Last active
December 28, 2015 18:19
-
-
Save rgiot/7542653 to your computer and use it in GitHub Desktop.
Template for CRTC transition when entering a part in the CPC MegaDemo.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; | |
; CRTC R7 transition sample | |
; From standard R7=30 to R7=0 | |
; Krusty/Benediction November 2013 | |
org &4000 | |
run $ | |
killsys | |
; Stop system | |
ld hl, &c9fb | |
ld (&38), hl | |
; Change border color | |
ld bc, &7f10 | |
ld a, &54 | |
out (c), c | |
out (c), a | |
; Real transition code | |
enter_part_transition | |
call secure_vsync | |
; Here R7=30, we want R7=0 at next frame | |
; we want to wait the loop of R7 | |
halt | |
halt | |
halt | |
halt | |
; We want a smaller screen this time, in order to generate vsync | |
; when R4 counter loops | |
ld bc, &bc00 + 4 | |
out (c), c | |
ld bc, &bd00 + 30 - 1 | |
out (c), c | |
ld bc, &bc00 + 7 | |
out (c), c | |
ld bc, &bd00 + 0 | |
out (c), c | |
call secure_vsync | |
; 19968 nops occur between the two calls of secure_vsync | |
; (+/- the necessary nops needed to catch the signal) | |
; Get back to a standard screen size | |
ld bc, &bc00 + 4 | |
out (c), c | |
ld bc, &bd00 + 38 | |
out (c), c | |
jp $ | |
;; | |
; Wait the next new vsync | |
secure_vsync | |
ld b, &f5 | |
_vbl | |
in a, (c) | |
rra | |
jr c, _vbl | |
vsync | |
ld b, &f5 | |
_novbl | |
in a, (c) | |
rra | |
jr nc, _novbl | |
ret | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment