all repos — xyw @ 0c93fbcf0b954125fea52bcba6b44f82ebbbe7c5

A minimal virtual machine and assembler for terminals.

examples/lib/oneof.xyw

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
; .include "lib/macros.xyw"

; Checks if char a16 is one of chars in b16 (string)
; a16 b16 -[xwyw]- a8
.label oneof
  POPyw
  POPxw
  .label oneof.loop
    ; if at end of string, then no char is matching 
    LDByw $00 EQU oneof.fail JCNw
    ; if char matches, ok
    LDBxyw EQU oneof.ok JCNw
    INCyw oneof.loop JMPw
    .label oneof.fail
      $00 RTS
    .label oneof.ok
      $01 RTS