views:

175

answers:

1

I'm trying to develop a simple kernel using TASM, using this code:

; beroset.asm
;
; This is a primitive operating system.
;
;**********************************************************************
code segment para public use16 '_CODE'
        .386
        assume cs:code, ds:code, es:code, ss:code
        org 0
Start:
        mov     ax,cs
        mov     ds,ax
        mov     es,ax
        mov     si,offset err_msg
        call    DisplayMsg
spin:
        jmp     spin


;****************************************************************************
; DisplayMsg
;
; displays the ASCIIZ message to the screen using int 10h calls
;
; Entry:
;    ds:si ==> ASCII string
;
; Exit:
;
; Destroyed:
;    none
;
;
;****************************************************************************
DisplayMsg proc
        push    ax bx si
        cld
nextchar:
        lodsb
        or      al,al
        jz      alldone
        mov     bx,0007h
        mov     ah,0eh
        int     10h
        jmp     nextchar
alldone:
        pop     si bx ax
        ret
DisplayMsg endp


err_msg db      "Operating system found and loaded.",0

code ends
        END

Then I compile it like this:

C:\DOCUME~1\Nathan\Desktop> tasm /la /m2 beroset.asm
Turbo Assembler Version 4.1 Copyright (c) 1988, 1996 Borland International

Assembling file: beroset.asm
Error messages: None
Warning messages: None
Passes: 2
Remaining memory: 406k

C:\DOCUME~1\Nathan\Desktop> tlink beroset, loader.bin
Turbo Link Version 7.1.30.1. Copyright (c) 1987, 1996 Borland International
Fatal: No program entry point

C:\DOCUME~1\Nathan\Desktop>

What can I to correct this error?

+1  A: 

I would say that you need to end the Start: section by adding end Start at the last line like this:

code ends
end Start

But again in that code you never initialize stack... It will not work, but it sould print "Operating system found and loaded.".

UPDATE: Actually, this did the trick. I just added end Start in place of END and the "No entry point" error was gone. but you get the stack warning.

So there you go. =)

CONCERNING THE STACK: Just add this before everything:

.model  small
.stack 
Cipi
Yeah, now I got `Warning: No stack`, but how can I solve that?
Nathan Campos
Ok, I added the new update "CONCERNING THE STACK" so read it. ;)
Cipi
@Cipi: Remember that I'm just starting to use TASM, because my assembler is Nasm, I just want to be better on Assembly by learning other assemblers. Thanks very much for your help to improve myself knowledge.
Nathan Campos
I will test, if it works I will acc this answer **:-)**
Nathan Campos