-
Notifications
You must be signed in to change notification settings - Fork 1
/
bgl_rle.asm
68 lines (58 loc) · 1.11 KB
/
bgl_rle.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
org 100h
call bgl_init
mov word [bgl_buffer_offset],gfx
mov al,1
mov byte [bgl_background_colour],al
call bgl_flood_fill
loop:
mov word [bgl_buffer_offset],bg
call bgl_draw_full_gfx_rle
mov word [bgl_buffer_offset],gfx
mov ax,[x]
mov word [bgl_x_pos],ax
mov ax,[y]
mov word [bgl_y_pos],ax
call bgl_draw_gfx_rle
call bgl_wait_retrace
call bgl_write_buffer
.up: ; all worked first try ;)
cmp byte [up],0
je .down
dec word [y]
cmp word [y],0
ja .left
mov byte [up],0
jmp .left
.down:
inc word [y]
cmp word [y],200-96
jb .left
mov byte [up],1
.left:
cmp byte [left],0
je .right
dec word [x]
cmp word [x],0
ja .end
mov byte [left],0
jmp .end
.right:
inc word [x]
cmp word [x],320-96
jb .end
mov byte [left],1
.end:
mov al,[left]
mov byte [bgl_flip],al
jmp loop
%include "bgl.asm"
; the advantages of bgl's dodgy proprietary rle:
; original png is 1.38k
; raw gfx file is 9k (ouch)
; rle gfx file is 1.62k! not bad
gfx: incbin "hapi.rle"
bg: incbin "bgl_full.rle"
x dw (320/2)-(96/2)
y dw (200/2)-(96/2)
up db 0
left db 0