Skip to main content
change of heading to include better formatting
Source Link
Z80 code
  • 61
  • 2
  • 4

ZX Spectrum Z80 assembly, 32, 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

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

ZX Spectrum Z80 assembly, 32, 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

shortened code by two bytes
Source Link
Z80 code
  • 61
  • 2
  • 4

ZX Spectrum Z80 assembly, 3230 Bytes

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


start:
    ld    c,16
    ld    hl,5800h;height
    ld    ae,8      ; blue
sheldon:/offset/counter
    ld    dehl,red*256+white5800h
sheldon:
    ld    b,ae      ;counter
fun:
    ld    (hl),ae   ;blue
    inc   hl
    djnz  fun
    ld    b,ae      ;counter
with:
    ld   (hl),ewhite
    inc  hl
    djnz with
    ld   b,ae       ;counter
flags:
    ld   (hl),dred
    inc  hl
    djnz flags
    ld   d,b
     ld   e,a;e holds offset       
    add  hl,de
    dec  c
    jr   nz,sheldon
    ret

    end

    3230 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

ZX Spectrum Z80 assembly, 32 Bytes

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


start:
    ld    c,16
    ld    hl,5800h
    ld    a,8      ; blue
sheldon:
    ld    de,red*256+white
    ld    b,a
fun:
    ld    (hl),a
    inc   hl
    djnz  fun
    ld    b,a
with:
    ld   (hl),e
    inc  hl
    djnz with
    ld   b,a
flags:
    ld   (hl),d
    inc  hl
    djnz flags
    ld   d,b
     ld   e,a
    add  hl,de
    dec  c
    jr   nz,sheldon
    ret

    end

    32 bytes

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

enter image description here

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

changing the category heading to be more consistent with other entries.
Source Link
Z80 code
  • 61
  • 2
  • 4

Z80 assembler output for zx spectrumZX Spectrum Z80 assembly, 32 Bytes

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


start:
    ld    c,16
    ld    hl,5800h
    ld    a,8      ; blue
sheldon:
    ld    de,red*256+white
    ld    b,a
fun:
    ld    (hl),a
    inc   hl
    djnz  fun
    ld    b,a
with:
    ld   (hl),e
    inc  hl
    djnz with
    ld   b,a
flags:
    ld   (hl),d
    inc  hl
    djnz flags
    ld   d,b
    ld   e,a
    add  hl,de
    dec  c
    jr   nz,sheldon
    ret

    end

    32 bytes

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

enter image description here

Z80 assembler output for zx spectrum, 32 Bytes

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


start:
    ld    c,16
    ld    hl,5800h
    ld    a,8      ; blue
sheldon:
    ld    de,red*256+white
    ld    b,a
fun:
    ld    (hl),a
    inc   hl
    djnz  fun
    ld    b,a
with:
    ld   (hl),e
    inc  hl
    djnz with
    ld   b,a
flags:
    ld   (hl),d
    inc  hl
    djnz flags
    ld   d,b
    ld   e,a
    add  hl,de
    dec  c
    jr   nz,sheldon
    ret

    end

    32 bytes

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

enter image description here

ZX Spectrum Z80 assembly, 32 Bytes

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


start:
    ld    c,16
    ld    hl,5800h
    ld    a,8      ; blue
sheldon:
    ld    de,red*256+white
    ld    b,a
fun:
    ld    (hl),a
    inc   hl
    djnz  fun
    ld    b,a
with:
    ld   (hl),e
    inc  hl
    djnz with
    ld   b,a
flags:
    ld   (hl),d
    inc  hl
    djnz flags
    ld   d,b
    ld   e,a
    add  hl,de
    dec  c
    jr   nz,sheldon
    ret

    end

    32 bytes

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

enter image description here

Source Link
Z80 code
  • 61
  • 2
  • 4
Loading