Fixed bugs in timers.

This commit is contained in:
Brad Nelson
2021-04-11 14:45:12 -07:00
parent ff731f3678
commit 2d7d856e4d
2 changed files with 9 additions and 8 deletions

View File

@ -26,12 +26,6 @@
: 4* 4 * ; : 4/ 4 / ;
: +! ( n a -- ) swap over @ + swap ! ;
( Double Words )
: 2drop ( n n -- ) drop drop ;
: 2dup ( a b -- a b a b ) over over ;
: 2@ ( a -- lo hi ) dup @ swap cell+ @ ;
: 2! ( lo hi a -- ) dup >r cell+ ! r> ! ;
( Line Comments )
: \ nl parse drop drop ; immediate
@ -40,6 +34,12 @@
: cells ( n -- n ) cell * ;
: cell/ ( n -- n ) cell / ;
( Double Words )
: 2drop ( n n -- ) drop drop ;
: 2dup ( a b -- a b a b ) over over ;
: 2@ ( a -- lo hi ) dup @ swap cell+ @ ;
: 2! ( lo hi a -- ) dup >r cell+ ! r> ! ;
( System Variables )
: 'tib ( -- a ) 'sys 0 cells + ;
: #tib ( -- a ) 'sys 1 cells + ;

View File

@ -1,8 +1,8 @@
vocabulary timers timers definitions also registers
$3ff5f00 constant TIMG_BASE
$3ff5f000 constant TIMG_BASE
( group n = 0/1, timer x = 0/1, watchdog m = 0-5 )
: TIMGn ( n x -- a ) $10000 * + TIMG_BASE + ;
: TIMGn ( n -- a ) $10000 * TIMG_BASE + ;
: TIMGn_Tx ( n x -- a ) $24 * swap TIMGn + ;
: TIMGn_TxCONFIG_REG ( n x -- a ) TIMGn_Tx 0 cells + ;
: TIMGn_TxLOHI_REG ( n x -- a ) TIMGn_Tx 1 cells + ;
@ -40,5 +40,6 @@ $3ff5f00 constant TIMG_BASE
: edgeint! ( v t ) >r 2 $4 r> t>nx TIMGn_TxCONFIG_REG m! ;
: levelint! ( v t ) >r 1 $2 r> t>nx TIMGn_TxCONFIG_REG m! ;
: alarm-enable! ( v t ) >r 0 $1 r> t>nx TIMGn_TxCONFIG_REG m! ;
: alarm-enable@ ( v t ) >r 0 $1 r> t>nx TIMGn_TxCONFIG_REG m@ ;
only forth definitions