Skip to content

Commit

Permalink
stack pushing testing
Browse files Browse the repository at this point in the history
  • Loading branch information
xubiod committed Mar 13, 2024
1 parent cddfa2e commit bc59392
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions cpu/core_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package cpu

import (
"strings"
"testing"
"xubiod/6502-experiment/assembler"
)

func TestExists(t *testing.T) {
Expand Down Expand Up @@ -329,17 +331,26 @@ func TestDecimalSBC(t *testing.T) {
}

func TestGeneralStackOps(t *testing.T) {
// var prg []byte
var prg []byte
loopCount := 32

// c := NewCore()
// asm := assembler.New()
c := NewCore()
asm := assembler.New()

prg, _ = asm.Parse("LDX #$00\n" + strings.Repeat("TXA\nPHA\nINX\n", loopCount))

stdProcedure(c, prg)

// prg, _ = asm.Parse("LDX #$01\n" + strings.Repeat("TXA\nPHA\nINX\n", 32))
var atStack byte

// stdProcedure(c, prg)
for number := range loopCount {
atStack = c.Memory[0x01FF-uint16(number)]
if atStack != byte(number) {
t.Errorf("general stack fail - expected %02x\tgot %02x", number, atStack)
}
}

// // incomplete test
// t.Fail()
t.Log("\n" + c.CompleteDump())
}

// Writes reset procedure followed by the given program. Goes into a standard execution
Expand Down

0 comments on commit bc59392

Please sign in to comment.