June 10, 2019

Programming in Assembly language made easy


Many users of desktop PC are convinced that they need at least the C language for writing efficient programs. The idea is, that the syntax of c like language is superior to normal machine code and this increases the productivity. The reason why modern software is realized in C/C++ isn't because of the language itself, but the strength is located in the amount of libraries. Even in the Assembly language it is possible to create powerful libraries. This can explain who the programmers in the 1980s have realized such wonderful software. What they have done is not to program in Assembly direct, but the steps for creating a program was, that at first an assembly library was created which contains lowlevel functions like drawing a line, sorting an array and ontop of this library the program itself was realized.
The funny thing is, that this programming style is not located within the Assembly universe itself, which means around CPU registers and memory address but within the space of the self-created library. For example the programmer is trying to realize a 2d game. Then he will need graphics primitives. Who these primitives are realized on a concrete computer are not relevant. The important thing is only, that the library provides these routines.
Programming without a library
Instead of recommending Forth as the language of choice it make sense to start slowly with the normal C language but without using an existing library. The question was asked in an online forum, https://cboard.cprogramming.com/c-programming/109615-program-without-standard-library.html One guess is, to access the underlying operating system, another idea is to call a bios interrupt. The more minimalist approach is to store the values direct into the video's memory space.
The details of realizing a library free programming style is to embedded assembly code within the c-program. According to the osdev wiki https://wiki.osdev.org/Printing_To_Screen the video memory in the protected mode starts at 0xB8000.