mirror of
https://github.com/freewilll/apple2-go.git
synced 2025-01-21 02:30:48 +00:00
Renamed vid and moved some more vid stuff to it
This commit is contained in:
parent
4bc2403e25
commit
ef0000b67b
@ -2,15 +2,13 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
"log"
|
|
||||||
|
|
||||||
"github.com/hajimehoshi/ebiten"
|
"github.com/hajimehoshi/ebiten"
|
||||||
"github.com/hajimehoshi/ebiten/ebitenutil"
|
|
||||||
|
|
||||||
"mos6502go/cpu"
|
"mos6502go/cpu"
|
||||||
"mos6502go/keyboard"
|
"mos6502go/keyboard"
|
||||||
"mos6502go/mmu"
|
"mos6502go/mmu"
|
||||||
"mos6502go/vid"
|
"mos6502go/video"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -19,12 +17,6 @@ const (
|
|||||||
flashFrames = 8 // Number of frames when FLASH mode is toggled
|
flashFrames = 8 // Number of frames when FLASH mode is toggled
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
|
||||||
charMap *ebiten.Image
|
|
||||||
flashCounter int
|
|
||||||
flashOn bool
|
|
||||||
)
|
|
||||||
|
|
||||||
var cpuState cpu.State
|
var cpuState cpu.State
|
||||||
var showInstructions *bool
|
var showInstructions *bool
|
||||||
var disableBell *bool
|
var disableBell *bool
|
||||||
@ -54,7 +46,7 @@ func update(screen *ebiten.Image) error {
|
|||||||
checkResetKeys()
|
checkResetKeys()
|
||||||
|
|
||||||
cpu.Run(&cpuState, *showInstructions, nil, *disableBell, 1024000/60)
|
cpu.Run(&cpuState, *showInstructions, nil, *disableBell, 1024000/60)
|
||||||
return vid.DrawTextScreen(cpuState.PageTable, screen, charMap)
|
return video.DrawTextScreen(cpuState.PageTable, screen)
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -71,14 +63,9 @@ func main() {
|
|||||||
cpuState.Init()
|
cpuState.Init()
|
||||||
|
|
||||||
keyboard.Init()
|
keyboard.Init()
|
||||||
|
video.Init()
|
||||||
|
|
||||||
reset()
|
reset()
|
||||||
|
|
||||||
var err error
|
|
||||||
charMap, _, err = ebitenutil.NewImageFromFile("./pr-latin1.png", ebiten.FilterNearest)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
ebiten.Run(update, 280*screenSizeFactor, 192*screenSizeFactor, 2, "Apple //e")
|
ebiten.Run(update, 280*screenSizeFactor, 192*screenSizeFactor, 2, "Apple //e")
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
@ -1,4 +1,4 @@
|
|||||||
package vid
|
package video
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"image"
|
"image"
|
||||||
@ -6,6 +6,7 @@ import (
|
|||||||
"mos6502go/mmu"
|
"mos6502go/mmu"
|
||||||
|
|
||||||
"github.com/hajimehoshi/ebiten"
|
"github.com/hajimehoshi/ebiten"
|
||||||
|
"github.com/hajimehoshi/ebiten/ebitenutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -15,11 +16,21 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
charMap *ebiten.Image
|
||||||
flashCounter int
|
flashCounter int
|
||||||
flashOn bool
|
flashOn bool
|
||||||
)
|
)
|
||||||
|
|
||||||
func DrawTextScreen(pageTable *mmu.PageTable, screen *ebiten.Image, charMap *ebiten.Image) error {
|
func Init() {
|
||||||
|
var err error
|
||||||
|
charMap, _, err = ebitenutil.NewImageFromFile("video/pr-latin1.png", ebiten.FilterNearest)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func DrawTextScreen(pageTable *mmu.PageTable, screen *ebiten.Image) error {
|
||||||
flashCounter--
|
flashCounter--
|
||||||
if flashCounter < 0 {
|
if flashCounter < 0 {
|
||||||
flashCounter = flashFrames
|
flashCounter = flashFrames
|
Loading…
x
Reference in New Issue
Block a user