Skip to content

Instantly share code, notes, and snippets.

@bakenezumi
Last active September 24, 2018 17:07
Show Gist options
  • Save bakenezumi/d7dd57ca4707f72fcc42cfa1d3c1837e to your computer and use it in GitHub Desktop.
Save bakenezumi/d7dd57ca4707f72fcc42cfa1d3c1837e to your computer and use it in GitHub Desktop.
Artifacts of EXAPUNKS meet-up at September 22, 2018

ZYZZY SAFE 2000™ API - SAFEST AROUND

  • XA

    LINK 800
    MAKE
    
    MARK DIGIT1
    COPY X #PASS
    COPY 1 #PASS
    COPY 1 #PASS
    COPY 1 #PASS
    COPY #OUTP M
    TEST M = 0
    ADDI X 1 X
    FJMP DIGIT1
    SUBI  X 1 F
    
    COPY 0 X
    MARK DIGIT2
    SEEK -9999
    COPY F #PASS
    COPY X #PASS
    COPY 1 #PASS
    COPY 1 #PASS
    NOOP
    NOOP
    COPY #OUTP M
    TEST M = 0
    ADDI X 1 X
    FJMP DIGIT2
    SUBI  X 1 F
    
    COPY 0 X
    MARK DIGIT3
    SEEK -9999
    COPY F #PASS
    COPY F #PASS
    COPY X #PASS
    COPY 1 #PASS
    NOOP
    NOOP
    NOOP
    NOOP
    COPY #OUTP M
    TEST M = 0
    ADDI X 1 X
    FJMP DIGIT3
    SUBI  X 1 F
    
    COPY 0 X
    MARK DIGIT4
    SEEK -9999
    COPY F #PASS
    COPY F #PASS
    COPY F #PASS
    COPY X #PASS
    NOOP
    NOOP
    NOOP
    NOOP
    NOOP
    NOOP
    COPY #OUTP M
    TEST M = 0
    ADDI X 1 X
    FJMP DIGIT4
    
    WIPE
    
    LINK 800
    
    GRAB 267
    LINK -1
    KILL
    LINK -1
    
  • XB

    LINK 800
    COPY #OUTP X
    MARK LOOP
    TEST X = M
    COPY T M
    JUMP LOOP
    

BRAINFU*K - MAKE AN INTERPRETER

  • XA(MODE = LOCAL)

    GRAB 300
    LINK 800
    
    MARK MAIN
    COPY F X
    
    TEST X = #LBRA
    TJMP LBRA
    TEST X = #RBRA
    TJMP RBRA
    
    COPY X M
    JUMP MAIN
    
    MARK LBRA
    COPY 1 M
    COPY M T
    TJMP MAIN
    
    MARK LBRA_LOOP
    TEST F = #RBRA
    TJMP MAIN
    JUMP LBRA_LOOP
    
    MARK RBRA
    COPY 1 M
    COPY M T
    FJMP MAIN
    
    MARK RBRA_LOOP
    SEEK -2
    TEST F = #LBRA
    TJMP MAIN
    JUMP RBRA_LOOP
    
  • XB(MODE = LOCAL)

    NOTE DATA
    LINK 800
    MAKE
    @REP 2
    COPY 0 F
    @END
    SEEK -9999
    
    MARK MAIN
    COPY M X
    TEST X = #LANG
    TJMP LANG
    TEST X = #RANG
    TJMP RANG
    TEST X = #COMA
    TJMP COMA
    TEST X = #STOP
    TJMP STOP
    TEST X = #PLUS
    TJMP PLUS
    TEST X = #MINS
    TJMP MINS
    
    COPY F M
    SEEK -1
    JUMP MAIN
    
    MARK PLUS
    COPY F X
    SEEK -1
    ADDI X 1 F
    SEEK -1
    JUMP MAIN
    
    MARK MINS
    COPY F X
    SEEK -1
    ADDI X -1 F
    SEEK -1
    JUMP MAIN
    
    MARK LANG
    SEEK -1
    JUMP MAIN
    MARK RANG
    SEEK 1
    JUMP MAIN
    
    MARK COMA
    COPY #INPT F
    SEEK -1
    JUMP MAIN
    
    MARK STOP
    COPY F #OUTP
    SEEK -1
    JUMP MAIN
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment