home *** CD-ROM | disk | FTP | other *** search
- \ This file Copyright 1988 by Warren Block.
-
- \ main.f
-
- \ To compile the whole program, just include this file. Depending on
- \ your snapshot, you may also need exec/execsupport.f and devices/serial.f.
-
- DECIMAL
-
- FORTH DEFINITIONS
- ANew ColorTerminal
-
- include serialwords.f
- include video.f
- include about.f
- include keyconvert.f
- include menustuff.f
- include intuievents.f
-
- : ExecWait ( signals --- signals ) \ Wait for a set of signals.
- !D0 EXEC@ 53 ;
-
- : Initialize ( --- ) \ Set up everything.
- GetFonts
- SetVideo
- SetUpMenus
- Greetings
- OpenSerialPort
- TRUE TO Continue? ;
-
- : CloseDown ( --- )
- CloseSerialPort
- CurrentWindow @ ClearMenuStrip
- CurrentWindow @ ?DUP IF CloseWindow THEN
- CurrentScreen @ ?DUP IF CloseScreen THEN
- FreeSpareBitMap
- FreeMenuMemory
- CloseFonts
- ?Turnkey IF Bye THEN ;
-
- : GetSerChar ( --- ) \ Something has arrived at the serial port--get it.
- 0 LOCALS| actual |
- ReadMessage @ WaitIO DROP \ wait for I/O to finish
- ReadBuffer C@ \ get the character
- PrintScrChar \ print it
- SDCMD_QUERY ReadMessage @ +ioCommand W!
- ReadMessage @ BeginIO
- ReadMessage @ WaitIO DROP
- CMD_READ ReadMessage @ +ioCommand W!
- ReadMessage @ +ioActual @ TO actual
- actual IF
- actual ReadMessage @ +ioLength !
- ReadMessage @ BeginIO
- ReadMessage @ WaitIO DROP
- 1 ReadMessage @ +ioLength !
- ReadBuffer actual + ReadBuffer DO
- IC@ PrintScrChar
- LOOP
- THEN
- ReadMessage @ BeginIO ; \ ask for the next
-
- : ColorTerm ( --- ) \ Main activation word.
- 0 0 0 LOCALS| serbit intuibit wakebits |
- Initialize
- BEGIN
- Continue?
- WHILE
- ToggleCursor
- 1 ReadMessage @ +ioMessage +mnReplyPort @ +mpSigBit C@ SCALE TO serbit
- 1 CurrentWindow @ +wdUserPort @ +mpSigBit C@ SCALE TO intuibit
- serbit intuibit | ExecWait TO wakebits \ wait for an event
- ToggleCursor
- ReadMessage @ CheckIO IF
- GetSerChar
- THEN
- wakebits intuibit AND IF
- HandleEvents
- THEN
- REPEAT
- CloseDown ;
-