User talk:Daniel K.

From Rosetta Code

How simple and straightforward do you think a 6802 interpreter could be? It's been something I've been thinking about along the lines of RCBF and RCSNUSP. The 6802 is the simplest microcontroller I know anything about. (Though I'll admit I don't know anything at all about the Z80, apart from that it was what powered my old calculator.) --Michael Mol 02:43, 6 October 2009 (UTC)

It depends from the kind of interpreter you want to write. The simplest way is to write a general routine that reads the instruction, does search for it in a jump table, gets the instruction's routine address, and jumps to it, providing the offset for the parameters string. This is good for command line processing and simple batch files, but it does lack too much features for an "usual" programming language. For an esoteric programming language (although I admit that I don't know anything at all about an esoteric programming language...) it could be enough. --User:Daniel K. 19:14, 6 October 2009 (CET)
You definitely don't want to write a Z80 interpreter; it had a lot of complicated addressing modes and many many instructions. (I started on a Z80 system and I can remember being rather daunted by it all.) Something more RISC in nature is probably better. —Donal Fellows 17:26, 6 October 2009 (UTC)
The Z80 isn't so difficult as you say: it is a lot like the 8080, but with better mnemonics and extra instructions and registers. The Z80 was the first processor that broke with the old mnemonic naming conventions, that employed compressed three letters mnemonics (6502: LDA #$4B stays for LoaD in A immediate number $4B, LDX #$4B for LoaD in X immediate value $4B, TAX is Transfer A to X, PSH A is to PuSH A, PLL X is to PuLL to X, POP in later assemblers) with less crunched mnemonics, and with the mnemonic separated from the name of the register that does work on (similar opcodes for Z80: LD A,$4B; LD B,$4B; LD B,A; PUSH; POP). There are difficult instructions also (like the ones regarding the second register set), but the Z80 is fully programmable even without using index registers and complicated addressing modes. Someone says that the 6502 is the first RISC processor; I don't agree, but it's true that the 6502 handling of the zero page (memory from $0000 to $00FF) it is very similar to the one of a RISC processor, and the number of 6502 instructions is very small. --User:Daniel K. 19:52, 6 October 2009 (CET)