I have two quick items which will otherwise get lost in style, memory map and address decode. If anything bores you then skip to the first memory map.
I forgot to mention the inclusion of six
ground test points for the purpose of minimizing loop inductance when viewing signals with an oscilloscope. This required 0.5% of the board area and easily fit around component placing. I don't have an oscilloscope or have access to an oscilloscope an yet I can add functionality to aid diagnostics with oscilloscope. What's your excuse?
Thank you to GARTHWILSON and BigDumbDinosaur for corrections about
JMP (abs) and JMP (abs,X). I remain unamused that one refers to 65816 bank zero and I can only presume that it fixed something in Apple IIgs. If you don't care about passing anything via RegX, JMP (abs) in local bank can be simulated when RegX is zero. For my purposes, I'm going to regard JMP (abs) on 65816 broken in the same manner that ROR is broken on 6501 and very early 6502, decimal flags are broken on NMOS 6502 and decimal subtraction is broken on 65CE02. Feel free to argue the JMP (abs) isn't broken. However, any legacy application which uses it may fail to work outside of bank zero.
I've been researching
fictional user interfaces and I'm utterly perplexed. Portable, circular devices should be quite common but they aren't. Even for a hobbiest:
- Numerous 6502 Forum members work on battery powered, 3.3V systems.
- Numerous 6502 Forum members work with SPI and I2C.
- For many years, VTech has successfully sold 6502 systems with I2C serial EEPROM.
- Multiple 6502 enthusiasts make circular boards with 4 inch diameter or less.
- Circular, 3.3V, SPI, OLED displays are commonly available.
- Numerous 6502 Forum members are customers of JLCPCB which has offered 3D printing since Sat 1 Jan 2022.
Therefore, it should be relatively easy to make a portable device which is maybe 5 inch diameter and 2 inch thick with connectors, buttons and a display on one side (or both sides) and maybe a solar panel. Actually, I don't understand why circular phones or tablets aren't a common choice. With an accelerometer, high resolution "retina" display and available graphics processing power, it should be possible to hold a circular tablet in any orientation and allow the device rotate the display for the user's convenience. The only circular devices which I can recall are
Sony Discman and Motorola Revolve which was dis-continued 12 years ago. Perhaps it is application support? I've found numerous circular devices in cartoons, although they tend to have exotically fictional features, such as DNA analyzer. In contrast, the merchandise you can buy is wholly underwhelming. For example, the Miraculous Ladybug yoyo has one button which plays sound samples from the show. That's only a marginal improvement from the infamous Barbie doll with a pull string which says "Let's go shopping!" The ladybug toy doesn't even work as a yoyo or have a torch function!
A preferable system would have a few dressed-up games from the 1980s Usborne computer books, a few games of skill which are no more advanced than Horace Goes Skiing or Shuffle Puck Cafe (a Pong variant). With a compressor, stuff one or more serial EEPROMs full of bad jokes, ghost stories, a dinosaur reference guide, crypto-zoology (unicorns, fairies, elves, trolls) and whatever else you can devise. It would also be popular if it contained a weak
decoder ring type
substitution cipher (like Speak 'N' Spell) and a GPS receiver to aid map making. An accelerometer and Hall effect device would aid science experiments. It would be vastly preferable if it plays music, works with a television, has a text editor, has a circuit designer/simulator and allows programming.
My model was a
Totally Spies X-Powder and perhaps I should explain how this began and where it departed. I am a fan of the hugely under-rated 1980s cartoon,
The Centurions. It is a tad jingoistic but the three protagonists (Ace McCloud, Jake
Rockwell and Max Ray) wear specialized suits with fixing points which allows an Dr. Bonnie Barstow type geek girl to teleport vehicles and weapons from a Thunderbird 5 type orbital platform. The hand drawn animation for the transformation sequences are amazing with heavy emphasis on a white-than-white bloom effect. I'm a fan of short form audio/visual and this includes demoscene productions (which often include bloom and lens flare), transformation sequences and James Bond title sequences which I'll watch maybe hundreds of times. You guys may be aiming to play Bad Apple. I'm aiming to play films or at least film trailers.
When I was wandering through an airport for a business trip, some kids were absolutely riveted by a very vivid and colorful cartoon. I made a mental note to investigate when I had time. That cartoon was Totally Spies and it is mix of Charlie's Angels, Scooby Doo, The X-Files, James Bond and Get Smart set in a Malibu high school, drawn by Quebeckers, in a Japanese style. Of particular note, the characters wear suits very much like the Centurions. However, to the best of my knowledge, none of the suit features are ever used. This is hugely disappointing!
Since going to the Sheepopolis Toy Exhibition (partly due to
randallmeyer2000's 6502-opoly), I have been investigating similar references and I was initially quite pleased to discover Miraculous which is a mix of Totally Spies, Reboot: Guardian Code and The Tick. It is visually stunning and evokes Paris on a sunny day. The story-boarded fight choreography greatly benefits from motion capture. However, it is "over egged", too fast paced and has no sense of peril. Out of costume, Cat Noir has the eyes of a dead fish. After watching six episodes, I was only inclined to re-watch Season 1, Episode 9: The Dark Owl. This is a Dark Knight parody which features a
JARVIS type computer called
ALBERT. As someone who worked on motion capture for The Dark Knight, I strongly approve of this parody.
So, onto the next reference from the toy exhibition: Winx Club. This isn't too distant from Eoin Colfer's Artemis Fowl books where multiple species use a combination of magic and technology. Early Winx Club animation is an amusingly cheap combination of hand drawn animation, 3D rendering and video effects. There are also numerous pop culture references. However, like some of the best science fiction, the story has a series arc, a season arc and episode arc in addition to character arcs. It also follows the universal themes of listening to your elders, looking fabulous, using your privilege bit responsibly and resolving conflict with tele-kinetic fire-balls. This makes it surprisingly engrossing and I've watched three films and 64 of the 208 episodes. From this, I've found something quite curious about the fictional technology. The series started in 2003 and some of the junior animators have incorporated cool stuff from their own past. This makes an odd pocket of 1990s
retro-futurism/
hauntology where a fictional continuation of quinkey keypads and chintzy Nokia phones is mixed with the obligatory holographic displays. This is mixed with
84 minutes of transformation sequences and
*hundreds* of upbeat tunes where the
early ones typically sound like Belinda Carlisle and the
latter ones typically sound like Republica who were popular in the, er, 1990s.
I'm now using animation sequences as a short-hand for how a 6502 system should work. I've often had difficulty expressing myself and, in technical matters, I may take longer to describe an idea than implement it. At the risk of raising expectations too high, I now give a quick explanation using stills or a montage of video clips. The final implementation may differ wildly. Indeed, this might be preferable to avoid being sued.
Initially, my plan was a processor accelerator which could be placed into Apple, Atari, Commodore or Acorn hardware and the accelerator would have a pre-boot sequence before the native host's initialization which would include a check of its extended memory. Rather than the half-finished look of x86 memory check, Wildbow's serialized fiction gives hints of super-villian GUIs which are slightly different to familiar systems. This gave me the idea to have bar graph memory checks. The
title sequence for Neon Genesis Evangelion has something similar. This is easily implemented with PETSCII or similar.
In a stand-alone system, a bar graph memory check is only one stage of a larger process. Therefore, I've been looking for further inspiration. Sometimes, that inspiration aids the 6502 Forum. I've already been [url="http://forum.6502.org/viewtopic.php?f=4&t=6822"]styling enclosures with stripes[/url]. It is worrying that I was able to match the default striped t-shirt of Ladybug's
Adrien Agreste without buying more imitation Lego.
A comment by BigEd contributed to the
keyboard/mouse extension of SNES joypad protocol and the uni-directional flow of data required a bezel for caps-lock and similar. I thought that 8mm pitch, 2*2 stud hole was sufficient. Assuming 5mm LEDs, this is sufficient for 3*3 grid of LEDs. Switching to digital LEDs, such as WS2812, as implemented by plasmo on 65816 and AndersNielsen on 6502, I assumed that the top left LED would be power, the next LED would be caps lock and the remaining seven would be user defined. After watching
Ladybug's typical transformation sequence, power should definitely be in the middle and a dice/domino pattern is highly desirable.
For systems with audio and video, anyone who has seen
The Bionic Woman or
Automan may appreciate the
glowing phosphorous grid and sparkles in Techna's first solo transformation. The solidifying effect is very simple and found in some Commodore 64 demos. Indeed, you might be thinking LDA abs,X // OR #$80 // STA abs,X on a monochrome bitmap display or a similar text mode font effect. This consideration overlaps with power-up testing in Commodore Amiga hardware where the display changes from black to dark gray to light gray to white as testing progresses - or switches to green, red or suchlike if a peripheral chip fails. (This is directly applicable to anyone making video output with four shades of gray.) As tests progress, the optional 3*3 WS2812 matrix and optional text display can be co-ordinated with a series of increasing tones from the optional audio output. When the display is solid white, a non-destructive marching bit test outputs a bar graph to display.
And then what?
After thinking about a
particularly glittery transformation of Musa (not to be confused with
MUSA), I wondered if anyone has made a window manager with glitter sparkle trails. When I'm finished, the answer will definitely be yes and I almost fell over laughing at the idea. My first idea for a window manager was to follow the default red of
vtwm. In a dream where I used my own GUI on a touch sensitive e-ink display, I found that burnt orange is a good default for window borders. I am now considering a window manager which is
offensively cute and defaults to hot pink. Or maybe purple. Remember that Jack Tramiel's son wanted playing card suits in PETSCII and therefore anything which faithfully supports PETSCII will display hearts. With minimal constraint on clock cycles to implement trail effects, I'm quite certain that it is possible to create pointless, annoying sparkle effects with sequences of symbols, such as @O*+o-. and maybe a few PETSCII symbols. It will be possible to switch off this effect but if I'm writing it, you can be dang sure about the default setting. Or maybe not because corrupted settings would be more annoying than the return of Clippy. Anyhow, this is currently filed as the
Sailor Bubba Window Manager.
These fun but ridiculous considerations lead me to consider a
memory map for applications. By default, each application gets its own 65816 bank with a maximum of 48KB RAM. Bulk data, such as display and storage buffers, are placed within an application's bank whereas meta-data is held outside of the application's bank. This arrangement provides a modicum of integrity because an NMOS or CMOS 6502 binary should only scribble over buffers within one bank. This leaves file system, network and windowing unaffected. 65816 bank zero is also used to maintain state for the sparkly effects.
Code:
$0000-$00FF: Zero page. Unused on 65816.
$0100-$01FF: Stack. Unused on 65816.
$0200-$03FF: Might be required for Commodore ABI compatibility. Otherwise may be unused.
$0400-$0FFF: Three 40*25 text planes for display. Configurations vary. May be re-allocated for storage or network buffers.
$1000-$1FFF: Storage or network buffers. 4*1KB blocks sufficient for Forth. Smaller allocations may work as a stochastic cache.
$2000-$BFFF: Portable binary and data.
(See
stochastic cache and
portable binary.)
This is an unusual 6502 memory map because the bottom 1KB may be completely empty. However, care must be taken. Under different operating modes, allocation and re-allocation within the bottom 8KB may become tortuous or contradictory.
The 3KB for display may operate in different modes which may include 40*25 traditional PETSCII, Latin1 or Roman/Greek/Cyrillic with or without accents. Where symbol representation is 8 bit, the other two planes may be RRGGBBII foreground/background. Whereas, 16 bit symbols only allow foreground to be specified uniquely. This is sufficient to implement a serious text editor similar to LocoScript. The 65816 executive may copy and translate symbols to occluded windows on the display; possibly with one cell border RRGGBBII drop shadow via configurable LUT. (This is a variation of
Bill Atkinson's window regions.) In the trivial case, RRGGBBII is decremented to make a shadow effect.
Within the
8KB I/O range ($C000-$DFFF), I have derived a tentative solution for high speed I/O after studying
Radical Brad's 20MHz, 32 I/O strobe implementation. There is a widespread technique to use multiple 65xx peripheral chips in a configuration where they all share one common active low chip select while active high chip selects are tied to different address lines. See
Address decoding (Garth's primer) for recent explanation with diagrams. This type of arrangement leads to asymmetric I/O ranges which decrease in size. It is quite profligate with address-space and invites opportunity for bus contention. However, it is blazingly fast and requires minimal hardware. In particular, one chip, 2ns address decode is possible. Radical Brad applies the same technique to 74x138 chips with their active high and active low chip selects. This has the typical advantages and dis-advantages but allows practical designs with generous I/O to exceed 20MHz. If contiguous memory is unimportant, this arrangement is also compatible with the 74x157 hack to obtain fast 20 bit or 24 bit addressing.
So far, XR2600 Series designs have been a tussle between speed, size and stability where everything lost. They have either:
- Failed to allocate 48KB for RAM.
- Failed to allow multiple SNES peripheral input chains.
- Failed to allow multiple 65xx peripheral chips.
- Failed to allow 6522 to count accurately.
- Failed to implement one fast tier of address decode.
- Failed to apply read/write qualification correctly to raw address strobes. Actually, I only found that error after adapting Radical Brad's ideas.
In XR2601, concern for speed and simplicity clipped the RAM by 8KB to add one shift register without read qualification. In XR2602, concern for flexibility omitted I/O from clock stretching and omitted strobes from qualification. The quickest fix for latch qualification breaks 65xx peripheral support while the quickest fix for I/O fan-out breaks accurate 6522 timing.
After some pre-amble and 1.5 days seriously considering the problem, I found that parallel I/O decode, using 74x138, within the range $C000-$DFFF, must meet simple conditions:
- Leading bits of the address must be 110.
- Two bits must be zero.
- One bit must be one. This is quite trivial, given the leading bits.
With two zeros in every address range, it is possible to divide an I/O range into half-of-a-half-of-a-half in the following form:
Code:
1100............: $C000-$CFFF: 4KB range.
11010...........: $D000-$D7FF: 2KB range.
110110..........: $D800-$DBFF: 1KB range.
1101110.........: $DC00-$DDFF: 512 byte range.
11011110........: $DE00-$DEFF: 256 byte range.
This arrangement has W65C265 compatibility because it approaches the internal I/O in page $DF but doesn't reach it. It can also be adapted to the simpler case of I/O starting from $8000 by dropping one leading bit. Unfortunately, for some ranges, the number of significant address lines exceeds the inputs of 74x138. Fortunately, they can be hollowed out such that the *last* address-space echo does not incur bus contention:
Code:
1100............: $C000-$CFFF: 4KB range.
11010...........: $D000-$D7FF: 2KB range.
110110..........: $D800-$DBFF: 1KB range.
1101x10.........: $DC00-$DDFF: 512 byte range.
1101xx10........: $DE00-$DEFF: 256 byte range.
With minor modification and future proofing, it is possible to define the I/O range such that each 74x138 provides one, two or four strobes but never eight (like
Radical Brad's design) because each range uses one top-level address decoder running in parallel and there aren't enough inputs free:
Code:
1100ss..........: $C000-$CFFF: 4KB for optional VAN [Video, Audio, Network].
11010s..........: $D000-$D7FF: 2KB unused.
110110..........: $D800-$DBFF: 1KB unused.
1101110.........: $DC00-$DDFF: Optional privilege strobes, shift registers and video registers. This range may be qualified and clock stretched.
11011110........: $DE00-$DEFF: One primary privileged 6522 and four unprivileged 6522s or six unprivileged 6551s.
11011111........: $DF00-$DFFF: Reserved for W65C265 compatibility.
And the oft neglected clock stretch map:
Code:
$0000-$DBFF: No change.
$DC00-$DDFF: +1 clock stretch for large fan-out of address strobes.
$DE00-$DFFF: No change.
$E000-$FFFF: +2/+4 clock stretch for slow ROM.
With sparse address decoding, 16*16 pixel text mode and bank switching into one display line, bus contention will occur when attempting 4K video and erroneous clock stretching will occur when attempting 16K video. This is not a concern for a system which displays 1920*1080 or less. However, software written for this system should work on larger systems.
Although this memory map is primarily designed for implementation with discrete 74x138, several other options are available with differing limitations:
- FPGA with 4 input LUT requires +1 clock stretch across $D000-$DFFF. This affects 6522 timer accuracy. However, if you implement with FPGA, you may not require any 6522.
- FPGA with 5 input LUT works best if I/O spans $8000-$BFFF rather than $C000-$DFFF. Alternatively, Omit A12 from address decode.
- Discrete implementation requires +1 clock stretch for 24 strobe fan-out.
- CPLD with 6 input macro-cell is compatible with discrete implementation but may be slower and consume more energy.
Anyhow, the general principle is that it is possible to run numerous 74x138 in parallel. One decoder provides strobes for six RAM chips, one ROM and provides clock stretching signal for slow ROM. The remainder are sensitive to decreasing spans of the I/O segment. This is achieved in an upwardly compatible manner which superficially appears to defy the six input limit of 74x138. With restrictions, the same memory map is compatible across CPLD and FPGA.
After staring at boards intermittently for almost five months, I will further stare at boards. Ultimately, I think that I'll have to redo about 20% of the layout. That might take about 10 hours.
Edit 1: Moved primary 6522 out of page $DF.