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

View File

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

View File

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