diff --git a/.DS_Store b/.DS_Store index 7edd7c7..b2d33c0 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/canalmeurtre/canalmeurtre.s b/canalmeurtre/canalmeurtre.s new file mode 100644 index 0000000..d6ba048 --- /dev/null +++ b/canalmeurtre/canalmeurtre.s @@ -0,0 +1,1559 @@ +* +* Canal Meurtre (FR) +* +* (c) 1986, Froggy Software +* (c) 2022, Antoine Vignau & Olivier Zardini +* + + lst off + rel + dsk CanalMeurtre.l + + mx %00 + xc + xc + +*----------------------------------- 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 + use 4/MIDISyn.Macs + 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 + +*----------------------- +* macros +*----------------------- + +@val mac + PushWord ]2 + PushWord ]1 + jsr val + eom + +@left mac + PushWord ]3 + PushWord ]2 + PushWord ]1 + jsr left + eom + +@charcmp mac + PushWord #]2 + PushWord #]1 + jsr charcmp + eom + +@copystring mac + PushWord #]3 + PushWord #]2 + PushWord #]1 + jsr copy_string + eom + +@instr mac + PushWord #]3 + PushWord #]2 + PushWord #]1 + jsr instr + eom + +*----------------------------------- Constantes + +*-------------- Softswitches + +KBD = $e0c000 +KBDSTROBE = $e0c010 +RDVBLBAR = $e0c019 +GSOS = $e100a8 + +*-------------- GUI + +wMAIN = 1 +alertQUIT = $0100 +alertRESTART = $0200 + +refIsPointer = $0 +refIsHandle = $1 +refIsResource = $2 + +appleKey = $0100 +mouseUpEvt = $0002 +keyDownEvt = $0003 + +*-------------- + +dpFROM = $80 +dpTO = dpFROM+4 + +dpFICHES = $90 ; pointeur vers NEWTV.BASE +dpENTREE = dpFICHES+4 ; pointeur vers une fiche + +Debut = $a0 +Arrivee = Debut+4 +Second = Arrivee+4 + +*--- + +TRUE = 1 +FALSE = 0 + +*----------------------------------- Entry point + + phk + plb + + _TLStartUp + pha + _MMStartUp + pla + sta myID + + tdc + sta myDP + +*--- 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 + +*--- 64K pour les images des scènes + +okVERS jsr make64KB + bcc okMEM1 + +koMEM pha + PushLong #memSTR1 + PushLong #errSTR2 + PushLong #errSTR1 + PushLong #errSTR2 + _TLTextMountVolume + pla + brl meQUIT1 + +okMEM1 + sty ptrIMAGE ; set pointer to show_cartouche + sty ptrToSourceLocInfo2+2 + stx ptrIMAGE+2 + stx ptrToSourceLocInfo2+4 + +*--- 64K pour la sauvegarde de l'écran + + jsr make64KB + bcs koMEM + + sep #$10 ; save pointer+2 + stx saveBACK1+3 ; for interactions + stx loadBACK1+3 ; with the toolbox + rep #$10 + +*--- 64K pour les images compressees + + jsr make64KB + bcs koMEM + + sty ptrUNPACK + stx ptrUNPACK+2 + +*--- 64K pour les décors + + jsr make64KB + bcs koMEM + + sty ptrDECORB + stx ptrDECORB+2 + stx ptrDECORN+2 + +*--- 64K pour les NEWTV.BASE + + jsr make64KB + bcs koMEM + + sty ptrFICHES + stx ptrFICHES+2 + +*--- Chargement des outils + + pha + pha + PushWord myID + PushWord #refIsResource + PushLong #1 + _StartUpTools + PullLong SStopREC + bcc okTOOL + + pha + PushLong #tolSTR1 + PushLong #errSTR2 + PushLong #errSTR1 + PushLong #errSTR2 + _TLTextMountVolume + pla + brl meQUIT0 + +*--- Et la musique... + +okTOOL + _InitCursor + + jsr set_texte ; set text language + +*--- Nettoie le cache de l'Event Manager + + PushWord #0 + PushWord #%11111111_11111111 + PushWord #0 + _FlushEvents + pla + +*--- On continue... + + jsr initMIDI + jsr randomMIDI ; select a sequence 0-7 + jsr TWILIGHToff + +*--- Et la bordure... + + PushWord #0 + PushWord #$1c + _ReadBParam + pla + sta saveBORDER + + PushWord #0 + PushWord #$1c + _WriteBParam + + sep #$20 ; black border + ldal $e0c034 + and #$f0 + stal $e0c034 + rep #$20 + + PushLong #sourcePAT + _GetPenPat + + PushLong #thePATTERN + _SetPenPat + +*--- Charge et décompresse les décors + + lda #pDECORB + ldx ptrUNPACK+2 + ldy ptrUNPACK + jsr loadFILE + bcc decor_ok + +decor_ko + pha + PushLong #filSTR1 + PushLong #errSTR2 + PushLong #errSTR1 + PushLong #errSTR2 + _TLTextMountVolume + pla + brl meQUIT + +decor_ok + ldx ptrDECORB+2 + ldy ptrDECORB + jsr unpackAPF + + lda #pDECORN + ldx ptrUNPACK+2 + ldy ptrUNPACK + jsr loadFILE + bcs decor_ko + + ldx ptrDECORN+2 + ldy ptrDECORN + jsr unpackAPF + +*--- Charge les textes + + jsr load_fiche ; exit if error + jsr init_fiche + jsr load_font + jsr initialisation + + jsr doSOUNDON ; midi on + +*---------------------------------------- +* INITIALISATIONS +*---------------------------------------- + +memOK + pha + pha + PushLong #0 + PushLong #wMAIN + PushLong #PAINTMAIN + PushLong #0 + PushWord #refIsResource + PushLong #wMAIN + PushWord #$800e + _NewWindow2 + PullLong wiMAIN + + ldx ptrDECORB+2 + ldy ptrDECORB + jsr show_picture + +*---------------------------------------- +* TASK MASTER +*---------------------------------------- + +taskLOOP + PushWord #0 + PushWord #0 + PushWord #$c000 + PushWord #0 + _HandleDiskInsert + pla + pla + + inc VBLCounter0 + + jsr checkREPLAY ; midi replay + + PushWord #0 + PushWord #%11111111_11111111 + PushLong #taskREC + _TaskMaster + pla + beq taskLOOP + + asl + tax + jsr (taskTBL,x) + bra taskLOOP + +*----------------------------------- 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 + sep #$20 +]lp inx + lda tblKEYVALUE,x ; get key + cmp #$ff ; end of table + beq doOPENAPPLE99 ; so exit + cmp taskMESSAGE ; same as pressed key? + bne ]lp ; no, loop + + rep #$20 + txa + asl + tax + jmp (tblKEYADDRESS,x) + +doOPENAPPLE99 +doNOT + rep #$20 + rts + +*--- + +tblKEYVALUE + asc 'QqOoSs' + asc 'Rr' + asc 'Zz' + hex ff + +tblKEYADDRESS + da doQUIT,doQUIT,doLOAD,doLOAD,doSAVE,doSAVE + da doRESTART,doRESTART + da doMUSIK,doMUSIK + +*----------------------------------- Gestion des contrôles (ça veut dire boutons ou lineedit) + +doCONTROL + lda taskREC+38 + cmp #6 + bcc doBOUTON + bne doOK + rts ; c'est le line edit, on ne fait rien + +*--- Le bouton OK est l'ID 7 + +doOK + jmp gosub43 + +*--- Les boutons de 1 à 5 (routines TO, 55) + +doBOUTON + @charcmp #T2;#'R' + bne ctl_notR + +gosub49 + pea $0004 ; nombre de caractères + lda taskREC+38 ; gère le choix de la REPONSE + dec + asl + tax + lda tblREP,x + pha + jsr val + sta P + jmp print_fiche + +tblREP da C2_5,C2_7,C2_9,C2_11,C2_13 + +ctl_notR + @charcmp #T2;#'M' + bne ctl_notM + +gosub39 + @val #C2_5;#4 ; gère le choix du MESSAGE (tjs le premier) + sta P + jmp print_fiche + +ctl_notM + @charcmp #T2;#'C' + bne ctl_notC + + jmp gosub31 + +ctl_notC + @charcmp #T2;#'D' + bne ctl_notD + + jmp gosub43 + +ctl_notD ; do nada + rts + +*--- Gestion des choix possibles (c'est aléatoire) + +gosub31 + jsr Random + and #3 ; 0..1..2..3 + inc ; 1..2..3..4 + sta H + + @val #C2_5;#4 + cmp H + beq goto37 ; <= + bcs goto18 ; > + +goto37 + @val #C2_9;#4 + sta P + + @copystring #C5;#C2_10;#40 + jsr gosub3 + jmp print_fiche + +goto18 + @val #C2_7;#4 + sta P + + @copystring #C5;#C2_8;#40 + jsr gosub3 + jmp print_fiche + +*--- Gestion de l'edit line saisi (il faut comparer les chaînes) + +gosub43 + PushLong wiMAIN + PushLong #6 + PushLong #R0 + _GetLETextByID + + lda R0 ; longueur de chaîne + and #$ff + sta L3 + beq gosub43_1 ; un p'tit string + + jsr upperCASE ; mets la chaîne en MAJUSCULES STP + + @val #C2_1;#2 ; entree max + sta C + + lda #3-1 ; compare les chaînes +]lp pha + asl + tax + PushWord L3 + lda ptrTEXT,x + pha + PushWord #R1 + jsr strcmp + beq gosub43_2 ; même chaîne + + pla + inc + cmp C + bcc ]lp +* beq ]lp + +* on n'a pas trouvé de correspondance + +gosub43_1 + + @copystring #C5;#C2_8;#40 + jsr gosub3 + @val #C2_7;#4 + sta P + jmp print_fiche + +*--- on a trouvé une correspondance + +gosub43_2 + pla + @val #C2_9;#4 + sta P + jmp print_fiche + +*----------------------------------- UPPERcase + +upperCASE + sep #$30 + + ldy #0 +]lp ldx R1,y + lda tblUPPER,x + sta R1,y + iny + cpy R0 + bcc ]lp +* beq ]lp + + rep #$30 + rts + +tblUPPER + hex 000102030405060708090A0B0C0D0E0F + hex 101112131415161718191A1B1C1D1E1F + hex 202122232425262728292A2B2C2D2E2F + hex 303132333435363738393A3B3C3D3E3F + hex 404142434445464748494A4B4C4D4E4F + hex 505152535455565758595A5B5C5D5E5F + hex 604142434445464748494A4B4C4D4E4F ; a-z => A-Z + hex 505152535455565758595A7B7C7D7E7F + hex 808182838485868788898A8B8C8D8E8F + hex 909192939495969798999A9B9C9D9E9F + hex A0A1A2A3A4A5A6A7A8A9AAABACADAEAF + hex B0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF + hex C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF + hex D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF + hex E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF + hex F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF + +*----------------------------------- Gestion du mouseUp +* on compare les coordonnées avec celles du incontent +* si dans le même rectangle, on traite + +doMOUSEUP + jsr check_boutonstv ; vérifie les boutons de la télévision + bcs doMOUSEUP1 ; not handled, others are controls + jmp handle_boutonstv ; handle it, please +doMOUSEUP1 + rts + +*---------------------------- +* TWILIGHToff +* Turns Twilight II off +* +* Entry: +* n/a +* +* Exit: +* n/a +* +*---------------------------- + +*Debut = $00 +*Arrivee = Debut+4 + +lenV1 = $49bf +lenV2 = $539a + +offV1 = $117a +offV2 = $154c + +TWILIGHToff + phd + lda myDP + tcd + + ldal $e11600 + sta Debut + ldal $e11602 + sta Debut+2 + +TWILIGHToff1 + ldy #8 + lda [Debut],y + ldx #offV1 + cmp #lenV1 + beq TWILIGHToff2 + ldx #offV2 + cmp #lenV2 + bne TWILIGHToff3 + +TWILIGHToff2 + stx offTWILIGHT + + lda [Debut] + sta Arrivee + sta ptrTWILIGHT + ldy #2 + lda [Debut],y + sta Arrivee+2 + sta ptrTWILIGHT+2 + + txy + lda [Arrivee],y + cmp #$0ef0 + bne TWILIGHToff3 + lda #$0e80 + sta [Arrivee],y + inc fgTWILIGHT + pld + rts + +TWILIGHToff3 + ldy #16 + lda [Debut],y + tax + iny + iny + lda [Debut],y + sta Debut+2 + txa + sta Debut + + lda Debut + ora Debut+2 + bne TWILIGHToff1 + pld + rts + +*---------------------------- +* TWILIGHTon +* Turns Twilight II on +* +* Entry: +* n/a +* +* Exit: +* n/a +* +*---------------------------- + +TWILIGHTon + lda fgTWILIGHT + bne TWILIGHTon1 + rts + +TWILIGHTon1 + phd + lda myDP + tcd + + lda ptrTWILIGHT + sta Arrivee + lda ptrTWILIGHT+2 + sta Arrivee+2 + ldy offTWILIGHT + lda #$0ef0 + sta [Arrivee],y + + pld + rts + +*--- Twilight II + +ptrTWILIGHT ds 4 +fgTWILIGHT ds 2 +offTWILIGHT ds 2 + +*---------------------------------------- +* FENETRES +*---------------------------------------- + +PAINTMAIN + PushLong wiMAIN + _DrawControls + + phb + phk + plb + + jsr font_it ; force Courier + + plb + rtl + +*---------------------------------------- +* CODE DU JEU +*---------------------------------------- + +*---------------------------------------- +* Affiche une image de décor +*---------------------------------------- + +show_picture + sty ptrToSourceLocInfo+2 + stx ptrToSourceLocInfo+4 + + _HideCursor + PushLong #paintParamPtr + _PaintPixels + + PushWord #0 + PushLong #ColorTableArray + _SetColorTable + PushWord #0 + _SetAllSCBs + _ShowCursor + rts + +*--- + +paintParamPtr + adrl ptrToSourceLocInfo + adrl ptrToDestLocInfo + adrl ptrToSourceRect + adrl ptrToDestPoint + dw $0000 ; mode copy + ds 4 + +ptrToSourceLocInfo + dw $0000 ; mode 320 + ds 4 ; ptrDECORB or ptrDECORN + dw 160 + dw 0,0,200,320 + +ptrToDestLocInfo + dw $0000 ; mode 320 + adrl $012000 + dw 160 + dw 0,0,200,320 + +ptrToSourceRect + dw 0,0,200,320 +ptrToDestPoint + dw 0,0 + +*---------------------------------------- +* Affiche une image de télévision +*---------------------------------------- + +show_cartouche + _HideCursor + PushLong #paintParamPtr2 + _PaintPixels + _ShowCursor + rts + +*--- + +paintParamPtr2 + adrl ptrToSourceLocInfo2 + adrl ptrToDestLocInfo2 + adrl ptrToSourceRect2 + adrl ptrToDestPoint2 + dw $0000 ; mode copy + ds 4 + +ptrToSourceLocInfo2 + dw $0000 ; mode 320 + ds 4 ; ptrIMAGE + dw 160 + dw 0,0,200,320 + +ptrToDestLocInfo2 + dw $0000 ; mode 320 + adrl $012000 + dw 160 + dw 0,0,200,320 + +ptrToSourceRect2 + dw 0,0,117,138 ; Rectangle of the source rectangle (because I tweaked the unpackAPF routine) +ptrToDestPoint2 + dw 13,27 ; This is where the cartouche is displayed + +*----------------------------------- Open + +doLOAD + jsr doSOUNDOFF ; midi off + jsr saveBACK + + PushWord #30 + PushWord #43 + PushLong #strLOADFILE + PushLong #0 + PushLong #typeLIST + PushLong #replyPTR + _SFGetFile + + jsr loadBACK + jsr doSOUNDON ; midi on + + lda replyPTR + bne doLOAD1 + rts + +doLOAD1 + jsr copyPATH + jmp loadALL + +*----------------------------------- Save + +doSAVE + jsr doSOUNDOFF ; midi off + jsr saveBACK + + PushWord #25 + PushWord #36 + PushLong #strSAVEFILE + PushLong #namePATH + PushWord #15 + PushLong #replyPTR + _SFPutFile + + jsr loadBACK + jsr doSOUNDON ; midi on + + lda replyPTR + bne doSAVE1 + rts + +doSAVE1 + jsr copyPATH + jmp saveALL + +*--- 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 + +*--- Charge le fichier de sauvegarde en mémoire + +loadALL + jsl GSOS + dw $2010 + adrl proOPENGAME + bcs loadKO99 + + lda proOPENGAME+2 + sta proREADGAME+2 + sta proCLOSE+2 + + jsr loadPART + + jsl GSOS + dw $2014 + adrl proCLOSE + +loadKO99 + rts + +*--- + +loadPART + ldx #NB_INDICATEURS + ldy #C1 + jsr loadIT + + ldx #2 + ldy #P + +loadIT + stx proREADGAME+8 + sty proREADGAME+4 + jsl GSOS + dw $2012 + adrl proREADGAME + rts + + +*--- Enregistre le fichier de sauvegarde + +saveALL + 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 + + jsr savePART + + jsl GSOS + dw $2014 + adrl proCLOSE + +saveKO99 + rts + +*--- + +savePART + ldx #NB_INDICATEURS + ldy #C1 + jsr saveIT + + ldx #2 + ldy #P + +saveIT + stx proWRITEGAME+8 + sty proWRITEGAME+4 + jsl GSOS + dw $2013 + adrl proWRITEGAME + rts + +*----------------------------------- Restart + +doRESTART + jsr saveBACK + + PushWord #0 + PushWord #5 + PushLong #0 +* PushLong #alertRESTART + pea $0000 + lda #alertRESTART + ora saveLANGUAGE + pha + _AlertWindow + + jsr loadBACK + + pla + beq re1 + rts + +re1 +* jsr initialisation2 + jmp initialisation + +*----------------------------------- Quit + +doQUIT + jsr saveBACK + + PushWord #0 + PushWord #5 + PushLong #0 +* PushLong #alertQUIT + pea $0000 + lda #alertQUIT + ora saveLANGUAGE + pha + _AlertWindow + + jsr loadBACK + + pla + beq meQUIT + rts + +*----------------------------------- Quit + +meQUIT + jsr stopMIDI + jsr TWILIGHTon + + _SoundShutDown + + PushLong #sourcePAT + _SetPenPat + + PushWord saveBORDER + PushWord #$1c + _WriteBParam + + sep #$20 + ldal $e0c034 + and #$f0 + ora saveBORDER + stal $e0c034 + rep #$20 + +meQUIT0 + PushWord #refIsHandle + PushLong SStopREC + _ShutDownTools + +meQUIT1 + PushWord myID + _DisposeAll + + PushWord myID + _MMShutDown + + _TLShutDown + + jsl GSOS + dw $2029 + adrl proQUIT + + 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 +*---------------------------------------- + +unpackAPF + sty Arrivee ; where to unpack the image located at ptrUNPACK + stx Arrivee+2 + + lda ptrUNPACK + sta Debut + lda ptrUNPACK+2 + sta Debut+2 + + ldy #$0b + lda [Debut],y + sta PixelsPerScanLine + + ldy #$0f + ldx #0 +]lp lda [Debut],y + sta ColorTableArray,x + iny + iny + inx + inx + cpx #32 + bcc ]lp + + lda Debut ; ScanLineDirectory + clc + adc #$31 + sta Second + lda Debut+2 + adc #0 + sta Second+2 + + lda [Debut],y ; PackedScanLines + sta NumScanLines + asl + asl +* tax + clc + adc #$31 + sta Debut +* lda Debut+2 +* adc #0 +* sta Debut+2 + + lda #0 + +* Decompresse les lignes now + +unpackAPF1 + pha + asl + asl + tay + lda [Second],y + sta APFpackedSize + + lda Debut + sta APFpackedHa + lda Debut+2 + sta APFpackedHa+2 + + lda Arrivee + sta APFstartHa + lda Arrivee+2 + sta APFstartHa+2 + + lda #1536 + sta APFsizePtr + + pha + PushLong APFpackedHa + PushWord APFpackedSize + PushLong #APFstartHa + PushLong #APFsizePtr + _UnPackBytes + pla ; next from + clc + adc Debut + sta Debut +* lda #0 ; same bank +* adc Debut+2 +* sta Debut+2 + +* lda PixelsPerScanLine ; next to +* lsr +* clc +* adc Arrivee + lda Arrivee + clc + adc #160 + sta Arrivee +* lda #0 ; same bank +* adc Arrivee+2 +* sta Arrivee+2 + + pla + inc + cmp NumScanLines + bcc unpackAPF1 + rts + +*-- Data + +PixelsPerScanLine ds 2 +ColorTableArray ds 32 +NumScanLines ds 2 + +APFpackedHa ds 4 +APFpackedSize ds 2 +APFstartHa ds 4 +APFsizePtr ds 2 + +*----------------------------------- +* SAVE THE SHR SCREEN +*----------------------------------- + +saveBACK + _HideCursor + + ldx #$8000-2 +]lp ldal $e12000,x +saveBACK1 stal $000000,x + dex + dex + bpl ]lp + +exitBACK _ShowCursor + rts + +*----------------------------------- +* RESTORE THE SHR SCREEN +*----------------------------------- + +loadBACK + _HideCursor + + ldx #$8000-2 +loadBACK1 ldal $000000,x + stal $012000,x + stal $e12000,x + dex + dex + bpl loadBACK1 + bmi exitBACK + +*--- Genere un nombre aleatoire + +Random + ldal $e0c02e + xba + clc + adc VBLCounter0 + sta VBLCounter0 + and #$ff + rts + +VBLCounter0 ds 2 + +*---------------------------- +* 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 +*---------------------------------------- + +*----------------------- Fenetres + +wiMAIN ds 4 + +*----------------------- Memory manager + +myID ds 2 +myDP ds 2 + +SStopREC ds 4 + +ptrIMAGE ds 4 ; where a scene image is loaded +ptrUNPACK ds 4 ; where the background picture is laoded +ptrDECORB ds 4 ; décor lumière allumée +ptrDECORN adrl $8000 ; décord lumière éteinte (ptrDECORB+$8000) + +ptrFICHES ds 4 ; les données multilingues du jeu + +fgSND ds 2 ; set if sound file not loaded +haSND ds 4 ; the handle to the sound pointer +temp ds 2 + +saveBORDER ds 2 +saveLANGUAGE ds 2 + +*----------------------- Tool locator + +verSTR1 str 'System 6.0.1 Required!' +verSTR2 str 'Press a key to quit' +fntSTR1 str 'Helvetica.09 font missing' +fntSTR2 str 'Please install it!' +tolSTR1 str 'Error while loading tools' +memSTR1 str 'Cannot allocate memory' +filSTR1 str 'Cannot load file' +filSTR2 str 'Cannot load text file' +filSTR3 str 'Cannot load font 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 + 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 + +taskTBL da doNOT ; Null + da doNOT ; mouseDownEvt + da doMOUSEUP ; mouseUpEvt + da doKEYDOWN ; keyDownEvt + da doNOT + da doNOT ; autoKeyEvt + da doNOT ; updateEvt + da doNOT + da doNOT ; activateEvt + da doNOT ; switchEvt + da doNOT ; deskAccEvt + da doNOT ; driverEvt + da doNOT ; app1Evt + da doNOT ; app2Evt + da doNOT ; app3Evt + da doNOT ; app4Evt + da doNOT ; wInDesk + da doNOT ; wInMenuBar + da doNOT ; wCLickCalled + da doNOT ; wInContent - was doCONTENT + 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 + da doCONTROL ; wInControl + da doNOT ; wInControlMenu + +*---------------------------------------- +* 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 +*---------------------------------------- + +loadFILE + sta proOPEN+4 ; filename + sty proREAD+4 ; RAM pointer low + stx proREAD+6 ; RAM pointer high + +loadFILE1 + stz proERR + + jsl GSOS + 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 + + ldy proREAD+12 ; length read + ldx proREAD+14 + rts + +loadERR jsr loadFILE2 + ldy #0 + tyx + sec + rts + +*--- GS/OS data + +proERR + ds 2 + +*--- For the game party + +proCREATEGAME + dw 7 ; pcount + adrl pGAME ; pathname + dw $c3 ; access_code + dw $5d ; file_type + adrl $801e ; aux_type + 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 + adrl pGAME ; 4 - data_buffer + ds 4 ; 8 - request_count + ds 4 ; C - transfer_count + +proWRITEGAME + dw 5 ; 0 - pcount + ds 2 ; 2 - ref_num + adrl pGAME ; 4 - data_buffer (we are in same bank) + ds 4 ; 8 - request_count + 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 +16 + +pIMAGE strl '1/data/images/XXXX' +pDECORB strl '1/data/images/DECORB' +pDECORN strl '1/data/images/DECORN' +pPUB strl '1/data/images/PUB' +pPLAN strl '1/data/images/PLAN' +pFICHES strl '1/data/textes/fr/NEWTV.BASE' + +pGAME strl '0/ ' + +*---------------------------------------- +* LES AUTRES FICHIERS +*---------------------------------------- + + put game.s + put midi.s + +*--- + + asc 0d + asc "----------------"0d + asc " "0d + asc " CANAL MEURTRE "0d + asc " "0d + asc " Antoine Vignau "0d + asc "Olivier Zardini"0d + asc " "0d + asc " Paques 2022 "0d + asc " "0d + asc "----------------"0d \ No newline at end of file diff --git a/canalmeurtre/fiche.s b/canalmeurtre/fiche.s new file mode 100644 index 0000000..611aecf --- /dev/null +++ b/canalmeurtre/fiche.s @@ -0,0 +1,821 @@ +* +* Canal Meurtre (éditeur) +* +* (c) 1986, Froggy Software +* (c) 2022, Antoine Vignau & Olivier Zardini +* + + lst off + rel + dsk Fiche.l + + mx %00 + xc + xc + +*----------------------------------- 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 + use 4/MIDISyn.Macs + 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 + +*----------------------------------- Constantes + +*-------------- Softswitches + +KBD = $e0c000 +KBDSTROBE = $e0c010 +RDVBLBAR = $e0c019 +GSOS = $e100a8 + +*-------------- GUI + +wMAIN = 1 + +refIsPointer = $0 +refIsHandle = $1 +refIsResource = $2 + +appleKey = $0100 +mouseUpEvt = $0002 +keyDownEvt = $0003 + +*-------------- + +dpFROM = $80 +dpTO = dpFROM+4 + +dpFICHES = $90 ; pointeur vers NEWTV.BASE +dpENTREE = dpFICHES+4 ; pointeur vers une fiche + +Debut = $a0 +Arrivee = Debut+4 +Second = Arrivee+4 + +*--- + +TRUE = 1 +FALSE = 0 + +*--- Programme + +NB_FICHES = 200 ; nombre de fiches du jeu +TAILLE_FICHE = 255 ; taille d'une fiche en octets + +*----------------------------------- Entry point + + phk + plb + + _TLStartUp + pha + _MMStartUp + pla + sta myID + + tdc + sta myDP + +*--- 64K pour les NEWTV.BASE + + jsr make64KB + + sty ptrFICHES + sty proREAD+4 + sty proWRITE+4 + stx ptrFICHES+2 + stx proREAD+6 + stx proWRITE+6 + + jsr loadFILE + jsr init_fiche + +*--- Chargement des outils + + pha + pha + PushWord myID + PushWord #refIsResource + PushLong #1 + _StartUpTools + PullLong SStopREC + + _InitCursor + +*--- Nettoie le cache de l'Event Manager + + PushWord #0 + PushWord #%11111111_11111111 + PushWord #0 + _FlushEvents + pla + +*---------------------------------------- +* INITIALISATIONS +*---------------------------------------- + + pha + pha + PushLong #0 + PushLong #wMAIN + PushLong #PAINTMAIN + PushLong #0 + PushWord #refIsResource + PushLong #wMAIN + PushWord #$800e + _NewWindow2 + PullLong wiMAIN + + jsr getFICHE + +*---------------------------------------- +* TASK MASTER +*---------------------------------------- + +taskLOOP + PushWord #0 + PushWord #0 + PushWord #$c000 + PushWord #0 + _HandleDiskInsert + pla + pla + + PushWord #0 + PushWord #%11111111_11111111 + PushLong #taskREC + _TaskMaster + pla + beq taskLOOP + + asl + tax + jsr (taskTBL,x) + bra taskLOOP + +*----------------------------------- Gestion des contrôles (ça veut dire boutons ou lineedit) + +doCONTROL + lda taskREC+38 + dec + asl + tax + jsr (taskCTL,x) + rts + +taskCTL da doLINE + da doLINE + da doLINE + da doLINE + da doLINE + da doQUIT + da doPREVIOUS + da doNEXT + da doSAVE + +*---------------------------------------- +* CODE DU JEU +*---------------------------------------- + +doNOT + +*--- Les Line Edit + +doLINE + rts + +*--- Bouton Enregistrer + +doSAVE + jsr putFICHE + jmp saveFILE + +*--- Bouton Quitter + +doQUIT + jsr doSAVE + +meQUIT + PushWord #refIsHandle + PushLong SStopREC + _ShutDownTools + +meQUIT1 + PushWord myID + _DisposeAll + + PushWord myID + _MMShutDown + + _TLShutDown + + jsl GSOS + dw $2029 + adrl proQUIT + + brk $bd + +*--- Bouton Fiche précédente + +doPREVIOUS + jsr putFICHE + + lda P + cmp #1 + bne okPREV + rts +okPREV sec + sbc #1 + sta P + jmp getFICHE + +*--- Bouton Fiche suivante + +doNEXT + jsr putFICHE + + lda P + cmp nbFICHES + bcc okNEXT + beq okNEXT + rts +okNEXT clc + adc #1 + sta P + jmp getFICHE + +*---------------------------------------- +* GESTION DES FICHES +*---------------------------------------- + +*----------------------- +* printP - affiche le numéro de la fiche +*----------------------- + +printP + lda #' ' + sta strP + sta strP+2 + + PushWord P + PushLong #strP + PushWord #3 + PushWord #FALSE + _Int2Dec + + pha + pha + _GetPort + + PushLong wiMAIN + _SetPort + + PushWord #210 + PushWord #130 + _MoveTo + + PushLong #strP + _DrawCString + + _SetPort + rts + +strP asc ' '00 + +*----------------------- +* getFICHE - De F à la fenêtre +*----------------------- + +getFICHE + jsr get_fiche + + sep #$30 + + lda #40 ; Tell length is 40 chars + sta B1_6 + sta B1_8 + sta B1_10 + sta B1_12 + sta B1_14 + + ldx #0 ; Move strings to the buffer +]lp lda C2_6,x + sta B2_6,x + lda C2_8,x + sta B2_8,x + lda C2_10,x + sta B2_10,x + lda C2_12,x + sta B2_12,x + lda C2_14,x + sta B2_14,x + inx + cpx #40 + bcc ]lp + + rep #$30 + + PushLong wiMAIN ; Set LE + PushLong #1 + PushLong #B1_6 + _SetLETextByID + + PushLong wiMAIN + PushLong #2 + PushLong #B1_8 + _SetLETextByID + + PushLong wiMAIN + PushLong #3 + PushLong #B1_10 + _SetLETextByID + + PushLong wiMAIN + PushLong #4 + PushLong #B1_12 + _SetLETextByID + + PushLong wiMAIN + PushLong #5 + PushLong #B1_14 + _SetLETextByID + + jmp printP + +*----------------------- +* putFICHE - De la fenêtre à F +*----------------------- + +putFICHE + PushLong wiMAIN ; Get LE + PushLong #1 + PushLong #B1_6 + _GetLETextByID + + PushLong wiMAIN + PushLong #2 + PushLong #B1_8 + _GetLETextByID + + PushLong wiMAIN + PushLong #3 + PushLong #B1_10 + _GetLETextByID + + PushLong wiMAIN + PushLong #4 + PushLong #B1_12 + _GetLETextByID + + PushLong wiMAIN + PushLong #5 + PushLong #B1_14 + _GetLETextByID + + sep #$30 + + ldx #0 ; Clear destination strings + lda #' ' +]lp sta C2_6,x + sta C2_8,x + sta C2_10,x + sta C2_12,x + sta C2_14,x + inx + cpx #40 + bcc ]lp + + ldx B1_6 ; Move strings to buffer + beq pf_2 + ldx #0 +]lp lda B2_6,x + sta C2_6,x + inx + cpx B1_6 + bcc ]lp +pf_2 + ldx B1_8 + beq pf_3 + ldx #0 +]lp lda B2_8,x + sta C2_8,x + inx + cpx B1_8 + bcc ]lp +pf_3 + ldx B1_10 + beq pf_4 + ldx #0 +]lp lda B2_10,x + sta C2_10,x + inx + cpx B1_10 + bcc ]lp +pf_4 + ldx B1_12 + beq pf_5 + ldx #0 +]lp lda B2_12,x + sta C2_12,x + inx + cpx B1_12 + bcc ]lp +pf_5 + ldx B1_14 + beq pf_6 + ldx #0 +]lp lda B2_14,x + sta C2_14,x + inx + cpx B1_14 + bcc ]lp +pf_6 + + rep #$30 + jmp set_fiche ; and save the data at ptrFICHES + +*----------------------- +* init_fiche +*----------------------- + +init_fiche + stz nbFICHES ; 0 texts on entry + + lda proEOF ; is file empty? + ora proEOF+2 + bne if1 + rts + +if1 + lda ptrFICHES + sta dpFROM + clc + adc proEOF + sta dpTO + lda ptrFICHES+2 + sta dpFROM+2 + adc proEOF+2 + sta dpTO+2 + +if2 + lda dpFROM+2 ; did we reach the end of the file? + cmp dpTO+2 + bcc if3 + lda dpFROM + cmp dpTO + bcc if3 + rts ; we are done! + +if3 + lda nbFICHES ; save the address of the string + asl + asl + tax + lda dpFROM + sta tblFICHES,x + lda dpFROM+2 + sta tblFICHES+2,x + + lda dpFROM + clc + adc #TAILLE_FICHE + sta dpFROM + lda dpFROM+2 + adc #0 + sta dpFROM+2 + + inc nbFICHES ; increment the number of strings + lda nbFICHES ; into our limit + cmp #NB_FICHES + bcc if2 + rts + +*----------------------- +* get_fiche(fiche%) - From ptrFICHES to F +*----------------------- + +get_fiche + lda P + bne get_fiche1 + rts + +get_fiche1 + cmp nbFICHES + bcc get_fiche2 + beq get_fiche2 + rts + +get_fiche2 + dec + asl + asl + tax + lda tblFICHES,x + sta dpFICHES + lda tblFICHES+2,x + sta dpFICHES+2 + + ldy #TAILLE_FICHE-1 + sep #$20 +]lp lda [dpFICHES],y + sta F,y + dey + bpl ]lp + rep #$20 + rts + +*----------------------- +* set_fiche(fiche%) - From F to ptrFICHES +*----------------------- + +set_fiche + lda P + bne set_fiche1 + rts + +set_fiche1 + cmp nbFICHES + bcc set_fiche2 + beq set_fiche2 + rts + +set_fiche2 + dec + asl + asl + tax + lda tblFICHES,x + sta dpFICHES + lda tblFICHES+2,x + sta dpFICHES+2 + + ldy #TAILLE_FICHE-1 + sep #$20 +]lp lda F,y + sta [dpFICHES],y + dey + bpl ]lp + rep #$20 + rts + +*---------------------------------------- Les données d'une fiche + +P dw 1 ; 1ère fiche +nbFICHES ds 2 + +tblFICHES ds 4*NB_FICHES + +F ds 1 ; fiche OK (non zero) ou KO (zero) +C2_1 ds 2 +C2_2 ds 25 +C2_3 ds 2 +C2_4 ds 2 +C2_5 ds 4 +C2_6 ds 40 +C2_7 ds 4 +C2_8 ds 40 +C2_9 ds 4 +C2_10 ds 40 +C2_11 ds 4 +C2_12 ds 40 +C2_13 ds 4 +C2_14 ds 40 + ds 3 ; garbage + +*---------------------------------------- Les données des LineEdit + +B1_6 ds 1 +B2_6 ds 40 + +B1_8 ds 1 +B2_8 ds 40 + +B1_10 ds 1 +B2_10 ds 40 + +B1_12 ds 1 +B2_12 ds 40 + +B1_14 ds 1 +B2_14 ds 40 + + ds 117 ; bad coder... + +*---------------------------------------- +* FENETRES +*---------------------------------------- + +PAINTMAIN + PushLong wiMAIN + _DrawControls + rtl + +*---------------------------------------- +* 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 + +*---------------------------------------- +* DATA +*---------------------------------------- + +*----------------------- Fenetres + +wiMAIN ds 4 + +*----------------------- Memory manager + +myID ds 2 +myDP ds 2 + +SStopREC ds 4 + +ptrFICHES ds 4 + +*----------------------- 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 + 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 + +taskTBL da doNOT ; Null + da doNOT ; mouseDownEvt + da doNOT ; mouseUpEvt + da doNOT ; keyDownEvt + da doNOT + da doNOT ; autoKeyEvt + da doNOT ; updateEvt + da doNOT + da doNOT ; activateEvt + da doNOT ; switchEvt + da doNOT ; deskAccEvt + da doNOT ; driverEvt + da doNOT ; app1Evt + da doNOT ; app2Evt + da doNOT ; app3Evt + da doNOT ; app4Evt + da doNOT ; wInDesk + da doNOT ; wInMenuBar + da doNOT ; wCLickCalled + da doNOT ; wInContent - was doCONTENT + 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 + da doCONTROL ; wInControl + da doNOT ; wInControlMenu + +*---------------------------------------- +* GS/OS +*---------------------------------------- + +loadFILE + jsl GSOS + dw $2010 + adrl proOPEN + + 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 + + jsl GSOS + dw $2014 + adrl proCLOSE + rts + +*--- + +saveFILE + jsl GSOS + dw $2010 + adrl proOPEN + + lda proOPEN+2 + sta proWRITE+2 + sta proCLOSE+2 + + lda proEOF + sta proWRITE+8 + lda proEOF+2 + sta proWRITE+10 + + jsl GSOS + dw $2013 + adrl proWRITE + + jsl GSOS + dw $2014 + adrl proCLOSE + rts + +*--- GS/OS data + +proOPEN + dw 12 + ds 2 + adrl pFICHES + 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 + +proWRITE + dw 5 ; 0 - pcount + ds 2 ; 2 - ref_num + ds 4 ; 4 - data_buffer (we are in same bank) + ds 4 ; 8 - request_count + ds 4 ; C - transfer_count + dw 1 ; cache_priority + +proCLOSE + dw 1 + ds 2 + +proQUIT + dw 2 ; pcount + ds 4 ; pathname + ds 2 ; flags + +*--- + +pFICHES strl '1/NEWTV.BASE' diff --git a/canalmeurtre/game.s b/canalmeurtre/game.s new file mode 100644 index 0000000..d51d19c --- /dev/null +++ b/canalmeurtre/game.s @@ -0,0 +1,1464 @@ +* +* Canal Meurtre +* +* (c) 1986, Froggy Software +* (c) 2022, Antoine Vignau & Olivier Zardini +* + + mx %00 + +*----------------------- +* constantes +*----------------------- + +NB_INDICATEURS = 10 +NB_FICHES = 150 ; nombre de fiches du jeu +TAILLE_FICHE = 255 ; taille d'une fiche en octets + +*--- affiche une fiche + +print_fiche + jsr gosub9 ; cadre + jmp gosub54 ; type d'entre + +*--- efface cadre du texte + +gosub9 + jsr gosub58 + + PushLong #theCADRE + PushWord #4 + PushWord #4 + PushLong #thePATTERN + _FillRRect + + PushLong #blackPATTERN + _SetPenPat + + PushLong #theCADRE + PushWord #4 + PushWord #4 + _FrameRRect + + PushLong #thePATTERN + _SetPenPat + rts + +*--- + +theCADRE dw 135 + dw 10 + dw 195 + dw 280 + +thePATTERN ds 32,$ff + +blackPATTERN ds 32,$00 + +sourcePAT ds 32 + +*--- charge une image (ou pas) + +gosub47 + lda C2_2 ; si la chane commence par 'Bo' comme 'Boot' + cmp #'Bo' ; alors on a une image + beq g47_1 + rts + +g47_1 lda C2_2+5 ; recopie les 4 caractres + sta pIMAGE+16 + lda C2_2+7 + sta pIMAGE+18 + + jsr gosub22 ; pour grer le couloir + + lda #pIMAGE + ldx ptrUNPACK+2 + ldy ptrUNPACK + jsr loadFILE + bcc g47_2 + rts +g47_2 ldx ptrIMAGE+2 + ldy ptrIMAGE + jsr unpackAPF + jsr show_cartouche + + lda S ; il faut affiche les numros de salle + beq g47_3 + jsr gosub4 ; oui + stz S + +g47_3 + rts + +*--- gestion du couloir + +gosub22 + lda C2_2+5 + cmp #'CO' + beq gosub22_1 + rts + +gosub22_1 + lda C2_2+6 + cmp #'OU' + beq gosub22_2 + rts + +gosub22_2 + ldx #1 ; couloir par dfaut + + lda P ; IF P>S2 THEN S=1 ELSE S=2 + cmp S2 + beq gosub22_3 + bcs gosub22_4 + +gosub22_3 + ldx #2 + +gosub22_4 + stx S ; sauve le numro de couloir + + sep #$20 ; met COU1 ou COU2 + lda S + ora #'0' + sta pIMAGE+19 + rep #$20 + rts + +*--- affiche les numros de salle + +gosub4 + pha + _GetTextSize + + lda S + cmp #1 + beq gosub16 ; couloir de gauche + brl gosub44 ; couloir de droite + +gosub16 + PushWord #149 + PushWord #42 + _MoveTo + + lda P + sec + sbc #129 + asl + sec + sbc #1 + jsr printSALLE + +*- + + PushWord #6 + _SetTextSize + + PushWord #29 + PushWord #54 + _MoveTo + + lda P + sec + sbc #129 + asl + jsr printSALLE + +*- + + PushWord #4 + _SetTextSize + + PushWord #72 + PushWord #76 + _MoveTo + + ldx #2 + + lda P + cmp #141 + bcs gosub16_1 + + lda P + sec + sbc #129 + asl + clc + adc #2 + tax + +gosub16_1 + txa + jsr printSALLE + + _SetTextSize + rts + +*-- + +gosub44 + PushWord #28 + PushWord #42 + _MoveTo + + lda P + sec + sbc #129 + asl + sec + sbc #1 + jsr printSALLE + +*- + + PushWord #6 + _SetTextSize + + PushWord #155 + PushWord #53 + _MoveTo + + lda P + sec + sbc #129 + asl + jsr printSALLE + +*- + + PushWord #4 + _SetTextSize + + PushWord #113 + PushWord #76 + _MoveTo + + ldx #24 + lda P + cmp #130 + beq gosub44_1 + + lda P + sec + sbc #129 + asl + sec + sbc #2 + tax + +gosub44_1 + txa + jsr printSALLE + + _SetTextSize + rts + +*--- + +printSALLE + stz strSALLE + + pha + PushLong #strSALLE + PushWord #2 + PushWord #FALSE + _Int2Dec + + PushLong #strSALLE + _DrawCString + rts + +*--- + +strSALLE ds 3 ; aabb00 + +*--- gestion du type d'entree + +gosub54 + lda P + jsr get_fiche + + lda F + and #$ff + beq pf_ok + sec + rts + +pf_ok + jsr gosub47 + + @left #T2;#C2_3;#1 + @charcmp #T2;#'R' + bne pf_notR + + jsr gosub8 ; REPONSES + stz T1 + rts + +pf_notR + @charcmp #T2;#'C' + bne pf_notC + + jsr gosub2 ; CHOIX + stz T1 + rts + +pf_notC + @charcmp #T2;#'D' + bne pf_notD + + jsr gosub7 ; DIALOGUES + stz T1 + rts + +pf_notD + @charcmp #T2;#'T' + bne pf_notT + + jsr gosub53 ; T + lda #1 + sta T1 + rts + +pf_notT + @charcmp #T2;#'M' + bne pf_notM + + jsr gosub6 ; MESSAGES + stz T1 + rts + +pf_notM + @charcmp #T2;#'I' + bne pf_notI + + jsr gosub33 ; INVENTAIRES + lda #1 + sta T1 + rts + +pf_notI + @charcmp #T2;#'E' + bne pf_notE + + jsr gosub23 ; ENTREES + lda #1 + sta T1 + rts + +pf_notE + @charcmp #T2;#'G' + bne pf_notG + + @copystring #C5;#strFROGGY;#40 + jsr gosub3 ; print & quit + brl meQUIT + +pf_notG + @charcmp #T2;#'F' + bne pf_notF + + @copystring #C5;#strERREUR;#40 + jsr gosub3 ; print & quit + brl meQUIT + +pf_notF + rts + +*--- + +strFROGGY asc '(c) FROGGY SOFTWARE ' +strERREUR asc 'VOUS AVEZ COMMIS UNE GRAVE ERREUR! ADIEU' + +*----------------------- +* eviv busog +*----------------------- + +*--- gestion des choix + +gosub2 + PushWord xTEXT + PushWord yTEXT + _MoveTo + + PushLong #C2_6 + PushWord #40 + _DrawText + + lda #1 + sta N0 + + lda #1 ; affiche 1 bouton + jmp bouton + +*--- gestion des messages + +gosub6 + @val #C2_1;#2 + sta C + + lda #0 +]lp pha + asl + tax + phx + + lda xTEXT,x + pha + lda yTEXT,x + pha + _MoveTo + + plx + pea ^ptrTEXT + lda ptrTEXT,x + pha + PushWord #40 + _DrawText + + pla + inc + cmp C + bcc ]lp +* beq ]lp + + lda #1 ; affiche 1 bouton + jmp bouton + +*--- + +xTEXT dw 30,30,30,30,30 +yTEXT dw 146,157,168,179,190 +ptrTEXT da C2_6,C2_8,C2_10,C2_12,C2_14 + +*--- gestion des dialogues + +gosub7 + PushWord xTEXT + PushWord yTEXT + _MoveTo + + PushLong #C2_6 + PushWord #40 + _DrawText + + PushLong #0 + PushLong wiMAIN + PushWord #2 + PushLong #6 + _NewControl2 + _DrawOneCtl + + PushLong #0 + PushLong wiMAIN + PushWord #2 + PushLong #7 + _NewControl2 + _DrawOneCtl + + lda #1 + sta N0 + sta N1 + rts + +*--- gestion des reponses + +gosub8 + @val #C2_1;#2 + sta C + + lda #0 +]lp pha + asl + tax + phx + + lda xTEXT,x + pha + lda yTEXT,x + pha + _MoveTo + + plx + pea ^ptrTEXT + lda ptrTEXT,x + pha + PushWord #40 + _DrawText + + lda 1,s ; affiche le bouton + inc + jsr bouton + + pla + inc + cmp C + bcc ]lp +* beq ]lp + rts + +*--- gestion des entres (le nom des salles) + +gosub23 + @instr #C2_6;#'*';#40 + dec + sta L2 + @left #C3;#C2_6;L2 + +* PushWord #0 +* _GetTextFace + +* PushWord #$0080 +* _SetTextFace + + PushWord #70 + PushWord #53 + _MoveTo + + PushLong #C3 + PushWord L2 + _DrawText + +* _SetTextFace + + @val #C2_13;#4 + sta P + jmp print_fiche + +*--- gestion des inventaires + +gosub33 + jsr gosub35 + + ldx N2 + sep #$20 +* lda V + lda #1 + sta C1-1,x + rep #$20 + + @val #C2_7;#4 + sta P + jmp print_fiche + +*--- gestion des T + +gosub53 + jsr gosub35 + + ldy #3 ; bonne rponse + + ldx N2 + lda C1-1,x + and #$ff +* cmp V +* beq gosub53_1 + bne gosub53_1 + + dey ; mauvaise rponse + +gosub53_1 + pea $0004 ; nombre de caractres + tya + dec + asl + tax + lda tblREP,x + pha + jsr val + sta P + jmp print_fiche + +*--- rcupre la valeur dans une chane + +gosub35 + @instr #C2_6;#'*';#40 + sta L2 + + @left #B0;#C2_6;L2 + @val #B0;L2 + sta N2 + +* @val #C2_5;#4 ; on met 1, c'est pareil +* sta V + rts + +*--- affiche la chane C5 et attend un peu + +gosub3 + jsr gosub58 + jsr gosub9 + + PushWord xTEXT + PushWord yTEXT + _MoveTo + + PushLong #C5 + PushWord #40 + _DrawText + +* lda #2 ; #4000 +* jsr nowWAIT + +*--- attend + +gosub52 + lda #2 ; #6000 + jmp nowWAIT + +*--- ferme les boutons et dialogues si ncessaire + +gosub58 + PushLong wiMAIN + _KillControls + + stz N0 + stz N1 + rts + +*----------------------- +* bouton +*----------------------- +* +* On cre un bouton +* A contains the button index to display + +bouton + sta nbBOUTONS ; useful to check if we clicked on a valid area + tax + + PushLong #0 + PushLong wiMAIN + PushWord #2 + pea $0000 + phx + _NewControl2 + _DrawOneCtl + rts + +*--- + +rectBOUTON dw 0,0,0,0 + +x1BOUTON dw 20,20,20,20,20 +x2BOUTON dw 28,28,28,28,28 +y1BOUTON dw 144,153,162,171,180 +y2BOUTON dw 152,161,170,179,188 + +nbBOUTONS ds 2 ; nombre de boutons actifs (up to 5) + +*----------------------- +* affiche_cadre +*----------------------- +* +* If TV is on, we do something with the first 3 buttons +* If 4th button is pressed, we switch on/off TV, that's all + +*----------------------- +* check_boutonstv +*----------------------- +* +* If TV is on, we do something with the first 3 buttons +* If 4th button is pressed, we switch on/off TV, that's all + +check_boutonstv + lda #0 +]lp + tay + lda taskWHERE + cmp tblBOUTONSTV,y ; Y1 + bcc next_boutontv + cmp tblBOUTONSTV+4,y ; Y2 + bcs next_boutontv + + lda taskWHERE+2 + cmp tblBOUTONSTV+2,y ; X1 + bcc next_boutontv + cmp tblBOUTONSTV+6,y ; X2 + bcs next_boutontv + tya + lsr + lsr + lsr ; /8 + inc ; 1-4 + tay + rts ; on a un bouton ! + +next_boutontv + tya + clc + adc #8 + cmp #8*4 ; parce qu'on a 4 boutons + bcc ]lp + rts ; pas de bouton press + +*--- + +tblBOUTONSTV + dw 19,182,26,189 + dw 32,182,39,189 + dw 44,182,51,189 + dw 72,181,77,189 + +*----------------------- +* handle_boutonstv +*----------------------- +* +* 1 : about +* 2 : plan +* 3 : remet les contrles +* 4 : TV on/off + +handle_boutonstv + sty C0 ; sauve le bouton actif + cpy #4 + bne hb_istvon + + lda fgTVON ; allume/teint la TV + eor #-1 + sta fgTVON + bne hb_tvon + + ldx ptrDECORB+2 ; show TV off + ldy ptrDECORB + jmp show_picture + +hb_tvon + ldx ptrDECORN+2 ; show TV on + ldy ptrDECORN + jsr show_picture + jmp print_fiche + +*--- teste les autres boutons + +hb_istvon + lda fgTVON ; do something if TV is on only + bne hb_3 + rts + +*--- + +hb_3 cpy #3 ; bouton 3 - remet l'image active + bne hb_2 + + jmp print_fiche + +*--- + +hb_2 + jsr gosub9 ; erase le cadre + + ldy C0 + cpy #2 ; affiche le plan + bne hb_1 + + jsr saveBACK + + lda #pPLAN + ldx ptrUNPACK+2 + ldy ptrUNPACK + jsr loadFILE + bcc hb_21 + rts +hb_21 ldx ptrIMAGE+2 + ldy ptrIMAGE + jsr unpackAPF + jsr show_cartouche + jmp gosub26 ; affiche le personnage + +*--- + +hb_1 + cpy #1 ; affiche l'image de pub + bne hb_0 + + jsr saveBACK + + lda #pPUB + ldx ptrUNPACK+2 + ldy ptrUNPACK + jsr loadFILE + bcc hb_11 + rts +hb_11 ldx ptrIMAGE+2 + ldy ptrIMAGE + jsr unpackAPF + jmp show_cartouche + +*--- + +hb_0 + rts + +*--- affiche le personnage sur le plan + +gosub26 + lda P + cmp #121 + bcc gosub26_1 + beq gosub26_1 + rts + +gosub26_1 + PushWord #0 ; get MOD 10 + PushWord #0 + PushWord P + PushWord #10 + _UDivide + pla + plx + + cmp #0 ; exit if 0 + beq gosub26_2 + + sec ; get P / 10 + sbc #1 + asl + tax + lda xPERSO,x + sta ptrToDestPoint3+2 + lda yPERSO,x + sta ptrToDestPoint3 + + PushLong #paintParamPtr3 + _PaintPixels + +gosub26_2 + rts + +*--- + +xPERSO dw 132,70,40,42,68,130,66,84,66,86,106,106 +yPERSO dw 85,113,85,61,31,62,88,88,51,55,51,91 + +paintParamPtr3 + adrl ptrToSourceLocInfo3 + adrl ptrToDestLocInfo3 + adrl ptrToSourceRect3 + adrl ptrToDestPoint3 + dw $0000 ; mode copy + ds 4 + +ptrToSourceLocInfo3 + dw $0000 ; mode 320 + adrl $e12000 + dw 160 + dw 0,0,200,320 + +ptrToDestLocInfo3 + dw $0000 ; mode 320 + adrl $e12000 + dw 160 + dw 0,0,200,320 + +ptrToSourceRect3 + dw 112,136,122,141 + +ptrToDestPoint3 + dw 0,0 + +*----------------------- +* load_font +*----------------------- + +load_font + jsr font_it + bcc lf_ok + + pha + PushLong #fntSTR1 + PushLong #fntSTR2 + PushLong #errSTR3 + PushLong #errSTR2 + _TLTextMountVolume + pla + +lf_ok + rts + +*--- Really load the font + +font_it + PushWord #$0900 + PushWord #$0015 ; Helvetica.9 + PushWord #0 + _InstallFont + rts + +*----------------------- +* set_texte +*----------------------- + +set_texte + PushWord #0 + PushWord #$29 + _ReadBParam + pla + cmp #20 + bcc st_ok + rts + +* index +* TEXTES : +16 + +st_ok + jsr st_setit ; try IIgs language + bcc st_ok99 + + lda #0 ; if not, try EN US + jsr st_setit + bcc st_ok99 + + lda #2 ; it not, force FR - It always exists + jsr st_setit +st_ok99 + rts + +*--- + +st_setit ; set language code + sta saveLANGUAGE + asl + tax + lda tblLANG,x + sta pFICHES+16 + + lda #pFICHES ; check file exists + sta proOPEN+4 + + jsl GSOS + dw $2010 + adrl proOPEN + bcs st_setit99 + + lda proOPEN+2 + sta proCLOSE+2 + + jsl GSOS + dw $2014 + adrl proCLOSE + +st_setit99 + rts + +*--- + +tblLANG + asc 'us' ; 0 + asc 'uk' + asc 'fr' ; 2 + asc 'nl' + asc 'es' ; 4 + asc 'it' + asc 'de' ; 6 + asc 'se' + asc 'us' + asc 'ca' + asc 'nl' + asc 'he' + asc 'jp' + asc 'ar' + asc 'gr' + asc 'tr' + asc 'fi' + asc 'ta' + asc 'hi' + asc 'us' ; 19 + +*----------------------- +* initialisation +*----------------------- + +initialisation + stz fgTVON ; TV is off on entry + + lda #1 + sta P + + stz S ; pas de sens de couloir + + lda #129 + sta S2 + + ldx #NB_INDICATEURS + sep #$20 +]lp stz C1-1,x + dex + dex + bne ]lp + rep #$20 + rts + +*----------------------- +* load_fiche +*----------------------- + +load_fiche + lda #pFICHES + sta proOPEN+4 + + jsl GSOS + dw $2010 + adrl proOPEN + bcs lt_err2 + + lda proOPEN+2 + sta proREAD+2 + sta proCLOSE+2 + + lda ptrFICHES + sta proREAD+4 + lda ptrFICHES+2 + sta proREAD+6 + + lda proEOF + sta proREAD+8 + lda proEOF+2 + sta proREAD+10 + + jsl GSOS + dw $2012 + adrl proREAD + bcs lt_err + + jsl GSOS + dw $2014 + adrl proCLOSE + rts + +lt_err + jsl GSOS + dw $2014 + adrl proCLOSE + +lt_err2 + pha + PushLong #filSTR1 + PushLong #errSTR2 + PushLong #errSTR1 + PushLong #errSTR2 + _TLTextMountVolume + pla + brl meQUIT1 + +*----------------------- +* init_fiche +*----------------------- + +init_fiche + stz nbFICHES ; 0 texts on entry + + lda proEOF ; is file empty? + ora proEOF+2 + bne if1 + rts + +if1 + lda ptrFICHES + sta dpFROM + clc + adc proEOF + sta dpTO + lda ptrFICHES+2 + sta dpFROM+2 + adc proEOF+2 + sta dpTO+2 + +if2 + lda dpFROM+2 ; did we reach the end of the file? + cmp dpTO+2 + bcc if3 + lda dpFROM + cmp dpTO + bcc if3 + rts ; we are done! + +if3 + lda nbFICHES ; save the address of the string + asl + asl + tax + lda dpFROM + sta tblFICHES,x + lda dpFROM+2 + sta tblFICHES+2,x + + lda dpFROM + clc + adc #TAILLE_FICHE + sta dpFROM + lda dpFROM+2 + adc #0 + sta dpFROM+2 + + inc nbFICHES ; increment the number of strings + lda nbFICHES ; into our limit + cmp #NB_FICHES + bcc if2 + rts + +*----------------------- +* get_fiche(fiche%) +*----------------------- + +get_fiche + cmp #0 + bne get_fiche1 + rts + +get_fiche1 + cmp nbFICHES + bcc get_fiche2 + beq get_fiche2 + rts + +get_fiche2 + dec + asl + asl + tax + lda tblFICHES,x + sta dpFICHES + lda tblFICHES+2,x + sta dpFICHES+2 + + ldy #TAILLE_FICHE-1 + sep #$20 +]lp lda [dpFICHES],y + sta F,y + dey + bpl ]lp + rep #$20 + rts + +*----------------------- +* TEXT ROUTINES +*----------------------- + +*----------------------- +* add_char +*----------------------- +* 5,s char to add +* 3,s pointer to string +* 1,s RTS + +add_char + lda 3,s + sta dpTO + + sep #$30 ; 02 AB + lda (dpTO) ; cannot exceed 255 chars + cmp #$ff + bcs add_char1 + + inc ; 03 AB + sta (dpTO) ; 03 + tay + lda 5,s ; C + sta (dpTO),y ; 03 ABC + +add_char1 + rep #$30 + lda 1,s ; rcupre RTS + plx ; dpile les paramtres + plx + sta 1,s ; remet le RTS + rts + +*----------------------- +* copy_string +*----------------------- +* 7,s number of chars to copy +* 5,s pointer to source string +* 3,s pointer to destination string +* 1,s RTS + +copy_string + lda 5,s + sta dpFROM + lda 3,s + sta dpTO + + sep #$20 + ldy #0 +]lp lda (dpFROM),y ; recopie les caractres + sta (dpTO),y + iny + tya + cmp 7,s + bcc ]lp +* beq ]lp + + rep #$20 + lda 1,s ; rcupre RTS + plx ; dpile les paramtres + plx + plx + sta 1,s ; remet le RTS + rts + +*----------------------- +* charcmp +*----------------------- +* 5,s char to compare +* 3,s pointer to string +* 1,s RTS + +charcmp + lda 3,s + sta dpFROM + + ldx #FALSE ; default value, les chanes sont diffrentes + + sep #$20 + lda (dpFROM) + cmp 5,s ; compare strings + bne charcmp1 + + ldx #TRUE ; mme chane + +charcmp1 + rep #$20 + lda 1,s ; rcupre RTS + ply ; dpile les paramtres + ply + sta 1,s ; remet le RTS + txa ; return value + cmp #TRUE ; met les valeurs de comparaison + rts + +*----------------------- +* left +*----------------------- +* 7,s number of chars to copy +* 5,s pointer to source string +* 3,s pointer to destination string +* 1,s RTS + +left + lda 5,s + sta dpFROM + lda 3,s + sta dpTO + +* check added length + + sep #$30 ; check length + + ldy #0 +]lp lda (dpFROM),y ; recopie les caractres + sta (dpTO),y + iny + tya + cmp 7,s + bcc ]lp +* beq ]lp + + rep #$30 + lda 1,s ; rcupre RTS + plx ; dpile les paramtres + plx + plx + sta 1,s ; remet le RTS + rts + +*----------------------- +* val +*----------------------- +* 5,s string length +* 3,s pointer to source string +* 1,s RTS +* on return, A = unsigned value + +val + lda 3,s + sta dpFROM + + sep #$20 + ldy #0 + tyx +]lp lda (dpFROM),y ; recopie les caractres + cmp #' ' ; skip space char + beq val1 + sta val_temp,x ; save + inx +val1 iny + tya + cmp 5,s + bcc ]lp +* beq ]lp + + cpx #0 ; exit if len is still 0 + beq val2 + + rep #$20 + + PushWord #0 ; wordspace + PushLong #val_temp ; strPtr + phx ; strLength + pea $0000 ; signedFlag + _Dec2Int + plx ; intResult + +val2 + rep #$20 + lda 1,s ; rcupre RTS + ply ; dpile les paramtres + ply + sta 1,s ; remet le RTS + txa ; return value + rts + +val_temp ds 8 ; longueur de la chane temporaire + +*----------------------- +* instr +*----------------------- +* 7,s length of string to search +* 5,s pointer to character to find +* 3,s pointer to source string +* 1,s RTS + +instr + lda 3,s + sta dpFROM + + sep #$20 + + ldy #0 ; AB +]lp lda (dpFROM),y + iny + cmp 5,s + beq instr2 ; on a trouv le caractre + tya + cmp 7,s + bcc ]lp +* beq ]lp +instr1 + ldy #-1 ; on n'a pas trouv le caractre + +instr2 + rep #$20 + lda 1,s ; rcupre RTS + plx ; dpile les paramtres + plx + plx + sta 1,s ; remet le RTS + tya ; return value + rts + +*----------------------- +* strcmp +*----------------------- +* 7,s length to compare +* 5,s pointer to string 2 +* 3,s pointer to string 1 +* 1,s RTS + +strcmp + lda 3,s + sta dpFROM + lda 5,s + sta dpTO + + ldx #FALSE ; default value, les chanes sont diffrentes + + sep #$30 + + ldy #0 ; AB +]lp lda (dpFROM),y + cmp (dpTO),y + bne strcmp2 + iny + tya + cmp 7,s + bcc ]lp +* beq ]lp +strcmp1 + ldx #TRUE ; mme chane + +strcmp2 + rep #$30 + lda 1,s ; rcupre RTS + ply ; dpile les paramtres + ply + ply + sta 1,s ; remet le RTS + txa ; return value + cmp #TRUE ; met les valeurs de comparaison + rts + +*----------------------- +* data +*----------------------- + +theDATA = * + +*----------------------- +* Variables +*----------------------- + +*--- Variables du jeu + +debutVARIABLES = * + + asc "fgTVON" + +fgTVON ds 2 ; 0 if TV off, -1 otherwise + + asc "C,C0,H,L2,L3,N0,N1,N2,P,S,S2,T1,T2,V" + +C ds 2 ; nombre de messages +C0 ds 2 ; bouton de la television actif +H ds 2 +L2 ds 2 +L3 ds 2 +N0 ds 2 +N1 ds 2 +N2 ds 2 +P ds 2 ; fiche active +S ds 2 ; sens du couloir +S2 ds 2 ; 129 au dbut +T1 ds 2 +T2 ds 2 +V ds 2 + + asc "C1" + +C1 ds NB_INDICATEURS + + asc "F ET C2" + +F ds 1 ; fiche OK (non zero) ou KO (zero) +C2_1 ds 2 +C2_2 ds 25 +C2_3 ds 2 +C2_4 ds 2 +C2_5 ds 4 +C2_6 ds 40 +C2_7 ds 4 +C2_8 ds 40 +C2_9 ds 4 +C2_10 ds 40 +C2_11 ds 4 +C2_12 ds 40 +C2_13 ds 4 +C2_14 ds 40 + ds 3 ; garbage + + asc "B0,C3,C5,R0,R1" + +B0 ds 40 +C3 ds 40 +C5 ds 40 +R0 ds 1 ; length byte of R1 +R1 ds 40 + +finVARIABLES = * + +*--- Variables Apple IIgs + +nbFICHES ds 2 +tblFICHES ds 4*NB_FICHES + diff --git a/canalmeurtre/lisezmoi.txt b/canalmeurtre/lisezmoi.txt new file mode 100644 index 0000000..3c43baa --- /dev/null +++ b/canalmeurtre/lisezmoi.txt @@ -0,0 +1 @@ +CANAL MEURTRE de Frdric Copet et Jean Sol (c) Froggy Software Version Apple IIgs d'Antoine Vignau & Olivier Zardini (c) 2022, Brutal Deluxe Software Plus qu'un jeu informatique traditionnel, Canal Meurtre est avant tout une bande dessine interactive. Feuilletez-l votre rythme et tchez de rsoudre l'nigme qu'elle vous propose ! Le thme Accroch votre tl comme un nourrisson sa ttine, vous coulez de douillettes soires dans le calme de votre appartement. Pourtant, ce soir, l'incroyable vient de se produire: on a assassin votre journaliste prfr ! Vos talents d'enquteur surmontant votre flemmingite aige, vous dcidez de passer l'action. Mais point trop n'en faut, et pour ne pas fatiguer votre cur de tlspectateur, c'est de chez vous que vous mnerez vos investigations. Eteignez votre lampe de chevet, allumez votre rcepteur et pntrez dans le monde trs ferm d'une chane tlvisuelle. Tous les coups sont permis pour dcouvrir le, la ou les coupables. A vous d'utiliser au mieux: votre sagacit, la souris de votre Apple IIgs, vos intuitions et le hasard ! Comment jouer ? Double-cliquez sur l'icone Canal Meurtre pour lancer le jeu. Si vous avez install l'outil Midi Synth alors une musique de fond vous accompagnera. Pour dmarrer Allumez la tl (la lampe de chevet s'teint automatiquement pour mieux vous laisser suivre l'mission). Vous vous retrouvez alors dans la maison de la radio o le journaliste a t assassin. A vous de dcouvrir dans quelles circonstances. Pour chaque tableau, des choix vous sont proposs en dessous de la commode. Cliquez dans les boutons pour vous dplacer, pour valider une action ou la lecture d'un texte. Le jeu vous demandera parfois des renseignements ou des indices. Tapez les directement au clavier et cliquez pour les valider. Dplacements Certaines pices ne sont pas toujours accessibles selon les circonstances. Les studios peuvent tre en cours de tournage par exemple. Sauvegarder et reprendre A tout moment vous pouvez sauvegarder ou reprendre une partie en cours. Le jeu tiendra alors compte de ce que vous avez fait et dcouvert jusque l. Plan En cliquant sur le deuxieme bouton de la tlvision, vous pouvez consulter le plan de celle-ci. Une silhouette symbolise l'endroit o vous vous trouvez. Pub Le troisime bouton de la tlvision est...une page de publicit. C'est normal puisqu'il s'agit d'une tl prive. Panique Vous tournez en rond depuis des semaines sans trouver la solution et vous voudiez bien voir les derniers dessins. Pas de panique. Il vous faut l'ordonnance du Docteur Froggy. Ecrivez Brutal Deluxe depuis brutaldeluxe.fr, celui-ci vous retournera la solution complte. Ouf. Merci Docteur. Les touches - pomme-ouverte-O : charger une partie depuis la disquette - pomme-ouverte-Q : quitter le jeu - pomme-ouverte-R : dmarrer une nouvelle partie - pomme-ouverte-S : enregistrer une partie sur disquette - pomme-ouverte-Z : jouer/arrter la musique Les auteurs Frdric Copet vit dans une grande maison prs de Reims. Il partage ses occupations entre l'informatique, la tlmatique, le travail du cuir, le moto cross, la mcanique, la menuiserie, le jardinage, la cordonnerie et la forge. Frdric Copet est donc un extra-terrestre. Jean Sol vit dans une grande maison prs de Reims. Il partage ses occupations entre la bande dessine, l'informatique, les affiches, les couvertures de revues, les couvertures de livres, les couvertures de logiciels, les expositions, les couvertures de disques, les illustrations pour enfants, pour adultes, pour ceux qui font de la politique. Il s'occupe galement des Beatles, et de sa collection de modles de bouteilles de Whisky. Jean Sol est donc un extra-terrestre. La maison de Frdric Copet et celle de Jean Sol sont distantes d'une dizaine de kilomtres. Parfois l'un d'entre eux prend sa soucoupe volante pour rendre visite l'autre. Protection Ce jeu n'est pas protg, donc moins cher. Ne vendez pas vos copies, merci. Anecdote La version Mac date de 1986. La version franaise a t publie en 1987. Les auteurs avaient ralis les versions allemande et espagnole lesquelles n'ont jamais t publies. Nous en avons profit pour crer la version anglaise. La version Apple IIgs est ainsi disponible en allemand, anglais, espagnol et franais. Peux-tu traduire, s'il te plat ? Si vous tes perdu(e) entre les diffrentes langues et les pices : - Canal Meurtre / Channel Murder / Fernsehkrimi / Canal Misterio - Rception / Lobby / Empfang / Recepcin - Cantine / Canteen / Kantine / Cantina - Archives / Archive room / Archiv / Archivo - Costumes / Costume room / Kostme / Vestuario - Dcors / Scenery room / Bhnendekoration / Escenografa - Rdaction / Newsroom / Redaktion / Redaccin - Studio A / Studio A / Studio A / Estudio A - Studio B / Studio B / Studio B / Estudio B - Maquillage / Makeup room / Maske / Maquillaje - Rgie / Control room / Regie / Direccin - Montage / Editing room / Schnitt / Edicin - Speak-Room / Speak-Room / Tontechnik / Cabina de sonido Remerciements - Jean-Louis Le Breton qui a donn son accord pour la version Apple IIgs, - Mario Patino pour ses quelques traductions en allemand et espagnol. \ No newline at end of file diff --git a/canalmeurtre/midi.s b/canalmeurtre/midi.s new file mode 100644 index 0000000..19d3798 --- /dev/null +++ b/canalmeurtre/midi.s @@ -0,0 +1,569 @@ +* +* Midi routines +* +* (c) 2020, Brutal Deluxe Software +* Antoine Vignau & Olivier Zardini +* + +dpSEQ = $f8 + +seqOFFSET = $006 +seqTEMPO = $18A +seqTPB = $190 + +*-------------------------------------- + + mx %00 + +stopMIDI + lda fgMIDI + bne stopMIDI99 + + _KillAllNotes ; Stop MidiSynth + _MSShutDown + + PushWord #35 ; unload MidiSynth + _UnloadOneTool + + _SoundShutDown + +stopMIDI99 + rts + +*-------------------------------------- + +initMIDI + pha ; Check for AppleTalk + _GetIRQEnable + pla + and #$20 + beq initMIDI1 + + inc fgMIDI + rts + +initMIDI1 + lda myDP + clc + adc #$100 + pha + _SoundStartUp + + PushWord #35 ; Load MidiSynth + PushWord #0 + _LoadOneTool + bcc initMIDI2 + + inc fgMIDI + rts + +initMIDI2 + _MSStartUp ; Start MidiSynth + bcc musicMEMORY + + inc fgMIDI + rts + +*-------------------------------------- Now, get RAM + +musicMEMORY + PushLong #0 + PushLong #$10000 + PushWord myID + PushWord #%11000000_00011100 + PushLong #0 + _NewHandle + phd + tsc + tcd + lda [3] + sta ptrSEQ + ldy #2 + lda [3],y + sta ptrSEQ+2 + pld + pla + pla + bcc musicMEMORY1 + + inc fgMIDI ; cannot assign memory for MIDI sequences + rts + +musicMEMORY1 + PushLong #0 + PushLong #$10000 + PushWord myID + PushWord #%11000000_00011100 + PushLong #0 + _NewHandle + phd + tsc + tcd + lda [3] + sta ptrBNK + ldy #2 + lda [3],y + sta ptrBNK+2 + pld + pla + pla + bcc musicMEMORY2 + + inc fgMIDI ; cannot assign memory for MIDI sequences + rts + +musicMEMORY2 + PushLong #0 + PushLong #$10000 + PushWord myID + PushWord #%11000000_00011100 + PushLong #0 + _NewHandle + phd + tsc + tcd + lda [3] + sta ptrWAV + ldy #2 + lda [3],y + sta ptrWAV+2 + pld + pla + pla + bcc loadWAV + + inc fgMIDI ; cannot assign memory for MIDI sequences + rts + +*-------------------------------------- Load WAV + +loadWAV + lda #pWAV + sta midiOPEN+4 + + jsl GSOS + dw $2010 + adrl midiOPEN + sta midiERR + + lda midiOPEN+2 + sta midiSETMARK+2 + sta midiREAD+2 + sta midiCLOSE+2 + + jsl GSOS + dw $2016 + adrl midiSETMARK + + lda ptrWAV + sta midiREAD+4 + lda ptrWAV+2 + sta midiREAD+6 + + stz midiREAD+8 + lda #1 + sta midiREAD+10 + + jsl GSOS + dw $2012 + adrl midiREAD + sta midiERR + + jsl GSOS + dw $2014 + adrl midiCLOSE + + lda midiERR ; check err + beq loadBNK + + inc fgMIDI ; exit + rts + +*-------------------------------------- Load BNK + +loadBNK + lda #pBNK ; load the MIDI bank + ldx ptrBNK+2 + ldy ptrBNK + jsr loadGSOS + + lda midiERR ; check err + beq loadSEQUENCE + + inc fgMIDI + rts + +*-------------------------------------- Load Sequence + +loadSEQUENCE + lda #pSEQ + ldx ptrSEQ+2 + ldy ptrSEQ + jsr loadGSOS + + lda midiERR ; check err + beq initMUSIC + + inc fgMIDI + rts + +*-------------------------------------- Play sequence + +initMUSIC + lda ptrSEQ + sta playMUSIC5+1 ; save pointers + sta playMUSIC55+1 + lda ptrSEQ+2 + sta playMUSIC6+1 + sta playMUSIC66+1 + + _KillAllNotes + + lda myDP + tcd + +playMUSIC5 + lda #$bdbd ; patched + sta dpSEQ +playMUSIC6 + lda #$bdbd ; patched + sta dpSEQ+2 + + ldy #seqOFFSET + lda [dpSEQ],y + clc +playMUSIC55 + adc #$bdbd ; patched + sta seqPlayRec + lda #0 +playMUSIC66 + adc #$bdbd ; patched + sta seqPlayRec+2 + + ldy #seqTEMPO + lda [dpSEQ],y + asl + sec + sbc #10 + pha + _SetTempo + + ldy #seqTPB + lda [dpSEQ],y + pha + _SetBeat + +*--- Toutes les pistes sont actives + + lda ptrBNK + clc + adc #$400 + sta ptrINST + lda ptrBNK+2 + adc #0 + sta ptrINST+2 + + stz myINDEX + +]lp PushWord myINDEX + PushWord #$8000 + _SetPlayTrack + + PushWord myINDEX + PushWord #-1 + _TrackToChannel + + PushWord myINDEX + PushWord #2 + _SetTrackOut + + PushLong ptrINST + PushWord myINDEX + _SetInstrument + + lda ptrINST + clc + adc #$120 + sta ptrINST + lda ptrINST+2 + adc #0 + sta ptrINST+2 + + inc myINDEX + lda myINDEX + cmp #16 + bne ]lp + +*--- + + sei + + PushLong ptrWAV + PushWord #0 ; docStart + PushWord #0 ; byteCount (=64ko) + _WriteRamBlock + + PushLong #callBackRec + _SetCallBack + + PushWord #0 + PushWord #0 + PushLong seqClock + PushLong seqPlayRec + _Locate + PullLong seqPlayRec + + cli ; end of the long init! + rts + +*-------------------------------------- + +doMUSIK + lda fgMIDI ; can we play? + bne nozik99 + + lda fgMIDIPLAY + eor #1 + sta fgMIDIPLAY + beq doSOUNDON + bne doSOUNDOFF + +nozik99 + rts + +fgMIDIPLAY ds 2 + +*-------------------------------------- + +doSOUNDON + lda fgMIDI ; can we play? + bne playMUSIC99 + + lda #$0100 ; no, let's start playing! + sta seqPlay + PushLong #seqPlayRec + _SeqPlayer + stz fgLOOP + +playMUSIC99 + rts + +*-------------------------------------- + +doSOUNDOFF + lda fgMIDI + bne stopMUSIC99 + + stz seqPlay + PushLong #seqPlayRec + _SeqPlayer + _KillAllNotes + +stopMUSIC99 + rts + +*-------------------------------------- Suspend music + +suspendMUSIC + lda fgMIDI + ora fgMIDIPLAY + bne suspendMUSIC9 + + _MSSuspend + +suspendMUSIC9 + rts + +*-------------------------------------- Resume music + +resumeMUSIC + lda fgMIDI + ora fgMIDIPLAY + bne resumeMUSIC9 + + _MSResume + +resumeMUSIC9 + rts + +*-------------------------------------- + +checkREPLAY + lda fgMIDI + bne checkREPLAY99 + + lda fgLOOP + beq checkREPLAY99 + jsr doSOUNDON + +checkREPLAY99 + rts + +*-------------------------------------- + +replayMUSIC + lda #-1 + stal fgLOOP + rtl + +fgLOOP dw -1 + +*-------------------------------------- Select random sequence + +randomMIDI + jsr Random ; get random 0-7 + and #7 + bcc randomMIDI + jsr midi_setit ; check file exists + bcc mr_ok ; it is ok, it is the sequence + + lda #0 ; force sequence 1 + jsr midi_setit + +mr_ok rts + +*-------------------------------------- Check a sequence + +midi_setit + clc + adc #'1' + sep #$20 + sta pSEQ+26 + rep #$20 + + lda #pSEQ ; check file exists + sta midiOPEN+4 + + jsl GSOS + dw $2010 + adrl midiOPEN + bcs midi_setit99 + + lda midiOPEN+2 + sta midiCLOSE+2 + + jsl GSOS + dw $2014 + adrl midiCLOSE + +midi_setit99 + rts + +*-------------------------------------- Load a file + +loadGSOS + sta midiOPEN+4 + sty midiREAD+4 + stx midiREAD+6 + stz midiERR + + jsl GSOS + dw $2010 + adrl midiOPEN + bcs loadGSOSERR + + lda midiOPEN+2 + sta midiREAD+2 + sta midiCLOSE+2 + + lda midiEOF + sta midiREAD+8 + lda midiEOF+2 + sta midiREAD+10 + + jsl GSOS + dw $2012 + adrl midiREAD + bcs loadGSOSERR + +loadGSOS2 + jsl GSOS + dw $2014 + adrl midiCLOSE + rts + +loadGSOSERR + jsr loadGSOS2 + inc fgMIDI + rts + +*-------------------------------------- DATA + +myINDEX ds 2 + +*--- GS/OS + +midiERR ds 2 + +midiOPEN dw 12 + ds 2 + adrl pSEQ + ds 2 + ds 2 + ds 2 + ds 2 + ds 4 + ds 2 + ds 8 + ds 8 + ds 4 +midiEOF ds 4 + +midiREAD dw 4 + ds 2 + ds 4 + ds 4 + ds 4 + +midiCLOSE dw 1 + ds 2 + +midiSETMARK dw 3 + ds 2 + ds 2 + adrl $900 ; +$900 pour WAV + +*--- GS/OS Strings (+26 pour le random de la musique) + +pSEQ strl '1/data/musiques/sequence1' +pWAV strl '1/data/musiques/piano.wav' +pBNK strl '1/data/musiques/piano.bnk' + +*--- Memory + +ptrSEQ ds 4 +ptrWAV ds 4 +ptrBNK ds 4 + +*--- Flags + +fgMIDI ds 2 ; can play MIDI if 0 + +*--- Instruments + +ptrINST ds 4 + +*--- MidiSynth + +seqPlayRec + ds 4 + ds 4 + ds 4 + ds 4 +seqPlay ds 2 ; Play +seqClock ds 4 + +callBackRec adrl replayMUSIC ; When sequence ends ! + ds 4 + ds 4 + ds 4 + ds 4 + ds 4 + ds 4 + ds 4 + ds 4 + ds 4 + ds 4 + ds 4 + ds 4 + ds 4 diff --git a/canalmeurtre/readme.txt b/canalmeurtre/readme.txt new file mode 100644 index 0000000..263abe3 --- /dev/null +++ b/canalmeurtre/readme.txt @@ -0,0 +1 @@ +MURDER CHANNEL by Frdric Copet and Jean Sol (c) Froggy Software Apple IIgs Version by Antoine Vignau & Olivier Zardini (c) 2022, Brutal Deluxe Software More than a traditional computer game, Canal Meurtre is above all an interactive comic strip. Leaf through it at your own pace and try to solve the enigma it offers you! The theme Attached to your TV like an infant to its pacifier, you enjoy cozy evenings in the calm of your apartment. However, tonight, the incredible has just happened: your favorite journalist has been murdered! Your investigative skills overcoming your acute flemmingitis, you decide to take action. But not too much is needed, and so as not to tire your viewer's heart, it is from your home that you will conduct your investigations. Switch off your bedside lamp, switch on your receiver and enter the very closed world of a television channel. All shots are allowed to discover the culprit(s). It's up to you to make the best use of: your sagacity, your Apple IIgs mouse, your intuitions and chance! How to play ? Double-click on the Murder Channel icon to launch the game. If you have installed the Midi Synth tool then background music will accompany you. To start Turn on the TV (the bedside lamp turns off automatically to better let you follow the show). You then find yourself in the radio house where the journalist was murdered. It's up to you to find out under what circumstances. For each table, choices are offered below the chest of drawers. Click in the buttons to move, to validate an action or the reading of a text. The game will sometimes ask you for information or clues. Type them directly on the keyboard and click to validate them. Displacements Some parts are not always accessible depending on the circumstances. The studios may be filming for example. Save and resume At any time you can save or resume a game in progress. The game will then take into account what you have done and discovered so far. Map By clicking on the second button of the television, you can consult the map of this one. A silhouette symbolizes where you are. Ad The third button on the TV is an advertisement page. This is normal since it is a private TV. Panic You've been going around in circles for weeks without finding the solution and you wanted to see the latest drawings. Do not panic. You need Doctor Froggy's prescription. Write to Brutal Deluxe from brutaldeluxe.fr, it will return the complete solution to you. Phew. Thank you Doctor. The keys - open-apple-O: load a game from the diskette - open-apple-Q: quit the game - open-apple-R: start a new game - open-apple-S: save a game on diskette - open-apple-Z: play/stop the music The authors Frdric Copet lives in a large house near Reims. He shares his occupations between computers, telematics, leather work, motocross, mechanics, carpentry, gardening, shoemaking and blacksmithing. Frdric Copet is therefore an extra-terrestrial. Jean Sol lives in a large house near Reims. He shares his occupations between comics, computers, posters, magazine covers, book covers, software covers, exhibitions, record covers, illustrations for children, for adults, for those who do politics. He also takes care of the Beatles, and his collection of Whiskey bottle models. Jean Sol is therefore an extra-terrestrial. The house of Frdric Copet and that of Jean Sol are about ten kilometers apart. Sometimes one of them takes his flying saucer to visit the other. Protection This game is not protected, therefore cheaper. Do not sell your copies, thank you. Anecdote The Mac version dates from 1986. The French version was published in 1987. The authors had produced the German and Spanish versions which were never published. We took the opportunity to create the English version. The Apple IIgs version is thus available in German, English, Spanish, and French. Can you translate, please? In case you're lost with the different languages and the associated rooms: - Canal Meurtre / Channel Murder / Fernsehkrimi / Canal Misterio - Rception / Lobby / Empfang / Recepcin - Cantine / Canteen / Kantine / Cantina - Archives / Archive room / Archiv / Archivo - Costumes / Costume room / Kostme / Vestuario - Dcors / Scenery room / Bhnendekoration / Escenografa - Rdaction / Newsroom / Redaktion / Redaccin - Studio A / Studio A / Studio A / Estudio A - Studio B / Studio B / Studio B / Estudio B - Maquillage / Makeup room / Maske / Maquillaje - Rgie / Control room / Regie / Direccin - Montage / Editing room / Schnitt / Edicin - Speak-Room / Speak-Room / Tontechnik / Cabina de sonido Thanks - Jean-Louis Le Breton who gave his agreement for the Apple IIgs version, - Mario Patino for his few translations into German and Spanish. \ No newline at end of file