]> git.sesse.net Git - pistorm/blobdiff - platforms/amiga/piscsi/device_driver_amiga/bootrom.s
Some more failed PiSCSI 1.3 autoboot ventures
[pistorm] / platforms / amiga / piscsi / device_driver_amiga / bootrom.s
index 2194a1e000786198eb4d311a9664f0de327c76ba..70f0af7efc2eaad14732bcea077141a7ab7fc0c1 100644 (file)
@@ -162,7 +162,7 @@ DiagEntry:
             nop
             nop
             nop
-            move.l  #1,PiSCSIDebugMe
+            move.l #1,PiSCSIDebugMe
             move.l a3,PiSCSIAddr1
             nop
             nop
@@ -209,18 +209,16 @@ endpatches:
 
 BootEntry:
             align 2
-            move.l  #2,PiSCSIDebugMe
-            nop
-            nop
-            nop
-            nop
-            nop
-
-            lea     DosName(PC),a1          ; 'dos.library',0
-            jsr     FindResident(a6)        ; find the DOS resident tag
-            move.l  d0,a0                   ; in order to bootstrap
-            move.l  RT_INIT(A0),a0          ; set vector to DOS INIT
-            jsr     (a0)                    ; and initialize DOS
+            move.l #2,PiSCSIDebugMe
+            lea DosName(pc),a1
+            jsr FindResident(a6)
+            tst.l d0
+            beq.b .End
+            move.l d0,a0
+            move.l RT_INIT(a0),a0
+            jmp (a0)
+.End
+            moveq.l #1,d0           ; indicate "success"
             rts
 
 *
@@ -261,6 +259,7 @@ Init:       ; After Diag patching, our romtag will point to this
             move.l a6,-(a7)             ; Push A6 to stack
             move.w #$00B8,$dff09a       ; Disable interrupts during init
             move.l  #3,PiSCSIDebugMe
+            move.l a3,PiSCSIAddr4
 
             move.l  #11,PiSCSIDebugMe
             movea.l 4,a6
@@ -303,54 +302,60 @@ PartitionLoop:
             move.l d0,a0
             jsr MakeDosNode(a6)
             move.l d0,PiSCSISetFSH
+            move.l d0,PiSCSIAddr2       ; Put DeviceNode address in PiSCSIAddr2, because I'm useless
             move.l d0,a0
             move.l PiSCSIGetPrio,d0
             move.l #0,d1
             move.l PiSCSIAddr1,a1
 
 * Uncomment these lines to test AddDosNode/Enqueue stuff
