flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Hayden 24 May 2007, 03:34
you should have used
Code: mov al, byte [dx] dx specifies the offset, and byte specifies to move a byte further more, you should also specify the segment Code: mov al, byte [ds:dx] ; moves a byte from ds:dx into al the 32bit version would be Code: mov al, byte [ds:edx] _________________ New User.. Hayden McKay. |
|||
![]() |
|
Enko 24 May 2007, 19:54
Thanks a lot
Quote:
I think I tried it but can't remember now very well. Quote:
This thing was making me a lot of problems. Great!!! |
|||
![]() |
|
mikegonta 24 May 2007, 21:12
[ Post removed by author. ]
Last edited by mikegonta on 27 Jan 2009, 21:57; edited 2 times in total |
|||
![]() |
|
Goplat 25 May 2007, 00:13
Hayden wrote: you should have used It doesn't make any difference - fasm already knows the memory operand is a byte, because the destination is the byte-sized register AL. Quote: further more, you should also specify the segment Again, doesn't make any difference - the DS: segment is the default for memory accesses, unless you're using BP/EBP/ESP as the base register. Anyway, it's dangerous to be using 32-bit addressing like "mov al,[edx]" if you don't know what's in the high word of EDX. If it isn't zero, then the address will exceed the segment limit (always 0FFFFh in real mode) and cause a general protection fault. You could of course just change the "xor dx,dx" to "xor edx,edx", but in a boot sector you want to keep things small so it's better to just avoid 32-bit stuff. I would suggest using the SI register to point to the message, that way you can use the LODSB instruction and save a couple more bytes. |
|||
![]() |
|
mikegonta 25 May 2007, 01:22
[ Post removed by author. ]
Last edited by mikegonta on 27 Jan 2009, 21:57; edited 1 time in total |
|||
![]() |
|
Goplat 25 May 2007, 15:24
By entering protected mode you lose the ability to call the BIOS, so how would you load the operating system? 512 bytes is rather small for putting disk drivers in.
|
|||
![]() |
|
Adam Kachwalla 26 May 2007, 11:06
Enko wrote:
AX, BX, CX, and DX have special meanings (ignore the fact that they seem to be derived from consecutive letters of the alphabet): [b]BX = Base Register. This is used to store addresses (which is why only MOV AL, [BX] works - BX is used as a base address register and is designed for that purpose). Enko wrote: I just used edx and it worked, tryed it in Virual PC. You will find that under a 286 or earlier processor, the system will do unpredictable things as the extended registers are only used in the 386 or greater. FASM doesn't know that EAX, EBX, ECX, and EDX cannot be used under 16-bit processors as they do not exist. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.