Kiwi Posted March 8, 2018 Share Posted March 8, 2018 I got inspired and started working on a new kernel on 8bitworkshop. The main one thing that I'm having trouble with is when you use the controls like press up for example, you lose a scan line. I had the same problem with RockCutter where I lose scanline when using the controls. I did test every lines I could in Rockcutter until it hit the overscan. I'm not sure if Carry supposed to affect the Overscan timer or not. But, I need help finding a solution to the problem so the scanline count can stay at 262. Thanks.Gif:Source: ShipTestGame.asmROM: TestShipGame.bin 1 Quote Link to comment Share on other sites More sharing options...
ZackAttack Posted March 8, 2018 Share Posted March 8, 2018 I looked at the code you provided and played with the bin and stella debugger. Since you're using the timer for all 3 portions that seems to rule out any possibility of variable length code putting you over/under by a scanline. I suspect the problem is in the TIMER_WAIT macro. My guess is that it needs to do a "sta WSYNC" between each poll of the timer to compensate for the course resolution of the timer register that's being checked. 1 Quote Link to comment Share on other sites More sharing options...
+nanochess Posted March 8, 2018 Share Posted March 8, 2018 Always use a STA WSYNC after the two timer loops, I use 43 in both STA TIM64T. And do all your housekeeping (handling controls, enemy movement, etc) just before the timer loops, this way the timer only counts the remaining "free" time. It's easy to overlook things and exceed some cycles and then all your WSYNC goes nuts. 1 Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted March 8, 2018 Share Posted March 8, 2018 The interval for reading the joystick is a bit too short. Moving up takes longest to handle and then you hit INTIM with an initial value of 0. So you don't catch the change from 1 to 0 there and are up to ~64 cycles late. That causes the extra line. 2 Quote Link to comment Share on other sites More sharing options...
Kiwi Posted March 8, 2018 Author Share Posted March 8, 2018 I added sta WSYNC right after TIMER_SETUP and added sta WSYNC after MoveUD after it store the variable into ShipY. It's now a stable 262 scanlines. TIMER_SETUP 30 sta WSYNC lda #3 sta VBLANK ldy cd bne DontMove ;Move Up sta WSYNC ldx ShipY lda #%00100000 ;Up? bit SWCHA bne SkipMoveUp cpx #9 beq SkipMoveUp inx ldy #7 sty cd ; JMP MoveUD SkipMoveUp lda #%00010000;Down? bit SWCHA bne SkipMoveDown cpx #0 beq SkipMoveDown dex ldy #7 sty cd SkipMoveDown stx ShipY jmp MoveUD DontMove dey sty cd MoveUD ;Move left or right ldx ShipX sta WSYNC lda #%01000000 ;left? bit SWCHA bne SkipMoveLeft cpx #1 bcc SkipMoveLeft dex SkipMoveLeft lda #%10000000 ;Right? bit SWCHA bne SkipMoveRight cpx #153 bcs SkipMoveRight inx SkipMoveRight ; clc stx ShipX ; check firebutton to fire lazer lda ShotOn cmp #0 bne SkipButton bit INPT4 ; test button bpl StartShooting jmp SkipButton StartShooting lda #1 sta ShotOn lda ShipY sta ShotY lda ShipX sta ShotX SkipButton In overscan portion I'll have to use WSYNC every 76 cycle. 8bitworkshop have a feature that calculates how much cycles is used between WSYNC by clicking on the clock icon so that will help me determine where to put WSYNC at. Thanks everyone. 1 Quote Link to comment Share on other sites More sharing options...
zilog_z80a Posted March 8, 2018 Share Posted March 8, 2018 (edited) 8bitworkshop have a feature that calculates how much cycles is used between WSYNC by clicking on the clock icon. Thanks everyone. Good info!! i will use this ty Kiwi!! Edited March 8, 2018 by zilog_z80a 1 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.