flat assembler
Message board for the users of flat assembler.
Index
> DOS > the confusing part of registers to me |
Author |
|
GhostXoPCorp 14 Dec 2008, 04:22
ok now some unconfusing part of the question, say i put a number into ax and choose the base in bx, is it a mth type of relation ship, and if so could you give me any other registers that do stuff like that and what they do different.
|
|||
14 Dec 2008, 04:22 |
|
revolution 14 Dec 2008, 05:46
I'm not sure what you are asking. Registers are just temporary storage, similar to RAM but much faster. Some instructions use implicit registers (like loop, mul, div) but most instructions use explicit registers (like add, xor).
In 16-bit mode only some registers are valid for memory address: BX, SI, DI and BP (and some combinations with index+base). |
|||
14 Dec 2008, 05:46 |
|
GhostXoPCorp 14 Dec 2008, 06:21
well i mean
like al =letters to print mov si,var how does si have anything to do with al? maybe its lodsb well i dont know, if you still dont understand just leave it be, its probably a time wasting question on how something does what doesnt exist and only happens not because of what it is, but of what lodsb and cd:ds or something like that makes it happen. but eh, forget it _________________ Oh that divide overflow. Just jumps out of the bushes every time to scare the day lights out of me. |
|||
14 Dec 2008, 06:21 |
|
ManOfSteel 14 Dec 2008, 09:20
Of course "ax" and "si" have nothing to do with each others. If you move something into "ax" (e.g. mov ax,10), "si" will still hold its original contents because the "mov" instruction only modifies its first operand (the destination operand).
However, in certain cases, like when using string manipulation instructions (e.g. lods*), the CPU will use and/or modify more than one register for different purposes depending on the said instruction. You have to check the Intel manuals, and more precisely the "Software Developer's Manual, Instruction Set Reference". Quote:
And yes, one more thing, if the code contains an interruption (e.g. int 0x10), you can expect it to modify many registers. You definitely need to check Ralf Brown's reference or any other BIOS and DOS interruption reference. |
|||
14 Dec 2008, 09:20 |
|
GhostXoPCorp 14 Dec 2008, 15:33
for the last time, i have looked at the int list!!!! but about the ds:edi do i load my string into DS or EDI? to get lodsb working
|
|||
14 Dec 2008, 15:33 |
|
GhostXoPCorp 14 Dec 2008, 17:43
can someone please respond to this, i need an answer. it is very important
|
|||
14 Dec 2008, 17:43 |
|
asmcoder 14 Dec 2008, 19:25
[content deleted]
Last edited by asmcoder on 14 Aug 2009, 14:54; edited 1 time in total |
|||
14 Dec 2008, 19:25 |
|
LocoDelAssembly 14 Dec 2008, 19:38
Since this is the DOS forum he should bother with it. You should "load your string" into DS:SI for LODSx and I have no idea what the int list has to do with it. If you are writing a .COM executable and the string is defined inside the source you may follow asmcoder's advice (except that you must use SI register, not DI), but if you are scanning memory that doesn't exist at compile-time (i.e. run-time allocated memory), then DS must be set.
|
|||
14 Dec 2008, 19:38 |
|
GhostXoPCorp 14 Dec 2008, 19:45
thank you guys so much for responding to my message, i will try edi and ds. thanks!
_________________ Oh that divide overflow. Just jumps out of the bushes every time to scare the day lights out of me. |
|||
14 Dec 2008, 19:45 |
|
LocoDelAssembly 14 Dec 2008, 19:59
Hey, there is an errata in the Intel manuals, they say this (which I suppose it is the same ManOfSteel posted): "The source operand is a memory location, the address of which is read from the DS:EDI or the DS:SI registers (depending on the address-size attribute of the instruction, 32 or 16, espectively). The DS segment may be overridden with a segment override prefix."
That's wrong, and in the table above that paragraph there are no mentions about EDI (because the table is correct). The pseudo-code below also seems to be correct (again no EDI appearances). |
|||
14 Dec 2008, 19:59 |
|
GhostXoPCorp 14 Dec 2008, 20:13
so what do you mean? if i put something in ds it will end up in edi?
the code im using is use16 or is it load ds and it will end up in al, or something lik that? using lods of course. or correct me |
|||
14 Dec 2008, 20:13 |
|
LocoDelAssembly 14 Dec 2008, 20:17
Just EDI has nothing to do with any version of LODSx. With lodsb AL will be loaded with the contents of the memory location at DS:SI ([DS*16 + SI] physical address). Once AL is loaded, SI is incremented by one.
|
|||
14 Dec 2008, 20:17 |
|
GhostXoPCorp 14 Dec 2008, 20:41
so which register do i load my string for it to be good for lods to load it to al?
|
|||
14 Dec 2008, 20:41 |
|
revolution 14 Dec 2008, 20:46
GhostXoPCorp wrote: so which register do i load my string for it to be good for lods to load it to al? |
|||
14 Dec 2008, 20:46 |
|
GhostXoPCorp 14 Dec 2008, 20:51
thanks beacue what i want to do is put the string in si as the usr is typing to print what he or she is typing, and at the same time save what he or she typed in a register to cmp it for a match with other commands. when the user put types a then b it prints, but will si keep a and b as "ab" so i check it for cmp si, ab?
|
|||
14 Dec 2008, 20:51 |
|
revolution 14 Dec 2008, 20:55
You should keep the string of bytes in memory. A single 16-bit register can only store two byte maximum.
Code: mov [si],al ;save the entered key inc si ;point si to the next position in memory. |
|||
14 Dec 2008, 20:55 |
|
GhostXoPCorp 14 Dec 2008, 21:02
great, im building a 16 bit rm dos and it ca onl get 2 bytes, ok thanks for answering all of my questions on this thread. this pretty much sums it up
|
|||
14 Dec 2008, 21:02 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.