2024-04-18 03:35 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0003118SolidGold[WHDLoad Installs Games] slavepublic2018-10-12 12:47
Reportermodrobert 
Assigned ToStingRayProject InfoSolid Gold (Night Owl Design)
http://www.whdload.de/games/SolidGold.html
 
PrioritylowSeverityfeatureReproducibilityN/A
StatusclosedResolutionfixed 
Summary0003118: Joy1 fire button 1 for "jump" CUSTOM3 feature request
DescriptionI want to jump with the "normal" fire button, my joystick lack button 2 and using "joy up" for jumping doesn't feel right. :)

After playing around in HRTMon with WHDLoad running and the game (Solid Gold) loaded on my A1200, this patch worked...

Address: $FD43C12 (I guess this can change.)

Look for these bytes: $082e 0006 0016 57c0 0839 0007 00bf e001

btst #6,($16,a6)
seq d0
btst #7,($bfe001)


Replace with these bytes: $0839 0007 00bf e001 57c0 4e71 4e71 4e71

btst #7,($bfe001)
seq d0
nop
nop
nop

Additional InformationJoy0 is handled just a few bytes before Joy1 in the code, if you want to patch that also.
TagsNo tags attached.
MachineA1200
CPU68030
CPUSpeed33
ChipSetAGA
GFXCardNone
ChipMem2 MB
FastMem128 MB
WorkbenchOS 3.1
KickROM40 - Kick 3.1
KickSoftNone
WHDLoad18.0
imported
Attached Files
  • ? file icon SolidGold_WHD_mod.s (10,866 bytes) 2014-12-16 12:30 -
    ***************************************************************************
    *             /                                                           *
    *       _____.__ _                                         .___.          *
    *      /    /_____________.  _________.__________.________ |   |________  *
    *  ___/____      /    ____|_/         |         /|        \|   ._      /  *
    *  \     \/      \    \     \    /    |    :___/¯|    \    \   |/     /   *
    *   \_____________\___/_____/___/_____|____|     |____|\_____________/    *
    *     -========================/===========|______\================-      *
    *                                                                         *
    *   .---.----(*(        SOLID GOLD WHDLOAD SLAVE            )*)---.---.   *
    *   `-./                                                           \.-'   *
    *                                                                         *
    *                         (c)oded by StingRay                             *
    *                         --------------------                            *
    *                             January 2014                                *
    *                                                                         *
    *                                                                         *
    ***************************************************************************
    
    ***********************************
    *** History			***
    ***********************************
    
    ; 01-Jan-2014	- work started
    ;		- and finished a short while later
    
    
    	INCDIR	SOURCES:INCLUDE/
    	INCLUDE	WHDLoad.i
    	
    
    FLAGS		= WHDLF_NoError|WHDLF_ClearMem|WHDLF_EmulTrap
    DEBUGKEY	= $58		; F9
    QUITKEY		= $59		; F10
    DEBUG
    
    ; absolute skip
    PL_SA	MACRO
    	PL_S	\1,\2-(\1)
    	ENDM
    
    ; jsr+absolute skip
    PL_PSA	MACRO
    	PL_PS	\1,\2		; could use PSS here but it fills memory
    	PL_S	\1+6,\3-(\1+6)	; with NOPS so we use standard skip
    	ENDM
    
    
    HEADER	SLAVE_HEADER		; ws_security + ws_ID
    	dc.w	17		; ws_version
    	dc.w	FLAGS		; flags
    	dc.l	524288		; ws_BaseMemSize
    	dc.l	0		; ws_ExecInstall
    	dc.w	Patch-HEADER	; ws_GameLoader
    	IFD	DEBUG
    	dc.w	.dir-HEADER	; ws_CurrentDir
    	ELSE
    	dc.w	0		; ws_CurrentDir
    	ENDC
    	dc.w	0		; ws_DontCache
    	dc.b	0		; ws_KeyDebug
    	dc.b	QUITKEY		; ws_KeyExit
    	dc.l	524288		; ws_ExpMem
    	dc.w	.name-HEADER	; ws_name
    	dc.w	.copy-HEADER	; ws_copy
    	dc.w	.info-HEADER	; ws_info
    
    ; v16
    	dc.w	0		; ws_kickname
    	dc.l	0		; ws_kicksize
    	dc.w	0		; ws_kickcrc
    
    ; v17
    	dc.w	.config-HEADER	; ws_config
    
    
    .config	dc.b	"C1:B:Unlimited Lives;"
    	dc.b	"C2:B:Enable In-Game Keys;"
    	dc.b	"C3:B:Jump Joy1 Button1;"
    	dc.b	"BW"
    	dc.b	0
    
    	IFD	DEBUG
    .dir	dc.b	"SOURCES:WHD_Slaves/SolidGold",0
    	ENDC
    
    .name	dc.b	"Solid Gold",0
    .copy	dc.b	"2013 Night Owl Design",0
    .info	dc.b	"installed by StingRay/[S]carab^Scoopex",10
    	IFD	DEBUG
    	dc.b	"DEBUG!!! "
    	ENDC
    	dc.b	"Version 1.00 (01.01.2014)",0
    HiName	dc.b	"SolidGold.high",0
    	CNOP	0,2
    
    
    TAGLIST		dc.l	WHDLTAG_ATTNFLAGS_GET
    CPUFLAGS	dc.l	0
    		dc.l	WHDLTAG_CUSTOM1_GET
    LIVESTRAINER	dc.l	0
    		dc.l	WHDLTAG_CUSTOM2_GET
    KEYS		dc.l	0
    		dc.l	WHDLTAG_CUSTOM3_GET
    BUTTON1		dc.l	0
    		dc.l	WHDLTAG_BUTTONWAIT_GET
    BUTTONWAIT	dc.l	0
    		dc.l	TAG_END
    
    
    resload	dc.l	0
    
    Patch	lea	resload(pc),a1
    	move.l	a0,(a1)
    	move.l	a0,a2
    
    	lea	TAGLIST(pc),a0
    	jsr	resload_Control(a2)
    
    
    ; install keyboard irq
    	bsr	SetLev2IRQ
    
    ; load boot (needed for title picture)
    	move.l	#$400,d0
    	move.l	#$2400,d1
    	moveq	#1,d2
    	lea	$70000,a0
    	move.l	a0,a5
    	move.l	d1,d5
    	jsr	resload_DiskLoad(a2)
    	move.l	a5,a0
    	move.l	d5,d0
    	jsr	resload_CRC16(a2)
    	cmp.w	#$fdd4,d0
    	bne.b	.wrongver
    
    	move.l	a5,a0
    	lea	$72400,a1
    	bsr	BK_DECRUNCH
    
    	lea	PLTITLE(pc),a0
    	lea	$72400,a1
    	move.l	resload(pc),a2
    	jsr	resload_Patch(a2)
    
    	jsr	$72400+$1d0		; display tite picture
    
    
    
    ; load game
    	move.l	#$2800,d0
    	move.l	#$7e1c+12,d1
    	lea	$1000.w,a0
    	move.l	a0,a5
    	move.l	d0,d5
    	moveq	#1,d2
    	jsr	resload_DiskLoad(a2)
    
    	move.l	a5,a0
    	move.l	d5,d0
    	jsr	resload_CRC16(a2)
    	cmp.w	#$d5a6,d0
    	beq.b	.ok
    .wrongver
    	pea	(TDREASON_WRONGVER).w
    	bra.w	EXIT
    
    .ok
    
    ; decrunch
    	move.l	a5,a0
    	move.l	HEADER+ws_ExpMem(pc),a1
    	bsr	BK_DECRUNCH
    
    
    ; relocate
    	move.l	HEADER+ws_ExpMem(pc),a1	; reloc entries
    	lea	$a6*4(a1),a2		; start of code
    	move.l	a2,a5
    
    .reloc	move.l	a2,d0
    	move.l	(a1)+,d2		; number of reloc entries
    	beq.b	.done
    .reloop	move.l	(a1)+,d1
    	add.l	d0,(a2,d1.l)
    	subq.l	#1,d2
    	bne.b	.reloop
    
    .done
    
    	move.l	LIVESTRAINER(pc),d0
    	beq.b	.nolives
    	move.w	#$7000,$25fa(a5)
    .nolives
    	
    	move.l	BUTTON1(pc),d0		; patch for joystick1 button1 jump
    	beq.b	.nobutton1
    	move.w  #$0839,$97a(a5)		;btst #6,$16(a6)   => btst #7,($bfe001)
    	move.w	#$0007,$97a+2(a5)	;
    	move.w	#$00BF,$97a+4(a5)	;
    	move.w	#$E001,$97a+6(a5)	;seq d0			
    	move.w	#$57c0,$97a+8(a5)	;                  => seq d0
    	move.w	#$4e71,$97a+10(a5)	;btst #7,($bfe001) => nop
    	move.w	#$4e71,$97a+12(a5)	;                  => nop
    	move.w	#$4e71,$97a+14(a5)	;                  => nop
    .nobutton1
    
    ; patch	
    	lea	PLGAME(pc),a0
    	move.l	a5,a1
    	move.l	resload(pc),a2
    	jsr	resload_Patch(a2)
    
    ; and start
    	move.l	BUTTONWAIT(pc),d0
    	beq.b	.nowait
    .wait	btst	#7,$bfe001
    	bne.b	.wait
    
    .nowait	lea	$dff000,a6
    	lea	$72400+$2e0,a0		; palette title picture
    	jmp	(a5)
    
    
    QUIT	pea	(TDREASON_OK).w
    EXIT	move.l	resload(pc),a2
    	bsr.b	KillSys
    	jmp	resload_Abort(a2)
    
    
    KillSys	move.w	#$7fff,$dff09a
    	bsr	WaitRaster
    	move.w	#$7fff,$dff096
    	move.w	#$7fff,$dff09c
    	rts
    
    PLTITLE	PL_START
    	PL_SA	$238,$23c		; skip _LVOWaitBlit
    	PL_R	$24e
    	PL_END
    	
    
    
    PLGAME	PL_START
    	PL_SA	$16,$1e			; skip CPU check ect.
    	PL_R	$258			; disable loader init
    	PL_P	$4d4,.load
    	PL_P	$22,QUIT
    	PL_SA	$304,$34e		; skip disk check
    	PL_PS	$a58,.keys
    	PL_PSA	$1e40,.loadhiscores,$1e4e
    	PL_PSA	$63e,.savehiscores,$698
    	PL_PS	$2874,.bw
    	PL_END
    
    .bw	move.l	BUTTONWAIT(pc),d0
    	beq.b	.nowait
    	btst	#7,$bfe001
    	beq.b	.bw
    	
    .bw2	btst	#7,$bfe001
    	bne.b	.bw2
    
    .nowait	moveq	#0,d0
    	move.b	3(a2),d0
    	rts
    
    ; a0: buffer
    .savehiscores
    	move.l	LIVESTRAINER(pc),d0	; high scores will not be
    	bne.b	.nohi			; saved if any trainers are used
    	move.l	KEYS(pc),d0
    	bne.b	.nohi
    
    	move.l	a0,a1
    	lea	HiName(pc),a0
    	move.l	#512,d0
    	move.l	resload(pc),a2
    	jsr	resload_SaveFile(a2)
    
    .nohi	moveq	#0,d0
    	rts
    
    
    .loadhiscores
    	move.l	resload(pc),a3
    
    	lea	HiName(pc),a0
    	jsr	resload_GetFileSize(a3)
    	tst.l	d0
    	beq.b	.loadfromdisk
    	lea	HiName(pc),a0
    	move.l	a2,a1
    	jmp	resload_LoadFile(a3)
    
    .loadfromdisk
    	move.w	#$6d5,d0
    	moveq	#1,d1
    	move.l	a2,a0
    	bra.b	.load
    
    
    .keys	or.b	#1<<6,$e00(a0)		; original code
    	move.b	d0,d1
    	ror.b	#1,d1
    	not.b	d1
    	cmp.b	HEADER+ws_keyexit(pc),d1
    	beq.w	QUIT
    
    	movem.l	d2/d3,-(a7)
    
    	move.l	KEYS(pc),d2
    	beq.b	.nokeys
    	cmp.b	#$36,d1			; N-skip level
    	bne.b	.nolevskip
    	sf	-$22d3(a4)
    	st	-$1c84(a4)
    .nolevskip
    	cmp.b	#$28,d1			; L-add 1 life
    	bne.b	.nolife
    	moveq	#1,d3
    	move.b	-$22d5(a4),d2
    	cmp.b	#$99,d2
    	beq.b	.nolife
    	abcd	d3,d2
    	move.b	d2,-$22d5(a4)
    
    .nolife
    
    .nokeys	movem.l	(a7)+,d2/d3
    
    	rts	
    
    
    .load	movem.l	d1-a6,-(a7)
    	mulu.w	#512,d0
    	mulu.w	#512,d1
    	moveq	#1,d2
    	move.l	resload(pc),a2
    	jsr	resload_DiskLoad(a2)
    	moveq	#0,d0			; no errors
    	movem.l	(a7)+,d1-a6
    	rts
    
    
    WaitRaster
    	move.l	d0,-(a7)
    .wait	move.l	$dff004,d0
    	and.l	#$1ff00,d0
    	cmp.l	#303<<8,d0
    	bne.b	.wait
    .wait2	move.l	$dff004,d0
    	and.l	#$1ff00,d0
    	cmp.l	#303<<8,d0
    	beq.b	.wait2
    	move.l	(a7)+,d0
    	rts
    
    ***********************************
    *** Level 2 IRQ			***
    ***********************************
    
    SetLev2IRQ
    	pea	.int(pc)
    	move.l	(a7)+,$68.w
    
    	move.b	#1<<7|1<<3,$bfed01		; enable keyboard interrupts
    	tst.b	$bfed01				; clear all CIA A interrupts
    	and.b	#~(1<<6),$bfee01		; set input mode
    
    	move.w	#1<<3,$dff09c			; clear ports interrupt
    	move.w	#1<<15|1<<14|1<<3,$dff09a	; and enable it
    	rts
    
    .int	movem.l	d0-d1/a0-a2,-(a7)
    	lea	$dff000,a0
    	lea	$bfe001,a1
    
    
    	btst	#3,$1e+1(a0)			; PORTS irq?
    	beq.b	.end
    	btst	#3,$d00(a1)			; KBD irq?
    	beq.b	.end
    
    	moveq	#0,d0
    	move.b	$c00(a1),d0
    	lea	Key(pc),a2
    	move.b	d0,(a2)+
    	not.b	d0
    	ror.b	d0
    	move.b	d0,(a2)
    
    	move.l	KbdCust(pc),d1
    	beq.b	.nocustom
    	movem.l	d0-a6,-(a7)
    	move.l	d1,a0
    	jsr	(a0)
    	movem.l	(a7)+,d0-a6
    .nocustom	
    	
    
    
    	or.b	#1<<6,$e00(a1)			; set output mode
    
    
    
    	cmp.b	HEADER+ws_keydebug(pc),d0	
    	bne.b	.nodebug
    	movem.l	(a7)+,d0-d1/a0-a2
    	move.w	(a7),6(a7)			; sr
    	move.l	2(a7),(a7)			; pc
    	clr.w	4(a7)				; ext.l sr
    	bra.b	.debug
    
    
    .nodebug
    	cmp.b	HEADER+ws_keyexit(pc),d0
    	beq.b	.exit
    	
    
    .nokeys	moveq	#3-1,d1
    .loop	move.b	$6(a0),d0
    .wait	cmp.b	$6(a0),d0
    	beq.b	.wait
    	dbf	d1,.loop
    
    
    	and.b	#~(1<<6),$e00(a1)	; set input mode
    .end	move.w	#1<<3,$9c(a0)
    	move.w	#1<<3,$9c(a0)		; twice to avoid a4k hw bug
    	movem.l	(a7)+,d0-d1/a0-a2
    	rte
    
    .debug	pea	(TDREASON_DEBUG).w
    .quit	bsr	KillSys
    	move.l	resload(pc),-(a7)
    	addq.l	#resload_Abort,(a7)
    	rts
    .exit	pea	(TDREASON_OK).w
    	bra.b	.quit
    
    
    Key	dc.b	0
    RawKey	dc.b	0
    KbdCust	dc.l	0			; ptr to custom routine
    
    
    
    ; Bytekiller decruncher
    ; resourced and adapted by stingray
    ;
    ; a0.l: source
    ; a1.l: destination
    
    BK_DECRUNCH
    	bsr.b	.decrunch
    	tst.l	d5
    	beq.b	.ok
    
    ; checksum doesn't match, file corrupt
    	pea	ErrText(pc)
    	pea	(TDREASON_FAILMSG).w
    	bra.w	EXIT
    
    .ok	rts
    
    
    .decrunch
    	move.l	(a0)+,d0		; crunched length
    	move.l	(a0)+,d1		; decrunched length
    	move.l	(a0)+,d5		; checksum
    	add.l	d0,a0			; end of crunched data
    	lea	(a1,d1.l),a2		; end of decrunched data
    	move.l	-(a0),d0		; get first long
    	eor.l	d0,d5
    .loop	lsr.l	#1,d0
    	bne.b	.nonew1
    	bsr.b	.nextlong
    .nonew1	bcs.b	.getcmd
    
    	moveq	#8,d1
    	moveq	#1,d3
    	lsr.l	#1,d0
    	bne.b	.nonew2
    	bsr.b	.nextlong
    .nonew2	bcs.b	.copyunpacked
    
    ; data is packed, unpack and copy
    	moveq	#3,d1			; next 3 bits: length of packed data
    	clr.w	d4
    
    ; d1: number of bits to get from stream
    ; d4: length
    .packed	bsr.b	.getbits
    	move.w	d2,d3
    	add.w	d4,d3
    .copypacked
    	moveq	#8-1,d1
    .getbyte
    	lsr.l	#1,d0
    	bne.b	.nonew3
    	bsr.b	.nextlong
    .nonew3	addx.l	d2,d2
    	dbf	d1,.getbyte
    
    	move.b	d2,-(a2)
    	dbf	d3,.copypacked
    	bra.b	.next
    
    .ispacked
    	moveq	#8,d1
    	moveq	#8,d4
    	bra.b	.packed
    
    .getcmd	moveq	#2,d1			; next 2 bits: command
    	bsr.b	.getbits
    	cmp.b	#2,d2			; %10: unpacked data follows
    	blt.b	.notpacked
    	cmp.b	#3,d2			; %11: packed data follows
    	beq.b	.ispacked
    
    ; %10
    	moveq	#8,d1			; next byte:
    	bsr.b	.getbits		; length of unpacked data
    	move.w	d2,d3			; length -> d3
    	moveq	#12,d1
    	bra.b	.copyunpacked
    
    ; %00 or %01
    .notpacked
    	moveq	#9,d1
    	add.w	d2,d1
    	addq.w	#2,d2
    	move.w	d2,d3
    
    .copyunpacked
    	bsr.b	.getbits		; get offset (d2)
    ;.copy	subq.w	#1,a2
    ;	move.b	(a2,d2.w),(a2)
    ;	dbf	d3,.copy
    
    ; optimised version of the code above
    	subq.w	#1,d2
    .copy	move.b	(a2,d2.w),-(a2)
    	dbf	d3,.copy
    
    .next
    ;	move.l	CUSTOM1(pc),d1
    ;	beq.b	.noflash
    ;	move.w	a0,$dff186
    .noflash
    
    	cmp.l	a2,a1
    	blt.b	.loop
    	rts
    
    .nextlong
    	move.l	-(a0),d0
    	eor.l	d0,d5
    	move.w	#$10,ccr
    	roxr.l	#1,d0
    	rts
    
    ; d1.w: number of bits to get
    ; ----
    ; d2.l: bit stream
    
    .getbits
    	subq.w	#1,d1
    	clr.w	d2
    .getbit	lsr.l	#1,d0
    	bne.b	.nonew
    	move.l	-(a0),d0
    	eor.l	d0,d5
    	move.w	#$10,ccr
    	roxr.l	#1,d0
    .nonew	addx.l	d2,d2
    	dbf	d1,.getbit
    	rts
    
    
    DEC_DESTINATION	dc.l	0
    ErrText	dc.b	"Decrunching failed, file corrupt!",0
    
    
    
    ? file icon SolidGold_WHD_mod.s (10,866 bytes) 2014-12-16 12:30 +
  • ? file icon SolidGold_WHD_mod2.s (10,569 bytes) 2014-12-16 19:32 -
    ***************************************************************************
    *             /                                                           *
    *       _____.__ _                                         .___.          *
    *      /    /_____________.  _________.__________.________ |   |________  *
    *  ___/____      /    ____|_/         |         /|        \|   ._      /  *
    *  \     \/      \    \     \    /    |    :___/¯|    \    \   |/     /   *
    *   \_____________\___/_____/___/_____|____|     |____|\_____________/    *
    *     -========================/===========|______\================-      *
    *                                                                         *
    *   .---.----(*(        SOLID GOLD WHDLOAD SLAVE            )*)---.---.   *
    *   `-./                                                           \.-'   *
    *                                                                         *
    *                         (c)oded by StingRay                             *
    *                         --------------------                            *
    *                             January 2014                                *
    *                                                                         *
    *                                                                         *
    ***************************************************************************
    
    ***********************************
    *** History			***
    ***********************************
    
    ; 01-Jan-2014	- work started
    ;		- and finished a short while later
    
    
    	INCDIR	SOURCES:INCLUDE/
    	INCLUDE	WHDLoad.i
    	
    
    FLAGS		= WHDLF_NoError|WHDLF_ClearMem|WHDLF_EmulTrap
    DEBUGKEY	= $58		; F9
    QUITKEY		= $59		; F10
    DEBUG
    
    ; absolute skip
    PL_SA	MACRO
    	PL_S	\1,\2-(\1)
    	ENDM
    
    ; jsr+absolute skip
    PL_PSA	MACRO
    	PL_PS	\1,\2		; could use PSS here but it fills memory
    	PL_S	\1+6,\3-(\1+6)	; with NOPS so we use standard skip
    	ENDM
    
    
    HEADER	SLAVE_HEADER		; ws_security + ws_ID
    	dc.w	17		; ws_version
    	dc.w	FLAGS		; flags
    	dc.l	524288		; ws_BaseMemSize
    	dc.l	0		; ws_ExecInstall
    	dc.w	Patch-HEADER	; ws_GameLoader
    	IFD	DEBUG
    	dc.w	.dir-HEADER	; ws_CurrentDir
    	ELSE
    	dc.w	0		; ws_CurrentDir
    	ENDC
    	dc.w	0		; ws_DontCache
    	dc.b	0		; ws_KeyDebug
    	dc.b	QUITKEY		; ws_KeyExit
    	dc.l	524288		; ws_ExpMem
    	dc.w	.name-HEADER	; ws_name
    	dc.w	.copy-HEADER	; ws_copy
    	dc.w	.info-HEADER	; ws_info
    
    ; v16
    	dc.w	0		; ws_kickname
    	dc.l	0		; ws_kicksize
    	dc.w	0		; ws_kickcrc
    
    ; v17
    	dc.w	.config-HEADER	; ws_config
    
    
    .config	dc.b	"C1:B:Unlimited Lives;"
    	dc.b	"C2:B:Enable In-Game Keys;"
    	dc.b	"C3:B:Jump Joy1 Button1;"
    	dc.b	"BW"
    	dc.b	0
    
    	IFD	DEBUG
    .dir	dc.b	"SOURCES:WHD_Slaves/SolidGold",0
    	ENDC
    
    .name	dc.b	"Solid Gold",0
    .copy	dc.b	"2013 Night Owl Design",0
    .info	dc.b	"installed by StingRay/[S]carab^Scoopex",10
    	IFD	DEBUG
    	dc.b	"DEBUG!!! "
    	ENDC
    	dc.b	"Version 1.00 (01.01.2014)",0
    HiName	dc.b	"SolidGold.high",0
    	CNOP	0,2
    
    
    TAGLIST		dc.l	WHDLTAG_ATTNFLAGS_GET
    CPUFLAGS	dc.l	0
    		dc.l	WHDLTAG_CUSTOM1_GET
    LIVESTRAINER	dc.l	0
    		dc.l	WHDLTAG_CUSTOM2_GET
    KEYS		dc.l	0
    		dc.l	WHDLTAG_CUSTOM3_GET
    BUTTONJMP   dc.l	0
    		dc.l	WHDLTAG_BUTTONWAIT_GET
    BUTTONWAIT	dc.l	0
    		dc.l	TAG_END
    
    
    resload	dc.l	0
    
    Patch	lea	resload(pc),a1
    	move.l	a0,(a1)
    	move.l	a0,a2
    
    	lea	TAGLIST(pc),a0
    	jsr	resload_Control(a2)
    
    
    ; install keyboard irq
    	bsr	SetLev2IRQ
    
    ; load boot (needed for title picture)
    	move.l	#$400,d0
    	move.l	#$2400,d1
    	moveq	#1,d2
    	lea	$70000,a0
    	move.l	a0,a5
    	move.l	d1,d5
    	jsr	resload_DiskLoad(a2)
    	move.l	a5,a0
    	move.l	d5,d0
    	jsr	resload_CRC16(a2)
    	cmp.w	#$fdd4,d0
    	bne.b	.wrongver
    
    	move.l	a5,a0
    	lea	$72400,a1
    	bsr	BK_DECRUNCH
    
    	lea	PLTITLE(pc),a0
    	lea	$72400,a1
    	move.l	resload(pc),a2
    	jsr	resload_Patch(a2)
    
    	jsr	$72400+$1d0		; display tite picture
    
    
    
    ; load game
    	move.l	#$2800,d0
    	move.l	#$7e1c+12,d1
    	lea	$1000.w,a0
    	move.l	a0,a5
    	move.l	d0,d5
    	moveq	#1,d2
    	jsr	resload_DiskLoad(a2)
    
    	move.l	a5,a0
    	move.l	d5,d0
    	jsr	resload_CRC16(a2)
    	cmp.w	#$d5a6,d0
    	beq.b	.ok
    .wrongver
    	pea	(TDREASON_WRONGVER).w
    	bra.w	EXIT
    
    .ok
    
    ; decrunch
    	move.l	a5,a0
    	move.l	HEADER+ws_ExpMem(pc),a1
    	bsr	BK_DECRUNCH
    
    
    ; relocate
    	move.l	HEADER+ws_ExpMem(pc),a1	; reloc entries
    	lea	$a6*4(a1),a2		; start of code
    	move.l	a2,a5
    
    .reloc	move.l	a2,d0
    	move.l	(a1)+,d2		; number of reloc entries
    	beq.b	.done
    .reloop	move.l	(a1)+,d1
    	add.l	d0,(a2,d1.l)
    	subq.l	#1,d2
    	bne.b	.reloop
    
    .done
    
    	move.l	LIVESTRAINER(pc),d0
    	beq.b	.nolives
    	move.w	#$7000,$25fa(a5)
    .nolives
    	
    	move.l	BUTTONJMP(pc),d0		;patch for joystick1 button1 jump
    	beq.b	.nobutton1
        move.w  #$DAAA,$2f9e(a5)    ;tst.b (-$2555,a4) => tst.b (-$2556,a4)
    .nobutton1
    
    ; patch	
    	lea	PLGAME(pc),a0
    	move.l	a5,a1
    	move.l	resload(pc),a2
    	jsr	resload_Patch(a2)
    
    ; and start
    	move.l	BUTTONWAIT(pc),d0
    	beq.b	.nowait
    .wait	btst	#7,$bfe001
    	bne.b	.wait
    
    .nowait	lea	$dff000,a6
    	lea	$72400+$2e0,a0		; palette title picture
    	jmp	(a5)
    
    
    QUIT	pea	(TDREASON_OK).w
    EXIT	move.l	resload(pc),a2
    	bsr.b	KillSys
    	jmp	resload_Abort(a2)
    
    
    KillSys	move.w	#$7fff,$dff09a
    	bsr	WaitRaster
    	move.w	#$7fff,$dff096
    	move.w	#$7fff,$dff09c
    	rts
    
    PLTITLE	PL_START
    	PL_SA	$238,$23c		; skip _LVOWaitBlit
    	PL_R	$24e
    	PL_END
    	
    
    
    PLGAME	PL_START
    	PL_SA	$16,$1e			; skip CPU check ect.
    	PL_R	$258			; disable loader init
    	PL_P	$4d4,.load
    	PL_P	$22,QUIT
    	PL_SA	$304,$34e		; skip disk check
    	PL_PS	$a58,.keys
    	PL_PSA	$1e40,.loadhiscores,$1e4e
    	PL_PSA	$63e,.savehiscores,$698
    	PL_PS	$2874,.bw
    	PL_END
    
    .bw	move.l	BUTTONWAIT(pc),d0
    	beq.b	.nowait
    	btst	#7,$bfe001
    	beq.b	.bw
    	
    .bw2	btst	#7,$bfe001
    	bne.b	.bw2
    
    .nowait	moveq	#0,d0
    	move.b	3(a2),d0
    	rts
    
    ; a0: buffer
    .savehiscores
    	move.l	LIVESTRAINER(pc),d0	; high scores will not be
    	bne.b	.nohi			; saved if any trainers are used
    	move.l	KEYS(pc),d0
    	bne.b	.nohi
    
    	move.l	a0,a1
    	lea	HiName(pc),a0
    	move.l	#512,d0
    	move.l	resload(pc),a2
    	jsr	resload_SaveFile(a2)
    
    .nohi	moveq	#0,d0
    	rts
    
    
    .loadhiscores
    	move.l	resload(pc),a3
    
    	lea	HiName(pc),a0
    	jsr	resload_GetFileSize(a3)
    	tst.l	d0
    	beq.b	.loadfromdisk
    	lea	HiName(pc),a0
    	move.l	a2,a1
    	jmp	resload_LoadFile(a3)
    
    .loadfromdisk
    	move.w	#$6d5,d0
    	moveq	#1,d1
    	move.l	a2,a0
    	bra.b	.load
    
    
    .keys	or.b	#1<<6,$e00(a0)		; original code
    	move.b	d0,d1
    	ror.b	#1,d1
    	not.b	d1
    	cmp.b	HEADER+ws_keyexit(pc),d1
    	beq.w	QUIT
    
    	movem.l	d2/d3,-(a7)
    
    	move.l	KEYS(pc),d2
    	beq.b	.nokeys
    	cmp.b	#$36,d1			; N-skip level
    	bne.b	.nolevskip
    	sf	-$22d3(a4)
    	st	-$1c84(a4)
    .nolevskip
    	cmp.b	#$28,d1			; L-add 1 life
    	bne.b	.nolife
    	moveq	#1,d3
    	move.b	-$22d5(a4),d2
    	cmp.b	#$99,d2
    	beq.b	.nolife
    	abcd	d3,d2
    	move.b	d2,-$22d5(a4)
    
    .nolife
    
    .nokeys	movem.l	(a7)+,d2/d3
    
    	rts	
    
    
    .load	movem.l	d1-a6,-(a7)
    	mulu.w	#512,d0
    	mulu.w	#512,d1
    	moveq	#1,d2
    	move.l	resload(pc),a2
    	jsr	resload_DiskLoad(a2)
    	moveq	#0,d0			; no errors
    	movem.l	(a7)+,d1-a6
    	rts
    
    
    WaitRaster
    	move.l	d0,-(a7)
    .wait	move.l	$dff004,d0
    	and.l	#$1ff00,d0
    	cmp.l	#303<<8,d0
    	bne.b	.wait
    .wait2	move.l	$dff004,d0
    	and.l	#$1ff00,d0
    	cmp.l	#303<<8,d0
    	beq.b	.wait2
    	move.l	(a7)+,d0
    	rts
    
    ***********************************
    *** Level 2 IRQ			***
    ***********************************
    
    SetLev2IRQ
    	pea	.int(pc)
    	move.l	(a7)+,$68.w
    
    	move.b	#1<<7|1<<3,$bfed01		; enable keyboard interrupts
    	tst.b	$bfed01				; clear all CIA A interrupts
    	and.b	#~(1<<6),$bfee01		; set input mode
    
    	move.w	#1<<3,$dff09c			; clear ports interrupt
    	move.w	#1<<15|1<<14|1<<3,$dff09a	; and enable it
    	rts
    
    .int	movem.l	d0-d1/a0-a2,-(a7)
    	lea	$dff000,a0
    	lea	$bfe001,a1
    
    
    	btst	#3,$1e+1(a0)			; PORTS irq?
    	beq.b	.end
    	btst	#3,$d00(a1)			; KBD irq?
    	beq.b	.end
    
    	moveq	#0,d0
    	move.b	$c00(a1),d0
    	lea	Key(pc),a2
    	move.b	d0,(a2)+
    	not.b	d0
    	ror.b	d0
    	move.b	d0,(a2)
    
    	move.l	KbdCust(pc),d1
    	beq.b	.nocustom
    	movem.l	d0-a6,-(a7)
    	move.l	d1,a0
    	jsr	(a0)
    	movem.l	(a7)+,d0-a6
    .nocustom	
    	
    
    
    	or.b	#1<<6,$e00(a1)			; set output mode
    
    
    
    	cmp.b	HEADER+ws_keydebug(pc),d0	
    	bne.b	.nodebug
    	movem.l	(a7)+,d0-d1/a0-a2
    	move.w	(a7),6(a7)			; sr
    	move.l	2(a7),(a7)			; pc
    	clr.w	4(a7)				; ext.l sr
    	bra.b	.debug
    
    
    .nodebug
    	cmp.b	HEADER+ws_keyexit(pc),d0
    	beq.b	.exit
    	
    
    .nokeys	moveq	#3-1,d1
    .loop	move.b	$6(a0),d0
    .wait	cmp.b	$6(a0),d0
    	beq.b	.wait
    	dbf	d1,.loop
    
    
    	and.b	#~(1<<6),$e00(a1)	; set input mode
    .end	move.w	#1<<3,$9c(a0)
    	move.w	#1<<3,$9c(a0)		; twice to avoid a4k hw bug
    	movem.l	(a7)+,d0-d1/a0-a2
    	rte
    
    .debug	pea	(TDREASON_DEBUG).w
    .quit	bsr	KillSys
    	move.l	resload(pc),-(a7)
    	addq.l	#resload_Abort,(a7)
    	rts
    .exit	pea	(TDREASON_OK).w
    	bra.b	.quit
    
    
    Key	dc.b	0
    RawKey	dc.b	0
    KbdCust	dc.l	0			; ptr to custom routine
    
    
    
    ; Bytekiller decruncher
    ; resourced and adapted by stingray
    ;
    ; a0.l: source
    ; a1.l: destination
    
    BK_DECRUNCH
    	bsr.b	.decrunch
    	tst.l	d5
    	beq.b	.ok
    
    ; checksum doesn't match, file corrupt
    	pea	ErrText(pc)
    	pea	(TDREASON_FAILMSG).w
    	bra.w	EXIT
    
    .ok	rts
    
    
    .decrunch
    	move.l	(a0)+,d0		; crunched length
    	move.l	(a0)+,d1		; decrunched length
    	move.l	(a0)+,d5		; checksum
    	add.l	d0,a0			; end of crunched data
    	lea	(a1,d1.l),a2		; end of decrunched data
    	move.l	-(a0),d0		; get first long
    	eor.l	d0,d5
    .loop	lsr.l	#1,d0
    	bne.b	.nonew1
    	bsr.b	.nextlong
    .nonew1	bcs.b	.getcmd
    
    	moveq	#8,d1
    	moveq	#1,d3
    	lsr.l	#1,d0
    	bne.b	.nonew2
    	bsr.b	.nextlong
    .nonew2	bcs.b	.copyunpacked
    
    ; data is packed, unpack and copy
    	moveq	#3,d1			; next 3 bits: length of packed data
    	clr.w	d4
    
    ; d1: number of bits to get from stream
    ; d4: length
    .packed	bsr.b	.getbits
    	move.w	d2,d3
    	add.w	d4,d3
    .copypacked
    	moveq	#8-1,d1
    .getbyte
    	lsr.l	#1,d0
    	bne.b	.nonew3
    	bsr.b	.nextlong
    .nonew3	addx.l	d2,d2
    	dbf	d1,.getbyte
    
    	move.b	d2,-(a2)
    	dbf	d3,.copypacked
    	bra.b	.next
    
    .ispacked
    	moveq	#8,d1
    	moveq	#8,d4
    	bra.b	.packed
    
    .getcmd	moveq	#2,d1			; next 2 bits: command
    	bsr.b	.getbits
    	cmp.b	#2,d2			; %10: unpacked data follows
    	blt.b	.notpacked
    	cmp.b	#3,d2			; %11: packed data follows
    	beq.b	.ispacked
    
    ; %10
    	moveq	#8,d1			; next byte:
    	bsr.b	.getbits		; length of unpacked data
    	move.w	d2,d3			; length -> d3
    	moveq	#12,d1
    	bra.b	.copyunpacked
    
    ; %00 or %01
    .notpacked
    	moveq	#9,d1
    	add.w	d2,d1
    	addq.w	#2,d2
    	move.w	d2,d3
    
    .copyunpacked
    	bsr.b	.getbits		; get offset (d2)
    ;.copy	subq.w	#1,a2
    ;	move.b	(a2,d2.w),(a2)
    ;	dbf	d3,.copy
    
    ; optimised version of the code above
    	subq.w	#1,d2
    .copy	move.b	(a2,d2.w),-(a2)
    	dbf	d3,.copy
    
    .next
    ;	move.l	CUSTOM1(pc),d1
    ;	beq.b	.noflash
    ;	move.w	a0,$dff186
    .noflash
    
    	cmp.l	a2,a1
    	blt.b	.loop
    	rts
    
    .nextlong
    	move.l	-(a0),d0
    	eor.l	d0,d5
    	move.w	#$10,ccr
    	roxr.l	#1,d0
    	rts
    
    ; d1.w: number of bits to get
    ; ----
    ; d2.l: bit stream
    
    .getbits
    	subq.w	#1,d1
    	clr.w	d2
    .getbit	lsr.l	#1,d0
    	bne.b	.nonew
    	move.l	-(a0),d0
    	eor.l	d0,d5
    	move.w	#$10,ccr
    	roxr.l	#1,d0
    .nonew	addx.l	d2,d2
    	dbf	d1,.getbit
    	rts
    
    
    DEC_DESTINATION	dc.l	0
    ErrText	dc.b	"Decrunching failed, file corrupt!",0
    
    
    
    ? file icon SolidGold_WHD_mod2.s (10,569 bytes) 2014-12-16 19:32 +
  • ? file icon SolidGold.Slave (1,392 bytes) 2015-01-18 16:16

