LIZAK98%SNYBUFVA.BITNET@cornellc.cit.cornell.edu (WE DISENGAGE--WE TURN THE PAGE) (04/21/89)
Hello Amigoids! Thanks for all the help that you all graciously gave with my last C encounter. This one is little more specific to Amiga. My BBS program that I wrote within the last year is in 100% Amiga BASIC. I did rewrite the serial I/O into C, but an having a hell of time getting it to load. I know I have to load the ML code into an array and go from there... my loader looks something like this, the code may be a little different (I'm not at my machine right now.) Load: OPEN "bbs.io" FOR INPUT AS #1 LENML=LOF(1) FOR I=0 TO LENML/4+1:INPUT #1,A$ CODE%=CVI(A$):NEXT I:CLOSE 1 DumpText:? CALL CODE%(SADD"This should print but wont") RETURN The C code was compiled with Manx 3.6 and linked with the same package. Everytime I load it into the array and then call it, I get a software error, task held requestor. However this code will work from CLI. I can launch it from CLI like so: 1> BBS.IO "This should print but now does" This should print but now does 1> What is the problem? Can BASIC handle the command line args like I used (The CLI run of it shows that), or does BASIC automatically pass parameters without the need for using command line args? This one is really puzzling me... ----Rob Lizak Jr. Bitnet: LIZAK98@SNYBUFVA DECNet: BSCOLA::LIZAK98---- - Snailnet: 8 Bay Lane, Cheektowaga, NY 14225 - - :) :) AT&Tnet: (716)/685-3979 - ---- Programming: It's just not a job... it's an OBSESSION.. Ugh! ----
jms@antares.UUCP (Joe Smith) (04/26/89)
In article <13680@louie.udel.EDU> LIZAK98%SNYBUFVA.BITNET@cornellc.cit.cornell.edu (WE DISENGAGE--WE TURN THE PAGE) writes: > I did rewrite the serial I/O into C, but an having a hell >of time getting it to load. I know I have to load the ML code >into an array and go from there... Your code assumes that programs that can be called from the CLI are: 1) position independent (so they can be loaded anywhere in memory and run) 2) consist on nothing but executable code (so CALL CODE%) works). Neither assumption is true. Executable commands are stored in files that have several hunks, including relocation information. You told it to jump into the middle of the header where it executed an illegal instruction. Unlike some 8-bit Operating System (such as C64, CP/M, etc), executable files are not loaded into memory verbatim and run. The loader has to do 16 and 32-bit relocations and link the segments together. To get information into memory properly, you will have to learn about FD files, you will have to open the Exec and DOS libraries, you will have to use the LoadSeg function, and you will have to convince BASIC to put the right stuff in the registers when it calls your code. You will need the AmigaDOS Reference Manual and the RKM/Exec (or the equivalant information from Rob Peck's books) for your project. -- Joe Smith (408)922-6220 | jms@antares.Tymnet.COM or jms@tymix.Tymnet.COM McDonnell Douglas FSCO | UUCP: ...!{ames,pyramid}!oliveb!tymix!antares!jms PO Box 49019, MS-D21 | PDP-10:JMS@F74.Tymnet.COM CA license plate:"POPJ P," San Jose, CA 95161-9019 | narrator.device: "I didn't say that, my Amiga did!"