http://www.viksoe.dk/code/index.htm
lately we have been swamped with bill gate's new .net vision. once again even respectable people are crying out that c++ and assembler programmers will become extinct dinosaurs. my reaction to that is: "it's not fair!" why are they always picking on assembler programmers? we don't do a lot of harm! just because we like to have total freedom and like to be close to our hardware doesn't make us bad people. go pick on someone else (like lisp programmers. i don't like them).
frankly, i was getting a little tired of this whole discussion, so i decided to do something about it - by bringing x86 assembler programming into the .net age. well, at least to allow asp.net pages to be written in 80386 assembler.
to do just that, i've written a compiler (assembler?) that compiles 80386 assembler code into msil. in other words, you get to write assembler programs that compiles into the same il of the .net's common language runtime that your fellow visualbasic.net and c# developers are using. so basically you can enjoy the thrill of low-level programming and still be compatible with your "oh, so modern" vb.net friends.
what?!
yup, it's true. it's really the x86 (intel 80386 actually) instruction set that gets compiled into il. literally it is an "80386 assembler scripting language" for asp.net.
"very usefull", you might think! "just the sort of thing you have been looking for", i hear you say! thanks, i do my best to support my kindred spirits.
you use the compiler in asp.net by replacing your usual vbscript.net script code with 80386 assembler instructions. in addition you use the keyword asm80386 as page language.
the compiler
short-term goal
because i didn't really want to spend too much time on this project, i set out a short-term goal: to create my first web-page in assembler.
that is, to be able to execute this asp.net script:<%@ page language="asm80386" %>
<%
str: db "testing...", 0
mov eax, -2
cmp eax, 2
jle label1
xor eax, eax
label1:
lea esi, str
push esi
call "response.write(string)"
pop esi
%>
<br>eax: <%= eax %>
instruction support
the following instructions are supported
nop, mov, lea, cmp, test,
add, sub, xor, not, neg,
inc, dec, or, and,
imul, idiv, mul, div,
sal, shl, sar, shr,
cbw, cwde, cwd, cdq,
cld, std, cmc, stc, clc,
push, pop, jmp, call,
je, jz, jne, jnz, js, jns, jb,
jnae, jae, jnb, jbe, jna, ja,
jnbe, jl, jnge, jge, jnl, jle
jng, jg, jnl, jc, jnc,
jcxz, jecxz
limitations
not all operand constructs are supported. instructions, which are available in multiple forms (such as imul) only support 1 form. registers al, ax and eax types are supported - but ah and its friends are currently not. there is no support for segments qualifiers, special 80386+ registers or any of the fancy prefix types (rep or lock). since segment registers are not supported, a flat memory model is used. the addressing form [bx + si] is not supported. the stack space is limited to 200 dword entries. use $ to denote hexadecimal. asp.net debugging is awkward, but works. the call instruction can handle cls calls using quouted strings, but ordinary sub routines are not supported (there is no ret support). plenty more limitations may apply.
but what about...
nothing has changed. a security exception will tell you when you're doing something wrong. you're only allowed access to your own data segment.