;1720708
;LAST UPDATE: 28.05.2021 savelij
include ../macros.a80
include ../ports_ngs.a80
include equ_ngs.a80
include ../sdcomand.a80
include version.a80
;GSRomBaseL equ 0X0000
;GSRomBaseH equ 0Xc000
; ORG GSRomBaseL ;clear low ROM
; DEFS 0X4000,0XFF
; ORG GSRomBaseH ;clear high ROM
; DEFS 0X4000,0XFF
ORG GSRomBaseL
DI
JP INIT
;---patched
; DEFB 0X0A ;LOW (in BCD!)
; DEFB 0X01 ;HIGH (in BCD!)
DW VERS_BIN
;---
ROMCRC DW 0XE428 ;CRC from original rom, corrupted!?
ORG GSRomBaseL+0X0030
JP SGEN ;0X2030
ORG GSRomBaseL+0X0038
INT8 EX AF,AF'
PUSH DE
LD E,A
LD D,IXH
LD A,(DE)
INC D
LD A,(DE)
INC D
LD A,(DE)
INC D
LD A,(DE)
INC E
JR Z,INT8_
LD A,E
POP DE
EX AF,AF'
EI
RET
INT8_ JP QTDONE
ORG GSRomBaseL+0X0066
NMILP POP HL
LD A,L
OUT (ZXDATWR),A
NMILP2 IN A,(ZXSTAT)
RLCA
JR C,NMILP2
LD A,H
OUT (ZXDATWR),A
NMILP3 IN A,(ZXSTAT)
RLCA
JR C,NMILP3
JP NMILP
ORG GSRomBaseL+0X0080
DB "This is improved ROM Version 1.04 Beta. "
DB "Bugfixes by psb & Evgeny Muchkin, 2007.",0
ORG GSRomBaseL+0X0100
DB "General Sound (tm) ROM"
DB "Copyright 1997 Stinger"
DB "Version ",VERS_TXT," "
; LOW ROM INCLUDES
;INCLUDE "INIT_L.a80"
INIT DI
OUT (CLRCBIT),A
INIT_ XOR A
OUT (ZXDATWR),A
; LD L,A
; LD H,A
; LD BC,0X0004
; LD SP,0X0008
; JR INIT02
;INIT00
OUT (MPAG),A
; LD SP,0XC000
; LD C,0X04
; DEC A
;INIT01 POP DE
; ADD HL,DE
; POP DE
; ADD HL,DE
; POP DE
; ADD HL,DE
; POP DE
; ADD HL,DE
;INIT02 POP DE
; ADD HL,DE
; POP DE
; ADD HL,DE
; POP DE
; ADD HL,DE
; POP DE
; ADD HL,DE
; DJNZ INIT01
; DEC C
; JR NZ,INIT01
; OR A
; JR Z,INIT00
; LD DE,(ROMCRC)
; SBC HL,DE
; LD HL,RAMPG
;---patched
; LD A,2
;CREATE_LIST_PAGE
; LD (HL),A
; INC HL
; INC A
; CP 0X40
; JR NZ,CREATE_LIST_PAGE
; LD (HL),1
; INC HL
; LD (HL),0
LD HL,0X8000
LD A,0X7F
OUT (MPAG),A
LD (HL),0XAA
LD A,0X3F
OUT (MPAG),A
LD (HL),0X55
LD A,0X7F
OUT (MPAG),A
LD A,(HL)
CP 0XAA
LD A,0X7E ;КОЛИЧЕСТВО СТРАНИЦ ДЛЯ 4 МЕГАБАЙТНОЙ NEOGS
JR Z,CP_RAMPAGES
LD A,0X3E ;КОЛИЧЕСТВО СТРАНИЦ ДЛЯ 2 МЕГАБАЙТНОЙ NEOGS
CP_RAMPAGES LD (NUMPG),A
OUT (ZXDATWR),A
ADD A,2
LD B,A
LD HL,RAMPG
LD A,2
CREATE_TABL LD (HL),A
INC HL
INC A
CP B
JR C,CREATE_TABL
XOR A
OUT (MPAG),A
LD (HL),1
INC HL
LD (HL),A
LD SP,0X8000
JP Patch5i3
SET_SIZE_MOD LD A,E
INC A
LD (SIZE_MOD),A ;РАЗМЕР ЗАГРЖЕННОГО ФАЙЛА В 32К СТРАНИЦАХ
JP PLAYMD
SET7XOR XOR A
OUT (VOL1),A
OUT (VOL2),A
OUT (VOL3),A
OUT (VOL4),A
OUT (VOL5),A
OUT (VOL6),A
OUT (VOL7),A
OUT (VOL8),A
OUT (VOL8),A
PUSH HL
LD HL,0
ADD HL,SP
EXX
LD A,0X10
LD SP,0X7F00
LD BC,0XA97E
LD DE,0X2C77
SPEDI1 REPT 16
PUSH DE
PUSH BC
ENDM
DEC A
JP NZ,SPEDI1
LD HL,SPEDI2
LD DE,0X7F00
LD BC,ESPEDI2-SPEDI2
LDIR
EXX
LD SP,HL
POP HL
LD A,L
EXX
LD L,A
LD H,0
LD BC,0X7B00
ADD HL,HL
ADD HL,HL
ADD HL,BC
EX (SP),HL
EXX
LD A,(SIZE_MOD)
LD B,A
LD C,0X80
RET
SPEDI2 INC H
JP NZ,0X7B00
INC E
LD A,(DE)
LD H,0X80
OUT (MPAG),A
DEC B
JP NZ,0X7B00
JP END7XOR
ESPEDI2
END7XOR EXX
LD HL,0
ADD HL,SP
LD SP,0X8000
LD DE,0X8080
LD B,0X28
E7X1 REPT 16
PUSH DE
ENDM
DJNZ E7X1
LD SP,HL
EXX
JP NOCONV
DUPL GSRomBaseL+0X269-$,0
; ORG GSRomBaseL+0X269
;INCLUDE "COM_L.a80"
COMHZ OUT (CLRCBIT),A
COMINT LD SP,ISTACK ;0X026B
COMINT_ IN A,(ZXSTAT)
RRCA
JR C,COMINT1
LD A,(PROCESS) ;0X0273
OR A
JR Z,COMINT_
LD A,(BUSY)
OR A
JR NZ,COMINT_
IN A,(ZXSTAT)
RRCA
JR C,COMINT1
LD A,0XFF
LD (INGEN),A
PUSH DE
CALL ENGINE
POP DE
XOR A
LD (INGEN),A
JP COMINT_
COMINT1 IN A,(ZXCMD)
CP 0X20
JR C,COMLOW
COMINT2 CP 0XF0
JR C,COMHIGH
SUB 0XD0
COMLOW ADD A,A
LD H,HIGH (COMTAB)
LD L,A
LD A,(HL)
INC L
LD H,(HL)
LD L,A
JP (HL)
COMHIGH LD HL,COMINT_
PUSH HL
LD L,A
LD H,HIGH (COMTABH)
XOR A
LD (CPAGE),A
OUT (MPAG),A
LD A,(HL)
INC H
LD H,(HL)
LD L,A
JP (HL)
WTDTL IN A,(ZXSTAT)
AND 0X81
JR Z,WTDTL
IN A,(ZXDATRD)
JP P,COMINT1
JP (IY)
WTDTG IN A,(ZXSTAT)
OR A
JP P,WTDTG
IN A,(ZXDATRD)
JP (IY)
COMM5__ LD A,(IY+CHLPBP)
CP -1
JP Z,COMM5
LD (IY+CHCURP),A
LD L,(IY+CHLPBL)
LD H,(IY+CHLPBH)
LD (IY+CHCURL),L
LD (IY+CHCURH),H
JP COMM5
align 256
COMTAB DEFW COM00,COM01,COM02,COM03,COM04,COM05,COM06,COM07 ;0365,036C,0381,0390,039E,03A8,03B8,03D0
DEFW COM08,COM09,COM0A,COM0B,COM0C,COM0D,COM0E,COM0F ;0360,03F3,0407,041F,0444,046E,0497,04AE
DEFW COM10,COM11,COM12,COM13,COM14,COM15,COM16,COM17 ;0511,0522,052E,0537,0545,0594,05FE,0617
DEFW COM18,COM19,COM1A,COM1B,COM1C,COM1D,COM1E,COM1F ;062A,063A,0642,064A,0650,0662,0360,0360
DEFW COMF0,COMF1,COMF2,COMF3,COMF4,COMF5,COMF6,COMF7 ;066F,0360,0360,0679,067E,0683,069B,06B0
DEFW COMF8,COMF9,COMFA,COMFB,COMFC,COMFD,COMFE,COMFF ;0360,0360,06B9,0360,0360,0360,0360,0360
COMZ OUT (CLRCBIT),A
JP COMINT_
COM1E EQU COMZ
COM1F EQU COMZ
COMF1 EQU COMZ
COMF2 EQU COMZ
COMF8 EQU COMZ
COMF9 EQU COMZ
COMFB EQU COMZ
COMFC EQU COMZ
COMFD EQU COMZ
COMFE EQU COMZ
COMFF EQU COMZ
;Reset flags
;Сбрасывает флаги Data bit и Command bit.
COM00 IN A,(ZXDATRD)
OUT (CLRCBIT),A
JP COMINT_
;Set silence (*)
;Выводит в ЦАПы всех каналов 0X80. По сути устанавливает тишину.
COM01 OUT (CLRCBIT),A
LD A,0X80
LD HL,DAC0
LD (HL),A
LD B,(HL)
INC H
LD (HL),A
LD B,(HL)
INC H
LD (HL),A
LD B,(HL)
INC H
LD (HL),A
LD B,(HL)
JP COMINT_
;Set low volume (*)
;Устанавливает громкостx ЦАПов всех каналов в ноль.
COM02 OUT (CLRCBIT),A
LD A,0X3F
OUT (VOL1),A
OUT (VOL2),A
OUT (VOL3),A
OUT (VOL4),A
JP COMINT_
;Set high volume (*)
;Устанавливает громкость ЦАПов всех каналов в максимум.
COM03 OUT (CLRCBIT),A
XOR A
OUT (VOL1),A
OUT (VOL2),A
OUT (VOL3),A
OUT (VOL4),A
JP COMINT_
;Set 'E' 3bits (*)
;Устанавливает в 'E' регистре GS 3 младших бита в соответствии с задан-
;ным значением (2 младших бита в сущности являются номером канала
;0X00-0X03).
COM04 IN A,(ZXDATRD)
OUT (CLRCBIT),A
AND 0X07
LD E,A
JP COMINT_
;Out volume port (*)
;Устанавливает громкость канала, номер которого содержится в 'E', в ука-
;занное значение. (Команда срабатывает при условии, что 'E' находится в
;пределах 0X00-0X03)
COM05 IN A,(ZXDATRD)
OUT (CLRCBIT),A
LD B,A
LD A,E
CP 0X04
JP NC,COMINT_
ADD A,VOL1
LD C,A
OUT (C),B
JP COMINT_
;Send to DAC (*)
;Выводит байт в ЦАП канала, указываемого по 'E'.
COM06 IN A,(ZXDATRD)
OUT (CLRCBIT),A
LD B,A
LD A,E
CP 0X04
JP NC,COMINT_
ADD A,HIGH (DAC0)
LD H,A
LD L,0X00
LD (HL),B
LD A,(HL)
JP COMINT_
;Send to DAC and to volume port (*)
;Выводит байт в ЦАП ('E') с заданной громкостью.
COM07 IN A,(ZXDATRD)
OUT (CLRCBIT),A
LD B,A
LD A,E
CP 0X04
JP NC,COMINT_
ADD A,HIGH (DAC0)
LD H,A
LD L,0X00
LD (HL),B
SUB HIGH (DAC0)
ADD A,VOL1
LD C,A
LD IY,COM07_1
JP WTDTL
COM07_1 OUT (C),A
LD A,(HL)
JP COMINT_
;то же что и команда 0X00
;Reset flags
;Сбрасывает флаги Data bit и Command bit.
COM08 EQU COMZ
;Sets one's byte volume. (*)
;Установка громкости канала, номер которого задан в 2х старших битах.
COM09 IN A,(ZXDATRD)
OUT (CLRCBIT),A
LD B,A
RLCA
RLCA
AND 0X03
ADD A,VOL1
LD C,A
LD A,B
AND 0X3F
OUT (C),A
JP COMINT_
;DAC output (*)
;Еще один непосредственный вывод в ЦАП.
COM0A IN A,(ZXDATRD)
OUT (CLRCBIT),A
LD B,A
LD IY,COM0A_1
JP WTDTL
COM0A_1 AND 0X03
ADD A,HIGH (DAC0)
LD H,A
LD L,0X00
LD (HL),B
LD A,(HL)
JP COMINT_
;DAC and Volume output (*)
;И наконец последний вывод в ЦАП с установкой громкости.
COM0B IN A,(ZXDATRD)
OUT (CLRCBIT),A
LD C,A
LD IY,COM0B_1
JP WTDTL
COM0B_1 LD B,A
RLCA
RLCA
AND 0X03
ADD A,HIGH (DAC0)
LD H,A
LD L,0X00
LD (HL),C
SUB HIGH (DAC0)
ADD A,VOL1
LD C,A
LD A,B
AND 0X3F
OUT (C),A
LD A,(HL)
JP COMINT_
;Call SounDrive Covox mode (*)
;Вызывает режим четырехканального Ковокса, последовательно копирует ре-
;гистр данных по каналам. Выход из режима автоматически после вывода
;четвертого байта.
COM0C IN A,(ZXDATRD)
OUT (CLRCBIT),A
LD HL,DAC0
LD (HL),A
LD A,(HL)
INC H
LD IY,COM0C_1
JP WTDTL
COM0C_1 LD (HL),A
LD A,(HL)
INC H
LD IY,COM0C_2
JP WTDTL
COM0C_2 LD (HL),A
LD A,(HL)
INC H
LD IY,COM0C_3
JP WTDTL
COM0C_3 LD (HL),A
LD A,(HL)
JP COMINT_
;Call Ultravox mode (*)
;Вызывает режим универсального Ковокса, последовательно копирует ре-
;гистр данных по каналам, число которых регулируется (1-4).В отличие от
;предыдущего варианта синхронизация не производится. Выход также произ-
;водится автоматически по записи последнего байта.
COM0D IN A,(ZXDATRD)
OUT (CLRCBIT),A
AND 0X0F
JP Z,COMINT_
RLCA
RLCA
RLCA
RLCA
LD B,A
LD HL,DAC0
LD IY,COM0D_3
JP COM0D_2
COM0D_3 LD (HL),A
LD A,(HL)
INC H
JP COM0D_2
COM0D_1 JP Z,COMINT_
INC H
COM0D_2 SLA B
JR NC,COM0D_1
JP WTDTL
;Go to LPT Covox mode
;Переходит в режим одноканального Ковокса, напрямую копирует регистр
;данных в ЦАПы двух (правого и левого) каналов. Выход из этого режима -
;запись 0X00 в регистр команд.
COM0E OUT (CLRCBIT),A
LD HL,DAC0
LD BC,DAC2
COM0E_1 IN A,(ZXDATRD)
LD (HL),A
LD (BC),A
LD A,(HL)
LD A,(BC)
IN A,(ZXSTAT)
RRCA
JP NC,COM0E_1
JP COMINT_
;Go in Profi Covox mode (*)
;Переходит в режим двухканального Ковокса, напрямую копирует регистр
;данных в ЦАПы одного канала, а регистр каманд в ЦАПы второго канала.
;Выход из этого режима - запись 0X4Е в регистр данных, затем последова-
;тельно 0X0F и 0XAA в регистр команд.
COM0F IN A,(ZXDATRD)
OUT (CLRCBIT),A
CP "Y"
JP NZ,COMINT_
LD HL,DAC0
LD DE,DAC2
COM0F_1 IN A,(ZXDATRD)
LD (HL),A
IN A,(ZXCMD)
LD (DE),A
LD A,(HL)
LD A,(DE)
IN A,(ZXSTAT)
OR A
JP M,COM0F_1
LD B,0X00
OUT (CLRCBIT),A
COM0F_2 IN A,(ZXSTAT)
AND 0X81
JR NZ,COM0F_1
DJNZ COM0F_2
COM0F_3 IN A,(ZXSTAT)
AND 0X81
JR Z,COM0F_3
CP 0X80
JR NZ,COM0F_1
IN A,(ZXDATRD)
CP "N"
JP NZ,COM0F_1
COM0F_4 IN A,(ZXSTAT)
AND 0X81
JR Z,COM0F_4
CP 0X01
JR NZ,COM0F_1
IN A,(ZXCMD)
CP 0X0F
JP NZ,COM0F_1
OUT (CLRCBIT),A
COM0F_5 IN A,(ZXSTAT)
AND 0X81
JR Z,COM0F_5
CP 0X01
JR NZ,COM0F_1
IN A,(ZXCMD)
CP 0XAA
JP NZ,COM0F_1
OUT (CLRCBIT),A
JP COMINT_
;Out to any port (*)
;Выводит байт вo внутренний порт GS (0X00-0X09).
COM10 IN A,(ZXDATRD)
OUT (CLRCBIT),A
LD C,A
LD IY,COM10_1
JP WTDTL
COM10_1 OUT (C),A
JP COMINT_
;In from any port (*)
;читает байт из внутреннего порта GS (0X00-0X09).
COM11 IN A,(ZXDATRD)
LD C,A
IN A,(C)
OUT (ZXDATWR),A
OUT (CLRCBIT),A
JP COMINT_
;OUT to 0 port (*)
;Выводит байт в порт кофигурации GS (0X00).
COM12 IN A,(ZXDATRD)
OUT (CLRCBIT),A
OUT (MPAG),A
JP COMINT_
;Jump to Address (*)
;Передает управление по заданному адресу.
COM13 IN A,(ZXDATRD)
OUT (CLRCBIT),A
LD L,A
LD IY,COM13_1
JP WTDTL
COM13_1 LD H,A
JP (HL)
;Load memory block (*)
;Загрузка блока кодов по указанному адресу с заданной длиной.
; 70+27*WAIT PER LOOP : 171K,123K,96K PER SECOND MAX
COM14 IN A,(ZXDATRD)
OUT (CLRCBIT),A
CPL
LD C,A
LD HL,WTDTL
LD IY,COM14_1
JP (HL)
COM14_1 CPL
LD B,A
INC BC
LD IY,COM14_2
JP (HL)
COM14_2 LD E,A
LD IY,COM14_3
JP (HL)
COM14_3 LD D,A
LD A,B
OR C
JP Z,COMINT_
LD IXL,B
LD B,0X81
BIT 0,C
JR NZ,COM14_7
COM14_6 IN A,(ZXSTAT)
AND B
JR Z,COM14_6
IN A,(ZXDATRD)
JP P,COMINT1
LD (DE),A
INC DE
INC C
COM14_7 IN A,(ZXSTAT)
AND B
JR Z,COM14_7
IN A,(ZXDATRD)
JP P,COMINT1
LD (DE),A
INC DE
INC C
JP NZ,COM14_6
INC IXL
JP NZ,COM14_6
JP COMINT_
;Get memory block (*)
;Выгрузка блока кодов по указанному адресу с заданной длиной.
COM15 IN A,(ZXDATRD) ;ошибка-не сбрасывается команд бит
CPL
LD C,A
LD IY,COM15_1
JP WTDTG
COM15_1 CPL
LD B,A
INC BC
LD IY,COM15_2
JP WTDTG
COM15_2 LD E,A
LD IY,COM15_3
JP WTDTG
COM15_3 LD D,A
LD A,B
OR C
JP Z,COMINT_
LD IXL,B
LD B,0X81
LD A,(DE)
INC DE
OUT (ZXDATWR),A
OUT (CLRCBIT),A
LD HL,COM15_4
INC C
JP NZ,COM15_4
INC IXL
JP Z,COMINT_
COM15_4 IN A,(ZXSTAT)
AND B
JR Z,COM15_5
JP P,COMINT1
IN A,(ZXSTAT)
AND B
JR Z,COM15_5
JP P,COMINT1
IN A,(ZXSTAT)
AND B
JR Z,COM15_5
JP P,COMINT1
IN A,(ZXSTAT)
AND B
JR Z,COM15_5
JP P,COMINT1
JP (HL)
COM15_5 LD A,(DE)
OUT (ZXDATWR),A
INC DE
INC C
JP NZ,COM15_4
COM15_7 INC IXL
JP NZ,COM15_4
JP COMINT_
;Poke to address (*)
;Записывает единичный байт по указанному адресу.
COM16 IN A,(ZXDATRD)
OUT (CLRCBIT),A
LD B,A
LD IY,COM16_1
JP WTDTL
COM16_1 LD L,A
LD IY,COM16_2
JP WTDTL
COM16_2 LD H,A
LD (HL),B
JP COMINT_
;Peek from address (*)
;Считывает единичный байт из указанного адреса.
COM17 IN A,(ZXDATRD)
LD L,A
LD IY,COM17_1
JP WTDTL
COM17_1 LD H,A
LD A,(HL)
OUT (ZXDATWR),A
OUT (CLRCBIT),A
JP COMINT_
;Load DE Pair (*)
;Загружает регистовую пару DE (относящуюся к GS, не путать с одноимен-
;ной парой Main CPU) указанным словом.
COM18 IN A,(ZXDATRD)
OUT (CLRCBIT),A
LD E,A
LD IY,COM18_1
JP WTDTL
COM18_1 LD D,A
JP COMINT_
;Poke to (DE) address (*)
;Записывает байт по адресу указанному в DE.
COM19 IN A,(ZXDATRD)
OUT (CLRCBIT),A
LD (DE),A
JP COMINT_
;Peek from (DE) address (*)
;Считывает содержимое адреса, указываемого по DE.
COM1A LD A,(DE)
OUT (ZXDATWR),A
OUT (CLRCBIT),A
JP COMINT_
;Increment of DE Pair (*)
;Увеличивает пару DE на единичку.
COM1B OUT (CLRCBIT),A
INC DE
JP COMINT_
;Poke to (0X20XX) address (*)
;Записывает байт по адресу, старший байт которого равен 0X20.
COM1C IN A,(ZXDATRD)
OUT (CLRCBIT),A
LD L,A
LD IY,COM1C_1
JP WTDTL
COM1C_1 LD H,0X20
LD (HL),A
JP COMINT_
;Peek from (0X20XX) address (*)
;читает байт с адреса, старший байт которого равен 0X20.
COM1D IN A,(ZXDATRD)
LD L,A
LD H,0X20
LD A,(HL)
OUT (ZXDATWR),A
OUT (CLRCBIT),A
JP COMINT_
COMF0 LD A,(ERRCODE) ; GET STATUS
OUT (ZXDATWR),A
OUT (CLRCBIT),A
JP COMINT_
;Warm restart
;Сбрасывает полностью GS, но пропускает этапы определения количества
;страниц памяти и их провеки, что очень сильно ускоряет процесс инициа-
;лизации.
COMF3 OUT (CLRCBIT),A
JP INITVAR
;Cold restart
;Полный перезапуск GS со всеми проверками. По сути, JP 0X0000.
COMF4 OUT (CLRCBIT),A
JP 0X0000
;Busy on
;Устанавливает флаг занятости в 0XFF
COMF5 OUT (CLRCBIT),A
LD A,IXH
AND 0X80
JP NZ,COMF5_1
LD A,0XFF
LD (BUSY),A
JP COMINT_
COMF5_1 OR 0X40
LD IXH,A
JP COMINT_
;Busy off
;Устанавливает флаг занятости в 0X00
COMF6 OUT (CLRCBIT),A
LD A,IXH
AND 0X80
JP NZ,COMF6_1
XOR A
LD (BUSY),A
JP COMINT_
COMF6_1 LD IXH,A
JP COMINT_
;Get IXH Register (*)
;Получить содержимое регистра IXH (GS)
;IXH участвует в обработке флага Busy.
COMF7 LD A,IXH
OUT (ZXDATWR),A
OUT (CLRCBIT),A
JP COMINT_
;Out zero_to_zero
;Вывод нуля в нулевой (конфигурационный) порт GS. Делает приостановку
;звучания музыки до следующего чтения из к.л. порта.
COMFA OUT (CLRCBIT),A
XOR A
LD (CPAGE),A
OUT (MPAG),A
JP TCOM
;INCLUDE "MEM_L.a80"
;MEMORY MOVEMENT MODULE - LOW PART
align 256
LDITAB REPT 0X100
DB 0XED,0XA0
ENDM
RET C
LD A,(SYSTEM)
LD (CPAGE),A
OUT (MPAG),A
RET
MLDI NEG
ADD A,A
LD IYL,A
LD A,HIGH (LDITAB)
ADC A,0X00
LD IYH,A
LD A,(SDPAGE)
LD (CPAGE),A
OUT (MPAG),A
JP (IY)
TLDI NEG
ADD A,A
LD IYL,A
LD A,HIGH (LDITAB)
ADC A,0X00
LD IYH,A
SCF
JP (IY)
MLDD NEG
ADD A,A
LD IYL,A
LD A,HIGH (LDDTAB)
ADC A,0X00
LD IYH,A
LD A,(SDPAGE)
LD (CPAGE),A
OUT (MPAG),A
JP (IY)
align 256
LDDTAB REPT 0X100
DB 0XED,0XA8
ENDM
LD A,(SYSTEM)
LD (CPAGE),A
OUT (MPAG),A
RET
;INCLUDE "LOAD_L.a80"
; RET B,DE - OLD CURADR
;0X0C09
LOAD LD B,0X81
LD HL,(CURADR)
LD A,(CURADR+2)
SCF
RL H
RLA
RRC H
LD E,A
LD D,HIGH (RAMPG)
LOAD_ LD A,(DE)
OR A
JP Z,LOADWT3
LD (CPAGE),A
OUT (MPAG),A
LD A,(NUMPG)
CP E
JR NZ,LOADWT
LD A,H
CP 0XC0
JR C,LOADWT2
JP LOADWT3
LOADWT IN A,(ZXSTAT)
AND B
JR Z,LOADWT
RRCA
IN A,(ZXDATRD)
JR C,LOADCM
ADD A,C
LD (HL),A
INC L
JP NZ,LOADWT
INC H
JP NZ,LOADWT
INC E
LD HL,0X8000
JP LOAD_
LOADCM IN A,(ZXCMD)
CP 0XF3
JP Z,COMF3
CP 0XF4
JP Z,COMF4
OUT (CLRCBIT),A
CP 0XD2
JP Z,LOAD3
JP LOADWT
LOADWT2 IN A,(ZXSTAT)
AND B
JR Z,LOADWT2
RRCA
IN A,(ZXDATRD)
JR C,LOADCM2
LD (HL),A
INC L
JP NZ,LOADWT2
INC H
BIT 6,H
JP Z,LOADWT2
LOADWT3 IN A,(ZXSTAT)
AND B
JR Z,LOADWT3
RRCA
IN A,(ZXDATRD)
JP NC,LOADWT3
IN A,(ZXCMD)
CP 0XF3
JP Z,COMF3
CP 0XF4
JP Z,COMF4
OUT (CLRCBIT),A
CP 0XD2
JR Z,LOAD3
JP LOADWT3
LOADCM2 IN A,(ZXCMD)
CP 0XF3
JP Z,COMF3
CP 0XF4
JP Z,COMF4
OUT (CLRCBIT),A
CP 0XD2
JR Z,LOAD3
JP LOADWT2
LOAD3 LD A,E
RL H
SRL A
RR H
LD (CURADR),HL
LD (CURADR+2),A
LD (MEMBOT),HL
LD (MEMBOT+2),A
EX AF,AF' ;LD E,A
XOR A
LD (CPAGE),A
OUT (MPAG),A
EX AF,AF' ;LD A,E
RET
;INCLUDE "PLAY.a80"
PLAYMD LD A,(RAMPG) ;0X0CC9
OUT (MPAG),A
LD IY,CHANS
LD DE,CHANLEN
LD B,0X04
RDLP1
;---patched
CALL Patch4
NOP
;---
LD (IY+CHCNTH),0X00
LD (IY+CHOLDV),0X80
LD (IY+CHSTAT),0X01
LD (IY+CHLPCNT),0X00
LD (IY+CHPATPS),0X00
LD (IY+CHTRMPS),0X00
LD (IY+CHVIBPS),0X00
LD (IY+CHVOL),0X40
LD (IY+CHMVOL),0X40
LD (IY+CHINS),0X00
LD (IY+CHSMP),0X00
LD (IY+CHPAN),0X80
LD (IY+CHEPAN),0X20
LD (IY+CHEVOL),0X40
LD (IY+CHFADVL),0XFF
LD (IY+CHFADVH),0XFF
ADD IY,DE
DJNZ RDLP1
LD IXL,0XFF
LD A,(0X8000+1080) ;определение сигнатуры заголовка
CP "M"
JR Z,TTY1
CP "4"
JR Z,TTY1
CP "F"
JR Z,TTY1
LD IXL,0X00
JP TTY0
TTY1 LD A,(0X8000+1081)
CP "."
JR Z,TTY2
CP "L"
JR Z,TTY2
CP "!"
JR Z,TTY2
CP "C"
JR Z,TTY2
LD IXL,0X00
JP TTY0
TTY2 LD A,(0X8000+1082)
CP "K"
JR Z,TTY0
CP "T"
JR Z,TTY0
CP "H"
JR Z,TTY0
LD IXL,0X00
TTY0 LD A,IXL
LD (MODTP),A
LD HL,0X8000+952
OR A
;---patched
LD DE,0X0000+1084
JR NZ,TTY10
LD DE,0X0000+600 ;размер заголовка файла
LD HL,0X8000+472 ;смещение до таблицы патернов
TTY10 LD B,0X80 ;сканирование таблицы патернов
SUB A
FDF2 CP (HL)
JR NC,FDF
LD A,(HL)
FDF INC HL
DJNZ FDF2
INC A
LD (PATTS),A ;количество патернов
LD L,A
LD H,B
ADD HL,HL
ADD HL,HL ;HL=кол-во патернов*4
LD A,H
LD H,L
LD L,B
ADD HL,DE
ADC A,B
DB 0XCB,0X34;SLI H
RLA
RRC H
LD E,A
LD (SMPS),HL
LD (SMPS+2),A
DUPL 3,0
;---
LD A,IXL
OR A
LD BC,0X8000+950
JR NZ,TTT11
LD BC,0X8000+470
TTT11 LD A,(BC)
DEC A
LD (MTSNGSZ),A
INC BC
LD A,(BC)
LD (MTSNGLP),A
LD IX,0X5400
LD IY,0X8000+20 ;начало сэмплов
LD B,31
LD C,E
RDLP3 PUSH BC
LD (IX+SMPBEG),C
LD (IX+SMPBEG+1),L
LD (IX+SMPBEG+2),H
LD A,(IY+28)
OR A
JR NZ,LPL
LD A,(IY+29)
CP 0X02
JP C,NLPL
LPL PUSH HL
PUSH BC
LD L,(IY+27)
LD H,(IY+26)
LD E,(IY+23)
LD D,(IY+22)
SBC HL,DE
POP BC
POP HL
JP NC,NLPL
PUSH HL
PUSH BC
LD E,(IY+27)
LD D,(IY+26)
EX DE,HL
ADD HL,HL
EX DE,HL
LD B,0
RL B
SRL C
RL H
RRC H
ADD HL,DE
LD A,C
ADC A,B
LD C,A
DB 0XCB,0X34;SLI H
RL C
RRC H
LD (IX+SMPLPB),C
LD (IX+SMPLPB+1),L
LD (IX+SMPLPB+2),H
SRL C
RL H
RRC H
LD E,(IY+29)
LD D,(IY+28)
EX DE,HL
ADD HL,HL
EX DE,HL
LD B,0
RL B
ADD HL,DE
LD A,C
ADC A,B
LD C,A
DB 0XCB,0X34;SLI H
RL C
RRC H
LD (IX+SMPLPE),C
LD (IX+SMPLPE+1),L
LD (IX+SMPLPE+2),H
POP BC
POP HL
LD E,(IY+23)
LD D,(IY+22)
EX DE,HL
ADD HL,HL
EX DE,HL
LD B,0X00
RL B
SRL C
RL H
RRC H
ADD HL,DE
LD A,C
ADC A,B
LD C,A
DB 0XCB,0X34;SLI H
RL C
RRC H
JP LPL2
LD A,(IX+SMPLPE)
CP C
JR C,LPL2
JR NZ,LPL1
LD A,(IX+SMPLPE+2)
CP H
JR C,LPL2
JR NZ,LPL1
LD A,(IX+SMPLPE+1)
CP L
JR C,LPL2
LPL1 LD A,(IX+SMPEND)
LD (IX+SMPLPE),A
LD A,(IX+SMPEND+1)
LD (IX+SMPLPE+1),A
LD A,(IX+SMPEND+2)
LD (IX+SMPLPE+2),A
JP LPCNT
LPL2 LD A,(IX+SMPLPE)
LD (IX+SMPEND),A
LD A,(IX+SMPLPE+1)
LD (IX+SMPEND+1),A
LD A,(IX+SMPLPE+2)
LD (IX+SMPEND+2),A
JP LPCNT
NLPL LD (IX+SMPLPB),0XFF
LD E,(IY+23)
LD D,(IY+22)
EX DE,HL
ADD HL,HL
EX DE,HL
LD B,0X00
RL B
SRL C
RL H
RRC H
ADD HL,DE
LD A,C
ADC A,B
LD C,A
DB 0XCB,0X34;SLI H
RL C
RRC H
RDLP2 LD (IX+SMPEND+1),L
LD (IX+SMPEND+2),H
LD (IX+SMPEND),C
LPCNT LD A,(IY+24)
ADD A,A
LD (IX+SMPFT),A
LD A,(IY+25)
LD (IX+SMPVOL),A
LD DE,0X0010
ADD IX,DE
LD DE,30
ADD IY,DE
LD A,C
POP BC
LD C,A
DEC B
JP NZ,RDLP3
LD HL,CONVERT
LD A,(HL)
OR A
JR NZ,NOCONV
LD (HL),0XFF
LD HL,(SMPS)
LD A,(SMPS+2)
LD E,A
LD D,HIGH (RAMPG)
LD A,(NUMPG)
SUB E
LD B,A
SMPMD2 LD A,(DE)
OUT (MPAG),A
CALL SET7XOR ;КОНВЕРСИЯ ЗАГРУЖЕННОГО MOD ФАЙЛА
JR SMPMD4
;SMPMD1 LD A,(HL) ;начало ADD A,0X80
; ADD A,0X80
; LD (HL),A
; INC L
; JP NZ,SMPMD1
; INC H
; JP NZ,SMPMD1
; LD H,0X80
; INC E
; DJNZ SMPMD2
; LD A,(DE)
; OUT (MPAG),A
; OR A
; JR Z,SMPMD4
;SMPMD3 LD A,(HL)
; ADD A,0X80
; LD (HL),A
; INC L
; JP NZ,SMPMD3
; INC H
; BIT 6,H
; JP Z,SMPMD3
DUPL 0XF20-$,0XFF
SMPMD4
NOCONV XOR A
LD (CPAGE),A
OUT (MPAG),A
RET
INITPAT LD A,(MTSNGPS)
LD E,A
LD D,0
LD A,(MODTP)
INC A
LD HL,0X8000+952
JR Z,TTT13
LD HL,0X8000+472
TTT13 ADD HL,DE
LD A,(RAMPG)
OUT (MPAG),A
;---patched
JP Patch11
;---
LD E,D
LD D,A
LD A,(MODTP)
INC A
LD HL,0X0000+1084
JR Z,TTT15
LD HL,0X0000+600
TTT15 XOR A
LD (CPAGE),A
OUT (MPAG),A
ADD HL,DE
LD DE,0X5000
LD BC,0X400
CALL LDMEM
XOR A
OUT (MPAG),A
RET
;INCLUDE "QUANTUM.a80"
;**************************************************************
;* QUANTUM PROCEDURE *
;**************************************************************
QUANTUM LD A,(FXCHNS)
CPL
LD C,A
LD A,(GSCHNS)
AND C
LD C,A
LD IY,CHANS ;CHANNELS
LD A,(MTSTAT)
AND 0XC0
JR NZ,L221
L204 LD A,C
AND (IY+CHRDR)
JR Z,L205
BIT 7,(IY+CHSTAT)
JR Z,L205
PUSH BC
CALL GEN
POP BC
L205 LD A,IYL
ADD A,0X40
LD IYL,A
JP NC,L204
JP L221
L221 XOR A
LD (CPAGE),A
OUT (MPAG),A
LD HL,VOLRQTB
LD A,(QTFREE)
ADD A,LOW (VOLTAB)
LD E,A
LD D,HIGH (VOLTAB)
LDI
LDI
LDI
LDI
LD HL,(QTFREE)
LD B,L
INC L
PUSH BC
PUSH HL
LD A,(CHANNEL)
AND 0X0F
LD HL,INTTB
ADD A,A
ADD A,L
LD L,A
LD A,H
ADC A,0X00
LD H,A
LD C,(HL)
INC HL
LD B,(HL)
LD A,(CHANNEL)
AND 0X0F
LD HL,INTOFF
ADD A,L
LD L,A
LD A,H
ADC A,0X00
LD H,A
LD A,(QTFREE)
ADD A,0X60
ADD A,(HL)
POP HL
LD (HL),A
INC L
LD (HL),C
INC L
LD (HL),B
POP BC
INC L
RES 5,L
LD (QTFREE),HL
LD L,B
LD A,(SGENOFF)
LD (HL),A
LD A,(PLAYING)
OR A
JP NZ,L224
LD (QTBUSY),HL
CALL QTPLAY
L224 LD A,(SGENOFF)
NEG
LD C,A
LD B,0
LD A,(MTSTAT)
AND 0XC0
RET NZ
LD HL,(TCKLEFT)
OR A
SBC HL,BC
JR Z,EFXINT
LD (TCKLEFT),HL
RET
EFXINT LD A,(MODULE)
OR A
RET Z
LD HL,(TICKLEN)
LD (TCKLEFT),HL
XOR A
LD (CPAGE),A
OUT (MPAG),A
LD IY,CHANS
LD B,0X04
LD A,(MTCOUNT)
INC A
LD (MTCOUNT),A
LD HL,MTSPEED
CP (HL)
JR C,EFXNONT ;NO NEW NOTE
XOR A
LD (MTCOUNT),A
LD A,(MTPDT2)
OR A
JR Z,EFXGTNT ;GET NEW NOTE
CALL EFXNONT
JP EFXSKIP
EFXNONT LD IY,CHANS
LD B,0X04
EFXNON1 PUSH BC
LD A,(IY+CHCOM)
OR (IY+CHPARM)
JR NZ,EFXNON2
CALL FXNOP
JP EFXNON3
EFXNON2 CALL FXCHK_
EFXNON3 LD BC,CHANLEN
ADD IY,BC
POP BC
DJNZ EFXNON1
RET
EFXNOP LD L,(IY+CHPERL) ;;not used!
LD H,(IY+CHPERL) ;;bug!
CALL EFXCNV
LD (IY+CHFRQL),L
LD (IY+CHFRQH),H
RET
EFXGTNT
;LD IY,CHANS
;---patched
JP Patch3
DB 0X46
;---
XOR A
LD (CPAGE),A
OUT (MPAG),A
LD (CURCHN),A
COMM1 XOR A
LD (CPAGE),A
OUT (MPAG),A
CALL GETROWS
LD (IY+CHCOM),B
LD (IY+CHPARM),C
LD A,E
OR A
JR Z,COMM2
LD (IY+CHINS),E
PUSH DE
PUSH BC
CALL EFXNEWI
POP BC
POP DE
COMM2 LD A,D
CP 0X7F
JP Z,COMM5
LD A,B
CP 0X03
JP Z,COMM4
CP 0X05
JP Z,COMM4
CP 0X0E
JR NZ,COMM3
LD A,C
AND 0XF0
CP 0X50
JR Z,COMM5_
LD (IY+CHNOTE),D
LD (IY+CHREAL),D
CP 0XD0
JR Z,COMM3__
JP COMM3
COMM5_ LD A,C
AND 0X0F
SLA A
LD (IY+CHFINE),A
COMM3 LD (IY+CHNOTE),D
LD (IY+CHREAL),D
CALL GETSMP
COMM3__ LD E,(IY+CHNOTE)
CALL GETPER
LD (IY+CHPERL),L
LD (IY+CHPERH),H
LD E,(IY+CHNOTE)
CALL GETFRQ
LD (IY+CHFRQL),L
LD (IY+CHFRQH),H
LD A,(IY+CHCOM)
CP 0X09
JP NZ,COMM5
LD A,(IY+CHPARM)
OR A
JR NZ,FX9_
LD A,(IY+CHOFFST)
FX9_ LD (IY+CHOFFST),A
LD H,A
LD L,0X00
XOR A
ADC A,A
EX DE,HL
LD L,(IY+CHCURL)
LD H,(IY+CHCURH)
LD B,(IY+CHCURP)
RL H
SRL B
RR H
ADD HL,DE
ADC A,B
DB 0XCB,0X34;SLI H
RLA
RRC H
LD (IY+CHCURL),L
LD (IY+CHCURH),H
LD (IY+CHCURP),A
CP (IY+CHENDP)
JP C,COMM5
JR NZ,COMM3_
LD A,H
CP (IY+CHENDH)
JP C,COMM5
JR NZ,COMM3_
LD A,L
CP (IY+CHENDL)
JP C,COMM5
COMM3_ RES 7,(IY+CHSTAT)
JP COMM5__
COMM4 LD (IY+CHWNT),D
COMM5 XOR A
LD (CPAGE),A
OUT (MPAG),A
CALL FXCHK
COMM6 LD BC,CHANLEN
ADD IY,BC
LD A,(CURCHN)
INC A
LD (CURCHN),A
CP 0X04
JP NZ,COMM1
EFXSKIP LD HL,MTPATPS
INC (HL)
LD A,(MTPDT)
OR A
JR Z,EFXSKP2
LD (MTPDT2),A
XOR A
LD (MTPDT),A
EFXSKP2 LD A,(MTPDT2)
OR A
JR Z,EFXSKP3
DEC A
LD (MTPDT2),A
JR Z,EFXSKP3
DEC (HL)
EFXSKP3 LD A,(MTBRKFL)
OR A
JR Z,EFXSKP4
LD A,(MTBRKPS)
LD (HL),A
XOR A
LD (MTBRKPS),A
LD (MTBRKFL),A
JP EFXSKP5
EFXSKP4 LD A,(HL)
OR A
JR NZ,EFXSKP5
LD A,(MTPDT2)
OR A
JR Z,EFXSKP6
EFXSKP5 LD A,(MTROWS)
CP (HL)
JR NC,EFXSKPX
EFXSKP6 LD A,(MTBRKPS)
LD (MTPATPS),A
XOR A
LD (MTBRKPS),A
LD (MTJMPFL),A
LD HL,MTSNGPS
INC (HL)
JR Z,EFXSKP7
LD A,(MTSNGSZ)
CP (HL)
JP NC,INITPAT
EFXSKP7 LD A,(MTSNGSZ)
LD HL,MTSNGLP
CP (HL)
LD A,0X00
JR C,EFXSKP8
LD A,(HL)
EFXSKP8 LD (MTSNGPS),A
LD A,6
DUPL 3,0 ;LD (MTSPEED),A
LD HL,750
DUPL 3,0 ;LD (TICKLEN),HL
DUPL 3,0 ;LD (TCKLEFT),HL
;CALL STOPMOD
XOR A
LD (MTBRKPS),A
LD (MTJMPFL),A
LD (MTBRKFL),A
LD (MTPDT),A
LD (MTPDT2),A
JP INITPAT
EFXSKPX LD A,(MTJMPFL)
OR A
JP NZ,EFXSKP6
RET
GETSMP SET 7,(IY+CHSTAT)
LD A,(IY+CHINS)
OR A
JR Z,GETSMP2
DEC A
ADD A,A
ADD A,A
ADD A,A
ADD A,A
LD E,A
LD A,0X54
ADC A,0X00
LD D,A
LD A,(DE)
LD (IY+CHCURP),A
INC DE
LD A,(DE)
LD (IY+CHCURL),A
INC DE
LD A,(DE)
LD (IY+CHCURH),A
INC (IY+CHCURL)
CALL Z,GETSMP3
INC (IY+CHCURL)
CALL Z,GETSMP3
INC DE
LD A,(DE)
LD (IY+CHENDP),A
INC DE
LD A,(DE)
LD (IY+CHENDL),A
INC DE
LD A,(DE)
LD (IY+CHENDH),A
INC DE
INC DE
INC DE
LD A,(DE)
LD (IY+CHLPBP),A
INC DE
LD A,(DE)
LD (IY+CHLPBL),A
INC DE
LD A,(DE)
LD (IY+CHLPBH),A
INC DE
LD A,(DE)
LD (IY+CHLPEP),A
INC DE
LD A,(DE)
LD (IY+CHLPEL),A
INC DE
LD A,(DE)
LD (IY+CHLPEH),A
LD (IY+CHCNTL),0X00
LD (IY+CHCNTH),0X07
LD A,(IY+CHCURP)
CP (IY+CHENDP)
RET C
JP NZ,GETSMP2
LD A,(IY+CHCURH)
CP (IY+CHENDH)
RET C
JP NZ,GETSMP2
LD A,(IY+CHCURL)
CP (IY+CHENDL)
RET C
GETSMP2 RES 7,(IY+CHSTAT)
RET
GETSMP3 INC (IY+CHCURH)
RET NZ
LD (IY+CHCURH),0X80
INC (IY+CHCURP)
RET
EFXNEWI LD A,(IY+CHINS)
DEC A
ADD A,A
ADD A,A
ADD A,A
ADD A,A
LD E,A
LD A,0X54
ADC A,0X00
LD D,A
INC DE
INC DE
INC DE
INC DE
INC DE
INC DE
LD A,(DE)
LD (IY+CHFINE),A
INC DE
LD A,(DE)
CP 0X40
JR C,GETSMP1
LD A,0X40
GETSMP1 LD (IY+CHVOL),A
CP (IY+CHMVOL)
LD (IY+CHMVOL),A
RET Z
SET 0,(IY+CHSTAT)
RET
GETROWS LD A,(MTPATPS)
AND 0X3F
ADD A,A
ADD A,A
LD L,A
LD H,0X00
ADD HL,HL
ADD HL,HL
LD A,(CURCHN)
ADD A,A
ADD A,A
ADD A,L
LD L,A
LD A,H
ADC A,0X50
LD H,A
LD A,(HL)
AND 0X10
PUSH AF
LD A,(HL)
AND 0X0F
LD D,A
INC HL
LD E,(HL)
OR E
LD A,0X7F
JR Z,GETRWS2
PUSH HL
CALL NOTEID
POP HL
GETRWS2 INC HL
POP BC
LD D,A
LD A,(HL)
AND 0XF0
RRCA
RRCA
RRCA
RRCA
OR B
LD E,A
LD A,(HL)
AND 0X0F
LD B,A
INC HL
LD C,(HL)
RET
;INCLUDE "INTTST.a80"
;***********************************************************
;* INTERRUPT HANDLING PROCEDURES *
;***********************************************************
align 256
INTZ RET
INT0 EX AF,AF'
INC A
JR Z,INT0_
EX AF,AF'
EI
RET
DUPL 11,0
RET
INT0_ PUSH DE
JP QTDONE
INT1 EX AF,AF'
PUSH DE
LD E,A
LD D,IXH
LD A,(DE)
INC E
JR Z,INT1_
LD A,E
POP DE
EX AF,AF'
EI
RET
DUPL 4,0
RET
PUSH DE
INT1_ JP QTDONE
INT2 EX AF,AF'
PUSH DE
LD E,A
LD D,IXH
LD A,(DE)
INC D
LD A,(DE)
INC E
JR Z,INT2_
LD A,E
POP DE
EX AF,AF'
EI
RET
DUPL 2,0
RET
PUSH DE
INT2_ JP QTDONE
INT3 EX AF,AF'
PUSH DE
LD E,A
LD D,IXH
LD A,(DE)
INC D
INC D
LD A,(DE)
INC E
JR Z,INT3_
LD A,E
POP DE
EX AF,AF'
EI
RET
DUPL 1,0
RET
PUSH DE
INT3_ JP QTDONE
INT4 EX AF,AF'
PUSH DE
LD E,A
LD D,IXH
LD A,(DE)
INC D
LD A,(DE)
INC D
LD A,(DE)
INC E
JR Z,INT4_
LD A,E
POP DE
EX AF,AF'
EI
RET
RET
PUSH DE
INT4_ JP QTDONE
INT5 EX AF,AF'
PUSH DE
LD E,A
LD D,IXH
LD A,(DE)
INC D
INC D
INC D
LD A,(DE)
INC E
JR Z,INT5_
LD A,E
POP DE
EX AF,AF'
EI
RET
RET
PUSH DE
INT5_ JP QTDONE
INT6 EX AF,AF'
PUSH DE
LD E,A
LD D,IXH
LD A,(DE)
INC D
LD A,(DE)
INC D
INC D
LD A,(DE)
INC E
JR Z,INT6_
LD A,E
POP DE
EX AF,AF'
EI
RET
PUSH DE
INT6_ JP QTDONE
INT7 EX AF,AF'
PUSH DE
LD E,A
LD D,IXH
LD A,(DE)
INC D
INC D
LD A,(DE)
INC D
LD A,(DE)
INC E
JR Z,INT7_
LD A,E
POP DE
EX AF,AF'
EI
RET
PUSH DE
INT7_ JP QTDONE
QTFAULT LD DE,(QTBUSY)
LD (DE),A
LD (PLAYING),A
POP DE
EX AF,AF'
RET
INT_IM1 IM 1
EI
EX DE,HL
LD HL,(QTBUSY)
LD (HL),A
LD A,L
ADD A,0X04
AND 0X1C
LD L,A
LD (QTBUSY),HL
SET 5,L
LD A,(HL)
OUT (VOL1),A
INC L
LD A,(HL)
OUT (VOL2),A
INC L
LD A,(HL)
OUT (VOL3),A
INC L
LD A,(HL)
OUT (VOL4),A
POP AF
POP HL
EX DE,HL
RET
QTDONE LD A,(QTBUSY)
ADD A,0X04
AND 0X1C
LD E,A
LD D,HIGH (QTMAP)
LD A,(DE)
OR A
JR Z,QTFAULT
EX AF,AF'
PUSH AF
INC E
LD A,(DE)
LD IXH,A
INC E
LD A,(DE)
OR A
JR Z,INT_IM1
IM 2
EX DE,HL
LD HL,INTAREA+0X18
CP (HL)
JR Z,INT_I1
LD (HL),A
LD HL,0X1518
LD (INTAREA),HL
EI
DEC A
JR Z,INT_I0
ADD A,0X03
LD L,A
LD H,HIGH (INT0)
PUSH DE
PUSH BC
LD DE,INTAREA+2
LDI
LDI
LDI
LDI
LDI
LDI
LDI
LDI
LDI
LDI
LDI
LDI
LDI
LDI
LDI
LDI
LD HL,0XD508
LD (INTAREA),HL
POP BC
POP DE
LD HL,(QTBUSY)
LD (HL),0X00
LD A,L
ADD A,0X04
AND 0X1C
LD L,A
LD (QTBUSY),HL
SET 5,L
LD A,(HL)
OUT (VOL1),A
INC L
LD A,(HL)
OUT (VOL2),A
INC L
LD A,(HL)
OUT (VOL3),A
INC L
LD A,(HL)
OUT (VOL4),A
POP AF
POP HL
EX DE,HL
RET
INT_I1 EI
LD A,0X04
LD HL,(QTBUSY)
LD (HL),0X00
ADD A,L
AND 0X1C
LD L,A
LD (QTBUSY),HL
SET 5,L
LD A,(HL)
OUT (VOL1),A
INC L
LD A,(HL)
OUT (VOL2),A
INC L
LD A,(HL)
OUT (VOL3),A
INC L
LD A,(HL)
OUT (VOL4),A
POP AF
POP HL
EX DE,HL
RET
INT_I0 LD HL,INT0+2
PUSH DE
PUSH BC
LD DE,INTAREA+2
LDI
LDI
LDI
LDI
LDI
LD HL,0X3C08
LD (INTAREA),HL
POP BC
POP DE
LD HL,(QTBUSY)
LD (HL),A
LD A,L
ADD A,0X04
AND 0X1C
LD L,A
LD (QTBUSY),HL
SET 5,L
LD A,(HL)
OUT (VOL1),A
INC L
LD A,(HL)
OUT (VOL2),A
INC L
LD A,(HL)
OUT (VOL3),A
INC L
LD A,(HL)
OUT (VOL4),A
POP AF
POP HL
EX DE,HL
RET
QTPLAY DI
LD A,0XFF
LD (PLAYING),A
LD HL,(QTBUSY)
LD A,(HL)
EX AF,AF'
INC L
LD A,(HL)
LD IXH,A
INC L
LD A,(HL)
IM 1
OR A
JR Z,QTPLAY_
IM 2
LD HL,INTAREA+0X18
CP (HL)
JR Z,QTPLAY_
LD (HL),A
LD L,A
LD H,HIGH (INT0)
LD DE,INTAREA
LD BC,0X0012
LDIR
QTPLAY_ LD HL,(QTBUSY)
SET 5,L
LD A,(HL)
OUT (VOL1),A
INC L
LD A,(HL)
OUT (VOL2),A
INC L
LD A,(HL)
OUT (VOL3),A
INC L
LD A,(HL)
OUT (VOL4),A
EI
RET
;INCLUDE "COMM.a80"
WTCM IN A,(ZXSTAT)
RRCA
JR NC,WTCM
IN A,(ZXCMD)
CP 0X12
JR Z,CM12
CP 0X18
JR Z,CM18
CP 0X1A
JR Z,CM1A
CP 0X1B
JR Z,CM1B
CP 0X20
JR Z,CM20
OUT (CLRCBIT),A
JP WTCM
CM12 IN A,(ZXDATRD)
OUT (CLRCBIT),A
OUT (MPAG),A
JP WTCM
CM18 IN A,(ZXDATRD)
LD E,A
OUT (CLRCBIT),A
CM18_1 IN A,(ZXSTAT)
OR A
JP P,CM18_1
IN A,(ZXDATRD)
LD D,A
JP WTCM
CM1A LD A,(DE)
OUT (ZXDATWR),A
OUT (CLRCBIT),A
JP WTCM
CM1B INC DE
OUT (CLRCBIT),A
JP WTCM
CM20 OUT (CLRCBIT),A
RET
;INCLUDE "GEN_L.a80"
GEN LD A,(QTFREE)
ADD A,HIGH (DAC0)
ADD A,(IY+CHRDN)
LD D,A
LD A,(SGENOFF)
LD E,A
LD A,(CHANNEL)
OR (IY+CHRDR)
LD (CHANNEL),A
GEN_ LD L,(IY+CHCURL)
LD H,(IY+CHCURH)
LD B,(IY+CHCNTL)
GENLP EXX
LD H,HIGH (RAMPG)
LD L,(IY+CHCURP)
LD D,(IY+CHCNTH)
LD E,(IY+CHFRQH)
LD B,(HL)
LD A,B
LD (CPAGE),A
OUT (MPAG),A
LD A,L
EXX
CP (IY+CHENDP)
JP C,GENTP
PUSH DE
EX DE,HL
LD L,(IY+CHENDL)
LD H,(IY+CHENDH)
DEC HL
SBC HL,DE
INC HL
EX DE,HL
LD IXL,E
LD A,D
POP DE
JR C,GENCHK
OR A
JR Z,GENENT
LD IXL,0XFF
JP GENENT
GENCHK RES 7,(IY+CHSTAT)
LD A,(IY+CHLPBP)
INC A
JP Z,GENCHK2
DEC A
LD (IY+CHCURP),A
LD L,(IY+CHLPBL)
LD H,(IY+CHLPBH)
LD A,(IY+CHLPEP)
LD (IY+CHENDP),A
LD A,(IY+CHLPEL)
LD (IY+CHENDL),A
LD A,(IY+CHLPEH)
LD (IY+CHENDH),A
SET 7,(IY+CHSTAT)
JP GENLP
GENCHK2 LD (IY+CHREAL),0X7F
BIT 6,(IY+CHSTAT)
JP Z,GENZERO
PUSH IY
PUSH DE
LD IY,CHANS
LD B,0X08
LD DE,CHANLEN
GENCHK3 SET 0,(IY+CHSTAT)
ADD IY,DE
DJNZ GENCHK3
POP DE
POP IY
JP GENZERO
GENTP LD IXL,0XFF
LD A,H
INC A
JP M,GENENT
OR L
JR Z,GENENT
NEG
LD IXL,A
GENENT LD C,(IY+CHFRQL)
LD A,(IY+CHOLDV)
PUSH IY
CALL 0X2030
POP IY
LD (IY+CHOLDV),A
LD (IY+CHCNTH),C
LD A,H
OR A
JP M,GENJ2
LD H,0X80
INC (IY+CHCURP)
GENJ2 LD A,E
OR A
JP Z,GENRET
BIT 7,(IY+CHSTAT)
JP NZ,GENLP
JP GENZERO
GENRET LD (IY+CHCURL),L
LD (IY+CHCURH),H
LD (IY+CHCNTL),B
JP GENEXT
GENZERO LD A,E
CP 0XFF
JR NC,GENZENT
LD B,(IY+CHOLDV)
LD C,0X80
CP 0XFD
JR NC,GENZ_1
CP 0XF9
JR NC,GENZ_2
LD A,C
ADD A,B
RRA
LD H,A
ADD A,B
RRA
LD L,A
ADD A,B
RRA
LD (DE),A
INC E
LD A,L
LD (DE),A
INC E
ADD A,H
RRA
LD (DE),A
INC E
LD A,H
LD (DE),A
INC E
ADD A,C
RRA
LD L,A
ADD A,H
RRA
LD (DE),A
INC E
LD A,L
LD (DE),A
INC E
ADD A,C
RRA
LD (DE),A
INC E
JP GENZENT
GENZ_2 LD A,C
ADD A,B
RRA
LD H,A
ADD A,B
RRA
LD (DE),A
INC E
LD A,H
LD (DE),A
INC E
ADD A,C
RRA
LD (DE),A
INC E
JP GENZENT
GENZ_1 LD A,B
ADD A,C
RRA
LD (DE),A
INC E
GENZENT LD A,0X80
BIT 0,E
JR Z,GENZJP1
LD (DE),A
INC E
JR Z,GENZEXT
GENZJP1 BIT 1,E
JR Z,GENZJP2
LD (DE),A
INC E
LD (DE),A
INC E
JR Z,GENZEXT
GENZJP2 BIT 2,E
JR Z,GENZLP
LD (DE),A
INC E
LD (DE),A
INC E
LD (DE),A
INC E
LD (DE),A
INC E
JR Z,GENZEXT
GENZLP LD (DE),A
INC E
LD (DE),A
INC E
LD (DE),A
INC E
LD (DE),A
INC E
LD (DE),A
INC E
LD (DE),A
INC E
LD (DE),A
INC E
LD (DE),A
INC E
JP NZ,GENZLP
GENZEXT LD A,(QTFREE)
ADD A,HIGH (DAC0)
ADD A,(IY+CHRDN)
LD D,A
LD E,0XFF
LD A,0X80
LD (DE),A
GENEXT XOR A
LD (CPAGE),A
OUT (MPAG),A
BIT 0,(IY+CHSTAT)
RET Z
JP CALCVOL
;INCLUDE "TABLES_L.a80"
align 256
INTTAB DUPL 0X101,HIGH (INTAREA)
INTTB DW INT0,INT1,INT1,INT2,INT1,INT3,INT2,INT4,INT1,INT5
DW INT3,INT6,INT2,INT7,INT4,0X0000
INTOFF DB 0,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
;INCLUDE "_BPM.a80"
BPMTAB
dw 0X0B72,0X0B19,0X0AC5,0X0A77,0X0A2C,0X09E6,0X09A3,0X0964
dw 0X0928,0X08EF,0X08B8,0X0884,0X0853,0X0823,0X07F6,0X07CB
dw 0X07A1,0X0779,0X0753,0X072E,0X070B,0X06E9,0X06C8,0X06A9
dw 0X068A,0X066D,0X0650,0X0635,0X061B,0X0601,0X05E8,0X05D0
dw 0X05B9,0X05A2,0X058C,0X0577,0X0563,0X054F,0X053B,0X0528
dw 0X0516,0X0504,0X04F3,0X04E2,0X04D2,0X04C2,0X04B2,0X04A3
dw 0X0494,0X0485,0X0477,0X046A,0X045C,0X044F,0X0442,0X0436
dw 0X0429,0X041D,0X0412,0X0406,0X03FB,0X03F0,0X03E5,0X03DB
dw 0X03D1,0X03C6,0X03BD,0X03B3,0X03AA,0X03A0,0X0397,0X038E
dw 0X0385,0X037D,0X0374,0X036C,0X0364,0X035C,0X0354,0X034D
dw 0X0345,0X033E,0X0336,0X032F,0X0328,0X0321,0X031A,0X0314
dw 0X030D,0X0307,0X0300,0X02FA,0X02F4,0X02EE,0X02E8,0X02E2
dw 0X02DC,0X02D7,0X02D1,0X02CC,0X02C6,0X02C1,0X02BC,0X02B6
dw 0X02B1,0X02AC,0X02A7,0X02A2,0X029E,0X0299,0X0294,0X0290
dw 0X028B,0X0287,0X0282,0X027E,0X0279,0X0275,0X0271,0X026D
dw 0X0269,0X0265,0X0261,0X025D,0X0259,0X0255,0X0251,0X024E
dw 0X024A,0X0246,0X0243,0X023F,0X023C,0X0238,0X0235,0X0231
dw 0X022E,0X022B,0X0227,0X0224,0X0221,0X021E,0X021B,0X0218
dw 0X0215,0X0212,0X020F,0X020C,0X0209,0X0206,0X0203,0X0200
dw 0X01FE,0X01FB,0X01F8,0X01F5,0X01F3,0X01F0,0X01ED,0X01EB
dw 0X01E8,0X01E6,0X01E3,0X01E1,0X01DE,0X01DC,0X01D9,0X01D7
dw 0X01D5,0X01D2,0X01D0,0X01CE,0X01CC,0X01C9,0X01C7,0X01C5
dw 0X01C3,0X01C1,0X01BE,0X01BC,0X01BA,0X01B8,0X01B6,0X01B4
dw 0X01B2,0X01B0,0X01AE,0X01AC,0X01AA,0X01A8,0X01A6,0X01A4
dw 0X01A3,0X01A1,0X019F,0X019D,0X019B,0X0199,0X0198,0X0196
dw 0X0194,0X0192,0X0191,0X018F,0X018D,0X018C,0X018A,0X0188
dw 0X0187,0X0185,0X0183,0X0182,0X0180,0X017F,0X017D,0X017C
dw 0X017A,0X0179,0X0177,0X0176,0X0174,0X0173,0X0171,0X0170
;INCLUDE "_trash.a80" ;comes from original ROM!
;strange block, comes from original ROM.
;real garbage;)
DB 0X56,0X43,0X56,0X49,0X45,0X57,0X20,0X20,0X45,0X58,0X54,0X20,0X00,0X00,0X00,0X00
DB 0X00,0X00,0X00,0X00,0X00,0X00,0XC4,0X08,0X43,0X21,0X28,0X09,0XDA,0X02,0X00,0X00
DB 0X00,0X43,0X56,0X49,0X45,0X57,0X20,0X20,0X45,0X58,0X54,0X20,0X00,0X00,0X00,0X00
DB 0X00,0X00,0X00,0X00,0X00,0X00,0XC4,0X08,0X43,0X21,0X28,0X09,0XDA,0X02,0X00,0X00
Free1
;---patched
Patch11
LD H,(HL)
LD L,D
ADD HL,HL
ADD HL,HL
JR NC,$+3
INC D
LD A,(MODTP)
INC A
LD BC,0X0000+1084
JR Z,TTT15x
LD BC,0X0000+600
TTT15x ADD HL,BC
JR NC,$+3
INC D
XOR A
LD (CPAGE),A
OUT (MPAG),A
LD A,D
LD DE,0X5000
LD BC,0X400
CALL LDMEM
XOR A
OUT (0X00),A
RET
; new cmd 0X6A - Set player mode
COM6A LD A,(PlMode) ;command
OUT (ZXDATWR),A
IN A,(ZXDATRD)
OUT (CLRCBIT),A
LD (PlMode),A
RET
Patch2x LD A,(PlMode)
OR A
RET NZ
LD HL,MTSTAT
SET 7,(HL)
RET
; last note speed
Patch3 LD A,(MTSNGPS)
OR A
JR NZ,Patch3e ;1st pattern
LD A,(MTPATPS)
OR A
JR NZ,Patch3e ;1st row
LD A,6 ;init speed at start of MOD
LD (MTSPEED),A
LD HL,750
LD (TICKLEN),HL
LD (TCKLEFT),HL
Patch3e LD IY,CHANS
JP EFXGTNT+4
; initial note
Patch4 LD (IY+CHCNTL),0X00
LD (IY+CHREAL),0X7F
RET
;MOD relooper
; new cmd 0X6B - Set minimal loop length (turn on relooper)
COM6B IN A,(ZXDATRD)
LD L,A
OUT (CLRCBIT),A
IN A,(ZXSTAT)
AND 0X81
JR Z,$-4
JP P,Patch5s
IN A,(ZXDATRD)
LD H,A
LD DE,16385
OR A
SBC HL,DE
ADD HL,DE
JR C,Patch5s+3
Patch5s LD HL,0X0200
LD (MODLLEN),HL
RET
;reconstruct MOD after load
Patch5x CALL SET_SIZE_MOD ;CALL PLAYMD ;init MOD
LD HL,(MODLLEN)
LD A,H
OR L
RET Z ;relooper off
LD A,(MODTP)
OR A
LD A,31
LD HL,1084
JR NZ,$+7
LD A,15
LD HL,600
LD (MODSMPS),A
LD (MODPTST),HL
CALL CHIP
JP PLAYMD ;init MOD again
;INCLUDE "reloop.a80"
;-----(c)Evgeny Muchkin
;MODSMPS equ 0X5000
;MODPTST equ 0X5001
;ChipSP_ equ 0X5005
;CHIP246 equ 0X5007
;TOcip_ equ 0X5009
;CHIPLN equ 0X5010 ; НА4АЛО СЕМПЛОВ (pointer)
;CHIPPP equ 0X5013 ; ДЛИНА МОДУЛЯ
;CIP1 equ 0X5016 ; ОТКУДА ПЕРЕНОСИТЬ
;CIP2 equ 0X5019 ; КУДА ПЕРЕНОСИТЬ
;CIP3 equ 0X501c ; КОНЕЦ БЛОКА
CHIP DI
LD A,(RAMPG)
OUT (MPAG),A
LD DE,(MODPTST) ;patts data!
LD A,(PATTS)
LD L,A
LD H,B
ADD HL,HL
ADD HL,HL
LD A,H
LD H,L
LD L,B
ADD HL,DE
ADC A,B
LD (CHIPLN),HL
LD (CHIPLN+2),A
LD (ChipSP_),SP
LD HL,CHIPLN
LD DE,CHIPPP
PUSH DE
LDI
LDI
LDI
POP IY
LD A,(MODSMPS)
LD B,A ;smps!
LD DE,30
LD IX,0X8014
ChIp LD H,(IX+22) ;len
LD L,(IX+23)
CALL TOCip
ADD IX,DE
DJNZ ChIp
LD IX,0X802A
LD A,(MODSMPS)
LD B,A ;smps!
CHIP1 LD A,(RAMPG)
OUT (MPAG),A
LD H,(IX+6) ;loop len
LD L,(IX+7)
LD (CHIP246),HL
LD A,(IX) ;len
OR (IX+1)
JP Z,CHIP2 ;skip if no smp
LD DE,2
CALL CP_DDE
JP C,CHIP2 ;skip if loop len <2
LUP_LEN LD DE,(MODLLEN)
CALL CP_DDE
JP NC,CHIP2 ;skip if loop len>=LUP_LEN
PUSH BC
LD B,H
LD C,L
EXX
LD BC,0 ;reloop counter
CHIP3 EXX
ADD HL,BC
CALL CP_DDE
EXX
INC BC
JR C,CHIP3
PUSH BC
EXX
;!!!!!!!!!!!!!!!!!!!!!!!!!!
PUSH HL ;new loop len
LD B,(IX+6) ;loop len
LD C,(IX+7)
AND A
SBC HL,BC
LD DE,CHIPPP
LD (TOcip_),DE
LD IY,CIP1
CALL TOCIP
LD DE,CHIPLN
LD (TOcip_),DE
LD B,3 ;check if free mem
LD DE,CIP1+2
LD HL,RAMTOP+2
ChipLP LD A,(DE)
CP (HL)
DEC HL
DEC DE
JR C,ChipOK
JP NZ,ChipSP
DJNZ ChipLP
ChipOK POP HL
EX DE,HL ;DE=new loop len
LD H,(IX) ;len
LD L,(IX+1)
LD B,(IX+6) ;loop len
LD C,(IX+7)
AND A
SBC HL,BC
ADD HL,DE
LD (IX),H ;new smp len
LD (IX+1),L
LD (IX+6),D ;new loop len
LD (IX+7),E
LD IY,CIP1
LD H,(IX+4) ;loop start
LD L,(IX+5)
PUSH HL
PUSH HL
PUSH HL
ADD HL,BC
CALL TOCIP
LD IY,CIP2
POP HL
ADD HL,DE
CALL TOCIP
LD HL,CHIPPP
LD DE,CIP3
LDI
LDI
LDI
CALL DIRER
LD IY,CIP1
POP HL
CALL TOCIP
POP HL
CHIP4 LD DE,(CHIP246) ;orig loop len
ADD HL,DE
LD IY,CIP2
CALL TOCIP
LD HL,CIP2
LD DE,CIP3
LDI
LDI
LDI
POP BC
CHIP5 PUSH BC
CALL DIRER
CHIP6 LD HL,(CHIP246) ;orig loop len
LD IY,CIP2
CALL TOCip
POP BC
DEC BC
LD A,B
OR C
JR NZ,CHIP5
POP BC
CHIP2 LD DE,(CHIP246) ;orig loop len
LD A,(RAMPG)
OUT (MPAG),A
LD H,(IX+6) ;new loop len
LD L,(IX+7)
AND A
SBC HL,DE
LD IY,CHIPPP ;corr mod len
CALL TOCip
LD H,(IX)
LD L,(IX+1)
LD IY,CHIPLN ;add pointer
CALL TOCip
LD DE,30
ADD IX,DE
DEC B
JP NZ,CHIP1
ChipSP LD SP,(ChipSP_)
EI
RET
DIRER LD IY,CIP1
LD L,(IY+3)
LD H,(IY+4)
LD B,(IY+5)
EXX
LD L,(IY)
LD H,(IY+1)
LD B,(IY+2)
LD E,(IY+6)
LD D,(IY+7)
LD C,(IY+8)
PUSH IX
CALL RESI10_
POP IX
RET
TOCIP PUSH HL
PUSH DE
PUSH IY
POP DE
TOcip LD HL,(TOcip_) ;CHIPLN
LDI
LDI
LDI
POP DE
POP HL
TOCip CALL ADD_IY
ADD_IY LD A,(IY)
ADD A,L
LD (IY),A
LD A,(IY+1)
ADC A,H
LD (IY+1),A
LD A,(IY+2)
ADC A,0
LD (IY+2),A
RET
CP_DDE PUSH HL
AND A
SBC HL,DE
POP HL
RET
;RESID10 ; MOVE BLOCK IN GS
; BHL - FROM
; CDE - END
; 'BHL - TO
RESI10_ SUB A
OUT (MPAG),A
LD (SYSTEM),A
LD A,B
PUSH HL
EXX
POP DE
PUSH HL
PUSH BC
LD C,A
OR A
SBC HL,DE
LD A,B
SBC A,C
EX DE,HL
POP BC
POP HL
LD C,A
OR E
OR D
RET Z
EXX
EX DE,HL
SBC HL,DE
LD A,C
SBC A,B
LD IXL,A
OR L
OR H
EXX
RET Z
PUSH DE
PUSH BC
BIT 7,C
EXX
JP NZ,MOVL
JP MOVH
;-----
;store settings
Patch5i1 LD A,(PlMode)
LD C,A
LD DE,(MODLLEN)
LD A,(ERRCODE)
RET
;restore settings
Patch5i2 LD (ERRCODE),A
LD A,C
LD (PlMode),A
LD (MODLLEN),DE
RET
;clear vars after full reset!
Patch5i3 XOR A
LD H,A
LD L,A
LD (PlMode),A
LD (MODLLEN),HL
JP INITVAR
CP_END_MOD
;LD HL,MTSNGPS
;INC (HL)
;CP (HL)
;CALL C,STOPMOD
;LD (MTSNGPS),A
;RET
; display $
;---
;emptyobl1
; ORG GSRomBaseL+0X1D00
; IN A,(ZXDATRD)
; OUT (CLRCBIT),A
; LD A,0X7F
; OUT (ZXDATWR),A
; JP COMINT_
;WDY IN A,(ZXSTAT)
; RLA
; JR NC,$-3
; RET
;WDN IN A,(ZXSTAT)
; RLA
; JR C,$-3
; RET
ORG GSRomBaseL+0X2000
;SGEN
;INCLUDE "SGEN_ASM.a80"
; MODULE SGEN
;INCLUDE "SGEN.a80"
SGENTBE DW S0,S1,S2,S3,S4,S5,S6,S7,S8
SGENTBF DW SGEN1,SGEN2,SGEN3,SGEN4,SGEN5,SGEN6,SGEN7,SGEN8,SGEN9
DUPL 12,0
SGEN EXX
INC D
DEC D
JP Z,SGEN_
LD C,A
LD A,D
DEC A
CP 0X09
JP NC,SGEN__
ADD A,A
ADD A,LOW (SGENTBF)
LD L,A
LD H,HIGH (SGENTBF)
LD A,(HL)
INC L
LD H,(HL)
LD L,A
LD A,C
JP (HL)
SGEN1 EXX
ADD A,(HL)
RRA
LD (DE),A
INC E
EXX
JP SGEN_
SGEN2 EXX
SUB (HL)
EXX
LD H,HIGH (DIVTAB3)
JP NC,SGEN2_2
INC H
SGEN2_2 LD L,A
LD A,(HL)
EXX
ADD A,(HL)
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
EXX
JP SGEN_
SGEN3 EXX
ADD A,(HL)
RRA
EXX
LD L,A
ADD A,C
RRA
EXX
LD (DE),A
INC E
EXX
LD A,L
EXX
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
EXX
JP SGEN_
SGEN4 EXX
ADD A,(HL)
RRA
EXX
LD L,A
ADD A,C
RRA
EXX
LD (DE),A
INC E
EXX
LD A,L
EXX
LD (DE),A
INC E
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
EXX
JP SGEN_
SGEN5 EXX
ADD A,(HL)
RRA
EXX
LD L,A
ADD A,C
RRA
EXX
LD (DE),A
INC E
LD (DE),A
INC E
EXX
LD A,L
EXX
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
LD (DE),A
INC E
EXX
JP SGEN_
SGEN6 EXX
ADD A,(HL)
RRA
EXX
LD L,A
ADD A,C
RRA
EXX
LD (DE),A
INC E
LD (DE),A
INC E
EXX
LD A,L
EXX
LD (DE),A
INC E
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
LD (DE),A
INC E
EXX
JP SGEN_
SGEN7 EXX
ADD A,(HL)
RRA
EXX
LD L,A
ADD A,C
RRA
LD H,A
ADD A,C
RRA
EXX
LD (DE),A
INC E
EXX
LD A,H
EXX
LD (DE),A
INC E
EXX
ADD A,L
RRA
EXX
LD (DE),A
INC E
EXX
LD A,L
EXX
LD (DE),A
INC E
ADD A,(HL)
RRA
EXX
LD H,A
ADD A,L
RRA
EXX
LD (DE),A
INC E
EXX
LD A,H
EXX
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
EXX
JP SGEN_
SGEN8 EXX
ADD A,(HL)
RRA
EXX
LD L,A
ADD A,C
RRA
LD H,A
ADD A,C
RRA
EXX
LD (DE),A
INC E
EXX
LD A,H
EXX
LD (DE),A
INC E
EXX
ADD A,L
RRA
EXX
LD (DE),A
INC E
EXX
LD A,L
EXX
LD (DE),A
INC E
LD (DE),A
INC E
ADD A,(HL)
RRA
EXX
LD H,A
ADD A,L
RRA
EXX
LD (DE),A
INC E
EXX
LD A,H
EXX
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
EXX
JP SGEN_
SGEN9 EXX
ADD A,(HL)
RRA
EXX
LD L,A
ADD A,C
RRA
LD H,A
ADD A,C
RRA
EXX
LD (DE),A
INC E
EXX
LD A,H
EXX
LD (DE),A
INC E
LD (DE),A
INC E
EXX
ADD A,L
RRA
EXX
LD (DE),A
INC E
EXX
LD A,L
EXX
LD (DE),A
INC E
ADD A,(HL)
RRA
EXX
LD H,A
ADD A,L
RRA
EXX
LD (DE),A
INC E
EXX
LD A,H
EXX
LD (DE),A
INC E
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
EXX
JP SGEN_
SGEN__ JP SGEN_
SGEN_ LD A,E
CP 0X09
JR NC,S9
ADD A,A
LD L,A
LD H,HIGH (SGENTBE)
LD A,(HL)
INC L
LD H,(HL)
LD L,A
JP (HL)
S9 EXX
LD C,0XFF
EXX
LD D,0X08
JP S8
S0 EXX
LD C,0X00
EXX
LD D,0X01
JP S1
S3 EXX
PUSH BC
EXX
POP HL
LD B,E
LD E,H
LD C,L
CALL S3_
S_RET LD IYL,E
LD E,D
LD D,IYL
PUSH DE
EXX
POP BC
RET
S4 EXX
PUSH BC
EXX
POP HL
LD B,E
LD E,H
LD C,L
CALL S4_
JP S_RET
S5 EXX
PUSH BC
EXX
POP HL
LD B,E
LD E,H
LD C,L
CALL S5_
JP S_RET
S6 EXX
PUSH BC
EXX
POP HL
LD B,E
LD E,H
LD C,L
CALL S6_
JP S_RET
S7 EXX
PUSH BC
EXX
POP HL
LD B,E
LD E,H
LD C,L
CALL S7_
JP S_RET
S8 EXX
PUSH BC
EXX
POP HL
LD B,E
LD E,H
LD C,L
CALL S8_
JP S_RET
;INCLUDE "SGEN1_L.a80"
S1 EXX
SLA C
JR C,S1_6
LD A,IXL
INC A
JR Z,S1_2
DEC A
ADD A,E
JR Z,S1_4
JR C,S1_2
BIT 7,C
JR Z,S1_4
LD IYL,A
LD A,IXL
SRL A
SRL A
ADD A,IYL
JR Z,S1_4
JR NC,S1_4
S1_2 DB 0XCB,0X30;SLI B
JR NC,S1_3
LD A,E
AND 0X03
JP Z,S11L0_1
DEC A
JP Z,S11L1_1
DEC A
JP Z,S11L2_1
JP S11L3
S1_3 LD A,E
AND 0X03
JP Z,S11H0_1
DEC A
JP Z,S11H1_1
DEC A
JP Z,S11H2_1
JP S11H3
S1_4 DB 0XCB,0X30;SLI B
JR NC,S1_5
LD A,E
AND 0X03
JP Z,S12L0_1
DEC A
JP Z,S12L1_1
DEC A
JP Z,S12L2_1
JP S12L3
S1_5 LD A,E
AND 0X03
JP Z,S12H0_1
DEC A
JP Z,S12H1_1
DEC A
JP Z,S12H2_1
JP S12H3
S1_6 LD A,IXL
INC A
JR Z,S1_7
DEC A
SRL A
ADD A,IXL
JR Z,S1_9
JR C,S1_7
ADD A,E
JR C,S1_7
BIT 7,C
JR Z,S1_9
LD IYL,A
LD A,IXL
SRL A
SRL A
ADD A,IYL
JR Z,S1_9
JR NC,S1_9
S1_7 DB 0XCB,0X30;SLI B
JR C,S1_8
LD A,E
AND 0X03
JP Z,S13L0
DEC A
JP Z,S13L1
DEC A
JP Z,S13L2
JP S13L3
S1_8 LD A,E
AND 0X03
JP Z,S13H0
DEC A
JP Z,S13H1
DEC A
JP Z,S13H2
JP S13H3
S1_9 DB 0XCB,0X30;SLI B
JR C,S1_A
LD A,E
AND 0X03
JP Z,S14L0
DEC A
JP Z,S14L1
DEC A
JP Z,S14L2
JP S14L3
S1_A LD A,E
AND 0X03
JP Z,S14H0
DEC A
JP Z,S14H1
DEC A
JP Z,S14H2
JP S14H3
S11M0 LD B,A
DEC HL
LD A,(HL)
INC HL
ADD A,(HL)
RRA
LD (DE),A
INC E
LDI
INC C
S11L2_1 LD A,B
S11L2_2 LDI
INC C
ADD A,C
LD B,A
JP NC,S11L3
ADD A,C
JP C,S11M3
S11G3 LD B,A
DEC HL
LD A,(HL)
INC HL
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S11R1
LDI
INC C
S11H1_1 LD A,B
S11H1_2 LDI
INC C
ADD A,C
JP NC,S11H2_2
LDI
INC C
ADD A,C
LD B,A
JP NC,S11L3
ADD A,C
JP C,S11M3
JP S11G3
S11R1 LD IYL,A
LD A,B
SUB C
LD B,A
SRL B
LD C,0X00
LD A,IYL
RET
S11M1 LD B,A
DEC HL
LD A,(HL)
INC HL
ADD A,(HL)
RRA
LD (DE),A
INC E
LDI
INC C
S11L3 LD A,(HL)
INC HL
LD (DE),A
INC E
JR Z,S11R2
LD A,B
ADD A,C
JP NC,S11L0_2
ADD A,C
JR C,S11M0
S11G0 LD B,A
DEC HL
LD A,(HL)
INC HL
ADD A,(HL)
RRA
LD (DE),A
INC E
LDI
INC C
S11H2_1 LD A,B
S11H2_2 LDI
INC C
ADD A,C
LD B,A
JP NC,S11H3
LD A,(HL)
INC HL
LD (DE),A
INC E
JR Z,S11R2
LD A,B
ADD A,C
JP NC,S11L0_2
ADD A,C
JP C,S11M0
JP S11G0
S11R2 LD IYL,A
LD A,B
ADD A,C
LD B,A
JR NC,S11R2_2
LD C,0X01
SRL B
LD A,IYL
RET
S11R2_2 LD C,0X00
RRC B
LD A,IYL
RET
S11M2 LD B,A
DEC HL
LD A,(HL)
INC HL
ADD A,(HL)
RRA
LD (DE),A
INC E
LD A,(HL)
INC HL
LD (DE),A
INC E
JR Z,S11R3
S11L0_1 LD A,B
S11L0_2 LDI
INC C
ADD A,C
JP NC,S11L1_2
ADD A,C
JR C,S11M1
S11G1 LD B,A
DEC HL
LD A,(HL)
INC HL
ADD A,(HL)
RRA
LD (DE),A
INC E
LDI
INC C
S11H3 LD A,(HL)
INC HL
LD (DE),A
INC E
JR Z,S11R4
LD A,B
ADD A,C
JP NC,S11H0_2
LDI
INC C
ADD A,C
JP NC,S11L1_2
ADD A,C
JP C,S11M1
JP S11G1
S11R3 LD C,0X00
RRC B
RET
S11R4 LD IYL,A
LD A,B
ADD A,C
LD B,A
JR NC,S11R4_2
LD C,0X00
RRC B
LD A,IYL
RET
S11R4_2 LD C,0X00
SRL B
LD A,IYL
RET
S11R5 LD IYL,A
LD A,B
SUB C
LD B,A
LD C,0X00
SRL B
LD A,IYL
RET
S11M3 LD B,A
DEC HL
LD A,(HL)
INC HL
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S11R5
LDI
INC C
S11L1_1 LD A,B
S11L1_2 LDI
INC C
ADD A,C
JP NC,S11L2_2
ADD A,C
JR C,S11M2
S11G2 LD B,A
DEC HL
LD A,(HL)
INC HL
ADD A,(HL)
RRA
LD (DE),A
INC E
LD A,(HL)
INC HL
LD (DE),A
INC E
JR Z,S11R6
S11H0_1 LD A,B
S11H0_2 LDI
INC C
ADD A,C
JP NC,S11H1_2
LDI
INC C
ADD A,C
JP NC,S11L2_2
ADD A,C
JP C,S11M2
JP S11G2
S11R6 LD C,0X00
SRL B
RET
S12M0 LD B,A
DEC HL
LD A,(HL)
INC HL
ADD A,(HL)
RRA
LD (DE),A
INC E
LDI
INC C
DEC IXL
JR Z,S12R3_3
S12L2_1 LD A,B
S12L2_2 LDI
INC C
DEC IXL
JR Z,S12R2_5
ADD A,C
LD B,A
JP NC,S12L3
ADD A,C
JP C,S12M3
S12G3 LD B,A
DEC HL
LD A,(HL)
INC HL
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S12R1
LDI
INC C
DEC IXL
JR Z,S12R6_3
S12H1_1 LD A,B
S12H1_2 LDI
INC C
DEC IXL
JR Z,S12R4_4
ADD A,C
JP NC,S12H2_2
LDI
INC C
DEC IXL
JR Z,S12R2_5
ADD A,C
LD B,A
JP NC,S12L3
ADD A,C
JP C,S12M3
JP S12G3
S12R2_5 JR S12R2_3
S12R6_3 JP S12R6_2
S12R1 LD IYL,A
LD A,B
SUB C
LD B,A
SRL B
LD C,0X00
LD A,IYL
RET
S12R3_3 DEC HL
LD A,(HL)
INC HL
LD C,0X00
RRC B
RET
S12R4_4 JP S12R4_3
S12M1 LD B,A
DEC HL
LD A,(HL)
INC HL
ADD A,(HL)
RRA
LD (DE),A
INC E
LDI
INC C
DEC IXL
JR Z,S12R3_3
S12L3 LD A,(HL)
INC HL
LD (DE),A
INC E
JR Z,S12R2
DEC IXL
JR Z,S12R2
LD A,B
ADD A,C
JP NC,S12L0_2
ADD A,C
JP C,S12M0
S12G0 LD B,A
DEC HL
LD A,(HL)
INC HL
ADD A,(HL)
RRA
LD (DE),A
INC E
LDI
INC C
DEC IXL
JR Z,S12R6_3
S12H2_1 LD A,B
S12H2_2 LDI
INC C
DEC IXL
JR Z,S12R4_4
ADD A,C
LD B,A
JP NC,S12H3
LD A,(HL)
INC HL
LD (DE),A
INC E
JR Z,S12R2
DEC IXL
JR Z,S12R2
LD A,B
ADD A,C
JP NC,S12L0_2
ADD A,C
JP C,S12M0
JP S12G0
S12R2_3 DEC HL
LD A,(HL)
INC HL
S12R2 LD IYL,A
LD A,B
ADD A,C
LD B,A
JR NC,S12R2_2
LD C,0X01
SRL B
LD A,IYL
RET
S12R2_2 LD C,0X00
RRC B
LD A,IYL
RET
S12M2 LD B,A
DEC HL
LD A,(HL)
INC HL
ADD A,(HL)
RRA
LD (DE),A
INC E
LD A,(HL)
INC HL
LD (DE),A
INC E
JR Z,S12R3
DEC IXL
JR Z,S12R3
S12L0_1 LD A,B
S12L0_2 LDI
INC C
DEC IXL
JR Z,S12R2_3
ADD A,C
JP NC,S12L1_2
ADD A,C
JP C,S12M1
S12G1 LD B,A
DEC HL
LD A,(HL)
INC HL
ADD A,(HL)
RRA
LD (DE),A
INC E
LDI
INC C
DEC IXL
JR Z,S12R6_5
S12H3 LD A,(HL)
INC HL
LD (DE),A
INC E
JR Z,S12R4
DEC IXL
JR Z,S12R4
LD A,B
ADD A,C
JP NC,S12H0_2
LDI
INC C
DEC IXL
JR Z,S12R2_3
ADD A,C
JP NC,S12L1_2
ADD A,C
JP C,S12M1
JP S12G1
S12R6_5 JP S12R6_2
S12R3_2 DEC HL
LD A,(HL)
INC HL
S12R3 LD C,0X00
RRC B
RET
S12R4_3 DEC HL
LD A,(HL)
INC HL
S12R4 LD IYL,A
LD A,B
ADD A,C
LD B,A
JR NC,S12R4_2
LD C,0X00
RRC B
LD A,IYL
RET
S12R4_2 LD C,0X00
SRL B
LD A,IYL
RET
S12R5 LD IYL,A
LD A,B
SUB C
LD B,A
LD C,0X00
SRL B
LD A,IYL
RET
S12M3 LD B,A
DEC HL
LD A,(HL)
INC HL
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S12R5
LDI
INC C
DEC IXL
JR Z,S12R3_2
S12L1_1 LD A,B
S12L1_2 LDI
INC C
DEC IXL
JR Z,S12R2_4
ADD A,C
JP NC,S12L2_2
ADD A,C
JP C,S12M2
S12G2 LD B,A
DEC HL
LD A,(HL)
INC HL
ADD A,(HL)
RRA
LD (DE),A
INC E
LD A,(HL)
INC HL
LD (DE),A
INC E
JR Z,S12R6
DEC IXL
JR Z,S12R6
S12H0_1 LD A,B
S12H0_2 LDI
INC C
DEC IXL
JR Z,S12R4_3
ADD A,C
JP NC,S12H1_2
LDI
INC C
DEC IXL
JR Z,S12R2_4
ADD A,C
JP NC,S12L2_2
ADD A,C
JP C,S12M2
JP S12G2
S12R6_2 DEC HL
LD A,(HL)
INC HL
S12R6 LD C,0X00
SRL B
RET
S12R2_4 JP S12R2_3
S13R1 JR NC,S13R1_2
SRL B
LD C,0X01
RET
S13R1_2 RRC B
LD C,0X00
RET
S13R2 SRL B
LD C,0X00
RET
S13J0 ADD A,(HL)
RRA
LD (DE),A
INC E
S13H1 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP C,S13J2
S13K2 ADD A,(HL)
RRA
LD (DE),A
INC E
S13L3 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JR Z,S13R1
JP C,S13K0
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP NC,S13K1
S13J1 ADD A,(HL)
RRA
LD (DE),A
INC E
S13H2 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP C,S13J3
S13K3 ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S13R2
S13L0 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP C,S13K1
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP NC,S13K2
S13J2 ADD A,(HL)
RRA
LD (DE),A
INC E
S13H3 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JR Z,S13R3
JP C,S13J0
S13K0 ADD A,(HL)
RRA
LD (DE),A
INC E
S13L1 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP C,S13K2
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP NC,S13K3
S13J3 ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S13R4
S13H0 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP C,S13J1
S13K1 ADD A,(HL)
RRA
LD (DE),A
INC E
S13L2 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP C,S13K3
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JR Z,S13R5
JP NC,S13K0
JP S13J0
S13R3 LD C,0X01
JR NC,S13R3_2
RRC B
RET
S13R3_2 SRL B
RET
S13R4 RRC B
LD C,0X00
RET
S13R5 LD C,0X01
JR NC,S13R5_2
RRC B
RET
S13R5_2 SRL B
RET
S14R5_3 JP S14R5
S14R1 JR NC,S14R1_2
SRL B
LD C,0X01
RET
S14R1_2 RRC B
LD C,0X00
RET
S14R2 SRL B
LD C,0X00
RET
S14J0 ADD A,(HL)
RRA
LD (DE),A
INC E
S14H1 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
DEC IXL
JR Z,S14R5_3
JP C,S14J2
S14K2 ADD A,(HL)
RRA
LD (DE),A
INC E
S14L3 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JR Z,S14R1
DEC IXL
JR Z,S14R1
JP C,S14K0
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
DEC IXL
JR Z,S14R5_3
JP NC,S14K1
S14J1 ADD A,(HL)
RRA
LD (DE),A
INC E
S14H2 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
DEC IXL
JR Z,S14R5_3
JP C,S14J3
S14K3 ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S14R2
S14L0 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
DEC IXL
JR Z,S14R1
JP C,S14K1
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
DEC IXL
JR Z,S14R5
JP NC,S14K2
S14J2 ADD A,(HL)
RRA
LD (DE),A
INC E
S14H3 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JR Z,S14R5
DEC IXL
JR Z,S14R5
JP C,S14J0
S14K0 ADD A,(HL)
RRA
LD (DE),A
INC E
S14L1 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
DEC IXL
JR Z,S14R1_3
JP C,S14K2
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
DEC IXL
JR Z,S14R5
JP NC,S14K3
S14J3 ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S14R4
S14H0 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
DEC IXL
JR Z,S14R5
JP C,S14J1
S14K1 ADD A,(HL)
RRA
LD (DE),A
INC E
S14L2 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
DEC IXL
JR Z,S14R1_3
JP C,S14K3
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JR Z,S14R5
DEC IXL
JR Z,S14R5
JP NC,S14K0
JP S14J0
S14R5 LD C,0X01
JR NC,S14R5_2
RRC B
RET
S14R5_2 SRL B
RET
S14R4 RRC B
LD C,0X00
RET
S14R1_3 JP S14R1
;INCLUDE "SGEN2_L.a80"
S2 LD H,HIGH (DIVTAB3)
LD D,H
INC D
EXX
SLA C
JR C,S2_6
LD A,IXL
ADD A,A
JR C,S2_2
ADD A,E
JR Z,S2_4
JR C,S2_2
BIT 7,C
JR Z,S2_4
LD IYL,A
LD A,IXL
SRL A
SRL A
ADD A,IYL
JR Z,S2_4
JR NC,S2_4
S2_2 DB 0XCB,0X30;SLI B
JR NC,S2_3
LD A,E
AND 0X03
JP Z,S21L0
DEC A
JP Z,S21L1
DEC A
JP Z,S21L2
JP S21L3
S2_3 LD A,E
AND 0X03
JP Z,S21H0
DEC A
JP Z,S21H1
DEC A
JP Z,S21H2
JP S21H3
S2_4 DB 0XCB,0X30;SLI B
JR NC,S2_5
LD A,E
AND 0X03
JP Z,S22L0
DEC A
JP Z,S22L1
DEC A
JP Z,S22L2
JP S22L3
S2_5 LD A,E
AND 0X03
JP Z,S22H0
DEC A
JP Z,S22H1
DEC A
JP Z,S22H2
JP S22H3
S2_6 LD A,IXL
ADD A,A
JR C,S2_7
LD IYL,A
LD A,IXL
SRL A
ADD A,IYL
JR C,S2_7
ADD A,E
JR Z,S2_9
JR C,S2_7
BIT 7,C
JR Z,S2_9
LD IYL,A
LD A,IXL
SRL A
SRL A
ADD A,IYL
JR Z,S2_9
JR NC,S2_9
S2_7 DB 0XCB,0X30;SLI B
JR C,S2_8
LD A,E
AND 0X03
JP Z,S23L0
DEC A
JP Z,S23L1
DEC A
JP Z,S23L2
JP S23L3
S2_8 LD A,E
AND 0X03
JP Z,S23H0
DEC A
JP Z,S23H1
DEC A
JP Z,S23H2
JP S23H3
S2_9 DB 0XCB,0X30;SLI B
JR C,S2_A
LD A,E
AND 0X03
JP Z,S24L0
DEC A
JP Z,S24L1
DEC A
JP Z,S24L2
JP S24L3
S2_A LD A,E
AND 0X03
JP Z,S24H0
DEC A
JP Z,S24H1
DEC A
JP Z,S24H2
JP S24H3
S21G0 LD E,A
LD A,(DE)
EXX
ADD A,(HL)
LD (DE),A
INC E
S21J1 ADD A,(HL)
RRA
LD (DE),A
INC E
S21H2 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP NC,S21J3
S21K3 ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S21R1
S21L0 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP NC,S21K1
SUB (HL)
EXX
JP C,S21G1
LD L,A
LD A,(HL)
EXX
ADD A,(HL)
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JR Z,S21R2
JP C,S21K0
JP S21J0
S21R1 LD C,0X00
RRC B
RET
S21R2 LD C,0X01
JR NC,S21R2_2
RRC B
RET
S21R2_2 SRL B
RET
S21G1 LD E,A
LD A,(DE)
EXX
ADD A,(HL)
LD (DE),A
INC E
S21J2 ADD A,(HL)
RRA
LD (DE),A
INC E
S21H3 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JR Z,S21R2
JP NC,S21J0
S21K0 ADD A,(HL)
RRA
LD (DE),A
INC E
S21L1 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP NC,S21K2
SUB (HL)
EXX
JP C,S21G2
LD L,A
LD A,(HL)
EXX
ADD A,(HL)
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S21R3
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP C,S21K1
JP S21J1
S21R3 LD C,0X00
SRL B
RET
S21G2 LD E,A
LD A,(DE)
EXX
ADD A,(HL)
LD (DE),A
INC E
S21J3 ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S21R3
S21H0 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP NC,S21J1
S21K1 ADD A,(HL)
RRA
LD (DE),A
INC E
S21L2 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP NC,S21K3
SUB (HL)
EXX
JP C,S21G3
LD L,A
LD A,(HL)
EXX
ADD A,(HL)
LD (DE),A
INC E
JR Z,S21R4
ADD A,(HL)
RRA
LD (DE),A
INC E
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP C,S21K2
JP S21J2
S21R4 LD C,0X01
SRL B
RET
S21G3 LD E,A
LD A,(DE)
EXX
ADD A,(HL)
LD (DE),A
INC E
JR Z,S21R4
S21J0 ADD A,(HL)
RRA
LD (DE),A
INC E
S21H1 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP NC,S21J2
S21K2 ADD A,(HL)
RRA
LD (DE),A
INC E
S21L3 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JR Z,S21R5
JP NC,S21K0
SUB (HL)
EXX
JP C,S21G0
LD L,A
LD A,(HL)
EXX
ADD A,(HL)
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP C,S21K3
JP S21J3
S21R5 JR NC,S21R5_2
LD C,0X02
SRL B
RET
S21R5_2 LD C,0X01
RRC B
RET
S22G0 LD E,A
LD A,(DE)
EXX
ADD A,(HL)
LD (DE),A
INC E
S22J1 ADD A,(HL)
RRA
LD (DE),A
INC E
S22H2 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
DEC IXL
JR Z,S22R2
JP NC,S22J3
S22K3 ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S22R1
S22L0 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
DEC IXL
JR Z,S22R5_3
JP NC,S22K1
SUB (HL)
EXX
JP C,S22G1
LD L,A
LD A,(HL)
EXX
ADD A,(HL)
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JR Z,S22R2
DEC IXL
JR Z,S22R2
JP C,S22K0
JP S22J0
S22R1 LD C,0X00
RRC B
RET
S22R2 LD C,0X01
JR NC,S22R2_2
RRC B
RET
S22R2_2 SRL B
RET
S22R5_3 JP S22R5
S22G1 LD E,A
LD A,(DE)
EXX
ADD A,(HL)
LD (DE),A
INC E
S22J2 ADD A,(HL)
RRA
LD (DE),A
INC E
S22H3 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JR Z,S22R2
DEC IXL
JR Z,S22R2
JP NC,S22J0
S22K0 ADD A,(HL)
RRA
LD (DE),A
INC E
S22L1 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
DEC IXL
JR Z,S22R5_3
JP NC,S22K2
SUB (HL)
EXX
JP C,S22G2
LD L,A
LD A,(HL)
EXX
ADD A,(HL)
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S22R3
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
DEC IXL
JR Z,S22R2
JP C,S22K1
JP S22J1
S22R3 LD C,0X00
SRL B
RET
S22G2 LD E,A
LD A,(DE)
EXX
ADD A,(HL)
LD (DE),A
INC E
S22J3 ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S22R3
S22H0 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
DEC IXL
JR Z,S22R2
JP NC,S22J1
S22K1 ADD A,(HL)
RRA
LD (DE),A
INC E
S22L2 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
DEC IXL
JR Z,S22R5
JP NC,S22K3
SUB (HL)
EXX
JP C,S22G3
LD L,A
LD A,(HL)
EXX
ADD A,(HL)
LD (DE),A
INC E
JR Z,S22R4
ADD A,(HL)
RRA
LD (DE),A
INC E
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
DEC IXL
JR Z,S22R2_3
JP C,S22K2
JP S22J2
S22G3 LD E,A
LD A,(DE)
EXX
ADD A,(HL)
LD (DE),A
INC E
JR Z,S22R4
S22J0 ADD A,(HL)
RRA
LD (DE),A
INC E
S22H1 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
DEC IXL
JR Z,S22R2_3
JP NC,S22J2
S22K2 ADD A,(HL)
RRA
LD (DE),A
INC E
S22L3 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JR Z,S22R5
DEC IXL
JR Z,S22R5
JP NC,S22K0
SUB (HL)
EXX
JP C,S22G0
LD L,A
LD A,(HL)
EXX
ADD A,(HL)
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
DEC IXL
JR Z,S22R2_3
JP C,S22K3
JP S22J3
S22R2_3 JP S22R2
S22R5 JR NC,S22R5_2
LD C,0X02
SRL B
RET
S22R5_2 LD C,0X01
RRC B
RET
S22R4 LD C,0X01
SRL B
RET
S23J0 SUB (HL)
EXX
JP C,S23P0
LD L,A
LD A,(HL)
EXX
ADD A,(HL)
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP C,S23J3
JP S23K3
S23P0 LD E,A
LD A,(DE)
EXX
ADD A,(HL)
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
S23H2 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP C,S23J3
S23K3 SUB (HL)
EXX
JP C,S23I3
LD L,A
LD A,(HL)
EXX
ADD A,(HL)
LD (DE),A
INC E
JR Z,S23R1
ADD A,(HL)
RRA
LD (DE),A
INC E
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP C,S23K2
JP S23G2
S23I3 LD E,A
LD A,(DE)
EXX
ADD A,(HL)
LD (DE),A
INC E
JR Z,S23R1
ADD A,(HL)
RRA
LD (DE),A
INC E
S23L1 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP C,S23K2
S23G2 ADD A,(HL)
RRA
LD (DE),A
INC E
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JR Z,S23R2
JP NC,S23K0
JP S23J0
S23R1 LD C,0X01
SRL B
RET
S23R2 LD C,0X02
JR NC,S23R2_2
RRC B
RET
S23R2_2 SRL B
RET
S23J1 SUB (HL)
EXX
JP C,S23P1
LD L,A
LD A,(HL)
EXX
ADD A,(HL)
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JR Z,S23R2
JP C,S23J0
JP S23K0
S23P1 LD E,A
LD A,(DE)
EXX
ADD A,(HL)
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
S23H3 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JR Z,S23R2
JP C,S23J0
S23K0 SUB (HL)
EXX
JP C,S23I0
LD L,A
LD A,(HL)
EXX
ADD A,(HL)
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP C,S23K3
JP S23G3
S23I0 LD E,A
LD A,(DE)
EXX
ADD A,(HL)
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
S23L2 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP C,S23K3
S23G3 ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S23R3
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP NC,S23K1
JP S23J1
S23R3 LD C,0X00
RRC B
RET
S23J2 SUB (HL)
EXX
JP C,S23P2
LD L,A
LD A,(HL)
EXX
ADD A,(HL)
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S23R3
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP C,S23J1
JP S23K1
S23P2 LD E,A
LD A,(DE)
EXX
ADD A,(HL)
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S23R3
S23H0 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP C,S23J1
S23K1 SUB (HL)
EXX
JP C,S23I1
LD L,A
LD A,(HL)
EXX
ADD A,(HL)
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JR Z,S23R4
JP C,S23K0
JP S23G0
S23I1 LD E,A
LD A,(DE)
EXX
ADD A,(HL)
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
S23L3 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JR Z,S23R4
JP C,S23K0
S23G0 ADD A,(HL)
RRA
LD (DE),A
INC E
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP NC,S23K2
JP S23J2
S23R4 JR C,S23R4_2
LD C,0X01
RRC B
RET
S23R4_2 LD C,0X02
SRL B
RET
S23R5 LD C,0X01
RRC B
RET
S23J3 SUB (HL)
EXX
JP C,S23P3
LD L,A
LD A,(HL)
EXX
ADD A,(HL)
LD (DE),A
INC E
JR Z,S23R5
ADD A,(HL)
RRA
LD (DE),A
INC E
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP C,S23J2
JP S23K2
S23P3 LD E,A
LD A,(DE)
EXX
ADD A,(HL)
LD (DE),A
INC E
JR Z,S23R5
ADD A,(HL)
RRA
LD (DE),A
INC E
S23H1 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP C,S23J2
S23K2 SUB (HL)
EXX
JP C,S23I2
LD L,A
LD A,(HL)
EXX
ADD A,(HL)
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S23R6
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP C,S23K1
JP S23G1
S23I2 LD E,A
LD A,(DE)
EXX
ADD A,(HL)
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S23R6
S23L0 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP C,S23K1
S23G1 ADD A,(HL)
RRA
LD (DE),A
INC E
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP NC,S23K3
JP S23J3
S23R6 LD C,0X00
SRL B
RET
S24J0 SUB (HL)
EXX
JP C,S24P0
LD L,A
LD A,(HL)
EXX
ADD A,(HL)
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
DEC IXL
JR Z,S24R2
JP C,S24J3
JP S24K3
S24P0 LD E,A
LD A,(DE)
EXX
ADD A,(HL)
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
S24H2 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
DEC IXL
JR Z,S24R2
JP C,S24J3
S24K3 SUB (HL)
EXX
JP C,S24I3
LD L,A
LD A,(HL)
EXX
ADD A,(HL)
LD (DE),A
INC E
JR Z,S24R1
ADD A,(HL)
RRA
LD (DE),A
INC E
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
DEC IXL
JR Z,S24R4_3
JP C,S24K2
JP S24G2
S24I3 LD E,A
LD A,(DE)
EXX
ADD A,(HL)
LD (DE),A
INC E
JR Z,S24R1
ADD A,(HL)
RRA
LD (DE),A
INC E
S24L1 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
DEC IXL
JR Z,S24R4_3
JP C,S24K2
S24G2 ADD A,(HL)
RRA
LD (DE),A
INC E
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JR Z,S24R2
DEC IXL
JR Z,S24R2
JP NC,S24K0
JP S24J0
S24R1 LD C,0X01
SRL B
RET
S24R2 LD C,0X02
JR NC,S24R2_2
RRC B
RET
S24R2_2 SRL B
RET
S24R4_3 JP S24R4
S24J1 SUB (HL)
EXX
JP C,S24P1
LD L,A
LD A,(HL)
EXX
ADD A,(HL)
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JR Z,S24R2
DEC IXL
JR Z,S24R2
JP C,S24J0
JP S24K0
S24P1 LD E,A
LD A,(DE)
EXX
ADD A,(HL)
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
S24H3 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JR Z,S24R2
DEC IXL
JR Z,S24R2
JP C,S24J0
S24K0 SUB (HL)
EXX
JP C,S24I0
LD L,A
LD A,(HL)
EXX
ADD A,(HL)
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
DEC IXL
JR Z,S24R4_3
JP C,S24K3
JP S24G3
S24I0 LD E,A
LD A,(DE)
EXX
ADD A,(HL)
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
S24L2 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
DEC IXL
JR Z,S24R4_3
JP C,S24K3
S24G3 ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S24R3
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
DEC IXL
JR Z,S24R2_5
JP NC,S24K1
JP S24J1
S24R2_5 JP S24R2
S24R3 LD C,0X00
RRC B
RET
S24J2 SUB (HL)
EXX
JP C,S24P2
LD L,A
LD A,(HL)
EXX
ADD A,(HL)
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S24R3
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
DEC IXL
JR Z,S24R2_3
JP C,S24J1
JP S24K1
S24P2 LD E,A
LD A,(DE)
EXX
ADD A,(HL)
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S24R3
S24H0 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
DEC IXL
JR Z,S24R2_3
JP C,S24J1
S24K1 SUB (HL)
EXX
JP C,S24I1
LD L,A
LD A,(HL)
EXX
ADD A,(HL)
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JR Z,S24R4
DEC IXL
JR Z,S24R4
JP C,S24K0
JP S24G0
S24I1 LD E,A
LD A,(DE)
EXX
ADD A,(HL)
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
S24L3 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JR Z,S24R4
DEC IXL
JR Z,S24R4
JP C,S24K0
S24G0 ADD A,(HL)
RRA
LD (DE),A
INC E
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
DEC IXL
JR Z,S24R2_3
JP NC,S24K2
JP S24J2
S24R4 JR C,S24R4_2
LD C,0X01
RRC B
RET
S24R4_2 LD C,0X02
SRL B
RET
S24R2_3 JP S24R2
S24R5 LD C,0X01
RRC B
RET
S24J3 SUB (HL)
EXX
JP C,S24P3
LD L,A
LD A,(HL)
EXX
ADD A,(HL)
LD (DE),A
INC E
JR Z,S24R5
ADD A,(HL)
RRA
LD (DE),A
INC E
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
DEC IXL
JR Z,S24R2_3
JP C,S24J2
JP S24K2
S24P3 LD E,A
LD A,(DE)
EXX
ADD A,(HL)
LD (DE),A
INC E
JR Z,S24R5
ADD A,(HL)
RRA
LD (DE),A
INC E
S24H1 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
DEC IXL
JR Z,S24R2_3
JP C,S24J2
S24K2 SUB (HL)
EXX
JP C,S24I2
LD L,A
LD A,(HL)
EXX
ADD A,(HL)
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S24R6
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
DEC IXL
JR Z,S24R4
JP C,S24K1
JP S24G1
S24I2 LD E,A
LD A,(DE)
EXX
ADD A,(HL)
LD (DE),A
INC E
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S24R6
S24L0 LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
DEC IXL
JR Z,S24R4_4
JP C,S24K1
S24G1 ADD A,(HL)
RRA
LD (DE),A
INC E
LD A,B
ADD A,C
LD B,A
LD A,(HL)
INC HL
LD (DE),A
INC E
DEC IXL
JR Z,S24R2_4
JP NC,S24K3
JP S24J3
S24R2_4 JP S24R2
S24R4_4 JP S24R4
S24R6 LD C,0X00
SRL B
RET
;INCLUDE "SGEN3.a80"
S3_ LD D,C
PUSH DE
LD D,B
EXX
POP BC
S31 SLA B
JP C,S318
S310 LD A,IXL
ADD A,A
JP C,S311
ADD A,IXL
JP C,S311
ADD A,E
JR Z,S310_
JP C,S311
BIT 7,B
JR Z,S310_
LD IYL,A
LD A,IXL
SRL A
SRL A
ADD A,IYL
JR Z,S310_
JP C,S311
S310_ DB 0XCB,0X31;SLI C
JP C,S3101
JP S3100
S3102 JR Z,S3104
S310A INC E
JR Z,S3105
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S31052
LD (DE),A
INC E
JR Z,S31053
S3100 LD A,C
ADD A,B
LD C,A
LD A,(HL)
INC HL
DEC IXL
LD (DE),A
JP NC,S3102
JR Z,S3106
INC E
JR Z,S3107
LD IYL,A
ADD A,(HL)
RRA
LD IYH,A
ADD A,IYL
RRA
LD (DE),A
INC E
JR Z,S3109
LD A,IYH
LD (DE),A
INC E
JR Z,S31092
ADD A,(HL)
RRA
LD (DE),A
INC E
JP NZ,S3101
JP S31093
S3103 JR Z,S3108
INC E
JR Z,S3109
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S31092
LD (DE),A
INC E
JR Z,S31093
S3101 LD A,C
ADD A,B
LD C,A
LD A,(HL)
INC HL
DEC IXL
LD (DE),A
JP NC,S3103
JP NZ,S310A
S3104 INC E
S3105 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,2
RET
S31052 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,1
RET
S31053 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,0
RET
S3106 INC E
S3107 RRC C
LD IYL,C
EXX
LD E,IYL
RET
S3108 INC E
S3109 RRC C
LD IYL,C
EXX
LD E,IYL
DEC D
RET
S31092 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,1
RET
S31093 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,0
RET
S311 DB 0XCB,0X31;SLI C
JP C,S3111
JR S3110
S3112 JR Z,S3114
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S31141
LD (DE),A
INC E
JR Z,S31142
S3110 LD A,C
ADD A,B
LD C,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP NC,S3112
JR Z,S3115
LD IYL,A
ADD A,(HL)
RRA
LD IYH,A
ADD A,IYL
RRA
LD (DE),A
INC E
JR Z,S31151
LD A,IYH
LD (DE),A
INC E
JR Z,S3116
ADD A,(HL)
RRA
LD (DE),A
INC E
JP NZ,S3111
JP S31162
S3113 JR Z,S31151
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S3116
LD (DE),A
INC E
JR Z,S31162
S3111 LD A,C
ADD A,B
LD C,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP NC,S3113
JP NZ,S3112
SRL C
LD IYL,C
EXX
LD E,IYL
LD D,2
RET
S31141 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,1
RET
S31142 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,0
RET
S3114 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,2
RET
S3115 RRC C
LD IYL,C
EXX
LD E,IYL
RET
S31151 RRC C
LD IYL,C
EXX
LD E,IYL
DEC D
RET
S3116 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,1
RET
S31162 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,0
RET
S318 LD A,IXL
ADD A,A
JP C,S319
ADD A,IXL
JP C,S319
LD IYL,A
LD A,IXL
SRL A
ADD A,IYL
JP C,S319
ADD A,E
JR Z,S318_
JP C,S319
BIT 7,B
JR Z,S318_
LD IYL,A
LD A,IXL
SRL A
SRL A
ADD A,IYL
JR Z,S318_
JP C,S319
S318_ DB 0XCB,0X31;SLI C
JP NC,S3180
JP S3181
S3184 INC E
S3185 RRC C
LD IYL,C
EXX
LD E,IYL
RET
S3182 JR Z,S3184
INC E
S31822 JR Z,S3185
S318222 LD IYL,A
ADD A,(HL)
RRA
LD IYH,A
ADD A,IYL
RRA
LD (DE),A
INC E
JR Z,S3186
LD A,IYH
LD (DE),A
INC E
JR Z,S31866
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S31867
S3181 LD A,C
ADD A,B
LD C,A
LD A,(HL)
INC HL
DEC IXL
LD (DE),A
JP C,S3182
JR Z,S31871
INC E
JR Z,S31891
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S3189
LD (DE),A
INC E
JP NZ,S3180
JP S31892
S31871 INC E
S31891 SRL C
LD IYL,C
EXX
LD E,IYL
DEC D
RET
S3183 JR Z,S3187
INC E
JR Z,S3188
LD IYL,A
ADD A,(HL)
RRA
LD IYH,A
ADD A,IYL
RRA
LD (DE),A
INC E
JR Z,S31891
LD A,IYH
LD (DE),A
INC E
JR Z,S3189
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S31892
S3180 LD A,C
ADD A,B
LD C,A
LD A,(HL)
INC HL
DEC IXL
LD (DE),A
JP C,S3183
JR Z,S31844
INC E
JP NZ,S318222
RRC C
LD IYL,C
EXX
LD E,IYL
RET
S3186 RRC C
LD IYL,C
EXX
LD E,IYL
DEC D
RET
S31866 RRC C
LD IYL,C
EXX
LD E,IYL
DEC D
DEC D
RET
S31867 RRC C
LD IYL,C
EXX
LD E,IYL
DEC D
DEC D
DEC D
RET
S31844 INC E
RRC C
LD IYL,C
EXX
LD E,IYL
RET
S3187 INC E
S3188 SRL C
LD IYL,C
EXX
LD E,IYL
RET
S3189 SRL C
LD IYL,C
EXX
LD E,IYL
DEC D
DEC D
RET
S31892 SRL C
LD IYL,C
EXX
LD E,IYL
DEC D
DEC D
DEC D
RET
S319 DB 0XCB,0X31;SLI C
JP NC,S3190
JP S3191
S3195 RRC C
LD IYL,C
EXX
LD E,IYL
RET
S3192 JR Z,S3195
LD IYL,A
ADD A,(HL)
RRA
LD IYH,A
ADD A,IYL
RRA
LD (DE),A
INC E
JR Z,S3196
LD A,IYH
LD (DE),A
INC E
JR Z,S31966
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S31967
S3191 LD A,C
ADD A,B
LD C,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP C,S3192
JR Z,S3199
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S31993
LD (DE),A
INC E
JP NZ,S3190
JP S31994
S3193 JR Z,S3198
LD IYL,A
ADD A,(HL)
RRA
LD IYH,A
ADD A,IYL
RRA
LD (DE),A
INC E
JR Z,S3199
S31933 LD A,IYH
LD (DE),A
INC E
JR Z,S31993
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S31994
S3190 LD A,C
ADD A,B
LD C,A
LD A,(HL)
INC HL
LD (DE),A
INC E
JP C,S3193
JP NZ,S3192
RRC C
LD IYL,C
EXX
LD E,IYL
RET
S3196 RRC C
LD IYL,C
EXX
LD E,IYL
DEC D
RET
S31966 RRC C
LD IYL,C
EXX
LD E,IYL
DEC D
DEC D
RET
S31967 RRC C
LD IYL,C
EXX
LD E,IYL
DEC D
DEC D
DEC D
RET
S3198 SRL C
LD IYL,C
EXX
LD E,IYL
RET
S3199 SRL C
LD IYL,C
EXX
LD E,IYL
DEC D
RET
S31993 SRL C
LD IYL,C
EXX
LD E,IYL
DEC D
DEC D
RET
S31994 SRL C
LD IYL,C
EXX
LD E,IYL
DEC D
DEC D
DEC D
RET
;INCLUDE "SGEN4.a80"
S4_ LD D,C
PUSH DE
LD D,B
EXX
POP BC
S41 SLA B
JP C,S418
DB 0XCB,0X31;SLI C
LD IYH,B
JP C,S4101
JP S4100
S4102 JR Z,S4104
S410A INC E
JR Z,S4105
LD B,A
ADD A,(HL)
RRA
LD IYL,A
ADD A,B
RRA
LD (DE),A
INC E
JR Z,S41052
LD A,IYL
LD (DE),A
INC E
JR Z,S41053
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S41054
S4100 LD A,C
ADD A,IYH
LD C,A
LD A,(HL)
INC HL
DEC IXL
LD (DE),A
JP NC,S4102
JR Z,S4106
INC E
JR Z,S4107
LD (DE),A
INC E
JP NZ,S41033
JP S4109
S4103 JR Z,S4108
INC E
JR Z,S4109
S41033 LD B,A
ADD A,(HL)
RRA
LD IYL,A
ADD A,B
RRA
LD (DE),A
INC E
JR Z,S41092
LD A,IYL
LD (DE),A
INC E
JR Z,S41093
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S41094
S4101 LD A,C
ADD A,IYH
LD C,A
LD A,(HL)
INC HL
DEC IXL
LD (DE),A
JP NC,S4103
JP NZ,S410A
S4104 INC E
S4105 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,3
RET
S41052 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,2
RET
S41053 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,1
RET
S41054 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,0
RET
S4106 INC E
S4107 RRC C
LD IYL,C
EXX
LD E,IYL
RET
S4108 INC E
S4109 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,3
RET
S41092 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,2
RET
S41093 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,1
RET
S41094 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,0
RET
S418 DB 0XCB,0X31;SLI C
JP NC,S4180
JP S4181
S4184 INC E
S4185 RRC C
LD IYL,C
EXX
LD E,IYL
RET
S41844 INC E
RRC C
LD IYL,C
EXX
LD E,IYL
RET
S4182 JR Z,S4184
INC E
S41822 JR Z,S4185
S418222 LD (DE),A
INC E
JR Z,S4186
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S41866
LD (DE),A
INC E
JR Z,S41867
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S41868
S4181 LD A,C
ADD A,B
LD C,A
LD A,(HL)
INC HL
DEC IXL
LD (DE),A
JP C,S4182
JR Z,S41871
JP S41831
S4183 JR Z,S4187
INC E
JR Z,S4188
LD (DE),A
S41831 INC E
JR Z,S4189
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S41891
LD (DE),A
INC E
JR Z,S41892
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S41893
S4180 LD A,C
ADD A,B
LD C,A
LD A,(HL)
INC HL
DEC IXL
LD (DE),A
JP C,S4183
JR Z,S41844
INC E
JP NZ,S418222
RRC C
LD IYL,C
EXX
LD E,IYL
RET
S4186 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,3
RET
S41866 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,2
RET
S41867 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,1
RET
S41868 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,0
RET
S4187 INC E
S4188 SRL C
LD IYL,C
EXX
LD E,IYL
RET
S4189 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,3
RET
S41871 INC E
S41891 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,2
RET
S41892 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,1
RET
S41893 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,0
RET
;INCLUDE "SGEN5.a80"
S5_ LD D,C
PUSH DE
LD D,B
EXX
POP BC
S51 SLA B
JP C,S518
DB 0XCB,0X31;SLI C
JP C,S5101
JP S5100
S5102 JR Z,S5104
S510A INC E
JR Z,S5105
LD IYL,A
ADD A,(HL)
RRA
LD IYH,A
ADD A,IYL
RRA
LD (DE),A
INC E
JR Z,S51052
LD A,IYH
LD (DE),A
INC E
JR Z,S51053
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S51054
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S51055
S5100 LD A,C
ADD A,B
LD C,A
LD A,(HL)
INC HL
DEC IXL
LD (DE),A
JP NC,S5102
JR Z,S5106
INC E
JR Z,S5107
LD (DE),A
DEC E
INC E
S5103 JR Z,S5108
INC E
JR Z,S5109
LD IYL,A
ADD A,(HL)
RRA
LD IYH,A
ADD A,IYL
RRA
LD (DE),A
INC E
JR Z,S51092
LD A,IYH
LD (DE),A
INC E
JR Z,S51093
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S51094
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S51095
S5101 LD A,C
ADD A,B
LD C,A
LD A,(HL)
INC HL
DEC IXL
LD (DE),A
JP NC,S5103
JP NZ,S510A
S5104 INC E
S5105 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,4
RET
S51052 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,3
RET
S51053 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,2
RET
S51054 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,1
RET
S51055 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,0
RET
S5106 INC E
S5107 RRC C
LD IYL,C
EXX
LD E,IYL
RET
S5108 INC E
S5109 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,4
RET
S51092 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,3
RET
S51093 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,2
RET
S51094 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,1
RET
S51095 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,0
RET
S518 DB 0XCB,0X31;SLI C
JP NC,S5180
JP S5181
S5184 INC E
S5185 RRC C
LD IYL,C
EXX
LD E,IYL
RET
S5186 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,4
RET
S51866 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,3
RET
S51867 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,2
RET
S51868 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,1
RET
S51869 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,0
RET
S5182 JR Z,S5184
INC E
S51822 JR Z,S5185
S518222 LD IYL,A
ADD A,(HL)
RRA
LD IYH,A
ADD A,IYL
RRA
LD (DE),A
INC E
JR Z,S5186
ADD A,IYH
RRA
LD (DE),A
INC E
JR Z,S51866
LD A,IYH
LD (DE),A
INC E
JR Z,S51867
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S51868
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S51869
S5181 LD A,C
ADD A,B
LD C,A
LD A,(HL)
INC HL
DEC IXL
LD (DE),A
JP C,S5182
JR Z,S51871
JP S51831
S5183 JR Z,S5187
INC E
JR Z,S5188
LD (DE),A
S51831 INC E
JR Z,S5189
LD IYL,A
ADD A,(HL)
RRA
LD IYH,A
ADD A,IYL
RRA
LD (DE),A
INC E
JR Z,S51891
LD A,IYH
LD (DE),A
INC E
JR Z,S51892
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S51893
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S51894
S5180 LD A,C
ADD A,B
LD C,A
LD A,(HL)
INC HL
DEC IXL
LD (DE),A
JP C,S5183
JR Z,S51844
INC E
JP NZ,S518222
RRC C
LD IYL,C
EXX
LD E,IYL
RET
S51844 INC E
RRC C
LD IYL,C
EXX
LD E,IYL
RET
S5187 INC E
S5188 SRL C
LD IYL,C
EXX
LD E,IYL
RET
S5189 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,4
RET
S51871 INC E
S51891 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,3
RET
S51892 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,2
RET
S51893 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,1
RET
S51894 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,0
RET
;INCLUDE "SGEN6.a80"
S6_ LD D,C
PUSH DE
LD D,B
EXX
POP BC
S61 SLA B
JP C,S618
DB 0XCB,0X31;SLI C
JP C,S6101
JP S6100
S61052 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,4
RET
S61053 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,3
RET
S61054 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,2
RET
S61055 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,1
RET
S61056 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,0
RET
S6102 JR Z,S6104
S610A INC E
JR Z,S6105
LD IYL,A
ADD A,(HL)
RRA
LD IYH,A
ADD A,IYL
RRA
LD (DE),A
INC E
JR Z,S61052
ADD A,IYH
RRA
LD (DE),A
INC E
JR Z,S61053
LD A,IYH
LD (DE),A
INC E
JR Z,S61054
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S61055
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S61056
S6100 LD A,C
ADD A,B
LD C,A
LD A,(HL)
INC HL
DEC IXL
LD (DE),A
JP NC,S6102
JR Z,S6106
INC E
JR Z,S6107
LD (DE),A
DEC E
INC E
S6103 JR Z,S6108
INC E
JR Z,S6109
LD IYL,A
ADD A,(HL)
RRA
LD IYH,A
ADD A,IYL
RRA
LD (DE),A
INC E
JR Z,S61092
ADD A,IYH
RRA
LD (DE),A
INC E
JR Z,S61093
LD A,IYH
LD (DE),A
INC E
JR Z,S61094
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S61095
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S61096
S6101 LD A,C
ADD A,B
LD C,A
LD A,(HL)
INC HL
DEC IXL
LD (DE),A
JP NC,S6103
JP NZ,S610A
S6104 INC E
S6105 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,5
RET
S6106 INC E
S6107 RRC C
LD IYL,C
EXX
LD E,IYL
RET
S6108 INC E
S6109 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,5
RET
S61092 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,4
RET
S61093 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,3
RET
S61094 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,2
RET
S61095 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,1
RET
S61096 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,0
RET
S618 DB 0XCB,0X31;SLI C
JP NC,S6180
JP S6181
S6184 INC E
S6185 RRC C
LD IYL,C
EXX
LD E,IYL
RET
S6186 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,5
RET
S61866 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,4
RET
S61867 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,3
RET
S61868 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,2
RET
S61869 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,1
RET
S6186A RRC C
LD IYL,C
EXX
LD E,IYL
LD D,0
RET
S6182 JR Z,S6184
INC E
S61822 JR Z,S6185
S618222 LD (DE),A
INC E
JR Z,S6186
LD IYL,A
ADD A,(HL)
RRA
LD IYH,A
ADD A,IYL
RRA
LD (DE),A
INC E
JR Z,S61866
ADD A,IYH
RRA
LD (DE),A
INC E
JR Z,S61867
LD A,IYH
LD (DE),A
INC E
JR Z,S61868
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S61869
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S6186A
S6181 LD A,C
ADD A,B
LD C,A
LD A,(HL)
INC HL
DEC IXL
LD (DE),A
JP C,S6182
JR Z,S61871
JP S61831
S6183 JR Z,S6187
INC E
JR Z,S6188
LD (DE),A
S61831 INC E
JR Z,S6189
LD IYL,A
ADD A,(HL)
RRA
LD IYH,A
ADD A,IYL
RRA
LD (DE),A
INC E
JR Z,S61891
ADD A,IYH
RRA
LD (DE),A
INC E
JR Z,S61892
LD A,IYH
LD (DE),A
INC E
JR Z,S61893
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S61894
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S61895
S6180 LD A,C
ADD A,B
LD C,A
LD A,(HL)
INC HL
DEC IXL
LD (DE),A
JP C,S6183
JR Z,S61844
INC E
JP NZ,S618222
RRC C
LD IYL,C
EXX
LD E,IYL
RET
S61844 INC E
RRC C
LD IYL,C
EXX
LD E,IYL
RET
S6187 INC E
S6188 SRL C
LD IYL,C
EXX
LD E,IYL
RET
S6189 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,5
RET
S61871 INC E
S61891 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,4
RET
S61892 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,3
RET
S61893 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,2
RET
S61894 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,1
RET
S61895 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,0
RET
;INCLUDE "SGEN7.a80"
S7_ LD D,C
PUSH DE
LD D,B
EXX
POP BC
S71 SLA B
JP C,S718
DB 0XCB,0X31;SLI C
JP C,S7101
JP S7100
S71052 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,5
RET
S71053 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,4
RET
S71054 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,3
RET
S71055 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,2
RET
S71056 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,1
RET
S71057 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,0
RET
S7102 JR Z,S7104
S710A INC E
JR Z,S7105
LD (DE),A
INC E
JR Z,S71052
LD IYL,A
ADD A,(HL)
RRA
LD IYH,A
ADD A,IYL
RRA
LD (DE),A
INC E
JR Z,S71053
ADD A,IYH
RRA
LD (DE),A
INC E
JR Z,S71054
LD A,IYH
LD (DE),A
INC E
JR Z,S71055
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S71056
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S71057
S7100 LD A,C
ADD A,B
LD C,A
LD A,(HL)
INC HL
DEC IXL
LD (DE),A
JP NC,S7102
JR Z,S7106
INC E
JR Z,S7107
LD (DE),A
DEC E
INC E
S7103 JR Z,S7108
INC E
JR Z,S7109
LD (DE),A
INC E
JR Z,S71092
LD IYL,A
ADD A,(HL)
RRA
LD IYH,A
ADD A,IYL
RRA
LD (DE),A
INC E
JR Z,S71093
ADD A,IYH
RRA
LD (DE),A
INC E
JR Z,S71094
LD A,IYH
LD (DE),A
INC E
JR Z,S71095
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S71096
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S71097
S7101 LD A,C
ADD A,B
LD C,A
LD A,(HL)
INC HL
DEC IXL
LD (DE),A
JP NC,S7103
JP NZ,S710A
S7104 INC E
S7105 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,6
RET
S7106 INC E
S7107 RRC C
LD IYL,C
EXX
LD E,IYL
RET
S7108 INC E
S7109 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,6
RET
S71092 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,5
RET
S71093 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,4
RET
S71094 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,3
RET
S71095 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,2
RET
S71096 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,1
RET
S71097 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,0
RET
S718 DB 0XCB,0X31;SLI C
JP NC,S7180
JP S7181
S7184 INC E
S7185 RRC C
LD IYL,C
EXX
LD E,IYL
RET
S7186 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,6
RET
S71866 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,5
RET
S71867 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,4
RET
S71868 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,3
RET
S71869 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,2
RET
S7186A RRC C
LD IYL,C
EXX
LD E,IYL
LD D,1
RET
S7186B RRC C
LD IYL,C
EXX
LD E,IYL
LD D,0
RET
S7182 JR Z,S7184
INC E
S71822 JR Z,S7185
S718222 LD (DE),A
INC E
JR Z,S7186
LD IYL,A
ADD A,(HL)
RRA
LD IYH,A
ADD A,IYL
RRA
LD (DE),A
INC E
JR Z,S71866
ADD A,IYH
RRA
LD (DE),A
INC E
JR Z,S71867
LD A,IYH
LD (DE),A
INC E
JR Z,S71868
LD (DE),A
INC E
JR Z,S71869
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S7186A
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S7186B
S7181 LD A,C
ADD A,B
LD C,A
LD A,(HL)
INC HL
DEC IXL
LD (DE),A
JP C,S7182
JR Z,S71871
JP S71831
S7183 JR Z,S7187
INC E
JR Z,S7188
LD (DE),A
S71831 INC E
JR Z,S7189
LD IYL,A
ADD A,(HL)
RRA
LD IYH,A
ADD A,IYL
RRA
LD (DE),A
INC E
JR Z,S71891
ADD A,IYH
RRA
LD (DE),A
INC E
JR Z,S71892
LD A,IYH
LD (DE),A
INC E
JR Z,S71893
LD (DE),A
INC E
JR Z,S71894
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S71895
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S71896
S7180 LD A,C
ADD A,B
LD C,A
LD A,(HL)
INC HL
DEC IXL
LD (DE),A
JP C,S7183
JR Z,S71844
INC E
JP NZ,S718222
RRC C
LD IYL,C
EXX
LD E,IYL
RET
S71844 INC E
RRC C
LD IYL,C
EXX
LD E,IYL
RET
S7187 INC E
S7188 SRL C
LD IYL,C
EXX
LD E,IYL
RET
S7189 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,6
RET
S71871 INC E
S71891 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,5
RET
S71892 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,4
RET
S71893 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,3
RET
S71894 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,2
RET
S71895 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,1
RET
S71896 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,0
RET
;INCLUDE "SGEN8.a80"
S8_ LD D,C
PUSH DE
LD D,B
EXX
POP BC
S81 SLA B
JP C,S818
DB 0XCB,0X31;SLI C
JP C,S8101
JP S8100
S81052 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,6
RET
S81053 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,5
RET
S81054 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,4
RET
S81055 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,3
RET
S81056 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,2
RET
S81057 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,1
RET
S81058 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,0
RET
S8102 JP Z,S8104
S810A INC E
JP Z,S8105
LD (DE),A
INC E
JR Z,S81052
LD IYL,A
ADD A,(HL)
RRA
LD IYH,A
ADD A,IYL
RRA
LD (DE),A
INC E
JR Z,S81053
ADD A,IYH
RRA
LD (DE),A
INC E
JR Z,S81054
LD A,IYH
LD (DE),A
INC E
JR Z,S81055
LD (DE),A
INC E
JR Z,S81056
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S81057
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S81058
S8100 LD A,C
ADD A,B
LD C,A
LD A,(HL)
INC HL
DEC IXL
LD (DE),A
JP NC,S8102
JR Z,S8106
INC E
JR Z,S8107
LD (DE),A
DEC E
INC E
S8103 JR Z,S8108
INC E
JR Z,S8109
LD (DE),A
INC E
JR Z,S81092
LD IYL,A
ADD A,(HL)
RRA
LD IYH,A
ADD A,IYL
RRA
LD (DE),A
INC E
JR Z,S81093
ADD A,IYH
RRA
LD (DE),A
INC E
JR Z,S81094
LD A,IYH
LD (DE),A
INC E
JR Z,S81095
LD (DE),A
INC E
JR Z,S81096
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S81097
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S81098
S8101 LD A,C
ADD A,B
LD C,A
LD A,(HL)
INC HL
DEC IXL
LD (DE),A
JP NC,S8103
JP NZ,S810A
S8104 INC E
S8105 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,7
RET
S8106 INC E
S8107 RRC C
LD IYL,C
EXX
LD E,IYL
RET
S8108 INC E
S8109 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,7
RET
S81092 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,6
RET
S81093 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,5
RET
S81094 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,4
RET
S81095 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,3
RET
S81096 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,2
RET
S81097 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,1
RET
S81098 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,0
RET
S818 DB 0XCB,0X31;SLI C
JP NC,S8180
JP S8181
S8184 INC E
S8185 RRC C
LD IYL,C
EXX
LD E,IYL
RET
S8186 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,7
RET
S81866 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,6
RET
S81867 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,5
RET
S81868 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,4
RET
S81869 RRC C
LD IYL,C
EXX
LD E,IYL
LD D,3
RET
S8186A RRC C
LD IYL,C
EXX
LD E,IYL
LD D,2
RET
S8186B RRC C
LD IYL,C
EXX
LD E,IYL
LD D,1
RET
S8186C RRC C
LD IYL,C
EXX
LD E,IYL
LD D,0
RET
S8182 JR Z,S8184
INC E
S81822 JR Z,S8185
S818222 LD (DE),A
INC E
JR Z,S8186
LD IYL,A
ADD A,(HL)
RRA
LD IYH,A
ADD A,IYL
RRA
LD (DE),A
INC E
JR Z,S81866
ADD A,IYH
RRA
LD (DE),A
INC E
JR Z,S81867
LD (DE),A
INC E
JR Z,S81868
LD A,IYH
LD (DE),A
INC E
JR Z,S81869
LD (DE),A
INC E
JR Z,S8186A
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S8186B
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S8186C
S8181 LD A,C
ADD A,B
LD C,A
LD A,(HL)
INC HL
DEC IXL
LD (DE),A
JP C,S8182
JR Z,S81871
JP S81831
S8183 JR Z,S8187
INC E
JR Z,S8188
LD (DE),A
S81831 INC E
JR Z,S8189
LD IYL,A
ADD A,(HL)
RRA
LD IYH,A
ADD A,IYL
RRA
LD (DE),A
INC E
JR Z,S81891
ADD A,IYH
RRA
LD (DE),A
INC E
JR Z,S81892
LD (DE),A
INC E
JR Z,S81893
LD A,IYH
LD (DE),A
INC E
JR Z,S81894
LD (DE),A
INC E
JR Z,S81895
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S81896
ADD A,(HL)
RRA
LD (DE),A
INC E
JR Z,S81897
S8180 LD A,C
ADD A,B
LD C,A
LD A,(HL)
INC HL
DEC IXL
LD (DE),A
JP C,S8183
JR Z,S81844
INC E
JP NZ,S818222
RRC C
LD IYL,C
EXX
LD E,IYL
RET
S81844 INC E
RRC C
LD IYL,C
EXX
LD E,IYL
RET
S8187 INC E
S8188 SRL C
LD IYL,C
EXX
LD E,IYL
RET
S8189 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,7
RET
S81871 INC E
S81891 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,6
RET
S81892 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,5
RET
S81893 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,4
RET
S81894 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,3
RET
S81895 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,2
RET
S81896 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,1
RET
S81897 SRL C
LD IYL,C
EXX
LD E,IYL
LD D,0
RET
;___END
; ENDMODULE
ORG GSRomBaseL+0X3E00
DIVTAB3
;INCLUDE "_DIVTAB3.a80" 0X10*0X20=0X200
DB 0X00,0X01,0X01,0X02,0X03,0X03,0X04,0X05,0X05,0X06,0X07,0X07,0X08,0X09,0X09,0X0A
DB 0X0B,0X0B,0X0C,0X0D,0X0D,0X0E,0X0F,0X0F,0X10,0X11,0X11,0X12,0X13,0X13,0X14,0X15
DB 0X15,0X16,0X17,0X17,0X18,0X19,0X19,0X1A,0X1B,0X1B,0X1C,0X1D,0X1D,0X1E,0X1F,0X1F
DB 0X20,0X21,0X21,0X22,0X23,0X23,0X24,0X25,0X25,0X26,0X27,0X27,0X28,0X29,0X29,0X2A
DB 0X2B,0X2B,0X2C,0X2D,0X2D,0X2E,0X2F,0X2F,0X30,0X31,0X31,0X32,0X33,0X33,0X34,0X35
DB 0X35,0X36,0X37,0X37,0X38,0X39,0X39,0X3A,0X3B,0X3B,0X3C,0X3D,0X3D,0X3E,0X3F,0X3F
DB 0X40,0X41,0X41,0X42,0X43,0X43,0X44,0X45,0X45,0X46,0X47,0X47,0X48,0X49,0X49,0X4A
DB 0X4B,0X4B,0X4C,0X4D,0X4D,0X4E,0X4F,0X4F,0X50,0X51,0X51,0X52,0X53,0X53,0X54,0X55
DB 0X55,0X56,0X57,0X57,0X58,0X59,0X59,0X5A,0X5B,0X5B,0X5C,0X5D,0X5D,0X5E,0X5F,0X5F
DB 0X60,0X61,0X61,0X62,0X63,0X63,0X64,0X65,0X65,0X66,0X67,0X67,0X68,0X69,0X69,0X6A
DB 0X6B,0X6B,0X6C,0X6D,0X6D,0X6E,0X6F,0X6F,0X70,0X71,0X71,0X72,0X73,0X73,0X74,0X75
DB 0X75,0X76,0X77,0X77,0X78,0X79,0X79,0X7A,0X7B,0X7B,0X7C,0X7D,0X7D,0X7E,0X7F,0X7F
DB 0X80,0X81,0X81,0X82,0X83,0X83,0X84,0X85,0X85,0X86,0X87,0X87,0X88,0X89,0X89,0X8A
DB 0X8B,0X8B,0X8C,0X8D,0X8D,0X8E,0X8F,0X8F,0X90,0X91,0X91,0X92,0X93,0X93,0X94,0X95
DB 0X95,0X96,0X97,0X97,0X98,0X99,0X99,0X9A,0X9B,0X9B,0X9C,0X9D,0X9D,0X9E,0X9F,0X9F
DB 0XA0,0XA1,0XA1,0XA2,0XA3,0XA3,0XA4,0XA5,0XA5,0XA6,0XA7,0XA7,0XA8,0XA9,0XA9,0XAA
DB 0X55,0X56,0X57,0X57,0X58,0X59,0X59,0X5A,0X5B,0X5B,0X5C,0X5D,0X5D,0X5E,0X5F,0X5F
DB 0X60,0X61,0X61,0X62,0X63,0X63,0X64,0X65,0X65,0X66,0X67,0X67,0X68,0X69,0X69,0X6A
DB 0X6B,0X6B,0X6C,0X6D,0X6D,0X6E,0X6F,0X6F,0X70,0X71,0X71,0X72,0X73,0X73,0X74,0X75
DB 0X75,0X76,0X77,0X77,0X78,0X79,0X79,0X7A,0X7B,0X7B,0X7C,0X7D,0X7D,0X7E,0X7F,0X7F
DB 0X80,0X81,0X81,0X82,0X83,0X83,0X84,0X85,0X85,0X86,0X87,0X87,0X88,0X89,0X89,0X8A
DB 0X8B,0X8B,0X8C,0X8D,0X8D,0X8E,0X8F,0X8F,0X90,0X91,0X91,0X92,0X93,0X93,0X94,0X95
DB 0X95,0X96,0X97,0X97,0X98,0X99,0X99,0X9A,0X9B,0X9B,0X9C,0X9D,0X9D,0X9E,0X9F,0X9F
DB 0XA0,0XA1,0XA1,0XA2,0XA3,0XA3,0XA4,0XA5,0XA5,0XA6,0XA7,0XA7,0XA8,0XA9,0XA9,0XAA
DB 0XAB,0XAB,0XAC,0XAD,0XAD,0XAE,0XAF,0XAF,0XB0,0XB1,0XB1,0XB2,0XB3,0XB3,0XB4,0XB5
DB 0XB5,0XB6,0XB7,0XB7,0XB8,0XB9,0XB9,0XBA,0XBB,0XBB,0XBC,0XBD,0XBD,0XBE,0XBF,0XBF
DB 0XC0,0XC1,0XC1,0XC2,0XC3,0XC3,0XC4,0XC5,0XC5,0XC6,0XC7,0XC7,0XC8,0XC9,0XC9,0XCA
DB 0XCB,0XCB,0XCC,0XCD,0XCD,0XCE,0XCF,0XCF,0XD0,0XD1,0XD1,0XD2,0XD3,0XD3,0XD4,0XD5
DB 0XD5,0XD6,0XD7,0XD7,0XD8,0XD9,0XD9,0XDA,0XDB,0XDB,0XDC,0XDD,0XDD,0XDE,0XDF,0XDF
DB 0XE0,0XE1,0XE1,0XE2,0XE3,0XE3,0XE4,0XE5,0XE5,0XE6,0XE7,0XE7,0XE8,0XE9,0XE9,0XEA
DB 0XEB,0XEB,0XEC,0XED,0XED,0XEE,0XEF,0XEF,0XF0,0XF1,0XF1,0XF2,0XF3,0XF3,0XF4,0XF5
DB 0XF5,0XF6,0XF7,0XF7,0XF8,0XF9,0XF9,0XFA,0XFB,0XFB,0XFC,0XFD,0XFD,0XFE,0XFF,0XFF
___LEND
; HIGH ROM INCLUDES
PHASE GSRomBaseH
;INCLUDE "INIT_H.a80"
INITVAR DI
;---patched
CALL Patch5i1
;---
EX AF,AF'
LD A,(NUMPG)
LD SP,0X8000
LD HL,0X8080
LD B,0X00
INITV00 REPT 16
PUSH HL
ENDM
DJNZ INITV00
LD HL,0X0000
LD B,0XFC;0XFE ; ОЧИЩАТЬ ПАМЯТЬ НЕ НИЖЕ 00X4080 ЧТОБЫ НЕ УНИЧТОЖАТЬ ТАБЛИЦУ СТРАНИЦ
INITV01 REPT 16
PUSH HL
ENDM
DJNZ INITV01
LD SP,ISTACK
LD (NUMPG),A
EX AF,AF'
;---patched
CALL Patch5i2
;---
LD A,0X00
LD (INFO),A
XOR A
LD (ROMPG),A
LD HL,DAC0
LD A,(HL)
INC H
LD A,(HL)
INC H
LD A,(HL)
INC H
LD A,(HL)
LD A,0X3F
OUT (VOL1),A
OUT (VOL2),A
OUT (VOL3),A
OUT (VOL4),A
LD HL,CHNVOL
LD DE,CHNVOL+1
LD BC,0X0007
LD (HL),0XBF
LDIR
LD A,HIGH (INTTAB)
LD I,A
LD HL,INT7
LD DE,INTAREA
LD BC,0X0017
LDIR
EX DE,HL
LD (HL),0XC3
INC L
LD (HL),LOW (INT7)
INC L
LD (HL),HIGH (INT7)
LD HL,QTMAP
LD (QTFREE),HL
LD (QTBUSY),HL
LD DE,QTMAP+1
LD BC,0X001F
LD (HL),B
LDIR
LD HL,VOLTAB
LD DE,VOLTAB+1
LD BC,0X001F
LD (HL),0X3F
LDIR
LD HL,VOLRQTB
LD DE,VOLRQTB+1
LD BC,0X0007
LD (HL),0X3F
LDIR
LD A,0X0F
LD (GSCHNS),A
LD (MTCHNS),A
LD A,0X40
LD (MODVOL),A
LD (FXMVOL),A
LD (FXVOL),A
LD A,%11000011
LD (MTSTAT),A
XOR A
LD (MODULE),A
LD A,(NUMPG)
SRL A
LD B,A
LD HL,0X8000
RR H
LD A,B
LD (RAMTOP),HL
LD (RAMTOP+2),A
LD (PTRC),HL
LD (PTRC+2),A
LD (PTRB),HL
LD (PTRB+2),A
LD (PTRA),HL
LD (PTRA+2),A
LD (PTR9),HL
LD (PTR9+2),A
LD (PTR8),HL
LD (PTR8+2),A
LD (PTR7),HL
LD (PTR7+2),A
LD (PTR6),HL
LD (PTR6+2),A
LD (PTR5),HL
LD (PTR5+2),A
LD (MEMTOP),HL
LD (MEMTOP+2),A
LD (PTR4),HL
LD (PTR4+2),A
LD IY,CHANSFX
LD (CURCHAN),IY
LD BC,0X0801
LD DE,CHANLEN
INITV03 LD (IY+CHSTAT),0X40
LD (IY+CHRDR),C
LD (IY+CHRDRI),C
LD A,0X08
SUB B
LD (IY+CHRDN),A
AND 0X02
JR Z,INITV05
SET 5,(IY+CHSTAT)
INITV05 LD (IY+CHFLAGS),0X00
LD (IY+CHPORT),0X01
LD (IY+CHVIBCM),0X11
LD (IY+CHTRMCM),0X11
LD (IY+CHOFFST),0X01
LD (IY+CHWNT),0X7F
LD (IY+CHOLDV),0X80
LD (IY+CHEPAN),0X20
LD (IY+CHEVOL),0X40
RLC C
ADD IY,DE
DJNZ INITV03
LD IY,CHANS
LD B,0X08
INITV04 LD (IY+CHSTAT),0X00
LD (IY+CHFLAGS),0X00
LD (IY+CHPORT),0X01
LD (IY+CHVIBCM),0X11
LD (IY+CHTRMCM),0X11
LD (IY+CHOFFST),0X01
LD (IY+CHWNT),0X7F
LD (IY+CHOLDV),0X80
LD (IY+CHEPAN),0X20
LD (IY+CHEVOL),0X40
ADD IY,DE
DJNZ INITV04
LD IY,CHANS
LD (IY+CHSTAT),0X00
LD (IY+CHRDR),0X01
LD (IY+CHRDRI),0X01
LD (IY+CHRDN),0X00
ADD IY,DE
LD (IY+CHSTAT),0X20
LD (IY+CHRDR),0X04
LD (IY+CHRDRI),0X04
LD (IY+CHRDN),0X02
ADD IY,DE
LD (IY+CHSTAT),0X20
LD (IY+CHRDR),0X08
LD (IY+CHRDRI),0X08
LD (IY+CHRDN),0X03
ADD IY,DE
LD (IY+CHSTAT),0X00
LD (IY+CHRDR),0X02
LD (IY+CHRDRI),0X02
LD (IY+CHRDN),0X01
LD HL,750
LD (TICKLEN),HL
LD (TCKLEFT),HL
LD (FXTICK),HL
LD (FXTCLEN),HL
LD IXH,0X80
LD DE,0X0000
IN A,(ZXDATRD)
JP COMINT
; B - NUMBER OF CHANNELS
INITCHN LD HL,(0XEC60)
LD (IY+CHPERL),L ; C-4
LD (IY+CHPERH),H
LD HL,(0XE060)
LD (IY+CHFRQL),L
LD (IY+CHFRQH),H
LD (IY+CHNOTE),48
LD (IY+CHFLAGS),0X00
LD (IY+CHREAL),0X7F
LD (IY+CHCNTL),0X00
LD (IY+CHCNTH),0X00
LD (IY+CHINS),0X00
LD (IY+CHSMP),0X00
LD (IY+CHCOM),0X00
LD (IY+CHPARM),0X00
LD (IY+CHVIBPS),0X00
LD (IY+CHTRMPS),0X00
LD (IY+CHPATPS),0X00
LD (IY+CHLPCNT),0X00
LD A,B
LD BC,CHANLEN
ADD IY,BC
LD B,A
DJNZ INITCHN
RET
;INCLUDE "COM_H.a80"
HGET IN A,(ZXSTAT)
AND 0X81
JR Z,HGET
IN A,(ZXDATRD)
RET M
JP COMINT
HSEND IN A,(ZXSTAT)
OR A
RET P
RRCA
JP NC,HSEND
JP COMINT
HTAIL LD HL,HTAIL2
HTAIL2 IN A,(ZXSTAT)
AND 0X81
JR Z,HTAIL2
RRCA
JR C,HTAIL3
IN A,(ZXDATRD)
JP (HL)
HTAIL3 IN A,(ZXCMD)
CP 0XE0
JP NC,COMINT
CP 0XD0
JP C,COMINT
JR Z,HTAIL5
CP 0XD1
JR Z,HTAIL6
XOR A
HTAIL4 OUT (ZXDATWR),A
IN A,(ZXDATRD)
HTAIL6 OUT (CLRCBIT),A
JP (HL)
HTAIL5 LD A,(ERRCODE)
JR HTAIL4
ERR30
ERR20
ERR10 LD A,0X10 ;NOT ENOUGH FREE SPACE
JR ERR
ERR11 LD A,0X11 ;NOT ENOUGH FREE ENTRIES
JR ERR
ERR LD (ERRCODE),A
JP COMINT
;Get total RAM
;Получить общий объем доступной памяти на GS. (В базовой версии это 112к)
COM20 LD DE,(RAMBOT)
LD A,(RAMBOT+2)
LD C,A
LD HL,(RAMTOP)
LD A,(RAMTOP+2)
OR A
SBC HL,DE
SBC A,C
LD C,A
LD A,L
OUT (ZXDATWR),A
OUT (CLRCBIT),A
CALL HSEND
LD A,H
OUT (ZXDATWR),A
CALL HSEND
LD A,C
OUT (ZXDATWR),A
RET
;Get free RAM
;Получить общий об'ем свободной памяти на GS.
COM21 LD DE,(MEMBOT)
LD A,(MEMBOT+2)
LD C,A
LD HL,(MEMTOP)
LD A,(MEMTOP+2)
OR A
SBC HL,DE
SBC A,C
LD C,A
LD A,L
OUT (ZXDATWR),A
OUT (CLRCBIT),A
XOR A
LD (ERRCODE),A
CALL HSEND
LD A,H
OUT (ZXDATWR),A
CALL HSEND
LD A,C
OUT (ZXDATWR),A
RET
;Get free RAM
;Получить общий об'ем свободной памяти на GS.
COM22 IN A,(ZXDATRD)
LD E,A
LD D,HIGH (RAMPG)
LD A,(DE)
OUT (ZXDATWR),A
OUT (CLRCBIT),A
RET
;Get number of RAM Pages
;Получить число страниц на GS.
COM23 LD A,(NUMPG)
OUT (ZXDATWR),A
OUT (CLRCBIT),A
RET
;Set Module Master Volume
;Установить громкость проигрывания модулей.
COM2A LD A,(MODVOL)
OUT (ZXDATWR),A
IN A,(ZXDATRD)
OUT (CLRCBIT),A
CP 0X40
JR C,COM2A_
LD A,0X40
COM2A_ LD (MODVOL),A
LD IY,CHANS
LD B,0X08
LD DE,CHANLEN
COM2A__ SET 0,(IY+CHSTAT)
ADD IY,DE
DJNZ COM2A__
RET
;Set FX Master Volume
;Установить громкость проигрывания эффектов.
COM2B LD A,(FXVOL)
OUT (ZXDATWR),A
IN A,(ZXDATRD)
OUT (CLRCBIT),A
CP 0X40
JR C,COM2B_
LD A,0X40
COM2B_ LD (FXVOL),A
LD IY,CHANSFX
LD B,0X08
LD DE,CHANLEN
COM2B__ SET 0,(IY+CHSTAT)
ADD IY,DE
DJNZ COM2B__
RET
COM2C LD A,(CURMOD)
OUT (ZXDATWR),A
IN A,(ZXDATRD)
OUT (CLRCBIT),A
OR A
JR Z,COM2C_
LD B,A
LD A,(CNTMOD)
CP B
JR C,COM2C__
LD A,B
LD (CURMOD),A
RET
COM2C_ LD A,(CNTMOD)
LD (CURMOD),A
RET
COM2C__ XOR A
LD (CURMOD),A
RET
COM2D LD A,(CURSMP)
OUT (ZXDATWR),A
IN A,(ZXDATRD)
OUT (CLRCBIT),A
OR A
JR Z,COM2D_
LD B,A
LD A,(CNTSMP)
CP B
JR C,COM2D__
LD A,B
LD (CURSMP),A
RET
COM2D_ LD A,(CNTSMP)
LD (CURSMP),A
RET
COM2D__ XOR A
LD (CURSMP),A
RET
;Set Current FX
;Установить текущий эффект. Просто присваивает переменной CURFX это зна-
;чение. Если какая-либо команда требует номер сэмпла (sample handle), то
;можно вместо этого номера подать ей 0X00 и интерпретатор подставит вмес-
;то этого нуля значение переменной CURFX. (См. команды 0X38, 0X39, 0X40-0X4F
;для понимания вышеизложенного.)
COM2E LD A,(CURFX)
OUT (ZXDATWR),A
IN A,(ZXDATRD)
OUT (CLRCBIT),A
OR A
JR Z,COM2E_
LD B,A
LD A,(CNTFX)
CP B
JR C,COM2E__
LD A,B
LD (CURFX),A
RET
COM2E_ LD A,(CNTFX)
LD (CURFX),A
RET
COM2E__ XOR A
LD (CURFX),A
RET
COM2F IN A,(ZXDATRD)
OUT (CLRCBIT),A
LD E,A
CALL HGET
LD D,A
OR E
JR Z,COM2F_
LD HL,(CNTTRK)
SBC HL,DE
JR C,COM2F__
LD (CURTRK),DE
RET
COM2F_ LD HL,(CNTTRK)
LD (CURTRK),HL
RET
COM2F__ LD HL,0X0000
LD (CURTRK),HL
RET
;Load Module
;Загрузка модуля в память.
COM30 LD A,(CNTMOD)
OR A
JP NZ,INITVAR
INC A
LD (CNTMOD),A
LD (CURMOD),A
OUT (ZXDATWR),A
IN A,(ZXDATRD)
OUT (CLRCBIT),A
LD C,0X00
CALL LOAD
LDMOD LD A,0X00 ;0XC3F8
LD (CONVERT),A
;---patched
CALL Patch5x
;---
RET
;Jump to position (*)
;Делает переход на заданную позицию.
COM65 IN A,(ZXDATRD)
LD C,A
LD A,(CURMOD)
LD B,A
JP COM65_
;Play module
;Проигрывание модуля.
COM31 IN A,(ZXDATRD)
OR A
JR NZ,COM31_
LD A,(CURMOD)
OR A
JP Z,COM31_1
COM31_ LD B,A
LD A,(CNTMOD)
CP B
JP C,COM31_2
LD A,B
LD C,0X00
COM65_ OUT (ZXDATWR),A
OUT (CLRCBIT),A
PLAYMOD LD A,(BUSY) ;0XC426
PUSH AF
LD A,0XFF
LD (BUSY),A
LD A,B
LD (MODULE),A
LD (CURMOD),A
LD A,%00000011
LD (MTSTAT),A
LD A,0X06
LD (MTSPEED),A
LD A,C
LD (MTSNGPS),A
XOR A
LD (MTFLAGS),A
LD (MTCOUNT),A
LD (MTPATPS),A
LD (MTPDT),A
LD (MTPDT2),A
LD (MTBRKFL),A
LD (MTBRKPS),A
LD (MTJMPFL),A
INC A
LD (MTTYPE),A
LD A,0X40
LD (MTVOL),A
DEC A
LD (MTROWS),A
LD A,125
CALL FXF
LD IY,CHANS
LD B,0X08
LD DE,CHANLEN
COM31__ RES 7,(IY+CHSTAT)
SET 0,(IY+CHSTAT)
LD (IY+CHVOL),0X40
LD (IY+CHMVOL),0X40
ADD IY,DE
DJNZ COM31__
CALL INITPAT
CALL EFXGTNT
LD A,0XFF
LD (PROCESS),A
POP AF
LD (BUSY),A
RET
COM31_1
COM31_2 XOR A
LD (CURMOD),A
OUT (ZXDATWR),A
OUT (CLRCBIT),A
RET
;Stop module
;Остановить проигрывание модуля.
COM32 LD A,(MODULE)
OUT (ZXDATWR),A
IN A,(ZXDATRD)
OUT (CLRCBIT),A
STOPMOD LD HL,MTSTAT ;0XC4AE
SET 7,(HL)
RET
;Continue module
;Продолжить проигрывание модуля после остановки.
COM33 LD A,(MODULE)
OUT (ZXDATWR),A
IN A,(ZXDATRD)
OUT (CLRCBIT),A
CONTMOD LD A,(MODULE) ;0XC4BD
OR A
RET Z
LD HL,MTSTAT
BIT 6,(HL)
RET NZ
LD A,0XFF
LD (PROCESS),A
RES 7,(HL)
LD (PROCESS),A
RET
COM34 LD A,(MODFADE)
OUT (ZXDATWR),A
IN A,(ZXDATRD)
OUT (CLRCBIT),A
LD (MODFADE),A
RET
;Set Module Volume
;Установить громкость проигрывания модулей.
COM35 LD A,(MTVOL)
OUT (ZXDATWR),A
IN A,(ZXDATRD)
OUT (CLRCBIT),A
CP 0X40
JR C,COM35_
LD A,0X40
COM35_ LD (MTVOL),A
LD IY,CHANS
LD B,0X08
LD DE,CHANLEN
COM35__ SET 0,(IY+CHSTAT)
ADD IY,DE
DJNZ COM35__
RET
;Data on (*)
;Устанавливает регистр данных в 0XFF.
COM36 LD A,0XFF
OUT (ZXDATWR),A
OUT (CLRCBIT),A
RET
;Reinitialisation (*)
;Переустанавливает внутренние переменные в исходное состояние.
COM37 OUT (CLRCBIT),A
LD HL,MTSTAT
SET 7,(HL)
LD HL,0X0000
XOR A
LD (CURADR),HL
LD (CURADR+2),A
LD (MEMBOT),HL
LD (MEMBOT+2),A
LD (CURMOD),A
LD (CNTMOD),A
LD (MODULE),A
RET
;Load FX (Extended version)
;Загрузка сэмпла эффекта в память. Позволяет загружать сэмплы со знаком.
COM3E IN A,(ZXDATRD)
CP 0X01
JR Z,COM38
LD IXL,0X80
OR A
JR Z,COM38_
XOR A
OUT (ZXDATWR),A
IN A,(ZXDATRD)
OUT (CLRCBIT),A
RET
;Load FX
;Загрузка сэмпла эффекта в память. Загружает беззнаковые сэмплы (PC type)
COM38 LD IXL,0X00
COM38_ LD A,(CNTFX)
CP 60
JP NC,COM38_9
INC A
OUT (ZXDATWR),A
PUSH AF
IN A,(ZXDATRD)
OUT (CLRCBIT),A
POP AF
LD (CNTFX),A
LD (CURFX),A
CALL GETFX
PUSH HL
POP IY
LD E,L
LD D,H
INC DE
LD BC,0X003F
LD (HL),B
LDIR
LD HL,(CURADR)
LD A,(CURADR+2)
LD (IY+8),L
LD (IY+9),H
LD (IY+10),A
LD C,IXL
CALL LOAD
LD A,(CURADR)
SUB (IY+8)
LD (IY+11),A
LD (IY+17),A
LD A,(CURADR+1)
SBC A,(IY+9)
LD (IY+12),A
LD (IY+18),A
LD A,(CURADR+2)
SBC A,(IY+10)
LD (IY+13),A
LD (IY+19),A
LD (IY+16),0XFF
LD (IY+20),0X40
LD (IY+23),0X80
LD (IY+24),0X0F
LD (IY+25),0X0F
LD (IY+26),0X80
LD (IY+27),0XFF
LD (IY+28),0XFF
LD (IY+31),60
LD E,60
CALL GETPER
LD (IY+54),L
LD (IY+55),H
CALL GETFRQ
LD (IY+56),L
LD (IY+57),H
RET
COM38_9 XOR A
OUT (ZXDATWR),A
LD (CURFX),A
IN A,(ZXDATRD)
OUT (CLRCBIT),A
RET
GETFX DEC A
CP 0X20
JR C,GETFX2
SUB 0X20
LD H,0X00
ADD A,A
ADD A,A
ADD A,A
RL H
ADD A,A
RL H
ADD A,A
RL H
ADD A,A
RL H
LD L,A
LD A,H
ADD A,HIGH (BUFFER)+1
LD H,A
PUSH HL
POP IY
RET
GETFX2 LD H,0X00
ADD A,A
ADD A,A
ADD A,A
RL H
ADD A,A
RL H
ADD A,A
RL H
ADD A,A
RL H
LD L,A
LD A,H
ADD A,HIGH (SMPADR)
LD H,A
PUSH HL
POP IY
RET
;Play FX
;Проигрывание эффекта.
COM39 IN A,(ZXDATRD)
OR A
JR NZ,COM39_1
LD A,(CURFX)
COM39_1 LD (CURFX),A
LD B,A
LD A,(CNTFX)
CP B
JP C,COM39_9
XOR A
OUT (ZXDATWR),A
OUT (CLRCBIT),A
LD A,(CURFX)
CALL GETFX
LD A,(BUSY)
PUSH AF
LD A,0XFF
LD (BUSY),A
PUSH HL
POP IY
CALL PLAYFX
POP AF
LD (BUSY),A
RET
COM39_9 LD A,0XFF
OUT (ZXDATWR),A
OUT (CLRCBIT),A
RET
COM3B
COM3C LD A,(FXFADE)
OUT (ZXDATWR),A
IN A,(ZXDATRD)
OUT (CLRCBIT),A
LD (FXFADE),A
RET
;Set FX Volume
;Установить громкость проигрывания эффектов.
COM3D LD A,(FXMVOL)
OUT (ZXDATWR),A
IN A,(ZXDATRD)
OUT (CLRCBIT),A
CP 0X40
JR C,COM3D_
LD A,0X40
COM3D_ LD (FXMVOL),A
LD IY,CHANSFX
LD B,0X08
LD DE,CHANLEN
COM3D__ SET 0,(IY+CHSTAT)
ADD IY,DE
DJNZ COM3D__
RET
COM3F
;Set FX Sample Playing Note
;Установка ноты по умолчанию для текущего эффекта.
COM40 IN A,(ZXDATRD)
OUT (CLRCBIT),A
LD E,A
LD A,(CURFX)
OR A
RET Z
CALL GETFX
LD A,E
CP 96
JR C,COM40_
LD E,95
COM40_ LD (IY+31),E
CALL GETPER
LD (IY+54),L
LD (IY+55),H
CALL GETFRQ
LD (IY+56),L
LD (IY+57),H
RET
;Set FX Sample Volume
;Установка громкости по умолчанию для текущего эффекта.
COM41 IN A,(ZXDATRD)
OUT (CLRCBIT),A
LD E,A
LD A,(CURFX)
OR A
RET Z
CALL GETFX
LD A,E
CP 0X41
JR C,COM41_
LD E,0X40
COM41_ LD (IY+20),E
RET
;Set FX Sample Finetune
;Установка Finetune по умолчанию для текущего эффекта.
COM42 LD A,(CURFX)
CALL GETFX
PUSH HL
POP IY
LD A,(IY+21)
OUT (ZXDATWR),A
IN A,(ZXDATRD)
OUT (CLRCBIT),A
LD (IY+21),A
RET
;Set FX Sample Priority
;Установка приоритета для текущего эффекта. (См. команду 0X39)
COM45 LD A,(CURFX)
CALL GETFX
PUSH HL
POP IY
LD A,(IY+26)
OUT (ZXDATWR),A
IN A,(ZXDATRD)
OUT (CLRCBIT),A
LD (IY+26),A
RET
;Set FX Sample Seek First parameter
;Установка параметра Seek First для текущего эффекта. (См. команду 0X39)
COM46 LD A,(CURFX)
CALL GETFX
PUSH HL
POP IY
LD A,(IY+24)
OUT (ZXDATWR),A
IN A,(ZXDATRD)
OUT (CLRCBIT),A
LD (IY+24),A
RET
;Set FX Sample Seek Last parameter
;Установка параметра Seek Last для текущего эффекта. (См. команду 0X39)
COM47 LD A,(CURFX)
CALL GETFX
PUSH HL
POP IY
LD A,(IY+25)
OUT (ZXDATWR),A
IN A,(ZXDATRD)
OUT (CLRCBIT),A
LD (IY+25),A
RET
;Set FX Sample Loop Begin (*)
;Установка начала цикла для текущего эффекта.
COM48 LD A,(CURFX)
CALL GETFX
PUSH HL
POP IY
IN A,(ZXDATRD)
OUT (CLRCBIT),A
LD (IY+14),A
CALL HGET
LD (IY+15),A
CALL HGET
LD (IY+16),A
RET
;Set FX Sample Loop End (*)
;Установка конца цикла для текущего эффекта.
COM49 LD A,(CURFX)
CALL GETFX
PUSH HL
POP IY
IN A,(ZXDATRD)
OUT (CLRCBIT),A
LD (IY+17),A
CALL HGET
LD (IY+18),A
CALL HGET
LD (IY+19),A
RET
COM58 LD B,0X00
OUT (ZXDATWR),A
JP COM50_
COM50 IN A,(ZXDATRD)
LD B,A
COM50_ IN A,(ZXCMD)
OUT (CLRCBIT),A
AND 0X07
LD E,A
CALL HGET
LD L,A
LD A,E
CP 0X04
CALL NC,HGET
LD H,A
LD A,E
CP 0X07
CALL Z,HGET
LD D,A
LD A,B
OR A
JR NZ,C50_00
LD A,(LSTCHN)
OR A
JP Z,ERR20
C50_00 LD B,A
LD C,0X01
LD IY,CHANSFX
C50_01 LD A,B
AND C
JR NZ,C50_02
RLC C
LD A,IYL
ADD A,LOW (CHANLEN)
LD IYL,A
LD A,IYH
ADC A,0X00
LD IYH,A
JP C50_01
C50_02 LD A,E
OR A
JP Z,C50_80
CP 0X02
JP Z,C50_A0
CP 0X04
JP Z,C50_C0
CP 0X05
JP Z,C50_D0
CP 0X06
JP Z,C50_E0
CP 0X07
JP Z,C50_F0
C50_LP
C50_80 SET 7,(IY+CHSTAT)
LD A,L
AND 0X7F
CP 96
JP NC,C50_LP
C50_81 LD A,(IY+CHSMP)
OR A
JP Z,C50_LP
PUSH DE
PUSH BC
PUSH HL
LD E,L
RES 7,E
CALL GETFRQ
LD (IY+CHFRQL),L
LD (IY+CHFRQH),H
CALL GETPER
LD (IY+CHPERL),L
LD (IY+CHPERH),H
BIT 7,(IY+CHSTAT)
JR NZ,C50_82
LD A,(IY+CHNOTE)
CP E
JR Z,C50_83
LD (IY+CHNOTE),E
C50_82 LD (IY+CHCNTL),0X00
LD (IY+CHCNTH),0X00
C50_83 POP HL
PUSH HL
BIT 7,(IY+CHSTAT)
JR NZ,C50_84
BIT 7,L
C50_84 POP HL
POP BC
POP DE
JP C50_LP
C50_90 LD A,L
CP 0X40
JR C,C50_91
LD L,0X40
C50_91 LD (IY+CHVOL),A
LD (IY+CHMVOL),A
JP C50_LP
C50_A0 LD (IY+CHFINE),L
JP C50_LP
C50_B0 LD (IY+CHPAN),L
JP C50_LP
C50_C0 LD A,H
OR A
JR NZ,C50_C1
OR L
JR NZ,C50_C1
LD L,0X01
C50_C1 LD A,H
CP 0X20
JR C,C50_C2
LD HL,0X1FFF
C50_C2 LD A,(IY+CHSTAT)
SET 7,(IY+CHSTAT)
LD (IY+CHPERL),L
LD (IY+CHPERH),H
LD (IY+CHCNTL),0X00
LD (IY+CHCNTH),0X00
LD (IY+CHSTAT),A
JP C50_LP
C50_D0 LD A,H
OR A
JR NZ,C50_D1
OR L
JR NZ,C50_D1
LD L,0X01
C50_D1 LD A,H
CP 0X80
JR C,C50_D2
LD HL,0X7FFF
C50_D2 LD A,(IY+CHSTAT)
SET 7,(IY+CHSTAT)
LD (IY+CHFRQL),L
LD (IY+CHFRQH),H
LD (IY+CHCNTL),0X00
LD (IY+CHCNTH),0X00
LD (IY+CHSTAT),A
JP C50_LP
C50_E0
C50_F0
;Get Song Position
;Получение значения переменной Song_Position в текущем модуле.
COM60 LD A,(MTSNGPS)
OUT (ZXDATWR),A
OUT (CLRCBIT),A
RET
;Get Pattern Position
;Получение значения переменной Pattern_Position в текущем модуле.
COM61 LD A,(MTPATPS)
OUT (ZXDATWR),A
OUT (CLRCBIT),A
RET
;Get Mixed Position
;Получить значение Pattern_Position, немного смешанной с Song_Position.
COM62 LD A,(MTSNGPS)
RRCA
RRCA
AND 0XC0
LD B,A
LD A,(MTPATPS)
AND 0X3F
OR B
OUT (ZXDATWR),A
OUT (CLRCBIT),A
RET
;Get Channel Volumes
;Получить громкости всех каналов модуля.
COM64 LD HL,CHANS+CHMVOL
JP COM64_
COM63 LD HL,CHANS+CHREAL
COM64_ LD DE,CHANLEN
LD B,0X04
LD A,(HL)
OUT (ZXDATWR),A
OUT (CLRCBIT),A
JP COM63__
;Get Channel Notes
;Получить ноты всех каналов модуля.
COM63_ LD A,(HL)
OUT (ZXDATWR),A
COM63__ SET 7,(HL)
CALL HSEND
ADD HL,DE
DJNZ COM63_
RET
;Set speed/tempo (*)
;Установка скорости в пределах 0X01-0X1F. При значениях 0X20-0XFF устанавли-
;вается темп проигрывания. Значения темпа соответствуют оригинальным при
;скорости равной 0X06.
COM66 IN A,(ZXDATRD)
OUT (CLRCBIT),A
CALL FXF
RET
;Get speed value (*)
;Чтение текущей скорости.
COM67 LD A,(MTSPEED)
OUT (ZXDATWR),A
OUT (CLRCBIT),A
RET
;Get tempo value (*)
;Чтение текущего темпа.
COM68 LD A,(MTBPM)
OUT (ZXDATWR),A
OUT (CLRCBIT),A
RET
;Process Sound (*)
;Переход на следующий кварк (или тик) в процессе проигрывания звука.
COM69 LD A,0XFF
LD (INGEN),A
CALL ENGINE
XOR A
LD (INGEN),A
OUT (CLRCBIT),A
RET
;Stop FX in channels
;установка проигрывания эффектов в заданных каналах, которые указывают-
;ся в маске каналов (Channel Mask). В ней единица в n-ном бите указы-
;вает на то, что эффект в n-ном канале требуется остановить
COM3A IN A,(ZXDATRD)
OUT (CLRCBIT),A
LD C,A
CPL
LD B,A
LD A,(FXCHNS)
AND B
LD (FXCHNS),A
LD IY,CHANSFX
LD DE,CHANLEN
SLA C
JR NC,COM3A_2
COM3A_1 RES 7,(IY+CHSTAT)
COM3A_2 ADD IY,DE
SLA C
JR C,COM3A_1
JP NZ,COM3A_2
RET
;Direct Play FX Sample (0X80..0X83)
;Проигрывание сэмпла в заданном канале.
COM80 IN A,(ZXDATRD)
OR A
JR NZ,COM80_1
LD A,(CURFX)
COM80_1 LD (CURFX),A
LD C,A
LD A,(CNTFX)
CP C
JP C,COM39_9
IN A,(ZXCMD)
OUT (CLRCBIT),A
LD B,A
BIT 3,B
CALL NZ,HGET
LD E,A
BIT 4,B
CALL NZ,HGET
LD D,A
LD A,C
CALL GETFX
PUSH DE
PUSH BC
CALL COM80_2
POP BC
POP DE
PUSH HL
POP IY
BIT 4,B
JR Z,COM80_4
LD (IY+CHVOL),D
LD (IY+CHMVOL),D
COM80_4 BIT 3,B
RET Z
CALL GETFRQ
LD (IY+CHFRQL),L
LD (IY+CHFRQH),H
CALL GETPER
LD (IY+CHPERL),L
LD (IY+CHPERH),H
RET
COM80_2 PUSH IY
LD IY,CHANSFX
LD DE,CHANLEN
LD A,B
AND 0X07
COM80_3 JP Z,PLFX_12
ADD IY,DE
DEC A
JP COM80_3
COMA0 IN A,(ZXDATRD)
LD C,A
IN A,(ZXCMD)
OUT (CLRCBIT),A
LD B,A
LD IY,CHANSFX
LD DE,CHANLEN
AND 0X07
COMA0_1 JR Z,COMA0_2
ADD IY,DE
DEC A
JP NZ,COMA0_1
COMA0_2 BIT 3,B
JR NZ,COMA0_3
LD E,C
CALL GETPER
LD (IY+CHPERL),L
LD (IY+CHPERH),H
CALL GETFRQ
LD (IY+CHFRQL),L
LD (IY+CHFRQH),H
RET
COMA0_3 LD (IY+CHVOL),C
LD (IY+CHMVOL),C
SET 0,(IY+CHSTAT)
RET
; INPUT : E=NOTE,IY=CHANNEL
; OUTPUT: HL=PERIOD OR FREQUENCY
; USED : HL,D,BC,A
GETPER LD HL,AMFRQTB ; FOR AMIGA FREQUENCY
JR GETFRQ_
GETFRQ LD HL,GSFRQTB
GETFRQ_ LD A,(IY+CHFINE)
RRA
AND 0X0F
JR Z,GETFRQ2
LD C,A
ADD A,A
ADD A,C
ADD A,A
ADD A,A
ADD A,A
LD B,0
RL B
ADD A,A
RL B
ADD A,A
RL B
LD C,A
ADD HL,BC
ADD HL,BC
GETFRQ2 LD D,0
LD A,E
CP 96
JR C,GETFRQ3
LD E,95
GETFRQ3 SLA E
ADD HL,DE
LD E,(HL)
INC HL
LD D,(HL)
EX DE,HL
LD E,A
BIT 0,(IY+CHFINE)
RET Z
RET
PLAYFX LD C,0X00
LD A,(MTSTAT)
OR A
JP M,PLFX_03
LD A,(MODULE)
OR A
JR Z,PLFX_03
LD IY,CHANS
LD DE,CHANLEN
LD B,0X04
PLFX_00 BIT 7,(IY+CHSTAT)
JR Z,PLFX_01
LD A,(IY+CHMVOL)
OR A
JR Z,PLFX_01
LD A,C
OR (IY+CHRDR)
LD C,A
PLFX_01 ADD IY,DE
DJNZ PLFX_00
PLFX_03 PUSH HL
POP IY
LD HL,GSCHNS
LD A,(HL)
OR A
SCF
RET Z
LD A,(FXCHNS)
OR C
CPL
AND (HL)
LD C,A
AND (IY+24)
JR NZ,PLFX_10
LD A,(IY+26)
CP 0X40
JR NC,PLFX_04
LD A,C
AND (IY+25)
JR NZ,PLFX_10
JP PLFX_05
PLFX_04 LD A,(FXCHNS)
CPL
AND (HL)
AND (IY+24)
JR NZ,PLFX_10
LD A,(FXCHNS)
CPL
AND (HL)
AND (IY+25)
JR NZ,PLFX_10
PLFX_05 LD A,(FXCHNS)
LD B,A
LD A,(GSCHNS)
AND B
LD B,A
PUSH IY
LD IY,CHANSFX
LD L,A
LD H,0XFF
LD DE,CHANLEN
SRL B
JP C,PLFX_06
JP NZ,PLFX_07
JP PLFX_08
PLFX_06 LD A,(IY+CHPRIOR)
CP H
JR NC,PLFX_07
LD H,A
LD L,(IY+CHRDR)
PLFX_07 ADD IY,DE
SRL B
JP C,PLFX_06
JP NZ,PLFX_07
PLFX_08 POP IY
LD A,L
OR A
SCF
RET Z
LD A,H
CP (IY+26)
LD A,L
JR C,PLFX_10
SCF
RET
PLFX_10 LD B,A
PUSH IY
LD IY,CHANSFX
LD DE,CHANLEN
SRL B
JP C,PLFX_12
PLFX_11 ADD IY,DE
SRL B
JP NC,PLFX_11
PLFX_12 LD A,(FXCHNS)
OR (IY+CHRDR)
LD (FXCHNS),A
EX (SP),IY
LD E,(IY+8)
LD D,(IY+9)
LD A,(IY+10)
DB 0XCB,0X32;SLI D
RLA
RRC D
EX (SP),IY
LD (IY+CHCURP),A
LD (IY+CHCURL),E
LD (IY+CHCURH),D
EX (SP),IY
LD A,(IY+8)
ADD A,(IY+11)
LD E,A
LD A,(IY+9)
ADC A,(IY+12)
LD D,A
LD A,(IY+10)
ADC A,(IY+13)
DB 0XCB,0X32;SLI D
RLA
RRC D
EX (SP),IY
LD (IY+CHENDP),A
LD (IY+CHENDL),E
LD (IY+CHENDH),D
LD (IY+CHLPBP),0XFF
EX (SP),IY
LD A,(IY+16)
INC A
JR Z,PLFX_13
LD A,(IY+8)
ADD A,(IY+14)
LD E,A
LD A,(IY+9)
ADC A,(IY+15)
LD D,A
LD A,(IY+10)
ADC A,(IY+16)
DB 0XCB,0X32;SLI D
RLA
RRC D
EX (SP),IY
LD (IY+CHLPBP),A
LD (IY+CHLPBL),E
LD (IY+CHLPBH),D
EX (SP),IY
LD A,(IY+8)
ADD A,(IY+17)
LD E,A
LD A,(IY+9)
ADC A,(IY+18)
LD D,A
LD A,(IY+10)
ADC A,(IY+19)
DB 0XCB,0X32;SLI D
RLA
RRC D
EX (SP),IY
LD (IY+CHLPEP),A
LD (IY+CHLPEL),E
LD (IY+CHLPEH),D
EX (SP),IY
PLFX_13 LD E,(IY+20)
LD D,(IY+21)
LD B,(IY+31)
LD C,(IY+23)
LD L,(IY+22)
LD H,(IY+6)
EX (SP),IY
LD (IY+CHVOL),E
LD (IY+CHMVOL),E
LD (IY+CHFINE),D
LD (IY+CHNOTE),B
LD (IY+CHPAN),C
LD (IY+CHRLNT),L
LD (IY+CHSQZ),H
EX (SP),IY
LD E,(IY+54)
LD D,(IY+55)
LD L,(IY+56)
LD H,(IY+57)
LD C,(IY+26)
EX (SP),IY
SRL D
RR E
SRL D
RR E
LD (IY+CHPERL),E
LD (IY+CHPERH),D
LD (IY+CHFRQL),L
LD (IY+CHFRQH),H
LD (IY+CHPRIOR),C
LD (IY+CHFADVH),0XFF
LD (IY+CHFADVL),0XFF
LD (IY+CHDELVH),0XFF
LD (IY+CHDELVL),0XFF
LD (IY+CHEPAN),0X20
LD (IY+CHEVOL),0X40
LD (IY+CHCNTL),0X00
LD (IY+CHCNTH),0X00
LD (IY+CHVOL),0X40
LD (IY+CHPAN),0X80
SET 7,(IY+CHSTAT)
SET 0,(IY+CHSTAT)
PUSH IY
POP HL
POP IY
LD A,0XFF
LD (PROCESS),A
RET
;INCLUDE "MEM_H.a80"
;MEMORY MOVEMENT MODULE - HIGH PART
;PROCEDURE: MOVE MEMORY
;INPUT : B ,HL - SOURCE START LOGICAL ADRESS
; C ,DE - SOURCE END LOGICAL ADRESS
; B',HL' - DESTINATION LOGICAL ADRESS
;OUTPUT : C ,DE = DEST-START
;USES : TYPE 1 REGS,RAMPG,CPAGE,BUFFER,SYSTEM
;EFFECT : MOVES MEMORY REGION {START,END-1} TO DEST
; ALL ADRESSES IS LOGICAL
MOVMEM XOR A
LD (SYSTEM),A
PUSH HL
LD A,B
EXX
POP DE
PUSH HL
PUSH BC
LD C,A
OR A
SBC HL,DE
LD A,B
SBC A,C
EX DE,HL
POP BC
POP HL
LD C,A
OR E
OR D
RET Z
EXX
EX DE,HL
SBC HL,DE
LD A,C
SBC A,B
LD IXL,A
OR L
OR H
EXX
RET Z
PUSH DE
PUSH BC
BIT 7,C
LD A,B
EXX
JR NZ,MOVL
CP C
JP C,MOVH
JR NZ,MOVL
EXX
LD A,H
EXX
CP D
JP C,MOVH
JR NZ,MOVL
EXX
LD A,L
EXX
CP E
JP C,MOVH
MOVL DB 0XCB,0X32;SLI D
RL B
RRC D
PUSH DE
EXX
EX DE,HL
POP HL
DB 0XCB,0X32;SLI D
RL B
RRC D
LD A,B
LD BC,0X0000
EXX
LD C,A
ML1 EXX
LD A,H
CP D
JR C,ML3
JR NZ,ML2
LD A,L
CP E
JR C,ML3
ML2 LD A,C
SUB L
LD C,A
LD A,B
SBC A,H
JR ML4
ML3 LD A,C
SUB E
LD C,A
LD A,B
SBC A,D
ML4 LD B,A
LD A,IXL
OR A
JR NZ,ML6
LD A,B
EXX
CP H
JR C,ML7
JR NZ,ML5
EXX
LD A,C
EXX
CP L
JR C,ML7
ML5 PUSH HL
EXX
POP BC
ML6 EXX
ML7 LD D,HIGH (RAMPG)
LD A,B
CP C
JR NZ,ML9
LD E,B
LD A,(DE)
LD (SDPAGE),A
EXX
PUSH BC
ML8 LD A,C
CALL MLDI
JP PE,ML8
JR MLD
ML9 EXX
PUSH BC
MLA PUSH BC
PUSH DE
EXX
LD E,B
LD A,(DE)
LD (SDPAGE),A
EXX
LD DE,BUFFER
LD A,C
CALL MLDI
POP DE
POP BC
PUSH HL
EXX
LD E,C
LD A,(DE)
LD (SDPAGE),A
EXX
LD HL,BUFFER
LD A,C
CALL MLDI
POP HL
JP PE,MLA
MLD BIT 7,H
JR NZ,MLB
SET 7,H
EXX
INC B
JP MLC
MLB SET 7,D
EXX
INC C
MLC POP DE
OR A
SBC HL,DE
LD A,IXL
SBC A,0X00
LD IXL,A
OR L
OR H
JP NZ,ML1
POP BC
POP DE
RET
MOVH LD A,L
OR H
JR NZ,MH0
DEC IXL
MH0 DEC HL
EX DE,HL
ADD HL,DE
LD A,B
ADC A,IXL
DB 0XCB,0X34;SLI H
RLA
RRC H
LD B,A
PUSH HL
PUSH DE
INC DE
LD A,E
OR D
LD A,IXL
JR NZ,MHF
INC IXL
MHF EX DE,HL
EXX
POP DE
ADD HL,DE
ADC A,B
DB 0XCB,0X34;SLI H
RLA
RRC H
EX DE,HL
POP HL
EXX
LD C,A
MH1 EXX
LD A,H
CP D
JR C,MH3
JR NZ,MH2
LD A,L
CP E
JR C,MH3
MH2 LD C,E
LD B,D
JR MH4
MH3 LD C,L
LD B,H
MH4 RES 7,B
INC BC
LD A,IXL
OR A
JR NZ,MH6
LD A,B
EXX
CP H
JR C,MH7
JR NZ,MH5
EXX
LD A,C
EXX
CP L
JR C,MH7
MH5 PUSH HL
EXX
POP BC
MH6 EXX
MH7 LD D,HIGH (RAMPG)
LD A,B
CP C
JR NZ,MH9
LD E,B
LD A,(DE)
LD (SDPAGE),A
EXX
PUSH BC
MH8 LD A,C
CALL MLDD
JP PE,MH8
JR MHD
MH9 EXX
PUSH BC
MHA PUSH BC
PUSH DE
EXX
LD E,B
LD A,(DE)
LD (SDPAGE),A
EXX
LD DE,BUFFER+0X00FF
LD A,C
CALL MLDD
POP DE
POP BC
PUSH HL
EXX
LD E,C
LD A,(DE)
LD (SDPAGE),A
EXX
LD HL,BUFFER+0X00FF
LD A,C
CALL MLDD
POP HL
JP PE,MHA
MHD BIT 7,H
JR NZ,MHB
SET 7,H
EXX
DEC B
JP MHC
MHB SET 7,D
EXX
DEC C
MHC POP DE
OR A
SBC HL,DE
LD A,IXL
SBC A,0X00
LD IXL,A
OR L
OR H
JP NZ,MH1
POP BC
POP DE
RET
;PROCEDURE: LOAD MEMORY BLOCK
;INPUT : A,HL - SOURCE LOGICAL ADRESS
; DE - DESTINATION PHISICAL ADRESS (LOW RAM)
; BC - BLOCK LENGTH
;USES : TYPE 2 REGS,RAMPG,CPAGE,SYSTEM
;EFFECT : MOVES MEMORY BLOCK FROM HIGH MEMORY TO LOW
; SWITCH TO PAGE 0
LDMEM DB 0XCB,0X34;SLI H
RLA
RRC H
LM1 LD IXL,A
PUSH HL
LD L,A
LD H,HIGH (RAMPG)
LD A,(HL)
POP HL
LD (SDPAGE),A
ADD HL,BC
JR NC,LM2
JR NZ,LM4
LM2 SBC HL,BC
LM3 LD A,C
CALL MLDI
JP PE,LM3
RET
LM4 XOR A
SBC HL,BC
LM5 LD A,L
NEG
CALL MLDI
BIT 7,H
JP NZ,LM5
SET 7,H
LD A,IXL
INC A
JP LM1
;PROCEDURE: SAVE MEMORY BLOCK
;INPUT : A,DE - DESTINATION LOGICAL ADRESS
; HL - SOURCE PHISICAL ADRESS (LOW RAM)
; BC - BLOCK LENGTH
;USES : TYPE 2 REGS,RAMPG,CPAGE,SYSTEM
;EFFECT : MOVES MEMORY BLOCK FROM LOW MEMORY TO HIGH
; SWITCH TO PAGE 0
SVMEM DB 0XCB,0X32;SLI D
RLA
RRC D
SM1 LD IXL,A
PUSH HL
LD L,A
LD H,HIGH (RAMPG)
LD A,(HL)
POP HL
LD (SDPAGE),A
EX DE,HL
ADD HL,BC
JR NC,SM2
JR NZ,SM4
SM2 SBC HL,BC
EX DE,HL
SM3 LD A,C
CALL MLDI
JP PE,SM3
RET
SM4 XOR A
SBC HL,BC
EX DE,HL
SM5 LD A,E
NEG
CALL MLDI
BIT 7,D
JP NZ,SM5
SET 7,D
LD A,IXL
INC A
JP SM1
;INCLUDE "ENGINE_L.a80"
ENGINE LD HL,(QTFREE)
LD H,HIGH (QTMAP)
LD A,L
AND 0X1C
LD L,A
LD (QTFREE),HL
LD A,(HL)
OR A
JP NZ,ENG_FUL
LD A,(CHANSFX+0X000)
RLCA
RR C
LD A,(CHANSFX+0X040)
RLCA
RR C
LD A,(CHANSFX+0X080)
RLCA
RR C
LD A,(CHANSFX+0X0C0)
RLCA
RR C
LD A,(CHANSFX+0X100)
RLCA
RR C
LD A,(CHANSFX+0X140)
RLCA
RR C
LD A,(CHANSFX+0X180)
RLCA
RR C
LD A,(CHANSFX+0X1C0)
RLCA
RR C
LD A,(GSCHNS)
AND C
LD C,A
LD (FXCHNS),A
JR NZ,ENG_01
LD A,(MTSTAT)
BIT 6,A
RET NZ
OR A
JP M,ENG_00
LD A,(MODULE)
OR A
JR NZ,ENG_01
ENG_00 XOR A
LD (PROCESS),A
RET
ENG_01 LD A,(MODSWCH)
OR A
JR NZ,ENG_03
LD A,(MODULE)
OR A
JR Z,ENG_03
LD A,0X01
LD (SGENOFF),A
LD A,(TCKLEFT+1)
CP 0X02
JR NC,ENG_05
OR A
LD A,(TCKLEFT)
JR Z,ENG_04
SUB 0X80
JR NC,ENG_05
JP ENG_04
ENG_03 LD A,0X01
LD (SGENOFF),A
LD A,(FXTICK+1)
CP 0X02
JR NC,ENG_05
OR A
LD A,(FXTICK)
JR Z,ENG_04
SUB 0X80
JR NC,ENG_05
ENG_04 NEG
LD (SGENOFF),A
ENG_05 XOR A
LD (CHANNEL),A
OR C
JR Z,ENG_07
LD IY,CHANSFX
SRL C
ENG_06 PUSH BC
CALL C,GEN
LD BC,CHANLEN
ADD IY,BC
POP BC
SRL C
JR C,ENG_06
JR NZ,ENG_06
ENG_07 CALL QUANTUM
XOR A
LD (CPAGE),A
OUT (MPAG),A
RET
ENG_80 LD A,(SGENOFF)
LD E,A
LD D,0X00
LD HL,(FXTICK)
OR A
SBC HL,DE
JR Z,ENG_81
JR C,ENG_81
LD (FXTICK),HL
JP ENG_82
ENG_81
ENG_82 LD A,(MODSWCH)
OR A
JR NZ,$
LD A,(MODULE)
OR A
JR Z,$
LD HL,(TCKLEFT)
SBC HL,DE
LD (TCKLEFT),HL
JR NZ,ENG_83
ENG_83
ENG_FUL LD A,(PLAYING)
OR A
RET NZ
DI
XOR A
LD (FILLALL),A
CALL QTPLAY
RET
;INCLUDE "FX_H.a80"
FXCHK_ LD HL,FXJP2
JP FXCHK__
FXCHK LD HL,FXJP1
FXCHK__ LD A,(IY+CHCOM)
AND 0X1F
ADD A,A
ADD A,L
LD L,A
LD A,(HL)
INC L
LD H,(HL)
LD L,A
LD A,(IY+CHPARM)
JP (HL)
FXE_ LD HL,FXEJP2
JP FXE__
FXE LD HL,FXEJP1
FXE__ RRCA
RRCA
RRCA
RRCA
AND 0X0F
ADD A,A
ADD A,L
LD L,A
LD A,(HL)
INC L
LD H,(HL)
LD L,A
LD A,(IY+CHPARM)
AND 0X0F
JP (HL)
FXRET RET
FXNOP LD L,(IY+CHPERL)
LD H,(IY+CHPERH)
EFXNOP2 CALL EFXCNV
LD (IY+CHFRQL),L
LD (IY+CHFRQH),H
RET
;---patched
EFXCNV LD A,H
CP 0X04
JR NC,EFXCNV1
XOR A
LD (CPAGE),A
OUT (MPAG),A
ADD HL,HL
LD A,H
ADD A,0XF8
LD H,A
LD A,(HL)
INC HL
LD H,(HL)
LD L,A
RET
EFXCNV1 PUSH HL
LD E,L
LD D,H
ADD HL,HL
ADD HL,HL
ADD HL,DE
XOR A ;HL A
LD C,A ;DE C
SRL D ;/2
RR E
RR C
ADD A,C
ADC HL,DE ;+/2
SRL D ;/4
RR E
RR C
SRL D ;/8
RR E
RR C
ADD A,C
ADC HL,DE ;+/8
SRL D ;/16
RR E
RR C
SRL D ;/32
RR E
RR C
SRL D ;/64
RR E
RR C
SRL D ;/128
RR E
RR C
SRL D ;/256
RR E
RR C
ADD A,C
ADC HL,DE ;+/256
SRL E ;/512
RR C
ADD A,C
ADC HL,DE ;+/512
SRL E ;/1024
RR C
ADD A,C
ADC HL,DE ;+/1024
SRL E ;/2048
RR C
SRL E ;/4096
RR C
ADD A,C
ADC HL,DE ;+/4096
SRL H
RR L
SRL H
RR L
SRL H
RR L
JR NC,EFXCNV2
INC HL
EFXCNV2 POP DE
ADD HL,DE
ADD HL,DE
RET
INC A
RR L
JR NC,TUT00
INC HL
TUT00 POP DE
ADD HL,DE
ADD HL,DE
RET
ARPTAB DB 0,1,2,0,1,2,0,1,2,0
DB 1,2,0,1,2,0,1,2,0,1,2
DB 0,1,2,0,1,2,0,1,2,0
DB 1,2,0,1,2,0,1,2,0,1,2
FX0 OR A
JP Z,FXNOP
LD B,A
LD A,(MTCOUNT)
LD HL,ARPTAB
ADD A,L
LD L,A
LD A,H
ADC A,0X00
LD H,A
LD A,(HL)
OR A
JP Z,FXNOP
PUSH AF
PUSH BC
CALL NOTEFND
POP BC
POP AF
DEC A
LD A,B
JR NZ,FX0_2
RRCA
RRCA
RRCA
RRCA
FX0_2 AND 0X0F
ADD A,E
LD E,A
CP 96
RET NC
CALL GETFRQ
LD (IY+CHFRQL),L
LD (IY+CHFRQH),H
RET
FX1 LD E,A
LD D,0X00
LD L,(IY+CHPERL)
LD H,(IY+CHPERH)
OR A
SBC HL,DE
JR NC,FX1_2
LD HL,0X0000
FX1_2 PUSH HL
LD HL,113
FX1_8 POP DE
OR A
SBC HL,DE
JR C,FX1_9
ADD HL,DE
EX DE,HL
FX1_9 SET 7,(IY+CHFLAGS)
LD (IY+CHPERL),E
LD (IY+CHPERH),D
PUSH DE
EX DE,HL
CALL EFXCNV
LD (IY+CHFRQL),L
LD (IY+CHFRQH),H
POP DE
CALL NOTEFND
LD (IY+CHREAL),A
RET NC
LD (IY+CHNOTE),A
RES 7,(IY+CHFLAGS)
RET
FX2 LD E,A
LD D,0X00
LD L,(IY+CHPERL)
LD H,(IY+CHPERH)
ADD HL,DE
JR NC,FX2_2
LD HL,0XFFFF
FX2_2 PUSH HL
LD HL,856
FX2_8 POP DE
OR A
SBC HL,DE
JR NC,FX2_9
ADD HL,DE
EX DE,HL
FX2_9 SET 7,(IY+CHFLAGS)
LD (IY+CHPERL),E
LD (IY+CHPERH),D
PUSH DE
EX DE,HL
CALL EFXCNV
LD (IY+CHFRQL),L
LD (IY+CHFRQH),H
POP DE
CALL NOTEFND
LD (IY+CHREAL),A
RET NC
LD (IY+CHNOTE),A
RES 7,(IY+CHFLAGS)
RET
FX3 OR A
JR Z,FX3_1
LD (IY+CHPORT),A
FX3_1 LD A,(IY+CHWNT)
CP 96
RET NC
LD E,A
CALL GETPER
EX DE,HL
LD L,(IY+CHPERL)
LD H,(IY+CHPERH)
OR A
SBC HL,DE
JR Z,FX3_9
ADD HL,DE
LD C,(IY+CHPORT)
LD B,0X00
JR C,FX3_5
SBC HL,BC
JR C,FX3_9
SBC HL,DE
JR C,FX3_9
FX3_2 ADD HL,DE
LD (IY+CHPERL),L
LD (IY+CHPERH),H
BIT 2,(IY+CHFLAGS)
CALL Z,EFXCNV
BIT 2,(IY+CHFLAGS)
JR Z,FX3_3
EX DE,HL
CALL NOTEFND
LD E,A
CALL GETFRQ
FX3_3 LD (IY+CHFRQL),L
LD (IY+CHFRQH),H
RET
FX3_5 ADD HL,BC
JR C,FX3_9
SBC HL,DE
JR C,FX3_2
FX3_9 LD E,(IY+CHWNT)
LD (IY+CHNOTE),E
LD (IY+CHREAL),E
CALL GETPER
LD (IY+CHPERL),L
LD (IY+CHPERH),H
CALL GETFRQ
LD (IY+CHFRQL),L
LD (IY+CHFRQH),H
RES 7,(IY+CHFLAGS)
LD (IY+CHCOM),0X00
LD (IY+CHPARM),0X00
LD (IY+CHWNT),0X7F
RET
FX3_ RET
FX4 PUSH DE
PUSH BC
OR A
JR Z,FX4_3
LD L,A
LD H,(IY+CHVIBCM)
AND 0X0F
JR Z,FX4_1
XOR H
AND 0X0F
XOR H
LD H,A
FX4_1 LD A,L
AND 0XF0
JR Z,FX4_2
XOR H
AND 0XF0
XOR H
LD H,A
FX4_2 LD (IY+CHVIBCM),H
FX4_3 LD D,(IY+CHVIBPS)
LD A,D
AND 0X03
JR Z,FX4_5
CP 0X03
JR NZ,FX4_A
LD A,R
AND 0X03
JR Z,FX4_5
CP 0X03
JR Z,FX4_5
FX4_A DEC A
JR Z,FX4_4
LD E,0XFF
JP FX4_6
FX4_4 LD A,D
AND 0X7C
RLCA
LD E,A
BIT 7,D
JR NZ,FX4_6
LD A,0XF8
SUB E
LD E,A
JP FX4_6
FX4_5 LD A,D
RRCA
RRCA
AND 0X1F
LD HL,VIBTB
ADD A,L
LD L,A
LD E,(HL)
FX4_6 LD A,(IY+CHVIBCM)
AND 0X0F
JR Z,FX4_9
LD B,A
LD HL,0X0000
LD D,H
FX4_7 ADD HL,DE
DJNZ FX4_7
LD B,0X07
LD A,L
FX4_8 SRL H
RRA
DJNZ FX4_8
ADC A,D
LD L,A
LD H,0X00
BIT 7,(IY+CHVIBPS)
JR Z,FX4_9
DEC H
CPL
LD L,A
INC HL
FX4_9 LD E,(IY+CHPERL)
LD D,(IY+CHPERH)
ADD HL,DE
CALL EFXNOP2
LD A,(IY+CHVIBCM)
AND 0XF0
RRCA
RRCA
ADD A,(IY+CHVIBPS)
LD (IY+CHVIBPS),A
POP BC
POP DE
RET
FX5 CALL FXA
JP FX3_1
FX6 CALL FXA
PUSH DE
PUSH BC
JP FX4_3
FX7 PUSH DE
PUSH BC
OR A
JR Z,FX7_3
LD L,A
LD H,(IY+CHTRMCM)
AND 0X0F
JR Z,FX7_1
XOR H
AND 0X0F
XOR H
LD H,A
FX7_1 LD A,L
AND 0XF0
JR Z,FX7_2
XOR H
AND 0XF0
XOR H
LD H,A
FX7_2 LD (IY+CHTRMCM),H
FX7_3 LD D,(IY+CHTRMPS)
LD A,D
AND 0X03
JR Z,FX7_5
CP 0X03
JR NZ,FX7_A
LD A,R
AND 0X03
JR Z,FX7_5
CP 0X03
JR Z,FX7_5
FX7_A DEC A
JR Z,FX7_4
LD E,0XFF
JP FX7_6
FX7_4 LD A,D
AND 0X7C
RLCA
LD E,A
BIT 7,D
JR NZ,FX7_6
LD A,0XF8
SUB E
LD E,A
JP FX7_6
FX7_5 LD A,D
RRCA
RRCA
AND 0X1F
LD HL,VIBTB
ADD A,L
LD L,A
LD E,(HL)
FX7_6 LD A,(IY+CHTRMCM)
AND 0X0F
JR Z,FX7_9
LD B,A
LD HL,0X0000
LD D,H
FX7_7 ADD HL,DE
DJNZ FX7_7
LD B,0X06
LD A,L
FX7_8 SRL H
RRA
DJNZ FX7_8
ADC A,D
BIT 7,(IY+CHTRMPS)
JR Z,FX7_9
LD L,A
LD A,(IY+CHVOL)
SUB L
JR NC,FX7_B
XOR A
JP FX7_B
FX7_9 ADD A,(IY+CHVOL)
CP 0X40
JR C,FX7_B
LD A,0X40
FX7_B CP (IY+CHMVOL)
LD (IY+CHMVOL),A
JR Z,FX7_C
SET 0,(IY+CHSTAT)
FX7_C LD A,(IY+CHTRMCM)
AND 0XF0
RRCA
RRCA
ADD A,(IY+CHTRMPS)
LD (IY+CHTRMPS),A
POP BC
POP DE
RET
FX9 OR A
RET
JR Z,FX9_1
LD (IY+CHOFFST),A
FX9_1 LD H,(IY+CHOFFST)
LD L,0X00
FXA OR A
RET Z
LD L,A
LD A,(IY+CHVOL)
LD H,A
LD A,L
AND 0XF0
JR Z,FXA_1
RRCA
RRCA
RRCA
RRCA
ADD A,H
CP 0X40
JR C,FXA_2
LD A,0X40
JP FXA_2
FXA_1 LD A,H
SUB L
JR NC,FXA_2
LD A,0X00
LD (IY+CHCOM),A
LD (IY+CHPARM),A
FXA_2 LD (IY+CHVOL),A
CP (IY+CHMVOL)
LD (IY+CHMVOL),A
RET Z
SET 0,(IY+CHSTAT)
RET
FXB DEC A
LD (MTSNGPS),A
;CALL CP_END_MOD
XOR A
LD (MTBRKPS),A
INC A
LD (MTJMPFL),A
RET
FXC CP 0X40
JR C,FXC_1
LD A,0X40
FXC_1 LD (IY+CHVOL),A
CP (IY+CHMVOL)
LD (IY+CHMVOL),A
RET Z
SET 0,(IY+CHSTAT)
RET
FXD LD L,A
AND 0XF0
RRCA
LD H,A
RRCA
RRCA
ADD A,H
LD H,A
LD A,L
AND 0X0F
ADD A,H
CP 0X40
JR C,FXD_1
XOR A
FXD_1 LD (MTBRKPS),A
LD A,0X01
LD (MTJMPFL),A
RET
FXF OR A
JR Z,FXF_5
CP 0X20
JR NC,FXF_1
FXF_0 LD (MTSPEED),A
RET
FXF_1 LD (MTBPM),A
SUB 0X20
LD HL,BPMTAB
ADD A,A
JR NC,FXF_3
INC H
FXF_3 ADD A,L
LD L,A
JR NC,FXF_4
INC H
FXF_4 LD A,(HL)
INC HL
LD H,(HL)
LD L,A
LD (TICKLEN),HL
LD (TCKLEFT),HL
RET
FXF_5
;LD HL,MTSTAT
;---patched
JP Patch2x
;---
SET 7,(HL)
RET
FXE0 AND 0X01
LD (MTFILTR),A
RET
FXE3 RES 2,(IY+CHFLAGS)
OR A
RET Z
SET 2,(IY+CHFLAGS)
RET
FXE4 RES 1,(IY+CHFLAGS)
BIT 2,A
JR Z,FXE4_2
SET 1,(IY+CHFLAGS)
FXE4_2 AND 0X03
LD L,A
LD A,(IY+CHVIBPS)
AND 0XFC
OR L
LD (IY+CHVIBPS),A
RET
FXE5 ADD A,A
LD (IY+CHFINE),A
RET
FXE6 OR A
JR Z,FXE6_3
INC (IY+CHLPCNT)
DEC (IY+CHLPCNT)
JR Z,FXE6_2
DEC (IY+CHLPCNT)
RET Z
FXE6_1 LD A,(IY+CHPATPS)
LD (MTBRKPS),A
LD A,0X01
LD (MTBRKFL),A
RET
FXE6_2 LD (IY+CHLPCNT),A
JP FXE6_1
FXE6_3 LD A,(MTPATPS)
LD (IY+CHPATPS),A
RET
FXE7 RES 0,(IY+CHFLAGS)
BIT 2,A
JR Z,FXE7_2
SET 0,(IY+CHFLAGS)
FXE7_2 AND 0X03
LD L,A
LD A,(IY+CHTRMPS)
AND 0XFC
OR L
LD (IY+CHTRMPS),A
RET
FXE9 OR A
RET Z
LD L,A
LD A,(MTCOUNT)
FXE9_1 SUB L
JR NC,FXE9_1
ADD A,L
RET NZ
CALL GETSMP
RET
FXEA RLCA
RLCA
RLCA
RLCA
JP FXA
FXEC LD HL,MTCOUNT
CP (HL)
RET NZ
XOR A
LD (IY+CHVOL),A
CP (IY+CHMVOL)
LD (IY+CHMVOL),A
RET Z
SET 0,(IY+CHSTAT)
RET
FXED LD HL,MTCOUNT
CP (HL)
RET NZ
CALL GETSMP
RET
FXEE LD HL,MTPDT2
INC (HL)
DEC (HL)
RET NZ
INC A
LD (MTPDT),A
RET
;INCLUDE "VOL_H.a80"
;VOLUME CALCULATION FOR MODULES AND FX
CALCVOL RES 0,(IY+CHSTAT)
LD DE,0XFC00
LD A,(IY+CHMVOL)
AND 0X7F
JP Z,CALCV_Z
CP 0X40
CALL C,MUL64
LD A,(IY+CHEVOL)
OR A
JP Z,CALCV_Z
CP 0X40
CALL C,MUL64
LD A,(IY+CHFADVH)
SRL A
SRL A
ADC A,0X00
JP Z,CALCV_Z
CP 0X40
CALL C,MUL64
BIT 6,(IY+CHSTAT)
JP Z,CALCV_N
LD A,(FXVOL)
OR A
JP Z,CALCV_Z
CP 0X40
CALL C,MUL64
LD A,(FXMVOL)
OR A
JP Z,CALCV_Z
CP 0X40
CALL C,MUL64
JP CALCV_X
CALCV_N LD A,(MTVOL)
OR A
JP Z,CALCV_Z
CP 0X40
CALL C,MUL64
LD A,(MODVOL)
OR A
JP Z,CALCV_Z
CP 0X40
CALL C,MUL64
CALCV_X LD C,(IY+CHPAN)
LD A,(IY+CHEPAN)
SUB 0X20
JR Z,CALCV_V
JR NC,CALCV_I
NEG
CALCV_I CP 0X20
JR C,CALCV_U
LD H,(IY+CHPAN)
LD A,H
OR A
JP P,CALCV_Q
NEG
LD H,A
JP CALCV_Q
CALCV_U RLCA
RLCA
RLCA
LD L,A
LD A,(IY+CHPAN)
OR A
JP P,CALCV_T
NEG
CALCV_T LD B,A
XOR A
JP CALCV_M
CALCV_R ADD A,B
CALCV_E SRL B
CALCV_M SLA L
JR C,CALCV_R
JR NZ,CALCV_E
SRL A
LD H,A
CALCV_Q LD A,(IY+CHEPAN)
CP 0X20
JR C,CALCV_P
LD A,C
ADD A,H
LD C,A
JR NC,CALCV_V
LD C,0XFF
JP CALCV_W
CALCV_P LD A,C
SUB H
LD C,0X00
JR C,CALCV_O
LD C,A
CALCV_V LD A,C
CP 0X80
JR Z,CALCV_Y
OR A
JP M,CALCV_W
CALCV_O BIT 5,(IY+CHSTAT)
JR Z,CALCV_Y
SRL A
CALL MUL64
JP CALCV_Y
CALCV_W BIT 5,(IY+CHSTAT)
JR NZ,CALCV_Y
NEG
SRL A
CALL MUL64
CALCV_Y LD A,D
SRL A
SRL A
ADC A,0X00
CALCV_Z LD C,A
LD HL,VOLRQTB
LD A,L
ADD A,(IY+CHRDN)
LD L,A
LD (HL),C
RET
MUL64 LD B,A
LD HL,0X0000
AND 0X0F
JR Z,MUL64_F
SLA B
SLA B
JP MUL64_E
MUL64_A ADD HL,DE
MUL64_E SRL D
RR E
SLA B
JP C,MUL64_A
JP NZ,MUL64_E
EX DE,HL
RET
MUL64_F LD A,B
OR A
JR Z,MUL64_S
SRL D
RR E
CP 0X20
RET Z
LD L,E
LD H,D
SRL D
RR E
CP 0X10
RET Z
ADD HL,DE
MUL64_S EX DE,HL
RET
;INCLUDE "TEST_H.a80"
TCOM IN A,(ZXSTAT)
RRCA
JR NC,TCOM
TCOM_ IN A,(ZXCMD)
CP 0X20
JP NC,COMINT2
CP 0X01
JR Z,TCOM
OUT (CLRCBIT),A
LD HL,TCOMTB
ADD A,A
ADD A,L
LD L,A
LD A,(HL)
INC L
LD H,(HL)
LD L,A
JP (HL)
TCOM2 LD HL,DAC0
LD A,0X3F
OUT (VOL1),A
TCOMDAC LD (HL),0
LD A,(HL)
LD IY,TCONT1
JP TWAIT
TCONT1 LD (HL),0XFF
LD A,(HL)
LD IY,TCOMDAC
JP TWAIT
TCOM3 LD HL,DAC1
LD A,0X3F
OUT (VOL2),A
JR TCOMDAC
TCOM4 LD HL,DAC2
LD A,0X3F
OUT (VOL3),A
JR TCOMDAC
TCOM5 LD HL,DAC3
LD A,0X3F
OUT (VOL4),A
JR TCOMDAC
TCOM6 XOR A
OUT (ZXDATWR),A
LD IY,TCONT2
JP TWAIT
TCONT2 LD A,0XFF
OUT (ZXDATWR),A
LD IY,TCOM6
JP TWAIT
TCOM7 LD C,VOL1
LD HL,DAC0
LD (HL),0XFF
LD A,(HL)
TCOMVOL LD A,0X00
OUT (C),A
LD IY,TCONT3
JP TWAIT
TCONT3 LD A,0XFF
OUT (C),A
LD IY,TCOMVOL
JP TWAIT
TCOM8 LD C,VOL2
LD HL,DAC1
LD (HL),0XFF
LD A,(HL)
JR TCOMVOL
TCOM9 LD C,VOL3
LD HL,DAC2
LD (HL),0XFF
LD A,(HL)
JR TCOMVOL
TCOMA LD C,VOL4
LD HL,DAC3
LD (HL),0XFF
LD A,(HL)
JR TCOMVOL
TCOMB LD HL,DAC0
LD C,VOL1
TCOMTST LD B,0X3F
TCOMT4 OUT (C),B
LD D,114
TCOMT5 LD (HL),0X00
LD A,(HL)
XOR A
TCOMT6 DEC A
JR NZ,TCOMT6
LD (HL),0XFF
LD A,(HL)
XOR A
TCOMT7 DEC A
JR NZ,TCOMT7
DEC D
JR NZ,TCOMT5
DEC B
JP P,TCOMT4
IN A,(ZXSTAT)
RRCA
JR NC,TCOMTST
JP TCOM_
TCOMC LD HL,DAC1
LD C,VOL2
JP TCOMTST
TCOMD LD HL,DAC2
LD C,VOL3
JP TCOMTST
TCOME LD HL,DAC3
LD C,VOL4
JP TCOMTST
TCOMF LD A,0X3F
OUT (VOL1),A
OUT (VOL2),A
OUT (VOL3),A
OUT (VOL4),A
LD B,0X00
LD L,B
TCONT8 LD H,HIGH (DAC0)
LD (HL),B
LD A,(HL)
INC H
LD (HL),B
LD A,(HL)
INC H
LD (HL),B
LD A,(HL)
INC H
LD (HL),B
LD A,(HL)
DJNZ TCONT8
IN A,(ZXSTAT)
RRCA
JP NC,TCONT8
JP TCOM_
TCOM10 IN A,(ZXDATRD)
OUT (ZXDATWR),A
JP TCOM_
TCOM11 IN A,(ZXDATRD)
JP TCOM_
TCOM12 LD HL,DAC0
TCONT9 LD A,0X3F
OUT (VOL1),A
OUT (VOL2),A
OUT (VOL3),A
OUT (VOL4),A
TCONTA IN A,(ZXDATRD)
LD (HL),A
LD A,(HL)
TCONTB DJNZ TCONTB
LD (HL),0X00
LD A,(HL)
TCONTC DJNZ TCONTC
IN A,(ZXSTAT)
RRCA
JP C,TCOM_
JP TCONTA
TCOM13 LD HL,DAC1
JR TCONT9
TCOM14 LD HL,DAC2
JR TCONT9
TCOM15 LD HL,DAC3
JR TCONT9
TWAIT LD B,0X04
TWAIT1 LD DE,38686
TWAIT2 IN A,(ZXSTAT)
RRCA
JP C,TCOM_
DEC DE
LD A,D
OR E
JR NZ,TWAIT2
DJNZ TWAIT2
JP (IY)
;INCLUDE "TABLES_H.a80"
align 256
VIBTB db 0X00,0X18,0X31,0X4A,0X61,0X78,0X8D,0XA1
db 0XB4,0XC5,0XD4,0XE0,0XEB,0XF4,0XFA,0XFD
db 0XFF,0XFD,0XFA,0XF4,0XEB,0XE0,0XD4,0XC5
db 0XB4,0XA1,0X8D,0X78,0X61,0X4A,0X31,0X18
COMTABH DB LOW (COM20),LOW (COM21),LOW (COM22),LOW (COM23),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ) ;0X20
DB LOW (COMHZ),LOW (COMHZ),LOW (COM2A),LOW (COM2B),LOW (COM2C),LOW (COM2D),LOW (COM2E),LOW (COM2F) ;0X28
DB LOW (COM30),LOW (COM31),LOW (COM32),LOW (COM33),LOW (COM34),LOW (COM35),LOW (COM36),LOW (COM37) ;0X30
DB LOW (COM38),LOW (COM39),LOW (COM3A),LOW (COM3B),LOW (COM3C),LOW (COM3D),LOW (COM3E),LOW (COM3F) ;0X38
DB LOW (COM40),LOW (COM41),LOW (COM42),LOW (COMHZ),LOW (COMHZ),LOW (COM45),LOW (COM46),LOW (COM47) ;0X40
DB LOW (COM48),LOW (COM49),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ) ;0X48
DB LOW (COM50),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ) ;0X50
DB LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ) ;0X58
DB LOW (COM60),LOW (COM61),LOW (COM62),LOW (COM63),LOW (COM64),LOW (COM65),LOW (COM66),LOW (COM67) ;0X60
DB LOW (COM68),LOW (COM69),LOW (COM6A),LOW (COM6B),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ) ;0X68 patched
DB LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ) ;0X70
DB LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ) ;0X78
DB LOW (COM80),LOW (COM80),LOW (COM80),LOW (COM80),LOW (COM80),LOW (COM80),LOW (COM80),LOW (COM80) ;0X80
DB LOW (COM80),LOW (COM80),LOW (COM80),LOW (COM80),LOW (COM80),LOW (COM80),LOW (COM80),LOW (COM80) ;0X88
DB LOW (COM80),LOW (COM80),LOW (COM80),LOW (COM80),LOW (COM80),LOW (COM80),LOW (COM80),LOW (COM80) ;0X90
DB LOW (COM80),LOW (COM80),LOW (COM80),LOW (COM80),LOW (COM80),LOW (COM80),LOW (COM80),LOW (COM80) ;0X98
DB LOW (COMA0),LOW (COMA0),LOW (COMA0),LOW (COMA0),LOW (COMA0),LOW (COMA0),LOW (COMA0),LOW (COMA0) ;0XA0
DB LOW (COMA0),LOW (COMA0),LOW (COMA0),LOW (COMA0),LOW (COMA0),LOW (COMA0),LOW (COMA0),LOW (COMA0) ;0XA8
DB LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ) ;0XB0
DB LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ) ;0XB8
DB LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ) ;0XC0
DB LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ) ;0XC8
DB LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ) ;0XD0
DB LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ) ;0XD8
DB LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ) ;0XE0
DB LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ),LOW (COMHZ) ;0XE8
DUPL 0X10,0
DUPL 0X20,0
DB HIGH (COM20),HIGH (COM21),HIGH (COM22),HIGH (COM23),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ) ;0X20
DB HIGH (COMHZ),HIGH (COMHZ),HIGH (COM2A),HIGH (COM2B),HIGH (COM2C),HIGH (COM2D),HIGH (COM2E),HIGH (COM2F) ;0X28
DB HIGH (COM30),HIGH (COM31),HIGH (COM32),HIGH (COM33),HIGH (COM34),HIGH (COM35),HIGH (COM36),HIGH (COM37) ;0X30
DB HIGH (COM38),HIGH (COM39),HIGH (COM3A),HIGH (COM3B),HIGH (COM3C),HIGH (COM3D),HIGH (COM3E),HIGH (COM3F) ;0X38
DB HIGH (COM40),HIGH (COM41),HIGH (COM42),HIGH (COMHZ),HIGH (COMHZ),HIGH (COM45),HIGH (COM46),HIGH (COM47) ;0X40
DB HIGH (COM48),HIGH (COM49),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ) ;0X48
DB HIGH (COM50),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ) ;0X50
DB HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ) ;0X58
DB HIGH (COM60),HIGH (COM61),HIGH (COM62),HIGH (COM63),HIGH (COM64),HIGH (COM65),HIGH (COM66),HIGH (COM67) ;0X60
DB HIGH (COM68),HIGH (COM69),HIGH (COM6A),HIGH (COM6B),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ) ;0X68 patched
DB HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ) ;0X70
DB HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ) ;0X78
DB HIGH (COM80),HIGH (COM80),HIGH (COM80),HIGH (COM80),HIGH (COM80),HIGH (COM80),HIGH (COM80),HIGH (COM80) ;0X80
DB HIGH (COM80),HIGH (COM80),HIGH (COM80),HIGH (COM80),HIGH (COM80),HIGH (COM80),HIGH (COM80),HIGH (COM80) ;0X88
DB HIGH (COM80),HIGH (COM80),HIGH (COM80),HIGH (COM80),HIGH (COM80),HIGH (COM80),HIGH (COM80),HIGH (COM80) ;0X90
DB HIGH (COM80),HIGH (COM80),HIGH (COM80),HIGH (COM80),HIGH (COM80),HIGH (COM80),HIGH (COM80),HIGH (COM80) ;0X98
DB HIGH (COMA0),HIGH (COMA0),HIGH (COMA0),HIGH (COMA0),HIGH (COMA0),HIGH (COMA0),HIGH (COMA0),HIGH (COMA0) ;0XA0
DB HIGH (COMA0),HIGH (COMA0),HIGH (COMA0),HIGH (COMA0),HIGH (COMA0),HIGH (COMA0),HIGH (COMA0),HIGH (COMA0) ;0XA8
DB HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ) ;0XB0
DB HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ) ;0XB8
DB HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ) ;0XC0
DB HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ) ;0XC8
DB HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ) ;0XD0
DB HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ) ;0XD8
DB HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ) ;0XE0
DB HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ),HIGH (COMHZ) ;0XE8
DUPL 0X10,0
FXJP1 DW FXNOP,FXNOP,FXNOP,FXNOP,FXNOP,FXNOP,FXNOP,FXNOP
DW FXNOP,FXNOP,FXNOP,FXB ,FXC ,FXD ,FXE ,FXF
DW FXRET,FXRET,FXRET,FXRET,FXRET,FXRET,FXRET,FXRET
DW FXRET,FXRET,FXRET,FXRET,FXRET,FXRET,FXRET,FXRET
FXJP2 DW FX0 ,FX1 ,FX2 ,FX3 ,FX4 ,FX5 ,FX6 ,FX7
DW FXRET,FXRET,FXA ,FXRET,FXRET,FXRET,FXE_ ,FXRET
DW FXRET,FXRET,FXRET,FXRET,FXRET,FXRET,FXRET,FXRET
DW FXRET,FXRET,FXRET,FXRET,FXRET,FXRET,FXRET,FXRET
FXEJP1 DW FXE0,FX1,FX2,FXE3,FXE4,FXE5,FXE6,FXE7
DW FXRET,FXE9,FXEA,FXA,FXEC,FXED,FXEE,FXRET
FXEJP2 DW FXRET,FXRET,FXRET,FXRET,FXRET,FXRET,FXRET,FXRET
DW FXRET,FXE9,FXRET,FXRET,FXEC,FXED,FXRET,FXRET
TCOMTB DEFW TCOM,TCOM,TCOM2,TCOM3,TCOM4,TCOM5,TCOM6,TCOM7
DEFW TCOM8,TCOM9,TCOMA,TCOMB,TCOMC,TCOMD,TCOME,TCOMF
DEFW TCOM10,TCOM11,TCOM12,TCOM13,TCOM14,TCOM15,TCOM,TCOM
DEFW TCOM,TCOM,TCOM,TCOM,TCOM,TCOM,TCOM,TCOM
;INCLUDE "DIHO.a80"
;RETURN: E - NOTE
NOTEID LD HL,AMINOTE
CALL DIH
LD E,A
RET
;RETURN: E - NOTE
NOTEGET LD E,(IY+CHNOTE)
LD A,E
INC A
RET NZ
NOTEFND LD HL,AMFRQTB
LD A,(IY+CHFINE)
RRA
AND 0X0F
JR Z,NOTEFN1
LD C,A
ADD A,A
ADD A,C
ADD A,A
ADD A,A
ADD A,A
LD B,0
RL B
ADD A,A
RL B
ADD A,A
RL B
LD C,A
ADD HL,BC
NOTEFN1 LD E,(IY+CHPERL)
LD D,(IY+CHPERH)
CALL DIH
LD E,A
RET
DIH LD BC,0X005F
PUSH HL
INC HL
LD A,(HL)
DEC HL
CP D
JR C,DIHRGR
JR NZ,DIH2
LD A,(HL)
CP E
JR C,DIHRGR
JR NZ,DIH2
POP HL
XOR A
SCF
RET
DIHRGR LD E,(HL)
INC HL
LD D,(HL)
POP HL
XOR A
RET
DIH2 LD A,0XBF
ADD A,L
LD L,A
LD A,H
ADC A,B
LD H,A
LD A,(HL)
DEC HL
CP D
JR C,DIH3
JR NZ,DIHRLO
LD A,(HL)
CP E
JR C,DIH3
JR NZ,DIHRLO
POP HL
LD A,C
SCF
RET
DIHRLO LD E,(HL)
INC HL
LD D,(HL)
POP HL
LD A,C
OR A
RET
DIH3 POP HL
DIHLP PUSH HL
LD A,B
ADD A,C
AND 0XFE
ADD A,L
LD L,A
LD A,H
ADC A,0X00
LD H,A
INC HL
LD A,(HL)
DEC HL
CP D
JR C,DIHGR
JR NZ,DIHLO
LD A,(HL)
CP E
JR C,DIHGR
JR NZ,DIHLO
POP HL
LD A,B
ADD A,C
SRL A
SCF
RET
DIHGR LD A,B
ADD A,C
SRL A
LD C,A
POP HL
JP DIHLP
DIHLO LD A,B
ADD A,C
SRL A
CP B
LD B,A
JR Z,DIHMID
POP HL
JP DIHLP
DIHMID PUSH HL
PUSH BC
LD A,(HL)
INC HL
SUB E
LD C,A
LD A,(HL)
INC HL
SBC A,D
LD B,A
LD A,(HL)
INC HL
LD H,(HL)
LD L,A
EX DE,HL
OR A
SBC HL,DE
LD A,H
CP B
JR C,DIHFLO
JR NZ,DIHFGR
LD A,L
CP C
JR C,DIHFLO
JR NZ,DIHFGR
DIHFLO POP BC
POP HL
POP HL
LD A,C
OR A
RET
DIHFGR POP BC
POP HL
LD E,(HL)
INC HL
LD D,(HL)
POP HL
LD A,B
RET
AMINOTE dw 0X1AC0,0X1940,0X17D0,0X1680,0X1530,0X1400,0X12E0,0X11D0,0X10D0,0X0FE0,0X0F00,0X0E28;C-0
dw 0X0D60,0X0CA0,0X0BE8,0X0B40,0X0A98,0X0A00,0X0970,0X08E8,0X0868,0X07F0,0X0780,0X0714;C-1
dw 0X06B0,0X0650,0X05F4,0X05A0,0X054C,0X0500,0X04B8,0X0474,0X0434,0X03F8,0X03C0,0X038A;C-2
dw 0X0358,0X0328,0X02FA,0X02D0,0X02A6,0X0280,0X025C,0X023A,0X021A,0X01FC,0X01E0,0X01C5;C-3
dw 0X01AC,0X0194,0X017D,0X0168,0X0153,0X0140,0X012E,0X011D,0X010D,0X00FE,0X00F0,0X00E2;C-4
dw 0X00D6,0X00CA,0X00BE,0X00B4,0X00AA,0X00A0,0X0097,0X008F,0X0087,0X007F,0X0078,0X0071;C-5
dw 0X006B,0X0065,0X005F,0X005A,0X0055,0X0050,0X004B,0X0047,0X0043,0X003F,0X003C,0X0038;C-6
dw 0X0035,0X0032,0X002F,0X002D,0X002A,0X0028,0X0025,0X0023,0X0021,0X001F,0X001E,0X001C;C-7
___END
DUPL GSRomBaseH+0X2000-$,0XFF
PHASE GSRomBaseH+0X2000
;INCLUDE "_GSFRQTB.a80" ;patched
GSFRQTB
;00
dw 0X4854,0X4446,0X4071,0X3CD1,0X3968,0X362F,0X3324,0X3045,0X2D91,0X2B02,0X2897,0X2652
dw 0X242A,0X2223,0X2037,0X1E68,0X1CB5,0X1B17,0X1992,0X1822,0X16C8,0X1581,0X144D,0X1329
dw 0X1215,0X1111,0X101B,0X0F35,0X0E5A,0X0D8D,0X0CCA,0X0C12,0X0B62,0X0AC0,0X0A26,0X0994
dw 0X090A,0X0888,0X080F,0X079A,0X072C,0X06C5,0X0663,0X0607,0X05B1,0X0560,0X0511,0X04C8
dw 0X0485,0X0444,0X0406,0X03CD,0X0397,0X0363,0X0333,0X0305,0X02DA,0X02AE,0X0288,0X0265
dw 0X0242,0X0222,0X0204,0X01E6,0X01CB,0X01B0,0X0198,0X0182,0X016D,0X0157,0X0144,0X0131
dw 0X0121,0X0111,0X0100,0X00F3,0X00E5,0X00D8,0X00CD,0X00BF,0X00B5,0X00AD,0X00A2,0X009A
dw 0X0092,0X0087,0X0081,0X0079,0X0071,0X006C,0X0066,0X0061,0X005B,0X0056,0X0051,0X004B
;01
dw 0X47D0,0X43C7,0X3FFA,0X3C62,0X38FE,0X35CB,0X32C6,0X2FEE,0X2D3D,0X2AB4,0X284E,0X260B
dw 0X23E6,0X21E5,0X1FFB,0X1E32,0X1C7F,0X1AE7,0X1964,0X17F7,0X169D,0X1558,0X1427,0X1305
dw 0X11F4,0X10F1,0X0FFD,0X0F18,0X0E3F,0X0D72,0X0CB2,0X0BFA,0X0B4F,0X0AAD,0X0A13,0X0981
dw 0X08FA,0X0878,0X07FE,0X078D,0X0721,0X06BA,0X0659,0X05FD,0X05A6,0X0555,0X0509,0X04C0
dw 0X047D,0X043C,0X0400,0X03C5,0X038F,0X035B,0X032B,0X02FF,0X02D4,0X02AC,0X0283,0X0260
dw 0X023D,0X021F,0X01FF,0X01E4,0X01C8,0X01AD,0X0195,0X017F,0X016A,0X0154,0X0141,0X0131
dw 0X011E,0X010E,0X0100,0X00F0,0X00E3,0X00D8,0X00CA,0X00BF,0X00B5,0X00AA,0X00A2,0X0097
dw 0X008F,0X0087,0X007F,0X0079,0X0071,0X006C,0X0066,0X005E,0X0059,0X0056,0X0051,0X004B
;02
dw 0X474C,0X434B,0X3F83,0X3BF3,0X3895,0X356A,0X326A,0X2F95,0X2CE9,0X2A63,0X2802,0X25C5
dw 0X23A6,0X21A4,0X1FC2,0X1DF9,0X1C4C,0X1AB3,0X1933,0X17C9,0X1674,0X1532,0X1401,0X12E2
dw 0X11D1,0X10D3,0X0FE0,0X0EFC,0X0E24,0X0D59,0X0C99,0X0BE4,0X0B3A,0X0A98,0X0A00,0X0971
dw 0X08EA,0X0868,0X07F1,0X077D,0X0713,0X06AC,0X064E,0X05F2,0X059E,0X054D,0X0501,0X04B8
dw 0X0475,0X0434,0X03F8,0X03BF,0X0389,0X0356,0X0325,0X02FA,0X02CF,0X02A6,0X0280,0X025A
dw 0X023A,0X021A,0X01FC,0X01DE,0X01C3,0X01AB,0X0192,0X017D,0X0167,0X0152,0X013F,0X012E
dw 0X011B,0X010E,0X00FE,0X00F0,0X00E3,0X00D5,0X00CA,0X00BD,0X00B2,0X00AA,0X009F,0X0097
dw 0X008F,0X0087,0X007F,0X0076,0X0071,0X006C,0X0064,0X005E,0X0059,0X0053,0X0051,0X004B
;03
dw 0X46C7,0X42CE,0X3F0E,0X3B85,0X382E,0X3506,0X320E,0X2F3E,0X2C98,0X2A17,0X27B9,0X257F
dw 0X2365,0X2168,0X1F87,0X1DC3,0X1C15,0X1A83,0X1905,0X179E,0X164C,0X150A,0X13DB,0X12BF
dw 0X11B1,0X10B3,0X0FC5,0X0EE1,0X0E0C,0X0D41,0X0C84,0X0BCF,0X0B24,0X0A85,0X09ED,0X095E
dw 0X08D9,0X085A,0X07E1,0X076F,0X0706,0X06A2,0X0640,0X05E7,0X0593,0X0542,0X04F6,0X04B0
dw 0X046C,0X042C,0X03F0,0X03B7,0X0381,0X0351,0X0320,0X02F5,0X02C9,0X02A1,0X027B,0X0258
dw 0X0235,0X0217,0X01F9,0X01DB,0X01C0,0X01A8,0X0190,0X017A,0X0164,0X0152,0X013F,0X012C
dw 0X011B,0X010B,0X00FB,0X00ED,0X00E0,0X00D2,0X00C8,0X00BD,0X00B2,0X00A7,0X009F,0X0094
dw 0X008C,0X0084,0X007F,0X0076,0X0071,0X0069,0X0064,0X005E,0X0059,0X0053,0X004E,0X004B
;04
dw 0X4645,0X4255,0X3E9A,0X3B18,0X37C7,0X34A4,0X31AF,0X2EE5,0X2C44,0X29C9,0X2770,0X2538
dw 0X2324,0X212A,0X1F4E,0X1D8B,0X1BE2,0X1A52,0X18D7,0X1772,0X1623,0X14E4,0X13B8,0X129C
dw 0X1190,0X1095,0X0FA7,0X0EC6,0X0DF1,0X0D29,0X0C6B,0X0BB9,0X0B11,0X0A72,0X09DA,0X094E
dw 0X08C9,0X084A,0X07D3,0X0762,0X06F8,0X0694,0X0635,0X05DC,0X0588,0X0537,0X04EE,0X04A8
dw 0X0464,0X0423,0X03E8,0X03B2,0X037C,0X034B,0X031A,0X02EF,0X02C4,0X029B,0X0276,0X0252
dw 0X0232,0X0211,0X01F4,0X01D9,0X01BE,0X01A5,0X018D,0X0177,0X0162,0X014F,0X013C,0X0129
dw 0X0119,0X0108,0X00FB,0X00EB,0X00E0,0X00D2,0X00C8,0X00BA,0X00AF,0X00A7,0X009C,0X0094
dw 0X008C,0X0084,0X007C,0X0076,0X006E,0X0069,0X0064,0X005E,0X0059,0X0053,0X004E,0X004B
;05
dw 0X45C3,0X41D8,0X3E29,0X3AAA,0X3761,0X3443,0X3156,0X2E8F,0X2BF3,0X297A,0X2727,0X24F5
dw 0X22E3,0X20EC,0X1F13,0X1D55,0X1BAF,0X1A21,0X18A9,0X1747,0X15FB,0X14BE,0X1395,0X1279
dw 0X1170,0X1077,0X0F89,0X0EAB,0X0DD8,0X0D10,0X0C56,0X0BA3,0X0AFC,0X0A5F,0X09CA,0X093E
dw 0X08B9,0X083A,0X07C6,0X0754,0X06EB,0X0689,0X062B,0X05D1,0X057E,0X052F,0X04E3,0X049D
dw 0X045C,0X041E,0X03E3,0X03AA,0X0376,0X0343,0X0315,0X02EA,0X02BF,0X0296,0X0273,0X0250
dw 0X022D,0X020F,0X01F1,0X01D6,0X01BB,0X01A3,0X018A,0X0175,0X015F,0X014C,0X0139,0X0126
dw 0X0116,0X0106,0X00F8,0X00EB,0X00DD,0X00D0,0X00C5,0X00BA,0X00AF,0X00A4,0X009C,0X0094
dw 0X008C,0X0084,0X007C,0X0074,0X006E,0X0069,0X0061,0X005B,0X0059,0X0053,0X004E,0X0049
;06
dw 0X4544,0X4161,0X3DB4,0X3A3D,0X36FA,0X33E4,0X30FA,0X2E3B,0X2BA2,0X292E,0X26DE,0X24B1
dw 0X22A2,0X20B0,0X1EDA,0X1D1E,0X1B7B,0X19F1,0X187B,0X171C,0X15D2,0X1498,0X136F,0X1258
dw 0X114F,0X1057,0X0F6E,0X0E90,0X0DBD,0X0CF8,0X0C3D,0X0B8E,0X0AE9,0X0A4C,0X09B7,0X092B
dw 0X08A9,0X082C,0X07B5,0X0747,0X06E0,0X067C,0X0620,0X05C7,0X0573,0X0524,0X04DB,0X0495
dw 0X0454,0X0416,0X03DA,0X03A4,0X036E,0X033E,0X0310,0X02E4,0X02B9,0X0293,0X026D,0X024A
dw 0X022A,0X0209,0X01EE,0X01D1,0X01B8,0X01A0,0X0188,0X0172,0X015C,0X0149,0X0136,0X0126
dw 0X0113,0X0106,0X00F6,0X00E8,0X00DB,0X00D0,0X00C2,0X00B7,0X00AF,0X00A4,0X009C,0X0092
dw 0X0089,0X0081,0X007C,0X0074,0X006E,0X0066,0X0061,0X005B,0X0056,0X0051,0X004E,0X0049
;07
dw 0X44C3,0X40E8,0X3D43,0X39D4,0X3693,0X3383,0X30A1,0X2DE4,0X2B51,0X28E3,0X2698,0X246E
dw 0X2261,0X2075,0X1EA1,0X1CE8,0X1B4B,0X19C3,0X1850,0X16F3,0X15A9,0X1472,0X134C,0X1235
dw 0X1132,0X1039,0X0F50,0X0E75,0X0DA5,0X0CE0,0X0C28,0X0B78,0X0AD3,0X0A39,0X09A4,0X091A
dw 0X0899,0X081C,0X07A8,0X0739,0X06D2,0X0671,0X0612,0X05BC,0X056B,0X051C,0X04D3,0X048D
dw 0X044C,0X040E,0X03D5,0X039C,0X0369,0X0338,0X030A,0X02DF,0X02B4,0X028E,0X0268,0X0248
dw 0X0224,0X0207,0X01E9,0X01CE,0X01B3,0X019B,0X0185,0X016F,0X015A,0X0147,0X0134,0X0124
dw 0X0113,0X0103,0X00F6,0X00E8,0X00DB,0X00CD,0X00C2,0X00B7,0X00AD,0X00A2,0X009A,0X0092
dw 0X0089,0X0081,0X0079,0X0074,0X006C,0X0066,0X0061,0X005B,0X0056,0X0051,0X004E,0X0049
;08
dw 0X4CA1,0X4854,0X4446,0X4071,0X3CD1,0X3968,0X362F,0X3324,0X3045,0X2D91,0X2B02,0X2897
dw 0X2652,0X242A,0X2223,0X2037,0X1E68,0X1CB5,0X1B17,0X1992,0X1822,0X16C8,0X1581,0X144D
dw 0X1329,0X1215,0X1111,0X101B,0X0F35,0X0E5A,0X0D8D,0X0CCA,0X0C12,0X0B62,0X0AC0,0X0A26
dw 0X0994,0X090A,0X0888,0X080F,0X079A,0X072C,0X06C5,0X0663,0X0607,0X05B1,0X0560,0X0511
dw 0X04C8,0X0485,0X0444,0X0406,0X03CD,0X0397,0X0363,0X0333,0X0305,0X02DA,0X02AE,0X0288
dw 0X0265,0X0242,0X0222,0X0204,0X01E6,0X01CB,0X01B0,0X0198,0X0182,0X016D,0X0157,0X0144
dw 0X0131,0X0121,0X0111,0X0100,0X00F3,0X00E5,0X00D8,0X00CD,0X00BF,0X00B5,0X00AD,0X00A2
dw 0X009A,0X0092,0X0087,0X0081,0X0079,0X0071,0X006C,0X0066,0X0061,0X005B,0X0056,0X0051
;09
dw 0X4C14,0X47D0,0X43C7,0X3FFA,0X3C62,0X38FE,0X35CB,0X32C6,0X2FEE,0X2D3D,0X2AB4,0X284E
dw 0X260B,0X23E6,0X21E5,0X1FFB,0X1E32,0X1C7F,0X1AE7,0X1964,0X17F7,0X169D,0X1558,0X1427
dw 0X1305,0X11F4,0X10F1,0X0FFD,0X0F18,0X0E3F,0X0D72,0X0CB2,0X0BFA,0X0B4F,0X0AAD,0X0A13
dw 0X0981,0X08FA,0X0878,0X07FE,0X078D,0X0721,0X06BA,0X0659,0X05FD,0X05A6,0X0555,0X0509
dw 0X04C0,0X047D,0X043C,0X0400,0X03C5,0X038F,0X035B,0X032B,0X02FF,0X02D4,0X02AC,0X0283
dw 0X0260,0X023D,0X021F,0X01FF,0X01E4,0X01C8,0X01AD,0X0195,0X017F,0X016A,0X0154,0X0141
dw 0X0131,0X011E,0X010E,0X0100,0X00F0,0X00E3,0X00D8,0X00CA,0X00BF,0X00B5,0X00AA,0X00A2
dw 0X0097,0X008F,0X0087,0X007F,0X0079,0X0071,0X006C,0X0066,0X005E,0X0059,0X0056,0X0051
;0A
dw 0X4B88,0X474C,0X434B,0X3F83,0X3BF3,0X3895,0X356A,0X326A,0X2F95,0X2CE9,0X2A63,0X2802
dw 0X25C5,0X23A6,0X21A4,0X1FC2,0X1DF9,0X1C4C,0X1AB3,0X1933,0X17C9,0X1674,0X1532,0X1401
dw 0X12E2,0X11D1,0X10D3,0X0FE0,0X0EFC,0X0E24,0X0D59,0X0C99,0X0BE4,0X0B3A,0X0A98,0X0A00
dw 0X0971,0X08EA,0X0868,0X07F1,0X077D,0X0713,0X06AC,0X064E,0X05F2,0X059E,0X054D,0X0501
dw 0X04B8,0X0475,0X0434,0X03F8,0X03BF,0X0389,0X0356,0X0325,0X02FA,0X02CF,0X02A6,0X0280
dw 0X025A,0X023A,0X021A,0X01FC,0X01DE,0X01C3,0X01AB,0X0192,0X017D,0X0167,0X0152,0X013F
dw 0X012E,0X011B,0X010E,0X00FE,0X00F0,0X00E3,0X00D5,0X00CA,0X00BD,0X00B2,0X00AA,0X009F
dw 0X0097,0X008F,0X0087,0X007F,0X0076,0X0071,0X006C,0X0064,0X005E,0X0059,0X0053,0X0051
;0B
dw 0X4AFE,0X46C7,0X42CE,0X3F0E,0X3B85,0X382E,0X3506,0X320E,0X2F3E,0X2C98,0X2A17,0X27B9
dw 0X257F,0X2365,0X2168,0X1F87,0X1DC3,0X1C15,0X1A83,0X1905,0X179E,0X164C,0X150A,0X13DB
dw 0X12BF,0X11B1,0X10B3,0X0FC5,0X0EE1,0X0E0C,0X0D41,0X0C84,0X0BCF,0X0B24,0X0A85,0X09ED
dw 0X095E,0X08D9,0X085A,0X07E1,0X076F,0X0706,0X06A2,0X0640,0X05E7,0X0593,0X0542,0X04F6
dw 0X04B0,0X046C,0X042C,0X03F0,0X03B7,0X0381,0X0351,0X0320,0X02F5,0X02C9,0X02A1,0X027B
dw 0X0258,0X0235,0X0217,0X01F9,0X01DB,0X01C0,0X01A8,0X0190,0X017A,0X0164,0X0152,0X013F
dw 0X012C,0X011B,0X010B,0X00FB,0X00ED,0X00E0,0X00D2,0X00C8,0X00BD,0X00B2,0X00A7,0X009F
dw 0X0094,0X008C,0X0084,0X007F,0X0076,0X0071,0X0069,0X0064,0X005E,0X0059,0X0053,0X004E
;0C
dw 0X4A74,0X4645,0X4255,0X3E9A,0X3B18,0X37C7,0X34A4,0X31AF,0X2EE5,0X2C44,0X29C9,0X2770
dw 0X2538,0X2324,0X212A,0X1F4E,0X1D8B,0X1BE2,0X1A52,0X18D7,0X1772,0X1623,0X14E4,0X13B8
dw 0X129C,0X1190,0X1095,0X0FA7,0X0EC6,0X0DF1,0X0D29,0X0C6B,0X0BB9,0X0B11,0X0A72,0X09DA
dw 0X094E,0X08C9,0X084A,0X07D3,0X0762,0X06F8,0X0694,0X0635,0X05DC,0X0588,0X0537,0X04EE
dw 0X04A8,0X0464,0X0423,0X03E8,0X03B2,0X037C,0X034B,0X031A,0X02EF,0X02C4,0X029B,0X0276
dw 0X0252,0X0232,0X0211,0X01F4,0X01D9,0X01BE,0X01A5,0X018D,0X0177,0X0162,0X014F,0X013C
dw 0X0129,0X0119,0X0108,0X00FB,0X00EB,0X00E0,0X00D2,0X00C8,0X00BA,0X00AF,0X00A7,0X009C
dw 0X0094,0X008C,0X0084,0X007C,0X0076,0X006E,0X0069,0X0064,0X005E,0X0059,0X0053,0X004E
;0D
dw 0X49EA,0X45C3,0X41D8,0X3E29,0X3AAA,0X3761,0X3443,0X3156,0X2E8F,0X2BF3,0X297A,0X2727
dw 0X24F5,0X22E3,0X20EC,0X1F13,0X1D55,0X1BAF,0X1A21,0X18A9,0X1747,0X15FB,0X14BE,0X1395
dw 0X1279,0X1170,0X1077,0X0F89,0X0EAB,0X0DD8,0X0D10,0X0C56,0X0BA3,0X0AFC,0X0A5F,0X09CA
dw 0X093E,0X08B9,0X083A,0X07C6,0X0754,0X06EB,0X0689,0X062B,0X05D1,0X057E,0X052F,0X04E3
dw 0X049D,0X045C,0X041E,0X03E3,0X03AA,0X0376,0X0343,0X0315,0X02EA,0X02BF,0X0296,0X0273
dw 0X0250,0X022D,0X020F,0X01F1,0X01D6,0X01BB,0X01A3,0X018A,0X0175,0X015F,0X014C,0X0139
dw 0X0126,0X0116,0X0106,0X00F8,0X00EB,0X00DD,0X00D0,0X00C5,0X00BA,0X00AF,0X00A4,0X009C
dw 0X0094,0X008C,0X0084,0X007C,0X0074,0X006E,0X0069,0X0061,0X005B,0X0059,0X0053,0X004E
;0E
dw 0X4963,0X4544,0X4161,0X3DB4,0X3A3D,0X36FA,0X33E4,0X30FA,0X2E3B,0X2BA2,0X292E,0X26DE
dw 0X24B1,0X22A2,0X20B0,0X1EDA,0X1D1E,0X1B7B,0X19F1,0X187B,0X171C,0X15D2,0X1498,0X136F
dw 0X1258,0X114F,0X1057,0X0F6E,0X0E90,0X0DBD,0X0CF8,0X0C3D,0X0B8E,0X0AE9,0X0A4C,0X09B7
dw 0X092B,0X08A9,0X082C,0X07B5,0X0747,0X06E0,0X067C,0X0620,0X05C7,0X0573,0X0524,0X04DB
dw 0X0495,0X0454,0X0416,0X03DA,0X03A4,0X036E,0X033E,0X0310,0X02E4,0X02B9,0X0293,0X026D
dw 0X024A,0X022A,0X0209,0X01EE,0X01D1,0X01B8,0X01A0,0X0188,0X0172,0X015C,0X0149,0X0136
dw 0X0126,0X0113,0X0106,0X00F6,0X00E8,0X00DB,0X00D0,0X00C2,0X00B7,0X00AF,0X00A4,0X009C
dw 0X0092,0X0089,0X0081,0X007C,0X0074,0X006E,0X0066,0X0061,0X005B,0X0056,0X0051,0X004E
;0F
dw 0X48DC,0X44C3,0X40E8,0X3D43,0X39D4,0X3693,0X3383,0X30A1,0X2DE4,0X2B51,0X28E3,0X2698
dw 0X246E,0X2261,0X2075,0X1EA1,0X1CE8,0X1B4B,0X19C3,0X1850,0X16F3,0X15A9,0X1472,0X134C
dw 0X1235,0X1132,0X1039,0X0F50,0X0E75,0X0DA5,0X0CE0,0X0C28,0X0B78,0X0AD3,0X0A39,0X09A4
dw 0X091A,0X0899,0X081C,0X07A8,0X0739,0X06D2,0X0671,0X0612,0X05BC,0X056B,0X051C,0X04D3
dw 0X048D,0X044C,0X040E,0X03D5,0X039C,0X0369,0X0338,0X030A,0X02DF,0X02B4,0X028E,0X0268
dw 0X0248,0X0224,0X0207,0X01E9,0X01CE,0X01B3,0X019B,0X0185,0X016F,0X015A,0X0147,0X0134
dw 0X0124,0X0113,0X0103,0X00F6,0X00E8,0X00DB,0X00CD,0X00C2,0X00B7,0X00AD,0X00A2,0X009A
dw 0X0092,0X0089,0X0081,0X0079,0X0074,0X006C,0X0066,0X0061,0X005B,0X0056,0X0051,0X004E
;INCLUDE "_AMFRQTB.a80"
AMFRQTB ;EQU 0XEC00
;00
dw 0X1AC0,0X1940,0X17D5,0X167E,0X153B,0X140A,0X12EA,0X11DA,0X10DA,0X0FE8,0X0F03,0X0E2C
dw 0X0D60,0X0CA0,0X0BEA,0X0B3F,0X0A9E,0X0A05,0X0975,0X08ED,0X086D,0X07F4,0X0782,0X0716
dw 0X06B0,0X0650,0X05F5,0X05A0,0X054F,0X0503,0X04BB,0X0477,0X0436,0X03FA,0X03C1,0X038B
dw 0X0358,0X0328,0X02FB,0X02D0,0X02A7,0X0281,0X025D,0X023B,0X021B,0X01FD,0X01E0,0X01C5
dw 0X01AC,0X0194,0X017D,0X0168,0X0154,0X0141,0X012F,0X011E,0X010E,0X00FE,0X00F0,0X00E3
dw 0X00D6,0X00CA,0X00BF,0X00B4,0X00AA,0X00A0,0X0097,0X008F,0X0087,0X007F,0X0078,0X0071
dw 0X006B,0X0065,0X005F,0X005A,0X0055,0X0050,0X004C,0X0047,0X0043,0X0040,0X003C,0X0039
dw 0X0036,0X0032,0X0030,0X002D,0X002A,0X0028,0X0026,0X0024,0X0022,0X0020,0X001E,0X001C
;01
dw 0X1A8F,0X1911,0X17A9,0X1655,0X1514,0X13E5,0X12C7,0X11BA,0X10BB,0X0FCB,0X0EE8,0X0E12
dw 0X0D47,0X0C89,0X0BD4,0X0B2B,0X0A8A,0X09F3,0X0964,0X08DD,0X085D,0X07E5,0X0774,0X0709
dw 0X06A4,0X0644,0X05EA,0X0595,0X0545,0X04F9,0X04B2,0X046E,0X042F,0X03F3,0X03BA,0X0384
dw 0X0352,0X0322,0X02F5,0X02CB,0X02A3,0X027D,0X0259,0X0237,0X0217,0X01F9,0X01DD,0X01C2
dw 0X01A9,0X0191,0X017B,0X0165,0X0151,0X013E,0X012C,0X011C,0X010C,0X00FD,0X00EE,0X00E1
dw 0X00D4,0X00C9,0X00BD,0X00B3,0X00A9,0X009F,0X0096,0X008E,0X0086,0X007E,0X0077,0X0071
dw 0X006A,0X0064,0X005F,0X0059,0X0054,0X0050,0X004B,0X0047,0X0043,0X003F,0X003C,0X0038
dw 0X0035,0X0032,0X002F,0X002D,0X002A,0X0028,0X0026,0X0023,0X0021,0X0020,0X001E,0X001C
;02
dw 0X1A5E,0X18E3,0X177D,0X162C,0X14ED,0X13C1,0X12A5,0X1199,0X109C,0X0FAD,0X0ECC,0X0DF8
dw 0X0D2F,0X0C71,0X0BBF,0X0B16,0X0A77,0X09E0,0X0952,0X08CC,0X084E,0X07D7,0X0766,0X06FC
dw 0X0697,0X0639,0X05DF,0X058B,0X053B,0X04F0,0X04A9,0X0466,0X0427,0X03EB,0X03B3,0X037E
dw 0X034C,0X031C,0X02F0,0X02C5,0X029E,0X0278,0X0255,0X0233,0X0214,0X01F6,0X01DA,0X01BF
dw 0X01A6,0X018E,0X0178,0X0163,0X014F,0X013C,0X012A,0X011A,0X010A,0X00FB,0X00ED,0X00DF
dw 0X00D3,0X00C7,0X00BC,0X00B1,0X00A7,0X009E,0X0095,0X008D,0X0085,0X007D,0X0076,0X0070
dw 0X0069,0X0064,0X005E,0X0059,0X0054,0X004F,0X004B,0X0046,0X0042,0X003F,0X003B,0X0038
dw 0X0035,0X0032,0X002F,0X002C,0X002A,0X0028,0X0025,0X0023,0X0021,0X001F,0X001E,0X001C
;03
dw 0X1A2D,0X18B5,0X1752,0X1603,0X14C7,0X139C,0X1283,0X1179,0X107E,0X0F91,0X0EB1,0X0DDE
dw 0X0D17,0X0C5B,0X0BA9,0X0B02,0X0A63,0X09CE,0X0941,0X08BC,0X083F,0X07C8,0X0758,0X06EF
dw 0X068B,0X062D,0X05D5,0X0581,0X0532,0X04E7,0X04A1,0X045E,0X041F,0X03E4,0X03AC,0X0377
dw 0X0346,0X0317,0X02EA,0X02C0,0X0299,0X0274,0X0250,0X022F,0X0210,0X01F2,0X01D6,0X01BC
dw 0X01A3,0X018B,0X0175,0X0160,0X014C,0X013A,0X0128,0X0118,0X0108,0X00F9,0X00EB,0X00DE
dw 0X00D1,0X00C6,0X00BB,0X00B0,0X00A6,0X009D,0X0094,0X008C,0X0084,0X007D,0X0076,0X006F
dw 0X0069,0X0063,0X005D,0X0058,0X0053,0X004E,0X004A,0X0046,0X0042,0X003E,0X003B,0X0037
dw 0X0034,0X0031,0X002F,0X002C,0X002A,0X0027,0X0025,0X0023,0X0021,0X001F,0X001D,0X001C
;04
dw 0X19FD,0X1888,0X1727,0X15DB,0X14A1,0X1378,0X1260,0X1158,0X105F,0X0F74,0X0E96,0X0DC4
dw 0X0CFF,0X0C44,0X0B94,0X0AED,0X0A50,0X09BC,0X0930,0X08AC,0X0830,0X07BA,0X074B,0X06E2
dw 0X067F,0X0622,0X05CA,0X0577,0X0528,0X04DE,0X0498,0X0456,0X0418,0X03DD,0X03A5,0X0371
dw 0X0340,0X0311,0X02E5,0X02BB,0X0294,0X026F,0X024C,0X022B,0X020C,0X01EE,0X01D3,0X01B9
dw 0X01A0,0X0188,0X0172,0X015E,0X014A,0X0138,0X0126,0X0116,0X0106,0X00F7,0X00E9,0X00DC
dw 0X00D0,0X00C4,0X00B9,0X00AF,0X00A5,0X009C,0X0093,0X008B,0X0083,0X007C,0X0075,0X006E
dw 0X0068,0X0062,0X005D,0X0057,0X0053,0X004E,0X004A,0X0045,0X0041,0X003E,0X003A,0X0037
dw 0X0034,0X0031,0X002E,0X002C,0X0029,0X0027,0X0025,0X0023,0X0021,0X001F,0X001D,0X001C
;05
dw 0X19CD,0X185A,0X16FD,0X15B2,0X147B,0X1354,0X123F,0X1138,0X1041,0X0F57,0X0E7B,0X0DAB
dw 0X0CE7,0X0C2D,0X0B7E,0X0AD9,0X0A3D,0X09AA,0X091F,0X089C,0X0821,0X07AC,0X073E,0X06D5
dw 0X0673,0X0617,0X05BF,0X056D,0X051F,0X04D5,0X0490,0X044E,0X0410,0X03D6,0X039F,0X036B
dw 0X033A,0X030B,0X02E0,0X02B6,0X028F,0X026B,0X0248,0X0227,0X0208,0X01EB,0X01CF,0X01B5
dw 0X019D,0X0186,0X0170,0X015B,0X0148,0X0135,0X0124,0X0114,0X0104,0X00F5,0X00E8,0X00DB
dw 0X00CE,0X00C3,0X00B8,0X00AE,0X00A4,0X009B,0X0092,0X008A,0X0082,0X007B,0X0074,0X006D
dw 0X0067,0X0061,0X005C,0X0057,0X0052,0X004D,0X0049,0X0045,0X0041,0X003D,0X003A,0X0037
dw 0X0034,0X0031,0X002E,0X002B,0X0029,0X0027,0X0024,0X0022,0X0021,0X001F,0X001D,0X001B
;06
dw 0X199E,0X182E,0X16D2,0X158A,0X1455,0X1331,0X121D,0X1119,0X1023,0X0F3B,0X0E60,0X0D92
dw 0X0CCF,0X0C17,0X0B69,0X0AC5,0X0A2A,0X0998,0X090E,0X088C,0X0812,0X079E,0X0730,0X06C9
dw 0X0667,0X060B,0X05B5,0X0563,0X0515,0X04CC,0X0487,0X0446,0X0409,0X03CF,0X0398,0X0364
dw 0X0334,0X0306,0X02DA,0X02B1,0X028B,0X0266,0X0244,0X0223,0X0204,0X01E7,0X01CC,0X01B2
dw 0X019A,0X0183,0X016D,0X0159,0X0145,0X0133,0X0122,0X0112,0X0102,0X00F4,0X00E6,0X00D9
dw 0X00CD,0X00C1,0X00B7,0X00AC,0X00A3,0X009A,0X0091,0X0089,0X0081,0X007A,0X0073,0X006D
dw 0X0066,0X0061,0X005B,0X0056,0X0051,0X004D,0X0048,0X0044,0X0041,0X003D,0X003A,0X0036
dw 0X0033,0X0030,0X002E,0X002B,0X0029,0X0026,0X0024,0X0022,0X0020,0X001E,0X001D,0X001B
;07
dw 0X196E,0X1801,0X16A8,0X1563,0X142F,0X130D,0X11FC,0X10F9,0X1005,0X0F1F,0X0E46,0X0D79
dw 0X0CB7,0X0C01,0X0B54,0X0AB1,0X0A18,0X0987,0X08FE,0X087D,0X0803,0X0790,0X0723,0X06BC
dw 0X065C,0X0600,0X05AA,0X0559,0X050C,0X04C3,0X047F,0X043E,0X0401,0X03C8,0X0391,0X035E
dw 0X032E,0X0300,0X02D5,0X02AC,0X0286,0X0262,0X023F,0X021F,0X0201,0X01E4,0X01C9,0X01AF
dw 0X0197,0X0180,0X016B,0X0156,0X0143,0X0131,0X0120,0X0110,0X0100,0X00F2,0X00E4,0X00D8
dw 0X00CB,0X00C0,0X00B5,0X00AB,0X00A1,0X0098,0X0090,0X0088,0X0080,0X0079,0X0072,0X006C
dw 0X0066,0X0060,0X005B,0X0056,0X0051,0X004C,0X0048,0X0044,0X0040,0X003C,0X0039,0X0036
dw 0X0033,0X0030,0X002D,0X002B,0X0028,0X0026,0X0024,0X0022,0X0020,0X001E,0X001D,0X001B
;08
dw 0X1C57,0X1AC0,0X1940,0X17D5,0X167E,0X153B,0X140A,0X12EA,0X11DA,0X10DA,0X0FE8,0X0F03
dw 0X0E2C,0X0D60,0X0CA0,0X0BEA,0X0B3F,0X0A9E,0X0A05,0X0975,0X08ED,0X086D,0X07F4,0X0782
dw 0X0716,0X06B0,0X0650,0X05F5,0X05A0,0X054F,0X0503,0X04BB,0X0477,0X0436,0X03FA,0X03C1
dw 0X038B,0X0358,0X0328,0X02FB,0X02D0,0X02A7,0X0281,0X025D,0X023B,0X021B,0X01FD,0X01E0
dw 0X01C5,0X01AC,0X0194,0X017D,0X0168,0X0154,0X0141,0X012F,0X011E,0X010E,0X00FE,0X00F0
dw 0X00E3,0X00D6,0X00CA,0X00BF,0X00B4,0X00AA,0X00A0,0X0097,0X008F,0X0087,0X007F,0X0078
dw 0X0071,0X006B,0X0065,0X005F,0X005A,0X0055,0X0050,0X004C,0X0047,0X0043,0X0040,0X003C
dw 0X0039,0X0036,0X0032,0X0030,0X002D,0X002A,0X0028,0X0026,0X0024,0X0022,0X0020,0X001E
;09
dw 0X1C23,0X1A8F,0X1911,0X17A9,0X1655,0X1514,0X13E5,0X12C7,0X11BA,0X10BB,0X0FCB,0X0EE8
dw 0X0E12,0X0D47,0X0C89,0X0BD4,0X0B2B,0X0A8A,0X09F3,0X0964,0X08DD,0X085D,0X07E5,0X0774
dw 0X0709,0X06A4,0X0644,0X05EA,0X0595,0X0545,0X04F9,0X04B2,0X046E,0X042F,0X03F3,0X03BA
dw 0X0384,0X0352,0X0322,0X02F5,0X02CB,0X02A3,0X027D,0X0259,0X0237,0X0217,0X01F9,0X01DD
dw 0X01C2,0X01A9,0X0191,0X017B,0X0165,0X0151,0X013E,0X012C,0X011C,0X010C,0X00FD,0X00EE
dw 0X00E1,0X00D4,0X00C9,0X00BD,0X00B3,0X00A9,0X009F,0X0096,0X008E,0X0086,0X007E,0X0077
dw 0X0071,0X006A,0X0064,0X005F,0X0059,0X0054,0X0050,0X004B,0X0047,0X0043,0X003F,0X003C
dw 0X0038,0X0035,0X0032,0X002F,0X002D,0X002A,0X0028,0X0026,0X0023,0X0021,0X0020,0X001E
;0A
dw 0X1BEF,0X1A5E,0X18E3,0X177D,0X162C,0X14ED,0X13C1,0X12A5,0X1199,0X109C,0X0FAD,0X0ECC
dw 0X0DF8,0X0D2F,0X0C71,0X0BBF,0X0B16,0X0A77,0X09E0,0X0952,0X08CC,0X084E,0X07D7,0X0766
dw 0X06FC,0X0697,0X0639,0X05DF,0X058B,0X053B,0X04F0,0X04A9,0X0466,0X0427,0X03EB,0X03B3
dw 0X037E,0X034C,0X031C,0X02F0,0X02C5,0X029E,0X0278,0X0255,0X0233,0X0214,0X01F6,0X01DA
dw 0X01BF,0X01A6,0X018E,0X0178,0X0163,0X014F,0X013C,0X012A,0X011A,0X010A,0X00FB,0X00ED
dw 0X00DF,0X00D3,0X00C7,0X00BC,0X00B1,0X00A7,0X009E,0X0095,0X008D,0X0085,0X007D,0X0076
dw 0X0070,0X0069,0X0064,0X005E,0X0059,0X0054,0X004F,0X004B,0X0046,0X0042,0X003F,0X003B
dw 0X0038,0X0035,0X0032,0X002F,0X002C,0X002A,0X0028,0X0025,0X0023,0X0021,0X001F,0X001E
;0B
dw 0X1BBC,0X1A2D,0X18B5,0X1752,0X1603,0X14C7,0X139C,0X1283,0X1179,0X107E,0X0F91,0X0EB1
dw 0X0DDE,0X0D17,0X0C5B,0X0BA9,0X0B02,0X0A63,0X09CE,0X0941,0X08BC,0X083F,0X07C8,0X0758
dw 0X06EF,0X068B,0X062D,0X05D5,0X0581,0X0532,0X04E7,0X04A1,0X045E,0X041F,0X03E4,0X03AC
dw 0X0377,0X0346,0X0317,0X02EA,0X02C0,0X0299,0X0274,0X0250,0X022F,0X0210,0X01F2,0X01D6
dw 0X01BC,0X01A3,0X018B,0X0175,0X0160,0X014C,0X013A,0X0128,0X0118,0X0108,0X00F9,0X00EB
dw 0X00DE,0X00D1,0X00C6,0X00BB,0X00B0,0X00A6,0X009D,0X0094,0X008C,0X0084,0X007D,0X0076
dw 0X006F,0X0069,0X0063,0X005D,0X0058,0X0053,0X004E,0X004A,0X0046,0X0042,0X003E,0X003B
dw 0X0037,0X0034,0X0031,0X002F,0X002C,0X002A,0X0027,0X0025,0X0023,0X0021,0X001F,0X001D
;0C
dw 0X1B89,0X19FD,0X1888,0X1727,0X15DB,0X14A1,0X1378,0X1260,0X1158,0X105F,0X0F74,0X0E96
dw 0X0DC4,0X0CFF,0X0C44,0X0B94,0X0AED,0X0A50,0X09BC,0X0930,0X08AC,0X0830,0X07BA,0X074B
dw 0X06E2,0X067F,0X0622,0X05CA,0X0577,0X0528,0X04DE,0X0498,0X0456,0X0418,0X03DD,0X03A5
dw 0X0371,0X0340,0X0311,0X02E5,0X02BB,0X0294,0X026F,0X024C,0X022B,0X020C,0X01EE,0X01D3
dw 0X01B9,0X01A0,0X0188,0X0172,0X015E,0X014A,0X0138,0X0126,0X0116,0X0106,0X00F7,0X00E9
dw 0X00DC,0X00D0,0X00C4,0X00B9,0X00AF,0X00A5,0X009C,0X0093,0X008B,0X0083,0X007C,0X0075
dw 0X006E,0X0068,0X0062,0X005D,0X0057,0X0053,0X004E,0X004A,0X0045,0X0041,0X003E,0X003A
dw 0X0037,0X0034,0X0031,0X002E,0X002C,0X0029,0X0027,0X0025,0X0023,0X0021,0X001F,0X001D
;0D
dw 0X1B56,0X19CD,0X185A,0X16FD,0X15B2,0X147B,0X1354,0X123F,0X1138,0X1041,0X0F57,0X0E7B
dw 0X0DAB,0X0CE7,0X0C2D,0X0B7E,0X0AD9,0X0A3D,0X09AA,0X091F,0X089C,0X0821,0X07AC,0X073E
dw 0X06D5,0X0673,0X0617,0X05BF,0X056D,0X051F,0X04D5,0X0490,0X044E,0X0410,0X03D6,0X039F
dw 0X036B,0X033A,0X030B,0X02E0,0X02B6,0X028F,0X026B,0X0248,0X0227,0X0208,0X01EB,0X01CF
dw 0X01B5,0X019D,0X0186,0X0170,0X015B,0X0148,0X0135,0X0124,0X0114,0X0104,0X00F5,0X00E8
dw 0X00DB,0X00CE,0X00C3,0X00B8,0X00AE,0X00A4,0X009B,0X0092,0X008A,0X0082,0X007B,0X0074
dw 0X006D,0X0067,0X0061,0X005C,0X0057,0X0052,0X004D,0X0049,0X0045,0X0041,0X003D,0X003A
dw 0X0037,0X0034,0X0031,0X002E,0X002B,0X0029,0X0027,0X0024,0X0022,0X0021,0X001F,0X001D
;0E
dw 0X1B24,0X199E,0X182E,0X16D2,0X158A,0X1455,0X1331,0X121D,0X1119,0X1023,0X0F3B,0X0E60
dw 0X0D92,0X0CCF,0X0C17,0X0B69,0X0AC5,0X0A2A,0X0998,0X090E,0X088C,0X0812,0X079E,0X0730
dw 0X06C9,0X0667,0X060B,0X05B5,0X0563,0X0515,0X04CC,0X0487,0X0446,0X0409,0X03CF,0X0398
dw 0X0364,0X0334,0X0306,0X02DA,0X02B1,0X028B,0X0266,0X0244,0X0223,0X0204,0X01E7,0X01CC
dw 0X01B2,0X019A,0X0183,0X016D,0X0159,0X0145,0X0133,0X0122,0X0112,0X0102,0X00F4,0X00E6
dw 0X00D9,0X00CD,0X00C1,0X00B7,0X00AC,0X00A3,0X009A,0X0091,0X0089,0X0081,0X007A,0X0073
dw 0X006D,0X0066,0X0061,0X005B,0X0056,0X0051,0X004D,0X0048,0X0044,0X0041,0X003D,0X003A
dw 0X0036,0X0033,0X0030,0X002E,0X002B,0X0029,0X0026,0X0024,0X0022,0X0020,0X001E,0X001D
;0F
dw 0X1AF2,0X196E,0X1801,0X16A8,0X1563,0X142F,0X130D,0X11FC,0X10F9,0X1005,0X0F1F,0X0E46
dw 0X0D79,0X0CB7,0X0C01,0X0B54,0X0AB1,0X0A18,0X0987,0X08FE,0X087D,0X0803,0X0790,0X0723
dw 0X06BC,0X065C,0X0600,0X05AA,0X0559,0X050C,0X04C3,0X047F,0X043E,0X0401,0X03C8,0X0391
dw 0X035E,0X032E,0X0300,0X02D5,0X02AC,0X0286,0X0262,0X023F,0X021F,0X0201,0X01E4,0X01C9
dw 0X01AF,0X0197,0X0180,0X016B,0X0156,0X0143,0X0131,0X0120,0X0110,0X0100,0X00F2,0X00E4
dw 0X00D8,0X00CB,0X00C0,0X00B5,0X00AB,0X00A1,0X0098,0X0090,0X0088,0X0080,0X0079,0X0072
dw 0X006C,0X0066,0X0060,0X005B,0X0056,0X0051,0X004C,0X0048,0X0044,0X0040,0X003C,0X0039
dw 0X0036,0X0033,0X0030,0X002D,0X002B,0X0028,0X0026,0X0024,0X0022,0X0020,0X001E,0X001D
;INCLUDE "_AMTOGS.a80" ;patched
;AMTOGS ;EQU 0XF800
dw 0X0000,0X0003,0X0005,0X0008,0X000B,0X000E,0X0010,0X0013
dw 0X0016,0X0018,0X001B,0X001E,0X0020,0X0023,0X0026,0X0029
dw 0X002B,0X002E,0X0031,0X0033,0X0036,0X0039,0X003B,0X003E
dw 0X0041,0X0044,0X0046,0X0049,0X004C,0X004E,0X0051,0X0054
dw 0X0057,0X0059,0X005C,0X005F,0X0061,0X0064,0X0067,0X0069
dw 0X006C,0X006F,0X0072,0X0074,0X0077,0X007A,0X007C,0X007F
dw 0X0082,0X0084,0X0087,0X008A,0X008D,0X008F,0X0092,0X0095
dw 0X0097,0X009A,0X009D,0X00A0,0X00A2,0X00A5,0X00A8,0X00AA
dw 0X00AD,0X00B0,0X00B2,0X00B5,0X00B8,0X00BB,0X00BD,0X00C0
dw 0X00C3,0X00C5,0X00C8,0X00CB,0X00CD,0X00D0,0X00D3,0X00D6
dw 0X00D8,0X00DB,0X00DE,0X00E0,0X00E3,0X00E6,0X00E9,0X00EB
dw 0X00EE,0X00F1,0X00F3,0X00F6,0X00F9,0X00FB,0X00FE,0X0101
dw 0X0104,0X0106,0X0109,0X010C,0X010E,0X0111,0X0114,0X0117
dw 0X0119,0X011C,0X011F,0X0121,0X0124,0X0127,0X0129,0X012C
dw 0X012F,0X0132,0X0134,0X0137,0X013A,0X013C,0X013F,0X0142
dw 0X0144,0X0147,0X014A,0X014D,0X014F,0X0152,0X0155,0X0157
dw 0X015A,0X015D,0X0160,0X0162,0X0165,0X0168,0X016A,0X016D
dw 0X0170,0X0172,0X0175,0X0178,0X017B,0X017D,0X0180,0X0183
dw 0X0185,0X0188,0X018B,0X018D,0X0190,0X0193,0X0196,0X0198
dw 0X019B,0X019E,0X01A0,0X01A3,0X01A6,0X01A9,0X01AB,0X01AE
dw 0X01B1,0X01B3,0X01B6,0X01B9,0X01BB,0X01BE,0X01C1,0X01C4
dw 0X01C6,0X01C9,0X01CC,0X01CE,0X01D1,0X01D4,0X01D6,0X01D9
dw 0X01DC,0X01DF,0X01E1,0X01E4,0X01E7,0X01E9,0X01EC,0X01EF
dw 0X01F2,0X01F4,0X01F7,0X01FA,0X01FC,0X01FF,0X0202,0X0204
dw 0X0207,0X020A,0X020D,0X020F,0X0212,0X0215,0X0217,0X021A
dw 0X021D,0X021F,0X0222,0X0225,0X0228,0X022A,0X022D,0X0230
dw 0X0232,0X0235,0X0238,0X023B,0X023D,0X0240,0X0243,0X0245
dw 0X0248,0X024B,0X024D,0X0250,0X0253,0X0256,0X0258,0X025B
dw 0X025E,0X0260,0X0263,0X0266,0X0269,0X026B,0X026E,0X0271
dw 0X0273,0X0276,0X0279,0X027B,0X027E,0X0281,0X0284,0X0286
dw 0X0289,0X028C,0X028E,0X0291,0X0294,0X0296,0X0299,0X029C
dw 0X029F,0X02A1,0X02A4,0X02A7,0X02A9,0X02AC,0X02AF,0X02B2
dw 0X02B4,0X02B7,0X02BA,0X02BC,0X02BF,0X02C2,0X02C4,0X02C7
dw 0X02CA,0X02CD,0X02CF,0X02D2,0X02D5,0X02D7,0X02DA,0X02DD
dw 0X02DF,0X02E2,0X02E5,0X02E8,0X02EA,0X02ED,0X02F0,0X02F2
dw 0X02F5,0X02F8,0X02FB,0X02FD,0X0300,0X0303,0X0305,0X0308
dw 0X030B,0X030D,0X0310,0X0313,0X0316,0X0318,0X031B,0X031E
dw 0X0320,0X0323,0X0326,0X0328,0X032B,0X032E,0X0331,0X0333
dw 0X0336,0X0339,0X033B,0X033E,0X0341,0X0344,0X0346,0X0349
dw 0X034C,0X034E,0X0351,0X0354,0X0356,0X0359,0X035C,0X035F
dw 0X0361,0X0364,0X0367,0X0369,0X036C,0X036F,0X0371,0X0374
dw 0X0377,0X037A,0X037C,0X037F,0X0382,0X0384,0X0387,0X038A
dw 0X038D,0X038F,0X0392,0X0395,0X0397,0X039A,0X039D,0X039F
dw 0X03A2,0X03A5,0X03A8,0X03AA,0X03AD,0X03B0,0X03B2,0X03B5
dw 0X03B8,0X03BB,0X03BD,0X03C0,0X03C3,0X03C5,0X03C8,0X03CB
dw 0X03CD,0X03D0,0X03D3,0X03D6,0X03D8,0X03DB,0X03DE,0X03E0
dw 0X03E3,0X03E6,0X03E8,0X03EB,0X03EE,0X03F1,0X03F3,0X03F6
dw 0X03F9,0X03FB,0X03FE,0X0401,0X0404,0X0406,0X0409,0X040C
dw 0X040E,0X0411,0X0414,0X0416,0X0419,0X041C,0X041F,0X0421
dw 0X0424,0X0427,0X0429,0X042C,0X042F,0X0431,0X0434,0X0437
dw 0X043A,0X043C,0X043F,0X0442,0X0444,0X0447,0X044A,0X044D
dw 0X044F,0X0452,0X0455,0X0457,0X045A,0X045D,0X045F,0X0462
dw 0X0465,0X0468,0X046A,0X046D,0X0470,0X0472,0X0475,0X0478
dw 0X047A,0X047D,0X0480,0X0483,0X0485,0X0488,0X048B,0X048D
dw 0X0490,0X0493,0X0496,0X0498,0X049B,0X049E,0X04A0,0X04A3
dw 0X04A6,0X04A8,0X04AB,0X04AE,0X04B1,0X04B3,0X04B6,0X04B9
dw 0X04BB,0X04BE,0X04C1,0X04C3,0X04C6,0X04C9,0X04CC,0X04CE
dw 0X04D1,0X04D4,0X04D6,0X04D9,0X04DC,0X04DF,0X04E1,0X04E4
dw 0X04E7,0X04E9,0X04EC,0X04EF,0X04F1,0X04F4,0X04F7,0X04FA
dw 0X04FC,0X04FF,0X0502,0X0504,0X0507,0X050A,0X050D,0X050F
dw 0X0512,0X0515,0X0517,0X051A,0X051D,0X051F,0X0522,0X0525
dw 0X0528,0X052A,0X052D,0X0530,0X0532,0X0535,0X0538,0X053A
dw 0X053D,0X0540,0X0543,0X0545,0X0548,0X054B,0X054D,0X0550
dw 0X0553,0X0556,0X0558,0X055B,0X055E,0X0560,0X0563,0X0566
dw 0X0568,0X056B,0X056E,0X0571,0X0573,0X0576,0X0579,0X057B
dw 0X057E,0X0581,0X0583,0X0586,0X0589,0X058C,0X058E,0X0591
dw 0X0594,0X0596,0X0599,0X059C,0X059F,0X05A1,0X05A4,0X05A7
dw 0X05A9,0X05AC,0X05AF,0X05B1,0X05B4,0X05B7,0X05BA,0X05BC
dw 0X05BF,0X05C2,0X05C4,0X05C7,0X05CA,0X05CC,0X05CF,0X05D2
dw 0X05D5,0X05D7,0X05DA,0X05DD,0X05DF,0X05E2,0X05E5,0X05E8
dw 0X05EA,0X05ED,0X05F0,0X05F2,0X05F5,0X05F8,0X05FA,0X05FD
dw 0X0600,0X0603,0X0605,0X0608,0X060B,0X060D,0X0610,0X0613
dw 0X0615,0X0618,0X061B,0X061E,0X0620,0X0623,0X0626,0X0628
dw 0X062B,0X062E,0X0631,0X0633,0X0636,0X0639,0X063B,0X063E
dw 0X0641,0X0643,0X0646,0X0649,0X064C,0X064E,0X0651,0X0654
dw 0X0656,0X0659,0X065C,0X065F,0X0661,0X0664,0X0667,0X0669
dw 0X066C,0X066F,0X0671,0X0674,0X0677,0X067A,0X067C,0X067F
dw 0X0682,0X0684,0X0687,0X068A,0X068C,0X068F,0X0692,0X0695
dw 0X0697,0X069A,0X069D,0X069F,0X06A2,0X06A5,0X06A8,0X06AA
dw 0X06AD,0X06B0,0X06B2,0X06B5,0X06B8,0X06BA,0X06BD,0X06C0
dw 0X06C3,0X06C5,0X06C8,0X06CB,0X06CD,0X06D0,0X06D3,0X06D5
dw 0X06D8,0X06DB,0X06DE,0X06E0,0X06E3,0X06E6,0X06E8,0X06EB
dw 0X06EE,0X06F1,0X06F3,0X06F6,0X06F9,0X06FB,0X06FE,0X0701
dw 0X0703,0X0706,0X0709,0X070C,0X070E,0X0711,0X0714,0X0716
dw 0X0719,0X071C,0X071E,0X0721,0X0724,0X0727,0X0729,0X072C
dw 0X072F,0X0731,0X0734,0X0737,0X073A,0X073C,0X073F,0X0742
dw 0X0744,0X0747,0X074A,0X074C,0X074F,0X0752,0X0755,0X0757
dw 0X075A,0X075D,0X075F,0X0762,0X0765,0X0767,0X076A,0X076D
dw 0X0770,0X0772,0X0775,0X0778,0X077A,0X077D,0X0780,0X0783
dw 0X0785,0X0788,0X078B,0X078D,0X0790,0X0793,0X0795,0X0798
dw 0X079B,0X079E,0X07A0,0X07A3,0X07A6,0X07A8,0X07AB,0X07AE
dw 0X07B1,0X07B3,0X07B6,0X07B9,0X07BB,0X07BE,0X07C1,0X07C3
dw 0X07C6,0X07C9,0X07CC,0X07CE,0X07D1,0X07D4,0X07D6,0X07D9
dw 0X07DC,0X07DE,0X07E1,0X07E4,0X07E7,0X07E9,0X07EC,0X07EF
dw 0X07F1,0X07F4,0X07F7,0X07FA,0X07FC,0X07FF,0X0802,0X0804
dw 0X0807,0X080A,0X080C,0X080F,0X0812,0X0815,0X0817,0X081A
dw 0X081D,0X081F,0X0822,0X0825,0X0827,0X082A,0X082D,0X0830
dw 0X0832,0X0835,0X0838,0X083A,0X083D,0X0840,0X0843,0X0845
dw 0X0848,0X084B,0X084D,0X0850,0X0853,0X0855,0X0858,0X085B
dw 0X085E,0X0860,0X0863,0X0866,0X0868,0X086B,0X086E,0X0870
dw 0X0873,0X0876,0X0879,0X087B,0X087E,0X0881,0X0883,0X0886
dw 0X0889,0X088C,0X088E,0X0891,0X0894,0X0896,0X0899,0X089C
dw 0X089E,0X08A1,0X08A4,0X08A7,0X08A9,0X08AC,0X08AF,0X08B1
dw 0X08B4,0X08B7,0X08B9,0X08BC,0X08BF,0X08C2,0X08C4,0X08C7
dw 0X08CA,0X08CC,0X08CF,0X08D2,0X08D5,0X08D7,0X08DA,0X08DD
dw 0X08DF,0X08E2,0X08E5,0X08E7,0X08EA,0X08ED,0X08F0,0X08F2
dw 0X08F5,0X08F8,0X08FA,0X08FD,0X0900,0X0903,0X0905,0X0908
dw 0X090B,0X090D,0X0910,0X0913,0X0915,0X0918,0X091B,0X091E
dw 0X0920,0X0923,0X0926,0X0928,0X092B,0X092E,0X0930,0X0933
dw 0X0936,0X0939,0X093B,0X093E,0X0941,0X0943,0X0946,0X0949
dw 0X094C,0X094E,0X0951,0X0954,0X0956,0X0959,0X095C,0X095E
dw 0X0961,0X0964,0X0967,0X0969,0X096C,0X096F,0X0971,0X0974
dw 0X0977,0X0979,0X097C,0X097F,0X0982,0X0984,0X0987,0X098A
dw 0X098C,0X098F,0X0992,0X0995,0X0997,0X099A,0X099D,0X099F
dw 0X09A2,0X09A5,0X09A7,0X09AA,0X09AD,0X09B0,0X09B2,0X09B5
dw 0X09B8,0X09BA,0X09BD,0X09C0,0X09C2,0X09C5,0X09C8,0X09CB
dw 0X09CD,0X09D0,0X09D3,0X09D5,0X09D8,0X09DB,0X09DE,0X09E0
dw 0X09E3,0X09E6,0X09E8,0X09EB,0X09EE,0X09F0,0X09F3,0X09F6
dw 0X09F9,0X09FB,0X09FE,0X0A01,0X0A03,0X0A06,0X0A09,0X0A0B
dw 0X0A0E,0X0A11,0X0A14,0X0A16,0X0A19,0X0A1C,0X0A1E,0X0A21
dw 0X0A24,0X0A27,0X0A29,0X0A2C,0X0A2F,0X0A31,0X0A34,0X0A37
dw 0X0A39,0X0A3C,0X0A3F,0X0A42,0X0A44,0X0A47,0X0A4A,0X0A4C
dw 0X0A4F,0X0A52,0X0A55,0X0A57,0X0A5A,0X0A5D,0X0A5F,0X0A62
dw 0X0A65,0X0A67,0X0A6A,0X0A6D,0X0A70,0X0A72,0X0A75,0X0A78
dw 0X0A7A,0X0A7D,0X0A80,0X0A82,0X0A85,0X0A88,0X0A8B,0X0A8D
dw 0X0A90,0X0A93,0X0A95,0X0A98,0X0A9B,0X0A9E,0X0AA0,0X0AA3
dw 0X0AA6,0X0AA8,0X0AAB,0X0AAE,0X0AB0,0X0AB3,0X0AB6,0X0AB9
dw 0X0ABB,0X0ABE,0X0AC1,0X0AC3,0X0AC6,0X0AC9,0X0ACB,0X0ACE
DEPHASE