all repos — xyw @ 51f5be3e8e93c45dd88cf45723892f328abb1f84

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
; Checks if char in a is one of chars in s2
; a s2 -> f
.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