amiga/WHDLoad/ElectroMAN/source/ElectroMAN.s

168 lines
5.0 KiB
ArmAsm
Raw Normal View History

2024-09-14 20:30:58 +00:00
;*---------------------------------------------------------------------------
; :Program. ElectroMAN.s
; :Contents. Slave for "ElectroMAN" from Tukinem & Retronics
; :Author. Tomek Wojcik, from Wepl sources
; :Original v1.0b1
; :Version. $Id: ElectroMAN.s 1.0b1 2024/09/13 22:20:34 BTHLabs Exp BTHLabs $
; :History. 2024-09-13 started
; :Requires. -
; :Copyright. Public Domain
; :Language. 68000 Assembler
; :Translator. Devpac 3.14, Barfly 2.9
; :To Do. * Add support for quitting the game with ESC key :)
;---------------------------------------------------------------------------*
INCLUDE whdload.i
INCLUDE whdmacros.i
INCLUDE lvo/dos.i
IFD BARFLY
OUTPUT "/ElectroMAN.Slave"
BOPT O+ ;enable optimizing
BOPT OG+ ;enable optimizing
BOPT ODd- ;disable mul optimizing
BOPT ODe- ;disable mul optimizing
BOPT w4- ;disable 64k warnings
BOPT wo- ;disable optimizer warnings
SUPER
ENDC
;============================================================================
CHIPMEMSIZE = $200000 ;size of chip memory
FASTMEMSIZE = 0 ;size of fast memory
NUMDRIVES = 1 ;amount of floppy drives to be configured
WPDRIVES = %0000 ;write protection of floppy drives
BLACKSCREEN ;set all initial colors to black
;BOOTBLOCK ;enable _bootblock routine
BOOTDOS ;enable _bootdos routine
;BOOTEARLY ;enable _bootearly routine
;CBDOSLOADSEG ;enable _cb_dosLoadSeg routine
;CBDOSREAD ;enable _cb_dosRead routine
;CBKEYBOARD ;enable _cb_keyboard routine
CACHE ;enable inst/data cache for fast memory with MMU
;CACHECHIP ;enable inst cache for chip/fast memory
;CACHECHIPDATA ;enable inst/data cache for chip/fast memory
;DEBUG ;add more internal checks
;DISKSONBOOT ;insert disks in floppy drives
DOSASSIGN ;enable _dos_assign routine
;FONTHEIGHT = 8 ;enable 80 chars per line
HDINIT ;initialize filesystem handler
;HRTMON ;add support for HrtMON
IOCACHE = 10000 ;cache for the filesystem handler (per fh)
INITAGA ;enable AGA
;MEMFREE = $200 ;location to store free memory counter
;NEEDFPU ;set requirement for a fpu
;POINTERTICKS = 1 ;set mouse speed
;SETPATCH ;enable patches from SetPatch 1.38
;SNOOPFS ;trace filesystem handler
;STACKSIZE = 6000 ;increase default stack
;TRDCHANGEDISK ;enable _trd_changedisk routine
;============================================================================
slv_Version = 17
slv_Flags = WHDLF_NoError|WHDLF_Examine
slv_keyexit = $59 ;F10
;============================================================================
INCLUDE whdload/kick31.s
;============================================================================
slv_name dc.b "ElectroMAN",0
slv_copy dc.b "2024 Tukinem & Retronics",0
slv_info dc.b "adapted by Tomek Wojcik",10
dc.b "Version 1.0b1 2024-09-13"
dc.b 0
slv_CurrentDir dc.b "data",0
slv_config dc.b 0
_disk1 dc.b "ELECTROMAN",0
_disk2 dc.b "SOUNDDATA",0
_program dc.b "ElectroMan.exu",0
_args dc.b 10
_args_end dc.b 0
EVEN
;============================================================================
_bootdos move.l _resload(pc),a2 ;A2 = resload
lea (_saveregs,pc),a0
movem.l d1-d6/a2-a6,(a0)
move.l (a7)+,(44,a0)
;open doslib
lea (_dosname,pc),a1
move.l (4),a6
jsr (_LVOOldOpenLibrary,a6)
lea (_dosbase,pc),a0
move.l d0,(a0)
move.l d0,a6 ;A6 = dosbase
;assigns
lea (_disk1,pc),a0
sub.l a1,a1
bsr _dos_assign
lea (_disk2,pc),a0
sub.l a1,a1
bsr _dos_assign
;load exe
lea (_program,pc),a0
move.l a0,d1
jsr (_LVOLoadSeg,a6)
move.l d0,d7 ;D7 = segment
beq .end
;patch
move.l a3,a0
move.l d7,a1
jsr (resload_PatchSeg,a2)
IFD DEBUG
;set debug
clr.l -(a7)
move.l d7,-(a7)
pea WHDLTAG_DBGSEG_SET
move.l a7,a0
jsr (resload_Control,a2)
add.w #12,a7
ENDC
;call
move.l d7,a1
add.l a1,a1
add.l a1,a1
moveq #_args_end-_args,d0
lea (_args,pc),a0
movem.l (_saveregs,pc),d1-d6/a2-a6
jsr (4,a1)
pea TDREASON_OK
jmp (resload_Abort,a2)
IFEQ 1
;remove exe
move.l d7,d1
move.l (_dosbase),a6
jsr (_LVOUnLoadSeg,a6)
ENDC
.end moveq #0,d0
move.l (_saverts,pc),-(a7)
rts
;============================================================================
_saveregs ds.l 11
_saverts dc.l 0
_dosbase dc.l 0
;============================================================================
END