Page 1 of 3

Bad Apple UDG

Posted: Sun Mar 18, 2018 9:41 am
by nollkolltroll
Bad Apple ZX81 v1.1

Intro
The famous Bad Apple video is played full screen at 15, 25 or 30fps.

Requirements
This player requires a ZX81 with UDG4ZXpand and a ZXpand+ or ZXpand.

Usage real HW
For the classic ZXpand: use zxp25.p to play the video in 50Hz PAL mode, giving 25fps. TV standard jumper is ignored.
For the classic ZXpand: use zxp15.p to play the video in 60Hz NTSC mode, giving 15fps. TV standard jumper is ignored.
For the ZXpand+: use zxpp2530 to play the video, which auto-adjusts to the ZX81 tv-standard, giving either 25fps or 30fps.

Usage EightyOne emulator v1.8 or later
Use zxpp2530.p to play the video. Both zxp15.p and zxp25.p plays too slow.
Use correct settings:
- RAM pack = 32k
- chr$ generator = CHR$16
- high resolution = none
- ZXpand = yes

Background
It all started when I got the UDG-board and began wondering how I could use it to play video. I thought it would be a quick and simple hack to create an encoder, but I soon realized that I actually had to learn some new tricks and spend quite some time. Not really cozy-coding, but very rewarding :)

Technical
The encoder takes a 256x192 video and groups every 4 frames. Each group is analyzed to get all 8x8 patterns used, and reduce that to a maximum of 128 UDG characters.
The video stream has 768 bytes of frame data and 256 bytes of character set data per frame, so 4 frames gives a new UDG character set.
1kB data per frame is only 1/6th of the original video bandwidth, (just) possible to stream from the ZXpand.

The player for ZXpand+ looks at the PAL/NTSC jumper setting at startup and changes some values regarding the picture generation, and chooses one of the two video files to play. PAL playback at 25fps and NTSC playback at 30fps, just the way we like it.

The players for the classic ZXpand ignores the PAL/NTSC jumper setting and just plays at the programmed framerate. NTSC had to be lowered to 15fps because the overhead of reading from the classic ZXpand is so much greater than on the ZXpand+.

It would be possible to add audio, but this was an exercise in video encoding for me. I've already done a different video/audio version of Bad Apple for the ZX81.

Video
For those wanting to see the show without getting out real hardware, you can watch on YouTube at: https://youtu.be/iMzVWNWk4E0

Demo appreciation
There is an entry for this on Pouet, a site devoted to demos: http://www.pouet.net/prod.php?which=75655
EDIT:
- updated to reflect v1.1 of this player
- added link to YouTube
- added link to pouet

Re: Bad Apple UDG

Posted: Sun Mar 18, 2018 10:06 am
by zx81jens
Wow, this is great stuff!!!!!!!!!!!!!

Re: Bad Apple UDG

Posted: Sun Mar 18, 2018 10:37 am
by Andy Rea
wow.... just freaking wow.... its not often in the world of ZX81 that i'm totally taken aback by what can be achieved.

Give your self a huge pat on the back, have a beer or 2 and play that trumpet loudly so that everyone know what a wizard you are.

fabulous work indeed... now i have to ask.... have you tried it with other video streams ?

regards Andy

Re: Bad Apple UDG

Posted: Sun Mar 18, 2018 11:29 am
by nollkolltroll
Yes, Big Buck Bunny is coming up. Error diffusion video does not look good, bayer dither looks very good.

Feels nice to surprise you Andy :)

Re: Bad Apple UDG

Posted: Sun Mar 18, 2018 12:11 pm
by nollkolltroll
And for those without the proper HW, it is possible to run this in EightyOne v1.8 or later with the appropriate settings.

Re: Bad Apple UDG

Posted: Sun Mar 18, 2018 12:43 pm
by McKlaud
:shock: :shock: :shock:

My jaws dropped to the floor and can't lift them up.

Re: Bad Apple UDG

Posted: Sun Mar 18, 2018 9:06 pm
by Andy Rea
Blimey looks even better on real hardware and a good old CRT screen complete with Persistence of vision motion blur :D

and a heads up for anyone trying to get it to run on real harware,

original zxpand firmware 2.62 "troll" ROM 6.6, no dice, crashes after filling screen with "udg player"

zxpand+ firmware 1.08, ROM 7.0 , no dice also crashed...

ZXpand+ firmware 1.12 ( latest as far as i can tell ) ROM 7.0 Yes we have some action....

HTH anybody else trying to get it to work.

@sirmorris / nollkolltroll any idea why it doesn't work ( for me anyway ) on an original Zxpand

Regards andy

Re: Bad Apple UDG

Posted: Sun Mar 18, 2018 9:30 pm
by nollkolltroll
The original zxpand does not support 512-byte requests/transfers, only 256-byte is ok. The new mode has less overhead, which is why I started coding for the zxpand+.
I made a quick test this afternoon, and managed to get a version working on the original zxpand. So far only tested in 25fps mode. Will get back to you on this subject.
The documentation claims requirements to be zxpand+, but I forgot to mention a later version fw, sorry. Been inside the code and working environment too long...

Re: Bad Apple UDG

Posted: Sun Mar 18, 2018 9:36 pm
by Andy Rea
nollkolltroll wrote: Sun Mar 18, 2018 9:30 pm
The documentation claims requirements to be zxpand+
Documentation ??? is that like a manual... pffpfff fpff nobody reads those :lol: :lol: :lol:

Re: Bad Apple UDG

Posted: Sun Mar 18, 2018 9:43 pm
by nollkolltroll
Well, the top post has the same text as the docs...
No worries, I think it IS interesting to know the differences between zxpand and zxpand+ regardless.
Hope to have some time to test 30fps mode on the zxpand tomorrow.