Support the Apple II Parallel Printer Interface card

This commit is contained in:
Iván Izaguirre 2022-08-05 19:08:34 +02:00
parent 1777954a54
commit f2bc9f21aa
6 changed files with 80 additions and 5 deletions

3
.gitignore vendored
View File

@ -7,4 +7,5 @@ frontend/a2sdl/*.dsk
frontend/a2fyne/a2fyne
frontend/headless/headless
frontend/*/snapshot.gif
frontend/*/snapshot.png
frontend/*/snapshot.png
frontend/*/printer.out

View File

@ -21,10 +21,11 @@ Portable emulator of an Apple II+ or //e. Written in Go.
- 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 with 64Kb extra RAM and optional RGB modes
- 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)
- SwyftCard (Apple //e only)
@ -78,7 +79,7 @@ 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
- Memory Expansion card with 1Gb in slot 1
- Parallel print inteface in slot 1
- VidHD card (SHR support) in slot 2
- FASTChip Accelerator card in slot 3
- Mouse card in slot 4
@ -206,7 +207,7 @@ Only valid on SDL mode
-languageCardSlot int
slot for the 16kb language card. -1 for none
-memoryExpSlot int
slot for the Memory Expansion card with 1GB. -1 for none (default 1)
slot for the Memory Expansion card with 1GB. -1 for none (default -1)
-mhz float
cpu speed in Mhz, use 0 for full speed. Use F5 to toggle. (default 1.0227142857142857)
-model string
@ -217,6 +218,8 @@ Only valid on SDL mode
add a DS1216 No-Slot-Clock on the main ROM (use 0) or a slot ROM. -1 for none (default -1)
-panicSS
panic if a not implemented softswitch is used
-printer int
slot for the Parallel Printer Interface. -1 for none (default 1)
-profile
generate profile trace to analyse with pprof
-ramworks int

View File

@ -169,6 +169,11 @@ func (a *Apple2) AddSaturnCard(slot int) {
a.insertCard(NewCardSaturn(), slot)
}
// AddParallelPrinter inserts an Apple II Parallel Printer card
func (a *Apple2) AddParallelPrinter(slot int) {
a.insertCard(NewCardParallelPrinter(), slot)
}
// AddMemoryExpansionCard inserts an Apple II Memory Expansion card with 1GB
func (a *Apple2) AddMemoryExpansionCard(slot int) {
a.insertCard(NewCardMemoryExpansion(), slot)

View File

@ -62,8 +62,12 @@ func MainApple() *Apple2 {
"slot for the FASTChip accelerator card, -1 for none")
memoryExpansionCardSlot := flag.Int(
"memoryExpSlot",
1,
-1,
"slot for the Memory Expansion card with 1GB. -1 for none")
parallelPrinterSlot := flag.Int(
"printer",
1,
"slot for the Parallel Printer Interface. -1 for none")
ramWorksKb := flag.Int(
"ramworks",
8192,
@ -227,6 +231,9 @@ func MainApple() *Apple2 {
if *saturnCardSlot >= 0 {
a.AddSaturnCard(*saturnCardSlot)
}
if *parallelPrinterSlot >= 0 {
a.AddParallelPrinter(*parallelPrinterSlot)
}
if *memoryExpansionCardSlot >= 0 {
a.AddMemoryExpansionCard(*memoryExpansionCardSlot)
}

48
cardParallelPrinter.go Normal file
View File

@ -0,0 +1,48 @@
package izapple2
import (
"os"
)
/*
Apple II Parallel Printer Interface card.
See:
https://mirrors.apple2.org.za/Apple%20II%20Documentation%20Project/Interface%20Cards/Parallel/Apple%20II%20Parallel%20Printer%20Interface%20Card/
*/
// CardParallelPrinter represents a Parallel Printer Interface card
type CardParallelPrinter struct {
cardBase
file *os.File
}
// NewCardParallelPrinter creates a new CardParallelPrinter
func NewCardParallelPrinter() *CardParallelPrinter {
var c CardParallelPrinter
c.name = "Parallel Printer Interface"
c.loadRomFromResource("<internal>/Apple II Parallel Printer Interface Card ROM fixed.bin")
return &c
}
func (c *CardParallelPrinter) assign(a *Apple2, slot int) {
f, err := os.OpenFile(printerFile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
panic(err)
}
c.file = f
c.addCardSoftSwitchW(0, func(_ *ioC0Page, value uint8) {
c.printByte(value)
}, "PARALLELDEVW")
c.cardBase.assign(a, slot)
}
const printerFile = "printer.out"
func (c *CardParallelPrinter) printByte(value uint8) {
value = value & 0x7f // Remove the MSB bit
c.file.Write([]byte{value})
}

View File

@ -0,0 +1,11 @@
°8HŠH˜Hx Xÿºhhhh¨Êšh(ª<>¸N˜)I0É
<EFBFBD>)Éx°˜<>8<06>Jj° ¸
 („!<21>=¸<18>¸~¸h¨hªh` 
}8ˆÐúµ!<21>88°ç©‰<C2A9>8<06>¸©…6˜]8
ðç^¸˜
¨<EFBFBD>@<40>þ™€À<E282AC>9I
Ð <0A>8½¸j)€
°_½¸h¨hªhLðý½8ðå!é÷<C3A9>™i…$<24>pþÿÿÿÿÿ<0F>!ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ½8Å$h°H)€ ,Xÿðþ8pˆÿÿÿÿÿ