Tny

block

Name block
Author m15o
Instructions Use keyboard to move block. Fill spaces!
Size
Source
3 0 BRK FRM LIT 4 MOD LIT @end JCN

# draw buffer
LIT 0 LIT 10 PSH PSH do: RSI LIT 40 SFT
  LIT 0 LIT 10 PSH PSH while:
    DUP RSI ADD OVR RSI ADD LDB SET
    PUL INC PSH
    RSI RSJ NEQ LIT @while JCN
    PUL PUL POP POP POP
  PUL INC PSH
  RSI RSJ NEQ LIT @do JCN 
  PUL PUL POP POP

# draw player
LIT pos: 1F LIT 1 SET

# check collision
LIT @pos LDA LIT 10 ADD LIT 04 SFT LIT 0 EQU LIT @hit JCN
LIT @pos LDA LIT 10 ADD LDB LIT @hit JCN

# move
LIT @pos LDA LIT 10 ADD LIT @pos STA
LIT 8 KEY EQU LIT @right JCN
LIT 4 KEY EQU LIT @left  JCN
end: BRK

hit:
  LIT 1 LIT @pos LDA STB
  RND LIT 0F AND LIT @pos STA
BRK

move:
  LIT 8 KEY EQU LIT @right JCN
  LIT 4 KEY EQU LIT @left  JCN
BRK

right: LIT @pos LDA INC LDB LIT @end JCN LIT @pos LDA INC LIT @pos STA BRK
left:  LIT @pos LDA DEC LDB LIT @end JCN LIT @pos LDA DEC LIT @pos STA BRK