Let's give this thing a name

This commit is contained in:
Ivan Izaguirre 2020-10-03 23:38:26 +02:00
parent e07754d1d0
commit 66e94574a0
56 changed files with 115 additions and 115 deletions

View File

@ -1,8 +1,8 @@
# Apple ][+, //e emulator
# izapple2 - Apple ][+, //e emulator
Portable emulator of an Apple II+ or //e. Written in Go.
[![CircleCI](https://circleci.com/gh/ivanizag/apple2/tree/master.svg?style=svg)](https://circleci.com/gh/ivanizag/apple2/tree/master)
[![CircleCI](https://circleci.com/gh/ivanizag/izapple2/tree/master.svg?style=svg)](https://circleci.com/gh/ivanizag/izapple2/tree/master)
## Features
@ -72,14 +72,14 @@ By default the following configuration is launched:
## Running the emulator
No installation required. [Download](https://github.com/ivanizag/apple2/releases) the single file executable `apple2xxx_xxx` for linux or Mac, SDL2 graphics or console. Build from source to get the latest features.
No installation required. [Download](https://github.com/ivanizag/izapple2/releases) the single file executable `izapple2xxx_xxx` for linux or Mac, SDL2 graphics or console. Build from source to get the latest features.
### Default mode
Execute without parameters to have an emulated Apple //e Enhanced with 128kb booting DOS 3.3 ready to run Applesoft:
``` terminal
casa@servidor:~$ ./apple2sdl
casa@servidor:~$ ./izapple2sdl
```
![DOS 3.3 started](doc/dos33.png)
@ -89,7 +89,7 @@ casa@servidor:~$ ./apple2sdl
Download a DSK or WOZ file or use an URL ([Asimov](https://www.apple.asimov.net/images/) is an excellent source) with the `-disk` parameter:
``` terminal
casa@servidor:~$ ./apple2sdl -disk "https://www.apple.asimov.net/images/games/action/karateka/karateka (includes intro).dsk"
casa@servidor:~$ ./izapple2sdl -disk "https://www.apple.asimov.net/images/games/action/karateka/karateka (includes intro).dsk"
```
![Karateka](doc/karateka.png)
@ -100,7 +100,7 @@ Download the excellent [Total Replay](https://archive.org/details/TotalReplay) c
[a2-4am](https://github.com/a2-4am/4cade). Run it with the `-hd` parameter:
``` terminal
casa@servidor:~$ ./apple2sdl -hd "Total Replay v3.0.2mg"
casa@servidor:~$ ./izapple2sdl -hd "Total Replay v3.0.2mg"
```
Displays super hi-res box art as seen with the VidHD card.
@ -109,10 +109,10 @@ Displays super hi-res box art as seen with the VidHD card.
### Terminal mode
To run text mode right on the terminal without the SDL2 dependency, use `apple2console`. It runs on the console using ANSI escape codes. Input is sent to the emulated Apple II one line at a time:
To run text mode right on the terminal without the SDL2 dependency, use `izapple2console`. It runs on the console using ANSI escape codes. Input is sent to the emulated Apple II one line at a time:
``` terminal
casa@servidor:~$ ./apple2console -model 2plus
casa@servidor:~$ ./izapple2console -model 2plus
############################################
# #
@ -229,26 +229,26 @@ Only valid on SDL mode
## Building from source
### apple2console
### izapple2console
The only dependency is having a working Go installation on any platform.
Run:
``` terminal
go get github.com/ivanizag/apple2/apple2console
go build github.com/ivanizag/apple2/apple2console
go get github.com/ivanizag/izapple2/izapple2console
go build github.com/ivanizag/izapple2/izapple2console
```
### apple2sdl
### izapple2sdl
Besides having a working Go installation, install the SDL2 developer files. Valid for any platform
Run:
``` terminal
go get github.com/ivanizag/apple2/apple2sdl
go build github.com/ivanizag/apple2/apple2sdl
go get github.com/ivanizag/izapple2/izapple2sdl
go build github.com/ivanizag/izapple2/izapple2sdl
```
### Use docker to cross compile for Linux and Windows
@ -260,4 +260,4 @@ cd docker
./build.sh
```
To run in Windows, copy the file `SDL2.dll` on the same folder as `apple2sdl.exe`. The latest `SDL2.dll` can be found in the [Runtime binary for Windows 64-bit](https://www.libsdl.org/download-2.0.php).
To run in Windows, copy the file `SDL2.dll` on the same folder as `izapple2sdl.exe`. The latest `SDL2.dll` can be found in the [Runtime binary for Windows 64-bit](https://www.libsdl.org/download-2.0.php).

View File

@ -1,10 +1,10 @@
package apple2
package izapple2
import (
"fmt"
"time"
"github.com/ivanizag/apple2/core6502"
"github.com/ivanizag/izapple2/core6502"
)
// Apple2 represents all the components and state of the emulated machine

View File

@ -1,9 +1,9 @@
package apple2
package izapple2
import (
"errors"
"github.com/ivanizag/apple2/core6502"
"github.com/ivanizag/izapple2/core6502"
)
func newApple2() *Apple2 {

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
import (
"flag"

View File

@ -1,9 +1,9 @@
package apple2
package izapple2
import (
"fmt"
"github.com/ivanizag/apple2/core6502"
"github.com/ivanizag/izapple2/core6502"
)
/*

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
import (
"errors"

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
type card interface {
loadRom(data []uint8)

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
import (
"fmt"

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
/*
Simulates just what is needed to make Total Replay use fast mode. Can change

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
import "fmt"

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
import (
"fmt"

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
/*
Language card with 16 extra kb for the Apple ][ and ][+

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
import (
"fmt"

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
/*
Apple II Memory Expansion Card

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
/*
Extended 80-Column Text AppleColor Card or Video7 RGB-SL7 card

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
/*
RAMWorks style card on the Apple IIe aus slot.

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
/*
RAM card with 128Kb. It's like 8 language cards.

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
/*
ThunderClock`, real time clock card.

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
/*
Simulates just what is needed to make Total Replay use the GS modes if the VidHD card is found

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
import (
"errors"

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
import (
"errors"

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
/*
See:

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
type diskette16sectorTimed struct {
nib *fileNib

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
/*
See:

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
import (
"errors"

View File

@ -1,27 +1,27 @@
#!/bin/bash
cd /tmp
git clone https://github.com/ivanizag/apple2
git clone https://github.com/ivanizag/izapple2
# Build apple2console for Linux
cd /tmp/apple2/apple2console
# Build izapple2console for Linux
cd /tmp/apple2/izapple2console
go build .
chown --reference /build apple2console
cp apple2console /build
chown --reference /build izapple2console
cp izapple2console /build
# Build apple2console.exe for Windows
cd /tmp/apple2/apple2console
env CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS=windows CGO_LDFLAGS="-L/usr/x86_64-w64-mingw32/lib" CGO_FLAGS="-I/usr/x86_64-w64-mingw32/include -D_REENTRANT" go build -o apple2console.exe .
chown --reference /build apple2console.exe
cp apple2console.exe /build
# Build izapple2console.exe for Windows
cd /tmp/apple2/izapple2console
env CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS=windows CGO_LDFLAGS="-L/usr/x86_64-w64-mingw32/lib" CGO_FLAGS="-I/usr/x86_64-w64-mingw32/include -D_REENTRANT" go build -o izapple2console.exe .
chown --reference /build izapple2console.exe
cp izapple2console.exe /build
# Build apple2sdl for Linux
cd /tmp/apple2/apple2sdl
# Build izapple2sdl for Linux
cd /tmp/apple2/izapple2sdl
go build .
chown --reference /build apple2sdl
cp apple2sdl /build
chown --reference /build izapple2sdl
cp izapple2sdl /build
# Build apple2sdl.exe for Windows
cd /tmp/apple2/apple2sdl
env CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS=windows CGO_LDFLAGS="-L/usr/x86_64-w64-mingw32/lib -lSDL2" CGO_FLAGS="-I/usr/x86_64-w64-mingw32/include -D_REENTRANT" go build -o apple2sdl.exe .
chown --reference /build apple2sdl.exe
cp apple2sdl.exe /build
# Build izapple2sdl.exe for Windows
cd /tmp/apple2/izapple2sdl
env CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS=windows CGO_LDFLAGS="-L/usr/x86_64-w64-mingw32/lib -lSDL2" CGO_FLAGS="-I/usr/x86_64-w64-mingw32/include -D_REENTRANT" go build -o izapple2sdl.exe .
chown --reference /build izapple2sdl.exe
cp izapple2sdl.exe /build

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
import (
"encoding/binary"

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
import (
"errors"

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
import (
"testing"

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
import (
"bytes"

3
go.mod
View File

@ -1,4 +1,4 @@
module github.com/ivanizag/apple2
module github.com/ivanizag/izapple2
go 1.12
@ -7,5 +7,4 @@ require (
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 // indirect
github.com/shurcooL/vfsgen v0.0.0-20181202132449-6a9ea43bcacd
github.com/veandco/go-sdl2 v0.4.0-rc.1
golang.org/x/tools v0.0.0-20191220234730-f13409bbebaf // indirect
)

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
import (
"fmt"

View File

@ -7,7 +7,7 @@ import (
"strings"
"time"
apple2 "github.com/ivanizag/apple2"
apple2 "github.com/ivanizag/izapple2"
)
func main() {

View File

@ -5,17 +5,18 @@ import (
"image"
"unsafe"
"github.com/ivanizag/apple2"
"github.com/ivanizag/izapple2"
"github.com/pkg/profile"
"github.com/veandco/go-sdl2/sdl"
)
func main() {
a := apple2.MainApple()
a := izapple2.MainApple()
if a != nil {
if a.IsProfiling() {
// See the log with:
// go tool pprof --pdf ~/go/bin/apple2sdl /tmp/profile329536248/cpu.pprof > profile.pdf
// go tool pprof --pdf ~/go/bin/izapple2sdl /tmp/profile329536248/cpu.pprof > profile.pdf
defer profile.Start().Stop()
}
@ -24,7 +25,7 @@ func main() {
}
// SDLRun starts the Apple2 emulator on SDL
func SDLRun(a *apple2.Apple2) {
func SDLRun(a *izapple2.Apple2) {
window, renderer, err := sdl.CreateWindowAndRenderer(4*40*7, 4*24*8,
sdl.WINDOW_SHOWN)
@ -35,7 +36,7 @@ func SDLRun(a *apple2.Apple2) {
defer window.Destroy()
defer renderer.Destroy()
window.SetTitle(a.Name)
window.SetTitle("iz-" + a.Name)
kp := newSDLKeyBoard(a)
a.SetKeyboardProvider(kp)
@ -55,7 +56,7 @@ func SDLRun(a *apple2.Apple2) {
for event := sdl.PollEvent(); event != nil; event = sdl.PollEvent() {
switch t := event.(type) {
case *sdl.QuitEvent:
a.SendCommand(apple2.CommandKill)
a.SendCommand(izapple2.CommandKill)
running = false
case *sdl.KeyboardEvent:
kp.putKey(t)
@ -76,9 +77,9 @@ func SDLRun(a *apple2.Apple2) {
if paused != a.IsPaused() {
if a.IsPaused() {
window.SetTitle(a.Name + " - PAUSED!")
window.SetTitle("iz-" + a.Name + " - PAUSED!")
} else {
window.SetTitle(a.Name)
window.SetTitle("iz-" + a.Name)
}
paused = a.IsPaused()
}

View File

@ -4,18 +4,18 @@ import (
"fmt"
"unicode/utf8"
"github.com/ivanizag/apple2"
"github.com/ivanizag/izapple2"
"github.com/veandco/go-sdl2/sdl"
)
type sdlKeyboard struct {
keyChannel chan uint8
a *apple2.Apple2
a *izapple2.Apple2
showPages bool
}
func newSDLKeyBoard(a *apple2.Apple2) *sdlKeyboard {
func newSDLKeyBoard(a *izapple2.Apple2) *sdlKeyboard {
var k sdlKeyboard
k.keyChannel = make(chan uint8, 100)
k.a = a
@ -98,33 +98,33 @@ func (k *sdlKeyboard) putKey(keyEvent *sdl.KeyboardEvent) {
// Control of the emulator
case sdl.K_F1:
if ctrl {
k.a.SendCommand(apple2.CommandReset)
k.a.SendCommand(izapple2.CommandReset)
}
case sdl.K_F5:
if ctrl {
k.a.SendCommand(apple2.CommandShowSpeed)
k.a.SendCommand(izapple2.CommandShowSpeed)
} else {
k.a.SendCommand(apple2.CommandToggleSpeed)
k.a.SendCommand(izapple2.CommandToggleSpeed)
}
case sdl.K_F6:
k.a.SendCommand(apple2.CommandToggleColor)
k.a.SendCommand(izapple2.CommandToggleColor)
case sdl.K_F7:
k.showPages = !k.showPages
case sdl.K_F9:
k.a.SendCommand(apple2.CommandDumpDebugInfo)
k.a.SendCommand(izapple2.CommandDumpDebugInfo)
case sdl.K_F10:
k.a.SendCommand(apple2.CommandNextCharGenPage)
k.a.SendCommand(izapple2.CommandNextCharGenPage)
case sdl.K_F11:
k.a.SendCommand(apple2.CommandToggleCPUTrace)
k.a.SendCommand(izapple2.CommandToggleCPUTrace)
case sdl.K_F12:
err := apple2.SaveSnapshot(k.a, "snapshot.png")
err := izapple2.SaveSnapshot(k.a, "snapshot.png")
if err != nil {
fmt.Printf("Error saving snapshoot: %v.\n.", err)
} else {
fmt.Println("Saving snapshot")
}
case sdl.K_PAUSE:
k.a.SendCommand(apple2.CommandPauseUnpauseEmulator)
k.a.SendCommand(izapple2.CommandPauseUnpauseEmulator)
}
// Missing values 91 to 95. Usually control for [\]^_

View File

@ -10,7 +10,7 @@ import (
"reflect"
"unsafe"
"github.com/ivanizag/apple2"
"github.com/ivanizag/izapple2"
"github.com/veandco/go-sdl2/sdl"
)
@ -18,7 +18,7 @@ const (
samplingHz = 48000
bufferSize = 1000
// bufferSize/samplingHz will be the max delay of the sound
sampleDurationCycles = 1000000 * apple2.CPUClockMhz / samplingHz
sampleDurationCycles = 1000000 * izapple2.CPUClockMhz / samplingHz
// each sample on the sound stream is 21.31 cpu cycles approx
maxOutOfSyncMs = 2000
decayLevel = 128
@ -49,10 +49,10 @@ func newSDLSpeaker() *sdlSpeaker {
// Click receives a speaker click. The argument is the CPU cycle when it is generated
func (s *sdlSpeaker) Click(cycle uint64) {
select {
case s.clickChannel <- cycle:
// Sent
default:
// The channel is full, the click is lost.
case s.clickChannel <- cycle:
// Sent
default:
// The channel is full, the click is lost.
}
}
@ -88,7 +88,7 @@ func SpeakerCallback(userdata unsafe.Pointer, stream *C.Uint8, length C.int) {
}
// Verify that we are not too long behind
var maxOutOfSyncCyclesFloat = 1000 * apple2.CPUClockMhz * maxOutOfSyncMs
var maxOutOfSyncCyclesFloat = 1000 * izapple2.CPUClockMhz * maxOutOfSyncMs
var maxOutOfSyncCycles = uint64(maxOutOfSyncCyclesFloat)
for _, pc := range s.pendingClicks {
if pc-s.lastCycle > maxOutOfSyncCycles {

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
import "fmt"

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
import (
"fmt"

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
import (
"time"

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
import (
"time"

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
import (
"io"
@ -7,7 +7,7 @@ import (
"os"
"strings"
"github.com/ivanizag/apple2/romdumps"
"github.com/ivanizag/izapple2/romdumps"
)
const (

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
import (
"fmt"

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
import (
"image"

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
import (
"image"

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
import (
"image"

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
import (
"testing"

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
import (
"image"

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
import (
"image"

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
import (
"image"

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
import (
"fmt"

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
import (
"testing"

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
const (
ioDataKeyboard uint8 = 0x10

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
/*
See:

View File

@ -1,4 +1,4 @@
package apple2
package izapple2
import "fmt"