subroutine not working

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
zer0cool
Posts: 2
Joined: Tue Nov 22, 2022 6:55 pm

subroutine not working

Post 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
Klakap
Member
Member
Posts: 297
Joined: Sat Mar 10, 2018 10:16 am

Re: subroutine not working

Post by Klakap »

what about posting all your code?
nullplan
Member
Member
Posts: 1644
Joined: Wed Aug 30, 2017 8:24 am

Re: subroutine not working

Post by nullplan »

I second Klakap's request for the full code, but in this case I presume you failed to set up a stack.
Carpe diem!
Octocontrabass
Member
Member
Posts: 5218
Joined: Mon Mar 25, 2013 7:01 pm

Re: subroutine not working

Post by Octocontrabass »

My crystal ball says you moved the subroutine under a "bits 32" directive (or whatever is equivalent for your assembler).
User avatar
iansjack
Member
Member
Posts: 4604
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: subroutine not working

Post 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.
Post Reply