Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 12:27 27 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 : PICO PETSCII

     Page 5 of 38    
Author Message
Martin H.

Guru

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

  Mixtel90 said  An LCD system is where you might get speed problems, unless it's a parallel display. VGA is far faster.

Yes, but I will give it a try, as soon as I have the Game*Mite here and running.
In the little Scroll demo there is a Pause 75 Command so that it runs at a tolerable speed.  This means that, if you don't take the rest of the program into account, it runs at 13 FPS and smoothly.
If we can display that on the LCD at around 10 FPS, would it be worth implementing.

But that's all in the future, so far we just have the graphics (80%), the maps (100%) and the fast Sprite screen routine.
Edited 2023-09-22 23:36 by Martin H.
'no comment
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 05:28pm 22 Sep 2023
Copy link to clipboard 
Print this post

Hi Martin & Harm,
I have tested on a LCD display, this is the code I used.
'CSUB scroll test
'MODE 2
FRAMEBUFFER create
Dim LV$(64) Length 128
Open "Data\LEVEL-c" For input As #1
For f=0 To 63:LV$(f)=Input$(128,#1):Next
Close #1

'make an index file
create_index


'prepare screen
'path$="tiles\"
FRAMEBUFFER layer
FRAMEBUFFER write l
Load image "layer.bmp"
FRAMEBUFFER write f
ox=0:oy=32
For y=0 To 8
For x=0 To 12
 vl=Asc(Mid$(lv$(y+oy),ox+x+1,1))
 Blit compressed tile_index%(vl),x*24,y*24
Next
Next
FRAMEBUFFER write l
ox=13
x=0:oy=32


'scroll left
f=4:y=0:sn=0
Do
FRAMEBUFFER write l
Blit compressed sprite_index%(4+sn),120,96
Inc sn:If sn=4 Then sn=0
FRAMEBUFFER write f
'Blit scroll -8,0
If f=7 Then
  'draw next column
  For y=0 To 8
    vl=Asc(Mid$(lv$(y+oy),ox,1))
    Blit compressed tile_index%(vl),264,y*24
  Next
  y=0:Inc ox:If ox>116 Then ox=1
  f=4
EndIf
Inc f:Pause 75
FRAMEBUFFER copy l,f
FRAMEBUFFER copy f,n
Loop
......
No changes from here on.

This is Harms code as supplied in the zip a couple of posts back, but with a FRAMEBUFFER Create added to use in place of the N buffer.

First problem is that I have had to comment out the Blit scroll -8,0 because I get a syntax error? I don't think my display can be read from, but I though that was why the F buffer was being used?
Second problem is that transparency doesn't appear to work.

This is the image I get with the code as shown above, the little man is animated, otherwise nothing is moving, (not surprising as I've removed the scroll).



Just to be sure the tiles are loading ok, I reversed the frame buffercopy, to become.
FRAMEBUFFER copy f,l
FRAMEBUFFER copy l,n


Which gives:-



Now the strip of tiles on the Right are updating, but everything else is obliterated and static, no little man.
As is, with the Pause removed each frame is taking between 89 and 93mS at default cpu speed, 81 to 84mS at cpuspeed 252, as expected, the speed is limited by the display communications.
If I'm doing something wrong, let me know and I'll try again. :-)
Regards, Kevin.
Edited 2023-09-23 03:47 by Bleep
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4243
Posted: 05:42pm 22 Sep 2023
Copy link to clipboard 
Print this post

This is something to investigate. Scrolling on vga requires plainting new sprites, on the left side of the screen. That is correct.

I am not sure the VGA layers N and L will work correct on a LCD. Maybe all must be painted in 1 layer.
PicomiteVGA PETSCII ROBOTS
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 05:58pm 22 Sep 2023
Copy link to clipboard 
Print this post

  Volhout said  This is something to investigate. Scrolling on vga requires plainting new sprites, on the left side of the screen. That is correct.

I am not sure the VGA layers N and L will work correct on a LCD. Maybe all must be painted in 1 layer.


Wouldn't that mean having to load the image "layer.bmp" each frame, which would be very slow?
 
Martin H.

Guru

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

@harm
  Volhout said  @Martin,

unpzip attached into a folder.
then

load "spr_csub.bas"
library save
load "tile0_csub.bas"
library save
load "tile1_csub.bas"
library save
load "tile2_csub.bas"
library save
memory



Ready clicking Pixels  
here is the enhanced Spriteset. I have now drawn a border around them to make them more clearly visible

I also included the SPR Files, to be on the Save site.
additionally I painted the 6 48x48 Health Sprites
the spr_csub.bas should be replaced with the new set and the new Index file.
The Healtz Sprites are new.

New-Sprites.zip

have fun
'no comment
 
Martin H.

Guru

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

Kevin

Nice to see your Work in Progress..
let me guess   ...
Load the Layer.bmp to the normal Display..
Now switch to the Framebuffer
do the Tilework
temporarily capture the Area where the Player Sprite should be placed...
draw the Player Sprite to its place the Framebuffer.
use Peters new implemented command
  Quote  
BLIT FRAMEBUFFER F/L/N, F/L/N, xfrom, yfrom, xto, yto, width, height [,col]

to copy just the area you need to see to the N screen

should be  

BLIT FRAMEBUFFER F, N, 0,24,0,24,266,168


redraw the buffered area to delete the Playersprite and restore the Background,on the Framebuffer
look if you can replace the missing  Blit scroll -8,0 Command with
blit 8,0,0,0,312,240
Sadly I have no working LCD Pico at the moment thats why I can not test it.
its a Guess

Cheers
Martin
Edited 2023-09-23 05:44 by Martin H.
'no comment
 
Bleep
Guru

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

Hi Martin,
Have got it basically working, the only thing wrong is the moving character has a black background, everything else is as it should be, I hope.
'CSUB scroll test
FRAMEBUFFER create 'f
FRAMEBUFFER layer  'l
Dim LV$(64) Length 128
Open "Data\LEVEL-c" For input As #1
For f=0 To 63:LV$(f)=Input$(128,#1):Next
Close #1

'make an index file
create_index

'prepare screen
'path$="tiles\"
Load image "layer.bmp"
FRAMEBUFFER write f
ox=0:oy=32
For y=0 To 8
For x=0 To 12
 vl=Asc(Mid$(lv$(y+oy),ox+x+1,1))
 Blit compressed tile_index%(vl),x*24,y*24
Next
Next
ox=13
x=0:oy=32

'scroll left
f=4:y=0:sn=0
Do :Print Timer:Timer =0
FRAMEBUFFER write f
Blit 8,0,0,0,312,240
If f=7 Then
  'draw next column
  For y=0 To 8
    vl=Asc(Mid$(lv$(y+oy),ox,1))
    Blit compressed tile_index%(vl),264,y*24
  Next
  y=0:Inc ox:If ox>116 Then ox=1
  f=4
EndIf
Inc f':Pause 75
FRAMEBUFFER Blit f,n,0,24,0,24,266,168
FRAMEBUFFER Write l
Blit compressed sprite_index%(4+sn),120,96
Inc sn:If sn=4 Then sn=0
FRAMEBUFFER Blit l,n,120,96,120,96,24,24
Loop


Seems like a waste to use one whole frame buffer for the character, but I couldn't find a way of pasting him straight to the N buffer, everything else I tried, he would always leave a trail.
At 252MHz the update is about 130mS.
Regards Kevin.
Edited 2023-09-23 07:18 by Bleep
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1109
Posted: 12:09am 23 Sep 2023
Copy link to clipboard 
Print this post

Just a request for anyone posting demo code - could you add a comment at the start of the program identifying what hardware the demo is for.

VGA / LCD / etc.
And if it needs an SD card or not, or any other special hardware.

Thanks.
Visit Vegipete's *Mite Library for cool programs.
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1113
Posted: 09:42am 23 Sep 2023
Copy link to clipboard 
Print this post

  Bleep said  
Seems like a waste to use one whole frame buffer for the character, but I couldn't find a way of pasting him straight to the N buffer,
Regards Kevin.

Kevin,
yes, thats why i asked for buffering the background of the Sprite before painting it. Restore the Background before scrolling.
so you dont need a extra Framebuffer for it.
change the Part in your code:

...
'we are on Framebuffer "F"
Inc f':Pause 75
'Buffer the Background
Blit read 10,120,96,24,24
'draw the Player
Blit compressed sprite_index%(4+sn),120,96
'copy all to Display
FRAMEBUFFER Blit f,n,0,24,0,24,266,168
'restore the Background
Blit write 10,120,96
Inc sn:If sn=4 Then sn=0


AFAIK the Blit compressed has no tranparency, so the Sprite will have a Black Background. Maybe in the Future it will extend it to boolean algebra, that one can AND a Mask and then OR the Sprite (something forthe Wishlist)


Cheers
 Martin
Edited 2023-09-23 20:10 by Martin H.
'no comment
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1113
Posted: 03:42pm 23 Sep 2023
Copy link to clipboard 
Print this post

to whom it may concern
WIP
Imanaged to decode and display the PETSCII Tileset in MM Basic
Here is a comparison between the graphic tiles we use and the tiles, generated with the PETSCII (GFX Font).
(the 36 K Variables includes the Space for the LevelMap)



just for the case
Or transfere it later to other Mites
Edited 2023-09-24 01:47 by Martin H.
'no comment
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4042
Posted: 04:05pm 23 Sep 2023
Copy link to clipboard 
Print this post

It's looking really neat, if you can get this working on the PicoMite I think it will be the most impressive game since Mauro Xavier's work (on the much more powerful CMM2).

Tom
Edited 2023-09-24 02:05 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 04:15pm 23 Sep 2023
Copy link to clipboard 
Print this post

Hi Martin,
Yes sorry I didn't quite see what you meant, the code example explained it.
All working now with only one frame buffer.
'scroll left
f=4:y=0:sn=0
Do :Print Timer:Timer =0
Blit 8,0,0,0,312,240
If f=7 Then
  'draw next column
  For y=0 To 8
    vl=Asc(Mid$(lv$(y+oy),ox,1))
    Blit compressed tile_index%(vl),264,y*24
  Next
  y=0:Inc ox:If ox>116 Then ox=1
  f=4
EndIf
Inc f':Pause 75
Blit read 1,120,96,24,24
'Draw the player
Blit compressed sprite_index%(4+sn),120,96
'Copy to the display
FRAMEBUFFER Blit f,n,0,24,0,24,266,168
Blit write 1,120,96
Blit close 1
Inc sn:If sn=4 Then sn=0
Loop




Unfortunately it hasn't really made any difference to the screen update rate, I'm now getting 128 to 130mS per screen update at 252MHz.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6798
Posted: 04:19pm 23 Sep 2023
Copy link to clipboard 
Print this post

An SPI LCD will never really fly along, unfortunately. A parallel one would be much better.
Mick

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

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1113
Posted: 04:24pm 23 Sep 2023
Copy link to clipboard 
Print this post

  thwill said  It's looking really neat, if you can get this working on the PicoMite I think it will be the most impressive game since Mauro Xavier's work (on the much more powerful CMM2).

Tom

Thanks Tom, but if it gets finished it will be a joint "product" by the community.
I can do my part for the graphics, possibly the screen routines and next the translation of the sounds and music.
Experience has shown that I lack patience when it comes to implementing the game logic
'no comment
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1113
Posted: 04:51pm 23 Sep 2023
Copy link to clipboard 
Print this post

  Bleep said  
Unfortunately it hasn't really made any difference to the screen update rate, I'm now getting 128 to 130mS per screen update at 252MHz.

This was to be expected since we didn't change the output.
BUT: There were similar starting problems with the Apple 2 version. David reported that this was solved by only redrawing the parts of the screen where there were changes.
In my opinion, you shouldn't give up on this yet
'no comment
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1113
Posted: 09:00am 24 Sep 2023
Copy link to clipboard 
Print this post

Good Morning,
I converted / Repainted the next puzzle piece to Pico Colors for the Game

Intro screen:

I left the Space for Messages while Loading, Copyright etc.

End Screen:




Health phases (I already posted as CSUB)...


Have a nice Sunday
Mart!n
Edited 2023-09-24 19:10 by Martin H.
'no comment
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6798
Posted: 09:30am 24 Sep 2023
Copy link to clipboard 
Print this post

This is lovely artwork, Martin. :)
Mick

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

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1113
Posted: 10:42am 24 Sep 2023
Copy link to clipboard 
Print this post

  Mixtel90 said  This is lovely artwork, Martin. :)

