Improved console output redrawing the screen in place

This commit is contained in:
Ivan Izaguirre 2019-02-16 20:32:50 +01:00
parent 33ccf5e4c3
commit 819c9f7eb9
3 changed files with 7 additions and 1 deletions

View File

@ -18,6 +18,7 @@ func Run(romFile string, log bool) {
// Start the processor // Start the processor
core6502.Reset(&s) core6502.Reset(&s)
t.prepare()
for true { for true {
core6502.ExecuteInstruction(&s, log) core6502.ExecuteInstruction(&s, log)
t.dumpIfDirty() t.dumpIfDirty()

View File

@ -34,10 +34,16 @@ func textMemoryByteToStringHex(value uint8) string {
return fmt.Sprintf("%02x ", value) return fmt.Sprintf("%02x ", value)
} }
func (tp *textPages) prepare() {
fmt.Printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")
}
func (tp *textPages) dump() { func (tp *textPages) dump() {
// See "Understand the Apple II", page 5-10 // See "Understand the Apple II", page 5-10
// http://www.applelogic.org/files/UNDERSTANDINGTHEAII.pdf // http://www.applelogic.org/files/UNDERSTANDINGTHEAII.pdf
fmt.Print("\033[26A")
fmt.Println("------------------------------------------") fmt.Println("------------------------------------------")
var i, j, h uint8 var i, j, h uint8

View File

@ -550,7 +550,6 @@ func ExecuteInstruction(s *State, log bool) {
// Reset resets the processor state. Moves the program counter to the vector in 0cfffc. // Reset resets the processor state. Moves the program counter to the vector in 0cfffc.
func Reset(s *State) { func Reset(s *State) {
startAddress := s.Mem.getWord(0xfffc) startAddress := s.Mem.getWord(0xfffc)
fmt.Println(startAddress)
s.Reg.setPC(startAddress) s.Reg.setPC(startAddress)
} }