CODEGEN.SLC is a simple parser that accepts an expression from input and writes 80x86 compatible assembly code to output. In this case, CODEGEN.SLC has been compiled to CODEGEN.COM and is being run under a DOS emulator, with your expression "stuffed" into the input.

executing "codegen" via DOSCMD and stuffing data "a + (b - (c * (d / 3)))" to STDIN...

> a + (b - (c * (d / 3)))
; a + (b - (c * (d / 3)))
	mov	ax,a
	push	ax
	mov	ax,b
	push	ax
	mov	ax,c
	push	ax
	mov	ax,d
	push	ax
	mov	ax,3
	mov	bx,ax
	pop	ax
	div	bx
	mov	bx,ax
	pop	ax
	mul	bx
	mov	bx,ax
	pop	ax
	sub	ax,bx
	pop	bx
	add	ax,bx

> 
; 

Bye!

Notes:
  • Lines starting with ">" are the stuffed input. Lines starting with ";" are comments in the output.
  • If this code was assembled and executed, the result would be in AX.
  • Yes, this is really the output of a DOS executable running on a FreeBSD (unix) web server!


    Return to SLC homepage