mirror of
https://github.com/ivanizag/izapple2.git
synced 2024-06-03 20:29:30 +00:00
Ctrl-F10 to show the current character map
This commit is contained in:
parent
69ec17e541
commit
e49bef397b
|
@ -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 "<internal>/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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -13,6 +13,7 @@ type sdlKeyboard struct {
|
|||
keyChannel *izapple2.KeyboardChannel
|
||||
|
||||
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:
|
||||
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:
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user