-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathk1.asm
51 lines (37 loc) · 768 Bytes
/
k1.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
;课程设计1
assume cs:code,ss:stack,ds:data
data segment
dw 1234
data ends
stack segment stack
db 128 dup(0)
stack ends
code segment
start: mov ax,stack ;set the stack
mov ss,ax
mov sp,128
mov ax,data
mov ds,ax
mov si,0 ;set the data source
mov ax,0B800H ;set the data destination
mov es,ax
mov di,160*10
add di,40*2
mov ax,ds:[si] ;set the dilidend
mov dx,0 ;clear the remainder
call short_div ;function
mov ax,4C00H
int 21H
;=========================================
short_div: mov cx,10
div cx
add dl,30H
mov es:[di],dl
mov cx,ax
jcxz short_divRet
mov dx,0 ;clear the remainder
sub di,2 ;back forward
jmp short_div
short_divRet: ret
code ends
end start