back references fixed

This commit is contained in:
wbcbz7 2025-08-15 00:39:46 +07:00
parent dca9690219
commit dff96990fc
21 changed files with 33 additions and 19 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 "moebius.tap"
copy /b loader.tap+player.tap+page0.tap+page1.tap+page3.tap+page4.tap+page6.tap+page7.tap "moebius.tap"
pause

View file

@ -1,3 +1,9 @@
10 BORDER 0 : PAPER 7 : INK 7 : CLEAR 24575
20 LOAD "moebius" CODE
30 POKE 23388,16 : OUT 32765,16 : LOAD "page0" CODE
40 POKE 23388,17 : OUT 32765,17 : LOAD "page1" CODE
50 POKE 23388,19 : OUT 32765,19 : LOAD "page3" CODE
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
100 RANDOMIZE USR 33155

View file

@ -211,9 +211,23 @@ music_p0_ch15:
page 4
emptytap "page4.tap"
org 0xC000
db 0
savetap "page4.tap",CODE,"page4",0xC000,$-0xC000
; ------------------------------------------------
page 6
emptytap "page6.tap"
org 0xC000
db 0
savetap "page6.tap",CODE,"page6",0xC000,$-0xC000
; ------------------------------------------------
page 7
emptytap "page7.tap"
org 0xC000
db 0
savetap "page7.tap",CODE,"page7",0xC000,$-0xC000
; splash screen
emptytap "splash.tap"
org 0x4000

View file

@ -89,14 +89,11 @@ reg_out:
; ------------------------
; pop from stack
; in: IX - channel context
; trashes A, DE
; trashes A, DE, HL
pop_stack:
dec [ix + channel_struct_t.stack_pos] ; --chctx->stack_pos;
ld l, [ix + channel_struct_t.stack_pos] : ld h, 0 ; hl = chctx->stack_pos;
add hl, hl ; *= 2
add hl, hl ; *= 4
ld de, channel_struct_t.stack
add hl, de
ld a, [ix + channel_struct_t.stack_pos]
add a : add a : add channel_struct_t.stack : ld l, a : ld h, 0
ld de, ix
add hl, de ; hl = st = chctx->stack + chctx->stack_pos;
@ -115,11 +112,8 @@ pop_stack:
; in: IX - channel context
; trashes A, DE
push_stack:
ld l, [ix + channel_struct_t.stack_pos] : ld h, 0 ; hl = chctx->stack_pos;
add hl, hl ; *= 2
add hl, hl ; *= 4
ld de, channel_struct_t.stack
add hl, de
ld a, [ix + channel_struct_t.stack_pos]
add a : add a : add channel_struct_t.stack : ld l, a : ld h, 0
ld de, ix
add hl, de ; hl = st = chctx->stack + chctx->stack_pos;
@ -686,15 +680,16 @@ parse_stream:
; back reference, nested call :)
; int distance = ((*(data + 0) & 0x0F) << 8) | (*(data + 1));
push hl
ld a, b : and 0x0F : ld d, a : inc hl
ldi e, [hl] ; de = distance
ldi a, [hl] ; int frames_to_play = *(data + 2); data += 3
ld [ix + channel_struct_t.ptr], hl ; chctx->stream.ptr = data + 3;
push af, de, hl
exa : push de
call push_stack
pop hl, de, af
and a : sbc hl, de ; data -= distance;
exa : pop de
pop hl : and a : sbc hl, de ; data -= distance;
; chctx->stream.frames_to_play = frames_to_play; // hack?
ld e, a : ld d, 0 : ld [ix + channel_struct_t.frames_to_play], de
@ -743,8 +738,7 @@ parse_stream:
ret
.not_pop:
exd
ld [ix+channel_struct_t.ptr], de
ld [ix+channel_struct_t.ptr], hl
ret
; -----------------------------

View file

@ -1 +1 @@
<EFBFBD>0<EFBFBD>@<40>C3<43>p2<70>L,<2C><>C2<43><32>0p+<2B><>L+N<>C$<24><><p*<2A><>L,<2C><>C2<43><32><p+<2B>L+N<>C3<43>p2<70>L,<2C><>C2<43><32>0p3<70><33>L4*<2A>C4<43><34><p4<70><34>H<><48>B<EFBFBD><42>xp:<3A><>C3<43>p2<70>L,<2C><>C2<43><32>0p+<2B><>L+N<>C$<24><><p*<2A><>L,<2C><>C2<43><32><p+<2B>L+N<>C3<43>p2<70>L,<2C><>C2<43><32>0p3<70><33>L4*<2A>C4<43>p4<70><34>
Ö0”@ĐC3¶p2ČL,ôËC2ČĐ0p+¶ĐL+NËC$ôĐ<p*ČĐL,ôËC2ČĐ<p+¶L+Nŕ3Đ0p3¶ĐL4*ËC4­Đ<p4­ĐH­ËBôĐxp:ČŕUp4­ţ