diff --git a/README.md b/README.md index 4991f2f..134f3eb 100644 --- a/README.md +++ b/README.md @@ -158,6 +158,7 @@ Line: - F6: Toggle between NTSC color TV and green phosphor monochrome monitor - F7: Show the video mode and a split screen with the views for NTSC color TV, page 1, page 2 and extra info. - F10: Cycle character generator code pages. Only if the character generator ROM has more than one 2Kb page. +- Ctrl-F10: Show the charater map for the current character generator page. - F11: Toggle on and off the trace to console of the CPU execution - F12: Save a screen snapshot to a file `snapshot.png` - Pause: Pause the emulation @@ -181,8 +182,6 @@ Only valid on SDL mode rom file for the disk drive controller (default "/DISK2.rom") -diskb string file to load on the second disk drive - -dumpChars - shows the character map -fastChipSlot int slot for the FASTChip accelerator card, -1 for none (default 3) -forceCaps diff --git a/apple2main.go b/apple2main.go index 4598bdf..f4c0e2a 100644 --- a/apple2main.go +++ b/apple2main.go @@ -2,7 +2,6 @@ package izapple2 import ( "flag" - "os" "github.com/ivanizag/izapple2/storage" ) @@ -115,10 +114,6 @@ func MainApple() *Apple2 { "traceHD", false, "dump to the console the hd/smarport commands") - dumpChars := flag.Bool( - "dumpChars", - false, - "shows the character map") model := flag.String( "model", "2enh", @@ -306,11 +301,5 @@ func MainApple() *Apple2 { // a.AddRomX() // a.AddCardLogger(4) - if *dumpChars { - a.cg.Dump() - os.Exit(0) - return nil - } - return a } diff --git a/characterGenerator.go b/characterGenerator.go index 1122803..dfc750e 100644 --- a/characterGenerator.go +++ b/characterGenerator.go @@ -2,7 +2,6 @@ package izapple2 import ( "errors" - "fmt" "github.com/ivanizag/izapple2/storage" ) @@ -73,49 +72,3 @@ func (cg *CharacterGenerator) getPixel(char uint8, row int, column int) bool { value := bits >> uint(bit) & 1 return value == 1 } - -func (cg *CharacterGenerator) dumpCharRaw(char int) { - base := int(char) * 8 - fmt.Printf("Char: %v\n---------\n", char) - for i := 0; i < 8; i++ { - fmt.Print("|") - b := cg.data[base+i] - for j := 0; j < 8; j++ { - if (b>>uint(j))&1 == 1 { - fmt.Print("#") - } else { - fmt.Print(" ") - } - } - fmt.Println("|") - } - fmt.Println("---------") -} - -func (cg *CharacterGenerator) dumpChar(char uint8) { - fmt.Printf("Char: %v\n---------\n", char) - for row := 0; row < 8; row++ { - fmt.Print("|") - for col := 0; col < 7; col++ { - if cg.getPixel(char, row, col) { - fmt.Print("#") - } else { - fmt.Print(" ") - } - } - fmt.Println("|") - } - fmt.Println("---------") -} - -// Dump to sdtout all the character maps -func (cg *CharacterGenerator) Dump() { - pages := len(cg.data) / charGenPageSize - for p := 0; p < pages; p++ { - cg.setPage(p) - for i := 0; i < 256; i++ { - cg.dumpChar(uint8(i)) - //cg.dumpCharRaw(int(i)) - } - } -} diff --git a/frontend/a2sdl/main.go b/frontend/a2sdl/main.go index 977d57a..f51d88a 100644 --- a/frontend/a2sdl/main.go +++ b/frontend/a2sdl/main.go @@ -90,7 +90,10 @@ func sdlRun(a *izapple2.Apple2) { if !a.IsPaused() { var img *image.RGBA - if kp.showPages { + if kp.showCharGen { + img = screen.SnapshotCharacterGenerator(a) + window.SetTitle(fmt.Sprintf("%v character map", a.Name)) + } else if kp.showPages { img = screen.SnapshotParts(a, screen.ScreenModeNTSC) window.SetTitle(fmt.Sprintf("%v %v %vx%v", a.Name, screen.VideoModeName(a), img.Rect.Dx()/2, img.Rect.Dy()/2)) } else { diff --git a/frontend/a2sdl/sdlKeyboard.go b/frontend/a2sdl/sdlKeyboard.go index 4b9160a..7aca842 100644 --- a/frontend/a2sdl/sdlKeyboard.go +++ b/frontend/a2sdl/sdlKeyboard.go @@ -12,7 +12,8 @@ type sdlKeyboard struct { a *izapple2.Apple2 keyChannel *izapple2.KeyboardChannel - showPages bool + showPages bool + showCharGen bool } func newSDLKeyBoard(a *izapple2.Apple2) *sdlKeyboard { @@ -100,7 +101,11 @@ func (k *sdlKeyboard) putKey(keyEvent *sdl.KeyboardEvent) { case sdl.K_F9: k.a.SendCommand(izapple2.CommandDumpDebugInfo) case sdl.K_F10: - k.a.SendCommand(izapple2.CommandNextCharGenPage) + if ctrl { + k.showCharGen = !k.showCharGen + } else { + k.a.SendCommand(izapple2.CommandNextCharGenPage) + } case sdl.K_F11: k.a.SendCommand(izapple2.CommandToggleCPUTrace) case sdl.K_F12: diff --git a/screen/snapshotsDebug.go b/screen/snapshotsDebug.go index ce6811b..d095770 100644 --- a/screen/snapshotsDebug.go +++ b/screen/snapshotsDebug.go @@ -2,6 +2,7 @@ package screen import ( "image" + "image/color" ) // SnapshotParts the currently visible screen @@ -127,3 +128,21 @@ func doubleWidthFilter(in *image.RGBA) *image.RGBA { } return out } + +// SnapshotCharacterGenerator shows the current character set +func SnapshotCharacterGenerator(vs VideoSource) *image.RGBA { + text := make([]uint8, textLines*text40Columns) + for l := 0; l < textLines; l++ { + for c := 0; c < text40Columns; c++ { + text[text40Columns*l+c] = 0x20 + 0x80 // Space + } + } + + for l := 0; l < 8; l++ { + for c := 0; c < 32; c++ { + text[text40Columns*(2*l+4)+c+4] = uint8(l*32 + c) + } + } + + return renderText(vs, text, nil, color.White) +}