Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 01:18 10 May 2025 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 : PicoMite V6.00.02 betas

     Page 9 of 23    
Author Message
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4251
Posted: 11:08am 31 Jan 2025
Copy link to clipboard 
Print this post

Another whackier approach with possible greater applications would be to develop a mechanism to initialise LONGSTRINGs from multiple lines:

DIM asm%(256) = """
 .program toggle
 .line 0
 set pindirs,1
 .wrap target
 set pins,0
 set pins,1
 .wrap
 .end program list
"""
PIO ASSEMBLE 1, asm%()


But good luck getting Peter and Geoff to go down that rabbit hole.

Best wishes,

Tom
Edited 2025-01-31 21:31 by thwill
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10066
Posted: 03:04pm 31 Jan 2025
Copy link to clipboard 
Print this post

Harm

I've thought of a way of doing this. There is one wrinkle that I can't see away round - labels - the syntax is the same as an MMbasic label.

My thought is to have a new directive

.label labelname:


If you are OK with this I can post a test version for you to play with
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10066
Posted: 05:23pm 31 Jan 2025
Copy link to clipboard 
Print this post

Try this PicoMiteRP2020

PicoMite.zip


Edited 2025-02-01 03:31 by matherp
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7499
Posted: 07:33am 01 Feb 2025
Copy link to clipboard 
Print this post

Oh, I do hope this works! In so far as is possible it makes the assembler look so much more accessible and, even if it breaks existing programs, I suspect it will encourage far more people to write for the PIO. That's no bad thing. Well done!

I always thought that one of the greatest things about BBC BASIC was the in line assembler and this is something similar in some respects.
Mick

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

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2415
Posted: 07:57am 01 Feb 2025
Copy link to clipboard 
Print this post

  Quote  and, even if it breaks existing programs,
I think the current version of the assembler is fairly recent, many older PIO programs would have been hand assembled binary type so they may still work.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7499
Posted: 08:13am 01 Feb 2025
Copy link to clipboard 
Print this post

As the actual assembler instructions won't have have changed, apart from the .label directive. converting existing assembler listings probably isn't a major problem. IMHO the change is well worth it, just because it's likely to be easier to learn from existing code when it's listed like this.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10066
Posted: 08:34am 01 Feb 2025
Copy link to clipboard 
Print this post

The existing functionality works with no changes. The new code layers on top of it.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7499
Posted: 08:50am 01 Feb 2025
Copy link to clipboard 
Print this post

Even better! :) Thou are a Wizard!

⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣠⣤⣤⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣶⠟⠛⠉⠉⠉⠛⠻⢿⣶⣤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⡿⠁⠀⠀⠀⠀⠀⠀⠀⠀⣍⠻⢿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⡿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧⣄⠛⢿⣶⣄⣠⡾⣧⡀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣷⣦⡉⠻⣫⣾⡽⣷⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⠇⠀⠀⣀⣀⡀⠀⠀⠀⠀⣀⣀⡀⠀⠸⣿⠻⣿⣾⡿⠃⠹⣿⣷⡀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⣿⠟⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠻⣿⣇⠀⠉⠀⠀⠀⠈⠛⠛⠒⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⠃⢀⣀⣠⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣀⡀⠘⣿⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣶⡿⠿⠟⠋⠉⠉⠁⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠙⠛⠿⢿⣶⣦⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⢀⣠⣴⣾⠿⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠿⣷⣦⣄⡀⠀⠀⠀⠀
⠀⣀⣴⣾⣿⣛⣁⣤⣤⣀⣀⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⣀⣀⣠⣤⣌⣛⣿⣷⣦⣀⠀
⣼⡿⣿⣿⣿⣿⣿⣿⠋⠉⢹⡿⠻⣿⣿⡶⠒⠒⠲⣶⣶⣶⣶⣶⣶⡶⠖⠒⠲⢾⣿⣿⠟⢿⡏⠉⠙⣿⣿⣿⣿⣿⣿⢿⣷
⢹⣷⡙⢿⣿⣿⠾⠍⠁⠀⣾⠇⠀⢻⠀⢈⣻⣷⣶⣤⣤⡽⠟⢯⣤⣤⣴⣾⣿⡁⠀⡟⠀⠘⣷⠀⠈⠩⠷⣿⣿⡿⢋⣾⡟
⠀⠙⢿⣶⣭⣛⡿⠷⠤⣼⠏⢠⢶⣾⠀⠀⠙⠓⢦⣼⣿⡇⠀⢸⣿⣧⣴⠟⠋⠀⠀⣿⡄⡄⠹⣧⠤⠾⠿⣛⣭⣴⡿⠋⠀
⠀⠀⠀⠈⠛⠻⠿⣷⣶⠟⢰⡏⢸⣇⠀⠀⠀⠈⠉⢉⣹⠇⠀⠘⣏⡉⠉⠁⠀⠀⠀⢸⡇⢹⡆⠻⣶⣾⠿⠟⠛⠉⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢠⡏⢠⡟⠀⣼⣿⣄⠀⠀⠀⡼⠋⠻⠀⠀⠀⠾⠉⢳⡀⠀⠀⣠⣿⣷⠀⢹⡄⢹⣆⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢀⣟⣠⡿⢀⣼⡇⢹⣝⡷⣤⣼⣳⠴⠛⠳⠤⠔⠛⠦⣞⣷⣤⢴⣫⡟⠸⣷⡀⢿⣄⣻⡀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠸⢋⣿⠁⣼⢹⣆⠀⠉⠛⠛⠉⠁⠀⠀⣀⣿⣄⠀⠀⠀⠉⠛⠛⠉⠀⢠⡏⢧⠀⢿⡝⠇⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⣼⡇⣰⠃⠈⢿⣦⣄⣀⣀⣀⣤⡴⠞⠋⠉⠉⠳⢦⣤⣀⣀⣀⣠⣴⡿⠁⠘⣦⢸⣷⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢿⣿⡏⢠⠄⢸⣧⠉⠉⢻⣀⣠⡶⠞⠛⠉⠛⠳⢶⣤⣀⡟⠉⠉⢸⡇⠀⡄⢹⡿⠟⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⢸⣡⡏⠀⡄⢿⡀⠀⠀⠛⠉⠀⠀⠀⠀⠀⠀⠀⠉⠛⠁⠀⢀⡿⢡⡀⢹⣬⡇⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠸⡿⣇⢸⣿⢸⣷⣼⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣧⣾⡇⣼⣧⣸⢻⡇⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⠹⣿⡏⡿⣧⣤⠀⠀⠀⠀⠀⠀⠀⠀⠀⣤⣾⣿⠻⣿⠏⢿⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠀⠀⠁⠀⠻⣿⣦⣾⠀⠀⠀⠀⠀⣶⣤⡟⠟⠀⠀⠀⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⢻⣧⡀⠀⠀⣼⡿⡿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢷⣦⡾⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10066
Posted: 09:01am 01 Feb 2025
Copy link to clipboard 
Print this post

This is how it works. The PIO commands and directives are now actual commands in MMBasic but can only be used after the single "PIO ASSEMBLE n" and up until the ".end program" command. There is then a frig to allow commands starting with a ".". Internally they start with "_" which is allowed and the tokenizer converts them on input and the list command converts them back on output. Another frig de-tokenizes the symbols "-" and "=" which can appear in the JMP command. Then the code is trivial. For each PIO command a single function generates the associated PIO ASSEMBLE command

