OVERVIEW of the ROM V3.0 by Andy Wright

Total Page:16

File Type:pdf, Size:1020Kb

OVERVIEW of the ROM V3.0 by Andy Wright OVERVIEW OF THE ROM v3.0 by Andy Wright NOTES ON THE ROM SOURCE LISTING This disk contains the complete ROM 3.0 source code. Source code is the text that an assembler program reads and converts into machine code, ready to go into a ROM hip. The files on the disk are in a slightly different form than normal source files. They were made by re-directing the output that the assembler would have sent to a printer during assembly to a disk file instead. This gives addresses in the left-hand column, followed by the values at those addresses (both in hexadecimal) followed by the actual source file text. So, for example, near the start of the lower ROM you will see: 0016 C5 BCJUMP: PUSH BC ;16 The first number gives the address in the ROM, and the second number is the value there, so that PRINT HEX$(PEEK &0016) gives C5. BCJUMP is a Label that is used to referto this bit ofthe ROM in other parts ofthe source listing. PUSH BC is the Assembly Language text that caused the Assembler to generate the C5 machine code equivalent. A semi-colon precedes any REMs by the author - here I just put a 16 to remind myselfas I wrote the source (without the benefit ofthe left-handtwo columns) where things would be in memory. This doesn't usually matter very much, but the first part ofa ROM used by a Z80 proces- sor is a special case - see the section on RESTARTS below. You will find the Technical Manual (available via FORMAT) useful for a full understanding ofinteractions with the hardware. The text ofthe ROM source has been leftjust as I wrote it. Some parts are not terribly well documented, since I was writing to explain things to myselfrather than an audience. The symbols used may not correspond exactly to the Technical Manual's usage - for example, I started using URPORT and LRPORT (for Upper RAM Port and Lower RAM Port) before Bruce Gordon told me he was using HMPR and LMPR for the same things! Also, to the hardware, the screen MODEs are 0-3, not 1-4, and I think I may have used MODE inconsistently. Some sections have been "commented out" by inserting semicolons; for example, a table of EQUs that allowed me to write e.g. CP BORDERTOK instead ofCP 9EH had to be cut when the assembler ran out ofsymbol space! At one point I changed assemblers, and the new one didn't allow e.g. LD A,'K'. I did a search and change ofall single quotes to double quotes; this accounts for the occasional appearance in the text of CAN"T and A" rather than CAN'T and A'. You may think the code is oddly arranged, or contains odd things like DB 0DDH used to jump three bytes. This is because space was very tight, and any trick that saved a byte was needed. This included moving routines into "illogical" positions ifthis allowed a Label to be reached by a 2-byte JR instead of a 3-byte JP instruction. A NOTE ON HEXADECIMAL NUMBERS I know some people don't like hex, but it does make life much easier if you can get used to it. For example, in the first part of the lower ROM is the line: 000A C3CE37 JP ERROR2 In any 3-byte Z80 instruction, the first byte is the code for the operation, or "op code". In this case it is C3, for JP. The next 2 bytes are a value, or address, in reverse order, so they should be read 37 and then CE. In other words, JP to 37CE hex, which you can eas- ily find in the later part ofthe lower ROM. (The Label ERROR2 is at 37CE.) A decimal version would not be as easy to use: 0010 195 206 55JP ERROR2 Besides, it takes more room and it isn't as neat. PAGING There is only one actual ROM chip in the SAM, but it is handled in two sections. The lower ROM, also called ROM0 (machine code programmers often start counting at zero!) is usually paged in at 0000 to 3FFF (0 to 16383) whereas the upper ROM, or ROM1, is paged in at C000 to FFFF (49152 to 65535) when required. The lower ROM is ALWAYS paged in unless user-loaded software initiates complex pag- ing operations. The lower ROM pages in the upper ROM as required, for example, to handle floating-point calculations, BEEP or tape operations. RAM page 0 is usually paged in at 4000-7FFF (16384-32767) and holds important sys- tem variables and the start ofthe current Basic program. The upper halfofmemory, 8000-FFFF, is used to hold the section ofRAM that is currently being worked on. The early part ofa Basic program would involve RAM page 0 being paged in at 8000 (which automatically means that page 1 follows at C000). It doesn't matter that RAM page 0 is also simultaneously paged in at 4000. As later parts ofthe Basic program are inter- preted, the start ofthe current line will occur higher and higher in memory, passing from, say, BF85 to C023. While any structure in memory, like a Basic line, starts below C000, it can be 16K long before it will "fall off" the end of the memory map. This simplifies the job ofthe ROM, since it doesn't need to keep checking, forevery byte it reads, whether the end ofthe memory map has been reached. It is sufficientifit checks, say, every line, if the start ofthe line is above C000; ifit is, the paging can be altered so that the same byte ofRAM is re-mapped 16K lower (which will be somewhere in the region 8000 to BFFF) and again we have ample room before we fall off the end of the memory map. This sys- tem can be extended with up to 32 pages ofRAM (the maximum that the ports that page internal RAM can control) allowing for very big programs indeed. The screen is paged in, starting at 8000, when it must be read from or written to. The fly in the ointment, in a way, is the upper ROM. When paged in, it covers RAM at C000-FFFF and could obscure the later part ofa Basic line or variable, or the later part of the screen. This makes it unsuitable for many kinds of routines. Floating-point calculation routines are fine, because they work on numbers in the "system page" - RAM page 0, paged in at 4000-7FFF. However, graphic routines should not be in the upper ROM because the entire screen could not be paged in at the same time. (Well, it could be paged in at 4000-BFFF, but that would mean paging out the system page, which holds important variables like the PEN colour, screen MODE, the machine stack, information for interrupts, etc.) All this means that too much code cannot be run in the upper ROM. To get round this, I had to do nasty things like copying routines from this ROM to a RAM buffer in the system page forexecution. The first part ofthe upper ROM consists ofsuch routines, and the addresses given in the left-hand column correspond to the addresses in the RAM buffer where the code is RUN, not to the actual addresses in the upper ROM where the code is STORED. The routines involved were chosen because their speed is not critical - the copying process obviously imposes a slight delay. Other routines are quite convoluted because ofthe problem with the upper ROM. The PRINT routines, forexample, start in the lower ROM, use the upper ROM where this is feasible for the interpretation of charac- ters, and then use the lower ROM again for actually putting data on the screen. SAMDOS, MasterDOS and MasterBasic all page into 4000-7FFF for execution. They page out the normal machine stack and replace it with one oftheir own. Special routines are used to read or write the (paged out) system page variables, or to Call ROM routines with the system page temporarily paged in. HOW THE BASIC INTERPRETER WORKS I do not have the time to explain this in detail, but the following rough outline may help. When the SAM is turned on, the start ofthe ROM, at 0000, is executed. This jumps to an initialisation routine in the upper ROM, which clears RAM, sets up the system variables, screen mode, rainbow start-up screen, copyright message etc. and then waits for you to press any key. It then indirectly enters the interpreter's "main loop", as it would after an error report. The main loop is at 0E84 in the lower ROM. The first action is a CALL AUTOLIST which would list the current part ofthe Basic program, ifthere was one. Afterclearing various scratch-pad areas (such as the edit line) with CALL SETMIN, the lower screen is selected for input and output with CALL STRM0. Then theEDITOR is called to get input from the user. When the user presses RETURN, the Editor hands back control, and the main loop tokenises any keywords in the input using CALL TOKMAIN. (E.g. print is turned into a single-byte internal form that is shorter and easier to handle.) The modified line is then checked for correct syntax using CALL LINESCAN. This process also inserts invisible forms of numbers in the line. The invisible form is used to speed things up during program execution. Ifthere is an error, the invisible forms are stripped out again at 0EB0, a warning BEEP is produced, and the loop is gone round again, giving the user a chance to modify the line.
Recommended publications
  • Creative Computing Magazine Is Published Bi-Monthly by Creative Computing
    he #1 magazine of computer applicafa *'are raHSJS? sfife a*«uiH O K» » #-. ^ *&> iiD o «» •— "^ Ul JT © O O Ul oo >- at O- X * 3 •O »- •« ^» ^ *© c * c ir — _j «_> o t^ ^ o am z 6 %' 7 * » • • Consumer Computers Buying Guide a/ Paf/i Analysis Electronic Game Reviews Mail Label Programs Someday all terminals will be smart. 128 Functions-software controlled 82 x 16 or 92 x 22 format-plus graphics 7x12 matrix, upper/lower case letters Printer output port 50 to 38,400 baud-selectable "CHERRY" keyboard CT-82 Intelligent Terminal, assembled and tested $795.00 ppd in Cont. U.S. SOUTHWEST TECHNICAL PRODUCTS CORPORATION 219 W. RHAPSODY SAN ANTONIO, TEXAS 78216 CIRCLE 106 ON READER 3ERVICE CARD Give creative Gontpattng to a fHend for " [W*nr fiwter service - call tell free X * • -540-0445] 800-631-8112 InNJ 201 TYPE OF SUBSCRIPTION BOOKS AND MERCHANDISE Foreign Foreign Term USA Surface Air D Gift Send to me 1 2 issues D $ 15 $ 23 $ 39 24 issues D 28 44 76 Gifts cannot be gift wrapped but a 36 issues D 40 64 112 Lifetime D 300 400 600 card with your name will be sent with each order YOUR NAME AND ADDRESS : Quan Cat Descriptions Price Name Address Cittj State Zip- NAME TO APPEAR ON GIFT CARD* SEND GIFT SUBSCRIPTION TO- Name Address Citvf State. .Zip. PAYMENT INFORMATION a Cash , check or 7M.O. enclosed o Visa/BankAmericard") Card no. Books shipping charge SI 00 USA S2 00 Foreign a Master Charge J Exp. NJ Residents add 5% sales lax DPlease bill me ($100 billing fee will be added) be prepaid- TOTAL (magazines and books) Book, orders from individuals must creative computing creative computing Books.
    [Show full text]
  • Proteus Vol05-01.Pdf
    PROTEUS / AN INDEPENDENT NEWSLETTER FOR OWNERS AND USERS OF PROCESSOR TECHNOLOGY CORPORATION COMPUTERS FORMERLY SOLUS NEWS ------------------------- VOL. 5 # 1 1982 - FIRST QUARTER SINGLE ISSUE ••• $7.50 (US) PUBLISHED BY I 1690 WOODSIDE ROAD. SUITE 219. REDWOOD CITY. CA 94061. USA PROTEUS SINGLE ISSUE •.. $9.50 (FOREIGN) McVIDEO UPGRADE AVAILABLE NEW VERSATILE DISK CONTROLLER: FLOPPY, HARD DISK, CLOCK IN ONE BOARD IT REALLY WORKS! by Stan Sokolow There is a new disk controller on the market which offers high performance in one 5-100 board compatible with Sol. Not In the last issue, I reported my preliminary experiences only that, but it is plug compatible with the PerSci disk used with the MicroComplex video upgrade for Sol. My Sol was a in the Helios system. Named the "Versatile Floppy Disk very early model (Rev D), so expected it to be a tough Controller" (VFDC), this board is so good for Sol users, that test-case. I did report some problems, but just after the Proteus has arranged to be a dealer for it. Proteus News went into the mail, I received the repaired unit and a phone call from Bob Hogg of MicroComplex. He explained Its use is not limited to the Helios, but Helios owners that the early Sol's had a few timing problems, including slow will rejoice to know that this board is a no-hassle plug-in 8080 microprocessors. He made a change to the video board to replacement for the Helios controller board set that will give be more tolerant of these timing variations, and expected no IBM compatible soft-sectoring instead of the unique Helios further problems with mine.
    [Show full text]
  • Northwest Computer News Northwest Computer Society 3 • P.O
    NORTHWEST COMPUTER NEWS NORTHWEST COMPUTER SOCIETY 3 • P.O. BOX 4193, SEATTLE, WA 98104 SEP 878 284-6109 MY SYSTEM by David Kob, MD The system: A Southwest 6800 with 29k of memory, EPROM, graphics, X-Y digitizer, My system started in early 1976 with could expand a Southwest 4K board to an· cassette storage, modified CT-1024 terminal, homebrew acoustic coupler, and Dura Selec­ the purchase of a Southwest Technical 8K board by just piggybacking memory tric printer. Products CT-1024 TV Typewriter. chips. The decoding was already present Unlike most people who buy the comput- on the board and required just a few er first and then look for a terminal later, wiring changes. For the price of 64 2102's lknewi'dbeimpatienttostarttalkingto I had my 16K of memory. Aesthetic it my processor when I got it. The CT-1024 wasn't, but cost effective? Definitely! .MEETINGS wenttogetherquicklyandasmanyothers You've probably guessed that I'm a have found, it worked the first time. tinkerer at heart. In some way or other The Northwest Computer Society meets atthe Pacific Science Center, in Seattle, on the Encouraged by this I went ahead and I've modified every board in my system. first and third Thursday of each month at 7:30PM. The first meeting of the month nor­ bought the Southwest 6800 computer kit. Not that there is anything wrong with mallyis held in room 200, on the East side of the Science Center Court. This meeting us­ There were other reasons for choosing Southwest design.. Quite the contrary. ually features a formal presentation by a speaker or speakers.
    [Show full text]
  • Dryneedlingpubliccommentwee
    The appendices at the Center for Medicare/Medicaid Services page on Acupuncture for Fibromyalgia give the following definitions: Acupuncture, in the strictest sense, refers to insertion of dry needles, at specially chosen sites for the treatment or prevention of symptoms and conditions. Intramuscular stimulation is a technique of apply needles to areas of tenderness. IMS is considered part of Acupuncture by Medicare, and Acupuncture is not covered by Medicare. Thus PTs cannot bill for IMS or acupuncture for Medicare. https://wvw.cms.gov/medicare-coverage-datab Billing for Dry Needling According to WebPT BiinngfotDryNeedllnglWehPT-GoogleChrome L c=> JI # 1 SS ! 1 4- X Q https://wvw.webptcom/b^ WebPT makes the ultimate EM!? for rehab therapists. Feait ires Why WebPT Pricing About App Login H j Categories WebPT f 3? Jn '. Search Billina for Dry Needlin \ \ \ \ WebPT Continued (f? BiIfingfarDryNeedling|WebPT- Google Chrome <• T- G (3 https:/7www.webptcorn/blog/posT/biliing-for-dry-needliiig SHARE Haunted by ICD-10? Attend the ICD-10 Open Forum webinar and jELauren Milllganj __^R get all your questions answered—no exorcism required. Register now. By Lauren Mllllgan © July 6,2015 Dry needling is getting under our skin. Due to its perceived similarity to Featured Articles acupuncture, this controversial practice recently has taken some heat Fortune Favors Data: regarding the legality of PTs providing this service at all. Fortunately, Lessons Learned About most states stiil recognize that dry needling is withinthe scope of Outcomes at Ascend 2015 physical therapy practice, but if you are able to legally provide this service, you then must deal with the lack of clarity around how to bill ICD-10 Codes for Physical for it Therapy.
    [Show full text]
  • Planning Process and Operational Design
    Joint Publication 5-0 T OF EN TH M E T A R R A M P Y E D U A N C I I T R E E D M S A T F AT E S O Joint Planning 01 December 2020 PREFACE 1. Scope a. This publication is the keystone document for joint planning. It provides the doctrinal foundation and fundamental principles that guide the Armed Forces of the United States in planning joint campaigns and operations. b. Joint planning is the process of identifying military ways and means (with associated risk) the President can integrate with other instruments of national power (diplomatic, informational, and economic) to implement strategic guidance. c. The crises and contingencies the joint force faces cut across multiple combatant commands, domains, and functions. Global integration addresses transregional, all- domain, and multifunctional challenges. 2. Purpose This publication provides planning considerations for the Armed Forces of the United States’ interaction with governmental and nongovernmental agencies, multinational forces, and other interorganizational partners. It does not restrict the authority of joint force commanders from organizing forces and executing the mission as they deem best to ensure unity of effort and the achievement of objectives. 3. Application a. Joint doctrine established in this publication applies to the Joint Staff, combatant commands, subordinate unified commands, joint task forces, subordinate components of these commands, the Services, the National Guard Bureau, and combat support agencies. b. This doctrine constitutes official advice concerning the enclosed subject matter; however, the judgment of the commander is paramount in all situations. c. If conflicts arise between the contents of this publication and the contents of Service publications, this publication will take precedence unless the CJCS, normally in coordination with the other members of the Joint Chiefs of Staff, has provided more current and specific guidance.
    [Show full text]
  • JP 5-0, Joint Operation Planning
    Joint Publication 5-0 Joint Operation Planning 11 August 2011 This edition of Joint Publication (JP) 5-0, Joint Operation Planning, reflects the current doctrine for conducting joint, interagency, and multinational planning activities across the full range of military operations. This keystone publication forms the core of joint warfighting doctrine and establishes the framework for our forces’ ability to fight as a joint team. As our military continues to serve and protect our Nation in complex conflicts across the globe, it is appropriate that we continue to refine our doctrine and update our planning practices based upon experience and hard won knowledge. As a result of relevant joint force experience and knowledge, the practice of operational design and its relationship to operational art and the joint operations planning process is reflected in this revision of JP 5-0. Likewise, the practice of Adaptive Planning and Execution has continued to evolve since the last publication of JP 5-0. This volume provides necessary updates to that process, as our combatant commands have continued to develop their ability to provide military options for contingencies and we seek to develop tools that allow for more rapid development, review, and refinement of plans at the accelerated pace we find the world requires today. Given the operational environment is not simple or static, adaptation and flexibility are necessary in planning and execution. This edition of JP 5-0 seeks to arm joint force commanders with processes that allow for that flexibility. I encourage leaders to ensure their organizations understand and use joint doctrine and this manual in particular as you continue to assist our Nation in advancing its enduring interests.
    [Show full text]
  • Disk Format and PTDOS Installation Utility *FORMAT {{/}<Src>,}{/}<Dst>
    FORMAT - Disk Format and PTDOS Installation Utility *FORMAT {{/}<src>,}{/}<dst>{,L=<n>}{,S={R}{-V}]{,N=<name>}{,D=MM/DD/YY} INTERRUPTABLE OPERATION: the disk in unit <dst> is erased and then low-level formatted. System files are then copied from the disk in unit <src> to the disk in unit <dst> according to the command line options. <src> and <dst> must be before any other options. the ‘/’ is optional for both <src> and <dst>. If <src> is not provided, then unit 0 is assumed. <src> and <dst> must not be the same. FORMAT always creates a START.UP file and enables Verbose mode, so that START.UP will be displayed during PTDOS boot. Type 'S' during formatting to skip the rest of the format ARGUMENTS The L option sets the file level controlling which files get copied onto the newly-formatted disk. As the level number increases, additional files are added to the disk. L=0 creates a (non-bootable) data disk, with just the following files: {DIRECTRY, NEXTID, FSMAP}. Dummy directory entries are created for the Level 1 files. L=1 Creates a barely bootable disk, adding the following files: {BOOTLOAD, RESIDENT and SUTIL, START.UP}. L=2 creates a minimally useful bootable disk, adding the following files: {CONFIGR, COPY, DISKCOPY, FILES, FREE?, KILL, OUT, PRINT, REATR, RENAME, RETYPE, SET, SETIN, SETOUT, SYST, $PR}. L=3 (default) creates a reasonable bootable disk, adding the following files: {CLOSE, CREATE, DO, DCHECK, DUMP, EDIT, ENDF, EXEC, EXTRACT, GET, IMAGE, NULL, OPEN, OPEN?, RANDOM, READ, RECOVER, SAVE, SEEK, SPACE, WRITE, ZIP, $CREATE, $ESC, $LST, $NLST, $REM, $STOP, $WAIT, ACOPY, FORMAT, HEX2IMG, RUNSOLOS, GETTAPE, XMODEM, TXTMODEM, RXMODEM, SERIAL}.
    [Show full text]
  • JP 5-0, Joint Planning
    Joint Publication 5-0 T OF THE N A E W E ' L L I S D E F E R H N D M T M T Y R • A P A E C D I U • R N E I T M E A D F S O TAT E S Joint Planning 16 June 2017 This edition of Joint Publication (JP) 5-0, Joint Planning, reflects current doctrine for conducting joint, interagency, and multinational planning activities across the range of military operations. This keystone publication is part of the core of joint doctrine and establishes the planning framework for our forces’ ability to fight and win as a joint team. As our military continues to serve and protect our Nation in the complex environment of global competition and conflict, we must continually refine our doctrine and update our planning practices based upon those experiences and lessons learned. Our understanding of operations across the spectrum of conflict and the information needed by senior leaders to make strategic and operational-level decisions, developed during the planning process has evolved. This update to JP 5-0 ensures all our operations benefit from the application of our doctrinal planning processes. Likewise, the practice of Adaptive Planning and Execution has continued to evolve since the last publication of JP 5-0. This publication provides necessary updates to that process, as our combatant commands have continued to develop the ability to provide military options for contingencies. Therefore, we seek to develop tools that allow for more rapid development, review, and refinement of plans at the accelerated pace the world requires today.
    [Show full text]
  • Solus Vol01-01.Pdf
    SOL NEWS Vol. 1, No. 1 SOL Users' Society Jan, Feb. 1978 Editor: Stan Sokolow 1690 Woodside Rd., #219, Redwood City, CA 94061 Contributing editor: Ron Parsons Austin, Texas Address newsletter correspondence to the Editor. Send all other correspondence to: SOLUS, P.O. Box 23471, San Jose, CA 95153 Entire contents copyright (e) 1978 Sol Users' Society. Subscriptions are available by membership in SOLUS. Individual dues: $10 in U.S.A., Canada, Mexico; $15 elsewhere, Dealer memberships ($25) and manufacturer memberships ($50) include special services. SOLUS TO MEET AT SECOND WEST COAST COMPUTER FAIRE The Computer Faire creatures are at it again. There will be a second one, in San Jose, CA, on March 3-5. SOLUS will have some sort of get-together there. Suggestions for what to do will be greatly appreciated. Anyone in the San Francisco Bay Area who would like to help organize a mini-program should contact SOLUS. For more info on the Fire itself, write to Computer Faire, Box 1579, Palo Alto, CA 94302. SOFTWARE TECHNOLOGY'S "MUSIC SYSTEM" by Rod Hallen, Tombstone, Arizona Having been a frustrated would-be musician for years, one of my goals has been to make music with my SOL. Software Technology's "Music System" seemed to be the answer and the price is right. ($24.50 PP) Seven days from order to arrival is O.K., too. The price includes an S-100 music board kit, a forty-page manual, and a CUTER (and Kansas City format) tape of the program. Since the board only holds five components, construction is a three-minute job.
    [Show full text]