# # About # # This program compares the number in a register with a constant. # # Usage: # # $ go.vm run ./compare.in # # Or compile, then execute: # # $ go.vm compile ./compare.in # $ go.vm execute ./compare.raw # store #1, 44 cmp #1, 44 jmpz equal store #1, "Inequal\n" print_str #1 exit :equal store #1, "EQUAL\n" print_str #1 store #1, "Steve" cmp #1, "Kemp" jmpnz str1 store #1, "Eek string 1 compare failed - BUG?\n" print_str #1 exit :str1 store #1, "Steve" cmp #1, "Steve" jmpz str2 store #1, "Eek string 2 compare failed - BUG?\n" print_str #1 exit :str2 store #1, "String comparisions OK\n" print_str #1 exit