home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 13
/
AACD13.ISO
/
AACD
/
Games
/
WHDLoad
/
Src
/
slave-examples
/
oscar.asm
< prev
next >
Wrap
Assembly Source File
|
2000-01-23
|
6KB
|
242 lines
;*---------------------------------------------------------------------------
; :Program. oscar.asm
; :Contents. Slave for "Oscar"
; :Author. wepl <wepl@whdload.org>
; :Original. v1 Desktop Dynamite <wepl@whdload.org>
; v2
; v3 CD³²
; :Version. $Id: oscar.asm 1.9 2000/01/23 21:02:51 jah Exp jah $
; :History. 20.05.96
; 16.06.97 updated for slave version 2
; 15.08.97 update for key managment
; 15.07.98 cache on 68040+ disabled
; 08.05.99 adapted for WHDLoad 10.0, access faults removed
; 08.12.99 support for v2 added
; 16.01.00 support for v3 added
; :Requires. -
; :Copyright. Public Domain
; :Language. 68000 Assembler
; :Translator. Barfly V2.9
; :To Do.
;---------------------------------------------------------------------------*
INCDIR Includes:
INCLUDE whdload.i
INCLUDE whdmacros.i
IFD BARFLY
OUTPUT "wart:o/oscar/Oscar.Slave"
;OUTPUT "wart:o/oscar cd³²/Oscar.Slave"
BOPT O+ ;enable optimizing
BOPT OG+ ;enable optimizing
BOPT ODd- ;disable mul optimizing
BOPT ODe- ;disable mul optimizing
BOPT w4- ;disable 64k warnings
SUPER ;disable supervisor warnings
ENDC
STRUCTURE globals,$100
LONG _resload
LONG _chipptr
LABEL gl_ENDOF
;============================================================================
_base SLAVE_HEADER ;ws_Security + ws_ID
dc.w 10 ;ws_Version
dc.w WHDLF_NoError ;ws_flags
_upchip dc.l $181000 ;ws_BaseMemSize
;floppy vers need only $177000
dc.l 0 ;ws_ExecInstall
dc.w _Start-_base ;ws_GameLoader
dc.w _data-_base ;ws_CurrentDir
dc.w 0 ;ws_DontCache
_keydebug dc.b 0 ;ws_keydebug
_keyexit dc.b $59 ;ws_keyexit = F10
_expmem dc.l 0 ;ws_ExpMem
dc.w _name-_base ;ws_name
dc.w _copy-_base ;ws_copy
dc.w _info-_base ;ws_info
;============================================================================
IFD BARFLY
IFND .passchk
DOSCMD "WDate >T:date"
.passchk
ENDC
ENDC
_data dc.b "data",0
_name dc.b "Oscar",0
_copy dc.b "1993 Flair Software",0
_info dc.b "installed & fixed by Wepl",10
dc.b "version 1.7 "
IFD BARFLY
INCBIN "T:date"
ENDC
dc.b 0
EVEN
;============================================================================
_Start ; A0 = resident loader
;============================================================================
;save resload base
move.l a0,(_resload) ;save
move.l a0,a5 ;A5 = resload
;set start address for emulated exec.AllocMem
move.l #$400,(_chipptr)
;enable caches
move.l #WCPUF_NWA|WCPUF_Base_WT,d0
move.l #WCPUF_NWA|WCPUF_Base,d1
jsr (resload_SetCPU,a5)
;load main
lea (_exe,pc),a0 ;name
move.l (_chipptr),a1 ;address
move.l a1,a4 ;A4 = executable
jsr (resload_LoadFileDecrunch,a5)
;relocate main
move.l a4,a0 ;address
sub.l a1,a1 ;taglist
jsr (resload_Relocate,a5)
move.l d0,d4 ;D4 = executable length
add.l d0,(_chipptr)
;fix empty dbf loops
move.l a4,a0 ;start
lea (a0,d0.l),a1 ;end
lea (gl_ENDOF),a2 ;temp
bsr _dbffix
;check version & apply patches
lea (_pexe1,pc),a0 ;patchlist
cmp.l #$2f2d4,d4
beq .patch
lea (_pexe2,pc),a0 ;patchlist
cmp.l #$2cf58,d4
beq .patch
lea (_pexe3,pc),a0 ;patchlist
cmp.l #$a80d8,d4
beq .patch
pea TDREASON_WRONGVER
jmp (resload_Abort,a5)
.patch move.l a4,a1 ;address
jsr (resload_Patch,a5)
;init ints
lea (_vbi,pc),a0
move.l a0,($6c)
;start main
jmp ($3e,a4)
_pexe1 PL_START
PL_P $8b4e,_allocmem ;emulate
PL_S $276,$2a8-$276 ;disable os-stuff
PL_P $7b1a,_loader
PL_W $1ce2,$e841 ;lsr.w -> asr.w
PL_W $1ce4,$c3fc ;mulu -> muls
PL_W $1cfc,$d0c1 ;adda.l -> adda.w
PL_W $1e0e,$e841 ;lsr.w -> asr.w
PL_W $1e10,$c3fc ;mulu -> muls
PL_W $1e28,$d0c1 ;adda.l -> adda.w
PL_S $9764,$99fc-$9764 ;copylock
PL_END
_pexe2 PL_START
PL_P $8b56,_allocmem ;emulate
PL_S $276,$2a8-$276 ;disable os-stuff
PL_P $7b22,_loader
PL_W $1cbc,$e841 ;lsr.w -> asr.w
PL_W $1cbe,$c3fc ;mulu -> muls
PL_W $1cd6,$d0c1 ;adda.l -> adda.w
PL_W $1de8,$e841 ;lsr.w -> asr.w
PL_W $1dea,$c3fc ;mulu -> muls
PL_W $1e02,$d0c1 ;adda.l -> adda.w
PL_S $976c,$9a04-$976c ;copylock
PL_END
_pexe3 PL_START
PL_P $76fc,_allocmem ;emulate
PL_S $200,$254-$200 ;disable os-stuff
; PL_W $b48e,$4e73 ;jmp to org vbi -> rte
PL_S $750e,$86-$e ;skip os-restore
PL_S $75a8,10 ;skip open
PL_PS $75de,_loadercd
PL_S $7630,14+$14 ;skip os-save
PL_PS $330,_enabledma
PL_W $199c,$e841 ;lsr.w -> asr.w
PL_W $199e,$c3fc ;mulu -> muls
PL_W $19b0,$d0c1 ;adda.l -> adda.w
PL_W $1ac2,$e841 ;lsr.w -> asr.w
PL_W $1ac4,$c3fc ;mulu -> muls
PL_W $1ad6,$d0c1 ;adda.l -> adda.w
PL_END
;--------------------------------
_vbi move.w #INTF_VERTB,(_custom+intreq)
rte
;--------------------------------
_allocmem addq.l #7,d0 ;round up
and.b #$f8,d0
move.l (_chipptr),a1
add.l d0,(_chipptr)
IFEQ 0
move.l (_chipptr),d1
cmp.l (_upchip,pc),d1
blo .0
illegal
.0
ENDC
move.l a1,a0
lsr.l #3,d0
.clr clr.l (a0)+
clr.l (a0)+
subq.l #1,d0
bne .clr
move.l a1,d0
rts
;--------------------------------
_loader addq.l #4,a0 ;skip "df0:"
move.l a2,-(a7)
move.l (_resload),a2
jsr (resload_LoadFileDecrunch,a2)
move.l (a7)+,a2
moveq #0,d0 ;return code
rts
_loadercd addq.l #6,a0
move.l d2,a1
move.l (_resload),a2
jsr (resload_LoadFileDecrunch,a2)
add.l #14,(a7)
rts
;--------------------------------
_enabledma move.w #$c028,(intena,a6)
waitvb a6
move.w #$86e0!DMAF_RASTER,(dmacon,a6)
rts
;--------------------------------
_exe dc.b "exe",0
;============================================================================
INCLUDE sources:whdload/dbffix.s
;============================================================================
END