top | item 23733315

(no title)

photokandy | 5 years ago

Author here & wow! Didn't expect to see this get posted anywhere, but happy to see that there are people as interested in this stuff as I am.

If you do play with Retroputer at all, it is still very much WIP -- so lots of things aren't implemented (or don't work). It's proven a fun project to reacquaint myself with lower-level concepts after having been in very high level languages for several years.

One thing I really loved about the computers like the C64 I grew up on: it was possible to hold the entire workings of the machine in your head. While things often appeared magical at first glance, it wasn't that hard to figure out how and why they worked, and then to use that to your advantage. I don't _know_ if that's a benefit when writing high level code today, but I like to think that having that low-level understanding is useful.

It's also proven useful as a project to learn _new_ things. I'm figuring out some back-end coding, Twitter bots, and at some point would love to make this thing in hardware with an fpga. One of these days... ;-)

discuss

order

wizzwizz4|5 years ago

I think you could make your lowercase loop shorter – and definitely faster – by jumping into a second loop when inside a string, instead of setting a flag.

photokandy|5 years ago

You’re right! I’ll do that. :-)

I haven’t done a lot of optimization yet-probably lots of things like this. :-)

tjalfi|5 years ago

This is a neat project, thanks for writing it up.

Does the Retroputer instruction set have an equivalent to the x86 ja instruction?

If so, here is a trick[0] that can be used for optimizing character class checks.

low <= x <= high is equivalent to x - low u<= high - low

[0] Chapter 4 - Arithmetic Bounds of Hacker's Delight by Henry Warren

photokandy|5 years ago

Oooh -- good idea. I don't think I have an instruction that quite matches. Retroputer's branch instructions are directly tied to the flags, so you can do `br !c(arry)`, but that doesn't rule out zero like `ja` does. At a quick glance I don't think that should rule something like this out, though. :-)

That looks like a really interesting book -- I think I shall add it to my reading list!