YVEL equ 200 GRAVITY equ 10 JUMPX equ 60 STOPX equ 155 SHAKEAMP equ 6 BACKGROUND equ $37 SIGNCLR equ $24 MAC HARRY_LOGIC KickLUT byte 3,3,3,5,6,6,6,5 HarryLogic lda frame and #3 bne NotShaking lda shakelines beq NotShaking dec shakelines NotShaking ;fade in ;TODO: better fade lda bknz bne SetBK lda frame lsr lsr lsr cmp #(BACKGROUND & $0F) bcc SetBK sta bknz lda #(BACKGROUND & $0F) SetBK ora #(BACKGROUND & $F0) sta bk lda tempoCount cmp #TEMPODELAY/2 lda beat rol tax lda measure cmp #FADEMEASURE bcs FadeOut cmp #SIGNMEASURE bcc IntroPart ;the sign is visible. harry and ground too ;I could do a nice wipe, but I'm just going to hide the latter two for now bne NoDropStart txa bcs StaBurntop NoDropStart cmp #SIGNMEASURE+1 beq DoneBounce ;stay still lda SinTab,X clc adc #40 StaBurntop sta burntop lda #LINES-2*SVLOGOLINES-11 ;the -11 is due to the shake sec sbc burntop sta burnbottom lda #1 sta skipharry ;lda #2*SVLOGOLINES-1 ;sta logoystart DoneBounce rts FadeOut tax lda beat eor #31 lsr cpx #FADEMEASURE+1 bcc DontFadeText sta textand lda #0 ;sta textor ;uncomment this to fade the text from white to black DontFadeText sta bk sta signclr rts IntroPart cmp #WALKMEASURE bcc InitialStop beq HarryWalk ;begin standing logic InitialStop ldx #0 ldy #0 cmp #EXCLMEASURE bne SetNoExcl ldx #16 SetNoExcl stx drawexcl ldy #0 cmp #TURNMEASUR3 bcs Reflect cmp #TURNMEASURE2 bcs NoReflect cmp #TURNMEASURE bcc NoReflect Reflect ldy #8 NoReflect sty REFP0 ldx harryxpos beq InitialStop2 cpx #STOPX bne HarryWalk InitialStop2 cmp #KICKMEASURE bcc NotKicking cmp #KICKMEASURE+KICKLENGTH bcs NotKicking lda beat asr #14 tax cpx #4 ;kick frame bne NoShake lda shakelines ;shakelines = impulse, ramps down bne NoShake ;don't hold it up lda #SHAKEAMP-1 sta shakelines NoShake lda KickLUT,X byte $0C NotKicking lda #5 bne HarryOnGround ;end standing logic ;begin walking logic HarryWalk lda frame and #1 clc adc harryxpos sta harryxpos cmp #JUMPX bne NoJump ldx #YVEL stx harryyvel+1 NoJump ldx harryyvel+1 lda harryypos+1 bne DoGravity cpx #0 bmi NoGravity ;negavite velocity and on ground DoGravity lda harryyvel adc harryypos sta harryypos lda harryyvel+1 adc harryypos+1 sta harryypos+1 lda harryyvel sec sbc #GRAVITY sta harryyvel txa sbc #0 sta harryyvel+1 NoGravity lda frame and #3 cmp #1 bne NoNewFrame dec harryfrm lda harryfrm bpl HarryFrmOK lda #4 sta harryfrm HarryFrmOK ldx harryypos+1 beq HarryOnGround lda #0 HarryOnGround ;end walking logic - frame in accumulator ;*21 sta temp+1 asl asl sta temp asl asl adc temp adc temp+1 adc #Harry adc #0 sta harryptr+1 NoNewFrame ldx harryxpos lda frame and #3 bne NoShakeDrop lda shakelines bne DoDrop NoShakeDrop cpx #JUMPX ;FIXME: we should be able to do this further up where we compare with JUMPX, but it's not working for some reason bcc NoDrop cpx #JUMPX+20 bcs NoDrop DoDrop ldy burnbottom dey bmi NoDrop ;bee+ sty burnbottom NoDrop inx ;hack to make harry not stick out to the right initially txa ldx #0 jsr PositionObject lda #87 sec sbc burnbottom sta logoystart rts ENDM MAC HARRY_KERNEL HarryKernel lda bk ldx burntop beq NoBurnTop ;bleh sta COLUBK jsr Burn NoBurnTop lda logoystart bpl LogoYStartOK sta WSYNC lda bk sta COLUBK jmp NoLogo LogoYStartOK sta temp+1 lsr tay ldx signclr sta WSYNC lda SVLogoPF1,Y sta temp SLEEP 2 jmp LogoLoopIn LogoLoop sta COLUBK lda temp+1 lsr tay lda SVLogoPF1,Y sta temp LogoLoopIn lda SVLogoPF2,Y sta PF2 lda SVLogoPF0PF1,Y stx COLUBK sta PF0 sta PF1 ;px 31 - need this value to stick around for 17 pixels -> 6 cy lda temp sta PF1 ;yep, that'll do tya and textand ora textor sta COLUPF lda bk ldy #0 sty PF0 sty PF2 dec temp+1 sty PF1 bpl LogoLoop CHECK_ALIGN LogoLoop sta.w COLUBK NoLogo lda #SHAKEAMP clc adc burnbottom sec sbc shakelines tax jsr Burn sta WSYNC lda skipharry beq DoHarryKernel bne BlackShakeAndRTS DoHarryKernel ldx #LINES-3-2*SVLOGOLINES-3-16-SHAKEAMP-1 HarryKernelLoop txa sec sbc harryypos+1 cpx #7 bne NoGround sta WSYNC sty COLUP0 ldy #$28 sty COLUBK tay bmi NoHarry bpl DoHarry NoGround sta WSYNC sty COLUP0 cmp #21 bcs NoHarry tay DoHarry lda (harryptr),Y bvc DrawHarry NoHarry sbc #30 cmp drawexcl bcs NoExcl lsr tay ;EXCLAMATION POINT QUESTION MARK EXCLAMATION POINT QUESTION MARK ;EXCLAMATION POINT QUESTION MARK EXCLAMATION POINT QUESTION MARK lda GlyphExcl,Y asr #%11111100 .byte $0C NoExcl lda #0 ldy #21 ;for COLUP0 DrawHarry sta GRP0 lda HarryClr-1,Y tay dex cpx #$FE bcc HarryKernelLoop sta WSYNC bne NoHarry ;cheap way to ensure GRP0 = 0 ldx #6 jsr Burn lda #$24 sta COLUBK ldx #9 jsr Burn BlackShakeAndRTS sta WSYNC lda #0 sta COLUBK ldx shakelines jmp Burn ;tail recursion ENDM