At 09:41 AM 11/30/2012, Ladislav Lacina wrote:
>I found strange and undocumented behaviour in kernel function INT21h/AX=6501h
>I wanted to report this as a bug but MS-DOS 7.1 has exactly the same
>behaviour.
>
>We have this snippet of code:
>
>var a:array[0..255] of byte;
>begin
>asm
>  seges lea di,a
>  mov bx,0ffffh
>  mov dx,0ffffh
>  mov cx,256
>  mov ax,6501h
>  int 21h
>end;
>
>It should return my country code and code page. But it sometimes works and
>sometimes not.
>It depends  on values in A array.
>If A is zeroed (for i:=0 to 255 do a[i]:=0) it works.
>If A is assigned to constant value (for i:=0 to 255 do a[i]:=2) it works.
>But if I make: "for i:=0 to 255 do a[i]:=i" it does not work.
>
>This behaviour is not documented in RBIL.
>However MS-DOS 7.1 acts in same way as FreeDOS so I don't know whether is this
>  bug or "feature".

Well, there are several issues:

- first of all, 21h/65xx is an "undocumented" call, also labeled 
"internal" in RBIL
- second, I don't know what you are setting all those registers to, 
as that does not comply with the description of this function call

As for the call as you call it, RBIL states that of the calls with 
AL=01h/02h, DS:DX is a pointer to the string to be capitalize. 
Assuming you are using Borland/Turbo Pascal here (and doen't know 
what that seges instruction is supposed to do) and that "a" is a 
global variable (and hence in the DATA segment, to which DS by 
default should point to), you are setting the offset in DX to 0ffffh 
instead of the offset of "a" within DS, you simply can't expect to 
get any reasonable result. Everything's a purely random to begin with...

Ralf 


------------------------------------------------------------------------------
Keep yourself connected to Go Parallel: 
TUNE You got it built. Now make it sing. Tune shows you how.
http://goparallel.sourceforge.net
_______________________________________________
Freedos-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to