_Fandal_ Posted February 22, 2009 Share Posted February 22, 2009 Hi all! I'm trying to convert Galactic Chase from A8 to 5200 as you might know... Everything was going pretty fine. I created source code of A8 version, changed HW registers for GTIA and Pokey, set up new DLI a VBI vectors, changed shadow registers for Antic, fixed joystick control and couple of another problems. The game plays fine now (under emulator) but I got stuck on keypad controls. This is my very first A8->5200 conversion and I need your help now!! I have no idea how to check keys properly. I'm only able to check if some key was pressed but I need to know if no key is pressed as well. How to do that?! Why am I asking? I'm checking if "start" key was pressed and then I start the game. But KBCODE still holds last pressed key and the game starts again and again and again and again... I'm lost! Please help! F. Quote Link to comment Share on other sites More sharing options...
CPUWIZ Posted February 22, 2009 Share Posted February 22, 2009 ;-----------------------------------------------------------------KBCodeVector ; KBCodeVector ; ; This is our Keypad continuation vector routine. The default Keyboard IRQ ; vector reads the KBCODE and converts the value for us but only ; stores this value in the accumulator. ; ; The default Keypad continuation vector just pops the stack and returns from ; the interrupt so the key press value is lost unless we store it somewhere. KBCodeVector ; Debounce logic here: rwl 8/08/03 ; on entry A=key just pressed CMP KEYLAST BNE KEYOK LDY KEYDB;SAME KEY, CHECK DEBOUNCE TIMER -- sample code has ldx BNE KEYDONE;IF DEBOUNCE ISN'T 0, REJECT THE KEY KEYOK STA CH;sample had "KEY" STA KEYLAST;STORE KEYPRESS KEYDONE LDA #$03;RESET DEBOUNCE TIMER STA KEYDB JMP XITVBL; You need to debounce the keys via interrupt, see above example. Quote Link to comment Share on other sites More sharing options...
kenfused Posted February 22, 2009 Share Posted February 22, 2009 Hi all! I'm trying to convert Galactic Chase from A8 to 5200 as you might know... Everything was going pretty fine. I created source code of A8 version, changed HW registers for GTIA and Pokey, set up new DLI a VBI vectors, changed shadow registers for Antic, fixed joystick control and couple of another problems. The game plays fine now (under emulator) but I got stuck on keypad controls. This is my very first A8->5200 conversion and I need your help now!! I have no idea how to check keys properly. I'm only able to check if some key was pressed but I need to know if no key is pressed as well. How to do that?! Why am I asking? I'm checking if "start" key was pressed and then I start the game. But KBCODE still holds last pressed key and the game starts again and again and again and again... I'm lost! Please help! F. I vary the code a little bit in my various conversions depending on need, etc, but this one is from one of my conversion. It looks like I check SKSTAT to check if a key is actually pressed. STIMER = $E809 KBCODE = STIMER SKCTL = $E80F SKSTAT = SKCTL GetConsole: lda SKSTAT and #4 bne ret7 lda KBCODE and #$0F<<1 cmp #$01<<1 beq ret5 cmp #$03<<1 beq ret3 cmp #$0c<<1 beq ret6 cmp #$04<<1 bne ret7 jmp resetkey ; cmp #$04<<1 ; beq reset ret7: lda #7 rts ret3: lda #3 rts ret5: lda #5 rts ret6: lda #6 rts Also going from memory I think anywhere a 3 is stored to SKCTL you need to store a 2 instead. If you don't do this it will probably work under emulation but not on the real thing. Quote Link to comment Share on other sites More sharing options...
_Fandal_ Posted February 23, 2009 Author Share Posted February 23, 2009 Thank you very much for your help guys! It seems I've done it! Please check it on real HW as I don't have it... F. GalacticChase.zip Quote Link to comment Share on other sites More sharing options...
darthkur Posted February 23, 2009 Share Posted February 23, 2009 Thank you very much for your help guys! It seems I've done it! Please check it on real HW as I don't have it... F. Can you convert that file to a .bin? That way I can load it onto my Atarimax flashcart and try it out on an actual 5200. Quote Link to comment Share on other sites More sharing options...
_Fandal_ Posted February 23, 2009 Author Share Posted February 23, 2009 Thank you very much for your help guys! It seems I've done it! Please check it on real HW as I don't have it... F. Can you convert that file to a .bin? That way I can load it onto my Atarimax flashcart and try it out on an actual 5200. This a .bin file (8192 bytes). Just rename it if you need it. F. Quote Link to comment Share on other sites More sharing options...
darthkur Posted February 23, 2009 Share Posted February 23, 2009 Thank you very much for your help guys! It seems I've done it! Please check it on real HW as I don't have it... F. Can you convert that file to a .bin? That way I can load it onto my Atarimax flashcart and try it out on an actual 5200. This a .bin file (8192 bytes). Just rename it if you need it. F. Well, I renamed it and although it still registered as a cartridge image I was still able to load it onto the flashcart by selecting "all files". The game boots up to the rainbow Fuji symbol the the attract mode and then starts when the Start button is depressed. Unfortunately the ship immediately moves to the far right and remains there no matter what position you place the controller in. It will fire though with the two lower side buttons. Pause and Reset have no effect. I pressed all of the keypad buttons in order to see what effect they had and afterwards the ship would no longer fire. After pressing Start it commenced a new game, the ship moved to the far right again and you could fire once more at will. The graphics are perfect with no distortions. Sounds is present as well. I'm using the stock 5200 controller. Quote Link to comment Share on other sites More sharing options...
_Fandal_ Posted February 23, 2009 Author Share Posted February 23, 2009 Oh my, damned 5200 controllers. It's weird. I took joystick position detection routine from another 5200 game. I use this piece of code: read_joystick txa ; X = player 0 or 1 asl @ tax lda ZP_11,x sec sbc #$70 bcs joystick_right eor #$FF adc #$01 cmp #$10 bcc no_movement jmp L_3286 ; joystick left no_movement jmp L_32A2 joystick_right cmp #$10 bcc no_movement jmp L_3260 ; joystick right What's wrong with this? I can post source code of the game here, if anobody with more 5200 experiences can fix it. F. Quote Link to comment Share on other sites More sharing options...
roadrunner Posted February 24, 2009 Share Posted February 24, 2009 (edited) Cool game. This is the first time i played Galactic Chase. I played it on the Atari800winplus. I had to change to file name from .car to .BIN The game is very similar to Galaxian. Can you convert Zoo Keeper or Commando to the 5200? Edited February 24, 2009 by roadrunner Quote Link to comment Share on other sites More sharing options...
ZylonBane Posted February 24, 2009 Share Posted February 24, 2009 Can you convert Zoo Keeper ... to the 5200? From what? Quote Link to comment Share on other sites More sharing options...
roadrunner Posted February 24, 2009 Share Posted February 24, 2009 (edited) Can you convert Zoo Keeper ... to the 5200? From what? Can the arcade version be ported to the 5200? Edited February 24, 2009 by roadrunner Quote Link to comment Share on other sites More sharing options...
ZylonBane Posted February 24, 2009 Share Posted February 24, 2009 Can the arcade version be ported to the 5200? Okayyy.... you DO understand why porting an Atari 800 game to the 5200 is significantly easier than porting an arcade game... right? Quote Link to comment Share on other sites More sharing options...
roadrunner Posted February 24, 2009 Share Posted February 24, 2009 Can the arcade version be ported to the 5200? Okayyy.... you DO understand why porting an Atari 800 game to the 5200 is significantly easier than porting an arcade game... right? No. I just thought i'd ask. Quote Link to comment Share on other sites More sharing options...
+Cafeman Posted February 24, 2009 Share Posted February 24, 2009 Playing this on A800win, there seems to be control problems. At first you gotta press up and down to move right and left. Then it seemed to fix itself (?) -- right and left worked properly. Sometimes the button didn't work for me. I've never run into these problems with other 5200 games so I am thinking there are bugs in the control routines. If you really want anyone to play this on 5200, allow us to hold in the fire button for auto-fire. 5200 button presses can cramp one's hands easier than using the standard Atari 2600/A8 joysticks. Quote Link to comment Share on other sites More sharing options...
kenfused Posted February 24, 2009 Share Posted February 24, 2009 Playing this on A800win, there seems to be control problems. At first you gotta press up and down to move right and left. Then it seemed to fix itself (?) -- right and left worked properly. Sometimes the button didn't work for me. I've never run into these problems with other 5200 games so I am thinking there are bugs in the control routines. If you really want anyone to play this on 5200, allow us to hold in the fire button for auto-fire. 5200 button presses can cramp one's hands easier than using the standard Atari 2600/A8 joysticks. This is kinda ugly but this was what I had for the joystick routines in some of my conversions. I think this was running in the VBI, it would fill in STICK0, STICK1 and SPORTA so it was kinda usable by games that read the shadow registers or the hardware PIA register. I never built in any calibration and I may have tweaked the limits on different games. lda $E802 cmp #114+50 rol stickval cmp #114-50 rol stickval lda $E803 cmp #114+50 rol stickval cmp #114-50 rol stickval lda $E800 cmp #114+50 rol stickval cmp #114-50 rol stickval lda $E801 cmp #114+50 rol stickval cmp #114-50 rol stickval sta POTGO lda stickval eor #2+8+32+128 pha and #$0F sta STICK0 pla pha lsr a lsr a lsr a lsr a STA STICK1 pla sta SPORTA ... Quote Link to comment Share on other sites More sharing options...
+Cafeman Posted February 24, 2009 Share Posted February 24, 2009 First make sure you are setting your interrupts/registers .. ; initialize stuff: lda #$02 ; Bit 0 must be 0 for keypad scan! sta SKCTL lda #$04 ; Enables POT read, otherwise, can't access joystick sta CONSOLR ; cli ; Enable interrupts lda #$40 ; Set POKMSK and IRQEN to #$40 sta POKMSK ; to enable the "other key" interrupt sta IRQEN lda #$00 ;Set Display list pointer sta sDLISTL sta DLISTL lda #$10 sta sDLISTH sta DLISTH lda #$f8 ;Set Charcter Set Base sta CHBASE lda #$22 ;Enable DMA sta sDMACTL lda #$C0 ; Enable NMI sta NMIEN Here are my routines for horizontal and vertical movement .. see if you can spot anything that can help. My main loop jsr's horizmove, then jsr's vertmove: horizmove lda SPOT0 ; Check the value of POT0 to see if the joystick is centered. ; use value of 120 for centered stick: ; lsr ;divide by 2 to prevent overflow cmp #$1A ; stick pulled left bmi mvleft cmp #$50 ; stick pulled right bpl mvright rts horizmove1 clc sbc #$78 ; Subtract 120 from the POT0 value bmi mvleft ; If this value is negative then the ; user is pushing to the left mvright lda #$00 sta ATRACT ;turn off attract mode when there is joystick input cpx #$C8 ; If the player is at the right most (used to be $CA) ; side of the playfield then don't bne mvright1; move right rts mvright1 lda leftright sta PrevDir ; save off previous direction faced, for middle animation lda #$01 ; this code means draw right-facing helicoper sta leftright inx ; Move 1 pixels to the right rts mvleft lda #$00 sta ATRACT ;turn off attract mode when there is joystick input cpx #$30 ; If the player is at the left most (used to be $40) ; side of the playfield then don't bne mvleft1 ; move left. rts mvleft1 lda leftright sta PrevDir ; save off previous direction faced, for middle animation lda #$00 ; this code means draw right-facing helicoper sta leftright dex ; Move 1 pixels to the left rts ;******************** vertmove lda SPOT1 ;added on 10/27/01 per debro: lsr;divide by 2 to prevent overflow cmp #$1A ; stick pulled up bmi mvup cmp #$50 ; stick pulled down bpl mvdown rts mvdown lda $20 ; rwltst cmp lowbound bne mvdown1 rts mvdown1 ;************ Erase Prior Bitmap image in Player's RAM memory ********** ldy #$00 eraseDwn lda erpm1,y ;Get data sta ($20),y ; pl0 sta ($22),y ; pl1 iny cpy #$0B ;Copy 11 bytes bne eraseDwn inc $20 ; pl0 inc $22 ; pl1 DwnOut rts mvup lda $20 cmp #$2d; check if too high bne mvup1 rts mvup1 ;************ Erase Prior Bitmap image in Player's RAM memory ********** ldy #$00 eraseUp lda erpm1,y ;Get data sta ($20),y ;pl0 sta ($22),y ;pl1 iny cpy #$0B ;Copy 11 bytes bne eraseUp dec $20 ;pl0 dec $22 ;pl1 UpOut rts From another game's source code here is a sample from my VBIDeferred routine, for the upper triggers: AfterCHCheck2 ; *** ; *** check bit 4 of SKCTL for upper fire buttons. ; *** debounce upper trigger: lda UpperTrigCnt ;must init to $00!!! beq CheckUpperTrig dec UpperTrigCnt jmp AfterUpperTrig CheckUpperTrig lda SKCTL AND #$08 beq UpperFireButtonPressed ; *** end debounce upper trigger ; also use CH ; commented out to get vbi timing to work again, 2/11/06: AfterUpperTrig ;3/3/06 debounce upper trig lda CH cmp #$06 bne AfterCHChecks ;AfterCHCHCheckManip 9/6/06 UpperFireButtonPressed ;new 12/24/05 lda #$08 sta UpperTrigCnt Quote Link to comment Share on other sites More sharing options...
_Fandal_ Posted February 24, 2009 Author Share Posted February 24, 2009 First make sure you are setting your interrupts/registers .. ; initialize stuff: lda #$02 ; Bit 0 must be 0 for keypad scan! sta SKCTL lda #$04 ; Enables POT read, otherwise, can't access joystick sta CONSOLR; cli ; Enable interrupts lda #$40 ; Set POKMSK and IRQEN to #$40 sta POKMSK ; to enable the "other key" interrupt sta IRQEN lda #$00 ;Set Display list pointer sta sDLISTL sta DLISTL lda #$10 sta sDLISTH sta DLISTH lda #$f8 ;Set Charcter Set Base sta CHBASE lda #$22 ;Enable DMA sta sDMACTL lda #$C0 ; Enable NMI sta NMIEN It seems this is my problem on real HW. I'm not familiar with 5200 so I didn't know I must set SKCTL and CONSOLR registers... Thanks a lot! F. Quote Link to comment Share on other sites More sharing options...
kenfused Posted February 24, 2009 Share Posted February 24, 2009 It seems this is my problem on real HW. I'm not familiar with 5200 so I didn't know I must set SKCTL and CONSOLR registers... Thanks a lot! F. Also be sure to check the existing code for any stores of 3 to SKCTL and if so change them to 2. Quote Link to comment Share on other sites More sharing options...
+Allan Posted February 24, 2009 Share Posted February 24, 2009 Can the arcade version be ported to the 5200? Okayyy.... you DO understand why porting an Atari 800 game to the 5200 is significantly easier than porting an arcade game... right? No. I just thought i'd ask. The 8-bit computers and the 5200 are about 98% the same. Anything else like arcade games, the 2600, the Colecovision, etc., are very different. The only programs you can convert to the 5200 are the atari 8-bit computer programs. And even among them you can only convert a small number of them. Allan Quote Link to comment Share on other sites More sharing options...
roadrunner Posted February 24, 2009 Share Posted February 24, 2009 (edited) Can the arcade version be ported to the 5200? Okayyy.... you DO understand why porting an Atari 800 game to the 5200 is significantly easier than porting an arcade game... right? No. I just thought i'd ask. The 8-bit computers and the 5200 are about 98% the same. Anything else like arcade games, the 2600, the Colecovision, etc., are very different. The only programs you can convert to the 5200 are the atari 8-bit computer programs. And even among them you can only convert a small number of them. Allan I didn't know how difficult it was for you guys to convert games to the 5200. I'm Sorry if i made anybody upset. Edited February 24, 2009 by roadrunner Quote Link to comment Share on other sites More sharing options...
+Allan Posted February 24, 2009 Share Posted February 24, 2009 Can the arcade version be ported to the 5200? Okayyy.... you DO understand why porting an Atari 800 game to the 5200 is significantly easier than porting an arcade game... right? No. I just thought i'd ask. The 8-bit computers and the 5200 are about 98% the same. Anything else like arcade games, the 2600, the Colecovision, etc., are very different. The only programs you can convert to the 5200 are the atari 8-bit computer programs. And even among them you can only convert a small number of them. Allan I didn't know how difficult it was for you guys to convert games to the 5200. I'm Sorry if i made anybody upset. No one was upset. Not everybody on Atariage is going to be an expert on everything Atari. That's what the board is here for. So that you can learn all about atari. Asking questions is how you learn things. Allan Quote Link to comment Share on other sites More sharing options...
ZylonBane Posted February 24, 2009 Share Posted February 24, 2009 I didn't know how difficult it was for you guys to convert games to the 5200. I'm Sorry if i made anybody upset. If you're feeling particularly penitent, getting rid of that infantile avatar would be a much-welcomed gesture. Quote Link to comment Share on other sites More sharing options...
_Fandal_ Posted February 25, 2009 Author Share Posted February 25, 2009 OK. Another try. Please test it on real HW. Hopefully it will work much better than previous version. F. GalacticChase.zip Quote Link to comment Share on other sites More sharing options...
darthkur Posted February 25, 2009 Share Posted February 25, 2009 (edited) OK. Another try. Please test it on real HW. Hopefully it will work much better than previous version. F. I played about a half dozen games using the 5200 flash cart. It seems to play properly. I tried the Pause and Reset during game play to no result. I also tried 1 - 0, again with no discernible result. By pressing either the star or pound keys results in the ongoing game locking up. Selecting Start began a new game. Shortly afterwards the same bug as before made it's appearance, with the ship moving to the right and staying there. I could not fire either. The game kept running and once the ship was destroyed I could move it on the subsequent life. A couple minutes later the bug took effect again. I turned off the power to the console and started anew. Games played after that played fine but I did not press any of the keys. I did notice that before a new game is started that pressing the star key selected a two player option. Having only one functional controller I didn't test the second player playability. By pressing the pound key I noticed an asterisk would appear next to the highest board achieved count that is retained for the high score. Is there an actual function to this? I could not discern any difference. I also tried both the new bin and the original cassette image using Atari800Win and both seemed comparable in speed and gameplay to the game running on the actual hardware. I hope this helps and thanks for the work you are doing. This game is rather enjoyable. Edited February 25, 2009 by darthkur Quote Link to comment Share on other sites More sharing options...
_Fandal_ Posted February 26, 2009 Author Share Posted February 26, 2009 OK. Another try. Please test it on real HW. Hopefully it will work much better than previous version. F. I played about a half dozen games using the 5200 flash cart. It seems to play properly. I tried the Pause and Reset during game play to no result. I also tried 1 - 0, again with no discernible result. By pressing either the star or pound keys results in the ongoing game locking up. Selecting Start began a new game. Shortly afterwards the same bug as before made it's appearance, with the ship moving to the right and staying there. I could not fire either. The game kept running and once the ship was destroyed I could move it on the subsequent life. A couple minutes later the bug took effect again. I turned off the power to the console and started anew. Games played after that played fine but I did not press any of the keys. I did notice that before a new game is started that pressing the star key selected a two player option. Having only one functional controller I didn't test the second player playability. By pressing the pound key I noticed an asterisk would appear next to the highest board achieved count that is retained for the high score. Is there an actual function to this? I could not discern any difference. I also tried both the new bin and the original cassette image using Atari800Win and both seemed comparable in speed and gameplay to the game running on the actual hardware. I hope this helps and thanks for the work you are doing. This game is rather enjoyable. Thanks a lot for testing! Reset or Pause keys should do nothing. That's OK. Star and pound keys select one/two player(s) mode and difficulty. Higher difficulty is noticed by asterisk. The game should stop when you press star or pound but you should be able to start a new game by pressing start key. Unfortunately I have no idea why there's still a bug with ship control... Well, it seems Galactic Chase is my first and the last try to convert anything from A8 to 5200. It a real pain to convert something as I don't have real HW and behavior of AtariWin PLus emulator is so different from real thing... F. 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.