Enth - readme - September 22nd, 2002
Enth is Copyright (c) 2002 Sean Pringle. This version of Enth is released to the
Public Domain.
Enth comes with ABSOLUTELY NO WARRANTY. No responsibility for anything will be
assumed by Sean Pringle. By using Enth or it's applications, including Flux,
you agree there is no implied warranty with regard to useability,
reliability or support.
VideoRuns at 1024x768 pixels, 64k or 32k colors, by default. Requires VESA 2.0+ video card with Linear Frame Buffer support. Failure to initialise the video will result in a 'Vid' error appearing during boot and system will hang. To run at 800x600 pixels, alter the VMODE line in EBOOT.ASM and recreate the boot disk image by running CREATE.BAT. InterfaceDefault post boot interface is the Flux Color Editor. There is no longer any distinction between the Forth the Editor and Forth the Terminal, they are one and the same. The color editorThe color editor is started automatically at BLOCK 0, Line 0 at boot. Each block is 1024 bytes wide. The editor operates like a sequential file editor within each block. Keyboard layout is standard QWERTY. Normal text editing functions are used including keys like SHIFT, CAPS, BKSPC, DEL, HOME, END and the ARROWs. Special control keys
PGUP / PGDN scroll through blocks. F1-F10 insert color tokens/spaces. SPACEBAR insert last used color token. CTRL then F1-F10 insert color token that doubles as a line break. ALT alternate between code and shadow blocks F12 insert normal ascii blank space.
Upper right of screen display:
The interactive terminalBLOCK 0 acts as the system terminal input buffer. Use the editor to edit the top line of BLOCK 0 and press the enter key. BLOCK 0 will be interpretted until the word OK is encountered, whereupon editing will be restarted. OKs are inserted automatically. Command line history scrolls down the page. Because you are simply editing a block, holding down the delete key until the required previous command line reaches the top of the page gives you a simple form of command history. Experiment with the colors and function keys. Look at BLOCK 1, it has some useful words defined on it. RecommendationTake it slow. The learning curve may be steep for some. Those who have experience with Chuck Moore's colorForth may recognise some things, but be warned: there will also be things you won't recognise. Flux is not a colorForth clone by any means, though certainly a cousin :) ANS ForthYes, as in the original release, Enth contains an ANS Forth based kernel. That is to say kernel words that also exist in ANS Forth should behave as the standard defines them. The Enth interpretter loop should behave in an ANS Forth fashion. At least such is the idea. Don't be surprised by bugs. Flux is a dual wordlist cmForth/colorForth model Forth implemented on top of Enth (actually beside Enth now as it is in the kernel). Don't go into it with any preconceptions. Yes, the primary Enth interface is now the colored Flux editor. This means writing color code is easy and even simple. The Enth ANS Forth interpretter still operates though and you can access it simply through EVALUATE or ELOAD. The more dedicated programmer may see other ways of reconfiguring the system to become ANS again. Feel free. It is my intention to reimplement the ANS Forth terminal interface as an application and an alternative to the color editor. Maybe in color code. Maybe not. Don't know yet. Where to?I've been using this system in various forms for the past two years. It changes sometimes, depending on its task. This release is a snapshot of its current configuration. I wanted to consolidate it a little before releasing again, but it refuses to co-operate. So WYSIWYG. I guess as very few people seem to be using it anyway, what direction it takes is of little matter. It goes whereever the territory appears interesting :) Your CodeFeel free to contribute. Nobody really has, so far. So consider it a blank slate. I'll look at anything. Source Code
EBOOT.ASM is the boot sector code.
Boot and Video.
EKERNEL.ASM is a second stage boot loader.
GDT. IDT. IRQs.
EMAKEIMAGE.ASM assembles the binary files into one bootable image.
All three are NASM compilable. All are automatically recompiled if CREATE.BAT is run.
SOURCE.BLK System color source code.
COLORHTML.F HTML generator for SOURCE.BLK.
ENTH.F Kernel.
EMAKE.F Run metacompiler to recompile Kernel into ENTH.BIN.
Win32Forth 4.2 compilable.
Memory MapsSystem Memory Structure
0h -> 0FFFFh GDT. IDT. IRQ variables. VESA video descriptor. 10000h -> 1FFFFh Kernel. 20000h -> 3FFFFh 128 System Color Forth Source Blocks, half code, half shadow. 40000h -> 8FFFFh Vacant. 90000h -> 9FFFFh DMA Transfer Buffer. 00000h -> Allocatable Memory Space.
Boot Disk Structure
0h -> 0FFFFh Boot code, descriptor tables and Kernel. 10000h -> 2FFFFh 128 System Color Forth Source Blocks, half code, half shadow. 30000h -> Vacant.
Memory Managment
ALLOCATE and FREE as in ANS Forth.
BLOCKS ( u - a )
ALLOCATE U contiguous blocks of memory and return their address.
BLOCK ( u - a )
Return start address of block U.
SUPERBLOCK ( - a )
A User Variable. A task's BLOCK references are based relative to the
value stored in this variable.
Multitasking
TASK ( - )
Usage: CREATE CHARLIE TASK
Else: HERE TASK CONSTANT CHARLIE
Or in color: <red>CHARLIE<white>TASK (reference as address: <yellow>CHARLIE)
WAKE ( up - )
Wake task UP. eg CHARLIE WAKE
SLEEP ( up - )
Sleep task UP. eg CHARLIE SLEEP
START ( up - )
WAKE task UP and begin it executing current definition following START.
STOP ( - )
Volantarily go to SLEEP.
ASSIGN ( xt up - )
Initialise task UP to start executing word XT when next aWAKEned.
PAUSE ( - )
Perform a task switch.
MS ( n - )
Continue to PAUSE for n milliseconds.
CHILD ( xt - )
Create background child task. ASSIGN xt to it. WAKE it. A CHILD cannot
compile.
SLAVE ( u - up )
Create a SLAVE task with dictionary of U Blocks. A SLAVE can compile yet
remains under control of the creating task.
MASTER ( u - up )
Create autonomous MASTER task with dictionary of U Blocks. A master can
compile and remain active after its creating task dies.
CEDE ( n up - )
Hand N stack items to MASTER or SLAVE task UP. Start task UP compiling
the current source block following CEDE.
HALT ( up - )
HALT task UP. If task UP has children HALT them too. If task UP has
ALLOCTEd memory, free it. HALTing a MASTER task will kill and erase it
completely, along with any children it may have. It can never be reused.
HALTing a SLAVE or CHILD task with merely reset them. They may be
reused until their creator MASTER task is HALTed.
MARKERs and BRANCHsMARKER operates similar to the ANS Forth fashion. Execution of a MARKER will roll back the system to the point just before the MARKER's definition. A MARKER may only be executed by the task that created it. Roll back affects the dictionary pointers and wordlists of that task. It also frees any memory ALLOCATEd to that task since MARKER's creation and HALTs any children tasks created since MARKER's creation. BRANCH creates a branchpoint, in the dictionary, from a previous MARKER, hiding words defined since the previous MARKER was created. Execution of a BRANCH rolls back anything defined since the BRANCH was created and reinstates the dictionary wordlists as they were previous to BRANCH being created. A BRANCH affects the dictionary, alllocated memory and children tasks just as MARKER affects them. Video Output
SCREEN ( - )
Compile video output words. Block 7.
WORDS ( wid - )In Enth, WORDS behaves in a non ANS Forth fashion. It displays what ever is in the wordlist who's identifier is on the stack. eg...
ROOT WORDS FLUX WORDS MACRO WORDS
Additionally, WORDS is a small application. The Forth terminal will disapear, the wordlist will be displayed and the system will wait for the Enter/Return key to be pushed before exiting. Floppy ImagingThese two words use a master background task which handles reading and writing the floppy, allowing you to continue with other things. They use the first floppy drive usually known as A: in MS-DOS/Windows and fd0 in Linux.
FLOPPY@ ( a - )
Image the inserted Floppy into memory at address (a).
FLOPPY! ( a - )
Write the floppy image at address (a) to the Floppy.
In Enth 0.4, the floppy imaging is set to read and write the first 25 cylinders each time, as this encompasses the amount of space taken up by the image in the boot disk. I often change this to read or write the amount of data I am working with at any time. You can too. It must be a mulitple of cylinders though. The best method is to create a buffer in allocated memory that is 1.44mb wide...
1440 BLOCKS
... and keep the address somewhere. Alter the floppy code (block 18 in Enth 0.4) to read anything up to 80 cylinders. The line should read something like...
0 25 go
After imaging, use the DUMP program to view the contents of your buffer. You should see the boot sector of your floppy! Use the infinite 1.44mb storage as you see fit :-) |