[PicForth] Large amounts of text seem to cause
PicForth to generate bad code - minimal example
Alex Holden
alex at linuxhacker.org
Thu Dec 2 17:41:52 CET 2004
Here's a minimal example demonstrating the problem. The '7F0 org' is
critical- it causes 'schedule' in the demo task to be in a different
program memory bank to 'multitasker' in the main word.
7F0 org
include multitasker.fs
task : demotask begin yield again ;
main : test multitasker ;
And the generated code. Note the instruction at 0x7f3 jumps into nowhere
because it has no bank select instructions before it:
0x0000 018A clrf 0x0A
0x0001 2FF5 goto 0x7F5 ; (init-picforth)
; name: demotask
; max return-stack depth: 0
0x07F0 3007 movlw 0x07
0x07F1 00A4 movwf 0x24
0x07F2 30F4 movlw 0xF4
0x07F3 2804 goto 0x004 ;
0x07F4 2FF0 goto 0x7F0 ; demotask
; name: (init-picforth)
; max return-stack depth: 0
0x07F5 303D movlw 0x3D
0x07F6 0084 movwf 0x04
0x07F7 302D movlw 0x2D
0x07F8 00A2 movwf 0x22
0x07F9 30F0 movlw 0xF0
0x07FA 00A3 movwf 0x23
0x07FB 3007 movlw 0x07
0x07FC 00A4 movwf 0x24
; name: test
; max return-stack depth: 0
0x07FD 0064 clrwdt
0x07FE 0822 movf 0x22,w
0x07FF 0084 movwf 0x04
0x0800 0824 movf 0x24,w
0x0801 008A movwf 0x0A
0x0802 0823 movf 0x23,w
0x0803 0082 movwf 0x02
0x0804 00A3 movwf 0x23
0x0805 0804 movf 0x04,w
0x0806 00A2 movwf 0x22
0x0807 2FFD goto 0x7FD ;
--
------------ Alex Holden - http://www.linuxhacker.org ------------
If it doesn't work, you're not hitting it with a big enough hammer
More information about the PicForth
mailing list