User avatar
Gavinmc42
Posts: 3148
Joined: Wed Aug 28, 2013 3:31 am

Demoscene

Wed Nov 21, 2018 11:43 am

DavidS dragged up the 4K demoscene in a recent post.
viewtopic.php?f=62&t=227343
That triggered a brain dump from me.

A search found out this goes back to 2015.
viewtopic.php?p=881908

Well, can a kernel.img that does graphics be made small enough?
Thanks to LdB showing the way, yes it can.
https://github.com/LdB-ECM/Raspberry-Pi

I used USB boot to load the files via USB onto a Zero.
https://github.com/raspberrypi/usbboot
OpenGLES triangle :D in 27KB

Could it be done in 4KB? Probably going to need assembler.
https://www.theverge.com/2012/5/14/3014 ... e-fractals

64KB for beginners like me?
Different classes 64, 32, 16, 8, 4KB. wow add 2KB and1KB to that list.
LdB does his compiling in Windows in C but there are other ways.
https://github.com/bztsrc/raspi3-tutorial

I know my default Ultibo Free Pascal baremetal won't go smaller than about 264KB and blows up to 1.3MB when the VC4 unit is added.
Which makes me wonder what Ultibo is doing and can it be trimmed more?

Anyway some serious code foo is happening in demoscene.
What can be done with Pi Zero'?
What happens when you use the 4 x 64bit cores and neon of a 3B+ or 3A+?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

DirkS
Posts: 9839
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Demoscene

Wed Nov 21, 2018 12:35 pm

Gavinmc42 wrote:
Wed Nov 21, 2018 11:43 am
That triggered a brain dump from me.
Is that worse than a brain fart? :?

Sorry, couldn't help myself... ;)
I will see myself out.

hippy
Posts: 5344
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Demoscene

Wed Nov 21, 2018 12:52 pm

Gavinmc42 wrote:
Wed Nov 21, 2018 11:43 am
Well, can a kernel.img that does graphics be made small enough?
Thanks to LdB showing the way, yes it can.
https://github.com/LdB-ECM/Raspberry-Pi
'Real programmers' wouldn't create a kernel.img; they would create bootcode.bin :P

User avatar
DavidS
Posts: 4198
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Demoscene

Wed Nov 21, 2018 5:49 pm

Gavinmc42 wrote:
Wed Nov 21, 2018 11:43 am
DavidS dragged up the 4K demoscene in a recent post.
viewtopic.php?f=62&t=227343
That triggered a brain dump from me.

A search found out this goes back to 2015.
viewtopic.php?p=881908

Well, can a kernel.img that does graphics be made small enough?
Thanks to LdB showing the way, yes it can.
https://github.com/LdB-ECM/Raspberry-Pi

I used USB boot to load the files via USB onto a Zero.
https://github.com/raspberrypi/usbboot
OpenGLES triangle :D in 27KB

Could it be done in 4KB? Probably going to need assembler.
https://www.theverge.com/2012/5/14/3014 ... e-fractals

64KB for beginners like me?
Different classes 64, 32, 16, 8, 4KB. wow add 2KB and1KB to that list.
LdB does his compiling in Windows in C but there are other ways.
https://github.com/bztsrc/raspi3-tutorial

I know my default Ultibo Free Pascal baremetal won't go smaller than about 264KB and blows up to 1.3MB when the VC4 unit is added.
Which makes me wonder what Ultibo is doing and can it be trimmed more?

Anyway some serious code foo is happening in demoscene.
What can be done with Pi Zero'?
What happens when you use the 4 x 64bit cores and neon of a 3B+ or 3A+?
Sounds like an interesting set of chalenges. Currently my YANGTOS kernel is 2.4KB and my ConOut module is 822 bytes, though that is an operating system with memory protection, SMP support, thread scheduling, memory allocation management, synchronization, and message passing, not a demo.

I think we could do a lot in 4KB on the Raspberry Pi, if we do not care about having USB. I think that 16KB would be a more reasonable target as that would at least give us enough space for a crude USB stack and HID class driver (perhaps use an existing USB stack and not count that against the demo size?). Though I wold say it is worth the attempt. Time to side project for a few days.
hippy wrote:
Wed Nov 21, 2018 12:52 pm
Gavinmc42 wrote:
Wed Nov 21, 2018 11:43 am
Well, can a kernel.img that does graphics be made small enough?
Thanks to LdB showing the way, yes it can.
https://github.com/LdB-ECM/Raspberry-Pi
'Real programmers' wouldn't create a kernel.img; they would create bootcode.bin :P
LOL, even the demo coders on Amiga, Atari ST/TT/Falcon, Macintosh, all relied on some ROM code to get things started up before loading there code.

Even the C64, Vic20, Atari 800, and other 8-bit scene demos relied on the the ROM to get them into RAM and start them on the CPU.

So I would say that sticking with ARM is valid.

Is that anything like the old saying "Real Programmers Write Machine Code directly; Real Coders would not be caught dead using an assembler" :) ?
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

User avatar
Gavinmc42
Posts: 3148
Joined: Wed Aug 28, 2013 3:31 am

Re: Demoscene

