News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Joseman

CRTC scrolling tests

Started by Joseman, 09:38, 24 November 23

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Joseman

Hi!

I'm trying to do a good horizontal scroll

first try with CRTC, it looks great

but the screen is rolling up every time it scroll one line

it's there any solution to maintain the scroll on the same line?

I suspect that is some kind of adjustment on crtc registers, but i'm new on this, any help?

thanks!!

Video:


andycadley

No, that's just how it works. It doesn't normally matter as you keep drawing new content in the right hand column each time, making it look continuous.

abalore

As Andy said, when you scroll you are supposed to draw new content in the last column, so in that case the problem doesn't really exist.

If for some reason you want to scroll over the same graphics, after every step you can move the whole last column one character down (by actually copying the bytes), that should be a very quick routine because of the easy calculations involved.

trocoloco

Quote from: abalore on 11:59, 25 November 23As Andy said, when you scroll you are supposed to draw new content in the last column, so in that case the problem doesn't really exist.

If for some reason you want to scroll over the same graphics, after every step you can move the whole last column one character down (by actually copying the bytes), that should be a very quick routine because of the easy calculations involved.
so for example, if you move one character down, lets say C000 to C050, C800 to C850... then I guess that the last one should be moved to the first one. Is that correct?

abalore

#4
Quote from: trocoloco on 19:51, 25 November 23
Quote from: abalore on 11:59, 25 November 23As Andy said, when you scroll you are supposed to draw new content in the last column, so in that case the problem doesn't really exist.

If for some reason you want to scroll over the same graphics, after every step you can move the whole last column one character down (by actually copying the bytes), that should be a very quick routine because of the easy calculations involved.
so for example, if you move one character down, lets say C000 to C050, C800 to C850... then I guess that the last one should be moved to the first one. Is that correct?

when you move the whole column down, it should happen automatically, considering a 32x32 screen (the easiest case) and with the routine properly done to clamp the address to be always in the screen buffer (&C000-&FFFF range), like, for example, always forcing the highest two bits to '11'.

But you'll have to do a lot of experimentation as everyone did before you, that's the fun! :)

trocoloco

#5
Quote from: abalore on 11:22, 26 November 23when you move the whole column down, it should happen automatically, considering a 32x32 screen (the easiest case) and with the routine properly done to clamp the address to be always in the screen buffer (&C000-&FFFF range), like, for example, always forcing the highest two bits to '11'.

But you'll have to do a lot of experimentation as everyone did before you, that's the fun! :)
haha in fact I'm on it right now!

I am experimenting with a normal screen from C000 to FFFF. For now I got this! but I came across to realise that first i should copy the last one in a buffer in order to copy to the first afterwards?   ??? I'm going nuts but it is fun tho   :)

 
.copy_char
  ld a,(hl):ld (de),a:set 3,h:set 3,d
ld a,(hl):ld (de),a:set 4,h:set 4,d
ld a,(hl):ld (de),a:res 3,h:res 3,d
ld a,(hl):ld (de),a:set 5,h:set 5,d
ld a,(hl):ld (de),a:set 3,h:set 3,d
ld a,(hl):ld (de),a:res 4,h:res 4,d
ld a,(hl):ld (de),a:res 3,h:res 3,d
  ld (hl),a:ld (de),a
.next_char
res 5,d:ld hl,&50:add hl,de:ex hl,de ; siguiente caracter
        djnz copy_char

andycadley

There is (usually) more screen memory than is actually displayed, so you don't normally need to worry about overwriting data that you're going to need unless you've changed the screen width and height.

Joseman

#7
Hi!

I have been doing some research of vram memory after 33 CRTC steps

I had incongruences on Winape vram mapping, so i taked a look with the great Caprice Forever

apparently on the 33 step we are out of vram bank memory, and the last line is pointing to &8000 (vram &4000-&7FFF)

it can be see on the graphic explorer, but no in the main screen emulator...

what this means? where is the last line of the last tiles for the CRTC?

if Caprice Forever emulator is right (and i think is right), this mean that we are limited to 32 CRTC steps for scrolling before we reach the vram boundaries?
ACE33-SCROLL" border="0

