antoine-source/labellezohra/sources/game.s

1481 lines
18 KiB
ArmAsm
Raw Normal View History

2023-08-28 16:01:04 +00:00
*
* La Belle Zohra
*
* (c) 1992, Fran<EFBFBD>ois Coulon
* (c) 2023, Antoine Vignau & Olivier Zardini
*
mx %00
*-----------------------
* macros
*-----------------------
@carre mac
PushLong ]1
PushWord ]2
PushWord ]3
PushWord ]4
jsr carre
eom
2023-08-30 14:42:20 +00:00
@t mac
lda ]1
ldy ]2
jsr t
eom
@cree_fenetre mac
lda ]1
ldx ]2
jsr cree_fenetre
eom
*-----------------------
* DATA_ERROR - OK
*-----------------------
* data_error
data_error pha
PushLong #pgmSTR1
PushLong #pgmSTR2
PushLong #errSTR3
PushLong #errSTR2
_TLTextMountVolume
pla
sec
rts
*-----------------------
* LOAD_TEXTE - OK
*-----------------------
* load_texte
load_texte
cmp #nombre_objets+1
bcc lt_1
rts
lt_1 cmp #0
bne lt_2
brl data_error
lt_2 sep #$20
ora #'0'
sta pTXT+22
rep #$20
*---
lda #pTXT
sta proOPEN+4 ; filename
jsl GSOS
dw $2010
adrl proOPEN
bcs lt_err2
lda proOPEN+2
sta proREAD+2
sta proCLOSE+2
ldy proEOF
sty proREAD+8
ldx proEOF+2
stx proREAD+10
pha
pha
phx
phy
PushWord myID
PushWord #%11000000_00001100
PushLong #0
_NewHandle
phd
tsc
tcd
lda index
dec
asl
asl
tax
lda [3]
sta ptrTXT1,x
sta proREAD+4
ldy #2
lda [3],y
sta ptrTXT1+2,x
sta proREAD+6
pld
pla
pla
bcs lt_err1
jsl GSOS
dw $2012
adrl proREAD
lt_err1 jsl GSOS
dw $2014
adrl proCLOSE
clc
lt_err2 rts
*-----------------------
* LOAD_REFERENCE - OK
*-----------------------
* load_reference
load_reference
cmp #nombre_objets+1
bcc lr_1
rts
lr_1 cmp #0
bne lr_2
brl data_error
lr_2 sep #$20
ora #'0'
sta pREF+22
rep #$20
*---
lda #pREF
sta proOPEN+4 ; filename
jsl GSOS
dw $2010
adrl proOPEN
bcs lr_err2
lda proOPEN+2
sta proREAD+2
sta proCLOSE+2
ldy proEOF
sty proREAD+8
ldx proEOF+2
stx proREAD+10
pha
pha
phx
phy
PushWord myID
PushWord #%11000000_00001100
PushLong #0
_NewHandle
phd
tsc
tcd
lda index
dec
asl
asl
tax
lda [3]
sta ptrREF1,x
sta proREAD+4
ldy #2
lda [3],y
sta ptrREF1+2,x
sta proREAD+6
pld
pla
pla
bcs lr_err1
jsl GSOS
dw $2012
adrl proREAD
lr_err1 jsl GSOS
dw $2014
adrl proCLOSE
clc
lr_err2 rts
2023-08-30 07:02:33 +00:00
*-----------------------
* GESTION DES ICONES
*-----------------------
test_icone
lda #0 ; from 1
]lp pha
asl
asl
asl
tax
lda taskWHERE+2 ; compare le X
2023-08-30 14:42:20 +00:00
cmp peche_x,x
2023-08-30 07:02:33 +00:00
bcc icone_ko
2023-08-30 14:42:20 +00:00
lda peche_xx,x
2023-08-30 07:02:33 +00:00
cmp taskWHERE+2
bcc icone_ko
lda taskWHERE ; et le Y
2023-08-30 14:42:20 +00:00
cmp peche_y,x
2023-08-30 07:02:33 +00:00
bcc icone_ko
2023-08-30 14:42:20 +00:00
lda peche_yy,x
2023-08-30 07:02:33 +00:00
cmp taskWHERE
bcc icone_ko
pla ; on a notre ic<69>ne
inc
* sta instruction2
rts
icone_ko
pla
inc
cmp #nombre_objets-1 ; et non plus nombre_icones
bcc ]lp
rts
*---
efface_icone ; X is object
cpx #0
beq ei1
jsr set_icone
_HideCursor
PushLong #iconParamPtr
_PaintPixels
_ShowCursor
ei1 rts
*---
affiche_icone ; X is object
cpx #0
beq ai1
jsr set_icone
_HideCursor
PushLong #fondParamPtr
_PaintPixels
_ShowCursor
ai1 rts
*---
set_icone txa
dec
asl
asl
asl ; because we are 16-bit
tax
2023-08-30 14:42:20 +00:00
lda peche_y,x
2023-08-30 07:02:33 +00:00
sta iconToSourceRect
sta iconToDestPoint
2023-08-30 14:42:20 +00:00
lda peche_x,x
2023-08-30 07:02:33 +00:00
sta iconToSourceRect+2
sta iconToDestPoint+2
2023-08-30 14:42:20 +00:00
lda peche_yy,x
2023-08-30 07:02:33 +00:00
sta iconToSourceRect+4
2023-08-30 14:42:20 +00:00
lda peche_xx,x
2023-08-30 07:02:33 +00:00
sta iconToSourceRect+6
rts
*---
fondParamPtr
adrl fondToSourceLocInfo
adrl iconToDestLocInfo
adrl iconToSourceRect
adrl iconToDestPoint
dw $0000 ; mode copy
ds 4
iconParamPtr
adrl iconToSourceLocInfo
adrl iconToDestLocInfo
adrl iconToSourceRect
adrl iconToDestPoint
dw $0000 ; mode copy
ds 4
fondToSourceLocInfo
dw mode_320 ; mode 320
ds 4 ; ptrFOND - $0000 on entry, high set after _NewHandle
dw 160
dw 0,0,199,319
iconToSourceLocInfo
dw mode_320 ; mode 320
adrl $8000 ; ptrICON - $8000 on entry, high set after _NewHandle
dw 160
dw 0,0,199,319
iconToDestLocInfo
dw mode_320 ; mode 320
adrl ptrE12000
dw 160
dw 0,0,199,319
iconToSourceRect
dw 3,0,109,272
iconToDestPoint
dw 3,0
2023-08-28 16:01:04 +00:00
*-----------------------
* set_language
*-----------------------
set_language
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 sta saveLANGUAGE
asl
tax
lda tblLANG,x
sta pREF+16
2023-08-30 14:42:20 +00:00
sta pTXT+16
2023-08-28 16:01:04 +00:00
lda #pREF ; 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
*-----------------------
* XX - OK
*-----------------------
xx
rts
*-----------------------
* MAIN - OK
*-----------------------
main
rts
*-----------------------
* VIGIL - OK
*-----------------------
* vigil(max_x%,max_y%,max_xx%,max_yy%,sauvegarde!)
vigil
rts
*-----------------------
* TEST_FIN - OK
*-----------------------
teste_fin lda paragraphes_lus
sec
sbc pointeur_paragraphes
cmp #1
bne tf_99
jmp the_end
tf_99 rts
*-----------------------
*
*-----------------------
demande_objet
rts
*-----------------------
*
*-----------------------
demande_peche
rts
*-----------------------
*
*-----------------------
recherche_references
rts
*-----------------------
*
*-----------------------
affiche_image
rts
*-----------------------
2023-08-30 14:42:20 +00:00
* SAUVEGARDE - OK
2023-08-28 16:01:04 +00:00
*-----------------------
2023-08-31 20:12:41 +00:00
* sauvegarde -> doSAVE
2023-08-28 16:01:04 +00:00
sauvegarde
rts
*-----------------------
2023-08-30 14:42:20 +00:00
* CHARGEMENT - OK
2023-08-28 16:01:04 +00:00
*-----------------------
2023-08-31 20:12:41 +00:00
* chargement -> doLOAD
2023-08-28 16:01:04 +00:00
chargement
rts
*-----------------------
2023-08-30 14:42:20 +00:00
* THE_END - OK
2023-08-28 16:01:04 +00:00
*-----------------------
2023-08-30 14:42:20 +00:00
* the_end
2023-08-28 16:01:04 +00:00
the_end
2023-08-30 14:42:20 +00:00
@cree_fenetre #9;pointeur_paragraphes
jsr pre_scrolling
PushWord #0
_ClearScreen
lda #TRUE
sta fgTHEEND
2023-08-28 16:01:04 +00:00
rts
*-----------------------
2023-08-30 14:42:20 +00:00
* PRE_SCROLLING
2023-08-28 16:01:04 +00:00
*-----------------------
2023-08-30 14:42:20 +00:00
* pre_scrolling
2023-08-28 16:01:04 +00:00
pre_scrolling
2023-08-30 14:42:20 +00:00
sep #$20
ldx paragraphe
lda #TRUE
sta paragraphe_lu,x
rep #$20
inc paragraphes_lus
* LOGO
2023-08-28 16:01:04 +00:00
rts
*-----------------------
*
*-----------------------
scrolling
rts
*-----------------------
*
*-----------------------
verif
rts
*-----------------------
2023-08-30 14:42:20 +00:00
* INIT - OK
2023-08-28 16:01:04 +00:00
*-----------------------
2023-08-30 14:42:20 +00:00
* init
2023-08-28 16:01:04 +00:00
2023-08-30 14:42:20 +00:00
init PushWord #0
_ClearScreen
jsr init_resolution
jsr mouse_off
jmp init_routines
2023-08-28 16:01:04 +00:00
*-----------------------
2023-08-30 14:42:20 +00:00
* INIT2 - OK
2023-08-28 16:01:04 +00:00
*-----------------------
2023-08-30 14:42:20 +00:00
init2 jsr init_objets
jsr init_peches
jsr init_icones
jsr init_indicateurs
jsr init_fenetres
jsr init_souris
jsr init_texte
jsr chargement
jmp mouse_on
2023-08-28 16:01:04 +00:00
*-----------------------
2023-08-30 14:42:20 +00:00
* INIT_RESOLUTION - OK
2023-08-28 16:01:04 +00:00
*-----------------------
init_resolution
rts
*-----------------------
2023-08-30 14:42:20 +00:00
* INIT_INDICATEURS - OK
2023-08-28 16:01:04 +00:00
*-----------------------
2023-08-30 14:42:20 +00:00
* init_indicateurs
2023-08-28 16:01:04 +00:00
init_indicateurs
2023-08-30 14:42:20 +00:00
sep #$20
ldx #0
]lp stz indicateurTEXT,x
stz indicateur,x
inx
cpx #nombre_indicateurs
bcc ]lp
2023-08-31 20:12:41 +00:00
stz pointeur_indicateurs
2023-08-30 14:42:20 +00:00
ldx #0
]lp stz paragraphe_lu,x
stz indicateur_paragraphes,x
stz indicateur_paragraphes_prealables,x
inx
cpx #nombre_paragraphes
bcc ]lp
ldx #0
lda #TRUE
sta indicateur,x
rep #$20
2023-08-28 16:01:04 +00:00
rts
*-----------------------
2023-08-30 14:42:20 +00:00
* INIT_OBJETS - OK
2023-08-28 16:01:04 +00:00
*-----------------------
2023-08-30 14:42:20 +00:00
* init_objets
2023-08-28 16:01:04 +00:00
init_objets
2023-08-30 14:42:20 +00:00
stz ancien_objet
2023-08-28 16:01:04 +00:00
rts
*-----------------------
2023-08-30 14:42:20 +00:00
* INIT_PECHES - OK
2023-08-28 16:01:04 +00:00
*-----------------------
2023-08-30 14:42:20 +00:00
* init_peches
2023-08-28 16:01:04 +00:00
init_peches
rts
*-----------------------
2023-08-30 14:42:20 +00:00
* INIT_ICONES - OK
2023-08-28 16:01:04 +00:00
*-----------------------
2023-08-30 14:42:20 +00:00
* init_icones
2023-08-28 16:01:04 +00:00
init_icones
2023-08-30 14:42:20 +00:00
PushWord #0
_ClearScreen
@loadfile #pFOND;ptrFOND
@loadfile #pICONES;ptrICONES
2023-08-28 16:01:04 +00:00
rts
*-----------------------
2023-08-30 14:42:20 +00:00
* INIT_ROUTINES - OK
2023-08-28 16:01:04 +00:00
*-----------------------
2023-08-30 14:42:20 +00:00
* init_routines
2023-08-28 16:01:04 +00:00
init_routines
rts
*-----------------------
2023-08-30 14:42:20 +00:00
* INIT_FENETRES - OK
2023-08-28 16:01:04 +00:00
*-----------------------
2023-08-30 14:42:20 +00:00
* init_fenetres
2023-08-28 16:01:04 +00:00
init_fenetres
rts
*-----------------------
2023-08-30 14:42:20 +00:00
* INIT_SOURIS - OK
2023-08-28 16:01:04 +00:00
*-----------------------
2023-08-30 14:42:20 +00:00
* init_souris
2023-08-28 16:01:04 +00:00
init_souris
2023-08-30 14:42:20 +00:00
PushLong #monCURSEUR
_SetCursor
2023-08-28 16:01:04 +00:00
rts
*-----------------------
2023-08-30 14:42:20 +00:00
* DATAS_INIT - OK
2023-08-28 16:01:04 +00:00
*-----------------------
2023-08-30 14:42:20 +00:00
* datas_init
2023-08-28 16:01:04 +00:00
datas_init
rts
*-----------------------
2023-08-30 14:42:20 +00:00
* INIT_TEXTE - OK
2023-08-28 16:01:04 +00:00
*-----------------------
2023-08-30 14:42:20 +00:00
* init_texte
2023-08-28 16:01:04 +00:00
init_texte
2023-08-30 14:42:20 +00:00
lda #1
]lp sta index
lda index ; fait patienter
jsr presentation
lda index ; charge le texte
jsr load_texte
lda index ; charge la r<>f<EFBFBD>rence
jsr load_reference
lda #4
jsr nowWAIT
lda index
inc
cmp #nombre_objets+1
bcc ]lp
2023-08-28 16:01:04 +00:00
rts
*-----------------------
2023-08-30 14:42:20 +00:00
* INIT_INDICATEURS_TEXTE
2023-08-28 16:01:04 +00:00
*-----------------------
2023-08-30 14:42:20 +00:00
* init_indicateurs_texte
2023-08-28 16:01:04 +00:00
init_indicateurs_texte
2023-08-30 14:42:20 +00:00
sep #$20
ldx #0
]lp stz paragraphe,x
inx
cpx #nombre_paragraphes
bcc ]lp
rep #$20
2023-08-31 20:12:41 +00:00
* paragraphe%(1)=0
2023-08-30 14:42:20 +00:00
stz pointeur_paragraphes
stz paragraphes_lus
* LOGO
2023-08-28 16:01:04 +00:00
rts
*-----------------------
*
*-----------------------
lookindex
rts
*-----------------------
* PRESENTATION - OK
*-----------------------
* presentation
* A: num<EFBFBD>ro du texte
presentation
2023-08-30 14:42:20 +00:00
cmp #nombre_objets+1
2023-08-28 16:01:04 +00:00
bcc pr_1
rts
pr_1 cmp #0
beq pr_2
pha
PushWord #0
_ClearScreen
pla
dec
asl
tax
jsr (tbl_pres,x)
pr_2 rts
*---
tbl_pres da pr_case_1
da pr_case_2
da pr_case_3
da pr_case_4
da pr_case_5
da pr_case_6
da pr_case_7
da pr_case_8
*---
2023-08-30 14:42:20 +00:00
pr_case_1 @carre #prSTR11;#100;#80;#$0771
2023-08-28 16:01:04 +00:00
@carre #prSTR12;#100;#120;#$0774
2023-08-30 14:42:20 +00:00
PushWord #15
_SetForeColor
PushWord #0
_SetBackColor
@t #prSTR13;#21
@t #prSTR14;#22
@t #prSTR15;#23
2023-08-28 16:01:04 +00:00
rts
2023-08-30 14:42:20 +00:00
pr_case_2 @carre #prSTR21;#25;#20;#$0437
2023-08-28 16:01:04 +00:00
rts
2023-08-30 14:42:20 +00:00
pr_case_3 @carre #prSTR31;#25;#180;#$0275
2023-08-28 16:01:04 +00:00
rts
2023-08-30 14:42:20 +00:00
pr_case_4 @carre #prSTR41;#100;#0;#$0743
2023-08-28 16:01:04 +00:00
rts
2023-08-30 14:42:20 +00:00
pr_case_5 @carre #prSTR51;#150;#20;#$0743
2023-08-28 16:01:04 +00:00
@carre #prSTR52;#50;#100;#$0743
@carre #prSTR53;#70;#180;#$0177
rts
2023-08-30 14:42:20 +00:00
pr_case_6 @carre #prSTR61;#0;#100;#$0607
2023-08-28 16:01:04 +00:00
@carre #prSTR62;#20;#150;#$0607
rts
2023-08-30 14:42:20 +00:00
pr_case_7 @carre #prSTR71;#0;#99;#$0073
PushWord #15
_SetForeColor
PushWord #0
_SetBackColor
@t #prSTR72;#20
@t #prSTR73;#21
@t #prSTR74;#22
@t #prSTR75;#23
2023-08-28 16:01:04 +00:00
rts
2023-08-30 14:42:20 +00:00
pr_case_8 @carre #prSTR81;#100;#180;#$0555
2023-08-28 16:01:04 +00:00
rts
*---
prSTR11 str 'la belle zohra'
prSTR12 str '(morceaux de bravoure)'
prSTR13 str 'fran'8d'ois coulon'
2023-08-30 14:42:20 +00:00
prSTR14 str 'les logiciels d'27'en face 1992'
prSTR15 str 'reproduction interdite'
2023-08-28 16:01:04 +00:00
prSTR21 str 'graphismes faustino ribeiro'
prSTR31 str 'programmation pascal piat'
prSTR41 str 'musique erik ecqier'
prSTR51 str 'un grand merci '88':'
prSTR52 str 'emmanuel talmy'
prSTR53 str 'sans qui ce logiciel... etc.'
2023-08-30 14:42:20 +00:00
prSTR61 str 'miss zohra c'8e'lestibus est habill'8e'e...'
2023-08-28 16:01:04 +00:00
prSTR62 str '...par aristide aristibus'
prSTR71 str 8e'crit et r'8e'alis'8e' par fran'8d'ois coulon'
2023-08-30 14:42:20 +00:00
prSTR72 str 'Version Apple IIgs'
prSTR73 str 'par'
prSTR74 str 'Brutal Deluxe Software'
prSTR75 str 'Antoine Vignau & Olivier Zardini'
2023-08-28 16:01:04 +00:00
prSTR81 str 88' la famille paspire...'
*-----------------------
* CARRE
*-----------------------
* carre(texte$,x%,y%,couleur$)
* 3,s word : RGB color
* 5,s word : y
* 7,s word : x
* 9,s long : @text
* couleur$ est pour le carr<EFBFBD>
* le texte est toujours en jaune
2023-08-30 14:42:20 +00:00
carre lda 5,s
2023-08-28 16:01:04 +00:00
sta carreRECT
clc
adc #12
sta carreRECT+4
lda 7,s
sta carreRECT+2
clc
adc #12
sta carreRECT+6
lda 9,s
sta dpFROM
lda 11,s
sta dpFROM+2
2023-08-30 14:42:20 +00:00
*--- la couleur du GS
lda 3,s ; R
and #$0f00
asl
sta carreRGB
lda 3,s ; G
and #$00f0
asl
ora carreRGB
sta carreRGB
lda 3,s ; B
and #$000f
asl
ora carreRGB
sta carreRGB
*--- draw square
PushWord #0 ; on met du RGB
PushWord index
PushWord carreRGB
_SetColorEntry
ldx index
lda carreRECT ; la couleur si > 100
cmp #100+1
bcs carre_1
ldx #8 ; le rose sinon
carre_1 phx
_SetSolidPenPat
lda carreRECT+2
pha
lda carreRECT
pha
_MoveTo
PushLong #carreRECT
_PaintRect
*--- print text in bold typeface
pha
_GetTextFace
pha
_GetForeColor
pha
_GetBackColor
PushWord #%00000000_00000001 ; bold
_SetTextFace
PushWord #15
_SetForeColor
PushWord #0
_SetBackColor
lda carreRECT+2
clc
adc #15
pha
lda carreRECT
clc
adc #8
pha
_MoveTo
PushLong dpFROM
_DrawString
2023-08-28 16:01:04 +00:00
2023-08-30 14:42:20 +00:00
_SetBackColor
_SetForeColor
_SetTextFace ; restore
2023-08-28 16:01:04 +00:00
carreEXIT lda 1,s
plx
plx
plx
plx
plx
sta 1,s
rts
*---
2023-08-30 14:42:20 +00:00
carreRGB ds 2 ; couleur du carre (4 bits)
2023-08-28 16:01:04 +00:00
carreRECT ds 2 ; y0
ds 2 ; x0
ds 2 ; y0+12
ds 2 ; y0+12
2023-08-30 14:42:20 +00:00
2023-08-28 16:01:04 +00:00
*-----------------------
* RAMDISK - OK
*-----------------------
ramdisk
rts
*-----------------------
*
*-----------------------
shoot_text
rts
*-----------------------
*
*-----------------------
shoot_ligne
rts
*-----------------------
2023-08-30 14:42:20 +00:00
* CREE_FENETRE
2023-08-28 16:01:04 +00:00
*-----------------------
* cree_fenetre(objet%,paragraphe%)
2023-08-30 14:42:20 +00:00
* A : objet
* X : paragraphe
2023-08-28 16:01:04 +00:00
cree_fenetre
rts
*-----------------------
*
*-----------------------
* display_text(ligne%,niveau%)
display_text
rts
*-----------------------
2023-08-30 14:42:20 +00:00
* ICE_LOAD - OK
2023-08-28 16:01:04 +00:00
*-----------------------
* ice_load(fichier$)
ice_load
rts
*-----------------------
2023-08-30 14:42:20 +00:00
* ICE_DISP - OK
2023-08-28 16:01:04 +00:00
*-----------------------
* ice_disp(adresse_image%)
ice_disp
rts
*-----------------------
2023-08-30 14:42:20 +00:00
* PALETTE - OK
2023-08-28 16:01:04 +00:00
*-----------------------
* palette(palette$)
palette
rts
*-----------------------
*
*-----------------------
hide_screen
rts
*-----------------------
*
*-----------------------
show_screen
rts
*-----------------------
*
*-----------------------
hide_screen2
rts
*-----------------------
*
*-----------------------
show_screen2
rts
*-----------------------
2023-08-30 14:42:20 +00:00
* MOUSE_ON - OK
2023-08-28 16:01:04 +00:00
*-----------------------
2023-08-30 14:42:20 +00:00
* mouse_on
2023-08-28 16:01:04 +00:00
mouse_on
2023-08-30 14:42:20 +00:00
_ShowCursor
2023-08-28 16:01:04 +00:00
rts
*-----------------------
2023-08-30 14:42:20 +00:00
* MOUSE_OFF - OK
2023-08-28 16:01:04 +00:00
*-----------------------
2023-08-30 14:42:20 +00:00
* mouse_off
2023-08-28 16:01:04 +00:00
mouse_off
2023-08-30 14:42:20 +00:00
_HideCursor
2023-08-28 16:01:04 +00:00
rts
*-----------------------
2023-09-02 20:47:17 +00:00
* MUSIQUE - OK
2023-08-28 16:01:04 +00:00
*-----------------------
2023-09-02 20:47:17 +00:00
* musique
musique jsr init_musique
2023-08-28 16:01:04 +00:00
2023-09-02 20:47:17 +00:00
lda #1
sta i
]lp lda i
jsr rythme
lda i
jsr charge_son
jsr clavier_sonore
jsr nettoie_musique
inc i
lda i
cmp #5
bcc ]lp
beq ]lp
2023-08-28 16:01:04 +00:00
rts
*-----------------------
2023-09-02 20:47:17 +00:00
* NETTOIE_MUSIQUE - OK
*-----------------------
* nettoie_musique
nettoie_musique
PushLong haBEAT
_DisposeHandle
lda #0
]lp pha
asl
asl
tax
lda haSND1+2,x
pha
lda haSND1,x
pha
_DisposeHandle
pla
inc
cmp j ; nombre de sons
bcc ]lp
rts
*-----------------------
* INIT_MUSIQUE - OK
2023-08-28 16:01:04 +00:00
*-----------------------
init_musique
2023-09-02 20:47:17 +00:00
PushWord #$ffff
_ClearScreen
2023-08-28 16:01:04 +00:00
rts
*-----------------------
2023-09-02 20:47:17 +00:00
* RYTHME - OK
2023-08-28 16:01:04 +00:00
*-----------------------
* rythme(rythme%)
2023-09-02 20:47:17 +00:00
*--- offset to beat number is +22
rythme sep #$20
ora #'0'
sta pBEAT+22
rep #$20
*---
lda #pBEAT
sta proOPEN+4 ; filename
jsl GSOS
dw $2010
adrl proOPEN
bcs ry_err2
lda proOPEN+2
sta proREAD+2
sta proCLOSE+2
ldy proEOF
sty proREAD+8
ldx proEOF+2
stx proREAD+10
pha
pha
phx
phy
PushWord myID
PushWord #%11000000_00001100
PushLong #0
_NewHandle
phd
tsc
tcd
lda [3]
sta ptrBEAT
sta proREAD+4
ldy #2
lda [3],y
sta ptrBEAT+2
sta proREAD+6
pld
pla
sta haBEAT
pla
sta haBEAT+2
bcs ry_err1
jsl GSOS
dw $2012
adrl proREAD
ry_err1 jsl GSOS
dw $2014
adrl proCLOSE
clc
ry_err2 rts
2023-08-28 16:01:04 +00:00
*-----------------------
2023-09-02 20:47:17 +00:00
* CHARGE_SON - OK
2023-08-28 16:01:04 +00:00
*-----------------------
2023-09-02 20:47:17 +00:00
* charge_son
2023-08-28 16:01:04 +00:00
2023-09-02 20:47:17 +00:00
*--- offset to sfxs number is +21
charge_son dec
asl ; pointe sur la table de pointeurs
tax ; par niveau (1..5)
lda tblSND,x
cmp #-1
bne ch_1
sec
rts
ch_1 sta dpFROM ; pointe sur sndPARTx
lda #1 ; on charge tous les sons maintenant
sta j
]lp lda j
dec
asl
tay
tax
lda (dpFROM),y
cmp #-1 ; fin d'une structure
bne ch_2
clc
2023-08-28 16:01:04 +00:00
rts
2023-09-02 20:47:17 +00:00
ch_2 sta dpTO ; pointe sur l'entr<74>e de la structure d'un son
lda (dpTO) ; nom du son
sta pSND+21
ldy #2
lda (dpTO),y
sta tblFREQ,x ; la fr<66>quence du son
lda dpTO
clc
adc #4
sta tblSTR1,x ; on pointe sur la premi<6D>re string
sta dpTO
lda (dpTO)
and #$ff
clc
adc tblSTR1,x
inc
sta tblSTR2,x
jsr charge_un_son
inc j
bra ]lp
*---
charge_un_son
lda #pSND
sta proOPEN+4 ; filename
jsl GSOS
dw $2010
adrl proOPEN
bcs cus_err2
lda proOPEN+2
sta proREAD+2
sta proCLOSE+2
ldy proEOF
sty proREAD+8
ldx proEOF+2
stx proREAD+10
pha
pha
phx
phy
PushWord myID
PushWord #%11000000_00001100
PushLong #0
_NewHandle
phd
tsc
tcd
lda j
dec
asl
tay
asl
tax
lda proEOF+1 ; nombre de pages
sta tblSIZE,y
lda [3]
sta ptrSND1,x
sta proREAD+4
ldy #2
lda [3],y
sta ptrSND1+2,x
sta proREAD+6
pld
pla
sta haSND1,x
pla
sta haSND1+2,x
bcs cus_err1
jsl GSOS
dw $2012
adrl proREAD
cus_err1 jsl GSOS
dw $2014
adrl proCLOSE
clc
cus_err2 rts
2023-08-28 16:01:04 +00:00
*-----------------------
2023-09-02 20:47:17 +00:00
* CLAVIER_SONORE - OK
2023-08-28 16:01:04 +00:00
*-----------------------
clavier_sonore
2023-09-02 20:47:17 +00:00
pha
_GetForeColor
pha
_GetBackColor
PushWord #0
_SetForeColor
PushWord #15
_SetBackColor
cl_loop pha
PushWord #%00000000_00001010
PushLong #taskREC
_GetNextEvent
pla
beq cl_loop
lda taskREC ; une touche ?
cmp #keyDownEvt
bne cl_loop
lda taskMESSAGE ; entre 0 et 9 ?
cmp #'0'
bne cl_1
_SetBackColor
_SetForeColor
rts ; on sort
cl_1 cmp #'1'
bcc cl_loop
cmp #'9'+1
bcs cl_loop
sec
sbc #'1'
cmp j ; dans la limite du nombre de sons
bcs cl_loop
asl ; affiche les cha<68>nes
tax
phx
lda tblSIZE,x
sta waveSIZE
lda tblFREQ,x
sta waveFREQ
txa
asl
tay
lda ptrSND1,y
sta waveSTART
lda ptrSND1+2,y
sta waveSTART+2
lda tblSTR1,x
ldy #22
jsr t
plx
lda tblSTR2,x
ldy #23
jsr t
PushWord #%0000_0000_1000_0000 ; play the sound
_FFStopSound
PushWord #$0701
PushLong #waveSTART
_FFStartSound
brl cl_loop
2023-08-28 16:01:04 +00:00
*-----------------------
*
*-----------------------
* mix(numero_son%)
mix
rts
*-----------------------
2023-09-02 20:47:17 +00:00
* STOP_SAMPLE - OK
2023-08-28 16:01:04 +00:00
*-----------------------
2023-09-02 20:47:17 +00:00
* stop_sample
2023-08-28 16:01:04 +00:00
stop_sample
rts
*-----------------------
2023-09-02 20:47:17 +00:00
* FIN_MUSIQUE - OK
2023-08-28 16:01:04 +00:00
*-----------------------
2023-09-02 20:47:17 +00:00
* fin_musique
2023-08-28 16:01:04 +00:00
fin_musique
rts
*-----------------------
2023-09-02 20:47:17 +00:00
* DATA_FICHIERS_MUSIQUE - OK
2023-08-28 16:01:04 +00:00
*-----------------------
2023-09-02 20:47:17 +00:00
* data_fichiers_musique
2023-08-28 16:01:04 +00:00
data_fichiers_musique
rts
*-----------------------
* T - OK
*-----------------------
* t(ligne%,texte$)
* A: @texte$
* Y: ligne%
2023-08-30 14:42:20 +00:00
t sty theY
PushWord #^t ; pointer to string
2023-08-28 16:01:04 +00:00
pha
PushWord #0 ; get string length
PushWord #^t
pha
_StringWidth ; return left on stack
2023-08-30 14:42:20 +00:00
lda #320 ; why 160?
2023-08-28 16:01:04 +00:00
sec
sbc 1,s
bpl t1
lda #0
2023-08-30 14:42:20 +00:00
t1 lsr
sta 1,s ; X
lda theY ; pour MoveTo
asl
asl
asl
pha ; Y
2023-08-28 16:01:04 +00:00
_MoveTo
_DrawString
rts
*-----------------------
* FIN - OK
*-----------------------
fin
rts
2023-08-30 14:42:20 +00:00
*-----------------------
* MON BEAU CURSEUR
*-----------------------
monCURSEUR
2023-09-02 20:47:17 +00:00
dw 16,5
hex FF000000000000000000 ; data
hex F0F00000000000000000
hex F00F0000000000000000
hex F000F000000000000000
hex F0000F000FFFFF000000
hex F00000F0F00000F00000
hex F000000F00FFF00F0000
hex F0000FFF00F0F00F0000
hex F0F00F0F00F0F00F0000
hex FF0F00FF00F0F00F0000
hex F000F00FFFFFF00F0000
hex 00000F00000000F00000
hex 000000FFFFFFFF000000
hex 0FFFFFFF00F000000000
hex F00000000F0000000000
hex 0FFFFFFFF00000000000
hex FF000000000000000000 ; mask
hex FFF00000000000000000
hex FFFF0000000000000000
hex FFFFF000000000000000
hex FFFFFF000FFFFF000000
hex FFFFFFF0FFFFFFF00000
hex FFFFFFFFFFFFFFFF0000
hex FFFFFFFFFFF0FFFF0000
hex FFFFFF0FFFF0FFFF0000
hex FF0FFFFFFFF0FFFF0000
hex F000FFFFFFFFFFFF0000
hex 00000FFFFFFFFFF00000
hex 000000FFFFFFFF000000
hex 0FFFFFFFFFF000000000
hex FFFFFFFFFF0000000000
hex 0FFFFFFFF00000000000
2023-08-31 20:12:41 +00:00
dw 1,1
2023-08-30 14:42:20 +00:00
*--- The end