News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_ervin

shrinking screen - effects on memory

Started by ervin, 07:17, 19 October 17

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ervin

Hi folks.

With the recent talk about shrinking the screen in BASIC etc, I thought that I should consider a spectrum-sized screen for my next project, just to try and lighten the load on the CPU when redrawing the screen.

I believe it would take the screen down to 64 bytes by 192 lines (please correct me if I'm wrong).
Anyway, that reduces the video ram by over 20%... is that "recovered" RAM available?
Is it contiguous RAM that I can use as a nice big neat (almost 4KB) block?

roudoudou

#1
With a 64 byte width screen of 192 lines (12288 bytes) the structure remains interlaced with blocks of 1536 bytes so the free memory is also fragmented


line 0 : bloc 0 : offset 0 : physical adresse #C000
line 1 : bloc 1 : offset 0: physical adresse #C800
line 2 : bloc 1 : offset 0: physical adresse #D000

...
line 8 : bloc 0 : offset 0 : physical adresse #C000+64
line 9 : bloc 1 : offset 0 : physical adresse #C800+64

...

You will have 8 free memory blocks in the same video page located at


#C000+24*64
#C800+24*64

#D000+24*64
#D800+24*64
#E000+24*64
#E800+24*64

#F000+24*64
#F800+24*64

There is still a better option if you like headache

Changing the number of line per block to 6 instead of 8

Free memory will be linear starting at #F000

All the 6 first blocks (#C000 to #E800) will be full


My pronouns are RASM and ACE

ervin

Hmmm... very interesting.
Thanks so much for all that info.

Just wondering, can the number of lines per block be changed to anything?
I'm interested in changing it to 4.

arnoldemu

Quote from: ervin on 07:31, 19 October 17
Hmmm... very interesting.
Thanks so much for all that info.

Just wondering, can the number of lines per block be changed to anything?
I'm interested in changing it to 4.
yes, set R9=3 and then double R7 and double R4.

You may need to play with R7 to get it centred exactly.

My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

ervin

#4
Quote from: arnoldemu on 09:36, 19 October 17
yes, set R9=3 and then double R7 and double R4.

You may need to play with R7 to get it centred exactly.

Thanks for that.  :)

I don't know how to do it but it will be interesting trying to find out.

AMSDOS

I know of a program from the AA51 Insider Dealing article that alters the screen to a Spectrum size screen.


OUT &BC00,1:OUT &BD00,32:OUT &BC00,2:OUT &BD00,43:OUT &BC00,6:OUT &BD00,24:OUT &BC00,7:OUT &BD00,30


It reverts back to the Amstrad screen with something like this:


OUT &BC00,1:OUT &BD00,40:OUT &BC00,2:OUT &BD00,46:OUT &BC00,6:OUT &BD00,25:OUT &BC00,7:OUT &BD00,32


however I think from memory it didn't quite restore that back to standard CPC screen size.
* 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

ervin

Quote from: arnoldemu on 09:36, 19 October 17
yes, set R9=3 and then double R7 and double R4.

You may need to play with R7 to get it centred exactly.

Cool, I figured it out.
:)

For anyone interested, here it is.

org &4000

; set R9 to 3 (default is 7)

ld bc,&bc09
out (c),c
ld bc,&bd00+3
out (c),c

; set R7 to 60 (default is 30)

ld bc,&bc07
out (c),c
ld bc,&bd00+60
out (c),c

; set R4 to 76 (default is 38)

ld bc,&bc04
out (c),c
ld bc,&bd00+76
out (c),c

ret

Axelay


A small point to note.  R4 is the vertical total less 1.  So while it's set to 38, it represents 39 character lines. (in much the same way that R9 is the lines per character less 1)  With 39 character lines at 8 lines high each, that gives you 312 lines total for a screen, which would typically be your goal when manipulating the CRTC for best compatibility.


So to maintain that 312 line total, strictly speaking you need to set R4 to 77 while R9 is set to 3, though I'm sure in most circumstances you'd find the 76 will work fine.


Damn, I was just going to link to Grimware's site for some extra detail, but it seems to be gone!

roudoudou

Quote from: Axelay on 14:59, 19 October 17
Damn, I was just going to link to Grimware's site for some extra detail, but it seems to be gone!


looking for this?  :D
[size=78%][/size]
My pronouns are RASM and ACE

ervin

Quote from: Axelay on 14:59, 19 October 17
A small point to note.  R4 is the vertical total less 1.  So while it's set to 38, it represents 39 character lines. (in much the same way that R9 is the lines per character less 1)  With 39 character lines at 8 lines high each, that gives you 312 lines total for a screen, which would typically be your goal when manipulating the CRTC for best compatibility.

So to maintain that 312 line total, strictly speaking you need to set R4 to 77 while R9 is set to 3, though I'm sure in most circumstances you'd find the 76 will work fine.

Damn, I was just going to link to Grimware's site for some extra detail, but it seems to be gone!

Tremendous, thanks for that info.

I had also tried looking on grimware's site, and found that it was gone!
I really hope it comes back, as it is an *amazing* resource.

Morri

Quote from: ervin on 22:51, 19 October 17
I had also tried looking on grimware's site, and found that it was gone!
I really hope it comes back, as it is an *amazing* resource.


