diff --git a/acornMemory.go b/acornMemory.go index 922b699..bc536bb 100644 --- a/acornMemory.go +++ b/acornMemory.go @@ -119,7 +119,7 @@ func (m *acornMemory) loadRom(filename string, slot uint8) { m.writeProtectRom[slot] = true // Cache the ROM type - m.data[romTypeTable+uint16(slot)] = data[romTypeByte-romStartAddress] + m.data[mosRomTypeTable+uint16(slot)] = data[romTypeByte-romStartAddress] } func (m *acornMemory) completeWithRam() { diff --git a/bbz.go b/bbz.go index 9696dd4..cadcac4 100644 --- a/bbz.go +++ b/bbz.go @@ -26,9 +26,17 @@ func RunMOS(env *environment) { if pc == romStartAddress { a, _, _, _ := env.cpu.GetAXYP() env.log(fmt.Sprintf("LANGUAGE(A=%02x, ROM=%x)", a, env.mem.activeRom)) + } else if pc == romServiceEntry { a, _, _, _ := env.cpu.GetAXYP() env.log(fmt.Sprintf("SERVICE(CMD=%02x, ROM=%x)", a, env.mem.activeRom)) + + } else if pc >= extentedVectorTableStart && + pc < extentedVectorTableEnd { + + // See http://beebwiki.mdfs.net/index.php/Paged_ROM + panic(fmt.Sprintf("Extender vectors not implemented, %04x was called", pc)) + } else if pc >= entryPoints && pc <= epEntryPointsLast { a, x, y, p := env.cpu.GetAXYP() diff --git a/beeb_fstest_test.go b/beeb_fstest_test.go index f995199..95a27dd 100644 --- a/beeb_fstest_test.go +++ b/beeb_fstest_test.go @@ -1,6 +1,7 @@ package main import ( + "os" "strings" "testing" ) @@ -17,4 +18,7 @@ func Test_beeb_ftest(t *testing.T) { t.Log(out) t.Error("beeb-fstest failed") } + + os.Remove("+.0") + os.Remove("+.0.inf") } diff --git a/constants.go b/constants.go index fdfc62a..9977eab 100644 --- a/constants.go +++ b/constants.go @@ -27,12 +27,13 @@ const ( zpErrorPointer uint16 = 0x00fd zpEscapeFlag uint16 = 0x00ff - vectorBRK uint16 = 0x0202 - mosVariablesStart uint16 = 0x0236 - romTypeTable uint16 = 0x023a - spoolFileHandle uint16 = 0x0257 - charDestinations uint16 = 0x027c - mosVariablesEnd uint16 = 0x028f + vectorBRK uint16 = 0x0202 + mosVariablesStart uint16 = 0x0236 + mosRomTypeTable uint16 = 0x023a + mosSpoolFileHandle uint16 = 0x0257 + mosCharDestinations uint16 = 0x027c + mosCurrentLanguage uint16 = 0x028c + mosVariablesEnd uint16 = 0x028f // ROM header https://tobylobster.github.io/mos/mos/S-s2.html#SP26 userMemBottom uint16 = 0x0e00 @@ -102,6 +103,9 @@ const ( sheilaStart uint16 = 0xf000 sheilaRomLatch uint16 = 0xfe30 + extentedVectorTableStart uint16 = 0xff00 + extentedVectorTableEnd uint16 = 0xff51 + maxFiles uint8 = 100 // Maximim delay to detect a double control C to quit diff --git a/environment.go b/environment.go index 9f6a95d..0038819 100644 --- a/environment.go +++ b/environment.go @@ -79,7 +79,7 @@ func (env *environment) escape() { func (env *environment) initUpperLanguage() { for slot := 0xf; slot >= 0; slot-- { - romType := env.mem.data[romTypeTable+uint16(slot)] + romType := env.mem.data[mosRomTypeTable+uint16(slot)] if romType&0x40 != 0 { env.initLanguage(uint8(slot)) return @@ -90,6 +90,8 @@ func (env *environment) initUpperLanguage() { } func (env *environment) initLanguage(slot uint8) { + //See https://github.com/raybellis/mos120/blob/master/mos120.s#L6186 + env.mem.Poke(mosCurrentLanguage, slot) env.mem.Poke(zpROMSelect, slot) env.mem.Poke(sheilaRomLatch, slot) @@ -103,7 +105,7 @@ func (env *environment) initLanguage(slot uint8) { The MOS also automatically prints the ROM's title string (&8009) so that the user is acknowledged. */ language := env.mem.peekString(romTitleString, 0) - env.con.write(fmt.Sprintf("%s\n", language)) + env.con.write(fmt.Sprintf("%s\n\n", language)) _, x, y, p := env.cpu.GetAXYP() env.cpu.SetAXYP(1, x, y, p) diff --git a/files.go b/files.go index f1ceedd..cbf1d63 100644 --- a/files.go +++ b/files.go @@ -64,13 +64,13 @@ func (env *environment) closeFile(handle uint8) { } func (env *environment) writeSpool(s string) { - charDest := env.mem.peekInternal(charDestinations) + charDest := env.mem.peekInternal(mosCharDestinations) if charDest&0x10 != 0 { // Spooled output is disabled return } - spoolHandle := env.mem.peekInternal(spoolFileHandle) + spoolHandle := env.mem.peekInternal(mosSpoolFileHandle) if spoolHandle == 0 { // No spool file defined return diff --git a/osByte.go b/osByte.go index 58adb15..54540bc 100644 --- a/osByte.go +++ b/osByte.go @@ -47,7 +47,7 @@ func execOSBYTE(env *environment) { /* On entry, the value in X determines the output device to be selected */ - env.mem.Poke(charDestinations, x) + env.mem.Poke(mosCharDestinations, x) isIO = true case 0x04: @@ -312,6 +312,14 @@ func execOSBYTE(env *environment) { } // Starting from a = 0xa6, we are reading mos variables. + case 0xa8: + option = "Read adress of extended vector table" + /* + On exit X and Y point to the start of the extended vectors for ROMs + */ + newX = uint8(extentedVectorTableStart & 0xff) + newY = uint8(extentedVectorTableStart >> 8) + case 0xda: option = "R/W number of items in VDU" /* diff --git a/osCLI.go b/osCLI.go index 6df868d..3af9850 100644 --- a/osCLI.go +++ b/osCLI.go @@ -107,7 +107,7 @@ func execOSCLI(env *environment) { // Runs the first language ROM with no service entry unhandled = true for slot := 0xf; slot >= 0; slot-- { - romType := env.mem.data[romTypeTable+uint16(slot)] + romType := env.mem.data[mosRomTypeTable+uint16(slot)] if romType&0b1100_0000 == 0b0100_0000 { // bit 7 clear, bit 6 set env.initLanguage(uint8(slot)) unhandled = false @@ -364,10 +364,10 @@ func execOSCLI(env *environment) { case "SPOOL": // *SPOOL filename // *SPOOL - spoolFile := env.mem.Peek(spoolFileHandle) + spoolFile := env.mem.Peek(mosSpoolFileHandle) if spoolFile != 0 { env.closeFile(spoolFile) - env.mem.Poke(spoolFileHandle, 0) + env.mem.Poke(mosSpoolFileHandle, 0) } filename := "" @@ -379,7 +379,7 @@ func execOSCLI(env *environment) { if filename != "" { // Activate spool spoolFile := env.openFile(filename, 0x80 /*open for output*/) - env.mem.Poke(spoolFileHandle, spoolFile) + env.mem.Poke(mosSpoolFileHandle, spoolFile) } case "TAPE": diff --git a/test/notes/pascal b/test/notes/pascal index 708e124..8c06dd5 100644 --- a/test/notes/pascal +++ b/test/notes/pascal @@ -1,7 +1,7 @@ ROM2 has the command line interpreter ROM1 has the compiler? May be invoked via OSBYTEa3(x=c0) - +$ cd ROMs/Pascal/ $ go run ../../*.go -rom0 ../Pascal-1.10-2.rom -m bbz - Acorn MOS for 6502 adaptation layer, https://github.com/ivanizag/bbz (tip: uppercase is usually needed)