Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 18:33 24 Nov 2024 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 : RP2350 firmware

     Page 17 of 20    
Author Message
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1113
Posted: 04:55pm 20 Sep 2024
Copy link to clipboard 
Print this post

Kevin,
use Mode 2 for PetsciiRobots and Flappy.
You also have no added value when using Mode 5, as these games are designed for the 16 Picomite VGA colors.
Cheers, Martin
'no comment
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 05:19pm 20 Sep 2024
Copy link to clipboard 
Print this post

Hi Martin,
Yes I realise this, I was simply running the tests that Peter had requested.
Regards, Kevin.
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1113
Posted: 05:27pm 20 Sep 2024
Copy link to clipboard 
Print this post

  Bleep said  Hi Martin,
Yes I realise this, I was simply running the tests that Peter had requested.
Regards, Kevin.

that should not be a reproach.
The sprite memory commands still rely on the 4bit/pixel 160 Byte per Line structure. That is why some of the sprites look so torn apart
Edited 2024-09-21 03:28 by Martin H.
'no comment
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 05:39pm 20 Sep 2024
Copy link to clipboard 
Print this post

Ok, so sounds like I shouldn't have tried them with Mode 5, as I said I wasn't sure if Peter wanted them tested in both 2 and 5, he did want his test program tested in both, which did worked fine in both.
Mode 2 Flappy and Petscii both work fine. :-)
Regards, Kevin.
Edited 2024-09-21 03:42 by Bleep
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9105
Posted: 06:20pm 20 Sep 2024
Copy link to clipboard 
Print this post

I want mode 5 (memory permitting) to be able to run a game programmed originally for mode 2. Thanks to Bleep's work I now have more idea of where I need to make changes so his efforts are appreciated. From Thursday next week onwards I'll have access to a HDMI setup again so can do my own testing.
Edited 2024-09-21 04:20 by matherp
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2120
Posted: 09:25pm 20 Sep 2024
Copy link to clipboard 
Print this post

  matherp said  I've updated the RP2350 VGA and HDMI versions. Please could someone test for me:

PicoMiteRP2350V6.00.00b6.zip

Petscii robots on VGA
Mode 2 and Mode 5 on HDMI and assuming working
The attached on HDMI in both mode 2 and mode 5
and then Petscii robots on HDMI

Thanks

MODE 2
FRAMEBUFFER layer
FRAMEBUFFER layer top
FRAMEBUFFER write T
'Box i,MM.VRes\6*2,MM.HRes\4,MM.VRes\3,10,RGB(red),RGB(green)
FRAMEBUFFER write l
'Circle MM.HRes\2,MM.VRes\2,MM.HRes\4,10,1,RGB(blue),RGB(yellow)
'Text MM.HRes\2,MM.VRes\2,"MIDDLE",CM,,3,RGB(CYAN),-1
d=1
i=0
rr=0
x=Sin(Rad(0))*40
y=Cos(Rad(0))*40
Do
FRAMEBUFFER write n
r = Rnd * 255
g = Rnd * 255
b = Rnd * 255
Circle Rnd * MM.HRes, Rnd * MM.VRes, Rnd * MM.HRes/7,,, 0, RGB(r,g,b)
Inc rr,3
xl=x
yl=y
x=Sin(Rad(rr))*40
y=-Cos(Rad(rr))*40
FRAMEBUFFER wait
FRAMEBUFFER write l
Circle MM.HRes\2+xl,MM.VRes\2+yl,MM.HRes\6,0,1,0,0
Circle MM.HRes\2+x,MM.VRes\2+y,MM.HRes\6,10,1,RGB(blue),RGB(yellow)
Text MM.HRes\2+x,MM.VRes\2+y,"MIDDLE",CM,,2,RGB(CYAN),-1
FRAMEBUFFER write t
Box i,MM.VRes\6*2,MM.HRes\4,MM.VRes\3,0,0,0
Inc i,d
Box i,MM.VRes\6*2,MM.HRes\4,MM.VRes\3,10,RGB(red),RGB(green)
Text i+MM.HRes/8,MM.VRes\2,"TOP",CM,,3,RGB(magenta),RGB(green)
If i>=MM.HRes/4*3 Then d=-1
If i=0 Then d=1
Loop

