27.3k views
1 vote
How to perform each instruction using DOSBox in DEBUG.

Encode the "block-move" program and show how it will be stored in memory at starting address 20016.

MOV AX, 2000H ; LOAD AX REGISTER
MOV DS, AX ; LOAD DATA SEGMENT ADDRESS
MOV SI, 100H ; LOAD SOURCE BLOCK POINTER
MOV DI, 120H ; LOAD DESTINATION BLOCK POINTER
MOV CX, 10H ; LOAD REPEAT COUNTER

NXTPT:
MOV AH, [SI] ; MOVE SOURCE BLOCK ELEMENT TO AH
MOV [DI], AH ; MOVE ELEMENT FROM AH TO DESTINATION BLOCK
INC SI ; INCREMENT SOURCE BLOCK POINTER
INC DI ; INCREMENT DESTINATION BLOCK POINTER
DEC CX ; DECREMENT REPEAT COUNTER
JNZ NXTPT ; JUMP TO NXTPT IF CX NOT EQUAL TO ZERO (NO OPERATION)

NOP ; NO OPERATION

1 Answer

7 votes

Final answer:

To perform each instruction using DOSBox in DEBUG and encode the 'block-move' program, you can follow the given code. This is how the 'block-move' program will be stored in memory at the starting address 20016.

Step-by-step explanation:

To perform each instruction using DOSBox in DEBUG and encode the 'block-move' program, you can follow the given code:

  1. Encode the instruction 'MOV AX, 2000H'. This moves the hex value 2000 into the AX register.
  2. Encode the instruction 'MOV DS, AX'. This moves the value in the AX register into the DS register.
  3. Encode the instruction 'MOV SI, 100H'. This moves the hex value 100 into the SI register.
  4. Encode the instruction 'MOV DI, 120H'. This moves the hex value 120 into the DI register.
  5. Encode the instruction 'MOV CX, 10H'. This moves the hex value 10 into the CX register.
  6. Encode the instruction 'NXTPT:'. This creates a label called 'NXTPT'.
  7. Encode the instruction 'MOV AH, [SI]'. This moves the value stored at the memory address pointed to by the SI register into the AH register.
  8. Encode the instruction 'MOV [DI], AH'. This moves the value in the AH register into the memory location pointed to by the DI register.
  9. Encode the instruction 'INC SI'. This increments the value in the SI register.
  10. Encode the instruction 'INC DI'. This increments the value in the DI register.
  11. Encode the instruction 'DEC CX'. This decrements the value in the CX register.
  12. Encode the instruction 'JNZ NXTPT'. This jumps to the label 'NXTPT' if the value in the CX register is not zero.
  13. Encode the instruction 'NOP'. This is a no-operation instruction.

This is how the 'block-move' program will be stored in memory at the starting address 20016.

User Vikasde
by
8.3k points