Skip to main content
3 of 4
shortened code by two bytes
Z80 code
  • 61
  • 2
  • 4

ZX Spectrum Z80 assembly, 30 Bytes

    org 8000h  
 
red:      equ 16   
white:    equ 120  
blue:     equ 8  
   


start:
    ld    c,16     ;height
    ld    e,8      ; blue/offset/counter
    ld    hl,5800h
sheldon:
    ld    b,e      ;counter
fun:
    ld    (hl),e   ;blue
    inc   hl
    djnz  fun
    ld    b,e      ;counter
with:
    ld   (hl),white
    inc  hl
    djnz with
    ld   b,e       ;counter
flags:
    ld   (hl),red
    inc  hl
    djnz flags
    ld   d,b       ;e holds offset       
    add  hl,de
    dec  c
    jr   nz,sheldon
    ret

    end

    30 bytes

output is 248 pixels wide =192 pixels wide
and 16
8 pixels high =128 pixels high

edit 1: removed preload of de with two colours,shorter to directly load (hl):saves 1 byte
By not using "de" it can now transfer values instead of "a":saves 1 byte

enter image description here

Z80 code
  • 61
  • 2
  • 4