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
91
92
93
94
95
96
97
98
99
|
stack segment para stack
dw 128h dup (0)
stack ends
data segment
notfound db 'NOT FOUND!', 0dh, 0ah, '$'
io db 0dh, 0ah, 'IO ADDRESS IS: $'
data ends
code segment
assume cs:code, ss:stack, ds:data
start:
mov ax, data
mov ds, ax
mov ah, 0b1h
mov al, 2
mov cx, 9050h ; Device ID
mov dx, 10b5h ; Vender ID
mov si, 0
int 1ah
cmp ah, 0
jz got
mov dx, offset notfound
mov ah, 9
int 21h
jmp gout
got:
mov ax, bx
call disp
mov dl, 0ah
mov ah, 2
int 21h
mov dl, 0dh
int 21h
mov di, 0
loop1:
mov ax, 0b109h
int 1ah
mov ax, cx
call disp
mov dl, ' '
mov ah, 2
int 21h
inc di
inc di
cmp di, 40h
jl loop1
mov dx, offset io
mov ah, 9
int 21h
mov ax, 0b109h
mov di, 1ch ; base reg #3
int 1ah
and cx, 0fffeh
mov ax, cx
call disp
gout:
mov ah, 4ch
int 21h
disp proc near
push bx
push cx
mov bx, ax
mov cx, 4
lloop1:
mov ax, bx
call disp2
push cx
mov cl, 4
shl bx, cl
pop cx
loop lloop1
pop cx
pop bx
ret
disp endp
disp2 proc near
push dx
push cx
and ah, 0f0h
mov cl, 4
shr ah, cl
mov dl, ah
cmp dl, 9
jle num
add dl, 7
num:
add dl, 30h
mov ah, 02h
int 21h
pop cx
pop dx
ret
disp2 endp
code ends
end start
|