;================================================== ; SwapApd- Swaps graph_mem with offscreen buffer ;================================================== SwapApd: ld hl,graph_mem ld de,savesscreen ld bc,768 SwapApd2: ld a,(de) ldi dec hl ld (hl),a inc hl jp pe,SwapApd2 ret Bt_row: ld b,c ;12 times bt_row2: ;Get source byte ld a,(ix+0) ;Mask it and d ;Save it ld iyh,a ;Get destination byte ld a,(hl) ;Mask it and e ;Combine it with previous mask or iyh ;Replace destionation ld (hl),a ;Inc offsets inc hl inc ix ;Loop 12 times djnz bt_row2 ;Add 12 to offsets add hl,bc add ix,bc ret ;====================================== ; BattleTransition- Battle Animation ;====================================== BattleTransition: di push iy call SwapApd exx ld de,$807F exx ld de,$01FE bt0: ;32 rows ld bc,$200C ;Source= ld ix,savesscreen ;Dest= ld hl,graph_mem bt1: ;Push push bc ;Doit call bt_row ;Pop pop bc ;Repeat 32 times djnz bt1 ;Swap de with de' exx ld bc,$200C ;Source= ld ix,savesscreen+12 ;Dest= ld hl,graph_mem+12 bt2: ;Push push bc ;doit call bt_row ;pop pop bc ;repeat 32 times djnz bt2 ;Update masks ld a,d rra ld d,a cpl ld e,a exx ;Save masks push de ;Update Screen call Fastcopy di call crapdelay ;Take masks back pop de ;Put D into A ld a,d ;Update mask add a,a ;Quit when done jr z,bt3 ;Save source Bitmask ld d,a ;Invert it cpl ;Save dest Bitmask ld e,a jr bt0 bt3: pop iy ret crapdelay ld b,32 crapdelay2: push bc ld b,255 crapdelay3: nop djnz crapdelay3 pop bc djnz crapdelay2 ret ;============================== ; Transition- leet animation ;============================== Transition: di ;Stop those pesky interrupts ld b,96 ;Do it 96 times ld c,12 ;Remember 12 TransitionStep: push bc ;Branch out ld hl,graph_mem ;Put graph_mem into hl ld b,32 ;32 repititions Transitionstep2: push bc ;Branch out ld b,c ;set b=12 or a ;Reset carry flag Transitionstep3: rr (hl) ;Rotate right inc hl ;and inc hl djnz Transitionstep3 ;and do it 12 times add hl,bc ;Increase offset by 12 ld b,c ;set b=12 Transitionstep4: dec hl ;and dec hl... rl (hl) ;Rotate left djnz TransitionStep4 add hl,bc ;Increase offset by 12 pop bc ;Branch In djnz transitionstep2 ;Loop back call fastcopy ;Display Screen pop bc ;Branch in djnz transitionstep ;Loop back ret ;====================================== ; Copy2APD- Copys screen to Saferam1 ;====================================== Copy2APD: ;768 bytes long ld bc,768 ;Destination is Saferam1 ld de,savesscreen ;Source is graph_mem ld hl,graph_mem ;copy ldir ;done ret ;===================================== ; CopyAPD- Copys SafeRam1 to screen ;===================================== CopyAPD: ;768 bytes long ld bc,768 ;Destination is graph_mem ld de,graph_mem ;Source is saferam1 ld hl,savesscreen ;copy ldir ;done ret