get DateTime working with chibi-scheme

This commit is contained in:
Erik Osheim 2025-01-22 13:10:01 -05:00
parent c3886f44f2
commit 667fb36489
1 changed files with 17 additions and 6 deletions

23
vm.scm
View File

@ -29,12 +29,19 @@
;; (vector-set! v 8 (not (= tz 0))) ;; (vector-set! v 8 (not (= tz 0)))
;; v)) ;; v))
;; ;; chibi scheme, invoke with ??? ;; ;; chibi scheme, invoke with chibi-scheme vm.scm ROM ...
;; (import (scheme base) (scheme bitwise) (scheme file)) ;; (import (scheme base) (scheme bitwise) (scheme file) (scheme process-context))
;; (import (chibi io) (chibi process)) ;; (import (chibi io) (chibi process) (chibi time))
;; (define (get-u8 port) (read-u8 port)) ;; (define (get-u8 port) (read-u8 port))
;; (define (open-rom path) (open-input-file path)) ;; (define (open-rom path) (open-input-file path))
;; (define (display s) (write-string s)) ;; (define display write-string)
;; (define (command-line-arguments) (cdr (command-line)))
;; (define (get-date-time)
;; (let ((t (seconds->time (current-seconds))))
;; (vector
;; (time-second t) (time-minute t) (time-hour t)
;; (time-day t) (+ (time-month t) 1) (+ (time-year t) 1900)
;; (time-day-of-week t) (time-day-of-year t) (not (= (time-dst? t) 0)))))
;; ;; chez scheme, invoke with chezscheme --script vm.scm ROM ... ;; ;; chez scheme, invoke with chezscheme --script vm.scm ROM ...
;; (define (open-rom path) (open-file-input-port path)) ;; (define (open-rom path) (open-file-input-port path))
@ -246,8 +253,12 @@
(u:debug-stack "WST" wst) (u:debug-stack "RST" rst)) (u:debug-stack "WST" wst) (u:debug-stack "RST" rst))
(define (u:debug-stack label st) (define (u:debug-stack label st)
(display label) (let* ((cells (cdr st))
(u:debug-cells (cdr st) (u8 (- (car st) 8)) (car st) (current-output-port))) (limit (car st))
(i (u8 (- limit 8)))
(port (current-output-port)))
(display label port)
(u:debug-cells cells i limit port)))
(define (u:debug-cells cells i limit port) (define (u:debug-cells cells i limit port)
(display (if (= i 0) "|" " ") port) (display (if (= i 0) "|" " ") port)