Shop OBEX P1 Docs P2 Docs Learn Events
p2asm bug? — Parallax Forums

p2asm bug?

I've been making changes to the structure of TAQOZ prior to handling it as a compressed binary image for ROM. The idea is that I can use the same larger version I use for stand-alone testing independent of the ROM and the only code I need to compile for ROM itself is the decompress routine that writes the output to RAM.

However the latest changes have been crashing badly and I hadn't been able to find out why. I've added extra debug trace routines to see what is happening under the hood. To cut a long story short I decided to look at the binary output and compare this with the listing and they don't match. It's a subtle bug, but after an alignl I compile some code and it looks right, and all references to these addresses from elsewhere are right, but the binary that is loaded is not right.

Attn @"Dave Hein"
I'm sure I can work around this for the moment and maybe if I have some time I can check the p2asm source but I thought I'd share this little gotcha. PNut is a bit too spin-centric and doesn't like hub labels I give to code that it thinks will be referenced in cog mode, but I know what I'm doing in that department, I just want the assembler to assemble, and give me a proper listing (which PNut does not).

813 x 419 - 92K

Comments

  • After lots of debugging I finally used the preprocessed .spin2 file in PNut and just kept on fixing/bypassing any minor errors until it found something that p2asm did not.
    word	_WORD,brstr,FETCH,,STORE
    
    There were two commas in a row and I found that it worked when I fix that and it broke again in that the binary was off by 2 bytes when I used two commas. But I'm very happy with p2asm nonetheless, it for instance allows labels on byte offsets for cog code that I access from the hub like this:
    orgh	0
    		org
    		jmp	#initsys
    
    '**************** configuration block **************** '
    ''
    		byte	"P2D2F   "		' 8 character ID'
    		byte	0,0
    _OPTIONS	byte	%0000_0011		' options    SD,FLASH
    _COGS		byte	%0000_0000
    
    _XIN		long	XIN
    
    The initsys code performs rdbyte on the hub image although it could getbyte which I originally had but that ,, bug threw me off and I tried dozens of different things :)

    There are lots of other things that p2asm allows that just make sense whereas PNut should really only throw a warning, not refuse to assemble.
  • RaymanRayman Posts: 14,646
    I just tried FastSpin on the double comma and it gives an error...
Sign In or Register to comment.