alekmaul Posted September 13, 2015 Share Posted September 13, 2015 Hi alls, I have a question regarding swap_screen and screen function. I want to use them but don't know how to configure which name table is used to put character to vram. To explain more, I begin my screen initialisation with screen(0x1800,0x1c00); then I put name table values with put_vram(0x1800... At least, for each frame, in nmi routine, I use swap_screen. My question is : does I need to manage which screen to refresh (0x1800 or 0x1c00) with the put_vram function or is it automatically done with the swap screen function and I just have to use put_vram(0x1800 ... always ? Quote Link to comment Share on other sites More sharing options...
Kiwi Posted September 13, 2015 Share Posted September 13, 2015 The syntax exactly is:screen(name_table1,name_table2);to show screen 1, 0x1800 and edit screen 2 at 0x1c00 by using only the Getput1 library. screen(name_table2,name_table1);will show screen 2,0x1c00 and now screen 1 at 0x1800 is now editable by using the Getput1 library.for example,screen(name_table1,name_table2);put_frame(LargeObject,8,6,12,7);//will draw on name_table2delay(1); screen(name_table2,name_table1);//show screen 2 put_char(6,3,21);//will draw on name_table1 delay(1); There's a sample that came with the newcoleco homebrew kit in the test folder that have the screen function I can post the source code of that now, #include <coleco.h> #include <getput1.h> void nmi(void) {} void main(void) { screen_mode_2_text(); screen_on(); fill_vram0(0x2000,0x1800,0xf0); upload_default_ascii(BOLD_ITALIC); duplicate_pattern(); cls(); print_at(1,0,"SCREEN #1"); screen(name_table1,name_table2); cls(); print_at(1,0,"SCREEN #2"); loop: screen(name_table2,name_table1); print_at(rnd_byte(1,30),rnd_byte(1,22),"1"); delay(5); screen(name_table1,name_table2); print_at(rnd_byte(1,30),rnd_byte(1,22),"2"); delay(5); goto loop; } Quote Link to comment Share on other sites More sharing options...
alekmaul Posted September 13, 2015 Author Share Posted September 13, 2015 (edited) ok, thanks for reply, but if screen does all the job, what is the purpose of swap_screen ? Edited September 13, 2015 by alekmaul Quote Link to comment Share on other sites More sharing options...
Kiwi Posted September 13, 2015 Share Posted September 13, 2015 (edited) ok, thanks for reply, but if screen does all the job, what is the purpose of swap_screen ? I just tried it by replacing screen with screen_swap() in that sample loop: // screen(name_table2,name_table1); swap_screen(); print_at(rnd_byte(1,30),rnd_byte(1,22),"1"); delay(5); // screen(name_table1,name_table2); swap_screen(); print_at(rnd_byte(1,30),rnd_byte(1,22),"2"); delay(5); goto loop; swap_screen(); inverts the screen() function everytime it is called. I think i would have got more space back in Flappybird if I used that function. Edited September 13, 2015 by Kiwi Quote Link to comment Share on other sites More sharing options...
+nanochess Posted September 13, 2015 Share Posted September 13, 2015 ok, thanks for reply, but if screen does all the job, what is the purpose of swap_screen ? I'm not using SDCC, but I suppose 'screen' setups the pointers, and swap_screen does the real swapping. Probably writing directly the VDP register for the screen base. In fact in Princess Quest (pure assembler) I use this register to manage the scrolling in 2 frames, half-top and then half-bottom, and then update the VDP register to the newly created screen. This allows for 30 frame per second scrolling. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.