[HN Gopher] Motorola 6800
       ___________________________________________________________________
        
       Motorola 6800
        
       Author : PaulHoule
       Score  : 81 points
       Date   : 2022-06-24 15:39 UTC (7 hours ago)
        
 (HTM) web link (en.wikipedia.org)
 (TXT) w3m dump (en.wikipedia.org)
        
       | jhallenworld wrote:
       | This was my first microprocessor: I developed assembly language
       | for it and the 6809 using Motorola's Exorciser development system
       | (which was already old in the mid 80s when I used it). Here is a
       | simulator I wrote for it, in case you want to try it in Linux or
       | Cygwin:
       | 
       | https://github.com/jhallen/exorsim
       | 
       | 8 inch floppies! I remember we had an old GE chain-train printer
       | for it which was awesome because it was so fast.
        
       | aliswe wrote:
       | Serious question, why is this on Hacker News? is it a classic of
       | some sort?
        
         | Tor3 wrote:
         | The 6800 definitely is a classic, yes. The classics included at
         | least 6800, 6502, 8080, and Z80. (To some extent 8085, but as
         | an "expanded" 8080 the Z80 dominated.) The four of them powered
         | the most iconic systems at the start of the microprocessor
         | "takeover" at the end of the seventies (at the same time as I
         | entered my electronics education). The 6800 was kind of left
         | behind by the others eventually, but was used in e.g. the SWTPC
         | 6800, and also in a _lot_ of minicomputer (e.g. DEC)
         | peripherals at the time (including variants like the 6802 with
         | a little on-board RAM)
        
           | AnimalMuppet wrote:
           | Was the 8085 ever used much as a microcomputer CPU? I've seen
           | it as an embedded CPU, but I don't recall it getting much run
           | as a general-purpose CPU.
        
       | FullyFunctional wrote:
       | With the optics of _compiled_ code, how do the various 8-bitters
       | stack up? (6809/6811, 65C02, Z80, H8, ...)? One would have to
       | account for the frequency allowed by the ISA at iso-technologies
       | (which makes including AVR somewhat tricky).
       | 
       | I only have experience with Z80 and 65C02 and I believe the
       | consensus is that a 4 MHz Z80 beats a 2 MHz 65C02, but neither is
       | a particularly nice compiler target.
        
         | klodolph wrote:
         | Just for modern perspective... you can use SDCC. It's an open-
         | source optimizing C compiler targeting small microprocessors
         | like the Z80 and various others. The project itself is terribly
         | run--the maintainers recently pushed out an ABI change which
         | broke everyone's code, but released it as a minor version bump.
         | This ABI change did speed up the code, but that's small
         | consolation to anyone who ended up with broken code.
         | 
         | IMO the Z80 is a lot nicer compiler target than the 6502,
         | because the stack pointer is 16-bit and it's much easier to use
         | the stack in general.
         | 
         | There are a couple C compilers for 6502 (like cc65 and WDC's C
         | compiler) but they're not quite as good as SDCC, as far as I
         | can tell. They're also not as actively maintained.
        
         | self wrote:
         | Some of that can be gleaned from this benchmark, published in
         | Byte, in 1981: https://en.wikipedia.org/wiki/Byte_Sieve
         | 
         | Results for a few 8/16 bit processors are here (and on
         | subsequent pages): https://archive.org/details/byte-
         | magazine-1981-09/page/n193/...
        
           | mysterymath wrote:
           | I ran the C version of this benchmark using llvm-mos's Clang
           | for the 6502. The results:
           | 
           | 21.4 seconds 5793 bytes
           | 
           | Which is middle of thepack for the Z80 benchmarks, but well
           | below the 6502 ones. We're also using a slightly tweaked
           | embedded printf written in C, so this could probably be
           | improved somewhat there, sans any compiler changes.
        
           | FullyFunctional wrote:
           | Very cool. While obviously not ideal, the results are
           | probably accurate within a small factor. Unfortunately
           | there's no assembly version for 65C02 but Z80 does
           | surprisingly well in this test.
           | 
           | I muse what could be done with modern cross-compiler (SAT
           | solving for optional code sequences?) A llvm backend for Z80
           | has recently kicked back into gear:
           | https://github.com/jacobly0/llvm-project
        
         | Gordonjcp wrote:
         | The 6809 is ridiculously suitable for running Forth, because
         | you've got two stacks, a 16-bit accumulator, and you can
         | implement NEXT in two instructions taking about three clocks
         | each.
        
           | cmrdporcupine wrote:
           | Someone needs to write a WASM VM for it.
        
         | cmrdporcupine wrote:
         | I just don't think any of the 8-bits made good compiler
         | targets. At least not C compilers. Not enough registers, even
         | in the 6809.
        
           | hashmash wrote:
           | In theory, a smart compiler could make heavy use of the DP
           | register (6809 feature) and then local variables within a
           | compiled function could access these "fast" global variables
           | instead. This was a common pattern when coding in assembly,
           | and it's much faster than accessing variables off the stack.
           | The function wouldn't be reentrant, but a compiler pragma
           | could be used to enable/disable the DP mode. Declaring the
           | local variables as static should be sufficient, however.
        
             | jhallenworld wrote:
             | I wrote a multi-tasking OS for the 6809 and used the DP to
             | hold the current task ID: task local variables would be in
             | the direct page.
        
             | cmrdporcupine wrote:
             | The WDC C compiler for the 65816 takes advantage of this
             | (relocatable direct page). And the relocatable stack. In
             | fact I believe what it does is relocate the stack to at
             | least partially overlap the direct page.
             | 
             | It's still an awkward target though.
        
           | PaulHoule wrote:
           | When you've got hardly any registers you don't have any
           | choices how to allocate them. What's maddening is a chip like
           | the 8086 where you have enough registers that how you
           | allocate them matters, but still very little space to work
           | in. You are left working hard on a register allocator that is
           | still not going to be very food.
        
           | rahen wrote:
           | These processors were designed for assembly programming,
           | hence their very CISC-y ISA. Some 8-bitters designed for
           | compiled languages would be the AVR family.
        
         | crest wrote:
         | The 6809 had two 16 bit index registers, PC-relative
         | addressing, and upper half of the stack and data page address
         | was taken from special purpose registers instead of hardwired.
         | It should be a fairly straight forward compiler target. On the
         | other hand it was late to the game, expensive and not (much)
         | faster than 8bit microprocessors. The 6502 very cheap, fast
         | enough when it came out, but a really annoying compiler target.
        
           | PaulHoule wrote:
           | I had a TRS-80 Color Computer when I was kid which had one
           | major drawback: it could only display 32 characters across
           | the screen compared to 40 characters for the Apple ][, C64
           | and most others at the time.
           | 
           | The Coco could run an operating system called OS-9 which was
           | Unix-influenced and came with a good C compiler and also a
           | bytecode interpreted structure basic called BASIC09.
           | 
           | I know C compilers were really popular among CP/M users
           | running the Z-80 and 8080 chips and also on the IBM PC which
           | had a segmentation system to reach beyond 64k that I thought
           | felt really elegant in assembly language but was awkward for
           | compilers.
           | 
           | Where OS-9 had all the above beat was that it was a real
           | multitasking OS and I had two terminals plugged into my coco
           | in addition to the TV console and could use it like a
           | minicomputer.
           | 
           | When I switched to an IBM PC AT compatible my favorite
           | programming language was Turbo Pascal which adds everything
           | missing from Pascal to do systems programming. I switched to
           | C when I went to college because that was supported on the
           | the various UNIX workstations they had.
        
             | jhallenworld wrote:
             | The 6809 was nice, but I think the CoCo otherwise was crap.
             | Aside from the 32 column display and awful color scheme,
             | the built-in serial port was bit-banged. This meant that
             | floppy drive and serial access could not happen at the same
             | time. This is very relevant when trying to use OS-9.
             | 
             | There was an external serial port as an option, but there
             | was only one slot. So you also had to buy a slot expander
             | (a Multi-Pak).
        
               | PaulHoule wrote:
               | I had the multi pak and the external uart. The entry
               | level price of the coco was low but I think I got most of
               | the peripherals available for it, particularly the disks
               | were crazy expensive. Adding it all up I must have spent
               | more than I spent on the AT clone that replaced it
               | ($1200)
               | 
               | In most ways the C-64 was a great machine but boy was the
               | disk drive slow.
        
               | jhallenworld wrote:
               | Perfect system == 6809 + SIO from the Atari800 + C64 SID
               | + IBM PC keyboard + C64 VIC or maybe V9938.
        
         | [deleted]
        
       | bitgif wrote:
        
       | klelatti wrote:
       | Worth mentioning the 6501 which was launched by MOS Technology
       | alongside the 6502 and was pin-compatible with the 6800.
       | 
       | Motorola sued alleging patent infringement and misappropriation
       | of trade secrets.
       | 
       | MOS Technology settled, paid Motorola $200,000 and dropped the
       | 6501.
        
         | dylan604 wrote:
         | $200k sounds like such a small number, but it was the dropping
         | of the offending chip that was the gotcha.
        
           | kjs3 wrote:
           | Well...200k in 1975 $'s. And MOS was a startup, basically. So
           | not a trivial amount. But yeah, a big part of the initial
           | pitch was "you can use your same hardware design but replace
           | the $300 CPU with our $25 CPU".
        
             | mark-r wrote:
             | I knew a guy who tried to build a multi processor system
             | with 16 6800s. Made a mistake with the power supply and
             | ended up frying all of them.
        
       | engineer_22 wrote:
       | I just finished an undergraduate class on microcontroller
       | applications that used a MC68HC12 dev board. We coded in Assembly
       | and then later in C.
       | 
       | I'm curious, is this a typical platform in other computer
       | engineering programs in the US?
        
         | PAPPPmAc wrote:
         | The university I'm attached to used 68HC11-family dev boards
         | for their intro embedded course until the early/mid 2010s, with
         | a smattering of other platforms like 8051 derivatives in
         | advanced classes, and have switched to ARM (Small Cortex M
         | ARMs, typically TI TM4C123 TivaC boards) for almost all our
         | embedded content since. Plus a few little Arduino based
         | activities with the freshmen, though the form of that has
         | changed over the years.
         | 
         | The intro to embedded systems course used to be only taken by
         | Computer Engineers around their Junior year, since ~2017 we do
         | it a semester or so earlier and make the EEs take it too as
         | part of a streamline; EEs no longer take the computer
         | architecture course, and the new embedded course covers some
         | basic architecture concepts.
         | 
         | We still do the beginning of the semester in Assembly (we
         | really only show them ARM Thumb) and the later part in C.
         | 
         | Possibly the most revelatory thing about that course is that
         | the low-level view means we find out and try to correct that
         | most of our students (as second semester sophomores who have in
         | theory passed at least two programming courses and a digital
         | logic course) haven't the slightest idea what code actually
         | means/does.
         | 
         | Example: Every semester I've been involved, when we transition
         | from assembly to C, we give a simple assignment to sort some
         | arrays of (well documented) structs by a specified field and
         | order, given the address where first element starts and length
         | in elements, in both C and assembly. They are handed a starter
         | project with a lightly-obfuscated object file that sets up the
         | arrays, calls two provided function headers for them to fill
         | in, then tests if the sorts succeeded. Details get changed
         | every semester because students cheat compulsively on
         | programming assignments, but it's always set up to be easy, the
         | structs they handle in ASM are always 16 or 32b in length,
         | stored aligned, etc.
         | 
         | Many of them... struggle mightily for two weeks because they
         | haven't actually retained anything about number representation,
         | memory (size, layout, byte addressing), arguments, the
         | difference between a value and a pointer, and so on. The course
         | staff spend weeks doing patient remediation around that point
         | in the semester. At least we get a chance to make another pass
         | over that material and more of them get it after.
        
         | shimonabi wrote:
         | At our company we still use a MC68HC11 for an industrial
         | device.
        
           | exmadscientist wrote:
           | Be careful -- they're rapidly going obsolete. No one wants to
           | fab old EPROM processes, and no one wants to package PLCCs
           | anymore. If it's neither of those, I think you've got a bit
           | more time.
           | 
           | There are "compatibles" out there, and some of them are very
           | good indeed, but they're not without their hassles.
        
             | mark-r wrote:
             | I think I have a 68HC11 sitting around that I picked up for
             | a project and never used. I wonder if it's worth anything?
        
         | [deleted]
        
         | mtnygard wrote:
         | I had a similar course using the 68HC11... but that was in 1991
         | or '92. I am (pleasantly) surprised to hear that this kind of
         | class is still running. Haven't done embedded for a long time,
         | so I don't know if the 68HC12 is current or not.
         | 
         | Wouldn't worry thouhg. Even if that chip is not in wide use
         | now, the skills you learned are transferrable to any other.
        
       | awful wrote:
       | The Heathkit/Zenith ET-3400 trainers with 6800s, and the
       | accompanying Heath/Zenith coursework, were fantastic in 1982. 50+
       | of us completed it that year, the class final was bit-banging the
       | tune of "Anchors Away" as the instructor was a Navy officer and
       | educator, retired to civilian teaching. I later learned machine
       | language on broken superscalar mainframes as bit-chaser, but the
       | 6800 were simply fantastic devices and prepared me well. Flat,
       | shared memory, von Neumann architecture. Very nice op codes and
       | indexing, as I recall. Ill have to go back to my coursework and
       | reminisce...
        
         | Salgat wrote:
         | I learned assembly on a 68HC11 heathkit, damn those things were
         | awesome!
        
         | B1FF_PSUVM wrote:
         | > Flat, shared memory [...] nice op codes and indexing, as I
         | recall.
         | 
         | Yeah, that was what the guy working with the Moto chips smirked
         | at us slaving on Intel 808x contraptions, back in those days
         | ...
        
       | ChrisMarshallNY wrote:
       | This was the first microprocessor I programmed.
       | 
       | My kit was for the school I was in. It was an STD Bus-based card,
       | nailed onto a piece of wood, with a hex keypad/display.
       | 
       | The card had 256 whole bytes of RAM.
       | 
       | We programmed it in machine code.
        
       | dymk wrote:
       | I built a small multitasking kernel with a friend with a 68000
       | (m68000) in college. We implemented it on breadboards, I think
       | with 30 or so feet of jumpers [0]. I had very little prior
       | embedded experience, so it was trial by fire.
       | 
       | It was a wonderful introduction to how kernels work (or at least
       | concurrency and scheduling) at their most basic level, without
       | having to deal with the complexity of virtual address spaces,
       | memory protection, or the byzantine bring-up dance of register
       | prodding that x86_64 needs. It prepared me well for my operating
       | systems class the next year, and as far as I can tell, was the
       | eye-catcher project that got me an internship on a team doing
       | kernel development the following summer.
       | 
       | The instruction set is also a dream. Super CISC-y, yet more
       | enjoyable (and IMO easier to grok) than x86. Take a look:
       | http://wpage.unina.it/rcanonic/didattica/ce1/docs/68000.pdf
       | 
       | My favorite is DBcc - "Test condition, decrement, and branch".
       | All in one instruction.
       | 
       | [0] - https://i.imgur.com/MKD7wTv.jpg
       | 
       | Here's the code - I have no idea how it works anymore, and I
       | believe it's incomplete compared to what I had running. The
       | complete code archive I think is lost to time -
       | https://github.com/dymk/68k/blob/master/projects/libraries/l...
       | 
       | My friend wrote up a much more comprehensive document on the
       | build:
       | 
       | https://github.com/ZigZagJoe/68k
       | 
       | https://docs.google.com/document/d/1ejW_Ist19tIXeA5HtEWixaLo...
        
         | pinewurst wrote:
         | The 6800 is nothing like the 68000.
        
           | dymk wrote:
           | Well, it was the predecessor :)
        
             | mek6800d2 wrote:
             | There was the 6809 in between. I remember BYTE magazine's
             | cover story, "A Microprocessor for the Revolution". Well,
             | not quite, as it turned out! :)
        
               | mark-r wrote:
               | I never got to use the 6800, but did use both the 6809
               | and 68000 in assembler. Both were a joy to work with.
        
               | danachow wrote:
               | The 6809 had some hobbyist/consumer prominence on this
               | side of the pond in the TRS-80 CoCo - and some European
               | similars. And there was a multitasking OS written for it
               | - OS-9.
               | 
               | OS-9 has an interesting history in its own right. It was
               | ported to a wide range of subsequent architectures. All
               | sorts of applications - Fairlight synths, Philips CD-i,
               | most of the traffic lights in the US in the 80s and 90s
               | to name a few.
        
             | djmips wrote:
             | Sort of. I mean they were both made by Motorola and both
             | had then #6800 in them...
        
         | Teknoman117 wrote:
         | I think the x86_64 chips are fairly unique in terms of how
         | hilariously awful the bring-up process is. I'd hate to be a
         | microcode engineer on one of them.
         | 
         | So much state. Then throw virtualization into the mix.
        
         | [deleted]
        
         | systems_glitch wrote:
         | Very cool! Do note that the Wikipedia page is about the 6800
         | (Sixty-Eight Hundred), though, not the 68K. A generation
         | earlier, 8-bit, far less popular in end-user applications than
         | the 68K. Still a good processor.
        
         | Doctor_Fegg wrote:
         | > "Test condition, decrement, and branch". All in one
         | instruction
         | 
         | The Z80 had that too - DJNZ (Decrement and Jump if Not Zero).
         | Standard way of writing loops.
        
           | ataylor284_ wrote:
           | The 8080 lacked this, but even though the 8086 was more or
           | less based on the 8080, this probably inspired the 8086
           | LOOPNZ instruction. Same idea, hardcoded to use the CX
           | register instead of B on the Z80. The unoffical nicknames for
           | the AX, BX, CX, DX were accumulator, base, count, and data.
           | CX was used for the count for all looping and string move
           | instructions. Similarly, BX was special purpose for indirect
           | operations and AX/DX for certain logic and arithmetic
           | instructions.
        
             | bonzini wrote:
             | AX/CX/DX/BX (in machine code this is the order from 000 to
             | 011) were intended as equivalent to AF/BC/DE/HL.
        
           | drfuchs wrote:
           | The IBM 360 had BCT back in 1964. Rumor had it that it was
           | created for Fortran DO statements ("for-loops"), but IBM's
           | compiler never emitted it.
           | 
           | "The BCT instruction subtracts 1 from the value of the
           | contents of the target register specified in the first
           | argument. If the value in the target register after the
           | subtraction is zero, no branch occurs. Otherwise the program
           | branches to the specified address."
        
         | tablespoon wrote:
         | > We implemented it on breadboards, I think with 30 or so feet
         | of jumpers [0]...
         | 
         | > [0] - https://i.imgur.com/MKD7wTv.jpg
         | 
         | Based on your description, I expected to see a picture of 30
         | feet of breadboards filled with jumpers
         | (https://en.wikipedia.org/wiki/Jumper_(computing)), maybe used
         | as ROM or something. Your actual project was unfortunately much
         | less ridiculous.
        
       | musicale wrote:
       | Aha, an 8-bit CPU post that isn't about the 6502 or Z-80!
        
         | le-mark wrote:
         | Where's the 8051 love?
        
       | tibbydudeza wrote:
       | Bill Mensch and Chuck Peddle - familiar names indeed.
        
       | [deleted]
        
       ___________________________________________________________________
       (page generated 2022-06-24 23:00 UTC)