0

I am learning Assembly language for my studies, and just tested the same program (as shown below) in emu8086 and DOSBox

Below used in emu8086

    org 100h
    MOV AX,1234h
    MOV BX,5678h
    MOV CX,9ABCh
    MOV DX,DEF0h
    ADD BX,DX
    ADC AX,CX
    ret

Below used in DOSBox Debug mode

    MOV AX,1234
    MOV BX,5678
    MOV CX,9ABC
    MOV DX,DEF0
    ADD BX,DX
    ADC AX,CX

DOSBox runs fine and produces the result as AX=ACF1, BX=3568,CX=9ABC,DX=DEF0.

However, the one in emu8086 doesn't run at MOV DX,DEF0h and gives:

(5) wrong parameters: MOV  DX,DEF0h
(5) probably no zero prefix for hex; or no 'h' suffix; or wrong addressing; or undefined var: DEF0h 

I couldn't identify the error(s) and so here I am to seek for advice. Appreciate any feedback :)

sesame
  • 15
  • 6
  • 2
    Like the message says: ‘probably no zero prefix for hex’. Use `0DEF0h`. – user3840170 Jun 08 '21 at 13:16
  • I see, so the hex value should always start with a digit as explained [here](https://stackoverflow.com/a/33276304/13596315) , but may i know why dosbox supports hex value that begins with letter eventho they both are emulator for x86? – sesame Jun 08 '21 at 13:32
  • DOSBox is not an assembler. What are you talking about? – user3840170 Jun 08 '21 at 13:52
  • 1
    It appears you're using a DOS Debug application in DOSBox. Debug traditionally defaults to hexadecimal numeric input and does determine that a number is used differently from a full fledged assembler. This is in part related to the fact that it doesn't support symbols. – ecm Jun 08 '21 at 16:33
  • yes, I used a DOS debug app in DOSBox, I should've stated it in the post, many thx to both of you – sesame Jun 09 '21 at 00:58

0 Answers0