Created
November 30, 2019 06:52
-
-
Save alexsunday/8994f68086fcbb145dc0a8fdece58c30 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
assume cs:code,ds:data,ss:stack | |
data segment | |
dw 12213, 31361 | |
data ends | |
stack segment stack | |
db 128 dup (0) | |
stack ends | |
code segment | |
start: | |
; 栈 | |
mov ax, stack | |
mov ss, ax | |
mov sp, 128 | |
; 数据段 | |
mov ax, data | |
mov ds, ax | |
mov si, 0 | |
mov ax, 0B800H | |
mov es, ax | |
mov di, 160 * 10 + 40 * 2 | |
mov ax, ds:[0] | |
mov dx, 0 | |
call short_div | |
quit: | |
mov ax,4C00H | |
int 21H | |
short_div: | |
mov cx, 10 | |
div cx | |
add dl, 30H | |
mov es:[di + 0], dl | |
mov byte ptr es:[di + 1], 00000010B | |
mov cx, ax | |
jcxz shortDivEnd | |
mov dx, 0 | |
sub di, 2 | |
jmp short_div | |
shortDivEnd: | |
ret | |
code ends | |
end start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment