modCd=((modC+255)/256)*256
BEGcur
LD A,(EPAT)
CALL iPATq
CALL XPP2
LD A,C
CALL ICHNQ
LD A,(CURY)
ld (beg1),A
XOR A
JR IBEGq
DECBEG2
DECBEG1 LD A,-1
JR IBEG1Q
INCBEG2
INCBEG1 LD A,1
IBEG1Q LD HL,ARX
BIT 5,(HL)
IBEGq LD HL,beg1
ld DE,0x2e0a;#2E0B
jr Z,$+8
IBEG2q LD HL,beg2
ld DE,0x380a;#380B
ADD A,(HL)
AND 63
LD (HL),A
toOO
LD BC,+('0'-1)*256+10
INC B
SUB C
jr NC,$-2
ADD A,C
PUSH AF
LD A,B
CALL PRADD
POP AF
toOOQ INC D
ADD A,'0'
JP PRADD
prpatl
LD A,(PATLEN)
INC A
LD DE,#0C07
JR toOO
toOOOO
PUSH DE
push IX
LD IX,OOOO
LD DE,1000
CALL toOPP
LD DE,100
CALL toOPP
LD DE,10
CALL toOPP
LD (IX),L
POP IX
pop DE
LD L,'0'
LD A,(OOOO)
ADD A,L
CALL PRADD
INC D
LD A,(OOOO+1)
ADD A,L
CALL PRADD
INC D
LD A,(OOOO+2)
ADD A,L
CALL PRADD
LD A,(OOOO+3)
JR toOOQ
toOPP
LD B,-1
OR A
INC B
SBC HL,DE
jr NC,$-3
ADD HL,DE
LD (IX),B
INC IX
RET
POSFON
TEMPO=$+1
LD A,4
LD DE,#4106
CALL PRF8
LD A,(LENG)
LD E,#66
CALL PRF8
LD A,(LOOP)
LD E,#86
CALL PRF8
LD HL,TTITLE
LD DE,0x060a;#60C
LD B,32
CALL PRTXADD
LD HL,TAUTHOR
LD DE,0x060b;#60D
LD B,32
CALL PRTXADD
PATFON
LD A,(POS)
PUSH AF
LD DE,#4126
CALL PRF8
POP AF
LD L,A
LD H,TPOSS/256
LD A,(HL)
LD DE,#4146
CALL PRF8
CALL prpatl
LD A,(EPAT)
LD DE,#41C6
PRF8 LD B,#F8
PR88 PUSH DE
LD L,A
ld H,0
LD C,H
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD HL,BC
LD A,(curpg32khigh) ;ok ;(pg)
PUSH AF
PR88PG=$+1
LD A,pg4
CALL OUTME
DUP 5
LD A,(HL)
ld (DE),A
INC D
inc L
EDUP
LD A,(HL)
ld (DE),A
POP AF
pop DE
INC E
;JP OUTME
push bc
SETPG32KHIGH
pop bc
ret
PR7D LD B,FNTNOTE/256
JR PR88
INCTMP
LD A,(TEMPO)
INC A
AND 63
RET Z
ITMPQ LD (TEMPO),A
LD (temp1),A
LD DE,#4106
JR PRF8
DECTMP
LD A,(TEMPO)
DEC A
RET Z
JR ITMPQ
INCPOSU LD A,(ESNGon)
OR A
JP Z,INCEPAT
CALL ROLnxPO
JR IPOSQA
INCPOS
LD A,(POS)
INC A
IPOSQ LD (POS),A
IPOSQA LD A,(POS)
PUSH AF
LD A,(ESNGon)
OR A
jr NZ,IPOSPAT
POP AF
LD DE,#4126
CALL PRF8
LD HL,(POS)
LD H,TPOSS/256
LD A,(HL)
LD DE,#4146
JR PRF8
DECPOSU LD A,(ESNGon)
OR A
JP Z,DECEPAT
SCF
CALL UPRnxPO
JR IPOSQA
DECPOS
LD A,(POS)
DEC A
JR IPOSQ
IPOSPAT POP AF
LD L,A
LD H,TPOSS/256
LD A,(HL)
LD L,A
LD (EPAT),A
INC H
LD A,(HL)
LD (PATLEN),A
CALL PATFON
IPOSPATQ
XOR A
LD (CURY),A
INC A ;
LD (tempCNT),A ;
JP PRPATUU ;иначе глючит перекл.на лету в режиме TS
;8
JPITEM
LD A,(NOPKA)
OR A
RET Z
LD D,0;A
LD A,(ITEM)
CP -1
RET Z
DEC A
ADD A,A
LD E,A
CALL RE ;повторное не страшно?
useadr=$+1
LD HL,MENUUSE
ADD HL,DE
LD A,(HL)
INC HL
LD H,(HL)
LD L,A
JP (HL)
STROKA
;A=line#
;E=scrY
;B=pat
PUSH BC
push AF
;AND 63
LD C,A
LD A,E
LD (STROKY),A
ex af,af'
PUSH DE
CALL GETnADR
PUSH HL
POP IX
POP DE
LD D,0
CALL DE2SCR
ex de,hl
LD A,C
INC D
LD B,FNTDEC/256
CALL PR88
INC E
LD A,(IX)
OR (IX+1)
jr NZ,$+7
LD A,pg7
ld (PR88PG),A
INC E
LD A,(IX)
CALL PRF8 ;NZ,NC
LD A,(IX+1)
CALL PRF8
INC E
LD A,pg7
ld (PR88PG),A
LD A,(IX+2)
CALL PRF8
INC E
LD A,16+4
ex af,af'
LD BC,3
LD A,C
STROK0 PUSH AF
ADD IX,BC
LD A,(IX)
AND #7F
LD BC,13
jr Z,sTRNbl
DEC C
DEC A
CP 96
jr Z,sTRNres
INC B
SUB C
jr NC,$-2
ADD A,C
PUSH BC
CALL PR7D
POP AF
JR sTRNQ
sTRNbl
sTRNres LD A,C
CALL PR7D
LD A,C
sTRNQ
ADD A,14
CALL PR7D
LD A,(IX+3)
CALL PRF8 ;XX..
PUSH DE
ex af,af' ;'
LD D,A
ADD A,10+6
ex af,af' ;'
LD A,(IX)
RLA
jr NC,STRnG
LD A,(IX+3)
RRA
RRA
RRA
RRA
AND 15
ADD A,'G'
STROKY=$+1
LD E,0
CALL PRADD
STRnG POP DE
LD A,(IX+4)
CALL PRF8
INC E
LD A,(IX+1)
CALL PRF8
LD A,(IX+2)
CALL PRF8
INC E
LD BC,5
POP AF
DEC A
JP NZ,STROK0
LD A,pg4
LD (PR88PG),A
POP AF
pop BC
RET
;1
TSTFIRH
YIELD;HALT
TSTFIRE CALL CANCEL
jr NC,TST1
LD A,(NOPKA)
OR A
RET Z
LD A,(ARX)
TSTXMIN=$+1
CP 0
RET C
TSTXMAX=$+1
CP 0
jr NC,TST1
LD A,(ARXY)
TSTYMIN=$+1
CP 0
RET C
TSTYMAX=$+1
CP 0
TST1 CCF
RET
ldbminusNEGHL
LD B,'-'
NEGHL
XOR A
SUB L
LD L,A
SBC A,A
SUB H
LD H,A
RET
CLORNSM CALL CLORNS
CLSMPS
XOR A
CLSMPS0
CALL CLSMP
INC A
AND 31
jr NZ,CLSMPS0
RET
CLORNS
XOR A
CLORNS0
CALL CLORN
INC A
AND #F
jr NZ,CLORNS0
LD HL,TORNSZ+1
LD B,6
LD A,B
INC HL
inc HL
LD (HL),3
DJNZ $-4
LD HL,TDEFORN
CLORNS1 ex de,hl
PUSH AF
CALL HLOR3
POP AF
ex de,hl
LDI
LDI
LDI
DEC A
jr NZ,CLORNS1
RET
CLSMP
PUSH AF
ADD A,SMPS/256
LD H,A
SUB SMPS/256+#F
SUB 1
CALL OUT4
LD BC,252
LD L,B
jr NZ,CLSMPnG
LD (HL),264&0xff ;сэмпл G
INC HL ;=тихая огибающая
LD (HL),264/256 ;(для орнамента F)
JR CLSMPqG
CLSMPnG
LD (HL),B
INC HL
LD (HL),B
CLSMPqG INC HL
LD (HL),64
jr NC,$+4
LD (HL),192 ;сэмпл F = --E
INC L
LD (HL),B
INC L
ex de,hl
LD H,D
LD L,B
LDIR
LD L,3
LD (HL),15
POP AF
LD L,A
ADD HL,HL
LD H,TSMPSZ/256
LD (HL),0
INC L
LD (HL),1
RET
CLORN
PUSH AF
LD HL,TORNSZ+1
ADD A,A
ADD A,L
LD L,A
CP 0xff&(#F*2+TORNSZ+1)
CALL OUT4
LD BC,63
LD (HL),1
DEC HL
LD (HL),B
CALL _orn
LD (HL),B
jr NZ,$+4
LD (HL),-96
LD D,H
LD E,L
INC E
LDIR
POP AF
RET
DECOMS
if 1==0
LD A,1
ld (yedecom),A
LD A,'C'
ld (filextS),A
DEC A
LD (filextF),A
endif
DISKS
;LD (IY),-1
;LD (IY+48),8
LD A,201
ld (MHEXFNTpg),A
;XOR A
;LD (#5CF9),A
;LD L,A,H,A,(#5D0F),HL ;в DOS уже есть
;LD A,9
;ld (#5D06),A
LD (DISKSP),SP
LD HL,DISKCOO
LD DE,DISKUSE
LD BC,mDISK
CALL WINDOW
LD HL,tDISK
LD DE,0
CALL PRMENU
LD HL,filename_5CDD
LD DE,#B06
LD B,8
CALL PRTXADD
LD A,(comped)
OR A
JR Z,DISKnsz
LD HL,tSZ
LD DE,0
CALL PRMENU
LD HL,(SNGLEN)
LD DE,#1500
CALL PRHL
DISKnsz
LD A,(catH)
INC A
CALL Z,READCAT
CALL PRCATEI
CATLOOP
CALL RESHALT
CALL NZ,REREAD
CALL JPITEM
CALL USEBAR
CALL TSTFIRE
jr NC,CATLOOP
DISKQ
if 1==1 ;TODO move code and vars around to avoid
movd0a0=$+1
LD A,0
OR A
jr Z,DSKQnMV
CALL OUT7
LD HL,ld000
LD DE,la000
LD BC,#2000
LDIR
XOR A
LD (movd0a0),A
DSKQnMV
endif
;LD A,'IMVEC
;LD I,A
;IM 2
DISKSP=$+1
LD SP,0
LD A,205
ld (MHEXFNTpg),A
CALL DOWNMER
CALL CLOSWIN
LD A,'S'
ld (filextS),A
LD A,'F'
ld (filextF),A
XOR A
LD (comped),A
;LD (yedecom),A
CALL MKSCROL
CALL POSFON
CALL PRPAT
JR COPYFRQ
IF set
SETUP
LD HL,SETUCOO
LD DE,SETUUSE
LD BC,mSETUP
CALL WINDOW
LD HL,tSETUP
LD DE,0
CALL PRMENU
CALL PRSETS
SETUPP0
CALL HALTER
CALL JPITEM
CALL TSTFIRE
jr NC,SETUPP0
CALL SETCOLS
CALL CLOSWIN
CALL PRPAT
ENDIF
COPYFRQ
CALL OUT6
FRQn=$+1
LD DE,1
LD HL,NT_DATA
ADD HL,DE
add HL,DE
add HL,DE
LD BC,T_
LD E,(HL)
INC HL
ex de,hl
ADD HL,BC
LD A,(DE)
ld (COPF3),A
INC DE
LD A,(DE)
ADD A,C
LD C,A
ADC A,B
SUB C
LD B,A
LD DE,FrTab
PUSH BC
push DE
LD B,12
COPF1 PUSH BC
LD C,(HL)
INC HL
LD B,(HL)
PUSH HL
push DE
ex de,hl
LD DE,23
LD HX,8
COPF2 SRL B
RR C
LD A,C
COPF3 ADC A,D ;=ADC 0
LD (HL),A
INC HL
LD A,B
ADC A,D
LD (HL),A
ADD HL,DE
DEC HX
jr NZ,COPF2
POP DE
pop HL
INC DE
inc DE
INC HL
POP BC
DJNZ COPF1
POP HL
pop DE
CORR_1 LD A,(DE)
OR A
RET Z
INC DE
RRA
PUSH HL
PUSH AF
ADD A,A
LD C,A
ADD HL,BC
POP AF
INC (HL)
jr NC,$+4
DEC (HL)
dec (HL)
POP HL
JR CORR_1
IF set
suPOI LD HL,poion
JR suCPL
suKJ XOR A
IN A,(31)
CPL
AND #F
RET Z
LD HL,joy
JR suCPL
suSND LD A,(SHOLK)
OR A
LD A,201
jr Z,$+3
XOR A
LD (SHOLK),A
JR PRSETS
suPLAY LD HL,playon
suCPL LD A,(HL)
CPL
LD (HL),A
JR PRSETS
suPAP1 LD HL,pap1
JR suATR
suINK2 LD HL,ink2
JR suATR
suPAP2 LD HL,pap2
JR suATR
suBORD LD HL,bord
JR suATR
suFRQ LD HL,FRQn
INC (HL)
RES 2,(HL)
JR PRSETS
suINK1 LD HL,ink1
suATR LD A,(HL)
ADD A,8
AND 56
LD (HL),A
PRSETS
LD BC,(FRQn-1)
INC B
LD DE,12
LD HL,tPTST-12
ADD HL,DE
DJNZ $-1
LD DE,#1301
CALL PRMENU
LD A,(poion)
LD HL,tON
OR A
jr NZ,$+5
LD HL,tOFF
LD DE,#1602
CALL PRMENU
;LD HL,#5971
;LD BC,32
;LD A,(ink1)
;ld (HL),A
;INC L
;LD A,(pap1)
;ld (HL),A
;ADD HL,BC
;LD A,(pap2)
;ld (HL),A
;DEC L
;LD A,(ink2)
;ld (HL),A
;LD A,(bord)
;ld (#59B2),A
LD A,(SHOLK)
LD HL,tON
OR A
jr Z,$+5
LD HL,tOFF
LD DE,#1407
CALL PRMENU
LD A,(joy)
LD HL,tON
OR A
jr NZ,$+5
LD HL,tOFF
LD DE,#1909
CALL PRMENU
LD A,(playon)
OR A
LD HL,tALL
jr NZ,$+5
LD HL,tNOTE
LD DE,#1408
JP PRMENU
ENDIF
;1+?
SETCOLS
LD HL,ink1
LD A,(HL)
INC HL
RRCA
RRCA
RRCA
OR (HL)
LD L,A
ld H,A
LD (col1),HL
LD HL,ink2
LD A,(HL)
INC HL
RRCA
RRCA
RRCA
OR (HL)
LD L,A
ld H,A
LD (col2),HL
;LD A,(bord)
;RRCA
;RRCA
;RRCA
;OUT (-2),A
RET
EDFILE
LD HL,filename_5CDD
LD DE,#B06
LD A,8
CALL EDTXT
JP WAITNOK
SAVSMP
LD HL,TSSMP
ld DE,#C01
CALL PRMENU
ld hl,fileext_5CE5
ld (hl),'s'
inc hl
ld (hl),'m'
inc hl
ld (hl),'p'
;LD C,#12
;CALL DOS
CALL OUT4
LD A,(smp)
PUSH AF
ADD A,SMPS/256
LD H,A
LD DE,BUF
LD BC,256
LD L,C
LDIR
POP AF
ADD A,A
LD L,A
ld H,TSMPSZ/256
LDI
LDI
LD HL,BUF
LD DE,258
DOSb
push de
push hl
ld hl,filename_5CDD
ld de,filinfo+FILINFO_FNAME
push de
call cpmname_to_dotname
pop de
OS_CREATEHANDLE
pop de
pop hl ;de=buf, hl=size
push bc
OS_WRITEHANDLE
pop bc
OS_CLOSEHANDLE
;LD C,#B
;DOSbQ ;CALL DOS
;LD HL,#5D0F
;ld A,(HL)
;ld (HL),0
;OR A
;jr Z,$+4
; OUT (-2),A
LD A,-1
ld (catH),A
JP DISKQ
SAVORN
LD HL,TSORN
ld DE,#B01
CALL PRMENU
ld hl,fileext_5CE5
ld (hl),'o'
inc hl
ld (hl),'r'
inc hl
ld (hl),'n'
;LD C,#12
;CALL DOS
CALL OUT4
CALL HLORN
LD DE,BUF
ld BC,64
LDIR
LD H,TORNSZ/256
ld L,A
LDI
LDI
LD HL,BUF
ld DE,66
JR DOSb
SAVPAT
LD HL,TSPAT
ld DE,#B01
CALL PRMENU
CURY=$+1
EPAT=$+2
LD BC,0
ld C,0
CALL GETnADR
PUSH HL
ld hl,fileext_5CE5
ld (hl),'p'
inc hl
ld (hl),'a'
inc hl
ld (hl),'t'
;LD A,'p'
;ld (fileext_5CE5),A
;LD C,#12
;CALL DOS
POP HL
LD DE,#480
JR DOSb
SAVCOMP
CALL OUT7
;LD C,#12
IF 1==0;cmpilmnu
LD A,(plyrON)
OR A
LD HL,plaer
ld A,'C'
jr NZ,$+7
ENDIF
ld hl,fileext_5CE5
ld (hl),'p'
inc hl
ld (hl),'t'
inc hl
ld (hl),'3'
LD HL,ptmod
;ld A,'m'
;LD (fileext_5CE5),A
;PUSH HL
; CALL DOS
;POP HL
LD DE,(SNGLEN)
; LD C,#B
; CALL DOS
; LD C,#A
; CALL DOS
; LD A,C
; PUSH AF
; LD C,8
; CALL DOS
;LD HL,(SNGST)
;ld (#5CE6),HL ;TR-DOS only
;POP AF
;LD C,9 ;save file descriptor ;TODO
JP DOSb;Q
SAVE
comped=$+1
LD A,0
OR A
jr NZ,SAVCOMP
;CALL EXB0
LD A,40 ;NOKILL
CALL cMPILE
PUSH HL
push DE
;CALL EXB0
CALL OUT7
ld hl,fileext_5CE5
ld (hl),'p'
inc hl
ld (hl),'t'
inc hl
ld (hl),'3'
;LD C,#12
;LD A,'m'
;ld (fileext_5CE5),A
;CALL DOS
POP DE
pop HL
JP DOSb
CATUP
LD A,(cattop)
DEC A
RET M
LD (cattop),A
JR PRCATEI
CATDN
LD A,(cattop)
INC A
ADD A,7
catH=$+1
CP 255
RET NC
SUB 7
LD (cattop),A
;2
PRCATEI
JP PRCAT
DESCADR
LD L,A
ld H,0
ld E,L
ld D,H
ADD HL,HL
ADD HL,HL
ADD HL,DE
ADD HL,HL
ADD HL,DE ;*11
LD DE,CATfilt
ADD HL,DE
RET
LDORN
LD HL,TLORN
ld DE,#A01
CALL PRMENU
CALL OUT4
LD HL,BUF
PUSH HL
LD (LDADR),HL
CALL LDFILE
CALL HLORN
ex de,hl
POP HL
LD BC,64
LDIR
LD D,TORNSZ/256
LDORNQ LD E,A
LDI
LDI
JP DISKQ
LDSMP
LD HL,TLSMP
ld DE,#B01
CALL PRMENU
CALL OUT4
LD HL,BUF
PUSH HL
LD (LDADR),HL
CALL LDFILE
LD A,(smp)
PUSH AF
ADD A,SMPS/256
LD D,A
POP AF
ADD A,A
POP HL
LD BC,256
LD E,C
LDIR
LD D,TSMPSZ/256
JR LDORNQ
LOAD
LD A,(ITEM)
SUB 9
LD C,A
ld A,(cattop)
ADD A,C
CALL DESCADR
LD DE,filename_5CDD
ld BC,11
LDIR
dec hl
LD C,(HL)
dec hl
;yedecom=$+1
; LD A,0
; DEC A
; JP Z,DECOM
DEC HL
LD A,(HL)
or 0x20
;jr $
CP 'o'
jr Z,LDORN
;CP 'S'
;jr Z,LDST
CP 'm'
jr Z,LDSNG
CP 'f'
jr Z,LDSTP
CP 'p'
jr Z,LDPAT
CP 's'
ret nz
inc hl
ld a,(hl)
or 0x20
cp 'm'
jr Z,LDSMP
jp LDST
ld_pt2
CALL OUT7
LD HL,ptmod
ld (LDADR),HL
CALL LDFILE
DI ;???
;CALL EXB0
CALL LDPT2PP
;CALL EXB0
;LD IY,23610
EI ;???
JR ex9BQ
LDST
CALL MOVD0A0
CALL LDFILE
CALL LDSTPP
JR ex9BQ
LDSTP
CALL MOVD0A0
LD (LDADR),HL
CALL LDFILE
LD A,-1
ld (ksaON),A
ld (STand),A
CALL LDKSAPP
XOR A
LD (ksaON),A
LD A,#F
ld (STand),A
ex9BQ LD A,(TPOSS)
ld (EPAT),A
JP DISKQ
LDPAT
LD A,C ;third char of extension
;or 0x20
CP '3'
jr Z,LDSNG_pt3
LD HL,TLPAT
ld DE,#B01
CALL PRMENU
LD A,(EPAT)
ld B,A
ld C,0
CALL GETnADR
LD (LDADR),HL
CALL LDFILE
JP DISKQ
LDSNG
LD A,C ;third char of extension
or 0x20
CP '2'
jr Z,ld_pt2
IF gs
CP 'd'
JP Z,LDGS
ENDIF
LDSNG_pt3
CALL OUT7
LD HL,ptmod
IF tstPT
PUSH HL
ENDIF
LD (LDADR),HL
CALL LDFILE
LD HL,TPROTR
IF tstPT
POP DE
LD B,13
LDSNGCP LD A,(DE)
CP (HL)
jr NZ,PRSORRY
INC DE
INC HL
DJNZ LDSNGCP
ENDIF
LDSNGQ DI ;???
;CALL EXB0
CALL LDPT3PP
;CALL EXB0
EI ;???
XOR A
LD (POS),A
LD A,(TPOSS)
LD (EPAT),A
JP DISKQ
PRSORRY LD HL,TSORRY
JP PRDISKQ
;DOSTSPP LD (#5C3D),SP
; JP #3D13
;1
DOSTEST
;CALL DOSTSPP
;LD A,#C9
;ld (#5CC2),A
;LD A,IMVEC/256
;ld I,A
;IM 2
;EI
;LD A,(#5D0F)
;INC A
;jr Z,DOSTSOK
;LD A,(23610)
;INC A
;RET Z
;DOSTSOK LD HL,TDISKER
;LD A,(#5D0F)
;CP -1
;jr NZ,$+5
;LD HL,TNOFILE
;LD (IY),-1
PRDISKQ LD DE,#601
CALL PRMENU
;LD B,50
;HALT
;DJNZ $-1
JP DISKQ
IF gs
LDGS
;LD C,#A
;CALL DOS
;LD A,C
;LD C,8
;CALL DOS
CALL OUT7
;LD HL,(#5CEB) ;trsec
;LD (#5CF4),HL ;curtrsec
;LD DE,(#5CF4)
;LD HL,modCd
;LD BC,#1005
;CALL DOS
;filename_5CDD
ld hl,filename_5CDD
ld de,filinfo+FILINFO_FNAME
push de
call cpmname_to_dotname ;hl -> de
pop de ;filinfo+FILINFO_FNAME
OS_OPENHANDLE
ld a,b
ld (curhandle),a
push bc
call LGSMPDISK
LD DE,#FC00
LD BC,20+(31*30)
LDIR
;1. Load module
;2. Load samples
SC #30 ;Load module
WC
;LD HL,modCd
LD BC,0;szsmp
CALL LGSMPLOOP
;find max pattern
;LD HL,modCd+950
LD B,(HL) ;songlength
INC HL
INC HL
;LD HL,modCd+950+2 ;positions
XOR A
FNDMAXPAT0
CP (HL)
JR NC,$+3
LD A,(HL)
INC HL
DJNZ FNDMAXPAT0
INC A
LD HL,modCd+950+134
;skip A patterns
ADD A,A
ADD A,A
LD B,A
LD C,0
;A*1024
LGSKP0 INC L
CALL Z,LGSMPH
DEC BC
LD A,B
OR C
JR NZ,LGSKP0
LD DE,#FC00+20+22
LD B,31
LGSMPS0
PUSH BC
LD A,(DE)
INC DE
LD B,A
LD A,(DE)
LD C,A
;smpsize/2
SLA C
RL B
;SC #38 ;Load FX
SD #01 ;signed sample
SC #3E ;Load FX ext
WC
CALL LGSMPLOOP
EX DE,HL
LD BC,30-1
ADD HL,BC ;next smp descr
EX DE,HL
POP BC
DJNZ LGSMPS0
pop bc
OS_CLOSEHANDLE
JP DISKQ
LGSMPLOOP
SC #D1 ;Open Stream
WC
LD A,B
OR C
JR Z,LGSMPSKIPQ
LGSMP0
LD A,(HL)
OUT (GSDAT),A
WD
INC L
CALL Z,LGSMPH
DEC BC
LD A,B
OR C
JR NZ,LGSMP0
LGSMPSKIPQ
SC #D2 ;Close Stream
WC
RET
LGSMPH
INC H
LD A,H
CP modCd/256+#10
RET NZ
LGSMPDISK
LD HL,modCd
PUSH BC
PUSH hl
PUSH de
ex de,hl
;LD DE,(#5CF4)
;LD BC,#1005
;CALL DOS
curhandle=$+1
ld b,0
ld hl,#1000
OS_READHANDLE
POP de ;modCd
POP hl
POP BC
RET
ENDIF ;gs
LDFILE
;filename_5CDD
ld hl,filename_5CDD
ld de,filinfo+FILINFO_FNAME
push de
call cpmname_to_dotname ;hl -> de
pop de ;filinfo+FILINFO_FNAME
OS_OPENHANDLE
;ld a,b
;ld (curhandle),a
;curhandle=$+1
; ld b,0
push bc
LDADR=$+1
LD de,ptmod
ld hl,0x4000
OS_READHANDLE
pop bc
OS_CLOSEHANDLE
DOS
ret
if 1==0
PUSH IX
CALL DOSTEST
POP IX
RET
msgRIA
PUSH AF
;LD A,(curpg32khigh) ;ok ;(pg)
;ld (OLDPG),A
LD BC,mDISKER
CALL WINDUM
LD HL,tDISKER
LD DE,0
CALL PRMENU
POP AF
RET
endif
REREAD
if 1==0
SUB '1'
RET C
CP 4
RET NC
LD (23833),A
LD (23798),A
LD (23800),A
LD (23801),A
CALL drive
LD C,1
CALL DOS
endif
READCAT
LD A,8
ld (DSKopts),A
LD HL,CATfilt
LD DE,CATfilt+1
LD (HL),32
LD B,1;C,#48
LDIR
LD A,8
ld (catopts),A
XOR A
LD (catH),A
LD (cattop),A
CALL PRCAT
;LD HL,CATdos
;LD DE,0
;LD BC,#805
;CALL DOS
ld de,emptypath
OS_OPENDIR
LD HL,CATfilt
ld bc,0
loaddir0
call loaddir_filinfo
jp c,loaddirq
jr z,loaddir0
push bc
push hl
ld de,filinfo+FILINFO_FNAME
call dotname_to_cpmname ;de -> hl
pop hl
push hl
ld bc,8
add hl,bc
LD BC,7+gs
LD A,(hl)
or 0x20
LD HL,FILEXTS
CPIR
pop hl
pop bc
jr NZ,loaddir0
ld de,11;9
add hl,de
inc bc
bit 7,c
jr z,loaddir0
loaddirq
ld a,c
LD (catH),A ; number of files
LD C,8
CP C
jr C,$+3
LD A,C
LD (catopts),A
ADD A,C
LD (options),A
LD (DSKopts),A
XOR A
LD (cattop),A
PRCAT
LD A,(cattop)
CALL DESCADR
catopts=$+1
LD A,8
LD B,A
OR A
jr Z,pRCATQ
LD DE,#1504
PRCAT0 PUSH BC
push DE
LD B,8
CALL PRTXADD
INC D
inc B
CALL PRTXT
INC HL
INC HL
POP DE
pop BC
INC E
DJNZ PRCAT0
pRCATQ JP CATBAR
DECPAT
LD A,-1
JR IPATQ
INCPAT LD A,1
IPATQ LD HL,(POS)
ld H,TPOSS/256
ADD A,(HL)
JP P,$+5
LD A,PATS-1
CP PATS
jr C,$+3
XOR A
LD HL,(POS)
ld H,TPOSS/256
LD (HL),A
ld C,A
LD A,(ESNGon)
OR A
LD A,C
LD DE,#4146
JP Z,PRF8
LD (EPAT),A
INC H
LD L,C
LD A,(HL)
ld (PATLEN),A
CALL PATFON
JP IPOSPATQ;PRPAT ;v3+698
INCLENG
LD A,(LENG)
INC A
jr NZ,$+3
INC A
ILENQ LD (LENG),A
LD DE,#4166
JP PRF8
DECLENG LD A,(LENG)
DEC A
jr NZ,ILENQ
DEC A
JR ILENQ
INCLOOP
LD A,(LOOP)
INC A
ILOOPQ LD (LOOP),A
LD DE,#4186
JP PRF8
DECLOOP LD A,(LOOP)
DEC A
JR ILOOPQ
INCVOL
VOL=$+1
LD A,#F
INC A
AND #F
RET Z
IVOLQ LD (VOL),A
PUSH AF
LD DE,#41A6
CALL PRF8
POP AF
ADD A,A
ADD A,A
ADD A,A
ADD A,A
LD (glovol),A
RET
DECVOL LD A,(VOL)
DEC A
RET M
JR IVOLQ
INCEPAT
LD A,(EPAT)
INC A
LD B,0
IEPATQ CP PATS
jr C,$+3
LD A,B
LD (EPAT),A
PUSH AF
LD HL,TPATSZ
ADD A,L
LD L,A
LD A,(HL)
LD (PATLEN),A
LD A,(ESNGon)
OR A
jr NZ,IESNG
CALL prpatl
POP AF
LD DE,#41C6
CALL PRF8
iEPATQQ
JP IPOSPATQ;PRPAT ;v3+698
DECEPAT LD A,(EPAT)
DEC A
LD B,PATS-1
JR IEPATQ
IESNG LD HL,(POS)
ld H,TPOSS/256
POP AF
LD (HL),A
CALL PATFON
JR iEPATQQ
CPLm
LD A,(HL)
XOR -1
LD (HL),A
LD HL,tON
RET Z
LD HL,tOFF
RET
AUTOON
LD HL,auto
CALL CPLm
LD DE,0x0a08;#A0A
JR NXDIVQ
ENVON
LD HL,aenv
CALL CPLm
LD DE,0x0a09;#A0B
JR NXDIVQ
NXTDIV
LD A,127
IN A,(-2)
RRA
RRA
CALL C,CANCEL2 ;check rmb
LD HL,div
LD A,(HL)
INC A
jr C,$+4
SUB 2
AND 7
LD (HL),A
LD D,A
ADD A,A
ADD A,D
LD E,A
LD D,0
LD HL,DIVS
ADD HL,DE
LD DE,0x0f09;#F0B
NXDIVQ JP PRMENU
MKSCROL
CALL OUT7
LD HL,scrolin
LD DE,_d000
PUSH DE
LD BC,scroLEN
LDIR
POP HL
PUSH HL
LD BC,scroSIZ
LDIR
ex de,hl
LD (HL),#C3
INC HL
LD (HL),scrolQ&0xff
INC HL
LD (HL),scrolQ/256
INC HL
LD (scrol2J),HL
POP DE
PUSH HL
PUSH DE
LD BC,scroSIZ+scroLEN
ex de,hl
LDIR
ex de,hl ;#
LD (HL),#C3
INC HL
LD (HL),scrol2Q&0xff
INC HL
LD (HL),scrol2Q/256
POP IX
LD HL,PATVIEWTOPFROM;#5103
LD DE,PATVIEWTOP;#49E0
LD C,PATVIEWLINES-1;8
MSCR0 LD B,6
MSCR1 CALL MscrPP
CALL DDE
call DHL
DJNZ MSCR1
CALL DDE
call DHL
INC D
inc H
DEC C
jr NZ,MSCR0
POP IX
LD HL,#56C3
LD DE,#56E0
LD C,PATVIEWLINES-1;8
MSCR2 LD B,6
MSCR3 CALL MscrPP
CALL UDE
call UHL
DJNZ MSCR3
CALL UDE
call UHL
DEC D
dec H
DEC C
jr NZ,MSCR2
RET
MscrPP
PUSH BC
LD C,-3
LD A,L
LD (IX+1),A
LD (IX+2),H
ADD A,C
LD (IX+4),A
LD (IX+5),H
LD A,E
LD (IX+7),A
LD (IX+8),D
SUB C
LD (IX+11),A
LD (IX+12),D
SUB C
LD (IX+15),A
LD (IX+16),D
SBC A,C
LD (IX+20),A
LD (IX+21),D
SBC A,C
LD (IX+24),A
LD (IX+25),D
ADD A,21
LD (IX+40),A
LD (IX+41),D
LD BC,scroLEN ;54
ADD IX,BC
POP BC
RET
scrolST
DI
PUSH AF
push BC
push DE
push HL
push IX
CALL OUT7
LD (scrolQ+1),SP
JP _d000
scrolQ
LD SP,0
POP IX
pop HL
pop DE
pop BC
pop AF
RET
scrol2
PUSH AF
push BC
push DE
push HL
push IX
CALL OUT7
LD (scrol2Q+1),SP
scrol2J=$+1
JP _d000
scrol2Q
LD SP,0
POP IX
pop HL
pop DE
pop BC
pop AF
RET
scrolin
LD SP,0;0
LD A,(0) ;ok ;3
LD (0),A ;ok ;6
POP HL
LD (0),HL ;ok ;10
POP AF
LD (0),A ;ok ;14
INC SP
POP HL
LD (0),HL ;ok ;19
POP HL
LD (0),HL ;ok ;23
INC SP
POP AF
INC SP
POP BC
pop DE
INC SP
POP HL
INC SP
EXX
POP BC
pop DE
INC SP
POP HL
LD SP,0;39
PUSH HL
DEC SP
PUSH DE
push BC
DEC SP
EXX
PUSH HL
DEC SP
PUSH DE
push BC
DEC SP
PUSH AF
scroLEN=$-scrolin
scroSIZ=scroLEN*((PATVIEWLINES-1)*6-1);47
;3
UDE
LD A,D
DEC D
AND 7
RET NZ
LD A,E
SUB 32
LD E,A
RET C
LD A,D
ADD A,8
LD D,A
RET
;3
UHL
LD A,H
DEC H
AND 7
RET NZ
LD A,L
SUB 32
LD L,A
RET C
LD A,H
ADD A,8
LD H,A
RET
if 1==0
EXB0
LD HL,COMFROM
LD DE,lb000
CALL OUT6
EXPG0 LD C,(HL)
ld A,(DE)
ld (HL),A
ld A,C
ld (DE),A
INC DE
inc HL
LD A,D
CP #BF
jr NZ,EXPG0
RET
endif
COMPILS
ret
;TODO
;CALL EXB0
LD A,24 ;KILL
CALL cMPILE
IF cmpilmnu
LD A,(plyrON)
OR A
jr Z,COMPnPL
LD HL,ptmod-plaer
ADD HL,DE
ex de,hl
COMPnPL
ENDIF
LD (SNGLEN),DE
;CALL EXB0
IF cmpilmnu
LD HL,COMPCOO
LD DE,COMPUSE
LD BC,mCOMPIL
CALL WINDOW
LD HL,tCOMPIL
LD A,H
ld (EDTXQIF),A
LD DE,0
CALL PRMENU
CALL PRCOMPI
COMPLOP
CALL HALTER
CALL JPITEM
CALL TSTFIRE
jr NC,COMPLOP
CALL CLOSWIN
XOR A
LD (EDTXQIF),A
JP MKSCROL
COMSAVE
ENDIF
LD A,-1
LD (comped),A
IF 0==(ply+cmpilmnu)
JP DISKS
ELSE
LD A,'C'
ld (extS),A
LD A,201
ld (MHEXFNTpg),A
CALL CLOSWIN
LD A,205
ld (MHEXFNTpg),A
XOR A
LD (EDTXQIF),A
POP HL
CALL OUT7
IF 0==ply
JP DISKS
ELSE
LD A,(SNGST+1)
LD IX,TRELOC
LD HL,plaer
LD D,#C0
LD ($-1),A
LD E,A
LD B,L
REL0 LD C,(IX)
LD A,C
OR A
JP Z,DISKS
INC IX
ADD HL,BC
INC A
jr Z,REL0
LD A,(HL)
SUB D
ADD A,E
LD (HL),A
JR REL0
ENDIF
ENDIF
IF cmpilmnu
PLYRyn
LD HL,plyrON
LD A,(HL)
XOR -1
LD (HL),A
LD BC,(SNGLEN)
LD HL,ptmod-plaer
CALL Z,NEGHL
ADD HL,BC
LD (SNGLEN),HL
JP PRCOMPI
EcomADR
CALL WAITNOK
LD A,2
LD DE,#1004
LD HL,tC0
CALL EDTXT
LD A,(TXTBUF)
CP '0'
jr C,EcomAQ
CP 'G'
jr NC,EcomAQ
CP 'A'
jr C,$+6
SUB #37
JR EcomA1
CP ':'
jr NC,EcomAQ
SUB '0'
EcomA1 RRCA
RRCA
RRCA
RRCA
LD B,A
LD A,(TXTBUF+1)
CP '0'
jr C,EcomAQ
CP 'G'
jr NC,EcomAQ
CP 'A'
jr C,$+6
SUB #37
JR EcomA2
CP ':'
jr NC,EcomAQ
SUB '0'
EcomA2 OR B
LD (SNGST+1),A
EcomAQ JP PRCOMPI
PRCOMPI
plyrON=$+1
LD A,-ply
OR A
LD HL,TYES
jr NZ,$+5
LD HL,TNO
LD DE,#1103
CALL PRMENU
LD HL,(SNGST)
LD DE,#1004
CALL PRHL
LD DE,#1008
CALL PRHL
LD DE,#1009
LD L,5
CALL PRHL
LD DE,#100A
LD L,8
CALL PRHL
LD DE,#100B
LD BC,ptmod-plaer-8
ADD HL,BC
CALL PRHL
LD HL,(SNGLEN)
LD DE,#100D
ENDIF
PRHL
LD A,H
CALL PRHEX
INC D
LD A,L
PRHEX
PUSH AF
RRCA
RRCA
RRCA
RRCA
CALL PRBCD
INC D
POP AF
PRBCD
;AND #F
;ADD A,#90
;DAA
;ADC A,#40
;DAA
or 0xf0 ;TODO
daa
add a,0xa0
adc a,0x40
PRADD
PUSH DE
CALL PRADDPP
CALL PR4X8
POP DE
RET
INCCHN
LD A,(chn1)
INC A
CP 4
jr NZ,$+4
LD A,1
ICHNQ LD (chn1),A
LD DE,0x2f09;#2F0A
JR PRBCD
DECCHN LD A,(chn1)
DEC A
jr NZ,ICHNQ
LD A,3
JR ICHNQ
INCCHN2
LD A,(chn2)
INC A
CP 4
jr NZ,$+4
LD A,1
ICHN2Q LD (chn2),A
LD DE,0x3909;#390A
JR PRBCD
DECCHN2 LD A,(chn2)
DEC A
jr NZ,ICHN2Q
LD A,3
JR ICHN2Q
D2HEX
CP 10
jr C,$+4
ADD A,'A'-':'
ADD A,'0' ;TODO daa
LD (digit),A
JR PRADD
drive
LD C,A
LD A,(#5D16)
AND #FC
OR C
LD (#5D16),A
LD A,C
RET
BLOBER
LD E,0
BLOBER_e
LD D,H
LD (HL),E
INC H
LD (HL),E
INC H
LD (HL),A
INC H
LD (HL),A
INC H
LD (HL),E
INC H
LD (HL),E
LD H,D
RET
BLOBER7 LD E,#70
JR BLOBER_e
if 1==0
;1
DECOM
LD HL,TSEARCH
LD DE,#601
CALL PRMENU
LD C,#A
CALL DOS
LD A,C
LD C,8
CALL DOS
CALL OUT7
LD HL,(#5CEB)
LD (#5CF4),HL
LD A,(#5CEA)
DECOM0 ex af,af'
LD HL,modCd+256
LD DE,modCd
PUSH DE ;modCd
LD BC,256
LDIR
LD HL,(#5CF4)
ex de,hl ;HL=modCd+256
LD BC,#105
CALL DOS
POP HL ;modCd
DECOM1 LD DE,TPROTR;+13
;LD C,L
PUSH HL
LD B,#D
DCOMPP0 INC DE
inc HL;DEC DE,HL
LD A,(DE)
CP (HL)
jr NZ,DCOMPPQ
DJNZ DCOMPP0
;PUSH HL
LD HL,TSEARCH
LD DE,#601
CALL PRMENU
LD HL,modCd+512
ex af,af'
LD BC,#4005
CP B
jr NC,$+3
LD B,A
LD DE,(#5CF4)
CALL DOS
POP HL
LD DE,ptmod
LD B,64
LDIR
JP LDSNGQ
DCOMPPQ;LD L,C
POP HL
INC L
jr NZ,DECOM1
ex af,af'
DEC A
jr NZ,DECOM0
JP DISKQ
endif
CHN1PP
chn1=$+1
LD A,1
LD BC,3
DEC A
RET Z
LD C,8
DEC A
RET Z
LD C,13
RET
IF bemol
EPbem
LD BC,(CURY)
CALL GETnADR
call XPP2
LD A,C
ADD A,A
add A,A
add A,C
add A,-2
ADD A,L
LD L,A
jr NC,$+3
INC H
LD A,(HL)
SUB 12
jr NC,$-2
ADD A,11
LD L,A
;DB ")))
add hl,hl
add hl,hl
add hl,hl
LD H,FNTDEC/256+2
INC L
BIT 3,(HL) ;diez
RET Z
DEC L
LD D,H
LD A,8
CALL bemxorP
LD A,-8
CALL bemxorP
INC HL
LD DE,sprbem
LD B,5
CALL bemxor
JP PRPATU
bemxorP ADD A,L
LD E,A
LD B,6
bemxor PUSH HL
LD A,(DE)
XOR (HL)
LD (HL),A
INC HL
inc DE
DJNZ $-5
POP HL
RET
sprbem DB 2,6,4,4,6
ENDIF
INCPATL LD A,(PATLEN)
INC A
IPATLQ
AND 63
LD (PATLEN),A
ld C,A
LD A,(EPAT)
LD HL,TPATSZ
ADD A,L
LD L,A
LD (HL),C
CALL prpatl
JP PRPATU;IPOSPATQ v3+698;PRPAT
DECPATL LD A,(PATLEN)
DEC A
JR IPATLQ