CRTC change colour (fill) test with precise timing
From CPCWiki - THE Amstrad CPC encyclopedia!
;------------------------------------------------------- ; 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 ===============================