Menu

Override Default Settings

2023-02-05
2023-02-05
  • Andrew Jameson

    Andrew Jameson - 2023-02-05

    I prefer that my source code documents all of the required PIC register configurations - really just to make the code readable / understandable. I could just add additional comments to include GCBasic's initialisation settings but I'd prefer to override them so that I know that I've not missed a specific register configuration.

    I can override / overload InitSys :
    sub INITSYS
    end sub

    but this still leaves :

    ;Start of program memory page 0
    ORG 58
    BASPROGRAMSTART
    ;Call initialisation routines
    ;Enable interrupts
    bsf INTCON,GIE
    bsf INTCON,PEIE
    ;Automatic pin direction setting
    banksel TRISA
    bcf TRISA,5
    bcf TRISA,4
    bsf TRISA,3
    bcf TRISA,0

    Anyway that I can override these chunks of code that I don't need ?
    (Still using 0.98.06 2019-06-12 (Windows 32 bit))

    Thanks,

    Andrew

     
  • Anobium

    Anobium - 2023-02-05

    I would need to see you method of overriding (and why).

     
  • Andrew Jameson

    Andrew Jameson - 2023-02-05

    The final source code should be readable and complete ... it should provide all that is needed by another developer and fairly independent of compiler. Yes embedded subroutines remain hidden but, as with Basic language itself, the code will remain clear - Wait 2 mS for example is obvious.

    Any PIC register configurations must be explained - get these wrong and you end up lost like I was when I migrated from a 12F683 to a 16F18313 and mistakenly expected that the CCP peripheral would, by default, be connected to GP2 / RA2 - felt like trying to open a combination lock !

    So I like my documentation to have a register initialisation section that explains exactly all configuration settings.

    The subroutine InitSys configures the clock, ADC, comparator and ports and I found that I can just add and overload the existing InitSys by adding the code :

    sub INITSYS
    end sub

    The only remaining piece that I can not override is the inline configuration that immediately follows BASPROGRAMSTART.

    The other thing is that some code associated with the configuration becomes redundant - in InitSys TRIS settings are made that I will / might configure to meet my requirement.

    Andrew

     

    Last edit: Andrew Jameson 2023-02-06
  • Anobium

    Anobium - 2023-02-05

    See the principles for Great Cow BASIC. The ease of use hiding all that complexity.

    Get onto the new toolchain and there is a way I can share to take total control. Yes, it has its risks hence it is undocumented.

    The latest tool is available on SoucrForge. If you want to stay with the Legacy IDE then I will put you in touch with Angle as he is now ready to release a Legacy IDE with the GCStudio front end (for updates only).. this will take you directly to SynWrite.

     

    Last edit: Anobium 2023-02-05
  • Andrew Jameson

    Andrew Jameson - 2023-02-05

    Thanks for your time - just thoughts and no real problems - just discussion. Yes I fully understand the principles of keeping things simple but there's a purist lurking within me.

    I stay with what works too and never moved on from Delphi 5 - all my development and OpenGL games still use it - because it works for me !

    Cheers,

    Andrew

    Many thanks again for producing such a great product with amazingly responsive support !

     
  • Anobium

    Anobium - 2023-02-05

    Love the video.

    Thank you for your nice words. :-)


    When you get onto the new compiler then I will create a video to document the hidden secret.

     
  • Anobium

    Anobium - 2023-02-05

    Andrew... this was bugging me.

    So, here is GCB and ASM. New compiler with no tweaks. It will do as wish - I think.

    GCB - I added the #option Bootloader 53 because I have assumed you are doing something in that memory area. I just noticed ORG 58 in your code segment.

    So, I think the upgraade may help you.

    Evan

    CGB

    #CHIP 12F683
    #option Bootloader 53
    
    sub initsys
    end sub
    

    ASM

    ;Program compiled by Great Cow BASIC (1.00.00 2023-01-26 (Windows 64 bit) : Build 1215) for Microchip MPASM/MPLAB-X Assembler using FreeBASIC 1.07.1/2023-02-02 CRC64
    ;Need help? 
    ;  See the GCBASIC forums at http://sourceforge.net/projects/gcbasic/forums,
    ;  Check the documentation and Help at http://gcbasic.sourceforge.net/help/,
    ;or, email us:
    ;   w_cholmondeley at users dot sourceforge dot net
    ;   evanvennn at users dot sourceforge dot net
    ;********************************************************************************
    ;Set up the assembler options (Chip type, clock source, other bits and pieces)
     LIST p=12F683, r=DEC
    #include <P12F683.inc>
     __CONFIG _FCMEN_ON & _CPD_OFF & _CP_OFF & _MCLRE_OFF & _WDTE_OFF & _INTRC_OSC_NOCLKOUT
    ;********************************************************************************
    ;Vectors
        ORG 53
        pagesel BASPROGRAMSTART
        goto    BASPROGRAMSTART
        ORG 57
        retfie
    ;********************************************************************************
    ;Start of program memory page 0
        ORG 58
    BASPROGRAMSTART
    ;Call initialisation routines
    ;Start of the main program
    BASPROGRAMEND
        sleep
        goto    BASPROGRAMEND
    ;********************************************************************************
    INITSYS1
        return
    ;********************************************************************************
     END
    
     
  • Andrew Jameson

    Andrew Jameson - 2023-02-05

    Thanks for that - upgrading this week, I think !

    Andrew

     

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.