TASM给出错误"前向参考需要覆盖"

时间:2014-03-18 15:11:59

标签: assembly syntax tasm

组装时程序中有很多错误。但是产生了相同的错误消息:

Forward reference needs override.

我在DOSBOX中使用TASM。 我有这个程序的可执行文件,它运行良好。我的问题是为什么 没有组装。

; "Spanzuratoare"   (by Ostafiev Sorin)
s segment
assume cs:s
org 100h
start:
  jmp real
circle    proc far
          public circle
          push bp
          mov  bp,sp
          mov  ax,[bp+10]
          mov  bx,1000
          imul bx
          mov  cx,[bp+8]
          idiv cx
          push ax
          xchg ax,cx
          mov  cx,[bp+10]
          imul bx
          idiv cx
          mov  [bp+8],ax
          pop  ax
          mov  [bp+10],ax
          mov  ax,[bp+12]
          mov  bx,1000
          imul bx
          xor  di,di
cr5:      push ax
          push dx
          xor  bx,bx
          add  ax,500
          adc  dx,bx
          mov  bx,1000
          idiv bx
          mov  bx,ax
          add  ax,[bp+16]
          mov  dx,[bp+14]
          sub  dx,di
          mov  cx,ax
          mov  al,[bp+6]
          mov  ah,12
          push ax
          int   10h
          pop  ax
          sub  cx,bx
          sub  cx,bx
          push ax
          int   10h
          pop  ax
          add  dx,di




          add  dx,di
          push ax
          int   10h
          pop  ax
          add  cx,bx
          add  cx,bx
          int   10h
          xchg cx,bx
          inc  di
          mov  ax,di
          mov  bx,[bp+8]
          imul bx
          idiv cx
          xor  dx,dx
          mov  si,ax
          idiv bx
          cmp  ax,1
          pop  dx
          pop  ax
          jae  cr7
          neg  si
          mov  bx,-1
          add  ax,si
          adc  dx,bx
          jmp  short cr5
cr7:      mov  ax,di
          mov  bx,1000
          imul bx
          mov  di,cx
          dec  di
cr8:      push ax
          push dx
          xor  bx,bx
          add  ax,500
          adc  dx,bx
          mov  bx,1000
          idiv bx
          mov  bx,ax
          add  ax,[bp+14]
          mov  cx,[bp+16]
          add  cx,di
          mov  dx,ax
          mov  al,[bp+6]
          mov  ah,12
          push ax
          int   10h
          pop  ax
          sub  cx,di
          sub  cx,di
          push ax
          int   10h
          pop  ax
          sub  dx,bx
          sub  dx,bx
          push ax
          int   10h
          pop  ax
          add  cx,di
          add  cx,di
          int   10h
          sub  dx,[bp+14]
          neg  dx
          xchg cx,dx
          or   di,di
          js   cr11
          dec  di
          mov  ax,di
          mov  bx,[bp+10]
          imul bx
          idiv cx
          mov  si,ax
          pop  dx
          pop  ax
          xor  bx,bx
          or   si,si
          jns  cr10
          mov  bx,-1
cr10:     add  ax,si
          adc  dx,bx
          jmp  short cr8
cr11:     add  sp,4
          pop  bp
          ret  12
circle    endp
x1       dw ?
y1       dw ?
x2       dw ?
y2       dw ?
color    db ?
len      dw ?
skip     dw ?
menu_color db 11
inc_x  equ  41h
dec_x  equ  49h
inc_y  equ  42h
dec_y  equ  4ah
adj_long_axis   equ  byte ptr cs:[di]
adj_master      equ  word ptr cs:[di+3]
test_master     equ  word ptr cs:[di+7]
alt_adj_master  equ  word ptr cs:[di+13]
adj_shrt_axis   equ  byte ptr cs:[di+15]
drawline proc
        mov   bl,inc_x
        mov   ax,x2
        sub   ax,x1
        jge   dll
        mov   bl,dec_x
        neg   ax
dll:    mov   cx,ax
        mov   bh,inc_y
        mov   ax,y2
        sub   ax,y1
        jge   pqw
        mov   bh,dec_y
        neg   ax
pqw:    mov   dx,ax
        mov   di,offset cs:modify_base
        cmp   dx,cx
        jge   mmm
        xchg  cx,dx
        xchg  bl,bh
