antoine-source/leretour/apple2/fr/leretour.s

1916 lines
22 KiB
ArmAsm
Raw Normal View History

2023-12-29 09:09:50 +00:00
*
* Le retour du Dr Genius
*
* (c) 1983, Loriciels
* (c) 2023, Brutal Deluxe Software (Apple II)
*
mx %11
lst off
*-----------------------------------
* SOFTSWITCHES AND FRIENDS
*-----------------------------------
2024-01-01 18:41:02 +00:00
textX = $30 ; les X/Y pour afficher les
textY = textX+2 ; caracteres QuickDraw II
2023-12-29 09:09:50 +00:00
2024-01-06 22:31:19 +00:00
LINNUM = $50 ; result from GETADR
2023-12-29 09:09:50 +00:00
2024-01-01 18:41:02 +00:00
chrLA = $08
chrRA = $15
chrDEL = $7f
chrRET = $0d
chrSPC = $20
maxLEN = 40
chrOUI = 'O'
chrNON = 'N'
idxTIMER = 200
2024-01-06 22:31:19 +00:00
idxMUSIC = 201
2023-12-29 09:09:50 +00:00
2024-01-06 16:13:17 +00:00
*-----------------------------------
2023-12-29 09:09:50 +00:00
*-----------------------------------
* MACROS
*-----------------------------------
@draw mac
2024-01-03 18:08:53 +00:00
lda ]1
2023-12-29 09:09:50 +00:00
jsr showPIC
eom
@explode mac
jsr EXPLODE
eom
@print mac
ldx #>]1
ldy #<]1
jsr printCSTRING
eom
2024-01-04 18:19:54 +00:00
@gotoxy mac
2024-01-05 16:01:36 +00:00
ldx #]1
ldy #]2
2024-01-04 18:19:54 +00:00
jsr GOTOXY
eom
@printxy mac
ldx #>]1
ldy #<]1
jsr COUTXY
eom
2023-12-29 09:09:50 +00:00
@wait mac
2023-12-31 20:27:37 +00:00
lda #>]1
2023-12-29 09:09:50 +00:00
ldy #<]1
jsr waitMS
eom
2024-01-05 18:49:35 +00:00
@zap mac
jsr ZAP
eom
2023-12-29 09:09:50 +00:00
*-----------------------------------
* CODE BASIC EN ASM :-)
*-----------------------------------
2024-01-01 07:25:27 +00:00
PLAY sep #$30
jsr initALL
2024-01-05 21:47:54 +00:00
REPLAY sep #$30
2024-01-06 22:31:19 +00:00
jsr FULLHGR
rep #$30 ; init 16-bits, c'est mieux
stz textX
2024-01-06 16:13:17 +00:00
lda #row16
sta textY
2024-01-06 22:31:19 +00:00
sep #$30
2023-12-29 09:09:50 +00:00
*-----------------------------------
* DU BASIC A L'ASSEMBLEUR (BEURK)
*-----------------------------------
2024-01-03 18:08:53 +00:00
:100 ldx #$11
lda P,x
cmp #1
beq :140
2023-12-29 09:09:50 +00:00
2024-01-03 18:08:53 +00:00
:101 lda SALLE
cmp #23
bne :102
ldx #3
lda P,x
cmp #1
beq :130
2023-12-29 09:09:50 +00:00
2024-01-03 18:08:53 +00:00
:102 lda SALLE
cmp #14
bne :104
ldx #4
lda P,x
cmp #1
beq :130
:104 lda SALLE
cmp #20
bne :106
ldx #5
2023-12-29 09:09:50 +00:00
lda P,x
2024-01-03 18:08:53 +00:00
cmp #1
beq :130
2023-12-29 09:09:50 +00:00
2024-01-03 18:08:53 +00:00
:106 lda SALLE
cmp #29
bne :108
ldx #6
lda P,x
cmp #1
beq :130
:108 lda SALLE
cmp #38
bne :110
ldx #7
lda P,x
cmp #1
beq :130
:110 jmp :200
2023-12-29 09:09:50 +00:00
:130 jsr HGR
@print #strILFAITNOIR
2024-01-06 22:31:19 +00:00
jsr :30000
2023-12-29 09:09:50 +00:00
jmp :500
2023-12-29 20:39:04 +00:00
:140 jsr HGR
@print #strVOSYEUX
jmp :500
2023-12-29 09:09:50 +00:00
*-----------------------------------
* 200 - description salle
*-----------------------------------
2024-01-06 22:31:19 +00:00
:200 jsr HGR
2024-01-03 18:08:53 +00:00
@draw SALLE
2023-12-29 09:09:50 +00:00
2024-01-03 18:08:53 +00:00
lda A2 ; trace des dessins
beq :206
cmp #1
bne :204
2024-01-04 18:19:54 +00:00
jsr :12010 ; 1er "cadre"
2024-01-03 18:08:53 +00:00
bra :206
:204 cmp #2
bne :206
2024-01-04 18:19:54 +00:00
jsr :12020 ; 2nd "cadre"
2024-01-03 18:08:53 +00:00
:206 lda PP
2024-01-04 18:19:54 +00:00
bne :210
2023-12-29 09:09:50 +00:00
2024-01-04 18:19:54 +00:00
lda SALLE
cmp #11
bne :300
lda #1
sta PP
jsr :4920
:210 ldx #-1
lda SALLE
cmp #21
bcs :220
ldx #1
jmp :270
:220 cmp #26
bcs :230
ldx #3
jmp :270
:230 cmp #31
bcs :240
ldx #0
jmp :270
:240 cmp #52
bcs :270
ldx #2
cmp #26
:270 cpx #-1
beq :300
txa
jsr printNIVEAU
*-----------------------------------
2023-12-29 09:09:50 +00:00
:300 lda #0
sta H
sta HH ; for comma
lda #1
sta N
:310 ldx N
lda O,x
cmp SALLE
bne :400
lda H
bne :350
@print #strILYA
inc H
:350 lda HH
beq :360
@print #strCOMMA
:360 @print #strSPACE
lda N
asl
tax
ldy tblO$,x
lda tblO$+1,x
tax
jsr printCSTRING
inc HH
:400 inc N
lda N
cmp #nbO
bcc :310
beq :310
2024-01-06 22:31:19 +00:00
* @print #strRETURN
2024-01-05 16:01:36 +00:00
2023-12-29 09:09:50 +00:00
*-----------------------------------
* 500 - ACCEPTATION COMMANDE
*-----------------------------------
2024-01-04 18:19:54 +00:00
:500 lda SALLE
cmp #51
beq :510
cmp #48
beq :510
cmp #22
beq :510
cmp #4
beq :510
cmp #17
beq :510
jmp :3500
:510 ldx #3
2023-12-29 09:09:50 +00:00
lda C,x
dec C,x
2024-01-04 18:19:54 +00:00
cmp #1
bne :520
jmp :4820 ; mort par contamination radioactive
2023-12-29 09:09:50 +00:00
2024-01-04 18:19:54 +00:00
:520 jmp :3500
2023-12-29 09:09:50 +00:00
2024-01-05 16:01:36 +00:00
*-----------
2023-12-29 20:39:04 +00:00
:530 @print #strCOMMANDE ; commande avec energie
2023-12-29 09:09:50 +00:00
:535 jsr GETLN1
jsr rewriteSTRING ; from lower to upper
2024-01-04 18:19:54 +00:00
jsr :6000 ; cherche les mots
2023-12-29 09:09:50 +00:00
lda MO$1
bne :900
2023-12-29 20:39:04 +00:00
@print #strJENECOMPRENDS
2024-01-04 18:19:54 +00:00
jmp :3500
2023-12-29 09:09:50 +00:00
*-----------------------------------
* 900 - CONTROLES APPLE II
*-----------------------------------
2024-01-01 18:41:02 +00:00
:900 cmp #idxTIMER
2024-01-06 22:31:19 +00:00
bne :905
2023-12-29 09:09:50 +00:00
jsr switchENERGIE
jmp :100
2024-01-06 22:31:19 +00:00
:905 cmp #idxMUSIC
bne :915
jsr switchMUSIC
jmp :100
2023-12-29 09:09:50 +00:00
*-----------------------------------
* 910 - CONTROLE MVT
*-----------------------------------
:915 ldy #0
:920 lda SALLE ; T$=MID(M$(SALLE),Z,2)
asl
tax
lda tblM$,x
sta LINNUM
lda tblM$+1,x
sta LINNUM+1
lda (LINNUM),y
beq :980
cmp MO$1
bne :970
:950 iny
lda (LINNUM),y
sta SALLE
jmp :100
:970 iny
iny
bne :920
:980 lda #0
sta T
sta A1
*-----------------------------------
* 1000 - CONTROLE
*-----------------------------------
2024-01-04 18:19:54 +00:00
:1000 lda #10 ; met n'importe quoi
sta BFF0
jsr checkACTION
lda BFF0
bne :1700 ; 0 si rien trouv<75>
2023-12-29 09:09:50 +00:00
2024-01-04 18:19:54 +00:00
@print #strIMPOSSIBLE
2023-12-29 09:09:50 +00:00
lda MO$1 ; les directions
2024-01-04 18:19:54 +00:00
cmp #9
bcs :1040
2023-12-29 09:09:50 +00:00
@print #strCECHEMIN
2024-01-04 18:19:54 +00:00
:1040 @print #strEXCLAM
jmp :500
2024-01-05 16:01:36 +00:00
2023-12-29 09:09:50 +00:00
*-----------------------------------
* 1700 - ACTIONS
*-----------------------------------
2024-01-04 18:19:54 +00:00
:1700 lda #0
sta E
ldx #0
]lp lda BFE0,x
sta E$,x
inx
cmp #-1
bne ]lp
2023-12-29 09:09:50 +00:00
:1710 ldx E
lda E$,x
2024-01-04 18:19:54 +00:00
sec
2024-01-05 16:01:36 +00:00
sbc #'A'
2023-12-29 09:09:50 +00:00
pha ; LI
lda E$+1,x
2024-01-05 16:01:36 +00:00
cmp #'.'
beq :1740
2023-12-29 09:09:50 +00:00
sec
2024-01-05 16:01:36 +00:00
sbc #'0'
2023-12-29 09:09:50 +00:00
tay
lda tblD2H,y
sta N
lda E$+2,x
sec
2024-01-05 16:01:36 +00:00
sbc #'0'
2023-12-29 09:09:50 +00:00
clc
adc N
sta N
:1740 lda #0
sta BREAK
pla
2024-01-04 18:19:54 +00:00
cmp #190 ; 255-65 = 190 = la fin
beq :1760
2024-01-05 16:01:36 +00:00
:1745 asl
tax
2023-12-29 09:09:50 +00:00
lda tbl1800,x
sta :1750+1
lda tbl1800+1,x
sta :1750+2
:1750 jsr $bdbd
2024-01-04 18:19:54 +00:00
:1760 lda BREAK
2023-12-29 09:09:50 +00:00
beq :1780
asl
tax
lda tblBRKA,x
sta :1762+1
lda tblBRKA+1,x
sta :1762+2
:1762 jmp $bdbd
:1780 lda E
clc
adc #3
sta E
jmp :1710
*-------- The modified BREAK table
tblBRKA da $bdbd
da :100,:500,:530
*-----------------------------------
* 1800
*-----------------------------------
tbl1800 da :1800,:1900
da :2000,:2100,:2200,:2300,:2400,:2500,:2600,:2700,:2800,:2900
da :3000,:3100,:3200
*-------- A
:1800 lda #0
sta G
sta HH
sta H ; for comma
2024-01-04 18:19:54 +00:00
lda #2 ; 500
sta BREAK
2023-12-29 09:09:50 +00:00
:1810 inc G
lda G
tax
lda O,x
cmp #-1
beq :1840
lda G
cmp #nbO
bcc :1810
bcs :1870
:1840 lda HH
bne :1850
@print #strVOUSDETENEZ
:1850 inc HH
lda H
beq :1860
@print #strCOMMA
:1860 @print #strSPACE
lda G
asl
tax
ldy tblO$,x
lda tblO$+1,x
tax
jsr printCSTRING
inc H
lda G
cmp #nbO
bcc :1810
:1870 lda HH
beq :1880
@print #strPOINT
rts
:1880 @print #strVOUSRIEN
rts
*-------- B
2023-12-29 20:39:04 +00:00
:1900 ldx N
2023-12-29 09:09:50 +00:00
lda O,x
cmp #-1
bne :1960
@print #strVOUSLAVEZ
2024-01-04 18:19:54 +00:00
lda #2 ; 500
sta BREAK
2023-12-31 20:27:37 +00:00
rts
2023-12-29 09:09:50 +00:00
:1960 lda #-1
sta O,x
inc S
rts
*-------- C
:2000 ldx N
lda O,x
cmp #-1
beq :2030
@print #strNOTOWNED
lda #2
sta BREAK
rts
:2030 lda SALLE
sta O,x
dec S
rts
*-------- D
:2100 lda N
asl
tax
lda tbl4000,x
sta :2112+1
lda tbl4000+1,x
sta :2112+2
:2112 jmp $bdbd
*-------- E
:2200 ldx N
lda #1
sta P,x
rts
*-------- F
:2300 ldx N
lda #0
sta P,x
rts
*-------- G
2024-01-04 18:19:54 +00:00
:2400 ldy E ; +3
2023-12-29 09:09:50 +00:00
iny
iny
sty E
iny
2024-01-04 18:19:54 +00:00
lda E$,y
2023-12-29 09:09:50 +00:00
sec
2024-01-05 16:01:36 +00:00
sbc #'0'
2023-12-29 09:09:50 +00:00
tax
lda tblD2H,x
ldx N
sta C,x
iny
2024-01-04 18:19:54 +00:00
lda E$,y
2023-12-29 09:09:50 +00:00
sec
2024-01-05 16:01:36 +00:00
sbc #'0'
2023-12-29 09:09:50 +00:00
clc
adc C,x
sta C,x
rts
*-------- H
:2500 ldx N
lda #0
sta O,x
rts
*-------- I
:2600 lda N
sta SALLE
rts
*-------- J
2024-01-04 18:19:54 +00:00
:2700 @print #strDACCORD ; jump into K
2023-12-29 09:09:50 +00:00
*-------- K
:2800
2024-01-04 18:19:54 +00:00
lda #2 ; 500
2023-12-29 09:09:50 +00:00
sta BREAK
rts
*-------- L
2024-01-04 18:19:54 +00:00
:2900 lda #3 ; 530
2023-12-29 09:09:50 +00:00
sta BREAK
rts
*-------- M
2024-01-04 18:19:54 +00:00
:3000 lda #1 ; 100
2023-12-29 09:09:50 +00:00
sta BREAK
rts
*-------- N
2024-01-04 18:19:54 +00:00
:3100 jmp :perdu
2023-12-29 09:09:50 +00:00
*-------- O
:3200 ldx N
lda SALLE
sta O,x
rts
2024-01-04 18:19:54 +00:00
*-----------------------------------
* 3500 - LES VERIFICATIONS
*-----------------------------------
:3500 lda SALLE
cmp #11
bne :3502
ldx #1
lda #1
sta P,x
:3502 lda SALLE
cmp #19
bne :3504
ldx #1
lda #0
sta P,x
:3504 lda SALLE
cmp #36
bne :3510
ldx #2
lda P,x
cmp #1
beq :3510
:3506 ldx #$d
lda O,x
cmp #-1
bne :3508
@wait #100
jsr :4010
ldx #2
lda #1
sta P,x
jmp :3510
:3508 @wait #100
jmp :4020
:3510 ldx #4
lda O,x
cmp #-1
bne :3516
2024-01-05 16:01:36 +00:00
:3512 ldx #8
dec C,x
2024-01-04 18:19:54 +00:00
:3514 ldx #8
lda C,x
bne :3516
jmp :4740
:3516 ldx #1
lda C,x
beq :3534
2024-01-05 16:01:36 +00:00
:3518 dec C,x
:3520 lda C,x
2024-01-04 18:19:54 +00:00
cmp #1
bcs :3534
:3522 ldx #3
lda O,x
2024-01-05 16:01:36 +00:00
cmp #-1
2024-01-04 18:19:54 +00:00
bne :3524
jmp :4750
:3524 cmp #51
beq :3526
jmp :4760
:3526 lda SALLE
cmp #51
bne :3528
jmp :4750
:3528 ldx #4
lda O,x
cmp #51
beq :3530
ldx #$13
lda O,x
cmp #51
2024-01-05 16:01:36 +00:00
beq :3530
2024-01-04 18:19:54 +00:00
jmp :4780
:3530 lda SALLE
cmp #46
beq :3531
cmp #49
bne :3532
:3531 jmp :4770
:3532 ldx #$c
lda #0
sta P,x
jsr :4790
ldx #$10
lda #1
sta P,x
bne :3540
:3534 ldx #$e
lda P,x
beq :3537
2024-01-05 16:01:36 +00:00
:3535 ldx #2
2024-01-04 18:19:54 +00:00
dec C,x
lda C,x
cmp #1
bcs :3540
:3536 ldx #$e
lda #0
sta P,x
2024-01-05 16:01:36 +00:00
:3537 ldx #$c ; LOGO - It was a PEEK not a DEEK
2024-01-04 18:19:54 +00:00
lda P,x
2024-01-05 16:01:36 +00:00
cmp #0
bcs :3540
2024-01-04 18:19:54 +00:00
:3538 lda SALLE
cmp #50
beq :3540
jmp :4800
:3540 ldx #$10
lda P,x
beq :3544
:3542 ldx #5
dec C,x
lda C,x
cmp #1
bne :3544
jmp :4810
:3544 ldx #6
lda C,x
beq :3548
2024-01-05 16:01:36 +00:00
:3546
2024-01-04 18:19:54 +00:00
dec C,x
lda C,x
bne :3548
jsr :4830
ldx #8
lda #0
sta P,x
:3548 ldx #8
lda P,x
cmp #1
beq :3552
:3550 ldx #7
dec C,x
lda C,x
bne :3552
jsr :4580
jmp :perdu
:3552 ldx #4
lda C,x
beq :3556
2024-01-05 16:01:36 +00:00
:3554
2024-01-04 18:19:54 +00:00
dec C,x
lda C,x
cmp #1
bne :3556
jmp :4840
:3556 jmp :530
2023-12-29 09:09:50 +00:00
*-----------------------------------
* 4000 - LES REPONSES
*-----------------------------------
2023-12-29 20:39:04 +00:00
tbl4000 da $bdbd,:4010,:4020,:4030,:4040,:4050,:4060,:4070,:4080,:4090
2023-12-29 09:09:50 +00:00
da :4100,:4110,:4120,:4130,:4140,:4150,:4160,:4170,:4180,:4190
da :4200,:4210,:4220,:4230,:4240,:4250,:4260,:4270,:4280,:4290
da :4300,:4310,:4320,:4330,:4340,:4350,:4360,:4370,:4380,:4390
da :4400,:4410,:4420,:4430,:4440,:4450,:4460,:4470,:4480,:4490
da :4500,:4510,:4520,:4530,:4540,:4550,:4560,:4570,:4580,:4590
da :4600,:4610,:4620,:4630,:4640,:4650,:4660,:4670,:4680,:4690
2023-12-29 20:39:04 +00:00
da :4700,:4710,:4720,:4730,:4740,:4750,:4760,:4770,:4780,:4790
da :4800,:4810,:4820,:4830,:4840,:4850,:4860,:4870,:4880,:4890
da :4900,:4910,:4920
2023-12-29 09:09:50 +00:00
*--------
:4010 @print #str4010
rts
:4020 @print #str4020
2024-01-04 18:19:54 +00:00
jmp :perdu
2023-12-29 09:09:50 +00:00
:4030 @print #str4030
rts
:4040 @print #str4040
rts
:4050 @print #str4050
rts
:4060 @print #str4060
rts
:4070 @print #str4070
rts
:4080 @print #str4080
rts
:4090 @print #str4090
rts
:4100 @print #str4100
rts
:4110 @print #str4110
rts
:4120 @print #str4120
rts
:4130 @print #str4130
rts
:4140 @print #str4140
rts
:4150 @print #str4150
rts
:4160 @print #str4160
rts
:4170 @print #str4170
rts
:4180 @print #str4180
rts
:4190 @print #str4190
rts
:4200 @print #str4200
rts
:4210 @print #str4210
rts
:4220 @print #str4220
rts
2024-01-04 18:19:54 +00:00
:4230 @explode
2024-01-05 18:49:35 +00:00
@wait #100
@explode
2024-01-04 18:19:54 +00:00
@print #str4230
2023-12-29 09:09:50 +00:00
rts
:4240 @print #str4240
rts
:4250 @print #str4250
rts
2024-01-06 22:31:19 +00:00
:4260 jsr HGR
2024-01-05 16:01:36 +00:00
@draw #57
2024-01-04 18:19:54 +00:00
lda #44
sta SALLE
2023-12-29 09:09:50 +00:00
rts
:4270 @print #str4270
rts
:4280 @print #str4280
rts
:4290 @print #str4290
rts
:4300 @print #str4300
rts
:4310 @print #str4310
rts
:4320 @print #str4320
2023-12-29 20:39:04 +00:00
@print #str4321
2023-12-29 09:09:50 +00:00
rts
:4330 @print #str4330
rts
2024-01-04 18:19:54 +00:00
:4340 @explode
@print #str4340
2023-12-29 09:09:50 +00:00
rts
:4350 @print #str4350
rts
:4360 @print #str4360
rts
:4370 @print #str4370
rts
:4380 @print #str4380
rts
:4390 @print #str4390
rts
:4400 @print #str4400
rts
:4410 @print #str4410
rts
:4420 @print #str4420
rts
:4430 @print #str4430
rts
:4440 @print #str4440
rts
:4450 @print #str4450
rts
:4460 @print #str4460
rts
:4470 @print #str4470
rts
2024-01-05 21:47:54 +00:00
:4480 jsr :5500 ; QUITTER
2024-01-04 18:19:54 +00:00
cmp #chrNON
bne :4481
jmp :500
:4481 @print #str4480
2024-01-06 22:31:19 +00:00
jmp :perdu_bis
2023-12-29 09:09:50 +00:00
:4490 @print #str4490
2023-12-31 20:27:37 +00:00
@print #str4491
2023-12-29 09:09:50 +00:00
rts
:4500 @print #str4500
rts
:4510 @print #str4510
jmp :gagne
:4520 @print #str4520
rts
:4530 @print #str4530
rts
:4540 @print #str4540
rts
2024-01-06 22:31:19 +00:00
:4550 jsr HGR
2024-01-05 16:01:36 +00:00
@draw #56 ; LOGO
2024-01-04 18:19:54 +00:00
jsr :12020
lda #21
sta SALLE
2024-01-05 16:01:36 +00:00
@gotoxy #43;#21 ; Vous avez deux essais pour
2024-01-06 16:13:17 +00:00
@print #str4550 ; xy
2024-01-05 16:01:36 +00:00
@gotoxy #43;#29 ; entrer le mot de passe
2024-01-06 16:13:17 +00:00
@print #str4552 ; xy
2024-01-05 16:01:36 +00:00
@gotoxy #43;#37 ; entrer le mot de passe
2024-01-04 18:19:54 +00:00
jsr :4556_input ; saisie 1
bcc :4554 ; ok
2024-01-05 16:01:36 +00:00
@gotoxy #43;#45 ; entrer le mot de passe
2024-01-04 18:19:54 +00:00
@print #str4553 ; FAUX!
2024-01-05 16:01:36 +00:00
@gotoxy #43;#37 ; entrer le mot de passe
2024-01-04 18:19:54 +00:00
jsr :4556_input ; saisie 2
bcc :4554 ; ok
2024-01-05 16:01:36 +00:00
@gotoxy #43;#45 ; entrer le mot de passe
2024-01-04 18:19:54 +00:00
@print #str4554 ; encore faux
jmp :perdu ; ciao
2024-01-05 16:01:36 +00:00
:4554 @gotoxy #43;#56 ; 42
2024-01-06 16:13:17 +00:00
@print #str4558 ; xy
2024-01-05 16:01:36 +00:00
@gotoxy #43;#64 ; 56
2024-01-06 16:13:17 +00:00
@print #str4559_1 ; xy
2024-01-05 16:01:36 +00:00
@gotoxy #43;#72 ; 67
2024-01-06 16:13:17 +00:00
@print #str4559_2 ; xy
2024-01-05 16:01:36 +00:00
@gotoxy #43;#80
2024-01-06 16:13:17 +00:00
@print #str4559_3 ; xy
2024-01-05 16:01:36 +00:00
@gotoxy #43;#88
2024-01-06 16:13:17 +00:00
@print #str4559_4 ; xy
2024-01-04 18:19:54 +00:00
ldx #>MP$
ldy #<MP$
2024-01-06 16:13:17 +00:00
jsr printCSTRING ; COUTXY
2024-01-04 18:19:54 +00:00
rts
*--- saisie du mot de passe
:4556_input @print #str4556
jsr GETLN1 ; cha<68>ne de 6 caract<63>res, SVP
cpx #6
bcc :4556_ko
cpx #7
bcs :4556_ko
jsr rewriteSTRING
ldx #6-1
]lp lda TEXTBUFFER,x
cmp MDP$,x
bne :4556_ko
dex
bpl ]lp
clc ; c'est le bon mot de passe
2023-12-29 09:09:50 +00:00
rts
2024-01-04 18:19:54 +00:00
:4556_ko sec ; c'est le mauvais mot de passe
rts
MDP$ asc 'MANOIR'
*-----------
2023-12-29 09:09:50 +00:00
:4560 @print #str4560
rts
:4570 @print #str4570
rts
:4580 @print #str4580
rts
2024-01-04 18:19:54 +00:00
*----------- SAVE - LOGO
2024-01-06 22:31:19 +00:00
:4590 stz fgTIME
rep #$30
jsr doSAVE
sep #$30
inc fgTIME
rts
2024-01-04 18:19:54 +00:00
*----------- LOAD - LOGO
2024-01-06 22:31:19 +00:00
:4600 stz fgTIME
rep #$30
jsr doLOAD
sep #$30
inc fgTIME
2024-01-05 21:47:54 +00:00
jmp REPLAY
2024-01-04 18:19:54 +00:00
*----------- LE MOT DE PASSE FINAL
2023-12-29 09:09:50 +00:00
:4610 @print #str4610
2024-01-04 18:19:54 +00:00
jsr GETLN1
2024-01-05 16:01:36 +00:00
cpx #5
bcc :4615
cpx #6
bcs :4615
2024-01-04 18:19:54 +00:00
jsr rewriteSTRING
2024-01-05 16:01:36 +00:00
ldx #5-1
]lp lda TEXTBUFFER,x
cmp MP$,x
bne :4615
dex
bpl ]lp
jmp :gagne
:4615 @print #str4615
2024-01-05 18:49:35 +00:00
@zap
@wait #100
2024-01-04 18:19:54 +00:00
@print #str4616
2024-01-05 18:49:35 +00:00
@zap
@wait #300
2024-01-05 16:01:36 +00:00
@print #str4618_1
@wait #200
@print #str4618_2
jmp :perdu
2023-12-29 09:09:50 +00:00
2024-01-05 18:49:35 +00:00
:4620 @explode
@print #str4620
2023-12-29 09:09:50 +00:00
rts
:4630 @print #str4630
rts
:4640 @print #str4640
rts
:4650 @print #str4650
2024-01-04 18:19:54 +00:00
jmp :perdu
2023-12-29 09:09:50 +00:00
2023-12-29 20:39:04 +00:00
:4660 @print #str4660
rts
2023-12-29 09:09:50 +00:00
2023-12-29 20:39:04 +00:00
:4670 @print #str4670
2023-12-29 09:09:50 +00:00
rts
2023-12-29 20:39:04 +00:00
:4680 @print #str4680
rts
2023-12-29 09:09:50 +00:00
2023-12-29 20:39:04 +00:00
:4690 @print #str4690
@print #str4692
rts
:4700 @print #str4700
rts
2023-12-31 20:27:37 +00:00
:4710 lda SALLE
pha
2024-01-06 22:31:19 +00:00
jsr HGR
2023-12-31 20:27:37 +00:00
@draw #54
pla
sta SALLE
2023-12-29 20:39:04 +00:00
rts
2023-12-31 20:27:37 +00:00
:4720 lda SALLE
pha
2024-01-06 22:31:19 +00:00
jsr HGR
2023-12-31 20:27:37 +00:00
@draw #55
pla
sta SALLE
2023-12-29 20:39:04 +00:00
rts
:4730 @print #str4730
rts
2024-01-04 18:19:54 +00:00
:4740 @explode
2024-01-05 18:49:35 +00:00
@wait #100
@explode
2024-01-04 18:19:54 +00:00
@print #str4740
jmp :perdu
2023-12-29 20:39:04 +00:00
2024-01-04 18:19:54 +00:00
:4750 @explode
2024-01-05 18:49:35 +00:00
@wait #100
2024-01-04 18:19:54 +00:00
@print #str4750
jmp :perdu
:4760 @explode
2024-01-05 18:49:35 +00:00
@wait #100
2024-01-04 18:19:54 +00:00
@print #str4760
jmp :perdu
2023-12-29 20:39:04 +00:00
2024-01-04 18:19:54 +00:00
:4770 @explode
@print #str4770
jmp :perdu
2023-12-29 20:39:04 +00:00
2024-01-04 18:19:54 +00:00
:4780 @explode
@print #str4780
jmp :perdu
2023-12-29 20:39:04 +00:00
2024-01-04 18:19:54 +00:00
:4790 @explode
@print #str4790
2023-12-29 20:39:04 +00:00
rts
2024-01-04 18:19:54 +00:00
:4800 @explode
@print #str4800
jmp :perdu
2023-12-29 20:39:04 +00:00
2024-01-04 18:19:54 +00:00
:4810 @explode
@print #str4810
jmp :perdu
2023-12-29 20:39:04 +00:00
2024-01-04 18:19:54 +00:00
:4820 @explode
@print #str4820
jmp :perdu
2023-12-29 20:39:04 +00:00
:4830 @print #str4830
rts
2024-01-04 18:19:54 +00:00
:4840 @explode
@print #str4840
jmp :perdu
2023-12-29 20:39:04 +00:00
:4850 @print #str4850
rts
:4860 @print #str4860
rts
2024-01-04 18:19:54 +00:00
:4870 lda S
bne :4872
@print #str4870
rts
:4872 ldx #$d
lda O,x
cmp #-1
bne :4873
lda #0
sta O,x
ldx #$c
lda #-1
sta O,x
:4873 ldx #1
]lp lda O,x
cmp #-1
bne :4874
lda SALLE
sta O,x
:4874 inx
cpx #$13
bcc ]lp
beq ]lp
lda #0
sta S
2023-12-29 20:39:04 +00:00
@print #str4874
rts
:4880 @print #str4880
rts
:4890 @print #str4890
@print #str4891
rts
:4900 @print #str4900
rts
:4910 @print #str4910
rts
:4920 @print #str4920
2024-01-04 18:19:54 +00:00
@wait #200
2023-12-29 20:39:04 +00:00
rts
2023-12-29 09:09:50 +00:00
2024-01-04 18:19:54 +00:00
*-----------
2024-01-06 22:31:19 +00:00
:5500 stz fgTIME
@print #str5500
2024-01-04 18:19:54 +00:00
jsr GETLN1
cpx #1
bne :5500
2024-01-05 18:49:35 +00:00
jsr rewriteSTRING
2024-01-04 18:19:54 +00:00
lda TEXTBUFFER
cmp #chrOUI
beq :5510
cmp #chrNON
bne :5500
2024-01-06 22:31:19 +00:00
:5510 inc fgTIME
rts
2024-01-04 18:19:54 +00:00
2023-12-29 09:09:50 +00:00
*-----------------------------------
* 6000 - ANALYSE DU MOT
*-----------------------------------
:6000 lda #0
sta N
sta X$1
sta X$2
sta MO$1
sta MO$2
* 1. cherche le premier caract<EFBFBD>re
ldx #0 ; cherche le premier caractere
]lp lda TEXTBUFFER,x
* cmp #chrRET
* beq :6021
cmp #chrSPC
bne :6022 ; on a trouv<75> un caract<63>re
inx
cpx lenSTRING
* bcs :6021
* cpx #nbCAR
bcc ]lp
:6021 rts ; retourne sans avoir trouve
* 2. recopie le mot
* 0123456789A
* 123456789
* PREN COMBI\
:6022 ldy #1
]lp lda TEXTBUFFER,x
cmp #chrRET
beq :6023
cmp #chrSPC
beq :6023
sta X$1,y ; 0P1R2E3N4
inx
cpx lenSTRING
bcs :6023
iny
cpy #4
bcc ]lp
beq ]lp
dey
:6023 sty X$1 ; sauve la longueur
* 3. cherche un espace
* inx
]lp lda TEXTBUFFER,x
* cmp #chrRET
* beq :6032
cmp #chrSPC
beq :6032
inx ; 5
cpx lenSTRING
* bcs :6100
* cpx #nbCAR
bcc ]lp
bcs :6100
* 4. recopie le mot
:6032 inx
ldy #1
]lp lda TEXTBUFFER,x
cmp #chrRET
beq :6033
cmp #chrSPC
beq :6033
sta X$2,y
inx
cpx lenSTRING
bcs :6033
iny
cpy #4
bcc ]lp
beq ]lp
dey
:6033 sty X$2 ; sauve la longueur
* 5. cherche le mot dans les options
* X$1 4 PREN
* X$2 4 LAMP
* V$x 6 04PREN
* 0 123456
:6100 lda X$1
bne :6110
rts
:6110 ldy #1
]lp lda tblVL$,y
sta :6225+1
lda tblVH$,y
sta :6225+2
ldx #0
:6225 lda $bdbd,x
cmp X$1,x
bne :6250
inx
cpx X$1
bcc :6225
beq :6225
lda tblV,y
sta MO$1
bne :6300
:6250 iny
cpy #V
bcc ]lp
beq ]lp
* 6. on change de mot
:6300 lda X$2
bne :6310
rts
:6310 ldy #1
]lp lda tblVL$,y
sta :6325+1
lda tblVH$,y
sta :6325+2
ldx #0
:6325 lda $bdbd,x
cmp X$2,x
bne :6350
inx
cpx X$2
bcc :6325
beq :6325
lda tblV,y
sta MO$2
bne :6400
:6350 iny
cpy #V
bcc ]lp
beq ]lp
:6400 rts
*-----------------------------------
* 8000 - CHARGEMENT VARIABLES
*-----------------------------------
2024-01-06 22:31:19 +00:00
initALL ldx #FIN_DATA-DEBUT_DATA
2023-12-29 09:09:50 +00:00
lda #0
]lp sta A1-1,x
dex
bne ]lp
2024-01-03 18:08:53 +00:00
*--- ligne 51
ldx #8
lda #10
sta C,x
ldx #5
lda #18
sta C,x
ldx #3
lda #10
sta C,x
ldx #6
lda #22
sta C,x
ldx #7
lda #9
sta C,x
*--- ligne 70
ldx #3
lda #1
]lp sta P,x
inx
cpx #8
bcc ]lp
beq ]lp
ldx #$c
sta P,x
2024-01-05 16:01:36 +00:00
*--- Le mot de passe
]lp jsr RND
and #%0000_0111 ; 7
cmp #%0000_0101 ; 5
bcs ]lp
asl
tax
lda tblMP$,x
sta LINNUM
lda tblMP$+1,x
sta LINNUM+1
ldy #5-1
]lp lda (LINNUM),y
sta MP$,y
dey
bpl ]lp
2023-12-29 09:09:50 +00:00
*---
ldx #nbO ; reset object table
]lp lda refO,x
sta O,x
dex
bpl ]lp
2024-01-06 22:31:19 +00:00
*---
lda #11
sta SALLE
lda #<4000
sta FORCE
lda #>4000
sta FORCE+1
lda #$20
sta MINUTES
lda #$00
sta SECONDES
lda #1 ; le temps d<>marre !
sta fgTIME
2023-12-29 09:09:50 +00:00
rts
2024-01-03 18:08:53 +00:00
*-----------------------------------
* LES TRACES DE CADRE
*-----------------------------------
:12000 rts
:12010 rts
:12020 rts
2024-01-04 18:19:54 +00:00
*-----------------------------------
* 30000 - LES MOTS DE PASSE
*-----------------------------------
:30000 rts
2024-01-06 22:31:19 +00:00
rep #$30
PushWord #12
PushWord #190
_MoveTo
PushLong #MP$
_DrawCString
sep #$30
rts
2023-12-29 09:09:50 +00:00
*-----------------------------------
* 20000 - PERDU
*-----------------------------------
2024-01-06 22:31:19 +00:00
:perdu stz fgTIME
@wait #200
2024-01-05 18:49:35 +00:00
@explode
2023-12-29 09:09:50 +00:00
jsr setTEXTFULL
@print #strPERDU
2024-01-06 22:31:19 +00:00
bra :20050
2023-12-29 09:09:50 +00:00
2024-01-06 22:31:19 +00:00
:perdu_bis @wait #200
@explode
:20050 @print #strREPLAY ; commun avec gagne
2023-12-29 09:09:50 +00:00
jsr translateKEY
cmp #chrNON
beq :20001
cmp #chrOUI
2024-01-06 22:31:19 +00:00
bne :20050
2023-12-31 20:27:37 +00:00
jmp PLAY
2023-12-29 09:09:50 +00:00
2023-12-31 20:27:37 +00:00
:20001 jmp QUIT ; return to the IIgs
2023-12-29 09:09:50 +00:00
*-----------------------------------
* 32000 - GAGNE
*-----------------------------------
2024-01-06 22:31:19 +00:00
:gagne stz fgTIME
@wait #200
@explode
2023-12-29 09:09:50 +00:00
jsr setTEXTFULL
@print #strGAGNE
jmp :20050
*-----------------------------------
* CODE 6502
*-----------------------------------
*----------------------
* setTEXTFULL
*----------------------
2024-01-06 22:31:19 +00:00
mx %11
setTEXTFULL jsr HGR
rep #$30
stz textX
lda #row0
sta textY
sep #$30
rts ; 40x24 text
2023-12-29 09:09:50 +00:00
*----------------------
2024-01-06 22:31:19 +00:00
* LE TEMPS EST ECOULE
2023-12-29 09:09:50 +00:00
*----------------------
2024-01-06 22:31:19 +00:00
nomoreTIME jmp :4650
2023-12-29 09:09:50 +00:00
*----------------------
* GETLEN1 par LoGo
*----------------------
2024-01-02 14:32:27 +00:00
mx %11
2023-12-29 09:09:50 +00:00
GETLN1 ldx #0
2024-01-06 22:31:19 +00:00
GETLN2 stx lenSTRING
2023-12-29 09:09:50 +00:00
]lp jsr RDKEY
2024-01-06 22:31:19 +00:00
bcs nomoreTIME
ldx lenSTRING
2023-12-29 09:09:50 +00:00
cmp #chrRET
beq doRET
cmp #chrDEL
beq doBACK
cmp #chrLA
beq doBACK
2024-01-02 14:32:27 +00:00
cmp #chrSPC ; must not be another control character
bcc ]lp
2024-01-06 22:31:19 +00:00
beq doSPC
2023-12-29 09:09:50 +00:00
2024-01-06 22:31:19 +00:00
doIT sta TEXTBUFFER,x
2023-12-29 09:09:50 +00:00
jsr COUT
2024-01-06 22:31:19 +00:00
doNEXT ldx lenSTRING
inx
2023-12-29 09:09:50 +00:00
cpx #maxLEN
2024-01-06 22:31:19 +00:00
bcc GETLN2
2023-12-29 09:09:50 +00:00
doEXIT lda #chrRET
sta TEXTBUFFER,x
stx lenSTRING
2024-01-06 22:31:19 +00:00
jsr CURSOR_ERASE
lda #chrRET
jsr COUT
ldx lenSTRING
rts
doSPC jsr WHITE_SPACE
ldx lenSTRING
lda #chrSPC
bra doIT
2023-12-29 09:09:50 +00:00
doBACK cpx #0
beq ]lp
2024-01-06 22:31:19 +00:00
jsr CURSOR_ERASE
ldx lenSTRING
2023-12-29 09:09:50 +00:00
dex
2024-01-06 22:31:19 +00:00
jmp GETLN2
2023-12-29 09:09:50 +00:00
doRET cpx #0
bne doEXIT
jsr switchVIDEO
jmp ]lp
*----------------------
2024-01-06 22:31:19 +00:00
* MUSIQUE
2023-12-29 09:09:50 +00:00
*----------------------
2024-01-06 22:31:19 +00:00
switchMUSIC
2023-12-29 09:09:50 +00:00
lda #0
eor #1
2024-01-06 22:31:19 +00:00
sta switchMUSIC+1
bne smoff
rep #$30
jsr doSOUNDON
sep #$30
2023-12-29 09:09:50 +00:00
rts
2024-01-06 22:31:19 +00:00
smoff rep #$30
jsr doSOUNDOFF
sep #$30
rts
2023-12-29 09:09:50 +00:00
*----------------------
2024-01-06 22:31:19 +00:00
* ENERGIE
2023-12-29 09:09:50 +00:00
*----------------------
2024-01-06 22:31:19 +00:00
mx %11
switchENERGIE
lda #0
2023-12-29 09:09:50 +00:00
eor #1
2024-01-06 22:31:19 +00:00
sta switchENERGIE+1
rts
testENERGIE sep #$30
lda switchENERGIE+1 ; switch is off
bne te_ok
lda fgTIME
beq te_ok
lda fgPERDU
bne te_ok
2023-12-29 09:09:50 +00:00
2024-01-06 22:31:19 +00:00
lda MINUTES ; reste-t-il des minutes
ora SECONDES ; ou des secondes ?
bne te_ok
lda #1
sta fgPERDU
rep #$30
sec ; non, on a perdu
rts
2023-12-29 09:09:50 +00:00
2024-01-06 22:31:19 +00:00
te_ok rep #$30
clc
rts
2023-12-29 09:09:50 +00:00
2024-01-06 22:31:19 +00:00
mx %11
2023-12-29 09:09:50 +00:00
*----------------------
2024-01-06 22:31:19 +00:00
* switchVIDEO
2023-12-29 09:09:50 +00:00
*----------------------
2024-01-06 22:31:19 +00:00
mx %00
switchVIDEO rep #$30
2024-01-01 18:41:02 +00:00
lda ptrSCREEN
sta dpTO
lda ptrSCREEN+2
sta dpTO+2
lda ptrTEXT
sta dpTHREE
lda ptrTEXT+2
sta dpTHREE+2
2024-01-06 11:08:05 +00:00
ldy #160*160-2
2024-01-01 18:41:02 +00:00
]lp lda [dpTHREE],y
2024-01-06 11:08:05 +00:00
tax
2024-01-01 18:41:02 +00:00
lda [dpTO],y
sta [dpTHREE],y
2024-01-06 11:08:05 +00:00
txa
2024-01-01 18:41:02 +00:00
sta [dpTO],y
dey
dey
bpl ]lp
sep #$30
2023-12-29 09:09:50 +00:00
rts
*----------------------
* printCSTR
*----------------------
2024-01-06 22:31:19 +00:00
mx %11
2023-12-29 09:09:50 +00:00
printCSTRING
sty pcs1+1
stx pcs1+2
pcs1 lda $ffff
beq pcs3
pcs2 jsr COUT
inc pcs1+1
bne pcs1
inc pcs1+2
bne pcs1
pcs3 rts
*----------------------
* waitMS
*----------------------
2024-01-06 22:31:19 +00:00
mx %11
2023-12-31 20:27:37 +00:00
switchWAIT lda waitMS+1
2023-12-29 09:09:50 +00:00
eor #1
sta waitMS+1
rts
waitMS lda #0 ; skip if not zero
bne waitMS9
sty LINNUM
doW1 ldy LINNUM
2024-01-05 16:01:36 +00:00
doW2 ldal RDVBLBAR
bpl doW2
*doW3 ldal RDVBLBAR
* bmi doW3
2023-12-29 09:09:50 +00:00
dey
2023-12-31 20:27:37 +00:00
bne doW2
2023-12-29 09:09:50 +00:00
dex
bpl doW1
waitMS9 rts
*-----------------------------------
* rewriteSTRING (lower -> upper)
*-----------------------------------
2024-01-06 22:31:19 +00:00
mx %11
2023-12-29 09:09:50 +00:00
rewriteSTRING
ldx #0
]lp ldy TEXTBUFFER,x
lda tblKEY,y
sta TEXTBUFFER,x
inx
cpx lenSTRING
bcc ]lp
rts
*-----------------------------------
* translateKEY (lower -> upper)
*-----------------------------------
2024-01-06 22:31:19 +00:00
mx %11
2023-12-29 09:09:50 +00:00
translateKEY
jsr RDKEY
2024-01-06 22:31:19 +00:00
pha
jsr COUT
plx
2023-12-29 09:09:50 +00:00
lda tblKEY,x
rts
2024-01-01 18:41:02 +00:00
tblKEY hex 00,01,02,03,04,05,06,07,08,09,0A,0B,0C,0D,0E,0F
2023-12-29 09:09:50 +00:00
hex 10,11,12,13,14,15,16,17,18,19,1A,1B,1C,1D,1E,1F
hex 20,21,22,23,24,25,26,27,28,29,2A,2B,2C,2D,2E,2F
hex 30,31,32,33,34,35,36,37,38,39,3A,3B,3C,3D,3E,3F
hex 40,41,42,43,44,45,46,47,48,49,4A,4B,4C,4D,4E,4F
hex 50,51,52,53,54,55,56,57,58,59,5A,5B,5C,5D,5E,5F
2024-01-04 18:19:54 +00:00
hex 60,41,42,43,44,45,46,47,48,49,4A,4B,4C,4D,4E,4F
hex 50,51,52,53,54,55,56,57,58,59,5A,7B,7C,7D,7E,7F
2023-12-29 09:09:50 +00:00
hex 80,81,82,83,84,85,86,87,88,89,8A,8B,8C,8D,8E,8F
hex 90,91,92,93,94,95,96,97,98,99,9A,9B,9C,9D,9E,9F
hex A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF
hex B0,B1,B2,B3,B4,B5,B6,B7,B8,B9,BA,BB,BC,BD,BE,BF
hex C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,CA,CB,CC,CD,CE,CF
hex D0,D1,D2,D3,D4,D5,D6,D7,D8,D9,DA,DB,DC,DD,DE,DF
hex E0,C1,C2,C3,C4,C5,C6,C7,C8,C9,CA,CB,CC,CD,CE,CF
hex D0,D1,D2,D3,D4,D5,D6,D7,D8,D9,DA,FB,FC,FD,FE,FF
2024-01-01 18:41:02 +00:00
TEXTBUFFER ds maxLEN+16 ; le simulacre de la page 2
2023-12-29 09:09:50 +00:00
*-----------------------------------
* VARIABLES
*-----------------------------------
DEBUT_DATA
2024-01-01 18:41:02 +00:00
A1 ds 1
2024-01-03 18:08:53 +00:00
A2 ds 1 ; $400
2024-01-01 18:41:02 +00:00
BREAK ds 1
E ds 1
2024-01-04 18:19:54 +00:00
FORCE ds 2 ; 400 unit<69>s en entr<74>e
2024-01-01 18:41:02 +00:00
G ds 1
H ds 1
HH ds 1
MO$1 ds 1 ; mot 1
MO$2 ds 1 ; mot 2
N ds 1
NL ds 1
OK ds 1
2024-01-03 18:08:53 +00:00
PP ds 1
2024-01-01 18:41:02 +00:00
S ds 1
SALLE ds 1
T ds 1
lenSTRING ds 1
2024-01-03 18:08:53 +00:00
2024-01-06 22:31:19 +00:00
fgTIME ds 2 ; 0: off, 1: on
fgPERDU ds 2 ; 1: perdu
MINUTES ds 1 ; 0..20 en d<>cimal
SECONDES ds 1 ; 0..59
2023-12-29 09:09:50 +00:00
2024-01-05 21:47:54 +00:00
MP$ ds 6 ; le mot de passe <20> trouver (5 + 00)
2024-01-06 22:31:19 +00:00
O dfb $bd
dfb 40,33,41,53,43,10,00,21,22,26
dfb 01,06,00,17,20,00,47,19,00
2024-01-04 18:19:54 +00:00
C ds 32+1
2023-12-29 09:09:50 +00:00
E$ ds 32 ; the longest string
2024-01-04 18:19:54 +00:00
P ds 32+1
2023-12-31 20:27:37 +00:00
X$1 ds 1+4 ; premier mot saisi
2024-01-01 18:41:02 +00:00
X$2 ds 1+4 ; deuxi<78>me mot saisi
2023-12-29 09:09:50 +00:00
FIN_DATA
*--- The lazy decimal to hexadecimal conversion
tblD2H dfb 0,10,20,30,40,50,60,70,80,90