Menu

Help with using MPASM to assemble so I can simulate code on PC.

Help
lhatch
2014-01-29
2014-02-02
  • lhatch

    lhatch - 2014-01-29

    This is my command line and my batch file that I use to make my .asm and .hex files and it works like a champ. Using gputils.

    HOWEVER, sometimes I would like to attempt to load the .ASM in mpasm and step through looking for problems.

    Anyone have a batch file for this or changes I can make. The below is for the gputils.

    Thanks

    Command line :      GCBASIC /NC %1.bas /O:%1.asm /A:m.bat
    
    Batch file m.bat that the command line calls:
    
    @ECHO OFF
    echo C:\progra~1\gputils\bin\gpasm -i -w2 %code%.asm >%code%.err
    C:\progra~1\gputils\bin\gpasm -i -w2 %code%.asm >%code%.err
    del %code%.cod>nul
    
     

    Last edit: lhatch 2014-01-31
    • lhatch

      lhatch - 2014-01-31

      Nobody? Maybe it is a GCB switch, I will check there.

       
  • Hugh Considine

    Hugh Considine - 2014-02-01

    It's definitely possible to load the ASM from GCBASIC into MPASM. I think that your m.bat should be like this:

    @ECHO OFF
    echo C:\progra~1\microc~1\mpasms~1\MPASMWIN /c- /o- /q+ /l- /x- /w1 %code%.asm
    C:\progra~1\microc~1\mpasms~1\MPASMWIN /c- /o- /q+ /l- /x- /w1 %code%.asm
    

    Try that and see!

     
  • lhatch

    lhatch - 2014-02-01

    Hugh,

    It ran perfect with no errors.

    Then I loaded MPASM X (bloatware for sure), made a new project, pasted the .ASM in a new file and it worked great.

    Thanks for the help. Sure this will help when I get a program that does not want to do what I want. Rare but does happen.

    Is there any way to have GCBASIC throw comment lines with the actual GCBASIC source code. That would help even more with debugging.

     
  • Hugh Considine

    Hugh Considine - 2014-02-01

    Yes, there certainly is a way to have GCBASIC preserve the original code as comments in the assembly. To keep all code, use /K:A when calling the compiler. To keep just the BASIC comments, use /K:C.

    Alternatively, if you have a gcbasic.ini file in the same folder as gcbasic.exe, you can add a line under the [gcbasic] section to control what is kept. Add
    Preserve = a
    or
    Preserve = c
    to keep all original lines, or to keep comments only in the assembly. I use that for debugging a lot myself.

     
  • Chuck Hellebuyck

    Frank,
    If you are out there, how do I add this /K:A option Hugh mentions to the batch files in your GCB@SYN.

     
  • lhatch

    lhatch - 2014-02-02

    Below are the updates from Hugh. I can pull the ASM into MPASM X and see the code lines as comments, step and run the code. Next will maybe attempt PicKit2 as a emulator. Probably need to make a cable for that.

    New c.bat (c filename to compile the .BAS file)

    GCBASIC /NC /K:C %1.bas /O:%1.asm /A:m.bat

    and m.bat is the one Hugh posted.

    @ECHO OFF
    echo C:\progra~1\microc~1\mpasms~1\MPASMWIN /c- /o- /q+ /l- /x- /w1 %code%.asm
    C:\progra~1\microc~1\mpasms~1\MPASMWIN /c- /o- /q+ /l- /x- /w1 %code%.asm
    
     

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.