antoine-source/picknpile/SOURCES.IIE/MAINIIE.SRC
Antoine Vignau ba8b564bab Adding Pick'n'Pile
IIe (complete) & IIgs (corrupted) soruce code
2022-10-29 21:18:37 +02:00

1 line
94 KiB
Plaintext

***************************************************************
*
* Pick'n Pile //e
* ---------------
*
* Version : Beta
* Conversion : Atreid Concept SA
****************************************************************
list off
gen off
msb off
symbol off
65816 off
65c02 off
keep PnP.Sys
mcopy PnP.Macros
ProDOS gequ $BF00 ;acces au MLI
IOBuffer gequ $Ba00
vbest gequ $800
Codes gequ $860
org $8000
PnP START PnP
lda #0
sta <$50
sta <$52
lda #$20
sta <$51
lda #$80
sta <$53
ldx #0
PnPInstall anop
lda ($50,x)
sta ($52,x)
lda <$50
clc
adc #1
bcs Inc51inst
sta <$50
beq Inc52inst
bne Inc52inst
Inc51inst anop
sta <$50
inc <$51
Inc52Inst anop
lda <$52
clc
adc #1
bcs Inc53inst
sta <$52
beq Inc54Inst
bne Inc54Inst
Inc53inst anop
sta <$52
inc <$53
Inc54Inst anop
lda <$53
cmp #$bf ;borne superieure de la mem
bne PnpInstall
jmp PnpInstalled
PnpInstalled anop
lda $c036 ;cyareg *****************
and #$7f *****************
sta $c036 *****************
tsx ;on sauve s !!!
stx StackPtr
jsr InitPnP
lda #vbestFile ;ptr string
sta GSTemp1
lda #>vbestFile
sta GSTemp1+1
lda #$18 ;taille a lire
sta GSTemp2
lda #$0c
sta GSTemp2+1
lda #vbest ;buffer mem
sta GSTemp3
lda #>vbest
sta GSTemp3+1
jsr LoadFile
lda #Car ;ptr string
sta GSTemp1
lda #>Car
sta GSTemp1+1
lda #0 ;taille a lire
sta GSTemp2
lda #$20
sta GSTemp2+1
lda #0 ;buffer mem
sta GSTemp3
lda #$60
sta GSTemp3+1
jsr LoadFile
jsr EnterCode
lda #Calib ;ptr string
sta GSTemp1
lda #>Calib
sta GSTemp1+1
lda #0 ;taille a lire
sta GSTemp2
lda #$20
sta GSTemp2+1
lda #0 ;buffer mem
sta GSTemp3
lda #$40
sta GSTemp3+1
jsr LoadFile
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
lda #CalibStr1
sta GSTemp1
lda #>CalibStr1
sta GSTemp1+1
ldx #10
ldy #73
jsr Texte8
lda #CalibStr2
sta GSTemp1
lda #>CalibStr2
sta GSTemp1+1
ldx #8
ldy #84
jsr Texte8
lda #KeyPick
sta GSTemp1
lda #>KeyPick
sta GSTemp1+1
ldx #25
ldy #167
jsr Texte8
lda #KeyFall
sta GSTemp1
lda #>KeyFall
sta GSTemp1+1
ldx #25
ldy #181
jsr Texte8
lda #0
sta Temp
lda #30
sta Temp2 ;origine x de la croix
sta $c010 ;echantillonnage clavier
CalibLoop anop
lda Temp
beq CalibLoop2
ldx #0
lda Temp1
sta <$50
lda Temp1+1
sta <$51
lda ($50,x) ;XOR d'une ligne
eor #$ff
sta ($50,x)
CalibLoop2 anop
ldx #1 ;manette 1
jsr $fb1e ;lecture manette
tya ;resultat dans a
clc
lsr a
lsr a
cmp #60
blt CalibY
lda #59
CalibY anop
and #%11111100
tax
lda adrlo,x
clc
adc Temp2 ;x source
sta <$50
sta Temp1
lda adrhi,x
adc #$40 ;HGR2
sta <$51
sta Temp1+1
ldx #0
lda ($50,x) ;XOR d'une ligne
eor #$ff
sta ($50,x)
lda #1
jsr Pause ;Attente...
ldx #0 ;manette 0
jsr $fb1e ;lecture manette
tya ;resultat dans a
clc
lsr a
lsr a
lsr a
lsr a
adc #23 ;decalage horiz cadre
sta Temp2
jsr doKeyAff
ldx CalibKey
lda KeyUp,x
eor #$80
sta KeyUp,x
lda #1
sta Temp
lda $c000
bpl CalibLoop
and #$7f
cmp #27
beq CalibEnd
jsr doCalibKey
sta $c010 ;echantillonnage clavier
jmp CalibLoop
doCalibKey anop
cmp #$21 ;point exclamation
blt doCalibKeyEnd
cmp #$7b
bge doCalibKeyEnd
ldx CalibKey
sta KeyUp,x
inx
inx
stx CalibKey
cpx #16
blt doCalibKeyEnd
ldx #1
stx CalibKey
doCalibKeyEnd anop
rts
CalibEnd anop
ldx CalibKey
lda KeyUp,x
and #$7f
sta KeyUp,x
Programme anop
jsr Presentation
bcs PnpEnd
jsr BouclePrin1
jmp Programme
PnpEnd anop
lda $c036 ;cyareg *****************
ora #$80 *****************
sta $c036 *****************
lda #0 ;hgr
jsr ClearHGR
jsr ProDOS
dc h'65' ;Quit
dc i2'QuitBloc'
brk
brk
;---------------------------------------------------------------------
doKeyAff anop
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
lda #KeyUp
sta GSTemp1
lda #>KeyUp
sta GSTemp1+1
ldx #30
ldy #111
jsr Texte8
lda #KeyLeft
sta GSTemp1
lda #>KeyLeft
sta GSTemp1+1
ldx #25
ldy #131
jsr Texte8
lda #KeyRight
sta GSTemp1
lda #>KeyRight
sta GSTemp1+1
ldx #35
ldy #131
jsr Texte8
lda #KeyDown
sta GSTemp1
lda #>KeyDown
sta GSTemp1+1
ldx #30
ldy #153
jsr Texte8
rts
;---------------------------------------------------------------------
InitPnp anop
lda #1 ;hgr2
jsr ClearHGR
lda #0
sta $c050 ;graph
sta $c052 ;plein ecran
sta $c055 ;page 2
sta $c057 ;hgr
rts
;---------------------------------------------------------------------
BouclePrin1 anop
lda #3
sta Vies
sta Vies1
sta Vies2
lda #0
sta ELife
sta ELife1
sta ELife2
sta Score
sta Score+1
sta Score+2
sta Score+3
sta Score1
sta Score1+1
sta Score1+2
sta Score1+3
sta Score2
sta Score2+1
sta Score2+2
sta Score2+3
sta Player
jsr ClrDiams
sta $c010 ;echantillonnage clavier
BouclePrin2 anop
lda #0
sta FirstScore
inc ScoreTemp
jsr Nettoyage
jsr InitLevel
jsr Preparation
BouclePrin anop
lda Diams+19
cmp #5
beq pasBonus
jsr BonusST
pasBonus anop
lda Time+1
cmp #$90
blt PasFin
lda #0
sta Time
sta Time+1
sta vpoum
sta vpoum+1
sta OkClic
jsr Afscore
jsr Explosions
ldx #5
ldy #96
lda #phtolate
sta GSTemp1
lda #>phtolate
sta GSTemp1+1
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
jsr Texte16
lda #50
jsr Pause
sed
dec Vies
cld
jsr Gestion2Joueurs
cmp #0
bne FinJeuGo
lda #1 ;hgr2
jsr ClearHGR
jmp BouclePrin2
FinJeuGo jmp FinJeu
pasfin anop
lda MBut2
bne PasFinFall
lda $c062 ;option
bpl BPFire0
pasFinFall anop
lda #0
sta MBut2
inc doFall
BPFire0 anop
lda $c000 ;lecture clavier
bpl BPPause
and #$7f
cmp #'p'
beq BPPause1
cmp #'P'
beq BPPause1
cmp #27 ;esc
beq FinJeu
bne BPPause
BPPause1 anop
jsr doPause
BPPause anop
ldy vmousejoy
beq pasReadKeys
jsr KeyMove
pasReadKeys anop
lda vmousejoy
bne pasReadX
ldx #0
jsr $FB1E
sty JoyX
pasReadX anop
jsr GestionSouris
jsr Afscore
jsr Poum
lda vmousejoy
bne pasReadY
ldx #1
jsr $FB1E
sty JoyY
pasReadY anop
jsr DrawCursor
jsr Affiche
jsr DeplaceBloc
jsr Alignement
lda #0
sta doFall
lda Reussit
bne OkReussit
jmp BouclePrin
OkReussit anop
jsr Afscore
lda #0
sta Reussit
sta okClic
sta FirstScore
inc ScoreTemp
jsr Affiche
jsr DecTime
lda #20
jsr Pause
lda #1 ;HGR2
jsr ClearHGR
inc Level
lda Level
cmp #99
bne okReussit2
lda #1
sta Level
okReussit2 anop
jsr Gestion2Joueurs
jmp BouclePrin2
FinJeu anop
lda #0
sta okClic
lda #9
sta GSTemp1
lda #70
sta GSTemp1+1
lda #22
sta GSTemp2
lda #46
sta GSTemp2+1
lda #%10101010
sta GSTemp3
lda #%11010101
sta GSTemp3+1
jsr PaintRect
lda #10
sta GSTemp1
lda #73
sta GSTemp1+1
lda #20
sta GSTemp2
lda #40
sta GSTemp2+1
lda #0
sta GSTemp3
sta GSTemp3+1
jsr PaintRect
ldx #11
ldy #76
lda #phgameover
sta GSTemp1
lda #>phgameover
sta GSTemp1+1
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
jsr Texte16
lda Player
bne FinPl2
ldx #12
ldy #95
lda #phPlayer1
sta GSTemp1
lda #>phPlayer1
sta GSTemp1+1
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
jsr Texte16
jmp FinJeu2
FinPl2 anop
ldx #12
ldy #95
lda #phPlayer2
sta GSTemp1
lda #>phPlayer2
sta GSTemp1+1
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
jsr Texte16
FinJeu2 anop
jsr Afscore
lda #35
jsr Pause
lda #1 ;hgr2
jsr ClearHGR
rts
;--------------------------------------------------------------------------
EnterCode anop
lda #0
ldx #0
clc
EnterCode0 anop
adc $0,x
inx
bne EnterCode0
EnterCode00 anop
pha
jsr Random
pla
beq EnterCode1
sec
sbc #1
jmp EnterCode00
EnterCode1 anop
jsr Random
cmp #60
bge EnterCode1
sta CodeY
tax
lda HexDec,x
pha
and #$0f
clc
adc #$30 ;zero
sta PassLine+8
pla
and #$f0
clc
lsr a
lsr a
lsr a
lsr a
clc
adc #$30 ;zero
sta PassLine+7
EnterCode2 anop
jsr Random
cmp #10
bge EnterCode2
sta CodeX
clc
adc #$41 ;caractere A
sta PassRow+8
lda #8
sta GSTemp1
lda #70
sta GSTemp1+1
lda #25
sta GSTemp2
lda #64
sta GSTemp2+1
lda #%10101010
sta GSTemp3
sta GSTemp3+1
jsr PaintRect
lda #9
sta GSTemp1
lda #76
sta GSTemp1+1
lda #23
sta GSTemp2
lda #52
sta GSTemp2+1
lda #0
sta GSTemp3
sta GSTemp3+1
jsr PaintRect
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
lda #PassText
sta GSTemp1
lda #>PassText
sta GSTemp1+1
ldx #10
ldy #83
jsr Texte8
lda #PassRow
sta GSTemp1
lda #>PassRow
sta GSTemp1+1
ldx #14
ldy #92
jsr Texte8
lda #PassLine
sta GSTemp1
lda #>PassLine
sta GSTemp1+1
ldx #14
ldy #101
jsr Texte8
lda #0
sta ScoreStr
EnterCodeLoop anop
jsr WaitUser
cmp #$20 ;espace?
blt SpecialCars
cmp #$7f ;Delete?
beq BackCode
cmp #$7b
bge EnterCodeLoop
cmp #$61
blt CodeUpper
sec
sbc #$20
CodeUpper anop
ldx ScoreStr
cpx #5
bge EnterCodeLoop
inx
stx ScoreStr
sta ScoreStr,x
AffCode anop
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
lda #ScoreStr
sta GSTemp1
lda #>ScoreStr
sta GSTemp1+1
ldx #18
ldy #113
jsr Texte8
jmp EnterCodeLoop
SpecialCars anop
cmp #$0d ;return?
beq EnterCodeEnd0
cmp #$08 ;fleche gauche?
beq BackCode
jmp EnterCodeLoop
BackCode anop
ldx ScoreStr
beq EnterCodeLoop
dex
stx ScoreStr
lda #18
sta GSTemp1
lda #113
sta GSTemp1+1
lda #5
sta GSTemp2
lda #7
sta GSTemp2+1
lda #0
sta GSTemp3
sta GSTemp3+1
jsr PaintRect
jmp AffCode
EnterCodeEnd0 anop
lda ScoreStr
cmp #5
bne PasCodeOk
jsr CodeCalc
lda Temp2
clc
adc #vbest+96
sta <$50
lda Temp2+1
adc #>vbest
sta <$51
ldx #0
lda ($50,x)
cmp ScoreStr+1
bne pasCodeOk
jsr Inc50
lda ($50,x)
cmp ScoreStr+2
bne pasCodeOk
jsr Inc50
lda ($50,x)
cmp ScoreStr+3
bne pasCodeOk
jsr Inc50
lda ($50,x)
cmp ScoreStr+4
bne pasCodeOk
jsr Inc50
lda ($50,x)
cmp ScoreStr+5
bne pasCodeOk
EnterCodeEnd anop
rts
PasCodeOk anop
lda #1 ;HGR2
jsr ClearHGR
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
lda #WrongCode
sta GSTemp1
lda #>WrongCode
sta GSTemp1+1
ldx #2
ldy #100
jsr Texte8
jsr WaitUser
ldx StackPtr
txs
jmp PnPEnd
CodeCalc anop
lda #0
sta Temp2
sta Temp2+1
ldx CodeY
beq CodeCalc20
lda #0
CodeCalc10 anop
clc
adc #50 ;une ligne de codes...
bcc CodeCalc100
inc Temp2+1
CodeCalc100 anop
dex
bne CodeCalc10
sta Temp2
CodeCalc20 anop
ldx CodeX
beq CodeCalc40
lda #0
CodeCalc30 anop
clc
adc #5 ;un code...
dex
bne CodeCalc30
clc
adc Temp2
sta Temp2
lda #0
adc Temp2+1
sta Temp2+1
CodeCalc40 anop
rts
;--------------------------------------------------------------------------
KeyMove anop
cmp KeyUp+1
beq doKeyUp
cmp KeyUp+3
beq doKeyUp
cmp KeyLeft+1
beq doKeyLeft
cmp KeyLeft+3
beq doKeyLeft
cmp KeyRight+1
beq doKeyRight
cmp KeyRight+3
beq doKeyRight
cmp KeyDown+1
beq doKeyDown
cmp KeyDown+3
beq doKeyDown
cmp #' '
beq doKeyPick
cmp #13
beq doKeyFall
lda #128
sta JoyX
sta JoyY
lda #$ea ;nop
sta doKeyPick
rts
doKeyUp anop
lda #90
sta JoyY
lda #128
sta JoyX
lda #$ea ;nop
sta doKeyPick
rts
doKeyDown anop
lda #165
sta JoyY
lda #128
sta JoyX
lda #$ea ;nop
sta doKeyPick
rts
doKeyRight anop
lda #165
sta JoyX
lda #128
sta JoyY
lda #$ea ;nop
sta doKeyPick
rts
doKeyLeft anop
lda #90
sta JoyX
lda #128
sta JoyY
lda #$ea ;nop
sta doKeyPick
rts
doKeyFall anop
lda #128
sta JoyX
sta JoyY
sta MBut2
lda #$ea ;nop
sta doKeyPick
rts
doKeyPick anop
nop
lda #128
sta JoyX
sta JoyY
sta MBut
lda #$60 ;rts
sta doKeyPick
rts
;--------------------------------------------------------------------------
DecTime anop
lda #20
DCLoop anop
pha
jsr Affiche
pla
sec
sbc #1
bne DCLoop
DCLoop2 anop
sed
lda Time
sec
sbc #10
sta Time
bcs DCL20
lda Time+1
sec
sbc #1
sta Time+1
bcc DCLoop3
DCL20 anop
lda Score
clc
adc #10
sta Score
lda #0
adc Score+1
sta Score+1
lda #0
adc Score+2
sta Score+2
lda #0
adc Score+3
sta Score+3
cld
jsr AfScore
lda #10
ldx #5
jsr Sound
lda #5
ldx #10
jsr Sound
jmp DCLoop2
DCLoop3 anop
cld
lda #0
sta Time
sta Time+1
jsr AfScore
jsr Affiche
lda #20
jsr Pause
rts
;--------------------------------------------------------------------------
BonusST anop
jsr AfScore
ldx #20
BSTloop anop
txa
pha
lda Diams-1,x
tay
lda #5
sta Diams-1,x ;efface diam
lda #0
sta DiamsTbl2-1,x
sed
lda ShScore,y ;valeur du diam
clc
lsr a ;multi 10
lsr a
lsr a
lsr a
adc Score+1
sta Score+1
lda #0
adc Score+2
sta Score+2
lda #0
adc Score+3
sta Score+3
lda #0
adc Score+4
sta Score+4
cld
lda #10
ldx #5
jsr Sound
jsr Afscore
lda #2
ldx #30
jsr Sound
jsr Affiche
pla
tax
dex
bne BSTLoop
rts
;--------------------------------------------------------------------------
Gestion2Joueurs anop
lda Player
bne GJpl2
ldx #0
GJpl1Loop anop
lda Diams,x
sta Diams1,x
inx
cpx #20
bne GJpl1Loop
lda Score
sta Score1
lda Score+1
sta Score1+1
lda Score+2
sta Score1+2
lda Score+3
sta Score1+3
lda Level
sta Level1
lda ELife
sta ELife1
lda Vies
sta Vies1
beq Perdu2
lda NbPlayer
beq paschange1
lda #1
sta Player
paschange1 anop
lda #0
rts
paschange2 anop
lda #-1
rts
Perdu2 anop
jsr BestScore
lda NbPlayer
beq paschange2
lda Vies2
beq paschange2
lda #1
sta Player
jmp paschange1
GJpl2 anop
ldx #0
GJpl2Loop anop
lda Diams,x
sta Diams2,x
inx
cpx #20
bne GJpl2Loop
lda Score
sta Score2
lda Score+1
sta Score2+1
lda Score+2
sta Score2+2
lda Score+3
sta Score2+3
lda Level
sta Level2
lda ELife
sta ELife2
lda Vies
sta Vies2
beq Perdu3
lda Vies1
beq paschange1
lda #0
sta Player
rts
Perdu3 anop
jsr BestScore
lda Vies1
beq paschange2
lda #0
sta Player
sta NbPlayer
rts
;--------------------------------------------------------------------------
BestScore anop
lda #0
sta NeedSave
jsr CopyBest
ldx #0
HiScoreLoop anop
lda vbest+15,x
cmp Score+3
blt HiScoreLoopOk
bne NextHiScore
lda vbest+14,x
cmp Score+2
blt HiScoreLoopOk
bne NextHiScore
lda vbest+13,x
cmp Score+1
blt HiScoreLoopOk
bne NextHiScore
lda Score
cmp vbest+12,x
blt NextHiScore
HiScoreLoopOk anop
txa
tay
stx Temp
jmp OkHiScore
NextHiScore anop
txa
clc
adc #16
tax
cmp #5*16
blt HiScoreLoop
jmp HiScores
OkHiScore anop
ldx #(4*16)+1
OkHiScore2 anop
dex
lda vbest,x
sta vbest+16,x
cpx Temp
bne OkHiScore2
lda Score
sta vbest+12,y
lda Score+1
sta vbest+13,y
lda Score+2
sta vbest+14,y
lda Score+3
sta vbest+15,y
ldx Level
lda HexDec,x
sta vbest,y
jsr EntreNom
HiScores anop
lda #0
sta FirstScore
inc ScoreTemp
jsr AfScore
ldx #9
ldy #45
lda #phhi
sta GSTemp1
lda #>phhi
sta GSTemp1+1
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
jsr Texte16
lda #80
sta HiVert
ldx #0
ShowHi anop
txa
pha
lda vbest,x
and #$0f
clc
adc #$30 ;zero
sta ScoreStr+2
lda vbest,x
and #$f0
lsr a
lsr a
lsr a
lsr a
adc #$30 ;zero
sta ScoreStr+1
lda #2
sta ScoreStr
ldx #0
ldy HiVert
lda #ScoreStr
sta GSTemp1
lda #>ScoreStr
sta GSTemp1+1
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
jsr Texte16 ;Affiche le level...
pla
pha
clc
adc #1
adc #vbest
sta GSTemp1
lda #>vbest
sta GSTemp1+1
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
ldx #5
ldy HiVert
jsr Texte16 ;affiche le nom...
pla
pha
tax
lda #$30 ;zero
sta ScoreStr+8
lda vbest+12,x
and #$0f
clc
adc #$30 ;zero
sta ScoreStr+7
lda vbest+12,x
and #$f0
lsr a
lsr a
lsr a
lsr a
adc #$30 ;zero
sta ScoreStr+6
lda vbest+13,x
and #$0f
adc #$30 ;zero
sta ScoreStr+5
lda vbest+13,x
and #$f0
lsr a
lsr a
lsr a
lsr a
adc #$30 ;zero
sta ScoreStr+4
lda vbest+14,x
and #$0f
adc #$30 ;zero
sta ScoreStr+3
lda vbest+14,x
and #$f0
lsr a
lsr a
lsr a
lsr a
adc #$30 ;zero
sta ScoreStr+2
lda vbest+15,x
and #$0f
adc #$30 ;zero
sta ScoreStr+1
lda #8
sta ScoreStr
ldx #24
ldy HiVert
lda #ScoreStr
sta GSTemp1
lda #>ScoreStr
sta GSTemp1+1
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
jsr Texte16 ;Affiche le score...
lda HiVert
clc
adc #18
sta HiVert
pla
clc
adc #16
tax
cmp #5*16
beq pasShowHi
jmp ShowHi
pasShowHi anop
jsr WaitUser
lda NeedSave
beq pasSaveHS
jsr SaveHiScore
pasSaveHS anop
rts
;--------------------------------------------------------------------------
SaveHiScore anop
jsr ProDOS
dc h'c8' ;Open
dc i2'OpenHS'
bcs SaveHSErr
lda RefNumHS
sta WriteHS+1
sta CloseHS+1
jsr ProDOS
dc h'cb' ;Write
dc i2'WriteHS'
bcs SaveHSErr
SaveHSclose anop
jsr ProDOS
dc h'cc' ;Close
dc i2'CloseHS'
rts
SaveHSErr anop
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
lda #SaveHS
sta GSTemp1
lda #>SaveHS
sta GSTemp1+1
ldx #11
ldy #182
jsr Texte8
jmp SaveHSClose
;--------------------------------------------------------------------------
EntreNom anop
inc NeedSave ;il faut sauver les hiscores
tya
pha
ldx #5
ldy #50
lda #phbest
sta GSTemp1
lda #>phbest
sta GSTemp1+1
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
jsr Texte16
lda Player
bne ENpl2
lda #phplayer1
sta GSTemp1
lda #>phplayer1
sta GSTemp1+1
jmp EN2
ENpl2 anop
lda #phplayer2
sta GSTemp1
lda #>phplayer2
sta GSTemp1+1
EN2 anop
ldx #12
ldy #70
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
jsr Texte16
lda #0
sta FirstScore
inc ScoreTemp
jsr AfScore
pla
pha
tay
tax
lda #0
sta vbest+1,x
EN3 anop
sty Temp
jsr WaitUser
ldy Temp
cmp #0 ;clic ou fire
beq EN3
cmp #$7f ;Delete ?
beq EN4
cmp #$08 ;fleche gauche ?
beq EN4
cmp #$0d ;return ?
beq EN5
cmp #$5b ;A-Z, 0-9, espace, ...
blt EN30
sec
sbc #$20 ;force majuscule
EN30 anop
sta Temp
lda vbest+1,y ;nb caracteres str
tax
cpx #9
beq EN3
pla
tax
lda Temp
sta vbest+2,x ;caractere tape
inx
txa
pha
tya
tax
inc vbest+1,x
EN33 anop
sty Temp
tya
clc
adc #vbest+1
sta GSTemp1
lda #>vbest
sta GSTemp1+1
ldx #11
ldy #108
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
jsr Texte16
ldy Temp
jmp EN3
EN4 anop
tya
tax
lda vbest+1,x
beq EN3
dec vbest+1,x
pla
sec
sbc #1
pha
sty Temp
lda #11
sta GSTemp1
lda #108
sta GSTemp1+1
lda #18
sta GSTemp2
lda #15
sta GSTemp2+1
lda #0
sta GSTemp3
sta GSTemp3+1
jsr PaintRect
ldy Temp
jmp EN33
EN5 anop
pla
lda #1 ;HGR2
jsr ClearHGR
jsr CopyBest
rts
;--------------------------------------------------------------------------
ProDOSErr anop
bcs ProDOSerr2
rts
ProDOSErr2 anop
tax
lda HexDec,x
pha
and #$0f
clc
adc #$30 ;zero
sta Err2Str+1
pla
and #$f0
clc
lsr a
lsr a
lsr a
lsr a
clc
adc #$30 ;zero
sta Err2Str
lda #9
sta GSTemp1
lda #70
sta GSTemp1+1
lda #22
sta GSTemp2
lda #52
sta GSTemp2+1
lda #$ff
sta GSTemp3
sta GSTemp3+1
jsr PaintRect
lda #10
sta GSTemp1
lda #76
sta GSTemp1+1
lda #20
sta GSTemp2
lda #40
sta GSTemp2+1
lda #0
sta GSTemp3
sta GSTemp3+1
jsr PaintRect
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
lda #ProDOSstr1
sta GSTemp1
lda #>ProDOSstr1
sta GSTemp1+1
ldx #13
ldy #83
jsr Texte8
lda #ProDOSstr2
sta GSTemp1
lda #>ProDOSstr2
sta GSTemp1+1
ldx #14
ldy #93
jsr Texte8
lda #ErrStr
sta GSTemp1
lda #>ErrStr
sta GSTemp1+1
ldx #23
ldy #106
jsr Texte8
jsr WaitUser
ldx StackPtr
txs
jmp PnPEnd
;--------------------------------------------------------------------------
Alignement anop
lda #8*20 ;taille tableau - une ligne
sta Temp
bcl1 anop
lda #0
sta Multi
sta PileSize
sta Temp4+1
sta Temp4+2
sta Temp4+3
ldx Temp
lda Tableau0,x
bcl11 anop
sta Temp2
tax
lda TypeDep,x
cmp #13 ;affreux ?
bne pasAffreux
stx StackX
lda #1
ldx #5
jsr Sound
ldx StackX
sed
lda Time
sec
sbc #1
sta Time
bcs pastrouv0
lda Time+1
sec
sbc #1
sta Time+1
pastrouv0 cld
jmp pasTrouv2
pasAffreux anop
cmp #9
bge PasTrouv1
sta Temp3
cmp #6 ;multiplicateur?
bne PasMulti
lda Temp2
sec
sbc #61 ;numero element des multis - 2
sta Multi
pasMulti anop
lda ShScore,x
sta Temp4
lda Temp
sta Temp+1
bcl2 anop
inc PileSize
lda Temp+1
sec
sbc #20 ;ligne superieur
sta Temp+1
tax
lda Tableau0,x
beq Trouv1
tay
tax
lda TypeDep,x
cmp #6 ;multiplicateur ?
bne pasMulti2
tya
sec
sbc #61 ;numero element des multis - 2
cmp Multi
blt pasmulti2
sta Multi
pasMulti2 anop
sed
lda ShScore,x
cmp #$99
beq bcl2score0
clc
adc Temp4
sta Temp4
bcc bcl2score
bcl2score0 anop
inc Temp4+1
bcl2score anop
cld
lda TypeDep,x
beq Trouv1
cmp #9
beq pasTrouv1
tax
cpy Temp2
beq bcl2
cpx #5 ;bonus?
beq bcl2
cpx #6 ;multi?
beq bcl2
cpx #8 ;time?
beq bcl2
PasTrouv1 jmp pasTrouv2
Trouv1 anop
lda PileSize
cmp Minimum
blt pastrouv1
lda Temp
sta Temp+1
bcl3 anop
ldx Temp+1
lda Tableau0,x
cmp #80
blt bcl3notdiams
cmp #99
bge bcl3notdiams
ldx #0
bcl3diams anop
ldy Diams,x
cpy #5
beq bcl3okdiam
inx
cpx #20
bne bcl3diams
bcl3okdiam anop
sta Diams,x
bcl3notdiams anop
tay
lda TypeDep,y
cmp #8 ;time?
bne pastime2
sed
lda Time+1
clc
adc #2
sta Time+1
cld
PasTime2 anop
lda valcar,y ;afficher valeur de l'element
ldx Temp+1
sta Tableau0,x
lda #0
sta Tableau20,x
lda Temp+1
sec
sbc #20 ;ligne superieure
sta Temp+1
dec PileSize
bne bcl3
lda #10
sta Show ;pour ne pas effacer les valeurs
lda Temp4
sta Temp2
lda Temp4+1
sta Temp2+1
sed
ldx Multi
beq pasbcl4
dex
bcl4 anop
lda Temp4
clc
adc Temp2
sta Temp4
lda Temp4+1
adc Temp2+1
sta Temp4+1
dex
bne bcl4
pasbcl4 anop
cld
ldx Temp+1
lda Temp4+1
cmp #$01
blt pasbonx
cmp #$02
bge pasDiams1
lda #80 ;diams 1
sta Tableau,x
jmp pasbonx
pasDiams1 anop
cmp #$04
bge pasDiams2
lda #83 ;diams 2
sta Tableau,x
jmp pasbonx
pasDiams2 anop
cmp #$06
bge pasDiams3
lda #86 ;diams 3
sta Tableau,x
jmp pasbonx
pasDiams3 anop
cmp #$08
bge pasDiams4
lda #89 ;diams 4
sta Tableau,x
jmp pasbonx
pasDiams4 anop
cmp #$10
bge pasDiams5
lda #92 ;diams 5
sta Tableau,x
jmp pasbonx
pasDiams5 anop
lda #95 ;diams 6
sta Tableau,x
pasbonx anop
sed
clc
lda Temp4
adc Score
sta Score
lda Temp4+1
adc Score+1
sta Score+1
lda Temp4+2
adc Score+2
sta Score+2
lda Temp4+3
adc Score+3
sta Score+3
cld
PasTrouv2 anop
inc Temp
lda Temp
cmp #9*20 ;le tableau est fini ?
beq pasbcl1
jmp bcl1
pasbcl1 anop
ldx #8*20
bcl5 anop
lda Tableau-1,x
cmp #40 ;boule 1
beq pasReussit
cmp #41 ;boule 2
beq pasReussit
cmp #42 ;boule 3
beq pasReussit
dex
bne Bcl5
lda #-1
sta Reussit
rts
pasReussit anop
ldx #8*20
bcl6 anop
lda Tableau-1,x
cmp #135 ;pot de fleur ?
bne paspot
lda Tableau-1+20,x ;ligne suivante
beq Paspot
tay
lda TypeDep,y
cmp #11
beq paspot
cmp #20
beq paspot
lda #68 ;explosion
sta Tableau-1+20,x
paspot anop
dex
bne bcl6
rts
;--------------------------------------------------------------------------
DrawCursor anop
lda JoyX
clc
lsr a
lsr a
lsr a
lsr a
lsr a
sec
sbc #4
beq DCJoyX
bcc DCsubX
clc
adc Mx
sta Mx
jmp DCjoyX
DCsubX anop
eor #$ff
sta Temp
lda Mx
sec
sbc Temp
sta Mx
DCJoyX anop
lda JoyY
clc
lsr a
lsr a
lsr a
lsr a
lsr a
sec
sbc #4
beq DCJoyY
bcc DCsubY
clc
adc My
sta My
jmp DCjoyY
DCsubY anop
eor #$ff
sta Temp
lda My
sec
sbc Temp
sta My
DCJoyY anop
lda Mx
cmp #39
blt DCClampX
cmp #$e0
blt DCClampX0
lda #0
sta Mx
jmp DCClampX
DCClampX0 anop
lda #38
sta Mx
DCClampX anop
lda My
cmp #24
blt DCClampY
cmp #$e0
blt DCClampY0
lda #0
sta My
jmp DCClampY
DCClampY0 anop
lda #23
sta My
DCClampY anop
ldx Mx
beq doMousePos
dex
doMousePos anop
txa
clc
lsr a
ldx My
adc ShapeTableY,x
sta MousePos
adc #20
sta MousePos2
adc #1
sta MousePos3
sec
sbc #20
sta MousePos4
ldx Mx
ldy My
jsr XORCursor
lda OldMouse
cmp Mx
bne DCClearCursor
lda OldMouse+1
cmp My
beq DrawCursorDone
DCClearCursor anop
lda OldMouse
clc
lsr a
ldx OldMouse+1
adc ShapeTableY,x
tax
lda #0
sta Tableau2,x
sta Tableau2-1,x
sta Tableau2+20,x
sta Tableau2+20-1,x
DrawCursorDone anop
lda Mx
sta OldMouse
lda My
sta OldMouse+1
rts
XORCursor anop
lda ShapesLineY,y
clc
adc #4
sta Temp3
txa
sta Temp1
lda #0
sta Temp2
sta Temp4
tax
XORCursor2 anop
ldy Temp3
lda adrlo,y
clc
adc Temp1
sta <$50
lda adrhi,y
adc PageHGR
sta <$51
lda ($50,x)
ldy Temp4
and CursorMask,y
ora CursorPict,y
iny
sta ($50,x)
jsr Inc50
lda ($50,x)
and CursorMask,y
ora CursorPict,y
iny
sty Temp4
sta ($50,x)
inc Temp3
inc Temp2
lda Temp2
cmp #9
bne XORCursor2
rts
XORCursor3 anop
lda ShapesLineY2,y
sta Temp3
txa
asl a
sta Temp1
lda #0
sta Temp2
sta Temp4
tax
XORCursor4 anop
ldy Temp3
lda adrlo,y
clc
adc Temp1
sta <$50
lda adrhi,y
adc PageHGR
sta <$51
lda ($50,x)
ldy Temp4
and CursorMask2,y
ora CursorPict2,y
iny
sta ($50,x)
jsr Inc50
lda ($50,x)
and CursorMask2,y
ora CursorPict2,y
iny
sty Temp4
sta ($50,x)
inc Temp3
inc Temp2
lda Temp2
cmp #15
bne XORCursor4
rts
OldMouse ds 2
MousePos ds 1
MousePos2 ds 1
MousePos3 ds 1
MousePos4 ds 1
;---------------------------------------------------------------------
Explosions anop
ldy #250
sty MousePos
sty MousePos2
sty MousePos3
sty MousePos4
ldy #0
ldx #0
ExploLoop anop
lda #68
sta Tableau,y
lda #0
sta Tableau2,y
iny
cpy #20*8
bne ExploLoop
lda #10
Explo1 anop
pha
jsr Affiche
pla
sec
sbc #1
bne Explo1
lda AffSpeed
pha
lda #20
sta AffSpeed
lda #100
Explo2 anop
pha
jsr Random
and #$f
clc
adc #2
sta Temp
jsr Random
and #7
tax
lda #0
ExploMul anop
cpx #0
beq ExploMul2
clc
adc #20
dex
jmp ExploMul
ExploMul2 anop
clc
adc Temp
tax
lda #68 ;explosion
sta Tableau,x
jsr Affiche
pla
sec
sbc #1
bne Explo2
pla
sta AffSpeed
lda #10
Explo3 anop
pha
jsr Affiche
pla
sec
sbc #1
bne Explo3
lda #10
jsr Pause
rts
;---------------------------------------------------------------------
Preparation anop
jsr Nettoyage
lda #200
sec
sbc Level
sta vexplo
lda #0
sta Temp
lda Level
asl a
asl a
asl a
asl a
clc
adc #Diff
bcc Prep0
inc Temp
Prep0 anop
sta <$50
lda Level
clc
lsr a
lsr a
lsr a
lsr a
clc
adc #>Diff
adc Temp
sta <$51
ldx #0
lda ($50,x) ;nb de balles
sta nbBalls
jsr Inc50
jsr Inc50
lda ($50,x) ;time+1
sta Time+1
jsr Inc50
lda ($50,x) ;time
sta Time
jsr Inc50
lda ($50,x) ;longueur-1 des lignes
clc
adc #1
sta Minimum
jsr Inc50
jsr Inc50
lda ($50,x) ;difficulte
sta Difficulte
jsr Inc50
jsr Inc50
lda ($50,x) ;% tete de mort
sta Affreux
jsr Inc50
jsr Inc50
lda ($50,x) ;% flammes
sta Flammes
jsr Inc50
jsr Inc50
lda ($50,x) ;% pot fleurs
sta Pot
jsr CopyBest
jsr Afscore
inc doFall ;simule l'appuie sur espace
sta $c010 ;echantillonnage clavier
Prep2 anop
lda vmousejoy
bne pasReadX2
ldx #0
jsr $FB1E
sty JoyX
pasReadX2 anop
jsr GestionSouris
jsr Afscore
jsr Poum
lda vmousejoy
bne pasReadY2
ldx #1 *******
jsr $FB1E *
sty JoyY *
pasReadY2 anop
jsr DrawCursor
jsr Affiche
jsr DeplaceBloc
lda $c000
bpl Prep3
and #$7f
cmp #'p'
beq Prep22
cmp #'P'
beq Prep22
jmp Prep3
Prep22 anop
jsr doPause
Prep3 anop
ldy vmousejoy
beq pasReadKeys2
jsr KeyMove
pasReadKeys2 anop
dec NbBalls
bne Prep2
dec doFall
rts
;---------------------------------------------------------------------
doPause anop
ldx #15
ldy #96
lda #phpause
sta GSTemp1
lda #>phpause
sta GSTemp1+1
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
jsr Texte16
jsr WaitUser ;* Debug
cmp #'*' ;*
bne doPause1 ;*
lda #$01 ;*
sta Time+1 ;*
lda #1 ;*
sta Vies ;*
lda #0 ;*
sta FirstScore ;*
jmp doPause2 ;*
doPause1 anop ;*
cmp #'+' ;*
bne doPause2 ;*
sed ;*
lda Score+1 ;*
clc ;*
adc #1 ;*
sta Score+1 ;*
cld ;*
inc ScoreTemp ;*
inc ScoreTemp ;*
jsr AfScore ;*
jmp doPause ;*
doPause2 anop
jsr ForceAff
rts
;---------------------------------------------------------------------
GestionSouris anop
jsr Random
sta Temp3
lda Temp3
cmp #8
bge doFallTest
lda Difficulte
bge doFallTest
and RNDRoot
and RNDRoot+1
cmp #1
bne doFallTest
cmp Temp3
beq doFallRout
doFallTest anop
lda doFall
beq notFallRout
doFallRout anop
jsr Random
eor Temp3
and #%00111100 ;colonne entre 0 et 15
clc
lsr a
lsr a
adc #2 ;...entre 2 et 17
tay
jsr Random
sta Temp3
lda #0
sta Temp4
ldx #0
RndLoop anop
lda Apparition,x
beq pasval
bmi notFallRout
clc
adc Temp4
sta Temp4
cmp Temp3
bge OkVal
pasval anop
inx
jmp RndLoop
okval anop
txa
sta Tableau0,y
notFallRout anop
lda Etalon
bne PasApp
lda MBut
bne doSourisFire
lda $c061
bmi doSourisFire
rts
doSourisFire anop
lda #0
sta MBut
lda #3
sta Etalon
lda OkClic
bne DejaClic
lda #12
ldx #8
jsr Sound
ldx MousePos
lda Tableau,x
tax
lda TypeDep,x
beq PasApp
cmp #10
bge PasApp
ldx MousePos
lda #0
sta Tableau2,x
lda MousePos
sta Curs1
lda Mx
clc
lsr a
sta XSour
lda My
sta YSour
lda #-1
sta OkClic
PasApp anop
lda Etalon
beq PasApp2
dec Etalon
PasApp2 rts
dejaClic anop
ldx MousePos
lda Tableau,x
sta Temp2+1
tay
lda TypeDep,y
cmp #11
beq PasApp
ldx Curs1
lda Tableau,x
sta Temp2
ldx MousePos
sta Tableau,x
lda #0
sta Tableau2,x
tya
ldx Curs1
sta Tableau,x
lda #0
sta Tableau2,x
sta OkClic
lda #8
ldx #12
jsr Sound
ldx Temp2
lda TypeDep,x
cmp #7
bne PasApp
lda vexplo
sec
sbc #1
cmp Temp2+1
beq OkExplo
sec
sbc #10
cmp Temp2+1
beq OkExplo
sec
sbc #10
cmp Temp2+1
beq OkExplo
sec
sbc #10
cmp Temp2+1
beq OkExplo
sec
sbc #10
cmp Temp2+1
beq OkExplo
sec
sbc #10
cmp Temp2+1
beq OkExplo
sec
sbc #10
cmp Temp2+1
beq OkExplo
sec
sbc #10
cmp Temp2+1
beq OkExplo
sec
sbc #10
cmp Temp2+1
beq OkExplo
lda #68
FillExplo anop
ldy Diams
ldx MousePos
sta Tableau-20-1,x
sta Tableau-20,x
sta Tableau-20+1,x
sta Tableau-1,x
sta Tableau,x
sta Tableau+1,x
sta Tableau+20-1,x
sta Tableau+20,x
sta Tableau+20+1,x
sty Diams
jmp doGround
OkExplo anop
jsr Random
and #$f
clc
adc #82
jmp FillExplo
doGround anop
lda #0
sta Tableau2-20-1,x
sta Tableau2-20,x
sta Tableau2-20+1,x
sta Tableau2-1,x
sta Tableau2,x
sta Tableau2+1,x
sta Tableau2+20-1,x
sta Tableau2+20,x
sta Tableau2+20+1,x
ldx #0
lda #2
doGroundLoop anop
sta Diams-20,x
inx
cpx #20
bne doGroundLoop
jmp PasApp
;---------------------------------------------------------------------
DeplaceBloc anop
ldx #20*8-1
DepBloc1 anop
lda Tableau-20,x ;on charge un element
beq PasTombe
tay
lda TypeDep,y
cmp #20
bge PasTombe
tay
lda Tableau,x ;ligne en dessous
bne tpasbas
lda Tableau-20,x
sta Tableau,x
lda #0
sta Tableau-20,x
sta Tableau2-20,x
sta Tableau2,x
jmp pasTombe
tpasbas anop
cpy #9
beq PasTombe
jsr Random
and #%00000010
bne tgauche
lda Tableau+1,x
bne pastombe
lda Tableau-20,x
sta Tableau+1,x
lda #0
sta Tableau-20,x
sta Tableau2-20,x
sta Tableau2+1,x
jmp pastombe
tgauche anop
lda Tableau-1,x
bne pastombe
lda Tableau-20,x
sta Tableau-1,x
lda #0
sta Tableau-20,x
sta Tableau2-20,x
sta Tableau2-1,x
Pastombe anop
dex
bne DepBloc1
ldx #20
lda #0
ClearSky anop
sta Tableau0-1,x
dex
bne ClearSky
rts
;---------------------------------------------------------------------
Affiche anop
lda #0
sta GSTemp2
lda #$20
sta GSTemp2+1
ldx #0
lda Show
beq Affiche1
dec Show
Affiche1 anop
stx Temp
lda OffSetX,x
sta GSTemp7 ;x dest
lda OffSetY,x
clc
adc #42 ;tableau de bord
sta GSTemp7+1 ;y dest
lda Tableau,x
ldy Show
beq OkAnim
cmp #160 ;element valeur alignement
bge Aff123
OkAnim anop
tax
ldy TypeDep,x
cpy #14 ;flamme
bne Affpasflamme
pha
jsr Random
tay
ldx Temp
pla
iny
bne AffPasFlamme
sta Tableau-20,x ;propagation des flammes
AffPasFlamme anop
ldx Temp
tay
lda Listeanim,y ;animation de l'objet
cmp Tableau,x
beq Aff123
sta Tableau,x
jmp Aff124
Aff123 anop
ldy Tableau2,x
bne NotAff
Aff124 anop
tay
lda OffSetX,y
sta GSTemp6 ;x source
lda OffSetY,y
sta GSTemp6+1 ;y source
lda #$80
sta Tableau2,x ;ne pas reafficher!
inc AffNumber
jsr Sprite16
lda Curs1
cmp Temp
beq AffCurs0
cmp MousePos
beq AffCurs0
cmp MousePos2
beq AffCurs0
cmp MousePos3
beq AffCurs0
cmp MousePos4
bne AffCurs1
AffCurs0 anop
lda OkClic
beq AffCurs1
inc AffNumber
ldx XSour
ldy YSour
jsr XORCursor3
Affcurs1 anop
lda Temp
cmp MousePos
beq AffFleche
cmp MousePos2
beq AffFleche
cmp MousePos3
beq AffFleche
cmp MousePos4
bne NotAff
AffFleche anop
inc AffNumber
ldx Mx
ldy My
jsr XORCursor ;utilise Temp1-4
NotAff anop
ldx Temp
inx
cpx #20*10
beq AfficheDone
jmp Affiche1
AfficheDone anop
lda AffNumber
cmp AffSpeed
blt AfficheDone2
lda #0
sta AffNumber
rts
AfficheDone2 anop ;Tempo pour vitesse constante
lda #10
sta GSTemp6 ;x source
lda #0
sta GSTemp6+1 ;y source
lda #38
sta GSTemp7 ;x dest
lda #177
sta GSTemp7+1 ;y dest
jsr Sprite16
inc AffNumber
lda AffNumber
cmp AffSpeed
bne AfficheDone2
lda #0
sta AffNumber
rts
;---------------------------------------------------------------------
Poum anop
sed
lda Time
sec
sbc #1
sta Time
bcs Poum2
lda Time+1
sec
sbc #1
sta Time+1
Poum2 anop
cld
lda vtictac
bne PoumDone
ldx vpoum
beq doPoum
dex
stx vpoum
jmp PoumDone
doPoum anop
lda TicSide
eor #$ff
sta TicSide
bne TicLeft
lda #25
jmp TicRight
TicLeft anop
lda #15
TicRight anop
ldx #8
jsr Sound ;clic...c'est le tictac!
lda Time+1
sta vpoum
PoumDone anop
rts
;---------------------------------------------------------------------
CopyBest anop
lda #1
jsr ClearHGR2
lda #0
sta Temp2
lda #150
sta Temp
CopyBestLoop anop
ldx Temp
lda adrlo,x
sta <$50
lda adrhi,x
adc #$60 ;Buffer car
sta <$51
ldx Temp2
lda adrlo,x
sta <$52
lda adrhi,x
adc #$40 ;HGR2
sta <$53
ldy #40
CopyBestLine anop
ldx #0
lda ($50,x) ;copie d'une ligne
sta ($52,x)
jsr Inc50
jsr Inc52
dey
bne CopyBestLine
inc Temp
inc Temp2
lda Temp2
cmp #42
bne CopyBestLoop
rts
;---------------------------------------------------------------------
Afscore anop
lda ELife
cmp Score+2
beq AfScore2
AfScore1 anop ;extra life !
lda #0
sta FirstScore
lda Score+2
sta ELife
sed
lda Vies
clc
adc #1
sta Vies
cld
lda #7
sta GSTemp1
lda #70
sta GSTemp1+1
lda #26
sta GSTemp2
lda #46
sta GSTemp2+1
lda #%10101010
sta GSTemp3
lda #%11010101
sta GSTemp3+1
jsr PaintRect
lda #8
sta GSTemp1
lda #73
sta GSTemp1+1
lda #24
sta GSTemp2
lda #40
sta GSTemp2+1
lda #0
sta GSTemp3
sta GSTemp3+1
jsr PaintRect
ldx #10
ldy #85
lda #phextralife
sta GSTemp1
lda #>phextralife
sta GSTemp1+1
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
jsr Texte16
lda #15
jsr Pause
jsr ForceAff
AfScore2 anop
;-----------------------
;affiche le temps
clc
lda Time
and #$0f
adc #$c2 ;zero (66 + $80)
sta ScoreStr+4
lda Time
and #$f0
lsr a
lsr a
lsr a
lsr a
adc #$c2 ;zero (66 + $80)
sta ScoreStr+3
lda Time+1
and #$0f
adc #$c2 ;zero (66 + $80)
sta ScoreStr+2
lda Time+1
and #$f0
lsr a
lsr a
lsr a
lsr a
adc #$c2 ;zero (66 + $80)
sta ScoreStr+1
lda #4
sta ScoreStr
ldx #30
ldy #9
lda #ScoreStr
sta GSTemp1
lda #>ScoreStr
sta GSTemp1+1
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
jsr Texte16
;-----------------------
;affiche le score
lda Score
eor Score+1
eor Score+2
eor Score+3
sta Temp
lda ScoreTemp
eor ScoreTemp+1
eor ScoreTemp+2
eor ScoreTemp+3
cmp Temp
bne doAffScore
jmp affvie
doAffScore anop
lda AffNumber ;controle de la vitesse
clc ;d'affichage
adc #7
sta AffNumber
clc
lda Score
and #$0f
adc #$c2 ;zero (66 + $80)
sta ScoreStr+7
lda Score
and #$f0
lsr a
lsr a
lsr a
lsr a
adc #$c2 ;zero (66 + $80)
sta ScoreStr+6
lda Score+1
and #$0f
adc #$c2 ;zero (66 + $80)
sta ScoreStr+5
lda Score+1
and #$f0
lsr a
lsr a
lsr a
lsr a
adc #$c2 ;zero (66 + $80)
sta ScoreStr+4
lda Score+2
and #$0f
adc #$c2 ;zero (66 + $80)
sta ScoreStr+3
lda Score+2
and #$f0
lsr a
lsr a
lsr a
lsr a
adc #$c2 ;zero (66 + $80)
sta ScoreStr+2
lda Score+3
and #$0f
adc #$c2
sta ScoreStr+1
lda #7
sta ScoreStr
ldx #12
ldy #9
lda #ScoreStr
sta GSTemp1
lda #>ScoreStr
sta GSTemp1+1
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
jsr Texte16
lda Score
sta ScoreTemp
lda Score+1
sta ScoreTemp+1
lda Score+2
sta ScoreTemp+2
lda Score+3
sta ScoreTemp+3
;-----------------------
;affiche les vies
affvie anop
lda FirstScore
beq doScore
rts
doScore inc FirstScore
clc
lda Vies
and #$0f
adc #$c2 ;zero (66 + $80)
sta ScoreStr+2
lda Vies
and #$f0
lsr a
lsr a
lsr a
lsr a
adc #$c2 ;zero (66 + $80)
sta ScoreStr+1
lda #2
sta ScoreStr
ldx #2
ldy #9
lda #ScoreStr
sta GSTemp1
lda #>ScoreStr
sta GSTemp1+1
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
jsr Texte16
;-----------------------
;affiche les blasons
lda Level
sta Temp
ldx #0
Blason50 anop
lda Temp
cmp #50
blt Blason10
sec
sbc #50
sta Temp
inx
lda #204 ;blason 50
sta ScoreStr,x
jmp Blason50
Blason10 anop
lda Temp
cmp #10
blt Blason5
sec
sbc #10
sta Temp
inx
lda #205 ;blason 10
sta ScoreStr,x
jmp Blason10
Blason5 anop
lda Temp
cmp #5
blt Blason1
sec
sbc #5
sta Temp
inx
lda #206 ;blason 5
sta ScoreStr,x
jmp Blason5
Blason1 anop
lda Temp
beq Blason0
sec
sbc #1
sta Temp
inx
lda #207 ;blason 1
sta ScoreStr,x
jmp Blason1
Blason0 anop
stx ScoreStr
ldx #10
ldy #26
lda #ScoreStr
sta GSTemp1
lda #>ScoreStr
sta GSTemp1+1
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
jsr Texte16
rts
;---------------------------------------------------------------------
Inc50 anop
lda <$50
clc
adc #1
bcs Inc51
sta <$50
rts
Inc51 anop
sta <$50
inc <$51
rts
;---------------------------------------------------------------------
Inc52 anop
lda <$52
clc
adc #1
bcs Inc53
sta <$52
rts
Inc53 anop
sta <$52
inc <$53
rts
;---------------------------------------------------------------------
InitLevel anop
lda #Menu ;ptr string
sta GSTemp1
lda #>Menu
sta GSTemp1+1
lda #0 ;taille a lire
sta GSTemp2
lda #$20
sta GSTemp2+1
lda #0 ;buffer mem
sta GSTemp3
lda #$40
sta GSTemp3+1
jsr LoadFile
lda #$ff
sta ScoreTemp
lda Player
bne ILpl2
lda Score1
sta Score
lda Score1+1
sta Score+1
lda Score1+2
sta Score+2
lda Score1+3
sta Score+3
lda Vies1
sta Vies
lda ELife1
sta ELife
lda Level1
sta Level
ldx #0
ILpl1Loop anop
lda Diams1,x
sta Diams,x
inx
cpx #20
bne ILpl1Loop
ldx #12
ldy #96
lda #phplayer1
sta GSTemp1
lda #>phplayer1
sta GSTemp1+1
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
jsr Texte16
jmp IL2
ILPl2 anop
lda Score2
sta Score
lda Score2+1
sta Score+1
lda Score2+2
sta Score+2
lda Score2+3
sta Score+3
lda Vies2
sta Vies
lda ELife2
sta ELife
lda Level2
sta Level
ldx #0
ILpl2Loop anop
lda Diams2,x
sta Diams,x
inx
cpx #20
bne ILpl2Loop
ldx #12
ldy #96
lda #phplayer2
sta GSTemp1
lda #>phplayer2
sta GSTemp1+1
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
jsr Texte16
IL2 anop
ldx #13
ldy #115
lda #phready
sta GSTemp1
lda #>phready
sta GSTemp1+1
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
jsr Texte16
ldx #0
lda Level
IL3Loop anop
sec
sbc #5
bcc IL4
inx
inx
cpx #20
bne IL3Loop
ldx #0
jmp IL3Loop
IL4 anop
lda LoadTable,x ;ptr string
sta GSTemp1
lda LoadTable+1,x
sta GSTemp1+1
lda #0 ;taille a lire
sta GSTemp2
lda #$20
sta GSTemp2+1
lda #0 ;buffer mem
sta GSTemp3
lda #$20 ;hgr1
sta GSTemp3+1
jsr LoadFile
jsr WaitUser
rts
;---------------------------------------------------------------------
Nettoyage anop
ldx #0
txa
NettoyLoop anop
sta Tableau,x
sta Tableau2,x
inx
cpx #9*20
bne NettoyLoop
ldx #0
lda #2
NettoyLoop2 anop
sta Tableau+(8*20),x
inx
cpx #20
bne NettoyLoop2
rts
;---------------------------------------------------------------------
ForceAff anop
ldx #0
txa
ForceALoop anop
sta Tableau2,x
inx
cpx #10*20
bne ForceALoop
rts
;---------------------------------------------------------------------
ClrDiams anop
lda #5
ldx #0
ClrDiamsLoop anop
sta Diams,x
inx
cpx #20*3 ;diams + diams1 + diams2
bne ClrDiamsLoop
rts
;---------------------------------------------------------------------
Presentation anop
lda #Convers ;ptr string
sta GSTemp1
lda #>Convers
sta GSTemp1+1
lda #0 ;taille a lire
sta GSTemp2
lda #$20
sta GSTemp2+1
lda #0 ;buffer mem
sta GSTemp3
lda #$40
sta GSTemp3+1
jsr LoadFile
jsr WaitUser
lda #Presents ;ptr string
sta GSTemp1
lda #>Presents
sta GSTemp1+1
lda #0 ;taille a lire
sta GSTemp2
lda #$20
sta GSTemp2+1
lda #0 ;buffer mem
sta GSTemp3
lda #$40
sta GSTemp3+1
jsr LoadFile
jsr WaitUser
lda #1 ;Hgr2
jsr ClearHGR
lda #Menu ;ptr string
sta GSTemp1
lda #>Menu
sta GSTemp1+1
lda #0 ;taille a lire
sta GSTemp2
lda #$20
sta GSTemp2+1
lda #0 ;buffer mem
sta GSTemp3
lda #$40
sta GSTemp3+1
jsr LoadFile
jsr ChoixnbPlayer
jsr ChoixLevel
jsr ChoixMouseJoy
jsr ChoixTictac
PrepWait anop
jsr WaitUser
cmp #'1'
bne PW2
lda nbPlayer
eor #1
sta nbPlayer
jsr ChoixNbPlayer
jmp PrepWait
PW2 anop
cmp #'2'
bne PW3
lda Level1x
eor #1
sta Level1x
jsr ChoixLevel
jmp PrepWait
PW3 anop
cmp #'3'
bne PW4
lda vmousejoy
eor #1
sta vmousejoy
jsr ChoixMouseJoy
jmp PrepWait
PW4 anop
cmp #'4'
bne PW5
lda vtictac
eor #1
sta vtictac
jsr ChoixTictac
jmp PrepWait
PW5 anop
cmp #27
bne PW6
sec
rts
PW6 anop
cmp #0
beq okPW7
cmp #' '
beq okPW7
cmp #13
bne PW7
okPW7 anop
lda #1 ;hgr2
jsr ClearHGR
clc
rts
PW7 anop
jmp PrepWait
;---------------------------------------------------------------------
ChoixMouseJoy anop
lda vmousejoy
bne CMJ2
ldx #8
ldy #108
lda #phmouse
sta GSTemp1
lda #>phmouse
sta GSTemp1+1
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
jsr Texte16
rts
CMJ2 anop
ldx #8
ldy #108
lda #phjoy
sta GSTemp1
lda #>phjoy
sta GSTemp1+1
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
jsr Texte16
rts
;---------------------------------------------------------------------
ChoixLevel anop
lda Level1x
bne CLV2
ldx #8
ldy #91
lda #phleveleasy
sta GSTemp1
lda #>phleveleasy
sta GSTemp1+1
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
jsr Texte16
lda #1
sta Level1
sta Level2
rts
CLV2 anop
ldx #8
ldy #91
lda #phlevelhard
sta GSTemp1
lda #>phlevelhard
sta GSTemp1+1
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
jsr Texte16
lda #50
sta Level1
sta Level2
rts
;---------------------------------------------------------------------
ChoixnbPlayer anop
lda nbPlayer
bne CNP2
ldx #30
ldy #75
lda #phclear
sta GSTemp1
lda #>phclear
sta GSTemp1+1
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
jsr Texte16
ldx #8
ldy #75
lda #phplay1
sta GSTemp1
lda #>phplay1
sta GSTemp1+1
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
jsr Texte16
rts
CNP2 anop
ldx #8
ldy #75
lda #phplay2
sta GSTemp1
lda #>phplay2
sta GSTemp1+1
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
jsr Texte16
rts
;---------------------------------------------------------------------
ChoixTictac anop
lda vTictac
bne CTT2
ldx #30
ldy #126
lda #phclear
sta GSTemp1
lda #>phclear
sta GSTemp1+1
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
jsr Texte16
ldx #8
ldy #126
lda #phtictac1
sta GSTemp1
lda #>phtictac1
sta GSTemp1+1
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
jsr Texte16
rts
CTT2 anop
ldx #8
ldy #126
lda #phtictac2
sta GSTemp1
lda #>phtictac2
sta GSTemp1+1
lda #0
sta GSTemp2
lda #$60
sta GSTemp2+1
jsr Texte16
rts
KeyUp str 'I i'
KeyLeft str 'J j'
KeyRight str 'L l'
KeyDown str 'K k'
KeyPick str 'PICK: Space'
KeyFall str 'FALL: Return'
HiVert ds 1
CalibKey dc i1'1'
NeedSave ds 1
nbPlayer ds 1
vtictac ds 1
vmousejoy ds 1
Etalon ds 1
OkClic ds 1
Curs1 ds 1
XSour ds 1
YSour ds 1
Level1x ds 1
Level ds 1
Level1 ds 1
Level2 ds 1
Vies ds 1
Vies1 ds 1
Vies2 ds 1
ELife ds 1
ELife1 ds 1
ELife2 ds 1
ScoreTemp ds 4
Score ds 4
Score1 ds 4
Score2 ds 4
Player ds 1
FirstScore ds 1
Time ds 2
Multi ds 1
PileSize ds 1
Show ds 1
vexplo ds 1
nbBalls ds 1
Reussit ds 1
AffNumber ds 1
TicSide ds 1
Minimum ds 1
Difficulte ds 1
vpoum ds 1
doFall ds 1
JoyX dc i1'128'
JoyY dc i1'128'
AffSpeed dc i1'40'
StackPtr ds 1
ScoreStr ds 20
ShapesLineY dc i1'42,47,52,57,62,67,72,77,82,87,92,97'
dc i1'102,107,112,117,122,127,132,137,142,147,152,157'
ShapesLineY2 dc i1'42,42,42,57,57,57,72,72,72,87,87,87'
dc i1'102,102,102,117,117,117,132,132,132,147,147,147'
ShapeTableY dc i1'0,0,0,20,20,20,40,40,40,60,60,60'
dc i1'80,80,80,100,100,100,120,120,120,140,140,140'
Tableau0 anop
ds 20
Tableau ds 20*9
Diams ds 20
Diams1 ds 20
Diams2 ds 20
Tableau20 anop
ds 20
Tableau2 ds 20*9
DiamsTbl2 ds 20
HexDec dc h'00010203040506070809101112131415161718192021222324'
dc h'25262728293031323334353637383940414243444546474849'
dc h'50515253545556575859606162636465666768697071727374'
dc h'75767778798081828384858687888990919293949596979899'
phclear str ' '
phplay1 str '1. 1 PLAYER'
phplay2 str '1. 2 PLAYERS'
phlevelhard str '2. LEVEL HARD'
phleveleasy str '2. LEVEL EASY'
phjoy str '3. KEYBOARD'
phmouse str '3. JOYSTICK'
phtictac1 str '4. TICTAC ON'
phtictac2 str '4. TICTAC OFF'
phgameover str 'GAME OVER'
phextralife str 'EXTRA LIFE'
phbest str 'ENTER YOUR NAME'
phtolate str 'SORRY TOO LATE !'
phplayer1 str 'PLAYER 1'
phplayer2 str 'PLAYER 2'
phready str 'READY !'
name1 str ']]]]]]]]]]'
name2 str ']]]]]]]]]]'
ready str 'READY !'
phnumber1 str 'RANK :'
phlevel1 str 'LEVEL :'
phname1 str 'NAME :'
phscore str 'SCORE :'
phhi str 'BEST SCORES'
phpause str 'PAUSE'
ProDOSstr1 str 'PRODOS ERROR!'
ProDOSstr2 str 'Press a key'
SaveHS str 'HiScores not saved.'
ErrStr dc i1'7'
dc c'Err #'
Err2Str ds 2
CalibStr1 str 'ADJUST JOY & KEYS'
CalibStr2 str 'Press "ESC" to continue'
WrongCode str 'WRONG CODE...press any key to quit !'
PassText str 'Enter password for...'
PassLine str 'Line: '
PassRow str 'Row : '
CodeX ds 1
CodeY ds 1
***************************************
Serie dc c'.mgb.'
***************************************
Temp ds 2
Temp1 ds 2
Temp2 ds 2
Temp3 ds 2
Temp4 ds 4
***************************************
MSB ON
LoadTable anop
dc i2'Motif1'
dc i2'Motif2'
dc i2'Motif3'
dc i2'Motif4'
dc i2'Motif5'
dc i2'Motif6'
dc i2'Motif7'
dc i2'Motif8'
dc i2'Motif9'
dc i2'Motif10'
Motif1 str 'PNP.Datas/Ball8'
Motif2 str 'PNP.Datas/Ball2'
Motif3 str 'PNP.Datas/Ball3.5.9'
Motif4 str 'PNP.Datas/Ball4'
Motif5 str 'PNP.Datas/Ball3.5.9'
Motif6 str 'PNP.Datas/Ball6'
Motif7 str 'PNP.Datas/Ball1.7'
Motif8 str 'PNP.Datas/Ball1.7'
Motif9 str 'PNP.Datas/Ball3.5.9'
Motif10 str 'PNP.Datas/Ball10'
Presents str 'PNP.Datas/Present2'
Menu str 'PNP.Datas/Menu1'
Car str 'PNP.Datas/Car'
Convers str 'PNP.Datas/Convers'
Calib str 'PNP.Datas/Calib'
vbestFile str 'PNP.Datas/HiScores'
OpenHS anop
dc i1'3'
dc i2'vbestfile'
dc i2'IOBuffer'
RefNumHS ds 1
WriteHS anop
dc i1'4'
ds 1
dc i2'vbest'
dc i2'96'
ds 2
CloseHS anop
dc i1'1'
ds 1
MSB OFF
****************************************
CursorPict anop
dc b'00000000 00000000'
dc b'00011000 00000000'
dc b'01111000 00000000'
dc b'01111000 00000011'
dc b'01111000 00001111'
dc b'01111000 00000001'
dc b'00011000 00000011'
dc b'00000000 00000110'
dc b'00000000 00000000'
CursorMask anop
dc b'11100111 11111111'
dc b'10000001 11111111'
dc b'10000001 11111100'
dc b'10000001 11110000'
dc b'10000001 11000000'
dc b'10000001 11100000'
dc b'10000001 11110000'
dc b'10100111 11100000'
dc b'11111111 11111001'
CursorPict2 anop
dc b'01111111 01111111'
dc b'01111111 01111111'
dc b'00000111 01110000'
dc b'00000111 01110000'
dc b'00000111 01110000'
dc b'00000111 01110000'
dc b'00000111 01110000'
dc b'00000111 01110000'
dc b'00000111 01110000'
dc b'00000111 01110000'
dc b'00000111 01110000'
dc b'00000111 01110000'
dc b'00000111 01110000'
dc b'01111111 01111111'
dc b'01111111 01111111'
CursorMask2 anop
dc b'10000000 10000000'
dc b'10000000 10000000'
dc b'11110000 10000111'
dc b'11110000 10000111'
dc b'11110000 10000111'
dc b'11110000 10000111'
dc b'11110000 10000111'
dc b'11110000 10000111'
dc b'11110000 10000111'
dc b'11110000 10000111'
dc b'11110000 10000111'
dc b'11110000 10000111'
dc b'11110000 10000111'
dc b'10000000 10000000'
dc b'10000000 10000000'
copy Datas.Src
copy GameSys.Src
END