Hi,

> 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".
it's simply a bug in your program.

        ES:DI -> country information buffer (see #01750)

but your code does not load ES. so ES most likely points 'somewhere'
where you don't expect it.
        push ss
        pop  es
should work (otherwise use a debugger)

> If A is assigned to constant value (for i:=0 to 255 do a[i]:=2) it works.
because your smart compiler turns this into something like

    push ss
    pop es
    mov cx,256
    mov al,2
    rep stosb

and now es points to right segment.

Tom








> ------------------------------------------------------------------------------
> 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
> Freedos-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/freedos-devel



Mit freundlichen Grüßen/Kind regards
Tom Ehlert
+49-241-79886


------------------------------------------------------------------------------
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
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to