Jump to content

Recommended Posts

Posted

as predicted no luck with jal, but at least I learned how to install from the terminal  :)

then I tried the script with the mios main.asm (not the sid), no luck either, that means the script does not work with osx as it is now.

any suggestions?

Posted

maybe I can add some more informations:

the problematic asm keywords are:

[tt]BIFSET, BIFCLR, IFSET, IFCLR, IFNEQ, IFLEQ, IFGEQ[/tt]

these should be replaced by:

[tt]btfsc, btfss, btfsc, btfss, spfeq, cpfsgt, cpfslt[/tt]

But I must admit, that I can't read those regular expressions:

[tt]s/\<IFSET\s*\([^,]*\)\s*,\s*\([^,]*\),\s*\(.*\)/btfsc \1, \2\n\t\3/g[/tt]

an example of a GPASM invalid line is:

[tt]IFSET   PIR1, TMR1IF,   rgoto IRQ_Timer1[/tt]

I don't know what the syntax would be if this line is expressed with "[tt]btfsc[/tt]"

It won't compile even if I replace IFSET by btfsc manually...

And finally, I think the problematic line is the first one of the replace-macros.sed:

[tt]1i;hey emacs, this is -*- asm -*-[/tt]

I can't see what the "[tt]1i;[/tt]" should do?

maybe an ASM-hacker knows what to do?

???

cheers,

Michael

  • 2 weeks later...
Posted

an example of a GPASM invalid line is:

IFSET  PIR1, TMR1IF,  rgoto IRQ_Timer1

I don't know what the syntax would be if this line is expressed with "btfsc"

It won't compile even if I replace IFSET by btfsc manually...

if you want to replace

IFSET  PIR1, TMR1IF,  rgoto IRQ_Timer1

the code should be

btfsc  PIR1, TMPAIF

rgoto  IRQ_Timer1

note that you have to use btfsc with IFSET

and btfss wit IFCLR

you can look into macro.inc for similar conversions for the other instructions

I just did what the macro should do  ;D

hope this helps (and that I'm not telling you stuff you already knew :))

Posted
you can look into macro.inc for similar conversions for the other instructions

I see!

Thanks a lot for pointing me to that, mess!

Now I got the root of all evil, the problem is the instruction passing as parameter:

[tt]

BIFSET MACRO reg, bit, reg_a, instr

btfsc reg, bit, reg_a

instr

ENDM

[/tt]

the macros have to be rewritten like this:

[tt]

BIFSET MACRO reg, bit, reg_a

btfsc reg, bit, reg_a

ENDM

[/tt]

and a typical call to this macro would now be:

[tt]

IFNEQ BYTE_NUMBER, ACCESS, rgoto MainLoop_WaitSequence

;; should become

IFNEQ BYTE_NUMBER, ACCESS

rgoto MainLoop_WaitSequence

[/tt]

Now there's only one thing that I don't understand: what advantage does one get by passing the instruction ??? it does not reduce typing or anything. The only thing it does is to prevent compilation with GPASM.

I tested it and compiled successfully with the bootloader source.

The generated .hex file is the same as the ready-compiled one. No differences :D

Cheers,

Michael

Posted

IFSET and IFCLR were the first macros I ever wrote in PIC assembly (anno 1998), because I always mixed the btfss/btfsc instructions, and I wanted to have the branch in a single line.

I'm not sure if it is worth the effort to change my own coding style (as it has to be done for all projects - it's really hard work), but in general I think that it can be easily solved with a small perl script which search/replaces the macros, instead of a bash script which uses sed.

Advantage: every MIOS user has to install perl anyhow, no need for additional tools.

Best Regards, Thorsten.

Posted

Hey, as the name of this topic is not really matching, I allowed myself to open a new topic: http://www.midibox.org/forum/index.php?topic=8275.0

I posted the download link to a first version of a perl script there. It works with the bootloader!

@nhaudio:

you are welcome to try the script, although it's just a rough first test...

because the script is actually overwriting files, please backup the original sources before applying the script...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...