One-opcode cpu using 6502 assembly

Programming the 6502 microprocessor and its relatives in assembly and other languages.
kakemoms
Posts: 349
Joined: 02 Mar 2016

Re: One-opcode cpu using 6502 assembly

Post by kakemoms »

BigEd wrote:
You're welcome. Just one thing... I didn't give a link! Do please share what you found...
Oh I found it in the biggest book there is: https://en.wikipedia.org/wiki/Transport ... chitecture
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: One-opcode cpu using 6502 assembly

Post by BigEd »

oh!
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: One-opcode cpu using 6502 assembly

Post by GARTHWILSON »

Re-arranging it a bit (I'm not sure if it'll help, but I do this sometimes to understand it better myself):

Code: Select all

     LDY  #0
     BEGIN
        LDX  $program,Y
        INY
        LDA  $program,Y
        IF_ZERO
           CPX  #0                 ; If second byte is zero:  (This was label zero2.)
           IF_EQ
              LDA  0               ; Both bytes were zero.   (This was label zero3.)
              IF_NOT_ZERO
                 INY
                 LDA  $program,Y   ; Y is PC so modify that.
                 TAY               ; For simplicity, I limited it to 256 bytes of code.
              END_IF
           ELSE_
              LDA  (0,X)
              INY
              ADC  $program,Y
              INY
              SBC  $program,Y
              CMP  (0,X)
              IF_EQ
                 LDA  $program,Y   ; Store value if both ADD and SUB are zero.
              END_IF
              STA  (0,X)
              INY
           END_IF
        ELSE_
           CPX  #0
           IF_EQ
              TAX                  ; If first byte is zero:  (This was label zero1.)
              INY
              LDA  $program,Y
              STA  (0,X)           ; Save LSB into register.
              INY
              INX
              LDA  $program,Y
              STA  (0,X)           ; Save MSB into register.
              INY
           ELSE_
              STA   0              ; Save second register.
              LDA  (0,X)           ; Move data from address in first register.
              LDX   0
              STA  (0,X)           ; Move data to address in second register.
              INY
           END_IF
        END_IF
     AGAIN


program:  data $01, $02, $03, $04, and so on....
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
IamRob
Posts: 357
Joined: 26 Apr 2020

Re: One-opcode cpu using 6502 assembly

Post by IamRob »

Ugh! NAI (Not Another Interpreter)

But for discussions sake, I'll bite.
The similarities look a lot like what SWEET16 was trying to achieve.

For this to work, it looks like you need a dedicated register. If registers were so easy to do, 8-bit computers would have way more of them.

My biggest question would be, how does the one-opcode know what kind of data it is working on? 8, 16, 24, 32, 64 - bit data? That's a lot of different opcodes, just to figger out the data size let alone what to do with the data.
Post Reply