-Relationships
+Relationships

-Notes

note ~0004127

modrobert (reporter)

Looks like the "Add Note" function screwed up the formatting in the patch, uploaded the modified slave source as attachment instead.

note ~0004128

modrobert (reporter)

Last edited: 2014-12-16 15:01

View 2 revisions

Nice, my rookie patch screwed up the main menu, each menu entry is one position out of order due to the joy1 button1 patch...hehe.

note ~0004129

modrobert (reporter)

OK, think I nailed it now, this time the patch is one word.

move.w #$DAAA,$2f9e(a5) ;tst.b (-$2555,a4) => tst.b (-$2556,a4)

I have uploaded SolidGold_WHD_mod2.s which should work.

note ~0004193

modrobert (reporter)

I've been testing SolidGold.Slave for a while now, seems to work, added it here as an attachment if anyone else wants it.

note ~0004194

Retroplay (reporter)

Nice it works great, thank you.

note ~0005143

StingRay (developer)

Updated the patch and added option to jump with fire, using joystick up to jump will still work when this option is enabled!
+Notes

-Issue History
Date Modified Username Field Change
2014-12-15 22:10 modrobert New Issue
2014-12-16 12:30 modrobert File Added: SolidGold_WHD_mod.s
2014-12-16 12:32 modrobert Note Added: 0004127
2014-12-16 15:01 modrobert Note Added: 0004128
2014-12-16 15:01 modrobert Note Edited: 0004128 View Revisions
2014-12-16 19:32 modrobert File Added: SolidGold_WHD_mod2.s
2014-12-16 19:34 modrobert Note Added: 0004129
2015-01-18 16:16 modrobert File Added: SolidGold.Slave
2015-01-18 16:18 modrobert Note Added: 0004193
2015-01-18 21:44 Retroplay Note Added: 0004194
2015-01-19 19:55 Wepl Assigned To => StingRay
2015-01-19 19:55 Wepl Status new => assigned
2016-08-02 12:14 StingRay Note Added: 0005143
2016-08-02 12:14 StingRay Status assigned => resolved
2016-08-02 12:14 StingRay Resolution open => fixed
2018-10-12 12:47 StingRay Status resolved => closed
+Issue History