Compare commits

...

2 commits

Author SHA1 Message Date
wbcbz7 487c7d5b4c fix CSM bugs 2025-08-21 02:04:43 +07:00
wbcbz7 0bf06f38d1 prepare for VU meters 2025-08-20 18:40:44 +07:00
42 changed files with 215 additions and 106 deletions

View file

@ -1,5 +1,5 @@
@echo off
bas2tap -a10 -spsgplay loader.bas loader.tap
sjasmplus main.asm --lst=main.lst
copy /b loader.tap+player.tap+page0.tap+page1.tap+page3.tap+page4.tap+page6.tap+page7.tap "moebius.tap"
copy /b loader.tap+player.tap+page0.tap+page1.tap+page3.tap+page4.tap+page6.tap+page7.tap+splash.tap "moebius.tap"
pause

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -6,4 +6,5 @@
60 POKE 23388,20 : OUT 32765,20 : LOAD "page4" CODE
70 POKE 23388,22 : OUT 32765,22 : LOAD "page6" CODE
80 POKE 23388,23 : OUT 32765,23 : LOAD "page7" CODE
90 POKE 23388,16 : OUT 32765,16 : LOAD "splash" CODE
100 RANDOMIZE USR 33155

View file

@ -48,15 +48,56 @@ start:
out (c), a
ld hl, reg_buffer
call player.reg_out
ld a, 2 : out (0xfe), a
ld a, 1 : out (0xfe), a
ld a, 0b11111001
ld b, 0xFF
out (c), a
inc hl
call player.reg_out
ld a, 3 : out (0xfe), a
ld a, 1 : out (0xfe), a
; draw vu meters
ld bc, 0x4000+2048*2+32*7+0
call vumeter.draw_e
.vu0 equ $-2
ld bc, 0x4000+2048*2+32*7+1
call vumeter.draw_e
.vu1 equ $-2
ld bc, 0x4000+2048*2+32*7+2
call vumeter.draw_e
.vu2 equ $-2
ld bc, 0x4000+2048*2+32*7+3
call vumeter.draw_e
.vu3 equ $-2
ld bc, 0x4000+2048*2+32*7+4
call vumeter.draw_e
.vu4 equ $-2
ld bc, 0x4000+2048*2+32*7+5
call vumeter.draw_e
.vu5 equ $-2
ld bc, 0x4000+2048*2+32*7+6
call vumeter.draw_e
.vu6 equ $-2
ld bc, 0x4000+2048*2+32*7+7
call vumeter.draw_e
.vu7 equ $-2
ld bc, 0x4000+2048*2+32*7+8
call vumeter.draw_e
.vu8 equ $-2
ld bc, 0x4000+2048*2+32*7+9
call vumeter.draw_e
.vu9 equ $-2
ld bc, 0x4000+2048*2+32*7+10
call vumeter.draw_e
.vu10 equ $-2
ld bc, 0x4000+2048*2+32*7+11
call vumeter.draw_e
.vu11 equ $-2
ld iy, reg_buffer
call player.play_tick
ld a, 1 : out (0xfe), a
call vumeter.init_frame
xor a : out (0xfe), a
; and jump to next frame
@ -66,26 +107,45 @@ start:
; ----------------------------------------------------
; vu meters
; orig by natt, rewritten by me
if 0
if 1
vumeter:
ld a, 0
call .get_address
ld [start.vu0], hl
ld a, 1
call .get_address
ld [start.vu1], hl
ld a, 2
call .get_address
ld [start.vu2], hl
ld a, 3
call .get_address
ld [start.vu3], hl
ld a, 4
call .get_address
ld [start.vu4], hl
ld a, 5
call .get_address
ld [start.vu5], hl
.init_frame:
ld a, [player.player_channels+(player.channel_struct_t*1)+player.channel_struct_t.volume]
call .get_address
ld [start.vu0], hl
ld a, [player.player_channels+(player.channel_struct_t*2)+player.channel_struct_t.volume]
call .get_address
ld [start.vu1], hl
ld a, [player.player_channels+(player.channel_struct_t*3)+player.channel_struct_t.volume]
call .get_address
ld [start.vu2], hl
ld a, [player.player_channels+(player.channel_struct_t*4)+player.channel_struct_t.volume]
call .get_address
ld [start.vu3], hl
ld a, [player.player_channels+(player.channel_struct_t*5)+player.channel_struct_t.volume]
call .get_address
ld [start.vu4], hl
ld a, [player.player_channels+(player.channel_struct_t*6)+player.channel_struct_t.volume]
call .get_address
ld [start.vu5], hl
ld a, [player.player_channels+(player.channel_struct_t*9)+player.channel_struct_t.volume]
call .get_address
ld [start.vu6], hl
ld a, [player.player_channels+(player.channel_struct_t*10)+player.channel_struct_t.volume]
call .get_address
ld [start.vu7], hl
ld a, [player.player_channels+(player.channel_struct_t*11)+player.channel_struct_t.volume]
call .get_address
ld [start.vu8], hl
ld a, [player.player_channels+(player.channel_struct_t*12)+player.channel_struct_t.volume]
call .get_address
ld [start.vu9], hl
ld a, [player.player_channels+(player.channel_struct_t*13)+player.channel_struct_t.volume]
call .get_address
ld [start.vu10], hl
ld a, [player.player_channels+(player.channel_struct_t*14)+player.channel_struct_t.volume]
call .get_address
ld [start.vu11], hl
ret
@ -106,45 +166,47 @@ vumeter:
; ------------------
; drawing routines
; DE - dst
; BC - dst
.draw_e:
ld a, 0b00000000 : ld [bc], a : inc b ; 18
ld a, 0b11111111 : ld [bc], a : inc b ; 18
ld a, 0b11000011 : ld [bc], a : inc b ; 18
ld a, 0b11011111 : ld [bc], a : inc b ; 18
ld a, 0b11000111 : ld [bc], a : inc b ; 18
ld a, 0b11011111 : ld [bc], a : inc b ; 18
ld a, 0b11000011 : ld [bc], a : inc b ; 18
ld a, 0b11111111 : ld [bc], a : ret ; 24 = 150t per char
ld a, 0b11111110 : ld [bc], a : inc b ; 18
ld a, 0b11000110 : ld [bc], a : inc b ; 18
ld a, 0b11011110 : ld [bc], a : inc b ; 18
ld a, 0b11001110 : ld [bc], a : inc b ; 18
ld a, 0b11011110 : ld [bc], a : inc b ; 18
ld a, 0b11000110 : ld [bc], a : inc b ; 18
ld a, 0b11111110 : ld [bc], a : ret ; 24 = 150t per char
.draw_0:
.draw_1:
dup 7 : ld a, 0x00 : ld [bc], a : inc b : edup ; 18*7
dup 1 : ld a, 0x00 : ld [bc], a : ret : edup ; 24*1
.draw_2:
.draw_1:
dup 6 : ld a, 0x00 : ld [bc], a : inc b : edup ; 18*6
dup 1 : ld a, 0xFF : ld [bc], a : inc b : edup ; 18*1
dup 1 : ld a, 0xFF : ld [bc], a : ret : edup ; 24
.draw_3:
dup 1 : ld a, 0xFE : ld [bc], a : inc b : edup ; 18*1
dup 1 : ld a, 0xFE : ld [bc], a : ret : edup ; 24
.draw_2:
dup 5 : ld a, 0x00 : ld [bc], a : inc b : edup ; 18*5
dup 2 : ld a, 0xFF : ld [bc], a : inc b : edup ; 18*2
dup 1 : ld a, 0xFF : ld [bc], a : ret : edup ; 24
.draw_4:
dup 2 : ld a, 0xFE : ld [bc], a : inc b : edup ; 18*2
dup 1 : ld a, 0xFE : ld [bc], a : ret : edup ; 24
.draw_3:
dup 4 : ld a, 0x00 : ld [bc], a : inc b : edup ; 18*4
dup 3 : ld a, 0xFF : ld [bc], a : inc b : edup ; 18*3
dup 1 : ld a, 0xFF : ld [bc], a : ret : edup ; 24
.draw_5:
dup 3 : ld a, 0xFE : ld [bc], a : inc b : edup ; 18*3
dup 1 : ld a, 0xFE : ld [bc], a : ret : edup ; 24
.draw_4:
dup 3 : ld a, 0x00 : ld [bc], a : inc b : edup ; 18*3
dup 4 : ld a, 0xFF : ld [bc], a : inc b : edup ; 18*4
dup 1 : ld a, 0xFF : ld [bc], a : ret : edup ; 24
.draw_6:
dup 4 : ld a, 0xFE : ld [bc], a : inc b : edup ; 18*4
dup 1 : ld a, 0xFE : ld [bc], a : ret : edup ; 24
.draw_5:
dup 2 : ld a, 0x00 : ld [bc], a : inc b : edup ; 18*2
dup 5 : ld a, 0xFF : ld [bc], a : inc b : edup ; 18*5
dup 1 : ld a, 0xFF : ld [bc], a : ret : edup ; 24
.draw_7:
dup 5 : ld a, 0xFE : ld [bc], a : inc b : edup ; 18*5
dup 1 : ld a, 0xFE : ld [bc], a : ret : edup ; 24
.draw_6:
dup 1 : ld a, 0x00 : ld [bc], a : inc b : edup ; 18*1
dup 6 : ld a, 0xFF : ld [bc], a : inc b : edup ; 18*6
dup 1 : ld a, 0xFF : ld [bc], a : ret : edup ; 24
dup 6 : ld a, 0xFE : ld [bc], a : inc b : edup ; 18*6
dup 1 : ld a, 0xFE : ld [bc], a : ret : edup ; 24
.draw_7:
dup 7 : ld a, 0xFE : ld [bc], a : inc b : edup ; 18*6
dup 1 : ld a, 0xFE : ld [bc], a : ret : edup ; 24
align 256
.calltab:
@ -153,8 +215,27 @@ vumeter:
; player include
include "player.asm"
music_p0_ch10:
incbin "tsfm_1308_0451_optimized/tsfm_1308_0451_optimized_ch10.bin" ; 10kb D:
; music
; not so hidden text
db ".......................... hey there again!", 10, 13
db "another arson? another arson!", 10, 13
db "this time for the TurboSound FM! (2 x YM2203)", 10, 13
db 10, 13
db "player code - artemka", 10, 13
db "splash screen - rui8bit", 10, 13
db "music - Abstract 64, Alex Winston, Natt, nIk0, Pator and Rei8bit", 10, 13
db "support and tools - AArt1526", 10, 13
db 10, 13
db "released at Xenium 2o25", 10, 13
db 10, 13
db "greets to everyone pushing the limits and keeping the scene alive! (and whatever ;)", 10, 13
db "special thanks to CHRV for the TSFMPro board :)", 10, 13
db 10, 13
db 10, 13
db "come to Multimatograf 2026 - the party that cares about the demoscene - spring 2026 - events.retroscene.org", 10, 13
code_end
@ -163,34 +244,20 @@ code_end
page 0
emptytap "page0.tap"
org 0xC000
music_p0_ch0:
incbin "tsfm_1308_0451_optimized/tsfm_1308_0451_optimized_ch0.bin"
music_p0_ch1:
incbin "tsfm_1308_0451_optimized/tsfm_1308_0451_optimized_ch1.bin"
music_p0_ch2:
incbin "tsfm_1308_0451_optimized/tsfm_1308_0451_optimized_ch2.bin"
music_p0_ch3:
incbin "tsfm_1308_0451_optimized/tsfm_1308_0451_optimized_ch3.bin"
music_p0_ch4:
incbin "tsfm_1308_0451_optimized/tsfm_1308_0451_optimized_ch4.bin"
music_p0_ch5:
incbin "tsfm_1308_0451_optimized/tsfm_1308_0451_optimized_ch5.bin"
music_p0_ch6:
incbin "tsfm_1308_0451_optimized/tsfm_1308_0451_optimized_ch6.bin"
music_p0_ch7:
incbin "tsfm_1308_0451_optimized/tsfm_1308_0451_optimized_ch7.bin"
music_p0_ch12:
incbin "tsfm_2108_0045_optimized/tsfm_2108_0045_optimized_ch12.bin"
music_p0_ch10:
incbin "tsfm_2108_0045_optimized/tsfm_2108_0045_optimized_ch10.bin"
savetap "page0.tap",CODE,"page0",0xC000,$-0xC000
; ------------------------------------------------
page 1
emptytap "page1.tap"
org 0xC000
music_p0_ch8:
incbin "tsfm_1308_0451_optimized/tsfm_1308_0451_optimized_ch8.bin"
music_p0_ch9:
incbin "tsfm_1308_0451_optimized/tsfm_1308_0451_optimized_ch9.bin"
music_p0_ch12:
incbin "tsfm_1308_0451_optimized/tsfm_1308_0451_optimized_ch12.bin"
music_p0_ch14:
incbin "tsfm_2108_0045_optimized/tsfm_2108_0045_optimized_ch14.bin"
music_p0_ch2:
incbin "tsfm_2108_0045_optimized/tsfm_2108_0045_optimized_ch2.bin"
savetap "page1.tap",CODE,"page1",0xC000,$-0xC000
; ------------------------------------------------
@ -198,20 +265,35 @@ music_p0_ch12:
emptytap "page3.tap"
org 0xC000
music_p0_ch11:
incbin "tsfm_1308_0451_optimized/tsfm_1308_0451_optimized_ch11.bin"
music_p0_ch13:
incbin "tsfm_1308_0451_optimized/tsfm_1308_0451_optimized_ch13.bin"
music_p0_ch14:
incbin "tsfm_1308_0451_optimized/tsfm_1308_0451_optimized_ch14.bin"
music_p0_ch15:
incbin "tsfm_1308_0451_optimized/tsfm_1308_0451_optimized_ch15.bin"
incbin "tsfm_2108_0045_optimized/tsfm_2108_0045_optimized_ch11.bin"
music_p0_ch8:
incbin "tsfm_2108_0045_optimized/tsfm_2108_0045_optimized_ch8.bin"
music_p0_ch1:
incbin "tsfm_2108_0045_optimized/tsfm_2108_0045_optimized_ch1.bin"
music_p0_ch6:
incbin "tsfm_2108_0045_optimized/tsfm_2108_0045_optimized_ch6.bin"
savetap "page3.tap",CODE,"page3",0xC000,$-0xC000
; ------------------------------------------------
page 4
emptytap "page4.tap"
org 0xC000
db 0
music_p0_ch9:
incbin "tsfm_2108_0045_optimized/tsfm_2108_0045_optimized_ch9.bin"
music_p0_ch4:
incbin "tsfm_2108_0045_optimized/tsfm_2108_0045_optimized_ch4.bin"
music_p0_ch13:
incbin "tsfm_2108_0045_optimized/tsfm_2108_0045_optimized_ch13.bin"
music_p0_ch15:
incbin "tsfm_2108_0045_optimized/tsfm_2108_0045_optimized_ch15.bin"
music_p0_ch5:
incbin "tsfm_2108_0045_optimized/tsfm_2108_0045_optimized_ch5.bin"
music_p0_ch7:
incbin "tsfm_2108_0045_optimized/tsfm_2108_0045_optimized_ch7.bin"
music_p0_ch0:
incbin "tsfm_2108_0045_optimized/tsfm_2108_0045_optimized_ch0.bin"
music_p0_ch3:
incbin "tsfm_2108_0045_optimized/tsfm_2108_0045_optimized_ch3.bin"
savetap "page4.tap",CODE,"page4",0xC000,$-0xC000
; ------------------------------------------------
@ -232,9 +314,9 @@ music_p0_ch15:
emptytap "splash.tap"
org 0x4000
splash:
block 6144, 0
block 768, (0<<3)|(7<<0)
;incbin "200a.scr"
;block 6144, 0
;block 768, (0<<3)|(7<<0)
incbin "!gfx/tsfm2.scr"
savetap "splash.tap",CODE,"splash",0x4000,$-0x4000
endmodule

