Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; aplib_unchain_p4_copy_to_vram
- ;
- ; Converts pattern data from 4-bit linear to 4-bit planar format and sends the result to VRAM.
- ;
- ; In:
- ; A = source bank
- ; Y = source offset
- ; X = VRAM word address
- ; APLIB_NUMBYTES = number of bytes to copy
- ;
- aplib_unchain_p4_copy_to_vram:
- php
- sep #$20
- rep #$10
- phb
- pha
- plb
- lda #$80
- sta.l $2115
- rep #$20
- txa
- sta.l $2116
- _au4ctv_loop_tiles:
- lda #8
- sta APLIB_COUNT
- ldx #0
- sep #$20
- _au4ctv_tile:
- lda #4
- sta.b APLIB_COUNT2
- -:
- lda.w $0000,y
- iny
- lsr a
- rol.b APLIB_PLANAR,x
- lsr a
- rol.b APLIB_PLANAR+1,x
- lsr a
- rol.b APLIB_PLANAR+16,x
- lsr a
- rol.b APLIB_PLANAR+17,x
- lsr a
- rol APLIB_PLANAR,x
- lsr a
- rol APLIB_PLANAR+1,x
- lsr a
- rol APLIB_PLANAR+16,x
- lsr a
- rol APLIB_PLANAR+17,x
- dec APLIB_COUNT2
- bne -
- inx
- inx
- dec APLIB_COUNT
- bne _au4ctv_tile
- rep #$20
- ldx #0
- ; Copy the planar data to VRAM
- --:
- lda APLIB_PLANAR,x
- sta.l $2118
- inx
- inx
- cpx #32
- bne --
- lda.b APLIB_NUMBYTES
- sec
- sbc #32
- sta.b APLIB_NUMBYTES
- bne _au4ctv_loop_tiles
- plb
- plp
- rts
- ; aplib_unchain_p8_copy_to_vram
- ;
- ; Converts pattern data from 8-bit linear to 8-bit planar format and sends the result to VRAM.
- ;
- ; In:
- ; A = source bank
- ; Y = source offset
- ; X = VRAM word address
- ; APLIB_NUMBYTES = number of bytes to copy
- ;
- aplib_unchain_p8_copy_to_vram:
- php
- sep #$20
- rep #$10
- phb
- pha
- plb
- lda #$80
- sta.l $2115
- rep #$20
- txa
- sta.l $2116
- _au8ctv_loop_tiles:
- lda #8
- sta APLIB_COUNT
- ldx #0
- sep #$20
- _au8ctv_tile:
- lda #8
- sta.b APLIB_COUNT2
- -:
- lda.w $0000,y
- iny
- lsr a
- rol.b APLIB_PLANAR,x
- lsr a
- rol.b APLIB_PLANAR+1,x
- lsr a
- rol.b APLIB_PLANAR+16,x
- lsr a
- rol.b APLIB_PLANAR+17,x
- lsr a
- rol APLIB_PLANAR+32,x
- lsr a
- rol APLIB_PLANAR+33,x
- lsr a
- rol APLIB_PLANAR+48,x
- lsr a
- rol APLIB_PLANAR+49,x
- dec APLIB_COUNT2
- bne -
- inx
- inx
- dec APLIB_COUNT
- bne _au8ctv_tile
- rep #$20
- ldx #0
- ; Copy the planar data to VRAM
- --:
- lda APLIB_PLANAR,x
- sta.l $2118
- inx
- inx
- cpx #64
- bne --
- lda.b APLIB_NUMBYTES
- sec
- sbc #32
- sta.b APLIB_NUMBYTES
- bne _au8ctv_loop_tiles
- plb
- plp
- rts
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement