@@ -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'
185189render_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
598605curr_chrset_ptr long 0
599606curr_screen_ptr long 0
600607curr_colors_ptr long 0
608+ curr_screen_adv long 0
601609
602610TOGGLE_EMPTY long $0
603611TOGGLE_FRAME long $1
0 commit comments