Retrogame Archeology
Total Page:16
File Type:pdf, Size:1020Kb
Retrogame Archeology John Aycock Retrogame Archeology Exploring Old Computer Games 123 John Aycock Department of Computer Science University of Calgary Calgary, Alberta, Canada ISBN 978-3-319-30002-3 ISBN 978-3-319-30004-7 (eBook) DOI 10.1007/978-3-319-30004-7 Library of Congress Control Number: 2016935859 © Springer International Publishing Switzerland 2016 This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed. The use of general descriptive names, registered names, trademarks, service marks, etc. in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant protective laws and regulations and therefore free for general use. The publisher, the authors and the editors are safe to assume that the advice and information in this book are believed to be true and accurate at the date of publication. Neither the publisher nor the authors or the editors give a warranty, express or implied, with respect to the material contained herein or for any errors or omissions that may have been made. Printed on acid-free paper This Springer imprint is published by Springer Nature The registered company is Springer International Publishing AG Switzerland For my mother, who gave me computers and games that are now retro Preface I’m not very good at playing computer games. However, through sheer luck I happened to be alive, using computers and playing games, at more or less the right time to have experienced the retrogame era. I also happened to learn programming and study computer science at a time when there was a strong emphasis on low- level work, when getting a program working sometimes meant being clever enough to sidestep all kinds of limitations. Now, fast-forward several decades. After reading two compelling books – Mont- fort and Bogost’s Racing the Beam and Maher’s The Future Was Here1 – it finally dawned on me that I could use my training and good fortune to dig into the guts of old games, to seek and showcase game authors’ implementation marvels that lurked under the hood. In Ian Bogost’s book How to Do Things with Videogames,hewrote2 ‘We need more media entomologists and media archeologists overturning rocks and logs to find and explain the tiny treasures that would otherwise go unseen.’ I wanted to become a retrogame archeologist. What I found surprising in my research was that many retrogame implementation techniques had modern applications, and not only in games. I won’t go so far as to say that retrogames were the first to use these techniques or that modern uses are directly inspired by retrogames, but I will claim that retrogames are an interesting way to learn about them. Furthermore, having taught computer science students in university for many years, I think it’s fair to say that modern programmers aren’t always exposed to these techniques nor to the constraints that precipitated their use. This book is an attempt to fix that. The material in these pages tends to be fairly low-level and technical by its na- ture, so a full understanding of the content will undoubtedly require at least some proficiency in programming. However, my hope is that I’ve made the explanations clear enough to be appreciated at some level by nonprogrammers, retrogame enthu- siasts, historians, and researchers in game studies. I should also say something about the retrogame screenshots: a few years ago I read a book about modern art and was disappointed that more images weren’t 1 MIT Press, 2009 and 2012, respectively. 2 University of Minnesota Press, 2011, p. 148 vii viii Preface included. I understand now. The time and effort for me to get copyright permission to use the images that appear here has literally ranged from minutes to months, and that’s only for the cases where an identifiable copyright holder still exists. In other cases, companies have gone defunct or been absorbed through a long chain of acquisitions, or unfortunately, people who would have held the copyrights have passed away. Static images also don’t really capture all nuances of an interactive medium like computer games; I encourage you to watch retrogame walkthrough videos on the Internet to complement your reading. Thank you to all the people who were kind enough to take the time to respond to my random emailed questions, namely Scott Adams, Shahid Ahmad, Mike Austin, Bill Budge, Melanie Bunten, David Crane, Don Daglow, John Darragh, Andrew Davie, Dale Dobson, Jim Dramis, Randy Farmer, Ira Goldklang, Roland Gustafs- son, Paul Hagstrom, Alex Handy, Wendell Hicken, Paul Hughes, Mike Lake, Peter Langston, Al Lowe, Kirk McKusick, Kem McNair, Alan McNeil, Steve Meretzky, Jeff Minter, Chip Morningstar, Dan Oliver, Dave Platt, Eric S. Raymond, Jon Rit- man, John Romero, Roger Schrag, Manuel Schulz, Michael Schwartz, Stefan Ser- bicki, Paul Urbanus, Bruce Webster, Ken Wellsch, Wayne Westmoreland, Robert Woodhead, and Don Worth. Parts of the copy protection and code obfuscation chap- ters have benefited greatly, directly and indirectly, from people whom I know only via Twitter: @a2_4am, @antoine_vignau, @D5AA96, @dosnostalgic,and @yesterbits. I apologize if I accidentally omitted anyone! This work would not have been possible without the multitude of emulators and tools that are freely available. I would especially like to thank all the contribu- tors to ADTPro, B-em, Catakig, DASMx, DCC6502, defedd, DOSBox, FreeDOS’ DEBUG, Frotz, Fuse, GMQCC, LensKey, the Level 9 interpreter, MAME, MESS, NAGI, OpenEmulator, qcc, ScottFree, ScummVM, SIMH, Stella, VICE, xtrs, ZILF, and Ztools, as well as the authors of some online emulators in JavaScript: Jan Bo- browski’s Qaop/JS, Matt Dawson’s VIC-20 emulator, and Will Scullin’s Apple II emulator. The efforts of people and organizations like the Internet Archive to pre- serve material and make it widely available have been invaluable too. Closer to home, I’d like to thank John Brosz for helping with the visualization studio I used for some analyses, Rob Furr for letting me sit in on his game history class, Darcy Grant for loaning the camera equipment, Ben Stephenson for solder- ing up a data transfer cable for the Apple IIc, and Dean Yergens for giving me access to a working Commodore 64 system. Jeff Boyd and Tyson Kendon provided me with dual-tape cassette decks for experiments. The students in my inaugural CPSC 599.82 class on retrogames were both eager and patient with me as we went through this material on its maiden voyage, for which I am eternally grateful. I am also hugely indebted to the people who took time to help proofread this book: Jorg¨ Denzinger, Peter Ferrie, Paul Hagstrom, Nigel Horspool, and Jim Uhl. Finally, a special thank you to both Darcy Grant, who suffered through lengthy detailed descriptions of my game analysis du jour, and Kathryn Kawalec for her loving, unwavering support throughout the long research and writing process. Calgary, Canada John Aycock Contents 1 Introduction ................................................... 1 1.1 Constraints................................................ 3 1.1.1 PlayerConstraints ................................... 5 1.1.2 DeveloperConstraints................................ 5 1.1.3 TechnicalConstraints................................. 9 1.1.4 Meet the 6502 . ...................................... 11 1.2 PresentDay............................................... 13 1.3 BoringAcademicStuff...................................... 13 References..................................................... 14 2 Memory Management .......................................... 17 2.1 TooMuchMemory......................................... 17 2.2 Not Enough Memory . ...................................... 22 2.2.1 Fine-GrainedMemoryOverlays........................ 24 2.2.2 PagingandVirtualMemory ........................... 27 2.3 MemoryforStateInformation................................ 28 2.3.1 StaticAllocation:SavingandRestoring ................. 30 2.3.2 DynamicAllocation:SavingandRestoring .............. 31 References..................................................... 34 3 Slow, Wildly Incompatible I/O ................................... 37 3.1 Curses.................................................... 40 3.2 Flexibility via External Data ................................. 45 3.2.1 Model A: Monolithic ................................. 45 3.2.2 ModelB:InterchangeableData ........................ 46 3.2.3 ModelC:PartialInterpretation......................... 49 3.2.4 ModelD:FullInterpretation........................... 51 References..................................................... 57 ix x Contents 4 Interpreters ................................................... 59 4.1 InterpreterDesign.......................................... 64 4.1.1 ClassicalInterpreters................................. 64 4.1.2 DirectThreadedInterpreters........................... 66 4.1.3 IndirectThreadedInterpreters.......................... 70 4.2 InstructionSetDesign....................................... 71 4.2.1 Alignment.......................................... 71 4.2.2 OperandType....................................... 72 4.2.3 Case Study: Level 9 . ................................