mirror of
https://github.com/nineties/planckforth
synced 2025-01-13 08:01:10 +01:00
Add 'E'
This commit is contained in:
parent
1310d1291b
commit
9b4fae9c43
1 changed files with 26 additions and 0 deletions
26
core.fs
26
core.fs
|
@ -203,4 +203,30 @@ ca i,
|
|||
\ Round up 'here' to a multiple of CELL
|
||||
cA i, 'h, '@, 'a, 'h, '!, 'e, l!
|
||||
|
||||
\ 'E' ( c-addr1 u1 c-addr2 u2 -- n ) STR=
|
||||
\ Compare two strings.
|
||||
\ Return 1 if they are same 0 otherwise.
|
||||
cE i,
|
||||
'{, '~, '}, \ ( c-addr1 c-addr2 u1 u2 )
|
||||
'o, '=, 'J, kVk0-C*, \ jump to <not_equal> if u1!=u2
|
||||
\ <loop>
|
||||
\ ( c-addr1 c-addr2 u )
|
||||
'#, 'J, kMk0-C*, \ jump to <equal> if u==0
|
||||
'{, \ preserve u
|
||||
'o, '?, \ ( c-addr1 c-addr2 c1 )
|
||||
'o, '?, \ ( c-addr1 c-addr2 c1 c2 )
|
||||
'}, \ ( c-addr1 c-addr2 c1 c2 u )
|
||||
'~, '{, '~, '}, \ ( c-addr1 c-addr2 u c1 c2 )
|
||||
'=, 'J, kFk0-C*, \ jump to <not_equal> if c1!=c2
|
||||
'{, '{, \ ( c-addr1 , R:u c-addr2 )
|
||||
'L, k1k0-, '+, \ increment c-addr1
|
||||
'}, 'L, k1k0-, '+, \ increment c-addrr2
|
||||
'}, 'L, k1k0-, '-, \ decrement u
|
||||
'j, k0kN-C*, \ jump to <loop>
|
||||
\ <equal>
|
||||
'_, '_, '_, 'L, k1k0-, 'e,
|
||||
\ <not_equal>
|
||||
'_, '_, '_, 'L, k0k0-, 'e,
|
||||
l!
|
||||
|
||||
Q
|
||||
|
|
Loading…
Reference in a new issue