CPCWiki forum

General Category => Programming => Topic started by: tastefulmrship on 17:54, 23 June 12

Title: 64 byte TV Static/Noise.
Post by: tastefulmrship on 17:54, 23 June 12
Now, I realise there are several TV static programs already released;
http://www.pouet.net/prod.php?which=58606 (http://www.pouet.net/prod.php?which=58606)
http://www.pouet.net/prod.php?which=56316 (http://www.pouet.net/prod.php?which=56316)
http://www.pouet.net/prod.php?which=56255 (http://www.pouet.net/prod.php?which=56255)

But they all use BASIC in some way or another. I wanted to see one that was 100% assembler, so I ripped a lot of code from the above releases and came up with this; a 64 byte TV Static/Noise program in Z80. (MaV helped me to remove a lot of bytes to get it this small!)


ORG &8000

LD A,1
CALL &BC0E

LD B,A
LD C,B
CALL &BC38

LD HL,Palette
LD A,&04
.INK_Loop
DEC A
PUSH AF
PUSH HL
LD B,(HL)
LD C,B
CALL &BC32
POP HL
INC HL
POP AF
JR NZ,INK_Loop

LD HL,&C000
.Random_8_Bit
LD A,R
OR A
ADD L
OR A
LD (HL),A
INC HL
LD A,H
OR L
JR NZ,Random_8_Bit

LD A,49
LD C,&06
.CRTC_Loop
LD B,&BC
OUT (C),C
INC B
OUT (C),A
DEC C
LD B,C
DJNZ,CRTC_Loop
.Infinite_Loop
JR Infinite_Loop

.Palette
DEFB 01,26,13,00


Obviously, being me, this was done in WinAPE 2A18. The code fills the screen with random bytes and sends the CRTC scatty, giving the illusion of a television on the blink! According to my real-hardware sources (MaV), this is pretty much what it does on real-hardware; other than the fact that the whole overscan screen is filled on real-hardware, where-as in WinAPE it doesn't fill up the borders.

I then ran the code in a number of other emulators (including CPCe, JavaCPC and Caprice32) all of which returned a static image after filling the screen with random bytes.

This means, and for once I can quieten the hoard of WinAPE haters, WinAPE has a "more accurate" emulation of the CRTC going scatty!

I thank you!
- JTMS...

Title: Re: 64 byte TV Static/Noise.
Post by: Bryce on 11:47, 24 June 12
I've a TV that does that and it doesn't use any bytes to get the effect :)

Bryce.
Title: Re: 64 byte TV Static/Noise.
Post by: MacDeath on 18:32, 24 June 12
yeah, easy, connect the CPC to a TV... switch on every thing, then disconnect the CPC, tada.... et voilĂ  !
Title: Re: 64 byte TV Static/Noise.
Post by: MaV on 19:31, 25 June 12
Nonsense! A lot of brains and hours goes into 3D graphics and trying to make the effects as realistic as possible. And I would not say: Just open the door and walk the streets if you want nearly unlimited polygon counts and colours.

If a little effect like that can achieve a real world effect then kudos to the guy! (Although it's been done a bit too often.)
Title: Re: 64 byte TV Static/Noise.
Post by: Bryce on 09:02, 26 June 12
It was meant as humour, hence the Laugh icon at the end. Although I do like your idea for a perfect 3D scenery by walking out the door. It looks fantastic, the shadows and weather are very convincing too, just the enemies AI needs to be worked on :(

Bryce.
Title: Re: 64 byte TV Static/Noise.
Post by: arnoldemu on 09:45, 26 June 12
Quote from: Bryce on 11:47, 24 June 12
I've a TV that does that and it doesn't use any bytes to get the effect :)

Bryce.
ours does that when we switch it to analogue.
Digital though, gives a nice steady picture....
Title: Re: 64 byte TV Static/Noise.
Post by: Gryzor on 11:27, 26 June 12
Ooh, this is a really nice effect if I may say so! Picture rolling is especially realistic.


Before anyone asks how to run it:


Open WinAPE, press F3 (Show Assembler). File->new, paste in the code from the OP and press F9 (Run). Go back to the emulator and type "call &8000". Enjoy the end of the analogue era.
Title: Re: 64 byte TV Static/Noise.
Post by: MaV on 17:49, 26 June 12
@Bryce: No worries, mate. It was not my intention to sound harsh. :)
Title: Re: 64 byte TV Static/Noise.
Post by: tastefulmrship on 19:19, 26 June 12
In true ACU type-ins tradition here is the code in BASIC;


1 ' TV Noise in 64 Bytes for CPCWiki.
2 '
10 FOR Addr=&8000 to &803E
20 READ Byte$
30 POKE Addr,VAL("&"+Byte$)
40 NEXT Addr
50 CALL &8000
60 '
110 DATA 3E,01,CD,0E,BC,47,48,CD
120 DATA 38,BC,21,3B,80,3E,04,3D
130 DATA F5,E5,46,48,CD,32,BC,E1
140 DATA 23,F1,20,F3,21,00,C0,ED
150 DATA 5F,B7,85,B7,77,23,7C,B5
160 DATA 20,F5,3E,31,0E,06,06,BC
170 DATA ED,49,04,ED,79,0D,41,10
180 DATA F5,18,FE,01,1A,0D,00
Powered by SMFPacks Menu Editor Mod