Skip to content

Instantly share code, notes, and snippets.

@TG9541
Created January 2, 2019 16:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TG9541/6315b95507d48a735d48b8525da46103 to your computer and use it in GitHub Desktop.
Save TG9541/6315b95507d48a735d48b8525da46103 to your computer and use it in GitHub Desktop.
STM8 eForth dependencies of MBTEST
#require UARTISR
#require CRC16
#require WIPE
NVM
: mbslv ( -- c )
rxbuf C@
;
: mbfc ( -- c )
rxbuf 1+ C@
;
: mbp1 ( -- n )
rxbuf 2+ @
;
: mbp2 ( -- n )
rxbuf 4 + @
;
: MBCRC ( a1 a0 -- crc-le )
\ -1 ( CRC seed ) OVER rxbuf ( a1 -1 a1 a0 ) DO
-1 ROT ROT ( -1 a1 a0 ) DO
I C@ CRC16
LOOP
( CRC16 ) EXG ( CRC-LE )
;
RAM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment