; *************************************************************************** ; *************************************************************************** ; ; blkmap.asm ; ; A map system based on 16x16 meta-tiles (aka "blocks", aka CHR/BLK/MAP). ; ; Copyright John Brandwood 2025. ; ; Distributed under the Boost Software License, Version 1.0. ; (See accompanying file LICENSE_1_0.txt or copy at ; http://www.boost.org/LICENSE_1_0.txt) ; ; *************************************************************************** ; *************************************************************************** ; ; The maximum X and Y size for blkmaps is 128 blocks (2048 pixels). ; ; The maximum total size for a blkmap is 16KBytes, which allows for maps up ; to 128x128 blocks (2048x2048 pixels). ; ; Huge multi-screen blkmaps are also supported (optionally). ; ; The maximum X and Y for multi-screen maps is 128 screens (32768 pixels). ; ; The maximum total size for a multi-screen map is 8KBytes, which allows for ; a total of 1024 screens. ; ; *************************************************************************** ; *************************************************************************** ; ; Include dependancies ... ; include "common.asm" ; Common helpers. include "vce.asm" ; Useful VCE routines. include "vdc.asm" ; Useful VCE routines. ; ; Support large blkmaps up to 16KBytes instead of the regular 8KBytes? ; ; The maximum X and Y size for regular blkmaps is 128 tiles (2048 pixels). ; ; This allows for individual maps up to 128x128 tiles (2048x2048 pixels) vs ; default limit of 128x64 or 64x128. ; .ifndef BLKMAP_LARGEMAP BLKMAP_LARGEMAP = 0 ; (0 or 1) .endif ; ; Support huge multi-screen maps, up to 32768 pixels wide/high? ; ; These are sectorized maps split into individual BAT-sized "screens", with ; a maximum of 1024 screens per map. ; ; The BAT size that is used when drawing *must* be the same as the BAT size ; that was chosen when creating the multi-screen map. ; ; Each screen can use a unique set of block definitions, or it might choose ; to share the same block definitions that are used on another screen. ; ; Each screen may choose which 8KByte banks of character data to select for ; the 4 banks (32KBytes) of VRAM that its block definitions use, with a max ; of 16 banks of characters per multi-screen map. ; ; Loading those character banks dynamically is an exercise for the user! ; ; Enabling support adds extra library code, and slightly slows down the use ; of regular blkmaps. ; .ifndef BLKMAP_MULTISCR BLKMAP_MULTISCR = 1 ; (0 or 1) .endif ; ; Block definitions can either use character data from VRAM $1000..$7FFF or ; they can be limited to use the 32KByte of characters in VRAM $1000..$4FFF ; which then frees up 2-bits for flag information for each character in the ; block. ; ; These 2-bits are perfect for using as collision information in game maps, ; allowing storage of states like transparent, solid, up-slope, down-slope. ; ; Typically this flag information is set by the map conversion tools from a ; seperate "collision" map layer. ; .ifndef BLKDEF_CHR_FLAG BLKDEF_CHR_FLAG = 1 ; (0 or 1) .endif ; ; Block definitions are accessed in MPR2 ($4000..$5FFF), and must not cross ; the bank boundary. ; ; When working this way, 8 pointers in ZP are used to access the individual ; bytes in the block definition. This is fine when using a regular map on a ; PC Engine, but it is awfully slow when using multi-screen maps or drawing ; maps on both VDC chips in a SuperGRAFX because the pointer values must be ; constantly changed. ; ; When using multi-screen maps, or when developing a SuperGRAFX game, or if ; developing a CDROM game, then it is usually preferable to store the block ; definitions with 2KByte alignment, especially if they are normally stored ; compressed and then decompressed into a 2KByte buffer in RAM when needed. ; ; This option controls whether the definitions are stored 2KByte aligned or ; if pointers should be used instead. ; .ifndef BLKDEF_POINTERS BLKDEF_POINTERS = 0 ; (0 or 1) .endif ; ; Add a timing bar to the scroll_map() to see how long the drawing takes? ; .ifndef BLKMAP_TIMETEST BLKMAP_TIMETEST = 0 ; (0 or 1) .endif ; ; ; .if BLKDEF_POINTERS .zp blk_tl_l_ptr: ds 2 ; Block definition top left lo-byte. blk_tr_l_ptr: ds 2 ; Block definition top right lo-byte. blk_bl_l_ptr: ds 2 ; Block definition bottom left lo-byte. blk_br_l_ptr: ds 2 ; Block definition bottom right lo-byte. blk_tl_h_ptr: ds 2 ; Block definition top left hi-byte. blk_tr_h_ptr: ds 2 ; Block definition top right hi-byte. blk_bl_h_ptr: ds 2 ; Block definition bottom left hi-byte. blk_br_h_ptr: ds 2 ; Block definition bottom right hi-byte. .code .else ; If the block definititions are 2KByte aligned. BLK_4000_TL_L = $4000 BLK_4000_TR_L = $4100 BLK_4000_BL_L = $4200 BLK_4000_BR_L = $4300 BLK_4000_TL_H = $4400 BLK_4000_TR_H = $4500 BLK_4000_BL_H = $4600 BLK_4000_BR_H = $4700 BLK_4800_TL_L = $4800 BLK_4800_TR_L = $4900 BLK_4800_BL_L = $4A00 BLK_4800_BR_L = $4B00 BLK_4800_TL_H = $4C00 BLK_4800_TR_H = $4D00 BLK_4800_BL_H = $4E00 BLK_4800_BR_H = $4F00 BLK_5000_TL_L = $5000 BLK_5000_TR_L = $5100 BLK_5000_BL_L = $5200 BLK_5000_BR_L = $5300 BLK_5000_TL_H = $5400 BLK_5000_TR_H = $5500 BLK_5000_BL_H = $5600 BLK_5000_BR_H = $5700 BLK_5800_TL_L = $5800 BLK_5800_TR_L = $5900 BLK_5800_BL_L = $5A00 BLK_5800_BR_L = $5B00 BLK_5800_TL_H = $5C00 BLK_5800_TR_H = $5D00 BLK_5800_BL_H = $5E00 BLK_5800_BR_H = $5F00 .endif MAP_UNALIGNED_X = $80 MAP_UNALIGNED_Y = $40 ; ; ; .bss ; ************** ; 8-byte (or 2-byte) entry for each SCREEN in the MULTI_MAP. .rsset 0 .if BLKDEF_POINTERS SCR_MAP_PAGE .rs 1 ; 256-byte aligned. SCR_MAP_BANK .rs 1 .else SCR_MAP_PAGE .rs 1 ; 256-byte aligned. SCR_MAP_BANK .rs 1 SCR_BLK_PAGE .rs 1 ; >$4000, >$4800, >$5000, or >$5800. SCR_BLK_BANK .rs 1 SCR_TBL_PAGE .rs 1 ; 256-byte aligned. SCR_TBL_BANK .rs 1 SCR_CHR_12 .rs 1 ; Which CHR banks are used by the BLK, with SCR_CHR_34 .rs 1 ; a max of 16 CHR banks per MULTI_MAP. .endif ; A simple macro to help build a multi-screen map. .ifndef SCREEN SCREEN .macro db (((\1) & $1FFF) | $6000) >> 8, bank(\1) .if !BLKDEF_POINTERS db (((\2) & $1FFF) | $4000) >> 8, bank(\2) db (((\3) & $1FFF) | $6000) >> 8, bank(\3) dw (\4) .endif .endm .endif map_blk_flag: ds 1 ; Returned from _get_map_block(). map_blk_mask: ds 1 ; Returned from _get_map_block(). ; ************** ; 16-bytes of VDC blkmap info. ; ; N.B. MUST be 16-bytes before the SGX versions to use PCE_VDC_OFFSET. vdc_old_chr_x: ds 1 ; Previous top-left X in CHR (lo-byte only). vdc_old_chr_y: ds 1 ; Previous top-left Y in CHR (lo-byte only). vdc_tbl_addr: ds 2 ; 256-byte aligned. vdc_tbl_bank: ds 1 vdc_blk_addr: ds 2 ; 2KBytes of data, 256-byte aligned. vdc_blk_bank: ds 1 vdc_map_addr: ds 2 ; Mapped into MPR3..MPR5, max 16KBytes. vdc_map_bank: ds 1 vdc_scr_addr: ds 2 ; 8KByte maximum size. vdc_scr_bank: ds 1 vdc_scr_chr12: ds 1 ; Which CHR banks are used by the BLK, with vdc_scr_chr34: ds 1 ; a max of 16 banks per multi-screen map. .if SUPPORT_SGX ; ************** ; 16-bytes of SGX blkmap info. ; ; N.B. MUST be 16-bytes after the VDC versions to use SGX_VDC_OFFSET. sgx_old_chr_x: ds 1 ; Previous top-left X in CHR (lo-byte only). sgx_old_chr_y: ds 1 ; Previous top-left Y in CHR (lo-byte only). sgx_tbl_addr: ds 2 ; 256-byte aligned. sgx_tbl_bank: ds 1 sgx_blk_addr: ds 2 ; 2KBytes of data, 256-byte aligned. sgx_blk_bank: ds 1 sgx_map_addr: ds 2 ; Mapped into MPR3..MPR4, max 8KBytes. sgx_map_bank: ds 1 sgx_scr_addr: ds 2 ; 8KByte maximum size. sgx_scr_bank: ds 1 sgx_scr_chr12: ds 1 ; Which CHR banks are used by the BLK, with sgx_scr_chr34: ds 1 ; a max of 16 banks per multi-screen map. .endif SUPPORT_SGX .if 0 ; ************** ; 16-bytes of VDC blkmap info (moved to vdc.asm to save .bss memory). ; ; N.B. MUST be 16-bytes before the SGX versions to use PCE_VDC_OFFSET. vdc_map_draw_w: ds 1 ; (SCR_WIDTH / 8) + 1 vdc_map_draw_h: ds 1 ; (SCR_HEIGHT / 8) + 1 vdc_map_line_w: ds 1 ; Width of map (or multi-screen BAT) in tiles. vdc_map_scrn_w: ds 1 ; Width of map in screens (if multi-screen). vdc_map_pxl_x: ds 2 ; Top-left X of drawn map in pixels. vdc_map_pxl_y: ds 2 ; Top-left Y of drawn map in pixels. vdc_map_option: ds 1 ; Flags to disable BAT alignment. .if SUPPORT_SGX ds 7 ; UNUSED, needed for padding. ; ************** ; 16-bytes of SGX blkmap info (moved to vdc.asm to save .bss memory). ; ; N.B. MUST be 16-bytes after the VDC versions to use SGX_VDC_OFFSET. sgx_map_draw_w: ds 1 ; (SCR_WIDTH / 8) + 1 sgx_map_draw_h: ds 1 ; (SCR_HEIGHT / 8) + 1 sgx_map_line_w: ds 1 ; Width of map (or multi-screen BAT) in tiles. sgx_map_scrn_w: ds 1 ; Width of map in screens (if multi-screen). sgx_map_pxl_x: ds 2 ; Top-left X of drawn map in pixels. sgx_map_pxl_y: ds 2 ; Top-left Y of drawn map in pixels. sgx_map_option: ds 1 ; Flags to disable BAT alignment. .endif SUPPORT_SGX .endif 0 ; ************** ; Aliases for the asm variable names in HuCC. ; .ifdef HUCC _map_blk_flag .alias map_blk_flag _map_blk_mask .alias map_blk_mask _vdc_map_draw_w .alias vdc_map_draw_w _vdc_map_draw_h .alias vdc_map_draw_h _vdc_map_pxl_x .alias vdc_map_pxl_x _vdc_map_pxl_y .alias vdc_map_pxl_y _vdc_old_chr_x .alias vdc_old_chr_x _vdc_old_chr_y .alias vdc_old_chr_y _vdc_tbl_addr .alias vdc_tbl_addr _vdc_tbl_bank .alias vdc_tbl_bank _vdc_blk_addr .alias vdc_blk_addr _vdc_blk_bank .alias vdc_blk_bank _vdc_map_line_w .alias vdc_map_line_w _vdc_map_scrn_w .alias vdc_map_scrn_w _vdc_map_addr .alias vdc_map_addr _vdc_map_bank .alias vdc_map_bank _vdc_scr_addr .alias vdc_scr_addr _vdc_scr_bank .alias vdc_scr_bank _vdc_scr_chr12 .alias vdc_scr_chr12 _vdc_scr_chr34 .alias vdc_scr_chr34 .if SUPPORT_SGX _sgx_map_draw_w .alias sgx_map_draw_w _sgx_map_draw_h .alias sgx_map_draw_h _sgx_map_pxl_x .alias sgx_map_pxl_x _sgx_map_pxl_y .alias sgx_map_pxl_y _sgx_old_chr_x .alias sgx_old_chr_x _sgx_old_chr_y .alias sgx_old_chr_y _sgx_tbl_addr .alias sgx_tbl_addr _sgx_tbl_bank .alias sgx_tbl_bank _sgx_blk_addr .alias sgx_blk_addr _sgx_blk_bank .alias sgx_blk_bank _sgx_map_line_w .alias sgx_map_line_w _sgx_map_scrn_w .alias sgx_map_scrn_w _sgx_map_addr .alias sgx_map_addr _sgx_map_bank .alias sgx_map_bank _sgx_scr_addr .alias sgx_scr_addr _sgx_scr_bank .alias sgx_scr_bank _sgx_scr_chr12 .alias sgx_scr_chr12 _sgx_scr_chr34 .alias sgx_scr_chr34 .endif SUPPORT_SGX .endif HUCC ; ************** ; Temporary variables for drawing, using common zero-page locations. ; map_bat_x = _al ; Set by draw_map(), scroll_map() if drawing map_bat_y = _ah ; aligned, or as parameters to blit_map(). map_draw_w = _bl ; Set by draw_map(), scroll_map(), but given map_draw_h = _bh ; as parameters to blit_map(). map_pxl_x = _cx ; Set by draw_map(), scroll_map() and also by map_chr_x = _cl ; blit__map(), from current vdc_map_pxl_x. map_scrn_x = _ch map_pxl_y = _dx ; Set by draw_map(), scroll_map() and also by map_chr_y = _dl ; blit__map(), from current vdc_map_pxl_y. map_scrn_y = _dh map_line = _si ; Start of map data line being drawn. map_count = __temp + 0 map_drawn = __temp + 1 .code blkmap_group .procgroup ; *************************************************************************** ; *************************************************************************** ; ; _set_blocks - Initialize the block definition pointers. ; _sgx_set_blocks - Initialize the block definition pointers. ; ; void __fastcall set_blocks( unsigned char __far *blk_def, unsigned char __far *flg_def, unsigned char number_of_blk<_al> ); ; void __fastcall sgx_set_blocks( unsigned char __far *blk_def, unsigned char __far *flg_def, unsigned char number_of_blk<_al> ); ; .if SUPPORT_SGX .proc _sgx_set_blocks.3 ldx #SGX_VDC_OFFSET ; Offset to SGX VDC. db $F0 ; Turn "clx" into a "beq". .ref _set_blocks.3 .endp .endif .proc _set_blocks.3 clx ; Offset to PCE VDC. lda.h vdc_tbl_addr, x ; Remap the address to MPR2. and #$1F ora #$40 sta.h vdc_tbl_addr, x lda.h vdc_blk_addr, x ; Remap the address to MPR2. and #$1F ora #$40 sta.h vdc_blk_addr, x .if BLKDEF_POINTERS dec <_al ; Number of blocks. !: lda.l vdc_blk_addr, x ; Get the BLK address. ldy.h vdc_blk_addr, x ; If the page is zero, then bne !+ ; retrieve it from the map. tma3 ; Set the BLK addr and bank pha ; from the 3 bytes *before* tma4 ; the map data. pha lda.l vdc_map_addr, x sta.l <_bp lda.h vdc_map_addr, x and.h #$1F00 ora.h #$8000 dec a sta.h <_bp lda vdc_map_bank, x tma4 dec a tma3 ldy #-1 lda [_bp], y sta vdc_blk_bank, x dey lda [_bp], y and #$1F ora #$40 sta.h vdc_blk_addr, x dey lda [_bp], y sta.l vdc_blk_addr, x pla tam4 pla tam3 bra !- !: clx ; Initialize the pointers. .loop: sta.l blk_tl_l_ptr, x say sta.h blk_tl_l_ptr, x say sec ; Number of BLK - 1, adc <_al ; so that 256 works! bcc !+ iny !: inx inx cpx #8 * 2 ; Initialize 8 consecutive bcc .loop ; pointers. .endif BLKDEF_POINTERS leave .endp ; *************************************************************************** ; *************************************************************************** ; ; _draw_map - Draw the entire screen at the current coordinates. ; _sgx_draw_map - Draw the entire screen at the current coordinates. ; ; void __fastcall draw_map( void ); ; void __fastcall sgx_draw_map( void ); ; .if SUPPORT_SGX _sgx_draw_map .proc ldx #SGX_VDC_OFFSET ; Offset to SGX VDC. db $F0 ; Turn "clx" into a "beq". .ref _draw_map .endp .endif _draw_map .proc clx ; Offset to PCE VDC. tma2 ; Preserve MPR2..MPR4. pha tma3 pha tma4 pha .if BLKMAP_LARGEMAP tma5 ; Preserve MPR5. pha .endif jsr map_pxl_2_chr ; Set up the draw coordinates. lda , unsigned char tile_y, unsigned char tile_w, unsigned char tile_h ); ; void __fastcall sgx_blit_map( unsigned char tile_x, unsigned char tile_y, unsigned char tile_w, unsigned char tile_h ); ; ; Normally you'd just use _draw_map() and _scroll_map(), but for those folks ; who really wish to take manual control, you can use this. ; .if SUPPORT_SGX _sgx_blit_map .proc ldx #SGX_VDC_OFFSET ; Offset to SGX VDC. db $F0 ; Turn "clx" into a "beq". .ref _blit_map .endp .endif _blit_map .proc clx ; Offset to PCE VDC. lda vdc_scr_bank, x ; Skip this if a multi-screen bne .exit ; blkmap. tma2 ; Preserve MPR2..MPR4. pha tma3 pha tma4 pha .if BLKMAP_LARGEMAP tma5 ; Preserve MPR5. pha .endif lda vdc_map_option, x ; Preserve current map options. pha ora #MAP_UNALIGNED_X | MAP_UNALIGNED_Y sta vdc_map_option, x jsr map_pxl_2_chr ; Set up the draw coordinates. lda , unsigned int y ); ; unsigned char __fastcall _sgx_get_map_block( unsigned int x, unsigned int y ); ; .if SUPPORT_SGX .proc _sgx_get_map_block.2 ldx #SGX_VDC_OFFSET ; Offset to SGX VDC. db $F0 ; Turn "clx" into a "beq". .ref _get_map_block.2 .endp .endif .proc _get_map_block.2 clx ; Offset to PCE VDC. tma2 ; Preserve MPR2..MPR4. pha tma3 pha tma4 pha .if BLKMAP_LARGEMAP tma5 ; Preserve MPR5. pha .endif jsr xvt_pxl_2_chr ; Set up the query coordinates. jsr map_chr_2_data ; Page in the map address. lda [_bp] ; Read the BLK from the map. tay lda = old_x. and vdc_bat_x_mask, x adc vdc_map_draw_w, x ; Usually (SCR_WIDTH / 8) + 1. dec a sta = old_x. adc vdc_map_draw_w, x ; Usually (SCR_WIDTH / 8) + 1. dec a sta = old_y. and vdc_bat_y_mask, x adc vdc_map_draw_h, x ; Usually (SCR_HEIGHT / 8) + 1. dec a sta = old_y. adc vdc_map_draw_h, x ; Usually (SCR_HEIGHT / 8) + 1. dec a sta 1649 cycles !repeat: lda [_bp] ; 7 tay ; 2 block_top_even: lda [blk_tl_l_ptr], y ; 7 sta VDC_DL, x ; 6 lda [blk_tl_h_ptr], y ; 7 .if BLKDEF_CHR_FLAG and #%11110011 ; 2 .endif inc a ; 2 sta VDC_DH, x ; 6 dec 1649 cycles !repeat: lda [_bp] ; 7 tay ; 2 block_btm_even: lda [blk_bl_l_ptr], y ; 7 sta VDC_DL, x ; 6 lda [blk_bl_h_ptr], y ; 7 .if BLKDEF_CHR_FLAG and #%11110011 ; 2 .endif inc a ; 2 sta VDC_DH, x ; 6 dec 16200 cycles !repeat: lda [_bp] ; 7 tay ; 2 block_lhs_even: lda [blk_tl_l_ptr], y ; 7 sta VDC_DL, x ; 6 lda [blk_tl_h_ptr], y ; 7 .if BLKDEF_CHR_FLAG and #%11110011 ; 2 .endif inc a ; 2 sta VDC_DH, x ; 6 dec 1620 cycles !repeat: lda [_bp] ; 7 tay ; 2 block_rhs_even: lda [blk_tr_l_ptr], y ; 7 sta VDC_DL, x ; 6 lda [blk_tr_h_ptr], y ; 7 .if BLKDEF_CHR_FLAG and #%11110011 ; 2 .endif inc a ; 2 sta VDC_DH, x ; 6 dec 1513 cycles !repeat: lda [_bp] ; 7 tay ; 2 b4000_top_even: lda BLK_4000_TL_L, y ; 5 sta VDC_DL, x ; 6 lda BLK_4000_TL_H, y ; 5 .if BLKDEF_CHR_FLAG and #%11110011 ; 2 .endif inc a ; 2 sta VDC_DH, x ; 6 dec 1513 cycles !repeat: lda [_bp] ; 7 tay ; 2 b4000_btm_even: lda BLK_4000_BL_L, y ; 5 sta VDC_DL, x ; 6 lda BLK_4000_BL_H, y ; 5 .if BLKDEF_CHR_FLAG and #%11110011 ; 2 .endif inc a ; 2 sta VDC_DH, x ; 6 dec 1513 cycles !repeat: lda [_bp] ; 7 tay ; 2 b4800_top_even: lda BLK_4800_TL_L, y ; 5 sta VDC_DL, x ; 6 lda BLK_4800_TL_H, y ; 5 .if BLKDEF_CHR_FLAG and #%11110011 ; 2 .endif inc a ; 2 sta VDC_DH, x ; 6 dec 1513 cycles !repeat: lda [_bp] ; 7 tay ; 2 b4800_btm_even: lda BLK_4800_BL_L, y ; 5 sta VDC_DL, x ; 6 lda BLK_4800_BL_H, y ; 5 .if BLKDEF_CHR_FLAG and #%11110011 ; 2 .endif inc a ; 2 sta VDC_DH, x ; 6 dec 1513 cycles !repeat: lda [_bp] ; 7 tay ; 2 b5000_top_even: lda BLK_5000_TL_L, y ; 5 sta VDC_DL, x ; 6 lda BLK_5000_TL_H, y ; 5 .if BLKDEF_CHR_FLAG and #%11110011 ; 2 .endif inc a ; 2 sta VDC_DH, x ; 6 dec 1513 cycles !repeat: lda [_bp] ; 7 tay ; 2 b5000_btm_even: lda BLK_5000_BL_L, y ; 5 sta VDC_DL, x ; 6 lda BLK_5000_BL_H, y ; 5 .if BLKDEF_CHR_FLAG and #%11110011 ; 2 .endif inc a ; 2 sta VDC_DH, x ; 6 dec 1513 cycles !repeat: lda [_bp] ; 7 tay ; 2 b5800_top_even: lda BLK_5800_TL_L, y ; 5 sta VDC_DL, x ; 6 lda BLK_5800_TL_H, y ; 5 .if BLKDEF_CHR_FLAG and #%11110011 ; 2 .endif inc a ; 2 sta VDC_DH, x ; 6 dec 1513 cycles !repeat: lda [_bp] ; 7 tay ; 2 b5800_btm_even: lda BLK_5800_BL_L, y ; 5 sta VDC_DL, x ; 6 lda BLK_5800_BL_H, y ; 5 .if BLKDEF_CHR_FLAG and #%11110011 ; 2 .endif inc a ; 2 sta VDC_DH, x ; 6 dec 1500 cycles !repeat: lda [_bp] ; 7 tay ; 2 b4000_lhs_even: lda BLK_4000_TL_L, y ; 5 sta VDC_DL, x ; 6 lda BLK_4000_TL_H, y ; 5 .if BLKDEF_CHR_FLAG and #%11110011 ; 2 .endif inc a ; 2 sta VDC_DH, x ; 6 dec 1500 cycles !repeat: lda [_bp] ; 7 tay ; 2 b4000_rhs_even: lda BLK_4000_TR_L, y ; 5 sta VDC_DL, x ; 6 lda BLK_4000_TR_H, y ; 5 .if BLKDEF_CHR_FLAG and #%11110011 ; 2 .endif inc a ; 2 sta VDC_DH, x ; 6 dec 1500 cycles !repeat: lda [_bp] ; 7 tay ; 2 b4800_lhs_even: lda BLK_4800_TL_L, y ; 5 sta VDC_DL, x ; 6 lda BLK_4800_TL_H, y ; 5 .if BLKDEF_CHR_FLAG and #%11110011 ; 2 .endif inc a ; 2 sta VDC_DH, x ; 6 dec 1500 cycles !repeat: lda [_bp] ; 7 tay ; 2 b4800_rhs_even: lda BLK_4800_TR_L, y ; 5 sta VDC_DL, x ; 6 lda BLK_4800_TR_H, y ; 5 .if BLKDEF_CHR_FLAG and #%11110011 ; 2 .endif inc a ; 2 sta VDC_DH, x ; 6 dec 1500 cycles !repeat: lda [_bp] ; 7 tay ; 2 b5000_lhs_even: lda BLK_5000_TL_L, y ; 5 sta VDC_DL, x ; 6 lda BLK_5000_TL_H, y ; 5 .if BLKDEF_CHR_FLAG and #%11110011 ; 2 .endif inc a ; 2 sta VDC_DH, x ; 6 dec 1500 cycles !repeat: lda [_bp] ; 7 tay ; 2 b5000_rhs_even: lda BLK_5000_TR_L, y ; 5 sta VDC_DL, x ; 6 lda BLK_5000_TR_H, y ; 5 .if BLKDEF_CHR_FLAG and #%11110011 ; 2 .endif inc a ; 2 sta VDC_DH, x ; 6 dec 1500 cycles !repeat: lda [_bp] ; 7 tay ; 2 b5800_lhs_even: lda BLK_5800_TL_L, y ; 5 sta VDC_DL, x ; 6 lda BLK_5800_TL_H, y ; 5 .if BLKDEF_CHR_FLAG and #%11110011 ; 2 .endif inc a ; 2 sta VDC_DH, x ; 6 dec 1500 cycles !repeat: lda [_bp] ; 7 tay ; 2 b5800_rhs_even: lda BLK_5800_TR_L, y ; 5 sta VDC_DL, x ; 6 lda BLK_5800_TR_H, y ; 5 .if BLKDEF_CHR_FLAG and #%11110011 ; 2 .endif inc a ; 2 sta VDC_DH, x ; 6 dec