View file

@ -26,7 +26,8 @@ stack block channel_stack_t*MAX_STACK_DEPTH, 0 ; stack
; reg cache
reg_extch3_fhi block 3, 0 ; extch3 block/fnum-high reg
reg_fhi db 0 ; block/fnum-high reg
reserved block 2, 0
volume db 0
tl_cache db 0
ends
struct player_struct_t
@ -42,22 +43,22 @@ ssg_r7 block 2, 0
; instantinate structures
align 256
player_channels:
channel_struct_t 0, music_p0_ch0 ; TODO: fill start offsets here
channel_struct_t 0, music_p0_ch1
channel_struct_t 0, music_p0_ch2
channel_struct_t 0, music_p0_ch3
channel_struct_t 0, music_p0_ch4
channel_struct_t 0, music_p0_ch5
channel_struct_t 0, music_p0_ch6
channel_struct_t 0, music_p0_ch7
channel_struct_t 1, music_p0_ch8
channel_struct_t 1, music_p0_ch9
channel_struct_t 4, music_p0_ch0 ; TODO: fill start offsets here
channel_struct_t 3, music_p0_ch1
channel_struct_t 1, music_p0_ch2
channel_struct_t 4, music_p0_ch3
channel_struct_t 4, music_p0_ch4
channel_struct_t 4, music_p0_ch5
channel_struct_t 3, music_p0_ch6
channel_struct_t 4, music_p0_ch7
channel_struct_t 3, music_p0_ch8
channel_struct_t 4, music_p0_ch9
channel_struct_t 0, music_p0_ch10
channel_struct_t 3, music_p0_ch11
channel_struct_t 1, music_p0_ch12
channel_struct_t 3, music_p0_ch13
channel_struct_t 3, music_p0_ch14
channel_struct_t 3, music_p0_ch15
channel_struct_t 0, music_p0_ch12
channel_struct_t 4, music_p0_ch13
channel_struct_t 1, music_p0_ch14
channel_struct_t 4, music_p0_ch15
player_struct player_struct_t player_channels+(channel_struct_t*(3+0)+channel_struct_t.reg_extch3_fhi), player_channels+(channel_struct_t*(3+8)+channel_struct_t.reg_extch3_fhi)
@ -174,6 +175,7 @@ parse_ay_channel_stream:
ldi [iy], a
ld a, b : and OPM_AYTONE_CMD00_VOLUME_MASK
ldi [iy], a
ld [ix+channel_struct_t.volume], a
; if (mask & OPM_AYTONE_CMD00_PERIOD_LOW) opn_write_reg(chip_index, 0 + (ch<<1), *data++);
bit OPM_AYTONE_CMD00_PERIOD_LOW_BIT, b
@ -401,7 +403,7 @@ parse_fm_control_stream:
ldi [iy], 0x27 : ldi a, [hl] : ldi [iy], a
1:
;if (mask & OPM_CTRL_CMD80_REG22) opn_write_reg(chip_index, 0x22, *data++);
bit OPM_CTRL_CMD80_REG25_BIT, b
bit OPM_CTRL_CMD80_REG22_BIT, b
jp z, 1f
ldi [iy], 0x22 : ldi a, [hl] : ldi [iy], a
1:
@ -546,7 +548,13 @@ parse_fm_channel_stream:
;if (mask & OPM_FM_CMD40_REG40) opn_write_reg(chip_index, 0x40 + regbase, *data++);
bit OPM_FM_CMD40_REG40_BIT, b
jp z, 1f
ld a, 0x40 : add c : ldi [iy], a
ld a, 0x40 : add c : ldi [iy], a
ld a, c : and 12 : cp 12 : jp nz, 2f
ld a, [hl] : rrca : and 0x3F : xor 0x3F
sub 0x30 : jp nc, 3f : xor a
3:
ld [ix + channel_struct_t.tl_cache], a
2:
ldi a, [hl] : ldi [iy], a
1:
;if (mask & OPM_FM_CMD40_REG90) opn_write_reg(chip_index, 0x90 + regbase, *data++);
@ -618,6 +626,9 @@ parse_fm_channel_stream:
ld a, b : and OPM_FM_CMDA0_OP_MASK
add a, a : add a, a : add a, a : add a, a : add a, c
ldi [iy], 0x28 : ldi [iy], a
and 0xF0 : jp z, 1f
ld a, [ix + channel_struct_t.tl_cache]
ld [ix + channel_struct_t.volume], a
1:
; if (mask & OPM_FM_CMDA0_EOF) endOfFrame = true;
bit OPM_FM_CMDA0_EOF_BIT, b
@ -741,6 +752,16 @@ parse_stream:
ld [ix+channel_struct_t.ptr], hl
ret
; advance volume on FM streams
; IX - channel ptr
advance_vol:
ld a, [ix+channel_struct_t.volume]
and a
ret z
dec a
ld [ix+channel_struct_t.volume], a
ret
; -----------------------------
; -----------------------------
; play one tick!!!
@ -764,18 +785,21 @@ play_tick:
ld bc, parse_fm_channel_stream
ld a, 0 : ld [player_struct.channel_idx], a
call parse_stream
call advance_vol
; opmplay_parse_stream(ctx, ctx->channels + 2, 1, opmplay_parse_fm_channel_stream);
ld ix, player_channels + (channel_struct_t * 2)
ld bc, parse_fm_channel_stream
ld a, 1 : ld [player_struct.channel_idx], a
call parse_stream
call advance_vol
; opmplay_parse_stream(ctx, ctx->channels + 3, 2, opmplay_parse_fm_channel_stream);
ld ix, player_channels + (channel_struct_t * 3)
ld bc, parse_fm_channel_stream
ld a, 2 : ld [player_struct.channel_idx], a
call parse_stream
call advance_vol
endif
if 1
@ -824,18 +848,21 @@ play_tick:
ld bc, parse_fm_channel_stream
ld a, 0 : ld [player_struct.channel_idx], a
call parse_stream
call advance_vol
; opmplay_parse_stream(ctx, ctx->channels + 2, 1, opmplay_parse_fm_channel_stream);
ld ix, player_channels + (channel_struct_t * 10)
ld bc, parse_fm_channel_stream
ld a, 1 : ld [player_struct.channel_idx], a
call parse_stream
call advance_vol
; opmplay_parse_stream(ctx, ctx->channels + 3, 2, opmplay_parse_fm_channel_stream);
ld ix, player_channels + (channel_struct_t * 11)
ld bc, parse_fm_channel_stream
ld a, 2 : ld [player_struct.channel_idx], a
call parse_stream
call advance_vol
endif
if 1

