From 2d7d856e4d690872d0187128a740b6ecc95722a4 Mon Sep 17 00:00:00 2001 From: Brad Nelson Date: Sun, 11 Apr 2021 14:45:12 -0700 Subject: [PATCH] Fixed bugs in timers. --- ueforth/common/boot.fs | 12 ++++++------ ueforth/esp32/timers.fs | 5 +++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ueforth/common/boot.fs b/ueforth/common/boot.fs index 5ed0049..9582286 100644 --- a/ueforth/common/boot.fs +++ b/ueforth/common/boot.fs @@ -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 + ; diff --git a/ueforth/esp32/timers.fs b/ueforth/esp32/timers.fs index cba0b30..d7e8235 100644 --- a/ueforth/esp32/timers.fs +++ b/ueforth/esp32/timers.fs @@ -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