Hello!
First I must say, that I'm new in posting on users group so please
don't blame too much for some mistake.
Here is my problem:
I'm experiencing very weird behavior of software running on LaunchPad and
I'm asking community to help with suggestions or experience.
I've used way many hours and days exploring problems with no solution.
My conclusion is that I have problem with reliable writing of code to flash.
Here is synopsis:
Software function:
Controller for DC motor drive, driving H-bridge MOSFETS, using current limit
protection and over-temperature protection. Commands for movement are accepted
over i2c. I'm using USI I2C library (slaa368a, rev B).
Thaer are three execution threads:
DC motor drive statemachine is driven by Timer_A irq with 1kHz.
ADC conversion is done in endless main loop.
I2c runs in USI irq.
I use fifo buffer with length 2 for commands from i2c->motor drive fsm.
I use fifo buffer with length 2 for ADC results -> motor drive fsm.
This way to avoid any memory corruption issues.
For testing, I have LEDs connected in place of MOSFET drivers and potentiometers
for simulating motor current and motor temperature, so I can simulate and
observe functionality.
I have another LaunchPad with simulation software that periodically sends two
commands ( move left, move right ) to i2c
(i2c master, same i2c library). I had similar problems with behavior with master
code too!.
Problem:
Program behaves differently even with slight changes in code ( adding/removing
if()..else, adding/removing function call ) or change in compiler options (
optimizing level, release/debug...). Code changes influence even if
added/removed code is not executed at all! Effective change is only slightly
different layout of object code.
Observed by improper LED's changes.
Example of change that improved functionality:
I've noticed, that for example, initializing port direction register works
only after several writes with same value.
P1DIR |= P1_ALL_OUT_MASK; // Unreliable write!!! LEDS on port 1 don't
work
P2DIR |= P2_ALL_OUT_MASK; // Unreliable write. LEDs on port 2 don't work
P2DIR |= P2_ALL_OUT_MASK;
P2DIR |= P2_ALL_OUT_MASK; // OK, now are LEDs on port 2 working as
expected
Since this is done at the very beginning of program, I can exclude any software
error.
I've noticed, that dissassembly code is on above place different from
assembly listing generated from compiler.
However, IAR doesn't detect problems at download ( I have active option for
download verification )
Partial list of what I've checked in my software, regarding possible
run-time errors:
I don't use any memory allocation in 128 bytes of ram.
State machine is simple, no error possible.
Stack is big enough.
Development environment:
Windows XP SP2
IAR Embedded Workbench 5.10.6, Kickstart version, using "C" code. I2C library is
in assembler.
LaunchPad with MSP430G2231.
Powered via USB cable
Voltage on processor 3.4V
Now, community, if you've read this far, I'm opened to suggestions.
I'd like to use some open-source tools to give a try to recreate project
and see difference.
Please suggest me tools that you're satisfied with.
I'm using CCS 4.0 for MSP430F2274 on eZ430-RF2500 with SimpliciTI without
problems of this type.
I'm trying to avoid CCS for MSP430Gxxxx, because it's huge beast and I
can't manage it and I don't want to have two copies of it on PC.
Thank you for help and suggestions in advance.
Best regards,
Borut.
Need help, weird program behavior LaunchPad - flash writing problem?
Started by ●April 9, 2011
Reply by ●April 11, 20112011-04-11
I've developped assembler/disassembler/decompiler/compiler/tinyForth for msp430 Launchpad. See if this can help you develop other program.
http://tech.groups.yahoo.com/group/armForth/files/msp430/msp430f240028p.f
--- 11/4/7 (四),borut.preloznik 寫道:
寄件者: borut.preloznik
主旨: [msp430] Need help, weird program behavior LaunchPad - flash writing problem?
收件者: m...
日期: 2011年4月7日,四,下午6:14
Hello!
First I must say, that I'm new in posting on users group so please don't blame too much for some mistake.
Here is my problem:
I'm experiencing very weird behavior of software running on LaunchPad and I'm asking community to help with suggestions or experience.
I've used way many hours and days exploring problems with no solution.
My conclusion is that I have problem with reliable writing of code to flash.
Here is synopsis:
Software function:
Controller for DC motor drive, driving H-bridge MOSFETS, using current limit protection and over-temperature protection. Commands for movement are accepted over i2c. I'm using USI I2C library (slaa368a, rev B).
Thaer are three execution threads:
DC motor drive statemachine is driven by Timer_A irq with 1kHz.
ADC conversion is done in endless main loop.
I2c runs in USI irq.
I use fifo buffer with length 2 for commands from i2c->motor drive fsm.
I use fifo buffer with length 2 for ADC results -> motor drive fsm.
This way to avoid any memory corruption issues.
For testing, I have LEDs connected in place of MOSFET drivers and potentiometers for simulating motor current and motor temperature, so I can simulate and observe functionality.
I have another LaunchPad with simulation software that periodically sends two commands ( move left, move right ) to i2c
(i2c master, same i2c library). I had similar problems with behavior with master code too!.
Problem:
Program behaves differently even with slight changes in code ( adding/removing if()..else, adding/removing function call ) or change in compiler options ( optimizing level, release/debug...). Code changes influence even if added/removed code is not executed at all! Effective change is only slightly different layout of object code.
Observed by improper LED's changes.
Example of change that improved functionality:
I've noticed, that for example, initializing port direction register works only after several writes with same value.
P1DIR |= P1_ALL_OUT_MASK; // Unreliable write!!! LEDS on port 1 don't work
P2DIR |= P2_ALL_OUT_MASK; // Unreliable write. LEDs on port 2 don't work
P2DIR |= P2_ALL_OUT_MASK;
P2DIR |= P2_ALL_OUT_MASK; // OK, now are LEDs on port 2 working as expected
Since this is done at the very beginning of program, I can exclude any software error.
I've noticed, that dissassembly code is on above place different from assembly listing generated from compiler.
However, IAR doesn't detect problems at download ( I have active option for download verification )
Partial list of what I've checked in my software, regarding possible run-time errors:
I don't use any memory allocation in 128 bytes of ram.
State machine is simple, no error possible.
Stack is big enough.
Development environment:
Windows XP SP2
IAR Embedded Workbench 5.10.6, Kickstart version, using "C" code. I2C library is in assembler.
LaunchPad with MSP430G2231.
Powered via USB cable
Voltage on processor 3.4V
Now, community, if you've read this far, I'm opened to suggestions.
I'd like to use some open-source tools to give a try to recreate project and see difference.
Please suggest me tools that you're satisfied with.
I'm using CCS 4.0 for MSP430F2274 on eZ430-RF2500 with SimpliciTI without problems of this type.
I'm trying to avoid CCS for MSP430Gxxxx, because it's huge beast and I can't manage it and I don't want to have two copies of it on PC.
Thank you for help and suggestions in advance.
Best regards,
Borut.
----------
comment:
************************************************************************************************
before floading this file, we have to prepare the followings....
**** methods to extend memory size ****
win32for \ enter win32for.4.2.671
sys \ enter dos
win32for fload meta setsize bye \ adding 5Meg byte to application, 2Meg byte to system
fkernel fload extend \ bye
fsave f.exe \ save f.exe as a working horse. put it on the desktop.
also copy WinIo.dll, WinIo.sys, WINIO.VXD to the directory the same as Win32forth.exe.
************************************************************************************************
comment;
hex
: 2rot 2>r 2swap 2r> 2swap ;
: -2rot 2rot 2rot ;
variable download.to.ram.start 210 download.to.ram.start !
variable download.to.ram.end+1 230 download.to.ram.end+1 !
variable ram.start 200 ram.start !
variable ram.end 280 ram.end !
variable target.var.range 10 target.var.range !
variable program.start f800 program.start ! \ *****************************************
variable program.length 800 program.length ! \ *****************************************
variable generate.disassem.program? generate.disassem.program? on
variable op.code.of.call 12b0 op.code.of.call !
variable op.code.of.jmp 4030 op.code.of.jmp !
variable last' 1c8e last' ! \ *****************************************
variable c.style? c.style? on
cr .( **** enter 8 to generate disassem program, otherwise not **** ) \ o
KEY '8' = #IF 1 #ELSE 0 #THEN generate.disassem.program? !
: MAXIZE.LIST 80 2e52 36 XCALL DROP ; MAXIZE.LIST
: emitx drop ; : typex 2drop ; : crx ;
: no.disassem.program ( cls ) [ ' _memit literal ] is emit [ ' _mtype literal ] is type ( [ ' crx literal ] is cr ) ;
: generate.disassem.program ( cls ) [ ' emitx literal ] is emit [ ' typex literal ] is type ( [ ' crx literal ] is cr ) ;
generate.disassem.program? @ #if generate.disassem.program #then
\ INCLUDE 232C3c.f
\ 232C2.F
DECIMAL
VARIABLE EXI.INI? -1 EXI.INI? !
VARIABLE EXI?
: XON -1 EXI.INI? ! ;
: XOFF 0 EXI.INI? ! ;
VARIABLE DONE?
: DONE DONE? @ IF 0 ELSE -1 THEN DONE? ! ;
VARIABLE BAUD.RATE?
: BAUD.RATE BAUD.RATE? ! ;
DEFER _EXI
VARIABLE PORT?
: PORT ( N ... ) PORT? ! ; 5 PORT
: BS 8 EMIT ;
: SET.com.port,BAUD.RATE ( PORT baud.rate -- )
over 1 7 between not abort" com port 1 ~ 7 only "
BAUD.RATE PORT ;
: show.0.11k cr ." 0.11k1 0.11k2 0.11k3 0.11k4 0.11k5 0.11k6 0.11k7 0.11k8 0.11k9 0.11k10 0.11k11 0.11k12 0.11k13 0.11k14 0.11k15" ;
: show.0.3k cr ." 0.3k1 0.3k2 0.3k3 0.3k4 0.3k5 0.3k6 0.3k7 0.3k8 0.3k9 0.3k10 0.3k11 0.3k12 0.3k13 0.3k14 0.3k15" ;
: show.0.6k cr ." 0.6k1 0.6k2 0.6k3 0.6k4 0.6k5 0.6k6 0.6k7 0.6k8 0.6k9 0.6k10 0.6k11 0.6k12 0.6k13 0.6k14 0.6k15" ;
: show.1.2k cr ." 1.2k1 1.2k2 1.2k3 1.2k4 1.2k5 1.2k6 1.2k7 1.2k8 1.2k9 1.2k10 1.2k11 1.2k12 1.2k13 1.2k14 1.2k15" ;
: show.2.4k cr ." 2.4k1 2.4k2 2.4k3 2.4k4 2.4k5 2.4k6 2.4k7 2.4k8 2.4k9 2.4k10 2.4k11 2.4k12 2.4k13 2.4k14 2.4k15" ;
: show.4.8k cr ." 4.8k1 4.8k2 4.8k3 4.8k4 4.8k5 4.8k6 4.8k7 4.8k8 4.8k9 4.8k10 4.8k11 4.8k12 4.8k13 4.8k14 4.8k15" ;
: show.9.6k cr ." 9.6k1 9.6k2 9.6k3 9.6k4 9.6k5 9.6k6 9.6k7 9.6k8 9.6k9 9.6k10 9.6k11 9.6k12 9.6k13 9.6k14 9.6k15" ;
: show.19.2k cr ." 19.2k1 19.2k2 19.2k3 19.2k4 19.2k5 19.2k6 19.2k7 19.2k8 19.2k9 19.2k10 19.2k11 19.2k12 19.2k13 19.2k14 19.2k15" ;
: show.38.4k cr ." 38.4k1 38.4k2 38.4k3 38.4k4 38.4k5 38.4k6 38.4k7 38.4k8 38.4k9 38.4k10 38.4k11 38.4k12 38.4k13 38.4k14 38.4k15" ;
: show.57.6k cr ." 57.6k1 57.6k2 57.6k3 57.6k4 57.6k5 57.6k6 57.6k7 57.6k8 57.6k9 57.6k10 57.6k11 57.6k12 57.6k13 57.6k14 57.6k15" ;
: show.115.2k cr ." 115.2k1 115.2k2 115.2k3 115.2k4 115.2k5 115.2k6 115.2k7 115.2k8 115.2k9 115.2k10 115.2k11 115.2k12 115.2k13 115.2k14 115.2k15" ;
: show.128k cr ." 128k1 128k2 128k3 128k4 128k5 128k6 128k7 128k8 128k9 128k10 128k11 128k12 128k13 128k14 128k15" ;
: show.230k cr ." 230k1 230k2 230k3 230k4 230k5 230k6 230k7 230k8 230k9 230k10 230k11 230k12 230k13 230k14 230k15" ;
: show.256k cr ." 256k1 256k2 256k3 256k4 256k5 256k6 256k7 256k8 256k9 256k10 256k11 256k12 256k13 256k14 256k15" ;
: show.0.11k cr ." 0.11k1 0.11k2 0.11k3 0.11k4 0.11k5 0.11k6 0.11k7 0.11k8 0.11k9 0.11k10 0.11k11 0.11k12 0.11k13 0.11k14 0.11k15" ;
: show.0.3k cr ." 0.3k1 0.3k2 0.3k3 0.3k4 0.3k5 0.3k6 0.3k7 0.3k8 0.3k9 0.3k10 0.3k11 0.3k12 0.3k13 0.3k14 0.3k15" ;
: show.0.6k cr ." 0.6k1 0.6k2 0.6k3 0.6k4 0.6k5 0.6k6 0.6k7 0.6k8 0.6k9 0.6k10 0.6k11 0.6k12 0.6k13 0.6k14 0.6k15" ;
: show.1.2k cr ." 1.2k1 1.2k2 1.2k3 1.2k4 1.2k5 1.2k6 1.2k7 1.2k8 1.2k9 1.2k10 1.2k11 1.2k12 1.2k13 1.2k14 1.2k15" ;
: show.2.4k cr ." 2.4k1 2.4k2 2.4k3 2.4k4 2.4k5 2.4k6 2.4k7 2.4k8 2.4k9 2.4k10 2.4k11 2.4k12 2.4k13 2.4k14 2.4k15" ;
: show.4.8k cr ." 4.8k1 4.8k2 4.8k3 4.8k4 4.8k5 4.8k6 4.8k7 4.8k8 4.8k9 4.8k10 4.8k11 4.8k12 4.8k13 4.8k14 4.8k15" ;
: show.9.6k cr ." 9.6k1 9.6k2 9.6k3 9.6k4 9.6k5 9.6k6 9.6k7 9.6k8 9.6k9 9.6k10 9.6k11 9.6k12 9.6k13 9.6k14 9.6k15" ;
: show.19.2k cr ." 19.2k1 19.2k2 19.2k3 19.2k4 19.2k5 19.2k6 19.2k7 19.2k8 19.2k9 19.2k10 19.2k11 19.2k12 19.2k13 19.2k14 19.2k15" ;
: show.38.4k cr ." 38.4k1 38.4k2 38.4k3 38.4k4 38.4k5 38.4k6 38.4k7 38.4k8 38.4k9 38.4k10 38.4k11 38.4k12 38.4k13 38.4k14 38.4k15" ;
: show.57.6k cr ." 57.6k1 57.6k2 57.6k3 57.6k4 57.6k5 57.6k6 57.6k7 57.6k8 57.6k9 57.6k10 57.6k11 57.6k12 57.6k13 57.6k14 57.6k15" ;
: show.115k cr ." 115k1 115k2 115k3 115k4 115k5 115k6 115k7 115k8 115k9 115k10 115k11 115k12 115k13 115k14 115k15" ;
: show.128k cr ." 128k1 128k2 128k3 128k4 128k5 128k6 128k7 128k8 128k9 128k10 128k11 128k12 128k13 128k14 128k15" ;
: show.230k cr ." 230k1 230k2 230k3 230k4 230k5 230k6 230k7 230k8 230k9 230k10 230k11 230k12 230k13 230k14 230k15" ;
: show.256k cr ." 256k1 256k2 256k3 256k4 256k5 256k6 256k7 256k8 256k9 256k10 256k11 256k12 256k13 256k14 256k15" ;
: show.all.port,baud.rate show.0.11k show.0.3k show.0.6k show.1.2k show.2.4k show.4.8k show.9.6k
show.19.2k show.38.4k show.57.6k show.115k show.128k show.230k show.256k ;
defer oo
\ ******************************************************************************
\ MODIFIED BY CJJ MAR.14,2001
\ Written by Andrew McKewan in Visual C++
\ Translated to Forth by Tom Zimmer
\ January 3nd, 1997 tjz
\ Updated to include changes from Skip Inskeep, as well as
\ other changes.
\ February 10th, 1997 by Tom Zimmer
\ Updated with a couple of additional changes from Skip Inskeep.
\ A Win32Forth example program that illustrates how to open COM1 for
\ bi-directional communications and then allows a simple terminal
\ program to communicate with whatever is connected at 9600 baud.
\ define the object for the Device Control Block ( DCB ) structure
:Object DCB
Record: AddrOf
int DCBlength
int BaudRate
int BinaryBits \ a 32bit cell of bit fields
1 bits fBinary \ define the bit fields
1 bits fParity
1 bits fOutxCtsFlow
1 bits fOutxDsrFlow \ SDI changed for Rts to Dsr
2 bits fDtrControl
1 bits fDtrSensitivity
1 bits fTXContinueOnXoff
1 bits fOutX
1 bits fInx
1 bits fErrorChar
1 bits fNull
2 bits fRtsControl
1 bits fAbortOnError
17 bits fDummy
short wReserved
short XonLim
short XoffLim
byte ByteSize
byte Parity
byte StopBits
byte XonChar
byte XoffChar
byte ErrorChar
byte EofChar
byte EvtChar
short wReserved1
;RecordSize: SIZEOFDCB
:M Reset: ( -- )
AddrOf SIZEOFDCB erase
;M
:M ClassInit: ( -- )
ClassInit: super
Reset: self \ create structure as Reset
;M
;Object
\ define the field names for the Communications Timeout structure
0 CELL Field+ .ReadIntervalTimeout
CELL Field+ .ReadTotalTimeoutMultiplier
CELL Field+ .ReadTotalTimeoutConstant
CELL Field+ .WriteTotalTimeoutMultiplier
CELL Field+ .WriteTotalTimeoutConstant
CONSTANT COMMTIMEOUTSBYTES
: ComTimeouts { cHndl \ CT -- } \ Initialize the communications timeouts
COMMTIMEOUTSBYTES LocalAlloc: CT \ allocate a CT structure
CT COMMTIMEOUTSBYTES erase \ initialize it to zeros
\ set read timeouts to magic value of don't wait, just poll
-1 CT .ReadIntervalTimeout !
0 CT .ReadTotalTimeoutMultiplier !
0 CT .ReadTotalTimeoutConstant !
1 CT .WriteTotalTimeoutMultiplier !
20 CT .WriteTotalTimeoutConstant !
CT rel>abs
cHndl
Call SetCommTimeouts drop ;
: ComOpen ( z1 -- cHndl ) \ Open Com port for z" COM1", or z" COM2"
>R
NULL \ no template
NULL \ open file attributes
OPEN_EXISTING \ creation distribution
NULL \ no security attributes
0 \ exclusive access
GENERIC_READ GENERIC_WRITE or \ desired access modes
R> rel>abs \ zstring filename
Call CreateFile \ returns handle or -1
dup -1 = \ if -1 then error
Abort" Failed to open COM port!"
; \ -- chndl ;return handle to port
\ ************************************************************
\ here is a list of valid parameters for ComSetup. Except for
\ the ByteSize parameter, these are all windows constants.
\ --- BuadRate CBR_110 CBR_300 CBR_600
\ CBR_1200 CBR_2400 CBR_4800
\ CBR_9600 CBR_14400 CBR_56000
\ CBR_19200 CBR_38400 CBR_57600
\ CBR_115200 CBR_128000 CBR_256000
\
\ --- ByteSize 5, 6, 7, 8
\
\ --- Parity NOPARITY ODDPARITY MARKPARITY
\ EVENPARITY SPACEPARITY
\
\ --- StopBits ONESTOPBIT TWOSTOPBITS ONE5STOPBITS
\
\ ************************************************************
\ Setup the Communications state to the parameters specified
: ComSetup { baud size parity stop cHndl -- }
DCB.AddrOf rel>abs
cHndl
Call GetCommState ?win-error
baud Put: DCB.BaudRate
size Put: DCB.ByteSize
parity 0<> Put: DCB.fParity \ parity enabled flag
parity Put: DCB.Parity
stop Put: DCB.StopBits
DCB.AddrOf rel>abs
cHndl
Call SetCommState ?win-error ;
: ComClose ( cHndl -- ) \ close com port if its open
?dup
if Call CloseHandle drop
then ;
:Object COMSTAT
Record: AddrOf
int lpComStatBits \ a 32bit cell of bit fields
1 bits fCtsHold \ define the bit fields Low to High
1 bits fDsrHold
1 bits fRlsdHold
1 bits fXoffHold
1 bits fXoffSent
1 bits fEof
1 bits fTxim
25 bits fReserved
int cbInQue
int cbOutQue
;RecordSize: SIZEOFCOMSTAT
:M Reset: ( -- )
AddrOf SIZEOFCOMSTAT erase
;M
:M ClassInit: ( -- )
ClassInit: super
Reset: self \ create structure as Reset
;M
;Object
: ComErrorClear { comhndl \ lpErrors -- f } \ true = success
COMSTAT.addrof rel>abs
lpErrors rel>abs
comhndl Call ClearCommError 0<> ;
\ ----------------------
: 0.11K17 17 110 INITIALIZE RUN.COM ;
: 0.11K18 18 110 INITIALIZE RUN.COM ;
: 0.11K19 19 110 INITIALIZE RUN.COM ;
: 0.11K20 20 110 INITIALIZE RUN.COM ;
: 0.11K21 21 110 INITIALIZE RUN.COM ;
: 0.11K22 22 110 INITIALIZE RUN.COM ;
: 0.11K23 23 110 INITIALIZE RUN.COM ;
: 0.11K24 24 110 INITIALIZE RUN.COM ;
: 0.11K25 25 110 INITIALIZE RUN.COM ;
: 0.11K26 26 110 INITIALIZE RUN.COM ;
: 0.11K27 27 110 INITIALIZE RUN.COM ;
: 0.11K28 28 110 INITIALIZE RUN.COM ;
: 0.11K29 29 110 INITIALIZE RUN.COM ;
: 0.11K30 30 110 INITIALIZE RUN.COM ;
: 0.11K31 31 110 INITIALIZE RUN.COM ;
: 0.11K32 32 110 INITIALIZE RUN.COM ;
: 0.3K17 17 300 INITIALIZE RUN.COM ;
: 0.3K18 18 300 INITIALIZE RUN.COM ;
: 0.3K19 19 300 INITIALIZE RUN.COM ;
: 0.3K20 20 300 INITIALIZE RUN.COM ;
: 0.3K21 21 300 INITIALIZE RUN.COM ;
: 0.3K22 22 300 INITIALIZE RUN.COM ;
: 0.3K23 23 300 INITIALIZE RUN.COM ;
: 0.3K24 24 300 INITIALIZE RUN.COM ;
: 0.3K25 25 300 INITIALIZE RUN.COM ;
: 0.3K26 26 300 INITIALIZE RUN.COM ;
: 0.3K27 27 300 INITIALIZE RUN.COM ;
: 0.3K28 28 300 INITIALIZE RUN.COM ;
: 0.3K29 29 300 INITIALIZE RUN.COM ;
: 0.3K30 30 300 INITIALIZE RUN.COM ;
: 0.3K31 31 300 INITIALIZE RUN.COM ;
: 0.3K32 32 300 INITIALIZE RUN.COM ;
: 0.6K17 17 600 INITIALIZE RUN.COM ;
: 0.6K18 18 600 INITIALIZE RUN.COM ;
: 0.6K19 19 600 INITIALIZE RUN.COM ;
: 0.6K20 20 600 INITIALIZE RUN.COM ;
: 0.6K21 21 600 INITIALIZE RUN.COM ;
: 0.6K22 22 600 INITIALIZE RUN.COM ;
: 0.6K23 23 600 INITIALIZE RUN.COM ;
: 0.6K24 24 600 INITIALIZE RUN.COM ;
: 0.6K25 25 600 INITIALIZE RUN.COM ;
: 0.6K26 26 600 INITIALIZE RUN.COM ;
: 0.6K27 27 600 INITIALIZE RUN.COM ;
: 0.6K28 28 600 INITIALIZE RUN.COM ;
: 0.6K29 29 600 INITIALIZE RUN.COM ;
: 0.6K30 30 600 INITIALIZE RUN.COM ;
: 0.6K31 31 600 INITIALIZE RUN.COM ;
: 0.6K32 32 600 INITIALIZE RUN.COM ;
: 1.2K17 17 1200 INITIALIZE RUN.COM ;
: 1.2K18 18 1200 INITIALIZE RUN.COM ;
: 1.2K19 19 1200 INITIALIZE RUN.COM ;
: 1.2K20 20 1200 INITIALIZE RUN.COM ;
: 1.2K21 21 1200 INITIALIZE RUN.COM ;
: 1.2K22 22 1200 INITIALIZE RUN.COM ;
: 1.2K23 23 1200 INITIALIZE RUN.COM ;
: 1.2K24 24 1200 INITIALIZE RUN.COM ;
: 1.2K25 25 1200 INITIALIZE RUN.COM ;
: 1.2K26 26 1200 INITIALIZE RUN.COM ;
: 1.2K27 27 1200 INITIALIZE RUN.COM ;
: 1.2K28 28 1200 INITIALIZE RUN.COM ;
: 1.2K29 29 1200 INITIALIZE RUN.COM ;
: 1.2K30 30 1200 INITIALIZE RUN.COM ;
: 1.2K31 31 1200 INITIALIZE RUN.COM ;
: 1.2K32 32 1200 INITIALIZE RUN.COM ;
: 2.4K17 17 2400 INITIALIZE RUN.COM ;
: 2.4K18 18 2400 INITIALIZE RUN.COM ;
: 2.4K19 19 2400 INITIALIZE RUN.COM ;
: 2.4K20 20 2400 INITIALIZE RUN.COM ;
: 2.4K21 21 2400 INITIALIZE RUN.COM ;
: 2.4K22 22 2400 INITIALIZE RUN.COM ;
: 2.4K23 23 2400 INITIALIZE RUN.COM ;
: 2.4K24 24 2400 INITIALIZE RUN.COM ;
: 2.4K25 25 2400 INITIALIZE RUN.COM ;
: 2.4K26 26 2400 INITIALIZE RUN.COM ;
: 2.4K27 27 2400 INITIALIZE RUN.COM ;
: 2.4K28 28 2400 INITIALIZE RUN.COM ;
: 2.4K29 29 2400 INITIALIZE RUN.COM ;
: 2.4K30 30 2400 INITIALIZE RUN.COM ;
: 2.4K31 31 2400 INITIALIZE RUN.COM ;
: 2.4K32 32 2400 INITIALIZE RUN.COM ;
: 4.8K17 17 4800 INITIALIZE RUN.COM ;
: 4.8K18 18 4800 INITIALIZE RUN.COM ;
: 4.8K19 19 4800 INITIALIZE RUN.COM ;
: 4.8K20 20 4800 INITIALIZE RUN.COM ;
: 4.8K21 21 4800 INITIALIZE RUN.COM ;
: 4.8K22 22 4800 INITIALIZE RUN.COM ;
: 4.8K23 23 4800 INITIALIZE RUN.COM ;
: 4.8K24 24 4800 INITIALIZE RUN.COM ;
: 4.8K25 25 4800 INITIALIZE RUN.COM ;
: 4.8K26 26 4800 INITIALIZE RUN.COM ;
: 4.8K27 27 4800 INITIALIZE RUN.COM ;
: 4.8K28 28 4800 INITIALIZE RUN.COM ;
: 4.8K29 29 4800 INITIALIZE RUN.COM ;
: 4.8K30 30 4800 INITIALIZE RUN.COM ;
: 4.8K31 31 4800 INITIALIZE RUN.COM ;
: 4.8K32 32 4800 INITIALIZE RUN.COM ;
: 9.6K17 17 9600 INITIALIZE RUN.COM ;
: 9.6K18 18 9600 INITIALIZE RUN.COM ;
: 9.6K19 19 9600 INITIALIZE RUN.COM ;
: 9.6K20 20 9600 INITIALIZE RUN.COM ;
: 9.6K21 21 9600 INITIALIZE RUN.COM ;
: 9.6K22 22 9600 INITIALIZE RUN.COM ;
: 9.6K23 23 9600 INITIALIZE RUN.COM ;
: 9.6K24 24 9600 INITIALIZE RUN.COM ;
: 9.6K25 25 9600 INITIALIZE RUN.COM ;
: 9.6K26 26 9600 INITIALIZE RUN.COM ;
: 9.6K27 27 9600 INITIALIZE RUN.COM ;
: 9.6K28 28 9600 INITIALIZE RUN.COM ;
: 9.6K29 29 9600 INITIALIZE RUN.COM ;
: 9.6K30 30 9600 INITIALIZE RUN.COM ;
: 9.6K31 31 9600 INITIALIZE RUN.COM ;
: 9.6K32 32 9600 INITIALIZE RUN.COM ;
: 19.2K17 17 19200 INITIALIZE RUN.COM ;
: 19.2K18 18 19200 INITIALIZE RUN.COM ;
: 19.2K19 19 19200 INITIALIZE RUN.COM ;
: 19.2K20 20 19200 INITIALIZE RUN.COM ;
: 19.2K21 21 19200 INITIALIZE RUN.COM ;
: 19.2K22 22 19200 INITIALIZE RUN.COM ;
: 19.2K23 23 19200 INITIALIZE RUN.COM ;
: 19.2K24 24 19200 INITIALIZE RUN.COM ;
: 19.2K25 25 19200 INITIALIZE RUN.COM ;
: 19.2K26 26 19200 INITIALIZE RUN.COM ;
: 19.2K27 27 19200 INITIALIZE RUN.COM ;
: 19.2K28 28 19200 INITIALIZE RUN.COM ;
: 19.2K29 29 19200 INITIALIZE RUN.COM ;
: 19.2K30 30 19200 INITIALIZE RUN.COM ;
: 19.2K31 31 19200 INITIALIZE RUN.COM ;
: 19.2K32 32 19200 INITIALIZE RUN.COM ;
: 38.4K17 17 38400 INITIALIZE RUN.COM ;
: 38.4K18 18 38400 INITIALIZE RUN.COM ;
: 38.4K19 19 38400 INITIALIZE RUN.COM ;
: 38.4K20 20 38400 INITIALIZE RUN.COM ;
: 38.4K21 21 38400 INITIALIZE RUN.COM ;
: 38.4K22 22 38400 INITIALIZE RUN.COM ;
: 38.4K23 23 38400 INITIALIZE RUN.COM ;
: 38.4K24 24 38400 INITIALIZE RUN.COM ;
: 38.4K25 25 38400 INITIALIZE RUN.COM ;
: 38.4K26 26 38400 INITIALIZE RUN.COM ;
: 38.4K27 27 38400 INITIALIZE RUN.COM ;
: 38.4K28 28 38400 INITIALIZE RUN.COM ;
: 38.4K29 29 38400 INITIALIZE RUN.COM ;
: 38.4K30 30 38400 INITIALIZE RUN.COM ;
: 38.4K31 31 38400 INITIALIZE RUN.COM ;
: 38.4K32 32 38400 INITIALIZE RUN.COM ;
: 57.6K17 17 57600 INITIALIZE RUN.COM ;
: 57.6K18 18 57600 INITIALIZE RUN.COM ;
: 57.6K19 19 57600 INITIALIZE RUN.COM ;
: 57.6K20 20 57600 INITIALIZE RUN.COM ;
: 57.6K21 21 57600 INITIALIZE RUN.COM ;
: 57.6K22 22 57600 INITIALIZE RUN.COM ;
: 57.6K23 23 57600 INITIALIZE RUN.COM ;
: 57.6K24 24 57600 INITIALIZE RUN.COM ;
: 57.6K25 25 57600 INITIALIZE RUN.COM ;
: 57.6K26 26 57600 INITIALIZE RUN.COM ;
: 57.6K27 27 57600 INITIALIZE RUN.COM ;
: 57.6K28 28 57600 INITIALIZE RUN.COM ;
: 57.6K29 29 57600 INITIALIZE RUN.COM ;
: 57.6K30 30 57600 INITIALIZE RUN.COM ;
: 57.6K31 31 57600 INITIALIZE RUN.COM ;
: 57.6K32 32 57600 INITIALIZE RUN.COM ;
: 115.2K17 17 115200 INITIALIZE RUN.COM ;
: 115.2K18 18 115200 INITIALIZE RUN.COM ;
: 115.2K19 19 115200 INITIALIZE RUN.COM ;
: 115.2K20 20 115200 INITIALIZE RUN.COM ;
: 115.2K21 21 115200 INITIALIZE RUN.COM ;
: 115.2K22 22 115200 INITIALIZE RUN.COM ;
: 115.2K23 23 115200 INITIALIZE RUN.COM ;
: 115.2K24 24 115200 INITIALIZE RUN.COM ;
: 115.2K25 25 115200 INITIALIZE RUN.COM ;
: 115.2K26 26 115200 INITIALIZE RUN.COM ;
: 115.2K27 27 115200 INITIALIZE RUN.COM ;
: 115.2K28 28 115200 INITIALIZE RUN.COM ;
: 115.2K29 29 115200 INITIALIZE RUN.COM ;
: 115.2K30 30 115200 INITIALIZE RUN.COM ;
: 115.2K31 31 115200 INITIALIZE RUN.COM ;
: 115.2K32 32 115200 INITIALIZE RUN.COM ;
: 115K17 17 115200 INITIALIZE RUN.COM ;
: 115K18 18 115200 INITIALIZE RUN.COM ;
: 115K19 19 115200 INITIALIZE RUN.COM ;
: 115K20 20 115200 INITIALIZE RUN.COM ;
: 115K21 21 115200 INITIALIZE RUN.COM ;
: 115K22 22 115200 INITIALIZE RUN.COM ;
: 115K23 23 115200 INITIALIZE RUN.COM ;
: 115K24 24 115200 INITIALIZE RUN.COM ;
: 115K25 25 115200 INITIALIZE RUN.COM ;
: 115K26 26 115200 INITIALIZE RUN.COM ;
: 115K27 27 115200 INITIALIZE RUN.COM ;
: 115K28 28 115200 INITIALIZE RUN.COM ;
: 115K29 29 115200 INITIALIZE RUN.COM ;
: 115K30 30 115200 INITIALIZE RUN.COM ;
: 115K31 31 115200 INITIALIZE RUN.COM ;
: 115K32 32 115200 INITIALIZE RUN.COM ;
: 128K17 17 128000 INITIALIZE RUN.COM ;
: 128K18 18 128000 INITIALIZE RUN.COM ;
: 128K19 19 128000 INITIALIZE RUN.COM ;
: 128K20 20 128000 INITIALIZE RUN.COM ;
: 128K21 21 128000 INITIALIZE RUN.COM ;
: 128K22 22 128000 INITIALIZE RUN.COM ;
: 128K23 23 128000 INITIALIZE RUN.COM ;
: 128K24 24 128000 INITIALIZE RUN.COM ;
: 128K25 25 128000 INITIALIZE RUN.COM ;
: 128K26 26 128000 INITIALIZE RUN.COM ;
: 128K27 27 128000 INITIALIZE RUN.COM ;
: 128K28 28 128000 INITIALIZE RUN.COM ;
: 128K29 29 128000 INITIALIZE RUN.COM ;
: 128K30 30 128000 INITIALIZE RUN.COM ;
: 128K31 31 128000 INITIALIZE RUN.COM ;
: 128K32 32 128000 INITIALIZE RUN.COM ;
: 230K17 17 230000 INITIALIZE RUN.COM ;
: 230K18 18 230000 INITIALIZE RUN.COM ;
: 230K19 19 230000 INITIALIZE RUN.COM ;
: 230K20 20 230000 INITIALIZE RUN.COM ;
: 230K21 21 230000 INITIALIZE RUN.COM ;
: 230K22 22 230000 INITIALIZE RUN.COM ;
: 230K23 23 230000 INITIALIZE RUN.COM ;
: 230K24 24 230000 INITIALIZE RUN.COM ;
: 230K25 25 230000 INITIALIZE RUN.COM ;
: 230K26 26 230000 INITIALIZE RUN.COM ;
: 230K27 27 230000 INITIALIZE RUN.COM ;
: 230K28 28 230000 INITIALIZE RUN.COM ;
: 230K29 29 230000 INITIALIZE RUN.COM ;
: 230K30 30 230000 INITIALIZE RUN.COM ;
: 230K31 31 230000 INITIALIZE RUN.COM ;
: 230K32 32 230000 INITIALIZE RUN.COM ;
: 256K17 17 256000 INITIALIZE RUN.COM ;
: 256K18 18 256000 INITIALIZE RUN.COM ;
: 256K19 19 256000 INITIALIZE RUN.COM ;
: 256K20 20 256000 INITIALIZE RUN.COM ;
: 256K21 21 256000 INITIALIZE RUN.COM ;
: 256K22 22 256000 INITIALIZE RUN.COM ;
: 256K23 23 256000 INITIALIZE RUN.COM ;
: 256K24 24 256000 INITIALIZE RUN.COM ;
: 256K25 25 256000 INITIALIZE RUN.COM ;
: 256K26 26 256000 INITIALIZE RUN.COM ;
: 256K27 27 256000 INITIALIZE RUN.COM ;
: 256K28 28 256000 INITIALIZE RUN.COM ;
: 256K29 29 256000 INITIALIZE RUN.COM ;
: 256K30 30 256000 INITIALIZE RUN.COM ;
: 256K31 31 256000 INITIALIZE RUN.COM ;
: 256K32 32 256000 INITIALIZE RUN.COM ;
: _oo ( -- ) port? @ BAUD.RATE? @ ( 2dup SET.com.port,BAUD.RATE ) INITIALIZE RUN.COM ;
' _oo is oo
HEX
: [0~F>ASC] ( N ... N1 ) >R
R@ 0 9 BETWEEN
IF R> 30 +
ELSE R@ 0A 0F BETWEEN
IF R> 37 +
ELSE R>
THEN
THEN ;
: XX>232 10 /MOD [0~F>ASC] COMnEMIT [0~F>ASC] COMnEMIT 0D COMnEMIT ;
: XXXX>232 10 /MOD 10 /MOD 10 /MOD
[0~F>ASC] COMnEMIT [0~F>ASC] COMnEMIT [0~F>ASC] COMnEMIT [0~F>ASC] COMnEMIT 0D COMnEMIT ;
CREATE "BUFFER 9 ALLOT
: NUMBER>STRING ( N ... ADDR LENGTH ) \ STRING == ADDR LENGTH
8 0 DO BASE @ /MOD LOOP 9 0 DO [0~F>ASC] I "BUFFER + C! LOOP "BUFFER 9 0 -TRAILCHARS ;
: NUMBER>STRING(9) ( N ... ADDR LENGTH ) \ STRING == ADDR LENGTH
DUP 0<
IF '-' "BUFFER C! ABS
8 0 DO BASE @ /MOD LOOP 9 0 DO [0~F>ASC] I 1+ "BUFFER + C! LOOP "BUFFER 9 0 -TRAILCHARS
ELSE 8 0 DO BASE @ /MOD LOOP 9 0 DO [0~F>ASC] I "BUFFER + C! LOOP "BUFFER 9 0 -TRAILCHARS
THEN ;
DEFER _STRING.with.LEADING.0.REMOVED
: NUMBER>STRING ( N ... ADDR LENGTH ) DUP>R ABS \ STRING == ADDR LENGTH
8 0 DO BASE @ /MOD LOOP 9 0 DO [0~F>ASC] I "BUFFER + C! LOOP "BUFFER 9 0 -TRAILCHARS
_STRING.with.LEADING.0.REMOVED
R> 0<
IF 2DUP OVER DUP>R 1+ SWAP CMOVE> '-' R> C! 1+
THEN ;
\ ' NUMBER>STRING IS _NUMBER>STRING
VARIABLE STRING>NUMBER.CORRECT?
\ : STRING>NUMBER ( ADDR LENGTH ... N -1 / 0 ) 0 -ROT \ STRING == ADDR LENGTH
\ BOUNDS -1 STRING>NUMBER.CORRECT? ! \ 5 31 32 33 34 35 12345
\ DO BASE @ * I C@ BASE @ DIGIT \ |___addr
\ IF +
\ ELSE DROP 0 STRING>NUMBER.CORRECT? ! LEAVE
\ THEN
\ LOOP STRING>NUMBER.CORRECT? @ ; \ IF ( BASE @ / ) -1 ELSE DROP 0 THEN ;
VARIABLE 0x?
: STRING.with.LEADING.BLANK.REMOVED ( ADDR LENGTH ... ADDR1 LENGTH1 ) DUP>R DUP 0
?DO OVER I + C@ 20 <> ( BLANK=20h )
IF LEAVE
THEN 1-
LOOP R> OVER - ROT + SWAP DUP 0= IF DROP 1- 1 THEN ;
\ ' STRING.WITH.LEADING.BLANK.REMOVED _STRING.WITH.LEADING.BLANK.REMOVED
VARIABLE '+'.PRECEEDED
VARIABLE '-'.PRECEEDED
: CHECK.+/- ( ADDR LENGTH ... ADDR1 LENGTH1 ) '+'.PRECEEDED OFF '-'.PRECEEDED OFF
>R >R R@ C@
CASE '-' OF '-'.PRECEEDED ON -1 ENDOF
'+' OF '+'.PRECEEDED ON -1 ENDOF
0 SWAP
ENDCASE
IF R> 1+ R> 1-
ELSE R> R>
THEN ;
DEFER _STRING.with.LEADING.BLANK.REMOVED
: STRING>NUMBER ( ADDR LENGTH ... N -1 / N 0 ) -TRAILING _STRING.with.LEADING.BLANK.REMOVED CHECK.+/-
0 -ROT \ STRING == ADDR LENGTH
BOUNDS -1 STRING>NUMBER.CORRECT? ! \ 5 31 32 33 34 35 12345
DO 0x? @
IF 10 * I C@ 10
ELSE BASE @ * I C@ BASE @
THEN DIGIT \ |___addr
IF +
ELSE DROP ( 2DROP ) 0 STRING>NUMBER.CORRECT? ! LEAVE
THEN
LOOP STRING>NUMBER.CORRECT? @ 0 0x? !
DUP
IF '-'.PRECEEDED @
IF SWAP NEGATE SWAP
THEN
THEN ; \ IF ( BASE @ / ) -1 ELSE DROP 0 THEN ;
VARIABLE DELAY.STRING>232 30 DELAY.STRING>232 !
: DS232 ( N ... ) DELAY.STRING>232 ! ;
: STRING>232 BOUNDS DO I C@ COMnEMIT DELAY.STRING>232 @ MS LOOP 0D COMnEMIT ;
DEFER _$>232
' STRING>232 IS _$>232
: NUMBER>232 NUMBER>STRING STRING>232 ;
: 232." STATE @
IF COMPILE EXI COMPILE INI COMPILE (S") ," COMPILE STRING>232
ELSE EXI INI 22 WORD NEW$ DUP>R OVER C@ 1+ MOVE R> COUNT STRING>232
THEN ; IMMEDIATE
\ include 1CellStack.f
\ ******************************************************************************
\ ONE CELL STACK for temperary storing the address of >1, >2, >3... etc.
: >ADDR.OF.REAL.VALUE.IN.VARIBLE ( CFA ... ADDR ) 4 + ;
2VARIABLE (#1)
2VARIABLE (#2)
2VARIABLE (#3)
2VARIABLE (#4)
2VARIABLE (#5)
2VARIABLE (#6)
2VARIABLE (#7)
2VARIABLE (#8)
2VARIABLE (#9)
2VARIABLE (#10)
2VARIABLE (#11)
2VARIABLE (#12)
2VARIABLE (#13)
2VARIABLE (#14)
2VARIABLE (#15)
2VARIABLE (#16)
2VARIABLE (#17)
2VARIABLE (#18)
2VARIABLE (#19)
2VARIABLE (#20)
2VARIABLE (#21)
2VARIABLE (#22)
2VARIABLE (#23)
2VARIABLE (#24)
: CHECK.COMSUMED ( CFA ... VALUE.ADDR ) DUP >R \ 1 cell stack
>ADDR.OF.REAL.VALUE.IN.VARIBLE DUP 2@
IF R> >NAME .ID -1 ABORT" hasn't comsumed yet! "
ELSE DROP R> DROP -1 SWAP 2!
THEN ;
: CHECK.RESOLVE ( CFA ... ADDR' VALUE.ADDR ) DUP >R \ 1 cell stack
>ADDR.OF.REAL.VALUE.IN.VARIBLE DUP 2@
IF R> DROP DUP @ ROT 0 SWAP 2!
ELSE R> >NAME .ID -1 ABORT" has been resolved already! "
THEN ;
\ INTERACTIVE MODE STACK 1 LEVEL ONLY
: >1 ['] (#1) CHECK.COMSUMED ; \ ( ADDR' ... )
: >2 ['] (#2) CHECK.COMSUMED ; \ ( ADDR' ... )
: >3 ['] (#3) CHECK.COMSUMED ; \ ( ADDR' ... )
: >4 ['] (#4) CHECK.COMSUMED ; \ ( ADDR' ... )
: >5 ['] (#5) CHECK.COMSUMED ; \ ( ADDR' ... )
: >6 ['] (#6) CHECK.COMSUMED ; \ ( ADDR' ... )
: >7 ['] (#7) CHECK.COMSUMED ; \ ( ADDR' ... )
: >8 ['] (#8) CHECK.COMSUMED ; \ ( ADDR' ... )
: >9 ['] (#9) CHECK.COMSUMED ; \ ( ADDR' ... )
: >10 ['] (#10) CHECK.COMSUMED ; \ ( ADDR' ... )
: >11 ['] (#11) CHECK.COMSUMED ; \ ( ADDR' ... )
: >12 ['] (#12) CHECK.COMSUMED ; \ ( ADDR' ... )
: >13 ['] (#13) CHECK.COMSUMED ; \ ( ADDR' ... )
: >14 ['] (#14) CHECK.COMSUMED ; \ ( ADDR' ... )
: >15 ['] (#15) CHECK.COMSUMED ; \ ( ADDR' ... )
: >16 ['] (#16) CHECK.COMSUMED ; \ ( ADDR' ... )
: >17 ['] (#17) CHECK.COMSUMED ; \ ( ADDR' ... )
: >18 ['] (#18) CHECK.COMSUMED ; \ ( ADDR' ... )
: >19 ['] (#19) CHECK.COMSUMED ; \ ( ADDR' ... )
: >20 ['] (#10) CHECK.COMSUMED ; \ ( ADDR' ... )
: >21 ['] (#11) CHECK.COMSUMED ; \ ( ADDR' ... )
: >22 ['] (#12) CHECK.COMSUMED ; \ ( ADDR' ... )
: >23 ['] (#13) CHECK.COMSUMED ; \ ( ADDR' ... )
: >24 ['] (#14) CHECK.COMSUMED ; \ ( ADDR' ... )
: 1> ['] (#1) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
: 2> ['] (#2) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
: 3> ['] (#3) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
: 4> ['] (#4) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
: 5> ['] (#5) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
: 6> ['] (#6) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
: 7> ['] (#7) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
: 8> ['] (#8) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
: 9> ['] (#9) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
: 10> ['] (#10) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
: 11> ['] (#11) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
: 12> ['] (#12) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
: 13> ['] (#13) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
: 14> ['] (#14) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
: 15> ['] (#15) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
: 16> ['] (#16) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
: 17> ['] (#17) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
: 18> ['] (#18) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
: 19> ['] (#19) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
: 20> ['] (#20) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
: 21> ['] (#21) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
: 22> ['] (#22) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
: 23> ['] (#23) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
: 24> ['] (#24) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
\ ******************************************************************************
: SET.com.port,BAUD.RATE ( PORT baud.rate -- )
over 1 20 ( 7 ) between not abort" com port 1 ~ 32 only "
BAUD.RATE PORT ;
CODE FLIP ( 1234 -- 3412 ) XCHG BH, BL NEXT C;
CREATE cp0' 10000 ALLOT \ 64k byte
VARIABLE cp' 0 cp' !
: HERE' cp' @ ;
: ORG cp' ! ;
: ALLOT' cp' +! ;
\ --------------------------
: 16! >R 0FFFF AND 100 /MOD R@ 1+ C! R> C! ; \ high order number at high address \ little endian
: C@' cp0' + C@ ; : 8@' c@' ;
: C!' cp0' + C! ; : 8!' c!' ;
: !' cp0' + 16! ; : 16!' !' ;
: @' DUP C@' SWAP 1+ C@' 100 * OR ; : 16@' @' ;
: +!' ( N ADDR' ... ) >R R@ @' + R> !' ;
: C+!' ( BYTE ADDR' ... ) >R R@ C@' + R> C!' ;
: 32@^ cp0' + @ ; \ 0~7 8~15 16~23 24~31
: 24@^ 32@^ 0ffffff and ;
: 16@^ 32@^ 0ffff and ;
: 32@' cp0' + @ ; \ 0~7 8~15 16~23 24~31
: 24@' 32@' 0ffffff and ; \ 0~7 8~15 16~23
: 16@' 32@' 0ffff and ; \ 0~7 8~15
: 8@' 32@' 0ff and ; \ 0~7
: 16!' !' ; \ 0~7 8~15 ( L H )
: 8!' c!' ; \ 0~7
: @^ 16@' flip ;
: 16@^ 16@' flip ; \ low order number at high address
: !^ >r flip r> 16!' ;
: 16!^ >r flip r> 16!' ; \ low order number at high address
: @'n @' F1ff and ; \ special usage of rb=x
: C,' ( BYTE ... ) HERE' C!' 1 ALLOT' ; : 8,' C,' ;
: ,' ( n .. ... ) HERE' !' 2 ALLOT' ; : 16,' ,' ;
: ,^ ( n ...... ) flip HERE' !' 2 ALLOT' ; \ : 16,' ,' ;
: 16,^ ( 16bit... ) HERE' 16!^ 2 ALLOT' ;
: cmove' ( from' to' length -- ) 0 ?do over i + c@' over i + c!' loop 2drop ;
: CFA>CFA' ( CFA ... CFA' ) 4 + @ ;
: >CFA' ( CFA ... CFA' ) 4 + @ ; \ ' CR' >CFA' == 386
: CFA'.OF' ' CFA>CFA' ;
: [CFA'.OF] ' CFA>CFA' [COMPILE] LITERAL ; IMMEDIATE
: CFA'.OF STATE @ IF ['] [CFA'.OF] EXECUTE else CFA'.OF' THEN ; IMMEDIATE \ ????
: '' STATE @ IF ['] [CFA'.OF] EXECUTE else CFA'.OF' THEN ; IMMEDIATE \ ????
VARIABLE 2nd.number
defer _disassem.number.stack> \ behaving like r>
defer _>disassem.number.stack \ behaving like >r
variable last.char
\ -------------------
: u.| ( n -- ) 0 (D.) TYPE ;
: u.| ( n -- ) ffff and 0 (D.) TYPE ; \ msp430 16 bit system
: 0u.| ( n -- ) dup 0a 0f between if '0' emit then
dup 0a0 0ff between if '0' emit then u.| ;
: check.b=1.or.not ( a' -- f ) >r
r@ 16@' f000 and 4000 f000 between
if -1
else r@ 16@' ff80 and
case 1000 of -1 endof
1100 of -1 endof
1200 of -1 endof
0 swap
endcase
then r>drop ;
variable .b=1?
: .b=1 .b=1? @ if ." b=1" then ;
: (1")0 do i c@ emit loop .b=1 ;
: (2")0 do i c@ emit loop .b=1 ;
: (3")0 do i c@ emit loop .b=1 ;
: (4")0 do i c@ emit loop .b=1 ;
variable Virtue.Forth?
: emit.vf.register ( n -- f )
case 0 of ." pc" -1 endof
1 of ." sp" -1 endof
2 of ." sr" -1 endof
3 of ." cg" -1 endof
4 of ." w" -1 endof
5 of ." fsp" -1 endof
6 of ." frp" -1 endof
7 of ." W" -1 endof
8 of ." X" -1 endof
9 of ." Y" -1 endof
0a of ." T" -1 endof
0b of ." U" -1 endof
0c of ." V" -1 endof
0d of ." P" -1 endof
0e of ." M" -1 endof
0f of ." Q" -1 endof
0 swap
endcase ;
\ ******** lower letter r will be neglected. **********
defer _emit.port.name ( a' -- )
defer _emit.port.name' ( a' -- )
: (1")1 \ ((")) COUNT bounds last.char off
do i c@ 'R' =
if Virtue.Forth? @ if _disassem.number.stack> emit.vf.register drop
else 'R' emit _disassem.number.stack> u.| \ R16 R8 === R1234 R56
then
else i c@ '#' =
if _disassem.number.stack> dup 0u.| _emit.port.name \ #
else i c@ emit \ =F0123456
then
then
loop .b=1 ;
variable c.type?
: (n")1 ( u l -- )
do i c@ 'R' =
if Virtue.Forth? @
if emit.vf.register drop
else 'R' emit u.| \ R16 R8 === R1234 R56
then
else i c@ '#' =
if dup c.type? @
if _emit.port.name' if drop else 0u.| then
else 0u.| _emit.port.name
then \ 0u.| \ #
else i c@ emit \ =F0123456
then
then
loop .b=1 ;
\ (1")1 _disassem.number.stack> -rot (n")1 ;
: (2")1 _disassem.number.stack> _disassem.number.stack> 2swap (n")1 ;
: (3")1 _disassem.number.stack> _disassem.number.stack> _disassem.number.stack> >r 2swap r> -rot (n")1 ;
: (4")1 _disassem.number.stack> _disassem.number.stack> _disassem.number.stack> _disassem.number.stack> 2rot (n")1 ;
: ?y ( x -) getxy nip gotoxy ;
: 24y 24 ?y ;
: 2ay 2a ?y ;
: 2cy 2c ?y ;
: 31y 31 ?y ;
: 2fy 2f ?y ;
: 30y 30 ?y ;
: 34y 34 ?y ;
: 38y 38 ?y ;
: 3cy 3c ?y ;
: 3ey 3e ?y ;
: 3fy 3f ?y ;
: 40y 40 ?y ;
variable h.mode
: (1") 3fy ((")) COUNT bounds last.char off
h.mode @
case
0 of (1")0 endof
1 of (1")1 endof
endcase ;
: (2") 3fy ((")) COUNT bounds last.char off
h.mode @
case
0 of (2")0 endof
1 of (2")1 endof
endcase ;
: (3") 3fy ((")) COUNT bounds last.char off
h.mode @
case
0 of (3")0 endof
1 of (3")1 endof
endcase ;
: (4") 3fy ((")) COUNT bounds last.char off
h.mode @
case
0 of (4")0 endof
1 of (4")1 endof
endcase ;
: 1" COMPILE (1") ," ; IMMEDIATE
: 2" COMPILE (2") ," ; IMMEDIATE
: 3" COMPILE (3") ," ; IMMEDIATE
: 4" COMPILE (4") ," ; IMMEDIATE
\ --------------------------
VARIABLE OUT.MODE 8 OUT.MODE !
: .X ( N ... ) 0 <# # #> TYPE ;
: .XX ( N ... ) 0 <# # # #> TYPE ;
: .XXX ( N ... ) 0 <# # # # #> TYPE ;
: .XXXX ( N ... ) 0 <# # # # # #> TYPE ;
: .XXXXx ( N ... ) 0 <# # # # # # #> TYPE ;
: .XXXXxx ( N ... ) 0 <# # # # # # # #> TYPE ;
: .XXXXxxx ( N ... ) 0 <# # # # # # # # #> TYPE ;
: .XXXXxxxx ( N ... ) 0 <# # # # # # # # # #> TYPE ;
: .0XX ( N ... ) DUP $0A0 $0FF BETWEEN IF $30 EMIT ELSE SPACE THEN .XX ; \ 0a0 7f
: .?XX(h) ( N ... ) dup 2nd.number ! h.mode @ 0<> if drop 3 spaces exit then
DUP 0 9 BETWEEN if 4 spaces .x 50 ?y exit then \ 9
DUP $0A $9f BETWEEN if 3 spaces .xx 50 ?y exit then \ 0a
DUP $0A0 $0ff BETWEEN if 2 spaces '0' emit then .xx 50 ?y ; \ 0a0
: .xxxx(h) h.mode @ 0<> if drop exit then .xxxx ;
: .xxxx(h) h.mode @ 0<> if drop 50 ?y exit then
dup 0a 0f between if 3 spaces '0' emit .x 50 ?y exit then
dup 0a0 0ff between if 2 spaces '0' emit .xx 50 ?y exit then
dup 0a00 0fff between if space '0' emit .xxx 50 ?y exit then
0ffff and 5 u.r 50 ?y ;
VARIABLE SUM
: .XX+SUM DUP SUM +! .XX ;
: U> SWAP U< ;
: .XX+SUM DUP SUM +! .XX ;
: >A.LINE.OF.HEX.FORMAT ( ADDR LENGTH ... )
?DUP
IF CR 0 SUM ! 3A EMIT DUP .XX+SUM
OVER 100 /MOD .XX+SUM .XX+SUM
0 .XX
BOUNDS
DO I C@' .XX+SUM
LOOP 100 SUM C@ - .XX
ELSE DROP
THEN ;
: >HEX' ( FROM LENGTH ... ) \ CLS
BEGIN DUP 10 U>
WHILE OVER 10 >A.LINE.OF.HEX.FORMAT
10 - SWAP 10 + SWAP
REPEAT >A.LINE.OF.HEX.FORMAT ;
: >HEX ( CLS ) >HEX' CR ." :00000001FF" cr KEY DROP ;
: HEX> ( ... ) CR ." *** please enter ???.HEX file *** "
BEGIN
BEGIN KEY 3A ( : ) =
UNTIL \ cr
KEY 10 DIGIT DROP 10 * KEY 10 DIGIT DROP + >R ( LENGTH )
KEY 10 DIGIT DROP 10 * KEY 10 DIGIT DROP + 10 * ( ADDR H )
KEY 10 DIGIT DROP + 10 * KEY 10 DIGIT DROP + ( ADDR L )
KEY 10 DIGIT DROP 10 * KEY 10 DIGIT DROP + DROP ( RECORD )
R@
IF R> 0
DO DUP I + KEY 10 DIGIT DROP 10 * KEY 10 DIGIT DROP + SWAP CP0' + C!
LOOP DROP 0
ELSE R> 2DROP DROP -1
THEN
UNTIL QUIT ;
: >HEXX' ( FROM LENGTH ... ) CLS
BEGIN DUP 20 U>
WHILE OVER 20 >A.LINE.OF.HEX.FORMAT
20 - SWAP 20 + SWAP
REPEAT >A.LINE.OF.HEX.FORMAT ;
: >HEXXX' ( FROM LENGTH ... ) CLS
BEGIN DUP 30 U>
WHILE OVER 30 >A.LINE.OF.HEX.FORMAT
30 - SWAP 30 + SWAP
REPEAT >A.LINE.OF.HEX.FORMAT ;
: >HEXXXX' ( FROM LENGTH ... ) CLS
BEGIN DUP 38 U>
WHILE OVER 38 >A.LINE.OF.HEX.FORMAT
38 - SWAP 38 + SWAP
REPEAT >A.LINE.OF.HEX.FORMAT ;
: >HEXX >HEXX' CR ." :00000001FF" KEY DROP ;
: >HEXXX >HEXXX' CR ." :00000001FF" KEY DROP ;
: >HEXXXX >HEXXXX' CR ." :00000001FF" KEY DROP ;
\ ------------
: >db ( from length -- ) cr over ." ORG 0x" .xxxx 0
do i 10 mod 0= if 8 emit space cr ." DB " then
dup i + c@' ." 0x" .xx ',' emit
loop 8 emit space drop cr ." END" quit ;
: >TI ( from length -- ) cls cr over ." @" .xxxx 0
do i 10 mod 0= if cr then
dup i + c@' .xx space
loop drop cr ." q" quit ;
\ ------------
\ from iPn
anew Buffer_To_Hex
: display.error.message ( message.addr length --- ) ErrorBox ;
: open.file ( file.head.seres.number --- )
close-file 0 <>
if
s" open.file.fail!" display.error.message
then
;
: new.file ( file.name.location file.name.length file.attribute --- file.head.seres.number )
rot rot drop 1 - swap
2dup
swap count rot
open-file 0 <>
if
drop
swap count rot
create-file 0 <>
if
s" new.file.fail!" display.error.message
then
else
rot rot 2drop
then
;
: write.file ( start.addr length file.head.seres.number --- )
write-file 0 <>
if
s" write.file.fail!" display.error.message bye
then
;
decimal
0 value fhd
DEFER _new.file
DEFER _write.file
DEFER _open.file
' new.file IS _new.file
' write.file IS _write.file
' open.file IS _open.file
create buf 1024 allot
: Buffer_To_Hex ( --- )
hex
s" xxx.hex" R/W new.file to fhd
1024 0 do
buf i + c@ s>d <# # # #> fhd write.file
\ crlf$ count fhd write.file
loop fhd open.file DECIMAL ;
: demo
cls
11 buf 1 + c!
22 buf 2 + c!
33 buf 3 + c!
buf 20 dump
Buffer_To_Hex ;
: demo1
cls
44 buf 4 + c!
55 buf 5 + c!
66 buf 6 + c!
buf 20 dump
Buffer_To_Hex ;
: DATA>HEX.FILE ( DATA ... ) BASE @ >R hex s>d <# # # #> fhd write.file R> BASE ! ;
hex
: 8K>Hex ( --- ) hex
s" xxx.hex" R/W new.file to fhd
2000 0
do I 20 MOD 0 = IF CRLF$ count fhd write.file THEN
i c@' s>d <# # # #> fhd write.file
loop fhd open.file ;
: crlf>file crlf$ count fhd write.file ;
: .xx' ( n ... ) s>d <# # # #> fhd write.file ( write.file ) ;
: .XX+SUM' DUP SUM +! .XX' ;
: >A.LINE.OF.HEX.FORMAT' ( ADDR LENGTH ... )
?DUP
IF ( crlf>file ) 0 SUM ! ( 3A EMIT ) s" :" fhd write.file DUP .XX+SUM'
OVER 100 /MOD .XX+SUM' .XX+SUM'
0 .XX'
BOUNDS
DO I C@' .XX+SUM'
LOOP 100 SUM C@ - .XX' crlf>file
ELSE DROP
THEN ;
: >HEX.file' ( FROM LENGTH ... )
BEGIN DUP 10 U>
WHILE OVER 10 >A.LINE.OF.HEX.FORMAT'
10 - SWAP 10 + SWAP
REPEAT >A.LINE.OF.HEX.FORMAT' ;
: >HEX.file ( FROM LENGTH ... ) BASE @ >R HEX
( CLS ) s" 1.hex" R/W new.file to fhd >HEX.file'
crlf>file s" :00000001FF" fhd write.file ( write.file ) fhd open.file
R> BASE ! ;
variable ROM.BASE.ADDR
: 8K ROM.BASE.ADDR @ 2000 >hex.file ;
: 15K ROM.BASE.ADDR @ 3E00 >hex.file ;
: 16K ROM.BASE.ADDR @ 4000 >hex.file ;
: 32K ROM.BASE.ADDR @ 8000 >hex.file ;
: 64K ROM.BASE.ADDR @ 10000 >hex.file ;
: 62K ROM.BASE.ADDR @ F800 >hex.file ; \ F800 = 63448 =62*1024 =62K K=1024
: 1.hex PROGRAM.START @ ( f800 ) PROGRAM.LENGTH @ ( 800 ) >hex.file ;
\ ---------------
: EXTEND ( N ... N1 )
CASE 0 OF 1 ENDOF
1 OF 3 ENDOF
2 OF 7 ENDOF
3 OF 0F ENDOF
4 OF 1F ENDOF
5 OF 3F ENDOF
6 OF 7F ENDOF
7 OF 0FF ENDOF
8 OF 1FF ENDOF
9 OF 3FF ENDOF
0A OF 7FF ENDOF
0B OF 0FFF ENDOF
0C OF 1FFF ENDOF
0D OF 3FFF ENDOF
0E OF 7FFF ENDOF
0F OF 0FFFF ENDOF
10 OF 1FFFF ENDOF
11 OF 3FFFF ENDOF
12 OF 3FFFF ENDOF
13 OF 7FFFF ENDOF
14 OF 0FFFFF ENDOF
15 OF 1FFFFF ENDOF
16 OF 3FFFFF ENDOF
17 OF 7FFFFF ENDOF
18 OF 0FFFFFF ENDOF
19 OF 1FFFFFF ENDOF
1A OF 3FFFFFF ENDOF
1B OF 7FFFFFF ENDOF
1C OF 0FFFFFFF ENDOF
1D OF 1FFFFFFF ENDOF
1E OF 3FFFFFFF ENDOF
1F OF 7FFFFFFF ENDOF
ENDCASE ;
CREATE N>2^n.MASK 1 , 3 , 7 , 0F ,
1F , 3F , 7F , 0FF ,
1FF , 3FF , 7FF , 0FFF ,
1FFF , 3FFF , 7FFF , 0FFFF ,
1FFFF , 3FFFF , 7FFFF , 0FFFFF ,
1FFFFF , 3FFFFF , 7FFFFF , 0FFFFFF ,
1FFFFFF , 3FFFFFF , 7FFFFFF , 0FFFFFFF ,
1FFFFFFF , 3FFFFFFF , 7FFFFFFF , 0FFFFFFFF ,
: EXTEND' ( N ... N1 ) DUP 0 1F BETWEEN 0= ABORT" must be in the range 0~1F"
4 * N>2^n.MASK + @ ;
: 2^n ( n ... 2^n ) 1 SWAP 0 ?DO 2* LOOP ;
: 2^n ( n ... 2^n ) 1 swap lshift ;
: 2^n/ ( n ... 2^n/ ) 2^n -1 XOR ;
: SIGN.EXTEND.n ( N1 n.bit ... N2 ) >R R@ 2^N OVER AND
IF R@ EXTEND AND R> EXTEND -1 XOR OR
ELSE R> DROP
THEN ;
: SIGN.EXTEND ( BYTE ... N ) drop DUP 7F > IF FFFFFF00 OR THEN ; \ weForth 32 bits
: TP1 CR ." TP1: " .S ;
: TP2 CR ." TP2: " .S ;
: TP3 CR ." TP3: " .S ;
: TP4 CR ." TP4: " .S ;
: TP5 CR ." TP5: " .S ;
: TP6 CR ." TP6: " .S ;
: TP7 CR ." TP7: " .S ;
: TP8 CR ." TP8: " .S ;
: TP9 CR ." TP9: " .S ;
: TP10 CR ." TP10: " .S ;
: TP11 CR ." TP11: " .S ;
: TP12 CR ." TP12: " .S ;
: TP13 CR ." TP13: " .S ;
: TP14 CR ." TP14: " .S ;
: TP15 CR ." TP15: " .S ;
: TP16 CR ." TP16: " .S ;
: TP17 CR ." TP17: " .S ;
: TP18 CR ." TP18: " .S ;
: TP19 CR ." TP19: " .S ;
: TP20 CR ." TP20: " .S ;
: TP21 CR ." TP21: " .S ;
: TP22 CR ." TP22: " .S ;
: TP23 CR ." TP23: " .S ;
: TP24 CR ." TP24: " .S ;
: {:NFA.QUEUE.MAX 1000 ( 200 ) ;
VARIABLE {:NFA.QUEUE.COUNTER
CREATE {:NFA.QUEUE {:NFA.QUEUE.MAX 2 CELLS ( 6 ) * ALLOT
: ERASE.{:NFA.QUEUE {:NFA.QUEUE {:NFA.QUEUE.MAX 2 CELLS ( 6 ) * ERASE ;
: T:QUEUE.MAX 1000 ( 200 ) ;
VARIABLE T:QUEUE.COUNTER
CREATE T:QUEUE T:QUEUE.MAX 2 CELLS ( 6 ) * ALLOT
: ERASE.T:QUEUE T:QUEUE T:QUEUE.MAX 2 CELLS ( 6 ) * ERASE ;
VARIABLE PROGRAM.MEMORY.R.SIZE 1000 PROGRAM.MEMORY.R.SIZE !
: R:QUEUE.MAX PROGRAM.MEMORY.R.SIZE @ 8 / ;
VARIABLE R:QUEUE.COUNTER
CREATE R:QUEUE R:QUEUE.MAX 2 CELLS ( 6 ) * ALLOT
: ERASE.R:QUEUE R:QUEUE R:QUEUE.MAX 2 CELLS ( 6 ) * ERASE ;
ERASE.R:QUEUE
VARIABLE LAYER 0 LAYER !
: LAYER' LAYER @ 0 < IF 0 LAYER ! THEN LAYER ;
variable name.in.nfa.queue
VARIABLE T:NFA.QUEUE.LENGTH 4000 T:NFA.QUEUE.LENGTH !
CREATE T:NFA.QUEUE T:NFA.QUEUE.LENGTH @ ALLOT
VARIABLE T:NFA.QUEUE.COUNTER
VARIABLE former.T:NFA.QUEUE.addr
: ERASE.T:NFA.QUEUE T:NFA.QUEUE T:NFA.QUEUE.LENGTH @ ERASE ;
ERASE.T:NFA.QUEUE
: JAM.INTO.T:NFA.QUEUE ( ADDR LENGTH HERE' ... )
T:NFA.QUEUE.COUNTER @ T:NFA.QUEUE + ! 4 T:NFA.QUEUE.COUNTER +! >R \ CFA'=T:ADDR
former.T:NFA.QUEUE.addr @ T:NFA.QUEUE T:NFA.QUEUE.COUNTER @ + ! 4 T:NFA.QUEUE.COUNTER +! \ LFA'
T:NFA.QUEUE.COUNTER @ former.T:NFA.QUEUE.addr ! R@ \
T:NFA.QUEUE.COUNTER @ T:NFA.QUEUE + C! 1 T:NFA.QUEUE.COUNTER +! \ LENGTH
T:NFA.QUEUE.COUNTER @ T:NFA.QUEUE + dup name.in.nfa.queue ! R@ CMOVE \ NAME
T:NFA.QUEUE.COUNTER @ R> + T:NFA.QUEUE.COUNTER ! ;
VARIABLE p:NFA.QUEUE.LENGTH 4000 p:NFA.QUEUE.LENGTH !
CREATE p:NFA.QUEUE p:NFA.QUEUE.LENGTH @ ALLOT
VARIABLE p:NFA.QUEUE.COUNTER
VARIABLE former.p:NFA.QUEUE.addr
: ERASE.p:NFA.QUEUE p:NFA.QUEUE p:NFA.QUEUE.LENGTH @ ERASE ;
ERASE.p:NFA.QUEUE
VARIABLE inst:NFA.QUEUE.LENGTH 8000 inst:NFA.QUEUE.LENGTH !
CREATE inst:NFA.QUEUE inst:NFA.QUEUE.LENGTH @ ALLOT
VARIABLE inst:NFA.QUEUE.COUNTER
VARIABLE former.inst:NFA.QUEUE.addr
: ERASE.inst:NFA.QUEUE inst:NFA.QUEUE inst:NFA.QUEUE.LENGTH @ ERASE ;
ERASE.inst:NFA.QUEUE
VARIABLE {:NFA.QUEUE.LENGTH 4000 {:NFA.QUEUE.LENGTH !
CREATE {:NFA.QUEUE {:NFA.QUEUE.LENGTH @ ALLOT
VARIABLE {:NFA.QUEUE.COUNTER
VARIABLE former.{:NFA.QUEUE.addr
: ERASE.{:NFA.QUEUE {:NFA.QUEUE {:NFA.QUEUE.LENGTH @ ERASE ;
ERASE.{:NFA.QUEUE
create header.string 40 allot
: >header.string ( a length -- ) dup header.string c! header.string 1+ swap cmove ;
create header.string.p 40 allot
: >header.string.p ( a length -- ) dup header.string.p c! header.string.p 1+ swap cmove ;
VARIABLE former.p:NFA.QUEUE.addr
: ERASE.p:NFA.QUEUE p:NFA.QUEUE p:NFA.QUEUE.LENGTH @ ERASE ;
ERASE.p:NFA.QUEUE
VARIABLE former.{:NFA.QUEUE.addr
: ERASE.{:NFA.QUEUE {:NFA.QUEUE {:NFA.QUEUE.LENGTH @ ERASE ;
ERASE.{:NFA.QUEUE
VARIABLE former.inst:NFA.QUEUE.addr
: ERASE.inst:NFA.QUEUE inst:NFA.QUEUE inst:NFA.QUEUE.LENGTH @ ERASE ;
ERASE.inst:NFA.QUEUE
: JAM.INTO.inst:NFA.QUEUE ( ADDR LENGTH cfa ... )
inst:NFA.QUEUE.COUNTER @ inst:NFA.QUEUE + ! 4 inst:NFA.QUEUE.COUNTER +! >R \ CFA'=inst;ADDR
former.inst:NFA.QUEUE.addr @ inst:NFA.QUEUE inst:NFA.QUEUE.COUNTER @ + ! 4 inst:NFA.QUEUE.COUNTER +!
Reply by ●April 13, 20112011-04-13
Hello Luke,
Thanks for response. I'm afraid that it can't help me, however.
Thanks and best regards,
Borut.
chang luke wrote:
>
>
>
> I've developped assembler/disassembler/decompiler/compiler/tinyForth
> for msp430 Launchpad. See if this can help you develop other program.
> http://tech.groups.yahoo.com/group/armForth/files/msp430/msp430f240028p.f
>
> --- 11/4/7 (四),borut.preloznik > > 寫道:
>
> 寄件者: borut.preloznik > >
> 主旨: [msp430] Need help, weird program behavior LaunchPad - flash
> writing problem?
> 收件者: m...
> 日期: 2011年4月7日,四,下午6:14
>
>
>
> Hello!
> First I must say, that I'm new in posting on users group so please
> don't blame too much for some mistake.
>
> Here is my problem:
>
> I'm experiencing very weird behavior of software running on LaunchPad
> and I'm asking community to help with suggestions or experience.
> I've used way many hours and days exploring problems with no solution.
> My conclusion is that I have problem with reliable writing of code to
> flash.
>
> Here is synopsis:
> Software function:
> Controller for DC motor drive, driving H-bridge MOSFETS, using current
> limit protection and over-temperature protection. Commands for
> movement are accepted over i2c. I'm using USI I2C library (slaa368a,
> rev B).
> Thaer are three execution threads:
> DC motor drive statemachine is driven by Timer_A irq with 1kHz.
> ADC conversion is done in endless main loop.
> I2c runs in USI irq.
>
> I use fifo buffer with length 2 for commands from i2c->motor drive fsm.
> I use fifo buffer with length 2 for ADC results -> motor drive fsm.
> This way to avoid any memory corruption issues.
>
> For testing, I have LEDs connected in place of MOSFET drivers and
> potentiometers for simulating motor current and motor temperature, so
> I can simulate and observe functionality.
>
> I have another LaunchPad with simulation software that periodically
> sends two commands ( move left, move right ) to i2c
> (i2c master, same i2c library). I had similar problems with behavior
> with master code too!.
>
> Problem:
> Program behaves differently even with slight changes in code (
> adding/removing if()..else, adding/removing function call ) or change
> in compiler options ( optimizing level, release/debug...). Code
> changes influence even if added/removed code is not executed at all!
> Effective change is only slightly different layout of object code.
> Observed by improper LED's changes.
>
> Example of change that improved functionality:
> I've noticed, that for example, initializing port direction register
> works only after several writes with same value.
> P1DIR |= P1_ALL_OUT_MASK; // Unreliable write!!! LEDS on port 1 don't work
> P2DIR |= P2_ALL_OUT_MASK; // Unreliable write. LEDs on port 2 don't work
> P2DIR |= P2_ALL_OUT_MASK;
> P2DIR |= P2_ALL_OUT_MASK; // OK, now are LEDs on port 2 working as
> expected
> Since this is done at the very beginning of program, I can exclude any
> software error.
>
> I've noticed, that dissassembly code is on above place different from
> assembly listing generated from compiler.
> However, IAR doesn't detect problems at download ( I have active
> option for download verification )
>
> Partial list of what I've checked in my software, regarding possible
> run-time errors:
> I don't use any memory allocation in 128 bytes of ram.
> State machine is simple, no error possible.
> Stack is big enough.
>
> Development environment:
> Windows XP SP2
> IAR Embedded Workbench 5.10.6, Kickstart version, using "C" code. I2C
> library is in assembler.
> LaunchPad with MSP430G2231.
> Powered via USB cable
> Voltage on processor 3.4V
>
> Now, community, if you've read this far, I'm opened to suggestions.
> I'd like to use some open-source tools to give a try to recreate
> project and see difference.
> Please suggest me tools that you're satisfied with.
> I'm using CCS 4.0 for MSP430F2274 on eZ430-RF2500 with SimpliciTI
> without problems of this type.
> I'm trying to avoid CCS for MSP430Gxxxx, because it's huge beast and I
> can't manage it and I don't want to have two copies of it on PC.
>
> Thank you for help and suggestions in advance.
> Best regards,
> Borut.
>
> ----------
> comment:
> ************************************************************************************************
>
> before floading this file, we have to prepare the followings....
> **** methods to extend memory size ****
> win32for \ enter win32for.4.2.671
> sys \ enter dos
> win32for fload meta setsize bye \ adding 5Meg byte to application,
> 2Meg byte to system
> fkernel fload extend \ bye
> fsave f.exe \ save f.exe as a working horse. put it on the desktop.
>
> also copy WinIo.dll, WinIo.sys, WINIO.VXD to the directory the same as
> Win32forth.exe.
> ************************************************************************************************
>
> comment;
> hex
> : 2rot 2>r 2swap 2r> 2swap ;
> : -2rot 2rot 2rot ;
> variable download.to.ram.start 210 download.to.ram.start !
> variable download.to.ram.end+1 230 download.to.ram.end+1 !
> variable ram.start 200 ram.start !
> variable ram.end 280 ram.end !
> variable target.var.range 10 target.var.range !
> variable program.start f800 program.start ! \
> *****************************************
> variable program.length 800 program.length ! \
> *****************************************
> variable generate.disassem.program? generate.disassem.program? on
> variable op.code.of.call 12b0 op.code.of.call !
> variable op.code.of.jmp 4030 op.code.of.jmp !
> variable last' 1c8e last' ! \ *****************************************
> variable c.style? c.style? on
> cr .( **** enter 8 to generate disassem program, otherwise not **** )
> \ �o
> KEY '8' = #IF 1 #ELSE 0 #THEN generate.disassem.program? !
>
> : MAXIZE.LIST 80 2e52 36 XCALL DROP ; MAXIZE.LIST
> : emitx drop ; : typex 2drop ; : crx ;
>
> : no.disassem.program ( cls ) [ ' _memit literal ] is emit [ ' _mtype
> literal ] is type ( [ ' crx literal ] is cr ) ;
> : generate.disassem.program ( cls ) [ ' emitx literal ] is emit [ '
> typex literal ] is type ( [ ' crx literal ] is cr ) ;
> generate.disassem.program? @ #if generate.disassem.program #then
>
> \ INCLUDE 232C3c.f
> \ 232C2.F
> DECIMAL
>
> VARIABLE EXI.INI? -1 EXI.INI? !
> VARIABLE EXI?
>
> : XON -1 EXI.INI? ! ;
> : XOFF 0 EXI.INI? ! ;
>
> VARIABLE DONE?
>
> : DONE DONE? @ IF 0 ELSE -1 THEN DONE? ! ;
>
> VARIABLE BAUD.RATE?
> : BAUD.RATE BAUD.RATE? ! ;
>
> DEFER _EXI
> VARIABLE PORT?
> : PORT ( N ... ) PORT? ! ; 5 PORT
> : BS 8 EMIT ;
>
> : SET.com.port,BAUD.RATE ( PORT baud.rate -- )
> over 1 7 between not abort" com port 1 ~ 7 only "
> BAUD.RATE PORT ;
>
> : show.0.11k cr ." 0.11k1 0.11k2 0.11k3 0.11k4 0.11k5 0.11k6 0.11k7
> 0.11k8 0.11k9 0.11k10 0.11k11 0.11k12 0.11k13 0.11k14 0.11k15" ;
> : show.0.3k cr ." 0.3k1 0.3k2 0.3k3 0.3k4 0.3k5 0.3k6 0.3k7 0.3k8
> 0.3k9 0.3k10 0.3k11 0.3k12 0.3k13 0.3k14 0.3k15" ;
> : show.0.6k cr ." 0.6k1 0.6k2 0.6k3 0.6k4 0.6k5 0.6k6 0.6k7 0.6k8
> 0.6k9 0.6k10 0.6k11 0.6k12 0.6k13 0.6k14 0.6k15" ;
> : show.1.2k cr ." 1.2k1 1.2k2 1.2k3 1.2k4 1.2k5 1.2k6 1.2k7 1.2k8
> 1.2k9 1.2k10 1.2k11 1.2k12 1.2k13 1.2k14 1.2k15" ;
> : show.2.4k cr ." 2.4k1 2.4k2 2.4k3 2.4k4 2.4k5 2.4k6 2.4k7 2.4k8
> 2.4k9 2.4k10 2.4k11 2.4k12 2.4k13 2.4k14 2.4k15" ;
> : show.4.8k cr ." 4.8k1 4.8k2 4.8k3 4.8k4 4.8k5 4.8k6 4.8k7 4.8k8
> 4.8k9 4.8k10 4.8k11 4.8k12 4.8k13 4.8k14 4.8k15" ;
> : show.9.6k cr ." 9.6k1 9.6k2 9.6k3 9.6k4 9.6k5 9.6k6 9.6k7 9.6k8
> 9.6k9 9.6k10 9.6k11 9.6k12 9.6k13 9.6k14 9.6k15" ;
> : show.19.2k cr ." 19.2k1 19.2k2 19.2k3 19.2k4 19.2k5 19.2k6 19.2k7
> 19.2k8 19.2k9 19.2k10 19.2k11 19.2k12 19.2k13 19.2k14 19.2k15" ;
> : show.38.4k cr ." 38.4k1 38.4k2 38.4k3 38.4k4 38.4k5 38.4k6 38.4k7
> 38.4k8 38.4k9 38.4k10 38.4k11 38.4k12 38.4k13 38.4k14 38.4k15" ;
> : show.57.6k cr ." 57.6k1 57.6k2 57.6k3 57.6k4 57.6k5 57.6k6 57.6k7
> 57.6k8 57.6k9 57.6k10 57.6k11 57.6k12 57.6k13 57.6k14 57.6k15" ;
> : show.115.2k cr ." 115.2k1 115.2k2 115.2k3 115.2k4 115.2k5 115.2k6
> 115.2k7 115.2k8 115.2k9 115.2k10 115.2k11 115.2k12 115.2k13 115.2k14
> 115.2k15" ;
> : show.128k cr ." 128k1 128k2 128k3 128k4 128k5 128k6 128k7 128k8
> 128k9 128k10 128k11 128k12 128k13 128k14 128k15" ;
> : show.230k cr ." 230k1 230k2 230k3 230k4 230k5 230k6 230k7 230k8
> 230k9 230k10 230k11 230k12 230k13 230k14 230k15" ;
> : show.256k cr ." 256k1 256k2 256k3 256k4 256k5 256k6 256k7 256k8
> 256k9 256k10 256k11 256k12 256k13 256k14 256k15" ;
>
> : show.0.11k cr ." 0.11k1 0.11k2 0.11k3 0.11k4 0.11k5 0.11k6 0.11k7
> 0.11k8 0.11k9 0.11k10 0.11k11 0.11k12 0.11k13 0.11k14 0.11k15" ;
> : show.0.3k cr ." 0.3k1 0.3k2 0.3k3 0.3k4 0.3k5 0.3k6 0.3k7 0.3k8
> 0.3k9 0.3k10 0.3k11 0.3k12 0.3k13 0.3k14 0.3k15" ;
> : show.0.6k cr ." 0.6k1 0.6k2 0.6k3 0.6k4 0.6k5 0.6k6 0.6k7 0.6k8
> 0.6k9 0.6k10 0.6k11 0.6k12 0.6k13 0.6k14 0.6k15" ;
> : show.1.2k cr ." 1.2k1 1.2k2 1.2k3 1.2k4 1.2k5 1.2k6 1.2k7 1.2k8
> 1.2k9 1.2k10 1.2k11 1.2k12 1.2k13 1.2k14 1.2k15" ;
> : show.2.4k cr ." 2.4k1 2.4k2 2.4k3 2.4k4 2.4k5 2.4k6 2.4k7 2.4k8
> 2.4k9 2.4k10 2.4k11 2.4k12 2.4k13 2.4k14 2.4k15" ;
> : show.4.8k cr ." 4.8k1 4.8k2 4.8k3 4.8k4 4.8k5 4.8k6 4.8k7 4.8k8
> 4.8k9 4.8k10 4.8k11 4.8k12 4.8k13 4.8k14 4.8k15" ;
> : show.9.6k cr ." 9.6k1 9.6k2 9.6k3 9.6k4 9.6k5 9.6k6 9.6k7 9.6k8
> 9.6k9 9.6k10 9.6k11 9.6k12 9.6k13 9.6k14 9.6k15" ;
> : show.19.2k cr ." 19.2k1 19.2k2 19.2k3 19.2k4 19.2k5 19.2k6 19.2k7
> 19.2k8 19.2k9 19.2k10 19.2k11 19.2k12 19.2k13 19.2k14 19.2k15" ;
> : show.38.4k cr ." 38.4k1 38.4k2 38.4k3 38.4k4 38.4k5 38.4k6 38.4k7
> 38.4k8 38.4k9 38.4k10 38.4k11 38.4k12 38.4k13 38.4k14 38.4k15" ;
> : show.57.6k cr ." 57.6k1 57.6k2 57.6k3 57.6k4 57.6k5 57.6k6 57.6k7
> 57.6k8 57.6k9 57.6k10 57.6k11 57.6k12 57.6k13 57.6k14 57.6k15" ;
> : show.115k cr ." 115k1 115k2 115k3 115k4 115k5 115k6 115k7 115k8
> 115k9 115k10 115k11 115k12 115k13 115k14 115k15" ;
> : show.128k cr ." 128k1 128k2 128k3 128k4 128k5 128k6 128k7 128k8
> 128k9 128k10 128k11 128k12 128k13 128k14 128k15" ;
> : show.230k cr ." 230k1 230k2 230k3 230k4 230k5 230k6 230k7 230k8
> 230k9 230k10 230k11 230k12 230k13 230k14 230k15" ;
> : show.256k cr ." 256k1 256k2 256k3 256k4 256k5 256k6 256k7 256k8
> 256k9 256k10 256k11 256k12 256k13 256k14 256k15" ;
> : show.all.port,baud.rate show.0.11k show.0.3k show.0.6k show.1.2k
> show.2.4k show.4.8k show.9.6k
> show.19.2k show.38.4k show.57.6k show.115k show.128k show.230k
> show.256k ;
> defer oo
> \
> ******************************************************************************
>
> \ MODIFIED BY CJJ MAR.14,2001
> \ Written by Andrew McKewan in Visual C++
> \ Translated to Forth by Tom Zimmer
> \ January 3nd, 1997 tjz
> \ Updated to include changes from Skip Inskeep, as well as
> \ other changes.
> \ February 10th, 1997 by Tom Zimmer
> \ Updated with a couple of additional changes from Skip Inskeep.
>
> \ A Win32Forth example program that illustrates how to open COM1 for
> \ bi-directional communications and then allows a simple terminal
> \ program to communicate with whatever is connected at 9600 baud.
>
> \ define the object for the Device Control Block ( DCB ) structure
>
> :Object DCB >
> Record: AddrOf
> int DCBlength
> int BaudRate
> int BinaryBits \ a 32bit cell of bit fields
> 1 bits fBinary \ define the bit fields
> 1 bits fParity
> 1 bits fOutxCtsFlow
> 1 bits fOutxDsrFlow \ SDI changed for Rts to Dsr
> 2 bits fDtrControl
> 1 bits fDtrSensitivity
> 1 bits fTXContinueOnXoff
> 1 bits fOutX
> 1 bits fInx
> 1 bits fErrorChar
> 1 bits fNull
> 2 bits fRtsControl
> 1 bits fAbortOnError
> 17 bits fDummy
> short wReserved
> short XonLim
> short XoffLim
> byte ByteSize
> byte Parity
> byte StopBits
> byte XonChar
> byte XoffChar
> byte ErrorChar
> byte EofChar
> byte EvtChar
> short wReserved1
> ;RecordSize: SIZEOFDCB
>
> :M Reset: ( -- )
> AddrOf SIZEOFDCB erase
> ;M
>
> :M ClassInit: ( -- )
> ClassInit: super
> Reset: self \ create structure as Reset
> ;M
>
> ;Object
>
> \ define the field names for the Communications Timeout structure
>
> 0 CELL Field+ .ReadIntervalTimeout
> CELL Field+ .ReadTotalTimeoutMultiplier
> CELL Field+ .ReadTotalTimeoutConstant
> CELL Field+ .WriteTotalTimeoutMultiplier
> CELL Field+ .WriteTotalTimeoutConstant
> CONSTANT COMMTIMEOUTSBYTES
>
> : ComTimeouts { cHndl \ CT -- } \ Initialize the communications timeouts
> COMMTIMEOUTSBYTES LocalAlloc: CT \ allocate a CT structure
> CT COMMTIMEOUTSBYTES erase \ initialize it to zeros
> \ set read timeouts to magic value of don't wait, just poll
> -1 CT .ReadIntervalTimeout !
> 0 CT .ReadTotalTimeoutMultiplier !
> 0 CT .ReadTotalTimeoutConstant !
> 1 CT .WriteTotalTimeoutMultiplier !
> 20 CT .WriteTotalTimeoutConstant !
> CT rel>abs
> cHndl
> Call SetCommTimeouts drop ;
>
> : ComOpen ( z1 -- cHndl ) \ Open Com port for z" COM1", or z" COM2"
> >R
> NULL \ no template
> NULL \ open file attributes
> OPEN_EXISTING \ creation distribution
> NULL \ no security attributes
> 0 \ exclusive access
> GENERIC_READ GENERIC_WRITE or \ desired access modes
> R> rel>abs \ zstring filename
> Call CreateFile \ returns handle or -1
> dup -1 = \ if -1 then error
> Abort" Failed to open COM port!"
> ; \ -- chndl ;return handle to port
>
> \ ************************************************************
> \ here is a list of valid parameters for ComSetup. Except for
> \ the ByteSize parameter, these are all windows constants.
>
> \ --- BuadRate CBR_110 CBR_300 CBR_600
> \ CBR_1200 CBR_2400 CBR_4800
> \ CBR_9600 CBR_14400 CBR_56000
> \ CBR_19200 CBR_38400 CBR_57600
> \ CBR_115200 CBR_128000 CBR_256000
> \
> \ --- ByteSize 5, 6, 7, 8
> \
> \ --- Parity NOPARITY ODDPARITY MARKPARITY
> \ EVENPARITY SPACEPARITY
> \
> \ --- StopBits ONESTOPBIT TWOSTOPBITS ONE5STOPBITS
> \
> \ ************************************************************
>
> \ Setup the Communications state to the parameters specified
>
> : ComSetup { baud size parity stop cHndl -- }
> DCB.AddrOf rel>abs
> cHndl
> Call GetCommState ?win-error
>
> baud Put: DCB.BaudRate
> size Put: DCB.ByteSize
> parity 0<> Put: DCB.fParity \ parity enabled flag
> parity Put: DCB.Parity
> stop Put: DCB.StopBits
>
> DCB.AddrOf rel>abs
> cHndl
> Call SetCommState ?win-error ;
>
> : ComClose ( cHndl -- ) \ close com port if its open
> ?dup
> if Call CloseHandle drop
> then ;
>
> :Object COMSTAT >
> Record: AddrOf
> int lpComStatBits \ a 32bit cell of bit fields
> 1 bits fCtsHold \ define the bit fields Low to High
> 1 bits fDsrHold
> 1 bits fRlsdHold
> 1 bits fXoffHold
> 1 bits fXoffSent
> 1 bits fEof
> 1 bits fTxim
> 25 bits fReserved
> int cbInQue
> int cbOutQue
> ;RecordSize: SIZEOFCOMSTAT
>
> :M Reset: ( -- )
> AddrOf SIZEOFCOMSTAT erase
> ;M
>
> :M ClassInit: ( -- )
> ClassInit: super
> Reset: self \ create structure as Reset
> ;M
>
> ;Object
>
> : ComErrorClear { comhndl \ lpErrors -- f } \ true = success
> COMSTAT.addrof rel>abs
> lpErrors rel>abs
> comhndl Call ClearCommError 0<> ;
>
> \
> ----------------------
> : 0.11K17 17 110 INITIALIZE RUN.COM ;
> : 0.11K18 18 110 INITIALIZE RUN.COM ;
> : 0.11K19 19 110 INITIALIZE RUN.COM ;
> : 0.11K20 20 110 INITIALIZE RUN.COM ;
> : 0.11K21 21 110 INITIALIZE RUN.COM ;
> : 0.11K22 22 110 INITIALIZE RUN.COM ;
> : 0.11K23 23 110 INITIALIZE RUN.COM ;
> : 0.11K24 24 110 INITIALIZE RUN.COM ;
> : 0.11K25 25 110 INITIALIZE RUN.COM ;
> : 0.11K26 26 110 INITIALIZE RUN.COM ;
> : 0.11K27 27 110 INITIALIZE RUN.COM ;
> : 0.11K28 28 110 INITIALIZE RUN.COM ;
> : 0.11K29 29 110 INITIALIZE RUN.COM ;
> : 0.11K30 30 110 INITIALIZE RUN.COM ;
> : 0.11K31 31 110 INITIALIZE RUN.COM ;
> : 0.11K32 32 110 INITIALIZE RUN.COM ;
>
> : 0.3K17 17 300 INITIALIZE RUN.COM ;
> : 0.3K18 18 300 INITIALIZE RUN.COM ;
> : 0.3K19 19 300 INITIALIZE RUN.COM ;
> : 0.3K20 20 300 INITIALIZE RUN.COM ;
> : 0.3K21 21 300 INITIALIZE RUN.COM ;
> : 0.3K22 22 300 INITIALIZE RUN.COM ;
> : 0.3K23 23 300 INITIALIZE RUN.COM ;
> : 0.3K24 24 300 INITIALIZE RUN.COM ;
> : 0.3K25 25 300 INITIALIZE RUN.COM ;
> : 0.3K26 26 300 INITIALIZE RUN.COM ;
> : 0.3K27 27 300 INITIALIZE RUN.COM ;
> : 0.3K28 28 300 INITIALIZE RUN.COM ;
> : 0.3K29 29 300 INITIALIZE RUN.COM ;
> : 0.3K30 30 300 INITIALIZE RUN.COM ;
> : 0.3K31 31 300 INITIALIZE RUN.COM ;
> : 0.3K32 32 300 INITIALIZE RUN.COM ;
>
> : 0.6K17 17 600 INITIALIZE RUN.COM ;
> : 0.6K18 18 600 INITIALIZE RUN.COM ;
> : 0.6K19 19 600 INITIALIZE RUN.COM ;
> : 0.6K20 20 600 INITIALIZE RUN.COM ;
> : 0.6K21 21 600 INITIALIZE RUN.COM ;
> : 0.6K22 22 600 INITIALIZE RUN.COM ;
> : 0.6K23 23 600 INITIALIZE RUN.COM ;
> : 0.6K24 24 600 INITIALIZE RUN.COM ;
> : 0.6K25 25 600 INITIALIZE RUN.COM ;
> : 0.6K26 26 600 INITIALIZE RUN.COM ;
> : 0.6K27 27 600 INITIALIZE RUN.COM ;
> : 0.6K28 28 600 INITIALIZE RUN.COM ;
> : 0.6K29 29 600 INITIALIZE RUN.COM ;
> : 0.6K30 30 600 INITIALIZE RUN.COM ;
> : 0.6K31 31 600 INITIALIZE RUN.COM ;
> : 0.6K32 32 600 INITIALIZE RUN.COM ;
>
> : 1.2K17 17 1200 INITIALIZE RUN.COM ;
> : 1.2K18 18 1200 INITIALIZE RUN.COM ;
> : 1.2K19 19 1200 INITIALIZE RUN.COM ;
> : 1.2K20 20 1200 INITIALIZE RUN.COM ;
> : 1.2K21 21 1200 INITIALIZE RUN.COM ;
> : 1.2K22 22 1200 INITIALIZE RUN.COM ;
> : 1.2K23 23 1200 INITIALIZE RUN.COM ;
> : 1.2K24 24 1200 INITIALIZE RUN.COM ;
> : 1.2K25 25 1200 INITIALIZE RUN.COM ;
> : 1.2K26 26 1200 INITIALIZE RUN.COM ;
> : 1.2K27 27 1200 INITIALIZE RUN.COM ;
> : 1.2K28 28 1200 INITIALIZE RUN.COM ;
> : 1.2K29 29 1200 INITIALIZE RUN.COM ;
> : 1.2K30 30 1200 INITIALIZE RUN.COM ;
> : 1.2K31 31 1200 INITIALIZE RUN.COM ;
> : 1.2K32 32 1200 INITIALIZE RUN.COM ;
>
> : 2.4K17 17 2400 INITIALIZE RUN.COM ;
> : 2.4K18 18 2400 INITIALIZE RUN.COM ;
> : 2.4K19 19 2400 INITIALIZE RUN.COM ;
> : 2.4K20 20 2400 INITIALIZE RUN.COM ;
> : 2.4K21 21 2400 INITIALIZE RUN.COM ;
> : 2.4K22 22 2400 INITIALIZE RUN.COM ;
> : 2.4K23 23 2400 INITIALIZE RUN.COM ;
> : 2.4K24 24 2400 INITIALIZE RUN.COM ;
> : 2.4K25 25 2400 INITIALIZE RUN.COM ;
> : 2.4K26 26 2400 INITIALIZE RUN.COM ;
> : 2.4K27 27 2400 INITIALIZE RUN.COM ;
> : 2.4K28 28 2400 INITIALIZE RUN.COM ;
> : 2.4K29 29 2400 INITIALIZE RUN.COM ;
> : 2.4K30 30 2400 INITIALIZE RUN.COM ;
> : 2.4K31 31 2400 INITIALIZE RUN.COM ;
> : 2.4K32 32 2400 INITIALIZE RUN.COM ;
>
> : 4.8K17 17 4800 INITIALIZE RUN.COM ;
> : 4.8K18 18 4800 INITIALIZE RUN.COM ;
> : 4.8K19 19 4800 INITIALIZE RUN.COM ;
> : 4.8K20 20 4800 INITIALIZE RUN.COM ;
> : 4.8K21 21 4800 INITIALIZE RUN.COM ;
> : 4.8K22 22 4800 INITIALIZE RUN.COM ;
> : 4.8K23 23 4800 INITIALIZE RUN.COM ;
> : 4.8K24 24 4800 INITIALIZE RUN.COM ;
> : 4.8K25 25 4800 INITIALIZE RUN.COM ;
> : 4.8K26 26 4800 INITIALIZE RUN.COM ;
> : 4.8K27 27 4800 INITIALIZE RUN.COM ;
> : 4.8K28 28 4800 INITIALIZE RUN.COM ;
> : 4.8K29 29 4800 INITIALIZE RUN.COM ;
> : 4.8K30 30 4800 INITIALIZE RUN.COM ;
> : 4.8K31 31 4800 INITIALIZE RUN.COM ;
> : 4.8K32 32 4800 INITIALIZE RUN.COM ;
>
> : 9.6K17 17 9600 INITIALIZE RUN.COM ;
> : 9.6K18 18 9600 INITIALIZE RUN.COM ;
> : 9.6K19 19 9600 INITIALIZE RUN.COM ;
> : 9.6K20 20 9600 INITIALIZE RUN.COM ;
> : 9.6K21 21 9600 INITIALIZE RUN.COM ;
> : 9.6K22 22 9600 INITIALIZE RUN.COM ;
> : 9.6K23 23 9600 INITIALIZE RUN.COM ;
> : 9.6K24 24 9600 INITIALIZE RUN.COM ;
> : 9.6K25 25 9600 INITIALIZE RUN.COM ;
> : 9.6K26 26 9600 INITIALIZE RUN.COM ;
> : 9.6K27 27 9600 INITIALIZE RUN.COM ;
> : 9.6K28 28 9600 INITIALIZE RUN.COM ;
> : 9.6K29 29 9600 INITIALIZE RUN.COM ;
> : 9.6K30 30 9600 INITIALIZE RUN.COM ;
> : 9.6K31 31 9600 INITIALIZE RUN.COM ;
> : 9.6K32 32 9600 INITIALIZE RUN.COM ;
>
> : 19.2K17 17 19200 INITIALIZE RUN.COM ;
> : 19.2K18 18 19200 INITIALIZE RUN.COM ;
> : 19.2K19 19 19200 INITIALIZE RUN.COM ;
> : 19.2K20 20 19200 INITIALIZE RUN.COM ;
> : 19.2K21 21 19200 INITIALIZE RUN.COM ;
> : 19.2K22 22 19200 INITIALIZE RUN.COM ;
> : 19.2K23 23 19200 INITIALIZE RUN.COM ;
> : 19.2K24 24 19200 INITIALIZE RUN.COM ;
> : 19.2K25 25 19200 INITIALIZE RUN.COM ;
> : 19.2K26 26 19200 INITIALIZE RUN.COM ;
> : 19.2K27 27 19200 INITIALIZE RUN.COM ;
> : 19.2K28 28 19200 INITIALIZE RUN.COM ;
> : 19.2K29 29 19200 INITIALIZE RUN.COM ;
> : 19.2K30 30 19200 INITIALIZE RUN.COM ;
> : 19.2K31 31 19200 INITIALIZE RUN.COM ;
> : 19.2K32 32 19200 INITIALIZE RUN.COM ;
>
> : 38.4K17 17 38400 INITIALIZE RUN.COM ;
> : 38.4K18 18 38400 INITIALIZE RUN.COM ;
> : 38.4K19 19 38400 INITIALIZE RUN.COM ;
> : 38.4K20 20 38400 INITIALIZE RUN.COM ;
> : 38.4K21 21 38400 INITIALIZE RUN.COM ;
> : 38.4K22 22 38400 INITIALIZE RUN.COM ;
> : 38.4K23 23 38400 INITIALIZE RUN.COM ;
> : 38.4K24 24 38400 INITIALIZE RUN.COM ;
> : 38.4K25 25 38400 INITIALIZE RUN.COM ;
> : 38.4K26 26 38400 INITIALIZE RUN.COM ;
> : 38.4K27 27 38400 INITIALIZE RUN.COM ;
> : 38.4K28 28 38400 INITIALIZE RUN.COM ;
> : 38.4K29 29 38400 INITIALIZE RUN.COM ;
> : 38.4K30 30 38400 INITIALIZE RUN.COM ;
> : 38.4K31 31 38400 INITIALIZE RUN.COM ;
> : 38.4K32 32 38400 INITIALIZE RUN.COM ;
>
> : 57.6K17 17 57600 INITIALIZE RUN.COM ;
> : 57.6K18 18 57600 INITIALIZE RUN.COM ;
> : 57.6K19 19 57600 INITIALIZE RUN.COM ;
> : 57.6K20 20 57600 INITIALIZE RUN.COM ;
> : 57.6K21 21 57600 INITIALIZE RUN.COM ;
> : 57.6K22 22 57600 INITIALIZE RUN.COM ;
> : 57.6K23 23 57600 INITIALIZE RUN.COM ;
> : 57.6K24 24 57600 INITIALIZE RUN.COM ;
> : 57.6K25 25 57600 INITIALIZE RUN.COM ;
> : 57.6K26 26 57600 INITIALIZE RUN.COM ;
> : 57.6K27 27 57600 INITIALIZE RUN.COM ;
> : 57.6K28 28 57600 INITIALIZE RUN.COM ;
> : 57.6K29 29 57600 INITIALIZE RUN.COM ;
> : 57.6K30 30 57600 INITIALIZE RUN.COM ;
> : 57.6K31 31 57600 INITIALIZE RUN.COM ;
> : 57.6K32 32 57600 INITIALIZE RUN.COM ;
>
> : 115.2K17 17 115200 INITIALIZE RUN.COM ;
> : 115.2K18 18 115200 INITIALIZE RUN.COM ;
> : 115.2K19 19 115200 INITIALIZE RUN.COM ;
> : 115.2K20 20 115200 INITIALIZE RUN.COM ;
> : 115.2K21 21 115200 INITIALIZE RUN.COM ;
> : 115.2K22 22 115200 INITIALIZE RUN.COM ;
> : 115.2K23 23 115200 INITIALIZE RUN.COM ;
> : 115.2K24 24 115200 INITIALIZE RUN.COM ;
> : 115.2K25 25 115200 INITIALIZE RUN.COM ;
> : 115.2K26 26 115200 INITIALIZE RUN.COM ;
> : 115.2K27 27 115200 INITIALIZE RUN.COM ;
> : 115.2K28 28 115200 INITIALIZE RUN.COM ;
> : 115.2K29 29 115200 INITIALIZE RUN.COM ;
> : 115.2K30 30 115200 INITIALIZE RUN.COM ;
> : 115.2K31 31 115200 INITIALIZE RUN.COM ;
> : 115.2K32 32 115200 INITIALIZE RUN.COM ;
>
> : 115K17 17 115200 INITIALIZE RUN.COM ;
> : 115K18 18 115200 INITIALIZE RUN.COM ;
> : 115K19 19 115200 INITIALIZE RUN.COM ;
> : 115K20 20 115200 INITIALIZE RUN.COM ;
> : 115K21 21 115200 INITIALIZE RUN.COM ;
> : 115K22 22 115200 INITIALIZE RUN.COM ;
> : 115K23 23 115200 INITIALIZE RUN.COM ;
> : 115K24 24 115200 INITIALIZE RUN.COM ;
> : 115K25 25 115200 INITIALIZE RUN.COM ;
> : 115K26 26 115200 INITIALIZE RUN.COM ;
> : 115K27 27 115200 INITIALIZE RUN.COM ;
> : 115K28 28 115200 INITIALIZE RUN.COM ;
> : 115K29 29 115200 INITIALIZE RUN.COM ;
> : 115K30 30 115200 INITIALIZE RUN.COM ;
> : 115K31 31 115200 INITIALIZE RUN.COM ;
> : 115K32 32 115200 INITIALIZE RUN.COM ;
>
> : 128K17 17 128000 INITIALIZE RUN.COM ;
> : 128K18 18 128000 INITIALIZE RUN.COM ;
> : 128K19 19 128000 INITIALIZE RUN.COM ;
> : 128K20 20 128000 INITIALIZE RUN.COM ;
> : 128K21 21 128000 INITIALIZE RUN.COM ;
> : 128K22 22 128000 INITIALIZE RUN.COM ;
> : 128K23 23 128000 INITIALIZE RUN.COM ;
> : 128K24 24 128000 INITIALIZE RUN.COM ;
> : 128K25 25 128000 INITIALIZE RUN.COM ;
> : 128K26 26 128000 INITIALIZE RUN.COM ;
> : 128K27 27 128000 INITIALIZE RUN.COM ;
> : 128K28 28 128000 INITIALIZE RUN.COM ;
> : 128K29 29 128000 INITIALIZE RUN.COM ;
> : 128K30 30 128000 INITIALIZE RUN.COM ;
> : 128K31 31 128000 INITIALIZE RUN.COM ;
> : 128K32 32 128000 INITIALIZE RUN.COM ;
>
> : 230K17 17 230000 INITIALIZE RUN.COM ;
> : 230K18 18 230000 INITIALIZE RUN.COM ;
> : 230K19 19 230000 INITIALIZE RUN.COM ;
> : 230K20 20 230000 INITIALIZE RUN.COM ;
> : 230K21 21 230000 INITIALIZE RUN.COM ;
> : 230K22 22 230000 INITIALIZE RUN.COM ;
> : 230K23 23 230000 INITIALIZE RUN.COM ;
> : 230K24 24 230000 INITIALIZE RUN.COM ;
> : 230K25 25 230000 INITIALIZE RUN.COM ;
> : 230K26 26 230000 INITIALIZE RUN.COM ;
> : 230K27 27 230000 INITIALIZE RUN.COM ;
> : 230K28 28 230000 INITIALIZE RUN.COM ;
> : 230K29 29 230000 INITIALIZE RUN.COM ;
> : 230K30 30 230000 INITIALIZE RUN.COM ;
> : 230K31 31 230000 INITIALIZE RUN.COM ;
> : 230K32 32 230000 INITIALIZE RUN.COM ;
>
> : 256K17 17 256000 INITIALIZE RUN.COM ;
> : 256K18 18 256000 INITIALIZE RUN.COM ;
> : 256K19 19 256000 INITIALIZE RUN.COM ;
> : 256K20 20 256000 INITIALIZE RUN.COM ;
> : 256K21 21 256000 INITIALIZE RUN.COM ;
> : 256K22 22 256000 INITIALIZE RUN.COM ;
> : 256K23 23 256000 INITIALIZE RUN.COM ;
> : 256K24 24 256000 INITIALIZE RUN.COM ;
> : 256K25 25 256000 INITIALIZE RUN.COM ;
> : 256K26 26 256000 INITIALIZE RUN.COM ;
> : 256K27 27 256000 INITIALIZE RUN.COM ;
> : 256K28 28 256000 INITIALIZE RUN.COM ;
> : 256K29 29 256000 INITIALIZE RUN.COM ;
> : 256K30 30 256000 INITIALIZE RUN.COM ;
> : 256K31 31 256000 INITIALIZE RUN.COM ;
> : 256K32 32 256000 INITIALIZE RUN.COM ;
> : _oo ( -- ) port? @ BAUD.RATE? @ ( 2dup SET.com.port,BAUD.RATE )
> INITIALIZE RUN.COM ;
>
> ' _oo is oo
>
> HEX
> : [0~F>ASC] ( N ... N1 ) >R
> R@ 0 9 BETWEEN
> IF R> 30 +
> ELSE R@ 0A 0F BETWEEN
> IF R> 37 +
> ELSE R>
> THEN
> THEN ;
> : XX>232 10 /MOD [0~F>ASC] COMnEMIT [0~F>ASC] COMnEMIT 0D COMnEMIT ;
>
> : XXXX>232 10 /MOD 10 /MOD 10 /MOD
> [0~F>ASC] COMnEMIT [0~F>ASC] COMnEMIT [0~F>ASC] COMnEMIT [0~F>ASC]
> COMnEMIT 0D COMnEMIT ;
>
> CREATE "BUFFER 9 ALLOT
>
> : NUMBER>STRING ( N ... ADDR LENGTH ) \ STRING == ADDR LENGTH
> 8 0 DO BASE @ /MOD LOOP 9 0 DO [0~F>ASC] I "BUFFER + C! LOOP "BUFFER 9
> 0 -TRAILCHARS ;
>
> : NUMBER>STRING(9) ( N ... ADDR LENGTH ) \ STRING == ADDR LENGTH
> DUP 0<
> IF '-' "BUFFER C! ABS
> 8 0 DO BASE @ /MOD LOOP 9 0 DO [0~F>ASC] I 1+ "BUFFER + C! LOOP
> "BUFFER 9 0 -TRAILCHARS
> ELSE 8 0 DO BASE @ /MOD LOOP 9 0 DO [0~F>ASC] I "BUFFER + C! LOOP
> "BUFFER 9 0 -TRAILCHARS
> THEN ;
>
> DEFER _STRING.with.LEADING.0.REMOVED
>
> : NUMBER>STRING ( N ... ADDR LENGTH ) DUP>R ABS \ STRING == ADDR LENGTH
> 8 0 DO BASE @ /MOD LOOP 9 0 DO [0~F>ASC] I "BUFFER + C! LOOP "BUFFER 9
> 0 -TRAILCHARS
> _STRING.with.LEADING.0.REMOVED
> R> 0<
> IF 2DUP OVER DUP>R 1+ SWAP CMOVE> '-' R> C! 1+
> THEN ;
>
> \ ' NUMBER>STRING IS _NUMBER>STRING
>
> VARIABLE STRING>NUMBER.CORRECT?
>
> \ : STRING>NUMBER ( ADDR LENGTH ... N -1 / 0 ) 0 -ROT \ STRING == ADDR
> LENGTH
> \ BOUNDS -1 STRING>NUMBER.CORRECT? ! \ 5 31 32 33 34 35 12345
> \ DO BASE @ * I C@ BASE @ DIGIT \ |___addr
> \ IF +
> \ ELSE DROP 0 STRING>NUMBER.CORRECT? ! LEAVE
> \ THEN
> \ LOOP STRING>NUMBER.CORRECT? @ ; \ IF ( BASE @ / ) -1 ELSE DROP 0 THEN ;
>
> VARIABLE 0x?
> : STRING.with.LEADING.BLANK.REMOVED ( ADDR LENGTH ... ADDR1 LENGTH1 )
> DUP>R DUP 0
> ?DO OVER I + C@ 20 <> ( BLANK=20h )
> IF LEAVE
> THEN 1-
> LOOP R> OVER - ROT + SWAP DUP 0= IF DROP 1- 1 THEN ;
>
> \ ' STRING.WITH.LEADING.BLANK.REMOVED _STRING.WITH.LEADING.BLANK.REMOVED
>
> VARIABLE '+'.PRECEEDED
> VARIABLE '-'.PRECEEDED
>
> : CHECK.+/- ( ADDR LENGTH ... ADDR1 LENGTH1 ) '+'.PRECEEDED OFF
> '-'.PRECEEDED OFF
> >R >R R@ C@
> CASE '-' OF '-'.PRECEEDED ON -1 ENDOF
> '+' OF '+'.PRECEEDED ON -1 ENDOF
> 0 SWAP
> ENDCASE
> IF R> 1+ R> 1-
> ELSE R> R>
> THEN ;
> DEFER _STRING.with.LEADING.BLANK.REMOVED
>
> : STRING>NUMBER ( ADDR LENGTH ... N -1 / N 0 ) -TRAILING
> _STRING.with.LEADING.BLANK.REMOVED CHECK.+/-
> 0 -ROT \ STRING == ADDR LENGTH
> BOUNDS -1 STRING>NUMBER.CORRECT? ! \ 5 31 32 33 34 35 12345
> DO 0x? @
> IF 10 * I C@ 10
> ELSE BASE @ * I C@ BASE @
> THEN DIGIT \ |___addr
> IF +
> ELSE DROP ( 2DROP ) 0 STRING>NUMBER.CORRECT? ! LEAVE
> THEN
> LOOP STRING>NUMBER.CORRECT? @ 0 0x? !
> DUP
> IF '-'.PRECEEDED @
> IF SWAP NEGATE SWAP
> THEN
> THEN ; \ IF ( BASE @ / ) -1 ELSE DROP 0 THEN ;
>
> VARIABLE DELAY.STRING>232 30 DELAY.STRING>232 !
>
> : DS232 ( N ... ) DELAY.STRING>232 ! ;
>
> : STRING>232 BOUNDS DO I C@ COMnEMIT DELAY.STRING>232 @ MS LOOP 0D
> COMnEMIT ;
>
> DEFER _$>232
>
> ' STRING>232 IS _$>232
>
> : NUMBER>232 NUMBER>STRING STRING>232 ;
>
> : 232." STATE @
> IF COMPILE EXI COMPILE INI COMPILE (S") ," COMPILE STRING>232
> ELSE EXI INI 22 WORD NEW$ DUP>R OVER C@ 1+ MOVE R> COUNT STRING>232
> THEN ; IMMEDIATE
>
> \ include 1CellStack.f
> \
> ******************************************************************************
>
> \ ONE CELL STACK for temperary storing the address of >1, >2, >3... etc.
>
> : >ADDR.OF.REAL.VALUE.IN.VARIBLE ( CFA ... ADDR ) 4 + ;
>
> 2VARIABLE (#1)
> 2VARIABLE (#2)
> 2VARIABLE (#3)
> 2VARIABLE (#4)
> 2VARIABLE (#5)
> 2VARIABLE (#6)
> 2VARIABLE (#7)
> 2VARIABLE (#8)
> 2VARIABLE (#9)
> 2VARIABLE (#10)
> 2VARIABLE (#11)
> 2VARIABLE (#12)
> 2VARIABLE (#13)
> 2VARIABLE (#14)
> 2VARIABLE (#15)
> 2VARIABLE (#16)
> 2VARIABLE (#17)
> 2VARIABLE (#18)
> 2VARIABLE (#19)
> 2VARIABLE (#20)
> 2VARIABLE (#21)
> 2VARIABLE (#22)
> 2VARIABLE (#23)
> 2VARIABLE (#24)
>
> : CHECK.COMSUMED ( CFA ... VALUE.ADDR ) DUP >R \ 1 cell stack
> >ADDR.OF.REAL.VALUE.IN.VARIBLE DUP 2@
> IF R> >NAME .ID -1 ABORT" hasn't comsumed yet! "
> ELSE DROP R> DROP -1 SWAP 2!
> THEN ;
>
> : CHECK.RESOLVE ( CFA ... ADDR' VALUE.ADDR ) DUP >R \ 1 cell stack
> >ADDR.OF.REAL.VALUE.IN.VARIBLE DUP 2@
> IF R> DROP DUP @ ROT 0 SWAP 2!
> ELSE R> >NAME .ID -1 ABORT" has been resolved already! "
> THEN ;
>
> \ INTERACTIVE MODE STACK 1 LEVEL ONLY
>
> : >1 ['] (#1) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >2 ['] (#2) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >3 ['] (#3) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >4 ['] (#4) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >5 ['] (#5) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >6 ['] (#6) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >7 ['] (#7) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >8 ['] (#8) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >9 ['] (#9) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >10 ['] (#10) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >11 ['] (#11) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >12 ['] (#12) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >13 ['] (#13) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >14 ['] (#14) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >15 ['] (#15) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >16 ['] (#16) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >17 ['] (#17) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >18 ['] (#18) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >19 ['] (#19) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >20 ['] (#10) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >21 ['] (#11) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >22 ['] (#12) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >23 ['] (#13) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >24 ['] (#14) CHECK.COMSUMED ; \ ( ADDR' ... )
>
> : 1> ['] (#1) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 2> ['] (#2) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 3> ['] (#3) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 4> ['] (#4) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 5> ['] (#5) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 6> ['] (#6) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 7> ['] (#7) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 8> ['] (#8) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 9> ['] (#9) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 10> ['] (#10) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 11> ['] (#11) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 12> ['] (#12) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 13> ['] (#13) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 14> ['] (#14) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 15> ['] (#15) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 16> ['] (#16) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 17> ['] (#17) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 18> ['] (#18) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 19> ['] (#19) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 20> ['] (#20) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 21> ['] (#21) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 22> ['] (#22) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 23> ['] (#23) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 24> ['] (#24) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
>
> \
> ******************************************************************************
>
> : SET.com.port,BAUD.RATE ( PORT baud.rate -- )
> over 1 20 ( 7 ) between not abort" com port 1 ~ 32 only "
> BAUD.RATE PORT ;
>
> CODE FLIP ( 1234 -- 3412 ) XCHG BH, BL NEXT C;
>
> CREATE cp0' 10000 ALLOT \ 64k byte
> VARIABLE cp' 0 cp' !
> : HERE' cp' @ ;
> : ORG cp' ! ;
> : ALLOT' cp' +! ;
> \ ----------------------
> : 16! >R 0FFFF AND 100 /MOD R@ 1+ C! R> C! ; \ high order number at
> high address \ little endian
> : C@' cp0' + C@ ; : 8@' c@' ;
> : C!' cp0' + C! ; : 8!' c!' ;
> : !' cp0' + 16! ; : 16!' !' ;
> : @' DUP C@' SWAP 1+ C@' 100 * OR ; : 16@' @' ;
> : +!' ( N ADDR' ... ) >R R@ @' + R> !' ;
> : C+!' ( BYTE ADDR' ... ) >R R@ C@' + R> C!' ;
>
> : 32@^ cp0' + @ ; \ 0~7 8~15 16~23 24~31
> : 24@^ 32@^ 0ffffff and ;
> : 16@^ 32@^ 0ffff and ;
>
> : 32@' cp0' + @ ; \ 0~7 8~15 16~23 24~31
> : 24@' 32@' 0ffffff and ; \ 0~7 8~15 16~23
> : 16@' 32@' 0ffff and ; \ 0~7 8~15
> : 8@' 32@' 0ff and ; \ 0~7
>
> : 16!' !' ; \ 0~7 8~15 ( L H )
> : 8!' c!' ; \ 0~7
>
> : @^ 16@' flip ;
> : 16@^ 16@' flip ; \ low order number at high address
> : !^ >r flip r> 16!' ;
> : 16!^ >r flip r> 16!' ; \ low order number at high address
>
> : @'n @' F1ff and ; \ special usage of rb=x
>
> : C,' ( BYTE ... ) HERE' C!' 1 ALLOT' ; : 8,' C,' ;
> : ,' ( n .. ... ) HERE' !' 2 ALLOT' ; : 16,' ,' ;
> : ,^ ( n ...... ) flip HERE' !' 2 ALLOT' ; \ : 16,' ,' ;
>
> : 16,^ ( 16bit... ) HERE' 16!^ 2 ALLOT' ;
>
> : cmove' ( from' to' length -- ) 0 ?do over i + c@' over i + c!' loop
> 2drop ;
>
> : CFA>CFA' ( CFA ... CFA' ) 4 + @ ;
> : >CFA' ( CFA ... CFA' ) 4 + @ ; \ ' CR' >CFA' == 386
> : CFA'.OF' ' CFA>CFA' ;
> : [CFA'.OF] ' CFA>CFA' [COMPILE] LITERAL ; IMMEDIATE
>
> : CFA'.OF STATE @ IF ['] [CFA'.OF] EXECUTE else CFA'.OF' THEN ;
> IMMEDIATE \ ????
> : '' STATE @ IF ['] [CFA'.OF] EXECUTE else CFA'.OF' THEN ; IMMEDIATE \
> ????
>
> VARIABLE 2nd.number
> defer _disassem.number.stack> \ behaving like r>
> defer _>disassem.number.stack \ behaving like >r
> variable last.char
> \ ----------------------
> : u.| ( n -- ) 0 (D.) TYPE ;
> : u.| ( n -- ) ffff and 0 (D.) TYPE ; \ msp430 16 bit system
>
> : 0u.| ( n -- ) dup 0a 0f between if '0' emit then
> dup 0a0 0ff between if '0' emit then u.| ;
>
> : check.b=1.or.not ( a' -- f ) >r
> r@ 16@' f000 and 4000 f000 between
> if -1
> else r@ 16@' ff80 and
> case 1000 of -1 endof
> 1100 of -1 endof
> 1200 of -1 endof
> 0 swap
> endcase
> then r>drop ;
>
> variable .b=1?
> : .b=1 .b=1? @ if ." b=1" then ;
>
> : (1")0 do i c@ emit loop .b=1 ;
> : (2")0 do i c@ emit loop .b=1 ;
> : (3")0 do i c@ emit loop .b=1 ;
> : (4")0 do i c@ emit loop .b=1 ;
>
> variable Virtue.Forth?
>
> : emit.vf.register ( n -- f )
> case 0 of ." pc" -1 endof
> 1 of ." sp" -1 endof
> 2 of ." sr" -1 endof
> 3 of ." cg" -1 endof
> 4 of ." w" -1 endof
> 5 of ." fsp" -1 endof
> 6 of ." frp" -1 endof
> 7 of ." W" -1 endof
> 8 of ." X" -1 endof
> 9 of ." Y" -1 endof
> 0a of ." T" -1 endof
> 0b of ." U" -1 endof
> 0c of ." V" -1 endof
> 0d of ." P" -1 endof
> 0e of ." M" -1 endof
> 0f of ." Q" -1 endof
> 0 swap
> endcase ;
>
> \ ******** lower letter r will be neglected. **********
> defer _emit.port.name ( a' -- )
> defer _emit.port.name' ( a' -- )
>
> : (1")1 \ ((")) COUNT bounds last.char off
> do i c@ 'R' =
> if Virtue.Forth? @ if _disassem.number.stack> emit.vf.register drop
> else 'R' emit _disassem.number.stack> u.| \ R16 R8 === R1234 R56
> then
> else i c@ '#' =
> if _disassem.number.stack> dup 0u.| _emit.port.name \ #
> else i c@ emit \ =F0123456
> then
> then
> loop .b=1 ;
>
> variable c.type?
>
> : (n")1 ( u l -- )
> do i c@ 'R' =
> if Virtue.Forth? @
> if emit.vf.register drop
> else 'R' emit u.| \ R16 R8 === R1234 R56
> then
> else i c@ '#' =
> if dup c.type? @
> if _emit.port.name' if drop else 0u.| then
> else 0u.| _emit.port.name
> then \ 0u.| \ #
> else i c@ emit \ =F0123456
> then
> then
> loop .b=1 ;
>
> \ (1")1 _disassem.number.stack> -rot (n")1 ;
> : (2")1 _disassem.number.stack> _disassem.number.stack> 2swap (n")1 ;
> : (3")1 _disassem.number.stack> _disassem.number.stack>
> _disassem.number.stack> >r 2swap r> -rot (n")1 ;
> : (4")1 _disassem.number.stack> _disassem.number.stack>
> _disassem.number.stack> _disassem.number.stack> 2rot (n")1 ;
>
> : ?y ( x -) getxy nip gotoxy ;
> : 24y 24 ?y ;
> : 2ay 2a ?y ;
> : 2cy 2c ?y ;
> : 31y 31 ?y ;
> : 2fy 2f ?y ;
> : 30y 30 ?y ;
> : 34y 34 ?y ;
> : 38y 38 ?y ;
> : 3cy 3c ?y ;
> : 3ey 3e ?y ;
> : 3fy 3f ?y ;
> : 40y 40 ?y ;
>
> variable h.mode
>
> : (1") 3fy ((")) COUNT bounds last.char off
> h.mode @
> case
> 0 of (1")0 endof
> 1 of (1")1 endof
> endcase ;
>
> : (2") 3fy ((")) COUNT bounds last.char off
> h.mode @
> case
> 0 of (2")0 endof
> 1 of (2")1 endof
> endcase ;
>
> : (3") 3fy ((")) COUNT bounds last.char off
> h.mode @
> case
> 0 of (3")0 endof
> 1 of (3")1 endof
> endcase ;
>
> : (4") 3fy ((")) COUNT bounds last.char off
> h.mode @
> case
> 0 of (4")0 endof
> 1 of (4")1 endof
> endcase ;
>
> : 1" COMPILE (1") ," ; IMMEDIATE
> : 2" COMPILE (2") ," ; IMMEDIATE
> : 3" COMPILE (3") ," ; IMMEDIATE
> : 4" COMPILE (4") ," ; IMMEDIATE
> \ ----------------------
> VARIABLE OUT.MODE 8 OUT.MODE !
> : .X ( N ... ) 0 <# # #> TYPE ;
> : .XX ( N ... ) 0 <# # # #> TYPE ;
> : .XXX ( N ... ) 0 <# # # # #> TYPE ;
> : .XXXX ( N ... ) 0 <# # # # # #> TYPE ;
> : .XXXXx ( N ... ) 0 <# # # # # # #> TYPE ;
> : .XXXXxx ( N ... ) 0 <# # # # # # # #> TYPE ;
> : .XXXXxxx ( N ... ) 0 <# # # # # # # # #> TYPE ;
> : .XXXXxxxx ( N ... ) 0 <# # # # # # # # # #> TYPE ;
>
> : .0XX ( N ... ) DUP $0A0 $0FF BETWEEN IF $30 EMIT ELSE SPACE THEN .XX
> ; \ 0a0 7f
>
> : .?XX(h) ( N ... ) dup 2nd.number ! h.mode @ 0<> if drop 3 spaces
> exit then
> DUP 0 9 BETWEEN if 4 spaces .x 50 ?y exit then \ 9
> DUP $0A $9f BETWEEN if 3 spaces .xx 50 ?y exit then \ 0a
> DUP $0A0 $0ff BETWEEN if 2 spaces '0' emit then .xx 50 ?y ; \ 0a0
>
> : .xxxx(h) h.mode @ 0<> if drop exit then .xxxx ;
> : .xxxx(h) h.mode @ 0<> if drop 50 ?y exit then
> dup 0a 0f between if 3 spaces '0' emit .x 50 ?y exit then
> dup 0a0 0ff between if 2 spaces '0' emit .xx 50 ?y exit then
> dup 0a00 0fff between if space '0' emit .xxx 50 ?y exit then
> 0ffff and 5 u.r 50 ?y ;
>
> VARIABLE SUM
> : .XX+SUM DUP SUM +! .XX ;
>
> : U> SWAP U< ;
>
> : .XX+SUM DUP SUM +! .XX ;
> : >A.LINE.OF.HEX.FORMAT ( ADDR LENGTH ... )
> ?DUP
> IF CR 0 SUM ! 3A EMIT DUP .XX+SUM
> OVER 100 /MOD .XX+SUM .XX+SUM
> 0 .XX
> BOUNDS
> DO I C@' .XX+SUM
> LOOP 100 SUM C@ - .XX
> ELSE DROP
> THEN ;
>
> : >HEX' ( FROM LENGTH ... ) \ CLS
> BEGIN DUP 10 U>
> WHILE OVER 10 >A.LINE.OF.HEX.FORMAT
> 10 - SWAP 10 + SWAP
> REPEAT >A.LINE.OF.HEX.FORMAT ;
>
> : >HEX ( CLS ) >HEX' CR ." :00000001FF" cr KEY DROP ;
>
> : HEX> ( ... ) CR ." *** please enter ???.HEX file *** "
> BEGIN
> BEGIN KEY 3A ( : ) =
> UNTIL \ cr
> KEY 10 DIGIT DROP 10 * KEY 10 DIGIT DROP + >R ( LENGTH )
> KEY 10 DIGIT DROP 10 * KEY 10 DIGIT DROP + 10 * ( ADDR H )
> KEY 10 DIGIT DROP + 10 * KEY 10 DIGIT DROP + ( ADDR L )
> KEY 10 DIGIT DROP 10 * KEY 10 DIGIT DROP + DROP ( RECORD )
> R@
> IF R> 0
> DO DUP I + KEY 10 DIGIT DROP 10 * KEY 10 DIGIT DROP + SWAP CP0' + C!
> LOOP DROP 0
> ELSE R> 2DROP DROP -1
> THEN
> UNTIL QUIT ;
>
> : >HEXX' ( FROM LENGTH ... ) CLS
> BEGIN DUP 20 U>
> WHILE OVER 20 >A.LINE.OF.HEX.FORMAT
> 20 - SWAP 20 + SWAP
> REPEAT >A.LINE.OF.HEX.FORMAT ;
>
> : >HEXXX' ( FROM LENGTH ... ) CLS
> BEGIN DUP 30 U>
> WHILE OVER 30 >A.LINE.OF.HEX.FORMAT
> 30 - SWAP 30 + SWAP
> REPEAT >A.LINE.OF.HEX.FORMAT ;
>
> : >HEXXXX' ( FROM LENGTH ... ) CLS
> BEGIN DUP 38 U>
> WHILE OVER 38 >A.LINE.OF.HEX.FORMAT
> 38 - SWAP 38 + SWAP
> REPEAT >A.LINE.OF.HEX.FORMAT ;
>
> : >HEXX >HEXX' CR ." :00000001FF" KEY DROP ;
> : >HEXXX >HEXXX' CR ." :00000001FF" KEY DROP ;
> : >HEXXXX >HEXXXX' CR ." :00000001FF" KEY DROP ;
> \ ----------------------
> : >db ( from length -- ) cr over ." ORG 0x" .xxxx 0
> do i 10 mod 0= if 8 emit space cr ." DB " then
> dup i + c@' ." 0x" .xx ',' emit
> loop 8 emit space drop cr ." END" quit ;
>
> : >TI ( from length -- ) cls cr over ." @" .xxxx 0
> do i 10 mod 0= if cr then
> dup i + c@' .xx space
> loop drop cr ." q" quit ;
> \ ----------------------
> \ from �i�P�n
> anew Buffer_To_Hex
>
> : display.error.message ( message.addr length --- ) ErrorBox ;
>
> : open.file ( file.head.seres.number --- )
> close-file 0 <>
> if
> s" open.file.fail!" display.error.message
> then
> ;
>
> : new.file ( file.name.location file.name.length file.attribute ---
> file.head.seres.number )
> rot rot drop 1 - swap
> 2dup
> swap count rot
> open-file 0 <>
> if
> drop
> swap count rot
> create-file 0 <>
> if
> s" new.file.fail!" display.error.message
> then
> else
> rot rot 2drop
> then
> ;
>
> : write.file ( start.addr length file.head.seres.number --- )
> write-file 0 <>
> if
> s" write.file.fail!" display.error.message bye
> then
> ;
> decimal
> 0 value fhd
> DEFER _new.file
> DEFER _write.file
> DEFER _open.file
>
> ' new.file IS _new.file
> ' write.file IS _write.file
> ' open.file IS _open.file
>
> create buf 1024 allot
>
> : Buffer_To_Hex ( --- )
> hex
> s" xxx.hex" R/W new.file to fhd
> 1024 0 do
> buf i + c@ s>d <# # # #> fhd write.file
> \ crlf$ count fhd write.file
> loop fhd open.file DECIMAL ;
>
> : demo
> cls
> 11 buf 1 + c!
> 22 buf 2 + c!
> 33 buf 3 + c!
> buf 20 dump
> Buffer_To_Hex ;
>
> : demo1
> cls
> 44 buf 4 + c!
> 55 buf 5 + c!
> 66 buf 6 + c!
> buf 20 dump
> Buffer_To_Hex ;
>
> : DATA>HEX.FILE ( DATA ... ) BASE @ >R hex s>d <# # # #> fhd
> write.file R> BASE ! ;
> hex
> : 8K>Hex ( --- ) hex
> s" xxx.hex" R/W new.file to fhd
> 2000 0
> do I 20 MOD 0 = IF CRLF$ count fhd write.file THEN
> i c@' s>d <# # # #> fhd write.file
> loop fhd open.file ;
>
> : crlf>file crlf$ count fhd write.file ;
>
> : .xx' ( n ... ) s>d <# # # #> fhd write.file ( write.file ) ;
>
> : .XX+SUM' DUP SUM +! .XX' ;
> : >A.LINE.OF.HEX.FORMAT' ( ADDR LENGTH ... )
> ?DUP
> IF ( crlf>file ) 0 SUM ! ( 3A EMIT ) s" :" fhd write.file DUP .XX+SUM'
> OVER 100 /MOD .XX+SUM' .XX+SUM'
> 0 .XX'
> BOUNDS
> DO I C@' .XX+SUM'
> LOOP 100 SUM C@ - .XX' crlf>file
> ELSE DROP
> THEN ;
>
> : >HEX.file' ( FROM LENGTH ... )
> BEGIN DUP 10 U>
> WHILE OVER 10 >A.LINE.OF.HEX.FORMAT'
> 10 - SWAP 10 + SWAP
> REPEAT >A.LINE.OF.HEX.FORMAT' ;
>
> : >HEX.file ( FROM LENGTH ... ) BASE @ >R HEX
> ( CLS ) s" 1.hex" R/W new.file to fhd >HEX.file'
> crlf>file s" :00000001FF" fhd write.file ( write.file ) fhd open.file
> R> BASE ! ;
>
> variable ROM.BASE.ADDR
>
> : 8K ROM.BASE.ADDR @ 2000 >hex.file ;
> : 15K ROM.BASE.ADDR @ 3E00 >hex.file ;
> : 16K ROM.BASE.ADDR @ 4000 >hex.file ;
> : 32K ROM.BASE.ADDR @ 8000 >hex.file ;
> : 64K ROM.BASE.ADDR @ 10000 >hex.file ;
> : 62K ROM.BASE.ADDR @ F800 >hex.file ; \ F800 = 63448 =62*1024 =62K
> K=1024
>
> : 1.hex PROGRAM.START @ ( f800 ) PROGRAM.LENGTH @ ( 800 ) >hex.file ;
> \ ----------------------
> : EXTEND ( N ... N1 )
> CASE 0 OF 1 ENDOF
> 1 OF 3 ENDOF
> 2 OF 7 ENDOF
> 3 OF 0F ENDOF
> 4 OF 1F ENDOF
> 5 OF 3F ENDOF
> 6 OF 7F ENDOF
> 7 OF 0FF ENDOF
> 8 OF 1FF ENDOF
> 9 OF 3FF ENDOF
> 0A OF 7FF ENDOF
> 0B OF 0FFF ENDOF
> 0C OF 1FFF ENDOF
> 0D OF 3FFF ENDOF
> 0E OF 7FFF ENDOF
> 0F OF 0FFFF ENDOF
> 10 OF 1FFFF ENDOF
> 11 OF 3FFFF ENDOF
> 12 OF 3FFFF ENDOF
> 13 OF 7FFFF ENDOF
> 14 OF 0FFFFF ENDOF
> 15 OF 1FFFFF ENDOF
> 16 OF 3FFFFF ENDOF
> 17 OF 7FFFFF ENDOF
> 18 OF 0FFFFFF ENDOF
> 19 OF 1FFFFFF ENDOF
> 1A OF 3FFFFFF ENDOF
> 1B OF 7FFFFFF ENDOF
> 1C OF 0FFFFFFF ENDOF
> 1D OF 1FFFFFFF ENDOF
> 1E OF 3FFFFFFF ENDOF
> 1F OF 7FFFFFFF ENDOF
> ENDCASE ;
>
> CREATE N>2^n.MASK 1 , 3 , 7 , 0F ,
> 1F , 3F , 7F , 0FF ,
> 1FF , 3FF , 7FF , 0FFF ,
> 1FFF , 3FFF , 7FFF , 0FFFF ,
> 1FFFF , 3FFFF , 7FFFF , 0FFFFF ,
> 1FFFFF , 3FFFFF , 7FFFFF , 0FFFFFF ,
> 1FFFFFF , 3FFFFFF , 7FFFFFF , 0FFFFFFF ,
> 1FFFFFFF , 3FFFFFFF , 7FFFFFFF , 0FFFFFFFF ,
>
> : EXTEND' ( N ... N1 ) DUP 0 1F BETWEEN 0= ABORT" must be in the range
> 0~1F"
> 4 * N>2^n.MASK + @ ;
>
> : 2^n ( n ... 2^n ) 1 SWAP 0 ?DO 2* LOOP ;
> : 2^n ( n ... 2^n ) 1 swap lshift ;
> : 2^n/ ( n ... 2^n/ ) 2^n -1 XOR ;
>
> : SIGN.EXTEND.n ( N1 n.bit ... N2 ) >R R@ 2^N OVER AND
> IF R@ EXTEND AND R> EXTEND -1 XOR OR
> ELSE R> DROP
> THEN ;
>
> : SIGN.EXTEND ( BYTE ... N ) drop DUP 7F > IF FFFFFF00 OR THEN ; \
> weForth 32 bits
>
> : TP1 CR ." TP1: " .S ;
> : TP2 CR ." TP2: " .S ;
> : TP3 CR ." TP3: " .S ;
> : TP4 CR ." TP4: " .S ;
> : TP5 CR ." TP5: " .S ;
> : TP6 CR ." TP6: " .S ;
> : TP7 CR ." TP7: " .S ;
> : TP8 CR ." TP8: " .S ;
> : TP9 CR ." TP9: " .S ;
> : TP10 CR ." TP10: " .S ;
> : TP11 CR ." TP11: " .S ;
> : TP12 CR ." TP12: " .S ;
> : TP13 CR ." TP13: " .S ;
> : TP14 CR ." TP14: " .S ;
> : TP15 CR ." TP15: " .S ;
> : TP16 CR ." TP16: " .S ;
> : TP17 CR ." TP17: " .S ;
> : TP18 CR ." TP18: " .S ;
> : TP19 CR ." TP19: " .S ;
> : TP20 CR ." TP20: " .S ;
> : TP21 CR ." TP21: " .S ;
> : TP22 CR ." TP22: " .S ;
> : TP23 CR ." TP23: " .S ;
> : TP24 CR ." TP24: " .S ;
>
> : {:NFA.QUEUE.MAX 1000 ( 200 ) ;
> VARIABLE {:NFA.QUEUE.COUNTER
> CREATE {:NFA.QUEUE {:NFA.QUEUE.MAX 2 CELLS ( 6 ) * ALLOT
> : ERASE.{:NFA.QUEUE {:NFA.QUEUE {:NFA.QUEUE.MAX 2 CELLS ( 6 ) * ERASE ;
>
> : T:QUEUE.MAX 1000 ( 200 ) ;
> VARIABLE T:QUEUE.COUNTER
> CREATE T:QUEUE T:QUEUE.MAX 2 CELLS ( 6 ) * ALLOT
> : ERASE.T:QUEUE T:QUEUE T:QUEUE.MAX 2 CELLS ( 6 ) * ERASE ;
>
> VARIABLE PROGRAM.MEMORY.R.SIZE 1000 PROGRAM.MEMORY.R.SIZE !
> : R:QUEUE.MAX PROGRAM.MEMORY.R.SIZE @ 8 / ;
>
> VARIABLE R:QUEUE.COUNTER
> CREATE R:QUEUE R:QUEUE.MAX 2 CELLS ( 6 ) * ALLOT
> : ERASE.R:QUEUE R:QUEUE R:QUEUE.MAX 2 CELLS ( 6 ) * ERASE ;
> ERASE.R:QUEUE
>
> VARIABLE LAYER 0 LAYER !
> : LAYER' LAYER @ 0 < IF 0 LAYER ! THEN LAYER ;
>
> variable name.in.nfa.queue
>
> VARIABLE T:NFA.QUEUE.LENGTH 4000 T:NFA.QUEUE.LENGTH !
> CREATE T:NFA.QUEUE T:NFA.QUEUE.LENGTH @ ALLOT
> VARIABLE T:NFA.QUEUE.COUNTER
> VARIABLE former.T:NFA.QUEUE.addr
> : ERASE.T:NFA.QUEUE T:NFA.QUEUE T:NFA.QUEUE.LENGTH @ ERASE ;
> ERASE.T:NFA.QUEUE
>
> : JAM.INTO.T:NFA.QUEUE ( ADDR LENGTH HERE' ... )
> T:NFA.QUEUE.COUNTER @ T:NFA.QUEUE + ! 4 T:NFA.QUEUE.COUNTER +! >R \
> CFA'=T:ADDR
> former.T:NFA.QUEUE.addr @ T:NFA.QUEUE T:NFA.QUEUE.COUNTER @ + ! 4
> T:NFA.QUEUE.COUNTER +! \ LFA'
> T:NFA.QUEUE.COUNTER @ former.T:NFA.QUEUE.addr ! R@ \
> T:NFA.QUEUE.COUNTER @ T:NFA.QUEUE + C! 1 T:NFA.QUEUE.COUNTER +! \ LENGTH
> T:NFA.QUEUE.COUNTER @ T:NFA.QUEUE + dup name.in.nfa.queue ! R@ CMOVE \
> NAME
> T:NFA.QUEUE.COUNTER @ R> + T:NFA.QUEUE.COUNTER ! ;
>
> VARIABLE p:NFA.QUEUE.LENGTH 4000 p:NFA.QUEUE.LENGTH !
> CREATE p:NFA.QUEUE p:NFA.QUEUE.LENGTH @ ALLOT
> VARIABLE p:NFA.QUEUE.COUNTER
> VARIABLE former.p:NFA.QUEUE.addr
> : ERASE.p:NFA.QUEUE p:NFA.QUEUE p:NFA.QUEUE.LENGTH @ ERASE ;
> ERASE.p:NFA.QUEUE
>
> VARIABLE inst:NFA.QUEUE.LENGTH 8000 inst:NFA.QUEUE.LENGTH !
> CREATE inst:NFA.QUEUE inst:NFA.QUEUE.LENGTH @ ALLOT
> VARIABLE inst:NFA.QUEUE.COUNTER
> VARIABLE former.inst:NFA.QUEUE.addr
> : ERASE.inst:NFA.QUEUE inst:NFA.QUEUE inst:NFA.QUEUE.LENGTH @ ERASE ;
> ERASE.inst:NFA.QUEUE
>
> VARIABLE {:NFA.QUEUE.LENGTH 4000 {:NFA.QUEUE.LENGTH !
> CREATE {:NFA.QUEUE {:NFA.QUEUE.LENGTH @ ALLOT
> VARIABLE {:NFA.QUEUE.COUNTER
> VARIABLE former.{:NFA.QUEUE.addr
> : ERASE.{:NFA.QUEUE {:NFA.QUEUE {:NFA.QUEUE.LENGTH @ ERASE ;
> ERASE.{:NFA.QUEUE
>
> create header.string 40 allot
> : >header.string ( a length -- ) dup header.string c! header.string 1+
> swap cmove ;
> create header.string.p 40 allot
> : >header.string.p ( a length -- ) dup header.string.p c!
> header.string.p 1+ swap cmove ;
>
> VARIABLE former.p:NFA.QUEUE.addr
> : ERASE.p:NFA.QUEUE p:NFA.QUEUE p:NFA.QUEUE.LENGTH @ ERASE ;
> ERASE.p:NFA.QUEUE
>
> VARIABLE former.{:NFA.QUEUE.addr
> : ERASE.{:NFA.QUEUE {:NFA.QUEUE {:NFA.QUEUE.LENGTH @ ERASE ;
> ERASE.{:NFA.QUEUE
>
> VARIABLE former.inst:NFA.QUEUE.addr
> : ERASE.inst:NFA.QUEUE inst:NFA.QUEUE inst:NFA.QUEUE.LENGTH @ ERASE ;
> ERASE.inst:NFA.QUEUE
>
> : JAM.INTO.inst:NFA.QUEUE ( ADDR LENGTH cfa ... )
> inst:NFA.QUEUE.COUNTER @ inst:NFA.QUEUE + ! 4 inst:NFA.QUEUE.COUNTER
> +! >R \ CFA'=inst;ADDR
> former.inst:NFA.QUEUE.addr @ inst:NFA.QUEUE inst:NFA.QUEUE.COUNTER @ +
> ! 4 inst:NFA.QUEUE.COUNTER +! \ LFA'
> inst:NFA.QUEUE.COUNTER @ former.inst:NFA.QUEUE.addr ! R@ \
> inst:NFA.QUEUE.COUNTER @ inst:NFA.QUEUE + C! 1 inst:NFA.QUEUE.COUNTER
> +! \ LENGTH
> inst:NFA.QUEUE.COUNTER @ inst:NFA.QUEUE + dup name.in.nfa.queue ! R@
> CMOVE \ NAME
> inst:NFA.QUEUE.COUNTER @ R> + inst:NFA.QUEUE.COUNTER !
> header.string dup>r inst:NFA.QUEUE.COUNTER @ inst:NFA.QUEUE + r@ c@ 1+
> cmove
> r> c@ 1+ inst:NFA.QUEUE.COUNTER +! ;
>
> : JAM.INTO.{:NFA.QUEUE ( ADDR LENGTH cfa ... )
> {:NFA.QUEUE.COUNTER @ {:NFA.QUEUE + ! 4 {:NFA.QUEUE.COUNTER +! >R \
> CFA'={;ADDR
> former.{:NFA.QUEUE.addr @ {:NFA.QUEUE {:NFA.QUEUE.COUNTER @ + ! 4
> {:NFA.QUEUE.COUNTER +! \ LFA'
> {:NFA.QUEUE.COUNTER @ former.{:NFA.QUEUE.addr ! R@ \
> {:NFA.QUEUE.COUNTER @ {:NFA.QUEUE + C! 1 {:NFA.QUEUE.COUNTER +! \ LENGTH
> {:NFA.QUEUE.COUNTER @ {:NFA.QUEUE + dup name.in.nfa.queue ! R@ CMOVE \
> NAME
> {:NFA.QUEUE.COUNTER @ R> + {:NFA.QUEUE.COUNTER !
> header.string dup>r {:NFA.QUEUE.COUNTER @ {:NFA.QUEUE + r@ c@ 1+ cmove
> r> c@ 1+ {:NFA.QUEUE.COUNTER +! ;
>
> : JAM.INTO.p:NFA.QUEUE ( ADDR LENGTH cfa ... )
> p:NFA.QUEUE.COUNTER @ p:NFA.QUEUE + ! 4 p:NFA.QUEUE.COUNTER +! >R \
> CFA'=p;ADDR
> former.p:NFA.QUEUE.addr @ p:NFA.QUEUE p:NFA.QUEUE.COUNTER @ + ! 4
> p:NFA.QUEUE.COUNTER +! \ LFA'
> p:NFA.QUEUE.COUNTER @ former.p:NFA.QUEUE.addr ! R@ \
> p:NFA.QUEUE.COUNTER @ p:NFA.QUEUE + C! 1 p:NFA.QUEUE.COUNTER +! \ LENGTH
> p:NFA.QUEUE.COUNTER @ p:NFA.QUEUE + dup name.in.nfa.queue ! R@ CMOVE \
> NAME
> p:NFA.QUEUE.COUNTER @ R> + p:NFA.QUEUE.COUNTER !
> header.string.p dup>r p:NFA.QUEUE.COUNTER @ p:NFA.QUEUE + r@ c@ 1+ cmove
> r> c@ 1+ p:NFA.QUEUE.COUNTER +! ;
>
> : <-macro ( -- ) here' dup>r last @ name> dup>r execute here' over - (
> a length ) r> rot cp0' + -rot JAM.INTO.{:NFA.QUEUE r> org ;
> : <-p ( -- ) here 8 - 4 last @ name> JAM.INTO.p:NFA.QUEUE ;
>
> VARIABLE S"=?
>
> : S"= ( STRING1 STRING2 ... F ) ROT OVER = \ STRING == ADDR LENGTH
> IF 0 -1 S"=? ! \ ADDR1 ADDR2 LENGTH \ LENGTH = LENGTH1 = LENGTH2
> DO OVER I + C@ OVER I + C@ <>
> IF 0 S"=? ! LEAVE
> THEN
> LOOP 2DROP S"=? @
> ELSE 2DROP DROP 0
> THEN ;
>
> : S= S"= ;
> : S<> S= NOT ;
>
> variable head.line
> variable head.counter
>
> : DUMP.HEAD.IMAGE ( ... ) former.T:NFA.QUEUE.addr @ head.counter off
> BEGIN KEY? IF DROP EXIT THEN 1 head.counter +!
> CR base @ >r decimal head.counter @ ." (" 4 .r ." )" r> base !
> DUP T:NFA.QUEUE + 8 - @ 0A U.R \ T:ADDR cfa'
> DUP T:NFA.QUEUE + 4 - @ 0A U.R 9 SPACES \ LFA
> DUP T:NFA.QUEUE + COUNT TYPE ( .NAME ) \ NAME
> T:NFA.QUEUE + 4 - @ ?DUP 0=
> UNTIL ;
>
> : DUMP.HEAD.IMAGE.msp430 ( ... ) former.T:NFA.QUEUE.addr @ cr 1
> head.line ! 50 ?y head.counter off
> BEGIN 1 head.counter +!
> getxy drop 38 > if cr ." (" base @ >r decimal head.line @ 1 head.line
> +! 4 .r r> base ! ." )" then 2 spaces
> DUP T:NFA.QUEUE + COUNT TYPE ( .NAME ) \ NAME
> T:NFA.QUEUE + 4 - @ ?DUP 0=
> UNTIL ;
>
> variable cfa'>.ID?
> variable cfa.inst>.ID?
>
> : cfa'in.NFA.QUEUE? ( cfa'-- f ) T:NFA.QUEUE cfa'>.ID? off
> T:QUEUE.counter @ 8 / 0
> ?do 2dup @ =
> if cfa'>.ID? on leave
> then 8 + count +
> loop 2drop cfa'>.ID? @ ;
>
> : cfa'>.ID ( cfa'-- f ) T:NFA.QUEUE cfa'>.ID? off
> T:QUEUE.counter @ 8 / 0
> ?do 2dup @ =
> if dup 8 + count type cfa'>.ID? on leave
> then 8 + count +
> loop 2drop cfa'>.ID? @ ;
>
> : cfa.in.inst.NFA.QUEUE? ( cfa -- f ) inst:NFA.QUEUE cfa.inst>.ID? off
> inst:NFA.QUEUE.counter @ 8 / 0
> ?do 2dup @ =
> if cfa.inst>.ID? on leave
> then 8 + count +
> loop 2drop cfa.inst>.ID? @ ;
>
> : cfa.inst>.ID ( cfa -- f ) inst:NFA.QUEUE cfa.inst>.ID? off \ '.
> swapb.r cfa.inst>.ID .. -1
> inst:NFA.QUEUE.counter @ 8 / 0
> ?do 2dup @ =
> if dup 8 + count type cfa.inst>.ID? on leave
> then 8 + count +
> loop 2drop cfa.inst>.ID? @ ;
>
> : \.48--- ." \ " 48 0 do '-' emit loop ;
>
> : cfa'>head ( cfa'-- ) T:NFA.QUEUE
> T:QUEUE.counter @ 8 / 0
> ?do 2dup @ =
> if \.48---
> cr 1e ?y ." t: " dup 8 + count type cr leave
> then 8 + count +
> loop 2drop ;
>
> : emit.port.name' ( port -- f ) >r former.p:NFA.QUEUE.addr @
> p:NFA.QUEUE +
> begin 4 - @ dup 0<>
> while p:NFA.QUEUE + dup 1+ @ r@ =
> if r>drop ( getxy 2>r 55 ?y ." \ " ) 5 + count type ( 2r> gotoxy ) -1
> exit
> then
> repeat r>drop drop 0 ;
>
> ' emit.port.name' is _emit.port.name'
>
> variable total.of.name.of.#.to.print
>
> : emit.port.name ( port -- ) >r former.p:NFA.QUEUE.addr @ p:NFA.QUEUE +
> begin 4 - @ dup 0<>
> while p:NFA.QUEUE + dup 1+ @ r@ =
> if r>drop getxy 2>r total.of.name.of.#.to.print @ 1 =
> if 65 ?y 15 spaces 67 ?y
> else 55 ?y ." \ "
> then 5 + count type 2r> gotoxy 1 total.of.name.of.#.to.print +! exit
> then
> repeat drop r>drop ;
>
> : dump.port.name ( ------- ) ( cls ) former.p:NFA.QUEUE.addr @
> p:NFA.QUEUE +
> begin 4 - @ dup 0<>
> while p:NFA.QUEUE + dup cr ." :p " 5 + count type dup 1 + @ 28 ?y 9
> u.r ." p; "
> repeat drop r>drop ;
>
> ' emit.port.name is _emit.port.name
>
> variable CFA'.OF._T:?
>
> : CFA'>NFA ( CFA' ... NFA' -1 /0 ) 0 CFA'.OF._T:? !
> T:QUEUE.MAX 2 CELLS ( 6 ) * 0
> DO DUP T:QUEUE I + ( 2 + ) @ ( 16@ ) =
> IF T:QUEUE I + CELL ( 2 ) + @ -1 CFA'.OF._T:? ! SWAP LEAVE
> THEN 2 CELLS ( 6 )
> +LOOP DROP CFA'.OF._T:? @ ;
>
> : CFA'>CFA CFA'>NFA IF NAME> -1 ELSE 0 THEN ;
>
> VARIABLE ENGLISH? ENGLISH? ON
>
> : CFA'>NFA' ( CFA' ... NFA' -1 / 0 ) >R
> former.T:NFA.QUEUE.addr @
> BEGIN DUP T:NFA.QUEUE + 8 - @ R@ =
> IF DUP T:NFA.QUEUE + 4 - @ DUP
> T:NFA.QUEUE + 8 - @ R@ =
> IF R>DROP ENGLISH? @ IF NIP ELSE DROP THEN
> ELSE R>DROP DROP
> THEN -1 EXIT
> THEN T:NFA.QUEUE + 4 - @ ?DUP 0=
> UNTIL R>DROP 0 ;
>
> : count' ( a' -- a+1' n ) dup 1+ swap c@' ;
> : type' ( a' n ------- ) swap cp0' + swap type ;
>
> : CFA>NFA' ( CFA ... NFA' ) 4 + @ ( CFA>CFA' ) CFA'>NFA' dup 0= ABORT"
> *** CFA'>NFA' failed *** " ;
>
> : .ID(original) ( NFA .......... ) ?DUP 0<> IF NAME> CFA>NFA'
> T:NFA.QUEUE + COUNT TYPE THEN ;
> : GET.ID(original).LENGTH ( NFA ... LENGTH ) DUP 0<> IF NAME> CFA>NFA'
> T:NFA.QUEUE + COUNT NIP THEN ;
> \
> ***************************************************************************************************************
>
> DEFER _[J]
>
> : _HEADER'p 7D0 ( 2000 ) ?MEMCHK BL WORD COUNT 2dup >header.string.p
> "HEADER ;
> : _HEADER' 7D0 ( 2000 ) ?MEMCHK BL WORD COUNT 2dup >header.string
> "HEADER ;
> : :{ PARMS-INIT _HEADER' HIDE DOCOL , !CSP ] ;
> : :p PARMS-INIT _HEADER'p HIDE DOCOL , !CSP ] ;
>
> : }; ( -- )
> ?COMP
> ?:M ( -- F1 )
> FALSE TO ?:M
> ( -- f1 ) ABORT" Methods must END in ;M !"
> ?CSP REVEAL
> PARMS
> IF COMPILE UNNESTP
> ELSE COMPILE UNNEST
> THEN [COMPILE] [ 0 TO PARMS DO-;CHAIN <-macro ; IMMEDIATE
>
> : p; ( -- )
> ?COMP
> ?:M ( -- F1 )
> FALSE TO ?:M
> ( -- f1 ) ABORT" Methods must END in ;M !"
> ?CSP REVEAL
> PARMS
> IF COMPILE UNNESTP
> ELSE COMPILE UNNEST
> THEN [COMPILE] [ 0 TO PARMS DO-;CHAIN <-p ; IMMEDIATE
> CREATE :" 80 ALLOT
>
> : CREATE.ANOTHER.COLON.INSTRUCTION 7D0 ?MEMCHK BL WORD COUNT >R
> :" 1+ R@ CMOVE '"' :" C! '"' R@ 1+ :" + C! :" R> 2 + "HEADER DOVAR , ;
>
> : CREATE.ACI CREATE.ANOTHER.COLON.INSTRUCTION ;
>
> : 8,' c,' ;
>
> : even.aligned ( a1' --- a2' ) 1+ fffffffe and ;
>
> variable here'.even.aligned? here'.even.aligned? on
>
> : here'.even.aligned here'.even.aligned? @ if here' 1 and if 0 c,'
> then then ;
> : here'.even here' here'.even.aligned? @ if 1+ 0fffffffe then ;
> : (CREATE)inst 7D0 ( 2000 ) ?MEMCHK BL WORD COUNT 2dup HERE
> JAM.INTO.inst:NFA.QUEUE "HEADER DOVAR , ; ( headless )
> : (CREATE) 7D0 ( 2000 ) ?MEMCHK BL WORD COUNT 2dup HERE'
> JAM.INTO.T:NFA.QUEUE "HEADER DOVAR , ; ( headless )
> \ ----------------------
> : T: \ headless tforth
> \ 8(1)tF/16(0)teF.system @ 0= drop 0 if here'.even.aligned then \ 16
> bit eForth uses even address system only.
> >IN @ >R CREATE.ACI HERE' , _[J] R> >IN !
> (CREATE) HERE' , HERE' T:QUEUE T:QUEUE.COUNTER @ + !
> LAST @ T:QUEUE T:QUEUE.COUNTER @ + CELL + !
> 2 CELLS ( 6 ) T:QUEUE.COUNTER +!
> DOES> @ op.code.of.call @ ( 12b0 ) ( As=3 R0 ) 16,' 16,' ; \ (r0+) (
> RCALL ) CALL' ;
> : 16: t: ;
> \ ----------------------
> : immediate' ( -- ) last' @ c@' 80 or last' @ c!' ;
> : compile-only' ( -- ) last' @ c@' 40 or last' @ c!' ;
>
> : 2+ 2 + ;
> : 2- 2 - ;
> : 3+ 3 + ;
> : 3- 3 - ;
> : 4+ 4 + ;
> : 4- 4 - ;
> : 5+ 5 + ;
> : 5- 5 - ;
>
> variable former.instruction's.nfa
> variable instruction.n
>
> : get.total.instructions ( -- n ) last' @ instruction.n off \ 8051
> begin 2- @' dup 0= 1 instruction.n +!
> until drop instruction.n @ ;
>
> : get.total.instructions^ ( -- n ) last' @ instruction.n off \ stm8s
> begin 2- @^ dup 0= 1 instruction.n +!
> until drop instruction.n @ ;
>
> : find.next.instruction's.nfa^ ( nfa1 -- nfa2 no | 0 ) last' @
> instruction.n off \ stm8s
> begin >r r@ 2- @^ former.instruction's.nfa ! 1 instruction.n +!
> r> 2- @^ dup 0= if 2drop 0 exit then 2dup =
> until 2drop ( former.instruction's.nfa @ ) last' @ instruction.n @ 1- 0
> ?do 2- @^
> loop ;
>
> : find.next.instruction's.nfa ( nfa1 -- nfa2 no | 0 ) last' @
> instruction.n off \ 8051
> begin >r r@ 2- @' former.instruction's.nfa ! 1 instruction.n +!
> r> 2- @' dup 0= if 2drop 0 exit then 2dup =
> until 2drop ( former.instruction's.nfa @ ) last' @ instruction.n @ 1- 0
> ?do 2- @'
> loop ;
>
> : nfa'>cfa' ( nfa' -- cfa' ) count' 1f and + even.aligned ;
>
> : don't.use.same.name ( --) last' @ \ >name' nfa of COLD ===> 955e
> last' @ decompile
> begin dup>r count' 1f and 2>r \ type'
> cr ." defer " 2r@ type' ." ." 20 ?y ." ' " 2r@ type' 3b ?y ." is " 2r@
> type' ." . " 56 ?y ." : " 2r> type' ." don't.use ; "
> r> 2- @' ?dup 0= key? or
> until ;
>
> : don't.use.same.name^ ( --) last' @ \ >name' nfa of COLD ===> 955e
> last' @ decompile
> begin dup>r count' 1f and 2>r \ type'
> cr ." defer " 2r@ type' ." ." 20 ?y ." ' " 2r@ type' 3b ?y ." is " 2r@
> type' ." . " 56 ?y ." : " 2r> type' ." don't.use ; "
> r> 2- @^ ?dup 0= key? or
> until ;
>
> : \.3f--- cr ." \ " 3f 0 do '-' emit loop ;
> : \.3f*** cr ." \ " 3f 0 do '*' emit loop ;
>
> : find.current.instruction's.nfa ( cfa1 -- nfa2 no | 0 ) last' @
> instruction.n off
> begin >r r@ 2- @' former.instruction's.nfa ! 1 instruction.n +!
> r> 2- @' dup 0= if 2drop 0 exit then 2dup u>
> until 2drop ( former.instruction's.nfa @ ) last' @ instruction.n @ (
> 1+ ) 0
> ?do 2- @'
> loop ;
>
> : find.current.instruction's.nfa^ ( cfa1 -- nfa2 no | 0 ) last' @
> instruction.n off
> begin >r r@ 2- @^ former.instruction's.nfa ! 1 instruction.n +!
> r> 2- @^ dup 0= if 2drop 0 exit then 2dup u>
> until 2drop ( former.instruction's.nfa @ ) last' @ instruction.n @ (
> 1+ ) 0
> ?do 2- @^
> loop ;
>
> variable xxx
> : name>' ( nfa' -- cfa' ) count' 1f and + even.aligned ;
>
> : >name' ( cfa' -- nfa' | 0 ) \ find.current.instruction's.nfa ;
> last' @ \ cfa nfa
> begin dup \ cfa nfa nfa
> if dup name>' >r over r> xor \ cfa nfa cfa<>cfa'
> if 2 - @' 0 \ cfa nfa'
> else nip exit \
> then \
> else -1 \
> then
> until 2drop 0 ;
>
> : >name^ ( cfa' -- nfa' | 0 ) \ find.current.instruction's.nfa ;
> last' @ \ cfa nfa
> begin dup \ cfa nfa nfa
> if dup name>' >r over r> xor \ cfa nfa cfa<>cfa'
> if 2 - @^ 0 \ cfa nfa'
> else nip exit \
> then \
> else -1 \
> then
> until 2drop 0 ;
>
> : .id'(cfa'.in.t:nfa.queue) ( cfa' -- ) >r t:nfa.queue
> begin dup @ r@ =
> if r>drop 8 + count 1f and type exit
> then 8 + count 1f and + dup @ 0=
> until r>drop drop ;
>
> : .id' ( nfa' -- ) nfa'>cfa' .id'(cfa'.in.t:nfa.queue) ;
> : .$' ( a -- ) count' type' ;
>
> : (.1234.................) ( a -) ." ( " .xxxx space 12 spaces ." ) " ;
> : (.1234..??????????????.) ( a n -) ." ( " over .xxxx space bounds do
> space i c@' .xx loop ." ) " ;
> : (.1234..55.............) ( a -) ." ( " dup .xxxx space 1 bounds do
> space i c@' .xx loop 0f spaces ." ) " ;
> : (.1234..55.66..........) ( a -) ." ( " dup .xxxx space 2 bounds do
> space i c@' .xx loop 0c spaces ." ) " ;
> : (.1234..55.66.77.......) ( a -) ." ( " dup .xxxx space 3 bounds do
> space i c@' .xx loop 9 spaces ." ) " ;
> : (.1234..55.66.77.88....) ( a -) ." ( " dup .xxxx space 4 bounds do
> space i c@' .xx loop 6 spaces ." ) " ;
> : (.1234..55.66.77.88.99.) ( a -) ." ( " dup .xxxx space 5 bounds do
> space i c@' .xx loop ." ) " ;
> : (.1234..55.66.77.88.99.)nfa ( a -) ." ( " dup .xxxx space dup count'
> nip 1f and 1+ 5 min dup>r bounds
> do space i c@' .xx loop 5 r> - 3 * spaces 3 spaces ." ) " ;
> : (.1234..55.66.77.88.99.aa.) ( a -) ." ( " dup .xxxx space 6 bounds
> do space i c@' .xx loop ." )" ;
>
> : %0 dup (.1234.................) 34y ; ( a' -- a' )
> : %1 dup (.1234..55.............) 34y ;
> : %2 dup (.1234..55.66..........) 34y ;
> : %3 dup (.1234..55.66.77.......) 34y ;
> : %4 dup (.1234..55.66.77.88....) 34y ;
> : %5 dup (.1234..55.66.77.88.99.) 34y ;
> : %5n dup (.1234..55.66.77.88.99.)nfa 34y ;
> : %6 dup (.1234..55.66.77.88.99.aa.) 34y ;
>
> : set..b=1? ( a' -- ) >r r@ check.b=1.or.not r> 16@' 40 and and if
> .b=1? on else .b=1? off then ;
>
> : %0 dup dup set..b=1? (.1234.................) 34y ; ( a' -- a' )
> : %1 dup dup set..b=1? (.1234..55.............) 34y ;
> : %2 dup dup set..b=1? (.1234..55.66..........) 34y ;
> : %3 dup dup set..b=1? (.1234..55.66.77.......) 34y ;
> : %4 dup dup set..b=1? (.1234..55.66.77.88....) 34y ;
> : %5 dup dup set..b=1? (.1234..55.66.77.88.99.) 34y ;
> : %5n dup dup set..b=1? (.1234..55.66.77.88.99.)nfa 34y ;
> : %6 dup dup set..b=1? (.1234..55.66.77.88.99.aa.) 34y ;
>
> : n>%n ( n -- )
> case 1 of %1 endof
> 2 of %2 endof
> 3 of %3 endof
> 4 of %4 endof
> 5 of %5 endof
> 6 of %6 endof
> endcase ;
>
> : .a.range.of.2.byte.data ( from' to' -- ) swap ?do cr i %2 drop i @'
> .xxxx 2 +loop ;
>
> variable cfa'.of.doLIT
> variable cfa'.of.next.
> variable cfa'.of.branch
> variable cfa'.of.?branch
>
> defer _disassem
>
> : check.special.instruction? ( a' -- n | 0 ) dup 2- @^ 154E ( ''
> COMPILE ) = if drop 0 exit then
> dup 2+ @' ( ?branch doLit )
> case 1e38 of cr 2+ dup (.1234..55.66..........) @' 30 ?y .xxxx 4 endof
> \ ?branch
> 1e54 of cr 2+ dup (.1234..55.66..........) @' 30 ?y .xxxx 4 endof \
> branch
> 0196 of cr 2+ dup (.1234..55.66..........) @' 30 ?y .xxxx 4 endof \ next
> 1e38 of cr 2+ dup (.1234..55.66..........) @' 30 ?y .xxxx 4 endof \ doLit
> 057a of cr 2+ dup (.1234..55.66..........) @' 30 ?y .xxxx 4 endof \ doVar
> 059c of cr 2+ dup (.1234..55.66..........) @' 30 ?y .xxxx 4 endof \
> doUSER
> 0dbc of cr 2+ dup (.1234..55.66.77.88.99.) dup c@' 1+ swap 30 ?y .$'
> endof \ ,"|
> 0db2 of cr 2+ dup (.1234..55.66.77.88.99.) dup c@' 1+ swap 30 ?y .$'=2
Thanks for response. I'm afraid that it can't help me, however.
Thanks and best regards,
Borut.
chang luke wrote:
>
>
>
> I've developped assembler/disassembler/decompiler/compiler/tinyForth
> for msp430 Launchpad. See if this can help you develop other program.
> http://tech.groups.yahoo.com/group/armForth/files/msp430/msp430f240028p.f
>
> --- 11/4/7 (四),borut.preloznik > > 寫道:
>
> 寄件者: borut.preloznik > >
> 主旨: [msp430] Need help, weird program behavior LaunchPad - flash
> writing problem?
> 收件者: m...
> 日期: 2011年4月7日,四,下午6:14
>
>
>
> Hello!
> First I must say, that I'm new in posting on users group so please
> don't blame too much for some mistake.
>
> Here is my problem:
>
> I'm experiencing very weird behavior of software running on LaunchPad
> and I'm asking community to help with suggestions or experience.
> I've used way many hours and days exploring problems with no solution.
> My conclusion is that I have problem with reliable writing of code to
> flash.
>
> Here is synopsis:
> Software function:
> Controller for DC motor drive, driving H-bridge MOSFETS, using current
> limit protection and over-temperature protection. Commands for
> movement are accepted over i2c. I'm using USI I2C library (slaa368a,
> rev B).
> Thaer are three execution threads:
> DC motor drive statemachine is driven by Timer_A irq with 1kHz.
> ADC conversion is done in endless main loop.
> I2c runs in USI irq.
>
> I use fifo buffer with length 2 for commands from i2c->motor drive fsm.
> I use fifo buffer with length 2 for ADC results -> motor drive fsm.
> This way to avoid any memory corruption issues.
>
> For testing, I have LEDs connected in place of MOSFET drivers and
> potentiometers for simulating motor current and motor temperature, so
> I can simulate and observe functionality.
>
> I have another LaunchPad with simulation software that periodically
> sends two commands ( move left, move right ) to i2c
> (i2c master, same i2c library). I had similar problems with behavior
> with master code too!.
>
> Problem:
> Program behaves differently even with slight changes in code (
> adding/removing if()..else, adding/removing function call ) or change
> in compiler options ( optimizing level, release/debug...). Code
> changes influence even if added/removed code is not executed at all!
> Effective change is only slightly different layout of object code.
> Observed by improper LED's changes.
>
> Example of change that improved functionality:
> I've noticed, that for example, initializing port direction register
> works only after several writes with same value.
> P1DIR |= P1_ALL_OUT_MASK; // Unreliable write!!! LEDS on port 1 don't work
> P2DIR |= P2_ALL_OUT_MASK; // Unreliable write. LEDs on port 2 don't work
> P2DIR |= P2_ALL_OUT_MASK;
> P2DIR |= P2_ALL_OUT_MASK; // OK, now are LEDs on port 2 working as
> expected
> Since this is done at the very beginning of program, I can exclude any
> software error.
>
> I've noticed, that dissassembly code is on above place different from
> assembly listing generated from compiler.
> However, IAR doesn't detect problems at download ( I have active
> option for download verification )
>
> Partial list of what I've checked in my software, regarding possible
> run-time errors:
> I don't use any memory allocation in 128 bytes of ram.
> State machine is simple, no error possible.
> Stack is big enough.
>
> Development environment:
> Windows XP SP2
> IAR Embedded Workbench 5.10.6, Kickstart version, using "C" code. I2C
> library is in assembler.
> LaunchPad with MSP430G2231.
> Powered via USB cable
> Voltage on processor 3.4V
>
> Now, community, if you've read this far, I'm opened to suggestions.
> I'd like to use some open-source tools to give a try to recreate
> project and see difference.
> Please suggest me tools that you're satisfied with.
> I'm using CCS 4.0 for MSP430F2274 on eZ430-RF2500 with SimpliciTI
> without problems of this type.
> I'm trying to avoid CCS for MSP430Gxxxx, because it's huge beast and I
> can't manage it and I don't want to have two copies of it on PC.
>
> Thank you for help and suggestions in advance.
> Best regards,
> Borut.
>
> ----------
> comment:
> ************************************************************************************************
>
> before floading this file, we have to prepare the followings....
> **** methods to extend memory size ****
> win32for \ enter win32for.4.2.671
> sys \ enter dos
> win32for fload meta setsize bye \ adding 5Meg byte to application,
> 2Meg byte to system
> fkernel fload extend \ bye
> fsave f.exe \ save f.exe as a working horse. put it on the desktop.
>
> also copy WinIo.dll, WinIo.sys, WINIO.VXD to the directory the same as
> Win32forth.exe.
> ************************************************************************************************
>
> comment;
> hex
> : 2rot 2>r 2swap 2r> 2swap ;
> : -2rot 2rot 2rot ;
> variable download.to.ram.start 210 download.to.ram.start !
> variable download.to.ram.end+1 230 download.to.ram.end+1 !
> variable ram.start 200 ram.start !
> variable ram.end 280 ram.end !
> variable target.var.range 10 target.var.range !
> variable program.start f800 program.start ! \
> *****************************************
> variable program.length 800 program.length ! \
> *****************************************
> variable generate.disassem.program? generate.disassem.program? on
> variable op.code.of.call 12b0 op.code.of.call !
> variable op.code.of.jmp 4030 op.code.of.jmp !
> variable last' 1c8e last' ! \ *****************************************
> variable c.style? c.style? on
> cr .( **** enter 8 to generate disassem program, otherwise not **** )
> \ �o
> KEY '8' = #IF 1 #ELSE 0 #THEN generate.disassem.program? !
>
> : MAXIZE.LIST 80 2e52 36 XCALL DROP ; MAXIZE.LIST
> : emitx drop ; : typex 2drop ; : crx ;
>
> : no.disassem.program ( cls ) [ ' _memit literal ] is emit [ ' _mtype
> literal ] is type ( [ ' crx literal ] is cr ) ;
> : generate.disassem.program ( cls ) [ ' emitx literal ] is emit [ '
> typex literal ] is type ( [ ' crx literal ] is cr ) ;
> generate.disassem.program? @ #if generate.disassem.program #then
>
> \ INCLUDE 232C3c.f
> \ 232C2.F
> DECIMAL
>
> VARIABLE EXI.INI? -1 EXI.INI? !
> VARIABLE EXI?
>
> : XON -1 EXI.INI? ! ;
> : XOFF 0 EXI.INI? ! ;
>
> VARIABLE DONE?
>
> : DONE DONE? @ IF 0 ELSE -1 THEN DONE? ! ;
>
> VARIABLE BAUD.RATE?
> : BAUD.RATE BAUD.RATE? ! ;
>
> DEFER _EXI
> VARIABLE PORT?
> : PORT ( N ... ) PORT? ! ; 5 PORT
> : BS 8 EMIT ;
>
> : SET.com.port,BAUD.RATE ( PORT baud.rate -- )
> over 1 7 between not abort" com port 1 ~ 7 only "
> BAUD.RATE PORT ;
>
> : show.0.11k cr ." 0.11k1 0.11k2 0.11k3 0.11k4 0.11k5 0.11k6 0.11k7
> 0.11k8 0.11k9 0.11k10 0.11k11 0.11k12 0.11k13 0.11k14 0.11k15" ;
> : show.0.3k cr ." 0.3k1 0.3k2 0.3k3 0.3k4 0.3k5 0.3k6 0.3k7 0.3k8
> 0.3k9 0.3k10 0.3k11 0.3k12 0.3k13 0.3k14 0.3k15" ;
> : show.0.6k cr ." 0.6k1 0.6k2 0.6k3 0.6k4 0.6k5 0.6k6 0.6k7 0.6k8
> 0.6k9 0.6k10 0.6k11 0.6k12 0.6k13 0.6k14 0.6k15" ;
> : show.1.2k cr ." 1.2k1 1.2k2 1.2k3 1.2k4 1.2k5 1.2k6 1.2k7 1.2k8
> 1.2k9 1.2k10 1.2k11 1.2k12 1.2k13 1.2k14 1.2k15" ;
> : show.2.4k cr ." 2.4k1 2.4k2 2.4k3 2.4k4 2.4k5 2.4k6 2.4k7 2.4k8
> 2.4k9 2.4k10 2.4k11 2.4k12 2.4k13 2.4k14 2.4k15" ;
> : show.4.8k cr ." 4.8k1 4.8k2 4.8k3 4.8k4 4.8k5 4.8k6 4.8k7 4.8k8
> 4.8k9 4.8k10 4.8k11 4.8k12 4.8k13 4.8k14 4.8k15" ;
> : show.9.6k cr ." 9.6k1 9.6k2 9.6k3 9.6k4 9.6k5 9.6k6 9.6k7 9.6k8
> 9.6k9 9.6k10 9.6k11 9.6k12 9.6k13 9.6k14 9.6k15" ;
> : show.19.2k cr ." 19.2k1 19.2k2 19.2k3 19.2k4 19.2k5 19.2k6 19.2k7
> 19.2k8 19.2k9 19.2k10 19.2k11 19.2k12 19.2k13 19.2k14 19.2k15" ;
> : show.38.4k cr ." 38.4k1 38.4k2 38.4k3 38.4k4 38.4k5 38.4k6 38.4k7
> 38.4k8 38.4k9 38.4k10 38.4k11 38.4k12 38.4k13 38.4k14 38.4k15" ;
> : show.57.6k cr ." 57.6k1 57.6k2 57.6k3 57.6k4 57.6k5 57.6k6 57.6k7
> 57.6k8 57.6k9 57.6k10 57.6k11 57.6k12 57.6k13 57.6k14 57.6k15" ;
> : show.115.2k cr ." 115.2k1 115.2k2 115.2k3 115.2k4 115.2k5 115.2k6
> 115.2k7 115.2k8 115.2k9 115.2k10 115.2k11 115.2k12 115.2k13 115.2k14
> 115.2k15" ;
> : show.128k cr ." 128k1 128k2 128k3 128k4 128k5 128k6 128k7 128k8
> 128k9 128k10 128k11 128k12 128k13 128k14 128k15" ;
> : show.230k cr ." 230k1 230k2 230k3 230k4 230k5 230k6 230k7 230k8
> 230k9 230k10 230k11 230k12 230k13 230k14 230k15" ;
> : show.256k cr ." 256k1 256k2 256k3 256k4 256k5 256k6 256k7 256k8
> 256k9 256k10 256k11 256k12 256k13 256k14 256k15" ;
>
> : show.0.11k cr ." 0.11k1 0.11k2 0.11k3 0.11k4 0.11k5 0.11k6 0.11k7
> 0.11k8 0.11k9 0.11k10 0.11k11 0.11k12 0.11k13 0.11k14 0.11k15" ;
> : show.0.3k cr ." 0.3k1 0.3k2 0.3k3 0.3k4 0.3k5 0.3k6 0.3k7 0.3k8
> 0.3k9 0.3k10 0.3k11 0.3k12 0.3k13 0.3k14 0.3k15" ;
> : show.0.6k cr ." 0.6k1 0.6k2 0.6k3 0.6k4 0.6k5 0.6k6 0.6k7 0.6k8
> 0.6k9 0.6k10 0.6k11 0.6k12 0.6k13 0.6k14 0.6k15" ;
> : show.1.2k cr ." 1.2k1 1.2k2 1.2k3 1.2k4 1.2k5 1.2k6 1.2k7 1.2k8
> 1.2k9 1.2k10 1.2k11 1.2k12 1.2k13 1.2k14 1.2k15" ;
> : show.2.4k cr ." 2.4k1 2.4k2 2.4k3 2.4k4 2.4k5 2.4k6 2.4k7 2.4k8
> 2.4k9 2.4k10 2.4k11 2.4k12 2.4k13 2.4k14 2.4k15" ;
> : show.4.8k cr ." 4.8k1 4.8k2 4.8k3 4.8k4 4.8k5 4.8k6 4.8k7 4.8k8
> 4.8k9 4.8k10 4.8k11 4.8k12 4.8k13 4.8k14 4.8k15" ;
> : show.9.6k cr ." 9.6k1 9.6k2 9.6k3 9.6k4 9.6k5 9.6k6 9.6k7 9.6k8
> 9.6k9 9.6k10 9.6k11 9.6k12 9.6k13 9.6k14 9.6k15" ;
> : show.19.2k cr ." 19.2k1 19.2k2 19.2k3 19.2k4 19.2k5 19.2k6 19.2k7
> 19.2k8 19.2k9 19.2k10 19.2k11 19.2k12 19.2k13 19.2k14 19.2k15" ;
> : show.38.4k cr ." 38.4k1 38.4k2 38.4k3 38.4k4 38.4k5 38.4k6 38.4k7
> 38.4k8 38.4k9 38.4k10 38.4k11 38.4k12 38.4k13 38.4k14 38.4k15" ;
> : show.57.6k cr ." 57.6k1 57.6k2 57.6k3 57.6k4 57.6k5 57.6k6 57.6k7
> 57.6k8 57.6k9 57.6k10 57.6k11 57.6k12 57.6k13 57.6k14 57.6k15" ;
> : show.115k cr ." 115k1 115k2 115k3 115k4 115k5 115k6 115k7 115k8
> 115k9 115k10 115k11 115k12 115k13 115k14 115k15" ;
> : show.128k cr ." 128k1 128k2 128k3 128k4 128k5 128k6 128k7 128k8
> 128k9 128k10 128k11 128k12 128k13 128k14 128k15" ;
> : show.230k cr ." 230k1 230k2 230k3 230k4 230k5 230k6 230k7 230k8
> 230k9 230k10 230k11 230k12 230k13 230k14 230k15" ;
> : show.256k cr ." 256k1 256k2 256k3 256k4 256k5 256k6 256k7 256k8
> 256k9 256k10 256k11 256k12 256k13 256k14 256k15" ;
> : show.all.port,baud.rate show.0.11k show.0.3k show.0.6k show.1.2k
> show.2.4k show.4.8k show.9.6k
> show.19.2k show.38.4k show.57.6k show.115k show.128k show.230k
> show.256k ;
> defer oo
> \
> ******************************************************************************
>
> \ MODIFIED BY CJJ MAR.14,2001
> \ Written by Andrew McKewan in Visual C++
> \ Translated to Forth by Tom Zimmer
> \ January 3nd, 1997 tjz
> \ Updated to include changes from Skip Inskeep, as well as
> \ other changes.
> \ February 10th, 1997 by Tom Zimmer
> \ Updated with a couple of additional changes from Skip Inskeep.
>
> \ A Win32Forth example program that illustrates how to open COM1 for
> \ bi-directional communications and then allows a simple terminal
> \ program to communicate with whatever is connected at 9600 baud.
>
> \ define the object for the Device Control Block ( DCB ) structure
>
> :Object DCB >
> Record: AddrOf
> int DCBlength
> int BaudRate
> int BinaryBits \ a 32bit cell of bit fields
> 1 bits fBinary \ define the bit fields
> 1 bits fParity
> 1 bits fOutxCtsFlow
> 1 bits fOutxDsrFlow \ SDI changed for Rts to Dsr
> 2 bits fDtrControl
> 1 bits fDtrSensitivity
> 1 bits fTXContinueOnXoff
> 1 bits fOutX
> 1 bits fInx
> 1 bits fErrorChar
> 1 bits fNull
> 2 bits fRtsControl
> 1 bits fAbortOnError
> 17 bits fDummy
> short wReserved
> short XonLim
> short XoffLim
> byte ByteSize
> byte Parity
> byte StopBits
> byte XonChar
> byte XoffChar
> byte ErrorChar
> byte EofChar
> byte EvtChar
> short wReserved1
> ;RecordSize: SIZEOFDCB
>
> :M Reset: ( -- )
> AddrOf SIZEOFDCB erase
> ;M
>
> :M ClassInit: ( -- )
> ClassInit: super
> Reset: self \ create structure as Reset
> ;M
>
> ;Object
>
> \ define the field names for the Communications Timeout structure
>
> 0 CELL Field+ .ReadIntervalTimeout
> CELL Field+ .ReadTotalTimeoutMultiplier
> CELL Field+ .ReadTotalTimeoutConstant
> CELL Field+ .WriteTotalTimeoutMultiplier
> CELL Field+ .WriteTotalTimeoutConstant
> CONSTANT COMMTIMEOUTSBYTES
>
> : ComTimeouts { cHndl \ CT -- } \ Initialize the communications timeouts
> COMMTIMEOUTSBYTES LocalAlloc: CT \ allocate a CT structure
> CT COMMTIMEOUTSBYTES erase \ initialize it to zeros
> \ set read timeouts to magic value of don't wait, just poll
> -1 CT .ReadIntervalTimeout !
> 0 CT .ReadTotalTimeoutMultiplier !
> 0 CT .ReadTotalTimeoutConstant !
> 1 CT .WriteTotalTimeoutMultiplier !
> 20 CT .WriteTotalTimeoutConstant !
> CT rel>abs
> cHndl
> Call SetCommTimeouts drop ;
>
> : ComOpen ( z1 -- cHndl ) \ Open Com port for z" COM1", or z" COM2"
> >R
> NULL \ no template
> NULL \ open file attributes
> OPEN_EXISTING \ creation distribution
> NULL \ no security attributes
> 0 \ exclusive access
> GENERIC_READ GENERIC_WRITE or \ desired access modes
> R> rel>abs \ zstring filename
> Call CreateFile \ returns handle or -1
> dup -1 = \ if -1 then error
> Abort" Failed to open COM port!"
> ; \ -- chndl ;return handle to port
>
> \ ************************************************************
> \ here is a list of valid parameters for ComSetup. Except for
> \ the ByteSize parameter, these are all windows constants.
>
> \ --- BuadRate CBR_110 CBR_300 CBR_600
> \ CBR_1200 CBR_2400 CBR_4800
> \ CBR_9600 CBR_14400 CBR_56000
> \ CBR_19200 CBR_38400 CBR_57600
> \ CBR_115200 CBR_128000 CBR_256000
> \
> \ --- ByteSize 5, 6, 7, 8
> \
> \ --- Parity NOPARITY ODDPARITY MARKPARITY
> \ EVENPARITY SPACEPARITY
> \
> \ --- StopBits ONESTOPBIT TWOSTOPBITS ONE5STOPBITS
> \
> \ ************************************************************
>
> \ Setup the Communications state to the parameters specified
>
> : ComSetup { baud size parity stop cHndl -- }
> DCB.AddrOf rel>abs
> cHndl
> Call GetCommState ?win-error
>
> baud Put: DCB.BaudRate
> size Put: DCB.ByteSize
> parity 0<> Put: DCB.fParity \ parity enabled flag
> parity Put: DCB.Parity
> stop Put: DCB.StopBits
>
> DCB.AddrOf rel>abs
> cHndl
> Call SetCommState ?win-error ;
>
> : ComClose ( cHndl -- ) \ close com port if its open
> ?dup
> if Call CloseHandle drop
> then ;
>
> :Object COMSTAT >
> Record: AddrOf
> int lpComStatBits \ a 32bit cell of bit fields
> 1 bits fCtsHold \ define the bit fields Low to High
> 1 bits fDsrHold
> 1 bits fRlsdHold
> 1 bits fXoffHold
> 1 bits fXoffSent
> 1 bits fEof
> 1 bits fTxim
> 25 bits fReserved
> int cbInQue
> int cbOutQue
> ;RecordSize: SIZEOFCOMSTAT
>
> :M Reset: ( -- )
> AddrOf SIZEOFCOMSTAT erase
> ;M
>
> :M ClassInit: ( -- )
> ClassInit: super
> Reset: self \ create structure as Reset
> ;M
>
> ;Object
>
> : ComErrorClear { comhndl \ lpErrors -- f } \ true = success
> COMSTAT.addrof rel>abs
> lpErrors rel>abs
> comhndl Call ClearCommError 0<> ;
>
> \
> ----------------------
> : 0.11K17 17 110 INITIALIZE RUN.COM ;
> : 0.11K18 18 110 INITIALIZE RUN.COM ;
> : 0.11K19 19 110 INITIALIZE RUN.COM ;
> : 0.11K20 20 110 INITIALIZE RUN.COM ;
> : 0.11K21 21 110 INITIALIZE RUN.COM ;
> : 0.11K22 22 110 INITIALIZE RUN.COM ;
> : 0.11K23 23 110 INITIALIZE RUN.COM ;
> : 0.11K24 24 110 INITIALIZE RUN.COM ;
> : 0.11K25 25 110 INITIALIZE RUN.COM ;
> : 0.11K26 26 110 INITIALIZE RUN.COM ;
> : 0.11K27 27 110 INITIALIZE RUN.COM ;
> : 0.11K28 28 110 INITIALIZE RUN.COM ;
> : 0.11K29 29 110 INITIALIZE RUN.COM ;
> : 0.11K30 30 110 INITIALIZE RUN.COM ;
> : 0.11K31 31 110 INITIALIZE RUN.COM ;
> : 0.11K32 32 110 INITIALIZE RUN.COM ;
>
> : 0.3K17 17 300 INITIALIZE RUN.COM ;
> : 0.3K18 18 300 INITIALIZE RUN.COM ;
> : 0.3K19 19 300 INITIALIZE RUN.COM ;
> : 0.3K20 20 300 INITIALIZE RUN.COM ;
> : 0.3K21 21 300 INITIALIZE RUN.COM ;
> : 0.3K22 22 300 INITIALIZE RUN.COM ;
> : 0.3K23 23 300 INITIALIZE RUN.COM ;
> : 0.3K24 24 300 INITIALIZE RUN.COM ;
> : 0.3K25 25 300 INITIALIZE RUN.COM ;
> : 0.3K26 26 300 INITIALIZE RUN.COM ;
> : 0.3K27 27 300 INITIALIZE RUN.COM ;
> : 0.3K28 28 300 INITIALIZE RUN.COM ;
> : 0.3K29 29 300 INITIALIZE RUN.COM ;
> : 0.3K30 30 300 INITIALIZE RUN.COM ;
> : 0.3K31 31 300 INITIALIZE RUN.COM ;
> : 0.3K32 32 300 INITIALIZE RUN.COM ;
>
> : 0.6K17 17 600 INITIALIZE RUN.COM ;
> : 0.6K18 18 600 INITIALIZE RUN.COM ;
> : 0.6K19 19 600 INITIALIZE RUN.COM ;
> : 0.6K20 20 600 INITIALIZE RUN.COM ;
> : 0.6K21 21 600 INITIALIZE RUN.COM ;
> : 0.6K22 22 600 INITIALIZE RUN.COM ;
> : 0.6K23 23 600 INITIALIZE RUN.COM ;
> : 0.6K24 24 600 INITIALIZE RUN.COM ;
> : 0.6K25 25 600 INITIALIZE RUN.COM ;
> : 0.6K26 26 600 INITIALIZE RUN.COM ;
> : 0.6K27 27 600 INITIALIZE RUN.COM ;
> : 0.6K28 28 600 INITIALIZE RUN.COM ;
> : 0.6K29 29 600 INITIALIZE RUN.COM ;
> : 0.6K30 30 600 INITIALIZE RUN.COM ;
> : 0.6K31 31 600 INITIALIZE RUN.COM ;
> : 0.6K32 32 600 INITIALIZE RUN.COM ;
>
> : 1.2K17 17 1200 INITIALIZE RUN.COM ;
> : 1.2K18 18 1200 INITIALIZE RUN.COM ;
> : 1.2K19 19 1200 INITIALIZE RUN.COM ;
> : 1.2K20 20 1200 INITIALIZE RUN.COM ;
> : 1.2K21 21 1200 INITIALIZE RUN.COM ;
> : 1.2K22 22 1200 INITIALIZE RUN.COM ;
> : 1.2K23 23 1200 INITIALIZE RUN.COM ;
> : 1.2K24 24 1200 INITIALIZE RUN.COM ;
> : 1.2K25 25 1200 INITIALIZE RUN.COM ;
> : 1.2K26 26 1200 INITIALIZE RUN.COM ;
> : 1.2K27 27 1200 INITIALIZE RUN.COM ;
> : 1.2K28 28 1200 INITIALIZE RUN.COM ;
> : 1.2K29 29 1200 INITIALIZE RUN.COM ;
> : 1.2K30 30 1200 INITIALIZE RUN.COM ;
> : 1.2K31 31 1200 INITIALIZE RUN.COM ;
> : 1.2K32 32 1200 INITIALIZE RUN.COM ;
>
> : 2.4K17 17 2400 INITIALIZE RUN.COM ;
> : 2.4K18 18 2400 INITIALIZE RUN.COM ;
> : 2.4K19 19 2400 INITIALIZE RUN.COM ;
> : 2.4K20 20 2400 INITIALIZE RUN.COM ;
> : 2.4K21 21 2400 INITIALIZE RUN.COM ;
> : 2.4K22 22 2400 INITIALIZE RUN.COM ;
> : 2.4K23 23 2400 INITIALIZE RUN.COM ;
> : 2.4K24 24 2400 INITIALIZE RUN.COM ;
> : 2.4K25 25 2400 INITIALIZE RUN.COM ;
> : 2.4K26 26 2400 INITIALIZE RUN.COM ;
> : 2.4K27 27 2400 INITIALIZE RUN.COM ;
> : 2.4K28 28 2400 INITIALIZE RUN.COM ;
> : 2.4K29 29 2400 INITIALIZE RUN.COM ;
> : 2.4K30 30 2400 INITIALIZE RUN.COM ;
> : 2.4K31 31 2400 INITIALIZE RUN.COM ;
> : 2.4K32 32 2400 INITIALIZE RUN.COM ;
>
> : 4.8K17 17 4800 INITIALIZE RUN.COM ;
> : 4.8K18 18 4800 INITIALIZE RUN.COM ;
> : 4.8K19 19 4800 INITIALIZE RUN.COM ;
> : 4.8K20 20 4800 INITIALIZE RUN.COM ;
> : 4.8K21 21 4800 INITIALIZE RUN.COM ;
> : 4.8K22 22 4800 INITIALIZE RUN.COM ;
> : 4.8K23 23 4800 INITIALIZE RUN.COM ;
> : 4.8K24 24 4800 INITIALIZE RUN.COM ;
> : 4.8K25 25 4800 INITIALIZE RUN.COM ;
> : 4.8K26 26 4800 INITIALIZE RUN.COM ;
> : 4.8K27 27 4800 INITIALIZE RUN.COM ;
> : 4.8K28 28 4800 INITIALIZE RUN.COM ;
> : 4.8K29 29 4800 INITIALIZE RUN.COM ;
> : 4.8K30 30 4800 INITIALIZE RUN.COM ;
> : 4.8K31 31 4800 INITIALIZE RUN.COM ;
> : 4.8K32 32 4800 INITIALIZE RUN.COM ;
>
> : 9.6K17 17 9600 INITIALIZE RUN.COM ;
> : 9.6K18 18 9600 INITIALIZE RUN.COM ;
> : 9.6K19 19 9600 INITIALIZE RUN.COM ;
> : 9.6K20 20 9600 INITIALIZE RUN.COM ;
> : 9.6K21 21 9600 INITIALIZE RUN.COM ;
> : 9.6K22 22 9600 INITIALIZE RUN.COM ;
> : 9.6K23 23 9600 INITIALIZE RUN.COM ;
> : 9.6K24 24 9600 INITIALIZE RUN.COM ;
> : 9.6K25 25 9600 INITIALIZE RUN.COM ;
> : 9.6K26 26 9600 INITIALIZE RUN.COM ;
> : 9.6K27 27 9600 INITIALIZE RUN.COM ;
> : 9.6K28 28 9600 INITIALIZE RUN.COM ;
> : 9.6K29 29 9600 INITIALIZE RUN.COM ;
> : 9.6K30 30 9600 INITIALIZE RUN.COM ;
> : 9.6K31 31 9600 INITIALIZE RUN.COM ;
> : 9.6K32 32 9600 INITIALIZE RUN.COM ;
>
> : 19.2K17 17 19200 INITIALIZE RUN.COM ;
> : 19.2K18 18 19200 INITIALIZE RUN.COM ;
> : 19.2K19 19 19200 INITIALIZE RUN.COM ;
> : 19.2K20 20 19200 INITIALIZE RUN.COM ;
> : 19.2K21 21 19200 INITIALIZE RUN.COM ;
> : 19.2K22 22 19200 INITIALIZE RUN.COM ;
> : 19.2K23 23 19200 INITIALIZE RUN.COM ;
> : 19.2K24 24 19200 INITIALIZE RUN.COM ;
> : 19.2K25 25 19200 INITIALIZE RUN.COM ;
> : 19.2K26 26 19200 INITIALIZE RUN.COM ;
> : 19.2K27 27 19200 INITIALIZE RUN.COM ;
> : 19.2K28 28 19200 INITIALIZE RUN.COM ;
> : 19.2K29 29 19200 INITIALIZE RUN.COM ;
> : 19.2K30 30 19200 INITIALIZE RUN.COM ;
> : 19.2K31 31 19200 INITIALIZE RUN.COM ;
> : 19.2K32 32 19200 INITIALIZE RUN.COM ;
>
> : 38.4K17 17 38400 INITIALIZE RUN.COM ;
> : 38.4K18 18 38400 INITIALIZE RUN.COM ;
> : 38.4K19 19 38400 INITIALIZE RUN.COM ;
> : 38.4K20 20 38400 INITIALIZE RUN.COM ;
> : 38.4K21 21 38400 INITIALIZE RUN.COM ;
> : 38.4K22 22 38400 INITIALIZE RUN.COM ;
> : 38.4K23 23 38400 INITIALIZE RUN.COM ;
> : 38.4K24 24 38400 INITIALIZE RUN.COM ;
> : 38.4K25 25 38400 INITIALIZE RUN.COM ;
> : 38.4K26 26 38400 INITIALIZE RUN.COM ;
> : 38.4K27 27 38400 INITIALIZE RUN.COM ;
> : 38.4K28 28 38400 INITIALIZE RUN.COM ;
> : 38.4K29 29 38400 INITIALIZE RUN.COM ;
> : 38.4K30 30 38400 INITIALIZE RUN.COM ;
> : 38.4K31 31 38400 INITIALIZE RUN.COM ;
> : 38.4K32 32 38400 INITIALIZE RUN.COM ;
>
> : 57.6K17 17 57600 INITIALIZE RUN.COM ;
> : 57.6K18 18 57600 INITIALIZE RUN.COM ;
> : 57.6K19 19 57600 INITIALIZE RUN.COM ;
> : 57.6K20 20 57600 INITIALIZE RUN.COM ;
> : 57.6K21 21 57600 INITIALIZE RUN.COM ;
> : 57.6K22 22 57600 INITIALIZE RUN.COM ;
> : 57.6K23 23 57600 INITIALIZE RUN.COM ;
> : 57.6K24 24 57600 INITIALIZE RUN.COM ;
> : 57.6K25 25 57600 INITIALIZE RUN.COM ;
> : 57.6K26 26 57600 INITIALIZE RUN.COM ;
> : 57.6K27 27 57600 INITIALIZE RUN.COM ;
> : 57.6K28 28 57600 INITIALIZE RUN.COM ;
> : 57.6K29 29 57600 INITIALIZE RUN.COM ;
> : 57.6K30 30 57600 INITIALIZE RUN.COM ;
> : 57.6K31 31 57600 INITIALIZE RUN.COM ;
> : 57.6K32 32 57600 INITIALIZE RUN.COM ;
>
> : 115.2K17 17 115200 INITIALIZE RUN.COM ;
> : 115.2K18 18 115200 INITIALIZE RUN.COM ;
> : 115.2K19 19 115200 INITIALIZE RUN.COM ;
> : 115.2K20 20 115200 INITIALIZE RUN.COM ;
> : 115.2K21 21 115200 INITIALIZE RUN.COM ;
> : 115.2K22 22 115200 INITIALIZE RUN.COM ;
> : 115.2K23 23 115200 INITIALIZE RUN.COM ;
> : 115.2K24 24 115200 INITIALIZE RUN.COM ;
> : 115.2K25 25 115200 INITIALIZE RUN.COM ;
> : 115.2K26 26 115200 INITIALIZE RUN.COM ;
> : 115.2K27 27 115200 INITIALIZE RUN.COM ;
> : 115.2K28 28 115200 INITIALIZE RUN.COM ;
> : 115.2K29 29 115200 INITIALIZE RUN.COM ;
> : 115.2K30 30 115200 INITIALIZE RUN.COM ;
> : 115.2K31 31 115200 INITIALIZE RUN.COM ;
> : 115.2K32 32 115200 INITIALIZE RUN.COM ;
>
> : 115K17 17 115200 INITIALIZE RUN.COM ;
> : 115K18 18 115200 INITIALIZE RUN.COM ;
> : 115K19 19 115200 INITIALIZE RUN.COM ;
> : 115K20 20 115200 INITIALIZE RUN.COM ;
> : 115K21 21 115200 INITIALIZE RUN.COM ;
> : 115K22 22 115200 INITIALIZE RUN.COM ;
> : 115K23 23 115200 INITIALIZE RUN.COM ;
> : 115K24 24 115200 INITIALIZE RUN.COM ;
> : 115K25 25 115200 INITIALIZE RUN.COM ;
> : 115K26 26 115200 INITIALIZE RUN.COM ;
> : 115K27 27 115200 INITIALIZE RUN.COM ;
> : 115K28 28 115200 INITIALIZE RUN.COM ;
> : 115K29 29 115200 INITIALIZE RUN.COM ;
> : 115K30 30 115200 INITIALIZE RUN.COM ;
> : 115K31 31 115200 INITIALIZE RUN.COM ;
> : 115K32 32 115200 INITIALIZE RUN.COM ;
>
> : 128K17 17 128000 INITIALIZE RUN.COM ;
> : 128K18 18 128000 INITIALIZE RUN.COM ;
> : 128K19 19 128000 INITIALIZE RUN.COM ;
> : 128K20 20 128000 INITIALIZE RUN.COM ;
> : 128K21 21 128000 INITIALIZE RUN.COM ;
> : 128K22 22 128000 INITIALIZE RUN.COM ;
> : 128K23 23 128000 INITIALIZE RUN.COM ;
> : 128K24 24 128000 INITIALIZE RUN.COM ;
> : 128K25 25 128000 INITIALIZE RUN.COM ;
> : 128K26 26 128000 INITIALIZE RUN.COM ;
> : 128K27 27 128000 INITIALIZE RUN.COM ;
> : 128K28 28 128000 INITIALIZE RUN.COM ;
> : 128K29 29 128000 INITIALIZE RUN.COM ;
> : 128K30 30 128000 INITIALIZE RUN.COM ;
> : 128K31 31 128000 INITIALIZE RUN.COM ;
> : 128K32 32 128000 INITIALIZE RUN.COM ;
>
> : 230K17 17 230000 INITIALIZE RUN.COM ;
> : 230K18 18 230000 INITIALIZE RUN.COM ;
> : 230K19 19 230000 INITIALIZE RUN.COM ;
> : 230K20 20 230000 INITIALIZE RUN.COM ;
> : 230K21 21 230000 INITIALIZE RUN.COM ;
> : 230K22 22 230000 INITIALIZE RUN.COM ;
> : 230K23 23 230000 INITIALIZE RUN.COM ;
> : 230K24 24 230000 INITIALIZE RUN.COM ;
> : 230K25 25 230000 INITIALIZE RUN.COM ;
> : 230K26 26 230000 INITIALIZE RUN.COM ;
> : 230K27 27 230000 INITIALIZE RUN.COM ;
> : 230K28 28 230000 INITIALIZE RUN.COM ;
> : 230K29 29 230000 INITIALIZE RUN.COM ;
> : 230K30 30 230000 INITIALIZE RUN.COM ;
> : 230K31 31 230000 INITIALIZE RUN.COM ;
> : 230K32 32 230000 INITIALIZE RUN.COM ;
>
> : 256K17 17 256000 INITIALIZE RUN.COM ;
> : 256K18 18 256000 INITIALIZE RUN.COM ;
> : 256K19 19 256000 INITIALIZE RUN.COM ;
> : 256K20 20 256000 INITIALIZE RUN.COM ;
> : 256K21 21 256000 INITIALIZE RUN.COM ;
> : 256K22 22 256000 INITIALIZE RUN.COM ;
> : 256K23 23 256000 INITIALIZE RUN.COM ;
> : 256K24 24 256000 INITIALIZE RUN.COM ;
> : 256K25 25 256000 INITIALIZE RUN.COM ;
> : 256K26 26 256000 INITIALIZE RUN.COM ;
> : 256K27 27 256000 INITIALIZE RUN.COM ;
> : 256K28 28 256000 INITIALIZE RUN.COM ;
> : 256K29 29 256000 INITIALIZE RUN.COM ;
> : 256K30 30 256000 INITIALIZE RUN.COM ;
> : 256K31 31 256000 INITIALIZE RUN.COM ;
> : 256K32 32 256000 INITIALIZE RUN.COM ;
> : _oo ( -- ) port? @ BAUD.RATE? @ ( 2dup SET.com.port,BAUD.RATE )
> INITIALIZE RUN.COM ;
>
> ' _oo is oo
>
> HEX
> : [0~F>ASC] ( N ... N1 ) >R
> R@ 0 9 BETWEEN
> IF R> 30 +
> ELSE R@ 0A 0F BETWEEN
> IF R> 37 +
> ELSE R>
> THEN
> THEN ;
> : XX>232 10 /MOD [0~F>ASC] COMnEMIT [0~F>ASC] COMnEMIT 0D COMnEMIT ;
>
> : XXXX>232 10 /MOD 10 /MOD 10 /MOD
> [0~F>ASC] COMnEMIT [0~F>ASC] COMnEMIT [0~F>ASC] COMnEMIT [0~F>ASC]
> COMnEMIT 0D COMnEMIT ;
>
> CREATE "BUFFER 9 ALLOT
>
> : NUMBER>STRING ( N ... ADDR LENGTH ) \ STRING == ADDR LENGTH
> 8 0 DO BASE @ /MOD LOOP 9 0 DO [0~F>ASC] I "BUFFER + C! LOOP "BUFFER 9
> 0 -TRAILCHARS ;
>
> : NUMBER>STRING(9) ( N ... ADDR LENGTH ) \ STRING == ADDR LENGTH
> DUP 0<
> IF '-' "BUFFER C! ABS
> 8 0 DO BASE @ /MOD LOOP 9 0 DO [0~F>ASC] I 1+ "BUFFER + C! LOOP
> "BUFFER 9 0 -TRAILCHARS
> ELSE 8 0 DO BASE @ /MOD LOOP 9 0 DO [0~F>ASC] I "BUFFER + C! LOOP
> "BUFFER 9 0 -TRAILCHARS
> THEN ;
>
> DEFER _STRING.with.LEADING.0.REMOVED
>
> : NUMBER>STRING ( N ... ADDR LENGTH ) DUP>R ABS \ STRING == ADDR LENGTH
> 8 0 DO BASE @ /MOD LOOP 9 0 DO [0~F>ASC] I "BUFFER + C! LOOP "BUFFER 9
> 0 -TRAILCHARS
> _STRING.with.LEADING.0.REMOVED
> R> 0<
> IF 2DUP OVER DUP>R 1+ SWAP CMOVE> '-' R> C! 1+
> THEN ;
>
> \ ' NUMBER>STRING IS _NUMBER>STRING
>
> VARIABLE STRING>NUMBER.CORRECT?
>
> \ : STRING>NUMBER ( ADDR LENGTH ... N -1 / 0 ) 0 -ROT \ STRING == ADDR
> LENGTH
> \ BOUNDS -1 STRING>NUMBER.CORRECT? ! \ 5 31 32 33 34 35 12345
> \ DO BASE @ * I C@ BASE @ DIGIT \ |___addr
> \ IF +
> \ ELSE DROP 0 STRING>NUMBER.CORRECT? ! LEAVE
> \ THEN
> \ LOOP STRING>NUMBER.CORRECT? @ ; \ IF ( BASE @ / ) -1 ELSE DROP 0 THEN ;
>
> VARIABLE 0x?
> : STRING.with.LEADING.BLANK.REMOVED ( ADDR LENGTH ... ADDR1 LENGTH1 )
> DUP>R DUP 0
> ?DO OVER I + C@ 20 <> ( BLANK=20h )
> IF LEAVE
> THEN 1-
> LOOP R> OVER - ROT + SWAP DUP 0= IF DROP 1- 1 THEN ;
>
> \ ' STRING.WITH.LEADING.BLANK.REMOVED _STRING.WITH.LEADING.BLANK.REMOVED
>
> VARIABLE '+'.PRECEEDED
> VARIABLE '-'.PRECEEDED
>
> : CHECK.+/- ( ADDR LENGTH ... ADDR1 LENGTH1 ) '+'.PRECEEDED OFF
> '-'.PRECEEDED OFF
> >R >R R@ C@
> CASE '-' OF '-'.PRECEEDED ON -1 ENDOF
> '+' OF '+'.PRECEEDED ON -1 ENDOF
> 0 SWAP
> ENDCASE
> IF R> 1+ R> 1-
> ELSE R> R>
> THEN ;
> DEFER _STRING.with.LEADING.BLANK.REMOVED
>
> : STRING>NUMBER ( ADDR LENGTH ... N -1 / N 0 ) -TRAILING
> _STRING.with.LEADING.BLANK.REMOVED CHECK.+/-
> 0 -ROT \ STRING == ADDR LENGTH
> BOUNDS -1 STRING>NUMBER.CORRECT? ! \ 5 31 32 33 34 35 12345
> DO 0x? @
> IF 10 * I C@ 10
> ELSE BASE @ * I C@ BASE @
> THEN DIGIT \ |___addr
> IF +
> ELSE DROP ( 2DROP ) 0 STRING>NUMBER.CORRECT? ! LEAVE
> THEN
> LOOP STRING>NUMBER.CORRECT? @ 0 0x? !
> DUP
> IF '-'.PRECEEDED @
> IF SWAP NEGATE SWAP
> THEN
> THEN ; \ IF ( BASE @ / ) -1 ELSE DROP 0 THEN ;
>
> VARIABLE DELAY.STRING>232 30 DELAY.STRING>232 !
>
> : DS232 ( N ... ) DELAY.STRING>232 ! ;
>
> : STRING>232 BOUNDS DO I C@ COMnEMIT DELAY.STRING>232 @ MS LOOP 0D
> COMnEMIT ;
>
> DEFER _$>232
>
> ' STRING>232 IS _$>232
>
> : NUMBER>232 NUMBER>STRING STRING>232 ;
>
> : 232." STATE @
> IF COMPILE EXI COMPILE INI COMPILE (S") ," COMPILE STRING>232
> ELSE EXI INI 22 WORD NEW$ DUP>R OVER C@ 1+ MOVE R> COUNT STRING>232
> THEN ; IMMEDIATE
>
> \ include 1CellStack.f
> \
> ******************************************************************************
>
> \ ONE CELL STACK for temperary storing the address of >1, >2, >3... etc.
>
> : >ADDR.OF.REAL.VALUE.IN.VARIBLE ( CFA ... ADDR ) 4 + ;
>
> 2VARIABLE (#1)
> 2VARIABLE (#2)
> 2VARIABLE (#3)
> 2VARIABLE (#4)
> 2VARIABLE (#5)
> 2VARIABLE (#6)
> 2VARIABLE (#7)
> 2VARIABLE (#8)
> 2VARIABLE (#9)
> 2VARIABLE (#10)
> 2VARIABLE (#11)
> 2VARIABLE (#12)
> 2VARIABLE (#13)
> 2VARIABLE (#14)
> 2VARIABLE (#15)
> 2VARIABLE (#16)
> 2VARIABLE (#17)
> 2VARIABLE (#18)
> 2VARIABLE (#19)
> 2VARIABLE (#20)
> 2VARIABLE (#21)
> 2VARIABLE (#22)
> 2VARIABLE (#23)
> 2VARIABLE (#24)
>
> : CHECK.COMSUMED ( CFA ... VALUE.ADDR ) DUP >R \ 1 cell stack
> >ADDR.OF.REAL.VALUE.IN.VARIBLE DUP 2@
> IF R> >NAME .ID -1 ABORT" hasn't comsumed yet! "
> ELSE DROP R> DROP -1 SWAP 2!
> THEN ;
>
> : CHECK.RESOLVE ( CFA ... ADDR' VALUE.ADDR ) DUP >R \ 1 cell stack
> >ADDR.OF.REAL.VALUE.IN.VARIBLE DUP 2@
> IF R> DROP DUP @ ROT 0 SWAP 2!
> ELSE R> >NAME .ID -1 ABORT" has been resolved already! "
> THEN ;
>
> \ INTERACTIVE MODE STACK 1 LEVEL ONLY
>
> : >1 ['] (#1) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >2 ['] (#2) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >3 ['] (#3) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >4 ['] (#4) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >5 ['] (#5) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >6 ['] (#6) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >7 ['] (#7) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >8 ['] (#8) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >9 ['] (#9) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >10 ['] (#10) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >11 ['] (#11) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >12 ['] (#12) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >13 ['] (#13) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >14 ['] (#14) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >15 ['] (#15) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >16 ['] (#16) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >17 ['] (#17) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >18 ['] (#18) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >19 ['] (#19) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >20 ['] (#10) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >21 ['] (#11) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >22 ['] (#12) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >23 ['] (#13) CHECK.COMSUMED ; \ ( ADDR' ... )
> : >24 ['] (#14) CHECK.COMSUMED ; \ ( ADDR' ... )
>
> : 1> ['] (#1) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 2> ['] (#2) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 3> ['] (#3) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 4> ['] (#4) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 5> ['] (#5) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 6> ['] (#6) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 7> ['] (#7) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 8> ['] (#8) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 9> ['] (#9) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 10> ['] (#10) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 11> ['] (#11) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 12> ['] (#12) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 13> ['] (#13) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 14> ['] (#14) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 15> ['] (#15) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 16> ['] (#16) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 17> ['] (#17) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 18> ['] (#18) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 19> ['] (#19) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 20> ['] (#20) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 21> ['] (#21) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 22> ['] (#22) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 23> ['] (#23) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
> : 24> ['] (#24) CHECK.RESOLVE ; \ ADDR -1 ( ... ADDR' )
>
> \
> ******************************************************************************
>
> : SET.com.port,BAUD.RATE ( PORT baud.rate -- )
> over 1 20 ( 7 ) between not abort" com port 1 ~ 32 only "
> BAUD.RATE PORT ;
>
> CODE FLIP ( 1234 -- 3412 ) XCHG BH, BL NEXT C;
>
> CREATE cp0' 10000 ALLOT \ 64k byte
> VARIABLE cp' 0 cp' !
> : HERE' cp' @ ;
> : ORG cp' ! ;
> : ALLOT' cp' +! ;
> \ ----------------------
> : 16! >R 0FFFF AND 100 /MOD R@ 1+ C! R> C! ; \ high order number at
> high address \ little endian
> : C@' cp0' + C@ ; : 8@' c@' ;
> : C!' cp0' + C! ; : 8!' c!' ;
> : !' cp0' + 16! ; : 16!' !' ;
> : @' DUP C@' SWAP 1+ C@' 100 * OR ; : 16@' @' ;
> : +!' ( N ADDR' ... ) >R R@ @' + R> !' ;
> : C+!' ( BYTE ADDR' ... ) >R R@ C@' + R> C!' ;
>
> : 32@^ cp0' + @ ; \ 0~7 8~15 16~23 24~31
> : 24@^ 32@^ 0ffffff and ;
> : 16@^ 32@^ 0ffff and ;
>
> : 32@' cp0' + @ ; \ 0~7 8~15 16~23 24~31
> : 24@' 32@' 0ffffff and ; \ 0~7 8~15 16~23
> : 16@' 32@' 0ffff and ; \ 0~7 8~15
> : 8@' 32@' 0ff and ; \ 0~7
>
> : 16!' !' ; \ 0~7 8~15 ( L H )
> : 8!' c!' ; \ 0~7
>
> : @^ 16@' flip ;
> : 16@^ 16@' flip ; \ low order number at high address
> : !^ >r flip r> 16!' ;
> : 16!^ >r flip r> 16!' ; \ low order number at high address
>
> : @'n @' F1ff and ; \ special usage of rb=x
>
> : C,' ( BYTE ... ) HERE' C!' 1 ALLOT' ; : 8,' C,' ;
> : ,' ( n .. ... ) HERE' !' 2 ALLOT' ; : 16,' ,' ;
> : ,^ ( n ...... ) flip HERE' !' 2 ALLOT' ; \ : 16,' ,' ;
>
> : 16,^ ( 16bit... ) HERE' 16!^ 2 ALLOT' ;
>
> : cmove' ( from' to' length -- ) 0 ?do over i + c@' over i + c!' loop
> 2drop ;
>
> : CFA>CFA' ( CFA ... CFA' ) 4 + @ ;
> : >CFA' ( CFA ... CFA' ) 4 + @ ; \ ' CR' >CFA' == 386
> : CFA'.OF' ' CFA>CFA' ;
> : [CFA'.OF] ' CFA>CFA' [COMPILE] LITERAL ; IMMEDIATE
>
> : CFA'.OF STATE @ IF ['] [CFA'.OF] EXECUTE else CFA'.OF' THEN ;
> IMMEDIATE \ ????
> : '' STATE @ IF ['] [CFA'.OF] EXECUTE else CFA'.OF' THEN ; IMMEDIATE \
> ????
>
> VARIABLE 2nd.number
> defer _disassem.number.stack> \ behaving like r>
> defer _>disassem.number.stack \ behaving like >r
> variable last.char
> \ ----------------------
> : u.| ( n -- ) 0 (D.) TYPE ;
> : u.| ( n -- ) ffff and 0 (D.) TYPE ; \ msp430 16 bit system
>
> : 0u.| ( n -- ) dup 0a 0f between if '0' emit then
> dup 0a0 0ff between if '0' emit then u.| ;
>
> : check.b=1.or.not ( a' -- f ) >r
> r@ 16@' f000 and 4000 f000 between
> if -1
> else r@ 16@' ff80 and
> case 1000 of -1 endof
> 1100 of -1 endof
> 1200 of -1 endof
> 0 swap
> endcase
> then r>drop ;
>
> variable .b=1?
> : .b=1 .b=1? @ if ." b=1" then ;
>
> : (1")0 do i c@ emit loop .b=1 ;
> : (2")0 do i c@ emit loop .b=1 ;
> : (3")0 do i c@ emit loop .b=1 ;
> : (4")0 do i c@ emit loop .b=1 ;
>
> variable Virtue.Forth?
>
> : emit.vf.register ( n -- f )
> case 0 of ." pc" -1 endof
> 1 of ." sp" -1 endof
> 2 of ." sr" -1 endof
> 3 of ." cg" -1 endof
> 4 of ." w" -1 endof
> 5 of ." fsp" -1 endof
> 6 of ." frp" -1 endof
> 7 of ." W" -1 endof
> 8 of ." X" -1 endof
> 9 of ." Y" -1 endof
> 0a of ." T" -1 endof
> 0b of ." U" -1 endof
> 0c of ." V" -1 endof
> 0d of ." P" -1 endof
> 0e of ." M" -1 endof
> 0f of ." Q" -1 endof
> 0 swap
> endcase ;
>
> \ ******** lower letter r will be neglected. **********
> defer _emit.port.name ( a' -- )
> defer _emit.port.name' ( a' -- )
>
> : (1")1 \ ((")) COUNT bounds last.char off
> do i c@ 'R' =
> if Virtue.Forth? @ if _disassem.number.stack> emit.vf.register drop
> else 'R' emit _disassem.number.stack> u.| \ R16 R8 === R1234 R56
> then
> else i c@ '#' =
> if _disassem.number.stack> dup 0u.| _emit.port.name \ #
> else i c@ emit \ =F0123456
> then
> then
> loop .b=1 ;
>
> variable c.type?
>
> : (n")1 ( u l -- )
> do i c@ 'R' =
> if Virtue.Forth? @
> if emit.vf.register drop
> else 'R' emit u.| \ R16 R8 === R1234 R56
> then
> else i c@ '#' =
> if dup c.type? @
> if _emit.port.name' if drop else 0u.| then
> else 0u.| _emit.port.name
> then \ 0u.| \ #
> else i c@ emit \ =F0123456
> then
> then
> loop .b=1 ;
>
> \ (1")1 _disassem.number.stack> -rot (n")1 ;
> : (2")1 _disassem.number.stack> _disassem.number.stack> 2swap (n")1 ;
> : (3")1 _disassem.number.stack> _disassem.number.stack>
> _disassem.number.stack> >r 2swap r> -rot (n")1 ;
> : (4")1 _disassem.number.stack> _disassem.number.stack>
> _disassem.number.stack> _disassem.number.stack> 2rot (n")1 ;
>
> : ?y ( x -) getxy nip gotoxy ;
> : 24y 24 ?y ;
> : 2ay 2a ?y ;
> : 2cy 2c ?y ;
> : 31y 31 ?y ;
> : 2fy 2f ?y ;
> : 30y 30 ?y ;
> : 34y 34 ?y ;
> : 38y 38 ?y ;
> : 3cy 3c ?y ;
> : 3ey 3e ?y ;
> : 3fy 3f ?y ;
> : 40y 40 ?y ;
>
> variable h.mode
>
> : (1") 3fy ((")) COUNT bounds last.char off
> h.mode @
> case
> 0 of (1")0 endof
> 1 of (1")1 endof
> endcase ;
>
> : (2") 3fy ((")) COUNT bounds last.char off
> h.mode @
> case
> 0 of (2")0 endof
> 1 of (2")1 endof
> endcase ;
>
> : (3") 3fy ((")) COUNT bounds last.char off
> h.mode @
> case
> 0 of (3")0 endof
> 1 of (3")1 endof
> endcase ;
>
> : (4") 3fy ((")) COUNT bounds last.char off
> h.mode @
> case
> 0 of (4")0 endof
> 1 of (4")1 endof
> endcase ;
>
> : 1" COMPILE (1") ," ; IMMEDIATE
> : 2" COMPILE (2") ," ; IMMEDIATE
> : 3" COMPILE (3") ," ; IMMEDIATE
> : 4" COMPILE (4") ," ; IMMEDIATE
> \ ----------------------
> VARIABLE OUT.MODE 8 OUT.MODE !
> : .X ( N ... ) 0 <# # #> TYPE ;
> : .XX ( N ... ) 0 <# # # #> TYPE ;
> : .XXX ( N ... ) 0 <# # # # #> TYPE ;
> : .XXXX ( N ... ) 0 <# # # # # #> TYPE ;
> : .XXXXx ( N ... ) 0 <# # # # # # #> TYPE ;
> : .XXXXxx ( N ... ) 0 <# # # # # # # #> TYPE ;
> : .XXXXxxx ( N ... ) 0 <# # # # # # # # #> TYPE ;
> : .XXXXxxxx ( N ... ) 0 <# # # # # # # # # #> TYPE ;
>
> : .0XX ( N ... ) DUP $0A0 $0FF BETWEEN IF $30 EMIT ELSE SPACE THEN .XX
> ; \ 0a0 7f
>
> : .?XX(h) ( N ... ) dup 2nd.number ! h.mode @ 0<> if drop 3 spaces
> exit then
> DUP 0 9 BETWEEN if 4 spaces .x 50 ?y exit then \ 9
> DUP $0A $9f BETWEEN if 3 spaces .xx 50 ?y exit then \ 0a
> DUP $0A0 $0ff BETWEEN if 2 spaces '0' emit then .xx 50 ?y ; \ 0a0
>
> : .xxxx(h) h.mode @ 0<> if drop exit then .xxxx ;
> : .xxxx(h) h.mode @ 0<> if drop 50 ?y exit then
> dup 0a 0f between if 3 spaces '0' emit .x 50 ?y exit then
> dup 0a0 0ff between if 2 spaces '0' emit .xx 50 ?y exit then
> dup 0a00 0fff between if space '0' emit .xxx 50 ?y exit then
> 0ffff and 5 u.r 50 ?y ;
>
> VARIABLE SUM
> : .XX+SUM DUP SUM +! .XX ;
>
> : U> SWAP U< ;
>
> : .XX+SUM DUP SUM +! .XX ;
> : >A.LINE.OF.HEX.FORMAT ( ADDR LENGTH ... )
> ?DUP
> IF CR 0 SUM ! 3A EMIT DUP .XX+SUM
> OVER 100 /MOD .XX+SUM .XX+SUM
> 0 .XX
> BOUNDS
> DO I C@' .XX+SUM
> LOOP 100 SUM C@ - .XX
> ELSE DROP
> THEN ;
>
> : >HEX' ( FROM LENGTH ... ) \ CLS
> BEGIN DUP 10 U>
> WHILE OVER 10 >A.LINE.OF.HEX.FORMAT
> 10 - SWAP 10 + SWAP
> REPEAT >A.LINE.OF.HEX.FORMAT ;
>
> : >HEX ( CLS ) >HEX' CR ." :00000001FF" cr KEY DROP ;
>
> : HEX> ( ... ) CR ." *** please enter ???.HEX file *** "
> BEGIN
> BEGIN KEY 3A ( : ) =
> UNTIL \ cr
> KEY 10 DIGIT DROP 10 * KEY 10 DIGIT DROP + >R ( LENGTH )
> KEY 10 DIGIT DROP 10 * KEY 10 DIGIT DROP + 10 * ( ADDR H )
> KEY 10 DIGIT DROP + 10 * KEY 10 DIGIT DROP + ( ADDR L )
> KEY 10 DIGIT DROP 10 * KEY 10 DIGIT DROP + DROP ( RECORD )
> R@
> IF R> 0
> DO DUP I + KEY 10 DIGIT DROP 10 * KEY 10 DIGIT DROP + SWAP CP0' + C!
> LOOP DROP 0
> ELSE R> 2DROP DROP -1
> THEN
> UNTIL QUIT ;
>
> : >HEXX' ( FROM LENGTH ... ) CLS
> BEGIN DUP 20 U>
> WHILE OVER 20 >A.LINE.OF.HEX.FORMAT
> 20 - SWAP 20 + SWAP
> REPEAT >A.LINE.OF.HEX.FORMAT ;
>
> : >HEXXX' ( FROM LENGTH ... ) CLS
> BEGIN DUP 30 U>
> WHILE OVER 30 >A.LINE.OF.HEX.FORMAT
> 30 - SWAP 30 + SWAP
> REPEAT >A.LINE.OF.HEX.FORMAT ;
>
> : >HEXXXX' ( FROM LENGTH ... ) CLS
> BEGIN DUP 38 U>
> WHILE OVER 38 >A.LINE.OF.HEX.FORMAT
> 38 - SWAP 38 + SWAP
> REPEAT >A.LINE.OF.HEX.FORMAT ;
>
> : >HEXX >HEXX' CR ." :00000001FF" KEY DROP ;
> : >HEXXX >HEXXX' CR ." :00000001FF" KEY DROP ;
> : >HEXXXX >HEXXXX' CR ." :00000001FF" KEY DROP ;
> \ ----------------------
> : >db ( from length -- ) cr over ." ORG 0x" .xxxx 0
> do i 10 mod 0= if 8 emit space cr ." DB " then
> dup i + c@' ." 0x" .xx ',' emit
> loop 8 emit space drop cr ." END" quit ;
>
> : >TI ( from length -- ) cls cr over ." @" .xxxx 0
> do i 10 mod 0= if cr then
> dup i + c@' .xx space
> loop drop cr ." q" quit ;
> \ ----------------------
> \ from �i�P�n
> anew Buffer_To_Hex
>
> : display.error.message ( message.addr length --- ) ErrorBox ;
>
> : open.file ( file.head.seres.number --- )
> close-file 0 <>
> if
> s" open.file.fail!" display.error.message
> then
> ;
>
> : new.file ( file.name.location file.name.length file.attribute ---
> file.head.seres.number )
> rot rot drop 1 - swap
> 2dup
> swap count rot
> open-file 0 <>
> if
> drop
> swap count rot
> create-file 0 <>
> if
> s" new.file.fail!" display.error.message
> then
> else
> rot rot 2drop
> then
> ;
>
> : write.file ( start.addr length file.head.seres.number --- )
> write-file 0 <>
> if
> s" write.file.fail!" display.error.message bye
> then
> ;
> decimal
> 0 value fhd
> DEFER _new.file
> DEFER _write.file
> DEFER _open.file
>
> ' new.file IS _new.file
> ' write.file IS _write.file
> ' open.file IS _open.file
>
> create buf 1024 allot
>
> : Buffer_To_Hex ( --- )
> hex
> s" xxx.hex" R/W new.file to fhd
> 1024 0 do
> buf i + c@ s>d <# # # #> fhd write.file
> \ crlf$ count fhd write.file
> loop fhd open.file DECIMAL ;
>
> : demo
> cls
> 11 buf 1 + c!
> 22 buf 2 + c!
> 33 buf 3 + c!
> buf 20 dump
> Buffer_To_Hex ;
>
> : demo1
> cls
> 44 buf 4 + c!
> 55 buf 5 + c!
> 66 buf 6 + c!
> buf 20 dump
> Buffer_To_Hex ;
>
> : DATA>HEX.FILE ( DATA ... ) BASE @ >R hex s>d <# # # #> fhd
> write.file R> BASE ! ;
> hex
> : 8K>Hex ( --- ) hex
> s" xxx.hex" R/W new.file to fhd
> 2000 0
> do I 20 MOD 0 = IF CRLF$ count fhd write.file THEN
> i c@' s>d <# # # #> fhd write.file
> loop fhd open.file ;
>
> : crlf>file crlf$ count fhd write.file ;
>
> : .xx' ( n ... ) s>d <# # # #> fhd write.file ( write.file ) ;
>
> : .XX+SUM' DUP SUM +! .XX' ;
> : >A.LINE.OF.HEX.FORMAT' ( ADDR LENGTH ... )
> ?DUP
> IF ( crlf>file ) 0 SUM ! ( 3A EMIT ) s" :" fhd write.file DUP .XX+SUM'
> OVER 100 /MOD .XX+SUM' .XX+SUM'
> 0 .XX'
> BOUNDS
> DO I C@' .XX+SUM'
> LOOP 100 SUM C@ - .XX' crlf>file
> ELSE DROP
> THEN ;
>
> : >HEX.file' ( FROM LENGTH ... )
> BEGIN DUP 10 U>
> WHILE OVER 10 >A.LINE.OF.HEX.FORMAT'
> 10 - SWAP 10 + SWAP
> REPEAT >A.LINE.OF.HEX.FORMAT' ;
>
> : >HEX.file ( FROM LENGTH ... ) BASE @ >R HEX
> ( CLS ) s" 1.hex" R/W new.file to fhd >HEX.file'
> crlf>file s" :00000001FF" fhd write.file ( write.file ) fhd open.file
> R> BASE ! ;
>
> variable ROM.BASE.ADDR
>
> : 8K ROM.BASE.ADDR @ 2000 >hex.file ;
> : 15K ROM.BASE.ADDR @ 3E00 >hex.file ;
> : 16K ROM.BASE.ADDR @ 4000 >hex.file ;
> : 32K ROM.BASE.ADDR @ 8000 >hex.file ;
> : 64K ROM.BASE.ADDR @ 10000 >hex.file ;
> : 62K ROM.BASE.ADDR @ F800 >hex.file ; \ F800 = 63448 =62*1024 =62K
> K=1024
>
> : 1.hex PROGRAM.START @ ( f800 ) PROGRAM.LENGTH @ ( 800 ) >hex.file ;
> \ ----------------------
> : EXTEND ( N ... N1 )
> CASE 0 OF 1 ENDOF
> 1 OF 3 ENDOF
> 2 OF 7 ENDOF
> 3 OF 0F ENDOF
> 4 OF 1F ENDOF
> 5 OF 3F ENDOF
> 6 OF 7F ENDOF
> 7 OF 0FF ENDOF
> 8 OF 1FF ENDOF
> 9 OF 3FF ENDOF
> 0A OF 7FF ENDOF
> 0B OF 0FFF ENDOF
> 0C OF 1FFF ENDOF
> 0D OF 3FFF ENDOF
> 0E OF 7FFF ENDOF
> 0F OF 0FFFF ENDOF
> 10 OF 1FFFF ENDOF
> 11 OF 3FFFF ENDOF
> 12 OF 3FFFF ENDOF
> 13 OF 7FFFF ENDOF
> 14 OF 0FFFFF ENDOF
> 15 OF 1FFFFF ENDOF
> 16 OF 3FFFFF ENDOF
> 17 OF 7FFFFF ENDOF
> 18 OF 0FFFFFF ENDOF
> 19 OF 1FFFFFF ENDOF
> 1A OF 3FFFFFF ENDOF
> 1B OF 7FFFFFF ENDOF
> 1C OF 0FFFFFFF ENDOF
> 1D OF 1FFFFFFF ENDOF
> 1E OF 3FFFFFFF ENDOF
> 1F OF 7FFFFFFF ENDOF
> ENDCASE ;
>
> CREATE N>2^n.MASK 1 , 3 , 7 , 0F ,
> 1F , 3F , 7F , 0FF ,
> 1FF , 3FF , 7FF , 0FFF ,
> 1FFF , 3FFF , 7FFF , 0FFFF ,
> 1FFFF , 3FFFF , 7FFFF , 0FFFFF ,
> 1FFFFF , 3FFFFF , 7FFFFF , 0FFFFFF ,
> 1FFFFFF , 3FFFFFF , 7FFFFFF , 0FFFFFFF ,
> 1FFFFFFF , 3FFFFFFF , 7FFFFFFF , 0FFFFFFFF ,
>
> : EXTEND' ( N ... N1 ) DUP 0 1F BETWEEN 0= ABORT" must be in the range
> 0~1F"
> 4 * N>2^n.MASK + @ ;
>
> : 2^n ( n ... 2^n ) 1 SWAP 0 ?DO 2* LOOP ;
> : 2^n ( n ... 2^n ) 1 swap lshift ;
> : 2^n/ ( n ... 2^n/ ) 2^n -1 XOR ;
>
> : SIGN.EXTEND.n ( N1 n.bit ... N2 ) >R R@ 2^N OVER AND
> IF R@ EXTEND AND R> EXTEND -1 XOR OR
> ELSE R> DROP
> THEN ;
>
> : SIGN.EXTEND ( BYTE ... N ) drop DUP 7F > IF FFFFFF00 OR THEN ; \
> weForth 32 bits
>
> : TP1 CR ." TP1: " .S ;
> : TP2 CR ." TP2: " .S ;
> : TP3 CR ." TP3: " .S ;
> : TP4 CR ." TP4: " .S ;
> : TP5 CR ." TP5: " .S ;
> : TP6 CR ." TP6: " .S ;
> : TP7 CR ." TP7: " .S ;
> : TP8 CR ." TP8: " .S ;
> : TP9 CR ." TP9: " .S ;
> : TP10 CR ." TP10: " .S ;
> : TP11 CR ." TP11: " .S ;
> : TP12 CR ." TP12: " .S ;
> : TP13 CR ." TP13: " .S ;
> : TP14 CR ." TP14: " .S ;
> : TP15 CR ." TP15: " .S ;
> : TP16 CR ." TP16: " .S ;
> : TP17 CR ." TP17: " .S ;
> : TP18 CR ." TP18: " .S ;
> : TP19 CR ." TP19: " .S ;
> : TP20 CR ." TP20: " .S ;
> : TP21 CR ." TP21: " .S ;
> : TP22 CR ." TP22: " .S ;
> : TP23 CR ." TP23: " .S ;
> : TP24 CR ." TP24: " .S ;
>
> : {:NFA.QUEUE.MAX 1000 ( 200 ) ;
> VARIABLE {:NFA.QUEUE.COUNTER
> CREATE {:NFA.QUEUE {:NFA.QUEUE.MAX 2 CELLS ( 6 ) * ALLOT
> : ERASE.{:NFA.QUEUE {:NFA.QUEUE {:NFA.QUEUE.MAX 2 CELLS ( 6 ) * ERASE ;
>
> : T:QUEUE.MAX 1000 ( 200 ) ;
> VARIABLE T:QUEUE.COUNTER
> CREATE T:QUEUE T:QUEUE.MAX 2 CELLS ( 6 ) * ALLOT
> : ERASE.T:QUEUE T:QUEUE T:QUEUE.MAX 2 CELLS ( 6 ) * ERASE ;
>
> VARIABLE PROGRAM.MEMORY.R.SIZE 1000 PROGRAM.MEMORY.R.SIZE !
> : R:QUEUE.MAX PROGRAM.MEMORY.R.SIZE @ 8 / ;
>
> VARIABLE R:QUEUE.COUNTER
> CREATE R:QUEUE R:QUEUE.MAX 2 CELLS ( 6 ) * ALLOT
> : ERASE.R:QUEUE R:QUEUE R:QUEUE.MAX 2 CELLS ( 6 ) * ERASE ;
> ERASE.R:QUEUE
>
> VARIABLE LAYER 0 LAYER !
> : LAYER' LAYER @ 0 < IF 0 LAYER ! THEN LAYER ;
>
> variable name.in.nfa.queue
>
> VARIABLE T:NFA.QUEUE.LENGTH 4000 T:NFA.QUEUE.LENGTH !
> CREATE T:NFA.QUEUE T:NFA.QUEUE.LENGTH @ ALLOT
> VARIABLE T:NFA.QUEUE.COUNTER
> VARIABLE former.T:NFA.QUEUE.addr
> : ERASE.T:NFA.QUEUE T:NFA.QUEUE T:NFA.QUEUE.LENGTH @ ERASE ;
> ERASE.T:NFA.QUEUE
>
> : JAM.INTO.T:NFA.QUEUE ( ADDR LENGTH HERE' ... )
> T:NFA.QUEUE.COUNTER @ T:NFA.QUEUE + ! 4 T:NFA.QUEUE.COUNTER +! >R \
> CFA'=T:ADDR
> former.T:NFA.QUEUE.addr @ T:NFA.QUEUE T:NFA.QUEUE.COUNTER @ + ! 4
> T:NFA.QUEUE.COUNTER +! \ LFA'
> T:NFA.QUEUE.COUNTER @ former.T:NFA.QUEUE.addr ! R@ \
> T:NFA.QUEUE.COUNTER @ T:NFA.QUEUE + C! 1 T:NFA.QUEUE.COUNTER +! \ LENGTH
> T:NFA.QUEUE.COUNTER @ T:NFA.QUEUE + dup name.in.nfa.queue ! R@ CMOVE \
> NAME
> T:NFA.QUEUE.COUNTER @ R> + T:NFA.QUEUE.COUNTER ! ;
>
> VARIABLE p:NFA.QUEUE.LENGTH 4000 p:NFA.QUEUE.LENGTH !
> CREATE p:NFA.QUEUE p:NFA.QUEUE.LENGTH @ ALLOT
> VARIABLE p:NFA.QUEUE.COUNTER
> VARIABLE former.p:NFA.QUEUE.addr
> : ERASE.p:NFA.QUEUE p:NFA.QUEUE p:NFA.QUEUE.LENGTH @ ERASE ;
> ERASE.p:NFA.QUEUE
>
> VARIABLE inst:NFA.QUEUE.LENGTH 8000 inst:NFA.QUEUE.LENGTH !
> CREATE inst:NFA.QUEUE inst:NFA.QUEUE.LENGTH @ ALLOT
> VARIABLE inst:NFA.QUEUE.COUNTER
> VARIABLE former.inst:NFA.QUEUE.addr
> : ERASE.inst:NFA.QUEUE inst:NFA.QUEUE inst:NFA.QUEUE.LENGTH @ ERASE ;
> ERASE.inst:NFA.QUEUE
>
> VARIABLE {:NFA.QUEUE.LENGTH 4000 {:NFA.QUEUE.LENGTH !
> CREATE {:NFA.QUEUE {:NFA.QUEUE.LENGTH @ ALLOT
> VARIABLE {:NFA.QUEUE.COUNTER
> VARIABLE former.{:NFA.QUEUE.addr
> : ERASE.{:NFA.QUEUE {:NFA.QUEUE {:NFA.QUEUE.LENGTH @ ERASE ;
> ERASE.{:NFA.QUEUE
>
> create header.string 40 allot
> : >header.string ( a length -- ) dup header.string c! header.string 1+
> swap cmove ;
> create header.string.p 40 allot
> : >header.string.p ( a length -- ) dup header.string.p c!
> header.string.p 1+ swap cmove ;
>
> VARIABLE former.p:NFA.QUEUE.addr
> : ERASE.p:NFA.QUEUE p:NFA.QUEUE p:NFA.QUEUE.LENGTH @ ERASE ;
> ERASE.p:NFA.QUEUE
>
> VARIABLE former.{:NFA.QUEUE.addr
> : ERASE.{:NFA.QUEUE {:NFA.QUEUE {:NFA.QUEUE.LENGTH @ ERASE ;
> ERASE.{:NFA.QUEUE
>
> VARIABLE former.inst:NFA.QUEUE.addr
> : ERASE.inst:NFA.QUEUE inst:NFA.QUEUE inst:NFA.QUEUE.LENGTH @ ERASE ;
> ERASE.inst:NFA.QUEUE
>
> : JAM.INTO.inst:NFA.QUEUE ( ADDR LENGTH cfa ... )
> inst:NFA.QUEUE.COUNTER @ inst:NFA.QUEUE + ! 4 inst:NFA.QUEUE.COUNTER
> +! >R \ CFA'=inst;ADDR
> former.inst:NFA.QUEUE.addr @ inst:NFA.QUEUE inst:NFA.QUEUE.COUNTER @ +
> ! 4 inst:NFA.QUEUE.COUNTER +! \ LFA'
> inst:NFA.QUEUE.COUNTER @ former.inst:NFA.QUEUE.addr ! R@ \
> inst:NFA.QUEUE.COUNTER @ inst:NFA.QUEUE + C! 1 inst:NFA.QUEUE.COUNTER
> +! \ LENGTH
> inst:NFA.QUEUE.COUNTER @ inst:NFA.QUEUE + dup name.in.nfa.queue ! R@
> CMOVE \ NAME
> inst:NFA.QUEUE.COUNTER @ R> + inst:NFA.QUEUE.COUNTER !
> header.string dup>r inst:NFA.QUEUE.COUNTER @ inst:NFA.QUEUE + r@ c@ 1+
> cmove
> r> c@ 1+ inst:NFA.QUEUE.COUNTER +! ;
>
> : JAM.INTO.{:NFA.QUEUE ( ADDR LENGTH cfa ... )
> {:NFA.QUEUE.COUNTER @ {:NFA.QUEUE + ! 4 {:NFA.QUEUE.COUNTER +! >R \
> CFA'={;ADDR
> former.{:NFA.QUEUE.addr @ {:NFA.QUEUE {:NFA.QUEUE.COUNTER @ + ! 4
> {:NFA.QUEUE.COUNTER +! \ LFA'
> {:NFA.QUEUE.COUNTER @ former.{:NFA.QUEUE.addr ! R@ \
> {:NFA.QUEUE.COUNTER @ {:NFA.QUEUE + C! 1 {:NFA.QUEUE.COUNTER +! \ LENGTH
> {:NFA.QUEUE.COUNTER @ {:NFA.QUEUE + dup name.in.nfa.queue ! R@ CMOVE \
> NAME
> {:NFA.QUEUE.COUNTER @ R> + {:NFA.QUEUE.COUNTER !
> header.string dup>r {:NFA.QUEUE.COUNTER @ {:NFA.QUEUE + r@ c@ 1+ cmove
> r> c@ 1+ {:NFA.QUEUE.COUNTER +! ;
>
> : JAM.INTO.p:NFA.QUEUE ( ADDR LENGTH cfa ... )
> p:NFA.QUEUE.COUNTER @ p:NFA.QUEUE + ! 4 p:NFA.QUEUE.COUNTER +! >R \
> CFA'=p;ADDR
> former.p:NFA.QUEUE.addr @ p:NFA.QUEUE p:NFA.QUEUE.COUNTER @ + ! 4
> p:NFA.QUEUE.COUNTER +! \ LFA'
> p:NFA.QUEUE.COUNTER @ former.p:NFA.QUEUE.addr ! R@ \
> p:NFA.QUEUE.COUNTER @ p:NFA.QUEUE + C! 1 p:NFA.QUEUE.COUNTER +! \ LENGTH
> p:NFA.QUEUE.COUNTER @ p:NFA.QUEUE + dup name.in.nfa.queue ! R@ CMOVE \
> NAME
> p:NFA.QUEUE.COUNTER @ R> + p:NFA.QUEUE.COUNTER !
> header.string.p dup>r p:NFA.QUEUE.COUNTER @ p:NFA.QUEUE + r@ c@ 1+ cmove
> r> c@ 1+ p:NFA.QUEUE.COUNTER +! ;
>
> : <-macro ( -- ) here' dup>r last @ name> dup>r execute here' over - (
> a length ) r> rot cp0' + -rot JAM.INTO.{:NFA.QUEUE r> org ;
> : <-p ( -- ) here 8 - 4 last @ name> JAM.INTO.p:NFA.QUEUE ;
>
> VARIABLE S"=?
>
> : S"= ( STRING1 STRING2 ... F ) ROT OVER = \ STRING == ADDR LENGTH
> IF 0 -1 S"=? ! \ ADDR1 ADDR2 LENGTH \ LENGTH = LENGTH1 = LENGTH2
> DO OVER I + C@ OVER I + C@ <>
> IF 0 S"=? ! LEAVE
> THEN
> LOOP 2DROP S"=? @
> ELSE 2DROP DROP 0
> THEN ;
>
> : S= S"= ;
> : S<> S= NOT ;
>
> variable head.line
> variable head.counter
>
> : DUMP.HEAD.IMAGE ( ... ) former.T:NFA.QUEUE.addr @ head.counter off
> BEGIN KEY? IF DROP EXIT THEN 1 head.counter +!
> CR base @ >r decimal head.counter @ ." (" 4 .r ." )" r> base !
> DUP T:NFA.QUEUE + 8 - @ 0A U.R \ T:ADDR cfa'
> DUP T:NFA.QUEUE + 4 - @ 0A U.R 9 SPACES \ LFA
> DUP T:NFA.QUEUE + COUNT TYPE ( .NAME ) \ NAME
> T:NFA.QUEUE + 4 - @ ?DUP 0=
> UNTIL ;
>
> : DUMP.HEAD.IMAGE.msp430 ( ... ) former.T:NFA.QUEUE.addr @ cr 1
> head.line ! 50 ?y head.counter off
> BEGIN 1 head.counter +!
> getxy drop 38 > if cr ." (" base @ >r decimal head.line @ 1 head.line
> +! 4 .r r> base ! ." )" then 2 spaces
> DUP T:NFA.QUEUE + COUNT TYPE ( .NAME ) \ NAME
> T:NFA.QUEUE + 4 - @ ?DUP 0=
> UNTIL ;
>
> variable cfa'>.ID?
> variable cfa.inst>.ID?
>
> : cfa'in.NFA.QUEUE? ( cfa'-- f ) T:NFA.QUEUE cfa'>.ID? off
> T:QUEUE.counter @ 8 / 0
> ?do 2dup @ =
> if cfa'>.ID? on leave
> then 8 + count +
> loop 2drop cfa'>.ID? @ ;
>
> : cfa'>.ID ( cfa'-- f ) T:NFA.QUEUE cfa'>.ID? off
> T:QUEUE.counter @ 8 / 0
> ?do 2dup @ =
> if dup 8 + count type cfa'>.ID? on leave
> then 8 + count +
> loop 2drop cfa'>.ID? @ ;
>
> : cfa.in.inst.NFA.QUEUE? ( cfa -- f ) inst:NFA.QUEUE cfa.inst>.ID? off
> inst:NFA.QUEUE.counter @ 8 / 0
> ?do 2dup @ =
> if cfa.inst>.ID? on leave
> then 8 + count +
> loop 2drop cfa.inst>.ID? @ ;
>
> : cfa.inst>.ID ( cfa -- f ) inst:NFA.QUEUE cfa.inst>.ID? off \ '.
> swapb.r cfa.inst>.ID .. -1
> inst:NFA.QUEUE.counter @ 8 / 0
> ?do 2dup @ =
> if dup 8 + count type cfa.inst>.ID? on leave
> then 8 + count +
> loop 2drop cfa.inst>.ID? @ ;
>
> : \.48--- ." \ " 48 0 do '-' emit loop ;
>
> : cfa'>head ( cfa'-- ) T:NFA.QUEUE
> T:QUEUE.counter @ 8 / 0
> ?do 2dup @ =
> if \.48---
> cr 1e ?y ." t: " dup 8 + count type cr leave
> then 8 + count +
> loop 2drop ;
>
> : emit.port.name' ( port -- f ) >r former.p:NFA.QUEUE.addr @
> p:NFA.QUEUE +
> begin 4 - @ dup 0<>
> while p:NFA.QUEUE + dup 1+ @ r@ =
> if r>drop ( getxy 2>r 55 ?y ." \ " ) 5 + count type ( 2r> gotoxy ) -1
> exit
> then
> repeat r>drop drop 0 ;
>
> ' emit.port.name' is _emit.port.name'
>
> variable total.of.name.of.#.to.print
>
> : emit.port.name ( port -- ) >r former.p:NFA.QUEUE.addr @ p:NFA.QUEUE +
> begin 4 - @ dup 0<>
> while p:NFA.QUEUE + dup 1+ @ r@ =
> if r>drop getxy 2>r total.of.name.of.#.to.print @ 1 =
> if 65 ?y 15 spaces 67 ?y
> else 55 ?y ." \ "
> then 5 + count type 2r> gotoxy 1 total.of.name.of.#.to.print +! exit
> then
> repeat drop r>drop ;
>
> : dump.port.name ( ------- ) ( cls ) former.p:NFA.QUEUE.addr @
> p:NFA.QUEUE +
> begin 4 - @ dup 0<>
> while p:NFA.QUEUE + dup cr ." :p " 5 + count type dup 1 + @ 28 ?y 9
> u.r ." p; "
> repeat drop r>drop ;
>
> ' emit.port.name is _emit.port.name
>
> variable CFA'.OF._T:?
>
> : CFA'>NFA ( CFA' ... NFA' -1 /0 ) 0 CFA'.OF._T:? !
> T:QUEUE.MAX 2 CELLS ( 6 ) * 0
> DO DUP T:QUEUE I + ( 2 + ) @ ( 16@ ) =
> IF T:QUEUE I + CELL ( 2 ) + @ -1 CFA'.OF._T:? ! SWAP LEAVE
> THEN 2 CELLS ( 6 )
> +LOOP DROP CFA'.OF._T:? @ ;
>
> : CFA'>CFA CFA'>NFA IF NAME> -1 ELSE 0 THEN ;
>
> VARIABLE ENGLISH? ENGLISH? ON
>
> : CFA'>NFA' ( CFA' ... NFA' -1 / 0 ) >R
> former.T:NFA.QUEUE.addr @
> BEGIN DUP T:NFA.QUEUE + 8 - @ R@ =
> IF DUP T:NFA.QUEUE + 4 - @ DUP
> T:NFA.QUEUE + 8 - @ R@ =
> IF R>DROP ENGLISH? @ IF NIP ELSE DROP THEN
> ELSE R>DROP DROP
> THEN -1 EXIT
> THEN T:NFA.QUEUE + 4 - @ ?DUP 0=
> UNTIL R>DROP 0 ;
>
> : count' ( a' -- a+1' n ) dup 1+ swap c@' ;
> : type' ( a' n ------- ) swap cp0' + swap type ;
>
> : CFA>NFA' ( CFA ... NFA' ) 4 + @ ( CFA>CFA' ) CFA'>NFA' dup 0= ABORT"
> *** CFA'>NFA' failed *** " ;
>
> : .ID(original) ( NFA .......... ) ?DUP 0<> IF NAME> CFA>NFA'
> T:NFA.QUEUE + COUNT TYPE THEN ;
> : GET.ID(original).LENGTH ( NFA ... LENGTH ) DUP 0<> IF NAME> CFA>NFA'
> T:NFA.QUEUE + COUNT NIP THEN ;
> \
> ***************************************************************************************************************
>
> DEFER _[J]
>
> : _HEADER'p 7D0 ( 2000 ) ?MEMCHK BL WORD COUNT 2dup >header.string.p
> "HEADER ;
> : _HEADER' 7D0 ( 2000 ) ?MEMCHK BL WORD COUNT 2dup >header.string
> "HEADER ;
> : :{ PARMS-INIT _HEADER' HIDE DOCOL , !CSP ] ;
> : :p PARMS-INIT _HEADER'p HIDE DOCOL , !CSP ] ;
>
> : }; ( -- )
> ?COMP
> ?:M ( -- F1 )
> FALSE TO ?:M
> ( -- f1 ) ABORT" Methods must END in ;M !"
> ?CSP REVEAL
> PARMS
> IF COMPILE UNNESTP
> ELSE COMPILE UNNEST
> THEN [COMPILE] [ 0 TO PARMS DO-;CHAIN <-macro ; IMMEDIATE
>
> : p; ( -- )
> ?COMP
> ?:M ( -- F1 )
> FALSE TO ?:M
> ( -- f1 ) ABORT" Methods must END in ;M !"
> ?CSP REVEAL
> PARMS
> IF COMPILE UNNESTP
> ELSE COMPILE UNNEST
> THEN [COMPILE] [ 0 TO PARMS DO-;CHAIN <-p ; IMMEDIATE
> CREATE :" 80 ALLOT
>
> : CREATE.ANOTHER.COLON.INSTRUCTION 7D0 ?MEMCHK BL WORD COUNT >R
> :" 1+ R@ CMOVE '"' :" C! '"' R@ 1+ :" + C! :" R> 2 + "HEADER DOVAR , ;
>
> : CREATE.ACI CREATE.ANOTHER.COLON.INSTRUCTION ;
>
> : 8,' c,' ;
>
> : even.aligned ( a1' --- a2' ) 1+ fffffffe and ;
>
> variable here'.even.aligned? here'.even.aligned? on
>
> : here'.even.aligned here'.even.aligned? @ if here' 1 and if 0 c,'
> then then ;
> : here'.even here' here'.even.aligned? @ if 1+ 0fffffffe then ;
> : (CREATE)inst 7D0 ( 2000 ) ?MEMCHK BL WORD COUNT 2dup HERE
> JAM.INTO.inst:NFA.QUEUE "HEADER DOVAR , ; ( headless )
> : (CREATE) 7D0 ( 2000 ) ?MEMCHK BL WORD COUNT 2dup HERE'
> JAM.INTO.T:NFA.QUEUE "HEADER DOVAR , ; ( headless )
> \ ----------------------
> : T: \ headless tforth
> \ 8(1)tF/16(0)teF.system @ 0= drop 0 if here'.even.aligned then \ 16
> bit eForth uses even address system only.
> >IN @ >R CREATE.ACI HERE' , _[J] R> >IN !
> (CREATE) HERE' , HERE' T:QUEUE T:QUEUE.COUNTER @ + !
> LAST @ T:QUEUE T:QUEUE.COUNTER @ + CELL + !
> 2 CELLS ( 6 ) T:QUEUE.COUNTER +!
> DOES> @ op.code.of.call @ ( 12b0 ) ( As=3 R0 ) 16,' 16,' ; \ (r0+) (
> RCALL ) CALL' ;
> : 16: t: ;
> \ ----------------------
> : immediate' ( -- ) last' @ c@' 80 or last' @ c!' ;
> : compile-only' ( -- ) last' @ c@' 40 or last' @ c!' ;
>
> : 2+ 2 + ;
> : 2- 2 - ;
> : 3+ 3 + ;
> : 3- 3 - ;
> : 4+ 4 + ;
> : 4- 4 - ;
> : 5+ 5 + ;
> : 5- 5 - ;
>
> variable former.instruction's.nfa
> variable instruction.n
>
> : get.total.instructions ( -- n ) last' @ instruction.n off \ 8051
> begin 2- @' dup 0= 1 instruction.n +!
> until drop instruction.n @ ;
>
> : get.total.instructions^ ( -- n ) last' @ instruction.n off \ stm8s
> begin 2- @^ dup 0= 1 instruction.n +!
> until drop instruction.n @ ;
>
> : find.next.instruction's.nfa^ ( nfa1 -- nfa2 no | 0 ) last' @
> instruction.n off \ stm8s
> begin >r r@ 2- @^ former.instruction's.nfa ! 1 instruction.n +!
> r> 2- @^ dup 0= if 2drop 0 exit then 2dup =
> until 2drop ( former.instruction's.nfa @ ) last' @ instruction.n @ 1- 0
> ?do 2- @^
> loop ;
>
> : find.next.instruction's.nfa ( nfa1 -- nfa2 no | 0 ) last' @
> instruction.n off \ 8051
> begin >r r@ 2- @' former.instruction's.nfa ! 1 instruction.n +!
> r> 2- @' dup 0= if 2drop 0 exit then 2dup =
> until 2drop ( former.instruction's.nfa @ ) last' @ instruction.n @ 1- 0
> ?do 2- @'
> loop ;
>
> : nfa'>cfa' ( nfa' -- cfa' ) count' 1f and + even.aligned ;
>
> : don't.use.same.name ( --) last' @ \ >name' nfa of COLD ===> 955e
> last' @ decompile
> begin dup>r count' 1f and 2>r \ type'
> cr ." defer " 2r@ type' ." ." 20 ?y ." ' " 2r@ type' 3b ?y ." is " 2r@
> type' ." . " 56 ?y ." : " 2r> type' ." don't.use ; "
> r> 2- @' ?dup 0= key? or
> until ;
>
> : don't.use.same.name^ ( --) last' @ \ >name' nfa of COLD ===> 955e
> last' @ decompile
> begin dup>r count' 1f and 2>r \ type'
> cr ." defer " 2r@ type' ." ." 20 ?y ." ' " 2r@ type' 3b ?y ." is " 2r@
> type' ." . " 56 ?y ." : " 2r> type' ." don't.use ; "
> r> 2- @^ ?dup 0= key? or
> until ;
>
> : \.3f--- cr ." \ " 3f 0 do '-' emit loop ;
> : \.3f*** cr ." \ " 3f 0 do '*' emit loop ;
>
> : find.current.instruction's.nfa ( cfa1 -- nfa2 no | 0 ) last' @
> instruction.n off
> begin >r r@ 2- @' former.instruction's.nfa ! 1 instruction.n +!
> r> 2- @' dup 0= if 2drop 0 exit then 2dup u>
> until 2drop ( former.instruction's.nfa @ ) last' @ instruction.n @ (
> 1+ ) 0
> ?do 2- @'
> loop ;
>
> : find.current.instruction's.nfa^ ( cfa1 -- nfa2 no | 0 ) last' @
> instruction.n off
> begin >r r@ 2- @^ former.instruction's.nfa ! 1 instruction.n +!
> r> 2- @^ dup 0= if 2drop 0 exit then 2dup u>
> until 2drop ( former.instruction's.nfa @ ) last' @ instruction.n @ (
> 1+ ) 0
> ?do 2- @^
> loop ;
>
> variable xxx
> : name>' ( nfa' -- cfa' ) count' 1f and + even.aligned ;
>
> : >name' ( cfa' -- nfa' | 0 ) \ find.current.instruction's.nfa ;
> last' @ \ cfa nfa
> begin dup \ cfa nfa nfa
> if dup name>' >r over r> xor \ cfa nfa cfa<>cfa'
> if 2 - @' 0 \ cfa nfa'
> else nip exit \
> then \
> else -1 \
> then
> until 2drop 0 ;
>
> : >name^ ( cfa' -- nfa' | 0 ) \ find.current.instruction's.nfa ;
> last' @ \ cfa nfa
> begin dup \ cfa nfa nfa
> if dup name>' >r over r> xor \ cfa nfa cfa<>cfa'
> if 2 - @^ 0 \ cfa nfa'
> else nip exit \
> then \
> else -1 \
> then
> until 2drop 0 ;
>
> : .id'(cfa'.in.t:nfa.queue) ( cfa' -- ) >r t:nfa.queue
> begin dup @ r@ =
> if r>drop 8 + count 1f and type exit
> then 8 + count 1f and + dup @ 0=
> until r>drop drop ;
>
> : .id' ( nfa' -- ) nfa'>cfa' .id'(cfa'.in.t:nfa.queue) ;
> : .$' ( a -- ) count' type' ;
>
> : (.1234.................) ( a -) ." ( " .xxxx space 12 spaces ." ) " ;
> : (.1234..??????????????.) ( a n -) ." ( " over .xxxx space bounds do
> space i c@' .xx loop ." ) " ;
> : (.1234..55.............) ( a -) ." ( " dup .xxxx space 1 bounds do
> space i c@' .xx loop 0f spaces ." ) " ;
> : (.1234..55.66..........) ( a -) ." ( " dup .xxxx space 2 bounds do
> space i c@' .xx loop 0c spaces ." ) " ;
> : (.1234..55.66.77.......) ( a -) ." ( " dup .xxxx space 3 bounds do
> space i c@' .xx loop 9 spaces ." ) " ;
> : (.1234..55.66.77.88....) ( a -) ." ( " dup .xxxx space 4 bounds do
> space i c@' .xx loop 6 spaces ." ) " ;
> : (.1234..55.66.77.88.99.) ( a -) ." ( " dup .xxxx space 5 bounds do
> space i c@' .xx loop ." ) " ;
> : (.1234..55.66.77.88.99.)nfa ( a -) ." ( " dup .xxxx space dup count'
> nip 1f and 1+ 5 min dup>r bounds
> do space i c@' .xx loop 5 r> - 3 * spaces 3 spaces ." ) " ;
> : (.1234..55.66.77.88.99.aa.) ( a -) ." ( " dup .xxxx space 6 bounds
> do space i c@' .xx loop ." )" ;
>
> : %0 dup (.1234.................) 34y ; ( a' -- a' )
> : %1 dup (.1234..55.............) 34y ;
> : %2 dup (.1234..55.66..........) 34y ;
> : %3 dup (.1234..55.66.77.......) 34y ;
> : %4 dup (.1234..55.66.77.88....) 34y ;
> : %5 dup (.1234..55.66.77.88.99.) 34y ;
> : %5n dup (.1234..55.66.77.88.99.)nfa 34y ;
> : %6 dup (.1234..55.66.77.88.99.aa.) 34y ;
>
> : set..b=1? ( a' -- ) >r r@ check.b=1.or.not r> 16@' 40 and and if
> .b=1? on else .b=1? off then ;
>
> : %0 dup dup set..b=1? (.1234.................) 34y ; ( a' -- a' )
> : %1 dup dup set..b=1? (.1234..55.............) 34y ;
> : %2 dup dup set..b=1? (.1234..55.66..........) 34y ;
> : %3 dup dup set..b=1? (.1234..55.66.77.......) 34y ;
> : %4 dup dup set..b=1? (.1234..55.66.77.88....) 34y ;
> : %5 dup dup set..b=1? (.1234..55.66.77.88.99.) 34y ;
> : %5n dup dup set..b=1? (.1234..55.66.77.88.99.)nfa 34y ;
> : %6 dup dup set..b=1? (.1234..55.66.77.88.99.aa.) 34y ;
>
> : n>%n ( n -- )
> case 1 of %1 endof
> 2 of %2 endof
> 3 of %3 endof
> 4 of %4 endof
> 5 of %5 endof
> 6 of %6 endof
> endcase ;
>
> : .a.range.of.2.byte.data ( from' to' -- ) swap ?do cr i %2 drop i @'
> .xxxx 2 +loop ;
>
> variable cfa'.of.doLIT
> variable cfa'.of.next.
> variable cfa'.of.branch
> variable cfa'.of.?branch
>
> defer _disassem
>
> : check.special.instruction? ( a' -- n | 0 ) dup 2- @^ 154E ( ''
> COMPILE ) = if drop 0 exit then
> dup 2+ @' ( ?branch doLit )
> case 1e38 of cr 2+ dup (.1234..55.66..........) @' 30 ?y .xxxx 4 endof
> \ ?branch
> 1e54 of cr 2+ dup (.1234..55.66..........) @' 30 ?y .xxxx 4 endof \
> branch
> 0196 of cr 2+ dup (.1234..55.66..........) @' 30 ?y .xxxx 4 endof \ next
> 1e38 of cr 2+ dup (.1234..55.66..........) @' 30 ?y .xxxx 4 endof \ doLit
> 057a of cr 2+ dup (.1234..55.66..........) @' 30 ?y .xxxx 4 endof \ doVar
> 059c of cr 2+ dup (.1234..55.66..........) @' 30 ?y .xxxx 4 endof \
> doUSER
> 0dbc of cr 2+ dup (.1234..55.66.77.88.99.) dup c@' 1+ swap 30 ?y .$'
> endof \ ,"|
> 0db2 of cr 2+ dup (.1234..55.66.77.88.99.) dup c@' 1+ swap 30 ?y .$'=2
Reply by ●April 13, 20112011-04-13
Just checking something, you say that you are doing a motor control, what sort
of bypassing / isolation is there between your motor power supply and your uC
power supply? I ask because some motor-induced power supply noise can seriously
mess up your uC, cause it to hang / reset / skip with scissors / generally act
rabid - I've had this bite me once or twice (cough) - you can get by with a
resistor feeding a large capacitor before the MSP430, to low-pass filter the
MSP430's power. (Diode to bypass back EMF spikes is pretty much mandatory.)
Sorry if this has already been covered, just making sure.
(If this was a high vibration environment I'd also suggest a good machine pin socked, or soldering the chips into the circuit, I've seen Sumo robots go loony when they hit another robot, as the cheap leaf sockets the guy was using bounced, disconnecting power etc., on impact - Obvious to me, not totally obvious at first glance. Experience is a thorough teacher, if painful sometimes! LOL)
(If this was a high vibration environment I'd also suggest a good machine pin socked, or soldering the chips into the circuit, I've seen Sumo robots go loony when they hit another robot, as the cheap leaf sockets the guy was using bounced, disconnecting power etc., on impact - Obvious to me, not totally obvious at first glance. Experience is a thorough teacher, if painful sometimes! LOL)