diff --git a/apple2Setup.go b/apple2Setup.go index 58be655..0aa0072 100644 --- a/apple2Setup.go +++ b/apple2Setup.go @@ -130,6 +130,13 @@ func (a *Apple2) AddHardDisk(slot int, hdImage string, trace bool) error { return nil } +// AddVidHD adds a card with the signature of VidHD +func (a *Apple2) AddVidHD(slot int) { + var c cardVidHD + c.loadRom(buildVidHDRom()) + a.insertCard(&c, slot) +} + // AddLanguageCard inserts a 16Kb card func (a *Apple2) AddLanguageCard(slot int) { a.insertCard(&cardLanguage{}, slot) diff --git a/apple2main.go b/apple2main.go index 35319fd..95a8b20 100644 --- a/apple2main.go +++ b/apple2main.go @@ -53,51 +53,46 @@ func MainApple() *Apple2 { "thunderClockCardSlot", 4, "slot for the ThunderClock Plus card. -1 for none") + vidHDCardSlot := flag.Int( + "vidHDSlot", + 2, + "slot for the VidHD card, -1 for none") mono := flag.Bool( "mono", false, - "emulate a green phosphor monitor instead of a NTSC color TV. Use F6 to toggle.", - ) + "emulate a green phosphor monitor instead of a NTSC color TV. Use F6 to toggle.") fastDisk := flag.Bool( "fastDisk", true, - "set fast mode when the disks are spinning", - ) + "set fast mode when the disks are spinning") panicSS := flag.Bool( "panicSS", false, - "panic if a not implemented softswitch is used", - ) + "panic if a not implemented softswitch is used") traceCPU := flag.Bool( "traceCpu", false, - "dump to the console the CPU execution operations", - ) + "dump to the console the CPU execution operations") traceSS := flag.Bool( "traceSS", false, - "dump to the console the sofswitches calls", - ) + "dump to the console the sofswitches calls") traceHD := flag.Bool( "traceHD", false, - "dump to the console the hd commands", - ) + "dump to the console the hd commands") dumpChars := flag.Bool( "dumpChars", false, - "shows the character map", - ) + "shows the character map") model := flag.String( "model", "2enh", - "set base model. Models available 2plus, 2e, 2enh, base64a", - ) + "set base model. Models available 2plus, 2e, 2enh, base64a") profile := flag.Bool( "profile", false, - "generate profile trace to analyse with pprof", - ) + "generate profile trace to analyse with pprof") flag.Parse() var a *Apple2 @@ -190,6 +185,9 @@ func MainApple() *Apple2 { panic(err) } } + if *vidHDCardSlot > 0 { + a.AddVidHD(*vidHDCardSlot) + } if *disk2Slot > 0 { err := a.AddDisk2(*disk2Slot, *disk2RomFile, *diskImage) if err != nil { diff --git a/cardVidHD.go b/cardVidHD.go new file mode 100644 index 0000000..e1f3acc --- /dev/null +++ b/cardVidHD.go @@ -0,0 +1,26 @@ +package apple2 + +/* +Simulates just what is needed to make Total Replay use the GS modes if the VidHD card is found + +See: + https://github.com/a2-4am/4cade/blob/master/src/hw.vidhd.a +*/ + +type cardVidHD struct { + cardBase +} + +func buildVidHDRom() []uint8 { + data := make([]uint8, 256) + + data[0] = 0x24 + data[1] = 0xEA + data[2] = 0x4C + + return data +} + +func (c *cardVidHD) assign(a *Apple2, slot int) { + c.cardBase.assign(a, slot) +}