1222 lines
19 KiB
ArmAsm
Raw Normal View History

2023-08-28 18:01:04 +02:00
*
* La Belle Zohra
*
* (c) 1992, François Coulon
* (c) 2023, Antoine Vignau & Olivier Zardini
*
mx %00
*----------------------------------- Macros
use 4/Ctl.Macs
use 4/Desk.Macs
use 4/Event.Macs
use 4/Font.Macs
use 4/Int.Macs
use 4/Line.Macs
use 4/Locator.Macs
use 4/Mem.Macs
use 4/Menu.Macs
2024-02-03 19:51:11 +01:00
use 4/MIDISyn.Macs
2023-08-28 18:01:04 +02:00
use 4/Misc.Macs
use 4/Print.Macs
use 4/Qd.Macs
use 4/QdAux.Macs
use 4/Resource.Macs
use 4/Scrap.Macs
use 4/Sound.Macs
use 4/Std.Macs
use 4/TextEdit.Macs
use 4/Util.Macs
use 4/Window.Macs
2023-08-30 09:02:33 +02:00
*-----------------------
* macros
*-----------------------
@loadfile mac
lda ]1
ldx ]2+2
ldy ]2
jsr loadFILE
eom
2023-08-28 18:01:04 +02:00
*----------------------------------- Constantes
*-------------- Softswitches
KBD = $e0c000
KBDSTROBE = $e0c010
RDVBLBAR = $e0c019
GSOS = $e100a8
*-------------- GUI
2024-02-03 19:51:11 +01:00
wMAIN = 1
2023-08-28 18:01:04 +02:00
alertQUIT = $0100
alertRESTART = $0200
refIsPointer = 0
refIsHandle = 1
refIsResource = 2
appleKey = $0100
mouseDownEvt = $0001
mouseUpEvt = $0002
keyDownEvt = $0003
2024-02-03 22:58:16 +01:00
chrRET = $0d
chrESC = $1b
2023-08-28 18:01:04 +02:00
*--------------
dpFROM = $80
dpTO = dpFROM+4
2024-02-03 22:58:16 +01:00
dpTEXTES = dpTO+4 ; pointeur vers les TEXTES
Debut = dpTEXTES+4
2023-08-28 18:01:04 +02:00
Arrivee = Debut+4
Second = Arrivee+4
*---
2024-02-05 15:24:14 +01:00
modeCopy = $0000
modeForeCopy = $0004 ; QDII Table 16-10
2023-08-28 18:01:04 +02:00
mode_320 = $00
mode_640 = $80
screen_320 = 320
screen_640 = 640
ptr012000 = $012000
ptrE12000 = $e12000
*---
2024-02-03 19:51:11 +01:00
TRUE = 255
2023-08-28 18:01:04 +02:00
FALSE = 0
fgLOAD = 1 ; flags for choix_aventure
fgRESTART = 2
*----------------------------------- Entry point
phk
plb
clc
xce
rep #$30
_TLStartUp
pha
_MMStartUp
pla
sta mainID
ora #$0100
sta myID
tdc
sta myDP
2023-08-30 09:02:33 +02:00
2023-08-28 18:01:04 +02:00
*--- Version du systeme
jsl GSOS
dw $202a
adrl proVERS
lda proVERS+2
and #%01111111_11111111
cmp #$0402
bcs okVERS
pha
PushLong #verSTR1
PushLong #verSTR2
PushLong #errSTR1
PushLong #errSTR2
_TLTextMountVolume
pla
brl meQUIT1
2023-09-03 22:10:44 +02:00
*--- Compacte la mémoire
okVERS PushLong #0
PushLong #$8fffff
PushWord myID
PushWord #%11000000_00000000
PushLong #0
_NewHandle
_DisposeHandle
_CompactMem
2023-08-28 18:01:04 +02:00
*--- 64K pour les images des scènes
2023-09-03 22:10:44 +02:00
jsr make64KB
2023-08-28 18:01:04 +02:00
bcc okMEM1
koMEM pha
PushLong #memSTR1
PushLong #errSTR2
PushLong #errSTR1
PushLong #errSTR2
_TLTextMountVolume
pla
brl meQUIT1
okMEM1 sty ptrIMAGE
stx ptrIMAGE+2
2024-02-03 19:51:11 +01:00
stx ptrBACKGND+2
2023-08-28 18:01:04 +02:00
2023-08-30 09:02:33 +02:00
*--- 64K pour les images du jeu
2023-08-28 18:01:04 +02:00
jsr make64KB
bcs koMEM
sty ptrFOND
stx ptrFOND+2
stx ptrICONES+2
2023-08-30 09:02:33 +02:00
stx fondToSourceLocInfo+4 ; fond
stx iconToSourceLocInfo+4 ; icon
2023-08-28 18:01:04 +02:00
*--- 64K pour les images compressees
jsr make64KB
bcs koMEM
sty ptrUNPACK
stx ptrUNPACK+2
2024-02-05 15:24:14 +01:00
stx ptrCONTENT+2 ; le fond de la fenêtre
2024-02-05 20:21:30 +01:00
stx contentToSourceLocInfo+4
2024-02-05 15:24:14 +01:00
2023-08-28 18:01:04 +02:00
*--- Chargement des outils
pha
pha
PushWord mainID
PushWord #refIsResource
PushLong #1
_StartUpTools
PullLong SStopREC
bcc okTOOL
pha
PushLong #tolSTR1
PushLong #errSTR2
PushLong #errSTR1
PushLong #errSTR2
_TLTextMountVolume
pla
brl meQUIT0
2024-02-04 21:08:00 +01:00
*--- Test default shadowing...
2024-02-03 19:51:11 +01:00
okTOOL PushWord #0
_GetMasterSCB
pla
bmi okSHADOW ; shadowing is on if bit 15 is set
lda #^ptrE12000 ; shadowing is off, use slow RAM
sta ptrSCREEN+2
2023-08-28 18:01:04 +02:00
*--- Et la musique...
2024-02-03 19:51:11 +01:00
okSHADOW pha
2023-09-03 22:10:44 +02:00
_SoundToolStatus
pla
bne noSOUND
lda #1
sta fgSND
noSOUND _HideMenuBar
2024-02-05 20:21:30 +01:00
_InitCursor
_HideCursor
2023-08-28 18:01:04 +02:00
PushWord #0
PushWord #%11111111_11111111
PushWord #0
_FlushEvents
pla
2024-02-06 20:49:01 +01:00
PushLong #0
PushWord #5 ; SetDeskPat
PushWord #$4000
PushWord #$0000
_Desktop
pla
pla
2023-08-28 18:01:04 +02:00
*----------------------------------------
* INITIALISATIONS
*----------------------------------------
2023-08-30 16:42:20 +02:00
entryPOINT
2023-08-28 18:01:04 +02:00
jsr set_language
2024-02-05 23:40:05 +01:00
jsr antoine ; le menu principal
2023-08-28 18:01:04 +02:00
jsr init
2024-02-05 23:40:05 +01:00
2024-02-06 20:49:01 +01:00
jsr initMIDI
jsr doSOUNDON
2024-02-05 23:40:05 +01:00
restartPOINT
2023-08-28 18:01:04 +02:00
jsr init2
2023-08-30 16:42:20 +02:00
2023-08-28 18:01:04 +02:00
*-----------------------
* MAIN
*-----------------------
2024-02-05 20:21:30 +01:00
mainLOOP PushLong ptrFOND
PushLong ptrCONTENT
PushLong #32768
_BlockMove
2024-02-04 21:08:00 +01:00
jsr test_objets
2024-02-05 23:40:05 +01:00
jsr test_fin
2024-02-05 20:21:30 +01:00
refreshLOOP
jsr refreshME
2023-08-28 18:01:04 +02:00
*----------------------------------------
2024-02-03 22:58:16 +01:00
* TASK MASTER
2023-08-28 18:01:04 +02:00
*----------------------------------------
2024-02-06 20:49:01 +01:00
taskLOOP PushWord #0
2024-02-03 19:51:11 +01:00
PushWord #0
PushWord #$c000
PushWord #0
2023-08-28 18:01:04 +02:00
_HandleDiskInsert
pla
pla
2024-02-06 20:49:01 +01:00
jsr checkREPLAY
2024-02-03 19:51:11 +01:00
PushWord #0
PushWord #%11111111_11111111
PushLong #taskREC
_TaskMaster
2023-08-28 18:01:04 +02:00
pla
beq taskLOOP
2024-02-05 23:40:05 +01:00
2023-08-28 18:01:04 +02:00
asl
tax
jsr (taskTBL,x)
2024-02-05 23:40:05 +01:00
cmp #$bcbc ; on recommence
beq restartPOINT
2024-02-05 20:21:30 +01:00
cmp #$bdbd ; on a fini de consulter un texte
beq mainLOOP
cmp #$bebe ; on voudrait consulter un texte
beq refreshLOOP
2024-02-05 23:40:05 +01:00
bra taskLOOP ; sinon, on boucle standard
2023-08-28 18:01:04 +02:00
*----------------------------------- Gestion du keyDown
* on gère les open-apple-qqch
doKEYDOWN lda taskMODIFIERS
and #appleKey
cmp #appleKey
beq doOPENAPPLE
rts
*--- gère les open-apple-qqch
doOPENAPPLE
ldx #-1
]lp inx
lda tblKEYVALUE,x ; get key
2024-02-06 20:49:01 +01:00
and #$ff
2023-08-28 18:01:04 +02:00
cmp #$ff ; end of table
beq doOPENAPPLE99 ; so exit
cmp taskMESSAGE ; same as pressed key?
bne ]lp ; no, loop
txa
asl
tax
jmp (tblKEYADDRESS,x)
doOPENAPPLE99
2024-02-06 20:49:01 +01:00
doNOT rts
2023-08-28 18:01:04 +02:00
2024-02-05 15:24:14 +01:00
mx %00
2023-08-28 18:01:04 +02:00
*---
tblKEYVALUE
asc 'QqOoSs'
asc 'Rr'
asc 'Zz'
asc '*'
hex ff
2024-02-05 23:40:05 +01:00
2023-08-28 18:01:04 +02:00
tblKEYADDRESS
da doQUIT,doQUIT,doLOAD,doLOAD,doSAVE,doSAVE
da doRESTART,doRESTART
da doMUSIK,doMUSIK
da monitor
*----------------------------------- Gestion du mouseUp
* on compare les coordonnées avec celles du incontent
* si dans le même rectangle, on traite
2024-02-05 23:40:05 +01:00
doMOUSEUP lda textes_encore_presents ; on a fini le jeu
bne domu_0
lda #$bcbc
rts
domu_0 lda objet_selectionne ; on a déjà un objet, saute
2024-02-04 21:08:00 +01:00
bne domu_2
2023-08-28 18:01:04 +02:00
2024-02-04 21:08:00 +01:00
* 1. vérifie si on a cliqué dans un objet
2024-02-05 20:21:30 +01:00
jsr test_objet ; on teste si on a cliqué sur un objet
2024-02-04 21:08:00 +01:00
bcc domu_1 ; on a clique dans un objet
2024-02-05 20:21:30 +01:00
lda #0
rts
2024-02-05 23:40:05 +01:00
domu_1 jsr test_peches ; on a clique dans un objet, affiche les peches correspondants
2024-02-05 20:21:30 +01:00
lda #$bebe ; il faudra rafraîchir l'écran
2023-08-30 09:02:33 +02:00
rts
2024-02-04 21:08:00 +01:00
* 2. on a déjà un objet, a-t-on cliqué dans un péché ?
domu_2 lda peche_selectionne ; on a aussi déjà un péché, saute
bne domu_4
2024-02-05 20:21:30 +01:00
jsr test_peche ; on teste si on a cliqué sur un péché
bcc domu_3 ; on a cliqué dans un péché
lda #0
2024-02-04 21:08:00 +01:00
rts
2024-02-05 20:21:30 +01:00
domu_3 jsr aiguillage ; choisit le texte correspondant
lda #$bebe ; il faudra rafraîchir l'écran
2024-02-04 21:08:00 +01:00
domu_4 rts
2024-02-03 19:51:11 +01:00
2024-02-05 15:24:14 +01:00
*----------------------------------- Clic dans le contenu de la fenêtre
2024-02-05 23:40:05 +01:00
doCONTENT lda textes_encore_presents
2024-02-05 15:24:14 +01:00
bne doco_1
2024-02-05 23:40:05 +01:00
jsr doco_3 ; detruit le controle
lda #$bcbc ; et force l'init
rts
doco_1 lda texte_selectionne
bne doco_2
2024-02-05 15:24:14 +01:00
rts
2024-02-05 23:40:05 +01:00
doco_2 jsr retour ; on marque le texte comme lu
2024-02-05 20:21:30 +01:00
stz peche_selectionne
stz objet_selectionne
stz texte_selectionne
2024-02-05 15:24:14 +01:00
2024-02-05 23:40:05 +01:00
doco_3 PushLong haCONTROL ; on enlève le contrôle
2024-02-05 15:24:14 +01:00
_DisposeControl
2024-02-05 20:21:30 +01:00
stz haCONTROL
stz haCONTROL+2
stz taskWHERE
stz taskWHERE+2
lda #$bdbd ; il faut rafraîchir les objets !
rts ; et on revient
2024-02-05 15:24:14 +01:00
2024-02-05 20:21:30 +01:00
*----------------------------------------
* RAFRAICHIT LES PALETTES ET LA FENETRE
*----------------------------------------
2024-02-07 19:25:57 +01:00
refreshME pea $0000 ; la palette
2024-02-05 20:21:30 +01:00
lda ptrCONTENT+2
pha
lda ptrCONTENT
clc
2024-02-07 19:25:57 +01:00
adc #32256 ; after data + SCBs
2024-02-05 20:21:30 +01:00
pha
_SetColorTable
PushLong #0
_RefreshDesktop
rts
2024-02-03 19:51:11 +01:00
*----------------------------------------
* FENETRES
*----------------------------------------
2024-02-05 15:24:14 +01:00
PAINTMAIN phb
phk
plb
pha
pha
_GetPort
PushLong wiMAIN
_SetPort
2024-02-05 20:21:30 +01:00
PushLong #contentToSourceLocInfo
PushLong #contentRect
2024-02-05 15:24:14 +01:00
PushWord #0
PushWord #0
PushWord #modeCopy
_PPToPort
2024-02-05 20:21:30 +01:00
lda haCONTROL
ora haCONTROL+2
bne pm_ok
brl pm_none
pm_ok PushLong #curPATTERN
_GetPenPat
PushLong #curPENSIZE
_GetPenSize
PushLong #whitePATTERN
_SetPenPat
PushLong #fenetreRECT
PushWord #16
PushWord #16
_PaintRRect
PushLong #blackPATTERN
_SetPenPat
PushWord #2
PushWord #2
_SetPenSize
PushLong #frameRECT
PushWord #16
PushWord #16
_FrameRRect
PushWord curPENSIZE
PushWord curPENSIZE+2
_SetPenSize
PushLong #curPATTERN
_SetPenPat
2024-02-05 15:24:14 +01:00
PushLong wiMAIN
2024-02-03 19:51:11 +01:00
_DrawControls
2024-02-05 15:24:14 +01:00
2024-02-05 20:21:30 +01:00
pm_none _SetPort
2024-02-05 15:24:14 +01:00
plb
2024-02-03 19:51:11 +01:00
rtl
2023-08-28 18:01:04 +02:00
*-----------------------------------
* AUTRES ROUTINES
*-----------------------------------
*----------------------------------- Open
2024-02-06 20:49:01 +01:00
doLOAD lda texte_selectionne
ora objet_selectionne
ora peche_selectionne
beq doLOAD0
rts
2024-02-07 19:25:57 +01:00
doLOAD0 PushWord #30
2024-02-06 20:49:01 +01:00
PushWord #43
PushLong #strLOADFILE
PushLong #0
PushLong #typeLIST
PushLong #replyPTR
2023-08-28 18:01:04 +02:00
_SFGetFile
2024-02-06 20:49:01 +01:00
jsr init_souris
2023-08-28 18:01:04 +02:00
lda replyPTR
bne doLOAD1
2024-02-06 20:49:01 +01:00
loadKO99 rts
2023-08-28 18:01:04 +02:00
doLOAD1 jsr copyPATH
2024-02-05 23:40:05 +01:00
jsl GSOS
dw $2010
adrl proOPENGAME
bcs loadKO99
lda proOPENGAME+2
sta proREADGAME+2
sta proCLOSE+2
jsl GSOS
dw $2012
adrl proREADGAME
jsl GSOS
dw $2014
adrl proCLOSE
2024-02-07 19:25:57 +01:00
lda #$bdbd ; on rafraîchit
2024-02-06 20:49:01 +01:00
rts
2023-08-28 18:01:04 +02:00
*----------------------------------- Save
2024-02-06 20:49:01 +01:00
doSAVE lda texte_selectionne
ora objet_selectionne
ora peche_selectionne
beq doSAVE0
rts
2024-02-07 19:25:57 +01:00
doSAVE0 PushWord #25
2024-02-06 20:49:01 +01:00
PushWord #36
PushLong #strSAVEFILE
PushLong #namePATH
PushWord #15
PushLong #replyPTR
2023-08-28 18:01:04 +02:00
_SFPutFile
2024-02-06 20:49:01 +01:00
jsr init_souris
2023-08-28 18:01:04 +02:00
lda replyPTR
bne doSAVE1
2024-02-07 19:25:57 +01:00
saveKO99 rts
2023-08-28 18:01:04 +02:00
doSAVE1 jsr copyPATH
2024-02-04 13:07:16 +01:00
2023-08-28 18:01:04 +02:00
jsl GSOS
dw $2002
adrl proDESTROYGAME
jsl GSOS
dw $2001
adrl proCREATEGAME
bcs saveKO99
jsl GSOS
dw $2010
adrl proOPENGAME
bcs saveKO99
lda proOPENGAME+2
sta proWRITEGAME+2
sta proCLOSE+2
2024-02-04 13:07:16 +01:00
jsl GSOS
dw $2013
adrl proWRITEGAME
2023-08-28 18:01:04 +02:00
jsl GSOS
dw $2014
adrl proCLOSE
2024-02-06 20:49:01 +01:00
rts
2024-02-05 23:40:05 +01:00
*--- Recopie le filename du fichier de sauvegarde
copyPATH sep #$20
ldx #16-1
]lp lda namePATH1,x
sta pGAME+4,x
dex
bpl ]lp
lda namePATH
inc
inc
sta pGAME
rep #$20
rts
2023-08-28 18:01:04 +02:00
*----------------------------------- Restart
2024-02-07 19:25:57 +01:00
doRESTART PushWord #0
2024-02-06 20:49:01 +01:00
PushWord #5
PushLong #0
2023-08-28 18:01:04 +02:00
pea $0000
lda #alertRESTART
ora saveLANGUAGE
pha
_AlertWindow
pla
beq re1
2024-02-06 20:49:01 +01:00
lda #0
rts
2024-02-07 19:25:57 +01:00
re1 lda #$bcbc ; on relance le jeu
2023-08-28 18:01:04 +02:00
rts
*----------------------------------- Quit
2024-02-07 19:25:57 +01:00
doQUIT PushWord #0
2023-08-28 18:01:04 +02:00
PushWord #5
PushLong #0
pea $0000
lda #alertQUIT
ora saveLANGUAGE
pha
2024-02-07 19:25:57 +01:00
_AlertWindow
2023-08-28 18:01:04 +02:00
pla
beq meQUIT
rts
*----------------------------------- Quit
2024-02-06 20:49:01 +01:00
meQUIT jsr stopMIDI
2023-08-28 18:01:04 +02:00
meQUIT0 PushWord #refIsHandle
PushLong SStopREC
_ShutDownTools
meQUIT1 PushWord myID
_DisposeAll
PushWord mainID
_DisposeAll
PushWord mainID
_MMShutDown
_TLShutDown
jsl GSOS
dw $2029
adrl proQUIT
monitor brk $bd
*----------------------------------------
* MEMOIRE
*----------------------------------------
make64KB pha
pha
PushLong #$010000
PushWord myID
PushWord #%11000000_00011100
PushLong #0
_NewHandle
phd
tsc
tcd
lda [3]
tax ; low in X
ldy #2
lda [3],y
txy ; low in Y
tax ; high in X
pld
pla ; we do not keep track of the handle
pla
rts
*----------------------------------------
* GFX
*----------------------------------------
*----------------------------
* unpackLZ4
* Unpacks a LZ4 file
* Uses the two pointers:
* - ptrUNPACK: packed img (MUST BE AT $0000)
* - ptrIMAGE: temp unpack zone
*
* Entry:
* A: packed data size
*
* Exit:
* lenDATA: unpacked data size
*
*----------------------------
2024-02-06 20:49:01 +01:00
mx %00
2023-08-28 18:01:04 +02:00
2024-02-06 20:49:01 +01:00
unpackLZ4 sta LZ4_Limit+1
2023-08-28 18:01:04 +02:00
sep #$20
2024-02-06 20:49:01 +01:00
lda ptrUNPACK+2 ; Source
sta LZ4_Literal_3+2
sta LZ4_ReadToken+3
sta LZ4_Match_1+3
sta LZ4_GetLength_1+3
2023-08-28 18:01:04 +02:00
2024-02-06 20:49:01 +01:00
lda ptrIMAGE+2 ; Destination
sta LZ4_Literal_3+1
sta LZ4_Match_5+1
sta LZ4_Match_5+2
2023-08-28 18:01:04 +02:00
2024-02-06 20:49:01 +01:00
rep #$20
2023-08-28 18:01:04 +02:00
*--
2024-02-06 20:49:01 +01:00
ldy #0 ; Init Target unpacked Data offset
ldx #16 ; Offset after header
2023-08-28 18:01:04 +02:00
2024-02-06 20:49:01 +01:00
LZ4_ReadToken
LDAL $AA0000,X ; Read Token Byte
INX
STA LZ4_Match_2+1
2023-08-28 18:01:04 +02:00
*----------------
2024-02-06 20:49:01 +01:00
LZ4_Literal
AND #$00F0 ; >>> Process Literal Bytes <<<
BEQ LZ4_Limit ; No Literal
CMP #$00F0
BNE LZ4_Literal_1
JSR LZ4_GetLengthLit ; Compute Literal Length with next bytes
BRA LZ4_Literal_2
LZ4_Literal_1
LSR ; Literal Length use the 4 bit
LSR
LSR
LSR
LZ4_Literal_2
DEC ; Copy A+1 Bytes
LZ4_Literal_3
MVN $AA,$BB ; Copy Literal Bytes from packed data buffer
PHK ; X and Y are auto incremented
PLB
2023-08-28 18:01:04 +02:00
*----------------
2024-02-06 20:49:01 +01:00
LZ4_Limit CPX #$AAAA ; End Of Packed Data buffer ?
BEQ LZ4_End
2023-08-28 18:01:04 +02:00
*----------------
2024-02-06 20:49:01 +01:00
LZ4_Match TYA ; >>> Process Match Bytes <<<
SEC
LZ4_Match_1 SBCL $AA0000,X ; Match Offset
INX
INX
STA LZ4_Match_4+1
LZ4_Match_2 LDA #$0000 ; Current Token Value
AND #$000F
CMP #$000F
BNE LZ4_Match_3
JSR LZ4_GetLengthMat ; Compute Match Length with next bytes
LZ4_Match_3 CLC
ADC #$0003 ; Minimum Match Length is 4 (-1 for the MVN)
PHX
LZ4_Match_4 LDX #$AAAA ; Match Byte Offset
LZ4_Match_5 MVN $BB,$BB ; Copy Match Bytes from unpacked data buffer
PHK ; X and Y are auto incremented
PLB
PLX
BRA LZ4_ReadToken
2023-08-28 18:01:04 +02:00
*----------------
2024-02-06 20:49:01 +01:00
LZ4_GetLengthLit
LDA #$000F ; Compute Variable Length (Literal or Match)
LZ4_GetLengthMat
STA LZ4_GetLength_2+1
LZ4_GetLength_1
LDAL $AA0000,X ; Read Length Byte
INX
AND #$00FF
CMP #$00FF
BNE LZ4_GetLength_3
CLC
LZ4_GetLength_2
ADC #$000F
STA LZ4_GetLength_2+1
BRA LZ4_GetLength_1
LZ4_GetLength_3
ADC LZ4_GetLength_2+1
RTS
2023-08-28 18:01:04 +02:00
*----------------
LZ4_End sty lenDATA ; Y = length of unpacked data
2024-02-06 20:49:01 +01:00
rts
2023-08-28 18:01:04 +02:00
*---
lenDATA ds 4
*----------------------------
* nowWAIT
* Wait A seconds
*
* Entry:
* A: nb of seconds to wait
*
* Exit:
* A/X: scrambled
*
*----------------------------
nowWAIT
dec
tax
lda #0
]lp clc
adc #60
cpx #0
beq nowWAIT1
dex
bra ]lp
nowWAIT1 pha
]lp ldal RDVBLBAR-1
bpl ]lp
]lp ldal RDVBLBAR-1
bmi ]lp
pla
dec
bne nowWAIT1
sec
rts
*----------------------------------------
* DATA
*----------------------------------------
2024-02-03 19:51:11 +01:00
*----------------------- Fenetres
wiMAIN ds 4
2023-08-28 18:01:04 +02:00
*----------------------- Memory manager
mainID ds 2 ; app ID
myID ds 2 ; user ID
myDP ds 2
SStopREC ds 4
2024-02-03 19:51:11 +01:00
ptrSCREEN adrl ptr012000 ; l'écran actif
2023-08-28 18:01:04 +02:00
ptrIMAGE ds 4 ; $0000: where a scene image is loaded
2024-02-03 19:51:11 +01:00
ptrBACKGND adrl $8000 ; $8000: where the screen is saved
2023-08-28 18:01:04 +02:00
ptrFOND ds 4 ; $0000: fond de jeu
ptrICONES adrl $8000 ; $0000: fond d'icônes du jeu
ptrUNPACK ds 4 ; $0000: where the background picture is laoded
2024-02-05 15:24:14 +01:00
ptrCONTENT adrl $8000 ; $8000: the window content
2023-08-30 16:42:20 +02:00
2024-02-03 22:58:16 +01:00
ptrTEXTES ds 4 ; les pointeurs des textes
2023-08-28 18:01:04 +02:00
2024-02-05 11:39:51 +01:00
haDESKTOP ds 4 ; handle du desktop
2023-09-02 22:47:17 +02:00
haBEAT ds 4
ptrBEAT ds 4
haSND1 ds 4
haSND2 ds 4
haSND3 ds 4
haSND4 ds 4
haSND5 ds 4
haSND6 ds 4
haSND7 ds 4
haSND8 ds 4
haSND9 ds 4
ptrSND1 ds 4
ptrSND2 ds 4
ptrSND3 ds 4
ptrSND4 ds 4
ptrSND5 ds 4
ptrSND6 ds 4
ptrSND7 ds 4
ptrSND8 ds 4
ptrSND9 ds 4
2023-08-28 18:01:04 +02:00
temp ds 2
saveLANGUAGE ds 2
2024-02-03 19:51:11 +01:00
*----------------------------------- Quickdraw II
palette320 dw $0000,$0777,$0841,$072C,$000F,$0080,$0F70,$0D00
dw $0FA9,$0FF0,$00E0,$04DF,$0DAF,$078F,$0CCC,$0FFF
palette640 dw $0000,$000F,$00F0,$0FFF,$0000,$000F,$0FF0,$0FFF
dw $0000,$0F00,$00F0,$0FFF,$0000,$000F,$0FF0,$0FFF
blackPATTERN ds 32,$00
ds 32,$11
ds 32,$22
ds 32,$33
ds 32,$44
ds 32,$55
ds 32,$66
ds 32,$77
ds 32,$88
ds 32,$99
ds 32,$aa
ds 32,$bb
ds 32,$cc
ds 32,$dd
ds 32,$ee
whitePATTERN ds 32,$ff
checkeredPATTERN
hex 0F0F0F0F
hex F0F0F0F0
hex 0F0F0F0F
hex F0F0F0F0
hex 0F0F0F0F
hex F0F0F0F0
hex 0F0F0F0F
hex F0F0F0F0
curPATTERN ds 32
curPENSIZE ds 4
2023-08-28 18:01:04 +02:00
*----------------------- Tool locator
verSTR1 str 'System 6.0.1 Required!'
verSTR2 str 'Press a key to quit'
fntSTR1 str 'Courier.10 font missing'
fntSTR2 str 'Please install it!'
pgmSTR1 str 'Data parsing error'
pgmSTR2 str 'Please report!'
tolSTR1 str 'Error while loading tools'
memSTR1 str 'Cannot allocate memory'
filSTR1 str 'Cannot load file'
errSTR1 str 'Quit'
errSTR2 str ''
errSTR3 str 'Continue'
*----------------------- Window manager
taskREC ds 2 ; wmWhat +0
taskMESSAGE ds 4 ; wmMessage +2
taskWHEN ds 4 ; wmWhen +6
taskWHERE ds 4 ; wmWhere +10
taskMODIFIERS ds 2 ; wmModifiers +14
taskDATA ds 4 ; wmTaskData +16
2024-02-03 19:51:11 +01:00
adrl $001fffff ; wmTaskMask +20
ds 4 ; wmLastClickTick +24
ds 2 ; wmClickCount +28
ds 4 ; wmTaskData2 +30
ds 4 ; wmTaskData3 +34
ds 4 ; wmTaskData4 +38
ds 4 ; wmLastClickPt +42
2023-08-28 18:01:04 +02:00
taskTBL da doNOT ; 0 Null
2024-02-04 21:08:00 +01:00
da doNOT ; 1 mouseDownEvt
da doMOUSEUP ; 2 mouseUpEvt
2023-08-28 18:01:04 +02:00
da doKEYDOWN ; 3 keyDownEvt
da doNOT
da doNOT ; 5 autoKeyEvt
da doNOT ; 6 updateEvt
da doNOT
da doNOT ; 8 activateEvt
da doNOT ; 9 switchEvt
da doNOT ; A deskAccEvt
da doNOT ; B driverEvt
da doNOT ; C app1Evt
da doNOT ; D app2Evt
da doNOT ; E app3Evt
da doNOT ; F app4Evt
2024-02-03 19:51:11 +01:00
da doNOT ; wInDesk
da doNOT ; wInMenuBar
da doNOT ; wCLickCalled
2024-02-05 15:24:14 +01:00
da doCONTENT ; wInContent - was doCONTENT
2024-02-03 19:51:11 +01:00
da doNOT ; wInDrag
da doNOT ; wInGrow
da doNOT ; wInGoAway
da doNOT ; wInZoom
da doNOT ; wInInfo
da doNOT ; wInSpecial
da doNOT ; wInDeskItem
da doNOT ; wInFrame
da doNOT ; wInactMenu
da doNOT ; wInClosedNDA
da doNOT ; wInCalledSysEdit
da doNOT ; wInTrackZoom
da doNOT ; wInHitFrame
2024-02-06 20:49:01 +01:00
da doNOT ; wInControl
2024-02-03 19:51:11 +01:00
da doNOT ; wInControlMenu
2024-02-05 23:40:05 +01:00
ctrlTBL da doNOT ; 0
da doNOT ; 1 - textedit
2023-08-28 18:01:04 +02:00
*----------------------------------------
* STD FILE
*----------------------------------------
*---
strLOADFILE str 'Charger quel jeu ?'
strSAVEFILE str 'Enregistrer sous...'
typeLIST hex 01
hex 5d ; Game/Edu files
replyPTR ds 2 ; 0 good
ds 2 ; 2 fileType
ds 2 ; 4 auxFileType
namePATH
hex 06 ; 6 fileName
namePATH1
asc 'Partie' ; 7 fileName (16 normally)
ds 9
loadPATH
ds 1 ; 22 fullPathname (string length)
loadPATH1
ds 129 ; 23 fullPathname (128 normally)
*----------------------------------------
* GS/OS
*----------------------------------------
2024-02-06 20:49:01 +01:00
loadFILE sta proOPEN+4 ; filename
2023-08-28 18:01:04 +02:00
2024-02-06 20:49:01 +01:00
sty proDEST ; where to put at the end
stx proDEST+2
2023-08-28 18:01:04 +02:00
2024-02-06 20:49:01 +01:00
ldy ptrUNPACK ; where to load
sty proREAD+4 ; the packed image
ldx ptrUNPACK+2
stx proREAD+6
loadFILE1 jsl GSOS
2023-08-28 18:01:04 +02:00
dw $2010
adrl proOPEN
bcs loadERR
lda proOPEN+2
sta proREAD+2
sta proCLOSE+2
lda proEOF
sta proREAD+8
lda proEOF+2
sta proREAD+10
jsl GSOS
dw $2012
adrl proREAD
bcs loadERR
loadFILE2 jsl GSOS
dw $2014
adrl proCLOSE
2024-02-06 20:49:01 +01:00
lda proREAD+12 ; length read
jsr unpackLZ4
PushLong ptrIMAGE
PushLong proDEST
PushLong #32768
_BlockMove
2023-08-28 18:01:04 +02:00
clc
rts
2024-02-06 20:49:01 +01:00
loadERR jsl GSOS
dw $2014
adrl proCLOSE
2023-08-28 18:01:04 +02:00
ldy #0
tyx
sec
rts
*--- GS/OS data
2024-02-06 20:49:01 +01:00
proDEST ds 4 ; where to put the image at the end
2023-08-28 18:01:04 +02:00
*--- For the game party
proCREATEGAME
dw 7 ; pcount
adrl pGAME ; pathname
dw $c3 ; access_code
dw $5d ; file_type
2024-02-05 23:40:05 +01:00
adrl $8021 ; aux_type
2023-08-28 18:01:04 +02:00
ds 2 ; storage_type
ds 4 ; eof
ds 4 ; resource_eof
proDESTROYGAME
dw 1 ; pcount
adrl pGAME ; pathname
proOPENGAME
dw 2
ds 2
adrl pGAME
proREADGAME
dw 4 ; 0 - pcount
ds 2 ; 2 - ref_num
2024-02-04 13:07:16 +01:00
adrl DEBUT_DATA ; 4 - data_buffer
adrl FIN_DATA-DEBUT_DATA ; 8 - request_count
2023-08-28 18:01:04 +02:00
ds 4 ; C - transfer_count
proWRITEGAME
dw 5 ; 0 - pcount
ds 2 ; 2 - ref_num
2024-02-04 13:07:16 +01:00
adrl DEBUT_DATA ; 4 - data_buffer (we are in same bank)
adrl FIN_DATA-DEBUT_DATA ; 8 - request_count
2023-08-28 18:01:04 +02:00
ds 4 ; C - transfer_count
dw 1 ; cache_priority
*--- For the game images
proOPEN dw 12
ds 2
adrl pIMAGE
ds 2
ds 2
ds 2
ds 2
ds 4
ds 2
ds 8
ds 8
ds 4
proEOF ds 4
proREAD dw 4 ; 0 - nb parms
ds 2 ; 2 - file id
ds 4 ; 4 - pointer
ds 4 ; 8 - length
ds 4 ; C - length read
proCLOSE dw 1
ds 2
proQUIT dw 2 ; pcount
ds 4 ; pathname
ds 2 ; flags
proVERS dw 1 ; pcount
ds 2 ; version
*--- offset to image number is +19
*--- offset to language is +16
*--- offset to text number is +22
2023-09-02 22:47:17 +02:00
*--- offset to beat number is +22
*--- offset to sfxs number is +21
* 1 2 3
* 23456789012345678901234567890123456789
2023-08-28 18:01:04 +02:00
2024-02-06 20:49:01 +01:00
pIMAGE strl '1/data/images/PIC1.LZ4'
pFOND strl '1/data/images/PIC10.LZ4'
pICONES strl '1/data/images/PIC11.LZ4'
2024-02-03 22:58:16 +01:00
pTXT strl '1/data/textes/fr/TEXTES'
2023-09-02 22:47:17 +02:00
pBEAT strl '1/data/musiques/BEAT1.SPL'
pSND strl '1/data/musiques/SND10.SND'
2023-08-28 18:01:04 +02:00
pGAME strl '0/ '
*----------------------------------------
* LES AUTRES FICHIERS
*----------------------------------------
put data.s
put game.s
2024-02-06 20:49:01 +01:00
put midi.s
2023-08-28 18:01:04 +02:00
*---
asc 0d
asc "----------------"0d
asc " "0d
asc " LA BELLE ZOHRA "0d
asc " "0d
asc " Antoine Vignau "0d
asc "Olivier Zardini"0d
asc " "0d
asc " Noel 2023 "0d
asc " "0d
asc "----------------"0d