Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 08:55 26 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 : PicoMiteVGA Alien Syndrome

     Page 3 of 3    
Author Message
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4233
Posted: 09:23am 25 Feb 2024
Copy link to clipboard 
Print this post

Pc numeric keyboard has a cluster that can give you the 8 directions. I will take a look tonight.

Volhout
PicomiteVGA PETSCII ROBOTS
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1113
Posted: 12:03pm 25 Feb 2024
Copy link to clipboard 
Print this post

  Volhout said  Pc numeric keyboard has a cluster that can give you the 8 directions. I will take a look tonight.

Volhout

since I work exclusively on my laptop and the connected PS2 keyboard is also narrow, the numeric keypad is not an option for me  
Edited 2024-02-25 22:04 by Martin H.
'no comment
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4233
Posted: 04:46pm 25 Feb 2024
Copy link to clipboard 
Print this post

Martin,

I think we need to put the sprites into flash before we go any further.
I was trying to add the key input routine from PETSCII since that cleans INKEY$ buffers (in running your code, that seemed to be the issue), and got memory problems.

RUN
Program:
 26K (25%) Program (650 lines)
  7K ( 5%) 1 Embedded C Routine
 67K (70%) Free

Saved Variables:
 16K (100%) Free

RAM:
 25K (19%) 32 Variables
 75K (58%) General
 28K (23%) Free

[57] Function conv$(a$)
Error : Not enough memory


The conv$(a$) is the function I added. It should replace your function read_inkey$()

There was a similar issue in PETSCII, and that is why I did not use the Framebuffer F. Only L and N. But you seem to use it. 2x38k (L+F) = 76k are gone.
You have 25k in variables, and also need minimum extra 9k for binary data (the CSUB in binary). By transferring the CSUB to library/flash you save these 9k.
But even then, there is not a lot to play with. Especially if you take into account that the MOD player needs 24k RAM (Peter says).

Architecture needs to change a bit I guess.... Can you manage without framebuffer F ?
Your maps are 128x128 = 16k in size. You have arrays tls() and tileattr() that consume 128x3 + 128 = 512 integers = 4kbyte. That is 20k of the 25k. The rest are individual variables and strings (255 bytes long, even if you use only 1 character).

Volhout
Edited 2024-02-26 03:00 by Volhout
PicomiteVGA PETSCII ROBOTS
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1113
Posted: 06:51pm 25 Feb 2024
Copy link to clipboard 
Print this post

Hello Volhout,
yes I've planned to save the sprites, the tiles and the Map in a library. One lib per level, which will then be reloaded in the game. The map would then be peeeked directly from the flash, so that the array is also omitted.
The frame buffer f is only a temporary solution and is required to temporarily store the tiles.
As long as there can/will still be changes in Tiles and/or Maps, it is easier than carrying out the conversion process every time. I also have to add the sprites of the enemies, the shots and the hostages.
So there will be enough Memory for the Modplayer.
I'll have another look at your instructions for creating the libs tomorrow and see if I can manage it
Cheers
Martin
'no comment
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4233
Posted: 08:20pm 25 Feb 2024
Copy link to clipboard 
Print this post

If you have a set that you are confident of, I can  help you in creating the flash binary and index file.
You can also phase it. Start with the tiles, freeing framebuffer F

Volhout
Edited 2024-02-26 06:21 by Volhout
PicomiteVGA PETSCII ROBOTS
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1113
Posted: 03:18pm 01 Mar 2024
Copy link to clipboard 
Print this post

Volhout
After several failed attempts, I have now managed to transfer the tiles to BIN files and display them in the programme.
The framebuffer (F) is no longer in use.

AS02.5.zip

Level 4 is in progress:




Cheers
Martin
Edited 2024-03-02 01:20 by Martin H.
'no comment
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4233
Posted: 06:51pm 01 Mar 2024
Copy link to clipboard 
Print this post

Hi Martin,

