We obtained it in 1983, I possess, so it only took me about 41 years to gain around to it. This Tomy Tutor is never any longer a replacement design I secondarily obtained, nor is it a Ship of Theseus Frankenstein rebuild. Here is my exact first pc, in its customary case, on its customary components, with the Federated Neighborhood sticky label tranquil on the customary box. And it tranquil works.
Now, why so long? Neatly, for one component, it used to be only purported to be a practicing wheels pc because a plump Commodore 64 design would possess payment too great, but my folks wished to leer whether we would take to a home pc and His High Holy Munificence Fred R. Rated used to be blowing these infants out for a song by then. The receipt has long since disappeared, although $ninety nine sounds about appropriate plus maybe around $40 or so for a joystick, cassette deck and some cartridges, in comparison with someplace between $200 and $300 for the nowadays discounted 64 — which didn’t consist of the rest. (It tells you one thing about our household finances at the time when a C64 used to be too expensive.) I directly started writing my personal BASIC programs on it in its perverse runt BASIC dialect and when my folks indeed saved up and acquired us a C64 design the next 12 months (full with 1702 monitor and 1541 disk power), I refused to utilize it. In
retaliation
my handiest pursuits, my mother and father forcibly relocated the Tomy to storage and I went on to conclude even bigger issues on the Commodore, making it, no longer the Tutor, the defining pc of my childhood. That’s why there’s tranquil a Commodore 128DCR on my desk.
The other reason is that there used to be never surely a straightforward option to conclude it. Even when I discovered what CPU used to be surely interior (extremely a 16-bit TMS 9995, an developed version of the TMS 9900 in the Texas Instruments ninety nine/4 and ninety nine/4A), there used to be never a Tomy assembler, and other than its runt amount of scratchpad RAM (256 bytes) the entirety of the Tutor’s 16K of reminiscence is tied up in the 9918ANL VDP video chip. That form of structure used to be conventional for the household, but that also scheme that in terms of all the pieces is kept in non-executable VDP RAM, so attempting burning your personal cartridge EPROMs there’s no option to surely originate and crawl a machine language program on the Tutor. The first flashcart for the Tutor didn’t exist unless around 2016 and it used to be tranquil all ROM; furthermore, whereas the ninety nine/4A might well per chance possess its CPU-addressable RAM expanded (in addition to the ninety nine/8, its unreleased successor to which the Tomy Tutor is closely linked), there wasn’t ever a Tutor RAM expansion cartridge either unless very nowadays. Nevertheless now there are a pair of homebrew options even for imprecise home pc techniques treasure this one, and at final I’ve obtained my personal assembly language program in a roundabout scheme running on it.
And it’s all done with its personal, better I/O routines (if I conclude sigh my personal better self) as a basis for bigger projects. Nevertheless first, a runt bit tour of the Tutor itself, and then we are going to dig in.
Texas Instruments’ home pc collection, together with the grand TI ninety nine/4A, used to be the logical consequence of TI’s “one firm, one pc structure” policy. Indeed, the 1976 TMS 9900 CPU used to be on the complete their 16-bit 990 minicomputer structure in an ungainly 64-pin DIP chip package deal and rather per chance (the only different is the Identical outdated Instrument CP1600) the first single chip 16-bit microprocessor commercially available. It used to be fabbed in NMOS on a 4.5 micron assignment with about 8,000 transistors and at the foundation topped out at a decent 3MHz, although its pervasively microcoded structure required most ceaselessly colossal cycle counts per instruction. The 9918 video expose processor in the customary ninety nine/4 developed with a original bitmap mode to change into the 9918A in the ninety nine/4A, and, outlasting its originator, used to be one of the most common video chips of the early home pc skills (Sord, MSX, CreatiVision/Dick Smith Wizzard, ColecoVision/Coleco ADAM, and tons, many more). The customary ninety nine/4 used to be the winning contrivance of three interior home design efforts in 1979, but used to be derided for its “calculator” keyboard, lack of decrease case and a excessive MSRP; the upgraded ninety nine/4A débuted in 1981 with an improved keyboard, better video, more expansion options and a decrease mark.
Nevertheless TI used to be first and principal in the chip commerce, and at the time used to be the largest semiconductor producer on the planet. TI realized that the bodily measurement of the CPU used to be harming its business viability — although TI’s dubious management decisions possess been honest as tall a component — and developed more conventional 40-pin versions, first as microcontrollers with on-board RAM and ROM, then with more conventional 8-bit knowledge buses. The most stepped forward of these used to be the TMS 9995 which had a pair of further opcodes, a ancient pre-obtain facility, 256 bytes of on-chip RAM (we are going to gain to why right here’s essential after we talk about assembly language programming) and an interior decrementer for timing and event counting. It used to be noticeably faster than the 9900 and TI planned to implement it in its next generation of home pc techniques, the low-conclude shaded and white ninety nine/2 supposed to compete against techniques treasure the ZX-81 and Timex Sinclair 1000, and the excessive-conclude ninety nine/8 with more reminiscence, built-in peripherals and a a lot bigger keyboard.
Before that will occur, nevertheless, TI obtained deep in the weeds against their frail nemesis Commodore below Jack Tramiel and ended up cancelling each the ninety nine/2 and ninety nine/8 in 1983 (exiting the home pc market utterly in 1984), although no longer earlier than there possess been spinoffs. Or no longer it’s some distance never any longer certain how Japanese toy producer Tomy obtained fervent but in 1982 Tomy tailored the in-fashion ninety nine/8 structure the utilization of the identical 9995 CPU and 9918A VDP into their personal home pc in Japan, manufactured by Matsushita (Panasonic) below contract. This pc used to be known as the Tomy Pyuuta (ぴゅう太, also variously romanized as the Tomy Pyuta or Tomy Pyūta).
The Pyuuta wasn’t, and wasn’t supposed as, a ninety nine/8 clone. In contrast to the ninety nine/8’s bigger-conclude aspirations, the Pyuuta used to be targeted explicitly at younger teens, the utilization of a nice yet sturdy colossal plastic case and spill-resistant rubber Chiclet keys. For cartridges Tomy licensed some of Konami’s arcade video games treasure Frogger and Scuttle and created a pair of of their personal, and for peripherals they equipped game controllers (integrated) and a cassette recorder (optional) for saving your work. In the slay they planned to launch a modem, floppy disk, printer and speech synthesizer, all presumably the utilization of TI’s reference designs other than the printer which used to be a modified Astor MCP-40 plotter.
Even though the general BIOS used to be primarily based mostly on the TI’s and the title show camouflage in particular is terribly identical, Tomy prominently advertised it used to be a 16-bit design, yet targeted more on video games and graphics than programming. Enjoy the unexpanded ninety nine/4 and ninety nine/4A, all of the integrated 16K RAM in the Pyuuta is dedicated to the VDP, for which Tomy created a built-in paint program and a highly constrained dialect of BASIC (“G-BASIC”) to manipulate show camouflage components and sprites with katakana keywords. It ran the utilization of a 10.738635MHz 945/88 crystal divided by three for video (common NTSC 315/88 3.579545MHz) and 4 for the CPU (945/352, 2.68465875MHz). The processor clock tempo used to be slower on paper than the 3MHz 9900 in the ninety nine/4A which came off a 12MHz crystal, but the Pyuuta used to be nevertheless faster thanks to the 9995’s efficiencies and a serious architectural distinction I’m going to talk about almost straight away.
The Pyuuta used to be a reasonable success in Japan and Tomy decided to export it to other markets by translating the OS and G-BASIC to English. On the other hand, British importer Adam Imports despatched this first prototype relief, discovering G-BASIC too cramped to be commercially viable. As an improve TI have to possess equipped (unwittingly or otherwise) the code for TI Prolonged BASIC to Tomy to port, since Tomy BASIC has corresponding to nearly identical tokens, reminiscence utilization and syntax. This as a lot as this point version used to be imported more or much less straight by Adam Imports as the Grandstand Tutor, and its twin-BASIC design used to be released as an add-on design for the Pyuuta and then built-in as effectively to the next generation design Tomy themselves supposed to promote in the United States. This used to be the Tomy Tutor in 1983.
Tomy USA employed Proper Of us host Sarah Purcell as their spokeperson, who touted the pc as a tool so easy to utilize that teens might well per chance train themselves how one can use it (it’s true: I did!). She wasn’t as excessive-profile as TI’s Bill Cosby, but she used to be occasionally unknown to the aim demographic(‘s mother and father), and she or he hadn’t committed any felony offenses either. Sadly their otherwise promising advertising advertising campaign used to be most essential for the most frequent use of the phrase “right” in a single pamphlet, in addition to a five-day kick-the-tires-for-free deal which used to be about as a hit as Apple’s later “Test Pressure a Macintosh” promotion. (NARRATOR: In which he scheme it wasn’t.)
Enjoy the Pyuuta, Tomy prominently touted the Tutor’s 16-bit processor, but equipped no option to straight gain entry to it. A pair years earlier the Tutor might well per chance possess been a compelling design and one of the “right” teens on the box even wrote me a pair of years relief to mention he rather enjoyed the video games, but the online game shatter used to be in plump swing by then and Tomy’s intentional toy aesthetic swiftly grew to change into the kiss of death. No wonder Fred R. Rated used to be looking out to attain away with them.
Tomy it sounds as if lost so great money on the Tutor that they ended up producing only a pair of peripherals for the design in either the United States or Japan. This image shows the full setup in the United States, namely a tape recorder with custom electronics, an Anglicized version of these disc-primarily based mostly joy controllers which made the Intellivision appear treasure a paragon of ergonomics, and a grand-as-nails single joystick bought as the Pleasure Stick (insert humorous fable right here). And that used to be it. The floppy disk power, printer and speech synthesizer promised in each nations never looked as other than a single image in the Purcell pamphlet, the printer interface bought in Japan as section of the BASIC-1 add-on used to be never bought in a foreign nation, and most seriously the “TI Adaptor” — nothing much less than a Tomy rebadge of the TI Peripheral Expansion Box — that will possess integrated additional reminiscence and storage options used to be vapourware too.
The Tutor used to be also no longer an exact reproduction of the Pyuuta either, although the core silicon (the 9995 CPU, 9918A VDP video chip [9929A for PAL] and SN76489 DCSG sound chip) is the identical, primarily differing in the BIOS ROM, the absence of a Japanese persona dwelling, the presence of Tomy BASIC, and pretty numerous reminiscence banking good judgment. The techniques are otherwise nearly entirely effectively matched such that Japanese Pyuuta cartridges will most ceaselessly crawl on American or PAL Tutors and vice versa, language strengthen notwithstanding, with only one of the American cartridges — its sole explicitly educational title — being particular to the United States.
The Tutor, as with the Pyuuta earlier than it, started with the TI ninety nine/4A’s title show camouflage but with animation, scrolling the shade bars vertically. It felt treasure a nice pc from the second you became it on and the bigger 32×24 textual content cells surely bolstered that somewhat (plus making it great more straightforward to read on our runt Panasonic shade TV).
The Tutor menu, straight translated from the Japanese menu in the Pyuuta, used to be also impressed by the TI’s menu, but as a replacement makes use of a “pointer” rather than choosing objects by number. It used to be likewise very easy for a child to rob. On the Tutor, the GRAPHIC and BASIC modes are continuously available as section of its sizeable 48K of built-in ROM. The CARTRIDGE option only appears to be like if a cartridge is detected, which we are going to talk about in a second.
In contrast to the TI ninety nine/4A which feeble serially addressed “GROMs” for BASIC and tons other software program (which on high of that can no longer contain native code and are primarily written in an interpreted bytecode known as GPL), all of the Tutor ROMs and cartridges are straight connected to the bus and therefore considerably faster. Even though Tomy BASIC will likely be primarily based mostly on GPL, Tomy’s GPL dialect is a stripped-down variant specialized for this assignment, and the program textual content is straight accessible treasure every other knowledge in ROM. All of this, plus the 9995’s prefetch, are why the Tutor’s (and Pyuuta’s) pretty slower clocked CPU runs so rather more hasty in apply than the ninety nine/4A’s.
The Tutor’s GRAPHIC mode is a straightforward built-in paint program that takes plump honest actual thing about the 9918A’s 256×192 bitmap mode, providing two colours per line in every 8×8 cell — considerably better than techniques treasure the C64 or ZX Spectrum with two colours per cell. Moderately rocket cursor moved with the arrow keys indicated the most recent location, and in the event you possess been at the desired cell, you would then edit it the utilization of the palette and the editing square on the decrease appropriate. GRAPHIC mode also supported four colossal 16×16 sprites — to camouflage the 9918’s limitation of no more than four sprites per scan line — which is probably going to be crudely moved or engaging by GBASIC programs (no hyphen in the English name).
GBASIC, nevertheless, used to be so cramped — barely any string strengthen, runt program house, terse syntax and a pair extreme bugs — that I spent most of my early elementary existence in Tomy BASIC. I wrote some video games and some easy utilities and saved them to tape, and I tranquil possess one of these tapes, although I carelessly overwrote most of its contents later. But despite its lineage as a descendant of TI Prolonged BASIC, Tomy BASIC intentionally supported much less than its ancestor, likely to relieve inquisitive teens treasure me in a reminiscence-safe “sandbox.” There possess been commands for sound, persona graphics and some custom persona shapes, but most of these aspects possess been poorly documented (if in any admire), and there wasn’t any supported facility for straight accessing bitmapped graphics or sprites — let alone arbitrary reads and writes to VDP reminiscence.
Restful, the “sandbox” concept ended up being unsuccessful because a selection of Tomy BASIC commands don’t bounds-check effectively, and I bear in mind very clearly crashing it a pair of instances one day looking out to resolve out how the COLOR key phrase labored. (Alas, I was too younger at the time to perceive the significance of what I would done.) Such bugs even facilitated a suave hack to allow sprites, although this hack unsurprisingly has essential limitations, and there used to be no option to straight gain entry to VDP registers for other aspects treasure excessive resolution or 40-column mode. BASIC used to be as great as you would conclude on a stock Tutor and other than a runt consumer community in the Los Angeles space I didn’t know anyone else who had one. It wasn’t unless several years later that I obtained the Tutor relief, and by then I was knee-deep in Commodore programming, together with handcoding 6502 machine language opcodes in the Epyx FastLoad monitor. The Tutor had been stress-free but I could well per chance conclude more with the Commodore 64 and the 128 we obtained after that.
Emulation came slack to the Tutor each due to the its obscurity and a profound lack of hardware documentation. In 1998 yours surely wrote the first Tutor “simulator,” which I christened Tutti, ironically for the Commodore 64 so that it’s some distance likely to be crawl wherever a C64 emulator used to be supported (relief then I feeble C64S and later Frodo). It used to be designed to mimic the Tutor’s leer and surely feel the utilization of a persona dwelling I labouriously drew by see, a custom keyboard driver, raster interrupts for the 9918A’s damage up show camouflage modes, easy tone audio, and shade approximations with the VIC-II’s palette. It had a fully functional title show camouflage and menu plus reasonably true looking out but very ancient GRAPHIC, GBASIC and BASIC modes. For its behaviour I manually discovered how hasty issues ran and added delays and tweaks, and reverse-engineered the BASIC and GBASIC editors. Surprisingly, a portion of Tutti is on the complete section of the mission we are going to conclude nowadays, so grasp onto it in the relief of your head.
It took five more years for the first true Tomy Tutor emulator, namely Ian Gledhill’s 2003 TutorEm with functional 9995 and 9918A emulation; it used to be very slack, very buggy, incomplete and Dwelling windows-only, nevertheless it surely did work and in a roundabout scheme opened the floodgates. Later that 12 months MESS added a driver written by Raphael Nabet in 0.70 that I helped beta-test and it’s tranquil section of trendy MAME. While I surely possess since as a lot as this point TutorEm and made many fixes for my tape-enabled Tutti II emulator, we are going to use MAME for debugging this entry since it’s at demonstrate the only Tutor emulator that handles cartridge ROMs.
Tutti didn’t emulate the CPU because I didn’t know the scheme its I/O labored and it might per chance per chance possess been impossible to attain code in any performant fashion on the C64; even the rather gentle-weight 6502-on-6502 emulator I relieve for the KIM-1 KIMplement emulator runs about 30 instances slower or so than exact. I had done a runt bit taking half in around with TMS9900 assembly on the ninety nine/4A the utilization of the Editor/Assembler cartridge (“module”) on a friend’s machine, and I even had a general 9900 programming book, so the 9995 wasn’t surely an alien structure to me — which makes a suitable transition into speaking about the CPU itself.
The customary TI-990 minicomputers supported multiprogramming in a then-revolutionary fashion: most of their registers possess been surely kept in RAM. The only CPU-interior registers are the program counter (PC), a Workspace Pointer (WP) that indicated the put in RAM the 16 registers (32 bytes) stay, and a Site (ST) register for flags. This supposed that a context swap is probably going to be as easy as merely altering the PC, WP and ST registers to these of the original assignment. Even though zero or snarl pages on CPUs treasure the 6502 or 6809 is a linked concept, the 990 WP used to be more versatile and indeed completely intrinsic to how the 990 operated. It has a most ceaselessly orthogonal instruction dwelling for the time (ceteris paribus), and other than for R0 no longer being authentic as an index the registers is also feeble for any general cause, although particular instructions are mounted to particular registers treasure R11 as a hyperlink register for subroutine calls or R12 as the contend with for bit-serial I/O over the Communications Register Unit bus. Byte operations exist but all phrase accesses are aligned to even addresses.
For the TI ninety nine/4 in 1979 (and later the ninety nine/4A), TI certain that designing a plump 16-bit design around the 9900 would possess required original chips for its completely 16-bit bus, making the effort too expensive for a home pc. TI solved this converse by devising two buses. The most straight connected 16-bit bus hosted the lowest stage design ROM with the GPL interpreter plus 256 bytes of “scratchpad RAM” which might well per chance retailer eight full objects of registers, aloof of two 128-byte 8-bit static RAMs wired as low and excessive bytes (the 9900 is tall-endian) which the CPU might well per chance gain entry to in parallel. SRAM used to be expensive, nevertheless, so the the rest of the machine’s RAM used to be 16K of dynamic RAM given to the VDP, which has its personal DRAM refresh circuitry. Sadly, although the VDP used to be on this 16-bit bus also, the VDP only supported byte accesses and ignores the decrease half of the phrase, slowing DRAM reads further. Worse, all the pieces else used to be at the relief of the second “multiplexed” 8-bit bus, the put a runt circuit stalled out the CPU on reads unless two 8-bit fetches might well per chance assemble the plump 16 bits. While this supposed much less dear 8-bit components is probably going to be feeble, the payment reduction also payment a principal amount of performance.
The use of SRAM suggests that the ninety nine/4 used to be at first supposed to utilize a numerous chip that had RAM on-die, the put refresh circuitry don’t possess been wanted, but payment and market considerations it sounds as if prevailed. The supposed CPU might well need been one thing treasure the 1979 TMS9940 with an on-chip CRU, 2K of ROM, a decrementer and 128 bytes of SRAM, or the later TMS9985 with 8K of ROM and 256 bytes of scratchpad, although neither would possess been ready in time for the ninety nine/4. As mentioned earlier, after the disadvantages of the 9900’s strict 16-bit knowledge bus grew to change into more acute TI moved the multiplex circuitry on-chip and exposed only an 8-bit bus starting with the TMS9980 — but this also doubled gain entry to time to its external scratchpad RAM, condemning it to diminish-performance applications treasure TI’s Silent 700 teletypes. TI’s first are trying used to be to flip the 9940 into the 9985 by together with the identical multiplexer and bumping up the ROM and scratchpad RAM, which possess been each interior and thus done without the bus converse. There used to be reportedly no market appetite for the 9985, so TI eradicated the ROM and reduced instruction latency further by the utilization of prefetch steps in the microcode which is probably going to be parallel with a preceding ALU operation. Here is the 9995, released in 1981.
(A digression: how conclude you use the 9900 to implement a language treasure C? The absolute best formula is to honest implement a stack, which is facilitated on the 990/9900 by its strengthen for publish-increment addressing. Here is surely the scheme taken by the GCC port for the TMS9900, which treats the CPU more or much less treasure a contemporary CPU with a hyperlink register [usually R11], defines an ABI for arguments and volatile/non-volatile registers, and reserves one of the registers as the stack pointer, in this case R10. R10 is a 16-bit register treasure any the others, so the stack is also as colossal as the addressing house, a principal development over C-adversarial architectures treasure the 6502. Another scheme is to run “plump Berkeley” and take care of the WP so that you can implement register home windows, a la SPARC: the WP is also moved to any phrase-aligned contend with, so a caller can meander the WP down a pair of notches, dwelling up its arguments, name the routine, capture the return worth and dwelling it relief. On the other hand, the 9995 — and for that matter the stock ninety nine/4(A) — would not possess CPU-addressable RAM other than the scratchpad, so in the substandard configuration neither design would possess great skill for function calls no matter how they possess been implemented. The Tomy BIOS gets around this by simply transferring the WP or particular person registers around by hand, which is house environment pleasant, but in addition makes some particular person routines or subsections more difficult to utilize because there is just not any common calling convention.)
For our applications, although the 9995 has a pair of further instructions, we can take care of it in handy phrases as a faster 9900. The principal distinction at the assembly stage is the put the scratchpad RAM lives: since it’s external to the 9900, its location is wherever it gets decoded (e.g., in the $8000 differ in the ninety nine/4A), but in the 9995 the interior RAM continuously occupies $f000-$f0fb (for compatibility with the 9900 the final four bytes are seen at $fffc to $ffff and encourage as the NMI vector). The 9995 also has an interior decrementer at $fffa but we won’t possess to take care of that appropriate now for this particular mission. The only other concern is that the prefetch in the 9995 will possess an ticket on self-editing code if it adjustments the very next instruction which our instance would not conclude either. Otherwise, programming it’s nearly utterly the identical.
The Tomy BIOS clearly has strengthen routines for showing textual content and reading the keyboard, but we’re no longer going to utilize them for several reasons: first, I’m no longer notably conversant in them, second, we can doubtlessly conclude it faster and more flexibly ourselves, third, it’s appropriate education, and fourth, they more or much less suck. For enter, whereas we can no longer conclude one thing about the Tutor’s snug Chiclets or its single SHIFT key, we completely can improve upon the BIOS’ terrifying key rollover. Additionally, the Tutor’s default persona dwelling is inconveniently organized for contemporary applications: wile that you might well per chance per chance it sounds as if use the SCELL() (the Tomy identical of TI CALL HCHAR) roar to retailer characters by their ASCII worth straight into VDP show camouflage reminiscence, right here’s surely an artifact of BASIC and no longer surely how the glyphs are laid out in VDP RAM. We might well per chance treasure to dwelling up our persona dwelling to be exactly the identical as true ASCII so that no translation is wanted, in addition to strengthen the 9918A’s 40 column textual content mode which the Tutor BIOS never did. To conclude all of these issues, we are going to devise our personal library.
The homebrew hardware we are going to use is all from TeamEurope (hello Klaus!), who made one of the earliest Tutor flash multicarts. Here is his most recent unit which is the only at demonstrate available CPU RAM expansion for the Tomy Tutor and Pyuuta, providing 16K of CPU-accessible RAM in two 8K ranges in addition to a pair of 32K ROMs accessible by DIP swap from a 512K flash ROM. (This cartridge used to be surely conceived of first by tanam, but this unit is an expansion of that contrivance.) We’ll explore this design more in a future entry. On the other hand, we don’t need the RAM nor the further ROM skill nowadays and the design additionally requires a passive I/O port adapter for these further addressing lines, so we are going to use one of his more handy objects.
That more handy merchandise is this one, his first. It has every USA and Japanese cartridge ROM other than the very uncommon USA and Japanese Demonstration cartridges — with a runt bit luck I’m hoping to rectify that soon. It also lacks the later “3D” collection (a misnomer, they weren’t 3D with the conceivable exception of Rescue Copter) which require the further addressing line for 32K ROMs and are equipped on a separate multicart.
The flash ROM itself is a socketed off-the-shelf 512K Microchip Skills SST39SF040. These chips are conclude-of-existence but they’re tranquil more cost effective and easy to search out as DIPs or PLCCs, and by the utilization of Klaus’ board I don’t possess to construct one of my personal. For this I started with another DIP 39SF040 that I obtained cheaply since we won’t possess to conclude too many insertion cycles on the socket to gain this straightforward program working. There is free house in the default cartridge loadout for four more 16K ROM photos and we are going to use two of them.
Somewhat great any programmer will work for this. Since my daily driver is a POWER9 Linux workstation, I exploit the open-source minipro and this older XGecu TL866-II+ (minipro has experimental strengthen for the more moderen T48 but the TL866-II+ is effectively-examined with it; unfortunately that you might well per chance per chance’t belief many of the eBay and Amazon sellers to gain you the older mannequin).
For the inappropriate-assembler, we are going to use the AS macroassembler, which is multi-structure, inappropriate-platform, open-source and has particular strengthen for the 9995. It builds honest lovely on any stylish OS, together with Linux and macOS. The macroassembler will originate an intermediate object which we then hyperlink with an integrated software program into the final executable.
The Tomy machines speak their VDP ports at $e000 and $e002 in the 9995’s common addressing house, whereas the keyboard and joy controllers (which fraction keyboard lines) are on the CRU bus at $ec00 by $ec70 with every community of eight lines separated by 16. The “runt” 8K and “medium” 16K cartridges each are mapped to $8000-$bfff, the put the Tutor expects to leer two $55 bytes at $8000. If these two $55 bytes are demonstrate, the CARTRIDGE option is enabled in the menu, which triggers a bounce to $8002. (There are other ways to signal its presence, but this fashion is the simplest and the one feeble by the majority of legit Tomy cartridges.) So we are going to commence off with this:
padding off ; vdp ports on the tutor vdpwd equ 0e000h vdpwr equ 0e002h ; CRU address for reading the keyboard keycru equ 0ec00h org 08000h ; cartridge signature word word 05555h
The leading zeroes for these particular 16-bit values are a required quirk of AS. Since we’re the utilization of all our personal routines, we don’t desire any interference from the BIOS, so we are going to flip off all interrupts by surroundings the interrupt hide to zero and cargo the WP with the lowest contend with of the 9995’s built-in scratchpad RAM. (We’ll possess more to sigh about interrupts later.)
limi 0 lwpi 0f000h ; don't even trust the Tomy OS here
The Tomy Tutor BIOS presents us literally nothing to work with anyway: earlier than the cartridge is started, the registers are dwelling to default values and the complete VDP RAM is cleared. That scheme there’s no show camouflage matrix nor a persona dwelling, and we are going to possess to write them to VDP RAM ourselves. (The expectation is that you are going to name the BIOS’ personal utility routines to dwelling these up, and that’s the reason indeed what common Tomy cartridges conclude, but we’re no longer going to conclude that right here.) To construct working with the VDP pretty more convenient, we are going to construct a runt bit utility subroutine.
vdpr ; write to VDP registers ; MSB of r0: command nybble + value (8r=register, ; 4x=MSB VDP RAM for write, 0x=for read) ; LSB of r0: new register value (xx) or LSB of VDP RAM address ; the swapping around gives enough time for the VDP to operate, ; and we have no IRQs on, so nothing will interfere swpb r0 movb r0, @vdpwr swpb r0 movb r0, @vdpwr b *r11
Recall that the 9918A only has an eight-bit knowledge bus, so we must talk about with it by byte-sized operations. This subroutine takes a single 16-bit argument in r0 that either encodes an absolute VDP RAM contend with for reading or writing, or encodes one of the eight VDP registers and the byte to retailer in it. (As a consequence of the scheme these addresses are represented, i.e., either $4xxx to write or $0xxx to read, a “gigantic 9918A” would possess to implement some form of bankswitching register to take care of more than 16K. The only other supported RAM measurement for the 9918A is 4K.) The LSB goes out on the bus first and the 9995 is tall-endian, so for every byte we swap them earlier than sending it to the 9918A’s control register, exiting relief to the caller by r11 as our hyperlink register. As a gratified convenience the swap operation takes honest long adequate for the 9918A to take care of the bus transaction and be ready for the next. With that, we can dwelling the following:
; register 0 turn off bitmap and external video li r0,08000h bl @vdpr ; register 1 ; - 16K mode ; screen off ; no IRQs ; no 40 column text mode (except if we asked for it?) ; no multicolour ; no bit 5 ; normal 8x8 sprites ; normal sized sprites li r0,08180h bl @vdpr ; register 2: put screen table at 0800h li r0,08202h bl @vdpr ; register 3: put colour table at 0c00h li r0,08330h bl @vdpr ; register 4: put character set at 0000h li r0,08400h bl @vdpr ; register 5: put sprite attributes at 0000h li r0,08500h bl @vdpr ; register 6: put sprite pattern table at 1000h li r0,08602h bl @vdpr ; register 7: white text on green background ; (the only colours available for 40-column) li r0,087f2h bl @vdpr
The locations for the show camouflage desk, shade desk, persona dwelling, sprites and tons others are encoded as multiples of particular alignments. For our persona dwelling, we are going to reorganize the Tutti one to check ASCII utter (I educated you we would be coming relief to that), add that to our binary and reproduction it in. We’re only the utilization of positions 32-127, so there is a range of house for expansion if we’re looking out so that you can add graphics characters or another font weight (for this cause I honest added a reverse/inverse dwelling). Once we dwelling the VDP reminiscence contend with, we can honest relieve sending knowledge to the knowledge port as the VDP’s contend with internally autoincrements with every write or read.
; load our font to>0000 li r0,04000h bl @vdpr li r1,fontt lup movb *r1+,@vdpwd ci r1,fontt+00800h jne lup
We run on to certain our show camouflage in the identical scheme (by storing the appropriate selection of house characters starting from the high left of show camouflage reminiscence), then dwelling the shade matrix (if 32 columns), print our persona dwelling and expose a welcome message in identical fashion.
Subsequent, we’re looking out to accept keyboard enter and echo it to the consumer. Despite the rubbery nature of the keycaps themselves and their non-common structure, the keyboard matrix honest is on the complete pretty appropriate quality: every key independently objects a particular bit in the matrix and some hasty assessments expose there’s runt to no shorting or ghosting. Discovering out it’s a straightforward matter of requesting every key bit in teams of eight from the CRU at their particular addresses. On the other hand, treasure every keyboard handler, we are going to possess to effectively debounce the keys, and right here’s the put the Tomy BIOS is notably destructive: once you form too swiftly and a pair of keys are down as you transition from one keys to the next, the keyscan routine will fail to construct a match and the original key will likely be dropped. This makes the Tutor’s already somewhat snug keyboard even worse to form on, a fully needless situation since the Tomy keyboard has all the hardware requirements to implement N-key rollover and is only let down by its software program. The solution is to trace every particular person key bit the utilization of the debounce matrix to filter key bits we already know possess been beforehand down. Here is made pretty more straightforward by the truth there’s only one modifier key to explore (i.e., SHIFT), but the concepts are the identical.
; scan keyboard ; needs 16 bytes of scratchpad RAM keyzone equ 0f020h keezc clr r0 ; clear debounce mov r0,@keyzone+8 mov r0,@keyzone+10 mov r0,@keyzone+12 mov r0,@keyzone+14 keez clr r9 ; clear test li r2,keyzone li r12,keycru-16 keezl ai r12,00010h clr r0 stcr r0,8 movb r0,*r2+ socb r0,r9 ; bitwise or ci r2,keyzone+8 jne keezl ci r9,0 jeq keezc ; clear debounce if nothing pressed
The “keyzone” block is our most recent matrix adopted by the debounce matrix we are going to use to filter it. This section is also entered either from keezc to scrub the debounce matrix, falling by to keez to read it. Discovering out from the CRU requires inserting the CRU contend with (a parallel addressing house) into R12 and requesting the wanted selection of bits. We obtain in teams of eight bits that are in eight locations kept 16 CRU bytes apart, conserving a running logical-OR (which the 9900/9995 atypically calls soc/socb “Discipline Ones Corresponding” for non-instantaneous arguments). If the worth of the running logical-OR used to be zero, then no key used to be pressed, we branch relief to certain the debounce, and run scan the matrix once more.
The simplest case is the put the most recent speak of the matrix exactly equals the final time (modulo the speak of the SHIFT key). This might well per chance also be checked for by outlandish-ORing with the debounce matrix, masking off the SHIFT bit. We then logical-OR all the resulting bits together and if it’s zero once more, we run relief to scanning — but leave the debounce matrix alone.
mov @keyzone,r2 mov @keyzone+2,r3 mov @keyzone+4,r4 mov @keyzone+6,r5 xor @keyzone+8,r2 ; xor current bits with last set xor @keyzone+10,r3 xor @keyzone+12,r4 ; clear shift bit (prevent "eeking" characters when releasing) andi r5,0fbffh xor @keyzone+14,r5 ; if exactly equal (i.e., all zeroes), go back soc r3,r2 soc r4,r2 soc r5,r2 jeq keez ; don't clear debounce
Here is the block of code we would use to dwelling up key repeat, which as at demonstrate written this routine would not strengthen yet (an bid for the future). Otherwise, now we possess got to filter the debounce to put off any keys that at the second are up, filter the original matrix to put off any keys already demonstrate in the debounce (which might well give us another zero matrix once more, but our keyscan desk would not match an all zeroes matrix, so it’s “lovely”), and replace the debounce matrix with the original bits which would be down whereas clearing the SHIFT flag. This closely makes use of the oddball szc instruction, which is an inverted logical-AND (although, treasure soc and ori, there is a traditional instantaneous andi that is no longer inverted, a irregular non-orthogonality in the instruction dwelling). I won’t expose every retailer right here but I’m going to give the total flavour — there’s doubtlessly a more environment pleasant option to conclude it than I’ve done, but right here’s also pretty easy to use conceptually:
; remove any bits in the debounce that aren't set currently mov @keyzone,r0 inv r0 szc r0,@keyzone+8 ; inverted and mov @keyzone+2,r0 inv r0 szc r0,@keyzone+10 [...] ; remove any bits in the new keyscan that were still set in debounce ; if we end up with a cleared keyscan, it doesn't matter since we ; won't be able to decode it anyway mov @keyzone,r0 szc @keyzone+8,r0 ; inverted and mov r0,@keyzone mov @keyzone+2,r0 szc @keyzone+10,r0 mov r0,@keyzone+2 [...] ; update debounce, clearing shift ; add any new bits to debounce so they get masked off too [...] mov @keyzone+4,r0 soc @keyzone+12,r0 mov r0,@keyzone+12 mov @keyzone+6,r0 soc @keyzone+14,r0 andi r0,0fbffh mov r0,@keyzone+14
Now with a trim dwelling of keybits, now we possess got to check them against a desk. I organized a desk of 4 phrases representing the eight matrix bytes in ASCII utter so once you possess found an identical dwelling, the index into the desk is the end result. This desk is kept at stamp keytab and appears to be like treasure this:
[...] ; symbols and numbers, 32-64 ; SPACE word 00000h, 00000h, 00000h, 08000h ; ! word 00100h, 00000h, 00000h, 00400h ; " word 00200h, 00000h, 00000h, 00400h ; # word 00001h, 00000h, 00000h, 00400h ; $ word 00002h, 00000h, 00000h, 00400h [...]
The Tutor does no longer possess CONTROL or ALT keys, honest SHIFT, nor does it possess a backspace or delete. This lets us redefine our special keys (the cursor keys, MON and MOD) to generate indices in the control persona differ. Our desk turns MOD into ^C (consistent with its use in Tomy BASIC as damage), LEFT/UP/DOWN/RIGHT as ^H ^Okay ^M/CR ^L, RT (RETURN) as ^J/LF, and MOD as ^[/ESCToroundoutothercommonASCIIpointsthedefaultkeyboardwouldnotgenerate^I/TABisencodedasSHIFT-SPACEbacktickasSHIFT-UPtildeasSHIFT-DOWNand^?/DELasSHIFT-LEFTThepipeandbackslashcharactersremainrepresentedbyflatanddegree/handakuwhichpossesstheidenticalASCIIworthTheonlykeyourmatrixdeskdoesnolongertakecareofisLOCKwhichwouldbe[/ESCToroundoutothercommonASCIIpointsthedefaultkeyboarddoesn’tgenerate^I/TABisencodedasSHIFT-SPACEbacktickasSHIFT-UPtildeasSHIFT-DOWNand^?/DELasSHIFT-LEFTThepipeandbackslashcharactersremainrepresentedbyflatanddegree/handakuwhichhavethesameASCIIvalueTheonlykeyourmatrixtabledoesnothandleisLOCKwhichwouldbephrase 00000h, 00000h, 00000h, 00200h. I would doubtlessly implement this as a conventional CAPS LOCK defaulting to up but we are going to exclude that from the good judgment for now. One thing no longer matched in the desk gets a end result of 0.
; decode key ; each table entry corresponds to CRUs>EC00-EC70 ; use a custom table to generate a standard ASCII value clr r6 li r1,keytab dekodl mov *r1+,r2 mov *r1+,r3 mov *r1+,r4 mov *r1+,r5 ci r2,0ffffh ; no key here jeq dekodn ; if the key matrix is an exact match, should be all zeroes xor @keyzone,r2 xor @keyzone+2,r3 xor @keyzone+4,r4 xor @keyzone+6,r5 soc r3,r2 soc r4,r2 soc r5,r2 jeq dekodo dekodn inc r6 ci r6,128 jne dekodl b @keez dekodo mov r6,r0 ; got a good key
Enjoy the debounce comparator, this code XORs the most recent matrix worth against the most recent desk entry; if it gets all zeroes, now we possess got a match. At the conclude the resulting persona code is in R6 and R0. Parenthetically, the 9900 has a inct instruction that increments by two in decision to honest one with common inc, priceless for skipping phrases (that you might well per chance per chance additionally use an instruction treasure c *r1+,*r1+ to increment by four in one phrase).
Because we left the VDP reminiscence pointer at the conclude of our “hello world” blurb, to print the persona to the show camouflage shall we simply conclude swpb r0 to gain it in the upper byte adopted by movb r0,@vdpwd. This would not scroll at the conclude as there’s no bounds-checking, and bear in mind the Tutor would not possess a backspace (control characters are simply printed as blanks anyway), nevertheless it’s surely surely hasty. On the other hand, we are also looking out to expose a cursor for we are going to use our reversed house persona, so we are going to relieve a rolling show camouflage pointer in R7. We’ll additionally possess RT certain the show camouflage and as a convenience use MON to bail out to the Tomy title.
; check for mon - implemented as escape ci r0,001bh jeq bye ; check for RT - implemented as line feed ci r0,000ah jne putc bl @clrscr b @cursor ; otherwise print character using a cursor ; overwrite previous cursor character with new character putc swpb r7 movb r7, @vdpwr swpb r7 movb r7, @vdpwr swpb r0 ; MAME will actually allow a mov here but not the real machine movb r0, @vdpwd inc r7 ; and print cursor cursor li r0,0a000h movb r0, @vdpwd b @keez
The absolute best option to run relief to the title show camouflage is to name the Tutor’s reset vector, but paradoxically the 9900’s built-in rset instruction is no longer what we desire for this. There are a handful of TI-990 holdovers known as external instructions which possess been feeble for special context switching operations, reminiscent of lrex to bounce into front panel code. On the other hand, on the 9900/9995, most of the instructions with the conceivable exception of idle conclude nothing priceless and in some situations is probably going to be doubtlessly unhealthy depending on what’s listening on the bus.
In its put, we are going to use the low reminiscence vectors. 9900 vectors consist of a pair of WP and PC phrases, with interrupt vectors starting at $0000. When an interrupt is brought on, or a vector is branched to the utilization of the blwp instruction, the WP and PC are loaded in utter from these phrases (directly saving the outdated code’s registers, assuming there is just not any conflict) and the outdated values of WP, PC and ST are placed in the original R13, R14 and R15 respectively. The rtwp instruction then reverses all the pieces the utilization of these registers and thus returns to the prior execution context. Theoretically the TMS9900 can strengthen as a lot as 16 phases of interrupt, starting at $0000 with stage 0 for resets by $003c for stage 15, although the ninety nine/4 and ninety nine/4A honest wire all the pieces to interrupt stage 1. In the 9900 reminiscence draw these vectors are adopted by XOP vectors for as a lot as 16 software program-defined opcodes by technique of the xop household of instructions.
On the other hand, the 9995 only implements seven certain interrupt phases, two of that are surely software program interrupts (and one of these would not even work effectively primarily based mostly on the handbook errata). The absolute best stage is stage 0, connected to the reset pin, adopted by the mid interrupt feeble for software program opcodes, then NMIs, and then four numbered interrupts consisting of an external interrupt (1) on the INT1 pin, a no longer-reliably-functional arithmetic overflow interrupt (2), the on-chip decrementer (3) and another external interrupt (4) on INT2. These possess their personal vectors other than for the MID interrupt and interrupt stage 2 which fraction the identical vector, and other than the NMI vector at $fffc all the rest come from low reminiscence as effectively.
On this particular regard, the Tutor is just not any numerous from the ninety nine/4A: a blwp 0 will bounce into the reset vector at $0000, honest as once you are going to powered the machine on and allowing you to run relief to the menu. While the Tutor also makes use of the identical reset vector values for phases 1 and 2, stage 3 (the decrementer) runs most ceaselessly to provider its common tasks and the stage 4 (external INT2 brought on) interrupt is feeble for triggering on tape reads. On the other hand, the Tutor makes use of the complete XOP vector differ as section of a bounce desk, so it’s some distance never any longer conceivable to utilize any XOP instructions on the Tutor with the common ROMs (the ninety nine/4A at the least has a pair priceless values there). Anyway, all right here’s to sigh that a straightforward blwp 0 will likely be adequate.
That’s pretty great it, and we’re ready to assemble our first draft. I’m going to gain to the code in a minute, but let’s test it in MAME with mame tutor -skip_gameinfo -cart tello.rom. Our persona dwelling and welcome message appear beautifully although typing is pretty … messy.
The converse is never any longer our code, it’s MAME’s default settings. That you can per chance per chance accumulate the identical mojibake occurs whereas typing in common BASIC as effectively. I mentioned that the keyboard matrix is shared with the joy controller lines (although that’s surely priceless since it lets you read some keys from GBASIC which would no longer ordinarily enable this), and because MAME defines some keys for the controller, that you might well per chance per chance’t form most ceaselessly with the default keyboard settings. In my case, I surely possess a Hyperkin Trooper 2 USB joystick I exploit for Tutor video games since it has two buttons for SL and SR, so I eradicated the key equivalents for the joy controllers and dwelling it to completely use the joystick. Now we can form most ceaselessly.
And as hoped for, typing now flows beautifully. There is one more converse now we possess got to resolve, although:
I mentioned we would treasure this to also strengthen the 9918A’s 40 column mode, one thing the Tutor BIOS would not but would be very priceless for productivity applications (the Tutor has a range of gigantic video games nevertheless it’s time it completed its ability, darn it). With a runt bit tweaking we can flip on the 40 column bit in VDP register 1 and regulate our message and show camouflage structure so all the pieces results in the appropriate speak. On the other hand, the 9918A can no longer expose a 320-pixel-wide show camouflage, so as a replacement it shows a 240-pixel-wide show camouflage the utilization of only the leftmost six columns of every persona cell. The cells are tranquil eight bits wide in reminiscence; the rightmost two are simply no longer displayed. This formula of works for some of the characters — lowercase in particular, which makes me wonder if this used to be a consideration in the direction of the Tutor’s fashion — but clearly would not for others.
Since the font started as a Commodore 64 persona dwelling, after all, we are going to run relief into Ultrafont+ and commence disquieted them down, leaving pretty of gutter house.
I possess we’re ready to are trying it on the right component!
I feeble minipro to dump the most recent contents of the multicart ROM and wrote up a runt bit Perl script to conclude an inplace overwrite on the resulting file with our original binaries. We generate two ROM files known as tello.rom (32 column) and tello40.rom (40 column), which we splice in at locations 0x70000 and 0x74000 and then burn it to flash.
% make burn perl splice /home/censored/tutor.bin 0x70000 tello.rom 0x2000 successfully replaced 8192 bytes at offset 458752 in /home/censored/tutor.bin with tello.rom perl splice /home/censored/tutor.bin 0x74000 tello40.rom 0x2000 successfully replaced 8192 bytes at offset 475136 in /home/censored/tutor.bin with tello40.rom minipro -p SST39SF040 -z Found TL866II+ 04.2.131 (0x283) Pin test passed. minipro -p SST39SF040 -w /home/censored/tutor.bin Found TL866II+ 04.2.131 (0x283) Chip ID OK: 0xBFB7 Erasing... 0.40Sec OK Writing Code... 30.12Sec OK Reading Code... 4.30Sec OK Verification OK
The multicart DIP settings for the 32-column version are (1=on) 00011 once you use these addresses. The first time I attempted, the hello message looked but typing generated no output. This used to be because I had a mov r0,@vdpwd in decision to movb r0,@vdpwd; MAME will accept either instruction but no longer an actual Tutor. With that corrected, we’re in commerce!
For the 40-column version, dwelling the DIP switches to 00010.
These are right composite video captures from my right Tutor. Hurray! We did it!
Now, what issues might well per chance you conclude with better keyboard strengthen, true ASCII and hasty persona expose? Neatly, clearly this complete proof of concept is the commence of doing one thing more handy with the Tutor. I’m going to acknowledge that question in a pair months once all the components come. The first utter of commerce will likely be placing in a PLCC adapter in the multicart so I don’t possess to drag the flash chip out many times for checking out.
Let’s briefly form our Tutor fable. There are surely two other participants of the Tutor/Pyuuta household, each home to Japan: the Pyuuta Jr., a game console that came out between the Pyuuta and Tutor that implemented GRAPHIC mode (but no GBASIC) and must tranquil play most cartridges — but used to be fully in English with no katakana strengthen in any admire — and this, the final and final Tutor, the Pyuuta Label II (variously Pyuuta mk II and Label II). The mk II had honest keycaps with a rearranged structure and feeble the American Tutor BIOS in decision to the Pyuuta’s, with Tomy BASIC (also the identical as the American Tutor’s version) available as an add-on cartridge. Seriously, neither design supported a composite monitor, only RF TV output, although they’re pretty easy to comp-mod. Each techniques possess tiny hardware differences from the Pyuuta and Tutor but each will crawl all the identical cartridge video games, and they also don’t require special hardware for 32K cartridges. Sadly, their English-only nature doubtlessly didn’t endear them to their home markets and the mk II can no longer load Pyuuta tapes either (only US Tutor ones). Likely in consequence, each bought poorly, and Tomy exited the home pc market as effectively in 1984.
As for the 9995, in the conclude it used to be only ever implemented in three techniques: the Tutor/Pyuuta household, a PEB improve known as the Myarc Geneve 9640 which used to be on the complete a original TI-effectively matched pc on a card, and the Powertran Cortex, a home and commerce pc first built at TI in the United Kingdom that never obtained released due to the interior squabbles. In its put, its plans possess been printed in the Electronics This present day International magazine and a firm known as Powertran Cybernetics bought kits and fully assembled machines. The Cortex ran at a plump 3MHz, had 64K of chip RAM (with a reminiscence mapper supporting as a lot as 1MB) and feeble a 16K PAL identical 9928/29 VDP for graphics, although the more stepped forward Yamaha/Maplin V9938 is also substituted with as a lot as 128K of VRAM. Floppy, serial and DMA possess been all supported along with a built-in BASIC and a pair of running design options, even a runt v6 UNIX port known as LSX. Even though effectively-liked by fans, it used to be an imprecise design then and now, and rather few examples remain in operation.
While the 9995 used to be a rather more tractable chip than its ancestors, the reliance of the 9900 collection on RAM used to be what in a roundabout scheme stunted its technological evolution. In the days when it used to be taped out, CPU die house used to be expensive, so challenging register house onto more cost-effective RAM which most ceaselessly ran at a identical tempo used to be a logical different. Indeed, systems treasure 6502/6800 zero net page are the identical general idea, the utilization of a special expanse of reminiscence with faster gain entry to and special addressing as if it possess been CPU registers itself. As CPUs grew to change into considerably faster than reminiscence, nevertheless, this architectural quirk grew to change into more of a liability and contemporary 16-bit CPUs treasure the Motorola 68000 and the Intel 8086 and 80286 eclipsed it. A chip treasure the 6502 only obtained away with it for as long as it did since it used to be extremely low-payment and extremely common and even nowadays tranquil sells in quantity, neither advantage being one the 9900 or 9995 ever possessed. This present day, stylish CPUs possess comparatively big register files and caches as proof that the 9900 idea used to be a ineffective conclude. After the 99000 household, an upgraded 9900 with segmented reminiscence only feeble in TI’s final differ of minicomputers, TI abandoned further fashion of the structure in 1983 for the TMS320 DSP collection and the exceptionally swift TMS32010, a rather more neatly-liked (and, notably for a DSP, more conventional) processor.
The source code for our demonstration mission along with a Makefile, the persona dwelling binaries and the keyscan desk are available on Github below a 3-clause BSD license.