home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
forth
/
compiler
/
fpc
/
tcom
/
debugger
/
tdbgbscs.seq
< prev
next >
Wrap
Text File
|
1990-09-12
|
2KB
|
66 lines
\ TDBGBSCS.SEQ "Target Debugger Basics"
decimal
anew bsc_words
$AF value listen-up
$FA value go-ahead
13 value hi-there
'!' value I'm-here
2variable vdate getdate vdate 2! \ date-stamp on this compile
0 value keyval
: ?comminit ( -- ) \ abort if commport has not been initialized
commport 0= abort" Comm Port has not been selected!" ;
: tdbg-hello ( -- ) \ startup message to be displayed if
\ there is nothing on the DOS command line
." \d\n\n\4\S10TDBG\S10TDBG\S10TDBG\s10\0\N"
." \n\2 Target Debugger for 80c196\s04\n"
commport 0= if com1: then
." \n\s06\3 Currently running on Comm Port # "
>attrib3 commport . >norm
." \nType \3 BYE \0 to leave this program.\n"
." ( compiled " vdate 2@ form-date count type ." )\n"
." \n\S10\4 Hang Loose! "
." \4 No \`Russian Forward\`. "
." \4 Use \`Reverse Polish\` "
?comminit
cr ;
' tdbg-hello is .hello
: purge ( -- ) \ wait until nothing received for 50 ms
\ leave with buffer clear
begin clr-buf 50 ms com-cnt 0=
key? control [ =
or until ;
: go-wait ( -- ) \ wait for a go-ahead, up to 200 ms
200 0 do 1 ms
com-cnt 0<> if com-get go-ahead = ?leave then
loop ;
: command ( c -- )
clr-buf listen-up com-out go-wait com-out ;
: getbyte ( -- b ) \ get a byte value from the comm port
begin com-cnt 0<>
key? control [ =
or until \ wait for the byte
com-get ;
: getword ( -- w ) \ get a word value from the comm port
getbyte getbyte join ;
: sendword ( w -- ) \ send a word value to the comm port
split swap com-out \ send the low byte of the word
com-out ; \ send the high byte
: .ns ( n -- ) \ display a number without a space following
(.) type ;
: jumpto ( addr -- ) \ make target jump to addr
0 command sendword ;