Changes

Jump to: navigation, search

CRTC change colour (fill) test with precise timing

2,876 bytes added, 15:11, 27 March 2011
Created page with "<pre>;------------------------------------------------------- ; CRTC change colour (fill) test ; with precise timing! ; ; by matahari - (March 27, 2011) ; ; NOTE: Watch the "prec..."
<pre>;-------------------------------------------------------
; CRTC change colour (fill) test
; with precise timing!
;
; by matahari - (March 27, 2011)
;
; NOTE: Watch the "precisely shifted" raster line!
; And, use it wisely to make some filled vectors.
;-------------------------------------------------------

org &amp;3000
run &amp;3000

;------ Switch to Mode 1 -------------------------------

ld a,1
call &amp;bc0e

;------ Set an interrupt that makes nothing! -----------

di
im 1
ld hl,&amp;c9fb
ld (&amp;38),hl

;====== Here comes the MAIN LOOP =======================

Loop: ei

;------ Wait for vertical blanking sync ----------------

ld b,&amp;f5
WaitVB: in a,(c)
rra
jr nc,WaitVB

halt
halt
di

;------ Set the colours --------------------------------

ld bc,&amp;7f00
out (c),c

ld h,&amp;51
ld l,&amp;48
ld d,&amp;43
ld e,&amp;4d
ld a,&amp;44

defs 1127

;------ Here comes copper (sorry, CRTC) list! ----------

REPEAT 4

out (c),h&nbsp;; Box #1 = GREEN
out (c),l&nbsp;; Box #2 = RED
out (c),d&nbsp;; Box #3 = YELLOW
out (c),e&nbsp;; Box #4 = PURPLE
out (c),h&nbsp;; Box #5 = GREEN
out (c),l&nbsp;; Box #6 = RED
out (c),d&nbsp;; Box #7 = YELLOW
out (c),e&nbsp;; Box #8 = PURPLE
out (c),h&nbsp;; Box #9 = GREEN
out (c),l&nbsp;; Box #10 = RED

defs 25-1&nbsp;; Yes, we're using 1 NOP less
&nbsp;; to achieve 8 pixel precision shift
&nbsp;; during next scan&nbsp;!!!

REND

;-------------------------------------------------------

out (c),h&nbsp;; Box #1 = GREEN
out (c),l&nbsp;; Box #2 = RED
out (c),d&nbsp;; Box #3 = YELLOW
out (c),e&nbsp;; Box #4 = PURPLE
out (c),h&nbsp;; Box #5 = GREEN
out (c),l&nbsp;; Box #6 = RED
out (c),d&nbsp;; Box #7 = YELLOW
out (c),e&nbsp;; Box #8 = PURPLE
out (c),h&nbsp;; Box #9 = GREEN
out (c),l&nbsp;; Box #10 = RED

defs 25&nbsp; &nbsp;; NOP

;-------------------------------------------------------

out (c),h&nbsp;; Box #1 = GREEN
out (c),l&nbsp;; Box #2 = RED
out (c),d&nbsp;; Box #3 = YELLOW
out (c),e&nbsp;; Box #4 = PURPLE
out (c),h&nbsp;; Box #5 = GREEN
out (c),l&nbsp;; Box #6 = RED
out (c),d&nbsp;; Box #7 = YELLOW
out (c),e&nbsp;; Box #8 = PURPLE
out (c),h&nbsp;; Box #9 = GREEN
out (c),l&nbsp;; Box #10 = RED

defs 23&nbsp; &nbsp;; Fixing previous subtraction!

;-------------------------------------------------------

REPEAT 5

out (c),h&nbsp;; Box #1 = GREEN
out (c),l&nbsp;; Box #2 = RED
out (c),d&nbsp;; Box #3 = YELLOW
out (c),e&nbsp;; Box #4 = PURPLE
out (c),h&nbsp;; Box #5 = GREEN
out (c),l&nbsp;; Box #6 = RED
out (c),d&nbsp;; Box #7 = YELLOW
out (c),e&nbsp;; Box #8 = PURPLE
out (c),h&nbsp;; Box #9 = GREEN
out (c),l&nbsp;; Box #10 = RED

defs 24&nbsp; &nbsp;; NOP

REND

;-------------------------------------------------------

out (c),a&nbsp;; Blue space

;-------------------------------------------------------

jp loop

;====== End of MAIN LOOP ===============================

</pre>
14
edits