1 ; vi:filetype=nasm ts=8 sts=8 sw=8:
6 ; initializes the video hardware and graphics routines
8 ; clears the framebuffer (not vmem)
11 ; copies the framebuffer to video memory
12 ; clobbers: ax, cx, di, si
15 ; set_palette_entry(idx[al], r[ah], g[bl], b[bh])
19 FRAMEBUF_SEG equ 09000h
21 REG_CRTC_STATUS equ 3dah
22 CRTC_VBLANK_BIT equ 08h
28 ; video mode 13h (320x200 8bpp)
33 ; setup the spritesheet palette
42 call set_palette_entry
75 mov dx, REG_CRTC_STATUS
78 and al, CRTC_VBLANK_BIT
82 and al, CRTC_VBLANK_BIT
90 inc dx ; dx <- REG_DAC_DATA
103 ; slow_sprite(short id, short x, short y)
104 ; assumptions: 32x32, one after the other, 0 is transparent
105 ; XXX sprsheet needs to go to its own segment
113 mov ax, [bp + 8] ; ax <- y
114 sub ax, 16 ; ax <- y - 16 (center sprite vertically)
118 add ax, bx ; ax <- (y - 16) * 320
119 mov di, [bp + 6] ; di <- x
120 sub di, 16 ; di <- x - 16 (center sprite horizontally)
121 add di, ax ; di <- (y - 16) * 320 + (x - 16)
123 mov si, sprsheet_tiles
124 ; calculate sprite id offset (each spr is 32*32=1k)