Created
July 22, 2015 17:01
-
-
Save snake66/7cb90d24050dc583b4ad to your computer and use it in GitHub Desktop.
99 bottles of beer for Viua VM assembler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; 99 bottles of beer program for Viua VM Assembler | |
; Copyright (C) 2015 Harald Eilertsen | |
; | |
; This program is free software: you can redistribute it and/or modify | |
; it under the terms of the GNU General Public License as published by | |
; the Free Software Foundation, either version 3 of the License, or | |
; (at your option) any later version. | |
; | |
; This program is distributed in the hope that it will be useful, | |
; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
; GNU General Public License for more details. | |
; | |
; You should have received a copy of the GNU General Public License | |
; along with this program. If not, see <http://www.gnu.org/licenses/>. | |
.function: main | |
istore 0 99 | |
strstore 1 " bottles" | |
strstore 2 " of beer" | |
strstore 3 " on the wall" | |
strstore 4 "Take one down, pass it around" | |
strstore 5 "" | |
strstore 6 "No more" | |
istore 7 1 | |
jump again | |
.mark: one_beer | |
strstore 1 " bottle" | |
.mark: again | |
echo 0 | |
echo 1 | |
echo 2 | |
print 3 | |
echo 0 | |
echo 1 | |
print 2 | |
print 4 | |
idec 0 | |
branch 0 more_beer | |
echo 6 | |
jump rest | |
.mark: more_beer | |
echo 0 | |
jump rest | |
.mark: rest | |
echo 1 | |
echo 2 | |
print 3 | |
print 5 | |
ieq 8 7 0 | |
branch 8 one_beer | |
branch 0 again | |
izero 0 | |
end | |
.end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment