Certainly! Here's a Z80 assembly code snippet that draws a yin-yang symbol in the center of the ZX Spectrum screen:
; ZX Spectrum Z80 assembly code for drawing a yin-yang symbol
; fast & centered
; Define video address of the center of the screen
VIDEO_CENTER_X EQU 24*2
VIDEO_CENTER_Y EQU 18*8
; Define yin-yang symbol data
YIN_YANG_DATA:
.DB 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.DB 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.DB 0x00, 0x00, 0x08, 0x08, 0x04, 0x10, 0x08, 0x08
.DB 0x00, 0x00, 0x08, 0x08, 0x04, 0x10, 0x08, 0x08
.DB 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.DB 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.DB 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.DB 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.DB 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.DB 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
; Main program
START:
IM 1 ; Interrupt mode 1
EI ; Enable interrupts
LD SP, STACK ; Set stack pointer
CALL CLEAR_SCREEN ; Clear the screen
LD HL, VIDEO_CENTER_X ; Get video address of center of screen
LD DE, VIDEO_CENTER_Y
CALL CALC_ADDRESS ; Calculate address
LD (CURSOR_ADDR), HL ; Save address
LD HL, YIN_YANG_DATA ; Get yin-yang data
LD B, 16 << 1 ; Set number of rows
DRAW_ROW:
PUSH BC ; Preserve row counter
LD C, 8 ; Set number of columns
DRAW_COLUMN:
LD A, (HL) ; Get symbol data
LD (DE), A ; Write to video memory
INC HL ; Next symbol data
INC DE ; Next video address
DEC C ; Decrement column counter
JR NZ, DRAW_COLUMN ; Loop if column counter is not zero
; Move to next row
LD DE, 32 ; Move right
LD BC, (CURSOR_ADDR) ; Load current address
ADD INDX, BC ; Add row offset
LD (CURSOR_ADDR), HL ; Save new address
POP BC ; Restore row counter
DJNZ DRAW_ROW ; Lo