mirror of
https://github.com/antoinevignau/source.git
synced 2025-01-01 00:31:17 +00:00
ba8b564bab
IIe (complete) & IIgs (corrupted) soruce code
1 line
17 KiB
Plaintext
1 line
17 KiB
Plaintext
************************************************************************
|
|
* *
|
|
* GAME SYSTEM //e *
|
|
* --------------- *
|
|
* *
|
|
* (c) Atreid Concept SA Version 0.2 02/03/91 *
|
|
************************************************************************
|
|
|
|
|
|
|
|
************************************************************************
|
|
GSInit anop
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
************************************************************************
|
|
ReadMouse anop ;a --> 0 : pas d'info souris
|
|
anop ;a --> $80
|
|
anop ;==> Mx--> coor X My--> coor Y
|
|
anop ; MBut--> bouton
|
|
|
|
RMDone rts
|
|
|
|
Mx ds 1
|
|
My ds 1
|
|
MBut ds 1
|
|
MBut2 ds 1
|
|
|
|
|
|
|
|
|
|
|
|
************************************************************************
|
|
PaintRect anop ;GSTemp1 = coor. x / 7
|
|
anop ;GSTemp1+1= coor. y
|
|
anop ;GSTemp2 = dep relatif x / 7
|
|
anop ;GSTemp2+1= dep relatif y
|
|
anop ;GSTemp3 = couleur
|
|
|
|
ldx #0
|
|
PR1 anop
|
|
ldy GSTemp1+1 ;coor y
|
|
lda Adrlo,y
|
|
clc
|
|
adc GSTemp1 ;coor x
|
|
sta <$50
|
|
lda Adrhi,y
|
|
clc
|
|
adc PageHGR
|
|
sta <$51
|
|
lda GSTemp3 ;couleur
|
|
ldy #0
|
|
PR2 anop
|
|
sta ($50),y
|
|
iny
|
|
cpy GSTemp2 ;dep x
|
|
bne PR2
|
|
inc GSTemp1+1
|
|
inx
|
|
cpx GSTemp2+1 ;dep y
|
|
bne PR1
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
************************************************************************
|
|
ClearHGR anop ;a=0 : hgr 1 a=1: hgr2
|
|
|
|
cmp #0
|
|
bne ClearHGR2
|
|
|
|
lda #$20
|
|
sta ClearHGRLoop+2
|
|
bne ClearHGR0
|
|
|
|
ClearHGR2 anop
|
|
lda #$40
|
|
sta ClearHGRLoop+2
|
|
|
|
ClearHGR0 lda #0
|
|
tay
|
|
ClearHGRLoop sta $2000
|
|
inc ClearHGRLoop+1
|
|
bne ClearHGRLoop
|
|
inc ClearHGRLoop+2
|
|
iny
|
|
cpy #32
|
|
bne ClearHGRLoop
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
************************************************************************
|
|
Swap anop ;a=0 : hgr 1 a=1: hgr2
|
|
|
|
cmp #0
|
|
bne SwapHgr2
|
|
|
|
lda #0
|
|
sta $c054
|
|
rts
|
|
|
|
SwapHGR2 anop
|
|
lda #0
|
|
sta $c055
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
************************************************************************
|
|
WaitUser anop ;--> a= caractere tape
|
|
anop ; 0 si clic ou fire
|
|
|
|
lda #0
|
|
lda $c024
|
|
sta $c010 ;echantillonne clavier
|
|
WULoop anop
|
|
jsr Random ;amorce...
|
|
lda $C000 ;teste touche
|
|
bmi WUDone1
|
|
lda $C061 ;teste fire 0
|
|
bmi WUDone
|
|
lda $C062 ;teste fire 1
|
|
bmi WUDone
|
|
lda $C027 ;teste clic souris
|
|
bpl WULoop
|
|
and #%00000010
|
|
bne WULoop2
|
|
lda $C024
|
|
lda $C024
|
|
bmi WULoop
|
|
bpl WUDone
|
|
WULoop2 anop
|
|
lda $C024
|
|
jmp WULoop
|
|
|
|
|
|
WUDone anop
|
|
lda #0
|
|
rts
|
|
WUDone1 anop
|
|
and #$7f
|
|
beq WaitUser
|
|
rts
|
|
|
|
|
|
|
|
|
|
************************************************************************
|
|
Sound anop ;a=note
|
|
anop ;x=duree
|
|
|
|
SoundLoop0 anop
|
|
ldy $c030 ;speaker
|
|
ldy $c030 ;speaker
|
|
ldy $c030 ;speaker
|
|
pha
|
|
SoundLoop1 ldy #10
|
|
SoundLoop2 dey
|
|
bne SoundLoop2
|
|
sec
|
|
sbc #1
|
|
bne SoundLoop1
|
|
pla
|
|
dex
|
|
bne SoundLoop0
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
************************************************************************
|
|
Texte16 anop ;x= coordonnee x / 7
|
|
anop ;y= coordonnee y
|
|
anop ;GSTemp1= ptr str
|
|
anop ;GSTemp2= ptr image source
|
|
|
|
stx GSTemp7 ; x;y image dest pour Sprite16
|
|
sty GSTemp7+1 ;
|
|
|
|
lda GSTemp1+1
|
|
sta T16length+2
|
|
sta T16Read+2
|
|
lda GSTemp1
|
|
sta T16length+1
|
|
clc
|
|
adc #1
|
|
bcc T16anop1
|
|
inc T16Read+2
|
|
T16anop1 anop
|
|
sta T16Read+1
|
|
T16length lda T16length
|
|
beq T16End
|
|
sta GSTemp4 ;longueur de la str
|
|
|
|
ldx #0
|
|
T16Read lda T16Read,x
|
|
cmp #128
|
|
bge T16Aff0
|
|
sta GSTemp5 ;caractere
|
|
ldy #0
|
|
T16Trans anop
|
|
lda T16Car,y ;utilisation de la table
|
|
cmp GSTemp5 ;de correspondance...
|
|
beq T16Aff
|
|
iny
|
|
cpy T16NbCar
|
|
bne T16Trans
|
|
beq T16Aff
|
|
|
|
T16Aff0 anop
|
|
and #$7f
|
|
tay
|
|
T16Aff anop
|
|
stx StackX ;on sauve l'index de la string
|
|
tya
|
|
|
|
lda OffSetX,y
|
|
sta GSTemp6 ;x de l'image source pour Sprite16
|
|
lda OffSetY,y
|
|
sta GSTemp6+1 ;y de l'image source pour Sprite16
|
|
|
|
jsr Sprite16
|
|
|
|
lda GSTemp7 ;avancement du curseur
|
|
clc
|
|
adc #2
|
|
sta GSTemp7
|
|
ldx StackX
|
|
inx
|
|
cpx GSTemp4
|
|
bne T16Read
|
|
|
|
T16End anop
|
|
rts
|
|
|
|
MSB OFF
|
|
T16Car dc c'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
|
dc c'.:!?#0123456789 '
|
|
T16CarEnd anop
|
|
T16NbCar dc i2'T16CarEnd-T16Car'
|
|
|
|
|
|
|
|
|
|
************************************************************************
|
|
Sprite16 anop ;GSTemp2= ptr image source
|
|
anop ;GSTemp6= x;y image source
|
|
anop ;GSTemp7= x;y image dest
|
|
|
|
lda GSTemp6+1 ;sauvegarde
|
|
pha
|
|
lda GSTemp7+1
|
|
pha
|
|
|
|
ldy #15 ;hauteur des shapes
|
|
Sp16Loop anop
|
|
ldx GSTemp6+1 ;y source
|
|
lda adrlo,x
|
|
clc
|
|
adc GSTemp2 ;ptr source
|
|
adc GSTemp6 ;x source
|
|
sta <$50
|
|
lda adrhi,x
|
|
adc GSTemp2+1 ;ptr source
|
|
sta <$51
|
|
|
|
ldx GSTemp7+1 ;y dest
|
|
lda adrlo,x
|
|
clc
|
|
adc GSTemp7 ;x dest
|
|
sta <$52
|
|
lda adrhi,x
|
|
adc PageHGR ;dest
|
|
sta <$53
|
|
|
|
ldx #0
|
|
lda ($50,x) ;copie d'une ligne
|
|
sta ($52,x)
|
|
inc <$50
|
|
inc <$52
|
|
lda ($50,x)
|
|
sta ($52,x)
|
|
|
|
inc GSTemp6+1
|
|
inc GSTemp7+1
|
|
dey
|
|
bne Sp16Loop
|
|
|
|
pla ;restore
|
|
sta GSTemp7+1
|
|
pla
|
|
sta GSTemp6+1
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
************************************************************************
|
|
Texte8 anop ;x= coordonnee x / 7
|
|
anop ;y= coordonnee y
|
|
anop ;GSTemp1= ptr str
|
|
anop ;GSTemp2= ptr image source
|
|
|
|
stx GSTemp7 ; x;y image dest pour Sprite8
|
|
sty GSTemp7+1 ;
|
|
|
|
lda GSTemp1+1
|
|
sta T8length+2
|
|
sta T8Read+2
|
|
lda GSTemp1
|
|
sta T8length+1
|
|
clc
|
|
adc #1
|
|
bcc T8anop1
|
|
inc T16Read+2
|
|
T8anop1 anop
|
|
sta T8Read+1
|
|
T8length lda T8length
|
|
beq T8End
|
|
sta GSTemp4 ;longueur de la str
|
|
|
|
ldx #0
|
|
T8Read lda T8Read,x
|
|
cmp #$80
|
|
blt T8Read2
|
|
ldy #$ff
|
|
sty T8Mask
|
|
T8Read2 anop
|
|
sec
|
|
sbc #32 ;on commence a espace
|
|
tay
|
|
stx StackX ;on sauve l'index de la string
|
|
|
|
lda OffSetX8,y
|
|
sta GSTemp6 ;x de l'image source pour Sprite8
|
|
lda OffSetY8,y
|
|
sta GSTemp6+1 ;y de l'image source pour Sprite8
|
|
|
|
jsr Sprite8
|
|
|
|
ldy #0
|
|
sty T8Mask
|
|
|
|
lda GSTemp7 ;avancement du curseur
|
|
clc
|
|
adc #1
|
|
sta GSTemp7
|
|
ldx StackX
|
|
inx
|
|
cpx GSTemp4
|
|
bne T8Read
|
|
|
|
T8End anop
|
|
rts
|
|
|
|
|
|
|
|
|
|
************************************************************************
|
|
Sprite8 anop ;GSTemp2= ptr image source
|
|
anop ;GSTemp6= x;y image source
|
|
anop ;GSTemp7= x;y image dest
|
|
|
|
lda GSTemp6+1 ;sauvegarde
|
|
pha
|
|
lda GSTemp7+1
|
|
pha
|
|
|
|
ldy #8 ;hauteur des shapes
|
|
Sp8Loop anop
|
|
ldx GSTemp6+1 ;y source
|
|
lda adrlo,x
|
|
clc
|
|
adc GSTemp2 ;ptr source
|
|
adc GSTemp6 ;x source
|
|
sta <$50
|
|
lda adrhi,x
|
|
adc GSTemp2+1 ;ptr source
|
|
sta <$51
|
|
|
|
ldx GSTemp7+1 ;y dest
|
|
lda adrlo,x
|
|
clc
|
|
adc GSTemp7 ;x dest
|
|
sta <$52
|
|
lda adrhi,x
|
|
adc PageHGR ;dest
|
|
sta <$53
|
|
|
|
ldx #0
|
|
lda ($50,x) ;copie d'une ligne
|
|
ora T8Mask
|
|
sta ($52,x)
|
|
|
|
inc GSTemp6+1
|
|
inc GSTemp7+1
|
|
dey
|
|
bne Sp8Loop
|
|
|
|
pla ;restore
|
|
sta GSTemp7+1
|
|
pla
|
|
sta GSTemp6+1
|
|
|
|
rts
|
|
|
|
T8Mask dc h'00'
|
|
|
|
|
|
|
|
|
|
|
|
************************************************************************
|
|
Pause anop ;a= temps de pause (1/10 s)
|
|
|
|
ldx #57
|
|
Pause1 anop
|
|
ldy #255
|
|
Pause2 anop
|
|
dey
|
|
bne Pause2
|
|
pha
|
|
pla
|
|
pha ;delai...
|
|
pla
|
|
pha
|
|
pla
|
|
nop
|
|
nop
|
|
nop
|
|
dex
|
|
bne Pause1 ;Boucle Pause1= 100.000 cycles
|
|
sec
|
|
sbc #1
|
|
bne Pause
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
************************************************************************
|
|
Random anop ; -->a= rnd(255)
|
|
|
|
lda RNDRoot
|
|
clc
|
|
adc #117
|
|
sta RNDRoot
|
|
bcc Random2
|
|
inc RNDRoot+1
|
|
Random2 anop
|
|
eor RNDRoot+1
|
|
eor RNDVal
|
|
sta RNDVal
|
|
rts
|
|
|
|
RNDRoot dc i2'19251'
|
|
RNDval dc i1'125'
|
|
|
|
|
|
|
|
|
|
|
|
************************************************************************
|
|
LoadFile anop ;GSTemp1= ptr string
|
|
anop ;GSTemp2= taille en octets
|
|
anop ;GSTemp3= buffer mem
|
|
|
|
lda GSTemp1
|
|
sta PathName
|
|
lda GSTemp1+1
|
|
sta PathName+1
|
|
|
|
lda GSTemp2
|
|
sta ReadSize
|
|
lda GSTemp2+1
|
|
sta ReadSize+1
|
|
|
|
lda GSTemp3
|
|
sta BufferIO
|
|
lda GSTemp3+1
|
|
sta BufferIO+1
|
|
|
|
jsr ProDOS
|
|
dc h'c8' ;Open
|
|
dc i2'OpenBloc'
|
|
jsr ProDOSerr
|
|
|
|
lda RefNum
|
|
sta ReadBloc+1
|
|
sta CloseBloc+1
|
|
|
|
jsr ProDOS
|
|
dc h'ca' ;Read
|
|
dc i2'ReadBloc'
|
|
jsr ProDOSerr
|
|
|
|
jsr ProDOS
|
|
dc h'cc' ;Close
|
|
dc i2'CloseBloc'
|
|
jsr ProDOSerr
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
QuitBloc dc i1'4'
|
|
dc i2'0'
|
|
dc i2'0'
|
|
dc i2'0'
|
|
|
|
OpenBloc dc i1'3'
|
|
PathName ds 2
|
|
dc i2'IOBuffer'
|
|
RefNum ds 1
|
|
|
|
ReadBloc dc i1'4'
|
|
ds 1
|
|
BufferIO ds 2
|
|
ReadSize ds 2
|
|
ds 2
|
|
|
|
CloseBloc dc i1'1'
|
|
ds 1
|
|
|
|
adrlo dc h'00000000000000008080808080808080'
|
|
dc h'00000000000000008080808080808080'
|
|
dc h'00000000000000008080808080808080'
|
|
dc h'00000000000000008080808080808080'
|
|
dc h'2828282828282828A8A8A8A8A8A8A8A8'
|
|
dc h'2828282828282828A8A8A8A8A8A8A8A8'
|
|
dc h'2828282828282828A8A8A8A8A8A8A8A8'
|
|
dc h'2828282828282828A8A8A8A8A8A8A8A8'
|
|
dc h'5050505050505050D0D0D0D0D0D0D0D0'
|
|
dc h'5050505050505050D0D0D0D0D0D0D0D0'
|
|
dc h'5050505050505050D0D0D0D0D0D0D0D0'
|
|
dc h'5050505050505050D0D0D0D0D0D0D0D0'
|
|
|
|
adrhi dc h'0004080C1014181C0004080C1014181C'
|
|
dc h'0105090D1115191D0105090D1115191D'
|
|
dc h'02060A0E12161A1E02060A0E12161A1E'
|
|
dc h'03070B0F13171B1F03070B0F13171B1F'
|
|
dc h'0004080C1014181C0004080C1014181C'
|
|
dc h'0105090D1115191D0105090D1115191D'
|
|
dc h'02060A0E12161A1E02060A0E12161A1E'
|
|
dc h'03070B0F13171B1F03070B0F13171B1F'
|
|
dc h'0004080C1014181C0004080C1014181C'
|
|
dc h'0105090D1115191D0105090D1115191D'
|
|
dc h'02060A0E12161A1E02060A0E12161A1E'
|
|
dc h'03070B0F13171B1F03070B0F13171B1F'
|
|
|
|
OffSetX dc h'00020406080a0c0e10121416181a1c1e20222426'
|
|
dc h'00020406080a0c0e10121416181a1c1e20222426'
|
|
dc h'00020406080a0c0e10121416181a1c1e20222426'
|
|
dc h'00020406080a0c0e10121416181a1c1e20222426'
|
|
dc h'00020406080a0c0e10121416181a1c1e20222426'
|
|
dc h'00020406080a0c0e10121416181a1c1e20222426'
|
|
dc h'00020406080a0c0e10121416181a1c1e20222426'
|
|
dc h'00020406080a0c0e10121416181a1c1e20222426'
|
|
dc h'00020406080a0c0e10121416181a1c1e20222426'
|
|
dc h'00020406080a0c0e10121416181a1c1e20222426'
|
|
OffSetY dc h'0000000000000000000000000000000000000000'
|
|
dc h'0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f'
|
|
dc h'1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e'
|
|
dc h'2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d'
|
|
dc h'3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c'
|
|
dc h'4b4b4b4b4b4b4b4b4b4b4b4b4b4b4b4b4b4b4b4b'
|
|
dc h'5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a'
|
|
dc h'6969696969696969696969696969696969696969'
|
|
dc h'7878787878787878787878787878787878787878'
|
|
dc h'8787878787878787878787878787878787878787'
|
|
|
|
OffSetX8 dc h'000102030405060708090a0b0c0d0e0f10111213'
|
|
dc h'1415161718191a1b1c1d1e1f2021222324252627'
|
|
dc h'000102030405060708090a0b0c0d0e0f10111213'
|
|
dc h'1415161718191a1b1c1d1e1f2021222324252627'
|
|
dc h'000102030405060708090a0b0c0d0e0f10111213'
|
|
dc h'1415161718191a1b1c1d1e1f2021222324252627'
|
|
OffSetY8 dc h'3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c'
|
|
dc h'3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c'
|
|
dc h'4444444444444444444444444444444444444444'
|
|
dc h'4444444444444444444444444444444444444444'
|
|
dc h'4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c'
|
|
dc h'4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c'
|
|
|
|
GSTemp1 ds 2
|
|
GSTemp2 ds 2
|
|
GSTemp3 ds 2
|
|
GSTemp4 ds 2
|
|
GSTemp5 ds 2
|
|
GSTemp6 ds 2
|
|
GSTemp7 ds 2
|
|
|
|
StackX ds 1
|
|
StackY ds 1
|
|
|
|
PageHGR dc h'40'
|
|
|