;------------------------------------------------------- ; 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 ;====== Here comes the MAIN LOOP ======================= Loop: ei ;------ Wait for vertical blanking sync ---------------- ld b,&f5 WaitVB: in a,(c) rra jr nc,WaitVB halt halt di ;------ 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 1127 ;------ 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 ===============================