The reference says the pseudo code for la (load address) is translated to:
Pseudo : la $1, Label
lui $1, Label[31:16]
ori $1,$1, label[15:0]
but when I try to assemble the code in MARS I get the error:
"Invalid language element: 16]
and if I remove the [31:16] part I get
"Label": operand is of incorrect type
Any idea?
...
I have to choose a thesis topic soon and I was considering implementing an operating system for an architecture that is not x86 (I'm leaning towards ARM or AVR). The reason I am avoiding x86 is because I would like to gain some experience with embedded platforms and I (possibly incorrectly) believe that the task may be easier when carrie...
From:
http://en.wikipedia.org/wiki/X86%5Fcalling%5Fconventions
push c
push b
push a
call function_name
add esp, 12 ;Stack clearing
mov x, eax
Why do we need to explicitly add 12 to ESP to clear the stack since the called function should have poped the parameters off the stack therefore restoring the stack pointer...?
Another questio...
How can you XOR the value stored in EAX?
The problem is at this line:
xor eax, key
EAX contains the address of the value i want to XOR. How can I accomplish this? I though it would be something along the lines of:
xor [eax], key
but that doesn't work (syntax error)
decrypt proc startAddress:DWORD , sizeOfSegment:DWORD , key:DWOR...
I want to save memory by converting an existing 32 bit counter to a 16 bit counter. This counter is atomically incremented/decremented. If I do this:
What instructions do I use for atomic_inc(uint16_t x) on x86/x86_64?
Is this reliable in multi-processor x86/x86_64 machines?
Is there a performance penalty to pay on any of these a...
I'm trying to code a exe packer/protector as a way of learning more about assembler, c++, and how PE files work. I've currently got it working so the section containing the EP is XORed with a key and a new section is created that contains my decryption code. Everything works out great except when I try and JMP to the original EP after de...
Back to the golden days of Assembly language.
As we know, assembly language is a low-level language with many hidden powers in it. If one can program well in it, many powerful and useful application can be developed from it.
Which was your best application or program that you have developed so far, or even one you are currently develo...
I saw the following question:
http://stackoverflow.com/questions/98944/how-to-generate-a-newline-in-a-cpp-macro
Let me give a brief requirement of a need in newline in a C++ preprocessor. Am working on ARM Realview compiler 3.1 on a code which uses embedded assembly code with C++ code.
#define DEFINE_FUNCTION(rtype, op, val) \
__as...
Hello!
I will be working on a big Assembly project but am now just starting to learn this new language. I am trying to make some simple examples like you might find for c++ in highschool (sum two numbers, is a number prime, etc).
Now I've got to display all prime numbers up to n. The problem is that the application freezes at "call pri...
I've been stuck with this for weeks now and have no idea where I'm going wrong because NASM hasn't given me any errors. The code is pretty self explanatory because of the comments.
this is the code that is loaded from the BIOS
;--------------------------------------------
; 'boot.asm'
; loaded from BIOS
[org 0x7C00]
[bits 16]
;...
I have a compiler which compiles assembly language to machine language (in memory).
My project is in c# .net.
Is there any way to run the memory on a thread?
How can DEP prevent it?
byte[] a:
01010101 10111010 00111010 10101011 ...
...
I have a small inline assembly code written in my C code.
The asm goes through an array and if needed, move values from a different array to a register.
In the end, an interrupt is called.
The code is similar to this:
cmp arrPointer[2],1h
jne EXIT
mov AX, shortArrPtr[2]
EXIT:
int 3h
This all work in x86 but according to microsoft: x64...
Hello,
I'm using MASM to build a download program, but the thing is that i don't know how to use a progress bar to show the progress of the download, i'm using URLDownloadToFile like this:
invoke URLDownloadToFile, NULL, chr$("http://masm32.masmcode.com/masm32/m32v10r.zip"), chr$("D:\test.zip"), 0, 0
Best Regards.
...
Hi,
I'm working in x86 assembly in 16bits.
I have three files that need to share 'variables between them' - basically, the data segment. When I compile them, as in the following:
ml file1.asm,file2.asm,file3.asm io.lib
They cannot access each other's variables
How do I share a data segment, and thus variables between the files?
Thank ...
Hi,
I am wondering how I would go about externalizing a proc (example below) so I can use it when compiling two separate file together
FOOBAR PROC
;do something
RET
FOOBAR ENDP
Thanks!
...
Hi,
I have two files,
in one I declare the variable SEED as such:
;file1.asm
.MODEL SMALL,BASIC
.FARDATA RAND_DATA
SEED DW ?
.CODE
;Some code
END
And in the other I try to reference the variable
;file2.asm
.MODEL SMALL,BASIC
EXTERNDEF SEED:WORD
FOO PROC FAR PUBLIC USES DX,DS
MOV SEED,DX
FOO ENDP
END
When ...
So, I am confused about how jump instructions work in an operating system. I thought that the jump instruction set the value in the processor's program counter. But programs can be run in various locations in memory. I see that in x86, there's the JMP EAX instruction, but my C++ code doesn't seem to use this. I compiled some C++ code in ...
I have just started a part time course and I have limited class time. I am really stuck on this question, any help solving it is greatly appreciated!
here's the question....
(a) write a subprogram which will take one argument, x, and return x*3 + 1. I.e. a Java
method would be
int fun(int x){
return x*3 + 1;
}
(b) Write a fragment o...
How do you allocate an array so it starts at certain place in memory? For example
.data
array:
.space 400
would make an array with 100 words, but I wish to let array start at, for example, 5000 in the memory. How can I do this? ( I remember in intel asm it being really easy)
edit: I am using spim in linux. btw does this rea...
I'm relatively(read: stupid newbie) familiar with disassembly but this bit stumped me:
I have a set of save files compressed with zlib and a game that loads them. Their structure is known and once loaded, the structs in memory are identical to their corresponding save files. The issue is that the game was written in an ass-backwards, scr...