Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Languages Misc > Re: TitsandAsm ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 1078 of 1154
Post > Topic >>

Re: TitsandAsm [CPU emulator]

by "Rod Pemberton" <do_not_have@[EMAIL PROTECTED] > Dec 1, 2007 at 12:30 PM

<robertwessel2@[EMAIL PROTECTED]
> wrote in message
news:333531d8-76d8-417b-a601-7d6ba5196d4a@[EMAIL PROTECTED]
> On Nov 30, 11:45 pm, Evenbit <nbaker2...@[EMAIL PROTECTED]
> wrote:
>> [snip, topic: "Okay, here is my 'rough draft' of the instruction layout
for a CPU emulator that builds on the basic premise of the Simple Machine
Language (SML) interpreter"]
>
> You seem to be implying a 24 bit address space in the ISA, yet your
> sample code appeared lo load 0xffffffff into SP.  For a student
> machine, you may want to just limit this to 24 bits.

16 bits is fine.  Look at FORTH's compactness.  Non-threaded code and
stackframes of compiled languages are the memory hogs...

> Also, I assume
> this is a 32 bit ISA?  You're obviously implying a word addressed
> machine, which is fine, but it's probably a much better idea to leave
> the addresses shifted by the appropriate amount to allow the straight
> forward creation of byte granularity pointers (IOW, consecutive memory
> words should be 0, 4, 8, 12..., not 0, 1, 2, 3 - there are good
> reasons the later went out of style a long time ago).

I agree.  It can be difficult to do strings, arrays, or implement C
without
byte granularity.

> And finally,
> you desperately need an indexed or indirect addressing mode - oddly
> you've got that for the branches - or you can't even program basic
> string functions without self modifying code.  Not to mention a few
> more ALU instructions.
>

I agree.  It's pretty hard to create a stackframe without such an
addressing
mode.

> But why not go for a more load/store architecture.  If you want
> simplicity for the student, that has a lot of advantages.  How about:
>

I agree.  Although, the linked SML page seems to have a pretty good
reduced
or modified 6502 like instruction set.  You could start by looking at
reducing the 6502 or Z80's instruction set.  I reduced the 6502's down to
13
on paper.  Working, but slow versions, of interpreted FORTH can be
implemented in 9 "primitives."  And, a basic LISP interpreter can be done
in
8.  C, for the most part, can be reduced to about 16 actions and 20
arithmetic operations, more if you need mixed sizes 8,16,32...  You could
also look at the Brainfuck language.


Rod Pemberton




 1 Posts in Topic:
Re: TitsandAsm [CPU emulator]
"Rod Pemberton"  2007-12-01 12:30:01 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu May 15 1:01:03 CDT 2008.