works fine vga usb pico2
> option list
PicoMiteVGA MMBasic USB Edition  6.00.00b6
OPTION SERIAL CONSOLE COM2,GP8,GP9
OPTION FLASH SIZE 4194304
OPTION COLOURCODE ON
OPTION KEYBOARD UK
OPTION CPUSPEED (KHz) 378000
OPTION DISPLAY 30, 53
OPTION SDCARD GP13, GP10, GP11, GP12
OPTION AUDIO GP0,GP1', ON PWM CHANNEL 0
>
Edited 2024-09-21 07:29 by stanleyella
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 09:03am 21 Sep 2024
Copy link to clipboard 
Print this post

Hi Peter,
That would be fantastic, if you are able to get programs to work well in either mode. :-)

Unfortunately another bug, in Widescreen Mode 1, if I issue a command to draw several circles, using an array, I get Display not configured, Mode 2 & 3 work ok:-

> run
[53] Circle ctrx(col), ctry(row), r,,,c.outline,c.face
Error : Display not configured

PicoMiteHDMI MMBasic Version 6.00.00b6
OPTION FLASH SIZE 4194304
OPTION COLOURCODE ON
OPTION KEYBOARD US
OPTION CPUSPEED (KHz) 372000
OPTION DISPLAY 30, 80
OPTION WIDESCREEN ENABLE
OPTION SDCARD GP11, GP10, GP7, GP6
OPTION DEFAULT FONT 3, 1

I can send the whole program if you can't reproduce.
Regards, Kevin.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9105
Posted: 11:24am 21 Sep 2024
Copy link to clipboard 
Print this post

Kevin: Can you either create a simple demo program or try your program again with fewer circles and/or smaller circles and let me know what happens - thanks


PicoMiteRP2350V6.00.00b7.zip


This one is for Tom

new commands:
CMM2 LOAD fname$ [,R]
CMM2 RUN fname$

These commands load and/or run programs whilst supporting the CMM2 directives

#DEFINE
#INCLUDE
#COMMENT START/END
#MMDEBUG ON/OFF

The program is loaded and crunched as per the CMM2 so if you edit the loaded program you will see it without any spaces and or comments and with the INCLUDE files inserted in-line.
If using these it therefore makes sense to only edit the individual source files off disk and back onto disk
EDIT fname$

This loads but doesn't run due to reuse of same variable with different type



This runs beautifully including my #define hacks

#DEFINE "rp()","LGetByte(m(),pc):inc pc"
#DEFINE "rp()*256","rpx()*256"
#DEFINE "spo()","stk(sp-1):inc sp,-1"
#DEFINE "rb(ad)","LGetByte(m(),ad)"
#DEFINE "rb(ad-1)","LGetByte(m(),ad-1)"
'Function spo()
' inc sp,-1
' spo=stk(sp)
'End Function


' Transpiled on 01-08-2020 19:19:55

' Copyright (c) 2020 Thomas Hugo Williams
'
' Optimised CMM2 version of Z-MIM







Hope you don't mind me posting Tom - could be added to the games thread?


zmim.zip



Edited 2024-09-21 21:26 by matherp
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 12:14pm 21 Sep 2024
Copy link to clipboard 
Print this post

Hi Peter,
I completely neglected to say this is using a Frame buffer.
so I am doing a:-
Framebuffer create
Framebuffer write f

Before I try to draw the circles.
I have now found that:-
Running the same program with no frame buffers, Wide screen Mode 1 works ok, with some flickering.
As soon as I set up the frame buffer then no graphics commands work and I get Display not configured, Wide screen Mode 1.
Sorry for neglecting that.
Regards Kevin.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6779
Posted: 12:45pm 21 Sep 2024
Copy link to clipboard 
Print this post

Text adventures on a Pico.. :)
I'm in love....  <swoon>....
Mick

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

Joined: 11/12/2012
Location: United Kingdom
Posts: 9105
Posted: 12:54pm 21 Sep 2024
Copy link to clipboard 
Print this post

Kevin

That now makes sense. Please try this. NB: you may run out of memory depending on the complexity of your program as the framebuffer will eat 112K bytes of your memory

PicoMiteRP2350V6.00.00b7.zip
Edited 2024-09-21 23:00 by matherp
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4036
Posted: 03:19pm 21 Sep 2024
Copy link to clipboard 
Print this post

  matherp said  This one is for Tom


If the intent was to distract me then you did so at least temporarily.

  matherp said  
CMM2 LOAD fname$ [,R]
CMM2 RUN fname$
...


