******************************************************************************** * ByteSCApe: draw the SCA logo in 256 bytes. Coded by Saturnus the Invincible. * * The Mega-Mighty Swiss Cracking Association - reaching out to you! 2024-03-08 * ******************************************************************************** include "graphics/graphics_lib.i" include "graphics/rastport.i" include "intuition/screens.i" wrch equ $e0 ; d1:char writespaces equ $d4 ; d2:amount intuitionbase equ $170 ; globvec offset eb_gfxbase equ $9c ; execbase offset _main: moveq #32,d0 ; bcpl stack frame size moveq #78,d2 ; 78 spaces movea.l writespaces(a2),a4 ; get routine from globvec jsr (a5) ; call bcpl lea text(pc),a0 .charloop: move.b (a0)+,d1 beq.b .text_done movea.l wrch(a2),a4 move.l a0,d5 ; wrch() preserves d5 but not a0 jsr (a5) moveq #' ',d1 movea.l wrch(a2),a4 jsr (a5) movea.l d5,a0 bra.b .charloop .text_done: movea.l intuitionbase(a2),a6 movea.l ib_ActiveScreen(a6),a1 lea sc_RastPort(a1),a1 movea.l 4.w,a6 movea.l eb_gfxbase(a6),a6 ; shortcut to graphics.library moveq #1,d0 ; white jsr _LVOSetAPen(a6) ; preserves a1, nice! lea sca_logo(pc),a4 movem.w (a4)+,d3-d7/a3 ; #lines,x,y,length,dx,dy .stem_loop: bsr.b draw_line addi.w #140,d4 ; x dbf d3,.stem_loop .draw_loop: move.w (a4)+,d0 ; dx beq.b draw_done add.w d0,d4 ; d4: x move.b (a4)+,d0 ; dy ext.w d0 add.w d0,d5 ; d5: y moveq #0,d6 move.b (a4)+,d6 ; d6: length (unsigned) move.b (a4)+,d7 ; d7: dx (signed) ext.w d7 move.b (a4)+,d0 ; dy (signed) ext.w d0 movea.w d0,a3 ; a3: dy bsr.b draw_line bra.b .draw_loop rts ; waste two bytes (we're gonna save them later) ; The secret BrazenHum algorithm: d4:x, d5:y, d6:length, d7:dx, a3:dy draw_line: movem.l d3-d6,-(sp) .loop: move.w d4,d0 move.w d5,d1 moveq #3,d2 ; width of ellipse moveq #2,d3 ; height jsr _LVODrawEllipse(a6) ; preserves a1, nice! add.w d7,d4 add.w a3,d5 dbf d6,.loop movem.l (sp)+,d3-d6 draw_done: moveq #0,d0 ; CLI return code (TnX Depeche for saving 2 bytes!) rts sca_logo: dc.w 3,110,72,50,-1,2 ; four stems ; array of [word dx0 byte dy0,length,dx,dy] dc.w -137 ; horizontal top line dc.b 2,143,-3,0 dc.w 593 ; horizontal bottom line dc.b 95,143,-3,0 dc.w -249 ; S top dc.b -66,24,-3,0 dc.w -91 ; S bottom dc.b 33,24,-3,0 dc.w 224 ; C dc.b -18,24,-3,0 dc.w 112 ; A horizontal dc.b -18,24,-3,0 dc.w -53 ; A vertical dc.b 33,18,-1,2 dc.w 0 ; end marker text: dc.b "The Mega-Mighty",10,0 ; 0 follows anyway, not necessary but we got the space end