diff --git a/Atari/display_purchasedl.asm b/Atari/display_purchasedl.asm index f2d8353..79e3779 100644 --- a/Atari/display_purchasedl.asm +++ b/Atari/display_purchasedl.asm @@ -15,7 +15,7 @@ DLPurTitleAddr .byte $50 .byte $42 .word purchaseTextBuffer - .byte $00+$80 + .byte $00+$80 .byte $20+$80,$10+$80,$42 MoreUpdl .word EmptyLine diff --git a/Atari/display_static.asm b/Atari/display_static.asm index 52e2674..07f6b0d 100644 --- a/Atari/display_static.asm +++ b/Atari/display_static.asm @@ -13,7 +13,7 @@ OptionsScreen .IF TARGET = 800 dta d" Please select option with " - dta $fe,$dc,$dd,$ff ; cursors in inverse + dta $fe,$dc,$dd,$ff ; cursors in inverse dta d" and " dta d"Tab"* dta d" " @@ -40,7 +40,7 @@ NameScreen5 .IF TARGET = 800 dta d"TAB"* dta d" - Port nr " - dta $fe,$dc,$dd,$ff ; cursors in inverse + dta $fe,$dc,$dd,$ff ; cursors in inverse dta d" - Difficulty" dta d" " dta d"INV"* @@ -182,19 +182,19 @@ dl ; MAIN game display list ;----------------------------------------------- OptionsDL .byte $70 - .byte $47 - .word OptionsTitle + .byte $47 + .word OptionsTitle .byte $70,$70 .byte $42 .word OptionsScreen .byte $30,$02,$02,$70 - .byte $42 - .word OptionsHere - .byte $10 + .byte $42 + .word OptionsHere + .byte $10 :maxOptions-1 .by $02,$10 - :(9-maxOptions) .by $70,$10 - .byte $80 - .byte $60 ; to match moved sprites + :(9-maxOptions) .by $70,$10 + .byte $80 + .byte $60 ; to match moved sprites .byte $4f .word (display+140*40) :21 .by $0f ;76 @@ -204,25 +204,25 @@ OptionsDL ;Enter names of tanks DL NameDL .byte $70 - .byte $47 - .word DifficultyTitle - .byte $70,$70 ; 16 empty lines + .byte $47 + .word DifficultyTitle + .byte $70,$70 ; 16 empty lines .byte $42 .word NameScreen - .byte $30 ; 4 empty lines - .byte $42 - .word NameScreen2 - .byte $30+$80 ; 4 empty lines + DLI - .byte $42 - .word NameScreen3 - .byte $10 ; 2 empty lines - .byte $42 - .word NameScreen4 - .byte $02,$02 - .byte $30 ; 4 empty lines - .byte $42 - .word NameScreen5 - .byte $02 + .byte $30 ; 4 empty lines + .byte $42 + .word NameScreen2 + .byte $30+$80 ; 4 empty lines + DLI + .byte $42 + .word NameScreen3 + .byte $10 ; 2 empty lines + .byte $42 + .word NameScreen4 + .byte $02,$02 + .byte $30 ; 4 empty lines + .byte $42 + .word NameScreen5 + .byte $02 .byte $41 .word NameDL ; ------------------------------------------------- @@ -252,8 +252,8 @@ GameOverDL .byte $42 .word GameOverResults :5 .byte $00+$80,$02 - .byte $01 - .word DLCreditsFragm + .byte $01 + .word DLCreditsFragm ; --------------- ; end of "constants" (ROM) ;----------------------------------------------- diff --git a/Atari/gr_basics.asm b/Atari/gr_basics.asm index 3dec1df..18219dd 100644 --- a/Atari/gr_basics.asm +++ b/Atari/gr_basics.asm @@ -41,7 +41,7 @@ MakeUnPlot ;--- tay ldx WhichUnPlot - tya + tya sta oldply,x ldx ydraw @@ -194,43 +194,43 @@ ClearPlot ;-------------------------------------------------- mwa #0 xdraw mwa #mountaintable modify - mva #1 color + mva #1 color drawmountainsloop ldy #0 lda (modify),y - cmp #screenheight - beq NoMountain + cmp #screenheight + beq NoMountain sta ydraw - sty ydraw+1 + sty ydraw+1 .IF FASTER_GRAF_PROCS = 1 -; there was Drawline proc +; there was Drawline proc lda #screenheight sec sbc ydraw sta tempbyte01 jsr plot.MakePlot - ; after plot we have: (xbyte),y - addres of screen byte; X - index in bittable (number of bit) + ; after plot we have: (xbyte),y - addres of screen byte; X - index in bittable (number of bit) ; jmp IntoDraw ; jumps inside Draw routine ; because one pixel is already plotted (and who cares? :) ) @ - lda (xbyte),y - and bittable2,x - sta (xbyte),y + lda (xbyte),y + and bittable2,x + sta (xbyte),y ;IntoDraw - adw xbyte #screenBytes - dec tempbyte01 - bne @- -; end of Drawline proc + adw xbyte #screenBytes + dec tempbyte01 + bne @- +; end of Drawline proc .ELSE -; there was Drawline proc +; there was Drawline proc drawline jsr plot.MakePlot - inc ydraw - lda ydraw - cmp #screenheight - bne drawline -; end of Drawline proc + inc ydraw + lda ydraw + cmp #screenheight + bne drawline +; end of Drawline proc .ENDIF NoMountain inw modify @@ -261,7 +261,7 @@ NoMountain ldy #7 CopyChar lda (fontind),y - eor #$ff + eor #$ff sta char1,y lda #$ff sta char2,y @@ -272,7 +272,7 @@ CopyChar ldy #7 CopyMask lda (fontind),y - eor #$ff + eor #$ff sta mask1,y lda #$00 sta mask2,y @@ -312,7 +312,7 @@ MakeMask00 .endr sec .rept 8 - ror char1+# ; in second (and next) lines we have C=1 - one SEC enough + ror char1+# ; in second (and next) lines we have C=1 - one SEC enough ror char2+# .endr dex @@ -331,12 +331,12 @@ EmptyChar ldx #0 CharLoopi lda (xbyte),y - ora mask1,x + ora mask1,x and char1,x sta (xbyte),y iny lda (xbyte),y - ora mask2,x + ora mask2,x and char2,x sta (xbyte),y dey @@ -345,42 +345,42 @@ CharLoopi cpx #8 bne CharLoopi .ELSE - mvx #7 temp ; line counter (Y) + mvx #7 temp ; line counter (Y) CharLoop1 - mva #7 temp+1 ; pixel counter (X) + mva #7 temp+1 ; pixel counter (X) CharLoop2 - mva #0 color - rol mask1,x - bcc NoMaskNoPlot - rol char1,x - bcs NoPlot + mva #0 color + rol mask1,x + bcc NoMaskNoPlot + rol char1,x + bcs NoPlot MakeCharPlot - lda Erase - bne ErasingChar - inc color + lda Erase + bne ErasingChar + inc color ErasingChar NoPlot - jsr plot.MakePlot + jsr plot.MakePlot AfterCharPlot - inw xdraw - ldx temp - dec temp+1 - bpl CharLoop2 - sec - sbw xdraw #8 - dec ydraw - ldx temp - dex - stx temp - bpl CharLoop1 - clc - lda ydraw - adc #8 - sta ydraw - bne EndPutChar + inw xdraw + ldx temp + dec temp+1 + bpl CharLoop2 + sec + sbw xdraw #8 + dec ydraw + ldx temp + dex + stx temp + bpl CharLoop1 + clc + lda ydraw + adc #8 + sta ydraw + bne EndPutChar NoMaskNoPlot - rol char1,x - jmp AfterCharPlot + rol char1,x + jmp AfterCharPlot .ENDIF EndPutChar rts @@ -397,16 +397,16 @@ EndPutChar ;-------------------------------------------------- cpw dy #(screenheight-1) jcs TypeChar.EndPutChar ;nearest RTS - cpw dy #(4) - jcc TypeChar.EndPutChar ;nearest RTS + cpw dy #(4) + jcc TypeChar.EndPutChar ;nearest RTS cpw dx #(screenwidth-4) jcs TypeChar.EndPutChar ;nearest RTS - ; checks ommited. + ; checks ommited. ; char to the table lda CharCode4x4 and #%00000001 - beq Upper4bits - lda #$ff ; better option to check (nibbler4x4 = $00 or $ff) + beq Upper4bits + lda #$ff ; better option to check (nibbler4x4 = $00 or $ff) Upper4bits sta nibbler4x4 lda CharCode4x4 @@ -414,28 +414,28 @@ Upper4bits sta fontind lda #$00 sta fontind+1 - + adw fontind #font4x4 ; and 4 bytes to the table - ldy #0 + ldy #0 ldx #3 CopyChar - lda (fontind),y ; Y must be 0 !!!! - bit nibbler4x4 - bpl GetUpper4bits - :4 rol + lda (fontind),y ; Y must be 0 !!!! + bit nibbler4x4 + bpl GetUpper4bits + :4 rol GetUpper4bits - ora #$0f + ora #$0f sta char1,x lda #$ff sta char2,x ; and 4 bytes as a mask - lda #$f0 + lda #$f0 sta mask1,x lda #$00 sta mask2,x - adw fontind #32 ; next byte of 4x4 font + adw fontind #32 ; next byte of 4x4 font dex bpl CopyChar @@ -451,7 +451,7 @@ GetUpper4bits ; rorw xbyte ; rorw xbyte ;--- - ldy xbyte ; horizontal byte offet stored in Y + ldy xbyte ; horizontal byte offet stored in Y lda dy ; y = y - 3 because left lower. sec sbc #3 @@ -471,75 +471,75 @@ MakeMask01 .endr sec .rept 4 - ror char1+# ; in second (and next) lines we have C=1 - one SEC enough + ror char1+# ; in second (and next) lines we have C=1 - one SEC enough ror char2+# .endr dex bne MakeMask01 MaskOK01 - ldx #0 + ldx #0 CharLoopi4x4 lda (xbyte),y - ora mask1,x - bit plot4x4color - bpl PutInColor0_1 ; only mask - no char + ora mask1,x + bit plot4x4color + bpl PutInColor0_1 ; only mask - no char and char1,x PutInColor0_1 sta (xbyte),y iny lda (xbyte),y - ora mask2,x - bit plot4x4color - bpl PutInColor0_2 ; only mask - no char + ora mask2,x + bit plot4x4color + bpl PutInColor0_2 ; only mask - no char and char2,x PutInColor0_2 sta (xbyte),y dey adw xbyte #screenBytes inx - cpx #4 + cpx #4 bne CharLoopi4x4 .ELSE - mwa xdraw char2 - mwa ydraw mask2 - mva color mask2+2 - mwa dx xdraw - mwa dy ydraw - mvx #3 temp ; line counter (Y) + mwa xdraw char2 + mwa ydraw mask2 + mva color mask2+2 + mwa dx xdraw + mwa dy ydraw + mvx #3 temp ; line counter (Y) CharLoop1 - mva #3 temp+1 ; pixel counter (X) + mva #3 temp+1 ; pixel counter (X) CharLoop2 - mva #0 color - rol mask1,x - bcc NoMaskNoPlot - rol char1,x - bcs NoPlot + mva #0 color + rol mask1,x + bcc NoMaskNoPlot + rol char1,x + bcs NoPlot MakeCharPlot - lda plot4x4color - beq ErasingChar - inc color + lda plot4x4color + beq ErasingChar + inc color ErasingChar NoPlot - jsr plot.MakePlot + jsr plot.MakePlot AfterCharPlot - inw xdraw - ldx temp - dec temp+1 - bpl CharLoop2 - sec - sbw xdraw #4 - dec ydraw - ldx temp - dex - stx temp - bpl CharLoop1 - mwa char2 xdraw - mwa mask2 ydraw - mva mask2+2 color - bpl EndPut4x4 + inw xdraw + ldx temp + dec temp+1 + bpl CharLoop2 + sec + sbw xdraw #4 + dec ydraw + ldx temp + dex + stx temp + bpl CharLoop1 + mwa char2 xdraw + mwa mask2 ydraw + mva mask2+2 color + bpl EndPut4x4 NoMaskNoPlot - rol char1,x - jmp AfterCharPlot + rol char1,x + jmp AfterCharPlot .ENDIF EndPut4x4 rts @@ -573,7 +573,7 @@ EndPut4x4 iny cpy #screenheight+1 bne @- - rts + rts .endp ;-------------------------------------------------- .proc SetMainScreen @@ -584,7 +584,7 @@ EndPut4x4 ; and #$fc ; ora #$02 ; 2=normal, 3 = wide screen width sta dmactls - mva WallsType COLBAKS ; set color of background + mva WallsType COLBAKS ; set color of background jsr WaitOneFrame rts .endp @@ -601,79 +601,79 @@ EndPut4x4 ; ------------------------------------------------- mva #sfx_sandhog sfx_effect .IF FASTER_GRAF_PROCS = 1 - ldy #0 ; byte counter (from 0 to 39) + ldy #0 ; byte counter (from 0 to 39) NextColumn - ; big loop - we repat internal loops for each column of bytes - sty magic - ldx #120 ; line counter (from 0 to 60 ) - ; first loop - inverse column of bytes for a while - ldy magic + ; big loop - we repat internal loops for each column of bytes + sty magic + ldx #120 ; line counter (from 0 to 60 ) + ; first loop - inverse column of bytes for a while + ldy magic NextLine1 - jsr InverseScreenByte - dex - dex - bpl NextLine1 - ; - jsr WaitOneFrame ; wait uses A only - ; second loop - inverse again and put random "snow" to column of bytes - ldx #120 - ldy magic - mva #$55 magic+1 + jsr InverseScreenByte + dex + dex + bpl NextLine1 + ; + jsr WaitOneFrame ; wait uses A only + ; second loop - inverse again and put random "snow" to column of bytes + ldx #120 + ldy magic + mva #$55 magic+1 NextLine2 - jsr InverseScreenByte - lda random - ora magic+1 - and (temp),y - sta (temp),y - lda magic+1 - eor #$ff - sta magic+1 - dex - dex - bpl NextLine2 - ; and go to next column - iny - cpy #40 - bne NextColumn + jsr InverseScreenByte + lda random + ora magic+1 + and (temp),y + sta (temp),y + lda magic+1 + eor #$ff + sta magic+1 + dex + dex + bpl NextLine2 + ; and go to next column + iny + cpy #40 + bne NextColumn .ELSE - mva #1 color - mwa #120 ydraw + mva #1 color + mwa #120 ydraw NextLineSlow - lda #0 - sta xdraw - sta xdraw+1 + lda #0 + sta xdraw + sta xdraw+1 NextPixelSlow - bit random - bpl NoPlot - bvc NoPlot - jsr plot.MakePlot + bit random + bpl NoPlot + bvc NoPlot + jsr plot.MakePlot NoPlot - inw xdraw - cpw xdraw #screenwidth - bne NextPixelSlow - dec ydraw - dec ydraw - bpl NextLineSlow + inw xdraw + cpw xdraw #screenwidth + bne NextPixelSlow + dec ydraw + dec ydraw + bpl NextLineSlow .ENDIF - ; and we have "snow" :) - lda #0 - ldx TankNr - sta ActiveDefenceWeapon,x ; deactivate Nuclear Winter - jsr SetFullScreenSoilRange + ; and we have "snow" :) + lda #0 + ldx TankNr + sta ActiveDefenceWeapon,x ; deactivate Nuclear Winter + jsr SetFullScreenSoilRange jsr SoilDown2.NoClearTanks - rts + rts - ; in order to optimize the fragment repeated in both internal loops - ; we save 15 bytes :) + ; in order to optimize the fragment repeated in both internal loops + ; we save 15 bytes :) InverseScreenByte - lda LineTableL,x - sta temp - lda LineTableH,x - sta temp+1 - lda (temp),y - eor #$ff - sta (temp),y - rts + lda LineTableL,x + sta temp + lda LineTableH,x + sta temp+1 + lda (temp),y + eor #$ff + sta (temp),y + rts .endp .ENDIF \ No newline at end of file diff --git a/Atari/interrupts.asm b/Atari/interrupts.asm index 175bdb1..e78b4fb 100644 --- a/Atari/interrupts.asm +++ b/Atari/interrupts.asm @@ -1,114 +1,114 @@ -; @com.wudsn.ide.asm.mainsourcefile=scorch.asm +; @com.wudsn.ide.asm.mainsourcefile=scorch.asm .IF *>0 ;this is a trick that prevents compiling this file alone ;-------------------------------------------------- .proc DLIinterruptGraph - pha - phy - ldy dliCounter - lda dliColorsBack,y + pha + phy + ldy dliCounter + lda dliColorsBack,y .IF TARGET = 800 - nop ; necessary on 800 because DLIs take less time, jitter visible without it - nop - nop + nop ; necessary on 800 because DLIs take less time, jitter visible without it + nop + nop .ENDIF - nop - nop + nop + nop sta COLPF1 - lda GradientNr - bne GoGradient - ldy #$ff ; one mauntain color + lda GradientNr + bne GoGradient + ldy #$ff ; one mauntain color GoGradient - iny - lda (GradientColors),y ; mountains colors array - sta COLPF2 - inc dliCounter + iny + lda (GradientColors),y ; mountains colors array + sta COLPF2 + inc dliCounter ply pla rti .endp ;-------------------------------------------------- .proc DLIinterruptOptions - pha - phy - lda #0 ; background color + pha + phy + lda #0 ; background color sta COLPF1 - ldy GradientNr - beq @+ - ldy #1 -@ lda (GradientColors),y ; mountains colors array - sta COLPF2 - ply + ldy GradientNr + beq @+ + ldy #1 +@ lda (GradientColors),y ; mountains colors array + sta COLPF2 + ply pla rti .endp ;-------------------------------------------------- .proc DLIinterruptGameOver - pha - phy - lda dliCounter - bne EndofPMG - lda #%00100001 ; playfield after P/M - prior=1 - ;STA WSYNC + pha + phy + lda dliCounter + bne EndofPMG + lda #%00100001 ; playfield after P/M - prior=1 + ;STA WSYNC sta PRIOR - bne EndOfDLI_GO + bne EndOfDLI_GO EndofPMG - cmp #1 - bne ColoredLines - lda #%00100100 ; playfield before P/M - ;STA WSYNC + cmp #1 + bne ColoredLines + lda #%00100100 ; playfield before P/M + ;STA WSYNC sta PRIOR - bne EndOfDLI_GO + bne EndOfDLI_GO ColoredLines - cmp #9 - beq CreditsScroll - tay - lda GameOverColoursTable-3,y ; -2 because this is DLI nr 2 and -1 (labels line) - ldy #$0a ; text colour (brightnes) - ;STA WSYNC - sta COLPF2 - sty COLPF1 - bne EndOfDLI_GO + cmp #9 + beq CreditsScroll + tay + lda GameOverColoursTable-3,y ; -2 because this is DLI nr 2 and -1 (labels line) + ldy #$0a ; text colour (brightnes) + ;STA WSYNC + sta COLPF2 + sty COLPF1 + bne EndOfDLI_GO CreditsScroll - lda #$00 - sta COLPF2 + lda #$00 + sta COLPF2 EndOfDLI_GO - inc dliCounter - ply - pla - rti + inc dliCounter + ply + pla + rti .endp ;-------------------------------------------------- .proc DLIinterruptText pha - lda dliCounter - bne MoreBarsColorChange + lda dliCounter + bne MoreBarsColorChange lda #TextBackgroundColor - ;sta WSYNC + ;sta WSYNC sta COLPF2 mva #TextForegroundColor COLPF3 - bne EndOfDLI_Text + bne EndOfDLI_Text MoreBarsColorChange - and #%00000001 - rol - sta COLPF2 + and #%00000001 + rol + sta COLPF2 EndOfDLI_Text - inc dliCounter + inc dliCounter pla DLIinterruptNone - rti - + rti + .endp ;-------------------------------------------------- .proc VBLinterrupt - mva #0 dliCounter - mva #$02 DliColorBack - - lda PAL - and #%00001110 - beq itsPAL - ;it is NTSC here + mva #0 dliCounter + mva #$02 DliColorBack + + lda PAL + and #%00001110 + beq itsPAL + ;it is NTSC here dec NTSCcounter bne itsPAL mva #6 NTSCcounter @@ -118,13 +118,13 @@ DLIinterruptNone itsPAL ; pressTimer is trigger tick counter. always 50 ticks / s bit:smi:inc pressTimer ; timer halted if >127. max time measured 2.5 s - + SkippedIfNTSC - bit RMT_blocked - bmi SkipRMTVBL + bit RMT_blocked + bmi SkipRMTVBL ; ------- RMT ------- - lda sfx_effect + lda sfx_effect bmi lab2 asl @ ; * 2 tay ;Y = 2,4,..,16 instrument number * 2 (0,2,4,..,126) @@ -138,53 +138,53 @@ SkippedIfNTSC lab2 jsr RASTERMUSICTRACKER+3 ;1 play ; ------- RMT ------- -SkipRMTVBL - bit ScrollFlag - bpl EndOfCreditsVBI +SkipRMTVBL + bit ScrollFlag + bpl EndOfCreditsVBI CreditsVBI - inc CreditsVScrol - lda CreditsVScrol - cmp #32 ;not too fast - beq nextlinedisplay - :2 lsr ;not too fast - sta VSCROL - jmp EndOfCreditsVBI + inc CreditsVScrol + lda CreditsVScrol + cmp #32 ;not too fast + beq nextlinedisplay + :2 lsr ;not too fast + sta VSCROL + jmp EndOfCreditsVBI nextlinedisplay - lda #0 - sta CreditsVScrol - sta VSCROL - clc - lda DLCreditsAddr - adc #40 - sta DLCreditsAddr - bcc @+ - inc DLCreditsAddr+1 + lda #0 + sta CreditsVScrol + sta VSCROL + clc + lda DLCreditsAddr + adc #40 + sta DLCreditsAddr + bcc @+ + inc DLCreditsAddr+1 @ - cmp #CreditsLastLine - bne EndOfCreditsVBI -; adw DLCreditsAddr #40 -; cpw DLCreditsAddr #CreditsLastLine -; bne EndOfCreditsVBI - mwa #Credits DLCreditsAddr + cmp #CreditsLastLine + bne EndOfCreditsVBI +; adw DLCreditsAddr #40 +; cpw DLCreditsAddr #CreditsLastLine +; bne EndOfCreditsVBI + mwa #Credits DLCreditsAddr EndOfCreditsVBI - .IF TARGET = 5200 - lda SkStatSimulator - bmi @+ - inc SkStatSimulator + .IF TARGET = 5200 + lda SkStatSimulator + bmi @+ + inc SkStatSimulator @ - lda JoystickNumber ; select port - ora #%00000100 ; Speaker off, Pots enabled + lda JoystickNumber ; select port + ora #%00000100 ; Speaker off, Pots enabled sta CONSOL5200 center = 114 ;Read analog stick and make it look like a digital stick threshold = 60 - - lda JoystickNumber - asl - tax + + lda JoystickNumber + asl + tax lda paddl0,x ;Read POT0 value (horizontal position) cmp #center+threshold ;Compare with right threshold rol stick0 ;Feed carry into digital stick value @@ -201,14 +201,14 @@ EndOfCreditsVBI eor #2+8 and #$0f sta stick0 - - ldx JoystickNumber - ; check shift key (5200 second fire button) - lda SKSTAT - :3 lsr ; third bit - and trig0,x ; and first button - ;lda trig0,x - sta strig0 ;Move hardware to shadow + + ldx JoystickNumber + ; check shift key (5200 second fire button) + lda SKSTAT + :3 lsr ; third bit + and trig0,x ; and first button + ;lda trig0,x + sta strig0 ;Move hardware to shadow mva chbas chbase @@ -224,21 +224,21 @@ EndOfCreditsVBI pla tax pla - rti - .ELSE - ; support for joysticks :) - ldx JoystickNumber - lda STICK0,x - sta STICK0 - lda STRIG0,x - sta STRIG0 - jmp XITVBV - .ENDIF + rti + .ELSE + ; support for joysticks :) + ldx JoystickNumber + lda STICK0,x + sta STICK0 + lda STRIG0,x + sta STRIG0 + jmp XITVBV + .ENDIF .endp .IF TARGET = 5200 .proc kb_continue sta kbcode ;Store key code in shadow. - mva #0 SkStatSimulator + mva #0 SkStatSimulator exit pla tay pla @@ -250,18 +250,18 @@ exit pla ;-------------------------------------------------- .macro SetDLI -; SetDLI #WORD -; Initialises Display List Interrupts +; SetDLI #WORD +; Initialises Display List Interrupts LDY # <:1 LDX # >:1 - jsr _SetDLIproc + jsr _SetDLIproc .endm .proc _SetDLIproc - LDA #$C0 - STY VDSLST - STX VDSLST+1 - STA NMIEN - rts + LDA #$C0 + STY VDSLST + STX VDSLST+1 + STA NMIEN + rts .endp .ENDIF diff --git a/Atari/textproc.asm b/Atari/textproc.asm index 5f358b1..b64ff2e 100644 --- a/Atari/textproc.asm +++ b/Atari/textproc.asm @@ -27,45 +27,44 @@ lda #%00111110 ; normal screen width, DL on, P/M on sta dmactls - jsr SetPMWidth + jsr SetPMWidth mva #TextBackgroundColor COLOR2 jsr ColorsOfSprites - mva #$ca COLOR1 - mva #$00 COLBAKS ; set color of background + mva #$ca COLOR1 + mva #$00 COLBAKS ; set color of background SetDLI DLIinterruptOptions ; jsr SetDLI for Options text screen -; -------- setup bottom (tanks) line - lda NumberOfPlayers - pha +; -------- setup bottom (tanks) line + lda NumberOfPlayers + pha lda mountainsDeltaTableH sta mountainDeltaH lda mountainsDeltaTableL sta mountainDeltaL - mva #6 NumberOfPlayers + mva #6 NumberOfPlayers jsr PMoutofScreen ;let P/M disappear ;jsr clearscreen ;let the screen be clean (clean-ish already) - jsr ClearPMmemory + jsr ClearPMmemory jsr placetanks ;let the tanks be evenly placed jsr calculatemountains ;let mountains be easy for the eye jsr drawmountains ;draw them - ldx NumberOfPlayers - dex -@ jsr RandomizeAngle - sta AngleTable,x - dex - bpl @- + ldx NumberOfPlayers + dex +@ jsr RandomizeAngle + sta AngleTable,x + dex + bpl @- jsr drawtanks ;finally draw tanks - pla - sta NumberOfPlayers -; -------- + pla + sta NumberOfPlayers mva #0 OptionsY OptionsMainLoop - lda WindChangeInRound - sta OptionsHere+126 + lda WindChangeInRound + sta OptionsHere+126 jsr OptionsInversion jsr getkey @@ -113,37 +112,39 @@ OptionsNoLeft OptionsNoRight cmp #@kbcode._ret ; $c ;Return key bne OptionsNoReturn - rts ; options selected - + rts ; options selected + OptionsNoReturn - cmp #@kbcode._tab ; Tab key - bne OptionsNoTab - jsr SelectNextGradient + cmp #@kbcode._tab ; Tab key + bne OptionsNoTab + jsr SelectNextGradient OptionsNoTab jmp OptionsMainLoop .endp + .proc SelectNextGradient - lda OptionsY ; if "Wind" option selected - cmp #$03 - bne NotWind - lda WindChangeInRound ; wind change after each turn (not round only) flag - eor #$1f ; '?' character - sta WindChangeInRound - rts + lda OptionsY ; if "Wind" option selected + cmp #$03 + bne NotWind + lda WindChangeInRound ; wind change after each turn (not round only) flag + eor #$1f ; '?' character + sta WindChangeInRound + rts NotWind - ldy GradientNr - iny - cpy #$03 - bne NoGradientLoop - ldy #$00 + ldy GradientNr + iny + cpy #$03 + bne NoGradientLoop + ldy #$00 NoGradientLoop - sty GradientNr - lda GradientAddrL,y - sta GradientColors - lda GradientAddrH,y - sta GradientColors+1 - rts + sty GradientNr + lda GradientAddrL,y + sta GradientColors + lda GradientAddrH,y + sta GradientColors+1 + rts .endp + ;-------- ; inversing selected option (cursor) ;-------- @@ -154,7 +155,7 @@ optionWidth = 6 nameWidth = 10 mwa #OptionsHere temp ; offset of the first option=11 mva #0 YPos ;option number pointer - mva #0 Xpos ;X position in the menu + sta Xpos ;X position in the menu tay ; Y is zero here... OptionsSetMainLoop ldx YPos ; Y position in the menu @@ -204,33 +205,34 @@ invertme rts .endp +.proc CallPurchaseForEveryTank ;------------------------------------------- ; call of the purchase (and activate) screens for each tank -.proc CallPurchaseForEveryTank +;------------------------------------------- - mva #0 TankNr - sta isInventory + mva #0 TankNr + sta isInventory @ - ldx TankNr - lda SkillTable,x - beq ManualPurchase - jsr PurchaseAI ; remember to make ActivateAI :) !!! - jmp AfterManualPurchase + ldx TankNr + lda SkillTable,x + beq ManualPurchase + jsr PurchaseAI ; remember to make ActivateAI :) !!! + jmp AfterManualPurchase ManualPurchase - lda JoyNumber,x - sta JoystickNumber ; set joystick port for player - mva #0 isInventory - jsr Purchase ; purchase weapons - bit escFlag - spl:rts - jsr DefensivesActivate ; activate weapons - bit escFlag - spl:rts + lda JoyNumber,x + sta JoystickNumber ; set joystick port for player + mva #0 isInventory + jsr Purchase ; purchase weapons + bit escFlag + spl:rts + jsr DefensivesActivate ; activate weapons + bit escFlag + spl:rts AfterManualPurchase - inc:lda TankNr - cmp NumberOfPlayers - bne @- - rts + inc:lda TankNr + cmp NumberOfPlayers + bne @- + rts .endp ;-------------------------------------------------- .proc DefensivesActivate @@ -241,7 +243,7 @@ AfterManualPurchase mva #$ff IsInventory mva #%10000000 WhichList ; offensive weapon - 0, defensive - %10000000 - jmp Purchase.GoToActivation + jmp Purchase.GoToActivation .endp ;-------------------------------------------------- @@ -277,10 +279,10 @@ GoToActivation sta dmactls lda #song_supermarket - bit IsInventory - bpl @+ - lda #song_inventory -@ jsr RmtSongSelect + bit IsInventory + bpl @+ + lda #song_inventory +@ jsr RmtSongSelect ldx tankNr lda TankStatusColoursTable,x @@ -288,10 +290,10 @@ GoToActivation ; there is a tank (player) number in tanknr ; we are displaying name of the player - lda #$ca - sta COLOR1 ; set color of header text - ldy #0 - sty COLBAKS ; set color of background + lda #$ca + sta COLOR1 ; set color of header text + ldy #0 + sty COLBAKS ; set color of background lda tanknr :3 asl ; 8 chars per name tax @@ -302,10 +304,10 @@ NextChar03 iny cpy #$08 bne NextChar03 - ; displaying number of active controller port - ldy JoystickNumber - lda digits+1,y - sta purchaseTextBuffer+17 + ; displaying number of active controller port + ldy JoystickNumber + lda digits+1,y + sta purchaseTextBuffer+17 ; and we display cash of the given player @@ -346,7 +348,7 @@ AfterPurchase cmp IndexesOfWeaponsL1,y beq ?weaponfound iny - cpy #(last_offensive_____ - first_offensive____)+1 ; maxOffensiveWeapons + cpy #(last_offensive - first_offensive )+1 ; maxOffensiveWeapons bne @- ; not found apparently? ; TODO: check border case (the last weapon) @@ -359,7 +361,7 @@ PositionDefensive ?weaponFound ; weapon index in Y sty positionOnTheList - jsr _MakeOffsetDown ; set list screen offset + jsr _MakeOffsetDown ; set list screen offset ; Here we have all we need ; So choose the weapon for purchase ...... @@ -405,7 +407,7 @@ GoUpOffensive ldy HowManyOnTheListOff dey sty PositionOnTheList - jmp MakeOffsetDown + jmp MakeOffsetDown MakeOffsetUp ; If offset is larger than pointer position, ; it must be equal then. @@ -423,16 +425,16 @@ PurchaseKeyDown bne EndGoDownX ldy #0 sty PositionOnTheList - beq MakeOffsetUp + beq MakeOffsetUp GoDownOffensive inc:lda PositionOnTheList cmp HowManyOnTheListOff bne MakeOffsetDown ldy #0 sty PositionOnTheList - beq MakeOffsetUp + beq MakeOffsetUp MakeOffsetDown - jsr _MakeOffsetDown + jsr _MakeOffsetDown EndGoDownX jmp ChoosingItemForPurchase @@ -448,7 +450,7 @@ _MakeOffsetDown sbc #15 sta OffsetDL1 _EndGoDownX - rts + rts ; swapping the displayed list and setting pointer to position 0 ListChange @@ -464,7 +466,7 @@ ListChange beq @+ ; inventory jsr calcPosOffensive - jsr _MakeOffsetDown ; set list screen offset + jsr _MakeOffsetDown ; set list screen offset jmp ChoosingItemForPurchase @ mva #0 PositionOnTheList @@ -481,7 +483,7 @@ DeffensiveSelected jmp ChoosingItemForPurchase .endp -; + ;-------------------------------------------------- .proc CreateList ;-------------------------------------------------- @@ -637,7 +639,7 @@ notInventory NotTheSameAsLastTime ; increase appropriate counter txa - cpx #last_offensive_____+1 + cpx #last_offensive +1 bcs DefenceList ldy HowManyOnTheListOff sta IndexesOfWeaponsL1,y @@ -655,14 +657,14 @@ NoWeapon ; next weapon. If no more weapons then finish! inx - cpx #last_offensive_____+1 + cpx #last_offensive +1 bne NoDefense ; if we got to the defense weapons, ; we switch address to the second table. mwa #ListOfDefensiveWeapons xbyte NoDefense - cpx #last_defensive_____+1 + cpx #last_defensive +1 jne CreateList @@ -697,7 +699,7 @@ WeHaveOffset ldy #0 ClearList1 cpw xbyte #ListOfWeapons1End - beq ListCleared1 + beq ListCleared1 tya ; now there is zero here sta (xbyte),y inw xbyte @@ -722,7 +724,7 @@ ListCleared1 ldy #0 ClearList2 cpw xbyte #ListOfDefensiveWeaponsEnd - beq ListCleared2 + beq ListCleared2 tya ; now there is zero here sta (xbyte),y inw xbyte @@ -773,27 +775,27 @@ positiveMoney sty LastWeapon ; store last purchased weapon ; because we must put screen pointer next to it - ; but if we purchasing "Buy me!" then we must draw the winning weapon. - - cpy #ind_Buy_me_________ - bne NoSuprise - -Suprise ; get a random weapon - lda random - cmp #51 ; defensive weapons are less likely because they are more expensive - probability 255:51 (5:1) - bcc GetRandomDefensive + ; but if we purchasing "Buy me!" then we must draw the winning weapon. + + cpy #ind_Buy_me + bne NoSuprise + +Suprise ; get a random weapon + lda random + cmp #51 ; defensive weapons are less likely because they are more expensive - probability 255:51 (5:1) + bcc GetRandomDefensive GetRandomOffensive - randomize ind_Missile________ last_offensive_____ - ;cmp #ind_Buy_me_________ ; buy me do not buy buy me :) - ;beq GetRandomOffensive - tay - bne NoSuprise ; Y always <> 0 + randomize ind_Missile last_offensive + ;cmp #ind_Buy_me ; buy me do not buy buy me :) + ;beq GetRandomOffensive + tay + bne NoSuprise ; Y always <> 0 GetRandomDefensive - randomize ind_Battery________ last_defensive_____ - tay -; lda WeaponUnits,y ; check if weapon exist -; beq GetRandomDefensive - + randomize ind_Battery last_defensive + tay +; lda WeaponUnits,y ; check if weapon exist +; beq GetRandomDefensive + NoSuprise lda TanksWeaponsTableL,x sta weaponPointer @@ -828,48 +830,48 @@ invSelectDef lda IndexesOfWeaponsL2,y tay ldx tankNr - cmp #ind_Battery________ + cmp #ind_Battery bne NotBattery ; if activate battery, we do it differently mva #sfx_battery sfx_effect - phy + phy mva #99 Energy,x - jsr MaxForceCalculate - ply + jsr MaxForceCalculate + ply jmp DecreaseDefensive ; bypass activation NotBattery - cmp #ind_Auto_Defense___ - bne NoAutoDefense + cmp #ind_Auto_Defense + bne NoAutoDefense ; Auto Defense - do it like battery mva #sfx_auto_defense sfx_effect - mva #$A1 AutoDefenseFlag,x ; this is "A" in inverse - for status line :) + mva #$A1 AutoDefenseFlag,x ; this is "A" in inverse - for status line :) jmp DecreaseDefensive ; bypass activation NoAutoDefense - cmp #ind_Lazy_Boy_______ - bne NoLazyBoy - ; Lazy Boy - do it like battery - mva #%01000000 LazyFlag + cmp #ind_Lazy_Boy + bne NoLazyBoy + ; Lazy Boy - do it like battery + mva #%01000000 LazyFlag jmp DecreaseDefensive ; bypass activation NoLazyBoy - cmp #ind_Lazy_Darwin____ - bne NoLazyDarwin - ; Lazy Darwin - do it like battery - mva #%11000000 LazyFlag + cmp #ind_Lazy_Darwin + bne NoLazyDarwin + ; Lazy Darwin - do it like battery + mva #%11000000 LazyFlag jmp DecreaseDefensive ; bypass activation NoLazyDarwin - cmp #ind_Spy_Hard_______ - bne NotSpy - mva #$ff SpyHardFlag - jmp DecreaseDefensive ; bypass activation + cmp #ind_Spy_Hard + bne NotSpy + mva #$ff SpyHardFlag + jmp DecreaseDefensive ; bypass activation NotSpy - cmp #ind_Long_Barrel____ - bne NotBarrel - ; if activate long barrel, we do it differently too - mva #sfx_long_barrel sfx_effect + cmp #ind_Long_Barrel + bne NotBarrel + ; if activate long barrel, we do it differently too + mva #sfx_long_barrel sfx_effect mva #LongBarrel BarrelLength,x - bne DecreaseDefensive ; bypass activation + bne DecreaseDefensive ; bypass activation NotBarrel - cmp #ind_White_Flag_____ + cmp #ind_White_Flag bne NotWhiteFlag cmp ActiveDefenceWeapon,x bne NoDeactivateWhiteFlag @@ -898,11 +900,12 @@ DecreaseDefensive DefActivationEnd jmp WaitForKeyRelease ; rts - .endp -; ----------------------------------------------------- + +;-------------------------------------------------- .proc calcPosDefensive ; calculate positionOnTheList from the activeWeapon (defensives) +;-------------------------------------------------- ldx tankNr lda ActiveDefenceWeapon,x beq ?noWeaponActive @@ -911,7 +914,7 @@ DefActivationEnd cmp IndexesOfWeaponsL2,y beq ?weaponfound iny - cpy #(last_defensive_____ - first_defensive____)+1 ; maxDefensiveWeapon + cpy #(last_defensive - first_defensive )+1 ; maxDefensiveWeapon bne @- ; not found apparently? ; TODO: check border case (the last weapon) @@ -934,7 +937,7 @@ DefActivationEnd cmp IndexesOfWeaponsL1,y beq ?weaponfound iny - cpy #(last_offensive_____ - first_offensive____) ; maxOffensiveWeapon + cpy #(last_offensive - first_offensive ) ; maxOffensiveWeapon bne @- ; not found apparently? ; TODO: check border case (the last weapon) @@ -946,11 +949,13 @@ DefActivationEnd sty positionOnTheList rts .endp -; ----------------------------------------------------- + +;-------------------------------------------------- .proc PutLitteChar +;-------------------------------------------------- ; first let's clear both lists from little chars mwa #ListOfWeapons xbyte - ldx #last_defensive_____ ; there are xx lines total + ldx #last_defensive ; there are xx lines total ldy #$00 EraseLoop tya ; lda #$00 @@ -967,10 +972,10 @@ EraseLoop mwa #ListOfDefensiveWeapons xbyte ldx PositionOnTheList beq SelectList2 ; if there is 0 we add nothing -AddLoop2 - adw xbyte #32 ; narrow screen - dex - bne AddLoop2 +@ + adw xbyte #32 ; narrow screen + dex + bne @- SelectList2 lda #$7f ; little char (tab) - this is the pointer sta (xbyte),y @@ -988,10 +993,10 @@ CharToList1 mwa #ListOfWeapons xbyte ldx PositionOnTheList beq SelectList1 ; if there is 0 we add nothing -AddLoop1 - adw xbyte #32 ; narrow screen - dex - bne AddLoop1 +@ + adw xbyte #32 ; narrow screen + dex + bne @- SelectList1 lda #$7f ; pointer = little char = (tab) sta (xbyte),y @@ -999,10 +1004,10 @@ SelectList1 mwa #ListOfWeapons xbyte ldx OffsetDL1 beq SetWindowList1 ; if zero then add nothing -LoopWindow1 - adw xbyte #32 ; narrow screen - dex - bne LoopWindow1 +@ + adw xbyte #32 ; narrow screen + dex + bne @- SetWindowList1 mwa xbyte WeaponsListDL ; and we change Display List @@ -1042,14 +1047,14 @@ NoArrowDown SetDLI DLIinterruptText ; jsr SetDLI for text (names) screen mva #0 TankNr - sta COLBAKS ; set color of background + sta COLBAKS ; set color of background @ tax lda TankStatusColoursTable,x sta COLOR2 ; set color of player name line jsr EnterPlayerName bit escFlag spl:rts - jsr CheckTankCheat + jsr CheckTankCheat inc TankNr lda TankNr cmp NumberOfPlayers @@ -1072,16 +1077,9 @@ NoArrowDown ldx tanknr lda skillTable,x sta difficultyLevel - lda digits+1,x + lda digits+1,x sta NameScreen2+7 - ; clear tank name editor field - not necessary -; ldx #8 -; lda #0 -;@ sta NameAdr,x -; dex -; bpl @- - ; copy existing name and place cursor at end lda TankNr :3 asl @@ -1089,7 +1087,6 @@ NoArrowDown ldy #0 @ lda TanksNames,x -; beq endOfTankName sta NameAdr,y inx iny @@ -1097,34 +1094,33 @@ NoArrowDown bne @- endOfTankName -@ lda NameAdr,y - and #$7f - bne LastNameChar - dey - bpl @- +@ lda NameAdr,y + and #$7f + bne LastNameChar + dey + bpl @- LastNameChar - cpy #7 - beq @+ - iny -@ sty PositionInName + cpy #7 + seq:iny + sty PositionInName CheckKeys jsr HighlightLevel ; setting choosen level of the opponent (Moron, etc) - ldx TankNr - lda JoyNumber,x + ldx TankNr + lda JoyNumber,x tay - lda digits+1,y - sta NameScreen2+11 ; display joystick port number - lda TankShape,x + lda digits+1,y + sta NameScreen2+11 ; display joystick port number + lda TankShape,x tay - lda digits+1,y - sta NameScreen2+15 ; display tank shape number - jsr CursorDisplay + lda digits+1,y + sta NameScreen2+15 ; display tank shape number + jsr CursorDisplay jsr getkey bit escFlag spl:rts - .IF TARGET = 800 ; only the A800 has a keyboard + .IF TARGET = 800 ; only the A800 has a keyboard ; is the char to be recorded? ldx #keycodesEnd-keycodes ;table was 38 chars long IsLetter @@ -1140,11 +1136,10 @@ YesLetter sta NameAdr,x inx cpx #$08 ; is there 8 characters? - bne @+ - dex -@ stx PositionInName ; if not, we store + sne:dex + stx PositionInName ; if not, we store jmp CheckKeys - .ENDIF + .ENDIF CheckFurtherX01 ; here we check Tab, Return and Del cmp #@kbcode._ret ; $0c ; Return jeq EndOfNick @@ -1158,19 +1153,19 @@ CheckFurtherX01 ; here we check Tab, Return and Del beq ChangeOfLevel3Up cmp #@kbcode._up ; $e ;cursor up beq ChangeOfLevel3Down - cmp #@kbcode._atari ; atari (inverse) key - jeq ChangeOfShapeUp + cmp #@kbcode._atari ; atari (inverse) key + jeq ChangeOfShapeUp cmp #@kbcode._del ; $34 ; Backspace (del) bne CheckKeys ; handling backing one char ldx PositionInName - beq FirstChar ; ferst char - no go back - cpx #7 - bne NotLastChar + beq FirstChar ; ferst char - no go back + cpx #7 + bne NotLastChar lda NameAdr,x - and #$7f - bne LastIsNotSpace ; last char not empty - first clear last char (no go back) + and #$7f + bne LastIsNotSpace ; last char not empty - first clear last char (no go back) NotLastChar dex LastIsNotSpace @@ -1181,65 +1176,54 @@ FirstChar jmp CheckKeys ;---- ChangeOfJoyUp - ldx TankNr - inc JoyNumber,x - lda JoyNumber,x - and #%00000011 ; max 4 joysticks - sta JoyNumber,x - .IF TARGET = 5200 - beq ChangeOfShapeUp ; change tank shape - .ENDIF + ldx TankNr + inc JoyNumber,x + lda JoyNumber,x + and #%00000011 ; max 4 joysticks + sta JoyNumber,x + .IF TARGET = 5200 + beq ChangeOfShapeUp ; change tank shape + .ENDIF jmp CheckKeys ;---- ChangeOfLevelUp ; change difficulty level of computer opponent inc:lda DifficultyLevel cmp #9 ; 9 levels are possible - bne DoNotLoopLevelUp - mva #$0 DifficultyLevel -DoNotLoopLevelUp + sne:mva #$0 DifficultyLevel ; DoNotLoopLevelUp jmp CheckKeys ;---- ChangeOfLevelDown dec:lda DifficultyLevel - bpl DoNotLoopLevelDown - mva #$8 DifficultyLevel -DoNotLoopLevelDown + spl:mva #$8 DifficultyLevel ; DoNotLoopLevelDown jmp CheckKeys ;---- ChangeOfLevel3Up adb DifficultyLevel #3 - cmp #9 - bcc DoNotLoopLevel3Up - - sbb DifficultyLevel #9 - -DoNotLoopLevel3Up + scc:sbb DifficultyLevel #9 ; DoNotLoopLevel3Up jmp CheckKeys ;---- ChangeOfLevel3Down sbb DifficultyLevel #3 - bpl @+ - adb DifficultyLevel #9 -@ + spl:adb DifficultyLevel #9 jmp CheckKeys ;---- ChangeOfShapeUp - ldx TankNr - inc TankShape,x - lda TankShape,x - cmp #$03 - bne @+ - lda #$00 - sta TankShape,x -@ jmp CheckKeys + ldx TankNr + inc TankShape,x + lda TankShape,x + cmp #$03 + bne @+ + lda #$00 + sta TankShape,x +@ jmp CheckKeys ;---- EndOfNick - ; now check long press joy button (or Return...) + ; now check long press joy button (or Return...) mva #0 pressTimer ; reset WaitForLongPress - lda STRIG0 ; wait only for joy long press - bne ShortJoyPress + lda STRIG0 ; wait only for joy long press + bne ShortJoyPress lda pressTimer cmp #25 ; 1/2s bcc WaitForLongPress @@ -1253,9 +1237,9 @@ ShortJoyPress ldx tanknr lda DifficultyLevel sta skilltable,x - beq NotRobot - lda #$03 ; shape for robotanks - sta TankShape,x + beq NotRobot + lda #$03 ; shape for robotanks + sta TankShape,x NotRobot ; storing name of the tank in the right space ; (without cursor!) @@ -1280,129 +1264,129 @@ NotRobot beq MakeDefaultName ldy #0 -nextchar04 - lda NameAdr,y - and #$7f ; remove inverse (Cursor) - sta tanksnames,x - inx - iny - cpy #$08 - bne nextchar04 +@ + lda NameAdr,y + and #$7f ; remove inverse (Cursor) + sta tanksnames,x + inx + iny + cpy #$08 + bne @- rts MakeDefaultName -nextchar05 - lda tanksnamesDefault,x - sta tanksnames,x - inx - iny - cpy #$08 - bne nextchar05 +@ + lda tanksnamesDefault,x + sta tanksnames,x + inx + iny + cpy #$08 + bne @- rts .endp ;-------------------------------------------------- .proc CursorDisplay - ldy #7 + ldy #7 CursorLoop - lda NameAdr,y - and #$7f - cpy #0 - bne NotFirstLetter - and #$3f ; First letter should be Capital letter + lda NameAdr,y + and #$7f + cpy #0 + bne NotFirstLetter + and #$3f ; First letter should be Capital letter ; (nice trick does not affect digits) NotFirstLetter - cpy PositionInName - bne @+ + cpy PositionInName + bne @+ ora #$80 ; place cursor -@ sta NameAdr,y - dey - bpl CursorLoop - rts +@ sta NameAdr,y + dey + bpl CursorLoop + rts .endp ;-------------------------------------------------- .proc EnterNameByJoy mva #sfx_keyclick sfx_effect - jsr CursorDisplay - ldy PositionInName - ; now in Y we have PositionInName - ldx #(keycodesEnd-keycodes) + jsr CursorDisplay + ldy PositionInName + ; now in Y we have PositionInName + ldx #(keycodesEnd-keycodes) SearchCharacter - lda NameAdr,y - and #$7f - cmp #$20 - bcc CharOK ; digit or space - cmp #$60 - bcs CharOK ; not capital letter - ora #$40 + lda NameAdr,y + and #$7f + cmp #$20 + bcc CharOK ; digit or space + cmp #$60 + bcs CharOK ; not capital letter + ora #$40 CharOK - cmp scrcodes,x - beq CharacterFound - dex - bpl SearchCharacter - inx + cmp scrcodes,x + beq CharacterFound + dex + bpl SearchCharacter + inx CharacterFound - ; now in X we have Character (index) on PositionInName - ; wait for centered joy + ; now in X we have Character (index) on PositionInName + ; wait for centered joy mva #128-15 pressTimer ; reset (trick) -@ lda STICK0 - and #$0f - cmp #$0f - beq checkjoy - bit pressTimer ; trick (no A change) - bpl @- -checkjoy - lda STICK0 - and #$0f - cmp #$0f - bne JoyNotCentered +@ lda STICK0 + and #$0f + cmp #$0f + beq checkjoy + bit pressTimer ; trick (no A change) + bpl @- +checkjoy + lda STICK0 + and #$0f + cmp #$0f + bne JoyNotCentered notpressedJoy - ;fire - lda STRIG0 - beq checkjoy ; fire still pressed - rts + ;fire + lda STRIG0 + beq checkjoy ; fire still pressed + rts JoyNotCentered - ; this is a place for code :) - cmp #7 - bne NoRight - ; joy right - cpy #7 - beq GoToMainLoop ; the last character - iny - bne GoToMainLoop + ; this is a place for code :) + cmp #7 + bne NoRight + ; joy right + cpy #7 + beq GoToMainLoop ; the last character + iny + bne GoToMainLoop NoRight - cmp #11 - bne NoLeft - ; joy left - lda #0 - sta NameAdr,y - dey - bpl GoToMainLoop - iny - beq GoToMainLoop + cmp #11 + bne NoLeft + ; joy left + lda #0 + sta NameAdr,y + dey + bpl GoToMainLoop + iny + beq GoToMainLoop NoLeft - cmp #14 - bne NoUp - ; joy up - cpx #(keycodesEnd-keycodes-1) - bne @+ - ldx #$00 ; set to the first character index (loop) - beq CharAndMainLoop -@ inx - bne CharAndMainLoop + cmp #14 + bne NoUp + ; joy up + cpx #(keycodesEnd-keycodes-1) + bne @+ + ldx #$00 ; set to the first character index (loop) + beq CharAndMainLoop +@ inx + bne CharAndMainLoop NoUp - cmp #13 - bne EnterNameByJoy ; not down - ; joy down - dex - bpl CharAndMainLoop - ldx #(keycodesEnd-keycodes-1) ; set to the last character index (loop) + cmp #13 + bne EnterNameByJoy ; not down + ; joy down + dex + bpl CharAndMainLoop + ldx #(keycodesEnd-keycodes-1) ; set to the last character index (loop) CharAndMainLoop - lda scrcodes,x - sta NameAdr,y + lda scrcodes,x + sta NameAdr,y GoToMainLoop - sty PositionInName - jmp EnterNameByJoy + sty PositionInName + jmp EnterNameByJoy .endp ;-------------------------------------------------- @@ -1472,24 +1456,24 @@ TooLittle000 dex ;rightnumber ; displaying without leading zeroes (if zeroes exist then display space at this position) ldy #0 - ldx #0 ; digit flag (cut leading zeroes) + ldx #0 ; digit flag (cut leading zeroes) displayloop lda decimalresult,y - cpx #0 - bne noleading0 - cpy #4 - beq noleading0 ; if 00000 - last 0 must stay - cmp zero - bne noleading0 - lda #space - beq displaychar ; space = 0 ! + cpx #0 + bne noleading0 + cpy #4 + beq noleading0 ; if 00000 - last 0 must stay + cmp zero + bne noleading0 + lda #space + beq displaychar ; space = 0 ! noleading0 - inx ; set flag (no leading zeroes to cut) + inx ; set flag (no leading zeroes to cut) displaychar sta (displayposition),y nexdigit iny - cpy #5 + cpy #5 bne displayloop rts @@ -1546,57 +1530,57 @@ displayloop1 ;-------------------------------------------------- .proc GameOverScreen ;-------------------------------------------------- - jsr MakeDarkScreen + jsr MakeDarkScreen jsr WaitForKeyRelease jsr ClearScreen jsr ClearPMmemory - jsr PrepareCredits - jsr GameOverResultsClear + jsr PrepareCredits + jsr GameOverResultsClear jsr CopyFromPurchaseAndGameOver mwa #GameOverDL dlptrs - mva #$ff ScrollFlag ; credits scroll on + mva #$ff ScrollFlag ; credits scroll on lda #%00111110 ; normal screen width, DL on, P/M on sta dmactls lda #%00100100 ; playfield before P/M sta GPRIOR - jsr SetPMWidth + jsr SetPMWidth jsr ColorsOfSprites mva #0 COLOR1 - sta COLBAKS ; set color of background - sta CreditsVScrol - sta JoystickNumber ; set joystick port for player + sta COLBAKS ; set color of background + sta CreditsVScrol + sta JoystickNumber ; set joystick port for player mva #TextForegroundColor COLOR2 SetDLI DLIinterruptGameOver ; jsr SetDLI for Game Over screen - ; make text and color lines for each tank + ; make text and color lines for each tank ldx NumberOfPlayers ;we start from the highest (best) tank dex ;and it is the last one stx ResultOfTankNr ;in TankSequence table - ldy #0 ;witch line we are coloring + ldy #0 ;witch line we are coloring FinalResultOfTheNextPlayer ldx ResultOfTankNr ;we are after a round, so we can use TankNr lda TankSequence,x ;and we keep here real number if the tank - tax + tax stx TankNr ;for which we are displaying results - lda TankStatusColoursTable,x - sta GameOverColoursTable,y - ; Y - line number (from 0 to 5) - ; X - TanNr - ; let's make texts - phy - ; first calculate adres first byte of line - mwa #GameOverResults temp -@ dey - bmi LineAdresReady - adw temp #40 - jmp @- + lda TankStatusColoursTable,x + sta GameOverColoursTable,y + ; Y - line number (from 0 to 5) + ; X - TanNr + ; let's make texts + phy + ; first calculate adres first byte of line + mwa #GameOverResults temp +@ dey + bmi LineAdresReady + adw temp #40 + jmp @- LineAdresReady - ; put position of tank on the screen - pla - pha ; now we have line number in A register - ldy #1 - tax - lda zero+1,x - sta (temp),y + ; put position of tank on the screen + pla + pha ; now we have line number in A register + ldy #1 + tax + lda zero+1,x + sta (temp),y ; puts name of the tank on the screen ldy #$03 lda TankNr @@ -1609,75 +1593,75 @@ NextChar iny cpy #$08+3 bne NextChar - ; put big points on the screen + ; put big points on the screen ldx TankNr lda ResultsTable,x sta decimal mva #0 decimal+1 adw temp #12 displayposition jsr displaydec5 - mva #0 displayposition ; overwrite first digit - ; put hits points on the screen - sta decimal+1 ; pozor!!! A=0 + mva #0 displayposition ; overwrite first digit + ; put hits points on the screen + sta decimal+1 ; pozor!!! A=0 ldx TankNr lda DirectHits,x sta decimal -; lda DirectHitsH,x ; one byte enough +; lda DirectHitsH,x ; one byte enough adw temp #19 displayposition jsr displaydec5 - mva #0 displayposition ; overwrite first digit - ; put AI symbol or joystick - ldx TankNr - lda SkillTable,x - tay - bne ThisIsAI - ldy JoyNumber,x - iny ; tricky + mva #0 displayposition ; overwrite first digit + ; put AI symbol or joystick + ldx TankNr + lda SkillTable,x + tay + bne ThisIsAI + ldy JoyNumber,x + iny ; tricky ThisIsAI - lda digits,y - ldy #39 - sta (temp),y ; AI level or joy number - ldy #$0a ; Joystick symbol - lda SkillTable,x - beq NotAItank - ldy #$5e ; Computer symbol + lda digits,y + ldy #39 + sta (temp),y ; AI level or joy number + ldy #$0a ; Joystick symbol + lda SkillTable,x + beq NotAItank + ldy #$5e ; Computer symbol NotAItank - tya - ldy #38 - sta (temp),y - ; put earned money on the screen + tya + ldy #38 + sta (temp),y + ; put earned money on the screen lda EarnedMoneyL,x sta decimal - lda EarnedMoneyH,x + lda EarnedMoneyH,x sta decimal+1 adw temp #30 displayposition jsr displaydec5 - ldy #35 - lda zero - sta (temp),y ; and last zero - ply - iny + ldy #35 + lda zero + sta (temp),y ; and last zero + ply + iny dec ResultOfTankNr jpl FinalResultOfTheNextPlayer MakeBlackLines - cpy #$06 - beq AllLinesReady - lda #0 ; black line color for rest of tanks - sta GameOverColoursTable,y - iny - bne MakeBlackLines + cpy #$06 + beq AllLinesReady + lda #0 ; black line color for rest of tanks + sta GameOverColoursTable,y + iny + bne MakeBlackLines AllLinesReady ldx #(MaxPlayers-1) MakeAllTanksVisible lda #99 sta eXistenZ,x - lda #0 - sta ActiveDefenceWeapon,x + lda #0 + sta ActiveDefenceWeapon,x dex bpl MakeAllTanksVisible - jsr SetStandardBarrels + jsr SetStandardBarrels - ; start music and animations + ; start music and animations RmtSong song_ending_looped ; initial tank positions randomization ldx #(MaxPlayers-1) ;maxNumberOfPlayers-1 @@ -1691,15 +1675,15 @@ MainTanksFloatingLoop AllTanksFloatingDown stx TankNr lda Ytankstable,x - cmp #(72-7) ; tank under screen - no erase - bcs NoEraseTank + cmp #(72-7) ; tank under screen - no erase + bcs NoEraseTank jsr ClearTankNr - sta ATRACT ; reset atract mode + sta ATRACT ; reset atract mode NoEraseTank - ldx TankNr + ldx TankNr inc Ytankstable,x - lda ActiveDefenceWeapon,x - beq NotFastTank + lda ActiveDefenceWeapon,x + beq NotFastTank :3 inc Ytankstable,x NotFastTank lda Ytankstable,x @@ -1714,109 +1698,109 @@ TankUnderScreen TankOnScreen jsr PutTankNr DrawOnlyParachute - lda ActiveDefenceWeapon,x - bne FastTank + lda ActiveDefenceWeapon,x + bne FastTank jsr DrawTankParachute FastTank ; ldx TankNr dex bpl AllTanksFloatingDown - jsr IsKeyPressed + jsr IsKeyPressed bne MainTanksFloatingLoop ; neverending loop - mva #$00 ScrollFlag ; credits scroll off - jsr MakeDarkScreen - jsr GameOverResultsClear + mva #$00 ScrollFlag ; credits scroll off + jsr MakeDarkScreen + jsr GameOverResultsClear rts RandomizeTankPos - randomize 10 (32-7) ; 10 not 8 - barrel !! :) + randomize 10 (32-7) ; 10 not 8 - barrel !! :) sta Ytankstable,x randomize 0 180 sta AngleTable,x randomize 0 (49-8) - ; x correction for P/M - ; -- - .IF XCORRECTION_FOR_PM = 1 + ; x correction for P/M + ; -- + .IF XCORRECTION_FOR_PM = 1 and #%11111110 - .ENDIF - ; -- + .ENDIF + ; -- clc adc XtankOffsetGO_L,x sta XtankstableL,x lda XtankOffsetGO_H,x adc #0 sta XtankstableH,x - lda random - cmp #32 ; like 1:8 - bcc NowFastTank - lda #0 - sta ActiveDefenceWeapon,x + lda random + cmp #32 ; like 1:8 + bcc NowFastTank + lda #0 + sta ActiveDefenceWeapon,x rts NowFastTank - lda #1 - sta ActiveDefenceWeapon,x + lda #1 + sta ActiveDefenceWeapon,x rts GameOverResultsClear - lda #$00 - tax -@ sta GameOverResults,x - inx - cpx #(6*40)+1 - bne @- - rts + lda #$00 + tax +@ sta GameOverResults,x + inx + cpx #(6*40)+1 + bne @- + rts PrepareCredits - ; Rewrites credits and places it in the middle of each line. - mwa #CreditsStart temp ; from - mwa #Credits temp2 ; to + ; Rewrites credits and places it in the middle of each line. + mwa #CreditsStart temp ; from + mwa #Credits temp2 ; to MainRewriteLoop - ldy #0 - cpw temp #CreditsEnd - beq EndOfCredits - ; count characters in this line -@ lda (temp),y - bmi LastCharFound - iny - bne @- + ldy #0 + cpw temp #CreditsEnd + beq EndOfCredits + ; count characters in this line +@ lda (temp),y + bmi LastCharFound + iny + bne @- LastCharFound - ; in Y number of characters reduced by 1 - ; let's count how many spaces add before the text - sec - sty magic - lda #40 - sbc magic - lsr ; now in A we have number of spaces in front - sta magic - ldy #0 - tya - tax + ; in Y number of characters reduced by 1 + ; let's count how many spaces add before the text + sec + sty magic + lda #40 + sbc magic + lsr ; now in A we have number of spaces in front + sta magic + ldy #0 + tya + tax FirstSpaces - sta (temp2),y ; fill the area in front of the text with spaces - iny - cpy magic - bne FirstSpaces + sta (temp2),y ; fill the area in front of the text with spaces + iny + cpy magic + bne FirstSpaces MainText - lda (temp,x) - sta (temp2),y ; rewrite the text to a new place - bmi LastCharWritten - inw temp - iny - bne MainText + lda (temp,x) + sta (temp2),y ; rewrite the text to a new place + bmi LastCharWritten + inw temp + iny + bne MainText LastCharWritten - inw temp - and #%01111111 ; remove inverse - sta (temp2),y - iny - txa ; space to A (0) + inw temp + and #%01111111 ; remove inverse + sta (temp2),y + iny + txa ; space to A (0) LastSpaces - sta (temp2),y ; fill the area behind the text with spaces - iny - cpy #40 - bne LastSpaces + sta (temp2),y ; fill the area behind the text with spaces + iny + cpy #40 + bne LastSpaces NextLine - adw temp2 #40 - jmp MainRewriteLoop + adw temp2 #40 + jmp MainRewriteLoop EndOfCredits - mwa #Credits DLCreditsAddr ; set address in DL to first line - rts + mwa #Credits DLCreditsAddr ; set address in DL to first line + rts .endp ;------------------------------------------------- .proc PutTankNameOnScreen @@ -1824,7 +1808,7 @@ EndOfCredits ; puts name of the tank on the screen ldy #$00 ; lda TankNr - txa ; TankNr in X ! + txa ; TankNr in X ! asl asl asl ; 8 chars per name @@ -1837,20 +1821,20 @@ NextChar02 cpy #$08 bne NextChar02 ;========================= - ; displaying number of active controller port or AI level + ; displaying number of active controller port or AI level ;========================= - ldx TankNr - ldy #$5e ; Computer symbol - lda SkillTable,x - tax - bne ThisIsAI - ldy #$0a ; Joystick symbol - ldx JoystickNumber - inx ; tricky + ldx TankNr + ldy #$5e ; Computer symbol + lda SkillTable,x + tax + bne ThisIsAI + ldy #$0a ; Joystick symbol + ldx JoystickNumber + inx ; tricky ThisIsAI - sty statusBuffer+16 - lda digits,x - sta statusBuffer+17 + sty statusBuffer+16 + lda digits,x + sta statusBuffer+17 ; rts .endp ;------------------------------------------------- @@ -1858,7 +1842,7 @@ ThisIsAI ;------------------------------------------------- ldx TankNr - + ;========================= ;displaying symbol of the weapon ;========================= @@ -1900,11 +1884,11 @@ ThisIsAI ;========================= ;displaying name of the defence weapon (if active) ;========================= - lda AutoDefenseFlag,x ; Auto Defense symbol (space or "A" in inverse) - bpl @+ - lda #$5e ; Auto Defense symbol + lda AutoDefenseFlag,x ; Auto Defense symbol (space or "A" in inverse) + bpl @+ + lda #$5e ; Auto Defense symbol @ - sta statusBuffer+80+21 + sta statusBuffer+80+21 lda #$08 ; ( sta statusBuffer+80+22 lda #$09 ; ) @@ -1973,15 +1957,15 @@ NoShieldEnergy ; display Wind ;========================= mwa Wind temp - lda #space + lda #space bit Wind+3 ; highest byte of 4 byte wind bmi DisplayLeftWind - sta statusBuffer+80+17 ; (space) char + sta statusBuffer+80+17 ; (space) char lda #$7f ; (tab) char sta statusBuffer+80+20 bne DisplayWindValue DisplayLeftWind - sta statusBuffer+80+20 ; (space) char + sta statusBuffer+80+20 ; (space) char lda #$7e ;(del) char sta statusBuffer+80+17 sec ; Wind = -Wind @@ -2021,7 +2005,7 @@ DisplayWindValue ;display Angle ;========================= displayAngle - ldy #space + ldy #space ldx TankNr lda AngleTable,x cmp #90 diff --git a/C64/gr_basics.asm b/C64/gr_basics.asm index 774a02c..d9feec8 100644 --- a/C64/gr_basics.asm +++ b/C64/gr_basics.asm @@ -16,7 +16,7 @@ unPlotAfterX lda oldplotH,x sta oldplot+1 - ldy #0 + ldy #0 lda oldora,x sta (oldplot),y @@ -31,23 +31,23 @@ CheckX MakeUnPlot ; let's count coordinates taken from xdraw and ydraw lda xdraw - and #%11111000 - ;sta xbyte + and #%11111000 + ;sta xbyte ;--- ldx ydraw - clc + clc adc linetableL,x - sta xbyte - sta oldplot + sta xbyte + sta oldplot lda linetableH,x adc xdraw+1 sta xbyte+1 - sta oldplot+1 + sta oldplot+1 lda xdraw and #$7 tax - ldy #0 + ldy #0 lda color bne ClearUnPlot @@ -117,13 +117,13 @@ MakePlot ; let's calculate coordinates from xdraw and ydraw lda xdraw - and #%11111000 - ;sta xbyte + and #%11111000 + ;sta xbyte ;--- ldx ydraw - clc + clc adc linetableL,x - sta xbyte + sta xbyte lda linetableH,x adc xdraw+1 sta xbyte+1 @@ -131,7 +131,7 @@ MakePlot lda xdraw and #$7 tax - ldy #0 + ldy #0 lda color bne ClearPlot @@ -156,13 +156,13 @@ ClearPlot ; let's calculate coordinates from xdraw and ydraw lda xdraw - and #%11111000 - ;sta xbyte + and #%11111000 + ;sta xbyte ;--- ldx ydraw - clc + clc adc linetableL,x - sta xbyte + sta xbyte lda linetableH,x adc xdraw+1 sta xbyte+1 @@ -170,7 +170,7 @@ ClearPlot lda xdraw and #$7 tax - ldy #0 + ldy #0 lda (xbyte),y eor #$ff and bittable,x @@ -181,55 +181,55 @@ ClearPlot ;-------------------------------------------------- mwa #0 xdraw mwa #mountaintable modify - mva #1 color + mva #1 color drawmountainsloop ldy #0 lda (modify),y - cmp #screenheight - beq NoMountain + cmp #screenheight + beq NoMountain sta ydraw - sty ydraw+1 + sty ydraw+1 .IF FASTER_GRAF_PROCS = 1 -; there was Drawline proc +; there was Drawline proc lda #screenheight sec sbc ydraw sta tempbyte01 jsr plot.MakePlot - ; X - index in bittable (number of bit) and nothing more (for use) in C64 :) + ; X - index in bittable (number of bit) and nothing more (for use) in C64 :) ; jmp IntoDraw ; jumps inside Draw routine ; because one pixel is already plotted (and who cares? :) ) @ - lda (xbyte),y - and bittable2,x - sta (xbyte),y + lda (xbyte),y + and bittable2,x + sta (xbyte),y ;IntoDraw - inc ydraw + inc ydraw lda xdraw - and #%11111000 - ;sta xbyte + and #%11111000 + ;sta xbyte ;--- ldy ydraw - clc + clc adc linetableL,y - sta xbyte + sta xbyte lda linetableH,y adc xdraw+1 sta xbyte+1 - ldy #0 - dec tempbyte01 - bne @- -; end of Drawline proc + ldy #0 + dec tempbyte01 + bne @- +; end of Drawline proc .ELSE -; there was Drawline proc +; there was Drawline proc drawline jsr plot.MakePlot - inc ydraw - lda ydraw - cmp #screenheight - bne drawline -; end of Drawline proc + inc ydraw + lda ydraw + cmp #screenheight + bne drawline +; end of Drawline proc .ENDIF NoMountain inw modify @@ -260,7 +260,7 @@ NoMountain ldy #7 CopyChar lda (fontind),y - eor #$ff + eor #$ff sta char1,y lda #$ff sta char2,y @@ -271,7 +271,7 @@ CopyChar ldy #7 CopyMask lda (fontind),y - eor #$ff + eor #$ff sta mask1,y lda #$00 sta mask2,y @@ -291,16 +291,16 @@ MakeMask00 .endr sec .rept 8 - ror char1+# ; in second (and next) lines we have C=1 - one SEC enough + ror char1+# ; in second (and next) lines we have C=1 - one SEC enough ror char2+# .endr dex bne MakeMask00 MaskOK00 - lda ydraw - sec - sbc #7 - sta ydraw + lda ydraw + sec + sbc #7 + sta ydraw ; X = 0 ! lda Erase beq CharLoopi ; it works, because x=0 @@ -314,67 +314,67 @@ EmptyChar ldx #0 CharLoopi ; calculating coordinates from xdraw and ydraw - ldy ydraw + ldy ydraw lda xdraw - and #%11111000 - clc + and #%11111000 + clc adc linetableL,y - sta xbyte + sta xbyte lda linetableH,y adc xdraw+1 sta xbyte+1 ;-- - ldy #0 + ldy #0 lda (xbyte),y - ora mask1,x + ora mask1,x and char1,x sta (xbyte),y ldy #8 lda (xbyte),y - ora mask2,x + ora mask2,x and char2,x sta (xbyte),y - inc ydraw + inc ydraw inx cpx #8 bne CharLoopi .ELSE - mvx #7 temp ; line counter (Y) + mvx #7 temp ; line counter (Y) CharLoop1 - mva #7 temp+1 ; pixel counter (X) + mva #7 temp+1 ; pixel counter (X) CharLoop2 - mva #0 color - rol mask1,x - bcc NoMaskNoPlot - rol char1,x - bcs NoPlot + mva #0 color + rol mask1,x + bcc NoMaskNoPlot + rol char1,x + bcs NoPlot MakeCharPlot - lda Erase - bne ErasingChar - inc color + lda Erase + bne ErasingChar + inc color ErasingChar NoPlot - jsr plot.MakePlot + jsr plot.MakePlot AfterCharPlot - inw xdraw - ldx temp - dec temp+1 - bpl CharLoop2 - sec - sbw xdraw #8 - dec ydraw - ldx temp - dex - stx temp - bpl CharLoop1 - clc - lda ydraw - adc #8 - sta ydraw - bne EndPutChar + inw xdraw + ldx temp + dec temp+1 + bpl CharLoop2 + sec + sbw xdraw #8 + dec ydraw + ldx temp + dex + stx temp + bpl CharLoop1 + clc + lda ydraw + adc #8 + sta ydraw + bne EndPutChar NoMaskNoPlot - rol char1,x - jmp AfterCharPlot + rol char1,x + jmp AfterCharPlot .ENDIF EndPutChar rts @@ -391,16 +391,16 @@ EndPutChar ;-------------------------------------------------- cpw dy #(screenheight-1) jcs TypeChar.EndPutChar ;nearest RTS - cpw dy #(4) - jcc TypeChar.EndPutChar ;nearest RTS + cpw dy #(4) + jcc TypeChar.EndPutChar ;nearest RTS cpw dx #(screenwidth-4) jcs TypeChar.EndPutChar ;nearest RTS - ; checks ommited. + ; checks ommited. ; char to the table lda CharCode4x4 and #%00000001 - beq Upper4bits - lda #$ff ; better option to check (nibbler4x4 = $00 or $ff) + beq Upper4bits + lda #$ff ; better option to check (nibbler4x4 = $00 or $ff) Upper4bits sta nibbler4x4 lda CharCode4x4 @@ -408,36 +408,36 @@ Upper4bits sta fontind lda #$00 sta fontind+1 - + adw fontind #font4x4 ; and 4 bytes to the table - ldy #0 + ldy #0 ldx #3 CopyChar - lda (fontind),y ; Y must be 0 !!!! - bit nibbler4x4 - bpl GetUpper4bits - :4 rol + lda (fontind),y ; Y must be 0 !!!! + bit nibbler4x4 + bpl GetUpper4bits + :4 rol GetUpper4bits - ora #$0f + ora #$0f sta char1,x lda #$ff sta char2,x ; and 4 bytes as a mask - lda #$f0 + lda #$f0 sta mask1,x lda #$00 sta mask2,x - adw fontind #32 ; next byte of 4x4 font + adw fontind #32 ; next byte of 4x4 font dex bpl CopyChar .IF FASTER_GRAF_PROCS = 1 ; mask preparation and character shifting - lda dx - and #$7 - tax + lda dx + and #$7 + tax beq MaskOK01 MakeMask01 .rept 4 @@ -446,90 +446,90 @@ MakeMask01 .endr sec .rept 4 - ror char1+# ; in second (and next) lines we have C=1 - one SEC enough + ror char1+# ; in second (and next) lines we have C=1 - one SEC enough ror char2+# .endr dex bne MakeMask01 MaskOK01 - lda dy - sec - sbc #3 - sta dy - ldx #0 + lda dy + sec + sbc #3 + sta dy + ldx #0 CharLoopi4x4 ; calculating coordinates from xdraw and ydraw - ldy dy + ldy dy lda dx - and #%11111000 - clc + and #%11111000 + clc adc linetableL,y - sta xbyte + sta xbyte lda linetableH,y adc dx+1 sta xbyte+1 ;-- - ldy #0 + ldy #0 lda (xbyte),y - ora mask1,x - bit plot4x4color - bpl PutInColor0_1 ; only mask - no char + ora mask1,x + bit plot4x4color + bpl PutInColor0_1 ; only mask - no char and char1,x PutInColor0_1 sta (xbyte),y ldy #8 lda (xbyte),y - ora mask2,x - bit plot4x4color - bpl PutInColor0_2 ; only mask - no char + ora mask2,x + bit plot4x4color + bpl PutInColor0_2 ; only mask - no char and char2,x PutInColor0_2 sta (xbyte),y - inc dy + inc dy inx - cpx #4 + cpx #4 bne CharLoopi4x4 .ELSE - mwa xdraw char2 - mwa ydraw mask2 - mva color mask2+2 - mwa dx xdraw - mwa dy ydraw - mvx #3 temp ; line counter (Y) + mwa xdraw char2 + mwa ydraw mask2 + mva color mask2+2 + mwa dx xdraw + mwa dy ydraw + mvx #3 temp ; line counter (Y) CharLoop1 - mva #3 temp+1 ; pixel counter (X) + mva #3 temp+1 ; pixel counter (X) CharLoop2 - mva #0 color - rol mask1,x - bcc NoMaskNoPlot - rol char1,x - bcs NoPlot + mva #0 color + rol mask1,x + bcc NoMaskNoPlot + rol char1,x + bcs NoPlot MakeCharPlot - lda plot4x4color - beq ErasingChar - inc color + lda plot4x4color + beq ErasingChar + inc color ErasingChar NoPlot - jsr plot.MakePlot + jsr plot.MakePlot AfterCharPlot - inw xdraw - ldx temp - dec temp+1 - bpl CharLoop2 - sec - sbw xdraw #4 - dec ydraw - ldx temp - dex - stx temp - bpl CharLoop1 - mwa char2 xdraw - mwa mask2 ydraw - mva mask2+2 color - bpl EndPut4x4 + inw xdraw + ldx temp + dec temp+1 + bpl CharLoop2 + sec + sbw xdraw #4 + dec ydraw + ldx temp + dex + stx temp + bpl CharLoop1 + mwa char2 xdraw + mwa mask2 ydraw + mva mask2+2 color + bpl EndPut4x4 NoMaskNoPlot - rol char1,x - jmp AfterCharPlot + rol char1,x + jmp AfterCharPlot .ENDIF EndPut4x4 rts @@ -555,59 +555,59 @@ EndPut4x4 mwa #linetableL temp2 mwa #linetableH modify ldy #0 - ldx #0 + ldx #0 @ lda temp sta (temp2),y lda temp+1 sta (modify),y - cpx #7 - bne NotChar - ldx #0 + cpx #7 + bne NotChar + ldx #0 adw temp #(320-7) - jmp next8lines + jmp next8lines NotChar - inw temp - inx + inw temp + inx next8lines iny cpy #screenheight+1 bne @- - rts + rts .endp ;-------------------------------------------------- .proc SetMainScreen - lda #$b ; Grey background and border - lda WallsType - :4 rol - sta $d020 - sta $d021 - - lda $dd00 ; Set video bank to start at 0 - and #252 - ora #3 - sta $dd00 - lda #$18 - sta $d018 + lda #$b ; Grey background and border + lda WallsType + :4 rol + sta $d020 + sta $d021 + + lda $dd00 ; Set video bank to start at 0 + and #252 + ora #3 + sta $dd00 + lda #$18 + sta $d018 -; SwitchVICBank(0) -; SetScreenMemory($2000) - SetHiresBitmapMode ; Hires mode on - lda #$00 - sta 53281 - ; clear color RAM - ldx #0 -@ lda #1 - sta $d800,x - sta $d900,x - sta $da00,x - sta $db00,x - lda #$0f - sta $0400,x - sta $0500,x - sta $0600,x - sta $0700,x - inx - bne @- +; SwitchVICBank(0) +; SetScreenMemory($2000) + SetHiresBitmapMode ; Hires mode on + lda #$00 + sta 53281 + ; clear color RAM + ldx #0 +@ lda #1 + sta $d800,x + sta $d900,x + sta $da00,x + sta $db00,x + lda #$0f + sta $0400,x + sta $0500,x + sta $0600,x + sta $0700,x + inx + bne @- rts .endp ;-------------------------------------------------- @@ -623,86 +623,86 @@ next8lines ; ------------------------------------------------- mva #sfx_sandhog sfx_effect .IF FASTER_GRAF_PROCS = 1 - mvy #0 magic ; byte counter (from 0 to 39) + mvy #0 magic ; byte counter (from 0 to 39) NextColumn - ; big loop - we repat internal loops for each column of bytes - ldx #120 ; line counter (from 0 to 60 ) - ; first loop - inverse column of bytes for a while + ; big loop - we repat internal loops for each column of bytes + ldx #120 ; line counter (from 0 to 60 ) + ; first loop - inverse column of bytes for a while NextLine1 - jsr InverseScreenByte - dex - dex - bpl NextLine1 - ; - jsr WaitOneFrame ; wait uses A only - ; second loop - inverse again and put random "snow" to column of bytes - ldx #120 - mva #$55 magic+1 + jsr InverseScreenByte + dex + dex + bpl NextLine1 + ; + jsr WaitOneFrame ; wait uses A only + ; second loop - inverse again and put random "snow" to column of bytes + ldx #120 + mva #$55 magic+1 NextLine2 - jsr InverseScreenByte - lda random - ora magic+1 - and (temp),y - sta (temp),y - lda magic+1 - eor #$ff - sta magic+1 - dex - dex - bpl NextLine2 - ; and go to next column - inc magic - ldy magic - cpy #40 - bne NextColumn + jsr InverseScreenByte + lda random + ora magic+1 + and (temp),y + sta (temp),y + lda magic+1 + eor #$ff + sta magic+1 + dex + dex + bpl NextLine2 + ; and go to next column + inc magic + ldy magic + cpy #40 + bne NextColumn .ELSE - mva #1 color - mwa #120 ydraw + mva #1 color + mwa #120 ydraw NextLineSlow - lda #0 - sta xdraw - sta xdraw+1 + lda #0 + sta xdraw + sta xdraw+1 NextPixelSlow - bit random - bpl NoPlot - bvc NoPlot - jsr plot.MakePlot + bit random + bpl NoPlot + bvc NoPlot + jsr plot.MakePlot NoPlot - inw xdraw - cpw xdraw #screenwidth - bne NextPixelSlow - dec ydraw - dec ydraw - bpl NextLineSlow + inw xdraw + cpw xdraw #screenwidth + bne NextPixelSlow + dec ydraw + dec ydraw + bpl NextLineSlow .ENDIF - ; and we have "snow" :) - lda #0 - ldx TankNr - sta ActiveDefenceWeapon,x ; deactivate Nuclear Winter - jsr SetFullScreenSoilRange + ; and we have "snow" :) + lda #0 + ldx TankNr + sta ActiveDefenceWeapon,x ; deactivate Nuclear Winter + jsr SetFullScreenSoilRange jsr SoilDown2.NoClearTanks - rts + rts - ; in order to optimize the fragment repeated in both internal loops - ; we save 15 bytes :) + ; in order to optimize the fragment repeated in both internal loops + ; we save 15 bytes :) InverseScreenByte - ldy magic - sty temp - ldy #0 - sty temp+1 + ldy magic + sty temp + ldy #0 + sty temp+1 aslw temp rolw temp rolw temp - lda temp - adc LineTableL,x - sta temp - lda LineTableH,x - adc temp+1 - sta temp+1 - lda (temp),y - eor #$ff - sta (temp),y - rts + lda temp + adc LineTableL,x + sta temp + lda LineTableH,x + adc temp+1 + sta temp+1 + lda (temp),y + eor #$ff + sta (temp),y + rts .endp .ENDIF \ No newline at end of file diff --git a/C64/interrupts.asm b/C64/interrupts.asm index 9d9c188..ff565f7 100644 --- a/C64/interrupts.asm +++ b/C64/interrupts.asm @@ -1,22 +1,22 @@ -; @com.wudsn.ide.asm.mainsourcefile=scorch.asm +; @com.wudsn.ide.asm.mainsourcefile=scorch.asm .IF *>0 ;this is a trick that prevents compiling this file alone DLIinterruptGraph = 0 ;-------------------------------------------------- .macro SetDLI -; SetDLI #WORD -; Initialises Display List Interrupts +; SetDLI #WORD +; Initialises Display List Interrupts LDY # <:1 LDX # >:1 - jsr _SetDLIproc + jsr _SetDLIproc .endm .proc _SetDLIproc -; LDA #$C0 -; STY VDSLST -; STX VDSLST+1 -; STA NMIEN - rts +; LDA #$C0 +; STY VDSLST +; STX VDSLST+1 +; STA NMIEN + rts .endp .ENDIF diff --git a/C64/textproc.asm b/C64/textproc.asm index 877c1f8..34615f4 100644 --- a/C64/textproc.asm +++ b/C64/textproc.asm @@ -2,7 +2,7 @@ .IF *>0 - + WeaponsListDL = 0 NamesOfLevels = 0 ;---------------------------------------- @@ -20,68 +20,68 @@ NamesOfLevels = 0 ; - and I am sure maxwind, gravity, no_of_rounds in a game, speed of shell flight - ldx #$08 -@ lda Autoplay_OptionsTable,x - sta OptionsTable,x - dex - bpl @- + ldx #$08 +@ lda Autoplay_OptionsTable,x + sta OptionsTable,x + dex + bpl @- - rts + rts Autoplay_OptionsTable .by 4,4,2,2,4,1,3,2,4 .endp .proc SelectNextGradient - lda OptionsY ; if "Wind" option selected - cmp #$03 - bne NotWind - lda WindChangeInRound ; wind change after each turn (not round only) flag - eor #$1f ; '?' character - sta WindChangeInRound - rts + lda OptionsY ; if "Wind" option selected + cmp #$03 + bne NotWind + lda WindChangeInRound ; wind change after each turn (not round only) flag + eor #$1f ; '?' character + sta WindChangeInRound + rts NotWind - ldy GradientNr - iny - cpy #$03 - bne NoGradientLoop - ldy #$00 + ldy GradientNr + iny + cpy #$03 + bne NoGradientLoop + ldy #$00 NoGradientLoop - sty GradientNr - lda GradientAddrL,y - sta GradientColors - lda GradientAddrH,y - sta GradientColors+1 - rts + sty GradientNr + lda GradientAddrL,y + sta GradientColors + lda GradientAddrH,y + sta GradientColors+1 + rts .endp ;------------------------------------------- ; call of the purchase (and activate) screens for each tank .proc CallPurchaseForEveryTank - mva #0 TankNr - sta isInventory + mva #0 TankNr + sta isInventory @ - ldx TankNr - lda SkillTable,x - beq ManualPurchase - jsr PurchaseAI ; remember to make ActivateAI :) !!! - jmp AfterManualPurchase + ldx TankNr + lda SkillTable,x + beq ManualPurchase + jsr PurchaseAI ; remember to make ActivateAI :) !!! + jmp AfterManualPurchase ManualPurchase - lda JoyNumber,x - sta JoystickNumber ; set joystick port for player - mva #0 isInventory - jsr Purchase ; purchase weapons - bit escFlag - spl:rts - jsr DefensivesActivate ; activate weapons - bit escFlag - spl:rts + lda JoyNumber,x + sta JoystickNumber ; set joystick port for player + mva #0 isInventory + jsr Purchase ; purchase weapons + bit escFlag + spl:rts + jsr DefensivesActivate ; activate weapons + bit escFlag + spl:rts AfterManualPurchase - inc:lda TankNr - cmp NumberOfPlayers - bne @- - rts + inc:lda TankNr + cmp NumberOfPlayers + bne @- + rts .endp ;-------------------------------------------------- .proc DefensivesActivate @@ -92,7 +92,7 @@ AfterManualPurchase mva #$ff IsInventory mva #%10000000 WhichList ; offensive weapon - 0, defensive - %10000000 - jmp Purchase.GoToActivation + jmp Purchase.GoToActivation .endp @@ -109,8 +109,8 @@ AfterManualPurchase mva #$00 WhichList ; offensive weapon - 0, deffensive - %10000000 GoToActivation - rts - + rts + .endp ; ----------------------------------------------------- @@ -118,14 +118,14 @@ GoToActivation ;entering names of players mva #0 TankNr - sta COLBAKS ; set color of background + sta COLBAKS ; set color of background @ tax lda TankStatusColoursTable,x sta COLOR2 ; set color of player name line jsr EnterPlayerName bit escFlag spl:rts - jsr CheckTankCheat + jsr CheckTankCheat inc TankNr lda TankNr cmp NumberOfPlayers @@ -151,12 +151,12 @@ EndOfNick ; level of the computer opponent goes to ; the table of levels (difficulties) ldx tanknr - lda #6 ; Spoiler + lda #6 ; Spoiler sta DifficultyLevel sta skilltable,x - beq NotRobot - lda #$03 ; shape for robotanks - sta TankShape,x + beq NotRobot + lda #$03 ; shape for robotanks + sta TankShape,x NotRobot ; storing name of the tank in the right space ; (without cursor!) @@ -234,24 +234,24 @@ TooLittle000 dex ;rightnumber ; displaying without leading zeroes (if zeroes exist then display space at this position) ldy #0 - ldx #0 ; digit flag (cut leading zeroes) + ldx #0 ; digit flag (cut leading zeroes) displayloop lda decimalresult,y - cpx #0 - bne noleading0 - cpy #4 - beq noleading0 ; if 00000 - last 0 must stay - cmp zero - bne noleading0 - lda #space - beq displaychar ; space = 0 ! + cpx #0 + bne noleading0 + cpy #4 + beq noleading0 ; if 00000 - last 0 must stay + cmp zero + bne noleading0 + lda #space + beq displaychar ; space = 0 ! noleading0 - inx ; set flag (no leading zeroes to cut) + inx ; set flag (no leading zeroes to cut) displaychar sta (displayposition),y nexdigit iny - cpy #5 + cpy #5 bne displayloop rts @@ -313,7 +313,7 @@ displayloop1 ;-------------------------------------------------- .proc GameOverScreen ;-------------------------------------------------- - rts + rts .endp ;------------------------------------------------- .proc PutTankNameOnScreen diff --git a/ai.asm b/ai.asm index ce4b87c..f6f18f1 100644 --- a/ai.asm +++ b/ai.asm @@ -1,4 +1,4 @@ -; @com.wudsn.ide.asm.mainsourcefile=scorch.asm +; @com.wudsn.ide.asm.mainsourcefile=scorch.asm ; artificial intelligence of tanks goes here! ; in A there is a level of tank's intelligence @@ -22,26 +22,26 @@ pha lda AIRoutines,y pha -; it's no necessary - PrepareAIShoot is next proc :) -; jsr PrepareAIShoot -; rts -.endp +; it's no necessary - PrepareAIShoot is next proc :) +; jsr PrepareAIShoot +; rts +.endp ;---------------------------------------------- .proc PrepareAIShoot - ; create low precision table of positions - ; by dividing positions by 4 - ldy #MaxPlayers-1 + ; create low precision table of positions + ; by dividing positions by 4 + ldy #MaxPlayers-1 loop - lda xtankstableL,y - sta temp - lda xtankstableH,y - sta temp+1 - ;= /4 - :2 lsrw temp - lda temp - sta LowResDistances,y - dey - bpl loop + lda xtankstableL,y + sta temp + lda xtankstableH,y + sta temp+1 + ;= /4 + :2 lsrw temp + lda temp + sta LowResDistances,y + dey + bpl loop ; common values used in AI routines ; address of weapons table (for future use) @@ -50,7 +50,7 @@ WepTableToTemp sta temp lda TanksWeaponsTableH,x sta temp+1 - rts + rts .endp ;---------------- AIRoutines @@ -65,15 +65,15 @@ AIRoutines ;---------------------------------------------- .proc Unknown - ; random robotank (from Poolshark to Cyborg) - randomize 4 13 - and #%11111110 - tay + ; random robotank (from Poolshark to Cyborg) + randomize 4 13 + and #%11111110 + tay lda AIRoutines+1,y pha lda AIRoutines,y pha - rts + rts .endp ;---------------------------------------------- .proc Moron @@ -82,9 +82,9 @@ AIRoutines mwa #80 RandBoundaryLow mwa #800 RandBoundaryHigh jsr RandomizeForce - ; choose the best weapon - ldy #ind_Buy_me_________+1 ; if the cheat is active it will fire the BFG :) - jmp ChooseBestOffensive.NotFromAll + ; choose the best weapon + ldy #ind_Buy_me +1 ; if the cheat is active it will fire the BFG :) + jmp ChooseBestOffensive.NotFromAll ;rts .endp ;---------------------------------------------- @@ -95,10 +95,10 @@ AIRoutines ora PreviousEnergyH,x beq firstShoot - lda PreviousAngle,x - cmp #90 - bcs shootingLeftAtThisMomentOfTime - ; shooting right at this moment of time + lda PreviousAngle,x + cmp #90 + bcs shootingLeftAtThisMomentOfTime + ; shooting right at this moment of time sec sbc #5 cmp #10 @@ -106,41 +106,41 @@ AIRoutines bcc firstShoot ; GET THE aim againg shootingLeftAtThisMomentOfTime - - clc - adc #5 - cmp #170 ; maximum shooter angle + + clc + adc #5 + cmp #170 ; maximum shooter angle bcs firstShoot @ - sta NewAngle + sta NewAngle - sec - lda PreviousEnergyL,x - sbc #5 - sta ForceTableL,x - lda PreviousEnergyH,x - sbc #0 - sta ForceTableH,x - jmp endo + sec + lda PreviousEnergyL,x + sbc #5 + sta ForceTableL,x + lda PreviousEnergyH,x + sbc #0 + sta ForceTableH,x + jmp endo firstShoot - ; compare the x position with the middle of the screen + ; compare the x position with the middle of the screen lda xTanksTableH,x cmp #>(screenwidth/2) bne @+ - lda xTanksTableL,x - cmp #<(screenwidth/2) -@ bcc tankIsOnTheRight + lda xTanksTableL,x + cmp #<(screenwidth/2) +@ bcc tankIsOnTheRight ; enemy tank is on the left - randomize 95 125 - sta NewAngle - bne forceNow + randomize 95 125 + sta NewAngle + bne forceNow tankIsOnTheRight randomize 55 85 sta NewAngle - + forceNow mwa #100 RandBoundaryLow mwa #800 RandBoundaryHigh @@ -148,262 +148,262 @@ forceNow jsr RandomizeForce endo - ;ldx TankNr ;this is possibly not necessary + ;ldx TankNr ;this is possibly not necessary jsr RandomizeForce.LimitForce - lda NewAngle - sta PreviousAngle,x - lda ForceTableL,x - sta PreviousEnergyL,x - lda ForceTableH,x - sta PreviousEnergyH,x - - ; choose the best weapon - - jmp ChooseBestOffensive + lda NewAngle + sta PreviousAngle,x + lda ForceTableL,x + sta PreviousEnergyL,x + lda ForceTableH,x + sta PreviousEnergyH,x + + ; choose the best weapon + + jmp ChooseBestOffensive ;rts .endp ;---------------------------------------------- .proc Poolshark - jsr UseBatteryOrFlag - ; defensives - jsr PoolsharkDefensives + jsr UseBatteryOrFlag + ; defensives + jsr PoolsharkDefensives firstShoot - ;find nearest tank neighbour - jsr FindBestTarget2 - beq EnemyOnLeft - ; calculate index to shotangle table - ; in temp2 we have x distance divided by 8 - lda temp2 - :3 lsr @ - and #%00000111 - clc - adc #8 - sta AngleTablePointer - bne AngleIsSet + ;find nearest tank neighbour + jsr FindBestTarget2 + beq EnemyOnLeft + ; calculate index to shotangle table + ; in temp2 we have x distance divided by 8 + lda temp2 + :3 lsr @ + and #%00000111 + clc + adc #8 + sta AngleTablePointer + bne AngleIsSet EnemyOnLeft - lda temp2 - :3 lsr @ - and #%00000111 - eor #%00000111 - sta AngleTablePointer + lda temp2 + :3 lsr @ + and #%00000111 + eor #%00000111 + sta AngleTablePointer AngleIsSet - - randomize 0 8 - ldy AngleTablePointer - clc - adc AngleTable,y - sta NewAngle - + + randomize 0 8 + ldy AngleTablePointer + clc + adc AngleTable,y + sta NewAngle + forceNow mwa #300 RandBoundaryLow mwa #700 RandBoundaryHigh ldx TankNr jsr RandomizeForce -endo - ; choose the best weapon - - jsr ChooseBestOffensive +endo + ; choose the best weapon + + jsr ChooseBestOffensive rts ;---------------------------------------------- -AngleTable ; 16 bytes ;ba w $348b L$3350 - .by 106,114,122,130,138,146,154,162 - .by 18,26,34,43,50,58,66,74 +AngleTable ; 16 bytes ;ba w $348b L$3350 + .by 106,114,122,130,138,146,154,162 + .by 18,26,34,43,50,58,66,74 .endp ;---------------------------------------------- .proc UseBatteryOrFlag - jsr UseBattery ; as subroutine for reuse in AutoDefense - ; if very low energy and no battery then use White Flag - lda Energy,x - cmp #5 - bcs EnoughEnergy - ; lower than 5 units - white flag - jsr ClearTankNr ; we must hide tank to erase shields (issue #138) - lda #ind_White_Flag_____ - sta ActiveDefenceWeapon,x - jsr PutTankNr ; and draw tank witch Flag + jsr UseBattery ; as subroutine for reuse in AutoDefense + ; if very low energy and no battery then use White Flag + lda Energy,x + cmp #5 + bcs EnoughEnergy + ; lower than 5 units - white flag + jsr ClearTankNr ; we must hide tank to erase shields (issue #138) + lda #ind_White_Flag + sta ActiveDefenceWeapon,x + jsr PutTankNr ; and draw tank witch Flag EnoughEnergy - rts + rts .endp ; .proc UseBattery - ; if low energy ten use battery - lda Energy,x - cmp #30 - bcs EnoughEnergy - ; lower than 30 units - check battery - ldy #ind_Battery________ - lda (temp),y ; has address of TanksWeaponsTable - beq NoBatteries - ; we have batteries - use one - sec - sbc #1 - sta (temp),y - lda #99 - sta Energy,x - jsr MaxForceCalculate + ; if low energy ten use battery + lda Energy,x + cmp #30 + bcs EnoughEnergy + ; lower than 30 units - check battery + ldy #ind_Battery + lda (temp),y ; has address of TanksWeaponsTable + beq NoBatteries + ; we have batteries - use one + sec + sbc #1 + sta (temp),y + lda #99 + sta Energy,x + jsr MaxForceCalculate EnoughEnergy NoBatteries - rts + rts .endp ;---------------------------------------------- .proc PoolsharkDefensives - ; use best defensive :) - ; but not allways - randomize 1 3 - cmp #1 - bne NoUseDefensive - ; first check check if any is in use - lda ActiveDefenceWeapon,x - bne DefensiveInUse - ldy #last_real_defensive+1 ;the last defensive weapon + ; use best defensive :) + ; but not allways + randomize 1 3 + cmp #1 + bne NoUseDefensive + ; first check check if any is in use + lda ActiveDefenceWeapon,x + bne DefensiveInUse + ldy #last_real_defensive+1 ;the last defensive weapon @ - dey - cpy #ind_Hovercraft_____ ;first defensive weapon (White Flag, Battery and Hovercraft - never use) - beq NoUseDefensive - lda (temp),y ; has address of TanksWeaponsTable - beq @- - ; decrease in inventory - sec - sbc #1 - sta (temp),y ; has address of TanksWeaponsTable - ; activate defensive weapon - tya ; number of selectet defensive weapon - sta ActiveDefenceWeapon,x + dey + cpy #ind_Hovercraft ;first defensive weapon (White Flag, Battery and Hovercraft - never use) + beq NoUseDefensive + lda (temp),y ; has address of TanksWeaponsTable + beq @- + ; decrease in inventory + sec + sbc #1 + sta (temp),y ; has address of TanksWeaponsTable + ; activate defensive weapon + tya ; number of selectet defensive weapon + sta ActiveDefenceWeapon,x lda DefensiveEnergy,y sta ShieldEnergy,x NoUseDefensive DefensiveInUse - rts + rts .endp ;---------------------------------------------- .proc Tosser - jsr UseBatteryOrFlag - ; use best defensive :) - jsr TosserDefensives - ; Toosser is like Poolshark but allways uses defensives - jmp Poolshark.firstShoot + jsr UseBatteryOrFlag + ; use best defensive :) + jsr TosserDefensives + ; Toosser is like Poolshark but allways uses defensives + jmp Poolshark.firstShoot .endp ;---------------------------------------------- .proc TosserDefensives - ; use best defensive :) - ; allways - ; first check check if any is in use - lda ActiveDefenceWeapon,x - bne DefensiveInUse - ldy #last_real_defensive+1 ;the last defensive weapon + ; use best defensive :) + ; allways + ; first check check if any is in use + lda ActiveDefenceWeapon,x + bne DefensiveInUse + ldy #last_real_defensive+1 ;the last defensive weapon @ - dey - cpy #ind_Hovercraft_____ ;first defensive weapon (White Flag, Battery and Hovercraft - never use) - beq NoUseDefensive - lda (temp),y ; has address of TanksWeaponsTable - beq @- - ; decrease in inventory - sec - sbc #1 - sta (temp),y ; has address of TanksWeaponsTable - ; activate defensive weapon - tya ; number of selectet defensive weapon - sta ActiveDefenceWeapon,x + dey + cpy #ind_Hovercraft ;first defensive weapon (White Flag, Battery and Hovercraft - never use) + beq NoUseDefensive + lda (temp),y ; has address of TanksWeaponsTable + beq @- + ; decrease in inventory + sec + sbc #1 + sta (temp),y ; has address of TanksWeaponsTable + ; activate defensive weapon + tya ; number of selectet defensive weapon + sta ActiveDefenceWeapon,x lda DefensiveEnergy,y sta ShieldEnergy,x DefensiveInUse NoUseDefensive - rts + rts .endp ;---------------------------------------------- .proc Chooser - ; like cyborg but more randomizing force - jsr UseBatteryOrFlag - ; use defensives like Tosser - jsr TosserDefensives - ; now select best target - lda #$00 ; no prefer humans - jsr FindBestTarget3 - sty TargetTankNr - ; aiming - jsr TakeAim ; direction still in A (0 - left, >0 - right) - - ; choose the best weapon - jsr ChooseBestOffensive + ; like cyborg but more randomizing force + jsr UseBatteryOrFlag + ; use defensives like Tosser + jsr TosserDefensives + ; now select best target + lda #$00 ; no prefer humans + jsr FindBestTarget3 + sty TargetTankNr + ; aiming + jsr TakeAim ; direction still in A (0 - left, >0 - right) + + ; choose the best weapon + jsr ChooseBestOffensive - ; randomizing force +-100 - sbw Force #100 RandBoundaryLow - bpl NotNegativeEnergy - mwa #1 RandBoundaryLow + ; randomizing force +-100 + sbw Force #100 RandBoundaryLow + bpl NotNegativeEnergy + mwa #1 RandBoundaryLow NotNegativeEnergy - adw Force #100 RandBoundaryHigh + adw Force #100 RandBoundaryHigh jsr RandomizeForce - ; if target distance lower than 24 - set weapon to Baby Missile (for security :) - jsr GetDistance - cmp #6 ; 24/4 - bcs HighForce - lda #ind_Baby_Missile___ - sta ActiveWeapon,x + ; if target distance lower than 24 - set weapon to Baby Missile (for security :) + jsr GetDistance + cmp #6 ; 24/4 + bcs HighForce + lda #ind_Baby_Missile + sta ActiveWeapon,x HighForce - rts + rts .endp ;---------------------------------------------- .proc Spoiler - ; like cyborg but little randomizing force - jsr UseBatteryOrFlag - ; use defensives like Tosser - jsr TosserDefensives - ; now select best target - lda #$00 ; no prefer humans - jsr FindBestTarget3 - sty TargetTankNr - ; aiming - jsr TakeAim ; direction still in A (0 - left, >0 - right) - - ; choose the best weapon - jsr ChooseBestOffensive + ; like cyborg but little randomizing force + jsr UseBatteryOrFlag + ; use defensives like Tosser + jsr TosserDefensives + ; now select best target + lda #$00 ; no prefer humans + jsr FindBestTarget3 + sty TargetTankNr + ; aiming + jsr TakeAim ; direction still in A (0 - left, >0 - right) + + ; choose the best weapon + jsr ChooseBestOffensive - ; randomizing force +-50 - sbw Force #50 RandBoundaryLow - bpl NotNegativeEnergy - mwa #1 RandBoundaryLow + ; randomizing force +-50 + sbw Force #50 RandBoundaryLow + bpl NotNegativeEnergy + mwa #1 RandBoundaryLow NotNegativeEnergy - adw Force #50 RandBoundaryHigh + adw Force #50 RandBoundaryHigh jsr RandomizeForce - ; if target distance lower than 24 - set weapon to Baby Missile (for security :) - jsr GetDistance - cmp #6 ; 24/4 - bcs HighForce - lda #ind_Baby_Missile___ - sta ActiveWeapon,x + ; if target distance lower than 24 - set weapon to Baby Missile (for security :) + jsr GetDistance + cmp #6 ; 24/4 + bcs HighForce + lda #ind_Baby_Missile + sta ActiveWeapon,x HighForce - rts + rts .endp ;---------------------------------------------- .proc Cyborg - jsr UseBatteryOrFlag - ; use defensives like Tosser - jsr TosserDefensives - ; now select best target - lda #100 ; prefer humans - jsr FindBestTarget3 - sty TargetTankNr - ; aiming - jsr TakeAim ; direction still in A (0 - left, >0 - right) - - ; choose the best weapon - ldy #ind_Nuke___________+1 - jsr ChooseBestOffensive.NotFromAll + jsr UseBatteryOrFlag + ; use defensives like Tosser + jsr TosserDefensives + ; now select best target + lda #100 ; prefer humans + jsr FindBestTarget3 + sty TargetTankNr + ; aiming + jsr TakeAim ; direction still in A (0 - left, >0 - right) + + ; choose the best weapon + ldy #ind_Nuke +1 + jsr ChooseBestOffensive.NotFromAll - lda Force - sta ForceTableL,x - lda Force+1 - sta ForceTableH,x - ; if target distance lower than 32 - set weapon to Baby Missile (for security :) - jsr GetDistance - cmp #8 ;32/4 - bcs HighForce - lda #ind_Baby_Missile___ - sta ActiveWeapon,x + lda Force + sta ForceTableL,x + lda Force+1 + sta ForceTableH,x + ; if target distance lower than 32 - set weapon to Baby Missile (for security :) + jsr GetDistance + cmp #8 ;32/4 + bcs HighForce + lda #ind_Baby_Missile + sta ActiveWeapon,x HighForce - rts + rts .endp ;---------------------------------------------- @@ -414,51 +414,51 @@ HighForce ; returns target tank number in Y and ; direcion of shoot in A (0 - left, >0 - right) ;---------------------------------------------- - sta PreferHumansFlag -; jsr MakeLowResDistances - lda #202 - sta temp2 ; max possible energy - lda #0 - sta tempor2 ; direction of shoot - ;ldx TankNr - ldy NumberOfPlayers - dey - + sta PreferHumansFlag +; jsr MakeLowResDistances + lda #202 + sta temp2 ; max possible energy + lda #0 + sta tempor2 ; direction of shoot + ;ldx TankNr + ldy NumberOfPlayers + dey + loop01 - cpy TankNr - beq skipThisPlayer - lda eXistenZ,y - beq skipThisPlayer + cpy TankNr + beq skipThisPlayer + lda eXistenZ,y + beq skipThisPlayer - lda skilltable,y - beq ItIsHuman - lda PreferHumansFlag + lda skilltable,y + beq ItIsHuman + lda PreferHumansFlag ItIsHuman - clc - adc Energy,y ; if robotank energy=energy+100 (100 or 0 from PreferHumansFlag) - cmp temp2 ; lowest - bcs lowestIsLower - sta temp2 - sty temp2+1 ; number of the closest tank - mva #0 tempor2 - lda LowResDistances,x - cmp LowResDistances,y - bcs EnemyOnTheLeft - ; enemy on right - inc tempor2 ; set direction to right - -EnemyOnTheLeft + clc + adc Energy,y ; if robotank energy=energy+100 (100 or 0 from PreferHumansFlag) + cmp temp2 ; lowest + bcs lowestIsLower + sta temp2 + sty temp2+1 ; number of the closest tank + mva #0 tempor2 + lda LowResDistances,x + cmp LowResDistances,y + bcs EnemyOnTheLeft + ; enemy on right + inc tempor2 ; set direction to right + +EnemyOnTheLeft lowestIsLower skipThisPlayer - dey - bpl loop01 - ; now we have number of the farthest tank in temp2+1 - ; and direction (0 - left, >0 - right) in tempor2 - ; let's move them to registers - ; in temp2 we have energy of target - ldy temp2+1 - lda tempor2 - rts + dey + bpl loop01 + ; now we have number of the farthest tank in temp2+1 + ; and direction (0 - left, >0 - right) in tempor2 + ; let's move them to registers + ; in temp2 we have energy of target + ldy temp2+1 + lda tempor2 + rts .endp ;---------------------------------------------- .proc FindBestTarget2 @@ -467,54 +467,54 @@ skipThisPlayer ; returns target tank number in Y and ; direcion of shoot in A (0 - left, >0 - right) ;---------------------------------------------- -; jsr MakeLowResDistances - mva #$ff temp2 ; min possible distance - mva #0 tempor2 ; direction of shoot +; jsr MakeLowResDistances + mva #$ff temp2 ; min possible distance + mva #0 tempor2 ; direction of shoot - ;ldx TankNr - ldy NumberOfPlayers - dey - + ;ldx TankNr + ldy NumberOfPlayers + dey + loop01 - cpy TankNr - beq skipThisPlayer - lda eXistenZ,y - beq skipThisPlayer - - lda LowResDistances,x - cmp LowResDistances,y - bcs EnemyOnTheLeft - ;enemy on the right - sec - lda LowResDistances,y - sbc LowResDistances,x - cmp temp2 ; lowest - bcs lowestIsLower - sta temp2 - sty temp2+1 ; number of the closest tank - inc tempor2 ; set direction to right - bne lowestIsLower + cpy TankNr + beq skipThisPlayer + lda eXistenZ,y + beq skipThisPlayer + + lda LowResDistances,x + cmp LowResDistances,y + bcs EnemyOnTheLeft + ;enemy on the right + sec + lda LowResDistances,y + sbc LowResDistances,x + cmp temp2 ; lowest + bcs lowestIsLower + sta temp2 + sty temp2+1 ; number of the closest tank + inc tempor2 ; set direction to right + bne lowestIsLower EnemyOnTheLeft - sec - lda LowResDistances,x - sbc LowResDistances,y - cmp temp2 ; lowest - bcs lowestIsLower - sta temp2 - sty temp2+1 ; number of the closest tank - + sec + lda LowResDistances,x + sbc LowResDistances,y + cmp temp2 ; lowest + bcs lowestIsLower + sta temp2 + sty temp2+1 ; number of the closest tank + lowestIsLower skipThisPlayer - dey - bpl loop01 - ; now we have number of the closest tank in temp2+1 - ; and direction (0 - left, >0 - right) in tempor2 - ; let's move them to registers - ; in temp2 we have x distance divided by 8 - ldy temp2+1 - lda tempor2 - rts + dey + bpl loop01 + ; now we have number of the closest tank in temp2+1 + ; and direction (0 - left, >0 - right) in tempor2 + ; let's move them to registers + ; in temp2 we have x distance divided by 8 + ldy temp2+1 + lda tempor2 + rts .endp ;---------------------------------------------- @@ -524,239 +524,239 @@ skipThisPlayer ; returns angle and power of shoot tank X (TankNr) ; in the appropriate variables (Angle and Force) ;---------------------------------------------- - lda ActiveWeapon,x - pha ; store active weapon - mva #$ff SecondTryFlag - ; set initial Angle and Force values - lda OptionsTable+2 ; selected gravity - asl - tay - ; force correction - lower tank Y position - higher possible force - sec - lda #screenheight - sbc Ytankstable,x - sta temp2 - clc - lda AIForceTable,y - sta RandBoundaryLow - adc temp2 - sta RandBoundaryHigh - lda AIForceTable+1,y - sta RandBoundaryLow+1 - adc #0 - sta RandBoundaryHigh+1 + lda ActiveWeapon,x + pha ; store active weapon + mva #$ff SecondTryFlag + ; set initial Angle and Force values + lda OptionsTable+2 ; selected gravity + asl + tay + ; force correction - lower tank Y position - higher possible force + sec + lda #screenheight + sbc Ytankstable,x + sta temp2 + clc + lda AIForceTable,y + sta RandBoundaryLow + adc temp2 + sta RandBoundaryHigh + lda AIForceTable+1,y + sta RandBoundaryLow+1 + adc #0 + sta RandBoundaryHigh+1 jsr RandomizeForce RepeatAim - jsr Table2Force - ; wind correction 90+(wind/8) - mwa Wind temp2 - :7 lsrw temp2 - clc - lda #90 - adc temp2 - sta NewAngle - ; set virtual weapon :) - lda #ind_Baby_Missile___ - sta ActiveWeapon,x - ; now we have initial valuses - mva #%11000000 TestFlightFlag - ; check targeting direction - lda tempor2 - jne AimingLeft + jsr Table2Force + ; wind correction 90+(wind/8) + mwa Wind temp2 + :7 lsrw temp2 + clc + lda #90 + adc temp2 + sta NewAngle + ; set virtual weapon :) + lda #ind_Baby_Missile + sta ActiveWeapon,x + ; now we have initial valuses + mva #%11000000 TestFlightFlag + ; check targeting direction + lda tempor2 + jne AimingLeft AimingRight - ; make test Shoot (Flight) - jsr SetStartAndFlight - lda HitFlag - beq NoHitInFirstLoopR ; impossible :) - bmi GroundHitInFirstLoopR + ; make test Shoot (Flight) + jsr SetStartAndFlight + lda HitFlag + beq NoHitInFirstLoopR ; impossible :) + bmi GroundHitInFirstLoopR TankHitInFirstLoopR - ; tank hit, but which tank? - ; it's our target or not? - ldy HitFlag - dey - cpy TargetTankNr - beq EndOfFirstLoopR ; it's our target! - ; if it's another tank then check position like ground hit + ; tank hit, but which tank? + ; it's our target or not? + ldy HitFlag + dey + cpy TargetTankNr + beq EndOfFirstLoopR ; it's our target! + ; if it's another tank then check position like ground hit GroundHitInFirstLoopR - ; checking only x position of hit - ldy TargetTankNr - lda xTanksTableH,y - cmp XHit+1 - bne @+ - lda xTanksTableL,y - cmp XHit + ; checking only x position of hit + ldy TargetTankNr + lda xTanksTableH,y + cmp XHit+1 + bne @+ + lda xTanksTableL,y + cmp XHit @ - bcs HitOnRightSideOfTargetR - ; continue targeting - clc - lda NewAngle - adc #5 ; 5 deg to right - cmp #(180-20) -; bcs EndOfFirstLoopR ; if angle 180-20 or higher - bcs AimSecondTry - sta NewAngle - jmp AimingRight + bcs HitOnRightSideOfTargetR + ; continue targeting + clc + lda NewAngle + adc #5 ; 5 deg to right + cmp #(180-20) +; bcs EndOfFirstLoopR ; if angle 180-20 or higher + bcs AimSecondTry + sta NewAngle + jmp AimingRight NoHitInFirstLoopR - ; Angle 5 deg to left and end loop - sec - lda NewAngle - sbc #5 - sta NewAngle + ; Angle 5 deg to left and end loop + sec + lda NewAngle + sbc #5 + sta NewAngle HitOnRightSideOfTargetR - dec NewAngle + dec NewAngle EndOfFirstLoopR - mva #5 modify ; set counter (5 turns) + mva #5 modify ; set counter (5 turns) SecondLoopR - ; make test Shoot (Flight) - jsr SetStartAndFlight - lda HitFlag - beq NoHitInSecondLoopR ; impossible :) - bmi GroundHitInSecondLoopR + ; make test Shoot (Flight) + jsr SetStartAndFlight + lda HitFlag + beq NoHitInSecondLoopR ; impossible :) + bmi GroundHitInSecondLoopR TankHitInSecondLoopR - ; tank hit, but which tank? - ; it's our target or not? - ldy HitFlag - dey - cpy TargetTankNr - beq EndOfSecondLoopR ; it's our target! - ; if it's another tank then check position like ground hit + ; tank hit, but which tank? + ; it's our target or not? + ldy HitFlag + dey + cpy TargetTankNr + beq EndOfSecondLoopR ; it's our target! + ; if it's another tank then check position like ground hit GroundHitInSecondLoopR - ; checking only x position of hit - ldy TargetTankNr - lda xTanksTableH,y - cmp XHit+1 - bne @+ - lda xTanksTableL,y - cmp XHit + ; checking only x position of hit + ldy TargetTankNr + lda xTanksTableH,y + cmp XHit+1 + bne @+ + lda xTanksTableL,y + cmp XHit @ - bcc HitOnLeftSideOfTargetR - ; continue targeting - dec NewAngle ; 1 deg to left - dec modify ; max 5 turns - beq EndOfSecondLoopR - jmp SecondLoopR + bcc HitOnLeftSideOfTargetR + ; continue targeting + dec NewAngle ; 1 deg to left + dec modify ; max 5 turns + beq EndOfSecondLoopR + jmp SecondLoopR HitOnLeftSideOfTargetR - ; decrease energy (a little) - sbw Force #5 + ; decrease energy (a little) + sbw Force #5 NoHitInSecondLoopR - ; Angle 1 deg to right and end loop - inc NewAngle + ; Angle 1 deg to right and end loop + inc NewAngle EndOfSecondLoopR EndOfAim - pla ; and restore active weapon - sta ActiveWeapon,x - rts + pla ; and restore active weapon + sta ActiveWeapon,x + rts AimSecondTry - bit SecondTryFlag - bpl EndOfAim ; closest RTS - inc SecondTryFlag - lda #<1000 - sta ForceTableL,x - lda #>1000 - sta ForceTableH,x - jsr RandomizeForce.LimitForce - jmp RepeatAim - + bit SecondTryFlag + bpl EndOfAim ; closest RTS + inc SecondTryFlag + lda #<1000 + sta ForceTableL,x + lda #>1000 + sta ForceTableH,x + jsr RandomizeForce.LimitForce + jmp RepeatAim + AimingLeft - ; make test Shoot (Flight) - jsr SetStartAndFlight - lda HitFlag - beq NoHitInFirstLoopL ; impossible :) - bmi GroundHitInFirstLoopL + ; make test Shoot (Flight) + jsr SetStartAndFlight + lda HitFlag + beq NoHitInFirstLoopL ; impossible :) + bmi GroundHitInFirstLoopL TankHitInFirstLoopL - ; tank hit, but which tank? - ; it's our target or not? - ldy HitFlag - dey - cpy TargetTankNr - beq EndOfFirstLoopL ; it's our target! - ; if it's another tank then check position like ground hit + ; tank hit, but which tank? + ; it's our target or not? + ldy HitFlag + dey + cpy TargetTankNr + beq EndOfFirstLoopL ; it's our target! + ; if it's another tank then check position like ground hit GroundHitInFirstLoopL - ; checking only x position of hit - ldy TargetTankNr - lda xTanksTableH,y - cmp XHit+1 - bne @+ - lda xTanksTableL,y - cmp XHit + ; checking only x position of hit + ldy TargetTankNr + lda xTanksTableH,y + cmp XHit+1 + bne @+ + lda xTanksTableL,y + cmp XHit @ - bcc HitOnLeftSideOfTargetL - ; continue targeting - sec - lda NewAngle - sbc #5 ; 5 deg to left - cmp #21 -; bcc EndOfFirstLoopL ; if angle 20 or lower - bcc AimSecondTry - sta NewAngle - jmp AimingLeft + bcc HitOnLeftSideOfTargetL + ; continue targeting + sec + lda NewAngle + sbc #5 ; 5 deg to left + cmp #21 +; bcc EndOfFirstLoopL ; if angle 20 or lower + bcc AimSecondTry + sta NewAngle + jmp AimingLeft NoHitInFirstLoopL - ; Angle 5 deg to right and end loop - clc - lda NewAngle - adc #5 - sta NewAngle + ; Angle 5 deg to right and end loop + clc + lda NewAngle + adc #5 + sta NewAngle HitOnLeftSideOfTargetL - inc NewAngle + inc NewAngle EndOfFirstLoopL - mva #5 modify ; set counter (5 turns) + mva #5 modify ; set counter (5 turns) SecondLoopL - ; make test Shoot (Flight) - jsr SetStartAndFlight - lda HitFlag - beq NoHitInSecondLoopL ; impossible :) - bmi GroundHitInSecondLoopL + ; make test Shoot (Flight) + jsr SetStartAndFlight + lda HitFlag + beq NoHitInSecondLoopL ; impossible :) + bmi GroundHitInSecondLoopL TankHitInSecondLoopL - ; tank hit, but which tank? - ; it's our target or not? - ldy HitFlag - dey - cpy TargetTankNr - beq EndOfSecondLoopL ; it's our target! - ; if it's another tank then check position like ground hit + ; tank hit, but which tank? + ; it's our target or not? + ldy HitFlag + dey + cpy TargetTankNr + beq EndOfSecondLoopL ; it's our target! + ; if it's another tank then check position like ground hit GroundHitInSecondLoopL - ; checking only x position of hit - ldy TargetTankNr - lda xTanksTableH,y - cmp XHit+1 - bne @+ - lda xTanksTableL,y - cmp XHit + ; checking only x position of hit + ldy TargetTankNr + lda xTanksTableH,y + cmp XHit+1 + bne @+ + lda xTanksTableL,y + cmp XHit @ - bcs HitOnRightSideOfTargetL - ; continue targeting - inc NewAngle ; 1 deg to right - dec modify ; max 5 turns - beq EndOfSecondLoopL - jmp SecondLoopL + bcs HitOnRightSideOfTargetL + ; continue targeting + inc NewAngle ; 1 deg to right + dec modify ; max 5 turns + beq EndOfSecondLoopL + jmp SecondLoopL HitOnRightSideOfTargetL - ; decrease energy (a little) - sbw Force #5 + ; decrease energy (a little) + sbw Force #5 NoHitInSecondLoopL - ; Angle 1 deg to left and end loop - dec NewAngle + ; Angle 1 deg to left and end loop + dec NewAngle EndOfSecondLoopL - jmp EndOfAim - -SetStartAndFlight ; set start point (virtual barrel end :) ) and make test flight - ; xtraj+1 and ytraj+1 set - clc - lda xTanksTableL,x - adc #4 - sta xtraj+1 - lda xTanksTableH,x - adc #0 - sta xtraj+2 - sec - lda yTanksTable,x - sbc #4 - sta ytraj+1 - mva #0 ytraj+2 - mva NewAngle Angle - jsr Flight - ldx TankNr - rts + jmp EndOfAim + +SetStartAndFlight ; set start point (virtual barrel end :) ) and make test flight + ; xtraj+1 and ytraj+1 set + clc + lda xTanksTableL,x + adc #4 + sta xtraj+1 + lda xTanksTableH,x + adc #0 + sta xtraj+2 + sec + lda yTanksTable,x + sbc #4 + sta ytraj+1 + mva #0 ytraj+2 + mva NewAngle Angle + jsr Flight + ldx TankNr + rts .endp ;---------------------------------------------- .proc PurchaseAI ; @@ -771,8 +771,8 @@ SetStartAndFlight ; set start point (virtual barrel end :) ) and make test fligh pha lda PurchaseAIRoutines,x pha - rts - .endp + rts + .endp ;---------------- PurchaseAIRoutines @@ -791,125 +791,125 @@ PurchaseAIRoutines rts .endp ;------- -.proc TryToPurchaseOnePiece2 ; for Cyborg - ; A - weapon number, better it will be in range(1,32) - ; TankNr in X +.proc TryToPurchaseOnePiece2 ; for Cyborg + ; A - weapon number, better it will be in range(1,32) + ; TankNr in X ; DOES NOT CHANGE X - tay - sta temp+1 - :3 lsr ; A=A/8 - sta temp - tya - and #%00000111 - tay - lda bittable,y - ldy temp - and PurchaseMeTable2,y - beq TryToPurchaseOnePiece.SorryNoPurchase - jmp TryToPurchaseOnePiece.PurchaseIt + tay + sta temp+1 + :3 lsr ; A=A/8 + sta temp + tya + and #%00000111 + tay + lda bittable,y + ldy temp + and PurchaseMeTable2,y + beq TryToPurchaseOnePiece.SorryNoPurchase + jmp TryToPurchaseOnePiece.PurchaseIt .endp ;------- .proc TryToPurchaseOnePiece - ; A - weapon number, better it will be in range(1,32) - ; TankNr in X + ; A - weapon number, better it will be in range(1,32) + ; TankNr in X ; DOES NOT CHANGE X - tay - sta temp+1 - :3 lsr ; A=A/8 - sta temp - tya - and #%00000111 - tay - lda bittable,y - ldy temp - and PurchaseMeTable,y - beq SorryNoPurchase + tay + sta temp+1 + :3 lsr ; A=A/8 + sta temp + tya + and #%00000111 + tay + lda bittable,y + ldy temp + and PurchaseMeTable,y + beq SorryNoPurchase PurchaseIt - ldy temp+1 - lda WeaponPriceL,y - sta temp - lda WeaponPriceH,y - sta temp+1 - ;price of the weapon in temp - lda MoneyL,x - sta temp2 - lda MoneyH,x - sta temp2+1 - ;current monies in temp2 - cpw temp2 temp - bcc SorryNoPurchase - ; deduct monies from the bank account - sec - lda temp2 - sbc temp - sta MoneyL,x - lda temp2+1 - sbc temp+1 - sta MoneyH,x - - lda TanksWeaponsTableL,x - sta temp - lda TanksWeaponsTableH,x - sta temp+1 + ldy temp+1 + lda WeaponPriceL,y + sta temp + lda WeaponPriceH,y + sta temp+1 + ;price of the weapon in temp + lda MoneyL,x + sta temp2 + lda MoneyH,x + sta temp2+1 + ;current monies in temp2 + cpw temp2 temp + bcc SorryNoPurchase + ; deduct monies from the bank account + sec + lda temp2 + sbc temp + sta MoneyL,x + lda temp2+1 + sbc temp+1 + sta MoneyH,x + + lda TanksWeaponsTableL,x + sta temp + lda TanksWeaponsTableH,x + sta temp+1 - lda WeaponUnits,y - clc - adc (temp),y - cmp #99 ;max number of weapon units - bcc NotExceeded - lda #99 + lda WeaponUnits,y + clc + adc (temp),y + cmp #99 ;max number of weapon units + bcc NotExceeded + lda #99 NotExceeded - sta (temp),y - - + sta (temp),y + + SorryNoPurchase - rts - .endp - + rts + .endp + ;---------------------------------------------- .proc ShooterPurchase - ; first try to buy defensives -; mva #2 tempXroller; number of offensive purchases to perform - ldx TankNr + ; first try to buy defensives +; mva #2 tempXroller; number of offensive purchases to perform + ldx TankNr @ - randomize ind_Battery________ ind_StrongParachute - jsr TryToPurchaseOnePiece -; dec tempXroller -; bne @- - - ; and now offensives - mva #4 tempXroller; number of offensive purchases to perform - ;ldx TankNr + randomize ind_Battery ind_StrongParachute + jsr TryToPurchaseOnePiece +; dec tempXroller +; bne @- + + ; and now offensives + mva #4 tempXroller; number of offensive purchases to perform + ;ldx TankNr @ - randomize ind_Missile________ ind_Heavy_Roller___ - jsr TryToPurchaseOnePiece - dec tempXroller - bne @- + randomize ind_Missile ind_Heavy_Roller + jsr TryToPurchaseOnePiece + dec tempXroller + bne @- - rts + rts .endp ;---------------------------------------------- .proc PoolsharkPurchase - ; first try to buy defensives -; mva #2 tempXroller; number of offensive purchases to perform - ldx TankNr + ; first try to buy defensives +; mva #2 tempXroller; number of offensive purchases to perform + ldx TankNr @ - randomize ind_Battery________ ind_Bouncy_Castle__ - jsr TryToPurchaseOnePiece - dec tempXroller -; bpl @- - - ; and now offensives - mva #6 tempXroller; number of purchases to perform - ;ldx TankNr + randomize ind_Battery ind_Bouncy_Castle + jsr TryToPurchaseOnePiece + dec tempXroller +; bpl @- + + ; and now offensives + mva #6 tempXroller; number of purchases to perform + ;ldx TankNr @ - randomize ind_Missile________ ind_Dirt_Charge____ - jsr TryToPurchaseOnePiece - dec tempXroller - bne @- + randomize ind_Missile ind_Dirt_Charge + jsr TryToPurchaseOnePiece + dec tempXroller + bne @- - rts + rts .endp ;---------------------------------------------- .proc TosserPurchase @@ -917,12 +917,12 @@ SorryNoPurchase ; what is my money level ldx TankNr lda MoneyH,x ; money / 256 - lsr ; /2 + lsr ; /2 sta tempXroller ; perform this many purchase attempts ; first try to buy defensives ; mva #1 tempXroller; number of defensive purchases to perform @ - randomize ind_Battery________ ind_Bouncy_Castle__ + randomize ind_Battery ind_Bouncy_Castle jsr TryToPurchaseOnePiece dec tempXroller bpl @- @@ -932,7 +932,7 @@ SorryNoPurchase asl ;*2 sta tempXroller ; perform this many purchase attempts @ - randomize ind_Missile________ ind_Dirt_Charge____ + randomize ind_Missile ind_Dirt_Charge jsr TryToPurchaseOnePiece dec tempXroller bpl @- @@ -945,12 +945,12 @@ SorryNoPurchase ; what is my money level ldx TankNr lda MoneyH,x ; money / 256 - lsr ; /2 + lsr ; /2 sta tempXroller ; perform this many purchase attempts ; first try to buy defensives ; mva #1 tempXroller; number of defensive purchases to perform @ - randomize ind_Battery________ ind_Bouncy_Castle__ + randomize ind_Battery ind_Bouncy_Castle jsr TryToPurchaseOnePiece2 dec tempXroller bpl @- @@ -960,7 +960,7 @@ SorryNoPurchase :3 asl ;*8 sta tempXroller ; perform this many purchase attempts @ - randomize first_offensive____ last_offensive_____ + randomize first_offensive last_offensive jsr TryToPurchaseOnePiece2 dec tempXroller bpl @- @@ -972,36 +972,36 @@ SorryNoPurchase ; choose the best weapon ; X - TankNr ;---------------------------------------------- - ldy #ind_Dirt_Charge____+1 ;the last weapon to choose +1 (not BFG or Laser :) ) -NotFromAll + ldy #ind_Dirt_Charge +1 ;the last weapon to choose +1 (not BFG or Laser :) ) +NotFromAll ; Y - the last offensive weapon to use + 1 - lda TanksWeaponsTableL,x - sta temp - lda TanksWeaponsTableH,x - sta temp+1 + lda TanksWeaponsTableL,x + sta temp + lda TanksWeaponsTableH,x + sta temp+1 loop - dey - lda (temp),y - beq loop - tya - sta ActiveWeapon,x - rts + dey + lda (temp),y + beq loop + tya + sta ActiveWeapon,x + rts .endp ;---------------------------------------------- .proc GetDistance ; calculates lores ( /4 ) distance from tank X to TargetTankNr(Y) ; result in A ;---------------------------------------------- - ldy TargetTankNr - lda LowResDistances,x - cmp LowResDistances,y -@ bcs YisLower - sec - lda LowResDistances,y - sbc LowResDistances,x - rts + ldy TargetTankNr + lda LowResDistances,x + cmp LowResDistances,y +@ bcs YisLower + sec + lda LowResDistances,y + sbc LowResDistances,x + rts YisLower - lda LowResDistances,x - sbc LowResDistances,y - rts + lda LowResDistances,x + sbc LowResDistances,y + rts .endp \ No newline at end of file diff --git a/artwork/sfx/rmtplayr_modified.asm b/artwork/sfx/rmtplayr_modified.asm index 506b580..dfbe15c 100644 --- a/artwork/sfx/rmtplayr_modified.asm +++ b/artwork/sfx/rmtplayr_modified.asm @@ -8,7 +8,7 @@ ; 1. RMT player routine needs 19 itself reserved bytes in zero page (no accessed ; from any other routines) as well as cca 1KB of memory before the "PLAYER" ; address for frequency tables and functionary variables. It's: -; a) from PLAYER-$03c0 to PLAYER for stereo RMTplayer +; a) from PLAYER-$03c0 to PLAYER for stereo RMTplayer ; b) from PLAYER-$0320 to PLAYER for mono RMTplayer ; ; 2. RMT player routine MUST (!!!) be compiled from the begin of the memory page. @@ -16,15 +16,15 @@ ; ; 3. Because of RMTplayer provides a lot of effects, it spent a lot of CPU time. ; -; STEREOMODE equ 0..3 ;0 => compile RMTplayer for 4 tracks mono -; ;1 => compile RMTplayer for 8 tracks stereo -; ;2 => compile RMTplayer for 4 tracks stereo L1 R2 R3 L4 -; ;3 => compile RMTplayer for 4 tracks stereo L1 L2 R3 R4 +; STEREOMODE equ 0..3 ;0 => compile RMTplayer for 4 tracks mono +; ;1 => compile RMTplayer for 8 tracks stereo +; ;2 => compile RMTplayer for 4 tracks stereo L1 R2 R3 L4 +; ;3 => compile RMTplayer for 4 tracks stereo L1 L2 R3 R4 -TRACKS equ 4 +TRACKS equ 4 ; RMT FEATures definitions file ; For optimizations of RMT player routine to concrete RMT modul only! - icl "feat.txt" + icl "feat.txt" ;FEAT_EFFECTS equ FEAT_EFFECTVIBRATO||FEAT_EFFECTFSHIFT ; ; RMT ZeroPage addresses @@ -37,7 +37,7 @@ p_instrstable = p_tis .zpvar nr .word .zpvar nt .byte .zpvar reg1 .byte -.zpvar reg2 .byte +.zpvar reg2 .byte .zpvar reg3 .byte .zpvar tmp .byte .zpvar v_audctl .byte ; de-self-modification vars @@ -49,43 +49,43 @@ p_instrstable = p_tis .zpvar RMTSFXVOLUME .byte ; MOVED TO variables.asm -; org PLAYER-$400+$e0 +; org PLAYER-$400+$e0 ;track_variables -;trackn_db .ds TRACKS -;trackn_hb .ds TRACKS -;trackn_idx .ds TRACKS -;trackn_pause .ds TRACKS -;trackn_note .ds TRACKS -;trackn_volume .ds TRACKS -;trackn_distor .ds TRACKS -;trackn_shiftfrq .ds TRACKS -;trackn_instrx2 .ds TRACKS -;trackn_instrdb .ds TRACKS -;trackn_instrhb .ds TRACKS -;trackn_instridx .ds TRACKS -;trackn_instrlen .ds TRACKS -;trackn_instrlop .ds TRACKS -;trackn_instrreachend .ds TRACKS +;trackn_db .ds TRACKS +;trackn_hb .ds TRACKS +;trackn_idx .ds TRACKS +;trackn_pause .ds TRACKS +;trackn_note .ds TRACKS +;trackn_volume .ds TRACKS +;trackn_distor .ds TRACKS +;trackn_shiftfrq .ds TRACKS +;trackn_instrx2 .ds TRACKS +;trackn_instrdb .ds TRACKS +;trackn_instrhb .ds TRACKS +;trackn_instridx .ds TRACKS +;trackn_instrlen .ds TRACKS +;trackn_instrlop .ds TRACKS +;trackn_instrreachend .ds TRACKS ;trackn_volumeslidedepth .ds TRACKS ;trackn_volumeslidevalue .ds TRACKS -;trackn_effdelay .ds TRACKS -;trackn_effvibratoa .ds TRACKS -;trackn_effshift .ds TRACKS +;trackn_effdelay .ds TRACKS +;trackn_effvibratoa .ds TRACKS +;trackn_effshift .ds TRACKS ;trackn_tabletypespeed .ds TRACKS -;trackn_tablenote .ds TRACKS -;trackn_tablea .ds TRACKS -;trackn_tableend .ds TRACKS -;trackn_tablelop .ds TRACKS -;trackn_tablespeeda .ds TRACKS -;trackn_command .ds TRACKS -;trackn_filter .ds TRACKS -;trackn_audf .ds TRACKS -;trackn_audc .ds TRACKS -;trackn_audctl .ds TRACKS -;v_aspeed .ds 1 +;trackn_tablenote .ds TRACKS +;trackn_tablea .ds TRACKS +;trackn_tableend .ds TRACKS +;trackn_tablelop .ds TRACKS +;trackn_tablespeeda .ds TRACKS +;trackn_command .ds TRACKS +;trackn_filter .ds TRACKS +;trackn_audf .ds TRACKS +;trackn_audc .ds TRACKS +;trackn_audctl .ds TRACKS +;v_aspeed .ds 1 ;track_endvariables -INSTRPAR equ 12 +INSTRPAR equ 12 tabbeganddistor dta frqtabpure-frqtab,$00 dta frqtabpure-frqtab,$20 @@ -96,451 +96,451 @@ tabbeganddistor dta frqtabbass1-frqtab,$c0 dta frqtabbass2-frqtab,$c0 vibtabbeg dta 0,vib1-vib0,vib2-vib0,vib3-vib0 -vib0 dta 0 -vib1 dta 1,-1,-1,1 -vib2 dta 1,0,-1,-1,0,1 -vib3 dta 1,1,0,-1,-1,-1,-1,0,1,1 +vib0 dta 0 +vib1 dta 1,-1,-1,1 +vib2 dta 1,0,-1,-1,0,1 +vib3 dta 1,1,0,-1,-1,-1,-1,0,1,1 vibtabnext - dta vib0-vib0+0 - dta vib1-vib0+1,vib1-vib0+2,vib1-vib0+3,vib1-vib0+0 - dta vib2-vib0+1,vib2-vib0+2,vib2-vib0+3,vib2-vib0+4,vib2-vib0+5,vib2-vib0+0 - dta vib3-vib0+1,vib3-vib0+2,vib3-vib0+3,vib3-vib0+4,vib3-vib0+5,vib3-vib0+6,vib3-vib0+7,vib3-vib0+8,vib3-vib0+9,vib3-vib0+0 + dta vib0-vib0+0 + dta vib1-vib0+1,vib1-vib0+2,vib1-vib0+3,vib1-vib0+0 + dta vib2-vib0+1,vib2-vib0+2,vib2-vib0+3,vib2-vib0+4,vib2-vib0+5,vib2-vib0+0 + dta vib3-vib0+1,vib3-vib0+2,vib3-vib0+3,vib3-vib0+4,vib3-vib0+5,vib3-vib0+6,vib3-vib0+7,vib3-vib0+8,vib3-vib0+9,vib3-vib0+0 .align $100 frqtab - ERT [255 -; ldy #0 -; tya -;ri0 sta track_variables,y -; sta track_endvariables-$100,y -; iny -; bne ri0 -; ELS - ldy #track_endvariables-track_variables - lda #0 -ri0 sta track_variables-1,y - dey - bne ri0 -; EIF - ldy #4 - lda (ns),y - sta v_maxtracklen - iny - lda (ns),y - sta v_speed - ldy #8 -ri1 lda (ns),y - sta p_tis-8,y - iny - cpy #8+8 - bne ri1 - pla - pha - asl @ - asl @ - clc - adc p_song - sta p_song - pla - php - and #$c0 - asl @ - rol @ - rol @ - plp - adc p_song+1 - sta p_song+1 - jsr GetSongLineTrackLineInitOfNewSetInstrumentsOnlyRmtp3 + stx ns + sty ns+1 + pha +; IFT track_endvariables-track_variables>255 +; ldy #0 +; tya +;ri0 sta track_variables,y +; sta track_endvariables-$100,y +; iny +; bne ri0 +; ELS + ldy #track_endvariables-track_variables + lda #0 +ri0 sta track_variables-1,y + dey + bne ri0 +; EIF + ldy #4 + lda (ns),y + sta v_maxtracklen + iny + lda (ns),y + sta v_speed + ldy #8 +ri1 lda (ns),y + sta p_tis-8,y + iny + cpy #8+8 + bne ri1 + pla + pha + asl @ + asl @ + clc + adc p_song + sta p_song + pla + php + and #$c0 + asl @ + rol @ + rol @ + plp + adc p_song+1 + sta p_song+1 + jsr GetSongLineTrackLineInitOfNewSetInstrumentsOnlyRmtp3 rmt_silence - lda #0 - sta $d208 - ldy #3 - sty $d20f - ldy #8 -si1 sta $d200,y - dey - bpl si1 - lda #FEAT_INSTRSPEED - rts + lda #0 + sta $d208 + ldy #3 + sty $d20f + ldy #8 +si1 sta $d200,y + dey + bpl si1 + lda #FEAT_INSTRSPEED + rts GetSongLineTrackLineInitOfNewSetInstrumentsOnlyRmtp3 GetSongLine - ldx #0 - stx v_abeat + ldx #0 + stx v_abeat nn0 -nn1 txa - tay - lda (p_song),y - cmp #$fe - bcs nn2 - tay - lda (p_trackslbstable),y - sta trackn_db,x - lda (p_trackshbstable),y +nn1 txa + tay + lda (p_song),y + cmp #$fe + bcs nn2 + tay + lda (p_trackslbstable),y + sta trackn_db,x + lda (p_trackshbstable),y nn1a sta trackn_hb,x - lda #0 - sta trackn_idx,x - lda #1 + lda #0 + sta trackn_idx,x + lda #1 nn1a2 sta trackn_pause,x - lda #$80 - sta trackn_instrx2,x - inx -xtracks01 cpx #TRACKS - bne nn1 - lda p_song - clc -xtracks02 adc #TRACKS - sta p_song - bcc GetTrackLine - inc p_song+1 + lda #$80 + sta trackn_instrx2,x + inx +xtracks01 cpx #TRACKS + bne nn1 + lda p_song + clc +xtracks02 adc #TRACKS + sta p_song + bcc GetTrackLine + inc p_song+1 nn1b - jmp GetTrackLine + jmp GetTrackLine nn2 - beq nn3 + beq nn3 nn2a - lda #0 - beq nn1a2 + lda #0 + beq nn1a2 nn3 - ldy #2 - lda (p_song),y - tax - iny - lda (p_song),y - sta p_song+1 - stx p_song - ldx #0 - beq nn0 + ldy #2 + lda (p_song),y + tax + iny + lda (p_song),y + sta p_song+1 + stx p_song + ldx #0 + beq nn0 GetTrackLine oo0 oo0a - lda v_speed + lda v_speed - sta v_bspeed - ldx #-1 + sta v_bspeed + ldx #-1 oo1 - inx - dec trackn_pause,x - bne oo1x + inx + dec trackn_pause,x + bne oo1x oo1b - lda trackn_db,x - sta ns - lda trackn_hb,x - sta ns+1 + lda trackn_db,x + sta ns + lda trackn_hb,x + sta ns+1 oo1i - ldy trackn_idx,x - inc trackn_idx,x - lda (ns),y - sta reg1 - and #$3f - cmp #61 - beq oo1a - bcs oo2 - sta trackn_note,x - iny - lda (ns),y - lsr @ - and #$3f*2 - sta trackn_instrx2,x + ldy trackn_idx,x + inc trackn_idx,x + lda (ns),y + sta reg1 + and #$3f + cmp #61 + beq oo1a + bcs oo2 + sta trackn_note,x + iny + lda (ns),y + lsr @ + and #$3f*2 + sta trackn_instrx2,x oo1a - lda #1 - sta trackn_pause,x - ldy trackn_idx,x - inc trackn_idx,x - lda (ns),y - lsr @ - ror reg1 - lsr @ - ror reg1 - lda reg1 - and #$f0 - sta trackn_volume,x + lda #1 + sta trackn_pause,x + ldy trackn_idx,x + inc trackn_idx,x + lda (ns),y + lsr @ + ror reg1 + lsr @ + ror reg1 + lda reg1 + and #$f0 + sta trackn_volume,x oo1x -xtracks03sub1 cpx #TRACKS-1 - bne oo1 - lda v_bspeed +xtracks03sub1 cpx #TRACKS-1 + bne oo1 + lda v_bspeed - sta v_speed - sta v_aspeed - jmp InitOfNewSetInstrumentsOnly + sta v_speed + sta v_aspeed + jmp InitOfNewSetInstrumentsOnly oo2 - cmp #63 - beq oo63 - lda reg1 - and #$c0 - beq oo62_b - asl @ - rol @ - rol @ - sta trackn_pause,x - jmp oo1x + cmp #63 + beq oo63 + lda reg1 + and #$c0 + beq oo62_b + asl @ + rol @ + rol @ + sta trackn_pause,x + jmp oo1x oo62_b - iny - lda (ns),y - sta trackn_pause,x - inc trackn_idx,x - jmp oo1x + iny + lda (ns),y + sta trackn_pause,x + inc trackn_idx,x + jmp oo1x oo63 - lda reg1 - bmi oo63_1X - iny - lda (ns),y - sta v_bspeed - inc trackn_idx,x - jmp oo1i + lda reg1 + bmi oo63_1X + iny + lda (ns),y + sta v_bspeed + inc trackn_idx,x + jmp oo1i oo63_1X - cmp #255 - beq oo63_11 - iny - lda (ns),y - sta trackn_idx,x - jmp oo1i + cmp #255 + beq oo63_11 + iny + lda (ns),y + sta trackn_idx,x + jmp oo1i oo63_11 - jmp GetSongLine -p2xrmtp3 jmp rmt_p3 + jmp GetSongLine +p2xrmtp3 jmp rmt_p3 p2x0 dex - bmi p2xrmtp3 + bmi p2xrmtp3 InitOfNewSetInstrumentsOnly p2x1 ldy trackn_instrx2,x - bmi p2x0 - jsr SetUpInstrumentY2 - jmp p2x0 + bmi p2x0 + jsr SetUpInstrumentY2 + jmp p2x0 rmt_sfx - sta trackn_note,x - lda RMTSFXVOLUME ;* sfx note volume*16 - ;* label for sfx note volume parameter overwriting - sta trackn_volume,x + sta trackn_note,x + lda RMTSFXVOLUME ;* sfx note volume*16 + ;* label for sfx note volume parameter overwriting + sta trackn_volume,x SetUpInstrumentY2 - lda (p_instrstable),y - sta trackn_instrdb,x - sta nt - iny - lda (p_instrstable),y - sta trackn_instrhb,x - sta nt+1 - lda #1 - sta trackn_filter,x - tay - lda (nt),y - sta trackn_tablelop,x - iny - lda (nt),y - sta trackn_instrlen,x - iny - lda (nt),y - sta trackn_instrlop,x - iny - lda (nt),y - sta trackn_tabletypespeed,x - sta trackn_tablespeeda,x - iny - lda (nt),y - sta trackn_audctl,x - iny - lda (nt),y - sta trackn_volumeslidedepth,x - ldy #8 - lda (nt),y - sta trackn_effdelay,x - iny - lda (nt),y - tay - lda vibtabbeg,y - sta trackn_effvibratoa,x - ldy #10 - lda (nt),y - sta trackn_effshift,x - lda #128 - sta trackn_volumeslidevalue,x - sta trackn_instrx2,x - asl @ - sta trackn_instrreachend,x - sta trackn_shiftfrq,x - tay - lda (nt),y - sta trackn_tableend,x - adc #0 - sta trackn_instridx,x - lda #INSTRPAR - sta trackn_tablea,x - tay - lda (nt),y - sta trackn_tablenote,x + lda (p_instrstable),y + sta trackn_instrdb,x + sta nt + iny + lda (p_instrstable),y + sta trackn_instrhb,x + sta nt+1 + lda #1 + sta trackn_filter,x + tay + lda (nt),y + sta trackn_tablelop,x + iny + lda (nt),y + sta trackn_instrlen,x + iny + lda (nt),y + sta trackn_instrlop,x + iny + lda (nt),y + sta trackn_tabletypespeed,x + sta trackn_tablespeeda,x + iny + lda (nt),y + sta trackn_audctl,x + iny + lda (nt),y + sta trackn_volumeslidedepth,x + ldy #8 + lda (nt),y + sta trackn_effdelay,x + iny + lda (nt),y + tay + lda vibtabbeg,y + sta trackn_effvibratoa,x + ldy #10 + lda (nt),y + sta trackn_effshift,x + lda #128 + sta trackn_volumeslidevalue,x + sta trackn_instrx2,x + asl @ + sta trackn_instrreachend,x + sta trackn_shiftfrq,x + tay + lda (nt),y + sta trackn_tableend,x + adc #0 + sta trackn_instridx,x + lda #INSTRPAR + sta trackn_tablea,x + tay + lda (nt),y + sta trackn_tablenote,x xata_rtshere - rts + rts rmt_play rmt_p0 - jsr SetPokey + jsr SetPokey rmt_p1 rmt_p2 - dec v_aspeed - bne rmt_p3 - inc v_abeat - lda v_abeat + dec v_aspeed + bne rmt_p3 + inc v_abeat + lda v_abeat - cmp v_maxtracklen + cmp v_maxtracklen - beq p2o3 - jmp GetTrackLine + beq p2o3 + jmp GetTrackLine p2o3 - jmp GetSongLineTrackLineInitOfNewSetInstrumentsOnlyRmtp3 -go_ppnext jmp ppnext + jmp GetSongLineTrackLineInitOfNewSetInstrumentsOnlyRmtp3 +go_ppnext jmp ppnext rmt_p3 - lda #>frqtab - sta nr+1 -xtracks05sub1 ldx #TRACKS-1 + lda #>frqtab + sta nr+1 +xtracks05sub1 ldx #TRACKS-1 pp1 - lda trackn_instrhb,x - beq go_ppnext - sta ns+1 - lda trackn_instrdb,x - sta ns - ldy trackn_instridx,x - lda (ns),y - sta reg1 - iny - lda (ns),y - sta reg2 - iny - lda (ns),y - sta reg3 - iny - tya - cmp trackn_instrlen,x - bcc pp2 - beq pp2 - lda #$80 - sta trackn_instrreachend,x + lda trackn_instrhb,x + beq go_ppnext + sta ns+1 + lda trackn_instrdb,x + sta ns + ldy trackn_instridx,x + lda (ns),y + sta reg1 + iny + lda (ns),y + sta reg2 + iny + lda (ns),y + sta reg3 + iny + tya + cmp trackn_instrlen,x + bcc pp2 + beq pp2 + lda #$80 + sta trackn_instrreachend,x pp1b - lda trackn_instrlop,x -pp2 sta trackn_instridx,x - lda reg1 - and #$0f - ora trackn_volume,x - tay - lda volumetab,y - sta tmp - lda reg2 - and #$0e - tay - lda tabbeganddistor,y - sta nr - lda tmp - ora tabbeganddistor+1,y - sta trackn_audc,x + lda trackn_instrlop,x +pp2 sta trackn_instridx,x + lda reg1 + and #$0f + ora trackn_volume,x + tay + lda volumetab,y + sta tmp + lda reg2 + and #$0e + tay + lda tabbeganddistor,y + sta nr + lda tmp + ora tabbeganddistor+1,y + sta trackn_audc,x InstrumentsEffects - lda trackn_effdelay,x - beq ei2 - cmp #1 - bne ei1 - lda trackn_shiftfrq,x - clc - adc trackn_effshift,x - clc - ldy trackn_effvibratoa,x - adc vib0,y - sta trackn_shiftfrq,x - lda vibtabnext,y - sta trackn_effvibratoa,x - jmp ei2 + lda trackn_effdelay,x + beq ei2 + cmp #1 + bne ei1 + lda trackn_shiftfrq,x + clc + adc trackn_effshift,x + clc + ldy trackn_effvibratoa,x + adc vib0,y + sta trackn_shiftfrq,x + lda vibtabnext,y + sta trackn_effvibratoa,x + jmp ei2 ei1 - dec trackn_effdelay,x + dec trackn_effdelay,x ei2 - ldy trackn_tableend,x - cpy #INSTRPAR+1 - bcc ei3 - lda trackn_tablespeeda,x - bpl ei2f + ldy trackn_tableend,x + cpy #INSTRPAR+1 + bcc ei3 + lda trackn_tablespeeda,x + bpl ei2f ei2c - tya - cmp trackn_tablea,x - bne ei2c2 - lda trackn_tablelop,x - sta trackn_tablea,x - bne ei2a + tya + cmp trackn_tablea,x + bne ei2c2 + lda trackn_tablelop,x + sta trackn_tablea,x + bne ei2a ei2c2 - inc trackn_tablea,x + inc trackn_tablea,x ei2a - lda trackn_instrdb,x - sta nt - lda trackn_instrhb,x - sta nt+1 - ldy trackn_tablea,x - lda (nt),y - sta trackn_tablenote,x - lda trackn_tabletypespeed,x + lda trackn_instrdb,x + sta nt + lda trackn_instrhb,x + sta nt+1 + ldy trackn_tablea,x + lda (nt),y + sta trackn_tablenote,x + lda trackn_tabletypespeed,x ei2f - sec - sbc #1 - sta trackn_tablespeeda,x + sec + sbc #1 + sta trackn_tablespeeda,x ei3 - lda trackn_instrreachend,x - bpl ei4 - lda trackn_volume,x - beq ei4 - tay - lda trackn_volumeslidevalue,x - clc - adc trackn_volumeslidedepth,x - sta trackn_volumeslidevalue,x - bcc ei4 - tya - sbc #16 - sta trackn_volume,x + lda trackn_instrreachend,x + bpl ei4 + lda trackn_volume,x + beq ei4 + tay + lda trackn_volumeslidevalue,x + clc + adc trackn_volumeslidedepth,x + sta trackn_volumeslidevalue,x + bcc ei4 + tya + sbc #16 + sta trackn_volume,x ei4 - lda reg2 - sta trackn_command,x - and #$70 - beq cmd0 + lda reg2 + sta trackn_command,x + and #$70 + beq cmd0 cmd1 - lda reg3 - jmp cmd0c + lda reg3 + jmp cmd0c cmd2 cmd3 cmd4 @@ -548,101 +548,101 @@ cmd5 cmd6 cmd7 cmd0 - lda trackn_note,x - clc - adc reg3 + lda trackn_note,x + clc + adc reg3 cmd0a - clc - adc trackn_tablenote,x - cmp #61 - bcc cmd0a1 - lda #0 - sta trackn_audc,x - lda #63 + clc + adc trackn_tablenote,x + cmp #61 + bcc cmd0a1 + lda #0 + sta trackn_audc,x + lda #63 cmd0a1 - tay - lda (nr),y - clc - adc trackn_shiftfrq,x + tay + lda (nr),y + clc + adc trackn_shiftfrq,x cmd0c - sta trackn_audf,x + sta trackn_audf,x pp9 ppnext - dex - bmi rmt_p4 - jmp pp1 + dex + bmi rmt_p4 + jmp pp1 rmt_p4 - lda trackn_audctl+0 - ora trackn_audctl+1 - ora trackn_audctl+2 - ora trackn_audctl+3 - tax + lda trackn_audctl+0 + ora trackn_audctl+1 + ora trackn_audctl+2 + ora trackn_audctl+3 + tax qq1 - stx v_audctl - lda trackn_command+0 - bpl qq2 - lda trackn_audc+0 - and #$0f - beq qq2 - lda trackn_audf+0 - clc - adc trackn_filter+0 - sta trackn_audf+2 - lda #0 - sta trackn_audc+2 + stx v_audctl + lda trackn_command+0 + bpl qq2 + lda trackn_audc+0 + and #$0f + beq qq2 + lda trackn_audf+0 + clc + adc trackn_filter+0 + sta trackn_audf+2 + lda #0 + sta trackn_audc+2 qq1a - txa - ora #4 - tax + txa + ora #4 + tax qq2 - lda trackn_command+1 - bpl qq3 - lda trackn_audc+1 - and #$0f - beq qq3 - lda trackn_audf+1 - clc - adc trackn_filter+1 - sta trackn_audf+3 - lda #0 - sta trackn_audc+3 + lda trackn_command+1 + bpl qq3 + lda trackn_audc+1 + and #$0f + beq qq3 + lda trackn_audf+1 + clc + adc trackn_filter+1 + sta trackn_audf+3 + lda #0 + sta trackn_audc+3 qq2a - txa - ora #2 - tax + txa + ora #2 + tax qq3 - cpx v_audctl - bne qq5 + cpx v_audctl + bne qq5 qq5 - stx v_audctl + stx v_audctl rmt_p5 -; lda v_ainstrspeed +; lda v_ainstrspeed .IF TARGET = 800 - ldx #$10 ; pseudo stereo - bne SetPokey_OffsetX ; pseudo stereo + ldx #$10 ; pseudo stereo + bne SetPokey_OffsetX ; pseudo stereo .ELSE - rts + rts .ENDIF SetPokey - ldx #0 ; POKEY registers offset (for stereo) + ldx #0 ; POKEY registers offset (for stereo) SetPokey_OffsetX - lda trackn_audf+0 - sta AUDF1,x - lda trackn_audc+0 - sta AUDC1,x - lda trackn_audf+1 - sta AUDF2,x - lda trackn_audc+1 - sta AUDC2,x - lda trackn_audf+2 - sta AUDF3,x - lda trackn_audc+2 - sta AUDC3,x - lda trackn_audf+3 - sta AUDF4,x - lda trackn_audc+3 - sta AUDC4,x - lda v_audctl - sta AUDCTL,x - rts + lda trackn_audf+0 + sta AUDF1,x + lda trackn_audc+0 + sta AUDC1,x + lda trackn_audf+1 + sta AUDF2,x + lda trackn_audc+1 + sta AUDC2,x + lda trackn_audf+2 + sta AUDF3,x + lda trackn_audc+2 + sta AUDC3,x + lda trackn_audf+3 + sta AUDF4,x + lda trackn_audc+3 + sta AUDC4,x + lda v_audctl + sta AUDCTL,x + rts RMTPLAYEREND diff --git a/artwork/splash_v2/lzss_player.asm b/artwork/splash_v2/lzss_player.asm index 6a0bdfd..f3c6eff 100644 --- a/artwork/splash_v2/lzss_player.asm +++ b/artwork/splash_v2/lzss_player.asm @@ -6,8 +6,8 @@ song_end buffers .ds 256 * 9 - -POKEY2 = POKEY+$10 ; stereo + +POKEY2 = POKEY+$10 ; stereo ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Song Initialization - this runs in the first tick: @@ -15,9 +15,9 @@ POKEY2 = POKEY+$10 ; stereo .proc init_song ; pokeys init - lda #3 ; stereo - sta POKEY+$0f ; stereo - sta POKEY2+$0f ; stereo + lda #3 ; stereo + sta POKEY+$0f ; stereo + sta POKEY2+$0f ; stereo mva #1 bit_data @@ -32,8 +32,8 @@ clear ; Read just init value and store into buffer and POKEY jsr get_byte sta POKEY, x - sta POKEY2,x ; stereo - sta stereo_buff,x ; stereo + sta POKEY2,x ; stereo + sta stereo_buff,x ; stereo sty chn_copy, x cbuf sta buffers + 255 @@ -62,12 +62,12 @@ delay ; Play one frame of the song ; .proc play_frame - ldx #8 ; stereo -@ lda stereo_buff,x ; stereo - sta POKEY2,x ; stereo - dex ;stereo - bpl @- ; stereo - + ldx #8 ; stereo +@ lda stereo_buff,x ; stereo + sta POKEY2,x ; stereo + dex ;stereo + bpl @- ; stereo + lda #>buffers sta bptr+1 @@ -110,7 +110,7 @@ do_copy_byte: store: ldy cur_pos sta POKEY,x ; Store to output and buffer - sta stereo_buff,x ; stereo + sta stereo_buff,x ; stereo sta (bptr), y skip_chn: @@ -148,6 +148,6 @@ skip rts .endp -stereo_buff ; stereo - .ds 9 ; stereo - \ No newline at end of file +stereo_buff ; stereo + .ds 9 ; stereo + \ No newline at end of file diff --git a/artwork/splash_v2/splash.asm b/artwork/splash_v2/splash.asm index 2a0edba..5b4f552 100644 --- a/artwork/splash_v2/splash.asm +++ b/artwork/splash_v2/splash.asm @@ -3,8 +3,8 @@ /* Mode: GED- (bitmap mode) */ /***************************************/ - icl "splash.h" - + icl "splash.h" + ; --- dmsc LZSS player routine on zero page org $80 @@ -17,172 +17,172 @@ chn_bits .ds 1 bit_data .ds 1 ; --- - org $00 + org $00 -fcnt .ds 2 -fadr .ds 2 -fhlp .ds 2 -cloc .ds 1 -regA .ds 1 -regX .ds 1 -regY .ds 1 -byt2 .ds 1 +fcnt .ds 2 +fadr .ds 2 +fhlp .ds 2 +cloc .ds 1 +regA .ds 1 +regX .ds 1 +regY .ds 1 +byt2 .ds 1 -zc .ds ZCOLORS +zc .ds ZCOLORS -* --- BASIC switch OFF - org $2000\ mva #$ff portb\ rts\ ini $2000 +* --- BASIC switch OFF + org $2000\ mva #$ff portb\ rts\ ini $2000 -* --- MAIN PROGRAM - org $2010 - IFT PIC_HEIGHT>=204 -scr ins "output.png.mic", 0, 8160 - :16 .byte 0 - ins "output.png.mic" , +8160 - ELS -scr ins "output.png.mic" - EIF +* --- MAIN PROGRAM + org $2010 + IFT PIC_HEIGHT>=204 +scr ins "output.png.mic", 0, 8160 + :16 .byte 0 + ins "output.png.mic" , +8160 + ELS +scr ins "output.png.mic" + EIF - .ifdef nil_used -nil :8*40 brk - eif + .ifdef nil_used +nil :8*40 brk + eif - .ALIGN $0400 -ant ANTIC_PROGRAM scr,ant + .ALIGN $0400 +ant ANTIC_PROGRAM scr,ant fnt - ift USESPRITES - .ALIGN $0800 - .ds $0300 -pmg SPRITES - eif - + ift USESPRITES + .ALIGN $0800 + .ds $0300 +pmg SPRITES + eif + FontSplash ins '../../artwork/weapons_AW6_mod.fnt' ; 'artwork/weapons.fnt' mother -; dta d" The Mother of All Games " - dta d" Father Unknown of All Games " - icl "lzss_player.asm" ; player (and data) for splash music +; dta d" The Mother of All Games " + dta d" Father Unknown of All Games " + icl "lzss_player.asm" ; player (and data) for splash music main jsr init_song -* --- init PMG +* --- init PMG - ift USESPRITES - mva >pmg pmbase ;missiles and players data address - mva #$03 pmcntl ;enable players and missiles - eif + ift USESPRITES + mva >pmg pmbase ;missiles and players data address + mva #$03 pmcntl ;enable players and missiles + eif - lda:cmp:req $14 ;wait 1 frame + lda:cmp:req $14 ;wait 1 frame - sei ;stop interrups - mva #$00 nmien ;stop all interrupts - mva #$fe portb ;switch off ROM to get 16k more ram + sei ;stop interrups + mva #$00 nmien ;stop all interrupts + mva #$fe portb ;switch off ROM to get 16k more ram - ZPINIT + ZPINIT //////////////////// // RASTER PROGRAM // //////////////////// -; jmp line239 - jmp raster_program_end +; jmp line239 + jmp raster_program_end -LOOP lda vcount ;synchronization for the first screen (picture) line - cmp #$02 - ;sta colpf0 - ;sta colpm0 - ;sta colbak - bne LOOP +LOOP lda vcount ;synchronization for the first screen (picture) line + cmp #$02 + ;sta colpf0 + ;sta colpm0 + ;sta colbak + bne LOOP - mva #%00111110 dmactl ;set new screen width - mva ant dlptr+1 + mva #%00111110 dmactl ;set new screen width + mva ant dlptr+1 icl "output.png.rp.ini" - + ;--- 16 lines down ---- !!! - :16 sta wsync - - ; wait 13 cycles !!! - :4 nop - inc byt2 - + :16 sta wsync + + ; wait 13 cycles !!! + :4 nop + inc byt2 + ;--- wait 18 cycles -; jsr _rts -; inc byt3 +; jsr _rts +; inc byt3 ;--- set global offset (23 cycles) - jsr _rts - cmp byt3\ pha:pla + jsr _rts + cmp byt3\ pha:pla ;--- empty line - jsr wait54cycle - inc byt2 + jsr wait54cycle + inc byt2 icl "output.png.rp" raster_program_end - lda >FontSplash - sta chbase -c0 lda #$00 - sta colbak -c1 lda #$00 - sta colpf0 -c2 lda #$02 - sta colpf1 -c3 lda #$08 - sta colpf2 -c4 lda #$00 - sta colpf3 -s0 lda #$03 - sta sizep0 - sta sizep1 - sta sizep2 - sta sizep3 - mva #$ff sizem - sta grafm - mva #$20 hposm0 - mva #$28 hposm1 - mva #$d0 hposm2 - mva #$d8 hposm3 - mva #$02 pmcntl - lda #$14 - sta gtictl + lda >FontSplash + sta chbase +c0 lda #$00 + sta colbak +c1 lda #$00 + sta colpf0 +c2 lda #$02 + sta colpf1 +c3 lda #$08 + sta colpf2 +c4 lda #$00 + sta colpf3 +s0 lda #$03 + sta sizep0 + sta sizep1 + sta sizep2 + sta sizep3 + mva #$ff sizem + sta grafm + mva #$20 hposm0 + mva #$28 hposm1 + mva #$d0 hposm2 + mva #$d8 hposm3 + mva #$02 pmcntl + lda #$14 + sta gtictl //-------------------- -// EXIT +// EXIT //-------------------- - lda trig0 ; FIRE #0 - beq stop + lda trig0 ; FIRE #0 + beq stop - lda trig1 ; FIRE #1 - beq stop + lda trig1 ; FIRE #1 + beq stop - lda consol ; START - and #1 - beq stop + lda consol ; START + and #1 + beq stop - lda skctl ; ANY KEY - and #$04 - bne skp + lda skctl ; ANY KEY + and #$04 + bne skp -stop mva #$00 pmcntl ;PMG disabled - tax - sta:rne hposp0,x+ +stop mva #$00 pmcntl ;PMG disabled + tax + sta:rne hposp0,x+ - ; silent - lda #0 + ; silent + lda #0 ldx #8 @ sta POKEY,x - sta POKEY2,x ; stereo + sta POKEY2,x ; stereo dex bpl @- @@ -192,90 +192,90 @@ stop mva #$00 pmcntl ;PMG disabled sta $022F ;dmactls - mva #$ff portb ;ROM switch on - mva #$40 nmien ;only NMI interrupts, DLI disabled - cli ;IRQ enabled + mva #$ff portb ;ROM switch on + mva #$40 nmien ;only NMI interrupts, DLI disabled + cli ;IRQ enabled - rts ;return to ... DOS + rts ;return to ... DOS skp //-------------------- jsr play_frame - jmp LOOP + jmp LOOP ;--- wait54cycle - :2 inc byt2 + :2 inc byt2 wait44cycle - inc byt3 - nop + inc byt3 + nop wait36cycle - inc byt3 - jsr _rts + inc byt3 + jsr _rts wait18cycle - inc byt3 -_rts rts + inc byt3 +_rts rts -byt3 brk +byt3 brk ;--- -.MACRO ANTIC_PROGRAM - dta $70,$70 - :+8 dta $4e,a(:1+$0000+#*40) - :+8 dta $4e,a(:1+$0140+#*40) - :+8 dta $4e,a(:1+$0280+#*40) - :+8 dta $4e,a(:1+$03C0+#*40) - :+8 dta $4e,a(:1+$0500+#*40) - :+8 dta $4e,a(:1+$0640+#*40) - :+8 dta $4e,a(:1+$0780+#*40) - :+8 dta $4e,a(:1+$08C0+#*40) - :+8 dta $4e,a(:1+$0A00+#*40) - :+8 dta $4e,a(:1+$0B40+#*40) - :+8 dta $4e,a(:1+$0C80+#*40) - :+8 dta $4e,a(:1+$0DC0+#*40) - :+8 dta $4e,a(:1+$0F00+#*40) - :+8 dta $4e,a(:1+$1040+#*40) - :+8 dta $4e,a(:1+$1180+#*40) - :+8 dta $4e,a(:1+$12C0+#*40) - :+8 dta $4e,a(:1+$1400+#*40) - :+8 dta $4e,a(:1+$1540+#*40) - :+8 dta $4e,a(:1+$1680+#*40) - :+8 dta $4e,a(:1+$17C0+#*40) - :+8 dta $4e,a(:1+$1900+#*40) - :+8 dta $4e,a(:1+$1A40+#*40) - :+8 dta $4e,a(:1+$1B80+#*40) - :+8 dta $4e,a(:1+$1CC0+#*40) - :+8 dta $4e,a(:1+$1E00+#*40) -; :+4 dta $4e,a(:1+$1F40+#*40) -; :+4 dta $4e,a(:1+$1FF0+#*40) -; :+8 dta $4e,a(:1+$2090+#*40) -; :+8 dta $4e,a(:1+$21D0+#*40) -; :+8 dta $4e,a(:1+$2310+#*40) -; :+8 dta $4e,a(:1+$2450+#*40) - dta $00 - dta $42,a(mother) - dta $41,a(:2) +.MACRO ANTIC_PROGRAM + dta $70,$70 + :+8 dta $4e,a(:1+$0000+#*40) + :+8 dta $4e,a(:1+$0140+#*40) + :+8 dta $4e,a(:1+$0280+#*40) + :+8 dta $4e,a(:1+$03C0+#*40) + :+8 dta $4e,a(:1+$0500+#*40) + :+8 dta $4e,a(:1+$0640+#*40) + :+8 dta $4e,a(:1+$0780+#*40) + :+8 dta $4e,a(:1+$08C0+#*40) + :+8 dta $4e,a(:1+$0A00+#*40) + :+8 dta $4e,a(:1+$0B40+#*40) + :+8 dta $4e,a(:1+$0C80+#*40) + :+8 dta $4e,a(:1+$0DC0+#*40) + :+8 dta $4e,a(:1+$0F00+#*40) + :+8 dta $4e,a(:1+$1040+#*40) + :+8 dta $4e,a(:1+$1180+#*40) + :+8 dta $4e,a(:1+$12C0+#*40) + :+8 dta $4e,a(:1+$1400+#*40) + :+8 dta $4e,a(:1+$1540+#*40) + :+8 dta $4e,a(:1+$1680+#*40) + :+8 dta $4e,a(:1+$17C0+#*40) + :+8 dta $4e,a(:1+$1900+#*40) + :+8 dta $4e,a(:1+$1A40+#*40) + :+8 dta $4e,a(:1+$1B80+#*40) + :+8 dta $4e,a(:1+$1CC0+#*40) + :+8 dta $4e,a(:1+$1E00+#*40) +; :+4 dta $4e,a(:1+$1F40+#*40) +; :+4 dta $4e,a(:1+$1FF0+#*40) +; :+8 dta $4e,a(:1+$2090+#*40) +; :+8 dta $4e,a(:1+$21D0+#*40) +; :+8 dta $4e,a(:1+$2310+#*40) +; :+8 dta $4e,a(:1+$2450+#*40) + dta $00 + dta $42,a(mother) + dta $41,a(:2) .ENDM CL -.MACRO ZPINIT +.MACRO ZPINIT .ENDM -ZCOLORS = 0 +ZCOLORS = 0 ;--- - ini main + ini main ;--- - opt l- + opt l- -.MACRO SPRITES - icl "output.png.pmg" +.MACRO SPRITES + icl "output.png.pmg" .ENDM USESPRITES = 1 diff --git a/constants.asm b/constants.asm index 4ec1a8f..f1b7ca4 100644 --- a/constants.asm +++ b/constants.asm @@ -32,18 +32,18 @@ LevelNameBeginH .by >(NamesOfLevels+64),>(NamesOfLevels+74),>(NamesOfLevels+84) ;-------------- TanksWeaponsTableL - .REPT MaxPlayers, #+1 - .by TanksWeapon:1 - .ENDR + .REPT MaxPlayers, #+1 + .by >TanksWeapon:1 + .ENDR ;-------------- XtankOffsetGO_L - .by 6,56,106,156,206,0 + .by 6,56,106,156,206,0 XtankOffsetGO_H - .by 0,0,0,0,0,1 + .by 0,0,0,0,0,1 ;-----4x4 texts----- LineTop dta d"(%%%%%%%%%%%%)" @@ -59,7 +59,12 @@ LineGameOver seppukuText dta d"# SEPPUKU! #" areYouSureText - dta d"# SURE? Y/N #" + .IF target != 5200 + dta d"# SURE? Y/N #" + .ELSE + dta d"#END? Y-1/N-0#" + .ENDIF + lineClear dta d" " @@ -68,17 +73,17 @@ TankColoursTable .BYTE $58,$2a,$96,$ca,$7a,$ed TankStatusColoursTable .BYTE $74,$c4,$24,$e4,$54,$94 ; Adam's order ;----------- GradientAddrL - .by dliColorsFore, >dliColorsFore, >dliColorsFore2 -dliColorsFore2 ; colors for NTSC - .by $0a ; one mountains color - .by $7a,$7a,$7a,$6a,$6a,$5a,$5a,$4a,$4a,$3a - .by $3a,$1a,$1a,$ea,$ea,$d8,$d8,$b8,$b8,$b8 -dliColorsFore2PAL ; colors for PAL - .by $0a ; one mountains color - .by $7a,$7a,$7a,$6a,$6a,$5a,$5a,$4a,$4a,$3a - .by $3a,$1a,$1a,$ea,$ea,$c8,$c8,$a8,$a8,$a8 + .by >dliColorsFore, >dliColorsFore, >dliColorsFore2 +dliColorsFore2 ; colors for NTSC + .by $0a ; one mountains color + .by $7a,$7a,$7a,$6a,$6a,$5a,$5a,$4a,$4a,$3a + .by $3a,$1a,$1a,$ea,$ea,$d8,$d8,$b8,$b8,$b8 +dliColorsFore2PAL ; colors for PAL + .by $0a ; one mountains color + .by $7a,$7a,$7a,$6a,$6a,$5a,$5a,$4a,$4a,$3a + .by $3a,$1a,$1a,$ea,$ea,$c8,$c8,$a8,$a8,$a8 ;----------- pmtableL ; addressess of the P/M memory for 6 tanks @@ -222,113 +227,114 @@ SlideLeftTableLen = *-SlideLeftTable TanksNamesDefault dta d"1st.Tank" dta d"2nd.Tank" -.REPT MaxPlayers-2, #+3 - dta d":1rd.Tank" + dta d"3rd.Tank" +.REPT MaxPlayers-3, #+4 + dta d":1th.Tank" .ENDR ;------------------------------------------------- -TankShapesTable .BYTE char_tank1___________ - .BYTE char_tank2___________ - .BYTE char_tank3___________ - .BYTE char_tank4___________ -;------------------------------------------------- +TankShapesTable .BYTE char_tank1 + .BYTE char_tank2 + .BYTE char_tank3 + .BYTE char_tank4 +;------------------------------------------------- WeaponPriceH ; weapons prices (tables with prices of weapons) - .by >price_Baby_Missile___ - .by >price_Missile________ - .by >price_Baby_Nuke______ - .by >price_Nuke___________ - .by >price_LeapFrog_______ - .by >price_Funky_Bomb_____ - .by >price_MIRV___________ - .by >price_Death_s_Head___ - .by >price_Napalm_________ - .by >price_Hot_Napalm_____ - .by >price_Tracer_________ - .by >price_Smoke_Tracer___ - .by >price_Baby_Roller____ - .by >price_Roller_________ - .by >price_Heavy_Roller___ - .by >price_Riot_Charge____ - .by >price_Riot_Blast_____ - .by >price_Riot_Bomb______ + .by >price_Baby_Missile + .by >price_Missile + .by >price_Baby_Nuke + .by >price_Nuke + .by >price_LeapFrog + .by >price_Funky_Bomb + .by >price_MIRV + .by >price_Death_s_Head + .by >price_Napalm + .by >price_Hot_Napalm + .by >price_Tracer + .by >price_Smoke_Tracer + .by >price_Baby_Roller + .by >price_Roller + .by >price_Heavy_Roller + .by >price_Riot_Charge + .by >price_Riot_Blast + .by >price_Riot_Bomb .by >price_Heavy_Riot_Bomb - .by >price_Baby_Digger____ - .by >price_Digger_________ - .by >price_Heavy_Digger___ - .by >price_Baby_Sandhog___ - .by >price_Sandhog________ - .by >price_Heavy_Sandhog__ - .by >price_Dirt_Clod______ - .by >price_Dirt_Ball______ - .by >price_Ton_of_Dirt____ - .by >price_Liquid_Dirt____ - .by >price_Dirt_Charge____ - .by >price_Buy_me_________ - .by >price_Laser__________ - .by >price_White_Flag_____ - .by >price_Battery________ - .by >price_Hovercraft_____ - .by >price_Parachute______ + .by >price_Baby_Digger + .by >price_Digger + .by >price_Heavy_Digger + .by >price_Baby_Sandhog + .by >price_Sandhog + .by >price_Heavy_Sandhog + .by >price_Dirt_Clod + .by >price_Dirt_Ball + .by >price_Ton_of_Dirt + .by >price_Liquid_Dirt + .by >price_Dirt_Charge + .by >price_Buy_me + .by >price_Laser + .by >price_White_Flag + .by >price_Battery + .by >price_Hovercraft + .by >price_Parachute .by >price_StrongParachute - .by >price_Mag_Deflector__ - .by >price_Shield_________ - .by >price_Heavy_Shield___ - .by >price_Force_Shield___ - .by >price_Bouncy_Castle__ - .by >price_Long_Barrel____ + .by >price_Mag_Deflector + .by >price_Shield + .by >price_Heavy_Shield + .by >price_Force_Shield + .by >price_Bouncy_Castle + .by >price_Long_Barrel .by >price_Nuclear_Winter_ - .by >price_Lazy_Boy_______ - .by >price_Lazy_Darwin____ - .by >price_Auto_Defense___ - .by >price_Spy_Hard_______ + .by >price_Lazy_Boy + .by >price_Lazy_Darwin + .by >price_Auto_Defense + .by >price_Spy_Hard WeaponPriceL - .by WeaponFont chbas @@ -844,7 +844,7 @@ SetunPlots sta oldplotH,x lda #0 sta oldply,x - lda #$ff + lda #$ff sta oldora,x dex bpl SetunPlots @@ -854,7 +854,7 @@ SetunPlots sta pmbase lda #$03 ; P/M on sta GRACTL - jsr SetPMWidth + jsr SetPMWidth lda #%00100001 ; P/M priorities (multicolor players on) - prior=1 sta GPRIOR jsr PMoutofScreen @@ -878,13 +878,13 @@ MakeTanksVisible ; for all tanks ;-------------------------------------------------- ldx #maxPlayers-1 -@ lda #StandardBarrel ; standard barrel length - sta BarrelLength,x - lda #$00 ; deactivate Auto Defense - sta AutoDefenseFlag,x - dex - bpl @- - rts +@ lda #StandardBarrel ; standard barrel length + sta BarrelLength,x + lda #$00 ; deactivate Auto Defense + sta AutoDefenseFlag,x + dex + bpl @- + rts .endp ;---------------------------------------------- /* .proc RandomizeSequence0 @@ -973,7 +973,7 @@ UsageLoop lda RANDOM and #%00000011 ;(0..1023) sta temp2+1 - + cpw RandBoundaryLow temp2 seq:bcs RandomizeForce @@ -1007,45 +1007,45 @@ LimitForce ;---------------------------------------------- .proc Table2Force ;---------------------------------------------- - lda ForceTableL,x - sta Force - lda ForceTableH,x - sta Force+1 - rts + lda ForceTableL,x + sta Force + lda ForceTableH,x + sta Force+1 + rts .endp ;---------------------------------------------- .proc MoveBarrelToNewPosition ;---------------------------------------------- - mva #1 Erase - jsr DrawTankNr.BarrelChange - mva #0 Erase + mva #1 Erase + jsr DrawTankNr.BarrelChange + mva #0 Erase MoveBarrel mva #sfx_set_power_2 sfx_effect - jsr DrawTankNr - jsr DisplayStatus.displayAngle - ; - jsr CheckExitKeys + jsr DrawTankNr + jsr DisplayStatus.displayAngle + ; + jsr CheckExitKeys spl:rts ;---Exit key pressed-quit game--- - ldx TankNr - ; - mva #1 Erase - jsr WaitOneFrame - jsr DrawTankNr.BarrelChange - mva #0 Erase - lda NewAngle - cmp AngleTable,x - beq BarrelPositionIsFine - bcc rotateLeft -rotateRight ; older is lower - inc angleTable,x - jmp MoveBarrel -rotateLeft ; older is bigger - dec angleTable,x - jmp MoveBarrel + ldx TankNr + ; + mva #1 Erase + jsr WaitOneFrame + jsr DrawTankNr.BarrelChange + mva #0 Erase + lda NewAngle + cmp AngleTable,x + beq BarrelPositionIsFine + bcc rotateLeft +rotateRight ; older is lower + inc angleTable,x + jmp MoveBarrel +rotateLeft ; older is bigger + dec angleTable,x + jmp MoveBarrel BarrelPositionIsFine - jsr DrawTankNr - rts - + jsr DrawTankNr + rts + .endp ;---------------------------------------------- @@ -1091,39 +1091,39 @@ SequenceStart Bubble ldx #0 ;i=x stx temp2 ; sortflag=temp2 - inx ; because NumberOfPlayers start from 1 (not 0) + inx ; because NumberOfPlayers start from 1 (not 0) BubbleBobble - ldy TankSequence-1,x ; x count from 1 to NumberOfPlayers (we need cout from 0 to NumberOfPlayers-1) - lda ResultsTable,y - ldy TankSequence,x - cmp ResultsTable,y + ldy TankSequence-1,x ; x count from 1 to NumberOfPlayers (we need cout from 0 to NumberOfPlayers-1) + lda ResultsTable,y + ldy TankSequence,x + cmp ResultsTable,y bcc nextishigher - bne swapvalues + bne swapvalues nextisequal - ; if results are equal, check Direct Hits - ldy TankSequence-1,x - lda DirectHits,y - ldy TankSequence,x - cmp DirectHits,y + ; if results are equal, check Direct Hits + ldy TankSequence-1,x + lda DirectHits,y + ldy TankSequence,x + cmp DirectHits,y bcc nextishigher - bne swapvalues + bne swapvalues nextisequal2 - ; if results are equal, check money (H) - ldy TankSequence-1,x - lda EarnedMoneyH,y - ldy TankSequence,x - cmp EarnedMoneyH,y + ; if results are equal, check money (H) + ldy TankSequence-1,x + lda EarnedMoneyH,y + ldy TankSequence,x + cmp EarnedMoneyH,y bcc nextishigher - bne swapvalues + bne swapvalues nextisequal2b - ; if results are equal, check money (L) - ldy TankSequence-1,x - lda EarnedMoneyL,y - ldy TankSequence,x - cmp EarnedMoneyL,y - ; - beq nextishigher ; this is to block hangs when 2 equal values meet + ; if results are equal, check money (L) + ldy TankSequence-1,x + lda EarnedMoneyL,y + ldy TankSequence,x + cmp EarnedMoneyL,y + ; + beq nextishigher ; this is to block hangs when 2 equal values meet bcc nextishigher ;here we must swap values ;because next is smaller than previous @@ -1149,20 +1149,20 @@ nextishigher ;-------------------------------------------------- .proc SetWallsType ;-------------------------------------------------- - mva #0 WallsType - lda OptionsTable+8 - cmp #4 - beq SetRandomWalls - lsr - ror WallsType - lsr - ror WallsType - rts + mva #0 WallsType + lda OptionsTable+8 + cmp #4 + beq SetRandomWalls + lsr + ror WallsType + lsr + ror WallsType + rts SetRandomWalls - lda random - and #%11000000 - sta WallsType - rts + lda random + and #%11000000 + sta WallsType + rts .endp ; -------------------------------------- ; Sets the appropriate variables based on the options table @@ -1321,7 +1321,7 @@ ResultOfTheNextPlayer ; overwrite the second digit of the points (max 255) ;it means ":" mva #26 ResultLineBuffer+9 - + ldx #0 lda TankNr asl @@ -1337,7 +1337,7 @@ TankNameCopyLoop iny cpx #8 ; end of name bne TankNameCopyLoop - ; last letter of tank name overwrites first digit of the points (max 255) + ; last letter of tank name overwrites first digit of the points (max 255) ;just after the digits diff --git a/grafproc.asm b/grafproc.asm index 0c310d1..f1351bc 100644 --- a/grafproc.asm +++ b/grafproc.asm @@ -1,4 +1,4 @@ -; @com.wudsn.ide.asm.mainsourcefile=scorch.asm +; @com.wudsn.ide.asm.mainsourcefile=scorch.asm .IF *>0 ;this is a trick that prevents compiling this file alone @@ -142,10 +142,10 @@ LineParametersReady ora DX+1 ora DY ora DY+1 - bne NotOnePoint - ; length=0 - sta LineLength - sta LineLength+1 + bne NotOnePoint + ; length=0 + sta LineLength + sta LineLength+1 jmp EndOfDraw NotOnePoint @@ -226,8 +226,8 @@ PutPixelinDraw bit drawFunction bpl @+ inw LineLength - bit Vdebug - bmi MeasureVisualisation + bit Vdebug + bmi MeasureVisualisation jmp ContinueDraw ; was `bne` - not good, because LineLength starts from $ffff @ bvc @+ @@ -239,7 +239,7 @@ yestrace jsr plot notrace ;aftertrace - ;key + ;key lda HitFlag bne StopHitChecking @@ -252,13 +252,13 @@ CheckCollisionDraw lda HitFlag bne StopHitChecking - clc - lda xdraw - adc #mountaintable - sta temp+1 + clc + lda xdraw + adc #mountaintable + sta temp+1 ldy #0 lda ydraw @@ -266,11 +266,11 @@ CheckCollisionDraw bcc StopHitChecking mwa xdraw XHit - lda (temp),y - sec - sbc #1 - sta YHit - sty YHit+1 + lda (temp),y + sec + sbc #1 + sta YHit + sty YHit+1 mva #$ff HitFlag StopHitChecking jmp ContinueDraw @@ -398,19 +398,19 @@ endcircleloop adc YC sta ydraw sta tempcir - lda ycircle+1 - adc #$00 - sta ydraw+1 - sta tempcir+1 + lda ycircle+1 + adc #$00 + sta ydraw+1 + sta tempcir+1 jsr plot sec lda ycircle sbc YC sta ydraw - lda ycircle+1 - sbc #$00 - sta ydraw+1 + lda ycircle+1 + sbc #$00 + sta ydraw+1 jsr plot sec @@ -424,8 +424,8 @@ endcircleloop lda tempcir sta ydraw - lda tempcir+1 - sta ydraw+1 + lda tempcir+1 + sta ydraw+1 jsr plot ;--- clc @@ -440,19 +440,19 @@ endcircleloop adc xC sta ydraw sta tempcir - lda ycircle+1 - adc #$00 - sta ydraw+1 - sta tempcir+1 + lda ycircle+1 + adc #$00 + sta ydraw+1 + sta tempcir+1 jsr plot sec lda ycircle sbc xC sta ydraw - lda ycircle+1 - sbc #$00 - sta ydraw+1 + lda ycircle+1 + sbc #$00 + sta ydraw+1 jsr plot sec @@ -466,8 +466,8 @@ endcircleloop lda tempcir sta ydraw - lda tempcir+1 - sta ydraw+1 + lda tempcir+1 + sta ydraw+1 jsr plot RTS @@ -495,7 +495,7 @@ endcircleloop mwa #0 temptankX - mva #0 temptankNr ;player number + sta temptankNr ;player number StillRandomize ldx NumberOfPlayers lda random @@ -542,15 +542,15 @@ NotHigherByte02 sec lda xtankstableL,x sbc #$0f - ; and clear lowest bit to be sure that the X coordinate is even - ; (this is to have P/M background look nice) - ; "AND" does not change "Carry" bit. - ; x correction for P/M - ; -- - .IF XCORRECTION_FOR_PM = 1 - and #$fe - .ENDIF - ; -- + ; and clear lowest bit to be sure that the X coordinate is even + ; (this is to have P/M background look nice) + ; "AND" does not change "Carry" bit. + ; x correction for P/M + ; -- + .IF XCORRECTION_FOR_PM = 1 + and #$fe + .ENDIF + ; -- sta xtankstableL,x bcs NotHigherByte01 dec xtankstableH,x @@ -588,8 +588,8 @@ UnequalTanks ;------------------------------------------------- .proc ClearTanks - jsr PMoutofScreen - mva #1 Erase ; erase tanks flag + jsr PMoutofScreen + mva #1 Erase ; erase tanks flag .endp ;-- .proc drawtanks @@ -609,15 +609,15 @@ DrawNextTank pla sta TankNr - mva #0 Erase ; no erase tanks flag + mva #0 Erase ; no erase tanks flag rts .endp ;--------- ClearTankNr - mva #1 Erase - bne DrawTankNr + mva #1 Erase + bne DrawTankNr PutTankNr - mva #0 Erase + mva #0 Erase .proc DrawTankNr ldx tankNr ; let's check the energy @@ -625,35 +625,35 @@ PutTankNr bne SkipHidingPM ; if energy=0 then no tank ; hide P/M - lda TanksPMOrder,x - tax + lda TanksPMOrder,x + tax lda #0 cpx #$4 ; 5th tank is defferent bne No5thTankHide - sta hposp0+4 - sta hposp0+5 - beq @+ + sta hposp0+4 + sta hposp0+5 + beq @+ No5thTankHide - cpx #$5 ; 6th tank is defferent - bne No6thTankHide - sta hposp0+6 - sta hposp0+7 - beq @+ + cpx #$5 ; 6th tank is defferent + bne No6thTankHide + sta hposp0+6 + sta hposp0+7 + beq @+ No6thTankHide sta hposp0,x @ - ldx TankNr + ldx TankNr jmp DoNotDrawTankNr SkipHidingPM - lda TankShape,x - tax - ldy TankShapesTable,x - ldx TankNr + lda TankShape,x + tax + ldy TankShapesTable,x + ldx TankNr lda AngleTable,x - cmp #91 ; left or right tank shape - bcs LeftTank - :2 iny ; right tank + cmp #91 ; left or right tank shape + bcs LeftTank + :2 iny ; right tank LeftTank sty CharCode DrawTankNrX @@ -661,13 +661,13 @@ DrawTankNrX jsr SetupXYdraw jsr TypeChar - lda Erase - jne noTankNoPM + lda Erase + jne noTankNoPM ; now P/M graphics on the screen (only for 5 tanks) ; horizontal position ldx TankNr - lda TanksPMOrder,x - tax + lda TanksPMOrder,x + tax mwa xdraw xbyte rorw xbyte ; divide by 2 (carry does not matter) lda xbyte @@ -677,17 +677,17 @@ DrawTankNrX bne No5thTank clc adc #$04 ; missile offset offset - sta hposp0+4 - sta hposp0+5 - bne NoMissile + sta hposp0+4 + sta hposp0+5 + bne NoMissile No5thTank - cpx #$5 ; 6th tank are joined missiles and offset is defferent - bne Tanks1to4 + cpx #$5 ; 6th tank are joined missiles and offset is defferent + bne Tanks1to4 clc adc #$04 ; missile offset offset - sta hposp0+6 - sta hposp0+7 - bne NoMissile + sta hposp0+6 + sta hposp0+7 + bne NoMissile Tanks1to4 sta hposp0,x @@ -707,81 +707,81 @@ NoMissile cpx #$5 bcs PMForTank6 ; clear sprite and put 3 lines on the tank at the same time - ldx #3 ; three lines of PM + ldx #3 ; three lines of PM ClearPM cpy temp bne ZeroesToGo -@ lda (xbyte),y - and #%11110000 +@ lda (xbyte),y + and #%11110000 ora #%00001111 ; (2 bits set) we set on two pixels in three lines sta (xbyte),y dey - dex - bne @- + dex + bne @- ZeroesToGo lda (xbyte),y - and #%11110000 + and #%11110000 sta (xbyte),y dey bne ClearPM - beq NoPlayerMissile + beq NoPlayerMissile PMForTank6 ; clear sprite and put 3 lines on the tank at the same time - ldx #3 ; three lines of PM + ldx #3 ; three lines of PM ClearPM6 cpy temp bne ZeroesToGo6 -@ lda (xbyte),y - and #%00001111 +@ lda (xbyte),y + and #%00001111 ora #%11110000 ; (2 bits set) we set on two pixels in three lines sta (xbyte),y dey - dex - bne @- + dex + bne @- ZeroesToGo6 lda (xbyte),y - and #%00001111 + and #%00001111 sta (xbyte),y dey bne ClearPM6 NoPlayerMissile noTankNoPM - ldy #$01 - lda Erase - beq @+ - dey -@ sty color - ; draw defensive weapons like shield ( tank number in X ) - ; in xdraw, ydraw we have coordinates left LOWER corner of Tank char + ldy #$01 + lda Erase + beq @+ + dey +@ sty color + ; draw defensive weapons like shield ( tank number in X ) + ; in xdraw, ydraw we have coordinates left LOWER corner of Tank char ldx TankNr - lda ActiveDefenceWeapon,x - cmp #ind_Shield_________ ; one shot shield - beq DrawTankSh - cmp #ind_Force_Shield___ ; shield with energy and parachute - beq DrawTankShieldBold - cmp #ind_Heavy_Shield___ ; shield with energy - beq DrawTankShieldBold - cmp #ind_Bouncy_Castle__ ; Auto Defence - beq DrawTankShieldWihHorns - cmp #ind_Mag_Deflector__ ; Mag Deflector - beq DrawTankShieldWihHorns - cmp #ind_White_Flag_____ ; White Flag - beq DrawTankFlag - bne NoShieldDraw + lda ActiveDefenceWeapon,x + cmp #ind_Shield ; one shot shield + beq DrawTankSh + cmp #ind_Force_Shield ; shield with energy and parachute + beq DrawTankShieldBold + cmp #ind_Heavy_Shield ; shield with energy + beq DrawTankShieldBold + cmp #ind_Bouncy_Castle ; Auto Defence + beq DrawTankShieldWihHorns + cmp #ind_Mag_Deflector ; Mag Deflector + beq DrawTankShieldWihHorns + cmp #ind_White_Flag ; White Flag + beq DrawTankFlag + bne NoShieldDraw DrawTankSh - jsr DrawTankShield - jmp NoShieldDraw + jsr DrawTankShield + jmp NoShieldDraw DrawTankShieldWihHorns - jsr DrawTankShield - jsr DrawTankShieldHorns - jmp NoShieldDraw + jsr DrawTankShield + jsr DrawTankShieldHorns + jmp NoShieldDraw DrawTankShieldBold - jsr DrawTankShield - jsr DrawTankShieldBoldLine - jmp NoShieldDraw + jsr DrawTankShield + jsr DrawTankShieldBoldLine + jmp NoShieldDraw DrawTankFlag - lda #char_flag____________ ; flag symbol + lda #char_flag ; flag symbol sta CharCode lda Ytankstable,x sec @@ -790,41 +790,41 @@ DrawTankFlag jsr TypeChar NoShieldDraw BarrelChange - ldy #$01 - lda Erase - beq @+ - dey -@ sty color - jsr DrawBarrel - ldx TankNr + ldy #$01 + lda Erase + beq @+ + dey +@ sty color + jsr DrawBarrel + ldx TankNr DoNotDrawTankNr - rts + rts .endp ; ------------------------------------- .proc FlashTank ; ------------------------------------- ; number of blinking tank in TankNr - mva #18 fs ; temp, how many times flash the tank + mva #18 fs ; temp, how many times flash the tank tankflash_loop lda CONSOL ; turbo mode - and #%00000001 ; START KEY + and #%00000001 ; START KEY sne:mva #1 fs ; finish it mva #1 Erase - ldx TankNr - jsr DrawTankNr.SkipHidingPM ; it's necessary becouse DrawTankNr skips tanks with no energy ! - ;PAUSE 2 + ldx TankNr + jsr DrawTankNr.SkipHidingPM ; it's necessary becouse DrawTankNr skips tanks with no energy ! + ;PAUSE 2 ldy #1 jsr PauseYFrames mva #0 Erase - ldx TankNr + ldx TankNr jsr DrawTankNr.SkipHidingPM ;PAUSE 2 ldy #1 jsr PauseYFrames dec fs jne tankflash_loop - rts + rts .endp ;-------------------------------------------------- @@ -836,45 +836,45 @@ tankflash_loop ; ; this proc change xdraw, ydraw and temp! ;-------------------------------------------------- - sbw xdraw #$03 ; 3 pixels to left - ; draw left vertical line of shield ( | ) - mva #7 temp ; strange !!! + sbw xdraw #$03 ; 3 pixels to left + ; draw left vertical line of shield ( | ) + mva #7 temp ; strange !!! @ - jsr plot -.nowarn dew ydraw - dec temp - bne @- - ; draw left oblique line of shield ( / ) - mva #3 temp + jsr plot +.nowarn dew ydraw + dec temp + bne @- + ; draw left oblique line of shield ( / ) + mva #3 temp @ - jsr plot -.nowarn dew ydraw - inw xdraw - dec temp - bne @- - ; draw top horizontal line of shield ( _ ) - mva #7 temp + jsr plot +.nowarn dew ydraw + inw xdraw + dec temp + bne @- + ; draw top horizontal line of shield ( _ ) + mva #7 temp @ - jsr plot - inw xdraw - dec temp - bne @- - ; draw right oblique line of shield ( \ ) - mva #3 temp + jsr plot + inw xdraw + dec temp + bne @- + ; draw right oblique line of shield ( \ ) + mva #3 temp @ - jsr plot - inw ydraw - inw xdraw - dec temp - bne @- - ; draw right vertical line of shield ( | ) - mva #7 temp + jsr plot + inw ydraw + inw xdraw + dec temp + bne @- + ; draw right vertical line of shield ( | ) + mva #7 temp @ - jsr plot - inw ydraw - dec temp - bne @- - rts + jsr plot + inw ydraw + dec temp + bne @- + rts .endp ;-------------------------------------------------- .proc DrawTankShieldHorns @@ -882,18 +882,18 @@ tankflash_loop ; this proc draws a little "horns" on shield. ; Symbol of defensive but aggressive :) weapon ;-------------------------------------------------- -.nowarn dew xdraw ; 1 pixel left - sbw ydraw #$0a ; 10 pixels up - jsr plot -.nowarn dew ydraw - inw xdraw - jsr plot - sbw xdraw #$0d ; 13 pixels left - jsr plot - inw xdraw - inw ydraw - jsr plot - rts +.nowarn dew xdraw ; 1 pixel left + sbw ydraw #$0a ; 10 pixels up + jsr plot +.nowarn dew ydraw + inw xdraw + jsr plot + sbw xdraw #$0d ; 13 pixels left + jsr plot + inw xdraw + inw ydraw + jsr plot + rts .endp ;-------------------------------------------------- .proc DrawTankShieldBoldLine @@ -901,34 +901,34 @@ tankflash_loop ; this proc draws bold top on shield. ; Symbol of ablative shield ? :) ;-------------------------------------------------- - sbw xdraw #$04 ; 5 pixels left - sbw ydraw #$0b ; 11 pixels up - ; draw additional top horizontal line of shield ( _ ) - mva #6 temp + sbw xdraw #$04 ; 5 pixels left + sbw ydraw #$0b ; 11 pixels up + ; draw additional top horizontal line of shield ( _ ) + mva #6 temp @ - jsr plot -.nowarn dew xdraw - dec temp - bne @- - rts + jsr plot +.nowarn dew xdraw + dec temp + bne @- + rts .endp ;-------------------------------------------------- .proc DrawTankParachute ;Tank number in X ;-------------------------------------------------- - lda #char_parachute_______ ; parachute symbol + lda #char_parachute ; parachute symbol sta CharCode lda Ytankstable,x - cmp #16 - bcc ToHighToParachute + cmp #16 + bcc ToHighToParachute ;sec sbc #8 sta ydraw jsr SetupXYdraw.X jsr TypeChar ToHighToParachute - ldx TankNr - rts + ldx TankNr + rts .endp ;-------------------------------------------------- @@ -937,47 +937,47 @@ ToHighToParachute ; ; this proc change xdraw, ydraw and temp! ;-------------------------------------------------- - clc - lda Ytankstable,x - adc #2 ; 1 pixel down - sta ydraw - mva #0 ydraw+1 - - clc - lda XtanksTableL,x - adc #2 ; 2 pixels to right - sta xdraw - lda XtanksTableH,x - adc #0 - sta xdraw+1 + clc + lda Ytankstable,x + adc #2 ; 1 pixel down + sta ydraw + mva #0 ydraw+1 + + clc + lda XtanksTableL,x + adc #2 ; 2 pixels to right + sta xdraw + lda XtanksTableH,x + adc #0 + sta xdraw+1 - ; draw first horizontal line - mva #5 temp + ; draw first horizontal line + mva #5 temp @ - jsr plot - inw xdraw - dec temp - bne @- - - sbw xdraw #2 ; 2 pixels left - inw ydraw ; 1 pixel down - - ; draw second horizontal line - mva #3 temp + jsr plot + inw xdraw + dec temp + bne @- + + sbw xdraw #2 ; 2 pixels left + inw ydraw ; 1 pixel down + + ; draw second horizontal line + mva #3 temp @ - jsr plot -.nowarn dew xdraw - dec temp - bne @- + jsr plot +.nowarn dew xdraw + dec temp + bne @- - adw xdraw #2 ; 2 pixels right - inw ydraw ; 1 pixel down + adw xdraw #2 ; 2 pixels right + inw ydraw ; 1 pixel down - ; and last pixel - jsr plot + ; and last pixel + jsr plot - ldx TankNr - rts + ldx TankNr + rts .endp ;-------------------------------------------------- .proc DrawTankEngine @@ -985,63 +985,63 @@ ToHighToParachute ; ; this proc change xdraw, ydraw and temp! ;-------------------------------------------------- - ; one pixel under tank - clc - lda Ytankstable,x - adc #1 - sta ydraw - mva #0 ydraw+1 - lda XtankstableL,x - sta xdraw - lda XtankstableH,x - sta xdraw+1 - ; clear first pixel under tank - mva #0 color - jsr plot - inw xdraw - ; plot 6 random color pixels - mva #6 temp -@ lda Erase - eor #%00000001 - and random - and #%00000001 - sta color - jsr plot - inw xdraw - dec temp - bne @- - ; clear last pixel under tank - mva #0 color - jsr plot - ldx TankNr - rts + ; one pixel under tank + clc + lda Ytankstable,x + adc #1 + sta ydraw + mva #0 ydraw+1 + lda XtankstableL,x + sta xdraw + lda XtankstableH,x + sta xdraw+1 + ; clear first pixel under tank + mva #0 color + jsr plot + inw xdraw + ; plot 6 random color pixels + mva #6 temp +@ lda Erase + eor #%00000001 + and random + and #%00000001 + sta color + jsr plot + inw xdraw + dec temp + bne @- + ; clear last pixel under tank + mva #0 color + jsr plot + ldx TankNr + rts .endp ;-------------------------------------------------- .proc TankFalls; ;-------------------------------------------------- lda #0 - sta PreviousFall ; bit 7 - left, bit 6 - right + sta PreviousFall ; bit 7 - left, bit 6 - right sta EndOfTheFallFlag sta Parachute - mva #2 FallingSoundBit ; another trick for only one sfx initialization in loop + mva #2 FallingSoundBit ; another trick for only one sfx initialization in loop ; let's check if the given tank has got the parachute - ldx TankNr - lda ActiveDefenceWeapon,x - cmp #ind_Parachute______ ; parachute - beq ParachuteActive - cmp #ind_StrongParachute ; strong parachute - beq ParachuteActive - cmp #ind_Force_Shield___ ; shield witch energy and parachute + ldx TankNr + lda ActiveDefenceWeapon,x + cmp #ind_Parachute ; parachute + beq ParachuteActive + cmp #ind_StrongParachute ; strong parachute + beq ParachuteActive + cmp #ind_Force_Shield ; shield witch energy and parachute bne TankFallsX ParachuteActive inc Parachute TankFallsX - ; sound only if really falls - lda Parachute - and FallingSoundBit ; bit 1 - beq NoFallingSound - mva #0 FallingSoundBit + ; sound only if really falls + lda Parachute + and FallingSoundBit ; bit 1 + beq NoFallingSound + mva #0 FallingSoundBit mva #sfx_shield_off sfx_effect NoFallingSound ; clear previous position @@ -1057,8 +1057,8 @@ NoFallingSound DoNotClearParachute mva #0 Erase ; ldx TankNr - lda EndOfTheFallFlag ; We only get byte below the tank if still falling - bne NoGroundCheck + lda EndOfTheFallFlag ; We only get byte below the tank if still falling + bne NoGroundCheck ; coordinates of the first pixel under the tank ldx TankNr jsr SetupXYdraw.X @@ -1068,58 +1068,58 @@ DoNotClearParachute ; time in our lives! Tada! It opens a new chapter!!! sta ydraw ; -; UnderTank1 ; byte under tank -; UnderTank2 ; byte under tank reversed (for simple check right direction) +; UnderTank1 ; byte under tank +; UnderTank2 ; byte under tank reversed (for simple check right direction) lda #08 sta temp ; Loop Counter ByteBelowTank jsr point_plot beq EmptyPoint2 sec - ror UnderTank2 - sec + ror UnderTank2 + sec bcs ROLPoint2 EmptyPoint2 clc - ror UnderTank2 - clc + ror UnderTank2 + clc ROLPoint2 rol UnderTank1 inw xdraw dec temp - bne ByteBelowTank + bne ByteBelowTank NoGroundCheck ldx TankNr - lda Ytankstable,x - cmp #screenheight-1 ; tank on lowest position (no falling down) - jcs EndOfFall - lda UnderTank1 - bne NoFallingDown - ; Tank falling down ---- - lda Parachute + lda Ytankstable,x + cmp #screenheight-1 ; tank on lowest position (no falling down) + jcs EndOfFall + lda UnderTank1 + bne NoFallingDown + ; Tank falling down ---- + lda Parachute and #1 bne ParachutePresent ; decreasing energy ldy #2 ; how much energy to substract if no parachute jsr DecreaseEnergyX ParachutePresent - ; check parachute type - lda ActiveDefenceWeapon,x + ; check parachute type + lda ActiveDefenceWeapon,x cmp #ind_StrongParachute ; strong parachute - bne OneTimeParachute + bne OneTimeParachute ; decreasing energy of parachute ldy #1 ; how much parachute energy to substract - jsr DecreaseShieldEnergyX - cpy #0 ; is necessary to reduce tenk energy ? - beq @+ + jsr DecreaseShieldEnergyX + cpy #0 ; is necessary to reduce tenk energy ? + beq @+ jsr DecreaseEnergyX @ - ; check energy of parachute - lda ShieldEnergy,x - bne OneTimeParachute - lda #$00 - sta Parachute - sta ActiveDefenceWeapon,x ; deactivate defence + ; check energy of parachute + lda ShieldEnergy,x + bne OneTimeParachute + lda #$00 + sta Parachute + sta ActiveDefenceWeapon,x ; deactivate defence OneTimeParachute lda Parachute ora #2 ; we set bit nr 1 (nr 0 means that parachute is present) @@ -1129,28 +1129,28 @@ OneTimeParachute clc adc #1 sta Ytankstable,x - jmp EndOfFCycle + jmp EndOfFCycle NoFallingDown - ; check direction (left or right) - ldy #SlideLeftTableLen-1 ; SlideLeftTable length -1 (from 0 to 7) -@ lda SlideLeftTable,y - cmp UnderTank1 - beq FallingLeft - cmp UnderTank2 - beq FallingRight - dey - bpl @- - bmi NoLeftOrRight + ; check direction (left or right) + ldy #SlideLeftTableLen-1 ; SlideLeftTable length -1 (from 0 to 7) +@ lda SlideLeftTable,y + cmp UnderTank1 + beq FallingLeft + cmp UnderTank2 + beq FallingRight + dey + bpl @- + bmi NoLeftOrRight FallingRight - ; tank is falling right - bit PreviousFall ; bit 6 - left - bvs EndRightFall + ; tank is falling right + bit PreviousFall ; bit 6 - left + bvs EndRightFall ; we finish falling right if the tank reached the edge of the screen lda XtanksTableH,x - cmp #>(screenwidth-TankWidth-2) ; 2 pixels correction due to a barrel wider than tank - bne @+ + cmp #>(screenwidth-TankWidth-2) ; 2 pixels correction due to a barrel wider than tank + bne @+ lda XtanksTableL,x - cmp #<(screenwidth-TankWidth-2) ; 2 pixels correction due to a barrel wider than tank + cmp #<(screenwidth-TankWidth-2) ; 2 pixels correction due to a barrel wider than tank @ bcs EndRightFall NotRightEdge ; tank is falling right - modify coorinates @@ -1161,17 +1161,17 @@ NotRightEdge lda XtankstableH,x adc #0 sta XtankstableH,x - mva #%10000000 PreviousFall ; set bit 7 - right - bne EndOfFCycle + mva #%10000000 PreviousFall ; set bit 7 - right + bne EndOfFCycle FallingLeft - ; tank is falling left - bit PreviousFall ; bit 7 - right - bmi EndLeftFall + ; tank is falling left + bit PreviousFall ; bit 7 - right + bmi EndLeftFall ; we finish falling left if the tank reached the edge of the screen lda XtanksTableH,x bne NotLeftEdge lda XtanksTableL,x - cmp #3 ; 2 pixels correction due to a barrel wider than tank + cmp #3 ; 2 pixels correction due to a barrel wider than tank bcc EndLeftFall NotLeftEdge ; tank is falling left - modify coorinates @@ -1182,51 +1182,51 @@ NotLeftEdge lda XtankstableH,x sbc #0 sta XtankstableH,x - mva #%01000000 PreviousFall ; set bit 6 - left - bne EndOfFCycle + mva #%01000000 PreviousFall ; set bit 6 - left + bne EndOfFCycle EndLeftFall EndRightFall NoLeftOrRight inc EndOfTheFallFlag ; after this is shouldn't fall EndOfFCycle - ; draw tank on new position - jsr DrawTankNr ; ew have TankNr in X (I hope :) ) + ; draw tank on new position + jsr DrawTankNr ; ew have TankNr in X (I hope :) ) ; checking is parachute present and if so, draw it lda Parachute - cmp #3 ; parachute and falling - bne DoNotDrawParachute + cmp #3 ; parachute and falling + bne DoNotDrawParachute ; here we draw parachute ; ldx TankNr jsr DrawTankParachute - jsr WaitOneFrame ; only if tank with parachute + jsr WaitOneFrame ; only if tank with parachute RapidFalling DoNotDrawParachute - lda EndOfTheFallFlag - jeq TankFallsX + lda EndOfTheFallFlag + jeq TankFallsX ; Tank falling down already finished, but it is not sure that ; the horizontal coordinate is even. ; If it is odd then it must be corrected because otherwise ; P/M graphics background would not look OK ; ldx TankNr - ; x correction for P/M - ; -- - .IF XCORRECTION_FOR_PM = 1 + ; x correction for P/M + ; -- + .IF XCORRECTION_FOR_PM = 1 lda XtanksTableL,x and #$01 beq EndOfFall ; if it is even then it is the end ; and if not, we push it one pixel the way it was falling before - lda #%10000000 ; set "virtual ground" for right falling - ldy #%00000001 - bit PreviousFall - bmi ForceFallLeft - tay ; tricky - replaces ldy #%10000000 - lda #%00000001 ; set "virtual ground" for left falling + lda #%10000000 ; set "virtual ground" for right falling + ldy #%00000001 + bit PreviousFall + bmi ForceFallLeft + tay ; tricky - replaces ldy #%10000000 + lda #%00000001 ; set "virtual ground" for left falling ForceFallLeft - sta UnderTank1 - sty UnderTank2 - jmp TankFallsX - .ENDIF - ; -- + sta UnderTank1 + sty UnderTank2 + jmp TankFallsX + .ENDIF + ; -- EndOfFall mva #1 Erase ; ldx TankNr @@ -1235,11 +1235,11 @@ EndOfFall lda Parachute cmp #$03 ; was falling down and the parachute bne NoParachuteWeapon - ; first we check type of parachute - lda ActiveDefenceWeapon,x - cmp #ind_Parachute______ ; deactivate weapon only if parachute (54) - bne NoParachuteWeapon - mva #0 ActiveDefenceWeapon,x ; deactivate defence weapon (parachute) + ; first we check type of parachute + lda ActiveDefenceWeapon,x + cmp #ind_Parachute ; deactivate weapon only if parachute (54) + bne NoParachuteWeapon + mva #0 ActiveDefenceWeapon,x ; deactivate defence weapon (parachute) NoParachuteWeapon ; now we clear parachute on the screen if present lda Parachute @@ -1247,8 +1247,8 @@ NoParachuteWeapon beq ThereWasNoParachute jsr DrawTankParachute ThereWasNoParachute -; ldx TankNr - jsr PutTankNr ; redraw tank after erase parachute (exactly for redraw leaky schield :) ) +; ldx TankNr + jsr PutTankNr ; redraw tank after erase parachute (exactly for redraw leaky schield :) ) mva #sfx_silencer sfx_effect rts @@ -1258,21 +1258,21 @@ ThereWasNoParachute .proc ClearPMmemory ;-------------------------------------------------- - lda #$00 - tay -@ sta pmgraph+$300,y - sta pmgraph+$400,y - sta pmgraph+$500,y - sta pmgraph+$600,y - sta pmgraph+$700,y - iny - bne @- - rts + lda #$00 + tay +@ sta pmgraph+$300,y + sta pmgraph+$400,y + sta pmgraph+$500,y + sta pmgraph+$600,y + sta pmgraph+$700,y + iny + bne @- + rts .endp /* ;-------------------------------------------------- -drawmountainspixel ; never used ? +drawmountainspixel ; never used ? ;-------------------------------------------------- mwa #0 xdraw mwa #mountaintable modify @@ -1280,7 +1280,7 @@ drawmountainspixelloop ldy #0 lda (modify),y sta ydraw - sty ydraw+1 + sty ydraw+1 jsr plot inw modify inw xdraw @@ -1315,17 +1315,17 @@ drawmountainspixelloop ; how it works. I have just translated Polish comment ; but I do not understand a word of it :) ; If you know how it works, please write here :)))) - jsr ClearTanks + jsr ClearTanks NoClearTanks ; Fix for lonely pixel after nuclear winter :) #103 - lda #0 - sta xdraw - sta xdraw+1 - sta ydraw - sta ydraw+1 - sta color - jsr plot + lda #0 + sta xdraw + sta xdraw+1 + sta ydraw + sta ydraw+1 + sta color + jsr plot ; First we look for highest pixels and fill with their coordinates ; both tables @@ -1335,7 +1335,7 @@ NoClearTanks adw RangeLeft #mountaintable2 tempor2 cpw xdraw RangeRight - jcs NothingToFall + jcs NothingToFall NextColumn1 mwa #0 ydraw @@ -1351,9 +1351,9 @@ StillNothing inc ydraw lda ydraw cmp #screenheight - bne NextPoint1 - ; no pixels on whole column !!! - ldy #0 + bne NextPoint1 + ; no pixels on whole column !!! + ldy #0 lda ydraw sta (tempor2),y sta (temp),y @@ -1419,18 +1419,18 @@ ColumnIsReady bcc FalloutOfLine beq FalloutOfLine - jsr CheckExitKeys ; Check for O, Esc or Start+Option keys - spl:rts ; exit if pressed 'Exit keys' + jsr CheckExitKeys ; Check for O, Esc or Start+Option keys + spl:rts ; exit if pressed 'Exit keys' lda IsEndOfTheFallFlag ; we repeat untill at some point first table reaches ; level of the mountains jeq MainFallout2 ; now correct heights are in the mountaintable - sta color ; Pozor! :) we know - now A=1 + sta color ; Pozor! :) we know - now A=1 NothingToFall mva #sfx_silencer sfx_effect - jsr DrawTanks + jsr DrawTanks rts .endp @@ -1548,14 +1548,14 @@ EndDrawing ;-------------------------------------------------- mwa #0 xdraw nextPointDrawing - adw xdraw #mountaintable modify + adw xdraw #mountaintable modify lda #screenheight ldy #0 sta (modify),y inw xdraw cpw xdraw #screenwidth bne nextPointDrawing - ldx NumberOfPlayers + ldx NumberOfPlayers dex SetYofNextTank lda #screenheight-1 @@ -1574,17 +1574,17 @@ SetYofNextTank ldy #0 ldx #screenheight-1 nextPointChecking - txa + txa cmp (modify),y - bcc NotHigher + bcc NotHigher lda (modify),y - tax + tax NotHigher inw modify cpw modify #(mountaintable+screenwidth) bne nextPointChecking - txa - rts + txa + rts .endp ;-------------------------------------------------------- @@ -1605,7 +1605,7 @@ NotHigher ;jsr Display4x4AboveTank ;rts - ; POZOR !!! + ; POZOR !!! .endp ;-------------------------------------------------------- @@ -1782,7 +1782,7 @@ TypeLine4x4Loop sta CharCode4x4 mwa LineXdraw dx mva LineYdraw dy - mva #0 dy+1 ; dy is 2 bytes value + mva #0 dy+1 ; dy is 2 bytes value jsr PutChar4x4 ;type empty pixels as well! adw LineXdraw #4 inc:lda LineCharNr @@ -1852,7 +1852,7 @@ quit_areyousure mva #20 fs ; temp, how many times blink the billboard seppuku_loop lda CONSOL ; turbo mode - and #%00000001 ; START KEY + and #%00000001 ; START KEY sne:mva #1 fs ; finish it mva #4 ResultY ; where seppuku text starts Y-wise on the screen @@ -1922,8 +1922,8 @@ X lda XtanksTableL,x ; mva #1 color ldx TankNr jsr SetupXYdraw - lda BarrelLength,x - sta yc ; current tank barrel length + lda BarrelLength,x + sta yc ; current tank barrel length lda angleTable,x sta Angle jsr DrawBarrelTech @@ -1979,7 +1979,7 @@ YangleUnder90 lda #0 ; all arithmetic to zero sta vx+1 sta vy+1 - lda #128 ; ; add 0.5 to fx and fy (not vx and vx) for better rounding - it's my opinion (Pecus) + lda #128 ; ; add 0.5 to fx and fy (not vx and vx) for better rounding - it's my opinion (Pecus) sta fx sta fy @@ -2044,20 +2044,20 @@ ybarrel .proc PMoutofScreen ;-------------------------------------------------- lda #$00 ; let all P/M disappear - ldy #7 -@ sta hposp0,y - dey - bpl @- - ;:8 sta hposp0+# ; optimized... but Y! + ldy #7 +@ sta hposp0,y + dey + bpl @- + ;:8 sta hposp0+# ; optimized... but Y! rts .endp ;-------------------------------------------------- .proc ColorsOfSprites - ldy #3 -@ lda TankColoursTable,y ; colours of sprites under tanks - sta PCOLR0,y - dey - bpl @- + ldy #3 +@ lda TankColoursTable,y ; colours of sprites under tanks + sta PCOLR0,y + dey + bpl @- LDA TankColoursTable+4 STA COLOR3 ; joined missiles (5th tank) rts diff --git a/scorch.asm b/scorch.asm index d1d56c9..7da368b 100644 --- a/scorch.asm +++ b/scorch.asm @@ -1,4 +1,4 @@ -; @com.wudsn.ide.asm.mainsourcefile=scorch.asm +; @com.wudsn.ide.asm.mainsourcefile=scorch.asm ;Atari 8-bit Scorched Earth source code ;--------------------------------------------------- ;by Tomasz 'pecus' Pecko and Pawel 'pirx' Kalinowski @@ -6,7 +6,9 @@ ;Miami & Warsaw 2022, 2023 ;--------------------------------------------------- -.def TARGET = 800 ; 5200 ; or 800 +.IFNDEF TARGET + .def TARGET = 800 ; 5200 ; or 64 +.ENDIF ;atari800 -5200 -cart ${outputFilePath} -cart-type 4 ;atari800 -run ${outputFilePath} ;--------------------------------------------------- @@ -17,11 +19,11 @@ ; (direct writes to screen memory - atari only :) ) ;--------------------------------------------------- - ;OPT r+ ; saves 12 bytes :O + ; OPT r+ ; saves 12 bytes :O ;--------------------------------------------------- .macro build - dta d"1.30" ; number of this build (4 bytes) + dta d"1.30" ; number of this build (4 bytes) .endm .macro RMTSong @@ -34,14 +36,14 @@ ;--------------------------------------------------- FirstZpageVariable = $57 - .zpvar DliColorBack .byte = FirstZpageVariable - .zpvar GradientNr .byte - .zpvar GradientColors .word - .zpvar WindChangeInRound .byte ; wind change after each turn (not round only) flag - (0 - round only, >0 - each turn) - .zpvar JoystickNumber .byte - .zpvar LazyFlag .byte ; 7 bit - run Lazy Darwin, 6 bit - run Lazy Boy or Darwin (!) after inventory, 0 - nothing - .zpvar SpyHardFlag .byte ; >$7f - run SpyHard after inventory - .zpvar Vdebug .byte ; "visual debug" flag ($00 - off, $ff - on) + .zpvar DliColorBack .byte = FirstZpageVariable + .zpvar GradientNr .byte + .zpvar GradientColors .word + .zpvar WindChangeInRound .byte ; wind change after each turn (not round only) flag - (0 - round only, >0 - each turn) + .zpvar JoystickNumber .byte + .zpvar LazyFlag .byte ; 7 bit - run Lazy Darwin, 6 bit - run Lazy Boy or Darwin (!) after inventory, 0 - nothing + .zpvar SpyHardFlag .byte ; >$7f - run SpyHard after inventory + .zpvar Vdebug .byte ; "visual debug" flag ($00 - off, $ff - on) .zpvar xdraw .word ;= $64 ;variable X for plot .zpvar ydraw .word ;variable Y for plot (like in Atari Basic - Y=0 in upper right corner of the screen) .zpvar xbyte .word @@ -59,7 +61,7 @@ FirstZpageVariable = $57 .zpvar xtempDRAW .word ;same as above for XDRAW routine .zpvar ytempDRAW .word ;same as above for XDRAW routine .zpvar tempor2 .word - .zpvar CreditsVScrol .byte + .zpvar CreditsVScrol .byte ;--------------temps used in circle routine .zpvar xi .word ;X (word) in draw routine .zpvar fx .byte @@ -74,21 +76,21 @@ FirstZpageVariable = $57 .zpvar di .word .zpvar dp .word ;---------------------------- - .zpvar UnderTank1 .byte - .zpvar UnderTank2 .byte + .zpvar UnderTank1 .byte + .zpvar UnderTank2 .byte ;---------------------------- - .zpvar TestFlightFlag .byte ; For AI test flights ($ff - test, $00 - standard shoot flight) + .zpvar TestFlightFlag .byte ; For AI test flights ($ff - test, $00 - standard shoot flight) .zpvar weaponPointer .word - .zpvar dliCounter .byte - .zpvar pressTimer .byte - .zpvar NTSCcounter .byte - .zpvar IsEndOfTheFallFlag .byte ; for small speedup ground falling - .zpvar sfx_effect .byte - .zpvar RMT_blocked .byte - .zpvar ScrollFlag .byte - .zpvar SkStatSimulator .byte - .zpvar FloatingAlt .byte ; floating tank altitude - .zpvar OverTankDir .byte ; (0 go right, $ff go left) direction of bypassing tanks on screen + .zpvar dliCounter .byte + .zpvar pressTimer .byte + .zpvar NTSCcounter .byte + .zpvar IsEndOfTheFallFlag .byte ; for small speedup ground falling + .zpvar sfx_effect .byte + .zpvar RMT_blocked .byte + .zpvar ScrollFlag .byte + .zpvar SkStatSimulator .byte + .zpvar FloatingAlt .byte ; floating tank altitude + .zpvar OverTankDir .byte ; (0 go right, $ff go left) direction of bypassing tanks on screen ; --------------OPTIMIZATION VARIABLES-------------- .zpvar Force .word @@ -103,7 +105,7 @@ FirstZpageVariable = $57 .zpvar NumberOfPlayers .byte ;current number of players (counted from 1) .zpvar Counter .byte ;temporary Counter for outside loops .zpvar ExplosionRadius .byte - .zpvar FunkyBombCounter .byte + .zpvar FunkyBombCounter .byte .zpvar ResultY .byte .zpvar xcircle .word .zpvar ycircle .word @@ -126,10 +128,10 @@ FirstZpageVariable = $57 .zpvar RangeLeft .word .zpvar RangeRight .word .zpvar NewAngle .byte - .zpvar escFlag .byte ; 7 bit - Exit game, 6 bit - Exit to GameOver (cleared - exit to Menu), 0 - nothing + .zpvar escFlag .byte ; 7 bit - Exit game, 6 bit - Exit to GameOver (cleared - exit to Menu), 0 - nothing .zpvar LineYdraw .byte .zpvar LineXdraw .word - .zpvar plot4x4color .byte ; $00 / $ff + .zpvar plot4x4color .byte ; $00 / $ff .zpvar Multiplier .word .zpvar Multiplier_ .byte ; 3 bytes .zpvar HowToDraw .byte @@ -141,7 +143,7 @@ FirstZpageVariable = $57 .zpvar goleft .byte .zpvar OffsetDL1 .byte .zpvar L1 .byte - HotNapalmFlag = FunkyBombCounter ; reuse variable! + HotNapalmFlag = FunkyBombCounter ; reuse variable! ;* RMT ZeroPage addresses in artwork/sfx/rmtplayr.a65 displayposition = modify @@ -187,14 +189,14 @@ FirstZpageVariable = $57 _del = $fc ;$0c ;not used in 5200 _M = $0d _S = $0e - _atari = $fd ; not used in 5200 + _atari = $fd ; not used in 5200 _none = $0f .ende .ELSE icl 'Atari/lib/ATARISYS.ASM' icl 'Atari/lib/MACRO.ASM' - icl 'artwork/splash_v2/splash.asm' ; splash screen and musix + ; icl 'artwork/splash_v2/splash.asm' ; splash screen and musix .ENDIF ;----------------------------------------------- @@ -283,83 +285,83 @@ rom2joy ; modify the text splash_text = $3c80 ; '.scorch.supersystem.copyright.19xx.atari' splash_year = splash_text + $1e - splash_copyright = splash_text + $14 - ldy #19 ; 20 characters -@ lda NewSplashText,y - sta splash_copyright,y - dey - bpl @- + splash_copyright = splash_text + $14 + ldy #19 ; 20 characters +@ lda NewSplashText,y + sta splash_copyright,y + dey + bpl @- ; splash screen delay. maybe add fire to speed up? @ cpx RTCLOK+1 bne @- no5200splash .ENDIF - jsr MakeDarkScreen + jsr MakeDarkScreen - ; one time zero variables in RAM (non zero page) - lda #0 - ldy #OneTimeZeroVariablesCount-1 -@ sta OneTimeZeroVariables,y - dey - bpl @- - - ; one time zero variables in RAM (zero page) - ldy #FirstZpageVariable -@ sta $0000,y - iny - bne @- - - ; initialize variables in RAM (non zero page) - ldy #initialvaluesCount-1 -@ lda initialvaluesStart,y - sta variablesToInitialize,y - dey - bpl @- + ; one time zero variables in RAM (non zero page) + lda #0 + ldy #OneTimeZeroVariablesCount-1 +@ sta OneTimeZeroVariables,y + dey + bpl @- + + ; one time zero variables in RAM (zero page) + ldy #FirstZpageVariable +@ sta $0000,y + iny + bne @- + + ; initialize variables in RAM (non zero page) + ldy #initialvaluesCount-1 +@ lda initialvaluesStart,y + sta variablesToInitialize,y + dey + bpl @- ; set gradient to the full LGBTIQQAAPP+ flag on start - mva #0 GradientNr ; #1 to set gradient number 2 :) (next one) - jsr SelectNextGradient.NotWind + mva #0 GradientNr ; #1 to set gradient number 2 :) (next one) + jsr SelectNextGradient.NotWind ; generate linetables - jsr GenerateLineTable + jsr GenerateLineTable .IF TARGET = 800 ; pokeys init - lda #3 ; stereo - sta POKEY+$0f ; stereo - sta POKEY+$1f ; stereo + lda #3 ; stereo + sta POKEY+$0f ; stereo + sta POKEY+$1f ; stereo - lda PAL - and #%00001110 - bne NoRMT_PALchange - ;it is PAL here - ; Change RMT to PAL version - ; 5 values in RMT file - ; not elegant :( - mva #$06 MODUL-6+$967 ; $07 > $06 - ;mva #$06 MODUL-6+$bc3 ; $07 > $06 - ;mva #$06 MODUL-6+$e69 ; $08 > $06 - ;mva #$06 MODUL-6+$ebc ; $08 > $06 - sta MODUL-6+$bc3 ; $07 > $06 - sta MODUL-6+$e69 ; $08 > $06 - sta MODUL-6+$ebc ; $08 > $06 - mva #$10 MODUL-6+$a69 ; $12 > $10 - mva #$04 MODUL-6+$bf8 ; $05 > $04 - mva #$08 MODUL-6+$e3d ; $0a > $08 - - ; and mountains colors table address - mva #dliColorsFore2PAL GradientAddrH+2 -; mva #$c4 dliColorsFore2+16 -; mva #$c6 dliColorsFore2+17 -; mva #$a4 dliColorsFore2+18 -; mva #$a6 dliColorsFore2+19 -; sta dliColorsFore2+20 + lda PAL + and #%00001110 + bne NoRMT_PALchange + ;it is PAL here + ; Change RMT to PAL version + ; 5 values in RMT file + ; not elegant :( + mva #$06 MODUL-6+$967 ; $07 > $06 + ;mva #$06 MODUL-6+$bc3 ; $07 > $06 + ;mva #$06 MODUL-6+$e69 ; $08 > $06 + ;mva #$06 MODUL-6+$ebc ; $08 > $06 + sta MODUL-6+$bc3 ; $07 > $06 + sta MODUL-6+$e69 ; $08 > $06 + sta MODUL-6+$ebc ; $08 > $06 + mva #$10 MODUL-6+$a69 ; $12 > $10 + mva #$04 MODUL-6+$bf8 ; $05 > $04 + mva #$08 MODUL-6+$e3d ; $0a > $08 + + ; and mountains colors table address + mva #dliColorsFore2PAL GradientAddrH+2 +; mva #$c4 dliColorsFore2+16 +; mva #$c6 dliColorsFore2+17 +; mva #$a4 dliColorsFore2+18 +; mva #$a6 dliColorsFore2+19 +; sta dliColorsFore2+20 NoRMT_PALchange - .ELSE - mva #$7f SkStatSimulator + .ELSE + mva #$7f SkStatSimulator .ENDIF @@ -377,16 +379,16 @@ NoRMT_PALchange mva #$04 CONSOL5200 ;Speaker off, Pots enabled, port #1 selected mwa #kb_continue VKEYCNT ;Keyboard handler .ENDIF - VMAIN VBLinterrupt,7 ;jsr SetVBL - - mva #2 chactl ; necessary for 5200 + VMAIN VBLinterrupt,7 ;jsr SetVBL + + mva #2 chactl ; necessary for 5200 ;-------------------------------------------------- ; Main program of the game icl 'game.asm' ;-------------------------------------------------- - + ;-------------------------------------------------- .proc GetKey ; waits for pressing a key and returns pressed value in A @@ -401,10 +403,10 @@ NoRMT_PALchange beq checkJoyGetKey ; key not pressed, check Joy cmp #$f7 ; SHIFT beq checkJoyGetKey - .ELSE - lda SkStatSimulator - and #%11111110 - bne checkJoyGetKey ; key not pressed, check Joy + .ELSE + lda SkStatSimulator + and #%11111110 + bne checkJoyGetKey ; key not pressed, check Joy .ENDIF lda kbcode cmp #@kbcode._none @@ -428,30 +430,30 @@ checkJoyGetKey bne getkeyend notpressedJoyGetKey - ;fire - lda STRIG0 - beq JoyButton - .IF TARGET = 800 ; Select and Option key only on A800 - bne checkSelectKey + ;fire + lda STRIG0 + beq JoyButton + .IF TARGET = 800 ; Select and Option key only on A800 + bne checkSelectKey checkSelectKey - lda CONSOL - and #%00000010 ; Select - beq SelectPressed - lda CONSOL - and #%00000100 ; Option - .ENDIF + lda CONSOL + and #%00000010 ; Select + beq SelectPressed + lda CONSOL + and #%00000100 ; Option + .ENDIF bne @- OptionPressed - lda #@kbcode._atari ; Option key - bne getkeyend + lda #@kbcode._atari ; Option key + bne getkeyend SelectPressed - lda #@kbcode._tab ; Select key - bne getkeyend + lda #@kbcode._tab ; Select key + bne getkeyend JoyButton lda #@kbcode._ret ;Return key getkeyend - ldy #0 - sty ATRACT ; reset atract mode + ldy #0 + sty ATRACT ; reset atract mode mvy #sfx_keyclick sfx_effect rts .endp @@ -468,10 +470,10 @@ getkeyend ;-------------------------------------------------- .proc WaitForKeyRelease ;-------------------------------------------------- - mva #128-KeyRepeatSpeed pressTimer ; tricky -StillWait - bit pressTimer - bmi KeyReleased + mva #128-KeyRepeatSpeed pressTimer ; tricky +StillWait + bit pressTimer + bmi KeyReleased lda STICK0 and #$0f cmp #$0f @@ -483,13 +485,13 @@ StillWait cmp #$ff bne StillWait lda CONSOL - and #%00000110 ; Select and Option only + and #%00000110 ; Select and Option only cmp #%00000110 bne StillWait - .ELSE - lda SkStatSimulator - and #%11111110 - beq StillWait + .ELSE + lda SkStatSimulator + and #%11111110 + beq StillWait .ENDIF KeyReleased rts @@ -498,12 +500,12 @@ KeyReleased .proc IsKeyPressed ; result: A=0 - yes , A>0 - no ;-------------------------------------------------- - lda SKSTAT - and #%00000100 - beq @+ - lda #1 -@ and STRIG0 - rts + lda SKSTAT + and #%00000100 + beq @+ + lda #1 +@ and STRIG0 + rts .endp ;-------------------------------------------------- .proc DemoModeOrKey @@ -530,15 +532,15 @@ peopleAreHere ;-------------------------------------------------- MakeDarkScreen ;-------------------------------------------------- - jsr PMoutofScreen ; hide P/M - mva #0 dmactls ; dark screen - ; and wait one frame :) + jsr PMoutofScreen ; hide P/M + mva #0 dmactls ; dark screen + ; and wait one frame :) ;-------------------------------------------------- .proc WaitOneFrame ;-------------------------------------------------- - lda CONSOL - and #%00000001 ; START KEY - seq:wait ; or waitRTC ? + lda CONSOL + and #%00000001 ; START KEY + seq:wait ; or waitRTC ? rts .endp @@ -563,10 +565,10 @@ MakeDarkScreen ; If 'Esc' key is pressed - displays "Are you sure?" and - exit to Menu screen ; Just setting the right flags!!! - ; Select and Option - lda CONSOL - and #%00000101 ; Start + Option - beq QuitToGameover + ; Select and Option + lda CONSOL + and #%00000101 ; Start + Option + beq QuitToGameover lda SKSTAT cmp #$ff jeq nokeys @@ -578,12 +580,12 @@ MakeDarkScreen cmp #@kbcode._O ; $08 ; O bne CheckEsc - jsr AreYouSure - bit escFlag - bpl nokeys + jsr AreYouSure + bit escFlag + bpl nokeys ;---O pressed-quit game to game over screen--- QuitToGameover - mva #$C0 escFlag ; bits 7 and 6 set + mva #$C0 escFlag ; bits 7 and 6 set rts CheckEsc cmp #@kbcode._esc ; 28 ; ESC @@ -592,16 +594,16 @@ DisplayAreYouSure jsr AreYouSure ;---esc pressed-quit game--- nokeys - bit escFlag + bit escFlag rts ; .endp ;-------------------------------------------------- .proc ShellDelay ;-------------------------------------------------- - lda CONSOL - and #%00000001 ; START KEY - beq noShellDelay + lda CONSOL + and #%00000001 ; START KEY + beq noShellDelay ldx flyDelay DelayLoop lda VCOUNT @@ -617,17 +619,17 @@ noShellDelay .proc RmtSongSelect ; starting song line 0-255 to A reg ;-------------------------------------------------- - cmp #song_ingame - bne noingame ; noMusic blocks only ingame song + cmp #song_ingame + bne noingame ; noMusic blocks only ingame song bit noMusic spl:lda #song_silencio noingame - mvx #$ff RMT_blocked + mvx #$ff RMT_blocked ldx #MODUL ;hi byte of RMT module to Y reg jsr RASTERMUSICTRACKER ;Init - mva #0 RMT_blocked - rts + mva #0 RMT_blocked + rts .endp ;------------------------------------------------- .proc CopyFromROM @@ -653,7 +655,7 @@ noingame rts .endp ;-------------------------------------------------- - icl 'Atari/interrupts.asm' + icl 'Atari/interrupts.asm' ;---------------------------------------------- icl 'constants.asm' ;---------------------------------------------- @@ -669,7 +671,7 @@ noingame icl 'artwork/talk.asm' ;---------------------------------------------- TankFont - ins 'artwork/tanksv4.fnt',+0,384 ; 48 characters only + ins 'artwork/tanksv4.fnt',+0,384 ; 48 characters only ;---------------------------------------------- font4x4 ins 'artwork/font4x4s.bmp',+62 @@ -686,60 +688,60 @@ font4x4 tax @ lda CheatName,y - sec + sec sbc tanksnames,x - cmp #$27 - bne NoCheat + cmp #$27 + bne NoCheat inx dey bpl @- YesCheat - ldx TankNr - lda TanksWeaponsTableL,x - sta temp - lda TanksWeaponsTableH,x - sta temp+1 - lda #99 -@ iny - sta (temp),y - cpy #(number_of_weapons - 1) - bne @- + ldx TankNr + lda TanksWeaponsTableL,x + sta temp + lda TanksWeaponsTableH,x + sta temp+1 + lda #99 +@ iny + sta (temp),y + cpy #(number_of_weapons - 1) + bne @- NoCheat rts .endp CheatName - dta d" 008.T"+$27 + dta d" 008.T"+$27 ;---------------------------------------------- .proc DLIinterruptBFG - pha - lda dliCounter - bne EndofBFGDLI - lda dliColorsFore - bit random - bmi @+ - lda DliColorBack -@ sta COLPF2 - lda dliColorsFore - bit random - bmi @+ - lda DliColorBack -@ sta COLPF1 + pha + lda dliCounter + bne EndofBFGDLI + lda dliColorsFore + bit random + bmi @+ + lda DliColorBack +@ sta COLPF2 + lda dliColorsFore + bit random + bmi @+ + lda DliColorBack +@ sta COLPF1 EndofBFGDLI - inc dliCounter + inc dliCounter pla rti .endp ; ------------------------ .proc BFGblink - SetDLI DLIinterruptBFG ; blinking on - ldy #50 - jsr PauseYFrames - SetDLI DLIinterruptGraph ; blinking off - rts + SetDLI DLIinterruptBFG ; blinking on + ldy #50 + jsr PauseYFrames + SetDLI DLIinterruptGraph ; blinking off + rts .endp ;-------------------------------------------------- .IF * > MODUL-1 - .ECHO * + .ECHO * .ERROR 'Code and data too long' .ENDIF .ECHO "Bytes left: ",$b000-* diff --git a/scorch.bin b/scorch.bin index 0b5931d..1354380 100644 Binary files a/scorch.bin and b/scorch.bin differ diff --git a/scorch.xex b/scorch.xex index d6af7c7..072dc4d 100644 Binary files a/scorch.xex and b/scorch.xex differ diff --git a/scorchC64.asm b/scorchC64.asm index e639b60..974b125 100644 --- a/scorchC64.asm +++ b/scorchC64.asm @@ -1,4 +1,4 @@ -; @com.wudsn.ide.asm.mainsourcefile=scorch.asm +; @com.wudsn.ide.asm.mainsourcefile=scorch.asm ;C64 8-bit Scorched Earth source code ;--------------------------------------------------- ;by Tomasz 'pecus' Pecko and Pawel 'pirx' Kalinowski @@ -20,15 +20,15 @@ org $801 org [a($801)],$801 basic_start(FirstSTART) - - + + ;--------------------------------------------------- .macro build - dta d"1.28" ; number of this build (4 bytes) + dta d"1.28" ; number of this build (4 bytes) .endm .macro RMTSong - lda #:1 ; do nothing in C64 + lda #:1 ; do nothing in C64 .endm ;--------------------------------------------------- @@ -36,14 +36,14 @@ ;--------------------------------------------------- FirstZpageVariable = $58 ; $57 - .zpvar DliColorBack .byte = FirstZpageVariable - .zpvar GradientNr .byte - .zpvar GradientColors .word - .zpvar WindChangeInRound .byte ; wind change after each turn (not round only) flag - (0 - round only, >0 - each turn) - .zpvar JoystickNumber .byte - .zpvar LazyFlag .byte ; 7 bit - run Lazy Darwin, 6 bit - run Lazy Boy or Darwin (!) after inventory, 0 - nothing - .zpvar SpyHardFlag .byte ; >$7f - run SpyHard after inventory - .zpvar Vdebug .byte ; "visual debug" flag ($00 - off, $ff - on) + .zpvar DliColorBack .byte = FirstZpageVariable + .zpvar GradientNr .byte + .zpvar GradientColors .word + .zpvar WindChangeInRound .byte ; wind change after each turn (not round only) flag - (0 - round only, >0 - each turn) + .zpvar JoystickNumber .byte + .zpvar LazyFlag .byte ; 7 bit - run Lazy Darwin, 6 bit - run Lazy Boy or Darwin (!) after inventory, 0 - nothing + .zpvar SpyHardFlag .byte ; >$7f - run SpyHard after inventory + .zpvar Vdebug .byte ; "visual debug" flag ($00 - off, $ff - on) .zpvar xdraw .word ;= $64 ;variable X for plot .zpvar ydraw .word ;variable Y for plot (like in Atari Basic - Y=0 in upper right corner of the screen) .zpvar xbyte .word @@ -61,7 +61,7 @@ FirstZpageVariable = $58 ; $57 .zpvar xtempDRAW .word ;same as above for XDRAW routine .zpvar ytempDRAW .word ;same as above for XDRAW routine .zpvar tempor2 .word - .zpvar CreditsVScrol .byte + .zpvar CreditsVScrol .byte ;--------------temps used in circle routine .zpvar xi .word ;X (word) in draw routine .zpvar fx .byte @@ -76,21 +76,21 @@ FirstZpageVariable = $58 ; $57 .zpvar di .word .zpvar dp .word ;---------------------------- - .zpvar UnderTank1 .byte - .zpvar UnderTank2 .byte + .zpvar UnderTank1 .byte + .zpvar UnderTank2 .byte ;---------------------------- - .zpvar TestFlightFlag .byte ; For AI test flights ($ff - test, $00 - standard shoot flight) + .zpvar TestFlightFlag .byte ; For AI test flights ($ff - test, $00 - standard shoot flight) .zpvar weaponPointer .word - .zpvar dliCounter .byte - .zpvar pressTimer .byte - .zpvar NTSCcounter .byte - .zpvar IsEndOfTheFallFlag .byte ; for small speedup ground falling - .zpvar sfx_effect .byte - .zpvar RMT_blocked .byte - .zpvar ScrollFlag .byte - .zpvar SkStatSimulator .byte - .zpvar FloatingAlt .byte ; floating tank altitude - .zpvar OverTankDir .byte ; (0 go right, $ff go left) direction of bypassing tanks on screen + .zpvar dliCounter .byte + .zpvar pressTimer .byte + .zpvar NTSCcounter .byte + .zpvar IsEndOfTheFallFlag .byte ; for small speedup ground falling + .zpvar sfx_effect .byte + .zpvar RMT_blocked .byte + .zpvar ScrollFlag .byte + .zpvar SkStatSimulator .byte + .zpvar FloatingAlt .byte ; floating tank altitude + .zpvar OverTankDir .byte ; (0 go right, $ff go left) direction of bypassing tanks on screen ; --------------OPTIMIZATION VARIABLES-------------- .zpvar Force .word @@ -105,7 +105,7 @@ FirstZpageVariable = $58 ; $57 .zpvar NumberOfPlayers .byte ;current number of players (counted from 1) .zpvar Counter .byte ;temporary Counter for outside loops .zpvar ExplosionRadius .byte - .zpvar FunkyBombCounter .byte + .zpvar FunkyBombCounter .byte .zpvar ResultY .byte .zpvar xcircle .word .zpvar ycircle .word @@ -128,10 +128,10 @@ FirstZpageVariable = $58 ; $57 .zpvar RangeLeft .word .zpvar RangeRight .word .zpvar NewAngle .byte - .zpvar escFlag .byte ; 7 bit - Exit game, 6 bit - Exit to GameOver (cleared - exit to Menu), 0 - nothing + .zpvar escFlag .byte ; 7 bit - Exit game, 6 bit - Exit to GameOver (cleared - exit to Menu), 0 - nothing .zpvar LineYdraw .byte .zpvar LineXdraw .word - .zpvar plot4x4color .byte ; $00 / $ff + .zpvar plot4x4color .byte ; $00 / $ff .zpvar Multiplier .word .zpvar Multiplier_ .byte ; 3 bytes .zpvar HowToDraw .byte @@ -143,7 +143,7 @@ FirstZpageVariable = $58 ; $57 .zpvar goleft .byte .zpvar OffsetDL1 .byte .zpvar L1 .byte - HotNapalmFlag = FunkyBombCounter ; reuse variable! + HotNapalmFlag = FunkyBombCounter ; reuse variable! ;* RMT ZeroPage addresses in artwork/sfx/rmtplayr.a65 displayposition = modify @@ -172,18 +172,18 @@ WeaponFont ; Game Code ;-------------------------------------------------- FirstSTART - DL = 0 - StatusBufferROM = 0 - ;StatusBufferCopy = 0 - StatusBufferCopyEnd = 0 - TRACKS = 4 - DisplayCopyPurchaseEnd = 0 - DisplayCopyPurchaseStart = 0 - displayC64 = $2000 ; graphics screen memory start + DL = 0 + StatusBufferROM = 0 + ;StatusBufferCopy = 0 + StatusBufferCopyEnd = 0 + TRACKS = 4 + DisplayCopyPurchaseEnd = 0 + DisplayCopyPurchaseStart = 0 + displayC64 = $2000 ; graphics screen memory start SEI ; disable IRQ - LDA #$36 - STA $0001 ; Turn Off BASIC ROM + LDA #$36 + STA $0001 ; Turn Off BASIC ROM LDA #NMI ; to our routine @@ -199,43 +199,43 @@ FirstSTART ; from here on NMI is disabled - - jsr MakeDarkScreen - - ; one time zero variables in RAM (non zero page) - lda #0 - ldy #OneTimeZeroVariablesCount-1 -@ sta OneTimeZeroVariables,y - dey - bpl @- - - ; one time zero variables in RAM (zero page) - ldy #FirstZpageVariable -@ sta $0000,y - iny - bne @- - - ; initialize variables in RAM (non zero page) - ldy #initialvaluesCount-1 -@ lda initialvaluesStart,y - sta variablesToInitialize,y - dey - bpl @- + + jsr MakeDarkScreen + + ; one time zero variables in RAM (non zero page) + lda #0 + ldy #OneTimeZeroVariablesCount-1 +@ sta OneTimeZeroVariables,y + dey + bpl @- + + ; one time zero variables in RAM (zero page) + ldy #FirstZpageVariable +@ sta $0000,y + iny + bne @- + + ; initialize variables in RAM (non zero page) + ldy #initialvaluesCount-1 +@ lda initialvaluesStart,y + sta variablesToInitialize,y + dey + bpl @- ; generate linetables - jsr GenerateLineTable + jsr GenerateLineTable ; Random INIT - InitializeSIDrnd + InitializeSIDrnd ;-------------------------------------------------- ; Main program of the game icl 'game.asm' ;-------------------------------------------------- - + ;-------------------------------------------------- .proc GetKey ; waits for pressing a key and returns pressed value in A @@ -243,9 +243,9 @@ FirstSTART ; result: A=keycode ;-------------------------------------------------- jsr WaitForKeyRelease - lda #0 - sta escFlag - lda #$ff + lda #0 + sta escFlag + lda #$ff rts .endp @@ -268,8 +268,8 @@ StillWait .proc IsKeyPressed ; result: A=0 - yes , A>0 - no ;-------------------------------------------------- - lda #1 - rts + lda #1 + rts .endp ;-------------------------------------------------- .proc DemoModeOrKey @@ -296,12 +296,12 @@ peopleAreHere ;-------------------------------------------------- MakeDarkScreen ;-------------------------------------------------- -; mva #0 dmactls ; dark screen - ; and wait one frame :) +; mva #0 dmactls ; dark screen + ; and wait one frame :) ;-------------------------------------------------- .proc WaitOneFrame ;-------------------------------------------------- - wait ; or waitRTC ? + wait ; or waitRTC ? rts .endp @@ -348,20 +348,20 @@ noShellDelay .proc RmtSongSelect ; starting song line 0-255 to A reg ;-------------------------------------------------- - rts + rts .endp .proc CopyFromRom - rts + rts .endp ;-------------------------------------------------- - icl 'C64/interrupts.asm' + icl 'C64/interrupts.asm' ;---------------------------------------------- icl 'constants.asm' ;---------------------------------------------- icl 'C64/textproc.asm' ;---------------------------------------------- icl 'grafproc.asm' - icl 'C64/gr_basics.asm' + icl 'C64/gr_basics.asm' ;---------------------------------------------- icl 'weapons.asm' ;---------------------------------------------- @@ -370,7 +370,7 @@ noShellDelay icl 'artwork/talk.asm' ;---------------------------------------------- TankFont - ins 'artwork/tanksv4.fnt',+0,384 ; 48 characters only + ins 'artwork/tanksv4.fnt',+0,384 ; 48 characters only ;---------------------------------------------- font4x4 ins 'artwork/font4x4s.bmp',+62 @@ -384,56 +384,56 @@ font4x4 tax @ lda CheatName,y - sec + sec sbc tanksnames,x - cmp #$27 - bne NoCheat + cmp #$27 + bne NoCheat inx dey bpl @- YesCheat - ldx TankNr - lda TanksWeaponsTableL,x - sta temp - lda TanksWeaponsTableH,x - sta temp+1 - lda #99 -@ iny - sta (temp),y - cpy #(number_of_weapons - 1) - bne @- + ldx TankNr + lda TanksWeaponsTableL,x + sta temp + lda TanksWeaponsTableH,x + sta temp+1 + lda #99 +@ iny + sta (temp),y + cpy #(number_of_weapons - 1) + bne @- NoCheat rts .endp CheatName - dta d" 008.T"+$27 + dta d" 008.T"+$27 ;---------------------------------------------- .proc DLIinterruptBFG - pha - lda dliCounter - bne EndofBFGDLI - lda dliColorsFore - bit random - bmi @+ - lda DliColorBack -@ sta COLPF2 - lda dliColorsFore - bit random - bmi @+ - lda DliColorBack -@ sta COLPF1 + pha + lda dliCounter + bne EndofBFGDLI + lda dliColorsFore + bit random + bmi @+ + lda DliColorBack +@ sta COLPF2 + lda dliColorsFore + bit random + bmi @+ + lda DliColorBack +@ sta COLPF1 EndofBFGDLI - inc dliCounter + inc dliCounter pla rti .endp ; ------------------------ .proc BFGblink -; SetDLI DLIinterruptBFG ; blinking on - ldy #50 - jsr PauseYFrames -; SetDLI DLIinterruptGraph ; blinking off - rts +; SetDLI DLIinterruptBFG ; blinking on + ldy #50 + jsr PauseYFrames +; SetDLI DLIinterruptGraph ; blinking off + rts .endp ;---------------------------------------------- icl 'constants_top.asm' diff --git a/variables.asm b/variables.asm index 209793e..38f4b83 100644 --- a/variables.asm +++ b/variables.asm @@ -1,4 +1,4 @@ -; @com.wudsn.ide.asm.mainsourcefile=scorch.asm +; @com.wudsn.ide.asm.mainsourcefile=scorch.asm .IF *>0 ;this is a trick that prevents compiling this file alone ;===================================================== @@ -18,7 +18,7 @@ noMusic .ds 1 ;.by 0 ; 0 - play music, $ff - do not play music noSfx .ds 1 ;.by 0 ; 0 - play SFX, $ff - do not play SFX ;---------------------------------------------------- ; Color table for Game Over Screen (created in a gameover routine) - .ds 1 ;.by $00 ; labels line color + .ds 1 ;.by $00 ; labels line color GameOverColoursTable .ds MaxPlayers; .BYTE $80,$40,$c4,$20,$c0,$e4 ;---------------------------------------------------- TanksNames ; DO NOT ZERO ON GAME RESTART - ticket #24 @@ -102,7 +102,7 @@ ResultsTable ;the results in the gameeeeee .DS MaxPlayers TempResults .DS MaxPlayers -;DirectHitsH ; one byte enough +;DirectHitsH ; one byte enough ; .DS MaxPlayers DirectHits .DS MaxPlayers @@ -149,7 +149,7 @@ WindOrientation .DS 1 ;(0-right,1-left) ;---------------------------------------------------- ;Counter .DS 1 ;temporary Counter for outside loops ;HitFlag .DS 1 ;$ff when missile hit ground, $00 when no hit, $01-$06 tank index+1 when hit tank -WallsType .ds 1 ; bits 6 and 7: 00 - none, 01 - bump, 10 - wrap, 11 - boxy +WallsType .ds 1 ; bits 6 and 7: 00 - none, 01 - bump, 10 - wrap, 11 - boxy ;---------------------------------------------------- xtankstableL ;X positions of tanks (lower left point) .DS MaxPlayers @@ -159,15 +159,15 @@ ytankstable ;Y positions of tanks (lower left point) .DS MaxPlayers LowResDistances ; coarse tank positions divided by 4 (to be in just one byte) .DS MaxPlayers -JoyNumber ; Joystick port number (from 0 to 3) - .DS MaxPlayers -TankShape ; Tank shape number (from 0 to 2) - .DS MaxPlayers +JoyNumber ; Joystick port number (from 0 to 3) + .DS MaxPlayers +TankShape ; Tank shape number (from 0 to 2) + .DS MaxPlayers ;---------------------------------------------------- -TargetTankNr ; Target tank index (for AI routines) - .DS 1 -SecondTryFlag ; For precise AI aiming - .DS 1 +TargetTankNr ; Target tank index (for AI routines) + .DS 1 +SecondTryFlag ; For precise AI aiming + .DS 1 ;---------------------------------------------------- ;Erase .DS 1 ; if 1 only mask of the character is printed ; on the graphics screen. if 0 character is printed normally @@ -218,8 +218,8 @@ FallingSoundBit .DS 1 PreviousFall .DS 1 EndOfTheFallFlag .DS 1 ; in case of the infinite fall ;Parachute .DS 1 ; are you insured with parachute? -;FloatingAlt .DS 1 ; floating tank altitude -FunkyWallFlag = FloatingAlt ; reuse this variable in different weapon (Funky Bomb)! +;FloatingAlt .DS 1 ; floating tank altitude +FunkyWallFlag = FloatingAlt ; reuse this variable in different weapon (Funky Bomb)! PreferHumansFlag = FloatingAlt ; second reuse in AI Aim proc ;---------------------------------------------------- ;Flight @@ -235,7 +235,7 @@ MirvDown .DS [5] ; is given missile down? MirvMissileCounter .DS 1 ; missile Counter (mainly for X) SmokeTracerFlag .DS 1 ; if Smoketracer LaserFlag .DS 1 ; $ff if Laser -XposFlag .DS 1 ; bullet positon X (0 - on screen , %1000000 - off-screen) +XposFlag .DS 1 ; bullet positon X (0 - on screen , %1000000 - off-screen) YposFlag .DS 1 ; bullet positon Y (0 - on screen , %1000000 - over the screen , %0100000 - under the screen) ;---------------------------------------------------- ;CheckCollisionWithTank @@ -287,9 +287,9 @@ AfterBFGflag .DS 1 ; tables with indexes of weapons on the right lists ; OK (2022) so, L1 is list of offensive weapons, L2 - defensive IndexesOfWeaponsL1 - .ds (last_offensive_____ - first_offensive____+1) + .ds (last_offensive - first_offensive +1) IndexesOfWeaponsL2 - .ds (last_defensive_____ - first_defensive____+1) + .ds (last_defensive - first_defensive +1) ;---------------------------------------------------- ; variables storing amount of weapons on the first and second diff --git a/weapons.asm b/weapons.asm index ca511ac..23f5809 100644 --- a/weapons.asm +++ b/weapons.asm @@ -1,4 +1,4 @@ -; @com.wudsn.ide.asm.mainsourcefile=scorch.asm +; @com.wudsn.ide.asm.mainsourcefile=scorch.asm .IF *>0 ;this is a trick that prevents compiling this file alone ;-------------------------------------------------- @@ -8,7 +8,7 @@ ; ActiveWeapon(TankNr) - weapon that tank fires ;-------------------------------------------------- ;cleanup of the soil fall down ranges (left and right) - jsr ClearScreenSoilRange + jsr ClearScreenSoilRange ldx TankNr lda ActiveWeapon,x @@ -22,38 +22,38 @@ pha rts ExplosionRoutines - .word babymissile-1 ;Baby_Missile___;_00 - .word missile-1 ;Missile________;_01 - .word babynuke-1 ;Baby_Nuke______;_02 - .word nuke-1 ;Nuke___________;_03 - .word leapfrog-1 ;LeapFrog_______;_04 - .word funkybomb-1 ;Funky_Bomb_____;_05 - .word mirv-1 ;MIRV___________;_06 - .word deathshead-1 ;Death_s_Head___;_07 - .word napalm-1 ;Napalm_________;_08 - .word hotnapalm-1 ;Hot_Napalm_____;_09 - .word tracer-1 ;Tracer_________;_10 - .word tracer-1 ;Smoke_Tracer___;_11 - .word babyroller-1 ;Baby_Roller____;_12 - .word roller-1 ;Roller_________;_13 - .word heavyroller-1 ;Heavy_Roller___;_14 - .word riotcharge-1 ;Riot_Charge____;_15 - .word riotblast-1 ;Riot_Blast_____;_16 - .word riotbomb-1 ;Riot_Bomb______;_17 + .word babymissile-1 ;Baby_Missile ;_00 + .word missile-1 ;Missile ;_01 + .word babynuke-1 ;Baby_Nuke ;_02 + .word nuke-1 ;Nuke ;_03 + .word leapfrog-1 ;LeapFrog ;_04 + .word funkybomb-1 ;Funky_Bomb ;_05 + .word mirv-1 ;MIRV ;_06 + .word deathshead-1 ;Death_s_Head ;_07 + .word napalm-1 ;Napalm ;_08 + .word hotnapalm-1 ;Hot_Napalm ;_09 + .word tracer-1 ;Tracer ;_10 + .word tracer-1 ;Smoke_Tracer ;_11 + .word babyroller-1 ;Baby_Roller ;_12 + .word roller-1 ;Roller ;_13 + .word heavyroller-1 ;Heavy_Roller ;_14 + .word riotcharge-1 ;Riot_Charge ;_15 + .word riotblast-1 ;Riot_Blast ;_16 + .word riotbomb-1 ;Riot_Bomb ;_17 .word heavyriotbomb-1 ;Heavy_Riot_Bomb;_18 - .word babydigger-1 ;Baby_Digger____;_19 - .word digger-1 ;Digger_________;_20 - .word heavydigger-1 ;Heavy_Digger___;_21 - .word babysandhog-1 ;Baby_Sandhog___;_22 - .word sandhog-1 ;Sandhog________;_23 - .word heavysandhog-1 ;Heavy_Sandhog__;_24 - .word dirtclod-1 ;Dirt_Clod______;_25 - .word dirtball-1 ;Dirt_Ball______;_26 - .word tonofdirt-1 ;Ton_of_Dirt____;_27 - .word liquiddirt-1 ;Liquid_Dirt____;_28 - .word dirtcharge-1 ;Dirt_Charge____;_29 - .word BFG-1 ;Buy_me_________;_30 - .word laser-1 ;Laser__________;_31 + .word babydigger-1 ;Baby_Digger ;_19 + .word digger-1 ;Digger ;_20 + .word heavydigger-1 ;Heavy_Digger ;_21 + .word babysandhog-1 ;Baby_Sandhog ;_22 + .word sandhog-1 ;Sandhog ;_23 + .word heavysandhog-1 ;Heavy_Sandhog ;_24 + .word dirtclod-1 ;Dirt_Clod ;_25 + .word dirtball-1 ;Dirt_Ball ;_26 + .word tonofdirt-1 ;Ton_of_Dirt ;_27 + .word liquiddirt-1 ;Liquid_Dirt ;_28 + .word dirtcharge-1 ;Dirt_Charge ;_29 + .word BFG-1 ;Buy_me ;_30 + .word laser-1 ;Laser ;_31 VOID tracer @@ -61,19 +61,19 @@ tracer .endp .proc BFG mva #sfx_plasma_2_2 sfx_effect - jsr BFGblink - ; Kill all :) + jsr BFGblink + ; Kill all :) ldx NumberOfPlayers dex - lda #$00 + lda #$00 CheckNextTankBFG - cpx TankNr ; not me! - beq @+ + cpx TankNr ; not me! + beq @+ sta Energy,x @ dex bpl CheckNextTankBFG - stx AfterBFGflag ; $ff - rts + stx AfterBFGflag ; $ff + rts .endp ; ------------------------ .proc babymissile @@ -86,21 +86,21 @@ GoXmissile ; ------------------------ .proc missile ; mva #17 ExplosionRadius - bne babymissile.GoBabyMissileSFX + bne babymissile.GoBabyMissileSFX ; jmp xmissile .endp ; ------------------------ .proc babynuke mva #25 ExplosionRadius GoBabyNukeSFX - mva #sfx_nuke sfx_effect ; allways <>0 - bne babymissile.GoXmissile + mva #sfx_nuke sfx_effect ; allways <>0 + bne babymissile.GoXmissile ; jmp xmissile .endp ; ------------------------ .proc nuke mva #30 ExplosionRadius - bne babynuke.GoBabyNukeSFX + bne babynuke.GoBabyNukeSFX ; jmp xmissile .endp ; ------------------------ @@ -110,8 +110,8 @@ GoBabyNukeSFX ; jsr xmissile jsr babymissile.GoBabyMissileSFX - jsr SecondRepeat - + jsr SecondRepeat + SecondRepeat ; soil must fall down now! there is no other way... ; hide tanks or they fall down with soil @@ -126,7 +126,7 @@ SecondRepeat ror Force mva LeapFrogAngle Angle mva #sfx_funky_hit sfx_effect - sbw ytraj+1 #$05 ; next missiles start point goes 5 pixel UP to prevent multiple explosion at one point if tank is hit (4 pixels tank height + 1) + sbw ytraj+1 #$05 ; next missiles start point goes 5 pixel UP to prevent multiple explosion at one point if tank is hit (4 pixels tank height + 1) jsr Flight lda HitFlag beq EndOfLeapping @@ -145,7 +145,7 @@ EndOfLeapping .proc funkybomb ; mva #sfx_baby_missile sfx_effect mwa xtraj+1 xtrajfb - sbw ytraj+1 #$05 ytrajfb ; funky missiles start point goes 5 pixel UP to prevent multiple explosion at one point if tank is hit (4 pixels tank height + 1) + sbw ytraj+1 #$05 ytrajfb ; funky missiles start point goes 5 pixel UP to prevent multiple explosion at one point if tank is hit (4 pixels tank height + 1) ;central Explosion mva #21 ExplosionRadius jsr CalculateExplosionRange0 @@ -153,9 +153,9 @@ EndOfLeapping jsr SoilDown2 ; - jsr cleartanks ; maybe not? - mva #1 color - mva #0 FunkyWallFlag + jsr cleartanks ; maybe not? + mva #1 color + mva #0 FunkyWallFlag mva #5 FunkyBombCounter FunkyBombLoop mva #1 tracerflag @@ -174,19 +174,19 @@ FunkyBombLoop mwa ytrajfb ytraj+1 mva #sfx_funky_hit sfx_effect jsr Flight - mva #0 ExplosionRadius ; if no explosion (off screen) - ; if xdraw if over range then fix it - lda xdraw+1 - bpl NoOnLeftEdge - lda #0 - sta xdraw - sta xdraw+1 + mva #0 ExplosionRadius ; if no explosion (off screen) + ; if xdraw if over range then fix it + lda xdraw+1 + bpl NoOnLeftEdge + lda #0 + sta xdraw + sta xdraw+1 NoOnLeftEdge - cpw xdraw #screenwidth - bcc NoOnRightEdge - mwa #screenwidth xdraw + cpw xdraw #screenwidth + bcc NoOnRightEdge + mwa #screenwidth xdraw NoOnRightEdge - jsr CalculateExplosionRange ; add end of flight coordinates to soildown range + jsr CalculateExplosionRange ; add end of flight coordinates to soildown range lda HitFlag beq NoExplosionInFunkyBomb mva #sfx_baby_missile sfx_effect @@ -196,9 +196,9 @@ NoExplosionInFunkyBomb dec FunkyBombCounter bne FunkyBombLoop mva #0 tracerflag - lda FunkyWallFlag - beq NoWallsInFunky - jsr SetFullScreenSoilRange + lda FunkyWallFlag + beq NoWallsInFunky + jsr SetFullScreenSoilRange NoWallsInFunky rts .endp @@ -242,121 +242,121 @@ GoXmissileWithSaveXYdraw .endp ; ------------------------ .proc napalm - mva #0 HotNapalmFlag ; in this weapon - flag: 0 - napalm, 1 - hotnapalm - beq xnapalm + mva #0 HotNapalmFlag ; in this weapon - flag: 0 - napalm, 1 - hotnapalm + beq xnapalm .endp ; ------------------------ .proc hotnapalm - mva #1 HotNapalmFlag ; in this weapon - flag: 0 - napalm, 1 - hotnapalm -; jmp xnapalm + mva #1 HotNapalmFlag ; in this weapon - flag: 0 - napalm, 1 - hotnapalm +; jmp xnapalm .endp ; ------------------------ .proc xnapalm mva #sfx_napalm sfx_effect - mva #(napalmRadius+4) ExplosionRadius ; real radius + 4 pixels (half characrer width) + mva #(napalmRadius+4) ExplosionRadius ; real radius + 4 pixels (half characrer width) jsr CalculateExplosionRange - ; - mwa xdraw xcircle ; store hitpoint for future repeats - ldy #30 ; repeat 30 times - sty magic -RepeatNapalm ; external loop (for fire animation) - mwa xcircle xdraw - sbw xdraw #(napalmRadius) ; 10 pixels on left side hit point - ldy #0 - sty magic+1 -RepeatFlame ; internal loop (draw flames) - ldy #0 - adw xdraw #mountaintable temp - sty ydraw+1 - lda (temp),y - sec - sbc #1 ; over ground - sta ydraw - lda xdraw - and HotNapalmFlag ; if hotnapalm and x is odd: - :2 asl ; modify y position 4 pixels up - ldy ydraw - sta ydraw - tya - sec - sbc ydraw - sta ydraw - sbw xdraw #4 ; half character correction - ; draw flame symbol - lda magic ; if last repeat - clear flames - beq LastNapalmRepeat - lda random - and #%00000110 - clc - adc #char_flame___________ - bne PutFlameChar + ; + mwa xdraw xcircle ; store hitpoint for future repeats + ldy #30 ; repeat 30 times + sty magic +RepeatNapalm ; external loop (for fire animation) + mwa xcircle xdraw + sbw xdraw #(napalmRadius) ; 10 pixels on left side hit point + ldy #0 + sty magic+1 +RepeatFlame ; internal loop (draw flames) + ldy #0 + adw xdraw #mountaintable temp + sty ydraw+1 + lda (temp),y + sec + sbc #1 ; over ground + sta ydraw + lda xdraw + and HotNapalmFlag ; if hotnapalm and x is odd: + :2 asl ; modify y position 4 pixels up + ldy ydraw + sta ydraw + tya + sec + sbc ydraw + sta ydraw + sbw xdraw #4 ; half character correction + ; draw flame symbol + lda magic ; if last repeat - clear flames + beq LastNapalmRepeat + lda random + and #%00000110 + clc + adc #char_flame + bne PutFlameChar LastNapalmRepeat - lda #char_clear_flame_____ ; clear flame symbol + lda #char_clear_flame ; clear flame symbol PutFlameChar - sta CharCode - ; check coordinates - cpw xdraw #(screenwidth-7) - bcs CharOffTheScreen - lda ydraw - cmp #7 - bcc CharOffTheScreen - cmp #(screenHeight-1) - bcs CharOffTheScreen - jsr TypeChar + sta CharCode + ; check coordinates + cpw xdraw #(screenwidth-7) + bcs CharOffTheScreen + lda ydraw + cmp #7 + bcc CharOffTheScreen + cmp #(screenHeight-1) + bcs CharOffTheScreen + jsr TypeChar CharOffTheScreen - adw xdraw #4 ; reverse half character correction (we need positon of character center) - adw xdraw #1 ; next char 1 pixels to right - inc magic+1 - lda magic+1 - cmp #(2*napalmRadius+1) ; 10 pixels on left, 10 pixels on right and 1 in center - jne RepeatFlame - dec magic - jpl RepeatNapalm - ; after napalm + adw xdraw #4 ; reverse half character correction (we need positon of character center) + adw xdraw #1 ; next char 1 pixels to right + inc magic+1 + lda magic+1 + cmp #(2*napalmRadius+1) ; 10 pixels on left, 10 pixels on right and 1 in center + jne RepeatFlame + dec magic + jpl RepeatNapalm + ; after napalm ;now we must check tanks in range ldx NumberOfPlayers - dex + dex BurnedCheckLoop lda eXistenZ,x beq EndNurnedCheckLoop ;here the tank exist - ; calculate right edge of the fire - adw xcircle #(napalmRadius+4+4) xdraw ; 10 pixels on right side hit point + half character width + correction - ; now we compare tank position with right edge of the fire (napalm) + ; calculate right edge of the fire + adw xcircle #(napalmRadius+4+4) xdraw ; 10 pixels on right side hit point + half character width + correction + ; now we compare tank position with right edge of the fire (napalm) lda XtankstableH,x - cmp xdraw+1 - bne @+ + cmp xdraw+1 + bne @+ lda XtankstableL,x - cmp xdraw + cmp xdraw @ - bcs TankOutOfFire - ; let's calculate left edge of the fire - sbw xcircle #(napalmRadius+TankWidth+4-4) xdraw ; 10 pixels on left + character width (tank) + half character - correction - bpl @+ - mwa #0 xdraw ; left screen edge + bcs TankOutOfFire + ; let's calculate left edge of the fire + sbw xcircle #(napalmRadius+TankWidth+4-4) xdraw ; 10 pixels on left + character width (tank) + half character - correction + bpl @+ + mwa #0 xdraw ; left screen edge @ - ; now we compare tank position with left edge of the fire (napalm) + ; now we compare tank position with left edge of the fire (napalm) lda XtankstableH,x - cmp xdraw+1 - bne @+ + cmp xdraw+1 + bne @+ lda XtankstableL,x - cmp xdraw + cmp xdraw @ - bcc TankOutOfFire + bcc TankOutOfFire - ldy #40 ; energy decrease (napalm) - but if hotnapalm: - lda HotNapalmFlag - beq NotHot - ldy #80 ; energy decrease (hotnapalm) + ldy #40 ; energy decrease (napalm) - but if hotnapalm: + lda HotNapalmFlag + beq NotHot + ldy #80 ; energy decrease (hotnapalm) NotHot - ; check shields ( joke :) ) + ; check shields ( joke :) ) jsr DecreaseEnergyX TankOutOfFire EndNurnedCheckLoop dex bpl BurnedCheckLoop mva #sfx_silencer sfx_effect - rts + rts .endp ; ------------------------ .proc babyroller @@ -367,13 +367,13 @@ GoRoller ; ------------------------ .proc roller ; mva #21 ExplosionRadius - bne babyroller.GoRoller ; 1 byte saved + bne babyroller.GoRoller ; 1 byte saved ; jmp xroller .endp ; ------------------------ .proc heavyroller mva #30 ExplosionRadius - bne babyroller.GoRoller ; 1 byte saved + bne babyroller.GoRoller ; 1 byte saved ; jmp xroller .endp ; ------------------------ @@ -386,7 +386,7 @@ GoRiotBomb ; ------------------------ .proc heavyriotbomb mva #29 ExplosionRadius - bne riotbomb.GoRiotBomb ; 4 bytes saved - optimization :) + bne riotbomb.GoRiotBomb ; 4 bytes saved - optimization :) ; jsr CalculateExplosionRange ; jmp xriotbomb .endp @@ -394,7 +394,7 @@ GoRiotBomb .proc babydigger mva #1 diggery ; how many branches (-1) GoBabydiggerSFX - mva #sfx_digger sfx_effect + mva #sfx_digger sfx_effect mva #0 sandhogflag mva #13 DigLong bne xdigger @@ -536,7 +536,7 @@ DiggerCharacter lda random and #$06 clc - adc #char_digger__________ + adc #char_digger adc sandhogflag sta CharCode cpw xdraw #(screenwidth-6) @@ -606,13 +606,13 @@ dirtLoop ; ------------------------ .proc liquiddirt mva #sfx_liquid_dirt sfx_effect - mwa #510 FillCounter + mwa #510 FillCounter ; ----- - mwa xdraw TempXfill + mwa xdraw TempXfill RepeatFill - mwa TempXfill xdraw - jsr checkRollDirection - ; HowMuchToFall - direction + mwa TempXfill xdraw + jsr checkRollDirection + ; HowMuchToFall - direction ; $FF - we are in a hole (flying in missile direction) ; 1 - right, 2 - left adw xdraw #mountaintable tempXROLLER @@ -638,10 +638,10 @@ UpNotYet2 cmp #1 beq HowMuchToFallRight3 .NOWARN dew xdraw - lda xdraw - and xdraw+1 - cmp #$ff ; like cpw xdraw #$ffff - ;ora xdraw+1 ; like cpw xdraw #$0000 + lda xdraw + and xdraw+1 + cmp #$ff ; like cpw xdraw #$ffff + ;ora xdraw+1 ; like cpw xdraw #$0000 jne RollinContinuesLiquid beq FillNow HowMuchToFallRight3 @@ -651,29 +651,29 @@ HowMuchToFallRight3 FillNow ; finally one pixel more ldy #0 - lda HowMuchToFall - bmi FillHole - cmp #1 - beq FillLeft - inw xdraw - inw xdraw ; tricky but we must rollback xdraw in proper direction + lda HowMuchToFall + bmi FillHole + cmp #1 + beq FillLeft + inw xdraw + inw xdraw ; tricky but we must rollback xdraw in proper direction FillLeft -.nowarn dew xdraw +.nowarn dew xdraw FillHole adw xdraw #mountaintable tempXROLLER - lda (tempXROLLER),y - sta ydraw - beq ToHighFill ; if we filled all playfield (very rare but possible) - dec ydraw ; one pixel up - lda ydraw - sta (tempXROLLER),y ;mountaintable update - mva #1 color - jsr plot.MakePlot + lda (tempXROLLER),y + sta ydraw + beq ToHighFill ; if we filled all playfield (very rare but possible) + dec ydraw ; one pixel up + lda ydraw + sta (tempXROLLER),y ;mountaintable update + mva #1 color + jsr plot.MakePlot ToHighFill .nowarn dew FillCounter - lda FillCounter - ora FillCounter+1 - jne RepeatFill + lda FillCounter + ora FillCounter+1 + jne RepeatFill rts .endp ; ------------------------ @@ -688,7 +688,7 @@ ToHighFill mwa EndOfTheBarrelX xbyte mva EndOfTheBarrelY ybyte mva #0 ybyte+1 - sta LaserFlag ; turn on gravity and wind after shot :) + sta LaserFlag ; turn on gravity and wind after shot :) mwa xdraw LaserCoordinate mwa ydraw LaserCoordinate+2 @@ -696,29 +696,29 @@ ToHighFill mwa ybyte LaserCoordinate+6 mva #sfx_lightning sfx_effect - + mva #%10000000 drawFunction ;the above switches Draw to measuring length jsr draw mva #0 drawFunction - lsr LineLength+1 ; LineLength / 8 - ror LineLength - lsr LineLength ; max line lenght is about 380 (9 bits) - lsr LineLength - sec - lda #60 - sbc LineLength - sta yc ; laser blink counter 60-(LineLength/8) + lsr LineLength+1 ; LineLength / 8 + ror LineLength + lsr LineLength ; max line lenght is about 380 (9 bits) + lsr LineLength + sec + lda #60 + sbc LineLength + sta yc ; laser blink counter 60-(LineLength/8) @ lda yc - and #$01 - eor #$01 + and #$01 + eor #$01 sta color mwa LaserCoordinate xdraw mwa LaserCoordinate+2 ydraw mwa LaserCoordinate+4 xbyte mwa LaserCoordinate+6 ybyte - mva #sfx_lightning sfx_effect + mva #sfx_lightning sfx_effect jsr draw dec yc @@ -775,7 +775,7 @@ ExplosionLoop2 ;calculation ldx NumberOfPlayers - dex + dex DistanceCheckLoop lda eXistenZ,x jeq EndOfDistanceCheckLoop @@ -811,40 +811,40 @@ DistanceCheckLoop adc #1 :3 asl tay - ; check shields - lda ActiveDefenceWeapon,x - cmp #ind_Shield_________ ; one hit shield - beq UseShield - cmp #ind_Force_Shield___ ; shield with energy and parachute - beq UseShieldWithEnergy - cmp #ind_Heavy_Shield___ ; shield with energy - beq UseShieldWithEnergy - cmp #ind_Bouncy_Castle__ ; Auto Defence (it works only if hit ground next to tank. Tank hit is handled in Flight proc) - beq UseShieldWithEnergy - cmp #ind_Mag_Deflector__ ; Mag deflector (it works only if hit ground next to tank. Tank hit is handled in Flight proc) - beq UseShieldWithEnergy + ; check shields + lda ActiveDefenceWeapon,x + cmp #ind_Shield ; one hit shield + beq UseShield + cmp #ind_Force_Shield ; shield with energy and parachute + beq UseShieldWithEnergy + cmp #ind_Heavy_Shield ; shield with energy + beq UseShieldWithEnergy + cmp #ind_Bouncy_Castle ; Auto Defence (it works only if hit ground next to tank. Tank hit is handled in Flight proc) + beq UseShieldWithEnergy + cmp #ind_Mag_Deflector ; Mag deflector (it works only if hit ground next to tank. Tank hit is handled in Flight proc) + beq UseShieldWithEnergy jsr DecreaseEnergyX - jmp EndOfDistanceCheckLoop + jmp EndOfDistanceCheckLoop UseShieldWithEnergy - jsr DecreaseShieldEnergyX - cpy #0 ; is necessary to reduce tenk energy ? - beq ShieldCoveredTank + jsr DecreaseShieldEnergyX + cpy #0 ; is necessary to reduce tenk energy ? + beq ShieldCoveredTank jsr DecreaseEnergyX -ShieldCoveredTank - lda ShieldEnergy,x - jne EndOfDistanceCheckLoop -ShieldEnergy0 ; deactivate if no energy. it's like use one hit shield :) +ShieldCoveredTank + lda ShieldEnergy,x + jne EndOfDistanceCheckLoop +ShieldEnergy0 ; deactivate if no energy. it's like use one hit shield :) UseShield - lda TankNr - pha ; store TankNr - stx TankNr ; store X in TankNr :) - jsr ClearTankNr ; now erase tank with shield (to erase shield) - lda #0 - sta ActiveDefenceWeapon,x ; deactivate defense weapons - jsr PutTankNr ; draw tank without shield - ldx TankNr ; restore X value :) - pla - sta TankNr ; restore TankNr value :) + lda TankNr + pha ; store TankNr + stx TankNr ; store X in TankNr :) + jsr ClearTankNr ; now erase tank with shield (to erase shield) + lda #0 + sta ActiveDefenceWeapon,x ; deactivate defense weapons + jsr PutTankNr ; draw tank without shield + ldx TankNr ; restore X value :) + pla + sta TankNr ; restore TankNr value :) TankIsNotWithinTheRange EndOfDistanceCheckLoop dex @@ -872,8 +872,8 @@ rbombLoop .proc xroller ; ; now collisions are detected with modified draw routine ; therefore YDRAW value must be taken from mountaintable - jsr checkRollDirection - ; HowMuchToFall - direction + jsr checkRollDirection + ; HowMuchToFall - direction ; $FF - we are in a hole (flying in missile direction) ; 1 - right, 2 - left Rollin @@ -891,7 +891,7 @@ RollinContinues ldy #0 lda (tempXROLLER),y sta ydraw - sty ydraw+1 + sty ydraw+1 beq ExplodeNow cmp HeightRol beq UpNotYet @@ -902,7 +902,7 @@ UpNotYet sbc #1 sta ydraw ;check tank collision prior to PLOT - sty HitFlag ; set to 0 + sty HitFlag ; set to 0 jsr CheckCollisionWithTank @@ -915,8 +915,8 @@ UpNotYet beq HowMuchToFallRight2 .nowarn dew xdraw lda xdraw - ora xdraw+1 - jne RollinContinues ; like cpw xdraw #0 + ora xdraw+1 + jne RollinContinues ; like cpw xdraw #0 beq ExplodeNow HowMuchToFallRight2 inw xdraw @@ -951,7 +951,7 @@ ExplodeNow adw xdraw #mountaintable tempXROLLER lda (tempXROLLER),y sta ydraw - sty ydraw+1 + sty ydraw+1 lda vx+3 ; if horizontal velocity is negative then change the direction @@ -967,19 +967,19 @@ PositiveVelocity mva #$ff HowMuchToFall mva ydraw HeightRol SeekLeft - cpw tempXROLLER #mountaintable - beq GoRightNow ; "bounce" if we have on left end + cpw tempXROLLER #mountaintable + beq GoRightNow ; "bounce" if we have on left end .nowarn dew tempXROLLER lda (tempXROLLER),y ;fukk! beware of Y value cmp HeightRol HowMuchToFallLeft bcs GoRightNow - mva #1 HowMuchToFall + mva #1 HowMuchToFall GoRightNow adw xdraw #mountaintable tempXROLLER SeekRight - cpw tempXROLLER #(mountaintable+screenwidth) - beq HowMuchToFallKnown ; "stop" if we have on left end + cpw tempXROLLER #(mountaintable+screenwidth) + beq HowMuchToFallKnown ; "stop" if we have on left end inw tempXROLLER lda (tempXROLLER),y cmp HeightRol @@ -999,7 +999,7 @@ HowMuchToFallKnown adc goleft sta HowMuchToFall DirectionChecked - rts + rts .endp ; -------------------------------------------------- @@ -1080,15 +1080,15 @@ ContinueToCheckMaxForce2 sta ForceTableL,x @ jsr PutTankNameOnScreen -; jsr DisplayStatus ; There is no need anymore, it is always after PutTankNameOnScreen +; jsr DisplayStatus ; There is no need anymore, it is always after PutTankNameOnScreen jsr PutTankNr jsr WaitOneFrame ; best after drawing a tank - bit TestFlightFlag - bpl @+ - jsr Shoot.AfterOffensiveText ; Lazy Darwin - aiming visualisation + bit TestFlightFlag + bpl @+ + jsr Shoot.AfterOffensiveText ; Lazy Darwin - aiming visualisation @ ;keyboard reading ; KBCODE keeps code of last keybi @@ -1098,18 +1098,18 @@ ContinueToCheckMaxForce2 ; $f3 - shift+key notpressed - jsr CheckExitKeys ; Check for O, Esc or Start+Option keys - spl:rts ; exit if pressed 'Exit keys' + jsr CheckExitKeys ; Check for O, Esc or Start+Option keys + spl:rts ; exit if pressed 'Exit keys' - ldx TankNr ; for optimize - ; Select and Option - lda CONSOL - tay - and #%00000100 - beq callActivation ; Option key - tya - and #%00000010 - jeq pressedTAB ; Select key + ldx TankNr ; for optimize + ; Select and Option + lda CONSOL + tay + and #%00000100 + beq callActivation ; Option key + tya + and #%00000010 + jeq pressedTAB ; Select key lda SKSTAT cmp #$ff jeq checkJoy @@ -1124,31 +1124,31 @@ notpressed callActivation ; Hide all tanks - after inventory they may have other shapes jsr ClearTanks - jsr DefensivesActivate - jmp afterInventory + jsr DefensivesActivate + jmp afterInventory -@ +@ cmp #@kbcode._I ; $0d ; I bne @+ callInventory ; Hide all tanks - after inventory they may have other shapes jsr ClearTanks - ; + ; mva #$ff isInventory jsr Purchase afterInventory - jsr MakeDarkScreen + jsr MakeDarkScreen jsr DisplayStatus jsr SetMainScreen jsr DrawTanks ;jsr WaitOneFrame ; not necessary - bit LazyFlag - bvc NoLazy - jsr LazyBoys + bit LazyFlag + bvc NoLazy + jsr LazyBoys NoLazy - bit SpyHardFlag - bpl NoSpyHard - jsr SpyHard + bit SpyHardFlag + bpl NoSpyHard + jsr SpyHard NoSpyHard RmtSong song_ingame mva #0 escFlag @@ -1162,15 +1162,15 @@ NoSpyHard jeq CTRLPressedTAB jumpFromStick - .IF TARGET = 800 - cmp #$80|17 ; Ctrl+Help - bne NoVdebugSwitch - lda Vdebug - eor #$ff - sta Vdebug - jmp ReleaseAndLoop -NoVdebugSwitch - .ENDIF + .IF TARGET = 800 + cmp #$80|17 ; Ctrl+Help + bne NoVdebugSwitch + lda Vdebug + eor #$ff + sta Vdebug + jmp ReleaseAndLoop +NoVdebugSwitch + .ENDIF and #$3f ;CTRL and SHIFT ellimination cmp #@kbcode._up ; $e jeq pressedUp @@ -1188,14 +1188,14 @@ NoVdebugSwitch jeq pressedM cmp #@kbcode._S ; $3e ; S jeq pressedS - .IF TARGET = 800 - cmp #61 ; G - bne EndKeys - jsr SelectNextGradient.NotWind - jmp ReleaseAndLoop - .ENDIF + .IF TARGET = 800 + cmp #61 ; G + bne EndKeys + jsr SelectNextGradient.NotWind + jmp ReleaseAndLoop + .ENDIF EndKeys - jmp notpressed + jmp notpressed checkJoy ;------------JOY------------- ;happy happy joy joy @@ -1205,7 +1205,7 @@ checkJoy cmp #$0f beq notpressedJoy tay - mva #0 ATRACT ; reset atract mode + mva #0 ATRACT ; reset atract mode lda joyToKeyTable,y jmp jumpFromStick notpressedJoy @@ -1224,11 +1224,11 @@ pressedUp ;force increaseeee! - ;ldx TankNr ; optimized + ;ldx TankNr ; optimized inc ForceTableL,x bne CheckingMaxForce inc ForceTableH,x - + CheckingMaxForce mva #sfx_set_power_1 sfx_effect @@ -1249,7 +1249,7 @@ FurtherCheckMaxForce jmp BeforeFire CTRLPressedUp - ;ldx TankNr ; optimized + ;ldx TankNr ; optimized lda ForceTableL,x clc adc #10 @@ -1267,7 +1267,7 @@ pressedDown mva #sfx_set_power_1 sfx_effect - ;ldx TankNr ; optimized + ;ldx TankNr ; optimized dec ForceTableL,x lda ForceTableL,x cmp #$ff @@ -1284,7 +1284,7 @@ ForceGoesZero CTRLPressedDown mva #sfx_set_power_1 sfx_effect - ;ldx TankNr ; optimized + ;ldx TankNr ; optimized sec lda ForceTableL,x sbc #10 @@ -1295,15 +1295,15 @@ CTRLPressedDown jmp BeforeFire pressedRight - ;ldx TankNr ; optimized + ;ldx TankNr ; optimized lda pressTimer spl:mva #0 pressTimer ; if >128 then reset to 0 cmp #25 ; 1/2s bcs CTRLPressedRight mva #sfx_set_power_2 sfx_effect - mva #1 Erase - jsr DrawTankNr.BarrelChange + mva #1 Erase + jsr DrawTankNr.BarrelChange dec:lda AngleTable,x cmp #255 ; -1 jne BeforeFire @@ -1312,10 +1312,10 @@ pressedRight jmp BeforeFire CTRLPressedRight - ;ldx TankNr ; optimized + ;ldx TankNr ; optimized mva #sfx_set_power_2 sfx_effect - mva #1 Erase - jsr DrawTankNr.BarrelChange + mva #1 Erase + jsr DrawTankNr.BarrelChange lda AngleTable,x sec sbc #4 @@ -1328,15 +1328,15 @@ CTRLPressedRight pressedLeft - ;ldx TankNr ; optimized + ;ldx TankNr ; optimized lda pressTimer spl:mva #0 pressTimer ; if >128 then reset to 0 cmp #25 ; 1/2s bcs CTRLPressedLeft mva #sfx_set_power_2 sfx_effect - mva #1 Erase - jsr DrawTankNr.BarrelChange + mva #1 Erase + jsr DrawTankNr.BarrelChange INC AngleTable,x lda AngleTable,x cmp #180 @@ -1346,10 +1346,10 @@ pressedLeft jmp BeforeFire CTRLPressedLeft - ;ldx TankNr ; optimized + ;ldx TankNr ; optimized mva #sfx_set_power_2 sfx_effect - mva #1 Erase - jsr DrawTankNr.BarrelChange + mva #1 Erase + jsr DrawTankNr.BarrelChange lda AngleTable,x clc adc #4 @@ -1362,14 +1362,14 @@ CTRLPressedLeft pressedTAB mva #sfx_purchase sfx_effect - ;ldx TankNr ; optimized - lda ActiveWeapon,x - cmp #last_offensive_____ ; the last possible offensive weapon - bne ?notlasttofirst - lda #first_offensive____ ; #0 + ;ldx TankNr ; optimized + lda ActiveWeapon,x + cmp #last_offensive ; the last possible offensive weapon + bne ?notlasttofirst + lda #first_offensive ; #0 sta ActiveWeapon,x - beq @+ ; allways = 0 -?notlasttofirst + beq @+ ; allways = 0 +?notlasttofirst inc ActiveWeapon,x @ lda ActiveWeapon,x @@ -1379,13 +1379,13 @@ pressedTAB CTRLpressedTAB mva #sfx_purchase sfx_effect - ;ldx TankNr ; optimized - lda ActiveWeapon,x - cmp #first_offensive____ ; #0 - bne ?notfirsttolast - lda #last_offensive_____ ; the last possible offensive weapon + ;ldx TankNr ; optimized + lda ActiveWeapon,x + cmp #first_offensive ; #0 + bne ?notfirsttolast + lda #last_offensive ; the last possible offensive weapon sta ActiveWeapon,x - bne @+ ; allways <> 0 + bne @+ ; allways <> 0 ?notfirsttolast dec ActiveWeapon,x @ @@ -1412,8 +1412,8 @@ ReleaseAndLoop pressedSpace ;================================= ;we shoot here!!! - lda #0 - sta ATRACT ; reset atract mode + lda #0 + sta ATRACT ; reset atract mode sta pressTimer ; reset jsr WaitForKeyRelease.StillWait lda pressTimer @@ -1433,7 +1433,7 @@ fire ;with much more separate blocks, but you know - ;- do not touch it if it works... - mva #0 TestFlightFlag + mva #0 TestFlightFlag ;the latest addition to this routine is ;displaying offensive texts! @@ -1447,26 +1447,26 @@ RandomizeOffensiveText ldy TankNr mva #$ff plot4x4color jsr DisplayOffensiveTextNr - + AfterOffensiveText - mva #0 LaserFlag ; $ff - Laser - ldx TankNr - lda ActiveWeapon,x - cmp #ind_Laser__________ ; laser - bne NotStrongShoot - ; Laser: (not)very strong - invisible - shot for laser beam end coordinates - bit Vdebug - bmi @+ - mva #0 color -@ lda #1 - sta Force - sta Force+1 - mva #$ff LaserFlag ; $ff - Laser - bne AfterStrongShoot + mva #0 LaserFlag ; $ff - Laser + ldx TankNr + lda ActiveWeapon,x + cmp #ind_Laser ; laser + bne NotStrongShoot + ; Laser: (not)very strong - invisible - shot for laser beam end coordinates + bit Vdebug + bmi @+ + mva #0 color +@ lda #1 + sta Force + sta Force+1 + mva #$ff LaserFlag ; $ff - Laser + bne AfterStrongShoot NotStrongShoot - jsr Table2Force - bit TestFlightFlag - bmi AfterStrongShoot + jsr Table2Force + bit TestFlightFlag + bmi AfterStrongShoot mva #sfx_shoot sfx_effect AfterStrongShoot lda AngleTable,x @@ -1477,29 +1477,29 @@ AfterStrongShoot ; to start where the tank's barrel ends ; (without it bullet would go from the left lower corner of the tank) ;ldx TankNr - - mwa EndOfTheBarrelX xtraj+1 - mva EndOfTheBarrely ytraj+1 + + mwa EndOfTheBarrelX xtraj+1 + mva EndOfTheBarrely ytraj+1 lda #0 sta Force+2 - sta ytraj+2 + sta ytraj+2 sta xtraj sta ytraj - ; checking if the shot is underground (no Flight but Hit :) ) - tay ; A=0 ! - adw xtraj+1 #mountaintable temp + ; checking if the shot is underground (no Flight but Hit :) ) + tay ; A=0 ! + adw xtraj+1 #mountaintable temp lda ytraj+1 - cmp (temp),y ; check collision with mountains + cmp (temp),y ; check collision with mountains bcs ShotUnderGround jsr Flight mva #1 color rts ShotUnderGround - mwa xtraj+1 xdraw ; but why not XHit and YHit !!!??? - mwa ytraj+1 ydraw - mva #$ff HitFlag - rts + mwa xtraj+1 xdraw ; but why not XHit and YHit !!!??? + mwa ytraj+1 ydraw + mva #$ff HitFlag + rts .endp ;-------------------------------------------------- @@ -1524,18 +1524,18 @@ ShotUnderGround ; smoke tracer :) ldy #0 - bit TestFlightFlag ; if test flight for AI or Lazy Darwin - bmi noSmokeTracer ; no Smoke Tracer display + bit TestFlightFlag ; if test flight for AI or Lazy Darwin + bmi noSmokeTracer ; no Smoke Tracer display ldx TankNr lda ActiveWeapon,x - cmp #ind_Smoke_Tracer___ ; Smoke tracer - bne noSmokeTracer - iny + cmp #ind_Smoke_Tracer ; Smoke tracer + bne noSmokeTracer + iny noSmokeTracer - sty SmokeTracerFlag + sty SmokeTracerFlag RepeatIfSmokeTracer -RepeatFlight +RepeatFlight mwa ytraj+1 Ytrajold+1 mwa xtraj+1 Xtrajold+1 mva #%01000000 drawFunction @@ -1687,8 +1687,8 @@ Loopi sbc vy+3 sta ytraj+2 - bit LaserFlag ; no gravity if Laser - bmi NoGravity + bit LaserFlag ; no gravity if Laser + bmi NoGravity ;vy=vy-g (again without least significant byte of vy) sec lda vy+1 @@ -1703,11 +1703,11 @@ Loopi bpl StillUp ; where we know that the bullet starts to fall down ; we check if it is MIRV and if so, jump to MIRV routine - bit TestFlightFlag - bmi NoTestForMIRV + bit TestFlightFlag + bmi NoTestForMIRV ldx TankNr lda ActiveWeapon,x - cmp #ind_MIRV___________ ; MIRV + cmp #ind_MIRV ; MIRV jeq MIRVdownLoop NoTestForMIRV NoGravity @@ -1724,8 +1724,8 @@ StillUp adc vx+3 sta xtraj+2 - bit LaserFlag ; no wind if Laser - bmi NoWind + bit LaserFlag ; no wind if Laser + bmi NoWind clc .rept 4 lda vx+# @@ -1739,51 +1739,51 @@ NoWind mwa ytraj+1 ybyte jsr draw ;key - bit LaserFlag - bmi LaserNoWalls - ; Check for walls - jsr MakeWalls - ; + bit LaserFlag + bmi LaserNoWalls + ; Check for walls + jsr MakeWalls + ; LaserNoWalls mwa xtraj+1 XtrajOld+1 mwa ytraj+1 YtrajOld+1 - bit TestFlightFlag - bmi nowait - bit LaserFlag ; faster laser prepare - bpl nolaserwait - bit Vdebug - bpl nowait + bit TestFlightFlag + bmi nowait + bit LaserFlag ; faster laser prepare + bpl nolaserwait + bit Vdebug + bpl nowait nolaserwait lda color - beq nonowait ; smoke tracer erases slowly - lda tracerflag - bne nowait ; funky bomb explotes fast ( tracerflag in real is funkyflag :) ) + beq nonowait ; smoke tracer erases slowly + lda tracerflag + bne nowait ; funky bomb explotes fast ( tracerflag in real is funkyflag :) ) nonowait jsr shellDelay - ; - jsr CheckExitKeys ; Check for O, Esc or Start+Option keys - spl:rts ; exit if pressed 'Exit keys' - ldx TankNr + ; + jsr CheckExitKeys ; Check for O, Esc or Start+Option keys + spl:rts ; exit if pressed 'Exit keys' + ldx TankNr ; nowait lda HitFlag bne Hit - ; --- only for Laser - bit LaserFlag + ; --- only for Laser + bit LaserFlag bpl NoCheckEdgesForLaser - ; If laser fires, edges of the screen finish "flying" and laser hits. - lda ytraj+2 - bmi LaserHitEdge - cpw xtraj+1 #screenwidth ;+1 - bcc LaserNoHitEdge + ; If laser fires, edges of the screen finish "flying" and laser hits. + lda ytraj+2 + bmi LaserHitEdge + cpw xtraj+1 #screenwidth ;+1 + bcc LaserNoHitEdge LaserHitEdge mwa xdraw XHit mwa ydraw YHit - mva #$ff HitFlag ; screen edgs like ground (only for Laser) - jmp EndOfFlight + mva #$ff HitFlag ; screen edgs like ground (only for Laser) + jmp EndOfFlight LaserNoHitEdge - ; ------------------ + ; ------------------ NoCheckEdgesForLaser cpw ytraj+1 #screenheight+1 @@ -1797,17 +1797,17 @@ SkipCollisionCheck mwa xtraj+1 xdraw mwa ytraj+1 ydraw - - bit TestFlightFlag - bvc NoTestFlight - bit Vdebug - bpl NoUnplot - jsr WaitOneFrame ; visualize AI targeting - jmp YesUnPlot + + bit TestFlightFlag + bvc NoTestFlight + bit Vdebug + bpl NoUnplot + jsr WaitOneFrame ; visualize AI targeting + jmp YesUnPlot NoTestFlight - lda tracerflag + lda tracerflag bne NoUnPlot - + YesUnPlot jsr UnPlot @@ -1818,8 +1818,8 @@ NoUnPlot Hit mwa XHit xdraw mwa YHit ydraw - bit TestFlightFlag - bvs EndOfFlight + bit TestFlightFlag + bvs EndOfFlight jsr unPlot EndOfFlight mwa xdraw xcircle ; we must store for a little while @@ -1830,133 +1830,133 @@ EndOfFlight mwa xcircle xdraw mwa ycircle ydraw - ldy SmokeTracerFlag - beq EndOfFlight2 - dey - sty SmokeTracerFlag - jmp SecondFlight + ldy SmokeTracerFlag + beq EndOfFlight2 + dey + sty SmokeTracerFlag + jmp SecondFlight EndOfFlight2 - mva #0 tracerflag ; don't know why - - bit TestFlightFlag - jmi NoHitAtEndOfFight ; RTS only !!! - no defendsives check - ; and now check for defensive-aggressive weapon - lda HitFlag - jeq NoHitAtEndOfFight ; RTS only !!! - jmi NoTankHitAtEndOfFight - ; tank hit - increase direct hits points - ldx TankNr - inx - cpx HitFlag ; we don't count suicides :) - beq @+ - dex - inc DirectHits,x -; bne @+ ; one byte enough -; inc DirectHitsH,x + mva #0 tracerflag ; don't know why + + bit TestFlightFlag + jmi NoHitAtEndOfFight ; RTS only !!! - no defendsives check + ; and now check for defensive-aggressive weapon + lda HitFlag + jeq NoHitAtEndOfFight ; RTS only !!! + jmi NoTankHitAtEndOfFight + ; tank hit - increase direct hits points + ldx TankNr + inx + cpx HitFlag ; we don't count suicides :) + beq @+ + dex + inc DirectHits,x +; bne @+ ; one byte enough +; inc DirectHitsH,x @ - ; tank hit - check defensive weapon of this tank - tax - dex ; index of hitted tank in X - ldy TankNr - lda ActiveWeapon,y - cmp #ind_Tracer_________ ; defence not fire by tracers - beq JNoDefence - cmp #ind_Smoke_Tracer___ - beq JNoDefence - cmp #ind_Laser__________ ; Bouncy and Mag not fire by Laser - beq JNoDefence - lda ActiveDefenceWeapon,x - cmp #ind_Bouncy_Castle__ ; Auto Defence - jeq BouncyCastle - cmp #ind_Mag_Deflector__ ; Mag Deflector - beq MagDeflector + ; tank hit - check defensive weapon of this tank + tax + dex ; index of hitted tank in X + ldy TankNr + lda ActiveWeapon,y + cmp #ind_Tracer ; defence not fire by tracers + beq JNoDefence + cmp #ind_Smoke_Tracer + beq JNoDefence + cmp #ind_Laser ; Bouncy and Mag not fire by Laser + beq JNoDefence + lda ActiveDefenceWeapon,x + cmp #ind_Bouncy_Castle ; Auto Defence + jeq BouncyCastle + cmp #ind_Mag_Deflector ; Mag Deflector + beq MagDeflector JNoDefence - jmp NoDefence + jmp NoDefence MagDeflector - ; now run defensive-aggressive weapon - Mag Deflector! - ; get tank position - clc - lda xtankstableL,x - adc #$04 ; almost in tak center :) - sta XHit - lda xtankstableH,x - adc #$00 - sta XHit+1 - lda #$ff ; change to ground hit (we hope) - sta HitFlag - bit random ; left or right deflection ? - bpl RightDeflection + ; now run defensive-aggressive weapon - Mag Deflector! + ; get tank position + clc + lda xtankstableL,x + adc #$04 ; almost in tak center :) + sta XHit + lda xtankstableH,x + adc #$00 + sta XHit+1 + lda #$ff ; change to ground hit (we hope) + sta HitFlag + bit random ; left or right deflection ? + bpl RightDeflection LeftDeflection - sbw XHit #18 ; 18 pixels to left and explode... - bit XHit+1 ; if off-screen ... - bpl EndOfMagDeflector ; hit of course but we need RTS - adw XHit #36 ; change to right :) - jmp EndOfMagDeflector + sbw XHit #18 ; 18 pixels to left and explode... + bit XHit+1 ; if off-screen ... + bpl EndOfMagDeflector ; hit of course but we need RTS + adw XHit #36 ; change to right :) + jmp EndOfMagDeflector RightDeflection - adw XHit #18 ; 18 pixels to right and explode... - cpw XHit screenwidth ; if off-screen ... - bcs EndOfMagDeflector ; hit of course but we need RTS - sbw XHit #36 ; change to left + adw XHit #18 ; 18 pixels to right and explode... + cpw XHit screenwidth ; if off-screen ... + bcs EndOfMagDeflector ; hit of course but we need RTS + sbw XHit #36 ; change to left EndOfMagDeflector - lda TankNr - pha ; store TankNr - stx TankNr ; store X in TankNr :) - jsr ClearTankNr ; now erase tank with shield (to erase shield) - lda #0 - sta ActiveDefenceWeapon,x ; deactivate used mag deflector weapon - sta ShieldEnergy,x - jsr PutTankNr ; draw tank without shield - ldx TankNr ; restore X value :) - pla - sta TankNr ; restore TankNr value :) - mwa XHit xdraw ; why? !!! + lda TankNr + pha ; store TankNr + stx TankNr ; store X in TankNr :) + jsr ClearTankNr ; now erase tank with shield (to erase shield) + lda #0 + sta ActiveDefenceWeapon,x ; deactivate used mag deflector weapon + sta ShieldEnergy,x + jsr PutTankNr ; draw tank without shield + ldx TankNr ; restore X value :) + pla + sta TankNr ; restore TankNr value :) + mwa XHit xdraw ; why? !!! NoTankHitAtEndOfFight NoHitAtEndOfFight NoDefence - lsrw Force ; Force = Force / 2 - because earlier we multiplied by 2 - rts ; END !!! + lsrw Force ; Force = Force / 2 - because earlier we multiplied by 2 + rts ; END !!! BouncyCastle - ; now in Y we have number of of the attacking player (TankNr) ! - lda ActiveWeapon,y - ; if Bouncy Castle bounced Funky Bomb - whole screen in range of soil down - cmp #ind_Funky_Bomb_____ - bne @+ - jsr SetFullScreenSoilRange + ; now in Y we have number of of the attacking player (TankNr) ! + lda ActiveWeapon,y + ; if Bouncy Castle bounced Funky Bomb - whole screen in range of soil down + cmp #ind_Funky_Bomb + bne @+ + jsr SetFullScreenSoilRange @ mva #sfx_shield_on sfx_effect - ; now run defensive-aggressive weapon - Bouncy Castle (previously known as Auto Defence)! - lda TankNr - pha ; store TankNr - stx TankNr ; store X in TankNr :) - jsr ClearTankNr ; now erase tank with shield (to erase shield) - lda #0 - sta ActiveDefenceWeapon,x ; deactivate used auto defense weapon - sta ShieldEnergy,x - sta xtraj ; prepare coordinates + ; now run defensive-aggressive weapon - Bouncy Castle (previously known as Auto Defence)! + lda TankNr + pha ; store TankNr + stx TankNr ; store X in TankNr :) + jsr ClearTankNr ; now erase tank with shield (to erase shield) + lda #0 + sta ActiveDefenceWeapon,x ; deactivate used auto defense weapon + sta ShieldEnergy,x + sta xtraj ; prepare coordinates sta ytraj -; sta xtraj+2 -; sta ytraj+2 - jsr PutTankNr ; draw tank without shield -; ldx TankNr ; restore X value :) ... but we don't need X now .. - pla - sta TankNr ; restore TankNr value :) - sec - lda #180 - sbc LeapFrogAngle - sta Angle ; swap angle (LeapFrogAngle - because we have strored angle in this variable) - lsrw Force ; Force = Force / 2 - because earlier we multiplied by 2 - mwa XHit xtraj+1 - sbw YHit #5 ytraj+1 - mva #1 color - jmp RepeatFlight ; and repeat Fight +; sta xtraj+2 +; sta ytraj+2 + jsr PutTankNr ; draw tank without shield +; ldx TankNr ; restore X value :) ... but we don't need X now .. + pla + sta TankNr ; restore TankNr value :) + sec + lda #180 + sbc LeapFrogAngle + sta Angle ; swap angle (LeapFrogAngle - because we have strored angle in this variable) + lsrw Force ; Force = Force / 2 - because earlier we multiplied by 2 + mwa XHit xtraj+1 + sbw YHit #5 ytraj+1 + mva #1 color + jmp RepeatFlight ; and repeat Fight .endp .proc SecondFlight ; ---------------- copied code fragment from before firing. not too elegant. ; ---------------- get fire parameters again - ldx TankNr - jsr Table2Force + ldx TankNr + jsr Table2Force lda AngleTable,x sta Angle @@ -1965,22 +1965,22 @@ BouncyCastle ; to start where the tank's barrel ends ; (without it bullet would go from the left lower corner of the tank) ;ldx TankNr - - mwa EndOfTheBarrelX xtraj+1 - mva EndOfTheBarrely ytraj+1 + + mwa EndOfTheBarrelX xtraj+1 + mva EndOfTheBarrely ytraj+1 lda #0 sta Force+2 - sta ytraj+2 + sta ytraj+2 sta xtraj sta ytraj - sta color + sta color - + ldy #100 ; ??? - mva #1 tracerflag ; I do not know (I mean I think I know ;) ) - ; 10 years later - I do not know!!! + mva #1 tracerflag ; I do not know (I mean I think I know ;) ) + ; 10 years later - I do not know!!! ; 20 years later - still do not know :] - jmp Flight.RepeatIfSmokeTracer + jmp Flight.RepeatIfSmokeTracer .endp ; ------------------------------------------------- @@ -2057,18 +2057,18 @@ MIRVcopyParameters sta vx03+4 ; clearing ranges of soil down registers - jsr ClearScreenSoilRange + jsr ClearScreenSoilRange ldx #$FF ; it will turn 0 in a moment anyway stx MirvMissileCounter mrLoopi - ldx MirvMissileCounter - inx - cpx #5 - bne @+ - ldx #0 -@ stx MirvMissileCounter - + ldx MirvMissileCounter + inx + cpx #5 + bne @+ + ldx #0 +@ stx MirvMissileCounter + ; Y changes only for bullet number 0 ; because rest of the bullets have the same Y (height) @@ -2099,14 +2099,14 @@ mrLoopi sta vy+3 jsr ShellDelay - ; - phx - jsr CheckExitKeys ; Check for O, Esc or Start+Option keys - bpl ExitnotPressed - plx - rts ; exit if pressed 'Exit keys' + ; + phx + jsr CheckExitKeys ; Check for O, Esc or Start+Option keys + bpl ExitnotPressed + plx + rts ; exit if pressed 'Exit keys' ExitnotPressed - plx + plx ; MIRVdoNotChangeY @@ -2134,63 +2134,63 @@ MIRVdoNotChangeY sta vx+# .endr - ; rules for a falling MIRV bulets. - ; if Y is negative and any X (bullet over the screen) - continue flying - ; if (Y>=0 and Y<=screenhight) and X>screenwidth (bullet off-screen on the left or right side) - continue flying - ; if (Y>=0 and Y<=screenhight) and X<=screenwidth (bullet on the screen) - check collision - ; if Y>screenhight and X>screenwidth (bullet under the screen on the left or right side) - stop flying without hit - ; if Y>screenhight and X<=screenwidth (bullet under the screen) - check collision (allways hit) - - ; check bullet position and set flags: - ; XposFlag - bullet positon X (0 - on screen , %1000000 - off-screen) - ; YposFlag - bullet positon Y (0 - on screen , %1000000 - over the screen , %0100000 - under the screen) - lda #$00 - sta XposFlag - sta YposFlag - lda ytraj+2 ; Y high byte - bpl @+ - mva #%10000000 YposFlag ; bullet over the screen (Y) - bmi MIRVsetXflag + ; rules for a falling MIRV bulets. + ; if Y is negative and any X (bullet over the screen) - continue flying + ; if (Y>=0 and Y<=screenhight) and X>screenwidth (bullet off-screen on the left or right side) - continue flying + ; if (Y>=0 and Y<=screenhight) and X<=screenwidth (bullet on the screen) - check collision + ; if Y>screenhight and X>screenwidth (bullet under the screen on the left or right side) - stop flying without hit + ; if Y>screenhight and X<=screenwidth (bullet under the screen) - check collision (allways hit) + + ; check bullet position and set flags: + ; XposFlag - bullet positon X (0 - on screen , %1000000 - off-screen) + ; YposFlag - bullet positon Y (0 - on screen , %1000000 - over the screen , %0100000 - under the screen) + lda #$00 + sta XposFlag + sta YposFlag + lda ytraj+2 ; Y high byte + bpl @+ + mva #%10000000 YposFlag ; bullet over the screen (Y) + bmi MIRVsetXflag @ - lda ytraj+1 ; Y low byte - cmp #screenheight - bcc MIRVsetXflag ; bullet on screen (Y) - mva #%01000000 YposFlag ; bullet under the screen (Y) + lda ytraj+1 ; Y low byte + cmp #screenheight + bcc MIRVsetXflag ; bullet on screen (Y) + mva #%01000000 YposFlag ; bullet under the screen (Y) MIRVsetXflag - lda xtraj02,x ; X high byte + lda xtraj02,x ; X high byte cmp #>screenwidth - bne @+ - lda xtraj01,x ; X low byte + bne @+ + lda xtraj01,x ; X low byte cmp #mountaintable sta temp+1 lda (temp),y - sec - sbc #1 + sec + sbc #1 sta ydraw sty ydraw+1 ;we know that y=0 jsr missile ; explode .... @@ -2305,61 +2305,61 @@ MIRValreadyAll ; temporary removing tanks from the screen (otherwise they will fall down with soil) jsr SoilDown2 - mva #$ff HitFlag ; but why ?? + mva #$ff HitFlag ; but why ?? rts .endp ; ------------------------------------------------- .proc MakeWalls ; ------------------------------------------------- - bit WallsType ; ; bits 6 and 7: 00 - none, 01 - bump, 10 - wrap, 11 - boxy - bpl WrapAndNone - bvc MakeBump - ; top bounce - bit ytraj+2 - bpl NoOnTop - bit vy+3 - bmi FlyingDown - sec - .rept 4 + bit WallsType ; ; bits 6 and 7: 00 - none, 01 - bump, 10 - wrap, 11 - boxy + bpl WrapAndNone + bvc MakeBump + ; top bounce + bit ytraj+2 + bpl NoOnTop + bit vy+3 + bmi FlyingDown + sec + .rept 4 lda #$00 sbc vy+# sta vy+# - .endr + .endr FlyingDown NoOnTop MakeBump - cpw xtraj+1 #screenwidth - bcc OnScreen - ; inverse vx (bouncing wall) - sec - .rept 4 + cpw xtraj+1 #screenwidth + bcc OnScreen + ; inverse vx (bouncing wall) + sec + .rept 4 lda #$00 sbc vx+# sta vx+# .endr - ; and bouce feapfrog :) - sec - lda #180 - sbc LeapFrogAngle - sta LeapFrogAngle ; swap angle (LeapFrogAngle) - inc FunkyWallFlag - rts + ; and bouce feapfrog :) + sec + lda #180 + sbc LeapFrogAngle + sta LeapFrogAngle ; swap angle (LeapFrogAngle) + inc FunkyWallFlag + rts WrapAndNone - bvc NoWall - cpw xtraj+1 #screenwidth - bcc OnScreen - ; (wrapping wall) - inc FunkyWallFlag - bit xtraj+2 - bmi LeftWrap + bvc NoWall + cpw xtraj+1 #screenwidth + bcc OnScreen + ; (wrapping wall) + inc FunkyWallFlag + bit xtraj+2 + bmi LeftWrap RightWrap - sbw xtraj+1 #screenwidth - rts + sbw xtraj+1 #screenwidth + rts LeftWrap - adw xtraj+1 #screenwidth + adw xtraj+1 #screenwidth OnScreen NoWall - rts + rts .endp ; ------------------------------------------------- .proc WhiteFlag @@ -2368,20 +2368,20 @@ NoWall ; and replaces Shoot and Flight routines ; X and TankNr - index of shooting tank ; ------------------------------------------------- - mva #sfx_death_begin sfx_effect - jsr FlashTank ; first we flash tank - jsr ClearTankNr ; and erase tank - lda #0 - sta Erase - ldx TankNr - sta Energy,x ; clear tank energy - sta eXistenZ,x ; erase from existence - sta LASTeXistenZ,x ; to prevent explosion - sta ActiveDefenceWeapon,x ; deactivate White Flag - jsr PMoutofScreen - jsr drawtanks ; for restore PM + mva #sfx_death_begin sfx_effect + jsr FlashTank ; first we flash tank + jsr ClearTankNr ; and erase tank + lda #0 + sta Erase + ldx TankNr + sta Energy,x ; clear tank energy + sta eXistenZ,x ; erase from existence + sta LASTeXistenZ,x ; to prevent explosion + sta ActiveDefenceWeapon,x ; deactivate White Flag + jsr PMoutofScreen + jsr drawtanks ; for restore PM mva #sfx_silencer sfx_effect - rts + rts .endp ; ------------------------------------------------- @@ -2390,92 +2390,92 @@ NoWall ; This routine is run from inside of the main loop ; X - index of tank ; ------------------------------------------------- - jsr PrepareAIShoot.WepTableToTemp - jsr UseBattery - jsr TosserDefensives - rts + jsr PrepareAIShoot.WepTableToTemp + jsr UseBattery + jsr TosserDefensives + rts .endp ; ------------------------------------------------- .proc SpyHard ; ------------------------------------------------- - mvx TankNr TargetTankNr ; save + mvx TankNr TargetTankNr ; save RepeatSpy - mvx #0 TankNr - stx SpyHardFlag ; 0 - optimization + mvx #0 TankNr + stx SpyHardFlag ; 0 - optimization CheckNextTankSH - cpx TargetTankNr - beq ThisTankItsMe - lda Energy,x ; only active players + cpx TargetTankNr + beq ThisTankItsMe + lda Energy,x ; only active players beq ThisTankIsDead - ; run SpyHard for tank in X - jsr DisplaySpyInfo - jsr FlashTank -@ jsr GetKey + ; run SpyHard for tank in X + jsr DisplaySpyInfo + jsr FlashTank +@ jsr GetKey bit escFlag bmi SpyHardEnd - cmp #@kbcode._space ; $21 ; Space - beq SpyHardEnd - cmp #@kbcode._ret ; Return key (5200 - fire) - beq SpyHardEnd + cmp #@kbcode._space ; $21 ; Space + beq SpyHardEnd + cmp #@kbcode._ret ; Return key (5200 - fire) + beq SpyHardEnd cmp #@kbcode._left ; $6 - beq SelectNextTank + beq SelectNextTank cmp #@kbcode._right ; $07 ; cursor right - bne @- + bne @- ThisTankIsDead ThisTankItsMe SelectNextTank inc TankNr - ldx TankNr - cpx NumberOfPlayers + ldx TankNr + cpx NumberOfPlayers bne CheckNextTankSH - beq RepeatSpy + beq RepeatSpy SpyHardEnd - mvx TargetTankNr TankNr ; restore - jsr DisplaySpyInfo - rts + mvx TargetTankNr TankNr ; restore + jsr DisplaySpyInfo + rts .endp .proc DisplaySpyInfo lda TankStatusColoursTable,x sta COLOR2 ; set color of status line jsr PutTankNameOnScreen -; jsr DisplayStatus ; There is no need anymore, it is always after PutTankNameOnScreen - rts +; jsr DisplayStatus ; There is no need anymore, it is always after PutTankNameOnScreen + rts .endp ; ------------------------------------------------- .proc LazyBoys ; ------------------------------------------------- mva #sfx_lazy_boys sfx_effect - jsr PrepareAIShoot - ldx TankNr - bit LazyFlag - bmi GoDarwin - jsr FindBestTarget2 ; find nearest tank neighbour - jsr LazyAim - lda #%00000000 ; set "visual aiming" off - beq EndLazy + jsr PrepareAIShoot + ldx TankNr + bit LazyFlag + bmi GoDarwin + jsr FindBestTarget2 ; find nearest tank neighbour + jsr LazyAim + lda #%00000000 ; set "visual aiming" off + beq EndLazy GoDarwin - jsr FindBestTarget3 ; find target with lowest energy - jsr LazyAim - lda #%10000000 + jsr FindBestTarget3 ; find target with lowest energy + jsr LazyAim + lda #%10000000 EndLazy - sta TestFlightFlag ; set "visual aiming" on - mva #0 LazyFlag - rts + sta TestFlightFlag ; set "visual aiming" on + mva #0 LazyFlag + rts .endp .proc LazyAim - ; aiming proc for Lazy ... weapons - ; as proc for memory optimisation - ; Y - target tan nr - ; A - target direction - sty TargetTankNr - ; aiming - jsr TakeAim ; direction still in A (0 - left, >0 - right) - lda Force - sta ForceTableL,x - lda Force+1 - sta ForceTableH,x - jsr MoveBarrelToNewPosition - rts + ; aiming proc for Lazy ... weapons + ; as proc for memory optimisation + ; Y - target tan nr + ; A - target direction + sty TargetTankNr + ; aiming + jsr TakeAim ; direction still in A (0 - left, >0 - right) + lda Force + sta ForceTableL,x + lda Force+1 + sta ForceTableH,x + jsr MoveBarrelToNewPosition + rts .endp ; ------------------------------------------------- .proc TankFlying @@ -2484,100 +2484,100 @@ EndLazy ; and replaces Shoot and Flight routines ; X and TankNr - index of flying tank ; ------------------------------------------------- - ; Let's designate the flight altitude. - jsr CheckMaxMountain - cmp #(12+18) ; tank with shield (12) and max alt (18) check - bcc IsToHigh - sbc #12 ; tank with shield high correction - bne StoreMaxAlt -IsToHigh - lda #18 + ; Let's designate the flight altitude. + jsr CheckMaxMountain + cmp #(12+18) ; tank with shield (12) and max alt (18) check + bcc IsToHigh + sbc #12 ; tank with shield high correction + bne StoreMaxAlt +IsToHigh + lda #18 StoreMaxAlt - sta FloatingAlt -; mva #18 FloatingAlt ; for testing + sta FloatingAlt +; mva #18 FloatingAlt ; for testing mva #sfx_plasma_2_2 sfx_effect - ; display text 4x4 - fuel full + ; display text 4x4 - fuel full mwa #hoverFull LineAddress4x4 mwa #((ScreenWidth/2)-((hoverFullEnd-hoverFull)*2)) LineXdraw ; centering - mva #hoverFullEnd-hoverFull-1 fx ; length - sec - lda FloatingAlt - sbc #12 + mva #hoverFullEnd-hoverFull fx ; length + sec + lda FloatingAlt + sbc #12 sta LineYdraw jsr TypeLine4x4.variableLength - ldx TankNr - - ; TankNr in X reg. - ; now animate Up - mva #0 modify ; it's a counter + ldx TankNr + + ; TankNr in X reg. + ; now animate Up + mva #0 modify ; it's a counter TankGoUp - lda ytankstable,x - cmp FloatingAlt ; Floating altitude - bcc ReachSky - ; first erase old tank position + lda ytankstable,x + cmp FloatingAlt ; Floating altitude + bcc ReachSky + ; first erase old tank position jsr ClearTankNr - lda modify - cmp #5 - bcc NoEngineClear - mva #0 color - jsr DrawTankRocketEngine + lda modify + cmp #5 + bcc NoEngineClear + mva #0 color + jsr DrawTankRocketEngine NoEngineClear - dec ytankstable,x - inc modify - ; then draw tank on new position + dec ytankstable,x + inc modify + ; then draw tank on new position jsr PutTankNr - lda modify - cmp #5 - bcc NoEngine - lda random - and #%00000001 - sta color - jsr DrawTankRocketEngine + lda modify + cmp #5 + bcc NoEngine + lda random + and #%00000001 + sta color + jsr DrawTankRocketEngine NoEngine -; jsr WaitOneFrame - jmp TankGoUp +; jsr WaitOneFrame + jmp TankGoUp ReachSky - ; engine symbol erase - mva #0 color - jsr DrawTankRocketEngine + ; engine symbol erase + mva #0 color + jsr DrawTankRocketEngine - ; display text 4x4 - fuel full (clear text) + ; display text 4x4 - fuel full (clear text) mwa #hoverFull LineAddress4x4 mwa #((ScreenWidth/2)-((hoverFullEnd-hoverFull)*2)) LineXdraw ; centering - mva #(hoverFullEnd-hoverFull-1) fx ; length - sec - lda FloatingAlt - sbc #12 + mva #(hoverFullEnd-hoverFull) fx ; length + sec + lda FloatingAlt + sbc #12 sta LineYdraw lda #$00 jsr TypeLine4x4.staplot4x4color - ; and Soildown at the start (for correct mountaintable if tank was buried) - ; calculate range - ldx TankNr - sec - lda XtankstableL,x - sbc #2 - sta RangeLeft - lda XtankstableH,x - sbc #0 - sta RangeLeft+1 - clc - lda XtankstableL,x - adc #10 - sta RangeRight - lda XtankstableH,x - adc #0 - sta RangeRight+1 - ; hide tanks and ... - jsr SoilDown2 - jsr ClearScreenSoilRange - ldx TankNr + ; and Soildown at the start (for correct mountaintable if tank was buried) + ; calculate range + ldx TankNr + sec + lda XtankstableL,x + sbc #2 + sta RangeLeft + lda XtankstableH,x + sbc #0 + sta RangeLeft+1 + clc + lda XtankstableL,x + adc #10 + sta RangeRight + lda XtankstableH,x + adc #0 + sta RangeRight+1 + ; hide tanks and ... + jsr SoilDown2 + jsr ClearScreenSoilRange + ldx TankNr - ; check keyboard/joy and move tank left/right - code copied from BeforeFire + ; check keyboard/joy and move tank left/right - code copied from BeforeFire ;keyboard reading ; KBCODE keeps code of last keybi ; SKSTAT $ff - nothing pressed @@ -2586,30 +2586,30 @@ ReachSky ; $f3 - shift+key KeyboardAndJoyCheck mva #sfx_tank_move sfx_effect - lda ShieldEnergy,x - cmp #20 - bne LotOfFuel - - ; display text 4x4 - low fuel + lda ShieldEnergy,x + cmp #20 + bne LotOfFuel + + ; display text 4x4 - low fuel mwa #hoverEmpty LineAddress4x4 mwa #((ScreenWidth/2)-((hoverEmptyEnd-hoverEmpty)*2)) LineXdraw ; centering - mva #hoverEmptyEnd-hoverEmpty-1 fx ; length - sec - lda FloatingAlt - sbc #12 + mva #hoverEmptyEnd-hoverEmpty fx ; length + sec + lda FloatingAlt + sbc #12 sta LineYdraw jsr TypeLine4x4.variableLength LotOfFuel notpressed - jsr CheckExitKeys + jsr CheckExitKeys spl:rts ;---Exit key pressed-quit game--- - ldx TankNr + ldx TankNr - ; let's animate "engine" - jsr DrawTankEngine - ; enimation ends - + ; let's animate "engine" + jsr DrawTankEngine + ; enimation ends + lda SKSTAT cmp #$ff jeq checkJoy @@ -2646,118 +2646,118 @@ notpressedJoy pressedRight - lda ShieldEnergy,x - jeq pressedSpace - ldy #1 - jsr DecreaseShieldEnergyX - ; first erase old tank position + lda ShieldEnergy,x + jeq pressedSpace + ldy #1 + jsr DecreaseShieldEnergyX + ; first erase old tank position jsr ClearTankNr - mva #0 Erase - lda XtankstableH,x - cmp #>(screenwidth-TankWidth-4) ; tank width correction +4 - bne @+ - lda XtankstableL,x - cmp #<(screenwidth-TankWidth-4) ; tank width correction +4 pixels -@ bcs RightScreenEdge - inc XtankstableL,x - sne:inc XtankstableH,x - jmp NoREdge + mva #0 Erase + lda XtankstableH,x + cmp #>(screenwidth-TankWidth-4) ; tank width correction +4 + bne @+ + lda XtankstableL,x + cmp #<(screenwidth-TankWidth-4) ; tank width correction +4 pixels +@ bcs RightScreenEdge + inc XtankstableL,x + sne:inc XtankstableH,x + jmp NoREdge RightScreenEdge mva #sfx_dunno sfx_effect NoREdge - mva #18 AngleTable,x - bne DrawFloatingTank ; then draw tank on new position + mva #18 AngleTable,x + bne DrawFloatingTank ; then draw tank on new position pressedLeft - lda ShieldEnergy,x - beq pressedSpace - ldy #1 - jsr DecreaseShieldEnergyX - ; first erase old tank position + lda ShieldEnergy,x + beq pressedSpace + ldy #1 + jsr DecreaseShieldEnergyX + ; first erase old tank position jsr ClearTankNr - lda XtankstableH,x - cmp #0 - bne @+ - lda XtankstableL,x - cmp #5 ; 4 pixles from left edge -@ bcc LeftScreenEdge - dec XtankstableL,x - lda XtankstableL,x - cmp #$ff - sne:dec XtankstableH,x - jmp NoLEdge + lda XtankstableH,x + cmp #0 + bne @+ + lda XtankstableL,x + cmp #5 ; 4 pixles from left edge +@ bcc LeftScreenEdge + dec XtankstableL,x + lda XtankstableL,x + cmp #$ff + sne:dec XtankstableH,x + jmp NoLEdge LeftScreenEdge mva #sfx_dunno sfx_effect NoLEdge - mva #162 AngleTable,x - ; then draw tank on new position + mva #162 AngleTable,x + ; then draw tank on new position DrawFloatingTank jsr PutTankNr - jsr DisplayStatus - jsr WaitOneFrame - jsr CalculateSoildown + jsr DisplayStatus + jsr WaitOneFrame + jsr CalculateSoildown jmp KeyboardAndJoyCheck pressedSpace - ; display text 4x4 - low fuel (clear text) + ; display text 4x4 - low fuel (clear text) mwa #hoverEmpty LineAddress4x4 mwa #((ScreenWidth/2)-((hoverEmptyEnd-hoverEmpty)*2)) LineXdraw ; centering - mva #hoverEmptyEnd-hoverEmpty-1 fx ; length - sec - lda FloatingAlt - sbc #12 + mva #hoverEmptyEnd-hoverEmpty fx ; length + sec + lda FloatingAlt + sbc #12 sta LineYdraw lda #$00 jsr TypeLine4x4.staplot4x4color - ldx TankNr + ldx TankNr ;================================= - ; left or right from center of screen ? - ldy #0 + ; left or right from center of screen ? + ldy #0 lda XtankstableH,x - cmp #>((screenwidth/2)-TankWidth) - bne @+ + cmp #>((screenwidth/2)-TankWidth) + bne @+ lda XtankstableL,x - cmp #<((screenwidth/2)-TankWidth) -@ bcc TankOnLeftSide + cmp #<((screenwidth/2)-TankWidth) +@ bcc TankOnLeftSide TankOnRightSide - dey + dey TankOnLeftSide - sty OverTankDir ; (0 go right, $ff go left) - ; now we have direction of bypassing tanks on screen + sty OverTankDir ; (0 go right, $ff go left) + ; now we have direction of bypassing tanks on screen - ; clear "engine pixels" under tank + ; clear "engine pixels" under tank mva #1 erase - jsr DrawTankEngine + jsr DrawTankEngine CheckForTanksBelow - lda XtankstableL,x - sta xdraw - lda XtankstableH,x - sta xdraw+1 - ldx NumberOfPlayers - dex + lda XtankstableL,x + sta xdraw + lda XtankstableH,x + sta xdraw+1 + ldx NumberOfPlayers + dex CheckCollisionWithTankLoop - cpx TankNr - beq ItIsMe - lda eXistenZ,x - beq DeadTank - ; now we use Y as low byte and A as high byte of checked position (left right edgs of shield) - ; it is tricky but fast and much shorter + cpx TankNr + beq ItIsMe + lda eXistenZ,x + beq DeadTank + ; now we use Y as low byte and A as high byte of checked position (left right edgs of shield) + ; it is tricky but fast and much shorter lda xtankstableL,x - sec - sbc #9 ; 2 pixels more on left side + tank width - tay - lda xtankstableH,x - sbc #0 - ; bmi ShieldOverLeftEdge ; I do not know whether to check it. Probably not :) !!! + sec + sbc #9 ; 2 pixels more on left side + tank width + tay + lda xtankstableH,x + sbc #0 + ; bmi ShieldOverLeftEdge ; I do not know whether to check it. Probably not :) !!! cmp xdraw+1 bne @+ cpy xdraw @ bcs LeftFromTheTank - tya ;add 20 (tank size*2 +2 and +2) + tya ;add 20 (tank size*2 +2 and +2) clc - adc #20 + adc #20 tay lda xtankstableH,x adc #0 @@ -2767,105 +2767,105 @@ CheckCollisionWithTankLoop @ bcc RightFromTheTank TankBelow - ; tank below - we must move our tank - ldx TankNr - ; first erase old tank position + ; tank below - we must move our tank + ldx TankNr + ; first erase old tank position jsr ClearTankNr - bit OverTankDir - bmi PassLeft + bit OverTankDir + bmi PassLeft PassRight - inc XtankstableL,x - sne:inc XtankstableH,x - mva #18 AngleTable,x - bne Bypassing + inc XtankstableL,x + sne:inc XtankstableH,x + mva #18 AngleTable,x + bne Bypassing PassLeft - dec XtankstableL,x - lda XtankstableL,x - cmp #$ff - sne:dec XtankstableH,x - mva #162 AngleTable,x + dec XtankstableL,x + lda XtankstableL,x + cmp #$ff + sne:dec XtankstableH,x + mva #162 AngleTable,x Bypassing - ; then draw tank on new position + ; then draw tank on new position jsr PutTankNr - jmp CheckForTanksBelow + jmp CheckForTanksBelow RightFromTheTank LeftFromTheTank DeadTank ItIsMe dex bpl CheckCollisionWithTankLoop - ldx TankNr + ldx TankNr mva #sfx_shield_off sfx_effect jsr ClearTankNr - mva #0 Erase - ; x correction for P/M - ; -- - .IF XCORRECTION_FOR_PM = 1 - lda XtankstableL,x - and #%11111110 ; correction for PM - sta XtankstableL,x - .ENDIF - ; -- + mva #0 Erase + ; x correction for P/M + ; -- + .IF XCORRECTION_FOR_PM = 1 + lda XtankstableL,x + and #%11111110 ; correction for PM + sta XtankstableL,x + .ENDIF + ; -- GoDown - mwa #mountaintable temp - clc - lda temp - adc XtankstableL,x - sta temp - lda temp+1 - adc XtankstableH,x - sta temp+1 - adw temp #4 ; center of the tank - ldy #0 - lda (temp),y - sta OverTankDir ; not elegant!!! Reuse as height of tank flight + mwa #mountaintable temp + clc + lda temp + adc XtankstableL,x + sta temp + lda temp+1 + adc XtankstableH,x + sta temp+1 + adw temp #4 ; center of the tank + ldy #0 + lda (temp),y + sta OverTankDir ; not elegant!!! Reuse as height of tank flight FloatDown - lda ytankstable,x - cmp OverTankDir - bcs OnGround - ; first erase old tank position + lda ytankstable,x + cmp OverTankDir + bcs OnGround + ; first erase old tank position jsr ClearTankNr jsr DrawTankParachute - inc ytankstable,x - ; then draw tank on new position + inc ytankstable,x + ; then draw tank on new position jsr PutTankNr jsr DrawTankParachute - jsr WaitOneFrame - jmp FloatDown + jsr WaitOneFrame + jmp FloatDown OnGround - ; clear parachute - mva #1 Erase + ; clear parachute + mva #1 Erase jsr DrawTankParachute - mva #0 Erase + mva #0 Erase jsr WaitForKeyRelease - ; and Soildown at the end (for correct mountaintable) - ; If tank did not fly at maximum altitude there is no need to soildown to much - lda FloatingAlt - cmp #18 - beq NotHighest + ; and Soildown at the end (for correct mountaintable) + ; If tank did not fly at maximum altitude there is no need to soildown to much + lda FloatingAlt + cmp #18 + beq NotHighest SoilDownAfterLanding - jsr ClearScreenSoilRange + jsr ClearScreenSoilRange NotHighest - ; calculate range - jsr CalculateSoildown - ; hide tanks and ... - jsr SoilDown2 - ldx TankNr - rts - + ; calculate range + jsr CalculateSoildown + ; hide tanks and ... + jsr SoilDown2 + ldx TankNr + rts + CalculateSoildown - ldx TankNr - clc - lda XtankstableL,x - adc #4 - sta xdraw - lda XtankstableH,x - adc #0 - sta xdraw+1 - mva #$04 ExplosionRadius - jsr CalculateExplosionRange - rts + ldx TankNr + clc + lda XtankstableL,x + adc #4 + sta xdraw + lda XtankstableH,x + adc #0 + sta xdraw+1 + mva #$04 ExplosionRadius + jsr CalculateExplosionRange + rts .endp ; ------------------------------------------------- @@ -2879,28 +2879,28 @@ CalculateSoildown ; X - index of the hit tank ldx NumberOfPlayers - dex + dex CheckCollisionWithTankLoop - lda eXistenZ,x - beq DeadTank - ; first we test top and bottom (same with and without shield!) + lda eXistenZ,x + beq DeadTank + ; first we test top and bottom (same with and without shield!) lda ytankstable,x cmp ydraw ; check range bcc BelowTheTank ;(ytankstable,ytankstable+3) sbc #3 ; hitbox height cmp ydraw bcs OverTheTank - ; with or without shield ? + ; with or without shield ? - lda ActiveDefenceWeapon,x - cmp #ind_Mag_Deflector__ ; first shielded weapon - bcc CheckCollisionWithNotShieldedTank - cmp #ind_Bouncy_Castle__+1 ; last shielded weapon - bcc CheckCollisionWithShieldedTank ; tank with shield is bigger :) - - ;lda ShieldEnergy,x ; there is wrong method to check shield :) - ;bne CheckCollisionWithShieldedTank ; tank with shield is bigger :) - + lda ActiveDefenceWeapon,x + cmp #ind_Mag_Deflector ; first shielded weapon + bcc CheckCollisionWithNotShieldedTank + cmp #ind_Bouncy_Castle +1 ; last shielded weapon + bcc CheckCollisionWithShieldedTank ; tank with shield is bigger :) + + ;lda ShieldEnergy,x ; there is wrong method to check shield :) + ;bne CheckCollisionWithShieldedTank ; tank with shield is bigger :) + CheckCollisionWithNotShieldedTank lda xtankstableH,x cmp xdraw+1 @@ -2909,9 +2909,9 @@ CheckCollisionWithNotShieldedTank cmp xdraw @ bcs LeftFromTheTank - ; add 8 double byte - ; now we use Y as low byte and A as high byte of checked position (right edge of tank) - ; it is tricky but fast and much shorter + ; add 8 double byte + ; now we use Y as low byte and A as high byte of checked position (right edge of tank) + ; it is tricky but fast and much shorter clc lda xtankstableL,x adc #TankWidth @@ -2924,9 +2924,9 @@ CheckCollisionWithNotShieldedTank @ bcc RightFromTheTank TankHit - inx - stx HitFlag ; index of hit tank+1 - dex + inx + stx HitFlag ; index of hit tank+1 + dex mwa xdraw XHit mwa ydraw YHit rts ; in X there is an index of the hit tank @@ -2939,23 +2939,23 @@ DeadTank bpl CheckCollisionWithTankLoop rts CheckCollisionWithShieldedTank - ; now we use Y as low byte and A as high byte of checked position (left right edgs of shield) - ; it is tricky but fast and much shorter + ; now we use Y as low byte and A as high byte of checked position (left right edgs of shield) + ; it is tricky but fast and much shorter lda xtankstableL,x - sec - sbc #4 ; 5 pixels more on left side - tay - lda xtankstableH,x - sbc #0 - ; bmi ShieldOverLeftEdge ; I do not know whether to check it. Probably not :) !!! + sec + sbc #4 ; 5 pixels more on left side + tay + lda xtankstableH,x + sbc #0 + ; bmi ShieldOverLeftEdge ; I do not know whether to check it. Probably not :) !!! cmp xdraw+1 bne @+ cpy xdraw @ bcs LeftFromTheTank - tya ;add 16 double byte + tya ;add 16 double byte clc - adc #TankWidth+4+4 + adc #TankWidth+4+4 tay lda xtankstableH,x adc #0 @@ -2964,7 +2964,7 @@ CheckCollisionWithShieldedTank cpy xdraw @ bcc RightFromTheTank - bcs TankHit + bcs TankHit .endp ;-------------------------------------------------- CalculateExplosionRange0 @@ -2974,39 +2974,39 @@ CalculateExplosionRange0 ;(for the first or single explosion) ;zero soil fall out ranges - jsr ClearScreenSoilRange + jsr ClearScreenSoilRange ;-------------------------------------------------- .proc CalculateExplosionRange ;-------------------------------------------------- ;calculates total horizontal range of explosion by ;"summing up" ranges of all separate explosions - ; WeaponRangeRight = xdraw + ExplosionRadius - clc - lda xdraw - adc ExplosionRadius - sta WeaponRangeRight - lda xdraw+1 - adc #$00 - sta WeaponRangeRight+1 + ; WeaponRangeRight = xdraw + ExplosionRadius + clc + lda xdraw + adc ExplosionRadius + sta WeaponRangeRight + lda xdraw+1 + adc #$00 + sta WeaponRangeRight+1 ; adw xdraw ExplosionRadius WeaponRangeRight ; Pozor! ExplosionRadius is one byte now ; cpw WeaponRangeRight #screenwidth-1 - cmp #>(screenwidth-1) - bne @+ - lda WeaponRangeRight - cmp #<(screenwidth-1) -@ bcc NotOutOfTheScreenRight + cmp #>(screenwidth-1) + bne @+ + lda WeaponRangeRight + cmp #<(screenwidth-1) +@ bcc NotOutOfTheScreenRight mwa #screenwidth-1 WeaponRangeRight NotOutOfTheScreenRight - ; WeaponRangeLeft = xdraw - ExplosionRadius - sec - lda xdraw - sbc ExplosionRadius - sta WeaponRangeLeft - lda xdraw+1 - sbc #$00 - sta WeaponRangeLeft+1 + ; WeaponRangeLeft = xdraw - ExplosionRadius + sec + lda xdraw + sbc ExplosionRadius + sta WeaponRangeLeft + lda xdraw+1 + sbc #$00 + sta WeaponRangeLeft+1 ; sbw xdraw ExplosionRadius WeaponRangeLeft ; Pozor! ExplosionRadius is one byte now ; lda WeaponRangeLeft+1 bpl NotOutOfTheScreenLeft @@ -3031,21 +3031,21 @@ RangesChecked .proc SetFullScreenSoilRange ; whole screen in range of soil down ;-------------------------------------------------- - lda #0 - sta RangeLeft - sta RangeLeft+1 - mwa #screenwidth RangeRight - rts + lda #0 + sta RangeLeft + sta RangeLeft+1 + mwa #screenwidth RangeRight + rts .endp ;-------------------------------------------------- .proc ClearScreenSoilRange ; cleanup of the soil fall down ranges (left and right) ;-------------------------------------------------- - mwa #screenwidth RangeLeft - lda #0 - sta RangeRight - sta RangeRight+1 - rts + mwa #screenwidth RangeLeft + lda #0 + sta RangeRight + sta RangeRight+1 + rts .endp ;-------------------------------------------------- .proc DecreaseWeaponBeforeShoot @@ -3065,7 +3065,7 @@ RangesChecked ; decreases 1 bullet from a weapon(A) of tank(TankNr) ;-------------------------------------------------- jsr HowManyBullets - beq noBullets ; no bullets - no decreasing (additional check) + beq noBullets ; no bullets - no decreasing (additional check) cpy #0 beq defaultWeapon ; no decreasing Baby Missile sec