mmm:    mov   adj_long_axis,bh
        mov   adj_master,cx
        shr   cx,1
        mov   test_master,cx
        mov   alt_adj_master,dx
        mov   adj_shrt_axis,bl
        mov   di,dx
        cmp   len,0
        je    tuy
        mov   di,len
tuy:    mov   bp,skip
        mov   cx,x1
        mov   dx,y1
        mov   al,color
        xor   bx,bx
edl:    cmp   bp,0
        je    okp
        dec   bp
        jmp   short npl
okp:    call  plotdot
modify_base   label   byte
npl:    inc   cx
        add   bx,1111h
        cmp   bx,1111h
        jle   dfm
        sub   bx,1111h
        inc   dx
dfm:    dec   di
        jge   edl
        ret
drawline  endp
plotdot  proc
        push  ax
        push  di
        push  bp
        mov   ah,12
        int   10h
        pop   bp
        pop   di
        pop   ax
        ret
plotdot  endp
putmenu proc
        call clear
        xor bh,bh
        mov bl,14
        mov cx,no1-span
        mov dx,060bh
        mov bp,offset span
        mov ax,cs
        mov es,ax
        mov ax,1300h
        int 10h
        xor bh,bh
        mov bl,menu_color
        mov cx,no2-no1
        mov dx,0b08h
        mov bp,offset no1
        mov ax,cs
        mov es,ax
        mov ax,1300h
        int 10h
        xor bh,bh
        mov bl,menu_color
        mov cx,no3-no2
        mov dx,0d08h
        mov bp,offset no2
        mov ax,cs
        mov es,ax
        mov ax,1300h
        int 10h
        xor bh,bh
        mov bl,menu_color
        mov cx,no4-no3
        mov dx,0f08h
        mov bp,offset no3
        mov ax,cs
        mov es,ax
        mov ax,1300h
        int 10h
        ret
putmenu endp
clear proc
        mov ax,0a000h
        mov ds,ax
        mov bx,64000
        xor al,al
la11:   mov ds:[bx],al
        dec bx
        jnz la11
        ret
clear endp
drawwrd proc
        xor bh,bh
        mov bl,14
        mov cx,cnt
        inc cx
        mov dx,0b00h
        add dx,6
        mov bp,offset stars
        mov ax,cs
        mov es,ax
        mov ax,1300h
        int 10h
        mov ax,1302h
        mov bh,0
        mov cx,1
        mov dx,cnt
        inc dx
        add dx,5
        mov dh,0bh
        push cs
        pop es
        mov bp,offset crs
        int 10h
        xor bh,bh
        mov bl,14
        mov cx,30
        sub cx,cnt
        dec cx
        mov dx,7
        add dx,cnt
        mov dh,0bh
        mov bp,offset wrdback
        mov ax,cs
        mov es,ax
        mov ax,1300h
        int 10h
        ret
drawwrd endp
pos1 proc
        mov x1,270
        mov y1,20
        mov x2,270
        mov y2,185
        mov color,13
        mov len,0
        mov skip,0
        call drawline
        mov x2,200
        mov y2,20
        call drawline
        mov x1,200
        mov y1,20
        mov x2,200
        mov y2,41
        call drawline
        mov x1,140
        mov y1,185
        mov x2,130
        mov y2,195
        mov cx,16
laslk:
        push cx
        add x1,10
        add x2,10
        call drawline
        pop cx
        dec cx
        jnz laslk
        mov x1,138
        mov y1,185
        mov x2,305
        mov y2,185
        call drawline
        ret
pos1 endp
pos2 proc
        push 200
        push 60
        push 20
        push 5
        push 6
        push 14
        call circle
        push 191
        push 55
        push 3
        push 5
        push 6
        push 14
        call circle
        push 209
        push 55
        push 3
        push 5
        push 6
        push 14
        call circle
        mov x1,200
        mov y1,53
        mov x2,200
        mov y2,65
        mov color,14
        mov len,0
        mov skip,0
        call drawline
        mov x1,195
        mov y1,70+1
        mov x2,205
        mov y2,70+1
        call drawline
        mov x2,193
        mov y2,68+1
        call drawline
        mov x1,205
        mov y1,70+1
        mov x2,207
        mov y2,68+1
        call drawline
        ret
