flat assembler
Message board for the users of flat assembler.
Index
> Projects and Ideas > another Befunge interpreter for DOS (BEFI.COM) |
What do you think of this? | |||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||
Total Votes : 15 |
Author |
|
rugxulo 30 Oct 2009, 17:54
Instead of cluttering up Pinecone_'s Win32 interpreter project thread or the (dead?) Esoteric language challenge thread, I'm putting this here (not that anybody cares besides me, though, *sniff*).
Current size: 1023 bytes uncompressed w/ simple LFN support N.B. Doesn't work in DOSEMU 1.4.0 under XUbuntu x86-64 (most likely due to self-modifying code confusing the 16-bit emulation), but it works everywhere else I tried (32-bit DOSEMU, DOSBox, Vista, XP, DR-DOS, FreeDOS, MS-DOS). EDIT: Deleted attachment. |
|||
30 Oct 2009, 17:54 |
|
rugxulo 14 Apr 2010, 17:28
Another update, minor bugfix (e.g. didn't ignore uppercase letters correctly, which also apparently fixes official befunge[3x].bf), somewhat improved examples. Still 1024 bytes (but due to bugfix I had to make it where it always returns a bogus errorlevel, to save a byte, which isn't ideal but will be fixed eventually ... hopefully). Also now can build with newer JWasm versions (unlike older since JWasm now uses shorter "cmp sp,..." encoding by default).
P.S. I know it's confusing having the version "number" be "2k" (previously "2j"), but whatever, just go with it for now. Last edited by rugxulo on 17 Apr 2010, 01:15; edited 1 time in total |
|||
14 Apr 2010, 17:28 |
|
rugxulo 17 Apr 2010, 01:13
Another update, hopefully (??) the "idiv" bug (see NEGMOD.BEF) seems gone. I also fixed the errorlevel issue. Only 1014 bytes now, ironically, because I was doing things the wrong way, it bloated to 1040, and I was forced to shrink to 1033 before seeing my mistake.
Feel free to stress test it with various examples, and please post any snippets (re: bugs) here. Last edited by rugxulo on 24 Apr 2010, 01:15; edited 1 time in total |
|||
17 Apr 2010, 01:13 |
|
rugxulo 22 Apr 2010, 21:34
Well, I think I'm going to "bloat" it a bit (four extra bytes) to increase speed. Technically, I've not optimized for speed at all, but self-modifying code (found in original, not added by me) just hurts too much.
Code: v benchmk2.bef (remove this line + all 'v<^>' to revert to benchmark.bef) >91+:*-:0`#@ #._v ^ < EDIT: Those 'v^<>' chars change IP direction, which is what the self-modifying code was used for. So it was self-modifying quite a lot! Quote:
Quote:
EDIT: I should post results for my Athlon64x2, it's even worse! |
|||
22 Apr 2010, 21:34 |
|
rugxulo 24 Apr 2010, 01:19
Well, another release, and I was actually able to shrink it back to 1014 uncompressed (although I know that's confusing for the unaware user, heh, same size as before!) while still keeping it fast.
|
|||
24 Apr 2010, 01:19 |
|
rugxulo 05 May 2010, 22:50
Another update, now shrank down to 982 bytes, but it slowed down the benchmark again on this P4 (argh). Added some other misc. files too (Rexx version(s), two more examples).
EDIT: (July 20) No .ASM changes, just basically added some other binaries from my Pascal version, plus adjusted and added some examples. |
|||
05 May 2010, 22:50 |
|
rugxulo 01 Sep 2010, 01:50
Well, I feel silly attaching a 100 kb .ZIP that contains a lot of non-assembly cruft. So I guess I'll just attach the latest (final?) (F)ASM src here instead (smaller, at least). Anybody who cares (unlikely) can get the full file from my site. (Still no x86 asm changes since May 5.)
|
|||||||||||
01 Sep 2010, 01:50 |
|
rugxulo 16 May 2012, 21:38
Two silly changes, but it saved nine bytes. (I know, big whoop, and for various reasons the whole thing needs a rewrite anyways, bah.)
EDIT: removed obsolete diff. |
|||
16 May 2012, 21:38 |
|
rugxulo 26 May 2012, 06:29
Bah, I'm such a doofus. Sure, I shrank it, but I introduced a (rare) bug that my existing tests didn't uncover. I don't know what I was thinking.
Code: <v_,#! #:<"Should be: 625 0 "+91::::::::::" " >>5:*:*:.!.@ Well, anyways, here's a newer diff, and it fixes that plus is now only 970 bytes (whee!). Yes, I realize this is fairly useless at this point (and horribly ugly / obfuscated due to relying on anarchy instead of a stable calling convention, heh, probably not the best thing for further maintenance, but it's still fun). Code: diff -wasruN old/befi.asm new/befi.asm --- old/befi.asm 2010-05-04 09:34:02 +0000 +++ new/befi.asm 2012-05-26 00:20:46 +0000 @@ -3,9 +3,9 @@ ; *************************************************************** ; ; old TASM version: 1280 bytes ( 1082 bytes aPACK'd ) -; this FASM version: 982 bytes ( 999 aPACK, 998 w/ 624 ) +; this FASM version: 970 bytes ( 993 aPACK, 990 w/ 624 ) ; -; Tuesday, May 4, 2010 2:33pm +; Saturday, May 26, 2012 ; ; "Ad Maiorem Gloriam Dei" && "Christus Rex" ; @@ -284,7 +284,7 @@ lvif: call pop1 - and eax,eax + test eax,eax jnz lup ldn: @@ -365,15 +365,15 @@ lnot: call pop1 test eax,eax - lea eax,[0] setz al - jmp push_jump + jmp and_push_jump lgreat: call pop2 cmp eax,edx - lea eax,[0] setg al +and_push_jump: + and eax,1 jmp push_jump lrt: @@ -400,13 +400,16 @@ shl cl,3 shl ax,cl add al,al - mov magx,al - mov magy,ah + +; mov magx,al +; mov magy,ah + mov [my_magx],ax + jmp lnop1 lhif: call pop1 - and eax,eax + test eax,eax jz lrt llt: @@ -495,7 +498,21 @@ rand: cmp word [F1],179 - jnz seed + jz rn + +seed: + mov word [F1],179 ; use the BIOS clock as a seed + xor ah,ah + int 1Ah + +; mov [S1],dx +; mov [S2],cx + mov di,S1 + xchg ax,dx + stosw + xchg ax,cx + stosw + rn: push si mov si,S1 @@ -522,21 +539,6 @@ pop si ret -seed: - mov word [F1],179 ; use the BIOS clock as a seed - xor ah,ah - int 1Ah - -; mov [S1],dx -; mov [S2],cx - mov di,S1 - xchg ax,dx - stosw - xchg ax,cx - stosw - - jmp rn - inch: cmp byte [ib+1],0 jnz inch_ugc @@ -742,12 +744,21 @@ ;dw lnop,lswap,lnop,lup,lhif,lgreat table1: -db lnot-200h,lstr-200h,lbridge-200h,lpop-200h,lmod-200h,linval-200h,lnop-200h -db lnop-200h,lnop-200h,lmul-200h,ladd-200h,loutchr-200h,lsub-200h,loutval-200h,ldiv-200h -db lpush-200h,lpush-200h,lpush-200h,lpush-200h,lpush-200h,lpush-200h,lpush-200h,lpush-200h,lpush-200h,lpush-200h -db ldup-200h,lnop-200h,llt-200h,lnop-200h,lrt-200h,lrand-200h,lend-200h +db lnot-200h,lstr-200h,lbridge-200h,lpop-200h,lmod-200h +db linval-200h,lnop-200h + +db lnop-200h,lnop-200h,lmul-200h,ladd-200h,loutchr-200h +db lsub-200h,loutval-200h,ldiv-200h + +db lpush-200h,lpush-200h,lpush-200h,lpush-200h,lpush-200h +db lpush-200h,lpush-200h,lpush-200h,lpush-200h,lpush-200h + +db ldup-200h,lnop-200h,llt-200h,lnop-200h,lrt-200h +db lrand-200h,lend-200h + table2: -db lnop-200h,lswap-200h,lnop-200h,lup-200h,lhif-200h,lgreat-200h +db lnop-200h,lswap-200h,lnop-200h,lup-200h,lhif-200h +db lgreat-200h ;badfilemsg: db '?$' ;badfilemsg: db 'Bad file',13,10,'$' |
|||
26 May 2012, 06:29 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.