VOGONS


First post, by videogamer555

User metadata
Rank Member
Rank
Member

The code segment register modifier 0x8EC8 (which is the result of assembling the asm command "mov cs,ax") is supposed to transfer the 16bit value stored in the ax register into the cs register, but it's not working. In the the Dosbox Debugger, the debugging console is showing that it's producing the error "Unhandled opcode 8EC8". I believe this is a bug in DosBox, as it's supposed to be able to handle the entire x86 instruction set.

Reply 1 of 5, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

mov cs,ax is not an allowed opcode/operation.

Last edited by Qbix on 2017-01-05, 12:16. Edited 1 time in total.
Reason: remove unneeded link

Water flows down the stream
How to ask questions the smart way!

Reply 2 of 5, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

MOV CS,AX only works on an 8088, not on later processors, and DOSBox doesn't emulate 8088-specific behavior. The same is true of the POP CS instruction, where the 0Fh encoding became a prefix for a group of instructions on later processors.

Reply 5 of 5, by vladstamate

User metadata
Rank Oldbie
Rank
Oldbie

Something like this would work

MOV AX, your_new_cs_value
PUSH AX
MOV AX, offset_to_your_new_code
PUSH AX
RETF

The reason stuff like MOV CS, AX or POP CS were cut in later processor is because they are really broken since the prefetch queue still has data fetched from the old CS and it will end up with partially decoded instructions and it won't really behave (even on 8088/86) the way you would like to.

YouTube channel: https://www.youtube.com/channel/UC7HbC_nq8t1S9l7qGYL0mTA
Collection: http://www.digiloguemuseum.com/index.html
Emulator: https://sites.google.com/site/capex86/
Raytracer: https://sites.google.com/site/opaqueraytracer/