pos2 endp
pos3 proc
        mov x1,200-3
        mov y1,79
        mov x2,200-2
        mov y2,85
        mov color,14
        mov len,0
        mov skip,0
        call drawline
        mov x1,200+3
        mov x2,200+2
        call drawline
        mov x1,200-20
        mov y1,85
        mov x2,200+20
        mov y2,85
        call drawline


        mov x2,200-20-5
        mov y2,90
        call drawline
        mov x1,200+20
        mov x2,200+20+5
        call drawline
        mov x1,200+20+5
        mov y1,120
        call drawline
        mov x2,200-20-5
        mov y2,120
        call drawline
        mov x1,200-20-5
        mov y1,90
        call drawline
        ret
pos3 endp
pos4 proc
        mov x1,200-20-2
        mov y1,85+2
        mov x2,200-20-30
        mov y2,85+15
        mov color,14
        mov skip,0
        mov len,0
        call drawline
        mov x1,200+20+2
        mov y1,85+2
        mov x2,200+20+30
        mov y2,85+15
        call drawline
        ret
pos4 endp
pos5 proc
        mov x1,200-15
        mov y1,160
        mov x2,200-10
        mov y2,120
        call drawline
        mov x2,200-20
        mov y2,161
        call drawline
        mov x1,200+15
        mov y1,160
        mov x2,200+10
        mov y2,120
        call drawline
        mov x2,200+20
        mov y2,161
        call drawline
        ret
pos5 endp
pos6 proc
        mov x1,160
        mov y1,170
        mov x2,180
        mov y2,170
        mov color,2
        mov skip,0
        mov len,0
        call drawline
        mov x1,180
        mov y1,183
        call drawline
        mov x2,160
        mov y2,183
        call drawline
        mov x1,160
        mov y1,155
        call drawline
        mov x2,162
        mov y2,155
        call drawline
        mov x1,162
        mov y1,170
        call drawline
        push 161
        push 153
        push 2
        push 5
        push 6
        push 2
        call circle
        ret
pos6 endp
pos7 proc
        push 250-15
        push 173
        push 10
        push 5
        push 6
        push 3
        call circle
        mov x1,248-15
        mov y1,163
        mov x2,248-15
        mov y2,155
        mov color,3
        mov skip,0
        mov len,0
        call drawline
        mov x1,245-15
        mov y1,155
        call drawline
        mov x2,245-15
        mov y2,153
        call drawline
        mov x1,255-15
        mov y1,153
        call drawline
        mov x2,255-15
        mov y2,155
        call drawline
        mov x1,252-15
        mov y1,155
        call drawline
        mov x2,252-15
        mov y2,163
        call drawline
        ret
pos7 endp
pos8 proc
        mov x1,122
        mov y1,15
        mov x2,122
        mov y2,199
        mov color,4
        mov skip,0
        mov len,0
        mov cx,19
kkfd:   push cx
        add x2,10
        add x1,10
        call drawline
        pop cx
        dec cx
        jnz kkfd
        mov x1,122
        mov x2,319
        mov y1,12
        mov y2,12
        mov cx,18
fgfl:   push cx
        add y1,10
        add y2,10
        call drawline
        pop cx
        dec cx
        jnz fgfl
        ret
pos8 endp
drawpos proc
        cmp pos,8
        ja by1
        call pos1
        cmp pos,7

        ja by1
        call pos2
        cmp pos,6
        ja by1
        call pos3
        cmp pos,5
        ja by1
        call pos4
        cmp pos,4
        ja by1
        call pos5
        cmp pos,3
        ja by1
        call pos6
        cmp pos,2
        ja by1
        call pos7
        cmp pos,1
        ja by1
        call pos8
by1:    ret
drawpos endp
givekey proc
        call freekeys
        mov ah,0
        int 16h
        mov ky,ah
        ret
givekey endp
drawww proc
        xor bh,bh
        mov bl,14
        mov cx,cnt
        mov dx,0105h
        mov bp,offset ww
        mov ax,cs
        mov es,ax
        mov ax,1300h
        int 10h
        ret
drawww endp
testkey proc
        mov keyok,0
        mov bp,cnt
        mov si,offset wrd
        mov di,offset ww
        push cs
        pop ds
        push cs
        pop es
laskj:  push bp
        cmp ds:[si+bp],al
        jnz dkjd
        mov keyok,1
        mov es:[di+bp-1],al
dkjd:   pop bp
        dec bp
        jnz laskj
        ret
