View Single Post
Old 23 January 2006, 19:48   #1
Joe Maroni
Moderator
 
Joe Maroni's Avatar
 
Join Date: Feb 2003
Location: Germany
Age: 44
Posts: 1,303
Send a message via MSN to Joe Maroni
help writing an whdload install for Brian the Lion Demo needed

i´ve tried to write a slave to support the demo version of Brian the Lion months ago...maybe Codetapper remember this, after i asked for some help.

but i didn´t really understand what the bootprog really do...

now i´ve restarted it and it seems that i´m still too stupid for it...

first i reassembled the bootblock, without the first 12 bytes (disktype, checksum, rootblock pointer)

this is what i´ve already understand:

Quote:
EXT_0000 EQU $0
ABSEXECBASE EQU $4
ILLEG_OPC EQU $10
EXT_0003 EQU $16
EXT_0004 EQU $40
EXT_0005 EQU $44
EXT_0006 EQU $48
EXT_0007 EQU $4C
EXT_0008 EQU $58
EXT_0009 EQU $5A
EXT_000A EQU $5E
TRAP_01 EQU $80
TRAP_02 EQU $84
TRAP_03 EQU $88
TRAP_09 EQU $A0
TRAP_10 EQU $A4
EXT_0010 EQU $CC
EXT_0011 EQU $D0
EXT_0012 EQU $D4
EXT_0013 EQU $D8
EXT_0014 EQU $E0
EXT_0015 EQU $64F
EXT_0016 EQU $800
EXT_0017 EQU $1000
EXT_0018 EQU $7F00
EXT_0019 EQU $7A000
EXT_001A EQU $A0000
CIAB_PRA EQU $BFD000
CIAB_PRB EQU $BFD100
CIAA_PRA EQU $BFE001
HARDBASE EQU $DFF000
EXT_001F EQU $1570035
EXT_0020 EQU $FFFFEB07




SECTION S_0,CODE

SECSTRT_0:
CLR.L (EXT_0004).W ------------
CLR.L (EXT_0005).W
CLR.L (EXT_0006).W clear
CLR.L (EXT_0007).W variables
CLR (EXT_000A).W
CLR.L (EXT_0014).W ------------
MOVEA.L (ABSEXECBASE).W,A6 move execbase to A6
LEA 322(A6),A6 load adress of pointer of MemList (offset $142 in ExecBaseStruct)
ExecBaseStruct starts at $676 (512 k Chip) or $C00276 (1 MB Chip)
lets do it with 1MB, and now A6 contains C00368
MOVEA.L (A6),A0 move the value that is stored at $C00368 to A0


MOVE.B 15(A0),D2 pointer to the first MemChunk struct...??
MOVE.L 20(A0),D0 points to memory start of the above MemChunk...??
MOVE.L 24(A0),D1 points to memory end of the above MemChunk...??
ANDI.L #$FFF80000,D0 AND the value $FFF80000 to the memory start adress to be sure you have $80000 bytes free
CMP.B #$03,D2 check if the MemChunk is ChipRam...??
BNE.S LAB_0000 if not branch to LAB_0000
MOVE.L #$00080000,D0 otherwise move $80000 to D0

LAB_0000:
MOVE.L D0,(EXT_0012).W move memory start pointer to $D4
MOVE.L #$00000800,(EXT_0013).W move $800 to absolute adress $D8
LEA LAB_0001(PC),A0 load adress of LAB_0001 to A0
MOVE.L A0,(TRAP_01).W send adress to TRAP #0 vector
TRAP #0 cause an exception and start again at $80

