News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_SkulleateR

Screen copying/switching once again (BASIC)

Started by SkulleateR, 08:54, 22 June 20

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

SkulleateR

Hi folks,


I know there are many topics about this and yes, I've read all of them and still I quite don't get it ....


Ok, so I know you can change screen address from &C000 to &4000 to switch screen mem, so far so good.


What I want to do :


- Load my program
- draw a map on screen (&C000)
- copy it to &4000 so I don't have to draw it again
- when an event is happening in the game : clear screen, put information there (print/draw/plot/whatever)
- after the event, copy the map back from &4000 to &C000


The point is to let the visible screen always be the one I write to ....


something like this :



10 DRAW map
20 main loop
30 event : copy screen to &4000
40 print information on visible screen
50 copy screen back from &4000 to &C000



Well you get the idea I hope  :P



Guess I use OUT &BC00 and &BD00 for this but everything I tried did not work at all :(  HELP :picard:

AMSDOS

You could simply draw the map screen to &4000 and leave it there couldn't you?


The advantage of having it at &4000 being able to store in the upper 64k with a OUT &7F00,&C4 -> &C7 for example and with a SCR SET BASE set to &4000 and the appropriate Bank Area set to where the Map is, it wouldn't need to be moved anywhere (which is slow), or am I missing the point?
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

SkulleateR

Can't do it that way, the map is used and altered in some minor ways, so I need to capture the state at that particular moment.


Speed isn't an issue here ....

Sykobee (Briggsy)

You can render the map changes to &4000 bank, or are you using firmware/library that assumes the screen is at &c000 so updates have to be done to that memory area?


SkulleateR

As stated in the title, I'm using plain Loco Basic, I'm not into ASM ...




Sykobee (Briggsy)

#5
I suspect you should not worry about the &4000 screen in that case and redraw it. If you can assume 128KB machine then you could store it in one of those banks and copy it in.


Why can't you use a &4000 screen with BASIC? Because BASIC thinks that memory is its memory pool.

> Basic starts at &170 and grows up to HIMEM. HIMEM is set around &b0ff for 464
https://www.cpcwiki.eu/forum/amstrad-cpc-hardware/memory-map/msg100865/#msg100865


I guess you could use MEMORY &3FFF to change HIMEM underneath.

AMSDOS

It's certainally possible to fool BASIC into thinking it's displaying something to a visible screen, @HAL 6128 posted a Bouncing Ball in BASIC, though it involves POKEing different addresses depending on which machine is used. I think peek(6) is good enough for that, which returns 128 for a 464, so the value becomes &B1CB and everything else has it set at &B7C6.



100 MODE 0
110 DEFINT a-z
120 IF PEEK(6)=128 THEN m=&B1CB ELSE m=&B7C6
130 c=0:b=&40:x=100
140 WHILE c<>10
150   b=&100-b:POKE m,b:CLS
160   y=100:GOSUB 200
170   x=x+4:c=c+1
180   OUT &BCFF,12:OUT &BDFF,b\4
190 WEND:PEN 1:MODE 2:END
200 MOVE x,y:DRAW x+100,y,1:DRAW x+100,y+100:DRAW x,y+100:DRAW x,y:RETURN



This is just a little Animated Square sequence which alternates between &4000 and &C000 screens, the POKE in line 150 is used to switch between screens without letting BASIC know about it and line 160 DRAWs the lines on the other screen. Line 180 is used to switch Screens and make the other screen visible. If that's of any help.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Powered by SMFPacks Menu Editor Mod