thankyou
whats left to do are
the Sprites for the Items (Bomb, Magnet, Gun, Keycards)
the Animated Tiles
and the Font
then every graphic thing is ported to the Pico.

then I start listening to the Sounds, and Music used in the Game.

When I think about it, I immediately have the first question.
@Volhout? (or anyone who is familiar with PWM programming on the Picomite)

Is there a clever way to change thw Pulswith of a squarewave, while playing?
SO the carrier is the actual tone and the pulse width is the modulation.
Like they do on the Atari 7800 Soundtrak.
Edited 2023-09-24 20:45 by Martin H.
'no comment
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9122
Posted: 12:11pm 24 Sep 2023
Copy link to clipboard 
Print this post

I've been offline for a day or two so catching up on my reading some thoughts to attend or ignore as you will

1. I believe this program can only work successfully on the PicoMiteVGA. It has a memory mapped screen like the retro computers. All transfers to a TFT display, whether SPI, or parallel, are and always will be blocking so you will always lose a big chunk of processor time. Without a big enough memory for true TFT framebuffer (RGB565) it is not possible to do background transfers using DMA or similar

2. At the moment the VGA SPRITE functionality (store background, display sprite, restore the background if sprite is moved) works well but is inefficient as sprites are stored as RGB888 images. I could re-code this to use RGB121. It is a fair amount of work and would only consider it if there was a genuine use case.

3. It is possible to conceive a process whereby the library is loaded from a binary file. So, from the perspective of the game provider, they would create the library using multiple loads as now. They could then execute a command LIBRARY SAVE fname$ which would write the library to a file as a binary image. A second command LIBRARY LOAD could then be used to read in that file and completely overwrite any existing library. These would be command-line commands. I can't think of a better approach but am open to ideas.
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4243
Posted: 12:40pm 24 Sep 2023
Copy link to clipboard 
Print this post

@Peter,

Not sure how large the keyboard buffer is, we may ne able to send a file tp the buffer. A script file. Executing all separate commands in it. Only continur to the next command when the prompt is reveived from the parser.

Volhout
PicomiteVGA PETSCII ROBOTS
 
     Page 5 of 38    
Print this page
© JAQ Software 2024