;:poke56,28000/256:clr ;:sys36864 ;.opt oo *= 28000 v =53248 tmp =2 tmp2 =4 konf =1 neuzeich =$e000 bank =$dd00 screen =648 cint =65409 neupos =8*64 neuze =neuzeich+neupos tmp3 =166 scrn =$c400 ; 50176 screenfld =scrn+41 feld =$8000 ; auch schon (anzspal) bytes davor belegt anzzeil =22 anzspal =23 mult =anzzeil*anzspal farbram =$d800 dist1 =anzzeil-1 dist2 =anzspal*dist1 dist3 =dist2+feld spalt =211 print =$ffd2 sprpt1 =2040+49152 ; $c7f8 sprit1 =2048+49152 ; nr 32 = $c800 sprit2 =2112+49152 ; nr 33 = $c840 sprit3 =2176+49152 ; nr 34 = $c880 irqvec =$314 oldirq =$ea31 key =198 joyst =56320 get =65508 delay =10 tab40l =$c000 tab40h =$c080 tabxxl =$c100 tabxxh =$c180 spx =8*anzspal sprix =88+spx sprixh =>sprix sprixl =v sta tmp+1 lda #>neuzeich sta tmp2+1 ldx #8 ;2 ;16 zcopy lda (tmp),y sta (tmp2),y dey bne zcopy inc tmp+1 inc tmp2+1 dex bpl zcopy jsr kram lda #148 sta bank lda #>scrn sta screen lda #24 sta v+24 inx stx v+32 stx v+33 stx mouseflg inx stx v+29 stx v+23 inx stx v+27 lda #34 sta sprpt1+1 lda #11 sta v+40 lda #217 sta v+3 lda #sprixl sta v+2 lda #sprixh*2 sta v+16 jsr setptr ldx #7 no0 lda #0 ldy #7 lp3 sta (tmp),y dey bpl lp3 jsr tp8 lda #128 sta rept ldy #7 lp1 sta (tmp),y dey bpl lp1 jsr tp8 dex bpl no0 jsr setptr ldy #0 ldx #3 lp2 jsr tp8 jsr tp8 lda #255 sta (tmp),y jsr tp8 lda #255 sta (tmp),y jsr tp8 dex bpl lp2 jsr setptr ldx #1 lp4 jsr tp32 ldy #31 lp5 lda (tmp),y ora #1 sta (tmp),y dey bpl lp5 jsr tp32 dex bpl lp4 jsr setptr jsr tp32 jsr tp32 ldx #7 ldy #7 lp6 lda #255 sta (tmp),y jsr tp8 dex bpl lp6 jsr setptr lda tmp sta tmp3 clc adc #128 sta tmp2 lda tmp+1 adc #0 sta tmp2+1 lda tmp+1 clc adc #1 sta tmp3+1 ldy #127 lpx lda (tmp),y sta (tmp2),y sta (tmp3),y dey cpy #119 bcs lpx ldy #127 ldx #7 lpy lda (tmp2),y ora mat1,x sta (tmp2),y lda (tmp3),y ora mat2,x sta (tmp3),y dex bpl lpyy ldx #7 lpyy dey cpy #119 bcs lpy lda #chars jsr settmp ch1 ldy #0 sty tmp2+1 lda (tmp),y beq ch2 asl rol tmp2+1 asl rol tmp2+1 asl rol tmp2+1 sta tmp2 lda tmp2+1 clc adc #>neuzeich sta tmp2+1 ldy #7 inc tmp bcc ch3 inc tmp+1 ch3 lda (tmp),y sta (tmp2),y dey bpl ch3 jsr tp8 jmp ch1 ch2 lda #0 ldx #192 delspr sta sprit1,x dex cpx #-1 bne delspr lda #31 sta sprit1+1 sta sprit1+4 lda #3 ldx #4 ldy #0 sts sta sprit2,y iny iny iny dex bpl sts ldx #7 ldy #0 setlp lda seg,x sta sprit3,y sta sprit3+1,y sta sprit3+2,y sta sprit3+24,y sta sprit3+25,y sta sprit3+26,y iny iny iny dex bpl setlp jsr krom cli rts tpxx lda #anzspal .byt $2c tp3 lda #3 .byt $2c tp40 lda #40 .byt $2c tp8 lda #8 .byt $2c tp32 lda #32 sta tpx+4 tpx lda tmp clc adc #0 sta tmp bcc rt inc tmp+1 rt rts clrline jsr bildx ldy #39 lda #32 cll1 sta (bild),y dey cpy #anzspal+1 bcs cll1 rts clrmenue ldx #5 clrm jsr clrline inx cpx #20 bcc clrm rts calcchr pha and #16 beq noletter pla and #32 beq null lda #15+32 rts null lda #15+16 rts noletter pla and #15 rts setptr lda #neuze settmp sta tmp sty tmp+1 rts feldtmp lda #feld bne settmp random lda raster ror sbc samen eor sidrnd eor #$aa rol adc sidrnd eor samen adc raster sta samen rts co1 lda #core1 jmp strout co0 lda #core0 jmp strout kram lda #53 .byt $2c krom lda #55 sta konf rts color lda tmp2+1 and #3 ora #>farbram sta tmp3+1 lda tmp2 sta tmp3 rts seterf lda #erfolg sta tmp2 sty tmp2+1 rts trans lda tmp2 sta tmp3 lda tmp2+1 sta tmp3+1 rts switch clc lda tmp3+1 adc #4 sta tmp3+1 rts initfield ldy #0 tya ifi sta feld,y sta feld+$100,y dey bne ifi ldy #anzspal-3 set2 lda #2 sta feld+1,y lda #8 sta dist3+1,y dey bpl set2 ldx #anzzeil-3 jsr feldtmp zeile2 lda tmp clc adc #anzspal sta tmp bcc nope3 inc tmp+1 nope3 ldy #0 lda #1 sta (tmp),y ldy #anzspal-1 lda #4 sta (tmp),y dex bpl zeile2 lda #3 sta feld lda #6 sta feld+anzspal-1 lda #9 sta dist3 lda #12 sta dist3+anzspal-1 rts strout sta tmp sty tmp+1 st ldy #0 lda (tmp),y cmp #"\x03" bne goon rts goon cmp #"\x1a" bne nocr lda #13 nocr cmp #"\x18" bne noiks lda #anzspal+2 sta spalt wt inc tmp bne st inc tmp+1 bne st noiks cmp #"\x19" beq rep jsr print bcc wt rep iny lda (tmp),y tax iny lda (tmp),y repp jsr print dex bne repp jsr tp3 bcc st gett ldy #0 lda (tmp4),y inc tmp4 bne itr inc tmp4+1 itr rts mask lda #hitxt jsr strout inc feldtask rts clrsid ldx #0 txa csi sta s,x dex bpl csi lda #15+128 sta s+24 lda #100 sta s+1 sta s+15 lda #129 sta s+18 lda #9 sta s+5 lda #240 sta s+6 rts ofield lda tmp2 pha lda tmp2+1 pha lda tmp3 pha lda tmp3+1 pha lda #screenfld sta tmp2 sty tmp2+1 jsr color jsr feldtmp ldx #anzzeil zeile ldy #anzspal-1 spalte lda (tmp),y jsr calcchr ora #64 sta (tmp2),y lda #14 sta (tmp3),y dey bpl spalte jsr tpxx lda tmp2 clc adc #40 sta tmp2 bcc nope2 inc tmp2+1 nope2 jsr color dex bne zeile pla sta tmp3+1 pla sta tmp3 pla sta tmp2+1 pla sta tmp2 rts irqinit sei lda #neuirq sta irqvec sty irqvec+1 lda #0 sta feldtask sta colnr sta mouseflg sta mousevh sta mousex sta mousey sta beep ldx #3 set0 sta sc1,x dex bpl set0 lda #2 sta dran cli nofeld rts neuirq lda tmp pha lda tmp+1 pha jsr feld10 jsr domouse jsr zahlout jsr peep ldx joynr lda joyst,x sta joy ldx dran lda drantab,x sta scrn+anzspal+10+800 inc irqbeweis pla sta tmp+1 pla sta tmp jmp oldirq feld10 lda feldtask beq nofeld lda #0 sta feldtask jmp ofield domouse lda mouseflg bne mousean lda #2 sta v+21 rts mousean lda #3 sta v+21 lda v+27 eor #1 sta v+27 lda mousevh bne vertikal lda mousex asl asl asl adc #9 tax lda mousey asl asl asl adc #56 ldy #32 bne setmouse vertikal ldy #33 lda mousex asl asl asl adc #18 tax lda mousey asl asl asl adc #57 setmouse sty sprpt1 stx v sta v+1 lda colflg eor #128 sta colflg bmi nochg ldx colnr dex bpl actcol ldx #7 actcol stx colnr lda coltab,x sta v+39 nochg rts zahlout ldx #80+anzspal lda sc1 ldy sc1+1 jsr numeric ldx #120+anzspal ldy sc2+1 lda sc2 numeric jsr settmp ldy #0 nu3 lda #176 sta zahl nu1 tya bne nu4 lda tmp+1 beq nu4 lda tmp sec sbc #100 sta tmp lda tmp+1 sbc #0 sta tmp+1 inc zahl bne nu1 nu4 lda tmp cmp log,y bcc nu2 lda tmp sbc log,y sta tmp inc zahl bne nu1 nu2 lda zahl sta scrn+$300,x inx iny cpy #3 bcc nu3 rts wartirq cli lda irqbeweis cmp irqbeweis beq wartirq rts peep lda beep beq nopeep dec beep lda #33 sta s+4 jsr dudel jsr dudel lda #32 sta s+4 jsr dudel lda #33 sta s+4 jsr dudel jsr dudel lda #32 sta s+4 dudel ldx #40 ldy #0 steffi dey bne steffi dex bne steffi nopeep rts getkoor inc mouseflg inc feldtask ; eigentl. unnoetig lda #0 sta key schleife ldy #delay ldx #0 del jsr t162 dex bne del dey bne del lda key bne tasted lda joy and #31 cmp #31 beq schleife and #1 bne nodir1 lda mousey beq nodir1a dec mousey nodir1 lda joy and #2 bne nodir2 lda mousey cmp #anzzeil-1 bcs nodir2a inc mousey nodir2 lda joy and #4 bne nodir4 lda mousex beq nodir4a dec mousex nodir4 lda joy and #8 bne nodir8 lda mousex cmp #anzspal-1 bcs nodir8a inc mousex nodir8 jsr t16 lda joy and #16 bne schleife lda mousevh eor #1 sta mousevh tasted jsr get beq qschleife cmp #13 bne stoped jsr test bne qschleife clc bcc rumaus stoped cmp #"?" beq helpme cmp #"\x03" bne qschleife rumaus lda #0 sta mouseflg rts nodir1a lda #anzzeil-1 .byt $2c nodir2a lda #0 sta mousey jmp nodir2 nodir4a lda #anzspal-1 .byt $2c nodir8a lda #0 sta mousex jmp nodir8 t16 lda joy and #16 cmp old16 bne keinsinn pla pla qschleife jmp schleife helpme lda #1 rts t162 lda joy and #16 beq keinsin2 keinsinn sta old16 keinsin2 rts test ldy mousey lda tab40l+1,y sta tmp lda tab40h+1,y ora #>scrn sta tmp+1 ldy mousex iny lda (tmp),y ldx mousevh beq waage and #1 rts waage and #2 rts makemath lda #0 tax tay jsr settmp ldy #anzzeil+1 math1 lda tmp+1 sta tab40h,x lda tmp sta tab40l,x jsr tp40 inx dey bpl math1 lda #0 tax tay jsr settmp ldy #anzzeil+1 math2 lda tmp+1 sta tabxxh,x lda tmp sta tabxxl,x jsr tpxx inx dey bpl math2 rts ;" qerr ldx #49:jmp error" ; setaxy setzt einen balken (a = 0 => waagerecht) setaxy pha lda tabxxh,y ora #>feld sta tmp+1 lda tabxxl,y sta tmp txa tay pla beq wag lda (tmp),y ora #1 sta (tmp),y dey lda #4 bne saat wag lda (tmp),y ora #2 sta (tmp),y lda tmp sec sbc #anzspal sta tmp lda tmp+1 sbc #0 sta tmp+1 lda #8 saat ora (tmp),y sta (tmp),y rts testfull lda #0 sta doagain jsr feldtmp ldx #anzzeil-1 xzeile ldy #anzspal-1 xspalte lda (tmp),y cmp #15 bne nee stx xmerk ldx dran lda won,x sta (tmp),y txa asl tax inc sc1,x bne nozwei inc sc1+1,x nozwei ldx xmerk inc doagain nee dey bpl xspalte jsr tpxx dex bpl xzeile rts wergewon lda sc1 clc adc sc2 sta tmp lda sc1+1 adc sc2+1 cmp #>mult bcc mussnoch bne hatschon lda tmp cmp #feld sta tmp+1 ldy xtab,x sty ergx lda (tmp),y and #15 sta wahl ;" :cmp #15:bne vtd:ldx #"4":jmp error" vtd jsr random and #3 tax lda wahl and grbit,x bne vtd txa and #1 eor #1 sta ergvh cpx #2 bcc zugok lda ergvh beq lieg inc ergx rts lieg inc ergy zugok rts ; bei welchem verteid.zug kann der gegner am wenigsten machen suchbest lda #-1 sta sovrek sta sovrek+1 ldx index be1 dex stx lfdnr ldy ytab,x sty ergy2 lda tabxxl,y sta tmp lda tabxxh,y ora #>feld sta tmp+1 ldy xtab,x sty ergx2 lda (tmp),y and #15 sta wahl2 ldx #1 ;" :cmp #15:bne be2:ldx #"4":jmp error" be2 stx lfdbit lda wahl2 and grbit,x bne be3 jsr wieviel lda strenght cmp #3 bcs be3 lda sovrek bne be3 lda sovrek+1 bne be3 lda #erfolg sta tmp3+1 bne be7 be3 ldx lfdbit dex bpl be2 ldx lfdnr bne be1 be4 jsr random sta tmp3 jsr random and #3 clc adc #>erfolg sta tmp3+1 lda tmp3+1 cmp tmp2+1 bcc be7 bne be4 lda tmp3 cmp tmp2 bcs be4 be7 ldy #0 lda (tmp3),y sta ergx jsr switch lda (tmp3),y sta ergy jsr switch lda (tmp3),y eor #1 and #1 sta ergvh rts ; wieviele karos kann der gegner setzen, wenn ich das mache wieviel jsr save ldx ergx2 ldy ergy2 lda lfdbit eor #1 jsr setaxy lda #0 sta soviel sta soviel+1 jsr suchkaro jsr load lda soviel+1 cmp sovrek+1 bcc neuer bne in2 lda soviel cmp sovrek beq take bcs in2 neuer jsr seterf lda soviel sta sovrek lda soviel+1 sta sovrek+1 take ldy #0 lda ergx2 sta (tmp2),y jsr trans jsr switch lda ergy2 sta (tmp3),y jsr switch lda lfdbit sta (tmp3),y inc tmp2 bne in2 inc tmp2+1 in2 rts ; high-speed routine folgt ; gibt es karos zu setzen in dieser situtaion suchkaro lda #feld sta tmp4 sty tmp4+1 ldx #0 stx nochwas szeil stx xmerk ldy #0 sspal sty ymerk lda (tmp4),y and #15 sta wahl tax lda anzbit,x cmp #3 bne ignor sta nochwas sty ergx ldy xmerk ldx #4 vttd dex lda wahl and grbit,x bne vttd txa eor #1 and #1 cpx #2 bcc zugokok tax beq lieeg inc ergx bne zugokok lieeg iny zugokok ldx ergx jsr setaxy inc soviel bne ignor inc soviel+1 ignor0 ldy ymerk ignor iny cpy #anzspal bcc sspal lda tmp4 adc #anzspal-1 sta tmp4 bcc noi4 inc tmp4+1 noi4 ldx xmerk inx cpx #anzzeil bcc szeil lda nochwas bne suchkaro rts start jsr cint jsr makemath jsr zsatz jsr initfield jsr irqinit jsr mask jsr clrsid lda #3 sta strenght lda #wgw jsr strout wa1 lda #geg0 jsr strout lda gegner1 asl asl adc gegner1 tay ldx #4 wa2 lda geg1,y jsr print iny dex bpl wa2 lda #"(" jsr print lda #")" jsr print lda gegner2 asl asl adc gegner2 tay ldx #4 wa3 lda geg1,y jsr print iny dex bpl wa3 lda #hindy jsr strout lda anzhi ora #48 sta scrn+625 cmp #49 bne wa4 lda #0 sta farbram+637 sta farbram+636 wa4 jsr get cmp #13 beq chosen cmp #"\x85" beq wa5 cmp #"\x86" bne wa6 inc gegner2 lda gegner2 cmp #6 bcc wa1 lda #0 sta gegner2 beq wa1 wa5 inc gegner1 lda gegner1 cmp #6 bcc qwa1 lda #0 sta gegner1 beq qwa1 wa6 cmp #"\x87" bne wa4 inc anzhi lda anzhi cmp #8 bcc qwa1 lda #0 sta anzhi qwa1 jmp wa1 chosen jsr clrmenue jsr behindern lda #1 sta dran nexter lda dran eor #1 sta dran jsr wartirq affe jsr ziehen jsr setaxy inc feldtask jsr testfull lda doagain bne noton inc beep noton jsr wartirq jsr wergewon bne finish lda doagain bne affe beq nexter finish pha inc feldtask lda #wontxt jsr strout pla bpl einer lda #wonune jsr strout jmp feddisch einer pha lda #wonplr jsr strout pla cmp #64 bne zweiwon lda #"1" .byt $2c zweiwon lda #"2" jsr print feddisch lda #revanche jsr strout lda #0 sta key gjn jsr get cmp #"n" bne non jmp (reset) non cmp #"j" bne gjn jmp start ziehen ldx dran ldy gegner1,x bne kl1 lda #1 bne setjoy kl1 cpy #1 bne no1 lda #0 setjoy sta joynr lda #help jsr strout user jsr getkoor bcc trau tax beq qabort jsr co1 jsr suchzug jsr co0 ldx ergx ldy ergy lda ergvh stx mousex sty mousey sta mousevh bpl user qabort jsr clrmenue abort pla pla jsr hatschon jmp finish trau jsr clrmenue ldx mousex ldy mousey lda mousevh rts no1 dey dey sty strenght jsr get cmp #"\x03" beq abort jsr co1 sei jsr suchzug jsr co0 ldx ergx ldy ergy lda ergvh rts behindern lda anzhi asl tax lda hintab,x sta tmp4 lda hintab+1,x sta tmp4+1 hi0 jsr gett tax bpl hi1 inc feldtask jmp wartirq hi1 beq hi3 jsr gett sta tmp2 jsr gett sta tmp2+1 jsr gett sta tmp3 hi2 lda #1 ldx tmp3 ldy tmp2 jsr setaxy inc tmp2 lda tmp2 cmp tmp2+1 bcc hi2 bcs hi0 hi3 jsr gett sta tmp2 jsr gett sta tmp2+1 jsr gett sta tmp3 hi4 lda #0 ldy tmp3 ldx tmp2 jsr setaxy inc tmp2 lda tmp2 cmp tmp2+1 bcc hi4 bcs hi0