|
|
2.30b OS/2
Microsoft Macro Assembler Version 5.10 7/22/93 04:16:00
mswait Page 1-1
; MSWAIT: Wait up to 30000 milliseconds
; July 1992, Steve D. @ Vertrauen 714 529-9547
setmod %mm ;set memory model
public _mswait,_mswtyp
.data
0000 00 _mswtyp db 0 ;system type for idle loop
= 0001 dosidl equ 1 ;use int 28h
= 0002 os2idl equ 2 ;use int 2fh function 1680h
.code
0000 00000000 clkvct dd 0 ;saved int 1ch vector
0004 00000000 brkvct dd 0 ;saved int 1bh vector
0008 0000 waitct dw 0 ;local 8254 tick count
000A 00 cbrk db 0 ;ctrl-break key pressed
000B clkisr proc ;interrupt 1ch (55ms tick) service routine
000B 2E: FF 0E 0008 R dec mw cs:waitct
0010 2E: FF 2E 0000 R jmp ml cs:clkvct ;exec prior service routine
0015 clkisr endp
0015 brkisr proc ;interrupt 1bh (ctrl-break) service routine
0015 2E: C6 06 000A R FF mov mb cs:cbrk,-1 ;ctrl-break depressed, set abort flag
001B 2E: FF 2E 0004 R jmp ml cs:brkvct ;exec prior service routine
0020 brkisr endp
0020 _mswait proc
0020 55 push bp
0021 8B EC mov bp,sp
0023 A0 0000 R mov al,mb _mswtyp
0026 50 push ax ;wait type flag at [bp-2]
0027 06 push es
0028 1E push ds
0029 B8 351B mov ax,351bh
002C CD 21 int 21h ;get ctrl-break vector
002E 2E: 89 1E 0004 R mov mw cs:brkvct,bx
0033 2E: 8C 06 0006 R mov mw cs:brkvct+2,es ;save old service routine address
0038 2E: C6 06 000A R 00 mov mb cs:cbrk,0 ;clear abort flag
003E B4 25 mov ah,25h
0040 0E push cs
0041 1F pop ds ;data segment is now inaccessible
0042 BA 0015 R mov dx,os brkisr
0045 CD 21 int 21h ;set new interrupt service routine
0047 B8 7530 mov ax,30000 ;maximal wait
004A 8B 56 06 mov dx,pb[bp] ;wait time in milliseconds
004D 3B C2 cmp ax,dx
004F 72 01 jc @f
0051 92 xchg ax,dx ;within range, use specification
0052 33 D2 @@: xor dx,dx ;milliseconds in dx:ax
0054 2D 000A sub ax,10 ;0-64 yields 55
0057 77 02 ja @f
0059 8B C2 mov ax,dx ;must be at least 0
005B B9 0037 @@: mov cx,55 ;milliseconds per ctc interrupt
005E F7 F1 div cx
Microsoft Macro Assembler Version 5.10 7/22/93 04:16:00
mswait Page 1-2
0060 2E: A3 0008 R mov mw cs:waitct,ax ;number of ctc interrupts to wait
0064 9C pushf ;detect cpu type
0065 B8 4000 mov ax,4000h
0068 50 push ax
0069 9D popf
006A 9C pushf
006B 58 pop ax
006C 9D popf
006D 80 E4 C0 and ah,0c0h
0070 78 7E js msxt ;80186 or earlier
0072 74 7C jz msxt ;80286
.386 ;80386
0074 66| 60 pushad
0076 B8 2B01 mov ax,2b01h ;set date (get desqview version)
0079 B9 4445 mov cx,4445h ;DE
007C BA 5351 mov dx,5351h ;SQ
007F CD 21 int 21h
0081 F6 D0 not al ;zero if desqview not running
0083 88 46 FF mov mb -1[bp],al
0086 33 C9 xor cx,cx ;running count in cx
0088 B8 0040 mov ax,40h
008B 8E C0 mov es,ax
008D BB 006C mov bx,6ch ;address bios clock
0090 26: 66| 8B 17 stwt: mov edx,ml es:[bx]
0094 2E: F6 06 000A R FF lpwt: test cs:cbrk,-1
009A 75 44 jnz s mabt ;exit on ctrl-break
009C 66| 52 push edx
009E F6 46 FF FF test mb -1[bp],-1
00A2 74 07 jz s @f ;not under desqview
00A4 B8 1000 mov ax,1000h
00A7 CD 15 int 15h ;surrender time slice, desqview
00A9 EB 0B jmp s ckwt ;continue
00AB F6 46 FE 02 @@: test mb -2[bp],os2idl
00AF 74 05 jz s ckwt ;no int 2fh call
00B1 B8 1680 mov ax,1680h
00B4 CD 2F int 2fh ;surrender time slice, os/2
00B6 F6 46 FE 01 ckwt: test mb -2[bp],dosidl
00BA 74 02 jz s @f ;no int 28h call
00BC CD 28 int 28h ;idle
00BE 66| 5A @@: pop edx
00C0 26: 66| 8B 07 mov eax,ml es:[bx]
00C4 66| 8B F0 mov esi,eax ;save latest clock value
00C7 66| 2B C2 sub eax,edx
00CA 74 C8 jz lpwt ;wait for clock change
00CC 72 C2 jc stwt ;crossed midnight, reset
00CE 66| 8B D6 mov edx,esi ;set most current value
00D1 66| 83 F8 7F cmp eax,7fh
00D5 73 09 jnc s mabt ;swapped out more than 7 seconds
00D7 03 C8 add cx,ax ;add to running total
00D9 2E: 3B 0E 0008 R cmp cx,cs:waitct ;static maximal value
00DE 76 B4 jna lpwt ;not expired, continue
00E0 66| 61 mabt: popad
00E2 B8 0182 mov ax,386 ;for test purposes
00E5 F6 46 FF FF test mb -1[bp],-1
Microsoft Macro Assembler Version 5.10 7/22/93 04:16:00
mswait Page 1-3
00E9 74 39 jz s msex
00EB B8 2892 mov ax,10386
00EE EB 34 jmp s msex
00F0 msxt: .8086
00F0 B8 351C mov ax,351ch
00F3 CD 21 int 21h ;get int 1ch vector
00F5 2E: 89 1E 0000 R mov mw cs:clkvct,bx
00FA 2E: 8C 06 0002 R mov mw cs:clkvct+2,es ;save old service routine address
00FF B4 25 mov ah,25h
0101 0E push cs
0102 1F pop ds
0103 BA 000B R mov dx,os clkisr
0106 CD 21 int 21h ;set new interrupt service routine
0108 2E: F6 06 000A R FF mswl: test cs:cbrk,-1
010E 75 08 jnz @f ;exit on ctrl-break
0110 2E: A1 0008 R mov ax,cs:waitct
0114 0B C0 or ax,ax
0116 79 F0 jns mswl ;wait for negative count
0118 B8 251C @@: mov ax,251ch
011B 2E: C5 16 0000 R lds dx,cs:clkvct
0120 CD 21 int 21h ;restore old clock sr vector
0122 33 C0 xor ax,ax ;return zero
0124 50 msex: push ax
0125 B8 251B mov ax,251bh
0128 2E: C5 16 0004 R lds dx,cs:brkvct
012D CD 21 int 21h ;restore old ctrl-break sr vector
012F 58 pop ax
0130 1F pop ds
0131 07 pop es
0132 5B pop bx ;wait type flag
0133 5D pop bp
0134 CB ret
0135 _mswait endp
end
Microsoft Macro Assembler Version 5.10 7/22/93 04:16:00
mswait Symbols-1
Macros:
N a m e Lines
.EOPG . . . . . . . . . . . . . 4
.ILIST . . . . . . . . . . . . . 2
ASA . . . . . . . . . . . . . . 1
ASTRUC . . . . . . . . . . . . . 6
ASYN . . . . . . . . . . . . . . 0
DA . . . . . . . . . . . . . . . 4
DBL . . . . . . . . . . . . . . 2
DBWW . . . . . . . . . . . . . . 2
DSA . . . . . . . . . . . . . . 4
DSB . . . . . . . . . . . . . . 4
DSS . . . . . . . . . . . . . . 8
DSTRUC . . . . . . . . . . . . . 8
DV . . . . . . . . . . . . . . . 5
INCL . . . . . . . . . . . . . . 5
SETMOD . . . . . . . . . . . . . 0
Segments and Groups:
N a m e Size Length Align Combine Class
DGROUP . . . . . . . . . . . . . GROUP
_DATA . . . . . . . . . . . . 16 Bit 0001 WORD PUBLIC 'DATA'
MSWAIT_TEXT . . . . . . . . . . 16 Bit 0135 WORD PUBLIC 'CODE'
Symbols:
N a m e Type Value Attr
AA . . . . . . . . . . . . . . . TEXT .model large
BRKISR . . . . . . . . . . . . . F PROC 0015 MSWAIT_TEXT Length = 000B
BRKVCT . . . . . . . . . . . . . L DWORD 0004 MSWAIT_TEXT
CBRK . . . . . . . . . . . . . . L BYTE 000A MSWAIT_TEXT
CKWT . . . . . . . . . . . . . . L NEAR 00B6 MSWAIT_TEXT
CLKISR . . . . . . . . . . . . . F PROC 000B MSWAIT_TEXT Length = 000A
CLKVCT . . . . . . . . . . . . . L DWORD 0000 MSWAIT_TEXT
DOSIDL . . . . . . . . . . . . . NUMBER 0001
DS1 . . . . . . . . . . . . . . TEXT label byte
DS2 . . . . . . . . . . . . . . TEXT label word
DS4 . . . . . . . . . . . . . . TEXT label dword
DS6 . . . . . . . . . . . . . . TEXT label fword
DS8 . . . . . . . . . . . . . . TEXT label qword
LISTON . . . . . . . . . . . . . NUMBER 0001
LPWT . . . . . . . . . . . . . . L NEAR 0094 MSWAIT_TEXT
MABT . . . . . . . . . . . . . . L NEAR 00E0 MSWAIT_TEXT
MB . . . . . . . . . . . . . . . TEXT byte ptr
MDLC . . . . . . . . . . . . . . TEXT compact
MDLH . . . . . . . . . . . . . . TEXT huge
MDLL . . . . . . . . . . . . . . TEXT large
MDLM . . . . . . . . . . . . . . TEXT medium
Microsoft Macro Assembler Version 5.10 7/22/93 04:16:00
mswait Symbols-2
MDLS . . . . . . . . . . . . . . TEXT small
ML . . . . . . . . . . . . . . . TEXT dword ptr
MM . . . . . . . . . . . . . . . TEXT l
MSEX . . . . . . . . . . . . . . L NEAR 0124 MSWAIT_TEXT
MSWL . . . . . . . . . . . . . . L NEAR 0108 MSWAIT_TEXT
MSXT . . . . . . . . . . . . . . L NEAR 00F0 MSWAIT_TEXT
MW . . . . . . . . . . . . . . . TEXT word ptr
OS . . . . . . . . . . . . . . . TEXT offset
OS2IDL . . . . . . . . . . . . . NUMBER 0002
PB . . . . . . . . . . . . . . . NUMBER 0006
S . . . . . . . . . . . . . . . TEXT short
STWT . . . . . . . . . . . . . . L NEAR 0090 MSWAIT_TEXT
WAITCT . . . . . . . . . . . . . L WORD 0008 MSWAIT_TEXT
@0 . . . . . . . . . . . . . . . L NEAR 0052 MSWAIT_TEXT
@1 . . . . . . . . . . . . . . . L NEAR 005B MSWAIT_TEXT
@2 . . . . . . . . . . . . . . . L NEAR 00AB MSWAIT_TEXT
@3 . . . . . . . . . . . . . . . L NEAR 00BE MSWAIT_TEXT
@4 . . . . . . . . . . . . . . . L NEAR 0118 MSWAIT_TEXT
@CODE . . . . . . . . . . . . . TEXT mswait_TEXT
@CODESIZE . . . . . . . . . . . TEXT 1
@CPU . . . . . . . . . . . . . . TEXT 257
@DATASIZE . . . . . . . . . . . TEXT 1
@FILENAME . . . . . . . . . . . TEXT mswait
@VERSION . . . . . . . . . . . . TEXT 510
_mswait . . . . . . . . . . . . F PROC 0020 MSWAIT_TEXT Global Length = 0115
_mswtyp . . . . . . . . . . . . L BYTE 0000 _DATA Global
340 Source Lines
356 Total Lines
74 Symbols
47118 + 348476 Bytes symbol space free
0 Warning Errors
0 Severe Errors
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.