LAB_0001:
LEA LAB_0002(PC),A0 set LAB_0002 adress to A0
MOVE.L A0,(ILLEG_OPC).W now put this adress to $10
DC.W $4E7A --------------------------------------------------
DC.W $0002 this code seems to be illegal, no reassembler was
ANDI #$FFFE,D0 possible to reassemble this...!?
DC.W $4E7B continue with next label...
DC.W $0002 --------------------------------------------------
LAB_0002:
LEA (EXT_0016).W,A7 setup stack to $800
BSR LAB_0003 branch to label LAB_0003 and see what happens
MOVEA.L (EXT_0012).W,A1 move value $D4 to A1
ADDA.L #$0007DE00,A1 ADD $0007DE00 to A1 = $7DED4
MOVEQ #16,D0 move $16 to D0
MOVEQ #6,D1 move $6 to D1
MOVEQ #0,D2 move $0 to D2
TRAP #1 Trap -> go to LAB_0004
MOVEA.L (EXT_0012).W,A1
ADDA.L #$0007DE00,A1
JMP (A1)

LAB_0003:
LEA LAB_0027(PC),A0 load adress of variable LAB_0027 to A0
MOVE.L #$FFFF0000,14(A0) move $FFFF0000 to LAB_0027 + $14
LEA HARDBASE,A6 load custom chip base to A6
MOVE #$7FFF,D0 move $7FFF (%1111111111111111) to D0
MOVE D0,154(A6) ------------------------------------
MOVE D0,158(A6) disable Interrupts(INTENA),Disk(ADKCON),DMA(DMACON)
MOVE D0,150(A6) ------------------------------------
MOVE #$0000,384(A6) set background black
MOVE #$4489,126(A6) $4489 -> DSKSYNC
MOVE #$9500,158(A6) set %1001010100000000 to ADKCON
bit 15 - set bits
bit 14 - first precompensation specifier 00 = none
bit 13 - second precompensation specifier 00 = none
bit 12 - 1 = MFM precompensation
bit 11 - not used for disk
bit 10 - enables sync and start DMA
bit 9 - used for GCR...??
bit 8 - write speed setup -> 1 for MFM
bit 7 - 0 only used for audio

MOVE #$8210,150(A6) set %1000001000010000 to DMACON
bit 15 - set bits
bit 14 - read-only
bit 13 - read-only
bit 12 - unused
bit 11 - unused
bit 10 - 1 = blitter hasn´t full priority over CPU
bit 9 - enable all DMA (bits 8-0)
bit 5 - disable Sprite DMA...??

LEA LAB_0004(PC),A0 load adress of LAB_0004 to A0
MOVE.L A0,(TRAP_02).W load this adress to Trap vector $84
LEA CIAB_PRA,A0 put CIA B base adress to A0
MOVE.B #$03,4609(A0) Direction for Port A ???
MOVE.B #$FF,512(A0) Direction for Port A ???
MOVE.B #$FF,768(A0) Direction for Port B ???
RTS return from subroutine

LAB_0004:
BSR.S LAB_0007 branch to label LAB_0007
LEA LAB_0027(PC),A5
LEA EXT_0019,A0
MOVE.L A1,0(A5)
MOVE.B #$08,3840(A3)
ADD D1,D0
SUBQ #1,D0
EXT.L D1
DIVU #$000B,D1
MOVE.L D1,6(A5)
EXT.L D0
DIVU #$000B,D0
MOVE.L D0,10(A5)
BSR LAB_001C
TST 14(A5)
BPL.S LAB_0006
CLR 14(A5)
LAB_0005:
BTST #4,(A3)
BEQ.S LAB_0006
BSR LAB_0024
BRA.S LAB_0005

LAB_0006:
BSR LAB_001C
BSR.S LAB_0008
BSR LAB_001F
SWAP D1
ROR #7,D1
SUBA D1,A1
MOVE.L A1,0(A5)
BSR.S LAB_0008
MOVE 14(A5),D0
BSR.S LAB_000A
MOVE.B #$F9,(A4)
MOVE.B #$81,(A4)
RTE

LAB_0007:
LEA CIAA_PRA,A3 load CIA A base to A3
LEA -3841(A3),A4 $BFE001 - $F01 = $BFD100 -> A4
LEA HARDBASE,A6 load DFF000 to A6
RTS return to where we came from
please lets do everything step by step that everybody can understand what happens...

Last edited by Joe Maroni; 24 January 2006 at 17:56.
Joe Maroni is offline  
 
Page generated in 0.05037 seconds with 11 queries