Skip to content

Instantly share code, notes, and snippets.

@Gekkio
Created June 30, 2018 19:06
Show Gist options
  • Save Gekkio/c18d9b285b13bf536c140dd94cd248d6 to your computer and use it in GitHub Desktop.
Save Gekkio/c18d9b285b13bf536c140dd94cd248d6 to your computer and use it in GitHub Desktop.
(skip-clock-edges 13) ; align to the start of the LCDC write M-cycle
(step-clock-edges 32)
(assert-edges 27 :stat 0x84 :ly 0x00 :vsync false :hsync false :cpg false :cpl false :fr true)
; this is 55 edges after the write
(assert-edges 8 :stat 0x84 :ly 0x00 :vsync false :hsync false :cpg true :cpl false :fr true)
(assert-edges 94 :stat 0x84 :ly 0x00 :vsync false :hsync false :cpg false :cpl false :fr true)
(assert-edges 29 :stat 0x87 :ly 0x00 :vsync false :hsync true :cpg false :cpl false :fr true)
(assert-edges 173 :stat 0x87 :ly 0x00 :vsync false :hsync false :cpg false :cpl false :fr true)
(assert-edges 8 :stat 0x87 :ly 0x00 :vsync false :hsync false :cpg true :cpl false :fr true)
(assert-edges 137 :stat 0x87 :ly 0x00 :vsync false :hsync false :cpg false :cpl false :fr true)
(assert-edges 159 :stat 0x84 :ly 0x00 :vsync false :hsync false :cpg false :cpl false :fr true)
(assert-edges 8 :stat 0x84 :ly 0x00 :vsync false :hsync false :cpg true :cpl false :fr true)
(assert-edges 232 :stat 0x84 :ly 0x00 :vsync false :hsync false :cpg false :cpl false :fr true)
(assert-edges 2 :stat 0x84 :ly 0x01 :vsync false :hsync false :cpg true :cpl true :fr true)
(assert-edges 2 :stat 0x86 :ly 0x01 :vsync false :hsync false :cpg true :cpl true :fr true)
(assert-edges 4 :stat 0x82 :ly 0x01 :vsync false :hsync false :cpg true :cpl true :fr true)
(assert-edges 8 :stat 0x82 :ly 0x01 :vsync false :hsync false :cpg true :cpl false :fr false)
(assert-edges 48 :stat 0x82 :ly 0x01 :vsync false :hsync false :cpg false :cpl false :fr false)
(assert-edges 8 :stat 0x82 :ly 0x01 :vsync false :hsync false :cpg true :cpl false :fr false)
(assert-edges 90 :stat 0x82 :ly 0x01 :vsync false :hsync false :cpg false :cpl false :fr false)
(assert-edges 29 :stat 0x83 :ly 0x01 :vsync false :hsync true :cpg false :cpl false :fr false)
(assert-edges 177 :stat 0x83 :ly 0x01 :vsync false :hsync false :cpg false :cpl false :fr false)
(assert-edges 8 :stat 0x83 :ly 0x01 :vsync false :hsync false :cpg true :cpl false :fr false)
(assert-edges 133 :stat 0x83 :ly 0x01 :vsync false :hsync false :cpg false :cpl false :fr false)
(assert-edges 163 :stat 0x80 :ly 0x01 :vsync false :hsync false :cpg false :cpl false :fr false)
(assert-edges 8 :stat 0x80 :ly 0x01 :vsync false :hsync false :cpg true :cpl false :fr false)
(assert-edges 232 :stat 0x80 :ly 0x01 :vsync false :hsync false :cpg false :cpl false :fr false)
(for 2 144 (lambda (ly)
(let ((fr (= 0 (rem ly 2))))
(do
(assert-edges 2 :stat 0x80 :ly ly :vsync false :hsync false :cpg true :cpl true :fr (not fr))
(assert-edges 6 :stat 0x82 :ly ly :vsync false :hsync false :cpg true :cpl true :fr (not fr))
(assert-edges 8 :stat 0x82 :ly ly :vsync false :hsync false :cpg true :cpl false :fr fr)
(assert-edges 48 :stat 0x82 :ly ly :vsync false :hsync false :cpg false :cpl false :fr fr)
(assert-edges 8 :stat 0x82 :ly ly :vsync false :hsync false :cpg true :cpl false :fr fr)
(assert-edges 90 :stat 0x82 :ly ly :vsync false :hsync false :cpg false :cpl false :fr fr)
(assert-edges 29 :stat 0x83 :ly ly :vsync false :hsync true :cpg false :cpl false :fr fr)
(assert-edges 177 :stat 0x83 :ly ly :vsync false :hsync false :cpg false :cpl false :fr fr)
(assert-edges 8 :stat 0x83 :ly ly :vsync false :hsync false :cpg true :cpl false :fr fr)
(assert-edges 133 :stat 0x83 :ly ly :vsync false :hsync false :cpg false :cpl false :fr fr)
(assert-edges 163 :stat 0x80 :ly ly :vsync false :hsync false :cpg false :cpl false :fr fr)
(assert-edges 8 :stat 0x80 :ly ly :vsync false :hsync false :cpg true :cpl false :fr fr)
(assert-edges 232 :stat 0x80 :ly ly :vsync false :hsync false :cpg false :cpl false :fr fr)))))
(assert-edges 4 :stat 0x80 :ly 0x90 :vsync false :hsync false :cpg true :cpl true :fr false)
(assert-edges 4 :stat 0x81 :ly 0x90 :vsync false :hsync false :cpg true :cpl true :fr true)
(assert-edges 8 :stat 0x81 :ly 0x90 :vsync false :hsync false :cpg true :cpl false :fr false)
(assert-edges 48 :stat 0x81 :ly 0x90 :vsync false :hsync false :cpg false :cpl false :fr false)
(assert-edges 8 :stat 0x81 :ly 0x90 :vsync false :hsync false :cpg true :cpl false :fr false)
(assert-edges 296 :stat 0x81 :ly 0x90 :vsync false :hsync false :cpg false :cpl false :fr false)
(assert-edges 8 :stat 0x81 :ly 0x90 :vsync false :hsync false :cpg true :cpl false :fr false)
(assert-edges 133 :stat 0x81 :ly 0x90 :vsync false :hsync false :cpg false :cpl false :fr false)
(assert-edges 163 :stat 0x81 :ly 0x90 :vsync false :hsync false :cpg false :cpl false :fr false)
(assert-edges 8 :stat 0x81 :ly 0x90 :vsync false :hsync false :cpg true :cpl false :fr false)
(assert-edges 232 :stat 0x81 :ly 0x90 :vsync false :hsync false :cpg false :cpl false :fr false)
(for 145 153 (lambda (ly)
(let ((fr (/= 0 (rem ly 2))))
(do
(assert-edges 8 :stat 0x81 :ly ly :vsync false :hsync false :cpg true :cpl true :fr (not fr))
(assert-edges 8 :stat 0x81 :ly ly :vsync false :hsync false :cpg true :cpl false :fr fr)
(assert-edges 48 :stat 0x81 :ly ly :vsync false :hsync false :cpg false :cpl false :fr fr)
(assert-edges 8 :stat 0x81 :ly ly :vsync false :hsync false :cpg true :cpl false :fr fr)
(assert-edges 296 :stat 0x81 :ly ly :vsync false :hsync false :cpg false :cpl false :fr fr)
(assert-edges 8 :stat 0x81 :ly ly :vsync false :hsync false :cpg true :cpl false :fr fr)
(assert-edges 133 :stat 0x81 :ly ly :vsync false :hsync false :cpg false :cpl false :fr fr)
(assert-edges 163 :stat 0x81 :ly ly :vsync false :hsync false :cpg false :cpl false :fr fr)
(assert-edges 8 :stat 0x81 :ly ly :vsync false :hsync false :cpg true :cpl false :fr fr)
(assert-edges 232 :stat 0x81 :ly ly :vsync false :hsync false :cpg false :cpl false :fr fr)))))
(assert-edges 8 :stat 0x81 :ly 0x99 :vsync false :hsync false :cpg true :cpl true :fr false)
(assert-edges 4 :stat 0x81 :ly 0x99 :vsync false :hsync false :cpg true :cpl false :fr true)
(assert-edges 4 :stat 0x81 :ly 0x00 :vsync false :hsync false :cpg true :cpl false :fr true)
(assert-edges 4 :stat 0x81 :ly 0x00 :vsync false :hsync false :cpg false :cpl false :fr true)
(assert-edges 44 :stat 0x85 :ly 0x00 :vsync false :hsync false :cpg false :cpl false :fr true)
(assert-edges 8 :stat 0x85 :ly 0x00 :vsync false :hsync false :cpg true :cpl false :fr true)
(assert-edges 296 :stat 0x85 :ly 0x00 :vsync false :hsync false :cpg false :cpl false :fr true)
(assert-edges 8 :stat 0x85 :ly 0x00 :vsync false :hsync false :cpg true :cpl false :fr true)
(assert-edges 133 :stat 0x85 :ly 0x00 :vsync false :hsync false :cpg false :cpl false :fr true)
(assert-edges 163 :stat 0x85 :ly 0x00 :vsync false :hsync false :cpg false :cpl false :fr true)
(assert-edges 8 :stat 0x85 :ly 0x00 :vsync false :hsync false :cpg true :cpl false :fr true)
(assert-edges 232 :stat 0x85 :ly 0x00 :vsync false :hsync false :cpg false :cpl false :fr true)
(assert-edges 2 :stat 0x85 :ly 0x00 :vsync false :hsync false :cpg true :cpl true :fr true)
(assert-edges 2 :stat 0x87 :ly 0x00 :vsync false :hsync false :cpg true :cpl true :fr true)
(assert-edges 4 :stat 0x86 :ly 0x00 :vsync false :hsync false :cpg true :cpl true :fr true)
(assert-edges 4 :stat 0x86 :ly 0x00 :vsync false :hsync false :cpg true :cpl false :fr false)
(assert-edges 4 :stat 0x86 :ly 0x00 :vsync true :hsync false :cpg true :cpl false :fr false)
(assert-edges 48 :stat 0x86 :ly 0x00 :vsync true :hsync false :cpg false :cpl false :fr false)
(assert-edges 8 :stat 0x86 :ly 0x00 :vsync true :hsync false :cpg true :cpl false :fr false)
(assert-edges 90 :stat 0x86 :ly 0x00 :vsync true :hsync false :cpg false :cpl false :fr false)
(assert-edges 29 :stat 0x87 :ly 0x00 :vsync true :hsync true :cpg false :cpl false :fr false)
(assert-edges 177 :stat 0x87 :ly 0x00 :vsync true :hsync false :cpg false :cpl false :fr false)
(assert-edges 8 :stat 0x87 :ly 0x00 :vsync true :hsync false :cpg true :cpl false :fr false)
(assert-edges 133 :stat 0x87 :ly 0x00 :vsync true :hsync false :cpg false :cpl false :fr false)
(assert-edges 163 :stat 0x84 :ly 0x00 :vsync true :hsync false :cpg false :cpl false :fr false)
(assert-edges 8 :stat 0x84 :ly 0x00 :vsync true :hsync false :cpg true :cpl false :fr false)
(assert-edges 232 :stat 0x84 :ly 0x00 :vsync true :hsync false :cpg false :cpl false :fr false)
(assert-edges 2 :stat 0x84 :ly 0x01 :vsync true :hsync false :cpg true :cpl true :fr false)
(assert-edges 2 :stat 0x86 :ly 0x01 :vsync true :hsync false :cpg true :cpl true :fr false)
(assert-edges 4 :stat 0x82 :ly 0x01 :vsync true :hsync false :cpg true :cpl true :fr false)
(assert-edges 4 :stat 0x82 :ly 0x01 :vsync true :hsync false :cpg true :cpl false :fr true)
(assert-edges 4 :stat 0x82 :ly 0x01 :vsync false :hsync false :cpg true :cpl false :fr true)
(assert-edges 48 :stat 0x82 :ly 0x01 :vsync false :hsync false :cpg false :cpl false :fr true)
(assert-edges 8 :stat 0x82 :ly 0x01 :vsync false :hsync false :cpg true :cpl false :fr true)
(assert-edges 90 :stat 0x82 :ly 0x01 :vsync false :hsync false :cpg false :cpl false :fr true)
(assert-edges 29 :stat 0x83 :ly 0x01 :vsync false :hsync true :cpg false :cpl false :fr true)
(assert-edges 177 :stat 0x83 :ly 0x01 :vsync false :hsync false :cpg false :cpl false :fr true)
(assert-edges 8 :stat 0x83 :ly 0x01 :vsync false :hsync false :cpg true :cpl false :fr true)
(assert-edges 133 :stat 0x83 :ly 0x01 :vsync false :hsync false :cpg false :cpl false :fr true)
(assert-edges 163 :stat 0x80 :ly 0x01 :vsync false :hsync false :cpg false :cpl false :fr true)
(assert-edges 8 :stat 0x80 :ly 0x01 :vsync false :hsync false :cpg true :cpl false :fr true)
(assert-edges 232 :stat 0x80 :ly 0x01 :vsync false :hsync false :cpg false :cpl false :fr true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment