Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Anyone using Forth on LPC21xx?

2005-04-27 by Stephen Pelc

>    From: Peter Jakacki <peterjak@...>
 
> Thanks Stephen, is the VFX a target resident Forth or hosted?

It's a target resident Forth produced by a cross compiler.
You can also produce an Umbilical version.

> Also do you have a decompile or hex dump of the DO-PRIME word?

: DO-PRIME	\ --
  FLAGS SIZE -1 FILL
  0 SIZE 0 DO
    I FLAGS + C@ IF
      I 2* 3 + DUP I +
      BEGIN
       DUP SIZE <
      WHILE
       DUP FLAGS + 0 SWAP C!
       OVER +
      REPEAT
      2DROP  1+
    THEN
  LOOP
  DROP
;

dis do-prime 
DO-PRIME
( 0000.FA88 0CC04CE2 .@Lb )  sub r12, r12, # $0C
( 0000.FA8C E0109FE5 `..e )  ldr r1, [ pc, # $E0 ]   ( @$FB74 = $1FFE )
( 0000.FA90 00108CE5 ...e )  str r1, [ r12, # $00 ]
( 0000.FA94 DC109FE5 \..e )  ldr r1, [ pc, # $DC ]   ( @$FB78 = $40004268 
)
( 0000.FA98 04108CE5 ...e )  str r1, [ r12, # $04 ]
( 0000.FA9C 08A08CE5 . .e )  str r10, [ r12, # $08 ]
( 0000.FAA0 00A0E0E3 . `c )  mvn r10, # $00
( 0000.FAA4 00402DE9 .@-i )  stmdb r13 ! { r14 }
( 0000.FAA8 53C6FFEB SF.k )  bl # $13FC      FILL
( 0000.FAAC 0CC04CE2 .@Lb )  sub r12, r12, # $0C
( 0000.FAB0 BC109FE5 <..e )  ldr r1, [ pc, # $BC ]   ( @$FB74 = $1FFE )
( 0000.FAB4 00108CE5 ...e )  str r1, [ r12, # $00 ]
( 0000.FAB8 0010A0E3 .. c )  mov r1, # $00
( 0000.FABC 04108CE5 ...e )  str r1, [ r12, # $04 ]
( 0000.FAC0 08A08CE5 . .e )  str r10, [ r12, # $08 ]
( 0000.FAC4 00A0A0E3 .  c )  mov r10, # $00
( 0000.FAC8 A1C2FFEB6CFB0000 !B.kl{.. )bl # $554       (DO) FB6C
( 0000.FAD0 00809DE5 ...e )  ldr r8, [ r13, # $00 ]
( 0000.FAD4 04009DE5 ...e )  ldr r0, [ r13, # $04 ]
( 0000.FAD8 008088E0 ...` )  add r8, r8, r0
( 0000.FADC 94009FE5 ...e )  ldr r0, [ pc, # $94 ]   ( @$FB78 = $40004268 
)
( 0000.FAE0 008098E0 ...` )  add .s r8, r8, r0
( 0000.FAE4 0080D8E5 ..Xe )  ldrb r8, [ r8, # $00 ]
( 0000.FAE8 000058E3 ..Xc )  cmp r8, # $00
( 0000.FAEC 1900000A .... )  b .eq # $FB58
( 0000.FAF0 00809DE5 ...e )  ldr r8, [ r13, # $00 ]
( 0000.FAF4 04009DE5 ...e )  ldr r0, [ r13, # $04 ]
( 0000.FAF8 008088E0 ...` )  add r8, r8, r0
( 0000.FAFC 8880A0E1 .. a )  mov r8, r8 lsl # $01
( 0000.FB00 038098E2 ...b )  add .s r8, r8, # $03
( 0000.FB04 00709DE5 .p.e )  ldr r7, [ r13, # $00 ]
( 0000.FB08 04009DE5 ...e )  ldr r0, [ r13, # $04 ]
( 0000.FB0C 007087E0 .p.` )  add r7, r7, r0
( 0000.FB10 087097E0 .p.` )  add .s r7, r7, r8
( 0000.FB14 08C04CE2 .@Lb )  sub r12, r12, # $08
( 0000.FB18 00808CE5 ...e )  str r8, [ r12, # $00 ]
( 0000.FB1C 04A08CE5 . .e )  str r10, [ r12, # $04 ]
( 0000.FB20 07A0A0E1 .  a )  mov r10, r7
( 0000.FB24 48009FE5 H..e )  ldr r0, [ pc, # $48 ]   ( @$FB74 = $1FFE )
( 0000.FB28 00005AE1 ..Za )  cmp r10, r0
( 0000.FB2C 060000AA ...* )  b .ge # $FB4C
( 0000.FB30 40009FE5 @..e )  ldr r0, [ pc, # $40 ]   ( @$FB78 = $40004268 
)
( 0000.FB34 00809AE0 ...` )  add .s r8, r10, r0
( 0000.FB38 0000A0E3 .. c )  mov r0, # $00
( 0000.FB3C 0000C8E5 ..He )  strb r0, [ r8, # $00 ]
( 0000.FB40 00009CE5 ...e )  ldr r0, [ r12, # $00 ]
( 0000.FB44 00A09AE0 . .` )  add .s r10, r10, r0
( 0000.FB48 F5FFFFEA u..j )  b # $FB24
( 0000.FB4C 04109CE5 ...e )  ldr r1, [ r12, # $04 ]
( 0000.FB50 01A091E2 . .b )  add .s r10, r1, # $01
( 0000.FB54 08C08CE2 .@.b )  add r12, r12, # $08
( 0000.FB58 00009DE5 ...e )  ldr r0, [ r13, # $00 ]
( 0000.FB5C 010090E2 ...b )  add .s r0, r0, # $01
( 0000.FB60 00008D75 ...u )  str .vc r0, [ r13, # $00 ]
( 0000.FB64 D9FFFF7A Y..z )  b .vc # $FAD0
( 0000.FB68 0CD08DE2 .P.b )  add r13, r13, # $0C
( 0000.FB6C 04A09CE4 . .d )  ldr r10, [ r12 ], # $04
( 0000.FB70 0080BDE8 ..=h )  ldmia r13 ! { pc }
236 bytes, 58 instructions.

> I suspect it is a subroutine threaded model or generates
> assembler code. 

The Forth system and benchmark code was produced by a VFX Forth 
cross compiler on a PC and downloaded to the Flash.

On build 883 of the compiler, 100 iterations took 1090 ms.

Stephen
--
Stephen Pelc, stephen@...
MicroProcessor Engineering Ltd - More Real, Less Time
133 Hill Lane, Southampton SO15 5AF, England
tel: +44 23 80 631441, fax: +44 23 80 339691
web: http://www.mpeltd.demon.co.uk - free VFX Forth downloads

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.