Kylearan Posted March 6, 2014 Share Posted March 6, 2014 If you have the luxury of too much ROM (probably not, but who knows...), you could use a look-up table. Something like... ldx TrafficOffset0 lda TrafficCacheStart,x ldx TrafficOffset1 ora TrafficCacheStart,x tax lda LookUpTable,x sta PF1Cache Uses constant 23 cycles in all cases, but uses also 256 bytes of ROM for the look-up table. And in case the numerical ranges of TrafficOffset 0 and 1 are <16 and can be packed into one byte, this becomes even faster (16 cycles, or 14 if you can spare y as well). Quote Link to comment https://forums.atariage.com/topic/171270-overscan-and-vblank-line-counts/page/2/#findComment-2942593 Share on other sites More sharing options...
Kylearan Posted March 6, 2014 Share Posted March 6, 2014 Oh, and if you add an "and #%11000000" before the "tax", your look-up table only needs 4 bytes instead of 256, for an additional 2 cycles (for a total of 25 cycles). The downside is that your four bytes have to be stored exactly at location 0, 64, 128 and 192, but if you have other data or code that you can store inbetween, this is very much doable and should be fastest (and in the ideal case even the smallest) solution. My cycle counts assume that the look-up table is aligned to $100, by the way. Quote Link to comment https://forums.atariage.com/topic/171270-overscan-and-vblank-line-counts/page/2/#findComment-2942597 Share on other sites More sharing options...
eshu Posted March 6, 2014 Share Posted March 6, 2014 If you have the luxury of too much ROM (probably not, but who knows...), you could use a look-up table. Something like... ldx TrafficOffset0 lda TrafficCacheStart,x ldx TrafficOffset1 ora TrafficCacheStart,x tax lda LookUpTable,x sta PF1Cache Uses constant 23 cycles in all cases, but uses also 256 bytes of ROM for the look-up table. And in case the numerical ranges of TrafficOffset 0 and 1 are <16 and can be packed into one byte, this becomes even faster (16 cycles, or 14 if you can spare y as well). I don't think this works I'm afraid - if [TrafficCacheStart+TrafficOffset0]=%11000000 and [TrafficCacheStart+TrafficOffset1]=%00000000 then it will have both cars enabled where only the first should be (where [address] is the contents of memory at address) Quote Link to comment https://forums.atariage.com/topic/171270-overscan-and-vblank-line-counts/page/2/#findComment-2942617 Share on other sites More sharing options...
Kylearan Posted March 6, 2014 Share Posted March 6, 2014 (edited) Sorry for the triple post, but I have another one. If you could use Y instead of X, you could make TrafficOffset0 and 1 the low bytes of pointers into TrafficCacheStart, using an additional 2 bytes of RAM. Then instead of ldx TrafficOffset0 lda TrafficCacheStart,x you could do ldy #0 lda (TrafficOffset0),y which saves you nothing for the first access, but 2 cycles for every subsequent access if you keep Y at zero. So eshu's solution becomes ldy #0 lda (TrafficOffset0),y bpl NoCar0 lda (TrafficOffset1),y and #%01000000 beq Car0NoCar1 lda #%01110111 bne StoreCache Car0NoCar1: lda #%01110000 bne StoreCache NoCar0: lda (TrafficOffset1),y and #%01000000 beq StoreCache lda #%00000111 StoreCache: sta PF1Cache for 27 cycles worst case. Edited March 6, 2014 by Kylearan Quote Link to comment https://forums.atariage.com/topic/171270-overscan-and-vblank-line-counts/page/2/#findComment-2942620 Share on other sites More sharing options...
Kylearan Posted March 6, 2014 Share Posted March 6, 2014 I don't think this works I'm afraid - if [TrafficCacheStart+TrafficOffset0]=%11000000 and [TrafficCacheStart+TrafficOffset1]=%00000000 then it will have both cars enabled where only the first should be (where [address] is the contents of memory at address) Ah you're right. Somehow I misunderstood the meaning of these variables. Sorry for the confusion, my bad. I shouldn't post when I'm at work. Quote Link to comment https://forums.atariage.com/topic/171270-overscan-and-vblank-line-counts/page/2/#findComment-2942621 Share on other sites More sharing options...
Octavio Pinho Bokel Posted February 16, 2021 Share Posted February 16, 2021 Hello, After a 6 years break, I decided to resume doing my game, now is in version 1 digital release: I am pushing 35 lines vblank and 5 overscan to maximize vertical play area, and it seams to be running fine: Quote Link to comment https://forums.atariage.com/topic/171270-overscan-and-vblank-line-counts/page/2/#findComment-4754858 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.