Compatibility between 'real' dos and winXP's cmd-line for simple apps[solved]

Started by hungerTom, September 25, 2008, 10:09:11 PM

Previous topic - Next topic

hungerTom

Oh my god, I guess you were right...
I've fixed it now.

But that still doesn't explain why on earth when run inside dosbox, the code works.
Either the return command isn't correctly executed in dosbox's implementation, or maybe this is a common error and dosbox compensates for it, either way I would really like to know!

Any ideas??

MichaelW

I think the problem is that your code is depending on a behavior that is unique to DOSBox. Function 2 is from the first version of MS-DOS/PC-DOS, is documented as having no return value, and has since been superseded by function 40h, which does have a return value. I seem to recall that the later versions of MS-DOS, instead of retaining the superceded functions, replaced them with stubs that would redirect the function call to the newer function. In any case, no return value does not equate to AL preserved. Under Windows 2000, this code corrects the problem:

; Erstes Zeichen Ein/Ausgabe, Programmverzweigung steuern, Abbruch?
c1_in:  mov     ah,8h       ; Fkt. 8: Tastatur-Zeicheneingabe ohne Echo
        int     21h         ; eingegebenes Zeichen in Register AL
        cmp     al,01Bh     ; Wenn ESC
        jz      pEnde       ; Programmm abbrechen
        mov     ah,2h       ; Fkt. 2: Einzelzeichen Ausgabe
        mov     dl,al       ; Eingabezeichen in DL und
        int     21h         ; ausgeben
        PUSH AX
        mov     ah,2h
        mov     dl,020h     ; Leerzeichen in DL und
        int     21h         ; ausgeben
        POP AX
        ret


eschew obfuscation

hungerTom

QuoteI seem to recall that the later versions of MS-DOS, instead of retaining the superseded functions, replaced them with stubs that would redirect the function call to the newer function
And Dosbox of course would not do that, for maximizing its compatibility and implement the old function!?

Gentleman, we have a winner  :bg

I solved the problem by just adding the space after storing al in a seperate register, not before.

Case closed. Thanks for all the helpful input!