#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2005
    Posts
    156
    Rep Power
    10

    Nasm and hla kernel


    im writing a os in nasm and hla (mostly hla, short for high level assembly). I just started and have a kernel.asm file and textdriver.hla.

    textdriver.hla:
    Code:
    program textdriver;
    #include( "console.hhf" );
    #include( "stdlib.hhf" );
    
    static
    	str:	string;
    
    procedure write( s:uns32 ); //parameters
    begin write;
    	
    	stralloc( 128 ); //allocate space for the params
    	mov( eax, str ); //move pointer to allocated space to str
    	mov( s, str ); //move params to allocated space
    	mov( "$0xB8000", [ebx] ); //0xB8000 is the text graphics buffer type thing
    	mov( 0, ecx ); //set count variables
    	mov( 1, edx );
    	repeat;
    		mov( [eax + ecx], [ebx + ecx] ); //move character and their color 1 by 1 to the text graphics buffer
    		add( 1, ecx );
    		mov( 7, [ebx + ecx] );
    		add( 1, ecx );
    		mov( [ebx], edx );
    	until( edx = 0 );
    
    	strfree( str );	//free allocated space
    end write;
    
    begin kernel_hla;
    end textdriver;
    and more importantly, kernel.asm:
    Code:
    [bits 32]
    
    SECTION .text
    
    EXTERN write ;external function from hla program
    
    start: ;beginning
    call write 10,13,"Hello World", 0 ;write Hello World
    jmp $ ;jump to nowhere
    Am i calling the write function correctly???
    also, how can i package these into a bootable file??? (an iso image preferably).

    Note: hla compiles into masm32. There is also i small error in the hla file, if you see it, please tell me
    Any help is appreciated
    Last edited by JavaManiac; December 31st, 2005 at 02:47 PM.

IMN logo majestic logo threadwatch logo seochat tools logo