Переход на относительные URL подмодулей

This commit is contained in:
Анатолий Белянский authored and Tolik committed 2026-05-19 19:46:03 +10:00
1 parent 314ba263d6
commit 3b64afe4e1
277 files changed
+19574 -56177

No files matched your search

+242
View File
@@ -0,0 +1,242 @@
; INCLUDE '../mem_map.inc'
; ORG Depacker_start
; DeHRUSTer v1.2
; HL - ­ ç «®  à娢 
; DE -  ¤à¥á à á¯ ª®¢ª¨
;--------------[DEPACKER]---------------
DEHRUST:
PUSH DE
PUSH HL
INC HL
INC HL
LD C,(HL)
INC HL
LD B,(HL)
INC HL
DEC BC
EX DE,HL
ADD HL,BC
EX DE,HL
LD C,(HL)
INC HL
LD B,(HL)
DEC BC
POP HL
ADD HL,BC
SBC HL,DE
ADD HL,DE
JR C,.LL4019
LD D,H
LD E,L
.LL4019:
LDDR
EX DE,HL
POP DE
LD C,#0C
ADD HL,BC
PUSH HL
POP IX
LD A,#03
.LL4025:
DEC HL
LD B,(HL)
DEC HL
LD C,(HL)
PUSH BC
DEC A
JR NZ,.LL4025
LD B,A
EXX
LD D,#BF
LD C,#10
CALL .LL4115
.LL4036:
LD A,(IX+#00)
INC IX
EXX
.LL403C:
LD (DE),A
INC DE
.LL403E:
EXX
.LL403F:
ADD HL,HL
DJNZ .LL4045
CALL .LL4115
.LL4045:
JR C,.LL4036
LD E,#01
.LL4049:
LD A,#80
.LL404B:
ADD HL,HL
DJNZ .LL4051
CALL .LL4115
.LL4051:
RLA
JR C,.LL404B
CP #03
JR C,.LL405D
ADD A,E
LD E,A
XOR C
JR NZ,.LL4049
.LL405D:
ADD A,E
CP #04
JR Z,.LL40C4
ADC A,#FF
CP #02
EXX
.LL4067:
LD C,A
.LL4068:
EXX
LD A,#BF
JR C,.LL4082
.LL406D:
ADD HL,HL
DJNZ .LL4073
CALL .LL4115
.LL4073:
RLA
JR C,.LL406D
JR Z,.LL407D
INC A
ADD A,D
JR NC,.LL4084
SUB D
.LL407D:
INC A
JR NZ,.LL408D
LD A,#EF
.LL4082:
RRCA
CP A
.LL4084:
ADD HL,HL
DJNZ .LL408A
CALL .LL4115
.LL408A:
RLA
JR C,.LL4084
.LL408D:
EXX
LD H,#FF
JR Z,.LL409B
LD H,A
INC A
LD A,(IX+#00)
INC IX
JR Z,.LL40A6
.LL409B:
LD L,A
ADD HL,DE
LDIR
.LL409F:
JR .LL403E
.LL40A1:
EXX
RRC D
JR .LL403F
.LL40A6:
CP #E0
JR C,.LL409B
RLCA
XOR C
INC A
JR Z,.LL40A1
SUB #10
.LL40B1:
LD L,A
LD C,A
LD H,#FF
ADD HL,DE
LDI
LD A,(IX+#00)
INC IX
LD (DE),A
INC HL
INC DE
LD A,(HL)
JP .LL403C
.LL40C4:
LD A,#80
.LL40C6:
ADD HL,HL
DJNZ .LL40CC
CALL .LL4115
.LL40CC:
ADC A,A
JR NZ,.LL40F3
JR C,.LL40C6
LD A,#FC
JR .LL40F6
.LL40D5:
LD B,A
LD C,(IX+#00)
INC IX
CCF
JR .LL4068
.LL40DE:
CP #0F
JR C,.LL40D5
JR NZ,.LL4067
LD B,#03
EX DE,HL
.LL40E7:
POP DE
LD (HL),E
INC HL
LD (HL),D
INC HL
DJNZ .LL40E7
LD HL,#2758
EXX
RET
.LL40F3:
SBC A,A
LD A,#EF
.LL40F6:
ADD HL,HL
DJNZ .LL40FC
CALL .LL4115
.LL40FC:
RLA
JR C,.LL40F6
EXX
JR NZ,.LL40B1
BIT 7,A
JR Z,.LL40DE
SUB #EA
ADD A,A
LD B,A
.LL410A:
LD A,(IX+#00)
INC IX
LD (DE),A
INC DE
DJNZ .LL410A
JR .LL409F
.LL4115:
LD B,C
LD L,(IX+#00)
INC IX
LD H,(IX+#00)
INC IX
RET
Length EQU $-DEHRUST
in a,(#FF)
;---------------------------------------
;---------------[MAIN.HR]---------------
;Depacker.packcode EQU $$$
;PackedMAIN EQU $
; INCBIN 'Build/Bin/temp/MAIN.HR'
;---------------------------------------
;
+157
View File
@@ -0,0 +1,157 @@
;------------------------------------------------------------------------------
;hl=src de=dst
lz4decrunch:
ld bc,7
add hl,bc
ld c,(hl)
inc hl
ld b,(hl) ;„q„u„‚„v„} „t„r„p „q„p„z„„„p „y„x „x„p„s„€„|„€„r„{„p - „‚„p„x„}„u„‚
inc hl
inc hl
inc hl ;„~„p„‰„p„|„€ „ƒ„w„p„„„�„‡ „t„p„~„~„�„‡ „ƒ„€ „ƒ„}„u„‹„u„~„y„‘ #0B
ld a,l
add a,c
ld (.endL+1),a
ld a,h
adc a,b
ld (.endH+1),a ;„K„€„~„u„‰„~„�„z „p„t„‚„u„ƒ „ƒ„w„p„„„�„‡ „t„p„~„~„�„‡
.loop:
ld a,(hl)
inc hl
ld (.litteral+1),a
and #F0
jr z,.copy ;„E„ƒ„|„y „t„|„y„~„p „‚„p„r„~„p 0, „ƒ„{„€„�„y„‚„€„r„p„„„Ž „…„w„u „�„u„‚„u„t„p„~„~„�„u „t„p„~„~„�„u
rrca
rrca
rrca
rrca
ld b,0
ld c,a
cp #0F
call z,.getlength ;„E„ƒ„|„y „t„|„y„~„p #0F, „„„€ „�„€„|„…„‰„y„„„Ž „t„€„�„€„|„~„y„„„u„|„Ž„~„…„� „t„|„y„~„…
ldir ;„P„u„‚„u„t„p„‰„p „~„p„‰„y„~„p„u„„„ƒ„‘ „ƒ„€ „ƒ„|„u„t„…„�„‹„u„z „y„~„†„€„‚„}„p„ˆ„y„y „€ „t„|„y„~„u
.copy:
ld a,l ;„t„€„ƒ„„„y„s„|„y „|„y „ƒ„w„p„„„�„u „t„p„~„~„�„u „{„€„~„u„‰„~„€„s„€ „p„t„‚„u„ƒ„p
.endL:
sub #FF
ld a,h
.endH:
sbc a,#FF
ret nc ;„^„†„†„u„{„„„y„r„~„p„‘ „�„‚„€„r„u„‚„{„p zf=1
ld c,(hl)
inc hl
ld b,(hl) ;bc=2byte „X„„„u„~„y„u „x„~„p„‰„u„~„y„‘ „ƒ„}„u„‹„u„~„y„‘
inc hl
.litteral:
ld a,0 ;litteral „�„u„‚„u„�„y„ƒ„p„„„Ž „x„t„u„ƒ„Ž
and #0F
add a,#04 ;cf=0
push hl
ld h,d
ld l,e
sbc hl,bc ;hl=de-bc „I„ƒ„�„€„|„Ž„x„…„z„„„u „t„p„~„~„�„u, „{„€„„„€„‚„�„u „…„w„u „q„�„|„y „‚„p„ƒ„Š„y„‚„u„~„�, „r „{„p„‰„u„ƒ„„„r„u „y„ƒ„„„€„‰„~„y„{„p „�„u„‚„u„t„p„‰„y
ld b,0
ld c,a
cp #0F+#04
ex (sp),hl
call z,.getlength
ex (sp),hl
ldir ;„K„€„�„y„‚„€„r„p„„„Ž „�„u„‚„u„~„€„ƒ „…„w„u „‚„p„x„r„u„‚„~„…„„„�„‡ „t„p„~„~„�„‡
pop hl
jp .loop
.getlength: ;„P„€„|„…„‰„y„„„Ž „t„|„y„~„… „q„p„z„„„p „�„u„‚„u„r„€„t„p („q„€„|„ބЄu) bc=„„„u„{„…„‹„p„‘ „ƒ„…„}„}„p „�„u„‚„u„r„€„t„p
ld a,(hl)
inc hl
cp #FF ;#FF „…„t„r„p„y„r„p„u„„„ƒ„‘ „{„p„{ „x„~„p„{, „x„p „{„€„„„€„‚„�„} „ƒ„|„u„t„…„u„„ „y„~„†„€„‚„}„p„ˆ„y„‘ „€ „t„|„y„~„u
jr nz,.addlen
inc b
dec bc ;bc += 255
jr .getlength
.addlen:
add a,c
ld c,a
adc a,b
sub c
ld b,a ;bc=„t„|„y„~„p „�„u„‚„u„t„p„r„p„u„}„€„s„€ „q„p„z„„„p
ret
;------------------------------------------------------------------------------
;in: hl=„~„p„‰„p„|„Ž„~„�„z „p„t„‚„u„ƒ bc=„t„|„y„~„p
;out: bcde=„‚„u„x„…„|„Ž„„„p„„
crc32:
push hl
push bc
ld de,#FFFF ; 0xFFFFFFFF ? „~„p„‰„p„|„Ž„~„€„u „x„~„p„‰„u„~„y„u CRC32, „y„ƒ„�„€„|„Ž„x„…„u„}„€„s„€ „r ZIP
ld h,d
ld l,e
ld c,#20 ;„ƒ„€„{„‚„p„‹„u„~„y„u
exx
pop hl
dec hl
inc h
inc l
ld b,l
ld c,h
pop hl
.loop1:
ld a,(hl)
inc hl
exx
xor e
ld b,8
.loop2:
srl h
rr l
rr d
rra
jp nc,.skip
ld e,a
ld a,h
xor #ED
ld h,a
ld a,l
xor #B8
ld l,a
ld a,d
xor #83
ld d,a
ld a,e
; xor #20
xor c
.skip:
djnz .loop2
ld e,a
exx
djnz .loop1
dec c
jp nz,.loop1
exx
ld a,h ;CRC32, „y„ƒ„�„€„|„Ž„x„…„u„}„�„z „r ZIP, „�„‚„y„~„y„}„p„u„„ xor „ƒ 0xFFFFFFFF „r „{„€„~„ˆ„u
cpl
ld b,a
ld a,l
cpl
ld c,a
ld a,d
cpl
ld d,a
ld a,e
cpl
ld e,a
ret
+89
View File
@@ -0,0 +1,89 @@
CALL #E1D2
DI
LD (RelocatedCode.SPsave),SP
LD HL,.START
LD DE,#D800
LD BC,.END-.START
PUSH DE
LDIR
LD HL,#E1D1
LD DE,#FFFF
LD BC,#0850
RET
RelocatedCode:
.START:
LDDR
LD HL,#F7B0
LD DE,#D900
LD B,#00
LD A,(HL)
BIT 7,A
JR NZ,#D94A
AND #0F
LD B,A
RLD
ADD A,#03
LD C,A
INC HL
LD A,E
SUB (HL)
INC HL
LD SP,HL
LD H,(HL)
LD L,A
LD A,D
SBC A,B
LD B,H
LD H,A
LD A,B
LD B,#00
LDIR
LD H,B
LD L,C
ADD HL,SP
JR #D929
AND #7F
JR Z,#D967
INC HL
BIT 6,A
JR NZ,#D958
LD C,A
LDIR
JR #D928
AND #3F
ADD A,#03
LD B,A
LD A,(HL)
INC HL
LD C,(HL)
LD (DE),A
INC DE
DJNZ #D960
LD A,C
JR #D929
LD SP,#D85B
LD B,#03
POP HL
DEC SP
POP AF
LD (HL),A
DJNZ #D96C
.SPsave+1: LD SP,#0000
DI
RET
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
.END EQU $
; Š à⨭ª  ­  áâ à⮢®¬ íªà ­¥ á«¥¢  ᢥàåã
INCBIN 'SP_LOGO.BIN'
+403
View File
@@ -0,0 +1,403 @@
; -Minimal ayFX player (Improved) v2.05 25/01/21--------------;
; https://github.com/Threetwosevensixseven/ayfxedit-improved ;
; Zeus format (http://www.desdes.com/products/oldfiles) ;
; ;
; Forked from v0.15 06/05/06 ;
; https://shiru.untergrund.net/software.shtml ;
; ;
; The simplest effects player. Plays effects on one AY, ;
; without music in the background. ;
; Priority of the choice of channels: if there are free ;
; channels, one of them is selected if free. ;
; If there are are no free channels, the longest-sounding ;
; one is selected. ;
; Procedure plays registers AF, BC, DE, HL, IX. ;
; ;
; Initialization: ;
; ld hl, the address of the effects bank ;
; call AFXInit ;
; ;
; Start the effect: ;
; ld a, the number of the effect (0..255) ;
; call AFXPlay ;
; ;
; In the interrupt handler: ;
; call AFXFrame ;
; ;
; Start the effect on a specified channel: ;
; ld a, the number of the effect (0..255) ;
; ld e, the number of the channel (A=0, B=1, C=2) ;
; call AFXPlayChannel ;
; ;
; Start the effect with sustain loop enabled: ;
; ld a, the number of the effect (0..255) ;
; ld e, the number of the channel (A=0, B=1, C=2) ;
; ld bc, the bank address + the release address offset ;
; call AFXPlayChannel ;
; ;
; Notify AFX.Frame that the should be should be looped back to ;
; the sustain point once the release point has been reached: ;
; ld a, the number of the effect (0..255) ;
; ld e, the number of the channel (A=0, B=1, C=2) ;
; ld bc, the bank address + the sustain address offset ;
; call AFXSustain ;
; ;
; Change log:
; v2.05 25/01/21 Bug fix: AFXInit was overwriting itself ;
; the first time it was called, so it ;
; couldn't ever be called a second time. ; ;
; v2.04 22/10/17 Bug fix: EffectTime was not fully ;
; initialised. ;
; v2.03 22/10/17 Bug fix: disabled loop markers should have ;
; MSB $00, as $FF could be a valid address. ;
; Backported Zeus player to Pasmo format. ;
; v2.02 21/10/17 Added the ability to loop a sound while ;
; receiving sustain messages. ;
; v2.01 21/10/17 Added the ability to play a sound on a ;
; specific channel. ;
; v2.00 27/08/17 Converted Z80 player to Zeus format. ;
; --------------------------------------------------------------;
; Channel descriptors, 4 bytes per channel:
; +0 (2) current address (channel is free if high byte=$00)
; +2 (2) sound effect time
; +2 (2) start address of sustain loop (disabled if high byte=$00)
; +2 (2) end address of sustain loop (disabled if high byte=$00)
afxChDescCount equ 3
afxChDesc DS afxChDescCount*8
AFXSMC equ 0
; --------------------------------------------------------------;
; Initialize the effects player. ;
; Turns off all channels, sets variables. ;
; ;
; Input: HL = bank address with effects ;
; --------------------------------------------------------------;
AFXInit:
inc hl
ld (afxBnkAdr1+1), hl ; Save the address of the table of offsets
ld (afxBnkAdr2+1), hl ; Save the address of the table of offsets
ld hl, afxChDesc ; Mark all channels as empty
ld de, $00ff
ld bc, afxChDescCount*256+$fd
afxInit0:
ld (hl), d
inc hl
ld (hl), d
inc hl
ld (hl), e
inc hl
ld (hl), e
inc hl
ld (hl), d
inc hl
ld (hl), d
inc hl
ld (hl), d
inc hl
ld (hl), d
inc hl
djnz afxInit0
ld hl, $ffbf ; Initialize AY
ld e, $15
afxInit1:
dec e
ld b, h
out (c), e
ld b,l
out (c), d
jr nz, afxInit1
ld (afxNseMix+1), de ; Reset the player variables
ret
; --------------------------------------------------------------;
; Play the current frame. ;
; ;
; No parameters. ;
; --------------------------------------------------------------;
AFXFrame:
ld bc, $03fd
ld ix, afxChDesc
afxFrame0:
push bc
ld a,11
ld h,(ix+1) ; Compare high-order byte of address to <11
cp h
jr nc, afxFrame7 ; The channel does not play, we skip
ld l, (ix+0)
ld e, (hl) ; We take the value of the information byte
inc hl
sub b ; Select the volume register:
ld d, b ; (11-3=8, 11-2=9, 11-1=10)
ld b, $ff ; Output the volume value
out (c), a
ld b, $bf
ld a, e
and $0f
out (c), a
bit 5, e ; Will the tone change?
jr z, afxFrame1 ; Tone does not change
ld a, 3 ; Select the tone registers:
sub d ; 3-3=0, 3-2=1, 3-1=2
add a, a ; 0*2=0, 1*2=2, 2*2=4
ld b, $ff ; Output the tone values
out (c), a
ld b, $bf
ld d, (hl)
inc hl
out (c), d
ld b, $ff
inc a
out (c), a
ld b, $bf
ld d, (hl)
inc hl
out (c), d
afxFrame1:
bit 6, e ; Will the noise change?
jr z, afxFrame3 ; Noise does not change
ld a, (hl) ; Read the meaning of noise
sub $20
jr c, afxFrame2 ; Less than $20, play on
ld h, a ; Otherwise the end of the effect
ld c,$ff
ld b, c ; In BC we record the most time
jr afxFrame6
afxFrame2:
inc hl
ld (afxNseMix+1), a ; Keep the noise value
afxFrame3:
pop bc ; Restore the value of the cycle in B
push bc
inc b ; Number of shifts for flags TN
ld a, %01101111 ; Mask for flags TN
afxFrame4:
rrc e ; Shift flags and mask
rrca
djnz afxFrame4
ld d, a
ld bc, afxNseMix+2 ; Store the values of the flags
ld a, (bc)
xor e
and d
xor e ; E is masked with D
ld (bc), a
afxFrame5:
ld c, (ix+2) ; Increase the time counter
ld b, (ix+3)
inc bc
afxFrame6:
ld (ix+2), c
ld (ix+3), b
ld (ix+0), l ; Save the changed address
ld (ix+1), h
call CheckRelease
afxFrame7:
ld bc, 8 ; Go to the next channel
add ix, bc
pop bc
djnz afxFrame0
ld hl, $ffbf ; Output the value of noise and mixer
afxNseMix:
ld de, 0 ; +1(E)=noise, +2(D)=mixer
ld a, 6
ld b, h
out (c), a
ld b, l
out (c), e
inc a
ld b, h
out (c), a
ld b, l
out (c), d
ret
CheckRelease:
ld a, (ix+6) ; get release LSB
cp l
ret nz ; Carry on if no MLB match
ld a, (ix+7) ; get release MSB
or a
ret z ; Carry on if release disabled
cp h
ret nz ; Carry on if no MSB match
push bc
ld a, (ix+4)
or a
jp z, NoLoop
ld a, (ix+5) ; Set CurrentAddrCh[N] back
ld (ix+1), a ; to SustainAddrCh[N] LSB
ld a, (ix+4) ;
ld (ix+0), a ; and MSB
xor a
ld (ix+4), a ; then toggle off the sustain
ld (ix+5), a ; to require it to be resent
NoLoop:
pop bc
ret
; --------------------------------------------------------------;
; Launch the effect on a specific channel. Any sound currently ;
; playing on that channel is terminated next frame. ;
; ;
; Input: A = Effect number 0..255 ;
; E = Channel (A=0, B=1, C=2) ;
; --------------------------------------------------------------;
AFXPlayChannel:
ld bc, $0000
; --------------------------------------------------------------;
; Launch the effect on a specific channel. Any sound currently ;
; playing on that channel is terminated next frame. ;
; During playback, when reaching ReleaseAddrCh[N], if an ;
; AFXSustain call has been received since this AFXPlayLooped ;
; returned, the playback time frame will loop back to ;
; SustainAddrCh[N]. ;
; ;
; Input: A = Effect number 0..255 ;
; E = Channel (A=0, B=1, C=2) ;
; BC = ReleaseAddrCh[N] ;
; --------------------------------------------------------------;
AFXPlayLooped:
push af
ld a, c
ld (ReleaseLoSMC), a ; SMC>
ld a, b
ld (ReleaseHiSMC), a ; SMC>
ld a, e
add a, a
add a, a
add a, a
ld e, a
ld d, 0
ld ix, afxChDesc
add ix, de
ld e, 3
add ix, de
pop af
ld de, 0 ; In DE the longest time in search
ld h, e
ld l, a
add hl, hl
afxBnkAdr2:
ld bc, 0 ; Address of the effect offsets table
add hl, bc
ld c, (hl)
inc hl
ld b, (hl)
add hl, bc ; The effect address is obtained in hl
push hl ; Save the effect address on the stack
jp DoPlay
; --------------------------------------------------------------;
; Launch the effect on a free channel. If no free channels, ;
; the longest sounding is selected. ;
; ;
; Input: A = Effect number 0..255 ;
; --------------------------------------------------------------;
AFXPlay:
push af
ld a, c
ld (ReleaseLoSMC), a ; SMC>
ld a, b
ld (ReleaseHiSMC), a ; SMC>
pop af
ld de, 0 ; In DE the longest time in search
ld h, e
ld l, a
add hl, hl
afxBnkAdr1:
ld bc, 0 ; Address of the effect offsets table
add hl, bc
ld c, (hl)
inc hl
ld b, (hl)
add hl, bc ; The effect address is obtained in hl
push hl ; Save the effect address on the stack
ld hl, afxChDesc ; Empty channel search
ld b, 3
afxPlay0:
inc hl
inc hl
ld a, (hl) ; Compare the channel time with the largest
inc hl
cp e
jr c, afxPlay1
ld c, a
ld a, (hl)
cp d
jr c, afxPlay1
ld e, c ; Remember the longest time
ld d, a
push hl ; Remember the channel address+3 in IX
pop ix
afxPlay1:
ld a, 5
add a, l ; Add(hl, a) }
ld l, a ; }
adc a, h ; }
sub l ; }
ld h, a ; }
djnz afxPlay0
DoPlay:
pop de ; Take the effect address from the stack
ld (ix-3), e ; Put in the channel descriptor
ld (ix-2), d
ld (ix-1), b ; Zero the playing time
ld (ix-0), b
ReleaseLoSMC equ $+3
ld (ix+3), AFXSMC ; <SMC Release LSB
ReleaseHiSMC equ $+3
ld (ix+4), AFXSMC ; <SMC Release MSB
xor a
ld (ix+1), a ; Reset sustain LSB
ld (ix+2), a ; Reset sustain MSB
ret
; --------------------------------------------------------------;
; Notify AFX.Frame that the sound in channel E should be looped ;
; back to SustainAddrCh[N] once ReleaseAddrCh[N] has been ;
; reached,provided playback was started with AFX.PlayLooped ;
; ;
; Input: E = Channel (A=0, B=1, C=2) ;
; BC = SustainAddrCh[N] ;
; --------------------------------------------------------------;
AFXSustain:
ld a, e
add a, a
add a, a
add a, a
ld e, 4
add a, e
ld hl, afxChDesc
add a, l ; Add(hl, a) }
ld l, a ; }
adc a, h ; }
sub l ; }
ld h, a ; }
ld (hl), c
inc hl
ld (hl), b
ret
Binary file not shown.