An illegal instruction in a simple ASM program?

Here is a simple getline() implemented with ASM based on the "shell" of <AOA>(DOS version), using some features of UCR1.0. Actually I changed the "shell" a little at the end of the file.
original:
zzzzzzseg segment para public 'zzzzzz'
present:
zzzzzzseg segment para public 'zzzzzzseg'
For I can't even assemble the source file without this modification.(Any one to explain this?)

The problem is that CodeView reports that there is an illegal instruction when meeting the following line.
jnc GoodMemInit


Source code is following:
.xlist
include stdlib.a
includelib stdlib.lib
.list

.586

dseg segment para public 'data'
; Global variables go here:

; Need a space between dup and () ?
strbuf byte 128 dup(0)

dseg ends

cseg segment para public 'code'
assume cs:cseg, ds:dseg
; Variables that wind up being used by the standard library routines.
; The MemInit routine uses "PSP" and "zzzzzzseg" labels. They must be
; present if you intend to use getenv, MemInit, malloc, and free.
public PSP
PSP dw ?
;--------------------------------------------
; Here is a good place to put other routines:
;-----------------------------------------------------------------
; Main is the main program. Program execution always begins here.
Main proc
mov cs:PSP, es ;Save pgm seg prefix
mov ax, seg dseg ;Set up the segment registers
mov ds, ax
mov es, ax

mov dx, 0
meminit
jnc GoodMemInit ;Illegal instrction???????????????????????
print
db "Error initializing memory manager",cr,lf,0
jmp Quit
GoodMemInit:
;***************************************************************************
; Put your main program here.
; Get characters and store them in strbuf(an address) until AL= 0Dh, or it is the 80th character.
; Add a 0 to the end of the string.
mov cx, 50h
lea bx, strbuf
mov di, bx
cld
inputString:
mov ah, 00h
int 16h
; if Carriage return
cmp al, 0Dh
je inputOver
; if Backspace
cmp al, 08h
je backspace
; if neither CR nor BS
mov ah, 0eh
int 10h
stosb
loop inputString
jmp inputOver
backspace:
mov ah, 0eh
int 10h
dec di
loop inputString
inputOver:
mov al, 0Dh
int 10h
mov al, 0Ah
int 10h

; Output strbuf until the program see the 0.
mov si, bx
mov ah, 0eh
outputString:
lodsb
int 10h
cmp al, 00h
jne outputString


;***************************************************************************
Quit: ExitPgm
Main endp
cseg ends

; Allocate a reasonable amount of space for the stack (2k).
sseg segment para stack 'stack'
stk db 256 dup ("stack ")
sseg ends

; zzzzzzseg must be the last segment that gets loaded into memory!
zzzzzzseg segment para public 'zzzzzzseg'
LastBytes db 16 dup (?)
zzzzzzseg ends
end Main
Posted on 2004-07-19 04:20:02 by dislimit
It's actually the instruction above it that is failing. There is no "meminit" instruction you forgot your CALL or INVOKE instruction in front of the routine.



meminit ; <-------------this one is failing
jnc GoodMemInit
Posted on 2004-07-19 08:11:33 by mark_larson
The reason is that I missed this line after
.586

option segment:use16

But I don't know why this caused the "illegal instruction" error.
Posted on 2004-07-19 21:50:55 by dislimit