diff -Nru kodi-audiodecoder-asap-2.0.2/appveyor.yml kodi-audiodecoder-asap-3.0.1/appveyor.yml --- kodi-audiodecoder-asap-2.0.2/appveyor.yml 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/appveyor.yml 2013-05-31 22:59:22.000000000 +0000 @@ -16,14 +16,14 @@ CONFIG: Release - GENERATOR: "Visual Studio 15 Win64" CONFIG: Release - WINSTORE: -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0.16299.0" + WINSTORE: -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0.17763.0" - GENERATOR: "Visual Studio 15 ARM" CONFIG: Release - WINSTORE: -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0.16299.0" + WINSTORE: -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0.17763.0" build_script: - cd .. - - git clone --branch Leia --depth=1 https://github.com/xbmc/xbmc.git + - git clone --branch master --depth=1 https://github.com/xbmc/xbmc.git - cd %app_id% - mkdir build - cd build diff -Nru kodi-audiodecoder-asap-2.0.2/audiodecoder.asap/addon.xml.in kodi-audiodecoder-asap-3.0.1/audiodecoder.asap/addon.xml.in --- kodi-audiodecoder-asap-2.0.2/audiodecoder.asap/addon.xml.in 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/audiodecoder.asap/addon.xml.in 2013-05-31 22:59:22.000000000 +0000 @@ -1,7 +1,7 @@ @ADDON_DEPENDS@ @@ -13,10 +13,12 @@ extension=".sap|.asapstream|.cmc|.cmr|.dmc|.mpt|.mpd|.rmt|.tmc|.tm8|.tm2|.cms|.cm3|.dlt" library_@PLATFORM@="@LIBRARY_FILENAME@"/> - ASAP - Another Slight Atari Player - ASAP (Another Slight Atari Player) plays on Kodi and converts 8-bit Atari music (*.sap, *.cmc, *.mpt, *.rmt, *.tmc, ...) on modern computers and mobile devices. + ASAP - Another Slight Atari Player + ASAP - Another Slight Atari Player + ASAP (Another Slight Atari Player) konvertiert 8-Bit-Atari-Musik (*.sap, *.cmc, *.mpt, *.rmt, *.tmc, ...) zum nötigen Format und zur Wiedergabe in Kodi auf modernen Computern und Mobilgeräten. + ASAP (Another Slight Atari Player) plays on Kodi and converts 8-bit Atari music (*.sap, *.cmc, *.mpt, *.rmt, *.tmc, ...) on modern computers and mobile devices. @PLATFORM@ - GPL-2.0 + GPL-2.0-or-later https://github.com/xbmc/audiodecoder.asap icon.png diff -Nru kodi-audiodecoder-asap-2.0.2/azure-pipelines.yml kodi-audiodecoder-asap-3.0.1/azure-pipelines.yml --- kodi-audiodecoder-asap-2.0.2/azure-pipelines.yml 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/azure-pipelines.yml 2013-05-31 22:59:22.000000000 +0000 @@ -4,7 +4,7 @@ trigger: branches: include: - - Leia + - Matrix - releases/* paths: include: @@ -46,7 +46,7 @@ - script: | cd .. - git clone --branch Leia --depth=1 https://github.com/xbmc/xbmc.git kodi + git clone --branch master --depth=1 https://github.com/xbmc/xbmc.git kodi cd $(Build.SourcesDirectory) mkdir build cd build diff -Nru kodi-audiodecoder-asap-2.0.2/.clang-format kodi-audiodecoder-asap-3.0.1/.clang-format --- kodi-audiodecoder-asap-2.0.2/.clang-format 1970-01-01 00:00:00.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/.clang-format 2013-05-31 22:59:22.000000000 +0000 @@ -0,0 +1,88 @@ +--- +# BasedOnStyle: LLVM +AccessModifierOffset: -2 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlines: DontAlign +AlignOperands: true +AlignTrailingComments: false +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: InlineOnly +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: true +BinPackArguments: true +BinPackParameters: false +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Allman +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +BreakConstructorInitializers: BeforeColon +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: true +ColumnLimit: 100 +CommentPragmas: '^ IWYU pragma:' +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ConstructorInitializerIndentWidth: 2 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: false +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] +IncludeBlocks: Regroup +IncludeCategories: + - Regex: '^<[a-z0-9_]+>$' + Priority: 3 + - Regex: '^<(assert|complex|ctype|errno|fenv|float|inttypes|iso646|limits|locale|math|setjmp|signal|stdalign|stdarg|stdatomic|stdbool|stddef|stdint|stdio|stdlib|stdnoreturn|string|tgmath|threads|time|uchar|wchar|wctype)\.h>$' + Priority: 3 + - Regex: '^<' + Priority: 3 + - Regex: '^["<](kodi|p8-platform)\/.*\.h[">]$' + Priority: 2 + - Regex: '.*' + Priority: 1 +IncludeIsMainRegex: '$' +IndentCaseLabels: true +IndentWidth: 2 +IndentWrappedFunctionNames: false +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: true +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 2 +NamespaceIndentation: None +ObjCBlockIndentWidth: 2 +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 60000 +PointerAlignment: Left +ReflowComments: false +SortIncludes: true +SpaceAfterCStyleCast: false +SpaceAfterTemplateKeyword: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: ControlStatements +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: Cpp11 +TabWidth: 8 +UseTab: Never +... diff -Nru kodi-audiodecoder-asap-2.0.2/CMakeLists.txt kodi-audiodecoder-asap-3.0.1/CMakeLists.txt --- kodi-audiodecoder-asap-2.0.2/CMakeLists.txt 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/CMakeLists.txt 2013-05-31 22:59:22.000000000 +0000 @@ -5,11 +5,17 @@ find_package(Kodi REQUIRED) +if(WIN32) + add_definitions("/wd4996") +endif() + include_directories(${KODI_INCLUDE_DIR}/.. - ${PROJECT_SOURCE_DIR}/lib/asap-3.1.5) + ${PROJECT_SOURCE_DIR}/lib/asap-code) set(ASAP_SOURCES src/ASAPCodec.cpp - lib/asap-3.1.5/asap.c) + lib/asap-code/asap.c) + +set(ASAP_HEADERS src/ASAPCodec.h) build_addon(audiodecoder.asap ASAP DEPLIBS) diff -Nru kodi-audiodecoder-asap-2.0.2/debian/changelog kodi-audiodecoder-asap-3.0.1/debian/changelog --- kodi-audiodecoder-asap-2.0.2/debian/changelog 2013-05-31 22:59:22.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/debian/changelog 2013-05-31 22:59:22.000000000 +0000 @@ -1,4 +1,4 @@ -kodi-audiodecoder-asap (2.0.2-1~bionic) bionic; urgency=low +kodi-audiodecoder-asap (3.0.1-1~bionic) bionic; urgency=low [ kodi ] * autogenerated dummy changelog diff -Nru kodi-audiodecoder-asap-2.0.2/debian/control kodi-audiodecoder-asap-3.0.1/debian/control --- kodi-audiodecoder-asap-2.0.2/debian/control 2013-05-31 22:59:22.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/debian/control 2013-05-31 22:59:22.000000000 +0000 @@ -4,7 +4,7 @@ Build-Depends: debhelper (>= 9.0.0), cmake, kodi-addon-dev Standards-Version: 4.1.2 Section: libs -Homepage: http://kodi.tv +Homepage: https://kodi.tv Package: kodi-audiodecoder-asap Section: libs diff -Nru kodi-audiodecoder-asap-2.0.2/debian/rules kodi-audiodecoder-asap-3.0.1/debian/rules --- kodi-audiodecoder-asap-2.0.2/debian/rules 2013-05-31 22:59:22.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/debian/rules 2013-05-31 22:59:22.000000000 +0000 @@ -10,13 +10,11 @@ #export DH_VERBOSE=1 %: - dh $@ + dh $@ override_dh_auto_configure: - dh_auto_configure -- -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=1 -DUSE_LTO=1 - -override_dh_strip: - dh_strip --dbg-package=kodi-audiodecoder-asap-dbg + dh_auto_configure -- -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=1 -DUSE_LTO=1 override_dh_installdocs: dh_installdocs --link-doc=kodi-audiodecoder-asap + diff -Nru kodi-audiodecoder-asap-2.0.2/debian/source/format kodi-audiodecoder-asap-3.0.1/debian/source/format --- kodi-audiodecoder-asap-2.0.2/debian/source/format 2013-05-31 22:59:22.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/debian/source/format 2013-05-31 22:59:22.000000000 +0000 @@ -1 +1 @@ -3.0 (quilt) +3.0 (native) diff -Nru kodi-audiodecoder-asap-2.0.2/.gitignore kodi-audiodecoder-asap-3.0.1/.gitignore --- kodi-audiodecoder-asap-2.0.2/.gitignore 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/.gitignore 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -# build artifacts -build/ -audiodecoder.*/addon.xml - -# Debian build files -debian/changelog -debian/files -debian/*.log -debian/*.substvars -debian/.debhelper/ -debian/tmp/ -debian/kodi-audiodecoder-*/ -obj-x86_64-linux-gnu/ - -# commonly used editors -# vim -*.swp - -# Eclipse -*.project -*.cproject -.classpath -*.sublime-* -.settings/ - -# KDevelop 4 -*.kdev4 - -# Visual Studio -.vs/ - -# gedit -*~ - -# CLion -/.idea - -# clion -.idea/ diff -Nru kodi-audiodecoder-asap-2.0.2/Jenkinsfile kodi-audiodecoder-asap-3.0.1/Jenkinsfile --- kodi-audiodecoder-asap-2.0.2/Jenkinsfile 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/Jenkinsfile 2013-05-31 22:59:22.000000000 +0000 @@ -1 +1 @@ -buildPlugin(version: "Leia") +buildPlugin(version: "Matrix") diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/6502.mk kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/6502.mk --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/6502.mk 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/6502.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ -MADS = $(DO)mads -s -o:$@ $< - -# no user-configurable paths below this line - -ifndef DO -$(error Use "Makefile" instead of "6502.mk") -endif - -ASM6502_PLAYERS = cmc cm3 cmr cms dlt mpt rmt4 rmt8 tmc tm2 fc -ASM6502_PLAYERS_OBX = $(ASM6502_PLAYERS:%=6502/%.obx) -ASM6502_OBX = $(ASM6502_PLAYERS_OBX) 6502/xexb.obx 6502/xexd.obx 6502/xexinfo.obx - -6502/cmc.obx: $(srcdir)6502/cmc.asx - $(XASM) -d CM3=0 -d CMR=0 - -6502/cm3.obx: $(srcdir)6502/cmc.asx - $(XASM) -d CM3=1 -d CMR=0 - -6502/cmr.obx: $(srcdir)6502/cmc.asx - $(XASM) -d CM3=0 -d CMR=1 - -6502/dlt.obx: $(srcdir)6502/dlt.as8 - $(MADS) -c - -6502/rmt4.obx: $(srcdir)6502/rmt.asx - $(XASM) -d STEREOMODE=0 - -6502/rmt8.obx: $(srcdir)6502/rmt.asx - $(XASM) -d STEREOMODE=1 - -6502/fc.obx: $(srcdir)6502/fc.as8 - $(MADS) - -6502/xexinfo.obx: $(srcdir)6502/xexinfo.asx - $(XASM) -d TEST=0 -l - -6502/xexinfo.xex: $(srcdir)6502/xexinfo.asx - $(XASM) -d TEST=1 - -6502/%.obx: $(srcdir)6502/%.asx - $(XASM) -l - -CLEAN += $(ASM6502_OBX) 6502/fp3depk.obx 6502/xexinfo.xex 6502/*.lst Binary files /tmp/tmpyaM5l1/AUpGL9bywb/kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/cm3.obx and /tmp/tmpyaM5l1/KBGCC02aAO/kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/cm3.obx differ diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/cmc.asx kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/cmc.asx --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/cmc.asx 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/cmc.asx 1970-01-01 00:00:00.000000000 +0000 @@ -1,965 +0,0 @@ -*---------------------------* -* cmc player v 2.1 * -* by Marcin Lewandowski * -* based on cmc player v 2.0 * -* by Janusz Pelc * -*---------------------------* - - org $0500 - -*--- strona 0 - -addr equ $fc -word equ $fe - -*--- skoki - - jmp basic - jmp init - jmp play - -*--- dane - -volume dta d' ' -czest dta d' ' -numins dta d' ' - - dta c' cmc player v 2.1 '* - -frq dta d' ' -znieks dta d' ' -audc dta b(0) - -czest1 dta d' ' -czest2 dta d' ' -czest3 dta d' ' -zniek dta d' ' -count1 dta b($ff),b($ff),b($ff) -count2 dta d' ' -lopad dta d' ' -numptr dta d' ' -poswpt dta d' ' -ilewol dta d' ' -czygrx dta b($80),b($80),b($80) -czygrc dta b($80) - -dana0 dta d' ' -dana1 dta d' ' -dana2 dta d' ' -dana3 dta d' ' -dana4 dta d' ' -dana5 dta d' ' -ladr dta d' ' -hadr dta d' ' - -posptr dta b(0) -possng dta b(0) -pocrep dta b(0) -konrep dta b(0) -ilrep dta b(0) -tmpo dta b(0) -ltemp dta b(0) -b1 dta b(0) -b2 dta b(0) -b3 dta b(0) -czygr dta b(0) - -adrmus dta a(0) -adradr dta a(0) -adrsng dta a(0) - -*--- init - -init sta b1 - stx b2 - sty b3 - and #$70 - lsr @ - lsr @ - lsr @ - tax - lda tab1,x - sta zm1+1 - lda tab1+1,x - sta zm1+2 - lda #3 - sta $d20f - cld - lda word - pha - lda word+1 - pha - ldy b3 - ldx b2 - lda b1 -zm1 jsr graj - pla - sta word+1 - pla - sta word - rts - -graj lda adrsng - sta word - lda adrsng+1 - sta word+1 - ldy #0 - txa - beq grajx -l1 lda (word),y - cmp #$8f - beq l2 - cmp #$ef - bne l3 -l2 dex - bne l3 - iny - cpy #$54 - bcs l4 - tya - tax - bpl grajx -l3 iny - cpy #$54 - bcc l1 -l4 rts - -grajx stx possng - jsr skoncz - lda #0 - ldx #9 -l5 sta poswpt,x - dex - bpl l5 - sta posptr - lda #1 - sta czygr - lda #$ff - sta konrep - lda adrmus - sta word - lda adrmus+1 - sta word+1 - ldy #$13 - lda (word),y - tax - lda adrsng - sta word - lda adrsng+1 - sta word+1 - ldy possng -l6 lda (word),y - cmp #$cf - bne l7 - tya - clc - adc #$55 - tay - lda (word),y - bmi l8 - tax - jmp l8 -l7 cmp #$8f - beq l8 - cmp #$ef - beq l8 - dey - bpl l6 -l8 stx tmpo - stx ltemp - rts - -tempo and #$f - beq l8 - stx d0+1 - stx d1+1 - stx d2+1 - sty d0+2 - sty d1+2 - sty d2+2 - rts - -inic stx adrmus - stx word - sty adrmus+1 - sty word+1 - clc - txa - adc #$14 - sta adradr - tya - adc #0 - sta adradr+1 - stx adrsng - iny - iny - sty adrsng+1 - ldy #$13 - lda (word),y - sta tmpo - sta ltemp - -skoncz ldx #8 -l9 lda #0 - sta czygr - sta $d200,x - cpx #3 - bcs l10 - sta volume,x - lda #$ff - sta count1,x -l10 dex - bpl l9 - -przer lda #$80 -l11 ldx #3 -l12 sta czygrx,x - dex - bpl l12 -l13 rts - -kont lda #1 - sta czygr - lda #0 - beq l11 - -instr and #3 - cmp #3 - beq l13 - cpx #$40 - bcs l13 - cpy #26 - bcs l13 - tax - lda #$80 - sta czygrx,x - -inst lda #0 - sta count1,x - sta count2,x - sta lopad,x - lda b2 - sta czest,x - - lda b3 - asl @ - asl @ - asl @ - sta word - clc - lda adrmus - adc #$30 - pha - lda adrmus+1 - adc #1 - tay - pla - clc - adc word - sta ladr,x - tya - adc #0 - sta hadr,x - - clc - lda adrmus - adc #$94 - sta word - lda adrmus+1 - adc #0 - sta word+1 - lda b3 - asl @ - adc b3 - asl @ - tay - lda (word),y - sta dana0,x - iny - lda (word),y - sta dana1,x - and #7 - sta b1 - iny - lda (word),y - sta dana2,x - iny - lda (word),y - sta dana3,x - iny - lda (word),y - sta dana4,x - iny - lda (word),y - sta dana5,x - - ldy #0 - lda b1 - cmp #3 - bne l14 - ldy #2 -l14 cmp #7 - bne l15 - ldy #4 -l15 lda tab3,y - sta word - lda tab3+1,y - sta word+1 - lda dana2,x - lsr @ - lsr @ - lsr @ - lsr @ - clc - adc b2 - sta b2 - sta zm2+1 - tay - lda b1 - cmp #7 - bne l16 - tya - asl @ - tay - lda (word),y - sta czest1,x - iny - sty b2 - jmp l17 -l16 lda (word),y - sta czest1,x - lda dana2,x - and #$f - clc - adc b2 - sta b2 -l17 ldy b2 - lda b1 - cmp #5 - php - lda (word),y - plp - beq l18 - cmp czest1,x - bne l18 - sec - sbc #1 -l18 sta czest2,x - lda dana0,x - pha - and #3 - tay - lda tab4,y - sta zniek,x - pla - lsr @ - lsr @ - lsr @ - lsr @ - ldy #$3e - cmp #$f - beq l19 - ldy #$37 - cmp #$e - beq l19 - ldy #$30 - cmp #$d - beq l19 - clc -zm2 adc #0 - tay -l19 lda tab5,y - sta czest3,x - rts - -*--- play - -play cld - lda addr - pha - lda addr+1 - pha - lda word - pha - lda word+1 - pha - lda czygr - bne g1 - jmp end -g1 lda czygrc - beq g2 - jmp dal3 -g2 lda tmpo - cmp ltemp - beq g3 - jmp dal2 -g3 lda posptr - beq g4 - jmp dal1 -g4 ldx #2 -g5 ldy czygrx,x - bmi g6 - sta czygrx,x -g6 sta poswpt,x - dex - bpl g5 - - lda adrsng - sta addr - lda adrsng+1 - sta addr+1 - ldy possng - sty word -g7 cpy konrep - bne g8 - lda ilrep - beq g8 - lda possng - ldy pocrep - sty possng - dec ilrep - bne g7 - sta possng - tay - bpl g7 -g8 ldx #0 -g9 lda (addr),y - cmp #$fe - bne g10 - ldy possng - iny - cpy word - beq g11 - sty possng - jmp g7 -g10 sta numptr,x - clc - tya - adc #$55 - tay - inx - cpx #3 - bcc g9 - ldy possng - lda (addr),y - bpl dal1 - cmp #$ff - beq dal1 - lsr @ - lsr @ - lsr @ - and #$e - tax - lda tab2,x - sta zm3+1 - lda tab2+1,x - sta zm3+2 - lda numptr+1 - sta word+1 -zm3 jsr stop - sty possng - cpy #$55 - bcs g11 - cpy word - bne g7 -g11 ldy word - sty possng - jmp end - -stop jsr przer -g12 ldy #$ff - rts -jump bmi g12 - tay - rts -up bmi g12 - sec - tya - sbc word+1 - tay - rts -down bmi g12 - clc - tya - adc word+1 - tay - rts -temp bmi g12 - sta tmpo - sta ltemp - iny - rts -rep bmi g12 - lda numptr+2 - bmi g12 - sta ilrep - iny - sty pocrep - clc - tya - adc word+1 - sta konrep - rts -break dey - bmi g13 - lda (addr),y - cmp #$8f - beq g13 - cmp #$ef - bne break -g13 iny - rts - -dal1 ldx #2 -v1 lda ilewol,x - beq v2 - dec ilewol,x - bpl v7 -v2 lda czygrx,x - bne v7 - ldy numptr,x - cpy #$40 - bcs v7 - lda adradr - sta addr - lda adradr+1 - sta addr+1 - lda (addr),y - sta word - clc - tya - adc #$40 - tay - lda (addr),y - sta word+1 - and word - cmp #$ff - beq v7 -v3 ldy poswpt,x - lda (word),y - and #$c0 - bne v4 - lda (word),y - and #$3f - sta numins,x - inc poswpt,x - bpl v3 -v4 cmp #$40 - bne v5 - lda (word),y - and #$3f - sta b2 - lda numins,x - sta b3 - jsr inst - jmp v6 -v5 cmp #$80 - bne v7 - lda (word),y - and #$3f - sta ilewol,x -v6 inc poswpt,x -v7 dex - bpl v1 - - ldx posptr - inx - ift CM3 - cpx #$30 - scc:ldx #0 - stx posptr - els - txa - and #$3f - sta posptr - eif - -dal2 dec ltemp - bne dal3 - lda tmpo - sta ltemp - lda posptr - bne dal3 - inc possng - -dal3 ldy czest2 - lda dana1 - and #7 - cmp #5 - beq a1 - cmp #6 - bne a2 -a1 dey -a2 sty frq+3 - ldy #0 - cmp #5 - beq a3 - cmp #6 - bne a4 -a3 ldy #2 -a4 cmp #7 - bne a5 - ldy #$28 -a5 sty audc - - ldx #2 -loop lda dana1,x - and #$e0 - sta znieks,x - lda ladr,x - sta addr - lda hadr,x - sta addr+1 - lda count1,x - cmp #$ff - beq y4 - cmp #$f - bne y2 - lda lopad,x - beq y4 - dec lopad,x - lda lopad,x - bne y4 - ldy volume,x - beq y1 - dey -y1 tya - sta volume,x - lda dana3,x - sta lopad,x - jmp y4 -y2 lda count1,x - lsr @ - tay - lda (addr),y - bcc y3 - lsr @ - lsr @ - lsr @ - lsr @ -y3 and #$f - sta volume,x -y4 ldy czest1,x - lda dana1,x - and #7 - cmp #1 - bne y6 - dey - tya - iny - cmp czest2,x - php - lda #1 - plp - bne y5 - asl @ - asl @ -y5 and count2,x - beq y6 - ldy czest2,x - cpy #$ff - bne y6 - lda #0 - sta volume,x -y6 tya - sta frq,x - lda #1 - sta b1 - lda count1,x - cmp #$f - beq y9 - and #7 - tay - lda tab9,y - sta word - lda count1,x - and #8 - php - txa - plp - clc - beq y7 - adc #3 -y7 tay - lda dana4,y - and word - beq y9 - lda czest3,x - sta frq,x - stx b1 - dex - bpl y8 - sta frq+3 - lda #0 - sta audc -y8 inx - lda zniek,x - sta znieks,x -y9 lda count1,x - and #$f - cmp #$f - beq y10 - inc count1,x - lda count1,x - cmp #$f - bne y10 - lda dana3,x - sta lopad,x -y10 lda czygrx,x - bpl y11 - lda volume,x - bne y11 - lda #$40 - sta czygrx,x -y11 inc count2,x - ldy #0 - lda dana1,x - lsr @ - lsr @ - lsr @ - lsr @ - bcc y12 - dey -y12 lsr @ - bcc y13 - iny -y13 clc - tya - adc czest1,x - sta czest1,x - lda czest2,x - cmp #$ff - bne y14 - ldy #0 -y14 clc - tya - adc czest2,x - sta czest2,x - dex - bmi x1 - jmp loop - -x1 lda znieks - sta znieks+3 - lda dana1 - and #7 - tax - ldy #3 - lda b1 - beq x2 - ldy tab10,x -x2 tya - pha - lda tab8,y - php - and #$7f - tax - tya - and #3 - asl @ - tay - lda frq,x -d0 sta $d200,y - iny - lda volume,x - cpx #3 - bne x3 - lda volume -x3 ora znieks,x - plp - bpl d1 - lda #0 -d1 sta $d200,y - pla - tay - dey - and #3 - bne x2 - ldy #8 - lda audc -d2 sta $d200,y - - clc -end pla - sta word+1 - pla - sta word - pla - sta addr+1 - pla - sta addr - rts - -*--- basic - -basic pla - tax - beq p6 - cmp #2 - beq p2 -p1 pla - pla - dex - bne p1 - rts -p2 lda $14 - cmp $14 - beq *-2 - lda $224 - cmp p8 - beq p1 -p3 lda $224 - sta p9+1 - lda $225 - sta p9+2 - lda p8 - sta $225 - pla - pla - beq p4 - sec - sbc #1 -p4 sta p5+1 - pla - tay - pla - tax - lda #$70 - jsr init - lda #0 -p5 ldx #0 - jmp init -p6 lda $14 - cmp $14 - beq *-2 - lda $224 - cmp p8 - bne p2-1 -p7 lda p9+1 - sta $224 - lda p9+2 - sta $225 - lda #$40 - jmp init -p8 jsr play - bcc p9 - jsr p7 -p9 jmp $ffff - -*--- tablice - -tab1 dta a(graj) - dta a(grajx) - dta a(instr) - dta a(tempo) - dta a(skoncz) - dta a(przer) - dta a(kont) - dta a(inic) - -tab2 dta a(stop) - dta a(jump) - dta a(up) - dta a(down) - dta a(temp) - dta a(rep) - dta a(break) - -tab3 dta a(tab5) - dta a(tab6) - dta a(tab7) - -tab4 dta b($80),b($a0) - dta b($20),b($40) - -tab5 dta b($ff),b($f1),b($e4),b($d7) - dta b($cb),b($c0),b($b5),b($aa) - dta b($a1),b($98),b($8f),b($87) - dta b($7f),b($78),b($72),b($6b) - dta b($65),b($5f),b($5a),b($55) - dta b($50),b($4b),b($47),b($43) - dta b($3f),b($3c),b($38),b($35) - dta b($32),b($2f),b($2c),b($2a) - dta b($27),b($25),b($23),b($21) - dta b($1f),b($1d),b($1c),b($1a) - dta b($18),b($17),b($16),b($14) - dta b($13),b($12),b($11),b($10) - dta b($0f),b($0e),b($0d),b($0c) - dta b($0b),b($0a),b($09),b($08) - dta b($07),b($06),b($05),b($04) - dta b($03),b($02),b($01),b($00) - dta b($00) - -tab6 dta b($00),b($00),b($00),b($00) - dta b($f2),b($e9),b($da),b($ce) - dta b($bf),b($b6),b($aa),b($a1) - dta b($98),b($8f),b($89),b($80) - dta b($7a),b($71),b($6b),b($65) - dta b($5f) - ift CMR - dta b($5c),b($56),b($50) - dta b($4d),b($47),b($44),b($41) - dta b($3e),b($38),b($35),b($88) - dta b($7f),b($79),b($73),b($6c) - dta b($67),b($60),b($5a),b($55) - dta b($51),b($4c),b($48),b($43) - dta b($3f),b($3d),b($39),b($34) - dta b($33),b($30),b($2d),b($2a) - dta b($28),b($25),b($24),b($21) - dta b($1f),b($1e) - els - dta b($00),b($56),b($50) - dta b($67),b($60),b($5a),b($55) - dta b($51),b($4c),b($48),b($43) - dta b($3f),b($3d),b($39),b($34) - dta b($33),b($39),b($2d),b($2a) - dta b($28),b($25),b($24),b($21) - dta b($1f),b($1e),b($00),b($00) - dta b($0f),b($0e),b($0d),b($0c) - dta b($0b),b($0a),b($09),b($08) - dta b($07),b($06) - eif - dta b($05),b($04) - dta b($03),b($02),b($01),b($00) - dta b($00) - -tab7 dta a($b38),a($a8c),a($a00),a($96a) - dta a($8e8),a($86a),a($7ef),a($780) - dta a($708),a($6ae),a($646),a($5e6) - dta a($595),a($541),a($4f6),a($4b0) - dta a($46e),a($430),a($3f6),a($3bb) - dta a($384),a($352),a($322),a($2f4) - dta a($2c8),a($2a0),a($27a),a($255) - dta a($234),a($214),a($1f5),a($1d8) - dta a($1bd),a($1a4),a($18d),a($177) - dta a($160),a($14e),a($138),a($127) - dta a($115),a($106),a($0f7),a($0e8) - dta a($0db),a($0cf),a($0c3),a($0b8) - dta a($0ac),a($0a2),a($09a),a($090) - dta a($088),a($07f),a($078),a($070) - dta a($06a),a($064),a($05e),a($057) - dta a($052),a($032),a($00a) - -tab8 dta b($00),b($01),b($02),b($83) - dta b($00),b($01),b($02),b($03) - dta b($01),b($00),b($02),b($83) - dta b($01),b($00),b($02),b($03) - dta b($01),b($02),b($80),b($03) - -tab9 dta b($80),b($40),b($20),b($10) - dta b($08),b($04),b($02),b($01) - -tab10 dta b(3),b(3),b(3),b(3) - dta b(7),b($b),b($f),b($13) - -*--- koniec - - end Binary files /tmp/tmpyaM5l1/AUpGL9bywb/kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/cmc.obx and /tmp/tmpyaM5l1/KBGCC02aAO/kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/cmc.obx differ Binary files /tmp/tmpyaM5l1/AUpGL9bywb/kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/cmr.obx and /tmp/tmpyaM5l1/KBGCC02aAO/kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/cmr.obx differ diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/cms.asx kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/cms.asx --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/cms.asx 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/cms.asx 1970-01-01 00:00:00.000000000 +0000 @@ -1,1065 +0,0 @@ -ZP_C8 equ $C8 -ZP_FC equ $FC -ZP_FD equ $FD -ZP_FE equ $FE -ZP_FF equ $FF -L_0224 equ $0224 -L_0225 equ $0225 - - org $0500 - -L_0500 :3 nop -L_0503 jmp L_0815 -L_0506 jmp L_0F5C -L_0509 dta $23,$05,$A9,$05,$AD,$05,$B8,$05 -L_0511 dta $00,$00,$00,$00,$00,$00 -L_0517 dta $00,$00,$00,$00,$00,$00 -L_051D dta $80,$80,$80,$80,$80,$80 -L_0523 dta $00,$00,$00 -L_0526 dta $00,$00,$00 -L_0529 dta $FF,$FF,$FF,$FF,$FF,$FF -L_052F dta $00,$00,$00,$00,$00,$00 -L_0535 dta $00 -L_0536 dta $00 -L_0537 dta $00 -L_0538 dta $00,$00,$00 -L_053B dta $00,$00,$00 -L_053E dta $00,$00,$00 -L_0541 dta $00,$00,$00 -L_0544 dta $00,$00,$00 -L_0547 dta $00,$00,$00,$00,$00,$00 -L_054D dta $00,$00,$00,$00,$00,$00 -L_0553 dta $00,$00,$00,$00,$00,$00 -L_0559 dta $00,$00,$00 -L_055C dta $00,$00,$00 -L_055F dta $00,$00,$00 -L_0562 dta $00,$00,$00 -L_0565 dta $00,$00,$00,$00,$00,$00 -L_056B dta $00,$00,$00,$00,$00,$00 -L_0571 dta $00,$00,$00,$00,$00,$00 -L_0577 dta $00,$00,$00,$00,$00,$00 -L_057D dta $00,$00,$00,$00,$00,$00 -L_0583 dta $00,$00,$00,$00,$00,$00 -L_0589 dta $00,$00,$00 -L_058C dta $00,$00,$00 -L_058F dta $00 -L_0590 dta $00 -L_0591 dta $00 -L_0592 dta $00 -L_0593 dta $00 -L_0594 dta $82 -L_0595 dta $00 -L_0596 dta $00 -L_0597 dta $06 -L_0598 dta $06 -L_0599 dta $00 -L_059A dta $80 -L_059B dta $14 -L_059C dta $80 -L_059D dta $80 -L_059E dta $00 -L_059F dta $00 -L_05A0 dta $00 -L_05A1 dta $00 -L_05A2 dta $00 -L_05A3 dta $00 -L_05A4 dta $00 -L_05A5 dta $00 -L_97A5 equ L_05A5 ; relocation bugfix by 0xF -L_05A6 dta $00 -L_05A7 dta $00 -L_97A7 equ L_05A7 ; relocation bugfix by 0xF -L_05A8 dta $00 -L_05A9 dta $0F -L_05AA dta $0F -L_05AB dta $00 -L_05AC dta $00 -L_05AD dta $00,$00,$00 -L_05B0 dta $00,$00,$00 -L_05B3 dta $FF -L_05B4 dta $00,$00,$00 -L_05B7 dta $00 -L_05B8 dta $00 -L_05B9 dta $00,$01,$02,$83,$00,$01,$02,$03,$01,$00,$02,$83,$01,$00,$02,$03 - dta $01,$02,$80,$03 -L_05CD dta $80,$40,$20,$10,$08,$04,$02,$01 -L_05D5 dta a(L_084B,L_0876,L_0985,L_0913,L_0950,L_096E,L_097C,L_091A) -L_05E5 dta $80,$A0,$20,$40 -L_05E9 dta $FF,$F1,$E4,$D7,$CB,$C0,$B5,$AA,$A1,$98,$8F,$87,$7F,$78,$72,$6B - dta $65,$5F,$5A,$55,$50,$4B,$47,$43,$3F,$3C,$38,$35,$32,$2F,$2C,$2A - dta $27,$25,$23,$21,$1F,$1D,$1C,$1A,$18,$17,$16,$14,$13,$12,$11,$10 - dta $0F,$0E,$0D,$0C,$0B,$0A,$09,$08,$07,$06,$05,$04,$03,$02,$01,$00 - dta $00 -L_062A dta $00,$00,$00,$00,$F2,$E9,$DA,$CE,$BF,$B6,$AA,$A1,$98,$8F,$89 - dta $80,$7A,$71,$6B,$65,$5F,$00,$56,$50,$67,$60,$5A,$55,$51,$4C,$48 - dta $43,$3F,$3D,$39,$34,$33,$39,$2D,$2A,$28,$25,$24,$21,$1F,$1E,$00 - dta $00,$0F,$0E,$0D,$0C,$0B,$0A,$09,$08,$07,$06,$05,$04,$03,$02,$01 - dta $00,$00 -L_066B dta $38,$0B,$8C,$0A,$00,$0A,$6A,$09,$E8,$08,$6A,$08,$EF,$07 - dta $80,$07,$08,$07,$AE,$06,$46,$06,$E6,$05,$95,$05,$41,$05,$F6,$04 - dta $B0,$04,$6E,$04,$30,$04,$F6,$03,$BB,$03,$84,$03,$52,$03,$22,$03 - dta $F4,$02,$C8,$02,$A0,$02,$7A,$02,$55,$02,$34,$02,$14,$02,$F5,$01 - dta $D8,$01,$BD,$01,$A4,$01,$8D,$01,$77,$01,$60,$01,$4E,$01,$38,$01 - dta $27,$01,$15,$01,$06,$01,$F7,$00,$E8,$00,$DB,$00,$CF,$00,$C3,$00 - dta $B8,$00,$AC,$00,$A2,$00,$9A,$00,$90,$00,$88,$00,$7F,$00,$78,$00 - dta $70,$00,$6A,$00,$64,$00,$5E,$00,$57,$00,$52,$00,$32,$00,$0A,$00 -L_06E9 dta $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 - dta $00,$00,$00,$00,$00,$00,$00,$00,$01,$01,$01,$01,$01,$01,$01,$01 - dta $00,$00,$00,$00,$01,$01,$01,$01,$01,$01,$01,$01,$02,$02,$02,$02 - dta $00,$00,$00,$00,$01,$01,$01,$01,$02,$02,$02,$02,$02,$03,$03,$03 - dta $00,$00,$01,$01,$01,$02,$02,$02,$02,$02,$03,$03,$03,$03,$04,$04 - dta $00,$00,$01,$01,$01,$02,$02,$02,$03,$03,$03,$04,$04,$04,$05,$05 - dta $00,$00,$01,$01,$02,$02,$02,$03,$03,$04,$04,$04,$05,$05,$06,$06 - dta $00,$00,$01,$01,$02,$02,$03,$03,$04,$04,$05,$05,$06,$06,$07,$07 - dta $00,$01,$01,$02,$02,$03,$03,$04,$04,$05,$05,$06,$06,$07,$07,$08 - dta $00,$01,$01,$02,$02,$03,$04,$04,$05,$05,$06,$07,$07,$08,$08,$09 - dta $00,$01,$01,$02,$03,$03,$04,$05,$05,$06,$07,$07,$08,$09,$09,$0A - dta $00,$01,$01,$02,$03,$04,$04,$05,$06,$07,$07,$08,$09,$0A,$0A,$0B - dta $00,$01,$02,$02,$03,$04,$05,$06,$07,$08,$09,$09,$0A,$0B,$0B,$0C - dta $00,$01,$02,$03,$04,$05,$05,$06,$07,$08,$09,$0A,$0A,$0B,$0C,$0D - dta $00,$01,$02,$03,$04,$05,$06,$07,$07,$08,$09,$0A,$0B,$0C,$0D,$0E - dta $00,$01,$02,$03,$04,$05,$06,$07,$08,$09,$0A,$0B,$0C,$0D,$0E,$0F -L_07E9 dta a(L_0C06,L_0C0C,L_0C12,L_0C1C,L_0C26,L_0C32,L_0C4F) -L_07F7 dta a(L_05E9,L_062A,L_066B) -L_07FD dta a(L_0BA1,L_0BC4,L_0BB9,0,0,0,0,0) ; bugfix by 0xF -L_080D dta $03,$03,$03,$03,$07,$0B,$0F,$13 ; bugfix by 0xF -L_0815 sta L_058F - stx L_0590 - sty L_0591 - and #$70 - lsr @ - lsr @ - lsr @ - tax - lda #$03 - sta $D20F - lda L_05D5,X - sta L_0849 - lda L_05D5+1,X - sta L_084A - lda #$03 - sta $D21F - lda #$01 - sta L_0592 - ldy L_0591 - ldx L_0590 - lda L_058F - jmp * -L_0849 equ *-2 -L_084A equ *-1 -L_084B lda L_0593 - sta ZP_FC - lda L_0594 - sta ZP_FD - ldy #$00 - txa - beq L_0876 -L_085A lda (ZP_FC),Y - cmp #$8F - beq L_0864 - cmp #$EF - bne L_0870 -L_0864 dex - bne L_0870 - iny - cpy #$54 - bcs L_0875 - tya - tax - bpl L_0876 -L_0870 iny - cpy #$54 - bcc L_085A -L_0875 rts -L_0876 stx L_0595 - lda #$00 - ldx #$05 -L_087D sta L_0511,X - sta L_0517,X - sta L_051D,X - dex - bpl L_087D - sta L_0596 - sta L_059D - ldy #$FF - sty L_059F - lda L_0599 - sta ZP_FC - lda L_059A - sta ZP_FD - ldy #$13 - lda (ZP_FC),Y - tax - lda L_0593 - sta ZP_FC - lda L_0594 - sta ZP_FD - ldy L_0595 - tya - pha - lda #$0F - sta L_05A9 - sta L_05AA -L_08BA lda (ZP_FC),Y - cmp #$87 - bne L_08E3 - tya - pha - clc - adc #$55 - tay - lda (ZP_FC),Y - bpl L_08CC - lda #$0F -L_08CC and #$0F - sta L_05A9 - tya - clc - adc #$55 - tay - lda (ZP_FC),Y - bpl L_08DD - lda L_05A9 -L_08DD and #$0F - sta L_05AA - pla -L_08E3 jmp L_08F3 -L_08E6 lda (ZP_FC),Y - cmp #$8F - beq L_08F3 - cmp #$EF - beq L_08F3 - dey - bpl L_08BA -L_08F3 pla - tay -L_08F5 lda (ZP_FC),Y - cmp #$CF - bne L_0908 - tya - clc - adc #$55 - tay - lda (ZP_FC),Y - bmi L_0913 - tax - jmp L_0913 -L_0908 cmp #$8F - beq L_0913 - cmp #$EF - beq L_0913 - dey - bpl L_08F5 -L_0913 stx L_0597 - stx L_0598 - rts -L_091A stx L_0599 - stx ZP_FC - sty L_059A - sty ZP_FD - clc - txa - adc #$14 - sta L_059B - tya - adc #$00 - sta L_059C - clc - txa - adc #$00 - sta L_0593 - tya - adc #$02 - sta L_0594 - ldy #$13 - lda (ZP_FC),Y - sta L_0597 - sta L_0598 - ldx #$03 - stx $D21F - stx $D20F -L_0950 lda #$00 - sta L_0592 - ldy #$08 -L_0957 lda #$00 - sta $D200,Y - sta $D210,Y - cpy #$06 - bcs L_096B - sta L_0523,Y - lda #$FF - sta L_0529,Y -L_096B dey - bpl L_0957 -L_096E lda #$80 -L_0970 ldx #$05 -L_0972 sta L_051D,X - dex - bpl L_0972 - sta L_059D - rts -L_097C lda #$00 - beq L_0970 - sta L_059D - beq L_0990 -L_0985 lda L_058F - and #$07 - tax - lda #$80 - sta L_051D,X -L_0990 ldy L_0591 - lda L_0590 -L_0996 sta L_058F - sty L_0591 - lda #$00 - sta L_0553,X - sta L_0529,X - sta L_054D,X - tya - asl @ - asl @ - asl @ - sta ZP_FE - clc - lda L_0599 - adc #$30 - pha - lda L_059A - adc #$01 - tay - pla - clc - adc ZP_FE - sta L_0565,X - tya - adc #$00 - sta L_0547,X - clc - lda L_0599 - adc #$94 - sta ZP_FC - lda L_059A - adc #$00 - sta ZP_FD - lda L_0591 - asl @ - adc L_0591 - asl @ - tay - sty L_0591 - iny - iny - iny - iny - iny - lda (ZP_FC),Y - sta L_0571,X - dey - lda (ZP_FC),Y - sta L_056B,X - dey - lda (ZP_FC),Y - sta L_0577,X - dey - dey - lda (ZP_FC),Y - sta L_053B,X - ldy #$00 - and #$07 - cmp #$03 - bne L_0A09 - ldy #$02 -L_0A09 cmp #$07 - bne L_0A0F - ldy #$04 -L_0A0F lda L_07F7,Y - sta ZP_FE - lda L_07F7+1,Y - sta ZP_FF - ldy L_0591 - iny - iny - lda (ZP_FC),Y - lsr @ - lsr @ - lsr @ - lsr @ - clc - adc L_058F - sta L_058F - sta L_0A9F - tay - lda L_053B,X - and #$07 - cmp #$07 - bne L_0A47 - tya - asl @ - tay - lda (ZP_FE),Y - sta L_057D,X - iny - sty L_058F - jmp L_0A5C -L_0A47 lda (ZP_FE),Y - sta L_057D,X - ldy L_0591 - iny - iny - lda (ZP_FC),Y - and #$0F - clc - adc L_058F - sta L_058F -L_0A5C ldy L_058F - lda L_053B,X - and #$07 - cmp #$05 - php - lda (ZP_FE),Y - plp - beq L_0A74 - cmp L_057D,X - bne L_0A74 - sec - sbc #$01 -L_0A74 sta L_0559,X - ldy L_0591 - lda (ZP_FC),Y - pha - and #$03 - tay - lda L_05E5,Y - sta L_0583,X - pla - lsr @ - lsr @ - lsr @ - lsr @ - ldy #$3E - cmp #$0F - beq L_0AA1 - ldy #$37 - cmp #$0E - beq L_0AA1 - ldy #$30 - cmp #$0D - beq L_0AA1 - clc - adc #$32 -L_0A9F equ *-1 - tay -L_0AA1 lda L_05E9,Y - sta L_0589,X - rts -L_0AA8 cld - lda ZP_FC - pha - lda ZP_FD - pha - lda ZP_FE - pha - lda ZP_FF - pha - lda L_0592 - bne L_0ABD - jmp L_0F2F -L_0ABD lda L_059D - beq L_0AC5 - jmp L_0CE1 -L_0AC5 lda L_0598 - cmp L_0597 - bcs L_0AD0 - jmp L_0CCE -L_0AD0 lda L_0596 - beq L_0AD8 - jmp L_0B9E -L_0AD8 ldx #$05 - lda #$00 -L_0ADC ldy L_051D,X - bmi L_0AE4 - sta L_051D,X -L_0AE4 sta L_0511,X - dex - bpl L_0ADC - lda L_0593 - sta ZP_FC - lda L_0594 - sta ZP_FD - ldy L_0595 - sty L_05A1 -L_0AFA cpy L_059F - bne L_0B18 - lda L_05A0 - beq L_0B18 - lda L_0595 - ldy L_059E - sty L_0595 - dec L_05A0 - bne L_0AFA - sta L_0595 - tay - bpl L_0AFA -L_0B18 ldx #$00 -L_0B1A lda (ZP_FC),Y - cmp #$FE - beq L_0B3C - sta L_0535,X - inc ZP_FD - lda (ZP_FC),Y - dec ZP_FD - cmp #$FE - beq L_0B3C - sta L_0538,X - clc - tya - adc #$55 - tay - inx - cpx #$03 - bcc L_0B1A - bcs L_0B5E -L_0B3C ldy L_0595 - iny - cpy L_05A1 - beq L_0B95 - sty L_0595 -L_0B48 jmp L_0AFA -L_0B4B pla - and #$0E - tax - lda L_07FD,X - sta L_0B87 - lda L_07FD+1,X - sta L_0B88 - jmp L_0B81 -L_0B5E ldy L_0595 - lda (ZP_FC),Y - bpl L_0B9E - cmp #$FF - beq L_0B9E - lsr @ - lsr @ - lsr @ - pha - and #$01 - beq L_0B4B - pla - and #$0E - tax - lda L_07E9,X - sta L_0B87 - lda L_07E9+1,X - sta L_0B88 -L_0B81 lda L_0536 - sta ZP_FE - jsr * -L_0B87 equ *-2 -L_0B88 equ *-1 - sty L_0595 - cpy #$55 - bcs L_0B95 - cpy L_05A1 - bne L_0B48 -L_0B95 ldy L_05A1 - sty L_0595 - jmp L_0F2F -L_0B9E jmp L_0C5E -L_0BA1 lda ZP_FE - bmi L_0BB7 - and #$0F - sta L_05A9 - lda L_0537 - bpl L_0BB2 - lda L_05A9 -L_0BB2 and #$0F - sta L_05AA -L_0BB7 iny - rts -L_0BB9 lda ZP_FE - bmi L_0BB7 - and #$01 - sta L_05B8 - iny - rts -L_0BC4 lda L_05B3 - bmi L_0BDD - dec L_05B4 - bne L_0C01 - lda #$32 - sta L_05B4 - dec L_05B3 - bne L_0C01 - dec L_05B3 - iny - rts -L_0BDD lda ZP_FE - bmi L_0BB7 - sta L_05B4 - inc L_05B4 - lda ZP_FE - bmi L_0BB7 - sta L_05B4 - inc L_05B4 - lda L_0537 - sta L_05B3 - bpl L_0BFE - lda #$00 - sta L_05B3 -L_0BFE inc L_05B3 -L_0C01 pla - pla - jmp L_0CE1 -L_0C06 jsr L_096E -L_0C09 ldy #$FF - rts -L_0C0C lda ZP_FE - bmi L_0C09 - tay - rts -L_0C12 lda ZP_FE - bmi L_0C09 - sec - tya - sbc ZP_FE - tay - rts -L_0C1C lda ZP_FE - bmi L_0C09 - clc - tya - adc ZP_FE - tay - rts -L_0C26 lda ZP_FE - bmi L_0C09 - sta L_0597 - sta L_0598 - iny - rts -L_0C32 lda ZP_FE - bmi L_0C09 - lda L_0537 - bmi L_0C09 - iny - sty L_059E - clc - tya - adc ZP_FE - sta L_059F - lda L_0537 - sta L_05A0 - cpy #$54 - rts -L_0C4F dey - bmi L_0C5C - lda (ZP_FC),Y - cmp #$8F - beq L_0C5C - cmp #$EF - bne L_0C4F -L_0C5C iny - rts -L_0C5E ldx #$05 -L_0C60 lda L_0517,X - beq L_0C6A - dec L_0517,X - bpl L_0CC1 -L_0C6A lda L_051D,X - bne L_0CC1 - ldy L_0535,X - cmp #$40 - bcs L_0CC1 - lda L_059B - sta ZP_FC - lda L_059C - sta ZP_FD - lda (ZP_FC),Y - sta ZP_FE - clc - tya - adc #$40 - tay - lda (ZP_FC),Y - sta ZP_FF -L_0C8D ldy L_0511,X - lda (ZP_FE),Y - and #$C0 - bne L_0CA2 - lda (ZP_FE),Y - and #$3F - sta L_052F,X - inc L_0511,X - bpl L_0C8D -L_0CA2 cmp #$40 - bne L_0CB3 - lda (ZP_FE),Y - and #$3F - ldy L_052F,X - jsr L_0996 - jmp L_0CBE -L_0CB3 cmp #$80 - bne L_0CC1 - lda (ZP_FE),Y - and #$3F - sta L_0517,X -L_0CBE inc L_0511,X -L_0CC1 dex - bpl L_0C60 - ldx L_0596 - inx - txa - and #$3F - sta L_0596 -L_0CCE dec L_0598 - bne L_0CE1 - lda L_0597 - sta L_0598 - lda L_0596 - bne L_0CE1 - inc L_0595 -L_0CE1 ldy L_0559 - lda L_053B - and #$07 - cmp #$05 - beq L_0CF1 - cmp #$06 - bne L_0CF2 -L_0CF1 dey -L_0CF2 sty L_05A2 - ldy #$00 - cmp #$05 - beq L_0CFF - cmp #$06 - bne L_0D01 -L_0CFF ldy #$02 -L_0D01 cmp #$07 - bne L_0D07 - ldy #$28 -L_0D07 sty L_05A4 - ldy L_055C - lda L_053E - and #$07 - cmp #$05 - beq L_0D1A - cmp #$06 - bne L_0D1B -L_0D1A dey -L_0D1B sty L_05A3 - ldy #$00 - cmp #$05 - beq L_0D28 - cmp #$06 - bne L_0D2A -L_0D28 ldy #$02 -L_0D2A cmp #$07 - bne L_0D30 - ldy #$28 -L_0D30 sty L_05A5 - ldx #$05 -L_0D35 lda L_053B,X - and #$E0 - sta L_0541,X - lda L_0565,X - sta ZP_FC - lda L_0547,X - sta ZP_FD - lda L_0529,X - cmp #$FF - beq L_0D85 - cmp #$0F - bne L_0D73 - lda L_054D,X - beq L_0D85 - dec L_054D,X - lda L_054D,X - bne L_0D85 - ldy L_0523,X - beq L_0D65 - dey -L_0D65 tya - sta L_0523,X - lda L_0577,X - sta L_054D,X - dey - jmp L_0D85 -L_0D73 lda L_0529,X - lsr @ - tay - lda (ZP_FC),Y - bcc L_0D80 - lsr @ - lsr @ - lsr @ - lsr @ -L_0D80 and #$0F - sta L_0523,X -L_0D85 ldy L_057D,X - lda L_053B,X - and #$07 - cmp #$01 - bne L_0DB0 - dey - tya - iny - cmp L_0559,X - php - lda #$01 - plp - bne L_0D9F - asl @ - asl @ -L_0D9F and L_0553,X - beq L_0DB0 - ldy L_0559,X - cpy #$FF - bne L_0DB0 - lda #$00 - sta L_0523,X -L_0DB0 tya - sta L_055F,X - lda #$01 - sta L_05A8 - lda L_0529,X - cmp #$0F - beq L_0E0C - and #$07 - tay - lda L_05CD,Y - sta ZP_FE - lda L_0529,X - and #$08 - php - txa - plp - clc - beq L_0DD5 - adc #$06 -L_0DD5 tay - lda L_056B,Y - and ZP_FE - beq L_0E0C - lda L_0589,X - sta L_055F,X - stx L_05A8 - dex - cpx #$02 - beq L_0DFA - cpx #$FF - bne L_0E05 - sta L_05A2 - lda #$00 - sta L_05A4 - jmp L_0E05 -L_0DFA lda L_058C - sta L_05A3 - lda #$00 - sta L_05A5 -L_0E05 inx - lda L_0583,X - sta L_0541,X -L_0E0C lda L_0529,X - and #$0F - cmp #$0F - beq L_0E27 - inc L_0529,X - lda L_0529,X - and #$0F - cmp #$0F - bne L_0E27 - lda L_0577,X - sta L_054D,X -L_0E27 lda L_051D,X - bpl L_0E36 - lda L_0523,X - bne L_0E36 - lda #$40 - sta L_051D,X -L_0E36 inc L_0553,X - ldy #$00 - lda L_053B,X - lsr @ - lsr @ - lsr @ - lsr @ - bcc L_0E45 - dey -L_0E45 lsr @ - bcc L_0E49 - iny -L_0E49 clc - tya - adc L_057D,X - sta L_057D,X - lda L_0559,X - cmp #$FF - bne L_0E5A - ldy #$00 -L_0E5A clc - tya - adc L_0559,X - sta L_0559,X - dex - bmi L_0E68 - jmp L_0D35 -L_0E68 jsr L_0F7B - lda L_0541 - sta L_05A6 - lda L_0544 - sta L_05A7 - lda L_053B - and #$07 - jsr L_0FB5 -L_0E7F tya - pha - lda L_05B9,Y - php - and #$7F - tax - tya - and #$03 - asl @ - tay - cpx #$03 - bne L_0E94 - jmp L_0EC4 -L_0E94 lda L_05AD,X - bne L_0EC0 - lda L_055F,X - sta $D200,Y - lda L_0523,X - ora L_0541,X - plp - bpl L_0EAA - lda #$00 -L_0EAA sta $D201,Y -L_0EAD pla - tay - dey - and #$03 - beq L_0EB7 - jmp L_0E7F -L_0EB7 lda L_05A4 - sta $D208 - jmp L_0EE4 -L_0EC0 plp - jmp L_0EAD -L_0EC4 lda L_05AD - bne L_0EE0 - lda L_05A2 - sta $D200,Y - lda L_0523 - ora L_05A6 - plp - bpl L_0EDA - lda #$00 -L_0EDA sta $D201,Y - jmp L_0EAD -L_0EE0 plp - jmp L_0EAD -L_0EE4 lda L_053E - and #$07 - jsr L_0FB5 -L_0EEC tya - pha - lda L_05B9,Y - php - and #$7F - tax - tya - and #$03 - asl @ - tay - cpx #$03 - bne L_0F01 - jmp L_0F3C -L_0F01 lda L_05B0,X - bne L_0F24 - lda L_0562,X - sta $D210,Y - lda L_0526,X - ora L_0544,X - plp - bpl L_0F17 - lda #$00 -L_0F17 sta $D211,Y -L_0F1A pla - tay - dey - and #$03 - beq L_0F28 - jmp L_0EEC -L_0F24 plp - jmp L_0F1A -L_0F28 lda L_97A5 - sta $D218 - clc -L_0F2F pla - sta ZP_FF - pla - sta ZP_FE - pla - sta ZP_FD - pla - sta ZP_FC - rts -L_0F3C lda L_05B0 - bne L_0F58 - lda L_05A3 - sta $D210,Y - lda L_0526 - ora L_97A7 - plp - bpl L_0F52 - lda #$00 -L_0F52 sta $D211,Y - jmp L_0F1A -L_0F58 plp - jmp L_0F1A -L_0F5C jsr L_0AA8 - bcs L_0F7A - lda L_05B8 - beq L_0F7A - lda L_059D - sta L_05B7 - lda #$01 - sta L_059D - jsr L_0AA8 - lda L_05B7 - sta L_059D -L_0F7A rts -L_0F7B lda L_05A9 - asl @ - asl @ - asl @ - asl @ - sta L_05AB - lda L_05AA - asl @ - asl @ - asl @ - asl @ - sta L_05AC - ldx #$02 -L_0F91 stx ZP_C8 - lda L_05AB - ora L_0523,X - tax - lda L_06E9,X - ldx ZP_C8 - sta L_0523,X - lda L_05AC - ora L_0526,X - tax - lda L_06E9,X - ldx ZP_C8 - sta L_0526,X - dex - bpl L_0F91 - rts -L_0FB5 tay - lda L_080D,Y - tay - rts - - end Binary files /tmp/tmpyaM5l1/AUpGL9bywb/kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/cms.obx and /tmp/tmpyaM5l1/KBGCC02aAO/kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/cms.obx differ diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/dlt.as8 kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/dlt.as8 --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/dlt.as8 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/dlt.as8 1970-01-01 00:00:00.000000000 +0000 @@ -1,922 +0,0 @@ -//****************************************************************************************************************************************************** -// Header -//****************************************************************************************************************************************************** - -/** Delta Music Composer 1.7 Reference Player - @author Marek Konopka - @date 03.09.2009 -*/ - -.local NRefDlt17Player - -//****************************************************************************************************************************************************** -// Constants -//****************************************************************************************************************************************************** - - PLAYER_BASE_PTR = $0200 - PLAYER_ZPG_VARS = $e0 - - DEFAULT_TEMPO = 6 - - MAX_NUM_PATTERNS = 64 - MAX_NUM_INSTRUMENTS = 32 - - SONG_LENGTH = 128 - PATTERN_SIZE = 128 - INSTRUMENT_SIZE = 64 - FRQ_TABLE_SIZE = 64 - ENVELOPE_SIZE = 16 - - TRACK_CMD_STOP = $40 - TRACK_CMD_JUMP = $41 - TRACK_CMD_TEMPO = $42 - TRACK_CMD_LAST = TRACK_CMD_TEMPO - - ACC_OFFSET_FILTER_TRANSP = 0 - INSTR_OFFSET_AUDCTLS = 48+0 - INSTR_OFFSET_VOL_DECAY_DELAY = 48+1 - INSTR_OFFSET_FRQ_SLIDE = 48+2 - INSTR_OFFSET_TRANSP_DELAY = 48+3 - INSTR_OFFSET_TRANSP_TBL = 48+4 - - ACCENT_NONE = 0 - ACCENT_FRQ_STORE = 1 - ACCENT_FRQ_TRANSP = 2 - ACCENT_NOTE_TRANSP = 3 - - TRANSP_TBL_SIZE = 4 // must be a power of two - - CHANNEL0_FILTER_MASK = 4 - CHANNEL1_FILTER_MASK = 2 - - AUDCTL_CHANNEL0_MASK = %11010101 - AUDCTL_CHANNEL1_MASK = %10000011 - AUDCTL_CHANNEL2_MASK = %10101001 - AUDCTL_CHANNEL3_MASK = %10000001 - - OFFSET_PATTERN_PTRS = $0000 - OFFSET_INSTR_PTRS = $0080 - OFFSET_VARIABLES = $0100 - OFFSET_FRQ = $0200 - OFFSET_PLAYER_CODE = $0300 - -//****************************************************************************************************************************************************** -// Zero page variable -//****************************************************************************************************************************************************** - - patt0_ptr = PLAYER_ZPG_VARS+$00 // track #0 pattern pointer - patt1_ptr = PLAYER_ZPG_VARS+$02 // track #1 pattern pointer - patt2_ptr = PLAYER_ZPG_VARS+$04 // track #2 pattern pointer - patt3_ptr = PLAYER_ZPG_VARS+$06 // track #3 pattern pointer - - instr0_ptr = PLAYER_ZPG_VARS+$08 // track #0 combined volume-distortion pointer - instr1_ptr = PLAYER_ZPG_VARS+$0a // track #1 combined volume-distortion pointer - instr2_ptr = PLAYER_ZPG_VARS+$0c // track #2 combined volume-distortion pointer - instr3_ptr = PLAYER_ZPG_VARS+$0e // track #3 combined volume-distortion pointer - - acc0_ptr = PLAYER_ZPG_VARS+$10 // track #0 accents ptr - acc1_ptr = PLAYER_ZPG_VARS+$12 // track #1 accents ptr - acc2_ptr = PLAYER_ZPG_VARS+$14 // track #2 accents ptr - acc3_ptr = PLAYER_ZPG_VARS+$16 // track #3 accents ptr - - acc_param0_ptr = PLAYER_ZPG_VARS+$18 // track #0 accent params ptr - acc_param1_ptr = PLAYER_ZPG_VARS+$1a // track #1 accent params ptr - acc_param2_ptr = PLAYER_ZPG_VARS+$1c // track #2 accent params ptr - acc_param3_ptr = PLAYER_ZPG_VARS+$1e // track #2 accent params ptr - -//****************************************************************************************************************************************************** -// Pointers -//****************************************************************************************************************************************************** - - ModulePtr = $2000 - TracksPtr = ModulePtr+$2000 - InstrumentsPtr = ModulePtr+$2400 - ParametersPtr = ModulePtr+$2c00 - BassFrqType = ParametersPtr+$0000 - -//****************************************************************************************************************************************************** -// Hardware -//****************************************************************************************************************************************************** - - POKEY = $d200 - AUDCTL = $d208 - SKCTL = $d20f - -//****************************************************************************************************************************************************** -// Variables -//****************************************************************************************************************************************************** - - org PLAYER_BASE_PTR + OFFSET_VARIABLES - - env_ind: .ds 4 // envelope indices (ENVELOPE_SIZE-1 ... 0) - tr_stat: .ds 4 // track statuses (0 -> off, !=0 -> on) - notes: .ds 4 // notes = pattern note + track transposition - vd_cnt: .ds 4 // volume decay counters - trns_del: .ds 4 // instrument transposition delays - trns_ind: .ds 4 // instrument transposition indices - ptransp: .ds 4 // pattern transpositions - freq_add: .ds 4 // frequency additions - audc: .ds 4 // audc - audf: .ds 4 // audf - audctls: .ds 4 // audctl - vol_stat: .ds 4 // volume statuses - - tmp_ptr: .ds 2 // temporary pointer - play_stat: .ds 1 // playing status - tempo: .ds 1 // tempo - tempo_cnt: .ds 1 // tempo counter - patt_pos: .ds 1 // pattern position - track_pos: .ds 1 // track position - //tmp_note: .ds 1 // temporary note - tmp_freq: .ds 1 // temporary frequency - -//****************************************************************************************************************************************************** -// Data -//****************************************************************************************************************************************************** - - //.align 256 - FrqTbl = PLAYER_BASE_PTR + OFFSET_FRQ - - org FrqTbl -; ins 'frq_tbl_normal.dat' - dta $ff,$f1,$e4,$d7,$cb,$c0,$b5,$aa,$a1,$98,$8f,$87,$7f,$79,$72,$6b - dta $65,$5f,$5a,$55,$50,$4b,$47,$43,$3f,$3c,$38,$35,$32,$2f,$2c,$2a - dta $27,$25,$23,$21,$1f,$1d,$1c,$1a,$18,$17,$16,$14,$13,$12,$11,$10 - dta $0f,$0e,$0d,$0c,$0b,$0a,$09,$08,$07,$06,$05,$04,$ff,$f1,$e4,$d7 - -; ins 'frq_tbl_bass_cmc.dat' - dta $f2,$e9,$da,$ce,$bf,$b6,$aa,$a1,$98,$8f,$89,$80,$7a,$71,$6b,$65 - dta $5f,$5c,$56,$50,$67,$60,$5a,$55,$51,$4c,$48,$43,$3f,$3d,$39,$34 - dta $33,$30,$2d,$2a,$28,$25,$24,$21,$1f,$1e,$1c,$1b,$19,$00,$16,$15 - dta $00,$0a,$09,$08,$07,$06,$05,$04,$03,$02,$01,$00,$f2,$e9,$da,$ce - -; ins 'frq_tbl_bass_cmc.dat' - dta $f2,$e9,$da,$ce,$bf,$b6,$aa,$a1,$98,$8f,$89,$80,$7a,$71,$6b,$65 - dta $5f,$5c,$56,$50,$67,$60,$5a,$55,$51,$4c,$48,$43,$3f,$3d,$39,$34 - dta $33,$30,$2d,$2a,$28,$25,$24,$21,$1f,$1e,$1c,$1b,$19,$00,$16,$15 - dta $00,$0a,$09,$08,$07,$06,$05,$04,$03,$02,$01,$00,$f2,$e9,$da,$ce - -; ins 'frq_tbl_bass_mpt.dat' - dta $ff,$f1,$e4,$d8,$ca,$c0,$b5,$ab,$a2,$99,$8e,$87,$7f,$78,$73,$6c - dta $66,$61,$5a,$55,$51,$4b,$48,$43,$3f,$3c,$39,$34,$33,$30,$2d,$2a - dta $28,$25,$24,$21,$1f,$1e,$1c,$1b,$19,$17,$16,$15,$13,$12,$11,$10 - dta $0f,$0e,$0d,$0c,$0b,$0a,$09,$08,$07,$06,$05,$04,$03,$02,$01,$ff - - PatternPtrsTbl = PLAYER_BASE_PTR + OFFSET_PATTERN_PTRS - InstrumentPtrsTbl = PLAYER_BASE_PTR + OFFSET_INSTR_PTRS - PlayerCodePtr = PLAYER_BASE_PTR + OFFSET_PLAYER_CODE - -//****************************************************************************************************************************************************** -// Code -//****************************************************************************************************************************************************** - - org PlayerCodePtr - -//****************************************************************************************************************************************************** - - jmp init - jmp player.entry_point - jmp stop - -//****************************************************************************************************************************************************** - -/// Initialize. -/** @param .byte Y - Initial track position. -*/ -.proc init - dey - sty track_pos - - lda #(PATTERN_SIZE-2) - sta patt_pos - - ldx #DEFAULT_TEMPO - stx tempo - ldx #1 - stx tempo_cnt - - jsr init_patterns_table - jsr init_instruments_tbl - jsr init_variables - jsr init_frq_tbl - - lda #1 - sta play_stat - - lda #3 - sta SKCTL - rts -.endp - -//****************************************************************************************************************************************************** - -.proc init_patterns_table - ldx #ModulePtr - stx tmp_ptr - sty tmp_ptr+1 - - ldy #0 -loop - lda tmp_ptr - sta PatternPtrsTbl,y - lda tmp_ptr+1 - sta PatternPtrsTbl+MAX_NUM_PATTERNS,y - - lda tmp_ptr - clc - adc #PATTERN_SIZE - sta tmp_ptr - bcc skip - inc tmp_ptr+1 -skip - - iny - cpy #MAX_NUM_PATTERNS - bne loop - rts -.endp - -//****************************************************************************************************************************************************** - -.proc init_instruments_tbl - ldx #InstrumentsPtr - stx tmp_ptr - sty tmp_ptr+1 - - ldy #0 -loop - lda tmp_ptr - sta InstrumentPtrsTbl,y - lda tmp_ptr+1 - sta InstrumentPtrsTbl+MAX_NUM_INSTRUMENTS,y - - lda tmp_ptr - clc - adc #INSTRUMENT_SIZE - sta tmp_ptr - bcc skip - inc tmp_ptr+1 -skip - - iny - cpy #MAX_NUM_INSTRUMENTS - bne loop - rts -.endp - -//****************************************************************************************************************************************************** - -.proc init_frq_tbl - lda BassFrqType - and #1 - lsr @ - ror @ - ror @ - tay - - ldx #0 -loop - lda FrqTbl+FRQ_TABLE_SIZE*2,y - sta FrqTbl+FRQ_TABLE_SIZE,x - - iny - inx - cpx #FRQ_TABLE_SIZE - bne loop - rts -.endp - -//****************************************************************************************************************************************************** - -.proc init_variables - ldy #3 - lda #0 -loop - sta audctls,y - sta audc,y - sta audf,y - sta vol_stat,y - - dey - bpl loop - rts -.endp - -//****************************************************************************************************************************************************** - -.proc stop - lda #0 - sta play_stat - - ldy #7 - lda #0 -loop - sta POKEY,y - dey - bpl loop - rts -.endp - -//****************************************************************************************************************************************************** - -.nowarn .proc player -play_done - rts - -entry_point - lda play_stat - beq play_done - - lda audctls+0 - ora audctls+1 - ora audctls+2 - ora audctls+3 - sta AUDCTL - - ldx audf+0 - ldy audc+0 - stx POKEY+0 - sty POKEY+1 - - ldx audf+1 - ldy audc+1 - stx POKEY+2 - sty POKEY+3 - - ldx audf+2 - ldy audc+2 - stx POKEY+4 - sty POKEY+5 - - ldx audf+3 - ldy audc+3 - stx POKEY+6 - sty POKEY+7 - - dec tempo_cnt - bne play_instruments - lda tempo - sta tempo_cnt - - inc patt_pos - inc patt_pos - bpl take_notes - - new_track_pos: - inc track_pos - lda #0 - sta patt_pos - - jsr tktrx.entry_point - - lda tr_stat+0 - ora tr_stat+1 - ora tr_stat+2 - ora tr_stat+3 - bne take_notes - jmp stop - - take_notes: - lda tr_stat+0 - beq skip1 - jsr tkpt1 - - skip1: - lda tr_stat+1 - beq skip2 - jsr tkpt2 - - skip2: - lda tr_stat+2 - beq skip3 - jsr tkpt3 - - skip3: - lda tr_stat+3 - beq skip4 - jsr tkpt4 - - skip4: - -play_instruments - lda tr_stat+0 - beq skip10 - lda vol_stat+0 - beq skip10 - jsr play_instr0 - -skip10: - lda tr_stat+1 - beq skip11 - lda vol_stat+1 - beq skip11 - jsr play_instr1 - -skip11: - lda tr_stat+2 - beq skip12 - lda vol_stat+2 - beq skip12 - jsr play_instr2 - -skip12: - lda tr_stat+3 - beq skip13 - lda vol_stat+3 - beq skip13 - jsr play_instr3 -skip13: - rts -.endp - -//****************************************************************************************************************************************************** - -.nowarn .proc tktrx - -//------------------------------------------------------------------------------------------------------------------------------------------------------ - -tr1_non_pattern - cpy #(TRACK_CMD_LAST+1) - bcc continue - lda #0 - sta tr_stat+0 - sta audc+0 - sta audctls+0 - jmp track2 - -continue - cpy #TRACK_CMD_TEMPO - bne non_tempo - -cmd_tempo - lda TracksPtr+SONG_LENGTH,x - sta tempo - sta tempo_cnt - inc track_pos - jmp tktrx.entry_point - -non_tempo: - cpy #TRACK_CMD_JUMP - bne cmd_stop - -cmd_jmp - lda TracksPtr+SONG_LENGTH,x - sta track_pos - jmp tktrx.entry_point - -cmd_stop - // no need to continue processing - pla - pla - jmp stop - -//------------------------------------------------------------------------------------------------------------------------------------------------------ - -entry_point - ldx track_pos -track1 - ldy TracksPtr,x - cpy #MAX_NUM_PATTERNS - bcs tr1_non_pattern - - lda TracksPtr+SONG_LENGTH,x - sta ptransp+0 - lda PatternPtrsTbl,y - sta patt0_ptr - lda PatternPtrsTbl+MAX_NUM_PATTERNS,y - sta patt0_ptr+1 - lda #1 - sta tr_stat+0 - -track2 - ldy TracksPtr+SONG_LENGTH*2,x - cpy #MAX_NUM_PATTERNS - bcs non_pattern_2 - - lda TracksPtr+SONG_LENGTH*3,x - sta ptransp+1 - lda PatternPtrsTbl,y - sta patt1_ptr - lda PatternPtrsTbl+MAX_NUM_PATTERNS,y - sta patt1_ptr+1 - lda #1 - sta tr_stat+1 - -track3 - ldy TracksPtr+SONG_LENGTH*4,x - cpy #MAX_NUM_PATTERNS - bcs non_pattern_3 - - lda TracksPtr+SONG_LENGTH*5,x - sta ptransp+2 - lda PatternPtrsTbl,y - sta patt2_ptr - lda PatternPtrsTbl+MAX_NUM_PATTERNS,y - sta patt2_ptr+1 - lda #1 - sta tr_stat+2 - -track4 - ldy TracksPtr+SONG_LENGTH*6,x - cpy #MAX_NUM_PATTERNS - bcs non_pattern_4 - - lda TracksPtr+SONG_LENGTH*7,x - sta ptransp+3 - lda PatternPtrsTbl,y - sta patt3_ptr - lda PatternPtrsTbl+MAX_NUM_PATTERNS,y - sta patt3_ptr+1 - lda #1 - sta tr_stat+3 - rts - -non_pattern_2 - lda #0 - sta tr_stat+1 - sta audc+1 - sta audctls+1 - beq track3 - -non_pattern_3 - lda #0 - sta tr_stat+2 - sta audc+2 - sta audctls+2 - beq track4 - -non_pattern_4 - lda #0 - sta tr_stat+3 - sta audc+3 - sta audctls+3 - rts -.endp - -//****************************************************************************************************************************************************** - -/// Take pattern position. -/** @param %%1 .byte channel_num - Channel number. - @param %%2 .word patt_ptr - Pattern pointer. - @param %%3 .word instr_ptr - Instrument pointer. - @param %%4 .word acc_ptr - Accents pointer. - @param %%5 .word acc_param_ptr - Accent params pointer. - @param %%6 .byte audctl_channel_mask - AUDCTL mask. -*/ -.macro tkpt_macro - ldy patt_pos - lda (%%2),y - bmi note - iny - lda (%%2),y - bmi end_of_pattern - // empty - rts - end_of_pattern: - pla - pla - jmp player.new_track_pos - -note - // note = (patt_note + ptransp) & 0x7f; - clc - adc ptransp+%%1 - and #127 - sta notes+%%1 - - // env_ind = vol_stat = (ENVELOPE_SIZE-1); - lda #(ENVELOPE_SIZE-1) - sta env_ind+%%1 - sta vol_stat+%%1 - - iny - lda (%%2),y - tax - - lda InstrumentPtrsTbl+MAX_NUM_INSTRUMENTS,x - sta %%3+1 - sta %%4+1 - sta %%5+1 - - lda InstrumentPtrsTbl,x - sta %%3 - //clc - eor #$10 - sta %%4 - eor #$30 - sta %%5 - - // vd_cnt = instr_ptr[INSTR_OFFSET_VOL_DECAY_DELAY]; - ldy #INSTR_OFFSET_VOL_DECAY_DELAY - lda (%%3),y - sta vd_cnt+%%1 - - // trns_del = instr_ptr[INSTR_OFFSET_VOL_DECAY_DELAY] & 0x7f; - ldy #INSTR_OFFSET_TRANSP_DELAY - lda (%%3),y - and #127 - sta trns_del+%%1 - - // trns_ind = freq_add = 0; - lda #0 - sta trns_ind+%%1 - sta freq_add+%%1 - - // audctls = instr_ptr[INSTR_OFFSET_AUDCTLS] & audctl_channel_mask - ldy #INSTR_OFFSET_AUDCTLS - lda (%%3),y - and %%6 - sta audctls+%%1 - rts -.endm - -//****************************************************************************************************************************************************** - -.proc tkpt1 - tkpt_macro 0, patt0_ptr, instr0_ptr, acc0_ptr, acc_param0_ptr, #AUDCTL_CHANNEL0_MASK -.endp - -//****************************************************************************************************************************************************** - -.proc tkpt2 - tkpt_macro 1, patt1_ptr, instr1_ptr, acc1_ptr, acc_param1_ptr, #AUDCTL_CHANNEL1_MASK -.endp - -//****************************************************************************************************************************************************** - -.proc tkpt3 - tkpt_macro 2, patt2_ptr, instr2_ptr, acc2_ptr, acc_param2_ptr, #AUDCTL_CHANNEL2_MASK -.endp - -//****************************************************************************************************************************************************** - -.proc tkpt4 - tkpt_macro 3, patt3_ptr, instr3_ptr, acc3_ptr, acc_param3_ptr, #AUDCTL_CHANNEL3_MASK -.endp - -//****************************************************************************************************************************************************** - -/// Play instrument. -/** @param %%1 .byte channel_num - Channel number. - @param %%2 .word instr_ptr - Instrument pointer. - @param %%3 .word acc_ptr - Accents pointer. - @param %%4 .word acc_param_ptr - Accent params pointer. -*/ -.macro play_instr - ldy env_ind+%%1 - bmi outside_envelope - -//------------------------------------------------------------------------------------------------------------------------------------------------------ - - envelope: - // audc = envelope[env_ind] - lda (%%2),y - sta audc+%%1 - - // if (accents[env_ind] == 0) - lda (%%3),y - bne acc - jsr determine_table_transpositions - dec env_ind+%%1 - jmp update_variables - acc: - cmp #ACCENT_FRQ_STORE - beq acc_1 - -//------------------------------------------------------------------------------------------------------------------------------------------------------ - - determine_accent_transpositions: - // if (accents[env_ind] == 3) - //lda (acc_ptr),y - cmp #ACCENT_NOTE_TRANSP - bne acc_2 - - acc_3: - // tmp_note = notes + acc_params[env_ind]; - lda notes+%%1 - clc - adc (%%4),y - //sta tmp_note - tax - - // tmp_freq = freq_add; - lda freq_add+%%1 - sta tmp_freq - //rts - jmp determine_acc_audf - - acc_2: - // tmp_freq = freq_add + acc_params[env_ind]; - lda freq_add+%%1 - clc - adc (%%4),y - sta tmp_freq - - // tmp_note = notes; - //lda notes+0 - //sta tmp_note - ldx notes+%%1 - //rts - //jmp determine_audf - - determine_acc_audf: - jsr determine_audf - dec env_ind+%%1 - rts - -//------------------------------------------------------------------------------------------------------------------------------------------------------ - - acc_1: - // audf = acc_params[env_ind]; - lda (%%4),y - sta audf+%%1 - dec env_ind+%%1 - rts - -//------------------------------------------------------------------------------------------------------------------------------------------------------ - -outside_envelope - jsr determine_table_transpositions - //jsr volume_decay - //jmp update_variables - -//------------------------------------------------------------------------------------------------------------------------------------------------------ - -volume_decay - ldy #INSTR_OFFSET_VOL_DECAY_DELAY - lda (%%2),y - beq exit_volume_decay - dec vd_cnt+%%1 - beq volume_test - //rts - jmp update_variables - volume_test: - lda audc+%%1 - and #15 - beq disable_instr - dec audc+%%1 - lda (%%2),y - sta vd_cnt+%%1 - //rts - jmp update_variables - disable_instr: - sta vol_stat+%%1 - rts -exit_volume_decay - //rts - -//------------------------------------------------------------------------------------------------------------------------------------------------------ - -update_variables - -frequency_slide - lda freq_add+%%1 - clc - ldy #INSTR_OFFSET_FRQ_SLIDE - adc (%%2),y - sta freq_add+%%1 - -table_transposition - dec trns_del+%%1 - bne done_table_transposition - inc trns_ind+%%1 - ldy #INSTR_OFFSET_TRANSP_DELAY - lda (%%2),y - and #127 - sta trns_del+%%1 -done_table_transposition - rts - -//------------------------------------------------------------------------------------------------------------------------------------------------------ - -determine_table_transpositions - // no acc - - // uint8_t transp = instr[(trns_ind & 3) + 4 + 48]; - lda trns_ind+%%1 - and #(TRANSP_TBL_SIZE-1) - clc - adc #INSTR_OFFSET_TRANSP_TBL - tay - lda (%%2),y - tax - - // if (instr[INSTR_OFFSET_TRANSP_DELAY] > 0) // transp_delay - ldy #INSTR_OFFSET_TRANSP_DELAY - lda (%%2),y - bmi frequency_transposition - - note_transposition: - // tmp_note = transp + notes - txa - //clc - adc notes+%%1 - //sta tmp_note - tax - - // tmp_freq = freq_add; - lda freq_add+%%1 - sta tmp_freq - //rts - jmp determine_audf - -frequency_transposition - // tmp_freq = transp + freq_add; - txa - //clc - adc freq_add+%%1 - sta tmp_freq - - // tmp_note = notes; - //lda notes+0 - //sta tmp_note - ldx notes+%%1 - //rts - //jmp determine_audf - -//------------------------------------------------------------------------------------------------------------------------------------------------------ - -determine_audf - // acc != 1 - - // audf = FrqTbl[tmp_note] + tmp_freq; - //ldx tmp_note - lda FrqTbl,x - clc - adc tmp_freq - sta audf+%%1 - - .if (%%1 == 2 || %%1 == 3) - rts - .else - // if ((audctls & filter_mask) == 0) // filter test - lda audctls+%%1 - .if (%%1 == 0) - and #CHANNEL0_FILTER_MASK - .else - and #CHANNEL1_FILTER_MASK - .endif - bne filter - rts - - filter: - // if (accents[env_ind] == 0) - ldy env_ind+%%1 - lda (%%3),y - bne filter_with_no_transposition - - filter_with_note_transposition: - // audf+2 = FrqTbl[tmp_note + acc_params[0]] + tmp_freq + 0xff; - //lda tmp_note - txa - clc - ldy #ACC_OFFSET_FILTER_TRANSP - adc (%%4),y - tax - lda FrqTbl,x - clc - adc tmp_freq - clc - adc #$ff - sta audf+%%1+2 - rts - - filter_with_no_transposition: - // audf+2 = audf + 0xff; - lda audf+%%1 - clc - adc #$ff - sta audf+%%1+2 - rts - .endif -.endm - -//****************************************************************************************************************************************************** - -.proc play_instr0 - play_instr 0, instr0_ptr, acc0_ptr, acc_param0_ptr -.endp - -//****************************************************************************************************************************************************** - -.proc play_instr1 - play_instr 1, instr1_ptr, acc1_ptr, acc_param1_ptr -.endp - -//****************************************************************************************************************************************************** - -.proc play_instr2 - play_instr 2, instr2_ptr, acc2_ptr, acc_param2_ptr -.endp - -//****************************************************************************************************************************************************** - -.proc play_instr3 - play_instr 3, instr3_ptr, acc3_ptr, acc_param3_ptr -.endp - -//****************************************************************************************************************************************************** - -.endl // NRefDltPlayer Binary files /tmp/tmpyaM5l1/AUpGL9bywb/kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/dlt.obx and /tmp/tmpyaM5l1/KBGCC02aAO/kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/dlt.obx differ diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/fc.as8 kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/fc.as8 --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/fc.as8 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/fc.as8 1970-01-01 00:00:00.000000000 +0000 @@ -1,703 +0,0 @@ -; Deassembled with da65 by Mono / Tristesse - - opt ?+ o+ h+ c- - -;irqens = $10 -audf1 = $d200 -;audc1 = $d201 -audf2 = $d202 -;audc2 = $d203 -;audctl = $d208 -;irqen = $d20e -;irqst = $d20e -skctl = $d20f - -audf12 = $d210 -audc12 = $d211 -audf22 = $d212 -audc22 = $d213 -audf32 = $d214 -audc32 = $d215 -audf42 = $d216 -audc42 = $d217 -audctl2 = $d218 -stimer2 = $d219 -irqen2 = $d21e -skctl2 = $d21f - -; FC player zpg -; = $1c..$1f -track1ad = $e0 -track2ad = $e2 -track3ad = $e4 -trackad = track1ad -track1pos = $e6 -track2pos = $e8 -track3pos = $ea -trackpos = track1pos -pat1pos = $e7 -pat2pos = $e9 -pat3pos = $eb -patpos = pat1pos -note1dur = $ec -note2dur = $ee -note3dur = $f0 -notedur = note1dur -pat1delay = $ed -pat2delay = $ef -pat3delay = $f1 -patdelay = pat1delay -patad = $f2 -songno = $f4 - - - -dataad = $fc -instrad = $fe - - org $400 - jmp initplay -; jmp dosound - -dosound: - jsr setpokey - jmp fc_play - -; Initialize playing of FC module. -initplay: - ldx #<$a00 - ldy #>$a00 -;doinit: - jsr fc_init -; jmp setpokey - -; Setting POKEY registers due to panning settings. -setpokey: - ldx #8 -?loop: - lda L0710_audf1s,x - sta audf1,x - sta audf12,x - dex - bpl ?loop - rts - -findsongbegin: - sta songno - - ldx #0 -?find: - stx track1pos - stx track2pos - stx track3pos - lda #0 - sta pat1pos - sta pat2pos - sta pat3pos - sta note1dur - sta note2dur - sta note3dur - sta pat1delay - sta pat2delay - sta pat3delay - txa - ldy #2 - ldx #4 -?calc: - jsr ?calcsongad - dey - dex - dex - bpl ?calc -?loop: - ldx #4 -?chk: - jsr ?chksongend - dex - dex - bpl ?chk - - lda #$ff - cmp track1pos - beq ?end - cmp track2pos - beq ?end - cmp track3pos - beq ?end - - lda #$fe - ldy #0 - cmp (track1ad),y - beq ?end - cmp (track2ad),y - beq ?end - cmp (track3ad),y - beq ?end - lda (track1ad),y - and (track2ad),y - and (track3ad),y - cmp #$ff - bne ?loop - -?end: - ldx #4 -?corr: - jsr ?corrpos - dex - dex - bpl ?corr - ldx track1pos - cpx track2pos - scs - ldx track2pos - cpx track3pos - scs - ldx track3pos - inx - - dec songno - bne ?find - txa - rts - -?corrpos: - lda patpos,x - seq - inc trackpos,x - rts - -?chksongend: - lda (trackad,x) - cmp #$fe - bcs ?ret - lda trackpos,x - cmp #$ff - beq ?ret - - lda patdelay,x - bne ?decdelay - - lda (trackad,x) - cmp #$40 - bcc ?pattern - sne - jsr ?incpos ;ommit AUDCTL - jsr ?incpos - jmp ?chksongend - -?decdelay: - dec patdelay,x -?ret: - rts - -?incpos: - inc trackad,x - sne - inc trackad+1,x - ldy trackpos,x - iny - seq - inc trackpos,x - rts - -?pattern: - tay - lda L0722_lpatternad,y - sta patad - lda L0782_hpatternad,y - sta patad+1 -?next: - ldy patpos,x - inc patpos,x - lda (patad),y - cmp #$40 - bcc ?note - cmp #$60 - bcc ?duration - cmp #$ff - bcc ?next - - lda #0 - sta patdelay,x - sta notedur,x - sta patpos,x - jsr ?incpos - jmp ?chksongend - -?note: - lda notedur,x - sta patdelay,x - rts - -?duration: - and #$1f - sta notedur,x - jmp ?next - -?calcsongad: - pha - clc - adc L0802_ltrackad,y - sta trackad,x - lda #0 - adc L0805_htrackad,y - sta trackad+1,x - pla - rts - -; Initialize of FC player -fc_init: - stx dataad - sty dataad+1 - pha - - ;calculate note durations table - ldy #2 - lda (dataad),y ;TODO: change to primitive tempocntr - ldx #0 -?fctempoloop: - sta L07E2_delaytab,x - clc - adc (dataad),y - inx - cpx #$20 - bcc ?fctempoloop - - ;update track addresses - lda dataad - ldx dataad+1 - clc - adc #3 - scc - inx - sta L0802_ltrackad - stx L0805_htrackad - inx - sta L0802_ltrackad+1 - stx L0805_htrackad+1 - inx - sta L0802_ltrackad+2 - stx L0805_htrackad+2 - - ;update instruments table address - inx - sta instrad - stx instrad+1 - - ;update patterns address - clc - adc #$20*4 - scc - inx - sta dataad - stx dataad+1 - - ldx #0 - ldy #0 -?fcpatternsloop: - lda dataad - sta L0722_lpatternad,y - lda dataad+1 - sta L0782_hpatternad,y -?fcpatternendloop: - lda (dataad,x) - inc dataad - sne - inc dataad+1 - cmp #$ff - bne ?fcpatternendloop - iny - cpy #$40 - bcc ?fcpatternsloop - - ;update instruments envelope address - ldx #0 -?fcinstrenvelopesloop: - lda dataad - sta L0762_linstrenvad,x - lda dataad+1 - sta L07C2_hinstrenvad,x - ldy #0 -?fcinstrenvendloop: - lda (dataad),y - iny - cmp #$ff - bne ?fcinstrenvendloop - tya - clc - adc dataad - sta dataad - scc - inc dataad+1 - inx - cpx #$20 - bcc ?fcinstrenvelopesloop - - pla - -?fcinitmus: - seq - jsr findsongbegin - sta L0400_beginmusic - -?fcreset: - lda #$40 - sta L070E_playerstate -; jmp fc_player - -; Playing FC -fc_play: - ;jmp fc_player - -fc_player: -; jsr L0410 -; ldx #$08 -;L0406: lda L0710_audf1s,x -; sta audf1,x -; dex -; bpl L0406 -; rts - -L0410: bit L070E_playerstate - bmi L043C - bvc L044C - lda #$00 - ldx #$0B -L041B: sta L06E1_patternpos,x - dex - bpl L041B - sta L070E_playerstate - ldx #$02 -L0426: lda #$08 - sta L070B_transp,x - lda L0400_beginmusic - sta L06DE_trackpos,x - dex - bpl L0426 - lda #$50 - sta L0718_audctls - jmp L044C - -; Music restart -L043C: lda #$00 - ldx #$07 -L0440: sta L0710_audf1s,x - dex - bpl L0440 - lda #$80 - sta L070E_playerstate - rts - -L044C: inc L070F_evenframe - ldx #$02 -L0451: stx $1E ;# number - inx - txa - asl @ - tay - sty $1F ;# offset (++<<) - dex - lda L0802_ltrackad,x - sta $1C - lda L0805_htrackad,x - sta $1D - lda L06E4_delaycntr,x - beq L046C - jmp L0554 -L046C: ldy L06DE_trackpos,x - lda ($1C),y - cmp #$40 - beq L0483 - cmp #$FF - beq L0491 - cmp #$FE - bne L04AA - sta L070E_playerstate - jmp L062F - -L0483: iny - lda ($1C),y - sta L0718_audctls - iny - tya - sta L06DE_trackpos,x - jmp L046C - -L0491: lda L0400_beginmusic - sta L06DE_trackpos,x - lda #$50 - sta L0718_audctls - lda #$00 - sta L06E4_delaycntr,x - sta L06E7_delay,x - sta L06E1_patternpos,x - jmp L046C - -L04AA: pha - and #$80 - beq L04BA - inc L06DE_trackpos,x - pla - and #$0F - sta L070B_transp,x - bpl L046C - -L04BA: pla - tay - lda L0722_lpatternad,y - sta $1C - lda L0782_hpatternad,y - sta $1D - lda L06E7_delay,x - sta L06E4_delaycntr,x - lda #$00 - sta L0702_slidedir,x - -L04D1: ldy L06E1_patternpos,x - lda ($1C),y - bmi L04DF - asl @ - bmi L0500 - lsr @ - jmp L0515 - -L04DF: asl @ - asl @ - tay - - ;modified by mono for play .FC file directly - lda (instrad),y - sta L06ED_instrenvno,x - iny - lda (instrad),y - sta L06F3_distort,x - iny - lda (instrad),y - sta L06F6_vibrato,x - iny - lda (instrad),y - sta L06F9_effect,x - ;lda L0808_instrdef,y - ;sta L06ED_instrenvno,x - ;lda L0808_instrdef+1,y - ;sta L06F3_distort,x - ;lda L0808_instrdef+2,y - ;sta L06F6_vibrato,x - ;lda L0808_instrdef+3,y - ;sta L06F9_effect,x - inc L06E1_patternpos,x - jmp L04D1 - -L0500: lsr @ - and #$1F - tax - lda L07E2_delaytab,x - ldx $1E - sta L06E4_delaycntr,x - sta L06E7_delay,x - inc L06E1_patternpos,x - jmp L04D1 - -L0515: sta L06FF_note,x - clc - adc L070B_transp,x - tay - cpx #$00 - bne L0530 - lda L0656_lfreqtab,y - sta L0710_audf1s - lda L0696_hfreqtab,y - sta L0712_audf2s - jmp L053B -L0530: lda L0628_freqtab,y - sta L06EA_freq,x - ldy $1F - sta L0710_audf1s,y -L053B: lda #$00 - sta L06F0_instrenvpos,x - inc L06E1_patternpos,x - - ldy L06E1_patternpos,x - lda ($1C),y - cmp #$FF - bne L0554 - lda #$00 - sta L06E1_patternpos,x - inc L06DE_trackpos,x - -L0554: lda L06ED_instrenvno,x - tay - lda L0762_linstrenvad,y - sta L056A - lda L07C2_hinstrenvad,y - sta L056B - ldx $1E - ldy L06F0_instrenvpos,x -L056A = * + 1 -L056B = * + 2 - lda $FFFF,y ;get envelope - cmp #$FF - beq L0597 - bpl L0582 - ldy $1F - sta L0711_audc1s,y - lda #$00 - sta L0710_audf1s,y - inc L06F0_instrenvpos,x - jmp L05F8 - -L0582: ldy $1F - inc L06F0_instrenvpos,x - ora L06F3_distort,x - sta L0711_audc1s,y - cpx #$00 - beq L0597 - lda L06EA_freq,x - sta L0710_audf1s,y - -L0597: lda L06F6_vibrato,x - beq L05BF - lda L070F_evenframe - and #$01 - bne L05A8 - lda L06F6_vibrato,x - bne L05AA -L05A8: lda #$00 -L05AA: sta L05B2 - clc - lda L06FF_note,x -L05B2 = * + 1 - adc #$02 - adc L070B_transp,x - tay - lda L0628_freqtab,y - ldy $1F - sta L0710_audf1s,y - -L05BF: lda L06F9_effect,x - beq L05F8 - bmi L05E6 -L05C6: ldy L06FC_finevibrpos,x - inc L06FC_finevibrpos,x - lda L0719_finevibrenv,y - cmp #$1F - bne L05DA - lda #$00 - sta L06FC_finevibrpos,x - beq L05C6 -L05DA: clc - adc L06EA_freq,x - ldy $1F - sta L0710_audf1s,y - jmp L05F8 -L05E6: lda L06EA_freq,x - cmp #$FF - beq L05F8 - inc L06EA_freq,x - inc L06EA_freq,x - ldy $1F - sta L0710_audf1s,y - -L05F8: lda L0702_slidedir,x - beq L0626 - lda L0705_slidedelay,x - beq L0608 - dec L0705_slidedelay,x - jmp L0626 -L0608: lda L0702_slidedir,x - bpl L0617 - clc - lda L06EA_freq,x - adc L0708_slidestep,x - jmp L061E -L0617: sec - lda L06EA_freq,x - sbc L0708_slidestep,x -L061E: sta L06EA_freq,x - ldy $1F - sta L0710_audf1s,y - -L0626: -L0628_freqtab = * + 2 - dec L06E4_delaycntr,x - dex - bmi L062F - jmp L0451 -L062F: rts - -;Freq tables (1ch) ;adres tablicy jest cofniety o 8, bo jest transpozycja 8 by default!!!!!!!!! - .db $FF,$F1,$E4,$D7,$CB,$C0,$B5,$AA - .db $A1,$98,$8F,$87,$7F,$78,$72,$6B - .db $65,$5F,$5A,$55,$50,$4B,$47,$43 - .db $3F,$3C,$38,$35,$32,$2F,$2C,$2A - .db $27,$25,$23,$21,$1F,$1D -L0656_lfreqtab: .db $1C,$1A,$17,$16,$13,$0F,$07,$00 -;Lo freq table - .db $38,$8C,$00,$6A,$E8,$6A,$EF,$80 - .db $08,$AE,$46,$E6,$95,$41,$F6,$B0 - .db $6E,$30,$F6,$BB,$84,$52,$22,$F4 - .db $C8,$A0,$7A,$55,$34,$14,$F5,$D8 - .db $BD,$A4,$8D,$77,$60,$4E,$38,$27 - .db $15,$06,$F7,$E8,$DB,$CF,$C3,$B8 - .db $AC,$A2,$9A,$90,$88,$7F,$78,$70 -L0696_hfreqtab: .db $6A,$64,$5E,$57,$52,$32,$0A,$00 -;Hi freq table - .db $0B,$0A,$0A,$09,$08,$08,$07,$07 - .db $07,$06,$06,$05,$05,$05,$04,$04 - .db $04,$04,$03,$03,$03,$03,$03,$02 - .db $02,$02,$02,$02,$02,$02,$01,$01 - .db $01,$01,$01,$01,$01,$01,$01,$01 - .db $01,$01,$00,$00,$00,$00,$00,$00 - .db $00,$00,$00,$00,$00,$00,$00,$00 - .db $00,$00,$00,$00,$00,$00,$00,$00 - -L06DE_trackpos: .db $00,$00,$00 -L06E1_patternpos: .db $00,$00,$00 -L06E4_delaycntr: .db $00,$00,$00 -L06E7_delay: .db $00,$00,$00 -L06EA_freq: .db $00,$00,$00 -L06ED_instrenvno: .db $00,$00,$00 -L06F0_instrenvpos: .db $00,$00,$00 -L06F3_distort: .db $00,$00,$00 -L06F6_vibrato: .db $00,$00,$00 -L06F9_effect: .db $00,$00,$00 -L06FC_finevibrpos: .db $00,$00,$00 -L06FF_note: .db $00,$00,$00 -L0702_slidedir: .db $00,$00,$00 -L0705_slidedelay: .db $00,$00,$00 -L0708_slidestep: .db $00,$00,$00 -L070B_transp: .db $00,$00,$00 -L070E_playerstate: .db $00 -L070F_evenframe: .db $00 -; POKEY shadow registers -L0710_audf1s: .db $00 -L0711_audc1s: .db $00 -L0712_audf2s: .db $00,$00,$00,$00,$00,$00 -L0718_audctls: .db $50 - -L0719_finevibrenv: .db $00,$00,$01,$01,$00,$00,$FF,$FF,$1F - -L0400_beginmusic: .ds 1 - -; part of compiled music adapted to universal player - -;Lo patterns addr -L0722_lpatternad: .ds 64 -;Lo instr addr -L0762_linstrenvad: .ds 32 -;Hi patterns addr -L0782_hpatternad: .ds 64 -;Hi instr addr -L07C2_hinstrenvad: .ds 32 -;Note duration (calculated based on tempo) -L07E2_delaytab: .ds 32 - -;Lo track addr -L0802_ltrackad: .ds 3 -;Hi track addr -L0805_htrackad: .ds 3 - - ert * >= 0xa00 - - end - Binary files /tmp/tmpyaM5l1/AUpGL9bywb/kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/fc.obx and /tmp/tmpyaM5l1/KBGCC02aAO/kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/fc.obx differ diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/fp3depk.asx kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/fp3depk.asx --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/fp3depk.asx 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/fp3depk.asx 1970-01-01 00:00:00.000000000 +0000 @@ -1,64 +0,0 @@ -outerFlags equ $fc -innerFlags equ $fd -outPtr equ $fe - - org $8000 -getByte - lda $aaaa - inw getByte+1 - rts -exit - jmp $aaaa -copyTwoOrThree - sta outPtr - txa ; lda #1 - rol @ -copyMany - tax - beq exit -copy - lda (outPtr),y -putByte - sta $8080,y - iny - bne samePage - tya ; lda #0 - sec - adc outPtr+1 -setPage - sta outPtr+1 - sta putByte+2 -samePage - dex - bne copy - - asl innerFlags - bne gotInnerFlags - asl outerFlags - bne gotOuterFlags - -start - sec - jsr getByte - rol @ - sta outerFlags -gotOuterFlags - lda #1 - bcc setInnerFlags - jsr getByte - rol @ -setInnerFlags - sta innerFlags -gotInnerFlags - jsr getByte - ldx #1 - bcc putByte - lsr @ - bne copyTwoOrThree - jsr getByte - bcs copyMany - tay - jsr getByte - bcc setPage ; jmp - - end diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/mpt.asx kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/mpt.asx --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/mpt.asx 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/mpt.asx 1970-01-01 00:00:00.000000000 +0000 @@ -1,904 +0,0 @@ -*----------------* -* Player MPT 2.4 * -* ver.spackowana * -*----------------* - - org $0500 - -*--- strona 0 - -addr equ $ec ,$ed -word equ $ee ,$ef -audzer equ $f0 ,$f1 ,$f2 ,$f3 -licslp equ $f4 ,$f5 ,$f6 ,$f7 -lensmp equ $f8 -lsbmsb equ $f9 -adrs1 equ $fa ,$fb -adrs2 equ $fc ,$fd -adrsmp equ $fe ,$ff - -*--- program - - jmp init - -play lda czygrc - bne *+3 - rts - lda #0 - sta oraaud - inc licz - lda pozptr - cmp maxptr - bcc r1 - dec zegar - beq p1 - jmp r5 -p1 ldx #0 - stx pozptr -p2 lda #0 - sta ptrwsk,x - sta licspc,x - lda adrtrl,x - sta addr - lda adrtrh,x - sta addr+1 - ldy pozsng -p3 lda (addr),y - iny - cmp #$ff - beq p5 - cmp #$fe - bne p6 -p4 jmp inic2 -p5 lda (addr),y - bmi p4 - asl @ - tay - sty pozsng - jmp p3 -p6 sta numptr,x - lda (addr),y - sta poddzw,x -p7 inx - cpx #4 - bne p2 - iny - sty pozsng - jmp r5 -r1 dec zegar - bpl r5 - lda tempo - sta zegar - ldx #3 -r2 dec licspc,x - bpl r4 - lda numptr,x - asl @ - tay -aptrlz lda $ffff,y - sta addr - iny -aptrhz lda $ffff,y - sta addr+1 - ora addr - beq r4 - lda ptrwsk,x - sta licptr - jsr newdzw - ldy licptr - iny - tya - sta ptrwsk,x - lda ilespc,x - sta licspc,x - cpx #2 - bne r4 - lda adcvol,x - eor #$f - asl @ - asl @ - asl @ - asl @ - adc volstb - adc #0 - sta volsmp+2 -r4 dex - bpl r2 - inc pozptr -r5 ldx #1 - lda typsmp - cmp #2 - beq r6 - ldx #3 -r6 lda typsmp - cmp #2 - bne r7 - cpx kansmp - beq r8 -r7 jmp dzwiek -r8 lda audzer,x - and filtry,x - beq r9 - ldy #$28 - lda (addr),y - clc - adc numdzw,x - jsr czest - sec - adc p1pom,x - sta freq+2,x -r9 dex - bpl r6 - lda #3 - sta $d20f - lda audzer+1 - and #$10 - beq w1 - ldy numdzw+1 - lda bsfrql,y - sta freq - lda bsfrqh,y - sta freq+1 -w1 lda freq - sta $d200 - lda freq+1 - sta $d202 - lda freq+2 - sta $d204 - lda freq+3 - sta $d206 - lda volume - ldx #$ff - ldy typsmp - cpy #1 - bne w2 - ldx kansmp - beq w3 -w2 sta $d201 -w3 lda volume+1 - cpx #1 - beq w4 - sta $d203 -w4 cpy #2 - beq w6 - lda volume+2 - cpx #2 - beq w5 - sta $d205 -w5 lda volume+3 - cpx #3 - beq w6 - sta $d207 -w6 lda audzer - ora audzer+1 - ora audzer+2 - ora audzer+3 - ora oraaud - sta $d208 - rts -filtry dta b(4),b(2),b(0),b(0) - -dzwiek lda adrinl,x - sta addr - lda adrinh,x - sta addr+1 - ora addr - bne d0 - sta volume,x - sta audzer,x - jmp r9 -d0 ldy licslp,x - cpy #$20 - beq d3 - lda (addr),y - sec - sbc adcvol,x - bit sprvol - beq d1 - and #$f0 -d1 sta volume,x - iny - lda (addr),y - sta przech - iny - sty licslp,x - and #7 - beq d4 - tay - lda akcadl-1,y - sta akjmpz+1 - lda akcadh-1,y - sta akjmpz+2 - lda przech - lsr @ - lsr @ - lsr @ - lsr @ - lsr @ - ora #$28 - tay - lda (addr),y - clc -akjmpz jsr $ffff -d2 lda #0 - sta audzer,x - jmp r9 -d3 lda p3max,x - beq d4 - dec p3lic,x - bne d4 - sta p3lic,x - lda volume,x - and #15 - beq d4 - dec volume,x -d4 ldy #$23 - lda (addr),y - sta audzer,x - lda trnlic,x - clc - adc #$25 - tay - and #3 - sta trnlic,x - dey - lda (addr),y - adc adcdzw,x - sta numdzw,x - jsr czest+2 - sta freq,x - lda p2lic,x - beq d5 - dec p2lic,x - jmp r8 -d5 lda branch,x - sta p1jmpz+1 -p1jmpz bpl * - jmp typ0dz - brk - jmp typ1dz - brk - jmp typ2dz - brk - jmp typ3dz -czygrc dta b(0) - jmp typ4dz -zapisx dta b(0) - jmp typ5dz -zapisy dta b(0) - jmp typ6dz -sprvol dta b($10) - jmp typ7dz - -newdzw lda #0 - sta adcvol,x - ldy licptr - dey -new iny - lda (addr),y - cmp #$fe - bne q0 - sty licptr - rts -q0 cmp #$e0 - bcc q1 - lda maxptr - sta pozptr - bne new -q1 cmp #$d0 - bcc q2 - and #15 - sta tempo - sta zegar - bpl new -q2 cmp #$c0 - bcc q3 - and #15 - eor #15 - sta adcvol,x - bpl new -q3 cmp #$80 - bcc q4 - and #$3f - sta ilespc,x - bpl new -q4 cmp #$40 - bcc q5 - iny - sty licptr - and #$1f - sta numsmp,x - asl @ - tay -ainslz lda $ffff,y - sta adrinl,x - iny -ainshz lda $ffff,y - sta adrinh,x - jmp newdzw - -q5 sty licptr - sta przech - clc - adc poddzw,x - sta adcdzw,x - lda typsmp - beq n9 - cmp #2 - beq n8 - lda numsmp,x - cmp #$1f - bne n9 - lda przech - sec - sbc #1 -n6 and #15 - tay - lda (adrsmp),y - sta adrs2+1 - tya - ora #$10 - tay - lda (adrsmp),y - sta lensmp - ldy #1 - ora adrs2+1 - bne n7 - ldy #0 -n7 sty czysmp - lda #0 - sta adrs2 - sta adrinl,x - sta adrinh,x - txa - asl @ - sta wsksmp - stx kansmp - rts -n8 cpx #2 - bcs nb -n9 lda adrinl,x - sta word - lda adrinh,x - sta word+1 - ora word - beq na-1 - ldy #$20 - lda (word),y - and #15 - sta p1lsb,x - lda (word),y - and #$70 - lsr @ - lsr @ - sta branch,x - iny - lda (word),y - asl @ - asl @ - pha - and #$3f - sta p2lic,x - pla - and #$c0 - sta frqwsk,x - iny - lda (word),y - sta p3max,x - sta p3lic,x - lda #0 - sta licslp,x - sta trnlic,x - sta p1lic,x - sta p1pom,x - lda adcdzw,x - sta numdzw,x - jsr czest - sta freq,x - cpx kansmp - beq na - rts -na ldy #$ff - sty kansmp - iny - sty czysmp - rts -nb cpx #2 - bne nd - ldy adcdzw+2 - lda frsmpl,y - sta smpl1z+1 - lda frsmph,y - sta smpl2z+1 - lda #0 - sta lsbmsb - sta adrs1 - lda numsmp+2 - and #15 - tay - lda (adrsmp),y - sta adrs1+1 - tya - ora #$10 - tay - lda (adrsmp),y - sta smpl3z+1 - ora adrs1+1 - bne nc - sta smpl1z+1 - sta smpl2z+1 -nc rts -nd lda numsmp+3 - and #15 - tay - lda (adrsmp),y - sta adrs2+1 - tya - ora #$10 - tay - lda (adrsmp),y - ora adrs2+1 - beq ne - lda (adrsmp),y - sec - sbc adrs2+1 - sta lensmp - lda #0 - sta adrs2 - lda #$8d - bne nf -ne lda #$ad -nf sta drum2z - sta drum1z - lda #$18 - sta $d207 - rts - -typ0dz lda licz - and #7 - lsr @ - lsr @ - bcc t2 - bne typ1dz - lda p1lsb,x -t1 clc - sta p1pom,x - adc freq,x - sta freq,x - jmp r8 -t2 lda #0 - sta p1pom,x - jmp r8 -typ1dz lda freq,x - sec - sbc p1lsb,x - sta freq,x - sec - lda #0 - sbc p1lsb,x - sta p1pom,x - jmp r8 -typ2dz lda p1lic,x - clc - sta p1pom,x - adc freq,x -t3 sta freq,x - clc - lda p1lic,x - adc p1lsb,x - sta p1lic,x - jmp r8 -typ3dz lda numdzw,x - sec - sbc p1lic,x -t4 sta numdzw,x - jsr czest - jmp t3 -typ4dz lda #0 - sec - sbc p1lic,x - sta p1pom,x - lda freq,x - sec - sbc p1lic,x - jmp t3 -typ5dz lda numdzw,x - clc - adc p1lic,x - jmp t4 -typ6dz jsr t5 - jmp t1 -typ7dz jsr t5 - clc - adc numdzw,x - jsr a3 - jmp r8 -t5 ldy p1lic,x - lda p1lsb,x - bmi t6 - iny - iny -t6 dey - tya - sta p1lic,x - cmp p1lsb,x - bne t7 - lda p1lsb,x - eor #$ff - sta p1lsb,x -t7 lda p1lic,x - rts -czest and #$3f - ora frqwsk,x - tay -t1frqz lda $ffff,y - rts - -akcadl dta l(a1),l(a0),l(a2) - dta l(a4),l(a5),l(a6),l(a8) -akcadh dta h(a1),h(a0),h(a2) - dta h(a4),h(a5),h(a6),h(a8) -audora dta b($40),b(0),b($20),b(0) - -a0 adc freq,x -a1 sta freq,x - rts -a2 adc adcdzw,x -a3 sta numdzw,x - jsr czest - sta freq,x - rts -a4 sta freq,x - lda audora,x - bpl a7 -a5 sta freq,x - lda #$80 - bne a7 -a6 sta freq,x - lda #1 -a7 ora oraaud - sta oraaud - rts -a8 and $d20a - sta freq,x -a9 rts - -bsfrql equ *-1 - dta b($f2),b($33),b($96) - dta b($e2),b($38),b($8c),b(0) - dta b($6a),b($e8),b($6a),b($ef) - dta b($80),b(8),b($ae),b($46) - dta b($e6),b($95),b($41),b($f6) - dta b($b0),b($6e),b($30),b($f6) - dta b($bb),b($84),b($52),b($22) - dta b($f4),b($c8),b($a0),b($7a) - dta b($55),b($34),b($14),b($f5) - dta b($d8),b($bd),b($a4),b($8d) - dta b($77),b($60),b($4e),b($38) - dta b($27),b($15),b(6),b($f7) - dta b($e8),b($db),b($cf),b($c3) - dta b($b8),b($ac),b($a2),b($9a) - dta b($90),b($88),b($7f),b($78) - dta b($70),b($6a),b($64),b($5e) - -bsfrqh equ *-1 - dta b(13,13,12,11,11,10,10,9,8,8,7,7,7,6,6) - dta b(5,5,5,4,4,4,4,3,3,3,3,3,2,2,2,2) - dta b(2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,0) - dta b(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) - -volstb dta d'8888888888888888' - dta d'667777888889999:' - dta d'556667788899:::;' - dta d'455667788899::;;' - dta d'44556677899::;;<' - dta d'34456677899::;<<' - dta d'33455677899:;;<=' - dta d'23445677899:;<<=' - dta d'2334566789::;<==' - dta d'2234566789::;<=>' - dta d'1234566789::;<=>' - dta d'1234556789:;;<=>' - dta d'1234456789:;<<=>' - dta d'1233456789:;<==>' - dta d'1223456789:;<=>>' - dta d'0123456789:;<=>?' - -frsmpl dta b($20),b($22),b($24),b($26),b($29) - dta b($2b),b($2e),b($30),b($33),b($37) - dta b($3a),b($3d),b($41),b($45),b($49) - dta b($4d),b($52),b($57),b($5c),b($61) - dta b($67),b($6e),b($74),b($7b),b($82) - dta b($8a),b($92),b($9b),b($a4),b($ae) - dta b($b8),b($c3),b($cf),b($dc),b($e9) - dta b($f6),b(5),b($15),b($25),b($37) - dta b($49),b($5d),b($71),b($87),b($9f) - dta b($b8),b($d2),b($ed),b($b),b($2a) - dta b($4b),b($6e),b($93),b($ba),b($e3) - dta b($f),b($3e),b($70),b($a4),b($db) - -frsmph dta d' ' - dta d' ' - dta d' !!!!!!!!!' - dta d'!!!"""""""#####' - -*--- inicjacja - -iniadl dta l(inic0),l(inic2) - dta l(inic4),l(inic5) - dta l(inic6),l(inic7) - dta l(inic8),l(inic9) -iniadh dta h(inic0),h(inic2) - dta h(inic4),h(inic5) - dta h(inic6),h(inic7) - dta h(inic8),h(inic9) - -init stx zapisx - sty zapisy - and #7 - tay - lda iniadl,y - sta inic1+1 - lda iniadh,y - sta inic1+2 -inic1 jmp $ffff - -inic0 lda zapisy - ldx zapisx - sta ainslz+1 - sta ainshz+1 - stx ainslz+2 - stx ainshz+2 - clc - adc #$40 - sta aptrlz+1 - sta aptrhz+1 - bcc i2 - inx -i2 stx aptrlz+2 - stx aptrhz+2 - clc - adc #$80 - sta t1frqz+1 - bcc i4 - inx -i4 stx t1frqz+2 - inx - sta j4+1 - stx j4+2 - ldx #9 -j4 lda $ffff,x - sta adrtrl,x - dex - bpl j4 - dec tempo - -inic2 lda #0 - sta czygrc - ldx ressmp+1 - sta adrs1+1 - lda #$ad - sta drum2z - sta drum1z - ldy #0 - sty smpl1z+1 - sty smpl2z+1 -k2 ldx $d40b - lda (adrs2),y - lsr @ - lsr @ - lsr @ - lsr @ - ora #$10 -drum1z sta $d207 - jsr k6 -k3 cpx $d40b - beq k3 - sta $d205 - ldx $d40b - lda (adrs2),y - inc adrs2 - bne k4 - inc adrs2+1 - dec lensmp - bne k4 - lda #$ad - sta drum2z - sta drum1z - lda #8 -k4 ora #$10 -drum2z sta $d207 - jsr k6 -k5 cpx $d40b - beq k5 - sta $d205 - lda typsmp - bne k2 - rts - -k6 clc - lda lsbmsb -smpl1z adc #0 - sta lsbmsb - lda adrs1 -smpl2z adc #0 - sta adrs1 - bcc k7 - inc adrs1+1 - lda adrs1+1 -smpl3z cmp #0 - bne k7 - sty smpl1z+1 - sty smpl2z+1 - rts -k7 lda (adrs1),y - bit lsbmsb - bmi k8 - lsr @ - lsr @ - lsr @ - lsr @ -k8 and #15 - tay -volsmp lda volstb,y - ldy #0 - rts - -inic9 ldy #0 - sty typsmp - sty czysmp - dey - sty kansmp - rts - -*--- zmienne - -adrtrl org *+4 -adrtrh org *+4 -maxptr org *+1 -tempo org *+1 - -branch org *+4 -volume org *+4 -adcvol org *+4 -freq org *+4 -frqwsk org *+4 -adcdzw org *+4 -poddzw org *+4 -adrinl org *+4 -adrinh org *+4 -numdzw org *+4 -numsmp org *+4 -numptr org *+4 -ptrwsk org *+4 -ilespc org *+4 -licspc org *+4 -p1lsb org *+4 -p1lic org *+4 -p1pom org *+4 -p2lic org *+4 -p3max org *+4 -p3lic org *+4 -trnlic org *+4 -zegar org *+1 -pozsng org *+1 -pozptr org *+1 -wsksmp org *+1 -kansmp org *+1 -czysmp org *+1 -typsmp org *+1 -oraaud org *+1 -licz org *+1 -przech org *+1 -licptr org *+1 - - end Binary files /tmp/tmpyaM5l1/AUpGL9bywb/kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/mpt.obx and /tmp/tmpyaM5l1/KBGCC02aAO/kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/mpt.obx differ diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/os.asx kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/os.asx --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/os.asx 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/os.asx 1970-01-01 00:00:00.000000000 +0000 @@ -1,55 +0,0 @@ - org $c000 -nmi - bit $d40f - bpl nmi_vbl - jmp ($200) -nmi_vbl - cld - pha - txa:pha - tya:pha - sta $d40f - jmp ($222) - -vbl - inc 20 - bne vbl_1 - inc 19 - bne vbl_1 - inc 18 -vbl_1 - jmp ($224) - -vbld - pla:tay - pla:tax - pla:rti - -irq - cld - jmp ($216) - -setvbv - asl @ - sta $22d - txa - ldx #5 - sta $d40a - dex:rne - ldx $22d - sta $217,x - tya:sta $216,x - rts - -reset - mwa #vbl $222 - mwa #vbld $224 - rts - - org $e45c - jmp setvbv - jmp vbl - jmp vbld - - org $fffa - dta a(nmi,reset,irq) Binary files /tmp/tmpyaM5l1/AUpGL9bywb/kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/rmt4.obx and /tmp/tmpyaM5l1/KBGCC02aAO/kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/rmt4.obx differ Binary files /tmp/tmpyaM5l1/AUpGL9bywb/kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/rmt8.obx and /tmp/tmpyaM5l1/KBGCC02aAO/kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/rmt8.obx differ diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/rmt.asx kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/rmt.asx --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/rmt.asx 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/rmt.asx 1970-01-01 00:00:00.000000000 +0000 @@ -1,1326 +0,0 @@ -;* -;* Raster Music Tracker, RMT Atari routine version 1.20051226 -;* (c) Radek Sterba, Raster/C.P.U., 2002 - 2005 -;* http://raster.atari.org -;* -;* Warnings: -;* -;* 1. RMT player routine needs 19 itself reserved bytes in zero page (no accessed -;* from any other routines) as well as cca 1KB of memory before the "PLAYER" -;* address for frequency tables and functionary variables. It's: -;* a) from PLAYER-$400 to PLAYER for stereo RMTplayer -;* b) from PLAYER-$380 to PLAYER for mono RMTplayer -;* -;* 2. RMT player routine MUST (!!!) be compiled from the begin of the memory page. -;* i.e. "PLAYER" address can be $..00 only! -;* -;* 3. Because of RMTplayer provides a lot of effects, it spent a lot of CPU time. -;* -;* STEREOMODE equ 0 ;0 => compile RMTplayer for 4 tracks mono -;* ;1 => compile RMTplayer for 8 tracks stereo -;* ;2 => compile RMTplayer for 4 tracks stereo L1 R2 R3 L4 -;* ;3 => compile RMTplayer for 4 tracks stereo L1 L2 R3 R4 -;* -PLAYER equ $0600 -;* - IFT STEREOMODE==1 -TRACKS equ 8 - ELS -TRACKS equ 4 - EIF -;* -;* RMT FEATures definitions -;* For optimizations of RMT player routine to concrete RMT modul only! -;* --------BEGIN-------- -FEAT_INSTRSPEED equ 0 ;* cca 21 or 5 bytes -FEAT_CONSTANTSPEED equ 0 ;* cca 28 bytes -;* VARIOUS COMMANDS -FEAT_COMMAND1 equ 1 ;* cca 8 bytes -FEAT_COMMAND2 equ 1 ;* cca 20 bytes (+save 1 address in zero page) and quicker whole RMT routine -FEAT_COMMAND3 equ 1 ;* cca 12 bytes -FEAT_COMMAND4 equ 1 ;* cca 15 bytes -FEAT_COMMAND5 equ 1 ;* cca 67 bytes -FEAT_COMMAND6 equ 1 ;* cca 15 bytes -;* COMMAND7 SETNOTE (i.e. command 7 with parameter != $80) -FEAT_COMMAND7SETNOTE equ 1 ;* cca 12 bytes -;* COMMAND7 VOLUMEONLY (i.e. command 7 with parameter == $80) -FEAT_COMMAND7VOLUMEONLY equ 1 ;* cca 74 bytes -;* PORTAMENTO -FEAT_PORTAMENTO equ 1 ;* cca 138 bytes and quicker whole RMT routine -;* FILTER -FEAT_FILTER equ 1 ;* cca 179 bytes and quicker whole RMT routine -FEAT_FILTERG0L equ 1 ;* (cca 38 bytes for each) -FEAT_FILTERG1L equ 1 -FEAT_FILTERG0R equ 1 -FEAT_FILTERG1R equ 1 -;* BASS16B (i.e. distortion value 6) -FEAT_BASS16 equ 1 ;* cca 194 bytes +128bytes freq table and quicker whole RMT routine -FEAT_BASS16G1L equ 1 ;* (cca 47 bytes for each) -FEAT_BASS16G3L equ 1 -FEAT_BASS16G1R equ 1 -FEAT_BASS16G3R equ 1 -;* VOLUME ONLY for particular generators -FEAT_VOLUMEONLYG0L equ 1 ;* (cca 7 bytes for each) -FEAT_VOLUMEONLYG2L equ 1 -FEAT_VOLUMEONLYG3L equ 1 -FEAT_VOLUMEONLYG0R equ 1 -FEAT_VOLUMEONLYG2R equ 1 -FEAT_VOLUMEONLYG3R equ 1 -;* TABLE TYPE (i.e. TABLETYPE=1) -FEAT_TABLETYPE equ 1 ;* cca 53 bytes and quicker whole RMT routine -;* TABLE MODE (i.e. TABLEMODE=1) -FEAT_TABLEMODE equ 1 ;* cca 16 bytes and quicker whole RMT routine -;* TABLE GO (i.e. TGO is nonzero value) -FEAT_TABLEGO equ 1 ;* cca 6 bytes and quicker whole RMT routine -;* AUDCTLMANUALSET (i.e. any MANUAL AUDCTL setting is nonzero value) -FEAT_AUDCTLMANUALSET equ 1 ;* cca 27 bytes and quicker whole RMT routine -;* VOLUME MINIMUM (i.e. VMIN is nonzero value) -FEAT_VOLUMEMIN equ 1 ;* cca 12 bytes and quicker whole RMT routine -;* --------END-------- - -;* -;* RMT ZeroPage addresses - org 203 -p_tis -p_instrstable org *+2 -p_trackslbstable org *+2 -p_trackshbstable org *+2 -p_song org *+2 -ns org *+2 -nr org *+2 -nt org *+2 -reg1 org *+1 -reg2 org *+1 -reg3 org *+1 -tmp org *+1 - IFT FEAT_COMMAND2 -frqaddcmd2 org *+1 - EIF - IFT TRACKS>4 - org PLAYER-$400 - ELS - org PLAYER-$380 - EIF -track_variables -trackn_db org *+TRACKS -trackn_hb org *+TRACKS -trackn_idx org *+TRACKS -trackn_pause org *+TRACKS -trackn_note org *+TRACKS -trackn_volume org *+TRACKS -trackn_distor org *+TRACKS -trackn_shiftfrq org *+TRACKS - IFT FEAT_PORTAMENTO -trackn_portafrqc org *+TRACKS -trackn_portafrqa org *+TRACKS -trackn_portaspeed org *+TRACKS -trackn_portaspeeda org *+TRACKS -trackn_portadepth org *+TRACKS - EIF -trackn_instrx2 org *+TRACKS -trackn_instrdb org *+TRACKS -trackn_instrhb org *+TRACKS -trackn_instridx org *+TRACKS -trackn_instrlen org *+TRACKS -trackn_instrlop org *+TRACKS -trackn_instrreachend org *+TRACKS -trackn_volumeslidedepth org *+TRACKS -trackn_volumeslidevalue org *+TRACKS - IFT FEAT_VOLUMEMIN -trackn_volumemin org *+TRACKS - EIF -trackn_effdelay org *+TRACKS -trackn_effvibratoa org *+TRACKS -trackn_effvibratobeg org *+TRACKS -trackn_effvibratoend org *+TRACKS -trackn_effshift org *+TRACKS -trackn_tabletypespeed org *+TRACKS - IFT FEAT_TABLEMODE -trackn_tablemode org *+TRACKS - EIF -trackn_tablenote org *+TRACKS -trackn_tablea org *+TRACKS -trackn_tableend org *+TRACKS - IFT FEAT_TABLEGO -trackn_tablelop org *+TRACKS - EIF -trackn_tablespeeda org *+TRACKS -trackn_command org *+TRACKS - IFT FEAT_BASS16 -trackn_outnote org *+TRACKS - EIF - IFT FEAT_FILTER -trackn_filter org *+TRACKS - EIF -trackn_audf org *+TRACKS -trackn_audc org *+TRACKS - IFT FEAT_AUDCTLMANUALSET -trackn_audctl org *+TRACKS - EIF - IFT FEAT_CONSTANTSPEED==0 -v_speed org *+1 - EIF -v_aspeed org *+1 - IFT FEAT_INSTRSPEED==0||FEAT_INSTRSPEED>1 -v_ainstrspeed org *+1 - EIF -v_abeat org *+1 -track_endvariables - org PLAYER-$100-$140-$30 -INSTRPAR equ 12 -tabbeganddistor - dta frqtabpure-frqtab,$00 - dta frqtabpure-frqtab,$20 - dta frqtabpure-frqtab,$40 - dta frqtabbass1-frqtab,$c0 - dta frqtabpure-frqtab,$80 - dta frqtabpure-frqtab,$a0 - dta frqtabbass1-frqtab,$c0 - dta frqtabbass2-frqtab,$c0 -vibtabbeg dta 0,vib1-vib0,vib2-vib0,vib3-vib0,vibx-vib0 -vib0 dta 0 -vib1 dta 1,-1,-1,1 -vib2 dta 1,0,-1,-1,0,1 -vib3 dta 1,1,0,-1,-1,-1,-1,0,1,1 -vibx -:PLAYER-$100-$140-* dta 0 -; org PLAYER-$100-$140 - IFT FEAT_BASS16 -frqtabbasslo - dta $F2,$33,$96,$E2,$38,$8C,$00,$6A,$E8,$6A,$EF,$80,$08,$AE,$46,$E6 - dta $95,$41,$F6,$B0,$6E,$30,$F6,$BB,$84,$52,$22,$F4,$C8,$A0,$7A,$55 - dta $34,$14,$F5,$D8,$BD,$A4,$8D,$77,$60,$4E,$38,$27,$15,$06,$F7,$E8 - dta $DB,$CF,$C3,$B8,$AC,$A2,$9A,$90,$88,$7F,$78,$70,$6A,$64,$5E,$00 - EIF - org PLAYER-$100-$100 -frqtab - ERT [255 - ldy #0 - tya -ri0 sta track_variables,y - sta track_endvariables-$100,y - iny - bne ri0 - ELS - ldy #track_endvariables-track_variables - lda #0 -ri0 sta track_variables-1,y - dey - bne ri0 - EIF - ldy #4 - lda (ns),y - sta v_maxtracklen - iny - IFT FEAT_CONSTANTSPEED==0 - lda (ns),y - sta v_speed - EIF - IFT FEAT_INSTRSPEED==0 - iny - lda (ns),y - sta v_instrspeed - sta v_ainstrspeed - ELI FEAT_INSTRSPEED>1 - lda #FEAT_INSTRSPEED - sta v_ainstrspeed - EIF - ldy #8 -ri1 lda (ns),y - sta p_tis-8,y - iny - cpy #8+8 - bne ri1 - pla - pha - IFT TRACKS>4 - asl @ - asl @ - asl @ - clc - adc p_song - sta p_song - pla - php - and #$e0 - asl @ - rol @ - rol @ - rol @ - ELS - asl @ - asl @ - clc - adc p_song - sta p_song - pla - php - and #$c0 - asl @ - rol @ - rol @ - EIF - plp - adc p_song+1 - sta p_song+1 - jsr GetSongLineTrackLineInitOfNewSetInstrumentsOnlyRmtp3 -rmt_silence - IFT STEREOMODE>0 - lda #0 - sta $d208 - sta $d218 - ldy #3 - sty $d20f - sty $d21f - ldy #8 -si1 sta $d200,y - sta $d210,y - dey - bpl si1 - ELS - lda #0 - sta $d208 - ldy #3 - sty $d20f - ldy #8 -si1 sta $d200,y - dey - bpl si1 - EIF - IFT FEAT_INSTRSPEED==0 - lda v_instrspeed - ELS - lda #FEAT_INSTRSPEED - EIF - rts -GetSongLineTrackLineInitOfNewSetInstrumentsOnlyRmtp3 -GetSongLine - ldx #0 - stx v_abeat -nn0 -nn1 txa - tay - lda (p_song),y - cmp #$fe - bcs nn2 - tay - lda (p_trackslbstable),y - sta trackn_db,x - lda (p_trackshbstable),y -nn1a sta trackn_hb,x - lda #0 - sta trackn_idx,x - lda #1 -nn1a2 sta trackn_pause,x - lda #$80 - sta trackn_instrx2,x - inx -xtracks01 cpx #TRACKS - bne nn1 - lda p_song - clc -xtracks02 adc #TRACKS - sta p_song - bcc GetTrackLine - inc p_song+1 -nn1b - jmp GetTrackLine -nn2 - beq nn3 -nn2a - lda #0 - beq nn1a2 -nn3 - ldy #2 - lda (p_song),y - tax - iny - lda (p_song),y - sta p_song+1 - stx p_song - ldx #0 - beq nn0 -GetTrackLine -oo0 -oo0a - IFT FEAT_CONSTANTSPEED==0 - lda v_speed - sta v_bspeed - EIF - ldx #-1 -oo1 - inx - dec trackn_pause,x - bne oo1x -oo1b - lda trackn_db,x - sta ns - lda trackn_hb,x - sta ns+1 -oo1i - ldy trackn_idx,x - inc trackn_idx,x - lda (ns),y - sta reg1 - and #$3f - cmp #61 - beq oo1a - bcs oo2 - sta trackn_note,x - IFT FEAT_BASS16 - sta trackn_outnote,x - EIF - iny - lda (ns),y - lsr @ - and #$3f*2 - sta trackn_instrx2,x -oo1a - lda #1 - sta trackn_pause,x - ldy trackn_idx,x - inc trackn_idx,x - lda (ns),y - lsr @ - ror reg1 - lsr @ - ror reg1 - lda reg1 - and #$f0 - sta trackn_volume,x -oo1x -xtracks03sub1 cpx #TRACKS-1 - bne oo1 - IFT FEAT_CONSTANTSPEED==0 - lda #$ff -v_bspeed equ *-1 - sta v_speed - ELS - lda #FEAT_CONSTANTSPEED - EIF - sta v_aspeed - jmp InitOfNewSetInstrumentsOnly -oo2 - cmp #63 - beq oo63 - lda reg1 - and #$c0 - beq oo62_b - asl @ - rol @ - rol @ - sta trackn_pause,x - jmp oo1x -oo62_b - iny - lda (ns),y - sta trackn_pause,x - inc trackn_idx,x - jmp oo1x -oo63 - lda reg1 - IFT FEAT_CONSTANTSPEED==0 - bmi oo63_1X - iny - lda (ns),y - sta v_bspeed - inc trackn_idx,x - jmp oo1i -oo63_1X - EIF - cmp #255 - beq oo63_11 - iny - lda (ns),y - sta trackn_idx,x - jmp oo1i -oo63_11 - jmp GetSongLine -p2xrmtp3 jmp rmt_p3 -p2x0 dex - bmi p2xrmtp3 -InitOfNewSetInstrumentsOnly -p2x1 ldy trackn_instrx2,x - bmi p2x0 -SetUpInstrumentY2 - lda (p_instrstable),y - sta trackn_instrdb,x - sta nt - iny - lda (p_instrstable),y - sta trackn_instrhb,x - sta nt+1 - IFT FEAT_FILTER - lda #1 - sta trackn_filter,x - EIF - IFT FEAT_TABLEGO - IFT FEAT_FILTER - tay - ELS - ldy #1 - EIF - lda (nt),y - sta trackn_tablelop,x - iny - ELS - ldy #2 - EIF - lda (nt),y - sta trackn_instrlen,x - iny - lda (nt),y - sta trackn_instrlop,x - iny - lda (nt),y - sta trackn_tabletypespeed,x - IFT FEAT_TABLETYPE||FEAT_TABLEMODE - and #$3f - EIF - sta trackn_tablespeeda,x - IFT FEAT_TABLEMODE - lda (nt),y - and #$40 - sta trackn_tablemode,x - EIF - IFT FEAT_AUDCTLMANUALSET - iny - lda (nt),y - sta trackn_audctl,x - iny - ELS - ldy #6 - EIF - lda (nt),y - sta trackn_volumeslidedepth,x - IFT FEAT_VOLUMEMIN - iny - lda (nt),y - sta trackn_volumemin,x - iny - ELS - ldy #8 - EIF - lda (nt),y - sta trackn_effdelay,x - iny - lda (nt),y - tay - lda vibtabbeg,y - sta trackn_effvibratoa,x - sta trackn_effvibratobeg,x - lda vibtabbeg+1,y - sta trackn_effvibratoend,x - ldy #10 - lda (nt),y - sta trackn_effshift,x - lda #128 - sta trackn_volumeslidevalue,x - sta trackn_instrx2,x - asl @ - sta trackn_instrreachend,x - sta trackn_shiftfrq,x - tay - lda (nt),y - sta trackn_tableend,x - adc #0 - sta trackn_instridx,x - lda #INSTRPAR - sta trackn_tablea,x - tay - lda (nt),y - sta trackn_tablenote,x -xata_rtshere - jmp p2x0 -rmt_play -rmt_p0 - jsr SetPokey -rmt_p1 - IFT FEAT_INSTRSPEED==0||FEAT_INSTRSPEED>1 - dec v_ainstrspeed - bne rmt_p3 - EIF - IFT FEAT_INSTRSPEED==0 - lda #$ff -v_instrspeed equ *-1 - sta v_ainstrspeed - ELI FEAT_INSTRSPEED>1 - lda #FEAT_INSTRSPEED - sta v_ainstrspeed - EIF -rmt_p2 - dec v_aspeed - bne rmt_p3 - inc v_abeat - lda v_abeat - cmp #$ff -v_maxtracklen equ *-1 - beq p2o3 - jmp GetTrackLine -p2o3 - jmp GetSongLineTrackLineInitOfNewSetInstrumentsOnlyRmtp3 -go_ppnext jmp ppnext -rmt_p3 - lda #>frqtab - sta nr+1 -xtracks05sub1 ldx #TRACKS-1 -pp1 - lda trackn_instrhb,x - beq go_ppnext - sta ns+1 - lda trackn_instrdb,x - sta ns - ldy trackn_instridx,x - lda (ns),y - sta reg1 - iny - lda (ns),y - sta reg2 - iny - lda (ns),y - sta reg3 - iny - tya - cmp trackn_instrlen,x - bcc pp2 - beq pp2 - lda #$80 - sta trackn_instrreachend,x -pp1b - lda trackn_instrlop,x -pp2 sta trackn_instridx,x - lda reg1 - IFT TRACKS>4 - cpx #4 - bcc pp2s - lsr @ - lsr @ - lsr @ - lsr @ -pp2s - EIF - and #$0f - ora trackn_volume,x - tay - lda volumetab,y - sta tmp - lda reg2 - and #$0e - tay - lda tabbeganddistor,y - sta nr - lda tmp - ora tabbeganddistor+1,y - sta trackn_audc,x -InstrumentsEffects - lda trackn_effdelay,x - beq ei2 - cmp #1 - bne ei1 - lda trackn_shiftfrq,x - clc - adc trackn_effshift,x - clc - ldy trackn_effvibratoa,x - adc vib0,y - sta trackn_shiftfrq,x - iny - tya - cmp trackn_effvibratoend,x - bne ei1a - lda trackn_effvibratobeg,x -ei1a - sta trackn_effvibratoa,x - jmp ei2 -ei1 - dec trackn_effdelay,x -ei2 - ldy trackn_tableend,x - cpy #INSTRPAR+1 - bcc ei3 - lda trackn_tablespeeda,x - bpl ei2f -ei2c - tya - cmp trackn_tablea,x - bne ei2c2 - IFT FEAT_TABLEGO - lda trackn_tablelop,x - ELS - lda #INSTRPAR - EIF - sta trackn_tablea,x - bne ei2a -ei2c2 - inc trackn_tablea,x -ei2a - lda trackn_instrdb,x - sta nt - lda trackn_instrhb,x - sta nt+1 - ldy trackn_tablea,x - lda (nt),y - IFT FEAT_TABLEMODE - ldy trackn_tablemode,x - beq ei2e - clc - adc trackn_tablenote,x -ei2e - EIF - sta trackn_tablenote,x - lda trackn_tabletypespeed,x - IFT FEAT_TABLETYPE||FEAT_TABLEMODE - and #$3f - EIF -ei2f - sec - sbc #1 - sta trackn_tablespeeda,x -ei3 - lda trackn_instrreachend,x - bpl ei4 - lda trackn_volume,x - beq ei4 - IFT FEAT_VOLUMEMIN - cmp trackn_volumemin,x - beq ei4 - bcc ei4 - EIF - tay - lda trackn_volumeslidevalue,x - clc - adc trackn_volumeslidedepth,x - sta trackn_volumeslidevalue,x - bcc ei4 - tya - sbc #16 - sta trackn_volume,x -ei4 - IFT FEAT_COMMAND2 - lda #0 - sta frqaddcmd2 - EIF - lda reg2 - sta trackn_command,x - and #$70 - lsr @ - lsr @ - sta jmx+1 -jmx bcc * - jmp cmd0 - nop - jmp cmd1 - nop - jmp cmd2 - nop - jmp cmd3 - nop - jmp cmd4 - nop - jmp cmd5 - nop - jmp cmd6 - nop - jmp cmd7 -cmd1 - IFT FEAT_COMMAND1 - lda reg3 - jmp cmd0c - EIF -cmd2 - IFT FEAT_COMMAND2 - lda reg3 - sta frqaddcmd2 - lda trackn_note,x - jmp cmd0a - EIF -cmd3 - IFT FEAT_COMMAND3 - lda trackn_note,x - clc - adc reg3 - sta trackn_note,x - jmp cmd0a - EIF -cmd4 - IFT FEAT_COMMAND4 - lda trackn_shiftfrq,x - clc - adc reg3 - sta trackn_shiftfrq,x - lda trackn_note,x - jmp cmd0a - EIF -cmd5 - IFT FEAT_COMMAND5&&FEAT_PORTAMENTO - IFT FEAT_TABLETYPE - lda trackn_tabletypespeed,x - bpl cmd5a1 - ldy trackn_note,x - lda (nr),y - clc - adc trackn_tablenote,x - jmp cmd5ax - EIF -cmd5a1 - lda trackn_note,x - clc - adc trackn_tablenote,x - cmp #61 - bcc cmd5a2 - lda #63 -cmd5a2 - tay - lda (nr),y -cmd5ax - sta trackn_portafrqc,x - ldy reg3 - bne cmd5a - sta trackn_portafrqa,x -cmd5a - tya - lsr @ - lsr @ - lsr @ - lsr @ - sta trackn_portaspeed,x - sta trackn_portaspeeda,x - lda reg3 - and #$0f - sta trackn_portadepth,x - lda trackn_note,x - jmp cmd0a - ELI FEAT_COMMAND5 - jmp pp9 - EIF -cmd6 - IFT FEAT_COMMAND6&&FEAT_FILTER - lda reg3 - clc - adc trackn_filter,x - sta trackn_filter,x - lda trackn_note,x - jmp cmd0a - ELI FEAT_COMMAND6 - jmp pp9 - EIF -cmd7 - IFT FEAT_COMMAND7SETNOTE||FEAT_COMMAND7VOLUMEONLY - IFT FEAT_COMMAND7SETNOTE - lda reg3 - IFT FEAT_COMMAND7VOLUMEONLY - cmp #$80 - beq cmd7a - EIF - sta trackn_note,x - jmp cmd0a - EIF - IFT FEAT_COMMAND7VOLUMEONLY -cmd7a - lda trackn_audc,x - ora #$f0 - sta trackn_audc,x - lda trackn_note,x - jmp cmd0a - EIF - EIF -cmd0 - lda trackn_note,x - clc - adc reg3 -cmd0a - IFT FEAT_TABLETYPE - ldy trackn_tabletypespeed,x - bmi cmd0b - EIF - clc - adc trackn_tablenote,x - cmp #61 - bcc cmd0a1 - lda #0 - sta trackn_audc,x - lda #63 -cmd0a1 - IFT FEAT_BASS16 - sta trackn_outnote,x - EIF - tay - lda (nr),y - clc - adc trackn_shiftfrq,x - IFT FEAT_COMMAND2 - clc - adc frqaddcmd2 - EIF - IFT FEAT_TABLETYPE - jmp cmd0c -cmd0b - cmp #61 - bcc cmd0b1 - lda #0 - sta trackn_audc,x - lda #63 -cmd0b1 - tay - lda trackn_shiftfrq,x - clc - adc trackn_tablenote,x - clc - adc (nr),y - IFT FEAT_COMMAND2 - clc - adc frqaddcmd2 - EIF - EIF -cmd0c - sta trackn_audf,x -pp9 - IFT FEAT_PORTAMENTO - lda trackn_portaspeeda,x - beq pp10 - dec trackn_portaspeeda,x - bne pp10 - lda trackn_portaspeed,x - sta trackn_portaspeeda,x - lda trackn_portafrqa,x - cmp trackn_portafrqc,x - beq pp10 - bcs pps1 - adc trackn_portadepth,x - bcs pps8 - cmp trackn_portafrqc,x - bcs pps8 - jmp pps9 -pps1 - sbc trackn_portadepth,x - bcc pps8 - cmp trackn_portafrqc,x - bcs pps9 -pps8 - lda trackn_portafrqc,x -pps9 - sta trackn_portafrqa,x -pp10 - lda reg2 - and #$01 - beq pp11 - lda trackn_portafrqa,x - clc - adc trackn_shiftfrq,x - sta trackn_audf,x -pp11 - EIF -ppnext - dex - bmi rmt_p4 - jmp pp1 -rmt_p4 - IFT FEAT_AUDCTLMANUALSET - lda trackn_audctl+0 - ora trackn_audctl+1 - ora trackn_audctl+2 - ora trackn_audctl+3 - tax - ELS - ldx #0 - EIF -qq1 - stx v_audctl - IFT FEAT_FILTER - IFT FEAT_FILTERG0L - lda trackn_command+0 - bpl qq2 - lda trackn_audc+0 - and #$0f - beq qq2 - lda trackn_audf+0 - clc - adc trackn_filter+0 - sta trackn_audf+2 - IFT FEAT_COMMAND7VOLUMEONLY&&FEAT_VOLUMEONLYG2L - lda trackn_audc+2 - and #$10 - bne qq1a - EIF - lda #0 - sta trackn_audc+2 -qq1a - txa - ora #4 - tax - EIF -qq2 - IFT FEAT_FILTERG1L - lda trackn_command+1 - bpl qq3 - lda trackn_audc+1 - and #$0f - beq qq3 - lda trackn_audf+1 - clc - adc trackn_filter+1 - sta trackn_audf+3 - IFT FEAT_COMMAND7VOLUMEONLY&&FEAT_VOLUMEONLYG3L - lda trackn_audc+3 - and #$10 - bne qq2a - EIF - lda #0 - sta trackn_audc+3 -qq2a - txa - ora #2 - tax - EIF -qq3 - IFT FEAT_FILTERG0L||FEAT_FILTERG1L - cpx v_audctl - bne qq5 - EIF - EIF - IFT FEAT_BASS16 - IFT FEAT_BASS16G1L - lda trackn_command+1 - and #$0e - cmp #6 - bne qq4 - lda trackn_audc+1 - and #$0f - beq qq4 - ldy trackn_outnote+1 - lda frqtabbasslo,y - sta trackn_audf+0 - lda frqtabbasshi,y - sta trackn_audf+1 - IFT FEAT_COMMAND7VOLUMEONLY&&FEAT_VOLUMEONLYG0L - lda trackn_audc+0 - and #$10 - bne qq3a - EIF - lda #0 - sta trackn_audc+0 -qq3a - txa - ora #$50 - tax - EIF -qq4 - IFT FEAT_BASS16G3L - lda trackn_command+3 - and #$0e - cmp #6 - bne qq5 - lda trackn_audc+3 - and #$0f - beq qq5 - ldy trackn_outnote+3 - lda frqtabbasslo,y - sta trackn_audf+2 - lda frqtabbasshi,y - sta trackn_audf+3 - IFT FEAT_COMMAND7VOLUMEONLY&&FEAT_VOLUMEONLYG2L - lda trackn_audc+2 - and #$10 - bne qq4a - EIF - lda #0 - sta trackn_audc+2 -qq4a - txa - ora #$28 - tax - EIF - EIF -qq5 - stx v_audctl - IFT TRACKS>4 - IFT FEAT_AUDCTLMANUALSET - lda trackn_audctl+4 - ora trackn_audctl+5 - ora trackn_audctl+6 - ora trackn_audctl+7 - tax - ELS - ldx #0 - EIF - stx v_audctl2 - IFT FEAT_FILTER - IFT FEAT_FILTERG0R - lda trackn_command+0+4 - bpl qs2 - lda trackn_audc+0+4 - and #$0f - beq qs2 - lda trackn_audf+0+4 - clc - adc trackn_filter+0+4 - sta trackn_audf+2+4 - IFT FEAT_COMMAND7VOLUMEONLY&&FEAT_VOLUMEONLYG2R - lda trackn_audc+2+4 - and #$10 - bne qs1a - EIF - lda #0 - sta trackn_audc+2+4 -qs1a - txa - ora #4 - tax - EIF -qs2 - IFT FEAT_FILTERG1R - lda trackn_command+1+4 - bpl qs3 - lda trackn_audc+1+4 - and #$0f - beq qs3 - lda trackn_audf+1+4 - clc - adc trackn_filter+1+4 - sta trackn_audf+3+4 - IFT FEAT_COMMAND7VOLUMEONLY&&FEAT_VOLUMEONLYG3R - lda trackn_audc+3+4 - and #$10 - bne qs2a - EIF - lda #0 - sta trackn_audc+3+4 -qs2a - txa - ora #2 - tax - EIF -qs3 - IFT FEAT_FILTERG0R||FEAT_FILTERG1R - cpx v_audctl2 - bne qs5 - EIF - EIF - IFT FEAT_BASS16 - IFT FEAT_BASS16G1R - lda trackn_command+1+4 - and #$0e - cmp #6 - bne qs4 - lda trackn_audc+1+4 - and #$0f - beq qs4 - ldy trackn_outnote+1+4 - lda frqtabbasslo,y - sta trackn_audf+0+4 - lda frqtabbasshi,y - sta trackn_audf+1+4 - IFT FEAT_COMMAND7VOLUMEONLY&&FEAT_VOLUMEONLYG0R - lda trackn_audc+0+4 - and #$10 - bne qs3a - EIF - lda #0 - sta trackn_audc+0+4 -qs3a - txa - ora #$50 - tax - EIF -qs4 - IFT FEAT_BASS16G3R - lda trackn_command+3+4 - and #$0e - cmp #6 - bne qs5 - lda trackn_audc+3+4 - and #$0f - beq qs5 - ldy trackn_outnote+3+4 - lda frqtabbasslo,y - sta trackn_audf+2+4 - lda frqtabbasshi,y - sta trackn_audf+3+4 - IFT FEAT_COMMAND7VOLUMEONLY&&FEAT_VOLUMEONLYG2R - lda trackn_audc+2+4 - and #$10 - bne qs4a - EIF - lda #0 - sta trackn_audc+2+4 -qs4a - txa - ora #$28 - tax - EIF - EIF -qs5 - stx v_audctl2 - EIF -rmt_p5 - IFT FEAT_INSTRSPEED==0||FEAT_INSTRSPEED>1 - lda v_ainstrspeed - ELS - lda #1 - EIF - rts -SetPokey - IFT STEREOMODE==1 ;* L1 L2 L3 L4 R1 R2 R3 R4 - ldy #$ff -v_audctl2 equ *-1 - lda trackn_audf+0+4 - ldx trackn_audf+0 -xstastx01 sta $d210 - stx $d200 - lda trackn_audc+0+4 - ldx trackn_audc+0 -xstastx02 sta $d211 - stx $d201 - lda trackn_audf+1+4 - ldx trackn_audf+1 -xstastx03 sta $d212 - stx $d202 - lda trackn_audc+1+4 - ldx trackn_audc+1 -xstastx04 sta $d213 - stx $d203 - lda trackn_audf+2+4 - ldx trackn_audf+2 -xstastx05 sta $d214 - stx $d204 - lda trackn_audc+2+4 - ldx trackn_audc+2 -xstastx06 sta $d215 - stx $d205 - lda trackn_audf+3+4 - ldx trackn_audf+3 -xstastx07 sta $d216 - stx $d206 - lda trackn_audc+3+4 - ldx trackn_audc+3 -xstastx08 sta $d217 - stx $d207 - lda #$ff -v_audctl equ *-1 -xstysta01 sty $d218 - sta $d208 - ELI STEREOMODE==0 ;* L1 L2 L3 L4 - ldy #$ff -v_audctl equ *-1 - lda trackn_audf+0 - ldx trackn_audc+0 - sta $d200 - stx $d201 - lda trackn_audf+1 - ldx trackn_audc+1 - sta $d200+2 - stx $d201+2 - lda trackn_audf+2 - ldx trackn_audc+2 - sta $d200+4 - stx $d201+4 - lda trackn_audf+3 - ldx trackn_audc+3 - sta $d200+6 - stx $d201+6 - sty $d208 - ELI STEREOMODE==2 ;* L1 R2 R3 L4 - ldy #$ff -v_audctl equ *-1 - lda trackn_audf+0 - ldx trackn_audc+0 - sta $d200 - stx $d201 - sta $d210 - lda trackn_audf+1 - ldx trackn_audc+1 - sta $d210+2 - stx $d211+2 - lda trackn_audf+2 - ldx trackn_audc+2 - sta $d210+4 - stx $d211+4 - sta $d200+4 - lda trackn_audf+3 - ldx trackn_audc+3 - sta $d200+6 - stx $d201+6 - sta $d210+6 - sty $d218 - sty $d208 - ELI STEREOMODE==3 ;* L1 L2 R3 R4 - ldy #$ff -v_audctl equ *-1 - lda trackn_audf+0 - ldx trackn_audc+0 - sta $d200 - stx $d201 - lda trackn_audf+1 - ldx trackn_audc+1 - sta $d200+2 - stx $d201+2 - lda trackn_audf+2 - ldx trackn_audc+2 - sta $d210+4 - stx $d211+4 - sta $d200+4 - lda trackn_audf+3 - ldx trackn_audc+3 - sta $d210+6 - stx $d211+6 - sta $d200+6 - sty $d218 - sty $d208 - EIF - rts -RMTEND diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/tm2.asx kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/tm2.asx --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/tm2.asx 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/tm2.asx 1970-01-01 00:00:00.000000000 +0000 @@ -1,1551 +0,0 @@ -;------------------- -; TMC 2.00 Player -;------------------ - -player equ $500 -normal equ 1 ; change to 0 for short version - - org player - -addr equ $fa -byte equ $fc -bajt equ $fd -filter equ $fe -maxvol equ $ff - -; some tables on start (to avoid page breaking) - -voltab dta d' ' - dta d' !!!!!!!!' - dta d' !!!!!!!!""""' - dta d' !!!!!"""""###' - dta d' !!!!""""####$$' - dta d' !!!"""###$$$%%' - dta d' !!"""##$$$%%&&' - dta d' !!""##$$%%&&''''' - dta d' !!""##$$%%&&''''(' - dta d' !!""#$$%%&''''(()' - dta d' !!"##$%%&''''())*' - dta d' !!"#$$%&''''()**+' - dta d' !""#$%&&''()**+,' - dta d' !"##$%&''()**+,-' - dta d' !"#$%&''''()*+,-.' - dta d' !"#$%&''()*+,-./' - -frqtab dta 0,$f1,$e4,$d7 - dta $cb,$c0,$b5,$aa - dta $a1,$98,$8f,$87 - dta $7f,$78,$72,$6b - dta $65,$5f,$5a,$55 - dta $50,$4b,$47,$43 - dta $3f,$3c,$38,$35 - dta $32,$2f,$2c,$2a - dta $27,$25,$23,$21 - dta $1f,$1d,$1c,$1a - dta $18,$17,$16,$14 - dta $13,$12,$11,$10 - dta 15,14,13,12 - dta 11,10,9,8 - dta 7,6,5,4 - dta 3,2,1,0 - - dta 0,$f2,$e9,$da - dta $ce,$bf,$b6,$aa - dta $a1,$98,$8f,$89 - dta $80,$7a,$71,$6b - dta $65,$5f,$5c,$56 - dta $50,$4d,$47,$44 - dta $3e,$3c,$38,$35 - dta $32,$2f,$2d,$2a - dta $28,$25,$23,$21 - dta $1f,$1d,$1c,$1a - dta $18,$17,$16,$14 - dta $13,$12,$11,$10 - dta 15,14,13,12 - dta 11,10,9,8 - dta 7,6,5,4 - dta 3,2,1,0 - - dta 0,$ff,$f1,$e4 - dta $d8,$ca,$c0,$b5 - dta $ab,$a2,$99,$8e - dta $87,$7f,$79,$73 - dta $70,$66,$61,$5a - dta $55,$52,$4b,$48 - dta $43,$3f,$3c,$39 - dta $37,$33,$30,$2d - dta $2a,$28,$25,$24 - dta $21,$1f,$1e,$1c - dta $1b,$19,$17,$16 - dta $15,$13,$12,$11 - dta $10,15,14,13 - dta 12,11,10,9 - dta 8,7,6,5 - dta 4,3,2,1 - - dta 0,$f3,$e6,$d9 - dta $cc,$c1,$b5,$ad - dta $a2,$99,$90,$88 - dta $80,$79,$72,$6c - dta $66,$60,$5b,$55 - dta $51,$4c,$48,$44 - dta $40,$3c,$39,$35 - dta $32,$2f,$2d,$2a - dta $28,$25,$23,$21 - dta $1f,$1d,$1c,$1a - dta $18,$17,$16,$14 - dta $13,$12,$11,$10 - dta 15,14,13,12 - dta 11,10,9,8 - dta 7,6,5,4 - dta 3,2,1,0 - -basslo dta l($be2,$b38,$a8c,$a00) - dta l($96a,$8e8,$86a,$7ef) - dta l($780,$708,$6ae,$646) - dta l($5e6,$595,$541,$4f6) - dta l($4b0,$46e,$430,$3f6) - dta l($3bb,$384,$352,$322) - dta l($2f4,$2c8,$2a0,$27a) - dta l($255,$234,$214,$1f5) - dta l($1d8,$1bd,$1a4,$18d) - dta l($177,$160,$14e,$138) - dta l($127,$115,$106,$0f7) - dta l($0e8,$0db,$0cf,$0c3) - dta l($0b8,$0ac,$0a2,$09a) - dta l($090,$088,$07f,$078) - dta l($070,$06a,$064,$05e) - dta l($057,$052,$032,$00a) - - dta 0,$f2,$33,$96 - dta $e2,$38,$8c,$00 - dta $6a,$e8,$6a,$ef - dta $80,$08,$ae,$46 - dta $e6,$95,$41,$f6 - dta $b0,$6e,$30,$f6 - dta $bb,$84,$52,$22 - dta $f4,$c8,$a0,$7a - dta $55,$34,$14,$f5 - dta $d8,$bd,$a4,$8d - dta $77,$60,$4e,$38 - dta $27,$15,$06,$f7 - dta $e8,$db,$cf,$c3 - dta $b8,$ac,$a2,$9a - dta $90,$88,$7f,$78 - dta $70,$6a,$64,$5e - -basshi dta h($be2,$b38,$a8c,$a00) - dta h($96a,$8e8,$86a,$7ef) - dta h($780,$708,$6ae,$646) - dta h($5e6,$595,$541,$4f6) - dta h($4b0,$46e,$430,$3f6) - dta h($3bb,$384,$352,$322) - dta h($2f4,$2c8,$2a0,$27a) - dta h($255,$234,$214,$1f5) - dta h($1d8,$1bd,$1a4,$18d) - dta h($177,$160,$14e,$138) - dta h($127,$115,$106,$0f7) - dta h($0e8,$0db,$0cf,$0c3) - dta h($0b8,$0ac,$0a2,$09a) - dta h($090,$088,$07f,$078) - dta h($070,$06a,$064,$05e) - dta h($057,$052,$032,$00a) - - dta 0,13,13,12 - dta 11,11,10,10 - dta 9,8,8,7 - dta 7,7,6,6 - dta 5,5,5,4 - dta 4,4,4,3 - dta 3,3,3,3 - dta 2,2,2,2 - dta 2,2,2,1 - dta 1,1,1,1 - dta 1,1,1,1 - dta 1,1,1,0 - dta 0,0,0,0 - dta 0,0,0,0 - dta 0,0,0,0 - dta 0,0,0,0 - -tables_len equ *-player - -; org +$300 - jmp init - jmp play - jmp sound - -; some external controls -quadro dta 1 ; 0=mono, 1-63=stereo, 64-127= RMT stereo, 128-255=quadro -pokeys dta 16 ; which data should go to which pokey (0,1,2 and 3 respectively) - dta 20 ; for stereo config: 16=first 4 tracks, 20=last 4 tracks - dta 0 ; for quadro values should be: - dta 0 ; 0=main volume from tracks 0-3, 4=main volume from tracks 4-5 - ; 8=additional volume from tracks 0-3, 12=additional volume from tracks 4-5 - ; typical: 0,4,12,8 which should sound well on pokeys 0&2 on left channel - ; and pokeys 1&3 on right channel - ; (on stereo atari these settings should also sound well) -silent dta d' ' ; which channel should be silent - -; these values are usable from the outside of player -czygrc dta 0 ; if song should be played -pozsng dta 0 ; position in song - -specialflag dta 0 ; flag triggered in song data -adrsng dta a(0) ; address of song line - -tempo dta 0 ; tempo of song -ltempo dta 0 ; counter of tempo -pozptr dta 0 ; counter of positions in patterns (64 means end of pattern) - - ift normal ; !!! - -aud1 dta 0 ; total AUDCTL of left channel -aud2 dta 0 ; and right - -voltabs equ * ; (24 bytes) - - eif ; !!! - -vol1ch dta d' ' ; volume of main channels - - ift normal ; !!! - -vol2ch dta d' ' ; volume of additional channels -volume dta d' ' ; volume of channels in stereo (taken from vol1ch and vol2ch) - -freqtabs equ * ; (24 bytes) - - eif ; !!! - -frq dta d' ' ; frequency - - ift normal ; !!! - -note dta d' ' ; actual note played on channel (taken from aktwys) -freqen dta d' ' ; frequency of channels in stereo (taken from frq) - - eif ; !!! - -; data for accesing pattern data -adrptl dta d' ' ; address of pattern data -adrpth dta d' ' ; -pozwpt dta d' ' ; index for accesing data in pattern -poddzw dta d' ' ; change of note -delay dta d' ' ; how many spaces in pattern should be skipped - -; data for accesing instrument data -czygrx dta d' ' ; if something is played on channel -adrsnl dta d' ' ; address of instrument data -adrsnh dta d' ' ; -numdzw dta d' ' ; number of instrument -wysdzw dta d' ' ; note to play -aktwys dta d' ' ; actual played note -znksz dta d' ' ; distortion -audctl dta d' ' ; AUDCTL -slupy dta d' ' ; counter for data inside instrument - -; data for specific sound effects -sndlen dta d' ' ; length of instrument -sndlop dta d' ' ; where to loop sound data -actvol dta d' ' ; volume of sounds -actvl1 dta d' ' ; actual control of main volume - - ift normal ; !!! - -actvl2 dta d' ' ; and additional volume - - eif ; !!! - -opad1 dta d' ' ; how soon the sound should fade (main volume) -opad2 dta d' ' ; and additional volume -lopad1 dta d' ' ; counters for fading -lopad2 dta d' ' ; -opadst dta d' ' ; start of fading -typ dta d' ' ; type of effect -param dta d' ' ; parameter for effect -typdat dta d' ' ; data for effect -czekaj dta d' ' ; how soon the effect should start -dtyp dta d' ' ; how often the effect should chanfe -ltyp dta d' ' ; counter for effect change -ilperm dta d' ' ; how many arpeggio sounds -aperm dta d' ' ; actual arpeggio sound -dperm dta d' ' ; how soon the arpeggio should change -lperm dta d' ' ; counter for arpeggio -kolejn dta d' ' ; order of arpeggio -sndfilter dta d' ' ; filter from sound data -mainaudctl dta d' ' ; main audctl -addaudctl dta d' ' ; additional audctl -shiftfrq dta d' ' -shiftnote dta d' ' -shiftfilter dta d' ' - -; some useful tables - - ift normal ; !!! - -przeci dta 4,5,6,7 ; which channel is the opposite (used only in stereo) - dta 0,1,2,3 - - eif ; !!! - -audtb1 dta 4,2,0,0 ; which byte in audctl has to be set to make sound "2 channel synth" - dta 4,2,0,0 -audtb2 dta 0,16,0,8 ; which byte in audctl has to be set to make sound "2 channel bass" - dta 0,16,0,8 -usedaudctl dta 4+129,$50+2+129,129,$28+129 ; bits of AUDCTL used in channel - dta 4+129,$50+2+129,129,$28+129 - -;------------------------- -; start of player program - -player_program equ * - -; new address of song line -p3 dey - lda (addr),y - sta pozsng - mvx #0 byte - asl @ - rol byte - asl @ - rol byte - asl @ - rol byte - asl @ - rol byte - adc pozsng ; clc - scc:inc byte - clc -zm0 adc #0 - sta addr - lda byte -zm1 adc #0 - sta addr+1 - jmp p1 - -; play song (call only one time per frame) -play jsr pokey - lda czygrc - beq rsound - dec ltempo - bmi p4 -rsound jmp sound+3 - -p4 dec pozptr - bne r1 - -; get new patterns from song - ldx #0 - inc pozsng - mwa adrsng addr - -p1 ldy #16 - lda (addr),y - bmi p3 - jeq stop - sta pozptr - dey - -p2 lda (addr),y - dey - sty byte - tay -zm2 lda $ffff,y - sta adrptl,x -zm3 lda $ffff,y - sta adrpth,x - lda #0 - sta delay,x - sta pozwpt,x - ldy byte - lda (addr),y - sta poddzw,x - inx - dey - bpl p2 - lda #17 - add addr - sta adrsng - lda #0 - adc addr+1 - sta adrsng+1 - -; get new data from patterns -r1 mva tempo ltempo - - ldx #7 -r2 dec delay,x - bmi r13 - -r14 dex - bpl r2 - jmp sound+3 - -r13 mva adrptl,x addr - mva adrpth,x addr+1 - - ldy pozwpt,x -r3 lda (addr),y ; get data - bne r4 - - iny ; $00: only new volume - lda (addr),y - sta actvol,x - and #$f0 - sta actvl1,x - - ift normal ; !!! - - lda (addr),y - asl @ - asl @ - asl @ - asl @ - sta actvl2,x - - eif ; !!! - - iny - tya - sta pozwpt,x - jmp r14 - -r4 cmp #$40 - bcs r5 - adc poddzw,x ; $01-$3f: new note with sound and maybe volume - sta wysdzw,x - iny - lda (addr),y - bpl r11 - and #$7f - sta byte - iny - lda (addr),y - sta actvol,x - and #$f0 - sta actvl1,x - - ift normal ; !!! - - lda (addr),y - asl @ - asl @ - asl @ - asl @ - sta actvl2,x - - eif ; !!! - - iny - tya - sta pozwpt,x - ldy byte - jsr dzwiek - jmp r14 - -r11 tay ; without volume - inc pozwpt,x - inc pozwpt,x - lda actvol,x - and #$f0 - sta actvl1,x - - ift normal ; !!! - - lda actvol,x - asl @ - asl @ - asl @ - asl @ - sta actvl2,x - - eif ; !!! - - jsr dzwiek - jmp r14 - -r5 cmp #$80 - bcs r6 - and #$3f ; $41-$7f: new note with volume - add poddzw,x - sta wysdzw,x - iny - lda (addr),y - sta actvol,x - and #$f0 - sta actvl1,x - - ift normal ; !!! - - lda (addr),y - asl @ - asl @ - asl @ - asl @ - sta actvl2,x - - eif ; !!! - - iny - tya - sta pozwpt,x - jmp r14 - -r6 bne r7 - iny ; $80: more than 15 spaces - lda (addr),y - sta delay,x - iny - tya - sta pozwpt,x - jmp r14 - -r7 cmp #$c0 - bcs r8 - and #$3f ; $81-$bf: new note - add poddzw,x - sta wysdzw,x - inc pozwpt,x - jmp r14 - -r8 cmp #$d0 - bcs r9 - iny ; $c0-$cf: new tempo - inc pozwpt,x - and #15 - sta tempo - sta ltempo - jmp r3 - -r9 cmp #$e0 ; special code - bcs r15 - mva (addr),y byte - iny - mva (addr),y bajt - iny - tya - sta pozwpt,x - lda byte - jsr specialcode - jmp r14 - -r15 cmp #$f0 ; special code with volume - bcs r12 - mva (addr),y byte - iny - mva (addr),y bajt - lda byte - jsr specialcode - ldy pozwpt,x - iny - iny - lda (addr),y - sta actvol,x - and #$f0 - sta actvl1,x - - ift normal ; !!! - - lda (addr),y - asl @ - asl @ - asl @ - asl @ - sta actvl2,x - - eif ; !!! - - iny - tya - sta pozwpt,x - jmp r14 - -r12 cmp #$ff - bcs r10 - sbc #$ef ; $f0-$fe: spaces-$f0 (c is clear here) - sta delay,x - inc pozwpt,x - jmp r14 - -r10 lda #$40 ; $ff: spaces till the end of pattern - sta delay,x - jmp r14 - -; main play sound loop -sound jsr pokey - ldx #7 -p5 lda czygrx,x - beq p6 - jmp graj - -grajreturn equ * - lda silent,x - beq p7 - - lda #0 ; silent channel - sta vol1ch,x - - ift normal ; !!! - - sta vol2ch,x - - eif ; !!! - - dex - bpl p5 - jmp p8 - -p7 ldy bajt - lda frqtab,y - add byte - sta frq,x - tya - sta aktwys,x - - lda audctl,x - and audtb2,x - beq p11 - lda bajt ; 2 channel bass - and #$7f - tay - lda basslo,y - add byte - sta frq-1,x - lda basshi,y - adc #0 - sta frq,x - lda #0 - sta vol1ch-1,x - ldy przeci,x - sta vol2ch-1,y - dex - dex - bpl p5 - jmp p8 - -p11 lda audctl,x - and audtb1,x - beq p6 - lda sndfilter,x ;two channel filter - add bajt - sta aktwys+2,x - tay - lda frqtab,y - add byte - sec - adc filter - sta frq+2,x - -p6 dex - bpl p5 - -; sound postprocessing -p8 inx - stx byte - - ift normal ; !!! - - ldx #3 - lda quadro - beq p9 - and #$40 - bne p12 - - ldx #7 ; standard stereo settings -p9 txa - tay - lda vol1ch,y - bne p10 - ldy przeci,x - lda vol2ch,y - bne p10 - txa - tay - lda #0 -p10 ora znksz,y - sta volume,x - lda frq,y - sta freqen,x - lda aktwys,y - sta note,x - - lda audctl,y - ora byte - sta byte - - cpx #4 - sne:sta aud2 - dex - bpl p9 - sta aud1 - rts - -p12 equ * ; RMT stereo -p13 lda vol1ch,x - ora znksz,x - sta volume,x - lda vol2ch+4,x - ora znksz+4,x - sta volume+4,x - mva frq,x freqen,x - mva frq+4,x freqen+4,x - mva aktwys,x note,x - mva aktwys+4,x note+4,x - dex - bpl p13 - - lda audctl - ora audctl+1 - ora audctl+2 - ora audctl+3 - sta aud1 - lda audctl+4 - ora audctl+5 - ora audctl+6 - ora audctl+7 - sta aud2 - rts - -; set pokey -pokey lda quadro - jeq pokey1 - jpl pokey2 - - lda pokeys+3 ; data for pokey 3 - tax - lsr @ - lsr @ - and #1 - tay - lda aud1,y - sta $d238 - txa - and #4 - tay - lda freqtabs,y - sta $d230 - lda voltabs,x - sta $d231 - lda freqtabs+1,y - sta $d232 - lda voltabs+1,x - sta $d233 - lda freqtabs+2,y - sta $d234 - lda voltabs+2,x - sta $d235 - lda freqtabs+3,y - sta $d236 - lda voltabs+3,x - sta $d237 - - lda pokeys+2 ; data for pokey 2 - tax - lsr @ - lsr @ - and #1 - tay - lda aud1,y - sta $d228 - txa - and #4 - tay - lda freqtabs,y - sta $d220 - lda voltabs,x - sta $d221 - lda freqtabs+1,y - sta $d222 - lda voltabs+1,x - sta $d223 - lda freqtabs+2,y - sta $d224 - lda voltabs+2,x - sta $d225 - lda freqtabs+3,y - sta $d226 - lda voltabs+3,x - sta $d227 - -pokey2 lda pokeys+1 ; data for pokey 1 - tax - lsr @ - lsr @ - and #1 - tay - lda aud1,y - sta $d218 - txa - ldy quadro - spl:and #4 - tay - lda freqtabs,y - sta $d210 - lda voltabs,x - sta $d211 - lda freqtabs+1,y - sta $d212 - lda voltabs+1,x - sta $d213 - lda freqtabs+2,y - sta $d214 - lda voltabs+2,x - sta $d215 - lda freqtabs+3,y - sta $d216 - lda voltabs+3,x - sta $d217 - -pokey1 lda pokeys ; data for pokey 0 - tax - lsr @ - lsr @ - and #1 - tay - lda aud1,y - sta $d208 - txa - ldy quadro - spl:and #4 - tay - lda freqtabs,y - sta $d200 - lda voltabs,x - sta $d201 - lda freqtabs+1,y - sta $d202 - lda voltabs+1,x - sta $d203 - lda freqtabs+2,y - sta $d204 - lda voltabs+2,x - sta $d205 - lda freqtabs+3,y - sta $d206 - lda voltabs+3,x - sta $d207 - rts - - els ; !!! - - rts - -pokey lda audctl+4 - ora audctl+5 - ora audctl+6 - ora audctl+7 - sta $d218 - lda frq+4 - sta $d210 - lda vol1ch+4 - ora znksz+4 - sta $d211 - lda frq+5 - sta $d212 - lda vol1ch+5 - ora znksz+5 - sta $d213 - lda frq+6 - sta $d214 - lda vol1ch+6 - ora znksz+6 - sta $d215 - lda frq+7 - sta $d216 - lda vol1ch+7 - ora znksz+7 - sta $d217 - - lda audctl+0 - ora audctl+1 - ora audctl+2 - ora audctl+3 - sta $d208 - lda frq+0 - sta $d200 - lda vol1ch+0 - ora znksz+0 - sta $d201 - lda frq+1 - sta $d202 - lda vol1ch+1 - ora znksz+1 - sta $d203 - lda frq+2 - sta $d204 - lda vol1ch+2 - ora znksz+2 - sta $d205 - lda frq+3 - sta $d206 - lda vol1ch+3 - ora znksz+3 - sta $d207 - rts - - eif ; !!! - -; sound processing -graj lda adrsnl,x - sta addr - lda adrsnh,x - sta addr+1 - - mva shiftfrq,x byte - mva shiftnote,x bajt - mva shiftfilter,x filter - - lda slupy,x - cmp sndlen,x - bcc n1 - sta opadst,x - lda sndlop,x - sta slupy,x - jmp n0 - -n1 lda opadst,x ; sound fading - beq n6 -n0 lda opad1,x - beq n7 - dec lopad1,x - bne n7 - sta lopad1,x - lda actvl1,x - beq n7 - sub #16 - sta actvl1,x -n7 lda opad2,x - beq n6 - dec lopad2,x - bne n6 - sta lopad2,x - - ift normal ; !!! - - lda actvl2,x - beq n6 - sub #16 - sta actvl2,x - - eif ; !!! - -n6 ldy aperm,x ; arpeggio - lda (addr),y - add wysdzw,x - add:sta bajt - dec lperm,x - bpl m1 - lda dperm,x - sta lperm,x - lda kolejn,x - beq m6 - add aperm,x - sta aperm,x - beq m7 - cmp ilperm,x - bcc m1 - lda #$ff - sta kolejn,x - jmp m1 - -m7 lda #1 - sta kolejn,x - jmp m1 - -m6 inc aperm,x - lda ilperm,x - cmp aperm,x - bcs m1 - lda #0 - sta aperm,x - -m1 lda #19 - add:sta addr - scc:inc addr+1 - - ldy slupy,x - lda (addr),y ; main sound data - and #$f0 - sta znksz,x - lda (addr),y - and #15 - ora actvl1,x - tay - lda voltab,y - ora maxvol - tay - lda voltab,y - sta vol1ch,x - - ift normal ; !!! - - ldy slupy,x - iny - lda (addr),y - and #15 - ora actvl2,x - tay - lda voltab,y - ora maxvol - tay - lda voltab,y - sta vol2ch,x - - eif ; !!! - - lda czekaj,x - bne m2 - lda typ,x - sta m5+1 -m5 bpl * ; jmp - jmp typ0 - nop - jmp typ1 - nop - jmp typ2 - nop - jmp typ3 - nop - jmp typ4 - nop - jmp typ5 - nop - jmp typ6 - nop - jmp typ7 - -m2 dec czekaj,x -m3 ldy slupy,x ; accents - iny - lda (addr),y - and #$70 - lsr @ - lsr @ - lsr @ - sta n5+1 - lda (addr),y - bmi n3 - lda mainaudctl,x - jmp n4 -n3 lda addaudctl,x -n4 and usedaudctl,x - sta audctl,x - iny - iny - tya - sta slupy,x - dey - lda (addr),y -n5 bcc * ; jmp - bcc a0 - bcc a1 - bcc a2 - bcc a3 - bcc a4 - bcc a5 - bcc a6 - bcc a7 - -; accents -a1 adc:sta shiftfrq,x - lda (addr),y -a0 add:sta byte - jmp grajreturn - -a3 adc:sta shiftnote,x - lda (addr),y -a2 add:sta bajt - jmp grajreturn - -a5 adc:sta shiftfilter,x - lda (addr),y -a4 add:sta filter - jmp grajreturn - -a6 sta byte - lda #0 -a7 sta bajt - jmp grajreturn - -; effects -typ1 lda typdat,x - and #3 - lsr @ - bcc t0 - bne t1 - lda param,x - add:sta byte -t0 dec ltyp,x - bpl typ0 - inc typdat,x - mva dtyp,x ltyp,x - jmp m3 - -t1 lda byte - sbc param,x ; sec - sta byte - dec ltyp,x - bpl typ0 - inc typdat,x - mva dtyp,x ltyp,x - jmp m3 - -typ2 ldy typdat,x - lda param,x - bmi t2 - iny - iny -t2 dey - tya - add:sta byte - dec ltyp,x - bpl typ0 - tya - sta typdat,x - cmp param,x - bne t3 - eor #$ff - sta param,x -t3 mva dtyp,x ltyp,x -typ0 jmp m3 - -typ3 ldy typdat,x - lda param,x - bmi t4 - iny - iny -t4 dey - tya - add:sta bajt - dec ltyp,x - bpl typ0 - tya - sta typdat,x - cmp param,x - bne t3 - eor #$ff - sta param,x - mva dtyp,x ltyp,x - jmp m3 - -typ4 lda typdat,x - add:sta byte - dec ltyp,x - bpl typ0 - lda param,x - add:sta typdat,x - mva dtyp,x ltyp,x - jmp m3 - -typ5 lda bajt - sub typdat,x - sta bajt - dec ltyp,x - bpl typ0 - lda param,x - add:sta typdat,x - mva dtyp,x ltyp,x - jmp m3 - -typ6 lda param,x - add:sta byte -typ7 jmp m3 ; placeholder for new type of sound - -;---------------- -; init functions - -; play song, X=number of song -songx ldy #16 -zm4 lda #0 - sta addr -zm5 lda #0 - sta addr+1 - mva #0 pozsng -d5 txa - beq inic - lda (addr),y - seq:bpl d4 - dex -d4 lda #17 - add:sta addr - scc:inc addr+1 - inc pozsng - bne d5 - ldx #0 - -; play song, X=line of song -playx lda #0 - sta byte - txa - sta pozsng - asl @ - rol byte - asl @ - rol byte - asl @ - rol byte - asl @ - rol byte - adc pozsng ; clc - scc:inc byte - clc -zm6 adc #0 - sta addr - lda byte -zm7 adc #0 - sta addr+1 -inic jsr stop - mwa addr adrsng - ldx #7 -i4 mva #$ff actvol,x - lda #$f0 - sta actvl1,x - - ift normal ; !!! - - sta actvl2,x - - eif ; !!! - - dex - bpl i4 - lda #3 - sta $d20f - sta $d21f - - ift normal ; !!! - - sta $d22f - sta $d23f - - eif ; !!! - - dec pozsng - inx - stx ltempo - inx - stx pozptr - stx czygrc - rts - -i1 txa ; change of tempo - and #15 - sta tempo - rts -i2 stx czygrc ; pause, continue - rts - -init cmp #$10 ; A=$00 - jcc songx - cmp #$20 ; A=$10 - bcc playx - cmp #$30 ; A=$20 - jcc d2 - cmp #$40 ; A=$30 - bcc i1 - cmp #$50 ; A=$40 - jcc stop - cmp #$60 ; A=$50 - bcc i2 - cmp #$70 ; A=$60 - jcs i3 - sty bajt - -specialcode and #15 - asl @ - sta sc17+1 - lda bajt -sc17 bcc * ; jmp - bcc sc0 - bcc sc1 - bcc sc2 - bcc sc3 - bcc sc4 - bcc sc5 - bcc sc6 - bcc sc7 - bcc sc8 - bcc sc9 - bcc sc10 - bcc sc11 - bcc sc12 - bcc sc13 - bcc sc14 - bcc sc15 - -sc0 sta specialflag ; code 0: set special flag -sc10 equ * -sc11 equ * -sc12 equ * -sc13 equ * -sc14 equ * -sc15 equ * - rts - -; special codes -sc4 sta sndfilter,x - rts -sc5 sta mainaudctl,x - rts -sc6 sta addaudctl,x - rts -sc7 sta shiftfilter,x - rts -sc8 sta shiftfrq,x - rts -sc9 sta shiftnote,x - rts - -sc1 and #$70 - lsr @ - lsr @ - sta typ,x - and #$30 - sne:sta typdat,x - lda bajt - bmi sc16 - and #15 - sta param,x - rts - -sc16 and #15 - eor #$ff - add #1 - sta param,x - rts - -sc2 and #$3f - sta dtyp,x - sta ltyp,x - rts - -sc3 and #$80 - asl @ - rol @ - sta kolejn,x - lda bajt - and #$70 - lsr @ - lsr @ - lsr @ - lsr @ - sta ilperm,x - sne:sta kolejn,x - lda bajt - and #15 - sta dperm,x - sta lperm,x - lda aperm,x - cmp ilperm,x - bcc sc0 - lda ilperm,x - seq:sbc #1 ; sec - sta aperm,x - rts - -; init of new song -i3 sty addr - stx addr+1 - - ldy #25 - mva (addr),y+ quadro - mva (addr),y+ pokeys - mva (addr),y+ pokeys+1 - mva (addr),y+ pokeys+2 - mva (addr),y+ pokeys+3 - lda (addr),y - sta tempo - - lda addr ; low byte of instruments data - eor #$80 - smi:inx - sta zm8+1 - stx zm8+2 - - eor #$80 ; low byte of pattern data - smi:inx - sta zm2+1 - stx zm2+2 - - inx ; high byte of pattern data - sta zm3+1 - stx zm3+2 - - inx ; high byte of instrument data - sta zm9+1 - stx zm9+2 - - eor #$80 ; track data - smi:inx - sta adrsng - sta zm0+1 - sta zm4+1 - sta zm6+1 - stx adrsng+1 - stx zm1+1 - stx zm5+1 - stx zm7+1 - - mva #$f0 maxvol - lda #0 - sta czygrc - sta specialflag - -; stop playing -stop ldx #7 - lda #0 - sta czygrc -d9 sta czygrx,x - sta audctl,x - sta vol1ch,x - - ift normal ; !!! - - sta vol2ch,x - sta volume,x - sta $d230,x - sta $d220,x - - eif ; !!! - - sta $d210,x - sta $d200,x - dex - bpl d9 - sta $d218 - sta $d208 - - ift normal ; !!! - - sta $d238 - sta $d228 - sta aud1 - sta aud2 - - eif ; !!! - rts - -; procedures for play new instrument -d1 sta vol1ch,x ; if attempt to play empty sound - clear data - - ift normal ; !!! - - sta vol2ch,x - sta volume,x - - eif ; !!! - - sta audctl,x - rts - -d0 tya ; change only volume - sta actvol,x -d3 and #$f0 - sta actvl1,x - lda actvol,x - - ift normal ; !!! - - asl @ - asl @ - asl @ - asl @ - sta actvl2,x - - eif ; !!! - - rts - -d2 and #7 - sta addr - txa - ldx addr - and #$3f - beq d0 - sta wysdzw,x - tya - bmi d2-1 - lda actvol,x - jsr d3 -dzwiek mva #0 czygrx,x -zm9 lda $ffff,y - beq d1 - sta adrsnh,x - sta addr+1 -zm8 lda $ffff,y - sta adrsnl,x - sta addr - tya - sta numdzw,x - - ldy #8 - mva (addr),y+ sndlen,x - mva (addr),y+ sndlop,x - mva (addr),y+ sndfilter,x - mva (addr),y+ mainaudctl,x - mva (addr),y+ addaudctl,x - mva (addr),y+ opad1,x - sta lopad1,x - mva (addr),y+ opad2,x - sta lopad2,x - lda (addr),y - and #$70 - lsr @ - lsr @ - sta typ,x - - lda (addr),y+ - bmi d7 - and #15 - sta param,x - jmp d8 -d7 and #15 - eor #$ff - add #1 - sta param,x - -d8 mva (addr),y+ czekaj,x - lda (addr),y+ - and #$3f - sta dtyp,x - sta ltyp,x - lda (addr),y - and #$80 - asl @ - rol @ - sta kolejn,x - lda (addr),y - and #$70 - lsr @ - lsr @ - lsr @ - lsr @ - sta ilperm,x - bne d6 - sta kolejn,x -d6 lda (addr),y- - and #15 - sta dperm,x - sta lperm,x - lda (addr),y - and #$c0 - ora wysdzw,x - sta wysdzw,x - tay - lda frqtab,y - sta frq,x - - lda #0 - sta slupy,x - sta typdat,x - sta opadst,x - sta aperm,x - sta shiftfrq,x - sta shiftnote,x - sta shiftfilter,x - lda #1 - sta czygrx,x - rts - -endplr end Binary files /tmp/tmpyaM5l1/AUpGL9bywb/kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/tm2.obx and /tmp/tmpyaM5l1/KBGCC02aAO/kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/tm2.obx differ diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/tmc.asx kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/tmc.asx --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/tmc.asx 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/tmc.asx 1970-01-01 00:00:00.000000000 +0000 @@ -1,963 +0,0 @@ -*---------------* -* TMC Player * -*Jaskier/Taquart* -*---------------* - - org $0500 - -byte equ $fa -bajt equ $fb -addr equ $fc -adrsng equ $fe - -player equ * - jmp init - jmp play - jmp sound - -maxvol dta b(15) -volume dta d' ' -freqen dta d' ' -kanal dta d' ' -aktwys dta d' ' -numdzw dta d' ' -audctl dta d' ' -aud1 dta b(0) -aud2 dta b(0) - -voltab dta d' ' - dta d' !!!!!!!!' - dta d' !!!!!!!!""""' - dta d' !!!!!"""""###' - dta d' !!!!""""####$$' - dta d' !!!"""###$$$%%' - dta d' !!"""##$$$%%&&' - dta d' !!""##$$%%&&''''' - dta d' !!""##$$%%&&''''(' - dta d' !!""#$$%%&''''(()' - dta d' !!"##$%%&''''())*' - dta d' !!"#$$%&''''()**+' - dta d' !""#$%&&''()**+,' - dta d' !"##$%&''()**+,-' - dta d' !"#$%&''''()*+,-.' - dta d' !"#$%&''()*+,-./' - -frqtab dta b(0),b($f1),b($e4),b($d7) - dta b($cb),b($c0),b($b5),b($aa) - dta b($a1),b($98),b($8f),b($87) - dta b($7f),b($78),b($72),b($6b) - dta b($65),b($5f),b($5a),b($55) - dta b($50),b($4b),b($47),b($43) - dta b($3f),b($3c),b($38),b($35) - dta b($32),b($2f),b($2c),b($2a) - dta b($27),b($25),b($23),b($21) - dta b($1f),b($1d),b($1c),b($1a) - dta b($18),b($17),b($16),b($14) - dta b($13),b($12),b($11),b($10) - dta b(15),b(14),b(13),b(12) - dta b(11),b(10),b(9),b(8) - dta b(7),b(6),b(5),b(4) - dta b(3),b(2),b(1),b(0) - - dta b(0),b($f2),b($e6),b($da) - dta b($ce),b($bf),b($b6),b($aa) - dta b($a1),b($98),b($8f),b($89) - dta b($80),b($7a),b($71),b($6b) - dta b($65),b($5f),b($5c),b($56) - dta b($50),b($4d),b($47),b($44) - dta b($3e),b($3c),b($38),b($35) - dta b($32),b($2f),b($2d),b($2a) - dta b($28),b($25),b($23),b($21) - dta b($1f),b($1d),b($1c),b($1a) - dta b($18),b($17),b($16),b($14) - dta b($13),b($12),b($11),b($10) - dta b(15),b(14),b(13),b(12) - dta b(11),b(10),b(9),b(8) - dta b(7),b(6),b(5),b(4) - dta b(3),b(2),b(1),b(0) - - dta b(0),b($ff),b($f1),b($e4) - dta b($d8),b($ca),b($c0),b($b5) - dta b($ab),b($a2),b($99),b($8e) - dta b($87),b($7f),b($79),b($73) - dta b($70),b($66),b($61),b($5a) - dta b($55),b($52),b($4b),b($48) - dta b($43),b($3f),b($3c),b($39) - dta b($37),b($33),b($30),b($2d) - dta b($2a),b($28),b($25),b($24) - dta b($21),b($1f),b($1e),b($1c) - dta b($1b),b($19),b($17),b($16) - dta b($15),b($13),b($12),b($11) - dta b($10),b(15),b(14),b(13) - dta b(12),b(11),b(10),b(9) - dta b(8),b(7),b(6),b(5) - dta b(4),b(3),b(2),b(1) - - dta b(0),b($f3),b($e6),b($d9) - dta b($cc),b($c1),b($b5),b($ad) - dta b($a2),b($99),b($90),b($88) - dta b($80),b($79),b($72),b($6c) - dta b($66),b($60),b($5b),b($55) - dta b($51),b($4c),b($48),b($44) - dta b($40),b($3c),b($39),b($35) - dta b($32),b($2f),b($2d),b($2a) - dta b($28),b($25),b($23),b($21) - dta b($1f),b($1d),b($1c),b($1a) - dta b($18),b($17),b($16),b($14) - dta b($13),b($12),b($11),b($10) - dta b(15),b(14),b(13),b(12) - dta b(11),b(10),b(9),b(8) - dta b(7),b(6),b(5),b(4) - dta b(3),b(2),b(1),b(0) - -basslo dta b(0),b($f2),b($33),b($96) - dta b($e2),b($38),b($8c),b($00) - dta b($6a),b($e8),b($6a),b($ef) - dta b($80),b($08),b($ae),b($46) - dta b($e6),b($95),b($41),b($f6) - dta b($b0),b($6e),b($30),b($f6) - dta b($bb),b($84),b($52),b($22) - dta b($f4),b($c8),b($a0),b($7a) - dta b($55),b($34),b($14),b($f5) - dta b($d8),b($bd),b($a4),b($8d) - dta b($77),b($60),b($4e),b($38) - dta b($27),b($15),b($06),b($f7) - dta b($e8),b($db),b($cf),b($c3) - dta b($b8),b($ac),b($a2),b($9a) - dta b($90),b($88),b($7f),b($78) - dta b($70),b($6a),b($64),b($5e) - -basshi dta b(0),b(13),b(13),b(12) - dta b(11),b(11),b(10),b(10) - dta b(9),b(8),b(8),b(7) - dta b(7),b(7),b(6),b(6) - dta b(5),b(5),b(5),b(4) - dta b(4),b(4),b(4),b(3) - dta b(3),b(3),b(3),b(3) - dta b(2),b(2),b(2),b(2) - dta b(2),b(2),b(2),b(1) - dta b(1),b(1),b(1),b(1) - dta b(1),b(1),b(1),b(1) - dta b(1),b(1),b(1),b(0) - dta b(0),b(0),b(0),b(0) - dta b(0),b(0),b(0),b(0) - dta b(0),b(0),b(0),b(0) - dta b(0),b(0),b(0),b(0) - -czygrx dta d' ' -pozwpt dta d' ' -delay dta d' ' -numptr dta d' ' -poddzw dta d' ' -wysdzw dta d' ' -znksz dta d' ' -frq dta d' ' -vol1ch dta d' ' -vol2ch dta d' ' -adcvl1 dta d' ' -adcvl2 dta d' ' -adrsnl dta d' ' -adrsnh dta d' ' -slupy dta d' ' -opad1 dta d' ' -opad2 dta d' ' -lopad1 dta d' ' -lopad2 dta d' ' -typ dta d' ' -param dta d' ' -pomoc1 dta d' ' -pomoc2 dta d' ' -czekaj dta d' ' -dtyp dta d' ' -ltyp dta d' ' -ilperm dta d' ' -aperm dta d' ' -dperm dta d' ' -lperm dta d' ' -kolejn dta d' ' -tempo dta b(0) -ltempo dta b(0) -pozptr dta b(0) -czygrc dta b(0) - -przeci dta b(4),b(5),b(6),b(7) - dta b(0),b(1),b(2),b(3) -audtb1 dta b(4),b(2),b(0),b(0) - dta b(4),b(2),b(0),b(0) -audtb2 dta b(0),b(16),b(0),b(8) - dta b(0),b(16),b(0),b(8) - -play lda czygrc - beq r1-3 - lda pozptr - cmp #64 - bcc r1 - dec ltempo - beq *+5 - jmp sound - - ldx #7 - lda #0 -p1 sta pozwpt,x - sta delay,x - dex - bpl p1 - sta pozptr - tax - ldy #15 -p2 lda (adrsng),y - bpl p3 - dey - lda (adrsng),y - bpl *+5 - jmp stop - stx addr - asl @ - asl @ - rol addr - asl @ - rol addr - asl @ - rol addr -zm0 adc #0 - sta adrsng - lda addr -zm1 adc #0 - sta adrsng+1 - bcc p2-2 -p3 sta numptr,x - dey - lda (adrsng),y - sta poddzw,x - inx - dey - bpl p2 - clc - lda adrsng - adc #16 - sta adrsng - bcc *+4 - inc adrsng+1 - jmp sound - -r1 dec ltempo - bpl r1-3 - inc pozptr - lda tempo - sta ltempo - ldx #7 -r2 dec delay,x - bmi *+5 - jmp r14 - ldy numptr,x -zm2 lda $ffff,y - sta addr -zm3 lda $ffff,y - sta addr+1 - ldy pozwpt,x -r3 lda (addr),y - bne r4 - jsr nparam - jmp r13 -r4 cmp #$40 - bcs r5 - adc poddzw,x - sta wysdzw,x - jsr nparam - ldy numdzw,x - jsr dzwiek - jmp r13 -r5 bne r8 - iny - inc pozwpt,x - lda (addr),y - bpl r6 - sta bajt - jsr nparam - lda bajt -r6 and #$7f - bne r7 - lda #64 - sta pozptr - bne r13 -r7 sta tempo - sta ltempo - bne r13 -r8 cmp #$80 - bcs r11 - and #$3f - adc poddzw,x - sta wysdzw,x - iny - inc pozwpt,x - lda (addr),y - and #127 - bne r9 - lda #64 - sta pozptr - bne r10 -r9 sta tempo - sta ltempo -r10 jsr nparam - ldy numdzw,x - jsr dzwiek - jmp r13 -r11 cmp #$c0 - bcs r12 - and #$3f - sta numdzw,x - iny - inc pozwpt,x - jmp r3 -r12 and #$3f - sta delay,x -r13 inc pozwpt,x -r14 dex - bmi sound - jmp r2 - -sound ldx #7 -p5 lda czygrx,x - beq p6 - jsr graj - lda audctl,x - and audtb1,x - beq p6 - ldy #71 - lda (addr),y - clc - adc aktwys,x - sta aktwys+2,x - tay - lda frqtab,y - sec - adc pomoc1,x - sta frq+2,x -p6 dex - bpl p5 - - asl maxvol - asl maxvol - asl maxvol - asl maxvol - inx - stx addr - stx addr+1 - ldx #7 -p9 txa - tay - lda vol1ch,y - bne p10 - ldy przeci,x - lda vol2ch,y - bne p10 - txa - tay - lda #0 -p10 sta byte - tya - sta kanal,x - lda frq,y - sta freqen,x - lda audctl,y - sta bajt - ora addr+1 - sta addr+1 - lda bajt - and audtb1,x - beq p11 - lda frq+2,y - sta freqen+2,x -p11 lda bajt - and audtb2,x - beq p12 - lda aktwys,y - and #$3f - tay - iny - sty addr - lda basshi-1,y - sta freqen,x - jmp p13 -p12 ldy addr - beq p13 - lda basslo-1,y - sta freqen,x - lda #0 - sta addr -p13 lda byte - ora maxvol - tay - lda voltab,y - ldy kanal,x - ora znksz,y - sta volume,x - cpx #4 - bne p14 - lda addr+1 - sta aud2 - lda #0 - sta addr+1 -p14 dex - bpl p9 - lsr maxvol - lsr maxvol - lsr maxvol - lsr maxvol - lda addr+1 -quit ldx #3 - stx $d21f - stx $d20f - ldx freqen+4 - ldy freqen - stx $d210 - sty $d200 - ldx volume+4 - ldy volume - stx $d211 - sty $d201 - ldx freqen+5 - ldy freqen+1 - stx $d212 - sty $d202 - ldx volume+5 - ldy volume+1 - stx $d213 - sty $d203 - ldx freqen+6 - ldy freqen+2 - stx $d214 - sty $d204 - ldx volume+6 - ldy volume+2 - stx $d215 - sty $d205 - ldx freqen+7 - ldy freqen+3 - stx $d216 - sty $d206 - ldx volume+7 - ldy volume+3 - stx $d217 - sty $d207 - sta aud1 - ldx aud2 - stx $d218 - sta $d208 - rts - -graj lda adrsnl,x - sta addr - lda adrsnh,x - sta addr+1 - ldy slupy,x - cpy #63 - beq n6 - inc slupy,x - inc slupy,x - inc slupy,x - lda (addr),y - and #$f0 - sta znksz,x - lda (addr),y - and #15 - sec - sbc adcvl1,x - bpl n1 - lda #0 -n1 sta vol1ch,x - iny - lda (addr),y - and #15 - sec - sbc adcvl2,x - bpl n2 - lda #0 -n2 sta vol2ch,x - lda (addr),y - and #$f0 - beq n8 - bpl n3 - ldy #73 - lda (addr),y - ldy slupy,x - dey - dey - bpl n4 -n3 lda #0 -n4 sta audctl,x - lda (addr),y - and #$70 - beq n9 - lsr @ - lsr @ - sta n5+1 - lda #0 - sta pomoc1,x - iny - lda (addr),y -n5 bcc * - nop - nop - nop - nop - jmp a1 - nop - jmp a2 - nop - jmp a3 - nop - jmp a4 - nop - jmp a5 - nop - jmp a6 - nop - jmp a7 -n6 lda opad1,x - beq n7 - dec lopad1,x - bne n7 - sta lopad1,x - lda vol1ch,x - and #15 - beq n7 - dec vol1ch,x -n7 lda opad2,x - beq n8 - dec lopad2,x - bne n8 - sta lopad2,x - lda vol2ch,x - and #15 - beq n8 - dec vol2ch,x -n8 ldy #72 - lda (addr),y - sta audctl,x -n9 lda aperm,x - clc - adc #63 - tay - lda (addr),y - adc wysdzw,x - sta aktwys,x - tay - lda frqtab,y - sta frq,x - dec lperm,x - bpl m1 - lda dperm,x - sta lperm,x - lda kolejn,x - beq m6 - clc - adc aperm,x - sta aperm,x - beq m7 - cmp ilperm,x - bne m1 - lda #$fe -m7 clc - adc #1 - sta kolejn,x - bne m1 -m6 inc aperm,x - lda ilperm,x - cmp aperm,x - bcs m1 - lda #0 - sta aperm,x -m1 lda czekaj,x - beq m2 - dec czekaj,x - rts -m2 lda pomoc2,x - sta byte - lda param,x - sta bajt - jsr m4 - dec ltyp,x - bpl m4-1 - lda byte - sta pomoc2,x - lda bajt - sta param,x - lda dtyp,x - sta ltyp,x - rts -m4 lda typ,x - sta m5+1 -m5 bpl * - jmp typ0 - nop - jmp typ1 - nop - jmp typ2 - nop - jmp typ3 - nop - jmp typ4 - nop - jmp typ5 - nop - jmp typ6 - nop - jmp typ7 - -typ1 lda byte - inc byte - and #3 - lsr @ - bcc t2 - bne typ6 - lda bajt -t1 sta pomoc1,x - clc - adc frq,x - sta frq,x -typ0 rts -t2 lda #0 - sta pomoc1,x - rts -typ2 jsr t5 - jmp t1 -typ3 jsr t5 - clc - adc aktwys,x - jmp a5 -typ4 lda byte - sta pomoc1,x - clc - adc frq,x -t3 sta frq,x - lda byte - clc - adc bajt - sta byte - rts -typ5 lda aktwys,x - sec - sbc byte - sta aktwys,x - tay - lda frqtab,y - jmp t3 -typ6 lda frq,x - sec - sbc bajt - sta frq,x - sec - lda #0 - sbc bajt - sta pomoc1,x - rts -typ7 lda ltyp,x - bne typ0 - lda bajt - bpl t4 - lda vol2ch,x - beq typ0 - lda vol1ch,x - cmp #15 - beq typ0 - inc vol1ch,x - rts -t4 lda vol1ch,x - beq typ0 - lda vol2ch,x - cmp #15 - beq typ0 - inc vol2ch,x - rts -t5 ldy byte - lda bajt - bmi t6 - iny - iny -t6 dey - tya - sta byte - cmp bajt - bne t7 - lda bajt - eor #$ff - sta bajt -t7 tya - rts - -a2 adc frq,x -a1 sta frq,x - rts -a3 ldy wysdzw,x - adc frqtab,y - sta frq,x - tya - sta aktwys,x - rts -a4 and $d20a - sta frq,x - rts -a7 adc wysdzw,x -a5 sta aktwys,x - tay - lda frqtab,y - sta frq,x - rts -a6 sta aktwys,x - tay - lda frq,x - adc frqtab,y - sta frq,x - rts - -nparam iny - inc pozwpt,x - lda (addr),y - lsr @ - lsr @ - lsr @ - lsr @ - sta adcvl1,x - lda (addr),y - and #15 - sta adcvl2,x - rts - -songx jsr stop - ldy #15 -zm4 lda #0 - sta adrsng -zm5 lda #0 - sta adrsng+1 -d5 txa - beq inic -d3 lda (adrsng),y - bpl d4 - dex -d4 clc - lda adrsng - adc #16 - sta adrsng - bcc d5 - inc adrsng+1 - bcs d5 - -playx jsr stop - lda #0 - sta addr - txa - asl @ - asl @ - rol addr - asl @ - rol addr - asl @ - rol addr -zm6 adc #0 - sta adrsng - lda addr -zm7 adc #0 - sta adrsng+1 -inic lda #64 - sta pozptr - lda #1 - sta ltempo - sta czygrc - rts - -init cmp #$10 - bcc songx - cmp #$20 - bcc playx - cmp #$30 - bcs *+5 - jmp d2 - cmp #$40 - bcs i1 - txa - and #15 - beq i1-1 - sta tempo - rts -i1 cmp #$50 - bcc stop - cmp #$60 - bcs i2 - lda #0 -i3 sta czygrc - rts -i2 cmp #$70 - bcc i3 - - lda #1 - sta ltempo - lda #64 - sta pozptr - sty addr - stx addr+1 - ldy #30 - lda (addr),y - sta tempo - lda addr - clc - adc #32 - sta zm8+1 - bcc *+3 - inx - stx zm8+2 - clc - adc #$40 - sta zm9+1 - bcc *+3 - inx - stx zm9+2 - clc - adc #$40 - sta zm2+1 - bcc *+3 - inx - stx zm2+2 - clc - adc #$80 - sta zm3+1 - bcc *+3 - inx - stx zm3+2 - clc - adc #$80 - sta adrsng - sta zm0+1 - sta zm4+1 - sta zm6+1 - bcc *+3 - inx - stx adrsng+1 - stx zm1+1 - stx zm5+1 - stx zm7+1 - -stop ldy #7 - lda #0 - sta czygrc -d9 sta $d200,y - sta $d210,y - sta volume,y - sta vol1ch,y - sta vol2ch,y - sta audctl,y - sta czygrx,y - dey - bpl d9 - sta $d208 - sta $d218 - sta aud1 - sta aud2 - rts - -d1 sta vol1ch,x - sta vol2ch,x - sta audctl,x - lda wysdzw,x - sta aktwys,x - rts -d0 tya - eor #$f0 - lsr @ - lsr @ - lsr @ - lsr @ - sta adcvl1,x - tya - and #15 - eor #15 - sta adcvl2,x - rts -d2 and #7 - sta addr - txa - ldx addr - and #$3f - beq d0 - sta wysdzw,x -dzwiek lda #0 - sta czygrx,x -zm8 lda $ffff,y - sta adrsnl,x - sta addr -zm9 lda $ffff,y - sta adrsnh,x - sta addr+1 - ora addr - beq d1 - ldy #74 - lda (addr),y - sta opad1,x - sta lopad1,x - iny - lda (addr),y - sta opad2,x - sta lopad2,x - iny - lda (addr),y - and #$70 - lsr @ - lsr @ - sta typ,x - lda (addr),y - and #15 - sta param,x - lda (addr),y - bpl d7 - lda param,x - eor #$ff - clc - adc #1 - sta param,x -d7 iny - lda (addr),y - sta czekaj,x - iny - lda (addr),y - and #$3f - sta dtyp,x - sta ltyp,x - iny - lda (addr),y - and #$80 - beq d8 - lda #1 -d8 sta kolejn,x - lda (addr),y - and #$70 - lsr @ - lsr @ - lsr @ - lsr @ - sta ilperm,x - bne d6 - sta kolejn,x -d6 lda (addr),y - and #15 - sta dperm,x - sta lperm,x - dey - lda (addr),y - and #$c0 - clc - adc wysdzw,x - sta wysdzw,x - sta aktwys,x - tay - lda frqtab,y - sta frq,x - lda #0 - sta slupy,x - sta pomoc1,x - sta pomoc2,x - sta aperm,x - lda #1 - sta czygrx,x - rts - -endplr end Binary files /tmp/tmpyaM5l1/AUpGL9bywb/kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/tmc.obx and /tmp/tmpyaM5l1/KBGCC02aAO/kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/tmc.obx differ diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/xexb.asx kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/xexb.asx --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/xexb.asx 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/xexb.asx 1970-01-01 00:00:00.000000000 +0000 @@ -1,103 +0,0 @@ -HIDE_AUTHOR equ 0 - ift HIDE_AUTHOR -countdown equ $fca7 - els -countdown equ $fc98 - eif - - org $124 -main - sei - mvy #0 ^4e - lda:rne ^4b - sta ^40 - ldx #29 - sta:rpl ^00,x- - ert *!=$13a - ldx #8 -init_pokey_1 - sta $d210,x - sta $d200,x - dex:bpl init_pokey_1 - lda #3 - sta $d21f - sta $d200 - -; check PAL vs NTSC ANTIC -; possible NTSC GTIA with PAL ANTIC - lda #130 - cmp:rne ^4b -:3 sta ^4a - lda ^4b - sne:inc ntsc - - lda song - jsr init - -; TODO: support 400/800/600XL - mva #$fe ^31 - lda nmi $fffb - mva #$40 ^4e - - lda #125 - -player_loop - cmp:rne ^4b - jsr player - ldx #0 -ntsc equ *-1 - lda fastplay_low_bit - lsr @ - bcc fastplay_is_even - lda #0 -calls equ *-1 - inc calls - lsr @ -fastplay_is_even - lda vcount_period,x - adc #125 -expected_vcount equ *-1 - bcs next_frame - cmp vcount_wrap,x - bcc same_frame -next_frame - sbc vcount_wrap,x - sec -same_frame - sta expected_vcount - lda frame_period,x - adc #0 -expected_frame equ *-1 - sta expected_frame - cmp #0 -frame equ *-1 - rne - lda expected_vcount - bcs player_loop ! - -nmi_info - pha - txa:pha - ldx ntsc - jsr countdown - pla:tax - pla -nmi - inc frame - rti - -vcount_wrap dta 156,131 -init dta {jmp 0} - opt o- - dta a(0) -player jmp 0 -song dta 0 -fastplay_low_bit dta 0 -vcount_period dta 0,0 -frame_period dta 0,0 - - end Binary files /tmp/tmpyaM5l1/AUpGL9bywb/kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/xexb.obx and /tmp/tmpyaM5l1/KBGCC02aAO/kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/xexb.obx differ diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/xexd.asx kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/xexd.asx --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/xexd.asx 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/xexd.asx 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -HIDE_AUTHOR equ 0 - ift HIDE_AUTHOR -countdown equ $fca7 - els -countdown equ $fc98 - eif - - org $124 -main - sei - mvy #0 ^4e - lda:rne ^4b - sta ^40 - ldx #29 - sta:rpl ^00,x- - ert *!=$13a - sta ^2e - ldx #8 -init_pokey_1 - sta $d210,x - sta $d200,x - dex:bpl init_pokey_1 - lda #3 - sta $d21f - sta $d200 - -; TODO: support 400/800/600XL - mva #$fe ^31 - lda player - cmp #{rts} - beq no_player - mwa #nmi $fffa - mva #$40 ^4e -no_player - lda song - cli - jmp init - -nmi - plp:php ; unblock IRQ if NMI blocked it - pha - txa:pha - tya:pha - jsr player - ldx $135 - beq no_info - ldx $d014 - dex - seq:ldx #1 - jsr countdown -no_info - pla:tay - pla:tax - pla:rti - -init dta {jmp 0} - opt o- - dta a(0) -player jmp 0 -song dta 0 - - end Binary files /tmp/tmpyaM5l1/AUpGL9bywb/kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/xexd.obx and /tmp/tmpyaM5l1/KBGCC02aAO/kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/xexd.obx differ diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/xexinfo.asx kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/xexinfo.asx --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/xexinfo.asx 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/xexinfo.asx 1970-01-01 00:00:00.000000000 +0000 @@ -1,165 +0,0 @@ -HIDE_AUTHOR equ 0 - -font equ $fc00 - - ift TEST - - org $8000 -scr - dta c'404 Error ' -:8 dta $55 - ift HIDE_AUTHOR -hidden - dta c'(press space to show author) ' - dta c' ' -author - eif - dta c'by Grzegorz Kwiatek (Greg) ' - dta c' & Lukasz Sychowicz (X-Ray) ' -date - dta c'01/03/2003 STEREO 02:26' - -dl -:22 dta $70 - dta $30,$62,a(scr),8,0 - ift HIDE_AUTHOR - dta $42 -dl_author - dta a(hidden),2,$10,$42,a(date) - dta $41,a(dl) -show_author - mwa #author dl_author - els - dta 2,2,$10,2 - dta $41,a(dl) - eif - - els - - org $fc50 - ift HIDE_AUTHOR -dl org *+39 - -show_author - org *+10 - rts - - els -dl org *+32 - dta $41,a(dl) - eif - - eif - -show_info - lda:rne ^4b - sta ^45 - mvx #$26 ^16 - mvx #$0a ^17 - mvx #$21 ^40 - mwx #dl ^42 -:>font!=>dl ldx >font - stx ^49 - - ift TEST - - mwa #vbl $fffa - mva #$40 ^4e - jmp * - -vbl - pha - txa:pha - ldx $d014 - dex - seq:ldx #1 - jsr countdown - pla:tax - pla:rti - - els - - rts - - eif - -countdown - ift HIDE_AUTHOR - lda #4 - bit $d20f - bne no_author - lda $d209 - cmp #$21 - bne no_author - jsr show_author -no_author - eif - - cld - lda countdown_framerate_lo,x - add #0 - sta *-1 - lda countdown_framerate_hi,x - adc #0 - sta *-1 - bcc countdown_skip - lda dl-5 - ora dl-4 - ora dl-2 - ora dl-1 - cmp #'1' - ldx #4 - bcs countdown_start -countdown_skip - rts - -countdown_wrap - lda #'9' - cpx #3 - sne:lda #'5' - sta dl-5,x -countdown_next - dex -countdown_start - lda dl-5,x - cmp #'1' - bcc countdown_wrap - cmp #':' - beq countdown_next - - dec dl-5,x - rts - -countdown_framerate_lo dta l(312*114/2*65536/[1773447/2],262*114*65536/1789772) -countdown_framerate_hi dta h(312*114/2*65536/[1773447/2],262*114*65536/1789772) - - org $100 -main - sei - mvy #0 ^4e - lda:rne ^4b - sta ^40 - ldx #29 - sta:rpl ^00,x- -; copy font from ROM, reordering from ANTIC codes to ASCII, semigraphics not needed -copy_font_1 - stx ^31 ; #$ff - lda:pha $e000,y ; punctuation - lda:pha $e100,y ; uppercase - lda $e300,y ; lowercase - dex:stx ^31 - inx - sta font+$300,y ; lowercase - pla:sta font+$200,y ; uppercase - pla:sta font+$100,y ; punctuation - iny - bne copy_font_1 - jsr show_info - ert *!=$13a - - ift TEST - jmp * - run main - eif - - end Binary files /tmp/tmpyaM5l1/AUpGL9bywb/kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/6502/xexinfo.obx and /tmp/tmpyaM5l1/KBGCC02aAO/kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/6502/xexinfo.obx differ diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/aatr.c kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/aatr.c --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/aatr.c 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/aatr.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,225 +0,0 @@ -/* - * aatr.c - another ATR file extractor - * - * Copyright (C) 2012 Piotr Fusik - * - * This file is part of ASAP (Another Slight Atari Player), - * see http://asap.sourceforge.net - * - * ASAP is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. - * - * ASAP is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ASAP; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include -#include "aatr.h" - -struct AATR -{ - FILE *fp; - int bytes_per_sector; - int sector4_offset; - int file_no; - unsigned char dir_sector[128]; - char filename[8 + 1 + 3 + 1]; -}; - -AATR *AATR_New(void) -{ - AATR *self = (AATR *) malloc(sizeof(AATR)); - self->fp = NULL; - return self; -} - -void AATR_Delete(AATR *self) -{ - if (self->fp != NULL) - fclose(self->fp); - free(self); -} - -static int fgetw(FILE *fp) -{ - int lo = fgetc(fp); - int hi; - if (lo < 0) - return -1; - hi = fgetc(fp); - if (hi < 0) - return -1; - return lo + (hi << 8); -} - -cibool AATR_Open(AATR *self, const char *filename) -{ - FILE *fp; - int paragraphs; - fp = fopen(filename, "rb"); - if (fp == NULL) - return FALSE; - if (fgetw(fp) != 0x296) { - fclose(fp); - return FALSE; - } - paragraphs = fgetw(fp); - if ((paragraphs & 7) != 0) { - fclose(fp); - return FALSE; - } - self->bytes_per_sector = fgetw(fp); - self->sector4_offset = 0x190; - switch (self->bytes_per_sector) { - case 0x80: - break; - case 0x100: - if ((paragraphs & 8) == 0) - self->sector4_offset = 0x310; - break; - default: - fclose(fp); - return FALSE; - } - self->fp = fp; - self->file_no = -1; - return TRUE; -} - -static cibool AATR_ReadSector(AATR *self, int sector, unsigned char buffer[], int length) -{ - if (sector < 4) - return FALSE; - if (fseek(self->fp, self->sector4_offset + (sector - 4) * self->bytes_per_sector, SEEK_SET) != 0) - return FALSE; - return fread(buffer, length, 1, self->fp) == 1; -} - -static int filename_part_chars(const char *p, int max) -{ - int i; - for (i = 0; i < max; i++) { - char c = p[i]; - if (c == ' ') { - int result = i; - /* make sure no spaces in filename */ - while (++i < max) { - if (p[i] != ' ') - return -1; - } - return result; - } - if ((c >= '0' && c <= '9') - || (c >= 'A' && c <= 'Z') - || c == '_') - continue; - return -1; - } - return max; -} - -const char *AATR_NextFile(AATR *self) -{ - int i; - int filename_chars; - int ext_chars; - for (;;) { - const char *filename; - if (self->file_no >= 63) - break; - self->file_no++; - i = (self->file_no & 7) << 4; - if (i == 0) { - if (!AATR_ReadSector(self, 361 + (self->file_no >> 3), self->dir_sector, 128)) - break; - } - switch (self->dir_sector[i] & 0xd7) { /* mask out readonly and unused bits */ - case 0x00: /* end of directory */ - break; - case 0x42: /* DOS 2 file */ - case 0x46: /* MyDOS file */ - case 0x03: /* DOS 2.5 file */ - break; - default: - continue; - } - filename = (const char *) self->dir_sector + i + 5; - filename_chars = filename_part_chars(filename, 8); - ext_chars = filename_part_chars(filename + 8, 3); - if (filename_chars < 0 || ext_chars < 0 || (filename_chars == 0 && ext_chars == 0)) - continue; - sprintf(self->filename, "%.*s.%.*s", filename_chars, filename, ext_chars, filename + 8); - return self->filename; - } - fclose(self->fp); - self->fp = NULL; - return NULL; -} - -int AATR_ReadCurrentFile(AATR *self, unsigned char output[], int length) -{ - int result = 0; - int i = (self->file_no & 7) << 4; - int sector = self->dir_sector[i + 3] + (self->dir_sector[i + 4] << 8); - while (sector != 0 && length > 0) { - unsigned char sector_data[256]; - int sector_used; - if (!AATR_ReadSector(self, sector, sector_data, self->bytes_per_sector)) - return -1; - sector_used = sector_data[self->bytes_per_sector - 1]; - if (sector_used > length) - sector_used = length; - if (output != NULL) - memcpy(output + result, sector_data, sector_used); - result += sector_used; - length -= sector_used; - sector = (sector_data[self->bytes_per_sector - 2] + (sector_data[self->bytes_per_sector - 3] << 8)) & 0x3ff; - } - return result; -} - -int AATR_ReadFile(const char *atr_filename, const char *inside_filename, unsigned char output[], int length) -{ - AATR aatr; - if (!AATR_Open(&aatr, atr_filename)) - return -1; - for (;;) { - const char *current_filename = AATR_NextFile(&aatr); - if (current_filename == NULL) - return -1; - if (strcmp(current_filename, inside_filename) == 0) { - length = AATR_ReadCurrentFile(&aatr, output, length); - fclose(aatr.fp); - return length; - } - } -} - -#if 0 -int main(int argc, char **argv) -{ - AATR aatr; - if (!AATR_Open(&aatr, "C:\\0\\a8\\asap\\TMC2.atr")) - return 1; - for (;;) { - const char *current_filename = AATR_NextFile(&aatr); - unsigned char buffer[30000]; - int length; - if (current_filename == NULL) - break; - length = AATR_ReadCurrentFile(&aatr, buffer, sizeof(buffer)); - printf("%s (%d)\n", current_filename, length); - } - return 0; -} -#endif diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/aatr.h kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/aatr.h --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/aatr.h 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/aatr.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -/* - * aatr.h - another ATR file extractor - * - * Copyright (C) 2012 Piotr Fusik - * - * This file is part of ASAP (Another Slight Atari Player), - * see http://asap.sourceforge.net - * - * ASAP is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. - * - * ASAP is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ASAP; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef _AATR_H_ -#define _AATR_H_ -#ifndef _ASAP_H_ /* FIXME */ -typedef int cibool; -#endif -#ifndef TRUE -#define TRUE 1 -#endif -#ifndef FALSE -#define FALSE 0 -#endif -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct AATR AATR; - -AATR *AATR_New(void); -void AATR_Delete(AATR *self); -cibool AATR_Open(AATR *self, const char *filename); -const char *AATR_NextFile(AATR *self); -int AATR_ReadCurrentFile(AATR *self, unsigned char output[], int length); -int AATR_ReadFile(const char *atr_filename, const char *inside_filename, unsigned char output[], int length); - -#ifdef __cplusplus -} -#endif -#endif diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/asap6502.ci kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/asap6502.ci --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/asap6502.ci 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/asap6502.ci 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -// asap6502.ci - player routines for the 6502 CPU -// -// Copyright (C) 2011 Piotr Fusik -// -// This file is part of ASAP (Another Slight Atari Player), -// see http://asap.sourceforge.net -// -// ASAP is free software; you can redistribute it and/or modify it -// under the terms of the GNU General Public License as published -// by the Free Software Foundation; either version 2 of the License, -// or (at your option) any later version. -// -// ASAP is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -// See the GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ASAP; if not, write to the Free Software Foundation, Inc., -// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -class ASAP6502 -{ - static byte[] GetPlayerRoutine(ASAPInfo info) - { - switch (info.Type) { - case ASAPModuleType.Cmc: return BinaryResource("cmc.obx"); - case ASAPModuleType.Cm3: return BinaryResource("cm3.obx"); - case ASAPModuleType.Cmr: return BinaryResource("cmr.obx"); - case ASAPModuleType.Cms: return BinaryResource("cms.obx"); - case ASAPModuleType.Dlt: return BinaryResource("dlt.obx"); - case ASAPModuleType.Mpt: return BinaryResource("mpt.obx"); - case ASAPModuleType.Rmt: return info.Channels == 1 ? BinaryResource("rmt4.obx") : BinaryResource("rmt8.obx"); - case ASAPModuleType.Tmc: return BinaryResource("tmc.obx"); - case ASAPModuleType.Tm2: return BinaryResource("tm2.obx"); - case ASAPModuleType.Fc: return BinaryResource("fc.obx"); - default: return null; - } - } -} diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/asap.c kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/asap.c --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/asap.c 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/asap.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,9159 +0,0 @@ -/* Generated automatically with "cito". Do not edit. */ -#include -#include -#include "asap.h" - -typedef enum { - ASAPModuleType_SAP_B, - ASAPModuleType_SAP_C, - ASAPModuleType_SAP_D, - ASAPModuleType_SAP_S, - ASAPModuleType_CMC, - ASAPModuleType_CM3, - ASAPModuleType_CMR, - ASAPModuleType_CMS, - ASAPModuleType_DLT, - ASAPModuleType_MPT, - ASAPModuleType_RMT, - ASAPModuleType_TMC, - ASAPModuleType_TM2, - ASAPModuleType_FC -} -ASAPModuleType; -typedef struct Cpu6502 Cpu6502; -typedef struct FlashPack FlashPack; -typedef struct FlashPackItem FlashPackItem; - -typedef enum { - FlashPackItemType_LITERAL, - FlashPackItemType_COPY_TWO_BYTES, - FlashPackItemType_COPY_THREE_BYTES, - FlashPackItemType_COPY_MANY_BYTES, - FlashPackItemType_SET_ADDRESS, - FlashPackItemType_END_OF_STREAM -} -FlashPackItemType; - -typedef enum { - FlashPackLoadState_START_LOW_BYTE, - FlashPackLoadState_START_HIGH_BYTE, - FlashPackLoadState_END_LOW_BYTE, - FlashPackLoadState_END_HIGH_BYTE, - FlashPackLoadState_CONTENT -} -FlashPackLoadState; - -typedef enum { - NmiStatus_RESET, - NmiStatus_ON_V_BLANK, - NmiStatus_WAS_V_BLANK -} -NmiStatus; -typedef struct Pokey Pokey; -typedef struct PokeyPair PokeyPair; - -struct Cpu6502 { - int a; - int c; - int nz; - int pc; - int s; - int vdi; - int x; - int y; -}; -static void Cpu6502_DoFrame(Cpu6502 *self, ASAP *asap, int cycleLimit); - -struct ASAPInfo { - int channels; - int covoxAddr; - int defaultSong; - int fastplay; - int headerLen; - int init; - int music; - cibool ntsc; - int player; - int songs; - ASAPModuleType type; - unsigned char songPos[32]; - char author[128]; - char date[128]; - int durations[32]; - char filename[128]; - cibool loops[32]; - char title[128]; -}; -static void ASAPInfo_AddSong(ASAPInfo *self, int playerCalls); -static int ASAPInfo_AfterFF(unsigned char const *module, int moduleLen, int currentOffset); -static int ASAPInfo_CheckDate(ASAPInfo const *self); -static cibool ASAPInfo_CheckTwoDateDigits(ASAPInfo const *self, int i); -static cibool ASAPInfo_CheckValidChar(int c); -static cibool ASAPInfo_CheckValidText(const char *s); -static int ASAPInfo_GetPackedExt(const char *filename); -static int ASAPInfo_GetRmtInstrumentFrames(unsigned char const *module, int instrument, int volume, int volumeFrame, cibool onExtraPokey); -static int ASAPInfo_GetRmtSapOffset(ASAPInfo const *self, unsigned char const *module, int moduleLen); -static int ASAPInfo_GetTwoDateDigits(ASAPInfo const *self, int i); -static int ASAPInfo_GetWord(unsigned char const *array, int i); -static int ASAPInfo_GuessPackedExt(unsigned char const *module, int moduleLen); -static cibool ASAPInfo_HasStringAt(unsigned char const *module, int moduleIndex, const char *s); -static cibool ASAPInfo_IsDltPatternEnd(unsigned char const *module, int pos, int i); -static cibool ASAPInfo_IsDltTrackEmpty(unsigned char const *module, int pos); -static cibool ASAPInfo_IsFcSongEnd(unsigned char const *module, int const *trackPos); -static cibool ASAPInfo_IsOurPackedExt(int ext); -static cibool ASAPInfo_IsValidChar(int c); -static cibool ASAPInfo_ParseCmc(ASAPInfo *self, unsigned char const *module, int moduleLen, ASAPModuleType type); -static void ASAPInfo_ParseCmcSong(ASAPInfo *self, unsigned char const *module, int pos); -static int ASAPInfo_ParseDec(unsigned char const *module, int moduleIndex, int maxVal); -static cibool ASAPInfo_ParseDlt(ASAPInfo *self, unsigned char const *module, int moduleLen); -static void ASAPInfo_ParseDltSong(ASAPInfo *self, unsigned char const *module, cibool *seen, int pos); -static cibool ASAPInfo_ParseFc(ASAPInfo *self, unsigned char const *module, int moduleLen); -static int ASAPInfo_ParseHex(unsigned char const *module, int moduleIndex); -static cibool ASAPInfo_ParseModule(ASAPInfo *self, unsigned char const *module, int moduleLen); -static cibool ASAPInfo_ParseMpt(ASAPInfo *self, unsigned char const *module, int moduleLen); -static void ASAPInfo_ParseMptSong(ASAPInfo *self, unsigned char const *module, cibool *globalSeen, int songLen, int pos); -static cibool ASAPInfo_ParseRmt(ASAPInfo *self, unsigned char const *module, int moduleLen); -static void ASAPInfo_ParseRmtSong(ASAPInfo *self, unsigned char const *module, cibool *globalSeen, int songLen, int posShift, int pos); -static cibool ASAPInfo_ParseSap(ASAPInfo *self, unsigned char const *module, int moduleLen); -static int ASAPInfo_ParseText(unsigned char const *module, int moduleIndex); -static cibool ASAPInfo_ParseTm2(ASAPInfo *self, unsigned char const *module, int moduleLen); -static void ASAPInfo_ParseTm2Song(ASAPInfo *self, unsigned char const *module, int pos); -static cibool ASAPInfo_ParseTmc(ASAPInfo *self, unsigned char const *module, int moduleLen); -static void ASAPInfo_ParseTmcSong(ASAPInfo *self, unsigned char const *module, int pos); -static int ASAPInfo_ParseTmcTitle(unsigned char *title, int titleLen, unsigned char const *module, int moduleOffset); -static cibool ASAPInfo_ValidateFc(unsigned char const *module, int moduleLen); -static cibool ASAPInfo_ValidateRmt(unsigned char const *module, int moduleLen); -static cibool ASAPInfo_ValidateSap(unsigned char const *module, int moduleLen); - -struct Pokey { - int audc1; - int audc2; - int audc3; - int audc4; - int audctl; - int audf1; - int audf2; - int audf3; - int audf4; - int delta1; - int delta2; - int delta3; - int delta4; - int divCycles; - cibool init; - int mute1; - int mute2; - int mute3; - int mute4; - int out1; - int out2; - int out3; - int out4; - int periodCycles1; - int periodCycles2; - int periodCycles3; - int periodCycles4; - int polyIndex; - int reloadCycles1; - int reloadCycles3; - int skctl; - int tickCycle1; - int tickCycle2; - int tickCycle3; - int tickCycle4; - int deltaBuffer[888]; -}; -static void Pokey_AddDelta(Pokey *self, PokeyPair const *pokeys, int cycle, int delta); -static void Pokey_EndFrame(Pokey *self, PokeyPair const *pokeys, int cycle); -static void Pokey_GenerateUntilCycle(Pokey *self, PokeyPair const *pokeys, int cycleLimit); -static void Pokey_Initialize(Pokey *self); -static cibool Pokey_IsSilent(Pokey const *self); -static void Pokey_Mute(Pokey *self, int mask); - -struct PokeyPair { - int extraPokeyMask; - int iirAccLeft; - int iirAccRight; - int irqst; - int readySamplesEnd; - int readySamplesStart; - int sampleFactor; - int sampleOffset; - int timer1Cycle; - int timer2Cycle; - int timer4Cycle; - unsigned char poly9Lookup[511]; - Pokey basePokey; - Pokey extraPokey; - unsigned char poly17Lookup[16385]; -}; -static void PokeyPair_Construct(PokeyPair *self); -static int PokeyPair_EndFrame(PokeyPair *self, int cycle); -static int PokeyPair_Generate(PokeyPair *self, unsigned char *buffer, int bufferOffset, int blocks, ASAPSampleFormat format); -static int PokeyPair_GetRandom(PokeyPair const *self, int addr, int cycle); -static void PokeyPair_Initialize(PokeyPair *self, cibool ntsc, cibool stereo); -static cibool PokeyPair_IsSilent(PokeyPair const *self); -static void PokeyPair_Poke(PokeyPair *self, int addr, int data, int cycle); -static void PokeyPair_StartFrame(PokeyPair *self); - -struct ASAP { - int blocksPlayed; - int consol; - unsigned char covox[4]; - int currentDuration; - int currentSong; - int cycle; - int nextEventCycle; - int nextPlayerCycle; - int nextScanlineCycle; - NmiStatus nmist; - int silenceCycles; - int silenceCyclesCounter; - int tmcPerFrameCounter; - Cpu6502 cpu; - ASAPInfo moduleInfo; - PokeyPair pokeys; - unsigned char memory[65536]; -}; -static void ASAP_Construct(ASAP *self); -static void ASAP_Call6502(ASAP *self, int addr); -static void ASAP_Call6502Player(ASAP *self); -static int ASAP_Do6502Frame(ASAP *self); -static cibool ASAP_Do6502Init(ASAP *self, int pc, int a, int x, int y); -static int ASAP_DoFrame(ASAP *self); -static int ASAP_GenerateAt(ASAP *self, unsigned char *buffer, int bufferOffset, int bufferLen, ASAPSampleFormat format); -static void ASAP_HandleEvent(ASAP *self); -static int ASAP_MillisecondsToBlocks(int milliseconds); -static int ASAP_PeekHardware(ASAP const *self, int addr); -static void ASAP_PokeHardware(ASAP *self, int addr, int data); -static void ASAP_PutLittleEndian(unsigned char *buffer, int offset, int value); -static void ASAP_PutLittleEndians(unsigned char *buffer, int offset, int value1, int value2); -static int ASAP_PutWavMetadata(unsigned char *buffer, int offset, int fourCC, const char *value); - -static unsigned char const *ASAP6502_GetPlayerRoutine(ASAPInfo const *info); -static const unsigned char CiBinaryResource_cm3_obx[2022] = { 255, 255, 0, 5, 223, 12, 76, 18, 11, 76, 120, 5, 76, 203, 7, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 160, 227, 237, 227, 160, 240, 236, 225, - 249, 229, 242, 160, 246, 160, 178, 174, 177, 160, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, - 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 141, 110, - 5, 142, 111, 5, 140, 112, 5, 41, 112, 74, 74, 74, 170, 189, 148, 11, - 141, 169, 5, 189, 149, 11, 141, 170, 5, 169, 3, 141, 15, 210, 216, 165, - 254, 72, 165, 255, 72, 172, 112, 5, 174, 111, 5, 173, 110, 5, 32, 178, - 5, 104, 133, 255, 104, 133, 254, 96, 173, 118, 5, 133, 254, 173, 119, 5, - 133, 255, 160, 0, 138, 240, 28, 177, 254, 201, 143, 240, 4, 201, 239, 208, - 12, 202, 208, 9, 200, 192, 84, 176, 9, 152, 170, 16, 6, 200, 192, 84, - 144, 229, 96, 142, 104, 5, 32, 123, 6, 169, 0, 162, 9, 157, 69, 5, - 202, 16, 250, 141, 103, 5, 169, 1, 141, 113, 5, 169, 255, 141, 106, 5, - 173, 114, 5, 133, 254, 173, 115, 5, 133, 255, 160, 19, 177, 254, 170, 173, - 118, 5, 133, 254, 173, 119, 5, 133, 255, 172, 104, 5, 177, 254, 201, 207, - 208, 13, 152, 24, 105, 85, 168, 177, 254, 48, 15, 170, 76, 52, 6, 201, - 143, 240, 7, 201, 239, 240, 3, 136, 16, 226, 142, 108, 5, 142, 109, 5, - 96, 41, 15, 240, 245, 142, 221, 10, 142, 243, 10, 142, 2, 11, 140, 222, - 10, 140, 244, 10, 140, 3, 11, 96, 142, 114, 5, 134, 254, 140, 115, 5, - 132, 255, 24, 138, 105, 20, 141, 116, 5, 152, 105, 0, 141, 117, 5, 142, - 118, 5, 200, 200, 140, 119, 5, 160, 19, 177, 254, 141, 108, 5, 141, 109, - 5, 162, 8, 169, 0, 141, 113, 5, 157, 0, 210, 224, 3, 176, 8, 157, - 9, 5, 169, 255, 157, 57, 5, 202, 16, 233, 169, 128, 162, 3, 157, 75, - 5, 202, 16, 250, 96, 169, 1, 141, 113, 5, 169, 0, 240, 238, 41, 3, - 201, 3, 240, 240, 224, 64, 176, 236, 192, 26, 176, 232, 170, 169, 128, 157, - 75, 5, 169, 0, 157, 57, 5, 157, 60, 5, 157, 63, 5, 173, 111, 5, - 157, 12, 5, 173, 112, 5, 10, 10, 10, 133, 254, 24, 173, 114, 5, 105, - 48, 72, 173, 115, 5, 105, 1, 168, 104, 24, 101, 254, 157, 97, 5, 152, - 105, 0, 157, 100, 5, 24, 173, 114, 5, 105, 148, 133, 254, 173, 115, 5, - 105, 0, 133, 255, 173, 112, 5, 10, 109, 112, 5, 10, 168, 177, 254, 157, - 79, 5, 200, 177, 254, 157, 82, 5, 41, 7, 141, 110, 5, 200, 177, 254, - 157, 85, 5, 200, 177, 254, 157, 88, 5, 200, 177, 254, 157, 91, 5, 200, - 177, 254, 157, 94, 5, 160, 0, 173, 110, 5, 201, 3, 208, 2, 160, 2, - 201, 7, 208, 2, 160, 4, 185, 178, 11, 133, 254, 185, 179, 11, 133, 255, - 189, 85, 5, 74, 74, 74, 74, 24, 109, 111, 5, 141, 111, 5, 141, 194, - 7, 168, 173, 110, 5, 201, 7, 208, 15, 152, 10, 168, 177, 254, 157, 45, - 5, 200, 140, 111, 5, 76, 131, 7, 177, 254, 157, 45, 5, 189, 85, 5, - 41, 15, 24, 109, 111, 5, 141, 111, 5, 172, 111, 5, 173, 110, 5, 201, - 5, 8, 177, 254, 40, 240, 8, 221, 45, 5, 208, 3, 56, 233, 1, 157, - 48, 5, 189, 79, 5, 72, 41, 3, 168, 185, 184, 11, 157, 54, 5, 104, - 74, 74, 74, 74, 160, 62, 201, 15, 240, 16, 160, 55, 201, 14, 240, 10, - 160, 48, 201, 13, 240, 4, 24, 105, 0, 168, 185, 188, 11, 157, 51, 5, - 96, 216, 165, 252, 72, 165, 253, 72, 165, 254, 72, 165, 255, 72, 173, 113, - 5, 208, 3, 76, 5, 11, 173, 78, 5, 240, 3, 76, 110, 9, 173, 108, - 5, 205, 109, 5, 240, 3, 76, 91, 9, 173, 103, 5, 240, 3, 76, 220, - 8, 162, 2, 188, 75, 5, 48, 3, 157, 75, 5, 157, 69, 5, 202, 16, - 242, 173, 118, 5, 133, 252, 173, 119, 5, 133, 253, 172, 104, 5, 132, 254, - 204, 106, 5, 208, 25, 173, 107, 5, 240, 20, 173, 104, 5, 172, 105, 5, - 140, 104, 5, 206, 107, 5, 208, 232, 141, 104, 5, 168, 16, 226, 162, 0, - 177, 252, 201, 254, 208, 14, 172, 104, 5, 200, 196, 254, 240, 67, 140, 104, - 5, 76, 26, 8, 157, 66, 5, 24, 152, 105, 85, 168, 232, 224, 3, 144, - 223, 172, 104, 5, 177, 252, 16, 122, 201, 255, 240, 118, 74, 74, 74, 41, - 14, 170, 189, 164, 11, 141, 126, 8, 189, 165, 11, 141, 127, 8, 173, 67, - 5, 133, 255, 32, 147, 8, 140, 104, 5, 192, 85, 176, 4, 196, 254, 208, - 143, 164, 254, 140, 104, 5, 76, 5, 11, 32, 148, 6, 160, 255, 96, 48, - 251, 168, 96, 48, 247, 56, 152, 229, 255, 168, 96, 48, 239, 24, 152, 101, - 255, 168, 96, 48, 231, 141, 108, 5, 141, 109, 5, 200, 96, 48, 221, 173, - 68, 5, 48, 216, 141, 107, 5, 200, 140, 105, 5, 24, 152, 101, 255, 141, - 106, 5, 96, 136, 48, 10, 177, 252, 201, 143, 240, 4, 201, 239, 208, 243, - 200, 96, 162, 2, 189, 72, 5, 240, 5, 222, 72, 5, 16, 99, 189, 75, - 5, 208, 94, 188, 66, 5, 192, 64, 176, 87, 173, 116, 5, 133, 252, 173, - 117, 5, 133, 253, 177, 252, 133, 254, 24, 152, 105, 64, 168, 177, 252, 133, - 255, 37, 254, 201, 255, 240, 58, 188, 69, 5, 177, 254, 41, 192, 208, 12, - 177, 254, 41, 63, 157, 15, 5, 254, 69, 5, 16, 235, 201, 64, 208, 19, - 177, 254, 41, 63, 141, 111, 5, 189, 15, 5, 141, 112, 5, 32, 188, 6, - 76, 72, 9, 201, 128, 208, 10, 177, 254, 41, 63, 157, 72, 5, 254, 69, - 5, 202, 16, 144, 174, 103, 5, 232, 224, 48, 144, 2, 162, 0, 142, 103, - 5, 206, 109, 5, 208, 14, 173, 108, 5, 141, 109, 5, 173, 103, 5, 208, - 3, 238, 104, 5, 172, 48, 5, 173, 82, 5, 41, 7, 201, 5, 240, 4, - 201, 6, 208, 1, 136, 140, 39, 5, 160, 0, 201, 5, 240, 4, 201, 6, - 208, 2, 160, 2, 201, 7, 208, 2, 160, 40, 140, 44, 5, 162, 2, 189, - 82, 5, 41, 224, 157, 40, 5, 189, 97, 5, 133, 252, 189, 100, 5, 133, - 253, 189, 57, 5, 201, 255, 240, 54, 201, 15, 208, 32, 189, 63, 5, 240, - 45, 222, 63, 5, 189, 63, 5, 208, 37, 188, 9, 5, 240, 1, 136, 152, - 157, 9, 5, 189, 88, 5, 157, 63, 5, 76, 232, 9, 189, 57, 5, 74, - 168, 177, 252, 144, 4, 74, 74, 74, 74, 41, 15, 157, 9, 5, 188, 45, - 5, 189, 82, 5, 41, 7, 201, 1, 208, 31, 136, 152, 200, 221, 48, 5, - 8, 169, 1, 40, 208, 2, 10, 10, 61, 60, 5, 240, 12, 188, 48, 5, - 192, 255, 208, 5, 169, 0, 157, 9, 5, 152, 157, 36, 5, 169, 1, 141, - 110, 5, 189, 57, 5, 201, 15, 240, 56, 41, 7, 168, 185, 208, 12, 133, - 254, 189, 57, 5, 41, 8, 8, 138, 40, 24, 240, 2, 105, 3, 168, 185, - 91, 5, 37, 254, 240, 27, 189, 51, 5, 157, 36, 5, 142, 110, 5, 202, - 16, 8, 141, 39, 5, 169, 0, 141, 44, 5, 232, 189, 54, 5, 157, 40, - 5, 189, 57, 5, 41, 15, 201, 15, 240, 16, 254, 57, 5, 189, 57, 5, - 201, 15, 208, 6, 189, 88, 5, 157, 63, 5, 189, 75, 5, 16, 10, 189, - 9, 5, 208, 5, 169, 64, 157, 75, 5, 254, 60, 5, 160, 0, 189, 82, - 5, 74, 74, 74, 74, 144, 1, 136, 74, 144, 1, 200, 24, 152, 125, 45, - 5, 157, 45, 5, 189, 48, 5, 201, 255, 208, 2, 160, 0, 24, 152, 125, - 48, 5, 157, 48, 5, 202, 48, 3, 76, 153, 9, 173, 40, 5, 141, 43, - 5, 173, 82, 5, 41, 7, 170, 160, 3, 173, 110, 5, 240, 3, 188, 216, - 12, 152, 72, 185, 188, 12, 8, 41, 127, 170, 152, 41, 3, 10, 168, 189, - 36, 5, 153, 0, 210, 200, 189, 9, 5, 224, 3, 208, 3, 173, 9, 5, - 29, 40, 5, 40, 16, 2, 169, 0, 153, 0, 210, 104, 168, 136, 41, 3, - 208, 207, 160, 8, 173, 44, 5, 153, 0, 210, 24, 104, 133, 255, 104, 133, - 254, 104, 133, 253, 104, 133, 252, 96, 104, 170, 240, 78, 201, 2, 240, 6, - 104, 104, 202, 208, 251, 96, 165, 20, 197, 20, 240, 252, 173, 36, 2, 201, - 137, 208, 7, 173, 37, 2, 201, 11, 240, 230, 173, 36, 2, 141, 146, 11, - 173, 37, 2, 141, 147, 11, 169, 137, 141, 36, 2, 169, 11, 141, 37, 2, - 104, 104, 240, 3, 56, 233, 1, 141, 96, 11, 104, 168, 104, 170, 169, 112, - 32, 120, 5, 169, 0, 162, 0, 76, 120, 5, 165, 20, 197, 20, 240, 252, - 173, 36, 2, 201, 137, 208, 174, 173, 37, 2, 201, 11, 208, 167, 173, 146, - 11, 141, 36, 2, 173, 147, 11, 141, 37, 2, 169, 64, 76, 120, 5, 32, - 203, 7, 144, 3, 32, 120, 11, 76, 255, 255, 178, 5, 221, 5, 168, 6, - 59, 6, 123, 6, 148, 6, 159, 6, 82, 6, 147, 8, 153, 8, 157, 8, - 165, 8, 173, 8, 183, 8, 205, 8, 188, 11, 253, 11, 62, 12, 128, 160, - 32, 64, 255, 241, 228, 215, 203, 192, 181, 170, 161, 152, 143, 135, 127, 120, - 114, 107, 101, 95, 90, 85, 80, 75, 71, 67, 63, 60, 56, 53, 50, 47, - 44, 42, 39, 37, 35, 33, 31, 29, 28, 26, 24, 23, 22, 20, 19, 18, - 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, - 1, 0, 0, 0, 0, 0, 0, 242, 233, 218, 206, 191, 182, 170, 161, 152, - 143, 137, 128, 122, 113, 107, 101, 95, 0, 86, 80, 103, 96, 90, 85, 81, - 76, 72, 67, 63, 61, 57, 52, 51, 57, 45, 42, 40, 37, 36, 33, 31, - 30, 0, 0, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, - 2, 1, 0, 0, 56, 11, 140, 10, 0, 10, 106, 9, 232, 8, 106, 8, - 239, 7, 128, 7, 8, 7, 174, 6, 70, 6, 230, 5, 149, 5, 65, 5, - 246, 4, 176, 4, 110, 4, 48, 4, 246, 3, 187, 3, 132, 3, 82, 3, - 34, 3, 244, 2, 200, 2, 160, 2, 122, 2, 85, 2, 52, 2, 20, 2, - 245, 1, 216, 1, 189, 1, 164, 1, 141, 1, 119, 1, 96, 1, 78, 1, - 56, 1, 39, 1, 21, 1, 6, 1, 247, 0, 232, 0, 219, 0, 207, 0, - 195, 0, 184, 0, 172, 0, 162, 0, 154, 0, 144, 0, 136, 0, 127, 0, - 120, 0, 112, 0, 106, 0, 100, 0, 94, 0, 87, 0, 82, 0, 50, 0, - 10, 0, 0, 1, 2, 131, 0, 1, 2, 3, 1, 0, 2, 131, 1, 0, - 2, 3, 1, 2, 128, 3, 128, 64, 32, 16, 8, 4, 2, 1, 3, 3, - 3, 3, 7, 11, 15, 19 }; -static const unsigned char CiBinaryResource_cmc_obx[2019] = { 255, 255, 0, 5, 220, 12, 76, 15, 11, 76, 120, 5, 76, 203, 7, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 160, 227, 237, 227, 160, 240, 236, 225, - 249, 229, 242, 160, 246, 160, 178, 174, 177, 160, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, - 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 141, 110, - 5, 142, 111, 5, 140, 112, 5, 41, 112, 74, 74, 74, 170, 189, 145, 11, - 141, 169, 5, 189, 146, 11, 141, 170, 5, 169, 3, 141, 15, 210, 216, 165, - 254, 72, 165, 255, 72, 172, 112, 5, 174, 111, 5, 173, 110, 5, 32, 178, - 5, 104, 133, 255, 104, 133, 254, 96, 173, 118, 5, 133, 254, 173, 119, 5, - 133, 255, 160, 0, 138, 240, 28, 177, 254, 201, 143, 240, 4, 201, 239, 208, - 12, 202, 208, 9, 200, 192, 84, 176, 9, 152, 170, 16, 6, 200, 192, 84, - 144, 229, 96, 142, 104, 5, 32, 123, 6, 169, 0, 162, 9, 157, 69, 5, - 202, 16, 250, 141, 103, 5, 169, 1, 141, 113, 5, 169, 255, 141, 106, 5, - 173, 114, 5, 133, 254, 173, 115, 5, 133, 255, 160, 19, 177, 254, 170, 173, - 118, 5, 133, 254, 173, 119, 5, 133, 255, 172, 104, 5, 177, 254, 201, 207, - 208, 13, 152, 24, 105, 85, 168, 177, 254, 48, 15, 170, 76, 52, 6, 201, - 143, 240, 7, 201, 239, 240, 3, 136, 16, 226, 142, 108, 5, 142, 109, 5, - 96, 41, 15, 240, 245, 142, 218, 10, 142, 240, 10, 142, 255, 10, 140, 219, - 10, 140, 241, 10, 140, 0, 11, 96, 142, 114, 5, 134, 254, 140, 115, 5, - 132, 255, 24, 138, 105, 20, 141, 116, 5, 152, 105, 0, 141, 117, 5, 142, - 118, 5, 200, 200, 140, 119, 5, 160, 19, 177, 254, 141, 108, 5, 141, 109, - 5, 162, 8, 169, 0, 141, 113, 5, 157, 0, 210, 224, 3, 176, 8, 157, - 9, 5, 169, 255, 157, 57, 5, 202, 16, 233, 169, 128, 162, 3, 157, 75, - 5, 202, 16, 250, 96, 169, 1, 141, 113, 5, 169, 0, 240, 238, 41, 3, - 201, 3, 240, 240, 224, 64, 176, 236, 192, 26, 176, 232, 170, 169, 128, 157, - 75, 5, 169, 0, 157, 57, 5, 157, 60, 5, 157, 63, 5, 173, 111, 5, - 157, 12, 5, 173, 112, 5, 10, 10, 10, 133, 254, 24, 173, 114, 5, 105, - 48, 72, 173, 115, 5, 105, 1, 168, 104, 24, 101, 254, 157, 97, 5, 152, - 105, 0, 157, 100, 5, 24, 173, 114, 5, 105, 148, 133, 254, 173, 115, 5, - 105, 0, 133, 255, 173, 112, 5, 10, 109, 112, 5, 10, 168, 177, 254, 157, - 79, 5, 200, 177, 254, 157, 82, 5, 41, 7, 141, 110, 5, 200, 177, 254, - 157, 85, 5, 200, 177, 254, 157, 88, 5, 200, 177, 254, 157, 91, 5, 200, - 177, 254, 157, 94, 5, 160, 0, 173, 110, 5, 201, 3, 208, 2, 160, 2, - 201, 7, 208, 2, 160, 4, 185, 175, 11, 133, 254, 185, 176, 11, 133, 255, - 189, 85, 5, 74, 74, 74, 74, 24, 109, 111, 5, 141, 111, 5, 141, 194, - 7, 168, 173, 110, 5, 201, 7, 208, 15, 152, 10, 168, 177, 254, 157, 45, - 5, 200, 140, 111, 5, 76, 131, 7, 177, 254, 157, 45, 5, 189, 85, 5, - 41, 15, 24, 109, 111, 5, 141, 111, 5, 172, 111, 5, 173, 110, 5, 201, - 5, 8, 177, 254, 40, 240, 8, 221, 45, 5, 208, 3, 56, 233, 1, 157, - 48, 5, 189, 79, 5, 72, 41, 3, 168, 185, 181, 11, 157, 54, 5, 104, - 74, 74, 74, 74, 160, 62, 201, 15, 240, 16, 160, 55, 201, 14, 240, 10, - 160, 48, 201, 13, 240, 4, 24, 105, 0, 168, 185, 185, 11, 157, 51, 5, - 96, 216, 165, 252, 72, 165, 253, 72, 165, 254, 72, 165, 255, 72, 173, 113, - 5, 208, 3, 76, 2, 11, 173, 78, 5, 240, 3, 76, 107, 9, 173, 108, - 5, 205, 109, 5, 240, 3, 76, 88, 9, 173, 103, 5, 240, 3, 76, 220, - 8, 162, 2, 188, 75, 5, 48, 3, 157, 75, 5, 157, 69, 5, 202, 16, - 242, 173, 118, 5, 133, 252, 173, 119, 5, 133, 253, 172, 104, 5, 132, 254, - 204, 106, 5, 208, 25, 173, 107, 5, 240, 20, 173, 104, 5, 172, 105, 5, - 140, 104, 5, 206, 107, 5, 208, 232, 141, 104, 5, 168, 16, 226, 162, 0, - 177, 252, 201, 254, 208, 14, 172, 104, 5, 200, 196, 254, 240, 67, 140, 104, - 5, 76, 26, 8, 157, 66, 5, 24, 152, 105, 85, 168, 232, 224, 3, 144, - 223, 172, 104, 5, 177, 252, 16, 122, 201, 255, 240, 118, 74, 74, 74, 41, - 14, 170, 189, 161, 11, 141, 126, 8, 189, 162, 11, 141, 127, 8, 173, 67, - 5, 133, 255, 32, 147, 8, 140, 104, 5, 192, 85, 176, 4, 196, 254, 208, - 143, 164, 254, 140, 104, 5, 76, 2, 11, 32, 148, 6, 160, 255, 96, 48, - 251, 168, 96, 48, 247, 56, 152, 229, 255, 168, 96, 48, 239, 24, 152, 101, - 255, 168, 96, 48, 231, 141, 108, 5, 141, 109, 5, 200, 96, 48, 221, 173, - 68, 5, 48, 216, 141, 107, 5, 200, 140, 105, 5, 24, 152, 101, 255, 141, - 106, 5, 96, 136, 48, 10, 177, 252, 201, 143, 240, 4, 201, 239, 208, 243, - 200, 96, 162, 2, 189, 72, 5, 240, 5, 222, 72, 5, 16, 99, 189, 75, - 5, 208, 94, 188, 66, 5, 192, 64, 176, 87, 173, 116, 5, 133, 252, 173, - 117, 5, 133, 253, 177, 252, 133, 254, 24, 152, 105, 64, 168, 177, 252, 133, - 255, 37, 254, 201, 255, 240, 58, 188, 69, 5, 177, 254, 41, 192, 208, 12, - 177, 254, 41, 63, 157, 15, 5, 254, 69, 5, 16, 235, 201, 64, 208, 19, - 177, 254, 41, 63, 141, 111, 5, 189, 15, 5, 141, 112, 5, 32, 188, 6, - 76, 72, 9, 201, 128, 208, 10, 177, 254, 41, 63, 157, 72, 5, 254, 69, - 5, 202, 16, 144, 174, 103, 5, 232, 138, 41, 63, 141, 103, 5, 206, 109, - 5, 208, 14, 173, 108, 5, 141, 109, 5, 173, 103, 5, 208, 3, 238, 104, - 5, 172, 48, 5, 173, 82, 5, 41, 7, 201, 5, 240, 4, 201, 6, 208, - 1, 136, 140, 39, 5, 160, 0, 201, 5, 240, 4, 201, 6, 208, 2, 160, - 2, 201, 7, 208, 2, 160, 40, 140, 44, 5, 162, 2, 189, 82, 5, 41, - 224, 157, 40, 5, 189, 97, 5, 133, 252, 189, 100, 5, 133, 253, 189, 57, - 5, 201, 255, 240, 54, 201, 15, 208, 32, 189, 63, 5, 240, 45, 222, 63, - 5, 189, 63, 5, 208, 37, 188, 9, 5, 240, 1, 136, 152, 157, 9, 5, - 189, 88, 5, 157, 63, 5, 76, 229, 9, 189, 57, 5, 74, 168, 177, 252, - 144, 4, 74, 74, 74, 74, 41, 15, 157, 9, 5, 188, 45, 5, 189, 82, - 5, 41, 7, 201, 1, 208, 31, 136, 152, 200, 221, 48, 5, 8, 169, 1, - 40, 208, 2, 10, 10, 61, 60, 5, 240, 12, 188, 48, 5, 192, 255, 208, - 5, 169, 0, 157, 9, 5, 152, 157, 36, 5, 169, 1, 141, 110, 5, 189, - 57, 5, 201, 15, 240, 56, 41, 7, 168, 185, 205, 12, 133, 254, 189, 57, - 5, 41, 8, 8, 138, 40, 24, 240, 2, 105, 3, 168, 185, 91, 5, 37, - 254, 240, 27, 189, 51, 5, 157, 36, 5, 142, 110, 5, 202, 16, 8, 141, - 39, 5, 169, 0, 141, 44, 5, 232, 189, 54, 5, 157, 40, 5, 189, 57, - 5, 41, 15, 201, 15, 240, 16, 254, 57, 5, 189, 57, 5, 201, 15, 208, - 6, 189, 88, 5, 157, 63, 5, 189, 75, 5, 16, 10, 189, 9, 5, 208, - 5, 169, 64, 157, 75, 5, 254, 60, 5, 160, 0, 189, 82, 5, 74, 74, - 74, 74, 144, 1, 136, 74, 144, 1, 200, 24, 152, 125, 45, 5, 157, 45, - 5, 189, 48, 5, 201, 255, 208, 2, 160, 0, 24, 152, 125, 48, 5, 157, - 48, 5, 202, 48, 3, 76, 150, 9, 173, 40, 5, 141, 43, 5, 173, 82, - 5, 41, 7, 170, 160, 3, 173, 110, 5, 240, 3, 188, 213, 12, 152, 72, - 185, 185, 12, 8, 41, 127, 170, 152, 41, 3, 10, 168, 189, 36, 5, 153, - 0, 210, 200, 189, 9, 5, 224, 3, 208, 3, 173, 9, 5, 29, 40, 5, - 40, 16, 2, 169, 0, 153, 0, 210, 104, 168, 136, 41, 3, 208, 207, 160, - 8, 173, 44, 5, 153, 0, 210, 24, 104, 133, 255, 104, 133, 254, 104, 133, - 253, 104, 133, 252, 96, 104, 170, 240, 78, 201, 2, 240, 6, 104, 104, 202, - 208, 251, 96, 165, 20, 197, 20, 240, 252, 173, 36, 2, 201, 134, 208, 7, - 173, 37, 2, 201, 11, 240, 230, 173, 36, 2, 141, 143, 11, 173, 37, 2, - 141, 144, 11, 169, 134, 141, 36, 2, 169, 11, 141, 37, 2, 104, 104, 240, - 3, 56, 233, 1, 141, 93, 11, 104, 168, 104, 170, 169, 112, 32, 120, 5, - 169, 0, 162, 0, 76, 120, 5, 165, 20, 197, 20, 240, 252, 173, 36, 2, - 201, 134, 208, 174, 173, 37, 2, 201, 11, 208, 167, 173, 143, 11, 141, 36, - 2, 173, 144, 11, 141, 37, 2, 169, 64, 76, 120, 5, 32, 203, 7, 144, - 3, 32, 117, 11, 76, 255, 255, 178, 5, 221, 5, 168, 6, 59, 6, 123, - 6, 148, 6, 159, 6, 82, 6, 147, 8, 153, 8, 157, 8, 165, 8, 173, - 8, 183, 8, 205, 8, 185, 11, 250, 11, 59, 12, 128, 160, 32, 64, 255, - 241, 228, 215, 203, 192, 181, 170, 161, 152, 143, 135, 127, 120, 114, 107, 101, - 95, 90, 85, 80, 75, 71, 67, 63, 60, 56, 53, 50, 47, 44, 42, 39, - 37, 35, 33, 31, 29, 28, 26, 24, 23, 22, 20, 19, 18, 17, 16, 15, - 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, - 0, 0, 0, 0, 242, 233, 218, 206, 191, 182, 170, 161, 152, 143, 137, 128, - 122, 113, 107, 101, 95, 0, 86, 80, 103, 96, 90, 85, 81, 76, 72, 67, - 63, 61, 57, 52, 51, 57, 45, 42, 40, 37, 36, 33, 31, 30, 0, 0, - 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, - 0, 56, 11, 140, 10, 0, 10, 106, 9, 232, 8, 106, 8, 239, 7, 128, - 7, 8, 7, 174, 6, 70, 6, 230, 5, 149, 5, 65, 5, 246, 4, 176, - 4, 110, 4, 48, 4, 246, 3, 187, 3, 132, 3, 82, 3, 34, 3, 244, - 2, 200, 2, 160, 2, 122, 2, 85, 2, 52, 2, 20, 2, 245, 1, 216, - 1, 189, 1, 164, 1, 141, 1, 119, 1, 96, 1, 78, 1, 56, 1, 39, - 1, 21, 1, 6, 1, 247, 0, 232, 0, 219, 0, 207, 0, 195, 0, 184, - 0, 172, 0, 162, 0, 154, 0, 144, 0, 136, 0, 127, 0, 120, 0, 112, - 0, 106, 0, 100, 0, 94, 0, 87, 0, 82, 0, 50, 0, 10, 0, 0, - 1, 2, 131, 0, 1, 2, 3, 1, 0, 2, 131, 1, 0, 2, 3, 1, - 2, 128, 3, 128, 64, 32, 16, 8, 4, 2, 1, 3, 3, 3, 3, 7, - 11, 15, 19 }; -static const unsigned char CiBinaryResource_cmr_obx[2019] = { 255, 255, 0, 5, 220, 12, 76, 15, 11, 76, 120, 5, 76, 203, 7, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 160, 227, 237, 227, 160, 240, 236, 225, - 249, 229, 242, 160, 246, 160, 178, 174, 177, 160, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, - 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 141, 110, - 5, 142, 111, 5, 140, 112, 5, 41, 112, 74, 74, 74, 170, 189, 145, 11, - 141, 169, 5, 189, 146, 11, 141, 170, 5, 169, 3, 141, 15, 210, 216, 165, - 254, 72, 165, 255, 72, 172, 112, 5, 174, 111, 5, 173, 110, 5, 32, 178, - 5, 104, 133, 255, 104, 133, 254, 96, 173, 118, 5, 133, 254, 173, 119, 5, - 133, 255, 160, 0, 138, 240, 28, 177, 254, 201, 143, 240, 4, 201, 239, 208, - 12, 202, 208, 9, 200, 192, 84, 176, 9, 152, 170, 16, 6, 200, 192, 84, - 144, 229, 96, 142, 104, 5, 32, 123, 6, 169, 0, 162, 9, 157, 69, 5, - 202, 16, 250, 141, 103, 5, 169, 1, 141, 113, 5, 169, 255, 141, 106, 5, - 173, 114, 5, 133, 254, 173, 115, 5, 133, 255, 160, 19, 177, 254, 170, 173, - 118, 5, 133, 254, 173, 119, 5, 133, 255, 172, 104, 5, 177, 254, 201, 207, - 208, 13, 152, 24, 105, 85, 168, 177, 254, 48, 15, 170, 76, 52, 6, 201, - 143, 240, 7, 201, 239, 240, 3, 136, 16, 226, 142, 108, 5, 142, 109, 5, - 96, 41, 15, 240, 245, 142, 218, 10, 142, 240, 10, 142, 255, 10, 140, 219, - 10, 140, 241, 10, 140, 0, 11, 96, 142, 114, 5, 134, 254, 140, 115, 5, - 132, 255, 24, 138, 105, 20, 141, 116, 5, 152, 105, 0, 141, 117, 5, 142, - 118, 5, 200, 200, 140, 119, 5, 160, 19, 177, 254, 141, 108, 5, 141, 109, - 5, 162, 8, 169, 0, 141, 113, 5, 157, 0, 210, 224, 3, 176, 8, 157, - 9, 5, 169, 255, 157, 57, 5, 202, 16, 233, 169, 128, 162, 3, 157, 75, - 5, 202, 16, 250, 96, 169, 1, 141, 113, 5, 169, 0, 240, 238, 41, 3, - 201, 3, 240, 240, 224, 64, 176, 236, 192, 26, 176, 232, 170, 169, 128, 157, - 75, 5, 169, 0, 157, 57, 5, 157, 60, 5, 157, 63, 5, 173, 111, 5, - 157, 12, 5, 173, 112, 5, 10, 10, 10, 133, 254, 24, 173, 114, 5, 105, - 48, 72, 173, 115, 5, 105, 1, 168, 104, 24, 101, 254, 157, 97, 5, 152, - 105, 0, 157, 100, 5, 24, 173, 114, 5, 105, 148, 133, 254, 173, 115, 5, - 105, 0, 133, 255, 173, 112, 5, 10, 109, 112, 5, 10, 168, 177, 254, 157, - 79, 5, 200, 177, 254, 157, 82, 5, 41, 7, 141, 110, 5, 200, 177, 254, - 157, 85, 5, 200, 177, 254, 157, 88, 5, 200, 177, 254, 157, 91, 5, 200, - 177, 254, 157, 94, 5, 160, 0, 173, 110, 5, 201, 3, 208, 2, 160, 2, - 201, 7, 208, 2, 160, 4, 185, 175, 11, 133, 254, 185, 176, 11, 133, 255, - 189, 85, 5, 74, 74, 74, 74, 24, 109, 111, 5, 141, 111, 5, 141, 194, - 7, 168, 173, 110, 5, 201, 7, 208, 15, 152, 10, 168, 177, 254, 157, 45, - 5, 200, 140, 111, 5, 76, 131, 7, 177, 254, 157, 45, 5, 189, 85, 5, - 41, 15, 24, 109, 111, 5, 141, 111, 5, 172, 111, 5, 173, 110, 5, 201, - 5, 8, 177, 254, 40, 240, 8, 221, 45, 5, 208, 3, 56, 233, 1, 157, - 48, 5, 189, 79, 5, 72, 41, 3, 168, 185, 181, 11, 157, 54, 5, 104, - 74, 74, 74, 74, 160, 62, 201, 15, 240, 16, 160, 55, 201, 14, 240, 10, - 160, 48, 201, 13, 240, 4, 24, 105, 0, 168, 185, 185, 11, 157, 51, 5, - 96, 216, 165, 252, 72, 165, 253, 72, 165, 254, 72, 165, 255, 72, 173, 113, - 5, 208, 3, 76, 2, 11, 173, 78, 5, 240, 3, 76, 107, 9, 173, 108, - 5, 205, 109, 5, 240, 3, 76, 88, 9, 173, 103, 5, 240, 3, 76, 220, - 8, 162, 2, 188, 75, 5, 48, 3, 157, 75, 5, 157, 69, 5, 202, 16, - 242, 173, 118, 5, 133, 252, 173, 119, 5, 133, 253, 172, 104, 5, 132, 254, - 204, 106, 5, 208, 25, 173, 107, 5, 240, 20, 173, 104, 5, 172, 105, 5, - 140, 104, 5, 206, 107, 5, 208, 232, 141, 104, 5, 168, 16, 226, 162, 0, - 177, 252, 201, 254, 208, 14, 172, 104, 5, 200, 196, 254, 240, 67, 140, 104, - 5, 76, 26, 8, 157, 66, 5, 24, 152, 105, 85, 168, 232, 224, 3, 144, - 223, 172, 104, 5, 177, 252, 16, 122, 201, 255, 240, 118, 74, 74, 74, 41, - 14, 170, 189, 161, 11, 141, 126, 8, 189, 162, 11, 141, 127, 8, 173, 67, - 5, 133, 255, 32, 147, 8, 140, 104, 5, 192, 85, 176, 4, 196, 254, 208, - 143, 164, 254, 140, 104, 5, 76, 2, 11, 32, 148, 6, 160, 255, 96, 48, - 251, 168, 96, 48, 247, 56, 152, 229, 255, 168, 96, 48, 239, 24, 152, 101, - 255, 168, 96, 48, 231, 141, 108, 5, 141, 109, 5, 200, 96, 48, 221, 173, - 68, 5, 48, 216, 141, 107, 5, 200, 140, 105, 5, 24, 152, 101, 255, 141, - 106, 5, 96, 136, 48, 10, 177, 252, 201, 143, 240, 4, 201, 239, 208, 243, - 200, 96, 162, 2, 189, 72, 5, 240, 5, 222, 72, 5, 16, 99, 189, 75, - 5, 208, 94, 188, 66, 5, 192, 64, 176, 87, 173, 116, 5, 133, 252, 173, - 117, 5, 133, 253, 177, 252, 133, 254, 24, 152, 105, 64, 168, 177, 252, 133, - 255, 37, 254, 201, 255, 240, 58, 188, 69, 5, 177, 254, 41, 192, 208, 12, - 177, 254, 41, 63, 157, 15, 5, 254, 69, 5, 16, 235, 201, 64, 208, 19, - 177, 254, 41, 63, 141, 111, 5, 189, 15, 5, 141, 112, 5, 32, 188, 6, - 76, 72, 9, 201, 128, 208, 10, 177, 254, 41, 63, 157, 72, 5, 254, 69, - 5, 202, 16, 144, 174, 103, 5, 232, 138, 41, 63, 141, 103, 5, 206, 109, - 5, 208, 14, 173, 108, 5, 141, 109, 5, 173, 103, 5, 208, 3, 238, 104, - 5, 172, 48, 5, 173, 82, 5, 41, 7, 201, 5, 240, 4, 201, 6, 208, - 1, 136, 140, 39, 5, 160, 0, 201, 5, 240, 4, 201, 6, 208, 2, 160, - 2, 201, 7, 208, 2, 160, 40, 140, 44, 5, 162, 2, 189, 82, 5, 41, - 224, 157, 40, 5, 189, 97, 5, 133, 252, 189, 100, 5, 133, 253, 189, 57, - 5, 201, 255, 240, 54, 201, 15, 208, 32, 189, 63, 5, 240, 45, 222, 63, - 5, 189, 63, 5, 208, 37, 188, 9, 5, 240, 1, 136, 152, 157, 9, 5, - 189, 88, 5, 157, 63, 5, 76, 229, 9, 189, 57, 5, 74, 168, 177, 252, - 144, 4, 74, 74, 74, 74, 41, 15, 157, 9, 5, 188, 45, 5, 189, 82, - 5, 41, 7, 201, 1, 208, 31, 136, 152, 200, 221, 48, 5, 8, 169, 1, - 40, 208, 2, 10, 10, 61, 60, 5, 240, 12, 188, 48, 5, 192, 255, 208, - 5, 169, 0, 157, 9, 5, 152, 157, 36, 5, 169, 1, 141, 110, 5, 189, - 57, 5, 201, 15, 240, 56, 41, 7, 168, 185, 205, 12, 133, 254, 189, 57, - 5, 41, 8, 8, 138, 40, 24, 240, 2, 105, 3, 168, 185, 91, 5, 37, - 254, 240, 27, 189, 51, 5, 157, 36, 5, 142, 110, 5, 202, 16, 8, 141, - 39, 5, 169, 0, 141, 44, 5, 232, 189, 54, 5, 157, 40, 5, 189, 57, - 5, 41, 15, 201, 15, 240, 16, 254, 57, 5, 189, 57, 5, 201, 15, 208, - 6, 189, 88, 5, 157, 63, 5, 189, 75, 5, 16, 10, 189, 9, 5, 208, - 5, 169, 64, 157, 75, 5, 254, 60, 5, 160, 0, 189, 82, 5, 74, 74, - 74, 74, 144, 1, 136, 74, 144, 1, 200, 24, 152, 125, 45, 5, 157, 45, - 5, 189, 48, 5, 201, 255, 208, 2, 160, 0, 24, 152, 125, 48, 5, 157, - 48, 5, 202, 48, 3, 76, 150, 9, 173, 40, 5, 141, 43, 5, 173, 82, - 5, 41, 7, 170, 160, 3, 173, 110, 5, 240, 3, 188, 213, 12, 152, 72, - 185, 185, 12, 8, 41, 127, 170, 152, 41, 3, 10, 168, 189, 36, 5, 153, - 0, 210, 200, 189, 9, 5, 224, 3, 208, 3, 173, 9, 5, 29, 40, 5, - 40, 16, 2, 169, 0, 153, 0, 210, 104, 168, 136, 41, 3, 208, 207, 160, - 8, 173, 44, 5, 153, 0, 210, 24, 104, 133, 255, 104, 133, 254, 104, 133, - 253, 104, 133, 252, 96, 104, 170, 240, 78, 201, 2, 240, 6, 104, 104, 202, - 208, 251, 96, 165, 20, 197, 20, 240, 252, 173, 36, 2, 201, 134, 208, 7, - 173, 37, 2, 201, 11, 240, 230, 173, 36, 2, 141, 143, 11, 173, 37, 2, - 141, 144, 11, 169, 134, 141, 36, 2, 169, 11, 141, 37, 2, 104, 104, 240, - 3, 56, 233, 1, 141, 93, 11, 104, 168, 104, 170, 169, 112, 32, 120, 5, - 169, 0, 162, 0, 76, 120, 5, 165, 20, 197, 20, 240, 252, 173, 36, 2, - 201, 134, 208, 174, 173, 37, 2, 201, 11, 208, 167, 173, 143, 11, 141, 36, - 2, 173, 144, 11, 141, 37, 2, 169, 64, 76, 120, 5, 32, 203, 7, 144, - 3, 32, 117, 11, 76, 255, 255, 178, 5, 221, 5, 168, 6, 59, 6, 123, - 6, 148, 6, 159, 6, 82, 6, 147, 8, 153, 8, 157, 8, 165, 8, 173, - 8, 183, 8, 205, 8, 185, 11, 250, 11, 59, 12, 128, 160, 32, 64, 255, - 241, 228, 215, 203, 192, 181, 170, 161, 152, 143, 135, 127, 120, 114, 107, 101, - 95, 90, 85, 80, 75, 71, 67, 63, 60, 56, 53, 50, 47, 44, 42, 39, - 37, 35, 33, 31, 29, 28, 26, 24, 23, 22, 20, 19, 18, 17, 16, 15, - 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, - 0, 0, 0, 0, 242, 233, 218, 206, 191, 182, 170, 161, 152, 143, 137, 128, - 122, 113, 107, 101, 95, 92, 86, 80, 77, 71, 68, 65, 62, 56, 53, 136, - 127, 121, 115, 108, 103, 96, 90, 85, 81, 76, 72, 67, 63, 61, 57, 52, - 51, 48, 45, 42, 40, 37, 36, 33, 31, 30, 5, 4, 3, 2, 1, 0, - 0, 56, 11, 140, 10, 0, 10, 106, 9, 232, 8, 106, 8, 239, 7, 128, - 7, 8, 7, 174, 6, 70, 6, 230, 5, 149, 5, 65, 5, 246, 4, 176, - 4, 110, 4, 48, 4, 246, 3, 187, 3, 132, 3, 82, 3, 34, 3, 244, - 2, 200, 2, 160, 2, 122, 2, 85, 2, 52, 2, 20, 2, 245, 1, 216, - 1, 189, 1, 164, 1, 141, 1, 119, 1, 96, 1, 78, 1, 56, 1, 39, - 1, 21, 1, 6, 1, 247, 0, 232, 0, 219, 0, 207, 0, 195, 0, 184, - 0, 172, 0, 162, 0, 154, 0, 144, 0, 136, 0, 127, 0, 120, 0, 112, - 0, 106, 0, 100, 0, 94, 0, 87, 0, 82, 0, 50, 0, 10, 0, 0, - 1, 2, 131, 0, 1, 2, 3, 1, 0, 2, 131, 1, 0, 2, 3, 1, - 2, 128, 3, 128, 64, 32, 16, 8, 4, 2, 1, 3, 3, 3, 3, 7, - 11, 15, 19 }; -static const unsigned char CiBinaryResource_cms_obx[2753] = { 255, 255, 0, 5, 186, 15, 234, 234, 234, 76, 21, 8, 76, 92, 15, 35, - 5, 169, 5, 173, 5, 184, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 128, 128, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 255, - 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 130, 0, 0, 6, 6, 0, - 128, 20, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, - 15, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, - 1, 2, 131, 0, 1, 2, 3, 1, 0, 2, 131, 1, 0, 2, 3, 1, - 2, 128, 3, 128, 64, 32, 16, 8, 4, 2, 1, 75, 8, 118, 8, 133, - 9, 19, 9, 80, 9, 110, 9, 124, 9, 26, 9, 128, 160, 32, 64, 255, - 241, 228, 215, 203, 192, 181, 170, 161, 152, 143, 135, 127, 120, 114, 107, 101, - 95, 90, 85, 80, 75, 71, 67, 63, 60, 56, 53, 50, 47, 44, 42, 39, - 37, 35, 33, 31, 29, 28, 26, 24, 23, 22, 20, 19, 18, 17, 16, 15, - 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, - 0, 0, 0, 0, 242, 233, 218, 206, 191, 182, 170, 161, 152, 143, 137, 128, - 122, 113, 107, 101, 95, 0, 86, 80, 103, 96, 90, 85, 81, 76, 72, 67, - 63, 61, 57, 52, 51, 57, 45, 42, 40, 37, 36, 33, 31, 30, 0, 0, - 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, - 0, 56, 11, 140, 10, 0, 10, 106, 9, 232, 8, 106, 8, 239, 7, 128, - 7, 8, 7, 174, 6, 70, 6, 230, 5, 149, 5, 65, 5, 246, 4, 176, - 4, 110, 4, 48, 4, 246, 3, 187, 3, 132, 3, 82, 3, 34, 3, 244, - 2, 200, 2, 160, 2, 122, 2, 85, 2, 52, 2, 20, 2, 245, 1, 216, - 1, 189, 1, 164, 1, 141, 1, 119, 1, 96, 1, 78, 1, 56, 1, 39, - 1, 21, 1, 6, 1, 247, 0, 232, 0, 219, 0, 207, 0, 195, 0, 184, - 0, 172, 0, 162, 0, 154, 0, 144, 0, 136, 0, 127, 0, 120, 0, 112, - 0, 106, 0, 100, 0, 94, 0, 87, 0, 82, 0, 50, 0, 10, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, - 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 0, - 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 0, - 0, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 0, - 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 0, - 0, 1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 0, - 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 0, - 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 0, - 1, 1, 2, 2, 3, 4, 4, 5, 5, 6, 7, 7, 8, 8, 9, 0, - 1, 1, 2, 3, 3, 4, 5, 5, 6, 7, 7, 8, 9, 9, 10, 0, - 1, 1, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 10, 10, 11, 0, - 1, 2, 2, 3, 4, 5, 6, 7, 8, 9, 9, 10, 11, 11, 12, 0, - 1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 10, 10, 11, 12, 13, 0, - 1, 2, 3, 4, 5, 6, 7, 7, 8, 9, 10, 11, 12, 13, 14, 0, - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 6, - 12, 12, 12, 18, 12, 28, 12, 38, 12, 50, 12, 79, 12, 233, 5, 42, - 6, 107, 6, 161, 11, 196, 11, 185, 11, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 3, 3, 3, 3, 7, 11, 15, 19, 141, 143, 5, 142, 144, - 5, 140, 145, 5, 41, 112, 74, 74, 74, 170, 169, 3, 141, 15, 210, 189, - 213, 5, 141, 73, 8, 189, 214, 5, 141, 74, 8, 169, 3, 141, 31, 210, - 169, 1, 141, 146, 5, 172, 145, 5, 174, 144, 5, 173, 143, 5, 76, 72, - 8, 173, 147, 5, 133, 252, 173, 148, 5, 133, 253, 160, 0, 138, 240, 28, - 177, 252, 201, 143, 240, 4, 201, 239, 208, 12, 202, 208, 9, 200, 192, 84, - 176, 9, 152, 170, 16, 6, 200, 192, 84, 144, 229, 96, 142, 149, 5, 169, - 0, 162, 5, 157, 17, 5, 157, 23, 5, 157, 29, 5, 202, 16, 244, 141, - 150, 5, 141, 157, 5, 160, 255, 140, 159, 5, 173, 153, 5, 133, 252, 173, - 154, 5, 133, 253, 160, 19, 177, 252, 170, 173, 147, 5, 133, 252, 173, 148, - 5, 133, 253, 172, 149, 5, 152, 72, 169, 15, 141, 169, 5, 141, 170, 5, - 177, 252, 201, 135, 208, 35, 152, 72, 24, 105, 85, 168, 177, 252, 16, 2, - 169, 15, 41, 15, 141, 169, 5, 152, 24, 105, 85, 168, 177, 252, 16, 3, - 173, 169, 5, 41, 15, 141, 170, 5, 104, 76, 243, 8, 177, 252, 201, 143, - 240, 7, 201, 239, 240, 3, 136, 16, 199, 104, 168, 177, 252, 201, 207, 208, - 13, 152, 24, 105, 85, 168, 177, 252, 48, 15, 170, 76, 19, 9, 201, 143, - 240, 7, 201, 239, 240, 3, 136, 16, 226, 142, 151, 5, 142, 152, 5, 96, - 142, 153, 5, 134, 252, 140, 154, 5, 132, 253, 24, 138, 105, 20, 141, 155, - 5, 152, 105, 0, 141, 156, 5, 24, 138, 105, 0, 141, 147, 5, 152, 105, - 2, 141, 148, 5, 160, 19, 177, 252, 141, 151, 5, 141, 152, 5, 162, 3, - 142, 31, 210, 142, 15, 210, 169, 0, 141, 146, 5, 160, 8, 169, 0, 153, - 0, 210, 153, 16, 210, 192, 6, 176, 8, 153, 35, 5, 169, 255, 153, 41, - 5, 136, 16, 233, 169, 128, 162, 5, 157, 29, 5, 202, 16, 250, 141, 157, - 5, 96, 169, 0, 240, 240, 141, 157, 5, 240, 11, 173, 143, 5, 41, 7, - 170, 169, 128, 157, 29, 5, 172, 145, 5, 173, 144, 5, 141, 143, 5, 140, - 145, 5, 169, 0, 157, 83, 5, 157, 41, 5, 157, 77, 5, 152, 10, 10, - 10, 133, 254, 24, 173, 153, 5, 105, 48, 72, 173, 154, 5, 105, 1, 168, - 104, 24, 101, 254, 157, 101, 5, 152, 105, 0, 157, 71, 5, 24, 173, 153, - 5, 105, 148, 133, 252, 173, 154, 5, 105, 0, 133, 253, 173, 145, 5, 10, - 109, 145, 5, 10, 168, 140, 145, 5, 200, 200, 200, 200, 200, 177, 252, 157, - 113, 5, 136, 177, 252, 157, 107, 5, 136, 177, 252, 157, 119, 5, 136, 136, - 177, 252, 157, 59, 5, 160, 0, 41, 7, 201, 3, 208, 2, 160, 2, 201, - 7, 208, 2, 160, 4, 185, 247, 7, 133, 254, 185, 248, 7, 133, 255, 172, - 145, 5, 200, 200, 177, 252, 74, 74, 74, 74, 24, 109, 143, 5, 141, 143, - 5, 141, 159, 10, 168, 189, 59, 5, 41, 7, 201, 7, 208, 15, 152, 10, - 168, 177, 254, 157, 125, 5, 200, 140, 143, 5, 76, 92, 10, 177, 254, 157, - 125, 5, 172, 145, 5, 200, 200, 177, 252, 41, 15, 24, 109, 143, 5, 141, - 143, 5, 172, 143, 5, 189, 59, 5, 41, 7, 201, 5, 8, 177, 254, 40, - 240, 8, 221, 125, 5, 208, 3, 56, 233, 1, 157, 89, 5, 172, 145, 5, - 177, 252, 72, 41, 3, 168, 185, 229, 5, 157, 131, 5, 104, 74, 74, 74, - 74, 160, 62, 201, 15, 240, 16, 160, 55, 201, 14, 240, 10, 160, 48, 201, - 13, 240, 4, 24, 105, 50, 168, 185, 233, 5, 157, 137, 5, 96, 216, 165, - 252, 72, 165, 253, 72, 165, 254, 72, 165, 255, 72, 173, 146, 5, 208, 3, - 76, 47, 15, 173, 157, 5, 240, 3, 76, 225, 12, 173, 152, 5, 205, 151, - 5, 176, 3, 76, 206, 12, 173, 150, 5, 240, 3, 76, 158, 11, 162, 5, - 169, 0, 188, 29, 5, 48, 3, 157, 29, 5, 157, 17, 5, 202, 16, 242, - 173, 147, 5, 133, 252, 173, 148, 5, 133, 253, 172, 149, 5, 140, 161, 5, - 204, 159, 5, 208, 25, 173, 160, 5, 240, 20, 173, 149, 5, 172, 158, 5, - 140, 149, 5, 206, 160, 5, 208, 232, 141, 149, 5, 168, 16, 226, 162, 0, - 177, 252, 201, 254, 240, 28, 157, 53, 5, 230, 253, 177, 252, 198, 253, 201, - 254, 240, 15, 157, 56, 5, 24, 152, 105, 85, 168, 232, 224, 3, 144, 224, - 176, 34, 172, 149, 5, 200, 204, 161, 5, 240, 80, 140, 149, 5, 76, 250, - 10, 104, 41, 14, 170, 189, 253, 7, 141, 135, 11, 189, 254, 7, 141, 136, - 11, 76, 129, 11, 172, 149, 5, 177, 252, 16, 57, 201, 255, 240, 53, 74, - 74, 74, 72, 41, 1, 240, 218, 104, 41, 14, 170, 189, 233, 7, 141, 135, - 11, 189, 234, 7, 141, 136, 11, 173, 54, 5, 133, 254, 32, 134, 11, 140, - 149, 5, 192, 85, 176, 5, 204, 161, 5, 208, 179, 172, 161, 5, 140, 149, - 5, 76, 47, 15, 76, 94, 12, 165, 254, 48, 18, 41, 15, 141, 169, 5, - 173, 55, 5, 16, 3, 173, 169, 5, 41, 15, 141, 170, 5, 200, 96, 165, - 254, 48, 250, 41, 1, 141, 184, 5, 200, 96, 173, 179, 5, 48, 20, 206, - 180, 5, 208, 51, 169, 50, 141, 180, 5, 206, 179, 5, 208, 41, 206, 179, - 5, 200, 96, 165, 254, 48, 214, 141, 180, 5, 238, 180, 5, 165, 254, 48, - 204, 141, 180, 5, 238, 180, 5, 173, 55, 5, 141, 179, 5, 16, 5, 169, - 0, 141, 179, 5, 238, 179, 5, 104, 104, 76, 225, 12, 32, 110, 9, 160, - 255, 96, 165, 254, 48, 249, 168, 96, 165, 254, 48, 243, 56, 152, 229, 254, - 168, 96, 165, 254, 48, 233, 24, 152, 101, 254, 168, 96, 165, 254, 48, 223, - 141, 151, 5, 141, 152, 5, 200, 96, 165, 254, 48, 211, 173, 55, 5, 48, - 206, 200, 140, 158, 5, 24, 152, 101, 254, 141, 159, 5, 173, 55, 5, 141, - 160, 5, 192, 84, 96, 136, 48, 10, 177, 252, 201, 143, 240, 4, 201, 239, - 208, 243, 200, 96, 162, 5, 189, 23, 5, 240, 5, 222, 23, 5, 16, 87, - 189, 29, 5, 208, 82, 188, 53, 5, 201, 64, 176, 75, 173, 155, 5, 133, - 252, 173, 156, 5, 133, 253, 177, 252, 133, 254, 24, 152, 105, 64, 168, 177, - 252, 133, 255, 188, 17, 5, 177, 254, 41, 192, 208, 12, 177, 254, 41, 63, - 157, 47, 5, 254, 17, 5, 16, 235, 201, 64, 208, 13, 177, 254, 41, 63, - 188, 47, 5, 32, 150, 9, 76, 190, 12, 201, 128, 208, 10, 177, 254, 41, - 63, 157, 23, 5, 254, 17, 5, 202, 16, 156, 174, 150, 5, 232, 138, 41, - 63, 141, 150, 5, 206, 152, 5, 208, 14, 173, 151, 5, 141, 152, 5, 173, - 150, 5, 208, 3, 238, 149, 5, 172, 89, 5, 173, 59, 5, 41, 7, 201, - 5, 240, 4, 201, 6, 208, 1, 136, 140, 162, 5, 160, 0, 201, 5, 240, - 4, 201, 6, 208, 2, 160, 2, 201, 7, 208, 2, 160, 40, 140, 164, 5, - 172, 92, 5, 173, 62, 5, 41, 7, 201, 5, 240, 4, 201, 6, 208, 1, - 136, 140, 163, 5, 160, 0, 201, 5, 240, 4, 201, 6, 208, 2, 160, 2, - 201, 7, 208, 2, 160, 40, 140, 165, 5, 162, 5, 189, 59, 5, 41, 224, - 157, 65, 5, 189, 101, 5, 133, 252, 189, 71, 5, 133, 253, 189, 41, 5, - 201, 255, 240, 55, 201, 15, 208, 33, 189, 77, 5, 240, 46, 222, 77, 5, - 189, 77, 5, 208, 38, 188, 35, 5, 240, 1, 136, 152, 157, 35, 5, 189, - 119, 5, 157, 77, 5, 136, 76, 133, 13, 189, 41, 5, 74, 168, 177, 252, - 144, 4, 74, 74, 74, 74, 41, 15, 157, 35, 5, 188, 125, 5, 189, 59, - 5, 41, 7, 201, 1, 208, 31, 136, 152, 200, 221, 89, 5, 8, 169, 1, - 40, 208, 2, 10, 10, 61, 83, 5, 240, 12, 188, 89, 5, 192, 255, 208, - 5, 169, 0, 157, 35, 5, 152, 157, 95, 5, 169, 1, 141, 168, 5, 189, - 41, 5, 201, 15, 240, 76, 41, 7, 168, 185, 205, 5, 133, 254, 189, 41, - 5, 41, 8, 8, 138, 40, 24, 240, 2, 105, 6, 168, 185, 107, 5, 37, - 254, 240, 47, 189, 137, 5, 157, 95, 5, 142, 168, 5, 202, 224, 2, 240, - 15, 224, 255, 208, 22, 141, 162, 5, 169, 0, 141, 164, 5, 76, 5, 14, - 173, 140, 5, 141, 163, 5, 169, 0, 141, 165, 5, 232, 189, 131, 5, 157, - 65, 5, 189, 41, 5, 41, 15, 201, 15, 240, 18, 254, 41, 5, 189, 41, - 5, 41, 15, 201, 15, 208, 6, 189, 119, 5, 157, 77, 5, 189, 29, 5, - 16, 10, 189, 35, 5, 208, 5, 169, 64, 157, 29, 5, 254, 83, 5, 160, - 0, 189, 59, 5, 74, 74, 74, 74, 144, 1, 136, 74, 144, 1, 200, 24, - 152, 125, 125, 5, 157, 125, 5, 189, 89, 5, 201, 255, 208, 2, 160, 0, - 24, 152, 125, 89, 5, 157, 89, 5, 202, 48, 3, 76, 53, 13, 32, 123, - 15, 173, 65, 5, 141, 166, 5, 173, 68, 5, 141, 167, 5, 173, 59, 5, - 41, 7, 32, 181, 15, 152, 72, 185, 185, 5, 8, 41, 127, 170, 152, 41, - 3, 10, 168, 224, 3, 208, 3, 76, 196, 14, 189, 173, 5, 208, 39, 189, - 95, 5, 153, 0, 210, 189, 35, 5, 29, 65, 5, 40, 16, 2, 169, 0, - 153, 1, 210, 104, 168, 136, 41, 3, 240, 3, 76, 127, 14, 173, 164, 5, - 141, 8, 210, 76, 228, 14, 40, 76, 173, 14, 173, 173, 5, 208, 23, 173, - 162, 5, 153, 0, 210, 173, 35, 5, 13, 166, 5, 40, 16, 2, 169, 0, - 153, 1, 210, 76, 173, 14, 40, 76, 173, 14, 173, 62, 5, 41, 7, 32, - 181, 15, 152, 72, 185, 185, 5, 8, 41, 127, 170, 152, 41, 3, 10, 168, - 224, 3, 208, 3, 76, 60, 15, 189, 176, 5, 208, 30, 189, 98, 5, 153, - 16, 210, 189, 38, 5, 29, 68, 5, 40, 16, 2, 169, 0, 153, 17, 210, - 104, 168, 136, 41, 3, 240, 7, 76, 236, 14, 40, 76, 26, 15, 173, 165, - 5, 141, 24, 210, 24, 104, 133, 255, 104, 133, 254, 104, 133, 253, 104, 133, - 252, 96, 173, 176, 5, 208, 23, 173, 163, 5, 153, 16, 210, 173, 38, 5, - 13, 167, 5, 40, 16, 2, 169, 0, 153, 17, 210, 76, 26, 15, 40, 76, - 26, 15, 32, 168, 10, 176, 25, 173, 184, 5, 240, 20, 173, 157, 5, 141, - 183, 5, 169, 1, 141, 157, 5, 32, 168, 10, 173, 183, 5, 141, 157, 5, - 96, 173, 169, 5, 10, 10, 10, 10, 141, 171, 5, 173, 170, 5, 10, 10, - 10, 10, 141, 172, 5, 162, 2, 134, 200, 173, 171, 5, 29, 35, 5, 170, - 189, 233, 6, 166, 200, 157, 35, 5, 173, 172, 5, 29, 38, 5, 170, 189, - 233, 6, 166, 200, 157, 38, 5, 202, 16, 221, 96, 168, 185, 13, 8, 168, - 96 }; -static const unsigned char CiBinaryResource_dlt_obx[2125] = { 255, 255, 0, 4, 70, 12, 255, 241, 228, 215, 203, 192, 181, 170, 161, 152, - 143, 135, 127, 121, 114, 107, 101, 95, 90, 85, 80, 75, 71, 67, 63, 60, - 56, 53, 50, 47, 44, 42, 39, 37, 35, 33, 31, 29, 28, 26, 24, 23, - 22, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, - 5, 4, 255, 241, 228, 215, 242, 233, 218, 206, 191, 182, 170, 161, 152, 143, - 137, 128, 122, 113, 107, 101, 95, 92, 86, 80, 103, 96, 90, 85, 81, 76, - 72, 67, 63, 61, 57, 52, 51, 48, 45, 42, 40, 37, 36, 33, 31, 30, - 28, 27, 25, 0, 22, 21, 0, 10, 9, 8, 7, 6, 5, 4, 3, 2, - 1, 0, 242, 233, 218, 206, 242, 233, 218, 206, 191, 182, 170, 161, 152, 143, - 137, 128, 122, 113, 107, 101, 95, 92, 86, 80, 103, 96, 90, 85, 81, 76, - 72, 67, 63, 61, 57, 52, 51, 48, 45, 42, 40, 37, 36, 33, 31, 30, - 28, 27, 25, 0, 22, 21, 0, 10, 9, 8, 7, 6, 5, 4, 3, 2, - 1, 0, 242, 233, 218, 206, 255, 241, 228, 216, 202, 192, 181, 171, 162, 153, - 142, 135, 127, 120, 115, 108, 102, 97, 90, 85, 81, 75, 72, 67, 63, 60, - 57, 52, 51, 48, 45, 42, 40, 37, 36, 33, 31, 30, 28, 27, 25, 23, - 22, 21, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, - 5, 4, 3, 2, 1, 255, 76, 9, 5, 76, 200, 5, 76, 183, 5, 136, - 140, 54, 3, 169, 126, 141, 53, 3, 162, 6, 142, 51, 3, 162, 1, 142, - 52, 3, 32, 51, 5, 32, 95, 5, 32, 163, 5, 32, 139, 5, 169, 1, - 141, 50, 3, 169, 3, 141, 15, 210, 96, 162, 0, 160, 32, 142, 48, 3, - 140, 49, 3, 160, 0, 173, 48, 3, 153, 0, 2, 173, 49, 3, 153, 64, - 2, 173, 48, 3, 24, 105, 128, 141, 48, 3, 144, 3, 238, 49, 3, 200, - 192, 64, 208, 225, 96, 162, 0, 160, 68, 142, 48, 3, 140, 49, 3, 160, - 0, 173, 48, 3, 153, 128, 2, 173, 49, 3, 153, 160, 2, 173, 48, 3, - 24, 105, 64, 141, 48, 3, 144, 3, 238, 49, 3, 200, 192, 32, 208, 225, - 96, 173, 0, 76, 41, 1, 74, 106, 106, 168, 162, 0, 185, 128, 4, 157, - 64, 4, 200, 232, 224, 64, 208, 244, 96, 160, 3, 169, 0, 153, 40, 3, - 153, 32, 3, 153, 36, 3, 153, 44, 3, 136, 16, 241, 96, 169, 0, 141, - 50, 3, 160, 7, 169, 0, 153, 0, 210, 136, 16, 250, 96, 96, 173, 50, - 3, 240, 250, 173, 40, 3, 13, 41, 3, 13, 42, 3, 13, 43, 3, 141, - 8, 210, 174, 36, 3, 172, 32, 3, 142, 0, 210, 140, 1, 210, 174, 37, - 3, 172, 33, 3, 142, 2, 210, 140, 3, 210, 174, 38, 3, 172, 34, 3, - 142, 4, 210, 140, 5, 210, 174, 39, 3, 172, 35, 3, 142, 6, 210, 140, - 7, 210, 206, 52, 3, 208, 74, 173, 51, 3, 141, 52, 3, 238, 53, 3, - 238, 53, 3, 16, 28, 238, 54, 3, 169, 0, 141, 53, 3, 32, 199, 6, - 173, 4, 3, 13, 5, 3, 13, 6, 3, 13, 7, 3, 208, 3, 76, 183, - 5, 173, 4, 3, 240, 3, 32, 97, 7, 173, 5, 3, 240, 3, 32, 192, - 7, 173, 6, 3, 240, 3, 32, 31, 8, 173, 7, 3, 240, 3, 32, 126, - 8, 173, 4, 3, 240, 8, 173, 44, 3, 240, 3, 32, 221, 8, 173, 5, - 3, 240, 8, 173, 45, 3, 240, 3, 32, 206, 9, 173, 6, 3, 240, 8, - 173, 46, 3, 240, 3, 32, 191, 10, 173, 7, 3, 240, 8, 173, 47, 3, - 240, 3, 32, 131, 11, 96, 192, 67, 144, 14, 169, 0, 141, 4, 3, 141, - 32, 3, 141, 40, 3, 76, 230, 6, 192, 66, 208, 15, 189, 128, 64, 141, - 51, 3, 141, 52, 3, 238, 54, 3, 76, 199, 6, 192, 65, 208, 9, 189, - 128, 64, 141, 54, 3, 76, 199, 6, 104, 104, 76, 183, 5, 174, 54, 3, - 188, 0, 64, 192, 64, 176, 191, 189, 128, 64, 141, 24, 3, 185, 0, 2, - 133, 224, 185, 64, 2, 133, 225, 169, 1, 141, 4, 3, 188, 0, 65, 192, - 64, 176, 78, 189, 128, 65, 141, 25, 3, 185, 0, 2, 133, 226, 185, 64, - 2, 133, 227, 169, 1, 141, 5, 3, 188, 0, 66, 192, 64, 176, 63, 189, - 128, 66, 141, 26, 3, 185, 0, 2, 133, 228, 185, 64, 2, 133, 229, 169, - 1, 141, 6, 3, 188, 0, 67, 192, 64, 176, 48, 189, 128, 67, 141, 27, - 3, 185, 0, 2, 133, 230, 185, 64, 2, 133, 231, 169, 1, 141, 7, 3, - 96, 169, 0, 141, 5, 3, 141, 33, 3, 141, 41, 3, 240, 186, 169, 0, - 141, 6, 3, 141, 34, 3, 141, 42, 3, 240, 201, 169, 0, 141, 7, 3, - 141, 35, 3, 141, 43, 3, 96, 172, 53, 3, 177, 224, 48, 11, 200, 177, - 224, 48, 1, 96, 104, 104, 76, 31, 6, 24, 109, 24, 3, 41, 127, 141, - 8, 3, 169, 15, 141, 0, 3, 141, 44, 3, 200, 177, 224, 170, 189, 160, - 2, 133, 233, 133, 241, 133, 249, 189, 128, 2, 133, 232, 73, 16, 133, 240, - 73, 48, 133, 248, 160, 49, 177, 232, 141, 12, 3, 160, 51, 177, 232, 41, - 127, 141, 16, 3, 169, 0, 141, 20, 3, 141, 28, 3, 160, 48, 177, 232, - 41, 213, 141, 40, 3, 96, 172, 53, 3, 177, 226, 48, 11, 200, 177, 226, - 48, 1, 96, 104, 104, 76, 31, 6, 24, 109, 25, 3, 41, 127, 141, 9, - 3, 169, 15, 141, 1, 3, 141, 45, 3, 200, 177, 226, 170, 189, 160, 2, - 133, 235, 133, 243, 133, 251, 189, 128, 2, 133, 234, 73, 16, 133, 242, 73, - 48, 133, 250, 160, 49, 177, 234, 141, 13, 3, 160, 51, 177, 234, 41, 127, - 141, 17, 3, 169, 0, 141, 21, 3, 141, 29, 3, 160, 48, 177, 234, 41, - 131, 141, 41, 3, 96, 172, 53, 3, 177, 228, 48, 11, 200, 177, 228, 48, - 1, 96, 104, 104, 76, 31, 6, 24, 109, 26, 3, 41, 127, 141, 10, 3, - 169, 15, 141, 2, 3, 141, 46, 3, 200, 177, 228, 170, 189, 160, 2, 133, - 237, 133, 245, 133, 253, 189, 128, 2, 133, 236, 73, 16, 133, 244, 73, 48, - 133, 252, 160, 49, 177, 236, 141, 14, 3, 160, 51, 177, 236, 41, 127, 141, - 18, 3, 169, 0, 141, 22, 3, 141, 30, 3, 160, 48, 177, 236, 41, 169, - 141, 42, 3, 96, 172, 53, 3, 177, 230, 48, 11, 200, 177, 230, 48, 1, - 96, 104, 104, 76, 31, 6, 24, 109, 27, 3, 41, 127, 141, 11, 3, 169, - 15, 141, 3, 3, 141, 47, 3, 200, 177, 230, 170, 189, 160, 2, 133, 239, - 133, 247, 133, 255, 189, 128, 2, 133, 238, 73, 16, 133, 246, 73, 48, 133, - 254, 160, 49, 177, 238, 141, 15, 3, 160, 51, 177, 238, 41, 127, 141, 19, - 3, 169, 0, 141, 23, 3, 141, 31, 3, 160, 48, 177, 238, 41, 129, 141, - 43, 3, 96, 172, 0, 3, 48, 70, 177, 232, 141, 32, 3, 177, 240, 208, - 9, 32, 108, 9, 206, 0, 3, 76, 79, 9, 201, 1, 240, 39, 201, 3, - 208, 16, 173, 8, 3, 24, 113, 248, 170, 173, 28, 3, 141, 55, 3, 76, - 24, 9, 173, 28, 3, 24, 113, 248, 141, 55, 3, 174, 8, 3, 32, 150, - 9, 206, 0, 3, 96, 177, 248, 141, 36, 3, 206, 0, 3, 96, 32, 108, - 9, 160, 49, 177, 232, 240, 30, 206, 12, 3, 240, 3, 76, 79, 9, 173, - 32, 3, 41, 15, 240, 11, 206, 32, 3, 177, 232, 141, 12, 3, 76, 79, - 9, 141, 44, 3, 96, 173, 28, 3, 24, 160, 50, 113, 232, 141, 28, 3, - 206, 16, 3, 208, 12, 238, 20, 3, 160, 51, 177, 232, 41, 127, 141, 16, - 3, 96, 173, 20, 3, 41, 3, 24, 105, 52, 168, 177, 232, 170, 160, 51, - 177, 232, 48, 14, 138, 109, 8, 3, 170, 173, 28, 3, 141, 55, 3, 76, - 150, 9, 138, 109, 28, 3, 141, 55, 3, 174, 8, 3, 189, 0, 4, 24, - 109, 55, 3, 141, 36, 3, 173, 40, 3, 41, 4, 208, 1, 96, 172, 0, - 3, 177, 240, 208, 21, 138, 24, 160, 0, 113, 248, 170, 189, 0, 4, 24, - 109, 55, 3, 24, 105, 255, 141, 38, 3, 96, 173, 36, 3, 24, 105, 255, - 141, 38, 3, 96, 172, 1, 3, 48, 70, 177, 234, 141, 33, 3, 177, 242, - 208, 9, 32, 93, 10, 206, 1, 3, 76, 64, 10, 201, 1, 240, 39, 201, - 3, 208, 16, 173, 9, 3, 24, 113, 250, 170, 173, 29, 3, 141, 55, 3, - 76, 9, 10, 173, 29, 3, 24, 113, 250, 141, 55, 3, 174, 9, 3, 32, - 135, 10, 206, 1, 3, 96, 177, 250, 141, 37, 3, 206, 1, 3, 96, 32, - 93, 10, 160, 49, 177, 234, 240, 30, 206, 13, 3, 240, 3, 76, 64, 10, - 173, 33, 3, 41, 15, 240, 11, 206, 33, 3, 177, 234, 141, 13, 3, 76, - 64, 10, 141, 45, 3, 96, 173, 29, 3, 24, 160, 50, 113, 234, 141, 29, - 3, 206, 17, 3, 208, 12, 238, 21, 3, 160, 51, 177, 234, 41, 127, 141, - 17, 3, 96, 173, 21, 3, 41, 3, 24, 105, 52, 168, 177, 234, 170, 160, - 51, 177, 234, 48, 14, 138, 109, 9, 3, 170, 173, 29, 3, 141, 55, 3, - 76, 135, 10, 138, 109, 29, 3, 141, 55, 3, 174, 9, 3, 189, 0, 4, - 24, 109, 55, 3, 141, 37, 3, 173, 41, 3, 41, 2, 208, 1, 96, 172, - 1, 3, 177, 242, 208, 21, 138, 24, 160, 0, 113, 250, 170, 189, 0, 4, - 24, 109, 55, 3, 24, 105, 255, 141, 39, 3, 96, 173, 37, 3, 24, 105, - 255, 141, 39, 3, 96, 172, 2, 3, 48, 70, 177, 236, 141, 34, 3, 177, - 244, 208, 9, 32, 78, 11, 206, 2, 3, 76, 49, 11, 201, 1, 240, 39, - 201, 3, 208, 16, 173, 10, 3, 24, 113, 252, 170, 173, 30, 3, 141, 55, - 3, 76, 250, 10, 173, 30, 3, 24, 113, 252, 141, 55, 3, 174, 10, 3, - 32, 120, 11, 206, 2, 3, 96, 177, 252, 141, 38, 3, 206, 2, 3, 96, - 32, 78, 11, 160, 49, 177, 236, 240, 30, 206, 14, 3, 240, 3, 76, 49, - 11, 173, 34, 3, 41, 15, 240, 11, 206, 34, 3, 177, 236, 141, 14, 3, - 76, 49, 11, 141, 46, 3, 96, 173, 30, 3, 24, 160, 50, 113, 236, 141, - 30, 3, 206, 18, 3, 208, 12, 238, 22, 3, 160, 51, 177, 236, 41, 127, - 141, 18, 3, 96, 173, 22, 3, 41, 3, 24, 105, 52, 168, 177, 236, 170, - 160, 51, 177, 236, 48, 14, 138, 109, 10, 3, 170, 173, 30, 3, 141, 55, - 3, 76, 120, 11, 138, 109, 30, 3, 141, 55, 3, 174, 10, 3, 189, 0, - 4, 24, 109, 55, 3, 141, 38, 3, 96, 172, 3, 3, 48, 70, 177, 238, - 141, 35, 3, 177, 246, 208, 9, 32, 18, 12, 206, 3, 3, 76, 245, 11, - 201, 1, 240, 39, 201, 3, 208, 16, 173, 11, 3, 24, 113, 254, 170, 173, - 31, 3, 141, 55, 3, 76, 190, 11, 173, 31, 3, 24, 113, 254, 141, 55, - 3, 174, 11, 3, 32, 60, 12, 206, 3, 3, 96, 177, 254, 141, 39, 3, - 206, 3, 3, 96, 32, 18, 12, 160, 49, 177, 238, 240, 30, 206, 15, 3, - 240, 3, 76, 245, 11, 173, 35, 3, 41, 15, 240, 11, 206, 35, 3, 177, - 238, 141, 15, 3, 76, 245, 11, 141, 47, 3, 96, 173, 31, 3, 24, 160, - 50, 113, 238, 141, 31, 3, 206, 19, 3, 208, 12, 238, 23, 3, 160, 51, - 177, 238, 41, 127, 141, 19, 3, 96, 173, 23, 3, 41, 3, 24, 105, 52, - 168, 177, 238, 170, 160, 51, 177, 238, 48, 14, 138, 109, 11, 3, 170, 173, - 31, 3, 141, 55, 3, 76, 60, 12, 138, 109, 31, 3, 141, 55, 3, 174, - 11, 3, 189, 0, 4, 24, 109, 55, 3, 141, 39, 3, 96 }; -static const unsigned char CiBinaryResource_fc_obx[1220] = { 255, 255, 0, 4, 189, 8, 76, 9, 4, 32, 16, 4, 76, 173, 5, 162, - 0, 160, 10, 32, 25, 5, 162, 8, 189, 172, 8, 157, 0, 210, 157, 16, - 210, 202, 16, 244, 96, 133, 244, 162, 0, 134, 230, 134, 232, 134, 234, 169, - 0, 133, 231, 133, 233, 133, 235, 133, 236, 133, 238, 133, 240, 133, 237, 133, - 239, 133, 241, 138, 160, 2, 162, 4, 32, 9, 5, 136, 202, 202, 16, 248, - 162, 4, 32, 160, 4, 202, 202, 16, 249, 169, 255, 197, 230, 240, 34, 197, - 232, 240, 30, 197, 234, 240, 26, 169, 254, 160, 0, 209, 224, 240, 18, 209, - 226, 240, 14, 209, 228, 240, 10, 177, 224, 49, 226, 49, 228, 201, 255, 208, - 207, 162, 4, 32, 153, 4, 202, 202, 16, 249, 166, 230, 228, 232, 176, 2, - 166, 232, 228, 234, 176, 2, 166, 234, 232, 198, 244, 208, 140, 138, 96, 181, - 231, 240, 2, 246, 230, 96, 161, 224, 201, 254, 176, 29, 181, 230, 201, 255, - 240, 23, 181, 237, 208, 17, 161, 224, 201, 64, 144, 28, 208, 3, 32, 196, - 4, 32, 196, 4, 76, 160, 4, 214, 237, 96, 246, 224, 208, 2, 246, 225, - 180, 230, 200, 240, 2, 246, 230, 96, 168, 185, 191, 8, 133, 242, 185, 31, - 9, 133, 243, 180, 231, 246, 231, 177, 242, 201, 64, 144, 22, 201, 96, 144, - 23, 201, 255, 144, 238, 169, 0, 149, 237, 149, 236, 149, 231, 32, 196, 4, - 76, 160, 4, 181, 236, 149, 237, 96, 41, 31, 149, 236, 76, 221, 4, 72, - 24, 121, 159, 9, 149, 224, 169, 0, 121, 162, 9, 149, 225, 104, 96, 134, - 252, 132, 253, 72, 160, 2, 177, 252, 162, 0, 157, 127, 9, 24, 113, 252, - 232, 224, 32, 144, 245, 165, 252, 166, 253, 24, 105, 3, 144, 1, 232, 141, - 159, 9, 142, 162, 9, 232, 141, 160, 9, 142, 163, 9, 232, 141, 161, 9, - 142, 164, 9, 232, 133, 254, 134, 255, 24, 105, 128, 144, 1, 232, 133, 252, - 134, 253, 162, 0, 160, 0, 165, 252, 153, 191, 8, 165, 253, 153, 31, 9, - 161, 252, 230, 252, 208, 2, 230, 253, 201, 255, 208, 244, 200, 192, 64, 144, - 229, 162, 0, 165, 252, 157, 255, 8, 165, 253, 157, 95, 9, 160, 0, 177, - 252, 200, 201, 255, 208, 249, 152, 24, 101, 252, 133, 252, 144, 2, 230, 253, - 232, 224, 32, 144, 222, 104, 240, 3, 32, 31, 4, 141, 190, 8, 169, 64, - 141, 170, 8, 44, 170, 8, 48, 39, 80, 53, 169, 0, 162, 11, 157, 125, - 8, 202, 16, 250, 141, 170, 8, 162, 2, 169, 8, 157, 167, 8, 173, 190, - 8, 157, 122, 8, 202, 16, 242, 169, 80, 141, 180, 8, 76, 233, 5, 169, - 0, 162, 7, 157, 172, 8, 202, 16, 250, 169, 128, 141, 170, 8, 96, 238, - 171, 8, 162, 2, 134, 30, 232, 138, 10, 168, 132, 31, 202, 189, 159, 9, - 133, 28, 189, 162, 9, 133, 29, 189, 128, 8, 240, 3, 76, 240, 6, 188, - 122, 8, 177, 28, 201, 64, 240, 14, 201, 255, 240, 24, 201, 254, 208, 45, - 141, 170, 8, 76, 203, 7, 200, 177, 28, 141, 180, 8, 200, 152, 157, 122, - 8, 76, 9, 6, 173, 190, 8, 157, 122, 8, 169, 80, 141, 180, 8, 169, - 0, 157, 128, 8, 157, 131, 8, 157, 125, 8, 76, 9, 6, 72, 41, 128, - 240, 11, 254, 122, 8, 104, 41, 15, 157, 167, 8, 16, 178, 104, 168, 185, - 191, 8, 133, 28, 185, 31, 9, 133, 29, 189, 131, 8, 157, 128, 8, 169, - 0, 157, 158, 8, 188, 125, 8, 177, 28, 48, 7, 10, 48, 36, 74, 76, - 177, 6, 10, 10, 168, 177, 254, 157, 137, 8, 200, 177, 254, 157, 143, 8, - 200, 177, 254, 157, 146, 8, 200, 177, 254, 157, 149, 8, 254, 125, 8, 76, - 110, 6, 74, 41, 31, 170, 189, 127, 9, 166, 30, 157, 128, 8, 157, 131, - 8, 254, 125, 8, 76, 110, 6, 157, 155, 8, 24, 125, 167, 8, 168, 224, - 0, 208, 15, 185, 242, 7, 141, 172, 8, 185, 50, 8, 141, 174, 8, 76, - 215, 6, 185, 196, 7, 157, 134, 8, 164, 31, 153, 172, 8, 169, 0, 157, - 140, 8, 254, 125, 8, 188, 125, 8, 177, 28, 201, 255, 208, 8, 169, 0, - 157, 125, 8, 254, 122, 8, 189, 137, 8, 168, 185, 255, 8, 141, 6, 7, - 185, 95, 9, 141, 7, 7, 166, 30, 188, 140, 8, 185, 255, 255, 201, 255, - 240, 39, 16, 16, 164, 31, 153, 173, 8, 169, 0, 153, 172, 8, 254, 140, - 8, 76, 148, 7, 164, 31, 254, 140, 8, 29, 143, 8, 153, 173, 8, 224, - 0, 240, 6, 189, 134, 8, 153, 172, 8, 189, 146, 8, 240, 35, 173, 171, - 8, 41, 1, 208, 5, 189, 146, 8, 208, 2, 169, 0, 141, 78, 7, 24, - 189, 155, 8, 105, 2, 125, 167, 8, 168, 185, 196, 7, 164, 31, 153, 172, - 8, 189, 149, 8, 240, 52, 48, 32, 188, 152, 8, 254, 152, 8, 185, 181, - 8, 201, 31, 208, 7, 169, 0, 157, 152, 8, 240, 236, 24, 125, 134, 8, - 164, 31, 153, 172, 8, 76, 148, 7, 189, 134, 8, 201, 255, 240, 11, 254, - 134, 8, 254, 134, 8, 164, 31, 153, 172, 8, 189, 158, 8, 240, 41, 189, - 161, 8, 240, 6, 222, 161, 8, 76, 194, 7, 189, 158, 8, 16, 10, 24, - 189, 134, 8, 125, 164, 8, 76, 186, 7, 56, 189, 134, 8, 253, 164, 8, - 157, 134, 8, 164, 31, 153, 172, 8, 222, 128, 8, 202, 48, 3, 76, 238, - 5, 96, 255, 241, 228, 215, 203, 192, 181, 170, 161, 152, 143, 135, 127, 120, - 114, 107, 101, 95, 90, 85, 80, 75, 71, 67, 63, 60, 56, 53, 50, 47, - 44, 42, 39, 37, 35, 33, 31, 29, 28, 26, 23, 22, 19, 15, 7, 0, - 56, 140, 0, 106, 232, 106, 239, 128, 8, 174, 70, 230, 149, 65, 246, 176, - 110, 48, 246, 187, 132, 82, 34, 244, 200, 160, 122, 85, 52, 20, 245, 216, - 189, 164, 141, 119, 96, 78, 56, 39, 21, 6, 247, 232, 219, 207, 195, 184, - 172, 162, 154, 144, 136, 127, 120, 112, 106, 100, 94, 87, 82, 50, 10, 0, - 11, 10, 10, 9, 8, 8, 7, 7, 7, 6, 6, 5, 5, 5, 4, 4, - 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, 0, 0, 1, 1, 0, - 0, 255, 255, 31 }; -static const unsigned char CiBinaryResource_mpt_obx[2233] = { 255, 255, 0, 5, 178, 13, 76, 205, 11, 173, 46, 7, 208, 1, 96, 169, - 0, 141, 28, 14, 238, 29, 14, 173, 23, 14, 205, 187, 13, 144, 80, 206, - 21, 14, 240, 3, 76, 197, 5, 162, 0, 142, 23, 14, 169, 0, 157, 237, - 13, 157, 245, 13, 189, 179, 13, 133, 236, 189, 183, 13, 133, 237, 172, 22, - 14, 177, 236, 200, 201, 255, 240, 7, 201, 254, 208, 15, 76, 42, 12, 177, - 236, 48, 249, 10, 168, 140, 22, 14, 76, 59, 5, 157, 233, 13, 177, 236, - 157, 213, 13, 232, 224, 4, 208, 196, 200, 140, 22, 14, 76, 197, 5, 206, - 21, 14, 16, 87, 173, 188, 13, 141, 21, 14, 162, 3, 222, 245, 13, 16, - 68, 189, 233, 13, 10, 168, 185, 255, 255, 133, 236, 200, 185, 255, 255, 133, - 237, 5, 236, 240, 48, 189, 237, 13, 141, 31, 14, 32, 62, 7, 172, 31, - 14, 200, 152, 157, 237, 13, 189, 241, 13, 157, 245, 13, 224, 2, 208, 21, - 189, 197, 13, 73, 15, 10, 10, 10, 10, 105, 69, 141, 161, 13, 169, 10, - 105, 0, 141, 162, 13, 202, 16, 180, 238, 23, 14, 162, 1, 173, 27, 14, - 201, 2, 240, 2, 162, 3, 173, 27, 14, 201, 2, 208, 5, 236, 25, 14, - 240, 3, 76, 118, 6, 181, 240, 61, 114, 6, 240, 18, 160, 40, 177, 236, - 24, 125, 225, 13, 32, 117, 9, 56, 125, 1, 14, 157, 203, 13, 202, 16, - 213, 169, 3, 141, 15, 210, 165, 241, 41, 16, 240, 15, 172, 226, 13, 185, - 198, 9, 141, 201, 13, 185, 5, 10, 141, 202, 13, 173, 201, 13, 141, 0, - 210, 173, 202, 13, 141, 2, 210, 173, 203, 13, 141, 4, 210, 173, 204, 13, - 141, 6, 210, 173, 193, 13, 162, 255, 172, 27, 14, 192, 1, 208, 5, 174, - 25, 14, 240, 3, 141, 1, 210, 173, 194, 13, 224, 1, 240, 3, 141, 3, - 210, 192, 2, 240, 20, 173, 195, 13, 224, 2, 240, 3, 141, 5, 210, 173, - 196, 13, 224, 3, 240, 3, 141, 7, 210, 165, 240, 5, 241, 5, 242, 5, - 243, 13, 28, 14, 141, 8, 210, 96, 4, 2, 0, 0, 189, 217, 13, 133, - 236, 189, 221, 13, 133, 237, 5, 236, 208, 8, 157, 193, 13, 149, 240, 76, - 248, 5, 180, 244, 192, 32, 240, 66, 177, 236, 56, 253, 197, 13, 44, 58, - 7, 240, 2, 41, 240, 157, 193, 13, 200, 177, 236, 141, 30, 14, 200, 148, - 244, 41, 7, 240, 60, 168, 185, 126, 9, 141, 203, 6, 185, 133, 9, 141, - 204, 6, 173, 30, 14, 74, 74, 74, 74, 74, 9, 40, 168, 177, 236, 24, - 32, 255, 255, 169, 0, 149, 240, 76, 248, 5, 189, 9, 14, 240, 18, 222, - 13, 14, 208, 13, 157, 13, 14, 189, 193, 13, 41, 15, 240, 3, 222, 193, - 13, 160, 35, 177, 236, 149, 240, 189, 17, 14, 24, 105, 37, 168, 41, 3, - 157, 17, 14, 136, 177, 236, 125, 209, 13, 157, 225, 13, 32, 119, 9, 157, - 201, 13, 189, 5, 14, 240, 6, 222, 5, 14, 76, 223, 5, 189, 189, 13, - 141, 30, 7, 16, 254, 76, 194, 8, 0, 76, 229, 8, 0, 76, 251, 8, - 0, 76, 21, 9, 0, 76, 37, 9, 0, 76, 56, 9, 0, 76, 66, 9, - 16, 76, 72, 9, 169, 0, 157, 197, 13, 172, 31, 14, 136, 200, 177, 236, - 201, 254, 208, 4, 140, 31, 14, 96, 201, 224, 144, 8, 173, 187, 13, 141, - 23, 14, 208, 233, 201, 208, 144, 10, 41, 15, 141, 188, 13, 141, 21, 14, - 16, 219, 201, 192, 144, 9, 41, 15, 73, 15, 157, 197, 13, 16, 206, 201, - 128, 144, 7, 41, 63, 157, 241, 13, 16, 195, 201, 64, 144, 27, 200, 140, - 31, 14, 41, 31, 157, 229, 13, 10, 168, 185, 255, 255, 157, 217, 13, 200, - 185, 255, 255, 157, 221, 13, 76, 62, 7, 140, 31, 14, 141, 30, 14, 24, - 125, 213, 13, 157, 209, 13, 173, 27, 14, 240, 66, 201, 2, 240, 58, 189, - 229, 13, 201, 31, 208, 55, 173, 30, 14, 56, 233, 1, 41, 15, 168, 177, - 254, 133, 253, 152, 9, 16, 168, 177, 254, 133, 248, 160, 1, 5, 253, 208, - 2, 160, 0, 140, 26, 14, 169, 0, 133, 252, 157, 217, 13, 157, 221, 13, - 138, 10, 141, 24, 14, 142, 25, 14, 96, 224, 2, 176, 99, 189, 217, 13, - 133, 238, 189, 221, 13, 133, 239, 5, 238, 240, 74, 160, 32, 177, 238, 41, - 15, 157, 249, 13, 177, 238, 41, 112, 74, 74, 157, 189, 13, 200, 177, 238, - 10, 10, 72, 41, 63, 157, 5, 14, 104, 41, 192, 157, 205, 13, 200, 177, - 238, 157, 9, 14, 157, 13, 14, 169, 0, 149, 244, 157, 17, 14, 157, 253, - 13, 157, 1, 14, 189, 209, 13, 157, 225, 13, 32, 117, 9, 157, 201, 13, - 236, 25, 14, 240, 1, 96, 160, 255, 140, 25, 14, 200, 140, 26, 14, 96, - 224, 2, 208, 51, 172, 211, 13, 185, 69, 11, 141, 121, 13, 185, 129, 11, - 141, 127, 13, 169, 0, 133, 249, 133, 250, 173, 231, 13, 41, 15, 168, 177, - 254, 133, 251, 152, 9, 16, 168, 177, 254, 141, 137, 13, 5, 251, 208, 6, - 141, 121, 13, 141, 127, 13, 96, 173, 232, 13, 41, 15, 168, 177, 254, 133, - 253, 152, 9, 16, 168, 177, 254, 5, 253, 240, 15, 177, 254, 56, 229, 253, - 133, 248, 169, 0, 133, 252, 169, 141, 208, 2, 169, 173, 141, 97, 13, 141, - 56, 13, 169, 24, 141, 7, 210, 96, 173, 29, 14, 41, 7, 74, 74, 144, - 18, 208, 24, 189, 249, 13, 24, 157, 1, 14, 125, 201, 13, 157, 201, 13, - 76, 223, 5, 169, 0, 157, 1, 14, 76, 223, 5, 189, 201, 13, 56, 253, - 249, 13, 157, 201, 13, 56, 169, 0, 253, 249, 13, 157, 1, 14, 76, 223, - 5, 189, 253, 13, 24, 157, 1, 14, 125, 201, 13, 157, 201, 13, 24, 189, - 253, 13, 125, 249, 13, 157, 253, 13, 76, 223, 5, 189, 225, 13, 56, 253, - 253, 13, 157, 225, 13, 32, 117, 9, 76, 5, 9, 169, 0, 56, 253, 253, - 13, 157, 1, 14, 189, 201, 13, 56, 253, 253, 13, 76, 5, 9, 189, 225, - 13, 24, 125, 253, 13, 76, 28, 9, 32, 85, 9, 76, 208, 8, 32, 85, - 9, 24, 125, 225, 13, 32, 155, 9, 76, 223, 5, 188, 253, 13, 189, 249, - 13, 48, 2, 200, 200, 136, 152, 157, 253, 13, 221, 249, 13, 208, 8, 189, - 249, 13, 73, 255, 157, 249, 13, 189, 253, 13, 96, 41, 63, 29, 205, 13, - 168, 185, 255, 255, 96, 148, 145, 152, 165, 173, 180, 192, 9, 9, 9, 9, - 9, 9, 9, 64, 0, 32, 0, 125, 201, 13, 157, 201, 13, 96, 125, 209, - 13, 157, 225, 13, 32, 117, 9, 157, 201, 13, 96, 157, 201, 13, 189, 141, - 9, 16, 12, 157, 201, 13, 169, 128, 208, 5, 157, 201, 13, 169, 1, 13, - 28, 14, 141, 28, 14, 96, 45, 10, 210, 157, 201, 13, 96, 242, 51, 150, - 226, 56, 140, 0, 106, 232, 106, 239, 128, 8, 174, 70, 230, 149, 65, 246, - 176, 110, 48, 246, 187, 132, 82, 34, 244, 200, 160, 122, 85, 52, 20, 245, - 216, 189, 164, 141, 119, 96, 78, 56, 39, 21, 6, 247, 232, 219, 207, 195, - 184, 172, 162, 154, 144, 136, 127, 120, 112, 106, 100, 94, 13, 13, 12, 11, - 11, 10, 10, 9, 8, 8, 7, 7, 7, 6, 6, 5, 5, 5, 4, 4, - 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 22, 22, 23, 23, 23, - 23, 24, 24, 24, 24, 24, 25, 25, 25, 25, 26, 21, 21, 22, 22, 22, - 23, 23, 24, 24, 24, 25, 25, 26, 26, 26, 27, 20, 21, 21, 22, 22, - 23, 23, 24, 24, 24, 25, 25, 26, 26, 27, 27, 20, 20, 21, 21, 22, - 22, 23, 23, 24, 25, 25, 26, 26, 27, 27, 28, 19, 20, 20, 21, 22, - 22, 23, 23, 24, 25, 25, 26, 26, 27, 28, 28, 19, 19, 20, 21, 21, - 22, 23, 23, 24, 25, 25, 26, 27, 27, 28, 29, 18, 19, 20, 20, 21, - 22, 23, 23, 24, 25, 25, 26, 27, 28, 28, 29, 18, 19, 19, 20, 21, - 22, 22, 23, 24, 25, 26, 26, 27, 28, 29, 29, 18, 18, 19, 20, 21, - 22, 22, 23, 24, 25, 26, 26, 27, 28, 29, 30, 17, 18, 19, 20, 21, - 22, 22, 23, 24, 25, 26, 26, 27, 28, 29, 30, 17, 18, 19, 20, 21, - 21, 22, 23, 24, 25, 26, 27, 27, 28, 29, 30, 17, 18, 19, 20, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 28, 29, 30, 17, 18, 19, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 29, 30, 17, 18, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 30, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 34, 36, 38, 41, - 43, 46, 48, 51, 55, 58, 61, 65, 69, 73, 77, 82, 87, 92, 97, 103, - 110, 116, 123, 130, 138, 146, 155, 164, 174, 184, 195, 207, 220, 233, 246, 5, - 21, 37, 55, 73, 93, 113, 135, 159, 184, 210, 237, 11, 42, 75, 110, 147, - 186, 227, 15, 62, 112, 164, 219, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, - 3, 3, 3, 229, 42, 64, 89, 100, 238, 8, 166, 11, 12, 12, 12, 12, - 12, 13, 13, 142, 50, 7, 140, 54, 7, 41, 7, 168, 185, 189, 11, 141, - 227, 11, 185, 197, 11, 141, 228, 11, 76, 255, 255, 173, 54, 7, 174, 50, - 7, 141, 148, 7, 141, 155, 7, 142, 149, 7, 142, 156, 7, 24, 105, 64, - 141, 129, 5, 141, 135, 5, 144, 1, 232, 142, 130, 5, 142, 136, 5, 24, - 105, 128, 141, 124, 9, 144, 1, 232, 142, 125, 9, 232, 141, 31, 12, 142, - 32, 12, 162, 9, 189, 255, 255, 157, 179, 13, 202, 16, 247, 206, 188, 13, - 169, 0, 141, 46, 7, 162, 98, 157, 189, 13, 202, 16, 250, 162, 8, 157, - 0, 210, 202, 16, 250, 96, 32, 42, 12, 173, 50, 7, 10, 141, 22, 14, - 173, 187, 13, 141, 23, 14, 169, 1, 141, 21, 14, 141, 46, 7, 96, 173, - 54, 7, 133, 254, 173, 50, 7, 133, 255, 96, 173, 54, 7, 41, 3, 170, - 173, 50, 7, 32, 198, 7, 173, 26, 14, 240, 238, 14, 54, 7, 32, 190, - 12, 169, 1, 141, 27, 14, 173, 26, 14, 240, 222, 201, 1, 208, 5, 160, - 0, 238, 26, 14, 177, 252, 174, 24, 14, 74, 74, 74, 74, 9, 16, 141, - 10, 212, 141, 10, 212, 157, 1, 210, 177, 252, 9, 16, 141, 10, 212, 141, - 10, 212, 157, 1, 210, 200, 208, 206, 230, 253, 165, 253, 197, 248, 208, 198, - 140, 26, 14, 96, 144, 21, 169, 234, 141, 153, 12, 141, 154, 12, 141, 155, - 12, 141, 166, 12, 141, 167, 12, 141, 168, 12, 96, 169, 141, 141, 153, 12, - 141, 166, 12, 169, 10, 141, 154, 12, 141, 167, 12, 169, 212, 141, 155, 12, - 141, 168, 12, 96, 169, 0, 141, 26, 14, 173, 50, 7, 74, 32, 190, 12, - 169, 1, 141, 27, 14, 32, 128, 12, 173, 27, 14, 208, 248, 96, 169, 2, - 141, 27, 14, 141, 25, 14, 169, 24, 141, 7, 210, 169, 17, 133, 250, 169, - 13, 133, 251, 169, 173, 141, 97, 13, 141, 56, 13, 160, 0, 140, 121, 13, - 140, 127, 13, 174, 11, 212, 177, 252, 74, 74, 74, 74, 9, 16, 141, 7, - 210, 32, 117, 13, 236, 11, 212, 240, 251, 141, 5, 210, 174, 11, 212, 177, - 252, 230, 252, 208, 16, 230, 253, 198, 248, 208, 10, 169, 173, 141, 97, 13, - 141, 56, 13, 169, 8, 9, 16, 141, 7, 210, 32, 117, 13, 236, 11, 212, - 240, 251, 141, 5, 210, 173, 27, 14, 208, 185, 96, 24, 165, 249, 105, 0, - 133, 249, 165, 250, 105, 0, 133, 250, 144, 15, 230, 251, 165, 251, 201, 0, - 208, 7, 140, 121, 13, 140, 127, 13, 96, 177, 250, 36, 249, 48, 4, 74, - 74, 74, 74, 41, 15, 168, 185, 69, 10, 160, 0, 96, 160, 0, 140, 27, - 14, 140, 26, 14, 136, 140, 25, 14, 96 }; -static const unsigned char CiBinaryResource_rmt4_obx[2007] = { 255, 255, 144, 3, 96, 11, 128, 0, 128, 32, 128, 64, 0, 192, 128, 128, - 128, 160, 0, 192, 64, 192, 0, 1, 5, 11, 21, 0, 1, 255, 255, 1, - 1, 0, 255, 255, 0, 1, 1, 1, 0, 255, 255, 255, 255, 0, 1, 1, - 0, 0, 0, 0, 0, 0, 242, 51, 150, 226, 56, 140, 0, 106, 232, 106, - 239, 128, 8, 174, 70, 230, 149, 65, 246, 176, 110, 48, 246, 187, 132, 82, - 34, 244, 200, 160, 122, 85, 52, 20, 245, 216, 189, 164, 141, 119, 96, 78, - 56, 39, 21, 6, 247, 232, 219, 207, 195, 184, 172, 162, 154, 144, 136, 127, - 120, 112, 106, 100, 94, 0, 191, 182, 170, 161, 152, 143, 137, 128, 242, 230, - 218, 206, 191, 182, 170, 161, 152, 143, 137, 128, 122, 113, 107, 101, 95, 92, - 86, 80, 77, 71, 68, 62, 60, 56, 53, 50, 47, 45, 42, 40, 37, 35, - 33, 31, 29, 28, 26, 24, 23, 22, 20, 19, 18, 17, 16, 15, 14, 13, - 12, 11, 10, 9, 8, 7, 255, 241, 228, 216, 202, 192, 181, 171, 162, 153, - 142, 135, 127, 121, 115, 112, 102, 97, 90, 85, 82, 75, 72, 67, 63, 60, - 57, 55, 51, 48, 45, 42, 40, 37, 36, 33, 31, 30, 28, 27, 25, 23, - 22, 21, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, - 5, 4, 3, 2, 1, 0, 243, 230, 217, 204, 193, 181, 173, 162, 153, 144, - 136, 128, 121, 114, 108, 102, 96, 91, 85, 81, 76, 72, 68, 64, 60, 57, - 53, 50, 47, 45, 42, 40, 37, 35, 33, 31, 29, 28, 26, 24, 23, 22, - 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, - 4, 3, 2, 1, 0, 0, 13, 13, 12, 11, 11, 10, 10, 9, 8, 8, - 7, 7, 7, 6, 6, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, - 3, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, - 1, 1, 2, 2, 2, 2, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, - 2, 2, 2, 3, 3, 3, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, - 3, 3, 3, 3, 4, 4, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, - 3, 4, 4, 4, 5, 5, 0, 0, 1, 1, 2, 2, 2, 3, 3, 4, - 4, 4, 5, 5, 6, 6, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, - 5, 5, 6, 6, 7, 7, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, - 5, 6, 6, 7, 7, 8, 0, 1, 1, 2, 2, 3, 4, 4, 5, 5, - 6, 7, 7, 8, 8, 9, 0, 1, 1, 2, 3, 3, 4, 5, 5, 6, - 7, 7, 8, 9, 9, 10, 0, 1, 1, 2, 3, 4, 4, 5, 6, 7, - 7, 8, 9, 10, 10, 11, 0, 1, 2, 2, 3, 4, 5, 6, 6, 7, - 8, 9, 10, 10, 11, 12, 0, 1, 2, 3, 3, 4, 5, 6, 7, 8, - 9, 10, 10, 11, 12, 13, 0, 1, 2, 3, 4, 5, 6, 7, 7, 8, - 9, 10, 11, 12, 13, 14, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 76, 15, 6, 76, 252, 7, 76, 33, 8, 76, - 88, 6, 76, 43, 11, 134, 211, 132, 212, 72, 160, 168, 169, 0, 153, 127, - 2, 136, 208, 250, 160, 4, 177, 211, 141, 21, 8, 200, 177, 211, 141, 36, - 3, 200, 177, 211, 141, 5, 8, 141, 38, 3, 160, 8, 177, 211, 153, 195, - 0, 200, 192, 16, 208, 246, 104, 72, 10, 10, 24, 101, 209, 133, 209, 104, - 8, 41, 192, 10, 42, 42, 40, 101, 210, 133, 210, 32, 110, 6, 169, 0, - 141, 8, 210, 160, 3, 140, 15, 210, 160, 8, 153, 0, 210, 136, 16, 250, - 173, 5, 8, 96, 162, 0, 142, 39, 3, 138, 168, 177, 209, 201, 254, 176, - 45, 168, 177, 205, 157, 128, 2, 177, 207, 157, 132, 2, 169, 0, 157, 136, - 2, 169, 1, 157, 140, 2, 169, 128, 157, 180, 2, 232, 224, 4, 208, 217, - 165, 209, 24, 105, 4, 133, 209, 144, 27, 230, 210, 76, 190, 6, 240, 4, - 169, 0, 240, 223, 160, 2, 177, 209, 170, 200, 177, 209, 133, 210, 134, 209, - 162, 0, 240, 181, 173, 36, 3, 141, 22, 7, 162, 255, 232, 222, 140, 2, - 208, 69, 189, 128, 2, 133, 211, 189, 132, 2, 133, 212, 188, 136, 2, 254, - 136, 2, 177, 211, 133, 217, 41, 63, 201, 61, 240, 17, 176, 56, 157, 144, - 2, 157, 16, 3, 200, 177, 211, 74, 41, 126, 157, 180, 2, 169, 1, 157, - 140, 2, 188, 136, 2, 254, 136, 2, 177, 211, 74, 102, 217, 74, 102, 217, - 165, 217, 41, 240, 157, 148, 2, 224, 3, 208, 177, 169, 255, 141, 36, 3, - 141, 37, 3, 76, 101, 7, 201, 63, 240, 27, 165, 217, 41, 192, 240, 9, - 10, 42, 42, 157, 140, 2, 76, 17, 7, 200, 177, 211, 157, 140, 2, 254, - 136, 2, 76, 17, 7, 165, 217, 48, 12, 200, 177, 211, 141, 22, 7, 254, - 136, 2, 76, 214, 6, 201, 255, 240, 9, 200, 177, 211, 157, 136, 2, 76, - 214, 6, 76, 110, 6, 76, 33, 8, 202, 48, 250, 188, 180, 2, 48, 248, - 177, 203, 157, 184, 2, 133, 215, 200, 177, 203, 157, 188, 2, 133, 216, 169, - 1, 157, 20, 3, 168, 177, 215, 157, 4, 3, 200, 177, 215, 157, 196, 2, - 200, 177, 215, 157, 200, 2, 200, 177, 215, 157, 240, 2, 41, 63, 157, 8, - 3, 177, 215, 41, 64, 157, 244, 2, 200, 177, 215, 157, 32, 3, 200, 177, - 215, 157, 208, 2, 200, 177, 215, 157, 216, 2, 200, 177, 215, 157, 220, 2, - 200, 177, 215, 168, 185, 160, 3, 157, 224, 2, 157, 228, 2, 185, 161, 3, - 157, 232, 2, 160, 10, 177, 215, 157, 236, 2, 169, 128, 157, 212, 2, 157, - 180, 2, 10, 157, 204, 2, 157, 156, 2, 168, 177, 215, 157, 0, 3, 105, - 0, 157, 192, 2, 169, 12, 157, 252, 2, 168, 177, 215, 157, 248, 2, 76, - 98, 7, 32, 43, 11, 206, 38, 3, 208, 29, 169, 255, 141, 38, 3, 206, - 37, 3, 208, 19, 238, 39, 3, 173, 39, 3, 201, 255, 240, 3, 76, 190, - 6, 76, 110, 6, 76, 95, 10, 169, 4, 133, 214, 162, 3, 189, 188, 2, - 240, 242, 133, 212, 189, 184, 2, 133, 211, 188, 192, 2, 177, 211, 133, 217, - 200, 177, 211, 133, 218, 200, 177, 211, 133, 219, 200, 152, 221, 196, 2, 144, - 10, 240, 8, 169, 128, 157, 204, 2, 189, 200, 2, 157, 192, 2, 165, 217, - 41, 15, 29, 148, 2, 168, 185, 0, 5, 133, 220, 165, 218, 41, 14, 168, - 185, 144, 3, 133, 213, 165, 220, 25, 145, 3, 157, 28, 3, 189, 220, 2, - 240, 40, 201, 1, 208, 33, 189, 156, 2, 24, 125, 236, 2, 24, 188, 224, - 2, 121, 165, 3, 157, 156, 2, 200, 152, 221, 232, 2, 208, 3, 189, 228, - 2, 157, 224, 2, 76, 164, 8, 222, 220, 2, 188, 0, 3, 192, 13, 144, - 60, 189, 8, 3, 16, 49, 152, 221, 252, 2, 208, 8, 189, 4, 3, 157, - 252, 2, 208, 3, 254, 252, 2, 189, 184, 2, 133, 215, 189, 188, 2, 133, - 216, 188, 252, 2, 177, 215, 188, 244, 2, 240, 4, 24, 125, 248, 2, 157, - 248, 2, 189, 240, 2, 41, 63, 56, 233, 1, 157, 8, 3, 189, 204, 2, - 16, 31, 189, 148, 2, 240, 26, 221, 216, 2, 240, 21, 144, 19, 168, 189, - 212, 2, 24, 125, 208, 2, 157, 212, 2, 144, 6, 152, 233, 16, 157, 148, - 2, 169, 0, 133, 221, 165, 218, 157, 12, 3, 41, 112, 74, 74, 141, 28, - 9, 144, 254, 76, 210, 9, 234, 76, 60, 9, 234, 76, 65, 9, 234, 76, - 75, 9, 234, 76, 87, 9, 234, 76, 102, 9, 234, 76, 169, 9, 234, 76, - 184, 9, 165, 219, 76, 21, 10, 165, 219, 133, 221, 189, 144, 2, 76, 216, - 9, 189, 144, 2, 24, 101, 219, 157, 144, 2, 76, 216, 9, 189, 156, 2, - 24, 101, 219, 157, 156, 2, 189, 144, 2, 76, 216, 9, 189, 240, 2, 16, - 12, 188, 144, 2, 177, 213, 24, 125, 248, 2, 76, 135, 9, 189, 144, 2, - 24, 125, 248, 2, 201, 61, 144, 2, 169, 63, 168, 177, 213, 157, 160, 2, - 164, 219, 208, 3, 157, 164, 2, 152, 74, 74, 74, 74, 157, 168, 2, 157, - 172, 2, 165, 219, 41, 15, 157, 176, 2, 189, 144, 2, 76, 216, 9, 165, - 219, 24, 125, 20, 3, 157, 20, 3, 189, 144, 2, 76, 216, 9, 165, 219, - 201, 128, 240, 6, 157, 144, 2, 76, 216, 9, 189, 28, 3, 9, 240, 157, - 28, 3, 189, 144, 2, 76, 216, 9, 189, 144, 2, 24, 101, 219, 188, 240, - 2, 48, 31, 24, 125, 248, 2, 201, 61, 144, 7, 169, 0, 157, 28, 3, - 169, 63, 157, 16, 3, 168, 177, 213, 24, 125, 156, 2, 24, 101, 221, 76, - 21, 10, 201, 61, 144, 7, 169, 0, 157, 28, 3, 169, 63, 168, 189, 156, - 2, 24, 125, 248, 2, 24, 113, 213, 24, 101, 221, 157, 24, 3, 189, 172, - 2, 240, 50, 222, 172, 2, 208, 45, 189, 168, 2, 157, 172, 2, 189, 164, - 2, 221, 160, 2, 240, 31, 176, 13, 125, 176, 2, 176, 18, 221, 160, 2, - 176, 13, 76, 76, 10, 253, 176, 2, 144, 5, 221, 160, 2, 176, 3, 189, - 160, 2, 157, 164, 2, 165, 218, 41, 1, 240, 10, 189, 164, 2, 24, 125, - 156, 2, 157, 24, 3, 202, 48, 3, 76, 39, 8, 173, 32, 3, 13, 33, - 3, 13, 34, 3, 13, 35, 3, 170, 142, 44, 11, 173, 12, 3, 16, 33, - 173, 28, 3, 41, 15, 240, 26, 173, 24, 3, 24, 109, 20, 3, 141, 26, - 3, 173, 30, 3, 41, 16, 208, 5, 169, 0, 141, 30, 3, 138, 9, 4, - 170, 173, 13, 3, 16, 33, 173, 29, 3, 41, 15, 240, 26, 173, 25, 3, - 24, 109, 21, 3, 141, 27, 3, 173, 31, 3, 41, 16, 208, 5, 169, 0, - 141, 31, 3, 138, 9, 2, 170, 236, 44, 11, 208, 94, 173, 13, 3, 41, - 14, 201, 6, 208, 38, 173, 29, 3, 41, 15, 240, 31, 172, 17, 3, 185, - 192, 3, 141, 24, 3, 185, 192, 4, 141, 25, 3, 173, 28, 3, 41, 16, - 208, 5, 169, 0, 141, 28, 3, 138, 9, 80, 170, 173, 15, 3, 41, 14, - 201, 6, 208, 38, 173, 31, 3, 41, 15, 240, 31, 172, 19, 3, 185, 192, - 3, 141, 26, 3, 185, 192, 4, 141, 27, 3, 173, 30, 3, 41, 16, 208, - 5, 169, 0, 141, 30, 3, 138, 9, 40, 170, 142, 44, 11, 173, 38, 3, - 96, 160, 255, 173, 24, 3, 174, 28, 3, 141, 0, 210, 142, 1, 210, 173, - 25, 3, 174, 29, 3, 141, 2, 210, 142, 3, 210, 173, 26, 3, 174, 30, - 3, 141, 4, 210, 142, 5, 210, 173, 27, 3, 174, 31, 3, 141, 6, 210, - 142, 7, 210, 140, 8, 210, 96 }; -static const unsigned char CiBinaryResource_rmt8_obx[2275] = { 255, 255, 144, 3, 108, 12, 128, 0, 128, 32, 128, 64, 0, 192, 128, 128, - 128, 160, 0, 192, 64, 192, 0, 1, 5, 11, 21, 0, 1, 255, 255, 1, - 1, 0, 255, 255, 0, 1, 1, 1, 0, 255, 255, 255, 255, 0, 1, 1, - 0, 0, 0, 0, 0, 0, 242, 51, 150, 226, 56, 140, 0, 106, 232, 106, - 239, 128, 8, 174, 70, 230, 149, 65, 246, 176, 110, 48, 246, 187, 132, 82, - 34, 244, 200, 160, 122, 85, 52, 20, 245, 216, 189, 164, 141, 119, 96, 78, - 56, 39, 21, 6, 247, 232, 219, 207, 195, 184, 172, 162, 154, 144, 136, 127, - 120, 112, 106, 100, 94, 0, 191, 182, 170, 161, 152, 143, 137, 128, 242, 230, - 218, 206, 191, 182, 170, 161, 152, 143, 137, 128, 122, 113, 107, 101, 95, 92, - 86, 80, 77, 71, 68, 62, 60, 56, 53, 50, 47, 45, 42, 40, 37, 35, - 33, 31, 29, 28, 26, 24, 23, 22, 20, 19, 18, 17, 16, 15, 14, 13, - 12, 11, 10, 9, 8, 7, 255, 241, 228, 216, 202, 192, 181, 171, 162, 153, - 142, 135, 127, 121, 115, 112, 102, 97, 90, 85, 82, 75, 72, 67, 63, 60, - 57, 55, 51, 48, 45, 42, 40, 37, 36, 33, 31, 30, 28, 27, 25, 23, - 22, 21, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, - 5, 4, 3, 2, 1, 0, 243, 230, 217, 204, 193, 181, 173, 162, 153, 144, - 136, 128, 121, 114, 108, 102, 96, 91, 85, 81, 76, 72, 68, 64, 60, 57, - 53, 50, 47, 45, 42, 40, 37, 35, 33, 31, 29, 28, 26, 24, 23, 22, - 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, - 4, 3, 2, 1, 0, 0, 13, 13, 12, 11, 11, 10, 10, 9, 8, 8, - 7, 7, 7, 6, 6, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, - 3, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, - 1, 1, 2, 2, 2, 2, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, - 2, 2, 2, 3, 3, 3, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, - 3, 3, 3, 3, 4, 4, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, - 3, 4, 4, 4, 5, 5, 0, 0, 1, 1, 2, 2, 2, 3, 3, 4, - 4, 4, 5, 5, 6, 6, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, - 5, 5, 6, 6, 7, 7, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, - 5, 6, 6, 7, 7, 8, 0, 1, 1, 2, 2, 3, 4, 4, 5, 5, - 6, 7, 7, 8, 8, 9, 0, 1, 1, 2, 3, 3, 4, 5, 5, 6, - 7, 7, 8, 9, 9, 10, 0, 1, 1, 2, 3, 4, 4, 5, 6, 7, - 7, 8, 9, 10, 10, 11, 0, 1, 2, 2, 3, 4, 5, 6, 6, 7, - 8, 9, 10, 10, 11, 12, 0, 1, 2, 3, 3, 4, 5, 6, 7, 8, - 9, 10, 10, 11, 12, 13, 0, 1, 2, 3, 4, 5, 6, 7, 7, 8, - 9, 10, 11, 12, 13, 14, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 76, 15, 6, 76, 9, 8, 76, 46, 8, 76, - 92, 6, 76, 2, 12, 134, 211, 132, 212, 72, 160, 0, 152, 153, 0, 2, - 153, 76, 2, 200, 208, 247, 160, 4, 177, 211, 141, 34, 8, 200, 177, 211, - 141, 72, 3, 200, 177, 211, 141, 18, 8, 141, 74, 3, 160, 8, 177, 211, - 153, 195, 0, 200, 192, 16, 208, 246, 104, 72, 10, 10, 10, 24, 101, 209, - 133, 209, 104, 8, 41, 224, 10, 42, 42, 42, 40, 101, 210, 133, 210, 32, - 123, 6, 169, 0, 141, 8, 210, 141, 24, 210, 160, 3, 140, 15, 210, 140, - 31, 210, 160, 8, 153, 0, 210, 153, 16, 210, 136, 16, 247, 173, 18, 8, - 96, 162, 0, 142, 75, 3, 138, 168, 177, 209, 201, 254, 176, 45, 168, 177, - 205, 157, 0, 2, 177, 207, 157, 8, 2, 169, 0, 157, 16, 2, 169, 1, - 157, 24, 2, 169, 128, 157, 104, 2, 232, 224, 8, 208, 217, 165, 209, 24, - 105, 8, 133, 209, 144, 27, 230, 210, 76, 203, 6, 240, 4, 169, 0, 240, - 223, 160, 2, 177, 209, 170, 200, 177, 209, 133, 210, 134, 209, 162, 0, 240, - 181, 173, 72, 3, 141, 35, 7, 162, 255, 232, 222, 24, 2, 208, 69, 189, - 0, 2, 133, 211, 189, 8, 2, 133, 212, 188, 16, 2, 254, 16, 2, 177, - 211, 133, 217, 41, 63, 201, 61, 240, 17, 176, 56, 157, 32, 2, 157, 32, - 3, 200, 177, 211, 74, 41, 126, 157, 104, 2, 169, 1, 157, 24, 2, 188, - 16, 2, 254, 16, 2, 177, 211, 74, 102, 217, 74, 102, 217, 165, 217, 41, - 240, 157, 40, 2, 224, 7, 208, 177, 169, 255, 141, 72, 3, 141, 73, 3, - 76, 114, 7, 201, 63, 240, 27, 165, 217, 41, 192, 240, 9, 10, 42, 42, - 157, 24, 2, 76, 30, 7, 200, 177, 211, 157, 24, 2, 254, 16, 2, 76, - 30, 7, 165, 217, 48, 12, 200, 177, 211, 141, 35, 7, 254, 16, 2, 76, - 227, 6, 201, 255, 240, 9, 200, 177, 211, 157, 16, 2, 76, 227, 6, 76, - 123, 6, 76, 46, 8, 202, 48, 250, 188, 104, 2, 48, 248, 177, 203, 157, - 112, 2, 133, 215, 200, 177, 203, 157, 120, 2, 133, 216, 169, 1, 157, 40, - 3, 168, 177, 215, 157, 8, 3, 200, 177, 215, 157, 136, 2, 200, 177, 215, - 157, 144, 2, 200, 177, 215, 157, 224, 2, 41, 63, 157, 16, 3, 177, 215, - 41, 64, 157, 232, 2, 200, 177, 215, 157, 64, 3, 200, 177, 215, 157, 160, - 2, 200, 177, 215, 157, 176, 2, 200, 177, 215, 157, 184, 2, 200, 177, 215, - 168, 185, 160, 3, 157, 192, 2, 157, 200, 2, 185, 161, 3, 157, 208, 2, - 160, 10, 177, 215, 157, 216, 2, 169, 128, 157, 168, 2, 157, 104, 2, 10, - 157, 152, 2, 157, 56, 2, 168, 177, 215, 157, 0, 3, 105, 0, 157, 128, - 2, 169, 12, 157, 248, 2, 168, 177, 215, 157, 240, 2, 76, 111, 7, 32, - 2, 12, 206, 74, 3, 208, 29, 169, 255, 141, 74, 3, 206, 73, 3, 208, - 19, 238, 75, 3, 173, 75, 3, 201, 255, 240, 3, 76, 203, 6, 76, 123, - 6, 76, 116, 10, 169, 4, 133, 214, 162, 7, 189, 120, 2, 240, 242, 133, - 212, 189, 112, 2, 133, 211, 188, 128, 2, 177, 211, 133, 217, 200, 177, 211, - 133, 218, 200, 177, 211, 133, 219, 200, 152, 221, 136, 2, 144, 10, 240, 8, - 169, 128, 157, 152, 2, 189, 144, 2, 157, 128, 2, 165, 217, 224, 4, 144, - 4, 74, 74, 74, 74, 41, 15, 29, 40, 2, 168, 185, 0, 5, 133, 220, - 165, 218, 41, 14, 168, 185, 144, 3, 133, 213, 165, 220, 25, 145, 3, 157, - 56, 3, 189, 184, 2, 240, 40, 201, 1, 208, 33, 189, 56, 2, 24, 125, - 216, 2, 24, 188, 192, 2, 121, 165, 3, 157, 56, 2, 200, 152, 221, 208, - 2, 208, 3, 189, 200, 2, 157, 192, 2, 76, 185, 8, 222, 184, 2, 188, - 0, 3, 192, 13, 144, 60, 189, 16, 3, 16, 49, 152, 221, 248, 2, 208, - 8, 189, 8, 3, 157, 248, 2, 208, 3, 254, 248, 2, 189, 112, 2, 133, - 215, 189, 120, 2, 133, 216, 188, 248, 2, 177, 215, 188, 232, 2, 240, 4, - 24, 125, 240, 2, 157, 240, 2, 189, 224, 2, 41, 63, 56, 233, 1, 157, - 16, 3, 189, 152, 2, 16, 31, 189, 40, 2, 240, 26, 221, 176, 2, 240, - 21, 144, 19, 168, 189, 168, 2, 24, 125, 160, 2, 157, 168, 2, 144, 6, - 152, 233, 16, 157, 40, 2, 169, 0, 133, 221, 165, 218, 157, 24, 3, 41, - 112, 74, 74, 141, 49, 9, 144, 254, 76, 231, 9, 234, 76, 81, 9, 234, - 76, 86, 9, 234, 76, 96, 9, 234, 76, 108, 9, 234, 76, 123, 9, 234, - 76, 190, 9, 234, 76, 205, 9, 165, 219, 76, 42, 10, 165, 219, 133, 221, - 189, 32, 2, 76, 237, 9, 189, 32, 2, 24, 101, 219, 157, 32, 2, 76, - 237, 9, 189, 56, 2, 24, 101, 219, 157, 56, 2, 189, 32, 2, 76, 237, - 9, 189, 224, 2, 16, 12, 188, 32, 2, 177, 213, 24, 125, 240, 2, 76, - 156, 9, 189, 32, 2, 24, 125, 240, 2, 201, 61, 144, 2, 169, 63, 168, - 177, 213, 157, 64, 2, 164, 219, 208, 3, 157, 72, 2, 152, 74, 74, 74, - 74, 157, 80, 2, 157, 88, 2, 165, 219, 41, 15, 157, 96, 2, 189, 32, - 2, 76, 237, 9, 165, 219, 24, 125, 40, 3, 157, 40, 3, 189, 32, 2, - 76, 237, 9, 165, 219, 201, 128, 240, 6, 157, 32, 2, 76, 237, 9, 189, - 56, 3, 9, 240, 157, 56, 3, 189, 32, 2, 76, 237, 9, 189, 32, 2, - 24, 101, 219, 188, 224, 2, 48, 31, 24, 125, 240, 2, 201, 61, 144, 7, - 169, 0, 157, 56, 3, 169, 63, 157, 32, 3, 168, 177, 213, 24, 125, 56, - 2, 24, 101, 221, 76, 42, 10, 201, 61, 144, 7, 169, 0, 157, 56, 3, - 169, 63, 168, 189, 56, 2, 24, 125, 240, 2, 24, 113, 213, 24, 101, 221, - 157, 48, 3, 189, 88, 2, 240, 50, 222, 88, 2, 208, 45, 189, 80, 2, - 157, 88, 2, 189, 72, 2, 221, 64, 2, 240, 31, 176, 13, 125, 96, 2, - 176, 18, 221, 64, 2, 176, 13, 76, 97, 10, 253, 96, 2, 144, 5, 221, - 64, 2, 176, 3, 189, 64, 2, 157, 72, 2, 165, 218, 41, 1, 240, 10, - 189, 72, 2, 24, 125, 56, 2, 157, 48, 3, 202, 48, 3, 76, 52, 8, - 173, 64, 3, 13, 65, 3, 13, 66, 3, 13, 67, 3, 170, 142, 101, 12, - 173, 24, 3, 16, 33, 173, 56, 3, 41, 15, 240, 26, 173, 48, 3, 24, - 109, 40, 3, 141, 50, 3, 173, 58, 3, 41, 16, 208, 5, 169, 0, 141, - 58, 3, 138, 9, 4, 170, 173, 25, 3, 16, 33, 173, 57, 3, 41, 15, - 240, 26, 173, 49, 3, 24, 109, 41, 3, 141, 51, 3, 173, 59, 3, 41, - 16, 208, 5, 169, 0, 141, 59, 3, 138, 9, 2, 170, 236, 101, 12, 208, - 94, 173, 25, 3, 41, 14, 201, 6, 208, 38, 173, 57, 3, 41, 15, 240, - 31, 172, 33, 3, 185, 192, 3, 141, 48, 3, 185, 192, 4, 141, 49, 3, - 173, 56, 3, 41, 16, 208, 5, 169, 0, 141, 56, 3, 138, 9, 80, 170, - 173, 27, 3, 41, 14, 201, 6, 208, 38, 173, 59, 3, 41, 15, 240, 31, - 172, 35, 3, 185, 192, 3, 141, 50, 3, 185, 192, 4, 141, 51, 3, 173, - 58, 3, 41, 16, 208, 5, 169, 0, 141, 58, 3, 138, 9, 40, 170, 142, - 101, 12, 173, 68, 3, 13, 69, 3, 13, 70, 3, 13, 71, 3, 170, 142, - 3, 12, 173, 28, 3, 16, 33, 173, 60, 3, 41, 15, 240, 26, 173, 52, - 3, 24, 109, 44, 3, 141, 54, 3, 173, 62, 3, 41, 16, 208, 5, 169, - 0, 141, 62, 3, 138, 9, 4, 170, 173, 29, 3, 16, 33, 173, 61, 3, - 41, 15, 240, 26, 173, 53, 3, 24, 109, 45, 3, 141, 55, 3, 173, 63, - 3, 41, 16, 208, 5, 169, 0, 141, 63, 3, 138, 9, 2, 170, 236, 3, - 12, 208, 94, 173, 29, 3, 41, 14, 201, 6, 208, 38, 173, 61, 3, 41, - 15, 240, 31, 172, 37, 3, 185, 192, 3, 141, 52, 3, 185, 192, 4, 141, - 53, 3, 173, 60, 3, 41, 16, 208, 5, 169, 0, 141, 60, 3, 138, 9, - 80, 170, 173, 31, 3, 41, 14, 201, 6, 208, 38, 173, 63, 3, 41, 15, - 240, 31, 172, 39, 3, 185, 192, 3, 141, 54, 3, 185, 192, 4, 141, 55, - 3, 173, 62, 3, 41, 16, 208, 5, 169, 0, 141, 62, 3, 138, 9, 40, - 170, 142, 3, 12, 173, 74, 3, 96, 160, 255, 173, 52, 3, 174, 48, 3, - 141, 16, 210, 142, 0, 210, 173, 60, 3, 174, 56, 3, 141, 17, 210, 142, - 1, 210, 173, 53, 3, 174, 49, 3, 141, 18, 210, 142, 2, 210, 173, 61, - 3, 174, 57, 3, 141, 19, 210, 142, 3, 210, 173, 54, 3, 174, 50, 3, - 141, 20, 210, 142, 4, 210, 173, 62, 3, 174, 58, 3, 141, 21, 210, 142, - 5, 210, 173, 55, 3, 174, 51, 3, 141, 22, 210, 142, 6, 210, 173, 63, - 3, 174, 59, 3, 141, 23, 210, 142, 7, 210, 169, 255, 140, 24, 210, 141, - 8, 210, 96 }; -static const unsigned char CiBinaryResource_tm2_obx[3698] = { 255, 255, 0, 5, 107, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, - 1, 1, 2, 2, 2, 2, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, - 2, 2, 2, 3, 3, 3, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, - 3, 3, 3, 3, 4, 4, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, - 3, 4, 4, 4, 5, 5, 0, 0, 1, 1, 2, 2, 2, 3, 3, 4, - 4, 4, 5, 5, 6, 6, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, - 5, 5, 6, 6, 7, 7, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, - 5, 6, 6, 7, 7, 8, 0, 1, 1, 2, 2, 3, 4, 4, 5, 5, - 6, 7, 7, 8, 8, 9, 0, 1, 1, 2, 3, 3, 4, 5, 5, 6, - 7, 7, 8, 9, 9, 10, 0, 1, 1, 2, 3, 4, 4, 5, 6, 7, - 7, 8, 9, 10, 10, 11, 0, 1, 2, 2, 3, 4, 5, 6, 6, 7, - 8, 9, 10, 10, 11, 12, 0, 1, 2, 3, 3, 4, 5, 6, 7, 8, - 9, 10, 10, 11, 12, 13, 0, 1, 2, 3, 4, 5, 6, 7, 7, 8, - 9, 10, 11, 12, 13, 14, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 0, 241, 228, 215, 203, 192, 181, 170, 161, 152, - 143, 135, 127, 120, 114, 107, 101, 95, 90, 85, 80, 75, 71, 67, 63, 60, - 56, 53, 50, 47, 44, 42, 39, 37, 35, 33, 31, 29, 28, 26, 24, 23, - 22, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, - 5, 4, 3, 2, 1, 0, 0, 242, 233, 218, 206, 191, 182, 170, 161, 152, - 143, 137, 128, 122, 113, 107, 101, 95, 92, 86, 80, 77, 71, 68, 62, 60, - 56, 53, 50, 47, 45, 42, 40, 37, 35, 33, 31, 29, 28, 26, 24, 23, - 22, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, - 5, 4, 3, 2, 1, 0, 0, 255, 241, 228, 216, 202, 192, 181, 171, 162, - 153, 142, 135, 127, 121, 115, 112, 102, 97, 90, 85, 82, 75, 72, 67, 63, - 60, 57, 55, 51, 48, 45, 42, 40, 37, 36, 33, 31, 30, 28, 27, 25, - 23, 22, 21, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, - 6, 5, 4, 3, 2, 1, 0, 243, 230, 217, 204, 193, 181, 173, 162, 153, - 144, 136, 128, 121, 114, 108, 102, 96, 91, 85, 81, 76, 72, 68, 64, 60, - 57, 53, 50, 47, 45, 42, 40, 37, 35, 33, 31, 29, 28, 26, 24, 23, - 22, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, - 5, 4, 3, 2, 1, 0, 226, 56, 140, 0, 106, 232, 106, 239, 128, 8, - 174, 70, 230, 149, 65, 246, 176, 110, 48, 246, 187, 132, 82, 34, 244, 200, - 160, 122, 85, 52, 20, 245, 216, 189, 164, 141, 119, 96, 78, 56, 39, 21, - 6, 247, 232, 219, 207, 195, 184, 172, 162, 154, 144, 136, 127, 120, 112, 106, - 100, 94, 87, 82, 50, 10, 0, 242, 51, 150, 226, 56, 140, 0, 106, 232, - 106, 239, 128, 8, 174, 70, 230, 149, 65, 246, 176, 110, 48, 246, 187, 132, - 82, 34, 244, 200, 160, 122, 85, 52, 20, 245, 216, 189, 164, 141, 119, 96, - 78, 56, 39, 21, 6, 247, 232, 219, 207, 195, 184, 172, 162, 154, 144, 136, - 127, 120, 112, 106, 100, 94, 11, 11, 10, 10, 9, 8, 8, 7, 7, 7, - 6, 6, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 3, 2, 2, - 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 13, 13, 12, 11, 11, 10, 10, 9, 8, - 8, 7, 7, 7, 6, 6, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, - 3, 3, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 76, 228, 16, 76, 227, 9, 76, 159, 11, 1, - 16, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, - 6, 7, 0, 1, 2, 3, 4, 2, 0, 0, 4, 2, 0, 0, 0, 16, - 0, 8, 0, 16, 0, 8, 133, 211, 129, 169, 133, 211, 129, 169, 136, 177, - 250, 141, 23, 8, 162, 0, 134, 252, 10, 38, 252, 10, 38, 252, 10, 38, - 252, 10, 38, 252, 109, 23, 8, 144, 2, 230, 252, 24, 105, 0, 133, 250, - 165, 252, 105, 0, 133, 251, 76, 7, 10, 32, 181, 12, 173, 22, 8, 240, - 5, 206, 28, 8, 48, 3, 76, 162, 11, 206, 29, 8, 208, 82, 162, 0, - 238, 23, 8, 173, 25, 8, 133, 250, 173, 26, 8, 133, 251, 160, 16, 177, - 250, 48, 171, 208, 3, 76, 44, 18, 141, 29, 8, 136, 177, 250, 136, 132, - 252, 168, 185, 255, 255, 157, 80, 8, 185, 255, 255, 157, 88, 8, 169, 0, - 157, 112, 8, 157, 96, 8, 164, 252, 177, 250, 157, 104, 8, 232, 136, 16, - 219, 169, 17, 24, 101, 250, 141, 25, 8, 169, 0, 101, 251, 141, 26, 8, - 173, 27, 8, 141, 28, 8, 162, 7, 222, 112, 8, 48, 6, 202, 16, 248, - 76, 162, 11, 189, 80, 8, 133, 250, 189, 88, 8, 133, 251, 188, 96, 8, - 177, 250, 208, 28, 200, 177, 250, 157, 208, 8, 41, 240, 157, 216, 8, 177, - 250, 10, 10, 10, 10, 157, 224, 8, 200, 152, 157, 96, 8, 76, 87, 10, - 201, 64, 176, 79, 125, 104, 8, 157, 152, 8, 200, 177, 250, 16, 37, 41, - 127, 133, 252, 200, 177, 250, 157, 208, 8, 41, 240, 157, 216, 8, 177, 250, - 10, 10, 10, 10, 157, 224, 8, 200, 152, 157, 96, 8, 164, 252, 32, 156, - 18, 76, 87, 10, 168, 254, 96, 8, 254, 96, 8, 189, 208, 8, 41, 240, - 157, 216, 8, 189, 208, 8, 10, 10, 10, 10, 157, 224, 8, 32, 156, 18, - 76, 87, 10, 201, 128, 176, 37, 41, 63, 24, 125, 104, 8, 157, 152, 8, - 200, 177, 250, 157, 208, 8, 41, 240, 157, 216, 8, 177, 250, 10, 10, 10, - 10, 157, 224, 8, 200, 152, 157, 96, 8, 76, 87, 10, 208, 14, 200, 177, - 250, 157, 112, 8, 200, 152, 157, 96, 8, 76, 87, 10, 201, 192, 176, 15, - 41, 63, 24, 125, 104, 8, 157, 152, 8, 254, 96, 8, 76, 87, 10, 201, - 208, 176, 15, 200, 254, 96, 8, 41, 15, 141, 27, 8, 141, 28, 8, 76, - 106, 10, 201, 224, 176, 22, 177, 250, 133, 252, 200, 177, 250, 133, 253, 200, - 152, 157, 96, 8, 165, 252, 32, 14, 17, 76, 87, 10, 201, 240, 176, 46, - 177, 250, 133, 252, 200, 177, 250, 133, 253, 165, 252, 32, 14, 17, 188, 96, - 8, 200, 200, 177, 250, 157, 208, 8, 41, 240, 157, 216, 8, 177, 250, 10, - 10, 10, 10, 157, 224, 8, 200, 152, 157, 96, 8, 76, 87, 10, 201, 255, - 176, 11, 233, 239, 157, 112, 8, 254, 96, 8, 76, 87, 10, 169, 64, 157, - 112, 8, 76, 87, 10, 32, 181, 12, 162, 7, 189, 120, 8, 240, 115, 76, - 217, 13, 189, 14, 8, 240, 14, 169, 0, 157, 32, 8, 157, 40, 8, 202, - 16, 232, 76, 31, 12, 164, 253, 185, 0, 6, 24, 101, 252, 157, 56, 8, - 152, 157, 160, 8, 189, 176, 8, 61, 168, 9, 240, 40, 165, 253, 41, 127, - 168, 185, 0, 7, 24, 101, 252, 157, 55, 8, 185, 128, 7, 105, 0, 157, - 56, 8, 169, 0, 157, 31, 8, 188, 152, 9, 153, 39, 8, 202, 202, 16, - 169, 76, 31, 12, 189, 176, 8, 61, 160, 9, 240, 22, 189, 104, 9, 24, - 101, 253, 157, 162, 8, 168, 185, 0, 6, 24, 101, 252, 56, 101, 254, 157, - 58, 8, 202, 16, 133, 232, 134, 252, 162, 3, 173, 9, 8, 240, 6, 41, - 64, 208, 60, 162, 7, 138, 168, 185, 32, 8, 208, 12, 188, 152, 9, 185, - 40, 8, 208, 4, 138, 168, 169, 0, 25, 168, 8, 157, 48, 8, 185, 56, - 8, 157, 72, 8, 185, 160, 8, 157, 64, 8, 185, 176, 8, 5, 252, 133, - 252, 224, 4, 208, 3, 141, 31, 8, 202, 16, 202, 141, 30, 8, 96, 189, - 32, 8, 29, 168, 8, 157, 48, 8, 189, 44, 8, 29, 172, 8, 157, 52, - 8, 189, 56, 8, 157, 72, 8, 189, 60, 8, 157, 76, 8, 189, 160, 8, - 157, 64, 8, 189, 164, 8, 157, 68, 8, 202, 16, 211, 173, 176, 8, 13, - 177, 8, 13, 178, 8, 13, 179, 8, 141, 30, 8, 173, 180, 8, 13, 181, - 8, 13, 182, 8, 13, 183, 8, 141, 31, 8, 96, 173, 9, 8, 208, 3, - 76, 144, 13, 48, 3, 76, 72, 13, 173, 13, 8, 170, 74, 74, 41, 1, - 168, 185, 30, 8, 141, 56, 210, 138, 41, 4, 168, 185, 56, 8, 141, 48, - 210, 189, 32, 8, 141, 49, 210, 185, 57, 8, 141, 50, 210, 189, 33, 8, - 141, 51, 210, 185, 58, 8, 141, 52, 210, 189, 34, 8, 141, 53, 210, 185, - 59, 8, 141, 54, 210, 189, 35, 8, 141, 55, 210, 173, 12, 8, 170, 74, - 74, 41, 1, 168, 185, 30, 8, 141, 40, 210, 138, 41, 4, 168, 185, 56, - 8, 141, 32, 210, 189, 32, 8, 141, 33, 210, 185, 57, 8, 141, 34, 210, - 189, 33, 8, 141, 35, 210, 185, 58, 8, 141, 36, 210, 189, 34, 8, 141, - 37, 210, 185, 59, 8, 141, 38, 210, 189, 35, 8, 141, 39, 210, 173, 11, - 8, 170, 74, 74, 41, 1, 168, 185, 30, 8, 141, 24, 210, 138, 172, 9, - 8, 16, 2, 41, 4, 168, 185, 56, 8, 141, 16, 210, 189, 32, 8, 141, - 17, 210, 185, 57, 8, 141, 18, 210, 189, 33, 8, 141, 19, 210, 185, 58, - 8, 141, 20, 210, 189, 34, 8, 141, 21, 210, 185, 59, 8, 141, 22, 210, - 189, 35, 8, 141, 23, 210, 173, 10, 8, 170, 74, 74, 41, 1, 168, 185, - 30, 8, 141, 8, 210, 138, 172, 9, 8, 16, 2, 41, 4, 168, 185, 56, - 8, 141, 0, 210, 189, 32, 8, 141, 1, 210, 185, 57, 8, 141, 2, 210, - 189, 33, 8, 141, 3, 210, 185, 58, 8, 141, 4, 210, 189, 34, 8, 141, - 5, 210, 185, 59, 8, 141, 6, 210, 189, 35, 8, 141, 7, 210, 96, 189, - 128, 8, 133, 250, 189, 136, 8, 133, 251, 189, 128, 9, 133, 252, 189, 136, - 9, 133, 253, 189, 144, 9, 133, 254, 189, 184, 8, 221, 192, 8, 144, 12, - 157, 8, 9, 189, 200, 8, 157, 184, 8, 76, 11, 14, 189, 8, 9, 240, - 48, 189, 232, 8, 240, 19, 222, 248, 8, 208, 14, 157, 248, 8, 189, 216, - 8, 240, 6, 56, 233, 16, 157, 216, 8, 189, 240, 8, 240, 19, 222, 0, - 9, 208, 14, 157, 0, 9, 189, 224, 8, 240, 6, 56, 233, 16, 157, 224, - 8, 188, 72, 9, 177, 250, 24, 125, 152, 8, 24, 101, 253, 133, 253, 222, - 88, 9, 16, 57, 189, 80, 9, 157, 88, 9, 189, 96, 9, 240, 30, 24, - 125, 72, 9, 157, 72, 9, 240, 13, 221, 64, 9, 144, 32, 169, 255, 157, - 96, 9, 76, 135, 14, 169, 1, 157, 96, 9, 76, 135, 14, 254, 72, 9, - 189, 64, 9, 221, 72, 9, 176, 5, 169, 0, 157, 72, 9, 169, 19, 24, - 101, 250, 133, 250, 144, 2, 230, 251, 188, 184, 8, 177, 250, 41, 240, 157, - 168, 8, 177, 250, 41, 15, 29, 216, 8, 168, 185, 0, 5, 5, 255, 168, - 185, 0, 5, 157, 32, 8, 188, 184, 8, 200, 177, 250, 41, 15, 29, 224, - 8, 168, 185, 0, 5, 5, 255, 168, 185, 0, 5, 157, 40, 8, 189, 40, - 9, 208, 39, 189, 16, 9, 141, 212, 14, 16, 254, 76, 209, 15, 234, 76, - 108, 15, 234, 76, 167, 15, 234, 76, 212, 15, 234, 76, 1, 16, 234, 76, - 33, 16, 234, 76, 65, 16, 234, 76, 73, 16, 222, 40, 9, 188, 184, 8, - 200, 177, 250, 41, 112, 74, 74, 74, 141, 34, 15, 177, 250, 48, 6, 189, - 112, 9, 76, 18, 15, 189, 120, 9, 61, 176, 9, 157, 176, 8, 200, 200, - 152, 157, 184, 8, 136, 177, 250, 144, 254, 144, 22, 144, 12, 144, 34, 144, - 24, 144, 46, 144, 36, 144, 50, 144, 52, 125, 128, 9, 157, 128, 9, 177, - 250, 24, 101, 252, 133, 252, 76, 172, 11, 125, 136, 9, 157, 136, 9, 177, - 250, 24, 101, 253, 133, 253, 76, 172, 11, 125, 144, 9, 157, 144, 9, 177, - 250, 24, 101, 254, 133, 254, 76, 172, 11, 133, 252, 169, 0, 133, 253, 76, - 172, 11, 189, 32, 9, 41, 3, 74, 144, 10, 208, 25, 189, 24, 9, 24, - 101, 252, 133, 252, 222, 56, 9, 16, 78, 254, 32, 9, 189, 48, 9, 157, - 56, 9, 76, 247, 14, 165, 252, 253, 24, 9, 133, 252, 222, 56, 9, 16, - 54, 254, 32, 9, 189, 48, 9, 157, 56, 9, 76, 247, 14, 188, 32, 9, - 189, 24, 9, 48, 2, 200, 200, 136, 152, 24, 101, 252, 133, 252, 222, 56, - 9, 16, 20, 152, 157, 32, 9, 221, 24, 9, 208, 5, 73, 255, 157, 24, - 9, 189, 48, 9, 157, 56, 9, 76, 247, 14, 188, 32, 9, 189, 24, 9, - 48, 2, 200, 200, 136, 152, 24, 101, 253, 133, 253, 222, 56, 9, 16, 231, - 152, 157, 32, 9, 221, 24, 9, 208, 216, 73, 255, 157, 24, 9, 189, 48, - 9, 157, 56, 9, 76, 247, 14, 189, 32, 9, 24, 101, 252, 133, 252, 222, - 56, 9, 16, 195, 189, 24, 9, 24, 125, 32, 9, 157, 32, 9, 189, 48, - 9, 157, 56, 9, 76, 247, 14, 165, 253, 56, 253, 32, 9, 133, 253, 222, - 56, 9, 16, 163, 189, 24, 9, 24, 125, 32, 9, 157, 32, 9, 189, 48, - 9, 157, 56, 9, 76, 247, 14, 189, 24, 9, 24, 101, 252, 133, 252, 76, - 247, 14, 160, 16, 169, 0, 133, 250, 169, 0, 133, 251, 169, 0, 141, 23, - 8, 138, 240, 63, 177, 250, 240, 2, 16, 1, 202, 169, 17, 24, 101, 250, - 133, 250, 144, 2, 230, 251, 238, 23, 8, 208, 230, 162, 0, 169, 0, 133, - 252, 138, 141, 23, 8, 10, 38, 252, 10, 38, 252, 10, 38, 252, 10, 38, - 252, 109, 23, 8, 144, 2, 230, 252, 24, 105, 0, 133, 250, 165, 252, 105, - 0, 133, 251, 32, 44, 18, 165, 250, 141, 25, 8, 165, 251, 141, 26, 8, - 162, 7, 169, 255, 157, 208, 8, 169, 240, 157, 216, 8, 157, 224, 8, 202, - 16, 240, 169, 3, 141, 15, 210, 141, 31, 210, 141, 47, 210, 141, 63, 210, - 206, 23, 8, 232, 142, 28, 8, 232, 142, 29, 8, 142, 22, 8, 96, 138, - 41, 15, 141, 27, 8, 96, 142, 22, 8, 96, 201, 16, 176, 3, 76, 76, - 16, 201, 32, 144, 136, 201, 48, 176, 3, 76, 133, 18, 201, 64, 144, 223, - 201, 80, 176, 3, 76, 44, 18, 201, 96, 144, 219, 201, 112, 144, 3, 76, - 180, 17, 132, 253, 41, 15, 10, 141, 23, 17, 165, 253, 144, 254, 144, 30, - 144, 56, 144, 89, 144, 96, 144, 26, 144, 28, 144, 30, 144, 32, 144, 34, - 144, 36, 144, 13, 144, 11, 144, 9, 144, 7, 144, 5, 144, 3, 141, 24, - 8, 96, 157, 104, 9, 96, 157, 112, 9, 96, 157, 120, 9, 96, 157, 144, - 9, 96, 157, 128, 9, 96, 157, 136, 9, 96, 41, 112, 74, 74, 157, 16, - 9, 41, 48, 208, 3, 157, 32, 9, 165, 253, 48, 6, 41, 15, 157, 24, - 9, 96, 41, 15, 73, 255, 24, 105, 1, 157, 24, 9, 96, 41, 63, 157, - 48, 9, 157, 56, 9, 96, 41, 128, 10, 42, 157, 96, 9, 165, 253, 41, - 112, 74, 74, 74, 74, 157, 64, 9, 208, 3, 157, 96, 9, 165, 253, 41, - 15, 157, 80, 9, 157, 88, 9, 189, 72, 9, 221, 64, 9, 144, 143, 189, - 64, 9, 240, 2, 233, 1, 157, 72, 9, 96, 132, 250, 134, 251, 160, 25, - 177, 250, 200, 141, 9, 8, 177, 250, 200, 141, 10, 8, 177, 250, 200, 141, - 11, 8, 177, 250, 200, 141, 12, 8, 177, 250, 200, 141, 13, 8, 177, 250, - 141, 27, 8, 165, 250, 73, 128, 48, 1, 232, 141, 172, 18, 142, 173, 18, - 73, 128, 48, 1, 232, 141, 29, 10, 142, 30, 10, 232, 141, 35, 10, 142, - 36, 10, 232, 141, 162, 18, 142, 163, 18, 73, 128, 48, 1, 232, 141, 25, - 8, 141, 215, 9, 141, 79, 16, 141, 148, 16, 142, 26, 8, 142, 221, 9, - 142, 83, 16, 142, 154, 16, 169, 240, 133, 255, 169, 0, 141, 22, 8, 141, - 24, 8, 162, 7, 169, 0, 141, 22, 8, 157, 120, 8, 157, 176, 8, 157, - 32, 8, 157, 40, 8, 157, 48, 8, 157, 48, 210, 157, 32, 210, 157, 16, - 210, 157, 0, 210, 202, 16, 226, 141, 24, 210, 141, 8, 210, 141, 56, 210, - 141, 40, 210, 141, 30, 8, 141, 31, 8, 96, 157, 32, 8, 157, 40, 8, - 157, 48, 8, 157, 176, 8, 96, 152, 157, 208, 8, 41, 240, 157, 216, 8, - 189, 208, 8, 10, 10, 10, 10, 157, 224, 8, 96, 41, 7, 133, 250, 138, - 166, 250, 41, 63, 240, 225, 157, 152, 8, 152, 48, 238, 189, 208, 8, 32, - 117, 18, 169, 0, 157, 120, 8, 185, 255, 255, 240, 190, 157, 136, 8, 133, - 251, 185, 255, 255, 157, 128, 8, 133, 250, 152, 157, 144, 8, 160, 8, 177, - 250, 200, 157, 192, 8, 177, 250, 200, 157, 200, 8, 177, 250, 200, 157, 104, - 9, 177, 250, 200, 157, 112, 9, 177, 250, 200, 157, 120, 9, 177, 250, 200, - 157, 232, 8, 157, 248, 8, 177, 250, 200, 157, 240, 8, 157, 0, 9, 177, - 250, 41, 112, 74, 74, 157, 16, 9, 177, 250, 200, 48, 8, 41, 15, 157, - 24, 9, 76, 9, 19, 41, 15, 73, 255, 24, 105, 1, 157, 24, 9, 177, - 250, 200, 157, 40, 9, 177, 250, 200, 41, 63, 157, 48, 9, 157, 56, 9, - 177, 250, 41, 128, 10, 42, 157, 96, 9, 177, 250, 41, 112, 74, 74, 74, - 74, 157, 64, 9, 208, 3, 157, 96, 9, 177, 250, 136, 41, 15, 157, 80, - 9, 157, 88, 9, 177, 250, 41, 192, 29, 152, 8, 157, 152, 8, 168, 185, - 0, 6, 157, 56, 8, 169, 0, 157, 184, 8, 157, 32, 9, 157, 8, 9, - 157, 72, 9, 157, 128, 9, 157, 136, 9, 157, 144, 9, 169, 1, 157, 120, - 8, 96 }; -static const unsigned char CiBinaryResource_tmc_obx[2671] = { 255, 255, 0, 5, 104, 15, 76, 206, 13, 76, 208, 8, 76, 239, 9, 15, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, - 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, - 2, 2, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, - 3, 3, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, - 4, 4, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, - 5, 5, 0, 0, 1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, - 6, 6, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, - 7, 7, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, - 7, 8, 0, 1, 1, 2, 2, 3, 4, 4, 5, 5, 6, 7, 7, 8, - 8, 9, 0, 1, 1, 2, 3, 3, 4, 5, 5, 6, 7, 7, 8, 9, - 9, 10, 0, 1, 1, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 10, - 10, 11, 0, 1, 2, 2, 3, 4, 5, 6, 6, 7, 8, 9, 10, 10, - 11, 12, 0, 1, 2, 3, 3, 4, 5, 6, 7, 8, 9, 10, 10, 11, - 12, 13, 0, 1, 2, 3, 4, 5, 6, 7, 7, 8, 9, 10, 11, 12, - 13, 14, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 0, 241, 228, 215, 203, 192, 181, 170, 161, 152, 143, 135, 127, 120, - 114, 107, 101, 95, 90, 85, 80, 75, 71, 67, 63, 60, 56, 53, 50, 47, - 44, 42, 39, 37, 35, 33, 31, 29, 28, 26, 24, 23, 22, 20, 19, 18, - 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, - 1, 0, 0, 242, 230, 218, 206, 191, 182, 170, 161, 152, 143, 137, 128, 122, - 113, 107, 101, 95, 92, 86, 80, 77, 71, 68, 62, 60, 56, 53, 50, 47, - 45, 42, 40, 37, 35, 33, 31, 29, 28, 26, 24, 23, 22, 20, 19, 18, - 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, - 1, 0, 0, 255, 241, 228, 216, 202, 192, 181, 171, 162, 153, 142, 135, 127, - 121, 115, 112, 102, 97, 90, 85, 82, 75, 72, 67, 63, 60, 57, 55, 51, - 48, 45, 42, 40, 37, 36, 33, 31, 30, 28, 27, 25, 23, 22, 21, 19, - 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, - 2, 1, 0, 243, 230, 217, 204, 193, 181, 173, 162, 153, 144, 136, 128, 121, - 114, 108, 102, 96, 91, 85, 81, 76, 72, 68, 64, 60, 57, 53, 50, 47, - 45, 42, 40, 37, 35, 33, 31, 29, 28, 26, 24, 23, 22, 20, 19, 18, - 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, - 1, 0, 0, 242, 51, 150, 226, 56, 140, 0, 106, 232, 106, 239, 128, 8, - 174, 70, 230, 149, 65, 246, 176, 110, 48, 246, 187, 132, 82, 34, 244, 200, - 160, 122, 85, 52, 20, 245, 216, 189, 164, 141, 119, 96, 78, 56, 39, 21, - 6, 247, 232, 219, 207, 195, 184, 172, 162, 154, 144, 136, 127, 120, 112, 106, - 100, 94, 0, 13, 13, 12, 11, 11, 10, 10, 9, 8, 8, 7, 7, 7, - 6, 6, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 3, 2, 2, - 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, - 6, 7, 0, 1, 2, 3, 4, 2, 0, 0, 4, 2, 0, 0, 0, 16, - 0, 8, 0, 16, 0, 8, 173, 183, 8, 240, 94, 173, 182, 8, 201, 64, - 144, 90, 206, 181, 8, 240, 3, 76, 239, 9, 162, 7, 169, 0, 157, 196, - 7, 157, 204, 7, 202, 16, 247, 141, 182, 8, 170, 160, 15, 177, 254, 16, - 32, 136, 177, 254, 16, 3, 76, 95, 14, 134, 252, 10, 10, 38, 252, 10, - 38, 252, 10, 38, 252, 105, 0, 133, 254, 165, 252, 105, 0, 133, 255, 144, - 218, 157, 212, 7, 136, 177, 254, 157, 220, 7, 232, 136, 16, 207, 24, 165, - 254, 105, 16, 133, 254, 144, 2, 230, 255, 76, 239, 9, 206, 181, 8, 16, - 248, 238, 182, 8, 173, 180, 8, 141, 181, 8, 162, 7, 222, 204, 7, 48, - 3, 76, 233, 9, 188, 212, 7, 185, 255, 255, 133, 252, 185, 255, 255, 133, - 253, 188, 196, 7, 177, 252, 208, 6, 32, 109, 13, 76, 230, 9, 201, 64, - 176, 18, 125, 220, 7, 157, 228, 7, 32, 109, 13, 188, 42, 5, 32, 188, - 14, 76, 230, 9, 208, 34, 200, 254, 196, 7, 177, 252, 16, 7, 133, 251, - 32, 109, 13, 165, 251, 41, 127, 208, 7, 169, 64, 141, 182, 8, 208, 76, - 141, 180, 8, 141, 181, 8, 208, 68, 201, 128, 176, 43, 41, 63, 125, 220, - 7, 157, 228, 7, 200, 254, 196, 7, 177, 252, 41, 127, 208, 7, 169, 64, - 141, 182, 8, 208, 6, 141, 180, 8, 141, 181, 8, 32, 109, 13, 188, 42, - 5, 32, 188, 14, 76, 230, 9, 201, 192, 176, 12, 41, 63, 157, 42, 5, - 200, 254, 196, 7, 76, 94, 9, 41, 63, 157, 204, 7, 254, 196, 7, 202, - 48, 3, 76, 70, 9, 162, 7, 189, 188, 7, 240, 33, 32, 46, 11, 189, - 50, 5, 61, 192, 8, 240, 22, 160, 71, 177, 252, 24, 125, 34, 5, 157, - 36, 5, 168, 185, 60, 6, 56, 125, 100, 8, 157, 246, 7, 202, 16, 215, - 14, 9, 5, 14, 9, 5, 14, 9, 5, 14, 9, 5, 232, 134, 252, 134, - 253, 162, 7, 138, 168, 185, 252, 7, 208, 12, 188, 184, 8, 185, 4, 8, - 208, 4, 138, 168, 169, 0, 133, 250, 152, 157, 26, 5, 185, 244, 7, 157, - 18, 5, 185, 50, 5, 133, 251, 5, 253, 133, 253, 165, 251, 61, 192, 8, - 240, 6, 185, 246, 7, 157, 20, 5, 165, 251, 61, 200, 8, 240, 18, 185, - 34, 5, 41, 63, 168, 200, 132, 252, 185, 123, 7, 157, 18, 5, 76, 137, - 10, 164, 252, 240, 10, 185, 59, 7, 157, 18, 5, 169, 0, 133, 252, 165, - 250, 13, 9, 5, 168, 185, 60, 5, 188, 26, 5, 25, 236, 7, 157, 10, - 5, 224, 4, 208, 9, 165, 253, 141, 59, 5, 169, 0, 133, 253, 202, 16, - 130, 78, 9, 5, 78, 9, 5, 78, 9, 5, 78, 9, 5, 165, 253, 162, - 3, 142, 31, 210, 142, 15, 210, 174, 22, 5, 172, 18, 5, 142, 16, 210, - 140, 0, 210, 174, 14, 5, 172, 10, 5, 142, 17, 210, 140, 1, 210, 174, - 23, 5, 172, 19, 5, 142, 18, 210, 140, 2, 210, 174, 15, 5, 172, 11, - 5, 142, 19, 210, 140, 3, 210, 174, 24, 5, 172, 20, 5, 142, 20, 210, - 140, 4, 210, 174, 16, 5, 172, 12, 5, 142, 21, 210, 140, 5, 210, 174, - 25, 5, 172, 21, 5, 142, 22, 210, 140, 6, 210, 174, 17, 5, 172, 13, - 5, 142, 23, 210, 140, 7, 210, 141, 58, 5, 174, 59, 5, 142, 24, 210, - 141, 8, 210, 96, 189, 28, 8, 133, 252, 189, 36, 8, 133, 253, 188, 44, - 8, 192, 63, 240, 123, 254, 44, 8, 254, 44, 8, 254, 44, 8, 177, 252, - 41, 240, 157, 236, 7, 177, 252, 41, 15, 56, 253, 12, 8, 16, 2, 169, - 0, 157, 252, 7, 200, 177, 252, 41, 15, 56, 253, 20, 8, 16, 2, 169, - 0, 157, 4, 8, 177, 252, 41, 240, 240, 116, 16, 11, 160, 73, 177, 252, - 188, 44, 8, 136, 136, 16, 2, 169, 0, 157, 50, 5, 177, 252, 41, 112, - 240, 99, 74, 74, 141, 154, 11, 169, 0, 157, 100, 8, 200, 177, 252, 144, - 254, 234, 234, 234, 234, 76, 56, 13, 234, 76, 53, 13, 234, 76, 60, 13, - 234, 76, 74, 13, 234, 76, 84, 13, 234, 76, 95, 13, 234, 76, 81, 13, - 189, 52, 8, 240, 18, 222, 68, 8, 208, 13, 157, 68, 8, 189, 252, 7, - 41, 15, 240, 3, 222, 252, 7, 189, 60, 8, 240, 18, 222, 76, 8, 208, - 13, 157, 76, 8, 189, 4, 8, 41, 15, 240, 3, 222, 4, 8, 160, 72, - 177, 252, 157, 50, 5, 189, 148, 8, 24, 105, 63, 168, 177, 252, 125, 228, - 7, 157, 34, 5, 168, 185, 60, 6, 157, 244, 7, 222, 164, 8, 16, 51, - 189, 156, 8, 157, 164, 8, 189, 172, 8, 240, 24, 24, 125, 148, 8, 157, - 148, 8, 240, 7, 221, 140, 8, 208, 26, 169, 254, 24, 105, 1, 157, 172, - 8, 208, 16, 254, 148, 8, 189, 140, 8, 221, 148, 8, 176, 5, 169, 0, - 157, 148, 8, 189, 116, 8, 240, 4, 222, 116, 8, 96, 189, 108, 8, 133, - 250, 189, 92, 8, 133, 251, 32, 105, 12, 222, 132, 8, 16, 16, 165, 250, - 157, 108, 8, 165, 251, 157, 92, 8, 189, 124, 8, 157, 132, 8, 96, 189, - 84, 8, 141, 112, 12, 16, 254, 76, 167, 12, 234, 76, 144, 12, 234, 76, - 174, 12, 234, 76, 180, 12, 234, 76, 190, 12, 234, 76, 210, 12, 234, 76, - 226, 12, 234, 76, 244, 12, 165, 250, 230, 250, 41, 3, 74, 144, 15, 208, - 71, 165, 251, 157, 100, 8, 24, 125, 244, 7, 157, 244, 7, 96, 169, 0, - 157, 100, 8, 96, 32, 29, 13, 76, 157, 12, 32, 29, 13, 24, 125, 34, - 5, 76, 84, 13, 165, 250, 157, 100, 8, 24, 125, 244, 7, 157, 244, 7, - 165, 250, 24, 101, 251, 133, 250, 96, 189, 34, 5, 56, 229, 250, 157, 34, - 5, 168, 185, 60, 6, 76, 199, 12, 189, 244, 7, 56, 229, 251, 157, 244, - 7, 56, 169, 0, 229, 251, 157, 100, 8, 96, 189, 132, 8, 208, 174, 165, - 251, 16, 16, 189, 4, 8, 240, 165, 189, 252, 7, 201, 15, 240, 158, 254, - 252, 7, 96, 189, 252, 7, 240, 149, 189, 4, 8, 201, 15, 240, 142, 254, - 4, 8, 96, 164, 250, 165, 251, 48, 2, 200, 200, 136, 152, 133, 250, 197, - 251, 208, 6, 165, 251, 73, 255, 133, 251, 152, 96, 125, 244, 7, 157, 244, - 7, 96, 188, 228, 7, 121, 60, 6, 157, 244, 7, 152, 157, 34, 5, 96, - 45, 10, 210, 157, 244, 7, 96, 125, 228, 7, 157, 34, 5, 168, 185, 60, - 6, 157, 244, 7, 96, 157, 34, 5, 168, 189, 244, 7, 121, 60, 6, 157, - 244, 7, 96, 200, 254, 196, 7, 177, 252, 74, 74, 74, 74, 157, 12, 8, - 177, 252, 41, 15, 157, 20, 8, 96, 32, 95, 14, 160, 15, 169, 0, 133, - 254, 169, 0, 133, 255, 138, 240, 46, 177, 254, 16, 1, 202, 24, 165, 254, - 105, 16, 133, 254, 144, 239, 230, 255, 176, 235, 32, 95, 14, 169, 0, 133, - 252, 138, 10, 10, 38, 252, 10, 38, 252, 10, 38, 252, 105, 0, 133, 254, - 165, 252, 105, 0, 133, 255, 169, 64, 141, 182, 8, 169, 1, 141, 181, 8, - 141, 183, 8, 96, 201, 16, 144, 176, 201, 32, 144, 206, 201, 48, 176, 3, - 76, 174, 14, 201, 64, 176, 9, 138, 41, 15, 240, 3, 141, 180, 8, 96, - 201, 80, 144, 113, 201, 96, 176, 6, 169, 0, 141, 183, 8, 96, 201, 112, - 144, 248, 169, 1, 141, 181, 8, 169, 64, 141, 182, 8, 132, 252, 134, 253, - 160, 30, 177, 252, 141, 180, 8, 165, 252, 24, 105, 32, 141, 194, 14, 144, - 1, 232, 142, 195, 14, 24, 105, 64, 141, 202, 14, 144, 1, 232, 142, 203, - 14, 24, 105, 64, 141, 82, 9, 144, 1, 232, 142, 83, 9, 24, 105, 128, - 141, 87, 9, 144, 1, 232, 142, 88, 9, 24, 105, 128, 133, 254, 141, 16, - 9, 141, 136, 13, 141, 183, 13, 144, 1, 232, 134, 255, 142, 22, 9, 142, - 140, 13, 142, 189, 13, 160, 7, 169, 0, 141, 183, 8, 153, 0, 210, 153, - 16, 210, 153, 10, 5, 153, 252, 7, 153, 4, 8, 153, 50, 5, 153, 188, - 7, 136, 16, 232, 141, 8, 210, 141, 24, 210, 141, 58, 5, 141, 59, 5, - 96, 157, 252, 7, 157, 4, 8, 157, 50, 5, 189, 228, 7, 157, 34, 5, - 96, 152, 73, 240, 74, 74, 74, 74, 157, 12, 8, 152, 41, 15, 73, 15, - 157, 20, 8, 96, 41, 7, 133, 252, 138, 166, 252, 41, 63, 240, 226, 157, - 228, 7, 169, 0, 157, 188, 7, 185, 255, 255, 157, 28, 8, 133, 252, 185, - 255, 255, 157, 36, 8, 133, 253, 5, 252, 240, 182, 160, 74, 177, 252, 157, - 52, 8, 157, 68, 8, 200, 177, 252, 157, 60, 8, 157, 76, 8, 200, 177, - 252, 41, 112, 74, 74, 157, 84, 8, 177, 252, 41, 15, 157, 92, 8, 177, - 252, 16, 11, 189, 92, 8, 73, 255, 24, 105, 1, 157, 92, 8, 200, 177, - 252, 157, 116, 8, 200, 177, 252, 41, 63, 157, 124, 8, 157, 132, 8, 200, - 177, 252, 41, 128, 240, 2, 169, 1, 157, 172, 8, 177, 252, 41, 112, 74, - 74, 74, 74, 157, 140, 8, 208, 3, 157, 172, 8, 177, 252, 41, 15, 157, - 156, 8, 157, 164, 8, 136, 177, 252, 41, 192, 24, 125, 228, 7, 157, 228, - 7, 157, 34, 5, 168, 185, 60, 6, 157, 244, 7, 169, 0, 157, 44, 8, - 157, 100, 8, 157, 108, 8, 157, 148, 8, 169, 1, 157, 188, 7, 96 }; - -static int ASAPWriter_FormatXexInfoText(unsigned char *dest, int destLen, int endColumn, const char *src, cibool author); -static int ASAPWriter_PadXexInfo(unsigned char *dest, int offset, int endColumn); -static cibool ASAPWriter_SecondsToString(unsigned char *result, int offset, int value); -static void ASAPWriter_TwoDigitsToString(unsigned char *result, int offset, int value); -static void ASAPWriter_WriteBytes(ByteWriter w, unsigned char const *array, int startIndex, int endIndex); -static void ASAPWriter_WriteCmcInit(ByteWriter w, int *initAndPlayer, ASAPInfo const *info); -static void ASAPWriter_WriteDec(ByteWriter w, int value); -static void ASAPWriter_WriteDecSapTag(ByteWriter w, const char *tag, int value); -static cibool ASAPWriter_WriteExecutable(ByteWriter w, int *initAndPlayer, ASAPInfo const *info, unsigned char const *module, int moduleLen); -static void ASAPWriter_WriteExecutableFromSap(ByteWriter w, int *initAndPlayer, ASAPInfo const *info, int type, unsigned char const *module, int moduleLen); -static void ASAPWriter_WriteExecutableHeader(ByteWriter w, int *initAndPlayer, ASAPInfo const *info, int type, int init, int player); -static int ASAPWriter_WriteExecutableHeaderForSongPos(ByteWriter w, int *initAndPlayer, ASAPInfo const *info, int player, int codeForOneSong, int codeForManySongs, int playerOffset); -static void ASAPWriter_WriteHexSapTag(ByteWriter w, const char *tag, int value); -static cibool ASAPWriter_WriteNative(ByteWriter w, ASAPInfo const *info, unsigned char const *module, int moduleLen); -static int ASAPWriter_WriteNativeHeader(ByteWriter w, ASAPInfo const *info, unsigned char const *module); -static void ASAPWriter_WritePlaTaxLda0(ByteWriter w); -static void ASAPWriter_WriteRelocatedBytes(ByteWriter w, int diff, unsigned char const *module, int lowOffset, int highOffset, int len, int shift); -static void ASAPWriter_WriteRelocatedLowHigh(ByteWriter w, int diff, unsigned char const *module, int lowOffset, int len); -static void ASAPWriter_WriteRelocatedWords(ByteWriter w, int diff, unsigned char const *module, int offset, int len); -static void ASAPWriter_WriteSapHeader(ByteWriter w, ASAPInfo const *info, int type, int init, int player); -static void ASAPWriter_WriteString(ByteWriter w, const char *s); -static void ASAPWriter_WriteTextSapTag(ByteWriter w, const char *tag, const char *value); -static void ASAPWriter_WriteWord(ByteWriter w, int value); -static void ASAPWriter_WriteXexInfo(ByteWriter w, ASAPInfo const *info); -static void ASAPWriter_WriteXexInfoTextDl(ByteWriter w, int address, int len, int verticalScrollAt); -static const unsigned char CiBinaryResource_xexb_obx[183] = { 255, 255, 36, 1, 223, 1, 120, 160, 0, 140, 14, 212, 173, 11, 212, 208, - 251, 141, 0, 212, 162, 29, 157, 0, 208, 202, 16, 250, 162, 8, 157, 16, - 210, 157, 0, 210, 202, 16, 247, 169, 3, 141, 31, 210, 141, 0, 210, 169, - 130, 205, 11, 212, 208, 251, 141, 10, 212, 141, 10, 212, 141, 10, 212, 173, - 11, 212, 208, 3, 238, 145, 1, 173, 218, 1, 32, 212, 1, 169, 254, 141, - 1, 211, 169, 206, 174, 53, 1, 240, 2, 169, 194, 141, 250, 255, 169, 1, - 141, 251, 255, 169, 64, 141, 14, 212, 169, 125, 205, 11, 212, 208, 251, 32, - 215, 1, 162, 0, 173, 219, 1, 74, 144, 6, 169, 0, 238, 153, 1, 74, - 189, 220, 1, 105, 125, 176, 5, 221, 210, 1, 144, 4, 253, 210, 1, 56, - 141, 162, 1, 189, 222, 1, 105, 0, 141, 181, 1, 201, 0, 208, 252, 173, - 162, 1, 176, 198, 72, 138, 72, 174, 145, 1, 32, 152, 252, 104, 170, 104, - 238, 186, 1, 64, 156, 131, 76 }; -static const unsigned char CiBinaryResource_xexd_obx[117] = { 255, 255, 36, 1, 152, 1, 120, 160, 0, 140, 14, 212, 173, 11, 212, 208, - 251, 141, 0, 212, 162, 29, 157, 0, 208, 202, 16, 250, 141, 14, 210, 162, - 8, 157, 16, 210, 157, 0, 210, 202, 16, 247, 169, 3, 141, 31, 210, 141, - 0, 210, 169, 254, 141, 1, 211, 173, 149, 1, 201, 96, 240, 15, 169, 114, - 141, 250, 255, 169, 1, 141, 251, 255, 169, 64, 141, 14, 212, 173, 152, 1, - 88, 76, 146, 1, 40, 8, 72, 138, 72, 152, 72, 32, 149, 1, 174, 53, - 1, 240, 11, 174, 20, 208, 202, 240, 2, 162, 1, 32, 152, 252, 104, 168, - 104, 170, 104, 64, 76 }; -static const unsigned char CiBinaryResource_xexinfo_obx[178] = { 255, 255, 112, 252, 221, 252, 65, 80, 252, 173, 11, 212, 208, 251, 141, 5, - 212, 162, 38, 142, 22, 208, 162, 10, 142, 23, 208, 162, 33, 142, 0, 212, - 162, 80, 142, 2, 212, 162, 252, 142, 3, 212, 142, 9, 212, 96, 216, 189, - 218, 252, 24, 105, 0, 141, 158, 252, 189, 220, 252, 105, 0, 141, 166, 252, - 144, 18, 173, 75, 252, 13, 76, 252, 13, 78, 252, 13, 79, 252, 201, 49, - 162, 4, 176, 13, 96, 169, 57, 224, 3, 208, 2, 169, 53, 157, 75, 252, - 202, 189, 75, 252, 201, 49, 144, 237, 201, 58, 240, 244, 222, 75, 252, 96, - 34, 69, 5, 4, 0, 1, 57, 1, 120, 160, 0, 140, 14, 212, 173, 11, - 212, 208, 251, 141, 0, 212, 162, 29, 157, 0, 208, 202, 16, 250, 142, 1, - 211, 185, 0, 224, 72, 185, 0, 225, 72, 185, 0, 227, 202, 142, 1, 211, - 232, 153, 0, 255, 104, 153, 0, 254, 104, 153, 0, 253, 200, 208, 223, 32, - 115, 252 }; - -struct FlashPackItem { - FlashPackItemType type; - int value; -}; -static int FlashPackItem_WriteValueTo(FlashPackItem const *self, unsigned char *buffer, int index); - -struct FlashPack { - int compressedLength; - int itemsCount; - int loadAddress; - int loadEndAddress; - FlashPackLoadState loadState; - FlashPackItem items[64]; - unsigned char compressed[65536]; - int memory[65536]; -}; -static void FlashPack_Construct(FlashPack *self); -static cibool FlashPack_Compress(FlashPack *self, ByteWriter w); -static void FlashPack_CompressMemoryArea(FlashPack *self, int startAddress, int endAddress); -static int FlashPack_FindHole(FlashPack const *self); -static int FlashPack_GetInnerFlags(FlashPack const *self, int index); -static cibool FlashPack_IsLiteralPreferred(FlashPack const *self); -static void FlashPack_LoadByte(FlashPack *self, int data); -static void FlashPack_PutItem(FlashPack *self, FlashPackItemType type, int value); -static void FlashPack_PutItems(FlashPack *self); -static void FlashPack_PutPoke(FlashPack *self, int address, int value); - -static void ASAP_Construct(ASAP *self) -{ - PokeyPair_Construct(&self->pokeys); - self->silenceCycles = 0; -} - -ASAP *ASAP_New(void) -{ - ASAP *self = (ASAP *) malloc(sizeof(ASAP)); - if (self != NULL) - ASAP_Construct(self); - return self; -} - -void ASAP_Delete(ASAP *self) -{ - free(self); -} - -static void ASAP_Call6502(ASAP *self, int addr) -{ - self->memory[53760] = 32; - self->memory[53761] = (unsigned char) addr; - self->memory[53762] = addr >> 8; - self->memory[53763] = 210; - self->cpu.pc = 53760; -} - -static void ASAP_Call6502Player(ASAP *self) -{ - int player = self->moduleInfo.player; - switch (self->moduleInfo.type) { - int i; - case ASAPModuleType_SAP_B: - ASAP_Call6502(self, player); - break; - case ASAPModuleType_SAP_C: - case ASAPModuleType_CMC: - case ASAPModuleType_CM3: - case ASAPModuleType_CMR: - case ASAPModuleType_CMS: - ASAP_Call6502(self, player + 6); - break; - case ASAPModuleType_SAP_D: - if (player >= 0) { - int s = self->cpu.s; - self->memory[256 + s] = self->cpu.pc >> 8; - s = (s - 1) & 255; - self->memory[256 + s] = (unsigned char) self->cpu.pc; - self->cpu.s = (s - 1) & 255; - self->memory[53760] = 8; - self->memory[53761] = 72; - self->memory[53762] = 138; - self->memory[53763] = 72; - self->memory[53764] = 152; - self->memory[53765] = 72; - self->memory[53766] = 32; - self->memory[53767] = (unsigned char) player; - self->memory[53768] = player >> 8; - self->memory[53769] = 104; - self->memory[53770] = 168; - self->memory[53771] = 104; - self->memory[53772] = 170; - self->memory[53773] = 104; - self->memory[53774] = 64; - self->cpu.pc = 53760; - } - break; - case ASAPModuleType_SAP_S: - i = self->memory[69] - 1; - self->memory[69] = (unsigned char) i; - if (i == 0) - self->memory[45179] = (unsigned char) (self->memory[45179] + 1); - break; - case ASAPModuleType_DLT: - ASAP_Call6502(self, player + 259); - break; - case ASAPModuleType_MPT: - case ASAPModuleType_RMT: - case ASAPModuleType_TM2: - case ASAPModuleType_FC: - ASAP_Call6502(self, player + 3); - break; - case ASAPModuleType_TMC: - if (--self->tmcPerFrameCounter <= 0) { - self->tmcPerFrameCounter = self->memory[self->moduleInfo.music + 31]; - ASAP_Call6502(self, player + 3); - } - else - ASAP_Call6502(self, player + 6); - break; - } -} - -void ASAP_DetectSilence(ASAP *self, int seconds) -{ - self->silenceCyclesCounter = self->silenceCycles = seconds * 1773447; -} - -static int ASAP_Do6502Frame(ASAP *self) -{ - int cycles; - self->nextEventCycle = 0; - self->nextScanlineCycle = 0; - self->nmist = self->nmist == NmiStatus_RESET ? NmiStatus_ON_V_BLANK : NmiStatus_WAS_V_BLANK; - cycles = self->moduleInfo.ntsc ? 29868 : 35568; - Cpu6502_DoFrame(&self->cpu, self, cycles); - self->cycle -= cycles; - if (self->nextPlayerCycle != 8388608) - self->nextPlayerCycle -= cycles; - if (self->pokeys.timer1Cycle != 8388608) - self->pokeys.timer1Cycle -= cycles; - if (self->pokeys.timer2Cycle != 8388608) - self->pokeys.timer2Cycle -= cycles; - if (self->pokeys.timer4Cycle != 8388608) - self->pokeys.timer4Cycle -= cycles; - return cycles; -} - -static cibool ASAP_Do6502Init(ASAP *self, int pc, int a, int x, int y) -{ - self->cpu.pc = pc; - self->cpu.a = a & 255; - self->cpu.x = x & 255; - self->cpu.y = y & 255; - self->memory[53760] = 210; - self->memory[510] = 255; - self->memory[511] = 209; - self->cpu.s = 253; - { - int frame; - for (frame = 0; frame < 50; frame++) { - ASAP_Do6502Frame(self); - if (self->cpu.pc == 53760) - return TRUE; - } - } - return FALSE; -} - -static int ASAP_DoFrame(ASAP *self) -{ - int cycles; - PokeyPair_StartFrame(&self->pokeys); - cycles = ASAP_Do6502Frame(self); - PokeyPair_EndFrame(&self->pokeys, cycles); - return cycles; -} - -int ASAP_Generate(ASAP *self, unsigned char *buffer, int bufferLen, ASAPSampleFormat format) -{ - return ASAP_GenerateAt(self, buffer, 0, bufferLen, format); -} - -static int ASAP_GenerateAt(ASAP *self, unsigned char *buffer, int bufferOffset, int bufferLen, ASAPSampleFormat format) -{ - int blockShift; - int bufferBlocks; - int block; - if (self->silenceCycles > 0 && self->silenceCyclesCounter <= 0) - return 0; - blockShift = self->moduleInfo.channels - 1 + (format != ASAPSampleFormat_U8 ? 1 : 0); - bufferBlocks = bufferLen >> blockShift; - if (self->currentDuration > 0) { - int totalBlocks = ASAP_MillisecondsToBlocks(self->currentDuration); - if (bufferBlocks > totalBlocks - self->blocksPlayed) - bufferBlocks = totalBlocks - self->blocksPlayed; - } - block = 0; - for (;;) { - int blocks = PokeyPair_Generate(&self->pokeys, buffer, bufferOffset + (block << blockShift), bufferBlocks - block, format); - int cycles; - self->blocksPlayed += blocks; - block += blocks; - if (block >= bufferBlocks) - break; - cycles = ASAP_DoFrame(self); - if (self->silenceCycles > 0) { - if (PokeyPair_IsSilent(&self->pokeys)) { - self->silenceCyclesCounter -= cycles; - if (self->silenceCyclesCounter <= 0) - break; - } - else - self->silenceCyclesCounter = self->silenceCycles; - } - } - return block << blockShift; -} - -int ASAP_GetBlocksPlayed(ASAP const *self) -{ - return self->blocksPlayed; -} - -ASAPInfo const *ASAP_GetInfo(ASAP const *self) -{ - return &self->moduleInfo; -} - -int ASAP_GetPokeyChannelVolume(ASAP const *self, int channel) -{ - switch (channel) { - case 0: - return self->pokeys.basePokey.audc1 & 15; - case 1: - return self->pokeys.basePokey.audc2 & 15; - case 2: - return self->pokeys.basePokey.audc3 & 15; - case 3: - return self->pokeys.basePokey.audc4 & 15; - case 4: - return self->pokeys.extraPokey.audc1 & 15; - case 5: - return self->pokeys.extraPokey.audc2 & 15; - case 6: - return self->pokeys.extraPokey.audc3 & 15; - case 7: - return self->pokeys.extraPokey.audc4 & 15; - default: - return 0; - } -} - -int ASAP_GetPosition(ASAP const *self) -{ - return self->blocksPlayed * 10 / 441; -} - -int ASAP_GetWavHeader(ASAP const *self, unsigned char *buffer, ASAPSampleFormat format, cibool metadata) -{ - int use16bit = format != ASAPSampleFormat_U8 ? 1 : 0; - int blockSize = self->moduleInfo.channels << use16bit; - int bytesPerSecond = 44100 * blockSize; - int totalBlocks = ASAP_MillisecondsToBlocks(self->currentDuration); - int nBytes = (totalBlocks - self->blocksPlayed) * blockSize; - int i; - ASAP_PutLittleEndian(buffer, 8, 1163280727); - ASAP_PutLittleEndians(buffer, 12, 544501094, 16); - buffer[20] = 1; - buffer[21] = 0; - buffer[22] = self->moduleInfo.channels; - buffer[23] = 0; - ASAP_PutLittleEndians(buffer, 24, 44100, bytesPerSecond); - buffer[32] = blockSize; - buffer[33] = 0; - buffer[34] = 8 << use16bit; - buffer[35] = 0; - i = 36; - if (metadata) { - int year = ASAPInfo_GetYear(&self->moduleInfo); - if (self->moduleInfo.title[0] != '\0' || self->moduleInfo.author[0] != '\0' || year > 0) { - ASAP_PutLittleEndian(buffer, 44, 1330007625); - i = ASAP_PutWavMetadata(buffer, 48, 1296125513, self->moduleInfo.title); - i = ASAP_PutWavMetadata(buffer, i, 1414676809, self->moduleInfo.author); - if (year > 0) { - ASAP_PutLittleEndians(buffer, i, 1146241865, 6); - { - int j; - for (j = 3; j >= 0; j--) { - buffer[i + 8 + j] = 48 + year % 10; - year /= 10; - } - } - buffer[i + 12] = 0; - buffer[i + 13] = 0; - i += 14; - } - ASAP_PutLittleEndians(buffer, 36, 1414744396, i - 44); - } - } - ASAP_PutLittleEndians(buffer, 0, 1179011410, i + nBytes); - ASAP_PutLittleEndians(buffer, i, 1635017060, nBytes); - return i + 8; -} - -static void ASAP_HandleEvent(ASAP *self) -{ - int cycle = self->cycle; - int nextEventCycle; - if (cycle >= self->nextScanlineCycle) { - if (cycle - self->nextScanlineCycle < 50) - self->cycle = cycle += 9; - self->nextScanlineCycle += 114; - if (cycle >= self->nextPlayerCycle) { - ASAP_Call6502Player(self); - self->nextPlayerCycle += 114 * self->moduleInfo.fastplay; - } - } - nextEventCycle = self->nextScanlineCycle; - if (cycle >= self->pokeys.timer1Cycle) { - self->pokeys.irqst &= ~1; - self->pokeys.timer1Cycle = 8388608; - } - else if (nextEventCycle > self->pokeys.timer1Cycle) - nextEventCycle = self->pokeys.timer1Cycle; - if (cycle >= self->pokeys.timer2Cycle) { - self->pokeys.irqst &= ~2; - self->pokeys.timer2Cycle = 8388608; - } - else if (nextEventCycle > self->pokeys.timer2Cycle) - nextEventCycle = self->pokeys.timer2Cycle; - if (cycle >= self->pokeys.timer4Cycle) { - self->pokeys.irqst &= ~4; - self->pokeys.timer4Cycle = 8388608; - } - else if (nextEventCycle > self->pokeys.timer4Cycle) - nextEventCycle = self->pokeys.timer4Cycle; - self->nextEventCycle = nextEventCycle; -} - -cibool ASAP_Load(ASAP *self, const char *filename, unsigned char const *module, int moduleLen) -{ - unsigned char const *playerRoutine; - int moduleIndex; - if (!ASAPInfo_Load(&self->moduleInfo, filename, module, moduleLen)) - return FALSE; - playerRoutine = ASAP6502_GetPlayerRoutine(&self->moduleInfo); - if (playerRoutine != NULL) { - int player = ASAPInfo_GetWord(playerRoutine, 2); - int playerLastByte = ASAPInfo_GetWord(playerRoutine, 4); - if (self->moduleInfo.music <= playerLastByte) - return FALSE; - self->memory[19456] = 0; - if (self->moduleInfo.type == ASAPModuleType_FC) - memcpy(self->memory + self->moduleInfo.music, module + 0, moduleLen); - else - memcpy(self->memory + self->moduleInfo.music, module + 6, moduleLen - 6); - memcpy(self->memory + player, playerRoutine + 6, playerLastByte + 1 - player); - if (self->moduleInfo.player < 0) - self->moduleInfo.player = player; - return TRUE; - } - memset(self->memory, 0, sizeof(self->memory)); - moduleIndex = self->moduleInfo.headerLen + 2; - while (moduleIndex + 5 <= moduleLen) { - int startAddr = ASAPInfo_GetWord(module, moduleIndex); - int blockLen = ASAPInfo_GetWord(module, moduleIndex + 2) + 1 - startAddr; - if (blockLen <= 0 || moduleIndex + blockLen > moduleLen) - return FALSE; - moduleIndex += 4; - memcpy(self->memory + startAddr, module + moduleIndex, blockLen); - moduleIndex += blockLen; - if (moduleIndex == moduleLen) - return TRUE; - if (moduleIndex + 7 <= moduleLen && module[moduleIndex] == 255 && module[moduleIndex + 1] == 255) - moduleIndex += 2; - } - return FALSE; -} - -static int ASAP_MillisecondsToBlocks(int milliseconds) -{ - return milliseconds * 441 / 10; -} - -void ASAP_MutePokeyChannels(ASAP *self, int mask) -{ - Pokey_Mute(&self->pokeys.basePokey, mask); - Pokey_Mute(&self->pokeys.extraPokey, mask >> 4); -} - -static int ASAP_PeekHardware(ASAP const *self, int addr) -{ - switch (addr & 65311) { - case 53268: - return self->moduleInfo.ntsc ? 15 : 1; - case 53279: - return ~self->consol & 15; - case 53770: - case 53786: - return PokeyPair_GetRandom(&self->pokeys, addr, self->cycle); - case 53774: - return self->pokeys.irqst; - case 53790: - if (self->pokeys.extraPokeyMask != 0) { - return 255; - } - return self->pokeys.irqst; - case 53772: - case 53788: - case 53775: - case 53791: - return 255; - case 54283: - case 54299: - if (self->cycle > (self->moduleInfo.ntsc ? 29868 : 35568)) - return 0; - return self->cycle / 228; - case 54287: - case 54303: - switch (self->nmist) { - case NmiStatus_RESET: - return 31; - case NmiStatus_WAS_V_BLANK: - return 95; - default: - return self->cycle < 28291 ? 31 : 95; - } - default: - return self->memory[addr]; - } -} - -cibool ASAP_PlaySong(ASAP *self, int song, int duration) -{ - if (song < 0 || song >= self->moduleInfo.songs) - return FALSE; - self->currentSong = song; - self->currentDuration = duration; - self->nextPlayerCycle = 8388608; - self->blocksPlayed = 0; - self->silenceCyclesCounter = self->silenceCycles; - self->cycle = 0; - self->cpu.nz = 0; - self->cpu.c = 0; - self->cpu.vdi = 0; - self->nmist = NmiStatus_ON_V_BLANK; - self->consol = 8; - self->covox[0] = 128; - self->covox[1] = 128; - self->covox[2] = 128; - self->covox[3] = 128; - PokeyPair_Initialize(&self->pokeys, self->moduleInfo.ntsc, self->moduleInfo.channels > 1); - ASAP_MutePokeyChannels(self, 255); - switch (self->moduleInfo.type) { - case ASAPModuleType_SAP_B: - if (!ASAP_Do6502Init(self, self->moduleInfo.init, song, 0, 0)) - return FALSE; - break; - case ASAPModuleType_SAP_C: - case ASAPModuleType_CMC: - case ASAPModuleType_CM3: - case ASAPModuleType_CMR: - case ASAPModuleType_CMS: - if (!ASAP_Do6502Init(self, self->moduleInfo.player + 3, 112, self->moduleInfo.music, self->moduleInfo.music >> 8)) - return FALSE; - if (!ASAP_Do6502Init(self, self->moduleInfo.player + 3, 0, song, 0)) - return FALSE; - break; - case ASAPModuleType_SAP_D: - case ASAPModuleType_SAP_S: - self->cpu.pc = self->moduleInfo.init; - self->cpu.a = song; - self->cpu.x = 0; - self->cpu.y = 0; - self->cpu.s = 255; - break; - case ASAPModuleType_DLT: - if (!ASAP_Do6502Init(self, self->moduleInfo.player + 256, 0, 0, self->moduleInfo.songPos[song])) - return FALSE; - break; - case ASAPModuleType_MPT: - if (!ASAP_Do6502Init(self, self->moduleInfo.player, 0, self->moduleInfo.music >> 8, self->moduleInfo.music)) - return FALSE; - if (!ASAP_Do6502Init(self, self->moduleInfo.player, 2, self->moduleInfo.songPos[song], 0)) - return FALSE; - break; - case ASAPModuleType_RMT: - if (!ASAP_Do6502Init(self, self->moduleInfo.player, self->moduleInfo.songPos[song], self->moduleInfo.music, self->moduleInfo.music >> 8)) - return FALSE; - break; - case ASAPModuleType_TMC: - case ASAPModuleType_TM2: - if (!ASAP_Do6502Init(self, self->moduleInfo.player, 112, self->moduleInfo.music >> 8, self->moduleInfo.music)) - return FALSE; - if (!ASAP_Do6502Init(self, self->moduleInfo.player, 0, song, 0)) - return FALSE; - self->tmcPerFrameCounter = 1; - break; - case ASAPModuleType_FC: - if (!ASAP_Do6502Init(self, self->moduleInfo.player, song, 0, 0)) - return FALSE; - break; - } - ASAP_MutePokeyChannels(self, 0); - self->nextPlayerCycle = 0; - return TRUE; -} - -static void ASAP_PokeHardware(ASAP *self, int addr, int data) -{ - if (addr >> 8 == 210) { - if ((addr & (self->pokeys.extraPokeyMask + 15)) == 14) { - self->pokeys.irqst |= data ^ 255; - if ((data & self->pokeys.irqst & 1) != 0) { - if (self->pokeys.timer1Cycle == 8388608) { - int t = self->pokeys.basePokey.tickCycle1; - while (t < self->cycle) - t += self->pokeys.basePokey.periodCycles1; - self->pokeys.timer1Cycle = t; - if (self->nextEventCycle > t) - self->nextEventCycle = t; - } - } - else - self->pokeys.timer1Cycle = 8388608; - if ((data & self->pokeys.irqst & 2) != 0) { - if (self->pokeys.timer2Cycle == 8388608) { - int t = self->pokeys.basePokey.tickCycle2; - while (t < self->cycle) - t += self->pokeys.basePokey.periodCycles2; - self->pokeys.timer2Cycle = t; - if (self->nextEventCycle > t) - self->nextEventCycle = t; - } - } - else - self->pokeys.timer2Cycle = 8388608; - if ((data & self->pokeys.irqst & 4) != 0) { - if (self->pokeys.timer4Cycle == 8388608) { - int t = self->pokeys.basePokey.tickCycle4; - while (t < self->cycle) - t += self->pokeys.basePokey.periodCycles4; - self->pokeys.timer4Cycle = t; - if (self->nextEventCycle > t) - self->nextEventCycle = t; - } - } - else - self->pokeys.timer4Cycle = 8388608; - } - else - PokeyPair_Poke(&self->pokeys, addr, data, self->cycle); - } - else if ((addr & 65295) == 54282) { - int x = self->cycle % 114; - self->cycle += (x <= 106 ? 106 : 220) - x; - } - else if ((addr & 65295) == 54287) { - self->nmist = self->cycle < 28292 ? NmiStatus_ON_V_BLANK : NmiStatus_RESET; - } - else if ((addr & 65280) == self->moduleInfo.covoxAddr) { - Pokey *pokey; - addr &= 3; - if (addr == 0 || addr == 3) - pokey = &self->pokeys.basePokey; - else - pokey = &self->pokeys.extraPokey; - Pokey_AddDelta(pokey, &self->pokeys, self->cycle, (data - self->covox[addr]) << 17); - self->covox[addr] = data; - } - else if ((addr & 65311) == 53279) { - int delta = ((self->consol & 8) - (data & 8)) << 20; - Pokey_AddDelta(&self->pokeys.basePokey, &self->pokeys, self->cycle, delta); - Pokey_AddDelta(&self->pokeys.extraPokey, &self->pokeys, self->cycle, delta); - self->consol = data; - } - else - self->memory[addr] = data; -} - -static void ASAP_PutLittleEndian(unsigned char *buffer, int offset, int value) -{ - buffer[offset] = (unsigned char) value; - buffer[offset + 1] = (unsigned char) (value >> 8); - buffer[offset + 2] = (unsigned char) (value >> 16); - buffer[offset + 3] = (unsigned char) (value >> 24); -} - -static void ASAP_PutLittleEndians(unsigned char *buffer, int offset, int value1, int value2) -{ - ASAP_PutLittleEndian(buffer, offset, value1); - ASAP_PutLittleEndian(buffer, offset + 4, value2); -} - -static int ASAP_PutWavMetadata(unsigned char *buffer, int offset, int fourCC, const char *value) -{ - int len = (int) strlen(value); - if (len > 0) { - ASAP_PutLittleEndians(buffer, offset, fourCC, (len | 1) + 1); - offset += 8; - { - int i; - for (i = 0; i < len; i++) - buffer[offset++] = value[i]; - } - buffer[offset++] = 0; - if ((len & 1) == 0) - buffer[offset++] = 0; - } - return offset; -} - -cibool ASAP_Seek(ASAP *self, int position) -{ - return ASAP_SeekSample(self, ASAP_MillisecondsToBlocks(position)); -} - -cibool ASAP_SeekSample(ASAP *self, int block) -{ - if (block < self->blocksPlayed) - if (!ASAP_PlaySong(self, self->currentSong, self->currentDuration)) - return FALSE; - while (self->blocksPlayed + self->pokeys.readySamplesEnd < block) { - self->blocksPlayed += self->pokeys.readySamplesEnd; - ASAP_DoFrame(self); - } - self->pokeys.readySamplesStart = block - self->blocksPlayed; - self->blocksPlayed = block; - return TRUE; -} - -static unsigned char const *ASAP6502_GetPlayerRoutine(ASAPInfo const *info) -{ - switch (info->type) { - case ASAPModuleType_CMC: - return CiBinaryResource_cmc_obx; - case ASAPModuleType_CM3: - return CiBinaryResource_cm3_obx; - case ASAPModuleType_CMR: - return CiBinaryResource_cmr_obx; - case ASAPModuleType_CMS: - return CiBinaryResource_cms_obx; - case ASAPModuleType_DLT: - return CiBinaryResource_dlt_obx; - case ASAPModuleType_MPT: - return CiBinaryResource_mpt_obx; - case ASAPModuleType_RMT: - return info->channels == 1 ? CiBinaryResource_rmt4_obx : CiBinaryResource_rmt8_obx; - case ASAPModuleType_TMC: - return CiBinaryResource_tmc_obx; - case ASAPModuleType_TM2: - return CiBinaryResource_tm2_obx; - case ASAPModuleType_FC: - return CiBinaryResource_fc_obx; - default: - return NULL; - } -} - -ASAPInfo *ASAPInfo_New(void) -{ - ASAPInfo *self = (ASAPInfo *) malloc(sizeof(ASAPInfo)); - return self; -} - -void ASAPInfo_Delete(ASAPInfo *self) -{ - free(self); -} - -static void ASAPInfo_AddSong(ASAPInfo *self, int playerCalls) -{ - self->durations[self->songs++] = (int) ((double) (playerCalls * self->fastplay) * 38000 / 591149); -} - -static int ASAPInfo_AfterFF(unsigned char const *module, int moduleLen, int currentOffset) -{ - while (currentOffset < moduleLen) { - if (module[currentOffset++] == 255) - return currentOffset; - } - return -1; -} - -static int ASAPInfo_CheckDate(ASAPInfo const *self) -{ - int n = (int) strlen(self->date); - switch (n) { - case 10: - if (!ASAPInfo_CheckTwoDateDigits(self, 0) || self->date[2] != 47) - return -1; - case 7: - if (!ASAPInfo_CheckTwoDateDigits(self, n - 7) || self->date[n - 5] != 47) - return -1; - case 4: - if (!ASAPInfo_CheckTwoDateDigits(self, n - 4) || !ASAPInfo_CheckTwoDateDigits(self, n - 2)) - return -1; - return n; - default: - return -1; - } -} - -static cibool ASAPInfo_CheckTwoDateDigits(ASAPInfo const *self, int i) -{ - int d1 = self->date[i]; - int d2 = self->date[i + 1]; - return d1 >= 48 && d1 <= 57 && d2 >= 48 && d2 <= 57; -} - -static cibool ASAPInfo_CheckValidChar(int c) -{ - if (!ASAPInfo_IsValidChar(c)) - return FALSE; - return TRUE; -} - -static cibool ASAPInfo_CheckValidText(const char *s) -{ - int n = (int) strlen(s); - if (n > 127) - return FALSE; - { - int i; - for (i = 0; i < n; i++) - if (!ASAPInfo_CheckValidChar(s[i])) - return FALSE; - } - return TRUE; -} - -const char *ASAPInfo_GetAuthor(ASAPInfo const *self) -{ - return self->author; -} - -int ASAPInfo_GetChannels(ASAPInfo const *self) -{ - return self->channels; -} - -int ASAPInfo_GetCovoxAddress(ASAPInfo const *self) -{ - return self->covoxAddr; -} - -const char *ASAPInfo_GetDate(ASAPInfo const *self) -{ - return self->date; -} - -int ASAPInfo_GetDayOfMonth(ASAPInfo const *self) -{ - int n = ASAPInfo_CheckDate(self); - if (n != 10) - return -1; - return ASAPInfo_GetTwoDateDigits(self, 0); -} - -int ASAPInfo_GetDefaultSong(ASAPInfo const *self) -{ - return self->defaultSong; -} - -int ASAPInfo_GetDuration(ASAPInfo const *self, int song) -{ - return self->durations[song]; -} - -const char *ASAPInfo_GetExtDescription(const char *ext) -{ - switch ((int) strlen(ext) >> 1 == 1 ? (ext[0] + (ext[1] << 8) + ((int) strlen(ext) == 3 ? ext[2] << 16 : 0)) | 2105376 : 0) { - case 7364979: - return "Slight Atari Player"; - case 6516067: - return "Chaos Music Composer"; - case 3370339: - return "CMC \"3/4\""; - case 7499107: - return "CMC \"Rzog\""; - case 7564643: - return "Stereo Double CMC"; - case 6516068: - return "DoublePlay CMC"; - case 7629924: - return "Delta Music Composer"; - case 7630957: - return "Music ProTracker"; - case 6582381: - return "MPT DoublePlay"; - case 7630194: - return "Raster Music Tracker"; - case 6516084: - case 3698036: - return "Theta Music Composer 1.x"; - case 3304820: - return "Theta Music Composer 2.x"; - case 2122598: - return "Future Composer"; - case 7890296: - return "Atari 8-bit executable"; - default: - return NULL; - } -} - -int ASAPInfo_GetInitAddress(ASAPInfo const *self) -{ - return self->init; -} - -const char *ASAPInfo_GetInstrumentName(ASAPInfo const *self, unsigned char const *module, int moduleLen, int i) -{ - if (self->type != ASAPModuleType_RMT) - return NULL; - { - int offset; - for (offset = ASAPInfo_GetWord(module, 4) - ASAPInfo_GetWord(module, 2) + 12; offset < moduleLen; offset++) { - if (module[offset - 1] == 0 && --i == -1) { - - return (const char *) module + offset; - } - } - } - return NULL; -} - -cibool ASAPInfo_GetLoop(ASAPInfo const *self, int song) -{ - return self->loops[song]; -} - -int ASAPInfo_GetMonth(ASAPInfo const *self) -{ - int n = ASAPInfo_CheckDate(self); - if (n < 7) - return -1; - return ASAPInfo_GetTwoDateDigits(self, n - 7); -} - -int ASAPInfo_GetMusicAddress(ASAPInfo const *self) -{ - return self->music; -} - -const char *ASAPInfo_GetOriginalModuleExt(ASAPInfo const *self, unsigned char const *module, int moduleLen) -{ - switch (self->type) { - case ASAPModuleType_SAP_B: - if ((self->init == 1019 || self->init == 1017) && self->player == 1283) - return "dlt"; - if (((self->init == 1267 || self->init == 1263) && self->player == 1283) || (self->init == 62707 && self->player == 62723)) - return self->fastplay == 156 ? "mpd" : "mpt"; - if (self->init == 3200 || ASAPInfo_GetRmtSapOffset(self, module, moduleLen) > 0) - return "rmt"; - if (self->init == 1269 || self->init == 62709 || self->init == 1266 || ((self->init == 1255 || self->init == 62695 || self->init == 1252) && self->fastplay == 156) || ((self->init == 1253 || self->init == 62693 || self->init == 1250) && (self->fastplay == 104 || self->fastplay == 78))) - return "tmc"; - if ((self->init == 4224 && self->player == 1283) || (self->init == 4992 && self->player == 2051)) - return "tm2"; - if (self->init == 1024 && self->player == 1027) - return "fc"; - return NULL; - case ASAPModuleType_SAP_C: - if ((self->player == 1280 || self->player == 62720) && moduleLen >= 1024) { - if (self->fastplay == 156) - return "dmc"; - if (self->channels > 1) - return "cms"; - if (module[moduleLen - 170] == 30) - return "cmr"; - if (module[moduleLen - 909] == 48) - return "cm3"; - return "cmc"; - } - return NULL; - case ASAPModuleType_CMC: - return self->fastplay == 156 ? "dmc" : "cmc"; - case ASAPModuleType_CM3: - return "cm3"; - case ASAPModuleType_CMR: - return "cmr"; - case ASAPModuleType_CMS: - return "cms"; - case ASAPModuleType_DLT: - return "dlt"; - case ASAPModuleType_MPT: - return self->fastplay == 156 ? "mpd" : "mpt"; - case ASAPModuleType_RMT: - return "rmt"; - case ASAPModuleType_TMC: - return "tmc"; - case ASAPModuleType_TM2: - return "tm2"; - case ASAPModuleType_FC: - return "fc"; - default: - return NULL; - } -} - -static int ASAPInfo_GetPackedExt(const char *filename) -{ - int ext = 0; - { - int i; - for (i = (int) strlen(filename); --i > 0;) { - int c = filename[i]; - if (c <= 32 || c > 122) - return 0; - if (c == 46) - return ext | 2105376; - ext = (ext << 8) + c; - } - } - return 0; -} - -int ASAPInfo_GetPlayerAddress(ASAPInfo const *self) -{ - return self->player; -} - -int ASAPInfo_GetPlayerRateHz(ASAPInfo const *self) -{ - int scanlineClock = self->ntsc ? 15699 : 15556; - return (scanlineClock + (self->fastplay >> 1)) / self->fastplay; -} - -int ASAPInfo_GetPlayerRateScanlines(ASAPInfo const *self) -{ - return self->fastplay; -} - -static int ASAPInfo_GetRmtInstrumentFrames(unsigned char const *module, int instrument, int volume, int volumeFrame, cibool onExtraPokey) -{ - int addrToOffset = ASAPInfo_GetWord(module, 2) - 6; - int perFrame; - int playerCall; - int playerCalls; - int index; - int indexEnd; - int indexLoop; - int volumeSlideDepth; - int volumeMin; - static const unsigned char rmtVolumeSilent[16] = { 16, 8, 4, 3, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1 }; - int volumeSlide; - cibool silentLoop; - instrument = ASAPInfo_GetWord(module, 14) - addrToOffset + (instrument << 1); - if (module[instrument + 1] == 0) - return 0; - instrument = ASAPInfo_GetWord(module, instrument) - addrToOffset; - perFrame = module[12]; - playerCall = volumeFrame * perFrame; - playerCalls = playerCall; - index = module[instrument] + 1 + playerCall * 3; - indexEnd = module[instrument + 2] + 3; - indexLoop = module[instrument + 3]; - if (indexLoop >= indexEnd) - return 0; - volumeSlideDepth = module[instrument + 6]; - volumeMin = module[instrument + 7]; - if (index >= indexEnd) - index = (index - indexEnd) % (indexEnd - indexLoop) + indexLoop; - else { - do { - int vol = module[instrument + index]; - if (onExtraPokey) - vol >>= 4; - if ((vol & 15) >= rmtVolumeSilent[volume]) - playerCalls = playerCall + 1; - playerCall++; - index += 3; - } - while (index < indexEnd); - } - if (volumeSlideDepth == 0) - return playerCalls / perFrame; - volumeSlide = 128; - silentLoop = FALSE; - for (;;) { - int vol; - if (index >= indexEnd) { - if (silentLoop) - break; - silentLoop = TRUE; - index = indexLoop; - } - vol = module[instrument + index]; - if (onExtraPokey) - vol >>= 4; - if ((vol & 15) >= rmtVolumeSilent[volume]) { - playerCalls = playerCall + 1; - silentLoop = FALSE; - } - playerCall++; - index += 3; - volumeSlide -= volumeSlideDepth; - if (volumeSlide < 0) { - volumeSlide += 256; - if (--volume <= volumeMin) - break; - } - } - return playerCalls / perFrame; -} - -static int ASAPInfo_GetRmtSapOffset(ASAPInfo const *self, unsigned char const *module, int moduleLen) -{ - int offset; - if (self->player != 13315) - return -1; - offset = self->headerLen + ASAPInfo_GetWord(module, self->headerLen + 4) - ASAPInfo_GetWord(module, self->headerLen + 2) + 7; - if (offset + 6 >= moduleLen || module[offset + 4] != 82 || module[offset + 5] != 77 || module[offset + 6] != 84) - return -1; - return offset; -} - -int ASAPInfo_GetSapHeaderLength(ASAPInfo const *self) -{ - return self->headerLen; -} - -int ASAPInfo_GetSongs(ASAPInfo const *self) -{ - return self->songs; -} - -const char *ASAPInfo_GetTitle(ASAPInfo const *self) -{ - return self->title; -} - -const char *ASAPInfo_GetTitleOrFilename(ASAPInfo const *self) -{ - return self->title[0] != '\0' ? self->title : self->filename; -} - -static int ASAPInfo_GetTwoDateDigits(ASAPInfo const *self, int i) -{ - return (self->date[i] - 48) * 10 + self->date[i + 1] - 48; -} - -int ASAPInfo_GetTypeLetter(ASAPInfo const *self) -{ - switch (self->type) { - case ASAPModuleType_SAP_B: - return 66; - case ASAPModuleType_SAP_C: - return 67; - case ASAPModuleType_SAP_D: - return 68; - case ASAPModuleType_SAP_S: - return 83; - default: - return 0; - } -} - -static int ASAPInfo_GetWord(unsigned char const *array, int i) -{ - return array[i] + (array[i + 1] << 8); -} - -int ASAPInfo_GetYear(ASAPInfo const *self) -{ - int n = ASAPInfo_CheckDate(self); - if (n < 0) - return -1; - return ASAPInfo_GetTwoDateDigits(self, n - 4) * 100 + ASAPInfo_GetTwoDateDigits(self, n - 2); -} - -static int ASAPInfo_GuessPackedExt(unsigned char const *module, int moduleLen) -{ - if (ASAPInfo_ValidateSap(module, moduleLen)) - return 7364979; - if (ASAPInfo_ValidateFc(module, moduleLen)) - return 2122598; - if (ASAPInfo_ValidateRmt(module, moduleLen)) - return 7630194; - return -1; -} - -static cibool ASAPInfo_HasStringAt(unsigned char const *module, int moduleIndex, const char *s) -{ - int n = (int) strlen(s); - { - int i; - for (i = 0; i < n; i++) - if (module[moduleIndex + i] != s[i]) - return FALSE; - } - return TRUE; -} - -static cibool ASAPInfo_IsDltPatternEnd(unsigned char const *module, int pos, int i) -{ - { - int ch; - for (ch = 0; ch < 4; ch++) { - int pattern = module[8198 + (ch << 8) + pos]; - if (pattern < 64) { - int offset = 6 + (pattern << 7) + (i << 1); - if ((module[offset] & 128) == 0 && (module[offset + 1] & 128) != 0) - return TRUE; - } - } - } - return FALSE; -} - -static cibool ASAPInfo_IsDltTrackEmpty(unsigned char const *module, int pos) -{ - return module[8198 + pos] >= 67 && module[8454 + pos] >= 64 && module[8710 + pos] >= 64 && module[8966 + pos] >= 64; -} - -static cibool ASAPInfo_IsFcSongEnd(unsigned char const *module, int const *trackPos) -{ - cibool allLoop = TRUE; - { - int n; - for (n = 0; n < 3; n++) { - if (trackPos[n] >= 256) - return TRUE; - switch (module[3 + (n << 8) + trackPos[n]]) { - case 254: - return TRUE; - case 255: - break; - default: - allLoop = FALSE; - break; - } - } - } - return allLoop; -} - -cibool ASAPInfo_IsNtsc(ASAPInfo const *self) -{ - return self->ntsc; -} - -cibool ASAPInfo_IsOurExt(const char *ext) -{ - return ASAPInfo_IsOurPackedExt((int) strlen(ext) >> 1 == 1 ? (ext[0] + (ext[1] << 8) + ((int) strlen(ext) == 3 ? ext[2] << 16 : 0)) | 2105376 : 0); -} - -cibool ASAPInfo_IsOurFile(const char *filename) -{ - return ASAPInfo_IsOurPackedExt(ASAPInfo_GetPackedExt(filename)); -} - -static cibool ASAPInfo_IsOurPackedExt(int ext) -{ - switch (ext) { - case 7364979: - case 6516067: - case 3370339: - case 7499107: - case 7564643: - case 6516068: - case 7629924: - case 7630957: - case 6582381: - case 7630194: - case 6516084: - case 3698036: - case 3304820: - case 2122598: - return TRUE; - default: - return FALSE; - } -} - -static cibool ASAPInfo_IsValidChar(int c) -{ - return c >= 32 && c <= 124 && c != 96 && c != 123; -} - -cibool ASAPInfo_Load(ASAPInfo *self, const char *filename, unsigned char const *module, int moduleLen) -{ - int ext; - if (filename != NULL) { - int len = (int) strlen(filename); - int basename = 0; - ext = -1; - { - int i; - for (i = len; --i >= 0;) { - int c = filename[i]; - if (c == 47 || c == 92) { - basename = i + 1; - break; - } - if (c == 46) - ext = i; - } - } - if (ext < 0) - return FALSE; - ext -= basename; - if (ext > 127) - ext = 127; - ((char *) memcpy(self->filename, filename + basename, ext))[ext] = '\0'; - ext = ASAPInfo_GetPackedExt(filename); - } - else { - self->filename[0] = '\0'; - if ((ext = ASAPInfo_GuessPackedExt(module, moduleLen)) == -1) - return FALSE; - } - self->author[0] = '\0'; - self->title[0] = '\0'; - self->date[0] = '\0'; - self->channels = 1; - self->songs = 1; - self->defaultSong = 0; - { - int i; - for (i = 0; i < 32; i++) { - self->durations[i] = -1; - self->loops[i] = FALSE; - } - } - self->ntsc = FALSE; - self->fastplay = 312; - self->music = -1; - self->init = -1; - self->player = -1; - self->covoxAddr = -1; - self->headerLen = 0; - switch (ext) { - case 7364979: - return ASAPInfo_ParseSap(self, module, moduleLen); - case 6516067: - return ASAPInfo_ParseCmc(self, module, moduleLen, ASAPModuleType_CMC); - case 3370339: - return ASAPInfo_ParseCmc(self, module, moduleLen, ASAPModuleType_CM3); - case 7499107: - return ASAPInfo_ParseCmc(self, module, moduleLen, ASAPModuleType_CMR); - case 7564643: - self->channels = 2; - return ASAPInfo_ParseCmc(self, module, moduleLen, ASAPModuleType_CMS); - case 6516068: - self->fastplay = 156; - return ASAPInfo_ParseCmc(self, module, moduleLen, ASAPModuleType_CMC); - case 7629924: - return ASAPInfo_ParseDlt(self, module, moduleLen); - case 7630957: - return ASAPInfo_ParseMpt(self, module, moduleLen); - case 6582381: - self->fastplay = 156; - return ASAPInfo_ParseMpt(self, module, moduleLen); - case 7630194: - return ASAPInfo_ParseRmt(self, module, moduleLen); - case 6516084: - case 3698036: - return ASAPInfo_ParseTmc(self, module, moduleLen); - case 3304820: - return ASAPInfo_ParseTm2(self, module, moduleLen); - case 2122598: - return ASAPInfo_ParseFc(self, module, moduleLen); - default: - return FALSE; - } -} - -static cibool ASAPInfo_ParseCmc(ASAPInfo *self, unsigned char const *module, int moduleLen, ASAPModuleType type) -{ - int lastPos; - if (moduleLen < 774) - return FALSE; - self->type = type; - if (!ASAPInfo_ParseModule(self, module, moduleLen)) - return FALSE; - lastPos = 84; - while (--lastPos >= 0) { - if (module[518 + lastPos] < 176 || module[603 + lastPos] < 64 || module[688 + lastPos] < 64) - break; - if (self->channels == 2) { - if (module[774 + lastPos] < 176 || module[859 + lastPos] < 64 || module[944 + lastPos] < 64) - break; - } - } - self->songs = 0; - ASAPInfo_ParseCmcSong(self, module, 0); - { - int pos; - for (pos = 0; pos < lastPos && self->songs < 32; pos++) - if (module[518 + pos] == 143 || module[518 + pos] == 239) - ASAPInfo_ParseCmcSong(self, module, pos + 1); - } - return TRUE; -} - -static void ASAPInfo_ParseCmcSong(ASAPInfo *self, unsigned char const *module, int pos) -{ - int tempo = module[25]; - int playerCalls = 0; - int repStartPos = 0; - int repEndPos = 0; - int repTimes = 0; - unsigned char seen[85]; - memset(seen, 0, sizeof(seen)); - while (pos >= 0 && pos < 85) { - int p1; - int p2; - int p3; - if (pos == repEndPos && repTimes > 0) { - { - int i; - for (i = 0; i < 85; i++) - if (seen[i] == 1 || seen[i] == 3) - seen[i] = 0; - } - repTimes--; - pos = repStartPos; - } - if (seen[pos] != 0) { - if (seen[pos] != 1) - self->loops[self->songs] = TRUE; - break; - } - seen[pos] = 1; - p1 = module[518 + pos]; - p2 = module[603 + pos]; - p3 = module[688 + pos]; - if (p1 == 254 || p2 == 254 || p3 == 254) { - pos++; - continue; - } - p1 |= self->type == ASAPModuleType_CMS ? 7 : 15; - switch (p1) { - case 135: - case 167: - pos++; - break; - case 143: - pos = -1; - break; - case 151: - if (p2 < 128) { - playerCalls += p2; - if (p3 < 128) - playerCalls += p3 * 50; - } - pos++; - break; - case 159: - pos = p2; - break; - case 175: - pos -= p2; - break; - case 191: - pos += p2; - break; - case 207: - if (p2 < 128) { - tempo = p2; - pos++; - } - else - pos = -1; - break; - case 223: - pos++; - repStartPos = pos; - repEndPos = pos + p2; - repTimes = p3 - 1; - break; - case 239: - self->loops[self->songs] = TRUE; - pos = -1; - break; - default: - p2 = repTimes > 0 ? 3 : 2; - for (p1 = 0; p1 < 85; p1++) - if (seen[p1] == 1) - seen[p1] = p2; - playerCalls += tempo * (self->type == ASAPModuleType_CM3 ? 48 : 64); - pos++; - break; - } - } - ASAPInfo_AddSong(self, playerCalls); -} - -static int ASAPInfo_ParseDec(unsigned char const *module, int moduleIndex, int maxVal) -{ - if (module[moduleIndex] == 13) - return -1; - { - int r; - for (r = 0;;) { - int c = module[moduleIndex++]; - if (c == 13) - return r; - if (c < 48 || c > 57) - return -1; - r = 10 * r + c - 48; - if (r > maxVal) - return -1; - } - } -} - -static cibool ASAPInfo_ParseDlt(ASAPInfo *self, unsigned char const *module, int moduleLen) -{ - cibool seen[128]; - if (moduleLen != 11270 && moduleLen != 11271) - return FALSE; - self->type = ASAPModuleType_DLT; - if (!ASAPInfo_ParseModule(self, module, moduleLen)) - return FALSE; - if (self->music != 8192) - return FALSE; - memset(seen, 0, sizeof(seen)); - self->songs = 0; - { - int pos; - for (pos = 0; pos < 128 && self->songs < 32; pos++) { - if (!seen[pos]) - ASAPInfo_ParseDltSong(self, module, seen, pos); - } - } - if (self->songs == 0) - return FALSE; - return TRUE; -} - -static void ASAPInfo_ParseDltSong(ASAPInfo *self, unsigned char const *module, cibool *seen, int pos) -{ - int playerCalls; - cibool loop; - int tempo; - while (pos < 128 && !seen[pos] && ASAPInfo_IsDltTrackEmpty(module, pos)) - seen[pos++] = TRUE; - self->songPos[self->songs] = pos; - playerCalls = 0; - loop = FALSE; - tempo = 6; - while (pos < 128) { - int p1; - if (seen[pos]) { - loop = TRUE; - break; - } - seen[pos] = TRUE; - p1 = module[8198 + pos]; - if (p1 == 64 || ASAPInfo_IsDltTrackEmpty(module, pos)) - break; - if (p1 == 65) - pos = module[8326 + pos]; - else if (p1 == 66) - tempo = module[8326 + pos++]; - else { - { - int i; - for (i = 0; i < 64 && !ASAPInfo_IsDltPatternEnd(module, pos, i); i++) - playerCalls += tempo; - } - pos++; - } - } - if (playerCalls > 0) { - self->loops[self->songs] = loop; - ASAPInfo_AddSong(self, playerCalls); - } -} - -int ASAPInfo_ParseDuration(const char *s) -{ - int i = 0; - int n = (int) strlen(s); - int d; - int r; - if (i >= n) - return -1; - d = s[i] - 48; - if (d < 0 || d > 9) - return -1; - i++; - r = d; - if (i < n) { - d = s[i] - 48; - if (d >= 0 && d <= 9) { - i++; - r = 10 * r + d; - } - if (i < n && s[i] == 58) { - i++; - if (i >= n) - return -1; - d = s[i] - 48; - if (d < 0 || d > 5) - return -1; - i++; - r = (6 * r + d) * 10; - if (i >= n) - return -1; - d = s[i] - 48; - if (d < 0 || d > 9) - return -1; - i++; - r += d; - } - } - r *= 1000; - if (i >= n) - return r; - if (s[i] != 46) - return -1; - i++; - if (i >= n) - return -1; - d = s[i] - 48; - if (d < 0 || d > 9) - return -1; - i++; - r += 100 * d; - if (i >= n) - return r; - d = s[i] - 48; - if (d < 0 || d > 9) - return -1; - i++; - r += 10 * d; - if (i >= n) - return r; - d = s[i] - 48; - if (d < 0 || d > 9) - return -1; - i++; - r += d; - return r; -} - -static cibool ASAPInfo_ParseFc(ASAPInfo *self, unsigned char const *module, int moduleLen) -{ - int patternOffsets[64]; - int currentOffset; - if (!ASAPInfo_ValidateFc(module, moduleLen)) - return FALSE; - self->type = ASAPModuleType_FC; - self->player = 1024; - self->music = 2560; - self->songs = 0; - self->headerLen = -1; - currentOffset = 899; - { - int i; - for (i = 0; i < 64; i++) { - patternOffsets[i] = currentOffset; - if ((currentOffset = ASAPInfo_AfterFF(module, moduleLen, currentOffset)) == -1) - return FALSE; - } - } - { - int i; - for (i = 0; i < 32; i++) - if ((currentOffset = ASAPInfo_AfterFF(module, moduleLen, currentOffset)) == -1) - return FALSE; - } - { - int pos; - for (pos = 0; pos < 256 && self->songs < 32;) { - int trackPos[3]; - int patternDelay[3]; - int noteDuration[3]; - int patternPos[3]; - int playerCalls; - { - int n; - for (n = 0; n < 3; n++) - trackPos[n] = pos; - } - memset(patternDelay, 0, sizeof(patternDelay)); - memset(noteDuration, 0, sizeof(noteDuration)); - memset(patternPos, 0, sizeof(patternPos)); - playerCalls = 0; - self->loops[self->songs] = TRUE; - while (!ASAPInfo_IsFcSongEnd(module, trackPos)) { - { - int n; - for (n = 0; n < 3; n++) { - int trackCmd = module[3 + (n << 8) + trackPos[n]]; - if (trackCmd != 255 && patternDelay[n]-- <= 0) { - while (trackPos[n] < 256) { - trackCmd = module[3 + (n << 8) + trackPos[n]]; - if (trackCmd < 64) { - int patternCmd = module[patternOffsets[trackCmd] + patternPos[n]++]; - if (patternCmd < 64) { - patternDelay[n] = noteDuration[n]; - break; - } - else if (patternCmd < 96) - noteDuration[n] = patternCmd - 64; - else if (patternCmd == 255) { - patternDelay[n] = 0; - noteDuration[n] = 0; - patternPos[n] = 0; - trackPos[n]++; - } - } - else if (trackCmd == 64) - trackPos[n] += 2; - else if (trackCmd == 254) { - self->loops[self->songs] = FALSE; - break; - } - else if (trackCmd == 255) - break; - else - trackPos[n]++; - } - } - } - } - if (ASAPInfo_IsFcSongEnd(module, trackPos)) - break; - playerCalls += module[2]; - } - pos = -1; - { - int n; - for (n = 0; n < 3; n++) { - int nxtrkpos = trackPos[n]; - if (patternPos[n] > 0) - nxtrkpos++; - if (pos < nxtrkpos) - pos = nxtrkpos; - } - } - pos++; - if (pos <= 256) - ASAPInfo_AddSong(self, playerCalls); - } - } - return TRUE; -} - -static int ASAPInfo_ParseHex(unsigned char const *module, int moduleIndex) -{ - if (module[moduleIndex] == 13) - return -1; - { - int r; - for (r = 0;;) { - int c = module[moduleIndex++]; - if (c == 13) - return r; - if (r > 4095) - return -1; - r <<= 4; - if (c >= 48 && c <= 57) - r += c - 48; - else if (c >= 65 && c <= 70) - r += c - 65 + 10; - else if (c >= 97 && c <= 102) - r += c - 97 + 10; - else - return -1; - } - } -} - -static cibool ASAPInfo_ParseModule(ASAPInfo *self, unsigned char const *module, int moduleLen) -{ - int musicLastByte; - int blockLen; - if ((module[0] != 255 || module[1] != 255) && (module[0] != 0 || module[1] != 0)) - return FALSE; - self->music = ASAPInfo_GetWord(module, 2); - musicLastByte = ASAPInfo_GetWord(module, 4); - if (self->music <= 55295 && musicLastByte >= 53248) - return FALSE; - blockLen = musicLastByte + 1 - self->music; - if (6 + blockLen != moduleLen) { - int infoAddr; - int infoLen; - if (self->type != ASAPModuleType_RMT || 11 + blockLen > moduleLen) - return FALSE; - infoAddr = ASAPInfo_GetWord(module, 6 + blockLen); - if (infoAddr != self->music + blockLen) - return FALSE; - infoLen = ASAPInfo_GetWord(module, 8 + blockLen) + 1 - infoAddr; - if (10 + blockLen + infoLen != moduleLen) - return FALSE; - } - return TRUE; -} - -static cibool ASAPInfo_ParseMpt(ASAPInfo *self, unsigned char const *module, int moduleLen) -{ - int track0Addr; - int songLen; - cibool globalSeen[256]; - if (moduleLen < 464) - return FALSE; - self->type = ASAPModuleType_MPT; - if (!ASAPInfo_ParseModule(self, module, moduleLen)) - return FALSE; - track0Addr = ASAPInfo_GetWord(module, 2) + 458; - if (module[454] + (module[458] << 8) != track0Addr) - return FALSE; - songLen = (module[455] + (module[459] << 8) - track0Addr) >> 1; - if (songLen > 254) - return FALSE; - memset(globalSeen, 0, sizeof(globalSeen)); - self->songs = 0; - { - int pos; - for (pos = 0; pos < songLen && self->songs < 32; pos++) { - if (!globalSeen[pos]) { - self->songPos[self->songs] = pos; - ASAPInfo_ParseMptSong(self, module, globalSeen, songLen, pos); - } - } - } - if (self->songs == 0) - return FALSE; - return TRUE; -} - -static void ASAPInfo_ParseMptSong(ASAPInfo *self, unsigned char const *module, cibool *globalSeen, int songLen, int pos) -{ - int addrToOffset = ASAPInfo_GetWord(module, 2) - 6; - int tempo = module[463]; - int playerCalls = 0; - unsigned char seen[256]; - int patternOffset[4]; - int blankRows[4]; - int blankRowsCounter[4]; - memset(seen, 0, sizeof(seen)); - memset(blankRows, 0, sizeof(blankRows)); - while (pos < songLen) { - int i; - int ch; - if (seen[pos] != 0) { - if (seen[pos] != 1) - self->loops[self->songs] = TRUE; - break; - } - seen[pos] = 1; - globalSeen[pos] = TRUE; - i = module[464 + pos * 2]; - if (i == 255) { - pos = module[465 + pos * 2]; - continue; - } - for (ch = 3; ch >= 0; ch--) { - i = module[454 + ch] + (module[458 + ch] << 8) - addrToOffset; - i = module[i + pos * 2]; - if (i >= 64) - break; - i <<= 1; - i = ASAPInfo_GetWord(module, 70 + i); - patternOffset[ch] = i == 0 ? 0 : i - addrToOffset; - blankRowsCounter[ch] = 0; - } - if (ch >= 0) - break; - for (i = 0; i < songLen; i++) - if (seen[i] == 1) - seen[i] = 2; - { - int patternRows; - for (patternRows = module[462]; --patternRows >= 0;) { - for (ch = 3; ch >= 0; ch--) { - if (patternOffset[ch] == 0 || --blankRowsCounter[ch] >= 0) - continue; - for (;;) { - i = module[patternOffset[ch]++]; - if (i < 64 || i == 254) - break; - if (i < 128) - continue; - if (i < 192) { - blankRows[ch] = i - 128; - continue; - } - if (i < 208) - continue; - if (i < 224) { - tempo = i - 207; - continue; - } - patternRows = 0; - } - blankRowsCounter[ch] = blankRows[ch]; - } - playerCalls += tempo; - } - } - pos++; - } - if (playerCalls > 0) - ASAPInfo_AddSong(self, playerCalls); -} - -static cibool ASAPInfo_ParseRmt(ASAPInfo *self, unsigned char const *module, int moduleLen) -{ - int posShift; - int perFrame; - int blockLen; - int songLen; - cibool globalSeen[256]; - unsigned char title[127]; - int titleLen; - if (!ASAPInfo_ValidateRmt(module, moduleLen)) - return FALSE; - switch (module[9]) { - case 52: - posShift = 2; - break; - case 56: - self->channels = 2; - posShift = 3; - break; - default: - return FALSE; - } - perFrame = module[12]; - if (perFrame < 1 || perFrame > 4) - return FALSE; - self->type = ASAPModuleType_RMT; - if (!ASAPInfo_ParseModule(self, module, moduleLen)) - return FALSE; - blockLen = ASAPInfo_GetWord(module, 4) + 1 - self->music; - songLen = ASAPInfo_GetWord(module, 4) + 1 - ASAPInfo_GetWord(module, 20); - if (posShift == 3 && (songLen & 4) != 0 && module[6 + blockLen - 4] == 254) - songLen += 4; - songLen >>= posShift; - if (songLen >= 256) - return FALSE; - memset(globalSeen, 0, sizeof(globalSeen)); - self->songs = 0; - { - int pos; - for (pos = 0; pos < songLen && self->songs < 32; pos++) { - if (!globalSeen[pos]) { - self->songPos[self->songs] = pos; - ASAPInfo_ParseRmtSong(self, module, globalSeen, songLen, posShift, pos); - } - } - } - self->fastplay = 312 / perFrame; - self->player = 1536; - if (self->songs == 0) - return FALSE; - for (titleLen = 0; titleLen < 127 && 10 + blockLen + titleLen < moduleLen; titleLen++) { - unsigned char c = module[10 + blockLen + titleLen]; - if (c == 0) - break; - title[titleLen] = ASAPInfo_IsValidChar(c) ? c : 32; - } - ((char *) memcpy(self->title, title + 0, titleLen))[titleLen] = '\0'; - return TRUE; -} - -static void ASAPInfo_ParseRmtSong(ASAPInfo *self, unsigned char const *module, cibool *globalSeen, int songLen, int posShift, int pos) -{ - int addrToOffset = ASAPInfo_GetWord(module, 2) - 6; - int tempo = module[11]; - int frames = 0; - int songOffset = ASAPInfo_GetWord(module, 20) - addrToOffset; - int patternLoOffset = ASAPInfo_GetWord(module, 16) - addrToOffset; - int patternHiOffset = ASAPInfo_GetWord(module, 18) - addrToOffset; - unsigned char seen[256]; - int patternBegin[8]; - int patternOffset[8]; - int blankRows[8]; - int instrumentNo[8]; - int instrumentFrame[8]; - int volumeValue[8]; - int volumeFrame[8]; - int instrumentFrames; - memset(seen, 0, sizeof(seen)); - memset(instrumentNo, 0, sizeof(instrumentNo)); - memset(instrumentFrame, 0, sizeof(instrumentFrame)); - memset(volumeValue, 0, sizeof(volumeValue)); - memset(volumeFrame, 0, sizeof(volumeFrame)); - while (pos < songLen) { - if (seen[pos] != 0) { - if (seen[pos] != 1) - self->loops[self->songs] = TRUE; - break; - } - seen[pos] = 1; - globalSeen[pos] = TRUE; - if (module[songOffset + (pos << posShift)] == 254) { - pos = module[songOffset + (pos << posShift) + 1]; - continue; - } - { - int ch; - for (ch = 0; ch < 1 << posShift; ch++) { - int p = module[songOffset + (pos << posShift) + ch]; - if (p == 255) - blankRows[ch] = 256; - else { - patternOffset[ch] = patternBegin[ch] = module[patternLoOffset + p] + (module[patternHiOffset + p] << 8) - addrToOffset; - if (patternOffset[ch] < 0) - return; - blankRows[ch] = 0; - } - } - } - { - int i; - for (i = 0; i < songLen; i++) - if (seen[i] == 1) - seen[i] = 2; - } - { - int patternRows; - for (patternRows = module[10]; --patternRows >= 0;) { - { - int ch; - for (ch = 0; ch < 1 << posShift; ch++) { - if (--blankRows[ch] > 0) - continue; - for (;;) { - int i = module[patternOffset[ch]++]; - if ((i & 63) < 62) { - i += module[patternOffset[ch]++] << 8; - if ((i & 63) != 61) { - instrumentNo[ch] = i >> 10; - instrumentFrame[ch] = frames; - } - volumeValue[ch] = (i >> 6) & 15; - volumeFrame[ch] = frames; - break; - } - if (i == 62) { - blankRows[ch] = module[patternOffset[ch]++]; - break; - } - if ((i & 63) == 62) { - blankRows[ch] = i >> 6; - break; - } - if ((i & 191) == 63) { - tempo = module[patternOffset[ch]++]; - continue; - } - if (i == 191) { - patternOffset[ch] = patternBegin[ch] + module[patternOffset[ch]]; - continue; - } - patternRows = -1; - break; - } - if (patternRows < 0) - break; - } - } - if (patternRows >= 0) - frames += tempo; - } - } - pos++; - } - instrumentFrames = 0; - { - int ch; - for (ch = 0; ch < 1 << posShift; ch++) { - int frame = instrumentFrame[ch]; - frame += ASAPInfo_GetRmtInstrumentFrames(module, instrumentNo[ch], volumeValue[ch], volumeFrame[ch] - frame, ch >= 4); - if (instrumentFrames < frame) - instrumentFrames = frame; - } - } - if (frames > instrumentFrames) { - if (frames - instrumentFrames > 100) - self->loops[self->songs] = FALSE; - frames = instrumentFrames; - } - if (frames > 0) - ASAPInfo_AddSong(self, frames); -} - -static cibool ASAPInfo_ParseSap(ASAPInfo *self, unsigned char const *module, int moduleLen) -{ - int type; - int moduleIndex; - int durationIndex; - if (!ASAPInfo_ValidateSap(module, moduleLen)) - return FALSE; - self->fastplay = -1; - type = 0; - moduleIndex = 5; - durationIndex = 0; - while (module[moduleIndex] != 255) { - if (moduleIndex + 8 >= moduleLen) - return FALSE; - if (ASAPInfo_HasStringAt(module, moduleIndex, "AUTHOR ")) { - int len; - if ((len = ASAPInfo_ParseText(module, moduleIndex + 7)) == -1) - return FALSE; - if (len > 0) - ((char *) memcpy(self->author, module + moduleIndex + 7 + 1, len))[len] = '\0'; - } - else if (ASAPInfo_HasStringAt(module, moduleIndex, "NAME ")) { - int len; - if ((len = ASAPInfo_ParseText(module, moduleIndex + 5)) == -1) - return FALSE; - if (len > 0) - ((char *) memcpy(self->title, module + moduleIndex + 5 + 1, len))[len] = '\0'; - } - else if (ASAPInfo_HasStringAt(module, moduleIndex, "DATE ")) { - int len; - if ((len = ASAPInfo_ParseText(module, moduleIndex + 5)) == -1) - return FALSE; - if (len > 0) - ((char *) memcpy(self->date, module + moduleIndex + 5 + 1, len))[len] = '\0'; - } - else if (ASAPInfo_HasStringAt(module, moduleIndex, "SONGS ")) { - if ((self->songs = ASAPInfo_ParseDec(module, moduleIndex + 6, 32)) == -1) - return FALSE; - if (self->songs < 1) - return FALSE; - } - else if (ASAPInfo_HasStringAt(module, moduleIndex, "DEFSONG ")) { - if ((self->defaultSong = ASAPInfo_ParseDec(module, moduleIndex + 8, 31)) == -1) - return FALSE; - if (self->defaultSong < 0) - return FALSE; - } - else if (ASAPInfo_HasStringAt(module, moduleIndex, "STEREO\r")) - self->channels = 2; - else if (ASAPInfo_HasStringAt(module, moduleIndex, "NTSC\r")) - self->ntsc = TRUE; - else if (ASAPInfo_HasStringAt(module, moduleIndex, "TIME ")) { - int len; - char s[10]; - int duration; - if (durationIndex >= 32) - return FALSE; - moduleIndex += 5; - for (len = 0; module[moduleIndex + len] != 13; len++) { - } - if (len > 5 && ASAPInfo_HasStringAt(module, moduleIndex + len - 5, " LOOP")) { - self->loops[durationIndex] = TRUE; - len -= 5; - } - if (len > 9) - return FALSE; - ((char *) memcpy(s, module + moduleIndex, len))[len] = '\0'; - if ((duration = ASAPInfo_ParseDuration(s)) == -1) - return FALSE; - self->durations[durationIndex++] = duration; - } - else if (ASAPInfo_HasStringAt(module, moduleIndex, "TYPE ")) - type = module[moduleIndex + 5]; - else if (ASAPInfo_HasStringAt(module, moduleIndex, "FASTPLAY ")) { - if ((self->fastplay = ASAPInfo_ParseDec(module, moduleIndex + 9, 32767)) == -1) - return FALSE; - if (self->fastplay < 1) - return FALSE; - } - else if (ASAPInfo_HasStringAt(module, moduleIndex, "MUSIC ")) { - if ((self->music = ASAPInfo_ParseHex(module, moduleIndex + 6)) == -1) - return FALSE; - } - else if (ASAPInfo_HasStringAt(module, moduleIndex, "INIT ")) { - if ((self->init = ASAPInfo_ParseHex(module, moduleIndex + 5)) == -1) - return FALSE; - } - else if (ASAPInfo_HasStringAt(module, moduleIndex, "PLAYER ")) { - if ((self->player = ASAPInfo_ParseHex(module, moduleIndex + 7)) == -1) - return FALSE; - } - else if (ASAPInfo_HasStringAt(module, moduleIndex, "COVOX ")) { - if ((self->covoxAddr = ASAPInfo_ParseHex(module, moduleIndex + 6)) == -1) - return FALSE; - if (self->covoxAddr != 54784) - return FALSE; - self->channels = 2; - } - while (module[moduleIndex++] != 13) { - if (moduleIndex >= moduleLen) - return FALSE; - } - if (module[moduleIndex++] != 10) - return FALSE; - } - if (self->defaultSong >= self->songs) - return FALSE; - switch (type) { - case 66: - if (self->player < 0) - return FALSE; - if (self->init < 0) - return FALSE; - self->type = ASAPModuleType_SAP_B; - break; - case 67: - if (self->player < 0) - return FALSE; - if (self->music < 0) - return FALSE; - self->type = ASAPModuleType_SAP_C; - break; - case 68: - if (self->init < 0) - return FALSE; - self->type = ASAPModuleType_SAP_D; - break; - case 83: - if (self->init < 0) - return FALSE; - self->type = ASAPModuleType_SAP_S; - if (self->fastplay < 0) - self->fastplay = 78; - break; - default: - return FALSE; - } - if (self->fastplay < 0) - self->fastplay = self->ntsc ? 262 : 312; - if (module[moduleIndex + 1] != 255) - return FALSE; - self->headerLen = moduleIndex; - return TRUE; -} - -static int ASAPInfo_ParseText(unsigned char const *module, int moduleIndex) -{ - if (module[moduleIndex] != 34) - return -1; - if (ASAPInfo_HasStringAt(module, moduleIndex + 1, "\"\r")) - return 0; - { - int len; - for (len = 0;; len++) { - int c = module[moduleIndex + 1 + len]; - if (c == 34 && module[moduleIndex + 2 + len] == 13) - return len; - if (!ASAPInfo_CheckValidChar(c)) - return -1; - } - } -} - -static cibool ASAPInfo_ParseTm2(ASAPInfo *self, unsigned char const *module, int moduleLen) -{ - int i; - int lastPos; - int c; - unsigned char title[127]; - int titleLen; - if (moduleLen < 932) - return FALSE; - self->type = ASAPModuleType_TM2; - if (!ASAPInfo_ParseModule(self, module, moduleLen)) - return FALSE; - i = module[37]; - if (i < 1 || i > 4) - return FALSE; - self->fastplay = 312 / i; - self->player = 2048; - if (module[31] != 0) - self->channels = 2; - lastPos = 65535; - for (i = 0; i < 128; i++) { - int instrAddr = module[134 + i] + (module[774 + i] << 8); - if (instrAddr != 0 && instrAddr < lastPos) - lastPos = instrAddr; - } - for (i = 0; i < 256; i++) { - int patternAddr = module[262 + i] + (module[518 + i] << 8); - if (patternAddr != 0 && patternAddr < lastPos) - lastPos = patternAddr; - } - lastPos -= ASAPInfo_GetWord(module, 2) + 896; - if (902 + lastPos >= moduleLen) - return FALSE; - do { - if (lastPos <= 0) - return FALSE; - lastPos -= 17; - c = module[918 + lastPos]; - } - while (c == 0 || c >= 128); - self->songs = 0; - ASAPInfo_ParseTm2Song(self, module, 0); - for (i = 0; i < lastPos && self->songs < 32; i += 17) { - c = module[918 + i]; - if (c == 0 || c >= 128) - ASAPInfo_ParseTm2Song(self, module, i + 17); - } - titleLen = ASAPInfo_ParseTmcTitle(title, 0, module, 39); - titleLen = ASAPInfo_ParseTmcTitle(title, titleLen, module, 71); - titleLen = ASAPInfo_ParseTmcTitle(title, titleLen, module, 103); - ((char *) memcpy(self->title, title + 0, titleLen))[titleLen] = '\0'; - return TRUE; -} - -static void ASAPInfo_ParseTm2Song(ASAPInfo *self, unsigned char const *module, int pos) -{ - int addrToOffset = ASAPInfo_GetWord(module, 2) - 6; - int tempo = module[36] + 1; - int playerCalls = 0; - int patternOffset[8]; - int blankRows[8]; - for (;;) { - int patternRows = module[918 + pos]; - if (patternRows == 0) - break; - if (patternRows >= 128) { - self->loops[self->songs] = TRUE; - break; - } - { - int ch; - for (ch = 7; ch >= 0; ch--) { - int pat = module[917 + pos - 2 * ch]; - patternOffset[ch] = module[262 + pat] + (module[518 + pat] << 8) - addrToOffset; - blankRows[ch] = 0; - } - } - while (--patternRows >= 0) { - { - int ch; - for (ch = 7; ch >= 0; ch--) { - if (--blankRows[ch] >= 0) - continue; - for (;;) { - int i = module[patternOffset[ch]++]; - if (i == 0) { - patternOffset[ch]++; - break; - } - if (i < 64) { - if (module[patternOffset[ch]++] >= 128) - patternOffset[ch]++; - break; - } - if (i < 128) { - patternOffset[ch]++; - break; - } - if (i == 128) { - blankRows[ch] = module[patternOffset[ch]++]; - break; - } - if (i < 192) - break; - if (i < 208) { - tempo = i - 191; - continue; - } - if (i < 224) { - patternOffset[ch]++; - break; - } - if (i < 240) { - patternOffset[ch] += 2; - break; - } - if (i < 255) { - blankRows[ch] = i - 240; - break; - } - blankRows[ch] = 64; - break; - } - } - } - playerCalls += tempo; - } - pos += 17; - } - ASAPInfo_AddSong(self, playerCalls); -} - -static cibool ASAPInfo_ParseTmc(ASAPInfo *self, unsigned char const *module, int moduleLen) -{ - int i; - int lastPos; - unsigned char title[127]; - int titleLen; - if (moduleLen < 464) - return FALSE; - self->type = ASAPModuleType_TMC; - if (!ASAPInfo_ParseModule(self, module, moduleLen)) - return FALSE; - self->channels = 2; - i = 0; - while (module[102 + i] == 0) { - if (++i >= 64) - return FALSE; - } - lastPos = (module[102 + i] << 8) + module[38 + i] - ASAPInfo_GetWord(module, 2) - 432; - if (437 + lastPos >= moduleLen) - return FALSE; - do { - if (lastPos <= 0) - return FALSE; - lastPos -= 16; - } - while (module[437 + lastPos] >= 128); - self->songs = 0; - ASAPInfo_ParseTmcSong(self, module, 0); - for (i = 0; i < lastPos && self->songs < 32; i += 16) - if (module[437 + i] >= 128) - ASAPInfo_ParseTmcSong(self, module, i + 16); - i = module[37]; - if (i < 1 || i > 4) - return FALSE; - self->fastplay = 312 / i; - titleLen = ASAPInfo_ParseTmcTitle(title, 0, module, 6); - ((char *) memcpy(self->title, title + 0, titleLen))[titleLen] = '\0'; - return TRUE; -} - -static void ASAPInfo_ParseTmcSong(ASAPInfo *self, unsigned char const *module, int pos) -{ - int addrToOffset = ASAPInfo_GetWord(module, 2) - 6; - int tempo = module[36] + 1; - int frames = 0; - int patternOffset[8]; - int blankRows[8]; - while (module[437 + pos] < 128) { - { - int ch; - for (ch = 7; ch >= 0; ch--) { - int pat = module[437 + pos - 2 * ch]; - patternOffset[ch] = module[166 + pat] + (module[294 + pat] << 8) - addrToOffset; - blankRows[ch] = 0; - } - } - { - int patternRows; - for (patternRows = 64; --patternRows >= 0;) { - { - int ch; - for (ch = 7; ch >= 0; ch--) { - if (--blankRows[ch] >= 0) - continue; - for (;;) { - int i = module[patternOffset[ch]++]; - if (i < 64) { - patternOffset[ch]++; - break; - } - if (i == 64) { - i = module[patternOffset[ch]++]; - if ((i & 127) == 0) - patternRows = 0; - else - tempo = (i & 127) + 1; - if (i >= 128) - patternOffset[ch]++; - break; - } - if (i < 128) { - i = module[patternOffset[ch]++] & 127; - if (i == 0) - patternRows = 0; - else - tempo = i + 1; - patternOffset[ch]++; - break; - } - if (i < 192) - continue; - blankRows[ch] = i - 191; - break; - } - } - } - frames += tempo; - } - } - pos += 16; - } - if (module[436 + pos] < 128) - self->loops[self->songs] = TRUE; - ASAPInfo_AddSong(self, frames); -} - -static int ASAPInfo_ParseTmcTitle(unsigned char *title, int titleLen, unsigned char const *module, int moduleOffset) -{ - int lastOffset = moduleOffset + 29; - while (module[lastOffset] == 32) { - if (--lastOffset < moduleOffset) - return titleLen; - } - if (titleLen > 0) { - title[titleLen++] = 32; - title[titleLen++] = 124; - title[titleLen++] = 32; - } - while (moduleOffset <= lastOffset) { - int c = module[moduleOffset++] & 127; - switch (c) { - case 20: - c = 42; - break; - case 1: - case 3: - case 5: - case 12: - case 14: - case 15: - case 19: - c += 96; - break; - case 24: - case 26: - c = 122; - break; - default: - if (!ASAPInfo_IsValidChar(c)) - c = 32; - break; - } - title[titleLen++] = c; - } - return titleLen; -} - -cibool ASAPInfo_SetAuthor(ASAPInfo *self, const char *value) -{ - if (!ASAPInfo_CheckValidText(value)) - return FALSE; - strcpy(self->author, value); - return TRUE; -} - -cibool ASAPInfo_SetDate(ASAPInfo *self, const char *value) -{ - if (!ASAPInfo_CheckValidText(value)) - return FALSE; - strcpy(self->date, value); - return TRUE; -} - -cibool ASAPInfo_SetDuration(ASAPInfo *self, int song, int duration) -{ - if (song < 0 || song >= self->songs) - return FALSE; - self->durations[song] = duration; - return TRUE; -} - -cibool ASAPInfo_SetLoop(ASAPInfo *self, int song, cibool loop) -{ - if (song < 0 || song >= self->songs) - return FALSE; - self->loops[song] = loop; - return TRUE; -} - -cibool ASAPInfo_SetMusicAddress(ASAPInfo *self, int address) -{ - if (address < 0 || address >= 65535) - return FALSE; - self->music = address; - return TRUE; -} - -cibool ASAPInfo_SetTitle(ASAPInfo *self, const char *value) -{ - if (!ASAPInfo_CheckValidText(value)) - return FALSE; - strcpy(self->title, value); - return TRUE; -} - -static cibool ASAPInfo_ValidateFc(unsigned char const *module, int moduleLen) -{ - if (moduleLen < 899) - return FALSE; - if (module[0] != 38 || module[1] != 35) - return FALSE; - return TRUE; -} - -static cibool ASAPInfo_ValidateRmt(unsigned char const *module, int moduleLen) -{ - if (moduleLen < 48) - return FALSE; - if (module[6] != 82 || module[7] != 77 || module[8] != 84 || module[13] != 1) - return FALSE; - return TRUE; -} - -static cibool ASAPInfo_ValidateSap(unsigned char const *module, int moduleLen) -{ - return moduleLen >= 30 && ASAPInfo_HasStringAt(module, 0, "SAP\r\n"); -} - -int ASAPWriter_DurationToString(unsigned char *result, int value) -{ - if (!ASAPWriter_SecondsToString(result, 0, value)) - return 0; - value %= 1000; - if (value == 0) - return 5; - result[5] = 46; - ASAPWriter_TwoDigitsToString(result, 6, value / 10); - value %= 10; - if (value == 0) - return 8; - result[8] = 48 + value; - return 9; -} - -void ASAPWriter_EnumSaveExts(StringConsumer output, ASAPInfo const *info, unsigned char const *module, int moduleLen) -{ - switch (info->type) { - const char *ext; - case ASAPModuleType_SAP_B: - case ASAPModuleType_SAP_C: - output.func(output.obj, "sap"); - ext = ASAPInfo_GetOriginalModuleExt(info, module, moduleLen); - if (ext != NULL) - output.func(output.obj, ext); - output.func(output.obj, "xex"); - break; - case ASAPModuleType_SAP_D: - output.func(output.obj, "sap"); - if (info->fastplay == 312) - output.func(output.obj, "xex"); - break; - case ASAPModuleType_SAP_S: - output.func(output.obj, "sap"); - break; - default: - output.func(output.obj, ASAPInfo_GetOriginalModuleExt(info, module, moduleLen)); - output.func(output.obj, "sap"); - output.func(output.obj, "xex"); - break; - } -} - -static int ASAPWriter_FormatXexInfoText(unsigned char *dest, int destLen, int endColumn, const char *src, cibool author) -{ - int srcLen = (int) strlen(src); - { - int srcOffset; - for (srcOffset = 0; srcOffset < srcLen;) { - int c = src[srcOffset++]; - if (c == 32) { - int wordLen; - if (author && srcOffset < srcLen && src[srcOffset] == 38) { - int authorLen; - for (authorLen = 1; srcOffset + authorLen < srcLen; authorLen++) { - if (src[srcOffset + authorLen] == 32 && srcOffset + authorLen + 1 < srcLen && src[srcOffset + authorLen + 1] == 38) - break; - } - if (authorLen <= 32 && destLen % 32 + 1 + authorLen > 32) { - destLen = ASAPWriter_PadXexInfo(dest, destLen, 1); - continue; - } - } - for (wordLen = 0; srcOffset + wordLen < srcLen && src[srcOffset + wordLen] != 32; wordLen++) { - } - if (wordLen <= 32 && destLen % 32 + 1 + wordLen > 32) { - destLen = ASAPWriter_PadXexInfo(dest, destLen, 0); - continue; - } - } - dest[destLen++] = c; - } - } - return ASAPWriter_PadXexInfo(dest, destLen, endColumn); -} - -static int ASAPWriter_PadXexInfo(unsigned char *dest, int offset, int endColumn) -{ - while (offset % 32 != endColumn) - dest[offset++] = 32; - return offset; -} - -static cibool ASAPWriter_SecondsToString(unsigned char *result, int offset, int value) -{ - if (value < 0 || value >= 6000000) - return FALSE; - value /= 1000; - ASAPWriter_TwoDigitsToString(result, offset, value / 60); - result[offset + 2] = 58; - ASAPWriter_TwoDigitsToString(result, offset + 3, value % 60); - return TRUE; -} - -static void ASAPWriter_TwoDigitsToString(unsigned char *result, int offset, int value) -{ - result[offset] = 48 + value / 10; - result[offset + 1] = 48 + value % 10; -} - -cibool ASAPWriter_Write(const char *targetFilename, ByteWriter w, ASAPInfo const *info, unsigned char const *module, int moduleLen, cibool tag) -{ - int destExt = ASAPInfo_GetPackedExt(targetFilename); - switch (destExt) { - const char *possibleExt; - case 7364979: - return ASAPWriter_WriteExecutable(w, NULL, info, module, moduleLen); - case 7890296: - { - FlashPack flashPack; - ByteWriter resultWriter; - int initAndPlayer[2]; - FlashPack_Construct(&flashPack); - resultWriter = w; - - w.obj = &flashPack; - w.func = (void (*)(void *, int)) FlashPack_LoadByte; - ; - if (!ASAPWriter_WriteExecutable(w, initAndPlayer, info, module, moduleLen)) - return FALSE; - switch (info->type) { - case ASAPModuleType_SAP_D: - if (info->fastplay != 312) - return FALSE; - ASAPWriter_WriteBytes(w, CiBinaryResource_xexd_obx, 2, 117); - ASAPWriter_WriteWord(w, initAndPlayer[0]); - if (initAndPlayer[1] < 0) { - w.func(w.obj, 96); - w.func(w.obj, 96); - w.func(w.obj, 96); - } - else { - w.func(w.obj, 76); - ASAPWriter_WriteWord(w, initAndPlayer[1]); - } - w.func(w.obj, info->defaultSong); - break; - case ASAPModuleType_SAP_S: - return FALSE; - default: - ASAPWriter_WriteBytes(w, CiBinaryResource_xexb_obx, 2, 183); - ASAPWriter_WriteWord(w, initAndPlayer[0]); - w.func(w.obj, 76); - ASAPWriter_WriteWord(w, initAndPlayer[1]); - w.func(w.obj, info->defaultSong); - w.func(w.obj, info->fastplay & 1); - w.func(w.obj, (info->fastplay >> 1) % 156); - w.func(w.obj, (info->fastplay >> 1) % 131); - w.func(w.obj, info->fastplay / 312); - w.func(w.obj, info->fastplay / 262); - break; - } - if (tag) - ASAPWriter_WriteXexInfo(w, info); - ASAPWriter_WriteWord(w, 736); - ASAPWriter_WriteWord(w, 737); - ASAPWriter_WriteWord(w, tag ? 256 : 292); - return FlashPack_Compress(&flashPack, resultWriter); - } - default: - possibleExt = ASAPInfo_GetOriginalModuleExt(info, module, moduleLen); - if (possibleExt != NULL) { - int packedPossibleExt = (possibleExt[0] + (possibleExt[1] << 8) + (possibleExt[2] << 16)) | 2105376; - if (destExt == packedPossibleExt || (destExt == 3698036 && packedPossibleExt == 6516084)) { - return ASAPWriter_WriteNative(w, info, module, moduleLen); - } - } - return FALSE; - } -} - -static void ASAPWriter_WriteBytes(ByteWriter w, unsigned char const *array, int startIndex, int endIndex) -{ - while (startIndex < endIndex) - w.func(w.obj, array[startIndex++]); -} - -static void ASAPWriter_WriteCmcInit(ByteWriter w, int *initAndPlayer, ASAPInfo const *info) -{ - if (initAndPlayer == NULL) - return; - ASAPWriter_WriteWord(w, 4064); - ASAPWriter_WriteWord(w, 4080); - w.func(w.obj, 72); - w.func(w.obj, 162); - w.func(w.obj, info->music & 255); - w.func(w.obj, 160); - w.func(w.obj, info->music >> 8); - w.func(w.obj, 169); - w.func(w.obj, 112); - w.func(w.obj, 32); - ASAPWriter_WriteWord(w, initAndPlayer[1] + 3); - ASAPWriter_WritePlaTaxLda0(w); - w.func(w.obj, 76); - ASAPWriter_WriteWord(w, initAndPlayer[1] + 3); - initAndPlayer[0] = 4064; - initAndPlayer[1] += 6; -} - -static void ASAPWriter_WriteDec(ByteWriter w, int value) -{ - if (value >= 10) { - ASAPWriter_WriteDec(w, value / 10); - value %= 10; - } - w.func(w.obj, 48 + value); -} - -static void ASAPWriter_WriteDecSapTag(ByteWriter w, const char *tag, int value) -{ - ASAPWriter_WriteString(w, tag); - ASAPWriter_WriteDec(w, value); - w.func(w.obj, 13); - w.func(w.obj, 10); -} - -static cibool ASAPWriter_WriteExecutable(ByteWriter w, int *initAndPlayer, ASAPInfo const *info, unsigned char const *module, int moduleLen) -{ - unsigned char const *playerRoutine = ASAP6502_GetPlayerRoutine(info); - int player = -1; - int playerLastByte = -1; - int startAddr; - if (playerRoutine != NULL) { - player = ASAPInfo_GetWord(playerRoutine, 2); - playerLastByte = ASAPInfo_GetWord(playerRoutine, 4); - if (info->music <= playerLastByte) - return FALSE; - } - switch (info->type) { - static const int tmcPlayerOffset[4] = { 3, -9, -10, -10 }; - int player2; - static const int tmcInitOffset[4] = { -14, -16, -17, -17 }; - case ASAPModuleType_SAP_B: - ASAPWriter_WriteExecutableFromSap(w, initAndPlayer, info, 66, module, moduleLen); - break; - case ASAPModuleType_SAP_C: - ASAPWriter_WriteExecutableFromSap(w, initAndPlayer, info, 67, module, moduleLen); - ASAPWriter_WriteCmcInit(w, initAndPlayer, info); - break; - case ASAPModuleType_SAP_D: - ASAPWriter_WriteExecutableFromSap(w, initAndPlayer, info, 68, module, moduleLen); - break; - case ASAPModuleType_SAP_S: - ASAPWriter_WriteExecutableFromSap(w, initAndPlayer, info, 83, module, moduleLen); - break; - case ASAPModuleType_CMC: - case ASAPModuleType_CM3: - case ASAPModuleType_CMR: - case ASAPModuleType_CMS: - ASAPWriter_WriteExecutableHeader(w, initAndPlayer, info, 67, -1, player); - w.func(w.obj, 255); - w.func(w.obj, 255); - ASAPWriter_WriteBytes(w, module, 2, moduleLen); - ASAPWriter_WriteBytes(w, playerRoutine, 2, playerLastByte - player + 7); - ASAPWriter_WriteCmcInit(w, initAndPlayer, info); - break; - case ASAPModuleType_DLT: - startAddr = ASAPWriter_WriteExecutableHeaderForSongPos(w, initAndPlayer, info, player, 5, 7, 259); - if (moduleLen == 11270) { - ASAPWriter_WriteBytes(w, module, 0, 4); - ASAPWriter_WriteWord(w, 19456); - ASAPWriter_WriteBytes(w, module, 6, moduleLen); - w.func(w.obj, 0); - } - else - ASAPWriter_WriteBytes(w, module, 0, moduleLen); - ASAPWriter_WriteWord(w, startAddr); - ASAPWriter_WriteWord(w, playerLastByte); - if (info->songs != 1) { - ASAPWriter_WriteBytes(w, info->songPos, 0, info->songs); - w.func(w.obj, 170); - w.func(w.obj, 188); - ASAPWriter_WriteWord(w, startAddr); - } - else { - w.func(w.obj, 160); - w.func(w.obj, 0); - } - w.func(w.obj, 76); - ASAPWriter_WriteWord(w, player + 256); - ASAPWriter_WriteBytes(w, playerRoutine, 6, playerLastByte - player + 7); - break; - case ASAPModuleType_MPT: - startAddr = ASAPWriter_WriteExecutableHeaderForSongPos(w, initAndPlayer, info, player, 13, 17, 3); - ASAPWriter_WriteBytes(w, module, 0, moduleLen); - ASAPWriter_WriteWord(w, startAddr); - ASAPWriter_WriteWord(w, playerLastByte); - if (info->songs != 1) { - ASAPWriter_WriteBytes(w, info->songPos, 0, info->songs); - w.func(w.obj, 72); - } - w.func(w.obj, 160); - w.func(w.obj, info->music & 255); - w.func(w.obj, 162); - w.func(w.obj, info->music >> 8); - w.func(w.obj, 169); - w.func(w.obj, 0); - w.func(w.obj, 32); - ASAPWriter_WriteWord(w, player); - if (info->songs != 1) { - w.func(w.obj, 104); - w.func(w.obj, 168); - w.func(w.obj, 190); - ASAPWriter_WriteWord(w, startAddr); - } - else { - w.func(w.obj, 162); - w.func(w.obj, 0); - } - w.func(w.obj, 169); - w.func(w.obj, 2); - ASAPWriter_WriteBytes(w, playerRoutine, 6, playerLastByte - player + 7); - break; - case ASAPModuleType_RMT: - ASAPWriter_WriteExecutableHeader(w, initAndPlayer, info, 66, 3200, 1539); - ASAPWriter_WriteBytes(w, module, 0, ASAPInfo_GetWord(module, 4) - info->music + 7); - ASAPWriter_WriteWord(w, 3200); - if (info->songs != 1) { - ASAPWriter_WriteWord(w, 3210 + info->songs); - w.func(w.obj, 168); - w.func(w.obj, 185); - ASAPWriter_WriteWord(w, 3211); - } - else { - ASAPWriter_WriteWord(w, 3208); - w.func(w.obj, 169); - w.func(w.obj, 0); - } - w.func(w.obj, 162); - w.func(w.obj, info->music & 255); - w.func(w.obj, 160); - w.func(w.obj, info->music >> 8); - w.func(w.obj, 76); - ASAPWriter_WriteWord(w, 1536); - if (info->songs != 1) - ASAPWriter_WriteBytes(w, info->songPos, 0, info->songs); - ASAPWriter_WriteBytes(w, playerRoutine, 2, playerLastByte - player + 7); - break; - case ASAPModuleType_TMC: - player2 = player + tmcPlayerOffset[module[37] - 1]; - startAddr = player2 + tmcInitOffset[module[37] - 1]; - if (info->songs != 1) - startAddr -= 3; - ASAPWriter_WriteExecutableHeader(w, initAndPlayer, info, 66, startAddr, player2); - ASAPWriter_WriteBytes(w, module, 0, moduleLen); - ASAPWriter_WriteWord(w, startAddr); - ASAPWriter_WriteWord(w, playerLastByte); - if (info->songs != 1) - w.func(w.obj, 72); - w.func(w.obj, 160); - w.func(w.obj, info->music & 255); - w.func(w.obj, 162); - w.func(w.obj, info->music >> 8); - w.func(w.obj, 169); - w.func(w.obj, 112); - w.func(w.obj, 32); - ASAPWriter_WriteWord(w, player); - if (info->songs != 1) - ASAPWriter_WritePlaTaxLda0(w); - else { - w.func(w.obj, 169); - w.func(w.obj, 96); - } - switch (module[37]) { - case 2: - w.func(w.obj, 6); - w.func(w.obj, 0); - w.func(w.obj, 76); - ASAPWriter_WriteWord(w, player); - w.func(w.obj, 165); - w.func(w.obj, 0); - w.func(w.obj, 230); - w.func(w.obj, 0); - w.func(w.obj, 74); - w.func(w.obj, 144); - w.func(w.obj, 5); - w.func(w.obj, 176); - w.func(w.obj, 6); - break; - case 3: - case 4: - w.func(w.obj, 160); - w.func(w.obj, 1); - w.func(w.obj, 132); - w.func(w.obj, 0); - w.func(w.obj, 208); - w.func(w.obj, 10); - w.func(w.obj, 198); - w.func(w.obj, 0); - w.func(w.obj, 208); - w.func(w.obj, 12); - w.func(w.obj, 160); - w.func(w.obj, module[37]); - w.func(w.obj, 132); - w.func(w.obj, 0); - w.func(w.obj, 208); - w.func(w.obj, 3); - break; - } - ASAPWriter_WriteBytes(w, playerRoutine, 6, playerLastByte - player + 7); - break; - case ASAPModuleType_TM2: - ASAPWriter_WriteExecutableHeader(w, initAndPlayer, info, 66, 4992, 2051); - ASAPWriter_WriteBytes(w, module, 0, moduleLen); - ASAPWriter_WriteWord(w, 4992); - if (info->songs != 1) { - ASAPWriter_WriteWord(w, 5008); - w.func(w.obj, 72); - } - else - ASAPWriter_WriteWord(w, 5006); - w.func(w.obj, 160); - w.func(w.obj, info->music & 255); - w.func(w.obj, 162); - w.func(w.obj, info->music >> 8); - w.func(w.obj, 169); - w.func(w.obj, 112); - w.func(w.obj, 32); - ASAPWriter_WriteWord(w, 2048); - if (info->songs != 1) - ASAPWriter_WritePlaTaxLda0(w); - else { - w.func(w.obj, 169); - w.func(w.obj, 0); - w.func(w.obj, 170); - } - w.func(w.obj, 76); - ASAPWriter_WriteWord(w, 2048); - ASAPWriter_WriteBytes(w, playerRoutine, 2, playerLastByte - player + 7); - break; - case ASAPModuleType_FC: - ASAPWriter_WriteExecutableHeader(w, initAndPlayer, info, 66, player, player + 3); - ASAPWriter_WriteWord(w, 65535); - ASAPWriter_WriteWord(w, info->music); - ASAPWriter_WriteWord(w, info->music + moduleLen - 1); - ASAPWriter_WriteBytes(w, module, 0, moduleLen); - ASAPWriter_WriteBytes(w, playerRoutine, 2, playerLastByte - player + 7); - break; - } - return TRUE; -} - -static void ASAPWriter_WriteExecutableFromSap(ByteWriter w, int *initAndPlayer, ASAPInfo const *info, int type, unsigned char const *module, int moduleLen) -{ - ASAPWriter_WriteExecutableHeader(w, initAndPlayer, info, type, info->init, info->player); - ASAPWriter_WriteBytes(w, module, info->headerLen, moduleLen); -} - -static void ASAPWriter_WriteExecutableHeader(ByteWriter w, int *initAndPlayer, ASAPInfo const *info, int type, int init, int player) -{ - if (initAndPlayer == NULL) - ASAPWriter_WriteSapHeader(w, info, type, init, player); - else { - initAndPlayer[0] = init; - initAndPlayer[1] = player; - } -} - -static int ASAPWriter_WriteExecutableHeaderForSongPos(ByteWriter w, int *initAndPlayer, ASAPInfo const *info, int player, int codeForOneSong, int codeForManySongs, int playerOffset) -{ - if (info->songs != 1) { - ASAPWriter_WriteExecutableHeader(w, initAndPlayer, info, 66, player - codeForManySongs, player + playerOffset); - return player - codeForManySongs - info->songs; - } - ASAPWriter_WriteExecutableHeader(w, initAndPlayer, info, 66, player - codeForOneSong, player + playerOffset); - return player - codeForOneSong; -} - -static void ASAPWriter_WriteHexSapTag(ByteWriter w, const char *tag, int value) -{ - if (value < 0) - return; - ASAPWriter_WriteString(w, tag); - { - int i; - for (i = 12; i >= 0; i -= 4) { - int digit = (value >> i) & 15; - w.func(w.obj, digit + (digit < 10 ? 48 : 55)); - } - } - w.func(w.obj, 13); - w.func(w.obj, 10); -} - -static cibool ASAPWriter_WriteNative(ByteWriter w, ASAPInfo const *info, unsigned char const *module, int moduleLen) -{ - int diff; - switch (info->type) { - int offset; - int blockLen; - int music; - int patternLowAddress; - int pointersAndInstrumentsLen; - int patterns; - int songOffset; - int songEnd; - case ASAPModuleType_SAP_B: - case ASAPModuleType_SAP_C: - offset = ASAPInfo_GetRmtSapOffset(info, module, moduleLen); - if (offset > 0) { - w.func(w.obj, 255); - w.func(w.obj, 255); - ASAPWriter_WriteBytes(w, module, offset, moduleLen); - break; - } - blockLen = ASAPInfo_GetWord(module, info->headerLen + 4) - ASAPInfo_GetWord(module, info->headerLen + 2) + 7; - if (blockLen < 7 || info->headerLen + blockLen >= moduleLen) - return FALSE; - if (info->init == 1024 && info->player == 1027) - ASAPWriter_WriteBytes(w, module, info->headerLen + 6, info->headerLen + blockLen); - else - ASAPWriter_WriteBytes(w, module, info->headerLen, info->headerLen + blockLen); - break; - case ASAPModuleType_CMC: - case ASAPModuleType_CM3: - case ASAPModuleType_CMR: - case ASAPModuleType_CMS: - if ((diff = ASAPWriter_WriteNativeHeader(w, info, module)) == -1) - return FALSE; - ASAPWriter_WriteBytes(w, module, 6, 26); - ASAPWriter_WriteRelocatedLowHigh(w, diff, module, 26, 64); - ASAPWriter_WriteBytes(w, module, 154, moduleLen); - break; - case ASAPModuleType_DLT: - if ((diff = ASAPWriter_WriteNativeHeader(w, info, module)) == -1) - return FALSE; - ASAPWriter_WriteBytes(w, module, 6, moduleLen); - break; - case ASAPModuleType_MPT: - if ((diff = ASAPWriter_WriteNativeHeader(w, info, module)) == -1) - return FALSE; - ASAPWriter_WriteRelocatedWords(w, diff, module, 6, 192); - ASAPWriter_WriteBytes(w, module, 198, 454); - ASAPWriter_WriteRelocatedLowHigh(w, diff, module, 454, 4); - ASAPWriter_WriteBytes(w, module, 462, moduleLen); - break; - case ASAPModuleType_RMT: - if ((diff = ASAPWriter_WriteNativeHeader(w, info, module)) == -1) - return FALSE; - ASAPWriter_WriteBytes(w, module, 6, 14); - music = ASAPInfo_GetWord(module, 2); - patternLowAddress = ASAPInfo_GetWord(module, 16); - pointersAndInstrumentsLen = patternLowAddress - music - 8; - ASAPWriter_WriteRelocatedWords(w, diff, module, 14, pointersAndInstrumentsLen); - patterns = ASAPInfo_GetWord(module, 18) - patternLowAddress; - ASAPWriter_WriteRelocatedLowHigh(w, diff, module, 14 + pointersAndInstrumentsLen, patterns); - songOffset = 6 + ASAPInfo_GetWord(module, 20) - music; - ASAPWriter_WriteBytes(w, module, 14 + pointersAndInstrumentsLen + (patterns << 1), songOffset); - songEnd = 7 + ASAPInfo_GetWord(module, 4) - music; - while (songOffset + 3 < songEnd) { - int nextSongOffset = songOffset + module[9] - 48; - if (module[songOffset] == 254) { - w.func(w.obj, 254); - w.func(w.obj, module[songOffset + 1]); - ASAPWriter_WriteWord(w, ASAPInfo_GetWord(module, songOffset + 2) + diff); - songOffset += 4; - } - if (nextSongOffset > songEnd) - nextSongOffset = songEnd; - ASAPWriter_WriteBytes(w, module, songOffset, nextSongOffset); - songOffset = nextSongOffset; - } - ASAPWriter_WriteBytes(w, module, songOffset, songEnd); - if (moduleLen >= songEnd + 5) { - ASAPWriter_WriteRelocatedWords(w, diff, module, songEnd, 4); - ASAPWriter_WriteBytes(w, module, songEnd + 4, moduleLen); - } - break; - case ASAPModuleType_TMC: - if ((diff = ASAPWriter_WriteNativeHeader(w, info, module)) == -1) - return FALSE; - ASAPWriter_WriteBytes(w, module, 6, 38); - ASAPWriter_WriteRelocatedLowHigh(w, diff, module, 38, 64); - ASAPWriter_WriteRelocatedLowHigh(w, diff, module, 166, 128); - ASAPWriter_WriteBytes(w, module, 422, moduleLen); - break; - case ASAPModuleType_TM2: - if ((diff = ASAPWriter_WriteNativeHeader(w, info, module)) == -1) - return FALSE; - ASAPWriter_WriteBytes(w, module, 6, 134); - ASAPWriter_WriteRelocatedBytes(w, diff, module, 134, 774, 128, 0); - ASAPWriter_WriteRelocatedLowHigh(w, diff, module, 262, 256); - ASAPWriter_WriteRelocatedBytes(w, diff, module, 134, 774, 128, 8); - ASAPWriter_WriteBytes(w, module, 902, moduleLen); - break; - case ASAPModuleType_FC: - ASAPWriter_WriteBytes(w, module, 0, moduleLen); - break; - default: - return FALSE; - } - return TRUE; -} - -static int ASAPWriter_WriteNativeHeader(ByteWriter w, ASAPInfo const *info, unsigned char const *module) -{ - int diff = info->music - ASAPInfo_GetWord(module, 2); - int last = ASAPInfo_GetWord(module, 4) + diff; - if (last > 65535) - return -1; - w.func(w.obj, 255); - w.func(w.obj, 255); - ASAPWriter_WriteWord(w, info->music); - ASAPWriter_WriteWord(w, last); - return diff; -} - -static void ASAPWriter_WritePlaTaxLda0(ByteWriter w) -{ - w.func(w.obj, 104); - w.func(w.obj, 170); - w.func(w.obj, 169); - w.func(w.obj, 0); -} - -static void ASAPWriter_WriteRelocatedBytes(ByteWriter w, int diff, unsigned char const *module, int lowOffset, int highOffset, int len, int shift) -{ - { - int i; - for (i = 0; i < len; i++) { - int address = module[lowOffset + i] + (module[highOffset + i] << 8); - if (address != 0 && address != 65535) - address += diff; - w.func(w.obj, (address >> shift) & 255); - } - } -} - -static void ASAPWriter_WriteRelocatedLowHigh(ByteWriter w, int diff, unsigned char const *module, int lowOffset, int len) -{ - ASAPWriter_WriteRelocatedBytes(w, diff, module, lowOffset, lowOffset + len, len, 0); - ASAPWriter_WriteRelocatedBytes(w, diff, module, lowOffset, lowOffset + len, len, 8); -} - -static void ASAPWriter_WriteRelocatedWords(ByteWriter w, int diff, unsigned char const *module, int offset, int len) -{ - { - int i; - for (i = 0; i < len; i += 2) { - int address = module[offset + i] + (module[offset + i + 1] << 8); - if (address != 0 && address != 65535) - address += diff; - ASAPWriter_WriteWord(w, address); - } - } -} - -static void ASAPWriter_WriteSapHeader(ByteWriter w, ASAPInfo const *info, int type, int init, int player) -{ - ASAPWriter_WriteString(w, "SAP\r\n"); - ASAPWriter_WriteTextSapTag(w, "AUTHOR ", info->author); - ASAPWriter_WriteTextSapTag(w, "NAME ", info->title); - ASAPWriter_WriteTextSapTag(w, "DATE ", info->date); - if (info->songs > 1) { - ASAPWriter_WriteDecSapTag(w, "SONGS ", info->songs); - if (info->defaultSong > 0) - ASAPWriter_WriteDecSapTag(w, "DEFSONG ", info->defaultSong); - } - if (info->channels > 1) - ASAPWriter_WriteString(w, "STEREO\r\n"); - if (info->ntsc) - ASAPWriter_WriteString(w, "NTSC\r\n"); - ASAPWriter_WriteString(w, "TYPE "); - w.func(w.obj, type); - w.func(w.obj, 13); - w.func(w.obj, 10); - if (info->fastplay != 312 || info->ntsc) - ASAPWriter_WriteDecSapTag(w, "FASTPLAY ", info->fastplay); - if (type == 67) - ASAPWriter_WriteHexSapTag(w, "MUSIC ", info->music); - ASAPWriter_WriteHexSapTag(w, "INIT ", init); - ASAPWriter_WriteHexSapTag(w, "PLAYER ", player); - ASAPWriter_WriteHexSapTag(w, "COVOX ", info->covoxAddr); - { - int song; - for (song = 0; song < info->songs; song++) { - unsigned char s[9]; - if (info->durations[song] < 0) - break; - ASAPWriter_WriteString(w, "TIME "); - ASAPWriter_WriteBytes(w, s, 0, ASAPWriter_DurationToString(s, info->durations[song])); - if (info->loops[song]) - ASAPWriter_WriteString(w, " LOOP"); - w.func(w.obj, 13); - w.func(w.obj, 10); - } - } -} - -static void ASAPWriter_WriteString(ByteWriter w, const char *s) -{ - int n = (int) strlen(s); - { - int i; - for (i = 0; i < n; i++) - w.func(w.obj, s[i]); - } -} - -static void ASAPWriter_WriteTextSapTag(ByteWriter w, const char *tag, const char *value) -{ - ASAPWriter_WriteString(w, tag); - w.func(w.obj, 34); - if (value[0] == '\0') - value = ""; - ASAPWriter_WriteString(w, value); - w.func(w.obj, 34); - w.func(w.obj, 13); - w.func(w.obj, 10); -} - -static void ASAPWriter_WriteWord(ByteWriter w, int value) -{ - w.func(w.obj, value & 255); - w.func(w.obj, (value >> 8) & 255); -} - -static void ASAPWriter_WriteXexInfo(ByteWriter w, ASAPInfo const *info) -{ - unsigned char title[256]; - int titleLen = ASAPWriter_FormatXexInfoText(title, 0, 0, info->title[0] == '\0' ? "(untitled)" : info->title, FALSE); - unsigned char author[256]; - int authorLen; - unsigned char other[256]; - int otherLen; - int duration; - int totalCharacters; - int totalLines; - int otherAddress; - int titleAddress; - if (info->author[0] != '\0') { - author[0] = 98; - author[1] = 121; - author[2] = 32; - authorLen = ASAPWriter_FormatXexInfoText(author, 3, 0, info->author, TRUE); - } - else - authorLen = 0; - otherLen = ASAPWriter_FormatXexInfoText(other, 0, 19, info->date, FALSE); - otherLen = ASAPWriter_FormatXexInfoText(other, otherLen, 27, info->channels > 1 ? " STEREO" : " MONO", FALSE); - duration = info->durations[info->defaultSong]; - if (duration > 0 && ASAPWriter_SecondsToString(other, otherLen, duration + 999)) - otherLen += 5; - else - otherLen = ASAPWriter_PadXexInfo(other, otherLen, 0); - totalCharacters = titleLen + authorLen + otherLen; - totalLines = totalCharacters / 32; - otherAddress = 64592 - otherLen; - titleAddress = otherAddress - authorLen - 8 - titleLen; - ASAPWriter_WriteWord(w, titleAddress); - ASAPWriter_WriteBytes(w, CiBinaryResource_xexinfo_obx, 4, 6); - ASAPWriter_WriteBytes(w, title, 0, titleLen); - { - int i; - for (i = 0; i < 8; i++) - w.func(w.obj, 85); - } - ASAPWriter_WriteBytes(w, author, 0, authorLen); - ASAPWriter_WriteBytes(w, other, 0, otherLen); - { - int i; - for (i = totalLines; i < 26; i++) - w.func(w.obj, 112); - } - w.func(w.obj, 48); - ASAPWriter_WriteXexInfoTextDl(w, titleAddress, titleLen, titleLen - 32); - w.func(w.obj, 8); - w.func(w.obj, 0); - { - int i; - for (i = 0; i < authorLen; i += 32) - w.func(w.obj, 2); - } - w.func(w.obj, 16); - { - int i; - for (i = 0; i < otherLen; i += 32) - w.func(w.obj, 2); - } - ASAPWriter_WriteBytes(w, CiBinaryResource_xexinfo_obx, 6, 178); -} - -static void ASAPWriter_WriteXexInfoTextDl(ByteWriter w, int address, int len, int verticalScrollAt) -{ - w.func(w.obj, verticalScrollAt == 0 ? 98 : 66); - ASAPWriter_WriteWord(w, address); - { - int i; - for (i = 32; i < len; i += 32) - w.func(w.obj, i == verticalScrollAt ? 34 : 2); - } -} - -static void Cpu6502_DoFrame(Cpu6502 *self, ASAP *asap, int cycleLimit) -{ - int pc = self->pc; - int nz = self->nz; - int a = self->a; - int x = self->x; - int y = self->y; - int c = self->c; - int s = self->s; - int vdi = self->vdi; - while (asap->cycle < cycleLimit) { - int data; - static const int opcodeCycles[256] = { 7, 6, 2, 8, 3, 3, 5, 5, 3, 2, 2, 2, 4, 4, 6, 6, - 2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 7, 7, - 6, 6, 2, 8, 3, 3, 5, 5, 4, 2, 2, 2, 4, 4, 6, 6, - 2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 7, 7, - 6, 6, 2, 8, 3, 3, 5, 5, 3, 2, 2, 2, 3, 4, 6, 6, - 2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 7, 7, - 6, 6, 2, 8, 3, 3, 5, 5, 4, 2, 2, 2, 5, 4, 6, 6, - 2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 7, 7, - 2, 6, 2, 6, 3, 3, 3, 3, 2, 2, 2, 2, 4, 4, 4, 4, - 2, 6, 2, 6, 4, 4, 4, 4, 2, 5, 2, 5, 5, 5, 5, 5, - 2, 6, 2, 6, 3, 3, 3, 3, 2, 2, 2, 2, 4, 4, 4, 4, - 2, 5, 2, 5, 4, 4, 4, 4, 2, 4, 2, 4, 4, 4, 4, 4, - 2, 6, 2, 8, 3, 3, 5, 5, 2, 2, 2, 2, 4, 4, 6, 6, - 2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 7, 7, - 2, 6, 2, 8, 3, 3, 5, 5, 2, 2, 2, 2, 4, 4, 6, 6, - 2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 7, 7 }; - int addr; - if (asap->cycle >= asap->nextEventCycle) { - self->pc = pc; - self->s = s; - ASAP_HandleEvent(asap); - pc = self->pc; - s = self->s; - if ((vdi & 4) == 0 && asap->pokeys.irqst != 255) { - asap->memory[256 + s] = pc >> 8; - s = (s - 1) & 255; - asap->memory[256 + s] = (unsigned char) pc; - s = (s - 1) & 255; - asap->memory[256 + s] = ((nz | (nz >> 1)) & 128) + vdi + ((nz & 255) == 0 ? 2 : 0) + c + 32; - s = (s - 1) & 255; - vdi |= 4; - pc = asap->memory[65534] + (asap->memory[65535] << 8); - asap->cycle += 7; - } - } - data = asap->memory[pc++]; - asap->cycle += opcodeCycles[data]; - switch (data) { - case 0: - pc++; - asap->memory[256 + s] = pc >> 8; - s = (s - 1) & 255; - asap->memory[256 + s] = (unsigned char) pc; - s = (s - 1) & 255; - asap->memory[256 + s] = ((nz | (nz >> 1)) & 128) + vdi + ((nz & 255) == 0 ? 2 : 0) + c + 48; - s = (s - 1) & 255; - vdi |= 4; - pc = asap->memory[65534] + (asap->memory[65535] << 8); - break; - case 1: - addr = (asap->memory[pc++] + x) & 255; - addr = asap->memory[addr] + (asap->memory[(addr + 1) & 255] << 8); - nz = a |= (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - break; - case 2: - case 18: - case 34: - case 50: - case 66: - case 82: - case 98: - case 114: - case 146: - case 178: - case 210: - case 242: - pc--; - asap->cycle = asap->nextEventCycle; - break; - case 5: - addr = asap->memory[pc++]; - nz = a |= asap->memory[addr]; - break; - case 6: - addr = asap->memory[pc++]; - nz = asap->memory[addr]; - c = nz >> 7; - nz = (nz << 1) & 255; - asap->memory[addr] = nz; - break; - case 8: - asap->memory[256 + s] = ((nz | (nz >> 1)) & 128) + vdi + ((nz & 255) == 0 ? 2 : 0) + c + 48; - s = (s - 1) & 255; - break; - case 9: - nz = a |= asap->memory[pc++]; - break; - case 10: - c = a >> 7; - nz = a = (a << 1) & 255; - break; - case 13: - addr = asap->memory[pc++]; - addr += asap->memory[pc++] << 8; - nz = a |= (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - break; - case 14: - addr = asap->memory[pc++]; - addr += asap->memory[pc++] << 8; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - c = nz >> 7; - nz = (nz << 1) & 255; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - break; - case 16: - if (nz < 128) { - addr = (signed char) asap->memory[pc]; - pc++; - addr += pc; - if ((addr ^ pc) >> 8 != 0) - asap->cycle++; - asap->cycle++; - pc = addr; - break; - } - pc++; - break; - case 17: - addr = asap->memory[pc++]; - addr = (asap->memory[addr] + (asap->memory[(addr + 1) & 255] << 8) + y) & 65535; - if ((addr & 255) < y) - asap->cycle++; - nz = a |= (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - break; - case 21: - addr = (asap->memory[pc++] + x) & 255; - nz = a |= asap->memory[addr]; - break; - case 22: - addr = (asap->memory[pc++] + x) & 255; - nz = asap->memory[addr]; - c = nz >> 7; - nz = (nz << 1) & 255; - asap->memory[addr] = nz; - break; - case 24: - c = 0; - break; - case 25: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + y) & 65535; - if ((addr & 255) < y) - asap->cycle++; - nz = a |= (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - break; - case 29: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + x) & 65535; - if ((addr & 255) < x) - asap->cycle++; - nz = a |= (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - break; - case 30: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + x) & 65535; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - c = nz >> 7; - nz = (nz << 1) & 255; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - break; - case 32: - addr = asap->memory[pc++]; - asap->memory[256 + s] = pc >> 8; - s = (s - 1) & 255; - asap->memory[256 + s] = (unsigned char) pc; - s = (s - 1) & 255; - pc = addr + (asap->memory[pc] << 8); - break; - case 33: - addr = (asap->memory[pc++] + x) & 255; - addr = asap->memory[addr] + (asap->memory[(addr + 1) & 255] << 8); - nz = a &= (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - break; - case 36: - addr = asap->memory[pc++]; - nz = asap->memory[addr]; - vdi = (vdi & 12) + (nz & 64); - nz = ((nz & 128) << 1) + (nz & a); - break; - case 37: - addr = asap->memory[pc++]; - nz = a &= asap->memory[addr]; - break; - case 38: - addr = asap->memory[pc++]; - nz = asap->memory[addr]; - nz = (nz << 1) + c; - c = nz >> 8; - nz &= 255; - asap->memory[addr] = nz; - break; - case 40: - s = (s + 1) & 255; - vdi = asap->memory[256 + s]; - nz = ((vdi & 128) << 1) + (~vdi & 2); - c = vdi & 1; - vdi &= 76; - if ((vdi & 4) == 0 && asap->pokeys.irqst != 255) { - asap->memory[256 + s] = pc >> 8; - s = (s - 1) & 255; - asap->memory[256 + s] = (unsigned char) pc; - s = (s - 1) & 255; - asap->memory[256 + s] = ((nz | (nz >> 1)) & 128) + vdi + ((nz & 255) == 0 ? 2 : 0) + c + 32; - s = (s - 1) & 255; - vdi |= 4; - pc = asap->memory[65534] + (asap->memory[65535] << 8); - asap->cycle += 7; - } - break; - case 41: - nz = a &= asap->memory[pc++]; - break; - case 42: - a = (a << 1) + c; - c = a >> 8; - nz = a &= 255; - break; - case 44: - addr = asap->memory[pc++]; - addr += asap->memory[pc++] << 8; - nz = (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - vdi = (vdi & 12) + (nz & 64); - nz = ((nz & 128) << 1) + (nz & a); - break; - case 45: - addr = asap->memory[pc++]; - addr += asap->memory[pc++] << 8; - nz = a &= (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - break; - case 46: - addr = asap->memory[pc++]; - addr += asap->memory[pc++] << 8; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - nz = (nz << 1) + c; - c = nz >> 8; - nz &= 255; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - break; - case 48: - if (nz >= 128) { - addr = (signed char) asap->memory[pc]; - pc++; - addr += pc; - if ((addr ^ pc) >> 8 != 0) - asap->cycle++; - asap->cycle++; - pc = addr; - break; - } - pc++; - break; - case 49: - addr = asap->memory[pc++]; - addr = (asap->memory[addr] + (asap->memory[(addr + 1) & 255] << 8) + y) & 65535; - if ((addr & 255) < y) - asap->cycle++; - nz = a &= (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - break; - case 53: - addr = (asap->memory[pc++] + x) & 255; - nz = a &= asap->memory[addr]; - break; - case 54: - addr = (asap->memory[pc++] + x) & 255; - nz = asap->memory[addr]; - nz = (nz << 1) + c; - c = nz >> 8; - nz &= 255; - asap->memory[addr] = nz; - break; - case 56: - c = 1; - break; - case 57: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + y) & 65535; - if ((addr & 255) < y) - asap->cycle++; - nz = a &= (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - break; - case 61: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + x) & 65535; - if ((addr & 255) < x) - asap->cycle++; - nz = a &= (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - break; - case 62: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + x) & 65535; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - nz = (nz << 1) + c; - c = nz >> 8; - nz &= 255; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - break; - case 64: - s = (s + 1) & 255; - vdi = asap->memory[256 + s]; - nz = ((vdi & 128) << 1) + (~vdi & 2); - c = vdi & 1; - vdi &= 76; - s = (s + 1) & 255; - pc = asap->memory[256 + s]; - s = (s + 1) & 255; - addr = asap->memory[256 + s]; - pc += addr << 8; - if ((vdi & 4) == 0 && asap->pokeys.irqst != 255) { - asap->memory[256 + s] = pc >> 8; - s = (s - 1) & 255; - asap->memory[256 + s] = (unsigned char) pc; - s = (s - 1) & 255; - asap->memory[256 + s] = ((nz | (nz >> 1)) & 128) + vdi + ((nz & 255) == 0 ? 2 : 0) + c + 32; - s = (s - 1) & 255; - vdi |= 4; - pc = asap->memory[65534] + (asap->memory[65535] << 8); - asap->cycle += 7; - } - break; - case 65: - addr = (asap->memory[pc++] + x) & 255; - addr = asap->memory[addr] + (asap->memory[(addr + 1) & 255] << 8); - nz = a ^= (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - break; - case 69: - addr = asap->memory[pc++]; - nz = a ^= asap->memory[addr]; - break; - case 70: - addr = asap->memory[pc++]; - nz = asap->memory[addr]; - c = nz & 1; - nz >>= 1; - asap->memory[addr] = nz; - break; - case 72: - asap->memory[256 + s] = a; - s = (s - 1) & 255; - break; - case 73: - nz = a ^= asap->memory[pc++]; - break; - case 74: - c = a & 1; - nz = a >>= 1; - break; - case 76: - addr = asap->memory[pc++]; - pc = addr + (asap->memory[pc] << 8); - break; - case 77: - addr = asap->memory[pc++]; - addr += asap->memory[pc++] << 8; - nz = a ^= (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - break; - case 78: - addr = asap->memory[pc++]; - addr += asap->memory[pc++] << 8; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - c = nz & 1; - nz >>= 1; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - break; - case 80: - if ((vdi & 64) == 0) { - addr = (signed char) asap->memory[pc]; - pc++; - addr += pc; - if ((addr ^ pc) >> 8 != 0) - asap->cycle++; - asap->cycle++; - pc = addr; - break; - } - pc++; - break; - case 81: - addr = asap->memory[pc++]; - addr = (asap->memory[addr] + (asap->memory[(addr + 1) & 255] << 8) + y) & 65535; - if ((addr & 255) < y) - asap->cycle++; - nz = a ^= (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - break; - case 85: - addr = (asap->memory[pc++] + x) & 255; - nz = a ^= asap->memory[addr]; - break; - case 86: - addr = (asap->memory[pc++] + x) & 255; - nz = asap->memory[addr]; - c = nz & 1; - nz >>= 1; - asap->memory[addr] = nz; - break; - case 88: - vdi &= 72; - if ((vdi & 4) == 0 && asap->pokeys.irqst != 255) { - asap->memory[256 + s] = pc >> 8; - s = (s - 1) & 255; - asap->memory[256 + s] = (unsigned char) pc; - s = (s - 1) & 255; - asap->memory[256 + s] = ((nz | (nz >> 1)) & 128) + vdi + ((nz & 255) == 0 ? 2 : 0) + c + 32; - s = (s - 1) & 255; - vdi |= 4; - pc = asap->memory[65534] + (asap->memory[65535] << 8); - asap->cycle += 7; - } - break; - case 89: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + y) & 65535; - if ((addr & 255) < y) - asap->cycle++; - nz = a ^= (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - break; - case 93: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + x) & 65535; - if ((addr & 255) < x) - asap->cycle++; - nz = a ^= (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - break; - case 94: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + x) & 65535; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - c = nz & 1; - nz >>= 1; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - break; - case 96: - s = (s + 1) & 255; - pc = asap->memory[256 + s]; - s = (s + 1) & 255; - addr = asap->memory[256 + s]; - pc += (addr << 8) + 1; - break; - case 97: - addr = (asap->memory[pc++] + x) & 255; - addr = asap->memory[addr] + (asap->memory[(addr + 1) & 255] << 8); - data = (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - { - int tmp = a + data + c; - nz = tmp & 255; - if ((vdi & 8) == 0) { - vdi = (vdi & 12) + (((~(data ^ a) & (a ^ tmp)) >> 1) & 64); - c = tmp >> 8; - a = nz; - } - else { - int al = (a & 15) + (data & 15) + c; - if (al >= 10) { - tmp += al < 26 ? 6 : -10; - if (nz != 0) - nz = (tmp & 128) + 1; - } - vdi = (vdi & 12) + (((~(data ^ a) & (a ^ tmp)) >> 1) & 64); - if (tmp >= 160) { - c = 1; - a = (tmp + 96) & 255; - } - else { - c = 0; - a = tmp; - } - } - } - break; - case 101: - addr = asap->memory[pc++]; - data = asap->memory[addr]; - { - int tmp = a + data + c; - nz = tmp & 255; - if ((vdi & 8) == 0) { - vdi = (vdi & 12) + (((~(data ^ a) & (a ^ tmp)) >> 1) & 64); - c = tmp >> 8; - a = nz; - } - else { - int al = (a & 15) + (data & 15) + c; - if (al >= 10) { - tmp += al < 26 ? 6 : -10; - if (nz != 0) - nz = (tmp & 128) + 1; - } - vdi = (vdi & 12) + (((~(data ^ a) & (a ^ tmp)) >> 1) & 64); - if (tmp >= 160) { - c = 1; - a = (tmp + 96) & 255; - } - else { - c = 0; - a = tmp; - } - } - } - break; - case 102: - addr = asap->memory[pc++]; - nz = asap->memory[addr] + (c << 8); - c = nz & 1; - nz >>= 1; - asap->memory[addr] = nz; - break; - case 104: - s = (s + 1) & 255; - a = asap->memory[256 + s]; - nz = a; - break; - case 105: - data = asap->memory[pc++]; - { - int tmp = a + data + c; - nz = tmp & 255; - if ((vdi & 8) == 0) { - vdi = (vdi & 12) + (((~(data ^ a) & (a ^ tmp)) >> 1) & 64); - c = tmp >> 8; - a = nz; - } - else { - int al = (a & 15) + (data & 15) + c; - if (al >= 10) { - tmp += al < 26 ? 6 : -10; - if (nz != 0) - nz = (tmp & 128) + 1; - } - vdi = (vdi & 12) + (((~(data ^ a) & (a ^ tmp)) >> 1) & 64); - if (tmp >= 160) { - c = 1; - a = (tmp + 96) & 255; - } - else { - c = 0; - a = tmp; - } - } - } - break; - case 106: - nz = (c << 7) + (a >> 1); - c = a & 1; - a = nz; - break; - case 108: - addr = asap->memory[pc++]; - addr += asap->memory[pc++] << 8; - if ((addr & 255) == 255) - pc = asap->memory[addr] + (asap->memory[addr - 255] << 8); - else - pc = asap->memory[addr] + (asap->memory[addr + 1] << 8); - break; - case 109: - addr = asap->memory[pc++]; - addr += asap->memory[pc++] << 8; - data = (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - { - int tmp = a + data + c; - nz = tmp & 255; - if ((vdi & 8) == 0) { - vdi = (vdi & 12) + (((~(data ^ a) & (a ^ tmp)) >> 1) & 64); - c = tmp >> 8; - a = nz; - } - else { - int al = (a & 15) + (data & 15) + c; - if (al >= 10) { - tmp += al < 26 ? 6 : -10; - if (nz != 0) - nz = (tmp & 128) + 1; - } - vdi = (vdi & 12) + (((~(data ^ a) & (a ^ tmp)) >> 1) & 64); - if (tmp >= 160) { - c = 1; - a = (tmp + 96) & 255; - } - else { - c = 0; - a = tmp; - } - } - } - break; - case 110: - addr = asap->memory[pc++]; - addr += asap->memory[pc++] << 8; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - nz += c << 8; - c = nz & 1; - nz >>= 1; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - break; - case 112: - if ((vdi & 64) != 0) { - addr = (signed char) asap->memory[pc]; - pc++; - addr += pc; - if ((addr ^ pc) >> 8 != 0) - asap->cycle++; - asap->cycle++; - pc = addr; - break; - } - pc++; - break; - case 113: - addr = asap->memory[pc++]; - addr = (asap->memory[addr] + (asap->memory[(addr + 1) & 255] << 8) + y) & 65535; - if ((addr & 255) < y) - asap->cycle++; - data = (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - { - int tmp = a + data + c; - nz = tmp & 255; - if ((vdi & 8) == 0) { - vdi = (vdi & 12) + (((~(data ^ a) & (a ^ tmp)) >> 1) & 64); - c = tmp >> 8; - a = nz; - } - else { - int al = (a & 15) + (data & 15) + c; - if (al >= 10) { - tmp += al < 26 ? 6 : -10; - if (nz != 0) - nz = (tmp & 128) + 1; - } - vdi = (vdi & 12) + (((~(data ^ a) & (a ^ tmp)) >> 1) & 64); - if (tmp >= 160) { - c = 1; - a = (tmp + 96) & 255; - } - else { - c = 0; - a = tmp; - } - } - } - break; - case 117: - addr = (asap->memory[pc++] + x) & 255; - data = asap->memory[addr]; - { - int tmp = a + data + c; - nz = tmp & 255; - if ((vdi & 8) == 0) { - vdi = (vdi & 12) + (((~(data ^ a) & (a ^ tmp)) >> 1) & 64); - c = tmp >> 8; - a = nz; - } - else { - int al = (a & 15) + (data & 15) + c; - if (al >= 10) { - tmp += al < 26 ? 6 : -10; - if (nz != 0) - nz = (tmp & 128) + 1; - } - vdi = (vdi & 12) + (((~(data ^ a) & (a ^ tmp)) >> 1) & 64); - if (tmp >= 160) { - c = 1; - a = (tmp + 96) & 255; - } - else { - c = 0; - a = tmp; - } - } - } - break; - case 118: - addr = (asap->memory[pc++] + x) & 255; - nz = asap->memory[addr] + (c << 8); - c = nz & 1; - nz >>= 1; - asap->memory[addr] = nz; - break; - case 120: - vdi |= 4; - break; - case 121: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + y) & 65535; - if ((addr & 255) < y) - asap->cycle++; - data = (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - { - int tmp = a + data + c; - nz = tmp & 255; - if ((vdi & 8) == 0) { - vdi = (vdi & 12) + (((~(data ^ a) & (a ^ tmp)) >> 1) & 64); - c = tmp >> 8; - a = nz; - } - else { - int al = (a & 15) + (data & 15) + c; - if (al >= 10) { - tmp += al < 26 ? 6 : -10; - if (nz != 0) - nz = (tmp & 128) + 1; - } - vdi = (vdi & 12) + (((~(data ^ a) & (a ^ tmp)) >> 1) & 64); - if (tmp >= 160) { - c = 1; - a = (tmp + 96) & 255; - } - else { - c = 0; - a = tmp; - } - } - } - break; - case 125: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + x) & 65535; - if ((addr & 255) < x) - asap->cycle++; - data = (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - { - int tmp = a + data + c; - nz = tmp & 255; - if ((vdi & 8) == 0) { - vdi = (vdi & 12) + (((~(data ^ a) & (a ^ tmp)) >> 1) & 64); - c = tmp >> 8; - a = nz; - } - else { - int al = (a & 15) + (data & 15) + c; - if (al >= 10) { - tmp += al < 26 ? 6 : -10; - if (nz != 0) - nz = (tmp & 128) + 1; - } - vdi = (vdi & 12) + (((~(data ^ a) & (a ^ tmp)) >> 1) & 64); - if (tmp >= 160) { - c = 1; - a = (tmp + 96) & 255; - } - else { - c = 0; - a = tmp; - } - } - } - break; - case 126: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + x) & 65535; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - nz += c << 8; - c = nz & 1; - nz >>= 1; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - break; - case 129: - addr = (asap->memory[pc++] + x) & 255; - addr = asap->memory[addr] + (asap->memory[(addr + 1) & 255] << 8); - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, a); - else - asap->memory[addr] = a; - break; - case 132: - addr = asap->memory[pc++]; - asap->memory[addr] = y; - break; - case 133: - addr = asap->memory[pc++]; - asap->memory[addr] = a; - break; - case 134: - addr = asap->memory[pc++]; - asap->memory[addr] = x; - break; - case 136: - nz = y = (y - 1) & 255; - break; - case 138: - nz = a = x; - break; - case 140: - addr = asap->memory[pc++]; - addr += asap->memory[pc++] << 8; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, y); - else - asap->memory[addr] = y; - break; - case 141: - addr = asap->memory[pc++]; - addr += asap->memory[pc++] << 8; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, a); - else - asap->memory[addr] = a; - break; - case 142: - addr = asap->memory[pc++]; - addr += asap->memory[pc++] << 8; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, x); - else - asap->memory[addr] = x; - break; - case 144: - if (c == 0) { - addr = (signed char) asap->memory[pc]; - pc++; - addr += pc; - if ((addr ^ pc) >> 8 != 0) - asap->cycle++; - asap->cycle++; - pc = addr; - break; - } - pc++; - break; - case 145: - addr = asap->memory[pc++]; - addr = (asap->memory[addr] + (asap->memory[(addr + 1) & 255] << 8) + y) & 65535; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, a); - else - asap->memory[addr] = a; - break; - case 148: - addr = (asap->memory[pc++] + x) & 255; - asap->memory[addr] = y; - break; - case 149: - addr = (asap->memory[pc++] + x) & 255; - asap->memory[addr] = a; - break; - case 150: - addr = (asap->memory[pc++] + y) & 255; - asap->memory[addr] = x; - break; - case 152: - nz = a = y; - break; - case 153: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + y) & 65535; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, a); - else - asap->memory[addr] = a; - break; - case 154: - s = x; - break; - case 157: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + x) & 65535; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, a); - else - asap->memory[addr] = a; - break; - case 160: - nz = y = asap->memory[pc++]; - break; - case 161: - addr = (asap->memory[pc++] + x) & 255; - addr = asap->memory[addr] + (asap->memory[(addr + 1) & 255] << 8); - nz = a = (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - break; - case 162: - nz = x = asap->memory[pc++]; - break; - case 164: - addr = asap->memory[pc++]; - nz = y = asap->memory[addr]; - break; - case 165: - addr = asap->memory[pc++]; - nz = a = asap->memory[addr]; - break; - case 166: - addr = asap->memory[pc++]; - nz = x = asap->memory[addr]; - break; - case 168: - nz = y = a; - break; - case 169: - nz = a = asap->memory[pc++]; - break; - case 170: - nz = x = a; - break; - case 172: - addr = asap->memory[pc++]; - addr += asap->memory[pc++] << 8; - nz = y = (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - break; - case 173: - addr = asap->memory[pc++]; - addr += asap->memory[pc++] << 8; - nz = a = (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - break; - case 174: - addr = asap->memory[pc++]; - addr += asap->memory[pc++] << 8; - nz = x = (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - break; - case 176: - if (c != 0) { - addr = (signed char) asap->memory[pc]; - pc++; - addr += pc; - if ((addr ^ pc) >> 8 != 0) - asap->cycle++; - asap->cycle++; - pc = addr; - break; - } - pc++; - break; - case 177: - addr = asap->memory[pc++]; - addr = (asap->memory[addr] + (asap->memory[(addr + 1) & 255] << 8) + y) & 65535; - if ((addr & 255) < y) - asap->cycle++; - nz = a = (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - break; - case 180: - addr = (asap->memory[pc++] + x) & 255; - nz = y = asap->memory[addr]; - break; - case 181: - addr = (asap->memory[pc++] + x) & 255; - nz = a = asap->memory[addr]; - break; - case 182: - addr = (asap->memory[pc++] + y) & 255; - nz = x = asap->memory[addr]; - break; - case 184: - vdi &= 12; - break; - case 185: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + y) & 65535; - if ((addr & 255) < y) - asap->cycle++; - nz = a = (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - break; - case 186: - nz = x = s; - break; - case 188: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + x) & 65535; - if ((addr & 255) < x) - asap->cycle++; - nz = y = (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - break; - case 189: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + x) & 65535; - if ((addr & 255) < x) - asap->cycle++; - nz = a = (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - break; - case 190: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + y) & 65535; - if ((addr & 255) < y) - asap->cycle++; - nz = x = (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - break; - case 192: - nz = asap->memory[pc++]; - c = y >= nz ? 1 : 0; - nz = (y - nz) & 255; - break; - case 193: - addr = (asap->memory[pc++] + x) & 255; - addr = asap->memory[addr] + (asap->memory[(addr + 1) & 255] << 8); - nz = (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - c = a >= nz ? 1 : 0; - nz = (a - nz) & 255; - break; - case 196: - addr = asap->memory[pc++]; - nz = asap->memory[addr]; - c = y >= nz ? 1 : 0; - nz = (y - nz) & 255; - break; - case 197: - addr = asap->memory[pc++]; - nz = asap->memory[addr]; - c = a >= nz ? 1 : 0; - nz = (a - nz) & 255; - break; - case 198: - addr = asap->memory[pc++]; - nz = asap->memory[addr]; - nz = (nz - 1) & 255; - asap->memory[addr] = nz; - break; - case 200: - nz = y = (y + 1) & 255; - break; - case 201: - nz = asap->memory[pc++]; - c = a >= nz ? 1 : 0; - nz = (a - nz) & 255; - break; - case 202: - nz = x = (x - 1) & 255; - break; - case 204: - addr = asap->memory[pc++]; - addr += asap->memory[pc++] << 8; - nz = (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - c = y >= nz ? 1 : 0; - nz = (y - nz) & 255; - break; - case 205: - addr = asap->memory[pc++]; - addr += asap->memory[pc++] << 8; - nz = (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - c = a >= nz ? 1 : 0; - nz = (a - nz) & 255; - break; - case 206: - addr = asap->memory[pc++]; - addr += asap->memory[pc++] << 8; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - nz = (nz - 1) & 255; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - break; - case 208: - if ((nz & 255) != 0) { - addr = (signed char) asap->memory[pc]; - pc++; - addr += pc; - if ((addr ^ pc) >> 8 != 0) - asap->cycle++; - asap->cycle++; - pc = addr; - break; - } - pc++; - break; - case 209: - addr = asap->memory[pc++]; - addr = (asap->memory[addr] + (asap->memory[(addr + 1) & 255] << 8) + y) & 65535; - if ((addr & 255) < y) - asap->cycle++; - nz = (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - c = a >= nz ? 1 : 0; - nz = (a - nz) & 255; - break; - case 213: - addr = (asap->memory[pc++] + x) & 255; - nz = asap->memory[addr]; - c = a >= nz ? 1 : 0; - nz = (a - nz) & 255; - break; - case 214: - addr = (asap->memory[pc++] + x) & 255; - nz = asap->memory[addr]; - nz = (nz - 1) & 255; - asap->memory[addr] = nz; - break; - case 216: - vdi &= 68; - break; - case 217: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + y) & 65535; - if ((addr & 255) < y) - asap->cycle++; - nz = (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - c = a >= nz ? 1 : 0; - nz = (a - nz) & 255; - break; - case 221: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + x) & 65535; - if ((addr & 255) < x) - asap->cycle++; - nz = (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - c = a >= nz ? 1 : 0; - nz = (a - nz) & 255; - break; - case 222: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + x) & 65535; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - nz = (nz - 1) & 255; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - break; - case 224: - nz = asap->memory[pc++]; - c = x >= nz ? 1 : 0; - nz = (x - nz) & 255; - break; - case 225: - addr = (asap->memory[pc++] + x) & 255; - addr = asap->memory[addr] + (asap->memory[(addr + 1) & 255] << 8); - data = (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - { - int tmp = a - data - 1 + c; - int al = (a & 15) - (data & 15) - 1 + c; - vdi = (vdi & 12) + ((((data ^ a) & (a ^ tmp)) >> 1) & 64); - c = tmp >= 0 ? 1 : 0; - nz = a = tmp & 255; - if ((vdi & 8) != 0) { - if (al < 0) - a += al < -10 ? 10 : -6; - if (c == 0) - a = (a - 96) & 255; - } - } - break; - case 228: - addr = asap->memory[pc++]; - nz = asap->memory[addr]; - c = x >= nz ? 1 : 0; - nz = (x - nz) & 255; - break; - case 229: - addr = asap->memory[pc++]; - data = asap->memory[addr]; - { - int tmp = a - data - 1 + c; - int al = (a & 15) - (data & 15) - 1 + c; - vdi = (vdi & 12) + ((((data ^ a) & (a ^ tmp)) >> 1) & 64); - c = tmp >= 0 ? 1 : 0; - nz = a = tmp & 255; - if ((vdi & 8) != 0) { - if (al < 0) - a += al < -10 ? 10 : -6; - if (c == 0) - a = (a - 96) & 255; - } - } - break; - case 230: - addr = asap->memory[pc++]; - nz = asap->memory[addr]; - nz = (nz + 1) & 255; - asap->memory[addr] = nz; - break; - case 232: - nz = x = (x + 1) & 255; - break; - case 233: - case 235: - data = asap->memory[pc++]; - { - int tmp = a - data - 1 + c; - int al = (a & 15) - (data & 15) - 1 + c; - vdi = (vdi & 12) + ((((data ^ a) & (a ^ tmp)) >> 1) & 64); - c = tmp >= 0 ? 1 : 0; - nz = a = tmp & 255; - if ((vdi & 8) != 0) { - if (al < 0) - a += al < -10 ? 10 : -6; - if (c == 0) - a = (a - 96) & 255; - } - } - break; - case 234: - case 26: - case 58: - case 90: - case 122: - case 218: - case 250: - break; - case 236: - addr = asap->memory[pc++]; - addr += asap->memory[pc++] << 8; - nz = (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - c = x >= nz ? 1 : 0; - nz = (x - nz) & 255; - break; - case 237: - addr = asap->memory[pc++]; - addr += asap->memory[pc++] << 8; - data = (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - { - int tmp = a - data - 1 + c; - int al = (a & 15) - (data & 15) - 1 + c; - vdi = (vdi & 12) + ((((data ^ a) & (a ^ tmp)) >> 1) & 64); - c = tmp >= 0 ? 1 : 0; - nz = a = tmp & 255; - if ((vdi & 8) != 0) { - if (al < 0) - a += al < -10 ? 10 : -6; - if (c == 0) - a = (a - 96) & 255; - } - } - break; - case 238: - addr = asap->memory[pc++]; - addr += asap->memory[pc++] << 8; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - nz = (nz + 1) & 255; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - break; - case 240: - if ((nz & 255) == 0) { - addr = (signed char) asap->memory[pc]; - pc++; - addr += pc; - if ((addr ^ pc) >> 8 != 0) - asap->cycle++; - asap->cycle++; - pc = addr; - break; - } - pc++; - break; - case 241: - addr = asap->memory[pc++]; - addr = (asap->memory[addr] + (asap->memory[(addr + 1) & 255] << 8) + y) & 65535; - if ((addr & 255) < y) - asap->cycle++; - data = (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - { - int tmp = a - data - 1 + c; - int al = (a & 15) - (data & 15) - 1 + c; - vdi = (vdi & 12) + ((((data ^ a) & (a ^ tmp)) >> 1) & 64); - c = tmp >= 0 ? 1 : 0; - nz = a = tmp & 255; - if ((vdi & 8) != 0) { - if (al < 0) - a += al < -10 ? 10 : -6; - if (c == 0) - a = (a - 96) & 255; - } - } - break; - case 245: - addr = (asap->memory[pc++] + x) & 255; - data = asap->memory[addr]; - { - int tmp = a - data - 1 + c; - int al = (a & 15) - (data & 15) - 1 + c; - vdi = (vdi & 12) + ((((data ^ a) & (a ^ tmp)) >> 1) & 64); - c = tmp >= 0 ? 1 : 0; - nz = a = tmp & 255; - if ((vdi & 8) != 0) { - if (al < 0) - a += al < -10 ? 10 : -6; - if (c == 0) - a = (a - 96) & 255; - } - } - break; - case 246: - addr = (asap->memory[pc++] + x) & 255; - nz = asap->memory[addr]; - nz = (nz + 1) & 255; - asap->memory[addr] = nz; - break; - case 248: - vdi |= 8; - break; - case 249: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + y) & 65535; - if ((addr & 255) < y) - asap->cycle++; - data = (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - { - int tmp = a - data - 1 + c; - int al = (a & 15) - (data & 15) - 1 + c; - vdi = (vdi & 12) + ((((data ^ a) & (a ^ tmp)) >> 1) & 64); - c = tmp >= 0 ? 1 : 0; - nz = a = tmp & 255; - if ((vdi & 8) != 0) { - if (al < 0) - a += al < -10 ? 10 : -6; - if (c == 0) - a = (a - 96) & 255; - } - } - break; - case 253: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + x) & 65535; - if ((addr & 255) < x) - asap->cycle++; - data = (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - { - int tmp = a - data - 1 + c; - int al = (a & 15) - (data & 15) - 1 + c; - vdi = (vdi & 12) + ((((data ^ a) & (a ^ tmp)) >> 1) & 64); - c = tmp >= 0 ? 1 : 0; - nz = a = tmp & 255; - if ((vdi & 8) != 0) { - if (al < 0) - a += al < -10 ? 10 : -6; - if (c == 0) - a = (a - 96) & 255; - } - } - break; - case 254: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + x) & 65535; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - nz = (nz + 1) & 255; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - break; - case 3: - addr = (asap->memory[pc++] + x) & 255; - addr = asap->memory[addr] + (asap->memory[(addr + 1) & 255] << 8); - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - c = nz >> 7; - nz = (nz << 1) & 255; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - nz = a |= nz; - break; - case 4: - case 68: - case 100: - case 20: - case 52: - case 84: - case 116: - case 212: - case 244: - case 128: - case 130: - case 137: - case 194: - case 226: - pc++; - break; - case 7: - addr = asap->memory[pc++]; - nz = asap->memory[addr]; - c = nz >> 7; - nz = (nz << 1) & 255; - asap->memory[addr] = nz; - nz = a |= nz; - break; - case 11: - case 43: - nz = a &= asap->memory[pc++]; - c = nz >> 7; - break; - case 12: - pc += 2; - break; - case 15: - addr = asap->memory[pc++]; - addr += asap->memory[pc++] << 8; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - c = nz >> 7; - nz = (nz << 1) & 255; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - nz = a |= nz; - break; - case 19: - addr = asap->memory[pc++]; - addr = (asap->memory[addr] + (asap->memory[(addr + 1) & 255] << 8) + y) & 65535; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - c = nz >> 7; - nz = (nz << 1) & 255; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - nz = a |= nz; - break; - case 23: - addr = (asap->memory[pc++] + x) & 255; - nz = asap->memory[addr]; - c = nz >> 7; - nz = (nz << 1) & 255; - asap->memory[addr] = nz; - nz = a |= nz; - break; - case 27: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + y) & 65535; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - c = nz >> 7; - nz = (nz << 1) & 255; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - nz = a |= nz; - break; - case 28: - case 60: - case 92: - case 124: - case 220: - case 252: - if (asap->memory[pc++] + x >= 256) - asap->cycle++; - pc++; - break; - case 31: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + x) & 65535; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - c = nz >> 7; - nz = (nz << 1) & 255; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - nz = a |= nz; - break; - case 35: - addr = (asap->memory[pc++] + x) & 255; - addr = asap->memory[addr] + (asap->memory[(addr + 1) & 255] << 8); - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - nz = (nz << 1) + c; - c = nz >> 8; - nz &= 255; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - nz = a &= nz; - break; - case 39: - addr = asap->memory[pc++]; - nz = asap->memory[addr]; - nz = (nz << 1) + c; - c = nz >> 8; - nz &= 255; - asap->memory[addr] = nz; - nz = a &= nz; - break; - case 47: - addr = asap->memory[pc++]; - addr += asap->memory[pc++] << 8; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - nz = (nz << 1) + c; - c = nz >> 8; - nz &= 255; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - nz = a &= nz; - break; - case 51: - addr = asap->memory[pc++]; - addr = (asap->memory[addr] + (asap->memory[(addr + 1) & 255] << 8) + y) & 65535; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - nz = (nz << 1) + c; - c = nz >> 8; - nz &= 255; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - nz = a &= nz; - break; - case 55: - addr = (asap->memory[pc++] + x) & 255; - nz = asap->memory[addr]; - nz = (nz << 1) + c; - c = nz >> 8; - nz &= 255; - asap->memory[addr] = nz; - nz = a &= nz; - break; - case 59: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + y) & 65535; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - nz = (nz << 1) + c; - c = nz >> 8; - nz &= 255; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - nz = a &= nz; - break; - case 63: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + x) & 65535; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - nz = (nz << 1) + c; - c = nz >> 8; - nz &= 255; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - nz = a &= nz; - break; - case 67: - addr = (asap->memory[pc++] + x) & 255; - addr = asap->memory[addr] + (asap->memory[(addr + 1) & 255] << 8); - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - c = nz & 1; - nz >>= 1; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - nz = a ^= nz; - break; - case 71: - addr = asap->memory[pc++]; - nz = asap->memory[addr]; - c = nz & 1; - nz >>= 1; - asap->memory[addr] = nz; - nz = a ^= nz; - break; - case 75: - a &= asap->memory[pc++]; - c = a & 1; - nz = a >>= 1; - break; - case 79: - addr = asap->memory[pc++]; - addr += asap->memory[pc++] << 8; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - c = nz & 1; - nz >>= 1; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - nz = a ^= nz; - break; - case 83: - addr = asap->memory[pc++]; - addr = (asap->memory[addr] + (asap->memory[(addr + 1) & 255] << 8) + y) & 65535; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - c = nz & 1; - nz >>= 1; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - nz = a ^= nz; - break; - case 87: - addr = (asap->memory[pc++] + x) & 255; - nz = asap->memory[addr]; - c = nz & 1; - nz >>= 1; - asap->memory[addr] = nz; - nz = a ^= nz; - break; - case 91: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + y) & 65535; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - c = nz & 1; - nz >>= 1; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - nz = a ^= nz; - break; - case 95: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + x) & 65535; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - c = nz & 1; - nz >>= 1; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - nz = a ^= nz; - break; - case 99: - addr = (asap->memory[pc++] + x) & 255; - addr = asap->memory[addr] + (asap->memory[(addr + 1) & 255] << 8); - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - nz += c << 8; - c = nz & 1; - nz >>= 1; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - data = nz; - { - int tmp = a + data + c; - nz = tmp & 255; - if ((vdi & 8) == 0) { - vdi = (vdi & 12) + (((~(data ^ a) & (a ^ tmp)) >> 1) & 64); - c = tmp >> 8; - a = nz; - } - else { - int al = (a & 15) + (data & 15) + c; - if (al >= 10) { - tmp += al < 26 ? 6 : -10; - if (nz != 0) - nz = (tmp & 128) + 1; - } - vdi = (vdi & 12) + (((~(data ^ a) & (a ^ tmp)) >> 1) & 64); - if (tmp >= 160) { - c = 1; - a = (tmp + 96) & 255; - } - else { - c = 0; - a = tmp; - } - } - } - break; - case 103: - addr = asap->memory[pc++]; - nz = asap->memory[addr] + (c << 8); - c = nz & 1; - nz >>= 1; - asap->memory[addr] = nz; - data = nz; - { - int tmp = a + data + c; - nz = tmp & 255; - if ((vdi & 8) == 0) { - vdi = (vdi & 12) + (((~(data ^ a) & (a ^ tmp)) >> 1) & 64); - c = tmp >> 8; - a = nz; - } - else { - int al = (a & 15) + (data & 15) + c; - if (al >= 10) { - tmp += al < 26 ? 6 : -10; - if (nz != 0) - nz = (tmp & 128) + 1; - } - vdi = (vdi & 12) + (((~(data ^ a) & (a ^ tmp)) >> 1) & 64); - if (tmp >= 160) { - c = 1; - a = (tmp + 96) & 255; - } - else { - c = 0; - a = tmp; - } - } - } - break; - case 107: - data = a & asap->memory[pc++]; - nz = a = (data >> 1) + (c << 7); - vdi = (vdi & 12) + ((a ^ data) & 64); - if ((vdi & 8) == 0) - c = data >> 7; - else { - if ((data & 15) >= 5) - a = (a & 240) + ((a + 6) & 15); - if (data >= 80) { - a = (a + 96) & 255; - c = 1; - } - else - c = 0; - } - break; - case 111: - addr = asap->memory[pc++]; - addr += asap->memory[pc++] << 8; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - nz += c << 8; - c = nz & 1; - nz >>= 1; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - data = nz; - { - int tmp = a + data + c; - nz = tmp & 255; - if ((vdi & 8) == 0) { - vdi = (vdi & 12) + (((~(data ^ a) & (a ^ tmp)) >> 1) & 64); - c = tmp >> 8; - a = nz; - } - else { - int al = (a & 15) + (data & 15) + c; - if (al >= 10) { - tmp += al < 26 ? 6 : -10; - if (nz != 0) - nz = (tmp & 128) + 1; - } - vdi = (vdi & 12) + (((~(data ^ a) & (a ^ tmp)) >> 1) & 64); - if (tmp >= 160) { - c = 1; - a = (tmp + 96) & 255; - } - else { - c = 0; - a = tmp; - } - } - } - break; - case 115: - addr = asap->memory[pc++]; - addr = (asap->memory[addr] + (asap->memory[(addr + 1) & 255] << 8) + y) & 65535; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - nz += c << 8; - c = nz & 1; - nz >>= 1; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - data = nz; - { - int tmp = a + data + c; - nz = tmp & 255; - if ((vdi & 8) == 0) { - vdi = (vdi & 12) + (((~(data ^ a) & (a ^ tmp)) >> 1) & 64); - c = tmp >> 8; - a = nz; - } - else { - int al = (a & 15) + (data & 15) + c; - if (al >= 10) { - tmp += al < 26 ? 6 : -10; - if (nz != 0) - nz = (tmp & 128) + 1; - } - vdi = (vdi & 12) + (((~(data ^ a) & (a ^ tmp)) >> 1) & 64); - if (tmp >= 160) { - c = 1; - a = (tmp + 96) & 255; - } - else { - c = 0; - a = tmp; - } - } - } - break; - case 119: - addr = (asap->memory[pc++] + x) & 255; - nz = asap->memory[addr] + (c << 8); - c = nz & 1; - nz >>= 1; - asap->memory[addr] = nz; - data = nz; - { - int tmp = a + data + c; - nz = tmp & 255; - if ((vdi & 8) == 0) { - vdi = (vdi & 12) + (((~(data ^ a) & (a ^ tmp)) >> 1) & 64); - c = tmp >> 8; - a = nz; - } - else { - int al = (a & 15) + (data & 15) + c; - if (al >= 10) { - tmp += al < 26 ? 6 : -10; - if (nz != 0) - nz = (tmp & 128) + 1; - } - vdi = (vdi & 12) + (((~(data ^ a) & (a ^ tmp)) >> 1) & 64); - if (tmp >= 160) { - c = 1; - a = (tmp + 96) & 255; - } - else { - c = 0; - a = tmp; - } - } - } - break; - case 123: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + y) & 65535; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - nz += c << 8; - c = nz & 1; - nz >>= 1; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - data = nz; - { - int tmp = a + data + c; - nz = tmp & 255; - if ((vdi & 8) == 0) { - vdi = (vdi & 12) + (((~(data ^ a) & (a ^ tmp)) >> 1) & 64); - c = tmp >> 8; - a = nz; - } - else { - int al = (a & 15) + (data & 15) + c; - if (al >= 10) { - tmp += al < 26 ? 6 : -10; - if (nz != 0) - nz = (tmp & 128) + 1; - } - vdi = (vdi & 12) + (((~(data ^ a) & (a ^ tmp)) >> 1) & 64); - if (tmp >= 160) { - c = 1; - a = (tmp + 96) & 255; - } - else { - c = 0; - a = tmp; - } - } - } - break; - case 127: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + x) & 65535; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - nz += c << 8; - c = nz & 1; - nz >>= 1; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - data = nz; - { - int tmp = a + data + c; - nz = tmp & 255; - if ((vdi & 8) == 0) { - vdi = (vdi & 12) + (((~(data ^ a) & (a ^ tmp)) >> 1) & 64); - c = tmp >> 8; - a = nz; - } - else { - int al = (a & 15) + (data & 15) + c; - if (al >= 10) { - tmp += al < 26 ? 6 : -10; - if (nz != 0) - nz = (tmp & 128) + 1; - } - vdi = (vdi & 12) + (((~(data ^ a) & (a ^ tmp)) >> 1) & 64); - if (tmp >= 160) { - c = 1; - a = (tmp + 96) & 255; - } - else { - c = 0; - a = tmp; - } - } - } - break; - case 131: - addr = (asap->memory[pc++] + x) & 255; - addr = asap->memory[addr] + (asap->memory[(addr + 1) & 255] << 8); - data = a & x; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, data); - else - asap->memory[addr] = data; - break; - case 135: - addr = asap->memory[pc++]; - data = a & x; - asap->memory[addr] = data; - break; - case 139: - data = asap->memory[pc++]; - a &= (data | 239) & x; - nz = a & data; - break; - case 143: - addr = asap->memory[pc++]; - addr += asap->memory[pc++] << 8; - data = a & x; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, data); - else - asap->memory[addr] = data; - break; - case 147: - { - int hi; - addr = asap->memory[pc++]; - hi = asap->memory[(addr + 1) & 255]; - addr = asap->memory[addr]; - data = (hi + 1) & a & x; - addr += y; - if (addr >= 256) - hi = data - 1; - addr += hi << 8; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, data); - else - asap->memory[addr] = data; - } - break; - case 151: - addr = (asap->memory[pc++] + y) & 255; - data = a & x; - asap->memory[addr] = data; - break; - case 155: - s = a & x; - { - int hi; - addr = asap->memory[pc++]; - hi = asap->memory[pc++]; - data = (hi + 1) & s; - addr += y; - if (addr >= 256) - hi = data - 1; - addr += hi << 8; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, data); - else - asap->memory[addr] = data; - } - break; - case 156: - { - int hi; - addr = asap->memory[pc++]; - hi = asap->memory[pc++]; - data = (hi + 1) & y; - addr += x; - if (addr >= 256) - hi = data - 1; - addr += hi << 8; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, data); - else - asap->memory[addr] = data; - } - break; - case 158: - { - int hi; - addr = asap->memory[pc++]; - hi = asap->memory[pc++]; - data = (hi + 1) & x; - addr += y; - if (addr >= 256) - hi = data - 1; - addr += hi << 8; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, data); - else - asap->memory[addr] = data; - } - break; - case 159: - { - int hi; - addr = asap->memory[pc++]; - hi = asap->memory[pc++]; - data = (hi + 1) & a & x; - addr += y; - if (addr >= 256) - hi = data - 1; - addr += hi << 8; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, data); - else - asap->memory[addr] = data; - } - break; - case 163: - addr = (asap->memory[pc++] + x) & 255; - addr = asap->memory[addr] + (asap->memory[(addr + 1) & 255] << 8); - nz = x = a = (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - break; - case 167: - addr = asap->memory[pc++]; - nz = x = a = asap->memory[addr]; - break; - case 171: - nz = x = a &= asap->memory[pc++]; - break; - case 175: - addr = asap->memory[pc++]; - addr += asap->memory[pc++] << 8; - nz = x = a = (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - break; - case 179: - addr = asap->memory[pc++]; - addr = (asap->memory[addr] + (asap->memory[(addr + 1) & 255] << 8) + y) & 65535; - if ((addr & 255) < y) - asap->cycle++; - nz = x = a = (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - break; - case 183: - addr = (asap->memory[pc++] + y) & 255; - nz = x = a = asap->memory[addr]; - break; - case 187: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + y) & 65535; - if ((addr & 255) < y) - asap->cycle++; - nz = x = a = s &= (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - break; - case 191: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + y) & 65535; - if ((addr & 255) < y) - asap->cycle++; - nz = x = a = (addr & 63744) == 53248 ? ASAP_PeekHardware(asap, addr) : asap->memory[addr]; - break; - case 195: - addr = (asap->memory[pc++] + x) & 255; - addr = asap->memory[addr] + (asap->memory[(addr + 1) & 255] << 8); - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - nz = (nz - 1) & 255; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - c = a >= nz ? 1 : 0; - nz = (a - nz) & 255; - break; - case 199: - addr = asap->memory[pc++]; - nz = asap->memory[addr]; - nz = (nz - 1) & 255; - asap->memory[addr] = nz; - c = a >= nz ? 1 : 0; - nz = (a - nz) & 255; - break; - case 203: - nz = asap->memory[pc++]; - x &= a; - c = x >= nz ? 1 : 0; - nz = x = (x - nz) & 255; - break; - case 207: - addr = asap->memory[pc++]; - addr += asap->memory[pc++] << 8; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - nz = (nz - 1) & 255; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - c = a >= nz ? 1 : 0; - nz = (a - nz) & 255; - break; - case 211: - addr = asap->memory[pc++]; - addr = (asap->memory[addr] + (asap->memory[(addr + 1) & 255] << 8) + y) & 65535; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - nz = (nz - 1) & 255; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - c = a >= nz ? 1 : 0; - nz = (a - nz) & 255; - break; - case 215: - addr = (asap->memory[pc++] + x) & 255; - nz = asap->memory[addr]; - nz = (nz - 1) & 255; - asap->memory[addr] = nz; - c = a >= nz ? 1 : 0; - nz = (a - nz) & 255; - break; - case 219: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + y) & 65535; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - nz = (nz - 1) & 255; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - c = a >= nz ? 1 : 0; - nz = (a - nz) & 255; - break; - case 223: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + x) & 65535; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - nz = (nz - 1) & 255; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - c = a >= nz ? 1 : 0; - nz = (a - nz) & 255; - break; - case 227: - addr = (asap->memory[pc++] + x) & 255; - addr = asap->memory[addr] + (asap->memory[(addr + 1) & 255] << 8); - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - nz = (nz + 1) & 255; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - data = nz; - { - int tmp = a - data - 1 + c; - int al = (a & 15) - (data & 15) - 1 + c; - vdi = (vdi & 12) + ((((data ^ a) & (a ^ tmp)) >> 1) & 64); - c = tmp >= 0 ? 1 : 0; - nz = a = tmp & 255; - if ((vdi & 8) != 0) { - if (al < 0) - a += al < -10 ? 10 : -6; - if (c == 0) - a = (a - 96) & 255; - } - } - break; - case 231: - addr = asap->memory[pc++]; - nz = asap->memory[addr]; - nz = (nz + 1) & 255; - asap->memory[addr] = nz; - data = nz; - { - int tmp = a - data - 1 + c; - int al = (a & 15) - (data & 15) - 1 + c; - vdi = (vdi & 12) + ((((data ^ a) & (a ^ tmp)) >> 1) & 64); - c = tmp >= 0 ? 1 : 0; - nz = a = tmp & 255; - if ((vdi & 8) != 0) { - if (al < 0) - a += al < -10 ? 10 : -6; - if (c == 0) - a = (a - 96) & 255; - } - } - break; - case 239: - addr = asap->memory[pc++]; - addr += asap->memory[pc++] << 8; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - nz = (nz + 1) & 255; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - data = nz; - { - int tmp = a - data - 1 + c; - int al = (a & 15) - (data & 15) - 1 + c; - vdi = (vdi & 12) + ((((data ^ a) & (a ^ tmp)) >> 1) & 64); - c = tmp >= 0 ? 1 : 0; - nz = a = tmp & 255; - if ((vdi & 8) != 0) { - if (al < 0) - a += al < -10 ? 10 : -6; - if (c == 0) - a = (a - 96) & 255; - } - } - break; - case 243: - addr = asap->memory[pc++]; - addr = (asap->memory[addr] + (asap->memory[(addr + 1) & 255] << 8) + y) & 65535; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - nz = (nz + 1) & 255; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - data = nz; - { - int tmp = a - data - 1 + c; - int al = (a & 15) - (data & 15) - 1 + c; - vdi = (vdi & 12) + ((((data ^ a) & (a ^ tmp)) >> 1) & 64); - c = tmp >= 0 ? 1 : 0; - nz = a = tmp & 255; - if ((vdi & 8) != 0) { - if (al < 0) - a += al < -10 ? 10 : -6; - if (c == 0) - a = (a - 96) & 255; - } - } - break; - case 247: - addr = (asap->memory[pc++] + x) & 255; - nz = asap->memory[addr]; - nz = (nz + 1) & 255; - asap->memory[addr] = nz; - data = nz; - { - int tmp = a - data - 1 + c; - int al = (a & 15) - (data & 15) - 1 + c; - vdi = (vdi & 12) + ((((data ^ a) & (a ^ tmp)) >> 1) & 64); - c = tmp >= 0 ? 1 : 0; - nz = a = tmp & 255; - if ((vdi & 8) != 0) { - if (al < 0) - a += al < -10 ? 10 : -6; - if (c == 0) - a = (a - 96) & 255; - } - } - break; - case 251: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + y) & 65535; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - nz = (nz + 1) & 255; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - data = nz; - { - int tmp = a - data - 1 + c; - int al = (a & 15) - (data & 15) - 1 + c; - vdi = (vdi & 12) + ((((data ^ a) & (a ^ tmp)) >> 1) & 64); - c = tmp >= 0 ? 1 : 0; - nz = a = tmp & 255; - if ((vdi & 8) != 0) { - if (al < 0) - a += al < -10 ? 10 : -6; - if (c == 0) - a = (a - 96) & 255; - } - } - break; - case 255: - addr = asap->memory[pc++]; - addr = (addr + (asap->memory[pc++] << 8) + x) & 65535; - if (addr >> 8 == 210) { - asap->cycle--; - nz = ASAP_PeekHardware(asap, addr); - ASAP_PokeHardware(asap, addr, nz); - asap->cycle++; - } - else - nz = asap->memory[addr]; - nz = (nz + 1) & 255; - if ((addr & 63744) == 53248) - ASAP_PokeHardware(asap, addr, nz); - else - asap->memory[addr] = nz; - data = nz; - { - int tmp = a - data - 1 + c; - int al = (a & 15) - (data & 15) - 1 + c; - vdi = (vdi & 12) + ((((data ^ a) & (a ^ tmp)) >> 1) & 64); - c = tmp >= 0 ? 1 : 0; - nz = a = tmp & 255; - if ((vdi & 8) != 0) { - if (al < 0) - a += al < -10 ? 10 : -6; - if (c == 0) - a = (a - 96) & 255; - } - } - break; - } - } - self->pc = pc; - self->nz = nz; - self->a = a; - self->x = x; - self->y = y; - self->c = c; - self->s = s; - self->vdi = vdi; -} - -static void FlashPack_Construct(FlashPack *self) -{ - { - int i; - for (i = 0; i < 65536; i++) - self->memory[i] = -1; - } - self->loadState = FlashPackLoadState_START_LOW_BYTE; -} - -static cibool FlashPack_Compress(FlashPack *self, ByteWriter w) -{ - int runAddress; - int depackerEndAddress; - int depackerStartAddress; - int compressedStartAddress; - if (self->memory[252] >= 0 || self->memory[253] >= 0 || self->memory[254] >= 0 || self->memory[255] >= 0) - return FALSE; - runAddress = self->memory[736] + (self->memory[737] << 8); - self->memory[736] = self->memory[737] = -1; - if ((depackerEndAddress = FlashPack_FindHole(self)) == -1) - return FALSE; - self->compressedLength = 0; - self->itemsCount = 0; - FlashPack_PutPoke(self, 54286, 0); - FlashPack_PutPoke(self, 53774, 0); - FlashPack_PutPoke(self, 54272, 0); - FlashPack_PutPoke(self, 54017, 254); - FlashPack_PutPoke(self, 580, 255); - FlashPack_CompressMemoryArea(self, depackerEndAddress, 65535); - FlashPack_CompressMemoryArea(self, 0, depackerEndAddress); - FlashPack_PutItem(self, FlashPackItemType_END_OF_STREAM, 0); - FlashPack_PutItems(self); - depackerStartAddress = depackerEndAddress - 87; - compressedStartAddress = depackerStartAddress - self->compressedLength; - if (compressedStartAddress < 8192) - return FALSE; - w.func(w.obj, 255); - w.func(w.obj, 255); - ASAPWriter_WriteWord(w, 54017); - ASAPWriter_WriteWord(w, 54017); - w.func(w.obj, 255); - ASAPWriter_WriteWord(w, compressedStartAddress); - ASAPWriter_WriteWord(w, depackerEndAddress); - ASAPWriter_WriteBytes(w, self->compressed, 0, self->compressedLength); - w.func(w.obj, 173); - ASAPWriter_WriteWord(w, compressedStartAddress); - w.func(w.obj, 238); - ASAPWriter_WriteWord(w, depackerStartAddress + 1); - w.func(w.obj, 208); - w.func(w.obj, 3); - w.func(w.obj, 238); - ASAPWriter_WriteWord(w, depackerStartAddress + 2); - w.func(w.obj, 96); - w.func(w.obj, 76); - ASAPWriter_WriteWord(w, runAddress); - w.func(w.obj, 133); - w.func(w.obj, 254); - w.func(w.obj, 138); - w.func(w.obj, 42); - w.func(w.obj, 170); - w.func(w.obj, 240); - w.func(w.obj, 246); - w.func(w.obj, 177); - w.func(w.obj, 254); - w.func(w.obj, 153); - w.func(w.obj, 128); - w.func(w.obj, 128); - w.func(w.obj, 200); - w.func(w.obj, 208); - w.func(w.obj, 9); - w.func(w.obj, 152); - w.func(w.obj, 56); - w.func(w.obj, 101); - w.func(w.obj, 255); - w.func(w.obj, 133); - w.func(w.obj, 255); - w.func(w.obj, 141); - ASAPWriter_WriteWord(w, depackerStartAddress + 26); - w.func(w.obj, 202); - w.func(w.obj, 208); - w.func(w.obj, 236); - w.func(w.obj, 6); - w.func(w.obj, 253); - w.func(w.obj, 208); - w.func(w.obj, 21); - w.func(w.obj, 6); - w.func(w.obj, 252); - w.func(w.obj, 208); - w.func(w.obj, 7); - w.func(w.obj, 56); - w.func(w.obj, 32); - ASAPWriter_WriteWord(w, depackerStartAddress); - w.func(w.obj, 42); - w.func(w.obj, 133); - w.func(w.obj, 252); - w.func(w.obj, 169); - w.func(w.obj, 1); - w.func(w.obj, 144); - w.func(w.obj, 4); - w.func(w.obj, 32); - ASAPWriter_WriteWord(w, depackerStartAddress); - w.func(w.obj, 42); - w.func(w.obj, 133); - w.func(w.obj, 253); - w.func(w.obj, 32); - ASAPWriter_WriteWord(w, depackerStartAddress); - w.func(w.obj, 162); - w.func(w.obj, 1); - w.func(w.obj, 144); - w.func(w.obj, 206); - w.func(w.obj, 74); - w.func(w.obj, 208); - w.func(w.obj, 194); - w.func(w.obj, 32); - ASAPWriter_WriteWord(w, depackerStartAddress); - w.func(w.obj, 176); - w.func(w.obj, 193); - w.func(w.obj, 168); - w.func(w.obj, 32); - ASAPWriter_WriteWord(w, depackerStartAddress); - w.func(w.obj, 144); - w.func(w.obj, 202); - ASAPWriter_WriteWord(w, 736); - ASAPWriter_WriteWord(w, 737); - ASAPWriter_WriteWord(w, depackerStartAddress + 50); - return TRUE; -} - -static void FlashPack_CompressMemoryArea(FlashPack *self, int startAddress, int endAddress) -{ - int lastDistance = -1; - { - int address; - for (address = startAddress; address <= endAddress;) { - while (self->memory[address] < 0) - if (++address > endAddress) - return; - FlashPack_PutItem(self, FlashPackItemType_SET_ADDRESS, address); - while (address <= endAddress && self->memory[address] >= 0) { - int bestMatch = 0; - int bestDistance = -1; - { - int backAddress; - for (backAddress = address - 1; backAddress >= startAddress && address - backAddress < 128; backAddress--) { - int match; - for (match = 0; address + match <= endAddress; match++) { - int data = self->memory[address + match]; - if (data < 0 || data != self->memory[backAddress + match]) - break; - } - if (bestMatch < match) { - bestMatch = match; - bestDistance = address - backAddress; - } - else if (bestMatch == match && address - backAddress == lastDistance) - bestDistance = lastDistance; - } - } - switch (bestMatch) { - int length; - case 0: - case 1: - FlashPack_PutItem(self, FlashPackItemType_LITERAL, self->memory[address++]); - continue; - case 2: - FlashPack_PutItem(self, FlashPackItemType_COPY_TWO_BYTES, bestDistance); - break; - case 3: - FlashPack_PutItem(self, FlashPackItemType_COPY_THREE_BYTES, bestDistance); - break; - case 4: - if (bestDistance == lastDistance) - FlashPack_PutItem(self, FlashPackItemType_COPY_MANY_BYTES, 4); - else if (FlashPack_IsLiteralPreferred(self)) { - FlashPack_PutItem(self, FlashPackItemType_LITERAL, self->memory[address]); - FlashPack_PutItem(self, FlashPackItemType_COPY_THREE_BYTES, bestDistance); - } - else { - FlashPack_PutItem(self, FlashPackItemType_COPY_THREE_BYTES, bestDistance); - FlashPack_PutItem(self, FlashPackItemType_LITERAL, self->memory[address + 3]); - } - break; - case 5: - if (bestDistance == lastDistance) - FlashPack_PutItem(self, FlashPackItemType_COPY_MANY_BYTES, 5); - else { - FlashPack_PutItem(self, FlashPackItemType_COPY_THREE_BYTES, bestDistance); - FlashPack_PutItem(self, FlashPackItemType_COPY_TWO_BYTES, bestDistance); - } - break; - case 6: - if (bestDistance == lastDistance) - FlashPack_PutItem(self, FlashPackItemType_COPY_MANY_BYTES, 6); - else { - FlashPack_PutItem(self, FlashPackItemType_COPY_THREE_BYTES, bestDistance); - FlashPack_PutItem(self, FlashPackItemType_COPY_THREE_BYTES, bestDistance); - } - break; - default: - length = bestMatch; - if (bestDistance != lastDistance) { - if (FlashPack_IsLiteralPreferred(self) && length % 255 == 4) { - FlashPack_PutItem(self, FlashPackItemType_LITERAL, self->memory[address]); - length--; - } - FlashPack_PutItem(self, FlashPackItemType_COPY_THREE_BYTES, bestDistance); - length -= 3; - } - else if (FlashPack_IsLiteralPreferred(self) && length % 255 == 1) { - FlashPack_PutItem(self, FlashPackItemType_LITERAL, self->memory[address]); - length--; - } - for (; length > 255; length -= 255) - FlashPack_PutItem(self, FlashPackItemType_COPY_MANY_BYTES, 255); - switch (length) { - case 0: - break; - case 1: - FlashPack_PutItem(self, FlashPackItemType_LITERAL, self->memory[address + bestMatch - 1]); - break; - case 2: - FlashPack_PutItem(self, FlashPackItemType_COPY_TWO_BYTES, bestDistance); - break; - case 3: - FlashPack_PutItem(self, FlashPackItemType_COPY_THREE_BYTES, bestDistance); - break; - default: - FlashPack_PutItem(self, FlashPackItemType_COPY_MANY_BYTES, length); - break; - } - break; - } - address += bestMatch; - lastDistance = bestDistance; - } - } - } -} - -static int FlashPack_FindHole(FlashPack const *self) -{ - int end = 48159; - for (;;) { - int start; - while (self->memory[end] >= 0) - if (--end < 9216) - return -1; - start = end; - while (self->memory[--start] < 0) - if (end - start >= 1023) - return end; - end = start; - } -} - -static int FlashPack_GetInnerFlags(FlashPack const *self, int index) -{ - int flags = 1; - do { - flags <<= 1; - if (index < self->itemsCount && self->items[index++].type != FlashPackItemType_LITERAL) - flags++; - } - while (flags < 256); - return flags & 255; -} - -static cibool FlashPack_IsLiteralPreferred(FlashPack const *self) -{ - return (self->itemsCount & 7) == 7 && FlashPack_GetInnerFlags(self, self->itemsCount - 7) == 0; -} - -static void FlashPack_LoadByte(FlashPack *self, int data) -{ - switch (self->loadState) { - case FlashPackLoadState_START_LOW_BYTE: - self->loadAddress = data; - self->loadState = FlashPackLoadState_START_HIGH_BYTE; - break; - case FlashPackLoadState_START_HIGH_BYTE: - self->loadAddress += data << 8; - self->loadState = self->loadAddress == 65535 ? FlashPackLoadState_START_LOW_BYTE : FlashPackLoadState_END_LOW_BYTE; - break; - case FlashPackLoadState_END_LOW_BYTE: - self->loadEndAddress = data; - self->loadState = FlashPackLoadState_END_HIGH_BYTE; - break; - case FlashPackLoadState_END_HIGH_BYTE: - self->loadEndAddress += data << 8; - self->loadState = FlashPackLoadState_CONTENT; - break; - case FlashPackLoadState_CONTENT: - self->memory[self->loadAddress] = data; - if (self->loadAddress == self->loadEndAddress) - self->loadState = FlashPackLoadState_START_LOW_BYTE; - else - self->loadAddress = (self->loadAddress + 1) & 65535; - break; - } -} - -static void FlashPack_PutItem(FlashPack *self, FlashPackItemType type, int value) -{ - if (self->itemsCount >= 64) { - FlashPack_PutItems(self); - self->itemsCount = 0; - } - self->items[self->itemsCount].type = type; - self->items[self->itemsCount].value = value; - self->itemsCount++; -} - -static void FlashPack_PutItems(FlashPack *self) -{ - int outerFlags = 0; - { - int i; - for (i = 0; i < self->itemsCount; i += 8) { - if (FlashPack_GetInnerFlags(self, i) != 0) - outerFlags |= 128 >> (i >> 3); - } - } - self->compressed[self->compressedLength++] = outerFlags; - { - int i; - for (i = 0; i < self->itemsCount; i++) { - if ((i & 7) == 0) { - int flags = FlashPack_GetInnerFlags(self, i); - if (flags != 0) - self->compressed[self->compressedLength++] = flags; - } - self->compressedLength += FlashPackItem_WriteValueTo(&self->items[i], self->compressed, self->compressedLength); - } - } -} - -static void FlashPack_PutPoke(FlashPack *self, int address, int value) -{ - FlashPack_PutItem(self, FlashPackItemType_SET_ADDRESS, address); - FlashPack_PutItem(self, FlashPackItemType_LITERAL, value); -} - -static int FlashPackItem_WriteValueTo(FlashPackItem const *self, unsigned char *buffer, int index) -{ - switch (self->type) { - int value; - case FlashPackItemType_LITERAL: - buffer[index] = self->value; - return 1; - case FlashPackItemType_COPY_TWO_BYTES: - buffer[index] = (128 - self->value) << 1; - return 1; - case FlashPackItemType_COPY_THREE_BYTES: - buffer[index] = ((128 - self->value) << 1) + 1; - return 1; - case FlashPackItemType_COPY_MANY_BYTES: - buffer[index] = 1; - buffer[index + 1] = self->value; - return 2; - case FlashPackItemType_SET_ADDRESS: - value = self->value - 128; - buffer[index] = 0; - buffer[index + 1] = (unsigned char) value; - buffer[index + 2] = value >> 8; - return 3; - default: - buffer[index] = 1; - buffer[index + 1] = 0; - return 2; - } -} - -static void Pokey_AddDelta(Pokey *self, PokeyPair const *pokeys, int cycle, int delta) -{ - int i = cycle * pokeys->sampleFactor + pokeys->sampleOffset; - int delta2 = (delta >> 16) * ((i >> 4) & 65535); - i >>= 20; - self->deltaBuffer[i] += delta - delta2; - self->deltaBuffer[i + 1] += delta2; -} - -static void Pokey_EndFrame(Pokey *self, PokeyPair const *pokeys, int cycle) -{ - int m; - Pokey_GenerateUntilCycle(self, pokeys, cycle); - self->polyIndex += cycle; - m = (self->audctl & 128) != 0 ? 237615 : 60948015; - if (self->polyIndex >= 2 * m) - self->polyIndex -= m; - if (self->tickCycle1 != 8388608) - self->tickCycle1 -= cycle; - if (self->tickCycle2 != 8388608) - self->tickCycle2 -= cycle; - if (self->tickCycle3 != 8388608) - self->tickCycle3 -= cycle; - if (self->tickCycle4 != 8388608) - self->tickCycle4 -= cycle; -} - -static void Pokey_GenerateUntilCycle(Pokey *self, PokeyPair const *pokeys, int cycleLimit) -{ - for (;;) { - int cycle = cycleLimit; - static const unsigned char poly4Lookup[15] = { 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1 }; - static const unsigned char poly5Lookup[31] = { 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, - 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1 }; - if (cycle > self->tickCycle1) - cycle = self->tickCycle1; - if (cycle > self->tickCycle2) - cycle = self->tickCycle2; - if (cycle > self->tickCycle3) - cycle = self->tickCycle3; - if (cycle > self->tickCycle4) - cycle = self->tickCycle4; - if (cycle == cycleLimit) - break; - if (cycle == self->tickCycle3) { - self->tickCycle3 += self->periodCycles3; - if ((self->audctl & 4) != 0 && self->delta1 > 0 && self->mute1 == 0) { - self->delta1 = -self->delta1; - Pokey_AddDelta(self, pokeys, cycle, self->delta1); - } - if (self->init) { - switch (self->audc3 >> 4) { - case 10: - case 14: - self->out3 ^= 1; - self->delta3 = -self->delta3; - Pokey_AddDelta(self, pokeys, cycle, self->delta3); - break; - default: - break; - } - } - else { - int poly = cycle + self->polyIndex - 2; - int newOut = self->out3; - switch (self->audc3 >> 4) { - case 0: - if (poly5Lookup[poly % 31] != 0) { - if ((self->audctl & 128) != 0) - newOut = pokeys->poly9Lookup[poly % 511] & 1; - else { - poly %= 131071; - newOut = (pokeys->poly17Lookup[poly >> 3] >> (poly & 7)) & 1; - } - } - break; - case 2: - case 6: - newOut ^= poly5Lookup[poly % 31]; - break; - case 4: - if (poly5Lookup[poly % 31] != 0) - newOut = poly4Lookup[poly % 15]; - break; - case 8: - if ((self->audctl & 128) != 0) - newOut = pokeys->poly9Lookup[poly % 511] & 1; - else { - poly %= 131071; - newOut = (pokeys->poly17Lookup[poly >> 3] >> (poly & 7)) & 1; - } - break; - case 10: - case 14: - newOut ^= 1; - break; - case 12: - newOut = poly4Lookup[poly % 15]; - break; - default: - break; - } - if (newOut != self->out3) { - self->out3 = newOut; - self->delta3 = -self->delta3; - Pokey_AddDelta(self, pokeys, cycle, self->delta3); - } - } - } - if (cycle == self->tickCycle4) { - self->tickCycle4 += self->periodCycles4; - if ((self->audctl & 8) != 0) - self->tickCycle3 = cycle + self->reloadCycles3; - if ((self->audctl & 2) != 0 && self->delta2 > 0 && self->mute2 == 0) { - self->delta2 = -self->delta2; - Pokey_AddDelta(self, pokeys, cycle, self->delta2); - } - if (self->init) { - switch (self->audc4 >> 4) { - case 10: - case 14: - self->out4 ^= 1; - self->delta4 = -self->delta4; - Pokey_AddDelta(self, pokeys, cycle, self->delta4); - break; - default: - break; - } - } - else { - int poly = cycle + self->polyIndex - 3; - int newOut = self->out4; - switch (self->audc4 >> 4) { - case 0: - if (poly5Lookup[poly % 31] != 0) { - if ((self->audctl & 128) != 0) - newOut = pokeys->poly9Lookup[poly % 511] & 1; - else { - poly %= 131071; - newOut = (pokeys->poly17Lookup[poly >> 3] >> (poly & 7)) & 1; - } - } - break; - case 2: - case 6: - newOut ^= poly5Lookup[poly % 31]; - break; - case 4: - if (poly5Lookup[poly % 31] != 0) - newOut = poly4Lookup[poly % 15]; - break; - case 8: - if ((self->audctl & 128) != 0) - newOut = pokeys->poly9Lookup[poly % 511] & 1; - else { - poly %= 131071; - newOut = (pokeys->poly17Lookup[poly >> 3] >> (poly & 7)) & 1; - } - break; - case 10: - case 14: - newOut ^= 1; - break; - case 12: - newOut = poly4Lookup[poly % 15]; - break; - default: - break; - } - if (newOut != self->out4) { - self->out4 = newOut; - self->delta4 = -self->delta4; - Pokey_AddDelta(self, pokeys, cycle, self->delta4); - } - } - } - if (cycle == self->tickCycle1) { - self->tickCycle1 += self->periodCycles1; - if ((self->skctl & 136) == 8) - self->tickCycle2 = cycle + self->periodCycles2; - if (self->init) { - switch (self->audc1 >> 4) { - case 10: - case 14: - self->out1 ^= 1; - self->delta1 = -self->delta1; - Pokey_AddDelta(self, pokeys, cycle, self->delta1); - break; - default: - break; - } - } - else { - int poly = cycle + self->polyIndex - 0; - int newOut = self->out1; - switch (self->audc1 >> 4) { - case 0: - if (poly5Lookup[poly % 31] != 0) { - if ((self->audctl & 128) != 0) - newOut = pokeys->poly9Lookup[poly % 511] & 1; - else { - poly %= 131071; - newOut = (pokeys->poly17Lookup[poly >> 3] >> (poly & 7)) & 1; - } - } - break; - case 2: - case 6: - newOut ^= poly5Lookup[poly % 31]; - break; - case 4: - if (poly5Lookup[poly % 31] != 0) - newOut = poly4Lookup[poly % 15]; - break; - case 8: - if ((self->audctl & 128) != 0) - newOut = pokeys->poly9Lookup[poly % 511] & 1; - else { - poly %= 131071; - newOut = (pokeys->poly17Lookup[poly >> 3] >> (poly & 7)) & 1; - } - break; - case 10: - case 14: - newOut ^= 1; - break; - case 12: - newOut = poly4Lookup[poly % 15]; - break; - default: - break; - } - if (newOut != self->out1) { - self->out1 = newOut; - self->delta1 = -self->delta1; - Pokey_AddDelta(self, pokeys, cycle, self->delta1); - } - } - } - if (cycle == self->tickCycle2) { - self->tickCycle2 += self->periodCycles2; - if ((self->audctl & 16) != 0) - self->tickCycle1 = cycle + self->reloadCycles1; - else if ((self->skctl & 8) != 0) - self->tickCycle1 = cycle + self->periodCycles1; - if (self->init) { - switch (self->audc2 >> 4) { - case 10: - case 14: - self->out2 ^= 1; - self->delta2 = -self->delta2; - Pokey_AddDelta(self, pokeys, cycle, self->delta2); - break; - default: - break; - } - } - else { - int poly = cycle + self->polyIndex - 1; - int newOut = self->out2; - switch (self->audc2 >> 4) { - case 0: - if (poly5Lookup[poly % 31] != 0) { - if ((self->audctl & 128) != 0) - newOut = pokeys->poly9Lookup[poly % 511] & 1; - else { - poly %= 131071; - newOut = (pokeys->poly17Lookup[poly >> 3] >> (poly & 7)) & 1; - } - } - break; - case 2: - case 6: - newOut ^= poly5Lookup[poly % 31]; - break; - case 4: - if (poly5Lookup[poly % 31] != 0) - newOut = poly4Lookup[poly % 15]; - break; - case 8: - if ((self->audctl & 128) != 0) - newOut = pokeys->poly9Lookup[poly % 511] & 1; - else { - poly %= 131071; - newOut = (pokeys->poly17Lookup[poly >> 3] >> (poly & 7)) & 1; - } - break; - case 10: - case 14: - newOut ^= 1; - break; - case 12: - newOut = poly4Lookup[poly % 15]; - break; - default: - break; - } - if (newOut != self->out2) { - self->out2 = newOut; - self->delta2 = -self->delta2; - Pokey_AddDelta(self, pokeys, cycle, self->delta2); - } - } - } - } -} - -static void Pokey_Initialize(Pokey *self) -{ - self->audf1 = 0; - self->audf2 = 0; - self->audf3 = 0; - self->audf4 = 0; - self->audc1 = 0; - self->audc2 = 0; - self->audc3 = 0; - self->audc4 = 0; - self->audctl = 0; - self->skctl = 3; - self->init = FALSE; - self->divCycles = 28; - self->periodCycles1 = 28; - self->periodCycles2 = 28; - self->periodCycles3 = 28; - self->periodCycles4 = 28; - self->reloadCycles1 = 28; - self->reloadCycles3 = 28; - self->polyIndex = 60948015; - self->tickCycle1 = 8388608; - self->tickCycle2 = 8388608; - self->tickCycle3 = 8388608; - self->tickCycle4 = 8388608; - self->mute1 = 1; - self->mute2 = 1; - self->mute3 = 1; - self->mute4 = 1; - self->out1 = 0; - self->out2 = 0; - self->out3 = 0; - self->out4 = 0; - self->delta1 = 0; - self->delta2 = 0; - self->delta3 = 0; - self->delta4 = 0; - memset(self->deltaBuffer, 0, sizeof(self->deltaBuffer)); -} - -static cibool Pokey_IsSilent(Pokey const *self) -{ - return ((self->audc1 | self->audc2 | self->audc3 | self->audc4) & 15) == 0; -} - -static void Pokey_Mute(Pokey *self, int mask) -{ - if ((mask & 1) != 0) { - self->mute1 |= 4; - self->tickCycle1 = 8388608; - } - else { - self->mute1 &= ~4; - if (self->tickCycle1 == 8388608 && self->mute1 == 0) - self->tickCycle1 = 0; - } - if ((mask & 2) != 0) { - self->mute2 |= 4; - self->tickCycle2 = 8388608; - } - else { - self->mute2 &= ~4; - if (self->tickCycle2 == 8388608 && self->mute2 == 0) - self->tickCycle2 = 0; - } - if ((mask & 4) != 0) { - self->mute3 |= 4; - self->tickCycle3 = 8388608; - } - else { - self->mute3 &= ~4; - if (self->tickCycle3 == 8388608 && self->mute3 == 0) - self->tickCycle3 = 0; - } - if ((mask & 8) != 0) { - self->mute4 |= 4; - self->tickCycle4 = 8388608; - } - else { - self->mute4 &= ~4; - if (self->tickCycle4 == 8388608 && self->mute4 == 0) - self->tickCycle4 = 0; - } -} - -static void PokeyPair_Construct(PokeyPair *self) -{ - int reg = 511; - { - int i; - for (i = 0; i < 511; i++) { - reg = ((((reg >> 5) ^ reg) & 1) << 8) + (reg >> 1); - self->poly9Lookup[i] = (unsigned char) reg; - } - } - reg = 131071; - { - int i; - for (i = 0; i < 16385; i++) { - reg = ((((reg >> 5) ^ reg) & 255) << 9) + (reg >> 8); - self->poly17Lookup[i] = (unsigned char) (reg >> 1); - } - } -} - -static int PokeyPair_EndFrame(PokeyPair *self, int cycle) -{ - Pokey_EndFrame(&self->basePokey, self, cycle); - if (self->extraPokeyMask != 0) - Pokey_EndFrame(&self->extraPokey, self, cycle); - self->sampleOffset += cycle * self->sampleFactor; - self->readySamplesStart = 0; - self->readySamplesEnd = self->sampleOffset >> 20; - self->sampleOffset &= 1048575; - return self->readySamplesEnd; -} - -static int PokeyPair_Generate(PokeyPair *self, unsigned char *buffer, int bufferOffset, int blocks, ASAPSampleFormat format) -{ - int i = self->readySamplesStart; - int samplesEnd = self->readySamplesEnd; - int accLeft; - int accRight; - if (blocks < samplesEnd - i) - samplesEnd = i + blocks; - else - blocks = samplesEnd - i; - accLeft = self->iirAccLeft; - accRight = self->iirAccRight; - for (; i < samplesEnd; i++) { - int sample; - accLeft += self->basePokey.deltaBuffer[i] - (accLeft * 3 >> 10); - sample = accLeft >> 10; - if (sample < -32767) - sample = -32767; - else if (sample > 32767) - sample = 32767; - switch (format) { - case ASAPSampleFormat_U8: - buffer[bufferOffset++] = (sample >> 8) + 128; - break; - case ASAPSampleFormat_S16_L_E: - buffer[bufferOffset++] = (unsigned char) sample; - buffer[bufferOffset++] = (unsigned char) (sample >> 8); - break; - case ASAPSampleFormat_S16_B_E: - buffer[bufferOffset++] = (unsigned char) (sample >> 8); - buffer[bufferOffset++] = (unsigned char) sample; - break; - } - if (self->extraPokeyMask != 0) { - accRight += self->extraPokey.deltaBuffer[i] - (accRight * 3 >> 10); - sample = accRight >> 10; - if (sample < -32767) - sample = -32767; - else if (sample > 32767) - sample = 32767; - switch (format) { - case ASAPSampleFormat_U8: - buffer[bufferOffset++] = (sample >> 8) + 128; - break; - case ASAPSampleFormat_S16_L_E: - buffer[bufferOffset++] = (unsigned char) sample; - buffer[bufferOffset++] = (unsigned char) (sample >> 8); - break; - case ASAPSampleFormat_S16_B_E: - buffer[bufferOffset++] = (unsigned char) (sample >> 8); - buffer[bufferOffset++] = (unsigned char) sample; - break; - } - } - } - if (i == self->readySamplesEnd) { - accLeft += self->basePokey.deltaBuffer[i] + self->basePokey.deltaBuffer[i + 1]; - accRight += self->extraPokey.deltaBuffer[i] + self->extraPokey.deltaBuffer[i + 1]; - } - self->readySamplesStart = i; - self->iirAccLeft = accLeft; - self->iirAccRight = accRight; - return blocks; -} - -static int PokeyPair_GetRandom(PokeyPair const *self, int addr, int cycle) -{ - Pokey const *pokey = (addr & self->extraPokeyMask) != 0 ? &self->extraPokey : &self->basePokey; - int i; - int j; - if (pokey->init) - return 255; - i = cycle + pokey->polyIndex; - if ((pokey->audctl & 128) != 0) - return self->poly9Lookup[i % 511]; - i %= 131071; - j = i >> 3; - i &= 7; - return ((self->poly17Lookup[j] >> i) + (self->poly17Lookup[j + 1] << (8 - i))) & 255; -} - -static void PokeyPair_Initialize(PokeyPair *self, cibool ntsc, cibool stereo) -{ - self->extraPokeyMask = stereo ? 16 : 0; - self->timer1Cycle = 8388608; - self->timer2Cycle = 8388608; - self->timer4Cycle = 8388608; - self->irqst = 255; - Pokey_Initialize(&self->basePokey); - Pokey_Initialize(&self->extraPokey); - self->sampleFactor = ntsc ? 25837 : 26075; - self->sampleOffset = 0; - self->readySamplesStart = 0; - self->readySamplesEnd = 0; - self->iirAccLeft = 0; - self->iirAccRight = 0; -} - -static cibool PokeyPair_IsSilent(PokeyPair const *self) -{ - return Pokey_IsSilent(&self->basePokey) && Pokey_IsSilent(&self->extraPokey); -} - -static void PokeyPair_Poke(PokeyPair *self, int addr, int data, int cycle) -{ - Pokey *pokey = (addr & self->extraPokeyMask) != 0 ? &self->extraPokey : &self->basePokey; - switch (addr & 15) { - cibool init; - case 0: - if (data == pokey->audf1) - break; - Pokey_GenerateUntilCycle(pokey, self, cycle); - pokey->audf1 = data; - switch (pokey->audctl & 80) { - case 0: - pokey->periodCycles1 = pokey->divCycles * (data + 1); - break; - case 16: - pokey->periodCycles2 = pokey->divCycles * (data + (pokey->audf2 << 8) + 1); - pokey->reloadCycles1 = pokey->divCycles * (data + 1); - if (pokey->periodCycles2 <= 112 && (pokey->audc2 >> 4 == 10 || pokey->audc2 >> 4 == 14)) { - pokey->mute2 |= 1; - pokey->tickCycle2 = 8388608; - } - else { - pokey->mute2 &= ~1; - if (pokey->tickCycle2 == 8388608 && pokey->mute2 == 0) - pokey->tickCycle2 = cycle; - } - break; - case 64: - pokey->periodCycles1 = data + 4; - break; - case 80: - pokey->periodCycles2 = data + (pokey->audf2 << 8) + 7; - pokey->reloadCycles1 = data + 4; - if (pokey->periodCycles2 <= 112 && (pokey->audc2 >> 4 == 10 || pokey->audc2 >> 4 == 14)) { - pokey->mute2 |= 1; - pokey->tickCycle2 = 8388608; - } - else { - pokey->mute2 &= ~1; - if (pokey->tickCycle2 == 8388608 && pokey->mute2 == 0) - pokey->tickCycle2 = cycle; - } - break; - } - if (pokey->periodCycles1 <= 112 && (pokey->audc1 >> 4 == 10 || pokey->audc1 >> 4 == 14)) { - pokey->mute1 |= 1; - pokey->tickCycle1 = 8388608; - } - else { - pokey->mute1 &= ~1; - if (pokey->tickCycle1 == 8388608 && pokey->mute1 == 0) - pokey->tickCycle1 = cycle; - } - break; - case 1: - if (data == pokey->audc1) - break; - Pokey_GenerateUntilCycle(pokey, self, cycle); - pokey->audc1 = data; - if ((data & 16) != 0) { - data = (data & 15) << 20; - if ((pokey->mute1 & 4) == 0) - Pokey_AddDelta(pokey, self, cycle, pokey->delta1 > 0 ? data - pokey->delta1 : data); - pokey->delta1 = data; - } - else { - data = (data & 15) << 20; - if (pokey->periodCycles1 <= 112 && (pokey->audc1 >> 4 == 10 || pokey->audc1 >> 4 == 14)) { - pokey->mute1 |= 1; - pokey->tickCycle1 = 8388608; - } - else { - pokey->mute1 &= ~1; - if (pokey->tickCycle1 == 8388608 && pokey->mute1 == 0) - pokey->tickCycle1 = cycle; - } - if (pokey->delta1 > 0) { - if ((pokey->mute1 & 4) == 0) - Pokey_AddDelta(pokey, self, cycle, data - pokey->delta1); - pokey->delta1 = data; - } - else - pokey->delta1 = -data; - } - break; - case 2: - if (data == pokey->audf2) - break; - Pokey_GenerateUntilCycle(pokey, self, cycle); - pokey->audf2 = data; - switch (pokey->audctl & 80) { - case 0: - case 64: - pokey->periodCycles2 = pokey->divCycles * (data + 1); - break; - case 16: - pokey->periodCycles2 = pokey->divCycles * (pokey->audf1 + (data << 8) + 1); - break; - case 80: - pokey->periodCycles2 = pokey->audf1 + (data << 8) + 7; - break; - } - if (pokey->periodCycles2 <= 112 && (pokey->audc2 >> 4 == 10 || pokey->audc2 >> 4 == 14)) { - pokey->mute2 |= 1; - pokey->tickCycle2 = 8388608; - } - else { - pokey->mute2 &= ~1; - if (pokey->tickCycle2 == 8388608 && pokey->mute2 == 0) - pokey->tickCycle2 = cycle; - } - break; - case 3: - if (data == pokey->audc2) - break; - Pokey_GenerateUntilCycle(pokey, self, cycle); - pokey->audc2 = data; - if ((data & 16) != 0) { - data = (data & 15) << 20; - if ((pokey->mute2 & 4) == 0) - Pokey_AddDelta(pokey, self, cycle, pokey->delta2 > 0 ? data - pokey->delta2 : data); - pokey->delta2 = data; - } - else { - data = (data & 15) << 20; - if (pokey->periodCycles2 <= 112 && (pokey->audc2 >> 4 == 10 || pokey->audc2 >> 4 == 14)) { - pokey->mute2 |= 1; - pokey->tickCycle2 = 8388608; - } - else { - pokey->mute2 &= ~1; - if (pokey->tickCycle2 == 8388608 && pokey->mute2 == 0) - pokey->tickCycle2 = cycle; - } - if (pokey->delta2 > 0) { - if ((pokey->mute2 & 4) == 0) - Pokey_AddDelta(pokey, self, cycle, data - pokey->delta2); - pokey->delta2 = data; - } - else - pokey->delta2 = -data; - } - break; - case 4: - if (data == pokey->audf3) - break; - Pokey_GenerateUntilCycle(pokey, self, cycle); - pokey->audf3 = data; - switch (pokey->audctl & 40) { - case 0: - pokey->periodCycles3 = pokey->divCycles * (data + 1); - break; - case 8: - pokey->periodCycles4 = pokey->divCycles * (data + (pokey->audf4 << 8) + 1); - pokey->reloadCycles3 = pokey->divCycles * (data + 1); - if (pokey->periodCycles4 <= 112 && (pokey->audc4 >> 4 == 10 || pokey->audc4 >> 4 == 14)) { - pokey->mute4 |= 1; - pokey->tickCycle4 = 8388608; - } - else { - pokey->mute4 &= ~1; - if (pokey->tickCycle4 == 8388608 && pokey->mute4 == 0) - pokey->tickCycle4 = cycle; - } - break; - case 32: - pokey->periodCycles3 = data + 4; - break; - case 40: - pokey->periodCycles4 = data + (pokey->audf4 << 8) + 7; - pokey->reloadCycles3 = data + 4; - if (pokey->periodCycles4 <= 112 && (pokey->audc4 >> 4 == 10 || pokey->audc4 >> 4 == 14)) { - pokey->mute4 |= 1; - pokey->tickCycle4 = 8388608; - } - else { - pokey->mute4 &= ~1; - if (pokey->tickCycle4 == 8388608 && pokey->mute4 == 0) - pokey->tickCycle4 = cycle; - } - break; - } - if (pokey->periodCycles3 <= 112 && (pokey->audc3 >> 4 == 10 || pokey->audc3 >> 4 == 14)) { - pokey->mute3 |= 1; - pokey->tickCycle3 = 8388608; - } - else { - pokey->mute3 &= ~1; - if (pokey->tickCycle3 == 8388608 && pokey->mute3 == 0) - pokey->tickCycle3 = cycle; - } - break; - case 5: - if (data == pokey->audc3) - break; - Pokey_GenerateUntilCycle(pokey, self, cycle); - pokey->audc3 = data; - if ((data & 16) != 0) { - data = (data & 15) << 20; - if ((pokey->mute3 & 4) == 0) - Pokey_AddDelta(pokey, self, cycle, pokey->delta3 > 0 ? data - pokey->delta3 : data); - pokey->delta3 = data; - } - else { - data = (data & 15) << 20; - if (pokey->periodCycles3 <= 112 && (pokey->audc3 >> 4 == 10 || pokey->audc3 >> 4 == 14)) { - pokey->mute3 |= 1; - pokey->tickCycle3 = 8388608; - } - else { - pokey->mute3 &= ~1; - if (pokey->tickCycle3 == 8388608 && pokey->mute3 == 0) - pokey->tickCycle3 = cycle; - } - if (pokey->delta3 > 0) { - if ((pokey->mute3 & 4) == 0) - Pokey_AddDelta(pokey, self, cycle, data - pokey->delta3); - pokey->delta3 = data; - } - else - pokey->delta3 = -data; - } - break; - case 6: - if (data == pokey->audf4) - break; - Pokey_GenerateUntilCycle(pokey, self, cycle); - pokey->audf4 = data; - switch (pokey->audctl & 40) { - case 0: - case 32: - pokey->periodCycles4 = pokey->divCycles * (data + 1); - break; - case 8: - pokey->periodCycles4 = pokey->divCycles * (pokey->audf3 + (data << 8) + 1); - break; - case 40: - pokey->periodCycles4 = pokey->audf3 + (data << 8) + 7; - break; - } - if (pokey->periodCycles4 <= 112 && (pokey->audc4 >> 4 == 10 || pokey->audc4 >> 4 == 14)) { - pokey->mute4 |= 1; - pokey->tickCycle4 = 8388608; - } - else { - pokey->mute4 &= ~1; - if (pokey->tickCycle4 == 8388608 && pokey->mute4 == 0) - pokey->tickCycle4 = cycle; - } - break; - case 7: - if (data == pokey->audc4) - break; - Pokey_GenerateUntilCycle(pokey, self, cycle); - pokey->audc4 = data; - if ((data & 16) != 0) { - data = (data & 15) << 20; - if ((pokey->mute4 & 4) == 0) - Pokey_AddDelta(pokey, self, cycle, pokey->delta4 > 0 ? data - pokey->delta4 : data); - pokey->delta4 = data; - } - else { - data = (data & 15) << 20; - if (pokey->periodCycles4 <= 112 && (pokey->audc4 >> 4 == 10 || pokey->audc4 >> 4 == 14)) { - pokey->mute4 |= 1; - pokey->tickCycle4 = 8388608; - } - else { - pokey->mute4 &= ~1; - if (pokey->tickCycle4 == 8388608 && pokey->mute4 == 0) - pokey->tickCycle4 = cycle; - } - if (pokey->delta4 > 0) { - if ((pokey->mute4 & 4) == 0) - Pokey_AddDelta(pokey, self, cycle, data - pokey->delta4); - pokey->delta4 = data; - } - else - pokey->delta4 = -data; - } - break; - case 8: - if (data == pokey->audctl) - break; - Pokey_GenerateUntilCycle(pokey, self, cycle); - pokey->audctl = data; - pokey->divCycles = (data & 1) != 0 ? 114 : 28; - switch (data & 80) { - case 0: - pokey->periodCycles1 = pokey->divCycles * (pokey->audf1 + 1); - pokey->periodCycles2 = pokey->divCycles * (pokey->audf2 + 1); - break; - case 16: - pokey->periodCycles1 = pokey->divCycles << 8; - pokey->periodCycles2 = pokey->divCycles * (pokey->audf1 + (pokey->audf2 << 8) + 1); - pokey->reloadCycles1 = pokey->divCycles * (pokey->audf1 + 1); - break; - case 64: - pokey->periodCycles1 = pokey->audf1 + 4; - pokey->periodCycles2 = pokey->divCycles * (pokey->audf2 + 1); - break; - case 80: - pokey->periodCycles1 = 256; - pokey->periodCycles2 = pokey->audf1 + (pokey->audf2 << 8) + 7; - pokey->reloadCycles1 = pokey->audf1 + 4; - break; - } - if (pokey->periodCycles1 <= 112 && (pokey->audc1 >> 4 == 10 || pokey->audc1 >> 4 == 14)) { - pokey->mute1 |= 1; - pokey->tickCycle1 = 8388608; - } - else { - pokey->mute1 &= ~1; - if (pokey->tickCycle1 == 8388608 && pokey->mute1 == 0) - pokey->tickCycle1 = cycle; - } - if (pokey->periodCycles2 <= 112 && (pokey->audc2 >> 4 == 10 || pokey->audc2 >> 4 == 14)) { - pokey->mute2 |= 1; - pokey->tickCycle2 = 8388608; - } - else { - pokey->mute2 &= ~1; - if (pokey->tickCycle2 == 8388608 && pokey->mute2 == 0) - pokey->tickCycle2 = cycle; - } - switch (data & 40) { - case 0: - pokey->periodCycles3 = pokey->divCycles * (pokey->audf3 + 1); - pokey->periodCycles4 = pokey->divCycles * (pokey->audf4 + 1); - break; - case 8: - pokey->periodCycles3 = pokey->divCycles << 8; - pokey->periodCycles4 = pokey->divCycles * (pokey->audf3 + (pokey->audf4 << 8) + 1); - pokey->reloadCycles3 = pokey->divCycles * (pokey->audf3 + 1); - break; - case 32: - pokey->periodCycles3 = pokey->audf3 + 4; - pokey->periodCycles4 = pokey->divCycles * (pokey->audf4 + 1); - break; - case 40: - pokey->periodCycles3 = 256; - pokey->periodCycles4 = pokey->audf3 + (pokey->audf4 << 8) + 7; - pokey->reloadCycles3 = pokey->audf3 + 4; - break; - } - if (pokey->periodCycles3 <= 112 && (pokey->audc3 >> 4 == 10 || pokey->audc3 >> 4 == 14)) { - pokey->mute3 |= 1; - pokey->tickCycle3 = 8388608; - } - else { - pokey->mute3 &= ~1; - if (pokey->tickCycle3 == 8388608 && pokey->mute3 == 0) - pokey->tickCycle3 = cycle; - } - if (pokey->periodCycles4 <= 112 && (pokey->audc4 >> 4 == 10 || pokey->audc4 >> 4 == 14)) { - pokey->mute4 |= 1; - pokey->tickCycle4 = 8388608; - } - else { - pokey->mute4 &= ~1; - if (pokey->tickCycle4 == 8388608 && pokey->mute4 == 0) - pokey->tickCycle4 = cycle; - } - if (pokey->init && (data & 64) == 0) { - pokey->mute1 |= 2; - pokey->tickCycle1 = 8388608; - } - else { - pokey->mute1 &= ~2; - if (pokey->tickCycle1 == 8388608 && pokey->mute1 == 0) - pokey->tickCycle1 = cycle; - } - if (pokey->init && (data & 80) != 80) { - pokey->mute2 |= 2; - pokey->tickCycle2 = 8388608; - } - else { - pokey->mute2 &= ~2; - if (pokey->tickCycle2 == 8388608 && pokey->mute2 == 0) - pokey->tickCycle2 = cycle; - } - if (pokey->init && (data & 32) == 0) { - pokey->mute3 |= 2; - pokey->tickCycle3 = 8388608; - } - else { - pokey->mute3 &= ~2; - if (pokey->tickCycle3 == 8388608 && pokey->mute3 == 0) - pokey->tickCycle3 = cycle; - } - if (pokey->init && (data & 40) != 40) { - pokey->mute4 |= 2; - pokey->tickCycle4 = 8388608; - } - else { - pokey->mute4 &= ~2; - if (pokey->tickCycle4 == 8388608 && pokey->mute4 == 0) - pokey->tickCycle4 = cycle; - } - break; - case 9: - if (pokey->tickCycle1 != 8388608) - pokey->tickCycle1 = cycle + pokey->periodCycles1; - if (pokey->tickCycle2 != 8388608) - pokey->tickCycle2 = cycle + pokey->periodCycles2; - if (pokey->tickCycle3 != 8388608) - pokey->tickCycle3 = cycle + pokey->periodCycles3; - if (pokey->tickCycle4 != 8388608) - pokey->tickCycle4 = cycle + pokey->periodCycles4; - break; - case 15: - if (data == pokey->skctl) - break; - Pokey_GenerateUntilCycle(pokey, self, cycle); - pokey->skctl = data; - init = (data & 3) == 0; - if (pokey->init && !init) - pokey->polyIndex = ((pokey->audctl & 128) != 0 ? 237614 : 60948014) - cycle; - pokey->init = init; - if (pokey->init && (pokey->audctl & 64) == 0) { - pokey->mute1 |= 2; - pokey->tickCycle1 = 8388608; - } - else { - pokey->mute1 &= ~2; - if (pokey->tickCycle1 == 8388608 && pokey->mute1 == 0) - pokey->tickCycle1 = cycle; - } - if (pokey->init && (pokey->audctl & 80) != 80) { - pokey->mute2 |= 2; - pokey->tickCycle2 = 8388608; - } - else { - pokey->mute2 &= ~2; - if (pokey->tickCycle2 == 8388608 && pokey->mute2 == 0) - pokey->tickCycle2 = cycle; - } - if (pokey->init && (pokey->audctl & 32) == 0) { - pokey->mute3 |= 2; - pokey->tickCycle3 = 8388608; - } - else { - pokey->mute3 &= ~2; - if (pokey->tickCycle3 == 8388608 && pokey->mute3 == 0) - pokey->tickCycle3 = cycle; - } - if (pokey->init && (pokey->audctl & 40) != 40) { - pokey->mute4 |= 2; - pokey->tickCycle4 = 8388608; - } - else { - pokey->mute4 &= ~2; - if (pokey->tickCycle4 == 8388608 && pokey->mute4 == 0) - pokey->tickCycle4 = cycle; - } - if ((data & 16) != 0) { - pokey->mute3 |= 8; - pokey->tickCycle3 = 8388608; - } - else { - pokey->mute3 &= ~8; - if (pokey->tickCycle3 == 8388608 && pokey->mute3 == 0) - pokey->tickCycle3 = cycle; - } - if ((data & 16) != 0) { - pokey->mute4 |= 8; - pokey->tickCycle4 = 8388608; - } - else { - pokey->mute4 &= ~8; - if (pokey->tickCycle4 == 8388608 && pokey->mute4 == 0) - pokey->tickCycle4 = cycle; - } - break; - default: - break; - } -} - -static void PokeyPair_StartFrame(PokeyPair *self) -{ - memset(self->basePokey.deltaBuffer, 0, sizeof(self->basePokey.deltaBuffer)); - if (self->extraPokeyMask != 0) - memset(self->extraPokey.deltaBuffer, 0, sizeof(self->extraPokey.deltaBuffer)); -} diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/asap.ci kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/asap.ci --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/asap.ci 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/asap.ci 1970-01-01 00:00:00.000000000 +0000 @@ -1,671 +0,0 @@ -// asap.ci - emulation engine -// -// Copyright (C) 2010-2013 Piotr Fusik -// -// This file is part of ASAP (Another Slight Atari Player), -// see http://asap.sourceforge.net -// -// ASAP is free software; you can redistribute it and/or modify it -// under the terms of the GNU General Public License as published -// by the Free Software Foundation; either version 2 of the License, -// or (at your option) any later version. -// -// ASAP is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -// See the GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ASAP; if not, write to the Free Software Foundation, Inc., -// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -enum NmiStatus -{ - Reset, - OnVBlank, - WasVBlank -} - -/// Atari 8-bit chip music emulator. -/// This class performs no I/O operations - all music data must be passed in byte arrays. -public class ASAP -{ - /// Output sample rate. - public const int SampleRate = Pokey.SampleRate; - - int Cycle; - int NextEventCycle; - - byte[65536] Memory; - - Cpu6502() Cpu; - - // ANTIC: - int NextScanlineCycle; - NmiStatus Nmist; - - // GTIA: - int Consol; - - // COVOX: - byte[4] Covox; - - // POKEYs: - PokeyPair() Pokeys; - - ASAPInfo() ModuleInfo; - int NextPlayerCycle; - int TmcPerFrameCounter; - int CurrentSong; - int CurrentDuration; - int BlocksPlayed; - int SilenceCycles; - int SilenceCyclesCounter; - - public ASAP() - { - SilenceCycles = 0; - } - - /// Enables silence detection. - /// Causes playback to stop after the specified period of silence. - public void DetectSilence( - /// Length of silence which ends playback. Zero disables silence detection. - int seconds) - { - // for simplicity ignore PAL/NTSC difference - this doesn't need to be precise - SilenceCyclesCounter = SilenceCycles = seconds * 1773447; - } - - int PeekHardware(int addr) - { - switch (addr & 0xff1f) { - case 0xd014: - return ModuleInfo.Ntsc ? 0xf : 1; - case 0xd01f: - return ~Consol & 0xf; - case 0xd20a: - case 0xd21a: - return Pokeys.GetRandom(addr, Cycle); - case 0xd20e: - return Pokeys.Irqst; - case 0xd21e: - if (Pokeys.ExtraPokeyMask != 0) { - // interrupts in the extra POKEY not emulated at the moment - return 0xff; - } - return Pokeys.Irqst; - case 0xd20c: - case 0xd21c: - case 0xd20f: // just because some SAP files rely on this - case 0xd21f: - return 0xff; - case 0xd40b: - case 0xd41b: - if (Cycle > (ModuleInfo.Ntsc ? 262 * 114 : 312 * 114)) - return 0; - return Cycle / 228; - case 0xd40f: - case 0xd41f: - switch (Nmist) { - case NmiStatus.Reset: - return 0x1f; - case NmiStatus.WasVBlank: - return 0x5f; - default: // case NmiStatus.OnVBlank: - return Cycle < 28291 ? 0x1f : 0x5f; - } - default: - return Memory[addr]; - } - } - - void PokeHardware(int addr, int data) - { - if (addr >> 8 == 0xd2) { - if ((addr & (Pokeys.ExtraPokeyMask + 0xf)) == 0xe) { - Pokeys.Irqst |= data ^ 0xff; - macro SET_TIMER_IRQ(ch) { - if ((data & Pokeys.Irqst & ch) != 0) { - if (Pokeys.Timer##ch##Cycle == Pokey.NeverCycle) { - int t = Pokeys.BasePokey.TickCycle##ch; - while (t < Cycle) - t += Pokeys.BasePokey.PeriodCycles##ch; - Pokeys.Timer##ch##Cycle = t; - if (NextEventCycle > t) - NextEventCycle = t; - } - } - else - Pokeys.Timer##ch##Cycle = Pokey.NeverCycle; - } - SET_TIMER_IRQ(1); - SET_TIMER_IRQ(2); - SET_TIMER_IRQ(4); - } - else - Pokeys.Poke(addr, data, Cycle); - } - else if ((addr & 0xff0f) == 0xd40a) { - int x = Cycle % 114; - Cycle += (x <= 106 ? 106 : 106 + 114) - x; - } - else if ((addr & 0xff0f) == 0xd40f) { - Nmist = Cycle < 28292 ? NmiStatus.OnVBlank : NmiStatus.Reset; - } - else if ((addr & 0xff00) == ModuleInfo.CovoxAddr) { - Pokey pokey; - addr &= 3; - if (addr == 0 || addr == 3) - pokey = Pokeys.BasePokey; - else - pokey = Pokeys.ExtraPokey; - const int DeltaShiftCOVOX = 17; - pokey.AddDelta(Pokeys, Cycle, (data - Covox[addr]) << DeltaShiftCOVOX); - Covox[addr] = data; - } - else if ((addr & 0xff1f) == 0xd01f) { - const int DeltaShiftGTIA = 20; - // NOT data - Consol; reverse to the POKEY sound - int delta = ((Consol & 8) - (data & 8)) << DeltaShiftGTIA; - Pokeys.BasePokey.AddDelta(Pokeys, Cycle, delta); - Pokeys.ExtraPokey.AddDelta(Pokeys, Cycle, delta); - Consol = data; - } - else - Memory[addr] = data; - } - - void Call6502(int addr) - { - const int codeAddr = 0xd200; - Memory[codeAddr] = 0x20; // JSR - Memory[codeAddr + 1] = addr.LowByte; - Memory[codeAddr + 2] = addr >> 8; - Memory[codeAddr + 3] = 0xd2; // escape - Cpu.Pc = codeAddr; - } - - void Call6502Player() - { - int player = ModuleInfo.Player; - switch (ModuleInfo.Type) { - case ASAPModuleType.SapB: - Call6502(player); - break; - case ASAPModuleType.SapC: -#if !ASAP_ONLY_SAP - case ASAPModuleType.Cmc: - case ASAPModuleType.Cm3: - case ASAPModuleType.Cmr: - case ASAPModuleType.Cms: -#endif - Call6502(player + 6); - break; - case ASAPModuleType.SapD: - if (player >= 0) { - int s = Cpu.S; - Memory[0x100 + s] = Cpu.Pc >> 8; - s = s - 1 & 0xff; - Memory[0x100 + s] = Cpu.Pc.LowByte; - Cpu.S = s - 1 & 0xff; - const int codeAddr = 0xd200; - Memory[codeAddr] = 0x08; // PHP - Memory[codeAddr + 1] = 0x48; // PHA - Memory[codeAddr + 2] = 0x8a; // TXA - Memory[codeAddr + 3] = 0x48; // PHA - Memory[codeAddr + 4] = 0x98; // TYA - Memory[codeAddr + 5] = 0x48; // PHA - Memory[codeAddr + 6] = 0x20; // JSR - Memory[codeAddr + 7] = player.LowByte; - Memory[codeAddr + 8] = player >> 8; - Memory[codeAddr + 9] = 0x68; // PLA - Memory[codeAddr + 10] = 0xa8; // TAY - Memory[codeAddr + 11] = 0x68; // PLA - Memory[codeAddr + 12] = 0xaa; // TAX - Memory[codeAddr + 13] = 0x68; // PLA - Memory[codeAddr + 14] = 0x40; // RTI - Cpu.Pc = codeAddr; - } - break; - case ASAPModuleType.SapS: - int i = Memory[0x45] - 1; - Memory[0x45] = i.LowByte; - if (i == 0) - Memory[0xb07b] = (Memory[0xb07b] + 1).LowByte; - break; -#if !ASAP_ONLY_SAP - case ASAPModuleType.Dlt: - Call6502(player + 0x103); - break; - case ASAPModuleType.Mpt: - case ASAPModuleType.Rmt: - case ASAPModuleType.Tm2: - case ASAPModuleType.Fc: - Call6502(player + 3); - break; - case ASAPModuleType.Tmc: - if (--TmcPerFrameCounter <= 0) { - TmcPerFrameCounter = Memory[ModuleInfo.Music + 0x1f]; - Call6502(player + 3); - } - else - Call6502(player + 6); - break; -#if EXPERIMENTAL_XEX - case ASAPModuleType.Xex: - break; -#endif -#endif - } - } - - void HandleEvent() - { - int cycle = Cycle; - if (cycle >= NextScanlineCycle) { - if (cycle - NextScanlineCycle < 50) // not WSYNC - Cycle = cycle += 9; - NextScanlineCycle += 114; - if (cycle >= NextPlayerCycle) { - Call6502Player(); - NextPlayerCycle += 114 * ModuleInfo.Fastplay; - } - } - int nextEventCycle = NextScanlineCycle; - macro CHECK_TIMER_IRQ(ch) { - if (cycle >= Pokeys.Timer##ch##Cycle) { - Pokeys.Irqst &= ~ch; - Pokeys.Timer##ch##Cycle = Pokey.NeverCycle; - } - else if (nextEventCycle > Pokeys.Timer##ch##Cycle) - nextEventCycle = Pokeys.Timer##ch##Cycle; - } - CHECK_TIMER_IRQ(1); - CHECK_TIMER_IRQ(2); - CHECK_TIMER_IRQ(4); - NextEventCycle = nextEventCycle; - } - - int Do6502Frame() - { - NextEventCycle = 0; - NextScanlineCycle = 0; - Nmist = Nmist == NmiStatus.Reset ? NmiStatus.OnVBlank : NmiStatus.WasVBlank; - int cycles = ModuleInfo.Ntsc ? 262 * 114 : 312 * 114; - Cpu.DoFrame(this, cycles); - Cycle -= cycles; - if (NextPlayerCycle != Pokey.NeverCycle) - NextPlayerCycle -= cycles; - if (Pokeys.Timer1Cycle != Pokey.NeverCycle) - Pokeys.Timer1Cycle -= cycles; - if (Pokeys.Timer2Cycle != Pokey.NeverCycle) - Pokeys.Timer2Cycle -= cycles; - if (Pokeys.Timer4Cycle != Pokey.NeverCycle) - Pokeys.Timer4Cycle -= cycles; - return cycles; - } - - int DoFrame() - { - Pokeys.StartFrame(); - int cycles = Do6502Frame(); - Pokeys.EndFrame(cycles); - return cycles; - } - - /// Loads music data ("module"). - public void Load( - /// Filename, used to determine the format. - string filename, - /// Contents of the file. - byte[] module, - /// Length of the file. - int moduleLen) - { - ModuleInfo.Load(filename, module, moduleLen); -#if !ASAP_ONLY_SAP - byte[] playerRoutine = ASAP6502.GetPlayerRoutine(ModuleInfo); - if (playerRoutine != null) { - int player = ASAPInfo.GetWord(playerRoutine, 2); - int playerLastByte = ASAPInfo.GetWord(playerRoutine, 4); - if (ModuleInfo.Music <= playerLastByte) - throw "Module address conflicts with the player routine"; - Memory[0x4c00] = 0; // for 11270-byte DLT - if (ModuleInfo.Type == ASAPModuleType.Fc) - module.CopyTo(0, Memory, ModuleInfo.Music, moduleLen); - else - module.CopyTo(6, Memory, ModuleInfo.Music, moduleLen - 6); - playerRoutine.CopyTo(6, Memory, player, playerLastByte + 1 - player); - if (ModuleInfo.Player < 0) - ModuleInfo.Player = player; - return; - } -#endif - Memory.Clear(); - int moduleIndex = ModuleInfo.HeaderLen + 2; - while (moduleIndex + 5 <= moduleLen) { - int startAddr = ASAPInfo.GetWord(module, moduleIndex); - int blockLen = ASAPInfo.GetWord(module, moduleIndex + 2) + 1 - startAddr; - if (blockLen <= 0 || moduleIndex + blockLen > moduleLen) - throw "Invalid binary block"; - moduleIndex += 4; - module.CopyTo(moduleIndex, Memory, startAddr, blockLen); - moduleIndex += blockLen; - if (moduleIndex == moduleLen) - return; - if (moduleIndex + 7 <= moduleLen && module[moduleIndex] == 0xff && module[moduleIndex + 1] == 0xff) - moduleIndex += 2; - } - throw "Invalid binary block"; - } - - /// Returns information about the loaded module. - public ASAPInfo GetInfo() - { - return ModuleInfo; - } - - void Do6502Init(int pc, int a, int x, int y) - { - Cpu.Pc = pc; - Cpu.A = a & 0xff; - Cpu.X = x & 0xff; - Cpu.Y = y & 0xff; - const int escapeAddr = 0xd200; - Memory[escapeAddr] = 0xd2; // escape code - Memory[0x1fe] = (escapeAddr - 1).LowByte; // return address points to the escape code - Memory[0x1ff] = (escapeAddr - 1) >> 8; - Cpu.S = 0xfd; - for (int frame = 0; frame < 50; frame++) { - Do6502Frame(); - if (Cpu.Pc == escapeAddr) - return; - } - throw "INIT routine didn't return"; - } - - /// Mutes the selected POKEY channels. - public void MutePokeyChannels( - /// An 8-bit mask which selects POKEY channels to be muted. - int mask) - { - Pokeys.BasePokey.Mute(mask); - Pokeys.ExtraPokey.Mute(mask >> 4); - } - - /// Prepares playback of the specified song of the loaded module. - public void PlaySong( - /// Zero-based song index. - int song, - /// Playback time in milliseconds, -1 means infinity. - int duration) - { - if (song < 0 || song >= ModuleInfo.Songs) - throw "Song number out of range"; - CurrentSong = song; - CurrentDuration = duration; - NextPlayerCycle = Pokey.NeverCycle; - BlocksPlayed = 0; - SilenceCyclesCounter = SilenceCycles; - - Cycle = 0; - Cpu.Nz = 0; - Cpu.C = 0; - Cpu.Vdi = 0; - Nmist = NmiStatus.OnVBlank; - Consol = 8; - Covox[0] = 0x80; - Covox[1] = 0x80; - Covox[2] = 0x80; - Covox[3] = 0x80; - Pokeys.Initialize(ModuleInfo.Ntsc, ModuleInfo.Channels > 1); - MutePokeyChannels(0xff); - switch (ModuleInfo.Type) { - case ASAPModuleType.SapB: - Do6502Init(ModuleInfo.Init, song, 0, 0); - break; - case ASAPModuleType.SapC: -#if !ASAP_ONLY_SAP - case ASAPModuleType.Cmc: - case ASAPModuleType.Cm3: - case ASAPModuleType.Cmr: - case ASAPModuleType.Cms: -#endif - Do6502Init(ModuleInfo.Player + 3, 0x70, ModuleInfo.Music, ModuleInfo.Music >> 8); - Do6502Init(ModuleInfo.Player + 3, 0x00, song, 0); - break; - case ASAPModuleType.SapD: - case ASAPModuleType.SapS: - Cpu.Pc = ModuleInfo.Init; - Cpu.A = song; - Cpu.X = 0x00; - Cpu.Y = 0x00; - Cpu.S = 0xff; - break; -#if !ASAP_ONLY_SAP - case ASAPModuleType.Dlt: - Do6502Init(ModuleInfo.Player + 0x100, 0x00, 0x00, ModuleInfo.SongPos[song]); - break; - case ASAPModuleType.Mpt: - Do6502Init(ModuleInfo.Player, 0x00, ModuleInfo.Music >> 8, ModuleInfo.Music); - Do6502Init(ModuleInfo.Player, 0x02, ModuleInfo.SongPos[song], 0); - break; - case ASAPModuleType.Rmt: - Do6502Init(ModuleInfo.Player, ModuleInfo.SongPos[song], ModuleInfo.Music, ModuleInfo.Music >> 8); - break; - case ASAPModuleType.Tmc: - case ASAPModuleType.Tm2: - Do6502Init(ModuleInfo.Player, 0x70, ModuleInfo.Music >> 8, ModuleInfo.Music); - Do6502Init(ModuleInfo.Player, 0x00, song, 0); - TmcPerFrameCounter = 1; - break; - case ASAPModuleType.Fc: - Do6502Init(ModuleInfo.Player, song, 0, 0); - break; -#if EXPERIMENTAL_XEX - case ASAPModuleType.Xex: - Cpu.Pc = ASAPInfo.GetWord(Memory, 0x2e0); - Cpu.A = song; - Cpu.X = 0x00; - Cpu.Y = 0x00; - Cpu.S = 0xff; - break; -#endif -#endif - } - MutePokeyChannels(0); - NextPlayerCycle = 0; - } - - /// Returns current playback position in blocks. - /// A block is one sample or a pair of samples for stereo. - public int GetBlocksPlayed() - { - return BlocksPlayed; - } - - /// Returns current playback position in milliseconds. - public int GetPosition() - { - return BlocksPlayed * 10 / (SampleRate / 100); - } - - static int MillisecondsToBlocks(int milliseconds) - { - return milliseconds * (SampleRate / 100) / 10; - } - - /// Changes the playback position. - public void SeekSample( - /// The requested absolute position in samples (always 44100 per second, even in stereo). - int block) - { - if (block < BlocksPlayed) - PlaySong(CurrentSong, CurrentDuration); - while (BlocksPlayed + Pokeys.ReadySamplesEnd < block) { - BlocksPlayed += Pokeys.ReadySamplesEnd; - DoFrame(); - } - Pokeys.ReadySamplesStart = block - BlocksPlayed; - BlocksPlayed = block; - } - - /// Changes the playback position. - public void Seek( - /// The requested absolute position in milliseconds. - int position) - { - SeekSample(MillisecondsToBlocks(position)); - } - - static void PutLittleEndian(byte[] buffer, int offset, int value) - { - buffer[offset] = value.LowByte; - buffer[offset + 1] = (value >> 8).LowByte; - buffer[offset + 2] = (value >> 16).LowByte; - buffer[offset + 3] = (value >> 24).LowByte; - } - - macro FOUR_CC(s) ( s[0] + (s[1] << 8) + (s[2] << 16) + (s[3] << 24) ) - - static void PutLittleEndians(byte[] buffer, int offset, int value1, int value2) - { - PutLittleEndian(buffer, offset, value1); - PutLittleEndian(buffer, offset + 4, value2); - } - - static int PutWavMetadata(byte[] buffer, int offset, int fourCC, string value) - { - int len = value.Length; - if (len > 0) { - // include terminator and round up to the nearest word - PutLittleEndians(buffer, offset, fourCC, (len | 1) + 1); - offset += 8; - for (int i = 0; i < len; i++) - buffer[offset++] = value[i]; - buffer[offset++] = 0; - if ((len & 1) == 0) - buffer[offset++] = 0; - } - return offset; - } - - /// Fills leading bytes of the specified buffer with WAV file header. - /// Returns the number of changed bytes. - public int GetWavHeader( - /// The destination buffer. - byte[] buffer, - /// Format of samples. - ASAPSampleFormat format, - /// Include metadata (title, author, date). - bool metadata) - { - int use16bit = format != ASAPSampleFormat.U8 ? 1 : 0; - int blockSize = ModuleInfo.Channels << use16bit; - int bytesPerSecond = SampleRate * blockSize; - int totalBlocks = MillisecondsToBlocks(CurrentDuration); - int nBytes = (totalBlocks - BlocksPlayed) * blockSize; - PutLittleEndian(buffer, 8, FOUR_CC("WAVE")); - PutLittleEndians(buffer, 12, FOUR_CC("fmt "), 16); - buffer[20] = 1; - buffer[21] = 0; - buffer[22] = ModuleInfo.Channels; - buffer[23] = 0; - PutLittleEndians(buffer, 24, SampleRate, bytesPerSecond); - buffer[32] = blockSize; - buffer[33] = 0; - buffer[34] = 8 << use16bit; - buffer[35] = 0; - int i = 36; - if (metadata) { - int year = ModuleInfo.GetYear(); - if (ModuleInfo.Title.Length > 0 || ModuleInfo.Author.Length > 0 || year > 0) { - PutLittleEndian(buffer, 44, FOUR_CC("INFO")); - i = PutWavMetadata(buffer, 48, FOUR_CC("INAM"), ModuleInfo.Title); - i = PutWavMetadata(buffer, i, FOUR_CC("IART"), ModuleInfo.Author); - if (year > 0) { - PutLittleEndians(buffer, i, FOUR_CC("ICRD"), 6); - for (int j = 3; j >= 0; j--) { - buffer[i + 8 + j] = '0' + year % 10; - year /= 10; - } - buffer[i + 12] = 0; - buffer[i + 13] = 0; - i += 14; - } - PutLittleEndians(buffer, 36, FOUR_CC("LIST"), i - 44); - } - } - PutLittleEndians(buffer, 0, FOUR_CC("RIFF"), i + nBytes); - PutLittleEndians(buffer, i, FOUR_CC("data"), nBytes); - return i + 8; - } - - int GenerateAt(byte[] buffer, int bufferOffset, int bufferLen, ASAPSampleFormat format) - { - if (SilenceCycles > 0 && SilenceCyclesCounter <= 0) - return 0; - int blockShift = -#if FLASH - 0; -#else - (ModuleInfo.Channels - 1) + (format != ASAPSampleFormat.U8 ? 1 : 0); -#endif - int bufferBlocks = bufferLen >> blockShift; - if (CurrentDuration > 0) { - int totalBlocks = MillisecondsToBlocks(CurrentDuration); - if (bufferBlocks > totalBlocks - BlocksPlayed) - bufferBlocks = totalBlocks - BlocksPlayed; - } - int block = 0; - for (;;) { - int blocks = Pokeys.Generate(buffer, bufferOffset + (block << blockShift), bufferBlocks - block, format); - BlocksPlayed += blocks; - block += blocks; - if (block >= bufferBlocks) - break; - int cycles = DoFrame(); - if (SilenceCycles > 0) { - if (Pokeys.IsSilent()) { - SilenceCyclesCounter -= cycles; - if (SilenceCyclesCounter <= 0) - break; - } - else - SilenceCyclesCounter = SilenceCycles; - } - } - return block << blockShift; - } - - /// Fills the specified buffer with generated samples. - public int Generate( - /// The destination buffer. - byte[] buffer, - /// Number of bytes to fill. - int bufferLen, - /// Format of samples. - ASAPSampleFormat format) - { - return GenerateAt(buffer, 0, bufferLen, format); - } - - /// Returns POKEY channel volume - an integer between 0 and 15. - public int GetPokeyChannelVolume( - /// POKEY channel number (from 0 to 7). - int channel) - { - switch (channel) { - case 0: return Pokeys.BasePokey.Audc1 & 0xf; - case 1: return Pokeys.BasePokey.Audc2 & 0xf; - case 2: return Pokeys.BasePokey.Audc3 & 0xf; - case 3: return Pokeys.BasePokey.Audc4 & 0xf; - case 4: return Pokeys.ExtraPokey.Audc1 & 0xf; - case 5: return Pokeys.ExtraPokey.Audc2 & 0xf; - case 6: return Pokeys.ExtraPokey.Audc3 & 0xf; - case 7: return Pokeys.ExtraPokey.Audc4 & 0xf; - default: return 0; - } - } -} Binary files /tmp/tmpyaM5l1/AUpGL9bywb/kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/asapconv and /tmp/tmpyaM5l1/KBGCC02aAO/kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/asapconv differ diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/asapconv.c kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/asapconv.c --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/asapconv.c 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/asapconv.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,626 +0,0 @@ -/* - * asapconv.c - converter of ASAP-supported formats - * - * Copyright (C) 2005-2012 Piotr Fusik - * - * This file is part of ASAP (Another Slight Atari Player), - * see http://asap.sourceforge.net - * - * ASAP is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. - * - * ASAP is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ASAP; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include -#include -#ifdef _WIN32 -#include -#ifdef _MSC_VER -#define strcasecmp _stricmp -#include -#endif -#endif - -#ifdef HAVE_LIBMP3LAME -#define SAMPLE_FORMATS "WAV, RAW or MP3" -#ifndef HAVE_LIBMP3LAME_DLL -#include -#endif -#else -#define SAMPLE_FORMATS "WAV or RAW" -#endif - -#include "asap.h" - -static const char *output_arg = NULL; -static int song = -1; -static ASAPSampleFormat sample_format = ASAPSampleFormat_S16_L_E; -static int duration = -1; -static int mute_mask = 0; -static const char *tag_author = NULL; -static const char *tag_name = NULL; -static const char *tag_date = NULL; -static cibool tag = FALSE; -static int music_address = -1; -static char output_file[FILENAME_MAX]; - -static void print_help(void) -{ - printf( - "Usage: asapconv [OPTIONS] INPUTFILE...\n" - "Each INPUTFILE must be in a supported format:\n" - "SAP, CMC, CM3, CMR, CMS, DMC, DLT, MPT, MPD, RMT, TMC, TM8, TM2 or FC.\n" - "Output EXT must be one of the above or XEX, " SAMPLE_FORMATS ".\n" - "Options:\n" - "-o FILE.EXT --output=FILE.EXT Write to the specified file\n" - "-o .EXT --output=.EXT Use input file path and name\n" - "-o DIR/.EXT --output=DIR/.EXT Write to the specified directory\n" - "-o -.EXT --output=-.EXT Write to standard output\n" - "-a \"TEXT\" --author=\"TEXT\" Set author name\n" - "-n \"TEXT\" --name=\"TEXT\" Set music name\n" - "-d \"TEXT\" --date=\"TEXT\" Set music creation date (DD/MM/YYYY format)\n" - "-h --help Display this information\n" - "-v --version Display version information\n" - "In FILE, DIR and EXT you may use the following placeholders:\n" - "%%a Music author\n" - "%%n Music name\n" - "%%d Music creation date\n" - "%%e Original extension (e.g. \"cmc\")\n" - "Options for " SAMPLE_FORMATS " output:\n" - "-s SONG --song=SONG Select subsong number (zero-based)\n" - "-t TIME --time=TIME Set output length (MM:SS format)\n" - "-m CHANNELS --mute=CHANNELS Mute POKEY channels (1-8)\n" -#ifdef HAVE_LIBMP3LAME - "Options for WAV or RAW output:\n" -#endif - "-b --byte-samples Output 8-bit samples\n" - "-w --word-samples Output 16-bit samples (default)\n" - "Options for XEX, WAV " -#ifdef HAVE_LIBMP3LAME - "or MP3 " -#endif - "output:\n" - " --tag Include metadata in the output file\n" - "Options for SAP output:\n" - "-s SONG --song=SONG Select subsong to set length of\n" - "-t TIME --time=TIME Set subsong length (MM:SS format)\n" - "Options for native modules (output format same as input format):\n" - " --address=HEXNUM Relocate music to the given address\n" - ); -} - -static void fatal_error(const char *format, ...) -{ - va_list args; - va_start(args, format); - fprintf(stderr, "asapconv: "); - vfprintf(stderr, format, args); - fputc('\n', stderr); - va_end(args); - exit(1); -} - -static void set_song(const char *s) -{ - song = 0; - do { - if (*s < '0' || *s > '9') - fatal_error("subsong number must be an integer"); - song = 10 * song + *s++ - '0'; - if (song >= ASAPInfo_MAX_SONGS) - fatal_error("maximum subsong number is %d", ASAPInfo_MAX_SONGS - 1); - } while (*s != '\0'); -} - -static void set_time(const char *s) -{ - duration = ASAPInfo_ParseDuration(s); - if (duration <= 0) - fatal_error("invalid time format"); -} - -static void set_mute_mask(const char *s) -{ - int mask = 0; - while (*s != '\0') { - if (*s >= '1' && *s <= '8') - mask |= 1 << (*s - '1'); - s++; - } - mute_mask = mask; -} - -static void set_music_address(const char *s) -{ - int address = 0; - if (s[0] == '0' && s[1] == 'x') - s += 2; - else if (s[0] == '$') - s++; - do { - int digit = *s++; - if (digit >= '0' && digit <= '9') - digit -= '0'; - else if (digit >= 'A' && digit <= 'F') - digit -= 'A' - 10; - else if (digit >= 'a' && digit <= 'f') - digit -= 'a' - 10; - else - fatal_error("invalid hex number"); - address = (address << 4) + digit; - if (address > 0xffff) - fatal_error("address must be 16-bit"); - } while (*s != '\0'); - music_address = address; -} - -static void apply_tags(const char *input_file, ASAPInfo *info) -{ - if (tag_author != NULL) { - if (!ASAPInfo_SetAuthor(info, tag_author)) - fatal_error("invalid author"); - } - if (tag_name != NULL) { - if (!ASAPInfo_SetTitle(info, tag_name)) - fatal_error("invalid music name"); - tag_name = NULL; - } - if (tag_date != NULL) { - if (!ASAPInfo_SetDate(info, tag_date)) - fatal_error("invalid date"); - } - - if (song < 0) - song = ASAPInfo_GetDefaultSong(info); - else if (song >= ASAPInfo_GetSongs(info)) { - fatal_error("you have requested subsong %d ...\n" - "... but %s contains only %d subsongs", - song, input_file, ASAPInfo_GetSongs(info)); - } -} - -static ASAP *load_module(const char *input_file, const unsigned char *module, int module_len) -{ - ASAP *asap = ASAP_New(); - ASAPInfo *info; - if (asap == NULL) - fatal_error("out of memory"); - if (!ASAP_Load(asap, input_file, module, module_len)) - fatal_error("%s: unsupported file", input_file); - info = (ASAPInfo *) ASAP_GetInfo(asap); /* FIXME: avoid cast */ - apply_tags(input_file, info); - if (duration < 0) { - duration = ASAPInfo_GetDuration(info, song); - if (duration < 0) - duration = 180 * 1000; - } - if (!ASAP_PlaySong(asap, song, duration)) - fatal_error("%s: PlaySong failed", input_file); - ASAP_MutePokeyChannels(asap, mute_mask); - return asap; -} - -static FILE *open_output_file(const char *input_file, const unsigned char *module, int module_len, const ASAPInfo *info) -{ - const char *output_ext = strrchr(output_arg, '.'); - const char *pattern_ptr; - char *output_ptr; - FILE *fp; - if (output_ext == output_arg) { - /* .EXT */ - } - else if (output_ext == output_arg + 1 && output_arg[0] == '-') { - /* -.EXT */ - strcpy(output_file, "stdout"); -#ifdef _WIN32 - _setmode(_fileno(stdout), _O_BINARY); -#endif - return stdout; - } - else if (output_ext[-1] == '/' || output_ext[-1] == '\\') { - /* DIR/.EXT */ - const char *p; - for (p = input_file; *p != '\0'; p++) - if (*p == '/' || *p == '\\') - input_file = p + 1; - } - else { - /* FILE.EXT */ - output_ext = NULL; /* don't insert input_file */ - } - - output_ptr = output_file; - for (pattern_ptr = output_arg; *pattern_ptr != '\0'; pattern_ptr++) { - char c; - if (pattern_ptr == output_ext) { - /* insert input_file without the extension */ - size_t len = strrchr(input_file, '.') - input_file; - if (output_ptr + len >= output_file + sizeof(output_file)) - fatal_error("filename too long"); - memcpy(output_ptr, input_file, len); - output_ptr += len; - } - c = *pattern_ptr; - if (c == '%') { - const char *tag; - c = *++pattern_ptr; - switch (c) { - case 'a': - tag = ASAPInfo_GetAuthor(info); - break; - case 'n': - tag = ASAPInfo_GetTitleOrFilename(info); - break; - case 'd': - tag = ASAPInfo_GetDate(info); - break; - case 'e': - tag = ASAPInfo_GetOriginalModuleExt(info, module, module_len); - if (tag == NULL) - tag = "unknown"; - break; - case '%': - tag = "%"; - break; - default: - fatal_error("unrecognized %%%c", c); - return 0; - } - while (*tag != '\0') { - if (output_ptr >= output_file + sizeof(output_file) - 1) - fatal_error("filename too long"); - c = *tag++; - switch (c) { - case '<': - case '>': - case ':': - case '/': - case '\\': - case '|': - case '?': - case '*': - c = '_'; - break; - default: - break; - } - *output_ptr++ = c; - } - } - else { - if (output_ptr >= output_file + sizeof(output_file) - 1) - fatal_error("filename too long"); - *output_ptr++ = c; - } - } - *output_ptr = '\0'; - - fp = fopen(output_file, "wb"); - if (fp == NULL) - fatal_error("cannot write %s", output_file); - return fp; -} - -static void write_output_file(FILE *fp, unsigned char *buffer, int n_bytes) -{ - if (fwrite(buffer, 1, n_bytes, fp) != n_bytes) { - fclose(fp); - fatal_error("error writing to %s", output_file); - } -} - -static void close_output_file(FILE *fp) -{ - if (fp != stdout) { - if (fclose(fp) != 0) - fatal_error("error closing %s", output_file); - } -} - -static void convert_to_wav(const char *input_file, const unsigned char *module, int module_len, cibool output_header) -{ - ASAP *asap = load_module(input_file, module, module_len); - FILE *fp = open_output_file(input_file, module, module_len, ASAP_GetInfo(asap)); - int n_bytes; - static unsigned char buffer[8192]; - - if (output_header) { - n_bytes = ASAP_GetWavHeader(asap, buffer, sample_format, tag); - fwrite(buffer, 1, n_bytes, fp); - } - do { - n_bytes = ASAP_Generate(asap, buffer, sizeof(buffer), sample_format); - write_output_file(fp, buffer, n_bytes); - } while (n_bytes == sizeof(buffer)); - close_output_file(fp); -} - -#ifdef HAVE_LIBMP3LAME - -#ifdef HAVE_LIBMP3LAME_DLL - -#include - -typedef struct lame_global_struct *lame_global_flags; -typedef lame_global_flags *(*plame_init)(void); -typedef int (*plame_set_num_samples)(lame_global_flags *, unsigned long); -typedef int (*plame_set_in_samplerate)(lame_global_flags *, int); -typedef int (*plame_set_num_channels)(lame_global_flags *, int); -typedef int (*plame_init_params)(lame_global_flags *); -typedef int (*plame_encode_buffer_interleaved)(lame_global_flags *, short int[], int, unsigned char *, int); -typedef int (*plame_encode_flush)(lame_global_flags *, unsigned char *, int); -typedef int (*plame_close)(lame_global_flags *); -typedef int (*pid3tag_init)(lame_global_flags *); -typedef int (*pid3tag_set_title)(lame_global_flags *, const char *); -typedef int (*pid3tag_set_artist)(lame_global_flags *, const char *); -typedef int (*pid3tag_set_year)(lame_global_flags *, const char *); -typedef int (*pid3tag_set_genre)(lame_global_flags *, const char *); -#define LAME_OKAY 0 - -static HMODULE lame_load(void) -{ - HMODULE lame_dll = LoadLibrary("libmp3lame.dll"); - if (lame_dll != NULL) - return lame_dll; - lame_dll = LoadLibrary("lame_enc.dll"); - if (lame_dll != NULL) - return lame_dll; - fatal_error("libmp3lame.dll and lame_enc.dll not found"); - return NULL; -} - -static FARPROC lame_proc(HMODULE lame_dll, const char *name) -{ - FARPROC proc = GetProcAddress(lame_dll, name); - if (proc == NULL) { - char dll_name[FILENAME_MAX]; - GetModuleFileName(lame_dll, dll_name, FILENAME_MAX); - fatal_error("%s not found in %s", name, dll_name); - } - return proc; -} - -#define LAME_FUNC(name) p##name name = (p##name) lame_proc(lame_dll, #name) - -#endif - -static void convert_to_mp3(const char *input_file, const unsigned char *module, int module_len) -{ - ASAP *asap = load_module(input_file, module, module_len); - const ASAPInfo *info = ASAP_GetInfo(asap); - int channels = ASAPInfo_GetChannels(info); - FILE *fp; - int n_bytes; - static unsigned char buffer[8192]; - lame_global_flags *lame = NULL; - static unsigned char mp3buf[4096 * 5 / 4 + 7200]; - int mp3_bytes; - -#ifdef HAVE_LIBMP3LAME_DLL - HMODULE lame_dll = lame_load(); - LAME_FUNC(lame_init); - LAME_FUNC(lame_set_num_samples); - LAME_FUNC(lame_set_in_samplerate); - LAME_FUNC(lame_set_num_channels); - LAME_FUNC(lame_init_params); - LAME_FUNC(lame_encode_buffer_interleaved); - LAME_FUNC(lame_encode_flush); - LAME_FUNC(lame_close); -#endif - lame = lame_init(); - if (lame == NULL) - fatal_error("lame_init failed"); - if (lame_set_num_samples(lame, duration * (ASAP_SAMPLE_RATE / 100) / 10) != LAME_OKAY - || lame_set_in_samplerate(lame, ASAP_SAMPLE_RATE) != LAME_OKAY - || lame_set_num_channels(lame, channels) != LAME_OKAY) - fatal_error("lame_set_* failed"); - if (lame_init_params(lame) != LAME_OKAY) - fatal_error("lame_init_params failed"); - if (tag) { -#ifdef HAVE_LIBMP3LAME_DLL - LAME_FUNC(id3tag_init); - LAME_FUNC(id3tag_set_title); - LAME_FUNC(id3tag_set_artist); - LAME_FUNC(id3tag_set_year); - LAME_FUNC(id3tag_set_genre); -#endif - const char *s; - int year; - id3tag_init(lame); - s = ASAPInfo_GetTitle(info); - if (s[0] != '\0') - id3tag_set_title(lame, s); - s = ASAPInfo_GetAuthor(info); - if (s[0] != '\0') - id3tag_set_artist(lame, s); - year = ASAPInfo_GetYear(info); - if (year > 0) { - char year_string[16]; - sprintf(year_string, "%d", year); - id3tag_set_year(lame, year_string); - } - id3tag_set_genre(lame, "Electronic"); - } - fp = open_output_file(input_file, module, module_len, info); - do { - static short pcm[8192]; - int i; - short *p = pcm; - n_bytes = ASAP_Generate(asap, buffer, sizeof(buffer), ASAPSampleFormat_S16_L_E); - for (i = 0; i < n_bytes; i += 2) { - *p++ = buffer[i] + (buffer[i + 1] << 8); - if (channels == 1) - p++; - } - mp3_bytes = lame_encode_buffer_interleaved(lame, pcm, n_bytes >> channels, mp3buf, sizeof(mp3buf)); - if (mp3_bytes < 0) - fatal_error("lame_encode_buffer_interleaved failed"); - write_output_file(fp, mp3buf, mp3_bytes); - } while (n_bytes == sizeof(buffer)); - mp3_bytes = lame_encode_flush(lame, mp3buf, sizeof(mp3buf)); - if (mp3_bytes < 0) - fatal_error("lame_encode_flush failed"); - write_output_file(fp, mp3buf, mp3_bytes); - lame_close(lame); - close_output_file(fp); -} - -#endif /* HAVE_LIBMP3LAME */ - -static void write_byte(void *obj, int data) -{ - putc(data, (FILE *) obj); -} - -static void convert_to_module(const char *input_file, const unsigned char *module, int module_len, const char *output_ext) -{ - const char *input_ext; - ASAPInfo *info; - FILE *fp; - ByteWriter bw; - - input_ext = strrchr(input_file, '.'); - if (input_ext == NULL) - fatal_error("%s: missing extension", input_file); - input_ext++; - info = ASAPInfo_New(); - if (info == NULL) - fatal_error("out of memory"); - if (!ASAPInfo_Load(info, input_file, module, module_len)) - fatal_error("%s: unsupported file", input_file); - apply_tags(input_file, info); - if (duration >= 0) - ASAPInfo_SetDuration(info, song, duration); - if (music_address >= 0) - ASAPInfo_SetMusicAddress(info, music_address); - - fp = open_output_file(input_file, module, module_len, info); - bw.obj = fp; - bw.func = write_byte; - /* FIXME: stdout */ - if (!ASAPWriter_Write(output_file, bw, info, module, module_len, tag)) { - if (fp != stdout) { - fclose(fp); - remove(output_file); /* "unlink" is less portable */ - } - fatal_error("%s: conversion error", input_file); - } - close_output_file(fp); -} - -static void process_file(const char *input_file) -{ - FILE *fp; - static unsigned char module[ASAPInfo_MAX_MODULE_LENGTH]; - int module_len; - const char *output_ext; - - if (output_arg == NULL) - fatal_error("the -o/--output option is mandatory"); - fp = fopen(input_file, "rb"); - if (fp == NULL) - fatal_error("cannot open %s", input_file); - module_len = fread(module, 1, sizeof(module), fp); - fclose(fp); - - output_ext = strrchr(output_arg, '.'); - if (output_ext == NULL) - fatal_error("missing .EXT in -o/--output"); - output_ext++; - if (strcasecmp(output_ext, "wav") == 0) - convert_to_wav(input_file, module, module_len, TRUE); - else if (strcasecmp(output_ext, "raw") == 0) - convert_to_wav(input_file, module, module_len, FALSE); - else if (strcasecmp(output_ext, "mp3") == 0) { -#ifdef HAVE_LIBMP3LAME - convert_to_mp3(input_file, module, module_len); -#else - fatal_error("this build of asapconv doesn't support MP3"); -#endif - } - else - convert_to_module(input_file, module, module_len, output_ext); - - song = -1; - duration = -1; -} - -int main(int argc, char *argv[]) -{ - const char *options_error = "no input files"; - int i; - for (i = 1; i < argc; i++) { - const char *arg = argv[i]; - if (arg[0] != '-') { - process_file(arg); - options_error = NULL; - continue; - } - options_error = "options must be specified before the input file"; -#define is_opt(c) (arg[1] == c && arg[2] == '\0') - if (is_opt('o')) - output_arg = argv[++i]; - else if (strncmp(arg, "--output=", 9) == 0) - output_arg = arg + 9; - else if (is_opt('s')) - set_song(argv[++i]); - else if (strncmp(arg, "--song=", 7) == 0) - set_song(arg + 7); - else if (is_opt('t')) - set_time(argv[++i]); - else if (strncmp(arg, "--time=", 7) == 0) - set_time(arg + 7); - else if (is_opt('b') || strcmp(arg, "--byte-samples") == 0) - sample_format = ASAPSampleFormat_U8; - else if (is_opt('w') || strcmp(arg, "--word-samples") == 0) - sample_format = ASAPSampleFormat_S16_L_E; - else if (is_opt('m')) - set_mute_mask(argv[++i]); - else if (strncmp(arg, "--mute=", 7) == 0) - set_mute_mask(arg + 7); - else if (is_opt('a')) - tag_author = argv[++i]; - else if (strncmp(arg, "--author=", 9) == 0) - tag_author = arg + 9; - else if (is_opt('n')) - tag_name = argv[++i]; - else if (strncmp(arg, "--name=", 7) == 0) - tag_name = arg + 7; - else if (is_opt('d')) - tag_date = argv[++i]; - else if (strncmp(arg, "--date=", 7) == 0) - tag_date = arg + 7; - else if (strcmp(arg, "--tag") == 0) - tag = TRUE; - else if (strncmp(arg, "--address=", 10) == 0) - set_music_address(arg + 10); - else if (is_opt('h') || strcmp(arg, "--help") == 0) { - print_help(); - options_error = NULL; - } - else if (is_opt('v') || strcmp(arg, "--version") == 0) { - printf("asapconv " ASAPInfo_VERSION "\n"); - options_error = NULL; - } - else - fatal_error("unknown option: %s", arg); - } - if (options_error != NULL) { - fprintf(stderr, "asapconv: %s\n", options_error); - print_help(); - return 1; - } - return 0; -} diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/asap.h kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/asap.h --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/asap.h 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/asap.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,429 +0,0 @@ -/* Generated automatically with "cito". Do not edit. */ -#ifndef _ASAP_H_ -#define _ASAP_H_ -typedef int cibool; -#ifndef TRUE -#define TRUE 1 -#endif -#ifndef FALSE -#define FALSE 0 -#endif -#ifdef __cplusplus -extern "C" { -#endif -typedef struct ASAP ASAP; -typedef struct ASAPInfo ASAPInfo; - -/** - * Format of output samples. - */ -typedef enum { - /** - * Unsigned 8-bit. - */ - ASAPSampleFormat_U8, - /** - * Signed 16-bit little-endian. - */ - ASAPSampleFormat_S16_L_E, - /** - * Signed 16-bit big-endian. - */ - ASAPSampleFormat_S16_B_E -} -ASAPSampleFormat; - -typedef struct -{ - void *obj; - void (*func)(void *obj, int data); -} -ByteWriter; - -typedef struct -{ - void *obj; - void (*func)(void *obj, const char *s); -} -StringConsumer; - -ASAP *ASAP_New(void); -void ASAP_Delete(ASAP *self); - -/** - * Enables silence detection. - * Causes playback to stop after the specified period of silence. - * @param seconds Length of silence which ends playback. Zero disables silence detection. - */ -void ASAP_DetectSilence(ASAP *self, int seconds); - -/** - * Fills the specified buffer with generated samples. - * @param buffer The destination buffer. - * @param bufferLen Number of bytes to fill. - * @param format Format of samples. - */ -int ASAP_Generate(ASAP *self, unsigned char *buffer, int bufferLen, ASAPSampleFormat format); - -/** - * Returns current playback position in blocks. - * A block is one sample or a pair of samples for stereo. - */ -int ASAP_GetBlocksPlayed(ASAP const *self); - -/** - * Returns information about the loaded module. - */ -ASAPInfo const *ASAP_GetInfo(ASAP const *self); - -/** - * Returns POKEY channel volume - an integer between 0 and 15. - * @param channel POKEY channel number (from 0 to 7). - */ -int ASAP_GetPokeyChannelVolume(ASAP const *self, int channel); - -/** - * Returns current playback position in milliseconds. - */ -int ASAP_GetPosition(ASAP const *self); - -/** - * Fills leading bytes of the specified buffer with WAV file header. - * Returns the number of changed bytes. - * @param buffer The destination buffer. - * @param format Format of samples. - * @param metadata Include metadata (title, author, date). - */ -int ASAP_GetWavHeader(ASAP const *self, unsigned char *buffer, ASAPSampleFormat format, cibool metadata); - -/** - * Loads music data ("module"). - * @param filename Filename, used to determine the format. - * @param module Contents of the file. - * @param moduleLen Length of the file. - */ -cibool ASAP_Load(ASAP *self, const char *filename, unsigned char const *module, int moduleLen); - -/** - * Mutes the selected POKEY channels. - * @param mask An 8-bit mask which selects POKEY channels to be muted. - */ -void ASAP_MutePokeyChannels(ASAP *self, int mask); - -/** - * Prepares playback of the specified song of the loaded module. - * @param song Zero-based song index. - * @param duration Playback time in milliseconds, -1 means infinity. - */ -cibool ASAP_PlaySong(ASAP *self, int song, int duration); - -/** - * Output sample rate. - */ -#define ASAP_SAMPLE_RATE 44100 - -/** - * Changes the playback position. - * @param position The requested absolute position in milliseconds. - */ -cibool ASAP_Seek(ASAP *self, int position); - -/** - * Changes the playback position. - * @param block The requested absolute position in samples (always 44100 per second, even in stereo). - */ -cibool ASAP_SeekSample(ASAP *self, int block); - -ASAPInfo *ASAPInfo_New(void); -void ASAPInfo_Delete(ASAPInfo *self); - -/** - * Short license notice. - * Display after the credits. - */ -#define ASAPInfo_COPYRIGHT "This program is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published\nby the Free Software Foundation; either version 2 of the License,\nor (at your option) any later version." - -/** - * Short credits for ASAP. - */ -#define ASAPInfo_CREDITS "Another Slight Atari Player (C) 2005-2013 Piotr Fusik\nCMC, MPT, TMC, TM2 players (C) 1994-2005 Marcin Lewandowski\nRMT player (C) 2002-2005 Radek Sterba\nDLT player (C) 2009 Marek Konopka\nCMS player (C) 1999 David Spilka\nFC player (C) 2011 Jerzy Kut\n" - -/** - * Returns author's name. - * A nickname may be included in parentheses after the real name. - * Multiple authors are separated with " & ". - * An empty string means the author is unknown. - */ -const char *ASAPInfo_GetAuthor(ASAPInfo const *self); - -/** - * Returns 1 for mono or 2 for stereo. - */ -int ASAPInfo_GetChannels(ASAPInfo const *self); - -int ASAPInfo_GetCovoxAddress(ASAPInfo const *self); - -/** - * Returns music creation date. - * Some of the possible formats are: - *
    - *
  • YYYY
  • - *
  • MM/YYYY
  • - *
  • DD/MM/YYYY
  • - *
  • YYYY-YYYY
  • - *
- * An empty string means the date is unknown. - */ -const char *ASAPInfo_GetDate(ASAPInfo const *self); - -/** - * Returns day of month of the music creation date. - * -1 means the day is unknown. - */ -int ASAPInfo_GetDayOfMonth(ASAPInfo const *self); - -/** - * Returns 0-based index of the "main" song. - * The specified song should be played by default. - */ -int ASAPInfo_GetDefaultSong(ASAPInfo const *self); - -/** - * Returns length of the specified song. - * The length is specified in milliseconds. -1 means the length is indeterminate. - */ -int ASAPInfo_GetDuration(ASAPInfo const *self, int song); - -/** - * Returns human-readable description of the filename extension. - * @param ext Filename extension without the leading dot. - */ -const char *ASAPInfo_GetExtDescription(const char *ext); - -int ASAPInfo_GetInitAddress(ASAPInfo const *self); - -const char *ASAPInfo_GetInstrumentName(ASAPInfo const *self, unsigned char const *module, int moduleLen, int i); - -/** - * Returns information whether the specified song loops. - * Returns: - *
    - *
  • true if the song loops
  • - *
  • false if the song stops
  • - *
- * - */ -cibool ASAPInfo_GetLoop(ASAPInfo const *self, int song); - -/** - * Returns music creation month (1-12). - * -1 means the month is unknown. - */ -int ASAPInfo_GetMonth(ASAPInfo const *self); - -int ASAPInfo_GetMusicAddress(ASAPInfo const *self); - -/** - * Returns the extension of the original module format. - * For native modules it simply returns their extension. - * For the SAP format it attempts to detect the original module format. - * @param module Contents of the file. - * @param moduleLen Length of the file. - */ -const char *ASAPInfo_GetOriginalModuleExt(ASAPInfo const *self, unsigned char const *module, int moduleLen); - -int ASAPInfo_GetPlayerAddress(ASAPInfo const *self); - -int ASAPInfo_GetPlayerRateHz(ASAPInfo const *self); - -int ASAPInfo_GetPlayerRateScanlines(ASAPInfo const *self); - -int ASAPInfo_GetSapHeaderLength(ASAPInfo const *self); - -/** - * Returns number of songs in the file. - */ -int ASAPInfo_GetSongs(ASAPInfo const *self); - -/** - * Returns music title. - * An empty string means the title is unknown. - */ -const char *ASAPInfo_GetTitle(ASAPInfo const *self); - -/** - * Returns music title or filename. - * If title is unknown returns filename without the path or extension. - */ -const char *ASAPInfo_GetTitleOrFilename(ASAPInfo const *self); - -int ASAPInfo_GetTypeLetter(ASAPInfo const *self); - -/** - * Returns music creation year. - * -1 means the year is unknown. - */ -int ASAPInfo_GetYear(ASAPInfo const *self); - -/** - * Returns true for NTSC song and false for PAL song. - */ -cibool ASAPInfo_IsNtsc(ASAPInfo const *self); - -/** - * Checks whether the filename extension represents a module type supported by ASAP. - * Returns true if the filename extension is supported by ASAP. - * @param ext Filename extension without the leading dot. - */ -cibool ASAPInfo_IsOurExt(const char *ext); - -/** - * Checks whether the filename represents a module type supported by ASAP. - * Returns true if the filename is supported by ASAP. - * @param filename Filename to check the extension of. - */ -cibool ASAPInfo_IsOurFile(const char *filename); - -/** - * Loads file information. - * @param filename Filename, used to determine the format. - * @param module Contents of the file. - * @param moduleLen Length of the file. - */ -cibool ASAPInfo_Load(ASAPInfo *self, const char *filename, unsigned char const *module, int moduleLen); - -/** - * Maximum length of a supported input file. - * You may assume that files longer than this are not supported by ASAP. - */ -#define ASAPInfo_MAX_MODULE_LENGTH 65000 - -/** - * Maximum number of songs in a file. - */ -#define ASAPInfo_MAX_SONGS 32 - -/** - * Maximum length of text metadata. - */ -#define ASAPInfo_MAX_TEXT_LENGTH 127 - -/** - * Returns the number of milliseconds represented by the given string. - * @param s Time in the "mm:ss.xxx" format. - */ -int ASAPInfo_ParseDuration(const char *s); - -/** - * Sets author's name. - * A nickname may be included in parentheses after the real name. - * Multiple authors are separated with " & ". - * An empty string means the author is unknown. - */ -cibool ASAPInfo_SetAuthor(ASAPInfo *self, const char *value); - -/** - * Sets music creation date. - * Some of the possible formats are: - *
    - *
  • YYYY
  • - *
  • MM/YYYY
  • - *
  • DD/MM/YYYY
  • - *
  • YYYY-YYYY
  • - *
- * An empty string means the date is unknown. - */ -cibool ASAPInfo_SetDate(ASAPInfo *self, const char *value); - -/** - * Sets length of the specified song. - * The length is specified in milliseconds. -1 means the length is indeterminate. - */ -cibool ASAPInfo_SetDuration(ASAPInfo *self, int song, int duration); - -/** - * Sets information whether the specified song loops. - * Use: - *
    - *
  • true if the song loops
  • - *
  • false if the song stops
  • - *
- * - */ -cibool ASAPInfo_SetLoop(ASAPInfo *self, int song, cibool loop); - -/** - * Causes music to be relocated. - * Use only with ASAPWriter.Write. - */ -cibool ASAPInfo_SetMusicAddress(ASAPInfo *self, int address); - -/** - * Sets music title. - * An empty string means the title is unknown. - */ -cibool ASAPInfo_SetTitle(ASAPInfo *self, const char *value); - -/** - * ASAP version as a string. - */ -#define ASAPInfo_VERSION "3.1.5" - -/** - * ASAP version - major part. - */ -#define ASAPInfo_VERSION_MAJOR 3 - -/** - * ASAP version - micro part. - */ -#define ASAPInfo_VERSION_MICRO 5 - -/** - * ASAP version - minor part. - */ -#define ASAPInfo_VERSION_MINOR 1 - -/** - * Years ASAP was created in. - */ -#define ASAPInfo_YEARS "2005-2013" - -/** - * Writes text representation of the given duration. - * Returns the number of bytes written to result. - * @param result The output buffer. - * @param value Number of milliseconds. - */ -int ASAPWriter_DurationToString(unsigned char *result, int value); - -/** - * Enumerates possible file types the given module can be written as. - * @param output Receives filename extensions without the leading dot. - * @param info File information. - * @param module Contents of the file. - * @param moduleLen Length of the file. - */ -void ASAPWriter_EnumSaveExts(StringConsumer output, ASAPInfo const *info, unsigned char const *module, int moduleLen); - -/** - * Maximum length of text representation of a duration. - * Corresponds to the longest format which is "mm:ss.xxx". - */ -#define ASAPWriter_MAX_DURATION_LENGTH 9 - -/** - * Writes the given module in a possibly different file format. - * @param targetFilename Output filename, used to determine the format. - * @param w Receives output file contents. - * @param info File information got from the source file with data updated for the output file. - * @param module Contents of the source file. - * @param moduleLen Length of the source file. - * @param tag Display information (xex output only). - */ -cibool ASAPWriter_Write(const char *targetFilename, ByteWriter w, ASAPInfo const *info, unsigned char const *module, int moduleLen, cibool tag); - -#ifdef __cplusplus -} -#endif -#endif diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/asapinfo.ci kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/asapinfo.ci --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/asapinfo.ci 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/asapinfo.ci 1970-01-01 00:00:00.000000000 +0000 @@ -1,1846 +0,0 @@ -// asapinfo.ci - module parser -// -// Copyright (C) 2010-2013 Piotr Fusik -// -// This file is part of ASAP (Another Slight Atari Player), -// see http://asap.sourceforge.net -// -// ASAP is free software; you can redistribute it and/or modify it -// under the terms of the GNU General Public License as published -// by the Free Software Foundation; either version 2 of the License, -// or (at your option) any later version. -// -// ASAP is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -// See the GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ASAP; if not, write to the Free Software Foundation, Inc., -// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -enum ASAPModuleType -{ - SapB, - SapC, - SapD, - SapS, - Cmc, - Cm3, - Cmr, - Cms, - Dlt, - Mpt, - Rmt, - Tmc, - Tm2, - Fc -#if EXPERIMENTAL_XEX - // actually it works, but without VBLKI it's practically useless - , Xex -#endif -} - -/// Information about a music file. -public class ASAPInfo -{ - /// ASAP version - major part. - public const int VersionMajor = 3; - /// ASAP version - minor part. - public const int VersionMinor = 1; - /// ASAP version - micro part. - public const int VersionMicro = 5; - /// ASAP version as a string. - public const string Version = VersionMajor + "." + VersionMinor + "." + VersionMicro; - - /// Years ASAP was created in. - public const string Years = "2005-2013"; - - /// Short credits for ASAP. - public const string Credits = - "Another Slight Atari Player (C) " + Years + " Piotr Fusik\n" + - "CMC, MPT, TMC, TM2 players (C) 1994-2005 Marcin Lewandowski\n" + - "RMT player (C) 2002-2005 Radek Sterba\n" + - "DLT player (C) 2009 Marek Konopka\n" + - "CMS player (C) 1999 David Spilka\n" + - "FC player (C) 2011 Jerzy Kut\n"; - - /// Short license notice. - /// Display after the credits. - public const string Copyright = - "This program is free software; you can redistribute it and/or modify\n" + - "it under the terms of the GNU General Public License as published\n" + - "by the Free Software Foundation; either version 2 of the License,\n" + - "or (at your option) any later version."; - - /// Maximum length of a supported input file. - /// You may assume that files longer than this are not supported by ASAP. - public const int MaxModuleLength = 65000; - - /// Maximum length of text metadata. - public const int MaxTextLength = 127; - - /// Maximum number of songs in a file. - public const int MaxSongs = 32; - - string(MaxTextLength) Filename; - string(MaxTextLength) Author; - string(MaxTextLength) Title; - string(MaxTextLength) Date; - int Channels; - int Songs; - int DefaultSong; - int[MaxSongs] Durations; - bool[MaxSongs] Loops; - bool Ntsc; - ASAPModuleType Type; - int Fastplay; - int Music; - int Init; - int Player; - int CovoxAddr; - int HeaderLen; - byte[MaxSongs] SongPos; - - static bool IsValidChar(int c) - { - return c >= ' ' && c <= '|' && c != '`' && c != '{'; - } - - static void CheckValidChar(int c) - { - if (!IsValidChar(c)) - throw "Invalid character"; - } - - static void CheckValidText(string s) - { - int n = s.Length; - if (n > MaxTextLength) - throw "Text too long"; - for (int i = 0; i < n; i++) - CheckValidChar(s[i]); - } - - /// Returns author's name. - /// A nickname may be included in parentheses after the real name. - /// Multiple authors are separated with `" & "`. - /// An empty string means the author is unknown. - public string GetAuthor() - { - return Author; - } - - /// Sets author's name. - /// A nickname may be included in parentheses after the real name. - /// Multiple authors are separated with `" & "`. - /// An empty string means the author is unknown. - public void SetAuthor(string value) - { - CheckValidText(value); - Author = value; - } - - /// Returns music title. - /// An empty string means the title is unknown. - public string GetTitle() - { - return Title; - } - - /// Sets music title. - /// An empty string means the title is unknown. - public void SetTitle(string value) - { - CheckValidText(value); - Title = value; - } - - /// Returns music title or filename. - /// If title is unknown returns filename without the path or extension. - public string GetTitleOrFilename() - { - return Title.Length > 0 ? Title : Filename; - } - - /// Returns music creation date. - /// Some of the possible formats are: - /// * YYYY - /// * MM/YYYY - /// * DD/MM/YYYY - /// * YYYY-YYYY - /// - /// An empty string means the date is unknown. - public string GetDate() - { - return Date; - } - - /// Sets music creation date. - /// Some of the possible formats are: - /// * YYYY - /// * MM/YYYY - /// * DD/MM/YYYY - /// * YYYY-YYYY - /// - /// An empty string means the date is unknown. - public void SetDate(string value) - { - CheckValidText(value); - Date = value; - } - - bool CheckTwoDateDigits(int i) - { - int d1 = Date[i]; - int d2 = Date[i + 1]; - return d1 >= '0' && d1 <= '9' && d2 >= '0' && d2 <= '9'; - } - - int CheckDate() - { - int n = Date.Length; - switch (n) { - case 10: - if (!CheckTwoDateDigits(0) || Date[2] != '/') - return -1; - goto case 7; - case 7: - if (!CheckTwoDateDigits(n - 7) || Date[n - 5] != '/') - return -1; - goto case 4; - case 4: - if (!CheckTwoDateDigits(n - 4) || !CheckTwoDateDigits(n - 2)) - return -1; - return n; - default: - return -1; - } - } - - int GetTwoDateDigits(int i) - { - return (Date[i] - '0') * 10 + Date[i + 1] - '0'; - } - - /// Returns music creation year. - /// -1 means the year is unknown. - public int GetYear() - { - int n = CheckDate(); - if (n < 0) - return -1; - return GetTwoDateDigits(n - 4) * 100 + GetTwoDateDigits(n - 2); - } - - /// Returns music creation month (1-12). - /// -1 means the month is unknown. - public int GetMonth() - { - int n = CheckDate(); - if (n < 7) - return -1; - return GetTwoDateDigits(n - 7); - } - - /// Returns day of month of the music creation date. - /// -1 means the day is unknown. - public int GetDayOfMonth() - { - int n = CheckDate(); - if (n != 10) - return -1; - return GetTwoDateDigits(0); - } - - /// Returns 1 for mono or 2 for stereo. - public int GetChannels() - { - return Channels; - } - - /// Returns number of songs in the file. - public int GetSongs() - { - return Songs; - } - - /// Returns 0-based index of the "main" song. - /// The specified song should be played by default. - public int GetDefaultSong() - { - return DefaultSong; - } - - /// Returns length of the specified song. - /// The length is specified in milliseconds. -1 means the length is indeterminate. - public int GetDuration(int song) - { - return Durations[song]; - } - - /// Sets length of the specified song. - /// The length is specified in milliseconds. -1 means the length is indeterminate. - public void SetDuration(int song, int duration) - { - if (song < 0 || song >= Songs) - throw "Song out of range"; - Durations[song] = duration; - } - - /// Returns information whether the specified song loops. - /// Returns: - /// * `true` if the song loops - /// * `false` if the song stops - public bool GetLoop(int song) - { - return Loops[song]; - } - - /// Sets information whether the specified song loops. - /// Use: - /// * `true` if the song loops - /// * `false` if the song stops - public void SetLoop(int song, bool loop) - { - if (song < 0 || song >= Songs) - throw "Song out of range"; - Loops[song] = loop; - } - - /// Returns `true` for NTSC song and `false` for PAL song. - public bool IsNtsc() - { - return Ntsc; - } - - public int GetTypeLetter() - { - switch (Type) { - case ASAPModuleType.SapB: return 'B'; - case ASAPModuleType.SapC: return 'C'; - case ASAPModuleType.SapD: return 'D'; - case ASAPModuleType.SapS: return 'S'; - default: return 0; - } - } - - public int GetPlayerRateScanlines() - { - return Fastplay; - } - - public int GetPlayerRateHz() - { - int scanlineClock = Ntsc ? 1789772 / 114 : 1773447 / 114; - return (scanlineClock + (Fastplay >> 1)) / Fastplay; - } - - public int GetMusicAddress() - { - return Music; - } - - /// Causes music to be relocated. - /// Use only with `ASAPWriter.Write`. - public void SetMusicAddress(int address) - { - if (address < 0 || address >= 0xffff) - throw "Invalid music address"; - Music = address; - } - - public int GetInitAddress() - { - return Init; - } - - public int GetPlayerAddress() - { - return Player; - } - - public int GetCovoxAddress() - { - return CovoxAddr; - } - - public int GetSapHeaderLength() - { - return HeaderLen; - } - -#if C - public string GetInstrumentName(byte[] module, int moduleLen, int i) - { - if (Type != ASAPModuleType.Rmt) - return null; - for (int offset = GetWord(module, 4) - GetWord(module, 2) + 12; offset < moduleLen; offset++) { - // skip title and i instruments - if (module[offset - 1] == 0 && --i == -1) { - native { - return (const char *) module + offset; - } - } - } - return null; - } -#endif - - static int GetWord(byte[] array, int i) - { - return array[i] + (array[i + 1] << 8); - } - - void ParseModule(byte[] module, int moduleLen) - { - if ((module[0] != 0xff || module[1] != 0xff) - && (module[0] != 0 || module[1] != 0)) // some CMC and clones start with zeros - throw "Invalid two leading bytes of the module"; - Music = GetWord(module, 2); - int musicLastByte = GetWord(module, 4); - if (Music <= 0xd7ff && musicLastByte >= 0xd000) - throw "Module address conflicts with hardware registers"; - int blockLen = musicLastByte + 1 - Music; - if (6 + blockLen != moduleLen) { - if (Type != ASAPModuleType.Rmt || 11 + blockLen > moduleLen) - throw "Module length doesn't match headers"; - // allow optional info for Raster Music Tracker - int infoAddr = GetWord(module, 6 + blockLen); - if (infoAddr != Music + blockLen) - throw "Invalid address of RMT info"; - int infoLen = GetWord(module, 8 + blockLen) + 1 - infoAddr; - if (10 + blockLen + infoLen != moduleLen) - throw "Invalid RMT info block"; - } - } - - void AddSong(int playerCalls) - { - Durations[Songs++] = (playerCalls * Fastplay).MulDiv(114000 / 3, 1773447 / 3); - } - - // TODO: enum + 0 - const int SeenThisCall = 1; - const int SeenBefore = 2; - const int SeenRepeat = 3; - - void ParseCmcSong(byte[] module, int pos) - { - int tempo = module[0x19]; - int playerCalls = 0; - int repStartPos = 0; - int repEndPos = 0; - int repTimes = 0; - byte[0x55] seen = 0; - while (pos >= 0 && pos < 0x55) { - if (pos == repEndPos && repTimes > 0) { - for (int i = 0; i < 0x55; i++) - if (seen[i] == SeenThisCall || seen[i] == SeenRepeat) - seen[i] = 0; - repTimes--; - pos = repStartPos; - } - if (seen[pos] != 0) { - if (seen[pos] != SeenThisCall) - Loops[Songs] = true; - break; - } - seen[pos] = SeenThisCall; - int p1 = module[0x206 + pos]; - int p2 = module[0x25b + pos]; - int p3 = module[0x2b0 + pos]; - if (p1 == 0xfe || p2 == 0xfe || p3 == 0xfe) { - pos++; - continue; - } - p1 |= Type == ASAPModuleType.Cms ? 7 : 0xf; - switch (p1) { - case 0x87: // CMS VOLUME - case 0xa7: // CMS MODE - pos++; - break; - case 0x8f: // STOP - pos = -1; - break; - case 0x97: // CMS PAUSE - if (p2 < 128) { - playerCalls += p2; - if (p3 < 128) - playerCalls += p3 * 50; - } - pos++; - break; - case 0x9f: // JUMP - pos = p2; - break; - case 0xaf: // UP - pos -= p2; - break; - case 0xbf: // DOWN - pos += p2; - break; - case 0xcf: // TEMPO - if (p2 < 128) { - tempo = p2; - pos++; - } - else - pos = -1; - break; - case 0xdf: // REPLAY - pos++; - repStartPos = pos; - repEndPos = pos + p2; - repTimes = p3 - 1; - break; - case 0xef: // BREAK - Loops[Songs] = true; - pos = -1; - break; - default: - p2 = repTimes > 0 ? SeenRepeat : SeenBefore; - for (p1 = 0; p1 < 0x55; p1++) - if (seen[p1] == SeenThisCall) - seen[p1] = p2; - playerCalls += tempo * (Type == ASAPModuleType.Cm3 ? 48 : 64); - pos++; - break; - } - } - AddSong(playerCalls); - } - - const int CmrBassTableOffset = 0x70f; - - void ParseCmc(byte[] module, int moduleLen, ASAPModuleType type) - { - if (moduleLen < 0x306) - throw "Module too short"; - Type = type; - ParseModule(module, moduleLen); - int lastPos = 0x54; - while (--lastPos >= 0) { - if (module[0x206 + lastPos] < 0xb0 - || module[0x25b + lastPos] < 0x40 - || module[0x2b0 + lastPos] < 0x40) - break; - if (Channels == 2) { - if (module[0x306 + lastPos] < 0xb0 - || module[0x35b + lastPos] < 0x40 - || module[0x3b0 + lastPos] < 0x40) - break; - } - } - Songs = 0; - ParseCmcSong(module, 0); - for (int pos = 0; pos < lastPos && Songs < MaxSongs; pos++) - if (module[0x206 + pos] == 0x8f || module[0x206 + pos] == 0xef) - ParseCmcSong(module, pos + 1); - } - - static bool IsDltTrackEmpty(byte[] module, int pos) - { - return module[0x2006 + pos] >= 0x43 - && module[0x2106 + pos] >= 0x40 - && module[0x2206 + pos] >= 0x40 - && module[0x2306 + pos] >= 0x40; - } - - static bool IsDltPatternEnd(byte[] module, int pos, int i) - { - for (int ch = 0; ch < 4; ch++) { - int pattern = module[0x2006 + (ch << 8) + pos]; - if (pattern < 64) { - int offset = 6 + (pattern << 7) + (i << 1); - if ((module[offset] & 0x80) == 0 && (module[offset + 1] & 0x80) != 0) - return true; - } - } - return false; - } - - void ParseDltSong(byte[] module, bool[] seen, int pos) - { - while (pos < 128 && !seen[pos] && IsDltTrackEmpty(module, pos)) - seen[pos++] = true; - SongPos[Songs] = pos; - int playerCalls = 0; - bool loop = false; - int tempo = 6; - while (pos < 128) { - if (seen[pos]) { - loop = true; - break; - } - seen[pos] = true; - int p1 = module[0x2006 + pos]; - if (p1 == 0x40 || IsDltTrackEmpty(module, pos)) - break; - if (p1 == 0x41) - pos = module[0x2086 + pos]; - else if (p1 == 0x42) - tempo = module[0x2086 + pos++]; - else { - for (int i = 0; i < 64 && !IsDltPatternEnd(module, pos, i); i++) - playerCalls += tempo; - pos++; - } - } - if (playerCalls > 0) { - Loops[Songs] = loop; - AddSong(playerCalls); - } - } - - void ParseDlt(byte[] module, int moduleLen) - { - if (moduleLen != 0x2c06 && moduleLen != 0x2c07) - throw "Invalid module length"; - Type = ASAPModuleType.Dlt; - ParseModule(module, moduleLen); - if (Music != 0x2000) - throw "Unsupported module address"; - bool[128] seen = false; - Songs = 0; - for (int pos = 0; pos < 128 && Songs < MaxSongs; pos++) { - if (!seen[pos]) - ParseDltSong(module, seen, pos); - } - if (Songs == 0) - throw "No songs found"; - } - - void ParseMptSong(byte[] module, bool[] globalSeen, int songLen, int pos) - { - int addrToOffset = GetWord(module, 2) - 6; - int tempo = module[0x1cf]; - int playerCalls = 0; - byte[256] seen = 0; - int[4] patternOffset; - int[4] blankRows = 0; - int[4] blankRowsCounter; - while (pos < songLen) { - if (seen[pos] != 0) { - if (seen[pos] != SeenThisCall) - Loops[Songs] = true; - break; - } - seen[pos] = SeenThisCall; - globalSeen[pos] = true; - int i = module[0x1d0 + pos * 2]; - if (i == 0xff) { - pos = module[0x1d1 + pos * 2]; - continue; - } - int ch; - for (ch = 3; ch >= 0; ch--) { - i = module[0x1c6 + ch] + (module[0x1ca + ch] << 8) - addrToOffset; - i = module[i + pos * 2]; - if (i >= 0x40) - break; - i <<= 1; - i = GetWord(module, 0x46 + i); - patternOffset[ch] = i == 0 ? 0 : i - addrToOffset; - blankRowsCounter[ch] = 0; - } - if (ch >= 0) - break; - for (i = 0; i < songLen; i++) - if (seen[i] == SeenThisCall) - seen[i] = SeenBefore; - for (int patternRows = module[0x1ce]; --patternRows >= 0; ) { - for (ch = 3; ch >= 0; ch--) { - if (patternOffset[ch] == 0 || --blankRowsCounter[ch] >= 0) - continue; - for (;;) { - i = module[patternOffset[ch]++]; - if (i < 0x40 || i == 0xfe) - break; - if (i < 0x80) - continue; - if (i < 0xc0) { - blankRows[ch] = i - 0x80; - continue; - } - if (i < 0xd0) - continue; - if (i < 0xe0) { - tempo = i - 0xcf; - continue; - } - patternRows = 0; - } - blankRowsCounter[ch] = blankRows[ch]; - } - playerCalls += tempo; - } - pos++; - } - if (playerCalls > 0) - AddSong(playerCalls); - } - - void ParseMpt(byte[] module, int moduleLen) - { - if (moduleLen < 0x1d0) - throw "Module too short"; - Type = ASAPModuleType.Mpt; - ParseModule(module, moduleLen); - int track0Addr = GetWord(module, 2) + 0x1ca; - if (module[0x1c6] + (module[0x1ca] << 8) != track0Addr) - throw "Invalid address of the first track"; - // Calculate the length of the first track. Address of the second track minus - // address of the first track equals the length of the first track in bytes. - // Divide by two to get number of track positions. - int songLen = (module[0x1c7] + (module[0x1cb] << 8) - track0Addr) >> 1; - if (songLen > 0xfe) - throw "Song too long"; - // `globalSeen[i] == true` if the track position `i` has been processed - bool[256] globalSeen = false; - Songs = 0; - for (int pos = 0; pos < songLen && Songs < MaxSongs; pos++) { - if (!globalSeen[pos]) { - SongPos[Songs] = pos; - ParseMptSong(module, globalSeen, songLen, pos); - } - } - if (Songs == 0) - throw "No songs found"; - } - - static int GetRmtInstrumentFrames(byte[] module, int instrument, int volume, int volumeFrame, bool onExtraPokey) - { - int addrToOffset = GetWord(module, 2) - 6; - instrument = GetWord(module, 0xe) - addrToOffset + (instrument << 1); - if (module[instrument + 1] == 0) - return 0; - instrument = GetWord(module, instrument) - addrToOffset; - int perFrame = module[0xc]; - int playerCall = volumeFrame * perFrame; - int playerCalls = playerCall; - int index = module[instrument] + 1 + playerCall * 3; - int indexEnd = module[instrument + 2] + 3; - int indexLoop = module[instrument + 3]; - if (indexLoop >= indexEnd) - return 0; // error - int volumeSlideDepth = module[instrument + 6]; - int volumeMin = module[instrument + 7]; - const byte[] rmtVolumeSilent = { 16, 8, 4, 3, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1 }; - if (index >= indexEnd) - index = (index - indexEnd) % (indexEnd - indexLoop) + indexLoop; - else { - do { - int vol = module[instrument + index]; - if (onExtraPokey) - vol >>= 4; - if ((vol & 0xf) >= rmtVolumeSilent[volume]) - playerCalls = playerCall + 1; - playerCall++; - index += 3; - } while (index < indexEnd); - } - if (volumeSlideDepth == 0) - return playerCalls / perFrame; - int volumeSlide = 128; - bool silentLoop = false; - for (;;) { - if (index >= indexEnd) { - if (silentLoop) - break; - silentLoop = true; - index = indexLoop; - } - int vol = module[instrument + index]; - if (onExtraPokey) - vol >>= 4; - if ((vol & 0xf) >= rmtVolumeSilent[volume]) { - playerCalls = playerCall + 1; - silentLoop = false; - } - playerCall++; - index += 3; - volumeSlide -= volumeSlideDepth; - if (volumeSlide < 0) { - volumeSlide += 256; - if (--volume <= volumeMin) - break; - } - } - return playerCalls / perFrame; - } - - void ParseRmtSong(byte[] module, bool[] globalSeen, int songLen, int posShift, int pos) - { - int addrToOffset = GetWord(module, 2) - 6; - int tempo = module[0xb]; - int frames = 0; - int songOffset = GetWord(module, 0x14) - addrToOffset; - int patternLoOffset = GetWord(module, 0x10) - addrToOffset; - int patternHiOffset = GetWord(module, 0x12) - addrToOffset; - byte[256] seen = 0; - int[8] patternBegin; - int[8] patternOffset; - int[8] blankRows; - int[8] instrumentNo = 0; - int[8] instrumentFrame = 0; - int[8] volumeValue = 0; - int[8] volumeFrame = 0; - while (pos < songLen) { - if (seen[pos] != 0) { - if (seen[pos] != SeenThisCall) - Loops[Songs] = true; - break; - } - seen[pos] = SeenThisCall; - globalSeen[pos] = true; - if (module[songOffset + (pos << posShift)] == 0xfe) { - pos = module[songOffset + (pos << posShift) + 1]; - continue; - } - for (int ch = 0; ch < 1 << posShift; ch++) { - int p = module[songOffset + (pos << posShift) + ch]; - if (p == 0xff) - blankRows[ch] = 256; - else { - patternOffset[ch] = patternBegin[ch] = module[patternLoOffset + p] - + (module[patternHiOffset + p] << 8) - addrToOffset; - if (patternOffset[ch] < 0) - return; // badly ripped alien.rmt - blankRows[ch] = 0; - } - } - for (int i = 0; i < songLen; i++) - if (seen[i] == SeenThisCall) - seen[i] = SeenBefore; - for (int patternRows = module[0xa]; --patternRows >= 0; ) { - for (int ch = 0; ch < 1 << posShift; ch++) { - if (--blankRows[ch] > 0) - continue; - for (;;) { - int i = module[patternOffset[ch]++]; - if ((i & 0x3f) < 62) { - i += module[patternOffset[ch]++] << 8; - if ((i & 0x3f) != 61) { - instrumentNo[ch] = i >> 10; - instrumentFrame[ch] = frames; - } - volumeValue[ch] = (i >> 6) & 0xf; - volumeFrame[ch] = frames; - break; - } - if (i == 62) { - blankRows[ch] = module[patternOffset[ch]++]; - break; - } - if ((i & 0x3f) == 62) { - blankRows[ch] = i >> 6; - break; - } - if ((i & 0xbf) == 63) { - tempo = module[patternOffset[ch]++]; - continue; - } - if (i == 0xbf) { - patternOffset[ch] = patternBegin[ch] + module[patternOffset[ch]]; - continue; - } - // assert(i == 0xff); - patternRows = -1; - break; - } - if (patternRows < 0) - break; - } - if (patternRows >= 0) - frames += tempo; - } - pos++; - } - int instrumentFrames = 0; - for (int ch = 0; ch < 1 << posShift; ch++) { - int frame = instrumentFrame[ch]; - frame += GetRmtInstrumentFrames(module, instrumentNo[ch], volumeValue[ch], volumeFrame[ch] - frame, ch >= 4); - if (instrumentFrames < frame) - instrumentFrames = frame; - } - if (frames > instrumentFrames) { - if (frames - instrumentFrames > 100) - Loops[Songs] = false; - frames = instrumentFrames; - } - if (frames > 0) - AddSong(frames); - } - - static bool ValidateRmt(byte[] module, int moduleLen) - { - if (moduleLen < 0x30) - return false; - if (module[6] != 'R' || module[7] != 'M' || module[8] != 'T' || module[0xd] != 1) - return false; - return true; - } - - void ParseRmt(byte[] module, int moduleLen) - { - if (!ValidateRmt(module, moduleLen)) - throw "Invalid RMT file"; - int posShift; - switch (module[9]) { - case '4': - posShift = 2; - break; - case '8': - Channels = 2; - posShift = 3; - break; - default: - throw "Unsupported number of channels"; - } - int perFrame = module[0xc]; - if (perFrame < 1 || perFrame > 4) - throw "Unsupported player call rate"; - Type = ASAPModuleType.Rmt; - ParseModule(module, moduleLen); - int blockLen = GetWord(module, 4) + 1 - Music; - int songLen = GetWord(module, 4) + 1 - GetWord(module, 0x14); - if (posShift == 3 && (songLen & 4) != 0 && module[6 + blockLen - 4] == 0xfe) - songLen += 4; - songLen >>= posShift; - if (songLen >= 0x100) - throw "Song too long"; - bool[256] globalSeen = false; - Songs = 0; - for (int pos = 0; pos < songLen && Songs < MaxSongs; pos++) { - if (!globalSeen[pos]) { - SongPos[Songs] = pos; - ParseRmtSong(module, globalSeen, songLen, posShift, pos); - } - } - // must set Fastplay after song durations calculations, so they assume 312 - Fastplay = 312 / perFrame; - Player = 0x600; - if (Songs == 0) - throw "No songs found"; - byte[MaxTextLength] title; - int titleLen; - for (titleLen = 0; titleLen < MaxTextLength && 10 + blockLen + titleLen < moduleLen; titleLen++) { - byte c = module[10 + blockLen + titleLen]; - if (c == 0) - break; - // RMT only allows entering characters we consider valid, but let's check just in case - title[titleLen] = IsValidChar(c) ? c : ' '; - } - Title = title.ToString(0, titleLen); - } - - void ParseTmcSong(byte[] module, int pos) - { - int addrToOffset = GetWord(module, 2) - 6; - int tempo = module[0x24] + 1; - int frames = 0; - int[8] patternOffset; - int[8] blankRows; - while (module[0x1a6 + 15 + pos] < 0x80) { - for (int ch = 7; ch >= 0; ch--) { - int pat = module[0x1a6 + 15 + pos - 2 * ch]; - patternOffset[ch] = module[0xa6 + pat] + (module[0x126 + pat] << 8) - addrToOffset; - blankRows[ch] = 0; - } - for (int patternRows = 64; --patternRows >= 0; ) { - for (int ch = 7; ch >= 0; ch--) { - if (--blankRows[ch] >= 0) - continue; - for (;;) { - int i = module[patternOffset[ch]++]; - if (i < 0x40) { - patternOffset[ch]++; - break; - } - if (i == 0x40) { - i = module[patternOffset[ch]++]; - if ((i & 0x7f) == 0) - patternRows = 0; - else - tempo = (i & 0x7f) + 1; - if (i >= 0x80) - patternOffset[ch]++; - break; - } - if (i < 0x80) { - i = module[patternOffset[ch]++] & 0x7f; - if (i == 0) - patternRows = 0; - else - tempo = i + 1; - patternOffset[ch]++; - break; - } - if (i < 0xc0) - continue; - blankRows[ch] = i - 0xbf; - break; - } - } - frames += tempo; - } - pos += 16; - } - if (module[0x1a6 + 14 + pos] < 0x80) - Loops[Songs] = true; - AddSong(frames); - } - - static int ParseTmcTitle(byte[] title, int titleLen, byte[] module, int moduleOffset) - { - int lastOffset = moduleOffset + 29; - while (module[lastOffset] == ' ') { - if (--lastOffset < moduleOffset) - return titleLen; - } - if (titleLen > 0) { - title[titleLen++] = ' '; - title[titleLen++] = '|'; - title[titleLen++] = ' '; - } - while (moduleOffset <= lastOffset) { - int c = module[moduleOffset++] & 0x7f; - switch (c) { - case 't' - 96: - c = '*'; - break; - // Replace Polish letters with their English equivalents. - // This is common practice when Polish letters are unavailable. - case 'a' - 96: - case 'c' - 96: - case 'e' - 96: - case 'l' - 96: - case 'n' - 96: - case 'o' - 96: - case 's' - 96: - c += 96; - break; - case 'x' - 96: - case 'z' - 96: - c = 'z'; - break; - default: - if (!IsValidChar(c)) - c = ' '; - break; - } - title[titleLen++] = c; - } - return titleLen; - } - - void ParseTmc(byte[] module, int moduleLen) - { - if (moduleLen < 0x1d0) - throw "Module too short"; - Type = ASAPModuleType.Tmc; - ParseModule(module, moduleLen); - Channels = 2; - int i = 0; - // find first instrument - while (module[0x66 + i] == 0) { - if (++i >= 64) - throw "No instruments"; - } - int lastPos = (module[0x66 + i] << 8) + module[0x26 + i] - GetWord(module, 2) - 0x1b0; - if (0x1b5 + lastPos >= moduleLen) - throw "Module too short"; - // skip trailing jumps - do { - if (lastPos <= 0) - throw "No songs found"; - lastPos -= 16; - } while (module[0x1b5 + lastPos] >= 0x80); - Songs = 0; - ParseTmcSong(module, 0); - for (i = 0; i < lastPos && Songs < MaxSongs; i += 16) - if (module[0x1b5 + i] >= 0x80) - ParseTmcSong(module, i + 16); - // must set fastplay after song durations calculations, so they assume 312 - i = module[0x25]; - if (i < 1 || i > 4) - throw "Unsupported player call rate"; - Fastplay = 312 / i; - byte[MaxTextLength] title; - int titleLen = ParseTmcTitle(title, 0, module, 6); - Title = title.ToString(0, titleLen); - } - - void ParseTm2Song(byte[] module, int pos) - { - int addrToOffset = GetWord(module, 2) - 6; - int tempo = module[0x24] + 1; - int playerCalls = 0; - int[8] patternOffset; - int[8] blankRows; - for (;;) { - int patternRows = module[0x386 + 16 + pos]; - if (patternRows == 0) - break; - if (patternRows >= 0x80) { - Loops[Songs] = true; - break; - } - for (int ch = 7; ch >= 0; ch--) { - int pat = module[0x386 + 15 + pos - 2 * ch]; - patternOffset[ch] = module[0x106 + pat] + (module[0x206 + pat] << 8) - addrToOffset; - blankRows[ch] = 0; - } - while (--patternRows >= 0) { - for (int ch = 7; ch >= 0; ch--) { - if (--blankRows[ch] >= 0) - continue; - for (;;) { - int i = module[patternOffset[ch]++]; - if (i == 0) { - patternOffset[ch]++; - break; - } - if (i < 0x40) { - if (module[patternOffset[ch]++] >= 0x80) - patternOffset[ch]++; - break; - } - if (i < 0x80) { - patternOffset[ch]++; - break; - } - if (i == 0x80) { - blankRows[ch] = module[patternOffset[ch]++]; - break; - } - if (i < 0xc0) - break; - if (i < 0xd0) { - tempo = i - 0xbf; - continue; - } - if (i < 0xe0) { - patternOffset[ch]++; - break; - } - if (i < 0xf0) { - patternOffset[ch] += 2; - break; - } - if (i < 0xff) { - blankRows[ch] = i - 0xf0; - break; - } - blankRows[ch] = 64; - break; - } - } - playerCalls += tempo; - } - pos += 17; - } - AddSong(playerCalls); - } - - void ParseTm2(byte[] module, int moduleLen) - { - if (moduleLen < 0x3a4) - throw "Module too short"; - Type = ASAPModuleType.Tm2; - ParseModule(module, moduleLen); - int i = module[0x25]; - if (i < 1 || i > 4) - throw "Unsupported player call rate"; - Fastplay = 312 / i; - Player = 0x800; - if (module[0x1f] != 0) - Channels = 2; - int lastPos = 0xffff; - for (i = 0; i < 0x80; i++) { - int instrAddr = module[0x86 + i] + (module[0x306 + i] << 8); - if (instrAddr != 0 && instrAddr < lastPos) - lastPos = instrAddr; - } - for (i = 0; i < 0x100; i++) { - int patternAddr = module[0x106 + i] + (module[0x206 + i] << 8); - if (patternAddr != 0 && patternAddr < lastPos) - lastPos = patternAddr; - } - lastPos -= GetWord(module, 2) + 0x380; - if (0x386 + lastPos >= moduleLen) - throw "Module too short"; - // skip trailing stop/jump commands - int c; - do { - if (lastPos <= 0) - throw "No songs found"; - lastPos -= 17; - c = module[0x386 + 16 + lastPos]; - } while (c == 0 || c >= 0x80); - Songs = 0; - ParseTm2Song(module, 0); - for (i = 0; i < lastPos && Songs < MaxSongs; i += 17) { - c = module[0x386 + 16 + i]; - if (c == 0 || c >= 0x80) - ParseTm2Song(module, i + 17); - } - byte[MaxTextLength] title; - int titleLen = ParseTmcTitle(title, 0, module, 0x27); - titleLen = ParseTmcTitle(title, titleLen, module, 0x47); - titleLen = ParseTmcTitle(title, titleLen, module, 0x67); - Title = title.ToString(0, titleLen); - } - - static int AfterFF(byte[] module, int moduleLen, int currentOffset) - { - while (currentOffset < moduleLen) { - if (module[currentOffset++] == 0xff) - return currentOffset; - } - throw "Module too short"; - } - - macro FC_TRKCMD(n) ( module[3 + (n << 8) + trackPos[n]] ) - - static bool IsFcSongEnd(byte[] module, int[] trackPos) - { - // stops when one channel (or more) has STOP command or each channel has LOOP command - bool allLoop = true; - for (int n = 0; n < 3; n++) { - if (trackPos[n] >= 0x100) - return true; - switch (FC_TRKCMD(n)) { - case 0xfe: // STOP - return true; - case 0xff: // LOOP - break; - default: - allLoop = false; - break; - } - } - return allLoop; - } - - static bool ValidateFc(byte[] module, int moduleLen) - { - if (moduleLen < 0x383) - return false; - if (module[0] != 0x26 || module[1] != 0x23) - return false; - return true; - } - - void ParseFc(byte[] module, int moduleLen) - { - if (!ValidateFc(module, moduleLen)) - throw "Invalid FC file"; - Type = ASAPModuleType.Fc; - - Player = 0x400; - Music = 0xa00; - Songs = 0; - HeaderLen = -1; - - int[0x40] patternOffsets; - int currentOffset = 0x383; - // patterns - for (int i = 0; i < 0x40; i++) { - patternOffsets[i] = currentOffset; - currentOffset = AfterFF(module, moduleLen, currentOffset); - } - // envelopes - for (int i = 0; i < 0x20; i++) - currentOffset = AfterFF(module, moduleLen, currentOffset); - - for (int pos = 0; pos < 0x100 && Songs < MaxSongs; ) { - int[3] trackPos; - for (int n = 0; n < 3; n++) - trackPos[n] = pos; - int[3] patternDelay = 0; - int[3] noteDuration = 0; - int[3] patternPos = 0; - int playerCalls = 0; - Loops[Songs] = true; - - while (!IsFcSongEnd(module, trackPos)) { - for (int n = 0; n < 3; n++) { - int trackCmd = FC_TRKCMD(n); - if (trackCmd != 0xff && patternDelay[n]-- <= 0) { //"<" for junks in track - while (trackPos[n] < 0x100) { - trackCmd = FC_TRKCMD(n); - if (trackCmd < 0x40) { - int patternCmd = module[patternOffsets[trackCmd] + patternPos[n]++]; - if (patternCmd < 0x40) { - patternDelay[n] = noteDuration[n]; - break; - } - else if (patternCmd < 0x60) - noteDuration[n] = patternCmd - 0x40; - else if (patternCmd == 0xff) { - patternDelay[n] = 0; - noteDuration[n] = 0; - patternPos[n] = 0; - trackPos[n]++; - } - } - else if (trackCmd == 0x40) - trackPos[n] += 2; - else if (trackCmd == 0xfe) { - Loops[Songs] = false; - break; - } - else if (trackCmd == 0xff) - break; - else - trackPos[n]++; - } - } - } - if (IsFcSongEnd(module, trackPos)) - break; - playerCalls += module[2]; - } - - pos = -1; - for (int n = 0; n < 3; n++) { - int nxtrkpos = trackPos[n]; - if (patternPos[n] > 0) - nxtrkpos++; - if (pos < nxtrkpos) - pos = nxtrkpos; - } - pos++; - if (pos <= 0x100) - AddSong(playerCalls); - } - } - - static bool HasStringAt(byte[] module, int moduleIndex, string s) - { - int n = s.Length; - for (int i = 0; i < n; i++) - if (module[moduleIndex + i] != s[i]) - return false; - return true; - } - - static int ParseText(byte[] module, int moduleIndex) - { - if (module[moduleIndex] != '"') - throw "Missing quote"; - if (HasStringAt(module, moduleIndex + 1, "\"\r")) - return 0; - for (int len = 0; ; len++) { - int c = module[moduleIndex + 1 + len]; - if (c == '"' && module[moduleIndex + 2 + len] == '\r') - return len; - CheckValidChar(c); - } - } - - static int ParseDec(byte[] module, int moduleIndex, int maxVal) - { - if (module[moduleIndex] == '\r') - throw "Missing number"; - for (int r = 0;;) { - int c = module[moduleIndex++]; - if (c == '\r') - return r; - if (c < '0' || c > '9') - throw "Invalid number"; - r = 10 * r + c - '0'; - if (r > maxVal) - throw "Number too big"; - } - } - - static int ParseHex(byte[] module, int moduleIndex) - { - if (module[moduleIndex] == '\r') - throw "Missing number"; - for (int r = 0;;) { - int c = module[moduleIndex++]; - if (c == '\r') - return r; - if (r > 0xfff) - throw "Number too big"; - r <<= 4; - if (c >= '0' && c <= '9') - r += c - '0'; - else if (c >= 'A' && c <= 'F') - r += c - 'A' + 10; - else if (c >= 'a' && c <= 'f') - r += c - 'a' + 10; - else - throw "Invalid number"; - } - } - - /// Returns the number of milliseconds represented by the given string. - public static int ParseDuration( - /// Time in the `"mm:ss.xxx"` format. - string s) - { - int i = 0; - int n = s.Length; - int d; - macro NEED_DIGIT() { if (i >= n) throw "Invalid duration"; } - macro PARSE_DIGIT(maxdig) { - d = s[i] - '0'; - if (d < 0 || d > maxdig) - throw "Invalid duration"; - i++; - } - NEED_DIGIT(); - PARSE_DIGIT(9); - int r = d; - if (i < n) { - d = s[i] - '0'; - if (d >= 0 && d <= 9) { - i++; - r = 10 * r + d; - } - if (i < n && s[i] == ':') { - i++; - NEED_DIGIT(); - PARSE_DIGIT(5); - r = (6 * r + d) * 10; - NEED_DIGIT(); - PARSE_DIGIT(9); - r += d; - } - } - r *= 1000; - if (i >= n) return r; - if (s[i] != '.') throw "Invalid duration"; - i++; - NEED_DIGIT(); - PARSE_DIGIT(9); - r += 100 * d; - if (i >= n) return r; - PARSE_DIGIT(9); - r += 10 * d; - if (i >= n) return r; - PARSE_DIGIT(9); - r += d; - return r; - } - - static bool ValidateSap(byte[] module, int moduleLen) - { - return moduleLen >= 30 && HasStringAt(module, 0, "SAP\r\n"); - } - - void ParseSap(byte[] module, int moduleLen) - { - if (!ValidateSap(module, moduleLen)) - throw "Invalid SAP file"; - Fastplay = -1; - int type = 0; - int moduleIndex = 5; - int durationIndex = 0; - while (module[moduleIndex] != 0xff) { - if (moduleIndex + 8 >= moduleLen) - throw "Missing binary part"; - macro TAG_IS(s) ( HasStringAt(module, moduleIndex, s) ) - macro SET_TEXT(v, i) { - int len = ParseText(module, moduleIndex + i); - if (len > 0) - v = module.ToString(moduleIndex + i + 1, len); - } - macro SET_DEC(v, i, min, max) { v = ParseDec(module, moduleIndex + i, max); if (v < min) throw "Number too small"; } - macro SET_HEX(v, i) { v = ParseHex(module, moduleIndex + i); } - if (TAG_IS("AUTHOR ")) { - SET_TEXT(Author, 7); - } - else if (TAG_IS("NAME ")) { - SET_TEXT(Title, 5); - } - else if (TAG_IS("DATE ")) { - SET_TEXT(Date, 5); - } - else if (TAG_IS("SONGS ")) { - SET_DEC(Songs, 6, 1, MaxSongs); - } - else if (TAG_IS("DEFSONG ")) { - SET_DEC(DefaultSong, 8, 0, MaxSongs - 1); - } - else if (TAG_IS("STEREO\r")) - Channels = 2; - else if (TAG_IS("NTSC\r")) - Ntsc = true; - else if (TAG_IS("TIME ")) { - if (durationIndex >= MaxSongs) - throw "Too many TIME tags"; - moduleIndex += 5; - int len; - for (len = 0; module[moduleIndex + len] != '\r'; len++) { } - if (len > 5 && HasStringAt(module, moduleIndex + len - 5, " LOOP")) { - Loops[durationIndex] = true; - len -= 5; - } - if (len > 9) - throw "Invalid TIME tag"; - string(9) s = module.ToString(moduleIndex, len); - int duration = ParseDuration(s); - Durations[durationIndex++] = duration; - } - else if (TAG_IS("TYPE ")) - type = module[moduleIndex + 5]; - else if (TAG_IS("FASTPLAY ")) { - SET_DEC(Fastplay, 9, 1, 32767); - } - else if (TAG_IS("MUSIC ")) { - SET_HEX(Music, 6); - } - else if (TAG_IS("INIT ")) { - SET_HEX(Init, 5); - } - else if (TAG_IS("PLAYER ")) { - SET_HEX(Player, 7); - } - else if (TAG_IS("COVOX ")) { - SET_HEX(CovoxAddr, 6); - if (CovoxAddr != 0xd600) - throw "COVOX should be D600"; - Channels = 2; - } - - while (module[moduleIndex++] != '\r') { - if (moduleIndex >= moduleLen) - throw "Malformed SAP header"; - } - if (module[moduleIndex++] != '\n') - throw "Malformed SAP header"; - } - if (DefaultSong >= Songs) - throw "DEFSONG too big"; - switch (type) { - case 'B': - if (Player < 0) - throw "Missing PLAYER tag"; - if (Init < 0) - throw "Missing INIT tag"; - Type = ASAPModuleType.SapB; - break; - case 'C': - if (Player < 0) - throw "Missing PLAYER tag"; - if (Music < 0) - throw "Missing MUSIC tag"; - Type = ASAPModuleType.SapC; - break; - case 'D': - if (Init < 0) - throw "Missing INIT tag"; - Type = ASAPModuleType.SapD; - break; - case 'S': - if (Init < 0) - throw "Missing INIT tag"; - Type = ASAPModuleType.SapS; - if (Fastplay < 0) - Fastplay = 78; - break; - default: - throw "Unsupported TYPE"; - } - if (Fastplay < 0) - Fastplay = Ntsc ? 262 : 312; - if (module[moduleIndex + 1] != 0xff) - throw "Invalid binary header"; - HeaderLen = moduleIndex; - } - - macro ASAP_EXT(s) ( s.Length >> 1 == 1 ? s[0] + (s[1] << 8) + (s.Length == 3 ? s[2] << 16 : 0) | 0x202020 : 0 ) - - static int GetPackedExt(string filename) - { - int ext = 0; - for (int i = filename.Length; --i > 0; ) { - int c = filename[i]; - if (c <= ' ' || c > 'z') - return 0; - if (c == '.') - return ext | 0x202020; - ext = (ext << 8) + c; - } - return 0; - } - - static bool IsOurPackedExt(int ext) - { - switch (ext) { - case ASAP_EXT("SAP"): -#if !ASAP_ONLY_SAP - case ASAP_EXT("CMC"): - case ASAP_EXT("CM3"): - case ASAP_EXT("CMR"): - case ASAP_EXT("CMS"): - case ASAP_EXT("DMC"): - case ASAP_EXT("DLT"): - case ASAP_EXT("MPT"): - case ASAP_EXT("MPD"): - case ASAP_EXT("RMT"): - case ASAP_EXT("TMC"): - case ASAP_EXT("TM8"): - case ASAP_EXT("TM2"): - case ASAP_EXT("FC"): -#if EXPERIMENTAL_XEX - case ASAP_EXT("XEX"): -#endif -#endif - return true; - default: - return false; - } - } - - /// Checks whether the filename represents a module type supported by ASAP. - /// Returns `true` if the filename is supported by ASAP. - public static bool IsOurFile( - /// Filename to check the extension of. - string filename) - { - return IsOurPackedExt(GetPackedExt(filename)); - } - - /// Checks whether the filename extension represents a module type supported by ASAP. - /// Returns `true` if the filename extension is supported by ASAP. - public static bool IsOurExt( - /// Filename extension without the leading dot. - string ext) - { - return IsOurPackedExt(ASAP_EXT(ext)); - } - - static int GuessPackedExt(byte[] module, int moduleLen) - { - if (ValidateSap(module, moduleLen)) - return ASAP_EXT("SAP"); - if (ValidateFc(module, moduleLen)) - return ASAP_EXT("FC"); - if (ValidateRmt(module, moduleLen)) - return ASAP_EXT("RMT"); - throw "Unknown format"; - } - - /// Loads file information. - public void Load( - /// Filename, used to determine the format. - string filename, - /// Contents of the file. - byte[] module, - /// Length of the file. - int moduleLen) - { - int ext; - if (filename != null) { - int len = filename.Length; - int basename = 0; - ext = -1; - for (int i = len; --i >= 0; ) { - int c = filename[i]; - if (c == '/' || c == '\\') { - basename = i + 1; - break; - } - if (c == '.') - ext = i; - } - if (ext < 0) - throw "Filename has no extension"; - ext -= basename; - if (ext > MaxTextLength) - ext = MaxTextLength; - Filename = filename.Substring(basename, ext); - ext = GetPackedExt(filename); - } - else { - Filename = ""; - ext = GuessPackedExt(module, moduleLen); - } - - Author = ""; - Title = ""; - Date = ""; - Channels = 1; - Songs = 1; - DefaultSong = 0; - for (int i = 0; i < MaxSongs; i++) { - Durations[i] = -1; - Loops[i] = false; - } - Ntsc = false; - Fastplay = 312; - Music = -1; - Init = -1; - Player = -1; - CovoxAddr = -1; - HeaderLen = 0; - switch (ext) { - case ASAP_EXT("SAP"): - ParseSap(module, moduleLen); - return; -#if !ASAP_ONLY_SAP - case ASAP_EXT("CMC"): - ParseCmc(module, moduleLen, ASAPModuleType.Cmc); - return; - case ASAP_EXT("CM3"): - ParseCmc(module, moduleLen, ASAPModuleType.Cm3); - return; - case ASAP_EXT("CMR"): - ParseCmc(module, moduleLen, ASAPModuleType.Cmr); - return; - case ASAP_EXT("CMS"): - Channels = 2; - ParseCmc(module, moduleLen, ASAPModuleType.Cms); - return; - case ASAP_EXT("DMC"): - Fastplay = 156; - ParseCmc(module, moduleLen, ASAPModuleType.Cmc); - return; - case ASAP_EXT("DLT"): - ParseDlt(module, moduleLen); - return; - case ASAP_EXT("MPT"): - ParseMpt(module, moduleLen); - return; - case ASAP_EXT("MPD"): - Fastplay = 156; - ParseMpt(module, moduleLen); - return; - case ASAP_EXT("RMT"): - ParseRmt(module, moduleLen); - return; - case ASAP_EXT("TMC"): - case ASAP_EXT("TM8"): - ParseTmc(module, moduleLen); - return; - case ASAP_EXT("TM2"): - ParseTm2(module, moduleLen); - return; - case ASAP_EXT("FC"): - ParseFc(module, moduleLen); - return; -#if EXPERIMENTAL_XEX - case ASAP_EXT("XEX"): - if (moduleLen < 7 || module[0] != 0xff || module[1] != 0xff) - throw "Missing 0xff,0xff header"; - Type = ASAPModuleType.Xex; - return; -#endif -#endif - default: - throw "Unknown filename extension"; - } - } - -#if !ASAP_ONLY_SAP - - /// Returns human-readable description of the filename extension. - public static string GetExtDescription( - /// Filename extension without the leading dot. - string ext) - { - switch (ASAP_EXT(ext)) { - case ASAP_EXT("SAP"): return "Slight Atari Player"; - case ASAP_EXT("CMC"): return "Chaos Music Composer"; - case ASAP_EXT("CM3"): return "CMC \"3/4\""; - case ASAP_EXT("CMR"): return "CMC \"Rzog\""; - case ASAP_EXT("CMS"): return "Stereo Double CMC"; - case ASAP_EXT("DMC"): return "DoublePlay CMC"; - case ASAP_EXT("DLT"): return "Delta Music Composer"; - case ASAP_EXT("MPT"): return "Music ProTracker"; - case ASAP_EXT("MPD"): return "MPT DoublePlay"; - case ASAP_EXT("RMT"): return "Raster Music Tracker"; - case ASAP_EXT("TMC"): - case ASAP_EXT("TM8"): return "Theta Music Composer 1.x"; - case ASAP_EXT("TM2"): return "Theta Music Composer 2.x"; - case ASAP_EXT("FC"): return "Future Composer"; - case ASAP_EXT("XEX"): return "Atari 8-bit executable"; - default: throw "Unknown extension"; - } - } - - const int RmtInit = 0xc80; - - int GetRmtSapOffset(byte[] module, int moduleLen) - { - if (Player != 0x3403) - return -1; - int offset = HeaderLen + GetWord(module, HeaderLen + 4) - GetWord(module, HeaderLen + 2) + 7; - if (offset + 6 >= moduleLen || module[offset + 4] != 'R' || module[offset + 5] != 'M' || module[offset + 6] != 'T') - return -1; - return offset; - } - - /// Returns the extension of the original module format. - /// For native modules it simply returns their extension. - /// For the SAP format it attempts to detect the original module format. - public string GetOriginalModuleExt( - /// Contents of the file. - byte[] module, - /// Length of the file. - int moduleLen) - { - switch (Type) { - case ASAPModuleType.SapB: - if ((Init == 0x3fb || Init == 0x3f9) && Player == 0x503) - return "dlt"; - if (((Init == 0x4f3 || Init == 0x4ef) && Player == 0x503) || (Init == 0xf4f3 && Player == 0xf503)) - return Fastplay == 156 ? "mpd" : "mpt"; - if (Init == RmtInit || GetRmtSapOffset(module, moduleLen) > 0) - return "rmt"; - if ((Init == 0x4f5 || Init == 0xf4f5 || Init == 0x4f2) - || ((Init == 0x4e7 || Init == 0xf4e7 || Init == 0x4e4) && Fastplay == 156) - || ((Init == 0x4e5 || Init == 0xf4e5 || Init == 0x4e2) && (Fastplay == 104 || Fastplay == 78))) - return "tmc"; - if ((Init == 0x1080 && Player == 0x503) || (Init == 0x1380 && Player == 0x803)) - return "tm2"; - if (Init == 0x400 && Player == 0x403) - return "fc"; - return null; - case ASAPModuleType.SapC: - if ((Player == 0x500 || Player == 0xf500) && moduleLen >= 1024) { - if (Fastplay == 156) - return "dmc"; - if (Channels > 1) - return "cms"; - if (module[moduleLen - 170] == 0x1e) - return "cmr"; - if (module[moduleLen - 909] == 0x30) - return "cm3"; - return "cmc"; - } - return null; - case ASAPModuleType.Cmc: - return Fastplay == 156 ? "dmc" : "cmc"; - case ASAPModuleType.Cm3: - return "cm3"; - case ASAPModuleType.Cmr: - return "cmr"; - case ASAPModuleType.Cms: - return "cms"; - case ASAPModuleType.Dlt: - return "dlt"; - case ASAPModuleType.Mpt: - return Fastplay == 156 ? "mpd" : "mpt"; - case ASAPModuleType.Rmt: - return "rmt"; - case ASAPModuleType.Tmc: - return "tmc"; - case ASAPModuleType.Tm2: - return "tm2"; - case ASAPModuleType.Fc: - return "fc"; - default: - return null; - } - } - -#endif -} diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/asapscan.c kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/asapscan.c --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/asapscan.c 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/asapscan.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,595 +0,0 @@ -/* - * asapscan.c - Atari 8-bit music analyzer - * - * Copyright (C) 2007-2013 Piotr Fusik - * - * This file is part of ASAP (Another Slight Atari Player), - * see http://asap.sourceforge.net - * - * ASAP is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. - * - * ASAP is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ASAP; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include -#include -#ifdef _WIN32 -#include -#endif - -#include "asap-asapscan.h" - -static cibool detect_time = FALSE; -static int scan_frames; -static int silence_frames; -static int loop_check_frames; -static int loop_min_frames; -static int frame; -static unsigned char *registers_dump; -#define HASH_BITS 8 -static int hash_first[1 << HASH_BITS]; -static int *hash_next; -static int hash_last[1 << HASH_BITS]; - -static ASAP *asap; -static cibool dump = FALSE; -static cibool fingerprint = FALSE; -static cibool long_fingerprint = FALSE; - -#define FEATURE_CHECK 1 -#define FEATURE_15_KHZ 2 -#define FEATURE_HIPASS_FILTER 4 -#define FEATURE_LOW_OF_16_BIT 8 -#define FEATURE_9_BIT_POLY 16 -#define FEATURE_ULTRASOUND 32 -static int features = 0; - -#define CPU_TRACE_PRINT 1 -#define CPU_TRACE_UNOFFICIAL 2 -#define CPU_TRACE_PC_TIME 4 -static int cpu_trace = 0; -static void trace_cpu(const ASAP *asap, int pc, int a, int x, int y, int s, int nz, int vdi, int c); - -static int print_time_at_pc = -1; - -static cibool acid = FALSE; -static int exit_code = 0; - -#include "asap-asapscan.c" - -#define CYCLES_PER_FRAME (asap->moduleInfo.ntsc ? 262 * 114 : 312 * 114) -#define MAIN_CLOCK (asap->moduleInfo.ntsc ? 1789772 : 1773447) - -static int seconds_to_frames(int seconds) -{ - return (int) ((double) seconds * MAIN_CLOCK / CYCLES_PER_FRAME); -} - -static int frames_to_milliseconds(int frames) -{ - return (int) ceil(frames * 1000.0 * CYCLES_PER_FRAME / MAIN_CLOCK); -} - -static void print_time(int frames, cibool loop) -{ - int duration = frames_to_milliseconds(frames); - printf("TIME %02d:%02d.%02d%s\n", duration / 60000, duration / 1000 % 60, duration / 10 % 100, loop ? " LOOP" : ""); -} - -static const char cpu_mnemonics[256][10] = { - "BRK", "ORA (1,X)", "CIM", "ASO (1,X)", "NOP 1", "ORA 1", "ASL 1", "ASO 1", - "PHP", "ORA #1", "ASL", "ANC #1", "NOP 2", "ORA 2", "ASL 2", "ASO 2", - "BPL 0", "ORA (1),Y", "CIM", "ASO (1),Y", "NOP 1,X", "ORA 1,X", "ASL 1,X", "ASO 1,X", - "CLC", "ORA 2,Y", "NOP !", "ASO 2,Y", "NOP 2,X", "ORA 2,X", "ASL 2,X", "ASO 2,X", - "JSR 2", "AND (1,X)", "CIM", "RLA (1,X)", "BIT 1", "AND 1", "ROL 1", "RLA 1", - "PLP", "AND #1", "ROL", "ANC #1", "BIT 2", "AND 2", "ROL 2", "RLA 2", - "BMI 0", "AND (1),Y", "CIM", "RLA (1),Y", "NOP 1,X", "AND 1,X", "ROL 1,X", "RLA 1,X", - "SEC", "AND 2,Y", "NOP !", "RLA 2,Y", "NOP 2,X", "AND 2,X", "ROL 2,X", "RLA 2,X", - - "RTI", "EOR (1,X)", "CIM", "LSE (1,X)", "NOP 1", "EOR 1", "LSR 1", "LSE 1", - "PHA", "EOR #1", "LSR", "ALR #1", "JMP 2", "EOR 2", "LSR 2", "LSE 2", - "BVC 0", "EOR (1),Y", "CIM", "LSE (1),Y", "NOP 1,X", "EOR 1,X", "LSR 1,X", "LSE 1,X", - "CLI", "EOR 2,Y", "NOP !", "LSE 2,Y", "NOP 2,X", "EOR 2,X", "LSR 2,X", "LSE 2,X", - "RTS", "ADC (1,X)", "CIM", "RRA (1,X)", "NOP 1", "ADC 1", "ROR 1", "RRA 1", - "PLA", "ADC #1", "ROR", "ARR #1", "JMP (2)", "ADC 2", "ROR 2", "RRA 2", - "BVS 0", "ADC (1),Y", "CIM", "RRA (1),Y", "NOP 1,X", "ADC 1,X", "ROR 1,X", "RRA 1,X", - "SEI", "ADC 2,Y", "NOP !", "RRA 2,Y", "NOP 2,X", "ADC 2,X", "ROR 2,X", "RRA 2,X", - - "NOP #1", "STA (1,X)", "NOP #1", "SAX (1,X)", "STY 1", "STA 1", "STX 1", "SAX 1", - "DEY", "NOP #1", "TXA", "ANE #1", "STY 2", "STA 2", "STX 2", "SAX 2", - "BCC 0", "STA (1),Y", "CIM", "SHA (1),Y", "STY 1,X", "STA 1,X", "STX 1,Y", "SAX 1,Y", - "TYA", "STA 2,Y", "TXS", "SHS 2,Y", "SHY 2,X", "STA 2,X", "SHX 2,Y", "SHA 2,Y", - "LDY #1", "LDA (1,X)", "LDX #1", "LAX (1,X)", "LDY 1", "LDA 1", "LDX 1", "LAX 1", - "TAY", "LDA #1", "TAX", "ANX #1", "LDY 2", "LDA 2", "LDX 2", "LAX 2", - "BCS 0", "LDA (1),Y", "CIM", "LAX (1),Y", "LDY 1,X", "LDA 1,X", "LDX 1,Y", "LAX 1,X", - "CLV", "LDA 2,Y", "TSX", "LAS 2,Y", "LDY 2,X", "LDA 2,X", "LDX 2,Y", "LAX 2,Y", - - "CPY #1", "CMP (1,X)", "NOP #1", "DCM (1,X)", "CPY 1", "CMP 1", "DEC 1", "DCM 1", - "INY", "CMP #1", "DEX", "SBX #1", "CPY 2", "CMP 2", "DEC 2", "DCM 2", - "BNE 0", "CMP (1),Y", "CIM", "DCM (1),Y", "NOP 1,X", "CMP 1,X", "DEC 1,X", "DCM 1,X", - "CLD", "CMP 2,Y", "NOP !", "DCM 2,Y", "NOP 2,X", "CMP 2,X", "DEC 2,X", "DCM 2,X", - - "CPX #1", "SBC (1,X)", "NOP #1", "INS (1,X)", "CPX 1", "SBC 1", "INC 1", "INS 1", - "INX", "SBC #1", "NOP", "SBC #1 !", "CPX 2", "SBC 2", "INC 2", "INS 2", - "BEQ 0", "SBC (1),Y", "CIM", "INS (1),Y", "NOP 1,X", "SBC 1,X", "INC 1,X", "INS 1,X", - "SED", "SBC 2,Y", "NOP !", "INS 2,Y", "NOP 2,X", "SBC 2,X", "INC 2,X", "INS 2,X" -}; - -#define CPU_OPCODE_UNOFFICIAL 1 -#define CPU_OPCODE_USED 2 -static char cpu_opcodes[256] = { - 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, - 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, - 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, - 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, - 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, - 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, - 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, - 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, - 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, - 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, - 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, - 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, - 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, - 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, - 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, - 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1 -}; - -static void show_instruction(const ASAP *asap, int pc) -{ - int addr = pc; - int opcode; - const char *mnemonic; - const char *p; - - opcode = asap->memory[pc++]; - mnemonic = cpu_mnemonics[opcode]; - for (p = mnemonic + 3; *p != '\0'; p++) { - if (*p == '1') { - int value = asap->memory[pc]; - printf("%04X: %02X %02X %.*s$%02X%s\n", - addr, opcode, value, (int) (p - mnemonic), mnemonic, value, p + 1); - return; - } - if (*p == '2') { - int lo = asap->memory[pc]; - int hi = asap->memory[pc + 1]; - printf("%04X: %02X %02X %02X %.*s$%02X%02X%s\n", - addr, opcode, lo, hi, (int) (p - mnemonic), mnemonic, hi, lo, p + 1); - return; - } - if (*p == '0') { - int offset = asap->memory[pc++]; - int target = (pc + (signed char) offset) & 0xffff; - printf("%04X: %02X %02X %.4s$%04X\n", addr, opcode, offset, mnemonic, target); - return; - } - } - printf("%04X: %02X %s\n", addr, opcode, mnemonic); -} - -static void trace_cpu(const ASAP *asap, int pc, int a, int x, int y, int s, int nz, int vdi, int c) -{ - if ((cpu_trace & CPU_TRACE_PRINT) != 0) { - printf("%3d %3d A=%02X X=%02X Y=%02X S=%02X P=%c%c*-%c%c%c%c PC=", - asap->cycle / 114, asap->cycle % 114, a, x, y, s, - nz >= 0x80 ? 'N' : '-', (vdi & 0x40) != 0 ? 'V' : '-', (vdi & 8) != 0 ? 'D' : '-', - (vdi & 4) != 0 ? 'I' : '-', (nz & 0xff) == 0 ? 'Z' : '-', c != 0 ? 'C' : '-'); - show_instruction(asap, pc); - } - if (pc == print_time_at_pc) - print_time(frame, TRUE); - if (pc != 0xd200 && pc != 0xd203) /* don't count 0xd2 used by Do6502Init() and Call6502() */ - cpu_opcodes[asap->memory[pc]] |= CPU_OPCODE_USED; -} - -static void print_unofficial_mnemonic(int opcode) -{ - const char *mnemonic = cpu_mnemonics[opcode]; - const char *p; - for (p = mnemonic + 3; *p != '\0'; p++) { - if (*p == '1') { - printf("%02X: %.*s$xx%s\n", opcode, (int) (p - mnemonic), mnemonic, p + 1); - return; - } - if (*p == '2') { - printf("%02X: %.*s$xxxx%s\n", opcode, (int) (p - mnemonic), mnemonic, p + 1); - return; - } - /* there are no undocumented branches ('0') */ - } - printf("%02X: %s\n", opcode, mnemonic); -} - -static void print_help(void) -{ - printf( - "Usage: asapscan COMMAND [OPTIONS] INPUTFILE\n" - "Commands:\n" - "-d Dump POKEY registers\n" - "-f List POKEY features used\n" - "-t Detect silence and loops\n" - "-p Calculate fingerprint\n" - "-l Calculate hash representation (fingerprint is a substring of this)\n" - "-c Dump 6502 trace\n" - "-u List used unofficial 6502 instructions and BRK\n" - "-b HEXADDR Print time the given instruction reached\n" - "-a Run Acid800 test\n" - "-v Display version information\n" - "Options:\n" - "-s SONG Process the specified subsong (zero-based)\n" - ); -} - -static cibool store_pokey(unsigned char *p, Pokey *pokey) -{ - cibool is_silence = TRUE; -#define STORE_CHANNEL(ch) \ - if ((pokey->audc##ch & 0xf) != 0) { \ - is_silence = FALSE; \ - p[ch * 2 - 2] = pokey->audf##ch; \ - p[ch * 2 - 1] = pokey->audc##ch; \ - } \ - else { \ - p[ch * 2 - 2] = 0; \ - p[ch * 2 - 1] = 0; \ - } - STORE_CHANNEL(1) - STORE_CHANNEL(2) - STORE_CHANNEL(3) - STORE_CHANNEL(4) - p[8] = pokey->audctl; - return is_silence; -} - -static cibool store_pokeys(int frame) -{ - unsigned char *p = registers_dump + 18 * frame; - cibool is_silence = store_pokey(p, &asap->pokeys.basePokey); - is_silence &= store_pokey(p + 9, &asap->pokeys.extraPokey); - return is_silence; -} - -static cibool has_loop_at(int first_frame, int second_frame) -{ - return memcmp(registers_dump + 18 * first_frame, registers_dump + 18 * second_frame, 18 * loop_check_frames) == 0; -} - -static int get_hash(int player_call) -{ - int hash = 0; - int i; - for (i = 1; i < 9; i += 2) { - if ((registers_dump[18 * player_call + i] & 0xe0) == 0xe0) - registers_dump[18 * player_call + i] &= 0xbf; - if ((registers_dump[18 * player_call + i + 9] & 0xe0) == 0xe0) - registers_dump[18 * player_call + i + 9] &= 0xbf; - } - for (i = 0; i < 18; i++) - hash += registers_dump[18 * player_call + i]; - return hash; -} - -static int get_byte_hash(int frame) -{ - int res = get_hash(frame); - res = (res & 0xff) + (res >> 8); - res = (res & 0xff) + (res >> 8); - return res; -} - -static void compute_entrophy(int frames) -{ - int entrophy_counters[256]; -#define ENTROPHY_LEN 32 - int emaxvalue = 0; - int emaxframe = 0; - int evalue = 0; - int i; - int v; - - for (i = 0; i < 256; i++) - entrophy_counters[i] = 0; - - if (long_fingerprint) { - for (i = 0; i < frame; i++) { - v = get_byte_hash(i); - printf("%02x", v); - } - printf("\n"); - } - else { - for (i = 0; i < frames; i++) { - v = get_byte_hash(i); - if (entrophy_counters[v] == 0) - evalue++; - entrophy_counters[v]++; - - if (i >= ENTROPHY_LEN) { - v = get_byte_hash(i - ENTROPHY_LEN); - entrophy_counters[v]--; - if (entrophy_counters[v] == 0) - evalue--; - - if (emaxvalue < evalue) { - emaxvalue = evalue; - emaxframe = i - ENTROPHY_LEN; - } - } - } - - for (i = 0; i < ENTROPHY_LEN; i++) { - v = get_byte_hash(i + emaxframe); - printf("%02x", v); - } - printf("\n"); - } -} - -static void print_pokey(const Pokey *pokey) -{ - printf( - "%02X %02X %02X %02X %02X %02X %02X %02X %02X", - pokey->audf1, pokey->audc1, pokey->audf2, pokey->audc2, - pokey->audf3, pokey->audc3, pokey->audf4, pokey->audc4, pokey->audctl - ); -} - -static cibool is_ultrasound(int period_cycles, int audc) -{ - if (period_cycles > 112) - return FALSE; - if ((audc & 0xf) == 0) - return FALSE; - audc >>= 4; - return audc == 10 || audc == 14; -} - -static void scan_song(int song) -{ - int silence_run = 0; - int running_hash = 0; - int i; - if (!ASAP_PlaySong(asap, song, -1)) { - fprintf(stderr, "asapscan: PlaySong failed\n"); - return; - } - if (acid) - scan_frames = seconds_to_frames(ASAPInfo_GetDuration(&asap->moduleInfo, song) / 1000); - for (i = 0; i < 1 << HASH_BITS; i++) - hash_first[i] = -1; - for (frame = 0; frame < scan_frames; frame++) { - ASAP_Do6502Frame(asap); - if (dump) { - printf("%6.2f: ", (double) frame * CYCLES_PER_FRAME / MAIN_CLOCK); - print_pokey(&asap->pokeys.basePokey); - if (asap->moduleInfo.channels == 2) { - printf(" | "); - print_pokey(&asap->pokeys.extraPokey); - } - printf("\n"); - } - if (features != 0) { - int c1 = asap->pokeys.basePokey.audctl; - int c2 = asap->pokeys.extraPokey.audctl; - if (((c1 | c2) & 1) != 0) - features |= FEATURE_15_KHZ; - if (((c1 | c2) & 6) != 0) - features |= FEATURE_HIPASS_FILTER; - if (((c1 & 0x40) != 0 && (asap->pokeys.basePokey.audc1 & 0xf) != 0) - || ((c1 & 0x20) != 0 && (asap->pokeys.basePokey.audc3 & 0xf) != 0)) - features |= FEATURE_LOW_OF_16_BIT; - if (((c1 | c2) & 0x80) != 0) - features |= FEATURE_9_BIT_POLY; - if (is_ultrasound(asap->pokeys.basePokey.periodCycles1, asap->pokeys.basePokey.audc1) - || is_ultrasound(asap->pokeys.basePokey.periodCycles2, asap->pokeys.basePokey.audc2) - || is_ultrasound(asap->pokeys.basePokey.periodCycles3, asap->pokeys.basePokey.audc3) - || is_ultrasound(asap->pokeys.basePokey.periodCycles4, asap->pokeys.basePokey.audc4)) - features |= FEATURE_ULTRASOUND; - } - if (detect_time) { - if (store_pokeys(frame)) { - silence_run++; - if (silence_run >= silence_frames && /* do not trigger at the initial silence */ silence_run < frame) { - if (fingerprint) - compute_entrophy(frame + 1 - silence_run); - else - print_time(frame + 1 - silence_run, FALSE); - return; - } - } - else - silence_run = 0; - if (frame >= loop_check_frames) { - int first_frame; - int second_frame = frame - loop_check_frames; - running_hash &= (1 << HASH_BITS) - 1; - /* Now running_hash is for the last loop_check_player_calls player calls before player_call. */ - for (first_frame = hash_first[running_hash]; first_frame >= 0; first_frame = hash_next[first_frame]) { - if (has_loop_at(first_frame, second_frame)) { - int loop_len = second_frame - first_frame; - if (loop_len >= loop_min_frames) { - if (fingerprint) - compute_entrophy(second_frame); - else - print_time(second_frame, TRUE); - return; - } - if (loop_len == 1) { - /* POKEY registers do not change - probably an ultrasound */ - if (fingerprint) - compute_entrophy(first_frame); - else - print_time(first_frame, FALSE); - return; - } - } - } - /* Insert into hashtable. */ - if (hash_first[running_hash] >= 0) - hash_next[hash_last[running_hash]] = second_frame; - else - hash_first[running_hash] = second_frame; - hash_next[second_frame] = -1; - hash_last[running_hash] = second_frame; - /* Update running_hash. */ - running_hash -= get_hash(second_frame); - } - running_hash += get_hash(frame); - } - } - if (detect_time) { - if (fingerprint) - compute_entrophy(loop_check_frames); - else - printf("No silence or loop detected in song %d\n", song); - } - if (acid) { -#ifdef _WIN32 - HANDLE so = GetStdHandle(STD_OUTPUT_HANDLE); - CONSOLE_SCREEN_BUFFER_INFO csbi; - GetConsoleScreenBufferInfo(so, &csbi); -#define set_color(x) SetConsoleTextAttribute(so, x) -#else -#define set_color(x) -#endif - for (i = 0x1000; i <= 0x17ff; i++) { - unsigned char c = asap->memory[i]; - if (c == 0) - break; - if (memcmp(asap->memory + i, "Pass", 4) == 0) - set_color((csbi.wAttributes & ~0xf) | 10); - else if (memcmp(asap->memory + i, "FAIL", 4) == 0) { - exit_code = 1; - set_color((csbi.wAttributes & ~0xf) | 12); - } - else if (memcmp(asap->memory + i, "Skipped", 7) == 0) { - exit_code = 1; - set_color((csbi.wAttributes & ~0xf) | 14); - } - if (c == 0x9b) - c = '\n'; - putchar(c); - } - if (asap->memory[i - 1] != 0x9b) { - set_color((csbi.wAttributes & ~0xf) | 13); - printf("NO RESPONSE\n"); - exit_code = 1; - } - set_color(csbi.wAttributes); - } -} - -int main(int argc, char **argv) -{ - int i; - const char *input_file = NULL; - int song = -1; - int scan_seconds = 15 * 60; - int silence_seconds = 5; - int loop_check_seconds = 3 * 60; - int loop_min_seconds = 5; - FILE *fp; - static unsigned char module[ASAPInfo_MAX_MODULE_LENGTH]; - int module_len; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-d") == 0) - dump = TRUE; - else if (strcmp(argv[i], "-p") == 0) - detect_time = fingerprint = TRUE; - else if (strcmp(argv[i], "-l") == 0) - detect_time = fingerprint = long_fingerprint = TRUE; - else if (strcmp(argv[i], "-f") == 0) - features = FEATURE_CHECK; - else if (strcmp(argv[i], "-t") == 0) - detect_time = TRUE; - else if (strcmp(argv[i], "-c") == 0) - cpu_trace |= CPU_TRACE_PRINT; - else if (strcmp(argv[i], "-u") == 0) - cpu_trace |= CPU_TRACE_UNOFFICIAL; - else if (strcmp(argv[i], "-b") == 0) { - print_time_at_pc = (int) strtol(argv[++i], NULL, 16); - cpu_trace |= CPU_TRACE_PC_TIME; - } - else if (strcmp(argv[i], "-s") == 0) - song = atoi(argv[++i]); - else if (strcmp(argv[i], "-a") == 0) - acid = TRUE; - else if (strcmp(argv[i], "-v") == 0) { - printf("asapscan " ASAPInfo_VERSION "\n"); - return 0; - } - else { - if (input_file != NULL) { - print_help(); - return 1; - } - input_file = argv[i]; - } - } - if (dump + features + detect_time + cpu_trace + acid == 0 || input_file == NULL) { - print_help(); - return 1; - } - fp = fopen(input_file, "rb"); - if (fp == NULL) { - fprintf(stderr, "asapscan: cannot open %s\n", input_file); - return 1; - } - module_len = fread(module, 1, sizeof(module), fp); - fclose(fp); - asap = ASAP_New(); - if (!ASAP_Load(asap, input_file, module, module_len)) { - fprintf(stderr, "asapscan: %s: format not supported\n", input_file); - return 1; - } - scan_frames = seconds_to_frames(scan_seconds); - silence_frames = seconds_to_frames(silence_seconds); - loop_check_frames = seconds_to_frames(loop_check_seconds); - loop_min_frames = seconds_to_frames(loop_min_seconds); - registers_dump = malloc(scan_frames * 18); - hash_next = malloc(scan_frames * sizeof(hash_next[0])); - if (registers_dump == NULL || hash_next == NULL) { - fprintf(stderr, "asapscan: out of memory\n"); - return 1; - } - if (song >= 0) - scan_song(song); - else - for (song = 0; song < asap->moduleInfo.songs; song++) - scan_song(song); - free(registers_dump); - if (features != 0) { - if ((features & FEATURE_15_KHZ) != 0) - printf("15 kHz clock\n"); - if ((features & FEATURE_HIPASS_FILTER) != 0) - printf("Hi-pass filter\n"); - if ((features & FEATURE_LOW_OF_16_BIT) != 0) - printf("Low byte of 16-bit counter\n"); - if ((features & FEATURE_9_BIT_POLY) != 0) - printf("9-bit poly\n"); - if ((features & FEATURE_ULTRASOUND) != 0) - printf("Ultrasound\n"); - } - if ((cpu_trace & CPU_TRACE_UNOFFICIAL) != 0) { - for (i = 0; i < 256; i++) { - if (cpu_opcodes[i] == (CPU_OPCODE_UNOFFICIAL | CPU_OPCODE_USED)) - print_unofficial_mnemonic(i); - } - } - return exit_code; -} diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/asap-sdl.c kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/asap-sdl.c --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/asap-sdl.c 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/asap-sdl.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,160 +0,0 @@ -/* - * asap-sdl.c - simple SDL ASAP player - * - * Copyright (C) 2010-2011 Piotr Fusik - * - * This file is part of ASAP (Another Slight Atari Player), - * see http://asap.sourceforge.net - * - * ASAP is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. - * - * ASAP is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ASAP; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include - -#include "asap.h" - -static int song = -1; - -static void print_help(void) -{ - printf( - "Usage: asap-sdl [OPTIONS] INPUTFILE\n" - "INPUTFILE must be in a supported format:\n" - "SAP, CMC, CM3, CMR, CMS, DMC, DLT, MPT, MPD, RMT, TMC, TM8, TM2 or FC.\n" - "Options:\n" - "-s SONG --song=SONG Select subsong number (zero-based)\n" - "-h --help Display this information\n" - "-v --version Display version information\n" - ); -} - -static void fatal_error(const char *format, ...) -{ - va_list args; - va_start(args, format); - fprintf(stderr, "asap-sdl: "); - vfprintf(stderr, format, args); - fputc('\n', stderr); - va_end(args); - exit(1); -} - -static void sdl_error(const char *fun) -{ - fatal_error("%s failed: %s", fun, SDL_GetError()); -} - -static void set_song(const char *s) -{ - song = 0; - do { - if (*s < '0' || *s > '9') - fatal_error("subsong number must be an integer"); - song = 10 * song + *s++ - '0'; - if (song >= ASAPInfo_MAX_SONGS) - fatal_error("maximum subsong number is %d", ASAPInfo_MAX_SONGS - 1); - } while (*s != '\0'); -} - -static void print_header(const char *name, const char *value) -{ - if (value[0] != '\0') - printf("%s: %s\n", name, value); -} - -static void audio_callback(void *userdata, Uint8 *stream, int len) -{ - ASAP_Generate((ASAP *) userdata, stream, len, ASAPSampleFormat_S16_L_E); -} - -static void process_file(const char *input_file) -{ - FILE *fp; - static unsigned char module[ASAPInfo_MAX_MODULE_LENGTH]; - int module_len; - ASAP *asap; - const ASAPInfo *info; - SDL_AudioSpec desired; - - fp = fopen(input_file, "rb"); - if (fp == NULL) - fatal_error("cannot open %s", input_file); - module_len = fread(module, 1, sizeof(module), fp); - fclose(fp); - - asap = ASAP_New(); - if (!ASAP_Load(asap, input_file, module, module_len)) - fatal_error("%s: unsupported file", input_file); - info = ASAP_GetInfo(asap); - if (song < 0) - song = ASAPInfo_GetDefaultSong(info); - if (!ASAP_PlaySong(asap, song, -1)) - fatal_error("%s: PlaySong failed", input_file); - print_header("Name", ASAPInfo_GetTitle(info)); - print_header("Author", ASAPInfo_GetAuthor(info)); - print_header("Date", ASAPInfo_GetDate(info)); - - if (SDL_Init(SDL_INIT_AUDIO) != 0) - sdl_error("SDL_Init"); - desired.freq = ASAP_SAMPLE_RATE; - desired.format = AUDIO_S16LSB; - desired.channels = ASAPInfo_GetChannels(info); - desired.samples = 4096; - desired.callback = audio_callback; - desired.userdata = asap; - if (SDL_OpenAudio(&desired, NULL) != 0) - sdl_error("SDL_OpenAudio"); - SDL_PauseAudio(0); - printf(" playing - press Enter to quit\n"); - getchar(); - SDL_Quit(); -} - -int main(int argc, char *argv[]) -{ - const char *options_error = "no input file"; - int i; - for (i = 1; i < argc; i++) { - const char *arg = argv[i]; - if (arg[0] != '-') { - process_file(arg); - options_error = NULL; - continue; - } - options_error = "options must be specified before the input file"; -#define is_opt(c) (arg[1] == c && arg[2] == '\0') - if (is_opt('s')) - set_song(argv[++i]); - else if (strncmp(arg, "--song=", 7) == 0) - set_song(arg + 7); - else if (is_opt('h') || strcmp(arg, "--help") == 0) { - print_help(); - options_error = NULL; - } - else if (is_opt('v') || strcmp(arg, "--version") == 0) { - printf("asap-sdl " ASAPInfo_VERSION "\n"); - options_error = NULL; - } - else - fatal_error("unknown option: %s", arg); - } - if (options_error != NULL) { - fprintf(stderr, "asap-sdl: %s\n", options_error); - print_help(); - return 1; - } - return 0; -} diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/asap.spec kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/asap.spec --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/asap.spec 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/asap.spec 1970-01-01 00:00:00.000000000 +0000 @@ -1,123 +0,0 @@ -Name: asap -Version: 3.1.5 -Release: 1 -Summary: Player of Atari 8-bit music -License: GPLv2+ -Group: Applications/Multimedia -Source: http://prdownloads.sourceforge.net/asap/asap-%{version}.tar.gz -URL: http://asap.sourceforge.net/ -BuildRoot: %{_tmppath}/asap-root - -%description -ASAP is a player of Atari 8-bit music for modern computers. -It emulates the POKEY sound chip and the 6502 processor. -ASAP supports the following file formats: -SAP, CMC, CM3, CMR, CMS, DMC, DLT, MPT, MPD, RMT, TMC, TM8, TM2, FC. - -%package devel -Summary: Development library providing Atari 8-bit music emulation -Group: Development/Libraries - -%description devel -These are the files needed for compiling programs that use libasap. - -%package xmms -Summary: ASAP plugin for XMMS -Group: Applications/Multimedia -Requires: xmms -BuildRequires: xmms-devel - -%description xmms -Provides playback of Atari 8-bit music in XMMS. -Supports the following file formats: -SAP, CMC, CM3, CMR, CMS, DMC, DLT, MPT, MPD, RMT, TMC, TM8, TM2, FC. - -%package gstreamer0.10 -Summary: ASAP plugin for GStreamer 0.10 -Group: Applications/Multimedia -Requires: gstreamer >= 0.10.36 -Requires: gstreamer < 0.11 -BuildRequires: gstreamer-devel -# 0.10.36 is the first version to properly recognize SAP files. This isn't required for the build. - -%description gstreamer0.10 -Provides playback of Atari 8-bit music in the SAP format in GStreamer-based players. - -%package vlc -Summary: ASAP plugin for VLC -Group: Applications/Multimedia -Requires: vlc -BuildRequires: vlc-devel - -%description vlc -Provides playback of Atari 8-bit music in VLC. -Supports the following file formats: SAP, RMT, FC. - -%prep -%setup -q - -%build -make asapconv libasap.a asap-xmms asap-gstreamer asap-vlc - -%install -rm -rf $RPM_BUILD_ROOT -make DESTDIR=$RPM_BUILD_ROOT prefix=%{_prefix} install install-xmms install-gstreamer install-vlc - -%clean -rm -rf $RPM_BUILD_ROOT - -%files -%defattr(-,root,root) -%doc README.html -%{_bindir}/asapconv - -%files devel -%defattr(-,root,root) -%{_includedir}/asap.h -%{_libdir}/libasap.a - -%files xmms -%defattr(-,root,root) -%{_libdir}/xmms/Input/libasap-xmms.so - -%files gstreamer0.10 -%defattr(-,root,root) -%{_libdir}/gstreamer-0.10/libgstasapdec.so - -%files vlc -%defattr(-,root,root) -%{_libdir}/vlc/plugins/demux/libasap_plugin.so - -%changelog -* Fri Aug 16 2013 Piotr Fusik -- 3.1.5-1 -- Corrected descriptions of GStreamer and VLC plugins - they don't support all the formats - -* Mon Apr 29 2013 Piotr Fusik -- 3.1.4-1 -- lib64 compatibility -- Removed the Audacious subpackage - -* Tue Dec 4 2012 Piotr Fusik -- 3.1.3-1 -- Added subpackages with GStreamer and VLC plugins - -* Mon Jun 25 2012 Piotr Fusik -- 3.1.2-1 - -* Wed Oct 26 2011 Piotr Fusik -- 3.1.1-1 - -* Sat Sep 24 2011 Piotr Fusik -- 3.1.0-1 - -* Fri Jul 15 2011 Piotr Fusik -- 3.0.1-1 - -* Thu May 19 2011 Piotr Fusik -- 3.0.0-1 -- Added subpackages with Audacious and XMMS plugins - -* Wed Nov 3 2010 Piotr Fusik -- 2.1.2-1 -- Initial packaging diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/asapwriter.ci kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/asapwriter.ci --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/asapwriter.ci 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/asapwriter.ci 1970-01-01 00:00:00.000000000 +0000 @@ -1,811 +0,0 @@ -// asapwriter.ci - format conversions -// -// Copyright (C) 2011-2012 Piotr Fusik -// -// This file is part of ASAP (Another Slight Atari Player), -// see http://asap.sourceforge.net -// -// ASAP is free software; you can redistribute it and/or modify it -// under the terms of the GNU General Public License as published -// by the Free Software Foundation; either version 2 of the License, -// or (at your option) any later version. -// -// ASAP is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -// See the GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ASAP; if not, write to the Free Software Foundation, Inc., -// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -public delegate void StringConsumer(string s); - -public delegate void ByteWriter(int data); - -/// Static methods for writing modules in different formats. -public class ASAPWriter -{ - /// Enumerates possible file types the given module can be written as. - public static void EnumSaveExts( - /// Receives filename extensions without the leading dot. - StringConsumer output, - /// File information. - ASAPInfo info, - /// Contents of the file. - byte[] module, - /// Length of the file. - int moduleLen) - { - switch (info.Type) { - case ASAPModuleType.SapB: - case ASAPModuleType.SapC: - output("sap"); - string ext = info.GetOriginalModuleExt(module, moduleLen); - if (ext != null) - output(ext); - output("xex"); - break; - case ASAPModuleType.SapD: - output("sap"); - if (info.Fastplay == 312) - output("xex"); - break; - case ASAPModuleType.SapS: - output("sap"); - break; - default: - output(info.GetOriginalModuleExt(module, moduleLen)); - output("sap"); - output("xex"); - break; - } - } - - static void TwoDigitsToString(byte[] result, int offset, int value) - { - result[offset] = '0' + value / 10; - result[offset + 1] = '0' + value % 10; - } - - static bool SecondsToString(byte[] result, int offset, int value) - { - if (value < 0 || value >= 100 * 60 * 1000) - return false; - value /= 1000; - TwoDigitsToString(result, offset, value / 60); - result[offset + 2] = ':'; - TwoDigitsToString(result, offset + 3, value % 60); - return true; - } - - /// Maximum length of text representation of a duration. - /// Corresponds to the longest format which is `"mm:ss.xxx"`. - public const int MaxDurationLength = 9; - - /// Writes text representation of the given duration. - /// Returns the number of bytes written to `result`. - public static int DurationToString( - /// The output buffer. - byte[] result, - /// Number of milliseconds. - int value) - { - if (!SecondsToString(result, 0, value)) - return 0; - value %= 1000; - if (value == 0) - return 5; - result[5] = '.'; - TwoDigitsToString(result, 6, value / 10); - value %= 10; - if (value == 0) - return 8; - result[8] = '0' + value; - return 9; - } - - static void WriteWord(ByteWriter w, int value) - { - w(value & 0xff); - w((value >> 8) & 0xff); - } - - static void WriteBytes(ByteWriter w, byte[] array, int startIndex, int endIndex) - { - while (startIndex < endIndex) - w(array[startIndex++]); - } - - static void WriteString(ByteWriter w, string s) - { - int n = s.Length; - for (int i = 0; i < n; i++) - w(s[i]); - } - - static void WriteDec(ByteWriter w, int value) - { - if (value >= 10) { - WriteDec(w, value / 10); - value %= 10; - } - w('0' + value); - } - - static void WriteTextSapTag(ByteWriter w, string tag, string value) - { - WriteString(w, tag); - w('"'); - if (value.Length == 0) - value = ""; - WriteString(w, value); - w('"'); - w('\r'); - w('\n'); - } - - static void WriteDecSapTag(ByteWriter w, string tag, int value) - { - WriteString(w, tag); - WriteDec(w, value); - w('\r'); - w('\n'); - } - - static void WriteHexSapTag(ByteWriter w, string tag, int value) - { - if (value < 0) - return; - WriteString(w, tag); - for (int i = 12; i >= 0; i -= 4) { - int digit = (value >> i) & 0xf; - w(digit + (digit < 10 ? '0' : 'A' - 10)); - } - w('\r'); - w('\n'); - } - - static void WriteSapHeader(ByteWriter w, ASAPInfo info, int type, int init, int player) - { - WriteString(w, "SAP\r\n"); - WriteTextSapTag(w, "AUTHOR ", info.Author); - WriteTextSapTag(w, "NAME ", info.Title); - WriteTextSapTag(w, "DATE ", info.Date); - if (info.Songs > 1) { - WriteDecSapTag(w, "SONGS ", info.Songs); - if (info.DefaultSong > 0) - WriteDecSapTag(w, "DEFSONG ", info.DefaultSong); - } - if (info.Channels > 1) - WriteString(w, "STEREO\r\n"); - if (info.Ntsc) - WriteString(w, "NTSC\r\n"); - WriteString(w, "TYPE "); - w(type); - w('\r'); - w('\n'); - if (info.Fastplay != 312 || info.Ntsc) - WriteDecSapTag(w, "FASTPLAY ", info.Fastplay); - if (type == 'C') - WriteHexSapTag(w, "MUSIC ", info.Music); - WriteHexSapTag(w, "INIT ", init); - WriteHexSapTag(w, "PLAYER ", player); - WriteHexSapTag(w, "COVOX ", info.CovoxAddr); - for (int song = 0; song < info.Songs; song++) { - if (info.Durations[song] < 0) - break; - WriteString(w, "TIME "); - byte[MaxDurationLength] s; - WriteBytes(w, s, 0, DurationToString(s, info.Durations[song])); - if (info.Loops[song]) - WriteString(w, " LOOP"); - w('\r'); - w('\n'); - } - } - - static void WriteExecutableHeader(ByteWriter w, int[] initAndPlayer, ASAPInfo info, int type, int init, int player) - { - if (initAndPlayer == null) - WriteSapHeader(w, info, type, init, player); - else { - initAndPlayer[0] = init; - initAndPlayer[1] = player; - } - } - - static void WritePlaTaxLda0(ByteWriter w) - { - w(0x68); - w(0xaa); - w(0xa9); - w(0); - } - - static void WriteCmcInit(ByteWriter w, int[] initAndPlayer, ASAPInfo info) - { - if (initAndPlayer == null) - return; // to SAP - const int initCmc = 0xfe0; // cms.obx ends at 0xfba - WriteWord(w, initCmc); - WriteWord(w, initCmc + 16); - w(0x48); // PHA - w(0xa2); w(info.Music & 0xff); // LDX #> 8); // LDY #>MUSIC - w(0xa9); w(0x70); // LDA #$70 - w(0x20); WriteWord(w, initAndPlayer[1] + 3); // JSR PLAYER+3 - WritePlaTaxLda0(w); // PLA; TAX; LDA #0 - w(0x4c); WriteWord(w, initAndPlayer[1] + 3); // JMP PLAYER+3 - initAndPlayer[0] = initCmc; - initAndPlayer[1] += 6; - } - - static void WriteExecutableFromSap(ByteWriter w, int[] initAndPlayer, ASAPInfo info, int type, byte[] module, int moduleLen) - { - WriteExecutableHeader(w, initAndPlayer, info, type, info.Init, info.Player); - WriteBytes(w, module, info.HeaderLen, moduleLen); - } - - static int WriteExecutableHeaderForSongPos(ByteWriter w, int[] initAndPlayer, ASAPInfo info, int player, int codeForOneSong, int codeForManySongs, int playerOffset) - { - if (info.Songs != 1) { - WriteExecutableHeader(w, initAndPlayer, info, 'B', player - codeForManySongs, player + playerOffset); - return player - codeForManySongs - info.Songs; - } - WriteExecutableHeader(w, initAndPlayer, info, 'B', player - codeForOneSong, player + playerOffset); - return player - codeForOneSong; - } - - internal static void WriteExecutable(ByteWriter w, int[] initAndPlayer, ASAPInfo info, byte[] module, int moduleLen) - { - byte[] playerRoutine = ASAP6502.GetPlayerRoutine(info); - int player = -1; - int playerLastByte = -1; - if (playerRoutine != null) { - player = ASAPInfo.GetWord(playerRoutine, 2); - playerLastByte = ASAPInfo.GetWord(playerRoutine, 4); - if (info.Music <= playerLastByte) - throw "Module address conflicts with the player routine"; - } - int startAddr; - switch (info.Type) { - case ASAPModuleType.SapB: - WriteExecutableFromSap(w, initAndPlayer, info, 'B', module, moduleLen); - break; - case ASAPModuleType.SapC: - WriteExecutableFromSap(w, initAndPlayer, info, 'C', module, moduleLen); - WriteCmcInit(w, initAndPlayer, info); - break; - case ASAPModuleType.SapD: - WriteExecutableFromSap(w, initAndPlayer, info, 'D', module, moduleLen); - break; - case ASAPModuleType.SapS: - WriteExecutableFromSap(w, initAndPlayer, info, 'S', module, moduleLen); - break; - case ASAPModuleType.Cmc: - case ASAPModuleType.Cm3: - case ASAPModuleType.Cmr: - case ASAPModuleType.Cms: - WriteExecutableHeader(w, initAndPlayer, info, 'C', -1, player); - w(0xff); // some modules start with zeros - w(0xff); - WriteBytes(w, module, 2, moduleLen); - WriteBytes(w, playerRoutine, 2, playerLastByte - player + 7); - WriteCmcInit(w, initAndPlayer, info); - break; - case ASAPModuleType.Dlt: - startAddr = WriteExecutableHeaderForSongPos(w, initAndPlayer, info, player, 5, 7, 0x103); - if (moduleLen == 0x2c06) { - // append zero to the module - WriteBytes(w, module, 0, 4); - WriteWord(w, 0x4c00); - WriteBytes(w, module, 6, moduleLen); - w(0); - } - else - WriteBytes(w, module, 0, moduleLen); - WriteWord(w, startAddr); - WriteWord(w, playerLastByte); - if (info.Songs != 1) { - WriteBytes(w, info.SongPos, 0, info.Songs); - w(0xaa); // TAX - w(0xbc); WriteWord(w, startAddr); // LDY SONG2POS,X - } - else { - w(0xa0); w(0); // LDY #0 - } - w(0x4c); WriteWord(w, player + 0x100); // JMP PLAYER+$100 - WriteBytes(w, playerRoutine, 6, playerLastByte - player + 7); - break; - case ASAPModuleType.Mpt: - startAddr = WriteExecutableHeaderForSongPos(w, initAndPlayer, info, player, 13, 17, 3); - WriteBytes(w, module, 0, moduleLen); - WriteWord(w, startAddr); - WriteWord(w, playerLastByte); - if (info.Songs != 1) { - WriteBytes(w, info.SongPos, 0, info.Songs); - w(0x48); // PHA - } - w(0xa0); w(info.Music & 0xff); // LDY #> 8); // LDX #>MUSIC - w(0xa9); w(0); // LDA #0 - w(0x20); WriteWord(w, player); // JSR PLAYER - if (info.Songs != 1) { - w(0x68); w(0xa8); // PLA; TAY - w(0xbe); WriteWord(w, startAddr); // LDX SONG2POS,Y - } - else { - w(0xa2); w(0); // LDX #0 - } - w(0xa9); w(2); // LDA #2 - WriteBytes(w, playerRoutine, 6, playerLastByte - player + 7); - break; - case ASAPModuleType.Rmt: - WriteExecutableHeader(w, initAndPlayer, info, 'B', ASAPInfo.RmtInit, 0x603); - WriteBytes(w, module, 0, ASAPInfo.GetWord(module, 4) - info.Music + 7); - WriteWord(w, ASAPInfo.RmtInit); - if (info.Songs != 1) { - WriteWord(w, ASAPInfo.RmtInit + 10 + info.Songs); - w(0xa8); // TAY - w(0xb9); WriteWord(w, ASAPInfo.RmtInit + 11); // LDA SONG2POS,Y - } - else { - WriteWord(w, ASAPInfo.RmtInit + 8); - w(0xa9); w(0); // LDA #0 - } - w(0xa2); w(info.Music & 0xff); // LDX #> 8); // LDY #>MUSIC - w(0x4c); WriteWord(w, 0x600); // JMP PLAYER - if (info.Songs != 1) - WriteBytes(w, info.SongPos, 0, info.Songs); - WriteBytes(w, playerRoutine, 2, playerLastByte - player + 7); - break; - case ASAPModuleType.Tmc: - const int[4] tmcPlayerOffset = { 3, -9, -10, -10 }; - int player2 = player + tmcPlayerOffset[module[0x25] - 1]; - const int[4] tmcInitOffset = { -14, -16, -17, -17 }; - startAddr = player2 + tmcInitOffset[module[0x25] - 1]; - if (info.Songs != 1) - startAddr -= 3; - WriteExecutableHeader(w, initAndPlayer, info, 'B', startAddr, player2); - WriteBytes(w, module, 0, moduleLen); - WriteWord(w, startAddr); - WriteWord(w, playerLastByte); - if (info.Songs != 1) - w(0x48); // PHA - w(0xa0); w(info.Music & 0xff); // LDY #> 8); // LDX #>MUSIC - w(0xa9); w(0x70); // LDA #$70 - w(0x20); WriteWord(w, player); // JSR PLAYER - if (info.Songs != 1) - WritePlaTaxLda0(w); // PLA; TAX; LDA #0 - else { - w(0xa9); w(0x60); // LDA #$60 - } - switch (module[0x25]) { - case 2: - w(0x06); w(0); // ASL 0 - w(0x4c); WriteWord(w, player); // JMP PLAYER - w(0xa5); w(0); // LDA 0 - w(0xe6); w(0); // INC 0 - w(0x4a); // LSR @ - w(0x90); w(5); // BCC PLAYER+3 - w(0xb0); w(6); // BCS PLAYER+6 - break; - case 3: - case 4: - w(0xa0); w(1); // LDY #1 - w(0x84); w(0); // STY 0 - w(0xd0); w(10); // BNE PLAYER - w(0xc6); w(0); // DEC 0 - w(0xd0); w(12); // BNE PLAYER+6 - w(0xa0); w(module[0x25]); // LDY #3 - w(0x84); w(0); // STY 0 - w(0xd0); w(3); // BNE PLAYER+3 - break; - } - WriteBytes(w, playerRoutine, 6, playerLastByte - player + 7); - break; - case ASAPModuleType.Tm2: - const int tm2Init = 0x1380; - WriteExecutableHeader(w, initAndPlayer, info, 'B', tm2Init, 0x803); - WriteBytes(w, module, 0, moduleLen); - WriteWord(w, tm2Init); - if (info.Songs != 1) { - WriteWord(w, tm2Init + 16); - w(0x48); // PHA - } - else - WriteWord(w, tm2Init + 14); - w(0xa0); w(info.Music & 0xff); // LDY #> 8); // LDX #>MUSIC - w(0xa9); w(0x70); // LDA #$70 - w(0x20); WriteWord(w, 0x800); // JSR PLAYER - if (info.Songs != 1) - WritePlaTaxLda0(w); // PLA; TAX; LDA #0 - else { - w(0xa9); w(0); // LDA #0 - w(0xaa); // TAX - } - w(0x4c); WriteWord(w, 0x800); // JMP PLAYER - WriteBytes(w, playerRoutine, 2, playerLastByte - player + 7); - break; - case ASAPModuleType.Fc: - WriteExecutableHeader(w, initAndPlayer, info, 'B', player, player + 3); - WriteWord(w, 0xffff); - WriteWord(w, info.Music); - WriteWord(w, info.Music + moduleLen - 1); - WriteBytes(w, module, 0, moduleLen); - WriteBytes(w, playerRoutine, 2, playerLastByte - player + 7); - break; - } - } - - const int XexInfoCharactersPerLine = 32; - - static int PadXexInfo(byte[] dest, int offset, int endColumn) - { - while (offset % XexInfoCharactersPerLine != endColumn) - dest[offset++] = ' '; - return offset; - } - - static int FormatXexInfoText(byte[] dest, int destLen, int endColumn, string src, bool author) - { - int srcLen = src.Length; - for (int srcOffset = 0; srcOffset < srcLen; ) { - int c = src[srcOffset++]; - if (c == ' ') { - if (author && srcOffset < srcLen && src[srcOffset] == '&') { - int authorLen; - for (authorLen = 1; srcOffset + authorLen < srcLen; authorLen++) { - if (src[srcOffset + authorLen] == ' ' && srcOffset + authorLen + 1 < srcLen && src[srcOffset + authorLen + 1] == '&') - break; - } - if (authorLen <= XexInfoCharactersPerLine && destLen % XexInfoCharactersPerLine + 1 + authorLen > XexInfoCharactersPerLine) { - destLen = PadXexInfo(dest, destLen, 1); // align author names after "by" and "&" - continue; - } - } - int wordLen; - for (wordLen = 0; srcOffset + wordLen < srcLen && src[srcOffset + wordLen] != ' '; wordLen++) { - } - if (wordLen <= XexInfoCharactersPerLine && destLen % XexInfoCharactersPerLine + 1 + wordLen > XexInfoCharactersPerLine) { - destLen = PadXexInfo(dest, destLen, 0); - continue; - } - } - dest[destLen++] = c; - } - return PadXexInfo(dest, destLen, endColumn); - } - - static void WriteXexInfoTextDl(ByteWriter w, int address, int len, int verticalScrollAt) - { - w(verticalScrollAt == 0 ? 0x62 : 0x42); - WriteWord(w, address); - for (int i = XexInfoCharactersPerLine; i < len; i += XexInfoCharactersPerLine) - w(i == verticalScrollAt ? 0x22 : 2); - } - - static void WriteXexInfo(ByteWriter w, ASAPInfo info) - { - byte[256] title; - int titleLen = FormatXexInfoText(title, 0, 0, info.Title.Length == 0 ? "(untitled)" : info.Title, false); - byte[256] author; - int authorLen; - if (info.Author.Length > 0) { - author[0] = 'b'; - author[1] = 'y'; - author[2] = ' '; - authorLen = FormatXexInfoText(author, 3, 0, info.Author, true); - } - else - authorLen = 0; - byte[256] other; - int otherLen = FormatXexInfoText(other, 0, XexInfoCharactersPerLine - 13, info.Date, false); - otherLen = FormatXexInfoText(other, otherLen, XexInfoCharactersPerLine - 5, info.Channels > 1 ? " STEREO" : " MONO", false); - int duration = info.Durations[info.DefaultSong]; - if (duration > 0 && SecondsToString(other, otherLen, duration + 999)) // round up to full seconds - otherLen += 5; - else - otherLen = PadXexInfo(other, otherLen, 0); - - const int xexInfoDl = 0xfc50; // must match xexinfo.asx - int totalCharacters = titleLen + authorLen + otherLen; - int totalLines = totalCharacters / XexInfoCharactersPerLine; - int otherAddress = xexInfoDl - otherLen; -#if HIDE_AUTHOR - int authorAddress = otherAddress - authorLen; - int hiddenAddress = authorAddress - authorLen; - int titleAddress = hiddenAddress - 8 - titleLen; -#else - int titleAddress = otherAddress - authorLen - 8 - titleLen; -#endif - WriteWord(w, titleAddress); - WriteBytes(w, BinaryResource("xexinfo.obx"), 4, 6); - WriteBytes(w, title, 0, titleLen); - for (int i = 0; i < 8; i++) - w(0x55); -#if HIDE_AUTHOR - if (authorLen > 0) { - WriteString(w, "(press space to show author)"); - for (int i = 28; i < authorLen; i++) - w(' '); - WriteBytes(w, author, 0, authorLen); - } -#else - WriteBytes(w, author, 0, authorLen); -#endif - WriteBytes(w, other, 0, otherLen); - for (int i = totalLines; i < 26; i++) - w(0x70); - w(0x30); - WriteXexInfoTextDl(w, titleAddress, titleLen, titleLen - XexInfoCharactersPerLine); - w(8); - w(0); -#if HIDE_AUTHOR - if (authorLen > 0) - WriteXexInfoTextDl(w, hiddenAddress, authorLen, -1); - w(0x10); - WriteXexInfoTextDl(w, otherAddress, otherLen, -1); - w(0x41); - WriteWord(w, xexInfoDl); - if (authorLen > 0) { - int dlAuthor = xexInfoDl + 32 - totalLines + titleLen / XexInfoCharactersPerLine; - w(0xa9); w(authorAddress & 0xff); // LDA #> 8); // LDA #>author - w(0x8d); WriteWord(w, dlAuthor + 1); // STA dl_author+1 - } - else { - // pad two bytes because DL is shorter due to no LMS for author - // show_author is just RTS, pad with more RTSes - for (int i = 0; i < 12; i++) - w(0x60); - } -#else - for (int i = 0; i < authorLen; i += XexInfoCharactersPerLine) - w(2); - w(0x10); - for (int i = 0; i < otherLen; i += XexInfoCharactersPerLine) - w(2); -#endif - WriteBytes(w, BinaryResource("xexinfo.obx"), 6, BinaryResource("xexinfo.obx").Length); - } - - static int WriteNativeHeader(ByteWriter w, ASAPInfo info, byte[] module) - { - int diff = info.Music - ASAPInfo.GetWord(module, 2); - int last = ASAPInfo.GetWord(module, 4) + diff; - if (last > 0xffff) - throw "Address set too high"; - w(0xff); - w(0xff); - WriteWord(w, info.Music); - WriteWord(w, last); - return diff; - } - - static void WriteRelocatedBytes(ByteWriter w, int diff, byte[] module, int lowOffset, int highOffset, int len, int shift) - { - for (int i = 0; i < len; i++) { - int address = module[lowOffset + i] + (module[highOffset + i] << 8); - if (address != 0 && address != 0xffff) - address += diff; - w((address >> shift) & 0xff); - } - } - - static void WriteRelocatedLowHigh(ByteWriter w, int diff, byte[] module, int lowOffset, int len) - { - WriteRelocatedBytes(w, diff, module, lowOffset, lowOffset + len, len, 0); - WriteRelocatedBytes(w, diff, module, lowOffset, lowOffset + len, len, 8); - } - - static void WriteRelocatedWords(ByteWriter w, int diff, byte[] module, int offset, int len) - { - for (int i = 0; i < len; i += 2) { - int address = module[offset + i] + (module[offset + i + 1] << 8); - if (address != 0 && address != 0xffff) - address += diff; - WriteWord(w, address); - } - } - - static void WriteNative(ByteWriter w, ASAPInfo info, byte[] module, int moduleLen) - { - int diff; - switch (info.Type) { - case ASAPModuleType.SapB: - case ASAPModuleType.SapC: - // SAP -> native - int offset = info.GetRmtSapOffset(module, moduleLen); - if (offset > 0) { - w(0xff); - w(0xff); - WriteBytes(w, module, offset, moduleLen); - break; - } - int blockLen = ASAPInfo.GetWord(module, info.HeaderLen + 4) - ASAPInfo.GetWord(module, info.HeaderLen + 2) + 7; - if (blockLen < 7 || info.HeaderLen + blockLen >= moduleLen) - throw "Cannot extract module from SAP"; - if (info.Init == 0x400 && info.Player == 0x403) - WriteBytes(w, module, info.HeaderLen + 6, info.HeaderLen + blockLen); // SAP -> FC - else - WriteBytes(w, module, info.HeaderLen, info.HeaderLen + blockLen); - break; - case ASAPModuleType.Cmc: - case ASAPModuleType.Cm3: - case ASAPModuleType.Cmr: - case ASAPModuleType.Cms: - // CMC -> CMC - diff = WriteNativeHeader(w, info, module); - WriteBytes(w, module, 6, 6 + 0x14); - WriteRelocatedLowHigh(w, diff, module, 6 + 0x14, 64); - WriteBytes(w, module, 6 + 0x14 + 128, moduleLen); - break; - case ASAPModuleType.Dlt: - // DLT -> DLT - diff = WriteNativeHeader(w, info, module); - WriteBytes(w, module, 6, moduleLen); - break; - case ASAPModuleType.Mpt: - // MPT -> MPT - diff = WriteNativeHeader(w, info, module); - WriteRelocatedWords(w, diff, module, 6, 64 + 128); - WriteBytes(w, module, 6 + 64 + 128, 6 + 64 + 128 + 256); - WriteRelocatedLowHigh(w, diff, module, 6 + 64 + 128 + 256, 4); - WriteBytes(w, module, 6 + 64 + 128 + 256 + 8, moduleLen); - break; - case ASAPModuleType.Rmt: - // RMT -> RMT - diff = WriteNativeHeader(w, info, module); - WriteBytes(w, module, 6, 6 + 8); - int music = ASAPInfo.GetWord(module, 2); - int patternLowAddress = ASAPInfo.GetWord(module, 0x10); - int pointersAndInstrumentsLen = patternLowAddress - music - 8; - WriteRelocatedWords(w, diff, module, 6 + 8, pointersAndInstrumentsLen); - int patterns = ASAPInfo.GetWord(module, 0x12) - patternLowAddress; - WriteRelocatedLowHigh(w, diff, module, 6 + 8 + pointersAndInstrumentsLen, patterns); - int songOffset = 6 + ASAPInfo.GetWord(module, 0x14) - music; - WriteBytes(w, module, 6 + 8 + pointersAndInstrumentsLen + (patterns << 1), songOffset); - int songEnd = 7 + ASAPInfo.GetWord(module, 4) - music; - while (songOffset + 3 < songEnd) { - int nextSongOffset = songOffset + module[9] - '0'; - if (module[songOffset] == 0xfe) { - w(0xfe); - w(module[songOffset + 1]); - WriteWord(w, ASAPInfo.GetWord(module, songOffset + 2) + diff); - songOffset += 4; - } - if (nextSongOffset > songEnd) - nextSongOffset = songEnd; - WriteBytes(w, module, songOffset, nextSongOffset); - songOffset = nextSongOffset; - } - WriteBytes(w, module, songOffset, songEnd); - if (moduleLen >= songEnd + 5) { - WriteRelocatedWords(w, diff, module, songEnd, 4); - WriteBytes(w, module, songEnd + 4, moduleLen); - } - break; - case ASAPModuleType.Tmc: - // TMC -> TMC - diff = WriteNativeHeader(w, info, module); - WriteBytes(w, module, 6, 6 + 32); - WriteRelocatedLowHigh(w, diff, module, 6 + 32, 64); - WriteRelocatedLowHigh(w, diff, module, 6 + 32 + 128, 128); - WriteBytes(w, module, 6 + 32 + 128 + 256, moduleLen); - break; - case ASAPModuleType.Tm2: - // TM2 -> TM2 - diff = WriteNativeHeader(w, info, module); - WriteBytes(w, module, 6, 6 + 128); - WriteRelocatedBytes(w, diff, module, 6 + 128, 6 + 128 + 128 + 512, 128, 0); - WriteRelocatedLowHigh(w, diff, module, 6 + 128 + 128, 256); - WriteRelocatedBytes(w, diff, module, 6 + 128, 6 + 128 + 128 + 512, 128, 8); - WriteBytes(w, module, 6 + 128 + 128 + 512 + 128, moduleLen); - break; - case ASAPModuleType.Fc: - // FC -> FC - WriteBytes(w, module, 0, moduleLen); - break; - default: - throw "Impossible conversion"; - } - } - - /// Writes the given module in a possibly different file format. - public static void Write( - /// Output filename, used to determine the format. - string targetFilename, - /// Receives output file contents. - ByteWriter w, - /// File information got from the source file with data updated for the output file. - ASAPInfo info, - /// Contents of the source file. - byte[] module, - /// Length of the source file. - int moduleLen, - /// Display information (xex output only). - bool tag) - { - macro ASAP_EXT(s) ( s[0] + (s[1] << 8) + (s[2] << 16) | 0x202020 ) - int destExt = ASAPInfo.GetPackedExt(targetFilename); - switch (destExt) { - case ASAP_EXT("SAP"): - // * -> SAP - WriteExecutable(w, null, info, module, moduleLen); - return; - case ASAP_EXT("XEX"): - // * -> XEX - { -#if FLASHPACK - FlashPack() flashPack; - ByteWriter resultWriter = w; - native { - w.obj = &flashPack; - w.func = (void (*)(void *, int)) FlashPack_LoadByte; - } -#endif - int[2] initAndPlayer; - WriteExecutable(w, initAndPlayer, info, module, moduleLen); - switch (info.Type) { - case ASAPModuleType.SapD: - if (info.Fastplay != 312) - throw "Impossible conversion"; - WriteBytes(w, BinaryResource("xexd.obx"), 2, BinaryResource("xexd.obx").Length); - WriteWord(w, initAndPlayer[0]); - if (initAndPlayer[1] < 0) { - w(0x60); // RTS - w(0x60); // don't care - w(0x60); // don't care - } - else { - w(0x4c); // JMP - WriteWord(w, initAndPlayer[1]); - } - w(info.DefaultSong); - break; - case ASAPModuleType.SapS: - throw "Impossible conversion"; - default: - WriteBytes(w, BinaryResource("xexb.obx"), 2, BinaryResource("xexb.obx").Length); - WriteWord(w, initAndPlayer[0]); - w(0x4c); // JMP - WriteWord(w, initAndPlayer[1]); - w(info.DefaultSong); - w(info.Fastplay & 1); - w((info.Fastplay >> 1) % 156); - w((info.Fastplay >> 1) % 131); - w(info.Fastplay / 312); - w(info.Fastplay / 262); - break; - } - if (tag) - WriteXexInfo(w, info); - WriteWord(w, 0x2e0); - WriteWord(w, 0x2e1); - WriteWord(w, tag ? 0x100 : 0x124); // must match xexinfo.asx, xexb.asx, xexd.asx -#if FLASHPACK - flashPack.Compress(resultWriter); -#endif - return; - } - default: - string possibleExt = info.GetOriginalModuleExt(module, moduleLen); - if (possibleExt != null) { - int packedPossibleExt = ASAP_EXT(possibleExt); - if (destExt == packedPossibleExt - || (destExt == ASAP_EXT("tm8") && packedPossibleExt == ASAP_EXT("tmc"))) { - // * -> native - WriteNative(w, info, module, moduleLen); - return; - } - } - throw "Impossible conversion"; - } - } -} diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/astil.c kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/astil.c --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/astil.c 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/astil.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,361 +0,0 @@ -/* - * astil.c - another SID/SAP Tune Information List parser - * - * Copyright (C) 2011-2012 Piotr Fusik - * - * This file is part of ASAP (Another Slight Atari Player), - * see http://asap.sourceforge.net - * - * ASAP is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. - * - * ASAP is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ASAP; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include -#include "astil.h" - -#define ASTIL_MAX_TEXT_LENGTH 100 -#define ASTIL_MAX_COMMENT_LENGTH 1000 -#define ASTIL_MAX_COVERS 10 - -struct ASTILCover -{ - int startSeconds; - int endSeconds; - char titleAndSource[ASTIL_MAX_TEXT_LENGTH + 1]; - char artist[ASTIL_MAX_TEXT_LENGTH + 1]; - char comment[ASTIL_MAX_COMMENT_LENGTH + 1]; -}; - -struct ASTIL -{ - int nCovers; - cibool isUTF8; - char stilFilename[FILENAME_MAX]; - char title[ASTIL_MAX_TEXT_LENGTH + 1]; - char author[ASTIL_MAX_TEXT_LENGTH + 1]; - char directoryComment[ASTIL_MAX_COMMENT_LENGTH + 1]; - char fileComment[ASTIL_MAX_COMMENT_LENGTH + 1]; - char songComment[ASTIL_MAX_COMMENT_LENGTH + 1]; - ASTILCover covers[ASTIL_MAX_COVERS]; -}; - -ASTIL *ASTIL_New(void) -{ - ASTIL *self = (ASTIL *) malloc(sizeof(ASTIL)); - return self; -} - -void ASTIL_Delete(ASTIL *self) -{ - free(self); -} - -static int ASTIL_FindPreviousSlash(const char *filename, int pos) -{ - while (pos > 0) { - pos--; - if (filename[pos] == '/' || filename[pos] == '\\') - return pos; - } - return -1; -} - -static cibool ASTIL_ReadUTF8BOM(FILE *fp) -{ - if (getc(fp) == 0xef && getc(fp) == 0xbb && getc(fp) == 0xbf) - return TRUE; - fseek(fp, 0, SEEK_SET); - return FALSE; -} - -static int ASTIL_ReadLine(FILE *fp, char *result) -{ - int len = 0; - for (;;) { - int c = getc(fp); - switch (c) { - case EOF: - result[0] = '\0'; - return -1; - case '\n': - while (len > 0 && (result[len - 1] == ' ' || result[len - 1] == '\t')) - len--; - result[len] = '\0'; - return len; - case '\r': - break; - default: - if (len < ASTIL_MAX_TEXT_LENGTH) - result[len++] = c; - break; - } - } -} - -static int ASTIL_MatchFilename(const char *line, const char *filename) -{ - int len = 0; - for (;; len++) { - int c = line[len]; - if (c == filename[len]) { - if (c == '\0') - return -1; - } - else if (c == '/' && filename[len] == '\\') { - } - else - return len; - } -} - -static void ASTIL_ReadComment(FILE *fp, char *line, char *comment) -{ - int len = ASTIL_ReadLine(fp, line); - if (len >= 9 && memcmp(line, "COMMENT: ", 9) == 0) { - len -= 9; - memcpy(comment, line + 9, len + 1); - for (;;) { - int len2 = ASTIL_ReadLine(fp, line); - if (len2 >= 9 && memcmp(line, " ", 9) == 0) { - if (len < ASTIL_MAX_COMMENT_LENGTH - ASTIL_MAX_TEXT_LENGTH) { - comment[len++] = '\n'; - len2 -= 9; - memcpy(comment + len, line + 9, len2 + 1); - len += len2; - } - } - else - break; - } - } -} - -static int ASTIL_ParseInt(const char *s, int *pos) -{ - int result = 0; - int i = *pos; - while (s[i] >= '0' && s[i] <= '9') { - if (result >= 10) - return -1; - result = 10 * result + s[i++] - '0'; - } - if (i == *pos) - return -1; - *pos = i; - return result; -} - -static cibool ASTIL_ReadUntilSongNo(FILE *fp, char *line) -{ - while (ASTIL_ReadLine(fp, line) > 0) { - if (line[0] == '(' && line[1] == '#') - return TRUE; - } - return FALSE; -} - -static int ASTILCover_ParseTimestamp(const char *s, int *pos) -{ - int minutes = ASTIL_ParseInt(s, pos); - if (minutes >= 0 && s[(*pos)++] == ':') { - int seconds = ASTIL_ParseInt(s, pos); - if (seconds >= 0) - return 60 * minutes + seconds; - } - return -1; -} - -static void ASTILCover_SetText(char *result, const char *src) -{ - if (strcmp(src, "") == 0) - result[0] = '\0'; - else - strcpy(result, src); -} - -static void ASTILCover_Load(ASTILCover *self, FILE *fp, char *line) -{ - const char *ts; - self->startSeconds = -1; - self->endSeconds = -1; - ts = strrchr(line, '('); - if (ts != NULL) { - int i = ts - line + 1; - int startSeconds = ASTILCover_ParseTimestamp(line, &i); - int endSeconds = -1; - if (startSeconds >= 0 && line[i] == '-') { - i++; - endSeconds = ASTILCover_ParseTimestamp(line, &i); - } - if (line[i] == ')' && line[i + 1] == '\0') { - int len = ts - line; - if (line[len - 1] == ' ') - len--; - line[len] = '\0'; - self->startSeconds = startSeconds; - self->endSeconds = endSeconds; - } - } - ASTILCover_SetText(self->titleAndSource, line + 9); - self->artist[0] = '\0'; - self->comment[0] = '\0'; - if (ASTIL_ReadLine(fp, line) >= 9 && memcmp(line, " ARTIST: ", 9) == 0) { - ASTILCover_SetText(self->artist, line + 9); - ASTIL_ReadComment(fp, line, self->comment); - } -} - -static void ASTIL_ReadStilBlock(ASTIL *self, FILE *fp, char *line) -{ - for (;;) { - if (memcmp(line, " NAME: ", 9) == 0) - strcpy(self->title, line + 9); - else if (memcmp(line, " AUTHOR: ", 9) == 0) - strcpy(self->author, line + 9); - else - break; - if (ASTIL_ReadLine(fp, line) < 9) - return; - } - while (self->nCovers < ASTIL_MAX_COVERS && memcmp(line, " TITLE: ", 9) == 0) { - ASTILCover *cover = self->covers + self->nCovers++; - ASTILCover_Load(cover, fp, line); - } -} - -cibool ASTIL_Load(ASTIL *self, const char *filename, int song) -{ - int lastSlash = ASTIL_FindPreviousSlash(filename, strlen(filename)); - int rootSlash; - FILE *fp; - char line[ASTIL_MAX_TEXT_LENGTH + 1]; - self->nCovers = 0; - self->stilFilename[0] = '\0'; - self->title[0] = '\0'; - self->author[0] = '\0'; - self->directoryComment[0] = '\0'; - self->fileComment[0] = '\0'; - self->songComment[0] = '\0'; - if (lastSlash < 0 || lastSlash >= FILENAME_MAX - 14) /* strlen("/Docs/STIL.txt") */ - return FALSE; - memcpy(self->stilFilename, filename, lastSlash + 1); - for (rootSlash = lastSlash; ; rootSlash = ASTIL_FindPreviousSlash(filename, rootSlash)) { - if (rootSlash < 0) { - self->stilFilename[0] = '\0'; - return FALSE; - } - strcpy(self->stilFilename + rootSlash + 1, "Docs/STIL.txt"); - self->stilFilename[rootSlash + 5] = self->stilFilename[rootSlash]; /* copy dir separator - slash or backslash */ - fp = fopen(self->stilFilename, "rb"); - if (fp != NULL) - break; - strcpy(self->stilFilename + rootSlash + 1, "STIL.txt"); - fp = fopen(self->stilFilename, "rb"); - if (fp != NULL) - break; - } - self->isUTF8 = ASTIL_ReadUTF8BOM(fp); - while (ASTIL_ReadLine(fp, line) >= 0) { - int len = ASTIL_MatchFilename(line, filename + rootSlash); - if (len == -1) { - ASTIL_ReadComment(fp, line, self->fileComment); - if (line[0] == '(' && line[1] == '#') { - do { - int i = 2; - if (ASTIL_ParseInt(line, &i) - 1 == song && line[i] == ')' && line[i + 1] == '\0') { - ASTIL_ReadComment(fp, line, self->songComment); - ASTIL_ReadStilBlock(self, fp, line); - break; - } - } while (ASTIL_ReadUntilSongNo(fp, line)); - } - else - ASTIL_ReadStilBlock(self, fp, line); - break; - } - if (len == lastSlash - rootSlash + 1 && line[len] == '\0') - ASTIL_ReadComment(fp, line, self->directoryComment); - } - fclose(fp); - return TRUE; -} - -const char *ASTIL_GetStilFilename(const ASTIL *self) -{ - return self->stilFilename; -} - -cibool ASTIL_IsUTF8(const ASTIL *self) -{ - return self->isUTF8; -} - -const char *ASTIL_GetTitle(const ASTIL *self) -{ - return self->title; -} - -const char *ASTIL_GetAuthor(const ASTIL *self) -{ - return self->author; -} - -const char *ASTIL_GetDirectoryComment(const ASTIL *self) -{ - return self->directoryComment; -} - -const char *ASTIL_GetFileComment(const ASTIL *self) -{ - return self->fileComment; -} - -const char *ASTIL_GetSongComment(const ASTIL *self) -{ - return self->songComment; -} - -const ASTILCover *ASTIL_GetCover(const ASTIL *self, int i) -{ - if (i < 0 || i >= self->nCovers) - return NULL; - return &self->covers[i]; -} - -int ASTILCover_GetStartSeconds(const ASTILCover *self) -{ - return self->startSeconds; -} - -int ASTILCover_GetEndSeconds(const ASTILCover *self) -{ - return self->endSeconds; -} - -const char *ASTILCover_GetTitleAndSource(const ASTILCover *self) -{ - return self->titleAndSource; -} - -const char *ASTILCover_GetArtist(const ASTILCover *self) -{ - return self->artist; -} - -const char *ASTILCover_GetComment(const ASTILCover *self) -{ - return self->comment; -} diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/astil.h kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/astil.h --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/astil.h 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/astil.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,65 +0,0 @@ -/* - * astil.h - another SID/SAP Tune Information List parser - * - * Copyright (C) 2011-2012 Piotr Fusik - * - * This file is part of ASAP (Another Slight Atari Player), - * see http://asap.sourceforge.net - * - * ASAP is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. - * - * ASAP is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ASAP; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef _ASTIL_H_ -#define _ASTIL_H_ -#ifndef _ASAP_H_ /* FIXME */ -typedef int cibool; -#endif -#ifndef TRUE -#define TRUE 1 -#endif -#ifndef FALSE -#define FALSE 0 -#endif -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct ASTIL ASTIL; -typedef struct ASTILCover ASTILCover; - -ASTIL *ASTIL_New(void); -void ASTIL_Delete(ASTIL *self); -cibool ASTIL_Load(ASTIL *self, const char *filename, int song); -const char *ASTIL_GetStilFilename(const ASTIL *self); -/* If TRUE, the following strings are expected to be UTF-8 encoded, - otherwise it's an old STIL.txt, ASCII or Windows-1250 maybe? */ -cibool ASTIL_IsUTF8(const ASTIL *self); -const char *ASTIL_GetTitle(const ASTIL *self); -const char *ASTIL_GetAuthor(const ASTIL *self); -const char *ASTIL_GetDirectoryComment(const ASTIL *self); -const char *ASTIL_GetFileComment(const ASTIL *self); -const char *ASTIL_GetSongComment(const ASTIL *self); -const ASTILCover *ASTIL_GetCover(const ASTIL *self, int i); - -int ASTILCover_GetStartSeconds(const ASTILCover *self); -int ASTILCover_GetEndSeconds(const ASTILCover *self); -const char *ASTILCover_GetTitleAndSource(const ASTILCover *self); -const char *ASTILCover_GetArtist(const ASTILCover *self); -const char *ASTILCover_GetComment(const ASTILCover *self); - -#ifdef __cplusplus -} -#endif -#endif diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/audacious/asapplug.c kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/audacious/asapplug.c --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/audacious/asapplug.c 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/audacious/asapplug.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,466 +0,0 @@ -/* - * asapplug.c - ASAP plugin for Audacious - * - * Copyright (C) 2010-2013 Piotr Fusik - * - * This file is part of ASAP (Another Slight Atari Player), - * see http://asap.sourceforge.net - * - * ASAP is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. - * - * ASAP is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ASAP; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include -#include -#include - -#if !defined(_AUD_PLUGIN_VERSION) && defined(__AUDACIOUS_PLUGIN_API__) -#define _AUD_PLUGIN_VERSION __AUDACIOUS_PLUGIN_API__ -#define _AUD_PLUGIN_VERSION_MIN __AUDACIOUS_PLUGIN_API__ -#endif -#if _AUD_PLUGIN_VERSION_MIN < 40 -#include -#endif - -#include "asap.h" - -#define BITS_PER_SAMPLE 16 - -static pthread_mutex_t control_mutex = PTHREAD_MUTEX_INITIALIZER; -static ASAP *asap; - -#if _AUD_PLUGIN_VERSION >= 18 -static gboolean playing; -#else -#define playing playback->playing -#endif - -static -#if _AUD_PLUGIN_VERSION >= 18 - gboolean -#else - void -#endif - plugin_init(void) -{ - asap = ASAP_New(); -#if _AUD_PLUGIN_VERSION >= 18 - return asap != NULL; -#endif -} - -static void plugin_cleanup(void) -{ - ASAP_Delete(asap); -} - -#if _AUD_PLUGIN_VERSION_MIN < 40 -static void plugin_about(void) -{ - static GtkWidget *aboutbox = NULL; - if (aboutbox == NULL) { - aboutbox = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "%s", - ASAPInfo_CREDITS "\n" ASAPInfo_COPYRIGHT); - gtk_window_set_title((GtkWindow *) aboutbox, "About ASAP plugin " ASAPInfo_VERSION); - g_signal_connect(aboutbox, "response", (GCallback) gtk_widget_destroy, NULL); - g_signal_connect(aboutbox, "destroy", (GCallback) gtk_widget_destroyed, &aboutbox); - } - gtk_window_present((GtkWindow *) aboutbox); -} -#endif - -static gboolean is_our_file_from_vfs(const char *filename, VFSFile *file) -{ - return ASAPInfo_IsOurFile(filename); -} - -static int load_module(const char *filename, VFSFile *file, unsigned char *module) -{ - int module_len; - if (file != NULL) - return vfs_fread(module, 1, ASAPInfo_MAX_MODULE_LENGTH, file); - file = vfs_fopen(filename, "rb"); - if (file == NULL) - return -1; - module_len = vfs_fread(module, 1, ASAPInfo_MAX_MODULE_LENGTH, file); - vfs_fclose(file); - return module_len; -} - -#if _AUD_PLUGIN_VERSION >= 37 -static char *filename_split_subtune(const char *filename, int *song) -{ - const char *sub; - uri_parse(filename, NULL, NULL, &sub, song); - return g_strndup(filename, sub - filename); -} -#else -#define tuple_set_int tuple_associate_int -#define tuple_set_str tuple_associate_string -#endif - -static void tuple_set_nonblank(Tuple *tuple, int nfield, const char *value) -{ - if (value[0] != '\0') - tuple_set_str(tuple, nfield, NULL, value); -} - -static Tuple *probe_for_tuple(const char *filename, VFSFile *file) -{ - int song = -1; - unsigned char module[ASAPInfo_MAX_MODULE_LENGTH]; - int module_len; - ASAPInfo *info = NULL; - Tuple *tuple = NULL; - int songs; - int duration; - int year; - -#if _AUD_PLUGIN_VERSION >= 10 - char *real_filename = filename_split_subtune(filename, &song); - if (real_filename != NULL) - filename = real_filename; -#endif - module_len = load_module(filename, file, module); - if (module_len > 0) { - info = ASAPInfo_New(); - if (info != NULL && ASAPInfo_Load(info, filename, module, module_len)) - tuple = tuple_new_from_filename(filename); - } -#if _AUD_PLUGIN_VERSION >= 10 - g_free(real_filename); -#endif - if (tuple == NULL) { - ASAPInfo_Delete(info); - return NULL; - } - - tuple_set_nonblank(tuple, FIELD_ARTIST, ASAPInfo_GetAuthor(info)); - tuple_set_nonblank(tuple, FIELD_TITLE, ASAPInfo_GetTitleOrFilename(info)); - tuple_set_nonblank(tuple, FIELD_DATE, ASAPInfo_GetDate(info)); - tuple_set_str(tuple, FIELD_CODEC, NULL, "ASAP"); - songs = ASAPInfo_GetSongs(info); - if (song > 0) { - tuple_set_int(tuple, FIELD_SUBSONG_ID, NULL, song); - tuple_set_int(tuple, FIELD_SUBSONG_NUM, NULL, songs); - song--; - } - else { - if (songs > 1) { -#if _AUD_PLUGIN_VERSION >= 37 - tuple_set_subtunes(tuple, songs, NULL); -#else - tuple->nsubtunes = songs; -#endif - } - song = ASAPInfo_GetDefaultSong(info); - } - duration = ASAPInfo_GetDuration(info, song); - if (duration > 0) - tuple_set_int(tuple, FIELD_LENGTH, NULL, duration); - year = ASAPInfo_GetYear(info); - if (year > 0) - tuple_set_int(tuple, FIELD_YEAR, NULL, year); - ASAPInfo_Delete(info); - return tuple; -} - -#if _AUD_PLUGIN_VERSION < 18 -static Tuple *get_song_tuple(const char *filename) -{ - return probe_for_tuple(filename, NULL); -} -#endif - -static gboolean play_start(InputPlayback *playback, const char *filename, VFSFile *file, int start_time, int stop_time, gboolean pause) -{ - int song = -1; - unsigned char module[ASAPInfo_MAX_MODULE_LENGTH]; - int module_len; - gboolean ok; - const ASAPInfo *info; - int channels; - -#if _AUD_PLUGIN_VERSION >= 10 - char *real_filename = filename_split_subtune(filename, &song); - if (real_filename != NULL) - filename = real_filename; -#endif - module_len = load_module(filename, file, module); - ok = module_len > 0 && ASAP_Load(asap, filename, module, module_len); -#if _AUD_PLUGIN_VERSION >= 10 - g_free(real_filename); -#endif - if (!ok) - return FALSE; - - info = ASAP_GetInfo(asap); - channels = ASAPInfo_GetChannels(info); - if (song > 0) - song--; - else - song = ASAPInfo_GetDefaultSong(info); - if (stop_time < 0) - stop_time = ASAPInfo_GetDuration(info, song); - if (!ASAP_PlaySong(asap, song, stop_time)) - return FALSE; - if (start_time > 0) - ASAP_Seek(asap, start_time); - - if (!playback->output->open_audio(BITS_PER_SAMPLE == 8 ? FMT_U8 : FMT_S16_LE, ASAP_SAMPLE_RATE, channels)) - return FALSE; - playback->set_params(playback, -#if _AUD_PLUGIN_VERSION < 18 - NULL, 0, -#endif - 0, ASAP_SAMPLE_RATE, channels); - if (pause) - playback->output->pause(TRUE); - playing = TRUE; - playback->set_pb_ready(playback); - - for (;;) { - static unsigned char buffer[4096]; - int len; - pthread_mutex_lock(&control_mutex); - if (!playing) { - pthread_mutex_unlock(&control_mutex); - break; - } - len = ASAP_Generate(asap, buffer, sizeof(buffer), BITS_PER_SAMPLE == 8 ? ASAPSampleFormat_U8 : ASAPSampleFormat_S16_L_E); - pthread_mutex_unlock(&control_mutex); - if (len <= 0) { -#if _AUD_PLUGIN_VERSION < 18 - playback->eof = TRUE; -#endif - break; - } -#if _AUD_PLUGIN_VERSION >= 14 - playback->output->write_audio(buffer, len); -#else - playback->pass_audio(playback, BITS_PER_SAMPLE == 8 ? FMT_U8 : FMT_S16_LE, channels, len, buffer, NULL); -#endif - } - -#if _AUD_PLUGIN_VERSION_MIN < 40 - while (playing && playback->output->buffer_playing()) - g_usleep(10000); -#endif - pthread_mutex_lock(&control_mutex); - playing = FALSE; - pthread_mutex_unlock(&control_mutex); -#if _AUD_PLUGIN_VERSION_MIN < 40 - playback->output->close_audio(); -#endif - return TRUE; -} - -#if _AUD_PLUGIN_VERSION < 18 -static void play_file(InputPlayback *playback) -{ - play_start(playback, playback->filename, NULL, 0, -1, FALSE); -} -#endif - -static void play_pause(InputPlayback *playback, -#if _AUD_PLUGIN_VERSION >= 18 - gboolean -#else - gshort -#endif - pause) -{ - pthread_mutex_lock(&control_mutex); - if (playing) - playback->output->pause(pause); - pthread_mutex_unlock(&control_mutex); -} - -static void play_mseek(InputPlayback *playback, -#if _AUD_PLUGIN_VERSION >= 18 - int -#else - gulong -#endif - time) -{ - pthread_mutex_lock(&control_mutex); - if (playing) { - ASAP_Seek(asap, time); -#if _AUD_PLUGIN_VERSION >= 15 - playback->output->abort_write(); -#endif - } - pthread_mutex_unlock(&control_mutex); -} - -static void play_stop(InputPlayback *playback) -{ - pthread_mutex_lock(&control_mutex); - if (playing) { -#if _AUD_PLUGIN_VERSION >= 15 - playback->output->abort_write(); -#endif - playing = FALSE; - } - pthread_mutex_unlock(&control_mutex); -} - -#pragma GCC diagnostic ignored "-Wunused-result" -static void write_byte(void *obj, int data) -{ - VFSFile *file = (VFSFile *) obj; - const char buf[1] = { data }; - vfs_fwrite(buf, 1, 1, file); -} - -static gboolean update_song_tuple(const Tuple * tuple, VFSFile *file) -{ -#if _AUD_PLUGIN_VERSION < 38 -#define vfs_get_filename(file) g_filename_from_uri(file->uri, NULL, NULL) -#define tuple_get_str tuple_get_string -#define str_unref(s) - const char *s; -#else - char *s; -#endif - /* read file */ - const char *filename = vfs_get_filename(file); - unsigned char module[ASAPInfo_MAX_MODULE_LENGTH]; - int module_len = load_module(filename, file, module); - ASAPInfo *info; - int year; - ByteWriter bw; - gboolean ok; - if (module_len <= 0) - return FALSE; - info = ASAPInfo_New(); - if (info == NULL) - return FALSE; - if (!ASAPInfo_Load(info, filename, module, module_len)) { - ASAPInfo_Delete(info); - return FALSE; - } - - /* apply new tags */ - s = tuple_get_str(tuple, FIELD_ARTIST, NULL); - if (s != NULL) { - if (!ASAPInfo_SetAuthor(info, s)) { - str_unref(s); - ASAPInfo_Delete(info); - return FALSE; - } - str_unref(s); - } - else - ASAPInfo_SetAuthor(info, ""); - s = tuple_get_str(tuple, FIELD_TITLE, NULL); - if (s != NULL) { - if (!ASAPInfo_SetTitle(info, s)) { - str_unref(s); - ASAPInfo_Delete(info); - return FALSE; - } - str_unref(s); - } - else - ASAPInfo_SetTitle(info, ""); - year = tuple_get_int(tuple, FIELD_YEAR, NULL); - if (year == 0) - year = -1; - /* check if year changed so that we don't lose other date parts */ - if (year != ASAPInfo_GetYear(info)) { - if (year <= 0) - ASAPInfo_SetDate(info, ""); - else { - char d[16]; - sprintf(d, "%d", year); - ASAPInfo_SetDate(info, d); - } - } - - /* write file */ - vfs_rewind(file); - bw.obj = file; - bw.func = write_byte; - ok = ASAPWriter_Write(filename, bw, info, module, module_len, TRUE) && vfs_ftruncate(file, vfs_ftell(file)) == 0; - ASAPInfo_Delete(info); - return ok; -} - -static -#if _AUD_PLUGIN_VERSION >= 16 - const -#endif - char *exts[] = { "sap", "cmc", "cm3", "cmr", "cms", "dmc", "dlt", "mpt", "mpd", "rmt", "tmc", "tm8", "tm2", "fc", NULL }; - -#ifdef _WIN32 -/* For some strange reason, it doesn't get exported without it. It wasn't necessary for Audacious 3.2... */ -__declspec(dllexport) InputPlugin *get_plugin_info(AudAPITable *); -#endif - -#if _AUD_PLUGIN_VERSION >= 30 - -AUD_INPUT_PLUGIN -( - .name = "ASAP", - .init = plugin_init, - .cleanup = plugin_cleanup, -#if _AUD_PLUGIN_VERSION_MIN >= 40 - .about_text = "ASAP " ASAPInfo_VERSION "\n" ASAPInfo_CREDITS "\n" ASAPInfo_COPYRIGHT, -#else - .about = plugin_about, -#endif - .have_subtune = TRUE, - .extensions = exts, - .is_our_file_from_vfs = is_our_file_from_vfs, - .probe_for_tuple = probe_for_tuple, - .play = play_start, - .pause = play_pause, - .mseek = play_mseek, - .stop = play_stop, - .update_song_tuple = update_song_tuple -); - -#else - -static InputPlugin asap_ip = { - .description = "ASAP Plugin", - .init = plugin_init, - .cleanup = plugin_cleanup, - .about = plugin_about, - .have_subtune = TRUE, - .vfs_extensions = exts, - .is_our_file_from_vfs = is_our_file_from_vfs, -#if _AUD_PLUGIN_VERSION >= 16 - .probe_for_tuple = probe_for_tuple, - .play = play_start, -#endif -#if _AUD_PLUGIN_VERSION < 18 - .get_song_tuple = get_song_tuple, - .play_file = play_file, -#endif - .pause = play_pause, - .mseek = play_mseek, - .stop = play_stop, - .update_song_tuple = update_song_tuple -}; - -static InputPlugin *asap_iplist[] = { &asap_ip, NULL }; - -SIMPLE_INPUT_PLUGIN(ASAP, asap_iplist) - -#endif diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/audacious/audacious.mk kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/audacious/audacious.mk --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/audacious/audacious.mk 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/audacious/audacious.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -AUDACIOUS_VERSION := $(shell pkg-config --modversion audacious 2>/dev/null) -AUDACIOUS_CFLAGS = `pkg-config --cflags $(if $(filter 2.%,$(AUDACIOUS_VERSION)),gtk+-2.0 libmowgli,gtk+-3.0)` -AUDACIOUS_INPUT_PLUGIN_DIR = `pkg-config --variable=input_plugin_dir audacious` - -# no user-configurable paths below this line - -ifndef DO -$(error Use "Makefile" instead of "audacious.mk") -endif - -asap-audacious: asapplug-$(AUDACIOUS_VERSION).so -.PHONY: asap-audacious - -asapplug-$(AUDACIOUS_VERSION).so: $(call src,audacious/asapplug.c asap.[ch]) -ifndef AUDACIOUS_VERSION - $(error Please install audacious-dev or audacious-devel) -endif - $(CC) $(AUDACIOUS_CFLAGS) -CLEAN += asapplug-*.so - -install-audacious: asapplug-$(AUDACIOUS_VERSION).so - $(call INSTALL_PROGRAM,asapplug-$(AUDACIOUS_VERSION).so,$(AUDACIOUS_INPUT_PLUGIN_DIR),asapplug.so) -.PHONY: install-audacious - -uninstall-audacious: - $(RM) $(DESTDIR)$(AUDACIOUS_INPUT_PLUGIN_DIR)/asapplug.so -.PHONY: uninstall-audacious diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/chksap.pl kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/chksap.pl --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/chksap.pl 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/chksap.pl 1970-01-01 00:00:00.000000000 +0000 @@ -1,714 +0,0 @@ -#!/usr/bin/perl - -=head1 NAME - -chksap - check, fix or calculate statistics for *.sap files - -=head1 SYNOPSIS - - perl chksap.pl option... file... - -=head1 DESCRIPTION - -I processes SAP (Slight Atari Player) files. -It can operate in one of three modes: check file format conformance, -fix errors automatically, compute statistics. - -You must select a mode using one of the options described below -and pass names of files or directories to be processed. -Directories are processed recursively, but only C<*.sap> files -are analyzed. - -=head1 OPTIONS - -Exactly one of the following options should be used to select -the operation: - -=over 4 - -=item B<-c>, B<--check> - -Display the errors found for each file. Does not display anything -for correct files. - -=item B<-f>, B<--fix> - -Try to automatically fix errors. Shows descriptions for the fixed -errors and the errors that cannot be fixed automatically. - -B files are modified in-place and no backup copies are made. -Make backups yourself before using this option! - -=item B<-s>, B<--statistics> - -Compute and display statistics. - -=back - -The following options are available in any mode: - -=over 4 - -=item B<-p>, B<--progress> - -Print name of the currently processed file. - -=back - -In the fix mode the following options are available: - -=over 4 - -=item B<-t>, B<--time> - -For files that have no TIME tag detects playback time using an external -program "asapscan" and stores it in TIME tags. - -=item B<-T>, B<--overwrite-time> - -Detects playback time using an external program "asapscan" and stores it -in TIME tags, possibly overwriting the current values. - -=back - -In the statistics mode the following options are available: - -=over 4 - -=item B<-t>, B<--time> - -Lists files with no TIME tags. - -=item B<-u>, B<--features> - -Lists files with rarely used POKEY and 6502 features. - -=back - -The following options display some text and terminate the program -without file operations: - -=over 4 - -=item B<-h>, B<--help> - -Display usage summary. - -=item B<-v>, B<--version> - -Display program version. - -=back - -=head1 ERRORS FIXED AUTOMATICALLY - -=over 4 - -=item B - -The lines of the header should be separated with CR/LF pairs -and not just LF or CR characters. - -=item B
- -The last line of the header is not terminated with CR/LF. - -=item B - -There should be exactly one space between the tag name -and its argument. There should be no spaces after the argument. - -=item B - -Although AUTHOR, NAME and DATE have no meaning to SAP players, -they should always appear in the file. If the value is unknown, -C<<"">> should be used. - -=item B - -If the value is unknown, it should not be empty or consist -of only question marks - use C<<"">> instead. - -=item B - -C tag with the argument of 1 is meaningless -because the number of songs defaults to 1. - -=item B - -C tag with the argument of 0 is meaningless -because the default song defaults to 0. - -=item B - -The arguments of INIT, PLAYER, MUSIC and COVOX should specify all 4 digits. - -=item B - -The arguments of INIT, PLAYER, MUSIC and COVOX should use C letters -rather than C. - -=item B - -The order of tags is of little importance, but making some assumptions -about it makes it easier to create new tools that process SAP files. -The canonical order is: first SAP, then AUTHOR, then NAME, then DATE. -After DATE, the following tags should be used in any order: SONGS, TYPE, -FASTPLAY, STEREO and NTSC. DEFSONG must appear after SONGS. -The tags that should appear last are: INIT, PLAYER, MUSIC and COVOX, -in any order. - -=item B - -Two C<0xFF> bytes start the binary part but are redundant -inside it. - -=item B - -There are extra bytes after the last binary block, but less than 4 necessary -to form a new block header. - -=item B - -There are not enough bytes in the file to fill the last binary block. - -=back - -=head1 ERRORS THAT CANNOT BE FIXED AUTOMATICALLY - -=over 4 - -=item B - -For portability, filenames should be limited to 26 characters -(plus C<.sap>). - -=item B - -Filenames should consist of letters (C and C), -digits (C<0-9>) and underscore characters (C<_>). - -=item B - -File should not exceed 63 KB (64512 bytes). This is because only 62 KB -base RAM is available for use in Atari XL/XE machines (2 KB is reserved -for I/O area) and the SAP header should be no longer than 1 KB. - -=item B - -The file does not begin with C. - -=item B - -Two C<0xFF> bytes were not found in the file. - -=item B - -A line of the header does not start with an uppercase tag name. - -=item B - -SAP, STEREO and NTSC tags should have no argument. - -=item B - -The arguments of these tags should be wrapped in double quotes -and should consist of ASCII characters between space and lowercase 'z', -except for the double quote and backtick (0x60) characters. -Moreover, no argument should be longer than 122 characters -(including quotes). - -=item B - -The argument of SONGS must be an integer within the range 2-255. - -=item B - -The argument of DEFSONG must be an integer greater than zero -and less than the argument of SONGS. - -=item B - -This tag is mandatory. - -=item B - -The currently defined types are: B, C, D, S. - -=item B - -The argument of FASTPLAY must be an integer within the range 1-32767. - -=item B - -C uses PLAYER and MUSIC tags, but not INIT. - -=item B - -The MUSIC tag should be used only with C. - -=item B - -The PLAYER tag is mandatory for C and C. - -=item B - -The argument of these tags must be 4-digit hexadecimal number. - -=item B - -The same tag appears several times within the header. - -=item B - -Known tags are: SAP, AUTHOR, NAME, DATE, SONGS, DEFSONG, TYPE, FASTPLAY, -STEREO, NTSC, INIT, PLAYER, MUSIC, COVOX. - -=item B - -A binary block starts with four C<0xFF> bytes. - -=item B - -Each binary block begins with a header that specifies the addresses -of the first and the last byte in the block. The end address must not -be less than the start address. - -=back - -=head1 BUGS - -The checks are more strict than necessary, which is a good thing. - -=head1 AUTHOR - -Piotr Fusik C. - -=cut - -use File::Find; -use File::Spec; -use Getopt::Long; -use Pod::Usage; -use strict; - -my $VERSION = '3.1.5'; -my $asapscan = File::Spec->rel2abs('asapscan'); -my ($check, $fix, $stat) = (0, 0, 0); -my ($progress, $time, $overwrite_time, $features, $help, $version) = (0, 0, 0, 0, 0, 0); -my ($total_files, $sap_files, $stereo_files, $ntsc_files) = (0, 0, 0, 0); -my ($total_length, $min_length, $max_length) = (0, 100_000, 0); -my ($min_filename, $max_filename); -my ($time_files, $total_millis) = (0, 0); -my (@fixed_messages, @notfixed_messages, @fatal_messages, @no_time_files); -my (%stat, %types, %features); - -sub process($$) { - my ($filename, $fullpath) = @_; - my (%fixed, %fatal); - my $sap; - print STDERR "$fullpath\n" if $progress; - open F, '<', $filename and binmode F and read F, $sap, 64513 and close F - or die "$filename: $!\n"; - { - ++$total_files; - my $len = length($sap); - if ($len > 64512) { - $fatal{'file too long'} = 1; - last; - } - $fatal{'filename too long'} = 1 if length($filename) > 30; - if ($filename !~ /^\w+\.sap$/is) { - $fatal{'illegal characters in filename'} = 1; - } - if ($sap !~ /^SAP\W/s) { - $fatal{'missing SAP header'} = 1; - last; - } - if ($sap !~ /^(.+?)\xFF\xFF(.{5,})$/s) { - $fatal{'missing binary part'} = 1; - last; - } - ++$sap_files; - $total_length += $len; - if ($min_length > $len) { - $min_length = $len; - $min_filename = $filename; - } - if ($max_length < $len) { - $max_length = $len; - $max_filename = $filename; - } - my ($hdr, $bin) = ($1, $2); - if ($hdr =~ /\x0D[^\x0A]|[^\x0D]\x0A/) { - $fixed{'line terminators within header are not CRLF'} = 1; - } - if ($hdr !~ s/\x0D\x0A$//s) { - $fixed{'header not terminated with CRLF'} = 1; - } - my %tags; - my @times; - for (split /[\x0D\x0A]+/, $hdr) { - my ($tag, $spaces1, $arg, $spaces2); - unless (($tag, $spaces1, $arg, $spaces2) = - /^([A-Z]+)(?:( +)(.+?))?( *)$/s) { - $fatal{"unknown header line: $_"} = 1; - next; - } - if (length($spaces1) > 1 || $spaces2) { - $fixed{'extra whitespace within header'} = 1; - } - if (exists($tags{$tag})) { - $fatal{"duplicate tag: $tag"} = 1; - next; - } - if ($tag eq 'SAP') { - $fatal{'unexpected argument of SAP'} = 1 if $arg ne ''; - } - elsif ($tag eq 'AUTHOR') { - ++$stat{'AUTHOR'}{$arg}; - if ($arg !~ /^"[ -_a-z|]{0,120}"$/s) { - $fatal{'invalid argument of AUTHOR'} = 1; - } - elsif ($arg =~ /^"\?*"$/s) { - $fixed{'blank AUTHOR argument'} = 1; - $arg = '""'; - } - } - elsif ($tag eq 'NAME') { - ++$stat{'NAME'}{$arg}; - exists($tags{'AUTHOR'}) - or $fixed{'non-standard order of tags'} = 1; - if ($arg !~ /^"[ -_a-z|]{0,120}"$/s) { - $fatal{'invalid argument of NAME'} = 1; - } - elsif ($arg =~ /^"\?*"$/s) { - $fixed{'blank NAME argument'} = 1; - $arg = '""'; - } - } - elsif ($tag eq 'DATE') { - ++$stat{'DATE'}{$arg}; - exists($tags{'NAME'}) - or $fixed{'non-standard order of tags'} = 1; - if ($arg !~ /^"[ -_a-z|]{0,120}"$/s) { - $fatal{'invalid argument of DATE'} = 1; - } - elsif ($arg =~ /^"\?*"$/s) { - $fixed{'blank DATE argument'} = 1; - $arg = '""'; - } - } - elsif ($tag eq 'SONGS') { - ++$stat{'SONGS'}{$arg}; - exists($tags{'DATE'}) - or $fixed{'non-standard order of tags'} = 1; - if ($arg !~ /^[1-9]\d*$/s || $arg > 255) { - $fatal{'invalid argument of SONGS'} = 1; - } - elsif ($arg eq '1') { - $fixed{'SONGS 1 is superfluous'} = 1; - next; - } - } - elsif ($tag eq 'DEFSONG') { - exists($tags{'SONGS'}) - or $fixed{'non-standard order of tags'} = 1; - if ($arg eq '0') { - $fixed{'DEFSONG 0 is superfluous'} = 1; - next; - } - if ($arg !~ /^[1-9]\d*$/s) { - $fatal{'invalid argument of DEFSONG'} = 1; - } - } - elsif ($tag eq 'TYPE') { - exists($tags{'DATE'}) - or $fixed{'non-standard order of tags'} = 1; - if ($arg !~ /^[BCDS]$/s) { - $fatal{'invalid argument of TYPE'} = 1; - } - } - elsif ($tag eq 'FASTPLAY') { - ++$stat{'FASTPLAY'}{$arg}; - exists($tags{'DATE'}) - or $fixed{'non-standard order of tags'} = 1; - if ($arg !~ /^[1-9]\d*$/s || $arg > 32767) { - $fatal{'invalid argument of FASTPLAY'} = 1; - } - } - elsif ($tag eq 'STEREO') { - ++$stereo_files; - exists($tags{'DATE'}) - or $fixed{'non-standard order of tags'} = 1; - $fatal{'unexpected argument of STEREO'} = 1 if $arg ne ''; - } - elsif ($tag eq 'NTSC') { - ++$ntsc_files; - exists($tags{'DATE'}) - or $fixed{'non-standard order of tags'} = 1; - $fatal{'unexpected argument of NTSC'} = 1 if $arg ne ''; - } - elsif ($tag eq 'INIT' || $tag eq 'PLAYER' || $tag eq 'MUSIC' || $tag eq 'COVOX') { - exists($tags{'TYPE'}) - or $fixed{'non-standard order of tags'} = 1; - if ($arg !~ /^[0-9A-Fa-f]{1,4}$/s) { - $fatal{"invalid argument of $tag"} = 1; - } - elsif (length($arg) != 4) { - $arg = sprintf('%04X', hex($arg)); - $fixed{'hexadecimal values should be 4-digit'} = 1; - } - elsif ($arg =~ y/a-f/A-F/) { - $fixed{'hexadecimal values should be uppercase'} = 1; - } - } - elsif ($tag eq 'TIME') { - if ($arg !~ /^\d?\d:\d\d(?:\.\d\d\d?)?(?: LOOP)?$/s) { - $fatal{'invalid argument of TIME'} = 1; - } - push @times, $arg; - next; - } - else { - $fatal{"unknown tag: $tag"} = 1; - next; - } - $tags{$tag} = $arg; - } - $fatal{'invalid argument of DEFSONG'} = 1 - if exists($tags{'SONGS'}) && $tags{'DEFSONG'} >= $tags{'SONGS'}; - if (exists($tags{'TYPE'})) { - my $type = $tags{'TYPE'}; - $fatal{'INIT is meaningless with TYPE C'} = 1 - if $type eq 'C' && exists($tags{'INIT'}); - $fatal{'MUSIC is meaningful only with TYPE C'} = 1 - if $type ne 'C' && exists($tags{'MUSIC'}); - $fatal{'missing PLAYER tag'} = 1 - if ($type eq 'B' || $type eq 'C') && !exists($tags{'PLAYER'}); - } - else { - $fatal{'missing TYPE tag'} = 1; - } - ++$types{$tags{'TYPE'}}{exists($tags{'STEREO'})?'stereo':'mono'}; - my $i = 0; - for (;;) { - my $bh = substr($bin, $i, 5); - if (length($bh) < 5) { - if ($bh ne '') { - substr($bin, $i) = ''; - $fixed{'garbage bytes at the end'} = 1; - } - last; - } - my ($start, $end) = unpack('vv', $bh); - if ($start == 0xffff) { - $fatal{'duplicate FFFF in the binary part'} = 1; - last; - } - if ($end < $start) { - $fatal{'block end address less than start address'} = 1; - last; - } - my $ni = $i + 5 + $end - $start; - if ($ni > length($bin)) { - substr($bin, $i + 2, 2) = - pack('v', $start + length($bin) - $i - 5); - $fixed{'truncated binary block'} = 1; - last; - } - $i = $ni; - if (substr($bin, $i, 2) eq "\xFF\xFF") { - substr($bin, $i, 2) = ''; - $fixed{'FFFF inside binary part'} = 1; - } - } - if (%fixed || ($fix && $time && !@times) || $overwrite_time) { - if (%fatal) { - push @notfixed_messages, - "$fullpath (" . join('; ', sort(keys(%fixed))) . ")\n"; - } - else { - if ($fix) { - if (($time && !@times) || $overwrite_time) { - my $times = `$asapscan -t $filename`; - if (!$times) { - $fatal{'error running asapscan'} = 1; - } - elsif ($times =~ /^(?:TIME \d?\d:\d\d(?:\.\d\d\d?)?(?: LOOP)?\r?\n)+$/s) { - my @new_times = $times =~ /\d?\d:\d\d(?:\.\d\d\d?)?(?: LOOP)?/gs; - if (!@times) { - @times = @new_times; - $fixed{'added TIME tags'} = 1; - } - elsif ("@new_times" ne "@times") { - @times = @new_times; - $fixed{'changed TIME tags'} = 1; - } - } - else { - $fatal{'cannot detect TIME'} = 1; - } - } - if (%fixed) { - open F, '>', $filename and binmode F - or die "$filename: $!\n"; - print F "SAP\x0D\x0A"; - for ('AUTHOR', 'NAME', 'DATE') { - if (exists($tags{$_})) { - print F "$_ $tags{$_}\x0D\x0A"; - } - else { - $fixed{"missing $_ tag"} = 1; - print F "$_ \"\"\x0D\x0A"; - } - } - print F "SONGS $tags{'SONGS'}\x0D\x0A" - if exists($tags{'SONGS'}); - print F "DEFSONG $tags{'DEFSONG'}\x0D\x0A" - if exists($tags{'DEFSONG'}); - print F "STEREO\x0D\x0A" if exists($tags{'STEREO'}); - print F "NTSC\x0D\x0A" if exists($tags{'NTSC'}); - for ('TYPE', 'FASTPLAY', 'INIT', 'MUSIC', 'PLAYER', 'COVOX') { - print F "$_ $tags{$_}\x0D\x0A" if exists($tags{$_}); - } - for (@times) { - print F "TIME $_\x0D\x0A"; - } - print F "\xFF\xFF", $bin; - close F or die "$filename: $!\n"; - } - } - if (%fixed) { - push @fixed_messages, - "$fullpath (" . join('; ', sort(keys(%fixed))) . ")\n"; - } - } - } - if (@times) { - ++$time_files; - for (@times) { - my ($minutes, $seconds, $hundredths, $millis) = /(\d?\d):(\d\d)(?:\.(\d\d)(\d?))?/; - $total_millis += 60_000 * $minutes + 1000 * $seconds + $hundredths * 10 + $millis; - } - } - elsif ($stat && $time) { - push @no_time_files, $fullpath - } - } - if ($features) { - my @features = `$asapscan -f -u $filename`; - if ($?) { - $fatal{'error running asapscan'} = 1; - } - else { - s/\s+$//, push @{$features{$_}}, $fullpath for @features; - } - } - if (%fatal) { - push @fatal_messages, - "$fullpath (" . join('; ', sort(keys(%fatal))) . ")\n"; - } -} - -sub wanted() { - process($_, $File::Find::name) if /\.sap$/is; -} - -Getopt::Long::Configure('bundling'); -GetOptions( - 'check|c' => \$check, - 'fix|f' => \$fix, - 'statistics|s' => \$stat, - 'progress|p' => \$progress, - 'time|t' => \$time, - 'overwrite-time|T' => \$overwrite_time, - 'features|u' => \$features, - 'help|h' => \$help, - 'version|v' => \$version, -) or pod2usage(2); - -pod2usage({ -verbose => 1, -exitval => 0 }) if $help; -if ($version) { - print "chksap $VERSION\n"; - exit 0; -} - -pod2usage(2) if $check + $fix + $stat != 1 || $time > $fix +$stat || $overwrite_time > $fix || @ARGV == 0; - -find(\&wanted, @ARGV); - -print "Files processed: $total_files\n"; -print "Not recognized as valid SAP: ", - $total_files - $sap_files, "\n" if $sap_files != $total_files; -if ($check) { - print "Bad files that can be fixed automatically: ", - scalar(@fixed_messages), "\n"; - print "Bad files that cannot be fixed automatically: ", - scalar(@fatal_messages), "\n"; - print "\nPossible automatic fixes:\n", - @fixed_messages if @fixed_messages; - print "\nAutomatic fix not possible:\n", - @fatal_messages if @fatal_messages; - print "\nCan fix automatically after correcting previous errors:\n", - @notfixed_messages if @notfixed_messages; -} -elsif ($fix) { - print "Bad files fixed automatically: ", - scalar(@fixed_messages), "\n"; - print "Bad files that cannot be fixed automatically: ", - scalar(@fatal_messages), "\n"; - print "\nFixed:\n", - @fixed_messages if @fixed_messages; - print "\nCannot fix automatically:\n", - @fatal_messages if @fatal_messages; - print "\nCan fix after correcting previous errors:\n", - @notfixed_messages if @notfixed_messages; -} -elsif ($stat) { - print "Total file size: $total_length bytes\n"; - printf "Average file size: %.0f bytes\n", $total_length / $sap_files if $sap_files; - print "Smallest SAP file: $min_filename ($min_length bytes)\n" if $min_filename; - print "Biggest SAP file: $max_filename ($max_length bytes)\n" if $max_filename; - my $ref = $stat{'SONGS'}; - if ($ref) { - print "\nFiles with subsongs:\n"; - my ($files_with_subsongs, $extra_subsongs); - for (sort { $a <=> $b } keys(%$ref)) { - next if $_ == 1; - my $files = $ref->{$_}; - printf "%3s subsongs:%4d file%s\n", $_, $files, $files != 1 ? 's' : ''; - $files_with_subsongs += $files; - $extra_subsongs += $files * ($_ - 1); - } - print "Total: $extra_subsongs extra subsongs in $files_with_subsongs files\n"; - } - printf "\nFiles tagged with TIME: $time_files (%d days %d hours %d minutes %g seconds)\n", - $total_millis / 86_400_000, $total_millis / 3600_000 % 24, - $total_millis / 60_000 % 60, $total_millis / 1000 % 60; - print "\nStereo SAP files: $stereo_files\n"; - print "NTSC SAP files: $ntsc_files\n"; - for (sort keys %types) { - printf "Type %s: mono:%5d stereo:%5d total:%5d\n", $_, - $types{$_}{'mono'}, $types{$_}{'stereo'}, $types{$_}{'mono'} + $types{$_}{'stereo'}; - } - for ('FASTPLAY', 'AUTHOR', 'DATE', 'NAME') { - $ref = $stat{$_}; - if ($ref) { - print "\n$_ values:\n"; - for (sort keys(%$ref)) { - printf "%4dx: %s\n", $ref->{$_}, $_; - } - } - } - if (@no_time_files) { - print "\nFiles with no TIME tags:\n"; - print "$_\n" for sort @no_time_files; - } - if ($features) { - for (sort keys %features) { - print "\nFiles which use $_:\n"; - print "$_\n" for sort @{$features{$_}}; - } - } -} diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/COPYING kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/COPYING --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/COPYING 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/COPYING 1970-01-01 00:00:00.000000000 +0000 @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/cpu6502.ci kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/cpu6502.ci --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/cpu6502.ci 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/cpu6502.ci 1970-01-01 00:00:00.000000000 +0000 @@ -1,1281 +0,0 @@ -// cpu6502.ci - 6502 CPU emulator -// -// Copyright (C) 2010-2011 Piotr Fusik -// -// This file is part of ASAP (Another Slight Atari Player), -// see http://asap.sourceforge.net -// -// ASAP is free software; you can redistribute it and/or modify it -// under the terms of the GNU General Public License as published -// by the Free Software Foundation; either version 2 of the License, -// or (at your option) any later version. -// -// ASAP is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -// See the GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with ASAP; if not, write to the Free Software Foundation, Inc., -// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -// How 6502 registers are stored in this emulator: -// All variables are int, because modern processors (and Java bytecode) -// tend to operate more effectively on these type than narrower ones. -// pc is really an unsigned 16-bit integer. -// a, x, y and s are unsigned 8-bit integers. -// Flags are decomposed into three variables for improved performance. -// c is either 0 or 1. -// nz contains 6502 flags N and Z. -// N is set if (nz >= 0x80). Z is set if ((nz & 0xff) == 0). -// Usually nz is simply assigned the unsigned 8-bit operation result. -// There are just a few operations (BIT, PLP and RTI) where both N and Z may -// be set. In these cases, N is reflected by the 8th (not 7th) bit of nz. -// vdi contains rarely used flags V, D and I, as a combination -// of VFlag, DFlag and IFlag. Other vdi bits are clear. - -// "Unofficial" opcodes are those not documented as "legal" 6502 opcodes. -// Their operation has been reverse-engineered on Atari 800XL and Atari 65XE. -// Unofficial opcodes are identical to C64's 6510, except for 0x8b and 0xab. -// The operation of "unstable" opcodes is partially uncertain. -// Explanation is welcome. - -// Emulation of POKEY timer interrupts is included. - -// Two preprocessor symbols may be used to strip the size of this emulator. -// Define ACPU_NO_DECIMAL to disable emulation of the BCD mode. -// Define ACPU_NO_UNOFFICIAL to disable emulation of unofficial opcodes. - -class Cpu6502 -{ - int Pc; - int A; - int X; - int Y; - int S; - int Nz; - int C; - int Vdi; - - const int VFlag = 0x40; - const int DFlag = 0x08; - const int IFlag = 0x04; - const int ZFlag = 0x02; - - /// Runs 6502 emulation for the specified number of Atari scanlines. - /// Each scanline is 114 cycles of which 9 is taken by ANTIC for memory refresh. - void DoFrame(ASAP asap, int cycleLimit) - { - // copy registers from the object to local variables for improved performance - int pc = Pc; - int nz = Nz; - int a = A; - int x = X; - int y = Y; - int c = C; - int s = S; - int vdi = Vdi; - - while (asap.Cycle < cycleLimit) { - - macro PEEK_MEMORY(addr) ( asap.Memory[addr] ) - macro POKE_MEMORY(addr, data) { asap.Memory[addr] = data; } - - macro PEEK_ZPAGE(addr) ( PEEK_MEMORY((addr) & 0xff) ) - macro DPEEK_MEMORY(addr) ( PEEK_MEMORY(addr) + (PEEK_MEMORY((addr) + 1) << 8) ) - - macro PEEK(addr) ( ((addr) & 0xf900) == 0xd000 ? asap.PeekHardware(addr) : PEEK_MEMORY(addr) ) - macro POKE(addr, data) { if (((addr) & 0xf900) == 0xd000) asap.PokeHardware(addr, data); else POKE_MEMORY(addr, data); } - - macro PEEK_RMW(dest, addr) { - if ((addr) >> 8 == 0xd2) { - asap.Cycle--; - dest = asap.PeekHardware(addr); - asap.PokeHardware(addr, dest); - asap.Cycle++; - } - else - dest = PEEK_MEMORY(addr); - } - - macro PEEK_CODE() ( PEEK_MEMORY(pc) ) - macro FETCH() ( PEEK_MEMORY(pc++) ) - - macro ABSOLUTE() { addr = FETCH(); addr += FETCH() << 8; } - macro ABSOLUTE_X() { addr = FETCH(); addr = (addr + (FETCH() << 8) + x) & 0xffff; } - macro ABSOLUTE_Y() { addr = FETCH(); addr = (addr + (FETCH() << 8) + y) & 0xffff; } - macro ZPAGE() { addr = FETCH(); } - macro ZPAGE_X() { addr = (FETCH() + x) & 0xff; } - macro ZPAGE_Y() { addr = (FETCH() + y) & 0xff; } - macro INDIRECT_X() { addr = (FETCH() + x) & 0xff; addr = PEEK_MEMORY(addr) + (PEEK_ZPAGE(addr + 1) << 8); } - macro INDIRECT_Y() { addr = FETCH(); addr = (PEEK_MEMORY(addr) + (PEEK_ZPAGE(addr + 1) << 8) + y) & 0xffff; } - macro NCYCLES_X() { if ((addr & 0xff) < x) asap.Cycle++; } - macro NCYCLES_Y() { if ((addr & 0xff) < y) asap.Cycle++; } - - macro PL(dest) { s = (s + 1) & 0xff; dest = PEEK_MEMORY(0x0100 + s); } - macro PLP() { PL(vdi); nz = ((vdi & 0x80) << 1) + (~vdi & ZFlag); c = vdi & 1; vdi &= VFlag | DFlag | IFlag; } - macro PH(data) { POKE_MEMORY(0x0100 + s, data); s = (s - 1) & 0xff; } - macro PHP(bflag) { PH(((nz | (nz >> 1)) & 0x80) + vdi + ((nz & 0xff) == 0 ? ZFlag : 0) + c + bflag); } - macro PHPB0() { PHP(0x20); } // push flags with B flag clear (NMI, IRQ) - macro PHPB1() { PHP(0x30); } // push flags with B flag set (PHP, BRK) - macro PHPC() { PH(pc >> 8); PH(pc.LowByte); } - -#if ACPU_NO_DECIMAL - - macro DO_ADC() {{ - // binary mode - int tmp = a + data + c; - vdi = (vdi & (DFlag | IFlag)) + (((~(data ^ a) & (a ^ tmp)) >> 1) & VFlag); - c = tmp >> 8; - nz = a = tmp & 0xff; - }} - - macro DO_SBC() {{ - // binary mode - int tmp = a - data - 1 + c; - vdi = (vdi & (DFlag | IFlag)) + ((((data ^ a) & (a ^ tmp)) >> 1) & VFlag); - c = tmp >= 0 ? 1 : 0; - nz = a = tmp & 0xff; - }} - -#else // ACPU_NO_DECIMAL - - macro DO_ADC() {{ - int tmp = a + data + c; - nz = tmp & 0xff; - if ((vdi & DFlag) == 0) { - // binary mode - vdi = (vdi & (DFlag | IFlag)) + (((~(data ^ a) & (a ^ tmp)) >> 1) & VFlag); - c = tmp >> 8; - a = nz; - } - else { - // decimal mode - int al = (a & 0x0f) + (data & 0x0f) + c; - if (al >= 10) { - tmp += al < 26 ? 6 : -10; - // Set N from tmp, leave Z unchanged. Zero can only change to 6, this doesn't affect N. - if (nz != 0) - nz = (tmp & 0x80) + 1; - } - vdi = (vdi & (DFlag | IFlag)) + (((~(data ^ a) & (a ^ tmp)) >> 1) & VFlag); - if (tmp >= 0xa0) { - c = 1; - a = (tmp + 0x60) & 0xff; - } - else { - c = 0; - a = tmp; - } - } - }} - - macro DO_SBC() {{ - int tmp = a - data - 1 + c; - int al = (a & 0x0f) - (data & 0x0f) - 1 + c; - vdi = (vdi & (DFlag | IFlag)) + ((((data ^ a) & (a ^ tmp)) >> 1) & VFlag); - c = tmp >= 0 ? 1 : 0; - nz = a = tmp & 0xff; - if ((vdi & DFlag) != 0) { - // decimal mode - if (al < 0) - a += al < -10 ? 10 : -6; - if (c == 0) - a = (a - 0x60) & 0xff; - } - }} - -#endif // ACPU_NO_DECIMAL - - macro LDA() { nz = a = PEEK(addr); } - macro LDA_ZP() { nz = a = PEEK_MEMORY(addr); } - macro LDX() { nz = x = PEEK(addr); } - macro LDX_ZP() { nz = x = PEEK_MEMORY(addr); } - macro LDY() { nz = y = PEEK(addr); } - macro LDY_ZP() { nz = y = PEEK_MEMORY(addr); } - macro LAX() { nz = x = a = PEEK(addr); } - macro LAX_ZP() { nz = x = a = PEEK_MEMORY(addr); } - macro STA() { POKE(addr, a); } - macro STA_ZP() { POKE_MEMORY(addr, a); } - macro STX() { POKE(addr, x); } - macro STX_ZP() { POKE_MEMORY(addr, x); } - macro STY() { POKE(addr, y); } - macro STY_ZP() { POKE_MEMORY(addr, y); } - macro SAX() { data = a & x; POKE(addr, data); } - macro SAX_ZP() { data = a & x; POKE_MEMORY(addr, data); } - macro CMP() { nz = PEEK(addr); c = a >= nz ? 1 : 0; nz = (a - nz) & 0xff; } - macro CMP_ZP() { nz = PEEK_MEMORY(addr); c = a >= nz ? 1 : 0; nz = (a - nz) & 0xff; } - macro CPX() { nz = PEEK(addr); c = x >= nz ? 1 : 0; nz = (x - nz) & 0xff; } - macro CPX_ZP() { nz = PEEK_MEMORY(addr); c = x >= nz ? 1 : 0; nz = (x - nz) & 0xff; } - macro CPY() { nz = PEEK(addr); c = y >= nz ? 1 : 0; nz = (y - nz) & 0xff; } - macro CPY_ZP() { nz = PEEK_MEMORY(addr); c = y >= nz ? 1 : 0; nz = (y - nz) & 0xff; } - macro AND() { nz = a &= PEEK(addr); } - macro AND_ZP() { nz = a &= PEEK_MEMORY(addr); } - macro ORA() { nz = a |= PEEK(addr); } - macro ORA_ZP() { nz = a |= PEEK_MEMORY(addr); } - macro EOR() { nz = a ^= PEEK(addr); } - macro EOR_ZP() { nz = a ^= PEEK_MEMORY(addr); } - macro ADC() { data = PEEK(addr); DO_ADC(); } - macro ADC_ZP() { data = PEEK_MEMORY(addr); DO_ADC(); } - macro SBC() { data = PEEK(addr); DO_SBC(); } - macro SBC_ZP() { data = PEEK_MEMORY(addr); DO_SBC(); } - - macro ASL() { PEEK_RMW(nz, addr); c = nz >> 7; nz = (nz << 1) & 0xff; POKE(addr, nz); } - macro ASL_ZP() { nz = PEEK_MEMORY(addr); c = nz >> 7; nz = (nz << 1) & 0xff; POKE_MEMORY(addr, nz); } - macro ROL() { PEEK_RMW(nz, addr); nz = (nz << 1) + c; c = nz >> 8; nz &= 0xff; POKE(addr, nz); } - macro ROL_ZP() { nz = PEEK_MEMORY(addr); nz = (nz << 1) + c; c = nz >> 8; nz &= 0xff; POKE_MEMORY(addr, nz); } - macro LSR() { PEEK_RMW(nz, addr); c = nz & 1; nz >>= 1; POKE(addr, nz); } - macro LSR_ZP() { nz = PEEK_MEMORY(addr); c = nz & 1; nz >>= 1; POKE_MEMORY(addr, nz); } - macro ROR() { PEEK_RMW(nz, addr); nz += c << 8; c = nz & 1; nz >>= 1; POKE(addr, nz); } - macro ROR_ZP() { nz = PEEK_MEMORY(addr) + (c << 8); c = nz & 1; nz >>= 1; POKE_MEMORY(addr, nz); } - macro DEC() { PEEK_RMW(nz, addr); nz = (nz - 1) & 0xff; POKE(addr, nz); } - macro DEC_ZP() { nz = PEEK_MEMORY(addr); nz = (nz - 1) & 0xff; POKE_MEMORY(addr, nz); } - macro INC() { PEEK_RMW(nz, addr); nz = (nz + 1) & 0xff; POKE(addr, nz); } - macro INC_ZP() { nz = PEEK_MEMORY(addr); nz = (nz + 1) & 0xff; POKE_MEMORY(addr, nz); } - - macro ASO() { ASL(); nz = a |= nz; } - macro ASO_ZP() { ASL_ZP(); nz = a |= nz; } - macro RLA() { ROL(); nz = a &= nz; } - macro RLA_ZP() { ROL_ZP(); nz = a &= nz; } - macro LSE() { LSR(); nz = a ^= nz; } - macro LSE_ZP() { LSR_ZP(); nz = a ^= nz; } - macro RRA() { ROR(); data = nz; DO_ADC(); } - macro RRA_ZP() { ROR_ZP(); data = nz; DO_ADC(); } - macro DCM() { DEC(); c = a >= nz ? 1 : 0; nz = (a - nz) & 0xff; } - macro DCM_ZP() { DEC_ZP(); c = a >= nz ? 1 : 0; nz = (a - nz) & 0xff; } - macro INS() { INC(); data = nz; DO_SBC(); } - macro INS_ZP() { INC_ZP(); data = nz; DO_SBC(); } - - macro SHX(val,ind) {{ - addr = FETCH(); - int hi = FETCH(); - data = (hi + 1) & val; - addr += ind; - if (addr >= 0x100) - hi = data - 1; - addr += hi << 8; - POKE(addr, data); - }} - - macro BRANCH(cond) { - if (cond) { - addr = PEEK_CODE().SByte; - pc++; - addr += pc; - if ((addr ^ pc) >> 8 != 0) - asap.Cycle++; - asap.Cycle++; - pc = addr; - break; - } - pc++; - break; - } - - macro CHECK_IRQ() { - if ((vdi & IFlag) == 0 && asap.Pokeys.Irqst != 0xff) { - PHPC(); - PHPB0(); - vdi |= IFlag; - pc = DPEEK_MEMORY(0xfffe); - asap.Cycle += 7; - } - } - - if (asap.Cycle >= asap.NextEventCycle) { - Pc = pc; - S = s; - asap.HandleEvent(); - pc = Pc; - s = S; - CHECK_IRQ(); - } -#if ASAPSCAN - native { - if (cpu_trace != 0) - trace_cpu(asap, pc, a, x, y, s, nz, vdi, c); - } -#endif - int data = FETCH(); - const int[256] opcodeCycles = { - // 0 1 2 3 4 5 6 7 8 9 A B C D E F - 7, 6, 2, 8, 3, 3, 5, 5, 3, 2, 2, 2, 4, 4, 6, 6, // 0x - 2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 7, 7, // 1x - 6, 6, 2, 8, 3, 3, 5, 5, 4, 2, 2, 2, 4, 4, 6, 6, // 2x - 2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 7, 7, // 3x - 6, 6, 2, 8, 3, 3, 5, 5, 3, 2, 2, 2, 3, 4, 6, 6, // 4x - 2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 7, 7, // 5x - 6, 6, 2, 8, 3, 3, 5, 5, 4, 2, 2, 2, 5, 4, 6, 6, // 6x - 2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 7, 7, // 7x - 2, 6, 2, 6, 3, 3, 3, 3, 2, 2, 2, 2, 4, 4, 4, 4, // 8x - 2, 6, 2, 6, 4, 4, 4, 4, 2, 5, 2, 5, 5, 5, 5, 5, // 9x - 2, 6, 2, 6, 3, 3, 3, 3, 2, 2, 2, 2, 4, 4, 4, 4, // Ax - 2, 5, 2, 5, 4, 4, 4, 4, 2, 4, 2, 4, 4, 4, 4, 4, // Bx - 2, 6, 2, 8, 3, 3, 5, 5, 2, 2, 2, 2, 4, 4, 6, 6, // Cx - 2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 7, 7, // Dx - 2, 6, 2, 8, 3, 3, 5, 5, 2, 2, 2, 2, 4, 4, 6, 6, // Ex - 2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 7, 7 // Fx - }; - asap.Cycle += opcodeCycles[data]; - int addr; - - switch (data) { - case 0x00: // BRK - pc++; - PHPC(); - PHPB1(); - vdi |= IFlag; - pc = DPEEK_MEMORY(0xfffe); - break; - case 0x01: // ORA (ab,x) - INDIRECT_X(); - ORA(); - break; - case 0x02: // CIM [unofficial] - case 0x12: - case 0x22: - case 0x32: - case 0x42: - case 0x52: - case 0x62: - case 0x72: - case 0x92: - case 0xb2: - case 0xd2: - case 0xf2: - pc--; - asap.Cycle = asap.NextEventCycle; - break; - case 0x05: // ORA ab - ZPAGE(); - ORA_ZP(); - break; - case 0x06: // ASL ab - ZPAGE(); - ASL_ZP(); - break; - case 0x08: // PHP - PHPB1(); - break; - case 0x09: // ORA #ab - nz = a |= FETCH(); - break; - case 0x0a: // ASL - c = a >> 7; - nz = a = (a << 1) & 0xff; - break; - case 0x0d: // ORA abcd - ABSOLUTE(); - ORA(); - break; - case 0x0e: // ASL abcd - ABSOLUTE(); - ASL(); - break; - case 0x10: // BPL - BRANCH(nz < 0x80); - case 0x11: // ORA (ab),y - INDIRECT_Y(); - NCYCLES_Y(); - ORA(); - break; - case 0x15: // ORA ab,x - ZPAGE_X(); - ORA_ZP(); - break; - case 0x16: // ASL ab,x - ZPAGE_X(); - ASL_ZP(); - break; - case 0x18: // CLC - c = 0; - break; - case 0x19: // ORA abcd,y - ABSOLUTE_Y(); - NCYCLES_Y(); - ORA(); - break; - case 0x1d: // ORA abcd,x - ABSOLUTE_X(); - NCYCLES_X(); - ORA(); - break; - case 0x1e: // ASL abcd,x - ABSOLUTE_X(); - ASL(); - break; - case 0x20: // JSR abcd - addr = FETCH(); - PHPC(); - pc = addr + (PEEK_CODE() << 8); - break; - case 0x21: // AND (ab,x) - INDIRECT_X(); - AND(); - break; - case 0x24: // BIT ab - ZPAGE(); - nz = PEEK_MEMORY(addr); - vdi = (vdi & (DFlag | IFlag)) + (nz & VFlag); - nz = ((nz & 0x80) << 1) + (nz & a); - break; - case 0x25: // AND ab - ZPAGE(); - AND_ZP(); - break; - case 0x26: // ROL ab - ZPAGE(); - ROL_ZP(); - break; - case 0x28: // PLP - PLP(); - CHECK_IRQ(); - break; - case 0x29: // AND #ab - nz = a &= FETCH(); - break; - case 0x2a: // ROL - a = (a << 1) + c; - c = a >> 8; - nz = a &= 0xff; - break; - case 0x2c: // BIT abcd - ABSOLUTE(); - nz = PEEK(addr); - vdi = (vdi & (DFlag | IFlag)) + (nz & VFlag); - nz = ((nz & 0x80) << 1) + (nz & a); - break; - case 0x2d: // AND abcd - ABSOLUTE(); - AND(); - break; - case 0x2e: // ROL abcd - ABSOLUTE(); - ROL(); - break; - case 0x30: // BMI - BRANCH(nz >= 0x80); - case 0x31: // AND (ab),y - INDIRECT_Y(); - NCYCLES_Y(); - AND(); - break; - case 0x35: // AND ab,x - ZPAGE_X(); - AND_ZP(); - break; - case 0x36: // ROL ab,x - ZPAGE_X(); - ROL_ZP(); - break; - case 0x38: // SEC - c = 1; - break; - case 0x39: // AND abcd,y - ABSOLUTE_Y(); - NCYCLES_Y(); - AND(); - break; - case 0x3d: // AND abcd,x - ABSOLUTE_X(); - NCYCLES_X(); - AND(); - break; - case 0x3e: // ROL abcd,x - ABSOLUTE_X(); - ROL(); - break; - case 0x40: // RTI - PLP(); - PL(pc); - PL(addr); - pc += addr << 8; - CHECK_IRQ(); - break; - case 0x41: // EOR (ab,x) - INDIRECT_X(); - EOR(); - break; - case 0x45: // EOR ab - ZPAGE(); - EOR_ZP(); - break; - case 0x46: // LSR ab - ZPAGE(); - LSR_ZP(); - break; - case 0x48: // PHA - PH(a); - break; - case 0x49: // EOR #ab - nz = a ^= FETCH(); - break; - case 0x4a: // LSR - c = a & 1; - nz = a >>= 1; - break; - case 0x4c: // JMP abcd - addr = FETCH(); - pc = addr + (PEEK_CODE() << 8); - break; - case 0x4d: // EOR abcd - ABSOLUTE(); - EOR(); - break; - case 0x4e: // LSR abcd - ABSOLUTE(); - LSR(); - break; - case 0x50: // BVC - BRANCH((vdi & VFlag) == 0); - case 0x51: // EOR (ab),y - INDIRECT_Y(); - NCYCLES_Y(); - EOR(); - break; - case 0x55: // EOR ab,x - ZPAGE_X(); - EOR_ZP(); - break; - case 0x56: // LSR ab,x - ZPAGE_X(); - LSR_ZP(); - break; - case 0x58: // CLI - vdi &= VFlag | DFlag; - CHECK_IRQ(); - break; - case 0x59: // EOR abcd,y - ABSOLUTE_Y(); - NCYCLES_Y(); - EOR(); - break; - case 0x5d: // EOR abcd,x - ABSOLUTE_X(); - NCYCLES_X(); - EOR(); - break; - case 0x5e: // LSR abcd,x - ABSOLUTE_X(); - LSR(); - break; - case 0x60: // RTS - PL(pc); - PL(addr); - pc += (addr << 8) + 1; - break; - case 0x61: // ADC (ab,x) - INDIRECT_X(); - ADC(); - break; - case 0x65: // ADC ab - ZPAGE(); - ADC_ZP(); - break; - case 0x66: // ROR ab - ZPAGE(); - ROR_ZP(); - break; - case 0x68: // PLA - PL(a); - nz = a; - break; - case 0x69: // ADC #ab - data = FETCH(); - DO_ADC(); - break; - case 0x6a: // ROR - nz = (c << 7) + (a >> 1); - c = a & 1; - a = nz; - break; - case 0x6c: // JMP (abcd) - ABSOLUTE(); - if ((addr & 0xff) == 0xff) - pc = PEEK_MEMORY(addr) + (PEEK_MEMORY(addr - 0xff) << 8); - else - pc = DPEEK_MEMORY(addr); - break; - case 0x6d: // ADC abcd - ABSOLUTE(); - ADC(); - break; - case 0x6e: // ROR abcd - ABSOLUTE(); - ROR(); - break; - case 0x70: // BVS - BRANCH((vdi & VFlag) != 0); - case 0x71: // ADC (ab),y - INDIRECT_Y(); - NCYCLES_Y(); - ADC(); - break; - case 0x75: // ADC ab,x - ZPAGE_X(); - ADC_ZP(); - break; - case 0x76: // ROR ab,x - ZPAGE_X(); - ROR_ZP(); - break; - case 0x78: // SEI - vdi |= IFlag; - break; - case 0x79: // ADC abcd,y - ABSOLUTE_Y(); - NCYCLES_Y(); - ADC(); - break; - case 0x7d: // ADC abcd,x - ABSOLUTE_X(); - NCYCLES_X(); - ADC(); - break; - case 0x7e: // ROR abcd,x - ABSOLUTE_X(); - ROR(); - break; - case 0x81: // STA (ab,x) - INDIRECT_X(); - STA(); - break; - case 0x84: // STY ab - ZPAGE(); - STY_ZP(); - break; - case 0x85: // STA ab - ZPAGE(); - STA_ZP(); - break; - case 0x86: // STX ab - ZPAGE(); - STX_ZP(); - break; - case 0x88: // DEY - nz = y = (y - 1) & 0xff; - break; - case 0x8a: // TXA - nz = a = x; - break; - case 0x8c: // STY abcd - ABSOLUTE(); - STY(); - break; - case 0x8d: // STA abcd - ABSOLUTE(); - STA(); - break; - case 0x8e: // STX abcd - ABSOLUTE(); - STX(); - break; - case 0x90: // BCC - BRANCH(c == 0); - case 0x91: // STA (ab),y - INDIRECT_Y(); - STA(); - break; - case 0x94: // STY ab,x - ZPAGE_X(); - STY_ZP(); - break; - case 0x95: // STA ab,x - ZPAGE_X(); - STA_ZP(); - break; - case 0x96: // STX ab,y - ZPAGE_Y(); - STX_ZP(); - break; - case 0x98: // TYA - nz = a = y; - break; - case 0x99: // STA abcd,y - ABSOLUTE_Y(); - STA(); - break; - case 0x9a: // TXS - s = x; - break; - case 0x9d: // STA abcd,x - ABSOLUTE_X(); - STA(); - break; - case 0xa0: // LDY #ab - nz = y = FETCH(); - break; - case 0xa1: // LDA (ab,x) - INDIRECT_X(); - LDA(); - break; - case 0xa2: // LDX #ab - nz = x = FETCH(); - break; - case 0xa4: // LDY ab - ZPAGE(); - LDY_ZP(); - break; - case 0xa5: // LDA ab - ZPAGE(); - LDA_ZP(); - break; - case 0xa6: // LDX ab - ZPAGE(); - LDX_ZP(); - break; - case 0xa8: // TAY - nz = y = a; - break; - case 0xa9: // LDA #ab - nz = a = FETCH(); - break; - case 0xaa: // TAX - nz = x = a; - break; - case 0xac: // LDY abcd - ABSOLUTE(); - LDY(); - break; - case 0xad: // LDA abcd - ABSOLUTE(); - LDA(); - break; - case 0xae: // LDX abcd - ABSOLUTE(); - LDX(); - break; - case 0xb0: // BCS - BRANCH(c != 0); - case 0xb1: // LDA (ab),y - INDIRECT_Y(); - NCYCLES_Y(); - LDA(); - break; - case 0xb4: // LDY ab,x - ZPAGE_X(); - LDY_ZP(); - break; - case 0xb5: // LDA ab,x - ZPAGE_X(); - LDA_ZP(); - break; - case 0xb6: // LDX ab,y - ZPAGE_Y(); - LDX_ZP(); - break; - case 0xb8: // CLV - vdi &= DFlag | IFlag; - break; - case 0xb9: // LDA abcd,y - ABSOLUTE_Y(); - NCYCLES_Y(); - LDA(); - break; - case 0xba: // TSX - nz = x = s; - break; - case 0xbc: // LDY abcd,x - ABSOLUTE_X(); - NCYCLES_X(); - LDY(); - break; - case 0xbd: // LDA abcd,x - ABSOLUTE_X(); - NCYCLES_X(); - LDA(); - break; - case 0xbe: // LDX abcd,y - ABSOLUTE_Y(); - NCYCLES_Y(); - LDX(); - break; - case 0xc0: // CPY #ab - nz = FETCH(); - c = y >= nz ? 1 : 0; - nz = (y - nz) & 0xff; - break; - case 0xc1: // CMP (ab,x) - INDIRECT_X(); - CMP(); - break; - case 0xc4: // CPY ab - ZPAGE(); - CPY_ZP(); - break; - case 0xc5: // CMP ab - ZPAGE(); - CMP_ZP(); - break; - case 0xc6: // DEC ab - ZPAGE(); - DEC_ZP(); - break; - case 0xc8: // INY - nz = y = (y + 1) & 0xff; - break; - case 0xc9: // CMP #ab - nz = FETCH(); - c = a >= nz ? 1 : 0; - nz = (a - nz) & 0xff; - break; - case 0xca: // DEX - nz = x = (x - 1) & 0xff; - break; - case 0xcc: // CPY abcd - ABSOLUTE(); - CPY(); - break; - case 0xcd: // CMP abcd - ABSOLUTE(); - CMP(); - break; - case 0xce: // DEC abcd - ABSOLUTE(); - DEC(); - break; - case 0xd0: // BNE - BRANCH((nz & 0xff) != 0); - case 0xd1: // CMP (ab),y - INDIRECT_Y(); - NCYCLES_Y(); - CMP(); - break; - case 0xd5: // CMP ab,x - ZPAGE_X(); - CMP_ZP(); - break; - case 0xd6: // DEC ab,x - ZPAGE_X(); - DEC_ZP(); - break; - case 0xd8: // CLD - vdi &= VFlag | IFlag; - break; - case 0xd9: // CMP abcd,y - ABSOLUTE_Y(); - NCYCLES_Y(); - CMP(); - break; - case 0xdd: // CMP abcd,x - ABSOLUTE_X(); - NCYCLES_X(); - CMP(); - break; - case 0xde: // DEC abcd,x - ABSOLUTE_X(); - DEC(); - break; - case 0xe0: // CPX #ab - nz = FETCH(); - c = x >= nz ? 1 : 0; - nz = (x - nz) & 0xff; - break; - case 0xe1: // SBC (ab,x) - INDIRECT_X(); - SBC(); - break; - case 0xe4: // CPX ab - ZPAGE(); - CPX_ZP(); - break; - case 0xe5: // SBC ab - ZPAGE(); - SBC_ZP(); - break; - case 0xe6: // INC ab - ZPAGE(); - INC_ZP(); - break; - case 0xe8: // INX - nz = x = (x + 1) & 0xff; - break; - case 0xe9: // SBC #ab - case 0xeb: // SBC #ab [unofficial] - data = FETCH(); - DO_SBC(); - break; - case 0xea: // NOP - case 0x1a: // NOP [unofficial] - case 0x3a: - case 0x5a: - case 0x7a: - case 0xda: - case 0xfa: - break; - case 0xec: // CPX abcd - ABSOLUTE(); - CPX(); - break; - case 0xed: // SBC abcd - ABSOLUTE(); - SBC(); - break; - case 0xee: // INC abcd - ABSOLUTE(); - INC(); - break; - case 0xf0: // BEQ - BRANCH((nz & 0xff) == 0); - case 0xf1: // SBC (ab),y - INDIRECT_Y(); - NCYCLES_Y(); - SBC(); - break; - case 0xf5: // SBC ab,x - ZPAGE_X(); - SBC_ZP(); - break; - case 0xf6: // INC ab,x - ZPAGE_X(); - INC_ZP(); - break; - case 0xf8: // SED - vdi |= DFlag; - break; - case 0xf9: // SBC abcd,y - ABSOLUTE_Y(); - NCYCLES_Y(); - SBC(); - break; - case 0xfd: // SBC abcd,x - ABSOLUTE_X(); - NCYCLES_X(); - SBC(); - break; - case 0xfe: // INC abcd,x - ABSOLUTE_X(); - INC(); - break; - -#if !ACPU_NO_UNOFFICIAL - case 0x03: // ASO (ab,x) [unofficial] - INDIRECT_X(); - ASO(); - break; - case 0x04: // NOP ab [unofficial] - case 0x44: - case 0x64: - case 0x14: // NOP ab,x [unofficial] - case 0x34: - case 0x54: - case 0x74: - case 0xd4: - case 0xf4: - case 0x80: // NOP #ab [unofficial] - case 0x82: - case 0x89: - case 0xc2: - case 0xe2: - pc++; - break; - case 0x07: // ASO ab [unofficial] - ZPAGE(); - ASO_ZP(); - break; - case 0x0b: // ANC #ab [unofficial] - case 0x2b: - nz = a &= FETCH(); - c = nz >> 7; - break; - case 0x0c: // NOP abcd [unofficial] - pc += 2; - break; - case 0x0f: // ASO abcd [unofficial] - ABSOLUTE(); - ASO(); - break; - case 0x13: // ASO (ab),y [unofficial] - INDIRECT_Y(); - ASO(); - break; - case 0x17: // ASO ab,x [unofficial] - ZPAGE_X(); - ASO_ZP(); - break; - case 0x1b: // ASO abcd,y [unofficial] - ABSOLUTE_Y(); - ASO(); - break; - case 0x1c: // NOP abcd,x [unofficial] - case 0x3c: - case 0x5c: - case 0x7c: - case 0xdc: - case 0xfc: - if (FETCH() + x >= 0x100) - asap.Cycle++; - pc++; - break; - case 0x1f: // ASO abcd,x [unofficial] - ABSOLUTE_X(); - ASO(); - break; - case 0x23: // RLA (ab,x) [unofficial] - INDIRECT_X(); - RLA(); - break; - case 0x27: // RLA ab [unofficial] - ZPAGE(); - RLA_ZP(); - break; - case 0x2f: // RLA abcd [unofficial] - ABSOLUTE(); - RLA(); - break; - case 0x33: // RLA (ab),y [unofficial] - INDIRECT_Y(); - RLA(); - break; - case 0x37: // RLA ab,x [unofficial] - ZPAGE_X(); - RLA_ZP(); - break; - case 0x3b: // RLA abcd,y [unofficial] - ABSOLUTE_Y(); - RLA(); - break; - case 0x3f: // RLA abcd,x [unofficial] - ABSOLUTE_X(); - RLA(); - break; - case 0x43: // LSE (ab,x) [unofficial] - INDIRECT_X(); - LSE(); - break; - case 0x47: // LSE ab [unofficial] - ZPAGE(); - LSE_ZP(); - break; - case 0x4b: // ALR #ab [unofficial] - a &= FETCH(); - c = a & 1; - nz = a >>= 1; - break; - case 0x4f: // LSE abcd [unofficial] - ABSOLUTE(); - LSE(); - break; - case 0x53: // LSE (ab),y [unofficial] - INDIRECT_Y(); - LSE(); - break; - case 0x57: // LSE ab,x [unofficial] - ZPAGE_X(); - LSE_ZP(); - break; - case 0x5b: // LSE abcd,y [unofficial] - ABSOLUTE_Y(); - LSE(); - break; - case 0x5f: // LSE abcd,x [unofficial] - ABSOLUTE_X(); - LSE(); - break; - case 0x63: // RRA (ab,x) [unofficial] - INDIRECT_X(); - RRA(); - break; - case 0x67: // RRA ab [unofficial] - ZPAGE(); - RRA_ZP(); - break; - case 0x6b: // ARR #ab [unofficial] - data = a & FETCH(); - nz = a = (data >> 1) + (c << 7); - vdi = (vdi & (DFlag | IFlag)) + ((a ^ data) & VFlag); -#if ACPU_NO_DECIMAL - c = data >> 7; -#else - if ((vdi & DFlag) == 0) - c = data >> 7; - else { - if ((data & 0xf) >= 5) - a = (a & 0xf0) + ((a + 6) & 0xf); - if (data >= 0x50) { - a = (a + 0x60) & 0xff; - c = 1; - } - else - c = 0; - } -#endif - break; - case 0x6f: // RRA abcd [unofficial] - ABSOLUTE(); - RRA(); - break; - case 0x73: // RRA (ab),y [unofficial] - INDIRECT_Y(); - RRA(); - break; - case 0x77: // RRA ab,x [unofficial] - ZPAGE_X(); - RRA_ZP(); - break; - case 0x7b: // RRA abcd,y [unofficial] - ABSOLUTE_Y(); - RRA(); - break; - case 0x7f: // RRA abcd,x [unofficial] - ABSOLUTE_X(); - RRA(); - break; - case 0x83: // SAX (ab,x) [unofficial] - INDIRECT_X(); - SAX(); - break; - case 0x87: // SAX ab [unofficial] - ZPAGE(); - SAX_ZP(); - break; - case 0x8b: // ANE #ab [unofficial] - data = FETCH(); - a &= (data | 0xef) & x; - nz = a & data; - break; - case 0x8f: // SAX abcd [unofficial] - ABSOLUTE(); - SAX(); - break; - case 0x93: // SHA (ab),y [unofficial, unstable] - { - addr = FETCH(); - int hi = PEEK_ZPAGE(addr + 1); - addr = PEEK_MEMORY(addr); - data = (hi + 1) & a & x; - addr += y; - if (addr >= 0x100) - hi = data - 1; - addr += hi << 8; - POKE(addr, data); - } - break; - case 0x97: // SAX ab,y [unofficial] - ZPAGE_Y(); - SAX_ZP(); - break; - case 0x9b: // SHS abcd,y [unofficial, unstable] - // S seems to be stable, only memory values vary - s = a & x; - SHX(s, y); - break; - case 0x9c: // SHY abcd,x [unofficial] - SHX(y, x); - break; - case 0x9e: // SHX abcd,y [unofficial] - SHX(x, y); - break; - case 0x9f: // SHA abcd,y [unofficial, unstable] - SHX(a & x, y); - break; - case 0xa3: // LAX (ab,x) [unofficial] - INDIRECT_X(); - LAX(); - break; - case 0xa7: // LAX ab [unofficial] - ZPAGE(); - LAX_ZP(); - break; - case 0xab: // ANX #ab [unofficial] - nz = x = a &= FETCH(); - break; - case 0xaf: // LAX abcd [unofficial] - ABSOLUTE(); - LAX(); - break; - case 0xb3: // LAX (ab),y [unofficial] - INDIRECT_Y(); - NCYCLES_Y(); - LAX(); - break; - case 0xb7: // LAX ab,y [unofficial] - ZPAGE_Y(); - LAX_ZP(); - break; - case 0xbb: // LAS abcd,y [unofficial, unstable] - // only Z is unstable - ABSOLUTE_Y(); - NCYCLES_Y(); - nz = x = a = s &= PEEK(addr); - break; - case 0xbf: // LAX abcd,y [unofficial] - ABSOLUTE_Y(); - NCYCLES_Y(); - LAX(); - break; - case 0xc3: // DCM (ab,x) [unofficial] - INDIRECT_X(); - DCM(); - break; - case 0xc7: // DCM ab [unofficial] - ZPAGE(); - DCM_ZP(); - break; - case 0xcb: // SBX #ab [unofficial] - nz = FETCH(); - x &= a; - c = x >= nz ? 1 : 0; - nz = x = (x - nz) & 0xff; - break; - case 0xcf: // DCM abcd [unofficial] - ABSOLUTE(); - DCM(); - break; - case 0xd3: // DCM (ab),y [unofficial] - INDIRECT_Y(); - DCM(); - break; - case 0xd7: // DCM ab,x [unofficial] - ZPAGE_X(); - DCM_ZP(); - break; - case 0xdb: // DCM abcd,y [unofficial] - ABSOLUTE_Y(); - DCM(); - break; - case 0xdf: // DCM abcd,x [unofficial] - ABSOLUTE_X(); - DCM(); - break; - case 0xe3: // INS (ab,x) [unofficial] - INDIRECT_X(); - INS(); - break; - case 0xe7: // INS ab [unofficial] - ZPAGE(); - INS_ZP(); - break; - case 0xef: // INS abcd [unofficial] - ABSOLUTE(); - INS(); - break; - case 0xf3: // INS (ab),y [unofficial] - INDIRECT_Y(); - INS(); - break; - case 0xf7: // INS ab,x [unofficial] - ZPAGE_X(); - INS_ZP(); - break; - case 0xfb: // INS abcd,y [unofficial] - ABSOLUTE_Y(); - INS(); - break; - case 0xff: // INS abcd,x [unofficial] - ABSOLUTE_X(); - INS(); - break; -#endif // ACPU_NO_UNOFFICIAL - } - } - Pc = pc; - Nz = nz; - A = a; - X = x; - Y = y; - C = c; - S = s; - Vdi = vdi; - } -} diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/CREDITS kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/CREDITS --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/CREDITS 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/CREDITS 1970-01-01 00:00:00.000000000 +0000 @@ -1,72 +0,0 @@ -Authors -------- - -[horizontal] - -Piotr Fusik {asapwww!}:: -Creator and main developer. - -Atari800 Emulator Developers {asapwww!(http://atari800.sourceforge.net)}:: -6502 and POKEY emulation used in 0.x.y versions of ASAP. - -Zdenek Eisenhammer {asapwww!}:: -Testing. - -Jakub Husak {asapwww!}:: -SAP fingerprint calculation. asapscan fixes. - -Henryk Karpowicz {asapwww!}:: -CMC routine modified for the CM3 format. - -Maciek Konecki {asapwww!}:: -Porting to C#. - -Marek Konopka {asapwww!}:: -6502 routine for playing DLT. - -Daniel Kozminski {asapwww!}:: -Ideas. - -Jerzy Kut {asapwww!}:: -FC format. - -Marcin Lewandowski {asapwww!}:: -6502 routines for playing CMC, MPT, TMC and TM2. - -Ian Luck {asapwww!}:: -Guided development of XMPlay and BASS plugins. - -Adrian Matoga {asapwww!}:: -COVOX information and test files. Testing. Porting to D. - -Perry McFarlane {asapwww!}:: -POKEY reverse-engineering. - -Kostas Nakos {asapwww!}:: -Windows CE testing. - -Mariusz Rozwadowski {asapwww!}:: -Suggested CMS, CM3, DLT and STIL format support. - -Slawomir Sledz {asapwww!}:: -Windows Mobile setup. Thorough testing. - -David Spilka:: -6502 routine for playing CMS. - -Radek Sterba:: -6502 routine for playing RMT. -Testing. - -Lukasz Sychowicz {asapwww!}:: -Windows icons. -Testing. - -Pawel Szewczyk {asapwww!}:: -Windows setup graphics. - -Michal Szpilowski {asapwww!}:: -Testing. - -Grzegorz Zyla {asapwww!}:: -XBMC plugin testing. diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/csharp/AppManifest.xaml kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/csharp/AppManifest.xaml --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/csharp/AppManifest.xaml 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/csharp/AppManifest.xaml 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ - - - - - diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/csharp/asap2wav.cs kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/csharp/asap2wav.cs --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/csharp/asap2wav.cs 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/csharp/asap2wav.cs 1970-01-01 00:00:00.000000000 +0000 @@ -1,165 +0,0 @@ -/* - * asap2wav.cs - converter of ASAP-supported formats to WAV files - * - * Copyright (C) 2008-2012 Piotr Fusik - * - * This file is part of ASAP (Another Slight Atari Player), - * see http://asap.sourceforge.net - * - * ASAP is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. - * - * ASAP is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ASAP; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -using System; -using System.IO; - -using Sf.Asap; - -public class Asap2Wav -{ - static string OutputFilename = null; - static bool OutputHeader = true; - static int Song = -1; - static ASAPSampleFormat Format = ASAPSampleFormat.S16LE; - static int Duration = -1; - static int MuteMask = 0; - - static void PrintHelp() - { - Console.Write( - "Usage: asap2wav [OPTIONS] INPUTFILE...\n" + - "Each INPUTFILE must be in a supported format:\n" + - "SAP, CMC, CM3, CMR, CMS, DMC, DLT, MPT, MPD, RMT, TMC, TM8, TM2 or FC.\n" + - "Options:\n" + - "-o FILE --output=FILE Set output file name\n" + - "-s SONG --song=SONG Select subsong number (zero-based)\n" + - "-t TIME --time=TIME Set output length (MM:SS format)\n" + - "-b --byte-samples Output 8-bit samples\n" + - "-w --word-samples Output 16-bit samples (default)\n" + - " --raw Output raw audio (no WAV header)\n" + - "-m CHANNELS --mute=CHANNELS Mute POKEY chanels (1-8)\n" + - "-h --help Display this information\n" + - "-v --version Display version information\n" - ); - } - - static void SetSong(string s) - { - Song = int.Parse(s); - } - - static void SetTime(string s) - { - Duration = ASAPInfo.ParseDuration(s); - } - - static void SetMuteMask(string s) - { - int mask = 0; - foreach (char c in s) { - if (c >= '1' && c <= '8') - mask |= 1 << (c - '1'); - } - MuteMask = mask; - } - - static void ProcessFile(string inputFilename) - { - byte[] module = new byte[ASAPInfo.MaxModuleLength]; - int moduleLen; - using (Stream s = File.OpenRead(inputFilename)) { - moduleLen = s.Read(module, 0, module.Length); - } - ASAP asap = new ASAP(); - asap.Load(inputFilename, module, moduleLen); - ASAPInfo info = asap.GetInfo(); - if (Song < 0) - Song = info.GetDefaultSong(); - if (Duration < 0) { - Duration = info.GetDuration(Song); - if (Duration < 0) - Duration = 180 * 1000; - } - asap.PlaySong(Song, Duration); - asap.MutePokeyChannels(MuteMask); - if (OutputFilename == null) { - int i = inputFilename.LastIndexOf('.'); - OutputFilename = inputFilename.Substring(0, i + 1) + (OutputHeader ? "wav" : "raw"); - } - using (Stream s = File.Create(OutputFilename)) { - byte[] buffer = new byte[8192]; - int nBytes; - if (OutputHeader) { - nBytes = asap.GetWavHeader(buffer, Format, false); - s.Write(buffer, 0, nBytes); - } - do { - nBytes = asap.Generate(buffer, buffer.Length, Format); - s.Write(buffer, 0, nBytes); - } while (nBytes == buffer.Length); - } - OutputFilename = null; - Song = -1; - Duration = -1; - } - - public static int Main(string[] args) - { - bool noInputFiles = true; - for (int i = 0; i < args.Length; i++) { - string arg = args[i]; - if (arg[0] != '-') { - ProcessFile(arg); - noInputFiles = false; - } - else if (arg == "-o") - OutputFilename = args[++i]; - else if (arg.StartsWith("--output=")) - OutputFilename = arg.Substring(9); - else if (arg == "-s") - SetSong(args[++i]); - else if (arg.StartsWith("--song=")) - SetSong(arg.Substring(7)); - else if (arg == "-t") - SetTime(args[++i]); - else if (arg.StartsWith("--time=")) - SetTime(arg.Substring(7)); - else if (arg == "-b" || arg == "--byte-samples") - Format = ASAPSampleFormat.U8; - else if (arg == "-w" || arg == "--word-samples") - Format = ASAPSampleFormat.S16LE; - else if (arg == "--raw") - OutputHeader = false; - else if (arg == "-m") - SetMuteMask(args[++i]); - else if (arg.StartsWith("--mute=")) - SetMuteMask(arg.Substring(7)); - else if (arg == "-h" || arg == "--help") { - PrintHelp(); - noInputFiles = false; - } - else if (arg == "-v" || arg == "--version") { - Console.WriteLine("ASAP2WAV (.NET) " + ASAPInfo.Version); - noInputFiles = false; - } - else - throw new ArgumentException("unknown option: " + arg); - } - if (noInputFiles) { - PrintHelp(); - return 1; - } - return 0; - } -} diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/csharp/asapplay.cs kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/csharp/asapplay.cs --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/csharp/asapplay.cs 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/csharp/asapplay.cs 1970-01-01 00:00:00.000000000 +0000 @@ -1,209 +0,0 @@ -/* - * asapplay.cs - .NET ASAP player - * - * Copyright (C) 2010-2012 Piotr Fusik - * - * This file is part of ASAP (Another Slight Atari Player), - * see http://asap.sourceforge.net - * - * ASAP is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. - * - * ASAP is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ASAP; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -using System; -using System.IO; -using System.Media; - -using Sf.Asap; - -public class ASAPWavStream : Stream -{ - readonly ASAP Asap = new ASAP(); - readonly byte[] Buffer = new byte[8192]; - int BufferPos = 0; - int BufferLen; - - public ASAPWavStream(string inputFilename, int song, int duration) - { - byte[] module = new byte[ASAPInfo.MaxModuleLength]; - int moduleLen; - using (Stream s = File.OpenRead(inputFilename)) { - moduleLen = s.Read(module, 0, module.Length); - } - Asap.Load(inputFilename, module, moduleLen); - ASAPInfo info = Asap.GetInfo(); - if (song < 0) - song = info.GetDefaultSong(); - if (duration < 0) { - duration = info.GetDuration(song); - if (duration < 0) - duration = 180 * 1000; - } - Asap.PlaySong(song, duration); - BufferLen = Asap.GetWavHeader(Buffer, ASAPSampleFormat.S16LE, false); - } - - public override int Read(byte[] outputBuffer, int offset, int count) - { - int i = BufferPos; - if (i >= BufferLen) { - BufferLen = Asap.Generate(Buffer, Buffer.Length, ASAPSampleFormat.S16LE); - if (BufferLen == 0) - return 0; - i = 0; - } - if (count > BufferLen - i) - count = BufferLen - i; - Array.Copy(Buffer, i, outputBuffer, offset, count); - BufferPos = i + count; - return count; - } - - public override bool CanRead - { - get - { - return true; - } - } - - public override bool CanSeek - { - get - { - return false; - } - } - - public override bool CanWrite - { - get - { - return false; - } - } - - public override void Flush() - { - throw new NotSupportedException(); - } - - public override long Length - { - get - { - throw new NotSupportedException(); - } - } - - public override long Position - { - get - { - throw new NotSupportedException(); - } - set - { - throw new NotSupportedException(); - } - } - - public override long Seek(long offset, SeekOrigin origin) - { - throw new NotSupportedException(); - } - - public override void SetLength(long value) - { - throw new NotSupportedException(); - } - - public override void Write(byte[] buffer, int offset, int count) - { - throw new NotSupportedException(); - } -} - -public class asapplay -{ - static int song = -1; - static int duration = -1; - - static void PrintHelp() - { - Console.Write( - "Usage: asapplay [OPTIONS] INPUTFILE...\n" + - "Each INPUTFILE must be in a supported format:\n" + - "SAP, CMC, CM3, CMR, CMS, DMC, DLT, MPT, MPD, RMT, TMC, TM8, TM2 or FC.\n" + - "Options:\n" + - "-s SONG --song=SONG Select subsong number (zero-based)\n" + - "-t TIME --time=TIME Set output length (MM:SS format)\n" + - "-h --help Display this information\n" + - "-v --version Display version information\n" - ); - } - - static void SetSong(string s) - { - song = int.Parse(s); - } - - static void SetTime(string s) - { - duration = ASAPInfo.ParseDuration(s); - } - - static void ProcessFile(string inputFilename) - { - Stream s = new ASAPWavStream(inputFilename, song, duration); - new SoundPlayer(s).PlaySync(); - song = -1; - duration = -1; - } - - public static int Main(string[] args) - { - bool noInputFiles = true; - for (int i = 0; i < args.Length; i++) { - string arg = args[i]; - if (arg[0] != '-') { - ProcessFile(arg); - noInputFiles = false; - } - else if (arg == "-s") - SetSong(args[++i]); - else if (arg.StartsWith("--song=")) - SetSong(arg.Substring(7)); - else if (arg == "-t") - SetTime(args[++i]); - else if (arg.StartsWith("--time=")) - SetTime(arg.Substring(7)); - else if (arg == "-h" || arg == "--help") { - PrintHelp(); - noInputFiles = false; - } - else if (arg == "-v" || arg == "--version") { - Console.WriteLine("asapplay (.NET) " + ASAPInfo.Version); - noInputFiles = false; - } - else - throw new ArgumentException("unknown option: " + arg); - } - if (noInputFiles) { - PrintHelp(); - return 1; - } - return 0; - } -} diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/csharp/csharp.mk kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/csharp/csharp.mk --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/csharp/csharp.mk 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/csharp/csharp.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ -CSC = $(DO)"C:/Windows/Microsoft.NET/Framework/v2.0.50727/csc.exe" -nologo -o+ -out:$@ $(if $(filter %.dll,$@),-t:library) $(subst /,\\,$^) -NDOC = $(DO)"C:/Program Files (x86)/NDoc3/bin/NDoc3Console.exe" -SL = "C:/Program Files (x86)/Reference Assemblies/Microsoft/Framework/Silverlight/v3.0" - -# no user-configurable paths below this line - -ifndef DO -$(error Use "Makefile" instead of "csharp.mk") -endif - -csharp: csharp/asap2wav.exe csharp/asapplay.exe csharp/SilverASAP.xap -.PHONY: csharp - -csharp/asap2wav.exe: $(srcdir)csharp/asap2wav.cs csharp/asap.cs - $(CSC) -CLEAN += csharp/asap2wav.exe - -csharp/asapplay.exe: $(srcdir)csharp/asapplay.cs csharp/asap.cs - $(CSC) -CLEAN += csharp/asapplay.exe - -csharp/SilverASAP.xap: csharp/SilverASAP.dll $(srcdir)csharp/AppManifest.xaml - $(MAKEZIP) -CLEAN += csharp/SilverASAP.xap - -csharp/SilverASAP.dll: $(srcdir)csharp/SilverASAP.cs csharp/asap.cs - $(CSC) -nostdlib -noconfig -r:$(SL)/mscorlib.dll -r:$(SL)/system.dll -r:$(SL)/System.Net.dll -r:$(SL)/System.Windows.dll -r:$(SL)/System.Windows.Browser.dll -CLEAN += csharp/SilverASAP.dll - -csharp/asap.cs: $(call src,asap.ci asap6502.ci asapinfo.ci cpu6502.ci pokey.ci) $(ASM6502_PLAYERS_OBX) - $(CITO) -n Sf.Asap -CLEAN += csharp/asap.cs - -csharp/doc/ASAP.chm: csharp/doc/ASAP.dll - $(NDOC) -documenter:MSDN -CleanIntermediates=true -DocumentInheritedFrameworkMembers=false \ - -OutputDirectory=csharp/doc -OutputTarget=HtmlHelp -HtmlHelpName=ASAP -Title="ASAP .NET API" $< -CLEAN += csharp/doc/ASAP.chm - -csharp/doc/ASAP.dll: csharp/asap.cs - $(CSC) -t:library -doc:csharp/doc/ASAP.xml -CLEAN += csharp/doc/ASAP.dll csharp/doc/ASAP.xml - -include $(srcdir)csharp/winrt/winrt.mk diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/csharp/SilverASAP.cs kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/csharp/SilverASAP.cs --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/csharp/SilverASAP.cs 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/csharp/SilverASAP.cs 1970-01-01 00:00:00.000000000 +0000 @@ -1,234 +0,0 @@ -/* - * SilverASAP.cs - Silverlight version of ASAP - * - * Copyright (C) 2010-2012 Piotr Fusik - * - * This file is part of ASAP (Another Slight Atari Player), - * see http://asap.sourceforge.net - * - * ASAP is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. - * - * ASAP is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ASAP; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -using System; -using System.Collections.Generic; -using System.Globalization; -using System.IO; -using System.Net; -using System.Windows; -using System.Windows.Browser; -using System.Windows.Controls; -using System.Windows.Media; - -using Sf.Asap; - -class ASAPMediaStreamSource : MediaStreamSource -{ - const int BitsPerSample = 16; - static readonly Dictionary SampleAttributes = new Dictionary(); - - readonly ASAP Asap; - readonly int Duration; - MediaStreamDescription MediaStreamDescription; - readonly byte[] buffer = new byte[8192]; - - public ASAPMediaStreamSource(ASAP asap, int duration) - { - this.Asap = asap; - this.Duration = duration; - } - - static int SwapBytes(int x) - { - return x << 24 | (x & 0xff00) << 8 | ((x >> 8) & 0xff00) | ((x >> 24) & 0xff); - } - - protected override void OpenMediaAsync() - { - int channels = this.Asap.GetInfo().GetChannels(); - int blockSize = channels * BitsPerSample >> 3; - string waveFormatHex = string.Format("0100{0:X2}00{1:X8}{2:X8}{3:X2}00{4:X2}000000", - channels, SwapBytes(ASAP.SampleRate), SwapBytes(ASAP.SampleRate * blockSize), blockSize, BitsPerSample); - Dictionary streamAttributes = new Dictionary(); - streamAttributes[MediaStreamAttributeKeys.CodecPrivateData] = waveFormatHex; - this.MediaStreamDescription = new MediaStreamDescription(MediaStreamType.Audio, streamAttributes); - - Dictionary sourceAttributes = new Dictionary(); - sourceAttributes[MediaSourceAttributesKeys.CanSeek] = "True"; - sourceAttributes[MediaSourceAttributesKeys.Duration] = (this.Duration < 0 ? 0 : this.Duration * 10000).ToString(); - - ReportOpenMediaCompleted(sourceAttributes, new MediaStreamDescription[1] { this.MediaStreamDescription }); - } - - protected override void GetSampleAsync(MediaStreamType mediaStreamType) - { - int blocksPlayed = this.Asap.GetBlocksPlayed(); - int bufferLen = this.Asap.Generate(buffer, buffer.Length, BitsPerSample == 8 ? ASAPSampleFormat.U8 : ASAPSampleFormat.S16LE); - Stream s = bufferLen == 0 ? null : new MemoryStream(buffer); - MediaStreamSample mss = new MediaStreamSample(this.MediaStreamDescription, s, 0, bufferLen, - blocksPlayed * 10000000L / ASAP.SampleRate, SampleAttributes); - ReportGetSampleCompleted(mss); - } - - protected override void SeekAsync(long seekToTime) - { - this.Asap.Seek((int) (seekToTime / 10000)); - ReportSeekCompleted(seekToTime); - } - - protected override void CloseMedia() - { - } - - protected override void SwitchMediaStreamAsync(MediaStreamDescription mediaStreamDescription) - { - throw new NotImplementedException(); - } - - protected override void GetDiagnosticAsync(MediaStreamSourceDiagnosticKind diagnosticKind) - { - throw new NotImplementedException(); - } - -} - -public class SilverASAP : Application -{ - readonly MediaElement MediaElement = new MediaElement(); - string Filename; - int Song = -1; - WebClient WebClient = null; - ASAPInfo Info; - - public SilverASAP() - { - this.Startup += this.Application_Startup; - } - - void CallJS(string paramName) - { - string js; - if (this.Host.InitParams.TryGetValue(paramName, out js)) - HtmlPage.Window.Eval(js); - } - - void MediaElement_MediaEnded(object sender, RoutedEventArgs e) - { - CallJS("onPlaybackEnd"); - } - - void WebClient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) - { - this.WebClient = null; - if (e.Cancelled || e.Error != null) - return; - byte[] module = new byte[e.Result.Length]; - int moduleLen = e.Result.Read(module, 0, module.Length); - - ASAP asap = new ASAP(); - asap.Load(this.Filename, module, moduleLen); - this.Info = asap.GetInfo(); - if (this.Song < 0) - this.Song = this.Info.GetDefaultSong(); - int duration = this.Info.GetLoop(this.Song) ? -1 : this.Info.GetDuration(this.Song); - asap.PlaySong(this.Song, duration); - - Stop(); - CallJS("onLoad"); - this.MediaElement.SetSource(new ASAPMediaStreamSource(asap, duration)); - } - - [ScriptableMember] - public void Play(string filename, int song) - { - this.Filename = filename; - this.Song = song; - this.WebClient = new WebClient(); - this.WebClient.OpenReadCompleted += WebClient_OpenReadCompleted; - this.WebClient.OpenReadAsync(new Uri(filename, UriKind.Relative)); - } - - [ScriptableMember] - public void Play(string filename) - { - Play(filename, -1); - } - - [ScriptableMember] - public bool Pause() - { - if (this.MediaElement.CurrentState == MediaElementState.Playing) { - this.MediaElement.Pause(); - return true; - } - else { - this.MediaElement.Play(); - return false; - } - } - - [ScriptableMember] - public void Stop() - { - if (this.WebClient != null) - this.WebClient.CancelAsync(); - this.MediaElement.Stop(); - // in Opera Stop() doesn't work when MediaElement is in the Opening state: - this.MediaElement.Source = null; - } - - [ScriptableMember] - public string Author - { - get - { - return this.Info.GetAuthor(); - } - } - - [ScriptableMember] - public string Title - { - get - { - return this.Info.GetTitle(); - } - } - - [ScriptableMember] - public string Date - { - get - { - return this.Info.GetDate(); - } - } - - void Application_Startup(object sender, StartupEventArgs e) - { - this.RootVisual = this.MediaElement; - this.MediaElement.Volume = 1; - this.MediaElement.AutoPlay = true; - this.MediaElement.MediaEnded += MediaElement_MediaEnded; - HtmlPage.RegisterScriptableObject("ASAP", this); - string filename; - if (e.InitParams.TryGetValue("file", out filename)) { - string s; - int song = -1; - if (e.InitParams.TryGetValue("song", out s)) - song = int.Parse(s, CultureInfo.InvariantCulture); - Play(filename, song); - } - } -} diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/csharp/winrt/AppxManifest.xml kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/csharp/winrt/AppxManifest.xml --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/csharp/winrt/AppxManifest.xml 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/csharp/winrt/AppxManifest.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,54 +0,0 @@ - - - - ASAP - foxoft.com.pl - Logo.png - ASAP plays Atari 8-bit chiptunes - - - 6.2 - 6.2 - - - - - - - - - - - - - - - - - - - - FileLogo.png - - .sap - .cmc - .cm3 - .cmr - .cms - .dmc - .dlt - .mpt - .mpd - .rmt - .tmc - .tm8 - .tm2 - .fc - - - - - - - diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/csharp/winrt/logo.svg kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/csharp/winrt/logo.svg --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/csharp/winrt/logo.svg 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/csharp/winrt/logo.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ - - - - MetroASAP Logo - - diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/csharp/winrt/MetroASAP.cs kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/csharp/winrt/MetroASAP.cs --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/csharp/winrt/MetroASAP.cs 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/csharp/winrt/MetroASAP.cs 1970-01-01 00:00:00.000000000 +0000 @@ -1,305 +0,0 @@ -/* - * MetroASAP.cs - Windows 8 Metro Interface version of ASAP - * - * Copyright (C) 2012 Piotr Fusik - * - * This file is part of ASAP (Another Slight Atari Player), - * see http://asap.sourceforge.net - * - * ASAP is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. - * - * ASAP is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ASAP; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -using System; -using System.Runtime.InteropServices.WindowsRuntime; -using System.Threading; -using System.Threading.Tasks; -using Windows.ApplicationModel.Activation; -using Windows.Foundation; -using Windows.Media; -using Windows.Storage; -using Windows.Storage.Pickers; -using Windows.Storage.Streams; -using Windows.UI; -using Windows.UI.Core; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Media; - -using Sf.Asap; - -class ASAPRandomAccessStream : IRandomAccessStream -{ - readonly ASAP asap; - readonly byte[] wavHeader = new byte[44]; - readonly ulong size; - ulong position; - const int BufferSize = 8192; // must be power of two - readonly byte[] samples = new byte[BufferSize]; - bool needSeek = false; - - public ASAPRandomAccessStream(ASAP asap, int duration) - { - this.asap = asap; - asap.GetWavHeader(this.wavHeader, ASAPSampleFormat.S16LE, false); - this.size = 8 + BitConverter.ToUInt32(wavHeader, 4); - this.position = 0; - } - - uint Read(IBuffer buffer, uint offset, uint count) - { - if (this.needSeek) { - if (this.position < 44) - asap.Seek(0); - else { - ulong bytes = this.position - 44 & ~(BufferSize - 1UL); - asap.SeekSample((int) (bytes / wavHeader[32])); - } - this.needSeek = false; - } - - ulong left = this.size - this.position; - if (count > left) - count = (uint) left; - if (this.position < 44UL) { - uint n = Math.Min(44 - (uint) this.position, count); - this.wavHeader.CopyTo((int) this.position, buffer, offset, (int) n); - this.position += n; - offset += n; - count -= n; - } - while (count > 0) { - int i = (int) this.position - 44 & BufferSize - 1; - if (i == 0) - asap.Generate(this.samples, BufferSize, ASAPSampleFormat.S16LE); - uint n = Math.Min((uint) BufferSize - (uint) i, count); - this.samples.CopyTo(i, buffer, offset, (int) n); - this.position += n; - offset += n; - count -= n; - } - return offset; - } - - IAsyncOperationWithProgress IInputStream.ReadAsync(IBuffer buffer, uint count, InputStreamOptions options) - { -#if true - return AsyncInfo.Run(async delegate (CancellationToken cancel, IProgress progress) { - cancel.ThrowIfCancellationRequested(); - buffer.Length = Read(buffer, buffer.Length, count); - progress.Report(buffer.Length); - return buffer; - }); -#else - return AsyncInfo.Run((CancellationToken cancel, IProgress progress) => { - var task = new Task(() => { - cancel.ThrowIfCancellationRequested(); - buffer.Length = Read(buffer, buffer.Length, count); - progress.Report(buffer.Length); - return buffer; - }, cancel); - task.Start(); - return task; - }); -#endif - } - - void IRandomAccessStream.Seek(ulong position) - { - if (position != this.position) { - this.position = position; - this.needSeek = true; - } - } - - bool IRandomAccessStream.CanRead - { - get - { - return true; - } - } - - bool IRandomAccessStream.CanWrite - { - get - { - return false; - } - } - - ulong IRandomAccessStream.Position - { - get - { - return this.position; - } - } - - ulong IRandomAccessStream.Size - { - get - { - return this.size; - } - set - { - throw new NotSupportedException(); - } - } - - IRandomAccessStream IRandomAccessStream.CloneStream() - { - throw new NotImplementedException(); - } - - IInputStream IRandomAccessStream.GetInputStreamAt(ulong position) - { - throw new NotImplementedException(); - } - - IOutputStream IRandomAccessStream.GetOutputStreamAt(ulong position) - { - throw new NotSupportedException(); - } - - IAsyncOperationWithProgress IOutputStream.WriteAsync(IBuffer buffer) - { - throw new NotSupportedException(); - } - - IAsyncOperation IOutputStream.FlushAsync() - { - throw new NotSupportedException(); - } - - public void Dispose() - { - } -} - -class MetroASAP : Application -{ - MediaElement MyMedia; - - static IAsyncOperation PickFile() - { - FileOpenPicker fop = new FileOpenPicker { - FileTypeFilter = { ".sap", ".cmc", ".cm3", ".cmr", ".cms", ".dmc", ".dlt", ".mpt", ".mpd", ".rmt", ".tmc", ".tm8", ".tm2", ".fc" }, - SuggestedStartLocation = PickerLocationId.ComputerFolder // Downloads, Desktop, MusicLibrary? - }; - return fop.PickSingleFileAsync(); - } - - async Task PlayFile(StorageFile sf) - { - if (sf == null) { - Exit(); - return; - } - byte[] module = new byte[ASAPInfo.MaxModuleLength]; - int moduleLen; - using (IInputStream iis = await sf.OpenSequentialReadAsync()) { - IBuffer buf = await iis.ReadAsync(module.AsBuffer(), (uint) ASAPInfo.MaxModuleLength, InputStreamOptions.None); - moduleLen = (int) buf.Length; - } - - ASAP asap = new ASAP(); - asap.Load(sf.Name, module, moduleLen); - ASAPInfo info = asap.GetInfo(); - int song = info.GetDefaultSong(); - int duration = info.GetLoop(song) ? -1 : info.GetDuration(song); - asap.PlaySong(song, duration); - - this.MyMedia = new MediaElement { - AudioCategory = AudioCategory.BackgroundCapableMedia, - Volume = 1, - AutoPlay = true - }; - Window.Current.Content = this.MyMedia; - await Task.Yield(); - this.MyMedia.SetSource(new ASAPRandomAccessStream(asap, duration), "audio/x-wav"); - - MediaControl.TrackName = info.GetTitleOrFilename(); - MediaControl.ArtistName = info.GetAuthor(); - MediaControl.PlayPressed += MediaControl_PlayPressed; - MediaControl.PausePressed += MediaControl_PausePressed; - MediaControl.PlayPauseTogglePressed += MediaControl_PlayPauseTogglePressed; - MediaControl.StopPressed += MediaControl_StopPressed; - MediaControl.IsPlaying = true; - } - - static void DispatchMediaControl(Func func) - { - Window.Current.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { - MediaControl.IsPlaying = func(); - }); - } - - void MediaControl_PlayPressed(object sender, object e) - { - DispatchMediaControl(() => { - this.MyMedia.Play(); - return true; - }); - } - - void MediaControl_PausePressed(object sender, object e) - { - DispatchMediaControl(() => { - this.MyMedia.Pause(); - return false; - }); - } - - void MediaControl_PlayPauseTogglePressed(object sender, object e) - { - DispatchMediaControl(() => { - if (this.MyMedia.CurrentState == MediaElementState.Paused) { - this.MyMedia.Play(); - return true; - } - else { - this.MyMedia.Pause(); - return false; - } - }); - } - - void MediaControl_StopPressed(object sender, object e) - { - DispatchMediaControl(() => { - this.MyMedia.Stop(); - return false; - }); - } - - protected override async void OnLaunched(LaunchActivatedEventArgs args) - { - Window.Current.Activate(); - StorageFile sf = await PickFile(); - await PlayFile(sf); - } - - protected override async void OnFileActivated(FileActivatedEventArgs args) - { - StorageFile sf = args.Files[0] as StorageFile; - await PlayFile(sf); - } - - public static void Main(string[] args) - { - Application.Start(p => new MetroASAP()); - } -} diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/csharp/winrt/winrt.mk kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/csharp/winrt/winrt.mk --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/csharp/winrt/winrt.mk 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/csharp/winrt/winrt.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -CSC45 = $(DO)"C:/Windows/Microsoft.NET/Framework/v4.0.30319/csc.exe" -nologo -o+ -out:$@ -t:appcontainerexe $(subst /,\\,$^) -WIN8_SDK = "C:/Program Files (x86)/Windows Kits/8.0" -MAKEAPPX = $(DO)$(WIN8_SDK)/bin/x86/makeappx.exe -NET45_RA = "C:/Program Files (x86)/Reference Assemblies/Microsoft/Framework/.NETCore/v4.5" -CONVERT = $(DO)convert - -# no user-configurable paths below this line - -ifndef DO -$(error Use "Makefile" instead of "winrt.mk") -endif - -csharp/winrt/MetroASAP.appx: csharp/winrt/obj/MetroASAP.exe csharp/winrt/obj/AppxManifest.xml csharp/winrt/obj/Logo.png csharp/winrt/obj/SmallLogo.png csharp/winrt/obj/SplashScreen.png csharp/winrt/obj/FileLogo.png - $(MAKEAPPX) pack -d csharp/winrt/obj -o -p $@ -CLEAN += csharp/winrt/MetroASAP.appx - -csharp/winrt/obj/MetroASAP.exe: $(srcdir)csharp/winrt/MetroASAP.cs csharp/asap.cs - $(CSC45) -nostdlib -noconfig -r:$(WIN8_SDK)/References/CommonConfiguration/Neutral/Windows.winmd \ - -r:$(NET45_RA)/mscorlib.dll -r:$(NET45_RA)/System.Diagnostics.Debug.dll -r:$(NET45_RA)/System.Runtime.dll \ - -r:$(NET45_RA)/System.Runtime.Extensions.dll -r:$(NET45_RA)/System.Runtime.InteropServices.WindowsRuntime.dll \ - -r:$(NET45_RA)/System.Runtime.WindowsRuntime.dll -r:$(NET45_RA)/System.Text.Encoding.dll -r:$(NET45_RA)/System.Threading.Tasks.dll -CLEANDIR += csharp/winrt/obj - -csharp/winrt/obj/AppxManifest.xml: $(srcdir)csharp/winrt/AppxManifest.xml - $(COPY) - -csharp/winrt/obj/Logo.png: $(srcdir)csharp/winrt/logo.svg - $(CONVERT) -background none -density 600 $< -gravity Center -resize "75x75!" -extent 150x150 -quality 95 $@ - -csharp/winrt/obj/SmallLogo.png: $(srcdir)csharp/winrt/logo.svg - $(CONVERT) -background none -density 600 $< -gravity Center -resize "28x28!" -extent 30x30 -quality 95 $@ - -csharp/winrt/obj/SplashScreen.png: $(srcdir)csharp/winrt/logo.svg - $(CONVERT) -background none -density 600 $< -gravity Center -resize "280x280!" -extent 620x300 -quality 95 $@ - -csharp/winrt/obj/FileLogo.png: $(srcdir)csharp/winrt/logo.svg - $(CONVERT) -background "#c02020" -density 600 $< -gravity Center -resize "36x36!" -extent 48x48 -quality 95 $@ diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/d/alsa/pcm.d kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/d/alsa/pcm.d --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/d/alsa/pcm.d 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/d/alsa/pcm.d 1970-01-01 00:00:00.000000000 +0000 @@ -1,131 +0,0 @@ -/* - * pcm.d - minimum ALSA PCM interface for D port of ASAP - * - * Copyright (C) 2011 Adrian Matoga - * - * This file is part of ASAP (Another Slight Atari Player), - * see http://asap.sourceforge.net - * - * ASAP is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. - * - * ASAP is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ASAP; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -module alsa.pcm; - -version (linux) -{ - -pragma (lib, "asound"); - -// Dummy struct, only pointers are used. -struct snd_pcm_t -{ -} - -enum snd_pcm_stream_t -{ - SND_PCM_STREAM_PLAYBACK = 0, - SND_PCM_STREAM_CAPTURE, - SND_PCM_STREAM_LAST = SND_PCM_STREAM_CAPTURE -} - -enum snd_pcm_access_t -{ - SND_PCM_ACCESS_MMAP_INTERLEAVED = 0, - SND_PCM_ACCESS_MMAP_NONINTERLEAVED, - SND_PCM_ACCESS_MMAP_COMPLEX, - SND_PCM_ACCESS_RW_INTERLEAVED, - SND_PCM_ACCESS_RW_NONINTERLEAVED, - SND_PCM_ACCESS_LAST = SND_PCM_ACCESS_RW_NONINTERLEAVED -} - -enum snd_pcm_format_t -{ - SND_PCM_FORMAT_UNKNOWN = -1, - SND_PCM_FORMAT_S8 = 0, - SND_PCM_FORMAT_U8, - SND_PCM_FORMAT_S16_LE, - SND_PCM_FORMAT_S16_BE, - SND_PCM_FORMAT_U16_LE, - SND_PCM_FORMAT_U16_BE, - SND_PCM_FORMAT_S24_LE, - SND_PCM_FORMAT_S24_BE, - SND_PCM_FORMAT_U24_LE, - SND_PCM_FORMAT_U24_BE, - SND_PCM_FORMAT_S32_LE, - SND_PCM_FORMAT_S32_BE, - SND_PCM_FORMAT_U32_LE, - SND_PCM_FORMAT_U32_BE, - SND_PCM_FORMAT_FLOAT_LE, - SND_PCM_FORMAT_FLOAT_BE, - SND_PCM_FORMAT_FLOAT64_LE, - SND_PCM_FORMAT_FLOAT64_BE, - SND_PCM_FORMAT_IEC958_SUBFRAME_LE, - SND_PCM_FORMAT_IEC958_SUBFRAME_BE, - SND_PCM_FORMAT_MU_LAW, - SND_PCM_FORMAT_A_LAW, - SND_PCM_FORMAT_IMA_ADPCM, - SND_PCM_FORMAT_MPEG, - SND_PCM_FORMAT_GSM, - SND_PCM_FORMAT_SPECIAL = 31, - SND_PCM_FORMAT_S24_3LE = 32, - SND_PCM_FORMAT_S24_3BE, - SND_PCM_FORMAT_U24_3LE, - SND_PCM_FORMAT_U24_3BE, - SND_PCM_FORMAT_S20_3LE, - SND_PCM_FORMAT_S20_3BE, - SND_PCM_FORMAT_U20_3LE, - SND_PCM_FORMAT_U20_3BE, - SND_PCM_FORMAT_S18_3LE, - SND_PCM_FORMAT_S18_3BE, - SND_PCM_FORMAT_U18_3LE, - SND_PCM_FORMAT_U18_3BE, - SND_PCM_FORMAT_LAST = SND_PCM_FORMAT_U18_3BE, -} - -version (X86_64) -{ - alias long snd_pcm_sframes_t; - alias ulong snd_pcm_uframes_t; -} -else version (X86) -{ - alias int snd_pcm_sframes_t; - alias uint snd_pcm_uframes_t; -} - -extern (C) -int snd_pcm_open(snd_pcm_t **pcm, const char *name, snd_pcm_stream_t stream, int mode); - -extern (C) -int snd_pcm_set_params( - snd_pcm_t *pcm, - snd_pcm_format_t format, - snd_pcm_access_t access, - uint channels, - uint rate, - int soft_resample, - uint latency); - -extern (C) -snd_pcm_sframes_t snd_pcm_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size); - -extern (C) -int snd_pcm_recover(snd_pcm_t *pcm, int err, int silent); - -extern (C) -int snd_pcm_close(snd_pcm_t *pcm); - -} // version (linux) - diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/d/asap2wav.d kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/d/asap2wav.d --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/d/asap2wav.d 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/d/asap2wav.d 1970-01-01 00:00:00.000000000 +0000 @@ -1,157 +0,0 @@ -/* - * asap2wav.d - converter of ASAP-supported formats to WAV files - * - * Copyright (C) 2011 Adrian Matoga - * - * This file is part of ASAP (Another Slight Atari Player), - * see http://asap.sourceforge.net - * - * ASAP is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. - * - * ASAP is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ASAP; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -import std.stdio; -import std.conv; -import std.file; -import std.string; - -import asap; - -string outputFilename; -bool outputHeader = true; -int song = -1; -ASAPSampleFormat format = ASAPSampleFormat.S16LE; -int duration = -1; -int muteMask = 0; - -void printHelp() -{ - write( - "Usage: asap2wav [OPTIONS] INPUTFILE...\n" ~ - "Each INPUTFILE must be in a supported format:\n" ~ - "SAP, CMC, CM3, CMR, CMS, DMC, DLT, MPT, MPD, RMT, TMC, TM8, TM2 or FC.\n" ~ - "Options:\n" ~ - "-o FILE --output=FILE Set output file name\n" ~ - "-s SONG --song=SONG Select subsong number (zero-based)\n" ~ - "-t TIME --time=TIME Set output length (MM:SS format)\n" ~ - "-b --byte-samples Output 8-bit samples\n" ~ - "-w --word-samples Output 16-bit samples (default)\n" ~ - " --raw Output raw audio (no WAV header)\n" ~ - "-m CHANNELS --mute=CHANNELS Mute POKEY chanels (1-8)\n" ~ - "-h --help Display this information\n" ~ - "-v --version Display version information\n" - ); -} - -void setSong(string s) -{ - song = to!int(s); -} - -void setTime(string s) -{ - duration = ASAPInfo.ParseDuration(s); -} - -void setMuteMask(string s) -{ - int mask = 0; - foreach (dchar c; s) { - if (c >= '1' && c <= '8') - mask |= 1 << (c - '1'); - } - muteMask = mask; -} - -void processFile(string inputFilename) -{ - auto asap = new ASAP; - auto mod = cast(ubyte[]) read(inputFilename, ASAPInfo.MaxModuleLength); - asap.Load(inputFilename, mod, cast(int) mod.length); - ASAPInfo info = asap.GetInfo(); - if (song < 0) - song = info.GetDefaultSong(); - if (duration < 0) { - duration = info.GetDuration(song); - if (duration < 0) - duration = 180 * 1000; - } - asap.PlaySong(song, duration); - asap.MutePokeyChannels(muteMask); - if (!outputFilename.length) { - auto i = inputFilename.lastIndexOf('.'); - outputFilename = inputFilename[0 .. i + 1] ~ (outputHeader ? "wav" : "raw"); - } - auto s = File(outputFilename, "wb"); - auto buffer = new ubyte[8192]; - if (outputHeader) { - int len = asap.GetWavHeader(buffer, format, false); - s.rawWrite(buffer[0 .. len]); - } - while ((buffer.length = asap.Generate(buffer, cast(int) buffer.length, format)) > 0) - s.rawWrite(buffer); - s.close(); - outputFilename = null; - song = -1; - duration = -1; -} - -int main(string[] args) -{ - bool noInputFiles = true; - for (int i = 1; i < args.length; i++) { - string arg = args[i]; - if (arg[0] != '-') { - processFile(arg); - noInputFiles = false; - } - else if (arg == "-o") - outputFilename = args[++i]; - else if (arg.startsWith("--output=")) - outputFilename = arg[9 .. $]; - else if (arg == "-s") - setSong(args[++i]); - else if (arg.startsWith("--song=")) - setSong(arg[7 .. $]); - else if (arg == "-t") - setTime(args[++i]); - else if (arg.startsWith("--time=")) - setTime(arg[7 .. $]); - else if (arg == "-b" || arg == "--byte-samples") - format = ASAPSampleFormat.U8; - else if (arg == "-w" || arg == "--word-samples") - format = ASAPSampleFormat.S16LE; - else if (arg == "--raw") - outputHeader = false; - else if (arg == "-m") - setMuteMask(args[++i]); - else if (arg.startsWith("--mute=")) - setMuteMask(arg[7 .. $]); - else if (arg == "-h" || arg == "--help") { - printHelp(); - noInputFiles = false; - } - else if (arg == "-v" || arg == "--version") { - writeln("ASAP2WAV (D) ", ASAPInfo.Version); - noInputFiles = false; - } - else - throw new Exception("unknown option: " ~ arg); - } - if (noInputFiles) { - printHelp(); - return 1; - } - return 0; -} diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/d/asapplay.d kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/d/asapplay.d --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/d/asapplay.d 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/d/asapplay.d 1970-01-01 00:00:00.000000000 +0000 @@ -1,122 +0,0 @@ -/* - * asapplay.d - D ASAP player - * - * Copyright (C) 2011 Adrian Matoga - * - * This file is part of ASAP (Another Slight Atari Player), - * see http://asap.sourceforge.net - * - * ASAP is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. - * - * ASAP is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ASAP; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -import std.math; -import std.stdio; -import std.file; -import std.conv; -import std.string; - -import waveout; -import asap; - -int song = -1; -int duration = -1; -bool showInfo; - -void processFile(string filename) -{ - auto asap = new ASAP; - auto mod = cast(ubyte[]) read(filename, ASAPInfo.MaxModuleLength); - asap.Load(filename, mod, cast(int) mod.length); - ASAPInfo info = asap.GetInfo(); - if (song < 0) - song = info.GetDefaultSong(); - if (duration < 0) { - duration = info.GetDuration(song); - if (duration < 0) - duration = 180 * 1000; - } - asap.PlaySong(song, duration); - auto wo = new WaveOut(cast(ushort) info.Channels, 44100, 16); - scope(exit) wo.close(); - ubyte[] buffer = new ubyte[8192]; - if (showInfo) - writefln("%s - %s (%d:%02d)", info.GetAuthor(), info.GetTitle(), duration / 60000, duration / 1000 % 60); - while ((buffer.length = asap.Generate(buffer, cast(int) buffer.length, ASAPSampleFormat.S16LE)) > 0) - wo.write(buffer); - song = -1; - duration = -1; -} - -void printHelp() -{ - write( - "Usage: asapplay [OPTIONS] INPUTFILE...\n" ~ - "Each INPUTFILE must be in a supported format:\n" ~ - "SAP, CMC, CM3, CMR, CMS, DMC, DLT, MPT, MPD, RMT, TMC, TM8, TM2 or FC.\n" ~ - "Options:\n" ~ - "-s SONG --song=SONG Select subsong number (zero-based)\n" ~ - "-t TIME --time=TIME Set output length (MM:SS format)\n" ~ - "-i --show-info Show song info\n" ~ - "-h --help Display this information\n" ~ - "-v --version Display version information\n" - ); -} - -void setSong(string s) -{ - song = to!int(s); -} - -void setTime(string s) -{ - duration = ASAPInfo.ParseDuration(s); -} - -int main(string[] args) -{ - bool noInputFiles = true; - for (size_t i = 1; i < args.length; ++i) { - auto arg = args[i]; - if (arg[0] != '-') { - processFile(arg); - noInputFiles = false; - } - else if (arg == "-i" || arg == "--show-info") - showInfo = true; - else if (arg == "-s") - setSong(args[++i]); - else if (arg.startsWith("--song=")) - setSong(arg[7 .. $]); - else if (arg == "-t") - setTime(args[++i]); - else if (arg.startsWith("--time=")) - setTime(arg[7 .. $]); - else if (arg == "-h" || arg == "--help") { - printHelp(); - noInputFiles = false; - } - else if (arg == "-v" || arg == "--version") { - writeln("asapplay (D) ", ASAPInfo.Version); - noInputFiles = false; - } - else - throw new Exception("unknown option: ", arg); - } - if (noInputFiles) { - printHelp(); - return 1; - } - return 0; -} diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/d/d.mk kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/d/d.mk --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/d/d.mk 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/d/d.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -DC = $(DO)dmd -release -inline -O $(if $(WINDIR),-of$(subst /,\\,$@) $(subst /,\\,$^),-of$@ $^) - -# no user-configurable paths below this line - -ifndef DO -$(error Use "Makefile" instead of "d.mk") -endif - -d: d/asap2wav.exe d/asapplay.exe -.PHONY: d - -d/asap2wav.exe: $(srcdir)d/asap2wav.d d/asap.d - $(DC) -CLEAN += d/asap2wav.exe d/asap2wav.obj asap2wav.map - -d/asapplay.exe: $(call src,d/asapplay.d d/waveout.d d/alsa/pcm.d) d/asap.d - $(DC) -CLEAN += d/asapplay.exe d/asapplay.obj asapplay.map - -d/asap.d: $(call src,asap.ci asap6502.ci asapinfo.ci cpu6502.ci pokey.ci) $(ASM6502_PLAYERS_OBX) - $(CITO) -CLEAN += d/asap.d diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/d/waveout.d kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/d/waveout.d --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/d/waveout.d 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/d/waveout.d 1970-01-01 00:00:00.000000000 +0000 @@ -1,201 +0,0 @@ -/* - * waveout.d - convenience wrapper for Windows waveOut API and ALSA - * - * Copyright (C) 2011 Adrian Matoga - * - * This file is part of ASAP (Another Slight Atari Player), - * see http://asap.sourceforge.net - * - * ASAP is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. - * - * ASAP is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ASAP; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -import std.stdio; -import std.exception; -import std.algorithm; -import std.conv; -import std.string; - -version (Windows) -{ - -import win32.windef: UINT, DWORD, DWORD_PTR, NULL; -import win32.winbase: GetCurrentThreadId, INVALID_HANDLE_VALUE; -import win32.winuser: PostThreadMessage, GetMessage, PeekMessage, MSG, WM_USER, PM_REMOVE; -import win32.mmsystem; - -pragma (lib, "winmm"); - -enum IDM_WOM_DONE = WM_USER; - -class WaveOutException : Exception -{ - this(string msg) - { - super(msg); - } -} - -extern (Windows) -private void waveOutProc(HWAVEOUT hwo, UINT uMsg, DWORD_PTR dwInstance, DWORD dwParam1, DWORD dwParam2) -{ - WaveOut wo = *(cast(WaveOut*) dwInstance); - if (uMsg == WOM_DONE) - PostThreadMessage(wo.threadId, IDM_WOM_DONE, 0, 0); -} - -class WaveOut -{ - this(ushort channels, uint samplesPerSec, ushort bitsPerSample, size_t bufferSize = 16384) - { - thisObj = this; - threadId = GetCurrentThreadId(); - enum bufferCount = 2; - buffers = new char[][bufferCount]; - foreach (i; 0 .. bufferCount) { - buffers[i] = new char[bufferSize]; - headers ~= WAVEHDR(buffers[i].ptr, buffers[i].length, 0, 0, 0, 0, NULL, 0); - } - WAVEFORMATEX wfx; - wfx.wFormatTag = WAVE_FORMAT_PCM; - wfx.nChannels = channels; - wfx.nSamplesPerSec = samplesPerSec; - wfx.nBlockAlign = cast(ushort) (channels * bitsPerSample / 8); - wfx.nAvgBytesPerSec = samplesPerSec * wfx.nBlockAlign; - wfx.wBitsPerSample = bitsPerSample; - wfx.cbSize = 0; - if (waveOutOpen(&hwo, WAVE_MAPPER, &wfx, cast(DWORD_PTR) &waveOutProc, cast(DWORD_PTR) &thisObj, CALLBACK_FUNCTION) != MMSYSERR_NOERROR) - throw new WaveOutException("waveOutOpen failed"); - scope (failure) { - waveOutClose(hwo); - foreach (i; 0 .. bufferCount) - if (headers[i].dwFlags & WHDR_PREPARED) - waveOutUnprepareHeader(hwo, &headers[i], headers[i].sizeof); - } - foreach (i; 0 .. bufferCount) - if (waveOutPrepareHeader(hwo, &headers[i], headers[i].sizeof) != MMSYSERR_NOERROR) - throw new WaveOutException("waveOutPrepareHeader failed"); - } - - ~this() - { - close(); - } - - void close() - { - if (hwo == INVALID_HANDLE_VALUE) - return; - waveOutReset(hwo); - foreach (ref hdr; headers) { - if (hdr.dwFlags & WHDR_PREPARED) - waveOutUnprepareHeader(hwo, &hdr, hdr.sizeof); - } - waveOutClose(hwo); - hwo = INVALID_HANDLE_VALUE; - MSG msg; - while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {} - } - - void write(const(ubyte)[] buf) - { - while (buf.length) { - if (usedBuffers == buffers.length) { - MSG msg; - if (GetMessage(&msg, NULL, 0, 0) <= 0 || msg.message != IDM_WOM_DONE) - throw new WaveOutException("GetMessage failed"); - --usedBuffers; - } - size_t toEnd = buffers[currentBuffer].length - offset; - size_t toWrite = min(buf.length, toEnd); - buffers[currentBuffer][offset .. offset + toWrite] = cast(const(char[])) buf[0 .. toWrite]; - buf = buf[toWrite .. $]; - if ((offset += toWrite) >= buffers[currentBuffer].length) { - if (waveOutWrite(hwo, &headers[currentBuffer], headers[currentBuffer].sizeof) != MMSYSERR_NOERROR) - throw new WaveOutException("waveOutWrite failed"); - offset = 0; - ++usedBuffers; - if (++currentBuffer >= buffers.length) - currentBuffer = 0; - } - } - } - -private: - WaveOut thisObj; - DWORD threadId; - - HWAVEOUT hwo = INVALID_HANDLE_VALUE; - - WAVEHDR[] headers; - char[][] buffers; - - size_t currentBuffer; - size_t offset; - size_t usedBuffers; -} - -} // version (Windows) - -version (linux) -{ - -import alsa.pcm; - -class WaveOut -{ - this(ushort channels, uint samplesPerSec, ushort bitsPerSample, size_t bufferSize = 16384) - { - int err; - if ((err = snd_pcm_open(&hpcm, "default".toStringz(), snd_pcm_stream_t.SND_PCM_STREAM_PLAYBACK, 0)) < 0) - throw new Exception("Cannot open default audio device"); - if ((err = snd_pcm_set_params( - hpcm, bitsPerSample == 8 ? snd_pcm_format_t.SND_PCM_FORMAT_U8 : snd_pcm_format_t.SND_PCM_FORMAT_S16_LE, - snd_pcm_access_t.SND_PCM_ACCESS_RW_INTERLEAVED, - channels, samplesPerSec, 1, 50000)) < 0) { - close(); - throw new Exception("Cannot set audio device params"); - } - bytesPerSample = bitsPerSample / 8 * channels; - } - - ~this() - { - close(); - } - - void close() - { - if (hpcm is null) - return; - snd_pcm_close(hpcm); - hpcm = null; - } - - void write(const(ubyte)[] buf) - { - snd_pcm_sframes_t frames = snd_pcm_writei(hpcm, buf.ptr, buf.length / bytesPerSample); - if (frames < 0) { - frames = snd_pcm_recover(hpcm, cast(int) frames, 0); - if (frames < 0) - throw new Exception("snd_pcm_writei failed"); - } - } - -private: - snd_pcm_t* hpcm; - int bytesPerSample; -} - -} // version (linux) diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/debian/asap-dev.install kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/debian/asap-dev.install --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/debian/asap-dev.install 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/debian/asap-dev.install 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -usr/include/asap.h -usr/lib/libasap.a diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/debian/asap-gstreamer0.10.install kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/debian/asap-gstreamer0.10.install --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/debian/asap-gstreamer0.10.install 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/debian/asap-gstreamer0.10.install 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -usr/lib/*/gstreamer-0.10/libgstasapdec.so diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/debian/asap.install kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/debian/asap.install --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/debian/asap.install 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/debian/asap.install 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -usr/bin/asapconv diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/debian/asap-vlc.install kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/debian/asap-vlc.install --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/debian/asap-vlc.install 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/debian/asap-vlc.install 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -usr/lib/vlc/plugins/demux/libasap_plugin.so diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/debian/changelog kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/debian/changelog --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/debian/changelog 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/debian/changelog 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -asap (3.1.5-1) UNRELEASED; urgency=low - - * First deb packaging. - - -- Piotr Fusik Fri, 16 Aug 2013 15:08:15 +0200 diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/debian/compat kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/debian/compat --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/debian/compat 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/debian/compat 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -9 diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/debian/control kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/debian/control --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/debian/control 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/debian/control 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -Source: asap -Maintainer: Piotr Fusik -Section: contrib/sound -Priority: optional -Standards-Version: 3.9.3 -Build-Depends: debhelper (>= 7), libgstreamer0.10-dev, libvlccore-dev - -Package: asap -Architecture: any -Depends: ${shlibs:Depends} -Description: Provides "asapconv" command-line converter of Atari 8-bit music - to WAV files. Supports the following file formats: - SAP, CMC, CM3, CMR, CMS, DMC, DLT, MPT, MPD, RMT, TMC, TM8, TM2, FC. - -Package: asap-dev -Architecture: any -Description: Development library providing Atari 8-bit music emulation. - -Package: asap-gstreamer0.10 -Architecture: any -Depends: libgstreamer0.10-0 (>= 0.10.36), ${shlibs:Depends} -Description: Provides playback of Atari 8-bit music in the SAP format - in GStreamer-based players. - -Package: asap-vlc -Architecture: any -Depends: vlc, ${shlibs:Depends} -Description: Provides playback of Atari 8-bit music in VLC. - Supports the following file formats: SAP, RMT, FC. diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/debian/copyright kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/debian/copyright --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/debian/copyright 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/debian/copyright 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Name: asap -Source: http://asap.sourceforge.net - -Files: * -Copyright: 2005-2013 Piotr Fusik -License: GPL-2+ diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/debian/rules kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/debian/rules --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/debian/rules 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/debian/rules 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -#!/usr/bin/make -f -%: - dh $@ - -# skip "make clean" to avoid dependency on xasm, mads and cito -override_dh_auto_clean: - -override_dh_auto_build: - $(MAKE) asapconv lib asap-gstreamer asap-vlc - -# skip "make check" to avoid dependency on Acid800 -override_dh_auto_test: - -override_dh_auto_install: - $(MAKE) DESTDIR=$$(pwd)/debian/tmp prefix=/usr install install-gstreamer install-vlc diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/flash/ASAPPlayer.as kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/flash/ASAPPlayer.as --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/flash/ASAPPlayer.as 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/flash/ASAPPlayer.as 1970-01-01 00:00:00.000000000 +0000 @@ -1,142 +0,0 @@ -/* - * ASAPPlayer.as - ASAP Flash player - * - * Copyright (C) 2009-2012 Piotr Fusik - * - * This file is part of ASAP (Another Slight Atari Player), - * see http://asap.sourceforge.net - * - * ASAP is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. - * - * ASAP is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ASAP; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package -{ - import flash.display.Sprite; - import flash.events.Event; - import flash.events.SampleDataEvent; - import flash.external.ExternalInterface; - import flash.media.Sound; - import flash.media.SoundChannel; - import flash.net.URLLoader; - import flash.net.URLLoaderDataFormat; - import flash.net.URLRequest; - import flash.utils.ByteArray; - import net.sf.asap.ASAP; - import net.sf.asap.ASAPInfo; - - public class ASAPPlayer extends Sprite - { - private var filename : String; - private var song : int; - private var asap : ASAP = new ASAP(); - private var soundChannel : SoundChannel = null; - - private function callJS(paramName : String) : void - { - var js : String = this.loaderInfo.parameters[paramName]; - if (js != null) - ExternalInterface.call(js); - } - - private function startPlayback() : void - { - var sound : Sound = new Sound(); - function generator(event : SampleDataEvent) : void - { - asap.generate(event.data, 8192, 0); - } - sound.addEventListener(SampleDataEvent.SAMPLE_DATA, generator); - this.soundChannel = sound.play(); - function soundCompleteHandler(event : Event) : void - { - callJS("onPlaybackEnd"); - } - this.soundChannel.addEventListener(Event.SOUND_COMPLETE, soundCompleteHandler); - } - - private function loadCompleteHandler(event : Event) : void - { - var module : ByteArray = URLLoader(event.target).data; - stop(); - this.asap.load(this.filename, module, module.length); - var info : ASAPInfo = this.asap.getInfo(); - var song : int = this.song; - if (song < 0) - song = info.getDefaultSong(); - var duration : int = info.getLoop(song) ? -1 : info.getDuration(song); - this.asap.playSong(song, duration); - callJS("onLoad"); - startPlayback(); - } - - public function play(filename : String, song : int = -1) : void - { - this.filename = filename; - this.song = song; - var loader : URLLoader = new URLLoader(); - loader.dataFormat = URLLoaderDataFormat.BINARY; - loader.addEventListener(Event.COMPLETE, loadCompleteHandler); - loader.load(new URLRequest(filename)); - } - - public function pause() : Boolean - { - if (this.soundChannel != null) { - stop(); - return true; - } - else { - startPlayback(); - return false; - } - } - - public function stop() : void - { - if (this.soundChannel != null) { - this.soundChannel.stop(); - this.soundChannel = null; - } - } - - public function getAuthor() : String - { - return this.asap.getInfo().getAuthor(); - } - - public function getTitle() : String - { - return this.asap.getInfo().getTitle(); - } - - public function getDate() : String - { - return this.asap.getInfo().getDate(); - } - - public function ASAPPlayer() - { - ExternalInterface.addCallback("asapPlay", play); - ExternalInterface.addCallback("asapPause", pause); - ExternalInterface.addCallback("asapStop", stop); - ExternalInterface.addCallback("getAuthor", getAuthor); - ExternalInterface.addCallback("getTitle", getTitle); - ExternalInterface.addCallback("getDate", getDate); - var parameters : Object = this.loaderInfo.parameters; - if (parameters.file != null) - play(parameters.file, parameters.song != null ? parameters.song : -1); - } - } -} diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/flash/flash.mk kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/flash/flash.mk --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/flash/flash.mk 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/flash/flash.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -MXMLC = $(DO)mxmlc -o $@ -compiler.optimize -compiler.warn-duplicate-variable-def=false -static-link-runtime-shared-libraries -target-player 10 $< -# -compiler.debug -compiler.warn-no-type-decl=false -ASDOC = $(DO)asdoc - -# no user-configurable paths below this line - -ifndef DO -$(error Use "Makefile" instead of "flash.mk") -endif - -flash/asap.swf: $(srcdir)flash/ASAPPlayer.as flash/net/sf/asap/ASAP.as $(ASM6502_PLAYERS_OBX) - $(MXMLC) -source-path flash 6502 -CLEAN += flash/asap.swf - -flash/net/sf/asap/ASAP.as: $(call src,asap.ci asap6502.ci asapinfo.ci cpu6502.ci pokey.ci) $(ASM6502_PLAYERS_OBX) - $(CITO) -n net.sf.asap -D FLASH -CLEAN += flash/net/sf/asap/*.as - -debug-flash: - tail -f "${APPDATA}\Macromedia\Flash Player\Logs\flashlog.txt" -.PHONY: debug-flash - -flash/doc: flash/net/sf/asap/ASAP.as - $(ASDOC) -compiler.warn-duplicate-variable-def=false -compiler.warn-const-not-initialized=false -output=$@ -window-title="ASAP ActionScript API" -main-title="ASAP (Another Slight Atari Player) ActionScript API" -doc-sources=$(> 8; - return 3; - default: // case FlashPackItemType.EndOfStream: - buffer[index] = 1; - buffer[index + 1] = 0; - return 2; - } - } -} - -class FlashPack -{ - int[65536] Memory; // TODO: short - int LoadAddress; - int LoadEndAddress; - FlashPackLoadState LoadState; - - FlashPack() - { - for (int i = 0; i < 65536; i++) - Memory[i] = -1; - LoadState = FlashPackLoadState.StartLowByte; - } - - internal void LoadByte(int data) - { - switch (LoadState) { - case FlashPackLoadState.StartLowByte: - LoadAddress = data; - LoadState = FlashPackLoadState.StartHighByte; - break; - case FlashPackLoadState.StartHighByte: - LoadAddress += data << 8; - LoadState = LoadAddress == 0xffff ? FlashPackLoadState.StartLowByte : FlashPackLoadState.EndLowByte; - break; - case FlashPackLoadState.EndLowByte: - LoadEndAddress = data; - LoadState = FlashPackLoadState.EndHighByte; - break; - case FlashPackLoadState.EndHighByte: - LoadEndAddress += data << 8; - LoadState = FlashPackLoadState.Content; - break; - case FlashPackLoadState.Content: - Memory[LoadAddress] = data; - if (LoadAddress == LoadEndAddress) - LoadState = FlashPackLoadState.StartLowByte; - else - LoadAddress = (LoadAddress + 1) & 0xffff; - break; - } - } - - const int MinLoadAddress = 0x2000; // safe for most of Atari DOSes - - int FindHole() - { - const int holeSize = 0x400; // FIXME: just a guess - int end = 0xbc1f; // below the Display List for standard text mode - for (;;) { - while (Memory[end] >= 0) - if (--end < MinLoadAddress + holeSize) - throw "Too much data to compress"; - int start = end; - while (Memory[--start] < 0) - if (end - start >= holeSize - 1) - return end; - end = start; - } - } - - byte[65536] Compressed; - int CompressedLength; - - FlashPackItem()[64] Items; - int ItemsCount; - - int GetInnerFlags(int index) - { - int flags = 1; - do { - flags <<= 1; - if (index < ItemsCount && Items[index++].Type != FlashPackItemType.Literal) - flags++; - } while (flags < 0x100); - return flags & 0xff; - } - - void PutItems() - { - int outerFlags = 0; - for (int i = 0; i < ItemsCount; i += 8) { - if (GetInnerFlags(i) != 0) - outerFlags |= 0x80 >> (i >> 3); - } - Compressed[CompressedLength++] = outerFlags; - for (int i = 0; i < ItemsCount; i++) { - if ((i & 7) == 0) { - int flags = GetInnerFlags(i); - if (flags != 0) - Compressed[CompressedLength++] = flags; - } - CompressedLength += Items[i].WriteValueTo(Compressed, CompressedLength); - } - } - - void PutItem(FlashPackItemType type, int value) - { - if (ItemsCount >= 64) { - PutItems(); - ItemsCount = 0; - } - Items[ItemsCount].Type = type; - Items[ItemsCount].Value = value; - ItemsCount++; - } - - bool IsLiteralPreferred() - { - return (ItemsCount & 7) == 7 && GetInnerFlags(ItemsCount - 7) == 0; - } - - void CompressMemoryArea(int startAddress, int endAddress) - { - int lastDistance = -1; - - for (int address = startAddress; address <= endAddress; ) { - while (Memory[address] < 0) - if (++address > endAddress) - return; - PutItem(FlashPackItemType.SetAddress, address); - - while (address <= endAddress && Memory[address] >= 0) { - int bestMatch = 0; - int bestDistance = -1; - // brute force matching, think about hashtables - for (int backAddress = address - 1; backAddress >= startAddress && address - backAddress < 0x80; backAddress--) { - int match; - for (match = 0; address + match <= endAddress; match++) { - int data = Memory[address + match]; - if (data < 0 || data != Memory[backAddress + match]) - break; - } - if (bestMatch < match) { - bestMatch = match; - bestDistance = address - backAddress; - } - else if (bestMatch == match && address - backAddress == lastDistance) - bestDistance = lastDistance; - } - - switch (bestMatch) { - case 0: - case 1: - PutItem(FlashPackItemType.Literal, Memory[address++]); - continue; - case 2: - PutItem(FlashPackItemType.CopyTwoBytes, bestDistance); - break; - case 3: - PutItem(FlashPackItemType.CopyThreeBytes, bestDistance); - break; - case 4: - if (bestDistance == lastDistance) - PutItem(FlashPackItemType.CopyManyBytes, 4); - else if (IsLiteralPreferred()) { - PutItem(FlashPackItemType.Literal, Memory[address]); - PutItem(FlashPackItemType.CopyThreeBytes, bestDistance); - } - else { - PutItem(FlashPackItemType.CopyThreeBytes, bestDistance); - PutItem(FlashPackItemType.Literal, Memory[address + 3]); - } - break; - case 5: - if (bestDistance == lastDistance) - PutItem(FlashPackItemType.CopyManyBytes, 5); - else { - PutItem(FlashPackItemType.CopyThreeBytes, bestDistance); - PutItem(FlashPackItemType.CopyTwoBytes, bestDistance); - } - break; - case 6: - if (bestDistance == lastDistance) - PutItem(FlashPackItemType.CopyManyBytes, 6); - else { - PutItem(FlashPackItemType.CopyThreeBytes, bestDistance); - PutItem(FlashPackItemType.CopyThreeBytes, bestDistance); - } - break; - default: - int length = bestMatch; - if (bestDistance != lastDistance) { - if (IsLiteralPreferred() && length % 255 == 4) { - PutItem(FlashPackItemType.Literal, Memory[address]); - length--; - } - PutItem(FlashPackItemType.CopyThreeBytes, bestDistance); - length -= 3; - } - else if (IsLiteralPreferred() && length % 255 == 1) { - PutItem(FlashPackItemType.Literal, Memory[address]); - length--; - } - for (; length > 255; length -= 255) - PutItem(FlashPackItemType.CopyManyBytes, 255); - switch (length) { - case 0: - break; - case 1: - PutItem(FlashPackItemType.Literal, Memory[address + bestMatch - 1]); - break; - case 2: - PutItem(FlashPackItemType.CopyTwoBytes, bestDistance); - break; - case 3: - PutItem(FlashPackItemType.CopyThreeBytes, bestDistance); - break; - default: - PutItem(FlashPackItemType.CopyManyBytes, length); - break; - } - break; - } - address += bestMatch; - lastDistance = bestDistance; - } - } - } - - void PutPoke(int address, int value) - { - PutItem(FlashPackItemType.SetAddress, address); - PutItem(FlashPackItemType.Literal, value); - } - - void Compress(ByteWriter w) - { - //assert LoadState == FlashPackLoadState.StartLowByte, "Invalid data to compress"; - //assert Memory[0x2e0] >= 0 && Memory[0x2e1] >= 0, "Missing run address"; - if (Memory[0xfc] >= 0 || Memory[0xfd] >= 0 || Memory[0xfe] >= 0 || Memory[0xff] >= 0) - throw "Conflict with decompressor variables"; - int runAddress = Memory[0x2e0] + (Memory[0x2e1] << 8); - Memory[0x2e0] = Memory[0x2e1] = -1; - - int depackerEndAddress = FindHole(); - CompressedLength = 0; - ItemsCount = 0; - PutPoke(0xd40e, 0); // disable NMI - PutPoke(0xd20e, 0); // disable IRQ - PutPoke(0xd400, 0); // disable screen - PutPoke(0xd301, 0xfe); // disable ROM - PutPoke(0x244, 0xff); // cold start after Reset - CompressMemoryArea(depackerEndAddress, 0xffff); - CompressMemoryArea(0, depackerEndAddress); - PutItem(FlashPackItemType.EndOfStream, 0); - PutItems(); - - int depackerStartAddress = depackerEndAddress - (0x58 - 1); - int compressedStartAddress = depackerStartAddress - CompressedLength; - if (compressedStartAddress < MinLoadAddress) - throw "Too much compressed data"; - w(0xff); - w(0xff); - // turn off the built-in BASIC - ASAPWriter.WriteWord(w, 0xd301); - ASAPWriter.WriteWord(w, 0xd301); - w(0xff); - - ASAPWriter.WriteWord(w, compressedStartAddress); - ASAPWriter.WriteWord(w, depackerEndAddress); - ASAPWriter.WriteBytes(w, Compressed, 0, CompressedLength); - - w(0xad); ASAPWriter.WriteWord(w, compressedStartAddress); // LDA compressed - w(0xee); ASAPWriter.WriteWord(w, depackerStartAddress + 1); // INC getByte+1 - w(0xd0); w(0x03); // SNE - w(0xee); ASAPWriter.WriteWord(w, depackerStartAddress + 2); // INC getByte+2 - w(0x60); // RTS - w(0x4c); ASAPWriter.WriteWord(w, runAddress); // JMP run - w(0x85); w(0xfe); // STA outPtr - w(0x8a); // TXA - w(0x2a); // ROL @ - w(0xaa); // TAX - w(0xf0); w(0xf6); // BEQ exit - w(0xb1); w(0xfe); // LDA (outPtr),Y - w(0x99); w(0x80); w(0x80); // STA $8080,Y - w(0xc8); // INY - w(0xd0); w(0x09); // BNE samePage - w(0x98); // TYA - w(0x38); // SEC - w(0x65); w(0xff); // ADC outPtr+1 - w(0x85); w(0xff); // STA outPtr+1 - w(0x8d); ASAPWriter.WriteWord(w, depackerStartAddress + 0x1a); // STA putByte+2 - w(0xca); // DEX - w(0xd0); w(0xec); // BNE copy - w(0x06); w(0xfd); // ASL innerFlags - w(0xd0); w(0x15); // BNE gotInnerFlags - w(0x06); w(0xfc); // ASL outerFlags - w(0xd0); w(0x07); // BNE gotOuterFlags - w(0x38); // SEC - w(0x20); ASAPWriter.WriteWord(w, depackerStartAddress); // JSR getByte - w(0x2a); // ROL @ - w(0x85); w(0xfc); // STA outerFlags - w(0xa9); w(0x01); // LDA #1 - w(0x90); w(0x04); // BCC setInnerFlags - w(0x20); ASAPWriter.WriteWord(w, depackerStartAddress); // JSR getByte - w(0x2a); // ROL @ - w(0x85); w(0xfd); // STA innerFlags - w(0x20); ASAPWriter.WriteWord(w, depackerStartAddress); // JSR getByte - w(0xa2); w(0x01); // LDX #1 - w(0x90); w(0xce); // BCC putByte - w(0x4a); // LSR @ - w(0xd0); w(0xc2); // BNE copyTwoOrThree - w(0x20); ASAPWriter.WriteWord(w, depackerStartAddress); // JSR getByte - w(0xb0); w(0xc1); // BCS copyMany - w(0xa8); // TAY - w(0x20); ASAPWriter.WriteWord(w, depackerStartAddress); // JSR getByte - w(0x90); w(0xca); // BCC setPage - - ASAPWriter.WriteWord(w, 0x2e0); - ASAPWriter.WriteWord(w, 0x2e1); - ASAPWriter.WriteWord(w, depackerStartAddress + 0x32); - } -} diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/gstreamer/gstasapdec.c kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/gstreamer/gstasapdec.c --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/gstreamer/gstasapdec.c 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/gstreamer/gstasapdec.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,409 +0,0 @@ -/* - * gstasapdec.c - ASAP plugin for GStreamer - * - * Copyright (C) 2011-2013 Piotr Fusik - * - * This file is part of ASAP (Another Slight Atari Player), - * see http://asap.sourceforge.net - * - * ASAP is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. - * - * ASAP is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ASAP; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * SECTION:element-asapdec - * - * This element decodes .sap files to raw audio. - * .sap files are small Atari XL/XE programs that are executed - * on an emulated 6502 and a POKEY sound chip. - * - * - * Example launch line - * |[ - * gst-launch filesrc location=Foo.sap ! asapdec ! audioconvert ! alsasink - * ]| - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include /* memcpy */ -#include - -#include "gstasapdec.h" - -GST_DEBUG_CATEGORY_STATIC (gst_asap_dec_debug); -#define GST_CAT_DEFAULT gst_asap_dec_debug - -enum -{ - PROP_0, - PROP_TUNE -}; - -/* the capabilities of the inputs and outputs. */ -static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("audio/x-sap") - ); - -static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("audio/x-raw-int, " - "endianness = (int) LITTLE_ENDIAN, " - "signed = (boolean) true, " - "width = (int) 16, " - "depth = (int) 16, " - "rate = (int) 44100, " - "channels = (int) [ 1, 2 ]") - ); - -GST_BOILERPLATE (GstAsapDec, gst_asap_dec, GstElement, GST_TYPE_ELEMENT); - -static void -play_loop (GstPad * pad) -{ -#define BUFFER_SIZE 4096 - GstAsapDec *asapdec = GST_ASAPDEC (gst_pad_get_parent (pad)); - GstBuffer *out = gst_buffer_new_and_alloc (BUFFER_SIZE); - int position; - int len; - gint64 time; - gint64 time2; - gst_buffer_set_caps (out, GST_PAD_CAPS (pad)); - - position = ASAP_GetBlocksPlayed (asapdec->asap); - len = ASAP_Generate (asapdec->asap, GST_BUFFER_DATA (out), GST_BUFFER_SIZE (out), ASAPSampleFormat_S16_L_E); - if (len == 0) - goto eos; - time = gst_util_uint64_scale_int (position, GST_SECOND, ASAP_SAMPLE_RATE); - GST_BUFFER_OFFSET (out) = position; - GST_BUFFER_TIMESTAMP (out) = time; - position = ASAP_GetBlocksPlayed (asapdec->asap); - time2 = gst_util_uint64_scale_int (position, GST_SECOND, ASAP_SAMPLE_RATE); - GST_BUFFER_OFFSET_END (out) = position; - GST_BUFFER_DURATION (out) = time2 - time; - - if (gst_pad_push (asapdec->srcpad, out) != GST_FLOW_OK || len < BUFFER_SIZE) { - eos: - gst_pad_push_event (pad, gst_event_new_eos ()); - gst_pad_pause_task (pad); - } - - gst_object_unref (asapdec); -} - -static void -add_tag (GstTagList * tags, const char * tag, const char * value) -{ - if (value[0] != '\0') - gst_tag_list_add (tags, GST_TAG_MERGE_REPLACE, tag, value, (void *) NULL); -} - -static gboolean -start_play_tune (GstAsapDec * asapdec) -{ - const ASAPInfo *info; - int song; - GstTagList *tags; - int i; - GstCaps *caps; - - if (!ASAP_Load (asapdec->asap, NULL, asapdec->module, asapdec->module_len)) { - GST_ELEMENT_ERROR (asapdec, LIBRARY, INIT, ("Could not load tune"), ("Could not load tune")); - return FALSE; - } - - info = ASAP_GetInfo (asapdec->asap); - song = asapdec->tune_number; - if (song > 0) - song--; - else - song = ASAPInfo_GetDefaultSong (info); - - tags = gst_tag_list_new (); - add_tag (tags, GST_TAG_TITLE, ASAPInfo_GetTitle (info)); - add_tag (tags, GST_TAG_ARTIST, ASAPInfo_GetAuthor (info)); - i = ASAPInfo_GetYear (info); - if (i > 0) { - GDate *date = g_date_new (); - g_date_set_year (date, i); - i = ASAPInfo_GetMonth (info); - if (i > 0) { - g_date_set_month (date, i); - i = ASAPInfo_GetDayOfMonth (info); - if (i > 0) - g_date_set_day (date, i); - } - gst_tag_list_add (tags, GST_TAG_MERGE_REPLACE, GST_TAG_DATE, date, (void *) NULL); - } - gst_pad_push_event (asapdec->srcpad, gst_event_new_tag (tags)); - - asapdec->duration = ASAPInfo_GetDuration (info, song); - if (!ASAP_PlaySong (asapdec->asap, song, asapdec->duration)) { - GST_ELEMENT_ERROR (asapdec, LIBRARY, INIT, ("Could not initialize song"), ("Could not initialize song")); - return FALSE; - } - asapdec->playing = TRUE; - - caps = gst_caps_new_simple ("audio/x-raw-int", - "endianness", G_TYPE_INT, G_LITTLE_ENDIAN, - "signed", G_TYPE_BOOLEAN, TRUE, - "width", G_TYPE_INT, 16, - "depth", G_TYPE_INT, 16, - "rate", G_TYPE_INT, ASAP_SAMPLE_RATE, - "channels", G_TYPE_INT, ASAPInfo_GetChannels (info), NULL); - gst_pad_set_caps (asapdec->srcpad, caps); - gst_caps_unref (caps); - gst_pad_push_event (asapdec->srcpad, gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, 0, -1, 0)); - return gst_pad_start_task (asapdec->srcpad, (GstTaskFunction) play_loop, asapdec->srcpad); -} - -static gboolean -gst_asap_sink_event (GstPad * pad, GstEvent * event) -{ - GstAsapDec *asapdec = GST_ASAPDEC (gst_pad_get_parent (pad)); - gboolean res; - - switch (GST_EVENT_TYPE (event)) { - case GST_EVENT_EOS: - res = start_play_tune (asapdec); - break; - default: - res = FALSE; - break; - } - - gst_object_unref (asapdec); - gst_event_unref (event); - return res; -} - -static GstFlowReturn -gst_asap_sink_chain (GstPad * pad, GstBuffer * buffer) -{ - GstAsapDec *asapdec = GST_ASAPDEC (gst_pad_get_parent (pad)); - guint64 size = GST_BUFFER_SIZE (buffer); - - if (asapdec->module_len + size > ASAPInfo_MAX_MODULE_LENGTH) { - GST_ELEMENT_ERROR (asapdec, STREAM, DECODE, (NULL), ("Input file too long")); - gst_object_unref (asapdec); - return GST_FLOW_ERROR; - } - memcpy (asapdec->module + asapdec->module_len, GST_BUFFER_DATA (buffer), size); - asapdec->module_len += size; - - gst_object_unref (asapdec); - gst_buffer_unref (buffer); - return GST_FLOW_OK; -} - -static gboolean -gst_asap_src_query (GstPad * pad, GstQuery * query) -{ - GstAsapDec *asapdec = GST_ASAPDEC (gst_pad_get_parent (pad)); - gboolean res = FALSE; - gint64 time; - - switch (GST_QUERY_TYPE (query)) { - case GST_QUERY_POSITION: - if (asapdec->playing) { - time = gst_util_uint64_scale_int (ASAP_GetBlocksPlayed (asapdec->asap), GST_SECOND, ASAP_SAMPLE_RATE); - gst_query_set_duration (query, GST_FORMAT_TIME, time); - res = TRUE; - } - break; - case GST_QUERY_DURATION: - if (asapdec->playing && asapdec->duration >= 0) { - gst_query_set_duration (query, GST_FORMAT_TIME, asapdec->duration * GST_MSECOND); - res = TRUE; - } - break; - default: - break; - } - - gst_object_unref (asapdec); - return res; -} - -static gboolean -perform_seek (GstAsapDec * asapdec, GstEvent * event) -{ - gdouble rate; - GstFormat format; - GstSeekFlags flags; - GstSeekType start_type; - gint64 start; - GstSeekType stop_type; - gint64 stop; - - if (!asapdec->playing) - return FALSE; - gst_event_parse_seek (event, &rate, &format, &flags, &start_type, &start, &stop_type, &stop); - if (rate != 1.0 || format != GST_FORMAT_TIME || start_type != GST_SEEK_TYPE_SET || stop_type != GST_SEEK_TYPE_NONE) { - GST_DEBUG_OBJECT (asapdec, "unsupported seek, aborted."); - return FALSE; - } - ASAP_Seek (asapdec->asap, (int) (start / GST_MSECOND)); - return TRUE; -} - -static gboolean -gst_asap_src_event (GstPad * pad, GstEvent * event) -{ - GstAsapDec *asapdec = GST_ASAPDEC (gst_pad_get_parent (pad)); - gboolean res; - - switch (GST_EVENT_TYPE (event)) { - case GST_EVENT_SEEK: - res = perform_seek (asapdec, event); - gst_event_unref (event); - return res; - default: - return gst_pad_event_default (pad, event); - } -} - -static void -gst_asap_dec_base_init (gpointer gclass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); - - gst_element_class_set_details_simple (element_class, - "ASAP decoder", - "Codec/Decoder/Audio", - "Decodes Atari 8-bit .sap chiptunes", - "Piotr Fusik "); - - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&src_factory)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sink_factory)); -} - -static void -gst_asap_dec_init (GstAsapDec * asapdec, GstAsapDecClass * gclass) -{ - asapdec->sinkpad = gst_pad_new_from_static_template (&sink_factory, "sink"); - gst_pad_set_event_function (asapdec->sinkpad, GST_DEBUG_FUNCPTR (gst_asap_sink_event)); - gst_pad_set_chain_function (asapdec->sinkpad, GST_DEBUG_FUNCPTR (gst_asap_sink_chain)); - gst_element_add_pad (GST_ELEMENT (asapdec), asapdec->sinkpad); - - asapdec->srcpad = gst_pad_new_from_static_template (&src_factory, "src"); - gst_pad_use_fixed_caps (asapdec->srcpad); - gst_pad_set_query_function (asapdec->srcpad, GST_DEBUG_FUNCPTR (gst_asap_src_query)); - gst_pad_set_event_function (asapdec->srcpad, GST_DEBUG_FUNCPTR (gst_asap_src_event)); - gst_element_add_pad (GST_ELEMENT (asapdec), asapdec->srcpad); - - asapdec->asap = ASAP_New (); - asapdec->playing = FALSE; - asapdec->duration = -1; - asapdec->tune_number = 0; - asapdec->module_len = 0; -} - -static void -gst_asap_dec_finalize (GObject * object) -{ - GstAsapDec *asapdec = GST_ASAPDEC (object); - - ASAP_Delete (asapdec->asap); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static void -gst_asap_dec_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec) -{ - GstAsapDec *asapdec = GST_ASAPDEC (object); - - switch (prop_id) { - case PROP_TUNE: - asapdec->tune_number = g_value_get_int (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - return; - } -} - -static void -gst_asap_dec_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec) -{ - GstAsapDec *asapdec = GST_ASAPDEC (object); - - switch (prop_id) { - case PROP_TUNE: - g_value_set_int (value, asapdec->tune_number); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - return; - } -} - -static void -gst_asap_dec_class_init (GstAsapDecClass * klass) -{ - GObjectClass *gobject_class = (GObjectClass *) klass; - - gobject_class->finalize = gst_asap_dec_finalize; - gobject_class->set_property = gst_asap_dec_set_property; - gobject_class->get_property = gst_asap_dec_get_property; - - g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_TUNE, - g_param_spec_int ("tune", "tune", "tune", 0, ASAPInfo_MAX_SONGS, 0, - (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); -} - -static gboolean -asapdec_init (GstPlugin * asapdec) -{ - /* debug category for filtering log messages */ - GST_DEBUG_CATEGORY_INIT (gst_asap_dec_debug, "asapdec", 0, "ASAP decoder"); - - return gst_element_register (asapdec, "asapdec", GST_RANK_PRIMARY, GST_TYPE_ASAPDEC); -} - -/* Workaround for gstconfig.h: it only checks _MSC_VER, - so it doesn't emit __declspec(dllexport) for MinGW. - As a result, no symbol has __declspec(dllexport) - and thus all are exported from the DLL. */ -#ifdef _WIN32 -#undef GST_PLUGIN_EXPORT -#define GST_PLUGIN_EXPORT __declspec(dllexport) -#endif - -/* GST_PLUGIN_DEFINE needs PACKAGE to be defined. */ -#define PACKAGE "asap" - -/* gstreamer looks for this structure to register asapdec */ -GST_PLUGIN_DEFINE ( - GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "asapdec", - "Decodes Atari 8-bit .sap chiptunes", - asapdec_init, - ASAPInfo_VERSION, - "GPL", - "ASAP", - "http://asap.sourceforge.net/" -) diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/gstreamer/gstasapdec.h kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/gstreamer/gstasapdec.h --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/gstreamer/gstasapdec.h 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/gstreamer/gstasapdec.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,69 +0,0 @@ -/* - * gstasapdec.c - ASAP plugin for GStreamer - * - * Copyright (C) 2011 Piotr Fusik - * - * This file is part of ASAP (Another Slight Atari Player), - * see http://asap.sourceforge.net - * - * ASAP is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. - * - * ASAP is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ASAP; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef __GST_ASAPDEC_H__ -#define __GST_ASAPDEC_H__ - -#include -#include "asap.h" - -G_BEGIN_DECLS - -#define GST_TYPE_ASAPDEC \ - (gst_asap_dec_get_type()) -#define GST_ASAPDEC(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ASAPDEC,GstAsapDec)) -#define GST_ASAPDEC_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ASAPDEC,GstAsapDecClass)) -#define GST_IS_ASAPDEC(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ASAPDEC)) -#define GST_IS_ASAPDEC_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ASAPDEC)) - -typedef struct _GstAsapDec GstAsapDec; -typedef struct _GstAsapDecClass GstAsapDecClass; - -struct _GstAsapDec -{ - GstElement element; - - GstPad *sinkpad, *srcpad; - - ASAP *asap; - gboolean playing; - gint duration; - gint tune_number; - gint module_len; - guchar module[ASAPInfo_MAX_MODULE_LENGTH]; -}; - -struct _GstAsapDecClass -{ - GstElementClass parent_class; -}; - -GType gst_asap_dec_get_type (void); - -G_END_DECLS - -#endif /* __GST_ASAPDEC_H__ */ diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/gstreamer/gstreamer.mk kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/gstreamer/gstreamer.mk --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/gstreamer/gstreamer.mk 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/gstreamer/gstreamer.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ -GSTREAMER_CFLAGS = `pkg-config --cflags --libs gstreamer-0.10` -GSTREAMER_PLUGIN_DIR = `pkg-config --variable=pluginsdir gstreamer-0.10` - -# no user-configurable paths below this line - -ifndef DO -$(error Use "Makefile" instead of "gstreamer.mk") -endif - -asap-gstreamer: libgstasapdec.so -.PHONY: asap-gstreamer - -libgstasapdec.so: $(call src,gstreamer/gstasapdec.c asap.[ch]) - $(CC) $(GSTREAMER_CFLAGS) -CLEAN += libgstasapdec.so - -install-gstreamer: libgstasapdec.so - $(call INSTALL_PROGRAM,libgstasapdec.so,$(GSTREAMER_PLUGIN_DIR)) -.PHONY: install-gstreamer - -uninstall-gstreamer: - $(RM) $(DESTDIR)$(GSTREAMER_PLUGIN_DIR)/libgstasapdec.so -.PHONY: uninstall-gstreamer diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/INSTALL kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/INSTALL --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/INSTALL 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/INSTALL 1970-01-01 00:00:00.000000000 +0000 @@ -1,504 +0,0 @@ -// This file is in AsciiDoc format. It is converted to README.html. - -Using asapconv --------------- - -Run the program from the command line to see the syntax. -The `-o`/`--output` option selects the output format and is mandatory. - - -Using libasap -------------- - -The library is documented in the `asap.h` header file. -Be warned there might be breaking changes in the future versions of the library. - - -Compilation instructions ------------------------- - -Required tools -~~~~~~~~~~~~~~ - -For all builds you will need: - -GNU Make:: -On Linux this program is called `make`. On other systems it may be called `gmake` -(if this is the case, type `gmake` instead of `make` in the following instructions). -On Windows you may install GNU Make from http://cygwin.com/[Cygwin] or http://www.mingw.org/[MinGW]. - -Standard Unix tools:: -I mean `sh`, `cat`, `cp`, `rm`, `mkdir`. On Windows you can find them in Cygwin. - -xasm and MADS:: -If you are compiling latest source code from Git, install -http://xasm.atari.org/[xasm] and http://mads.atari8.info/[MADS]. - -Ć Translator:: -The core of ASAP is written in the Ć programming language. -You'll need http://cito.sourceforge.net[cito]. -For your convenience, this is not needed for most of the C and C++ ports. - -Make sure these tools are on your `PATH`. - - -Getting officially released source code -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -If you want to compile an official release of ASAP, download a source distribution -(`asap-*.tar.gz`) and uncompress it to a directory of your choice. - -On Unix-like systems: --------------------------------------------------------------------------------- -tar zxf asap-*.tar.gz --------------------------------------------------------------------------------- - -On Windows you may use http://7-zip.org/[7-Zip]. - - -Getting latest source code -~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Alternatively you may get the latest version from the Git repository. -To do this using a command-line Git client: --------------------------------------------------------------------------------- -git clone git://git.code.sf.net/p/asap/code asap-code --------------------------------------------------------------------------------- - -This will fetch the latest code into a new directory called `asap-code`. - - -Building asapconv and libasap on Unix-like systems -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -From your shell prompt navigate to the directory which contains `asap.c`. - -To compile and install, run the following commands: --------------------------------------------------------------------------------- -make -sudo make install --------------------------------------------------------------------------------- - -The latter command installs the command-line converter and the C library -in `/usr/local`. - - -Building the Audacious plugin on Unix-like systems -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Install `audacious-dev` or `audacious-devel`. -To compile, run the following command: --------------------------------------------------------------------------------- -make asap-audacious --------------------------------------------------------------------------------- - -To install: --------------------------------------------------------------------------------- -sudo make install-audacious --------------------------------------------------------------------------------- - - -Building the GStreamer plugin on Unix-like systems -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -To compile, run the following command: --------------------------------------------------------------------------------- -make asap-gstreamer --------------------------------------------------------------------------------- - -To install in `/usr/lib/gstreamer-0.10`: --------------------------------------------------------------------------------- -sudo make install-gstreamer --------------------------------------------------------------------------------- - - -Building the MOC plugin on Unix-like systems -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -You need source code of MOC. The plugin is compatible with MOC 2.4.x -and MOC 2.5.0 alpha. - -Check `MOC_INCLUDE` and `MOC_PLUGIN_DIR` in the `moc/moc.mk` file. -These should be the directory with MOC sources -and the directory with the installed MOC plugins, respectively. - -If the defaults are correct, use the following commands: --------------------------------------------------------------------------------- -make asap-moc -sudo make install-moc --------------------------------------------------------------------------------- - -If you need to specify different directories, use: --------------------------------------------------------------------------------- -make asap-moc MOC_INCLUDE=path/to/moc/sources -sudo make install-moc MOC_PLUGIN_DIR=/path/to/moc/plugins --------------------------------------------------------------------------------- - - -Building the VLC plugin on Linux -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Install `vlc-devel`. Verify paths at the top of `vlc/vlc.mk`. -To compile, run the following command: --------------------------------------------------------------------------------- -make asap-vlc --------------------------------------------------------------------------------- - -To install: --------------------------------------------------------------------------------- -sudo make install-vlc --------------------------------------------------------------------------------- - - -Building the VLC plugin on OS X -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Install Xcode Command Line Tools. - -You need `vlc_plugin.h` and other header files. -Unfortunately they are not installed with the VLC on Mac. -You can find them in VLC source code. I copied them from my Windows VLC -(`C:\Program Files (x86)\VideoLAN\VLC\sdk\include\vlc\plugins`). ;) -Make sure `VLC_OSX_CFLAGS` in `vlc/vlc.mk` points to the directory -with these header files. - -To compile, run the following command: --------------------------------------------------------------------------------- -make asap-vlc-osx --------------------------------------------------------------------------------- - -To install: --------------------------------------------------------------------------------- -make install-vlc-osx --------------------------------------------------------------------------------- - - -Building the XBMC plugin on Linux -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -You need source code of the Linux port of XBMC. - -Run: --------------------------------------------------------------------------------- -make asap-xbmc XBMC_DLL_LOADER_EXPORTS=path/to/dir/in/xbmc/sources --------------------------------------------------------------------------------- - -`XBMC_DLL_LOADER_EXPORTS` must point to the directory in XBMC sources -which contains `wrapper.def` and `wrapper.o`. -You should get `xbmc_asap-i486-linux.so`. - -Recently I wasn't able to enable the ASAP plugin in XBMC. -This seems to be an XBMC issue. - - -Building the XMMS plugin on Unix-like systems -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -You need `xmms` and `xmms-devel` packages. - -To compile, run the following command: --------------------------------------------------------------------------------- -make asap-xmms --------------------------------------------------------------------------------- - -If the compilation finished successfully, you can install the plugin -in your home directory: --------------------------------------------------------------------------------- -make install-xmms-user --------------------------------------------------------------------------------- - -or for all users: --------------------------------------------------------------------------------- -sudo make install-xmms --------------------------------------------------------------------------------- - -If you have another XMMS plugin that supports Atari 8-bit music, -remove it in order to avoid conflicts. - - -Building asapconv, WASAP, Winamp/GSPlayer/Apollo/XMPlay/BASS plugins, RMT DLL, asapscan, shell extension and libasap on Windows -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Install the C and C++ compilers from http://www.mingw.org/[MinGW]. - -Open the command prompt in the root directory of ASAP sources and run: --------------------------------------------------------------------------------- -make mingw --------------------------------------------------------------------------------- - -You should get `asapconv.exe`, `wasap.exe`, `in_asap.dll`, `gspasap.dll`, -`ASAP_Apollo.dll`, `xmp-asap.dll`, `bass_asap.dll`, `apokeysnd.dll`, -`asapscan.exe`, `ASAPShellEx.dll` and `libasap.a`. - - -Building Windows Media Player plugin and asap.lib on Windows -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -You additionally need Windows SDK -(install native C++ compiler, headers, libraries and samples). -Set `Path`, `INCLUDE` and `LIB` environment variables -to point to the right locations in the Windows SDK. -Make sure `DSHOW_BASECLASSES_DIR` is set correctly in `win32\win32.mk`. - -Open the command prompt in the root directory of ASAP sources and run: --------------------------------------------------------------------------------- -make win32/asap_dsf.dll win32/asap.lib --------------------------------------------------------------------------------- - -You will get `asap_dsf.dll` and `asap.lib`. - - -Building the GStreamer plugin on Windows -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Install http://www.gstreamer.com/[GStreamer SDK] 32-bit development files. - -Open the command prompt in the root directory of ASAP sources and run: --------------------------------------------------------------------------------- -make win32/libgstasapdec.dll --------------------------------------------------------------------------------- - -Building the Audacious plugin on Windows -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Too bad Audacious doesn't provide an SDK for Windows. - -Unpack http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.24/gtk+-bundle_2.24.10-20120208_win32.zip[GTK+ 2 bundle] -and make sure `GTK_DIR` in `win32/win32.mk` points to it. - -Install Audacious and make sure `AUDACIOUS_LIB` points inside it. - -Unpack Audacious source code and make sure `AUDACIOUS_INCLUDE` points inside it. - -Now comes the tricky part: configure Audacious for Windows. -You'll need to install `gettext` and `libgnurx` in MinGW -(that's probably not an exhaustive list, `configure` will complain about missing things). -From the Audacious source directory run: --------------------------------------------------------------------------------- -bash configure PKG_CONFIG=../gtk/bin/pkg-config --------------------------------------------------------------------------------- - -After it finishes with no errors (warnings are fine), go to ASAP and run: --------------------------------------------------------------------------------- -make win32/asapplug.dll --------------------------------------------------------------------------------- - -Put the DLL in `lib/audacious/Input` of the Windows binary distribution of Audacious. - - -Building the foobar2000 plugin on Windows -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -In addition to the common prerequisites and Windows SDK you need -foobar2000 SDK - extract it to a new directory called -`foobar2000_SDK` next to (not inside!) the ASAP directory. - -Open the command prompt in the root directory of ASAP sources and run: --------------------------------------------------------------------------------- -make win32/foo_asap.dll --------------------------------------------------------------------------------- - -This should produce `foo_asap.dll`. - - -Building the VLC plugin on Windows -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Install VLC as usual, it includes the SDK. -`VLC_SDK_DIR` in `win32/win32.mk` is fine for the default installation -directory on 64-bit Windows - edit it if necessary. - -Open the command prompt in the root directory of ASAP sources and run: --------------------------------------------------------------------------------- -make win32/libasap_plugin.dll --------------------------------------------------------------------------------- - -You will get `libasap_plugin.dll`. - - -Building the XBMC plugin on Windows -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -You need Visual C\++ Toolkit (it used to be a free download from Microsoft, -now search the internet for `VCToolkitSetup.exe`) -and .NET Framework SDK Version 1.1. -Microsoft Visual C++ 2003 might work, but wasn't tested. - -Open the command prompt in the root directory of ASAP sources and run: --------------------------------------------------------------------------------- -make win32/xbmc_asap.dll --------------------------------------------------------------------------------- - -This should produce `xbmc_asap.dll`, which you can use with XBox -or Windows version of XBMC. The XBMC must include support for ASAP. - -Alternatively, you may use the `build_vctk.bat` script in the `xbmc` directory. - - -Building WASAP, GSPlayer and Windows Media Player plugins for Windows CE -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -For WASAP and GSPlayer plugins you need http://cegcc.sourceforge.net/[CeGCC]. -For the Windows Media Player plugin you need Visual Studio 2008 -(2005 might work, but wasn't checked, 2010 won't work). - -Edit the `WINCE_...` paths at the top of `win32/win32.mk` so that they point to your installed tools. -Open the command prompt in the root directory of ASAP sources and run: --------------------------------------------------------------------------------- -make wince --------------------------------------------------------------------------------- - -This should produce `wasap.exe`, `gspasap.dll` and `asap_dsf.dll` -in the `win32/wince` directory. - - -Building Java ASAP2WAV and Java applet -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -You need Java Development Kit (JDK). - -If necessary, edit the paths at the top of `java/java.mk` so that they point to your installed tools. -Open the command prompt in the root directory of ASAP sources and run: --------------------------------------------------------------------------------- -make java/asap2wav.jar java/asap_applet.jar --------------------------------------------------------------------------------- - -This should produce `asap2wav.jar` and `asap_applet.jar`. - - -Building Java midlet -~~~~~~~~~~~~~~~~~~~~ - -You need a Java ME SDK - I use Oracle Java ME SDK. - -Edit the WTK path at the top of `java/j2me/j2me.mk` so that they point to your installed Java ME SDK. -Open the command prompt in the root directory of ASAP sources and run: --------------------------------------------------------------------------------- -make java/j2me/asap_midlet.jad --------------------------------------------------------------------------------- - -This should produce `asap_midlet.jar` and `asap_midlet.jad`. - - -Building AndroidASAP -~~~~~~~~~~~~~~~~~~~~ - -Install http://developer.android.com/sdk/[Android SDK] -with an Android platform(s) (I compile with 2.2 and test with 1.6). - -Edit the paths at the top of `java/android/android.mk` so that they point to your installed SDK. -Open the command prompt in the root directory of ASAP sources and run: --------------------------------------------------------------------------------- -make android-debug --------------------------------------------------------------------------------- - -This should produce `AndroidASAP-debug.apk`. -AndroidASAP integrates with file managers and the web browser. -It uses the internet connection only for files clicked in the web browser. -It reads phone state only to pause playback on incoming phone calls. - - -Building C# ASAP2WAV, asapplay and SilverASAP on Windows -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -You need the .NET Framework, of course. -For SilverASAP you need Silverlight and 7-Zip. - -Open the command prompt in the root directory of ASAP sources and run: --------------------------------------------------------------------------------- -make csharp --------------------------------------------------------------------------------- - -This should produce `asap2wav.exe`, `asapplay.exe` and `SilverASAP.xap`. - - -Building MetroASAP for Windows 8 -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -NOTE: Windows 8 is not yet generally available and this port is work in progress. - -Install .NET Framework 4.5 (Windows 8 already has it). -Install Windows SDK for Windows 8 or Visual Studio 2012 (any edition should be fine). -Verify the paths at the top of `csharp/winrt/winrt.mk`. - -Open the command prompt in the root directory of ASAP sources and run: --------------------------------------------------------------------------------- -make csharp/winrt/MetroASAP.appx --------------------------------------------------------------------------------- - -If you're not on Windows 8, the last step (creating the appx) will fail, -but you'll have the application in the `csharp/winrt/obj` directory. -Copy it to Windows 8 and install from PowerShell: --------------------------------------------------------------------------------- -Add-AppxPackage AppxManifest.xml -Register --------------------------------------------------------------------------------- - - -Building JavaScript command-line ASAP2WAV and the web browser player -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Open the command prompt in the root directory of ASAP sources and run: --------------------------------------------------------------------------------- -make javascript --------------------------------------------------------------------------------- - -`asap2wav.js` is the command-line script. -`asapweb.js` plus `asap.js` are the browser player (you'll probably need `binaryHttpRequest.js` as well). - - -Building Flash player version of ASAP -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -You need http://opensource.adobe.com/wiki/display/flexsdk/Flex+SDK[Flex SDK]. -Add its `bin` directory to your `PATH`. - -Open the command prompt in the root directory of ASAP sources and run: --------------------------------------------------------------------------------- -make flash/asap.swf --------------------------------------------------------------------------------- - -You should get `asap.swf`. - - -Building Perl command-line ASAP2WAV -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Open the command prompt in the root directory of ASAP sources and run: --------------------------------------------------------------------------------- -make perl --------------------------------------------------------------------------------- - -`asap2wav.pl` is the Perl script which uses the `Asap.pm` module you have just built. - - -Building D ASAP2WAV and asapplay on Windows and Linux -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -You need DMD 2.054 or compatible D compiler. -To build asapplay on Windows, you need http://www.dsource.org/projects/bindings/wiki/WindowsApi[D Windows API bindings]. -On Linux, you need ALSA development libraries (e.g. libasound2-dev package in Ubuntu). -D bindings for ALSA are currently included in ASAP sources. - -Open the command prompt in the root directory of ASAP sources and run: --------------------------------------------------------------------------------- -make d --------------------------------------------------------------------------------- - -This should produce `asap2wav.exe` and `asapplay.exe`. - - -Building Android command-line asapconv -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -You need http://developer.android.com/tools/sdk/ndk/index.html[Android NDK]. - -Edit the paths at the top of `java/android/android.mk` so that they point to your installed NDK. -Open the command prompt in the root directory of ASAP sources and run: --------------------------------------------------------------------------------- -make java/android/asapconv --------------------------------------------------------------------------------- - -Now you need to put the binary (`java/android/asapconv`) on your device and make it executable. -It's not possible on a FAT-formatted SD card. I was able to do that in `/data/local/tmp/`. -If you use USB debugging, `make android-push-asapconv` will copy the file, -but you have to do the `chmod` part. diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/java/android/AndroidManifest.xml kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/java/android/AndroidManifest.xml --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/java/android/AndroidManifest.xml 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/java/android/AndroidManifest.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/java/android/android.mk kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/java/android/android.mk --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/java/android/android.mk 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/java/android/android.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,115 +0,0 @@ -ANDROID_SDK = C:/bin/android-sdk-windows -ANDROID_JAR = $(ANDROID_SDK)/platforms/android-17/android.jar -PROGUARD_JAR = C:/bin/proguard4.6/lib/proguard.jar - -AAPT = $(ANDROID_SDK)/platform-tools/aapt -PROGUARD = $(DO)java -jar $(PROGUARD_JAR) -DX = $(DO)java -jar "$(ANDROID_SDK)/platform-tools/lib/dx.jar" --no-strict -APKBUILDER = $(DO)java -classpath "$(ANDROID_SDK)/tools/lib/sdklib.jar" com.android.sdklib.build.ApkBuilderMain $@ -JARSIGNER = $(DO)jarsigner -sigalg SHA1withDSA -digestalg SHA1 -ZIPALIGN = $(DO)$(ANDROID_SDK)/tools/zipalign -ADB = $(ANDROID_SDK)/platform-tools/adb -ANDROID = $(ANDROID_SDK)/tools/android.bat -EMULATOR = $(ANDROID_SDK)/tools/emulator - -# NDK is only needed for the command-line asapconv -# It ended up in this Makefile even though it's not Java -ANDROID_NDK = C:/bin/android-ndk-r8c -ANDROID_NDK_PLATFORM = $(ANDROID_NDK)/platforms/android-3/arch-arm -ANDROID_CC = $(DO)$(ANDROID_NDK)/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/arm-linux-androideabi-gcc --sysroot=$(ANDROID_NDK_PLATFORM) -s -O2 -Wall -o $@ $(INCLUDEOPTS) $(filter %.c,$^) - -# no user-configurable paths below this line - -ifndef DO -$(error Use "Makefile" instead of "android.mk") -endif - -ANDROID_RELEASE = release/asap-$(VERSION)-android.apk - -android-debug: java/android/AndroidASAP-debug.apk -.PHONY: android-debug - -android-release: $(ANDROID_RELEASE) -.PHONY: android-release - -android-install-emu: java/android/AndroidASAP-debug.apk - $(ADB) -e install -r java/android/AndroidASAP-debug.apk -.PHONY: android-install-emu - -android-install-dev: $(ANDROID_RELEASE) - $(ADB) -d install -r $(ANDROID_RELEASE) -.PHONY: android-install-dev - -android-log-emu: - $(ADB) -e logcat -d -.PHONY: android-log-emu - -android-log-dev: - $(ADB) -d logcat -.PHONY: android-log-dev - -android-shell-emu: - $(ADB) -e shell -.PHONY: android-shell-emu - -android-shell-dev: - $(ADB) -d shell -.PHONY: android-shell-dev - -android-emu: - $(EMULATOR) -avd myavd & -.PHONY: android-emu - -android-push-release: $(ANDROID_RELEASE) - $(ADB) -d push $(ANDROID_RELEASE) /sdcard/sap/ -.PHONY: android-push-release - -android-push-sap: - $(ADB) -e push ../Drunk_Chessboard.sap /sdcard/ -.PHONY: android-push-sap - -android-create-avd: - $(ANDROID) create avd -n myavd -t android-4 -c 16M -.PHONY: android-create-avd - -$(ANDROID_RELEASE): java/android/AndroidASAP-unaligned.apk - $(ZIPALIGN) -f 4 $< $@ - -java/android/AndroidASAP-unaligned.apk: java/android/AndroidASAP-unsigned.apk - $(JARSIGNER) -storepass walsie -signedjar $@ java/android/AndroidASAP-unsigned.apk pfusik-android -CLEAN += java/android/AndroidASAP-unaligned.apk - -java/android/AndroidASAP-unsigned.apk: java/android/AndroidASAP-resources.apk java/android/classes.dex - $(APKBUILDER) -u -z java/android/AndroidASAP-resources.apk -f java/android/classes.dex -CLEAN += java/android/AndroidASAP-unsigned.apk - -java/android/AndroidASAP-debug.apk: java/android/AndroidASAP-resources.apk java/android/classes.dex - $(APKBUILDER) -z java/android/AndroidASAP-resources.apk -f java/android/classes.dex -CLEAN += java/android/AndroidASAP-debug.apk - -java/android/classes.dex: java/android/classes/net/sf/asap/Player.class - $(DX) --dex --output=$@ java/android/classes -CLEAN += java/android/classes.dex - -#java/android/classes.dex: java/android/classes.jar -# $(DX) --dex --output=$@ $< - -java/android/classes.jar: $(srcdir)java/android/proguard.cfg java/android/classes/net/sf/asap/Player.class - $(PROGUARD) -injars java/android/classes -outjars $@ -libraryjars $(ANDROID_JAR) @$< - -java/android/classes/net/sf/asap/Player.class: $(addprefix $(srcdir)java/android/,FileContainer.java FileSelector.java MediaButtonEventReceiver.java Player.java PlayerService.java Util.java ZipInputStream.java) java/android/AndroidASAP-resources.apk java/src/net/sf/asap/ASAP.java - $(JAVAC) -d java/android/classes -bootclasspath $(ANDROID_JAR) $(addprefix $(srcdir)java/android/,FileContainer.java FileSelector.java MediaButtonEventReceiver.java Player.java PlayerService.java Util.java ZipInputStream.java) java/android/src/net/sf/asap/R.java java/src/net/sf/asap/*.java -CLEANDIR += java/android/classes - -# Also generates java/android/src/net/sf/asap/R.java -java/android/AndroidASAP-resources.apk: $(addprefix $(srcdir)java/android/,AndroidManifest.xml res/drawable/icon.png res/layout/fileinfo_list_item.xml res/layout/filename_list_item.xml res/layout/playing.xml res/menu/file_selector.xml res/menu/playing.xml res/values/strings.xml res/values/themes.xml) $(JAVA_OBX) - $(DO)mkdir -p java/android/src && $(AAPT) p -f -m -M $< -I $(ANDROID_JAR) -S $(srcdir)java/android/res -F $@ -J java/android/src java/obx -CLEAN += java/android/AndroidASAP-resources.apk java/android/src/net/sf/asap/R.java - -android-push-asapconv: java/android/asapconv - $(ADB) -d push java/android/asapconv /data/local/tmp/ -.PHONY: android-push-asapconv - -java/android/asapconv: $(call src,asapconv.c asap.[ch]) - $(ANDROID_CC) -CLEAN += java/android/asapconv diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/java/android/FileContainer.java kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/java/android/FileContainer.java --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/java/android/FileContainer.java 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/java/android/FileContainer.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,174 +0,0 @@ -/* - * FileContainer.java - ASAP for Android - * - * Copyright (C) 2013 Piotr Fusik - * - * This file is part of ASAP (Another Slight Atari Player), - * see http://asap.sourceforge.net - * - * ASAP is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. - * - * ASAP is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ASAP; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.sf.asap; - -import android.net.Uri; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.IOException; -import java.util.Enumeration; -import java.util.zip.ZipFile; -import java.util.zip.ZipEntry; - -/* - * Container of files: either a directory, a ZIP directory or an M3U playlist. - */ -abstract class FileContainer -{ - protected abstract void onSongFile(String name, InputStream is) throws Exception; - - // directory, m3u, zip - protected void onContainer(String name) - { - } - - private void listDirectory(File dir, boolean inputStreams) throws IOException - { - File[] files = dir.listFiles(); - if (files == null) - throw new FileNotFoundException(); - for (File file : files) { - String name = file.getName(); - if (file.isDirectory()) - onContainer(name + '/'); - else if (ASAPInfo.isOurFile(name)) { - try { - onSongFile(name, inputStreams ? new FileInputStream(file) : null); - } - catch (Exception ex) { - // ignore files we cannot read or understand - } - } - else if (Util.isZip(name) || Util.isM3u(name)) - onContainer(name); - } - } - - private void listM3u(Uri uri, boolean inputStreams) throws IOException - { - String path = uri.getPath(); - InputStream m3uIs; - ZipInputStream zis; - if (Util.isZip(path)) { - String zipFilename = path; - path = uri.getFragment(); - m3uIs = zis = new ZipInputStream(zipFilename, path); - } - else { - m3uIs = new FileInputStream(uri.getPath()); - zis = null; - } - path = Util.getParent(path); - BufferedReader lineReader = new BufferedReader(new InputStreamReader(m3uIs)); - - try { - for (;;) { - String line = lineReader.readLine(); - if (line == null) - break; - if (line.length() == 0 || line.charAt(0) == '#') - continue; - line = line.replace('\\', '/'); - - if (ASAPInfo.isOurFile(line)) { - try { - InputStream is; - if (inputStreams) { - if (zis != null) - is = zis.openInputStream(path + line); - else - is = new FileInputStream(path + line); - } - else - is = null; - onSongFile(line, is); - } - catch (Exception ex) { - // ignore files we cannot read or understand - } - } - } - } - finally { - lineReader.close(); - } - } - - private void listZipDirectory(File zipFile, String zipPath, boolean inputStreams, boolean recurseZip) throws IOException - { - if (zipPath == null) - zipPath = ""; - int zipPathLen = zipPath.length(); - ZipFile zip = new ZipFile(zipFile); - try { - Enumeration zipEntries = zip.entries(); - while (zipEntries.hasMoreElements()) { - final ZipEntry zipEntry = zipEntries.nextElement(); - if (!zipEntry.isDirectory()) { - String name = zipEntry.getName(); - if (name.startsWith(zipPath) && (ASAPInfo.isOurFile(name) || Util.isM3u(name))) { - if (!recurseZip) { - int i = name.indexOf('/', zipPathLen); - if (i >= 0) { - // file in a subdirectory - add subdirectory with the trailing slash - onContainer(name.substring(zipPathLen, i + 1)); - continue; - } - } - // file - name = name.substring(zipPathLen); - if (Util.isM3u(name)) - onContainer(name); - else { - try { - onSongFile(name, inputStreams ? zip.getInputStream(zipEntry) : null); - } - catch (Exception ex) { - // ignore files we cannot read or understand - } - } - } - } - } - } - finally { - zip.close(); - } - } - - void list(Uri uri, boolean inputStreams, boolean recurseZip) throws IOException - { - File file = new File(uri.getPath()); - if (file.isDirectory()) - listDirectory(file, inputStreams); - else if (Util.isM3u(uri)) - listM3u(uri, inputStreams); - else - listZipDirectory(file, uri.getFragment(), inputStreams, recurseZip); - } -} diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/java/android/FileSelector.java kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/java/android/FileSelector.java --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/java/android/FileSelector.java 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/java/android/FileSelector.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,285 +0,0 @@ -/* - * FileSelector.java - ASAP for Android - * - * Copyright (C) 2010-2013 Piotr Fusik - * - * This file is part of ASAP (Another Slight Atari Player), - * see http://asap.sourceforge.net - * - * ASAP is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. - * - * ASAP is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ASAP; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.sf.asap; - -import android.app.ListActivity; -import android.content.Context; -import android.content.Intent; -import android.content.SharedPreferences; -import android.net.Uri; -import android.os.Bundle; -import android.os.Environment; -import android.view.LayoutInflater; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ArrayAdapter; -import android.widget.ListAdapter; -import android.widget.ListView; -import android.widget.TextView; -import android.widget.Toast; -import java.io.File; -import java.io.InputStream; -import java.io.IOException; -import java.util.Arrays; -import java.util.ArrayList; -import java.util.Collection; -import java.util.TreeSet; - -public class FileSelector extends ListActivity -{ - private boolean isDetails; - private Uri uri; - - private static class FileInfo implements Comparable - { - private String filename; - private String title; - private String author; - private String date; - private int songs; - - private FileInfo(String filename) - { - this.title = this.filename = filename; - } - - private FileInfo(String filename, InputStream is) throws Exception - { - this(filename); - if (is != null) { - byte[] module = new byte[ASAPInfo.MAX_MODULE_LENGTH]; - int moduleLen = Util.readAndClose(is, module); - ASAPInfo info = new ASAPInfo(); - info.load(filename, module, moduleLen); - this.title = info.getTitleOrFilename(); - this.author = info.getAuthor(); - this.date = info.getDate(); - this.songs = info.getSongs(); - } - } - - private FileInfo(String filename, String title) - { - this.filename = filename; - this.title = title; - } - - @Override - public String toString() - { - return title; - } - - @Override - public boolean equals(Object obj) - { - if (!(obj instanceof FileInfo)) - return false; - FileInfo that = (FileInfo) obj; - if (this.filename == null) - return that.filename == null; - return this.filename.equals(that.filename); - } - - @Override - public int hashCode() - { - return filename == null ? 0 : filename.hashCode(); - } - - public int compareTo(FileInfo that) - { - if (this.filename == null) - return -1; - if (that.filename == null) - return 1; - boolean dir1 = this.filename.endsWith("/"); - boolean dir2 = that.filename.endsWith("/"); - if (dir1 != dir2) - return dir1 ? -1 : 1; - return this.title.compareTo(that.title); - } - } - - private static class FileInfoAdapter extends ArrayAdapter - { - private LayoutInflater layoutInflater; - - private FileInfoAdapter(Context context, int rowViewResourceId, FileInfo[] infos) - { - super(context, rowViewResourceId, infos); - layoutInflater = LayoutInflater.from(context); - } - - private static class ViewHolder - { - private TextView title; - private TextView author; - private TextView date; - private TextView songs; - } - - public View getView(int position, View convertView, ViewGroup parent) - { - ViewHolder holder; - if (convertView == null) { - convertView = layoutInflater.inflate(R.layout.fileinfo_list_item, null); - holder = new ViewHolder(); - holder.title = (TextView) convertView.findViewById(R.id.title); - holder.author = (TextView) convertView.findViewById(R.id.author); - holder.date = (TextView) convertView.findViewById(R.id.date); - holder.songs = (TextView) convertView.findViewById(R.id.songs); - convertView.setTag(holder); - } - else - holder = (ViewHolder) convertView.getTag(); - - FileInfo info = getItem(position); - holder.title.setText(info.title); - holder.author.setText(info.author); - holder.date.setText(info.date); - holder.songs.setText(info.songs > 1 ? getContext().getString(R.string.songs_format, info.songs) : null); - - return convertView; - } - } - - private class FileInfoList extends FileContainer - { - private Collection coll; - private int songFiles; - - @Override - protected void onSongFile(String name, InputStream is) throws Exception - { - coll.add(new FileInfo(name, is)); - songFiles++; - } - - @Override - protected void onContainer(String name) - { - coll.add(new FileInfo(name)); - } - - FileInfo[] list() throws IOException - { - boolean isM3u = Util.isM3u(uri); - coll = isM3u ? new ArrayList() : new TreeSet(); - songFiles = 0; - list(uri, isDetails, false); - - // "(shuffle all)" if any song files or non-empty ZIP directory - if (songFiles > 1 || (!coll.isEmpty() && Util.isZip(uri.getPath()))) { - FileInfo shuffleAll = new FileInfo(null, getString(R.string.shuffle_all)); - if (isM3u) - ((ArrayList) coll).add(0, shuffleAll); // insert at the beginning - else - coll.add(shuffleAll); - } - - return coll.toArray(new FileInfo[coll.size()]); - } - } - - private void reload() - { - uri = getIntent().getData(); - if (uri == null) { - String state = Environment.getExternalStorageState(); - File dir = Environment.MEDIA_MOUNTED.equals(state) || Environment.MEDIA_MOUNTED_READ_ONLY.equals(state) - ? Environment.getExternalStorageDirectory() - : Environment.getRootDirectory(); - uri = Uri.fromFile(dir); - } - - FileInfo[] infos; - try { - infos = new FileInfoList().list(); - } - catch (IOException ex) { - Toast.makeText(this, R.string.access_denied, Toast.LENGTH_SHORT).show(); - infos = new FileInfo[0]; - } - - ListAdapter adapter = isDetails - ? new FileInfoAdapter(this, R.layout.fileinfo_list_item, infos) - : new ArrayAdapter(this, R.layout.filename_list_item, infos); - setListAdapter(adapter); - } - - @Override - public void onCreate(Bundle savedInstanceState) - { - super.onCreate(savedInstanceState); - getListView().setTextFilterEnabled(true); - isDetails = getPreferences(MODE_PRIVATE).getBoolean("fileDetails", false); - reload(); - } - - @Override - protected void onListItemClick(ListView l, View v, int position, long id) - { - Intent intent; - FileInfo info = (FileInfo) l.getItemAtPosition(position); - String name = info.filename; - if (name == null) { - // shuffle all - intent = new Intent(Intent.ACTION_VIEW, uri, this, Player.class); - } - else { - Class klass = ASAPInfo.isOurFile(name) ? Player.class : FileSelector.class; - intent = new Intent(Intent.ACTION_VIEW, Util.buildUri(uri, name), this, klass); - if (Util.isM3u(uri)) - intent.putExtra(PlayerService.EXTRA_PLAYLIST, uri.toString()); - } - startActivity(intent); - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) - { - getMenuInflater().inflate(R.menu.file_selector, menu); - return true; - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) - { - switch (item.getItemId()) { - case R.id.menu_toggle_details: - isDetails = !isDetails; - getPreferences(MODE_PRIVATE).edit().putBoolean("fileDetails", isDetails).commit(); - reload(); - return true; - case R.id.menu_about: - Util.showAbout(this); - return true; - default: - return false; - } - } -} diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/java/android/MediaButtonEventReceiver.java kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/java/android/MediaButtonEventReceiver.java --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/java/android/MediaButtonEventReceiver.java 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/java/android/MediaButtonEventReceiver.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,66 +0,0 @@ -/* - * MediaButtonEventReceiver.java - ASAP for Android - * - * Copyright (C) 2013 Piotr Fusik - * - * This file is part of ASAP (Another Slight Atari Player), - * see http://asap.sourceforge.net - * - * ASAP is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. - * - * ASAP is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ASAP; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.sf.asap; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.os.IBinder; -import android.view.KeyEvent; - -public class MediaButtonEventReceiver extends BroadcastReceiver -{ - @Override - public void onReceive(Context context, Intent intent) - { - IBinder binder = peekService(context, new Intent(context, PlayerService.class)); - if (binder == null) - return; - PlayerService service = ((PlayerService.LocalBinder) binder).getService(); - - KeyEvent event = (KeyEvent) intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT); - if (event.getAction() != KeyEvent.ACTION_DOWN) - return; - switch (event.getKeyCode()) { - case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: - case KeyEvent.KEYCODE_HEADSETHOOK: - service.togglePause(); - break; - case KeyEvent.KEYCODE_MEDIA_PAUSE: - service.pause(); - break; - case KeyEvent.KEYCODE_MEDIA_PLAY: - service.start(); - break; - case KeyEvent.KEYCODE_MEDIA_NEXT: - service.playNextSong(); - break; - case KeyEvent.KEYCODE_MEDIA_PREVIOUS: - service.playPreviousSong(); - break; - default: - break; - } - } -} diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/java/android/Player.java kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/java/android/Player.java --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/java/android/Player.java 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/java/android/Player.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,180 +0,0 @@ -/* - * Player.java - ASAP for Android - * - * Copyright (C) 2010-2013 Piotr Fusik - * - * This file is part of ASAP (Another Slight Atari Player), - * see http://asap.sourceforge.net - * - * ASAP is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. - * - * ASAP is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ASAP; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.sf.asap; - -import android.app.Activity; -import android.content.BroadcastReceiver; -import android.content.ComponentName; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.content.ServiceConnection; -import android.os.Bundle; -import android.os.IBinder; -import android.net.Uri; -import android.view.Menu; -import android.view.MenuItem; -import android.view.MotionEvent; -import android.view.View; -import android.view.View.OnClickListener; -import android.widget.MediaController; -import android.widget.TextView; - -public class Player extends Activity -{ - private PlayerService service; - private final ServiceConnection connection = new ServiceConnection() { - public void onServiceConnected(ComponentName className, IBinder service) - { - Player.this.service = ((PlayerService.LocalBinder) service).getService(); - showInfo(); - } - public void onServiceDisconnected(ComponentName className) - { - Player.this.service = null; - } - }; - - private MediaController mediaController; - - private View getContentView() - { - return findViewById(android.R.id.content); - } - - private void setTag(int controlId, String value) - { - TextView control = (TextView) findViewById(controlId); - if (value.length() == 0) - control.setVisibility(View.GONE); - else { - control.setText(value); - control.setVisibility(View.VISIBLE); - } - } - - private void showInfo() - { - final PlayerService service = this.service; - if (service == null) - return; - ASAPInfo info = service.info; - if (info == null) - return; - setTag(R.id.name, info.getTitleOrFilename()); - setTag(R.id.author, info.getAuthor()); - setTag(R.id.date, info.getDate()); - int songs = info.getSongs(); - if (songs > 1) - setTag(R.id.song, getString(R.string.song_format, service.song + 1, songs)); - else - setTag(R.id.song, ""); - - mediaController.setMediaPlayer(service); - mediaController.setPrevNextListeners(new OnClickListener() { - public void onClick(View v) { service.playNextSong(); } - }, - new OnClickListener() { - public void onClick(View v) { service.playPreviousSong(); } - }); - } - - static final String ACTION_SHOW_INFO = "net.sf.asap.action.SHOW_INFO"; - - private BroadcastReceiver receiver = new BroadcastReceiver() { - @Override - public void onReceive(Context context, Intent intent) { - showInfo(); - } - }; - - @Override - protected void onCreate(Bundle savedInstanceState) - { - super.onCreate(savedInstanceState); - setTitle(R.string.playing_title); - setContentView(R.layout.playing); - mediaController = new MediaController(this, false); - mediaController.setAnchorView(getContentView()); - - Uri uri = getIntent().getData(); - Intent intent = new Intent(Intent.ACTION_VIEW, uri, this, PlayerService.class); - if (uri != null) - startService(intent); - bindService(intent, connection, Context.BIND_AUTO_CREATE); - - findViewById(R.id.stop_button).setOnClickListener(new OnClickListener() { - public void onClick(View v) { - if (service != null) - service.stopSelf(); - finish(); - } - }); - - registerReceiver(receiver, new IntentFilter(ACTION_SHOW_INFO)); - } - - @Override - protected void onResume() - { - super.onResume(); - if (service != null) - mediaController.show(0); - } - - @Override - public boolean onTouchEvent(MotionEvent event) - { - if (service != null) - mediaController.show(0); - return true; - } - - @Override - protected void onDestroy() - { - super.onDestroy(); - unregisterReceiver(receiver); - unbindService(connection); - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) - { - getMenuInflater().inflate(R.menu.playing, menu); - return true; - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) - { - switch (item.getItemId()) { - case R.id.menu_about: - Util.showAbout(this); - return true; - default: - return false; - } - } -} diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/java/android/PlayerService.java kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/java/android/PlayerService.java --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/java/android/PlayerService.java 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/java/android/PlayerService.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,503 +0,0 @@ -/* - * PlayerService.java - ASAP for Android - * - * Copyright (C) 2010-2013 Piotr Fusik - * - * This file is part of ASAP (Another Slight Atari Player), - * see http://asap.sourceforge.net - * - * ASAP is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. - * - * ASAP is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ASAP; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.sf.asap; - -import android.app.Notification; -import android.app.NotificationManager; -import android.app.PendingIntent; -import android.app.Service; -import android.content.BroadcastReceiver; -import android.content.ComponentName; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.media.AudioFormat; -import android.media.AudioManager; -import android.media.AudioTrack; -import android.net.Uri; -import android.os.Binder; -import android.os.Handler; -import android.os.IBinder; -import android.telephony.PhoneStateListener; -import android.telephony.TelephonyManager; -import android.widget.MediaController; -import android.widget.Toast; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.InputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import org.apache.http.HttpResponse; -import org.apache.http.StatusLine; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.impl.client.DefaultHttpClient; - -public class PlayerService extends Service implements Runnable, MediaController.MediaPlayerControl -{ - private Uri uri; - int song; - private static final int SONG_DEFAULT = -1; - private static final int SONG_LAST = -2; - - // User interface ----------------------------------------------------------------------------------------- - - private NotificationManager notMan; - private static final int NOTIFICATION_ID = 1; - - @Override - public void onCreate() - { - notMan = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); - } - - private void startForegroundCompat(int id, Notification notification) - { - if (!Util.invokeMethod(this, "startForeground", id, notification)) { - // Fall back on the old API. - Util.invokeMethod(this, "setForeground", true); - notMan.notify(id, notification); - } - } - - private void stopForegroundCompat(int id) - { - if (!Util.invokeMethod(this, "stopForeground", true)) { - // Fall back on the old API. - // Cancel before changing the foreground state, since we could be killed at that point. - notMan.cancel(id); - Util.invokeMethod(this, "setForeground", false); - } - } - - private final Handler toastHandler = new Handler(); - - private void showError(final int messageId) - { - toastHandler.post(new Runnable() { - public void run() { - Toast.makeText(PlayerService.this, messageId, Toast.LENGTH_SHORT).show(); - } - }); - } - - - // Threading ---------------------------------------------------------------------------------------------- - - private Thread thread; - private boolean stop; - - private void stop() - { - if (thread != null) { - synchronized (this) { - stop = true; - notify(); - } - try { - thread.join(); - } - catch (InterruptedException ex) { - } - thread = null; - stopForegroundCompat(NOTIFICATION_ID); - } - } - - private void playFile(Uri uri, int song) - { - stop(); - this.uri = uri; - this.song = song; - stop = false; - thread = new Thread(this); - thread.start(); - } - - - // I/O ---------------------------------------------------------------------------------------------------- - - private static InputStream httpGet(Uri uri) throws IOException - { - DefaultHttpClient client = new DefaultHttpClient(); - HttpGet request = new HttpGet(uri.toString()); - HttpResponse response = client.execute(request); - StatusLine status = response.getStatusLine(); - if (status.getStatusCode() != 200) - throw new IOException("HTTP error " + status); - return response.getEntity().getContent(); - } - - - // Playlist ----------------------------------------------------------------------------------------------- - - static final String EXTRA_PLAYLIST = "asap.intent.extra.PLAYLIST"; - - private final ArrayList playlist = new ArrayList(); - - private void setPlaylist(final Uri uri, boolean shuffle) - { - playlist.clear(); - FileContainer container = new FileContainer() { - @Override - protected void onSongFile(String name, InputStream is) { - playlist.add(Util.buildUri(uri, name)); - } - }; - try { - container.list(uri, false, true); - if (shuffle) - Collections.shuffle(playlist); - else if (!Util.isM3u(uri)) - Collections.sort(playlist); - } - catch (IOException ex) { - // playlist is not essential - } - } - - private int getPlaylistIndex() - { - return playlist.indexOf(uri); - } - - private void playFileFromPlaylist(int playlistIndex, int song) - { - playFile(playlist.get(playlistIndex), song); - } - - - // Playback ----------------------------------------------------------------------------------------------- - - private final ASAP asap = new ASAP(); - ASAPInfo info; - private AudioTrack audioTrack; - private int seekPosition; - - private boolean isPaused() - { - return audioTrack == null || audioTrack.getPlayState() == AudioTrack.PLAYSTATE_PAUSED; - } - - public boolean isPlaying() - { - return !isPaused(); - } - - public boolean canPause() - { - return !isPaused(); - } - - public boolean canSeekBackward() - { - return false; - } - - public boolean canSeekForward() - { - return false; - } - - public int getBufferPercentage() - { - return 100; - } - - public void pause() - { - if (audioTrack != null) - audioTrack.pause(); - } - - public void start() - { - if (audioTrack != null) { - audioTrack.play(); - synchronized (this) { - notify(); - } - } - } - - void togglePause() - { - if (isPaused()) - start(); - else - pause(); - } - - private void showInfo() - { - sendBroadcast(new Intent(Player.ACTION_SHOW_INFO)); - } - - private void playSong() throws Exception - { - synchronized (asap) { - seekPosition = -1; - asap.playSong(song, info.getLoop(song) ? -1 : info.getDuration(song)); - } - showInfo(); - start(); - } - - void playNextSong() - { - if (song + 1 < info.getSongs()) { - song++; - try { - playSong(); - return; - } - catch (Exception ex) { - } - } - - int playlistIndex = getPlaylistIndex(); - if (playlistIndex >= 0) { - if (++playlistIndex >= playlist.size()) - playlistIndex = 0; - playFileFromPlaylist(playlistIndex, 0); - } - } - - void playPreviousSong() - { - if (song > 0) { - song--; - try { - playSong(); - return; - } - catch (Exception ex) { - } - } - - int playlistIndex = getPlaylistIndex(); - if (playlistIndex >= 0) { - if (playlistIndex == 0) - playlistIndex = playlist.size(); - playFileFromPlaylist(playlistIndex - 1, SONG_LAST); - } - } - - public int getDuration() - { - if (song < 0) - return -1; - return info.getDuration(song); - } - - public int getCurrentPosition() - { - return asap.getPosition(); - } - - public void seekTo(int pos) - { - synchronized (asap) { - seekPosition = pos; - } - } - - public void run() - { - // read file - String filename = uri.getPath(); - byte[] module = new byte[ASAPInfo.MAX_MODULE_LENGTH]; - int moduleLen; - try { - InputStream is; - switch (uri.getScheme()) { - case "file": - if (Util.isZip(filename)) { - String zipFilename = filename; - filename = uri.getFragment(); - is = new ZipInputStream(zipFilename, filename); - } - else - is = new FileInputStream(filename); - break; - case "http": - is = httpGet(uri); - break; - default: - throw new FileNotFoundException(uri.toString()); - } - moduleLen = Util.readAndClose(is, module); - } - catch (IOException ex) { - showError(R.string.error_reading_file); - return; - } - - // load file - try { - asap.load(filename, module, moduleLen); - info = asap.getInfo(); - switch (song) { - case SONG_DEFAULT: - song = info.getDefaultSong(); - break; - case SONG_LAST: - song = info.getSongs() - 1; - break; - default: - break; - } - playSong(); - } - catch (Exception ex) { - showError(R.string.invalid_file); - return; - } - - PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, Player.class), 0); - String title = info.getTitleOrFilename(); - Notification notification = new Notification(R.drawable.icon, title, System.currentTimeMillis()); - notification.flags |= Notification.FLAG_ONGOING_EVENT; - notification.setLatestEventInfo(this, title, info.getAuthor(), contentIntent); - startForegroundCompat(NOTIFICATION_ID, notification); - - // playback - int channelConfig = info.getChannels() == 1 ? AudioFormat.CHANNEL_CONFIGURATION_MONO : AudioFormat.CHANNEL_CONFIGURATION_STEREO; - int bufferLen = AudioTrack.getMinBufferSize(ASAP.SAMPLE_RATE, channelConfig, AudioFormat.ENCODING_PCM_16BIT) >> 1; - if (bufferLen < 16384) - bufferLen = 16384; - final byte[] byteBuffer = new byte[bufferLen << 1]; - final short[] shortBuffer = new short[bufferLen]; - audioTrack = new AudioTrack(AudioManager.STREAM_MUSIC, ASAP.SAMPLE_RATE, channelConfig, AudioFormat.ENCODING_PCM_16BIT, bufferLen << 1, AudioTrack.MODE_STREAM); - audioTrack.play(); - - for (;;) { - synchronized (this) { - if (bufferLen < shortBuffer.length || isPaused()) { - try { - wait(); - } - catch (InterruptedException ex) { - } - } - if (stop) { - audioTrack.stop(); - return; - } - } - synchronized (asap) { - int pos = seekPosition; - if (pos >= 0) { - seekPosition = -1; - try { - asap.seek(pos); - } - catch (Exception ex) { - } - } - bufferLen = asap.generate(byteBuffer, byteBuffer.length, ASAPSampleFormat.S16_L_E) >> 1; - } - for (int i = 0; i < bufferLen; i++) - shortBuffer[i] = (short) ((byteBuffer[i << 1] & 0xff) | byteBuffer[i << 1 | 1] << 8); - audioTrack.write(shortBuffer, 0, bufferLen); - } - } - - private final BroadcastReceiver headsetReceiver = new BroadcastReceiver() { - @Override - public void onReceive(Context context, Intent intent) - { - if (intent.getIntExtra("state", -1) == 0) { - pause(); - showInfo(); // just to update MediaController - } - } - }; - - private void registerMediaButtonEventReceiver(String methodName) - { - Object audioManager = getSystemService(AUDIO_SERVICE); - ComponentName eventReceiver = new ComponentName(getPackageName(), MediaButtonEventReceiver.class.getName()); - Util.invokeMethod(audioManager, methodName, eventReceiver); - } - - @Override - public void onStart(Intent intent, int startId) - { - super.onStart(intent, startId); - - registerReceiver(headsetReceiver, new IntentFilter(Intent.ACTION_HEADSET_PLUG)); - registerMediaButtonEventReceiver("registerMediaButtonEventReceiver"); - - TelephonyManager telephony = (TelephonyManager) getSystemService(TELEPHONY_SERVICE); - telephony.listen(new PhoneStateListener() { - public void onCallStateChanged(int state, String incomingNumber) { - if (state == TelephonyManager.CALL_STATE_RINGING) - pause(); - } - }, PhoneStateListener.LISTEN_CALL_STATE); - - Uri uri = intent.getData(); - String playlistUri = intent.getStringExtra(EXTRA_PLAYLIST); - if (playlistUri != null) - setPlaylist(Uri.parse(playlistUri), false); - else if ("file".equals(uri.getScheme())) { - if (ASAPInfo.isOurFile(uri.toString())) - setPlaylist(Util.getParent(uri), false); - else { - setPlaylist(uri, true); - uri = playlist.get(0); - } - } - playFile(uri, SONG_DEFAULT); - } - - @Override - public void onDestroy() - { - super.onDestroy(); - stop(); - registerMediaButtonEventReceiver("unregisterMediaButtonEventReceiver"); - unregisterReceiver(headsetReceiver); - } - - - // Player.java interface ---------------------------------------------------------------------------------- - - class LocalBinder extends Binder - { - PlayerService getService() - { - return PlayerService.this; - } - } - - private final IBinder binder = new LocalBinder(); - - @Override - public IBinder onBind(Intent intent) - { - return binder; - } -} diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/java/android/proguard.cfg kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/java/android/proguard.cfg --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/java/android/proguard.cfg 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/java/android/proguard.cfg 1970-01-01 00:00:00.000000000 +0000 @@ -1,85 +0,0 @@ -# Based on examples/android.pro from ProGuard 4.6. - --dontpreverify --repackageclasses '' --allowaccessmodification - -# don't change package because of the resources --keep class net.sf.asap.ASAP6502 - -# Switch off some optimizations that trip older versions of the Dalvik VM. --optimizations !code/simplification/arithmetic - -# RemoteViews might need annotations. --keepattributes *Annotation* - -# Preserve all fundamental application classes. --keep public class * extends android.app.Activity --keep public class * extends android.app.Application --keep public class * extends android.app.Service --keep public class * extends android.content.BroadcastReceiver --keep public class * extends android.content.ContentProvider - -# Preserve all View implementations, their special context constructors, and -# their setters. --keep public class * extends android.view.View { - public (android.content.Context); - public (android.content.Context, android.util.AttributeSet); - public (android.content.Context, android.util.AttributeSet, int); - public void set*(...); -} - -# Preserve all classes that have special context constructors, and the -# constructors themselves. --keepclasseswithmembers class * { - public (android.content.Context, android.util.AttributeSet); -} - -# Preserve all classes that have special context constructors, and the -# constructors themselves. --keepclasseswithmembers class * { - public (android.content.Context, android.util.AttributeSet, int); -} - -# Preserve the special fields of all Parcelable implementations. --keepclassmembers class * implements android.os.Parcelable { - static android.os.Parcelable$Creator CREATOR; -} - -# Preserve static fields of inner classes of R classes that might be accessed -# through introspection. --keepclassmembers class **.R$* { - public static ; -} - -# Preserve the required interface from the License Verification Library -# (but don't nag the developer if the library is not used at all). --keep public interface com.android.vending.licensing.ILicensingService - --dontnote com.android.vending.licensing.ILicensingService - -# Preserve all native method names and the names of their classes. --keepclasseswithmembernames class * { - native ; -} - -# Preserve the special static methods that are required in all enumeration -# classes. --keepclassmembers class * extends java.lang.Enum { - public static **[] values(); - public static ** valueOf(java.lang.String); -} - -# Explicitly preserve all serialization members. The Serializable interface -# is only a marker interface, so it wouldn't save them. -# You can comment this out if your application doesn't use serialization. -# If your code contains serializable classes that have to be backward -# compatible, please refer to the manual. --keepclassmembers class * implements java.io.Serializable { - static final long serialVersionUID; - static final java.io.ObjectStreamField[] serialPersistentFields; - private void writeObject(java.io.ObjectOutputStream); - private void readObject(java.io.ObjectInputStream); - java.lang.Object writeReplace(); - java.lang.Object readResolve(); -} Binary files /tmp/tmpyaM5l1/AUpGL9bywb/kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/java/android/res/drawable/icon.png and /tmp/tmpyaM5l1/KBGCC02aAO/kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/java/android/res/drawable/icon.png differ diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/java/android/res/layout/fileinfo_list_item.xml kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/java/android/res/layout/fileinfo_list_item.xml --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/java/android/res/layout/fileinfo_list_item.xml 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/java/android/res/layout/fileinfo_list_item.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ - - - - - - - - - - - diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/java/android/res/layout/filename_list_item.xml kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/java/android/res/layout/filename_list_item.xml --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/java/android/res/layout/filename_list_item.xml 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/java/android/res/layout/filename_list_item.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ - - diff -Nru kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/java/android/res/layout/playing.xml kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/java/android/res/layout/playing.xml --- kodi-audiodecoder-asap-2.0.2/lib/asap-3.1.5/java/android/res/layout/playing.xml 2020-02-05 15:41:38.000000000 +0000 +++ kodi-audiodecoder-asap-3.0.1/lib/asap-3.1.5/java/android/res/layout/playing.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ - - - - - - -