File Formats

Hardware Hacking, Programming and Game Solutions/Cheats
User avatar
tormod
Posts: 416
Joined: Sat Apr 27, 2013 12:06 pm
Location: Switzerland
Contact:

Re: File Formats

Post by tormod »

We would very much like to find out what goes wrong with lwasm or makewav. Can you please post your .bin file?
If LWASM is the problem I should probably change assemblers.
I should maybe add that lwasm is actively maintained and open-source, so if you encounter a problem with it, the solution is not to run away but report the problem and I am sure any bugs will be fixed quickly.
User avatar
Bosco
Posts: 333
Joined: Tue Mar 04, 2014 11:49 pm
Location: Nottingham, UK

Re: File Formats

Post by Bosco »

Hi tormod.

Sorry if I sounded dismissive. I'm still finding my feet.

I'm really pleased to hear LWASM is being supported so I've been going through my code commenting sections out and I've found the root of the problem.

If I use the pseudo-opcode `rmb' to reserve some memory bytes eg. rmb $10 , makewav will throw the `wrong DECB block length' error. If I comment that line out, the decb will convert without any problems.

I've attached a second test program so you can repro it. Hope this helps?
Attachments
Test02.rar
(1.57 KiB) Downloaded 271 times
User avatar
tormod
Posts: 416
Joined: Sat Apr 27, 2013 12:06 pm
Location: Switzerland
Contact:

Re: File Formats

Post by tormod »

Thanks. I could reproduce it. The problem is that makewav doesn't support multi-segment DECB binaries. It writes out non-gapped cassette files which doesn't allow non-contiguous data. It must either pad the open holes, or write gapped cassette files* instead. The solution for makewav could be to first analyse the DECB file and then choose which way to go. At the least it should error out or give a clear warning if a multi-segment DECB is detected!

When lwasm encounters RMB and other "reserve memory" directives it makes multiple DECB segment so that it can skip those locations entirely. The simplest workaround for you is to use a fill directive instead, e.g. fill 0,$10 instead of rmb $10.

*If you are familiar with the sound of cassette files:
non-gapped: beep burp pause beep burp-burp-burp...
gapped: beep burp pause beep burp pause beep burp pause ...
User avatar
Bosco
Posts: 333
Joined: Tue Mar 04, 2014 11:49 pm
Location: Nottingham, UK

Re: File Formats

Post by Bosco »

Thanks for taking a look tormod. Using `fill' will be no problem. :)

I've also been trying to output a listing txt file but typing the below produces the error `cannot open file `prog.txt': no such file or directory'

lwasm -b -o prog.bin -l prog.txt prog.asm

Creating a dummy text file called prog.txt avoids the error but the listing streams to the dos window, not the file.

I'm interested to know whether LWASM can list cycles per instruction like AS09?
User avatar
tormod
Posts: 416
Joined: Sat Apr 27, 2013 12:06 pm
Location: Switzerland
Contact:

Re: File Formats

Post by tormod »

As the fine manual says, http://lwtools.projects.l-w.ca/manual/manual.html
--list[=file], -l[file]
So the optional file argument to -l must follow without space. Alternatively use the -l option alone to dump the listing to standard output and redirect it to a file:

Code: Select all

lwasm -b -o prog.bin -l prog.asm > prog.txt
User avatar
Bosco
Posts: 333
Joined: Tue Mar 04, 2014 11:49 pm
Location: Nottingham, UK

Re: File Formats

Post by Bosco »

I need to slow down. "Less haste, more speed'. :D

Thanks for all the help.
sixxie
Posts: 1348
Joined: Fri Jul 18, 2008 8:36 am
Location: Hertfordshire
Contact:

Re: File Formats

Post by sixxie »

Ok I swear I hadn't read this forum today before I did some updates to my own bin2cas utility (written in Perl): http://www.6809.org.uk/dragon/#castools

Supports segmented input, but currently just pads gaps with zeroes for output. Is incredibly not-clever about things like overlapping segments.

Edit: now does WAV output
zephyr
Posts: 1474
Joined: Mon Jul 21, 2008 1:18 am

Re: File Formats

Post by zephyr »

Usage: asm6809 [OPTION]... SOURCE-FILE...
Assembles 6809/6309 source code.

-B, --bin output to binary file (default)
-D, --dragondos output to DragonDOS binary file
-C, --coco output to CoCo segmented binary file
-S, --srec output to Motorola SREC file
-H, --hex output to Intel hex record file
It would be far better if all of the cross assemblers offered the option to "output to CAS file". :?
User avatar
Bosco
Posts: 333
Joined: Tue Mar 04, 2014 11:49 pm
Location: Nottingham, UK

Re: File Formats

Post by Bosco »

I like your thinking there zephyr. :)
User avatar
tormod
Posts: 416
Joined: Sat Apr 27, 2013 12:06 pm
Location: Switzerland
Contact:

Re: File Formats

Post by tormod »

In the larger view of things, lwasm and other cross-compilers for 6809 have a much larger user base than some Dragon-specific tools have. So IMHO it is better to share resources as widely as possible, use general tools like lwasm that is being used and maintained by a larger group of people when possible, and have small Dragon tools that can be combined with these. And common CoCo/Dragon tools somewhere in between there again of course. You can always make your own alias/script/batch file that does lwasm -o X && bin2cas X (you quickly end up with a makefile though*). For us who have a searchable command line history it is less of an issue to have some long complex command lines.

*) Actually a good idea to have a Makefile with just general rules for .asm -> .bin and .bin to -> cas. So you can just type "make myprog.cas"
Post Reply