update docs about stdin renaming to cin

pull/21/head
Ondřej Hruška 4 years ago
parent ace92a6411
commit 4d921cbec0
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 13
      README.md

@ -555,17 +555,18 @@ such as animations.
## Stdio module
- This module currently defines two global handles (resp. constants): `@stdin` and `@stdout`.
- This module defines 4 global handles: `@cin`, `@cout`, `@cin_r`, `@cout_r`.
- You can think of these handles as streams or SFRs (special function registers).
To use them, simply load data to or from the handles (e.g. `(ld r0 @stdin)`).
To use them, simply load data to or from the handles (e.g. `(ld r0 @cin)`).
- They operate over unicode code points, which are a superset of ASCII.
- The "_r" variants work with raw bytes. Do not combine them, or you may get problems with multi-byte characters.
You can use these special handles in almost all instructions:
```lisp
(cmp @stdin 'y'
(eq? (ld @stdout '1'))
(ne? (ld @stdout '0')))
(cmp @cin 'y'
(eq? (ld @cout '1'))
(ne? (ld @cout '0')))
```
When you compile a program using such handles, you will get a strange looking assembly:
@ -577,7 +578,7 @@ When you compile a program using such handles, you will get a strange looking as
```
These are unique constants assigned to the streams at compile time. They are not meant to be used
directly, but the value can be obtained by simply leaving out the '@' sign: `(ld r0 stdin)`.
directly, but the value can be obtained by simply leaving out the '@' sign: `(ld r0 cin)`.
That can be useful when these stream handles need to be passed to a function. Obviously this makes
more sense when there are different kinds of streams available, not just these two default ones.

Loading…
Cancel
Save