GERLA.CC

tutorial · commodore 64 · mactutorial · commodore 64 · mac

Come si fa un gioco per Commodore 64 su un MacHow to make a Commodore 64 game on a Mac

Gli strumenti che servono, dal minimo indispensabile a quello che serve per misurare, tutti gratuiti. Scrivere un gioco per C64 oggi non vuol dire lavorare su un C64: si scrive sul Mac, si prova in un emulatore, e il C64 vero, se c'è, serve come prova finale. Questa è la catena con cui è nato Ruote Fumanti. The tools you need, from the bare minimum to what it takes to measure, all free. Writing a C64 game today doesn't mean working on a C64: you write on the Mac, you test in an emulator, and the real C64, if you have one, is the final check. This is the chain Ruote Fumanti was built with.

L'editor è solo il posto dove si scrive il codice. Per arrivare a un file che il C64 carica servono pochi altri pezzi, e la maggior parte si installa con Homebrew, il gestore di pacchetti per macOS, con un comando solo:

The editor is just the place where the code gets written. To get to a file the C64 will load you need a few other pieces, and most of them install with Homebrew, the macOS package manager, in a single command:

brew install acme exomizer vice python git ffmpeg
01 · il minimo indispensabilethe bare minimum

Scrivere, compilare, provareWrite, build, test

Con questi quattro si scrive, si compila con un comando e si prova il gioco.

With these four you write, build with one command and test the game.

cosawhata cosa serve, e con cosawhat it's for, and with what
Editorscrivere l'assembler:writing the assembly: Visual Studio Code con l'estensionewith the VS64 extension (sorgentesource), che riconosce ACME, KickAssembler e cc65 e si collega a VICE per il debug, which understands ACME, KickAssembler and cc65 and hooks into VICE for debugging
AssemblatoreAssemblertrasformare il sorgente .asm in un file .prg:turning the .asm source into a .prg file: ACME, quello usato per Ruote Fumanti. In alternativa, the one used for Ruote Fumanti. Alternatively KickAssembler (serve Java) o ca65, dentro(needs Java) or ca65, inside cc65
EmulatoreEmulatorprovare il gioco, fermarlo, leggere la memoria col monitor:testing the game, pausing it, reading memory with the monitor: VICE, in particolare x64sc, il più preciso. Con VICE arriva anche c1541, che crea le immagini disco .d64, x64sc in particular, the most accurate. VICE also brings c1541, which builds .d64 disk images
CompressoreCruncherottenere un solo file piccolo che si decomprime da solo:getting a single small file that unpacks itself: Exomizer

Il ciclo di lavoro è sempre lo stesso: scrivi in VS Code, compili con ACME, comprimi con Exomizer, apri il .prg in VICE.

The work cycle is always the same: write in VS Code, build with ACME, crunch with Exomizer, open the .prg in VICE.

VS Code aperto sul sorgente di Ruote Fumanti

VS Code sulla cartella del gioco: a sinistra i sorgenti in src/, a destra native.asm aperto sulla routine che fa scorrere la strada, quella raccontata in come scorre la strada.VS Code on the game folder: sources in src/ on the left, native.asm on the right, open at the routine that scrolls the road, the one told in how the road scrolls.

La compilazione: ACME ed Exomizer

make rifà tutto: ACME assembla, Exomizer comprime. In fondo la mappa della memoria: 61 KB di gioco diventano un file da 24 KB che si decomprime da solo.make rebuilds everything: ACME assembles, Exomizer crunches. At the bottom the memory map: 61 KB of game become a 24 KB file that unpacks itself.

Ruote Fumanti in VICE

il PRG in VICE (x64sc), sul tracciato 3. In basso a sinistra la cosa che conta: 50,1 fotogrammi al secondo.the PRG in VICE (x64sc), on track 3. Bottom left, the thing that matters: 50.1 frames a second.

02 · un gioco completoa complete game

Quello che serve oltre il codiceWhat you need beyond the code

cosawhata cosa serve, e con cosawhat it's for, and with what
ScriptScriptinggenerare dati e tabelle, convertire la grafica, controllare la build:generating data and tables, converting graphics, checking the build: Python, con, with Pillow per leggere e scrivere le immaginito read and write images
AutomazioneAutomationricompilare tutto con un comando solo:rebuilding everything with one command: make, che arriva con gli strumenti da riga di comando di Apple (xcode-select --install), oppure i task di VS Code, which comes with Apple's command line tools (xcode-select --install), or VS Code tasks
VersioniVersionstornare indietro, confrontare, non perdere niente:going back, comparing, losing nothing: Git
Spritedisegnare gli sprite nei limiti del C64:drawing sprites within the C64's limits: Spritemate, che gira nel browser, which runs in the browser (sorgentesource)
CaratteriCharactersil set di caratteri, le tessere e i livelli:the character set, tiles and levels: VChar64, anche per Mac, also for Mac
ImmaginiImagesschermate e disegni con i colori e le risoluzioni del C64:screens and pictures in the C64's colours and resolutions: Multipaint
MusicaMusiccomporre per il SID:composing for the SID: GoatTracker 2 (c'è una(there's a versione per MacMac version), oppure, or SID-Wizard, che gira dentro il C64 o l'emulatore, which runs inside the C64 or the emulator
Gli sprite del salto in Spritemate

