behind the scenes of a c64 demo
play

Behind the scenes of a C64 demo Ninja / The Dreams 28C3 Ninja / - PowerPoint PPT Presentation

Behind the scenes of a C64 demo Ninja / The Dreams 28C3 Ninja / The Dreams Behind the scenes of a C64 demo About me Linux kernel hacker embedded systems low level computing prefers limited machines and thats mainly because. . . Ninja /


  1. Behind the scenes of a C64 demo Ninja / The Dreams 28C3 Ninja / The Dreams Behind the scenes of a C64 demo

  2. About me Linux kernel hacker embedded systems low level computing prefers limited machines and that’s mainly because. . . Ninja / The Dreams Behind the scenes of a C64 demo

  3. About me coding on the C64 since 1988 mainly demo-scene related Zen(?)-like passion (searching enlightment via excessive practice :)) Ninja / The Dreams Behind the scenes of a C64 demo

  4. Some more notes This is a group effort Thanks, Oswald Thanks, Edhellon Thanks, Bubis Thanks, Leon Thanks, AMN Thanks, Dalezy Thanks, Doc Bacardi This is a case study! Yeah, we rock, but others do, too Yeah, C64 rocks, but other platforms do, too Ninja / The Dreams Behind the scenes of a C64 demo

  5. C64 facts CPU: 6502-based, 985248 Hz, three 8-bit registers, 56+ opcodes, 13 addressing modes, no multiplication and such Memory: 64KB RAM, forget the ROM Graphics: 160x200x16 (4 colors per 4x8 cell), Sprites Sound: 3 voices (Triangle. Pulse. . . ), Modulation, Filters Disk: 170KB per disk side, serial interface, handshake Other: 4 cycle-based timers, chainable Ninja / The Dreams Behind the scenes of a C64 demo

  6. Design choices flow dictated by music high pace, effect after effect no obvious filling material avoid empty screens as much as possible no story ”right in your face” Ninja / The Dreams Behind the scenes of a C64 demo

  7. Let’s get serious Showtime! Warning: Current working state Ninja / The Dreams Behind the scenes of a C64 demo

  8. Some terminology Speedcode unrolled loops usually generated at runtime LDA sine,x ADC sine,y STA pixel LDA sine+1,x ADC sine+1,y STA pixel+1 Ninja / The Dreams Behind the scenes of a C64 demo

  9. Some terminology Speedcode unrolled loops usually generated at runtime LDA sine,x ADC sine,y STA pixel LDA sine+1,x ADC sine+1,y STA pixel+1 Illegal opcodes undocumented opcodes only few useful, but those should be used Ninja / The Dreams Behind the scenes of a C64 demo

  10. Some terminology Speedcode unrolled loops usually generated at runtime LDA sine,x ADC sine,y STA pixel LDA sine+1,x ADC sine+1,y STA pixel+1 Illegal opcodes undocumented opcodes only few useful, but those should be used Raster time cycles Ninja / The Dreams Behind the scenes of a C64 demo

  11. Things we do Self modifying code can’t do without code is data, data is code Ninja / The Dreams Behind the scenes of a C64 demo

  12. Things we do Self modifying code can’t do without code is data, data is code Abuse the stack LDA table,x; INX costs 6 cycles PLA costs 4 cycles (and leaves X free!) needs sliding window for interrupts Ninja / The Dreams Behind the scenes of a C64 demo

  13. Things we do Self modifying code can’t do without code is data, data is code Abuse the stack LDA table,x; INX costs 6 cycles PLA costs 4 cycles (and leaves X free!) needs sliding window for interrupts Anarchy! Assume $DC06 LDA #$4C LDA #$04 is our STA $DC04 STA $FFFE jitter counter LDA #$00 LDA #$DC STA $DC05 STA $FFFF . . . . . . Ninja / The Dreams Behind the scenes of a C64 demo

  14. Tabled based effects lots of speedcode and tables ”magic” is in the tables and code generators runs in main loop code too slow, effect too slow chunky modes are common speed measured in fps (50 = good, 25 = well. . . ) ”newschool” effects Ninja / The Dreams Behind the scenes of a C64 demo

  15. VIC (register) based effects less speedcode and tables ”magic” is in the actual code runs in interrupt, must often be cycle exact code too slow, effect impossible usually full resolution (or even increased) speed measured in rasterlines ”oldschool” effects Our team can do both \ o/ Example: Bump mapper Ninja / The Dreams Behind the scenes of a C64 demo

  16. Tools/Equipment used Mostly cross-development GFX: ProjectOne, Grafx2, AmicaPaint , Sprite-Char-Edit , other GFX tools Music: GoatTracker Code: AS, DreamAss, CA65, TASS Custom Tools: mostly data converters or generators in C, Perl, VB, Java, CBM BASIC V2 Linking: make, exomizer Developer machines: C64 , Linux, Win, Mac EOL can still be annoying Master machine: Pentium MMX233 running DOS Ninja / The Dreams Behind the scenes of a C64 demo

  17. Memory layout $FFFF free for parts ... $2000 music $0F80 temporary stuff $0700 loader, buffers, $0200 depacker (relocatable) $0100 stack $0000 zeropage Ninja / The Dreams Behind the scenes of a C64 demo

  18. Memory layout (Rekmap) $FFFF free for parts speedcodes ... tables init code $2000 music $0F80 temporary stuff tables $0700 loader, buffers, $0200 depacker (relocatable) $0100 stack $0000 zeropage variables Ninja / The Dreams Behind the scenes of a C64 demo

  19. Memory layout (Rekmap) $FFFF free for parts speedcodes ... tables init code $2000 music $0F80 temporary stuff tables $0700 loader, buffers, $0200 depacker (relocatable) $0100 stack $0000 zeropage variables Ninja / The Dreams Behind the scenes of a C64 demo

  20. Loading Custom load routines Serial(!), asynchronous(!!) protocol [rant, rant] demos usually use 2bit + ATN you need custom code in the drive Some demos use the drive for calculations was cool to have your own loader, but lots of them crashed a few survived and are commonly used these days Here, our DreamLoad is used Special feature: Can also run from HD and MMC You want good compression to minimize loading. Ninja / The Dreams Behind the scenes of a C64 demo

  21. Packing Pimped exomizer (cross, of course) best packer around can take surprisingly long to pack 40KB depacking too slow for fast paced demos custom depacker, faster but nearly twice as large (500 byte) tweak the packer: use literals if the gain is not at least ’n’ bit tweaked the parameters for every part Ninja / The Dreams Behind the scenes of a C64 demo

  22. Packing Pimped exomizer (cross, of course) best packer around can take surprisingly long to pack 40KB depacking too slow for fast paced demos custom depacker, faster but nearly twice as large (500 byte) tweak the packer: use literals if the gain is not at least ’n’ bit tweaked the parameters for every part A priori knowledge (manual) know your data find symmetries use delta-packing derive tables from other tables . . . Ninja / The Dreams Behind the scenes of a C64 demo

  23. Linking Putting it all together usually parts are developed independently Linking means Proper init/clean exit rewrite code generators Sync to music Find/create spot to load/depack next part assign resources (memory!) don’t crash don’t create visual/audial glitches don’t be boring everybody hates it no fame involved, although it is pretty hard Ninja / The Dreams Behind the scenes of a C64 demo

  24. Syncing Music is the reference Music player is called once per frame (usually) a simple counter is used for synchronization loading times are variable since drives are mechanic! don’t even think about the time-of-day clocks, too coarse music players use ”instruments” internally so you can do something on e.g. every drum Ninja / The Dreams Behind the scenes of a C64 demo

  25. Once more Showtime again Now with pauses and comments Ninja / The Dreams Behind the scenes of a C64 demo

  26. Thanks! ninja@the-dreams.de Ninja / The Dreams Behind the scenes of a C64 demo

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend