View Full Version : MaxForth monitor and execution fun
Ok folks I'm dying out here. I have an NMIY-0020 with Max-FORTH V3.5E as my monitor and I can't seem to find out how to execute a program after loading it into memory. I have the most basic configuration of this board with a single 2K memory chip in U2.
First: Where the heck is the list of monitor commands for the Max-FORTH monitor? I can find tons of documentation on FORTH in general but I assume that there is a short list of command line commands for program loading and execution for those of us who have no interest in learning FORTH.
After reading numerous posts I have discovered that I can display a segment of memory by using the syntax "HEX 1000 1 DUMP". Thank goodness, now I can see that the program ( echo.s19 ) IS actually sitting in location HEX 1000 where I stuffed it.
I also am running in the dark with scissors with regard to offsets... I used the SREC_EEP.4TH with offset = 0 because my I'm assuming that since the sample C program has the following :
#data 0x0000
#code 0x1000
#stack 0xFF
that I will be able to just simply start executing it at HEX 1000 after it's uploaded with no offset.
So after the download and the verification that it's really there, how DO I get it to execute from my ram?
Any help would be greatly appreciated as I'm into my 8th hour of messing with this and running out of rope.
Many thanks in advance,
Mark
RMDumse
03-14-04, 05:38 PM
Originally posted by mark00
Where the heck is the list of monitor commands for the Max-FORTH monitor?
You can see all the functions, called words, but typing WORDS, and the language will show you.
Details beyond just their names can be found here:
http://tech.newmicros.com/v50/Alphabetical/Detailed/
Many thanks for the quick response....
Yes, indeed. I do have that link but there is more unsaid than said.
I find that when I use the EXECUTE command both as :
EXECUTE 1000
and as
HEX 1000 EXECUTE
the result is the same... the cursor just sits there for a second and then it returns with the prompt :
Max-FORTH V3.5E
Is the EXECUTE command even valid in this context ( trying to execute my C program from location 1000 )?
I can understand how I may have jumpped the track here as this is my first attempt at running anything on my 0020 but without a concrete example of even the simplest kind I'm clueless as to how to proceed.
:confused:
- Mark
RMDumse
03-14-04, 06:26 PM
Yes, much is left unsaid. That's because I haven't started a C program from Forth in like... oh... must be more than 8 years.
So I tried to help with what I could. From here, I'd hoped someone else would jump in. But, I can do a little speculation, if you keep in mind, I'm working from very old memories.
Lemme see. To start assembly language at some address, like $1000, from Forth, you need an indirect pointer. How can we make one? Hummm... Seems like the C compilation process was supposed to put those in for you. Like there was a switch option for with and without monitor. But since I can't seem to remember much about that...
If you did
CODE-SUB X
39 C,
END-CODE
You'd create a name in Forth, X, that would execute the code following it. In this case we put in a 39, which iirc is a RTS.
So if we did
CODE-SUB X
7E C, 1000 ,
39 C,
END-CODE
We'd have a JMP $1000 instruction. You wouldn't have a way back when your coded ended. We could do JSR instead.
CODE-SUB X
BD C, 1000 ,
39 C,
END-CODE
Well, I know there is Small C documentation that deals with starting your code. Do you have any of that?
RMDumse
03-14-04, 06:28 PM
You might be able to get there easier.
If you did
HEX HERE 1000 , EXECUTE
it might cause your program at 1000 to run
Aaaaaaa yes that swell smallc documentation... < snip >
(To prepare to load an S-Record, connect the serial channel of the
F68HC11 system to the PC's COM1:. Power-up the F68HC11 system
from a cold start. Enter MAXTALK SREC.4TH on the PC. The file
will download and automatically envoke the loader. Enter MAXTALK
????????.S19 on the PC, where ????????.S19 is your compiled C
program in S-record format; or just enter once:
MAXTALK SREC.4TH ???????.S19
After the file is loaded, a reset will start the C program.)
< snip >
Great place to start... first of all MAXTALK is not shipped with the NMI package. So you hunt around and dig up MAXTERM. Well this works at a glacial pace but gets the job done... ( yes I have since downloaded NMITerm and am extremely impressed )... next you hunt round for SREC.4TH and after discovering that it's not in the original package that came with your board you dig through the archives and find a link to a link that gives you the latest docs. Behold there is an EEPROG directory where you find SREC_EEP.4th. Can't find any reference to autostart or any such reference to loading my start address into 0x4000 where I'm told in some little fragment of documentation that this is where the autostart ( after soft reboot ) address should be located.
I have to tell you, I spent a year at a fortune 500 company using CodeWarrior programming the heck out of HC11's in C++ and never had a problem. Now that I'm using freebie tools to put together...... rant, rant, rant... my kingdom for a simple C example with instructions on how to compile ( SC ), load ( SREC_EEP.4th ), and execute ( ???? ) a program. "Hello world, I know your out there!"
Say that was fun.
HELP!
TOUCHDOWN!
Many thanks for your help.
HEX HERE XXXX . EXECUTE
was all I needed.
I couldn't get any response out of echo.c or other sample programs but just knowing that I was on the right track was enough for me to construct my own hello world from the atod.c and after using your tip and kicking off a soft reboot I was greeted with those sweet little words "Hello World".
The world's my oyster now...
Thanks for listening.
- Mark
Strike that...
HEX HERE XXXX , EXECUTE
was not needed after all...
Just a running program.
The SREC_EEP.4th takes care of loading the autostart address... so all you have to do is compile ( SC ), download SREC_EEP.4TH, download your S19 file, and do a soft reboot ( haven't installed your reboot button yet... now's the time ).
Anyway, success speaks for itself.
thx.
vBulletin v3.0.7, Copyright ©2000-2012, Jelsoft Enterprises Ltd.