Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Happy Birthday!

41 views
Skip to first unread message

BLuRry

unread,
Mar 22, 2013, 4:06:46 PM3/22/13
to
I wrote this for Antoine's birthday since he's such a nice guy. And really I'm just shamelessly trying to get him to spill the beans on this big secret of his. :-D

Anyway, it requires 65c02 but only barely -- I think the BRA can be changed to a BEQ and it will be 6502 friendly -- I originally was using 65c02 LDA (ZP) opcodes before changing things around during the revision process; I crammed note+duration into individual bytes trying to get it to fit as a one-liner. Alas, I was not successful at making it a one-liner. It still fits as a two-liner though. The data format is simple: High-nibble is duration and low-nibble is the pitch. Pitches are stored in a lookup table. #00 marks the end of the data. I might have gotten it into a one-liner if I simplified the playback but I rather liked the ability to add pauses and have duration work the same for every pitch.

I used a tuning app on my phone to get as close to the right pitch as possible so it shouldn't be painful to listen to I hope. :-D

------------- Assembled format -------------
300: A2 FF E8 BD 36 3 D0 1 60 29 F0 85 8 BD 36 3 29 F A8 B9 2D 3 85 9 A0 0 A5 9 F0 3 2C 30 C0 88 D0 4 C6 8 F0 DA 3A D0 F6 80 ED 0 7F 71

330: 64 5F 54 4B 48 40 41 10 21 10 42 10 31 20 44 10 43 50 41 10 21 10 42 10 31 20 45 10 44 10 41 10 21 10 48 10 36 20 34 10 43 10 62 20 47 10 27 10 46 10 34 20 45 10 44 10

------------- Source format -------------
;Note: Written with ACME, but easy to convert to something else
!cpu 65c02
*=$300
ldx #$ff
loop
inx
lda data,x
bne .notover
rts
.notover
and #$f0
sta $08
lda data,x
and #$0f
tay
lda notes,y
sta $09
ldy #00
;-----------------
.notetick
lda $09
beq .pwmdur
bit $c030
.pwmdur
dey
bne .keepcounting
dec $08
beq loop
.keepcounting
dec
bne .pwmdur
bra .notetick
;----------------
notes !by 0,$7f, $71, $64, $5f, $54, $4B, $48, $40
;----------------

data
!by $41, $10, $21, $10, $42, $10, $31, $20, $44, $10, $43, $50
!by $41, $10, $21, $10, $42, $10, $31, $20, $45, $10, $44, $10
!by $41, $10, $21, $10, $48, $10, $36, $20, $34, $10
!by $43, $10, $62, $20
!by $47, $10, $27, $10, $46, $10, $34, $20, $45, $10, $44, $10

Antoine Vignau

unread,
Mar 22, 2013, 4:38:54 PM3/22/13
to
Thank you so much, I am really honored!
Antoine

BLuRry

unread,
Mar 22, 2013, 4:56:23 PM3/22/13
to
On Friday, March 22, 2013 3:38:54 PM UTC-5, Antoine Vignau wrote:
> Thank you so much, I am really honored!
>
> Antoine

I forgot to mention, if you're on *nix or Mac and have "hexdump" installed you can produce listings directly like so:

acme -o hbday.out -f plain hbday.a && echo 300: `hexdump -v -e '/1 "%02X "' hbday.out`
0 new messages