Hello x86: Low-level assembly coding for the 8086

Hello x86: Low-level assembly coding for the 8086 wiring no-talking, in emulated 80286 / MS-DOS machine in DOSbox. This is a set of four "hello world" codes in x86 assembly, using single-segment 16-bit/i8086 instruction set. The purspose of this tutorial is to demonstrate how exact, minimal-space, yet razor-sharp is assembly coding, especially when dealing with such complexities like the segmented memory model of MS-DOS. The four versions are:
  • Hello1.asm: Old-style standard directives, used by '70s-'80s assemblers, for .EXE output.
  • Hello1C.asm: Old-style standard directives, used by '70s-'80s assemblers, for .COM output.
  • Hello2.asm: Compact 'dot' directives, used by modern assemblers, for .EXE output.
  • Hello2C.asm: Compact 'dot' directives, used by modern assemblers, for .COM output.

The difference between .EXE and .COM comes from the MS-DOS era, when the first format required 'far' pointers (segment:offset) for memory addresses, while the second fitted everything within a single 64KB segment (code, data, stack). There are specific restrictions to .COM executables regarding calls and data handling, but in very early x86 CPUs they were faster because of the much simpler addressing model. Some linkers had options for producing .COM executables directly, while others required the use of EXE2BIN tool for this image conversion. The memory map files .MAP are also retainned with the sources .ASM, in order to have a clear view of the layout of each executable image .EXE or .COM (comparison).

Enable captions for more details and walk-through. Source code available at the Github repository (see channel info). Music credits:

  • Fluidscape by Kevin MacLeod is licensed under a Creative Commons Attribution 4.0 license. https://creativecommons.org/licenses/by/4.0/
  • Source: http://incompetech.com/music/royalty-free/index.html?isrc=USUAN1100393
  • Artist: http://incompetech.com/
Tags: #ambient #coding #programming #notalking #assembly #retro #msdos #dosbox

Comments

Popular Posts

Announcement: Writing a new book in Data Science and R&D projects

Fibonacci numbers in C (4 different ways)

Multiplication tables in COBOL

Bricks and towers in Prolog

Channel Updates