I'm having some slight trouble with my program, my program is supposed to multiply together two 1-byte integers, using repeated addition.
BITS 16 ;Set code generation to 16 bit mode
ORG 0x0100 ;Set code start address to 0100h
SEGMENT .text ;Main code segment
Main:
mov CX,[num2]
mov AX,00
Sum:
add AX,[num1]
dec CX
cmp CX,0
je Terminate
jmp Sum
Terminate:
mov DL,AL
mov AX,4C00H
int 21H
SEGMENT .data ;Initialised data segment
num1 db 4
num2 db 3
The problem is that when I debug my code, the initial value (num2) is entered into CX fine, however when num1 is entered into AX, there is still some leftover data from num2.
Eg.Debug
As you can see from the image the value put into CX (3) works fine, however instead of putting 4 into AX, it puts 304.
Thanks for your help in advance.