The problems, that I was writing about lately, are caused by 4DOS'
tinkering with Timer 0. Ed (DXForth creator) sent to me a little
utility to check out; it's short Forth listing, but most is assembler:

#v+
\ Check current mode of the 8253/4 PC tick timer
\
\ Compile with  DX.EXE - INCLUDE GM.F BYE

empty  also forth definitions  decimal  application

cr .( Compiling Getmode )

macro IODELAY  $EB c, 0 c, endm   \  jmp *+2

\ read Timer 0 count, result in BX
label READTIMER
  pushf  cli                            \ disable interrupts
  al al sub  al $43 # out               \ send command

  iodelay  ( iodelay  iodelay  iodelay  iodelay )
\  1 $ ) call                 \ ** alternate delay method

  $40 # al in  al bl mov                \ get low byte

  iodelay  ( iodelay  iodelay  iodelay  iodelay )
\  1 $ ) call                 \ ** alternate delay method

  $40 # al in  al bh mov                \ get high byte
  popf                                  \ enable interrupts
1 $:  ret
end-code

code GETMODE ( -- mode )
  3 # dx mov            \ assume mode 3
  500 # cx mov          \ ** retries (Turbo-C uses 100)
1 $:
  cx dec
  2 $ jcxz              \ done, count always even = mode 3
  readtimer ) call      \ read current Timer 0 counter
  1 # bx and            \ test bit 0
  1 $ jz                \ loop if count even
  dx dec                \ count was odd - must be mode 2
2 $:
  dx push               \ return with mode on stack
  next
end-code

: GM ( -- )  dos-io
  cr ." Getmode" cr
  cr ." Getting PC tick timer mode (8253/54 Timer 0)"
  cr ." press any key to stop ..." cr
  begin  getmode .  10 ms  key?  until  key drop ;

cr .( Save to disk? )  y/n [if]
  turnkey gm GM
[then]
cr cr .( Type GM to test )  cr
#v-

It's checking timer mode in a loop, displaying "2" or "3". When I ran
it from command line:

1. When used 4DOS as a command shell, it's displaying both "2" and "3"
in proportion about half-to-half.

2. When used FreeCon, it displayed only "3"s - and not a single "2".

Watched its output about half a minute in both cases.

Actually, why 4DOS is touching this timer at all? Does it really need
to change mode of operation of Timer 0? Maybe something can be done
different way, by not causing problems for programs/games, that are
using this timer?
-- 
Z.

------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user

Reply via email to