logo       

Re: Progrmaming in Bytecode?: msg#00815

lang.smalltalk.squeak.general

Subject: Re: Progrmaming in Bytecode?

Jon Hylands <jon@xxxxxxx> wrote...

>One of the projects I did a while ago was writing PIC/Smalltalk,
>which basically is a Slang-style translater that translates Smalltalk
>source code into PIC assembler. PIC chips are tiny 8-bit RISC embedded
>micro-controllers (www.microchip.com), with miniscule amounts of
>memory (program memory measured in single-digit kilobytes and RAM
>between 50 and 500 bytes).
>
>If you want to work at a low level with Smalltalk, doing stuff like
>that is fun and useful as well. And of course it works in Squeak,
>although its been a while since I did anything with it.
>
>http://www.huv.com/smalltalk for more details...

This reminded me that, about ten years ago I wrote in a day or two a little
assembler for a simple processor.

Anyway, since I said "a page or two", I thought I should put my money where my
mouth is, so I'm sending along that old code. Unfortunately it's for a
slightly different dialect from Squeak, but most of the code should still work
if you file off the rough edges. There's nothing great about it, but if people
think assemblers are hard, this should help to allay that fear.

One thing to notice (and this may take a little bit of tweaking for Squeak) is
that it the class redirects the message compile:classified:notifying: so that
once you define a subclass of the assembler, you can actually type assembly
code into the browser, and it assembles when you do an 'accept' [in fact you
can mix them -- it assembles any method in a category whose name begins with
'ASM-']. This kind of environmental leverage might not occur to a newbie.

Enjoy
- Dan

Attachment: %Assembler.st.gz
Description: application/applefile

Attachment: Assembler.st.gz
Description: Binary data

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise