gnupic: Re: How to use MPASM generated "cod" files with GPSIM
Subject:
[PIC]: How to use MPASM generated "cod" files with GPSIM
From:
Wojtek Zabolotny ####@####.####
Date:
14 Sep 2000 09:57:14 -0000
Message-Id: <20000914115727.A15121@ipebio15.ise.pw.edu.pl>
Hi All,
Because of the bug in macro implementation in GPASM (discussed in the
"Global symbols in macros don't work in gpasm?" thread), I had to use MPASM
last time. However the debbugging facilities of MPLAB simulator are very
poor, and I really had to do the job in GPSIM (USART & SPI simulation).
MPASM (DOS version) runs smoothly under DOSEMU in Linux, so there is no
problem with using MPASM & GPSIM together, however one problem exists:
GPSIM does not accept the MPASM generated "cod" files. As I've found in the
GPSIM's documentation the reason is the inclusion of OS dependent filenames
in the cod file. I've checked it and this is what I found:
To make the MPASM generated cod files you need:
1. Change the processor name to one accepted by GPSIM
(in my case I had to change "16F877" to "16f877")
2. Change all the filenames from the DOS versions into their UNIX
equivalents.
Eg. I have my sources in "~/dos/pic2" directory which is "F:\PIC2" under
DOSEMU.
If my source is "F:\PIC2\PICTEST1.ASM" and it uses the
include file "F:\PIC2\P16F877.INC", then I change this strings
to "pictest1.asm" and "p16f877.inc" (however I have to start the gpsim
in the "~/dos/pic2" directory.
One more remark about the string format in "cod" files. I have stated that
the strings in "cod" files are written in following form:
length_of_string (1 byte)
string_itself (array of bytes)
zero_padding (array of zero bytes)
I've stated, that it is safe to change the strings, when changing the length
byte respectively, and padding the new string with zeros.
Up to now I did it just with Midnight Commander (F3 to view -> F2 to edit ->
repeatedly F2 to switch hex/text edit -> F6 to save), but I'm
considering to write a simple C program or Perl script to make it
automatically (making chnages "by hand" after each compilation is rather
boring & tiring).
--
HTH & Greetings
Wojciech M. Zabolotny
http://www.ise.pw.edu.pl/~wzab <--> ####@####.####
http://www.freedos.org Free DOS for free people!