News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

assembly without libraries

Started by xdc, June 01, 2012, 05:14:42 PM

Previous topic - Next topic

xdc

the reason I switched from High level languages to assembly was because
I wanted to learn without using libraries. I want to learn how to make
my own printf, scanf functions etc

I was using the c++ std lib, and tried graphics programming, etc It didn't feel right, it seems like
too much is going on in the background that I still don't know, and that's what i want to learn!

I've looked around for this for c/c++, but I've only get negative
responses, or 'talk of reinventing the wheel', etc

I have AoA, the non-HLA version, it might be the ms-dos version, but i hear
people say skip 16 and go to 32bit, etc

Is there a book that is to my liking of programming?
Do I have to go through using these libraries till I can make my own?

jj2007

There is no "with" vs "without". There is only "more" vs "less libraries".
For example, you could write your own version of print, but somewhere inside you will inevitably have to revert to WriteFile or WriteConsole - and these are functions of one big fat library called "Windoze"...

If you have installed Masm32, open \Masm32\examples\exampl07\slickhuh\slickhuh.asm and spend some time trying to understand it (and I am afraid even that one uses Windows...). Then come back and tell us if you really want to live without libraries and high level elements.

anta40

Quote from: xdc on June 01, 2012, 05:14:42 PM
Do I have to go through using these libraries till I can make my own?

like JJ said, as long as your app run on OS (Windows, Linux, etc), eventually you'll end up using their native API.
C's printf, for example, may be implemented using WriteFile of WriteConsole on Windows.

AFAIK the only way to code in assembly without using those libraries is... to write your own OS. Then you can write your own printf, scanf, graphics engine, etc.

xdc

Quote from: jj2007 on June 01, 2012, 05:43:56 PM
There is no "with" vs "without". There is only "more" vs "less libraries".
For example, you could write your own version of print, but somewhere inside you will inevitably have to revert to WriteFile or WriteConsole - and these are functions of one big fat library called "Windoze"...

If you have installed Masm32, open \Masm32\examples\exampl07\slickhuh\slickhuh.asm and spend some time trying to understand it (and I am afraid even that one uses Windows...). Then come back and tell us if you really want to live without libraries and high level elements.

are there any books/tutorials for this kind of thing? I'm still using libraries but if that's as low as it gets without having to create your own OS that
sounds great to me.

Quote from: anta40 on June 01, 2012, 06:14:33 PM
Quote from: xdc on June 01, 2012, 05:14:42 PM
Do I have to go through using these libraries till I can make my own?

like JJ said, as long as your app run on OS (Windows, Linux, etc), eventually you'll end up using their native API.
C's printf, for example, may be implemented using WriteFile of WriteConsole on Windows.

AFAIK the only way to code in assembly without using those libraries is... to write your own OS. Then you can write your own printf, scanf, graphics engine, etc.

thanks, ill also start looking into OS development

Vortex

Hi xdc,

Try to study the Masm32 examples as much as possible. They will give you an idea.

raymond

Hi xdc,

You can effectively program without the use of libraries as long as you don't interact with the external "hardware". Unless you run strictly in DOS mode, a modern OS will not let you directly access external hardware (such as the monitor screen).

However, there are numerous ways to put a pixel on the screen (using OS functions), but some are a lot faster than others; and that becomes important when the quantity and rate increase significantly. That is where assembly can excel.
Whenever you assume something, you risk being wrong half the time.
https://masm32.com/masmcode/rayfil/index.html

Adamanteus

Quote from: xdc on June 01, 2012, 05:14:42 PM
I've looked around for this for c/c++, but I've only get negative
responses, or 'talk of reinventing the wheel', etc
The "wheel" consist of some algos, that is till now commercial secretes, becouse it's not easy to rewrite them.
So if you'd like to "learn how to make my own printf" you could make you own - that's all you can do.
Normal way in you case - first choose developer environment (including OS), then collect for it all algos that you see in sources or lib-files, make from it own library (for not loosing code) - building part from sources, other save with docs that to access it easy. Meanwhile you'll be understanding how's it works, replace some of functions by you own - more excellent, and so on  ::)

dedndave

what hasn't been mentioned...

most of the libraries you see in the masm32 package are import libraries
they allow you to link a program to the operating system functions

a good example might be the ExitProcess function
it's hard to write a valid win32 application without using that one   :P
the actual code is in kernel32.dll, which is in your Windows\System32 folder - part of the OS
the import library kernel32.lib gives the linker a way to resolve this external reference
kernel32.inc defines the prototype so the assembler knows the parameter format