Skip to content

Commit

Permalink
Add non-CONF_ASCII putc support to XS:Lisp
Browse files Browse the repository at this point in the history
  • Loading branch information
mesheets committed Jul 22, 2024
1 parent 3d47895 commit 2950938
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 6 deletions.
2 changes: 1 addition & 1 deletion demo/xs-lisp/Makefile.sub
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ DEMO_XS_STACKSIZE?=$(XS_STACKSIZE)
#OPTIONS=-DLISTLIB
#OPTIONS=

DEMO_XS_SOURCES1=fact.lsp lib.lsp range.lsp remote.lsp rover.lsp rover-watcher.lsp trace.lsp
DEMO_XS_SOURCES1=fact.lsp hello-lisp.lsp lib.lsp range.lsp remote.lsp rover.lsp rover-watcher.lsp trace.lsp
# sample.lsp is too large to build under a typical kernel configuration
DEMO_XS_SOURCES=$(DEMO_XS_SOURCES1:%=demo/xs-lisp/%)
DEMO_XS_PROGRAMS=$(patsubst %.lsp, %.lx, $(DEMO_XS_SOURCES))
Expand Down
28 changes: 28 additions & 0 deletions demo/xs-lisp/hello-lisp.lsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
;; The contents of this file are subject to the Mozilla Public License
;; Version 1.0 (the "License"); you may not use this file except in
;; compliance with the License. You may obtain a copy of the License at
;; http://www.mozilla.org/MPL/
;;
;; Software distributed under the License is distributed on an "AS IS"
;; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
;; License for the specific language governing rights and limitations
;; under the License.
;;
;; Contributor(s): Matthew Sheets

;; hello world

(putc :char_H 4)
(putc :char_E 3)
(putc :char_Parallel 2)
(putc :char_O 1)
(sleep 1)

(putc :char_L 4)
(putc :char_E 3)
(putc :char_G 2)
(putc :char_O 1)
(sleep 1)

(cls)
(sleep 1)
9 changes: 4 additions & 5 deletions xs/lisp/eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -1373,14 +1373,13 @@ object eval(object e) {
}
case Lputc:
if (check_int_args(base)) goto LERROR;
// the second arg is between 0 (right-most) and 4 (left-most)
// the second arg is between 0 (right-most) and 4 (left-most), or 5 for the '-' spot
#if ((defined(RCX) && defined(CONF_ASCII)) || (!defined(RCX)))
// TODO: If not on the RCX and CONF_ASCII is not defined,
// this value (which is the character mask), will not display the intended character
cputc(INTval(e = base[0]), INTval(base[1]));
#elif (defined(RCX) && defined(CONF_CONIO))
// ASCII is not enabled on the RCX, so we cannot display the ASCII character
// Display a generic '-' in the requested position instead
e = base[0];
cputc_native(CHAR_DASH, INTval(base[1]));
cputc_native(INTval(e = base[0]), INTval(base[1]));
#endif
#ifndef RCX
show_lcd();
Expand Down

0 comments on commit 2950938

Please sign in to comment.