use uxncli debug format
This commit is contained in:
parent
7bd8afc386
commit
5f30e61907
20
vm.scm
20
vm.scm
|
@ -196,11 +196,29 @@
|
|||
(define (_deo byte port)
|
||||
(vector-set! dev port (u8 byte))
|
||||
(cond
|
||||
((= 14 port) (display wst) (display "\n") (display rst) (display "\n"))
|
||||
((= 14 port) (debug))
|
||||
((= 24 port) (write-char (integer->char byte) (current-output-port)))
|
||||
((= 25 port) (write-char (integer->char byte) (current-error-port)))
|
||||
(* '())))
|
||||
|
||||
(define (debug)
|
||||
(debug-stack "WST" wst) (debug-stack "RST" rst))
|
||||
|
||||
(define (debug-stack label st)
|
||||
(display label)
|
||||
(debug-cells (cdr st) (u8 (- (car st) 8)) (car st) (current-output-port)))
|
||||
|
||||
(define (debug-cells cells i limit port)
|
||||
(display (if (= i 0) "|" " ") port)
|
||||
(if (= i limit) (display "<\n")
|
||||
(begin
|
||||
(emit-u8 (vector-ref cells i) port)
|
||||
(debug-cells cells (u8 (+ i 1)) limit port))))
|
||||
|
||||
(define (emit-u8 n port)
|
||||
(display (number->string (quotient n 16) 16) port)
|
||||
(display (number->string (modulo n 16) 16) port))
|
||||
|
||||
; SFT base instruction implementation
|
||||
(define (sft-impl k)
|
||||
(let* ((n (_pop1))
|
||||
|
|
Loading…
Reference in New Issue