[PicForth] Re: Another gotcha- @ and ! can break interrupts
Samuel Tardieu
sam at rfc1149.net
Sun Nov 14 20:43:47 CET 2004
>>>>> "Alex" == Alex Holden <alex at linuxhacker.org> writes:
Alex> These files define words called any-@ and any-! which are
Alex> sometimes called when you use '@' and '!'. any-@ and any-! use
Alex> suspend-interrupts and restore-interrupts to prevent interrupts
Alex> from occuring in the middle of a fetch or store.
Could you try the following picisr.fs version and tell me whether this
fixes your problem? It allows you to nest as many as 256
suspend-interrupts/restore-interrupts. The drawback are:
- the code is a little longer (not much) than before for initial
(non-nested) calls (and faster for nested calls)
- it takes one more byte in memory
The generated code looks like:
; name: suspend-interrupts
; max return-stack depth: 0
0x000D 0AA5 incf 0x25,f
0x000E 0B25 decfsz 0x25,w
0x000F 0008 return
0x0010 080B movf 0x0B,w
0x0011 00A4 movwf 0x24
0x0012 138B bcf 0x0B,7
0x0013 0008 return
; name: restore-interrupts
; max return-stack depth: 0
0x0014 0B25 decfsz 0x25,f
0x0015 0008 return
0x0016 1BA4 btfsc 0x24,7
0x0017 178B bsf 0x0B,7
0x0018 0008 return
Sam
--
Samuel Tardieu -- sam at rfc1149.net -- http://www.rfc1149.net/sam
-------------- next part --------------
A non-text attachment was scrubbed...
Name: picisr.fs
Type: text/x-forth
Size: 1400 bytes
Desc: picisr.fs
Url : http://lists.rfc1149.net/pipermail/picforth/attachments/20041114/a4cc77b5/picisr.bin
More information about the PicForth
mailing list