瀏覽代碼

Improve usage docs

pull/110/head
Virgil Dupras 4 年之前
父節點
當前提交
c16c5c98ce
共有 13 個檔案被更改,包括 36 行新增88 行删除
  1. +2
    -2
      blk/000
  2. +2
    -2
      blk/003
  3. +3
    -3
      blk/005
  4. +2
    -4
      blk/006
  5. +1
    -1
      blk/008
  6. +0
    -16
      blk/014
  7. +0
    -16
      blk/015
  8. +0
    -16
      blk/016
  9. +1
    -1
      blk/017
  10. +7
    -7
      blk/120
  11. +6
    -6
      blk/121
  12. +6
    -6
      blk/122
  13. +6
    -8
      blk/123

+ 2
- 2
blk/000 查看文件

@@ -12,5 +12,5 @@ block, it means that the next block continues the same kind of
contents. Block numbers are abbreviated with prefix "B". "BX"
means "block X".

The master index of this filesystem is at B1. The Block editor
at B100 is a convenient way to navigate blocks.
The master index of this filesystem is at B1. You can navi-
gate and edit blocks with the Visual Editor at B120.

+ 2
- 2
blk/003 查看文件

@@ -12,5 +12,5 @@ Contents

5 Number literals 6 Compilation vs meta-comp.
8 Interpreter I/O 11 Signed-ness
14 Addressed devices 17 DOES>
18 Disk blocks (cont.)
17 DOES> 18 Disk blocks
(cont.)

+ 3
- 3
blk/005 查看文件

@@ -1,8 +1,8 @@
Number literals

Traditional Forth often use HEX/DEC switches to go from decimal
to hexadecimal parsing. Collapse OS parses literals in a way
that is closer to C.
Traditional Forth often uses HEX/DEC switches to go from deci-
mal to hexadecimal parsing. Collapse OS parses literals in a
way that is closer to C.

Straight numbers are decimals, numbers starting with "0x"
are hexadecimals (example "0x12ef"), "0b" prefixes indicate


+ 2
- 4
blk/006 查看文件

@@ -1,8 +1,8 @@
Compilation vs meta-compilation

Compilation vs meta-compilation. When you compile a word with
"[COMPILE] foo", its straightforward: It writes down to HERE
wither the address of the word or a number literal.
"[COMPILE] foo", it's straightforward: It writes the address
of word foo to HERE.

When you *meta* compile, it's a bit more mind blowing. It
fetches the address of the word specified by the caller, then
@@ -12,5 +12,3 @@ writes that number as a literal, followed by a reference to
Example: ": foo [COMPILE] bar;" is the equivalent of ": foo bar
;" if bar is not an immediate. However, ": foo COMPILE bar ;"
is the equivalent of ": foo ['] bar , ;". Got it?

Meta-compile only works with real words, not number literals.

+ 1
- 1
blk/008 查看文件

@@ -8,7 +8,7 @@ During normal operations, C< is simply a buffered layer over
KEY, which has the same behavior (but unbuffered). Before
yielding any character, the C< routine fetches a whole line
from KEY, puts it in a buffer, then yields the buffered line,
one character at once.
one character at a time.

Both C< and KEY can be overridden by setting an alternate
routine at the proper RAM offset (see B80). For example, C<


+ 0
- 16
blk/014 查看文件

@@ -1,16 +0,0 @@
Addressed devices

