Jump to content

CRTC change colour (fill) test with precise timing: Difference between revisions

From CPCWiki - THE Amstrad CPC encyclopedia!
Created page with "<pre>;------------------------------------------------------- ; CRTC change colour (fill) test ; with precise timing! ; ; by matahari - (March 27, 2011) ; ; NOTE: Watch the "prec..."
 
No edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 5: Line 5:
; by matahari - (March 27, 2011)
; by matahari - (March 27, 2011)
;
;
; NOTE: Watch the "precisely shifted" raster line!
; NOTE - Watch the "precisely shifted" raster line!
;       And, use it wisely to make some filled vectors.
;       And, use it wisely to make some filled vectors  
;-------------------------------------------------------
;-------------------------------------------------------


Line 23: Line 23:
ld hl,&amp;c9fb
ld hl,&amp;c9fb
ld (&amp;38),hl
ld (&amp;38),hl
ei


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


Loop: ei
Loop:


;------ Wait for vertical blanking sync ----------------
;------ Wait for vertical blanking sync ----------------
Line 37: Line 38:
halt
halt
halt
halt
di


;------ Set the colours --------------------------------
;------ Set the colours --------------------------------
Line 50: Line 50:
ld a,&amp;44
ld a,&amp;44


defs 1127
defs 1128


;------ Here comes copper (sorry, CRTC) list! ----------
;------ Here comes copper (sorry, CRTC) list! ----------
Line 67: Line 67:
out (c),l&nbsp;; Box #10 = RED
out (c),l&nbsp;; Box #10 = RED


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


REND
REND
Line 86: Line 84:
out (c),l&nbsp;; Box #10 = RED
out (c),l&nbsp;; Box #10 = RED


defs 25&nbsp; &nbsp;; NOP
defs 24+1&nbsp;; Yes, we're adding 1 more NOP
&nbsp;; to achieve 8 pixel precision shift
&nbsp;; during next scan&nbsp;!!!


;-------------------------------------------------------
;-------------------------------------------------------
Line 101: Line 101:
out (c),l&nbsp;; Box #10 = RED
out (c),l&nbsp;; Box #10 = RED


defs 23&nbsp; &nbsp;; Fixing previous subtraction!
defs 24-1&nbsp;; Fixing previous addition!


;-------------------------------------------------------
;-------------------------------------------------------
Line 133: Line 133:


</pre>
</pre>
[[Category:Programming]]

Latest revision as of 14:24, 28 March 2011

;-------------------------------------------------------
; 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 &3000
run &3000

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

ld a,1
call &bc0e

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

di
im 1
ld hl,&c9fb
ld (&38),hl
ei

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

Loop:

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

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

halt
halt

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

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

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

defs 1128

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

REPEAT 4

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

defs 24   ; NOP

REND

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

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

defs 24+1 ; Yes, we're adding 1 more NOP
	  ; to achieve 8 pixel precision shift
	  ; during next scan !!!

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

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

defs 24-1 ; Fixing previous addition!

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

REPEAT 5

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

defs 24   ; NOP

REND

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

out (c),a ; Blue space

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

jp loop

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