File: stack.tcl

package info (click to toggle)
openmsx 0.5.1-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 6,976 kB
  • ctags: 10,295
  • sloc: cpp: 63,525; xml: 37,105; sh: 1,403; python: 681; tcl: 207; makefile: 64
file content (14 lines) | stat: -rw-r--r-- 450 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# dump <count> number of entries of the stack at SP
#
# Usage:
#    stack [<count>]
#
proc stack { { depth 8 } } {
	set stackpointer [expr [debug read "CPU regs" 22] * 256 + [debug read "CPU regs" 23]]
	for {set i 0} {$i < $depth} {incr i} {
		set val [expr [debug read memory $stackpointer] + 256 * [debug read memory [expr $stackpointer + 1 ]] ]
		puts "[format %04x $stackpointer]: [format %04x $val]"
		incr stackpointer
		incr stackpointer
	}
}