Author Topic: 64 byte TV Static/Noise.  (Read 2266 times)

0 Members and 1 Guest are viewing this topic.

Offline SuTeKH/Epyteor

  • 6128 Plus
  • ******
  • Posts: 1.385
  • Country: 00
  • Liked: 1296
  • Likes Given: 2032
64 byte TV Static/Noise.
« on: 19: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=56316
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!)

Code: [Select]
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...


Offline Bryce

  • The Hardware Guy.
  • Supporter
  • 6128 Plus
  • *
  • Posts: 12.069
  • Country: wf
  • It's not broken, it just hasn't been fixed yet.
    • index.php?action=treasury
  • Liked: 4419
  • Likes Given: 465
Re: 64 byte TV Static/Noise.
« Reply #1 on: 13:47, 24 June 12 »
I've a TV that does that and it doesn't use any bytes to get the effect :)

Bryce.

Offline MacDeath

  • Chaotic post writer and mock-up specialist
  • Supporter
  • 6128 Plus
  • *
  • Posts: 4.068
  • Country: fr
  • Liked: 1183
  • Likes Given: 667
Re: 64 byte TV Static/Noise.
« Reply #2 on: 20:32, 24 June 12 »
yeah, easy, connect the CPC to a TV... switch on every thing, then disconnect the CPC, tada.... et voilĂ  !

Online MaV

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.103
  • Country: at
  • Ius summum saepe summa est malitia.
  • Liked: 400
  • Likes Given: 828
Re: 64 byte TV Static/Noise.
« Reply #3 on: 21: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.)
Black Mesa Transit Announcement System:
"Work safe, work smart. Your future depends on it."

Offline Bryce

  • The Hardware Guy.
  • Supporter
  • 6128 Plus
  • *
  • Posts: 12.069
  • Country: wf
  • It's not broken, it just hasn't been fixed yet.
    • index.php?action=treasury
  • Liked: 4419
  • Likes Given: 465
Re: 64 byte TV Static/Noise.
« Reply #4 on: 11: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.

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.336
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2278
  • Likes Given: 3478
Re: 64 byte TV Static/Noise.
« Reply #5 on: 11:45, 26 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....
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline Gryzor

  • Administrator
  • 6128 Plus
  • *****
  • Posts: 16.405
  • Country: gr
  • CPC-Wiki maintainer
    • CPCWiki
  • Liked: 3714
  • Likes Given: 6643
Re: 64 byte TV Static/Noise.
« Reply #6 on: 13: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.

Online MaV

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.103
  • Country: at
  • Ius summum saepe summa est malitia.
  • Liked: 400
  • Likes Given: 828
Re: 64 byte TV Static/Noise.
« Reply #7 on: 19:49, 26 June 12 »
@Bryce: No worries, mate. It was not my intention to sound harsh. :)
Black Mesa Transit Announcement System:
"Work safe, work smart. Your future depends on it."

Offline SuTeKH/Epyteor

  • 6128 Plus
  • ******
  • Posts: 1.385
  • Country: 00
  • Liked: 1296
  • Likes Given: 2032
Re: 64 byte TV Static/Noise.
« Reply #8 on: 21:19, 26 June 12 »
In true ACU type-ins tradition here is the code in BASIC;

Code: [Select]
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