Acornsoft FORTH
Working with FORTH
Filesystem
TAPE- Select cassette for storage.DISK- Select floppy for storage.CREATE-SCREENS- Rewrite floppy to crate screen files for storage. (Nddds to be DFS formatted first)3 LOAD- Load screen 3 (on tape it is the editor) and execute.30 LIST- Load screen 30 (if not loaded) and print its contents.SCR @ .- Prints recently listed screen number.SAVE- Save current screen (lists and asks before saving).SAVE-BUFFERS- Save all screens in memory to disk.FLUSH- Zero all screens memory.PROGRAM- Initializes empty screen (asks for number). Enters editor mode.EDITOR- Enters editor vocabulary.FORTH- Enters core vocabulary.-->- Load next screen.
Editor
Screen commands:
P- Put text onto line.D- Delete the line, moving up the lower lines to close the gap, but hold the deleted line at PAD.E- Erase the line, leaving it blank. The contents of the line are not saved.H- Hold the contents of the line at PAD. The line also remains in the screen.I- Insert the text from PAD at the specified line. The lower lines are moved down to make room for the insertion and line 15 is lost.R- Replace the contents of the line with the text from PAD.S- Spread the text by inserting a blank line. Line 15 is lost.T- Type the contents of the line and also copy it to PAD. The text remains in the screen.
Line editing (each command also lieves given text in PAD):
C- Insert the given text at the current cursor position.F- Find the given text and position the cursor immediately after its first occurrence.TILL- Delete all text, from the current cursor position to the end of the text given. This command will only act on text within a single line of the screen.X- Find and delete the first occurrence of the given text.N- Find the next occurrence of the text at PADB- Move the cursor back by the number of characters in the text at PAD.DELETE- (count --) Delete count characters, backwards from the current cursor position.M- (count --) Move the cursor by count characters, either forwards or backwards depending on the sign of count. The text itself is unchanged M is a simple way of displaying the current cursor position!
Errors
- (reserved)
- Stack Empty
- Dictionary Full
- Has Incorrect Address Mode (Assembler)
- Isn't unique
- Parameter Outside Valid Range
- Screen Number Out of Range
- Stack Full
- Can't Open or Extend File
- Read/Write not Completed
- Can't Redefine End-of-Line
- Can 't Divide by Zero
- Undefined Execution Vector
- Branch Too Long
- Incorrect CURRENT Vocabulary
- (reserved)
- (reserved)
- Compilation Only
- Execution Only
- Conditionals not Paired
- Definition not Finished
- In Protected Dictionary
- Use Only When LOADing
- Off Current Editing Screen
- Not in CURRENT Vocabulary
- System Memory Clash
Forth basics
Printing text
| Word | Stack effect | Description |
|---|---|---|
. |
( n -- ) |
Dispaly signed number followed by one space |
U. |
( u -- ) |
Same as above but unsigned number |
D. |
( d -- ) |
Same as above but double signed number |
.R |
( n n2 -- ) |
Display signed number n in right side of filed of width n2 |
D.R |
( d n2 -- ) |
Same as above but double signed number |
H. |
( u -- ) |
Display unsigned number in hexadecimal form |
DEC. |
( n -- ) |
Display signed number in decimal form |
." <text>" |
( -- ) |
Display text literal |
Acorn Electron
Video
Acornsoft Forth uses memory used by hi-res modes; only mode 4 and 5 are available.
Modes:
- 320x256 @ 4 color -
0x3000-0x7FFF(bits: 0/4, 1/5, 2/6, 3/7) - 160x265 @ 16 color -
0x5000-0x7FFF(bits: 0/2/4/6, 1/3/5/7) - No GFX, only text 80x25
- 320x246 @ 2 color -
0x5800-0x7FFF(bits: one bit per pixel) - default - 160x256 @ 4 color -
0x5800-0x7FFF(bits: 0/4, 1/5, 2/6, 3/7) - available - No GFX, only text 40x25
HEX
5 MODE
: CLS 7FFF 5800 DO FF I C! LOOP ;
In mode 4 this leave out space between lines of text, but if I switch to mode 5 and back to 4 it works fine. Also this is slow...
This is addressed in columns bytes 0-7, and then next column. So it is like character mode?
VDU can be used to clear the screen faster:
HEX
10 >VDU
MAME Emulation
Keyboard
| Acorn Key | MAME/PC Key | My key |
|---|---|---|
\ |
Ctrl+\ |
Ctrl+# |
( |
Shift+8 |
|
) |
Shift+9 |
|
# |
Shift+3 |
|
* |
Shift+' |
|
: |
' |
|
+ |
Shift+; |
|
@ |
Shift+0 |
|
= |
Shift+- |
|
& |
Shift+6 |
|
| backtick | Shift+7 |
|
^ |
Shift+= |