Author Topic: Save a portion of screen  (Read 622 times)

0 Members and 1 Guest are viewing this topic.

Offline Neurox66

  • CPC464
  • **
  • Posts: 12
  • Country: it
    • My WebSite
  • Liked: 4
  • Likes Given: 12
Save a portion of screen
« on: 18:09, 20 May 21 »

Hi,
Newbie question :-O
Is it possible in basic to save a portion (or all) of the screen and recall it later?
Obviously in memory and not on disk.


Thanks,
Paolo
CPC 464+ with C4CPC and Gotek HxC USB Drive - 
CPC 6128+ with Nova, FlashGordon,AmsDap, SymbiFace III -
CPC 6128 with M4

Offline eto

  • Supporter
  • 464 Plus
  • *
  • Posts: 371
  • Country: de
  • Liked: 226
  • Likes Given: 220
Re: Save a portion of screen
« Reply #1 on: 19:07, 20 May 21 »
In BASIC there is no built-in support for this.

However there are extensions that will support this. For the 6128 there is e.g. BANKMAN on one of the system discs which leverages the second 64KB for this. It is described in the manual, chapter 1, part 11: "Introducing the Bank Manager"


Offline Neurox66

  • CPC464
  • **
  • Posts: 12
  • Country: it
    • My WebSite
  • Liked: 4
  • Likes Given: 12
Re: Save a portion of screen
« Reply #2 on: 19:36, 20 May 21 »

Thanks Eto for the reply but I probably misunderstood.
Is it possible in Locomotive Basic to write a subroutine similar to
the Savescreen function of the Clipper for save a screen region?


Paolo

CPC 464+ with C4CPC and Gotek HxC USB Drive - 
CPC 6128+ with Nova, FlashGordon,AmsDap, SymbiFace III -
CPC 6128 with M4

Offline eto

  • Supporter
  • 464 Plus
  • *
  • Posts: 371
  • Country: de
  • Liked: 226
  • Likes Given: 220
Re: Save a portion of screen
« Reply #3 on: 19:41, 20 May 21 »
As I said, no. Nothing that would be built-in. The BANKMAN program is the closest to what you want that I know. There might be other extensions that support this, but I don't know any. It's probably also not very hard to do that in machine code... but it's not possible in pure BASIC.


Well, you could simulate something like this with PEEK and POKE but it would be awfully slow.


Offline Neurox66

  • CPC464
  • **
  • Posts: 12
  • Country: it
    • My WebSite
  • Liked: 4
  • Likes Given: 12
Re: Save a portion of screen
« Reply #4 on: 19:48, 20 May 21 »
Ah ok.

I was hoping that it could be done like in Beta Basic for the ZX Spectrum with the Memory$() function
LET a$=MEMORY$()(16400 TO 18804)
CPC 464+ with C4CPC and Gotek HxC USB Drive - 
CPC 6128+ with Nova, FlashGordon,AmsDap, SymbiFace III -
CPC 6128 with M4

Offline andycadley

  • Supporter
  • 6128 Plus
  • *
  • Posts: 979
  • Liked: 479
  • Likes Given: 80
Re: Save a portion of screen
« Reply #5 on: 21:32, 20 May 21 »
You could do it in BASIC, but it would be really slow. RSX's are likely to be your best bet. Back in the day I think I used Sprites Alive! To do this, before moving on to just writing Z80 myself.

Offline SkulleateR

  • 464 Plus
  • *****
  • Posts: 391
  • Country: de
  • Liked: 206
  • Likes Given: 112
Re: Save a portion of screen
« Reply #6 on: 00:13, 21 May 21 »
You can remap the screen mem to an other location in ram and then use the second screen to print something on it and then switch back to the old one ... I'm pretty sure some people here know the correct calls in basic :D

Offline GUNHED

  • 6128 Plus
  • ******
  • Posts: 2.693
  • Country: de
  • Reincarnation of TFM
    • FutureOS - The quickest OS for the CPC and Plus
  • Liked: 1266
  • Likes Given: 2961
