-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathintro.ras
217 lines (171 loc) · 4.87 KB
/
intro.ras
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
program intro;
@VicMemoryConfig "all"
@ignoremethod "init16x8div"
@ignoremethod "init16x8mul"
@ignoremethod "init8x8div"
@ignoremethod "initrandom"
// Image in images/logo.flf
var
loader: string = "VAI";
fileName: pointer;
pressed: boolean;
// Size of image. Defined when creating and drawing the flf file
const imageWidth:byte = 20;
const imageHeight:byte = 20;
// Bitmap will be loaded as a charset
const charsetAndBitmap:address = $1400;
const colors:address = $2080;
i,j,k, time,t:byte;
zp: pointer;
charset : incbin("chr/title.bin", charsetAndBitmap);
charset_c : incbin("chr/title_color.bin", colors);
// Put all code at $2400
@startblock $0400 Code
procedure Boot();
var
fn: string ="BOOT";
fileNameb: pointer;
begin
fileNameb := #fn;
asm("
; KERNEL/BASIC ROM Routines
LOADB = $FFD5
SETLFSB = $FFBA
SETNAMB = $FFBD
RUNB = $1210
JMP mainb
bootb dc.b $01, $12
mainb LDA #$08 ; Logical file number
LDX #$08 ; Device number
LDY #$00 ; Secondary address
; $00 Load using specifed address
; $01 Load using original address from file
JSR SETLFSB ; Set above parameters
LDA #$04 ; Length of file name
LDX localVariable_Boot_fileNameb ; Low byte of file name location
LDY localVariable_Boot_fileNameb+1 ; High byte of file name location
JSR SETNAMB ; Set the name
LDA #$00 ; Load = 0, Verify = 1
LDX bootb ; Low byte of start address
LDY bootb+1 ; High byte of start address
JSR LOADB ; Perform load
BCS mainb ; Jump to error handler if error
JMP RUNB
");
end;
@endblock
@startblock $2600 Code
procedure LoadFile(addr: integer);
var
len: byte;
fn: integer;
begin
len := 3;
asm("
; KERNEL/BASIC ROM Routines
LOAD = $FFD5
SETLFS = $FFBA
SETNAM = $FFBD
main LDA #$08 ; Logical file number
LDX #$08 ; Device number
LDY #$00 ; Secondary address
; $00 Load using specifed address
; $01 Load using original address from file
JSR SETLFS ; Set above parameters
LDA localVariable_LoadFile_len ; Length of file name
LDX fileName ; Low byte of file name location
LDY fileName+1 ; High byte of file name location
JSR SETNAM ; Set the name
LDA #$00 ; Load = 0, Verify = 1
LDX localVariable_LoadFile_addr ; Low byte of start address
LDY localVariable_LoadFile_addr+1 ; High byte of start address
JSR LOAD ; Perform load
BCS main ; Jump to error handler if error
");
end;
// Copy color data from bitmap data
procedure CopyImageColor();
begin
/*
zp:=#charset_c;
moveto(0,0,$94);
for i:=0 to 0 do
screenmemory[i]:=zp[i];
*/
zp:=#charset_c;
moveto(0,0,$94);
for j:=0 to imageHeight do begin
for i:=0 to imageWidth do begin
k:=zp[i] | zp[i+imageWidth];
screenmemory[i]:= k;
end;
screenmemory := screenmemory + imageWidth;
zp := zp + imageWidth;
end;
end;
procedure Main();
begin
fileName := #loader;
LoadFile($0400);
// Turn off interrupts so we won't be distrubed
// DisableVIC20IRQ();
// Background is PURPLE and BLACK
SCREEN_BG_COLOR:=BLACK*16;
// Auxilliary color is cyan
AUX_COLOR_AND_VOLUME:=WHITE*16;
// Screen to $1000
setscreenlocation($1000);
// Set charset location to where bitmap data is
setcharsetlocation(charsetAndBitmap);
// Set height of columns (-1, needs to be odd)
SCREEN_TEXT_HEIGHT:=imageHeight-1;
// Width of screen same as bitmap
SCREEN_TEXT_WIDTH:=imageWidth;
// Copy color data
CopyImageColor();
moveto(0,0,$10);
for i:=0 to 0 do
screenmemory[i]:=i;
pressed := false;
while(pressed = false) do begin
ReadJoy1();
i := getkey();
if (i = KEY_SPACE or i = KEY_RETURN) then
pressed := true;
if(joy1 & joy_fire = joy_fire) then
pressed := true;
end;
setcharsetlocation($8000);
VICCR5 := $c0;
VICCR2 := VICCR2 & $7F;
VICCR3 := VICCR3 & $FE;
moveto(0,0,$10);
for i:=0 to 0 do
screenmemory[i]:=$20;
moveto(0,0,$94);
for i:=0 to 19 do
screenmemory[i]:=$91;
moveto(0,0,$10);
printstring("LOADING...",0,10);
Boot();
/*
// After this, some random raster effect
while (true) do begin
time:=time+4;
t:=sine[time]/4+32;
waitforraster(t);
aux_color_and_volume:=black*16;
for i:=0 to 24 do begin
screen_bg_color:=blue;
waitnoraster(1);
end;
aux_color_and_volume:=purple*16;
screen_bg_color:=blue*16;
end;
*/
Loop();
end;
@endblock
begin
Main();
end.