Usenet comp.os.linux.announce (1993-2013)
 help / color / mirror / Atom feed
From: "Rick A. Hohensee" <rickh@Capaccess.org>
Subject: Son of shasm, osimpa
Date: Tue, 11 Dec 2001 13:31:10 CST	[thread overview]
Message-ID: <fc.00858412002257c200858412002257c2.2257de@Capaccess.org> (raw)

osimpa is a macro-assembler or "compembler" written entirely in GNU Bash.
With minor modifications it should also work with pdksh and zsh.  It is a
superset of shasm, which was discussed on Slashdot.  It currently supports
the Intel 80386 real and protected modes. No floats, etc.. The osimpa
script is currently 116k including a lot of per-instruction help prompt
texts. The "compembler" thing is about being as convenient as possible
without creating restrictions to low-level access. osimpa is vaguely
similar to, but still lower-level than, Randy Hyde's High Level Assembler.
This results in some degenerate imitations of high-level language features
that lose some generality but that win huge on bang-per-buck in terms of
implementation complexity.

osimpa emphasizes some of the same things as Forth, but without a Forth
(virtual) 2-stack-machine; a consistant simple syntax (no lexer), terse
but self-explanatory names, ease of extension, systemic simplicity, and
minimal external dependancies. Structured programming, object oriented
programming, functional programming and data typing are not directly
supported. Although not typed in the C sense, data is sized somewhat by a
cell concept. There's a lot of defaulting of things for the common case,
and cells default to 4 bytes. Composites that assemble more than one
instruction are provided for the 386 prefixed looping instructions,
execution arrays, host system calls, reentrant procedures, and a register
dump. Other conveniences resemble Forth ALLOT, C enum, C struct, Forth
VARIABLE, Forth CR, C printf, and some handy features the 386 doesn't have
like a 0 register. The "heap" word allows unallocated memory in the
storage image of the program. The "when" construct for conditional
branches and osimpa strand arrays are fairly unique. osimpa code doesn't
look very CPU-specific, and I believe it could be generalized to port
easily between most desktop one-stack CPUs.

osimpa in Bash is very slow, but very interactive otherwise, and the
produced code is as good as you are. Listed below is a playful little
Linux command in osimpa. The = A to B (Intel MOV ebx,eax) instruction is
gratuitous. Such a simple program as this didn't need any non-composite
instructions, so I just stuck one in to show that there is no syntactic
or semantic hurdle between composites and per-instruction assembly.
Similarly, ab assembles specific bytes without any conflict with more
complex actions. obverse and reverse are vt102 display directives
supported by the Linux console driver.

ELF
        = A to B
        Linux $write 0 $reverse 4
        print hiya   ; Linux $write 0 $obverse 5
        print hiya                                      # comment
        print hiya
        Linux $exit
L reverse
        ab 0x1b `asciibyte [ 7 m`
L obverse
        ab 0x1b `asciibyte [ 2 7 m`
text hiya <<!

Good morning Mister Felps. Your mission, should you choose to accept
it...
..
 .
 .
!


osimpa is at
                ftp://linux01.gwdg.de/pub/cLIeNUX/interim/osimpa.tgz

Rick Hohensee
rickh@capaccess.org
http://linux01.gwdg.de/~rhohen

##########################################################################
# 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/              #
##########################################################################



                 reply	other threads:[~2001-12-11 19:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

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