|
|
@ -337,7 +337,7 @@ Many instructions have two forms: |
|
|
|
- 3 args ... explicit source and destination |
|
|
|
- 3 args ... explicit source and destination |
|
|
|
- 2 args ... destination is also used as the first argument |
|
|
|
- 2 args ... destination is also used as the first argument |
|
|
|
|
|
|
|
|
|
|
|
``` |
|
|
|
```lisp |
|
|
|
; Test properties of a value - zero, positive, negative |
|
|
|
; Test properties of a value - zero, positive, negative |
|
|
|
(tst SRC) |
|
|
|
(tst SRC) |
|
|
|
|
|
|
|
|
|
|
@ -421,7 +421,7 @@ This module defines dynamic size integer buffers. |
|
|
|
|
|
|
|
|
|
|
|
A buffer needs to be created using one of the init instructions: |
|
|
|
A buffer needs to be created using one of the init instructions: |
|
|
|
|
|
|
|
|
|
|
|
``` |
|
|
|
```lisp |
|
|
|
; Create an empty buffer and store its handle into a register |
|
|
|
; Create an empty buffer and store its handle into a register |
|
|
|
(mkbf Wr) |
|
|
|
(mkbf Wr) |
|
|
|
|
|
|
|
|
|
|
@ -438,7 +438,7 @@ A buffer needs to be created using one of the init instructions: |
|
|
|
|
|
|
|
|
|
|
|
Primitive buffer ops (position is always 0-based) |
|
|
|
Primitive buffer ops (position is always 0-based) |
|
|
|
|
|
|
|
|
|
|
|
``` |
|
|
|
```lisp |
|
|
|
; Get buffer size |
|
|
|
; Get buffer size |
|
|
|
(bfsz Wr @Obj) |
|
|
|
(bfsz Wr @Obj) |
|
|
|
|
|
|
|
|
|
|
@ -457,7 +457,7 @@ Primitive buffer ops (position is always 0-based) |
|
|
|
|
|
|
|
|
|
|
|
Whole buffer manipulation: |
|
|
|
Whole buffer manipulation: |
|
|
|
|
|
|
|
|
|
|
|
``` |
|
|
|
```lisp |
|
|
|
; Resize the buffer. Removes trailing elements or inserts zero to match the new size. |
|
|
|
; Resize the buffer. Removes trailing elements or inserts zero to match the new size. |
|
|
|
(bfrsz @Obj Rd:len) |
|
|
|
(bfrsz @Obj Rd:len) |
|
|
|
|
|
|
|
|
|
|
@ -473,7 +473,7 @@ Whole buffer manipulation: |
|
|
|
|
|
|
|
|
|
|
|
Stack-style buffer ops: |
|
|
|
Stack-style buffer ops: |
|
|
|
|
|
|
|
|
|
|
|
``` |
|
|
|
```lisp |
|
|
|
; Push (insert at the end) |
|
|
|
; Push (insert at the end) |
|
|
|
(bfpush @Obj Rd) |
|
|
|
(bfpush @Obj Rd) |
|
|
|
|
|
|
|
|
|
|
@ -504,7 +504,7 @@ NOTE: Logging can significantly reduce crsn run speed. |
|
|
|
Make sure the log level is at not set to "trace" when you need high-speed updates, |
|
|
|
Make sure the log level is at not set to "trace" when you need high-speed updates, |
|
|
|
such as animations. |
|
|
|
such as animations. |
|
|
|
|
|
|
|
|
|
|
|
``` |
|
|
|
```lisp |
|
|
|
; Initialize the screen (opens a window) |
|
|
|
; Initialize the screen (opens a window) |
|
|
|
(sc-init WIDTH HEIGHT) |
|
|
|
(sc-init WIDTH HEIGHT) |
|
|
|
|
|
|
|
|
|
|
@ -552,7 +552,7 @@ such as animations. |
|
|
|
|
|
|
|
|
|
|
|
You can use these special handles in almost all instructions: |
|
|
|
You can use these special handles in almost all instructions: |
|
|
|
|
|
|
|
|
|
|
|
``` |
|
|
|
```lisp |
|
|
|
(cmp @stdin 'y' |
|
|
|
(cmp @stdin 'y' |
|
|
|
(eq? (ld @stdout '1')) |
|
|
|
(eq? (ld @stdout '1')) |
|
|
|
(ne? (ld @stdout '0'))) |
|
|
|
(ne? (ld @stdout '0'))) |
|
|
|