Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 20:34 02 May 2026 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Assembler on CMM2

Author Message
joker

Regular Member

Joined: 06/02/2024
Location: Germany
Posts: 42
Posted: 06:24pm 01 May 2026
Copy link to clipboard 
Print this post

Hello,
Do you remember that we talked quite a while ago about an ARM Assembler in Basic?

After finishing some other projects I gave it a second thought and this time it worked. I created an assembler suite containing a
 - a Thumb/Thumb-2 assembler for a cortex-M7
 - a disassembler to view CSUB code
 - file format converters from
   - bin to CSUB
   - CSUB to bin
   - ELF to CSUB
 - an assembler include file for the MMBasic API

Maybe this is the most useless programm since the book "How to learn French" was translated to French, but to my surprise you can do real work with it.  

It is a 1.5 pass assembler, which uses some private arrays to encode forward references without a second pass. As a result, it needs some help with some encodings once in a while. It only supports Thumb (16 and 32-bit), one processor (cortex-M7) and only a limited set of assembler directives. It cannot live up to the arm-non-eabi-as or the gcc but it works.

You can find the code on github.com: CMM2 Assembler Wiki

Tell me what you think.

Cheers
 Matthias
 
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 1872
Posted: 07:57pm 01 May 2026
Copy link to clipboard 
Print this post

Does this mean the possibility of mere mortals being able to create CSUBS?
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4308
Posted: 08:47pm 01 May 2026
Copy link to clipboard 
Print this post

  PhenixRising said  Does this mean the possibility of mere mortals being able to create CSUBS?

Probably easier to write them in C than ASM but still only easy if you know C.

This looks an interesting post, bearing the above in mind.

John
 
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 1872
Posted: 09:36pm 01 May 2026
Copy link to clipboard 
Print this post

Oh, I'm not afraid of C but I understood that the tricky bit was creating the CSUB for MMBasic.

The way I read the above is that not only asm code but also C code can be processed to be oven ready.

Again, I am the master of misinterpreting  
 
joker

Regular Member

Joined: 06/02/2024
Location: Germany
Posts: 42
Posted: 07:47am 02 May 2026
Copy link to clipboard 
Print this post

Hello,
Yes, the converter ELF2csub.bas will convert cross compiled C-code into an CSUB, too. But ths was already possible with the tool armcfgen143.bas, which is part of the firmware package. I just included it to have everything in one place and anyway, elf2csub-bas mimics its behaviour.

The problem of mere mortals is not to create a CSUB but to write something in C or assembler that pushs an MMBasic program really forward. I just paved the road, you must now walk on it (sorry, but I don't want to stress the citation from Matrix again, with the door or so.   )

Matthias
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4308
Posted: 09:33am 02 May 2026
Copy link to clipboard 
Print this post

  PhenixRising said  Oh, I'm not afraid of C but I understood that the tricky bit was creating the CSUB for MMBasic.

I don't see it as tricky, particularly as there's a detailed writeup with examples.

However, what is needed in C and why?  Mostly the CPU is doing not much (waiting for I/O or a timer).

(This would be somewhat less true if PIOs didn't exist.)

John
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 8794
Posted: 10:09am 02 May 2026
Copy link to clipboard 
Print this post

I'm pretty sure that in most instances CSUBs aren't needed now. They were handy when MMBasic was less developed but a lot has happened since. I suppose they are handy if you want to make your programs unreadable, unsupportable and incompatible across different platforms and versions of NNBasic though. ;)
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2026