dos_compilers/DX-FORTH v430/MISC.SCR

1 line
65 KiB
Plaintext
Raw Normal View History

2024-07-09 18:07:02 +02:00
\ Miscellaneous functions \ Common forth words : 0<= ( n -- flag ) 0> 0= ; : 0>= ( n -- flag ) 0< 0= ; : <= ( n1 n2 -- flag ) > 0= ; : >= ( n1 n2 -- flag ) < 0= ; : U<= ( u1 u2 -- flag ) u> 0= ; : U>= ( u1 u2 -- flag ) u< 0= ; \ Common forth words \ Duplicate a triple number : 3DUP ( x1 x2 x3 -- x1 x2 x3 x1 x2 x3 ) dup 2over rot ; \ Negate n1/d1 if n is negative (FIG: +- D+-) : ?NEGATE ( n1 n -- n2 ) 0< if negate then ; : ?DNEGATE ( d1 n -- d2 ) 0< if dnegate then ; \ UNDER UNDER+ \ : UNDER ( a b -- a a b ) over swap ; code UNDER ( a b -- a a b ) ax pop sp bx mov 0 [bx] dx mov 2push end-code \ : UNDER+ ( a b x -- a+x b ) rot + swap ; code UNDER+ ( a b x -- a+x b ) ax pop sp bx mov ax 2 [bx] add next end-code