ACE33-SCROLLVRAM" border="0

andycadley

Assuming you don't use the trick for overflowing the address to get a 32K screen (by setting bits 10 and 11 in R12/13 both to 1) then the lines start wrapping every 2048 bytes. Quite how many steps that is rather depends on screen size etc.

It can't spill over into another 16K bank (which is what I think you're suggesting) so any emulator that is doing that is wrong. I'd be very surprised if any emulator was getting this wrong though, as even LISTing a long BASIC program would start giving weird results.

megachur

Hello,
It's very simple to understand :

first line start #c000
next at #c800
etc...
8th lines is #c000 + SCREEN_WITH (=CRTC_SCREEN_WITH*2)

for standard screen

SCREEN_WITH = 80 = #50
#50*25 = #800
so screen at the 24 lines :  address of this line will be #c7b0
next line 25 will be > beyond the #c800 limit...so you see the begining of the screen again ;-) !

if you reduce the screen width, you can have more lines but the address 'limit' is the same...

I hope it will help you.

Jean-Marie


If you're using a resolution of 256*256 (R1=32, R6=32) starting at 4000h, the offset of each line will be :
Line 1=4000
Line 2=4800
Line 3=5000
Line 4=5800
Line 5=6000
Line 6=6800
Line 7=7000
Line 8=7800
Line 9=4040
Line 10=4840
Line 11=5040
Line 12=5840
Line 13=6040
Line 14=6840
Line 15=7040
Line 16=7840
Line 17=4080
Line 18=4880
Line 19=5080
Line 20=5880
Line 21=6080
Line 22=6880
Line 23=7080
Line 24=7880
Line 25=40C0
Line 26=48C0
Line 27=50C0
Line 28=58C0
Line 29=60C0
Line 30=68C0
Line 31=70C0
Line 32=78C0
Line 33=4100
Line 34=4900
Line 35=5100
Line 36=5900
Line 37=6100
Line 38=6900
Line 39=7100
Line 40=7900
Line 41=4140
Line 42=4940
Line 43=5140
Line 44=5940
Line 45=6140
Line 46=6940
Line 47=7140
Line 48=7940
Line 49=4180
Line 50=4980
Line 51=5180
Line 52=5980
Line 53=6180
Line 54=6980
Line 55=7180
Line 56=7980
Line 57=41C0
Line 58=49C0
Line 59=51C0
Line 60=59C0
Line 61=61C0
Line 62=69C0
Line 63=71C0
Line 64=79C0
Line 65=4200
Line 66=4A00
Line 67=5200
Line 68=5A00
Line 69=6200
Line 70=6A00
Line 71=7200
Line 72=7A00
Line 73=4240
Line 74=4A40
Line 75=5240
Line 76=5A40
Line 77=6240
Line 78=6A40
Line 79=7240
Line 80=7A40
Line 81=4280
Line 82=4A80
Line 83=5280
Line 84=5A80
Line 85=6280
Line 86=6A80
Line 87=7280
Line 88=7A80
Line 89=42C0
Line 90=4AC0
Line 91=52C0
Line 92=5AC0
Line 93=62C0
Line 94=6AC0
Line 95=72C0
Line 96=7AC0
Line 97=4300
Line 98=4B00
Line 99=5300
Line 100=5B00
Line 101=6300
Line 102=6B00
Line 103=7300
Line 104=7B00
Line 105=4340
Line 106=4B40
Line 107=5340
Line 108=5B40
Line 109=6340
Line 110=6B40
Line 111=7340
Line 112=7B40
Line 113=4380
Line 114=4B80
Line 115=5380
Line 116=5B80
Line 117=6380
Line 118=6B80
Line 119=7380
Line 120=7B80
Line 121=43C0
Line 122=4BC0
Line 123=53C0
Line 124=5BC0
Line 125=63C0
Line 126=6BC0
Line 127=73C0
Line 128=7BC0
Line 129=4400
Line 130=4C00
Line 131=5400
Line 132=5C00
Line 133=6400
Line 134=6C00
Line 135=7400
Line 136=7C00
Line 137=4440
Line 138=4C40
Line 139=5440
Line 140=5C40
Line 141=6440
Line 142=6C40
Line 143=7440
Line 144=7C40
Line 145=4480
Line 146=4C80
Line 147=5480
Line 148=5C80
Line 149=6480
Line 150=6C80
Line 151=7480
Line 152=7C80
Line 153=44C0
Line 154=4CC0
Line 155=54C0
Line 156=5CC0
Line 157=64C0
Line 158=6CC0
Line 159=74C0
Line 160=7CC0
Line 161=4500
Line 162=4D00
Line 163=5500
Line 164=5D00
Line 165=6500
Line 166=6D00
Line 167=7500
Line 168=7D00
Line 169=4540
Line 170=4D40
Line 171=5540
Line 172=5D40
Line 173=6540
Line 174=6D40
Line 175=7540
Line 176=7D40
Line 177=4580
Line 178=4D80
Line 179=5580
Line 180=5D80
Line 181=6580
Line 182=6D80
Line 183=7580
Line 184=7D80
Line 185=45C0
Line 186=4DC0
Line 187=55C0
Line 188=5DC0
Line 189=65C0
Line 190=6DC0
Line 191=75C0
Line 192=7DC0
Line 193=4600
Line 194=4E00
Line 195=5600
Line 196=5E00
Line 197=6600
Line 198=6E00
Line 199=7600
Line 200=7E00
Line 201=4640
Line 202=4E40
Line 203=5640
Line 204=5E40
Line 205=6640
Line 206=6E40
Line 207=7640
Line 208=7E40
Line 209=4680
Line 210=4E80
Line 211=5680
Line 212=5E80
Line 213=6680
Line 214=6E80
Line 215=7680
Line 216=7E80
Line 217=46C0
Line 218=4EC0
Line 219=56C0
Line 220=5EC0
Line 221=66C0
Line 222=6EC0
Line 223=76C0
Line 224=7EC0
Line 225=4700
Line 226=4F00
Line 227=5700
Line 228=5F00
Line 229=6700
Line 230=6F00
Line 231=7700
Line 232=7F00
Line 233=4740
Line 234=4F40
Line 235=5740
Line 236=5F40
Line 237=6740
Line 238=6F40
Line 239=7740
Line 240=7F40
Line 241=4780
Line 242=4F80
Line 243=5780
Line 244=5F80
Line 245=6780
Line 246=6F80
Line 247=7780
Line 248=7F80
Line 249=47C0
Line 250=4FC0
Line 251=57C0
Line 252=5FC0
Line 253=67C0
Line 254=6FC0
Line 255=77C0
Line 256=7FC0
Hence, the last line will be @7FC0h.

