Skip to content

Instantly share code, notes, and snippets.

@rgiot
Created November 19, 2013 09:48
Show Gist options
  • Save rgiot/7542889 to your computer and use it in GitHub Desktop.
Save rgiot/7542889 to your computer and use it in GitHub Desktop.
Template for CRTC transition when entering a part in the CPC MegaDemo.
;;
; CRTC R7 transition sample to leave a part
; From R7=0 to standard R7=30
; Krusty/Benediction November 2013
org &8000
run $
leave_part_transition
call secure_vsync
; We want R7=30
ld bc, &bc00 + 7
out (c), c
ld bc, &bd00 + 30
out (c),c
; So we need to have a small screen here
ld bc, &bc00 + 4
out (c), c
ld bc, &bd00 + 8
out (c), c
halt
halt
halt
ld bc, &bd00 + 4
out (c), c
ld bc, &bd00 + 38
out (c), c
call secure_vsync
; 19968 nops between the 2 vsyncs
call secure_vsync
; 19968 nops between the 2 vsyncs
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