HP Forums
DM-FORTH: FORTH implementation for the DM41X - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: Not HP Calculators (/forum-7.html)
+--- Forum: Not quite HP Calculators - but related (/forum-8.html)
+--- Thread: DM-FORTH: FORTH implementation for the DM41X (/thread-20915.html)



DM-FORTH: FORTH implementation for the DM41X - dmh - 11-28-2023 02:05 PM

I've ported FORTH to the Swissmicros DM41X hardware and added sound, graphics, file loading, keyboard shortcuts and assignment which I demonstrate in the following video.

N-Queens for an 8x8 board runs in .27 seconds on USB power which appears to be the fastest version in FORTH when reviewing the current Calculator Benchmark list.

Happy to receive feedback and suggestions for enhancements and future features. There's bound to be some bugs in it still. I'll setup a Github repository for it soon once I've done a bit of a code tidy up :-)






RE: DM-FORTH: FORTH implementation for the DM41X - floppy - 11-28-2023 07:41 PM

Nice.
What is the stack level? Any doc available?


RE: DM-FORTH: FORTH implementation for the DM41X - dmh - 11-29-2023 10:23 AM

It's based on the following FORTH which I ported and added features to, fixed some bugs and added DM41X hardware support.

https://gist.github.com/lbruder/10007431

I'll document my version and the new features when I setup the repository.

Total memory currently allocated is 64Kb with a 16 bit default cell size and 384 cell stack size.

I have not tested the memory limits but I'm sure some testing and tuning could probably increase these limits.

(11-28-2023 07:41 PM)floppy Wrote:  Nice.
What is the stack level? Any doc available?



RE: DM-FORTH: FORTH implementation for the DM41X - xerxes - 11-30-2023 02:46 AM

(11-28-2023 02:05 PM)dmh Wrote:  N-Queens for an 8x8 board runs in .27 seconds on USB power which appears to be the fastest version in FORTH when reviewing the current Calculator Benchmark list.

Thank you for the test. Interestingly, it's 9 times faster than the Jonesforth implementation on the 50G.
Can you please post the test code for the list?


RE: DM-FORTH: FORTH implementation for the DM41X - dmh - 11-30-2023 10:26 AM

You're welcome. I'm enjoying getting FORTH running on more devices and testing N-Queens :-)

I just tested the 50G FORTH code you already have listed on the DM41X and, as expected, it works and is what I used. All I added was a few words to time the runtime.
EDIT: I realised that I added disabling program interrupt checking to make it is fast as possible so here is the code including that with timing removed,

Code:
8 CONSTANT RR
 VARIABLE II VARIABLE SS VARIABLE XX VARIABLE YY
 HERE @ RR 2+ ALLOT CONSTANT AA

 : RCLAA @ AA + C@ ;
 : STOAA @ AA + C! ;

 : NQPRINT
  1 II !
  BEGIN II @ XX @ 1+ < WHILE
    II RCLAA .
    1 II +!
  REPEAT ;

 : NQCORE
   0 SS !
   0 XX !
   BEGIN
     1 XX +!
     RR XX STOAA
     BEGIN
       1 SS +!
       XX @ YY !
       BEGIN YY @ 1 > WHILE
         -1 YY +!
         XX RCLAA YY RCLAA - DUP
         0= SWAP ABS XX @ YY @ - = OR IF
           0 YY !
           BEGIN XX RCLAA 1- DUP XX STOAA 0= WHILE
             -1 XX +!
           REPEAT
         THEN
       REPEAT
     YY @ 1 = UNTIL
   RR XX @ = UNTIL
 ;

: NQUEENS
  BRKOFF
  NQCORE
  NQPRINT
  BRKON
;

I notice you don't have my PrimeFORTH, written in Python, listed either.

The Prime G2 version runs N-Queens in 2.49 seconds and the code is here:

https://github.com/diemheych/PrimeFORTH/blob/main/nqueens.fth

(11-30-2023 02:46 AM)xerxes Wrote:  
(11-28-2023 02:05 PM)dmh Wrote:  N-Queens for an 8x8 board runs in .27 seconds on USB power which appears to be the fastest version in FORTH when reviewing the current Calculator Benchmark list.

Thank you for the test. Interestingly, it's 9 times faster than the Jonesforth implementation on the 50G.
Can you please post the test code for the list?



RE: DM-FORTH: FORTH implementation for the DM41X - xerxes - 12-01-2023 03:55 AM

(11-30-2023 10:26 AM)dmh Wrote:  I'm enjoying getting FORTH running on more devices and testing N-Queens :-)

I like Forth since Jupiter Ace. :-)
I'm especially impressed by the Forth implementations for the PC-E500S and PC-G850V.


RE: DM-FORTH: FORTH implementation for the DM41X - dmh - 12-01-2023 04:10 AM

I've seen the FORTH threads on these Sharp models but unfortunately I don't have either of them to try it out :-(

(12-01-2023 03:55 AM)xerxes Wrote:  
(11-30-2023 10:26 AM)dmh Wrote:  I'm enjoying getting FORTH running on more devices and testing N-Queens :-)

I like Forth since Jupiter Ace. :-)
I'm especially impressed by the Forth implementations for the PC-E500S and PC-G850V.



RE: DM-FORTH: FORTH implementation for the DM41X - cdmackay - 12-01-2023 04:25 PM

(12-01-2023 04:10 AM)dmh Wrote:  I've seen the FORTH threads on these Sharp models but unfortunately I don't have either of them to try it out :-(

(12-01-2023 03:55 AM)xerxes Wrote:  I like Forth since Jupiter Ace. :-)
I'm especially impressed by the Forth implementations for the PC-E500S and PC-G850V.

I see that pockemul has both, although I've not tried them.


RE: DM-FORTH: FORTH implementation for the DM41X - Craig Bladow - 12-01-2023 04:55 PM

Very Cool! This will be on my DM-41X very soon. I've been following your YouTube channel and wondered if a port to the DM-41X was coming.

Regarding the Jupiter Ace , I've ran an emulator several years ago on Apple iPad, by Memention, that includes the comprehensive manual which takes you through every feature.

Cheers,
Craig


RE: DM-FORTH: FORTH implementation for the DM41X - dmh - 12-01-2023 10:22 PM

Thanks :-) Let me know how you go.

I didn't demonstrate it but to exit DM-FORTH so you can swap back to DM41 just use the BYE command and you will be back at the full DMCP menu. I didn't assign BYE to a key to prevent people accidentally exiting.

To extract DM41.pgm from the firmware .bin file take a look at the following:

https://github.com/swissmicros/DMCP_SDK/tree/master/keymap_utils#making-dmcppgm-combo

(12-01-2023 04:55 PM)Craig Bladow Wrote:  Very Cool! This will be on my DM-41X very soon. I've been following your YouTube channel and wondered if a port to the DM-41X was coming.

Regarding the Jupiter Ace , I've ran an emulator several years ago on Apple iPad, by Memention, that includes the comprehensive manual which takes you through every feature.

Cheers,
Craig



RE: DM-FORTH: FORTH implementation for the DM41X - dmh - 12-30-2023 08:20 AM

A couple of minor updates:
  • Lowercase support - use ALPHA and USER mode
  • Added DEPTH word - returns stack depth to stack
There's a link to the latest version (0.5) in the YouTube video description (after the demonstrated version).


RE: DM-FORTH: FORTH implementation for the DM41X - dmh - 03-05-2024 12:14 PM

Now compiled for the DM42 with appropriate adjustments to keyboard mapping (shown in video).

Download link is in the video description.