xxl Posted July 26, 2012 Share Posted July 26, 2012 MusicStudio Engine for GTIA (source code) opt h+l+o+ gractl equ $d01d consol equ $d01f skctl equ $d20f dmactl equ $d400 nmien equ $d40e S_REG equ $f0 speed equ $f1 _channel equ $f2 ; 4 byte org $2000 run_adr sei lda #$00 sta nmien sta gractl sta dmactl music_studio_stack tsx stx S_REG ldx #$03 _lch lda _ch1,x sta _channel,x dex bpl _lch _loop lda skctl and #$04 bne _cont ldx S_REG txs rts _cont ldx #$00 _load lda (_channel,x) bpl _80_1 lda _ch1,x sta _channel,x lda _ch1+1,x sta _channel+1,x lda (_channel,x) _80_1 inc _channel,x bne _80_2 inc _channel+1,x _80_2 tay lda _nuty,y pha pha pha sec sbc #$01 pha beq _80_en1 lda #$08 _80_en1 pha lda #$00 pha txa eor #%10 tax bne _load tay ; =0 lda music_speed sta speed _iloop tsx _2kolej lda $0101,x sta consol dec $0105,x bne _2kl eor $0102,x sta $0101,x lda $0106,x sta $0105,x lda $0104,x cmp #$20 bcs _2kl inc $0106,x _2kl dec $0103,x bne _2kn lda $0101,x eor $0102,x sta $0101,x lda $0106,x sta $0103,x dec $0103,x _2kn txa ;clc ; too slow, replace with sbx ;adc #$06 ;tax sbx #$100-$06 ; +6 cpx S_REG bne _2kolej dey bne _iloop dec speed bne _iloop txs jmp _loop _nuty .byte $FF,$F0,$E3,$D7,$CB,$C0,$B4,$AB .byte $A1,$97,$90,$88,$80,$79,$72,$6C .byte $66,$60,$5B,$56,$51,$4C,$48,$44 .byte $40,$3D,$39,$36,$33,$30,$2D,$2B .byte $28,$26,$24,$22,$20,$1E,$1C,$1B .byte $19,$18,$17,$15,$14,$13,$12,$11 .byte $10,$01 music_speed .byte $0f _ch1 .word kanal1 _ch2 .word kanal2 kanal1 .byte $00,$0C,$00,$0C,$00,$0C,$00,$0C .byte $08,$14,$08,$14,$05,$11,$05,$11 .byte $00,$0C,$00,$0C,$00,$0C,$00,$0C .byte $08,$14,$08,$14,$05,$11,$05,$07 .byte $00,$0C,$00,$0C,$00,$0C,$00,$0C .byte $08,$14,$08,$14,$05,$11,$05,$07 .byte $00,$0C,$00,$0C,$00,$0C,$00,$0C .byte $08,$14,$08,$14,$05,$11,$05,$07 .byte $00,$0C,$25,$0C,$00,$0C,$25,$0C .byte $03,$0F,$25,$0F,$03,$0F,$25,$25 .byte $08,$14,$25,$14,$08,$14,$25,$14 .byte $05,$11,$25,$11,$05,$11,$25,$25 .byte $00,$0C,$25,$0C,$00,$0C,$00,$0C .byte $03,$0F,$25,$0F,$03,$0F,$25,$0F .byte $08,$14,$25,$14,$08,$14,$25,$14 .byte $05,$11,$25,$11,$07,$25,$25,$25 .byte $03,$0F,$25,$0F,$03,$0F,$25,$0F .byte $05,$11,$25,$11,$05,$11,$25,$25 .byte $00,$0C,$25,$0C,$00,$0C,$25,$0C .byte $0A,$16,$25,$16,$0A,$25,$0A,$25 .byte $03,$0F,$25,$0F,$03,$0F,$25,$25 .byte $05,$11,$25,$11,$05,$11,$25,$25 .byte $00,$0C,$25,$0C,$00,$0C,$25,$0C .byte $0A,$16,$25,$16,$0A,$25,$0A,$25 .byte $00,$0C,$25,$0C,$00,$0C,$25,$0C .byte $00,$0C,$25,$0C,$07,$05,$25,$25 .byte $00,$0C,$25,$0C,$00,$0C,$25,$0C .byte $00,$0C,$25,$0C,$07,$25,$03,$25 .byte $30,$30,$31,$30,$30,$31,$2D,$2D .byte $31,$2B,$2B,$31,$27,$31,$27,$31 .byte $30,$30,$30,$30,$30,$30,$2D,$2D .byte $2D,$2A,$2A,$2A,$27,$27,$27,$27 .byte $18,$1F,$18,$1D,$1F,$18,$22,$1F .byte $18,$1D,$1F,$18,$24,$1F,$22,$24 .byte $18,$1F,$22,$1D,$1F,$18,$22,$1F .byte $18,$1D,$1B,$1F,$1A,$1D,$16,$1A .byte $18,$1F,$18,$1D,$1F,$18,$22,$1F .byte $18,$1D,$1F,$18,$24,$1F,$22,$24 .byte $18,$1F,$22,$1D,$1F,$18,$22,$1F .byte $18,$1D,$1B,$18,$1A,$1B,$16,$1A .byte $ff kanal2 .byte $00,$0C,$00,$0C,$00,$0C,$00,$0C .byte $08,$14,$08,$14,$05,$11,$05,$11 .byte $00,$0C,$00,$0C,$00,$0C,$00,$0C .byte $08,$14,$08,$14,$05,$11,$05,$07 .byte $00,$0C,$25,$0C,$00,$0C,$25,$0C .byte $08,$14,$25,$14,$05,$11,$25,$25 .byte $00,$0C,$25,$0C,$00,$0C,$25,$0C .byte $08,$14,$25,$14,$05,$25,$05,$25 .byte $1F,$0C,$1F,$0C,$1D,$1F,$00,$18 .byte $03,$18,$1B,$18,$03,$18,$1B,$18 .byte $1F,$14,$1F,$14,$1D,$1F,$08,$18 .byte $05,$18,$1B,$18,$1F,$1D,$1B,$1D .byte $1F,$0C,$1F,$0C,$1D,$1B,$25,$18 .byte $03,$18,$1B,$18,$03,$18,$1F,$18 .byte $1F,$14,$1F,$14,$1D,$1B,$08,$18 .byte $05,$18,$1B,$1D,$1F,$1D,$1B,$1A .byte $18,$0F,$18,$0F,$16,$18,$03,$13 .byte $05,$18,$1B,$1D,$1F,$1D,$1B,$1D .byte $18,$0C,$1A,$0C,$1B,$18,$00,$1F .byte $0A,$1D,$1B,$1D,$1F,$1D,$1B,$1D .byte $18,$0F,$18,$0F,$16,$18,$03,$13 .byte $05,$1D,$1B,$1D,$1F,$1D,$1B,$1A .byte $18,$0C,$18,$1A,$1B,$18,$00,$1F .byte $0A,$1F,$1D,$1B,$1D,$1B,$1A,$16 .byte $00,$0C,$00,$0C,$00,$0C,$00,$0C .byte $00,$0C,$00,$0C,$07,$05,$03,$05 .byte $00,$0C,$00,$0C,$00,$0C,$00,$0C .byte $00,$0C,$00,$0C,$07,$05,$03,$02 .byte $30,$30,$30,$30,$30,$30,$2D,$2D .byte $2D,$2B,$2B,$2A,$27,$27,$27,$27 .byte $30,$30,$31,$30,$30,$31,$2D,$2D .byte $31,$2A,$2A,$31,$27,$31,$27,$31 .byte $18,$1F,$31,$1D,$1F,$31,$22,$1F .byte $31,$1D,$1F,$31,$24,$31,$22,$31 .byte $18,$1F,$31,$1D,$1F,$31,$22,$1F .byte $31,$1D,$1B,$31,$1A,$31,$16,$31 .byte $18,$1F,$31,$1D,$1F,$31,$22,$1F .byte $31,$1D,$1F,$31,$24,$31,$22,$31 .byte $18,$1F,$31,$1D,$1F,$31,$22,$1F .byte $31,$1D,$1B,$31,$1A,$31,$16,$31 .byte $ff org $2e0 .word a(run_adr) music_studio_stack.obx 7 Quote Link to comment Share on other sites More sharing options...
+JAC! Posted July 26, 2012 Share Posted July 26, 2012 (edited) Sounds really cool. Could you explain a bit how the routine works? Edited July 26, 2012 by JAC! Quote Link to comment Share on other sites More sharing options...
xxl Posted July 26, 2012 Author Share Posted July 26, 2012 nice obfuscation . try remove stack usage... Quote Link to comment Share on other sites More sharing options...
+JAC! Posted July 26, 2012 Share Posted July 26, 2012 (edited) Hmm, the stack usage to use S as counter was the obvious part for me. I rather wonder about the nuty and the lda/eor/sta/dec sequence. Maybe I should add that I have no clue about PWM or whatever this is. Edited July 26, 2012 by JAC! Quote Link to comment Share on other sites More sharing options...
+skr Posted August 13, 2012 Share Posted August 13, 2012 Very nice. First I have to say that I don´t understand most of the code. Using WUDSN I get an error saying: Compiler 'MADS' output: sbx #$100-$06 ; +6 /Users/skriegel/Documents/eclipse/Atari/gtia_sound.asm (87) ERROR: Undeclared macro SBX (BANK=0) Using this works: clc ; too slow, replace with sbx adc #$06 tax ;sbx #$100-$06 ; +6 At least in the emulator (Atari800MacX on Mac Book Pro) it´s not too slow. Quote Link to comment Share on other sites More sharing options...
+JAC! Posted August 13, 2012 Share Posted August 13, 2012 SBX is an illegal opcode, so you need a recent MADS version >=1.9.2 which supports illegal opcodes also. I haven't used illegal opcodes in MADS yet (is on the WUDSN todo list). Maybe also a compiler switch is required to allow them (like /U in ATASM). Quote Link to comment Share on other sites More sharing options...
xxl Posted August 13, 2012 Author Share Posted August 13, 2012 lda $0106,x sta $0103,x ; 5 dec $0103,x ; 7 better lda $0106,x sec ; 2 sbc #$01 ; 2 sta $0103,x ; 5 Quote Link to comment Share on other sites More sharing options...
xxl Posted August 13, 2012 Author Share Posted August 13, 2012 ok. GTIA music is nice... lets play on PIA :-) pactl equ $d302 org $2000 run_adr equ * sei lda #%00000000 sta nmien sta gractl sta dmactl speed equ $f1 _channel equ $f2 ; 4 bajty zpage equ $f6 ; $0a bajty music_studio_zpage ldx #3 _lch lda _ch1,x sta _channel,x dex bpl _lch _row lda skctl and #$04 bne _cont rts _cont ldx #0 _load lda (_channel,x) bpl _80_1 lda _ch1,x ; reload track sta _channel,x lda _ch1+1,x sta _channel+1,x lda (_channel,x) _80_1 inc _channel,x bne _80_2 inc _channel+1,x _80_2 tay txa lsr @ tax lda _nuty,y sta zpage+$00,x sta zpage+$02,x sta zpage+$04,x sec sbc #1 sta zpage+$06,x beq _80_en1 lda #$38 ; :-) _80_en1 sta zpage+$08,x lda #$30 ; :-) sta zpage+$0a,x inx inx cpx #$02 beq _load lda music_speed sta speed ldy #$00 _loop ldx #$00 _2kolej lda zpage+$0a,x sta PACTL ; :-) dec zpage+$02,x bne _skp eor zpage+$08,x sta zpage+$0a,x lda zpage+$00,x sta zpage+$02,x lda zpage+$04,x cmp #$20 bcs _skp inc zpage+$00,x _skp dec zpage+$06,x bne _skp1 lda zpage+$0a,x eor zpage+$08,x sta zpage+$0a,x lda zpage+$00,x sec sbc #$01 sta zpage+$06,x _skp1 inx cpx #$02 bne _2kolej dey bne _loop dec speed bne _loop jmp _row _nuty dta $FF,$F0,$E3,$D7,$CB,$C0,$B4,$AB,$A1,$97,$90,$88,$80,$79,$72,$6C dta $66,$60,$5B,$56,$51,$4C,$48,$44,$40,$3D,$39,$36,$33,$30,$2D,$2B dta $28,$26,$24,$22,$20,$1E,$1C,$1B,$19,$18,$17,$15,$14,$13,$12,$11 dta $10,$01 music_speed .byte $0f _ch1 .word kanal1 _ch2 .word kanal2 kanal1 dta $00,$0C,$00,$0C,$00,$0C,$00,$0C dta $08,$14,$08,$14,$05,$11,$05,$11 dta $00,$0C,$00,$0C,$00,$0C,$00,$0C dta $08,$14,$08,$14,$05,$11,$05,$07 dta $00,$0C,$00,$0C,$00,$0C,$00,$0C dta $08,$14,$08,$14,$05,$11,$05,$07 dta $00,$0C,$00,$0C,$00,$0C,$00,$0C dta $08,$14,$08,$14,$05,$11,$05,$07 dta $00,$0C,$25,$0C,$00,$0C,$25,$0C dta $03,$0F,$25,$0F,$03,$0F,$25,$25 dta $08,$14,$25,$14,$08,$14,$25,$14 dta $05,$11,$25,$11,$05,$11,$25,$25 dta $00,$0C,$25,$0C,$00,$0C,$00,$0C dta $03,$0F,$25,$0F,$03,$0F,$25,$0F dta $08,$14,$25,$14,$08,$14,$25,$14 dta $05,$11,$25,$11,$07,$25,$25,$25 dta $03,$0F,$25,$0F,$03,$0F,$25,$0F dta $05,$11,$25,$11,$05,$11,$25,$25 dta $00,$0C,$25,$0C,$00,$0C,$25,$0C dta $0A,$16,$25,$16,$0A,$25,$0A,$25 dta $03,$0F,$25,$0F,$03,$0F,$25,$25 dta $05,$11,$25,$11,$05,$11,$25,$25 dta $00,$0C,$25,$0C,$00,$0C,$25,$0C dta $0A,$16,$25,$16,$0A,$25,$0A,$25 dta $00,$0C,$25,$0C,$00,$0C,$25,$0C dta $00,$0C,$25,$0C,$07,$05,$25,$25 dta $00,$0C,$25,$0C,$00,$0C,$25,$0C dta $00,$0C,$25,$0C,$07,$25,$03,$25 dta $30,$30,$31,$30,$30,$31,$2D,$2D dta $31,$2B,$2B,$31,$27,$31,$27,$31 dta $30,$30,$30,$30,$30,$30,$2D,$2D dta $2D,$2A,$2A,$2A,$27,$27,$27,$27 dta $18,$1F,$18,$1D,$1F,$18,$22,$1F dta $18,$1D,$1F,$18,$24,$1F,$22,$24 dta $18,$1F,$22,$1D,$1F,$18,$22,$1F dta $18,$1D,$1B,$1F,$1A,$1D,$16,$1A dta $18,$1F,$18,$1D,$1F,$18,$22,$1F dta $18,$1D,$1F,$18,$24,$1F,$22,$24 dta $18,$1F,$22,$1D,$1F,$18,$22,$1F dta $18,$1D,$1B,$18,$1A,$1B,$16,$1A dta $ff kanal2 dta $00,$0C,$00,$0C,$00,$0C,$00,$0C dta $08,$14,$08,$14,$05,$11,$05,$11 dta $00,$0C,$00,$0C,$00,$0C,$00,$0C dta $08,$14,$08,$14,$05,$11,$05,$07 dta $00,$0C,$25,$0C,$00,$0C,$25,$0C dta $08,$14,$25,$14,$05,$11,$25,$25 dta $00,$0C,$25,$0C,$00,$0C,$25,$0C dta $08,$14,$25,$14,$05,$25,$05,$25 dta $1F,$0C,$1F,$0C,$1D,$1F,$00,$18 dta $03,$18,$1B,$18,$03,$18,$1B,$18 dta $1F,$14,$1F,$14,$1D,$1F,$08,$18 dta $05,$18,$1B,$18,$1F,$1D,$1B,$1D dta $1F,$0C,$1F,$0C,$1D,$1B,$25,$18 dta $03,$18,$1B,$18,$03,$18,$1F,$18 dta $1F,$14,$1F,$14,$1D,$1B,$08,$18 dta $05,$18,$1B,$1D,$1F,$1D,$1B,$1A dta $18,$0F,$18,$0F,$16,$18,$03,$13 dta $05,$18,$1B,$1D,$1F,$1D,$1B,$1D dta $18,$0C,$1A,$0C,$1B,$18,$00,$1F dta $0A,$1D,$1B,$1D,$1F,$1D,$1B,$1D dta $18,$0F,$18,$0F,$16,$18,$03,$13 dta $05,$1D,$1B,$1D,$1F,$1D,$1B,$1A dta $18,$0C,$18,$1A,$1B,$18,$00,$1F dta $0A,$1F,$1D,$1B,$1D,$1B,$1A,$16 dta $00,$0C,$00,$0C,$00,$0C,$00,$0C dta $00,$0C,$00,$0C,$07,$05,$03,$05 dta $00,$0C,$00,$0C,$00,$0C,$00,$0C dta $00,$0C,$00,$0C,$07,$05,$03,$02 dta $30,$30,$30,$30,$30,$30,$2D,$2D dta $2D,$2B,$2B,$2A,$27,$27,$27,$27 dta $30,$30,$31,$30,$30,$31,$2D,$2D dta $31,$2A,$2A,$31,$27,$31,$27,$31 dta $18,$1F,$31,$1D,$1F,$31,$22,$1F dta $31,$1D,$1F,$31,$24,$31,$22,$31 dta $18,$1F,$31,$1D,$1F,$31,$22,$1F dta $31,$1D,$1B,$31,$1A,$31,$16,$31 dta $18,$1F,$31,$1D,$1F,$31,$22,$1F dta $31,$1D,$1F,$31,$24,$31,$22,$31 dta $18,$1F,$31,$1D,$1F,$31,$22,$1F dta $31,$1D,$1B,$31,$1A,$31,$16,$31 dta $ff org $2e0 dta a(run_adr) for Atari PLUG IN DATA RECORDER !!! or use Altirra. temp.obx 1 Quote Link to comment Share on other sites More sharing options...
+skr Posted August 13, 2012 Share Posted August 13, 2012 (edited) *deleted* Argh. Ok, I should read before writing bullshit... Edited August 13, 2012 by skr Quote Link to comment Share on other sites More sharing options...
Heaven/TQA Posted October 18, 2016 Share Posted October 18, 2016 @xxl tried with some other music studio tune but which format does this player support? Quote Link to comment Share on other sites More sharing options...
NegativeCharge Posted December 19, 2022 Share Posted December 19, 2022 Hi XXL, Resurrecting an old thread, but I’ve just converted this engine to the Acorn Electron here: https://github.com/NegativeCharge/Elk-Music-Studio-Beeper-Engine Are there any other tracks available for this engine, and have you published the source to any of your other engine conversions? Would love to try and port some of them too. Quote Link to comment Share on other sites More sharing options...
Beeblebrox Posted December 20, 2022 Share Posted December 20, 2022 @NegativeCharge BTW if interested check this out: 1 Quote Link to comment Share on other sites More sharing options...
NegativeCharge Posted December 20, 2022 Share Posted December 20, 2022 Thanks @Beeblebrox. Yes, I’ve seen that thread, but don’t see any additional links to beeper engine source code. Any recommendations for a good Atari disassembler for .atr files? Quote Link to comment Share on other sites More sharing options...
Beeblebrox Posted December 20, 2022 Share Posted December 20, 2022 8 minutes ago, NegativeCharge said: Thanks @Beeblebrox. Yes, I’ve seen that thread, but don’t see any additional links to beeper engine source code. Any recommendations for a good Atari disassembler for .atr files? Ah I just posted it as it was related to creating GTIA music and is a 2022 post. (Just in case it was missed). Also, try this: 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.