IDE ROM: Add Mounter

* Fixed up mounter (Creation of FileSystem.resource missed adding LN_NAME and LN_TYPE
* Wrapped in a RomTag and glued crudely to the driver
This commit is contained in:
Matt Harlum 2023-02-28 12:27:07 +00:00
parent 53383d92a8
commit 633428b89a
11 changed files with 1170 additions and 13 deletions

4
iderom/.gitignore vendored
View File

@ -1,5 +1,7 @@
obj/**
obj/*
at
*.rom
**/*.o
**/*.out
**/*.device
**/*.hunk

View File

@ -3,12 +3,13 @@ INCLUDE=/opt/amiga/m68k-amigaos/ndk-include
AS=vasmm68k_mot
ASFLAGS=-Fhunk -I$(INCLUDE) -quiet -align
LINKER=vlink
LINKFLAGS=-brawbin1 -s -sc -sd -mrel
LINKFLAGS=-brawbin1 -s -sc -sd -mrel -lamiga -lauto -L/opt/amiga/m68k-amigaos/vbcc/lib
OBJDIR=obj
.PHONY: all clean rom
.PHONY: all clean rom mounter/obj/mounter.hunk
SRCS = bootldr.S
SRCS = bootldr.S \
endrom.S
OBJS = $(SRCS:%.S=$(OBJDIR)/%.o)
all: $(PROGRAM)
@ -22,16 +23,22 @@ $(OBJDIR)/%.o: %.S
$(AS) $(ASFLAGS) -o $@ $<
$(OBJDIR)/bootldr: $(OBJDIR)/bootldr.o
$(LINKER) $(LINKFLAGS) -o $@ $<
$(LINKER) $(LINKFLAGS) -o $@ $^
$(OBJDIR)/bootnibbles: $(OBJDIR)/bootldr $(OBJDIR)/mungerom
@mkdir -p $(OBJDIR)
./obj/mungerom
mounter/obj/mounter.hunk:
$(MAKE) -C mounter all
$(OBJDIR)/assets.o: assets.S $(OBJDIR)/bootnibbles mounter/obj/mounter.hunk
$(PROGRAM): $(OBJDIR)/bootnibbles $(OBJDIR)/assets.o
$(LINKER) $(LINKFLAGS) -Trom.ld -o $@ $(OBJDIR)/assets.o
clean:
$(MAKE) -C mounter clean
rm -f $(OBJDIR)/*
rm -f $(PROGRAM)
rm -f mungerom

View File

@ -1,3 +1,3 @@
## ide boot rom
WIP for the IDE driver, currently just loads Oktapus driver from ROM
WIP for the IDE driver

View File

@ -2,4 +2,4 @@
incbin "obj/bootnibbles"
section DEVICE
incbin "cider.device"
incbin "mounter/obj/mounter.hunk"

View File

@ -7,7 +7,7 @@
VERSION = 1
REVISION = 1
DRIVEROFFSET = $2000
dc.w $00
******* DiagStart **************************************************
DiagStart
; This is the DiagArea structure whose relative offset from
@ -60,7 +60,6 @@ DiagEntry
move.l a1,RT_ENDSKIP(a4)
lea.l DevName(pc),a1
move.l a1,RT_NAME(a4)
lea.l IdString(pc),a1
move.l a1,RT_IDSTRING(a4)
lea.l Init(pc),a1
move.l a1,RT_INIT(a4)
@ -112,6 +111,7 @@ Init: movem.l d2-d7/a2-a6,-(sp)
move.l MyConfigDev(PC),a1
move.w cd_Rom+er_InitDiagVec(a1),d1 ; Get rom offset
ror.l #8,d1 ; Divide by 8 for Z2 Nibble-wide
andi.l #1,d1
move.l #DRIVEROFFSET,d0 ; Add to Driver offset
add.l d1,d0
@ -155,8 +155,6 @@ Init: movem.l d2-d7/a2-a6,-(sp)
.found
moveq.l #0,d1
jsr _LVOInitResident(A6)
tst.l d0
beq.s .err
.done
moveq.l #0,d0 ; Report "failure" as the chainloader romtag is no longer needed
movem.l (sp)+,d2-d7/a2-a6
@ -167,8 +165,6 @@ Init: movem.l d2-d7/a2-a6,-(sp)
DevName
dc.b 'Chainloader',0 ; Name string
align 1
IdString
dc.b 'Chainloader',0
DosName
dc.b 'dos.library',0 ; DOS library name
align 1 ; word align

33
iderom/mounter/Makefile Normal file
View File

@ -0,0 +1,33 @@
PROJECT=mounter
#CC=m68k-amigaos-gcc
#CFLAGS=-lamiga -nostartfiles -mcrt=clib2 -mcpu=68000 -c
INCLUDE=/opt/amiga/m68k-amigaos/ndk-include
CC=vc
CFLAGS=+aos68k -cpu=68000 -c99 -lamiga -c -Os -dontwarn=153 -dontwarn=368
AS=vasmm68k_mot
ASFLAGS=-Fhunk -I$(INCLUDE) -quiet -align
LINKER=vlink
LINKFLAGS=-bamigahunk -s -sc -sd -mrel -lamiga -lauto -L/opt/amiga/m68k-amigaos/vbcc/lib
.PHONY: clean all
all: obj/mounter.hunk
OBJ = mounter.o
ASMOBJ = romtag.o \
endrom.o
ASMSRCS = $(ASMOBJ:%.o=%.S)
SRCS = $(OBJ:%.o=%.c)
obj/%.o: %.S
$(AS) $(ASFLAGS) $< -o $@
obj/%.o: %.c
${CC} -o $@ $(CFLAGS) $<
obj/mounter.hunk: obj/romtag.o obj/mounter.o obj/endrom.o liv2ride.device
$(LINKER) $(LINKFLAGS) -o $@ $^
clean:
-rm -rf obj/*

4
iderom/mounter/endrom.S Normal file
View File

@ -0,0 +1,4 @@
XDEF EndSkip
dc.b "End of the line..."
EndSkip:

1042
iderom/mounter/mounter.c Normal file

File diff suppressed because it is too large Load Diff

12
iderom/mounter/mounter.h Normal file
View File

@ -0,0 +1,12 @@
#ifndef MOUNTER_H
#define MOUNTER_H
APTR W_CreateIORequest(struct MsgPort *ioReplyPort, ULONG size, struct ExecBase *SysBase);
void W_DeleteIORequest(APTR iorequest, struct ExecBase *SysBase);
struct MsgPort *W_CreateMsgPort(struct ExecBase *SysBase);
void W_DeleteMsgPort(struct MsgPort *port, struct ExecBase *SysBase);
int mount_drives(struct ConfigDev *cd);
int main();
#endif

View File

@ -0,0 +1,18 @@
#ifndef __NDK_COMPAT_H
#define __NDK_COMPAT_H
#include <inttypes.h>
/* ULONG has changed from NDK 3.9 to NDK 3.2.
* However, PRI*32 did not. What is the right way to implement this?
*/
#if INCLUDE_VERSION < 47
#undef PRIu32
#define PRIu32 "lu"
#undef PRId32
#define PRId32 "ld"
#undef PRIx32
#define PRIx32 "lx"
#endif
#endif

43
iderom/mounter/romtag.S Normal file
View File

@ -0,0 +1,43 @@
include exec/resident.i
include lvo/exec_lib.i
jmp _main
Romtag: dc.w $4AFC
.rt_match dc.l Romtag
.rt_endskip dc.l EndSkip
.rt_flags dc.b RTF_COLDSTART
.rt_version dc.b 41
.rt_type dc.b 0
.rt_pri dc.b 0
.rt_name dc.l Name
.rt_id dc.l Name
.rt_init dc.l init
Name: dc.b "Mounter",0
init: movem.l d2-d7/a2-a6,-(sp)
lea EndSkip(PC),a1
move.l #$1000,d3 ; Search the first 4096 words for a Romtag
.findrt cmpi.w #$4AFC,(a1)
bne.s .not_rt
cmp.l RT_MATCHTAG(a1),a1 ; Check that the RT_MATCHTAG is correct
beq.s .found
.not_rt addq.l #2,a1
dbra d3,.findrt
bra.s .err
* Found the driver, initialize it & mount devices
.found
moveq.l #0,d1
jsr _LVOInitResident(A6)
tst.l d0
beq.s .done
move.l d0,-(sp)
jsr _main
move.l (sp)+,d0
.done
movem.l (sp)+,d2-d7/a2-a6
rts
.err
moveq.l #0,d0
movem.l (sp)+,d2-d7/a2-a6
rts