Thu Nov 22, 2018 2:51 am

Is that worse than a brain fart? :?
Nope it much worse, farts are out and normally don't linger much :lol:
My brain dumps are concepts for ideas that usually requires serous brain stretching and the pain of learning.
Sometime I feel like cursing Eben for unleashing the Pi on the World, other times I am in awe of his little brain dump ;)
Very mixed feelings, usually based on how the head feels after serious brain strain.
I swear, I can feel new neural connections growing nearly as fast as the old ones die off.
'Real programmers' wouldn't create a kernel.img; they would create bootcode.bin :P
Thanks hippy, had not gone that far, but that's obvious now that you have pointed it out ;)
Start here? https://github.com/christinaa/rpi-open-firmware

Lots of code buried in the various start.elf versions, making use of that requires some reverse engineering.
So bootcode.bin, start.elf, kernel.img, three classes of Pi Demoscene.
Another division for VC4 versions and ARM versions?
Is that anything like the old saying "Real Programmers Write Machine Code directly; Real Coders would not be caught dead using an assembler" :) ?
David we are going to have to handicap you, you only get 1/4 the memory because you have the advantage.
Perhaps you can be the Judge after you win the first 10 contests?

I noticed when using the USB boot option the Pi stays in OTG mode.
So stuff is going on that might be exploitable as David pointed out.
I have found when I do jobs that need to be done on Pi's I learn more than just messing about.
Having a goal is better than just waffling around and I waffle a lot :oops:

Demoscene is graphics and music, I don't see a need for any SD or USB stacks.
No Man's Sky has rekindled my interest in procedural coding.
Perhaps 2D and 3D versions.

So Arm only and 64KB, 16KB and 4KB kernel.img?
Can music be done on the HDMI on a Zero?
Zero and Pi3, Lightweight, Heavyweight Divisions?

Being an Ozzie we would call these Idiot, Average and Showoff class levels ;)
But perhaps a more kid friendly terminology?
Noob, Warrior, Master?
We could even make badges, like in Boy Scouts.
Open source rule too, so we can learn, improve or just drool?

I found some Demoscene stuff on PC, Amiga, VC20, C64, ZX.
No Pi Demoscene yet?

YANGTOS in 2.4KB :o
DavidS goes in as favorite with odds of 5 to 4 to win?

The thing with Demoscene is it is pure coding, no extra hardware required.
And more important is it teaches compact coding, not code bloat.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
Gavinmc42
Posts: 3148
Joined: Wed Aug 28, 2013 3:31 am

Re: Demoscene

Thu Nov 22, 2018 3:14 am

I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
Gavinmc42
Posts: 3148
Joined: Wed Aug 28, 2013 3:31 am

Re: Demoscene

Thu Nov 22, 2018 3:17 am

I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
DavidS
Posts: 4198
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Demoscene

Thu Nov 22, 2018 5:24 pm

Gavinmc42 wrote:
Thu Nov 22, 2018 3:17 am
For inspiration?
https://www.geeks3d.com/20180402/demosc ... sion-2018/
Nice inspiration. And following with the Demoscene on other platforms, may I suggest that in the categories you already suggested you split each between baremetal, Linux hosted (no extra libs), and RISC OS hosted? That would put it well in line with the other platforms demoscenes. Also may be worth a difference between BCM2835 and BCM2837 (kind of like the difference between an Atari STE demo and an Atari Falcon demo).

Now off to get a few things working, and then finally start a little work towards a simple RPi B+ baremetal Demo. I need the play time, after a few issues with other projects.

Besides raytracing is fun ;) .
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

User avatar
Gavinmc42
Posts: 3148
Joined: Wed Aug 28, 2013 3:31 am

Re: Demoscene

Fri Nov 23, 2018 2:34 am

Also Ultibo versions
https://github.com/noshbar/smallpt-ultibo-single

Raytracing is a bit slow, but OpenGLES is getting interesting
viewtopic.php?p=1325460

Not sure, but are Demoscenes real time or rendered videos?
I always thought they are live, in realtime.

I was thinking for myself something like a Zen sand garden.
Like a virtual one of these https://www.raspberrypi.org/blog/sisyph ... art-table/
Usual relaxing things to look and listen too when the brain strain of making these things is getting too much :lol:

Now where are some white/coloured noise algorithms that send audio via HDMI?
Perhaps some brainwave entrainment stereo effects?

For some reason I seems to have lots of spare Pi's and screens lying around.
Hmm a bunch of Pi/displays that RF talk to each other, distributed interactive Demoscenes?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
Gavinmc42
Posts: 3148
Joined: Wed Aug 28, 2013 3:31 am

Re: Demoscene

Fri Nov 23, 2018 2:45 am

Has this been done on Pi's?
http://www.brainwavecollege.com/brainwa ... audio.html

Been thinking too hard about graphics I have forgotten the audio component.
SonicPi is fun to play with, is there a baremetal version?
As relaxing music is one vital part of my coping mechanisms I think I need to do that first before attempting OpenGLES :lol:
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
Gavinmc42
Posts: 3148
Joined: Wed Aug 28, 2013 3:31 am

