-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcode4_2.asm
90 lines (79 loc) · 1 KB
/
code4_2.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
; 2183310802
assume cs:code,ds:data,ss:stack
SAVE MACRO
local AA,BB
mov dx,bx
and dx,1111b
cmp dx,9
jna AA
add dx,55
jmp BB
AA:
or dl,30h
BB:
push dx
shr bx,cl
ENDM
data segment
ID db 31h,08h,02h
NUM dw 0
data ends
stack segment
dw 80 dup(0)
stack ends
code segment
main proc
mov ax,data
mov ds,ax
mov ax,stack
mov ss,ax
mov sp,80h
mov al,1CH
mov ah,35H
int 21H
mov ax,es
push ax
push bx
push ds
mov ax,seg COUNT
mov ds,ax
mov dx,offset COUNT
mov ax,251Ch
int 21h
pop ds
mov ah,07h
j:
int 21h
cmp al,'Q'
jne j
call DISPLAY
pop dx
pop ax
mov ds,ax
mov ax,251CH
int 21H
mov ax,4c00h
int 21h
DISPLAY:
mov bx,NUM
mov cx,4
SAVE
SAVE
SAVE
SAVE
I=0
REPT 4
pop dx
mov ah,02h
int 21h
ENDM
mov dl,'h'
int 21h
ret
main endp
COUNT proc near
inc NUM
iret
COUNT endp
code ends
end main