Joseman

Many many thanks for the help!!

@Jean-Marie yes, the calculations i made was only for the first line, hence the overflow withou seeing it!. Thankyou for the calculations!

@megachur thankyou for the formulas!, I have to use more this type of coding! I usually in my tests do fixed values and is not good.

@andycadley I was reading the edge grinder code and yes, using overscan, but i dont have this level of coding! (at the moment)

So i limited the scroll to 32 char scroll, i corrected the code with your help. And it works!

Here is the video!! thankyou again!






Joseman

Left scroll coded!!

here is the video scrolling left-right :)




andycadley

Looks great, can't wait to see what you use it for.

Joseman

The most sincere reply to this is nothing :)

But, the next i want to do is scrolling up & down

and reduce the screen to the real screen on GB 160x144

I don't know if 32 char scroll is enough to cover the GB maps on some games, but i doubt it.

zhulien

I haven't coded a hardware scroll before... in software you are doing an actual memory copy - I am guessing the CRTC is just rendering from an offset, so no memory is copied... does that mean when doing a hardware scroll (unlike a software scroll where you do a memory copy, then always write the same memory locations to fill in e.g. the right hand side) do you need to update a different column of screen memory in sync with the scroll each frame?

andycadley

Yes with a hardware scroll you have to write to different addresses each time as well as dealing with the wrap around in screen memory.

Powered by SMFPacks Menu Editor Mod