flipCode - Tech File - Lionel Brits [an error occurred while processing this directive]
Lionel Brits
(aka Betelgeuse)
Click the name for some bio info

E-Mail: britsc@cadvision.com

   03/28/2000, EggNBeans, How Do I Love Thee? Let Me Count The Ways

W'sap homeys! Well it's official! I spend wa-a-a-ay too much time in #flipcode. Other than that, I've had a rather productive past two weeks: I made a friend, *gasp*; I started coding my compiler; I've also come to the realization that BMP files are evil. Still, I have yet to receive my A+ Certificate and matching badge ;o)

Update on my compiler

I seem to have misplaced my laser-pointer. Oh wait, right, the compiler. Yes, well, I spent most of the weekend getting the thing to load instruction definition files from disk. As I might have said earlier, the compiler is designed to use scripts for specific code platforms and output formats. E.g. if I wanted to compile a piece of Intel assembly, I would specify "i386.idf".

The instruction definition file simply contains semi-compiled assembly.

"DB"		"imm8"		"%1";
"DW"		"imm16"		"%1";
"STOSW"		"*"		"AB";
"CLI"		"*"		"FA";
"INT"		"imm8"		"CD %1";
"MOV"		"AX,	imm"	"B8 %1"
		"CX,	imm"	"B9 %1"
		"DX,	imm"	"BA %1"
		"BX,	imm"	"BB %1";
My compiler then builds up a tree/list of instructions and uses it to process code into binary form. For instance, when it sees an instruction like "INT 0x13", it compares it to the list and replaces it with "0xCD 0x13". I don't know if this compiler/assembler will ever be fast enough to be of any use, but I do see it being used by hobbyists and die-hard Z80 programmers ;o)

Well, most of my day was spent on getting these instruction definition files to load properly. I suspect that I'll be spending the next week on commenting/debugging etc. What concerns me though is where I'm going to get .idf files to plug into my trusty new creation. Hopefully some good Samaritans will offer to do a few... A-a-a-anyway, I'll probably post a link/upload to my compiler in my next tech-file.


I saw this a while ago, and I didn't quite know how to do it. One can embed an HTML file inside another web page as an element of that page, just like an image or a table. This eliminates the need for those cumbersome frames everyone hates - although this can be equally evil in the wrong hands. This is ideal for situations where you want to embed C++ or other code in a tutorial. All too often I find myself struggling with copy-paste in situations where IE has decided to remove all the CR/LF characters from a code block. Don't laugh.

Here's the code:

As you may have guessed, Netscape chokes on this, as is the case with most other M$ inventions.


Well, that's about it for this tech-file. I hope it wasn't too short (or long :o). Mm... It seems that I have forgotten to mention why BMP files are evil. Oh well...



"We should take care not to make the intellect our god; it has, of course, powerful muscles, but no personality."
Albert Einstein (1879-1955)

  • 10/18/2000 - A Coder's Insanity
  • 04/17/2000 - My Not-So Tech File
  • 03/28/2000 - EggNBeans, How Do I Love Thee? Let Me Count The Ways
  • 03/19/2000 - Midgets, Calculus And Dirty Punks
  • 02/25/2000 - Strike Two!
  • 01/27/2000 - Introduction

  • This document may not be reproduced in any way without explicit permission from the author and flipCode. All Rights Reserved. Best viewed at a high resolution. The views expressed in this document are the views of the author and NOT neccesarily of anyone else associated with flipCode.

    [an error occurred while processing this directive]