Hey guys!
I'm in the process of writing a bootloader and I'm having trouble printing out memory information,
using 16 bit nasm
I know INT 12h stores the low memory information in AX but I can't seem to print it out correctly.
I'm currently trying to print it by converting to ascii, moving it into a string and printing it with INT 10h but right now I just get ASCII smiley faces.
Can I get a snippet of asm on how to print the contents of AX to the screen?

I've got a function for doing that sitting on my PC, but to save me digging it up and to help you through the problem, could you show us the pseudo routine and/or assembly code for your integer to string conversion?

Smiley faces are either 0x1 or 0x2, 0x1 being a more 'hollow' face which allows the background colour through. It suggests something's certainly going wrong with your code :)

so I've got


memory: db "Mem:0000"

    xor ax,ax
    int 12h
    mov bx,ax ;confused here on 16 bit to  8 bit splitting regs
    add bh,30h ;convert to ascii
    and bh,0fh
    mov [memory+4],bh

    mov bx,ax ;fresh copy of register
    shr bh,4 ;get higher bits
    add bh,30h; convert to ascii
    and bh,,0fh
    mov [memory+5],bh

    and the same thing for bl register

I get something like a (smiley,000!!) when I try to output with int 10h
mov ax, 6745    ;any random number
xor dx,dx       ;convert 16 bit number in ax into 32 bit number in dx:ax
mov bx.10       ;radix
div bx          ;5 into dx, 674 into ax
add dl, '0'     ;convert to digit
mov mem[4], dl  ;save units column digit
xor dx,ax   ;dx:ax = 674
div bx          ;4 into dx, 67 into ax
add dl, '0'     ;convert to digit
mov mem[3], dl  ;save 10's column

And so on, obviously a loop could be made out of that.

Hey, thanks for the response.
what is mem[4] and mem[3] in your code as nasm is giving me compilation error
If I declare mem: db '0000'
then do mov [mem+3],dl it compiles but I am not seeing anything on the screen after my print function

I use masm syntax, which isn't quite the same as nasm. If I remember rightly, nasm would want you to write [mem + 4] instead of mem[4].

Personally, if I was using the bios functions, I would do the print function like this. You might need to modify it for nasm:

digits db '1234', 0

print    proc    near

    xor bx,bx           ;set vide page number and foreground colour
    lea si, digits      ;ds:si -> zero terminated string to print

    lodsb               ;load next digit and automatically increment si
    cmp al, 0           ;end of string?
    je exit             ;if so leave the loop

    mov ah, 0eh         ;bios function to print a character
    int 10h             ;print the character
    jmp next_char       ;repeat until end of string


    print endp

thanks for the quick responses!
Would you happen to know any reference I can look at to chainload my Ubuntu from my custom bootloader (virtual floppy disk) ?
I know INT 19h can be used but very lost on implementation