I am writing a very simple program that subtracts 16 bit integers. After the subtractions I want to view the registers' final values by using DumpRegs. The information displayed seems accurate for EAX, but EBX and ECX have values that don't seem to be correct. Why is this so?
TITLE Subtract Three (subtractThree.asm) ;Description: ; This program subtracts 3 integers using only 16 bit registers. INCLUDE Irvine32.inc .code main PROC mov ax,8000h ;ax = 8000h mov bx,2000h ;bx = 2000h mov cx,3000h ;cx = 3000h sub ax,bx ;subtract bx from ax, ax = 6000h sub ax,cx ;subtract cx from ax, ax = 3000h sub cx,bx ;subtract bx from cx, cx = 1000h call DumpRegs ;display registers exit ;halt program main ENDP ;end procedure END main ;end program
Here is the output...
EAX=00003000 EBX=7FFD2000 ECX=00121000 EDX=7C90E514
ESI=01CB4228 EDI=D8DB1C09 EBP=0012FFF0 ESP=0012FFC4
EIP=0040102A EFL=00000206 CF=0 SF=0 ZF=0 OF=0 AF=0 PF=1
Press any key to continue . . .