########################################### # # Grad School Simulator 2014 # # "Welcome to the sunless depths of my ennui." # ########################################### : main hires draw-background loop do-behavior again : do-behavior # by AND masking an 8 bit value with 0b1110 # we can create the numbers 0,2,4,8,10,12,14,16: v0 := random 0b1110 jump0 behavior-table : behavior-table # this is a jump table. Each entry # is 1 instruction long, or 2 bytes: jump blink jump blink jump idle jump idle jump grimace jump show-icon jump show-icon jump show-icon # here I've overlapped two subroutines, # since they share the same ending instructions: : blink blink-toggle vf := 10 wait blink-toggle : idle vf := 45 wait ; : blink-toggle i := blink-mask v0 := 55 v1 := 26 sprite v0 v1 3 v0 := 65 v1 := 26 sprite v0 v1 3 ; : wait # takes a time argument in vf. # vf gets destroyed by +/-/>>/<