;=======================================================================
; Vintage Computing Christmas Challenge 2023 (VC3 2023)
; Amstrad CPC / Overflow & Longshot (Logon System)
; December 2023
; 28 bytes
;=======================================================================
_firm_dispchar equ #bb5a ; firmware TXT OUTPUT
_firm_locatexy equ #bb75 ; firmware TXT SET CURSOR
orgcode equ #300-1
sizecode equ end_c-start_c
org orgcode
start_c
; on run (de=#0040, hl=#abff, af=#ff80 bc=#b0ff)
inc e ; E = #41 = 5 + 6*n | 5 would be ok
; 1st loop for half of the shape
next_half ; 2nd loop for the other half
; then loops for ever on 2nd half
ld a,c ; X = #FF = 9 + 6*n for 1st "*" at X=9
ld b,19 ; Y dec from 19 to 1
loop
inc a ; pre-inc X
ld h,a ; X=...
ld l,b ; Y=...
call _firm_locatexy ; locate X,Y | X-- Y--
ld a,h
cp 19 ; output windows X-1 <19
ld a,"*"
call c,_firm_dispchar ; print "*"
ld a,h
sub 6 ; next "*" is at X-6
jr nc,loop ; is X still > 0 ?
sub e ; updates "*" slide for next line
djnz loop ; next line
ld e,h ; for next loop E = H = #03 | 3 + 6*n is ok
jp (hl) ; jp next_half = #300 = HL
end_c
;=======================================================================
; Vintage Computing Christmas Challenge 2023 (VC3 2023)
; Amstrad CPC / Longshot (Logon System)
; December 2023
; 29 bytes
; Window strategy
;=======================================================================
_firm_dispchar equ #bb5a ; firmware TXT OUTPUT
_firm_locatexy equ #bb75 ; firmware TXT SET CURSOR
mode_dev equ 1
sizecode equ end_c-start_c
orgcode equ #1313-2-10
org orgcode
run $
ld a,1
call #bc0e
ld de,#0040
ld hl,#abff
; on run (de=#0040, hl=#abff, af=#ff80 bc=#b0ff)
start_c
display_start
ld a,e ; X initial position (out of x windows)
display_next_line
ld c,19
ld h,a ; First X position (out of windows, y not yet fixed)
ld b,c ; Star counter on line
push bc ; loop address
push af ; Save X
display_star_line
call _firm_locatexy ; Locate cursor (exit h=x-1, l=y-1, acc=2!)
ld e,a ; de=0002 left.down / de=0202 right.down
ld a,h ; Is X in windows (0..18) ?
cp c
ld a,"*" ; Accumulator sacrificed to the star. Alleluia!
call c,_firm_dispchar ; Display only if cursor in window
add hl,de ; Calculate next coordinate from x-1,y-1
djnz display_star_line ;
pop af ; restore X
ld l,6 ; Fix Y position to 6 (equal to x step)
sub l ; move line on x
ret po ; loop on display_next_line
add a,e ; a=7a+2=7c (x mod 6)
ld d,e ; switch on right.down
ret
end_c
;=======================================================================
; Vintage Computing Christmas Challenge 2023 (VC3 2023)
; Amstrad CPC / Overflow
; December 2023
; 29 bytes
;=======================================================================
org #12FB ; set there to get #1301 at given opcode
run $ ; same entry
loop ; 1st loop to draw half
; 2nd loop to draw the other half
; then loops on 2nd half for ever
ld bc,#1304 ; b line [1..19]
; c counter [6..1] then loops from 1 to 6
loop_on_line
ld de,#1301 ; d column [1..19]
; e is being updated to equal 20-column
; INC DE=#13 is last byte from ld de,#1301=#11,#01,#13
loop_on_column equ $-1 ; so this label includes INC DE
; updates H,L = LOCATE x,y on screen text
; address there is exactly #1301
ld h,e ; =#63 then updated to #62=LD H,D
ld l,b
; update c counter ; one loop out of 6 does PRINT "*"
dec c
jr nz,test_nochartoprint
ld c,6
call #BB75 ; LOCATE H,L by firmware
ld a,"*"
call #BB5A ; PRINT A by firmware
test_nochartoprint
; updates column number then loops
dec d
jr nz,loop_on_column ; also does INC DE=#13 to INC E
; updates line number then loops
djnz loop_on_line
; assuming at 1st loop HL=#1301 ; at other loops HL=#0101
dec (hl) ; switch from #63=LD H,E to #62=LD H,D
; loops once for 2nd half and then forever
jr loop
;=======================================================================
; Vintage Computing Christmas Challenge 2023 (VC3 2023)
; Amstrad CPC / Arnolde
; December 2023
; 32 bytes
;=======================================================================
;60x2=32
;draws 60 stars, all of them twice
;Needs 32 bytes of memory.
;Basic idea:
;In a window of 19 characters width, repeat typing
; " *" (5 spaces + 1 star), and you get this:
;|12345*12345*12345*1|
;|2345*etc. * * |
;| * * * |
;| * * * | etc.
;For simpler code, we proceed in the other direction:
; every star is 6 to the left of the previous one,
; if x<0, 19 is added to the (negative) x-value
; and we go one line down.
;|* * * *| 19, 13, 7, 1, (-5) ->
;| * * * | 14, 8, 2, (-4) ->
;| * * * | 15, 9, 3, (-3) etc.
;| * * * | etc.
;The desired pattern is just these two combined.
;So, all we have to do is start in the correct position (x=15)
; and mirror every star to the other side of the line.
;(In the lines with only 3 stars, they are all drawn twice
; but that doesn't hurt. Actually, in the last line, not
; all stars)
;firmware call
txt_out equ #bb5a
;firmware cursor variables
;These have to be changed in order to work on the CPC464
cur_y equ #b726
cur_x equ #b727
;(*unlike firmware calls, these are 0,0 indexed!!!)
org #bae0 ;It's ugly but it must be located here so that we can call the
;txt_out routine with a relative jump.
;In fact, we overwrite some bytes of the high jump block firmware
;routines, but that doesn't affect the functionality of this code.
ld a,14 ;initial x value (middle star 1st row)
ld bc,59*256 + 18 ;b=total amount of stars (of one diagonal pattern) -1
;c=18 (width-1)
main_loop:
ld hl,cur_x ;(re)set hl to the firmware x coord
ld d,a ;backup x
call draw_star ;draw original star @ x
ld a,c ;mirror x:
sub d ;x-=18
;call draw_star ;draw mirrored star @ 18-x
ld a,d ;restore x
sub 6 ;go 6 char positions left
jr nc,loop_end ;check if <0
;line break:
dec hl ;hl <- cur_y
inc (hl) ;line down
adc c ;x+=18+1
loop_end:
djnz main_loop ;repeat that for 60 stars
;fall through for the last star - it doesn't have to be mirrored,
;because in the last line the mirrored stars are redundant:
draw_star:
ld (hl),a ;set firmware x
ld a,"*" ;again 42, the Answer to the Ultimate Question!
jr txt_out ;relative jump because we located the program
;close enough. (Jump instead of call because it's
;the end of our subroutine/program and we use the
;RET provided by the firmware routine.
;=======================================================================
; Vintage Computing Christmas Challenge 2023 (VC3 2023)
; Amstrad CPC / Typhon
; December 2023
; 99 bytes
;=======================================================================
org #8000
run begin
begin:
ld ix, location
ld b, 9
start:
ld h, (ix + 1)
ld l, (ix + 0)
call TXT_SET_CURSOR
call draw
inc ix
inc ix
djnz start
finish:
ret
draw:
push bc
ld b, data_end - data_begin
ld de, data_begin
loop: ld a, (de)
call TXT_OUTPUT
inc de
djnz loop
pop bc
ret
.locate
call TXT_SET_CURSOR
ret
data_begin:
DEFB #2a
DEFB #0b, #2a, #0b, #2a, #0b, #2a
DEFB #0a, #2a, #0a, #2a, #0a, #2a
DEFB #0a, #08, #08, #2a, #0a, #08, #08, #2a, #0a, #08, #08, #2a
DEFB #0b, #08, #08, #2a, #0b, #08, #08, #2a, #0b, #08, #08, #2a
data_end:
location:
DEFB #04, #01, #04, #07, #04, #0d
DEFB #0a, #01, #0a, #07, #0a, #0d
DEFB #10, #01, #10, #07, #10, #0d
TXT_OUTPUT equ #bb5a ; Print a Character (PRINT)
TXT_SET_CURSOR equ #bb75 ; Set the Cursor Position (LOCATE)
;=======================================================================
; Vintage Computing Christmas Challenge 2023 (VC3 2023)
; Amstrad CPC / Pararaum
; December 2023
; 120 bytes
;=======================================================================
TXTOUT: equ &HBB5A
ORG 0x1000
entry: ld a,12
call TXTOUT
ld hl,lines
call upndown
call upndown
call upndown
call tripleprint
fini: jp fini
upndown:
ld b,3
ld de,8
updown_loop1:
call tripleprint
add hl,de
djnz updown_loop1
ld b,3
updown_loop2:
call tripleprint
or a
sbc hl,de
djnz updown_loop2
ret
; M: a
crlf: ld a,10
call TXTOUT
ld a,13
call TXTOUT
ret
crlf_data: db 10,13,0
; M: a
tripleprint:
push bc
ld b,3
tripleprint_loop1:
push hl
call southl
ld a,8
call TXTOUT
pop hl
djnz tripleprint_loop1
pop bc
jp crlf
; M: a, hl
southl: ld a,(hl)
and a
ret z
call TXTOUT
inc hl
jp southl
lines: db " * ",0
db " * * ",0
db " * * ",0
db "* *",0
END entry