Message board for the users of flat assembler.
> Main > ES:BX Explanation Needed!
leo128 04 Aug 2006, 15:50
I'm trying to use int 13h, function 02h --> Read disk sectors.
this is the description I've found on internet:
Function 02h: Read Disk Sectors
This function reads disk sectors using CHS format. This can be either a floppy diskette or a hard disk.
On input, the CHS values are contained in the following registers:
AH = function number, 02h in this case
AL = number of sectors to read (must be nonzero)
CH = low 8 bits of cylinder number
CL = high 2 bits of cylinder number and 6-bit sector number as follows:
high-order bits 6-7 (hard disk only) contain high 2 bits of cylinder number
low-order bits 0-5 contain sector number (1-63)
DH = head number
DL = drive number (bit 7 set for hard disk)
ES:BX = data buffer
the problem is... what does EX:BX mean? I'm new to ASM, I use "flat assembler"
I mean, in general, somebody would give me a hint on using the ES register? what does the column between ES and BX stand for? which is the correct sintax for flat assembler?
Or... a good tutorial about this?
|04 Aug 2006, 15:50||
HyperVista 04 Aug 2006, 19:45
ES stands for Extra Segment and is one of a handful of segment registers and can be used to specify a location in memory. The colon between ES and BX (ES:BX) denotes the standard segment:off-set address notation. In otherwords, ES:BX specifies a memory location that is the value contained in BX "distance" from the start of the segment ES.
|04 Aug 2006, 19:45||
leo128 05 Aug 2006, 19:22
All Right! Thank you!
So, let see if I got it...
CS --> Code segment (points to a segment in which the program code resides)
DS --> Data segment (points to a segment in which the program is expected to store its data)
ES --> Extra segment register used for addressing memory without modifying other registers, for example DS.
so, if I make ES match CS, I can read data from disk and tell int 13 to store data in the code segment, and I have to pay attention not to overwrite the program code itself...
so, actually, because I'm not yet an expert ASMer, I tried
mov ax, cs
mov es, ax
and it worked fine... so at the moment I use labels to make room for my data. anyway, I think I could have done this with any other memory segment (like DS...) to make it accessible via ES.
is all this right? did I get it? I hope so...
anyway... my interrupt 13 call seems to work fine now, except that it fails returning an error code in AH (code = 80h, which seems to mean "Disk Timeout"). When I issue the int 13 call, the MS-DOS 16 bit subsystem of windows XP tells me that int 13 is unsupported, and the application might not work as expected. I just click "Ignore" and it goes stright to the failure (CF = 1, AH = 80h)
so my doubt is... can I use int 13h, function 02h in my environment, or I'll have to do something, like install windows 98 or MS-DOS 6.22 ???
maybe I passed it wrong cyl/head/sect parameters...
or even... do I have to use another interrupt ???
thank you again!!!
|05 Aug 2006, 19:22||
DOS386 22 Dec 2006, 02:58
Accidentally found this (OK, not newest) thread with open questions.
DOS. FreeDOS or Enhanced DR-DOS
Install DOS first. Also, CHS works up to 8 GB maximal.
NO. Use this one but be careful not to overwrite something on the HD.
Bug Nr.: 12345
Title: Hello World program compiles to 100 KB !!!
Status: Closed: NOT a Bug
|22 Dec 2006, 02:58||
< Last Thread | Next Thread >
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.