Skip to content

Commit 29ec0dd

Browse files
author
fredrikramsberg
committed
Option -i to add a loader showing a picture while loading the game.
1 parent 0636d79 commit 29ec0dd

File tree

4 files changed

+329
-34
lines changed

4 files changed

+329
-34
lines changed

asm/picloader.asm

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
; !to "picload.prg", cbm
2+
* = $801
3+
4+
loader_start = $334
5+
6+
!source "constants.asm"
7+
8+
; Basic line: "1 sys2061"
9+
!byte $0b, $08, $01,$00, $9e, $32, $30, $36, $31, 0, 0, 0
10+
11+
!zone picloader {
12+
13+
; Copy bitmap data
14+
15+
ldx #0
16+
.copy_bitmap
17+
lda loader_pic_start,x
18+
sta $e000,x
19+
inx
20+
bne .copy_bitmap
21+
inc .copy_bitmap + 2
22+
inc .copy_bitmap + 5
23+
bne .copy_bitmap ; Copies to $e000-$ffff, stops when target address is $0000
24+
25+
; Copy screen RAM and colour RAM
26+
27+
.copy_screen
28+
lda loader_pic_start + 8000,x
29+
sta $cc00,x
30+
lda loader_pic_start + 8000 + 250,x
31+
sta $cc00 + 250,x
32+
lda loader_pic_start + 8000 + 500,x
33+
sta $cc00 + 500,x
34+
lda loader_pic_start + 8000 + 750,x
35+
sta $cc00 + 750,x
36+
lda loader_pic_start + 8000 + 1000,x
37+
sta $d800,x
38+
lda loader_pic_start + 8000 + 1250,x
39+
sta $d800 + 250,x
40+
lda loader_pic_start + 8000 + 1500,x
41+
sta $d800 + 500,x
42+
lda loader_pic_start + 8000 + 1750,x
43+
sta $d800 + 750,x
44+
inx
45+
cpx #250
46+
bcc .copy_screen
47+
48+
49+
; Copy background colour
50+
lda loader_pic_start + 10000
51+
sta $d020
52+
sta $d021
53+
54+
; Show image
55+
56+
; Set bank
57+
lda $dd00
58+
and #%11111100
59+
sta $dd00
60+
61+
lda $d018
62+
; Set bitmap address to $e000
63+
ora #%00001000
64+
; Set screen address to $cc00
65+
and #%00001111
66+
ora #%00110000
67+
sta $d018
68+
69+
; Set graphics mode
70+
71+
lda $d011
72+
and #%10011111
73+
ora #%00100000
74+
sta $d011
75+
lda $d016
76+
and #%11101111
77+
ora #%00010000
78+
sta $d016
79+
80+
; Wait for <SPACE>
81+
;.getchar
82+
; jsr $ffe4
83+
; cmp #32
84+
; bne .getchar
85+
86+
; Copy loader
87+
88+
ldx #.end_of_loader - .loader - 1
89+
- lda .loader,x
90+
sta loader_start,x
91+
dex
92+
bpl -
93+
jmp loader_start;
94+
95+
.loader
96+
!pseudopc loader_start {
97+
lda #5
98+
ldx #<.filename
99+
ldy #>.filename
100+
jsr kernal_setnam
101+
lda #1 ; file number
102+
ldx $ba ; Device#
103+
ldy #1 ; $01 means: load to address stored in file
104+
jsr kernal_setlfs
105+
lda #$00 ; $00 means: load to memory (not verify)
106+
jsr kernal_load
107+
lda #1
108+
jsr kernal_close
109+
110+
; Hide image and set default graphics bank
111+
112+
; Set graphics mode
113+
114+
lda $d011
115+
and #%10011111
116+
sta $d011
117+
lda $d016
118+
and #%11101111
119+
sta $d016
120+
121+
; Set bank
122+
lda $dd00
123+
and #%11111100
124+
ora #%00000011
125+
sta $dd00
126+
127+
; Set screen address to $0400 and charmem to $d000
128+
lda #%00010100
129+
sta $d018
130+
131+
; Clear screen
132+
lda #147
133+
jsr kernal_printchar
134+
135+
; Add keys to run program into keyboard buffer
136+
lda #$52 ; r
137+
sta 631
138+
lda #$d5 ; U
139+
sta 632
140+
lda #13 ; Enter
141+
sta 633
142+
lda #3 ; 3 chars are now in keyboard buffer
143+
sta 198
144+
145+
; Set text colour to black
146+
lda #0
147+
sta 646
148+
149+
rts
150+
.filename
151+
!pet "story"
152+
}
153+
.end_of_loader
154+
} ; zone picloader
155+
156+
loader_pic_start
157+
158+
; !binary "loaderpic.kla",,2

0 commit comments

Comments
 (0)