You can still access grimware via wayback machine until it (hopefully) comes back online.
Keeping it Kiwi since 1977

ervin

Quote from: Morri on 00:25, 20 October 17
You can still access grimware via wayback machine until it (hopefully) comes back online.

Nice find, thanks.
(I still can't believe that such an exhaustive resource was put together by one person!)

AMSDOS

Quote from: ervin on 13:38, 19 October 17
Cool, I figured it out.
:)

For anyone interested, here it is.

org &4000

; set R9 to 3 (default is 7)

ld bc,&bc09
out (c),c
ld bc,&bd00+3
out (c),c

; set R7 to 60 (default is 30)

ld bc,&bc07
out (c),c
ld bc,&bd00+60
out (c),c

; set R4 to 76 (default is 38)

ld bc,&bc04
out (c),c
ld bc,&bd00+76
out (c),c

ret



So in BASIC it's:



OUT &BC00,9 : OUT &BD00,3 : OUT &BC00,7 : OUT &BD00,60 : OUT &BC00,4 : OUT &BD00,76



I'm a little bit confused with what I posted earlier and what this does (sorry I haven't been able to test).
* 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

ervin

Each character line becomes only 4 pixels tall.
The side effects of this are that only the top half of typed words are visible, and that the screen is only half the height of what it was before.
I initially thought I'd have a use for this, but I may have been mistaken.  :doh:

arnoldemu

Quote from: ervin on 12:04, 22 October 17
Each character line becomes only 4 pixels tall.
The side effects of this are that only the top half of typed words are visible, and that the screen is only half the height of what it was before.
I initially thought I'd have a use for this, but I may have been mistaken.  :doh:
You can make it the same height as before if you use the '32kb' overscan method, but screen addresses may become a bit more awkward to calculate.

What did you want to do? There may be other ways to achieve the same result.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

ervin

Quote from: arnoldemu on 13:54, 22 October 17
You can make it the same height as before if you use the '32kb' overscan method, but screen addresses may become a bit more awkward to calculate.

What did you want to do? There may be other ways to achieve the same result.


I'm revisiting my chunky pixel idea from a few years ago, and have been trying to think of ways to make the screen display faster.

Axelay


Quote from: roudoudou on 18:12, 19 October 17


looking for this?


Ha! Yes.  :)


Quote from: ervin on 12:04, 22 October 17
Each character line becomes only 4 pixels tall.
The side effects of this are that only the top half of typed words are visible, and that the screen is only half the height of what it was before.
I initially thought I'd have a use for this, but I may have been mistaken. 


If you manipulate the screen like that, you wont be able to use firmware routines to display text, it doesnt know about the new screen dimensions.  You'd either need to patch the firmware or write your own text routines.  As arnoldemu says, you can use the overscan method to get more lines without the screen repeating if you want a spectrum sized display with 4 line characters.  I've added some more register settings to your sample to show this.


org &4000


; set the border black to see the effect


ld bc,0 ; black
call &bc38 ; set border


; set R9 to 3 (default is 7)


ld bc,&bc09
out (c),c
ld bc,&bd00+3
out (c),c


; set R7 to 60 (default is 30)


ld bc,&bc07
out (c),c
ld bc,&bd00+60
out (c),c


; set R4 to 76 (default is 38)


ld bc,&bc04
out (c),c
ld bc,&bd00+77
out (c),c


; set R6 to 48 (default is 25) lines to display, 48 equivalent to 24 normal character lines


ld bc,&bc06
out (c),c
ld bc,&bd00+48
out (c),c


; set R12 to &3c (default is &30) cause overflow on base screen address from &30 to &00


ld bc,&bc0c
out (c),c
ld bc,&bd00+&2c
out (c),c


; set R1 to 32 (default is 40) character width of display


ld bc,&bc01
out (c),c
ld bc,&bd00+32
out (c),c


; set R2 to 42 (default is 46) move horrizontal sync position to centre narrowed screen


ld bc,&bc02
out (c),c
ld bc,&bd00+42
out (c),c


ret



That gives you a 12k screen with characters 4 lines high for your chunky pixels, but the screen has an address 'jump' two thirds of the way day the screen, where it jumps from bank 2 to bank 3 of main ram.  The memory layout is:


&0000-&7fff 32k free (or &0040 up if using interupts)
&8000-&9fff 8k top two thirds of the screen
&a000-&bfff 8k free
&c000-&c3ff 1k bottom third of screen, char line 1
&c400-&c7ff 1k free
&c800-&cbff 1k bottom third of screen, char line 2
&cc00-&cfff 1k free
&d000-&d3ff 1k bottom third of screen, char line 3
&d400-&d7ff 1k free
&d800-&dbff 1k bottom third of screen, char line 4
&dc00-&ffff 9k free


Which will take some juggling to use to the full, perhaps. The 6 line character option roudoudou mentioned will give you the much simpler layout as he described of a single 12k block for the screen and a free 4k block, but could be extra work if you are using 4 pixel high chunky pixels. Perhaps a question of pick your headache?  ;)

ervin

Hmmm... very interesting.
Thanks for that info.


I'll study it carefully and see if I can apply it to my situation.

Powered by SMFPacks Menu Editor Mod