Spritemate con i quindici sprite del salto di Ruote Fumanti: l'auto in sette taglie, ognuna con due fasi delle ruote, più l'ombra. Se gli sprite sono una novità, sono spiegati da capo in gli sprite del C64.Spritemate with Ruote Fumanti's fifteen jump sprites: the car in seven sizes, each with two wheel phases, plus the shadow. If sprites are new to you, they're explained from scratch in C64 sprites.

La musica non deve per forza passare da un tracker: in Ruote Fumanti il motivo è scritto come testo, una riga per voce, e uno script Python lo converte in dati per il SID.

Music doesn't have to go through a tracker: in Ruote Fumanti the tune is written as text, one line per voice, and a Python script turns it into SID data.

03 · misuraremeasuring

Per misurare invece di provare a occhioTo measure instead of eyeballing

È la parte che distingue «sembra che funzioni» da «funziona, e lo si può dimostrare».

This is the part that separates "it seems to work" from "it works, and it can be shown".

cosawhata cosa serve, e con cosawhat it's for, and with what
CPU in PythonCPU in Pythonprovare pezzi di codice senza aprire l'emulatore: si carica il programma, si chiama una routine, si controllano i registri:testing pieces of code without opening the emulator: load the program, call a routine, check the registers: py65
Emulatore via scriptScripted emulatorfar guidare il gioco a un programma, leggere la memoria a ogni fotogramma, contare i fotogrammi persi, fare screenshot: il monitor remoto diletting a program drive the game, reading memory every frame, counting dropped frames, taking screenshots: the remote monitor of VICE (opzione -remotemonitor), comandato da Python(-remotemonitor option), driven from Python
Videospezzoni per la pagina del gioco, con l'audio registrato dall'emulatore:clips for the game page, with audio recorded by the emulator: FFmpeg
Secondo emulatoreSecond emulatorcontrollare che il gioco non funzioni solo in VICE:making sure the game doesn't only work in VICE: VirtualC64, nativo per Mac, native on Mac
C64 veroReal C64la prova finale, con una cartuccia flash comethe final test, with a flash cartridge such as Kung Fu Flash, oppure un, or an Ultimate 64
Prove su CPU 6502 con py65

py65 prova i tasti M e F e i motori senza aprire l'emulatore: la tastiera è finta, il codice è quello vero del gioco. Ogni riga è una verifica, e in fondo FALLITE 0.py65 tests the M and F keys and the engines without opening the emulator: the keyboard is fake, the code is the game's real code. Every line is a check, and at the bottom FALLITE 0, zero failures.

Il monitor di VICE sul gioco in corsa

il monitor di VICE, comandato da uno script, ferma il gioco in corsa: i registri della CPU, il codice dello scorrimento disassemblato, e la memoria delle variabili. Le istruzioni da $14f5 in giù sono la routine .fine vista dall'interno della macchina.VICE's monitor, driven by a script, halts the game mid-race: the CPU registers, the scrolling code disassembled, and the variables' memory. The instructions from $14f5 down are the .fine routine seen from inside the machine.

Misure con VICE pilotato da Python

le misure della 1.0.2: fotogrammi persi su 3000, per quanto la volante ti sta addosso, e cosa succede a fine tracciato.the 1.0.2 measurements: dropped frames out of 3000, how long the police car stays on you, and what happens at the end of the track.

Le quattro schermate di terminale sono ricomposte in immagine a partire dall'output reale dei comandi; le altre sono catture dirette dei programmi.

The four terminal screenshots are rebuilt as images from the commands' real output; the others are direct captures of the programs.

04 · pubblicarepublishing

Farlo arrivare a chi lo giocaGetting it to the people who play it

cosawhatcon cosawith what
Pagina e downloadPage and downloaditch.io
Caricare i fileUploading filesbutler, lo strumento ufficiale di itch.io da riga di comando, itch.io's official command line tool
La scena C64The C64 sceneCSDb, il database della scena, the scene database
in brevein short

Tre livelliThree levels

  • per cominciareto start VS Code, ACME, VICE, Exomizer
  • per un gioco verofor a real game in più Python, make, Git, e un editor per sprite, caratteri e musicaplus Python, make, Git, and editors for sprites, characters and music
  • per sapere che funzionato know it works py65, VICE pilotato da script, un secondo emulatore, e un C64 vero quando si puòpy65, scripted VICE, a second emulator, and a real C64 when you can

← Tutti i tutorial← All tutorials Ruote Fumanti →Ruote Fumanti →