![]() |
Forum Index : Microcontroller and PC projects : CMM2: Memory map?
Page 1 of 3 ![]() ![]() |
|||||
Author | Message | ||||
alynna Newbie ![]() Joined: 05/10/2021 Location: United StatesPosts: 28 |
Can I get a memory map, including IO registers, of the CMM2? Also I sent a request in to be able to look at the source for MMBasic (I would like to add some additional functions), but I have not received it yet. |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
Hi @alynna, I think you're asking a question that might have had a simple answer for a real 8-bit computer, but the CMM2 is actually a 32-bit microcontroller and you are likely to be directed to the datasheet (there is a misnomer given it is a big document) and firmware code, which I'm sure Geoff will email you about when he has done time. Best wishes, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 4044 |
The ld input from here is basically a memory map. The datasheet for the CPU (STM32H743 / STM32H753) is on ST's site.... and it's big. There are related documents it references, too. John |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7937 |
As with most microcontrollers, messing with the memory map isn't something you play with - it breaks things very quickly. :) That doesn't mean it's impossible, but it's not recommended. If you are thinking of peeking & pokeing variable space then the tools are there in MMBasic. You can also effectively peek and poke a string of bits that can be a nibble, byte or word. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
alynna Newbie ![]() Joined: 05/10/2021 Location: United StatesPosts: 28 |
Ok found the memory map, by that I mean the hardware description and register map ... 3319 pages.. DAYAM. Kind of puts the C64 programmers reference in perspective. And I've been sent the source too now. I noticed the STM32 (including the ones on our boards) have an Ethernet MAC on it. Are the pins conveniently accessible? |
||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 4044 |
MMBasic is so fast you can probably just write them in it. John Edited 2021-10-07 06:15 by JohnS |
||||
alynna Newbie ![]() Joined: 05/10/2021 Location: United StatesPosts: 28 |
I am definitely thinking of peeking and poking into the hardware register space (Apparently between 0x40000000 and 0x5fffffff). I am also considering writing an assembler in MMBasic that will spit out CSub modules that can be called after assembled and do things... faster. I absolutely love the idea of having a machine that is 32 bit, fast, and yet I can hit low level hardware stuff. And write machine code for. Edited 2021-10-07 06:29 by alynna |
||||
alynna Newbie ![]() Joined: 05/10/2021 Location: United StatesPosts: 28 |
https://microcontrollershop.com/product_info.php?cPath=98_322&products_id=3625&osCsid=v34t2o38t62ne7j8729aj0ttp1 Also I want to implement the above. I see no reason why, using that, I could not create a TCP/IP stack in MMBasic. |
||||
twofingers![]() Guru ![]() Joined: 02/06/2014 Location: GermanyPosts: 1593 |
Hi, maybe Rubens thread helps a little. Regards Michael causality ≠ correlation ≠ coincidence |
||||
alynna Newbie ![]() Joined: 05/10/2021 Location: United StatesPosts: 28 |
So I have MMBasic in the STM32CubeIDE. I have more questions. Are functions and commands in the form of cmd_xxx and fun_xxx parsed by a preprocessor to become BASIC tokens, or is there a table to add new commands to somewhere. Does the CMM2 have a Discord or a Slack where these kinds of questions can be answered without cluttering up this board? Yes, I do know C. And some ARM assembler. Enough of the latter to get dangerous. |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7937 |
You need to talk to matherp and Geoffg regarding the workings of MMBasic. You also need to be aware that it's released under licence and that you aren't allowed to release modified versions of the code without permission. MMBasic for the CMM2 stores the BASIC program as an ASCII file on the SDcard. It is tokenized into RAM when a RUN command is given. At this point it overwrites the RAM used by the editor. When the editor restarts it overwrites the RAM used by the tokenized program and variables. Because of the way in which MMBasic works there may be limits on how many commands and functions can be built into the software. I don't know the limits for the CMM2 version. AFAIK all MMBasic discussion takes part on this forum. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
alynna Newbie ![]() Joined: 05/10/2021 Location: United StatesPosts: 28 |
I was planning on sending him back my changes so that he could release them as new versions. :) |
||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 4044 |
Maybe just read the source :) John |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
There is a table that new functions and commands are added to, grep is your friend. You might also find it helpful to start by looking at the much simpler Windows/DOS MMBasic source code where it is easier to see the wood for the trees and then build up to looking at the CMM2 source. Best wishes, Tom Edited 2021-10-07 08:05 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
alynna Newbie ![]() Joined: 05/10/2021 Location: United StatesPosts: 28 |
Nah, I've worked on more complex things before (I also know Verilog..). I have figured out how to make new commands and functions and started with: inp(<type> <addr>): Retrieves data from the hardware registers out <type>, <addr>, <value>: Modifies hardware registers. inp and out were traditional on Z80 BASIC where the I/O ports were off the memory bus. Addresses are offset by REGBASE (0x40000000) and limited from 0x0 to 0x1FFFFFFF. |
||||
alynna Newbie ![]() Joined: 05/10/2021 Location: United StatesPosts: 28 |
So now this is a thing: > list ?"Inp() and Out example." RNGBASE% = &H08021800 ?"RNGBASE Registers are at " hex$(RNGBASE%) RNGCTRL% = RNGBASE% RNGSTATUS% = RNGBASE% + 4 RNGDATA% = RNGBASE% + 8 'Activate true RNG out word RNGCTRL%,4 for j=1 to 64 'Wait for ready do: loop until inp(word RNGSTATUS%) mod 2) ?right$("00000000"+hex$(inp(word RNGDATA%)),8), if not(j mod 4) then ? next > run Inp() and Out example. RNGBASE Registers are at 8021800 A504E788 05DA23C7 6600402D 6BDEB523 8EF55AE9 A069EEC4 12D593D5 079ECAC3 4FE15A9B EAB0BE88 8E089FCD 87D707C3 14B92B37 BFD23E4D A3C943C6 D0B1EED6 6F4AA1CD 3211AFE4 345AF8EA D0544CCF 0416331A A4831831 D2196D9D A6D65EF3 2843420F B9B9FF09 0B43B26E 193C2FC3 930E67C3 5D47BDD2 B42D4516 C80E0083 3A5BFCF3 8F056B13 F3FEF826 3C1D5270 4C0ED776 BAD0B25C FF150590 514B80EA 20917F8B 7F2DB797 15D9054E 38874A75 107DBD4F DDF548EB A6D386D8 A75C9516 4DCE1FC9 8BB205F2 FD9A0DE3 4D5D746C 0EF59B9D 1FF17315 57676517 8B4A653C 03FD6AED 08EDE010 5DC692FB 310F922E 27D50444 1B09C399 A7A056A0 AAC919ED |
||||
alynna Newbie ![]() Joined: 05/10/2021 Location: United StatesPosts: 28 |
How do I contribute back to MMBasic? I made a new thing. > list 'Make some variables for the heck of it tails = 6 fox$ = "The quick brown fox jumped over a lazy dog." g! = 4.669201609 dim a$(10) 'Memory report! ?"Program memory size:" tab(30) mem(progsize) ?"Program lines:" tab(30) mem(proglines) ?"Variable memory size:" tab(30) mem(varsize) ?"Variable count:" tab(30) mem(varcount) ?"String var size:" tab(30) mem(stringsize) ?"Total flash memory:" tab(30) mem(flashsize) ?"Saved variable size:" tab(30) mem(fvarsize) ?"Saved variable count:" tab(30) mem(fvarcount) ?"Font memory size:" tab(30) mem(fontsize) ?"Font count:" tab(30) mem(fontcount) ?"C Function memory size:" tab(30) mem(cfuncsize) ?"C Function count:" tab(30) mem(cfunccount) ?"Heap size:" tab(30) mem(heap) ? ?"Total memory:" tab(30) mem(total) ?"Used memory:" tab(30) mem(used) ?"Free memory:" tab(30) mem(free) > run Program memory size: 767 Program lines: 22 Variable memory size: 3328 Variable count: 4 String var size: 3072 Total flash memory: 524288 Saved variable size: 0 Saved variable count: 0 Font memory size: 0 Font count: 0 C Function memory size: 0 C Function count: 0 Heap size: 2816 Total memory: 5472000 Used memory: 6911 Free memory: 5465089 Edited 2021-10-07 16:16 by alynna |
||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 4044 |
Why couldn't mem just be a csub? Maybe it would be better that way. John |
||||
alynna Newbie ![]() Joined: 05/10/2021 Location: United StatesPosts: 28 |
How? Is there some issue with contributing to MMBasic I don't know about? |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7937 |
You'll have to ask Geoffg that, not us. MMBasic is his baby. :) matherp has done a lot of porting to other platforms and has added a lot of functionality. He puts in a hell of a lot of (very much appreciated!) work maintaining MMBasic across several platforms. It will now run happily on a PIC chip (from 28-pin up), a RP2040 or an ARM Cortex. (I must have forgotten something...) If something will work on CMM2 but not on PicoMite or F4, for example, because of processor differences then it's possible that the idea may be rejected for compatibility reasons. At register level the platforms vary a lot but MMBasic has to remain more or less a constant. There are variations, but core commands tend to remain the same (or there is some form of easy adaptation or work-around). Bear in mind what MMBasic is about - it emulates using a 1980's home computer, but with a more modern BASIC and a few bells and whistles. If an idea deviates from that then it needs serious thinking about. Would you expect a C64, Speccy or Amstrad user to be happy using inp() and out all that much? How would you keep the addresses constant on all platforms so that BASIC programs remain compatible? Edited 2021-10-07 17:38 by Mixtel90 Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
Page 1 of 3 ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |