ast01

ast01 - ; Note, The result is stored in DX:AX, but only ;...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
; assembly language, basic computation a .model medium .486 . ; ---------------------------------------------- .data . num1 dw 13 num2 dw 15 num3 dw 6 num4 dw 9 res1 dw ? res2 dw ? res3 dw ? res4 dw ? res5 dw ? res6 dw ? res7 dw ? rem7 dw ? res8 dw ? rem8 dw ? ; ---------------------------------------------- ; .stack . .code . main proc far mov ax, @data mov ds, ax m ; ---------- ; Example additions E ; Calculate: res1 = num1 + num3 C mov ax, num1 add ax, num3 mov res1, ax r ; Calculate: res2 = num2 + num4 C mov ax, num2 add ax, num4 mov res2, ax r ; ---------- ; Example subtractions E ; Calculate: res3 = num1 - num3 C mov ax, num1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
sub ax, num3 mov res3, ax r ; Calculate: res4 = num2 - num4 C mov ax, num2 sub ax, num4 mov res4, ax r ; ---------- ; Example multiplications
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ; Note, The result is stored in DX:AX, but only ; AX is saved since these are small values A ; Calculate: res5 = num1 * num3 C mov ax, num1 imul num3 mov res5, ax r ; Calculate: res6 = num2 * num4 C mov ax, num2 imul num4 mov res6, ax r ; ----------; Example divisions E ; Calculate: res7 = num1 / num3 C mov ax, num1 cwd idiv num3 mov res7, ax mov rem7, dx r ; Calculate: res8 = num2 / num4 C mov ax, num2 cwd idiv num4 mov res8, ax mov rem8, dx r ; ----------; Done, terminate program. D last: mov ah, 4ch int 21h main endp m end main e...
View Full Document

Page1 / 2

ast01 - ; Note, The result is stored in DX:AX, but only ;...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online