// mode determines functionality
// bit 0 sets whether to add a space after the text
// bit 1 sets whether to omit the missing program check
// bit 2 sets whether to add a colon after the text
// bit 3 enables the diagnostic print
void call_pio(char * instruction, uint8_t mode){
       if((instructions==NULL || pioinuse==99) && !(mode & 2))error("Missing Program statement");
       skipspace(cmdline);
       char *buff=GetTempMemory(STRINGSIZE);
       sprintf(buff,"ASSEMBLE %d, \"",pioinuse);
       strcat(buff,instruction);
       if(mode & 1)strcat(buff," ");
       strcat(buff,(char *)cmdline);
       char *p=buff;
       while(*p){ //strip comments and loose spurrious tokens
              if(*p==GetTokenValue((unsigned char *)"-"))*p=(unsigned char)'-';
              if(*p==GetTokenValue((unsigned char *)"="))*p=(unsigned char)'=';
              if(*p=='\''){
                      *p=0;
                      break;
              }
              p++;
       }
       // strip trailing spaces
       p=buff+strlen(buff)-1;
       while(*p==' ')*p--=0;
       if(mode & 4)strcat(buff,":");
       strcat(buff,"\"");
       cmdline=((unsigned char *)buff);
       if(mode & 8){MMPrintString((char *)cmdline);PRet();}
       cmd_pio();
}
void cmd_program(void){
       call_pio(".program",3);
}
void cmd_wrap(void){
       call_pio(".wrap",0);
}
void cmd_wraptarget(void){
       call_pio(".wrap target",0);
}
void cmd_PIOline(void){
       call_pio(".line",1);
}
void cmd_sideset(void){
       call_pio(".side set",1);
}
void cmd_endprogram(void){
       call_pio(".end program",strlen((char *)cmdline) ? 1 : 0);
}
void cmd_jmp(void){
       call_pio("jmp",1);
}
void cmd_wait(void){
       call_pio("wait",1);
}
void cmd_in(void){
        call_pio("in",1);
}
void cmd_out(void){
        call_pio("out",1);
}
void cmd_push(void){
        call_pio("push",1);
}
void cmd_pull(void){
        call_pio("pull",1);
}
void cmd_mov(void){
        call_pio("mov",1);
}
void cmd_nop(void){
        call_pio("nop",1);
}
void cmd_irqset(void){
        call_pio("irq set",1);
}
void cmd_irqwait(void){
        call_pio("irq wait",1);
}
void cmd_irqclear(void){
        call_pio("irq clear",1);
}
void cmd_irqnowait(void){
        call_pio("irq mov",1);
}
void cmd_irq(void){
        call_pio("irq",1);
}
void cmd_set(void){
       call_pio("set",1);
}
void cmd_label(void){
       call_pio("",4);
}

Edited 2025-02-01 19:17 by matherp
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7499
Posted: 09:19am 01 Feb 2025
Copy link to clipboard 
Print this post

Very neat. :)
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10066
Posted: 12:07pm 01 Feb 2025
Copy link to clipboard 
Print this post

V6.00.02b6 now available

https://geoffg.net/Downloads/picomite/PicoMite_Beta.zip

Includes support for FT6336 capacitive touch chip

OPTION TOUCH FT6336 IRQpin, RESETpin [,BEEPpin] [,sensitivity]

sensitivity is a number between 0 and 255 - defaults to 50, lower is more sensitive.
SDA and SCK should be connected to valid I2C pins and set up with OPTION SYSTEM I2C

TOUCH function works as before + TOUCH(X2) and TOUCH(Y2) returns the position of a second touch location or -1 if no second location is touched.

New commands

Support for all PIO commands as per post above. Note that labels required must be identified with the directive ".LABEL" in order to differentiate them from MMBasic labels


LIST SYSTEM I2C

Produces a display showing the addresses of all I2C device connected to the STSTEM I2C pins (another sneaky bit of embedded Basic)

Edited 2025-02-01 22:08 by matherp
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4854
Posted: 02:44pm 01 Feb 2025
Copy link to clipboard 
Print this post

Hi Peter,

Sorry I was not in position to test earlier. I was at a concert last afternoon/evening...

I am not sure this PIO assembler change is backwards compatible, but it feels (from your explanation) that .WRAP it translated into _WRAP. This has impact on the PIO handlers.

Please find attached code (runs fine on b5) that throws an error.

RUN
0: A02B
1: 20A0
2: 0043
3: 00C2
4: A0C9
5: 8000
[149] puls_wrap=Pio(_wrap)
Error : Syntax


The code (is far from finished) it this:

fc2_v02.zip

I tried the new assembler format, and the issue is the same.

fc2_v02_new_asm.zip

I tried replacing .WRAP with _WRAP, but that does not help. I think under water the PIO helper still checks for .WRAP and not _WRAP.

I have another question. In the original program i implemented the "debug" variable that shows the disassembly listing yes or no by changing the string. Is this portable in any way to the new assembler format ?