Re: Save a portion of screen
« Reply #7 on: 02:53, 21 May 21 »
Hi,
Newbie question :-O
Is it possible in basic to save a portion (or all) of the screen and recall it later?
Obviously in memory and not on disk.


Thanks,
Paolo


On 6128... see manual and bank manager RSX. IIRC they (at least) copy complete screens.


For parts use  PEEK and POKE.

http://futureos.de --> Get the revolutionary FutureOS (Update: 2021.01.24)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.07.15)

Offline roudoudou

  • 6128 Plus
  • ******
  • Posts: 1.104
  • Country: fr
    • urban exploration
  • Liked: 1526
  • Likes Given: 880
Re: Save a portion of screen
« Reply #8 on: 08:48, 21 May 21 »
Hi,
Newbie question :-O
Is it possible in basic to save a portion (or all) of the screen and recall it later?
Obviously in memory and not on disk.
Thanks,
Paolo
on what purpose? moving portions of screen in Basic will be slow because video memory is huge and interlaced (so it need some computations to select an area PLUS additionnal computations if pixel coordinates are odd)
the best way (i mean, usable) is to do some assembly routines and call them from basic (CALL or RSX)
use RASM, the best assembler ever made :p

I will survive

Offline GUNHED

  • 6128 Plus
  • ******
  • Posts: 2.693
  • Country: de
  • Reincarnation of TFM
    • FutureOS - The quickest OS for the CPC and Plus
  • Liked: 1266
  • Likes Given: 2961
Re: Save a portion of screen
« Reply #9 on: 16:47, 21 May 21 »
Try this...
http://futureos.de --> Get the revolutionary FutureOS (Update: 2021.01.24)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.07.15)

Offline Neurox66

  • CPC464
  • **
  • Posts: 12
  • Country: it
    • My WebSite
  • Liked: 4
  • Likes Given: 12
Re: Save a portion of screen
« Reply #10 on: 18:50, 21 May 21 »

Thank you all for the suggestions.
I am actually writing in Locomotive Basic many of the procedures and functions of the Clipper language. @Prompt, Menu To, @Say,@Get and Read are working.
The most complex ones are SAVESCREEN() and RESTSCREEN() for this reason I asked for advice to the forum.


@Gunhed
Very nice animation. At the next edition of Brusaretro I'll show it on my CPC.


Paolo
CPC 464+ with C4CPC and Gotek HxC USB Drive - 
CPC 6128+ with Nova, FlashGordon,AmsDap, SymbiFace III -
CPC 6128 with M4

Offline GeoffB17

  • 6128 Plus
  • ******
  • Posts: 797
  • Country: gb
  • PCW since '85, more CP/M than Loco
  • Liked: 169
  • Likes Given: 9
Re: Save a portion of screen
« Reply #11 on: 19:25, 21 May 21 »
Just for information, note that the Write Hand Man pop-up system for the PCW does a part screen save, and restore on exit.   It does this with a menu area in the top left of the screen.   There are two versions of the WHM program, both do the CLEAR, but only the slightly larger one does the screen restore as well, so the restore is optional depending on your RAM needs.   The extra RAM used will be for both the code, and a memory buffer to store the screen data.

Also, some time back, there was some discussion here regarding two MALLARD BASIC extensions that did graphics things with the screen,   WALBASIC and I think EBASIC (or was it XBASIC ?).   I know the code for WALBASIC did not include specific SAVE/RESTORE, but aspects of the code for drawing lines etc might be relevant.   I can't remember the details regarding the other system now.

As mentioned, the problem with the PCW is that the screen memory is in fact arranged around 'tiles'.   If the screen area you want to mess with fits with the tiles, then it's not so bad, but if it does not it will get messy.

Ah, Clipper - used it for business things for a lot of years.   Still use it for quick file fix things.  Of course the PC screen system is much easier to work with.

Geoff

Offline roudoudou

  • 6128 Plus
  • ******
  • Posts: 1.104
  • Country: fr
    • urban exploration
  • Liked: 1526
  • Likes Given: 880
