pouët.net

Go to bottom

wchrmas pattern by AttentionWhore

wchrmas pattern

Author: Losso / AttentionWhore
Category: Christmas Challenge
System:   Amiga
Language: Assembler
Len source code: 390
Len exe file:    96
Len code only:   60

Instructions:
Execute the file in a CLI/Shell window on any
Kickstart version. WinUAE will auto-run the
file when passed as an argument. Or use the
provided ADF disk image in any other Amiga
emulator.

Loops forever when done.

Description:
A compact pattern writer for all Amigas. The
AmigaDOS overhead for executable files is 36
bytes, so we have:

36 bytes overhead + 60 bytes code = 96 bytes 

Tricks used to keep it small:

- Text output using the "wchr" BCPL call
- Use initial register contents of d0, d4
- Lots of experiments with different
  constants, counting methods, compare-free
  abort conditions

It took about a week of night-time coding to
get the initial version from 88 bytes of code
down to 60. Yet, I am almost sure I still
missed an optimizing opportunity or two... :)

Expect a little write-up at:
https://heckmeck.de/demoscene/wchrmas-pattern/

Comments:

File and code breakdown:

----- HEADER tag, table, CODE tag -----------

0000: 0000 03f3 0000 0000 0000 0001 0000 0000
0010: 0000 0000 0000 000f 0000 03e9 0000 000f

----- Code ----------------------------------

0020: 7c04 7e04 7220 6122 6120 d07c 06bc 6808
0030: 7000 5246 5747 720a 48e7 fffe 7020 286a
0040: 00e0 4e95 4cdf 7fff 60da 5346 6c02 5c46
0050: 6606 722a 5404 65fe cd47 4e75

----- END tag -------------------------------

0050:                               0000 03f2


7c04      |         moveq   #4,d6
7e04      |         moveq   #4,d7
7220      | .loop   moveq   #32,d1
6122      |         bsr.b   .mod
6120      |         bsr.b   .mod
d07c 06bc |         add.w   #1724,d0
6808      |         bvc.b   .puts
7000      |         moveq   #0,d0
5246      |         addq.w  #1,d6
5747      |         subq.w  #3,d7
720a      |         moveq   #10,d1
48e7 fffe | .puts   movem.l d0-a6,-(a7)
7020      |         moveq   #32,d0
286a 00e0 |         move.l  224(a2),a4
4e95      |         jsr     (a5)
4cdf 7fff |         movem.l (a7)+,d0-a6
60da      |         bra.b   .loop
5346      | .mod    subq.w   #1,d6
6c02      |         bge.b   .norst
5c46      |         addq    #6,d6
6606      | .norst  bne.b   .nostr
722a      |         moveq   #42,d1
5404      |         addq.b  #2,d4
65fe      | .done   bcs.b   done
cd47      | .nostr  exg     d6,d7
4e75      |         rts
Go to top