Regards,

Volhout
Edited 2025-02-02 01:01 by Volhout
PicomiteVGA PETSCII ROBOTS
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10066
Posted: 03:00pm 01 Feb 2025
Copy link to clipboard 
Print this post

Easily fixed - will post an update later this afternoon. To carry on testing just global replace _wrap with wrap in the variable names
 
electricat

Senior Member

Joined: 30/11/2020
Location: Lithuania
Posts: 294
Posted: 03:32pm 01 Feb 2025
Copy link to clipboard 
Print this post

  matherp said  V6.00.02b6 now available
LIST SYSTEM I2C


But there might be different slave`s SCL speeds...
My MMBasic 'sand box'
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10066
Posted: 03:35pm 01 Feb 2025
Copy link to clipboard 
Print this post

SYSTEM I2C can be set to 400 or 100. It's up to the user - see manual. Obviously set it to the speed of the slowest device. Nothing to do with this command
 
electricat

Senior Member

Joined: 30/11/2020
Location: Lithuania
Posts: 294
Posted: 03:49pm 01 Feb 2025
Copy link to clipboard 
Print this post

Ha   as I instantly get it as idea of universal command not attached to system I2C, but to I2C / I2C2 so removed word SYSTEM.
My MMBasic 'sand box'
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10066
Posted: 07:31pm 01 Feb 2025
Copy link to clipboard 
Print this post

error
Edited 2025-02-02 05:57 by matherp
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10066
Posted: 10:42pm 01 Feb 2025
Copy link to clipboard 
Print this post

Harm

Try this


PicoMite.zip
 
JanVolk
Senior Member

Joined: 28/01/2023
Location: Netherlands
Posts: 220
Posted: 11:48pm 01 Feb 2025
Copy link to clipboard 
Print this post

Unfortunately I am getting an error message.

> list pins
GP0      1      OFF
GP1      2      Boot Reserved : I2S BCLK
GP2      4      Boot Reserved : I2S LRCK
GP3      5      OFF
GP4      6      Boot Reserved : SPI SYSTEM MISO
GP5      7      Boot Reserved : I2S DATA
GP6      9      Boot Reserved : SPI SYSTEM CLK
GP7      10     Boot Reserved : SPI SYSTEM MOSI
GP8      11     Boot Reserved : CONSOLE TX
GP9      12     Boot Reserved : CONSOLE RX
GP10     14     OFF
GP11     15     OFF
GP12     16     Boot Reserved : HDMI
GP13     17     Boot Reserved : HDMI
GP14     19     Boot Reserved : HDMI
GP15     20     Boot Reserved : HDMI
GP16     21     Boot Reserved : HDMI
GP17     22     Boot Reserved : HDMI
GP18     24     Boot Reserved : HDMI
GP19     25     Boot Reserved : HDMI
GP20     26     Boot Reserved : SYSTEM I2C SDA
GP21     27     Boot Reserved : SYSTEM I2C SCL
GP22     29     Boot Reserved : SD CS
GP23     41     DOUT
GP24     42     DIN
GP25     43     HEARTBEAT
GP26     31     OFF
GP27     32     OFF
GP28     34     OFF
GP29     44     AIN
> cls
> option list
PicoMiteHDMI MMBasic USB RP2350A Edition V6.00.02b6
OPTION SERIAL CONSOLE COM2,GP8,GP9
OPTION SYSTEM I2C GP20,GP21
OPTION FLASH SIZE 4194304
OPTION COLOURCODE ON
OPTION KEYBOARD US
OPTION CPUSPEED (KHz) 315000
OPTION HDMI PINS  1, 3, 7, 5
OPTION SDCARD GP22, GP6, GP7, GP4
OPTION AUDIO I2S GP1,GP5', ON PWM CHANNEL 0
> list system i2c
[LIBRARY] Pin(gp1)=1
Error : Pin 2/GP1 is not an output
>

Greetings,

Jan
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2415
Posted: 02:43am 02 Feb 2025
Copy link to clipboard 
Print this post

What does Library List show?
 
     Page 9 of 23    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025