mirror of
https://github.com/ivanizag/izapple2.git
synced 2025-03-10 21:31:52 +00:00
Character map roms initial support
This commit is contained in:
parent
05355749f3
commit
016e1ea875
73
apple2/characterGenerator.go
Normal file
73
apple2/characterGenerator.go
Normal file
@ -0,0 +1,73 @@
|
||||
package apple2
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
/*
|
||||
See:
|
||||
hhttps://mirrors.apple2.org.za/Apple%20II%20Documentation%20Project/Companies/Apple/Documentation/Apple%20Technical%20Information%20Library/a2til041.txt
|
||||
*/
|
||||
|
||||
// CharacterGenerator represents the ROM wth the characters bitmaps
|
||||
type CharacterGenerator struct {
|
||||
data []uint8
|
||||
}
|
||||
|
||||
const (
|
||||
rev7CharGenSize = 2048
|
||||
)
|
||||
|
||||
// NewCharacterGenerator instantiates a new Character Generator with the rom on the file given
|
||||
func NewCharacterGenerator(filename string) *CharacterGenerator {
|
||||
var cg CharacterGenerator
|
||||
cg.load(filename)
|
||||
return &cg
|
||||
}
|
||||
|
||||
func (cg *CharacterGenerator) load(filename string) {
|
||||
f, err := os.Open(filename)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
stats, statsErr := f.Stat()
|
||||
if statsErr != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
size := stats.Size()
|
||||
if size != rev7CharGenSize {
|
||||
panic("Character ROM size not supported")
|
||||
}
|
||||
cg.data = make([]uint8, size)
|
||||
buf := bufio.NewReader(f)
|
||||
buf.Read(cg.data)
|
||||
}
|
||||
|
||||
func (cg *CharacterGenerator) dumpChar(char uint8) {
|
||||
base := int(char) * 8
|
||||
fmt.Printf("Char: %v\n---------\n", char)
|
||||
for i := 0; i < 8; i++ {
|
||||
fmt.Print("|")
|
||||
b := cg.data[base+i]
|
||||
for j := 6; j >= 0; j-- {
|
||||
if (b>>uint(j))&1 == 1 {
|
||||
fmt.Print("#")
|
||||
} else {
|
||||
fmt.Print(" ")
|
||||
}
|
||||
}
|
||||
fmt.Println("|")
|
||||
}
|
||||
fmt.Println("---------")
|
||||
}
|
||||
|
||||
func (cg *CharacterGenerator) Dump() {
|
||||
for i := 0; i < 256; i++ {
|
||||
cg.dumpChar(uint8(i))
|
||||
}
|
||||
}
|
@ -15,6 +15,7 @@ type ioC0Page struct {
|
||||
type softSwitchR func(io *ioC0Page) uint8
|
||||
type softSwitchW func(io *ioC0Page, value uint8)
|
||||
|
||||
// KeyboardProvider declares the keyboard implementation requitements
|
||||
type KeyboardProvider interface {
|
||||
GetKey(strobe bool) (key uint8, ok bool)
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
BIN
apple2/romdumps/Apple2rev7CharGen.rom
Normal file
BIN
apple2/romdumps/Apple2rev7CharGen.rom
Normal file
Binary file not shown.
@ -7,7 +7,7 @@ const (
|
||||
ioFlagMixed uint8 = 0x52
|
||||
ioFlagSecondPage uint8 = 0x54
|
||||
ioFlagHiRes uint8 = 0x56
|
||||
ioFlagAnnunciator0 uint8 = 0x58
|
||||
ioFlagAnnunciator0 uint8 = 0x58 // On Copam Electronics Base-64A this is used to bank swith the ROM
|
||||
ioFlagAnnunciator1 uint8 = 0x5a
|
||||
ioFlagAnnunciator2 uint8 = 0x5c
|
||||
ioFlagAnnunciator3 uint8 = 0x5e
|
||||
|
15
main.go
15
main.go
@ -19,6 +19,10 @@ func main() {
|
||||
"disk",
|
||||
"../dos33.dsk",
|
||||
"file to load on the first disk drive")
|
||||
charRomFile := flag.String(
|
||||
"charRom",
|
||||
"apple2/romdumps/Apple2rev7CharGen.rom",
|
||||
"rom file for the disk drive controller")
|
||||
useSdl := flag.Bool(
|
||||
"sdl",
|
||||
true,
|
||||
@ -27,6 +31,11 @@ func main() {
|
||||
"panicss",
|
||||
false,
|
||||
"panic if a not implemented softwtich is used")
|
||||
dumpChars := flag.Bool(
|
||||
"dumpChars",
|
||||
false,
|
||||
"shows the character map",
|
||||
)
|
||||
flag.Parse()
|
||||
|
||||
//romFile := "apple2/romdumps/Apple2.rom"
|
||||
@ -37,6 +46,12 @@ func main() {
|
||||
//diskImage := "../Apex II - Apple II Diagnostic (v4.7-1986).DSK"
|
||||
//diskImage := "../A2Diag.v4.1.SDK"
|
||||
|
||||
if *dumpChars {
|
||||
cg := apple2.NewCharacterGenerator(*charRomFile)
|
||||
cg.Dump()
|
||||
return
|
||||
}
|
||||
|
||||
log := false
|
||||
a := apple2.NewApple2(*romFile, *panicSS)
|
||||
a.AddDisk2(*disk2RomFile, *diskImage)
|
||||
|
Loading…
x
Reference in New Issue
Block a user