Created
October 15, 2019 15:57
-
-
Save neuro-sys/68ddea06ad0abf126c5b8f6f5d1fbc72 to your computer and use it in GitHub Desktop.
32 hardware colors of Amstrad CPC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
org &8000 | |
run &8000 | |
jp start | |
HWCOLN EQU 32 ; Number of hardware colors | |
c1 db 0 ; Ink color index | |
vsync ld b, &f5 | |
vsync1 in a, (c) | |
rra | |
jp nc, vsync1 | |
vsync2 in a, (c) | |
rra | |
jp c, vsync2 | |
ret | |
; A holds number of frames to sleep | |
sleepf ld e, a | |
sleepf1 call vsync | |
dec e | |
jp nz, sleepf1 | |
ret | |
; disable interrupts | |
disint | |
ld hl, &c9fb | |
ld (&38), hl | |
ret | |
; c holds pen index | |
selpen ld b, &7f | |
out (c), c | |
ret | |
; no input | |
selbor ld bc, &7f10 | |
out (c), c | |
ret | |
; a holds ink | |
setink | |
or &40 | |
ld c, a | |
ld b, &7f | |
out (c), c | |
ret | |
start | |
call disint | |
ld a, 1 | |
ld (c1), a | |
loop | |
ld a, 50 | |
call sleepf | |
ld c, 0 | |
call selpen | |
ld a, (c1) | |
call setink | |
call selbor | |
ld a, (c1) | |
call setink | |
ld hl, c1 | |
inc (hl) | |
ld a, HWCOLN | |
cp (hl) | |
jp nz, loop | |
ld a, 0 | |
ld (hl), a | |
jp loop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment