all right the problem i have is this, i have 2 files
and
Now the problem is that when i run it i get to the fillarr program but when its about to take the last digit it just crashes. I tried a lot of different ways i cant understand why would it crash all the time right after i input the last number.
The '*' char isnt outputed after i enter the last number
those PutCh thingies were entered for testing purpose only. i have Masm 6.1something
Code:
INCLUDE PCMAC.INC
.model small;
.586
.stack 100h
.data;
PUBLIC numarray1
EXTRN GETDEC:FAR, PUTDEC:FAR
EXTRN fillarr:FAR, printarr:FAR;, printrev:NEAR
numarray1 dw 25 dup (?)
N dw ?
enterN db 13, 10, "Please enter the size of the array: $"
.code
main proc
_Begin
_PutStr enterN
call GetDec
mov N, ax
mov cx, N
call fillArr
mov cx, N
call printarr
_Exit 0
main endp; Ends Procedure and then the main program
end main
and
Code:
INCLUDE PCMAC.INC
.model small; General start commands, use a small model
.586; Allows for Pentium instructions
.data; Data segmet
EXTRN numarray1:WORD
EXTRN GETDEC:FAR, PUTDEC:FAR
PUBLIC fillarr
fillmsg db 13, 10, 13, 10, "Please Enter a number within the range -25 and 25: $"
errmsg db 13, 10, "Number you entered is invalid, please enter another one: $"
index dw ?
.code
fillarr PROC
mov di, OFFSET numarray1
mov ax, [di]
Loop1:
mov ax, [di]
call PutDec
_PutCh (' ')
_PutStr fillmsg
call GetDec
jmp RangeTest
OutRange:
_Putstr errmsg
call GetDec
RangeTest:
cmp ax, -25 ;if less then -25, get another number
jl OutRange
cmp ax, 25 ;if more then 25, get another number
jg OutRange
mov [di], ax
add di, 2
_PutCh ('*')
loop Loop1
fillarr endp;
ret
end
Now the problem is that when i run it i get to the fillarr program but when its about to take the last digit it just crashes. I tried a lot of different ways i cant understand why would it crash all the time right after i input the last number.
The '*' char isnt outputed after i enter the last number
those PutCh thingies were entered for testing purpose only. i have Masm 6.1something