Page 1 of 1

subroutine not working

Posted: Mon Sep 18, 2023 9:19 pm
by zer0cool
i have a simple character write subroutine that looks like

Code: Select all

writeChar:
    mov ah, 0x0A
    mov bh, 0x00
    mov cx, 1
    int 0x10
    ret
before i call the function i put the value for ascii A into al then i call it but it doesnt do anything, when i copy the code inplace of the call it work just fine, what could be causing this

Re: subroutine not working

Posted: Mon Sep 18, 2023 11:56 pm
by Klakap
what about posting all your code?

Re: subroutine not working

Posted: Tue Sep 19, 2023 8:11 am
by nullplan
I second Klakap's request for the full code, but in this case I presume you failed to set up a stack.

Re: subroutine not working

Posted: Tue Sep 19, 2023 8:18 am
by Octocontrabass
My crystal ball says you moved the subroutine under a "bits 32" directive (or whatever is equivalent for your assembler).

Re: subroutine not working

Posted: Tue Sep 19, 2023 8:49 am
by iansjack
There are so many things that you could have done wrong. Single-stepping your code in a debugger should make the cause obvious.