Páginas

Páginas aconselhadas

segunda-feira, 23 de março de 2020

ZX Spectrum - modo "texto" (II) - UDGs

Nas rotinas de impressão BASIC/ROM do ZX Spectrum, podem-se usar caracteres definidos pelo utilizador.

Os caracteres que se podem definir vão de $90 até $A4 ; cada um define-se num block de 8x8. A rotina da ROM usa esses bitmaps a partir do endereço que estiver definido na variável UDG $5C7B.

Como exemplo, definimos UDGs com as componentes de um rectângulo, e imprimimos usando rotinas da ROM:
ORG 50000

LD HL,UDG
LD ($5C7B),HL ; points UDG system var pointer to UDG here

; print string STR
; ended by 0
LD HL,STR

PRINT: LD A,(HL)
CP 0
RET Z
RST $10
INC HL
JR PRINT
; string to print
; each line is a DEFB line, set of UDG characters, or space ($20)
; ended by newline ($0D)
; 0 to end the string
STR:
DEFB $90, $91, $91, $91, $92, $0D
DEFB $93, $20, $20, $20, $94, $0D
DEFB $93, $20, $20, $20, $94, $0D
DEFB $93, $20, $20, $20, $94, $0D
DEFB $93, $20, $20, $20, $94, $0D
DEFB $95, $96, $96, $96, $97, 0

; UDG area

UDG:
; $90
DEFB %11111111
DEFB %10000000
DEFB %10000000
DEFB %10000000
DEFB %10000000
DEFB %10000000
DEFB %10000000
DEFB %10000000

; $91
DEFB %11111111
DEFB %00000000
DEFB %00000000
DEFB %00000000
DEFB %00000000
DEFB %00000000
DEFB %00000000
DEFB %00000000
; $92
        DEFB %11111111
        DEFB %00000001
        DEFB %00000001
        DEFB %00000001
        DEFB %00000001
        DEFB %00000001
        DEFB %00000001
        DEFB %00000001

; $93
        DEFB %10000000
        DEFB %10000000
        DEFB %10000000
        DEFB %10000000
        DEFB %10000000
        DEFB %10000000
        DEFB %10000000
        DEFB %10000000

; $94
        DEFB %00000001
        DEFB %00000001
        DEFB %00000001
        DEFB %00000001
        DEFB %00000001
        DEFB %00000001
        DEFB %00000001
        DEFB %00000001

; $95
        DEFB %10000000
        DEFB %10000000
        DEFB %10000000
        DEFB %10000000
        DEFB %10000000
        DEFB %10000000
        DEFB %10000000
        DEFB %11111111

        ; $96
        DEFB %00000000
        DEFB %00000000
        DEFB %00000000
        DEFB %00000000
        DEFB %00000000
        DEFB %00000000
        DEFB %00000000
        DEFB %11111111

        ; $97
        DEFB %00000001
        DEFB %00000001
        DEFB %00000001
        DEFB %00000001
        DEFB %00000001
        DEFB %00000001
        DEFB %00000001
        DEFB %11111111

END 50000

Ver:

ZX Spectrum - modo "texto" (I)
ZX Basic Manual - The character set
The Moon (UDG Moon’s Phases)

Sem comentários:

Enviar um comentário