;; 99 bottles of beer ;; inspired by the example in LDPL SET %beer, 99 song: SET $y, 0 ; y=0 GT %beer, $y, $a ; a=x>y JIF end_song ; if(a==0) JUMP end_song CALL print_bottles PRINT " on the wall, " CALL print_bottles PRINT ". " PRINT "Take one down, pass it around, " SET $y, 1 ; y=1 SUB %beer, $y, %beer ; x=x-y CALL print_bottles PRINL " on the wall!" JUMP song end_song: EXIT print_bottles: PRINT %beer SET $y, 1 EQ %beer, $y, $a JIF pb_plural PRINT " bottle of beer" JUMP pb_body pb_plural: PRINT " bottles of beer" pb_body: RETURN