Re: Save a portion of screen
« Reply #12 on: 19:30, 21 May 21 »
back in time the french magazine A100% published some assembly routines in order to be used in Basic programm and do some graphic adventure engine
there was many productions :)
use RASM, the best assembler ever made :p

I will survive

Offline GUNHED

  • 6128 Plus
  • ******
  • Posts: 2.693
  • Country: de
  • Reincarnation of TFM
    • FutureOS - The quickest OS for the CPC and Plus
  • Liked: 1266
  • Likes Given: 2961
Re: Save a portion of screen
« Reply #13 on: 20:39, 24 May 21 »
@Gunhed
Very nice animation. At the next edition of Brusaretro I'll show it on my CPC.
Paolo
Thanks, it's from Devilmarkus, he did a couple of them. But you won't be able to contact him here any longer. See JavaCPC homepage.  :)
http://futureos.de --> Get the revolutionary FutureOS (Update: 2021.01.24)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.07.15)

Offline Neurox66

  • CPC464
  • **
  • Posts: 12
  • Country: it
    • My WebSite
  • Liked: 4
  • Likes Given: 12
Re: Save a portion of screen
« Reply #14 on: 19:17, 25 May 21 »

Thanks to Roudoudou's hint I've found this interesting routine:
Code: [Select]



10 '-------------------------------------------
20 'ROUTINE DE FENETRES ET TRANSFERTS MULTIPLES
30 '       (C) Fr{d{ric BELLEC Juin 1989
40 '-------------------------------------------
50 DATA FE,05,C0,2E,AA,DD,66,08,22,FE,FF,DD,56,07,DD,5E,06,DD,66,05
60 DATA 7C,FE,C0,D8,DD,6E,04,DD,46,00,E5,DD,4E,02,3A,FF,FF,FE,00,28
70 DATA 11,3D,28,13,3D,28,14,3D,28,15,3D,28,16,3D,28,1D,E1,C9,7E,2F     
80 DATA 77,18,19,7E,12,18,15,1A,77,18,11,36,00,18,0D,7E,E5,21,FE,FF
90 DATA B6,E1,77,18,03,1A,B6,77,23,13,0D,20,C5,E1,CD,26,BC,7C,FE,C0   
100 DATA D8,3A,FE,FF,2F,32,FE,FF,10,B0,C9
110 ad=40960:FOR n=ad TO ad+110:READ a$:a=VAL("&"+a$):POKE n,a:s=s+a:NEXT:IF s<>12255 THEN PRINT"Erreur dans les DATA...":END
120 MODE 2:INK 0,2:BORDER 2:INK 1,26:PRINT"ROUTINES DE FENETRES ET TRANSFERTS MULTIPLES V2.0"
130 PRINT"Entierement relogeable - 111 octets"
140 PRINT"Principalement utilisable en MODE 2"
150 PRINT"Utile pour les menus deroulants
160 PRINT:PRINT"CALL routine,Type,Ad Buffer,Ad Ecran,Largeur,Hauteur"
170 PRINT:PRINT"Type : 0 Inversion video d'une zone ecran"
180 PRINT"       1 Sauvegarde d'une portion d'ecran"
190 PRINT"       2 Rappel d'une portion d'ecran"
200 PRINT"       3 Effacement d'une zone"
210 PRINT"       4 Tramage du fond"
220 PRINT"       5 Rappel avec surimpression"
230 PRINT:PRINT"Ad Buffer : partie de la memoire destinee a recevoir la portion d'ecran sauvee.             La valeur n'a de l'importance que pour les types 1 et 2"
240 PRINT:PRINT"Ad Ecran  = &C000+80*(Y-1)+X-1 (X & Y idem que pour un LOCATE)"
250 PRINT:PRINT"Largeur   : en octets  80 maximum"
260 PRINT"Hauteur   : en octets 200 maximum"



It works great but after hours of testing with my data entry I've encountered memory problems.
Now I'm using Bankman.


Paolo
CPC 464+ with C4CPC and Gotek HxC USB Drive - 
CPC 6128+ with Nova, FlashGordon,AmsDap, SymbiFace III -
CPC 6128 with M4