flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
DOS386 06 Oct 2008, 06:18
Look at some Hello world programs and other examples and try to enhance them. Try some math:
Code: ; void main(void) ; NOT needed |
|||
![]() |
|
vid 06 Oct 2008, 09:44
iceman: I suggest starting with 32bit windows assembly, it is somewhat easier to grasp at the beginning than 16bit real mode (DOS) assembly.
I think looking into how instructions are encoded would explain a lot to you. For example why you can use certain combination of parameters, but not others, etc. In C#, you can do anything that makes sense syntax-wise, and compiler will translate it into series of step with desired results. But in assembly, you are not limited by "artificial" syntax. In assembly, every statement must correspond 1:1 to one CPU instruction, so you are limited by the processor architecture, not by the language. Because of that, you cannot do certain things which would make sense syntactically, like move from memory to memory directly ("mov [var1], [var2]"). Another new concept might be memory, which in assemby beheaves strictly like array of bytes. Closest to this was probably C, not sure how much you spent with it. This array is indexed by number called "offset" or simply "pointer". But, in assembly, this pointer is not anything special, like in C. It is just plain number like every else, and it's only on you whether you use the number for arithmetics, or as index to "memory array", or both. For example: Code: mov eax, 4 ;set EAX register to 4 mov ebx, [eax] ;read memory at address 4 to EBX mov ebx, [4] ;same as previous Another things which could be troublesome until explained is accessing various parts of register. For exampe EAX is 32 bit register, whose lower 16 bits are called AX. Lower 8 bits of AX is called AL, and upper 8 bits of AX is called AH. You can access these register parts directly: Code: mov eax, 0x12345678 ;EAX = 12345678 mov al, 0xAB ;EAX = 123456AB mov ah, 0xCD ;EAX = 1234CDAB mov ax, 0x0000 ;EAX = 12340000 |
|||
![]() |
|
iceman90289 07 Oct 2008, 02:05
ah ok. i see how eax works. thank you. that did help a lot.
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.