The adev unit provides a simple but powerful abstraction over
C@ and C!: A@ and A!. These work the same way as C@ and C! (but
for performance reasons, aren't used in core words), but are
indirect calls.

Upon initialization, the default to C@ and C!, but can be set
to any word through A@* and A!*.

On top of that, it provides a few core-like words such as
AMOVE.

Let's demonstrate its use through a toy example:

(cont.)

+ 0
- 16
blk/015 查看文件

@@ -1,16 +0,0 @@
(cont.)
> : F! SWAP 1 + SWAP C! ;
> 8 H@ DUMP
:54 0000 0000 0000 0000 ........
> 9 H@ A!
> 8 H@ DUMP
:54 0900 0000 0000 0000 ........
> ' F! A!* !
> 9 H@ 1 + A!
> 8 H@ DUMP
:54 090a 0000 0000 0000 ........
> H@ H@ 2 + 2 AMOVE
> 8 H@ DUMP
:54 090a 0a0b 0000 0000 ........
>
(cont.)

+ 0
- 16
blk/016 查看文件

@@ -1,16 +0,0 @@
(cont.) Of course, you might want to end up using adev in this
kind of ad-hoc way to have some kind of mapping function, but
what you'll mostly want to to is to plug device drivers into
those words.













+ 1
- 1
blk/017 查看文件

@@ -2,7 +2,7 @@ DOES>

Used inside a colon definition that itself uses CREATE, DOES>
transforms that newly created word into a "does cell", that is,
a regular cell ( when called, puts the cell's addr on PS), but
a regular cell (when called, puts the cell's addr on PS), but
right after that, it executes words that appear after the
DOES>.



+ 7
- 7
blk/120 查看文件

@@ -2,15 +2,15 @@ Visual Editor

This editor, unlike the Block Editor (B100), is grid-based
instead of being command-based. It requires the AT-XY, COLS
and LINES words to be implemented.
and LINES words to be implemented. If you don't have those,
use the Block Editor.

It is loaded with "125 LOAD" and invoked with "VE". Note that
this also fully loads the Block Editor (B100).
this also fully loads the Block Editor.

This editor uses 17 lines. The top line is the status line and
the 16 others are contents lines. The content shown is that
of the currently selected block.
This editor uses 19 lines. The top line is the status line and
it's followed by 2 lines showing the contents of IBUF and
FBUF (see B100). There are then 16 contents lines. The contents
shown is that of the currently selected block.

All keystrokes are directly interpreted by VE and have the
effect described below.
(cont.)

+ 6
- 6
blk/121 查看文件

@@ -1,3 +1,6 @@
All keystrokes are directly interpreted by VE and have the
effect described below.

Pressing a 0-9 digit accumulates that digit into what is named
the "modifier". That modifier affects the behavior of many
keystokes described below. The modifier starts at zero, but
@@ -5,12 +8,9 @@ most commands interpret a zero as a 1 so that they can have an
effect.

'g' selects the block specified by the modifier as the current
block. Any change madde to the previously selected block is
block. Any change made to the previously selected block is
saved beforehand.

'[' and ']' advance the selected block by modifier.

';' resets the modifier. 'q' quits.
'[' and ']' advances the selected block by "modifier".

'h' and 'l' move the cursor by "modifier" characters. 'j' and
'k', by lines. (cont.)
';' resets the modifier. 'q' quits. (cont.)

+ 6
- 6
blk/122 查看文件

@@ -1,16 +1,16 @@
'h' and 'l' move the cursor by "modifier" characters. 'j' and
'k', by lines.

'H' goes to the beginning of the line, 'L' to the end.

'w' moves forward by a word. 'b' moves backward by a word.
'W' moves to end-of-word. 'B' moves backward to end-of-word.
'w' moves forward by "modifier" words. 'b' moves backward.
'W' moves to end-of-word. 'B', backwards.

'I', 'F' and 'E' invoke the corresponding command from the
'I', 'F', 'X' and 'E' invoke the corresponding command from the
Block Editor (B100). Refer to documentation there.

'o' inserts a blank line after the cursor. 'O', before.

'D' deletes "modifier" lines at the cursor.




(cont.)

+ 6
- 8
blk/123 查看文件

@@ -1,11 +1,9 @@
'f' puts the contents of your previous cursor movement into the
find buffer. If that movement was a forward movement, it brings
the cursor back where it was. This allows for an efficient
combination of movements and 'E'. For example, if you want to
delete the next word, you type 'w', then 'f', then check your
"F" buffer to be sure, then press 'E'.

'X' deletes "modifier" characters following cursor.
'f' puts the contents of your previous cursor movement into
FBUF. If that movement was a forward movement, it brings the
cursor back where it was. This allows for an efficient combi-
nation of movements and 'E'. For example, if you want to delete
the next word, you type 'w', then 'f', then check your FBUF to
be sure, then press 'E'.

'R' goes into replace mode at current cursor position.
Following keystrokes replace current character and advance


Loading…
取消
儲存