OpenCores
URL https://opencores.org/ocsvn/next186/next186/trunk

Subversion Repositories next186

[/] [next186/] [trunk/] [sample/] [mon/] [a.asm] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 ndumitrach
.186
2
.model tiny
3
.code
4
zero:
5
        org 24h
6
srecv label near
7
        org 100h
8
start:
9
        xor ax,ax
10
        mov es,ax
11
        mov word ptr es:[10h*4], offset int10
12
        mov es:[10h*4+2], cs
13
        mov word ptr es:[11h*4], offset int11
14
        mov es:[11h*4+2], cs
15
        mov ax,1
16
        mov ax,cs
17
        mov es,ax
18
 
19
newline:
20
        mov di, offset buf
21
        mov cx, 15
22
newchar:
23
        int 10h
24
        mov al,ah
25
        stosb
26
        int 11h
27
        cmp al,8
28
        jne nobs
29
        sub di,2
30
        cmp di,offset buf
31
        jae nobs
32
        mov di,offset buf
33
nobs:
34
        cmp al,13
35
        jz nc1
36
        loop newchar
37
        mov al,13
38
        stosb
39
        int 11h
40
nc1:
41
        mov byte ptr [di-1], 0
42
        mov si,offset buf
43
        cmp byte ptr [si],'d'
44
        jne nodump
45
 
46
        mov cx,8
47
        xor si,si
48
 dl1:
49
        mov dx,16
50
        push cx
51
        call dumpline
52
        mov al,13
53
        int 11h
54
        pop cx
55
        loop dl1
56
 
57
        jmp cr
58
nodump:
59
        call prtstr
60
        mov al, '?'
61
        int 11h
62
cr:
63
        mov al,13
64
        int 11h
65
        jmp newline
66
 
67
buf     db 16 dup(0)
68
 
69
;--------------------------------- receive char INT10 -----------------------------------
70
int10:  ; get RS232 char in ah
71
        push cx
72
        call srecv
73
        pop cx
74
        iret
75
 
76
;--------------------------------- send char INT11 -----------------------------------
77
int11:  ; write RS232 char from al
78
        push ax
79
        push cx
80
        out 0,al
81
        mov ah,1
82
        add ax,ax
83
int111:
84
        out 1,al
85
        mov cx,0adh;8bh;90h
86
even
87
        loop $
88
        shr ax,1
89
        jnz int111
90
        pop cx
91
        pop ax
92
        iret
93
 
94
;--------------------------------- print string at SI -----------------------------------
95
prtstr:
96
        lodsb
97
        test al,al
98
        jz prtstr1
99
        int 11h
100
        jmp prtstr
101
prtstr1:
102
        ret
103
 
104
;--------------------------------- print 4 digit hex number in ax -------------------------------
105
prthex4:
106
        xchg ah,al
107
        call prthex2
108
        mov al,ah
109
;--------------------------------- print 2 digit hex number in al -------------------------------
110
prthex2:
111
        mov bx, offset hexdigit
112
        push ax
113
        shr al,4
114
        xlat
115
        int 11h
116
        pop ax
117
        and al,15
118
        xlat
119
        int 11h
120
        ret
121
hexdigit db "0123456789ABCDEF"
122
 
123
;-------------------------------- dump DX bytes memory at DS:SI -------------------------------
124
dumpline:
125
        mov ax,ds
126
        call prthex4
127
        mov al, ':'
128
        int 11h
129
        mov ax,si
130
        call prthex4
131
        mov cx,dx
132
        mov al,' '
133
        int 11h
134
dump1:
135
        mov al, ' '
136
        int 11h
137
        lodsb
138
        call prthex2
139
        loop dump1
140
        mov cx,dx
141
        sub si,dx
142
        mov al,' '
143
        int 11h
144
        int 11h
145
dump2:
146
        lodsb
147
        sub al,32
148
        cmp al,128-32
149
        jb dump3
150
        mov al,'.'-32
151
dump3:  add al,32
152
        int 11h
153
        loop dump2
154
        ret
155
 
156
end start

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.