Menu

#40 Ugly fix for moviw and movwi

closed
None
5
2012-08-12
2011-07-23
Anonymous
No

While adding support for the 12f1822, I noticed that the moviw and movwi instructions were not encoding correctly. The "n" bit for FSRn was encoding to bit-3, where it should go to bit-2.
MOVIW: 00 0000 0001 0nmm
MOVWI: 00 0000 0001 1nmm

In gpasm/directive.c the fsr value is 4 for FSR0 and 6 for FSR1. I do not have the correct fix (digging into the parser to find out why) but here is an ugly workaround that seems to work. Here are the results, which seem to be correct:

0038 0010 00107 moviw ++FSR0
0039 0014 00108 moviw ++FSR1
003A 0011 00109 moviw --FSR0
003B 0015 00110 moviw --FSR1
003C 0012 00111 moviw FSR0++
003D 0016 00112 moviw FSR1++
003E 0013 00113 moviw FSR0--
003F 0017 00114 moviw FSR1--
00115
0040 0018 00116 movwi ++FSR0
0041 001C 00117 movwi ++FSR1
0042 0019 00118 movwi --FSR0
0043 001D 00119 movwi --FSR1
0044 001A 00120 movwi FSR0++
0045 001E 00121 movwi FSR1++
0046 001B 00122 movwi FSR0--
0047 001F 00123 movwi FSR1--

Using movwi k[FSRn] addressing (such as "movwi 0[FSR0]") gives me a core dump in list_length() called from line 3064 under do_insn() in directive.c I have not figured that out yet.

Comments to richard@hodges.org

Discussion

  • Nobody/Anonymous

    Ugly patch for MOVIW and MOVWI

     
  • Borut Ražem

    Borut Ražem - 2011-09-26

    Duplicate of #3375990.

    Borut

     

Anonymous
Anonymous

Add attachments
Cancel





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.