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

718 lines
11 KiB
ArmAsm
Raw Normal View History

2023-12-30 22:03:33 +00:00
*
* Le retour du Dr Genius
*
* (c) 1983, Loriciels
* (c) 2023, Brutal Deluxe Software (Apple II)
*
2024-01-11 13:28:30 +00:00
* Les accents (encore et toujours)
*
* <EFBFBD> 88
* <EFBFBD> 89
* <EFBFBD> 8d
* <EFBFBD> 8e
* <EFBFBD> 8f
* <EFBFBD> 90
* <EFBFBD> 91
* <EFBFBD> 94
* <EFBFBD> 95
* <EFBFBD> 99
* <EFBFBD> 9d
* <EFBFBD> 9e
* (c) a9 (only c)
* oe cf
2023-12-30 22:03:33 +00:00
mx %00
2024-01-11 13:28:30 +00:00
rel
lst off
2023-12-30 22:03:33 +00:00
*-----------------------------------
* MACROS
*-----------------------------------
2023-12-31 21:49:51 +00:00
use 4/Event.Macs
2024-01-10 07:09:30 +00:00
use 4/Font.Macs
2023-12-30 22:03:33 +00:00
use 4/Locator.Macs
use 4/Mem.Macs
use 4/Menu.Macs
2024-01-05 21:47:54 +00:00
use 4/MidiSyn.Macs
2023-12-30 22:03:33 +00:00
use 4/Misc.Macs
use 4/QD.Macs
2023-12-31 09:56:15 +00:00
use 4/QDAux.Macs
2024-01-05 18:49:35 +00:00
use 4/Sound.Macs
2024-01-05 21:47:54 +00:00
use 4/Std.Macs
2023-12-30 22:03:33 +00:00
use 4/Util.Macs
use 4/Window.Macs
2024-01-01 07:25:27 +00:00
*-----------------------
KBD = $e0c000
KBDSTROBE = $e0c010
RDVBLBAR = $e0c019
2024-01-05 16:01:36 +00:00
VERTCNT = $e0c02e
2023-12-30 22:03:33 +00:00
GSOS = $e100a8
2024-01-01 07:25:27 +00:00
*-----------------------
2024-01-01 18:41:02 +00:00
dpFROM = $80
dpTO = dpFROM+4
dpTHREE = dpTO+4
2024-01-08 22:14:55 +00:00
dpFOUR = dpTHREE+4
dpCOL1 = $90
dpCOL2 = dpCOL1+1
dpPX = dpCOL2+1
dpBK = dpPX+1
2023-12-30 22:03:33 +00:00
2024-01-01 07:25:27 +00:00
*-----------------------
2023-12-30 22:03:33 +00:00
refIsPointer = $0
refIsHandle = $1
refIsResource = $2
2024-01-01 07:25:27 +00:00
appleKey = $0100
mouseDownEvt = $0001
mouseUpEvt = $0002
keyDownEvt = $0003
2023-12-30 22:03:33 +00:00
2024-01-01 07:25:27 +00:00
*-----------------------
2023-12-31 09:56:15 +00:00
2024-01-02 14:32:27 +00:00
modeCopy = $0000
2023-12-31 20:27:37 +00:00
modeForeCopy = $0004 ; QDII Table 16-10
2023-12-30 22:03:33 +00:00
mode320 = $00
mode640 = $80
maxX = 320
maxY = 200
2024-01-01 18:41:02 +00:00
maxTCOLUMN = 40
maxTROW = 19
2024-01-06 16:13:17 +00:00
charHEIGHT = 10
charWIDTH = 8
2024-01-06 22:31:19 +00:00
row0 = charHEIGHT-2 ; 9 - 1 partout...
2024-01-06 16:13:17 +00:00
row1 = row0+charHEIGHT ; 19
row2 = row1+charHEIGHT ; 29
row3 = row2+charHEIGHT ; 39
row4 = row3+charHEIGHT ; 49
row5 = row4+charHEIGHT ; 59
row6 = row5+charHEIGHT ; 69
row7 = row6+charHEIGHT ; 79
row8 = row7+charHEIGHT ; 89
row9 = row8+charHEIGHT ; 99
row10 = row9+charHEIGHT ; 109
row11 = row10+charHEIGHT ; 119
row12 = row11+charHEIGHT ; 129
row13 = row12+charHEIGHT ; 139
row14 = row13+charHEIGHT ; 149
row15 = row14+charHEIGHT ; 159
row16 = row15+charHEIGHT ; 169
row17 = row16+charHEIGHT ; 179
row18 = row17+charHEIGHT ; 189
row19 = row18+charHEIGHT ; 199
2024-01-01 07:25:27 +00:00
ptr012000 = $012000
ptrE12000 = $e12000
*-----------------------
TRUE = 1
FALSE = 0
2023-12-30 22:03:33 +00:00
*-----------------------------------
* DU 16-BITS
*-----------------------------------
2023-12-31 09:56:15 +00:00
ICI phk
2023-12-30 22:03:33 +00:00
plb
clc
xce
rep #$30
tdc
sta myDP
2024-01-06 22:31:19 +00:00
lda #screenRECT
stal $300
lda #^screenRECT
stal $302
2023-12-30 22:03:33 +00:00
_TLStartUp
pha
_MMStartUp
pla
2023-12-31 20:27:37 +00:00
sta appID
ora #$0100
2023-12-30 22:03:33 +00:00
sta myID
2024-01-01 07:25:27 +00:00
*-----------------------------------
* MEMORY...
*-----------------------------------
jsr make64KB
bcc okMEM1
koMEM pha
PushLong #memSTR1
PushLong #errSTR2
PushLong #errSTR1
PushLong #errSTR2
_TLTextMountVolume
pla
brl meQUIT1
okMEM1 sty ptrTEXT
stx ptrTEXT+2
stx ptrBACKGND+2
*-----------------------
jsr make64KB
bcs koMEM
sty ptrUNPACK
stx ptrUNPACK+2
stx ptrIMAGE+2
*-----------------------------------
* DESKTOP MODE
*-----------------------------------
2023-12-30 22:03:33 +00:00
pha
pha
PushWord myID
2024-01-11 13:28:30 +00:00
PushWord #refIsResource
PushLong #1
2023-12-30 22:03:33 +00:00
_StartUpTools
2024-01-11 13:28:30 +00:00
PullLong ssREC
2024-01-01 07:25:27 +00:00
bcc okTOOL
2023-12-30 22:03:33 +00:00
2024-01-01 07:25:27 +00:00
pha
PushLong #tolSTR1
PushLong #errSTR2
PushLong #errSTR1
PushLong #errSTR2
_TLTextMountVolume
pla
brl meQUIT
okTOOL _HideMenuBar
2023-12-30 22:03:33 +00:00
_InitCursor
_HideCursor
2024-01-01 07:25:27 +00:00
PushWord #0
PushWord #%11111111_11111111
PushWord #0
_FlushEvents
pla
PushLong #0
PushWord #5 ; SetDeskPat
PushWord #$4000
PushWord #$0000
2023-12-30 22:03:33 +00:00
_Desktop
pla
pla
2023-12-31 20:27:37 +00:00
*-----------------------------------
* INITIALISATIONS DESKTOP
*-----------------------------------
2023-12-30 22:03:33 +00:00
PushLong #0
_GetPort
PullLong mainPORT
PushLong mainPORT
_SetPort
2024-01-03 18:08:53 +00:00
PushLong #117117
_SetRandSeed
2023-12-30 22:03:33 +00:00
PushWord #0
_SetBackColor
PushWord #15
_SetForeColor
PushLong #whitePATTERN ; white pattern
_SetPenPat
PushWord #0
_ClearScreen
2023-12-31 20:27:37 +00:00
PushWord #0
_GetMasterSCB
pla
bmi okSHADOW ; shadowing is on if bit 15 is set
2023-12-30 22:03:33 +00:00
2023-12-31 20:27:37 +00:00
lda #^ptrE12000 ; shadowing is off, use slow RAM
sta srcLocInfoPtr+4
2024-01-01 18:41:02 +00:00
sta ptrSCREEN+2
2023-12-31 20:27:37 +00:00
okSHADOW
2024-01-08 22:14:55 +00:00
*-----------------------------------
* C'EST L'HEURE DE L'INTRODUCTION
*-----------------------------------
jsr intro
2023-12-30 22:03:33 +00:00
2023-12-31 20:27:37 +00:00
*-----------------------------------
* IL FAUT JOUER MAINTENANT
2024-01-01 18:41:02 +00:00
*-----------------------------------
2024-01-11 13:28:30 +00:00
* jsr initMIDI
* jsr doSOUNDON
2024-01-09 07:15:00 +00:00
2024-01-06 22:31:19 +00:00
sei
PushLong #intTIME
_SetHeartBeat
cli
2024-01-01 18:41:02 +00:00
jmp PLAY
2023-12-30 22:03:33 +00:00
*-----------------------------------
* AU REVOIR LE IIGS
*-----------------------------------
2024-01-01 07:25:27 +00:00
QUIT rep #$30
2024-01-05 21:47:54 +00:00
jsr stopMIDI
2024-01-06 22:31:19 +00:00
sei
PushLong #intTIME
_DelHeartBeat
cli
2024-01-05 21:47:54 +00:00
2024-01-11 13:28:30 +00:00
meQUIT PushWord #refIsHandle
PushLong ssREC
2023-12-30 22:03:33 +00:00
_ShutDownTools
2024-01-01 07:25:27 +00:00
meQUIT1 PushWord myID
2023-12-30 22:03:33 +00:00
_DisposeAll
2023-12-31 20:27:37 +00:00
PushWord appID
_DisposeAll
PushWord appID
2023-12-30 22:03:33 +00:00
_MMShutDown
_TLShutDown
jsl GSOS
dw $2029
adrl proQUIT
brk $bd
2024-01-01 07:25:27 +00:00
*-----------------------------------
* UNE BELLE BIBLIOTHEQUE
*-----------------------------------
*-----------------------------------
* RESERVE 64K
*-----------------------------------
make64KB pha
pha
PushLong #$010000
PushWord myID
PushWord #%11000000_00011100
PushLong #0
_NewHandle
phd
tsc
tcd
ldy #2
lda [3],y
tax
lda [3]
tay ; low in X
pld
pla ; we do not keep track of the handle
pla
rts
*-----------------------------------
* SAVE THE SHR SCREEN
*-----------------------------------
saveBACK _HideCursor
2024-01-11 13:28:30 +00:00
PushLong ptrSCREEN
2024-01-01 07:25:27 +00:00
PushLong ptrBACKGND
PushLong #32768
_BlockMove
_ShowCursor
rts
*-----------------------------------
* RESTORE THE SHR SCREEN
*-----------------------------------
loadBACK _HideCursor
PushLong ptrBACKGND
2024-01-11 13:28:30 +00:00
PushLong ptrSCREEN
2024-01-01 07:25:27 +00:00
PushLong #32768
_BlockMove
rts
2023-12-30 22:03:33 +00:00
*-----------------------------------
2024-01-05 21:47:54 +00:00
* LOAD/SAVE
2023-12-30 22:03:33 +00:00
*-----------------------------------
2024-01-05 21:47:54 +00:00
*----------------------------------- Open
2024-01-09 22:15:26 +00:00
mx %11
doLOAD sta pGAME+10
rep #$30
jsr loadALL
sep #$30
rts
mx %00
jsr doSOUNDOFF
2024-01-05 21:47:54 +00:00
jsr saveBACK
PushWord #30
PushWord #43
PushLong #strLOADFILE
PushLong #0
PushLong #typeLIST
PushLong #replyPTR
_SFGetFile
jsr loadBACK
jsr doSOUNDON
lda replyPTR
bne doLOAD1
rts
doLOAD1 jsr copyPATH
jsr loadALL
rts
*----------------------------------- Save
2024-01-09 22:15:26 +00:00
mx %11
doSAVE sta pGAME+10
rep #$30
jsr saveALL
sep #$30
rts
mx %00
jsr doSOUNDOFF
2024-01-05 21:47:54 +00:00
jsr saveBACK
PushWord #25
PushWord #36
PushLong #strSAVEFILE
PushLong #namePATH
PushWord #15
PushLong #replyPTR
_SFPutFile
jsr loadBACK
jsr doSOUNDON
lda replyPTR
bne doSAVE1
rts
doSAVE1 jsr copyPATH
jsr saveALL
rts
*--- Recopie le filename du fichier de sauvegarde
mx %00
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<EFBFBD>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 #FIN_DATA-DEBUT_DATA
ldy #A1
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 #FIN_DATA-DEBUT_DATA
ldy #A1
saveIT stx proWRITEGAME+8
sty proWRITEGAME+4
jsl GSOS
dw $2013
adrl proWRITEGAME
rts
*--- For the game party
proCREATEGAME
dw 7 ; pcount
adrl pGAME ; pathname
dw $c3 ; access_code
dw $5d ; file_type
adrl $8020 ; 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
2024-01-09 22:15:26 +00:00
pGAME strl '1/Partie0' ; +10 pour la partie
2024-01-05 21:47:54 +00:00
*-----------------------------------
* DES DONNES 16-BITS
*-----------------------------------
2023-12-30 22:03:33 +00:00
2024-01-01 07:25:27 +00:00
*----------------------------------- Memory Manager
appID ds 2
myID ds 2
myDP ds 2
2024-01-01 18:41:02 +00:00
ptrSCREEN adrl ptr012000 ; l'<27>cran actif
2024-01-01 07:25:27 +00:00
ptrTEXT adrl $00000000 ; 32k bank 1
ptrBACKGND adrl $00008000 ; 32k
ptrUNPACK adrl $00000000 ; 32k bank 2
ptrIMAGE adrl $00008000 ; 32k
*----------------------------------- Quickdraw II
2023-12-30 22:03:33 +00:00
2023-12-31 09:56:15 +00:00
palette320 dw $0000,$0777,$0841,$072C,$000F,$0080,$0F70,$0D00
dw $0FA9,$0FF0,$00E0,$04DF,$0DAF,$078F,$0CCC,$0FFF
2024-01-01 15:49:02 +00:00
palette640 dw $0000,$000F,$00F0,$0FFF,$0000,$000F,$0FF0,$0FFF
dw $0000,$0F00,$00F0,$0FFF,$0000,$000F,$0FF0,$0FFF
2023-12-31 09:56:15 +00:00
2023-12-31 04:18:24 +00:00
blackPATTERN ds 32,$00
ds 32,$11
ds 32,$22
ds 32,$33
ds 32,$44
ds 32,$55
ds 32,$66
2024-01-10 07:09:30 +00:00
redPATTERN ds 32,$77
2023-12-31 04:18:24 +00:00
ds 32,$88
2024-01-11 08:30:28 +00:00
yellowPATTERN ds 32,$99
2023-12-31 04:18:24 +00:00
ds 32,$aa
2024-01-11 08:30:28 +00:00
cyanPATTERN ds 32,$bb
2023-12-31 04:18:24 +00:00
ds 32,$cc
ds 32,$dd
ds 32,$ee
2023-12-30 22:03:33 +00:00
whitePATTERN ds 32,$ff
2024-01-11 13:28:30 +00:00
checkeredPATTERN
hex 0F0F0F0F
hex F0F0F0F0
hex 0F0F0F0F
hex F0F0F0F0
hex 0F0F0F0F
hex F0F0F0F0
hex 0F0F0F0F
hex F0F0F0F0
2024-01-01 18:41:02 +00:00
curPATTERN ds 32
2024-01-11 13:28:30 +00:00
curPENSIZE ds 4
2024-01-01 07:25:27 +00:00
*----------------------------------- Error messages
tolSTR1 str 'Error while loading tools'
memSTR1 str 'Cannot allocate memory'
filSTR1 str 'Cannot load file'
errSTR1 str 'Quit'
errSTR2 str ''
*----------------------------------- Tool Locator
2023-12-30 22:03:33 +00:00
ssREC ds 4
2024-01-11 13:28:30 +00:00
*toolTBL dw $0000 ; flags
* dw $C000 ; videoMode (shadowing + fast port)
* dw $0000 ; resFileID
* ADRL $00000000 ; dPageHandle
* dw $0011
* dw $0003 ; Miscellaneous Tool
* dw $0300
* dw $0004 ; QuickDraw II
* dw $0301
* dw $0005 ; Desk Manager
* dw $0302
* dw $0006 ; Event Manager
* dw $0300
* dw $0008 ; Sound Tool Set
* dw $0100
* dw $000B ; Integer Math Tool Set
* dw $0200
* dw $000E ; Window Manager
* dw $0301
* dw $000F ; Menu Manager
* dw $0301
* dw $0010 ; Control Manager
* dw $0301
* dw $0012 ; QuickDraw II Auxiliary
* dw $0301
* dw $0014 ; LineEdit Tool Set
* dw $0301
* dw $0015 ; Dialog Manager
* dw $0301
* dw $0016 ; Scrap Manager
* dw $0300
* dw $0017 ; Standard File Tool Set
* dw $0301
* dw $001B ; Font Manager
* dw $0301
* dw $001C ; List Manager
* dw $0301
* dw $001E ; Resource Manager
* dw $0100
2023-12-30 22:03:33 +00:00
2024-01-01 07:25:27 +00:00
*----------------------------------- GS/OS
proERR ds 2 ; GS/OS error code
2023-12-30 22:03:33 +00:00
2024-01-05 21:47:54 +00:00
proCLOSE dw 1 ; pcount
ds 2 ; ID
2023-12-30 22:03:33 +00:00
proQUIT dw 2 ; pcount
ds 4 ; pathname
ds 2 ; flags
2024-01-01 07:25:27 +00:00
*----------------------------------- Window Manager
2023-12-30 22:03:33 +00:00
mainPORT ds 4
2024-01-01 07:25:27 +00:00
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
*----------------------------------- Standard File Tool Set
strLOADFILE str 'Charger quelle partie ?'
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)
2023-12-30 22:03:33 +00:00
*-----------------------------------
* CODE BASIC EN ASM :-)
*-----------------------------------
2023-12-31 20:27:37 +00:00
put leretour.s
2023-12-30 22:03:33 +00:00
put engine.s
2024-01-08 22:14:55 +00:00
put introcode.s
2023-12-31 20:27:37 +00:00
put fr.s
2024-01-08 22:14:55 +00:00
put midi.s
put images.s
2023-12-30 22:03:33 +00:00
*--- It's the end