I am using GCC + the terminal to make an array of prime numbers.
I once asked on #[email protected], but I still don't understand:
An int can store values on 32 bits (so a total of 2^32 unique values), but can't an array have more than 2^24 values ?
I'm not sure, but is http://stackoverflow.com/questions/2318278/why-24-bits-registers...
I'm having a lot of trouble getting my compiled assembly file working on SPIM. Basically I want to write a c++ file, and then generate a .s file that I can open in SPIM without error. This means that the assembly must be in MIPS32 ABI using MIPS I instructions (some MIPS II). How do I do this? Right now I'm using g++ but I'm having m...
I want to replace one line of code in 3d party API with my own code.
I mean this is questionable practice but I need to fix their bug (the idiots call ResolveDNS on every method call which writes to TCP socket - what they were going to achieve with it?) which results in untolerable lags. I want to cache DNS name in static field and scr...
physical address=16*selector+offset
but i don't know why multiplying 16 by selector?
...
Newbie ARM assembler question. I am writing my first arm assembler program and I am trying to code this C fragment.
int x = somevalue1 << 12; // s19.12
int y = somevalue2 << 12; // s19.12
int a = somevalue3 << 12; // s19.12
int b = somevalue4 << 12; // s19.12
int c = somevalue4 << 12; // s19.12
long long acc = (long long) a * b;...
Hi,
After a lot of internet research I implemented a small assembler routine in my C++ program to get the CPU's L1 cache size using cpuid.
int CPUID_getL1CacheSize() {
int l1CacheSize = -1;
asm ( "mov $5, %%eax\n\t" // EAX=80000005h: L1 Cache and TLB Identifiers
"cpuid\n\t"
"mov %%eax, %0" // eax i...
I'm trying to use the bios video interrupt to display a character on the screen.
The following is the assembly code:
mov $0x0A, %AH
mov $0x68, %AL ; to display character 'h'
int $0x10
I assembled this code using GNU assembler to produce an object file called sample.o
The total size of sample.o is 449 bytes. Now I manually write to th...
I'm using libmpeg2 for showing video in my pocket pc project. Last release of this lib has acceleration for ARM processor, some of the functions are rewritten in arm assembly (in separate file motion_comp_arm_s.S).
The problem is armasm from Visual Studio 9 cant compile it, producing a lot of errors. My question is, which arm assembly c...
It appears the general logic for prefetch usage is that prefetch can be added, provided the code is busy in processing until the prefetch instruction completes its operation. But, it seems that if too much of prefetch instructions are used, then it would impact the performance of the system. I find that we need to first have the working ...
Hello,
I cannot say I finished learning reverse engineering because its a skill that improves with practice. Basically, I now know how to reverse engineer things. I followed the book "Reversing: Secrets of reverse engineering". I did some hands on practice.
I know there are http://www.crackmes.de/ & http://www.reversing.be/ for practic...
Hi, I'd like to know if someone can explain me the solution to this problem:
the code is:
#include <stdio.h>
#include <stdlib.h>
typedef struct {
int c[20];
int n;
} t_coda;
t_coda coda;
void init(t_coda *coda) {
coda->n = 0;
}
void add(t_coda *coda, int x) {
if (coda->n < 20)
coda->c[(coda->n)++] = ...
I want to learn 32-bit assembly. I got some programming background, mostly high-level languages but also 16-bit ASM.
I want to write real simple console applications for Windows (I remember something vague about some difference between Windows and Linux, maybe just when creating graphical applications?).
Any ideas where to start?
...
I'm building a program for ARM Linux using GAS, but I want to do some macros to make my development some more smart. Then I want to know:
How could I do a macro for this: (x+y*240)*2, were x and y are int, that will be used like this:
mov r0, MACRO_SHOULD_BE_CALLED_HERE
And how could I do a macro that should be called like this:
JUS...
I'm building a boot loader that boots the content that is located at the 1000h part of the floppy. I was doing that using Fasm(because my friend only uses Fasm, and he was helping me with this), but I prefer to use Nasm, and now I'm having problems with the syntax, then I want to know how could I do this in Nasm:
org 7C00h
%include ...
I am looking at some existing real-mode code that uses the in and out assembly instruction.
I recognize a few, but I don't know what most of the different ports in the instructions are related to.
Is there a list of what the different I/O ports refer to?
...
#define CANCEL_COMMON_DIALOG_HOOK(name) \
void __declspec(naked) ##name##CancelCommonDialogHook(void) \
{ \
__asm \
{ \
add esp, [k##name##CancelCommonDialogStackOffset] \
jz RESTORE \
jmp [k##name##CancelCommonDialogNewFileRetnAddr] \
RESTORE: \
pushad \
call ...
So, while using IDA to disassemble a dll, I came across this class function:
mov eax, [ecx+4]
mov eax, [eax]
retn
I know ecx means this and eax is the return value, but I fail to understand what it returns. Any help?
...
This is/was for assignment four of From NAND to Tetris, and OCW from Hebrew University (I don't attend, I'm just doing the course for kicks). What it does is, when any key is held down, it blackens out every pixel. When the key is released, the "screen" is cleared.
Here's the ROM itself:
// Fill.asm
// Fills the 'screen' with black,...
I'm making a protected-mode OS based on Intel's x86 architecture, and was looking for some information on how to power off the computer via assembly code, or something like that. Could you help me with this problem?
...
Hi there,
Is the width of the stack 8 bit wide for IA32 architecture and for all types microprocessors/microcontrollers.
I am currently reading http://ozark.hendrix.edu/~burch/csbsju/cs/350/handouts/x86.html about assembly language. At the explanation of "call" it says that the stack pointer is being decreased by 4 and the program cou...