uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

string.tal (514B)


      1 @strcmp ( a* b* -- a-end* b-end* order nonzero if strings differ
      2                 OR a-end* b-end* 00    00      if strings match )
      3 	STH2
      4 	,&entry JMP
      5 
      6 	&loop ( a* a b / b* )
      7 	SUB ,&nomatch JCNk ( a* a-b nonzero / b* )
      8 	POP2 ( a* / b* )
      9 	INC2 INC2r
     10 	&entry ( a* / b* )
     11 	LDAk LDAkr STHr ( a* a b / b* )
     12 	ORAk ,&loop JCN
     13 
     14 	&nomatch ( a* a-b flag / b* )
     15 	STH2r SWP2 ( a* b* a-b flag )
     16 	JMP2r
     17 
     18 @strlen ( string-ptr* -- length^ )
     19 	LIT2r 0000
     20 	,&entry JMP
     21 
     22 	&loop
     23 	INC2 INC2r
     24 	&entry
     25 	LDAk ,&loop JCN
     26 	POP2 STH2r
     27 	JMP2r
     28