Assembly Gui Programming

Introduction to Z-80 Assembly Language Programming VCF SE 3.0 Malcolm Macleod 3 May 2015 malcolm@avitech.com.au.

This article's tone or style may not reflect the encyclopedic tone used throughout the wiki. See Wikipedia's article on tone for suggestions.

  1. Here we will be demonstrating Assembly programming using MASM as it is the Microsoft assembler and provide much flexibility when it comes to development on Windows environment over various other assemblers like NASM etc. Required Tools: MASM Reference 2 - MASM is a Microsoft assembler. WinAsm Reference 3 - WinAsm is IDE. It provides a nice.
  2. Before you can use the Borland tools you must run a setup program. From the CAE Windows machines press Start-CAE Application-Programming-Borland Turbo Assembler v5.0. A command window will launch; and at the top you will see the message 'This command window is now ready for using TASM.' Now you are ready to assemble your.asm file.

This page or section refers to its readers or editors using I, my, we or us. It should be edited to be in an encyclopedic tone.

Difficulty level

Beginner
Assembly Gui ProgrammingAssembly Gui Programming

In this tutorial we will assemble a small 16-bit assembly language kernel with NASM and boot it.

WARNING: Please see the Real Mode OS Warning page before continuing.

  • 2So what's it going to look like?

Overview

You're probably going to sigh and dismiss yet another tutorial on writing operating systems in x86 assembly language, especially since this one uses real mode. But there's a catch to this one; it actually does more than printing 'Hello World' to the screen and halting.

For this, you'll need:

  • the latest version of NASM (2.05.01 as of November 28th, 2008)
  • PARTCOPY on Windows or dd on Linux
  • an emulator like QEMU, Bochs, or Microsoft Virtual PC

So what's it going to look like?

Well, there will be a single source file, the kernel. What about a bootloader? This is such a small kernel, we're not going to use a filesystem at all, we're just going to put the kernel into the first few sectors of the disk image!

The system will have a string printing call (of course), keyboard input, and a strcmp call similar to that of C, all packaged into less than a sector.

Gui

But I want a GUI and sound effects and all the Windows games to work on my OS...

Assembly Gui Programming

So where's the code?

Here you go, go wild.

To assemble on Windows:

Or on Linux:

Those commands assemble your kernel binary and write them to the first disk (sda might be your system disk, so use sdb, sdc etc. according to your configuration. USB-sticks also appear as one of the 'sd' devices). Go ahead and test out your operating system now!

What next?

Why, that's up to you of course! You could add more commands, expand your OS to another sector and learn to use the BIOS sector load functions, add a stack and improve the calls, etc.

Have fun with your OS, however you decide to write it!

EDIT on December 12 2008: I've written a second part to this tutorial at Real mode assembly II. This and future parts will have less code to copy and paste and more theory!

Assembly Gui Programming Example

Retrieved from 'https://wiki.osdev.org/index.php?title=Real_mode_assembly_I&oldid=25012'