Tempest Posted September 20, 2001 Share Posted September 20, 2001 Ok, now I'm trying to read the bottom fire button on the 5200 stick. I was using this code: firebutton1 lda TRIG0 cmp #$00 bne mvplayer lda #$65 sta sCOLPM0 sta sCOLPM1 This should turn my player purple if the button is pressed but it doesn't seem to work. From what I read in the 400/800 programming book TRIG0 will have a 0 if the button is pressed and a 1 otherwise. What am I doing wrong? Tempest Quote Link to comment Share on other sites More sharing options...
Nukey Shay Posted September 20, 2001 Share Posted September 20, 2001 This is writing to the shadow, did you try writing to the hardware locations instead? BTW you don't really need to CMP #00, as loading the accumulator will automatically affect the N and Z flags. Quote Link to comment Share on other sites More sharing options...
+Cafeman Posted September 20, 2001 Share Posted September 20, 2001 I'm pretty sure you have to write to the shadow. The only time I write to the actual color registers is in a DLI; the color register is reset on each frame by the value in its shadow register. Right?! Quote Link to comment Share on other sites More sharing options...
+Cafeman Posted September 20, 2001 Share Posted September 20, 2001 Maybe you should be checking the shadow for Trig0? And not the register itself? this is a guess, but you know in my move routine I check the shadows of POT0 and POT1, not POT0/1 themselves. Try that. Quote Link to comment Share on other sites More sharing options...
DanBoris Posted September 20, 2001 Share Posted September 20, 2001 Ok, a few suggestions on this.. - You DO have to write the color values to the shadow registers. As Cafeman pointed out the hardware registers get overwritten by the shadows every v-blank. - Trig0 is not shadowed so you have to read the hardware registers. - Remeber the trig inputs only read the top triggers on the 5200 control. The bottom triggers are read via the keyboard scanning along with the rest of the keypad buttons. Other then this, the code should work as written. You might want to check to be sure the color register isn't getting reset elsewhere in the code. Dan Quote Link to comment Share on other sites More sharing options...
Tempest Posted September 20, 2001 Author Share Posted September 20, 2001 It works. I had stupidly forgotten to re-route a branch statement right before my fire button check so it always got branched around. Tempest Quote Link to comment Share on other sites More sharing options...
DEBRO Posted September 21, 2001 Share Posted September 21, 2001 quote: Originally posted by Dan Boris: - Remeber the trig inputs only read the top triggers on the 5200 control. The bottom triggers are read via the keyboard scanning along with the rest of the keypad buttons. Dan So are we to scan KBCODE for the top buttons? Is pressing the top buttons suppose to trigger an interrupt like the keypad? Quote Link to comment Share on other sites More sharing options...
OldGuru Posted November 25, 2001 Share Posted November 25, 2001 I've been trying to use the upper fire button without success so far... I tried the "SHIFT" approach (SKSTAT reading)- that works on the emulator but not on the real console (tried with 2 different controllers)... Then, I tried to use the VBRK interrupt to handle that but again without success (it seems that my interrupt routine was never called although I eneabled it...) Does anybody has any idea? Any hidden register's bit I need to set/clear somewhere? Any help is appreciated, Thanks, OldGuru. Quote Link to comment Share on other sites More sharing options...
Heaven/TQA Posted November 25, 2001 Share Posted November 25, 2001 firebutton1 lda TRIG0 cmp #$00 bne mvplayer lda #$65 sta sCOLPM0 sta sCOLPM1 what about: lda trig0 bne mvplayer lda #$65 sta $d4xx ; can't remember the actual GTIA/antic register sta $d4xx mvplayer ... should be faster. and if it is correct that the 5200 is nearly 800xl... do not use the shadow-registers. better use the antic/gtia registers directly... (who needs shadows anyway?) or does the bios of 5200 does this for you? on 800xl we switch off completly the ROM... i can not believe that you have to use the shadow registers which makes the whole code slower... try to use even zero page where possible...again faster on 6502... Quote Link to comment Share on other sites More sharing options...
DEBRO Posted November 26, 2001 Share Posted November 26, 2001 O.G. I'll just cover what I can remember off hand. Also know that I only did this on the VSS emulator using VTRIGR. 1) Set CONSOL high to enable the pots and set bits 0 and 1 to 0 to enable port 0 (I'm sure you did this because you helped me ) 2) Enable the break interrupt by setting bit 7 of POKMSK and IRQEN. 3) Point your VTRIGR vector to your fire button routine. This assumes that your VIMIRQ is set to $FC03. Also do a PLA before you return from this interrupt because VIMIRQ ($FC03) pushes the accumulator on the stack before executing. This of course is interesting as none of the other interrupts need to do this I hope this helps you. Quote Link to comment Share on other sites More sharing options...
OldGuru Posted January 7, 2002 Share Posted January 7, 2002 OK, It was my console! I got a new one last weekend (my old one is completely out of order) and had a chnace to test the upper fire button code. Both known (to me) ways did work: 1. The VBRK interrupt is taking place when the upper fire button is pressed. 2. Checking bit D3 (If I remember correctly) of SKSTAT does reflect the status of the upper fire button. I use this method in my game now... Hope that clears some confusion in respect to this matter. DEBRO - Thanks for your help on that one. O.G. 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.