CPCWiki forum

General Category => Programming => Topic started by: nrgroom on 20:33, 12 November 13

Title: BASIC windows and screen switching
Post by: nrgroom on 20:33, 12 November 13
Howdy folks.

After recently getting my Amstrad powered up again (thanks to the folks on the Hardware board), i've started delving into BASIC programming.

I'm working on a pretty basic game in mode 1, where the game takes up the entire screen. There are some interactions with characters on the screen, and I need to have a pop-up window to show some text, and ask questions, which i'm happy with, using the window command to have a smaller window appear with the required text in.

Once i've finished with the window however, is there any easy way to make it disappear, and replace the now blank area with the contents that were previously shown there (ie the screen as it was before the window popped up?

If there isn't an easy way, I could always do it in mode 1 with a blank section either at the side or bottom of the screen, but i'd prefer to use as much of the screen for the game as I can.

Any advice/guidance gratefully received.

Thanks

Title: Re: BASIC windows and screen switching
Post by: Bruce Abbott on 22:34, 12 November 13
Once you start using a window the previous contents will be lost, so if you want to 'restore' it you have two options:-

1. Redraw the part of the screen that was overwritten.

2. Save that part of the screen before using the window, then restore it afterwards.

The easiest way may be to simply redraw the whole screen again, but if for some reason you don't want to do that the second option may be preferable.

If you have a 6128 then you could run BANKMAN.BAS and use |SCREENCOPY to copy part of your screen to and from a backup screen in the extended memory.
   

Title: Re: BASIC windows and screen switching
Post by: nrgroom on 23:04, 12 November 13
Thanks Bruce.

My main problem is in the time it will take to scan what was there, then later re-draw, so I think i'm gonna have to go with a different mode.

I'll try a scan-and-redraw, to see if it works okay, though.

Title: Re: BASIC windows and screen switching
Post by: fano on 08:46, 13 November 13
I'd say the most adapted way would be to restore only the modified part.That depends about how much memory you still have but a little asm routine could do fastly and easily the job.You may take a look if this does already exist in type ins (is the correct word for listing?).If not , it is not a difficult work and someone here could write this for you  ;)
Title: Re: BASIC windows and screen switching
Post by: AMSDOS on 08:54, 13 November 13
It might be worth having a look at the Window Saver (http://www.cpcwiki.eu/index.php/Amstrad_Action_February_1987_Type-Ins) program from AA17. It sets up 2 RSXes "W.SAVE" & "W.LOAD", the first 4 parameters work in the same manner as the BASIC Window with a 5th parameter which is the address of the window. It recommends setting up the Windows between &4000 & &6000 and the size of the window you setup determines the amount of memory used, so if a whole screen is setup as a window it takes up the full &4000, so some caution when using this program, perhaps have a monitor to check how much memory you need for your windows you need and don't waste memory by making the whole screen a window.
Title: Re: BASIC windows and screen switching
Post by: redbox on 10:45, 13 November 13
Quote from: AMSDOS on 08:54, 13 November 13
It might be worth having a look at the Window Saver (http://www.cpcwiki.eu/index.php/Amstrad_Action_February_1987_Type-Ins) program from AA17. It sets up 2 RSXes "W.SAVE" & "W.LOAD", the first 4 parameters work in the same manner as the BASIC Window with a 5th parameter which is the address of the window.

Great recommendation.

Be careful to use the "WINSAVER.BAS" version (the original type-in) on the DSK file as this worked when I tried it where as the "WINDOW.BAS/BIN" files didn't.
Title: Re: BASIC windows and screen switching
Post by: SRS on 20:37, 21 November 13
Maybe you can use XBASIC -> [url=http://cpcrulez.fr/applications_list_coding-xbasic_AI.htm]CPCRULEZ &#9733 APPLICATION &#9733 LISTINGS PROGRAMMATION &#9733 PROGRAMMHIT DES (http://cpcrulez.fr/applications_list_coding-xbasic_AI.htm)[/url]
Powered by SMFPacks Menu Editor Mod