1. PandaOnSmack

    OP PandaOnSmack GBAtemp Fan
    Member

    Joined:
    Nov 3, 2015
    Messages:
    349
    Country:
    Is it possible to write values on screen through pure assembly?

    Would you have to rely on a print function that the game provides? I am just trying to expand my understanding of PPC / Assembly.
     
  2. Hikari06

    Hikari06 GBAtemp Advanced Fan
    Member

    Joined:
    Nov 20, 2012
    Messages:
    999
    Country:
    Ecuador
    I'm not too familiar with the wii u but I guess you could just call the proper functions from your assembly code (OSScreenInit,OSScreenSetBufferEx,OSScreenFlipBuffersEx,OSScreenPutFontEx).

    Edit : You could maybe also write the pixels one by one on the screen buffer but I'm not sure what you would gain from doing that.
     
    Last edited by Hikari06, Feb 27, 2017
  3. PandaOnSmack

    OP PandaOnSmack GBAtemp Fan
    Member

    Joined:
    Nov 3, 2015
    Messages:
    349
    Country:
    Thanks Hikari06. Do you have any examples or how I can call them please? How do you call a function via PPC? ta!
     
  4. BullyWiiPlaza

    BullyWiiPlaza Nintendo Hacking <3
    Member

    Joined:
    Aug 2, 2014
    Messages:
    1,932
    Country:
    Germany
    You call a function in assembly by doing a bl to the address of the function (yes, you will have to find that) but I don't think you will get anywhere with this overall since the OSScreen functions won't really work. I tried it before in games and it crashes. Maybe I made a mistake though. In C printing to the screen looks similar to this:
    Code:
    void writeScreen(char message[100], int secondsDelay) {
        OSScreenClearBufferEx(0, 0);
        OSScreenClearBufferEx(1, 0);
    
        OSScreenPutFontEx(0, 14, 1, message);
        OSScreenPutFontEx(1, 14, 1, message);
    
        sleep(secondsDelay);
    
        OSScreenFlipBuffersEx(0);
        OSScreenFlipBuffersEx(1);
    }
    First of all you have to call OSScreenInit() though to initialize the screen.

    I still recommend getting it to work in C first and then maybe try and write it in assembly but if you can use C you may just copy the compiled function's assembly and use that for a code or whatever.
     
    Last edited by BullyWiiPlaza, Feb 27, 2017
  5. Hikari06

    Hikari06 GBAtemp Advanced Fan
    Member

    Joined:
    Nov 20, 2012
    Messages:
    999
    Country:
    Ecuador
    The OSScreen functions do work from what I can tell.

    Maybe you should add this after OSScreenInit():

    Code:
    int screen_buf0_size = OSScreenGetBufferSizeEx(0);
    int screen_buf1_size = OSScreenGetBufferSizeEx(1);
    unsigned char *screenBuffer = MEM1_alloc(screen_buf0_size + screen_buf1_size, 0x100);
    OSScreenSetBufferEx(0, screenBuffer);
    OSScreenSetBufferEx(1, (screenBuffer + screen_buf0_size));
    I'm not sure how one would do that directly from assembly though so inspecting the compiled code might be a good idea
     
    Last edited by Hikari06, Feb 27, 2017
Draft saved Draft deleted
Loading...

Hide similar threads Similar threads with keywords - Screen, Print,