From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d4db,74c3dad57af34e3b,start X-Google-Attributes: gid10d4db,public X-Google-ArrivalTime: 2001-12-11 11:35:55 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!sn-xit-01!supernews.com!news.alt.net!cola.stump.algebra.com!robomod!not-for-mail From: "Rick A. Hohensee" Newsgroups: comp.os.linux.announce Subject: Son of shasm, osimpa Date: Tue, 11 Dec 2001 13:31:10 CST Organization: Altopia Corp. - Usenet Access - http://www.altopia.com Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Return-Path: X-COLA-Policy: http://stump.algebra.com/~cola X-COLA-Info-1: Send submissions to cola@stump.algebra.com X-COLA-Info-2: Send complaints to cola-admin@stump.algebra.com X-Comment: moderators do not necessarily agree or disagree with this article. X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov) X-Auth: PGPMoose V1.1 PGP comp.os.linux.announce iQBVAwUAPBZe/iFvAtx2nXvNAQE+OAH/aXEDfBwQPbcaTxAbnFNp0OeI5VtVSha+ Z0FLJDnbAA+qjsVJIXq6uAUmn8MAcKy7IgfFmvRdNcWCjmnMV1Tg4g== =9K/I Xref: archiver1.google.com comp.os.linux.announce:1552 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 <