Jump to content

Mallard Games

Members
  • Posts

    120
  • Joined

  • Last visited

Everything posted by Mallard Games

  1. The question is how do I align the code so it's "exactly at the address the cpu will fetch the next instruction from". Also I moved the 2 pla's up so they do execute and removed the jmp that will never execute or succeed if it does. CheckState lda GameState ; check the gamestate cmp #STATE_TITLESCREEN ; has it changed beq StateCheckDone ; if not then branch pla ; clear low byte of jump address from stack pla ; clear high byte of jump address from stack cmp SelectBank2 ; bankswitch to bank 2 StateCheckDone rts
  2. Fixed the RTS not being cancelled. CheckState lda GameState ; check the gamestate cmp #STATE_TITLESCREEN ; has it changed beq StateCheckDone ; if not then branch cmp SelectBank2 ; bankswitch to bank 2 pla ; clear low byte of jump address from stack pla ; clear high byte of jump address from stack jmp GameMode ; jump to game mode StateCheckDone rts Tried moving that bit of code so it is right above reset, and it stops the crashing but now it just sticks to the title screen. ; *********************************************************************************** ; Start of Bank 1 ; Title Screen Bank ; *********************************************************************************** seg Bank_1 ; end of uninitialized segment - start of ROM Bank 1 org $1000 ; start ROM at $1000 rorg $1000 ; start ROM at $1000 JUMP_TABLE CheckState lda GameState ; check the gamestate cmp #STATE_TITLESCREEN ; has it changed beq StateCheckDone ; if not then branch cmp SelectBank2 ; bankswitch to bank 2 pla ; clear low byte of jump address from stack pla ; clear high byte of jump address from stack jmp GameMode ; jump to game mode StateCheckDone rts ; we'll call the start of our program "Reset". Reset sei ; Disable Any Interrupts cld ; Clear BCD math bit. ldx #$FF ; put X to the top... txs ; ...and use it reset the stack pointer ; Clear RAM and all TIA registers lda #0 ; Put Zero into A, X is at $FF Clear sta 0,x ; Now, this doesn't mean what you think... dex ; decrement X (decrease X by one) bne Clear ; if the last command resulted in something ; that's "N"ot "Equal" to Zero, branch back ; to "Clear" ; ************************************************************************** ; One time initializations ; ************************************************************************** lda #BLUE sta COLUBK ; set the background color to sky blue lda #BROWN sta COLUPF ; set the playfield color to brown lda #WHITE sta COLUP1 ; set crosshair color to white lda INTIM ; get a random value from INTIM sta Random ; use it to seed the random number generator lda #STATE_TITLESCREEN ; 0 = title screen state sta GameState ; store it AttarctMode TitleScreenLoop jsr VerticalSync ; perform vertical sync jsr CheckJoystick ; check for joystick input jsr CheckState ; check if the gamestate has changed jsr TitleScreen_Kernal ; jump to title screen kernal jsr OverScan ; (3 13) jump to OverScan Routine jmp TitleScreenLoop ; jump to start of loop TitleScreen_Kernal WaitForVblankEnd_TitleScreen bit TIMINT ; load timer... bpl WaitForVblankEnd_TitleScreen ; killing time if the timer's not yet zero ldy #31 ; 16 scanline of padding on the top TopPaddingLoop: sta WSYNC ; wait for sync dey ; decrement y bne TopPaddingLoop ; loop until the top of the screen is padded 16 scanlines ldy #64 ; Y is going to hold how many lines we have to do ; ...we're going to count scanlines here. theoretically ; since this example is ass simple, we could just repeat ; the timer trick, but often its important to know ; just what scan line we're at. ldx #02 ; interlaced sta WSYNC ; We do a WSYNC just before that so we don't turn on sta VBLANK ; End the VBLANK period with the zero ;*********************** Scan line Loop ScanLoop_TitleScreen sta WSYNC ; (3 0) Wait for the previous line to finish lda pf0dataleft-1,y ; (4 4) load left pf0 data into the acumulator sta PF0 ; (3 7) and store it lda pf1dataleft-1,y ; (4 11) load left pf1 data into the acumulator sta PF1 ; (3 14) and store it lda pf2dataleft-1,y ; (4 17) load left pf2 data into the acumulator sta PF2 ; (3 21) and store it lda pf0dataright-1,y ; (4 25) load right pf0 data into the acumulator sta PF0 ; (3 28) and store it *MUST OCCUR AFTER CYCLE 28* SLEEP 3 ; (3 31) sleep for 3 cycles lda pf1dataright-1,y ; (4 35) load right pf1 data into the acumulator sta PF1 ; (3 38) and store it *MUST OCCUR AFTER CYCLE 38* SLEEP 5 ; (5 43) sleep for 5 cycles lda pf2dataright-1,y ; (4 47) load right pf2 data into the acumulator sta PF2 ; (3 50) and store it *MUST OCCUR AFTER CYCLE 50* dex ; (2 52) decrement x bne ScanLoop_TitleScreen ; (2/3 54/55) and repeat if we're not finished with all the scanlines. ldx #02 ; (2 56/57) load 2 into x register dey ; (2 58/59) subtract one off the line counter thingy bne ScanLoop_TitleScreen ; (2/3 60/61 61/62) and repeat if we're not finished with all the scanlines. sty PF0 ; clear PF0 register to prevent garbage from appearing on the screen sty PF1 ; and PF1... sty PF2 ; and PF2 just in case ldy #31 ; (2 62/63 63/64) 16 scanlines of padding on the bottom BottomPaddingLoop: sta WSYNC ; (3 0) wait for sync dey ; (2 2) decrement y bne BottomPaddingLoop ; (2/3 4/5) loop until the bottom of the screen is padded 16 scanlines rts ; ************************************* ; Data Section Follows ; ************************************* Source Code: https://www.dropbox.com/sh/zjbuabjg4i0p7c9/AAAXbjqu6ODRiGrQqi8_sR5Aa?dl=0
  3. I know the contest already ended but, I'm already subscribed.
  4. If your talking about cmp SelectBank2 ; bankswitch to bank 2 It bankswitches to the second bank where the game mode code is. The bankswitching takes so time to happen so I added the 3 nop instructions to pass the time. I have removed them since.
  5. Back again, I have some good news progress has been slow but, steady. Some minor bug fixes have been made that should improve the code a bit. Now comes the hard part, getting the game to transition from the title screen to the game mode. Here is the code I am using: CheckState lda GameState ; check the gamestate cmp #STATE_TITLESCREEN ; has it changed beq StateCheckDone ; if not then branch cmp SelectBank2 ; bandswitch to bank 2 nop nop nop jmp GameMode ; jump to game mode StateCheckDone rts It's almost exactly like the bankswitching code except it's a jump instead of jump to subroutine and there are check to see if we need to perform the jump based on what the current state of the game is. The issue is when I try to perform the bankswitch the game crashes on Stella with "Illegal Instruction". My guess is the 2600 doesn't like me abandoning the CheckState routine altogether if the game state is changed, but at that point the subroutine doesn't need to finish since the rest of the code doesn't need to execute at all. I must say in all seriousness though this is starting to hurt my head. Source: https://www.dropbox.com/sh/ku4ip913q718h0n/AABpPC0h8maEuBAL4U7dtl3Oa?dl=0
  6. Weird they both say 2.8" LCD screen on the box. Sorry about that I actually don't know much about these including what year they're from. That's why I'm asking the community for advice.
  7. Which of these 2 AtGames Flashback Portable's would you recommend I buy? 1) Atari Flashback Portable Console (80 Games Included) (eu) /retro by Atari ESRB Rating: Everyone 2.6 out of 5 stars  7 Xbox One $29.00(15 used & new offers) 2) Atari Flashback Portable Deluxe Edition - Hand Held Console by Atari 4.6 out of 5 stars  7 $29.99(5 used & new offers)
  8. Should I just go for last years model then since I can just add in any exclusive games via the SD card?
  9. So with September just starting and the summer officially over we are officially getting close to the release of the latest version of Atari Portable 2019. Is there a list of what games will be included yet and what new features if any there will be?
  10. Is it necessary to clear the PF register At the end if the loop?
  11. Just reread the example he gave, he meant I should lda pf0dataleft-1,y Instead of lda pf0dataleft,y and then I can remove the padding byte.
  12. How do I subtract 1 from the data tables? This is just a snippet of the full source but, I just double checked and I do dey In both examples. I don't clear my PF registers after each scanline is that bad, should I be worried?
  13. We're talking about this loop: ldy #64 ; Y is going to hold how many lines we have to do ; ...we're going to count scanlines here. theoretically ; since this example is ass simple, we could just repeat ; the timer trick, but often its important to know ; just what scan line we're at. sta WSYNC ; We do a WSYNC just before that so we don't turn on sta VBLANK ; End the VBLANK period with the zero ;*********************** Scan line Loop ScanLoop_TitleScreen sta WSYNC ; (3 0) Wait for the previous line to finish lda pf0dataleft,y ; (4 4) load left pf0 data into the acumulator sta PF0 ; (3 7) and store it lda pf1dataleft,y ; (4 11) load left pf1 data into the acumulator sta PF1 ; (3 14) and store it lda pf2dataleft,y ; (4 17) load left pf2 data into the acumulator sta PF2 ; (3 21) and store it lda pf0dataright,y ; (4 25) load right pf0 data into the acumulator sta PF0 ; (3 28) and store it *MUST OCCUR AFTER CYCLE 28* SLEEP 3 ; (3 31) sleep for 3 cycles lda pf1dataright,y ; (4 35) load right pf1 data into the acumulator sta PF1 ; (3 38) and store it *MUST OCCUR AFTER CYCLE 38* SLEEP 5 ; (5 43) sleep for 5 cycles lda pf2dataright,y ; (4 47) load right pf2 data into the acumulator sta PF2 ; (3 50) and store it *MUST OCCUR AFTER CYCLE 50* dey ; (2 58/59) subtract one off the line counter thingy bne ScanLoop_TitleScreen ; (2/3 60/61 61/62) and repeat if we're not finished with all the scanlines. That's 64 lines right? If I change it to: ldy #63 ; Y is going to hold how many lines we have to do ; ...we're going to count scanlines here. theoretically ; since this example is ass simple, we could just repeat ; the timer trick, but often its important to know ; just what scan line we're at. sta WSYNC ; We do a WSYNC just before that so we don't turn on sta VBLANK ; End the VBLANK period with the zero ;*********************** Scan line Loop ScanLoop_TitleScreen sta WSYNC ; (3 0) Wait for the previous line to finish lda pf0dataleft,y ; (4 4) load left pf0 data into the acumulator sta PF0 ; (3 7) and store it lda pf1dataleft,y ; (4 11) load left pf1 data into the acumulator sta PF1 ; (3 14) and store it lda pf2dataleft,y ; (4 17) load left pf2 data into the acumulator sta PF2 ; (3 21) and store it lda pf0dataright,y ; (4 25) load right pf0 data into the acumulator sta PF0 ; (3 28) and store it *MUST OCCUR AFTER CYCLE 28* SLEEP 3 ; (3 31) sleep for 3 cycles lda pf1dataright,y ; (4 35) load right pf1 data into the acumulator sta PF1 ; (3 38) and store it *MUST OCCUR AFTER CYCLE 38* SLEEP 5 ; (5 43) sleep for 5 cycles lda pf2dataright,y ; (4 47) load right pf2 data into the acumulator sta PF2 ; (3 50) and store it *MUST OCCUR AFTER CYCLE 50* dey ; (2 58/59) subtract one off the line counter thingy bpl ScanLoop_TitleScreen ; (2/3 60/61 61/62) and repeat if we're not finished with all the scanlines. would it be more efficient for looping through 64 scanlines of playfield data?
  14. When doing loops, if you want to iterate against say 64 items the formula is: x-1 for example lda #63 ; loop 64 times and not lda #64 ; loop 64 times correct?
  15. So I know in these modern times most of us use Windows to do our coding. Some even use Macintosh or Linux. Others use Linux hosted in the cloud, or a VPS. I'm interested in learning more about what systems were used in the 80's when the 2600 was ? hot ? to program games?
  16. Still haven't figured out why if both kernels use the same number of scanline, why one comes out short while the other is over 262.
  17. Dead, as in completely stopped in it's tracks after the write happens until we're ready to start a new scanline??? You mean like the visual above. ^^^ Ok, then if that is the case then now i understand, but how exactly do you tag previous line counts or you just don't?
  18. Nothing the scanline count is the remaining issue. The thing is if you look at the number of bytes for the titlescreen and game playfield you will notice they are almost exactly the same minus the padding on the top and bottom of the titlescreen to save some space. While it's true that I could easily fix it by increasing the padding, my main concern is if both modes use the same number of scanline, why am i coming up short for the titlescreen? The sta WSYNC ; (3 0) Wait for the previous line to finish resets the cycle count to 0, but additionally take 3 cycles to complete which I add to the next instruction.
  19. Finally managed to get the titlescreen working with 1 very minor issue, my scanline count went back down to 229.? Other then the sleep's to push everything into place, nothing else had changed in the kernel. ? Source: https://www.dropbox.com/sh/z6wn1u7hmrnflli/AACXSWLGETd7zEjWnhWELg4oa?dl=0
  20. sta WSYNC ; (3 0) Wait for the previous line to finish SLEEP 11 ; (11 14) sleep for 11 cycles lda pf0dataleft,y ; (4 18) load left pf0 data into the acumulator sta PF0 ; (3 21) and store it lda pf1dataleft,y ; (4 25) load left pf1 data into the acumulator sta PF1 ; (3 28) and store it SLEEP 2 ; (2 30) sleep for 2 cycles lda pf2dataleft,y ; (4 34) load left pf2 data into the acumulator sta PF2 ; (3 37) and store it SLEEP 5 ; (5 42) sleep for 5 cycles lda pf0dataright,y ; (4 46) load right pf0 data into the acumulator sta PF0 ; (3 49) and store it lda pf1dataright,y ; (4 53) load right pf1 data into the acumulator sta PF1 ; (3 56) and store it SLEEP 2 ; (2 58) sleep for 2 cycles lda pf2dataright,y ; (4 62) load right pf2 data into the acumulator sta PF2 ; (3 65) and store it (right PF2 MUST hit on cycle 65 to avoid writing too soon or too late) dex ; (2 67) decrement x bne ScanLoop_TitleScreen ; (2/3 69/70) and repeat if we're not finished with all the scanlines. ldx #02 ; (2 71/72) load 2 into x register dey ; (2 73/74) subtract one off the line counter thingy bne ScanLoop_TitleScreen ; (2/3 75/76 76/77) and repeat if we're not finished with all the scanlines. Hopefully i fixed all the comments. As far as bne ScanlineLoop_Titlescreen goes I got to that count by aligning the cycles perfectly using the sleep macros and Spiceware's guide. If I remove the sleep 5 macro I should be below 73 cycles by the time I get there but, the right pf0 will hit at cycle 44 which is 5 cycles too early?
  21. Sorry i updated my post while you were posting your response. I fixed the comments.
  22. This is what's confusing me, I'm trying to align the cycles exactly 21, 28, 37 etc. Also I am trying to time it exactly but some of them won't line up perfectly. sta WSYNC ; (3 0) Wait for the previous line to finish SLEEP 11 ; (11 14) sleep for 6 cycles lda pf0dataleft,y ; (4 18) load left pf0 data into the acumulator sta PF0 ; (3 *21*) and store it lda pf1dataleft,y ; (4 25) load left pf1 data into the acumulator sta PF1 ; (3 *28*) and store it lda pf2dataleft,y ; (4 32) load left pf2 data into the acumulator SLEEP 6 ; (2 34) sleep for 2 cycles sta PF2 ; (3 *37*) and store it SLEEP 5 ; (5 42) sleep for 6 cycles lda pf0dataright,y ; (4 46) load right pf0 data into the acumulator sta PF0 ; (3 *49*) and store it lda pf1dataright,y ; (4 53) load right pf1 data into the acumulator sta PF1 ; (3 56 - OFF BY 2) and store it SLEEP 2 ; (2 58) sleep for 6 cycles lda pf2dataright,y ; (4 62) load right pf2 data into the acumulator sta PF2 ; (3 *65*) and store it (right PF2 MUST hit on cycle 65 to avoid writing too soon or too late) dex ; (2 67) decrement x bne ScanLoop_TitleScreen ; (2/3 69/70) and repeat if we're not finished with all the scanlines. ldx #02 ; (2 71/72) decrement y dey ; (2 73/74) subtract one off the line counter thingy bne ScanLoop_TitleScreen ; (2/3 75/76 76/77) and repeat if we're not finished with all the scanlines. ldy #16 ; (2 77/78 78/79) 16 scanlines of padding on the bottom It's not possible to line pf1 right as the cycles there are very tight.
  23. This is what I came up with: sta WSYNC ; (3 0) Wait for the previous line to finish SLEEP 14 ; (14 14) sleep for 8 cycles lda pf0dataleft,y ; (4 18) load left pf0 data into the acumulator sta PF0 ; (3 21) and store it lda pf1dataleft,y ; (4 25) load left pf1 data into the acumulator sta PF1 ; (3 28) and store it lda pf2dataleft,y ; (4 32) load left pf2 data into the acumulator sta PF2 ; (3 35) and store it ; SLEEP 8 ; (8 29) sleep for 8 cycles lda pf0dataright,y ; (4 39) load right pf0 data into the acumulator sta PF0 ; (3 42) and store it lda pf1dataright,y ; (4 46) load right pf1 data into the acumulator sta PF1 ; (3 49) and store it lda pf2dataright,y ; (4 53) load right pf2 data into the acumulator sta PF2 ; (3 56) and store it (right PF2 MUST hit on cycle 48 to avoid writing too soon or too late) dex ; (2 58) decrement x bne ScanLoop_TitleScreen ; (2/3 60/61) and repeat if we're not finished with all the scanlines. ldx #02 ; (2 62/63) decrement y dey ; (2 64/65) subtract one off the line counter thingy bne ScanLoop_TitleScreen ; (2/3 66/67) and repeat if we're not finished with all the scanlines. M is now broken
  24. Those who preorder are "guaranteed a copy" and shipment on the day it comes out. Not sure if a Nes Classic/Snes Classic situation ever occurred with one of your products.
  25. Question for SLEEP x how do i count it cycle wise? Do i use x * 2 or the actual sleep time x?
×
×
  • Create New...