Usenet comp.os.linux.announce (1993-2013)
 help / color / mirror / Atom feed
* osimpa x86 compembler in Bash
@ 2001-08-30  3:51 Rick Hohensee
  0 siblings, 0 replies; only message in thread
From: Rick Hohensee @ 2001-08-30  3:51 UTC (permalink / raw)


osimpa is an assembler for Intel 80386 processors and subsequent, written
entirely in the GNU Bash command interpreter shell. The predecessor of
osimpa was shasm, as seen on Slashdot. osimpa is much cleaned up, can
create useful Linux ELF executables, and has various HLL-like extensions
derived from Forth and C and some programmer convenience commands.

Osimpa uses it's own names for x86 opcodes, which vary from stuff like "="
instead of "MOV" for terseness for common instructions, to the likes of
loadmachinestatusword for little-used instructions that are best kept
self-explanatory. The syntax of osimpa is also unique, and has some faint
resemblances to Forth, while doing whatever is expedient in the shell.
There is no "lexer"; all tokens are whitespace-delimited. Two-operand
instructions use one of "to", "from" or "with" to delimit and order the
operands. The size of an operand is assumed to be the current cellsize,
or can be explicitly set to byte with the "byte" keyword. Keywords are
also available for the x86 size-change prefixes.

osimpa is about 2 orders of magnitude slower than a regular stand-alone
assembler, or about one order of magnitude slower than a compiler.
Interactivity is extremely high, however. You can change a keyword in
seconds, for example, or you can alias it in your source, since the source
file of a program written in osimpa is a Bash script. You can assemble a
program one instruction at a time if you like. Each opcode has it's own
help, e.g.

.....................................
<prompt>= h

                                        Intel MOV

 catch-all. copy. The most prevalent insn. The only access to special
registers.  The fast mem<->A forms may be A= and =A by the time you read
this.
.....................................

And of course, since osimpa is an assembler, the performance of the
resulting program is usually quite good. This is similar to unix "cat" in
osimpa...
.............................................................

ELF
pull @ $argc
pull @ $programname
-test 1 with @ $argc
        when zero                       help
-test 2 with @ $argc
        when not zero                   per_filename
=   @  SP to B
-test  byte 104 with byte @ B
        when  not zero                  per_filename
-test  byte 0 with byte @ 1 + B
        when zero                       help
L per_filename
        1- @ $argc
                when zero               ciao
        pull B
        zero C
         Linux $open
        flag A
                when sign               problem
        = A to BP
L per_read
                = BP to B
                = $buffer to C
                = 4096 to D
                 Linux $read
                flag A
                        when zero       per_filename
                = 1 to B
                # C is still good from the above
                = A to D
                 Linux $write
jump per_read
L problem
        print  $ouch
                        Linux $exit
L help
        print $helptext
                        Linux $exit
L ciao
        = A to B                        # wierd bug, this is a scab.
        = A to B
                Linux $exit

text ouch <<!
 I (cLIeNUX osimpa get) couldn't open one of the arguments so I quit.
!
text helptext <<!

This program is like unix cat, but with just a help switch ala
        get h
 It quits if it can't read the contents of one of it's arguments.
It also doesn't use stdin. With no arguments at all it just quits.
What the program does do is read all it's args in sequence and write them
(thier contents) to stdout.
!
heap
cell argc
cell programname
L buffer
allot 4096
# in_osimpa/get  Rick Hohensee 2001
.........................................................................

osimpa is headed toward
ftp://ftp.gwdg.de/pub/linux/install/clienux/interim/osimpa.tgz 
 or email me since that server lags a bit as to me putting something up on
it, but that's the one that's supposed be be Slashdot-effect-resistant.


Rick Hohensee						compembler
                www.
                           cLIeNUX
                                          .com
                                                        humbubba@smart.net

##########################################################################
# Send submissions for comp.os.linux.announce to: cola@stump.algebra.com #
# PLEASE remember a short description of the software and the LOCATION.  #
# This group is archived at http://stump.algebra.com/~cola/              #
##########################################################################



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-08-30  3:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-08-30  3:51 osimpa x86 compembler in Bash Rick Hohensee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox