Skip to content

Instantly share code, notes, and snippets.

@ped7g
Created July 15, 2019 22:15
Show Gist options
  • Save ped7g/56e6fc31f291340f9317b1fb68151e0a to your computer and use it in GitHub Desktop.
Save ped7g/56e6fc31f291340f9317b1fb68151e0a to your computer and use it in GitHub Desktop.
DEVICE ZXSPECTRUM48
OPT reset --zxnext=cspect --syntax=abfw
ORG $8000
start:
;; FIRST test: black border configured into default transparency fallback colour, inkmask 7
; black border
xor a
out (254),a
; configure the NextULA palette (inkmask 7, select ULA palette for write, display first pals, enable NextULA mode)
nextreg $42,$07 ,, $43,%0'000'0'0'0'1
; modify black colour of ULA to $AA, and global transparency to $AA too
nextreg $40,$80 ,, $41,$AA ,, $14,$AA
call waitForN
;; SECOND test: "all ink" mode with inmask 255
; blue border (should use fallback value anyway in full-ink mode)
ld a,1
out (254),a
; configure the NextULA palette (inkmask FF, select ULA palette for write, display first pals, enable NextULA mode)
nextreg $42,$FF ,, $43,%0'000'0'0'0'1
; no need to modify any colour
call waitForN
;; THIRD test: same as first, but this time global transparency is set to cyan $1F
; black border
xor a
out (254),a
; configure the NextULA palette (inkmask 7, select ULA palette for write, display first pals, enable NextULA mode)
nextreg $42,$07 ,, $43,%0'000'0'0'0'1
; modify black colour of ULA to $AA, and global transparency to $AA, fallback to $1F
nextreg $40,$80 ,, $41,$AA ,, $14,$AA ,, $4A,$1F
call waitForN
;; FOURTH test: "all ink" mode with inmask 255, fallback set to $1F cyan
; blue border (should use fallback value anyway in full-ink mode)
ld a,1
out (254),a
; configure the NextULA palette (inkmask FF, select ULA palette for write, display first pals, enable NextULA mode)
nextreg $42,$FF ,, $43,%0'000'0'0'0'1 ,, $4A,$1F
call waitForN
; switch off NextULA and reset border to red to signal the end
nextreg $43,%0'000'0'0'0'0 ,, $40,$80 ,, $41,$00
ld a,2
out (254),a
jr $
waitForN:
ld b,10
.wait200ms: ; wait 200ms first to give a chance to release the key
ei
halt
djnz .wait200ms
.waitForKey:
ld a,$7F
in a,(254)
and %0000'1000 ; test for "N" key
jr nz,.waitForKey
ret
SAVESNA "deffalbk.sna", start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment