Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- org 100h
- start:
- mov ah, $09
- mov dx, prog_name
- int 21h
- mov ah, $02
- mov dx, 0x0D0A
- int 21h
- mov ah, $09
- mov dx, info_str
- int 21h
- mov ah, $02
- mov dx, 0x0D0A
- int 21h
- mov ah, $09
- mov dx, result_is
- int 21h
- mov ax, [a] ;ãðóçèì a â AX
- mov cx, [b] ;ãðóçèì b â CX
- sub ax, $08 ;îòíèìàåì îò à 8
- mul cx ;óìíîæàåì (a-8)*b, ðåçóëüòàò â DX:AX
- mov bx, [c] ;ãðóçèì â BX c
- add ax, bx ;ñêëàäûàåì (a-8)*b ñ c
- mov cx,[d] ;ãðóçèì â CX d
- add cx, $04 ;äîáàâëÿåì ê d 4
- div cx ;äåëèì AX íà CX (ò.å. (a-8)*b+c)/(d+4). ðåçóëüòàò â DX:AX
- mov [res],ax ;ñîõðàí¤åì ðåçóëüòàò (ìëàäøóþ ÷àñòü) â ÿ¾ res
- mov ax, [res]
- add ax, '0'
- mov bx,ax
- mov ah, $02
- mov dx,bx
- int 21h
- mov ah,$08
- int 21h
- ret
- prog_name db "This program calculates ((a-8)*b+c)/(d+4)$"
- info_str db "where a=1, b=3, c=3, d=2$"
- result_is db "result is equal to $"
- a dw 11h
- b dw 3h
- c dw 3h
- d dw 2h
- res dw 0h
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement