Old DOS&Windows programming projects

Here you can find some of my programming projects, from the old ones done for DOS, to the new ones in Windows

DOS Programs

I started programming in a Commodore 128 in the late eighties, when I was only eight or nine years old. I do not keep any of my very first programs, but I remember spending hours programming in Basic, learning how to do graphics and sound, and that wreid integrated disassembler called the monitor, that introduced me into the assembler programming.

My very first contact with an IBM PC like computer was at the school, when I was 10 years old. I remember that we had some old Multitech PCs at the computer room. But when I was 12 years old, my parents bought an Olivetti PCS 286. It was delivered with a VGA card and, 3 1/2 floppy disk and a 20MB hard disk drive. It was a really incredible machine, far advanced for its time in my opinion.

I started programming in GW Basic, but very soon I moved to Turbo Pascal 5.5. My first serious programs were done with it. In parallel, I learnt how to program in 8086 assembler and I started playing around with interrupts and ports.

Some days ago I discovered a very funny utility: DOSBOX . This is a freeware utility that let you execute DOS programs under Windows, having a good support for old CGA/EGA/VGA graphic cards and AdLib / SoundBlaster sound cards. It works extremely well, and emulates perfectly Turbo Pascal compiled programs.

Columns

This was my first finished game. I wrote it in 1993 and it is completely done in 8086 assembler. When I see it I can't believe how did I write this being only 15 years old. It is so small that it fits in a 77 kb ZIP file.

I wrote this game after seeing an advertisment in Micromania, a spanish computer game magazine. It was the Columns game for Sega Megadrive. I used Autodesk Animator for drawing the gems and the intro screens. I used MCGA 256 color video mode. Graphics were directly imported from Autodesk CEL files. The high score screen that appears at the end of the game is done using the bubble sort algorithm.

To play, just download the game, decompress it and execute cl.exe

The keys are: 1 right - 3 left - Space rotate - ESC exits the game

Columns 8086 Assembler source code and executable file

 

Binary Spatial Partitioning

3D graphics programming turned me crazy. I really enjoyed. I played around with ray tracing, the Z buffer algorithm, shading, polygon filling...

This is only one example. I read an article about binary spatial partitioning, and I wrote two applications. The first one (gram3) is a grammar analysis and tree building utility. It reads the contents of a text file where a scene is described, and then it generates a binary polygonal tree that can be directly consumed by a second utility, a BSP tree interpreter (intbsp).

Execute gram3.exe for generating the BSP tree. The input file is hardcoded in the code (cil3.scn) and the output file is (prueba.arb)

Then execute intbsp.exe for displaying the scene. Press five or six times a key to enter the scene rendering. Then use the arrow keys to move around.

BSP Pascal source code and executable file

Computer Circuit Simulation

Me and my classmate Haritz wrote this program for Computer Programming Lab subject at the University. I couldn't find the final version of this program, but this one is quite final.

It can do the simulation of a linear circuit mesh (composed of resistors, capacitors and inductors). The final version can calculate the frequency and the impulse response of the circuit mesh, given an output node.

To execute the analysis of a circuit, just execute graf.exe and load "pbanda.chj" using the option "Cargar". This file contains the description of a second order bandpass filter.

Then choose the magnitude & argument display to render the filter response at "Dibujar / Completo"

Spice Turbo Pascal source code and executable

 

Ray Tracing

For a long time, I studied a variety of ray tracing algorithms. I remember I printed the whole source code of the POVRAY raytracer in an old matricial Olivetti printer and then I studied it line by line. Apart from ray tracing algorithms, I learnt how to do large structured programs and I gathered the basic knowledge to do language parser.

I also looked for simpler raytracing algorithms. One of them is this translation to Turbo Pascal of the George Kyriazis raytracer, written in 1988. It is so simple that the whole scene parsing and VESA graphic rendering fits into 680 lines of Turbo Pascal Code.

To have it working, just execute:

rs2 test.1 640 480 output

It is not a very fast ray tracer, but just press Ctrl+F12 to speed up DOSBOX and have the scene traced faster.

Ray tracing Turbo Pascal source code and executable

Windows Programs

ST30 Flasher

While I was working for a automotive electronic design and manufacturing company in Spain, I developed a complete ST30 flasher windows utility for the ST30F774 and the ST30F772i. These microcontrollers are an ARM7TDMI based systems. The utility can flash a ST30 flash microcontroller using a conventional Wiggler cable. The utility was planned to be used for one of the Electronic Control Unit that now is being incorporated in a famous german car manufacturer. But since I left the company, and this was a completely independent work, I have made it public.

The program is divided in six different directories:

  • jtag_kernel_mode_driver: This is the diectory of a Windows kernel mode driver to manage the access to the parallel port. Since the access to the parallel port is done inside the kernel of the operating system, the signal generation of the serial communication used in the JTAG protocol is much faster.
  • loader: here a small ARM assembler program is stored. It can be compiled using the old ARM Developer Studio tool. This program is loaded using the JTAG instruction pipeline. Loading the code in such way is quite slow. Therefore, a small loader is loaded into the RAM memory to download to the microcontroller a larger program called the monitor
  • monitor: the program stored here is a command server executed inside the microcontroller. The monitor communicates with the windows application through the JTAG Debug Communication Channel. A command + data packet is sent to the microcontroller to be executed.
  • ST30Flasher: contains the whole MFC Windows application to be compiled using Visual C++. The program is prepared to include a license system, but it has been commented for now.
  • KeyGenerator: contains a small program that generates a license key based on the Ethernet MAC address of the Physical machine where the program is being executed.
  • comun: contains a set of common files used in the two Windows applications. The main functions are the code to get the MAC address of the machine and the algorithm for calculating the license key.

To execute this program, first you have to install the kernel mode driver. I have not done any application to do the installation of the program. Ask google how to do it. After that, just execute the ST30Flasher program having a properly working Wiggler cable plugged into the parallel port and connected to the target board with the power supply connected.

ST30 Flasher utility executables and source code files.

Sudoku solver

A small numerical exercise about how to solve a sudoku game. Just type the numbers into the matrix and execute the program.

Small sudoku solver source code and executable file.

 

PCAD parser

Here you can find a PCAD grammar parser. PCAD can save the schematic files in a text format that can be read by a external application. This is a small exercise to lear how to use Bison to extract information from a PCAD schematic file.

PCAD parser source code and executable file.

 

VCORE assembler and simulator

While I was teaching in the Public University of Navarra, I wrote an assembler and a compiler for a virtual processor called VCore (from Vadillo Core ;-) ). The main purpose was to let my students to write a game running in the simulator. The simulator contains the processor core simulator, a small 320x200x8bpp graphic card, a keyboard peripheral and a timer.

VCore assembler and simulator source codes and executable files.

 

VCORE Tetris

To show my students that a real game could be built and executed in the virtual machine, I wrote a complete Tetris game with animated graphics. I remembered my old days doing it ...

VCore Tetris assembler source code and executable file.

 

M16C simulator

One of the things I am triying to do in the last year is to simulate a complete

Future software projects

  • A complete ARM7 (maybe a Philips LPC21xx) evaluation board simulated system, with an LCD, LEDs and push buttons.
  • A digital oscilloscope with a sampling rate over 60MSPS
  • A digital capacitance meter

(C) Juan Ramón Vadillo Pastor