summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2016-02-02 22:24:49 -0800
committerMichael Pavone <pavone@retrodev.com>2016-02-02 22:24:49 -0800
commit1e14a6fefc0e20cd23b07834c329d7f84403c01f (patch)
tree887da68ee14973372bf832309c9b7ebc276c8ba1
parent046179315b057bd3a8eafadcbc3d38a3b0f01c76 (diff)
parent8428d5149537bd0c6df61467bb42b005d3d38501 (diff)
Merge
-rw-r--r--button.spec2
-rw-r--r--menu.s6863
2 files changed, 62 insertions, 3 deletions
diff --git a/button.spec b/button.spec
index 6f33a9d..1415fc7 100644
--- a/button.spec
+++ b/button.spec
@@ -1 +1 @@
-button.png,16,0,raw,interlace
+button.png,4,0,raw,interlace
diff --git a/menu.s68 b/menu.s68
index 13123bc..bae064b 100644
--- a/menu.s68
+++ b/menu.s68
@@ -516,7 +516,61 @@ ypos
move.b #$40, (PAD1_CTRL-PAD1_DATA, a2)
rts
-
+topcorner equ (button-font)/64 + 32
+topmiddle equ topcorner+1
+botcorner equ topmiddle+1
+botmiddle equ botcorner+1
+horiz_flip equ $800
+vert_flip equ $1000
+
+; draws a button
+; d0.w - x in cells
+; d1.w - y in cells
+; d2.w - width in cells
+;
+; clobbers a6
+draw_button:
+ ;multiply x by 2
+ add.w d0, d0
+ ;multiply y by 128
+ lsl.w #7, d1
+ add.w d1, d0
+ add.w #$A000, d0
+ move.w d0, d1
+ and.w #$3FFF, d0
+ rol.w #2, d1
+ and.w #3, d1
+ ori.w #(VDP_VRAM_WRITE >> 16), d0
+ swap d0
+ move.w d1, d0
+ move.l d0, (a1)
+ move.w d2, d1
+ ;top left corner
+ move.w #topcorner, (a0)
+ subq #3, d1
+ bmi .notopmiddle
+.toploop:
+ ;top middle
+ move.w #topmiddle, (a0)
+ dbra d1, .toploop
+.notopmiddle
+ ;top right corner
+ move.w #(topcorner | horiz_flip), (a0)
+ ;go to next row in name table
+ add.l #((2*64) << 16), d0
+ move.l d0, (a1)
+ ;bottom left corner
+ move.w #botcorner, (a0)
+ subq #3, d2
+ bmi .nomiddlebot
+.botloop:
+ ;bottom middle
+ move.w #botmiddle, (a0)
+ dbra d2, .botloop
+.nomiddlebot
+ ;bottom right corner
+ move.w #(botcorner | horiz_flip), (a0)
+ rts
initial_regs:
vdpreg MODE_2, $4 ;Mode 5, everything turned off
@@ -564,7 +618,7 @@ start:
;load tiles
vdpaccess $800, VDP_VRAM_WRITE
lea font(pc), a2
- move.w #((cursorend-font)/4 - 1), d0
+ move.w #((buttonend-font)/4 - 1), d0
tloop:
move.l (a2)+, (a0)
dbra d0, tloop
@@ -606,6 +660,11 @@ ploop:
move.l d0, (a0)
dbra d1, ploop
+ moveq #0, d0
+ moveq #26, d1
+ moveq #6, d2
+ bsr draw_button
+
move.l #$40860002, d3
move.l d3, (a1)
move.l d3, base_cmd.w