It was silent for several days, I feared you had gotten I’ll. Good that you managed to create the bin file.
First time I tried, it also took few tries before I understood how to do it.

Dit you see a penalty on speed (flash versus RAM.

Volhout
PicomiteVGA PETSCII ROBOTS
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4233
Posted: 06:51pm 01 Mar 2024
Copy link to clipboard 
Print this post

Hi Martin,

It was silent for several days, I feared you had gotten I’ll. Good that you managed to create the bin file.
First time I tried, it also took few tries before I understood how to do it.

Dit you see a penalty on speed (flash versus RAM.

Volhout
PicomiteVGA PETSCII ROBOTS
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1113
Posted: 08:00pm 01 Mar 2024
Copy link to clipboard 
Print this post

Assembling the sprites to Csub and saving them in the flash slot was not the problem.
The tricky thing was to find the beginning of the Csub data within the bin file.
To do this, I had to add an offset to the flash address.

  Volhout said  
Dit you see a penalty on speed (flash versus RAM.

at 25 fps we have 40ms per frame, scrolling takes 2ms and border drawing takes another 1 to 2ms, it may be that flashmemory is slower than RAM but the command needs less parameters to be processed, so it seems to balance out or even be a little faster. You can see this in the console/terminal, where I constantly print the time for the pause until the next frame (36-38ms)
Edited 2024-03-02 06:07 by Martin H.
'no comment
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4233
Posted: 12:12am 02 Mar 2024
Copy link to clipboard 
Print this post

While the bin is syill in the libtaty, get csub address (peek....). Get start of flash slot 3 (mm.info....). This is also begin of library.

Difference=offset.

Volhout
PicomiteVGA PETSCII ROBOTS
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1113
Posted: 07:15am 02 Mar 2024
Copy link to clipboard 
Print this post

  Volhout said  While the bin is syill in the libtaty, get csub address (peek....). Get start of flash slot 3 (mm.info....). This is also begin of library.

Difference=offset.

Volhout

At the address of flash slot 3 it starts with the name of the Library .. the payload start at some Bytes later (the offset).
As the Program is now, this would be a prototype for topview scrolling games and can be used in a variety of ways.
'---------------------------------
At the same time, I am also trying to save/replay the background music in an MOD file.


Edited 2024-03-02 18:21 by Martin H.
'no comment
 
Martin H.

Guru

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

  Volhout said  Hi Martin,
I have been thinking about that also. I see 2 solutions:

1/ in stead of a generic routine that adds the new tiles, write something specific for each of the 8 directions. That could even be fastest. You could even "hard code" each individual blit. Maybe a list of 20 blits is faster that a loop of 20. But the code would be larger (not an issue I guess seeing the complexity of this game).
Volhout

I have now tested one part by replacing the loop within the subs with a stack of commands

so
Sub Paint_Row nr%
 Local integer sx=Offset_X,sy=Offset_y+nr,ty=nr%<<4,tx=0
 'Get address of Map Position
 mp=Peek(varaddr map$(sy))
 For x=sx To sx+19
    tn=Peek(BYTE mp+x+1)
    Sprite memory tile_index(tn),tx,ty
    Inc tx,16
 Next
End Sub


becomes
Sub Paint_Rowx nr%
 Local mp,tx,sx=Offset_X,sy=Offset_y+nr,ty=nr%<<4
 'Get address of Map Position
 mp=Peek(varaddr map$(sy)):Inc mp,(sx+1)
 Sprite memory tile_index(Peek(BYTE mp)),tx,ty:Inc tx,16:Inc mp
 Sprite memory tile_index(Peek(BYTE mp)),tx,ty:Inc tx,16:Inc mp
 Sprite memory tile_index(Peek(BYTE mp)),tx,ty:Inc tx,16:Inc mp
 Sprite memory tile_index(Peek(BYTE mp)),tx,ty:Inc tx,16:Inc mp
 Sprite memory tile_index(Peek(BYTE mp)),tx,ty:Inc tx,16:Inc mp
 Sprite memory tile_index(Peek(BYTE mp)),tx,ty:Inc tx,16:Inc mp
 Sprite memory tile_index(Peek(BYTE mp)),tx,ty:Inc tx,16:Inc mp
 Sprite memory tile_index(Peek(BYTE mp)),tx,ty:Inc tx,16:Inc mp
 Sprite memory tile_index(Peek(BYTE mp)),tx,ty:Inc tx,16:Inc mp
 Sprite memory tile_index(Peek(BYTE mp)),tx,ty:Inc tx,16:Inc mp
 Sprite memory tile_index(Peek(BYTE mp)),tx,ty:Inc tx,16:Inc mp
 Sprite memory tile_index(Peek(BYTE mp)),tx,ty:Inc tx,16:Inc mp
 Sprite memory tile_index(Peek(BYTE mp)),tx,ty:Inc tx,16:Inc mp
 Sprite memory tile_index(Peek(BYTE mp)),tx,ty:Inc tx,16:Inc mp
 Sprite memory tile_index(Peek(BYTE mp)),tx,ty:Inc tx,16:Inc mp
 Sprite memory tile_index(Peek(BYTE mp)),tx,ty:Inc tx,16:Inc mp
 Sprite memory tile_index(Peek(BYTE mp)),tx,ty:Inc tx,16:Inc mp
 Sprite memory tile_index(Peek(BYTE mp)),tx,ty:Inc tx,16:Inc mp
 Sprite memory tile_index(Peek(BYTE mp)),tx,ty:Inc tx,16:Inc mp
 Sprite memory tile_index(Peek(BYTE mp)),tx,ty
End Sub

and same for Columns drawing

I have had the screen drawn 100 times
Here the Results of a speedtest:

Drawing 2000 Columns:
With loop in sub 4583.007 ms

Without loop in sub 3914.418 ms

Drawing 1500  rows:
With loop  in sub 4019.503 ms

Without loop in sub 3572.736 ms

not outstandingly faster (2.38 ms for a Row vs 2.68 ms) but still a difference
Edited 2024-03-04 02:23 by Martin H.
'no comment
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4233
Posted: 09:16pm 03 Mar 2024
Copy link to clipboard 
Print this post

Hi Martin,

Now you can move in steps (not tiles) and still the viewwindow get's updated correctly. Also keyboard buffer is flushed.

See if this suits you, or revert as you please....


AS02.5_h.zip

EDIT: there is a flaw. The variables nx and ny must be part of X andY for this to work correct.

Regards,

Volhout
Edited 2024-03-04 16:17 by Volhout
PicomiteVGA PETSCII ROBOTS
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4233
Posted: 07:37am 04 Mar 2024
Copy link to clipboard 
Print this post

Hi Martin,

This should theoretically do it correct.
Running out of time, there is a 4 pix pasting error, and it is slow.
Just wanted to show a solution that could work when bugs are out. Am at work now, so time is limitted.

AS02.5_h2.zip

Volhout
PicomiteVGA PETSCII ROBOTS
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1113
Posted: 08:00am 04 Mar 2024
Copy link to clipboard 
Print this post

  Volhout said  Hi Martin,

This should theoretically do it correct.
Running out of time, there is a 4 pix pasting error, and it is slow.
Just wanted to show a solution that could work when bugs are out. Am at work now, so time is limitted.

AS02.5_h2.zip

Volhout


Good morning Volhout,
yes, I'll take a look at it, the movement in 4 pixel steps requires some more adjustments in the program, although in my opinion stopping at 16 pixels is not disturbing either.
I'm currently testing where I can save a few more milliseconds in the image painting.
From 3827ms for 100 Screems to 3649 using the Paint_Row sub.
Lets see how this behaves with Paint_col

Have a good start into the week

Cheers
Martin
'no comment
 
     Page 3 of 3    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024