Nice additions.

  matherp said  This loads but doesn't run due to reuse of same variable with different type


Looks like I'd left the SAAINT source code in an unstable state .

I've done a quick fix for this and if you update your clone (you may need to do a forced update) or download a new zip then this problem will hopefully be resolved:

- https://github.com/thwill1000/cmm2-saaint-public
- https://github.com/thwill1000/cmm2-saaint-public/archive/refs/heads/main.zip

HOWEVER when I last looked at it on real RP2040 hardware it would report OOM because its use of strings is very naive. It should easily fit (the original games would run in 16K), I just never got around to implementing more efficient read-only string storage. It may run unaltered on an RP2350.

With regards Z-MIM I'm not entirely certain which memory-model you've built with, I suspect it might be the one where the entire story file is held in RAM, in which case IIRC the RP2040 has enough RAM to run "minizork" but not any of the proper Infocom .z3 story files. I'm afraid it is yet another thing I need to look at, my plan was to load the read-only parts of the story file into a flash slot.

  matherp said  Hope you don't mind me posting Tom - could be added to the games thread?


Of course I don't mind. I was holding off posting them myself until they were properly working on the Pico (if/when I get around to it), but I don't object to someone else posting if they want to.

BTW did you get my email about LOAD BMP ?

Best wishes,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9105
Posted: 08:50am 22 Sep 2024
Copy link to clipboard 
Print this post

V6.00.00b8

PicoMiteRP2350V6.00.00b8.zip

This has more facilities for compatibility with CMM2 programs
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6779
Posted: 09:01am 22 Sep 2024
Copy link to clipboard 
Print this post

Is this becoming the CMM1.5-and-a-bit, Peter?  :)

( "and-a-bit" is a classic technical term, of course. Originally used in the precision positioning of rocks by cavemen.)
Mick

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

Senior Member

Joined: 01/10/2023
Location: Ukraine
Posts: 207
Posted: 09:05am 22 Sep 2024
Copy link to clipboard 
Print this post

  matherp said  V6.00.00b8

When can we expect an update to the PicoMite code on GitHub?
This is important to me because I am immediately setting up this project for different hardware for a small community of retro computer enthusiasts.
Edited 2024-09-22 19:17 by javavi
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4222
Posted: 12:02pm 22 Sep 2024
Copy link to clipboard 
Print this post

Peter,