View file

@ -1 +0,0 @@
Ö0”@ĐC3¶p2ČL,ôËC2ČĐ0p+¶ĐL+NËC$ôĐ<p*ČĐL,ôËC2ČĐ<p+¶L+Nŕ3Đ0p3¶ĐL4*ËC4­Đ<p4­ĐH­ËBôĐxp:ČŕUp4­ţ

View file

@ -3,7 +3,7 @@
define MUSIC_INC
TICK_RATE equ 50
TOTAL_FRAMES equ 3840
TOTAL_FRAMES equ 8091
TOTAL_CHANNELS equ 16
FILEPATH equ "tsfm_1308_0451_optimized/tsfm_1308_0451_optimized"
FILEPATH equ "tsfm_2108_0045_optimized/tsfm_2108_0045_optimized"
endif

View file

@ -240,7 +240,7 @@ int vgm_parse_frame() {
case VGM_Stream_Opcode::YM2203_WRITE: {
// get register and data
int reg = *(it + 1), data = *(it + 2);
opna_regqueue[0].add(0, reg, data, 4);
opna_regqueue[0].add(0, reg, data, 16);
//opnachip->write(2, reg);
//opnachip->write(3, data);
break;
@ -248,7 +248,7 @@ int vgm_parse_frame() {
case VGM_Stream_Opcode::YM2203_CHIP2_WRITE: {
// get register and data
int reg = *(it + 1), data = *(it + 2);
opna_regqueue[1].add(0, reg, data, 4);
opna_regqueue[1].add(0, reg, data, 16);
//opnachip->write(0, reg);
//opnachip->write(1, data);
break;