home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
forth
/
compiler
/
fpc
/
source
/
therctxt.seq
< prev
next >
Wrap
Text File
|
1990-03-28
|
2KB
|
84 lines
\\ THERCTXT.SEQ Hercules graphics mode text routines
Hercules graphics mode text support, originally by Wempe, subsequently
modified by Oliver Shank, Mike Mayo, Tom Zimmer and Jerry Modrow.
This is a simple two color system, color zero being black, and color
one being white. If you set a color above 127, a point will be drawn
XOR'd with the current pixel.
{
\ FORTH DECIMAL \ TARGET \ Source Library
$0F000 value charseg
$0FA6E value chartbl
0 value charadr
0 value hercX
0 value hercY
: H-AT ( x y -- ) \ AT for Hercules
=: hercY =: hercX ;
: HERC-AT ( x y -- ) \ AT for Hercules
8 * =: hercY 8 * =: hercX ;
: HERC-AT? ( -- x y ) \ AT? for Hercules
hercX 8 * hercY 8 * ;
: (HERC-EMIT) ( c -- ) \ emit to Hercules graphics screen.
8 * chartbl + =: charadr
hercX 8 /
hercY 4 /mod 90 * swap $2000 * +
+ ( video-byte-addr )
\ POINTOFFSET = INT[ROW/4] * 90 + REM[ROW/4]*$2000 + INT[COL/8]
\ PIXEL(1 BIT)ADDR = REM[COL/8] {WITHIN BYTE}
\ Next bit, step along byte and to next byte.
\ Next row, add $2000, and add 90 when wrapping.
8 0 do charseg charadr c@l incr> charadr
over herc-seg @ swap c!l
$2000 + dup $7FFF u> if 90 + then $7FFF and
loop
drop
hercX 8 + 720 /mod if 8 +!> hercY then =: hercX ;
: (HERC-CR) ( -- ) hercY 8 + 319 min =: hercY off> hercX ;
: HERC-EMIT ( c -- ) printing @ IF pemit ELSE (herc-emit) THEN ;
: HERC-TYPEL ( s a l -- ) bounds ?do dup i c@L emit loop drop ;
: HERC-TYPE ( a l -- ) bounds ?do i c@ emit loop ;
: HERC-CR ( -- ) printing @ IF crlf ELSE (herc-cr) THEN ;
: HERCULES$ ( -- )
HERCULES \ Hercules graphics mode
\ ['] herc-typeL is typeL
['] herc-type is type \ vector for graphics mode text
['] herc-emit is emit
['] herc-at is at
['] herc-at? is at?
['] herc-cr is cr ;
: HTEXT$ ( -- )
HTEXT \ Text mode
\ ['] QtypeL is typeL
['] (type) is type \ restore normal text words
['] (emit) is emit
['] ibm-at is at
['] ibm-at? is at?
['] crlf is cr
DARK ;
\ FORTH TARGET >TARGET
}