mirror of
https://github.com/zellyn/goapple2.git
synced 2024-12-14 13:29:05 +00:00
Flesh out readme, reorder shiny code
This commit is contained in:
parent
ed5aebf344
commit
46b66ec7c3
44
README.md
44
README.md
@ -1,4 +1,42 @@
|
||||
goapple2
|
||||
========
|
||||
# goapple2
|
||||
|
||||
Apple ][+ emulator written in Go.
|
||||
Apple ][+ emulator written in Go.
|
||||
|
||||
## Status
|
||||
|
||||
Basic functionality (keyboard input, text, low and hires graphics)
|
||||
works.
|
||||
|
||||
Very basic (and fake) *read-only* disk access works, for `.dsk` images
|
||||
where no trickery is involved.
|
||||
|
||||
This was one of my early Go-learning projects: the code organization
|
||||
is pretty horrible.
|
||||
|
||||
## Shiny
|
||||
|
||||
This is the main "supported" interface, hacked together during hack
|
||||
day at GopherCon2016. It's almost certainly doing things wrong
|
||||
Shiny-wise: pull requests welcome. Press backquote/tilde to exit.
|
||||
|
||||
## Texty
|
||||
|
||||
`texty/` contains a hackish version of the emulator that runs in a
|
||||
terminal. It interprets all videoscan outputs as text, regardless of
|
||||
any other settings. Press `~` to exit.
|
||||
|
||||
## Where to find ROMs
|
||||
|
||||
cd data/roms
|
||||
./getroms.sh
|
||||
|
||||
## Contributing
|
||||
|
||||
Pull requests welcome. If you have any questions, feel free to get in
|
||||
touch with me: username "zellyn" on gmail, twitter, facebook, github,
|
||||
golang slack.
|
||||
|
||||
### Contributors
|
||||
|
||||
- [zellyn](https://github.com/zellyn)
|
||||
- [frumious](https://github.com/frumious)
|
||||
|
BIN
data/roms/apple2-chars.rom
Normal file
BIN
data/roms/apple2-chars.rom
Normal file
Binary file not shown.
36
data/roms/getroms.sh
Executable file
36
data/roms/getroms.sh
Executable file
@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
DIR1='http://mirrors.apple2.org.za/Apple%20II%20Documentation%20Project/Computers/Apple%20II/Apple%20II/ROM%20Images'
|
||||
DIR2='http://mirrors.apple2.org.za/Apple%20II%20Documentation%20Project/Computers/Apple%20II/Apple%20II%20plus/ROM%20Images'
|
||||
|
||||
rm -f apple2.rom apple2+.rom
|
||||
|
||||
D0_2="Apple%20Programmer's%20Aid%20%231%20ROM%20(D000)%20-%20341-0016%20-%202716.bin"
|
||||
E0_2='Apple%20II%20ROM%20Pages%20E0-E7%20-%20341-0001%20-%20Integer%20BASIC.bin'
|
||||
E8_2='Apple%20II%20ROM%20Pages%20E8-EF%20-%20341-0002%20-%20Integer%20BASIC.bin'
|
||||
F0_2='Apple%20II%20ROM%20Pages%20F0-F7%20-%20341-0003%20-%20Integer%20BASIC.bin'
|
||||
F8_2='Apple%20II%20ROM%20Pages%20F8-FF%20-%20341-0004%20-%20Original%20Monitor.bin'
|
||||
|
||||
|
||||
D0_2P='Apple%20II%20plus%20ROM%20Pages%20D0-D7%20-%20341-0011%20-%20Applesoft%20BASIC.bin'
|
||||
D8_2P='Apple%20II%20plus%20ROM%20Pages%20D8-DF%20-%20341-0012%20-%20Applesoft%20BASIC.bin'
|
||||
E0_2P='Apple%20II%20plus%20ROM%20Pages%20E0-E7%20-%20341-0013%20-%20Applesoft%20BASIC.bin'
|
||||
E8_2P='Apple%20II%20plus%20ROM%20Pages%20E8-EF%20-%20341-0014%20-%20Applesoft%20BASIC.bin'
|
||||
F0_2P='Apple%20II%20plus%20ROM%20Pages%20F0-F7%20-%20341-0015%20-%20Applesoft%20BASIC.bin'
|
||||
F8_2P='Apple%20II%20plus%20ROM%20Pages%20F8-FF%20-%20341-0020%20-%20Autostart%20Monitor.bin'
|
||||
|
||||
curl $DIR2/$D0_2P > apple2+.rom
|
||||
curl $DIR2/$D8_2P >> apple2+.rom
|
||||
curl $DIR2/$E0_2P >> apple2+.rom
|
||||
curl $DIR2/$E8_2P >> apple2+.rom
|
||||
curl $DIR2/$F0_2P >> apple2+.rom
|
||||
curl $DIR2/$F8_2P >> apple2+.rom
|
||||
|
||||
curl $DIR1/$D0_2 > apple2.rom
|
||||
curl $DIR2/$D8_2P >> apple2.rom
|
||||
curl $DIR1/$E0_2 >> apple2.rom
|
||||
curl $DIR1/$E8_2 >> apple2.rom
|
||||
curl $DIR1/$F0_2 >> apple2.rom
|
||||
curl $DIR1/$F8_2 >> apple2.rom
|
||||
|
||||
curl http://mirrors.apple2.org.za/Apple%20II%20Documentation%20Project/Interface%20Cards/Disk%20Drive%20Controllers/Apple%20Disk%20II%20Interface%20Card/ROM%20Images/Apple%20Disk%20II%2016%20Sector%20Interface%20Card%20ROM%20P5%20-%20341-0027.bin >> 'Apple Disk II 16 Sector Interface Card ROM P5 - 341-0027.bin'
|
@ -16,7 +16,6 @@ import (
|
||||
"golang.org/x/mobile/event/key"
|
||||
"golang.org/x/mobile/event/lifecycle"
|
||||
|
||||
"github.com/zellyn/go6502/cpu"
|
||||
"github.com/zellyn/goapple2"
|
||||
"github.com/zellyn/goapple2/cards"
|
||||
"github.com/zellyn/goapple2/util"
|
||||
@ -38,10 +37,10 @@ const (
|
||||
|
||||
// Run the emulator
|
||||
func RunEmulator(s screen.Screen) {
|
||||
rom := util.ReadRomOrDie("../data/roms/apple2+.rom")
|
||||
// charRom = util.ReadFullCharacterRomOrDie("../data/roms/apple2char.rom")
|
||||
rom := util.ReadRomOrDie("../data/roms/apple2+.rom", 12288)
|
||||
charRom := util.ReadSmallCharacterRomOrDie("../data/roms/apple2-chars.rom")
|
||||
intBasicRom := util.ReadRomOrDie("../data/roms/apple2.rom")
|
||||
intBasicRom := util.ReadRomOrDie("../data/roms/apple2.rom", 12288)
|
||||
util.ReadRomOrDie("../data/roms/Apple Disk II 16 Sector Interface Card ROM P5 - 341-0027.bin", 256)
|
||||
|
||||
eventChan := make(chan (interface{}))
|
||||
w, err := s.NewWindow(&screen.NewWindowOptions{Width: SCREEN_WIDTH, Height: SCREEN_HEIGHT})
|
||||
@ -129,9 +128,8 @@ func RunEmulator(s screen.Screen) {
|
||||
a2.AddPCAction(
|
||||
0xBDAF, goapple2.PCAction{Type: goapple2.ActionDumpMem, String: "0xBDAF-goa2.bin", Delay: 68})
|
||||
*/
|
||||
_ = cpu.FLAG_Z
|
||||
|
||||
// go typeProgram(a2)
|
||||
go typeProgram(a2)
|
||||
|
||||
go func() {
|
||||
for {
|
||||
@ -307,6 +305,8 @@ var KeyToApple = map[Key]byte{
|
||||
func shinyToAppleKeyboard(e key.Event) (byte, error) {
|
||||
if b, ok := KeyToApple[Key{e.Code, e.Modifiers}]; ok {
|
||||
return b, nil
|
||||
} else {
|
||||
fmt.Printf("Key for %v not found\n", e)
|
||||
}
|
||||
/*
|
||||
switch k.Mod {
|
||||
@ -346,8 +346,10 @@ func ProcessEvents(a2 *goapple2.Apple2, w screen.Window, eventChan chan interfac
|
||||
return true
|
||||
}
|
||||
if e.Direction == key.DirPress || e.Direction == key.DirNone {
|
||||
if b, err := shinyToAppleKeyboard(e); err != nil {
|
||||
if b, err := shinyToAppleKeyboard(e); err == nil {
|
||||
a2.Keypress(b)
|
||||
} else {
|
||||
fmt.Printf("Unable to convert event %v (%d, %d): %v\n", e, int(e.Code), int(e.Modifiers), err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -410,7 +412,6 @@ func (s ShinyPlotter) OncePerFrame() {
|
||||
}
|
||||
|
||||
func typeProgram(a2 *goapple2.Apple2) {
|
||||
return
|
||||
lines := []string{
|
||||
"10 GR",
|
||||
"20 POKE -16302,0",
|
||||
|
@ -5,16 +5,19 @@ import (
|
||||
"io/ioutil"
|
||||
)
|
||||
|
||||
func ReadRomOrDie(filename string) []byte {
|
||||
func ReadRomOrDie(filename string, size int) []byte {
|
||||
bytes, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
panic("Cannot read ROM file: " + filename)
|
||||
}
|
||||
if len(bytes) != size {
|
||||
panic(fmt.Sprintf("Want length of %d for ROM %q; want %d", size, filename, len(bytes)))
|
||||
}
|
||||
return bytes
|
||||
}
|
||||
|
||||
func ReadSmallCharacterRomOrDie(filename string) [2048]byte {
|
||||
bytes := ReadRomOrDie(filename)
|
||||
bytes := ReadRomOrDie(filename, 512)
|
||||
if len(bytes) != 512 {
|
||||
panic(fmt.Sprintf("Got %d bytes (not 512) from file '%s'", len(bytes), filename))
|
||||
}
|
||||
@ -29,7 +32,7 @@ func ReadSmallCharacterRomOrDie(filename string) [2048]byte {
|
||||
}
|
||||
|
||||
func ReadFullCharacterRomOrDie(filename string) [2048]byte {
|
||||
bytes := ReadRomOrDie(filename)
|
||||
bytes := ReadRomOrDie(filename, 2048)
|
||||
if len(bytes) != 2048 {
|
||||
panic(fmt.Sprintf("Got %d bytes (not 2048) from file '%s'", len(bytes), filename))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user