Build word-wide ROM

This commit is contained in:
Matt Harlum 2023-11-21 20:33:36 +00:00 committed by Matt Harlum
parent 2e3f7fc767
commit 9ef812753b
3 changed files with 54 additions and 7 deletions

View File

@ -1,7 +1,7 @@
PROJECT=lide
INCLUDE=/opt/amiga/m68k-amigaos/ndk-include
AS=vasmm68k_mot
ASFLAGS=-Fhunk -I$(INCLUDE) -quiet -align -DROM -DBYTEWIDE
ASFLAGS=-Fhunk -I$(INCLUDE) -quiet -align -DROM
LINKER=vlink
LINKFLAGS=-brawbin1 -s -sc -sd -mrel -lamiga -lauto -L/opt/amiga/m68k-amigaos/vbcc/lib
OBJDIR=obj
@ -12,33 +12,48 @@ SRCS = bootldr.S \
endrom.S
OBJS = $(SRCS:%.S=$(OBJDIR)/%.o)
all: ../$(PROJECT).rom ../$(PROJECT)-atbus.rom
all: ../$(PROJECT).rom ../$(PROJECT)-atbus.rom ../$(PROJECT)-word.rom
$(OBJDIR)/mungerom: mungerom.c
@mkdir -p $(OBJDIR)
$(CC) $< -Wall -o $@
# Nibble-wide boot loader with Byte-wide driver
$(OBJDIR)/%.o: %.S
@mkdir -p $(OBJDIR)
$(AS) $(ASFLAGS) -o $@ $<
$(AS) $(ASFLAGS) -DBYTEWIDE -o $@ $<
# Word-wide boot loader & driver
$(OBJDIR)/%-word.o: %.S
@mkdir -p $(OBJDIR)
$(AS) $(ASFLAGS) -DWORDWIDE -o $@ $<
$(OBJDIR)/bootldr: $(OBJDIR)/bootldr.o
$(LINKER) $(LINKFLAGS) -o $@ $^
$(OBJDIR)/bootldr-word: $(OBJDIR)/bootldr-word.o
$(LINKER) $(LINKFLAGS) -o $@ $^
$(OBJDIR)/bootnibbles: $(OBJDIR)/bootldr $(OBJDIR)/mungerom
@mkdir -p $(OBJDIR)
./obj/mungerom
$(OBJDIR)/assets.o: assets.S $(OBJDIR)/bootnibbles ../lide.device
$(OBJDIR)/assets-word.o: assets.S $(OBJDIR)/bootldr-word ../lide.device
../$(PROJECT).rom: $(OBJDIR)/bootnibbles $(OBJDIR)/assets.o
$(LINKER) $(LINKFLAGS) -Trom.ld -o $@ $(OBJDIR)/assets.o
../$(PROJECT)-atbus.rom: $(OBJDIR)/bootnibbles $(OBJDIR)/assets.o
$(LINKER) $(LINKFLAGS) -Tatbusrom.ld -o $@ $(OBJDIR)/assets.o
../$(PROJECT)-word.rom: $(OBJDIR)/assets-word.o
$(LINKER) $(LINKFLAGS) -Trom.ld -o $@ $(OBJDIR)/assets-word.o
clean:
rm -f $(OBJDIR)/*
rm -f ../$(PROJECT).rom
rm -f ../$(PROJECT)-atbus.rom
rm -f ../$(PROJECT)-word.rom
rm -f mungerom

View File

@ -1,5 +1,9 @@
section BOOTLDR
IFND WORDWIDE
incbin "obj/bootnibbles"
ELSE
incbin "obj/bootldr-word"
ENDIF
section DEVICE
incbin "../lide.device"

View File

@ -6,7 +6,11 @@
VERSION = 1
REVISION = 1
IFND WORDWIDE
DRIVEROFFSET = $2000
ELSE
DRIVEROFFSET = $1000
ENDIF
******* DiagStart **************************************************
DiagStart
@ -14,7 +18,11 @@ DiagStart
; your board base appears as the Init Diag vector in your
; autoconfig ID information. This structure is designed
; to use all relative pointers (no patching needed).
IFND WORDWIDE
dc.b DAC_NIBBLEWIDE+DAC_CONFIGTIME ; da_Config
ELSE
dc.b DAC_WORDWIDE+DAC_CONFIGTIME ; da_Config
ENDIF
dc.b 0 ; da_Flags
dc.w EndCopy-DiagStart ; da_Size
dc.w DiagEntry-DiagStart ; da_DiagPoint
@ -114,9 +122,11 @@ Init: movem.l d2-d7/a2-a6,-(sp)
move.l MyConfigDev(PC),a1
move.w cd_Rom+er_InitDiagVec(a1),d1 ; Get rom offset
moveq #0,d2
cmp.l #8,d1 ; LIV2 board with even rom addrss?
beq .even
.odd add.l #1,d2 ; No, AT-Bus style board with odd address
cmp.l #1,d1 ; AT-Bus with odd address?
beq .odd
cmp.l #$100,d1 ; WinUAE AT-Bus with ROM at odd address (despite DiagVec...)
bne .even
.odd add.l #1,d2
.even
cmp.l #$20000,cd_BoardSize(a1) ; 128K Board?
bne .skipcdfs
@ -135,9 +145,17 @@ Init: movem.l d2-d7/a2-a6,-(sp)
cmp.l #'LIDE',d1 ; If bank switched this will not match
beq .skipcdfs
IFND WORDWIDE
move.l #$10000,d0 ; Reloc offset to second bank
add.l d2,d0 ; Add the odd offset if needed
ELSE
moveq.l #0,d0
add.l #$8000,a0
ENDIF
bsr _relocate ; BoardBase already in A0
tst.l d0
beq.s .skipcdfs
@ -145,8 +163,18 @@ Init: movem.l d2-d7/a2-a6,-(sp)
.skipcdfs:
move.l BoardBase(PC),a0
IFND WORDWIDE
move.l #DRIVEROFFSET,d0
add.l d2,d0 ; Add offset if AT-Bus with odd address
ELSE
move.l #0,d0
add.l #DRIVEROFFSET,a0
ENDIF
bsr _relocate
tst.l d0
beq.s .err