CPCWiki forum

General Category => Programming => Topic started by: martin464 on 03:01, 05 November 22

Title: Split raster handling
Post by: martin464 on 03:01, 05 November 22
like everyone does, just messing around with split rasters

is there any way to get it to change the colour more often?
this a full screen width with no delays using OUTI and INC B but each bar is quite a few characters wide

the funny thing is the wiki said this technique is used for scrolling messages to build up characters, with the results i'm getting one letter would take up the whole screen!

(about:invalid)

Title: Re: Split raster handling
Post by: martin464 on 03:04, 05 November 22
(https://i.postimg.cc/Z5T5Kdr4/raster.png)
Title: Re: Split raster handling
Post by: Axelay on 03:36, 05 November 22
I don't know if it's the fastest/best way, but in the past I've used a string of instructions like this:

out (c),c
out (c),c
out (c),a
out (c),c
out (c),a


with c & a preloaded with the colours before each line.  That gives a colour change 4 characters apart.  To scroll, you change the start point of the split raster, which shifts by 1 character the position.  Then every 4 frames you reset the start point and use self modifying code to change the instructions, so the above might become

out (c),c
out (c),a
out (c),c
out (c),a
out (c),a


so the colour changes have moved along by 4 characters.
Title: Re: Split raster handling
Post by: martin464 on 04:36, 05 November 22
ah that's a good trick i like that, :thumbs up:
Title: Re: Split raster handling
Post by: Longshot on 12:26, 05 November 22
You can also use out(#ff),a to have a size of 3 characters (3x2 bytes)
https://shaker.logonsystem.fr/tests?cpc=1&crtc=0&test=A9

Depending on the value of A (between #40 and #7F), this can however send I/O to other circuits, which must be done knowingly. ;D
Title: Re: Split raster handling
Post by: martin464 on 14:09, 05 November 22
Yes I found that out trying OTIR, B went on a dive through the ports but this could replicate the Spectrum colour clash quite nicely (!)
Title: Re: Split raster handling
Post by: Longshot on 16:06, 07 November 22
OTIR and OTDR are not really usable on Cpc since B decrements to 0 and this value serves as the i/o port.
However, you can see an example of OTIR use in Shaker
https://shaker.logonsystem.fr/tests?cpc=1&amspirit=1&crtc=0&test=BR see SubTest F

The method used for this test is to run this instruction and abort it with an interrupt before B reaches a critical value.
Also, this instruction takes 6 µseconds between each color update.
Title: Re: Split raster handling
Post by: Prodatron on 19:06, 07 November 22
You can use repeating

INC B:OUTI
INC B:OUTI
...

instead of OTIR on the CPC, which will have the same speed (I think so?), but takes some code memory.
Btw, yes, you have to INC B first, as OUTI is first decreasing it before outing (hl) to the port at BC.
With INI you have to INC B in the second step (I wonder what they did so that the Z80 behaves in this different way).
Title: Re: Split raster handling
Post by: Mage on 20:41, 07 November 22
Quote from: Longshot on 12:26, 05 November 22You can also use out(#ff),a to have a size of 3 characters (3x2 bytes)
https://shaker.logonsystem.fr/tests?cpc=1&crtc=0&test=A9

Depending on the value of A (between #40 and #7F), this can however send I/O to other circuits, which must be done knowingly. ;D

Do you know is there any "out(number),a" equivalent to enable/disable split-border within 3 characters ?
Title: Re: Split raster handling
Post by: Longshot on 22:22, 07 November 22
QuoteDo you know is there any "out(number),a" equivalent to enable/disable split-border within 3 characters ?
On CRTC 0, a splitborder uses R8 (#3x/#0x)
On CRTC 1, a splitborder uses R6 (#00/<>C4) (on lines where C4<>0)

The OUT(#ff),A instruction can write to the selected CRTC register with
A=1,5,9,13,17,21,25,29,33,37,41,45,49,53,57,61 (and same values +128)

On CRTC 0, values <49 disable border and >49 enable border
(but however, the interlace is activated (bit 0=1), and you need to disable it before the end of the line (e.g. R8=0))

On CRTC 1, the border can only be cancelled (border to non border) with this instruction.
Title: Re: Split raster handling
Post by: martin464 on 23:01, 07 November 22
that otir technique.. that's another level.... amazing someone pulled it off! wow
not sure if it's actually usable for real...
with out (b), r - it's good enough i found it the same as INC/OUTI same size split. 

i did have a weird problem of the first split not being visible. ok, just put some more nop's in and couldn't find the magic number to make it start where it should. 

the example said
;; delay so that the first colour change is invisible (it occurs
;; during the horizontal flyback)
defs 28


wonder why first colour change needs to be invisible, i really want it to start on the first one
i tried adding more than 28 going 1 at a time, expecting it to work eventually.... 

y'know, this crtc/gate array stuff is beginning to sink in. it looks worse than it is. i think i might be close to getting it, not guru level just "enough to scrape by" level that will do me!
Title: Re: Split raster handling
Post by: Mage on 19:22, 08 November 22
Thank you very much @Longshot 
Title: Re: Split raster handling
Post by: Longshot on 19:53, 08 November 22
Quote from: martin464i did have a weird problem of the first split not being visible. ok, just put some more nop's in and couldn't find the magic number to make it start where it should.
For your subject, I advise you to look at the diagrams on page 47.

This should bring you some answers. ;)

http://logonsystem.fr/down/ACCC1.3-EN.pdf
Powered by SMFPacks Menu Editor Mod