Assembly Gui Programming

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

Assembly Gui Programming Software

Masm32 - A complete package for programming Windows™ using its API code and Assembly language. This uses Microsoft's® Assembler program MASM (included), but gets its usefulness from a number of macros, include and library files and examples which a team of people have worked on. At age 12, he started programming by copying assembly game code on his dad's Commodore 64. Eventually, he parlayed that experience into learning about Visual Basic for Applications (VBA), ASP.NET, C#, and a variety of client scripting languages and frameworks.

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.

Java
Difficulty level

Beginner

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.

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

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!

Assembly Gui Programming Software

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!

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

Question or issue on macOS:

Java Gui Programming Example

I’d like to know how can I do a simple assembly program for Mac OS X that shows a window on the screen and put some coloured text on that window. The code may call some Carbon or Cocoa APIs. I need some code for the nasm sintaxe.

I saw in http://snipplr.com/view/29150/assembly-code-nasm-for-mac–hello-world the next code that works fine, but it´s not graphic.

Assembly Gui Programming Tutorial

Thanks for any help

How to solve this problem?

Solution no. 1:

This is not Carbon as requested in the comments in the previous answers, but it may help you get a step further ahead in your noble pursuit:

Solution no. 2:

You can call Carbon APIs with call like this:

You can pass arguments also, but I’m unsure how to do that. Probably pushed onto the stack in reversed order just before the call:

You can look in how you C code compiles into assembly, like this:

Hope this helps!