-
Notifications
You must be signed in to change notification settings - Fork 1
/
OUT.ASM
139 lines (127 loc) · 4.45 KB
/
OUT.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
.model tiny
.code
.286
;jumps
org 100h
Begin:
jmp Start
Chr DB 176,177,178,219,220,223,96,126,32
Pic DB 9Eh,53h,43h,33h,23h,13h,9Fh,95h,81h,95h,52h,0FFh,9Bh,52h,42h
DB 33h,23h,13h,9Fh,9Ah,81h,93h,51h,61h,92h,41h,91h,51h,92h,41h
DB 92h,52h,92h,41h,51h,62h,0FFh,99h,51h,41h,32h,22h,12h,9Fh,9Fh
DB 92h,81h,94h,41h,92h,41h,91h,41h,92h,41h,91h,41h,52h,41h,91h
DB 41h,0FFh,97h,51h,41h,31h,21h,11h,9Fh,9Ah,53h,99h,81h,95h,62h
DB 93h,61h,51h,41h,91h,61h,52h,92h,61h,0FFh,96h,41h,31h,21h,11h
DB 9Fh,9Dh,62h,42h,51h,96h,81h,95h,52h,9Bh,41h,0FFh,94h,51h,49h
DB 53h,9Dh,53h,48h,31h,21h,11h,95h,81h,93h,51h,61h,94h,52h,92h
DB 51h,62h,51h,91h,41h,0FFh,93h,51h,42h,62h,96h,63h,43h,53h,91h
DB 53h,43h,64h,95h,62h,41h,31h,21h,11h,94h,81h,93h,41h,94h,41h
DB 92h,41h,91h,41h,92h,41h,91h,41h,51h,0FFh,92h,43h,9Fh,63h,41h
DB 63h,9Fh,41h,31h,21h,11h,93h,81h,94h,63h,91h,61h,52h,61h,92h
DB 62h,0FFh,93h,43h,51h,99h,53h,61h,42h,61h,51h,61h,41h,31h,61h
DB 54h,98h,51h,42h,21h,11h,94h,81h,0FFh,93h,49h,32h,22h,12h,94h
DB 51h,41h,51h,92h,31h,21h,11h,4Ch,31h,21h,11h,94h,81h,9Dh,51h
DB 0FFh,93h,44h,32h,22h,12h,92h,52h,44h,31h,21h,91h,42h,31h,21h
DB 11h,93h,63h,47h,31h,21h,11h,94h,81h,9Ch,41h,91h,41h,93h,52h
DB 0FFh,93h,41h,31h,21h,12h,95h,51h,47h,31h,21h,91h,42h,32h,22h
DB 11h,92h,11h,94h,62h,41h,31h,21h,11h,95h,81h,94h,41h,94h,41h
DB 91h,41h,52h,41h,92h,41h,0FFh,94h,61h,93h,12h,91h,51h,48h,31h
DB 21h,92h,61h,91h,41h,32h,22h,11h,94h,13h,91h,31h,11h,97h,81h
DB 94h,41h,91h,41h,91h,41h,92h,61h,93h,41h,92h,63h,51h,0FFh,9Ah
DB 51h,42h,63h,53h,92h,62h,91h,41h,61h,51h,91h,53h,93h,11h,92h
DB 11h,9Bh,81h,95h,61h,91h,61h,9Ah,63h,0FFh,9Ah,52h,91h,41h,61h
DB 92h,21h,93h,61h,96h,61h,21h,92h,41h,61h,91h,52h,94h,81h,92h
DB 41h,93h,41h,92h,51h,63h,92h,41h,62h,51h,92h,53h,0FFh,9Bh,21h
DB 95h,61h,9Bh,61h,96h,21h,94h,81h,93h,41h,52h,41h,92h,41h,52h
DB 93h,41h,61h,41h,93h,41h,51h,0FFh,9Bh,61h,9Fh,99h,61h,94h,81h
DB 93h,41h,93h,41h,92h,41h,94h,61h,51h,91h,61h,51h,91h,41h,53h
DB 92h,51h,91h,51h,91h,61h,0FFh,9Fh,9Fh,9Bh,81h,9Bh,63h,0FFh,71h
DB 96h,41h,0FFh,71h,92h,41h,92h,61h,9Fh,93h,41h,64h,91h,41h,62h
DB 51h,92h,41h,61h,51h,95h,41h,92h,51h,91h,61h,96h,51h,9Fh,93h
DB 53h,0FFh,71h,92h,41h,97h,51h,61h,41h,51h,61h,41h,98h,41h,53h
DB 92h,41h,93h,41h,91h,41h,92h,41h,94h,41h,51h,61h,92h,41h,92h
DB 41h,93h,41h,93h,41h,62h,93h,41h,62h,51h,95h,42h,0FFh,71h,93h
DB 41h,95h,41h,92h,61h,93h,41h,97h,41h,95h,41h,93h,41h,91h,41h
DB 52h,61h,94h,41h,91h,41h,93h,41h,92h,41h,52h,91h,41h,52h,91h
DB 41h,62h,92h,41h,61h,41h,61h,95h,41h,0FFh,71h,94h,41h,9Fh,94h
DB 61h,95h,64h,9Fh,9Dh,63h,94h,61h,94h,52h
EndPic:
posx db 0
posy db 0
attr db 01h
Start:
mov ax,0003h
int 10h
mov dx,3D4h ; wylaczenie kursora tekstowego
mov ax,100Ah ; (przez porty)
out dx,ax
push 0b800h
pop es
mov si,offset Pic ; si = wskaznik do danych
mov cx,(EndPic-Pic)
xor ax,ax
xor bx,bx
AllDraw:
mov al,byte ptr cs:[si] ; al - licznik
cmp al,0ffh
jnz Continue
inc posy
mov posx,0
inc si
mov attr,01h
loop AllDraw
continue:
mov ah,al ; ah - znak
and al,0fh
push cx
xor ch,ch
mov cl,al
shr ah,4
mov al,ah
xor ah,ah
mov di,(offset chr)-1
add di,ax
mov dl,byte ptr cs:[di] ; dl-znak cl-licznik
cmp dl,126 ; czy zmienic atrybut
jnz next
mov attr,04h
Back:
inc si
pop cx
loop AllDraw
next:
cmp dl,96 ; czy zmienic atrybut
jnz Forward
mov attr,0eh
jmp back
Forward:
xor ax,ax
xor bx,bx
mov al,byte ptr posx
mov bl,byte ptr posy
; wypisanie znaku ax = x bx = y
Draw:
push ax
push bx
mov di,bx ; obliczenie ofsetu pamieci ekranu
shl bx,7 ; wg wzoru:
shl di,5 ; Ofs = Y * 160 + X * 2
add bx,di ; dodawanie...
shl ax,1 ; ... i przesuniecia bitowe sa szybsze
add ax,bx
mov di,ax
mov byte ptr es:[di],dl ; wypisz znak
mov dh,attr
mov byte ptr es:[di+1],dh ; postaw atrybut
pop bx ; przywroc rejsetry
pop ax
inc al ; zwieksz x
inc posx
loop Draw ; i powtorz
pop cx
inc si
loop alldraw
xor ax,ax
int 16h
ret
End Begin