Skip to content

Commit b90d9f8

Browse files
committed
Add Propeller firmware and assembly example for bitmap mode
1 parent 8ee1dd5 commit b90d9f8

File tree

4 files changed

+1351
-18
lines changed

4 files changed

+1351
-18
lines changed

Spin/cody_line.spin

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,10 @@ if_z mov buffer_ptr, buffer2_ptr
181181
' line is fetched. Finally the character is blitted to the scanline buffer
182182
' using the current colors. (Adjustments are made for soft-scrolling when
183183
' scrolling is enabled.)
184+
'
185+
' In bitmap mode the layout is slightly different. Data is read as in
186+
' character mode, but the screen memory is arranged as a sequence of 1000
187+
' multicolor "characters" instead. The actual character memory is unused.
184188
'
185189
render_chars
186190
' Set up the output pointer taking into account the left "margin" for sprites
@@ -210,18 +214,22 @@ if_nz mov adjustv, scrollv
210214
nop
211215

212216
:load_offset mov screen_memory_offset, 0_0
213-
214-
' Calculate the locations in screen and color memory using the offset above
215-
mov curr_screen_ptr, scrmem_ptr
216-
add curr_screen_ptr, screen_memory_offset
217217

218+
' Calculate the locations in color and screen memory using the offset above
218219
mov curr_colors_ptr, colmem_ptr
219220
add curr_colors_ptr, screen_memory_offset
220-
221+
222+
test controlreg, #%00010000 wz
223+
if_z mov curr_screen_adv, #1
224+
if_nz mov curr_screen_adv, #8
225+
if_nz shl screen_memory_offset, #3
226+
227+
mov curr_screen_ptr, scrmem_ptr
228+
add curr_screen_ptr, screen_memory_offset
229+
221230
mov chars_remaining, #40
222231

223-
:char_loop
224-
rdbyte color_data, curr_colors_ptr
232+
:char_loop rdbyte color_data, curr_colors_ptr
225233

226234
shl color_data, #1
227235
add color_data, lookup_ptr
@@ -231,19 +239,18 @@ if_nz mov adjustv, scrollv
231239

232240
add curr_colors_ptr, #1
233241

234-
rdbyte source_ptr, curr_screen_ptr
235-
shl source_ptr, #3
236-
add source_ptr, chrset_ptr
242+
test controlreg, #%00010000 wz
243+
if_nz mov source_ptr, curr_screen_ptr
244+
if_z rdbyte source_ptr, curr_screen_ptr
245+
if_z shl source_ptr, #3
246+
if_z add source_ptr, chrset_ptr
237247
add source_ptr, char_offset_y
238-
239-
rdbyte pixel_data, source_ptr
240-
241248
add dest_ptr, #3
249+
rdbyte pixel_data, source_ptr
242250

243251
mov pixels_remaining, #4
244252

245-
:pixel_loop
246-
mov temp, pixel_data
253+
:pixel_loop mov temp, pixel_data
247254
and temp, #%11
248255

249256
shl temp, #3
@@ -258,7 +265,7 @@ if_nz mov adjustv, scrollv
258265
djnz pixels_remaining, #:pixel_loop
259266

260267
add dest_ptr, #5
261-
add curr_screen_ptr, #1
268+
add curr_screen_ptr, curr_screen_adv
262269

263270
djnz chars_remaining, #:char_loop
264271

@@ -598,6 +605,7 @@ temp long $0
598605
curr_chrset_ptr long 0
599606
curr_screen_ptr long 0
600607
curr_colors_ptr long 0
608+
curr_screen_adv long 0
601609

602610
TOGGLE_EMPTY long $0
603611
TOGGLE_FRAME long $1

Spin/cody_video.spin

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
' Bit 1 - If set, enables vertical scrolling (and reduces screen height by one row)
6666
' Bit 2 - If set, enables horizontal scrolling (and reduces screen width by two cols)
6767
' Bit 3 - If set, enables row effects.
68-
' Bit 4 - Unused.
68+
' Bit 4 - If set, enables bitmap mode.
6969
' Bit 5 - Unused.
7070
' Bit 6 - Unused.
7171
' Bit 7 - Unused.

Tass/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
all: codybasic.bin codybros.bin codycart.bin codyprog.bin codysid.bin
1+
all: codybasic.bin codybros.bin codycart.bin codyprog.bin codysid.bin codybitmap.bin
22

33
%.bin: %.asm
44
64tass --mw65c02 --nostart -o $@ $<

0 commit comments

Comments
 (0)