2000-05-06 21:34:20 +02:00
|
|
|
; File:
|
|
|
|
; DosIdle.asm
|
|
|
|
; Description:
|
|
|
|
; Dos Idle Interrupt Call
|
|
|
|
;
|
|
|
|
; DOS-C
|
|
|
|
; Copyright (c) 1995, 1999
|
2000-05-08 06:30:00 +02:00
|
|
|
; James B. Tabor
|
2000-05-06 21:34:20 +02:00
|
|
|
; All Rights Reserved
|
|
|
|
;
|
|
|
|
; This file is part of DOS-C.
|
|
|
|
;
|
|
|
|
; DOS-C is free software; you can redistribute it and/or
|
|
|
|
; modify it under the terms of the GNU General Public License
|
|
|
|
; as published by the Free Software Foundation; either version
|
|
|
|
; 2, or (at your option) any later version.
|
|
|
|
;
|
|
|
|
; DOS-C is distributed in the hope that it will be useful, but
|
|
|
|
; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
|
|
|
|
; the GNU General Public License for more details.
|
|
|
|
;
|
|
|
|
; You should have received a copy of the GNU General Public
|
|
|
|
; License along with DOS-C; see the file COPYING. If not,
|
|
|
|
; write to the Free Software Foundation, 675 Mass Ave,
|
|
|
|
; Cambridge, MA 02139, USA.
|
|
|
|
;
|
|
|
|
;
|
|
|
|
%include "segs.inc"
|
|
|
|
|
|
|
|
PSP_USERSP equ 2eh
|
|
|
|
PSP_USERSS equ 30h
|
|
|
|
|
2003-03-12 23:43:53 +01:00
|
|
|
segment HMA_TEXT
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
|
|
global _DosIdle_int
|
2007-07-21 05:37:53 +02:00
|
|
|
global _DosIdle_hlt
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
|
|
extern _InDOS:wrt DGROUP
|
|
|
|
extern _cu_psp:wrt DGROUP
|
|
|
|
extern _MachineId:wrt DGROUP
|
|
|
|
extern critical_sp:wrt DGROUP
|
|
|
|
extern _user_r:wrt DGROUP
|
2007-07-21 05:37:53 +02:00
|
|
|
; variables as the following are "part of" module inthndlr.c
|
|
|
|
; because of the define MAIN before include globals.h there!
|
|
|
|
extern _HaltCpuWhileIdle:wrt DGROUP
|
2003-06-15 18:21:26 +02:00
|
|
|
extern _DGROUP_:wrt HMA_TEXT
|
2000-05-06 21:34:20 +02:00
|
|
|
;
|
2007-07-21 05:37:53 +02:00
|
|
|
_DosIdle_hlt:
|
|
|
|
push ds
|
|
|
|
mov ds, [cs:_DGROUP_]
|
|
|
|
cmp byte [_HaltCpuWhileIdle],1
|
|
|
|
jb DosId0
|
|
|
|
pushf
|
|
|
|
sti
|
|
|
|
hlt ; save some energy :-)
|
|
|
|
popf
|
|
|
|
DosId0: pop ds
|
|
|
|
retn
|
2000-05-06 21:34:20 +02:00
|
|
|
;
|
|
|
|
_DosIdle_int:
|
2007-07-21 05:37:53 +02:00
|
|
|
call _DosIdle_hlt
|
2000-05-06 21:34:20 +02:00
|
|
|
push ds
|
2003-06-15 18:21:26 +02:00
|
|
|
mov ds, [cs:_DGROUP_]
|
2002-10-22 04:40:19 +02:00
|
|
|
cmp byte [_InDOS],1
|
|
|
|
ja DosId1
|
2000-05-06 21:34:20 +02:00
|
|
|
call Do_DosI
|
|
|
|
DosId1:
|
|
|
|
pop ds
|
|
|
|
retn
|
|
|
|
|
|
|
|
Do_DosI:
|
|
|
|
push ax
|
|
|
|
push es
|
|
|
|
push word [_MachineId]
|
|
|
|
push word [_user_r]
|
|
|
|
push word [_user_r+2]
|
|
|
|
mov es,word [_cu_psp]
|
|
|
|
push word [es:PSP_USERSS]
|
|
|
|
push word [es:PSP_USERSP]
|
|
|
|
|
|
|
|
int 28h
|
|
|
|
|
|
|
|
mov es,word [_cu_psp]
|
|
|
|
pop word [es:PSP_USERSP]
|
|
|
|
pop word [es:PSP_USERSS]
|
|
|
|
pop word [_user_r+2]
|
|
|
|
pop word [_user_r]
|
|
|
|
pop word [_MachineId]
|
|
|
|
pop es
|
|
|
|
pop ax
|
|
|
|
ret
|
|
|
|
|
2007-07-21 05:37:53 +02:00
|
|
|
; segment _DATA ; belongs to DGROUP
|
|
|
|
; whatever db whatever
|
|
|
|
|