izapple2

package module
v0.0.0-...-d94ec37 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2026 License: GPL-3.0 Imports: 31 Imported by: 0

README

izapple2 - Apple ][+, //e emulator

Portable emulator of an Apple II+ or //e. Written in Go.

Features

  • Models:

    • Apple ][+ with 48Kb of base RAM
    • Apple //e with 128Kb of RAM
    • Apple //e enhanced with 128Kb of RAM
    • Base64A clone with 48Kb of base RAM and paged ROM
    • Basis 108 clone (partial)
  • Storage

    • 16 Sector 5 1/4 diskettes. Uncompressed or compressed witth gzip or zip. Supported formats:
    • 13 Sector 5 1/4 diskettes. Uncompressed or compressed witth gzip or zip. Supported formats:
      • NIB (read only)
      • WOZ 2.0 (read only)
    • 3.5 disks in PO or 2MG format
    • Hard disk in HDV or 2MG format with ProDOS and SmartPort support
  • Emulated extension cards:

    • DiskII controller (state machine based for WOZ files)
    • 16Kb Language Card
    • 256Kb Saturn RAM
    • Parallel Printer Interface card
    • 1Mb Memory Expansion Card (slinky)
    • RAMWorks style expansion Card (up to 16MB additional) (Apple //e only)
    • ThunderClock Plus real time clock
    • Apple //e 80 columns card with 64Kb extra RAM and optional RGB modes
    • No Slot Clock based on the DS1216
    • Videx Videoterm 80 column card with the Videx Soft Video Switch (Apple ][+ only)
    • Videx Ultraterm 80 to 160 column card wuth integrated Video Switch
    • SwyftCard (Apple //e only)
    • Brain Board
    • Brain Board II
    • MultiROM card
    • Dan ][ Controller card
    • ProDOS ROM card
    • Microsoft Z80 Softcard using the Z80 emulation from Koron
  • Useful cards not emulating a real card

    • Bootable SmartPort / ProDOS card with the following smartport devices:
      • Block device (hard disks)
      • Fujinet network device (supports only http(s) with GET and JSON)
      • Fujinet clock (not in Fujinet upstream)
    • VidHd, limited to the ROM signature and SHR as used by Total Replay, only for //e models with 128Kb
    • FASTChip, limited to what Total Replay needs to set and clear fast mode
    • Mouse Card, emulates the entry points, not the softswitches.
    • Host console card. Maps the host STDIN and STDOUT to PR# and IN#
    • ROMXe, limited to font switching
  • Graphic modes:

    • Text 40 columns
    • Text 80 columns Apple //e
    • Text 80 columns Videx VideoTerm
    • Text up to 160 columns and 48 lines Videx UltraTerm
    • Low-Resolution graphics
    • Double-Width Low-Resolution graphics (Apple //e only)
    • High-Resolution graphics
    • Double-Width High-Resolution graphics (Apple //e only)
    • Super High Resolution (VidHD only)
    • Mixed mode
    • RGB card text 40 columns with 16 colors for foreground and background (mixable)
    • RGB card mode 11, mono 560x192
    • RGB card mode 12, ntsc 160*192
    • RGB card mode 13, ntsc 140*192 (regular DHGR)
    • RGB card mode 14, mix of modes 11 and 13 on the fly
  • Displays:

    • Green monochrome monitor with half width pixel support
    • NTSC Color TV (extracting the phase from the mono signal)
    • RGB for Super High Resolution and RGB card
    • ANSI Console, avoiding the SDL2 dependency
    • Debug mode: shows four panels with actual screen, page1, page2 and extra info dependant of the video mode
  • Tracing capabilities:

    • CPU execution disassembled
    • Softswitch reads and writes
    • ProDOS MLI calls
    • Apple Pascal BIOS calls
    • SmartPort commands
    • BBC MOS calls when using Applecorn
  • Other features:

    • Sound
    • Joystick support. Up to two joysticks or four paddles
    • Mouse support. No mouse capture needed
    • Adjustable speed
    • Fast disk mode to set max speed while using the disks
    • Single file executable with embedded ROMs and DOS 3.3
    • Pause (thanks a2geek)
    • Passes the A2AUDIT 1.06 tests as II+, //e, and //e Enhanced.
    • Partial pass ot the ProcessorTests for 6502 and 65c02. Failing test 6502/v1/20_55_13; flags N anv V issues with ADC; and missing some undocumented 6502 opcodes.

By default the following configuration is launched:

  • Enhanced Apple //e with 65c02 processor
  • RAMWorks card with 80 column, RGB (with Video7 modes) and 8Gb RAM in aux slot
  • Parallel print inteface in slot 1
  • VidHD card (SHR support) in slot 2
  • FASTChip Accelerator card in slot 3
  • Mouse card in slot 4
  • SmartPort card with 1 device in slot 5 (if an image is provided with -disk35)
  • DiskII controller card in slot 6
  • SmartPort card with 1 device in slot 7 (if an image is provided with -hd)

Running the emulator

No installation required. Download 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:

casa@servidor:~$ ./izapple2sdl

DOS 3.3 started

Play games

Download a DSK or WOZ file or use an URL (Asimov is an excellent source):

casa@servidor:~$ ./izapple2sdl "https://www.apple.asimov.net/images/games/action/karateka/karateka (includes intro).dsk"

Karateka

Play the Total Replay collection

Download the excellent Total Replay compilation by a2-4am:

casa@servidor:~$ ./izapple2sdl Total\ Replay\ v4.0.hdv

Displays super hi-res box art as seen with the VidHD card.

Total Replay

Terminal mode

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:

casa@servidor:~$ ./izapple2console -model 2plus

############################################
#                                          #
#                APPLE II                  #
#                                          #
#     DOS VERSION 3.3  SYSTEM MASTER       #
#                                          #
#                                          #
#            JANUARY 1, 1983               #
#                                          #
#                                          #
# COPYRIGHT APPLE COMPUTER,INC. 1980,1982  #
#                                          #
#                                          #
# ]10 PRINT "HELLO WORLD"                  #
#                                          #
# ]LIST                                    #
#                                          #
# 10  PRINT "HELLO WORLD"                  #
#                                          #
# ]RUN                                     #
# HELLO WORLD                              #
#                                          #
# ]_                                       #
#                                          #
#                                          #
############################################
Line:

Command line options

See doc/command_line.md for a complete guide on command line configuration.

Building from source

Linux

Besides having a working Go installation, install the SDL2 developer files. Run:

git clone github.com/ivanizag/izapple2
cd izapple2/frontend/a2sdl
go build .
MacOS

With a working Go installation, run:

brew install SDL2
git clone github.com/ivanizag/izapple2
cd izapple2/frontend/a2sdl
go build .
Windows

On Windows, CGO needs a gcc compiler. Install mingw-w64 and the SDL2 developer files for mingw-64.

Run:

git clone github.com/ivanizag/izapple2
cd izapple2\frontend\a2sdl
go build .

To run in Windows, copy the file SDL2.dll on the same folder as a2sdl.exe. The latest SDL2.dll can be found in the Runtime binary for Windows 64-bit.

Use docker to cross compile for Linux and Windows

To create executables for Linux and Windows without installing Go, SDL2 or the Windows cross compilation toosl, run:

cd docker
./build.sh

Documentation

Index

Constants

View Source
const (
	// CommandToggleSpeed toggles cpu speed between full speed and actual Apple II speed
	CommandToggleSpeed = iota + 1
	// CommandShowSpeed toggles printinf the current freq in Mhz
	CommandShowSpeed
	// CommandDumpDebugInfo dumps useful info
	CommandDumpDebugInfo
	// CommandNextCharGenPage cycles the CharGen page if several
	CommandNextCharGenPage
	// CommandToggleCPUTrace toggle tracing of CPU execution
	CommandToggleCPUTrace
	// CommandKill stops the cpu execution loop
	CommandKill
	// CommandReset executes a 6502 reset
	CommandReset
	// CommandPauseUnpause allows the Pause button to freeze the emulator for a coffee break
	CommandPauseUnpause
	// CommandPause pauses the emulator
	CommandPause
	// CommandStart restarts the emulator
	CommandStart
	// CommandComplex for commands that use a struct with parameters
	CommandComplex
)
View Source
const (
	// CPUClockMhz is the actual Apple II clock speed
	CPUClockMhz = 14.318 / 14
)

Variables

View Source
var PROGMEM = [512]uint8{}/* 446 elements not displayed */
View Source
var PROGMEM_v7 = [3 * 512]uint8{}/* 1349 elements not displayed */

Functions

func DumpTextModeAnsi

func DumpTextModeAnsi(a *Apple2) string

DumpTextModeAnsi returns the text mode contents using ANSI escape codes for reverse and flash

func LoadBlockDisk

func LoadBlockDisk(filename string) (storage.BlockDisk, error)

LoadBlockDisk returns a BlockDisk

func LoadDiskette

func LoadDiskette(filename string) (storage.Diskette, error)

LoadDiskette returns a Diskette by detecting the format

func LoadResource

func LoadResource(filename string) ([]uint8, bool, error)

LoadResource loads in memory a file from the filesystem, http or embedded

Types

type Apple2

type Apple2 struct {
	Name string
	// contains filtered or unexported fields
}

Apple2 represents all the components and state of the emulated machine

func CreateConfiguredApple

func CreateConfiguredApple() (*Apple2, error)

CreateConfiguredApple is a device independent main. Video, keyboard and speaker won't be defined

func (*Apple2) BreakPoint

func (a *Apple2) BreakPoint() bool

func (*Apple2) GetCards

func (a *Apple2) GetCards() [8]Card

GetCards returns the array of inserted cards

func (*Apple2) GetCgPageInfo

func (a *Apple2) GetCgPageInfo() (int, int)

func (*Apple2) GetCurrentFreqMHz

func (a *Apple2) GetCurrentFreqMHz() float64

func (*Apple2) GetCycles

func (a *Apple2) GetCycles() uint64

func (*Apple2) GetVideoSource

func (a *Apple2) GetVideoSource() screen.VideoSource

func (*Apple2) IsForceCaps

func (a *Apple2) IsForceCaps() bool

IsForceCaps returns true when all letters are forced to upper case

func (*Apple2) IsPaused

func (a *Apple2) IsPaused() bool

IsPaused returns true when emulator is paused

func (*Apple2) IsProfiling

func (a *Apple2) IsProfiling() bool

IsProfiling returns true when profiling

func (*Apple2) ReleaseFastMode

func (a *Apple2) ReleaseFastMode()

func (*Apple2) RequestFastMode

func (a *Apple2) RequestFastMode()

func (*Apple2) Run

func (a *Apple2) Run()

Run starts the Apple2 emulation

func (*Apple2) SendCommand

func (a *Apple2) SendCommand(commandId int)

SendCommand enqueues a command to the emulator thread

func (*Apple2) SendLoadDisk

func (a *Apple2) SendLoadDisk(drive int, path string)

func (*Apple2) SetCycleBreakpoint

func (a *Apple2) SetCycleBreakpoint(cycle uint64)

SetCycleBreakpoint sets a cycle number to pause the emulator. 0 to disable

func (*Apple2) SetForceCaps

func (a *Apple2) SetForceCaps(value bool)

SetForceCaps allows the caps state to be toggled at runtime

func (*Apple2) SetJoysticksProvider

func (a *Apple2) SetJoysticksProvider(j JoysticksProvider)

SetJoysticksProvider attaches an external joysticks provider

func (*Apple2) SetKeyboardProvider

func (a *Apple2) SetKeyboardProvider(kb KeyboardProvider)

SetKeyboardProvider attaches an external keyboard provider

func (*Apple2) SetMouseProvider

func (a *Apple2) SetMouseProvider(m MouseProvider)

SetMouseProvider attaches an external joysticks provider

func (*Apple2) SetSpeakerProvider

func (a *Apple2) SetSpeakerProvider(s SpeakerProvider)

SetSpeakerProvider attaches an external keyboard provider

func (*Apple2) Start

func (a *Apple2) Start(paused bool)

Start the Apple2 emulation, can start paused

func (*Apple2) UsesMouse

func (a *Apple2) UsesMouse() bool

UsesMouse returns true when the emulator uses the mouse

type Card

type Card interface {
	GetName() string
	GetInfo() map[string]string
	// contains filtered or unexported methods
}

Card represents an Apple II card to be inserted in a slot

type CardBrainBoard

type CardBrainBoard struct {
	// contains filtered or unexported fields
}

CardBrainBoard represents a Brain Board card

func (*CardBrainBoard) GetInfo

func (c *CardBrainBoard) GetInfo() map[string]string

func (*CardBrainBoard) GetName

func (c *CardBrainBoard) GetName() string

type CardBrainBoardII

type CardBrainBoardII struct {
	// contains filtered or unexported fields
}

CardBrainBoardII represents a Brain Board II card

func (*CardBrainBoardII) GetInfo

func (c *CardBrainBoardII) GetInfo() map[string]string

func (*CardBrainBoardII) GetName

func (c *CardBrainBoardII) GetName() string

type CardDan2Controller

type CardDan2Controller struct {
	// contains filtered or unexported fields
}

CardDan2Controller represents a Dan ][ controller card

func (*CardDan2Controller) GetInfo

func (c *CardDan2Controller) GetInfo() map[string]string

func (*CardDan2Controller) GetName

func (c *CardDan2Controller) GetName() string

type CardDisk2

type CardDisk2 struct {
	// contains filtered or unexported fields
}

CardDisk2 is a DiskII interface card

func (*CardDisk2) GetInfo

func (c *CardDisk2) GetInfo() map[string]string

GetInfo returns smartPort info

func (*CardDisk2) GetName

func (c *CardDisk2) GetName() string

type CardDisk2Sequencer

type CardDisk2Sequencer struct {
	// contains filtered or unexported fields
}

CardDisk2Sequencer is a DiskII interface card with the Woz state machine

func (*CardDisk2Sequencer) GetInfo

func (c *CardDisk2Sequencer) GetInfo() map[string]string

GetInfo returns card info

func (*CardDisk2Sequencer) GetName

func (c *CardDisk2Sequencer) GetName() string

type CardFastChip

type CardFastChip struct {
	// contains filtered or unexported fields
}

CardFastChip represents a

func (*CardFastChip) GetInfo

func (c *CardFastChip) GetInfo() map[string]string

func (*CardFastChip) GetName

func (c *CardFastChip) GetName() string

type CardInOut

type CardInOut struct {
	// contains filtered or unexported fields
}

CardInOut is an experimental card to bridge with the host console

func (*CardInOut) GetInfo

func (c *CardInOut) GetInfo() map[string]string

func (*CardInOut) GetName

func (c *CardInOut) GetName() string

type CardLanguage

type CardLanguage struct {
	// contains filtered or unexported fields
}

CardLanguage is an Language Card

func (*CardLanguage) GetInfo

func (c *CardLanguage) GetInfo() map[string]string

func (*CardLanguage) GetName

func (c *CardLanguage) GetName() string

type CardLogger

type CardLogger struct {
	// contains filtered or unexported fields
}

CardLogger is a fake card to log soft switch invocations

func (*CardLogger) GetInfo

func (c *CardLogger) GetInfo() map[string]string

func (*CardLogger) GetName

func (c *CardLogger) GetName() string

type CardMemoryExpansion

type CardMemoryExpansion struct {
	// contains filtered or unexported fields
}

CardMemoryExpansion is a Memory Expansion card

func (*CardMemoryExpansion) GetInfo

func (c *CardMemoryExpansion) GetInfo() map[string]string

GetInfo returns card info

func (*CardMemoryExpansion) GetName

func (c *CardMemoryExpansion) GetName() string

type CardMouse

type CardMouse struct {
	// contains filtered or unexported fields
}

CardMouse represents a SmartPort card

func (*CardMouse) GetInfo

func (c *CardMouse) GetInfo() map[string]string

func (*CardMouse) GetName

func (c *CardMouse) GetName() string

type CardParallelPrinter

type CardParallelPrinter struct {
	// contains filtered or unexported fields
}

CardParallelPrinter represents a Parallel Printer Interface card

func (*CardParallelPrinter) GetInfo

func (c *CardParallelPrinter) GetInfo() map[string]string

func (*CardParallelPrinter) GetName

func (c *CardParallelPrinter) GetName() string

type CardProDOSRomCard3

type CardProDOSRomCard3 struct {
	// contains filtered or unexported fields
}

CardProDOSRomCard3 is a Memory Expansion card

func (*CardProDOSRomCard3) GetInfo

func (c *CardProDOSRomCard3) GetInfo() map[string]string

func (*CardProDOSRomCard3) GetName

func (c *CardProDOSRomCard3) GetName() string

type CardProDOSRomDrive

type CardProDOSRomDrive struct {
	// contains filtered or unexported fields
}

CardMemoryExpansion is a Memory Expansion card

func (*CardProDOSRomDrive) GetInfo

func (c *CardProDOSRomDrive) GetInfo() map[string]string

func (*CardProDOSRomDrive) GetName

func (c *CardProDOSRomDrive) GetName() string

type CardProfile

type CardProfile struct {
	// contains filtered or unexported fields
}

CardProfile represents the Apple II Profile interface card

func (*CardProfile) GetInfo

func (c *CardProfile) GetInfo() map[string]string

func (*CardProfile) GetName

func (c *CardProfile) GetName() string

type CardSaturn

type CardSaturn struct {
	// contains filtered or unexported fields
}

CardSaturn is a Saturn128 card

func (*CardSaturn) GetInfo

func (c *CardSaturn) GetInfo() map[string]string

func (*CardSaturn) GetName

func (c *CardSaturn) GetName() string

type CardSmartPort

type CardSmartPort struct {
	// contains filtered or unexported fields
}

CardSmartPort represents a SmartPort card

func (*CardSmartPort) AddDevice

func (c *CardSmartPort) AddDevice(device smartPortDevice)

LoadImage loads a disk image

func (*CardSmartPort) GetInfo

func (c *CardSmartPort) GetInfo() map[string]string

GetInfo returns smartPort info

func (*CardSmartPort) GetName

func (c *CardSmartPort) GetName() string

func (*CardSmartPort) LoadImage

func (c *CardSmartPort) LoadImage(filename string, trace bool) error

LoadImage loads a disk image

type CardSwyft

type CardSwyft struct {
	// contains filtered or unexported fields
}

CardSwyft represents a Swyft card

func (*CardSwyft) GetInfo

func (c *CardSwyft) GetInfo() map[string]string

func (*CardSwyft) GetName

func (c *CardSwyft) GetName() string

type CardThunderClockPlus

type CardThunderClockPlus struct {
	// contains filtered or unexported fields
}

CardThunderClockPlus represents a ThunderClock+ card

func (*CardThunderClockPlus) GetInfo

func (c *CardThunderClockPlus) GetInfo() map[string]string

func (*CardThunderClockPlus) GetName

func (c *CardThunderClockPlus) GetName() string

type CardVidHD

type CardVidHD struct {
	// contains filtered or unexported fields
}

CardVidHD represents a VidHD card

func (*CardVidHD) GetInfo

func (c *CardVidHD) GetInfo() map[string]string

func (*CardVidHD) GetName

func (c *CardVidHD) GetName() string

type CardVidexUltraterm

type CardVidexUltraterm struct {
	// contains filtered or unexported fields
}

CardVidex represents a Videx Ultraterm compatible 80 column card

func (*CardVidexUltraterm) GetInfo

func (c *CardVidexUltraterm) GetInfo() map[string]string

func (*CardVidexUltraterm) GetName

func (c *CardVidexUltraterm) GetName() string

type CardVidexVideoterm

type CardVidexVideoterm struct {
	// contains filtered or unexported fields
}

CardVidexVideoterm represents a Videx compatible 80 column card

func (*CardVidexVideoterm) GetInfo

func (c *CardVidexVideoterm) GetInfo() map[string]string

func (*CardVidexVideoterm) GetName

func (c *CardVidexVideoterm) GetName() string

type CardZ80SoftCard

type CardZ80SoftCard struct {
	// contains filtered or unexported fields
}

CardVidHD represents a VidHD card

func (*CardZ80SoftCard) GetInfo

func (c *CardZ80SoftCard) GetInfo() map[string]string

func (*CardZ80SoftCard) GetName

func (c *CardZ80SoftCard) GetName() string

type CharacterGenerator

type CharacterGenerator struct {
	// contains filtered or unexported fields
}

CharacterGenerator represents the ROM wth the characters bitmaps

type JoysticksProvider

type JoysticksProvider interface {
	ReadButton(i int) bool
	ReadPaddle(i int) (uint8, bool)
}

JoysticksProvider abstracts the joysticks

type KeyboardChannel

type KeyboardChannel struct {
	// contains filtered or unexported fields
}

KeyboardChannel is a possible implemetation of a Keyboard provider

func NewKeyboardChannel

func NewKeyboardChannel(a *Apple2) *KeyboardChannel

NewKeyboardChannel returns an instance of KeyboardChannel

func (*KeyboardChannel) GetKey

func (k *KeyboardChannel) GetKey(_ bool) (key uint8, ok bool)

GetKey returns a pressed key if available

func (*KeyboardChannel) PutChar

func (k *KeyboardChannel) PutChar(ch uint8)

PutChar sends a character to the emulator

func (*KeyboardChannel) PutRune

func (k *KeyboardChannel) PutRune(ch rune)

PutRune sends a rune to the emulator if it is valid printable ASCII

func (*KeyboardChannel) PutText

func (k *KeyboardChannel) PutText(text string)

PutText sends texts to the emulator as succesive chars

type KeyboardProvider

type KeyboardProvider interface {
	GetKey(strobe bool) (key uint8, ok bool)
}

KeyboardProvider provides a keyboard implementation

type MouseProvider

type MouseProvider interface {
	ReadMouse() (x uint16, y uint16, pressed bool)
}

MouseProvider abstracts the mouse

type MultiRomCard

type MultiRomCard struct {
	// contains filtered or unexported fields
}

MultiRomCard represents a Multiple Image ROM Card

func (*MultiRomCard) GetInfo

func (c *MultiRomCard) GetInfo() map[string]string

func (*MultiRomCard) GetName

func (c *MultiRomCard) GetName() string

type SmartPortFujinetClock

type SmartPortFujinetClock struct {
	// contains filtered or unexported fields
}

SmartPortFujinetClock represents a Fujinet clock device

func NewSmartPortFujinetClock

func NewSmartPortFujinetClock(host *CardSmartPort) *SmartPortFujinetClock

NewSmartPortFujinetClock creates a new fujinet device

type SmartPortFujinetNetwork

type SmartPortFujinetNetwork struct {
	// contains filtered or unexported fields
}

SmartPortFujinetNetwork represents a Fujinet device

func NewSmartPortFujinetNetwork

func NewSmartPortFujinetNetwork(host *CardSmartPort) *SmartPortFujinetNetwork

NewSmartPortFujinetNetwork creates a new fujinet device

type SmartPortHardDisk

type SmartPortHardDisk struct {
	// contains filtered or unexported fields
}

SmartPortHardDisk represents a hard disk

func NewSmartPortHardDisk

func NewSmartPortHardDisk(host *CardSmartPort, filename string) (*SmartPortHardDisk, error)

NewSmartPortHardDisk creates a new hard disk with the smartPort interface

type SpeakerProvider

type SpeakerProvider interface {
	// Click receives a speaker click. The argument is the CPU cycle when it is generated
	Click(cycle uint64)
}

SpeakerProvider provides a speaker implementation

Directories

Path Synopsis
frontend
a2ebiten command
a2fyne command
a2sdl command
console command
headless command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL