YJDoc2 / 8086-emulator-web

Repository for 8086 emulator web implementation
Apache License 2.0
227 stars 26 forks source link

INT 21H writing data to memory +1, amount of chars 1 short #33

Open digitalandrew opened 11 months ago

digitalandrew commented 11 months ago

If I run the following code: start: MOV DX, 0x00 MOV AH, 0x0A INT 0x21

And at the interrupt enter 123

I would expect the memory starting at 0 to look something like:

03,31,32,33

Where the first byte stores the number of chars read and then the remaining 3 are the data.

Instead I get the following in the memory starting at 0:

00,02,31,32,33

Even though DX is pointing to 0x00 the data is written starting at 0x01, also the amount of chars appears to be 0 indexed so is 1 lower than the actual amount written.

This can be a bit of an annoyance if you want to print out a string you receive through the interrupt as you need to increment the value read for the amount of chars and remember to add one to memory location of wherever you wrote to.