Compare commits
No commits in common. "57a47e6ba36d50e6bb0342829d9e42f57ee97298" and "fd70c8d5dc55ba89928bf6593c289a302c7ba278" have entirely different histories.
57a47e6ba3
...
fd70c8d5dc
1 changed files with 0 additions and 31 deletions
|
@ -109,8 +109,6 @@
|
||||||
return-tokens-p return-syntax-tree-p
|
return-tokens-p return-syntax-tree-p
|
||||||
return-iblock-p return-allocs-p
|
return-iblock-p return-allocs-p
|
||||||
return-asm-p)
|
return-asm-p)
|
||||||
(when (zerop (hash-table-count *asm-functions*))
|
|
||||||
(usc-init))
|
|
||||||
(let (tokens syntax-tree iblock allocs asm-obj bytes)
|
(let (tokens syntax-tree iblock allocs asm-obj bytes)
|
||||||
(format *debug-io* "Tokenizing...~%")
|
(format *debug-io* "Tokenizing...~%")
|
||||||
(setf tokens (ci-tokenize string))
|
(setf tokens (ci-tokenize string))
|
||||||
|
@ -220,32 +218,3 @@
|
||||||
:do (write-byte byte stream)))
|
:do (write-byte byte stream)))
|
||||||
(format t "Finished, wrote compiled program to \"~A\".~%"
|
(format t "Finished, wrote compiled program to \"~A\".~%"
|
||||||
output-filepath))))
|
output-filepath))))
|
||||||
|
|
||||||
(defun send-data-to-c64 (data)
|
|
||||||
(with-open-file (stream "/dev/ttyACM0"
|
|
||||||
:direction :io
|
|
||||||
:element-type '(unsigned-byte 8)
|
|
||||||
:if-exists :overwrite)
|
|
||||||
(sleep 2.5)
|
|
||||||
(let ((index 0)
|
|
||||||
(length (length data)))
|
|
||||||
(write-byte (ldb (byte 8 0) length) stream)
|
|
||||||
(write-byte (ldb (byte 8 8) length) stream)
|
|
||||||
(force-output stream)
|
|
||||||
(loop :while (< index length)
|
|
||||||
:for amount := (min 16 (- (length data) index))
|
|
||||||
:do (format t "~D " amount)
|
|
||||||
(read-byte stream)
|
|
||||||
(write-byte amount stream)
|
|
||||||
(format t "~D " index)
|
|
||||||
(loop :for byte
|
|
||||||
:across (subseq data index (incf index amount))
|
|
||||||
:do (write-byte byte stream))
|
|
||||||
(force-output stream)
|
|
||||||
(format t "~D~%" index)))))
|
|
||||||
|
|
||||||
(defun compile-and-send-to-c64 (string)
|
|
||||||
(let ((bytes (compile-string-to-bytes string :print-ir-p t)))
|
|
||||||
(handler-case
|
|
||||||
(send-data-to-c64 (coerce bytes 'vector))
|
|
||||||
(error (c) (abort c)))))
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue