aboutsummaryrefslogtreecommitdiff
path: root/explosion.s
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2016-01-29 16:26:19 -0500
committerB. Watson <yalhcru@gmail.com>2016-01-29 16:26:19 -0500
commitb56d447d887cb0a3618726b4fd23b3cf0c7ae7d8 (patch)
treebc8dcaf4500f2b06c52ead43f5868d090e58bdc4 /explosion.s
parentb4bec85ebfc3a84e4b3b5797c0427ec2edba7481 (diff)
downloadtaipan-b56d447d887cb0a3618726b4fd23b3cf0c7ae7d8.tar.gz
rewrote screen-flash in asm, save a few bytes
Diffstat (limited to 'explosion.s')
-rw-r--r--explosion.s66
1 files changed, 66 insertions, 0 deletions
diff --git a/explosion.s b/explosion.s
new file mode 100644
index 0000000..581e987
--- /dev/null
+++ b/explosion.s
@@ -0,0 +1,66 @@
+; explosion seen when we're hit by enemy fire.
+; currently just flashes the screen. the apple version is
+; kinda funky-looking, best way I can describe it is that it
+; looks like TV static. would be hard to imitate that on the
+; atari. maybe there should be screen-shaking going on?
+
+; original code was in C, and looked like:
+;; for(i = 0; i < 3; i++) {
+;; unsigned char color = PEEK(710) & 0xf0;
+;; unsigned char textcolor = PEEK(709);
+;; POKE(709,0);
+;; POKE(710, color | 0x0c);
+;; jsleep(10);
+;; POKE(710, color & 0xf0);
+;; jsleep(10);
+;; POKE(709,textcolor);
+;; }
+
+ .export _explosion
+ .include "atari.inc"
+ .importzp tmp1, tmp2
+ .import _jsleep
+
+color1save = tmp1
+color2save = tmp2
+
+; extern void explosion(void);
+_explosion:
+; {
+ ; save original colors (don't hardcode, they can be changed on the title screen)
+ lda COLOR1
+ sta color1save
+ lda COLOR2
+ sta color2save
+
+ ; dark text
+ lda #0
+ sta COLOR1
+
+ ldy #3 ; loop counter, counts 3 2 1
+
+; {
+@loop:
+ lda color2save
+ ora #$0c ; embrighten text background (without changing the hue)
+ sta COLOR2
+
+ ldx #0 ;\
+ lda #$0a ; | jsleep(10);
+ jsr _jsleep ;/
+
+ lda color2save ; put text bg back like it was...
+ sta COLOR2
+
+ ldx #0 ; ...and jsleep(10) again
+ lda #$0a
+ jsr _jsleep
+
+ dey
+ bne @loop ; we're done if Y==0
+; }
+
+ lda color1save ; restore text color
+ sta COLOR1
+ rts
+; }