1 ;----------------------------------------------------------;
2 ; BOS 0.04 Christoffer Bubach, 2004-2005. ;
3 ;----------------------------------------------------------;
5 ; VGA functions. Change video mode etc. ;
7 ;----------------------------------------------------------;
14 palette256 db 00, 00, 00, 00, 10, 41, 12, 28, 18, 02, 43, 22, 35
15 db 19, 09, 58, 00, 00, 57, 35, 12, 43, 43, 47, 24, 24
16 db 28, 20, 24, 60, 10, 60, 15, 31, 47, 63, 62, 56, 20
17 db 60, 56, 22, 63, 61, 36, 63, 63, 63, 00, 00, 00, 05
18 db 05, 05, 08, 08, 08, 11, 11, 11, 14, 14, 14, 17, 17
19 db 17, 20, 20, 20, 24, 24, 24, 28, 28, 28, 32, 32, 32
20 db 36, 36, 36, 40, 40, 40, 45, 45, 45, 50, 50, 50, 56
21 db 56, 56, 63, 63, 63, 13, 12, 15, 15, 16, 22, 17, 20
22 db 29, 19, 24, 36, 21, 28, 43, 23, 31, 50, 25, 34, 57
23 db 26, 42, 63, 00, 15, 02, 01, 22, 04, 02, 29, 06, 03
24 db 36, 08, 04, 43, 10, 05, 50, 12, 06, 57, 14, 20, 63
25 db 40, 18, 06, 07, 25, 12, 11, 33, 17, 14, 40, 23, 18
26 db 48, 28, 21, 55, 34, 25, 62, 39, 27, 63, 48, 36, 15
27 db 03, 02, 22, 06, 04, 29, 09, 06, 36, 12, 08, 43, 15
28 db 10, 50, 18, 12, 57, 21, 14, 63, 28, 20, 15, 00, 00
29 db 22, 07, 00, 29, 15, 00, 36, 23, 00, 43, 31, 00, 50
30 db 39, 00, 57, 47, 00, 63, 55, 00, 15, 05, 03, 22, 11
31 db 07, 29, 17, 11, 36, 23, 15, 43, 29, 19, 50, 35, 23
32 db 57, 41, 27, 63, 53, 34, 28, 14, 12, 33, 20, 14, 38
33 db 26, 16, 43, 32, 18, 48, 38, 20, 53, 44, 22, 58, 50
34 db 24, 63, 56, 30, 05, 05, 06, 10, 10, 13, 15, 15, 20
35 db 20, 20, 27, 25, 25, 34, 30, 30, 41, 35, 35, 48, 44
36 db 44, 63, 03, 06, 05, 05, 11, 09, 07, 16, 13, 09, 21
37 db 17, 11, 26, 21, 13, 31, 25, 15, 36, 29, 20, 48, 38
38 db 06, 06, 07, 13, 13, 15, 20, 20, 23, 27, 27, 31, 34
39 db 34, 39, 41, 41, 47, 48, 48, 55, 57, 57, 63, 06, 15
40 db 04, 12, 22, 08, 18, 29, 12, 24, 36, 16, 30, 43, 20
41 db 36, 50, 24, 42, 57, 28, 54, 63, 35, 15, 10, 10, 22
42 db 16, 16, 29, 21, 21, 36, 27, 27, 43, 32, 32, 50, 38
43 db 38, 57, 43, 43, 63, 54, 54, 15, 15, 06, 22, 22, 12
44 db 29, 29, 18, 36, 36, 24, 43, 43, 30, 50, 50, 36, 57
45 db 57, 42, 63, 63, 54, 02, 04, 14, 06, 12, 21, 10, 20
46 db 28, 14, 28, 35, 18, 36, 42, 22, 44, 49, 26, 52, 56
47 db 36, 63, 63, 18, 04, 14, 24, 08, 21, 31, 12, 28, 37
48 db 16, 35, 44, 20, 42, 50, 24, 49, 57, 28, 56, 63, 38
49 db 63, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
50 db 00, 00, 00, 00, 00, 00, 00, 00, 00, 53, 44, 22, 09
51 db 08, 12, 16, 14, 16, 22, 21, 20, 29, 27, 24, 35, 34
52 db 28, 42, 40, 32, 48, 47, 36, 57, 56, 43, 08, 12, 16
53 db 14, 16, 22, 21, 20, 29, 27, 24, 35, 34, 28, 42, 40
54 db 32, 48, 47, 36, 57, 56, 43, 63, 13, 09, 11, 21, 16
55 db 15, 27, 22, 18, 36, 29, 22, 42, 35, 25, 51, 42, 29
56 db 57, 48, 32, 63, 56, 39, 06, 14, 09, 12, 21, 14, 18
57 db 27, 22, 24, 33, 28, 30, 39, 36, 36, 46, 42, 42, 52
58 db 47, 50, 59, 53, 00, 00, 00, 00, 00, 00, 00, 00, 00
59 db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
60 db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
61 db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
62 db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
63 db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
64 db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
65 db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
66 db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
67 db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
68 db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
69 db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
70 db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
71 db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
72 db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
76 ;---------------------------------;
77 ; sets the screen to mode 0x03 ;
78 ;---------------------------------;
82 ;mov ax, 0x0003 ; "realmode ax", move to
83 ;shl eax, 16 ; the high part of eax
84 ;mov ax, 0x77 ; os function number for ints
87 ;mov eax, 0x00030077 ; or it could look like this.
90 mov ebx, 0x00100000 ; int no. in high part and
91 call rmode_int ; realmode bx in low part
97 ;---------------------------------;
98 ; sets the screen to mode 0x13 ;
99 ;---------------------------------;
104 mov eax, 0x00130000 ; realmode ax in high part
105 mov ebx, 0x00100000 ; int no. in high part and
106 call rmode_int ; realmode bx in low part
116 ;------------------------------------;
117 ; put a pixel at x, y with color ;
118 ; used only in mode 0x13 ;
125 ;------------------------------------;
132 mov edi, 0xa0000 ; directly to mem
148 ;-----------------------------------------------------;
149 ; put a sprite at x, y. only for mode 0x13 ;
151 ; input: ax = x, bx = y, cx = width, dx = height ;
152 ; esi = pointer to sprite ;
155 ;-----------------------------------------------------;
158 .row_loop: ; nightmare to write.
159 dec dx ; guess how many times
160 push cx ; i got lost in the push
161 push ax ; and pops here.. ;)
162 .col_loop: ; not to mention what
163 dec cx ; time it was when i wrote
186 ;---------------------------------------------;
187 ; sets the palette (256 colors) ;
189 ; input: esi = palette. ;
191 ;---------------------------------------------;
200 mov al, cl ; color no. = loop no.
203 mov al, byte [esi] ; red
206 mov al, byte [esi] ; green
209 mov al, byte [esi] ; blue