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

From CPCWiki - THE Amstrad CPC encyclopedia!
Jump to: navigation, search
(added category)
Line 23: Line 23:
 
ld hl,&c9fb
 
ld hl,&c9fb
 
ld (&38),hl
 
ld (&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,&44
 
ld a,&44
  
defs 1127
+
defs 1128
  
 
;------ Here comes copper (sorry, CRTC) list! ----------
 
;------ Here comes copper (sorry, CRTC) list! ----------
Line 133: Line 133:
  
 
</pre>
 
</pre>
 
 
[[Category:Programming]]
 
[[Category:Programming]]

Revision as of 10:15, 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 25-1 ; Yes, we're using 1 NOP less
	  ; to achieve 8 pixel precision shift
	  ; during next scan !!!

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 25   ; NOP

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

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 23   ; Fixing previous subtraction!

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

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 ===============================