Stories
Slash Boxes
Comments

SoylentNews is people

posted by janrinok on Saturday January 07, @06:58PM   Printer-friendly

http://oldvcr.blogspot.com/2023/01/the-mos-6502-is-mostly-turing-complete.html

It is known that the x86 MOV instruction is Turing-complete (PDF) all by itself, and is even a compiler target. More usefully, x86 can be made Turing-complete without the overt use of any registers.

These tricks work primarily because the ISA allows memory-to-memory operations, i.e., altering a memory location without explicitly moving data through a program-visible register, a historical holdover from its roots in the Intel 8086 and its ancestors. (Let's not even talk about its Turing-complete faults.) Other pre-RISC CPUs of that era also have memory-to-memory addressing, including the MOS 6502, which despite its simplicity being inspiration for the RISC ARM architecture is not itself RISC. It should be no surprise you can make the 6502 do this trick too even with its more constrained instruction set, and we can do it with just four instructions, not counting rts to return to the operating system.


Original Submission

This discussion was created by janrinok (52) for logged-in users only, but now has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
(1)
  • (Score: 3, Insightful) by Opportunist on Saturday January 07, @08:17PM (1 child)

    by Opportunist (5545) on Saturday January 07, @08:17PM (#1285720)

    As in, you of course need a flag register and some other tidbits, but you don't need the general purpose ones... which get replaced by memory.

    Can I get a "duh" from the peanut gallery?

    • (Score: 3, Insightful) by theluggage on Monday January 09, @02:20PM

      by theluggage (1797) on Monday January 09, @02:20PM (#1285970)

      Heck, the 6502 doesn't really have any general-purpose registers anyway - A is the accumulator and has a special role in many instructions, while X and Y are essential for the indexed addressing modes. Instead, the 6502 had "zero page" addressing modes that let you treat the first 256 bytes of RAM as pseudo-registers & bases for indirect addressing. TFA probably missed a trick there...

      Oh, and TFA relies on self-modifying code (just like my first attempt at 6502 code when I was trying to learn from a list of opcodes and someone else's lecture notes, and hadn't worked out what X and Y did...)

  • (Score: 4, Insightful) by Mojibake Tengu on Saturday January 07, @08:37PM

    by Mojibake Tengu (8598) on Saturday January 07, @08:37PM (#1285727) Journal

    Minimalist instruction set execution models are instrumental for hiding software in software or fusing code, don't be scared too much when someone unknown advances such idea to practical use!

    --
    The edge of 太玄 cannot be defined, for it is beyond every aspect of design
  • (Score: 3, Interesting) by Tork on Sunday January 08, @02:58AM (1 child)

    by Tork (3914) on Sunday January 08, @02:58AM (#1285772)
    I apologize if this is a very basic question, but what is a register? What is specifically making me ask this question is I read an article about the Atari Jaguar hardware and someone was claiming that if one of its processors had "just one more register!!" it would have (possibly) surpassed the ps1's graphical abilities. Is there something to that... plausible?
    --
    Slashdolt Logic: "25 year old jokes about sharks and lasers are +5, Funny." 💩
    • (Score: 4, Informative) by owl on Sunday January 08, @03:52AM

      by owl (15206) Subscriber Badge on Sunday January 08, @03:52AM (#1285777)

      I apologize if this is a very basic question, but what is a register?

      A tiny bit of addressable memory built into the processor itself. The width of these registers (in bits) is usually what defines a given processor as 8-bit or 16-bit or 32-bit, etc.

      What is specifically making me ask this question is I read an article about the Atari Jaguar hardware and someone was claiming that if one of its processors had "just one more register!!" it would have (possibly) surpassed the ps1's graphical abilities. Is there something to that... plausible?

      Without knowing more about whatever smoke this commenter was trying to blow up your ass, that sounds extremely implausible.

  • (Score: 0) by Anonymous Coward on Sunday January 08, @01:03PM

    by Anonymous Coward on Sunday January 08, @01:03PM (#1285811)

    First computer I had was a 6502-based Acorn Atom. (I wussed out and got ready-built, didn't solder it myself, give me a break, I wasn't yet 10!) Atom Basic. About 10% basic and 90% peek+poke 6502 machine code...

(1)