home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hall of Fame
/
HallofFameCDROM.cdr
/
prog1
/
4th_86.lzh
/
7NXTRA3.4TH
< prev
next >
Wrap
Text File
|
1989-05-08
|
11KB
|
321 lines
( 1st. February 1989 - 4th_86 version 3.0 - MFB )
off printload
on redefine
( This file contains various odd bits of code which have been displaced
from other source files
The section marked ** is no longer used -- GLOAD replaces CLOAD -- but
it has been left here in case the previous format MASM files with
embedded dictionary entries are preferred. To use it - uncoment it and
recompile. NOTE however that the word $!+ has been commented out of
7BASIC3 as it serves no purpose other than to assist definition of LXWRD
and will have to be loaded separately if you want to re-implement CLOAD )
( *** following three words transferred here from original
7DOUBLE3 which is now MASM code ****)
: ,AND swap 4 pick and 3 poke and ;
( *******************)
: ,OR swap 4 pick or 3 poke or ;
( *******************)
: ,XOR swap 4 pick xor 3 poke xor ;
( *******************)
: FLOAD WORD dup string $! LOAD ;
( *******************)
2 block savehead
2 block saveihead
2 block savesysl
2 block savelum
DATA[ BYTE " 4th_86.com" ] savesysn
( *******************)
: saveinit
LAST @ B@ IF
LAST @ HEAD @ TOPDICT 3 + 3 PICK - ( compute size of diction)
( TOS: source, dest, size )
HEAD @ ' SYSLAST 3 + dup@ savesysl ! ! ( SYSLAST points to new dict segment)
OVER OVER + DUP HEAD dup@ savehead ! !
' INITHEAD 3 + dup@ saveihead ! ! ( HEAD and INITHEAD fixed)
MOVE ( dictionary attached )
then
LUM @ ' INITLUM 3 + dup@ savelum ! ! ( INITLUM fixed ) ;
( *******************)
: dosave dup 2 SYSOPEN HEAD @ 100H - 100H 3 PICK SYSWRITE SYSCLOSE
crlf " system saved as " ." ." crlf
savehead @ head ! saveihead @ ' inithead 3 + !
savesysl @ ' syslast 3 + ! savelum @ ' initlum 3 + ! ;
( *******************)
: fsave saveinit word dosave ;
( *******************)
: savesys saveinit savesysn string $! string dosave ;
( *******************)
: quote ; ( dummy stub for 'LINKing' to if quote included )
: bye norm quote q-u-it ; ( normal exit method )
( *******************)
: ILOAD WORD GIMAGE ;
( *******************)
: ISAVE WORD dup PIMAGE crlf " image saved as " ." ." ;
( *******************)
: RECURSE LAST @ DUP B@ + 2 + @ HEAD! ; IMMEDIATE
( ********** -------- following no longer used -------- ***********
** VVVVVVV
**
** DATA[ WORD 0 ] FCBADD ( to avoid keeping it on stack)
** DATA[ BYTE " endfile" ] EOFSTRG ( for comparison with input stream)
** DATA[ BYTE " endproc" ] NTRYSTRG ( for comparison with input stream)
** DATA[ WORD 0 ] SLAST ( simulate last while defining)
** 10 BLOCK IBUFF ( buffer for dictionary string)
** DATA[ WORD 0 ] CTFLAG
** DATA[ WORD 0 ] CSFLAG
**
** ( *******************)
** : FIND[ ( load bytes till 'e' found -- returns only nok or ok flag)
** FCBADD @
** REPEAT DUP SYSRBYTE
** 0= if 0FFH ( nok flag) return then ( sysrbyte flag dropped)
** DUP ( BYTE on TOS) "e" = 0=
** WHILE HEADB! ENDWHILE
** SWAP DROP headb! ( save it whatever) 0 ( ok flag) ;
**
** ( *******************)
** : RBYTE ( read one byte from file)
** FCBADD @ SYSRBYTE DROP ;
**
** ( *******************)
** : LXSTRG ( read 7 bytes to test for 'endproc' and 'endfile')
** 6 0 DO RBYTE HEADB! LOOP ;
**
** ( *******************)
** : FBUFF ( read label from input file and store in IBUFF with count)
** IBUFF SLAST ! ( use SLAST as pointer into IBUFF )
** 0 1- BEGIN 1+ ( count)
** SLAST DUP@ 1+ SWAP ! ( update SLAST)
** RBYTE ctflag @ if dup headb!
** then DUP SLAST @ B! 20H = END
** IBUFF B! ( count) ;
**
**
** ( *******************)
** : LXWRD ( read next word from file and store at LAST)
** FBUFF
** IBUFF B@ 1- DUP 4 + LAST @ SWAP - SLAST !
** SLAST @ DUP IBUFF SWAP $!+ + 0 SWAP 1+ drop drop ;
**
** ( *******************)
** CODE STEST ( string test -- scan HL and DE strings for match)
** ' PSHSI# CALL, C 8 MVI, ( character count)
** H POP, D POP, ( pointers to strings)
** BEGIN D LDAX, C DCR, M CMP,
** PSW PUSH, H INX, D INX, PSW POP, ENDNZ ( mismatch)
** H 0 MVI, L C MOV, ( will be zero only if whole string matches)
** H PUSH, ' POPSI# CALL, H POP,
** ;PUSH
**
** ( *******************)
** : DOLOAD ( kept separate so that RETURN will drop into CLOAD correctly)
** BEGIN
** FIND[ ( returns only ok or nok flag)
** 0FFH = IF DROP DROP ( pointers for STEST)
** RETURN ( 'e' not found - file exhausted)
** THEN
** ( GETLOC ) HEAD @
**
** LXSTRG ( get NTY string for testing)
** 1- ( pointer for string test AND for jmp THREAD)
** DUP ( for STEST)
** NTRYSTRG 1+ ( ignore length byte)
** SWAP STEST ( do test)
** ( aarghh! => will miss next 'e' if within 7 bytes )
** 0= IF LXWRD
** ( getloc) head @ swap head !
**
** 0E9H HEADB!
** ' THREAD HEAD @ - 2 - CROSS @ IF BASE @ + THEN
** HEAD! ( JMP THREAD)
** head ! ( to value after LXWRD)
** SLAST @ LAST !
** head @ CROSS @ IF BASE @ - THEN
** SLAST @ DUPB@ + 2 + ! ( value of code addr)
** ( return )
** ( else drop)
** THEN
**
** ( no LXSTRG -- already in place -- also 1- already done)
** DUP ( for STEST)
** EOFSTRG 1+ ( ignore length byte)
** SWAP STEST ( do test)
** 0= ( loop if 'endfile' string not found)
** END ( 'endfile' string found)
** HEAD ! ( restore HEAD to getloc value less one ) drop ;
**
** ( *******************)
** : CsLOAD ( load COM file)
** GETLOC csflag @ if
** 10h + fff0h and dup
** cross @ if base @ + then
** head ! then
** ( .H " ===> start of code" ." crlf) drop
** ( 0 DEFINE ) ( last @ dup word swap $! dup 0 swap b! head @ swap !)
** word ( LAST @ ) 1 SYSOPEN FCBADD ! ( open file and store FCBADD)
** DOLOAD FCBADD @ SYSCLOSE
** 0E9H HEADB! ' THREAD CROSS @ IF BASE @ + THEN
** HEAD @ - 2 - HEAD! depth kill
** ( GETLOC .H " ===> end of code" ." crlf ) ;
**
** : ctload 0 ctflag ! 0 csflag ! csload ;
** ( trim off redundant labels in code area)
** ( involves extra work in ASM file)
**
** : cload 1 ctflag ! 0 csflag ! csload ;
** ( include redundant labels in code area)
** ( makes life easy with ASM file)
**
** : c0load 1 ctflag ! 1 csflag ! csload ;
** ( as for cload, but loads at xxx0 )
**
**
** ^^^^^^
** ********** -------- above no longer used -------- **************
**
** ---------- replaced by ---------------
** VVVVV )
data[ WORD 0 ] fcbaddx
data[ WORD 0 ] headad
data[ WORD 0 ] dictad
data[ BYTE " ndfile " ] eofstr
data[ BYTE " ndproc " ] ntrystr
data[ BYTE " xxxxxx " ] strgbuf
data[ WORD 0 ] strptr
data[ WORD 0 ] slastx
data[ BYTE 0 ] eoflg
data[ WORD 0 ] dptr
( *******************
same as headb! but at strgbuf
*********************** )
: str! strptr @ 1+ strptr ! strptr @ B! ;
( *******************
read byte from file
*********************** )
: rbyter fcbaddx @ sysrbyte 0= eoflg B! ;
( *******************
read next 6 characters into strgbuf
*********************** )
: lxstrgg strgbuf strptr ! 6 0 do rbyter str! loop ;
( *******************
do file load at HEAD until endproc
*********************** )
: dload fcbaddx @
repeat dup sysrbyte dup 0=
eoflg B! swap dup "e" = if 3 kill return then
swap 0= 0= while
( head @ dup 1+ head ! ! ) headb! endwhile drop ;
( *******************
do dictionary entry load after endproc
*********************** )
: d2load fcbaddx @
repeat dup sysrbyte dup 0=
eoflg B! swap dup "e" = if 3 kill return then
swap 0= 0= while
dictad @ dup 1+ dictad ! ! endwhile drop ;
( *******************
add value at headad to CFA addresses
*********************** )
: relocate dptr @
begin dup B@ ( length byte)
+ 2 + ( at PFA) dup 2+ dptr ! dup @ ( pfa contents )
100h - ( code offset) ( headad )
headad @ cross @ if base @ - then + swap !
dptr @ dup last @ swap - 0= end slastx @ last !
( drop ) ;
: updd "e" ( head @ dup 1+ head ! ! ) headb!
strgbuf 1+ head @ 7 move 7 head +! ;
: upd2 "e" dictad @ dup 1+ dictad ! !
strgbuf 1+ dictad @ 7 move 7 dictad +! ;
( *******************
equivalent to csload
*********************** )
: gsload word dup string $! 1 sysopen fcbaddx !
begin dload lxstrgg
ntrystr 1+ strgbuf 1+ 5 strcmp 0= dup if updd then 0= end
head @ dictad !
begin d2load lxstrgg ( then )
eofstr 1+ strgbuf 1+ 5 strcmp 0= dup if ( return )
( then ) upd2 then ( eoflg b@ ) 0= end ;
( *******************
move dictionary
*********************** )
: dmove dictad @ head @ - dup last @ swap - head @
swap dup slastx ! dup dptr ! rot move ;
( *******************
close files and go round the
edit - compile cycle again
*********************** )
( : panic fcbaddx @ sysclose redit ; )
( *******************
test stub
*********************** )
: gdoit gsload dmove relocate
fcbaddx @ sysclose ; ( crlf
headad @ 8dm drop crlf head @ 8dm drop crlf dictad @ .h ; )
( *******************
replaces cload
*********************** )
: gload head @ headad ! gdoit drop ;
( *******************
replaces c0load
*********************** )
: g0load getloc 10h + fff0h and cross @ if base @ + then
dup head ! headad ! gdoit drop ;
2 block olkad
2 block olkad1
2 block olkad2
( *******************
link now works in cross mode as well
*********************** )
: link gtdfa cross @ if base @ + then
( from) dup olkad ! dup dup@ olkad1 ! 2+ @ olkad2 !
gtdfa cross @ if base @ + then
( to) over - 3 - swap dup e9h swap b! 1+ ! ;
( *******************
but can't see why we'd want to
unlink whilst in cross mode
*********************** )
: unlink olkad1 @ olkad @ ! olkad2 @ olkad @ 2+ ! ;