Post Reply 
DM-FORTH: FORTH implementation for the DM41X
11-28-2023, 02:05 PM
Post: #1
DM-FORTH: FORTH implementation for the DM41X
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 :-)




Calculator Clique on YouTube
Visit this user's website Find all posts by this user
Quote this message in a reply
11-28-2023, 07:41 PM (This post was last modified: 11-28-2023 07:44 PM by floppy.)
Post: #2
RE: DM-FORTH: FORTH implementation for the DM41X
Nice.
What is the stack level? Any doc available?

HP71B 4TH/ASM/Multimod, HP41CV/X/Y & Nov64d, PILBOX, HP-IL 821.62A & 64A & 66A, Deb11 64b-PC & PI2 3 4 w/ ILPER, VIDEO80, V41 & EMU71, DM41X
Find all posts by this user
Quote this message in a reply
11-29-2023, 10:23 AM
Post: #3
RE: DM-FORTH: FORTH implementation for the DM41X
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?

Calculator Clique on YouTube
Visit this user's website Find all posts by this user
Quote this message in a reply
11-30-2023, 02:46 AM
Post: #4
RE: DM-FORTH: FORTH implementation for the DM41X
(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?

Calculator Benchmark
Find all posts by this user
Quote this message in a reply
11-30-2023, 10:26 AM (This post was last modified: 11-30-2023 08:59 PM by dmh.)
Post: #5
RE: DM-FORTH: FORTH implementation for the DM41X
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/...queens.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?

Calculator Clique on YouTube
Visit this user's website Find all posts by this user
Quote this message in a reply
12-01-2023, 03:55 AM
Post: #6
RE: DM-FORTH: FORTH implementation for the DM41X
(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.

Calculator Benchmark
Find all posts by this user
Quote this message in a reply
12-01-2023, 04:10 AM
Post: #7
RE: DM-FORTH: FORTH implementation for the DM41X
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.

Calculator Clique on YouTube
Visit this user's website Find all posts by this user
Quote this message in a reply
12-01-2023, 04:25 PM
Post: #8
RE: DM-FORTH: FORTH implementation for the DM41X
(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.

Cambridge, UK
41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot/C47
Casio, Rockwell 18R
Find all posts by this user
Quote this message in a reply
12-01-2023, 04:55 PM
Post: #9
RE: DM-FORTH: FORTH implementation for the DM41X
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

Try CC41!
Find all posts by this user
Quote this message in a reply
12-01-2023, 10:22 PM (This post was last modified: 12-01-2023 10:24 PM by dmh.)
Post: #10
RE: DM-FORTH: FORTH implementation for the DM41X
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/...ppgm-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

Calculator Clique on YouTube
Visit this user's website Find all posts by this user
Quote this message in a reply
12-30-2023, 08:20 AM
Post: #11
RE: DM-FORTH: FORTH implementation for the DM41X
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).

Calculator Clique on YouTube
Visit this user's website Find all posts by this user
Quote this message in a reply
03-05-2024, 12:14 PM
Post: #12
RE: DM-FORTH: FORTH implementation for the DM41X
Now compiled for the DM42 with appropriate adjustments to keyboard mapping (shown in video).

Download link is in the video description.




Calculator Clique on YouTube
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)