bogax Posted June 13, 2013 Share Posted June 13, 2013 pfread for the multisprite kernel as bB functions The first (mostly) in bB The second in asm Both take column and row as parameters and return 0 or 255 0, 0 is bottom left Both use temp1 and temp2 but no other variables. function msk_pf_rd() temp1 = temp1 + $08 if temp1{4} then skip_PF1_and asm lda (PF1pointer),y sta temp2 end goto skip_PF2_and skip_PF1_and asm lda (PF2pointer),y sta temp2 end skip_PF2_and temp1 = temp1 & $0F if bit_masks[temp1] & temp2 then temp2 = $FF return data bit_masks 1,2,4,8,$10,$20,$40,$80 $80,$40,$20,$10,8,4,2,1 end function msk_pf_rd() asm clc adc #$08 and #$1F cmp #$10 and #$0F tax lda bit_masks,x bcc skip_PF2_and and (PF2pointer),y bcs skip_PF1_and skip_PF2_and and (PF1pointer),y skip_PF1_and beq skip_ldFF lda #$FF skip_ldFF end return data bit_masks 1,2,4,8,$10,$20,$40,$80 $80,$40,$20,$10,8,4,2,1 end 2 Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted June 13, 2013 Share Posted June 13, 2013 Added to the bB page: randomterrain.com/atari-2600-memories-batari-basic-commands.html#pfread 3 Quote Link to comment Share on other sites More sharing options...
bogax Posted June 15, 2013 Author Share Posted June 15, 2013 (edited) One more Here it is purely as asm This can be put in an include file or put in the bB program as asm (not as a function) Then it can be used directly in an if statement (or used in an assignment) One odd thing, the sense of the if statement is backwards. (whats up with that? So you'd need to use it like this if pfread (column, row) then goto pfpixel_off else goto pfpixel_on pfread clc adc #$08 and #$1F cmp #$10 and #$0F tax lda bit_masks,x bcc skip_PF2_and and (PF2pointer),y bcs skip_PF1_and skip_PF2_and and (PF1pointer),y skip_PF1_and beq skip_ldFF lda #$FF skip_ldFF return bit_masks .byte $01, $02, $04, $08, $10, $20, $40, $80 .byte $80, $40, $20, $10, $08, $04, $02, $01 Edited June 15, 2013 by bogax Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.