This document discusses RetroObjects, a framework and collection of emulators written in Smalltalk. It aims to allow emulating retro game consoles like the Commodore 64 and Nintendo Entertainment System in an object-oriented way. The framework provides abstractions for common hardware components like CPUs, video chips, and memory. It separates the emulator into a system model and objects for user input/output. This allows developers to focus on accurately modeling the target system architecture rather than low-level programming.
2. What is it? A collection of software emulators A software emulator is a computerprogram that imitates an electronicdevice or another program. Examples: DOSBox MAME 2
7. Motivations I noticed that: People always choose statically-typedlanguages for making them. Proceduraldesigns are preferedwhencomparedtoobject-orienteddesigns. Whyisthat? Performance issues. Isthatreally a problemnowadays? 7
8. Goals Whatdid I wanttoaccomplish? Writeeverything in Smalltalk! . OO design first, then think about performance. Recreatethefeeling of the original machines Highqualityemulation. Createaneasyto useframeworkforwritingcomputer & gameconsoleemulators 8
15. Thesystemmodel Thepowersupply Implementsthe concept of “keepingalive”electricaldevices Works at a specifiedfrequency Manydevices can bepluggedtoit It’simplementedwith aSmalltalkprocess 15
17. Thesystemmodel The C64 architecture (simplified) CPU (MOS 6510) Address decoder IO CHIPS MEMORIES Video chip MOS 6569 R E G Mainmemory (64K RAM) Color (?K RAM) Sound chip MOS 6581 R E G Basic (?K ROM) R E G Kernal (?K ROM) CIA 1 Char (?K ROM) R E G CIA 2 17
18. Thesystemmodel The NES architecture (simplified) CPU (MOS 6502) Address decoder Color palette (32 bytes RAM) IO CHIPS MEMORIES Video chip PPU R E G Characterinternalmemory (2K RAM) Memoryprovided bythecartridge Sound chip APU R E G R E G Sprite RAM (256 bytes) DMA R E G IO 18
19. Thesystemmodel How do the machines work? The CPU isclockedbythepowersupply The CPU readsfrom and writestothe bus ie: at:anAddressput:aNumber Addressdecoder: Addressinterval -> Chip (16r0000-16r7FFF) -> RAM (0000-7FFF) (16r8000-16r800F) -> Video chip (0000-000F) Theselected chip getstherequest,and theregisters interface mapitintoanaction. 19
22. The Video system RETROBJECTS SIDE DEVELOPER ONLYNEEDS TO IMPLEMENT THESE TWO OBJECTS Palette Thesystemmodel Powersource Video chip Frame buffer Color generator External interface TV Converter 22
23. The Audio system RETROBJECTS SIDE Buffer Strategy Thesystemmodel External interface Power source Sound chip Sampler Speaker DEVELOPER ONLYNEEDS TO IMPLEMENT THIS OBJECT 23
24. The Input system OUTSIDE RETROBJECTS RETROBJECTS Thesystemmodel Representation of user’s keyboard User presses The ‘A’ key External interface C64 keyboard Adaptor DEVELOPER ONLYNEEDS TO IMPLEMENT THESE TWO OBJECTS 24
25. Groups of entities Thesystemmodel Theuser’s IO devices Theobjectsthatallowcommunicationbetweenthetwoworlds 25
27. Groups of entities Thesystemmodel Theuser’s IO devices Theobjectsthatallowcommunicationbetweenthetwo “worlds” 27
28. Translationobjects Loaders Take a file and convertsitintothe actualsoftware media, ie: T64, PRG, TAP. Adaptors Take a user input event and convertsitintoanaction in themodel. ie: User’skeypress -> C64 keypress TheGUIs 28
29. There are lots of thingsthatcouldbereusedonotheremulators! 29
31. The framework Somecomponents: TV, speaker, powersupply Digital pins, one-way and bi-directionalports Addressdecoders: mapping, bank-switching,mirroring Memories: RAM, ROM and registers Stroberegisters Counters and comparators Buttons and switches Video filters, samplers, etc. 31
33. Conclusions Smalltalk can do that, too! The Smalltalk environment is idealfor modeling hardware. Profiling is the key for getting greatperformance without compromisingthe design. 33
34. Future works Make it cross-platform Make it run in Mac & Linux Keepimprovingtheemulators. Keepevolvingtheframework. Documentation, please! No tests Make more emulators! 34