This page is a mirror of Tepples' nesdev forum mirror (URL TBD).
Last updated on Oct-18-2019 Download

asm6 1.6 released

asm6 1.6 released
by on (#69472)
Loopy has just posted an update to asm6 that incorporates several improvements I made:
  • PowerPC (big-endian) and 64-bit compatible.
  • Includes Dwedit's error-overload prevention code.
  • Supports quiet mode with -q, which prints nothing unless there's an error. Useful for scripts.
  • Returns non-zero exit status unless there are NO errors AND output file was successfully generated. This allows scripts to catch any errors, rather than thinking they have a valid file.
  • It's now an error to include extra arguments, rather than just warning.
  • All file writing is now checked for errors, including the final fclose().
  • Generates fewer compiler warnings, and avoids non-portable things like (char*)1.
If you see any problems or differences in output, please post here so I can look into it. If possible, try assembling your project with this version and the previous, and be sure the output files are exactly the same.

by on (#69473)
I found a bug in ASM6. After adding a "JSR somelabel" to a label which appears later in the source file, some stuff involving the current address $ breaks. I would add ".org $" as a workaround, and that worked.


So I'm using a series of INCBINS to make a patch.
When I have a construct like this:
$ = $8000
   OLDADDR = $

   $ = $6000
   incbin FILE.bin , $ - $6000, $70D2 - $
   ;some data here
   incbin FILE.bin , $ - $6000, $7461 - $
     LDA #$74
     jsr SomeLabel
   incbin FILE.bin , $ - $6000

   $ = OLDADDR + $ - $6000
.org $BAC0
   incbin FILE2.bin  , $ - $BAC0, $C000 - $
.org $C000

I get an error in the last incbin line. The error goes away if I put ".org $" after the jsr SomeLabel.

by on (#69482)
OK, I think I might have found the cause. It seems that the boolean dependant is set to true by eval() when the expression involves a label not yet defined. And apparently, eval() doesn't clear dependant otherwise, instead relying on the caller to do so. So sprinkled throughout the source are dependant=0 lines. I believe that there should be one of those in incbin(). I inserted one after seekpos=0 and it appears to work now. Doing .org $ has the side-effect of clearing dependant, and thus making incbin() work as well. Might be a good idea for me to add an extra fresh_eval() or something that clears dependant first, and then use that wherever dependant is cleared first.

BTW, this bug was in the previous version as well. I guess I was most interested in any bugs I introduced into the new version, but I might as well address others as well...

by on (#69483)
I'm surprised you were able to fix something in the jumbled spaghetti mess which is ASM6. :)