Jump to content

assembler sid v1.7303 help


nhaudio
 Share

Recommended Posts

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

Link to comment
Share on other sites

  • 2 weeks later...

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 :))

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...