Created
October 2, 2015 23:01
-
-
Save anonymous/923dfd12fd8947ac0c83 to your computer and use it in GitHub Desktop.
Octo Chip8 Program
This file contains 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
Play this game by pasting the program into http://johnearnest.github.io/Octo/ |
This file contains 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
{"tickrate":"100","fillColor":"#306230","fillColor2":"#8BAC0F","blendColor":"#9BBC0F","backgroundColor":"#0F380F","buzzColor":"#333333","quietColor":"#000000","shiftQuirks":false,"loadStoreQuirks":false,"vfOrderQuirks":false,"enableXO":true} |
This file contains 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
# 8s Revenge is a remake of the Atari VCS classic Yars Revenge, made by | |
# Corwyn Kalenda ([email protected]) for Octo-ber II, the 2015 Octo Game | |
# Jam. | |
# | |
# WASD to move, V to fire. | |
# | |
# Chip8 is a virtual machine designed in 1977 for programming video games. | |
# Octo is a high level assembler, disassembler and simulator for Chip8. | |
:alias px v3 | |
:alias py v4 | |
:alias qx v5 | |
:alias qy v6 | |
:alias mx v7 | |
:alias my v8 | |
:alias gx v9 | |
:alias gy va | |
:alias zx vb | |
:alias zy vc | |
:alias flags vd | |
:const swirlyAnimMask 0b00000011 | |
:const swirlyPrepMask 0b00000100 | |
:const swirlyMoveMask 0b00001000 | |
:const shieldModeMask 0b00010000 | |
:const zorlonPrepMask 0b00100000 | |
:const zorlonShotMask 0b01000000 | |
:const playerAnimMask 0b10000000 | |
: main | |
hires | |
flags := 0b00000000 # explicitly initialize, because assumptions. | |
plane 2 | |
px := 8 | |
py := 28 | |
v0 := 8 | |
i := playerright | |
i += v0 | |
sprite px py 8 | |
qx := 116 | |
qy := 28 | |
i := swirly | |
sprite qx qy 8 | |
loop | |
# redraw the neutral zone | |
plane 1 | |
i := main | |
v0 := random 0b1111111 | |
i += v0 | |
v1 := 50 | |
v2 := 0 | |
v0 := 16 | |
sprite v1 v2 0 | |
v2 += v0 | |
i += v0 | |
sprite v1 v2 0 | |
v2 += v0 | |
i += v0 | |
sprite v1 v2 0 | |
v2 += v0 | |
i += v0 | |
sprite v1 v2 0 | |
# End Neutral Zone draw | |
#erase, update, and redraw Quotile | |
plane 2 | |
v0 := swirlyAnimMask | |
v0 &= flags | |
if v0 == 3 | |
begin | |
i := quotile | |
sprite qx qy 9 | |
#update position here | |
sprite qx qy 9 | |
else | |
i := swirly | |
if v0 == 0 | |
begin | |
v1 := 0 | |
else | |
if v0 == 1 | |
begin | |
v1 := 8 | |
i += v1 | |
else | |
if v0 == 2 | |
begin | |
v1 := 16 | |
i += v1 | |
end | |
end | |
end | |
sprite qx qy 8 | |
# set frame to next, draw, and update flags register | |
v0 += 1 | |
v1 := 8 | |
if v0 == 3 | |
begin | |
v0 := 0 | |
i := swirly | |
else | |
i += v1 | |
end | |
sprite qx qy 8 | |
v1 := 0b11111100 | |
flags &= v1 | |
flags |= v0 | |
end | |
# redraw quotile while we've still got the | |
#erase player | |
i := playerright | |
v0 := playerAnimMask | |
v0 &= flags | |
if v0 == 0 | |
begin | |
v0 := 8 | |
i += v0 | |
end | |
sprite px py 8 | |
# update player position | |
v0 := 5 if v0 key then py += -2 # keyboard W | |
v0 := 8 if v0 key then py += 2 # keyboard S | |
v0 := 7 if v0 key then px += -2 # keyboard A | |
v0 := 9 if v0 key then px += 2 # keyboard D | |
# redraw player | |
i := playerright | |
v0 := playerAnimMask | |
flags ^= v0 # advance the animation frame by toggling the flag from last frame | |
v0 &= flags | |
if v0 == 0 | |
begin | |
v0 := 8 | |
i += v0 | |
end | |
sprite px py 8 | |
# lock the framerate of this program via the delay timer: | |
loop | |
vf := delay | |
if vf != 0 then | |
again | |
vf := 3 | |
delay := vf | |
again | |
: playerright | |
0x1C 0x10 0x99 0xE6 0xE6 0x99 0x10 0x1C | |
0x40 0x70 0x99 0xE6 0xE6 0x99 0x70 0x40 | |
: quotile | |
0x0F 0x1B 0x33 0xE3 0xFF 0xE3 0x33 0x1B | |
0x0F | |
: swirly | |
0x18 0x20 0x26 0x99 0x99 0x64 0x04 0x18 | |
0x06 0x88 0x90 0x5C 0x3A 0x09 0x11 0x60 | |
0x20 0x46 0x49 0x38 0x1C 0x92 0x62 0x04 | |
: missile | |
0x7E 0x7E | |
: shield | |
#two copies of sheild buffer for scrolling/rotation purposes | |
0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF | |
0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment