PeteCotton
 Guru
 Joined: 13/08/2020 Location: CanadaPosts: 456 |
Posted: 10:26pm 22 Apr 2024 |
|
|
|
Building an Assembler would be an interesting challenge.
I suspect a limited subset (MOV, MVN, CMP, LDR, ADD, SUB, MUL, AND, OR, LSL etc.) wouldn't be too hard to implement, something like just the commands for moving variables between memory registers/locations which would allow for functions that do mass sorting, or fast algorithms. These could be pointed at BASIC arrays in memory or graphics memory banks to ensure that it stuck to reserved memory.
But the cortex processors appear to be a significant step beyond 6502 or 68000 assembly, with a multitude of quite complex commands, interrupts and memory manipulation (Note: I cannot program ARM assembly - but I was pretty proficient with 6809E and Z80 back in the day). I don't know how deep this rabbit hole goes, but I think a full implementation might be fraught with issues. And then of course, there's the fact that it would have to co-exist with another program (the BASIC interpreter) and not step on each other's toes.
Even then, I'm talking about a separate Assembler program written in BASIC that would spit out the machine code for the CSUB, which could then be saved to disc (as a BASIC program with a CSUB) and then loaded into memory (replacing the Assembler program in memory) and executed. I think trying to do an inline one (where it is part of the BASIC editor) might be a bridge too far to begin with.
But the real question is - Why? The CMM2 BASIC is fast - I mean really fast. Sure, you can eventually hit the limit of what it can do, but isn't that part of the fun of programming it? Finding those limits and working within them. If we want an infinitely powerful computer, then we could just run MMBasic for Windows on a pc. Also, many of the functions (moving chunks of memory between graphics pages) are probably already so heavily tuned, that being able to do it in assembly probably isn't going to gain you much.
Having thrown up all of those road blocks - I don't want to dissuade anyone from doing this - I think it would be fascinating, but the reasons for doing it might not be as straightforward as we think.
Of course, a good reason to do it would be as a learning tool for ARM assembly language.  Edited 2024-04-23 08:28 by PeteCotton |