VolksForth/sources/msdos/timer.fb.src

86 lines
5.4 KiB
Plaintext
Raw Normal View History

2017-04-23 22:25:49 +00:00
Screen 0 not modified
0 \ ks 22 dez 87
1
2 The timer utilizes the memory cell at $46C that is incremented
3 by an interrupt. A couple of words allow this timer to be
4 used for time delays.
5
6 time-of-day and date are accessed via MS-DOS calls.
7
8
9
10
11
12
13
14
15
Screen 1 not modified
0 \ BIMomat BIOS Timer ks 03 apr 88
1 Onlyforth \needs Assembler 2 loadfrom asm.scr
2
3 $46C >label Counter
4
5 \ 1193180 / 65536 = 18,206 Hz
6
7 1 2 +thru .( Timer geladen) cr
8
9
10
11
12
13
14
15
Screen 2 not modified
0 \ BIMomat BIOS Timer ks 22 dez 87
1
2 Code ticks ( -- n ) D push D: C mov A A xor
3 A D: mov Counter #) D mov C D: mov Next end-code
4
5 : timeout? ( ticks -- ticks f ) pause dup ticks - 0< ;
6
7 : till ( n -- ) BEGIN timeout? UNTIL drop ;
8
9 : time ( n -- time ) ticks + ;
10
11 : wait ( n -- ) time till ;
12
13 : seconds ( sec -- ticks ) &18206 &1000 */ ;
14
15 : minutes ( min -- ticks ) &1092 * ;
Screen 3 not modified
0 \ MS-DOS time and date ks 22 dez 87
1
2 Code date@ ( -- dd mm yy )
3 D push $2A # A+ mov $21 int A A xor D+ A- xchg
4 D push A push C D mov &1900 # D sub Next
5 end-code
6
7 Code time@ ( -- ss mm hh )
8 D push $2C # A+ mov $21 int D+ D- mov 0 # D+ mov
9 D push D+ D- mov C+ D- xchg C push Next
10 end-code
11
12
13
14
15
Screen 4 not modified
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15