1 # The stack shouldn't grow into the code area.
13 3d/compare-eax-and 0x01000000/imm32
15 7f/jump-if-> break/disp8
16 (abort "stack overflow")
36 # save old cursor position
37 (cursor-position 0) # => eax, ecx
39 (set-cursor-position 0 0x70 0)
40 (draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0 %edx 0xf 0xc)
41 # restore cursor position
42 (set-cursor-position %eax %ecx)
43 $show-stack-state:end:
53 # Helper for debugging deeply recursive calls without logs or traces.
54 # Turn it on, insert calls in the right places, and you get a terse sense of
55 # important parts of the call stack. A poor sophont's stack trace.
56 debug-print: # x: (addr array byte), fg: int, bg: int # x is very short; usually a single character
65 81 7/subop/compare *Really-debug-print 0/imm32/false
66 74/jump-if-= break/disp8
67 (draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 *(ebp+8) *(ebp+0xc) *(ebp+0x10))
68 # clear the screen and continue if we got too close to the bottom
69 (cursor-position 0) # => eax, ecx
70 81 7/subop/compare %ecx 0x28/imm32
71 75/jump-if-!= break/disp8
73 (set-cursor-position 0 0 0)
84 debug-print?: # -> _/eax: boolean
89 8b/-> *Really-debug-print 0/r32/eax
101 c7 0/subop/copy *Really-debug-print 1/imm32/true
102 $turn-on-debug-print:end:
108 turn-off-debug-print:
113 c7 0/subop/copy *Really-debug-print 0/imm32/false
114 $turn-off-debug-print:end: