1 ; vi:filetype=nasm ts=8 sts=8 sw=8:
6 ; initializes the video hardware and graphics routines
8 ; clears the framebuffer (not vmem)
9 ; clobbers: eax, ecx, edi
11 ; copies the framebuffer to video memory
12 ; clobbers: eax, ecx, edi, esi
15 ; set_palette_entry(idx[al], r[ah], g[bl], b[bh])
23 REG_CRTC_STATUS equ 3dah
24 CRTC_VBLANK_BIT equ 08h
36 ; setup the spritesheet palette
37 mov esi, sprsheet_cmap
45 call set_palette_entry
49 ; force color 0 to black
52 call set_palette_entry
58 mov edi, FRAMEBUF_ADDR
66 mov esi, FRAMEBUF_ADDR
74 mov dx, REG_CRTC_STATUS
77 and al, CRTC_VBLANK_BIT
81 and al, CRTC_VBLANK_BIT
89 inc dx ; dx <- REG_DAC_DATA
102 ; slow_sprite(int id, int x, int y)
103 ; assumptions: 32x32, one after the other, 0 is transparent
110 mov eax, [ebp + 16] ; ax <- y
111 sub eax, 16 ; ax <- y - 16 (center sprite vertically)
115 add eax, ebx ; ax <- (y - 16) * 320
116 mov edi, [ebp + 12] ; di <- x
117 sub edi, 16 ; di <- x - 16 (center sprite horizontally)
118 add edi, eax ; di <- (y - 16) * 320 + (x - 16)
119 add edi, FRAMEBUF_ADDR
122 ; calculate sprite id offset (each spr is 32*32=1k)