The MASM Forum

General => The Workshop => Topic started by: Shintaro on March 03, 2020, 12:46:37 PM

Title: What library is "_stddata.ah" from?
Post by: Shintaro on March 03, 2020, 12:46:37 PM
Hi,
I was playing around with MS DOS in Virtual box and found that the program dosidle didn't like emm386.
The program included the source, and there was a comment that it was compiled with Tasm 4.0.
What I don't know is where the following libraries are from:

ideal                                   ; Yep, this prog is TASM 4.0 coded!
include "_stddata.ah"
include "_tsrres.ah"
include "_dcon.ah"

Does anyone recognise these libraries?
(Source attached)

Cheers.
Title: Re: What library is "_stddata.ah" from?
Post by: mabdelouahab on March 03, 2020, 09:42:44 PM
try japheth DosIdle
from:  https://www.japheth.de/dwnload4.html (https://www.japheth.de/dwnload4.html)


;--- IDLE detection driver for DOS, written for MASM
;--- to be used in virtual environments

.286
        .model small
        .386

?DRIVER equ 1 ;make a DOS driver
?V86CHECK equ 0 ;1=dont install in v86 mode
?IFCHECK equ 0 ;1=only hlt if IF is set
?INT16 equ 0

.code

if ?DRIVER

IODAT   struct ;structure for dos device drivers
cmdlen  db      ?           ;+0
unit    db      ?
cmd     db      ?
status  dw      ?           ;+3
        db      8 dup (?)   ;+5
media   db      ?           ;+0Dh
trans   dd      ?           ;+0Eh
count   dw      ?           ;+12h
start   dw      ?           ;+14h
drive   db      ?           ;+16h
IODAT   ends

        dw 0ffffh
        dw 0ffffh
        dw 8000h                  ;attribute
        dw offset devstrat        ;device strategy
diaddr  dw offset devint1         ;device interrupt
        db 'DOSIDLE$'             ;device name 8 chars (use carefully)

saveptr dd 0

devstrat proc far
        mov cs:word ptr [saveptr+0],bx
        mov cs:word ptr [saveptr+2],es
        ret
devstrat endp

devint2 proc far
        push    ds
        push    bx
        lds bx,cs:[saveptr]
        mov     [bx.IODAT.status],8103h
        pop     bx
        pop     ds
        ret
devint2 endp

endif

IRETS struct
wIP dw ?
wCS dw ?
wFL dw ?
IRETS ends

oldint28 dd 0
oldint2F dd 0
if ?INT16
oldint16 dd 0
endif

int28 proc
pushf
        call cs:[oldint28]
perform_hlt::
if ?IFCHECK
push bp
        mov bp,sp
        test byte ptr [bp+2].IRETS.wFL+1,2
pop bp
        jz @F
endif       
        sti
        nop
hlt
@@:       
        iret
int28 endp


int2f proc
pushf
cmp ax,1680h
        jz @F
        popf
        jmp cs:[oldint2F]
@@:
call cs:[oldint2F]
        mov al,00
        jmp perform_hlt
int2f endp

if ?INT16

cnt16 db 16

int16 proc
cmp ah,01h
        jz @F
cmp ah,11h
        jz @F
        jmp cs:[oldint16]
@@:
pushf
call cs:[oldint16]
        pushf
        jnz @F
        dec cs:[cnt16]
        jnz @F
        sti
        nop
        hlt
        mov cs:[cnt16],16
@@:
popf
push bp
        mov  bp,sp
        push ax
        lahf
        mov  [bp+2+4],ah
        pop ax
        pop bp
iret
int16 endp

endif

endres equ $

if ?DRIVER

devint1 proc far
        pusha
        push    ds
        lds     bx,cs:[saveptr]
        mov     [bx.IODAT.status],8103h
        cmp     [bx.IODAT.cmd],00
        jnz     @F
        mov     [bx.IODAT.status],0100h
mov cs:[diaddr], offset devint2
        mov     word ptr [bx+0eh],offset endres
        mov     word ptr [bx+10h],cs
push es
call install
pop es
@@:       
        pop     ds
        popa
        ret
devint1 endp

endif

install proc
if ?V86CHECK
smsw ax
        test al,1
        jnz error
endif       
        mov ax,3528h
        int 21h
        mov word ptr cs:[oldint28+0], bx
        mov word ptr cs:[oldint28+2], es
        mov ax,352Fh
        int 21h
        mov word ptr cs:[oldint2F+0], bx
        mov word ptr cs:[oldint2F+2], es
if ?INT16       
        mov ax,3516h
        int 21h
        mov word ptr cs:[oldint16+0], bx
        mov word ptr cs:[oldint16+2], es
endif       
        push cs
        pop ds
        mov dx,int28
        mov ax,2528h
        int 21h
        mov dx,int2f
        mov ax,252Fh
        int 21h
if ?INT16
        mov dx,int16
        mov ax,2516h
        int 21h
endif
        clc
        ret
if ?V86CHECK       
error:       
push cs
        pop ds
mov dx,offset szMsg1
        mov ah,9
        int 21h
        stc
ret
endif       
install endp

main proc c

        mov es,es:[2Ch]
        mov ah,49h
        int 21h
        call install
        jc exit
        mov dx,offset endres
        shr dx,4
        add dx,11h
        mov ax,3100h
        int 21h
exit:       
ret
main    endp

if ?V86CHECK
szMsg1  db "cpu is in v86 mode, dosidle not installed",13,10,'$'
endif

start:
        call main
mov ah,4Ch
        int 21h

        END start