testkey endp
loser proc
        call clear
        push cs
        pop es
        mov bp,offset str_loser
        mov dx,0b0eh
        mov cx,str_winner-str_loser
        mov bx,7
        mov ax,1300h
        int 10h
        push cs
        pop es
        mov bp,offset str_era
        mov dx,0e06h
        mov cx,str_era_end-str_era
        mov bx,7
        mov ax,1300h
        int 10h
        push cs
        pop es
        mov bp,offset wrd
        mov dx,0e13h
        mov cx,cnt
        inc cx
        mov bx,7
        mov ax,1300h
        int 10h
        call waitkey
        ret
loser endp
str_loser db 'loser'
str_winner db 'winner'
str_lala db ?
str_era db 'cuvantul era:'
str_era_end db ?
winner proc
        call clear
        push cs
        pop es
        mov bp,offset str_winner
        mov dx,0b0eh
        mov cx,str_lala-str_winner
        mov bx,7
        mov ax,1300h
        int 10h
        call waitkey
        ret
winner endp
gatap proc
        call egata
        cmp gata,1
        jz go112
        call loser
        jmp lkk
go112:  call winner
lkk:    ret
gatap endp
egata proc
        mov bx,1
        mov si,cnt
        push cs
        pop ds
        mov bp,offset ww
dfk:    push si
        cmp byte ptr ds:[bp+si-1],'-'
        jnz dkj
        mov bx,0
dkj:    pop si
        dec si
        cmp si,0
        jnz dfk
        mov gata,bx
        ret
egata endp
resetwr proc
        mov bp,40
        push cs
        pop ds
        mov si,offset ww
ddfd:   mov byte ptr ds:[si+bp-1],'-'
        dec bp
        cmp bp,0
        jnz ddfd
        ret
resetwr endp
play proc
        cmp sepoate,0
        jnz meme
        ret
meme:
        call clear
        call resetwr
        mov pos,8
        mov gata,0
sdsd:   call drawww
        call egata
        cmp gata,1
        jz gtgt
        call drawpos
        call givekey
        call testkey
        cmp keyok,1
        jz gdod
        dec pos
gdod:   cmp pos,0
        jnz sdsd
gtgt:   call gatap
        call clear
        ret
play endp
freekeys proc
cec1:   mov ah,01h
        int 16h
        jz ga1
        mov ah,0
        int 16h
        jmp cec1
ga1:    ret
freekeys endp
enterword proc
        mov sepoate,1
        call clear
        call freekeys
        xor bh,bh
        mov bl,14
        mov cx,wrd-entr
        mov dx,070dh
        mov bp,offset entr
        mov ax,cs
        mov es,ax
        mov ax,1300h
        int 10h
        mov cnt,0
        call drawwrd
la111:  mov ah,0
        int 16h
        cmp ah,28
        jz en
        cmp ah,1
        jz la111
        cmp ah,14
        jnz noba
        cmp cnt,0
        jz bad1
        dec cnt
bad1:   jmp bad2
noba:   cmp cnt,29
        jz bad2
        inc cnt
        mov bx,offset wrd
        add bx,cnt
        mov cs:[bx],al
bad2:   call drawwrd
        jmp la111
en:     cmp cnt,0
        jz la111
        cmp cnt,1
        jz la111
        ret
enterword endp
waitkey proc
        call freekeys
        mov ah,0
        int 16h
        ret
waitkey endp
entr db 'datzi cuvantul'
wrd db 30 dup (?)
crs db 219
wrdback db '------------------------------'
cnt dw 0
stars db '******************************'
span db 'SPANZURATOAREA'
no1 db '1 - New Game'
no2 db '2 - Introducetzi cuvantul'
no3 db 'ESC - Iesire'
no4 db ?
pos db 8
keyok db 0
ky db 0
ww db '------------------------------'
gata dw ?
sepoate db 0
real:   mov ax,13h
        int 10h
        call putmenu
lala1:  in al,60h
        cmp al,1
        jz bye
        cmp al,2
        jnz skip1
        call play
        call putmenu
skip1:  cmp al,3
        jnz lala1
        call enterword
        call putmenu
        jmp lala1
bye:    mov ax,3h
        int 10h
        ret
s ends
end start

1 个答案:

答案 0 :(得分:1)

  

生成了相同的错误消息:正向引用需要覆盖。

从“Turbo汇编程序版本4.0用户指南”的第229页开始(如果您查看手册的不同版本,页码可能会有所不同):

  

通常,Turbo Assembler充当单通道汇编程序。如果您使用Turbo Assembler的多次传递功能(使用 /m命令行开关调用),则会在必要时使用多次传递