My attempt at the Vintage Christmas Star Challenge. I created a BASIC version that I then converted to assembly. I didn't submit this as it was mostly for fun.
; ; Star - in z80 assembly for the ZX81 (12/2022) ; 45 bytes of machine code. Basically the same ; algorithm as the BASIC one (below). ; ; ZX81 BASIC VERSION ;10 FOR L = 1 TO 13 ;20 LET A$="*************"( TO L) ;30 PRINT AT L,4;A$;AT 18-L,13-L;A$;AT L,13-L;A$;AT 18-L,4;A$ ;40 NEXT L org 16514 printat: equ $08f5 ; rom routine to set location on screen ld d,13 ; 02 number of stars to print loop: ; first point - d,4 ld b,d ; 03 set b (X) to d ld e,4 ; 05 set e (Y) to 4 (location) call print_char_at ; 08 ; second point - 18-d,4 ld a,18 ; 10 calculate X position sub d ; 11 push af ; 12 save for later ld b,a ; 13 set b (X) to a (e is 4 still) call print_char_at ; 16 ; third point - d,13-d ld b,d ; 17 set b (x) to d ld a,13 ; 19 calculate Y position sub d ; 20 ld e,a ; 21 set e (Y) to a call print_char_at ; 24 ; forth point - 18-d,13-d pop bc ; 25 restore b (X) (e is 13-d still) call print_char_at ; 28 dec d ; 29 decrement loop jr nz,loop ; 31 until we are done! ret ; 32 print_char_at: push de ; 33 save de as printat will distory it ld c,e ; 34 b is X location, c is Y location call printat ; 37 position character pop de ; 38 restore de ld b,d ; 39 number of stars to print print_loop: ; ld (hl),23 ; 41 alternate version ; inc hl ; 42 but no extra memory ld a,23 ; 41 the astrix character (ZX81) rst $10 ; 42 print char (ROM routine) djnz print_loop ; 44 and loop until done! ret ; 45