Mattel Intellivision is the world's first gaming console with a 16-bit processor. The computer was developed by the American company Mattel in 1979 and was produced until 1984 (more than 3 million pieces were produced). Intellivision is widely known in the United States, but is little known in Europe and completely unknown in Russia.
Unlike its main competitor - the Atari VCS (2600) with a very simple architecture and an 8-bit 6502 processor, Mattel chose a complicated path, choosing the General Instrument CP1610 (CP1600) processor. In principle, at that time everyone was impressed by the architecture of the PDP-11 , so it’s not too surprising that the CP1610 resembles it (the register functionality is reduced and fewer addressing modes are used).
As in the case of the TI-99 / 4a computer and TMS9900 processor , 16-bit capacity in fact did not give the machine a performance advantage over 8-bit computers with 6502 or z80 processors , but in terms of programming, the machine is quite interesting. ')
Like other gaming consoles, programs are stored here on cartridges, which are ROMs ranging in size from 4 to 24 KB. In addition, the computer itself also has a small Executive ROM ROM, 6 KB in size, which stores the basic routines and character set and tiny RAM with a total size of 1.5 KB. Despite the fact that the bus is also 16-bit, it does not give much benefit, as RAM (with the exception of 240 words System RAM) is 8-bit.
CPU
The 16-bit General Instrument CP-1610 processor (developed around 1975) operates at a frequency of about 1 MHz and has 8 registers, of which only four are general-purpose - R0-R3. The remaining registers have special properties:
After referring to R4, R5 (as storing the address), their contents are automatically increased by one. The content of R6 is reduced by one when reading from it and is increased by one when writing.
Another name of the register R6 - SP (stack pointer). Strictly speaking, there is no hardware stack in this processor, but it can be fairly easily organized, because when writing to memory with an instruction in which the address is stored in R6, this register is automatically increased by one, and when reading the opposite, it decreases.
And finally, there is a register R7 - this is a PC (command pointer), into which you can write as in a regular register.
There are also several flags (Z, S, O, C) that do not have a special register of flags, but are available through the GSWD / RSWD commands.
The set of commands for moving data between memory and registers is quite traditional (unlike, say, TMS9900 , registers are not mapped into memory, so memory-memory operations are not supported by one instruction).
A useful feature of the processor is the ability to perform operations not only on general-purpose registers, but also on others. Above this can be seen in the example of MOVR R5, PC. There are a lot of more or less clever tricks based on PC operations. For example, DECR PC implements an infinite loop. INCR PC skips the next command.
To implement the stack, the following aliases are used:
PSHR R0 = MVO@ R0, R6 PULR R0 = MVI@ R6, R0
It is curious that, although the processor has all the features for full-fledged work with 16-bit data, all its instructions fit into 10 bits (6 are reserved for future extensions) and the early ROMs of the cartridges were also ten-bit, for cheaper prices. Later, all ROMs have become 16-bit, so now all this is no longer important. Nevertheless, the notion “DECLE” is still in the assembler - a ten-bit word. In more or less modern programs, it is functionally equivalent to DW (WORD). Analog DD (DWORD) is BIDECLE.
Memory
The memory card includes addresses at which RAM, ROM, video controllers and peripherals are available (STIC, PSG, Intellivoice).
RAM includes:
256b 8-bit ScratchPad RAM at $ 0100 - $ 01EF addresses (used for variables, including BIOS)
352b 16-bit System RAM at addresses $ 0200- $ 035F (here you can find the BACKTAB screen area, the processor stack, etc.
512b 8-bit GRAM for custom character and sprite images at $ 3800 - $ 39FF
ROM includes:
2k 8-bit ROM with characters and pseudo-graphics at $ 4000 - $ FFFF (as well as $ 3000 - $ 37FF, $ 2000 - $ 2FFF)
4k 10-bit Executive ROM ROM (BIOS) at $ 1000- $ 1fff
4 ... 24k 10- or 16-bit ROM cartridge at $ 0400- $ 0fff
Graphics
Video controller called STIC (AY-3-8900) for those times is quite good. It provides a resolution of 160x96 pixels (20x12 characters 8x8 pixels in size) with 16 colors and 8 simultaneously displayed sprites. Also there is a hardware horizontal and vertical scrolling (shift by 1-8 points).
Graphic mode, strictly speaking, is not here, but in text mode, you can reprogram characters (blocks of 8x8 dots called CARDS), indicating in the BACKTAB table which address in GROM or GRAM they are determined from, as well as their colors (background and image). GROM stores 2kb of standard letters, numbers and pseudographics.
As well as, say, in Magnavox Odyssey (Videopac) , STIC implements an interrupt in the reverse direction of the beam over the frame. But, unfortunately, the change of the video controller registers at this time is also not allowed, which excludes various raster effects common to later systems - such as the Commodore 64 or Atari XE / XL.
There are two video modes - FGBG (Foreground Background) and CS (Color Stack). They differ in the interpretation of bits in BACKTAB - how many and which bits there are responsible for the address in GRAM / GROM, how many and what colors. In FGBG mode, colors are stored directly in BACKTAB and there can be 8 for the image (bits 0,1,2) and 16 for the background (bits 9,10,13,12). At the same time, the numbers of the blocks that can be referenced are limited to 0-63 for GRAM and GROM (bits 3-8).
In CS mode, colors can be 16 for the image and background, but they are cleverly defined - in BACKTAB, bits 0, 1, 2 and 12 directly determine the color of the image (similar to FGBG, only two times less colors), but for the background everything is more cunning - colors are taken from the STIC cs0..cs3 registers ($ 28- $ 2B). If bit 13 for all blocks is cleared, then the background color for the entire screen is taken from cs0. If there is a block in which this bit is set, then the background color of this and subsequent blocks is taken from cs1. If there is still such a unit where it is installed, then from cs2, and then from cs3 - cyclically. Thus, you can choose any color from the “palette” with just one bit. Available block numbers in this mode: 0-63 for GRAM and 0-255 for GROM
Apparently, this mode is invented in the calculation of most games, where the screen is divided into color bars (sky, water, land, etc.)
In addition, separately in all modes, you can set the color of the frame and narrow the frame on the left and / or above (necessary when using the scrolling registers).
Sprites (they are called MOBs) can be 8x8 and 8x16 in size. For each in the STIC registers, you can specify the color, priority relative to the background image and the number (not the address!) Of the block in the GRAM from which the content will be taken, by analogy with BACKTAB. In addition, any sprite can be hardware stretched 2, 4 or 8 times and mirrored horizontally or vertically. Interestingly, the visual resolution of the sprite on the vertical is twice as high as the image resolution (the points from which are composed, for example, characters). Those. an 8x8 sprite actually consists of 8 pixels horizontally and 8 half pixels vertically. 8x16 sprites display two consecutive 8x8 blocks in memory.
Writing to the STIC and GRAM registers is possible only during the VBLANK retrace (or rather, there are two periods - VBLANK1 and VBLANK2, but we will not go deeper).
There is a standard approach to changing the image on the screen. It consists in setting the interrupt vector STIC on the handler, which starts at the beginning of VBLANK every 1/60 second. The handler writes to the STIC registers (the screen turns on, sets the colors of the frame, changes the coordinates of the sprites, etc.) and writes to GRAM (drawing the image).
In order to have time to do all these operations, the so-called shadowing is used - at first everything that needs to be written to the GRAM is prepared in the buffer in RAM, and copied from the RAM into the GRAM handler.
Sound
As for sound, it is enough to call the chip - AY-3-8914 (by the way, the development of the same company as the processor and video controller - General Instrument). This is, in fact, the same chip as in the well-known ZX Spectrum, with the same capabilities - three channels, a noise generator, and limited possibilities of envelope formation. The chip is addressed to the addresses $ 01F0 - $ 01FF.
In addition, a quite popular peripheral device is the IntelliVoice speech synthesizer built, like similar modules for other computers of those times (Magnavox Odyssey, TI-99 / 4a), based on the General Instrument SP0256 chip. You can play with the LPC coefficients using the Voice Tinkerer program.
Periphery
For Mattel Intellivision there were a number of peripherals. As in the case of other gaming consoles, Mattel tried to give its typewriter the properties of a home computer - a keyboard module was released. He had his own processor 6502, 16k RAM, ROM with BASIC, built-in tape recorder and, as a result, was comparable in power and cost to the console itself. The release of the module was promised but was postponed for a very long time (it reached the lawsuits of the buyers for the company) and, as a result, only 4,000 pieces were released.
Competition with the Atari VCS (2600) led to the creation of a strange device called System Changer. In fact, it was a copy of the Atari VCS, but developed and produced by Mattel, inserted into the Intellivision slot and allowed, respectively, to run games for the Atari VCS.
In 1982, the IntelliVoice speech synthesizer, already mentioned above, appeared.
A curious peripheral was the PlayCable. Mattel periodically broadcast games through television channels. Owners of PlayCable could download them from TV to the internal memory of the module and then play. Periodically, the set of broadcast games changed.
It is also worth mentioning about the standard control panels with a disk and buttons. These are the most common joysticks in two directions, for closing / opening, designed in the form of discs (you need to click on the edges). A large number of additional buttons, however, is quite unusual for game consoles.
Development and Emulation Tools
In those years when Intellivision was sold, the development of games for her was not an easy task. Technically, PDP-11 with a ROM emulator and the corresponding software was used for this.
In our times, of course, everything is much simpler. At least for Win32 there is a good emulator with a debugger - there is an SDK that includes an assembler with code examples and libraries that implement the most common functions for working with graphics and sound.
Of the emulators at the moment jzintv works best, enabling the debugger.
In addition, the so-called IntyBasic is popular . This is a cross-compiler of the Basic language to the source code in assembler. In a sense, it can be called a macro assembler, imitating the syntax of BASIC. It is quite good - it turns out quite a quality code, not to mention the mass of examples and documentation.
Sources look like this:
SPRITE 1,0WHILE COL0 AND $0004 #Y = #Y - 256 SPRITE 0,X+8,SPR63 WAIT WEND GOSUB update_score #Y = #Y + 256 PLAY music_victory FOR c = 0to100WAITNEXT c
Broadcast to the assembler as follows:
IntyBASIC.exe %1.bas %1.asmC:\work\inty\intybasic
To transfer the ROM image to a computer, I personally purchased an LTO Flash cartridge (images are uploaded via USB, the cartridge is inserted into Intellivision, where the list menu appears after switching on).
Intro "Yolka"
In order to feel the spirit of the platform, I wrote a small (6kb) New Year's intro - Yolka :
For graphics, the Color Stack mode is used here. Fir-trees and the month are sprites (for the Christmas tree the same sprite is used, stretched 2-4 times). To simulate snow, the middle part of the screen is periodically filled with the same successively increasing its code symbol, each of which represents the next “frame” of the flight of two snowflakes in the 8x8 block. Frames are chosen so that they are joined with the same neighboring ones.
Horizontal stripes, snowdrift, icicles and the inscription "HAPPY NEW YEAR" - these are all the usual standard characters.
To move up and down, the STIC vertical scrolling register is used when the frame is narrowed from above (this is not visible, since it is the same color as the background). Those. moves everything that is on the screen.
Unfortunately, taking pictures from the screen distorts colors very much and gives noises. In reality, everything looks much more decent.
As for the sound, the speech (verses from the song about the Christmas tree) is pronounced by the Intellivoice synthesizer module. At the same time, Russian words are composed of English phonemes ( allophones ).
Of course, this is almost exclusively a game - more than a hundred of them were released, including several homebrew games released in the 2000s.
With democene sparsely. There are several intro, from which it is worth looking at the spirit of Arnauld Chevallier.
In 2003-2004, the same author wrote for Intellivision an operating system called IntyOS . Although for obvious reasons (at least due to the lack of a drive), it is problematic to put it into practice, nevertheless, it is a fully-fledged OS with windowed graphical user interface, proportional fonts, true multitasking and an API for application developers.
Arnauld Chevallier itself implemented several simple applications for its OS: music player, clock, system load indicator and Hello World.