If there is one thing from cmm2 that would be much appreciated, it is a way to browse the sd card.
A filebrowser. Ideally that would be one that can also move, copy files ( a 2 pane browser like midnight commander. But the cmm2 browser is also fine, with its build in file associations.

I remember there was midnight commander alike browser written in mmbasic for cmm2.

Anyway… a file browser for picomite would be great.

Regards,

Volhout
PicomiteVGA PETSCII ROBOTS
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 12:08pm 22 Sep 2024
Copy link to clipboard 
Print this post

Hi Peter,
In B7 and B8 Framebuffer now works fine. However I get the following.
I have only adjusted the positioning and size of the clocks so far, not bothered yet to correct the tiles for colouring.
Wide Screen Mode 1 B9
The horizontal and vertical bar appears to be the fill from the lower line of clocks gone awol. The hands are being drawn from a Ploygon command, which draws multiple hands at a time from arrays. I get the same with or without Framebuffer.

With the hands moving you can see the origin of some of the hands being at 12 O'clock


This is what it should look like in Non Widescreen.


Edited 2024-09-22 22:21 by Bleep
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1113
Posted: 01:48pm 22 Sep 2024
Copy link to clipboard 
Print this post

I spent a little time understand BMP file Header structure for Mode 2 and mode 3 (640x480x16)



the Image must be saved as uncompressed BMP with 4 bit colors, the MAP values are read from the file header.
BMP Decoder

file$="chess.bmp"
MODE 2
Map reset:Map set
CLS
Dim integer w,h,f,cl,c
Open file$ For random As #1
read_BMP_Header
Map set
If h>240 Then MODE 3
hi=MM.VRes
yofs=(hi-h)/2
yofs=hi-yofs
Seek #1,54+65
For y=0 To h-1
 For x=0 To w-1Step 2
   l$=Input$(1,1)
   cl=Asc(l$)
   Pixel x,yofs-y,Map(cl>>4):Pixel x+1,yofs-y,Map(cl And 15)
 Next
Next
Close #1
For c=0 To 15:cl=Map(c):Box c*20,0,20,10,,cl,cl:Next
Map set


Sub read_BMP_Header
Local l$
WStart= &H13
Hstart= &H17
MPStart= 55
Seek #1,WStart
l$=Input$(1,1):W=Asc(l$)
l$=Input$(1,1):Inc w,256*(Asc(l$))

Seek #1,HStart
l$=Input$(1,1):h=Asc(l$)
l$=Input$(1,1):Inc h,256*(Asc(l$))

Seek #1,MPStart
For F=0 To 15
l$=Input$(1,1):B=Asc(l$)
l$=Input$(1,1):G=Asc(l$)
l$=Input$(1,1):R=Asc(l$)
l$=Input$(1,1)'fillbyte
   Map(f)=RGB(R,G,B)
Next
End Sub
>

not quite perfect yet,there is even more information in the header that one can use, but a start  
possibly the reading of the color palette and transfer to MAP values can be included in the “Load Image” command



  Quote  Here's an example of a 4-bit BMP header for an image with a resolution of 320x240 pixels:
1. BMP File Header (14 Bytes)

   Offset 0 (2 Bytes): 42 4D (BM - signature for Bitmap files)
   Offset 2 (4 Bytes): 36 96 00 00 (Total file size in bytes: 38,518 bytes)
   Offset 6 (2 Bytes): 00 00 (Reserved)
   Offset 8 (2 Bytes): 00 00 (Reserved)
   Offset 10 (4 Bytes): 36 00 00 00 (Offset to the image data: 54 bytes)

2. DIB Header (Info Header) - 40 Bytes

   Offset 14 (4 Bytes): 28 00 00 00 (Header size: 40 bytes)
   Offset 18 (4 Bytes): 40 01 00 00 (Image width: 320 pixels)
   Offset 22 (4 Bytes): F0 00 00 00 (Image height: 240 pixels)
   Offset 26 (2 Bytes): 01 00 (Number of color planes: 1)
   Offset 28 (2 Bytes): 04 00 (Color depth: 4 bits per pixel)
   Offset 30 (4 Bytes): 00 00 00 00 (Compression: None)
   Offset 34 (4 Bytes): 00 96 00 00 (Image data size: 38,400 bytes)
   Offset 38 (4 Bytes): 13 0B 00 00 (Horizontal resolution: 2835 pixels/meter)
   Offset 42 (4 Bytes): 13 0B 00 00 (Vertical resolution: 2835 pixels/meter)
   Offset 46 (4 Bytes): 10 00 00 00 (Number of colors in palette: 16)
   Offset 50 (4 Bytes): 00 00 00 00 (Important colors: 0)

3. Color Table (64 Bytes)

The color table contains 16 entries, each with 4 bytes (Blue, Green, Red, Reserved):

4. Pixel Data

The pixel data starts at byte 54 and has a size of 38,400 bytes. Each pixel is represented by 4 bits (an index in the color palette), and one byte contains two pixels.

This is the basic structure for a 320x240 image with 4-bit color depth.

Cheers
Martin
Edited 2024-09-23 00:25 by Martin H.
'no comment
 
javavi

Senior Member

Joined: 01/10/2023
Location: Ukraine
Posts: 207
Posted: 02:27pm 22 Sep 2024
Copy link to clipboard 
Print this post

  Volhout said  
I remember there was midnight commander alike browser written in mmbasic for cmm2.
Anyway… a file browser for picomite would be great.

Peter,Volhout,
I would also like to have a file manager built into PicoMite, like a built-in code editor, so that it could also work in the terminal.



I even started making one in MMBASIC, but it is not finished. It only does not work for editing and launching programs.
FM - File Manager.zip
Regards, javavi
Edited 2024-09-23 00:28 by javavi
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9105
Posted: 04:26pm 22 Sep 2024
Copy link to clipboard 
Print this post

  Quote  If there is one thing from cmm2 that would be much appreciated, it is a way to browse the sd card.
A filebrowser. Ideally that would be one that can also move, copy files ( a 2 pane browser like midnight commander. But the cmm2 browser is also fine, with its build in file associations.


Sorry, but I hate that sort of messy string coding so no chance.

  Quote  In B7 and B8 Framebuffer now works fine. However I get the following.


Please post the whole program or a demo of the problem and I'll look when I get back home
 
     Page 17 of 20    
Print this page
© JAQ Software 2024