From f2a60e3bb115ab31b53f02f6bf10b08749d47331 Mon Sep 17 00:00:00 2001 From: Damian Yerrick Date: Sun, 3 May 2020 19:57:25 -0400 Subject: [PATCH] Status of bars in Indiana is closed Per https://backontrack.in.gov/ Indiana plans to reopen bars and nightclubs on June 14 provided COVID-19 doesn't flare up again. --- hopesup/hope.txt | 23 ++++ hopesup/makefile | 7 +- hopesup/src/bcd.asm | 100 ++++++++++++++ hopesup/src/floorvram.asm | 11 ++ hopesup/src/main.asm | 11 +- hopesup/src/statusbar.asm | 184 ++++++++++++++++++++++++++ hopesup/tilesets/16x16digits.png | Bin 465 -> 657 bytes hopesup/tilesets/otherstatustiles.png | Bin 296 -> 0 bytes 8 files changed, 332 insertions(+), 4 deletions(-) create mode 100644 hopesup/hope.txt create mode 100644 hopesup/src/bcd.asm create mode 100644 hopesup/src/statusbar.asm delete mode 100644 hopesup/tilesets/otherstatustiles.png diff --git a/hopesup/hope.txt b/hopesup/hope.txt new file mode 100644 index 0000000..2dd5ce2 --- /dev/null +++ b/hopesup/hope.txt @@ -0,0 +1,23 @@ +Hope is confidence in a positive outcome. + +1. load in-game palette +2. +3. CHR for floor +4. nametable for predefined floor +5. CHR for walls +6. nametable for walls +7. CHR for sprite +8. sprite moves +9. valid movement only +10. floor generation +11. count score +12. exit door +13. animate rolling +14. fall +15. instruction screen +16. fades +17. attract mode +18. +19. audio +20. count combo + diff --git a/hopesup/makefile b/hopesup/makefile index 91f3143..e5072db 100644 --- a/hopesup/makefile +++ b/hopesup/makefile @@ -4,7 +4,8 @@ title:=hopesup version:=wip objlist:= \ - init main ppuclear pads vwfdraw vwf7_cp144p + init main statusbar floorvram floormodel \ + bcd ppuclear pads vwfdraw vwf7_cp144p objdir:=obj/something srcdir:=src @@ -80,8 +81,8 @@ $(objdir)/%-gg.o: $(objdir)/%.asm $(srcdir)/sms.inc # Additional deps (.include/.incbin) -$(objdir)/bg.o $(objdir)/bg-gg.o: \ - $(objdir)/title.iu +$(objdir)/statusbar.o: \ + $(objdir)/16x16digits1616.2b # Linking diff --git a/hopesup/src/bcd.asm b/hopesup/src/bcd.asm new file mode 100644 index 0000000..b477452 --- /dev/null +++ b/hopesup/src/bcd.asm @@ -0,0 +1,100 @@ +; +; Binary to decimal (8-bit) +; Copyright 2018 Damian Yerrick +; +; This software is provided 'as-is', without any express or implied +; warranty. In no event will the authors be held liable for any damages +; arising from the use of this software. +; +; Permission is granted to anyone to use this software for any purpose, +; including commercial applications, and to alter it and redistribute it +; freely, subject to the following restrictions: +; +; 1. The origin of this software must not be misrepresented; you must not +; claim that you wrote the original software. If you use this software +; in a product, an acknowledgment in the product documentation would be +; appreciated but is not required. +; 2. Altered source versions must be plainly marked as such, and must not be +; misrepresented as being the original software. +; 3. This notice may not be removed or altered from any source distribution. +; +.include "src/sms.inc" + +.section "bcd" free + +;; +; Converts an 8-bit value to decimal. +; @param A the value +; @return A: tens and ones digits; B[1:0]: hundreds digit; +; B[7:2]: unspecified +bcd8bit_baa: + + rrca + rrca + rrca + rrca + ld b,a + and $0F ; bits 3-0 in A, range $00-$0F + or a ; for some odd reason, AND sets half carry to 1 + daa ; A=$00-$15 + + sla b + adc a + daa + sla b + adc a + daa ; A=$00-$63 + rl b + adc a + daa + rl b + adc a + daa + rl b + ret + +;; +; Calculates one digit of converting a fraction to a percentage. +; @param B numerator, less than C +; @param C denominator, greater than 0 +; @return A = floor(10 * B / C); B = 10 * B % C; +; CHL unchanged; D clobbered; E = 0 +pctdigit: + ld de,$1000 + + ; bit 3: A.E = B * 1.25 + ld a,b + srl a + rr e + srl a + rr e + add b + jr @have_first_carry + + ; bits 2-0: mul A.E by 2 + @bitloop: + rl e + adc a + @have_first_carry: + jr c,@yessub + cp c + jr c,@nosub + @yessub: + ; Usually A>=C so subtracting C won't borrow. But if we + ; arrived via yessub, A>256 so even though 256+A>=C, Aidentity_table + ld ix, 0 + call load_2bpp_cel + call load_2bpp_cel + + ; TODO: Color the status bar + ret + +init_status_bar: + ld hl, debughex0 + ld [hl], $C0 + inc hl + ld [hl], $DE + + ; Set background + vdp_seek_xy 0, 22 + ld b, 64 + @clrloop: + ld a, STATUS_BLANK_TILE + out [VDPDATA], a + xor a + out [VDPDATA], a + djnz @clrloop + + ; Write "Combo" + vdp_seek_xy 6, 23 + ld a, $C0 + call put2digsm + ld a, STATUS_M_TILE + call put1tileid + ld a, $B0 + call put2digsm + + ; Percent sign + ld l, <(18 * 2 + 22 * 64) + ld a, 10 + call put1digbig + + ld a, 69 + ld [max_score], a + ld a, 5 + ld [cur_combo], a + ld a, 6 + ld [cur_score], a + + ; Write level maximum score + vdp_seek_xy 27, 23 + ld a, STATUS_SLASH_TILE + call put1tileid + ld a, [max_score] + call bcd8bit_baa + call put2digsm + +update_status_bar: + + ld a, [max_score] + ld c, a + ld a, [cur_score] + cp c + jr c, @not_100pct + ld l, <(12 * 2 + 22 * 64) + ld a, $10 + call put2digbig + xor a + jr @have_last_pctdigit + @not_100pct: + ld b, a + call pctdigit + ld l, <(14 * 2 + 22 * 64) + or a + jr nz, @atleast10pct + ld a, 11 + @atleast10pct: + call put1digbig + call pctdigit + @have_last_pctdigit: + call put1digbig + + ld l, <(2 * 2 + 22 * 64) + ld a, 5 + call put2decdigbig + ld l, <(23 * 2 + 22 * 64) + ld a, 15 +put2decdigbig: + call bcd8bit_baa +put2digbig: + ld c, a + and $F0 + jr nz, @yes_tens + ld a, 11 + jr @have_tens_digit + @yes_tens: + ld a, c + and $F0 + rrca + rrca + rrca + rrca + @have_tens_digit: + call put1digbig + ld a, c + and $0F +put1digbig: + ; may trash ABDEH, must add 2 to L + add a + add a + or STATUS_BIG_DIGITS + ld h, a + + ld a, l ; Top row + call @puttileb + ld a, l ; Bottomrow + inc l + inc l + inc l + inc l + add 64 +@puttileb: + out [VDPCTRL], a + ld a, $7D + out [VDPCTRL], a + ld a, h + out [VDPDATA], a + cp STATUS_BLANK_TILE + ld a, 0 + nop + out [VDPDATA], a + nop + jr nc, @isblank1 + inc h + @isblank1: + ld a, h + out [VDPDATA], a + ld a, 0 + jr nc, @isblank2 + inc h + @isblank2: + out [VDPDATA], a + ret +.ends + +draw_debughex: + vdp_seek_xy 7, 22 + ld a, [debughex0] + call put2digsm + ld a, [debughex1] +put2digsm: + push af + rrca + rrca + rrca + rrca + call put1dig + pop af +put1dig: + or STATUS_SMALL_DIGITS +put1tileid: + out [VDPDATA], a + xor a + nop + nop + nop + out [VDPDATA], a + ret diff --git a/hopesup/tilesets/16x16digits.png b/hopesup/tilesets/16x16digits.png index 21d431e35c703e18aaf13e5640dbe164bc6318b2..1dceddbb7bf25c40708f8c63c6e6f81931d97e64 100644 GIT binary patch delta 644 zcmV-~0(s0~Zo0xO+L<=Wq`oL#e!MKPx5DV#nr(dOp0a?|S z1@QE@VI2guWdS_>q~jjDHfq>d01rQ%i)coOFTQ9J5se-0<2>LM1(jg)w8q`Ec^KqtBM*Q@z+==8Dkp8h~ ejfzd$CjSQ)f4U=MLo>tx0000bBg~rvR?nN zCZCZBiq8v74oMRi?~yopAie~ozct93$<60Ok#g2w7M>Q2V)E9{r@?27MC=S0?HNnI z42Inrkj(1Y0R2ec2CUiEKw^Lvf1!u~`qlxL21tq~M*podU_w_0$?`VVqSNsgZIi~? zz|&XHx+Q}j7$i0QlL7pt0f9=l0YF}S9kenSKA;a?wak296=mQKSH2C3_holy(D^nH zzrU^tAFgKw;DNWwg`i_1K8<|d__=9`W1Zxk0VyW~g%z_M*OLJUsao`{f8cH0F$NPA z$VibGoWHb)0ty_oA{jm#u(~e527ZA69Xhv&N!JRLfv;m4w1U@QctRPFTuA3LBf>Hm zl8i2(4Ag?UL9>e2E;|?Sa9vBSd8bf7l3W_}e;ITEoM_|rJrJL;hg5(j050Bx=0l_v tI2fGYgXYuOoai#Rcn_N28D;Y+{06xU5U|#dcWnRw002ovPDHLkV1lRN#Ge2F diff --git a/hopesup/tilesets/otherstatustiles.png b/hopesup/tilesets/otherstatustiles.png deleted file mode 100644 index 18ac4de2f9b06e9623a1249e6f692d834b14dd14..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 296 zcmV+@0oVSCP)xq7I{;0-Vw z1=tV|BcG$Z(}6d(p?!u1;6n9RfkY)xAjAeD@O10n`r7)de;EQkKn22QSKhANKAXY$ uAesO_D^y@RRKP|QX6WC_+aNR0?F9g}z=z9n@I6-m0000