X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: Rugxulo Newsgroups: comp.os.msdos.djgpp Subject: GAS ".code16" and DJASM quirks ... Date: Mon, 9 Nov 2009 20:03:14 -0800 (PST) Organization: http://groups.google.com Lines: 69 Message-ID: <0008cd2e-63c9-43cb-82d4-11aece7c209f@c3g2000yqd.googlegroups.com> NNTP-Posting-Host: 68.220.162.125 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1257825794 29226 127.0.0.1 (10 Nov 2009 04:03:14 GMT) X-Complaints-To: groups-abuse AT google DOT com NNTP-Posting-Date: Tue, 10 Nov 2009 04:03:14 +0000 (UTC) Complaints-To: groups-abuse AT google DOT com Injection-Info: c3g2000yqd.googlegroups.com; posting-host=68.220.162.125; posting-account=p5rsXQoAAAB8KPnVlgg9E_vlm2dvVhfO User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195.32 Safari/532.0,gzip(gfe),gzip(gfe) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com I've been messing with a small Befunge93 interpreter in assembly. I didn't write it, just tweaked it a bit, converted it to something besides TASM, fixed a few bugs (though some obscure ones still exist), and shrank its size a lot. I know it's silly, but ... http://board.flatassembler.net/topic.php?t=10810 Yesterday I made it work with DJASM (via MAKE.BAT which uses sed script). Unfortunately, I couldn't manually get GAS working earlier today. Anyways, here's what I discovered: DJASM: 1). no "salc" (0xD6) support (though other assemblers have it except GAS) 2). no hex numbers a la "30h" (only "0x30" ??), that's very annoying and not Intel-friendly, IMHO, can't be hard to add support for that can it? 3). '.type "com"' even when using ".org 0x100" seems useless, "djasm befi.dj" still makes an .EXE unless explicitly saying "djasm befi.dj befi.com" 4). "rep movsb" must be split to use two lines (vaguely annoying but not the only assembler to require this, e.g. GAS or WolfASM) 5). it's also picky on "byte" or "word" overrides, which is kinda clunky 6). jumps that are > 128 bytes away aren't manually converted to 3- byte jumps, so they have to be manually tweaked ("jmp" -> "jmpl"), which is annoying Okay, so I know it's not perfect and never was meant for too much initially. I also know it's probably moot mentioning this, but I tried anyways. At least it works! ;-) While GAS now supports ".code16" and everything mostly seems to work (almost), I have a few doubts that anybody really uses it much for 16- bit (or maybe I did it wrong, who knows). GAS: 1). no "salc" support (argh, oh well) 2). "0x300" required instead of "300h" (seriously?? bah) 3). ".org 0x100" doesn't seem to do anything useful (adds a bunch of zero bytes at the beginning), nor does ".data" (adds bunch of crud to end) 4). seems to align the code with no way to turn that off (is there?), so it's "too big" a result (e.g. smallest .COM I got was 1536 bytes) 5). can't even directly output a flat binary (.COM) file (can it?) except via external tools like OBJCOPY (yes) or LD (doubt it), can it??? 6). it seems to assume 0x1000 as "entry" and using "-e0x100" (or anything else I tried) doesn't seem to change the following (of what I assume is a) "bug": (normal assembler) dw offset lnop (GAS) .short lnop For some reason, while most ".intel_syntax noprefix" code requires "offset" and "word ptr" etc., using "offset" like ".short offset lnop" isn't accepted. So the closest I can get is as mentioned above, BUT it doesn't generate a correct address/offset (instead of being 0x262 it's like 0x1162). I'm blindly guessing entry is accidentally hard-coded or maybe not handled correctly or whatever. (This was 2.19, I think.) So based upon that and not knowing a solution, I gave up on GAS (for now). I almost wouldn't even post this, but there's no much other traffic (die, spam!) and it is at least *almost* on topic. ;-)