-*            cmp.l   #-128,d0
-*            bne.s   EnqueueNode
-*
-** BOOL AddDosNode( LONG bootPri, ULONG flags, struct DeviceNode *deviceNode );
-** amicall(ExpansionBase, 0x96, AddDosNode(d0,d1,a0))
-*            move.l #38,PiSCSIDebugMe
-*            jsr AddDosNode(a6)
-*            bra.w SkipEnqueue
-** VOID Enqueue( struct List *list, struct Node *node );
-** amicall(SysBase, 0x10e, Enqueue(a0,a1))
-*
-*EnqueueNode:
-*            exg a6,a4
-*            move.l #35,PiSCSIDebugMe
-*            move.l #BootNode_SIZEOF,PiSCSIDebugMe
-*            move.l #NT_BOOTNODE,PiSCSIDebugMe
-*            move.l #LN_TYPE,PiSCSIDebugMe
-*            move.l #LN_PRI,PiSCSIDebugMe
-*            move.l #LN_NAME,PiSCSIDebugMe
-*            move.l #eb_MountList,PiSCSIDebugMe
-*            move.l #35,PiSCSIDebugMe
-*
-*            move.l #BootNode_SIZEOF,d0
-*            move.l #$10001,d1
-*            jsr AllocMem(a6)            ; Allocate memory for the BootNode
-*
-*            move.l d0,a1
-*            move.b #NT_BOOTNODE,LN_TYPE(a1)
-*            move.b PiSCSIGetPrio,LN_PRI(a1)
-*            move.l a0,bn_DeviceNode(a1)
-*            move.l PiSCSIAddr1,LN_NAME(a1)
-*
-*            lea eb_MountList(a4),a0
-*            jsr Enqueue(a6)
-*            exg a6,a4
-*
-*SkipEnqueue:
+* Or comment them out all the way down to and including SkipEnqueue: to use the AddBootNode method instead.
+            cmp.l   #-128,d0
+            bne.s   EnqueueNode
+
+* BOOL AddDosNode( LONG bootPri, ULONG flags, struct DeviceNode *deviceNode );
+* amicall(ExpansionBase, 0x96, AddDosNode(d0,d1,a0))
+            move.l #38,PiSCSIDebugMe
+            jsr AddDosNode(a6)
+            bra.w SkipEnqueue
+* VOID Enqueue( struct List *list, struct Node *node );
+* amicall(SysBase, 0x10e, Enqueue(a0,a1))
+
+EnqueueNode:
+            exg a6,a4
+            move.l #35,PiSCSIDebugMe
+            move.l #BootNode_SIZEOF,PiSCSIDebugMe
+            move.l #NT_BOOTNODE,PiSCSIDebugMe
+            move.l #LN_TYPE,PiSCSIDebugMe
+            move.l #LN_PRI,PiSCSIDebugMe
+            move.l #LN_NAME,PiSCSIDebugMe
+            move.l #eb_MountList,PiSCSIDebugMe
+            move.l #35,PiSCSIDebugMe
+
+            move.l #BootNode_SIZEOF,d0
+            move.l #$10001,d1
+            jsr AllocMem(a6)            ; Allocate memory for the BootNode
+
+            move.l d0,PiSCSIAddr3
+            move.l #36,PiSCSIDebugMe
+
+            move.l d0,a1
+            move.b #NT_BOOTNODE,LN_TYPE(a1)
+            move.l PiSCSIGetPrio,d0
+            move.b d0,LN_PRI(a1)
+            move.l PiSCSIAddr2,bn_DeviceNode(a1)
+            move.l PiSCSIAddr1,LN_NAME(a1)
+
+            lea eb_MountList(a4),a0
+            jsr Enqueue(a6)
+            exg a6,a4
+
+SkipEnqueue:
 
 * BOOL AddBootNode( LONG bootPri, ULONG flags, struct DeviceNode *deviceNode, struct ConfigDev *configDev );
 * amicall(ExpansionBase, 0x24, AddBootNode(d0,d1,a0,a1))
 * Comment out the line below to test AddDosNode/Enqueue stuff
-            jsr AddBootNode(a6)
+*            jsr AddBootNode(a6)
             move.l #1,PiSCSINextPart    ; Switch to the next partition
             bra.w PartitionLoop
 
@@ -384,17 +389,33 @@ FSResource:     dc.l    $0
 LoadFileSystems:
             movem.l d0-d7/a0-a6,-(sp)       ; Push registers to stack
             move.l #30,PiSCSIDebugMe
+ReloadResource:
             lea FileSysName(pc),a1
             jsr OpenResource(a6)
             tst.l d0
             bne FSRExists
 
             move.l #33,PiSCSIDebugMe        ; FileSystem.resource isn't open, create it
-            lea FSRes(pc),a1
-            move.l a1,-(a7)
-            jsr AddResource(a6)
-            move.l (a7)+,a0
-            move.l a0,d0
+                                            ; Code based on WinUAE filesys.asm
+
+            moveq #32,d0                    ; sizeof(FileSysResource)
+            move.l #$10001,d1
+            jsr AllocMem(a6)
+            move.l d0,a2
+            move.b #8,8(a2)                 ; NT_RESOURCE
+            lea FileSysName(pc),a0
+            move.l a0,10(a2)                ; node name
+            lea FileSysCreator(pc),a0
+            move.l a0,14(a2)                ; fsr_Creator
+            lea 18(a2),a0
+            move.l a0,(a0)                  ; NewList() fsr_FileSysEntries
+            addq.l #4,(a0)
+            move.l a0,8(a0)
+            lea $150(a6),a0                 ; ResourceList
+            move.l a2,a1
+            jsr -$f6(a6)                    ; AddTail
+            move.l a2,a0
+            bra.s ReloadResource
 
 FSRExists:  
             move.l d0,PiSCSIAddr2             ; PiSCSIAddr2 is now FileSystem.resource
@@ -451,7 +472,7 @@ FSDone:     move.l #37,PiSCSIDebugMe
             movem.l (sp)+,d0-d7/a0-a6   ; Pop registers from stack
             bra.w FSLoadExit
 
-FileSysRes
+FSRes
     dc.l    0
     dc.l    0
     dc.b    NT_RESOURCE