Menu

PIC assembler

2022-06-25
2022-06-26
  • Brian Beard

    Brian Beard - 2022-06-25

    Hi, I am new to this forum. I've been using MPASM since the 16C parts. I really don't like the new PIC-AS assembler in XC8. I see Great Cow Basic has an internal assembler. Can that assembler be run stand alone to generate .hex files?

     
  • Anobium

    Anobium - 2022-06-25

    The simple answer is No. GCASM cannot execute as a standalone tool

    GCASM has a number of key constraints. Those constraints include the chips supported, completeness of the ASM instruction set, object linking and use of preprocessor and scripts and a dependency on the Great BASIC compiler.

    The GCASM is not a direct replacement. It was not designed to be a direct replacement.

    The compiler is intended to make programming easy. Therefore, much of the memory management, configuration management, interrupt management is easy from a user perspective.

    Coming from MPASM you will have to learn a new approach. You can achieve a much better solution but you will find it frustrating as you have a learn a totally new approach.

    I have asked Bill Roth to join this post. He has completed a stunning ASM project that uses Great Cow BASIC abilities and then passes the .S to XC8 for assembly- this is done with ease

    All that said. Give up on ASM and use Great Vow BASIC out of the box with no ASM.

     

    Last edit: Anobium 2022-06-26
  • Chris Roper

    Chris Roper - 2022-06-25

    Hi Brian,

    I was in a similar situation to you when I first tried GCBASIC.
    I was using the inline assembler in the mistaken belief that BASIC was an inefficient language and I was a good ASM coder.

    Anobium suggested that I try the basic out of the box and I was surprised to find that it did in fact generate tighter code than I was hard coding in ASM. I then took one of my older projects and re wrote it in GCBASIC with the result that the code was not only smaller, albeit only a word or two once compiled, but it was now fully portable and could be recompiled to anything from a PIC10 to a PIC18 or even an AVR device (Long before the buyout).

    From that day on I have used GCBASIC for development and used my ASM skill's to help out where I can to help expand the GCBASIC language.

    It has been a fun ride.

    Cheers
    Chris

     
  • William Roth

    William Roth - 2022-06-26

    Hi Brian,

    Great Cow BASIC supports the use of "inline" ASM. But was not intended to be used as a stand-alone assembler where you write all of the code in pure ASM and get a hex out.

    What GCB does (and does quite well) is to compile BASIC into ASM and then assemble it into hex using either GCASM, MPASM(X), or PIC-AS. (MPASM does not support the newer chips)

    What you cannot do is use the GCB editor to write pure ASM and simply get a hex out.

    However, once you get familiar with GCB you can use it as a wrapper around your ASM where GCB does the hard stuff like generating the header, handling variable EQU's, interrupt vectors and and loads of other stuff like configuring the OSC and much more. Or with the #option UserCodeOnly directive you can tell the compiler NOT to do this stuff and do it all yourself. But you will still need to use some BASIC.

    My suggestion is that you first install GCB@Syn, get a programmer configured, write some code in GCBASIC and then have a look at the ASM that is generated. You may not even want to program in ASM any longer. However, if still you do, you can use the wrapper method that I mentioned. You will likely need help with that as it is not trivial.

    So install and try GCB first, play with it, look at the generated ASM and get back to us.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.