Subject: [stella] Updated missile.bin -- TWO missiles! :^) From: Ruffin Bailey <rufbo1@xxxxxxxxxxx> Date: Tue, 25 Jun 2002 23:28:42 -0400 |
Welp, between Kirk's recent message and Manuel's Beta Demo I finally broke out DAsm and did my biannual night's worth of 2600 hacking. Added another missile to the missile.bin code that's moved by player two's joystick (at least it works in MacStella 0.7), but I'm left with a couple of questions. The first is pretty easy, I think. When the two "missiles" (16 scans high right now to make them easier to see, so to speak) are on the same scan line, give or take, they change height. Is that because of timing issues regarding when I push Y into ENAM0 and ENAM1? Forgive me; I'm not up on timing issues just yet other than staying < 76 (?). Time to pull back out the timing guide and relearn my "weenie instructions". Second... in the code I open up initializing $80 and $81, the variables where I'm storing M0's y-position and M1's y-position, respectively, to #$40, yet the variables start out at zero when the app starts up. I'm storing $80 in GRP0 to debug and view the value, so to speak, and it's sure nuff zero to start. What's re-/un-initializing this value? Welp, a fun night's work while watching a movie, and a good excuse to pull OS 9 out of the closet for a while on the iBook. In 2004, players and collisions! Thanks in advance, and watch out for Mac line breaks. Ruffin Bailey
Attachment:
2missiles.asm
Description: application/applefile
; ------------------------------------------------------------------------ ; * Subject: [stella] Distella --> DAsm problem ; * From: Ruffin Bailey <rufbo@xxxxxxxxxxxxx> ; * Date: Fri, 21 Aug 98 13:55:03 -0000 ; ------------------------------------------------------------------------ ; See original message post for details ; http://www.biglist.com/lists/stella/archives/9808/msg00065.html ; dasm source.s -f3 -osource.bin ; Disassembly of missile.bin aka How to move a missile around your screen. ; Disassembled Sat Aug 15 11:32:54 1998 ; Using DiStella v2.0 on a Mac, no less! ; ; Command Line: distella -pafs missile.bin ; processor 6502 VSYNC = $00 VBLANK = $01 WSYNC = $02 COLUP0 = $06 COLUP1 = $07 COLUPF = $08 COLUBK = $09 CTRLPF = $0A PF0 = $0D PF1 = $0E GRP0 = $1B GRP1 = $1C ENAM0 = $1D ENAM1 = $1E ENABL = $1F HMM0 = $22 HMM1 = $23 HMOVE = $2A CXCLR = $2C SWCHA = $0280 INTIM = $0284 TIM64T = $0296 ORG $F000 START: SEI ;2 CLD ;2 LDA #$40 ;2 STA $80 ;3 $80 is holding the value where missle zero should be shown (the "y-value") ; starting at $40 (64 decimal) STA $81 ;3 $81 is holding the value where missle one should be shown (the "y-value") ; also starting at $40 (64 decimal) LDX #$FF ;2 TXS ;2 LDA #$00 ;2 LF00B: STA VSYNC,X ;4 DEX ;2 BNE LF00B ;2 JSR LF0D8 ;6 LF013: JSR LF025 ;6 JSR LF03F ;6 JSR LF044 ;6 JSR LF07D ;6 JSR LF0D0 ;6 JMP LF013 ;3 LF025: LDX #$00 ;2 LDA #$02 ;2 STA WSYNC ;3 STA WSYNC ;3 STA WSYNC ;3 STA VSYNC ;3 STA WSYNC ;3 STA WSYNC ;3 LDA #$2C ;2 STA TIM64T ;4 STA WSYNC ;3 STA VSYNC ;3 RTS ;6 LF03F: LDA #$00 ;2 STA COLUBK ;3 RTS ;6 LF044: LDA #$88 ;2 setting up the colors STA COLUP0 ;3 P0 is blue LDA #$36 ;2 STA COLUPF ;3 PF redish (won't see that here, though) LDA #$D8 ;2 STA COLUP1 ;3 P1 yellow (Sir Not Pictured in this film) LDA #$00 ;2 STA COLUBK ;3 BK black LDA #$00 ;2 STA CTRLPF ;3 LDA #$00 ;2 STA HMM0 ;3 if there's no joystick move, m0 goes nowhere sta HMM1 ; set missile one's move to nothing as well LDA SWCHA ;4 SWCHA dissection BMI LF065 ;2 Player 0 | Player 1 LDY #$F0 ;2 ===============|=============== STY HMM0 ;3 D7 D6 D5 D4 | D3 D2 D1 D0 LF065: ROL ;2 rt lt dn up | rt lt dn up BMI LF06C ;2 LDY #$10 ;2 I'm using BMI to read D7 of SWCHA STY HMM0 ;3 (which has been read into the accumulator) LF06C: ROL ;2 Then rolling the byte to the left and reading the BMI LF073 ;2 next bit (D6,5,4...) with BMI since the next INC $80 ;5 bit would now be D7. INC $80 ;5 LF073: ROL ;2 $80 holds the scan line that the missile BMI MISSLE1CHECK ;2 will appear on, and since I'm counting up from 1 DEC $80 ;5 in the screen drawing loop, I decrease $80 to move DEC $80 ;5 the missile up and increase $80 to go down. ; we're going to do the same thing now with missile 1 ; SWCHA's got that too! Keep rolling left MISSLE1CHECK rol ; grab the next bit BMI M1LEFT ;2 LDY #$F0 ;2 STY HMM1 ;3 M1LEFT: ROL ;2 BMI M1DOWN ;2 LDY #$10 ;2 STY HMM1 ;3 M1DOWN: ROL ;2 BMI M1UP ;2 INC $81 ;5 INC $81 ;5 M1UP: ROL ;2 BMI JOYDONE ;2 DEC $81 ;5 DEC $81 ;5 JOYDONE: STA CXCLR ;3 Clear the collision latches. ; see what's in $80 by sticking it in P1's graphic lda $80 sta GRP1 RTS ;6 I assume the HMM0 commands are self-explanatory! ;) ; SCREEN DRAW LF07D: LDA INTIM ;4 Here's the screen draw routine. BNE LF07D ;2 STA WSYNC ;3 STA VBLANK ;3 LDA #$02 ;2 STA CTRLPF ;3 LDX #$01 ;2 STA HMOVE ;3 DON'T FORGET TO HIT HMOVE!! or the object won't move ; horizontally. I might have forgotten that for a while, ; causing nearly unbearable psychological pain. LF08E: STA WSYNC ;3 INX ;2 Increase the line counter BEQ endScreen ;2 LF0B2: INX ;2 ldy #$00 txa ; get the line count in the accum sbc $80 adc #$10 bcc nextCheck ldy #$02 nextCheck sty ENAM0 ldy #$00 txa sbc $81 adc #$10 bcc beyondThis ldy #$02 beyondThis sty ENAM1 CPX #$C1 ;2 BEQ endScreen STA WSYNC ;3 looks like I was missing this line JMP LF0B2 ;2 ; Clean everything out and skip on out of the endScreen: LDA #$02 ;2 STA WSYNC ;3 STA VBLANK ;3 LDY #$00 ;2 STY PF0 ;3 STY PF1 ;3 STY PF1 ;3 STY GRP0 ;3 STY GRP1 ;3 STY ENAM0 ;3 STY ENAM1 ;3 STY ENABL ;3 RTS ;6 LF0D0: LDX #$1E ;2 LF0D2: STA WSYNC ;3 DEX ;2 BNE LF0D2 ;2 RTS ;6 LF0D8: LDA #$00 ;2 STA $90 ;3 RTS ;6 org $FFFC .word START .word START
xØ©@????¢ÿ?©