masm - Subtract in assembly Language using a constant variable -
include irvine32.inc cr equ 13 lf equ 10 .data currentyear dword 2017 year dword ? yearmsg byte "enter year: ", 0 summsg byte "years have passed = ", cr, lf, 0 dig1 byte ? digsum byte ? .code main proc ; start call clrscr lea edx, year ; store call writestring call readdec ; input dig1 mov byte ptr year, al call crlf lea edx, yearmsg ; print "enter year: " call writestring call readdec ; input dig1 mov dig1, al call crlf mov al, byte ptr year ; digsum = year - dig1 sub al, dig1 mov digsum, al lea edx, summsg ; print "sum = "; digsum call writestring movzx eax, digsum call writedec call crlf exit ; stop main endp end main
my intention subtract year user inputs current year.
Comments
Post a Comment