Home > Software design >  Is it possible to write multiple characters in C Assembly with no stdlib?
Is it possible to write multiple characters in C Assembly with no stdlib?

Time:12-13

I am developing a operating system, following this tutorial, and I'm on part 7 (chapter 7), and he shows how to print a character to the screen, but I want to print multiple characters but it just overwrites the previous character. Here is my code

extern "C" void main() {
    // printf("Hello, World!");
    *(char *)0xb8000 = 'H';
    *(char *)0xb8000 = 'e';
    *(char *)0xb8000 = 'l';
    *(char *)0xb8000 = 'l';
    *(char *)0xb8000 = 'o';
    *(char *)0xb8000 = ',';
    *(char *)0xb8000 = ' ';
    *(char *)0xb8000 = 'W';
    *(char *)0xb8000 = 'o';
    *(char *)0xb8000 = 'r';
    *(char *)0xb8000 = 'l';
    *(char *)0xb8000 = 'd';
    *(char *)0xb8000 = '!';
    return;
}

CodePudding user response:

Is it possible to write multiple characters in C Assembly with no stdlib?

There is no standard way to write one or more characters in C other than using the standard library.

The system (operating system / CPU architecture) may have ways, but that depends on which OS / CPU you are using. See their documentation.

There is no one assembly language; each CPU architecture has their own language, and compilers have their own syntax.

CodePudding user response:

@user2864740 sent me a link that helped me fix it

CodePudding user response:

K _ThePortal, I learned 68k-assembly-coding (Demos) on the Amiga in 1987. It was a cool expirience for me as a young guy and I decided to study it. The main thing is after all this years: Don't be wasting your time! Why do you have to re-invent the wheel - go on with C on a higher level!

  • Related