1
0
mirror of https://github.com/ariejan/i6502.git synced 2024-06-28 01:29:30 +00:00
i6502/cpu_stack.go

20 lines
313 B
Go
Raw Normal View History

2014-08-16 08:35:00 +00:00
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))
}