TITLE Subtraction (Sub.asm)
Comment !
Description: This program subtracts two 16-bit signed integers.
Insert a call DumpRegs statement to display the register values.
!
INCLUDE Irvine32.inc
.data
x SWORD 5000h
y SWORD 2000h
z SWORD 1000h
finalVal SWORD ?
.code
main PROC
sub eax, eax ; clear eax
sub ebx, ebx ; clear ebx
sub ecx, ecx ; clear ecx
mov ax, x ; load ax with 5000h
mov bx, y ; load bx with 2000h
mov cx, z ; load cx with 1000h
sub ax, bx ; subtract 2000h
sub ax, cx ; subtrack 1000h
mov finalVal, ax ; store the result (2000h)
call DumpRegs ; display the registers
exit
main ENDP
END main
|