Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data segment
- a dw ?
- b dw 9
- nmb db ?
- pnt dw 0h
- answer db 0h
- aa dw ?
- bb dw ?
- data ends
- code segment
- assume cs:code, ds:data
- main: mov dx, data
- mov ds, dx
- mov dx, 0B800h
- mov es, dx
- xor di, di
- jmp start
- outp_n:
- mov di, 80*2
- mov ax, 0730h
- add al, nmb
- add di, pnt
- mov es:[di], ax
- ret
- start: xor dx, dx
- mov ax, 0720h
- mov cx, 80*25
- rep stosw
- xor di, di
- mov cx, 02h
- inloop: in al, 60h
- cmp al, bl
- je inloop
- mov bl, al
- cmp al, 01h
- jne NotEsc
- jmp quit
- NotEsc: cmp al, 0Bh
- jne Not0
- mov a, 0
- mov es:[di], 0730h
- jmp NxtNum
- Not0: cmp al, 02h
- jne Not1
- mov a, 1
- mov es:[di], 0731h
- jmp NxtNum
- Not1: cmp al, 03h
- jne Not2
- mov a, 2
- mov es:[di], 0732h
- jmp NxtNum
- Not2: cmp al, 04h
- jne Not3
- mov a, 3
- mov es:[di], 0733h
- jmp NxtNum
- Not3: cmp al, 05h
- jne Not4
- mov a, 4
- mov es:[di], 0734h
- jmp NxtNum
- Not4: cmp al, 06h
- jne Not5
- mov a, 5
- mov es:[di], 0735h
- jmp NxtNum
- Not5: cmp al, 07h
- jne Not6
- mov a, 6
- mov es:[di], 0736h
- jmp NxtNum
- Not6: cmp al, 08h
- jne Not7
- mov a, 7
- mov es:[di], 0737h
- jmp NxtNum
- Not7: cmp al, 09h
- jne Not8
- mov a, 8
- mov es:[di], 0738h
- jmp NxtNum
- Not8: cmp al, 0Ah
- jne Not9
- mov a, 9
- mov es:[di], 0739h
- jmp NxtNum
- Not9: jmp inloop
- NxtNum:
- mov aa, ax
- mov bb, bx
- mov bl, 0Ah
- mov al, answer
- mul bl
- add ax, a
- mov answer, al
- mov ax, aa
- mov bx, bb
- inc di
- inc di
- dec cx
- jnz Not9
- mov ax, 0h ;Вывод числа в десятичном виде
- mov al, answer
- add ax, b
- mov bl, 0Ah
- div bl
- mov nmb, al
- mov bl, ah
- call outp_n
- add pnt, 2
- mov nmb, bl
- call outp_n
- pause: in al, 60h
- cmp al, 01h
- jne pause
- quit: mov ax, 4C00h
- int 21h
- code ends
- end main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement