Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Simple BIOS Text.....

Can someone post a NASM code that will simply print a string of text out on the screen using BIOS INTs only?


This is extremly easy to do using 21h with DOS but I need to use a BIOS INT (my code is on the boot sector). I believe its in INT 9 but I can't figure it out...when ever I try to print my name and exit at the dos prompt my Compaq IJ700 printer starts spitting out empty pages at me and the cursor blinks around all over the place until I close the prompt :o(


-Robert


Comments

  • Use the video services - int 10h

    something like this - the formatting sucks here but you can figure it out.. al contains the character to be displayed...


    ps_loop:

    lodsb ; Load ds:si into al

    or al, al ; Check to see if it is the null terminator

    jz ps_done ; if al==0 then return



    mov ah, 0Eh ; Put character

    mov bx, 07h ; Attribute (color etc..)

    int 10h ; Call video

    jmp ps_loop ; Repeat until we are done



    ps_done:

    ret




  • : ps_loop:

    : lodsb ; Load ds:si into al

    : or al, al ; Check to see if it is the null terminator

    : jz ps_done ; if al==0 then return

    :

    : mov ah, 0Eh ; Put character

    : mov bx, 07h ; Attribute (color etc..)

    : int 10h ; Call video

    : jmp ps_loop ; Repeat until we are done

    :

    : ps_done:


    This is going to sound pathetic (and it is of course) but how to I load the strings address info into SI and DS? A code snippet that I looked at before (which didn't work) used LEA but gave an error (grr)...anyways...suppose I had:



    jmp ps_loop

    msg db "Put String Here",0

    ps_loop:


    ; ...something goes here...


    lodsb ; Load ds:si into al

    or al, al ; Check to see if it is the null terminator

    jz ps_done ; if al==0 then return

    mov ah, 0Eh ; Put character

    mov bx, 07h ; Attribute (color etc..)

    int 10h ; Call video

    jmp ps_loop ; Repeat until we are done

    ps_done:

    END




    What do I put where it says "Something goes here"?


    Thank you,

    Robert


  • Well I only know Masm really.. but in masm

    all you have to do to get ds to point to your

    data segment is something like this


    .data

    message db "blah blah blah", 0


    .code

    main proc

    mov ax, @data ;load the data segment address into ds..

    mov ds, ax


    mov si, offset message ; load the offset of the message into si

    call print_string ; call your print_string routine...etc..

    etc..

    etc..

    main endp




    hope this helps







  • here:


    message db 'barfo!',0


    mov si, message

    call print_string


    and the code for print string that he showed you before.

    the only thing that i have noticed it that for some reason

    the attribute doesn't seem to work with this call.

    anyone know why?





Sign In or Register to comment.