Hacker News new | ask | show | jobs
by userbinator 3411 days ago
Now, I wonder if I can get an old calculator to play the accompanying 4 track MOD?

Add some music and the demosceners at pouet.net might get interested in seeing it; they have a "wild" category for hardware/exotic demos like this.

I agree with the second comment there about replacing the verbose chain of if-statements with a single expression; my first thought upon seeing that was "this really needs to be simplified"; likewise, the second part with 7 nearly identical lines shifting left and then right by the same amount, then multiplying by 255(?!) can be simplified to a loop; the way it looked with lines for B and C having a slightly-different mask constant is misleading, since it looks like a copy-paste error. Here's an (untested) attempt at simplifying the code:

    int yoffs[] = { 0, 1, 3, 4, 3, 1, 2 };
    shift = 6 - ((digit&3) << 1);
    for(segs=0,i=0;i<7;i++)
     segs |= !!(screen_buffer[bx+yoffs[i]][bx]  &  1 << shift+(i<1||i>2) ) << 6-i;
2 comments

> they have a "wild" category for hardware/exotic demos like this.

Revision 2017 has a Wild competition coming up in mid-April as well:

https://2017.revision-party.net/compos/other

Trying to understand his code. It looks like B and C's mask constants are correct. Look at the pixel map, B and C are the only segments with a pixel offset. His 'bittest' is a cast to bool!? anything not 0 becomes 255 to mask against the seg bit? Strange. Surely there's a case with something like this to unroll loops to simplify