1
0
mirror of https://github.com/ariejan/i6502.git synced 2024-06-04 08:29:27 +00:00
i6502/cpu_stack.go
2014-08-16 10:37:56 +02:00

20 lines
313 B
Go

package i6502
const (
StackBase = 0x0100
)
func (c *Cpu) stackPush(data byte) {
c.bus.Write(StackBase+uint16(c.SP), data)
c.SP -= 1
}
func (c *Cpu) stackPeek() byte {
return c.bus.Read(StackBase + uint16(c.SP+1))
}
func (c *Cpu) stackPop() byte {
c.SP += 1
return c.bus.Read(StackBase + uint16(c.SP))
}