代码之家  ›  专栏  ›  技术社区  ›  Nathan Campos

无程序入口点tasm错误

  •  1
  • Nathan Campos  · 技术社区  · 14 年前

    我尝试使用tasm开发一个简单的内核,使用以下代码:

    ; 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
    

    然后我这样编译它:

    C:\docume~1\nathan\desktop>tasm/la/m2 beroset.asm
    Turbo汇编程序版本4.1版权所有(c)1988,1996 Borland International

    汇编文件:beroset.asm
    错误消息:无
    警告消息:无
    通过次数:2次
    剩余内存:406K

    C:\docume~1\nathan\desktop>t链接beroset,loader.bin
    涡轮链接版本7.1.30.1。版权所有(c)1987,1996 Borland International
    致命:无程序入口点

    C:\docume~1\nathan\desktop>

    我该怎么纠正这个错误?

    1 回复  |  直到 13 年前
        1
  •  1
  •   Cipi    14 年前

    我会说你需要结束 Start: 添加的节 end Start 在这样的最后一行:

    code ends
    end Start
    

    但同样,在代码中,您永远不会初始化堆栈…它将不工作,但它会打印“找到并加载操作系统”。

    更新: 事实上,这确实起了作用。我刚补充道 结束-开始 代替结束和“无入口点”错误消失。但你得到了叠加警告。

    那就这样吧。=)

    关于堆栈: 只需在所有内容之前添加:

    .model  small
    .stack