files@willett.UUCP (Mailed File Repository) (12/20/89)
Category 3, Topic 31
Message 13 Tue Dec 19, 1989
DANMILLER at 22:34 CST
In repy to comments on for next vs do loop implementation. I compiled a
simple for next and a do loop using a commercial compiler. The for next
implementation is much simpler using a single for/next opcode to cycle vs the
forth 83 type loop implementation. In this implementation the for next is
faster. Do you have a better forth 83 style do loop for this processor? I'd be
happy to compile and run test samples of code for you. Also, I looked in the
rtx reference manual under carries and didn't see a reference to complex
carry. Was this in the RTX2001A literature? ( Code comparison of for next and
do loop implementation in the compiled TFORTH language of the RTXDS
development system from Harris )
Screen # 0
HEX
START-TFORTH
8300 ROMORG 9000 RAMORG( sets the compilation addresses )
: TEST 10 FOR 1 1 + NEXT ;
: TEST2 10 0 DO 1 1 + LOOP ;
END-TFORTH
---( Dissassembled listing of the above code )----------
FULL DASM
address opcode operation
8300 (:) TEST
BE50 LIT 10
8302 BE81 >R ( puts the for next count on ret stk )
8304 BE41 LIT 01
8306 B8C1 LIT 01 +
8308 9982 NEXT 8304 ( for/next next, 1011 1bba aaaa aaaa )
830A A020 ;
830C (:) TEST2
BE50 LIT 10
830E BE40 LIT 00
8310 419B do Call 8336 'A.'
8312 BE41 LIT 01
8314 B8C1 LIT 01 +
8316 4190 loop Call 8320 'A.'
8318 9189 BRANCH 8312
831A B001 R> DROP
831C B001 R> DROP
831E A020 ;
8320 (:) loop ( decompilation of loop )
BE01 R>
8322 BE01 R>
8324 B8C1 LIT 01 +
8326 A0C0 DUP
8328 BE00 R@
832A AE80 SWAP
832C BE81 >R
832E 41A2 = Call 8344 'A.'
8330 899A 0BRANCH 8334
8332 B8C2 LIT 02 +
8334 BEA7 >R ;
8336 (:) do ( decompilation of do )
AE80 SWAP
8338 BE01 R>
833A AE80 SWAP
833C BE81 >R
833E AE80 SWAP
8340 BE81 >R
8342 BEA7 >R ;
8344 (:) = ( this decompiles the = in the loop definition )
AA40 XOR
8346 89A6 0BRANCH 834C
8348 BE40 LIT 00
834A B07E EXIT
834C BF60 LIT -1 ;
ok
note: parenthetic comments are my addition to the listing
*s
------------