all repos — xyw @ 12959899d893742d178fa40c30533b31c8063a97

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 a16 is one of chars in b16 (string)
; a16 b16 -> 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