Re: Demoscene

Fri Nov 23, 2018 2:53 am

https://github.com/psenough/teach_yours ... in_14_days
Cool, I can learn everything in 14 days.
I thought it might take me well into retirement :lol:
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
Gavinmc42
Posts: 3148
Joined: Wed Aug 28, 2013 3:31 am

Re: Demoscene

Fri Nov 23, 2018 3:09 am

in4k has some useful info
https://in4k.github.io/wiki/raspberry-pi
Sometimes learning the existing methods blinds you to new methods.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
Gavinmc42
Posts: 3148
Joined: Wed Aug 28, 2013 3:31 am

Re: Demoscene

Fri Nov 23, 2018 3:18 am

But then again standing on the shoulders of giants allows you to see further.
http://www.pbr-book.org/
Time to stop talking and start coding
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
DavidS
Posts: 4198
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Demoscene

Fri Nov 23, 2018 3:29 am

@Gavinmc:
Sound on bare metal has alway been a bit difficult on the RPi, most people start out by outputing audio to the sterio output, not to HDMI, as it is an easier place to start.

It is not like on the Atari ST or Amiga where the sound output was only by one method, and very simple to accomplish, not by a long run.

We are still writing registers, though pushing sound to HDMI is a different game on the RPi.

And here I thought the hardest part was going to be getting user input in a way that everyone that would view the demo would have, which would be USB keyboard, requiring a working USB Stack with HUB and HID class support.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

Roken
Posts: 280
Joined: Sun Dec 31, 2017 4:35 pm
Location: UK

Re: Demoscene

Fri Nov 23, 2018 3:31 pm

Back in the day, demo scene went hand in hand with the cracking crews. Seems a bit pointless on OS software.
Headless PI. OMG, someone cut it's head off. Oh, hang on. it didn't have one to start with.

User avatar
DavidS
Posts: 4198
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Demoscene

Fri Nov 23, 2018 3:45 pm

Roken wrote:
Fri Nov 23, 2018 3:31 pm
Back in the day, demo scene went hand in hand with the cracking crews. Seems a bit pointless on OS software.
While there were cracking crews that particapated in the demoscene, most demoscene crews were composed of programmers attempting to get seen by the world by showing off there skills. Then of course there have always been the ones that just want to prove that the Computer or OS that they use is really good (remember the days when every Amiga user thought Amiga was best, ever Atari ST/TT/Falcon user thought that Atari TOS machines were the best, etc), this was the biggest fuel for the demoscene of old.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

User avatar
Gavinmc42
Posts: 3148
Joined: Wed Aug 28, 2013 3:31 am

Re: Demoscene

Sat Nov 24, 2018 7:30 am

A Retro CPU post lead me to this github.
https://github.com/fbergama/pigfx

A bit of tweaking and any old retro computer resolution can be supported?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
DavidS
Posts: 4198
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Demoscene

Sat Nov 24, 2018 2:34 pm

Gavinmc42 wrote:
Sat Nov 24, 2018 7:30 am
A Retro CPU post lead me to this github.
https://github.com/fbergama/pigfx

A bit of tweaking and any old retro computer resolution can be supported?
No tweeking at all. For resolutions other than that currectly set, when you set a framebuffer visable size the GPU will scale it to the actuall output resolution. This is a nice feature of the RPi, as it makes it possible to do maximum 2 level recursion recursive raytracing, with simple enough scenes, at a speed that is accaptable, around 12FPS, by only rendering to a screen that is 320x200 pixels (makes a huge difference). With an ARMv8, four cores, and careful coding you may be able to get significantly higher speeds at 640x480.

Then just play.

Unless you are talking about tweeking PiGFX, in which case there are better ways to simulate old graphics and text modes.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

bzt
Posts: 373
Joined: Sat Oct 14, 2017 9:57 pm

Re: Demoscene

Sun Nov 25, 2018 12:01 pm

Gavinmc42 wrote:
Fri Nov 23, 2018 2:34 am
Not sure, but are Demoscenes real time or rendered videos?
I always thought they are live, in realtime.
They are real time indeed. There's no video compression known that could shrink a 5 min rendered video (and it's player) into 4k / 16k / 64k etc.

Btw, if you're interested, in this documentary video there's an interview with the makers of this 64k demo (both are YouTube links). They explain around 54:10 with simple words how they've created their demo and those awesome visual effects in such small size. Sorry, the documentary is in Hungarian, but at least it's subtitled in English.

(Just an interesting sidenode, demo scene has a long history in Hungary. It started as a nice animated logo of the hacker team who pirated the software (you couldn't buy software legally on the East side of the Wall back then, so pirating was the only option. Needless to say it was punished by jail, but not because you violated copyright, but because you were using the "digital optium of the falling West" as they said. You had to use East-block software only, which weren't bad btw, but mostly games, like Mission Impossible, The Last Ninja series, Ecco, Scarabæus (the first 3d maze game, contributing to the urban legend of Polybius a lot) etc.). Anyway they started a geek-show for those animated logos alone, and that show grow up to be the first independent demo scene.)

Cheers,
bzt

Return to “Bare metal, Assembly language”