
;Huby beeper music engine by Shiru (shiru@mail.ru) 04'11
;Two channels of tone, no volume, global speed
;One drum, replaces note on the first channel
;The main feature of this engine is the size, just 100 bytes
;Feel free to do whatever you want with the code, it is PD
OP_INCL equ #2c
module huby
play
ld e,(hl) ;read speed word
inc hl
ld d,(hl)
inc hl
ld (readRow.speed),de ;store it
ld e,(hl) ;read patterns offset
inc hl
ld d,(hl) ;it will be always in DE, and HL is order list pointer now
readPos
inc hl
ld a,(hl) ;read first byte of order list
or a
ret z ;if it is zero, it is end of the song
inc hl
push hl ;store order list pointer
push de ;store patterns offset
ld l,(hl) ;read second byte of order list
ld bc,2*256 ;calculate addresses of two patterns
.read
ld h,c ;pattern number*8
add hl,hl
add hl,hl
add hl,hl
add hl,de ;add patterns offset
push hl ;store pattern address
ld l,a ;now second address
djnz .read
exx
pop hl ;restore pattern addressed in alternative set
pop de
ld b,8 ;play 8 rows
readRow
ld a,(hl) ;read first note
inc hl ;increase first pattern pointer
exa
ld a,(de) ;read second note
inc de ;increase second pattern pointer
exx
ld h,a
exa
ld l,a
cp OP_INCL ;if first note is #2c, it is drum sound
jr z,$+3
xor a
ld (soundLoop.slide),a
.speed=$+1
ld bc,0
di
soundLoop
xor a ;clear carry and set A to zero
dec e ;counter of first channel
jr nz,.l1
ld e,l ;reload if overflow
sub l ;and set carry if note is not zero (mute)
.slide=$
nop ;slide for drum
.l1
dec d ;counter of second channel
jr nz,.l2
ld d,h ;reload if overflow
sub h ;and set carry if note is not zero (mute)
.l2
sbc a,a ;if carry, A=255, otherwise A=0
and 16
out (#fe),a
in a,(#fe) ;read keyboard
cpl
and #1f
jr nz,.l3 ;if any key is pressed, exit loop
dec bc
ld a,b
or c
jr nz,soundLoop ;113/123t
.l3
ld hl,#2758 ;restore alternative HL to default value
exx
ei
jr nz,$+4 ;if any key was pressed, break loop
djnz readRow
pop de
pop hl
jr z,readPos ;if no key was pressed, continue
ret
endmodule

)

However they seem to be more focused on TI83 and later models...
still, TI-83 asm shouldn't be too far away from TI-82. ROM calls will be different, of course, but this routine uses only one anyway, for reading the keyboard. And port numbers will be different, I suppose.
Theorically, you just have to adapt the port number and all things related to hardware, and it should work with your TI
not 100% sure what's going on there, but i think it's an equate for ld (pq),a, where pq = soundLoop, sub-label slide. definately not a typo, since the routine works fine on ZX.
.byte $00
speed ..
.INCLUDE CRASH82.INC
.DB "HUBY 1-BIT TI82", 0
#define db .byte
#define dw .word
;Huby beeper music engine by Shiru (shiru@mail.ru) 04'11
;Two channels of tone, no volume, global speed
;One drum, replaces note on the first channel
;The main feature of this engine is the size, just 100 bytes
;Feel free to do whatever you want with the code, it is PD
ld hl,musicData
call play
play
ld e,(hl) ;read speed word
inc hl
ld d,(hl)
inc hl
ld (speed),de ;store it
ld e,(hl) ;read patterns offset
inc hl
ld d,(hl) ;it will be always in DE, and HL is order list pointer now
readPos
inc hl
ld a,(hl) ;read first byte of order list
or a
ret z ;if it is zero, it is end of the song
inc hl
push hl ;store order list pointer
push de ;store patterns offset
ld l,(hl) ;read second byte of order list
ld bc,2*256 ;calculate addresses of two patterns
read
ld h,c ;pattern number*8
add hl,hl
add hl,hl
add hl,hl
add hl,de ;add patterns offset
push hl ;store pattern address
ld l,a ;now second address
djnz read
exx
pop hl ;restore pattern addressed in alternative set
pop de
ld b,8 ;play 8 rows
readRow
ld a,(hl) ;read first note
inc hl ;increase first pattern pointer
ex af,af'
ld a,(de) ;read second note
inc de ;increase second pattern pointer
exx
ld h,a
ex af,af'
ld l,a
cp $2c ;if first note is $2c, it is drum sound
jr z,$+3
xor a
ld (slide),a
speed equ $+1
ld bc,0
di
soundLoop
xor a ;clear carry and set A to zero
dec e ;counter of first channel
jr nz,l1
ld e,l ;reload if overflow
sub l ;and set carry if note is not zero (mute)
slide equ $
nop ;slide for drum
l1
dec d ;counter of second channel
jr nz,l2
ld d,h ;reload if overflow
sub h ;and set carry if note is not zero (mute)
l2
sbc a,a ;if carry, A=255, otherwise A=0
and 16 ;need a good way to ld a,$c0 / ld a,$fc here
out (0),a
in a,(1) ;read keyboard
cpl ;this must probably be adapted
and $1f
jr nz,l3 ;if any key is pressed, exit loop
dec bc
ld a,b
or c
jr nz,soundLoop ;113/123t
l3
ld hl,$2758 ;restore alternative HL to default value
exx
ei
jr nz,$+4 ;if any key was pressed, break loop
djnz readRow
pop de
pop hl
jr z,readPos ;if no key was pressed, continue
ret
musicData
dw $06f3
dw p-8
db $01,$02
db $01,$02
db $03,$02
db $04,$02
db $05,$02
db $06,$02
db $07,$02
db $01,$02
db $01,$02
db $03,$02
db $04,$02
db $05,$02
db $06,$02
db $07,$02
db $08,$09
db $01,$0a
db $03,$0b
db $04,$0c
db $05,$0d
db $06,$0d
db $07,$0e
db $01,$0a
db $01,$0f
db $03,$10
db $04,$11
db $05,$12
db $06,$13
db $07,$14
db $08,$09
db $01,$0a
db $03,$0b
db $04,$0c
db $05,$0d
db $06,$0d
db $07,$0e
db $01,$0a
db $01,$0f
db $03,$10
db $04,$15
db $05,$16
db $06,$17
db $07,$18
db $01,$02
db $01,$02
db $03,$02
db $04,$02
db $05,$02
db $06,$02
db $07,$02
db $01,$02
db $01,$02
db $03,$02
db $04,$02
db $05,$02
db $06,$02
db $07,$02
db $19,$1a
db $19,$1b
db $1c,$1d
db $1e,$1f
db $20,$21
db $22,$23
db $24,$25
db $19,$1a
db $19,$1a
db $1c,$1d
db $1e,$1f
db $20,$26
db $27,$28
db $02,$29
db $19,$1a
db $19,$1b
db $1c,$1d
db $1e,$1f
db $20,$21
db $22,$23
db $24,$25
db $19,$1a
db $19,$1a
db $1c,$1d
db $1e,$1f
db $20,$26
db $22,$2a
db $2b,$2c
db $2d,$2e
db $2f,$30
db $31,$32
db $33,$34
db $35,$36
db $37,$36
db $38,$39
db $2f,$30
db $2f,$3a
db $31,$3b
db $33,$3c
db $35,$3d
db $37,$3e
db $38,$3f
db $40,$41
db $19,$42
db $1c,$43
db $44,$45
db $46,$47
db $22,$47
db $48,$49
db $19,$42
db $19,$0a
db $1c,$4a
db $44,$4b
db $20,$4c
db $4d,$4e
db $07,$18
db $01,$02
db $01,$02
db $03,$02
db $04,$02
db $05,$02
db $06,$02
db $07,$02
db $19,$02
db $19,$02
db $1c,$02
db $1e,$02
db $20,$02
db $4f,$02
db $50,$02
db $01,$02
db $01,$02
db $03,$02
db $04,$02
db $05,$02
db $06,$02
db $07,$02
db $19,$02
db $19,$02
db $1c,$02
db $51,$02
db $02,$02
db $52,$02
db $50,$02
db $00
p
db $be,$be,$5f,$50,$3f,$00,$00,$00
db $00,$00,$00,$00,$00,$00,$00,$00
db $d6,$d6,$d6,$d6,$d6,$d6,$ca,$ca
db $ca,$ca,$ca,$ca,$be,$be,$5f,$50
db $3f,$00,$00,$00,$be,$be,$5f,$50
db $3f,$00,$00,$00,$d6,$d6,$d6,$d6
db $d6,$d6,$ca,$ca,$ca,$ca,$ca,$ca
db $be,$be,$5f,$50,$00,$00,$00,$00
db $5f,$5f,$5f,$5f,$3f,$3f,$00,$00
db $3f,$3f,$3f,$3f,$47,$47,$00,$00
db $47,$47,$47,$47,$50,$50,$54,$54
db $00,$00,$00,$00,$50,$50,$50,$50
db $54,$54,$00,$00,$50,$50,$50,$50
db $47,$47,$3f,$3f,$00,$00,$00,$00
db $47,$47,$47,$47,$50,$50,$00,$00
db $50,$50,$50,$50,$54,$54,$5f,$5f
db $5f,$00,$00,$00,$54,$54,$54,$54
db $50,$50,$00,$00,$50,$50,$50,$50
db $47,$47,$00,$00,$47,$47,$47,$47
db $3f,$3f,$00,$00,$3f,$00,$3f,$00
db $5f,$00,$00,$00,$54,$54,$50,$50
db $47,$47,$00,$00,$3f,$3f,$47,$47
db $50,$50,$00,$00,$3f,$3f,$3f,$47
db $47,$47,$50,$50,$50,$00,$00,$00
db $a9,$a9,$54,$47,$38,$00,$00,$00
db $fe,$fe,$a9,$8e,$71,$00,$00,$00
db $fe,$fe,$fe,$8e,$71,$00,$00,$00
db $be,$be,$be,$be,$be,$be,$b3,$b3
db $bd,$bd,$bd,$bd,$bd,$bd,$b2,$b2
db $b3,$b3,$b3,$b3,$a9,$a9,$54,$47
db $b2,$b2,$b2,$b2,$fe,$fe,$a9,$8e
db $38,$00,$00,$00,$a9,$a9,$54,$47
db $71,$00,$00,$00,$fe,$fe,$fe,$00
db $38,$00,$00,$00,$be,$be,$be,$be
db $00,$00,$00,$00,$71,$71,$71,$71
db $be,$be,$be,$7f,$7f,$7f,$7f,$7f
db $8e,$8e,$8e,$a9,$a9,$a9,$a9,$a9
db $71,$00,$00,$00,$fe,$fe,$00,$00
db $38,$00,$00,$00,$00,$00,$00,$00
db $00,$00,$00,$00,$fe,$d6,$a9,$7f
db $6b,$54,$47,$3f,$35,$2a,$23,$1c
db $00,$00,$00,$00,$7f,$7f,$7f,$7f
db $be,$be,$be,$b3,$b3,$b3,$b3,$b3
db $78,$78,$78,$71,$71,$71,$71,$71
db $a0,$a0,$50,$43,$00,$00,$00,$00
db $50,$50,$50,$50,$35,$35,$00,$00
db $a0,$a0,$50,$43,$35,$00,$00,$00
db $35,$35,$35,$35,$3c,$3c,$00,$00
db $b3,$b3,$b3,$b3,$b3,$b3,$a9,$a9
db $3c,$3c,$3c,$3c,$43,$43,$47,$47
db $a9,$a9,$a9,$a9,$a0,$a0,$50,$43
db $00,$00,$00,$00,$43,$43,$43,$43
db $35,$00,$00,$00,$a0,$a0,$50,$43
db $47,$47,$00,$00,$43,$43,$43,$43
db $35,$00,$00,$00,$b3,$b3,$b3,$b3
db $b3,$b3,$a9,$a9,$a9,$a9,$a9,$a9
db $3c,$3c,$35,$35,$00,$00,$00,$00
db $3c,$3c,$3c,$3c,$43,$43,$00,$00
db $43,$43,$43,$43,$47,$47,$50,$50
db $50,$00,$00,$00,$47,$47,$47,$47
db $43,$43,$00,$00,$43,$43,$43,$43
db $3c,$3c,$00,$00,$3c,$3c,$3c,$3c
db $35,$35,$00,$00,$35,$00,$35,$00
db $a9,$a9,$54,$47,$00,$00,$00,$00
db $54,$54,$54,$54,$38,$38,$00,$00
db $38,$38,$38,$38,$3f,$3f,$00,$00
db $3f,$3f,$3f,$3f,$47,$47,$4b,$4b
db $b3,$b3,$b3,$b3,$a9,$a9,$54,$4b
db $00,$00,$00,$00,$47,$47,$47,$47
db $38,$00,$00,$00,$a9,$a9,$54,$4b
db $4b,$4b,$00,$00,$47,$47,$47,$47
db $be,$be,$b3,$b3,$b3,$b3,$b3,$b3
db $3f,$3f,$38,$38,$00,$00,$00,$00
db $47,$47,$47,$47,$4b,$4b,$54,$54
db $54,$00,$00,$00,$4b,$4b,$47,$47
db $3f,$3f,$00,$00,$38,$38,$3f,$3f
db $38,$00,$00,$00,$d6,$d6,$d6,$d6
db $47,$47,$00,$00,$3f,$3f,$3f,$47
db $38,$00,$00,$00,$a9,$a9,$a9,$a9
db $a9,$a9,$b3,$b3,$b3,$b3,$b3,$b3
db $b3,$b3,$b3,$b3,$a9,$a9,$a9,$00
db $00,$00,$00,$00,$a9,$a9,$a9,$a9
defb 021h,06Dh,0C0h,0CDh,009h,0C0h,0C3h,000h,0C0h,05Eh,023h,056h,023h,0EDh,053h,03Fh
defb 0C0h,05Eh,023h,056h,023h,07Eh,0B7h,0C8h,023h,0E5h,0D5h,06Eh,001h,000h,002h,061h
defb 029h,029h,029h,019h,0E5h,06Fh,010h,0F7h,0D9h,0E1h,0D1h,006h,008h,07Eh,023h,008h
defb 01Ah,013h,0D9h,067h,008h,06Fh,0FEh,02Ch,028h,001h,0AFh,032h,048h,0C0h,001h,000h
defb 000h,0F3h,0AFh,01Dh,020h,003h,05Dh,095h,000h,015h,020h,002h,054h,094h,09Fh,0E6h
defb 010h,0D3h,0FEh,0DBh,0FEh,02Fh,0E6h,01Fh,020h,005h,00Bh,078h,0B1h,020h,0E3h,021h
defb 058h,027h,0D9h,0FBh,020h,002h,010h,0C5h,0D1h,0E1h,028h,0A8h,0C9h,0F3h,006h,082h
defb 0C1h,001h,002h,001h,002h,003h,002h,004h,002h,005h,002h,006h,002h,007h,002h,001h
defb 002h,001h,002h,003h,002h,004h,002h,005h,002h,006h,002h,007h,002h,008h,009h,001h
defb 00Ah,003h,00Bh,004h,00Ch,005h,00Dh,006h,00Dh,007h,00Eh,001h,00Ah,001h,00Fh,003h
defb 010h,004h,011h,005h,012h,006h,013h,007h,014h,008h,009h,001h,00Ah,003h,00Bh,004h
defb 00Ch,005h,00Dh,006h,00Dh,007h,00Eh,001h,00Ah,001h,00Fh,003h,010h,004h,015h,005h
defb 016h,006h,017h,007h,018h,001h,002h,001h,002h,003h,002h,004h,002h,005h,002h,006h
defb 002h,007h,002h,001h,002h,001h,002h,003h,002h,004h,002h,005h,002h,006h,002h,007h
defb 002h,019h,01Ah,019h,01Bh,01Ch,01Dh,01Eh,01Fh,020h,021h,022h,023h,024h,025h,019h
defb 01Ah,019h,01Ah,01Ch,01Dh,01Eh,01Fh,020h,026h,027h,028h,002h,029h,019h,01Ah,019h
defb 01Bh,01Ch,01Dh,01Eh,01Fh,020h,021h,022h,023h,024h,025h,019h,01Ah,019h,01Ah,01Ch
defb 01Dh,01Eh,01Fh,020h,026h,022h,02Ah,02Bh,02Ch,02Dh,02Eh,02Fh,030h,031h,032h,033h
defb 034h,035h,036h,037h,036h,038h,039h,02Fh,030h,02Fh,03Ah,031h,03Bh,033h,03Ch,035h
defb 03Dh,037h,03Eh,038h,03Fh,040h,041h,019h,042h,01Ch,043h,044h,045h,046h,047h,022h
defb 047h,048h,049h,019h,042h,019h,00Ah,01Ch,04Ah,044h,04Bh,020h,04Ch,04Dh,04Eh,007h
defb 018h,
;data section starts here
001h,002h,001h,002h,003h,002h,004h,002h,005h,002h,006h,002h,007h,002h,019h
defb 002h,019h,002h,01Ch,002h,01Eh,002h,020h,002h,04Fh,002h,050h,002h,001h,002h,001h
defb 002h,003h,002h,004h,002h,005h,002h,006h,002h,007h,002h,019h,002h,019h,002h,01Ch
defb 002h,051h,002h,002h,002h,052h,002h,050h,002h,000h,0BEh,0BEh,05Fh,050h,03Fh,000h
defb 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,0D6h,0D6h,0D6h,0D6h,0D6h,0D6h
defb 0CAh,0CAh,0CAh,0CAh,0CAh,0CAh,0BEh,0BEh,05Fh,050h,03Fh,000h,000h,000h,0BEh,0BEh
defb 05Fh,050h,03Fh,000h,000h,000h,0D6h,0D6h,0D6h,0D6h,0D6h,0D6h,0CAh,0CAh,0CAh,0CAh
defb 0CAh,0CAh,0BEh,0BEh,05Fh,050h,000h,000h,000h,000h,05Fh,05Fh,05Fh,05Fh,03Fh,03Fh
defb 000h,000h,03Fh,03Fh,03Fh,03Fh,047h,047h,000h,000h,047h,047h,047h,047h,050h,050h
defb 054h,054h,000h,000h,000h,000h,050h,050h,050h,050h,054h,054h,000h,000h,050h,050h
defb 050h,050h,047h,047h,03Fh,03Fh,000h,000h,000h,000h,047h,047h,047h,047h,050h,050h
defb 000h,000h,050h,050h,050h,050h,054h,054h,05Fh,05Fh,05Fh,000h,000h,000h,054h,054h
defb 054h,054h,050h,050h,000h,000h,050h,050h,050h,050h,047h,047h,000h,000h,047h,047h
defb 047h,047h,03Fh,03Fh,000h,000h,03Fh,000h,03Fh,000h,05Fh,000h,000h,000h,054h,054h
defb 050h,050h,047h,047h,000h,000h,03Fh,03Fh,047h,047h,050h,050h,000h,000h,03Fh,03Fh
defb 03Fh,047h,047h,047h,050h,050h,050h,000h,000h,000h,0A9h,0A9h,054h,047h,038h,000h
defb 000h,000h,0FEh,0FEh,0A9h,08Eh,071h,000h,000h,000h,0FEh,0FEh,0FEh,08Eh,071h,000h
defb 000h,000h,0BEh,0BEh,0BEh,0BEh,0BEh,0BEh,0B3h,0B3h,0BDh,0BDh,0BDh,0BDh,0BDh,0BDh
defb 0B2h,0B2h,0B3h,0B3h,0B3h,0B3h,0A9h,0A9h,054h,047h,0B2h,0B2h,0B2h,0B2h,0FEh,0FEh
defb 0A9h,08Eh,038h,000h,000h,000h,0A9h,0A9h,054h,047h,071h,000h,000h,000h,0FEh,0FEh
defb 0FEh,000h,038h,000h,000h,000h,0BEh,0BEh,0BEh,0BEh,000h,000h,000h,000h,071h,071h
defb 071h,071h,0BEh,0BEh,0BEh,07Fh,07Fh,07Fh,07Fh,07Fh,08Eh,08Eh,08Eh,0A9h,0A9h,0A9h
defb 0A9h,0A9h,071h,000h,000h,000h,0FEh,0FEh,000h,000h,038h,000h,000h,000h,000h,000h
defb 000h,000h,000h,000h,000h,000h,0FEh,0D6h,0A9h,07Fh,06Bh,054h,047h,03Fh,035h,02Ah
defb 023h,01Ch,000h,000h,000h,000h,07Fh,07Fh,07Fh,07Fh,0BEh,0BEh,0BEh,0B3h,0B3h,0B3h
defb 0B3h,0B3h,078h,078h,078h,071h,071h,071h,071h,071h,0A0h,0A0h,050h,043h,000h,000h
defb 000h,000h,050h,050h,050h,050h,035h,035h,000h,000h,0A0h,0A0h,050h,043h,035h,000h
defb 000h,000h,035h,035h,035h,035h,03Ch,03Ch,000h,000h,0B3h,0B3h,0B3h,0B3h,0B3h,0B3h
defb 0A9h,0A9h,03Ch,03Ch,03Ch,03Ch,043h,043h,047h,047h,0A9h,0A9h,0A9h,0A9h,0A0h,0A0h
defb 050h,043h,000h,000h,000h,000h,043h,043h,043h,043h,035h,000h,000h,000h,0A0h,0A0h
defb 050h,043h,047h,047h,000h,000h,043h,043h,043h,043h,035h,000h,000h,000h,0B3h,0B3h
defb 0B3h,0B3h,0B3h,0B3h,0A9h,0A9h,0A9h,0A9h,0A9h,0A9h,03Ch,03Ch,035h,035h,000h,000h
defb 000h,000h,03Ch,03Ch,03Ch,03Ch,043h,043h,000h,000h,043h,043h,043h,043h,047h,047h
defb 050h,050h,050h,000h,000h,000h,047h,047h,047h,047h,043h,043h,000h,000h,043h,043h
defb 043h,043h,03Ch,03Ch,000h,000h,03Ch,03Ch,03Ch,03Ch,035h,035h,000h,000h,035h,000h
defb 035h,000h,0A9h,0A9h,054h,047h,000h,000h,000h,000h,054h,054h,054h,054h,038h,038h
defb 000h,000h,038h,038h,038h,038h,03Fh,03Fh,000h,000h,03Fh,03Fh,03Fh,03Fh,047h,047h
defb 04Bh,04Bh,0B3h,0B3h,0B3h,0B3h,0A9h,0A9h,054h,04Bh,000h,000h,000h,000h,047h,047h
defb 047h,047h,038h,000h,000h,000h,0A9h,0A9h,054h,04Bh,04Bh,04Bh,000h,000h,047h,047h
defb 047h,047h,0BEh,0BEh,0B3h,0B3h,0B3h,0B3h,0B3h,0B3h,03Fh,03Fh,038h,038h,000h,000h
defb 000h,000h,047h,047h,047h,047h,04Bh,04Bh,054h,054h,054h,000h,000h,000h,04Bh,04Bh
defb 047h,047h,03Fh,03Fh,000h,000h,038h,038h,03Fh,03Fh,038h,000h,000h,000h,0D6h,0D6h
defb 0D6h,0D6h,047h,047h,000h,000h,03Fh,03Fh,03Fh,047h,038h,000h,000h,000h,0A9h,0A9h
defb 0A9h,0A9h,0A9h,0A9h,0B3h,0B3h,0B3h,0B3h,0B3h,0B3h,0B3h,0B3h,0B3h,0B3h,0A9h,0A9h
defb 0A9h,000h,000h,000h,000h,000h,0A9h,0A9h,0A9h,0A9h
Don't ask me, it doesn't make much sense to me either. I still think my original explanation with .byte $00 is better...
org $8000
l_8000: ld hl, l_806d ; 8000 21 6d 80 $0ats
call l_8009 ; 8003 cd 09 80 $11ts
jp l_8000 ; 8006 c3 00 80 $0ats
l_8009: ld e, (hl) ; 8009 5e $07ts
inc hl ; 800a 23 $06ts
ld d, (hl) ; 800b 56 $07ts
inc hl ; 800c 23 $06ts
ld ($803f), de ; 800d ed 53 3f 80 $14ts
ld e, (hl) ; 8011 5e $07ts
inc hl ; 8012 23 $06ts
ld d, (hl) ; 8013 56 $07ts
l_8014: inc hl ; 8014 23 $06ts
ld a, (hl) ; 8015 7e $07ts
or a ; 8016 b7 $04ts
ret z ; 8017 c8 $0b/$05ts
inc hl ; 8018 23 $06ts
push hl ; 8019 e5 $0bts
push de ; 801a d5 $0bts
ld l, (hl) ; 801b 6e $07ts
ld bc, $0200 ; 801c 01 00 02 $0ats
l_801f: ld h, c ; 801f 61 $04ts
add hl, hl ; 8020 29 $0bts
add hl, hl ; 8021 29 $0bts
add hl, hl ; 8022 29 $0bts
add hl, de ; 8023 19 $0bts
push hl ; 8024 e5 $0bts
ld l, a ; 8025 6f $04ts
djnz l_801f ; 8026 10 f7 $08/$0dts
exx ; 8028 d9 $04ts
pop hl ; 8029 e1 $0ats
pop de ; 802a d1 $0ats
ld b, $08 ; 802b 06 08 $07ts
l_802d: ld a, (hl) ; 802d 7e $07ts
inc hl ; 802e 23 $06ts
ex af, af' ; 802f 08 $04ts
ld a, (de) ; 8030 1a $07ts
inc de ; 8031 13 $06ts
exx ; 8032 d9 $04ts
ld h, a ; 8033 67 $04ts
ex af, af' ; 8034 08 $04ts
ld l, a ; 8035 6f $04ts
cp $2c ; 8036 fe 2c $07ts
jr z, l_803b ; 8038 28 01 $0c/$07ts
xor a ; 803a af $04ts
l_803b: ld (l_8048), a ; 803b 32 48 80 $0dts
ld bc, $06f3 ; 803e 01 f3 06 $0ats
di ; 8041 f3 $04ts
l_8042: xor a ; 8042 af $04ts
dec e ; 8043 1d $04ts
jr nz, l_8049 ; 8044 20 03 $07/$0cts
ld e, l ; 8046 5d $04ts
sub l ; 8047 95 $04ts
l_8048: nop ; 8048 00 $04ts
l_8049: dec d ; 8049 15 $04ts
jr nz, l_804e ; 804a 20 02 $07/$0cts
ld d, h ; 804c 54 $04ts
sub h ; 804d 94 $04ts
l_804e: sbc a, a ; 804e 9f $04ts
and $10 ; 804f e6 10 $07ts
out ($fe), a ; 8051 d3 fe $0bts
in a, ($fe) ; 8053 db fe $0bts
cpl ; 8055 2f $04ts
and $1f ; 8056 e6 1f $07ts
jr nz, l_805f ; 8058 20 05 $07/$0cts
dec bc ; 805a 0b $06ts
ld a, b ; 805b 78 $04ts
or c ; 805c b1 $04ts
jr nz, l_8042 ; 805d 20 e3 $07/$0cts
l_805f: ld hl, $2758 ; 805f 21 58 27 $0ats
exx ; 8062 d9 $04ts
ei ; 8063 fb $04ts
jr nz, l_8068 ; 8064 20 02 $07/$0cts
djnz l_802d ; 8066 10 c5 $08/$0dts
l_8068: pop de ; 8068 d1 $0ats
pop hl ; 8069 e1 $0ats
jr z, l_8014 ; 806a 28 a8 $0c/$07ts
ret ; 806c c9 $0ats
.INCLUDE CRASH82.INC
.DB "HUBY 1-BIT TI82 0.5", 0
#define db .byte
#define dw .word
;Huby beeper music engine by Shiru (shiru@mail.ru) 04'11
;Two channels of tone, no volume, global speed
;One drum, replaces note on the first channel
;The main feature of this engine is the size, just 100 bytes
;Feel free to do whatever you want with the code, it is PD
ld hl,musicData
ld a,%00010000 ;+ set interrupts to
fastest mode
out (4),a
call play
play
ld e,(hl) ;read speed word
inc hl
ld d,(hl)
inc hl
ld (speed),de ;store it
ld e,(hl) ;read patterns offset
inc hl
ld d,(hl) ;it will be always in
DE, and HL is order list pointer now
readPos
inc hl
ld a,(hl) ;read first byte of
order list
or a
ret z ;if it is zero, it is
end of the song
inc hl
push hl ;store order list
pointer
push de ;store patterns offset
ld l,(hl) ;read second byte of
order list
ld bc,2*256 ;calculate addresses
of two patterns
read
ld h,c ;pattern number*8
add hl,hl
add hl,hl
add hl,hl
add hl,de ;add patterns offset
push hl ;store pattern address
ld l,a ;now second address
djnz read
exx
pop hl ;restore pattern
addressed in alternative set
pop de
ld b,8 ;play 8 rows
readRow
ld a,(hl) ;read first note
inc hl ;increase first
pattern pointer
ex af,af'
ld a,(de) ;read second note
inc de ;increase second
pattern pointer
exx
ld h,a
ex af,af'
ld l,a
cp $2c ;if first note is $2c,
it is drum sound
jr z,$+3
xor a
ld (slide),a
speed .EQU $+1
ld bc,0
di
soundLoop
xor a ;clear carry and set A
to zero
dec e ;counter of first
channel
jr nz,l1
ld e,l ;reload if overflow
sub l ;and set carry if note
is not zero (mute)
slide .EQU $
nop ;slide for drum
l1
dec d ;counter of second
channel
jr nz,l2
ld d,h ;reload if overflow
sub h ;and set carry if note
is not zero (mute)
l2
sbc a,a ;if carry, A=255,
otherwise A=0
xor %11111100 ;+ $ff -> $c0, $0 ->
$fc
and %00111100
add a,12
out (0),a
out (0),a
out (0),a
out (0),a ;+ 4x to compensate
higher cpu speed
ld a,%10111111 ;+ new keyhandler
out (1),a
in a,(1) ;read keyboard
cpl
bit 6,a
jr nz,l3 ;if any key is
pressed, exit loop
dec bc
ld a,b
or c
jr nz,soundLoop ;113/123t + not
anymore i think
l3
ld hl,$2758 ;restore alternative
HL to default value
exx
ei
jr nz,$+4 ;if any key was
pressed, break loop
djnz readRow
pop de
pop hl
jr z,readPos ;if no key was
pressed, continue
ld a,%00010110 ;+ set interrupts back
to normal
out (4),a
;ret
jp EXIT_2_TIOS ;use CrASH syscall to
return properly
musicData
dw $06f3
dw p-8
db $01,$02
db $01,$03
db $04,$05
db $06,$07
db $08,$09
db $0a,$0b
db $0c,$0d
db $0e,$0f
db $01,$02
db $01,$03
db $04,$05
db $06,$07
db $08,$09
db $0a,$0b
db $0c,$0d
db $0e,$0f
db $10,$02
db $11,$03
db $12,$05
db $13,$07
db $14,$09
db $15,$0b
db $16,$0d
db $17,$0f
db $18,$02
db $18,$03
db $19,$05
db $19,$07
db $1a,$09
db $1a,$0b
db $1b,$0d
db $1c,$0f
db $01,$02
db $01,$03
db $04,$05
db $06,$07
db $08,$09
db $0a,$0b
db $0c,$0d
db $0e,$0f
db $1d,$02
db $1d,$03
db $1e,$05
db $1e,$07
db $1f,$09
db $1f,$0b
db $20,$0d
db $21,$0f
db $10,$02
db $11,$03
db $12,$05
db $13,$07
db $14,$09
db $15,$0b
db $16,$0d
db $17,$0f
db $18,$02
db $18,$03
db $19,$05
db $19,$07
db $1a,$09
db $1a,$0b
db $1b,$0d
db $1c,$0f
db $00
p
db $2c,$3c,$b3,$3c,$b3,$3c,$b3,$3c
db $59,$59,$50,$50,$4b,$4b,$4b,$4b
db $4b,$4b,$4b,$4b,$59,$59,$59,$59
db $2c,$38,$b3,$38,$b3,$38,$b3,$38
db $43,$43,$43,$43,$43,$43,$43,$43
db $2c,$38,$b3,$38,$2c,$38,$2c,$38
db $43,$43,$43,$43,$4b,$4b,$50,$50
db $b3,$32,$b3,$32,$2c,$32,$b3,$32
db $4b,$4b,$50,$50,$59,$59,$59,$59
db $2c,$32,$b3,$32,$b3,$32,$b3,$32
db $59,$59,$59,$59,$4b,$4b,$4b,$4b
db $2c,$43,$b3,$43,$b3,$43,$b3,$43
db $50,$50,$50,$50,$50,$50,$50,$50
db $2c,$43,$b3,$43,$2c,$a0,$2c,$86
db $50,$50,$50,$50,$43,$43,$3c,$3c
db $2c,$3c,$e2,$3c,$e2,$3c,$2c,$3c
db $2c,$3c,$e2,$3c,$2c,$3c,$2c,$3c
db $2c,$38,$e2,$38,$e2,$38,$e2,$38
db $e2,$38,$2c,$38,$2c,$38,$e2,$38
db $2c,$32,$e2,$32,$2c,$32,$e2,$32
db $e2,$32,$e2,$32,$2c,$32,$e2,$32
db $2c,$43,$e2,$43,$e2,$43,$e2,$43
db $2c,$43,$2c,$43,$2c,$2c,$2c,$2c
db $f0,$3c,$f0,$3c,$f0,$3c,$f0,$3c
db $f0,$38,$f0,$38,$f0,$38,$f0,$38
db $f0,$32,$f0,$32,$f0,$32,$f0,$32
db $f0,$43,$f0,$43,$f0,$43,$f0,$43
db $f0,$43,$f0,$43,$f0,$a0,$f0,$86
db $78,$3c,$78,$3c,$78,$3c,$78,$3c
db $78,$38,$78,$38,$78,$38,$78,$38
db $78,$32,$78,$32,$78,$32,$78,$32
db $78,$43,$78,$43,$78,$43,$78,$43
db $78,$43,$78,$43,$78,$a0,$78,$86
