News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Neurox66

Save a portion of screen

Started by Neurox66, 16:09, 20 May 21

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Neurox66


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 ... and other Amstrad computers

eto

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"


Neurox66


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 ... and other Amstrad computers

eto

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.


Neurox66

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 ... and other Amstrad computers

andycadley

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.

SkulleateR

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

GUNHED

Quote from: Neurox66 on 16: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


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: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

roudoudou

Quote from: Neurox66 on 16: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
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)
My pronouns are RASM and ACE

GUNHED

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

Neurox66


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 ... and other Amstrad computers

GeoffB17

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

roudoudou

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 :)
My pronouns are RASM and ACE

GUNHED

Quote from: Neurox66 on 16:50, 21 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: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

Neurox66


Thanks to Roudoudou's hint I've found this interesting routine:




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 ... and other Amstrad computers

Powered by SMFPacks Menu Editor Mod