diff --git a/.hgignore b/.hgignore new file mode 100644 index 0000000..a449a94 --- /dev/null +++ b/.hgignore @@ -0,0 +1,4 @@ +syntax:glob +*.EXE +*.OBJ +*.MAP diff --git a/DEBUG.INC b/DEBUG.INC new file mode 100644 index 0000000..530c1be --- /dev/null +++ b/DEBUG.INC @@ -0,0 +1,107 @@ +; +; Debug macro. To write to the file, use "Trace " +; + +IF TRACEENABLED + +IF CREATENEWLOGFILE +FirstTime DB 0 +ENDIF + +LogFileName DB "Logfile.Txt", 0 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc WriteDebugFile + + PushA + Push DS + + Push CS + Pop DS + + Push CX + Mov DX, Offset LogFileName + +IF CREATENEWLOGFILE + + Cmp DS:FirstTime, 0 + JNE WriteDebugFile1 + + Mov AH, 3Ch + Xor CX, CX + Int 21h + JC WriteDebugFileEnd + + Mov DS:FirstTime, 1 + XChg AX, BX + Jmp WriteDebugFile2 + + WriteDebugFile1: + +ENDIF + Mov AX, 3D02h + Int 21h + JC WriteDebugFileEnd + + XChg AX, BX + + Mov AX, 4202h + Xor CX, CX + Xor DX, DX + Int 21h ; Move to end of file + +WriteDebugFile2: + Mov AH, 40h + Pop CX + Push CX + Mov DX, SI + Int 21h + + Mov AH, 3Eh + Int 21h + +WriteDebugFileEnd: + Pop CX + Pop DS + PopA + Ret + +EndP WriteDebugFile + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Trace Macro LogMessage + Local X, Y + + PushF + Push CX + Push SI + Jmp Y + X: + DB LogMessage + DB 0Dh, 0Ah + Y: + Mov CX, Offset Y - Offset X + Mov SI, Offset X + Call WriteDebugFile + + Pop SI + Pop CX + PopF + + EndM + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +ELSE + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Trace Macro LogMessage + EndM + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +ENDIF + diff --git a/IT.ASM b/IT.ASM new file mode 100644 index 0000000..e97cc5e --- /dev/null +++ b/IT.ASM @@ -0,0 +1,1147 @@ +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Startup Module ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Jumps + .386P + +include switch.inc + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Externals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Segment Object1 BYTE Public 'Data' + Extrn HelpKeyValue:Word, OrderKeyValue:Word +EndS + +Segment InfoLine BYTE Public 'Code' USE16 + Extrn ShowUsageTime:Byte +EndS + +Segment Disk BYTE Public 'Code' USE16 + Extrn DiskOptions:Byte +EndS + +Segment Screen BYTE Public 'Code' + Extrn CharacterGenerationOffset:Word + Extrn VGAFlags:Byte +EndS + +Segment Mouse BYTE Public 'Code' + Extrn MouseCharacterGenerationOffset:Word +EndS + +Segment Main DWORD Public 'Code' USE16 + Extrn ReleaseTimeSlice:Byte +EndS + + Extrn D_InitDisk:Far + Extrn D_UnInitDisk:Far + Extrn D_DisableFileColours:Far + + Extrn E_InitEMS:Far + Extrn E_UnInitEMS:Far + + Extrn Error_InitHandler:Far + Extrn Error_UnInitHandler:Far + + Extrn K_InitKeyBoard:Far + Extrn K_UnInitKeyBoard:Far + Extrn K_InstallKeyboardType:Far + Extrn K_RemoveKeyboardType:Far + + Extrn K_InstallDOSHandler:Far + Extrn K_UnInstallDOSHandler:Far + Extrn K_SwapKeyBoard:Far + + Extrn O1_AutoDetectList:Far + Extrn O1_ConfirmQuit:Far + Extrn O1_PatternEditList:Far + Extrn O1_CrashRecovery:Far + Extrn O1_KeyboardList:Far + + Extrn M_Object1List:Far + + Extrn S_InitScreen:Far + Extrn S_ClearScreen:Far + Extrn S_UnInitScreen:Far + Extrn S_SetDirectMode:Far + Extrn S_DrawString:Far + + Extrn Music_InitMusic:Far + Extrn Music_UnInitMusic:Far + + Extrn Music_SetLimit:Far + Extrn Music_SetSoundCard:Far + Extrn Music_SetDMA:Far + Extrn Music_SetIRQ:Far + Extrn Music_SetMixSpeed:Far + Extrn Music_SetAddress:Far + Extrn Music_ReverseChannels:Far + Extrn Music_PatternStorage:Far + Extrn Music_SetSoundCardDriver:Far + Extrn Music_Stop:Far + Extrn Music_AutoDetectSoundCard:Far + +IF NETWORKENABLED + Extrn Network_Shutdown:Far +ENDIF + + Extrn PE_InitPatternEdit:Far + Extrn PE_UnInitPatternEdit:Far + Extrn PECheckModified:Far + + Extrn D_RestorePreShellDirectory:Far + Extrn D_GetPreShellDirectory:Far + + Extrn MMTSR_InstallMMTSR:Far + Extrn MMTSR_UninstallMMTSR:Far + + Extrn InitMouse:Far, UnInitMouse:Far + Extrn CmdLineDisableMouse:Far + + Extrn InitTimerHandler:Far, UnInitTimerHandler:Far + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + + Global Quit:Far, Refresh:Far + Global DOSShell:Far, GetEnvironment:Far + Global CrashRecovery:Far + + Public IsStartupKeyList + Public GetStartupKeyList + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +Segment StartUp BYTE Public 'Code' USE16 + Assume CS:StartUp, DS:Nothing, ES:Nothing + +CREATENEWLOGFILE EQU 1 +include debug.inc + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Variables ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +StackSize = 1000h + +No386Msg DB "Sorry, Impulse Tracker requires a 386+ processor to run." + DB 13, 10, "$" +WindowsMsg DB "Microsoft Windows detected.", 13, 10, 10 + DB "Due to instabilities in Windows, it is highly recommended that you run", 13, 10 + DB "Impulse Tracker in DOS instead.", 13, 10, 10 + DB "Press any key to continue..." + DB "$" + +PSP DW ? + +LoadMMTSR DB 1 +Pause DB 0 +COMSPECFound DB 0 +COMSPEC DD 0 +Control DB 0 +CommandTail DB 1, 0, 13 + +FCB1 DB 0, 11 Dup (32), 52 Dup (0) +FCB2 DB 0, 11 Dup (32), 52 Dup (0) + +COMSPECString DB "COMSPEC" +DefaultShell DB "C:\COMMAND.COM", 0 +EXECData DW 0 ; Inherit same environment block + DW Offset CommandTail, Startup + DW Offset FCB1, Startup + DW Offset FCB2, Startup +ShellMsg DB "Type EXIT to return to Impulse Tracker$" + +IF SHOWREGISTERNAME +include wavswitc.inc +include username.inc +ENDIF + +Label CmdLineHelp Byte +IF SHOWVERSION + DB "Impulse Tracker 2.14, Copyright (C) 1995-2000 Jeffrey Lim", 13, 10 + DB 10 + DB " Usage: IT.EXE [Switches]", 13, 10 +ELSE + DB "Impulse Tracker, Copyright (C) 1995-2000 Jeffrey Lim", 13, 10 +IF SHOWREGISTERNAME + DB "Registered to: " + DB REGISTERNAME + DB 13, 10 +ENDIF +ENDIF + DB 10 + DB "Switches:", 13, 10 + DB " SFilename.Drv Select sound card driver", 13, 10 + DB " S#", 9, 9, " Quick select sound card", 13, 10 + DB 9, "S0: No sound card", 9, 9, " S9: Pro Audio Spectrum", 13, 10 + DB 9, "S1: PC Speaker", 9, 9, 9, "S10: Pro Audio Spectrum 16", 13, 10 + DB 9, "S2: Sound Blaster 1.xx", 9, 9, "S11: Windows Sound System", 13, 10 + DB 9, "S3: Sound Blaster 2.xx", 9, 9, "S12: ESS ES1868 AudioDrive", 13, 10 + DB 9, "S4: Sound Blaster Pro", 9, 9, "S13: EWS64 XL Codec", 13, 10 + DB 9, "S5: Sound Blaster 16", 9, 9, "S14: Ensoniq SoundscapeVIVO", 13, 10 + DB 9, "S6: Sound Blaster AWE 32", 9, "S19: Generic MPU401", 13, 10 + DB 9, "S7: Gravis UltraSound", 9, 9, "S20: Disk Writer (WAV)", 13, 10 + DB 9, "S8: AMD Interwave", 9, 9, "S21: Disk Writer (MID)", 13, 10 + DB 10 + DB " Axxx", 9, "Set Base Address of sound card (hexadecimal)", 13, 10 + DB " I###", 9, "Set IRQ of sound card (decimal)", 13, 10 + DB " D###", 9, "Set DMA of sound card (decimal)", 13, 10 + DB 10 + DB " M###", 9, "Set Mixspeed", 13, 10 + DB " L###", 9, "Limit number of channels (4-256)", 13, 10 + DB "$" + +MixErrorMsg DB "Error: Mixing speed invalid - setting ignored", 13, 10, "$" +AddressErrorMsg DB "Error: Base Address invalid - setting ignored", 13, 10, "$" +IRQErrorMsg DB "Error: IRQ number invalid - setting ignored", 13, 10, "$" +LimitErrorMsg DB "Error: Channel limit number invalid - setting ignored", 13, 10, "$" +ContinueMsg DB "Press any key to continue...$" + +StartupList DB 0 +StartupMode DB 0 ; Load? Or Load/Play? or Load/Save +StartupFileOffset DW 0 +StartupFileSegment DW 0 +StartupKeyListFunction DW Offset GetStartupKeyList1 + + ; CX,DX +StartupInformation DW 11Ch, 0 ; Enter + DW 1Ch, 0 ; Release Enter + DW 10Fh, 0 ; Tab + DW 10Fh, 0 ; Tab + DW 10Fh, 0 ; Tab + DW 90Eh, 127 ; Ctrl-Backspace + +ENDSTARTUPINFORMATION EQU $ + +SaveInformation DW 0, 0 ; Loading screen key-loss + DW 1FFh, 13h ; Ctrl-S + DW 0, 0 ; Saving screen key-loss + DW 1FFh, 11h ; Ctrl-Q + DW 1FFh, 'Y' ; 'Y' + +ENDSAVEINFORMATION EQU $ + +StartupQueueOffset DW Offset StartupInformation +StartupQueueEnd DW Offset ENDSTARTUPINFORMATION +StartupQueueNextFunction DW Offset GetStartupKeyList2 + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Functions ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Proc CapitaliseAL + + Cmp AL, 'a' + JB CapitaliseAL1 + + Cmp AL, 'z' + JA CapitaliseAL1 + + Add AL, 'A'-'a' + +CapitaliseAL1: + Ret + +EndP CapitaliseAL + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetDecimalNumber ; Returns CX + + LodsB + Cmp AL, '0' + JB GetDecimalNumber1 + Cmp AL, '9' + JBE GetDecimalNumber2 + +GetDecimalNumber1: + StC + Ret + +GetDecimalNumber2: + Xor CX, CX + +GetDecimalNumber3: + Mov BL, AL + Sub BL, '0' + Xor BH, BH + Mov AX, 10 + Mul CX + Add AX, BX + Mov CX, AX + LodsB + And DX, DX + JNZ GetDecimalNumber1 + + Cmp AL, '0' + JB GetDecimalNumber4 + Cmp AL, '9' + JA GetDecimalNumber4 + Jmp GetDecimalNumber3 + +GetDecimalNumber4: + ClC + Ret + +EndP GetDecimalNumber + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Start + Assume DS:Nothing + +; 386 check. + + Trace "Impulse Tracker Startup" + + Push SP + Pop AX + Cmp AX, SP + JNE No386 + + PushF + Pop CX ; CX = Flags. + Mov AX, CX + Or AX, 0F000h + Push AX + PopF + PushF + Pop AX + And AX, 0F000h + JNZ Found386 + +No386: + Push CS + Pop DS + + Mov AH, 9 + Mov DX, Offset No386Msg + Int 21h + + Mov AX, 4C02h + Int 21h + +Found386: +; Push 0B800h ; DEBUG!!!!! +; Pop GS ; DEBUG!!!!! + + Push CX + PopF + + ClD + + Mov [CS:PSP], ES + + Mov AX, ES + Mov BX, SS + Sub BX, AX + Add BX, StackSize / 16 ; Add BX, + Mov AH, 4Ah ; Re-allocate memory + Int 21h + + ; Check for 386 here. + + ; Do command line stuff. + Mov SI, 81h ; DS:SI points to cmdtail + +CmdLine1: + Push ES + Pop DS + + LodsB + +CmdLine3: + Cmp AL, 0Dh + JE CmdLineEnd + And AL, AL + JZ CmdLineEnd + + Call CapitaliseAL + +CmdLine2: + Cmp AL, 'K' + JE KeyboardSwap + Cmp AL, 'F' + JE DisableColours + Cmp AL, 'C' + JE SetControl + Cmp AL, 'H' + JE ShowCmdLineHelp + Cmp AL, '?' + JE ShowCmdLineHelp + Cmp AL, 'S' + JE SetSoundCard1 + Cmp AL, 'D' + JE SetDMA1 + Cmp AL, 'M' + JE SetMixSpeed1 + Cmp AL, 'I' + JE SetIRQ1 + Cmp AL, 'A' + JE SetAddress1 + Cmp AL, 'V' + JE OverrideVGA + Cmp AL, 'L' + JE Limit1 + Cmp AL, 'R' + JE Reverse1 + Cmp AL, 'X' + JE DisableFeatures + Cmp AL, 'P' + JE PatternStorage + Cmp AL, 'T' + JE NoShowUsageTime + Cmp AL, 'W' + JE ConvertModule + + Jmp CmdLine1 + +NoShowUsageTime: + LodsB + Cmp AL, '1' + JNE NoReleaseTimeSlice + + Push DS + + Push InfoLine + Pop DS + Assume DS:InfoLine + + Mov [ShowUsageTime], 0 + + Pop DS + Jmp CmdLine1 + Assume DS:Nothing + +NoReleaseTimeSlice: + Cmp AL, '2' + JNE CmdLine3 + +NoReleaseTimeSlice2: + Push DS + + Push Main + Pop DS + Assume DS:Main + + Mov [ReleaseTimeSlice], 1 + + Pop DS + Jmp CmdLine1 + +PatternStorage: + LodsB + Sub AL, '0' + JC PatternStorageEnd + Cmp AL, 2 + JA PatternStorageEnd + Call Music_PatternStorage + Jmp CmdLine1 + +PatternStorageEnd: + Jmp CmdLine3 + +DisableFeatures: + LodsB + Cmp AL, '1' + JB CmdLine3 + JE DisableMMTSR + + Cmp AL, '3' + JB DisableMouse + JE DisableDetectDriveMap + + Cmp AL, '5' + JB DisableCacheFiles + Jmp CmdLine3 + +DisableMouse: + Call CmdLineDisableMouse + Jmp CmdLine1 + +DisableMMTSR: + Mov [LoadMMTSR], 0 + Jmp CmdLine1 + +DisableDetectDriveMap: + Push Disk + Pop DS + Assume DS:Disk + + Or [DiskOptions], 1 + Jmp CmdLine1 + Assume DS:Nothing + +DisableCacheFiles: + Push Disk + Pop DS + Assume DS:Disk + + Or [DiskOptions], 2 + Jmp CmdLine1 + Assume DS:Nothing + +KeyboardSwap: + Mov AX, Object1 + Mov DS, AX + Assume DS:Object1 + + Mov [HelpKeyValue], 157h + Mov [OrderKeyValue], 13Bh + + Jmp CmdLine1 + Assume DS:Nothing + +DisableColours: + Call D_DisableFileColours + Jmp CmdLine1 + +Reverse1: + Call Music_ReverseChannels + Jmp CmdLine1 + +OverrideVGA: + LodsB + + Mov CX, Screen + Mov DS, CX + Assume DS:Screen + + Cmp AL, '1' + JE OverrideVGA1 + Cmp AL, '2' + JE Matrox + Cmp AL, '3' + JE WaitforRetrace + Cmp AL, '4' + JE Retrace + Jmp CmdLine3 + +OverrideVGA1: + Or [VGAFlags], 1 + Jmp CmdLine1 + +WaitforRetrace: + Or [VGAFlags], 4 + Jmp CmdLine1 + +Retrace: + Or [VGAFlags], 2 + Jmp CmdLine1 + +Matrox: + Mov [CharacterGenerationOffset], 256*32 + + Mov AX, Mouse + Mov DS, AX + Assume DS:Mouse + Mov [MouseCharacterGenerationOffset], 256*32 + + Jmp CmdLine1 + Assume DS:Nothing + +SetControl: + Mov [CS:Control], 1 + Jmp CmdLine1 + +ShowCmdLineHelp: + Push CS + Pop DS + + Mov AH, 9 + Mov DX, Offset CmdLineHelp + Int 21h + + Mov AX, 4C00h + Int 21h + +SetSoundCard1: + Call GetDecimalNumber + JC SetSoundCardDriver + Cmp CX, 21 + JA SetSoundCard2 + + Push AX + Mov AX, CX + Call Music_SetSoundCard + Pop AX + +SetSoundCard2: + Jmp CmdLine3 + +SetSoundCardDriver: + Cmp AL, 32 + JBE CmdLine3 + + Dec SI + Call Music_SetSoundCardDriver + +SetSoundCardDriver1: + LodsB + Cmp AL, 32 + JA SetSoundCardDriver1 + + Mov Byte Ptr [SI-1], 0 + Cmp AL, 32 + JE CmdLine1 + Jmp CmdLineEnd + +ConvertModule: + Mov [CS:StartupList], 1 + Mov [CS:StartupFileOffset], SI + Mov [CS:StartupFileSegment], DS + Jmp SetSoundCardDriver1 + +SetDMA1: + LodsB + Cmp AL, '0' + JB CmdLine3 + Cmp AL, '7' + JA CmdLine3 + Sub AL, '0' + Call Music_SetDMA + Jmp CmdLine1 + +SetMixSpeed1: + Call GetDecimalNumber + JC SetMixSpeedError + Push AX + Call Music_SetMixSpeed + Pop AX + Jmp CmdLine3 + +SetMixSpeedError: + Push CS + Pop DS + Assume DS:StartUp + + Mov AH, 9 + Mov DX, Offset MixErrorMsg + Int 21h + + Mov [Pause], 1 + Jmp CmdLine1 + Assume DS:Nothing + +SetIRQ1: + Call GetDecimalNumber + JC IRQError + Cmp CX, 15 + JA IRQError + + Push AX + Call Music_SetIRQ + Pop AX + Jmp CmdLine3 + +IRQError: + Push CS + Pop DS + Assume DS:StartUp + + Mov AH, 9 + Mov DX, Offset IRQErrorMsg + Int 21h + + Mov [Pause], 1 + Jmp CmdLine1 + Assume DS:Nothing + + +SetAddress1: + LodsB + + Xor DX, DX + Mov CL, 4 + + Cmp AL, '0' + JB SetAddress2 + Cmp AL, '9' + JA SetAddress2 + Sub AL, '0' + Jmp SetAddress3 + +SetAddress2: + Call CapitaliseAL + + Cmp AL, 'A' + JB CmdLine2 + Cmp AL, 'F' + JA CmdLine2 + Sub AL, '@' + +SetAddress3: + Test DX, 0F000h + JNZ AddressError + + ShL DX, CL + Or DL, AL + + LodsB + Cmp AL, '0' + JB SetAddress4 + Cmp AL, '9' + JA SetAddress4 + Sub AL, '0' + Jmp SetAddress3 + +SetAddress4: + Call CapitaliseAL + Cmp AL, 'A' + JB SetAddress5 + Cmp AL, 'F' + JA SetAddress5 + + Sub AL, '@' + Jmp SetAddress3 + +SetAddress5: + Call Music_SetAddress + Jmp CmdLine3 + +AddressError: + Push CS + Pop DS + Assume DS:StartUp + + Mov AH, 9 + Mov DX, Offset AddressErrorMsg + Int 21h + + Mov [Pause], 1 + Jmp CmdLine1 + Assume DS:Nothing + +Limit1: + Call GetDecimalNumber + JC LimitError + Cmp CX, 256 + JA LimitError + Cmp CX, 4 + JB LimitError + + Push AX + Call Music_SetLimit + Pop AX + Jmp CmdLine3 + +LimitError: + Push CS + Pop DS + Assume DS:StartUp + + Mov AH, 9 + Mov DX, Offset LimitErrorMsg + Int 21h + + Mov [Pause], 1 + Jmp CmdLine1 + Assume DS:Nothing + + +CmdLineEnd: + Trace "Command Line Parsed" + + Push CS + Pop DS + Assume DS:StartUp + + Trace "Windows Detection" + + Mov AX, 1600h ; Windows detection. + Int 2Fh + Test AL, 7Fh + JZ Start1 + Cmp AL, 4 ; Windows 4.0+ ?? + JAE Start1 + + Mov AH, 9 + Mov DX, Offset WindowsMsg + Int 21h + + Xor AX, AX + Int 16h + +Start1: + ; Get Comspec + Cmp [Pause], 1 + JNE NoPause + + Mov DX, Offset ContinueMsg + Mov AH, 9 + Int 21h + + Xor AX, AX + Int 16h + +NoPause: + Trace "Retrieving Environment" + + Mov SI, Offset COMSPECString + Mov CX, 7 + Call GetEnvironment + JC Start2 + + Mov [COMSPECFound], 1 + Mov [Word Ptr COMSPEC], DI + Mov [Word Ptr COMSPEC+2], ES + +Start2: + Mov FS, [CS:PSP] + + Trace "Initialising Screen Module" + + Call S_InitScreen + + Trace "Initialising Disk Module" + + Call D_InitDisk + + Trace "Initialising Expanded Memory Module" + + Call E_InitEMS + + Trace "Initialising Music Module" + + Call Music_InitMusic + + Trace "Initialising Keyboard Module" + + Call K_InitKeyBoard + + Trace "Initialising Edit Module" + + Call PE_InitPatternEdit + + Trace "Initialising Custom Keyboard Layout" + + Call K_InstallKeyboardType + + Trace "Initialising Error Handler Module" + + Call Error_InitHandler + + Cmp [CS:LoadMMTSR], 0 + JE SkipMMTSR + + Trace "Initialising MMTSR Module" + + Call MMTSR_InstallMMTSR + +SkipMMTSR: + Trace "Initialising Mouse Module" + + Call InitMouse + + Call S_ClearScreen + + Trace "Initialising Timer Module" + + Call InitTimerHandler + + Trace "Initialising Soundcard" + + Call Music_AutoDetectSoundCard + + Trace "Entering Main Message Loop" + + Mov DI, Offset O1_AutoDetectList +; Mov DI, Offset O1_KeyboardList + Mov CX, 0FFFFh + Call M_Object1List + Jmp Quit1 + +Proc Quit Far + + Mov DI, Offset O1_ConfirmQuit + Mov CX, 3 + Call M_Object1List + + And DX, DX + JNZ Quit1 + + Mov AX, 1 + RetF + +Quit1: + Call PECheckModified + Call Music_Stop + +IF NETWORKENABLED + Call Network_Shutdown +ENDIF + + Call MMTSR_UninstallMMTSR + Call PE_UnInitPatternEdit + Call Music_UnInitMusic + Call UnInitMouse + Call S_UnInitScreen + Call E_UnInitEMS + Call K_UnInitKeyBoard + Call Error_UnInitHandler + Call D_UnInitDisk + Call K_RemoveKeyboardType + Call UnInitTimerHandler + + Mov AX, 4C00h + Int 21h + +EndP Quit + +EndP Start + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc IsStartupKeyList Far + + Mov AL,CS:StartupList + + Ret + +EndP IsStartupKeyList + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetStartupKeyList Far + + Jmp [CS:StartupKeyListFunction] + +GetStartupKeyList1: + Push SI + Mov SI, [CS:StartupQueueOffset] + + Mov CX, [CS:SI] + Mov DX, [CS:SI+2] + + Add SI, 4 + Mov [CS:StartupQueueOffset], SI + + Cmp SI, [CS:StartupQueueEnd] + + Pop SI + JB GetStartupKeyList1End + + Mov AX, [CS:StartupQueueNextFunction] + Mov [CS:StartupKeyListFunction], AX + +GetStartupKeyList1End: + Ret + +GetStartupKeyList2: + Push DS + Push SI + + LDS SI, [DWord Ptr CS:StartupFileOffset] + LodsB + + Mov [CS:StartupFileOffset], SI + + Pop SI + Pop DS + + Cmp AL, 32 + JE GetStartupKeyList2EndOfString + And AX, 0FFh + JZ GetStartupKeyList2EndOfString + + Mov DX, AX + Mov CX, 1FFh + + Ret + +GetStartupKeyList2EndOfString: + Mov [CS:StartupQueueOffset], Offset SaveInformation + Mov [CS:StartupQueueEnd], Offset ENDSAVEINFORMATION + Mov [CS:StartupQueueNextfunction], Offset GetStartupKeyList3 + Mov [CS:StartupKeyListFunction], Offset GetStartupKeyList1 + + Mov CX, 11Ch ; Enter + Mov DX, 0 + + Ret + +GetStartupKeyList3: ; Save module then quit + Xor CX, CX + Xor DX, DX + Mov [CS:StartupList], 0 + Ret + +EndP GetStartupKeyList + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc CrashRecovery Far ; CtrlAltDel location. + + ClD + StI + + Call S_ClearScreen + Call S_InitScreen + Call D_InitDisk + Call InitMouse + + Mov DI, Offset O1_CrashRecovery + Mov CX, 0FFFFh + Call M_Object1List + + Mov DI, Offset O1_PatternEditList + Mov CX, 0FFFFh + Jmp M_Object1List + +EndP CrashRecovery + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetEnvironment Far ; DS:SI points to string. + ; CX = length of string. + ; Returns ES:DI + + Mov ES, [CS:PSP] + Mov ES, [ES:2Ch] ; DS:00 points to environ. + Xor DI, DI + +GetEnvironment1: + Push DI + Push CX + Push SI + + RepE CmpSB + + Pop SI + Pop CX + Pop DI + + JE GetEnvironment3 ; From RepE + + Xor AL, AL + +GetEnvironment2: + ScasB + JNE GetEnvironment2 + + Cmp [Byte Ptr ES:DI], AL + JNE GetEnvironment1 + + StC + Ret + +GetEnvironment3: + Add DI, CX + Inc DI ; Skip past '=' + ClC + Ret + +EndP GetEnvironment + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Refresh Far + + Call D_GetPreShellDirectory + Call S_InitScreen + Call D_InitDisk + Call InitMouse + Call D_RestorePreShellDirectory + + Mov AX, 1 + Ret + +EndP Refresh + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DOSShell Far + + PushAD + Push DS + Push ES + + PushF + + Call D_GetPreShellDirectory + + Cmp [CS:Control], 0 + JNE DOSShell2 + + Call K_UnInitKeyBoard + Jmp DOSShell3 + +DOSShell2: + Call K_InstallDOSHandler +DOSShell3: + + Mov AX, 3 + Int 10h ; Clr screen. + + Call UnInitMouse + + Push CS + Push CS + Pop DS + Pop ES + Assume DS:StartUp + + Mov AH, 9 + Mov DX, Offset ShellMsg + Int 21h + + Mov AX, 4B00h + Mov BX, Offset ExecData + Mov DX, Offset DefaultShell + Cmp [COMSPECFound], 0 + JE DOSShell1 + + LDS DX, [COMSPEC] + +DOSShell1: + ClI + Int 21h + Assume DS:Nothing + + PopF + + Call S_InitScreen + Call D_InitDisk + Call InitMouse + + Cmp [CS:Control], 0 + JNE DOSShell4 + + Call K_InitKeyBoard + Jmp DOSShell5 + +DOSShell4: + Call K_UnInstallDOSHandler + +DOSShell5: + Call D_RestorePreShellDirectory + + Pop ES + Pop DS + PopAD + + Mov AX, 1 + Ret + +EndP DOSShell + Assume DS:Nothing + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + + +EndS + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Stack Segment ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Segment StackSeg PARA Stack 'Stack' +StackData DB StackSize Dup(?) +EndS + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +End Start diff --git a/ITMIDI.CFG b/ITMIDI.CFG new file mode 100644 index 0000000..52da1e1 Binary files /dev/null and b/ITMIDI.CFG differ diff --git a/IT_DISK.ASM b/IT_DISK.ASM new file mode 100644 index 0000000..50ceec8 --- /dev/null +++ b/IT_DISK.ASM @@ -0,0 +1,10940 @@ +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Disk Module ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +include switch.inc +include network.inc + + Jumps + .386 + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Externals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Segment Object1 BYTE Public 'Data' +EndS + +Segment Pattern BYTE Public 'Code' + Extrn BaseOctave:Byte + Extrn RowHilight1:Byte + Extrn RowHilight2:Byte +EndS + +Segment Pattern BYTE Public 'Code' + Extrn PatternDataArea:Word +EndS + +Segment Music BYTE Public 'Code' +EndS + + Extrn Display_GetDisplayWindowData:Far + + Extrn E_UnInitEMS:Far + Extrn E_MapEMSMemory:Far + Extrn E_GetEMSPageFrame:Far + + Extrn Glbl_F3:Far + Extrn Glbl_F4:Far + + Extrn I_GetSampleOffset:Far + Extrn I_GetInstrumentOffset:Far + Extrn I_ClearTables:Far + Extrn I_GetPresetEnvelopeOffset:Far + + Extrn K_UnInitKeyBoard:Far + Extrn K_IsAnyKeyDown:Far + Extrn K_ClearKeyBoardQueue:Far + Extrn K_GetKey:Far + + Extrn M_FunctionDivider:Far + Extrn M_Object1List:Far + + Extrn Music_PlayNote:Far + Extrn Music_PlaySample:Far + Extrn Music_ReleaseAllPatterns:Far + Extrn Music_ReleaseAllSamples:Far + Extrn Music_ReleaseSample:Far + Extrn Music_GetSongSegment:Far + Extrn Music_AllocateSample:Far + Extrn Music_ClearAllSampleNames:Far + Extrn Music_GetNumberOfSamples:Far + Extrn Music_GetNumberOfInstruments:Far + Extrn Music_GetPattern:Far + Extrn Music_AllocatePattern:Far + Extrn Music_AllocateSample:Far + Extrn Music_GetSampleLocation:Far + Extrn Music_ClearAllInstruments:Far + Extrn Music_GetInstrumentMode:Far + Extrn Music_AssignSampleToInstrument:Far + Extrn Music_SoundCardLoadSample:Far + Extrn Music_SoundCardLoadAllSamples:Far + Extrn Music_GetPitchTable:Far + Extrn Music_GetMIDIDataArea:Far + + Extrn Music_Stop:Far + Extrn Msg_ResetMessage:Far + Extrn Msg_GetMessageOffset:Far + Extrn Msg_GetMessageLength:Far + +IF TUTORIAL +ELSE + Extrn O1_LoadS3MList:Far + Extrn O1_LoadXMList:Far + Extrn O1_LoadMODList:Far + Extrn O1_LoadMTMList:Far + Extrn O1_Load669List:Far + Extrn O1_LoadITList:Far +ENDIF + Extrn O1_ConfirmOverWriteList:Far + Extrn O1_UnableToSaveList:Far + Extrn O1_SaveITList:Far + Extrn O1_SaveS3MList:Far + Extrn O1_ConfirmDelete:Far ; Updates Song name loader. + Extrn O1_ConfirmDelete2:Far + Extrn O1_ConfirmDelete3:Far + Extrn O1_ConfirmSaveRenameList:Far + Extrn O1_ConfirmResaveList:Far + Extrn O1_ConfirmDiscardList:Far + Extrn O1_InitInstrument:Far + Extrn O1_EditSampleName:Far + Extrn O1_OutOfSamplesList:Far + Extrn O1_EnableInstrumentMode:Far + Extrn O1_StereoSampleList:Far + + Extrn PE_TranslateXMPattern:Far + Extrn PE_Translate669Pattern:Far + Extrn PE_TranslateS3MPattern:Far + Extrn PE_TranslateMTMPattern:Far + Extrn PE_TranslateMODPattern:Far + Extrn PE_ResetOrderPattern:Far + Extrn PE_UnInitPatternEdit:Far + Extrn PEFunction_OutOfMemoryMessage:Far + Extrn PECheckModified:Far + Extrn PEResetModified:Far + Extrn PE_GetMaxPattern:Far + Extrn PE_ConvAX2Num:Far + Extrn PE_GetLastInstrument:Far + Extrn PE_GetPatternConfigOffset:Far + Extrn PE_SaveCurrentPattern:Far + Extrn PE_RestoreCurrentPattern:Far + + Extrn S_UnInitScreen:Far + Extrn S_GetDestination:Far + Extrn S_DrawString:Far + Extrn S_SaveScreen:Far + Extrn S_RestoreScreen:Far + Extrn S_GetGenerationTableOffset:Far + Extrn S_GenerateCharacters:Far + Extrn S_RedefineCharacters:Far + Extrn S_GetPaletteOffset:Far + Extrn S_SetPalette:Far + + Extrn SetInfoLine:Far + Extrn ClearInfoLine:Far + + Extrn Glbl_SetCurrentMode:Far + Extrn Glbl_F10:Far + + Extrn GetKeyboardLock:Far, GetTimerCounter:Far + Extrn MouseUpdateEnable:Far, MouseUpdateDisable:Far + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Globals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Global D_GetFileName:Far + Global D_SetDriveDirectoryFar:Far + + Global D_RestorePreShellDirectory:Far + Global D_GetPreShellDirectory:Far + + Global D_SaveInstrument:Far + Global D_ClearFileName:Far + + Global D_GetFormatType:Far + + Global D_LSCheckLoopValues:Far + Global D_LSCheckSusLoopValues:Far + + Global D_SaveSong:Far + + Global D_InitDisk:Far + Global D_UnInitDisk:Far + Global D_InitLoadModule:Far + Global D_InitLoadSamples:Far + Global D_LoadSampleNames:Far + Global D_NewSpecifier:Far + Global D_NewDirectory:Far + Global D_SaveIT:Far + Global D_DrawWaveForm:Far + + Global D_InitLoadInstruments:Far + Global D_DrawLoadInstrument:Far + Global D_PreLoadInstrument:Far + Global D_PostLoadInstrument:Far + Global D_LoadInstrumentNames:Far + Global D_ViewInstrument:Far + Global D_SlowSampleSort:Far + Global D_SlowInstrumentSort:Far + + Global D_SaveS3M:Far + + Global D_SaveDirectoryConfiguration:Far + Global D_DisableFileColours:Far + + Global D_GetLoadSampleVars:Far + + Global D_DrawLoadSampleWindow:Far + Global D_PreLoadSampleWindow:Far + Global D_PostLoadSampleWindow:Far + Global D_PostViewSampleLibrary:Far + + Global D_LSDrawDriveWindow:Far + Global D_LSPreDriveWindow:Far + Global D_LSPostDriveWindow:Far + + Global D_LIDrawDriveWindow:Far + Global D_LIPreDriveWindow:Far + Global D_LIPostDriveWindow:Far + + Global D_DeleteSampleFile:Far + + Global D_PostSaveDriveWindow:Far + + Global D_ClearFileSpecifier:Far + Global D_LoadSongNames:Far + Global D_DrawFileWindow:Far + Global D_DrawDirectoryWindow:Far + Global D_DrawDriveWindow:Far + Global D_PreFileWindow:Far + Global D_PostFileWindow:Far + Global D_PreDirectoryWindow:Far + Global D_PostDirectoryWindow:Far + Global D_PreDriveWindow:Far + Global D_PostDriveWindow:Far + Global D_PostFileLoadWindow:Far + Global D_PostFileSaveWindow:Far + Global D_SaveModule:Far + + Global FileSpecifier:Byte + Global SongDirectory:Byte + Global SampleDirectory:Byte + Global InstrumentDirectory:Byte + Global FileName:Byte + + Global D_SaveSample:Far + Global D_SaveRawSample:Far + Global D_SaveST3Sample:Far + + Global D_GotoStartingDirectory:Far + + Global LSWindow_Up:Far + Global LSWindow_Down:Far + + Global DiskDataArea:Word + Global SampleName:Byte + Global DiskOptions:Byte + + Public D_Resettimer + Public D_ShowTime + +IF TIMERSCREEN + Public D_DrawTimer + Public D_PostTimerList +ENDIF + +IF TUTORIAL + Public SamplesInModule + Public InSampleFileName +ELSE + Public D_LoadS3M + Public D_LoadMTM + Public D_LoadMOD + Public D_Load669 + Public D_LoadIT + Public D_LoadXM +ENDIF + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +Segment Disk BYTE Public 'Code' USE16 + Assume CS:Disk, DS:Nothing + +CREATENEWLOGFILE EQU 0 +include debug.inc + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Variables ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +SampleInMemory DW 0FFFFh +NoSaveError DB 0 +Specific DB 0 +DiskDataArea DW DiskData + +OldCacheTime DD 0 + +Time DW 0 +Date DW 0 +LoadDate DW 0 +LoadTime DW 0 +DrivesAvail DB 27 Dup (0) +UnusedSamples DW 0 + +InitialInstruments DW 0 ; +NumInstruments DW 0 ; Order important! +InstrumentCachefileVersion DW TRACKERVERSION ; + +LoadInstrumentNameCount DW 0 +TopInstrument DW 0 +CurrentInstrument DW 0 + +LoadSongNameCount DW 0 +LoadSampleNameCount DW 0 +CurrentSample DW 0 + +NumSamples DW 0 ; Order important! +SampleCachefileVersion DW TRACKERVERSION ; + +TopSample DW 0 +CurrentDrive DB 0 +NumDrives DB 0 +TopDrive DB 0 +NumEntries DW 0 +NumFiles DW 0 +NumFileInfo DW 0 +NumDirectories DW 0 +TopDirectory DW 0 +CurrentDirectory DW 0 +CurrentFile DW 0 +TopFile DW 0 +FileName DB 0 + DB 13 Dup (0) +SaveFileName DB 0 + DB 79 Dup (0) +FileSpecifier DB 0 + DB 64 Dup (0) +StartingDrive DB 0 +StartingDirectory DB 70 Dup (0) + +PreShellDirectory DB 70 Dup (0) +DOSDirectory DB 70 Dup (0) + +SongDirectory DB 0 + DB 69 Dup (0) +SampleDirectory DB 0 + DB 69 Dup (0) +InstrumentDirectory DB 0 + DB 69 Dup (0) +CountryTableConfig DB 0 + +SampleName DB 0 + DB 26 Dup (0) + +MODNumberOfChannels DB 0 +MODNumberOfInstruments DB 0 +MODNumberOfOrders DB 0 +MODOrderOffset DW 0 +MODPatternOffset DW 0 +LastKey DW 0 + +SampleCacheFileComplete DB 0 +InstrumentCacheFileComplete DB 0 + +Resolution DB 0 + +FileTempSpecifier DB 70 Dup (0) +CurrentSearchPos DB 0 +Search DB 13 Dup (0) + +InstrumentTable DB 100 Dup (0) + +InstrumentLoaderTable Label Word + DW Offset LoadITInstrument ; 3 + DW Offset LoadXIInstrument ; 4 + DW Offset LoadInITInstrument ; 5 + DW Offset LoadInXMInstrument ; 6 + DW 0 ; 7 + DW Offset LoadITInModuleInstrument ; 8 + DW Offset LoadXMInModuleInstrument ; 9 + +InstrumentLoader DW 0 +InSampleFileName DB 13 Dup (0) +InSampleDateTime DD 0 +InSampleFormat DB 0 ; Do *NOT* change order +InSampleChannels DB 0 ; Do *NOT* change order + +InInstrumentFileName DB 13 Dup (0) +InInstrumentFormat DB 0 + +ExitLibraryDirectory Label + DB "IMPS. ", 0, 0, 0, 0 + DB 8 Dup(154), "Directory", 8 Dup(154), 0, 0, 0 + DW 0, 0, 0, 0, 0, 0, 0, 0 + DW 0, 0, 0, 0, 0, 0, 0, 0 + DW 0, 0, 0, 0 + DB 1 + +ExitInstrumentLibraryDirectory Label + DB 1, ". ", 0 + DB 8 Dup(154), "Directory", 8 Dup(154), 0 ; Instrument name + DW 0, 0 ; NoSamples, FileSize + DD 0 ; File offset + +AllFilesMask DB "*.*", 0 +FileSpecifierDefault DB "*.IT, *.XM, *.S3M, *.MTM, *.669, *.MOD", 0 +DriveMsg DB "Drive X:" +NoFilesMsg DB "No files.", 0 +NoDirsMsg DB "No dirs.", 0 +WAVEfmtID DB "WAVEfmt ", 0, 0, 1, 0 +XIIdentification DB "Extended Instrument: " +XMIdentification DB "Extended Module: " +TXWAVEIdentification DB "LM8953", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +GUSPATIdentification DB "GF1PATCH110", 0, "ID#000002", 0 ; 22 bytes + +OpenErrorMsg DB "Error opening file.", 0 + +HeaderMsg DB "File Header", 0 +SampleMsg DB "Sample ", 0FDh, 'D', 0 +SHLoadMsg DB "Sample Header ", 0FDh, 'D', 0 +InstrumentMsg DB "Instrument ", 0FDh, 'D', 0 +PatternMsg DB "Pattern ", 0FDh, 'D', 0 +TrackMsg DB "Channel ", 0FDh, 'D ', 13 + DB "Track ", 0FDh, 'D ', 0 +CompleteMsg DB "Done", 0 +InstrumentHeaderMsg DB "Instrument Headers", 0 +SampleHeaderMsg DB "Sample Headers", 0 +Quality8Msg DB "8 Bit", 0 +Quality16Msg DB "16 Bit", 0 +Quality8StereoMsg DB "8 Bit Stereo", 0 +Quality16StereoMsg DB "16 Bit Stereo", 0 +LengthMsg DB 0FDh, 'L', 0 +DirectoryMsg DB 8 Dup(154), "Directory", 8 Dup(154), 0 +LibraryMsg DB 9 Dup(154), "Library", 9 Dup(154), 0 +FontFileName DB "FONT.CFG", 0 +ConfigFileName DB "IT.CFG", 0 +ST3CacheFileName DB "########.ST3", 0 +SampleCacheFileName DB "CACHE.ITS", 0 +InstrumentCacheFileName DB "CACHE.ITI", 0 +SaveFormat DB DEFAULTFORMAT +SaveFormatError DB 0 ; This will get erased whenever the + ; saveformat changes. +SamplesInModule DB 0 +InstrumentsInModule DB 0 +FileColours DB 1 + +NoteData DB 0FFh, 0, 0FFh, 0, 0 + +CheckDataArea DB 96 Dup(0) +KeyBoardTable DW 12Ch, 0, 11Fh, 1, 12Dh, 2, 120h, 3, 12Eh, 4 + DW 12Fh, 5, 122h, 6, 130h, 7, 123h, 8, 131h, 9 + DW 124h, 10, 132h, 11, 110h, 12, 103h, 13, 111h, 14 + DW 104h, 15, 112h, 16, 113h, 17, 106h, 18, 114h, 19 + DW 107h, 20, 115h, 21, 108h, 22, 116h, 23, 117h, 24 + DW 10Ah, 25, 118h, 26, 10Bh, 27, 119h, 28, 0FFFFh +SampleCheck DW 0FFFFh + +MonthNames Label + DW Offset Empty + DW Offset January + DW Offset February + DW Offset March + DW Offset April + DW Offset May + DW Offset June + DW Offset July + DW Offset August + DW Offset September + DW Offset October + DW Offset November + DW Offset December + DW Offset Empty + DW Offset Empty + DW Offset Empty + +January DB "January", 0 +February DB "February", 0 +March DB "March", 0 +April DB "April", 0 +May DB "May", 0 +June DB "June", 0 +July DB "July", 0 +August DB "August", 0 +September DB "September", 0 +October DB "October", 0 +November DB "November", 0 +December DB "December" +Empty DB 0 + +TimerData DW 0 +NumTimerData DW 0 +TopTimerData DW 0 + +SampleFormatNames Label + DW Offset Unchecked ; 0 + DW Offset DirectoryFormat + DW Offset ITSampleFormat + DW Offset STSampleFormat + DW Offset UnknownSampleFormat + DW Offset WAV8BitFormat + DW Offset XMSample + DW Offset WAV16BitFormat + DW Offset XMSample + DW Offset PTMSample + DW Offset MTMSample + DW Offset C669Sample + DW Offset FARSample + DW Offset TXWaveSample ; 13 + DW Offset MODSample + DW Offset KRZSample ; 15 + DW Offset PATFormat + DW Offset IFFFormat ; 17 + DW 0, 0 + DW 0, 0, 0, 0 + DW 0, 0, 0, 0 + DW 0, 0, 0, 0 + DW Offset ST3Module ; 20h + DW Offset ITModule + DW Offset XMModule + DW Offset PTMModule + DW Offset MTMModule + DW Offset C669Module + DW Offset FARModule + DW Offset MODModule1 + DW Offset XMModule + DW Offset KRZFormat ; 29h + DW Offset PATFormat + +LoadSamplesInModuleTable Label Word + DW Offset LoadS3MSamplesInModule + DW Offset LoadITSamplesInModule + DW Offset LoadXMSamplesInModule + DW Offset LoadPTMSamplesInModule + DW Offset LoadMTMSamplesInModule + DW Offset Load669SamplesInModule + DW Offset LoadFARSamplesInModule + DW Offset LoadMODSamplesInModule + DW Offset LoadMODSamplesInModule + DW Offset LoadKRZSamples + DW Offset LoadPATSamples +; DW Offset LoadULTSamplesInModule + +FormatNames Label + DW Offset Unchecked ; 0 + DW Offset UnknownFormat ; 1 + DW Offset ITFormat2_0 ; 2 + DW Offset ITFormat? ; 3 + DW Offset ST3Format ; 4 + DW Offset XMModule ; 5 + DW Offset C669Module ; 6 + DW Offset CompressedITModule ; 7 + DW 0 + DW Offset MODFormat ; 9 + DW Offset Protracker ; 10 + DW Offset Channel4 ; 11 + DW Offset Channel6 ; 12 + DW Offset Channel8 ; 13 + DW Offset StarTrekker4 ; 14 + DW Offset StarTrekker8 ; 15 + DW Offset OldMod ; 16 + DW Offset ChannelXX ; 17 + DW Offset MultiTrackerModule ; 18 + +PanningPositions DB 0, 4, 9, 13, 17, 21, 26, 30 + DB 34, 38, 43, 47, 51, 55, 60, 64 +MODChannelTable DB 4, 4, 4, 6, 8, 4, 8, 4 +FineTuneTable DW 8363, 8413, 8463, 8529 + DW 8581, 8651, 8723, 8757 + DW 7895, 7941, 7985, 8046 + DW 8107, 8169, 8232, 8280 + +DirectoryFormat DB "Directory", 0 +ITSampleFormat DB "Impulse Tracker Sample", 0 +STSampleFormat DB "Scream Tracker Sample", 0 +UnknownSampleFormat DB "Unknown sample format", 0 +WAV8BitFormat DB "8 Bit WAV Format", 0 +WAV16BitFormat DB "16 Bit WAV Format", 0 +XMSample DB "Fast Tracker 2 Sample", 0 +PTMSample DB "Poly Tracker Sample", 0 +MTMSample DB "Multi Tracker Sample", 0 +C669Sample DB "Composer 669 Sample", 0 +FARSample DB "Farandole Sample", 0 +; ULTSample DB "Ultra Tracker Sample", 0 +TXWaveSample DB "TX Wave Sample", 0 +MODSample DB "MOD Sample", 0 +KRZSample DB "KRZ Sample", 0 + +ST3Module DB "Scream Tracker 3 Module", 0 +ITModule DB "Impulse Tracker Module", 0 +XMModule DB "Fast Tracker 2 Module", 0 +PTMModule DB "Poly Tracker Module", 0 +MTMModule DB "Multi Tracker Module", 0 +C669Module DB "Composer 669 Module", 0 +FARModule DB "Farandole Module", 0 +MODModule1 DB "MOD Format", 0 +; ULTModule DB "Ultra Tracker Module", 0 +KRZFormat DB "Kurzweil Synth File", 0 +PATFormat DB "Gravis UltraSound Patch", 0 +IFFFormat DB "AIFF Sample", 0 + +Unchecked DB "Unchecked", 0 +UnknownFormat DB "Unknown module format", 0 +CompressedITModule DB "Compressed " +ITFormat2_0 DB "Impulse Tracker", 0 +ITFormat? DB "Impulse Tracker ?.??", 0 +ST3Format DB "Scream Tracker 3", 0 +MODFormat DB "Amiga-NewTracker", 0 +ProTracker DB "Amiga-ProTracker", 0 +StarTrekker4 DB "4 Channel Startrekker", 0 +StarTrekker8 DB "8 Channel Startrekker", 0 +Channel4 DB "4 Channel MOD", 0 +Channel6 DB "6 Channel MOD", 0 +Channel8 DB "8 Channel MOD", 0 +OldMod DB "Old Amiga-MOD format ? ", 0 +ChannelXX DB 0FDh, "D Channel MOD", 0 +MultiTrackerModule DB "MultiTracker Module", 0 + +ITInstrumentSavedMsg DB "Instrument saved (instrument ", 0FDh, "D)", 0 +InstrumentErrorMsg DB "Error: Instrument ", 0FDh, "D NOT saved! (No Filename?)", 0 +ITSampleSavedMsg DB "Impulse Tracker sample saved (sample ", 0FDh, "D)", 0 +ST3SampleSavedMsg DB "Scream Tracker sample saved (sample ", 0FDh, "D)", 0 +IF SAVESAMPLEWAV +RawSampleSavedMsg DB "WAV Sample saved (sample ", 0FDh, "D)", 0 +ELSE +RawSampleSavedMsg DB "RAW Sample saved (sample ", 0FDh, "D)", 0 +ENDIF +SampleErrorMsg DB "Error: Sample ", 0FDh, "D NOT saved! (No Filename?)", 0 +InitInstrumentMsg DB "Sample assigned to Instrument ", 0FDh, "D", 0 +InitInstrumentErrorMsg DB "Error: No available Instruments!", 0 + +TooManyPatternsMsg DB "Warning: Only 100 patterns supported in S3M format", 0 +ChannelVolumeErrorMsg DB "Warning: Channel volumes unsupported in S3M format", 0 +LinearSlideMsg DB "Warning: Linear slides unsupported in S3M format", 0 +LoopMsg DB "Warning: Sustain and Ping Pong loops unsupported in S3M format", 0 +SampleVolumeMsg DB "Warning: Sample volumes unsupported in S3M format", 0 +SampleVibratoMsg DB "Warning: Sample vibrato unsupported in S3M format", 0 +ST3InstrumentErrorMsg DB "Warning: Instrument functions unsupported in S3M format", 0 +PatternLengthMsg DB "Warning: Pattern lengths other than 64 rows unsupported in S3M format", 0 +ChannelErrorMsg DB "Warning: Data outside 16 channels unsupported in S3M format", 0 +NoteRangeMsg DB "Warning: Notes outside the range C-1 to B-8 are unsupported in S3M format", 0 +PanningErrorMsg DB "Warning: Extended volume column effects are unsupported in S3M format", 0 + +InstrumentLibrary DB 154, 154, "Module", 154, 154, 0 +InstrumentNoSample DB "No Samples", 0 +InstrumentSingleSample DB "1 Sample", 0 +InstrumentSeveralSamples DB 0FDh, "D Samples", 0 +InstrumentUnknownSamples DB "???", 0 +FileSizeMsg DB 0FDh, "Dk", 0 +FreeSampleMsg DB "Available", 13 + DB "Samples: ", 0FDh, 'D', 0 + +IF SAVESAMPLEWAV + WAVEFileHeader DB "RIFF" + WAVEFileSize DD 0 + WAVEFileHeader2 DB "WAVEfmt " + WAVEFileHeaderLength DD 10h + WAVEFileID DW 1 + WAVEChannels DW 1 + WAVEMixSpeed DD 44100 ; Default to CD quality + WAVEBytesPerSecond DD 0 + WAVEBytesPerSample DW 2 + WAVEBits DW 16 + WAVEHeader3 DB "data" + WAVEDataSize DD 0 +ENDIF + +DiskOptions DB 0 +EditTimer DD 0 + +CDRomStartDrive DB 0 ; The first CDRom Drive letter +CDRomEndDrive DB 0 ; The drive AFTER the last cdrom + +FileWindowKeys Label + + DB 0 + DW 1C8h ; Up arrow + DW FileWindow_Up + + DB 0 + DW 1D0h ; Down arrow + DW FileWindow_Down + + DB 0 + DW 1C9h ; PgUp + DW FileWindow_PgUp + + DB 0 + DW 1D1h ; PgDn + DW FileWindow_PgDn + + DB 0 + DW 1C7h ; Home + DW FileWindow_Home + + DB 0 + DW 1CFh ; End + DW FileWindow_End + + DB 4 + DW 10Fh ; Shift Tab + DW FileWindow_ShiftTab + + DB 0 + DW 10Fh ; Tab + DW FileWindow_Right + + DB 0 + DW 1CDh ; Right arrow + DW FileWindow_Right + + DB 0 + DW 1CBh ; Left arrow + DW FileWindow_Left + + DB 0 + DW 1D3h ; Delete + DW FileWindow_DeleteFile + + DB 0FFh + +DirectoryWindowKeys Label + + DB 0 + DW 1C8h + DW DirectoryWindow_Up + + DB 0 + DW 1D0h + DW DirectoryWindow_Down + + DB 0 + DW 1C9h ; PgUp + DW DirectoryWindow_PgUp + + DB 0 + DW 1D1h ; PgDn + DW DirectoryWindow_PgDn + + DB 0 + DW 1C7h ; Home + DW DirectoryWindow_Home + + DB 0 + DW 1CFh ; End + DW DirectoryWindow_End + + DB 4 + DW 10Fh ; Shift Tab + DW DirectoryWindow_Left + + DB 0 + DW 10Fh ; Tab + DW FileWindow_Left ; Same object num + + DB 0 + DW 1CDh ; Right arrow + DW FileWindow_Left + + DB 0 + DW 1CBh ; Left arrow + DW DirectoryWindow_Left + + DB 0 + DW 11Ch ; Enter + DW DirectoryWindow_Enter + + DB 0FFh + +DriveWindowKeys Label + + DB 0 + DW 1C8h + DW DriveWindow_Up + + DB 0 + DW 1D0h + DW DriveWindow_Down + + DB 4 + DW 10Fh ; Shift-Tab + DW FileWindow_Right + + DB 0 + DW 10Fh ; Tab + DW DriveWindow_Tab + + DB 0 + DW 1CDh ; Right arrow + DW DirectoryWindow_Left + + DB 0 + DW 1CBh ; Left arrow + DW FileWindow_Right + + DB 0 + DW 11Ch ; Enter + DW DriveWindow_Enter + + DB 0FFh + +SaveDriveWindowKeys Label + + DB 0 + DW 1C8h + DW DriveWindow_Up + + DB 0 + DW 1D0h + DW DriveWindow_Down + + DB 4 + DW 10Fh ; Shift-Tab + DW FileWindow_Right + + DB 0 + DW 10Fh ; Tab + DW SaveDriveWindow_Tab + + DB 0 + DW 1CDh ; Right arrow + DW SaveDriveWindow_Tab + + DB 0 + DW 1CBh ; Left arrow + DW FileWindow_Right + + DB 0 + DW 11Ch ; Enter + DW DriveWindow_Enter + + DB 0FFh + +LSDriveWindowKeys Label + + DB 0 + DW 1C8h + DW DriveWindow_Up + + DB 0 + DW 1D0h + DW DriveWindow_Down + + DB 4 + DW 10Fh ; Shift-Tab + DW DriveWindow_Tab ; goto object number 15 + + DB 0 + DW 10Fh ; Tab + DW LSDriveWindow_Right + + DB 0 + DW 1CDh ; Right arrow + DW LSDriveWindow_Right + + DB 0 + DW 1CBh ; Left arrow + DW DriveWindow_Tab + + DB 0 + DW 11Ch ; Enter + DW LS_DriveWindow_Enter + + DB 0FFh + +LIDriveWindowKeys Label + + DB 0 + DW 1C8h + DW DriveWindow_Up + + DB 0 + DW 1D0h + DW DriveWindow_Down + + DB 0 + DW 1CBh ; Left arrow + DW LIDriveWindow_Tab + + DB 0 + DW 10Fh ; Tab + DW LIDriveWindow_Tab + + DB 0 + DW 11Ch ; Enter + DW LI_DriveWindow_Enter + + DB 0FFh + +LoadInstrumentKeys Label + DB 0 + DW 11Ch ; Enter + DW LIWindow_Enter + +ViewInstrumentKeys Label + DB 0 + DW 1C8h + DW LIWindow_Up + + DB 0 + DW 1D0h + DW LIWindow_Down + + DB 0 + DW 1C9h ; PgUp + DW LIWindow_PgUp + + DB 0 + DW 1D1h ; PgDn + DW LIWindow_PgDn + + DB 0 + DW 1C7h ; Home + DW LIWindow_Home + + DB 0 + DW 1CFh ; End + DW LIWindow_End + + DB 0 + DW 1D3h ; Delete + DW D_DeleteInstrumentFile + + DB 0 + DW 11Ch ; Enter + DW LIViewWindow_Enter + + DB 0 + DW 1CDh ; Right arrow + DW LIViewWindow_Tab + + DB 0 + DW 10Fh ; Tab + DW LIViewWindow_Tab + + DB 0FFh + +LSWindowKeys Label + DB 0 + DW 11Ch ; Enter + DW LSWindow_Enter + +LSViewWindowKeys Label + DB 0 + DW 139h + DW LSWindow_Space ; Edit sample name + + DB 0 + DW 1C8h + DW LSWindow_Up + + DB 0 + DW 1D0h + DW LSWindow_Down + + DB 0 + DW 1C9h ; PgUp + DW LSWindow_PgUp + + DB 0 + DW 1D1h ; PgDn + DW LSWindow_PgDn + + DB 0 + DW 1C7h ; Home + DW LSWindow_Home + + DB 0 + DW 1CFh ; End + DW LSWindow_End + + DB 0 + DW 1CDh ; Right arrow + DW FileWindow_ShiftTab + + DB 0 + DW 10Fh ; Tab + DW FileWindow_ShiftTab ; Object 16 + + DB 0 + DW 1D3h ; Delete + DW D_DeleteSampleFile + + DB 0 + DW 11Ch ; Enter + DW LSViewWindow_Enter + + DB 0FFh + + + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Functions ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Proc D_InitDisk Far + + Push DS + + Push CS + Pop DS + Assume DS:Disk + ; Get date/time for CACHE.IT file + + Trace " - Finding CDROM Drives" + + Mov AX, 1500h + Xor BX, BX + Int 2Fh + Cmp AL, 0FFh + JNE D_InitDiskNoCDROM + Test BX, BX + JZ D_InitDiskNoCDROM + + Add CL, 'A' + Mov CDRomStartDrive, CL + Add CX, BX + Mov CDRomEndDrive, CL + +D_InitDiskNoCDROM: + Trace " - Determining main directory" + + Mov SI, Offset DOSDirectory + Call D_GetDriveDirectory + + Trace " - Initialising cache file parameters" + + Mov AH, 2Ah + Int 21h ; Get Date + Mov AX, CX ; Now to get date in yyyyyyym mmmddddd + Sub AX, 1980 + ShL AX, 9 ; Year + Or AL, DL ; Day + Xor DL, DL + ShR DX, 3 + Or AX, DX ; Month + Mov Date, AX + + Mov AH, 2Ch + Int 21h ; Get time + Mov AX, CX ; Now to get time in hhhhhmmm mmmsssss + ShL AL, 2 ; AX = ...hhhhh mmmmmm.. + ShL AX, 3 ; AX = hhhhhmmm mmm..... + ShR DH, 1 ; DH = ...sssss + Or AL, DH + Mov Time, AX + + Cmp StartingDirectory, 0 + JNE D_InitDisk2 + + Trace " - Determining available drives" + +D_InitDisk1: + Mov AH, 19h + Int 21h + + Mov StartingDrive, AL + + Mov CX, 26 + Xor BX, BX + Xor SI, SI + +D_InitDisk3: + Mov DL, BL + Mov AH, 0Eh + Int 21h + + Mov AH, 19h + Int 21h + Cmp AL, BL + JNE D_InitDisk4 + + Cmp BL, StartingDrive + JNE D_InitDisk9 + + Mov AX, SI + Mov CurrentDrive, AL + +D_InitDisk9: + Test DiskOptions, 1 + JNZ D_InitDisk10 + + Mov AX, 440Eh ; This code was to prevent + ; A and B drives being shown + ; on older DOS systems when + ; only one drive was present. + ; For some reason, it crashes + ; one in a thousand computers. + ; hence the option /x3 + Push BX + Xor BL, BL + Int 21h + + Pop BX + JC D_InitDisk10 + And AL, AL + JZ D_InitDisk10 + Dec AX + Cmp AL, BL + JNE D_InitDisk4 + +D_InitDisk10: + Mov [DrivesAvail+SI], BL + Inc SI + +D_InitDisk4: + Inc BX + Loop D_InitDisk3 + + Mov BX, SI + Mov NumDrives, BL + + Mov DL, StartingDrive + Mov AH, 0Eh + Int 21h + +D_GetStartingDirectory1: ; FS=PSP. + Push CS + Pop ES + + Mov DI, Offset StartingDirectory + + Mov DS, [FS:2Ch] ; Environment thingy. + Xor SI, SI + Mov CX, 7FFFh + +D_GetStartingDirectory2: + Cmp Word Ptr [SI], 0 + JE D_GetStartingDirectory3 + + Inc SI + Loop D_GetStartingDirectory2 + + Jmp D_GetStartingDirectoryEnd + +D_GetStartingDirectory3: ; DS:SI points to 0... + Add SI, 4 + Push SI ; Now to work out count. + + Xor DX, DX + Mov CX, 1 + +D_GetStartingDirectory4: + LodsB + And AL, AL + JZ D_GetStartingDirectory5 + + Inc DX + + Cmp AL, '\' + JNE D_GetStartingDirectory4 + + Mov CX, DX + Jmp D_GetStartingDirectory4 + +D_GetStartingDirectory5: + Pop SI + + Dec CX + Rep MovsB + Xor AL, AL + StosB + +D_GetStartingDirectoryEnd: + Push CS + Pop DS + + Mov SI, Offset StartingDirectory + Call D_SetDriveDirectory + + Mov DI, Offset SongDirectory + Cmp Byte Ptr [DI], 0 + JNE D_InitDisk11 + + Push SI + +D_InitDisk5: + LodsB + And AL, AL + JZ D_InitDisk6 + + StosB + Jmp D_InitDisk5 + +D_InitDisk6: + Cmp Byte Ptr [ES:DI-1], '\' + JNE D_InitDisk15 + + Dec DI + +D_InitDisk15: + Mov AX, '\' + 256*'S' + StosW + Xor AL, AL + StosB + + Pop SI + +D_InitDisk11: + Mov DI, Offset SampleDirectory + Cmp Byte Ptr [DI], 0 + JNE D_InitDisk12 + +D_InitDisk7: + LodsB + And AL, AL + JZ D_InitDisk8 + + StosB + Jmp D_InitDisk7 + +D_InitDisk8: + Cmp Byte Ptr [ES:DI-1], '\' + JNE D_InitDisk16 + + Dec DI + +D_InitDisk16: + Mov AX, '\' + 256*'I' + StosW + Xor AL, AL + StosB + +D_InitDisk12: + Mov DI, Offset InstrumentDirectory + Cmp Byte Ptr [DI], 0 + JNE D_InitDisk13 + + Mov SI, Offset SampleDirectory + Mov CX, 70 + Rep MovsB + + Mov SI, Offset SongDirectory + Call D_SetDriveDirectory + Mov SI, Offset SampleDirectory + Call D_SetDriveDirectory + Mov SI, Offset InstrumentDirectory + Call D_SetDriveDirectory + +D_InitDisk13: + Push CS + Pop DS + + Mov SI, Offset StartingDirectory + Call D_SetDriveDirectory + + Trace " - Loading configuration file" + + Mov AX, 3D00h ; Get config. + Mov DX, Offset ConfigFileName + Int 21h + JC D_InitDisk2 + + Mov BX, AX ; BX = file handle + + Trace " - Processing configuration file" + + Mov AH, 3Fh + Mov CX, 211 ; Load Directories+Keyboard + Mov DX, Offset SongDirectory + Int 21h ; Read config file.. + + Call S_GetPaletteOffset ; Read palette stuff. + Mov AH, 3Fh + Mov CX, 3*16 + Int 21h + + Call S_SetPalette + + Call Display_GetDisplayWindowData + Mov AH, 3Fh + Mov CX, 50 + Int 21h + + Call PE_GetPatternConfigOffset + Mov AH, 3Fh + Mov CX, 218 + Int 21h + + Call I_GetPresetEnvelopeOffset + Mov AH, 3Fh + Mov CX, 810 + Int 21h + + Mov AH, 3Eh ; Close file. + Int 21h + +D_InitDisk2: ; Load font data.. and set it. + Push CS + Pop DS + Assume DS:Disk + + Mov SI, Offset StartingDirectory + Call D_SetDriveDirectory + + Mov AX, 3D00h + Mov DX, Offset FontFileName + Int 21h + JC D_NoFontFile + + Trace " - Loading custom font file" + + Call S_GetGenerationTableOffset + Push ES + Pop DS + Mov DX, DI + + Mov BX, AX + Mov AH, 3Fh + Mov CX, 2048 + Int 21h + JC D_BadFontRead + Cmp AX, CX + JNE D_BadFontRead + + Trace " - Initialising custom font file" + + Push BX + + Mov SI, DX + Xor AX, AX + Mov BX, 256 + Call S_RedefineCharacters + + Pop BX + +D_BadFontRead: + Mov AH, 3Eh + Int 21h + +D_NoFontFile: + Push CS + Pop DS + + Call CheckTimerData + + Pop DS + Ret + +EndP D_InitDisk + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_UnInitDisk Far + + Push CS + Pop DS + Assume DS:Disk + + Mov AX, DiskDataArea + Test AX, AX + JZ D_UnInitDisk1 + + Mov ES, AX + Mov AH, 49h + Int 21h + + +D_UnInitDisk1: + Call ReleaseTimerData + Mov SI, Offset DOSDirectory + Call D_SetDriveDirectory + + Ret + +EndP D_UnInitDisk + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_GetDriveDirectory ; DS:SI points to buffer + + Push AX + Push DX + Push SI + + Mov AH, 19h + Int 21h + + Add AL, 'A' + Mov [SI], AL + Mov Word Ptr [SI+1], ':' + 256*'\' + Add SI, 3 + Mov AH, 47h + Xor DX, DX + Int 21h + + Pop SI + Pop DX + Pop AX + + Ret + +EndP D_GetDriveDirectory + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_SetDriveDirectory ; DS:SI points to dir. + + Push AX + Push BX + Push DX + + Xor DX, DX + + Cmp Byte Ptr [SI+1], ':' + JNE D_SetDriveDirectory2 + + Mov DL, [SI] + Cmp DL, 'a' + JB D_SetDriveDirectory1 + Cmp DL, 'z' + JA D_SetDriveDirectory1 + + Add DL, 'A'-'a' + +D_SetDriveDirectory1: + Sub DL, 'A' + Cmp DL, 25 ; Drive > 'Z'?? + JA D_SetDriveDirectory4 + + Mov AX, 440Eh + Mov BL, DL + Inc BX + Int 21h + JC D_SetDriveDirectory3 + And AL, AL + JZ D_SetDriveDirectory3 + + Mov AX, 440Fh + Int 21h + +D_SetDriveDirectory3: + Mov AH, 0Eh + Int 21h ; This causes hanging on re-run!!! + +D_SetDriveDirectory4: + Mov DX, 2 + +D_SetDriveDirectory2: + Add DX, SI + Mov AH, 3Bh + Int 21h + + Call D_GetDriveDirectory + + Pop DX + Pop BX + Pop AX + Ret + +EndP D_SetDriveDirectory + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_LoadFileNames + + Mov ES, CS:DiskDataArea + Xor DI, DI + Xor AX, AX + Mov CX, 32768 + Rep StosW + + Push CS + Push CS + + Pop DS + Pop ES + Assume DS:Disk + + Mov NumFileInfo, 0 + Mov NumEntries, 0 + Mov CurrentDirectory, 0 + + Mov SI, Offset FileSpecifier + +D_LoadFileNames1: + Mov DI, Offset FileTempSpecifier + +D_LoadFileNames2: + LodsB + And AL, AL + JZ D_LoadFileNames3 + + Cmp AL, ',' + JE D_LoadFileNames3 + + Cmp AL, ' ' + JE D_LoadFileNames2 + + StosB + Jmp D_LoadFileNames2 + +D_LoadFileNames3: + Xor AL, AL + StosB ; ES:DI points to file name. + + Push DS + Push SI + Push ES + Push DI + + Xor BL, BL + Mov CX, 6 ; Hidden/System/Normal files + Mov DX, Offset FileTempSpecifier + Call D_LoadFileNames4 + + Pop DI + Pop ES + Pop SI + Pop DS + + Cmp Byte Ptr [DS:SI-1], 0 + JNE D_LoadFileNames1 + + Mov AX, NumEntries + Mov NumFiles, AX + Cmp CurrentFile, AX + JB D_LoadFileNameUpdateCurrentFile + + Mov CurrentFile, 0 + +D_LoadFileNameUpdateCurrentFile: + Mov DX, Offset AllFilesMask + Mov CX, 10h ; Directories + Mov BX, CX + Call D_LoadFileNames4 + + Mov AX, NumEntries + Sub AX, NumFiles + Mov NumDirectories, AX + + Ret + +D_LoadFileNames4: + Push DX + + Mov DS, DiskDataArea + Assume DS:Nothing + + Mov DX, 60000 + Mov AH, 1Ah + Int 21h ; Shift DTA address.. + + Push CS + Pop DS + Assume DS:Disk + + Mov AH, 4Eh + Pop DX + Int 21h + +D_LoadFileNames5: + JC D_LoadFileNames6 + ; A file is found.... + Cmp NumEntries, 1000 + JAE D_LoadFileNames6 + + Mov AX, 50 + Mul NumEntries + Add AX, 2000 + Mov DI, AX + Mov CX, 21 + + Mov DS, DiskDataArea + Assume DS:Nothing + + Mov SI, 60000+16h + + Cmp Word Ptr [DS:60000+1Eh], '.' + JNE D_LoadFileNames9 + + Mov Byte Ptr [DS:60000+1Eh], '\' + +D_LoadFileNames9: + And BL, BL + JZ D_LoadFileNames7 + + Test [SI-1], BL + JZ D_LoadFileNames8 + +D_LoadFileNames7: + Push DS + Pop ES + Rep MovsB + + Inc CS:NumEntries + +D_LoadFileNames8: + Push CS + Pop DS + Mov AH, 4Fh + Int 21h + Jmp D_LoadFileNames5 + +D_LoadFileNames6: + RetN + +EndP D_LoadFileNames + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_SortRoutine + + Mov DS, DiskDataArea + Push DS + Pop ES + + Mov SI, CX ; Start + + ; OK, so SI = current, + ; CX/DX = range + +D_SortRoutine2: + Cmp SI, DX + JAE D_SortRoutine1 + + Push DX + Push SI + + Push CX + Push DX + + Mov AX, 50 + Mul SI + Add AX, 2000 + Mov SI, AX + + Mov AX, 50 + Mul CX + Add AX, 2000 + Mov DI, AX + + Xor BX, BX + Pop DX + + Cmp Word Ptr [SI+8], '\' + JE D_SortRoutine4 + +D_SortRoutine3: + Cmp CX, DX + JAE D_SortRoutine4 + + Cmp Word Ptr [DI+8], '\' + JE D_SortRoutine6 + + Push CX + Push SI + Push DI + + Add SI, 8 + Add DI, 8 + Mov CX, 13 + + RepE CmpsB + + Pop DI + Pop SI + Pop CX + + JB D_SortRoutine5 + JA D_SortRoutine6 + Cmp DI, SI + JBE D_SortRoutine5 + +D_SortRoutine6: + Inc BX + +D_SortRoutine5: + Inc CX + Add DI, 50 + + Jmp D_SortRoutine3 + +D_SortRoutine4: + Pop CX + Add BX, CX + Add BX, BX + Mov [BX], SI + + Pop SI + Pop DX + Inc SI + Jmp D_SortRoutine2 + +D_SortRoutine1: + Ret + +EndP D_SortRoutine + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_SortFileNames + + Xor CX, CX + Mov DX, CS:NumFiles + Call D_SortRoutine + + Ret + +EndP D_SortFileNames + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_SortDirNames + + Mov CX, CS:NumFiles + Mov DX, CX + Add DX, CS:NumDirectories + Call D_SortRoutine + + Ret + +EndP D_SortDirNames + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_InitLoadModule Far + + Push DS + Push ES + Push DI + + Push CS + Push CS + Pop DS + Pop ES + Assume DS:Disk + + Mov SI, Offset FileSpecifierDefault + Mov DI, Offset FileSpecifier + Mov CX, 65 + Rep MovsB + + Pop DI + Pop ES + Pop DS + Assume DS:Nothing + +Proc D_InitLoadModule2 Far + + Cmp CS:FileSpecifier, 0 + JE D_InitLoadModule + + Push DS + Push ES + Push DI + + Push CS + Push CS + Pop DS + Pop ES + Assume DS:Disk + + Mov DI, Offset CurrentSearchPos + Mov CX, 14 + Xor AL, AL + Rep StosB + + Mov LoadSongNameCount, 0 + + Mov SI, Offset SongDirectory + Call D_SetDriveDirectory ; DS:SI points to cur dir. + + Call D_LoadFileNames + Call D_SortFileNames + Call D_SortDirNames + + Pop DI + Pop ES + Pop DS + Ret + +EndP D_InitLoadModule2 + +EndP D_InitLoadModule + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_DrawFileWindow Far ; Layout of filenames in memory + ; Start at offset 2000 + ; Pointers to filenames at 0 + + Push CS + Pop DS + Assume DS:Disk + + Call S_GetDestination + + Mov AX, TopFile + Mov BX, CurrentFile + Cmp AX, BX + JBE D_DrawFileWindow1 + + Mov AX, BX + +D_DrawFileWindow1: + LEA CX, [EAX+30] + Cmp CX, BX + JA D_DrawFileWindow2 + + LEA AX, [BX-30] + +D_DrawFileWindow2: + Mov TopFile, AX + Mov BX, AX ; BX = filenum + + Mov DS, DiskDataArea + Assume DS:Nothing + + Mov DI, (3+13*80)*2 + Mov CX, 31 + + +D_DrawFileWindow3: + LEA SI, [EBX+EBX] + Mov SI, [SI] + + Push DI + + Cmp BX, NumFiles + JAE D_DrawFileWindow4 + + Push SI + Push DI + + Mov AH, 2 + Cmp CS:FileColours, 0 + JE D_DrawFileWindow28 + + Mov AH, 6 ; Not checked colour + Mov AL, [SI+23] + + Test AL, AL + JE D_DrawFileWindow28 + + Mov AH, 7 ; Not known colour + Cmp AL, 1 + JE D_DrawFileWindow28 + + Mov AH, 3 ; Impulse Tracker colour + Cmp AL, 3 + JBE D_DrawFileWindow28 + Cmp AL, 7 + JE D_DrawFileWindow28 + + Mov AH, 5 ; Scream Tracker colour + Cmp AL, 8 + JBE D_DrawFileWindow28 + + Mov AH, 2 ; MOD/MTM colour + +D_DrawFileWindow28: + Push CX + + Add SI, 8 + Mov CX, 12 + +D_DrawFileWindow6: + LodsB + StosW + + And AL, AL + LoopNZ D_DrawFileWindow6 + +; JCXZ D_DrawFileWindow30 + + Xor AL, AL + Rep StosW + + Pop CX + +; D_DrawFileWindow30: + Pop DI + Pop SI + +D_DrawFileWindow4: + Add DI, 24 + Add SI, 25 + + Mov AX, 2A8h + StosW + + Cmp BX, NumFiles + JAE D_DrawFileWindow9 + + Mov AH, 2 ; Song name.. + Mov DX, 25 + + Add AH, CS:FileColours + +D_DrawFileWindow5: + LodsB + Cmp AL, 226 + JB D_DrawFileCharFilter + + Mov AL, ' ' + +D_DrawFileCharFilter: + StosW + + Dec DX + JNZ D_DrawFileWindow5 + +D_DrawFileWindow9: + Pop DI + Add DI, 160 + Inc BX + + Loop D_DrawFileWindow3 + + Push CS + Pop DS + Assume DS:Disk + + Cmp NumFiles, 0 + JE D_DrawFileWindow7 + + Jmp D_DrawFileWindow11 + +D_DrawFileWindow7: + Mov SI, Offset NoFilesMsg + Mov DI, (3+13*80)*2 + Mov AH, 7 + Mov CX, 9 + +D_DrawFileWindow8: + LodsB + StosW + + Loop D_DrawFileWindow8 + +D_DrawFileWindow11: +; Push CS ; Not necessary +; Pop DS + + Mov SI, Offset Search + Mov DI, (51+37*80)*2 + Mov CX, 13 + Mov AH, 5 + +D_DrawFileWindow10: + LodsB + StosW + + Loop D_DrawFileWindow10 + + Cmp NumFiles, 0 + JNE D_DrawFileWindow12 + + Ret + +D_DrawFileWindow12: + Mov BX, CurrentFile + Add BX, BX + + Mov DS, DiskDataArea + Assume DS:Nothing + + Mov BX, [BX] + Mov SI, [BX+23] + Mov AL, [BX+22] + Mov DI, (51+40*80)*2 + + Push CS + Pop DS + Assume DS:Disk + + Add SI, SI + Mov SI, [FormatNames+SI] + Cmp SI, Offset ChannelXX + JNE D_DrawFileWindow29 + + Xor AH, AH + Push AX ; Number of channels for MOD + + Mov AH, 5 + Call S_DrawString + Pop AX ; Add SP, 2 + + Jmp D_DrawFileWindow14 + +D_DrawFileWindow29: + Mov AH, 5 + +D_DrawFileWindow13: + LodsB + And AL, AL + JZ D_DrawFileWindow14 + + StosW + Jmp D_DrawFileWindow13 + +D_DrawFileWindow14: + Mov DS, DS:DiskDataArea + Assume DS:Nothing + + Mov DX, [BX+6] + Mov AX, [BX+4] + Cmp DX, 10000 + + JAE D_DrawFileWindow15 + + Mov DI, (51+41*80)*2 + + Mov CX, 10000 + Div CX ; DX = remainder. AX = main. + + Mov BP, AX + + Mov CX, 4 + Mov SI, 10 + Mov AX, DX + +D_DrawFileWindow16: + Xor DX, DX + Div SI + Add DL, '0' + Push DX + + Loop D_DrawFileWindow16 + + Mov AX, BP + + Mov CX, 5 + +D_DrawFileWindow17: + Xor DX, DX + Div SI + Add DL, '0' + Push DX + + Loop D_DrawFileWindow17 + + Mov CX, 9 + +D_DrawFileWindow18: + Pop AX + Mov AH, 5 + StosW + Loop D_DrawFileWindow18 + +D_DrawFileWindow15: ; OK, time for a date :) + Mov DX, [DS:BX] ; DX = time + Mov BX, [DS:BX+2] ; BX = date + + Push CS + Pop DS + Assume DS:Disk + + Mov DI, (51+42*80)*2 + Mov AX, BX + ShR AX, 5 + And AX, 0Fh + LEA SI, [EAX+EAX] + Mov SI, [MonthNames+SI] + + Mov AH, 5 + +D_DrawFileWindow19: + LodsB + StosW + And AL, AL + JNZ D_DrawFileWindow19 + + Mov AL, BL + And AX, 31 + Mov CH, 10 + Div CH + And AL, AL + JZ D_DrawFileWindow20 + + Push AX + Add AL, '0' + Mov AH, 5 + StosW + + Pop AX + +D_DrawFileWindow20: + Mov AL, AH + Add AL, '0' + Mov AH, 5 + StosW + + Mov AL, ',' + StosW + + Mov AL, ' ' + StosW + + Push DX + Mov AL, BH + ShR AX, 1 + And AX, 7Fh + Add AX, 1980 + Mov DX, 0FFFFh + Push DX + + Mov SI, 10 + +D_DrawFileWindow21: + Xor DX, DX + Div SI + Add DL, '0' + Push DX + + And AX, AX + JNZ D_DrawFileWindow21 + +D_DrawFileWindow22: + Pop AX + Cmp AX, 0FFFFh + JE D_DrawFileWindow23 + + Mov AH, 5 + StosW + + Jmp D_DrawFileWindow22 + +D_DrawFileWindow23: + Pop DX + Mov DI, (51+43*80)*2 + + Mov AX, DX + ShR AX, 11 + + Xor BL, BL ; if BL = 0, then am, otherwise + ; pm.. + Cmp AX, 12 + JB D_DrawFileWindow24 + + Inc BX + Sub AX, 12 + +D_DrawFileWindow24: + And AX, AX + JNZ D_DrawFileWindow25 + + Add AX, 12 + +D_DrawFileWindow25: + Mov BH, 10 + Div BH + And AL, AL + JZ D_DrawfileWindow26 + + Push AX + Add AL, '0' + Mov AH, 5 + StosW + + Pop AX + +D_DrawFileWindow26: + Mov AL, AH + Add AL, '0' + Mov AH, 5 + StosW + + Mov AL, ':' + StosW + + Mov AX, DX + ShR AX, 5 + And AX, 63 + + Div BH + Mov BH, AH + + Add AL, '0' + Mov AH, 5 + StosW + + Mov AL, BH + Add AL, '0' + StosW + + Mov AL, 'a' + And BL, BL + JZ D_DrawFileWindow27 + + Mov AL, 'p' + +D_DrawFileWindow27: + StosW + Mov AL, 'm' + StosW + + Ret + +EndP D_DrawFileWindow + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_DrawDirectoryWindow Far + + Push CS + Pop DS + Assume DS:Disk + + Call S_GetDestination + + Mov AX, TopDirectory + Mov BX, CurrentDirectory + Cmp AX, BX + JBE D_DrawDirectoryWindow1 + + Mov AX, BX + +D_DrawDirectoryWindow1: + LEA CX, [EAX+20] + Cmp CX, BX + JA D_DrawDirectoryWindow2 + + LEA AX, [BX-20] + +D_DrawDirectoryWindow2: + Mov TopDirectory, AX + Mov BX, AX + + Mov CX, 21 + Mov DI, (44+13*80)*2 + + Mov DS, DiskDataArea + Assume DS:Nothing + +D_DrawDirectoryWindow3: + Cmp BX, CS:NumDirectories + JAE D_DrawDirectoryWindow4 + + Mov SI, BX + Add SI, CS:NumFiles + Add SI, SI + Mov SI, [SI] + + Push DI + + Add SI, 8 + Mov AH, 5 + +D_DrawDirectoryWindow5: + LodsB + And AL, AL + JZ D_DrawDirectoryWindow8 + + StosW + Jmp D_DrawDirectoryWindow5 + +D_DrawDirectoryWindow8: + Pop DI + Add DI, 160 + Inc BX + + Loop D_DrawDirectoryWindow3 + +D_DrawDirectoryWindow4: + Push CS + Pop DS + Assume DS:Disk + + Cmp NumDirectories, 0 + JE D_DrawDirectoryWindow6 + + Ret + +D_DrawDirectoryWindow6: + Mov SI, Offset NoDirsMsg + Mov DI, (44+13*80)*2 + Mov AH, 7 + Mov CX, 8 + +D_DrawDirectoryWindow7: + LodsB + StosW + + Loop D_DrawDirectoryWindow7 + + Ret + +EndP D_DrawDirectoryWindow + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_DrawDriveWindow Far + + Push CS + Pop DS + Assume DS:Disk + + Call S_GetDestination + + Mov AL, TopDrive + Mov BL, CurrentDrive + Cmp AL, BL + JBE D_DrawDriveWindow1 + + Mov AL, BL + +D_DrawDriveWindow1: + Mov CL, AL + Add CL, 20 + Cmp CL, BL + JA D_DrawDriveWindow2 + + Mov AL, BL + Sub AL, 20 + +D_DrawDriveWindow2: + Mov TopDrive, AL + Mov BL, AL + Mov CX, 21 + + Mov DI, (59+13*80)*2 + Xor BH, BH + +D_DrawDriveWindow3: + Cmp BL, NumDrives + JAE D_DrawDriveWindow5 + + Push DI + + Mov AL, [DrivesAvail+BX] + Add AL, 'A' + Mov SI, Offset DriveMsg + Mov [SI+6], AL + + Mov AH, 5 + Mov DX, 8 + +D_DrawDriveWindow4: + LodsB + StosW + + Dec DX + JNZ D_DrawDriveWindow4 + + Pop DI + Add DI, 160 + Inc BX + Loop D_DrawDriveWindow3 + +D_DrawDriveWindow5: + Ret + +EndP D_DrawDriveWindow + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_LoadFileHeader ; Given DS:SI = filename + + Push BP + + Xor BP, BP ; BP = 0 (no MMTSR) + + Mov AX, 4370h + Int 21h ; MMTSR installation check. + + Cmp EAX, 4352697Ah + JNE D_LoadFileHeader2 + + Mov AX, 4372h + Int 21h ; Disable MMTSR + + Inc BP + +D_LoadFileHeader2: + Mov DX, SI + Mov AX, 3D00h + Int 21h ; Open File + JC D_LoadFileHeader1 + + Mov BX, AX ; BX = file handle + + Push DS + Pop ES + Mov DI, 60000 + Mov CX, 5536 + Xor AL, AL + Rep StosB ; Clear data area first... + + Mov AH, 3Fh + Mov CX, 5536 + Mov DX, 60000 + Int 21h + PushF + + JC D_LoadFileHeader5 + Test BP, BP + JZ D_LoadFileHeader5 + + Cmp DWord Ptr [DS:60000], 'CRiz' + JNE D_LoadFileHeader5 + + Cmp DWord Ptr [DS:60004], 'aiNO' + JNE D_LoadFileHeader5 + ; OK.. have a MMCMPed file. + Mov AX, 4200h + Mov DX, [DS:60018] + Mov CX, [DS:60020] + Int 21h + + Mov AH, 3Fh + Mov CX, 4 + Mov DX, 60000 + Int 21h + Cmp AX, CX + JNE D_LoadFileHeader5 + + Mov AX, 4200h + Mov DX, [DS:60000] + Mov CX, [DS:60002] + Int 21h ; Seek to offset in file. + + Mov AH, 3Fh + Mov CX, 28 + Mov DX, 60000 + Int 21h + Cmp AX, CX + JNE D_LoadFileHeader5 + + Mov AX, [DS:60014] + ShR AX, 4 + And AL, 7 + JNZ D_LoadFileHeader5 + + PopF + Mov AH, 3Fh + Mov CX, 5536 + Mov DX, 60000 + Int 21h + PushF + +D_LoadFileHeader5: + Mov AH, 3Eh ; Close file + Int 21h + +D_LoadFileHeader4: + Test BP, BP + JZ D_LoadFileHeader3 + ; Reenable MMTSR + Mov AX, 4371h + Int 21h + +D_LoadFileHeader3: + PopF + + Pop BP + StI ; For problems with MMTSR + Ret + +D_LoadFileHeader1: + StC + PushF + Jmp D_LoadFileHeader4 + +EndP D_LoadFileHeader + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_LoadModuleHeader + + Mov DS, DiskDataArea + Assume DS:Nothing + + Add BX, BX + Mov SI, [BX] + Add SI, 8 + + Call D_LoadFileHeader + + Ret + +EndP D_LoadModuleHeader + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_LoadSongNames Far ; Part of idle list. + + Call K_IsAnyKeyDown + And AL, AL + JNZ D_LoadSongNames2 + + Call GetKeyboardLock + And AL, AL + JNZ D_LoadSongNames2 + + Push CS + Pop DS + Assume DS:Disk + + Mov BX, LoadSongNameCount + Cmp BX, NumFiles + JB D_LoadSongNames1 + +D_LoadSongNames2: + Xor AX, AX ; No redraw screen. + Ret + +D_LoadSongNames1: + Inc LoadSongNameCount + + Call D_LoadModuleHeader + JC D_LoadSongNames3 + + Call D_GetSongNameModuleType + +D_LoadSongNames3: + + Mov AX, 1 ; Signify redraw screen + Ret + +EndP D_LoadSongNames + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_PreFileWindow Far + + Push CS + Pop DS + Assume DS:Disk + + Mov AX, CurrentFile + Sub AX, TopFile + Add AX, 13 + Mov BX, 160 + Mul BX + + Call S_GetDestination + + LEA DI, [EAX+6] + Mov CX, 38 + +D_PreFileWindow1: + Mov AX, [ES:DI] + Cmp CX, 26 + +; Cmp AL, 168 + JNE D_PreFileWindow2 + + Mov AH, 32h + Jmp D_PreFileWindow3 + +D_PreFileWindow2: + Mov AH, 30h + +D_PreFileWindow3: + StosW + + Loop D_PreFileWindow1 + + Mov DI, (51+37*80)*2 + Xor AH, AH + Mov AL, CurrentSearchPos + LEA DI, [EDI+EAX*2+1] + Mov AL, 60h + StosB + + Ret + +EndP D_PreFileWindow + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_PreDirectoryWindow Far + + Push CS + Pop DS + Assume DS:Disk + + Mov AX, CurrentDirectory + Sub AX, TopDirectory + Add AX, 13 + Mov BX, 160 + Mul BX + + Call S_GetDestination + + LEA DI, [EAX+88] + + Mov CX, 12 + +D_PreDirectoryWindow1: + Mov AX, [ES:DI] + Mov AH, 30h + StosW + + Loop D_PreDirectoryWindow1 + + Ret + +EndP D_PreDirectoryWindow + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_PreDriveWindow Far + + Push CS + Pop DS + Assume DS:Disk + + Mov AL, CurrentDrive + Sub AL, TopDrive + Add AL, 13 + Mov AH, 160 + Mul AH + + Call S_GetDestination + LEA DI, [EAX+118] + Mov CX, 8 + +D_PreDriveWindow1: + Mov AX, [ES:DI] + Mov AH, 30h + StosW + + Loop D_PreDriveWindow1 + + Ret + +EndP D_PreDriveWindow + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_LoadFileOpenErrorMsg Far + + Mov DI, (4+16*80)*2 + Mov AH, 4 + + Push CS + Pop DS + Assume DS:Disk + + Mov SI, Offset OpenErrorMsg + + Call S_DrawString + + Mov AX, 1 + Ret + +EndP D_LoadFileOpenErrorMsg + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_Decompress16BitData + +; Register usage: +; BX = LastValue +; CH = Bitdepth +; CL = 16-Bitdepth, 0 for Bitdepth > 16 +; DL = Bitsread +; DH = scratch + + PushAD + Mov BP, CX + Mov CX, 1100h + ShR BP, 1 + Xor DX, DX + Xor BX, BX + +D_Decompress16BitData1: + Push CX + + Mov EAX, [SI] + Mov CL, DL + ShR EAX, CL + + Add DL, CH + Mov CX, DX + ShR CX, 3 + Add SI, CX + And DL, 7 + + Pop CX + + Cmp CH, 6 + JA D_Decompress16BitA + + ShL EAX, CL + Cmp AX, 8000h + JE D_Decompress16BitDepthChange1 + +D_Decompress16BitD: + SAR AX, CL + +D_Decompress16BitC: + Add BX, AX + Mov [ES:DI], BX + ScasW +; Add DI, 2 + + Dec BP + JNZ D_Decompress16BitData1 + + PopAD + Ret + +D_Decompress16BitDepthChange1: + ShR EAX, 16 + And AL, 15 + + Inc AX + +; Advance bits + Add DL, 4 + +D_Decompress16BitDepthChange3: + Cmp AL, CH + SBB AL, 0FFh + Mov CL, 16 + Mov CH, AL + Sub CL, AL + AdC CL, 0 + + Jmp D_Decompress16BitData1 + +D_Decompress16BitA: + Cmp CH, 16 + JA D_Decompress16BitB + + Push DX + Mov DX, 0FFFFh + ShR DX, CL + And AX, DX + ShR DX, 1 + Add DX, 8 + Cmp AX, DX + JA D_Decompress16BitE + Sub DX, 16 + Cmp AX, DX + JBE D_Decompress16BitE + + Sub AX, DX + Pop DX + Jmp D_Decompress16BitDepthChange3 + +D_Decompress16BitE: + Pop DX + ShL AX, CL + Jmp D_Decompress16BitD + +D_Decompress16BitB: + Test EAX, 10000h + JZ D_Decompress16BitC + + Mov CL, 16 + Inc AX + + Sub CL, AL + Mov CH, AL + + Jmp D_Decompress16BitData1 + +EndP D_Decompress16BitData + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_Decompress8BitData ; DS:SI = source + ; ES:DI = destination + ; CX = count. + + PushA + Mov BP, CX ; BP = counter; + + Mov BX, 900h + Xor CX, CX + Xor DX, DX + +; Register usage: +; BH = Bitdepth +; BL = lastvalue +; CL = 8-bitdepth, undefined for bitdepth > 8 +; CH = Bitsread + +; DX = scratch + +D_Decompress8BitData1: + Push CX + Mov AX, [SI] + Mov CL, CH + +; Get bits loaded into AX properly. + ShR AX, CL + Pop CX + +; Advance SI as necessary. + Add CH, BH + Mov DL, CH + And CH, 7 + ShR DL, 3 + Add SI, DX + + Cmp BH, 6 + JA D_Decompress8BitA + + ShL AX, CL + + Cmp AL, 80h + JE D_Decompress8BitDepthChange1 + +D_Decompress8BitWriteData2: + SAR AL, CL + +D_Decompress8BitWriteData: + Add BL, AL + Mov [ES:DI], BL + + Inc DI + Dec BP + + JNZ D_Decompress8BitData1 + PopA + Ret + +D_Decompress8BitDepthChange1: + Mov AL, AH + Add CH, 3 + + And AL, 7 + Mov DL, CH + + And CH, 7 + ShR DL, 3 + + Add SI, DX + Jmp D_Decompress8BitD + +D_Decompress8BitA: + Cmp BH, 8 + JA D_Decompress8BitC + JE D_Decompress8BitB + + ShL AL, 1 + Cmp AL, 78h + JB D_Decompress8BitWriteData2 + Cmp AL, 86h + JA D_Decompress8BitWriteData2 + + ShR AL, 1 + Sub AL, 3Ch + Jmp D_Decompress8BitD + +D_Decompress8BitB: + Cmp AL, 7Ch + JB D_Decompress8BitWriteData + Cmp AL, 83h + JA D_Decompress8BitWriteData + + Sub AL, 7Ch + +D_Decompress8BitD: + Mov CL, 8 + Inc AX + + Cmp AL, BH + SBB AL, 0FFh + Mov BH, AL + Sub CL, AL + AdC CL, 0 + + Jmp D_Decompress8BitData1 + +D_Decompress8BitC: ; 9 bit representation + And AX, 1FFh + + Test AX, 100h + JZ D_Decompress8BitWriteData + + Jmp D_Decompress8BitD + +EndP D_Decompress8BitData + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +TempData DW 0 +DisableStereoMenu DB 0 + +Proc D_LoadSampleData ; DS:SI points to sample header + ; AX = sample number (0 based) + + Push DS + Push ES + PushAD + + Mov EDX, [DS:SI+30h] + And EDX, EDX + JZ D_NoLoadSample + + Mov CL, [SI+12h] + Mov BP, [SI+2Eh] + + And Byte Ptr [SI+12h], Not 0Ch + Mov Byte Ptr [SI+2Eh], 1 + And BP, 0FFh + + ShL BP, 1 + Mov CH, CL + And CX, 802h + ShL CH, 4 + ShR CL, 1 + Or BP, CX ; BP flags: + ; 1: 16 bit + ; 2: Convert unsigned->signed + ; 4: Swap bytes + ; 8: Delta values. + ; 16: Byte delta values + ; 32: 12-bit sample. + ; 64: Stereo prompt. + ; 8000h: Compressed. + + Xor SI, SI + + Test BP, 1 + JZ D_LoadSampleData5 + + Add EDX, EDX + +D_LoadSampleData5: + Test BP, 64 + JZ D_LoadSampleDataNotStereo + + Cmp CS:DisableStereoMenu, 0 + JNE D_NoStereoMenu + + PushAD + Push DS ES + + Mov DI, Offset O1_StereoSampleList + Mov CX, 0FFFFh + Call M_Object1List + + Mov CS:TempData, DX + + Pop ES DS + PopAD + + Or BP, CS:TempData ; 64 = left + ; 64+128 = right +D_NoStereoMenu: + Add EDX, EDX + +D_LoadSampleDataNotStereo: + Call Music_AllocateSample ; AX = sample no. + ; EDX = length. + ; returns ES:DI. + Inc AX + + Mov EDI, EDX + + Mov DX, ES + Test DX, DX + JZ D_LoadSampleData1 + + Push DS + + Xor CX, CX ; Start with page 0 + +D_LoadSampleData3: + Push AX ; AX = sample no. + Push CX ; CH = page no. + Push EDI ; EDI = bytes remaining + ; SI = delta accumulator + ; BX = file pointer + + Push SI + Call Music_GetSampleLocation + Mov DX, SI + Pop SI + + Mov ECX, 32768 + Cmp EDI, ECX + JA D_LoadSampleData4 + + Mov CX, DI + +D_LoadSampleData4: + Test BP, 32 ; 12 bit format? + JZ NotTX12BitSampleA + + And ECX, 0FFFFh + LEA ECX, [ECX*2+ECX] + Add ECX, 3 + ShR ECX, 2 ; ECX = bytes to read. + +NotTX12BitSampleA: + +; DS:DX point to buffer. For compressed samples, use +; patterndata area. + + Test BP, BP + JNS LoadCompressedSample1 + + Push DS + Push CX + Push DX + + Mov DX, Pattern + Mov DS, DX + Assume DS:Pattern + + Mov DS, Word Ptr [PatternDataArea] + Assume DS:Nothing + + Xor DX, DX + Mov CX, 2 + Mov AH, 3Fh + Int 21h + Mov CX, [DS:0] ; Bytes to read. + Xor DX, DX ; Compressed chunk. + +LoadCompressedSample1: + + Mov AH, 3Fh + Int 21h + +; Now to decompress samples, if required. + + Test BP, BP + JNS LoadCompressedSample3 + + Pop DI + Pop CX + Pop ES + Xor SI, SI + + Test BP, 1 + JNZ LoadCompressedSample2 + + Call D_Decompress8BitData ; 8 bit decode. + Jmp LoadCompressedSample4 + +LoadCompressedSample2: ; 16 bit decode + Call D_Decompress16BitData + +LoadCompressedSample4: + Push ES + Pop DS + + Xor SI, SI + Jmp SecondDelta + +LoadCompressedSample3: + Test BP, 32 ; 12-bit sample? + JZ NotTX12BitSampleB + ; CX = number of bytes read. + ; = 3*2 number of sample read + Push SI + Push DX + + Add AX, 2 + Mov CX, 3 + Div CX + Mov CX, AX + Pop DX + + LEA SI, [EAX*2+EAX] ; SI = AX * 3 + LEA DI, [EAX*4+EDX] + Add SI, DX + + Test CX, CX + JZ ConvertTXSample2 + + Push CX + +ConvertTXSample1: + Sub SI, 3 + Sub DI, 4 + + Mov AX, [SI+1] + ShL AL, 4 + ShL EAX, 16 + Mov AH, [SI] + Mov AL, [SI+1] + And AL, 0F0h + Mov [DI], EAX + + Loop ConvertTXSample1 + + Pop CX + Pop SI + ShL CX, 1 + Jmp D_LoadSampleData10 + +ConvertTXSample2: + Pop SI + Jmp D_LoadSampleData6 + +NotTX12BitSampleB: + Mov CX, AX ; CX = number of bytes read + +SecondDelta: + Test BP, 1 ; 16 bit? + JZ D_LoadSampleData10 + + ShR CX, 1 + +D_LoadSampleData10: + Mov AX, BP + And AX, 5 ; 16 bit and BSwap? + Cmp AX, 5 + JNE D_LoadSampleData11 + + Push CX + Mov DI, DX + +D_LoadSampleData12: + Mov AX, [DI] + XChg AH, AL + Mov [DI], AX + ScasW +; Add DI, 2 + Loop D_LoadSampleData12 + + Pop CX + +D_LoadSampleData11: + Test BP, 24 ; Delta values? + JZ D_LoadSampleData8 + + Push CX + Mov AX, SI + Mov DI, DX + + Test BP, 1 ; 8 bit sample? + JZ D_LoadSampleData9 + + Test BP, 16 ; Byte enforced? + JZ D_LoadSampleData7 + + Add CX, CX + Jmp D_LoadSampleData9 + +D_LoadSampleData7: ; 16 bit delta + Add AX, [DI] + Mov [DI], AX + +; Add DI, 2 + ScasW + Loop D_LoadSampleData7 + + Mov SI, AX + Pop CX + + Jmp D_LoadSampleData8 + +D_LoadSampleData9: ; 8 bit delta + Add AH, [DI] + Mov [DI], AH + Inc DI + Loop D_LoadSampleData9 + + Mov SI, AX + Pop CX + +D_LoadSampleData8: + Test BP, 2 ; unsigned->signed? + JNZ D_LoadSampleData6 + + Push CX + Mov DI, DX + + Test BP, 1 + JNZ D_LoadSampleData14 + +D_LoadSampleData13: ; 8 bit + Xor Byte Ptr [DI], 80h + Inc DI + Loop D_LoadSampleData13 + + Pop CX + + Jmp D_LoadSampleData6 + +D_LoadSampleData14: ; 16 bit.. + Xor Word Ptr [DI], 8000h +; Add DI, 2 + ScasW + Loop D_LoadSampleData14 + + Pop CX + +D_LoadSampleData6: + Test BP, 64 ; Stereo? + JZ D_LoadSampleDataNoStereo + + Push SI ES + + Push DS + Pop ES + + Mov SI, DX + Mov DI, DX + + ShR CX, 1 + JZ D_LoadSampleDataEndStereo + + Test BP, 1 ; 8/16 bit? + JNZ D_LoadSampleDataStereo16BitStart + + Test BP, 128 + JZ D_LoadSampleDataStereo8Bit + + Inc SI + +D_LoadSampleDataStereo8Bit: + MovsB + Inc SI + Loop D_LoadSampleDataStereo8Bit + Jmp D_LoadSampleDataEndStereo + +D_LoadSampleDataStereo16BitStart: + Test BP, 128 + JZ D_LoadSampledataStereo16Bit + + LodsW + +D_LoadSampleDataStereo16Bit: + MovsW + LodsW + Loop D_LoadSampleDataStereo16Bit + +D_LoadSampleDataEndStereo: + Pop ES SI + + Pop EDI + Pop CX + Pop AX + + Inc CH + Jmp D_LoadSampleDataNextChain + +D_LoadSampleDataNoStereo: + Pop EDI + Pop CX + Pop AX + + Add CH, 2 + +D_LoadSampleDataNextChain: + Sub EDI, 32768 + JA D_LoadSampleData3 + + Pop DS + +D_NoLoadSample: + ClC + + PopAD + Pop ES + Pop DS + Ret + +D_LoadSampleData1: + PopAD + PushAD + + Mov AX, 4201h ; Advance file ptr. + Mov DX, [DS:SI+30h] + Mov CX, [DS:SI+32h] + Int 21h + + Call PEFunction_OutOfMemoryMessage + + PopAD + Pop ES + Pop DS + + StC + Ret + +EndP D_LoadSampleData + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ConvertWriteData ; DS:DX points to data + ; BP = 1, convert, BP = 2, 16-bit + ; CX = number of bytes + + PushF + + Push AX + Push CX + Push SI + + Mov AX, 1 + Test BP, 2 + JZ ConvertWriteDataLoop1 + + Inc AX + Inc SI + ShR CX, 1 + +ConvertWriteDataLoop1: + JCXZ ConvertWriteDataLoop3 + +ConvertWriteDataLoop2: + Xor Byte Ptr [SI], 80h + Add SI, AX + Loop ConvertWriteDataLoop2 + +ConvertWriteDataLoop3: + Pop SI + Pop CX + Pop AX + +ConvertWriteData1: + PopF + Ret + +EndP ConvertWriteData + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_SaveSampleDataConvert ; AX = sample number (1 based) + + PushAD + Push DS + Push ES + + Xor BP, BP + + Call Music_GetSampleLocation + Mov EDI, ECX + JZ D_SaveSampleDataConvert5 + + Add EDI, EDI + Or BP, 2 + +D_SaveSampleDataConvert5: + Xor CX, CX ; Start with page 0 + +D_SaveSampleDataConvert3: + Push AX ; AX = sample no. + Push CX ; CX = page no. + + Call Music_GetSampleLocation + Mov DX, SI + + Mov ECX, 32768 + Cmp EDI, ECX + JA D_SaveSampleDataConvert4 + + Mov CX, DI + +D_SaveSampleDataConvert4: + ClI + + Call ConvertWriteData + Call D_SaveBlock + Call ConvertWriteData + + StI + + Pop CX + Pop AX + + JC D_SaveSampleDataConvert2 + + Add CH, 2 + Sub EDI, 32768 + JA D_SaveSampleDataConvert3 + + DB 85h ; ClC +D_SaveSampleDataConvert2: + StC + Pop ES + Pop DS + PopAD + Ret + +EndP D_SaveSampleDataConvert + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc WriteBits ; CH = bits to write + ; CL = current bit. + ; BX = data. + ; ES:DI = output buffer. + ; EAX = buffer + ; BP = scratch + + Push CX + + Mov EBP, 1 + Mov CL, CH + ShL EBP, CL + Dec EBP + And EBX, EBP + + Pop CX + ShL EBX, CL + Add CL, CH + Or EAX, EBX + +D_WriteBits1: + Cmp CL, 8 + JB D_WriteBits2 + + StosB + ShR EAX, 8 + Sub CL, 8 + Jmp D_WriteBits1 + +D_WriteBits2: + Ret + +EndP WriteBits + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +; Data layout: +; DiskDataArea:16384 = deltas +; PatternDataArea:16384 = bittable +; PatternDataArea:0 = bufferlength +; PatternDataArea:2 = outputbuffer + +Proc D_SaveSampleDataCompressed ; AX = sample number, 1 based. + + PushAD + Push DS + Push ES + + Xor BP, BP + + Call Music_GetSampleLocation + Mov EDI, ECX + JZ D_SaveSampleDataCompressed5 + + Add EDI, EDI + Inc BP + +D_SaveSampleDataCompressed5: + Xor CX, CX ; Start with page 0 + +D_SaveSampleDataCompressed3: + Push AX ; AX = sample no. + Push CX ; CX = page no. + Push EDI + + Call Music_GetSampleLocation + + Mov ECX, 32768 + Cmp EDI, ECX + JA D_SaveSampleDataCompressed4 + + Mov CX, DI + +D_SaveSampleDataCompressed4: + Test BP, 1 + JZ D_SaveSampleCompressed8BitSample + + ShR CX, 1 + +D_SaveSampleCompressed8BitSample: +; DS:SI = sample location +; Calculate delats first. + Push BX + Push BP + Push CX + + Mov ES, CS:DiskDataArea + Mov DI, 16384 ; Offset in DiskDataArea + +IF DDCOMPRESS + Mov DX, 1 + + Cmp CS:SaveFormat, 3 + JNE D_SaveFormatNot215 + + Inc DX + +D_SaveFormatNot215: + +ENDIF + +D_CalculateDeltas: + Xor AH, AH ; AH = lastdata. + + Test BP, 1 + JZ D_Calculate8BitDeltas + + Xor BX, BX + +D_Calculate16BitDeltas: + LodsW + Sub AX, BX + Mov BX, [SI-2] + StosW + Loop D_Calculate16BitDeltas + + Jmp D_CalculateDeltaEnd + +D_Calculate8BitDeltas: + LodsB + Sub AL, AH + Mov AH, [SI-1] + StosB + Loop D_Calculate8BitDeltas + +D_CalculateDeltaEnd: + +IF DDCOMPRESS + Mov DI, 16384 + Pop CX + Push ES + Mov SI, DI + Pop DS + Push CX + + Dec DX + JNZ D_CalculateDeltas + + Push Pattern + Pop ES + Assume ES:Pattern + Mov ES, PatternDataArea + Assume ES:Nothing + +ELSE + + Pop CX + +; Now to create bittable. + + Push ES + Pop DS + + Push Pattern + Pop ES + Assume ES:Pattern + Mov ES, PatternDataArea + Assume ES:Nothing + + Push CX + + Mov SI, 16384 + Mov DI, SI +ENDIF + + Mov BH, 40 + Test BP, 1 + JZ D_GenerateBitTable1 + + Xor AX, AX + +D_Generate16BitTable1: + Mov BL, [SI+1] + Mov BH, 41 + Mov AL, [BX] + Mov DL, AL + And DL, 7 + Mov BL, [SI] + Add BH, DL + ShR AL, 3 + Add SI, 2 + Add AL, [BX] + StosW + + Loop D_Generate16BitTable1 + Pop CX + +; Minimise 16-bit table + Push ES + Pop DS + Mov Byte Ptr [DS:16382], 17 ; Starting boundary of 17. + Mov DL, 1 ; Scan for 1 bit first. + +D_Minimise16BitTable1: + Push CX + Xor AX, AX ; AX = consecutive values. + Mov SI, 16384 + +D_Minimise16BitTable2: + Test AX, AX + JNZ D_Minimise16BitTable3 + +; Not in consecutive sequence. + Cmp DL, [SI] + JNE D_Minimise16BitTableEnd + Mov DI, SI ; First value + +D_Minimise16BitTable4: + Inc AX + Jmp D_Minimise16BitTableEnd + +D_Minimise16BitTable3: + Cmp DL, [SI] + JE D_Minimise16BitTable4 + +; OK.. outside of bittable + Cmp AX, 33 + JA D_Minimise16BitTable5 + + Mov BL, [SI] + Mov BH, [DI-2] + + Cmp BL, BH + JBE D_Minimise16BitTable6 + + XChg BL, BH + +D_Minimise16BitTable6: + Cmp BL, DL + JA D_Minimise16BitTable7 + XChg BL, BH + + Cmp BL, DL + JB D_Minimise16BitTable5 + +D_Minimise16BitTable7: ; BL = minbits. + Push CX + Push DX + + Mov CH, BL + Mov DH, BL ; DH = minbits. + + Cmp AX, 1 + JE D_Minimise16BitTableForce + + Cmp BL, 5 + JA D_Minimise16BitTable8 + + Add BL, 4 + +D_Minimise16BitTable8: + Cmp BH, 5 + JA D_Minimise16BitTable9 + + Add BL, 4 + +D_Minimise16BitTable9: + Mov CL, CH + And BX, 0FFh ; BX = bits to effect conversion + + Cmp AX, BX + JA D_Minimise16BitTable13 + + And CX, 0FFh ; CX = minbits. + + Sub CL, DL + Push DX + Mul CX ; DX:AX = bits saved. + Pop CX + Test DX, DX + JNZ D_Minimise16BitTable13 + Cmp AX, BX + JA D_Minimise16BitTable13 + +D_Minimise16BitTableForce: +; Have to change values from DI -> SI with minbits. + Mov AL, CH + Mov CX, SI + Sub CX, DI + ShR CX, 1 + Rep StosW + +D_Minimise16BitTable13: + Pop DX + Pop CX + +D_Minimise16BitTable5: + Xor AX, AX + +D_Minimise16BitTableEnd: + Add SI, 2 + Loop D_Minimise16BitTable2 + + Pop CX + + And DX, 0FFh + Inc DX + Cmp DX, 17 + JB D_Minimise16BitTable1 + +; Now to dump bits to buffer. + + Mov DX, CX + Mov DS, CS:DiskDataArea + Xor EAX, EAX + Mov DI, 2 + Mov SI, 16384 + Mov CX, 1100h + +; Convert 16 Bit Buffer. + +D_Convert16BitBuffer1: + Cmp CH, [ES:SI] ; BitsToWrite = BitTable? + JE D_Convert16BitBufferEnd + +; Need to change base + Cmp CH, 6 + JA D_Convert16BitBuffer2 + + Push CX + Mov BX, 1 + Mov CL, CH + Dec CL + ShL BX, CL + Pop CX + Call WriteBits + + Mov BL, [ES:SI] + Cmp CH, BL + SBB BL, 1 + Mov CH, 4 + Call WriteBits + Jmp D_Convert16BitBufferDepthChange + +D_Convert16BitBuffer2: + Cmp CH, 16 + JA D_Convert16BitBuffer3 + + Push CX + Mov EBX, 1 + Mov CL, CH + Dec CL + ShL EBX, CL + Sub BX, 9 + Add BL, [ES:SI] + AdC BH, 0 + Pop CX + + Cmp CH, [ES:SI] + SBB BL, 0 + Call WriteBits + Jmp D_Convert16BitBufferDepthChange + +D_Convert16BitBuffer3: + Mov EBX, 100FFh + Add BL, [ES:SI] + Call WriteBits + +D_Convert16BitBufferDepthChange: + Mov CH, [ES:SI] + +D_Convert16BitBufferEnd: + MovZX EBX, Word Ptr [SI] + Call WriteBits + + Add SI, 2 + Dec DX + JNZ D_Convert16BitBuffer1 + + Jmp D_ConvertBitsFinished + + +D_GenerateBitTable1: + Mov BL, [SI] + Inc SI + Mov AL, [BX] + StosB + Loop D_GenerateBitTable1 + +D_GenerateBitTableDone: + +; OK bit table is generated. + Pop CX + +; Have to minimise bit table (in patterndataarea) + + + Push ES + Pop DS + Mov Byte Ptr [DS:16383], 9 ; Starting boundary of 9. + Mov DL, 1 ; Scan for 1 bit first. + +D_MinimiseBitTable1: + Push CX + Xor AX, AX ; AX = consecutive values. + Mov SI, 16384 + +D_MinimiseBitTable2: + Test AX, AX + JNZ D_MinimiseBitTable3 + +; Not in consecutive sequence. + Cmp DL, [SI] + JNE D_MinimiseBitTableEnd + Mov DI, SI ; First value + +D_MinimiseBitTable4: + Inc AX + Jmp D_MinimiseBitTableEnd + +D_MinimiseBitTable3: + Cmp DL, [SI] + JE D_MinimiseBitTable4 + +; OK.. outside of bittable + Cmp AX, 17 + JA D_MinimiseBitTable5 + + Mov BL, [SI] + Mov BH, [DI-1] + + Cmp BL, BH + JBE D_MinimiseBitTable6 + + XChg BL, BH + +D_MinimiseBitTable6: + Cmp BL, DL + JA D_MinimiseBitTable7 + XChg BL, BH + + Cmp BL, DL + JB D_MinimiseBitTable5 + +D_MinimiseBitTable7: ; BL = minbits. + Push CX + Push DX + + Mov DH, BL ; DH = minbits. + Mov CH, BL + + Cmp AX, 1 + JE D_MinimiseBitTableForce + + Cmp BL, 5 + JA D_MinimiseBitTable8 + + Add BL, 3 + +D_MinimiseBitTable8: + Cmp BH, 5 + JA D_MinimiseBitTable9 + + Add BL, 3 + +D_MinimiseBitTable9: + Mov CL, CH ; CL = minbits. + And BX, 0FFh ; BX = bits to effect conversion + + Cmp AX, BX + JA D_MinimiseBitTable13 + + And CX, 0FFh ; CX = minbits. + + Sub CL, DL + Push DX + Mul CX ; DX:AX = bits saved. + Pop CX + Test DX, DX + JNZ D_MinimiseBitTable13 + Cmp AX, BX + JA D_MinimiseBitTable13 + +; Have to change values from DI -> SI with minbits. +D_MinimiseBitTableForce: + Mov AL, CH + Mov CX, SI + Sub CX, DI + Rep StosB + +D_MinimiseBitTable13: + Pop DX + Pop CX + +D_MinimiseBitTable5: + Xor AX, AX + +D_MinimiseBitTableEnd: + Inc SI + Loop D_MinimiseBitTable2 + + Pop CX + + And DX, 0FFh + Inc DX + Cmp DX, 9 + JB D_MinimiseBitTable1 + +; Now to dump bits to buffer. + + Mov DX, CX + Mov DS, CS:DiskDataArea + Xor EAX, EAX + Mov DI, 2 + Mov SI, 16384 + Mov CX, 900h + +D_ConvertBitBuffer1: ; CL = current bit + ; CH = bitstowrite + ; AX = output buffer + ; DX = bytes to process + ; SI = DS:source/ES:bittable + ; DI = destination + + Cmp CH, [ES:SI] ; BitsToWrite = BitTable? + JE D_ConvertBitBufferEnd + +; Need to change base + Cmp CH, 6 + JA D_ConvertBitBuffer2 + + Push CX + Mov BX, 1 + Mov CL, CH + Dec CL + ShL BX, CL + Pop CX + Call WriteBits + + Mov BL, [ES:SI] + Cmp CH, BL + SBB BL, 1 + Mov CH, 3 + Call WriteBits + Jmp D_ConvertBitBufferDepthChange + +D_ConvertBitBuffer2: + Cmp CH, 8 + JA D_ConvertBitBuffer3 + + Push CX + Mov BX, 1 + Mov CL, CH + Dec CL + ShL BX, CL + Sub BL, 5 + Add BL, [ES:SI] + Pop CX + + Cmp CH, [ES:SI] + SBB BL, 0 + Call WriteBits + Jmp D_ConvertBitBufferDepthChange + +D_ConvertBitBuffer3: + Mov BX, 1FFh + Add BL, [ES:SI] + Call WriteBits + +D_ConvertBitBufferDepthChange: + Mov CH, [ES:SI] + +D_ConvertBitBufferEnd: + MovZX BX, Byte Ptr [SI] + Call WriteBits + + Inc SI + Dec DX + JNZ D_ConvertBitBuffer1 + +D_ConvertBitsFinished: + Xor CH, CH + Add CL, 7 + ShR CL, 3 + Rep StosB ; Write 0 or 1 bytes. + +; DI = end of block = size; + + Pop BP + Pop BX + + Mov CX, DI + Sub DI, 2 + + Push ES + Pop DS + + Mov [DS:0], DI + + Xor DX, DX + Call D_SaveBlock + + Pop EDI + Pop CX + Pop AX + + JC D_SaveSampleDataCompressed2 + + Add CH, 2 + Sub EDI, 32768 + JA D_SaveSampleDataCompressed3 + + DB 85h +D_SaveSampleDataCompressed2: + StC + Pop ES + Pop DS + PopAD + Ret + +EndP D_SaveSampleDataCompressed + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_SaveSampleData ; AX = sample number (1 based) + + PushAD + Push DS + Push ES + + Call Music_GetSampleLocation + Mov EDI, ECX + JZ D_SaveSampleData1 + + Add EDI, EDI + +D_SaveSampleData1: + Xor CX, CX ; Start with page 0 + +D_SaveSampleData3: + Push AX ; AX = sample no. + Push CX ; CX = page no. + + Call Music_GetSampleLocation + Mov DX, SI + + Mov ECX, 32768 + Cmp EDI, ECX + JA D_SaveSampleData4 + + Mov CX, DI + +D_SaveSampleData4: + Call D_SaveBlock + Pop CX + Pop AX + JC D_SaveSampleData2 + + Add CH, 2 + Sub EDI, 32768 + JA D_SaveSampleData3 + + DB 85h +D_SaveSampleData2: + StC + Pop ES + Pop DS + PopAD + + Ret + +EndP D_SaveSampleData + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +include it_timer.inc +include it_d_rm.inc + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_CheckOverWrite ; DS:DX points to filename + ; Returns Carry set if not ok + + Mov CX, 6 + Mov AH, 4Eh + Int 21h + JC D_CheckOverWrite1 ; File doesn't exist. + + ; File Already exists... + + Push BX + Push DS + Push SI + + Mov DI, Offset O1_ConfirmOverWriteList + Mov CX, 4 + Call M_Object1List + ; DX = 0 -> don't overwrite + ; DX = 1 -> overwrite + Pop SI + Pop DS + Pop BX + + Test DX, DX + JZ D_CheckOverWrite2 + +D_CheckOverWrite1: + DB 85h + +D_CheckOverWrite2: + StC + Ret + + +EndP D_CheckOverWrite + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_PostFileSaveWindow Far + +; Cmp DX, 13 + Cmp CX, 11Ch + JNE D_PostFileWindow + ; Save file routines. + Mov DS, CS:DiskDataArea + Mov SI, CurrentFile + Add SI, SI + Mov SI, [SI] + Add SI, 8 ; Filename + Mov DI, Offset SaveFileName + + Push CS + Pop ES + +D_PostFileSaveWindow1: + LodsB + StosB + And AL, AL + JNZ D_PostFileSaveWindow1 + +D_PostFileSaveWindow2: + Push CS + Pop DS + Assume DS:Disk + + Mov DX, Offset SaveFileName + Call D_CheckOverWrite + JNC D_PostFileSaveWindow3 ; OK to write! + + Mov AX, 1 + Ret + +D_PostFileSaveWindow3: + Cmp SaveFormat, 1 + JE D_PostFileSaveWindow4 + + Jmp D_SaveFileITModule + +D_PostFileSaveWindow4: + Jmp D_SaveFileS3MModule + +EndP D_PostFileSaveWindow + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_PostFileLoadWindow Far + +; Cmp DX, 13 + Cmp CX, 11Ch + JNE D_PostFileWindow + ; Load file routines. + +D_PostFileLoadWindowLink: + EnsureNoNetwork + + Call PECheckModified + + Call Music_Stop + + Mov BX, CS:CurrentFile + Call D_LoadModuleHeader + JC D_PostFileLoadWindow1 + + Push DI + Call D_GetSongNameModuleType + Pop DI + +IF TUTORIAL +ELSE + Mov BX, CS:CurrentFile + Add BX, BX + Mov BX, [BX] + Mov AX, [BX+23] + + Cmp AX, 1 + JBE D_PostFileLoadWindow1 + + Cmp AX, 3 + JB D_LoadFileImpulseModule + JE D_PostFileLoadWindow1 + + Cmp AX, 5 + JB D_LoadFileS3MModule + JE D_LoadFileXMModule + + Cmp AX, 7 + JB D_LoadFile669Module + JE D_LoadFileImpulseModule + + Cmp AX, 8 + JBE D_PostFileLoadWindow1 + + Cmp AX, 17 + JBE D_LoadFileMODModule + + Cmp AX, 18 + JE D_LoadFileMTMModule +ENDIF + +D_PostFileLoadWindow1: + Mov AX, 1 + Ret + +EndP D_PostFileLoadWindow + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_PostFileWindow Far + + Push CS + Pop DS + Assume DS:Disk + + Mov SI, Offset FileWindowKeys + Call M_FunctionDivider + JC D_PostFileWindow1 + + Jmp [SI] + +D_PostFileWindow1: + Cmp CX, 10Eh + JNE D_PostFileWindow15 + +D_PostFileWindowBackspace: + Mov BL, CurrentSearchPos + Test BL, BL + JZ D_PostFileWindow14 + + Dec BX + Xor BH, BH + Mov [Search+BX], 0 + Mov CurrentSearchPos, BL + +D_PostFileWindow14: + Mov AX, 1 + Ret + +D_PostFileWindow15: + Test CL, CL + JZ D_PostFileWindow20 + Cmp DL, 33 + JB D_PostFileWindow20 + + Cmp CurrentSearchPos, 13 + JAE D_PostFileWindow17 + + Cmp DL, 'a' + JB D_PostFileWindow16 + + Cmp DL, 'z' + JA D_PostFileWindow16 + + Sub DL, 32 + +D_PostFileWindow16: + Mov BL, CurrentSearchPos + Xor BH, BH + Mov [Search+BX], DL + + Inc CurrentSearchPos + ; Now do the search. + Xor DX, DX + + Mov ES, DiskDataArea + +D_PostFileWindow18: + Cmp DX, NumFiles + JAE D_PostFileWindow17 + + Mov BX, DX + Add BX, BX + Mov DI, [ES:BX] + Add DI, 8 + Mov SI, Offset Search + Mov CX, 13 + +D_PostFileWindow21: + Cmp Byte Ptr [DS:SI], 0 + JE D_PostFileWindow19 + + CmpsB + JE D_PostFileWindow21 + + Inc DX + Jmp D_PostFileWindow18 + +D_PostFileWindow19: + Mov CurrentFile, DX + +D_PostFileWindow17: + Mov AX, 1 + Ret + +D_PostFileWindow20: + Xor AX, AX + Ret + +EndP D_PostFileWindow + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_PostDirectoryWindow Far + + Push CS + Pop DS + Assume DS:Disk + + Mov SI, Offset DirectoryWindowKeys + Call M_FunctionDivider + JC D_PostDirectoryWindow1 + + Jmp [SI] + +D_PostDirectoryWindow1: + Cmp CX, 10Eh + JNE D_PostDirectoryWindow15 + + Jmp D_PostFileWindowBackspace + +D_PostDirectoryWindow15: + Test CL, CL + JZ D_PostDirectoryWindow20 + Cmp DL, 33 + JB D_PostDirectoryWindow20 + + Cmp CurrentSearchPos, 13 + JAE D_PostDirectoryWindow17 + + Cmp DL, 'a' + JB D_PostDirectoryWindow16 + + Cmp DL, 'z' + JA D_PostDirectoryWindow16 + + Sub DL, 32 + +D_PostDirectoryWindow16: + Mov BL, CurrentSearchPos + Xor BH, BH + Mov [Search+BX], DL + + Inc CurrentSearchPos + ; Now do the search. + Xor DX, DX + + Mov ES, DiskDataArea + +D_PostDirectoryWindow18: + Cmp DX, NumDirectories + JAE D_PostFileWindow17 + + Mov BX, DX + Add BX, NumFiles + Add BX, BX + Mov DI, [ES:BX] + Add DI, 8 + Mov SI, Offset Search + Mov CX, 13 + +D_PostDirectoryWindow21: + Cmp Byte Ptr [DS:SI], 0 + JE D_PostDirectoryWindow19 + + CmpsB + JE D_PostDirectoryWindow21 + + Inc DX + Jmp D_PostDirectoryWindow18 + +D_PostDirectoryWindow19: + Mov CurrentDirectory, DX + +D_PostDirectoryWindow17: + Mov AX, 1 + Ret + +D_PostDirectoryWindow20: + Xor AX, AX + Ret + +EndP D_PostDirectoryWindow + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_PostDriveWindow Far + + Push CS + Pop DS + Assume DS:Disk + + Mov SI, Offset DriveWindowKeys + Call M_FunctionDivider + JC D_PostDriveWindow1 + + Jmp [SI] + +D_PostDriveWindow1: + Xor AX, AX + Ret + +EndP D_PostDriveWindow + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_PostSaveDriveWindow Far + + Push CS + Pop DS + Assume DS:Disk + + Mov SI, Offset SaveDriveWindowKeys + Call M_FunctionDivider + JC D_PostSaveDriveWindow1 + + Jmp [SI] + +D_PostSaveDriveWindow1: + Xor AX, AX + Ret + +EndP D_PostSaveDriveWindow + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_NewSpecifier Far + + Push CS + Pop DS + Assume DS:Disk + + Xor BX, BX + Mov SI, Offset FileSpecifier + Mov Specific, 1 + +D_NewSpecifier3: + LodsB + And AL, AL + JZ D_NewSpecifier4 + + Cmp AL, '\' + JE D_NewSpecifier10 + Cmp AL, ':' + JE D_NewSpecifier10 + + Jmp D_NewSpecifier3 + +D_NewSpecifier10: + Mov BX, SI + Jmp D_NewSpecifier3 + +D_NewSpecifier4: + And BX, BX + JZ D_NewSpecifier5 + + Push ES + Push DI + + Push CS + Pop ES + + Mov SI, Offset FileSpecifier + Mov DI, Offset SongDirectory + +D_NewSpecifier7: + MovsB + Cmp SI, BX + JB D_NewSpecifier7 + + Xor AL, AL + Cmp Byte Ptr [DI-1], '\' + JNE D_NewSpecifier11 + + Dec DI + +D_NewSpecifier11: + StosB + + Mov DI, Offset FileSpecifier + +D_NewSpecifier6: + LodsB + StosB + And AL, AL + JNZ D_NewSpecifier6 + + Cmp DI, Offset FileSpecifier+1 + JNE D_NewSpecifier14 + + Mov Specific, 0 + +D_NewSpecifier14: + Pop DI + Pop ES + + +D_NewSpecifier5: + Mov CurrentFile, 0 + Call D_InitLoadModule2 + +D_NewSpecifier12: + Cmp NumFiles, 0 + JE D_NewSpecifier1 + + Mov Word Ptr [ES:DI], 12 + +D_NewSpecifier1: + Cmp Specific, 1 + JNE D_NewSpecifier2 + + Cmp NumFiles, 1 + JNE D_NewSpecifier2 + + Mov SI, Offset FileSpecifier + +D_NewSpecifier8: + LodsB + And AL, AL + JZ D_NewSpecifier9 + + Cmp AL, '*' + JE D_NewSpecifier2 + Cmp AL, '?' + JE D_NewSpecifier2 + Jmp D_NewSpecifier8 + +D_NewSpecifier9: + Jmp D_PostFileLoadWindowLink + +D_NewSpecifier2: + + Mov AX, 1 + Ret + +EndP D_NewSpecifier + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_NewDirectory Far + +; Mov SI, Offset SongDirectory +; Push CS +; Pop DS +; +; Call S_SetDriveDirectory + + Mov CurrentFile, 0 + Call D_InitLoadModule + + Cmp NumFiles, 0 + JE D_NewDirectory1 + + Mov Word Ptr [ES:DI], 12 + +D_NewDirectory1: + Mov AX, 1 + Ret + +EndP D_NewDirectory + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_ClearFileSpecifier Far + + Push ES + Push DI + Push AX + Push CX + + Push CS + Pop ES + Mov DI, Offset FileSpecifier + Xor AX, AX + Mov CX, 65 + Rep StosB + + Pop CX + Pop AX + Pop DI + Pop ES + + Ret + +EndP D_ClearFileSpecifier + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_SaveModule Far + + Push CS + Pop DS + Assume DS:Disk + + Mov SI, Offset FileSpecifier + Cmp Byte Ptr [SI], 0 + JNE D_SaveModule9 + + Call D_NewSpecifier + Call D_ClearFileSpecifier + + Mov AX, 1 + Ret + +D_SaveModule9: + Push CS + Pop ES + Xor BX, BX + +D_SaveModule1: + LodsB + And AL, AL + JZ D_SaveModule3 + + Cmp AL, '?' + JE D_NewSpecifier + Cmp AL, '*' + JE D_NewSpecifier + Cmp AL, ':' + JE D_SaveModule2 + Cmp AL, '\' + JE D_SaveModule2 + + Jmp D_SaveModule1 + +D_SaveModule2: + Mov BX, SI + Jmp D_SaveModule1 + +D_SaveModule3: + And BX, BX + JZ D_SaveModule7 + + Mov SI, Offset FileSpecifier + Mov DI, Offset SongDirectory + +D_SaveModule4: + MovsB + Cmp SI, BX + JB D_SaveModule4 + + Xor AL, AL + Cmp Byte Ptr [DI-1], '\' + JNE D_SaveModule5 + + Dec DI + +D_SaveModule5: + StosB + + Mov DI, Offset FileSpecifier + +D_SaveModule6: + LodsB + StosB + And AL, AL + JNZ D_SaveModule6 + +D_SaveModule7: ; Time to save a module. + Mov DI, Offset SaveFileName + Mov SI, Offset FileSpecifier + +D_SaveModule8: + LodsB + StosB + And AL, AL + JNZ D_SaveModule8 + + ; FileName contains file to + ; save + Mov SI, Offset SongDirectory + Call D_SetDriveDirectory + + Mov SI, Offset SaveFileName + Xor BX, BX + +D_SaveModule10: + LodsB + Cmp AL, '.' + JNE D_SaveModule11 + + Mov BX, SI + +D_SaveModule11: + And AL, AL + JNZ D_SaveModule10 + + And BX, BX + JNZ D_SaveModule12 + + Cmp SaveFormat, 1 + JE D_SaveModule13 + + Mov Word Ptr [SI-1], 'I.' + Mov Word Ptr [SI+1], 'T' + Jmp D_PostFileSaveWindow2 + +D_SaveModule13: + Mov Word Ptr [SI-1], 'S.' + Mov Word Ptr [SI+1], 'M3' + Mov Byte Ptr [SI+3], 0 + +D_SaveModule12: + Jmp D_PostFileSaveWindow2 +; Jmp D_SaveFileITModule + +EndP D_SaveModule + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_NoSaveMessage Far + + Call S_SaveScreen + + Mov DI, Offset O1_UnableToSaveList + Mov CX, 2 + Call M_Object1List + + Call S_RestoreScreen + + Mov AX, 1 + Ret + +EndP D_NoSaveMessage + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_SaveBlock ; DS:DX points to buffer + ; BX = file handle + ; CX = number of bytes + + JCXZ D_SaveBlock3 + + Cmp CS:NoSaveError, 1 + JE D_SaveBlock2 + + Mov AH, 40h + Int 21h + JC D_SaveBlock1 + Cmp CX, AX + JNE D_SaveBlock1 + +D_SaveBlock3: + Ret + +D_SaveBlock2: + Mov AX, CX + StC + Ret + +D_SaveBlock1: + PushAD + Push DS + Push ES + + Call D_NoSaveMessage + + Pop ES + Pop DS + PopAD + + Mov CS:NoSaveError, 1 + StC + + Ret + +EndP D_SaveBlock + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_DeleteIfError ; DS:DX = filename + + PushF + + Cmp CS:NoSaveError, 0 + JE D_DeleteIfError1 + + PushA + + Mov AH, 41h + Int 21h + + PopA + +D_DeleteIfError1: + PopF + Ret + +EndP D_DeleteIfError + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_UpdateFileName + + Push CS + Push CS + Pop DS + Pop ES + + Mov SI, Offset SaveFileName + Mov DI, Offset FileName + ; Scan through file name first. + Mov BX, SI + +D_UpdateFileName1: + LodsB + And AL, AL + JZ D_UpdateFileName2 + + Cmp AL, ':' + JE D_UpdateFileName3 + Cmp AL, '\' + JNE D_UpdateFileName1 + +D_UpdateFileName3: + Mov BX, SI + Jmp D_UpdateFileName1 + +D_UpdateFileName2: + Mov SI, BX + Add BX, 8 + +D_UpdateFileName4: + LodsB + StosB + + Cmp AL, '.' + JE D_UpdateFileName5 + + And AL, AL + JZ D_UpdateFileNameEnd + + Cmp SI, BX + JBE D_UpdateFileName4 + +D_UpdateFileName5: + Mov BX, SI + Add BX, 3 + +D_UpdateFileName6: + LodsB + StosB + + And AL, AL + JZ D_UpdateFileNameEnd + + Cmp SI, BX + JBE D_UpdateFileName6 + +D_UpdateFileNameEnd: + Ret + +EndP D_UpdateFileName + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +include it_d_wm.inc + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_InitLoadSamples Far + + Push CS + Pop DS + Assume DS:Disk + + Mov SI, Offset SampleDirectory + Call D_SetDriveDirectory ; DS:SI points to cur dir. + + Cmp SamplesInModule, 0 + JE D_InitLoadSamples4 + + Jmp LSWindow_EnterLoadInSampleData + +D_InitLoadSamples4: + Mov LoadSampleNameCount, 0 + Mov NumSamples, 0 + Mov SampleInMemory, 0FFFFh + Mov SampleCheck, 0FFFFh + Mov SampleCacheFileComplete, 0 + + ; First attempt to delete + ; ST3's cache file.. + Mov DX, Offset ST3CacheFileName + Mov AH, 41h + Int 21h + + ; First check for cache file. + Mov OldCacheTime, 0 + + Mov AX, 3D00h ; Open file.. + Mov DX, Offset SampleCacheFileName + Int 21h + JC D_InitLoadSamples1 ; Can't open file? + + Mov BX, AX + + Mov AH, 3Fh + Mov CX, 4 ; Integer containing number + ; of sample entries... + Mov DS, DiskDataArea + Assume DS:Nothing + + Xor DX, DX + Int 21h + JC D_InitLoadSamples3 + Cmp AX, CX + JNE D_InitLoadSamples3 + + Mov AL, [CS:SampleDirectory] ; AL = drive letter + Cmp AL, [CS:CDRomStartDrive] + JL SampleVersionCheck + Cmp AL, [CS:CDRomEndDrive] + JGE SampleVersionCheck + + Cmp Word Ptr [DS:2], 211h + JB D_InitLoadSamples3 + Cmp Word Ptr [DS:2], TRACKERVERSION + JBE D_InitLoadSampleCacheFileOK + +SampleVersionCheck: + Cmp Word Ptr [DS:2], TRACKERVERSION + JNE D_InitLoadSamples3 + +VersionCheckEnd: + Mov AX, 5700h ; Get file date&time. + Int 21h + + Mov Word Ptr [OldCacheTime], CX + Mov Word Ptr [OldCachetime+2], DX + + Cmp CX, Time ; Check time and date + JNE D_InitLoadSamplesOldCache ; for 'currentness' + Cmp DX, Date + JNE D_InitLoadSamplesOldCache + ; OK.. let's load... + +D_InitLoadSampleCacheFileOK: + Mov SI, [DS:0] ; Number of samples. + Mov AX, 96 + Mul SI + Mov CX, AX ; Bytes to read. + + Mov AH, 3Fh ; Load again. + Xor DX, DX ; In case of internal malfunc. + Int 21h + JC D_InitLoadSamples3 + Cmp AX, CX + JNE D_InitLoadSamples3 + + Mov AH, 3Eh ; Close file. + Int 21h + + Push CS + Pop DS + Assume DS:Disk + + Mov LoadSampleNameCount, SI + Mov NumSamples, SI + Mov SampleCacheFileComplete, 1 + + Jmp D_InitLoadSamples2 + +D_InitLoadSamplesOldCache: + PushA + Push DS + + Call D_GetNumFiles ; Returns number of files + ; and directories, + ; carry if newer file exists. + Pop DS + JC D_InitLoadSamples5 + + Cmp AX, [DS:0] + + PopA + + JNE D_InitLoadSamples3 + + Call Far Ptr D_InitLoadSampleCacheFileOK + + Call D_SaveSampleCacheFile ; Resave it with new date + + Ret + +D_InitLoadSamples5: + PopA + +D_InitLoadSamples3: + Mov AH, 3Eh ; Close file. + Int 21h + + Push CS + Pop DS + Assume DS:Disk + + Call DeleteSampleCacheFile + +D_InitLoadSamples1: + Call D_LoadSampleFiles + +D_InitLoadSamples2: + Ret + +EndP D_InitLoadSamples + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DeleteSampleCacheFile + + Push DS + + Push CS + Pop DS + + Mov AH, 41h + Mov DX, Offset SampleCacheFileName + Int 21h + + Pop DS + + Ret + +EndP DeleteSampleCachefile + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DeleteInstrumentCacheFile + + Push DS + + Push CS + Pop DS + + Mov AH, 41h + Mov DX, Offset InstrumentCacheFileName + Int 21h + + Pop DS + + Ret + +EndP DeleteInstrumentCachefile + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_GetNumFiles ; DS = DiskDaraArea + + Mov DS, CS:DiskDataArea + + Mov DX, 64000 ; Set DTA to DS:64000 + Mov AH, 1Ah + Int 21h + + Push CS + Pop DS + + Mov DX, Offset AllFilesMask + Mov CX, 10h + Mov AH, 4Eh + Int 21h + + Mov DS, CS:DiskDataArea + JC D_GetNumFilesError + + Xor AX, AX ; No samples/directories to + ; start off with. + +D_GetNumFiles1: + Test Byte Ptr [DS:64000+15h], 10h + JZ D_GetNumFiles2 + + Mov EDX, DWord Ptr [CS:OldCacheTime] + Cmp [DS:64000+16h], EDX ; Newer file? + JA D_GetNumFilesError + + Inc AX + +D_GetNumFiles2: + Push AX + Mov AH, 4Fh + Int 21h + Pop AX + JNC D_GetNumFiles1 + ; Directories done.. files now + Push AX + + Push CS + Pop DS + Mov DX, Offset AllFilesMask + Xor CX, CX + Mov AH, 4Eh + Int 21h + + Mov DS, CS:DiskDataArea + + Pop AX + JC D_GetNumFilesFinished + + Push CS + Pop ES + +D_GetNumFiles3: + Mov SI, 64000+1Eh + Mov DI, Offset SampleCacheFileName + Mov CX, 9 + RepE CmpsB + JE D_GetNumFiles4 + + Mov SI, 64000+1Eh + Mov DI, Offset InstrumentCacheFileName + Mov CX, 9 + RepE CmpsB + JE D_GetNumFiles4 + + Mov EDX, DWord Ptr [CS:OldCacheTime] + Cmp [DS:64000+16h], EDX ; Newer file? + JA D_GetNumFilesError + +D_GetNumFiles4: + Inc AX + + Push AX + Mov AH, 4Fh + Int 21h + Pop AX + JNC D_GetNumfiles3 + + Dec AX + +D_GetNumFilesFinished: + ClC + Ret + +D_GetNumFilesError: + Xor AX, AX + StC + Ret + + +EndP D_GetNumFiles + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_LoadSampleFiles + + Mov DS, CS:DiskDataArea + Push DS + Pop ES + + Xor DI, DI + Xor AX, AX + Mov CX, 32768 + Rep StosW + + Mov DX, 64000 + Mov AH, 1Ah + Int 21h ; Shift DTA address.. + ; to DiskDataArea:64000 + + Xor DI, DI + + Push CS + Pop DS + Mov DX, Offset AllFilesMask + Mov CX, 10h + Mov AH, 4Eh + Int 21h + + Mov DS, CS:DiskDataArea + Push DS + Pop ES + + JC D_LoadSampleFiles2 + +D_LoadSampleFiles1: ; A directory was found! + Test Byte Ptr [DS:64000+15h], 10h + JZ D_LoadSampleFiles5 ; Check that it IS a directory + + Cmp Word Ptr [DS:64000+1Eh], '.' + JNE D_LoadSampleFilesNoRoot + + Mov Byte Ptr [DS:64000+1Eh], '\' + +D_LoadSampleFilesNoRoot: + Mov DL, 1 + Call Near Ptr D_LoadSampleFiles6 + + Inc CS:NumSamples + Inc CS:LoadSampleNameCount + + Cmp CS:NumSamples, 620 + JAE D_LoadSampleFiles4 + +D_LoadSampleFiles5: + Mov AH, 4Fh + Int 21h + JNC D_LoadSampleFiles1 + +D_LoadSampleFiles2: ; Directories done.. samples now + Push CS + Pop DS + Mov DX, Offset AllFilesMask + Xor CX, CX + Mov AH, 4Eh + Int 21h + + Mov DS, CS:DiskDataArea + Push DS + Pop ES + + JC D_LoadSampleFiles4 + +D_LoadSampleFiles3: + Mov DL, 0 + Call Near Ptr D_LoadSampleFiles6 + + Inc CS:NumSamples + Cmp CS:NumSamples, 620 + JAE D_LoadSampleFiles4 + +D_LoadSampleFilesNext: + Mov AH, 4Fh + Int 21h + JNC D_LoadSampleFiles3 + +D_LoadSampleFiles4: ; End! + + Ret + +D_LoadSampleFiles6: ; Get name/size/date/time. + Add DI, 4 + Mov SI, 64000+1Eh + Mov CX, 13 + Rep MovsB + + Cmp DL, 1 + JNE D_LoadSampleFiles7 + + Xor AX, AX + StosB + StosW + + Push DS + Push CS + Pop DS + Mov SI, Offset DirectoryMsg + Mov CX, 25 + Rep MovsB + + Pop DS + + Mov CX, 35 + Jmp D_LoadSampleFiles8 + +D_LoadSampleFiles7: + Mov CX, 63 + +D_LoadSampleFiles8: + Xor AL, AL + Rep StosB + + Mov EAX, [DS:64000+1Ah] + StosD + Mov AX, [DS:64000+18h] + StosW + Mov AX, [DS:64000+16h] + StosW + Mov AL, DL + StosB + Mov CX, 7 + Xor AL, AL + Rep StosB + + RetN + +EndP D_LoadSampleFiles + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_DrawLoadSampleWindow Far ; Has to handle + ; 1) Sample list + ; 2) Sample info box + ; 3) WaveForm stuff + + + Cmp CS:NumSamples, 0 + JNE D_DrawLoadSampleWindow4 + + Push CS + Pop DS + + Call S_GetDestination + Mov DI, (6+13*80)*2 ; (6, 13) + Mov SI, Offset NoFilesMsg + + Mov AH, 5 + Call S_DrawString + + Ret + +D_DrawLoadSampleWindow4: + Mov BX, CS:CurrentSample + Mov AX, 96 + Mul BX + Mov SI, AX + Mov ES, CS:DiskDataArea + + Cmp Byte Ptr [ES:SI+88], 0 + JNE D_DrawLoadSampleWindow28 + + Push SI + + Call D_LoadSampleHeader + Call D_GetSampleInfo + + Pop SI + +D_DrawLoadSampleWindow28: + Mov BX, CS:CurrentSample + Cmp BX, CS:SampleCheck + JE D_DrawLoadSampleWindow31 + + Mov CS:SampleCheck, BX + Push CS + Pop ES + Mov DI, Offset CheckDataArea + Mov DS, CS:DiskDataArea + Mov CX, 96 + Rep MovsB + +D_DrawLoadSampleWindow31: + Push CS + Pop DS + Assume DS:Disk + + Call S_GetDestination + + Mov AX, TopSample + Mov BX, CurrentSample + Cmp AX, BX + JBE D_DrawLoadSampleWindow1 + + Mov AX, BX + +D_DrawLoadSampleWindow1: + LEA CX, [EAX+34] + Cmp CX, BX + JA D_DrawLoadSampleWindow2 + + LEA AX, [BX-34] + +D_DrawLoadSampleWindow2: + Mov TopSample, AX + Mov BX, AX + + Push AX + + Mov DI, (31+13*80)*2 + Mov CX, 35 + Mov AX, 2A8h + +D_DrawLoadSampleWindow5: ; Divider... + StosW + Add DI, 158 + Loop D_DrawLoadSampleWindow5 + + Pop AX + + Mov DX, NumSamples + ; Put numbers of screen first. + Mov DI, (2+13*80)*2 ; (2,13) + Mov CX, 2000h+35 ; Colour and loop count. + +D_DrawLoadSampleWindow3: + Inc AX + Push DI + + Call PE_ConvAX2Num + + Pop DI + Add DI, 160 + Cmp AX, DX ; DX = NumSamples + JAE D_DrawLoadSampleWindow9 + + Dec CL + JNZ D_DrawLoadSampleWindow3 + +D_DrawLoadSampleWindow9: + Mov DS, DiskDataArea + Assume DS:Nothing + Mov AX, 96 + Mul BX + Mov SI, AX ; SI = offset of first sample. + + Mov DX, 35 ; DX = Number of rows to show. + ; BX = sample num + + Mov DI, (6+13*80)*2 + +D_DrawLoadSampleWindow6: + Push BX + Push DX + Push SI + Push DI + ; Colour.... + Mov AL, [DS:SI+88] ; AL = type. 0 = not loaded. + ; 1=dir + ; 2=it sample + ; 3=scrm sample. + ; 4=unknown + ; 5=8 bit mono wave + Mov AH, 6 + Cmp AL, 1 + JB D_DrawLoadSampleWindow7 + + Mov AH, 5 + JE D_DrawLoadSampleWindow7 + + Mov AH, 3 + Cmp AL, 4 + JNE D_DrawLoadSampleWindow7 + + Mov AH, 2 + +D_DrawLoadSampleWindow7: ; AH = colour. + Push SI + + Add SI, 14h + + Mov CX, 25 + +D_DrawLoadSampleWindow50: + LodsB + + Cmp AL, 226 + JB D_DrawLoadSampleCharFilter + + Mov AL, ' ' + +D_DrawLoadSampleCharFilter: + StosW + Loop D_DrawLoadSampleWindow50 + + Xor AL, AL + Rep StosW + + Pop SI + +; Add DI, 2 + ScasW + Add SI, 4 + + Mov CX, 12 + +D_DrawLoadSampleWindow51: + LodsB + StosW + And AL, AL + LoopNZ D_DrawLoadSampleWindow51 + + Xor AL, AL + Rep StosW + + Pop DI + Pop SI + Pop DX + Pop BX + + Add SI, 96 ; Advance to next sample. + Add DI, 160 ; Advance to next line on screen + + Inc BX + Cmp BX, CS:NumSamples + JAE D_DrawLoadSampleWindow8 + + Dec DX + JNZ D_DrawLoadSampleWindow6 + +D_DrawLoadSampleWindow8: ; Length + Mov AX, 96 + Mul CS:CurrentSample + + Mov SI, AX + + Push DS + Push SI + + Push DWord Ptr [DS:SI+30h] + + Test Byte Ptr [DS:SI+2Eh], 32 ; Stereo? + JZ D_DrawLoadSampleWindowNoStereo + + Test Byte Ptr [DS:SI+12h], 2 + Mov SI, Offset Quality8StereoMsg + + Push CS + Pop DS + JZ D_DrawLoadSampleWindowBitMsg + + Mov SI, Offset Quality16StereoMsg + Jmp D_DrawLoadSampleWindowBitMsg + +D_DrawLoadSampleWindowNoStereo: + Test Byte Ptr [DS:SI+12h], 2 + Mov SI, Offset Quality8Msg + + Push CS + Pop DS + JZ D_DrawLoadSampleWindowBitMsg + + Mov SI, Offset Quality16Msg + +D_DrawLoadSampleWindowBitMsg: + Mov DI, (21*80+64)*2 + Mov AH, 2 + Call S_DrawString + + Mov SI, Offset LengthMsg + Mov DI, (22*80+64)*2 + Call S_DrawString + Pop EAX + + Pop SI + Pop DS + +D_DrawLoadSampleWindow30: + ; Now for infobox. + Mov BL, [DS:SI+88] ; BL = type. + Push DS + Push SI + + Push CS + Pop DS + Xor BH, BH + Add BX, BX + Mov SI, [SampleFormatNames+BX] + Mov DI, (53+44*80)*2 + Mov AH, 5 + Call S_DrawString + + Pop SI + Pop DS + + Push SI + + Mov DX, [DS:SI+82] + Mov AX, [DS:SI+80] + Cmp DX, 10000 + + JAE D_DrawLoadSampleWindow13 + + Mov DI, (53+45*80)*2 + + Mov CX, 10000 + Div CX ; DX = remainder. AX = main. + + Mov BP, AX + + Mov CX, 4 + Mov SI, 10 + Mov AX, DX + +D_DrawLoadSampleWindow10: + Xor DX, DX + Div SI + Add DL, '0' + Push DX + + Loop D_DrawLoadSampleWindow10 + + Mov AX, BP + + Mov CX, 5 + +D_DrawLoadSampleWindow11: + Xor DX, DX + Div SI + Add DL, '0' + Push DX + + Loop D_DrawLoadSampleWindow11 + + Mov CX, 9 + +D_DrawLoadSampleWindow12: + Pop AX + Mov AH, 5 + StosW + Loop D_DrawLoadSampleWindow12 + +D_DrawLoadSampleWindow13: + Pop SI + + Mov DX, [DS:SI+86] ; DX = time + Mov BX, [DS:SI+84] ; BX = date + + Push CS + Pop DS + + Mov DI, (53+46*80)*2 + Mov AX, BX + ShR AX, 5 + And AX, 0Fh + Mov SI, AX + Add SI, SI + Mov SI, [MonthNames+SI] + + Mov AH, 5 + +D_DrawLoadSampleWindow19: + LodsB + StosW + And AL, AL + JNZ D_DrawLoadSampleWindow19 + + Mov AL, BL + And AX, 31 + Mov CH, 10 + Div CH + And AL, AL + JZ D_DrawLoadSampleWindow20 + + Push AX + Add AL, '0' + Mov AH, 5 + StosW + + Pop AX + +D_DrawLoadSampleWindow20: + Mov AL, AH + Add AL, '0' + Mov AH, 5 + StosW + + Mov AL, ',' + StosW + + Mov AL, ' ' + StosW + + Push DX + Mov AL, BH + ShR AX, 1 + And AX, 7Fh + Add AX, 1980 + Mov DX, 0FFFFh + Push DX + + Mov SI, 10 + +D_DrawLoadSampleWindow21: + Xor DX, DX + Div SI + Add DL, '0' + Push DX + + And AX, AX + JNZ D_DrawLoadSampleWindow21 + +D_DrawLoadSampleWindow22: + Pop AX + Cmp AX, 0FFFFh + JE D_DrawLoadSampleWindow23 + + Mov AH, 5 + StosW + + Jmp D_DrawLoadSampleWindow22 + +D_DrawLoadSampleWindow23: + Pop DX + Mov DI, (53+47*80)*2 + + Mov AX, DX + ShR AX, 11 + + Xor BL, BL ; if BL = 0, then am, otherwise + ; pm.. + Cmp AX, 12 + JB D_DrawLoadSampleWindow24 + + Inc BX + Sub AX, 12 + +D_DrawLoadSampleWindow24: + And AX, AX + JNZ D_DrawLoadSampleWindow25 + + Add AX, 12 + +D_DrawLoadSampleWindow25: + Mov BH, 10 + Div BH + And AL, AL + JZ D_DrawLoadSampleWindow26 + + Push AX + Add AL, '0' + Mov AH, 5 + StosW + + Pop AX + +D_DrawLoadSampleWindow26: + Mov AL, AH + Add AL, '0' + Mov AH, 5 + StosW + + Mov AL, ':' + StosW + + Mov AX, DX + ShR AX, 5 + And AX, 63 + + Div BH + Mov BH, AH + + Add AL, '0' + Mov AH, 5 + StosW + + Mov AL, BH + Add AL, '0' + StosW + + Mov AL, 'a' + And BL, BL + JZ D_DrawLoadSampleWindow27 + + Mov AL, 'p' + +D_DrawLoadSampleWindow27: + StosW + Mov AL, 'm' + StosW + + Push CS ; Wave form shit.. + Pop DS + Assume DS:Disk + + Mov AX, CurrentSample + Cmp AX, SampleInMemory + JNE D_DrawLoadSampleWindow54 + + Mov DI, (46+25*80)*2 + Mov DX, 4 + Mov AX, 0D00h + +D_DrawLoadSampleWindow55: + Mov CX, 31 + +D_DrawLoadSampleWindow56: + StosW + Inc AX + Loop D_DrawLoadSampleWindow56 + + Add DI, 160-31*2 + Dec DX + JNZ D_DrawLoadSampleWindow55 + +D_DrawLoadSampleWindow54: + Ret + +EndP D_DrawLoadSampleWindow + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_PreLoadSampleWindow Far + + Push CS + Pop DS + Assume DS:Disk + + Mov AX, CurrentSample + Sub AX, TopSample + Add AX, 13 + Mov BX, 160 + Mul BX + + Call S_GetDestination + + LEA DI, [EAX+12] + Mov CX, 38 + +D_PreLoadSample1: + Mov AX, [ES:DI] + Cmp CX, 13 + + JNE D_PreLoadSample2 + + Mov AH, 32h + Jmp D_PreLoadSample3 + +D_PreLoadSample2: + Mov AH, 30h + +D_PreLoadSample3: + StosW + + Loop D_PreLoadSample1 + + Ret + +EndP D_PreLoadSampleWindow + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_PostLoadSampleWindow Far + + Push CS + Pop DS + Assume DS:Disk + + Mov SI, Offset LSWindowKeys + Call M_FunctionDivider + JC D_PostLoadSampleWindow1 + + Jmp [SI] + +D_PostLoadSampleWindow1: ; Time to check for play keys. + Mov SI, Offset KeyBoardTable + Test CH, Not 1 + JNZ D_PostLoadSampleWindow3 + + Cmp CX, LastKey + JE D_PostLoadSampleWindow3 + + Mov LastKey, CX + +D_PostLoadSampleWindow2: + LodsW + Cmp AX, 0FFFFh + JE D_PostLoadSampleWindow3 + + Mov BX, AX + LodsW + + Cmp BL, CL + JNE D_PostLoadSampleWindow2 + ; Note to play... + ; AX = notemod. + And CH, CH + JZ D_PostLoadSampleWindow5 + + + Mov BX, AX + + Mov CX, Pattern + Mov DS, CX + Assume DS:Pattern + + Mov AL, 12 + Mul BaseOctave + + Push CS + Pop DS + Assume DS:Disk + + Add AX, BX + Cmp AX, 119 + JA D_PostLoadSampleWindow4 ; If note > B-9... don't play! + + Push AX + + Mov AX, 96 + Mul CurrentSample + Mov SI, AX + + Mov DisableStereoMenu, 1 + + Mov DS, DiskDataArea + Mov AX, 99 + Call LoadSample + + Mov CS:DisableStereoMenu, 0 + + Pop AX + JC D_PostLoadSampleWindow4 + + ; AX = note. Ins = 99. + Mov AH, 100 + Xor CX, CX + Call Music_PlaySample + Jmp D_PostLoadSampleWindow4 + +D_PostLoadSampleWindow5: + Xor AX, AX + Mov SI, Offset NoteData + Mov DH, 32 + Call Music_PlayNote + +D_PostLoadSampleWindow4: + Mov AX, 1 + Ret + +D_PostLoadSampleWindow3: + Xor AX, AX + Ret + +EndP D_PostLoadSampleWindow + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_PostViewSampleLibrary Far + + Push CS + Pop DS + Assume DS:Disk + + Mov SI, Offset LSViewWindowKeys + Call M_FunctionDivider + JC D_PostLoadSampleWindow1 + + Jmp [SI] + +EndP D_PostViewSampleLibrary + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_LSDrawDriveWindow Far + + Push CS + Pop DS + Assume DS:Disk + + Call S_GetDestination + + Mov AL, TopDrive + Mov BL, CurrentDrive + Cmp AL, BL + JBE D_LSDrawDriveWindow1 + + Mov AL, BL + +D_LSDrawDriveWindow1: + Mov CL, AL + Add CL, 9 + Cmp CL, BL + JA D_LSDrawDriveWindow2 + + Mov AL, BL + Sub AL, 9 + +D_LSDrawDriveWindow2: + Mov TopDrive, AL + Mov BL, AL + Mov CX, 10 + + Mov DI, (46+13*80)*2 + Xor BH, BH + +D_LSDrawDriveWindow3: + Cmp BL, NumDrives + JAE D_LSDrawDriveWindow5 + + Push DI + + Mov AL, [DrivesAvail+BX] + Add AL, 'A' + Mov SI, Offset DriveMsg + Mov [SI+6], AL + + Mov AH, 5 + Mov DX, 8 + +D_LSDrawDriveWindow4: + LodsB + StosW + + Dec DX + JNZ D_LSDrawDriveWindow4 + + Pop DI + Add DI, 160 + Inc BX + Loop D_LSDrawDriveWindow3 + +D_LSDrawDriveWindow5: + Ret + +EndP D_LSDrawDriveWindow + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_LSPreDriveWindow Far + + Push CS + Pop DS + Assume DS:Disk + + Mov AL, CurrentDrive + Sub AL, TopDrive + Add AL, 13 + Mov AH, 160 + Mul AH + + Call S_GetDestination + LEA DI, [EAX+92] + Mov CX, 8 + +D_LSPreDriveWindow1: + Mov AX, [ES:DI] + Mov AH, 30h + StosW + + Loop D_LSPreDriveWindow1 + + Ret + +EndP D_LSPreDriveWindow + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_LSPostDriveWindow Far + + Push CS + Pop DS + Assume DS:Disk + + Mov SI, Offset LSDriveWindowKeys + Call M_FunctionDivider + JC D_LSPostDriveWindow1 + + Jmp [SI] + +D_LSPostDriveWindow1: + Xor AX, AX + Ret + +EndP D_LSPostDriveWindow + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_LIDrawDriveWindow Far + + Push CS + Pop DS + Assume DS:Disk + + Call S_GetDestination + + Xor AL, AL + Xor BX, BX + + Mov CX, 32 + + Mov DI, (64+16*80)*2 + +D_LIDrawDriveWindow3: + Cmp BL, NumDrives + JAE D_LIDrawDriveWindow5 + + Push DI + + Mov AL, [DrivesAvail+BX] + Add AL, 'A' + Mov SI, Offset DriveMsg + Mov [SI+6], AL + + Mov AH, 5 + Mov DX, 8 + +D_LIDrawDriveWindow4: + LodsB + StosW + + Dec DX + JNZ D_LIDrawDriveWindow4 + + Pop DI + Add DI, 160 + Inc BX + Loop D_LIDrawDriveWindow3 + +D_LIDrawDriveWindow5: + Ret + +EndP D_LIDrawDriveWindow + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_LIPreDriveWindow Far + + Push CS + Pop DS + Assume DS:Disk + + Mov AL, CurrentDrive + Add AL, 16 + Mov AH, 160 + Mul AH + Mov DI, AX + + Call S_GetDestination + Add DI, 64*2 + Mov CX, 8 + +D_LIPreDriveWindow1: + Mov AX, [ES:DI] + Mov AH, 30h + StosW + + Loop D_LIPreDriveWindow1 + + Ret + +EndP D_LIPreDriveWindow + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_LIPostDriveWindow Far + + Push CS + Pop DS + Assume DS:Disk + + Mov SI, Offset LIDriveWindowKeys + Call M_FunctionDivider + JC D_LIPostDriveWindow1 + + Jmp [SI] + +D_LIPostDriveWindow1: + Xor AX, AX + Ret + +EndP D_LIPostDriveWindow + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_LoadSampleHeader ; Given BX = sample number. + + Push BX + + Mov DS, DiskDataArea + Assume DS:Nothing + + Mov AX, 96 + Mul BX + LEA SI, [EAX+4] + + Call D_LoadFileHeader + + Pop BX + + Ret + +EndP D_LoadSampleHeader + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_LoadInstrumentHeader ; Given BX = instrument num + + Push BX + + Mov DS, DiskDataArea + Assume DS:Nothing + + Mov AX, 48 + Mul BX + Mov SI, AX + Inc SI + + Call D_LoadFileHeader + + Pop BX + + Ret + +EndP D_LoadInstrumentHeader + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +include it_d_inf.inc + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_SaveSampleCacheFile ; Assumes DS=Disk + + Push CS + Pop DS + + Assume DS:Disk + + Test DiskOptions, 2 + JNZ D_SaveSampleCacheFile1 + + Cmp SamplesInModule, 0 + JNE D_SaveSampleCacheFile1 + + Mov AH, 3Ch ; create file. + Xor CX, CX ; normal file + Mov DX, Offset SampleCacheFileName + Int 21h + JC D_SaveSampleCacheFile1 + + Mov BX, AX ; BX = file handle + + Mov AH, 40h ; Write to file + Mov CX, 4 ; Word size + Mov DX, Offset NumSamples + Int 21h + + Mov AX, 96 + Mul NumSamples + Mov CX, AX ; CX = num bytes to write. + Mov AH, 40h + Xor DX, DX + Mov DS, DiskDataArea + Assume DS:Nothing + Int 21h ; Write cache file! + + ; Set date and time... + Mov AX, 5701h + Mov CX, CS:Time + Mov DX, CS:Date + Int 21h + + Mov AH, 3Eh ; Close file handle + Int 21h + + Push CS + Pop DS + Assume DS:Disk + +D_SaveSampleCacheFile1: + Mov SampleCacheFileComplete, 1 + + Ret + +EndP D_SaveSampleCacheFile + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_SaveInstrumentCacheFile ; Assumes DS=Disk + + Push CS + Pop DS + Assume DS:Disk + + Test DiskOptions, 2 + JNZ D_SaveInstrumentCacheFile1 + + Mov AH, 3Ch ; create file. + Xor CX, CX ; normal file + Mov DX, Offset InstrumentCacheFileName + Int 21h + JC D_SaveInstrumentCacheFile1 + + Mov BX, AX ; BX = file handle + + Mov AH, 40h ; Write to file + Mov CX, 6 ; Word size + Mov DX, Offset InitialInstruments + Int 21h + + Mov AX, 48 + Mul NumInstruments + Mov CX, AX ; CX = num bytes to write. + Mov AH, 40h + Xor DX, DX + Mov DS, DiskDataArea + Assume DS:Nothing + + Int 21h ; Write cache file! + + ; Set date and time... + Mov AX, 5701h + Mov CX, CS:Time + Mov DX, CS:Date + Int 21h + + Mov AH, 3Eh ; Close file handle + Int 21h + + Push CS + Pop DS + Assume DS:Disk + +D_SaveInstrumentCacheFile1: + Mov InstrumentCacheFileComplete, 1 + + Ret + +EndP D_SaveInstrumentCacheFile + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_LoadSampleNames Far + + Push CS + Pop DS + Assume DS:Disk + + Cmp SampleCacheFileComplete, 1 + JNE D_LoadSampleNames2 + +D_LoadSampleNames6: + Xor AX, AX ; No redraw screen. + Ret + +D_LoadSampleNames2: + Mov BX, LoadSampleNameCount + Cmp BX, NumSamples + JAE D_LoadSampleNames5 + +D_LoadSampleNames1: + Call K_IsAnyKeyDown + And AL, AL + JNZ D_LoadSampleNames6 + + Call GetKeyboardLock + And AL, AL + JNZ D_LoadSampleNames6 + + Mov AX, 96 + Mul BX + Mov SI, AX + Mov ES, DiskDataArea + Cmp Byte Ptr [ES:SI+88], 0 + JNE D_LoadSampleNames3 + + Call D_LoadSampleHeader + JC D_LoadSampleNames3 + + Call D_GetSampleInfo ; BX = sample number + +D_LoadSampleNames3: + Push CS + Pop DS + Assume DS:Disk + + Inc LoadSampleNameCount + Mov BX, LoadSampleNameCount + Cmp BX, NumSamples + JNE D_LoadSampleNames4 + ; Save cache file.. + +D_LoadSampleNames5: + Call D_SaveSampleCacheFile + Cmp CurrentSample, 0 + JNE D_LoadSampleNames4 + Call D_SlowSampleSort + +D_LoadSampleNames4: + Mov AX, 1 ; Signify redraw screen + Ret + +EndP D_LoadSampleNames + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_GetLoadSampleVars Far ; Returns SI with offset of + + Push AX + Push DX + + Mov AX, 96 + Mul CS:CurrentSample + Mov SI, AX + Mov DS, CS:DiskDataArea + + Pop DX + Pop AX + + Ret + +EndP D_GetLoadSampleVars + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_GotoStartingDirectory Far + + Push DS + Push CS + Pop DS + + Mov SI, Offset StartingDirectory + Call D_SetDriveDirectory + Pop DS + + Ret + +EndP D_GotoStartingDirectory + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_SaveDirectoryConfiguration Far + + Push CS + Pop DS + Assume DS:Disk + + Mov NoSaveError, 0 + Mov CountryTableConfig, 0 + + Mov SI, Offset StartingDirectory + Call D_SetDriveDirectory + + Mov AH, 3Ch + Xor CX, CX + Mov DX, Offset ConfigFileName + Int 21h + JC D_SaveDirectoryConfiguration1 + + Mov BX, AX + + Mov CX, 211 + Mov DX, Offset SongDirectory + Call D_SaveBlock + + Call S_GetPaletteOffset ; Into DS:DX + Mov CX, 3*16 + Call D_SaveBlock + + Call Display_GetDisplayWindowData + Mov CX, 50 + Call D_SaveBlock + + Call PE_GetPatternConfigOffset + Mov CX, 218 + Call D_SaveBlock + + Call I_GetPresetEnvelopeOffset + Mov CX, 810 + Call D_SaveBlock + + Mov AH, 3Eh + Int 21h + +D_SaveDirectoryConfiguration1: + Mov AX, 1 + Ret + +EndP D_SaveDirectoryConfiguration + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc FileWindow_Up Far + + Assume DS:Disk + + Mov AX, CurrentFile + And AX, AX + JZ FileWindow_Up1 + + Dec CurrentFile + +FileWindow_Up1: + Mov AX, 1 + Ret + +EndP FileWindow_Up + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc FileWindow_Down Far + + Assume DS:Disk + + Mov AX, CurrentFile + Inc AX + Cmp AX, NumFiles + JAE FileWindow_Down1 + + Inc CurrentFile + +FileWindow_Down1: + Mov AX, 1 + Ret + +EndP FileWindow_Down + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc FileWindow_PgUp Far + + Assume DS:Disk + + Mov AX, CurrentFile + Sub AX, 31 + JNC FileWindow_PgUp1 + + Xor AX, AX + +FileWindow_PgUp1: + Mov CurrentFile, AX + + Mov AX, 1 + Ret + +EndP FileWindow_PgUp + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc FileWindow_PgDn Far + + Assume DS:Disk + + Mov AX, CurrentFile + Add AX, 31 + Cmp AX, NumFiles + JB FileWindow_PgDn1 + + Mov AX, NumFiles + And AX, AX + JZ FileWindow_PgDn1 + + Dec AX + +FileWindow_PgDn1: + Mov CurrentFile, AX + + Mov AX, 1 + Ret + +EndP FileWindow_PgDn + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc FileWindow_Right Far + + Assume DS:Disk + + Mov Word Ptr [ES:DI], 13 + + Mov AX, 1 + Ret + +EndP FileWindow_Right + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc FileWindow_Left Far + + Assume DS:Disk + + Mov Word Ptr [ES:DI], 14 + + Mov AX, 1 + Ret + +EndP FileWindow_Left + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc FileWindow_ShiftTab Far + + Assume DS:Disk + + Mov Word Ptr [ES:DI], 16 + + Mov AX, 1 + Ret + +EndP FileWindow_ShiftTab + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc FileWindow_Home Far + + Assume DS:Disk + + Mov CurrentFile, 0 + + Mov AX, 1 + Ret + +EndP FileWindow_Home + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc FileWindow_End Far + + Assume DS:Disk + + Mov AX, NumFiles + Dec AX + JS FileWindow_End1 + + Mov CurrentFile, AX + +FileWindow_End1: + Mov AX, 1 + Ret + +EndP FileWindow_End + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc FileWindow_DeleteFile Far + + Assume DS:Disk + + Cmp NumFiles, 0 + JE FileWindow_DeleteFile26 + + Mov DI, Offset O1_ConfirmDelete + Mov CX, 4 + Call M_Object1List + And DX, DX + JNZ FileWindow_DeleteFile24 + + Mov AX, 1 + Ret + +FileWindow_DeleteFile24: ; Time to kill the sucker... + Mov DS, CS:DiskDataArea + Mov BX, CS:CurrentFile + Assume DS:Nothing + + Add BX, BX + Mov DX, [BX] + Add DX, 8 ; DS:BX points to thingo. + Mov AH, 41h + Int 21h + JC FileWindow_DeleteFile26 + + Push DS + Pop ES + + Push CS + Pop DS + Assume DS:Disk + + Mov DI, CurrentFile + Mov CX, DI + Add DI, DI + Mov BX, NumFiles + Add BX, NumDirectories + +FileWindow_DeleteFile27: + Mov AX, [ES:DI+2] + StosW + Inc CX + Cmp CX, BX + JBE FileWindow_DeleteFile27 + + Mov AX, NumFiles + Mov BX, CurrentFile + Dec AX + And AX, AX + JZ FileWindow_DeleteFile29 + + Cmp BX, AX + JB FileWindow_DeleteFile28 + + Mov BX, AX + Dec BX + Jmp FileWindow_DeleteFile28 + +FileWindow_DeleteFile29: + Mov BX, AX + +FileWindow_DeleteFile28: + Mov NumFiles, AX + Mov CurrentFile, BX + Dec LoadSongNameCount + +FileWindow_DeleteFile26: + Mov AX, 1 + Ret + +EndP FileWindow_DeleteFile + Assume DS:Nothing + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +Proc DirectoryWindow_Up Far + + Assume DS:Disk + + Mov AX, CurrentDirectory + And AX, AX + JZ DirectoryWindow_Up1 + + Dec CurrentDirectory + +DirectoryWindow_Up1: + Mov AX, 1 + Ret + +EndP DirectoryWindow_Up + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DirectoryWindow_Down Far + + Assume DS:Disk + + Mov AX, CurrentDirectory + Inc AX + Cmp AX, NumDirectories + JAE DirectoryWindow_Down1 + + Inc CurrentDirectory + +DirectoryWindow_Down1: + Mov AX, 1 + Ret + +EndP DirectoryWindow_Down + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DirectoryWindow_PgUp Far + + Assume DS:Disk + + Mov AX, CurrentDirectory + Sub AX, 21 + JC DirectoryWindow_Home + + Mov CurrentDirectory, AX + + Mov AX, 1 + Ret + +EndP DirectoryWindow_PgUp + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DirectoryWindow_PgDn Far + + Assume DS:Disk + + Mov AX, CurrentDirectory + Add AX, 21 + Cmp AX, NumDirectories + JAE DirectoryWindow_End + + Mov CurrentDirectory, AX + + Mov AX, 1 + Ret + +EndP DirectoryWindow_PgDn + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DirectoryWindow_Home Far + + Assume DS:Disk + + Mov CurrentDirectory, 0 + + Mov AX, 1 + Ret + +EndP DirectoryWindow_Home + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DirectoryWindow_End Far + + Assume DS:Disk + + Mov AX, NumDirectories + Dec AX + JS DirectoryWindow_End1 + + Mov CurrentDirectory, AX + +DirectoryWindow_End1: + Mov AX, 1 + Ret + +EndP DirectoryWindow_End + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DirectoryWindow_Left Far + + Assume DS:Disk + + Mov Word Ptr [ES:DI], 12 + + Mov AX, 1 + Ret + +EndP DirectoryWindow_Left + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DirectoryWindow_Enter Far + + Assume DS:Disk + + Cmp NumDirectories, 0 + JE DirectoryWindow_Enter2 + + Mov BX, CurrentDirectory + Add BX, NumFiles + + Mov DS, DiskDataArea + Assume DS:Nothing + + Add BX, BX + Mov DX, [BX] + Add DX, 8 + Mov AH, 3Bh + Int 21h + + Push CS + Pop DS + Assume DS:Disk + + Mov SI, Offset SongDirectory + Call D_GetDriveDirectory + + Call D_InitLoadModule + + Mov CurrentFile, 0 + Mov AX, 12 + Cmp NumFiles, 0 + JNE DirectoryWindow_Enter1 + + Mov AX, 13 + +DirectoryWindow_Enter1: + StosW +; Mov [ES:DI], AX + + Mov AX, 1 + Ret + +DirectoryWindow_Enter2: + Xor AX, AX + Ret + +EndP DirectoryWindow_Enter + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +Proc DriveWindow_Up Far + + Assume DS:Disk + + Mov AL, CurrentDrive + And AL, AL + JZ DriveWindow_Up1 + + Dec CurrentDrive + +DriveWindow_Up1: + Mov AX, 1 + Ret + +EndP DriveWindow_Up + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DriveWindow_Down Far + + Assume DS:Disk + + Mov AL, CurrentDrive + Inc AX + Cmp AL, NumDrives + JAE DriveWindow_Down1 + + Inc CurrentDrive + +DriveWindow_Down1: + Mov AX, 1 + Ret + +EndP DriveWindow_Down + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DriveWindow_Tab Far + + Assume DS:Disk + + Mov Word Ptr [ES:DI], 15 + + Mov AX, 1 + Ret + +EndP DriveWindow_Tab + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LIDriveWindow_Tab Far + + Assume DS:Disk + + Mov Word Ptr [ES:DI], 5 + + Mov AX, 1 + Ret + +EndP LIDriveWindow_Tab + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SaveDriveWindow_Tab Far + + Assume DS:Disk + + Mov Word Ptr [ES:DI], 18 + + Mov AX, 1 + Ret + +EndP SaveDriveWindow_Tab + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DriveWindow_Enter Far + + Assume DS:Disk + + Mov BL, CurrentDrive + Xor BH, BH + Mov DL, [DrivesAvail+BX] + Mov AH, 0Eh + Int 21h + + Mov SI, Offset SongDirectory + Call D_GetDriveDirectory + + Call D_InitLoadModule + + Mov CurrentFile, 0 + Mov AX, 12 + Cmp NumFiles, 0 + JNE DriveWindow_Enter1 + + Mov AX, 13 + Cmp NumDirectories, 0 + JNE DriveWindow_Enter1 + + Mov AX, 14 + +DriveWindow_Enter1: + StosW +; Mov [ES:DI], AX + + Mov AX, 1 + Ret + +EndP DriveWindow_Enter + Assume DS:Nothing + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +Proc LS_DriveWindow_Enter Far + + Assume DS:Disk + + Mov BL, CurrentDrive + Xor BH, BH + Mov DL, [DrivesAvail+BX] + Mov AH, 0Eh + Int 21h + + Mov SI, Offset SampleDirectory + Call D_GetDriveDirectory + + Mov CurrentSample, 0 + Push ES + Push DI + Call D_InitLoadSamples + Pop DI + Pop ES + + Mov Word Ptr [ES:DI], 15 ; Sample list + + Mov AX, 1 + Ret + +EndP LS_DriveWindow_Enter + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +Proc LI_DriveWindow_Enter Far + + Assume DS:Disk + + Mov BL, CurrentDrive + Xor BH, BH + Mov DL, [DrivesAvail+BX] + Mov AH, 0Eh + Int 21h + + Mov SI, Offset InstrumentDirectory + Call D_GetDriveDirectory + + Mov CurrentInstrument, 0 + Push ES + Push DI + Call D_InitLoadInstruments + Pop DI + Pop ES + + Mov Word Ptr [ES:DI], 5 ; Sample list + + Mov AX, 1 + Ret + +EndP LI_DriveWindow_Enter + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LSDriveWindow_Right Far + + Mov Word Ptr [ES:DI], 17 + + Mov AX, 1 + Ret + +EndP LSDriveWindow_Right + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +Proc LoadSample ; AX = Sample number + ; DS:SI points to sample header. + Call PE_SaveCurrentPattern + + Push AX + + Cmp AX, 99 + JNE LoadSample4 + + Mov DX, CS:CurrentSample + Cmp DX, CS:SampleInMemory + JE LoadSample3 + +LoadSample4: + Mov EDX, [DS:SI+30h] + And EDX, EDX + JZ LoadSample6 + Test Byte Ptr [DS:SI+12h], 1 + JZ LoadSample6 + + Call Music_Stop + + Push AX + + Mov AX, 3D00h + Mov DX, SI + Add DX, 4 + Int 21h + JC LoadSample8 + + Mov BX, AX ; BX = File Handle + Mov AX, 4200h + Mov CX, [DS:SI+4Ah] + Mov DX, [DS:SI+48h] + Int 21h ; Move File Ptr. + + Pop AX ; AX = sample number. + + Push SI ; Load sample into memory first. + + Call D_LoadSampleData + + PushF + + Mov AH, 3Eh + Int 21h ; Close file. + + PopF + Pop SI + + JC LoadSample2 + +LoadSample3: + Pop BX + Mov DX, BX + + Add BX, BX + Call Music_GetSongSegment + Mov ES, AX + Mov DI, [ES:BX+64912] ; ES:DI points to instrument + + Mov CX, 48h + Rep MovsB + Add SI, 4 + Add DI, 4 + MovsW + MovsW + + Cmp DX, 99 + JNE LoadSample5 + + Mov AX, [Word Ptr CS:CheckDataArea+2Eh] + Mov [DS:SI-50h+2Eh], AX + Mov AL, [CS:CheckDataArea+12h] + Mov [DS:SI-50h+12h], AL + + Mov AX, CS:CurrentSample + Cmp AX, CS:SampleInMemory + JE LoadSample7 + + Mov CS:SampleInMemory, AX + + Call D_DrawWaveForm + +LoadSample5: + Mov AX, DX + Inc AX + Call Music_SoundCardLoadSample + +LoadSample7: + ClC + Jmp LoadSample1 + Ret + +LoadSample2: + Mov CS:SampleInMemory, 0FFFFh + Jmp LoadSample6 + +LoadSample8: + Pop AX + +LoadSample6: + Pop AX + StC + +LoadSample1: + PushF + Call PE_RestoreCurrentPattern + PopF + Ret + +EndP LoadSample + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +include it_d_ris.inc + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LSViewWindow_Enter Far + + Assume DS:Disk + + Cmp NumSamples, 0 + JE LSViewWindow_Enter1 + + Mov AX, 96 + Mul CurrentSample + Mov SI, AX + Assume DS:Nothing + + Mov DS, DiskDataArea + Mov DL, [DS:SI+88] + Cmp DL, 1 + JE LSViewWindow_Enter1 + + Cmp DL, 20h + JAE LSViewWindow_Enter2 + + Mov AX, 1 + Ret + +EndP LSViewWindow_Enter + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LSWindow_Enter Far + + Assume DS:Disk + + Cmp NumSamples, 0 + JE LSWindow_Enter2 + + Mov AX, 96 + Mul CurrentSample + Mov SI, AX + Assume DS:Nothing + + Mov DS, DiskDataArea + Mov DX, [DS:SI+88] ; Also get DH = InsampleChannels + Cmp DL, 1 + JNE LSWindow_Enter1 + +LSViewWindow_Enter1: + Push DS + Push SI + + Push CS + Pop DS + Mov SI, Offset SampleDirectory + Call D_SetDriveDirectory + + Pop SI + Pop DS + + Add SI, 4 + Call D_SetDriveDirectory + + Push CS + Pop DS + Assume DS:Disk + + Mov SI, Offset SampleDirectory + Call D_GetDriveDirectory + +LSWindow_EnterInModuleError: + Mov SamplesInModule, 0 + Call D_InitLoadSamples + Assume DS:Nothing + Mov CS:CurrentSample, 0 + + Mov AX, 1 + Ret + +LSWindow_Enter1: ; Load sample into sample list. + Cmp DL, 20h + JB LSWindow_EnterSample + +LSViewWindow_Enter2: + Sub DL, 20h + Mov Word Ptr CS:InSampleFormat, DX + Mov EAX, [SI+54h] + Mov CS:InSampleDateTime, EAX + + Add SI, 4 + ; Copy module name across + Push CS + Pop ES + Mov DI, Offset InSampleFileName + Mov CX, 13 + Rep MovsB + ; Open file + Push CS + Pop DS + Assume DS:Disk + + Mov CurrentSample, 0 + +LSWindow_EnterLoadInSampleData: + Mov DX, Offset InSampleFileName + Mov AX, 3D00h + Int 21h + JC LSWindow_EnterInModuleError + + Mov BX, AX + + Mov SI, Word Ptr InSampleFormat + And SI, 0FFh + Add SI, SI + + Mov NumSamples, 1 + + Mov DS, DiskDataArea + Assume DS:Nothing + + Push DS + Pop ES + + Call [CS:LoadSamplesInModuleTable+SI] + + ; Close module + Mov AH, 3Eh + Int 21h + + ; Setup first 'directory' + + Push CS + Pop DS + Assume DS:Disk + + Xor DI, DI + Mov SI, Offset ExitLibraryDirectory + Mov CX, 89 + Rep MovsB + + Mov EAX, InSampleDateTime + Mov [ES:DI-5], EAX + Mov SampleCacheFileComplete, 1 + Mov SamplesInModule, 1 + Mov SampleInMemory, 0FFFFh + Mov SampleCheck, 0FFFFh + + Mov AX, NumSamples + Mov LoadSampleNameCount, AX + + Mov AX, 1 + Ret + + Assume DS:Nothing + +LSWindow_EnterSample: + Call Music_Stop + + Mov AX, [Word Ptr CS:CheckDataArea+2Eh] + Mov [SI+2Eh], AX + ; prompt whether to initialise + ; instrument + ; 1) Only when no sample was + ; previously present + ; 2) When instrument mode is + ; on. + Mov AX, 99 ; Release sample! + Call Music_ReleaseSample + + Xor DX, DX ; Assume don't call. + + Call Music_GetInstrumentMode + JZ LSWindow_Enter4 ; Sample mode! + + ; Instrument mode + + ; Check whether previous sample + ; existed. + Push DS + Push SI + + Mov CX, 4 ; Assume Not OK + + Call I_GetSampleOffset ; DS:BX points to sample. + Test Byte Ptr [BX+12h], 1 + JNZ LSWindow_Enter5 + + Mov CX, 3 ; Assume OK. + +LSWindow_Enter5: + Mov DI, Offset O1_InitInstrument + Call M_Object1List + ; DX contains init flag. + Pop SI + Pop DS + +LSWindow_Enter4: + Push DX + + Call PE_GetLastInstrument + Mov AX, BX + Push AX + Call LoadSample + Pop CX + Xor DX, DX + +IF NETWORKENABLED + NetworkSendSample + Call Network_QueueSampleData +ENDIF + + Pop DX + + Test DX, DX + JZ LSWindow_Enter7 + + Call PE_GetLastInstrument ; BX = sample number + Call Music_AssignSampleToInstrument + + Push CS + Pop DS + Mov SI, Offset InitInstrumentErrorMsg + JC LSWindow_Enter6 + + Mov SI, Offset InitInstrumentMsg + +LSWindow_Enter6: + Call SetInfoLine + +LSWindow_Enter7: + Jmp Glbl_F3 + +LSWindow_Enter2: + Mov AX, 1 + Ret + +EndP LSWindow_Enter + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LSWindow_Space Far + + Assume DS:Disk + + Cmp NumSamples, 0 + JE LSViewWindow_Enter1 + + Mov AX, 96 + Mul CurrentSample + LEA SI, [EAX+14h] + Assume DS:Nothing + + Push SI + + Mov DS, DiskDataArea + + Push CS + Pop ES + Mov DI, Offset SampleName + + Mov CX, 26 + Mov BX, DI + +LSWindow_Space1: + LodsB + And AL, AL + JNZ LS_WindowSpace2 + + Mov AL, ' ' + Jmp LS_WindowSpace3 + +LS_WindowSpace2: + Cmp AL, ' ' + JE LS_WindowSpace3 + + Mov BX, DI + Inc BX + +LS_WindowSpace3: + StosB + Loop LSWindow_Space1 + + Mov Byte Ptr [ES:BX], 0 + + + Mov DI, Offset O1_EditSampleName + Mov CX, 3 + Call M_Object1List + + Pop DI ; DI contains offset of sample + + And DX, DX + JZ LS_WindowSpace4 + + Push CS + Pop DS + Assume DS:Disk + + Mov SI, Offset SampleName + Mov CX, 26 + Mov ES, DiskDataArea + Rep MovsB + +LS_WindowSpace4: + Mov AX, 1 + Ret + +EndP LSWindow_Space + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LSWindow_Up Far + + Call CheckSampleModified + JC LSWindow_Up1 + + Assume DS:Disk + + Mov AX, CurrentSample + And AX, AX + JZ LSWindow_Up1 + + Dec CurrentSample + +LSWindow_Up1: + Mov AX, 1 + Ret + +EndP LSWindow_Up + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LSWindow_Down Far + + Call CheckSampleModified + JC LSWindow_Down1 + + Assume DS:Disk + + Mov AX, CurrentSample + + Inc AX + Cmp AX, NumSamples + JAE LSWindow_Down1 + + Mov CurrentSample, AX + +LSWindow_Down1: + Mov AX, 1 + Ret + +EndP LSWindow_Down + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LSWindow_PgUp Far + + Call CheckSampleModified + JC LSWindow_PgUp1 + + Assume DS:Disk + + Mov AX, CurrentSample + + Sub AX, 35 + JC LSWindow_Home + + Mov CurrentSample, AX + +LSWindow_PgUp1: + Mov AX, 1 + Ret + +EndP LSWindow_PgUp + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LSWindow_PgDn Far + + Call CheckSampleModified + JC LSWindow_PgDn1 + + Assume DS:Disk + + Mov AX, CurrentSample + + Add AX, 35 + Cmp AX, NumSamples + JAE LSWindow_End + + Mov CurrentSample, AX + +LSWindow_PgDn1: + Mov AX, 1 + Ret + +EndP LSWindow_PgDn + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LSWindow_Home Far + + Call CheckSampleModified + JC LSWindow_Home1 + + Assume DS:Disk + + Mov CurrentSample, 0 + +LSWindow_Home1: + Mov AX, 1 + Ret + +EndP LSWindow_Home + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LSWindow_End Far + + Call CheckSampleModified + JC LSWindow_End1 + + Assume DS:Disk + + Mov AX, NumSamples + + Dec AX + JS LSWindow_End1 + + Mov CurrentSample, AX + +LSWindow_End1: + Mov AX, 1 + Ret + +EndP LSWindow_End + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_LSCheckLoopValues Far + + Call D_GetLoadSampleVars ; DS:SI points to thing + + Mov BX, SI + + Mov EAX, [BX+30h] + Cmp EAX, [BX+34h] + JA D_LSCheckLoopValues3 + + Mov [BX+34h], EAX + +D_LSCheckLoopValues3: + Cmp EAX, [BX+38h] + JAE D_LSCheckLoopValues2 + + Mov [BX+38h], EAX + +D_LSCheckLoopValues2: + Mov EAX, [BX+38h] + Cmp EAX, [BX+34h] + JA D_LSCheckLoopValues1 + + And Byte Ptr [BX+12h], NOT 00010000b + +D_LSCheckLoopValues1: + Call D_DrawWaveForm + + Ret + +EndP D_LSCheckLoopValues + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_LSCheckSusLoopValues Far + + Call D_GetLoadSampleVars ; DS:SI points to thing + + Mov BX, SI + + Mov EAX, [BX+30h] + Cmp EAX, [BX+40h] + JA D_LSCheckSusLoopValues3 + + Mov [BX+40h], EAX + +D_LSCheckSusLoopValues3: + Cmp EAX, [BX+44h] + JAE D_LSCheckSusLoopValues2 + + Mov [BX+44h], EAX + +D_LSCheckSusLoopValues2: + Mov EAX, [BX+44h] + Cmp EAX, [BX+40h] + JA D_LSCheckLoopValues1 + + And Byte Ptr [BX+12h], NOT 00100000b + +D_LSCheckSusLoopValues1: + Call D_DrawWaveForm + + Ret + +EndP D_LSCheckSusLoopValues + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_SaveSong Far + + Push CS + Pop DS + Assume DS:Disk + + Mov SI, Offset SongDirectory + Call D_SetDriveDirectory ; DS:SI points to cur dir. + + Cmp Byte Ptr [FileName], 0 + JNE D_SaveSong2 + + Jmp Glbl_F10 + +D_SaveSong2: +; Call D_CheckOverWrite +; JC D_SaveSong1 + + Push CS +; Push CS +; Pop DS + Pop ES + + Mov SI, Offset FileName + Mov DI, Offset SaveFileName + Mov CX, 14 + +D_SaveSong3: + LodsB + StosB + Cmp AL, '.' + LoopNE D_SaveSong3 + JNE D_SaveSong4 + + Cmp SaveFormat, 1 + JE D_SaveSong5 + + Mov AX, 'TI' + StosW + Xor AX, AX + StosB + Jmp D_SaveSong4 + +D_SaveSong5: + Mov AX, '3S' + StosW + Mov AX, 'M' + StosW + +D_SaveSong4: + Xor AL, AL + Call Glbl_SetCurrentMode + + Cmp SaveFormat, 1 + JE D_SaveFileS3MModule + Jmp D_SaveFileITModule + +EndP D_SaveSong + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_PreSaveSample + + Push CS + Pop DS + Assume DS:Disk + + Mov NoSaveError, 0 + + Mov SI, Offset SampleDirectory + Call D_SetDriveDirectory + + Call PE_GetLastInstrument + Call Music_GetSongSegment + Mov DS, AX + Assume DS:Nothing + + Mov SI, BX + Add SI, SI + Mov SI, [DS:64912+SI] ; SI points to sample. + Inc BX + + ; Check if sample exists + Test Byte Ptr [SI+12h], 1 + JZ D_PreSaveSample1 + + Call DeleteSampleCacheFile + + LEA DX, [SI+4] + + Call D_CheckOverWrite + Ret + +D_PreSaveSample1: + StC + Ret + +EndP D_PreSaveSample + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_SaveSample Far + + Call D_PreSaveSample + JC D_SaveSample2 + +Proc D_SaveSampleInternal Far + ; OK to save. DS:SI points to + ; structure, BX = sample num + Mov ES, CS:DiskDataArea + Xor DI, DI + Mov CX, 80 + Rep MovsB + Mov Byte Ptr [ES:2Eh], 1 + Mov DWord Ptr [ES:48h], 80 + + Push ES + Pop DS + + Mov AH, 3Ch + Xor CX, CX + Mov DX, 4 + Int 21h ; Open file. + JC D_SaveSample2 + + Push BX ; BX = sample number + Mov BX, AX ; BX = file handle + + Mov AH, 40h + Mov CX, 80 + Xor DX, DX + Int 21h ; Save header. + + Pop AX ; AX = sample number + Push AX + + Call D_SaveSampleData + PushF + + Mov AH, 3Eh + Int 21h ; Close file + + PopF + Pop BX ; AX = sample number + JC D_SaveSample2 + + Push CS + Pop DS + Mov AX, BX + Mov SI, Offset ITSampleSavedMsg + Call SetInfoLine + + Jmp D_SaveSampleEnd + +D_SaveSample2: + Push CS + Pop DS + Mov AX, BX + Mov SI, Offset SampleErrorMsg + Call SetInfoLine + +D_SaveSampleEnd: + Mov AX, 1 + Ret + +EndP D_SaveSampleInternal + +EndP D_SaveSample + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_SaveRawSample Far + Assume DS:Disk + + Call D_PreSaveSample ; DS:SI points to structure + JC D_SaveRawSample2 + Assume DS:Nothing + +IF SAVESAMPLEWAV + Mov DWord Ptr [CS:WaveBytesPerSample], 80001h + Mov ECX, [SI+3Ch] ; C5Speed + Mov [CS:WAVEMixSpeed], ECX + Mov EAX, [SI+30h] ; Length + Test Byte Ptr [SI+12h], 2 + JZ D_SaveWAVHeader1 + + Add EAX, EAX + Add ECX, ECX + Mov DWord Ptr [CS:WaveBytesPerSample], 100002h + +D_SaveWAVHeader1: + Mov [CS:WAVEDataSize], EAX + Mov [CS:WAVEBytesPerSecond], ECX +ENDIF + Push DS + Push SI + + Mov AX, BX ; AX = sample number. + Xor CX, CX + Call Music_GetSampleLocation ; ES:DI points to sample. + + Mov DI, SI + Push DS + Pop ES + + Pop SI + Pop DS + + PushF + + Mov AH, 3Ch + Xor CX, CX + LEA DX, [SI+4] + Int 21h + JC D_SaveRawSample3 + +IF SAVESAMPLEWAV + PushA + Push DS + + Push CS + Pop DS + + Mov BX, AX + Mov AH, 40h + Mov DX, Offset WAVEFileHeader + Mov CX, 2Ch + Int 21h + + Pop DS + PopA +ENDIF + + PopF + Push BX + XChg AX, BX ; BX = file handle, AX = sample + ; number + JZ D_SaveRawSample1 ; 8 bit, write as unsigned + + Call D_SaveSampleData + PushF + Jmp D_SaveRawSample4 + +D_SaveRawSample1: + Call D_SaveSampleDataConvert + PushF + +D_SaveRawSample4: + Mov AH, 3Eh + Int 21h ; Close file. + + PopF + Pop BX ; BX = Sample number + + JC D_SaveRawSample2 + + Push CS + Pop DS + Assume DS:Disk + + Mov AX, BX + Mov SI, Offset RawSampleSavedMsg + Call SetInfoLine + + ClC + Jmp D_SaveRawSampleEnd + +D_SaveRawSample3: + PopF + +D_SaveRawSample2: + Push CS + Pop DS + Mov AX, BX + Mov SI, Offset SampleErrorMsg + Call SetInfoLine + StC + +D_SaveRawSampleEnd: + Mov AX, 1 + Ret + +EndP D_SaveRawSample + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_SaveST3Sample Far + + Call D_PreSaveSample + JC D_SaveST3Sample2 + + ; OK to save. DS:SI points to + ; structure, BX = sample num + Mov ES, CS:DiskDataArea + Xor DI, DI + Mov AL, 1 + StosB + Push SI + Mov CX, 13 + Add SI, 4 + Rep MovsB + Pop SI + Mov AX, 5 + StosW ; FileName + + Mov EAX, [DS:SI+30h] ; LoopStart + StosD + + Mov EAX, [DS:SI+34h] ; LoopBeg + StosD + + Mov EAX, [DS:SI+38h] ; LoopEnd + StosD + + Xor AX, AX + Mov AL, Byte Ptr [DS:SI+13h] + StosW ; Volume + + Mov AH, [DS:SI+12h] + Mov AL, AH + And AX, 1002h + ShR AH, 4 + ShL AL, 1 + Or AH, AL + Xor AL, AL + StosW ; Flags & Pack + + Mov EAX, [DS:SI+3Ch] + StosD + + Mov CX, 6 + Xor AX, AX + Rep StosW + + Add SI, 14h + Mov CX, 25 + Rep MovsB + Xor AX, AX + StosB + StosW + + Mov EAX, 'SRCS' + StosD + + Push ES + Pop DS + + Mov AH, 3Ch + Xor CX, CX + Mov DX, 1 + Int 21h ; Open file. + JC D_SaveST3Sample2 + + Push BX ; BX = sample number + Mov BX, AX ; BX = file handle + + Mov AH, 40h + Mov CX, 80 + Xor DX, DX + Int 21h ; Save header. + + Pop AX ; AX = sample number + Push AX + + Call D_SaveSampleDataConvert + + PushF + + Mov AH, 3Eh + Int 21h ; Close file + + PopF + Pop BX + + JC D_SaveST3Sample2 + + Push CS + Pop DS + Mov AX, BX + Mov SI, Offset ST3SampleSavedMsg + Call SetInfoLine + + Jmp D_SaveST3SampleEnd + +D_SaveST3Sample2: + Push CS + Pop DS + Mov AX, BX + Mov SI, Offset SampleErrorMsg + Call SetInfoLine + +D_SaveST3SampleEnd: + Mov AX, 1 + Ret + +EndP D_SaveST3Sample + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_SaveInstrument Far + + Push CS + Pop DS + Assume DS:Disk + + Mov NoSaveError, 0 + + Mov SI, Offset InstrumentDirectory + Call D_SetDriveDirectory + + Call PE_GetLastInstrument + Call Music_GetSongSegment + Mov DS, AX + Assume DS:Nothing + + Mov SI, BX + Add SI, SI + Mov SI, [DS:64712+SI] ; SI points to instrument + + Call DeleteInstrumentCacheFile + +; Mov DX, SI +; Add DX, 4 + LEA DX, [SI+4] + + Call D_CheckOverWrite + JC D_SaveInstrumentError + + ; DS:SI still points to ins. + ; Clear InstrumentTable setup table. + Push CS + Pop ES + Mov DI, Offset InstrumentTable + Xor AX, AX + Mov CX, 50 + Rep StosW ; OK.. table clear. + + ; Now step through instrument + ; list and get sample numbers. + Push DS + Push SI + + Add SI, 40h + Mov CX, 120 + Xor BX, BX + +D_SaveInstrument1: + LodsW + Mov BL, AH ; BL = sample number. + Mov [CS:InstrumentTable+BX], 1 + Loop D_SaveInstrument1 + + ; OK. Instrument table contains + ; 1s for every sample used... + ; Now to re-translate it. + Push CS + Pop DS + Assume DS:Disk + + Mov AH, 0 + Mov CX, 99 + Mov SI, Offset InstrumentTable + Mov Byte Ptr [SI], 0 + +D_SaveInstrument2: + Cmp Byte Ptr [SI], 0 + JE D_SaveInstrument3 + + Inc AH + Mov [SI], AH + +D_SaveInstrument3: + Inc SI + Loop D_SaveInstrument2 + ; AH = number of samples.. + ; Now let's copy it to the Diskdata. + + Pop SI + Pop DS + Assume DS:Nothing + + Mov ES, CS:DiskDataArea + Xor DI, DI + Mov CX, 554/2 + + Rep MovsW + + Push ES + Pop DS + Assume DS:Nothing + + Mov [DS:1Eh], AH ; AH = number of samples. + Mov Word Ptr [DS:1Ch], TRACKERVERSION + + ; Now to translate + Mov DI, 41h +; Xor BX, BX + Mov CX, 120 + +D_SaveInstrument4: + Mov BL, [DI] + Mov AL, [CS:InstrumentTable+BX] + StosB + Inc DI + + Loop D_SaveInstrument4 + ; headerfilesize=554(instrumentheader)+ + ; 80*AH. + Mov AL, 80 + Mul AH + Add AX, 554 ; AX = header size. + + Push AX + + Mov DX, AX + Xor CX, CX ; CX:DX = posn in file. + + Call Music_GetSongSegment + Mov DS, AX + Mov DI, 554 ; DI = posn in header. + Xor BX, BX + +D_SaveInstrument5: ; Loop to get samples into header. + Cmp [CS:InstrumentTable+BX], 0 + JE D_SaveInstrument6 + + Mov SI, BX + Add SI, SI + Mov SI, [DS:64912+SI-2] ; DS:SI points to sample. + + Push CX ; Move the header... + Mov CX, 40 + Rep MovsW + Pop CX + + Mov [ES:DI-80+48h], DX ; File pointer. + Mov [ES:DI-80+4Ah], CX + + Mov AL, [ES:DI-80+12h] + Test AL, 1 + JZ D_SaveInstrument6 + + Add DX, [ES:DI-80+30h] + AdC CX, [ES:DI-80+32h] + + Test AL, 2 + JZ D_SaveInstrument6 + + Add DX, [ES:DI-80+30h] + AdC CX, [ES:DI-80+32h] + +D_SaveInstrument6: + Inc BX + Cmp BX, 100 + JB D_SaveInstrument5 + + Push ES + Pop DS ; Lets open the file! + Mov DX, 4 + + Mov AH, 3Ch ; Open file! + Xor CX, CX ; Normal attributes + Int 21h + + Pop CX ; CX = header size + + JC D_SaveInstrumentError + + Mov BX, AX ; BX = file handle... + + Xor DX, DX + Call D_SaveBlock ; OK.. header's written.. now save + ; individual samples... + Mov DI, 1 + +D_SaveInstrument7: + Cmp [CS:InstrumentTable+DI], 0 + JE D_SaveInstrument8 + + Mov AX, DI + + Call D_SaveSampleData + +D_SaveInstrument8: + Inc DI + Cmp DI, 100 + JBE D_SaveInstrument7 + + Mov AH, 3Eh + Int 21h + Jmp D_SaveInstrumentOK + +D_SaveInstrumentError: + Push CS + Pop DS + + Call PE_GetLastInstrument + Mov AX, BX + Inc AX + Mov SI, Offset InstrumentErrorMsg + Call SetInfoLine + + Jmp D_SaveInstrumentEnd + +D_SaveInstrumentOK: + Push CS + Pop DS + + Call PE_GetLastInstrument + Mov AX, BX + Inc AX + Mov SI, Offset ITInstrumentSavedMsg + Call SetInfoLine + +D_SaveInstrumentEnd: + Mov AX, 1 + Ret + +EndP D_SaveInstrument + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_DeleteSampleFile Far + + Push CS + Pop DS + Assume DS:Disk + + Cmp NumSamples, 0 + JE D_DeleteSampleFile1 + Cmp SamplesInModule, 0 + JNE D_DeleteSampleFile1 + + Mov AX, 96 + Mul CurrentSample + Mov SI, AX + Mov DS, DiskDataArea + Assume DS:Nothing + Cmp Byte Ptr [DS:SI+58h], 1 + JBE D_DeleteSampleFile1 ; Don't delete dirs! +; Cmp Byte Ptr [DS:SI+58h], 20h +; JAE D_DeleteSampleFile1 + + Push DS + Push SI + + Mov DI, Offset O1_ConfirmDelete2 + Mov CX, 4 + Call M_Object1List + + Pop SI + Pop DS + + And DX, DX ; OK to delete? + JZ D_DeleteSampleFile1 + + ; Delete file.... + LEA DX, [SI+4] + Mov AH, 41h + Int 21h + JC D_DeleteSampleFile1 + + Push CS + Pop DS + Assume DS:Disk + + Mov DI, SI + Add SI, 96 + + Mov CX, NumSamples ; Wipe from list.. + Mov BX, CurrentSample + Sub CX, BX + + Mov AX, 96 + Mul CX + Mov CX, AX + + Push DS + + Mov DS, DiskDataArea + Push DS + Pop ES + + Rep MovsB + + Pop DS + + Mov SampleInMemory, 0FFFFh + Mov SampleCheck, 0FFFFh + + Dec NumSamples + JZ D_DeleteSampleFile2 + + Cmp BX, NumSamples + JB D_DeleteSampleFile2 + + Mov BX, NumSamples + Dec BX + Mov CurrentSample, BX + +D_DeleteSampleFile2: + Cmp SampleCacheFileComplete, 1 + JNE D_DeleteSampleFile1 + + Call D_SaveSampleCacheFile + +D_DeleteSampleFile1: + Mov AX, 1 + Ret + +EndP D_DeleteSampleFile + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc CheckSampleModified + + Push CS + Pop DS + Assume DS:Disk + + Cmp SamplesInModule, 0 + JNE CheckSampleModified1 + + Mov AX, 96 + Mul CurrentSample + + Mov ES, DiskDataArea + Mov DI, AX + Mov DL, [ES:DI+88] + Cmp DL, 1 + JBE CheckSampleModified1 + Cmp DL, 20h + JAE CheckSampleModified1 + + Mov SI, Offset CheckDataArea + + Mov CX, 12h + RepE CmpSB + JNE CheckSampleModified7 + Inc SI + Inc DI + Mov CX, 50h-12h-1 + RepE CmpsB + JE CheckSampleModified1 + Mov CX, 80 + RepE CmpsB + + ; Check whether file name changed... +CheckSampleModified7: + Mov DI, AX + Mov SI, Offset CheckDataArea+4 + Add DI, 4 + + Mov CX, 13 + RepE CmpsB + JE CheckSampleModified3 + +CheckSampleModified2: ; Sample name different. + Mov DI, Offset O1_ConfirmSaveRenameList + Mov CX, 3 + Call M_Object1List + ; DX = 0 -> don't save + ; DX = 1 -> save + And DX, DX + JZ CheckSampleModified4 + + ; Load Sample + Push CS + Pop DS + + Mov SI, Offset CheckDataArea + Mov AX, 99 + Call LoadSample ; Load sample into slot 100! + JC CheckSampleModified5 + ; Save sample + Mov AX, 96 + Mul CS:CurrentSample + Mov SI, AX + Mov DS, CS:DiskDataArea + Mov BX, 100 ; DS:SI points to block + Push DS + Push SI + Call D_SaveSampleInternal + Pop SI + Pop DS + JC CheckSampleModified6 + ; Delete old sample + + Push CS + Pop DS + Mov DX, Offset CheckDataArea+4 + Mov AH, 41h + Int 21h ; Delete file + + ; Now update sample data... + + Call DeleteSampleCacheFile + Call D_InitLoadSamples + + Jmp CheckSampleModified1 ; Return OK! + +CheckSampleModified3: ; Sample name the same. + Mov DI, Offset O1_ConfirmResaveList + Mov CX, 3 + Call M_Object1List + ; DX = 0 -> don't save + ; DX = 1 -> save + And DX, DX + JZ CheckSampleModified4 + + ; Load Sample + Push CS + Pop DS + + Mov SI, Offset CheckDataArea + Mov AX, 99 + Call LoadSample ; Load sample into slot 100! + JC CheckSampleModified5 + + ; Save Sample + Mov AX, 96 + Mul CS:CurrentSample + Mov SI, AX + Mov DS, CS:DiskDataArea + Mov BX, 100 ; DS:SI points to block + Push DS + Push SI + Call D_SaveSampleInternal + Pop SI + Pop DS + JC CheckSampleModified6 + ; Now update sample data... + Call DeleteSampleCacheFile + Call D_InitLoadSamples + + Jmp CheckSampleModified1 + +CheckSampleModified4: ; Prompt to discard changes.. + Mov DI, Offset O1_ConfirmDiscardList + Mov CX, 4 + Call M_Object1List + ; DX = 0 -> don't discard + ; DX = 1 -> discard + And DX, DX + JZ CheckSampleModified5 + + Push CS + Pop DS + Assume DS:Disk + + Mov SI, Offset CheckDataArea + Mov ES, DS:DiskDataArea + Mov AX, 96 + Mul CurrentSample + Mov DI, AX + Mov CX, 80 + Rep MovsB + + Jmp CheckSampleModified1 + +CheckSampleModified6: + Call DeleteSampleCacheFile + Call D_InitLoadSamples + +CheckSampleModified5: + Push CS + Pop DS + + StC + Ret + +CheckSampleModified1: + Push CS + Pop DS + + ClC + Ret + +EndP CheckSampleModified + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_DrawWaveForm Far + + PushAD + Push DS + Push ES + + Call S_GetGenerationTableOffset + Push DI + Mov CX, 248*32 + Xor AL, AL + Rep StosB + Pop DI + + Mov AX, 100 + Xor CX, CX + Call Music_GetSampleLocation ; Gets DS:SI and CX + JC D_DrawWaveFormEnd + +; Push AX ; AX = instrument num + ; DS:SI = waveform, CX = length + ; ES:DI = charactergenerationtable + + SetNZ CS:Resolution + JZ D_DrawWaveForm8Bit + + Add ECX, ECX + Inc SI + +D_DrawWaveForm8Bit: + + Mov EAX, ECX + Mov ECX, 248 + Xor EDX, EDX + Div ECX ; AX = major shift. DX = minor shift. + + Mov EBX, EAX + Xor EAX, EAX + Div ECX + + Mov EDX, EAX + Xor EAX, EAX + + Mov EBP, ESI + +D_DrawWaveForm6: + Add EAX, EDX + AdC EBP, EBX + Push EAX + Push EBX + Push ECX + Push EDX + + Mov CL, [SI] + Mov CH, CL + + Mov BX, 1 + Add BL, CS:Resolution + +D_DrawWaveForm10: + Cmp ESI, EBP + JAE D_DrawWaveForm7 + + Mov AL, [SI] + Add SI, BX + JC D_DrawWaveFormUpdateLocation + +D_DrawWaveFormResume: + Cmp AL, CL + JL D_DrawWaveForm8 + + Cmp AL, CH + JLE D_DrawWaveForm10 + + Mov CH, AL + Jmp D_DrawWaveForm10 + +D_DrawWaveFormUpdateLocation: + Add ESI, 10000h + Int 3 + Jmp D_DrawWaveFormResume + +D_DrawWaveForm8: + Mov CL, AL + Jmp D_DrawWaveForm10 + +D_DrawWaveForm7: ; CL = min, CH = max. + Mov AX, CX + SAR AH, 1 + SAR AL, 1 + Add AX, 202h + SAR AL, 2 + SAR AH, 2 + + Xor CH, CH + Mov CL, AH + Sub CL, AL ; CX = iterations. + Inc CX + + Mov AL, 16 + Sub AL, AH + Cmp AL, 32 + JNE D_DrawWaveForm13 + + Mov AL, 31 + +D_DrawWaveForm13: + Mov AH, 31*8 + Mul AH + Mov BX, AX + +D_DrawWaveForm11: + Mov Byte Ptr [ES:DI+BX], 1 + Add BX, 248 + Loop D_DrawWaveForm11 + +D_DrawWaveForm12: + Pop EDX + Pop ECX + Pop EBX + Pop EAX + Inc DI + Loop D_DrawWaveForm6 + + ; Get Sample header offset. +; Call Music_GetSongSegment +; Mov DS, AX +; Pop SI +; Dec SI +; Add SI, SI +; Mov SI, [64912+SI] + Mov AX, 96 + Mul CS:CurrentSample + Mov DS, CS:DiskDataArea + Mov SI, AX + + + Mov EBX, [DS:SI+30h] + Test Byte Ptr [DS:SI+12h], 10h + JZ D_DrawWaveForm14 + + Mov ECX, EBX + ShR ECX, 1 + + Mov EAX, 247 + Mul DWord Ptr [DS:SI+34h] + Add EAX, ECX + AdC EDX, 0 + Div EBX + + Push EAX ; AX = loop start. + + Mov EAX, 247 + Mul DWord Ptr [DS:SI+38h] + Add EAX, ECX + AdC EDX, 0 + Div EBX + Mov EDX, EAX + Pop EAX ; DX = loop end (0-175) + ; AX = loop start (0-175) + + Call S_GetGenerationTableOffset + ; ES:DI + Add DI, AX + Sub DX, AX + Dec DX + Mov CX, 32 + Mov AH, 1 + +D_DrawSampleWaveFormLoop1: + Push DI + + Xor AL, AL + Test AH, 2 + JZ D_DrawSampleWaveFormLoop2 + + Inc AX + +D_DrawSampleWaveFormLoop2: + StosB + Add DI, DX + StosB + + Pop DI + Add DI, 248 + Inc AH + Loop D_DrawSampleWaveFormLoop1 + +D_DrawWaveForm14: + Test Byte Ptr [DS:SI+12h], 20h + JZ D_DrawWaveFormEnd + + Mov ECX, EBX + ShR ECX, 1 + + Mov EAX, 247 + Mul DWord Ptr [DS:SI+40h] + Add EAX, ECX + AdC EDX, 0 + Div EBX + + Push EAX ; AX = loop start. + + Mov EAX, 247 + Mul DWord Ptr [DS:SI+44h] + Add EAX, ECX + AdC EDX, 0 + Div EBX + Mov EDX, EAX + Pop EAX ; DX = loop end (0-175) + ; AX = loop start (0-175) + + Call S_GetGenerationTableOffset + ; ES:DI + Add DI, AX + Sub DX, AX + Dec DX + Mov CX, 32 + Mov AL, 1 + +D_DrawSampleWaveFormSusLoop1: + Push DI + + StosB + Add DI, DX + StosB + + Pop DI + Add DI, 248 + Xor AL, 1 + Loop D_DrawSampleWaveFormSusLoop1 + +D_DrawWaveFormEnd: + Mov AX, 0 + Mov BX, 31 + Mov CX, 4 + Call S_GenerateCharacters + + Pop ES + Pop DS + PopAD + + Ret + +EndP D_DrawWaveForm + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_ClearFileName Far + + Push AX + Push CX + Push ES + Push DI + + Mov DI, Offset FileName + Push CS + Pop ES + Mov CX, 7 + Xor AX, AX + Rep StosW + + Pop DI + Pop ES + Pop CX + Pop AX + Ret + +EndP D_ClearFileName + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_GetFormatType Far + + Push CS + Pop ES + Mov DI, Offset SaveFormat + + Ret + +EndP D_GetFormatType + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_DisableFileColours Far + + Mov CS:FileColours, 0 + + Ret + +EndP D_DisableFileColours + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_LoadInstrumentFiles + + Mov DS, CS:DiskDataArea + Push DS + Pop ES + + Xor DI, DI + Xor AX, AX + Mov CX, 32768 + Rep StosW + + Mov DX, 64000 + Mov AH, 1Ah + Int 21h ; Shift DTA address.. + ; to DiskDataArea:64000 + + Xor DI, DI + + Push CS + Pop DS + Mov DX, Offset AllFilesMask + Mov CX, 10h + Mov AH, 4Eh + Int 21h + + Mov DS, CS:DiskDataArea + Push DS + Pop ES + + JC D_LoadInstrumentFiles2 + +D_LoadInstrumentFiles1: ; A directory was found! + Test Byte Ptr [DS:64000+15h], 10h + JZ D_LoadInstrumentFiles5 ; Check that it IS a directory + + Cmp Word Ptr [DS:64000+1Eh], '.' + JNE D_LoadInstrumentFilesNoRoot + + Mov Byte Ptr [DS:64000+1Eh], '\' + +D_LoadInstrumentFilesNoRoot: + Mov DL, 1 + Call Near Ptr D_LoadInstrumentFiles6 + + Inc CS:NumInstruments + Inc CS:LoadInstrumentNameCount + + Cmp CS:NumInstruments, 999 + JAE D_LoadInstrumentFiles4 + +D_LoadInstrumentFiles5: + Mov AH, 4Fh + Int 21h + JNC D_LoadInstrumentFiles1 + +D_LoadInstrumentFiles2: ; Directories done.. samples now + Push CS + Pop DS + Mov DX, Offset AllFilesMask + Xor CX, CX + Mov AH, 4Eh + Int 21h + + Mov DS, CS:DiskDataArea + Push DS + Pop ES + + JC D_LoadInstrumentFiles4 + +D_LoadInstrumentFiles3: +; Push DI +; +; Mov SI, Offset InstrumentCacheFileName +; Mov DI, 64000+1Eh +; Mov CX, 9 +; Rep SegCS CmpsB +; Pop DI +; JE D_LoadInstrumentFilesNext + + Mov DL, 0 + Call Near Ptr D_LoadInstrumentFiles6 + + Inc CS:NumInstruments + Cmp CS:NumInstruments, 999 + JAE D_LoadInstrumentFiles4 + +D_LoadInstrumentFilesNext: + Mov AH, 4Fh + Int 21h + JNC D_LoadInstrumentFiles3 + +D_LoadInstrumentFiles4: ; End! + Mov AX, CS:NumInstruments + Mov CS:InitialInstruments, AX + + Ret + +D_LoadInstrumentFiles6: ; Get name/size/date/time. + Mov AL, DL + StosB + + Mov SI, 64000+1Eh + Mov CX, 14 ; Name.. + Rep MovsB + + Cmp DL, 1 + JNE D_LoadInstrumentFiles7 + + Push DS + Push CS + Pop DS + Mov SI, Offset DirectoryMsg + Mov CX, 25 + Rep MovsB + + Pop DS + + Xor AX, AX + Mov CX, 4 + Rep StosW + + RetN + +D_LoadInstrumentFiles7: + Xor AX, AX + Mov CX, 27 + Rep StosB ; No instrumentname, NOS = 0. + + Mov AX, [DS:64000+1Ah] ; File Size.. + Mov DX, [DS:64000+1Ch] + + SHRD AX, DX, 10 + ShR DX, 10 + JZ D_LoadInstrumentFiles8 + + Mov AX, 0FFFFh + +D_LoadInstrumentFiles8: + StosW + + Xor EAX, EAX ; Offset + StosD + + RetN + +EndP D_LoadInstrumentFiles + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_InitLoadInstruments Far + + Push CS + Pop DS + Assume DS:Disk + + Mov SI, Offset InstrumentDirectory + Call D_SetDriveDirectory ; DS:SI points to cur dir. + + Call Music_GetSongSegment + Mov DS, AX + + Mov CX, 99 + Mov BX, [DS:64912] ; BX = offset to first + ; sample. + + Mov DX, CX ; DX = counter. + Add BX, 12h + +D_InitLoadInstruments4: + Mov AL, [BX] + ShR AL, 1 + SBB DX, 0 + + Add BX, 80 + Loop D_InitLoadInstruments4 + + Push CS + Pop DS + Assume DS:Disk + + Mov UnusedSamples, DX + + Cmp InstrumentsInModule, 0 + JE D_InitLoadInstruments5 + + Jmp LIWindow_EnterLoadInInstrumentData + +D_InitLoadInstruments5: + Mov LoadInstrumentNameCount, 0 + Mov NumInstruments, 0 + Mov InstrumentCacheFileComplete, 0 + + Mov SI, Offset InstrumentDirectory + Call D_SetDriveDirectory ; DS:SI points to cur dir. + + Mov [OldCacheTime], 0 + + Mov AX, 3D00h ; Open file.. + Mov DX, Offset InstrumentCacheFileName + Int 21h + JC D_InitLoadInstrument1 ; Can't open file? + + Mov BX, AX + + Mov AH, 3Fh + Mov CX, 6 ; 2 integers containing number + ; of sample entries... + ; 3rd word = Version check + Mov DS, DiskDataArea + Assume DS:Nothing + + Xor DX, DX + Int 21h + JC D_InitLoadInstrument3 + Cmp AX, CX + JNE D_InitLoadInstrument3 + + Mov AL, [CS:InstrumentDirectory] ; AL = drive letter + Cmp AL, [CS:CDRomStartDrive] + JL InstrumentVersionCheck + Cmp AL, [CS:CDRomEndDrive] + JGE InstrumentVersionCheck + + Cmp Word Ptr [DS:4], 211h + JB D_InitLoadInstrument3 + Cmp Word Ptr [DS:4], TRACKERVERSION + JBE D_InitLoadInstrumentsCacheOK + +InstrumentVersionCheck: + Cmp Word Ptr [DS:4], TRACKERVERSION + JNE D_InitLoadInstrument3 + +InstrumentVersionCheckEnd: + Mov AX, 5700h ; Get file date&time. + Int 21h + + Mov Word Ptr [OldCacheTime], CX + Mov Word Ptr [OldCacheTime+2], DX + + Cmp CX, Time ; Check time and date + JNE D_InitLoadInstrumentOldCache ; for 'currentness' + Cmp DX, Date + JNE D_InitLoadInstrumentOldCache + ; OK.. let's load... + +D_InitLoadInstrumentsCacheOK: + Mov AX, [DS:0] + Mov CS:InitialInstruments, AX + + Mov SI, [DS:2] ; Number of samples. + Mov AX, 48 + Mul SI + Mov CX, AX ; Bytes to read. + + Mov AH, 3Fh ; Load again. + Xor DX, DX ; In case of internal malfunc. + Int 21h + JC D_InitLoadInstrument3 + Cmp AX, CX + JNE D_InitLoadInstrument3 + + Mov AH, 3Eh ; Close file. + Int 21h + + Push CS + Pop DS + Assume DS:Disk + + Mov LoadInstrumentNameCount, SI + Mov NumInstruments, SI + Mov InstrumentCacheFileComplete, 1 + + Jmp D_InitLoadInstrument2 + +D_InitLoadInstrumentOldCache: + PushA + Push DS + + Call D_GetNumFiles + + Pop DS + JC D_InitLoadInstrument5 + + Cmp AX, [DS:0] + + PopA + JNE D_InitLoadInstrument3 + + Call Far Ptr D_InitLoadInstrumentsCacheOK + + Call D_SaveInstrumentCacheFile ; Resave it with new date + + Ret + +D_InitLoadInstrument5: + PopA + +D_InitLoadInstrument3: + Mov AH, 3Eh ; Close file. + Int 21h + + Push CS + Pop DS + Assume DS:Disk + + Call DeleteInstrumentCacheFile + +D_InitLoadInstrument1: + Call D_LoadInstrumentFiles + +D_InitLoadInstrument2: + Ret + +EndP D_InitLoadInstruments + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_LoadInstrumentNames Far + + Push CS + Pop DS + Assume DS:Disk + + Cmp InstrumentCacheFileComplete, 1 + JNE D_LoadInstrumentNames2 + +D_LoadInstrumentNames6: + Xor AX, AX ; No redraw screen. + Ret + +D_LoadInstrumentNames2: + Mov BX, LoadInstrumentNameCount + Cmp BX, NumInstruments + JAE D_LoadInstrumentNames5 + +D_LoadInstrumentNames1: + Call K_IsAnyKeyDown + And AL, AL + JNZ D_LoadInstrumentNames6 + + Call GetKeyboardLock + And AL, AL + JNZ D_LoadInstrumentNames6 + + Mov AX, 48 + Mul BX + Mov SI, AX + Mov ES, DiskDataArea + Cmp Byte Ptr [ES:SI], 0 + JNE D_LoadInstrumentNames3 + + Call D_LoadInstrumentHeader + JC D_LoadInstrumentNames3 + + Call D_GetInstrumentInfo ; BX = sample number + Push CS + Pop DS + JC D_LoadInstrumentNames7 + +D_LoadInstrumentNames3: + Push CS + Pop DS + Assume DS:Disk + + Inc LoadInstrumentNameCount + +D_LoadInstrumentNames7: + Mov BX, LoadInstrumentNameCount + Cmp BX, NumInstruments + JNE D_LoadInstrumentNames4 + ; Save cache file.. + +D_LoadInstrumentNames5: + Call D_SaveInstrumentCacheFile + Cmp CurrentInstrument, 0 + JNE D_LoadInstrumentNames4 + Call D_SlowInstrumentSort + +D_LoadInstrumentNames4: + Mov AX, 1 ; Signify redraw screen + Ret + +EndP D_LoadInstrumentNames + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_DrawLoadInstrument Far + + Cmp CS:NumInstruments, 0 + JNE D_DrawLoadInstrumentPresent + + Jmp D_DrawLoadInstrumentEnd + +D_DrawLoadInstrumentPresent: + Mov BX, CS:CurrentInstrument + Mov AX, 48 + Mul BX + Mov SI, AX + Mov ES, CS:DiskDataArea + + Cmp Byte Ptr [ES:SI], 0 + JNE D_DrawLoadInstrumentWindow28 + + Call D_LoadInstrumentHeader + Call D_GetInstrumentInfo + JC D_DrawLoadInstrument + +D_DrawLoadInstrumentWindow28: + Call S_GetDestination + + Push CS + Pop DS + Assume DS:Disk + + Mov AX, TopInstrument + Mov BX, CurrentInstrument + Cmp AX, BX + JBE D_DrawLoadInstrument1 + + Mov AX, BX + +D_DrawLoadInstrument1: + LEa CX, [EAX+34] + Cmp CX, BX + JA D_DrawLoadInstrument2 + + LEA AX, [BX-34] + +D_DrawLoadInstrument2: + Mov TopInstrument, AX + + Mov DS, DiskDataArea + Assume DS:Nothing + + Mov DI, (2+13*80)*2 + Mov CX, 35 + +D_DrawLoadInstrument3: + Push AX + Push CX + Push DI + + Cmp AX, CS:NumInstruments + JB D_DrawLoadInstrument4 + + Mov AX, 2A8h + Add DI, 58 + StosW + Add DI, 24 + StosW + +D_DrawLoadInstrument10: + Add DI, 20 + StosW + + Jmp D_DrawLoadInstrument5 + +D_DrawLoadInstrument4: + Inc AX + Mov CH, 20h + Call PE_ConvAX2Num + Dec AX + + Add DI, 8 + Mov BX, 48 + Mul BX + Mov SI, AX ; SI = offset in diskdata.. + ; Name first.. + + Mov DL, [SI] + ; DL = type. 0 = unchecked + ; 1 = directory + ; 2 = unknown + ; 3 = ITI. + Mov AH, 6 + Cmp DL, 1 + JB D_DrawLoadInstrument6 + + Mov AH, 5 + JE D_DrawLoadInstrument6 + + Mov AH, 7 + Cmp DL, 2 + JE D_DrawLoadInstrument6 + + Mov AH, 3 + +D_DrawLoadInstrument6: + Mov DH, AH ; DH = col. + Mov CX, 25 ; Instrument Name + Add SI, 15 + +D_DrawLoadInstrument7: + LodsB + + Cmp AL, 226 + JB D_DrawLoadInstrumentCharFilter + + Mov AL, ' ' + +D_DrawLoadInstrumentCharFilter: + StosW + Loop D_DrawLoadInstrument7 + + Mov AX, 2A8h + StosW ; Divider 1. + + Mov AH, DH + ; File name... + Sub SI, 39 + Mov CX, 12 + +D_DrawLoadInstrument8: + LodsB + StosW + And AL, AL + LoopNZ D_DrawLoadInstrument8 + + Add DI, CX + Add DI, CX + + Mov AX, 2A8h + StosW ; Divider 2. + + Cmp DL, 3 + JB D_DrawLoadInstrument10 + + LEA SI, [ESI+ECX+27] + LodsW ; AX = number of samples. + + Push DS + Push SI + Push DI + Push AX + + Cmp Byte Ptr [SI-42], 8 + + Push CS + Pop DS + + Mov SI, Offset InstrumentLibrary + JAE D_DrawLoadInstrument9 + + Mov SI, Offset InstrumentNoSample + Cmp AX, 1 + JB D_DrawLoadInstrument9 + + Mov SI, Offset InstrumentSingleSample + JE D_DrawLoadInstrument9 + + Mov SI, Offset InstrumentSeveralSamples + Cmp AX, 0FFFFh + JNE D_DrawLoadInstrument9 + + Mov SI, Offset InstrumentUnknownSamples + +D_DrawLoadInstrument9: + Mov AH, DH + Call S_DrawString + + Pop AX + Pop DI + Pop SI + Pop DS + + Mov AX, 2A8h + Add DI, 20 + StosW ; Divider.. now file size... + + LodsW ; AX = file size. + + Push DS + + Push CS + Pop DS + Mov SI, Offset FileSizeMsg + + Push AX + Mov AH, DH + Call S_DrawString + + Pop AX + + Pop DS + +D_DrawLoadInstrument5: + Pop DI + Pop CX + Pop AX + + Inc AX + + Add DI, 160 + Loop D_DrawLoadInstrument3 + + Push CS + Pop DS + Jmp D_DrawLoadInstrumentEnd2 + +D_DrawLoadInstrumentEnd: + Push CS + Pop DS + Assume DS:Disk + + Mov DI, (6+13*80)*2 ; (6, 13) + Mov SI, Offset NoFilesMsg + + Mov AH, 5 + Call S_DrawString + +D_DrawLoadInstrumentEnd2: ; Put Unused Sample msg. + Mov AX, UnusedSamples + Push AX + + Mov SI, Offset FreeSampleMsg + Mov DI, (64+13*80)*2 + Mov AH, 20h + + Call S_DrawString + + Pop AX + + Ret + +EndP D_DrawLoadInstrument + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_PreLoadInstrument Far + + Push CS + Pop DS + Assume DS:Disk + + Mov AX, CurrentInstrument + Sub AX, TopInstrument + Add AX, 13 + Mov BX, 160 + Mul BX + + Call S_GetDestination + + LEA DI, [EAX+12] + Mov CX, 56 + +D_PreLoadInstrument1: + Mov AX, [ES:DI] + + Mov AH, 32h + + Cmp AL, 0A8h + JE D_PreLoadInstrument3 + +D_PreLoadInstrument2: + Mov AH, 30h + +D_PreLoadInstrument3: + StosW + + Loop D_PreLoadInstrument1 + + Ret + + Ret + +EndP D_PreLoadInstrument + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_PostLoadInstrument Far + + Push CS + Pop DS + Assume DS:Disk + + Mov SI, Offset LoadInstrumentKeys + Call M_FunctionDivider + JC D_PostLoadInstrument1 + + Jmp [SI] + +D_PostLoadInstrument1: + Xor AX, AX + Ret + +EndP D_PostLoadInstrument + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_ViewInstrument Far + + Push CS + Pop DS + Assume DS:Disk + + Mov SI, Offset ViewInstrumentKeys + Call M_FunctionDivider + JC D_ViewInstrument1 + + Jmp [SI] + +D_ViewInstrument1: + Xor AX, AX + Ret + +EndP D_ViewInstrument + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LIWindow_Up Far + + Assume DS:Disk + + Mov AX, CurrentInstrument + And AX, AX + JZ LIWindow_Up1 + + Dec CurrentInstrument + +LIWindow_Up1: + Mov AX, 1 + Ret + +EndP LIWindow_Up + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LIWindow_Down Far + + Assume DS:Disk + + Mov AX, CurrentInstrument + + Inc AX + Cmp AX, NumInstruments + JAE LIWindow_Down1 + + Mov CurrentInstrument, AX + +LIWindow_Down1: + Mov AX, 1 + Ret + +EndP LIWindow_Down + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LIWindow_PgUp Far + + Assume DS:Disk + + Mov AX, CurrentInstrument + + Sub AX, 35 + JC LIWindow_Home + + Mov CurrentInstrument, AX + +LIWindow_PgUp1: + Mov AX, 1 + Ret + +EndP LIWindow_PgUp + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LIWindow_PgDn Far + + Assume DS:Disk + + Mov AX, CurrentInstrument + + Add AX, 35 + Cmp AX, NumInstruments + JAE LIWindow_End + + Mov CurrentInstrument, AX + +LIWindow_PgDn1: + Mov AX, 1 + Ret + +EndP LIWindow_PgDn + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LIWindow_Home Far + + Assume DS:Disk + Mov CurrentInstrument, 0 + + Mov AX, 1 + Ret + +EndP LIWindow_Home + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LIWindow_End Far + + Assume DS:Disk + + Mov AX, NumInstruments + + Dec AX + JS LIWindow_End1 + + Mov CurrentInstrument, AX + +LIWindow_End1: + Mov AX, 1 + Ret + +EndP LIWindow_End + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LIViewWindow_Tab Far + + Mov Word Ptr [ES:DI], 7 + + Mov AX, 1 + Ret + +EndP LIViewWindow_Tab + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +include it_d_ri.inc + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LIViewWindow_Enter Far + + Assume DS:Disk + + Cmp NumInstruments, 0 + JE LIViewWindow_Enter2 + + Mov AX, 48 + Mul CurrentInstrument + Mov SI, AX + Assume DS:Nothing + + Mov DS, DiskDataArea + Mov DL, [DS:SI] + Cmp DL, 1 + JE LIViewWindow_Enter1 + Cmp DL, 8 + JAE LIWindow_InInstrument1 + +LIViewWindow_Enter2: + Mov AX, 1 + Ret + +EndP LIViewWindow_Enter + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LIWindow_Enter Far + + Assume DS:Disk + + Cmp NumInstruments, 0 + JE LIWindow_Enter4 + + Mov AX, 48 + Mul CurrentInstrument + Mov SI, AX + Assume DS:Nothing + + Mov DS, DiskDataArea + Mov DL, [DS:SI] + Cmp DL, 1 + JNE LIWindow_Enter1 + +LIViewWindow_Enter1: + Push DS + Push SI + + Push CS + Pop DS + Mov SI, Offset InstrumentDirectory + Call D_SetDriveDirectory + + Pop SI + Pop DS + + Inc SI + Call D_SetDriveDirectory + + Push CS + Pop DS + Assume DS:Disk + + Mov SI, Offset InstrumentDirectory + Call D_GetDriveDirectory + +LIWindow_EnterInModuleError: + Mov InstrumentsInModule, 0 + Call D_InitLoadInstruments + Assume DS:Nothing + + Mov CS:CurrentInstrument, 0 + +LIWindow_Enter4: + Mov AX, 1 + Ret + +LIWindow_Enter1: ; Load sample into sample list. + Cmp DL, 8 + JAE LIWindow_InInstrument1 + Cmp DL, 3 + JAE LIWindow_Enter2 + + Xor AX, AX + Ret + +LIWindow_InInstrument1: + Mov CS:InInstrumentFormat, DL + + Inc SI + ; Copy module name across + Push CS + Pop ES + Mov DI, Offset InInstrumentFileName + Mov CX, 13 + Rep MovsB + ; Open file + Push CS + Pop DS + Assume DS:Disk + + Mov CurrentInstrument, 0 + +LIWindow_EnterLoadInInstrumentData: + Mov DX, Offset InInstrumentFileName + Mov AX, 3D00h + Int 21h + JC LIWindow_EnterInModuleError + + Mov BX, AX + + Mov SI, Word Ptr InInstrumentFormat + And SI, 0FFh + Add SI, SI + + Mov NumInstruments, 1 + + Mov DS, DiskDataArea + Assume DS:Nothing + + Push DS + Pop ES + + Call [CS:InstrumentLoaderTable+SI-6] + + ; Close module + Mov AH, 3Eh + Int 21h + + ; Setup first 'directory' + + Push CS + Pop DS + Assume DS:Disk + + Xor DI, DI + Mov SI, Offset ExitInstrumentLibraryDirectory + Mov CX, 48 + Rep MovsB + + Mov InstrumentCacheFileComplete, 1 + Mov InstrumentsInModule, 1 + + Mov AX, NumInstruments + Mov LoadInstrumentNameCount, AX + + Mov AX, 1 + Ret + Assume DS:Nothing + +LIWindow_Enter2: + Mov EAX, [SI+44] + Mov CS:LoadInstrumentOffset, EAX + Mov AX, [SI+40] + Mov CS:NumInstrumentSamples, AX + + And DX, 0FFh + Sub DX, 3 + Add DX, DX + Mov BX, DX + Mov AX, [CS:InstrumentLoaderTable+BX] + Mov [CS:InstrumentLoader], AX + + Mov AX, [SI+40] + Cmp AX, UnusedSamples + JBE LIWindow_Enter5 + + Mov CX, 0FFFFh + Mov DI, Offset O1_OutOfSamplesList + Call M_Object1List + Jmp LIWindow_Enter4 + +LIWindow_Enter5: ; OK.. enough 'sample space'.. + Call Music_Stop + + ; Clean out all old samples... + ; 1. Clean out table + ; 2. Set all samples used in inst to 1 + ; 3. Step through all insts and set + ; samples to 0 + ; 4. Delete all samples with 1. + Push CS ; Step 1. + Pop ES + Mov DI, Offset InstrumentTable + Mov CX, 50 + Xor AX, AX + Rep StosW ; Step 1. Done. + + Push DS + Push SI + + Call Music_GetSongSegment + Mov DS, AX + Assume DS:Nothing + + + Call PE_GetLastInstrument + Mov DX, BX ; DX = instrument, 0 based + Add BX, BX + Mov SI, [DS:64712+BX] + Add SI, 40h + Mov CX, 120 + +ClearSamples1: + LodsW ; AH = sample. AL = note + Mov BL, AH + Mov [CS:InstrumentTable+BX], 1 + Loop Clearsamples1 + + Xor BX, BX + +ClearSamples2: + Cmp BX, DX + JE ClearSamples3 + + Mov SI, BX + Add SI, SI + Mov SI, [DS:64712+SI] + Add SI, 41h + Mov CX, 120 + +ClearSamples4: + LodsW + And AX, 0FFh + Mov DI, AX + Mov [CS:InstrumentTable+DI], 0 + Loop ClearSamples4 + +ClearSamples3: + Inc BX + Cmp BL, 99 + JB ClearSamples2 + + Xor DI, DI + +ClearSamples5: + Cmp [CS:InstrumentTable+DI+1], 0 + JE ClearSamples6 + + Mov AX, DI + Call Music_ReleaseSample + +ClearSamples6: + Inc DI + Cmp DI, 99 + JB ClearSamples5 + + Pop DX + Pop DS + ; Process. + ; 1. Reset instrument-sample table. + ; 2. Read all sample headers into mem. + ; 3. Load each sample/sample header. + ; 4. Store instrument header. + + Push CS ; Step 1. + Pop ES + Mov DI, Offset InstrumentTable + Mov CX, 50 + Xor AX, AX + Rep StosW ; Step 1. Done. + + ; OK. to do step 2. + ; a) Open file. + ; b) if error.. skip! + ; c) Load file. + + Inc DX + Mov AX, 3D00h ; Open file.. +; Mov DX, SI +; Inc DX ; DS:DX points to file name + Int 21h + + JNC LIWindow_Enter6 + + Mov AX, 1 + Ret + +LIWindow_Enter6: + Mov BX, AX ; BX = file handle. + + ; Load instrument data into DS:64000 + ; Step 3. Go through each sample. + Call [CS:InstrumentLoader] + + Call Music_GetSongSegment + Mov ES, AX + + Mov CL, [DS:64000+1Eh] + And CX, 0FFh + JZ LIWindow_Enter10 + + Push CX + + Mov DI, [ES:64912] + Add DI, 12h-80 + Xor SI, SI + Xor AX, AX + +LIWindow_Enter8: ; Figure out instrument translation + ; table first. + Inc AX + Add DI, 80 + Test Byte Ptr [ES:DI], 1 ; Sample present? + JNZ LIWindow_Enter8 + + Inc SI + Mov [CS:InstrumentTable+SI], AL + + Loop LIWindow_Enter8 + + Pop CX + + Xor SI, SI ; SI = pointer to first sample. + Mov DI, 1 ; DI = untranslated sample number. + +LIWindow_Enter9: + Push CX ; Have to load EACH sample... + Push DS + Push SI + Push ES + Push DI + + Mov DL, [CS:InstrumentTable+DI] + Xor DH, DH ; DX = translated sample number. + Dec DX + + Mov DI, DX + Add DI, DI ; DI = 2*samplenumber + Mov DI, [ES:64912+DI] ; ES:DI points to sample in mem. + + Mov CX, 48h/2 + Rep MovsW + Xor AX, AX + StosW ; Sample pointer data. + StosW + Add SI, 4 + MovsW + MovsW ; OK.. sample header transferred.. + ; Need to load sample data?? + Mov Word Ptr [ES:DI-80+2Eh], 1 + +IF NETWORKENABLED + Mov AL, NETWORK_SAMPLEHEADEROBJECT + Mov AH, DL + Call Network_AddWordToQueue +ENDIF + Test Byte Ptr [SI-80+12h], 1 + JZ LIWindow_Enter11 ; No! + + Push DX + Push DX + + Mov AX, 4200h + Mov CX, [SI-80+4Ah] + Mov DX, [SI-80+48h] + Int 21h ; Move pointer... + + Pop AX + Sub SI, 80 + Call PE_SaveCurrentPattern + Call D_LoadSampleData + Call PE_RestoreCurrentPattern + + Pop CX + +IF NETWORKENABLED + Xor DX, DX + Call Network_QueueSampleData +; Mov AL, NETWORK_SAMPLEHEADEROBJECT +; Mov AH, DL +; Call Network_AddWordToQueue +ENDIF + + + Jmp LIWindow_Enter11 + +LIWindow_Enter12: + Call PEFunction_OutOfMemoryMessage + +LIWindow_Enter11: + Pop DI + Pop ES + Pop SI + Pop DS + Pop CX + + Inc DI + Add SI, 80 + + Loop LIWindow_Enter9 + +LIWindow_Enter10: ; Now to copy instrument... + Mov AH, 3Eh + Int 21h ; Close file first. + + Call I_GetInstrumentOffset + ; DS:BX points to instrument + ; DS:64000 points to loaded instrument + ; so copy everything, but update the + ; sample numbers.. + Mov DI, BX + Push DS + Pop ES + + Mov DS, CS:DiskDataArea + + + Mov SI, 64000 + Mov CX, 40h/2 + Rep MovsW + + Mov CX, 120 + Xor BX, BX + +LIWindow_Enter7: + MovsB ; Note transferred. + LodsB + Mov BL, AL + Mov AL, [CS:InstrumentTable+BX] + StosB + Loop LIWindow_Enter7 + + Mov CX, 250/2 + Rep MovsW + + Call Music_SoundCardLoadAllSamples + + Call Music_GetInstrumentMode + JNZ LIWindow_Enter13 + + Mov CX, 3 + Mov DI, Offset O1_EnableInstrumentMode + Call M_Object1List + Test DX, DX + + JZ LIWindow_Enter13 + + Call Music_GetSongSegment + Mov DS, AX + Or Byte Ptr [DS:2Ch], 4 + +IF NETWORKENABLED + Mov CX, 1 + Mov DX, 2Ch + Call Network_SendSongDataInformation +ENDIF + +LIWindow_Enter13: + NetworkSendInstrument + Jmp Glbl_F4 + +EndP LIWindow_Enter + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_DeleteInstrumentFile Far + + Push CS + Pop DS + Assume DS:Disk + + Cmp NumInstruments, 0 + JE D_DeleteInstrumentFile1 + Cmp InstrumentsInModule, 0 + JNE D_DeleteInstrumentFile1 + + Mov AX, 48 + Mul CurrentInstrument + Mov SI, AX + Mov DS, DiskDataArea + Assume DS:Nothing + Cmp Byte Ptr [DS:SI], 1 + JBE D_DeleteInstrumentFile1 ; Don't delete dirs! + Cmp Byte Ptr [DS:SI], 8 + JAE D_DeleteInstrumentFile1 + + Push DS + Push SI + + Mov DI, Offset O1_ConfirmDelete3 + Mov CX, 4 + Call M_Object1List + + Pop SI + Pop DS + + And DX, DX ; OK to delete? + JZ D_DeleteInstrumentFile1 + + ; Delete file.... + Mov DX, SI + Inc DX + Mov AH, 41h + Int 21h + JC D_DeleteInstrumentFile1 + + Push CS + Pop DS + Assume DS:Disk + + Mov DI, SI + Add SI, 48 + + Mov CX, NumInstruments + Mov BX, CurrentInstrument + Sub CX, BX + + Mov AX, 48 + Mul CX + Mov CX, AX + + Push DS + + Mov DS, DiskDataArea + Push DS + Pop ES + + Rep MovsB + + Pop DS + + Dec NumInstruments + JZ D_DeleteInstrumentFile2 + + Cmp BX, NumInstruments + JB D_DeleteInstrumentFile2 + + Mov BX, NumInstruments + Dec BX + Mov CurrentInstrument, BX + Dec LoadInstrumentNameCount + +D_DeleteInstrumentFile2: + Cmp InstrumentCacheFileComplete, 1 + JNE D_DeleteInstrumentFile1 + + Call D_SaveInstrumentCacheFile + +D_DeleteInstrumentFile1: + Mov AX, 1 + Ret + +EndP D_DeleteInstrumentFile + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_GetPreShellDirectory Far + + Push CS + Pop DS + Mov SI, Offset PreShellDirectory + + Call D_GetDriveDirectory + + Mov SI, Offset DOSDirectory + Call D_SetDriveDirectory + + + Ret + +EndP D_GetPreShellDirectory + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_RestorePreShellDirectory Far + + Push CS + Pop DS + Mov SI, Offset PreShellDirectory + + Call D_SetDriveDirectory + + Ret + +EndP D_RestorePreShellDirectory + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_SetDriveDirectoryFar Far + + Call D_SetDriveDirectory + Ret + +EndP D_SetDriveDirectoryFar + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_GetFileName Far + + Push CS + Pop DS + Mov SI, Offset FileName + + Ret + +EndP D_GetFileName + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_ResetTimer Far + + Push DS + + Push CS + Pop DS + Assume DS:Disk + + Call GetTimerCounter + Mov [EditTimer], EAX + Call ReleaseTimerData + + Call CheckTimerData + + Pop DS + Ret + +EndP D_ResetTimer + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Hours DB "0000:" +Minutes DB "00:" +Seconds DB "00", 0 + +RemainingDateMsg DB " ", 0FDh, "D, ", 0FDh, "D", 0 + +Time2Msg DB 0FDh, "D:00", 0 +TotalTime DD 0 + +Proc D_ShowTime Far + + Push CS + Pop DS + Assume DS:Disk + + Mov EDX, 3600 + Mul EDX + ShRD EAX, EDX, 16 + ShR EDX, 16 + JNZ D_ShowTimeEnd + ; EAX = number of seconds + Mov EBX, 60 + Div EBX ; EAX = minutes, EDX = seconds + + Push EDX + Xor EDX, EDX + Div EBX ; EAX = hours, EDX = minutes + + Pop ECX + Push AX ; Hours on stack, CX = seconds, DX = min + Mov BL, 10 + + Mov AX, DX + Div BL + Add AX, 3030h + Mov [Word Ptr Minutes], AX + + Mov AX, CX + Div BL + Add AX, 3030h + Mov [Word Ptr Seconds], AX + + Pop AX ; AX = hours. + Cmp AH, BL + JAE D_ShowTimeEnd + + Div BL + Add AH, '0' + Mov [Byte Ptr Hours+3], AH + Xor AH, AH + + Div BL + Add AH, '0' + Mov [Byte Ptr Hours+2], AH + Xor AH, AH + + Div BL + Add AH, '0' + Mov [Byte Ptr Hours+1], AH + Xor AH, AH + + Div BL + Add AH, '0' + Mov [Byte Ptr Hours+0], AH + Xor AH, AH + + Xor BX, BX + Mov SI, Offset Hours + +D_ShowTime1: + Cmp Byte Ptr [SI+BX], '0' + JNE D_ShowTime2 + Mov Byte Ptr [SI+BX], ' ' + Inc BX + Cmp BX, 3 + JB D_ShowTime1 + +D_ShowTime2: + Mov AH, 20h + Call S_DrawString + +D_ShowTimeEnd: + Ret + +EndP D_ShowTime + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +IF TIMERSCREEN + +TimerListKeys Label + + DB 0 + DW 1C8h ; Up arrow + DW D_TimerListUp + + DB 0 + DW 1D0h ; Down arrow + DW D_TimerListDown + + DB 0 + DW 1C9h ; PgUp + DW D_TimerListPgUp + + DB 0 + DW 1D1h ; PgDn + DW D_TimerListPgDn + + DB 0 + DW 0D29h ; Left Ctrl, Right Shift + '`' + DW D_ReleaseTimer + + DB 0 + DW 4529h + DW D_ToggleShowTimes + + DB 0FFh + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_PostTimerList Far + + Push CS + Pop DS + Assume DS:Disk + + Mov SI, Offset TimerListKeys + Call M_FunctionDivider + JC D_PostTimerList1 + + Jmp [SI] + +D_PostTimerList1: + Xor AX, AX + + Ret + +EndP D_PostTimerList + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_TimerListUp Far + Assume DS:Disk + + Sub TopTimerData, 1 + AdC TopTimerData, 0 + + Mov AX, 1 + Ret + +EndP D_TimerListUp + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_TimerListDown Far + Assume DS:Disk + + Mov AX, TopTimerData + Cmp AX, NumTimerData + JAE D_TimerListDown1 + + Inc AX + Mov TopTimerData, AX + +D_TimerListDown1: + Mov AX, 1 + Ret + +EndP D_TimerListDown + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_TimerListPgUp Far + Assume DS:Disk + + Sub TopTimerData, 28 + JNC D_TimerListPgUp1 + + Mov TopTimerData, 0 + +D_TimerListPgUp1: + Mov AX, 1 + Ret + +EndP D_TimerListPgUp + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_TimerListPgDn Far + Assume DS:Disk + + Mov AX, TopTimerData + Add AX, 28 + Cmp AX, NumTimerData + JB D_TimerListPgDn1 + + Mov AX, NumTimerData + Sub AX, 1 + AdC AX, 0 + +D_TimerListPgDn1: + Mov TopTimerData, AX + + Mov AX, 1 + Ret + +EndP D_TimerListPgDn + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +ShowTimes DB 0 + +Proc D_DrawTimer Far + + Call Music_GetSongSegment + Mov ES, AX + + Mov EAX, [ES:3Ch] + Mov DI, (18+13*80)*2 + Call D_ShowTime + + Call GetTimerCounter + Sub EAX, [CS:EditTimer] + Mov DI, (18+14*80)*2 + Push EAX + Call D_ShowTime + + Pop EAX + Mov DI, (18+16*80)*2 + Add EAX, [ES:3Ch] + Call D_ShowTime + + Test ShowTimes, 1 + JZ D_DrawTimerEnd + + Assume DS:Disk + + Mov CX, 28 + Mov SI, TopTimerData + Mov AX, TimerData + Test AX, AX + JZ D_DrawTimerEnd + Mov ES, AX + Mov AX, SI + ShL SI, 3 + Mov DI, (4+20*80)*2 + + Mov BX, 4 + Mov TotalTime, 0 + +D_DrawTimer2: + Cmp BX, SI + JA D_DrawTimer1 + + Mov EDX, [ES:BX] + Add TotalTime, EDX + Add BX, 8 + Jmp D_DrawTimer2 + +D_DrawTimer1: + Cmp AX, NumTimerData + JAE D_DrawTimerEnd + PushA + ; Data formats: yyyyyyym mmmddddd + ; hhhhhmmm mmmsssss + SegES LodsD + + Push SI + Push DI + ; AX = yyyyyyym mmmddddd + Mov BX, AX + ShR AX, 9 + Add AX, 1980 + Push AX ; Year + Mov AX, BX + And AX, 1Fh + Push AX + + ShR BX, 5 + And BX, 0Fh + Add BX, BX + + Mov SI, [MonthNames+BX] + Mov AH, 20h + Call S_DrawString + + Mov SI, Offset RemainingDateMsg + Call S_DrawString + + Pop AX ; Clean up stack + Pop AX + + Pop DI + Add DI, 50 + Push DI + + ; time + ShR EAX, 21 ; AX = hhh hhmmmmmm + Mov BX, AX + ShR BX, 6 + Push BX + Mov BL, 10 + And AX, 3Fh + Div BL + Add AX, '00' + Mov Word Ptr [Time2Msg+3], AX ; Minutes done. + + Mov SI, Offset Time2Msg + Mov AH, 20h + Call S_DrawString + Pop AX + + Pop DI + Pop SI + + Add DI, 30 + SegES LodSD + Add TotalTime, EAX + Call D_ShowTime + + Add DI, 20 + + Mov EAX, TotalTime + Call D_ShowTime + + PopA + Add SI, 8 + Add DI, 160 + Inc AX + Loop D_DrawTimer1 + +D_DrawTimerEnd: + Xor AX, AX + Ret + +EndP D_DrawTimer + +ENDIF + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_ReleaseTimer Far + + Call ReleaseTimerData + Inc AX + Ret + +EndP D_ReleaseTimer + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +IF TIMERSCREEN + +Proc D_ToggleShowTimes Far + Assume DS:Disk + + Xor ShowTimes, 1 + + Mov AX, 1 + Ret + +EndP D_ToggleShowTimes + Assume DS:Nothing + +ENDIF + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_SlowSampleSort Far + + Push CS + Pop DS + Assume DS:Disk + +IF SORTENABLED + Cmp SamplesInModule, 1 + JE D_SlowSampleSortExit + Cmp SampleCacheFileComplete, 1 + JNE D_SlowSampleSortExit + Mov CX, NumSamples + + Mov SampleInMemory, 0FFFFh + Mov SampleCheck, 0FFFFh + + Mov ES, DiskDataArea + Push ES + Pop DS + Assume DS:Nothing + + Xor SI, SI + + Cmp Word Ptr [SI+4], '\' + JNE SlowSampleSortNoSort1 + + Add SI, 60h + Dec CX + +SlowSampleSortNoSort1: + Cmp Word Ptr [SI+4], '..' + JNE SlowSampleSortNoSort2 + + Add SI, 60h + Dec CX + +SlowSampleSortNoSort2: + Cmp CX, 0 + JLE D_SlowSampleSortExit + +SlowSampleSortLoop1: + Push CX + Push SI + + Mov AL, [SI+5Ah] + Mov DX, SI ; DX = destination of SI + Mov DI, SI + Mov BX, CX + +SlowSampleSortLoop2: + +; SI = current lowest. + +; Sort priority: 0 = directory +; 1 = library +; 2 = recognised +; 3 = unknown + + Cmp AL, [DI+5Ah] + JB D_CompareSamples2 + JA D_CompareSamples1 + + Push SI + Push DI + + Mov CX, 13 + Add SI, 4 + Add DI, 4 + RepE CmpSB + Pop DI + Pop SI + + JBE D_CompareSamples2 + +D_CompareSamples1: + Mov AL, [DI+5Ah] + Mov SI, DI + +D_CompareSamples2: + Add DI, 60h + + Dec BX + JNZ SlowSampleSortLoop2 + + Cmp SI, DX + JE D_CompareSamplesNoSwap + + + Push DI + Mov CX, 24 + Rep MovsD + + LEA DI, [SI-60h] + Mov SI, DX + Mov CX, 24 + Rep MovsD + + Pop SI + Mov DI, DX + Mov CX, 24 + Rep MovsD + +D_CompareSamplesNoSwap: + Pop SI + Pop CX + + Add SI, 60h + + Dec CX + JNZ SlowSampleSortLoop1 + + Call D_SaveSampleCacheFile ; Resave it with new date + +D_SlowSampleSortExit: + +ENDIF + + Mov AX, 1 + Ret + +EndP D_SlowSampleSort + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_SlowInstrumentSort Far + + Push CS + Pop DS + Assume DS:Disk + +IF SORTENABLED + Cmp InstrumentsInModule, 1 + JE D_SlowInstrumentSortExit + Cmp InstrumentCacheFileComplete, 1 + JNE D_SlowInstrumentSortExit + Mov CX, NumInstruments + + Mov ES, DiskDataArea + Push ES + Pop DS + Assume DS:Nothing + + Xor SI, SI + + Cmp Word Ptr [SI+1], '\' + JNE SlowInstrumentSortNoSort1 + + Add SI, 30h + Dec CX + +SlowInstrumentSortNoSort1: + Cmp Word Ptr [SI+1], '..' + JNE SlowInstrumentSortNoSort2 + + Add SI, 30h + Dec CX + +SlowInstrumentSortNoSort2: + Cmp CX, 0 + JLE D_SlowInstrumentSortExit + +SlowInstrumentSortLoop1: + Push CX + Push SI + + Mov AL, [SI] + Mov DX, SI ; DX = destination of SI + Mov DI, SI + Mov BX, CX + +SlowInstrumentSortLoop2: + Mov AH, [DI] + +; SI = current lowest. + + Cmp AL, 1 + JNE SlowInstrumentSort3 + Cmp AH, 1 + JE SlowInstrumentFilename + Jmp D_CompareInstruments2 + +SlowInstrumentsort3: + Cmp AH, 1 + JE D_CompareInstruments1 + + Test AL, 8 + JZ SlowInstrumentSort4 + Test AH, 8 + JNZ SlowInstrumentFileName + Jmp D_CompareInstruments2 + +SlowInstrumentsort4: + Test AH, 8 + JNZ D_CompareInstruments1 + +SlowInstrumentFilename: + Push SI + Push DI + + Mov CX, 13 + Inc SI + Inc DI + RepE CmpSB + Pop DI + Pop SI + + JBE D_CompareInstruments2 + +D_CompareInstruments1: + Mov AL, AH + Mov SI, DI + +D_CompareInstruments2: + Add DI, 30h + + Dec BX + JNZ SlowInstrumentSortLoop2 + + Cmp SI, DX + JE D_CompareInstrumentsNoSwap + + Push DI + Mov CX, 12 + Rep MovsD + + LEA DI, [SI-30h] + Mov SI, DX + Mov CX, 12 + Rep MovsD + + Pop SI + Mov DI, DX + Mov CX, 12 + Rep MovsD + +D_CompareInstrumentsNoSwap: + Pop SI + Pop CX + + Add SI, 30h + + Dec CX + JNZ SlowInstrumentSortLoop1 + + Call D_SaveInstrumentCacheFile ; Resave it with new date + +D_SlowInstrumentSortExit: + +ENDIF + + Mov AX, 1 + Ret + +EndP D_SlowInstrumentSort + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +Segment DiskData PARA Public 'Data' + DB 65536 Dup (0) +EndS + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +EndS + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +End diff --git a/IT_DISPL.ASM b/IT_DISPL.ASM new file mode 100644 index 0000000..4c32729 --- /dev/null +++ b/IT_DISPL.ASM @@ -0,0 +1,4485 @@ +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Display Module!! ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Jumps + .386 + +include switch.inc + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Externals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Segment Pattern WORD Public 'Code' USE16 + Extrn Order:Word +EndS + +Segment Object1 BYTE Public 'Data' USE16 +EndS + +Segment Glbl BYTE Public 'Code' USE16 + Extrn CurrentMode:Byte +EndS + +IF SPECTRUMANALYSER + Extrn Fourier_Start:Far +ENDIF + Extrn S_GetDestination:Far + Extrn S_DrawBox:Far + Extrn S_DrawString:Far + Extrn Music_GetOutputWaveform:Far + Extrn Music_GetInstrumentMode:Far + Extrn Music_GetSongSegment:Far + Extrn Music_GetSampleLocation:Far + Extrn Music_GetHostChannelInformationTable:Far + Extrn Music_GetSlaveChannelInformationTable:Far + Extrn Music_NextOrder:Far + Extrn Music_LastOrder:Far + Extrn Music_GetPlayMode:Far + Extrn Music_GetPlayMode2:Far + Extrn Music_GetPattern:Far + Extrn Music_ToggleChannel:Far + Extrn Music_SoloChannel:Far + Extrn Music_GetDisplayVariables:Far + Extrn Music_InitStereo:Far +; Extrn Music_UpdateSampleLocation:Far + Extrn Music_Poll:Far + Extrn Music_ToggleReverse:Far + Extrn Music_GetLastChannel:far + Extrn Music_GetPatternLength:Far + + Extrn M_FunctionDivider:Far + +IF NETWORKENABLED + Extrn Network_Poll:Far +ENDIF + + Extrn O1_DisplayList, O1_FullDisplayList + + Extrn PE_GetCurrentPattern:Far + Extrn PE_ConvAX2Num:Far + + Extrn PE_GotoPattern:Far + + Extrn SetInfoLine:Far + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Globals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Global DisplayPlus:Far + Global DisplayMinus:Far + Global DrawDisplayData:Far + Global PostDisplayData:Far + Global DisplayUpdateScreen:Far + Global Display_GetDisplayWindowData:Far + Global Display_SelectDisplayList:Far + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +Segment InfoPage BYTE Public 'Code' USE16 + Assume CS:InfoPage, DS:InfoPage + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Variables ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +SLAVECHANNELSIZE EQU 128 +HOSTCHANNELSIZE EQU 80 + +PLAYMETHODS EQU 11 +DOTSDISPLAY EQU 9 + +CurrentChannel DW 0 +;CurrentSample DW 0 +;CurrentInstrument DW 0 +DisplayMode DW 0 + +DrawTrackData DW 0 ; Function to call to draw track + +DataArray DB 320 Dup (0) +DataDecode DB 384 Dup (0) +DecodeOffset DW ? ; Offset is -1 if no pat +DecodeSegment DW ? + +DecodePattern DW ? +DecodeRow DW ? +DecodeMaxRow DW ? + +PatternArrayNumber DW ? +PatternMaxRow DW ? +PatternSegment DW ? + +Channel5Msg DB " Channel xx ", 0 +Channel8Msg DB " xx ", 0 +Channel18Msg DB "xx", 0 +NoteTable DB "C-C#D-D#E-F-F#G-G#A-A#B-" +Note2Table DB "cCdDefFgGaAb" +LeftMsg DB "Left " +RightMsg DB " Right" +SurroundMsg DB "Surround " +NNAMsg DB "Cut", 0 + DB "Con", 0 + DB "Off", 0 + DB "Fde", 0 +VirtualMsg DB "NNA", 0FEh, 21h, 148, 0FEh, 12h, "Tot", 0 +DetailsMsg DB "Frequency", 0FEh, 21h, 148, 148, 0FEh, 12h + DB "Position", 0FEh, 21h, 148, 148, 0FEh, 12h + DB "Smp", 0FEh, 21h, 152, 153, 0FEh, 12h + DB "FVl", 0FEh, 21h, 148, 0FEh, 12h + DB "Vl", 0FEh, 21h, 148, 0FEh, 12h + DB "CV", 0FEh, 21h, 148, 0FEh, 12h + DB "SV", 0FEh, 21h, 148, 0FEh, 12h + DB "VE", 0FEh, 21h, 148, 0FEh, 12h + DB "Fde", 0FEh, 21h, 148, 0FEh, 12h + DB "Pn", 0FEh, 21h, 148, 0FEh, 12h + DB "PE", 0 + + +RestoreData DB 0 + +DisplayWindows Label ; Structure is 1 word + DW 0 ; 1 word, method + DB 0 ; 1 byte, top channel (+2) +; DB 1 +; DW 31 +; DW 160 + + DB 12 ; 1 byte, top line (+3) + DW 20 ; 1 word length of window (+4) + DW 12*80*2 ; 1 word offset to top left (+6) + + DW 8 + DB 0 + DB 32 + DW 3 + DW 32*80*2 + + DW 5 + DB 0 + DB 35 + DW 15 + DW 35*80*2 + + DW 11 Dup (0) + DB 0 +FullScreen DB 0 + +NumWindows DW 3 ; This cannot be moved!!! +CurrentWindow DW 0 +ProcessWindow DW 0 + +PlayMode DW 0 +CurrentRow DW 0 +CurrentPattern DW 0 +CurrentOrder DW 0 + +LastRow DW 0 +LastPattern DW 0 +LastOrder DW 0 + +WaveformLength DW 0 +Velocity DB 0 +Instrument DB 0 + +Comment ~ +Correlation Label Byte + DB 255, 254, 252, 249, 245, 240, 234, 227 + DB 219, 210, 210, 199, 187, 174, 160, 145 + + DB 129, 112, 94, 75, 55, 34, 12, 0 + DB 0, 0, 0, 0, 0, 0, 0, 0 +~ + +Destination DW 0 + +VariablesMsg DB "Active Channels: ", 0FDh, "D (", 0FDh, "D)", 13 + DB " Global Volume: ", 0FDh, "D", 0 + +StereoEnabledMsg DB "Stereo Enabled", 0 +StereoDisabledMsg DB "Stereo Disabled", 0 +VelocityMsg DB "Using velocity bars", 0 +VolumeMsg DB "Using volume bars", 0 +InstrumentMsg DB "Using Instrument names", 0 +SampleMsg DB "Using Sample names", 0 + +DisplayDataModes Label + DW Offset Display_HostChannel + DW Offset Display_5Channel + DW Offset Display_8Channel + DW Offset Display_10Channel + DW Offset Display_18Channel + DW Offset Display_24Channel + DW Offset Display_36Channel + DW Offset Display_64Channel + DW Offset Display_Variables + DW Offset Display_NoteDots +; DW Offset Display_SampleDots + DW Offset Display_Details + +DisplayListKeys Label + DB 0 ; Up arrow + DW 1C8h + DW Offset DisplayUp + + DB 0 + DW 1CBh ; Left arrow + DW Offset DisplayUp + + DB 0 + DW 1D0h ; Down arrow + DW Offset DisplayDown + + DB 0 + DW 1CDh ; Right arrow + DW Offset DisplayDown + + DB 2 + DW 1C8h + DW Offset DisplayAltUp + + DB 2 + DW 1D0h + DW Offset DisplayAltDown + + DB 0 + DW 1C7h + DW Offset DisplayHome + + DB 0 + DW 1CFh + DW Offset DisplayEnd + +; DB 0 +; DW 14Ah ; Grey minus + DB 1 + DW '-' + DW Offset DisplayMinus + +; DB 0 +; DW 14Eh ; Grey Plus + DB 1 + DW '+' + DW Offset DisplayPlus + + DB 0 + DW 1D2h ; Insert + DW Offset DisplayInsert + + DB 0 + DW 1D3h ; Delete + DW Offset DisplayDelete + + DB 0 ; PgUp + DW 1C9h + DW Offset DisplayPageUp + + DB 0 ; PgDn + DW 1D1h + DW Offset DisplayPageDown + + DB 0 ; Tab + DW 10Fh + DW Offset DisplayNext + + DB 1 ; Shifttab + DW 0F00h + DW Offset DisplayPrevious + + DB 2 ; Alt + DW 143h ; F9 + DW Offset DisplayToggleChannel + + DB 5 + DW 'Q' + DW Offset DisplayToggleChannel + + DB 2 ; Alt + DW 144h ; F10 + DW Offset DisplaySoloChannel + + DB 1 ; Alt 'R' + DW 1300h + DW Offset DisplayToggleReverse + + DB 1 ; Alt... + DW 1F00h ; 'S' + DW Offset DisplayToggleStereo + + DB 5 + DW 'S' + DW Offset DisplaySoloChannel + + DB 5 + DW 'G' + DW Offset Display_GotoPattern + + DB 5 + DW 'V' + DW Offset DisplayToggleVelocity + + DB 5 + DW 'I' + DW Offset DisplayToggleInstrument + + DB 1 + DW ' ' + DW Offset Display_SpaceBar + + DB 1 + DW 6 ; Ctrl F + DW Offset Display_FullScreen + +IF SPECTRUMANALYSER + DB 2 ; Alt.. + DW 158h ; F12 + DW Offset Display_FourierStart +ENDIF + + DB 0FFh ; End of list + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Functions ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Proc GetChannelColour ; Gets AH + + Push DS + Push BX + Call Music_GetSongSegment + Mov DS, AX + And BX, 0FFh + Test Byte Ptr [DS:BX+40h], 80h + Pop BX + Pop DS + JNZ GetChannelColour1 + + ; Non-muted colours. + Mov AH, 13h + Cmp BL, DL + JE GetChannelColourEnd + + Mov AH, 12h + + Mov BH, Byte Ptr ProcessWindow + Cmp BH, Byte Ptr CurrentWindow + JE GetChannelColourEnd + + Mov AH, 10h + Ret + +GetChannelColour1: ; Muted colours + Mov AH, 16h + + Cmp BL, DL + JE GetChannelColourEnd + + Mov AH, 11h + +GetChannelColourEnd: + Ret + +EndP GetChannelColour + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DrawChannelNumbers + + Mov CH, 0Ah + Mov CL, [CS:BP+4] + Sub CL, 2 + Mov DI, [CS:BP+6] + Add DI, (2+1*80)*2 + + Call Music_GetSongSegment + Mov DS, AX + Assume DS:Nothing + +Display_HostChannel3: + Push CX + Push DI + + Mov AX, BX + Inc AX + Div CH + + Add AX, 3030h + + Mov DH, AH + + Mov AH, 23h + Cmp DL, BL + JE Display_HostChannel4 + + Test Byte Ptr [BX+40h], 80h + JNZ Display_HostChannel21 + + Mov AH, 21h + Mov CX, ProcessWindow + Cmp CX, CurrentWindow + JE Display_HostChannel4 + + Mov AH, 20h + Jmp Display_HostChannel32 + +Display_HostChannel4: + Test Byte Ptr [BX+40h], 80h + JZ Display_HostChannel32 + + Mov AH, 26h + +Display_HostChannel32: + StosW + Mov AL, DH + StosW + +Display_HostChannel21: + Inc BX + + Pop DI + Pop CX + Add DI, 160 + + Dec CL + JNZ Display_HostChannel3 + + Ret + +EndP DrawChannelNumbers + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DrawHexAL + + Cmp AL, 10 + SBB AL, 69h + DAS + + StosW + Ret + +EndP DrawHexAL + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Display_HostChannel + ; Draw boxes first. + Assume DS:InfoPage + + Mov ES, Destination + + Mov AX, 4 ; left + Push AX + Mov AL, [CS:BP+3] + Push AX + Push 29 + Add AX, [CS:BP+4] + Dec AX + Push AX + Push 27 + Call S_DrawBox + + Mov SI, SP + Mov Byte Ptr [SS:SI+4], 62 + Mov Byte Ptr [SS:SI+8], 30 + Call S_DrawBox + + Push DS + Call Music_GetSongSegment + Mov DS, AX + Test Byte Ptr [DS:2Ch], 1 + Pop DS + JZ Display_HostChannel27 + + Mov Byte Ptr [SS:SI+4], 73 + Mov Byte Ptr [SS:SI+8], 63 + Call S_DrawBox + +Display_HostChannel27: + Add SP, 10 + + Mov DX, CurrentChannel + MovZX BX, Byte Ptr [CS:BP+2] + Cmp DX, BX + JAE Display_HostChannel1 + + Mov BX, DX + +Display_HostChannel1: + LEA CX, [EDX+3] + Sub CX, [CS:BP+4] + Cmp BX, CX + JGE Display_HostChannel2 + + Mov BX, CX + +Display_HostChannel2: + Mov CX, 66 + Sub CX, [CS:BP+4] + Cmp BX, CX + JLE Display_HostChannel22 + + Mov BX, 65 + Sub BX, [CS:BP+4] + +Display_HostChannel22: + Mov [CS:BP+2], BL ; BL = top channel + + Call DrawChannelNumbers + + Mov AL, 80 ; HostChannelSize + Mul Byte Ptr [CS:BP+2] + Call Music_GetHostChannelInformationTable + Assume DS:Nothing + Add SI, AX + Mov DI, [CS:BP+6] + Add DI, (31+1*80)*2 + Mov CX, [CS:BP+4] + Sub CX, 2 + +Display_HostChannel5: ; Show vol and sample. + Push CX + Push DI + + Test Byte Ptr [SI], 4 + JZ Display_HostChannel6 + + Mov BX, [SI+24h] ; DS:BX = slave channel + + ; OK get sample number +; Mov AL, [SI+20h] + + Push DI + + Push SI + Push DS + + Push DI + + MovZX AX, Byte Ptr [BX+36h] + Inc AX + Mov DH, 10 + Div DH + Add AX, 3030h ; '0'+'0' + Cmp AL, '9' + JBE SampleNumRange1 + + Mov AX, '--' + +SampleNumRange1: + Mov DL, AH + Mov AH, 6 + StosW + Mov AL, DL + StosW + + Call Music_GetInstrumentMode + JZ Display_HostChannel23 + + MovZX AX, Byte Ptr [BX+33h] ; Instrument number + Cmp AL, 0FFh + JE Display_HostChannel23 + + Div DH + Add AX, 3030h + Mov DX, AX + + Mov AX, 6*256+'/' + StosW + + Mov AL, DL + StosW + Mov AL, DH + StosW + +Display_HostChannel23: + Mov AX, 7*256+':' + Test Byte Ptr [BX], 4 ; Note off??? + JNZ Display_HostChannel31 + + Mov AH, 6 + +Display_HostChannel31: + Cmp Byte Ptr [BX+20h], 0 + JNE Display_HostChannel7 + + Mov AH, 4 + +Display_HostChannel7: + StosW + MovZX AX, Byte Ptr [BX+36h] + Add AX, AX + Mov SI, AX + Mov DX, [BX+30h] + + Call Music_GetSongSegment + Mov DS, AX + + Mov SI, [DS:SI+64912] + Add SI, 14h + + Mov AH, 6 + Mov CX, 25 + + Test Byte Ptr [DS:2Ch], 4 ; Instrument mode? + JZ Display_HostChannel8 + Cmp CS:Instrument, 0 + JE Display_HostChannel8 + + LEA SI, [EDX+20h] + +Display_HostChannel8: + LodsB + Cmp AL, 226 + JB AvoidMouse1 + + Mov AL, ' ' + +AvoidMouse1: + StosW + Loop Display_HostChannel8 + + ; Show string... + ; Now show panning if applic + Pop DI + + Test Byte Ptr [DS:2Ch], 1 ; Stereo + JZ Display_HostChannel24 + + Pop DS + Pop SI + + Push SI + Push DS + + Add DI, 33*2 + ; Show panning. + MovZX AX, Byte Ptr [BX+25h] +; Mov AL, [DS:SI+2Eh] + Cmp AL, 100 + JE Display_HostChannel25 +; Test AL, 80h ; Should never occur +; JNZ Display_HostChannel24 + + And AL, AL + JZ Display_HostChannel29 + Cmp AL, 64 + JE Display_HostChannel30 + + ; Show thumb bar sorta thing. + Inc AX + Mov DX, AX + ShR DX, 3 + Add DX, DX + Add DI, DX + And AX, 7 + Add AX, 155 + Mov AH, 2 + StosW + + Cmp AL, 157 + JBE Display_HostChannel24 + Add AL, 5 + StosW + + Jmp Display_HostChannel24 + +Display_HostChannel29: + Mov SI, Offset LeftMsg + Jmp Display_HostChannel28 + +Display_HostChannel30: + Mov SI, Offset RightMsg + Jmp Display_HostChannel28 + +Display_HostChannel25: + Mov SI, Offset SurroundMsg + +Display_HostChannel28: + Push CS + Pop DS + Mov CX, 9 + Mov AH, 2 + +Display_HostChannel26: + LodsB + StosW + Loop Display_HostChannel26 + +Display_HostChannel24: + Pop DS + Push DS + + Mov AL, 255 + Cmp CS:Velocity, 0 + JNZ Display_HostChannel10 + Cmp Byte Ptr [BX+36h], 100 + JE Display_HostChannel10 + +; Test Byte Ptr [BX+1], 8 +; JNZ Display_HostChannel18 ; Don't display volume + + Mov EDX, [BX+2Ch] ; Initial offset. + Mov ECX, [BX+4Ch] ; Final offset + + And EDX, EDX + JNS Display_HostChannelPP1 + + Xor EDX, EDX + +Display_HostChannelPP1: + And ECX, ECX + JNS Display_HostChannelPP2 + + Xor ECX, ECX + +Display_HostChannelPP2: + Cmp Byte Ptr [BX+0Ah], 8 + JB Display_HostChannel9 ; No loop + +Comment ~ + Mov AL, [BX+0Bh] + And AL, 7Fh + Cmp AL, 2 + JB NoSampleLoop + + Mov ECX, [BX+40h] + Mov EDX, [BX+44h] + Jmp Display_HostChannel20 + +NoSampleLoop: + Cmp Byte Ptr [BX+0Ah], 8 +~ + JE Display_HostChannel19 ; Normal loop + + ; Ping pong! + Cmp ECX, EDX + JA Display_HostChannel9 + XChg ECX, EDX + Jmp Display_HostChannel9 + +Display_HostChannel19: ; Forwards loop! + Cmp ECX, EDX + JAE Display_HostChannel9 + Mov ECX, [BX+44h] + +Display_HostChannel9: + Sub ECX, EDX + JBE Display_HostChannel18 + +Display_HostChannel20: + Test Byte Ptr [BX+18h], 2 + PushF + JZ Display_HCNoDouble + + Add ECX, ECX + Add EDX, EDX + +Display_HCNoDouble: + MovZX AX, Byte Ptr [BX+36h] + Inc AX + + Push ECX + Xor CX, CX + Call Music_GetSampleLocation + Pop ECX + Add ESI, EDX + + PopF + Push BX + Mov BX, 1 + JZ Display_HostChannel8Bit + + Xor DX, DX + ShR ECX, 1 + JZ Display_HostChannelError + Or ESI, 1 + Inc BX + +Display_HostChannel8Bit: + Int 3 + + Mov DL, [SI] + Mov DH, DL ; DL = min, DH = max. + +Display_HostChannel11: + Mov AL, [SI] + Add SI, BX + JC Display_HostChannelNewSegment + +Display_HostChannelResume: + Cmp DH, AL + JL Display_HostChannel12 + + Cmp DL, AL + JG Display_HostChannel13 + +Display_HostChannel14: + Loop Display_HostChannel11 + + Pop BX + + Mov AL, DH + Sub AL, DL + Jmp Display_HostChannel10 + +Display_HostChannel13: + Mov DL, AL + Jmp Display_HostChannel14 + +Display_HostChannel12: + Mov DH, AL + Jmp Display_HostChannel14 + +Display_HostChannelNewSegment: + Add ESI, 10000h + Int 3 + Jmp Display_HostChannelResume + +Display_HostChannelError: + Pop BX + +Display_HostChannel18: ; AL = volume. + Mov AL, 0 + +Display_HostChannel10: ; AL = volume. + Pop DS + Pop SI + + Mul Byte Ptr [BX+20h] ; Final volume! + ShR AH, 1 + AdC AH, 0 ; AH = volume to show. + + Pop DI + Sub DI, 26*2 ; ES:DI points to vol deposit + Mov DH, AH + And DH, 7 + ShR AH, 3 + Mov CL, AH + + Mov AH, 5 + + Test Word Ptr [BX], 800h + JZ Display_HostChannelNotMuted + + Mov AH, 1 + +Display_HostChannelNotMuted: + And CL, CL + JZ Display_HostChannel16 + +Display_HostChannel15: + Mov AL, 176 + StosW + Mov AL, 179 + StosW + Mov AL, 182 + StosW + + Dec CL + JNZ Display_HostChannel15 + +Display_HostChannel16: ; DH contains remainder. + And DH, DH + JZ Display_HostChannel6 + + Cmp DH, 3 + JBE Display_HostChannel17 + + Mov AL, 176 + StosW + + Cmp DH, 5 + JBE Display_HostChannel17 + + Mov AL, 179 + Inc DH + StosW + +Display_HostChannel17: + Mov AL, 173 + Add AL, DH + StosW + +Display_HostChannel6: + Pop DI + Pop CX + Add DI, 160 + Add SI, HOSTCHANNELSIZE + Loop Display_HostChannel5 + + Ret + +EndP Display_HostChannel + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Draw10Num + + Mov CX, 10 + Mov EBP, 10 + +Draw10Num1: + Xor EDX, EDX + Div EBP + + Add DX, '0'+2*256 + Sub DI, 2 + Mov [ES:DI], DX + + And EAX, EAX + + LoopNZ Draw10Num1 + + Add CX, CX + Sub DI, CX + + Ret + +EndP Draw10Num + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Draw2Num + + Xor AH, AH + Mov DL, 10 + Div DL + Add AX, 3030h + Mov DL, AH + Mov AH, 2 + StosW + Mov AL, DL + StosW + + ScasW +; Add DI, 2 + + Ret + +EndP Draw2Num + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Draw3Num + + Cmp AH, 10 + JB Draw3Num1 + + Xor AX, AX + +Draw3Num1: + Mov DL, 10 + Div DL + Mov DH, AH + Xor AH, AH + Div DL + Add AX, 3030h + Mov DL, AH + Mov AH, 2 + StosW + Mov AL, DL + StosW + Mov AL, DH + Add AL, 30h + StosW + + ScasW +; Add DI, 2 + + Ret + +EndP Draw3Num + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Display_Details + ; Draw boxes first. + Assume DS:InfoPage + + Mov ES, Destination + + Mov AX, 4 ; left + Push AX + Mov AL, [CS:BP+3] + Inc AX + Push AX + Push 30 + Add AX, [CS:BP+4] + Sub AX, 2 + Push AX + Push 27 + Call S_DrawBox + + Mov SI, SP + Mov Byte Ptr [SS:SI+4], 57 + Mov Byte Ptr [SS:SI+8], 31 + Call S_DrawBox + + Push DS + Call Music_GetSongSegment + Mov DS, AX + Test Byte Ptr [DS:2Ch], 4 + Pop DS + JZ Display_Details27 + + Mov Byte Ptr [SS:SI+4], 66 + Mov Byte Ptr [SS:SI+8], 58 + Call S_DrawBox + + Mov DI, [CS:BP+6] + Add DI, 118+160 + Mov SI, Offset VirtualMsg + Mov AH, 12h + Call S_DrawString + +Display_Details27: + Mov DI, [CS:BP+6] + Add DI, 12+160 + Mov SI, Offset DetailsMsg + Mov AH, 12h + Call S_DrawString + + Add SP, 10 + + Mov DX, CurrentChannel + MovZX BX, Byte Ptr [CS:BP+2] + Cmp DX, BX + JAE Display_Details1 + + Mov BX, DX + +Display_Details1: + LEA CX, [EDX+4] + Sub CX, [CS:BP+4] + Cmp BX, CX + JGE Display_Details2 + + Mov BX, CX + +Display_Details2: + Mov CX, 67 + Sub CX, [CS:BP+4] + Cmp BX, CX + JL Display_Details22 + + Mov BX, 67 + Sub BX, [CS:BP+4] + +Display_Details22: + Mov [CS:BP+2], BL ; BL = top channel + + Mov CH, 0Ah + Mov CL, [CS:BP+4] + Sub CL, 3 + Mov DI, [CS:BP+6] + Add DI, (2+2*80)*2 + + Call Music_GetSongSegment + Mov DS, AX + Assume DS:Nothing + +Display_Details3: + Push CX + Push DI + + Mov AX, BX + Inc AX + Div CH + + Add AX, '00' + + Mov DH, AH + + Mov AH, 23h + Cmp DL, BL + JE Display_Details4 + + Test Byte Ptr [BX+40h], 80h + JNZ Display_Details21 + + Mov AH, 21h + Mov CX, ProcessWindow + Cmp CX, CurrentWindow + JE Display_Details4 + + Mov AH, 20h + Jmp Display_Details32 + +Display_Details4: + Test Byte Ptr [BX+40h], 80h + JZ Display_Details32 + + Mov AH, 26h + +Display_Details32: + StosW + Mov AL, DH + StosW + +Display_Details21: + Inc BX + + Pop DI + Pop CX + Add DI, 160 + + Dec CL + JNZ Display_Details3 + + Mov AL, 80 ; HostChannelSize + Mul Byte Ptr [CS:BP+2] + Call Music_GetHostChannelInformationTable + Assume DS:Nothing + Add SI, AX + Mov DI, [CS:BP+6] + Add DI, (15+2*80)*2 + Mov CX, [CS:BP+4] + Sub CX, 3 + +Display_Details5: ; Show vol and sample. + Push CX + Push SI + Push DI + + ; Draw in divisions. + Mov AX, 2A8h + Mov Word Ptr [ES:DI], AX + Mov Word Ptr [ES:DI+22], AX + Mov Word Ptr [ES:DI+40], AX + Mov Word Ptr [ES:DI+46], AX + Mov Word Ptr [ES:DI+52], AX + Mov Word Ptr [ES:DI+58], AX + Mov Word Ptr [ES:DI+64], AX + Mov Word Ptr [ES:DI+72], AX + Mov Word Ptr [ES:DI+78], AX + + ClI + + Test Byte Ptr [SI], 4 + JNZ Display_Details6 + + Add DI, 88 + + Jmp Display_Details72 + +Display_Details6: + Mov BX, [SI+24h] ; DS:BX points to virtual channel. + Mov EAX, [BX+10h] + Call Draw10Num + + Add DI, 42 + Mov EAX, [BX+4Ch] + Call Draw10Num + + Add DI, 22 + Xor AH, AH + Mov AL, [BX+36h] + Inc AX ; Sample.. + Call Draw3Num + +; Add DI, 2 + ScasW + Xor AH, AH + Mov AL, [BX+20h] ; Final vol + Call Draw3Num + + Mov AL, [BX+21h] ; Vol + Call Draw2Num + + Mov AL, [BX+23h] ; CV + Call Draw2Num + + Mov AL, [BX+24h] ; SV + ShR AL, 1 + Call Draw2Num + + Mov AL, [BX+52h] ; VE + Call Draw2Num + + Mov AX, [BX+26h] ; Fade + ShR AX, 1 + Call Draw3Num + + Mov AL, [BX+25h] ; Pan + Cmp AL, 100 + JE Display_Details13 + + Call Draw2Num + + Jmp Display_Details7 + +Display_Details13: + Mov AX, 'S'+2*256 + StosW + Mov AL, 'u' + StosW +; Add DI, 2 + ScasW + +Display_Details7: + Mov AL, [BX+62h] ; PE + Add AL, 32 + Call Draw2Num + +; Add DI, 2 + ScasW + +Display_Details72: + Push DS + Call Music_GetSongSegment + Mov DS, AX + Test Byte Ptr [DS:2Ch], 4 + Pop DS + JZ Display_Details8 + + Mov Word Ptr [ES:DI+6], 2A8h + + Test Byte Ptr [SI], 4 + JNZ Display_Details9 + + Mov AX, '-'+2*256 + StosW + StosW + StosW + + Jmp Display_Details10 + +Display_Details9: + Push SI + + Mov SI, [BX+3Bh] ; NNA + And SI, 0FFh + ShL SI, 2 + Mov AH, 2 + Mov AL, [CS:NNAMsg+SI] + StosW + Mov AL, [CS:NNAMsg+SI+1] + StosW + Mov AL, [CS:NNAMsg+SI+2] + StosW + + Pop SI + +Display_Details10: ; Time to count channels. + Mov AH, [SI+20h] + +; Add DI, 2 + ScasW + Call Music_GetSlaveChannelInformationTable + + Xor AL, AL ; AL = count. + +Display_Details11: + Mov DL, [SI+3Ah] + And DL, 7Fh + Cmp AH, DL + JNE Display_Details12 + + Test Byte Ptr [SI], 1 + JZ Display_Details12 + + Inc AX + +Display_Details12: + Add SI, SLAVECHANNELSIZE + Loop Display_Details11 + + Xor AH, AH + Call Draw3Num + +Display_Details8: + StI + + Pop DI + Pop SI + Pop CX + Add DI, 160 + Add SI, HOSTCHANNELSIZE + Loop Display_Details5 + + Ret + +EndP Display_Details + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LoadNextData ; Returns DS:SI to data. (unpacked) + Assume DS:InfoPage + + Mov BX, DecodePattern + Cmp BX, PatternArrayNumber + JE LoadNextData1 + + Push DI + + Push CS + Pop ES + Mov DI, Offset DataArray + Mov CX, 64 + +LoadNextData3: + Mov AX, 0FDh + StosW + Mov AL, 0FFh + StosB + Xor AL, AL + StosW + Loop LoadNextData3 + + Cmp BX, 0FFFFh + JNE LoadNextData2 + + Pop DI + Mov SI, Offset DataArray + Ret + +LoadNextData2: + ; OK... time to decode. + Mov SI, DecodeOffset + Mov DS, DecodeSegment + Assume DS:Nothing + +LoadNextData4: + LodsB + And AL, AL + JZ LoadNextData5 + + Mov DL, AL + And AL, 7Fh + Dec AX + Mov DH, AL + + Mov AH, 6 + Mul AH + Mov BX, AX + Add BX, Offset DataDecode + + Mov AL, 5 + Mul DH + Mov DI, AX + Add DI, Offset DataArray + + Mov AH, [CS:BX] + Test DL, 80h + JZ LoadNextData6 + + LodsB + Mov AH, AL + Mov [CS:BX], AL + +LoadNextData6: + Test AH, 1 + JZ LoadNextData7 + + LodsB + Mov [CS:BX+1], AL + Jmp LoadNextData8 + +LoadNextData7: + Test AH, 10h + JZ LoadNextData9 + + Mov AL, [CS:BX+1] + +LoadNextData8: + Mov [CS:DI], AL ; Note + +LoadNextData9: + Test AH, 2 + JZ LoadNextData10 + + LodsB + Mov [CS:BX+2], AL + Jmp LoadNextData11 + +LoadNextData10: + Test AH, 20h + JZ LoadNextData12 + + Mov AL, [CS:BX+2] + +LoadNextData11: + Mov [CS:DI+1], AL ; Instrument + +LoadNextData12: + Test AH, 4 + JZ LoadNextData13 + + LodsB + Mov [CS:BX+3], AL + Jmp LoadNextData14 + +LoadNextData13: + Test AH, 40h + JZ LoadNextData15 + + Mov AL, [CS:BX+3] + +LoadNextData14: + Mov [CS:DI+2], AL ; Volume + +LoadNextData15: + Test AH, 8 + JZ LoadNextData16 + + LodsW + Mov [CS:BX+4], AX + Mov [CS:DI+3], AX + Jmp LoadNextData4 + +LoadNextData16: + Test AH, 80h + JZ LoadNextData4 + + Mov AX, [CS:BX+4] + Mov [CS:DI+3], AX + Jmp LoadNextData4 + +LoadNextData5: + Push CS + Pop DS + Assume DS:InfoPage + + Mov DecodeOffset, SI + + Mov SI, Offset DataArray + + Pop DI + Ret + +LoadNextData1: + Mov SI, DecodeOffset + Add DecodeOffset, 320 + Mov DS, PatternSegment + Assume DS:Nothing + + Ret + +EndP LoadNextData + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GotoRow ; DS:SI points to data. + + Push CX + + + Mov CX, CS:DecodeRow + Inc CX + +GotoRow1: + Dec CX + JZ GotoRow2 + +GotoRow3: + LodsB + And AL, AL + JZ GotoRow1 + + Mov DL, AL + And AL, 7Fh + Dec AX + Mov AH, 6 + Mul AH + Mov BX, AX + Add BX, Offset DataDecode + + Mov DH, [CS:BX] ; Mask. + Test DL, 80h + JZ GotoRow4 + + LodsB + Mov DH, AL + Mov [CS:BX], AL ; Mask + +GotoRow4: + Test DH, 1 + JZ GotoRow5 + + LodsB + Mov [CS:BX+1], AL ; Note + +GotoRow5: + Test DH, 2 + JZ GotoRow6 + + LodsB + Mov [CS:BX+2], AL ; Instrument + +GotoRow6: + Test DH, 4 + JZ GotoRow7 ; Volume + + LodsB + Mov [CS:BX+3], AL + +GotoRow7: + Test DH, 8 + JZ GotoRow3 + + LodsW + Mov [CS:BX+4], AX + Jmp GotoRow3 + +GotoRow2: + Mov CS:DecodeSegment, DS + Mov CS:DecodeOffset, SI + + Pop CX + Ret + +EndP GotoRow + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetBeforeRows ; Returns + ; CX = number of rows to show. + ; the row numbers are handled. + ; Initialises DataSegment, + ; DataOffset and Array. + Assume DS:InfoPage + + Xor CX, CX + Mov BX, CurrentRow + Mov AX, [CS:BP+4] + Sub AX, 4 + ShR AX, 1 + Sub BX, AX + JC GetBeforeRows2 + + Ret ; No rows to show! + +GetBeforeRows2: + Mov CX, BX + Neg CX ; CX = num of rows to show + + Cmp PlayMode, 1 + JE GetBeforeRows1 + ; Song.. + Mov BX, CurrentOrder + Test BX, BX + JZ GetBeforeRows3 + + Call Music_GetSongSegment + Mov ES, AX + MovZX AX, Byte Ptr [ES:BX+100h-1] + Cmp AL, 199 + JBE GetBeforeRows4 + +GetBeforeRows3: + Mov DecodePattern, 0FFFFh + Ret + +GetBeforeRows1: ; Pattern... + Mov AX, CurrentPattern + +GetBeforeRows4: + Mov DecodePattern, AX ; Now find offset. + Cmp AX, PatternArrayNumber ; CX = num rows to show + JNE GetBeforeRows5 + + Mov BX, PatternMaxRow + Sub BX, CX + Mov DecodeRow, BX + Mov AX, 320 + Mul BX + Mov DecodeOffset, AX + Jmp GetBeforeRows6 + +GetBeforeRows5: + Call Music_GetPattern + Assume DS:Nothing + LodsW + LodsW + ; AX = rows. + Sub AX, CX + Mov CS:DecodeRow, AX + Add SI, 4 + Call GotoRow + +GetBeforeRows6: ; Put numbers on screen. + Push CS + Pop DS + + JCXZ GetBeforeRows9 + + Push CX + Push DI + +GetBeforeRows7: + Mov AX, DecodeRow + Mov ES, Destination + +GetBeforeRows8: + Push CX + + Mov CH, 20h + Call PE_ConvAX2Num + + Pop CX + Inc AX + Add DI, 160 + Loop GetBeforeRows8 + + Pop DI + Pop CX + +GetBeforeRows9: + Ret + +EndP GetBeforeRows + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetAfterRows ; Returns + Assume DS:InfoPage + + Xor CX, CX + Mov BX, DecodeMaxRow + Mov AX, [CS:BP+4] + Sub AX, 3 + Mov DX, AX + Dec AX + ShR AX, 1 + Sub DX, AX + Add DX, CurrentRow + + Sub BX, DX + JC GetAfterRows2 + + Ret ; No rows to show! + +GetAfterRows2: + Mov CX, BX + Neg CX + + Cmp PlayMode, 1 + JE GetAfterRows1 + + ; Song.. + Mov BX, CurrentOrder + Cmp BX, 255 + JAE GetAfterRows3 + + Call Music_GetSongSegment + Mov ES, AX + MovZX AX, Byte Ptr [ES:BX+101h] + Cmp AL, 199 + JBE GetAfterRows4 + +GetAfterRows3: + Mov DecodePattern, 0FFFFh + Ret + +GetAfterRows1: ; Pattern... + Mov AX, CurrentPattern + +GetAfterRows4: + Mov DecodePattern, AX ; Now find offset. + Mov DecodeRow, 0 + + Cmp AX, PatternArrayNumber ; CX = num rows to show + JNE GetAfterRows5 + + Mov DecodeOffset, 0 + Jmp GetAfterRows6 + +GetAfterRows5: + Call Music_GetPattern + Assume DS:Nothing + Add SI, 8 + Mov CS:DecodeSegment, DS + + Push CS + Pop DS + Assume DS:InfoPage + + Mov DecodeOffset, SI + +GetAfterRows6: ; Put numbers on screen. + JCXZ GetAfterRows9 + + Push CX + Push DI + +GetAfterRows7: + Mov AX, DecodeRow + Mov ES, Destination + +GetAfterRows8: + Push CX + + Mov CH, 20h + Call PE_ConvAX2Num + + Pop CX + Inc AX + Add DI, 160 + Loop GetAfterRows8 + + Pop DI + Pop CX + +GetAfterRows9: + Ret + +EndP GetAfterRows + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetCurrentPatternRows ; Returns CX = number of rows to show. + Assume DS:InfoPage + + Mov BX, CurrentRow + Mov AX, [CS:BP+4] + Sub AX, 3 + + Mov CX, AX + Dec AX + ShR AX, 1 + Sub CX, AX + + Add CX, BX ; CX = final row. + Sub BX, AX + JNC GetCurrentPatternRows2 + + Xor BX, BX + ; BX = starting row. + +GetCurrentPatternRows2: + Mov AX, CurrentPattern + + Mov DecodeRow, BX + Mov DecodePattern, AX ; Now find offset. + Cmp AX, PatternArrayNumber ; BX = starting row, CX = final row. + JNE GetCurrentPatternRows5 + + Mov AX, PatternMaxRow + Mov DecodeMaxRow, AX + Cmp CX, AX + JBE GetCurrentPatternRows1 + + Mov CX, AX + +GetCurrentPatternRows1: + Mov AX, 320 + Mul BX + Mov DecodeOffset, AX + Sub CX, BX ; CX = number of rows. + Jmp GetCurrentPatternRows6 + +GetCurrentPatternRows5: + Call Music_GetPattern + Assume DS:Nothing + LodsW + LodsW + ; AX = number of rows. + Mov DecodeMaxRow, AX + + Cmp CX, AX + JBE GetCurrentPatternRows3 + + Mov CX, AX + +GetCurrentPatternRows3: + Sub CX, BX + Add SI, 4 + Call GotoRow + +GetCurrentPatternRows6: ; Put numbers on screen. + Push CS + Pop DS + + Push CX + Push DI + +GetCurrentPatternRows7: + Mov AX, DecodeRow + Mov ES, Destination + +GetCurrentPatternRows8: + Push CX + + Mov CH, 20h + Call PE_ConvAX2Num + + Pop CX + Inc AX + Add DI, 160 + Loop GetCurrentPatternRows8 + + Pop DI + Pop CX + Ret + +EndP GetCurrentPatternRows + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DrawHilightBar + + Mov DI, [CS:BP+6] + Mov AX, [CS:BP+4] + ShR AX, 1 + Mov AH, 160 + Mul AH + Add DI, AX + Add DI, 11 + +DrawHilightBar1: + Or Byte Ptr [ES:DI], 0E0h +; Add DI, 2 + ScasW + Dec CX + JNZ DrawHilightBar1 + + Ret + +EndP DrawHilightBar + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DisplayTrackData + + Cmp PlayMode, 0 + JNE DisplayTrackData1 + + Pop AX ; Pull off return address + Ret + +DisplayTrackData1: + ; Check if row is OK. + + ; Now check for early block + + Mov DI, [CS:BP+6] + Add DI, (1+2*80)*2 + + Call GetBeforeRows + JCXZ DisplayTrackData3 + +DisplayTrackData2: + Push CX + Push DI + Push DS + + Call LoadNextData ; Gets DS:SI + Call [CS:DrawTrackData] + + Pop DS + Pop DI + Pop CX + Add DI, 160 + Dec CX + JNZ DisplayTrackData2 + +DisplayTrackData3: + Call GetCurrentPatternRows + +DisplayTrackData4: + Push CX + Push DI + Push DS + + Call LoadNextData ; Gets DS:SI + Call [CS:DrawTrackData] + + Pop DS + Pop DI + Pop CX + Add DI, 160 + Dec CX + JNZ DisplayTrackData4 + + Call GetAfterRows + JCXZ DisplayTrackData6 + +DisplayTrackData5: + Push CX + Push DI + Push DS + + Call LoadNextData ; Gets DS:SI + Call [CS:DrawTrackData] + + Pop DS + Pop DI + Pop CX + Add DI, 160 + Dec CX + JNZ DisplayTrackData5 + +DisplayTrackData6: + Ret + +EndP DisplayTrackData + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Show5Channel + + Mov AL, [CS:BP+2] + Mov AH, 5 + Mul AH + Add SI, AX ; DS:SI points to stuff. + + Mov CX, 0A05h + Mov ES, Destination + Add DI, 8 + +Show5Channel1: + LodsB + Cmp AL, 119 + JBE Show5Channel2 + + Mov AH, AL + Mov AL, 205 + + Cmp AH, 0FFh + JE Show5Channel3 + + Mov AL, '^' + Cmp AH, 0FEh + JE Show5Channel3 + + Mov AL, 173 ; '.' + +Show5Channel3: + Mov AH, 6 + StosW + StosW + StosW + Jmp Show5Channel4 + +Show5Channel2: ; Show note. + AAM 12 + ; AL = octave + ; AH = note. + Mov DX, AX + MovZX BX, AL + Add BX, BX + Mov AH, 6 + Mov AL, [CS:BX+NoteTable] + StosW + Mov AL, [CS:BX+NoteTable+1] + StosW + Mov AL, DH + Add AL, 30h + StosW + +Show5Channel4: ; Show ins. +; Add DI, 2 + ScasW + LodsB + + Test AL, AL + JZ Show5Channel5 + + Xor AH, AH + Div CH + Add AX, 3030h + Mov DL, AH + Mov AH, 6 + StosW + Mov AL, DL + StosW + + Jmp Show5Channel6 + +Show5Channel5: + Mov AL, 173 + StosW + StosW + +Show5Channel6: ; show vol +; Add DI, 2 + ScasW + LodsB + Cmp AL, 0FFh + JE Show5Channel7 + + Mov AH, AL + And AH, 7Fh + Sub AH, 65 + JC Show5ChannelNoVEffect + + Test AL, 80h + JZ Show5ChannelVEffect + + Add AH, 60 + +Show5ChannelVEffect: + Mov AL, AH + Xor AH, AH + Div CH + ; AL = effect, AH = num + Add AX, 'A'+'0'*256 + Mov DL, AH + Mov AH, 6 + StosW + Mov AL, DL + StosW + + Jmp Show5Channel8 + +Show5ChannelNoVEffect: + Mov DL, 6 + Test AL, 80h + JZ Show5Channel10 + + Mov DL, 2 + And AL, 7Fh + +Show5Channel10: + Xor AH, AH + Div CH + Add AX, 3030h + XChg DL, AH + StosW + Mov AL, DL + StosW + + Mov AH, 6 + Jmp Show5Channel8 + +Show5Channel7: + Mov AL, 173 + StosW + StosW + +Show5Channel8: +; Add DI, 2 + ScasW + LodsB + And AL, AL + JNZ Show5Channel9 + + Mov AL, '.'-'@' + +Show5Channel9: + Add AL, '@' + StosW ; Command + + LodsB ; Commandvalue. + Mov AH, AL + And AX, 0FF0h + Mov DL, AH + ShR AL, 4 + + Mov AH, 6 + Call DrawHexAL + + Mov AL, DL + Call DrawHexAL + + Dec CL + JZ Show5ChannelEnd + + Mov AX, 2A8h + StosW + + Jmp Show5Channel1 + +Show5ChannelEnd: + Ret + +EndP Show5Channel + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Display_5Channel + Assume DS:InfoPage + + Mov AX, 4 ; left + Push AX + Mov AL, [CS:BP+3] + Inc AX + Push AX + Push 74 + Add AX, [CS:BP+4] + Sub AL, 2 + Push AX + Push 27 + Call S_DrawBox + + Add SP, 10 + ; Fill in text. + ; check boundaries. + Mov DX, CurrentChannel + MovZX BX, Byte Ptr [CS:BP+2] + Cmp DX, BX + JAE Display_5Channel2 + + Mov BX, DX + +Display_5Channel2: + Mov CX, DX + Sub CX, 4 + Cmp BX, CX + JGE Display_5Channel3 + + Mov BX, CX + +Display_5Channel3: + Cmp BX, 59 + JB Display_5Channel11 + + Mov BX, 59 + +Display_5Channel11: + Mov [CS:BP+2], BL ; top channel. + ; Now do channel msgs. + + Mov CX, 0A05h + Mov DI, [CS:BP+6] + Add DI, (5+1*80)*2 + Mov SI, Offset Channel5Msg + +Display_5Channel4: + MovZX AX, BL + Inc AX + Div CH + Add AX, 3030h + Mov [SI+9], AX + + Call GetChannelColour + Call S_DrawString + + Add DI, 4 + + Inc BX + Dec CL + JNZ Display_5Channel4 + + Mov [CS:DrawTrackData], Offset Show5Channel + Call DisplayTrackData + Mov CX, 69 + Call DrawHilightBar + + Ret + +EndP Display_5Channel + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Show8Channel + + Mov AL, [CS:BP+2] + Mov AH, 5 + Mul AH + Add SI, AX ; DS:SI points to stuff. + + Mov CX, 0A08h + Mov ES, Destination + Add DI, 8 + +Show8Channel1: + LodsW + Cmp AL, 119 + JBE Show8Channel2 + + Mov AH, AL + Mov AL, 205 + + Cmp AH, 0FFh + JE Show8Channel3 + + Mov AL, '^' + Cmp AH, 0FEh + JE Show8Channel3 + + Mov AL, 173 ; '.' + +Show8Channel3: + Mov AH, 6 + StosW + StosW + StosW + Jmp Show8Channel4 + +Show8Channel2: ; Show note. + AAM 12 + + Mov DX, AX + MovZX BX, AL + Add BX, BX + Mov AH, 6 + Mov AL, [CS:BX+NoteTable] + StosW + Mov AL, [CS:BX+NoteTable+1] + StosW + Mov AL, DH + Add AL, 30h + StosW + +Show8Channel4: ; Show vol. + LodsB + Cmp AL, 0FFh + JE Show8Channel5 + + Mov AH, AL + And AH, 7Fh + Sub AH, 65 + JC Show8ChannelNoVEffect + + Test AL, 80h + JZ Show8ChannelVEffect + + Add AH, 60 + +Show8ChannelVEffect: + Mov AL, AH + Xor AH, AH + Div CH + ; AL = effect, AH = num + Add AX, 'A'+'0'*256 + Mov DL, AH + Mov AH, 2 + StosW + Mov AL, DL + StosW + + Jmp Show8Channel6 + +Show8ChannelNoVEffect: + Mov DL, 2 + Test AL, 80h + JZ Show8Channel10 + + Dec DL + And AL, 7Fh + +Show8Channel10: + Xor AH, AH + Div CH + Add AX, 3030h + XChg DL, AH + StosW + Mov AL, DL + StosW + + Jmp Show8Channel6 + +Show8Channel5: + Add DI, 4 + +Show8Channel6: + LodsB + And AL, AL + JNZ Show8Channel9 + + Mov AL, '.'-'@' + +Show8Channel9: + Add AL, '@' + Mov AH, 6 + StosW ; Command + + LodsB ; Commandvalue. + Mov AH, AL + And AX, 0FF0h + Mov DL, AH + ShR AL, 4 + + Mov AH, 6 + Call DrawHexAL + + Mov AL, DL + Call DrawHexAL + + Dec CL + JZ Show8ChannelEnd + + Mov AX, 2A8h + StosW + + Jmp Show8Channel1 + +Show8ChannelEnd: + Ret + +EndP Show8Channel + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Display_8Channel + Assume DS:InfoPage + + Mov AX, 4 ; left + Push AX + Mov AL, [CS:BP+3] + Inc AX + Push AX + Push 76 + Add AX, [CS:BP+4] + Sub AL, 2 + Push AX + Push 27 + Call S_DrawBox + + Add SP, 10 + ; Fill in text. + ; check boundaries. + Mov DX, CurrentChannel + MovZX BX, Byte Ptr [CS:BP+2] + Cmp DX, BX + JAE Display_8Channel2 + + Mov BX, DX + +Display_8Channel2: + Mov CX, DX + Sub CX, 7 + Cmp BX, CX + JGE Display_8Channel3 + + Mov BX, CX + +Display_8Channel3: + Cmp BX, 56 + JB Display_8Channel11 + + Mov BX, 56 + +Display_8Channel11: + Mov [CS:BP+2], BL ; top channel. + ; Now do channel msgs. + + Mov CX, 0A08h + Mov DI, [CS:BP+6] + Add DI, (6+1*80)*2 + Mov SI, Offset Channel8Msg + +Display_8Channel4: + MovZX AX, BL + Inc AX + Div CH + Add AX, 3030h + Mov [SI+2], AX + + Call GetChannelColour + Call S_DrawString + + Add DI, 6 + + Inc BX + Dec CL + JNZ Display_8Channel4 + + Mov [CS:DrawTrackData], Offset Show8Channel + Call DisplayTrackData + Mov CX, 71 + Call DrawHilightBar + + Ret + +EndP Display_8Channel + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Show10Channel + + Mov AL, [CS:BP+2] + Mov AH, 5 + Mul AH + Add SI, AX ; DS:SI points to stuff. + + Mov CX, 0A0Ah + Mov ES, Destination + Add DI, 8 + +Show10Channel1: + LodsB + Cmp AL, 119 + JBE Show10Channel2 + + Mov AH, AL + Mov AL, 205 + + Cmp AH, 0FFh + JE Show10Channel3 + + Mov AL, '^' + Cmp AH, 0FEh + JE Show10Channel3 + + Mov AL, 173 ; '.' + +Show10Channel3: + Mov AH, 6 + StosW + StosW + StosW + Jmp Show10Channel4 + +Show10Channel2: ; Show note. + AAM 12 + ; AL = octave + ; AH = note. + Mov DX, AX + MovZX BX, AL + Add BX, BX + Mov AH, 6 + Mov AL, [CS:BX+NoteTable] + StosW + Mov AL, [CS:BX+NoteTable+1] + StosW + Mov AL, DH + Add AL, 30h + StosW + +Show10Channel4: ; Show Instrument + LodsB ; AL = instrument + And AX, 0FFh + JZ Show10Channel5 ; No instrument? + Div CH + + ; AL = tens, AH = units + ShL AL, 4 + Or AL, AH + Mov AH, 0Ah + + StosW ; Instrument done. + Jmp Show10Channel6 + +Show10Channel5: + Mov AX, 184+200h + StosW + +Show10Channel6: ; Show volume + LodsB ; AL = volume + + Cmp AL, 0FFh + JE Show10Channel7 + + Mov AH, AL + And AH, 7Fh + Sub AH, 65 + JC ViewAllSmallNoVEffect + + Test AL, 80h + JZ ViewAllSmallVEffect1 + + Mov AL, AH + Add AL, 226 + Mov AH, 6 + StosW + Jmp Show10Channel8 + +ViewAllSmallVEffect1: + Mov AL, AH + AAM + Add AH, 0Ah + ShL AH, 4 + Or AL, AH + Mov AH, 12 + StosW +Comment ~ + Mov AL, AH + Mov AH, 0 + Div CH + ; AL = effect, AH = num + Add AL, 0Ah + ShL AL, 4 + Or AL, AH + Mov AH, 12 + StosW +~ + Jmp Show10Channel8 + +ViewAllSmallNoVEffect: +; Xor AH, AH + Mov DL, 12 ; Volume + Test AL, AL + JNS Show10Channel9 + + Mov DL, 9 + And AL, 7Fh + +Show10Channel9: +; Div CH + AAM + + ; AL = tens, AH = units + ShL AH, 4 + Or AL, AH + Mov AH, DL + + StosW + Jmp Show10Channel8 + +Show10Channel7: ; No volume + Mov AX, 184+600h + StosW + +Show10Channel8: ; Show volume + LodsB + Test AL, AL + JNZ Show10Channel10 + + Add AL, '.'-'@' + +Show10Channel10: + Add AL, '@' + Mov AH, 2 + StosW ; Command + + Mov AH, 0Ah + LodsB ; Commandvalue. + StosW + + Dec CL + JNZ Show10Channel1 + + Ret + +EndP Show10Channel + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Display_10Channel + Assume DS:InfoPage + + Mov AX, 4 ; left + Push AX + Mov AL, [CS:BP+3] + Inc AX + Push AX + Push 75 + Add AX, [CS:BP+4] + Sub AL, 2 + Push AX + Push 27 + Call S_DrawBox + + Add SP, 10 + ; Fill in text. + ; check boundaries. + Mov DX, CurrentChannel + MovZX BX, Byte Ptr [CS:BP+2] + Cmp DX, BX + JAE Display_10Channel2 + + Mov BX, DX + +Display_10Channel2: + Mov CX, DX + Sub CX, 9 + Cmp BX, CX + JGE Display_10Channel3 + + Mov BX, CX + +Display_10Channel3: + Cmp BX, 54 + JB Display_10Channel11 + + Mov BX, 54 + +Display_10Channel11: + Mov [CS:BP+2], BL ; top channel. + ; Now do channel msgs. + + Mov CX, 0A0Ah + Mov DI, [CS:BP+6] + Add DI, (5+1*80)*2 + Mov SI, Offset Channel8Msg + +Display_10Channel4: + MovZX AX, BL + Inc AX + Div CH + Add AX, 3030h + Mov [SI+2], AX + + Call GetChannelColour + Call S_DrawString + +; Add DI, 2 + ScasW + + Inc BX + Dec CL + JNZ Display_10Channel4 + + Mov [CS:DrawTrackData], Offset Show10Channel + Call DisplayTrackData + Mov CX, 70 + Call DrawHilightBar + + Ret + +EndP Display_10Channel + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Process3CharacterRow + + Push SI + + LodsW + Cmp AX, 0FDh + JE Show18Channel4 + + Cmp AL, 0FDh + JE Show18Channel3 + JB Show18Channel2 + + Mov AH, AL + Mov AL, 205 + + Cmp AH, 0FFh + JE Show18Channel8 + + Mov AL, '^' + Cmp AH, 0FEh + JE Show18Channel8 + + Mov AL, 173 ; '.' + +Show18Channel8: + Mov AH, 6 + StosW + StosW + StosW + Jmp Show18Channel7 + +Show18Channel2: + AAM 12 + + Mov DX, AX + MovZX BX, AL + Add BX, BX + Mov AH, 6 + Mov AL, [CS:BX+NoteTable] + StosW + Mov AL, [CS:BX+NoteTable+1] + StosW + Mov AL, DH + Add AL, 30h + StosW + + Jmp Show18Channel7 + +Show18Channel3: + MovZX AX, AH + Div CH + Add AX, 3030h + Mov DL, AH + Mov AH, 6 +; Add DI, 2 + ScasW + StosW + Mov AL, DL + StosW + Jmp Show18Channel7 + +Show18Channel4: + LodsW + Cmp AX, 0FFh + JE Show18Channel6 + + Cmp AL, 0FFh + JE Show18Channel5 + +; Add DI, 2 + ScasW + + Mov AH, AL + And AH, 7Fh + Sub AH, 65 + JC Show18ChannelNoVEffect + + Test AL, 80h + JZ Show18ChannelVEffect + + Add AH, 60 + +Show18ChannelVEffect: + Mov AL, AH + Xor AH, AH + Div CH + ; AL = effect, AH = num + Add AX, 'A'+'0'*256 + Mov DL, AH + Mov AH, 2 + StosW + Mov AL, DL + StosW + + Jmp Show18Channel7 + +Show18ChannelNoVEffect: + Mov DL, 2 + Test AL, 80h + JZ Show18Channel9 + + Dec DX + And AL, 7Fh + +Show18Channel9: + Xor AH, AH ; Volume + Div CH + Add AX, 3030h + XChg DL, AH + StosW + Mov AL, DL + StosW + + Jmp Show18Channel7 + +Show18Channel5: + Mov AL, AH + Add AL, '@' + Mov AH, 2 + StosW + + LodsB ; Commandvalue. + Mov AH, AL + And AX, 0FF0h + Mov DL, AH + ShR AL, 4 + + Mov AH, 2 + Call DrawHexAL + + Mov AL, DL + Call DrawHexAL + Jmp Show18Channel7 + +Show18Channel6: + Mov AX, 173+256*6 + StosW + StosW + StosW + +Show18Channel7: + Pop SI + Add SI, 5 + + Ret + +EndP Process3CharacterRow + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Show18Channel + + Mov AL, [CS:BP+2] + Mov AH, 5 + Mul AH + Add SI, AX ; DS:SI points to stuff. + + Mov CX, 0A12h + Mov ES, Destination + Add DI, 8 + +Show18Channel1: + Call Process3CharacterRow + Dec CL + JZ Show18ChannelEnd + + Mov AX, 2A8h + StosW + + Jmp Show18Channel1 + +Show18ChannelEnd: + Ret + +EndP Show18Channel + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Display_18Channel + Assume DS:InfoPage + + Mov AX, 4 ; left + Push AX + Mov AL, [CS:BP+3] + Inc AX + Push AX + Push 76 + Add AX, [CS:BP+4] + Sub AL, 2 + Push AX + Push 27 + Call S_DrawBox + + Add SP, 10 + ; Fill in text. + ; check boundaries. + Mov DX, CurrentChannel + MovZX BX, Byte Ptr [CS:BP+2] + Cmp DX, BX + JAE Display_18Channel2 + + Mov BX, DX + +Display_18Channel2: + Mov CX, DX + Sub CX, 17 + Cmp BX, CX + JGE Display_18Channel3 + + Mov BX, CX + +Display_18Channel3: + Cmp BX, 46 + JB Display_18Channel11 + + Mov BX, 46 + +Display_18Channel11: + Mov [CS:BP+2], BL ; top channel. + ; Now do channel msgs. + + Mov CX, 0A12h + Mov DI, [CS:BP+6] + Add DI, (6+1*80)*2 + Mov SI, Offset Channel18Msg + +Display_18Channel4: + MovZX AX, BL + Inc AX + Div CH + Add AX, 3030h + Mov [SI], AX + + Call GetChannelColour + Call S_DrawString + + Add DI, 4 + + Inc BX + Dec CL + JNZ Display_18Channel4 + + Mov [CS:DrawTrackData], Offset Show18Channel + Call DisplayTrackData + Mov CX, 71 + Call DrawHilightBar + + Ret + +EndP Display_18Channel + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Show24Channel + + Mov AL, [CS:BP+2] + Mov AH, 5 + Mul AH + Add SI, AX ; DS:SI points to stuff. + + Mov CX, 0A18h + Mov ES, Destination + Add DI, 8 + +Show24Channel1: + Call Process3CharacterRow + + Dec CL + JNZ Show24Channel1 + + Ret + +EndP Show24Channel + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Display_24Channel + Assume DS:InfoPage + + Mov AX, 4 ; left + Push AX + Mov AL, [CS:BP+3] + Inc AX + Push AX + Push 77 + Add AX, [CS:BP+4] + Sub AL, 2 + Push AX + Push 27 + Call S_DrawBox + + Add SP, 10 + ; Fill in text. + ; check boundaries. + Mov DX, CurrentChannel + MovZX BX, Byte Ptr [CS:BP+2] + Cmp DX, BX + JAE Display_24Channel2 + + Mov BX, DX + +Display_24Channel2: + Mov CX, DX + Sub CX, 23 + Cmp BX, CX + JGE Display_24Channel3 + + Mov BX, CX + +Display_24Channel3: + Cmp BX, 40 + JB Display_24Channel11 + + Mov BX, 40 + +Display_24Channel11: + Mov [CS:BP+2], BL ; top channel. + ; Now do channel msgs. + + Mov CX, 0A18h + Mov DI, [CS:BP+6] + Add DI, (6+1*80)*2 + Mov SI, Offset Channel18Msg + +Display_24Channel4: + MovZX AX, BL + Inc AX + Div CH + Add AX, 3030h + Mov [SI], AX + + Call GetChannelColour + Call S_DrawString + +; Add DI, 2 + ScasW + + Inc BX + Dec CL + JNZ Display_24Channel4 + + Mov [CS:DrawTrackData], Offset Show24Channel + Call DisplayTrackData + Mov CX, 72 + Call DrawHilightBar + + Ret + +EndP Display_24Channel + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Show36Channel + + Mov AL, [CS:BP+2] + Mov AH, 5 + Mul AH + Add SI, AX ; DS:SI points to stuff. + + Mov CX, 0A24h + Mov ES, Destination + Add DI, 8 + +Show36Channel1: + LodsW + + Cmp AX, 0FDh + JE Show36Channel4 + + Add SI, 3 + + Cmp AL, 0FDh + JE Show36Channel3 + JB Show36Channel2 + + Mov AH, AL + Mov AL, 205 + + Cmp AH, 0FFh + JE Show36Channel8 + + Mov AL, '^' + Cmp AH, 0FEh + JE Show36Channel8 + + Mov AL, 173 ; '.' + +Show36Channel8: + Mov AH, 6 + StosW + StosW + Jmp Show36Channel7 + +Show36Channel2: + AAM 12 + Mov BX, Offset Note2Table + SegCS XLatB + Mov DL, AH + Mov AH, 6 + StosW + + Mov AL, DL + Add AL, 30h + StosW + + Jmp Show36Channel7 + +Show36Channel3: + MovZX AX, AH + Div CH + Add AX, 3030h + Mov DL, AH + Mov AH, 6 + StosW + Mov AL, DL + StosW + + Jmp Show36Channel7 + +Show36Channel4: + LodsW + Cmp AX, 0FFh + JE Show36Channel6 + + Cmp AL, 0FFh + JE Show36Channel5 + + Mov AH, AL + And AH, 7Fh + Sub AH, 65 + JC Show36ChannelNoVEffect + + Test AL, 80h + JZ Show36ChannelVEffect + + Add AH, 60 + +Show36ChannelVEffect: + Mov AL, AH + Xor AH, AH + Div CH + ; AL = effect, AH = num + Add AX, 'A'+'0'*256 + Mov DL, AH + Mov AH, 2 + StosW + Mov AL, DL + StosW + + Jmp Show36ChannelEndVolume + +Show36ChannelNoVEffect: + Mov DL, 2 + Test AL, 80h + JZ Show36Channel10 + + And AL, 7Fh + Dec DX + +Show36Channel10: + + Xor AH, AH ; Volume + Div CH + Add AX, 3030h + XChg DL, AH + StosW + Mov AL, DL + StosW + +Show36ChannelEndVolume: + Inc SI + Jmp Show36Channel7 + +Show36Channel5: + Mov AL, AH + Add AL, '@' + Mov AH, 2 + StosW + LodsB + Mov AH, 0Ah + StosW + + Jmp Show36Channel7 + +Show36Channel6: + Mov AX, 173+256*6 + StosW + StosW + Inc SI + +Show36Channel7: + Dec CL + JNZ Show36Channel9 + + Ret + +Show36Channel9: + Jmp Show36Channel1 + +EndP Show36Channel + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Display_36Channel + Assume DS:InfoPage + + Mov AX, 4 ; left + Push AX + Mov AL, [CS:BP+3] + Inc AX + Push AX + Push 77 + Add AX, [CS:BP+4] + Sub AL, 2 + Push AX + Push 27 + Call S_DrawBox + + Add SP, 10 + ; Fill in text. + ; check boundaries. + Mov DX, CurrentChannel + MovZX BX, Byte Ptr [CS:BP+2] + Cmp DX, BX + JAE Display_36Channel2 + + Mov BX, DX + +Display_36Channel2: + Mov CX, DX + Sub CX, 35 + Cmp BX, CX + JGE Display_36Channel3 + + Mov BX, CX + +Display_36Channel3: + Cmp BX, 28 + JB Display_36Channel11 + + Mov BX, 28 + +Display_36Channel11: + Mov [CS:BP+2], BL ; top channel. + ; Now do channel msgs. + + Mov CX, 0A24h + Mov DI, [CS:BP+6] + Add DI, (5+1*80)*2 + Mov SI, Offset Channel18Msg + +Display_36Channel4: + MovZX AX, BL + Inc AX + Div CH + Add AX, 3030h + Mov [SI], AX + + Call GetChannelColour + Call S_DrawString + + Inc BX + Dec CL + JNZ Display_36Channel4 + + Mov [CS:DrawTrackData], Offset Show36Channel + Call DisplayTrackData + Mov CX, 72 + Call DrawHilightBar + + Ret + +EndP Display_36Channel + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Show64Channel + ; DS:SI points to stuff. + + Mov CX, 64 + Mov ES, Destination + Add DI, 8 + +Show64Channel1: + LodsW + + Cmp AX, 0FDh + JE Show64Channel4 + + Add SI, 3 + + Cmp AL, 0FDh + JE Show64Channel3 + JB Show64Channel2 + + Mov AH, AL + Mov AL, 205 + + Cmp AH, 0FFh + JE Show64Channel8 + + Mov AL, '^' + Cmp AH, 0FEh + JE Show64Channel8 + + Mov AL, 173 ; '.' + +Show64Channel8: + Mov AH, 6 + StosW + Jmp Show64Channel7 + +Show64Channel2: + AAM 12 + Mov BX, Offset Note2Table + SegCS XLatB + Mov AH, 6 + + StosW + Jmp Show64Channel7 + +Show64Channel3: + Mov AL, AH + AAM + ShL AH, 4 + Or AL, AH + + Mov AH, 10 + StosW + Jmp Show64Channel7 + +Show64Channel4: + LodsW + Inc SI + + Cmp AL, 0FFh + JE Show64Channel6 + + Mov DL, AL + And AX, 07Fh + + Cmp AL, 64 + JA Show64Channel6 + + AAM + ShL AH, 4 + Or AL, AH + + Mov AH, 12 + Test DL, 80h + JZ Show64ChannelVolumePan + + Mov AH, 9 + +Show64ChannelVolumePan: + StosW + + Jmp Show64Channel7 + +Show64Channel6: + Mov AX, 173+256*6 + StosW + +Show64Channel7: + Dec CX + JNZ Show64Channel9 + + Mov CX, 9 + Mov AX, 173+256*6 + Rep StosW + Ret + +Show64Channel9: + Jmp Show64Channel1 + +EndP Show64Channel + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Display_64Channel + Assume DS:InfoPage + + Mov AX, 4 ; left + Push AX + Mov AL, [CS:BP+3] + Inc AX + Push AX + Push 78 + Add AX, [CS:BP+4] + Sub AL, 2 + Push AX + Push 27 + Call S_DrawBox + + Add SP, 10 + ; Now do channel msgs. + + Mov CX, 0A40h + Mov DI, [CS:BP+6] + Add DI, (5+1*80)*2 + Mov SI, Offset Channel18Msg + Xor BX, BX + Mov DL, Byte Ptr CurrentChannel + +Display_64Channel4: + MovZX AX, BL + Inc AX + Div CH + + ShL AL, 4 + Or AL, AH + Mov DH, AL + Call GetChannelColour + Or AH, 8 + Mov AL, DH + StosW + + Inc BX + Dec CL + JNZ Display_64Channel4 + + Mov AX, 1000h + Mov CX, 9 + Rep StosW + + Mov Byte Ptr [CS:BP+2], 0 + + Mov [CS:DrawTrackData], Offset Show64Channel + Call DisplayTrackData + Mov CX, 73 + Call DrawHilightBar + + Ret + +EndP Display_64Channel + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Display_Variables + + Mov DI, [CS:BP+6] + Add DI, (2+1*80)*2 + + Call Music_GetSlaveChannelInformationTable + ; DS:SI points to tables + ; CX = numchannels. + Xor DX, DX ; DX = counter of + ; currently act. + ; channels. + Xor BX, BX + + +Display_Variables1: + Cmp Word Ptr [SI+38h], 0 + JE Display_Variables2 + + Inc BX + +Display_Variables2: + Mov AX, [SI] +; Test AH, 8 +; JNZ Display_Variables4 + + And AX, 1 + Add DX, AX + +Display_Variables4: + Add SI, SLAVECHANNELSIZE + Loop Display_Variables1 + + Push BX + Call Music_GetDisplayVariables ; AX = Current Speed + ; BX = current tempo + ; CX = global volume + ; DX = active channels + Pop BX + Push CX + Push BX + Push DX + + Push CS + Pop DS + + Mov AH, 20h + Mov AL, Byte Ptr CurrentWindow + Cmp AL, Byte Ptr ProcessWindow + JNE Display_Variables3 + + Mov AH, 23h + +Display_Variables3: + Mov SI, Offset VariablesMsg + Call S_DrawString + + Add SP, 6 + + Ret + +EndP Display_Variables + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Display_NoteDots ; Draw boxes first. + Assume DS:InfoPage + + Mov ES, Destination + + Mov AX, 4 ; left + Push AX + Mov AL, [CS:BP+3] + Push AX + Push 78 + Add AX, [CS:BP+4] + Dec AX + Push AX + Push 27 + Call S_DrawBox + Add SP, 10 + + Mov DX, CurrentChannel + MovZX BX, Byte Ptr [CS:BP+2] + Cmp DX, BX + JAE Display_Dots1 + + Mov BX, DX + +Display_Dots1: + LEA CX, [EDX+3] + Sub CX, [CS:BP+4] + Cmp BX, CX + JGE Display_Dots2 + + Mov BX, CX + +Display_Dots2: + Mov CX, 66 + Sub CX, [CS:BP+4] + Cmp BX, CX + JLE Display_Dots3 + + Mov BX, 65 + Sub BX, [CS:BP+4] + +Display_Dots3: + Mov [CS:BP+2], BL ; BL = top channel + + Call DrawChannelNumbers + + Mov DX, [CS:BP+4] + Sub DX, 2 + Mov BL, [CS:BP+2] ; BL = channel + Mov DI, [CS:BP+6] + Add DI, (5+1*80)*2 + +Display_Dots4: + Push DI + + Push CS + Pop ES + Mov DI, Offset DataArray + Mov AX, 600h + 193 + Mov CX, 73 + Rep StosW ; DataArray cleared. + + ; OK.. loop to find channel usage. + Call Music_GetSlaveChannelInformationTable + ; Return DS:SI, CX +Display_Dots5: +; Cmp Word Ptr [SI+38h], 0 +; JE Display_Dots8 + + Test Byte Ptr [SI], 1 + JZ Display_Dots6 + + Mov AL, [SI+3Ah] + And AX, 7Fh + Cmp AL, BL + JNE Display_Dots6 ; Nope.. not the same channel + + Mov AL, [SI+32h] + Sub AL, 30 + JC Display_Dots6 + Cmp AL, 73 + JAE Display_Dots6 + + LEA DI, [DataArray+EAX+EAX] + Mov AL, [SI+20h] + Mov AH, [SI+36h] + Cmp AH, 100 + JNE Display_DotsNOMIDI + + Mov AH, [SI+33h] + +Display_DotsNoMIDI: + And AH, 3 + Add AL, 7 + ShR AL, 4 + AdC AX, 200h+193 + Test Word Ptr [SI], 800h + JZ Display_Dots7 + + Mov AH, 1 ; 6 + +Display_Dots7: + Test Byte Ptr [SI+3Ah], 80h + JZ Display_Dots9 + + Cmp Byte Ptr [CS:DI], AL + JA Display_Dots6 +Display_Dots9: + + Mov [CS:DI], AX + +Display_Dots6: + Add SI, SLAVECHANNELSIZE + + Dec CX + JNZ Display_Dots5 + +Display_Dots8: +; Dump to screen buffer. + + Pop DI + + Push CS + Pop DS + Mov SI, Offset DataArray + Mov ES, Destination + + Mov CX, 73 + Rep MovsW + + Add DI, 160-146 + + Inc BL + Dec DX + JNZ Display_Dots4 + + Ret + +EndP Display_NoteDots + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Comment ~ + +Proc Display_SampleDots ; Draw boxes first. + Assume DS:InfoPage + + Mov ES, Destination + + Mov AX, 4 ; left + Push AX + Mov AL, [CS:BP+3] + Push AX + Push 78 + Add AX, [CS:BP+4] + Dec AX + Push AX + Push 27 + Call S_DrawBox + Add SP, 10 + + Mov DX, CurrentSample + MovZX BX, Byte Ptr [CS:BP+2] + Cmp DX, BX + JAE Display_SampleDots1 + + Mov BX, DX + +Display_SampleDots1: + LEA CX, [EDX+3] + Sub CX, [CS:BP+4] + Cmp BX, CX + JGE Display_SampleDots2 + + Mov BX, CX + +Display_SampleDots2: + Mov CX, 66 + Sub CX, [CS:BP+4] + Cmp BX, CX + JLE Display_SampleDots3 + + Mov BX, 65 + Sub BX, [CS:BP+4] + +Display_SampleDots3: + Mov [CS:BP+2], BL ; BL = top channel + + Mov CL, [CS:BP+4] + Mov CH, 0Ah + Sub CL, 2 + Mov DI, [CS:BP+6] + Add DI, (2+1*80)*2 + +Display_SampleDotsNumbers1: ; BX = top number, CL = count + Inc BX + Mov AX, BX + Div CH + Add AX, 3030h + Mov DH, AH + Mov AH, 21h + StosW + Mov AL, DH + StosW + Add DI, 160-4 + Dec CL + JNZ Display_SampleDotsNumbers1 + + Mov DX, [CS:BP+4] + Sub DX, 2 + Mov BL, [CS:BP+2] ; BL = sample + Mov DI, [CS:BP+6] + Add DI, (5+1*80)*2 + +Display_SampleDots4: + Push DI + + Push CS + Pop ES + Mov DI, Offset DataArray + Mov AX, 600h + 193 + Mov CX, 73 + Rep StosW ; DataArray cleared. + + ; OK.. loop to find channel usage. + Call Music_GetSlaveChannelInformationTable + ; Return DS:SI, CX +Display_SampleDots5: + Test Byte Ptr [SI], 1 + JZ Display_SampleDots6 + + Mov AL, [SI+36h] + Cmp AL, BL + JNE Display_SampleDots6 ; Nope.. not the same channel + + MovZX AX, Byte Ptr [SI+32h] + Sub AL, 30 + JC Display_SampleDots6 + Cmp AL, 73 + JAE Display_SampleDots6 + + LEA DI, [DataArray+EAX+EAX] + Mov AL, [SI+20h] ; Volume + Mov AH, [SI+33h] ; Instrument + + And AH, 3 + Add AL, 7 + ShR AL, 4 + AdC AX, 200h+193 + Test Word Ptr [SI], 800h + JZ Display_SampleDots7 + + Mov AH, 1 ; 6 ; Muted + +Display_SampleDots7: + Cmp Byte Ptr [CS:DI], AL + JA Display_SampleDots6 + +Display_SampleDots9: + Mov [CS:DI], AX + +Display_SampleDots6: + Add SI, SLAVECHANNELSIZE + + Dec CX + JNZ Display_SampleDots5 + +Display_SampleDots8: +; Dump to screen buffer. + + Pop DI + + Push CS + Pop DS + Mov SI, Offset DataArray + Mov ES, Destination + + Mov CX, 73 + Rep MovsW + + Add DI, 160-146 + + Inc BL + Dec DX + JNZ Display_SampleDots4 + + + Ret + +EndP Display_SampleDots + +~ + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DrawDisplayData Far + + Call PE_GetCurrentPattern + Mov CS:PatternSegment, DS + + Push CS + Pop DS + Assume DS:InfoPage + + Call S_GetDestination + Mov Destination, ES + + Mov PatternArrayNumber, AX + Mov PatternMaxRow, BX + + Call Music_GetPlayMode + Mov PlayMode, AX + Mov CurrentRow, BX + Mov CurrentPattern, CX + Mov CurrentOrder, DX + + Xor BP, BP + + Cmp CX, PatternArrayNumber + JNE DrawDisplayData1 + + Call Music_GetPatternLength + Mov PatternMaxRow, AX + +DrawDisplayData1: + Push CS + Pop DS + Assume DS:InfoPage + + Push BP + + Mov ProcessWindow, BP + + ShL BP, 3 + Add BP, Offset DisplayWindows + Mov SI, [CS:BP] + + Xor AL, AL + + Cmp FullScreen, 0 + JNE DisplayDataFull + + Cmp BP, Offset DisplayWindows + JE DisplayData2 + +DisplayDataFull: + Test SI, SI + JZ DisplayData2 + Cmp SI, DOTSDISPLAY + JE DisplayData2 + + Inc AX + + Dec Byte Ptr [CS:BP+3] ; Starting row + Inc Word Ptr [CS:BP+4] ; Length of window + Sub Word Ptr [CS:BP+6], 160 ; Offset + +DisplayData2: + Mov [RestoreData], AL + + Add SI, SI + Call [DisplayDataModes+SI] + + Push CS + Pop DS + + Cmp [RestoreData], 0 + JE DisplayData3 + + Pop BX + Push BX + + ShL BX, 3 + Add BX, Offset DisplayWindows + + Inc Byte Ptr [BX+3] + Dec Word Ptr [BX+4] + Add Word Ptr [BX+6], 160 + +DisplayData3: + Pop BP + Inc BP + Cmp BP, NumWindows + JB DrawDisplayData1 + + Mov AX, 1 + Ret + +EndP DrawDisplayData + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PostDisplayData Far + + Push CS + Pop DS + Assume DS:InfoPage + + Mov SI, Offset DisplayListKeys + Call M_FunctionDivider + JC PostDisplayData1 + + Jmp [SI] + +PostDisplayData1: + Xor AX, AX + Ret + +EndP PostDisplayData + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DisplayUp Far + Assume DS:InfoPage + + Mov AX, 1 + + Sub CurrentChannel, AX + AdC CurrentChannel, 0 + + Ret + +EndP DisplayUp + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DisplayDown Far + Assume DS:InfoPage + + Mov AX, CurrentChannel + Inc AX + Cmp AX, 64 + JAE DisplayDown1 + + Mov CurrentChannel, AX + +DisplayDown1: + Mov AX, 1 + Ret + +EndP DisplayDown + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DisplayPlus Far + + Call Music_NextOrder + + Mov AX, 1 + Ret + +EndP DisplayPlus + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DisplayMinus Far + + Call Music_LastOrder + + Mov AX, 1 + Ret + +EndP DisplayMinus + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DisplayInsert Far + Assume DS:InfoPage + + Cmp NumWindows, 5 + JAE DisplayInsert1 + + Push DS + Pop ES + + Mov AX, 8 + Mul Byte Ptr CurrentWindow ; AX = offset + Mov SI, Offset DisplayWindows + Add SI, AX + + Cmp Word Ptr [SI+4], 6 ; Length of window + JBE DisplayInsert1 + + Push SI + + Mov AX, 8 + Mul Byte Ptr NumWindows + Mov SI, Offset DisplayWindows + Add SI, AX + Mov DI, SI + Sub SI, 8 + + Mov DX, NumWindows + Sub DX, CurrentWindow + +DisplayInsert2: + Mov CX, 4 + Rep MovsW + + Sub SI, 16 + Sub DI, 16 + Dec DX + JNZ DisplayInsert2 + + Pop SI ; SI points to cur win + ; now to resize.. + Mov AX, [SI+4] ; AX = length of win + ShR AX, 1 + AdC AX, 0 + + Mov [SI+4], AX ; halve length. + Sub [SI+8+4], AX ; second one also + Add AL, [SI+3] ; Add top line + Mov [SI+8+3], AL + Mov AH, 160 + Mul AH + Mov [SI+8+6], AX + + Inc NumWindows + +DisplayInsert1: + Mov AX, 1 + Ret + +EndP DisplayInsert + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DisplayDelete Far + Assume DS:InfoPage + + Cmp NumWindows, 1 + JBE DisplayDelete1 + + Mov AX, 8 + Mul Byte Ptr CurrentWindow ; AX = offset + Mov SI, Offset DisplayWindows + Add SI, AX + Mov DI, SI + + Mov BX, [SI+4] ; Length of deleted win + Push SI + + Add SI, 8 + + Push DS + Pop ES + + Mov DX, NumWindows + Sub DX, CurrentWindow + +DisplayDelete2: + Mov CX, 4 + Rep MovsW + + Dec DX + JNZ DisplayDelete2 + + Pop SI + ; Now to recombine. + + Dec NumWindows + + Mov AX, CurrentWindow + Cmp AX, NumWindows + JB DisplayDelete3 + + Dec CurrentWindow ; Combine with earlier. + Add [SI-8+4], BX + Jmp DisplayDelete1 + +DisplayDelete3: ; Combine with next + Add [SI+4], BX + Mov AL, [SI+3] + Sub AL, BL + Mov [SI+3], AL + Mov AH, 160 + Mul AH + Mov [SI+6], AX + +DisplayDelete1: + Mov AX, 1 + Ret + +EndP DisplayDelete + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DisplayNext Far + Assume DS:InfoPage + + Mov AX, CurrentWindow + Inc AX + Cmp AX, NumWindows + JB DisplayNext1 + + Xor AX, AX + +DisplayNext1: + Mov CurrentWindow, AX + + Mov AX, 1 + Ret + +EndP DisplayNext + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DisplayPrevious Far + + Mov AX, CurrentWindow + And AX, AX + JZ DisplayPrevious1 + + Dec AX + Mov CurrentWindow, AX + +DisplayPrevious1: + Mov AX, 1 + Ret + +EndP DisplayPrevious + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DisplayAltUp Far + Assume DS:InfoPage + + Mov BX, 3 + + Mov AX, CurrentWindow + Sub AX, 1 + AdC BX, 0 + Add AX, 2 + + Cmp AX, NumWindows + JAE DisplayAltUp1 + + Mov AH, 8 + Mul AH + Mov SI, Offset DisplayWindows + Add SI, AX + + Cmp Word Ptr [SI-8+4], BX + JBE DisplayAltUp1 + + Inc Word Ptr [SI+4] + Dec Word Ptr [SI-8+4] + Dec Byte Ptr [SI+3] + Sub Word Ptr [SI+6], 160 + +DisplayAltUp1: + Mov AX, 1 + Ret + +EndP DisplayAltUp + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DisplayAltDown Far + Assume DS:InfoPage + + Mov AX, CurrentWindow + Inc AX + Cmp AX, NumWindows + JAE DisplayAltDown1 + + Mov AH, 8 + Mul AH + Mov SI, Offset DisplayWindows + Add SI, AX + + Cmp Word Ptr [SI+4], 3 + JBE DisplayAltDown1 + + Inc Word Ptr [SI-8+4] + Dec Word Ptr [SI+4] + Inc Byte Ptr [SI+3] + Add Word Ptr [SI+6], 160 + +DisplayAltDown1: + Mov AX, 1 + Ret + +EndP DisplayAltDown + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DisplayPageUp Far + Assume DS:InfoPage + + Mov AX, CurrentWindow + Mov AH, 8 + Mul AH + Mov SI, Offset DisplayWindows + Add SI, AX + + Mov AX, [SI] + And AX, AX + JNZ DisplayPageUp1 + + Mov AX, PLAYMETHODS + +DisplayPageUp1: + Dec AX + Mov [SI], AX + + Mov AX, 1 + Ret + +EndP DisplayPageUp + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DisplayPageDown Far + Assume DS:InfoPage + + Mov AX, CurrentWindow + Mov AH, 8 + Mul AH + Mov SI, Offset DisplayWindows + Add SI, AX + + Mov AX, [SI] + Inc AX + Cmp AX, PLAYMETHODS + JB DisplayPageDown1 + + Xor AX, AX + +DisplayPageDown1: + Mov [SI], AX + + Mov AX, 1 + Ret + +EndP DisplayPageDown + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DisplayHome Far + Assume DS:InfoPage + + Mov CurrentChannel, 0 + + Mov AX, 1 + Ret + +EndP DisplayHome + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DisplayEnd Far + Assume DS:InfoPage + + Call Music_GetLastChannel + Mov CurrentChannel, AX + + Mov AX, 1 + Ret + +EndP DisplayEnd + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DisplayToggleChannel Far + + Mov AX, CurrentChannel + Call Music_ToggleChannel + + Mov AX, 1 + Ret + +EndP DisplayToggleChannel + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DisplaySoloChannel Far + + Mov AX, CurrentChannel + Call Music_SoloChannel + + Mov AX, 1 + Ret + +EndP DisplaySoloChannel + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +OldEBX DD 0 +OldECX DD 0 + +Proc DisplayUpdateScreen Far + +IF NETWORKENABLED + Call Network_Poll + + Test AX, AX + JNZ DisplayUpdateScreen1 +ENDIF + + Call Music_Poll + Call Music_GetPlayMode2 + + Test AX, AX + JZ DisplayUpdateScreen3 ; Play mode 0 - update screen + + Cmp CS:OldEBX, EBX + JNE DisplayUpdateScreen2 + + Cmp CS:OldECX, ECX + JNE DisplayUpdateScreen2 + + Xor AX, AX + Ret + +DisplayUpdateScreen3: + Mov EBX, -1 + Mov ECX, EBX + +DisplayUpdateScreen2: + Mov CS:OldEBX, EBX + Mov CS:OldECX, ECX + +DisplayUpdateScreen1: + Mov AX, 1 + Ret + +EndP DisplayUpdateScreen + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DisplayToggleStereo Far + Assume DS:InfoPage + + Call Music_GetSongSegment + Mov ES, AX + + Mov AL, [ES:2Ch] + Xor AL, 1 + Mov [ES:2Ch], AL + + Mov SI, Offset StereoEnabledMsg + Test AL, 1 + JNZ DisplayToggleStereo1 + + Mov SI, Offset StereoDisabledMsg + +DisplayToggleStereo1: + Call SetInfoLine + Call Music_InitStereo + + Mov AX, 1 + Ret + +EndP DisplayToggleStereo + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Display_GetDisplayWindowData Far + + Push CS + Pop DS + Assume DS:InfoPage + + Mov DX, Offset DisplayWindows + + Ret + +EndP DIsplay_GetDisplayWindowData + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Display_GotoPattern Far + + Call Music_GetPlayMode + Cmp AX, 1 + JB Display_GotoPattern1 + JE Display_GotoPattern2 + + Push Pattern + Pop DS + Assume DS:Pattern + + Mov Order, DX + +Display_GotoPattern2: + Mov AX, CX + ; BX = current row + Mov CX, CS:CurrentChannel + + Jmp PE_GotoPattern + +Display_GotoPattern1: + Xor AX, AX + Ret + +EndP Display_GotoPattern + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Display_SpaceBar Far + Assume DS:InfoPage + + Call DisplayToggleChannel + Jmp DisplayDown + +EndP Display_SpaceBar + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DisplayToggleVelocity Far + + Mov SI, Offset VolumeMsg + Xor Byte Ptr Velocity, 1 + JZ DisplayToggleVelocity1 + + Mov SI, Offset VelocityMsg + +DisplayToggleVelocity1: + Call SetInfoLine + + Mov AX, 1 + Ret + +EndP DisplayToggleVelocity + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DisplayToggleInstrument Far + + Mov SI, Offset SampleMsg + Xor Byte Ptr Instrument, 1 + JZ DisplayToggleInstrument1 + + Mov SI, Offset InstrumentMsg + +DisplayToggleInstrument1: + Call SetInfoLine + + Mov AX, 1 + Ret + +EndP DisplayToggleInstrument + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DisplayToggleReverse Far + + Call Music_ToggleReverse + + Mov AX, 1 + Ret + +EndP DisplayToggleReverse + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Display_SelectDisplayList Far + + Cmp CS:FullScreen, 1 + JZ Display_FullScreen3 + Jmp Display_FullScreen4 + +EndP Display_SelectDisplayList + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Display_FullScreen Far + + Cmp NumWindows, 1 + JE Display_FullScreen1 + + Mov AX, 1 + Ret + +Display_FullScreen1: + Push Glbl + Pop ES + Assume ES:Glbl + Mov ES:CurrentMode, 5 + Assume ES:Nothing + + Xor FullScreen, 1 + + JZ Display_FullScreen2 + + Mov Byte Ptr [DisplayWindows+3], 1 + Mov DWord Ptr [DisplayWindows+4], 160*10000h+49 + +Display_FullScreen3: + Push Glbl + Pop ES + Assume ES:Glbl + Mov ES:CurrentMode, 200 + Assume ES:Nothing + + Mov AX, 5 + Mov SI, 1 + Mov CX, Object1 + + Mov DX, Offset O1_FullDisplayList + Ret + +Display_FullScreen2: + Mov Byte Ptr [DisplayWindows+3], 12 + Mov DWord Ptr [DisplayWindows+4], 12*80*2*65536+38 + +Display_FullScreen4: + Push Glbl + Pop ES + Assume ES:Glbl + Mov ES:CurrentMode, 5 + Assume ES:Nothing + + Mov AX, 5 + Mov SI, 1 + Mov CX, Object1 + + Mov DX, Offset O1_DisplayList + Ret + +EndP Display_FullScreen + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +IF SPECTRUMANALYSER + +Proc Display_FourierStart Far + + Jmp Fourier_Start + +EndP Display_FourierStart + +ENDIF + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +EndS + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +End diff --git a/IT_D_INF.INC b/IT_D_INF.INC new file mode 100644 index 0000000..4c2e52a --- /dev/null +++ b/IT_D_INF.INC @@ -0,0 +1,1126 @@ + + +Proc D_GetSongNameModuleType + + LEA DI, [SI+17] ; ES:DI points to deposit point. + Sub SI, 8 + + Cmp DWord Ptr [DS:60000], 'MPMI' + JNE D_GetSongNameModuleType1 + + Mov DX, [DS:60000+2Ah] + Mov AX, 3 + + Cmp DX, TRACKERVERSION + JA D_GSNMTImpulse1 + + Dec AX + Cmp DX, 214h + JB D_GSNMTImpulse1 + + Mov AX, 7 + +D_GSNMTImpulse1: + Mov Word Ptr [SI+23], AX + + Mov SI, 60004 + Mov CX, 25 + Rep MovsB + + Ret + +D_GetSongNameModuleType1: +; Cmp Word Ptr [DS:60028], 101Ah +; JNE D_GetSongNameModuleType2 + + Cmp DWord Ptr [DS:60044], 'MRCS' + JNE D_GetSongNameModuleType2 + + Mov Word Ptr [SI+23], 4 + + Mov SI, 60000 + Mov CX, 25 + Rep MovsB + + Ret + +D_GetSongNameModuleType2: + Push SI ES DI + + Push CS + Pop ES + Mov SI, 60000 + Mov DI, Offset XMIdentification + Mov CX, 17 + RepE CmpsB + + Pop DI ES SI + JNE D_GetSongNameModuleTypeNotXM + + Mov Word Ptr [SI+23], 5 ; XM + + Mov SI, 60000+17 + Mov CX, 20 + Rep MovsB + Xor AX, AX +; Mov CX, 5 +; Rep StosB + Ret + +D_GetSongNameModuleTypeNotXM: + Mov AX, [DS:60000] + Cmp AX, 'fi' + JE D_GetSongNameModuleType669 + Cmp AX, 'NJ' + JNE D_GetSongNameModuleTypeNot669 + +D_GetSongNameModuleType669: ; We have a 669 module! + Mov Word Ptr [SI+23], 6 ; 669 + Mov SI, 60000+2 + Mov CX, 25 + Rep MovsB + Ret + +D_GetSongNameModuleTypeNot669: + Mov EAX, [DS:61080] + + Cmp EAX, '.K.M' + JNE D_GetSongNameModuleType3 + + Mov Word Ptr [SI+23], 9 + Jmp D_GSNMTMod + +D_GetSongNameModuleType3: + Cmp EAX, '!K!M' + JNE D_GetSongNameModuleType4 + + Mov Word Ptr [SI+23], 10 + Jmp D_GSNMTMod + +D_GetSongNameModuleType4: + Cmp EAX, 'NHC4' + JNE D_GetSongNameModuleType5 + + Mov Word Ptr [SI+23], 11 + Jmp D_GSNMTMod + +D_GetSongNameModuleType5: + Cmp EAX, 'NHC6' + JNE D_GetSongNameModuleType6 + + Mov Word Ptr [SI+23], 12 + Jmp D_GSNMTMod + +D_GetSongNameModuleType6: + Cmp EAX, 'NHC8' + JNE D_GetSongNameModuleType11 + + Mov Word Ptr [SI+23], 13 + Jmp D_GSNMTMod + +D_GetSongNameModuleType11: + Cmp Word Ptr [DS:61082], 'HC' + JNE D_GetSongNameModuleType7 + Cmp AL, '0' + JB D_GetSongNameModuleType7 + Cmp AL, '9' + JA D_GetSongNameModuleType7 + Cmp AH, '0' + JB D_GetSongNameModuleType7 + Cmp AH, '9' + JA D_GetSongNameModuleType7 + + ; Generic MOD type. + Sub AX, '00' + Mov BL, AH + Mov AH, 10 + Mul AH + Add BL, AL + Mov Word Ptr [SI+23], 17 + Mov Byte Ptr [SI+22], BL + + Jmp D_GSNMTMod + + +D_GetSongNameModuleType7: + Cmp EAX, '4TLF' + JNE D_GetSongNameModuleType8 + + Mov Word Ptr [SI+23], 14 + Jmp D_GSNMTMod + +D_GetSongNameModuleType8: +; Cmp EAX, '8TLF' +; JNE D_GetSongNameModuleType9 +; +; Mov Word Ptr [SI+23], 15 +; Jmp D_GSNMTMod +; +; D_GetSongNameModuleType9: + Cmp Byte Ptr [DS:60000+471], 78h + JNE D_GetSongNameModuleType10 + + Mov Word Ptr [SI+23], 16 + Jmp D_GSNMTMod + +D_GetSongNameModuleType10: + Cmp Word Ptr [DS:60000], 'M'+256*'T' + JNE D_GetSongNameModuleType12 + Cmp Byte Ptr [DS:60002], 'M' + JNE D_GetSongNameModuleType12 + + Mov Word Ptr [SI+23], 18 + + Mov SI, 60004 + Mov CX, 20 + Rep MovsB + Mov CX, 5 + Xor AL, AL + Rep StosB + +D_GetSongNameModuleType12: + Mov Word Ptr [SI+23], 1 + + Ret + +D_GSNMTMod: + Mov SI, 60000 + Mov CX, 20 + Rep MovsB + Xor AX, AX + StosW + StosW + StosB + + Ret + +EndP D_GetSongNameModuleType + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_GetInstrumentInfo ; Instrument layout + ; 48 bytes per instrument. + ; Offset 0 = type of file. + ; 0 = Unchecked + ; 1 = Directory + ; 2 = Unrecognised + ; 3 = ITI + ; 4 = XI + ; 8 = .IT + ; 9 = .XM + ; Offset 1 = file name + ; 15->40 is the instrument name, + ; 40 = No. Samples + ; 42 = File size. + ; 44 = file offset (DWord) + + Mov AX, 48 + Mul BX + Mov DI, AX + + Mov DS, CS:DiskDataArea + Mov SI, 60000 + + ; Check for XM + Push CS + Pop ES + +; Comment ~ + + Push DI + Mov DI, Offset XMIdentification + Mov CX, 17 + RepE CmpSB + Pop DI + + Mov AL, 9 + JE D_InModuleInstrument ; XM module found? + + Mov SI, 60000 + + Cmp DWord Ptr [SI], 'MPMI' ; Impulse Tracker module? + JNE D_GetInstrumentInfoNotIT + Cmp Word Ptr [SI+22h], 0 + JE D_GetInstrumentInfoNotIT + Test Byte Ptr [SI+2Ch], 4 ; Instrument mode? + JZ D_GetInstrumentInfoNotIT + + Mov AL, 8 + +D_InModuleInstrument: + Push DS + Pop ES + + StosB + Add DI, 14 + Push CS + Pop DS + Mov SI, Offset LibraryMsg + Mov CX, 25 + Rep MovsB + Xor AX, AX + + Ret + +D_GetInstrumentInfoNotIT: +; ~ + + Cmp DWord Ptr [SI], 'IPMI' + JNE D_GetInstrumentInfo1 + + Push DS + Pop ES + Mov Byte Ptr [DI], 3 + + Mov AL, [SI+1Eh] + Xor AH, AH + + Add DI, 15 + Add SI, 20h + Mov CX, 25 + Rep MovsB + + StosW ; NOS. + + ClC + Ret + +D_GetInstrumentInfo1: ; Check for XI + Push DI + + Mov DI, Offset XIIdentification + Mov CX, 21 + RepE CmpsB + + Pop DI + JNE D_GetInstrumentInfo2 + +D_GetInstrumentInfoXI: + Push DS + Pop ES + + Mov Byte Ptr [DI], 4 ; XI + Add DI, 15 + Mov CX, 22 + Rep MovsB + Xor AX, AX + StosW + StosB + Mov AX, [DS:60000+128h] ; AX = number of samples + StosW ; NoS + Ret + +D_GetInstrumentInfo2: + Push DS + Pop ES + + Mov SI, DI + Mov CX, 48 + Mov AX, CS:NumInstruments + Sub AX, BX + Add SI, CX + Mul CX + Mov CX, AX + Rep MovsB + + Push CS + Pop DS + Assume DS:Disk + + Dec NumInstruments + + Mov AX, CurrentInstrument + Cmp AX, NumInstruments + JAE D_GetInstrumentInfo3 + + Cmp AX, BX + JBE D_GetInstrumentInfoEnd + +D_GetInstrumentInfo3: + Sub AX, 1 + AdC AX, 0 + +D_GetInstrumentInfoEnd: + Mov CurrentInstrument, AX + + StC + Ret + +EndP D_GetInstrumentInfo + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_GetSampleInfo ; BX = sample num. + + Mov AX, 96 + Mul BX + Mov DI, AX + Mov BX, AX + Mov DS, CS:DiskDataArea + Mov SI, 60000 + Push DS + Pop ES ; ES:DI points to sample block + ; DS:SI points to header + + Mov Byte Ptr [BX+90], 2 ; Recognised sample default. + + Cmp DWord Ptr [DS:60000], 'SPMI' + JE D_GetSampleInfo1 ; Possibly a IT sample. + Cmp DWord Ptr [DS:60000+4Ch], 'SRCS' + JE D_GetSampleInfo4 + Cmp DWord Ptr [DS:60000], 'FFIR' + JE D_GetSampleInfo8 ; AIFF? + Cmp DWord Ptr [DS:60000], 'MROF' + JE D_GetSampleInfo13 + + Mov AL, 21h + Cmp DWord Ptr [DS:60000], 'MPMI' + JE D_GetSampleInfoModuleTypes1 + + Mov AL, 23h + Cmp DWord Ptr [DS:60000+44], 'FMTP' + JE D_GetSampleInfoModuleTypes1 + + Inc AX ; AL = 24h + Mov ECX, [DS:60000] + And ECX, 0FFFFFFh + Cmp ECX, 'M'*10000h+'T'*100h+'M' + JE D_GetSampleInfoModuleTypes1 + + Inc AX ; AL = 25h + Cmp Word Ptr [DS:60000], 'fi' + JE D_GetSampleInfoModuleTypes1 + Cmp Word Ptr [DS:60000], 'NJ' + JE D_GetSampleInfoModuleTypes1 + + Inc AX ; AL = 26h + Cmp DWord Ptr [DS:60000], 'þRAF' + JE D_GetSampleInfoModuleTypes1 + + Mov ECX, [DS:60000+1080] + Mov AX, 427h ; MOD Module + 4 channels + Cmp ECX, '.K.M' + JE D_GetSampleInfoModuleTypes1 + Cmp ECX, '!K!M' + JE D_GetSampleInfoModuleTypes1 + Cmp ECX, '4TLF' + JE D_GetSampleInfoModuleTypes1 + Cmp ECX, 'NHC4' + JE D_GetSampleInfoModuleTypes1 + + Mov AH, 6 ; 6 Channel + Cmp ECX, 'NHC6' + JE D_GetSampleInfoModuleTypes1 + + Mov AH, 8 + Cmp ECX, 'NHC8' + JE D_GetSampleInfoModuleTypes1 + Cmp ECX, '8TLF' + JE D_GetSampleInfoModuleTypes1 + + Cmp Word Ptr [DS:61082], 'HC' + JNE D_GetSampleInfoS3M + + Sub CX, '00' + Cmp CL, 9 + JA D_GetSampleInfoS3M + Cmp CH, 9 + JA D_GetSampleInfoS3M + Mov AL, 10 + Mul CL + Add AL, CH + Mov AH, AL + Mov AL, 28h + Jmp D_GetSampleInfoModuleTypes1 + +D_GetSampleInfoS3M: + Cmp DWord Ptr [DS:60000+2Ch], 'MRCS' + JNE D_GetSampleInfoModuleTypes3 + + Mov AL, 20h ; ST3? + Jmp D_GetSampleInfoModuleTypes1 +; Cmp Word Ptr [DS:60000+1Ch], 101Ah +; JE D_GetSampleInfoModuleTypes1 +; Jmp D_GetSampleInfoModuleTypes3 + +D_GetSampleInfoModuleTypes3: ; KRZ + Cmp DWord Ptr [DS:60000], 'MARP' + JNE D_GetSampleInfoNotKRZ + + Cmp Word Ptr [DS:60000+32], 0FFFFh + JNE D_GetSampleInfoNotKRZ + + ; Check filename for .KRZ + + LEA SI, [BX+4] + Mov CX, 9 + +D_CheckKRZFileName: + Cmp Byte Ptr [SI], 0 + JE D_GetSampleInfoNotKRZ + + Cmp DWord Ptr [SI], 'ZRK.' + JE D_FoundKRZ + + Inc SI + Loop D_CheckKRZFileName + Jmp D_GetSampleInfoNotKRZ + +D_FoundKRZ: + Mov AL, 29h + Jmp D_GetSampleInfoModuleTypes1 + +D_GetSampleInfoNotKRZ: ; FT2 check + Push SI + Push ES + Push DI + + Push CS + Pop ES + Mov DI, Offset GUSPATIdentification + Mov CX, 22 + RepE CmpsB + + Pop DI + Pop ES + Pop SI + JNE D_GetSampleInfoNotPAT + + Cmp Byte Ptr [DS:60000+198], 1 + JE G_GetSampleInfoPAT + + Mov AL, 2Ah + Jmp D_GetSampleInfoModuleTypes1 + +G_GetSampleInfoPAT: + Mov Byte Ptr [BX+88], 16 + + Mov EAX, 'SPMI' + StosD + Mov SI, DI + Add DI, 13 + Mov AL, 64 + StosB ; Global vol = 64 + + Mov AX, 4001h ; sample present + Mov DL, [DS:60000+239+55] ; modes + + Test DL, 1 ; 8/16 bit + JZ GetSampleInfoPATSamples2 + + Or AL, 2 + +GetSampleInfoPATSamples2: + Test DL, 4 ; Looping enabled? + JZ GetSampleInfoPATSamples3 + + Or AL, 10h + +GetSampleInfoPATSamples3: + Test DL, 8 ; Ping pong loops? + JZ GetSampleInfoPATSamples4 + + Or AL, 40h + +GetSampleInfoPATSamples4: + StosW ; OK.. now for name. + + Mov SI, 60000+131 + Mov CX, 16 + +GetSampleInfoPATSamples5: + LodsB + Test AL, AL + JZ GetSampleInfoPATSamples6 + StosB + Loop GetSampleInfoPATSamples5 + + Xor AL, AL + +GetSampleInfoPATSamples6: + Add CX, 10 + Rep StosB + + ; Convert, default pan + + Mov AH, 32 + Mov AL, [DS:60000+239+55] + And AL, 2 + ShR AL, 1 + Xor AL, 1 + StosW + + ; Length. + + Mov DL, [DS:60000+239+55] + + Mov EAX, [DS:60000+239+16] ; LoopEnd -> FileSize + Mov [DI+20h], EAX ; File size + Call StorePATLength + + Mov EAX, [DS:60000+239+12] ; LoopBeg + Call StorePATLength + Mov EAX, [DS:60000+239+16] ; LoopEnd + Call StorePATLength + + Mov AX, [DS:60000+239+20] + And EAX, 0FFFFh + +Comment ~ + Push ES DI + + Call Music_GetPitchTable ; Returns ES:DI + Mov BP, [DS:60000+239+56] + And BP, 0FFh + ShL BP, 2 + Mul DWord Ptr [ES:DI+BP] + SHRD EAX, EDX, 16 + + Pop DI ES +~ + StosD ; C5Spd + + Xor EAX, EAX + StosD + StosD + + Mov EAX, 14Fh + StosD + + Xor AX, AX + StosW + StosW + + Ret + + +D_GetSampleInfoNotPAT: + Push SI + Push ES + Push DI + + Push CS + Pop ES + Mov DI, Offset XMIdentification + Mov CX, 17 + RepE CmpsB + + Pop DI + Pop ES + Pop SI + JNE TXWaveSampleIdentification + + Mov AL, 22h ; FT2 + +D_GetSampleInfoModuleTypes1: + Mov Word Ptr [BX+88], AX + Mov Byte Ptr [BX+90], 1 + + Push DS + + Push CS + Pop DS + + Mov SI, Offset LibraryMsg + LEA DI, [BX+14h] + Mov CX, 26/2 + Rep MovsW + + Pop DS + Ret + +TXWaveSampleIdentification: + Push SI + Push ES + Push DI + + Push CS + Pop ES + Mov DI, Offset TXWaveIdentification + Mov CX, 16 + RepE CmpSB + + Pop DI + Pop ES + Pop SI + ; OK.. have a TX Wave. + ; Now to transfer data. + JNE D_GetSampleInfo2 + + Mov AL, [DS:60000+16h] + And AL, 7Fh + Cmp AL, 49h + JNE D_GetSampleInfo2 + + Mov Byte Ptr [BX+88], 13 + + Mov EAX, 'SPMI' + StosD + Mov SI, DI + Add DI, 13 + Mov AL, 64 + StosB ; Global vol = 64 + + Mov AX, 64*256+1+2 ; Flag = sample + 16 bit + ; Default volume = 64 + Cmp Byte Ptr [DS:60000+16h], 049h + JNE D_GetTXInfo3 + + Or AL, 10h ; Loop forwards + +D_GetTXInfo3: + StosW + + Mov CX, 13 + +D_GetTXInfo1: + LodsB + Test AL, AL + JZ D_GetTXInfo2 + + StosB + Loop D_GetTXInfo1 + +D_GetTXInfo2: + Xor AL, AL + Rep StosB + + Mov CX, 13 + Rep StosB + ; Length... + Mov AX, 16+1 ; TX Wave, signed + StosW + + Mov EDX, [DS:60000+18h] + Mov ECX, [DS:60000+1Bh] + And EDX, 1FFFFh ; Attack length + And ECX, 1FFFFh ; Loop Length + + Mov EAX, ECX + Add EAX, EDX ; Length + StosD + Mov EAX, EDX ; LoopStart + StosD + Add EAX, ECX ; LoopEnd + StosD + + Mov EAX, 33000 ; Freq + Cmp Byte Ptr [DS:60000+17h], 2 + JB D_GetTXInfo4 + + Mov AX, 50000 + JE D_GetTXInfo4 + + Mov AX, 16000 + +D_GetTXInfo4: + StosD ; Frequency + Xor EAX, EAX + StosD + StosD + Mov AX, 20h + StosD + Xor AX, AX + StosD + + Ret + +D_GetSampleInfo2: + Mov DWord Ptr [BX+88], 30004h ; Unknown Type + + Mov EAX, 'SPMI' + StosD + Mov SI, DI + Add DI, 13 + Mov AL, 64 + StosB ; Global vol = 64 + Mov AL, 1 + StosB ; Flag = sample. + Mov AL, 64 + StosB ; Default vol = 64. + + Mov CX, 13 + +D_GetSampleInfo6: + LodsB + Test AL, AL + JZ D_GetSampleInfo7 + + StosB + Loop D_GetSampleInfo6 + +D_GetSampleInfo7: + Xor AL, AL + Rep StosB + + Mov CX, 15 + Rep StosB + ; Length... + Mov EAX, 4177910 + + Cmp EAX, [BX+80] + JB D_GetSampleInfo3 + + Mov EAX, [BX+80] + +D_GetSampleInfo3: + StosD + Xor AX, AX + StosW + StosW + StosW + StosW + Mov AX, 8363 + StosW + Xor AX, AX + Mov CX, 9 + Rep StosW + + Ret + +D_GetSampleInfo1: + Mov Byte Ptr [BX+88], 2 + + Mov CX, 4 + Rep MovsB + Add SI, 12 + Add DI, 12 + Mov CX, 64 + Rep MovsB + + Ret + +D_GetSampleInfo4: + Mov Byte Ptr [BX+88], 3 ; Scrm + + Mov EAX, 'SPMI' + StosD + + Add DI, 13 + Mov AL, 64 + StosB + + Mov AL, 1 + Mov CL, [DS:60000+1Fh] + Mov CH, CL + + And CL, 1 + ShL CL, 4 + Or AL, CL ; Loop... + + And CH, 4 + ShR CH, 1 + Or AL, CH ; 16 bit. + +D_GetSampleInfo5: + StosB + Mov AL, [DS:60000+1Ch] + StosB + Mov SI, 60000+30h + Mov CX, 25 + Rep MovsB + Xor AX, AX + StosB + StosW ; Name done... now for length + + Mov EAX, [DS:60000+10h] + StosD + Mov EAX, [DS:60000+14h] + StosD + Mov EAX, [DS:60000+18h] + StosD + Mov EAX, [DS:60000+20h] ; C5Spd + StosD + Xor AX, AX + StosW + StosW + StosW + StosW + ; Now for sample pointer. + Mov CL, 4 + Mov AX, [DS:60000+0Eh] + Mov DL, [DS:60000+0Fh] + Mov DH, [DS:60000+0Dh] + ShL AX, CL + ShR DX, CL + StosW ; Sample pointer in file. + Mov AX, DX + StosW + + Xor AX, AX ; Vibrato info + StosW + StosW + + Ret + +D_GetSampleInfo8: ; WAV Identification + Push SI + Push DI + Push DS + + Push CS + Pop DS + Mov SI, Offset WAVEfmtID + Mov DI, 60008 + Mov CX, 8 + RepE CmpsB + JNE NotWAV + + Add DI, 2 + Mov CX, 4 + RepE CmpsB + +NotWAV: + Pop DS + + JNE D_GetSampleInfo9 + + Mov BP, 60000+18h + Add BP, [DS:60000+10h] + Mov CX, 3 ; Only allow 3 blocks + +CheckNextWAVE: + Cmp DWord Ptr [DS:BP-4], 'atad' + JE D_GetSampleWaveFound + + Mov AX, [DS:BP] + Add AX, 8 + Add BP, AX + JC D_GetSampleInfo9 + + Loop CheckNextWAVE + Jmp D_GetSampleInfo9 + +D_GetSampleWaveFound: + Mov DL, [DS:60000+22h] ; DL = number of bits. + Mov DH, 1 + Cmp DL, 8 + JE D_GetSampleInfo9 + + Mov DH, 3 + Cmp DL, 16 + +D_GetSampleInfo9: + Pop DI + Pop SI + JNE D_GetSampleInfo2 + ; We have a WAV file! + Cmp Word Ptr [DS:60000+16h], 2 + JNE D_GetSampleWAVStereo + + Or DH, 4 + +D_GetSampleWAVStereo: + Mov AL, DH + And AL, 3 + Add AL, 4 + Mov Byte Ptr [BX+88], AL ; 5 = 8 bit, 7 = 16 bit. + + Mov EAX, 'SPMI' + StosD + + Mov SI, DI + Add DI, 13 + Mov AL, 64 + StosB ; Global vol = 64 + Mov AL, DH + StosB ; Flag = sample. + Mov AL, 64 + StosB ; Default vol = 64. + + Mov CX, 13 + +D_GetSampleInfo10: + LodsB + And AL, AL + JZ D_GetSampleInfo11 + + StosB + Loop D_GetSampleInfo10 + +D_GetSampleInfo11: + Xor AX, AX + Add CX, 13 + Rep StosB + + Mov AL, DH + And AL, 4 ; stereo? + ShL AL, 3 + + Test DH, 2 + JZ D_GetSampleInfo19 + + Inc AX + +D_GetSampleInfo19: + StosW ; Sample format + + Mov EAX, 4177910 ; Length + + Cmp EAX, [DS:BP] + JB D_GetSampleInfo12 + + Mov EAX, [DS:BP] + +D_GetSampleInfo12: + Test DH, 2 + JZ D_GetSampleInfo18 + + ShR EAX, 1 + +D_GetSampleInfo18: + Test DH, 4 + JZ D_GetSampleWAVStereo2 + + ShR EAX, 1 + +D_GetSampleWAVStereo2: + StosD + + Xor AX, AX + StosW + StosW + StosW + StosW + + Mov AX, [DS:60000+18h] ; Frequency + StosW + Xor AX, AX + Mov CX, 5 + Rep StosW + Mov AX, BP + Add AX, 4-60000 +; Mov AX, 2Ch + StosW + Xor AX, AX + StosW + StosW + StosW + + Ret + +D_GetSampleInfo13: ; AIFF Identification + Mov AL, 3 + Cmp DWord Ptr [DS:60000+8], 'VS61' + JE D_GetSampleInfoIFF + + Mov AL, 1 + Cmp DWord Ptr [DS:60000+8], 'XVS8' + JNE D_GetSampleInfo2 + +D_GetSampleInfoIFF: + Mov Byte Ptr [BX+88], 17 ; AIFF format. + Mov Byte Ptr [BX+12h], AL + Mov SI, 60000 + 0Ch + +D_GetSampleInfoIFF1: + Cmp DWord Ptr [DS:SI], 'EMAN' + JE D_GetSampleInfoIFFName + + Cmp DWord Ptr [DS:SI], 'RDHV' + JE D_GetSampleInfoIFFHeader + + Cmp DWord Ptr [DS:SI], 'YDOB' + JNE D_IFFHeaderNext + + ; Body. + Mov DWord Ptr [DI], 'SPMI' + Mov Byte Ptr [DI+11h], 64 ; Global volume + Mov Byte Ptr [DI+13h], 64 ; Default volume + Mov Word Ptr [DI+2Eh], 1 ; Sign conversion + + Add DI, 30h + Mov AX, [SI+06h] ; Size + Mov DX, [SI+04h] + Call Near Ptr D_GetSampleInfoBSwap + StosD + Xor EAX, EAX + Add DI, 0Ch + StosD + StosD + StosD + StosD + + Add SI, 8-60000 + Mov [BX+48h], SI + + Ret + +D_GetSampleInfoIFFName: + Push SI + Push DI + + Mov CX, [SI+6] + XChg CL, CH + Cmp CX, 25 + JBE D_GetSampleInfoIFFName1 + + Mov CX, 25 + +D_GetSampleInfoIFFName1: + Add SI, 8 + Add DI, 14h + Rep MovsB + +D_IFFHeaderEnd: + Pop DI + Pop SI + +D_IFFHeaderNext: + Mov AX, [SI+6] + XChg AL, AH + Add AX, 8 + Add SI, AX + JC D_GetSampleInfo2 + + Jmp D_GetSampleInfoIFF1 + +D_GetSampleInfoIFFHeader: + Push SI + Push DI + + Add DI, 34h + + Mov AX, [SI+0Eh] ; Loop start + Mov DX, [SI+0Ch] + Call Near Ptr D_GetSampleInfoBSwap + StosD + + Push EAX + Mov AX, [SI+12h] ; Loop end + Mov DX, [SI+10h] + Call Near Ptr D_GetSampleInfoBSwap + Test EAX, EAX + JZ D_GetSampleInfoIFFHeader1 + + Or Byte Ptr [BX+12h], 16 + +D_GetSampleInfoIFFHeader1: + Pop EDX + Add EAX, EDX + StosD + + Xor EAX, EAX + Mov AX, [SI+14h] + XChg AL, AH + StosD + + Jmp D_IFFHeaderEnd + +D_GetSampleInfoBSwap: + XChg DH, AL + XChg DL, AH + + ShL EAX, 16 + Mov AX, DX + + Test Byte Ptr [BX+12h], 2 + JZ D_GetSampleInfo17 + + ShR EAX, 1 ; Halve length for 16-bit samples. + +D_GetSampleInfo17: + RetN + +EndP D_GetSampleInfo + diff --git a/IT_D_RI.INC b/IT_D_RI.INC new file mode 100644 index 0000000..f4376ba --- /dev/null +++ b/IT_D_RI.INC @@ -0,0 +1,771 @@ +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ +; +; Load Instrument module +; +; Instrument in .ITI format has to be placed at DS:64000 +; Sample headers have to be placed at DS:0 +; +; +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LoadITInstrument + + Mov DX, 64000 + Mov CX, 554 ; Length of instrument header + Mov AH, 3Fh + Int 21h + + Cmp Word Ptr [DS:64000+1Ch], 200h + JAE LoadITInstrument1 + + Mov SI, DX + Call ConvertOldInstrument + +LoadITInstrument1: + Mov AX, [DS:64000+1Eh] ; AX = number of samples + Mov DX, 80 + Mul DX ; Clears DX, AX = size in bytes + Mov CX, AX + +; Xor DX, DX +; Mov CX, DI + JCXZ LoadITInstrument2 + + Mov AH, 3Fh + Int 21h ; All sample headers are loaded too. + ; Step 2 done. + +LoadITInstrument2: + Ret + +EndP LoadITInstrument + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +InstrumentNameOffset DW 0 +XISampleOffset DD 0 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LoadXIInstrument ; Must preserve DS, BX + + Push DS + Pop ES + + Mov DX, 63000 + Mov CX, 298 ; Length of instrument header + Mov AH, 3Fh + Int 21h + + Mov AX, [DS:63000+296] ; NoS + Mov CS:NumInstrumentSamples, AX + Mov CS:InstrumentNameOffset, 63000+21 + Mov CS:XISampleOffset, 298 + + ; Now to transfer data across + ; to 64000 in ITI format +LoadXIChain: + Mov DI, 64000 + Mov EAX, 'IPMI' ; Header + StosD + + Xor AX, AX + Mov CX, 8 + Rep StosW ; Filename, NNA, DCA, DCT + + Mov AX, [DS:63000+272] + Add AX, 15 + ShR AX, 5 + Cmp AX, 256 + JB LoadXIInstrumentFdOut + + Mov AX, 256 + +LoadXIInstrumentFdOut: + StosW ; Fadeout + + Mov AX, 60*256 + StosW ; PPC and PPS + Mov AX, 128+32*256 + StosW ; GBV and DfP + Xor AX, AX + StosW + StosW + Mov AX, CS:NumInstrumentSamples + StosW + Xor AX, AX + + Mov SI, CS:InstrumentNameOffset + Mov CX, 22/2 + Rep MovsW + Mov CX, 5 + Rep StosW ; Clear up end of inst name + + ; Translation table + Mov CX, 12 ; First 12 entries empty + Xor AX, AX + +LoadXIInstrument1: + StosW + Inc AX + Loop LoadXIInstrument1 + + Mov SI, 63000+66 + Mov CX, 96 + +LoadXIInstrument2: + Mov AH, [SI] + Inc AH + StosW + + Inc AX + Inc SI + Loop LoadXIInstrument2 + + Mov CX, 12 ; Last 12 entries empty + Xor AH, AH + +LoadXIInstrument3: + StosW + Inc AX + Loop LoadXIInstrument3 + + ; Now for volume envelope + Mov AL, [DS:63000+266] ; Flags + Mov CL, AL + Mov AH, AL + And AX, 402h + ShR AH, 1 + ShL AL, 1 + Or AL, AH + And CL, 1 + Or AL, CL + + Mov AH, [DS:63000+258] ; No of vol env nodes + Cmp AH, 12 + JB NumXIVolNodes1 + + Mov AH, 12 + +NumXIVolNodes1: + StosW + Mov AX, [DS:63000+261] ; Vol loop start+end + StosW + Mov AL, [DS:63000+260] ; Vol Sustain point + Mov AH, AL + StosW + + ; OK. now process volume env points + Mov CX, 12 + +LoadXIInstrument4: + Mov AL, [SI+2] + Cmp AL, 64 + JB LoadXICheckVolBound1 + + Mov AL, 64 + +LoadXICheckVolBound1: + StosB + MovsW + LodsW + Loop LoadXIInstrument4 + + Mov CX, 13*3+1 + Xor AX, AX + Rep StosB + + ; Now for panning envelope + +LoadXIInstrument5: + Mov AL, [DS:63000+267] ; Flags + Mov CL, AL + Mov AH, AL + And AX, 402h + ShR AH, 1 + ShL AL, 1 + Or AL, AH + And CL, 1 + Or AL, CL + + Mov AH, [DS:63000+259] ; No of pan env nodes + Cmp AH, 12 + JB NumXIPanNodes1 + + Mov AH, 12 + +NumXIPanNodes1: + StosW + Mov AX, [DS:63000+264] ; Pan loop start+end + StosW + Mov AL, [DS:63000+263] ; Pan Sustain point + Mov AH, AL + StosW + + ; OK. now process panning env points + Mov CX, 12 + Xor AH, AH + +LoadXIInstrument6: + Mov AL, [SI+2] + Cmp AL, 64 + JB LoadXICheckPanBound + + Mov AL, 64 + +LoadXICheckPanBound: + Sub AL, 32 + StosB + MovsW + LodsW ; Add SI, 2 + Loop LoadXIInstrument6 + + Mov CX, 13*3+1 + Xor AX, AX + Rep StosB + + ; Now for pitch envelope + Mov AX, 2*256 ; 2 node points + StosW + Xor AX, AX + StosW + StosW + + ; First node is 0, 0, second node is 0, 99 + StosW + StosW + Mov AX, 99 + StosW + + Mov CX, 75-6 + Xor AX, AX + Rep StosB + + Cmp Byte Ptr [DS:64000+131h], 2 + JAE LoadXIInstrumentVolEnvelopeCheck1 + + Mov Byte Ptr [DS:64000+131h], 2 + Mov Word Ptr [DS:64000+136h], 64 + Mov Word Ptr [DS:64000+138h], 64*256 + Mov Word Ptr [DS:64000+13Ah], 100 + +LoadXIInstrumentVolEnvelopeCheck1: + + Cmp Byte Ptr [DS:64000+183h], 2 + JAE LoadXIInstrumentPanEnvelopeCheck1 + + Mov Byte Ptr [DS:64000+183h], 2 + Xor AX, AX + Mov [DS:64000+188h], AX + Mov [DS:64000+18Ah], AX + Mov Word Ptr [DS:64000+18Ch], 100 + +LoadXIInstrumentPanEnvelopeCheck1: + + ; OK. instrument done. + ; Now have to load samples + ; Bytes to load = 40*NoS + Mov AX, 40 + Mul Word Ptr [DS:64000+1Eh] + Mov CX, AX + + Mov DX, 62000 + Mov AH, 3Fh + Int 21h + + Mov EDX, CS:XISampleOffset ; EDX = offset in file + Add DX, CX + + Xor DI, DI + Mov SI, 62000 + Mov CX, [DS:64000+1Eh] + +LoadXISample1: + Push CX + + Mov EAX, 'SPMI' + StosD + Xor AX, AX + Mov CX, 6 + Rep StosW + Mov AX, 64*256 + StosW + ; Flg +LoadXISample2: + Mov AH, [SI+12] ; Default volume + Mov AL, 0 + Cmp DWord Ptr [SI], 0 ; Length = 0? + JE LoadXISample4 + + Mov AL, 1 + + Mov CL, [SI+14] + Test CL, 10h + JZ LoadXISample3 + + Or AL, 2 ; 16-bit sample + +LoadXISample3: + And CL, 3 + JZ LoadXISample4 ; No loop + ; CL = 1 or 2 + Cmp DWord Ptr [SI+8], 1 + JBE LoadXISample4 + + Or AL, 10h ; Loop + Dec CX + ShL CL, 6 + Or AL, CL + +LoadXISample4: + StosW + + Push SI + ; Copy sample name + Add SI, 18 + Mov CX, 22/2 + Rep MovsW + Xor AX, AX + StosW + StosW + + Pop SI + ; Conversion flags, default pan + Mov AL, 5 + Mov AH, [SI+15] ; Pan + ShR AH, 2 + AdC AH, 80h + StosW + + Mov EAX, [SI] + Call LoadXISample5 + Mov EAX, [SI+4] + Call LoadXISample5 + Mov EAX, [SI+4] + Add EAX, [SI+8] + Call LoadXISample5 + + ; C5speed.. + Push ES + Push DI + + Call Music_GetPitchTable ; Returns ES:DI + Mov AL, [SI+16] ; Relative note number + Add AL, 60 ; AL = note multiplier + And AX, 0FFh + ShL AX, 2 + Add DI, AX + Mov ECX, [ES:DI] + + Mov AL, [SI+13] ; Finetune, -128->+127 + SAR AL, 4 ; Finetune = -8->+7 + And AX, 0Fh + Add AX, AX + Mov DI, AX + MovZX EAX, [CS:FineTuneTable+DI] + + Pop DI + Pop ES + + Push EDX + + Mul ECX + ShRD EAX, EDX, 16 + Pop EDX + StosD ; C5freq + + Xor AX, AX + StosW + StosW + StosW + StosW + + Mov EAX, EDX + Add EDX, [SI] + StosD + Xor AX, AX + StosW + StosW + + Pop CX + Add SI, 40 + Loop LoadXISample1 + + Ret + +LoadXISample5: + Cmp EAX, 4177910 + JB LoadXISample6 + + Mov EAX, 4177910 +LoadXISample6: + Test Byte Ptr [SI+14], 10h + JZ LoadXISample7 + + ShR EAX, 1 + +LoadXISample7: + StosD + RetN + +EndP LoadXIInstrument + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LoadInITInstrument + + Mov AH, 3Fh + Mov CX, 2000 + Mov DX, 62000 + Int 21h ; Read header into 62000 + + Mov AX, 4200h + Mov CX, Word Ptr [CS:LoadInstrumentOffset+2] + Mov DX, Word Ptr [CS:LoadInstrumentOffset] + Int 21h ; Goto location + + Mov AH, 3Fh ; Load instrument data + Mov CX, 554 + Mov DX, 64000 + Int 21h + + Cmp Word Ptr [DS:62000+2Ah], 200h + JAE LoadInITInstrument1 + + Mov SI, 64000 + Call ConvertOldInstrument + +LoadInITInstrument1: ; Convert Note table and load + ; Sample headers. + Mov SI, 64000+41h + Xor CX, CX + +LoadInITInstrument2: + Mov DI, [SI] + And DI, 0FFh ; DI = sample number + JZ LoadInITInstrument3 + Cmp DI, [DS:62000+24h] ; Sample exists? + JA LoadInITInstrument3 + Cmp Byte Ptr [CS:InstrumentTable+DI], 0 + JNE LoadInITInstrument3 + + Inc CX ; CL = sample number + Mov [CS:InstrumentTable+DI], CL + + Push SI + Push CX + + Add DI, [DS:62000+22h] + ShL DI, 2 + Add DI, [DS:62000+20h] + Add DI, 62000+0C0h-4 ; Samples are 0 based, not 1 + + Mov AX, 4200h ; Move to offset of sample + Mov CX, [DI+2] + Mov DX, [DI] + Int 21h + + Pop AX + Push AX + + Dec AX + Mov CX, 80 + Mul CX + Mov DX, AX + + Mov AH, 3Fh + Int 21h ; Load sample header. + + Pop CX + Pop SI + +LoadInITInstrument3: + Add SI, 2 + Cmp SI, 64000+41h+120*2 + JB LoadInITInstrument2 + + Mov [DS:64000+1Eh], CX + + ; Process translation table + Mov SI, 64000+41h + +LoadInITInstrument4: + Mov DI, [SI] + And DI, 0FFh + Mov AL, [CS:InstrumentTable+DI] + Mov [SI], AL + + Add SI, 2 + Cmp SI, 64000+41h+120*2 + JB LoadInITInstrument4 + + Mov DI, Offset InstrumentTable + Xor AX, AX + Mov CX, 50 + Rep StosW + + Ret + +EndP LoadInITInstrument + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LoadInXMInstrument + + Mov AX, 4200h + Mov CX, Word Ptr [CS:LoadInstrumentOffset+2] + Mov DX, Word Ptr [CS:LoadInstrumentOffset] + Int 21h ; Goto location + + Mov AH, 3Fh + Mov CX, 4 + Mov DX, 63000 + Int 21h + + Mov AH, 3Fh + Mov CX, [DS:63000] + Sub CX, 4 + Mov DX, 63033+4 + Int 21h + + Mov AX, [DS:63033+27] + Mov CS:NumInstrumentSamples, AX + Mov CS:InstrumentNameOffset, 63033+4 + + Mov AX, 4201h + Xor CX, CX + Xor DX, DX + Int 21h ; DX:AX = fileoffset + + Mov Word Ptr [CS:XISampleOffset], AX + Mov Word Ptr [CS:XISampleOffset+2], DX + + Push DS + Pop ES + + Jmp LoadXIChain + +EndP LoadInXMInstrument + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc TransferInstrumentName + + Mov AX, 48 + Mul CS:NumInstruments + Inc CS:NumInstruments + + Mov DI, AX + + Push DS + + Push CS + Pop DS + + Mov AL, CL + StosB + Mov SI, Offset InInstrumentFileName + Mov CX, 14 + Rep MovsB + Mov EAX, LoadInstrumentOffset + Mov [ES:DI+44-15], EAX + + Pop DS + + Ret + +EndP TransferInstrumentName + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +; 'InstrumentTable' scratchpad + +LoadInstrumentOffset DD 0 +NumInstrumentSamples DW 0 + +Proc LoadITInModuleInstrument + + Mov AH, 3Fh + Mov CX, 2000 + Mov DX, 63000 + Int 21h + + Xor BP, BP + + Push ES + + Push CS ; Clear InstrumentTable + Pop ES + + Mov DI, Offset InstrumentTable + Mov CX, 100 + Xor AL, AL + Rep StosB + + Pop ES + +LoadITInModuleInstrument1: + Cmp BP, [DS:63000+22h] ; InsNum + JB LoadITInmoduleInstrument2 + + Ret + +LoadITInModuleInstrument2: + Mov SI, BP + ShL SI, 2 + + Inc BP + + Add SI, [DS:63000+20h] + Add SI, 63000+0C0h + + Mov AX, 4200h ; Move file pointer. + Mov CX, [SI+2] + Mov DX, [SI] + + Mov Word Ptr [CS:LoadInstrumentOffset], DX + Mov Word Ptr [CS:LoadInstrumentOffset+2], CX + + Int 21h + + Mov AH, 3Fh + Mov CX, 554 + Mov DX, 62000 + Int 21h + + Mov SI, 62000+41h + +LoadITInModuleInstrument3: + LodsW + And AX, 0FFh + Mov DI, AX + + Cmp AL, 100 + JAE LoadITInModuleInstrument5 + + Mov [CS:InstrumentTable+DI], 1 + +LoadITInModuleInstrument5: + Cmp SI, 62000+41h+120*2 + JB LoadITInModuleInstrument3 + + ; Now to count samples + ; and clear table. + Mov DI, 99 + Xor DX, DX ; DX = number of samples. + +LoadITInModuleInstrument4: + Cmp Byte Ptr [CS:InstrumentTable+DI], 1 + JNE LoadITInModuleInstrument6 + + Inc DX + Mov Byte Ptr [CS:InstrumentTable+DI], 0 + +LoadITInModuleInstrument6: + Dec DI + JNZ LoadITInModuleInstrument4 + + Test DX, DX + JZ LoadITInModuleInstrument1 + + Push DX + + Mov CL, 5 ; In-Module .IT Instrument + Call TransferInstrumentName + + Mov SI, 62000+20h + Mov CX, 25 + Rep MovsB + + Pop AX + StosW + Xor AX, AX + StosW + + Jmp LoadITInModuleInstrument1 + +EndP LoadITInModuleInstrument + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LoadXMInModuleInstrument + + Call LoadXMHeader ; Reads to first instrument + + Xor BP, BP + +LoadXMInModuleInstrument1: + Cmp BP, [DS:64000+72] + JB LoadXMInModuleInstrument2 + + Ret + +LoadXMInModuleInstrument2: + Inc BP + + Mov AX, 4201h + Xor CX, CX + Xor DX, DX + Int 21h ; Get current file location + + Mov Word Ptr [CS:LoadInstrumentOffset], AX + Mov Word Ptr [CS:LoadInstrumentOffset+2], DX + + Mov AH, 3Fh + Mov CX, 4 + Mov DX, 63000 + Int 21h ; Read instrument size field + + Mov AH, 3Fh + Mov CX, [DS:63000] + Sub CX, 4 + Mov DX, 63004 + Int 21h + + Mov AX, [DS:63000+27] ; Number of samples + Test AX, AX + JZ LoadXMInModuleInstrument1 + + Mov CX, 40 + Mul CX + Mov CX, AX + Mov AH, 3Fh + Mov DX, 62000 + Int 21h ; OK sample headers read + ; into DS:62000 + + Mov CL, 6 ; In-Module .XM Instrument + Call TransferInstrumentName + + Mov SI, 63004 + Mov CX, 22 + Rep MovsB + Xor AX, AX + StosB + StosW + + Mov AX, [DS:63000+27] + Mov CX, AX + StosW + Xor AX, AX + StosW + + Xor EDX, EDX + Mov SI, 62000 + +LoadXMInModuleInstrument3: + Add EDX, [SI] + Add SI, 40 + + Dec CX + JNZ LoadXMInModuleInstrument3 + + SHLD ECX, EDX, 16 + Mov AX, 4201h + Int 21h + ; Advance file pointers.. + Jmp LoadXMInModuleInstrument1 + +EndP LoadXMInModuleInstrument + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ diff --git a/IT_D_RIS.INC b/IT_D_RIS.INC new file mode 100644 index 0000000..9759404 --- /dev/null +++ b/IT_D_RIS.INC @@ -0,0 +1,1498 @@ +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ +; +; In-Module sample loaders have to place the information at Sample*96 bytes +; in ITS format into DiskDataArea. Provided with: +; BX = file handle, File at header section. +; DS, ES = DiskDataArea +; +; Variables to update: +; NumSamples (initialised to 1 before the call) +; +; Variables to use: +; InSampleDateTime (DWord) +; CS:InSampleFileName (13 bytes) +; +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SoftBSWAP ; EAX, returns EAX + + Push EDX + + SHLD EDX, EAX, 16 ; DX:AX contains value. + XChg DH, AL + XChg DL, AH ; DX:AX in proper order now + ShL EAX, 16 + SHRD EAX, EDX, 16 + + Pop EDX + Ret + +EndP SoftBSWAP + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc TransferFileName + + Mov EAX, 'SPMI' + StosD + + Push DS + + Push CS + Pop DS + Assume DS:Disk + + Mov EAX, InSampleDateTime + + Mov SI, Offset InSampleFileName + Mov CX, 13 + Rep MovsB + + Pop DS + Assume DS:Nothing + + Mov [DI+54h-11h], EAX ; Date. + + Ret + +EndP TransferFileName + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LoadMODSamplesInModule + + Mov AH, 3Fh + Mov CX, 1084 + Mov DX, 63000 + Int 21h + + Xor CX, CX + Mov SI, 63952 + Mov AX, 07F00h + + +LoadMODSamplesInModule1: + LodsB + Cmp CL, AL + JAE LoadMODSamplesInModule2 + + Mov CL, AL + +LoadMODSamplesInModule2: + Dec AH + JNZ LoadMODSamplesInModule1 + + Inc CX ; CX = number of patterns to + ; load + + Mov AL, CS:InSampleChannels + Mul CL ; AX = Chan * patterns + + And EAX, 0FFFFh + ShL EAX, 8 + Add EAX, 1084 + Mov EBP, EAX ; EBP = location of first sample + + Mov SI, 63020 ; First sample + Mov CX, 31 + +LoadMODSamplesInModule3: + Push CX + Push SI + + Mov CX, [SI+22] + XChg CH, CL + Cmp CX, 1 + JBE LoadMODSamplesInModule4 + + ; OK.. have a sample + Mov AX, 96 + Mul CS:NumSamples + Mov DI, AX + + Inc CS:NumSamples + + Mov Byte Ptr [DI+88], 14 + Push SI + Call TransferFileName + Pop SI + + Mov AL, 64 + StosB + + Mov AH, [SI+25] ; Default volume + Mov AL, 1 + + Mov CX, [DS:SI+28] + XChg CH, CL + Cmp CX, 1 + JBE LoadMODSamplesInModule5 + + Or AL, 16 + +LoadMODSamplesInModule5: + StosW + + Mov CX, 22 + Rep MovsB + Xor EAX, EAX + StosD + + Mov AX, 32*256+1 ; Convert signed->Unsigned + StosW ; Default pan of 32 + + Mov AX, [SI] + XChg AH, AL + Add EAX, EAX + Mov [DI+20h], EAX ; File size + StosD ; Sample length + + Push EAX + + MovZX EAX, Word Ptr [SI+4] + XChg AH, AL + Add EAX, EAX + StosD ; Loop begin + + MovZX ECX, Word Ptr [SI+6] + XChg CH, CL + Add ECX, ECX + Add EAX, ECX + StosD ; Loop end + + Mov AL, [SI+2] + And AX, 15 + Mov SI, AX + Add SI, SI + Mov AX, [CS:FineTuneTable+SI] + StosW + Xor AX, AX + Mov CX, 5 + Rep StosW + + Mov EAX, EBP + StosD + Xor EAX, EAX + StosD + + Pop EAX + Add EBP, EAX + +LoadMODSamplesInModule4: + Pop SI + Pop CX + + Add SI, 30 + Loop LoadMODSamplesInModule3 + + Ret + +EndP LoadMODSamplesInModule + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LoadS3MSamplesInModule + + Mov AH, 3Fh + Mov CX, 2000 + Mov DX, 63000 + Int 21h + + Xor BP, BP + +LoadS3MSamplesInModule1: + Cmp BP, [DS:63000+22h] + JB LoadS3MSamplesInModule2 + + Ret + +LoadS3MSamplesInModule2: + Mov SI, BP + Add SI, SI + Add SI, [DS:63000+20h] + Inc BP + + Mov DX, [DS:63000+SI+60h] + Mov CX, DX + ShR CX, 12 + ShL DX, 4 + Mov AX, 4200h + Int 21h + ; Move to location + Mov DX, 62000 + Mov AH, 3Fh + Mov CX, 80h + Int 21h + + Cmp Byte Ptr [DS:62000], 1 + JNE LoadS3MSamplesInModule1 + Cmp DWord Ptr [DS:62000+10h], 0 + JE LoadS3MSamplesInModule1 + + Mov AX, 96 + Mul CS:NumSamples + Mov DI, AX + + Mov Byte Ptr [DI+88], 3 + Call TransferFileName + + Mov AL, 64 + StosB + + Mov AL, [DS:62000+1Fh] ; Flag + Mov AH, AL + And AX, 401h + ShR AH, 1 + ShL AL, 4 + Or AL, AH + Or AL, 1 + Mov AH, [DS:62000+1Ch] ; Default volume + StosW + + Mov SI, 62000+30h + Mov CX, 25 + Rep MovsB + Xor AX, AX + StosW + Mov AL, 32 + StosB + + ; Length + Mov EAX, [DS:62000+10h] + StosD + Test Byte Ptr [DS:62000+1Fh], 4 + JZ LoadS3MSamplesInModule3 + + Add EAX, EAX + +LoadS3MSamplesInModule3: + Mov [DI+20h-4], EAX ; File size + + Mov EAX, [DS:62000+14h] + StosD + Mov EAX, [DS:62000+18h] + StosD + Mov EAX, [DS:62000+20h] + StosD + Xor AX, AX + StosW + StosW + StosW + StosW + ; Sample pointer.. + Mov AL, [DS:62000+0Dh] + ShL EAX, 16 + Mov AX, [DS:62000+0Eh] + ShL EAX, 4 + StosD + Xor AX, AX + StosW + StosW + + Inc CS:NumSamples + Jmp LoadS3MSamplesInModule1 + +EndP LoadS3MSamplesInModule + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LoadFARSamplesInModule + + Mov AH, 3Fh + Mov CX, 98 + Mov DX, 63000 + Int 21h + + Mov AX, 4201h + Xor CX, CX + Mov DX, [DS:63000+96] + Int 21h ; Removes song message + + Mov AH, 3Fh + Mov CX, 869-98 + Mov DX, 63000+98 + Int 21h + +; Xor CX, CX +; Mov CL, [DS:63000+354] ; CX = number of patterns + + Mov CX, 256 + +Comment ~ + + Xor CX, CX + Mov CL, [DS:63000+355] + Mov SI, 63000+98 + Xor AH, AH + ; Have to find CX from order list, apparently... + +LoadFARSamplesInModule7: + LodsB + Cmp AL, 0FFh + JE LoadFARSamplesInModule8 + Cmp AL, AH + JB LoadFARSamplesInModule8 + + Mov AH, AL + +LoadFARSamplesInModule8: + Loop LoadFARSamplesInModule7 + + Mov CL, AH + Inc CX + + ~ + + Mov SI, 63000+357 + Xor AX, AX + Xor DX, DX + +LoadFARSamplesInModule1: + Add AX, [SI] + AdC DX, 0 + Add SI, 2 + Loop LoadFARSamplesInModule1 + + ; DX:AX = length of patterns. + Mov CX, DX + Mov DX, AX + Mov AX, 4201h + Int 21h ; OK.. skipped past patterns. + + Mov AH, 3Fh + Mov CX, 8 + Mov DX, 64000 + Int 21h ; Read sample map. + + ; Determine number of samples... + Xor SI, SI ; SI = number of samples + + Mov EDX, [DS:64004] + Mov EAX, [DS:64000] + Mov CX, 64 + +LoadFARSamplesInModule2: + Test AL, 1 + JZ LoadFARSamplesInModule3 + + Inc SI + +LoadFARSamplesInModule3: + ShR EDX, 1 + RCR EAX, 1 + Loop LoadFARSamplesInModule2 + ; OK.. SI = number of samples.. + Mov [DS:65000], SI + + Mov AX, 48 + Mul SI + Mov SI, AX ; SI = number of bytes for sample header + + Mov AX, 4201h + Xor CX, CX + Xor DX, DX + Int 21h + ; DX:AX = position in file. + Add AX, SI + AdC DX, 0 ; DX:AX = position in file of first sam + + Xor BP, BP + +LoadFARSamplesInModule4: + Cmp BP, [DS:65000] + JB LoadFARSamplesInModule5 + + Ret + +LoadFARSamplesInModule5: + Inc BP + + Mov DX, 62000 + Mov AH, 3Fh + Mov CX, 48 + Int 21h + + Cmp DWord Ptr [DS:62000+32], 0 + JE LoadFARSamplesInModule4 + + Mov AX, 96 + Mul CS:NumSamples + Mov DI, AX + + Mov Byte Ptr [DI+88], 12 ; FAR sample + Call TransferFileName + + Mov AL, 64 + StosB ; Global volume + + Mov AX, [DS:62000+46] ; 8/16 bit in bit 0 + ; loop in bit 3 of AH + And AX, 801h + ShL AX, 1 + Or AL, AH + Or AL, 1 + Mov DL, AL + Mov AH, 64 + StosW + + Mov SI, 62000 + Mov CX, 25 + +LoadFARSamplesInModule6: + LodsB + StosB + Test AL, AL + LoopNZ LoadFarSamplesInModule6 + + Xor AL, AL + Inc CX + Rep StosB + Mov AX, 1+32*256 + StosW + + Mov EAX, [DS:62000+32] + Mov [DI+20h], EAX ; File size + Call LoadPTMSamplesInModule4 + Mov EAX, [DS:62000+38] ; Begin + Call LoadPTMSamplesInModule4 + Mov EAX, [DS:62000+42] ; End + Call LoadPTMSamplesInModule4 + + Mov AX, 8363 + StosW + Xor AX, AX + Mov CX, 5 + Rep StosW + + ; Get current position in file + Mov AX, 4201h + Xor CX, CX + Xor DX, DX + Int 21h + StosW + Mov AX, DX + StosW + + Xor AX, AX + StosW + StosW + + Mov AX, 4201h + Mov CX, [DS:62000+34] + Mov DX, [DS:62000+32] + Int 21h + + Cmp DWord Ptr [DS:62000+32], 1 + JBE LoadFARSamplesInModule4 + + Inc CS:NumSamples + Jmp LoadFARSamplesInModule4 + +EndP LoadFARSamplesInModule + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LoadMTMSamplesInModule + + Mov AH, 3Fh + Mov CX, 66 ; Read header + Mov DX, 63000 + Int 21h + + ; Sample pos = LastsamplePos+Length + ; So.. setup first sample with no length + Mov AH, 64 + Mov AL, [DS:63000+26] + Inc AX + Mul AH + Mov CX, AX ; CX = 64*(LastPatternSaved+1) + + Mov AL, 37 + Mul Byte Ptr [DS:63000+30] ; NOS + Add CX, AX ; CX = NOS*37+64*(LastPatternSaved+1) + Add CX, [DS:63000+28] + Add CX, 194 ; CX = 194+NOS*37+Lngth of comment+... + + Mov AX, 192 + Mul Word Ptr [DS:63000+24] ; Tracks saved + + Add AX, CX + AdC DX, 0 + + Mov [DS:48h], AX + Mov [DS:4Ah], DX + + Mov DWord Ptr [DS:30h], 0 + + Mov Byte Ptr [DS:63000+31], 0 + Xor BP, BP + +LoadMTMSamplesInModule1: + Cmp BP, [DS:63000+30] + JB LoadMTMSamplesInModule2 + + Ret + +LoadMTMSamplesInModule2: + Inc BP + + Mov DX, 62000 + Mov AH, 3Fh + Mov CX, 37 + Int 21h + + Cmp DWord Ptr [DS:62000+22], 0 + JE LoadMTMSamplesInModule1 + + Mov AX, 96 + Mul CS:NumSamples + Mov DI, AX + + Mov Byte Ptr [DI+88], 10 ; MTM sample + Call TransferFileName + + Mov AL, 64 + StosB ; Global volume + + Mov AL, 1 + + Mov ECX, [DS:62000+30] + Sub ECX, [DS:62000+26] + + Cmp ECX, 2 + JLE LoadMTMSamplesInModule3 + + Mov AL, 11h ; Loop + sample. + +LoadMTMSamplesInModule3: + Mov AH, [DS:62000+35] + StosW + ; Sample name now.. + Mov SI, 62000 + Mov CX, 22 + +LoadMTMSamplesInModule4: + LodsB + StosB + Test AL, AL + LoopNZ LoadMTMSamplesInModule4 + + Xor AX, AX + Add CX, 4 + Rep StosB + + Mov AH, 32 + StosW + + Mov EAX, [DS:62000+22] + Mov [DI+20h], EAX + StosD + Mov EAX, [DS:62000+26] + StosD + Mov EAX, [DS:62000+30] + StosD + + Mov AL, [DS:62000+34] + And AX, 0Fh + Mov SI, AX + Add SI, SI + Mov AX, [CS:FineTuneTable+SI] + StosW + Xor AX, AX + Mov CX, 5 + Rep StosW + + ; Sample pointer... + Mov EAX, [DI-96] ; Last sample pointer + Add EAX, [DI-96-18h] ; Last sample length + StosD + + Xor AX, AX + StosW + StosW + + Inc CS:NumSamples + Jmp LoadMTMSamplesInModule1 + +EndP LoadMTMSamplesInModule + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Comment ~ + +Proc LoadULTSamplesInModule + + Mov AH, 3Fh + Mov CX, 48 ; Read 48 bytes. + Mov DX, 63000 + Int 21h + + Xor DH, DH + Mov DL, [DS:63000+47] + ShL DX, 5 ; CX = CX * 32 + Xor CX, CX + Mov AX, 4201h + Int 21h ; Seek.. + + Mov AH, 3Fh + Mov CX, 1 + Mov DX, 63000+48 + Int 21h ; Read 1 byte.. + Mov Byte Ptr [DS:63000+49], 0 + + Ret + +EndP LoadULTSamplesInModule + + ~ + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Load669SamplesInModule + + Mov AH, 3Fh + Mov CX, 1F1h + Mov DX, 63000 + Int 21h + + Mov AL, 19h + Mul Byte Ptr [DS:63000+6Eh] + Mov CX, AX + Add CX, 1F1h + + Mov AL, [DS:63000+6Fh] + Xor AH, AH + Mov DX, 600h + Mul DX + + Add AX, CX + AdC DX, 0 + + Mov [DS:48h], AX + Mov [DS:4Ah], DX + + Mov DWord Ptr [DS:30h], 0 + + Mov Byte Ptr [DS:63000+6Fh], 0 + Xor BP, BP + +Load669SamplesInModule1: + Cmp BP, [DS:63000+6Eh] + JB Load669SamplesInModule2 + + Ret + +Load669SamplesInModule2: + Inc BP + + Mov AH, 3Fh + Mov CX, 19h + Mov DX, 62000 + Int 21h + + Cmp DWord Ptr [DS:62000+13], 0 + JE Load669SamplesInModule1 + + Mov AX, 96 + Mul CS:NumSamples + Mov DI, AX + + Mov Byte Ptr [DI+88], 11 ; 669 sample + Call TransferFileName + + Mov AL, 64 + StosB ; Global volume + + Mov AL, 1 + + Mov ECX, [DS:62000+21] + Cmp ECX, [DS:62000+13] + JA Load669SamplesInModule3 + + Mov AL, 11h ; Loop + sample. + +Load669SamplesInModule3: + Mov DL, AL + Mov AH, 64 + StosW + + ; Sample name + Mov SI, 62000 + Mov CX, 13 + Rep MovsB + + Xor AX, AX + Mov CX, 13 + Rep StosB + + Mov AH, 32 + StosW + + Mov SI, 62000+13 + LodsD + Mov [DI+20h], EAX + StosD + MovsD + Test DL, 10h + JZ Load669SamplesInModule4 + + MovsD + Jmp Load669SamplesInModule5 + +Load669SamplesInModule4: + Xor AX, AX + StosW + StosW + +Load669SamplesInModule5: + Mov AX, 8363 + StosW + Xor AX, AX + Mov CX, 5 + Rep StosW + + ; Sample pointer... + Mov EAX, [DI-96] ; Last sample pointer + Add EAX, [DI-96-18h] ; Last sample length + StosD + + Xor AX, AX + StosW + StosW + + Inc CS:NumSamples + Jmp Load669SamplesInModule1 + +EndP Load669SamplesInModule + + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LoadPTMSamplesInModule + + Mov AH, 3Fh + Mov CX, 608 ; Read 608 bytes. + Mov DX, 63000 + Int 21h + + Xor BP, BP + +LoadPTMSamplesInModule1: + Cmp BP, [DS:63000+34] + JB LoadPTMSamplesInModule2 + + Ret + +LoadPTMSamplesInModule2: + Inc BP + + Mov DX, 62000 + Mov AH, 3Fh + Mov CX, 80 + Int 21h + + Mov AL, [DS:62000] + And AL, 3 + Cmp AL, 1 + JNE LoadPTMSamplesInModule1 + Cmp DWord Ptr [DS:62000+22], 0 + JE LoadPTMSamplesInModule1 + + Mov AX, 96 + Mul CS:NumSamples + Mov DI, AX + + Mov Byte Ptr [DI+88], 9 ; PTM sample + Call TransferFileName + + Mov AL, 64 + StosB ; Global volume + + Mov CL, [DS:62000] ; AL, Bit 0-1 = sample + ; Bit 2 = loop + ; Bit 3 = loop dirn + ; Bit 4 = 8/16 bit + Mov AL, CL + Mov AH, CL + And AX, 1004h + ShL AL, 2 + And CL, 8 + ShR AH, 3 + ShL CL, 3 + Or AL, AH + Or AL, CL + Or AL, 1 + Mov DL, AL + Mov AH, [DS:62000+13] ; Default volume + StosW ; Flag + default volume + + Mov SI, 62000+30h ; Sample name + Mov CX, 25 + Rep MovsB + Xor AX, AX + StosB + + Mov AX, 9+32*256 ; Conversion flag + default pan + StosW + + ; Length + Mov EAX, [DS:62000+22] + Mov [DI+20h], EAX ; File size + Call LoadPTMSamplesInModule4 + Mov EAX, [DS:62000+26] ; Begin + Call LoadPTMSamplesInModule4 + Mov EAX, [DS:62000+30] ; End + Call LoadPTMSamplesInModule4 + Xor EAX, EAX + Mov AX, [DS:62000+14] ; C5Freq + StosD + Xor AX, AX + StosW + StosW + StosW + StosW + ; Sample pointer.. + Mov EAX, [DS:62000+18] + StosD + Xor AX, AX + StosW + StosW + + Inc CS:NumSamples + Jmp LoadPTMSamplesInModule1 + +LoadPTMSamplesInModule4: + Test DL, 2 + JZ LoadPTMSamplesInModule5 + + ShR EAX, 1 + +LoadPTMSamplesInModule5: + StosD + RetN + +EndP LoadPTMSamplesInModule + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LoadITSamplesInModule ; DS, ES = DiskDataArea + + Mov AH, 3Fh + Mov CX, 2000 + Mov DX, 63000 + Int 21h ; Loaded module + + Xor BP, BP ; DX = number of samples + +LoadITSamplesInModule1: + Cmp BP, [DS:63000+24h] ; Num Samples + JB LoadITSamplesInModule2 + + Ret + +LoadITSamplesInModule2: + Mov SI, [DS:63000+22h] + Add SI, BP + ShL SI, 2 ; DX = (NumInstrument+NumSamples)*4 + Add SI, [DS:63000+20h] + Inc BP + + Mov DX, [DS:63000+SI+0C0h] + Mov CX, [DS:63000+SI+0C0h+2] + + Mov AX, 4200h + Int 21h + ; OK. file pointer moved to sample header. + ; Memory region to copy it to is BP*96 + + Mov AX, 96 + Mul CS:NumSamples + + Mov DX, AX + Mov DI, DX + Mov AH, 3Fh + Mov CX, 80 + Int 21h + + Mov CL, [DI+12h] + Test CL, 1 + JZ LoadITSamplesInModule1 + + Mov EAX, [DI+30h] ; Length + Test CL, 2 + JZ LoadITSamplesInModule3 + + Add EAX, EAX + +LoadITSamplesInModule3: + Mov [DI+50h], EAX + + Mov Byte Ptr [DI+88], 2 + Call TransferFileName + + Inc CS:NumSamples + Jmp LoadITSamplesInModule1 + +EndP LoadITSamplesInModule + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LoadXMHeader + + Mov AH, 3Fh + Mov CX, 74 + Mov DX, 64000 + Int 21h ; Loaded module + + Mov AX, 4200h ; Seek to position from start of module + Mov DX, [DS:64000+60] + Mov CX, [DS:64000+62] + Add DX, 60 + Int 21h + + Xor BP, BP ; BP = pattern counter + ; At first pattern +LoadXMSamplesInModule1: + Cmp BP, [DS:64000+70] ; Number of patterns + JAE LoadXMSamplesInModule2 + + ; Load 4 bytes. + Mov AH, 3Fh + Mov CX, 9 ; Read standard header + Mov DX, 63000 + Int 21h + + Mov AX, 4201h + Xor CX, CX + Mov DX, [DS:63000] + Add DX, [DS:63000+7] + Sub DX, 9 + Int 21h + + Inc BP + Jmp LoadXMSamplesInModule1 + +LoadXMSamplesInModule2: ; OK.. at first instrument + + Ret + +EndP LoadXMHeader + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LoadXMSamplesInModule + + Call LoadXMHeader + + Xor BP, BP + +LoadXMSamplesInModule3: + Cmp BP, [DS:64000+72] + JB LoadXMSamplesInModule4 + + Ret + +LoadXMSamplesInModule4: + Inc BP + + Mov AH, 3Fh + Mov CX, 4 + Mov DX, 63000 + Int 21h ; Read instrument size field + + Mov AH, 3Fh + Mov CX, [DS:63000] + Sub CX, 4 + Mov DX, 63004 + Int 21h + + Mov AX, [DS:63000+27] ; Number of samples + Test AX, AX + JZ LoadXMSamplesInModule3 + + ; Bytes to read = AX*40 + Mov CX, 40 + Mul CX + Mov CX, AX + Mov AH, 3Fh + Mov DX, 62000 + Int 21h ; OK sample headers read + ; into DS:62000 + + Push BP + Xor BP, BP + Xor EDX, EDX ; EDX = number of bytes to adv + +LoadXMSamplesInModule5: + Cmp BP, [DS:63000+27] ; Number of samples + JB LoadXMSamplesInModule6 + + SHLD ECX, EDX, 16 + Mov AX, 4201h + Int 21h ; Advance file pointer + + Pop BP + Jmp LoadXMSamplesInModule3 + +LoadXMSamplesInModule6: + Push EDX + + Mov AX, 40 + Mul BP + Mov SI, AX + Add SI, 62000 + + Pop EDX + Inc BP + + Cmp DWord Ptr [DS:SI], 0 ; Sample length = 0?? + JE LoadXMSamplesInModule5 + + Push EDX + + Mov AX, 96 + Mul CS:NumSamples + Mov DI, AX + + Push SI + + Mov Byte Ptr [DI+88], 8 + Call TransferFileName + + Mov AL, 64 + StosB + + Pop SI + + Mov AH, [SI+12] ; Default volume + Mov AL, 1 + + Mov CL, [SI+14] + Test CL, 10h + JZ LoadXMSamplesInModule7 + + Or AL, 2 ; 16-bit sample + +LoadXMSamplesInModule7: + And CL, 3 + JZ LoadXMSamplesInModule8 ; No loop + ; CL = 1 or 2 + + Cmp DWord Ptr [SI+8], 1 + JBE LoadXMSamplesInModule8 + + Or AL, 10h ; Loop + Dec CX + ShL CL, 6 + Or AL, CL + +LoadXMSamplesInModule8: + StosW + + Push SI + ; Sample name + Add SI, 18 + Mov CX, 22/2 + Rep MovsW + + Pop SI + + Xor AX, AX ; Cleanup + conversion flags + StosW + StosW + Mov AH, [SI+15] ; Default pan + ShR AH, 2 + AdC AH, 80h + Mov AL, 5 ; Delta values, signed + StosW + + Mov EAX, [SI] + Mov [DI+20h], EAX ; File size + Call LoadXISample5 + Mov EAX, [SI+4] + Call LoadXISample5 + Mov EAX, [SI+4] + Add EAX, [SI+8] + Call LoadXISample5 + + ; C5speed.. + Push ES + Push DI + + Call Music_GetPitchTable ; Returns ES:DI + Mov AL, [SI+16] ; Relative note number + Add AL, 60 ; AL = note multiplier + And AX, 0FFh + ShL AX, 2 + Add DI, AX + Mov ECX, [ES:DI] + + Mov AL, [SI+13] ; Finetune, -128->+127 + SAR AL, 4 ; Finetune = -8->+7 + And AX, 0Fh + Add AX, AX + Mov DI, AX + MovZX EAX, [CS:FineTuneTable+DI] + + Pop DI + Pop ES + + Mul ECX + ShRD EAX, EDX, 16 + StosD ; C5freq + + Xor AX, AX + StosW + StosW + StosW + StosW + ; Now position + Mov AX, 4201h + Xor CX, CX + Xor DX, DX + Int 21h ; Returns file position in DX:AX + + Push AX + ShRD EAX, EDX, 16 + Pop AX + Pop EDX + Add EAX, EDX + StosD + Xor AX, AX + StosW + StosW + + Add EDX, [DS:SI] + Inc CS:NumSamples + Jmp LoadXMSamplesInModule5 + +EndP LoadXMSamplesInModule + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +KRZSampleOffset DD 0 +KRZSampleStartingOffset DD 0 +KRZFileOffset DD 0 + +Proc LoadKRZSamples + + Mov AH, 3Fh + Mov CX, 32 + Mov DX, 64000 + Int 21h + + Mov CS:KRZFileOffset, 32 + + Mov EAX, [DS:64000+4] ; Sample start offset + Call SoftBSWAP + + Mov CS:KRZSampleOffset, EAX + Mov CS:KRZSampleStartingOffset, EAX + +LoadKRZSamples1: + Mov EDX, CS:KRZFileOffset + Cmp EDX, CS:KRZSampleStartingOffset + JB LoadKRZSamples2 + + Ret + +LoadKRZSamples2: + Mov AX, 4200h ; Move to location in file + SHLD ECX, EDX, 16 + Int 21h + + Mov AH, 3Fh + Mov CX, 1000 + Mov DX, 64000 + Int 21h ; Load .KRZ object + + Mov AX, [DS:64000+6] ; Block size + XChg AH, AL + Add AX, 7 + And EAX, 0FFFCh + Add CS:KRZFileOffset, EAX + + Mov AX, [DS:64000+4] ; Sample object? + Cmp AL, 98h + JB LoadKRZSamples1 + Cmp AL, 9Bh + JA LoadKRZSamples1 + + Push BX + + Mov AX, 96 + Mul CS:NumSamples + Mov DI, AX + + Mov Byte Ptr [DI+88], 15 ; KRZ sample. + Call TransferFileName + + Mov AL, 64 ; Global volume + StosB + + Mov BX, [DS:64000+8] + XChg BH, BL + Add BX, 64000+20 + + ; BX points to start of + ; KRZSampleHdr + + Mov AX, 4003h ; Flags + Default volume + ; sample present, 16-bit + Mov DL, [BX+1] + + Test DL, 2 ; Bidir loop? + JZ LoadKRZSamples5 + + Or AL, 0C0h ; Ping pong + +LoadKRZSamples5: + Test DL, 80h ; Loop off? + JNZ LoadKRZSamples6 + + Mov ECX, [BX+16] + Cmp ECX, [BX+20] + JE LoadKRZSamples6 + + Or AL, 10h ; Loop on. + +LoadKRZSamples6: + StosW ; Flags + DFV done. + +; Sample name. + + Mov SI, 64000+10 + Mov CX, 26 + +LoadKRZSamples3: + LodsB + Test AL, AL + JZ LoadKRZSamples4 + StosB + Loop LoadKRZSamples3 + + Xor AL, AL + +LoadKRZSamples4: + Rep StosB + + Mov AX, 1+2+32*256 + StosW ; Signed sample, default pan = 32 + + ; Length + Mov EAX, [BX+8] + Call SoftBSWAP + Mov EBP, EAX + + Mov EAX, [BX+20] + Call SoftBSWAP + Sub EAX, EBP + StosD + Add EAX, EAX + Mov [DI+20h-4], EAX ; File size + + Mov EAX, [BX+16] ; start of loop + Call SoftBSWAP + Sub EAX, EBP + StosD + Mov EAX, [BX+20] + Call SoftBSWAP + Sub EAX, EBP + Cmp EAX, [ES:DI-4] + JB NextKRZ + StosD + + Mov EAX, [BX+28] + Call SoftBSWAP + Mov ECX, EAX + + Mov EAX, 22000 + Test ECX, ECX + JZ LoadKRZSamples7 + + Xor EDX, EDX + Mov EAX, 1000000000 + + Div ECX + Test EAX, EAX + JNZ LoadKRZSamples7 + + Mov EAX, 44100 + +LoadKRZSamples7: + StosD ; C5Speed + + Xor EAX, EAX + StosD + StosD + + Mov EAX, CS:KRZSampleOffset + Add EAX, EBP + Add EAX, EBP + StosD + + Xor EAX, EAX + StoSD + + Inc CS:NumSamples + +NextKRZ: + Pop BX + Jmp LoadKRZSamples1 + +EndP LoadKRZSamples + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc StorePATLength + + Test DL, 1 ; 16-bit? + JZ StorePATLength1 + + ShR EAX, 1 + +StorePATLength1: + StosD + Ret + +EndP StorePATLength + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LoadPATSamples + + Mov AH, 3Fh + Mov CX, 129+63+47 ; 129 bytes for file header, 63 for + ; instrument header, 47 for layer + Mov DX, 65000 + Int 21h + + Mov BP, [DS:65000+129+63+6] + And BP, 0FFh ; BP = number of waves. + +LoadPATSamples1: + Mov AH, 3Fh + Mov DX, 64000 + Mov CX, 96 + Int 21h ; Read data in + + Mov AX, 96 + Mul CS:NumSamples + Mov DI, AX + + Inc CS:NumSamples + + Mov Byte Ptr [DI+88], 16 ; GUS Patch + Call TransferFileName + + Mov AL, 64 ; Global volume + StosB + + Mov AX, 4001h ; sample present + Mov DL, [DS:64000+55] ; modes + + Test DL, 1 ; 8/16 bit + JZ LoadPATSamples2 + + Or AL, 2 + +LoadPATSamples2: + Test DL, 4 ; Looping enabled? + JZ LoadPATSamples3 + + Or AL, 10h + +LoadPATSamples3: + Test DL, 8 ; Ping pong loops? + JZ LoadPATSamples4 + + Or AL, 40h + +LoadPATSamples4: + StosW ; OK.. now for name. + + Mov SI, 65000+129+2 + Mov CX, 16 + +LoadPATSamples5: + LodsB + Test AL, AL + JZ LoadPATSamples6 + StosB + Loop LoadPATSamples5 + +LoadPATSamples6: + Add CX, 9 + + Mov AL, ':' + StosB + Mov SI, 64000 + +LoadPATSamples7: + LodsB + Test AL, AL + JZ LoadPATSamples8 + StosB + Loop LoadPATSamples7 + +LoadPATSamples8: + Xor AL, AL + Rep StosB + + ; Convert, default pan + + Mov AH, 32 + Mov AL, [DS:64000+55] + And AL, 2 + ShR AL, 1 + Xor AL, 1 + StosW + + ; Length. + + Mov DL, [DS:64000+55] + + Mov EAX, [DS:64000+16] ; ->Length + Mov [DI+20h], EAX ; File size + Call StorePATLength + + Mov EAX, [DS:64000+12] ; LoopBeg + Call StorePATLength + Mov EAX, [DS:64000+16] ; LoopEnd + Call StorePATLength + + Mov AX, [DS:64000+20] + And EAX, 0FFFFh + StosD ; C5Spd + + Xor EAX, EAX + StosD + StosD + + Mov AX, 4201h + Xor CX, CX + Xor DX, DX + Int 21h ; Current position. + + StosW + Mov AX, DX + StosW + + Xor AX, AX + StosW + StosW + + Mov AX, 4201h + Mov CX, [DS:64000+10] + Mov DX, [DS:64000+8] + Int 21h + + Dec BP + JNZ LoadPATSamples1 + + Ret + +EndP LoadPATSamples + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + diff --git a/IT_D_RM.INC b/IT_D_RM.INC new file mode 100644 index 0000000..f9b0fb0 --- /dev/null +++ b/IT_D_RM.INC @@ -0,0 +1,2889 @@ +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ +; +; Read module functions +; + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +IF TUTORIAL +ELSE + +Proc D_PreLoadModule ; Returns ES = song segment + ; BX = file handle + ; DS = Diskdata area + ; AX = SaveFormat + +; Call MouseUpdateEnable + +IF DEFAULTFORMAT + Test AL, AL + JNZ D_PreLoadModuleTemp + + Mov AL, DEFAULTFORMAT + +D_PreLoadModuleTemp: +ENDIF + Mov SaveFormat, AL + + Call I_ClearTables + Call Music_ReleaseAllPatterns + Call Music_ReleaseAllSamples + Call Music_ClearAllSampleNames + Call Music_ClearAllInstruments + Call Msg_ResetMessage + Call ReleaseTimerData + + Mov DS, CS:DiskDataArea + + Mov BX, CS:CurrentFile + Add BX, BX + Mov BX, [BX] + Add BX, 8 + + Push CS + Pop ES + Mov DI, Offset FileName ; OK... + Mov SI, BX ; Data area no longer + Mov CX, 13 ; reqd + Rep MovsB + + Mov AX, 3D00h + Mov DX, BX + Int 21h + JC D_LoadFileOpenErrorMsg + + Mov BX, AX ; BX = file handle. + + Call Music_GetSongSegment + Mov ES, AX + + Ret + +EndP D_PreLoadModule + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_PostLoadModule Far + + Mov AH, 3Eh ; Close file. + Int 21h + + Push CS + Pop DS + Assume DS:Disk + + Call CheckTimerData + Call GetCurrentTime + + Mov [TopTimerData], 0 + + Call GetTimerCounter + Mov [EditTimer], EAX + + Call PE_ResetOrderPattern + +; Mov AX, 1 + Ret + +EndP D_PostLoadModule + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_InsertOrder ; DX = inserting pattern, BP = current + ; ES = songdata + PushA + Push DS + + Push ES + Pop DS + + Mov SI, 1FFh + Mov AX, BP + +D_InsertOrder1: + Cmp AL, [SI] + JE D_InsertOrder2 + +D_InsertOrderResume: + Dec SI + Cmp SI, 100h + JAE D_InsertOrder1 + + Pop DS + PopA + Ret + +D_InsertOrder2: + Push SI + Mov CX, 1FEh + Mov DI, 1FFh + Sub CX, SI + JC D_InsertOrder3 + + Mov SI, 1FEh + + StD + Rep MovsB + ClD + + Mov AL, DL + StosB + +D_InsertOrder3: + Pop SI + Jmp D_InsertOrderResume + +EndP D_InsertOrder + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_LoadXM Far + + Xor AX, AX + Call D_PreLoadModule + Assume DS:Nothing + + Mov AH, 3Fh + Mov CX, 64 ; Header length + Mov DX, 64000 + Int 21h + + Mov AH, 3Fh ; Read rest of header. + Mov CX, [DS:64000+60] + Sub CX, 4 + Mov DX, 64104 + Int 21h + + Mov DI, 4 + Mov CX, 20 + Mov SI, 64000+17 + Rep MovsB + Xor AX, AX + Mov CX, 5 + Rep StosW ; OK name transferred. + + ; Number of Instruments + Mov AX, [DS:64100+12] + StosW ; Insnum + + Mov AX, 1 + StosW + + ; Number of Patterns + Mov AX, [DS:64100+10] + StosW + Mov [ES:0C0h], AX ; Number of patterns. + + ; CWT/V, CMWT + Add DI, 4 + + ; Flags + Mov AX, [DS:64100+14] + And AX, 1 + ShL AX, 3 + Or AX, 35h ; XM Effects, Old effects, stereo, insts + StosW + + ; Reserved + Xor AX, AX + StosW + + ; GVolume. MVolume + Mov AX, 128+48*256 + StosW + + ; Initial Speed, Initial Tempo + Mov AL, [DS:64100+16] + Test AL, AL + JNZ InitialSpeedNot0 + + Mov AL, 6 + +InitialSpeedNot0: + Mov AH, [DS:64100+18] + StosW + + ; Separation + Mov AX, 128 + StosW + + ; Message length, offset, timer + Xor AX, AX + Mov CX, 5 + Rep StosW + + ; Channel Pan + + Mov CX, [DS:64100+8] ; Number of channels + Mov AL, 32 + Rep StosB + Mov AL, 128+32 + Mov CX, 64 + Sub CX, [DS:64100+8] + Rep StosB + + ; Channel Volume + + Mov AL, 64 + Mov CX, 64 + Rep StosB + + ; Orders + Add DI, 40h + Mov SI, 64100+20 ; Orders + Mov CX, [DS:64100+4] ; Song legnth + JCXZ D_LoadXMNoPatterns2 + +D_FindMaximumPattern: + LodsB + Cmp AL, 200 + JAE D_FindMaximumPattern3 + + Cmp AL, [ES:0C0h] + JB D_FindMaximumPattern2 + + Inc AX + Mov [ES:0C0h], AX + Dec AX + Jmp D_FindMaximumPattern2 + +D_FindMaximumPattern3: + Mov AL, 0FFh + +D_FindMaximumPattern2: + StosB + Loop D_FindMaximumPattern + +D_LoadXMNoPatterns2: + Mov CX, 256 + Sub CX, [DS:64100+4] + Mov AL, 0FFh + Rep StosB + + ; OK.. now to load patterns. + Cmp Word Ptr [DS:64100+10], 0 + JE D_LoadXMNoPatterns + + Xor BP, BP + +D_LoadXM1: + Push DS SI DI + + Push CS + Pop DS + Assume DS:Disk + + Mov SI, Offset PatternMsg + Mov AH, 5 + Mov DI, (4+16*80)*2 + Push BP + Call S_DrawString + Pop AX + + Pop DI SI DS + Assume DS:Nothing + + Mov AH, 3Fh + Mov CX, 4 + Xor DX, DX + Int 21h ; Read pattern length + + Mov AH, 3Fh + Mov CX, [DS:0] + Mov DX, 4 + Sub CX, DX + Int 21h ; Read pattern header + + Cmp Word Ptr [DS:7], 0 + JE D_LoadXM3 + + Mov AH, 3Fh + Mov CX, [DS:7] + Mov DX, 100h + Mov SI, DX + Int 21h ; DS:100h contains all the + ; pattern data. + + Cmp BP, 200 ; Too many patterns? + JAE D_LoadXM3 + + Mov AX, [DS:5] ; AX = number of rows + Mov CX, [DS:64100+8] ; CX = number of channels + Mov DX, BP + + Cmp AX, 200 + JA D_LoadXM2 + + ; TranslateXMPattern takes: + ; DS:SI points to pattern data + ; AX = rows + ; CX = channels + ; DX = pattern number + + + Call PE_TranslateXMPattern + Jmp D_LoadXM3 + +D_LoadXM2: + ShR AX, 1 + Call PE_TranslateXMPattern + + Mov DX, [ES:0C0h] ; DX = pattern number + Cmp DX, 200 + JAE D_LoadXM3 + + Inc Word Ptr [ES:0C0h] + + Call D_InsertOrder + + Mov AX, [DS:5] + Inc AX + ShR AX, 1 ; AX = number of rows. + Call PE_TranslateXMPattern + +D_LoadXM3: + Inc BP + Cmp BP, [DS:64100+10] + JB D_LoadXM1 + +D_LoadXMNoPatterns: + ; Now to load instruments + Xor BP, BP + Cmp BP, [DS:64100+12] + JE D_LoadXMInstrumentTooMany + +D_LoadXM4: + Push DS SI + + Push CS + Pop DS + Mov SI, Offset InstrumentMsg + Mov AX, BP + Inc AX + Push AX + Mov AH, 5 + Mov DI, (4+17*80)*2 + Call S_DrawString + Pop AX + + Pop SI DS + + Mov AH, 3Fh + Mov CX, 4 + Xor DX, DX + Int 21h + + Mov AH, 3Fh + Mov CX, [DS:0] + Mov DX, 4 + Sub CX, DX + Int 21h + + ; OK.. instrument loaded into DS:0.. + Mov DI, BP + Add DI, DI + Mov DI, [ES:64712+DI] ; ES:DI points to instrument + Push DI + + Mov SI, 4 + Add DI, 20h + Mov CX, 22 + Rep MovsB + Xor AX, AX + Mov CX, 4 + Rep StosW + + Pop DI + Cmp Word Ptr [DS:27], 0 + JE D_LoadXMInstrumentEnd + + Add DI, 14h ; DI points to fadeout + Mov AX, [DS:239] + Add AX, 15 + ShR AX, 5 + Cmp AX, 256 + JBE D_LoadXMInstrument1 + + Mov AX, 256 + +D_LoadXMInstrument1: + StosW + Add DI, 40h-16h ; Translation table + + Mov CX, 12 ; Kill first 12 entries. + Xor AX, AX + +D_LoadXMInstrument2: ; First 12 entries cleared + StosW + Inc AX + Loop D_LoadXMInstrument2 + + Mov CX, 96 + Mov SI, 33 ; Note translation + +D_LoadXMInstrument3: + Mov AH, [SI] + Add AH, [ES:24h] + Cmp AH, 99 + JBE D_LoadXMInstrument4 + + Mov AH, 99 + +D_LoadXMInstrument4: + StosW + Inc SI + Inc AX + Loop D_LoadXMInstrument3 + + Mov CX, 12 ; Kill first 12 entries. + Xor AH, AH + +D_LoadXMInstrument5: ; First 12 entries cleared + StosW + Inc AX + Loop D_LoadXMInstrument5 + + ; Now for volume envelope + Mov AL, [DS:233] ; Flags + Test AL, 1 + JNZ D_LoadXMVolumeEnvelope + + Mov AX, 205h + StosW + Xor AX, AX + StosW + StosW + + Mov AL, 64 + StosB + Xor AX, AX + StosW + + StosB + Mov AX, 1 + StosW + + Mov CX, 70 + Xor AX, AX + Rep StosB + + Jmp D_LoadXMInstrumentVolumeFinished + +D_LoadXMVolumeEnvelope: +; Mov CL, AL +; Mov AH, AL +; And AX, 402h +; ShR AH, 1 +; ShL AL, 1 +; Or AL, AH +; And CL, 1 +; Or AL, CL + + And AL, 2 + ShL AL, 1 + Or AL, 2+1 ; Volume envelope on, Loop on (always) + + Mov AH, [DS:225] ; No of vol env nodes + Cmp AH, 12 + JB D_NumXMVolNodes1 + + Mov AH, 12 + +D_NumXMVolNodes1: + StosW + Mov AX, [DS:228] ; Vol loop start+end + Test Byte Ptr [DS:233], 4 ; Volume loop? + JNZ VolumeLoopOK + + Mov AL, [DS:225] + Dec AX + Mov AH, AL + +VolumeLoopOK: + StosW + Mov AL, [DS:227] ; Vol Sustain point + Mov AH, AL + StosW + + Cmp Byte Ptr [DS:233], 7 + JNE D_XMVolumeNoSustain + + Cmp AL, [DS:229] ; Compare sustain to endpoint + JB D_XMVolumeLoopOK + + And Byte Ptr [ES:DI-6], Not 4 + Jmp D_XMVolumeLoopOK + +D_XMVolumeNoSustain: + Test Byte Ptr [DS:233], 2 ; Loop? + JNZ D_XMVolumeLoopOK + + Mov AL, [DS:225] ; Number of nodes + Dec AX + Mov AH, AL + Mov [ES:DI-2], AX + Or Byte Ptr [ES:DI-6], 4 + +D_XMVolumeLoopOK: + ; OK. now process volume env points + Mov CX, 12 + Mov SI, 129 + +D_LoadXMInstrument6: + Mov AL, [SI+2] + Cmp AL, 64 + JB D_LoadXMInstrument7 + + Mov AL, 64 + +D_LoadXMInstrument7: + StosB + MovsW + LodsW + Loop D_LoadXMInstrument6 + + Mov CX, 13*3+1 + Xor AX, AX + Rep StosB + + ; Now for panning envelope +D_LoadXMInstrumentVolumeFinished: + + Mov AL, [DS:234] ; Flags + Mov CL, AL + Mov AH, AL + And AX, 402h + ShR AH, 1 + ShL AL, 1 + Or AL, AH + And CL, 1 + Or AL, CL + + Mov AH, [DS:226] ; No of pan env nodes + Cmp AH, 12 + JB D_NumXMPanNodes1 + + Mov AH, 12 + +D_NumXMPanNodes1: + StosW + Mov AX, [DS:231] ; Pan loop start+end + StosW + Mov AL, [DS:230] ; Pan Sustain point + Mov AH, AL + StosW + + Test Byte Ptr [DS:234], 2 ; Panning envelope flags + JZ D_XMPanningLoopOK + + Cmp AL, [DS:232] ; Compare sustain to endpoint + JB D_XMPanningLoopOK + + And Byte Ptr [ES:DI-6], Not 4 + +D_XMPanningLoopOK: + ; OK. now process panning env points + Mov CX, 12 + Mov SI, 177 + Xor AH, AH + +D_LoadXMInstrument8: + Mov AL, [SI+2] + Cmp AL, 64 + JB D_LoadXMInstrument9 + + Mov AL, 64 + +D_LoadXMInstrument9: + Sub AL, 32 + StosB + MovsW + LodsW ; Add SI, 2 + Loop D_LoadXMInstrument8 + + Mov AX, [DS:27] + Mul Word Ptr [DS:29] + Mov CX, AX + Mov AH, 3Fh + Mov DX, 1000h + Mov SI, DX + Int 21h + + Mov CX, [DS:27] ; Update number of samples. + Mov AX, [ES:24h] + Add [ES:24h], CX + +D_LoadXMSamples1: + Cmp AX, 99 + JA D_LoadXMInstrumentTooMany + Cmp AX, [ES:24h] + JAE D_LoadXMInstrumentEnd + + Push AX + Push SI + + Mov DI, AX + Add DI, DI + Mov DI, [ES:64912+DI-2] + Add DI, 12h ; Skip filename, ID, GVL + + Mov AH, [SI+12] ; Default volume + Mov AL, 0 + Cmp DWord Ptr [SI], 0 ; Length = 0? + JE D_LoadXMSamples3 + + ; Grab the panning value + +Comment ~ + Mov AL, [SI+15] + ShR AL, 1 + Inc AX + ShR AL, 1 + + Push DI + Mov DI, BP + Add DI, DI + Mov DI, [ES:64712+DI] + Cmp Byte Ptr [ES:DI+19h], 32+128 + JE XMNoPan2 + + Mov AL, 32 + +XMNoPan2: + Mov [ES:DI+19h], AL + +XMNoPan: + Pop DI +~ + ; Sample present flag + Mov AL, 1 + + Mov CL, [SI+14] + Test CL, 10h ; 16 bit sample? + JZ D_LoadXMSamples2 + + Or AL, 2 + +D_LoadXMSamples2: + And CL, 3 + JZ D_LoadXMSamples3 ; No loop + ; CL = 1 or 2 + Cmp DWord Ptr [SI+8], 1 + JBE D_LoadXMSamples3 + + Or AL, 10h ; Loop + Dec CX + ShL CL, 6 + Or AL, CL + +D_LoadXMSamples3: + StosW + + Push SI + ; Copy sample name + Add SI, 18 + Mov CX, 22/2 + Rep MovsW + Xor AX, AX + StosW + StosW + + Pop SI + ; Conversion flags. + Mov AH, [SI+15] + ShR AH, 2 + AdC AH, 80h + Mov AL, 5 + StosW + + Mov EAX, [SI] + Call LoadXISample5 + Mov EAX, [SI+4] + Call LoadXISample5 + Mov EAX, [SI+4] + Add EAX, [SI+8] + Call LoadXISample5 + + ; C5speed.. + Push ES + Push DI + + Call Music_GetPitchTable ; Returns ES:DI + Mov AL, [SI+16] ; Relative note number + Add AL, 60 ; AL = note multiplier + And AX, 0FFh + ShL AX, 2 + Add DI, AX + Mov ECX, [ES:DI] + + Mov AL, [SI+13] ; Finetune, -128->+127 + SAR AL, 4 ; Finetune = -8->+7 + And AX, 0Fh + Add AX, AX + Mov DI, AX + MovZX EAX, [CS:FineTuneTable+DI] + + Pop DI + Pop ES + + Push EDX + + Mul ECX + ShRD EAX, EDX, 16 + Pop EDX + StosD ; C5freq + + Xor AX, AX + StosW + StosW + StosW + StosW + + ; Now for file position + Mov AX, 4201h + Xor CX, CX + Xor DX, DX + Int 21h ; Returns DX:AX + + StosW + Mov AX, DX + StosW + + ; Vibrato information + Mov AX, [DS:237] + XChg AH, AL + StosW + + Mov DX, [DS:236] + And DX, 0FFh + Mov AX, 100h + Sub AX, DX +; Cmp AL, 64 +; JBE VibratoLimit +; +; Mov AL, 64 +; +; VibratoLimit: + Mov AH, [DS:235] + StosW + + ; Move file pointer forwards + Mov AX, 4201h + Mov CX, [SI+2] + Mov DX, [SI] + Int 21h + + Pop SI + Pop AX + Add SI, [DS:29] ; Next sample header + Inc AX + Jmp D_LoadXMSamples1 + +D_LoadXMInstrumentEnd: + Inc BP + Cmp BP, 99 + JA D_LoadXMInstrumentTooMany + Cmp BP, [DS:64100+12] + JB D_LoadXM4 + +D_LoadXMInstrumentTooMany: + Mov CX, 1 ; CX = sample number (base 1) + ; DS = doesn't matter + ; ES = songdata segment + +D_LoadXMFinalSamples1: ; OK, now load the samples. + Push CX + Push ES + + Mov SI, CX + Dec SI + Add SI, SI + Mov SI, [ES:64912+SI] + Test Byte Ptr [ES:SI+12h], 1 + JZ D_LoadXMFinalSamples2 + + Push CS + Pop DS + + Push SI + Mov SI, Offset SampleMsg + Mov DI, (4+18*80)*2 + Mov AH, 5 + Push CX + Call S_DrawString + Pop DI + Pop SI ; ES:SI points to sample header. + ; DI = sample number+1 + Push ES + Pop DS + + Mov AX, 4200h + Xor CX, CX + Xor DX, DX + XChg CX, [DS:SI+4Ah] + XChg DX, [DS:SI+48h] + Int 21h ; Move file pointer. + + Mov AX, DI + Dec AX + + Call D_LoadSampleData + Jmp D_LoadXMFinalSamplesPresent + +D_LoadXMFinalSamples2: + Mov DWord Ptr [SI+48h], 0 + +D_LoadXMFinalSamplesPresent: + Pop ES + Pop CX + Inc CX + Cmp CX, 100 + JBE D_LoadXMFinalSamples1 + + Jmp D_PostLoadModule + +EndP D_LoadXM + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_LoadMTM Far + + Xor AX, AX + Call D_PreLoadModule + + Assume DS:Nothing + + Mov AH, 3Fh + Mov CX, 66 ; Song header length. + Mov DX, 60000 + Int 21h + + Mov DI, 4 + Mov CX, 20 + Mov SI, 60004 + Rep MovsB + Xor AX, AX + Mov CX, 8 + Rep StosB ; Song name. + Mov AL, [DS:60027] + StosW ; Order num + Xor AL, AL + StosW ; Inst num + Mov AL, [DS:60030] + StosW ; Sample number. + Mov AL, [DS:60026] + StosW ; Pattern number + + Add DI, 4 +; Mov AX, 101h ; Cwt/v 1.0 +; StosW +; Mov AX, 100h ; Cmwt 1.0 +; StosW + + Mov AX, 31h ; Stereo. No Vol0Opt + StosW ; Use samples, old eff + Xor AX, AX + StosW + Mov AX, 3080h ; GlobalVol+MixVol + StosW + Mov AX, 7D06h + StosW + Mov AL, 128 + StosB + Xor AL, AL + Mov CX, 11 + Rep StosB + + Mov CX, 32 + Mov DX, 0 + Xor AH, AH + ; Panning positions +D_LoadMTM1: + Mov SI, 60034 + Add SI, DX + Mov AL, [DS:SI] + Mov SI, AX + Mov AL, [CS:PanningPositions+SI] + StosB + + Inc DX + Loop D_LoadMTM1 + + Mov CX, 32 + Mov AL, 160 + Rep StosB + Mov AL, 64 + Mov CX, 64 + Rep StosB + + Push DS + + Push CS + Pop DS + Assume DS:Disk + + Mov SI, Offset SampleHeaderMsg + Mov AH, 5 + Mov DI, (4+16*80)*2 + Call S_DrawString + + Pop DS + Assume DS:Nothing + + Mov AL, 37 + Mul Byte Ptr [ES:24h] ; AX = length of + ; sample headers + Mov CX, AX ; length.. + Mov AH, 3Fh ; read file.. + Xor DX, DX + Int 21h + + + Mov DH, [ES:24h] + Mov DI, 55912 ; Start of samples. + Xor SI, SI ; DS:SI points to MTM header. + +D_LoadMTM2: + Mov EAX, 'SPMI' + StosD + Xor AX, AX + Mov CX, 6 + Rep StosW ; Clear file name. + StosB + Mov AL, 40h + StosB + + + Mov AL, [DS:SI+36] + And AL, 1 + Add AL, AL + + Cmp DWord Ptr [DS:SI+22], 0 + JE D_LoadMTM3 ; Sample length = 0. + + Or AL, 1 ; Else there's a sample. + +D_LoadMTM3: + Mov ECX, [SI+30] ; Sample loop end + Sub ECX, [SI+26] ; Sample loop start + Cmp ECX, 2 + JBE D_LoadMTM4 + + Or AL, 16 + +D_LoadMTM4: + StosB + Mov DL, AL + Mov AL, [DS:SI+35] + StosB + + Push SI + + Mov CX, 22 + +D_LoadMTMSampleName: + LodsB + StosB + And AL, AL + LoopNZ D_LoadMTMSampleName + Pop SI + + Xor AL, AL + Add CX, 5 + Rep StosB ; Filler. + Mov AL, 32 + StosB + + Mov EAX, [DS:SI+22] + StosD + + Test DL, 1 + JNZ D_LoadMTM5 + + Xor AX, AX + Mov CX, 4 + Rep StosW ; Clear rest of sample field. + Mov AX, 8363 ; (no sample) + StosW + Xor AX, AX + Mov CX, 9 + Rep StosW + + Jmp D_LoadMTM8 + +D_LoadMTM5: + Test DL, 16 + JZ D_LoadMTM6 + + Mov EAX, [DS:SI+26] + StosD + Mov EAX, [DS:SI+30] + StosD + Jmp D_LoadMTM7 + +D_LoadMTM6: + Xor AX, AX + Mov CX, 4 + Rep StosW + +D_LoadMTM7: ; C5 speed here... + Push SI + Mov AL, [DS:SI+34] + And AX, 0Fh + Mov SI, AX + Add SI, SI + Mov AX, [CS:FineTuneTable+SI] + Pop SI + StosW + Xor AX, AX + Mov CX, 9 + Rep StosW + +D_LoadMTM8: + Add SI, 37 + Dec DH + JNZ D_LoadMTM2 ; Finished with samples. + + Mov AH, 3Fh + Mov CX, 128 + Xor DX, DX + Int 21h ; Order data. + + Mov CL, [DS:60027] + Inc CX + Xor CH, CH + Mov DX, 256 + Sub DX, CX + Xor SI, SI + Mov DI, 256 + Rep MovsB + Mov CX, DX + Mov AL, 0FFh + Rep StosB ; Order list done. + ; Now it's time to do the + ; friggen pattern stuff. + Mov AL, 37 + Mul Byte Ptr [DS:60030] + Add AX, 66+128 + Push AX + + Mov AX, 192 + Mul Word Ptr [DS:60024] + ; DX:AX = length of track data. + Mov BP, DX + Mov CX, AX + Xor DX, DX + Pop AX + Add CX, AX + AdC BP, 0 + ; BP:CX = offset to sequencer +D_LoadMTM9: ; DX = pattern no. + ; AX = offset to track data. + Push AX + Push CX + Push DX + + Push AX + + Push DS + Push SI + Push DI + + Push CS + Pop DS + Assume DS:Disk + + Mov SI, Offset PatternMsg + Mov AH, 5 + Mov DI, (4+17*80)*2 + Push DX + Call S_DrawString + Pop AX + + Pop DI + Pop SI + Pop DS + Assume DS:Nothing + + + Mov AX, 4200h + Mov DX, CX + Mov CX, BP + Int 21h ; Move to offset. + + Mov AH, 3Fh + Mov CX, 64 + Xor DX, DX + Int 21h ; Read seq data. + + Pop AX + + Mov CX, 32 + Xor SI, SI + Mov DX, AX ; DX = posn of track data. + Mov DI, 10000 + +D_LoadMTM10: + Push CX + Push DX + + LodsW + And AX, AX + JZ D_LoadMTM11 + + Push DS + Push SI + Push DI + Mov SI, 33 + Sub SI, CX + Push AX + Push SI + + Push CS + Pop DS + Assume DS:Disk + + Mov SI, Offset TrackMsg + Mov DI, (5+18*80)*2 + Mov AH, 5 + Call S_DrawString + + Pop SI + Pop AX + Pop DI + Pop SI + Pop DS + Assume DS:Nothing + + Push DX + + Dec AX + Mov CX, 192 + Mul CX + + Pop CX + Add AX, CX + AdC DX, 0 + Mov CX, DX + Mov DX, AX + Mov AX, 4200h + Int 21h ; Move ptr. + + Mov AH, 3Fh + Mov CX, 192 + Mov DX, DI + Int 21h + + Add DI, 192 + Jmp D_LoadMTM12 + +D_LoadMTM11: + Push ES + + Push DS + Pop ES + + Mov CX, 192 + Xor AL, AL + Rep StosB + + Pop ES + +D_LoadMTM12: + Pop DX + Pop CX + Loop D_LoadMTM10 + + Mov SI, 10000 + ; DS:SI points to pattern data. + + Pop DX + ; DX = pattern number + ; DS:SI = pattern data. + Call PE_TranslateMTMPattern + + Pop CX + Pop AX + Add CX, 64 + AdC BP, 0 + Inc DX + Cmp DL, [DS:60026] + JBE D_LoadMTM9 + + ; BP:CX points to comment + + Comment & + + Mov AL, 37 + Mul Byte Ptr [DS:60030] + ; AX = 37*NOS + Add AX, 194 + Add AX, Word Ptr [DS:60028] ; AX = 194+NOS*37+length_comment + Mov CX, AX + Mov AX, 192 + Mul Word Ptr [DS:60024] ; DX:AX = trcks*192 + Mov BP, DX + Add CX, AX + AdC BP, 0 ; BP:CX = 194+NOS*37+trcks*192+ + ; length(comment) + Mov AL, 64 + Mov AH, Byte Ptr [DS:60026] + Inc AH + Mul AH + Add CX, AX + AdC BP, 0 ; BP:CX = 194+NOS*37+trcks*192+ + ; 64*patterns+length(comment) + + & + +; Add CX, [DS:60028] ; Skip past comment -> samples. +; AdC BP, 0 +; + Mov AX, 4200h + Mov DX, CX + Mov CX, BP + Int 21h ; File is at pointers to samps. + + Mov CX, [DS:60028] ; Length of message + Call Msg_GetMessageOffset ; Sets up DS:DX + Mov AH, 3Fh + Int 21h + ; Now to 'process' the message. + + Mov SI, DX + Mov CX, AX + + Xor DX, DX ; DX = character count. + +D_LoadMTMMessage1: + Mov AL, [SI] + And AL, AL + JNZ D_LoadMTMMessage2 + + Mov Byte Ptr [SI], 32 ; spacebar. + +D_LoadMTMMessage2: + Inc DX + Cmp DX, 40 + JB D_LoadMTMMessage3 + + Xor DX, DX + Mov Byte Ptr [SI], 13 ; Enter! + +D_LoadMTMMessage3: + Inc SI + Loop D_LoadMTMMessage1 + + Push ES + Pop DS + Mov SI, 55912 ; DS:SI points to sample headers + Xor CX, CX + +D_LoadMTM13: + Push CX + Push SI + Test Byte Ptr [DS:SI+12h], 1 + JZ D_LoadMTM14 + ; OK.. have a sample to load. + Push DS + Push SI + + Push CS + Pop DS + Mov SI, Offset SampleMsg + Mov DI, (4+20*80)*2 + Mov AX, CX + Inc AX + Push AX + Mov AH, 5 + Call S_DrawString + Pop AX + Dec AX + + Pop SI + Pop DS + + Call D_LoadSampleData + +D_LoadMTM14: + Pop SI + Pop CX + Inc CX + Add SI, 80 + Cmp CX, 100 + JB D_LoadMTM13 + + Jmp D_PostLoadModule + +EndP D_LoadMTM + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_LoadS3M Far + + Mov AL, 1 + Call D_PreLoadModule + + Mov AH, 3Fh + Mov CX, 60h + Mov DX, 60000 + Int 21h + + Mov DI, 4 + Mov CX, 25 + Mov SI, 60000 + Rep MovsB + Xor AL, AL + StosB + Add DI, 14 + + Mov AX, 10h ; Old Effects + + Test Byte Ptr [DS:60000+33h], 80h + JZ D_LoadS3M1 + + Inc AX + +D_LoadS3M1: + Test Byte Ptr [DS:60000+26h], 8 + JZ D_LoadS3M2 + + Or AL, 2 + +D_LoadS3M2: + StosW + Xor AX, AX + StosW + Mov AL, [DS:60000+30h] + ShL AL, 1 + StosB + Mov AL, [DS:60000+33h] + And AL, 127 + StosB + Mov AX, [DS:60000+31h] + StosW + Mov AL, 128 + StosB + Add DI, 7 + + Mov EAX, [DS:60000+38h] + Cmp Word Ptr [DS:60000+28h], 3208h + JB D_ConvertS3MTimer + + Xor EAX, 'ITRK' + RoR EAX, 7 + Neg EAX + RoL EAX, 4 + Xor EAX, 'JTHL' + +D_ConvertS3MTimer: + StosD + ; OK, panning now... + Mov SI, 60000+40h + Mov CX, 32 + +D_LoadS3M3: + LodsB + + Mov DL, 32+128 + Cmp AL, 128 + JAE D_LoadS3M4 + + Mov AH, AL + +; Test Byte Ptr [DS:60000+33h], 128 +; JZ D_LoadS3M5 + + And AL, 127 + + Mov DL, 0 + Cmp AL, 7 + JBE D_LoadS3M4 + + Mov DL, 64 + Cmp AL, 15 + JBE D_LoadS3M4 + + Mov DL, 32 + +D_LoadS3M4: + Mov AL, DL + And AH, 80h + + StosB + Loop D_LoadS3M3 + + Mov CX, 32 + Mov AL, 32+128 + Rep StosB + + Mov CX, 64 + Mov AL, 64 + Rep StosB + + Mov DI, 100h + Mov CX, 256 + Mov AL, 255 + Rep StosB + + Push DS + + Mov CX, [DS:60000+20h] + Push ES + Pop DS + Mov DX, 100h + Mov AH, 3Fh + Int 21h + + Pop DS ; Order list loaded. + + Mov AH, 3Fh + Mov CX, [DS:60000+22h] + Add CX, [DS:60000+24h] + Add CX, CX + Xor DX, DX + Int 21h + + Cmp Byte Ptr [DS:60000+35h], 252 + JNE D_LoadS3M15 + + Mov AH, 3Fh + Mov CX, 32 + Mov DX, 1024 + Int 21h + + Mov CX, 32 + Mov SI, 1024 + Mov DI, 64 + +D_LoadS3M14: + LodsB + Test AL, 32 + JZ D_LoadS3M16 + + Mov AH, [ES:DI] + And AX, 800Fh + ShL AL, 1 + ShL AL, 1 + Add AL, 2 + Or AL, AH + Mov [ES:DI], AL + +D_LoadS3M16: + Inc DI + + Loop D_LoadS3M14 + +D_LoadS3M15: + Mov CX, 1 ; Load instruments + Mov DI, 55912 + +D_LoadS3M7: + Push CX + Push DI + + Push DI + Push DS + + Mov SI, CX + Dec SI + Add SI, SI + Mov DX, [SI] + + Push CS + Pop DS + Push CX ; For Drawstring. + + Mov AX, 4200h + Xor CX, CX + ShLD CX, DX, 4 + ShL DX, 4 + Int 21h + + Mov SI, Offset SHLoadMsg + Mov DI, (4+16*80)*2 + Mov AH, 5 + Call S_DrawString + Pop AX + + Pop DS + Pop DI + + Mov DX, 1024 ; Load inst. header. + Mov CX, 80 + Mov AH, 3Fh + Int 21h + + Mov EAX, 'SPMI' + StosD + + Mov SI, 1025 + Mov CX, 12 + Rep MovsB + Xor AL, AL + StosB + Mov AL, 64 + StosB + + Xor AL, AL + + Cmp Byte Ptr [DS:1024], 1 + JNE D_LoadS3M8 + + Mov AL, [DS:1024+1Fh] + ShR AL, 1 + And AL, 2 + + Cmp Word Ptr [DS:1024+10h], 0 + JE D_LoadS3M8 + + Inc AX + +D_LoadS3M8: + Mov CL, [DS:1024+1Fh] + Mov CH, CL ; CL = 1 -> loop + And CL, 1 + ShL CL, 4 + Or AL, CL ; Loop... + + And CH, 4 + ShR CH, 1 + Or AL, CH ; 16 bit. + +D_LoadS3M9: + StosB + Mov AL, [DS:1024+1Ch] + StosB + Mov SI, 1024+30h + Mov CX, 25 + Rep MovsB + Xor AX, AX + StosW + Mov AL, 32 + StosB + + Mov EAX, [DS:1024+10h] + StosD ; Length + + Mov EAX, [DS:1024+14h] + StosD ; LoopBeg + + Mov EAX, [DS:1024+18h] + StosD ; LoopEnd + + Mov EAX, [DS:1024+20h] + StosD ; C5Spd + + Xor AX, AX + StosW + StosW ; Susloopbegin + + StosW + StosW ; SusLoopEnd + + Cmp Byte Ptr [DS:1024], 1 + JE D_LoadS3M22 + + Xor AX, AX + StosW + StosW + Jmp D_LoadS3M23 + +D_LoadS3M22: + Mov CL, 4 + Mov AX, [DS:1024+0Eh] + Mov DL, [DS:1024+0Fh] + Mov DH, [DS:1024+0Dh] + ShL AX, CL + ShR DX, CL + StosW ; Sample pointer in file. + Mov AX, DX + StosW + + Xor AX, AX + +D_LoadS3M23: + StosW ; Vibrato info... + StosW + + Pop DI + Pop CX + Add DI, 80 + Inc CX + + Cmp CX, 100 + JAE D_LoadS3M10 + + Cmp CX, [DS:60000+22h] + JBE D_LoadS3M7 + +D_LoadS3M10: + Push DS + + Mov CX, 1 ; CX = sample number (base 1) + ; DS = doesn't matter + ; ES = songdata segment + +D_LoadS3M17: ; OK, now load the samples. + Push CX + Push ES + + Mov SI, CX + Dec SI + Add SI, SI + Mov SI, [ES:64912+SI] + Test Byte Ptr [ES:SI+12h], 1 + JZ D_LoadS3M18 + + Push CS + Pop DS + + Push SI + Mov SI, Offset SampleMsg + Mov DI, (4+17*80)*2 + Mov AH, 5 + Push CX + Call S_DrawString + Pop DI + Pop SI ; ES:SI points to sample header. + ; DI = sample number+1 + Push ES + Pop DS + + Mov AX, 4200h + Xor CX, CX + Xor DX, DX + XChg CX, [DS:SI+4Ah] + XChg DX, [DS:SI+48h] + Int 21h ; Move file pointer. + + Mov AX, DI + Dec AX + + Call D_LoadSampleData + Jmp D_LoadS3MSamplePresent + +D_LoadS3M18: + Mov DWord Ptr [SI+48h], 0 + +D_LoadS3MSamplePresent: + Pop ES + Pop CX + Inc CX + Cmp CX, 100 + JBE D_LoadS3M17 + + Pop DS + + Mov CX, 0 ; CX = pattern number + ; DS = disktransfer + +D_LoadS3M11: + Push CX ; Load patterns.... + + Push DS + + Push CS + Pop DS + + Mov DI, (4+18*80)*2 + Mov SI, Offset PatternMsg + Mov AH, 5 + Push CX + Call S_DrawString + Pop SI ; SI = Pattern Number + + Pop DS + + Add SI, [DS:60000+22h] + Add SI, SI + Mov DX, [SI] ; DX = offset of pattern / 16 + And DX, DX + JZ D_LoadS3M13 + + Push CX + + Xor CX, CX + ShLD CX, DX, 4 + ShL DX, 4 + Mov AX, 4200h + Int 21h + + Mov AH, 3Fh ; Load data. + Mov CX, 2 + Mov DX, 1024 + Int 21h + Mov AH, 3Fh + Mov CX, [DS:1024] + Mov DX, 1024 + Int 21h ; Pattern data at DS:1024 + + Pop DX ; DX = Pattern number + Mov SI, 1024 + Call PE_TranslateS3MPattern + +D_LoadS3M13: + Pop CX + Inc CX + Cmp CX, 100 + JA D_LoadS3M12 + + Cmp CX, [DS:60000+24h] + JB D_LoadS3M11 + +D_LoadS3M12: + Jmp D_PostLoadModule + + Ret + +EndP D_LoadS3M + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_Load669 Far + + Xor AX, AX + Call D_PreLoadModule + + Mov AH, 3Fh + Mov CX, 1F1h + Mov DX, 60000 + Int 21h + + Mov SI, 60000+2 + Mov DI, 4 + Mov CX, 25 + Rep MovsB + + Xor AX, AX + Mov CX, 7 + Rep StosB + Mov SI, 60000+6Eh + LodsB + StosW + LodsB + StosW + + Add DI, 4 + Mov AX, 19h ; Stereo control, sample controlled, + StosW ; Linear, Old EFX + Xor AX, AX + StosW ; Song message attached. + + Mov AX, 3080h ; GV/MV + StosW + + Mov AX, 78*100h+6h ; 78 BPM, speed 6 + StosW + + Mov AX, 64 ; Separation of 64 + StosW + Xor AX, AX + Mov CX, 5 + Rep StosW + + Mov AX, 4000h + StosW + StosW + StosW + StosW + Mov AL, 32+128 + Mov CX, 56 + Rep StosB ; Channel pan + Mov AL, 64 + Mov CL, AL + Rep StosB ; Channel volume + + Mov SI, 60000+71h + Mov DI, 100h ; Orders + Mov CL, 80h + Rep MovsB + Mov CL, 80h + Mov AL, 0FFh + Rep StosB ; Orders done. + + Xor BP, BP ; Sample time + + Mov DI, 512+55400 + Mov AL, 25 + Mul Byte Ptr [DS:60000+6Eh] + Mov CX, AX ; CX = bytes to read + Mov AH, 3Fh + Xor DX, DX + Int 21h + Xor SI, SI + +D_Load669_1: + Cmp BP, [ES:24h] + JAE D_Load669_2 + + Mov EAX, 'SPMI' + StosD + Mov CX, 6 + Rep MovsW + Mov AX, 4000h + StosW + + ; Flag, volume + Mov AH, 60 + Inc SI + Mov ECX, [SI] + Test ECX, ECX + JZ D_Load669_3 + + Xor EAX, EAX + Mov [ES:DI+22h], EAX + Mov [ES:DI+26h], EAX + + Mov AX, 3C01h ; Sample present + + Mov ECX, [SI+8] ; End loop + + Cmp ECX, [SI] + JA D_Load669_3 + + Sub ECX, [SI+4] ; Start loop + JC D_Load669_3 + Cmp ECX, 2 + JB D_Load669_3 + + Mov ECX, [SI+4] + Mov [ES:DI+22h], ECX + Mov ECX, [SI+8] + Mov [ES:DI+26h], ECX + + Mov AX, 3C11h ; Sample present, forwards loop + +D_Load669_3: + StosW + Mov CX, 13 + Sub SI, CX + Rep MovsB + Xor AL, AL + Mov CX, 13 + Rep StosB + Mov AH, 32 + StosW ; Convert, DfP + MovsW + MovsW + Add SI, 8 + Add DI, 8 + + Mov AX, 8363 + StosW + + Xor AX, AX + Mov CX, 9 + Rep StosW + + Inc BP + Jmp D_Load669_1 + +D_Load669_2: ; OK.. patterns.. + Xor BP, BP ; BP = pattern number + +D_Load669_4: + Cmp BP, [ES:26h] + JAE D_Load669_5 + + Mov AH, 3Fh + Mov CX, 600h + Xor DX, DX + Int 21h ; Patterns at DS:0 + + Mov AH, [DS:60000+0F1h+BP] + Mov CL, [DS:60000+171h+BP] + Call PE_Translate669Pattern + + Inc BP + Jmp D_Load669_4 + +D_Load669_5: ; Samples + + Xor BP, BP + Push ES + Pop DS + +D_Load669Samples: + Inc BP + Cmp BP, [DS:24h] + JA D_Load669End + + Mov SI, BP + Add SI, SI + Mov SI, [DS:64910+SI] + Test Byte Ptr [DS:SI+12h], 1 ; Sample present? + JZ D_Load669Samples + + Push DS + Push SI + + Push CS + Pop DS + + Push BP + Mov SI, Offset SampleMsg + Mov DI, (4+16*80)*2 + Mov AH, 5 + Call S_DrawString + + Pop AX + Pop SI + Pop DS + + Dec AX + Call D_LoadSampleData + + Jmp D_Load669Samples + +D_Load669End: + Jmp D_PostLoadModule + +EndP D_Load669 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_LoadMOD Far + + Xor AX, AX + Call D_PreLoadModule + + Mov AH, 3Fh + Mov CX, 2048 + Mov DX, 60000 + Int 21h + + Mov SI, 60000 + Mov DI, 4 + Mov CX, 20 + Rep MovsB ; Song name + Xor AX, AX + Mov CX, 8 + Rep StosW + Add DI, 4 + Mov AX, 31h ; Old effects, stereo, sample control + StosW + Xor AX, AX + StosW + Mov AX, 3080h ; GV/MV + StosW + + Mov AX, 07D06h ; 125 BPM, speed 6 + StosW + + Mov AX, 64 ; Separation of 64 + StosW + + Xor AX, AX + Mov CX, 5 + Rep StosW + + Mov DL, CS:MODNumberOfChannels + Mov CX, 64 + Cmp DL, 8 + JBE D_LoadMOD13 + + Mov CL, DL + Mov AL, 32 + Rep StosB + Mov CL, 64 + Sub CL, DL + Jmp D_LoadMOD14 + +D_LoadMOD13: + Mov AX, 4000h ; Panning. + StosW + Mov AX, 40h + StosW + Sub CX, 4 + + Cmp DL, 4 + JBE D_LoadMOD14 + + Mov AX, 4000h + StosW + Sub CX, 2 + Cmp DL, 6 + JBE D_LoadMOD14 + + Mov AX, 40h + StosW + Sub CX, 2 + +D_LoadMOD14: + Mov AL, 32+128 + Rep StosB ; Clear Panning + + Mov AL, 64 + Mov CX, 64 + Rep StosB ; Channel Volume + + Mov DI, 256 + Mov CX, 256 + Mov AL, 0FFh + Rep StosB ; Orders. + + Mov DI, 256 + Xor CH, CH + Mov CL, CS:MODNumberOfOrders + Mov SI, CS:MODOrderOffset + Mov DX, SI + Rep MovsB ; copy orders... + + ; Get number of patterns to load + Xor CX, CX + Mov SI, DX + Mov AX, 07F00h + +D_LoadMOD1: + LodsB + Cmp CL, AL + JAE D_LoadMOD2 + + Mov CL, AL + +D_LoadMOD2: + Dec AH + JNZ D_LoadMOD1 + + Inc CX ; CX = number of patterns to + ; load + Push CX + + Push BX + ; setup inst. headers + Xor CH, CH + Mov CL, CS:MODNumberOfInstruments + Mov SI, 60000+20 + Mov DI, 512+55400 + +D_LoadMOD3: + Push CX + + Mov EAX, 'SPMI' + StosD + + Mov CX, 6 + Xor AX, AX + Rep StosW + StosB + Mov AL, 64 + StosB + Xor AL, AL + Mov CX, [DS:SI+28] + XChg CH, CL + Cmp CX, 1 + JBE D_LoadMOD4 + + Or AL, 16 + +D_LoadMOD4: + Mov CX, [DS:SI+22] + XChg CH, CL + Cmp CX, 1 + JBE D_LoadMOD5 + + Or AL, 1 + +D_LoadMOD5: + StosB + Mov AL, [DS:SI+25] + StosB + Mov CX, 22 + Rep MovsB + Xor EAX, EAX + StosD + + Mov AX, 1+32*256 ; Convert signed->Unsigned + StosW ; Default pan of 32 + + LodsW + XChg AH, AL ; Sample length... + Add EAX, EAX + StosD + Mov EDX, EAX ; EDX = length + + MovZX EAX, Word Ptr [DS:SI+2] ; Loop begin + XChg AH, AL + + Cmp CS:MODOrderOffset, 60472 + JE D_LoadMOD15 + + Add EAX, EAX + +D_LoadMOD15: + Cmp EAX, EDX + JBE D_LoadMODLengthCheck1 + + Xor EAX, EAX + +D_LoadMODLengthCheck1: + StosD + Mov ECX, EAX + + MovZX EAX, Word Ptr [DS:SI+4] ; Loop end + XChg AH, AL + + Cmp CS:MODOrderOffset, 60472 + JE D_LoadMOD16 + + Add EAX, EAX + +D_LoadMOD16: + Add EAX, ECX + Cmp EAX, EDX + JBE D_LoadMODLengthCheck2 + + Mov EAX, EDX + +D_LoadMODLengthCheck2: + StosD + + LodsB ; C5Speed. + And AX, 15 + Mov BX, AX + Add BX, BX + Mov AX, [CS:FineTuneTable+BX] + StosW + Xor AX, AX + Mov CX, 9 + Rep StosW + + Add SI, 5 + + Pop CX + Loop D_LoadMOD3 + + Pop BX ; Now to load mod patterns. + + Mov AX, 4200h + Xor CX, CX + Mov DX, CS:MODPatternOffset + Int 21h ; set offset in file... + + Pop CX + Xor AX, AX ; Start with pattern 0 + +D_LoadMOD6: + Cmp AX, CX + JAE D_LoadMOD7 + + Push AX + Push CX + + Push DS + + Push CS + Pop DS + + Push AX ; AX = pattern num. + Mov SI, Offset PatternMsg + Mov DI, (4+16*80)*2 + Mov AH, 5 + Call S_DrawString + + Pop DX ; DX = pattern num + Pop DS + + Push DX + + Mov AH, 3Fh + Mov CH, CS:MODNumberOfChannels + Xor CL, CL + Xor DX, DX + Int 21h ; DS:0 contains pat data + + Pop DX + Xor SI, SI + Mov AL, CS:MODNumberOfChannels + Xor AH, AH + + Call PE_TranslateMODPattern + + Pop CX + Pop AX + Inc AX + Jmp D_LoadMOD6 + + +D_LoadMOD7: ; Finished loading patterns + Mov CX, 1 ; Time to load samples. + +D_LoadMOD8: + Push CX + Push ES + + Mov SI, CX + Dec SI + Add SI, SI + Mov SI, [ES:64912+SI] + + Test Byte Ptr [ES:SI+12h], 1 + JZ D_LoadMOD9 + + Push SI + + Push CS + Pop DS + + Push CX + Mov SI, Offset SampleMsg + Mov DI, (4+17*80)*2 + Mov AH, 5 + Call S_DrawString + +; Mov AX, 4201h +; Xor CX, CX +; Mov DX, 4 +; Int 21h ; Progress pointer + + Pop AX + + Pop SI + + Push ES + Pop DS + + Dec AX ; AX = sample to load. + Call D_LoadSampleData + +D_LoadMOD9: + Pop ES + Pop CX + Inc CX + Cmp CL, CS:MODNumberOfInstruments + JBE D_LoadMOD8 + +D_LoadMOD12: + Jmp D_PostLoadModule + + Ret + +EndP D_LoadMOD + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +ENDIF + +Proc ConvertOldInstrument ; DS:SI points to inst. + + PushAD + Push DS + Push ES + + Push DS + Pop ES + + Mov DI, SI + + Mov AL, [SI+11h] ; Old format Flg + Mov [SI+130h], AL + + Mov EAX, [SI+12h] ; VLS, VLE, SLS, SLE + Mov [SI+132h], EAX + + Mov AX, [SI+18h] ; Fadeout + Add AX, AX + Mov [SI+14h], AX + + Mov AL, [SI+1Ah] + Mov [SI+11h], AL + + Xor AX, AX + Mov AL, [SI+1Bh] + Mov [SI+12h], AX ; DCT + + Mov AX, 60*256 ; PPS, PPC + Mov [SI+16h], AX + + Mov AX, 128+(32+128)*256 ; GbV+DfP + Mov [SI+18h], AX + + Xor AX, AX + Mov [SI+1Ah], AX + ; Now for envelope + Push SI + Xor CX, CX + + Add SI, 1F8h + Add DI, 136h + +D_LoadITInstrument2: + LodsW + Cmp AX, 0FFFFh + JE D_LoadITInstrument3 + + Mov [DI], AH ; Magintude + Xor AH, AH + Mov [DI+1], AX ; Tick + + Add DI, 3 + Inc CX + Cmp CL, 25 + JAE D_LoadITInstrument3 + + Jmp D_LoadITInstrument2 + +D_LoadITInstrument3: + Pop SI + Mov [SI+131h], CL + + Mov CX, SI + Add CX, 554 + Sub CX, DI + Xor AL, AL + Rep StosB + + Mov Byte Ptr [SI+183h], 2 ; Num nodes for panning + pitch + Mov Byte Ptr [SI+1D5h], 2 + + Mov Byte Ptr [SI+18Ch], 99 ; Magn 0 at Tick 99 + Mov Byte Ptr [SI+1DEh], 99 ; Magn 0 at Tick 99 + + Pop ES + Pop DS + PopAD + + Ret + +EndP ConvertOldInstrument + +IF TUTORIAL +ELSE + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_LoadIT Far + + Xor AX, AX + Call D_PreLoadModule + + Push DS + + Push CS + Pop DS + Mov SI, Offset HeaderMsg + Mov DI, (4+16*80)*2 + Mov AH, 5 + Call S_DrawString + + Pop DS + + Mov AH, 3Fh + Mov CX, 2048 + Xor DX, DX + Int 21h + + Cmp Word Ptr [DS:28h], 208h + JB D_ConvertITTimer + + Mov EAX, [DS:3Ch] + Xor EAX, 'ITRK' + RoR EAX, 7 + Neg EAX + RoL EAX, 4 + Xor EAX, 'JTHL' + Mov [DS:3Ch], EAX + +D_ConvertITTimer: + Test Byte Ptr [DS:2Eh], 2 ; Time data? + JZ D_LoadTimeDataNone + + ; Seek to 0C0+Orders+ + ; (ins+samp+pat)*4 + Mov DX, [DS:22h] + Add DX, [DS:24h] + Add DX, [DS:26h] + ShL DX, 2 + Add DX, [DS:20h] + Add DX, 0C0h + Xor CX, CX + Mov AX, 4200h + Int 21h + + Push DS + + Push CS + Pop DS + + Mov AH, 3Fh + Mov CX, 2 + Mov DX, Offset NumTimerData + Int 21h + + Push BX ; Allocate data for timedata + Mov BX, NumTimerData + Cmp BX, 0FFFFh + JNE D_NoTimerDataOverFlow + + Dec BX + Mov NumTimerData, BX + +D_NoTimerDataOverFlow: + Mov CX, BX + ShR BX, 1 + Inc BX + Mov AH, 48h + Int 21h + Pop BX + JC D_LoadTimeDataEnd + + Mov TimerData, AX + Mov DS, AX + ShL CX, 3 + Xor DX, DX + Mov AH, 3Fh + Int 21h + +D_LoadTimeDataEnd: + Pop DS + +D_LoadTimeDataNone: + Test Byte Ptr [DS:2Eh], 8 + JZ D_LoadMIDIConfigDataNone + + PushA + Push DS + + Call Music_GetMIDIDataArea + Xor DX, DX + Mov CX, 4896 + Mov AH, 3Fh + Int 21h + + Pop DS + PopA + +D_LoadMIDIConfigDataNone: + Test Byte Ptr [DS:2Eh], 1 + JZ D_LoadITMsg1 + ; Load the message + ; Move to offset first. + Mov AX, 4200h + Mov CX, [DS:3Ah] + Mov DX, [DS:38h] + Int 21h ; Seek to position + + Push DS + + Mov CX, [DS:36h] + Call Msg_GetMessageOffset + Mov AH, 3Fh + Int 21h + + Pop DS + +D_LoadITMsg1: + ; Actually, load row hilights first... + Test Byte Ptr [DS:2Eh], 4 + JZ D_LoadITNoHilight + + Mov AX, [DS:1Eh] + Push DS + + Push Pattern + Pop DS + Assume DS:Pattern + Mov Word Ptr [RowHilight1], AX + + Pop DS + Assume DS:Nothing + +D_LoadITNoHilight: + Xor SI, SI + Xor DI, DI + Mov CX, 192 + Rep MovsB ; Header + + Mov DI, 256 + Mov CX, [DS:20h] + + Mov DX, DI + Dec CX + Sub DX, CX + Rep MovsB ; Orders + Mov AL, 0FFh + Mov CX, DX + Rep StosB + + Inc SI ; SI points to first + ; pointer + + Xor BP, BP ; Instrument time. + +D_LoadIT1: + Cmp BP, [DS:22h] + JAE D_LoadIT2 + + Push DS + Push SI + + Push CS + Pop DS + Mov SI, Offset InstrumentMsg + Mov AX, BP + Inc AX + Push AX + Mov AH, 5 + Mov DI, (4+17*80)*2 + Call S_DrawString + Pop AX + + Pop SI + Pop DS + ; Move to offset.. + LodsW + Mov DX, AX + LodsW + Mov CX, AX + Mov AX, 4200h + Int 21h + + Mov DI, [DS:2Ah] ; Format version + + Push DS + Push SI + + Push ES + Pop DS + Mov SI, BP + Add SI, SI + Mov DX, [DS:64712+SI] + Mov CX, 554 + Mov AH, 3Fh + Int 21h + + Cmp DI, 200h + JAE D_LoadITInstrument1 + + Mov SI, DX + Call ConvertOldInstrument + +D_LoadITInstrument1: + Pop SI + Pop DS + Inc BP + Jmp D_LoadIT1 + +D_LoadIT2: + Xor BP, BP ; Sample header time. + +D_LoadIT3: + Cmp BP, [DS:24h] + JAE D_LoadIT4 + + Push DS + Push SI + + Push CS + Pop DS + Mov SI, Offset SHLoadMsg + Mov AX, BP + Inc AX + Push AX + Mov AH, 5 + Mov DI, (4+18*80)*2 + Call S_DrawString + Pop AX + + Pop SI + Pop DS + ; Move to offset.. + LodsW + Mov DX, AX + LodsW + Mov CX, AX + Mov AX, 4200h + Int 21h + + Push DS + Push SI + + Push ES + Pop DS + + Mov SI, BP + Add SI, SI + Mov DX, [DS:64912+SI] + Mov CX, 80 + Mov AH, 3Fh + Int 21h + + Pop SI + Pop DS + Inc BP + Jmp D_LoadIT3 + +D_LoadIT4: + Xor BP, BP + + Push DS + Push SI + + + Push ES + Pop DS ; DS now points to song data. + +D_LoadIT7: + Mov SI, BP + Add SI, SI + Mov SI, [64912+SI] + + Test Byte Ptr [DS:SI+12h], 1 + JZ D_LoadIT8 + + Push DS + Push SI + + Push CS + Pop DS + Mov SI, Offset SampleMsg + Mov AX, BP + Inc AX + Push AX + Mov AH, 5 + Mov DI, (4+19*80)*2 + Call S_DrawString + Pop AX + + Pop SI + Pop DS + + Mov AX, 4200h + Xor CX, CX + Xor DX, DX + XChg DX, [DS:SI+48h] + XChg CX, [DS:SI+4Ah] + Int 21h ; Move file pointer. + + Mov AX, BP + Call D_LoadSampleData + Jmp D_LoadITSamplePresent + +D_LoadIT8: + Mov DWord Ptr [SI+48h], 0 + +D_LoadITSamplePresent: + Inc BP + Cmp BP, 99 + JB D_LoadIT7 + + Pop SI + Pop DS + + Xor BP, BP + +D_LoadIT5: + Cmp BP, [DS:26h] ; Pattern time. + JAE D_LoadIT6 + + Push ES + + Push DS + Push SI + + Push CS + Pop DS + Mov SI, Offset PatternMsg + Push BP + Mov AH, 5 + Mov DI, (4+20*80)*2 + Call S_DrawString + Pop AX + + Pop SI + Pop DS + ; Move to offset.. + LodsW + Mov DX, AX + LodsW + Mov CX, AX + And DX, DX + JNZ D_LoadIT12 + And CX, CX + JZ D_LoadIT13 + +D_LoadIT12: + Mov AX, 4200h + Int 21h + + Push DS + Push SI + + Mov AH, 3Fh + Mov DX, 60000 + Mov CX, 8 + Int 21h ; DS:DX = pattern header. + + Mov DX, [DS:60000] ; DX = length + Push DX + Add DX, 8 + Mov SI, BP + + Push BX + Call Music_AllocatePattern + ; ES:DI = location. + Pop BX + + Mov AX, ES + And AX, AX + JZ D_LoadIT10 + + Mov SI, 60000 + Mov CX, 8 + Rep MovsB + + Push ES + Pop DS + Mov DX, DI + Mov AH, 3Fh + Pop CX ; CX = length. + Int 21h + + Jmp D_LoadIT11 + +D_LoadIT10: + Pop CX + Push BX + + + Call PEFunction_OutOfMemoryMessage + + Pop BX + +D_LoadIT11: + Pop SI + Pop DS + +D_LoadIT13: + Pop ES + + Inc BP + Jmp D_LoadIT5 + +D_LoadIT6: + Jmp D_PostLoadModule + + Ret + +EndP D_LoadIT + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_LoadFileImpulseModule Far + + Mov SI, 1 + Mov CX, Object1 + Mov DX, Offset O1_LoadITList + + Mov AX, 5 + Ret + +EndP D_LoadFileImpulseModule + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_LoadFileS3MModule Far + + Mov SI, 1 + Mov CX, Object1 + Mov DX, Offset O1_LoadS3MList + + Mov AX, 5 + Ret + +EndP D_LoadFileS3MModule + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_LoadFile669Module Far + + Mov SI, 1 + Mov CX, Object1 + Mov DX, Offset O1_Load669List + + Mov AX, 5 + Ret + +EndP D_LoadFile669Module + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_LoadFileXMModule Far + + Mov SI, 1 + Mov CX, Object1 + Mov DX, Offset O1_LoadXMList + + Mov AX, 5 + Ret + +EndP D_LoadFileXMModule + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_LoadFileMTMModule Far + + Mov SI, 1 + Mov CX, Object1 + Mov DX, Offset O1_LoadMTMList + + Mov AX, 5 + Ret + +EndP D_LoadFileMTMModule + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_LoadFileMODModule Far + + Mov AL, 31 + Mov CL, [DS:60000+950] + Mov DX, 60952 + Mov SI, 1084 + + Cmp Word Ptr [BX+23], 16 + JNE D_LoadFileMODModule1 + + Mov AL, 15 + Mov CL, [DS:60000+470] + Mov DX, 60472 + Mov SI, 600 + +D_LoadFileMODModule1: + Mov CS:MODNumberOfInstruments, AL + Mov CS:MODNumberOfOrders, CL + Mov CS:MODOrderOffset, DX + Mov CS:MODPatternOffset, SI + + Mov SI, [BX+23] + Cmp SI, 17 + JNE D_LoadFileMODModule2 + + Mov AL, [BX+22] + Jmp D_LoadFileMODModule3 + +D_LoadFileMODModule2: + Sub SI, 9 + Mov AL, [CS:MODChannelTable+SI] + +D_LoadFileMODModule3: + Mov CS:MODNumberOfChannels, AL + + Mov SI, 1 + Mov CX, Object1 + Mov DX, Offset O1_LoadMODList + + Mov AX, 5 + Ret + +EndP D_LoadFileMODModule + +ENDIF + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + diff --git a/IT_D_WM.INC b/IT_D_WM.INC new file mode 100644 index 0000000..22e492c --- /dev/null +++ b/IT_D_WM.INC @@ -0,0 +1,1785 @@ +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ +; +; Write module functions +; +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + + +Proc WriteITSampleBlock + + PushAD ; BX = file handle. + Push DS + + Mov DS, CS:DiskDataArea + + Mov DX, [DS:1996] + Mov CX, [DS:1998] + Mov AX, 4200h + Int 21h + + Mov AX, 80 + Mul Word Ptr [DS:24h] + Mov CX, AX + + Mov DX, 2000 + Call D_SaveBlock + +WriteITSampleBlock1: + Pop DS + PopAD + Ret + +EndP WriteITSampleBlock + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +NUMS3MCHANNELS EQU 16 + +BitLUT Label Byte + DB 1, 2, 3, 3, 4, 4, 4, 4 + DB 5, 5, 5, 5, 5, 5, 5, 5 + DB 4, 4, 4, 4, 3, 3, 2 + +BitLUT16 Label Byte + DB 1, 10 SHL 3 + 3, 11 SHL 3 + 5, 11 SHL 3 + 3 + DB 3 DUP (12 SHL 3 + 5), 12 SHL 3 + 3 + DB 7 DUP (13 SHL 3 + 5), 13 SHL 3 + 3 + + DB 13 SHL 3 + 4, 7 DUP (13 SHL 3 + 5) + DB 12 SHL 3 + 4, 3 DUP (12 SHL 3 + 5) + DB 11 SHL 3 + 4, 11 SHL 3 + 5, 10 SHL 3 + 4, 2 + + +Proc D_SaveIT Far + + + Call PE_SaveCurrentPattern + + Call D_UpdateFileName + + Push CS + Pop DS + Assume DS:Disk + + Mov NoSaveError, 0 + + Mov AH, 3Ch + Xor CX, CX ; File type is normal (archive) + Mov DX, Offset SaveFileName ; DS:DX points to filename + Int 21h + JNC D_SaveIT3 + + Call PE_RestoreCurrentPattern + Jmp D_NoSaveMessage + +D_SaveIT3: + Mov BX, AX ; BX = handle + + Mov ES, DiskDataArea + Call Music_GetSongSegment + Mov DS, AX + Assume DS:Nothing ; DS = MusicData + + Xor SI, SI + Xor DI, DI + Mov CX, 192 + Rep MovsB ; Get header. + + ; Now to figure out the + ; orders. + Mov SI, 511 + StD + Mov CX, 256 + +D_SaveIT4: + LodsB + Cmp AL, 0FFh + LoopE D_SaveIT4 + + ClD + + Add CX, 2 + Mov [ES:20h], CX + Dec CX + + Mov SI, 256 + Rep MovsB ; Transfer orders. + Mov AL, 0FFh + StosB + +; Mov AX, 0 +; Test Byte Ptr [DS:2Ch], 4 +; JZ D_SaveIT6 +; + Call Music_GetNumberOfInstruments +; +; D_SaveIT6: + Mov [ES:22h], AX ; Number of instruments + + Call Music_GetNumberOfSamples + Mov [ES:24h], AX ; Number of samples + + Call PE_GetMaxPattern + Inc AX + Mov [ES:26h], AX ; Number of patterns. + + Xor CX, CX ; CX:DX = 'long' offsets. + Mov DX, 0C0h + Add DX, [ES:20h] + Mov AX, [ES:22h] + ShL AX, 2 + Add DX, AX + Mov AX, [ES:24h] + ShL AX, 2 + Add DX, AX + Mov AX, [ES:26h] + ShL AX, 2 + Add DX, AX + + Mov DWord Ptr [ES:36h], 0 + Mov Word Ptr [ES:2Eh], 4 ; Row hilight information + + Push DS + + Push Pattern + Pop DS + Assume DS:Pattern + + Mov AX, Word Ptr [RowHilight1] + + Pop DS + Assume DS:Nothing + + Mov [ES:1Eh], AX + + + Call GetTimerCounter + Sub EAX, EditTimer + + Cmp TimerData, 0 + JE NoTimerData + + Or Byte Ptr [ES:2Eh], 2 ; Contains timer information + + Push ES ; Put time into table. + Push DI + + Mov ES, TimerData + Mov DI, NumTimerData + ShL DI, 3 + Add DI, 4 + StosD + Add DI, 2 + + Add DX, DI ; Long offset progress. + AdC CX, 0 + + Pop DI + Pop ES + +NoTimerData: +; OK.. check for MIDI config save. + Test Byte Ptr [DS:2Ch], 128 + JZ D_SaveITNoMIDIConfig1 + + Add DX, 4896 ; MIDI Config size + AdC CX, 0 + Or Byte Ptr [ES:2Eh], 8 ; MIDI Config. + +D_SaveITNOMIDIConfig1: + + Add EAX, [ES:3Ch] + Xor EAX, 'JTHL' + RoR EAX, 4 + Neg EAX + RoL EAX, 7 + Xor EAX, 'ITRK' + + Mov [ES:3Ch], EAX + + Call Msg_GetMessageLength + Cmp AX, 1 + JE D_SaveITMsg1 + + Or Byte Ptr [ES:2Eh], 1 + Mov Word Ptr [ES:3Ah], 0 + Mov [ES:38h], DX + Mov [ES:36h], AX + Add DX, AX + +D_SaveITMsg1: + Mov BP, [ES:22h] ; Number of instruments + + Mov AX, 214h + + Cmp CS:SaveFormat, 0 + JE D_SaveNewFormat + + Inc AX + Cmp CS:SaveFormat, 3 + JE D_SaveNewFormat + + Mov AX, 200h + +D_SaveOldIT2_1: + Test BP, BP + JNZ D_SaveNewFormat + + Mov AX, 100h + +D_SaveNewFormat: + Inc BP + Mov Word Ptr [ES:28h], TRACKERVERSION + Mov [ES:2Ah], AX + And EBP, 0FFFFh + +D_SaveIT7: + Dec BP + JZ D_SaveIT8 + + Mov SI, [DS:EBP+EBP+64710] + Test Byte Ptr [SI+1D4h], 80h + JZ D_SaveIT216 + + Mov Word Ptr [ES:2Ah], 216h + +D_SaveIT216: + Mov AX, DX + StosW + Mov AX, CX + StosW + Add DX, 554 + AdC CX, 0 + + Jmp D_SaveIT7 + +D_SaveIT8: + Mov BP, [ES:24h] ; Number of samples + Inc BP + Mov [ES:1996], DX ; Store sample position. + Mov [ES:1998], CX + +D_SaveIT9: + Dec BP + JZ D_SaveIT10 + + Mov AX, DX + StosW + Mov AX, CX + StosW + + Add DX, 80 + AdC CX, 0 + + Jmp D_SaveIT9 + +D_SaveIT10: + + Xor BP, BP + +D_SaveIT11: + Cmp BP, [ES:26h] ; Number of patterns + JAE D_SaveIT12 + + Push DS + + Mov AX, BP + Call Music_GetPattern ; DS:SI has pattern + + Mov AX, DS + Cmp AX, Music + JE D_SaveIT1 + + Mov AX, DX + StosW + Mov AX, CX + StosW + + Add DX, [DS:SI] + AdC CX, 0 + Add DX, 8 ; pattern header length = 8. + AdC CX, 0 + + Jmp D_SaveIT22 + +D_SaveIT1: + Xor EAX, EAX + StosD + +D_SaveIT22: + Pop DS + + Inc BP + Jmp D_SaveIT11 + +D_SaveIT12: + ; CX:DX now point to first sample data. + Push CX + Push DX + + Push DS + + Push DI + + Push CS + Pop DS + Mov DI, (4+17*80)*2 + Mov SI, Offset HeaderMsg + Mov AH, 5 + Call S_DrawString + + Pop CX ; CX = length of header. + + Push ES + Pop DS + + Xor DX, DX + Call D_SaveBlock ; Header. + + Test Byte Ptr [DS:2Eh], 2 ; Time information? + JZ D_SaveITTimeData + + Push DS + + Push CS + Pop DS + + Mov CX, 2 + Mov DX, Offset NumTimerData + Inc [DS:NumTimerData] + Call D_SaveBlock + Mov CX, [DS:NumTimerData] + Dec [DS:NumTimerData] + ShL CX, 3 + Mov DS, [DS:TimerData] + Xor DX, DX + Call D_SaveBlock + + Pop DS + +D_SaveITTimeData: + Test Byte Ptr [DS:2Ch], 128 + JZ D_SaveITMIDIConfig + + Push DS + + Mov CX, 4896 + Xor DX, DX + Call Music_GetMIDIDataArea ; Gets DS + Call D_SaveBlock + + Pop DS + +D_SaveITMIDIConfig: + ; Message? + Test Byte Ptr [DS:2Eh], 1 + JZ D_SaveITMsg2 + + Mov CX, [DS:36h] + Push DS + Call Msg_GetMessageOffset + Call D_SaveBlock + Pop DS + +D_SaveITMsg2: + Push CS + Pop DS + Mov DI, (4+18*80)*2 + Mov SI, Offset InstrumentHeaderMsg + Mov AH, 5 + Call S_DrawString + + Pop DS + Cmp Word Ptr [ES:22h], 0 + JE D_SaveIT13 + + Mov AX, 554 + Mul Word Ptr [ES:22h] + Mov DX, 512 + Mov CX, AX + + Call D_SaveBlock ; Instrument headers... + +D_SaveIT13: + Push DS + + Push CS + Pop DS + Mov DI, (4+19*80)*2 + Mov SI, Offset SampleHeaderMsg + Mov AH, 5 + Call S_DrawString + + Pop DS ; DS = song data segment + Mov SI, 55912 ; Start of samples in mem. + Mov AX, 80 + Mul Word Ptr [ES:24h] + Mov DI, 2000 + Mov CX, AX + Rep MovsB + + Pop DX + Pop CX ; CX:DX = sample point. + + Mov BP, [ES:24h] ; Number of samples. + Mov SI, 2000 + Inc BP + +D_SaveIT14: + Dec BP + JZ D_SaveIT16 + Mov AL, [ES:SI+12h] + Mov AH, 1 + + Cmp CS:SaveFormat, 3 + JNE D_SaveNoDD + + Or AH, 4 + +D_SaveNoDD: + Test AL, 1 + JZ D_SaveIT15 + + Or AL, 8 + Cmp CS:SaveFormat, 2 + JNE D_SaveIT214_1 + + And AL, Not 8 + +D_SaveIT214_1: + Mov [ES:SI+48h], DX + Mov [ES:SI+4Ah], CX + + Test AL, 2 + Mov [ES:SI+12h], AL + Mov [ES:SI+2Eh], AH + Mov EAX, [ES:SI+30h] + JZ D_SaveIT16Bit + + Add EAX, EAX + +D_SaveIT16Bit: + Add DX, AX + PushF + ShR EAX, 16 + PopF + AdC CX, AX ; Advance sample pointer. + +D_SaveIT15: + Add SI, 80 + Jmp D_SaveIT14 + +D_SaveIT16: + Call WriteITSampleBlock + + Xor BP, BP + +D_SaveIT17: + Push DS + + Push CS + Pop DS + Mov DI, (4+20*80)*2 + Mov SI, Offset PatternMsg + Mov AH, 5 + Push BP + Call S_DrawString + Pop AX + + Call Music_GetPattern + Mov DX, DS + Cmp DX, Music + JE D_SaveIT2 + + Mov DX, SI + Mov CX, [DS:SI] + Add CX, 8 + Call D_SaveBlock + +D_SaveIT2: + Pop DS + Inc BP + Cmp BP, [ES:26h] + JB D_SaveIT17 + +; Setup compression block + Push DS + + Push CS + Pop DS + Mov SI, Offset BitLUT + + Mov DI, 10240 + Mov CX, 16/2 + Rep MovsW + +; Setup table. + + Mov CX, 16 + Mov AL, 6 + Rep StosB + + Mov CX, 28 + Inc AX + Rep StosB + + Mov CX, 64 + Inc AX + Rep StosB + + Mov CX, 8 + Inc AX + Rep StosB + + Mov CX, 64 + Dec AX + Rep StosB + + Mov CX, 29 + Dec AX + Rep StosB + + Mov CX, 16 + Dec AX + Rep StosB + + Mov CX, 15 + Sub SI, 8 + Rep MovsB + +; 16 bit Main LUT + + Mov SI, Offset BitLUT16 + Mov CX, 16 + Rep MovsB + + Mov CX, 15 + Mov AL, 14 SHL 3 + 5 + Rep StosB + Mov AL, 14 SHL 3 + 3 + StosB + + Mov CX, 31 + Mov AL, 15 SHL 3 + 5 + Rep StosB + Mov AL, 15 SHL 3 + 3 + StosB + + Mov CX, 63 + Mov AL, 16 SHL 3 + 5 + Rep StosB + Mov AL, 16 SHL 3 + 3 + StosB + + Inc AX +; Mov AL, 16 SHL 3 + 4 + StosB + Mov CX, 63 + Inc AX +; Mov AL, 16 SHL 3 + 5 + Rep StosB + + Mov AL, 15 SHL 3 + 4 + StosB + Mov CX, 31 + Mov AL, 15 SHL 3 + 5 + Rep StosB + + Mov AL, 14 SHL 3 + 4 + StosB + Mov CX, 15 + Mov AL, 14 SHL 3 + 5 + Rep StosB + + Mov CX, 16 + Rep MovsB + +; 16 bit LUT 1, for 16-bit samples with high byte = 0 + + Mov SI, Offset BitLUT + Mov CX, 16 + Rep MovsB + + Mov CX, 16 + Mov AL, 6 + Rep StosB ; AL = 6 from before + + Mov CX, 24 + Inc AX + Rep StosB + + Mov CX, 64 + Inc AX + Rep StosB + + Mov CX, 128 + Inc AX + Rep StosB + +; 16-Bit LUT 2, for 16-bit samples with high byte = 0xFF + + Mov CX, 16 + Inc AX + Rep StosB + + Mov CX, 128 + Dec AX + Rep StosB + + Mov CX, 64 + Dec AX + Rep StosB + + Mov CX, 25 + Dec AX + Rep StosB + + Mov CX, 16 + Dec AX + Rep StosB + + Mov CX, 15 + Sub SI, 8 + Rep MovsB + + Mov CX, 256-8 + Xor AX, AX + Rep StosB + + Mov CX, 16 + Inc AX + Rep StosB + + Mov CX, 256-8+256 + Dec AX + Rep StosB + + Pop DS + + Xor BP, BP ; BP = sample number. + Mov DI, 2000+48h + +D_SaveIT18: + Push DS + Push DI + + Xor CX, CX + Xor DX, DX + Mov AX, 4201h + Int 21h + + Mov [ES:DI], AX + Mov [ES:DI+2], DX + + Mov SI, BP + Add SI, SI + Mov SI, [64912+SI] ; DS:SI points to sample head. + + Test Byte Ptr [SI+12h], 1 ; Check if sample is present. + JZ D_SaveIT19 + Cmp DWord Ptr [SI+30h], 0 ; For bodgy sample crap. + JZ D_SaveIT19 + +D_SaveIT21: + Push DS ; DS:DX points to sample... + Push SI + + Push CS + Pop DS + Mov DI, (4+21*80)*2 + Mov SI, Offset SampleMsg + Mov AX, BP + Inc AX + Push AX + Mov AH, 5 + Call S_DrawString + Pop AX + + Pop SI + Pop DS ; Sample encoding to go here.. + ; But sample position needs to + ; be recoded then... + Cmp CS:SaveFormat, 2 + JNE D_SaveSampleDataCompressedCall + + Call D_SaveSampleData + Jmp D_SaveIT19 + +D_SaveSampleDataCompressedCall: + Call D_SaveSampleDataCompressed + +D_SaveIT19: + Pop DI + Pop DS + + Add DI, 80 + + Inc BP + Cmp BP, [ES:24h] + JB D_SaveIT18 + + Call WriteITSampleBlock + + Mov AH, 3Eh ; Close file + Int 21h + + Push CS + Pop DS + Mov DI, (4+23*80)*2 + Mov SI, Offset CompleteMsg + Mov AH, 5 + Call S_DrawString + +EndSaveModule: + Mov DX, Offset SaveFileName + Call D_DeleteIfError + + Call PE_RestoreCurrentPattern + + Cmp NoSaveError, 0 + JNE SaveModuleError + + Call PEResetModified + +SaveModuleError: + Mov AX, 1 + Ret + +EndP D_SaveIT + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_SaveS3M Far + + Call PE_SaveCurrentPattern + Call D_UpdateFileName + + Mov BP, 60h ; BP = length of header. +; Call PE_StoreCurrentPattern + + Push CS + Pop DS + Assume DS:Disk + + Mov SaveFormatError, 0 + + Mov NoSaveError, 0 + + Mov AH, 3Ch + Xor CX, CX ; File type is normal (archive) + Mov DX, Offset SaveFileName ; DS:DX points to filename + Int 21h + JNC D_SaveS3M1 + + Call PE_RestoreCurrentPattern + Jmp D_NoSaveMessage + +D_SaveS3M1: + Mov BX, AX + + Mov ES, DiskDataArea + Call Music_GetSongSegment + Mov DS, AX + Assume DS:Nothing ; DS = MusicData + + Mov SI, 4 + Xor DI, DI + Mov CX, 26/2 + Rep MovsW + Xor AX, AX + StosW + Mov AX, 1Ah+16*256 ; St3 module identification. + StosW + Xor AX, AX + StosW + ; Now to figure out the + ; orders. + Mov SI, 511 + StD + Mov CX, 256 + +D_SaveS3M2: + LodsB + Cmp AL, 0FFh + LoopE D_SaveS3M2 + + ClD + + Inc CX + Mov AX, CX + Inc AX ; Number of orders. + Add BP, AX + StosW + + Call Music_GetNumberOfSamples + Add BP, AX + Add BP, AX + StosW ; Number of samples. + + Call PE_GetMaxPattern + Inc AX + Add BP, AX + Add BP, AX + Cmp AX, 100 + JBE D_SaveS3M4 + + Mov AX, 100 + + Push Offset D_SaveS3M4 + Push SI + Push DI + Mov SI, Offset TooManyPatternsMsg + Mov DI, (4+23*80)*2 + Jmp D_SaveS3MFormatError + +D_SaveS3M4: + StosW ; Number of patterns + + ; Flags... 8 = vol0opt on. + Mov AX, [DS:2Ch] + And AX, 2 + ShL AX, 2 + StosW ; Flags stored. + + Mov AX, 3000h+TRACKERVERSION + StosW ; Impulse Tracker + + Mov AX, 2 + StosW ; Standard unsigned samples. + + Mov EAX, 'MRCS' + StosD ; ID done. + + Mov AH, [DS:2Ch] + Test AH, 4 + JZ D_SaveS3MNoInsError + + Push Offset D_SaveS3MNoInsError + Push SI + Push DI + Mov SI, Offset ST3InstrumentErrorMsg + Mov DI, (4+29*80)*2 + Jmp D_SaveS3MFormatError + +D_SaveS3MNoInsError: + Mov AL, [DS:30h] + ShR AL, 1 + StosB + Mov AX, [DS:32h] ; Tempo and speed + StosW + Mov AL, [DS:31h] ; Mixing volume + Mov AH, [DS:2Ch] ; Grab stereo setting. + Cmp AL, 80h + JB D_SaveNoMixOverflow + + Mov AL, 7Fh + +D_SaveNoMixOverflow: + ShL AL, 1 + ShR AX, 1 + StosB + + Mov AX, 252*256 + StosW + Xor AX, AX + StosW + + Call GetTimerCounter + Sub EAX, EditTimer + Add EAX, [DS:3Ch] + + Xor EAX, 'JTHL' + RoR EAX, 4 + Neg EAX + RoL EAX, 7 + Xor EAX, 'ITRK' + + StosD + + Xor AX, AX + StosW + + Mov SI, 256 ; Orders. + Mov DI, 60h + JCXZ D_SaveS3M3 + +D_SaveS3M5: + LodsB + Cmp AL, 0FEh + JAE D_SaveS3M6 + Cmp AL, 100 + JB D_SaveS3M6 + + Mov AL, 0FFh ; So that pattern numbers >= 100 aren't listed + +D_SaveS3M6: + StosB + Loop D_SaveS3M5 + +D_SaveS3M3: + Mov AL, 0FFh + StosB + + ; Do channel settings. + Push BX + + Mov BX, BP + + Mov SI, 40h + Mov DI, SI + Sub BX, DI + + Mov CX, 32 + Xor AH, AH + +D_SaveS3M7: + LodsB + Test AL, 80h + JNZ D_SaveS3M9 + + Cmp AL, 64 + JBE D_SaveS3M8 + + Mov AL, 32 ; For surround. + +D_SaveS3M8: + ; Convert 0->64 to 0->15 + Mov DL, AL + ShR DL, 1 + Sub DL, 1 + AdC DL, 0 + ShR DL, 1 + Or DL, 32 ; Reqd... + + Mov AL, AH + + And AL, 1 + ShL AL, 3 + Mov DH, AH + ShR DH, 1 + Or AL, DH + + Inc AH + Jmp D_SaveS3M10 + +D_SaveS3M9: ; Muted/nonexistant + Mov AL, 0FFh + Mov DL, 0 + +D_SaveS3M10: + Mov [ES:BX+DI], DL + StosB + Loop D_SaveS3M7 + + Pop BX + + Add BP, 20h + + ; Check that channel volumes are all 64... + + Mov CX, 32 + Mov SI, 80h + +D_SaveS3M11: + LodsB + Cmp AL, 64 + JNE D_SaveS3M12 + Loop D_SaveS3M11 + Jmp D_SaveS3M13 + +D_SaveS3M12: + Push Offset D_SaveS3M13 + Push SI + Push DI + Mov SI, Offset ChannelVolumeErrorMsg + Mov DI, (4+24*80)*2 + Jmp D_SaveS3MFormatError + +D_SaveS3M13: + Test Byte Ptr [DS:2Ch], 8 + JZ D_SaveS3M15 + + Push Offset D_SaveS3M15 + Push SI + Push DI + Mov SI, Offset LinearSlideMsg + Mov DI, (4+25*80)*2 + Jmp D_SaveS3MFormatError + +D_SaveS3M15: + Push DS + + Push CS + Pop DS + Mov DI, (4+17*80)*2 + Mov SI, Offset SampleHeaderMsg + Mov AH, 5 + Call S_DrawString + + Pop DS + Assume DS:Nothing + + Push BP ; BP = length of header. + + Xor AX, AX ; AX = sample number. + Xor DX, DX ; DX:BP = file position. + ; BX = file handle + +;-------------------------------------- + +D_SaveS3M14: + Push AX + + Add BP, 15 ; Align on next 16-byte boundary. + AdC DX, 0 ; Unnecessary.. but who cares. + ; Now to store pointer. + And BP, Not 15 + + Push DX + + Mov DI, AX + Add DI, DI + + Push DI + + Add DI, 60h + Add DI, [ES:20h] + + ; Move file pointer. + Mov AX, 4200h + Mov CX, DX + Mov DX, BP + Int 21h + + SHRD AX, DX, 4 + Mov [ES:DI], AX + + ; Set up sample block at ES:1024. + Pop DI + Push BX + + Mov BX, [DS:64912+DI] ; DS:BX points to sample header. + + Mov DI, 1024 + Mov AL, [BX+12h] + Mov DL, AL + And AL, 1 + + StosB + + Mov SI, BX + Add SI, 4 + Mov CX, 12 + Rep MovsB ; filename + + Xor AX, AX + StosB + StosW + + Mov SI, BX + Add SI, 30h + Mov CX, 6 + Rep MovsW ; Length/Loopbeg/Loopend. + + Mov AL, [DS:BX+13h] + StosW ; Default sample volume. + + Mov AH, DL + Mov CL, DL + ShR AH, 4 + And AX, 100h + ShL CL, 1 + And CL, 4 + Or AH, CL + + StosW ; Loop, 16 Bit & no 'pack' + + MovsW + MovsW + + Mov CX, 6 + Xor AX, AX + Rep StosW + ; Now for sample name. + + Mov SI, BX + Add SI, 14h + Mov CX, 25 + +D_SaveS3M56: + LodsB + And AL, AL + JNZ D_SaveS3M57 + + Mov AL, 32 + +D_SaveS3M57: + StosB + Loop D_SaveS3M56 + + Xor AX, AX + StosB + StosW + + Mov EAX, 'SRCS' + StosD ; OK header is done... + + Test DL, 16+32 + JZ D_SaveS3M16 ; No loop on. + + Test DL, 32 + JNZ D_SaveS3M51 + + Test DL, 64 + JZ D_SaveS3M16 + +D_SaveS3M51: + Push Offset D_SaveS3M16 + Push SI + Push DI + Mov SI, Offset LoopMsg + Mov DI, (4+27*80)*2 + Jmp D_SaveS3MFormatError + +D_SaveS3M16: + Cmp Byte Ptr [DS:BX+11h], 64 + JE D_SaveS3M17 + + Push Offset D_SaveS3M17 + Push SI + Push DI + Mov SI, Offset SampleVolumeMsg + Mov DI, (4+26*80)*2 + Jmp D_SaveS3MFormatError + +D_SaveS3M17: + Cmp Byte Ptr [DS:BX+4Dh], 0 + JE D_SaveS3M18 + + Push Offset D_SaveS3M18 + Push SI + Push DI + Mov SI, Offset SampleVibratoMsg + Mov DI, (4+28*80)*2 + Jmp D_SaveS3MFormatError + +D_SaveS3M18: ; Write block. + Pop BX + Push DS + + Push ES + Pop DS + Mov DX, 1024 + Mov CX, 50h + Call D_SaveBlock + + Pop DS + Pop DX + + Add BP, 50h ; Advance file pointer. + AdC DX, 0 + + Pop AX + Inc AX + Cmp AX, [ES:22h] + JB D_SaveS3M14 ; Sample headers done. + +;----------------------------------- + ; Pattern data. + Xor AX, AX ; Start with pattern 0 + +D_SaveS3M19: + Push AX + ; Shove message on screen.... + Add BP, 15 ; Align on next 16-byte boundary. + AdC DX, 0 ; Unnecessary.. but who cares. + ; Now to store pointer. + And BP, Not 15 + + Push DX + + Push AX ; AX for pattern msg... + + Mov DI, AX + Add DI, DI + + Add DI, 60h + Add DI, [ES:20h] + Mov CX, [ES:22h] + Add CX, CX + Add DI, CX + + ; Move file pointer. + Mov AX, 4200h + Mov CX, DX + Mov DX, BP + Int 21h + + SHRD AX, DX, 4 ; DX:AX = new file pointer location + Mov [ES:DI], AX + + Push CS + Pop DS + + Mov DI, (4+18*80)*2 + Mov SI, Offset PatternMsg + Mov AH, 5 + Call S_DrawString + + Pop AX ; AX = pattern. + Call Music_GetPattern ; DS:SI points to pattern. + + Mov CX, [SI+2] ; CX = length. + Cmp CX, 64 + JE D_SaveS3M20 + + Push Offset D_SaveS3M20 + Push SI + Push DI + Mov SI, Offset PatternLengthMsg + Mov DI, (4+30*80)*2 + Jmp D_SaveS3MFormatError + +D_SaveS3M20: + Push BX + + Push CX + + Mov DI, 20000 + Mov CX, 64 + +D_SaveS3M25: + Mov AX, 0FD00h ; Mask & note. + StosW + Mov AH, 0FFh ; instrument & volume. + StosW + Xor AH, AH + StosW + StosW + Loop D_SaveS3M25 + + Mov DI, 30002 + Add SI, 8 + + Pop CX + Push CX + +D_SaveS3M22: ; Pattern translation time. + Push CX + +D_SaveS3M33: + LodsB + And AL, AL + JZ D_SaveS3M23 + + Mov DL, AL + And AX, 7Fh + Dec AX + Mov CL, 3 + ShL AX, CL + Mov BX, AX + Add BX, 20000 ; ES:BX points to old information. + ; Decode row into area. + + Mov DH, [ES:BX] + + Test DL, 80h + JZ D_SaveS3M24 + + LodsB ; Mask + Mov [ES:BX], AL + Mov DH, AL + +D_SaveS3M24: + Test DH, 1 + JZ D_SaveS3M26 + + LodsB + Mov [ES:BX+1], AL + +D_SaveS3M26: + Test DH, 2 + JZ D_SaveS3M27 + + LodsB + Mov [ES:BX+2], AL + +D_SaveS3M27: + Test DH, 4 + JZ D_SaveS3M28 + + LodsB + Cmp AL, 64 + JA D_SaveS3MPanError + +D_SaveS3M28_2: + Mov [ES:BX+3], AL ; Volume + +D_SaveS3M28: + Test DH, 8 + JZ D_SaveS3M29 + + LodsW ; Effect+value. + Mov [ES:BX+4], AX + +D_SaveS3M29: + And DL, 7Fh + Cmp DL, NUMS3MCHANNELS + JA D_SaveS3M30 + + Dec DX + Test DH, 33h + JZ D_SaveS3M31 + + Or DL, 32 + +D_SaveS3M31: + Test DH, 44h + JZ D_SaveS3M32 + + Or DL, 64 ; Volume + +D_SaveS3M32: + Test DH, 88h + JZ D_SaveS3M34 + + Or DL, 128 ; Effect. + +D_SaveS3M34: + ; Check if note in range. + Mov AX, [ES:BX+1] + Mov [ES:BX+6], AX ; BX+6=note, BX+7=ins. + + Cmp AL, 120 + JAE D_SaveS3M55 + + Test DH, 11h + JZ D_SaveS3M55 + Test DH, 22h + JZ D_SaveS3M55 + + Push DS + + Call Music_GetSongSegment + Mov DS, AX + Test Byte Ptr [DS:2Ch], 4 + JZ D_SaveS3M54 + + Push BX + Push DI + + Mov DI, BX + + Mov BL, [ES:BX+7] + And BX, 0FFh ; BX = ins. + JZ D_SaveS3M52 + + Add BX, BX + Mov BX, [BX+64712-2] ; BX points to instrument. + Mov AL, [ES:DI+1] + And AX, 0FFh + Add AX, AX + Add BX, AX + Mov AX, [BX+40h] + + Mov [ES:DI+6], AX + +D_SaveS3M52: + Pop DI + Pop BX + +D_SaveS3M54: + Pop DS + +D_SaveS3M55: + Mov AL, DL + + Test DL, 32 ; Do note? + JZ D_SaveS3M35 + + Mov AH, [ES:BX+6] ; AH = note. + Cmp AH, 0FDh + JAE D_SaveS3M35 + Cmp AH, 12 + JB D_SaveS3M36 ; Note out of range. + Cmp AH, 108 + JAE D_SaveS3M36 + +D_SaveS3M35: + StosB ; Store mask. + Test DL, 32 + JZ D_SaveS3M39 + + Mov AL, 0FFh + Test DH, 11h + JZ D_SaveS3M37 + + Cmp AH, 0FDh + JE D_SaveS3M37 + + Mov AL, 0FEh + Cmp AH, 0FEh + JAE D_SaveS3M37 + + Mov AL, AH + Xor AH, AH + Sub AL, 12 + Mov CX, 12*256+4 + Div CH ; AL = octave, AH = note. + ShL AL, CL + Or AL, AH + +D_SaveS3M37: + Mov AH, 0 + Test DH, 22h + JZ D_SaveS3M50 + + Mov AH, [ES:BX+7] + +D_SaveS3M50: + StosW + +D_SaveS3M39: + Test DL, 64 + JZ D_SaveS3M40 + + Mov AL, [ES:BX+3] + StosB + +D_SaveS3M40: + Test DL, 128 + JZ D_SaveS3M41 + + Mov AX, [ES:BX+4] + +; Cmp AL, 'H'-'@' +; JE D_SaveVibDepth1 +; Cmp AL, 'U'-'@' +; JE D_SaveVibDepth2 +; + Cmp AX, 'S'-'@'+9100h + JE D_SaveS3MSurround + + Cmp AL, 'V'-'@' + JE D_SaveS3M46 + Cmp AL, 'X'-'@' + JE D_SaveS3M46 + + Cmp AL, 'C'-'@' + JNE D_SaveS3M47 + + Mov AL, AH + Xor AH, AH + Mov CX, 10*256+4 + Div CH + ShL AL, CL + Or AH, AL + Mov AL, 'C'-'@' + Jmp D_SaveS3M47 + +D_SaveS3MSurround: + Mov AX, 'X'-'@'+0A400h + Jmp D_SaveS3M47 + +D_SaveS3M46: + ShR AH, 1 + +D_SaveS3M47: + StosW + +D_SaveS3M41: + Jmp D_SaveS3M33 + +; D_SaveVibDepth1: ; Command H +; Mov CL, AH +; And AH, 0Fh +; And CL, 0F0h +; Inc AH +; ShR AH, 1 +; Or AH, CL +; +; StosW +; Jmp D_SaveS3M33 +; +;D_SaveVibDepth2: +; Mov CL, AH +; And AH, 0Fh ; AH = depth +; Inc AH +; ShR AH, 1 +; And CL, 0F0h +; Or AH, CL +; +; StosW +; Jmp D_SaveS3M33 + +D_SaveS3MPanError: + Mov AL, 0FFh + Mov Byte Ptr [ES:BX+3], AL ; Volume + + Push Offset D_SaveS3M28_2 + Push SI + Push DI + Mov SI, Offset PanningErrorMsg + Mov DI, (4+33*80)*2 + Jmp D_SaveS3MFormatError + +D_SaveS3M30: + Push Offset D_SaveS3M33 + Push SI + Push DI + Mov SI, Offset ChannelErrorMsg + Mov DI, (4+31*80)*2 + Jmp D_SaveS3MFormatError + +D_SaveS3M36: + Push Offset D_SaveS3M33 + Push SI + Push DI + Mov SI, Offset NoteRangeMsg + Mov DI, (4+32*80)*2 + Jmp D_SaveS3MFormatError + +D_SaveS3M23: + StosB + Pop CX + Loop D_SaveS3M22 + + Pop CX + Pop BX + Sub CX, 64 + JNC D_SaveS3M21 + + Neg CX + Xor AL, AL + Rep StosB + +D_SaveS3M21: + Mov CX, DI + Sub CX, 30000 + Mov [ES:30000], CX ; Pattern length. + + Push ES + Pop DS + Mov DX, 30000 + Call D_SaveBlock + + Pop DX + + Add BP, CX + AdC DX, 0 + + Pop AX + Inc AX + Cmp AX, [ES:24h] + JB D_SaveS3M19 + +;----------------------------------- + ; Now to save samples. + Mov DI, 10000 + Mov CX, 200 ; ES:10000 contains sample pointers. + Xor AX, AX + Rep StosW + +D_SaveS3M42: + Inc AX + Push AX + + Xor CX, CX + Call Music_GetSampleLocation ; Gets DS:SI, ECX + JC D_SaveS3M43 + + JZ D_SaveS3M8Bit + + Add ECX, ECX + +D_SaveS3M8Bit: + Push DS + Push AX + + Push CS + Pop DS + Mov DI, (4+19*80)*2 + Mov SI, Offset SampleMsg + Mov AH, 5 + Call S_DrawString + + Pop AX + Pop DS + + ; Shove message on screen.... + Add BP, 15 ; Align on next 16-byte boundary. + AdC DX, 0 + And BP, Not 15 + + Push ECX + Push DX + Push AX ; AX = sample num + + Mov DI, AX + Dec DI + Add DI, DI + Add DI, DI + Add DI, 10000 + Mov AX, BP + StosW + Mov AX, DX + StosW + + + Mov AX, 4200h + Mov CX, DX + Mov DX, BP + Int 21h ; Set file offset. + + Pop AX + + Call D_SaveSampleDataConvert + + Pop DX + Pop ECX + Add BP, CX + PushF + ShR ECX, 16 + PopF + AdC DX, CX + +D_SaveS3M43: + Pop AX + Cmp AX, [ES:22h] + JB D_SaveS3M42 + +;----------------------------------- + + Push CS + Pop DS + Assume DS:Disk + + Mov DI, (4+20*80)*2 + Mov SI, Offset HeaderMsg + Mov AH, 5 + Call S_DrawString + + Mov AX, 4200h + Xor CX, CX + Xor DX, DX + Int 21h ; Go back to start of file. + + Push ES + Pop DS + Xor DX, DX + Pop CX ; CX = length of header. (previously BP) + Call D_SaveBlock + + ; To do sample pointers now. + Mov SI, 10000 + Xor BP, BP + +D_SaveS3M44: + Mov DI, BP + Add DI, DI + Add DI, 60h ; Length of header + Add DI, [DS:20h] ; Past Orders, DS:SI points to parasample + + Xor CX, CX + Mov DX, [DI] + SHLD CX, DX, 4 + ShL DX, 4 + + Add DX, 0Dh + + Mov AX, 4200h + Int 21h ; file re-position. + + LodsW + Mov DX, AX + LodsW ; AX:DX contains sample pointer. + + ShRD DX, AX, 4 + ShR AX, 4 ; AX:DX contains para pointer. + + Mov [DS:0], AL + Mov [DS:1], DX + Mov CX, 3 + Xor DX, DX + Call D_SaveBlock + + Inc BP + Cmp BP, [DS:22h] + JB D_SaveS3M44 + + Mov AH, 3Eh ; Close file. + Int 21h + + Push CS + Pop DS + Assume DS:Disk + + Mov DI, (4+21*80)*2 + Mov SI, Offset CompleteMsg + Mov AH, 5 + Call S_DrawString + + Cmp SaveFormatError, 0 + JE D_SaveS3M_NoKeyWait + + Call K_ClearKeyboardQueue + +D_SaveS3MKeyWait: + Call K_GetKey + Test CH, 1 + JZ D_SaveS3MKeyWait + +D_SaveS3M_NoKeyWait: + Jmp EndSaveModule + +D_SaveS3MFormatError: + Push AX + Push DS + + Push CS + Pop DS + Assume DS:Disk + + Mov SaveFormatError, 1 + Mov AH, 4 + Call S_DrawString + + Pop DS + Pop AX + Pop DI + Pop SI + RetN + +EndP D_SaveS3M + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_SaveFileITModule Far + + Mov SI, 1 + Mov CX, Object1 + Mov DX, Offset O1_SaveITList + + Mov AX, 5 + Ret + +EndP D_SaveFileITModule + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc D_SaveFileS3MModule Far + + Mov SI, 1 + Mov CX, Object1 + Mov DX, Offset O1_SaveS3MList + + Mov AX, 5 + Ret + +EndP D_SaveFileS3MModule + + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + diff --git a/IT_EMS.ASM b/IT_EMS.ASM new file mode 100644 index 0000000..647fbe6 --- /dev/null +++ b/IT_EMS.ASM @@ -0,0 +1,973 @@ +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ EMS Module ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +include switch.inc + +; Memory structure for patterns: +; Memory Block Header +; Memory data +; +; Block Header +; Offset 0: DWord - Number of bytes in block (not including header) +; Offset 4: Word - Segment of last block, 0 if first +; Offset 6: Word - Segment of next block, 0 if last +; Offset 8: Byte - 0 = Unused, 1 = Used +; Offset 9-0Fh: Not used +; Offset 10h Data + + Jumps + .386 + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Externals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Segment Object1 BYTE Public 'Data' + Extrn EMSErrorValue:Word + Extrn EMSErrorValue2:Word + Extrn EMSErrorValue3:Word + Extrn EMSErrorValue4:Word + Extrn EMSErrorValue5:Word + Extrn EMSErrorValue6:Word + Extrn EMSErrorValue7:Word + Extrn EMSErrorValue8:Word +EndS + + Extrn M_Object1List:Far + + Extrn O1_EMSWarningMessage + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Globals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Global E_AllocateEMS:Far + Global E_InitEMS:Far + Global E_UnInitEMS:Far + Global E_GetFreeEMS:Far + Global E_ReleaseEMS:Far + Global E_MapEMSMemory:Far, E_MapAvailableEMSMemory:Far + Global E_GetEMSPageFrame:Far + Global E_EMSAvailable:Far + Global E_SaveEMSPageFrame:Far + Global E_RestoreEMSPageFrame:Far + Global E_AllocateBlockEMS:Far, E_ReleaseBlockEMS:Far + Global E_MapAlignedBlockEMS:Far + Global E_GetEMSVersion:Far + Global E_GetInternalEMSHandle:Far + +IF EMSDEBUG + + Global E_DumpEMSMemory:Far + +ENDIF + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +Segment EMS WORD Public 'Code' USE16 + Assume CS:EMS, DS:Nothing + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Variables ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +CREATENEWLOGFILE EQU 0 +include debug.inc + +EMSDetectString DB "EMMXXXX0" ; Identification string +EMSHandlesRemaining DW 0 +EMSAvailable DW 0 ; Assume that it's not avail. +EMSPageFrame DW 0 +EMSHandle DW 0 +EMSVersion DB 0 + DB 0 + +IF EMSDEBUG + +EMSDumpName DB "EMSDump", 0 + +ENDIF + +EMSCorrespondenceList Label Word + Page0 DB 0, 0 + DW 0 + Page1 DB 0, 0 + DW 1 + Page2 DB 0, 0 + DW 2 + Page3 DB 0, 0 + DW 3 + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Functions ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Proc E_InitEMS Far + + Push DS + Push ES + + Trace " - Determining EMS presence" + + Xor AX, AX + Mov DS, AX + + Mov AX, [DS:019Eh] ; Get interrupt vector for Int 67h + And AX, AX ; Is Segment = 0? + JZ E_InitEMS1 + + Mov ES, AX + Mov DI, 0Ah ; Offset into driver of identification string + + Push CS + Pop DS + Assume DS:EMS + + Mov SI, Offset EMSDetectString + + Mov CX, 8/2 + + RepE CmpsW + JNE E_InitEMS1 + ; EMM driver is present + + Mov AH, 40h ; Get manager status + Int 67h ; Returns AH=0 -> no error + And AH, AH + JNZ E_InitEMS1 + + Trace " - Determining EMS Page Frame" + + Mov AH, 41h ; Get page frame segment + Int 67h ; AH if successful, with BX=segment + And AH, AH + JNZ E_InitEMS1 + + Mov EMSPageFrame, BX + + Trace " - Determining EMS Version" + + Mov AH, 46h ; Get EMS version + Int 67h + Test AH, AH + JNZ E_InitEMS1 + + Mov EMSVersion, AL + + Trace " - Allocating EMS block" + + Mov AH, 43h + Mov BX, 8 + Int 67h + + Test AH, AH + JNZ E_InitEMS1 + + Mov EMSHandle, DX + + Mov AX, 4400h + Xor BX, BX + Int 67h ; Map first page + + Mov ES, EMSPageFrame + Xor DI, DI + Mov EAX, 8*16*1024-16 + StosD ; Amount of memory free + Xor EAX, EAX ; No previous block, no next block + StosD + Xor AX, AX ; Unused block + StosW + + Mov EMSAvailable, 1 + + ; OK.. now to get number of EMS + ; handles available.. + + Trace " - Determining number of free EMS handles" + + Cmp EMSVersion, 40h + JB E_InitEMSBelow4 + + Mov AX, 5402h + Int 67h ; BX = total number of pages. + Test AH, AH + JNZ E_InitEMSBelow4 + + Mov DX, BX + + Mov AH, 4Bh + Int 67h + + Test AH, AH + JNZ E_InitEMSBelow4 + + Sub DX, BX + Mov EMSHandlesRemaining, DX + + Jmp E_InitEMS1 + +E_InitEMSBelow4: + + Mov CX, 256 ; Allocate 256 MAX + +E_InitEMS2: + Mov AH, 43h + Mov BX, 1 + Int 67h + + Test AH, AH + JNZ E_InitEMS3 + + Inc EMSHandlesRemaining + Push DX + Loop E_InitEMS2 + +E_InitEMS3: + Mov CX, EMSHandlesRemaining ; Now to dealloc them + + Test CX, CX +E_InitEMS4: + JZ E_InitEMS1 + + Mov AH, 45h + Pop DX + Int 67h + + Dec CX + Jmp E_InitEMS4 + +E_InitEMS1: + Pop ES + Pop DS + Ret + +EndP E_InitEMS + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc E_GetFreeEMS Far ; Returns kb free.. + + Push BX + Push DX + + Cmp EMSAvailable, 0 + JE E_GetFreeEMS2 ; No EMM driver? + + Mov AH, 42h ; Get page counts + Int 67h + + And AH, AH ; AH=0 -> no error + JNZ E_GetFreeEMS2 ; BX = free pages + + Mov AX, BX + ShL AX, 4 + + Jmp E_GetFreeEMS1 + +E_GetFreeEMS2: + Xor AX, AX + +E_GetFreeEMS1: + Pop DX + Pop BX + Ret + +EndP E_GetFreeEMS + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc E_ReleaseEMS Far ; AX = handle. + + Push AX + Push DX + + Mov DX, AX + Mov AH, 45h ; Deallocate memory. + Int 67h + + And AH, AH ; AH = 0 -> no error + JZ E_ReleaseEMS1 + + Call EMSWarning + +E_ReleaseEMS1: + Inc CS:EMSHandlesRemaining + + Pop DX + Pop AX + + Ret + +EndP E_ReleaseEMS + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc EMSWarning + + PushAD + Push DS + Push ES + + Mov BX, Object1 + Mov DS, BX + Assume DS:Object1 + + Mov Byte Ptr EMSErrorValue, AH + Mov EMSErrorValue2, CX + Mov EMSErrorValue3, DX + + Mov AX, Word Ptr CS:EMSVersion + Mov EMSErrorValue8, AX + + Mov AL, CS:Page0 + Mov Byte Ptr EMSErrorValue4, AL + + Mov AL, CS:Page1 + Mov Byte Ptr EMSErrorValue5, AL + + Mov AL, CS:Page2 + Mov Byte Ptr EMSErrorValue6, AL + + Mov AL, CS:Page3 + Mov Byte Ptr EMSErrorValue7, AL + + Mov DI, Offset O1_EMSWarningMessage + Mov CX, 2 + Call M_Object1List + + Pop ES + Pop DS + PopAD + + Ret + +EndP EMSWarning + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc E_MapAvailableEMSMemory Far + ; AX = handle. + + Push AX BX DX + + Mov DX, AX + + Xor AL, AL + Xor BX, BX + +E_MapAvailableEMSMemory1: + Mov AH, 44h + Int 67h + Test AH, AH + JNZ E_MapAvailableEMSMemory2 + + Inc AX + Inc BX + + Cmp AL, 3 + JBE E_MapAvailableEMSMemory1 + +E_MapAvailableEMSMemory2: + Pop DX BX AX + + Ret + +EndP E_MapAvailableEMSMemory + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc E_MapEMSMemory Far ; CL = total pages in handle + ; CH = starting (base) page. + ; DX = handle + + Push AX + Push BX + Push CX + + Sub CL, CH + JBE E_MapEMSMemory002 + + Cmp CL, 4 + JB E_MapEMSMemory003 + + Mov CL, 4 + +E_MapEMSMemory003: + +IF EMSUSE41 + Cmp CS:EMSVersion, 40h + JAE E_MapEMSMemoryV4_1 +ENDIF + + Xor BX, BX + +E_MapEMSMemory001: + Mov AL, CL + Dec AX + Mov BL, AL + Add BL, CH + Mov AH, 44h + Int 67h + + And AH, AH + JNZ E_MapEMSMemory004 + + Dec CL + JNZ E_MapEMSMemory001 + Jmp E_MapEMSMemory002 + +IF EMSUSE41 + +E_MapEMSMemoryV4_1: + Push DS + Push SI + PushF + + CLI + + Push CS + Pop DS + Assume DS:EMS + + Mov Page0, CH + Inc CH + Mov Page1, CH + Inc CH + Mov Page2, CH + Inc CH + Mov Page3, CH + + Mov AX, 5000h + Xor CH, CH + Mov SI, Offset EMSCorrespondenceList + Int 67h + + PopF + Pop SI + Pop DS + Assume DS:Nothing + + Test AH, AH + JZ E_MapEMSMemory002 + +ENDIF + +E_MapEMSMemory004: +; Call EMSWarning + +E_MapEMSMemory002: + Pop CX + Pop BX + Pop AX + +E_MapEMSMemoryExit: + Ret + +EndP E_MapEMSMemory + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc E_UnInitEMS Far + + Cmp EMSAvailable, 0 + JE E_UnInitEMS1 + + Mov AX, EMSHandle + Call E_ReleaseEMS + +E_UnInitEMS1: + Ret + +EndP E_UnInitEMS + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc E_GetEMSPageFrame Far + + Mov AX, CS:EMSPageFrame + Ret + +EndP E_GetEMSPageFrame + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc E_MapAlignedBlockEMS Far ; Given AX, Return DS:SI + + Push CX DX + + Mov SI, AX + Mov CX, AX + ShL SI, 4 + Mov CL, 8 + ShR CH, 2 + And SI, 03FFFh + + Mov DX, CS:EMSHandle + Call E_MapEMSMemory + + Mov DS, CS:EMSPageFrame + + Pop DX CX + + Ret + +EndP E_MapAlignedBlockEMS + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc E_AllocateBlockEMS Far ; EAX = number of bytes + ; Destroys EMS page frame + ; Returns AX = segment address + ; Carry set if fail, clear if + ; successful + + ClI + Push EBX ECX EDX ESI EDI DS ES + + Cmp CS:EMSAvailable, 0 + JE AllocateBlockQuitError + + Mov ESI, EAX + Add ESI, 0Fh + And ESI, Not 0Fh + + Mov DS, CS:EMSPageFrame + Xor EDI, EDI ; EDI = current offset + + Mov CX, 0008h ; Starting page = 0, Max page = 8 + +AllocateBlockEMS2: + Mov DX, CS:EMSHandle + Call E_MapEMSMemory + +AllocateBlockEMS1: + Cmp Byte Ptr [DI+8], 0 ; Used? + JNE AllocateBlockEMSNext + + Cmp ESI, [DI] + JA AllocateBlockEMSNext + + Mov AX, DI + And AX, 3FFFh + Add AX, SI + JC AllocateBlockQuitError ; Can't fit it in! + +; OK. this block will do + Mov Byte Ptr [DI+8], 1 ; This block used + + Mov EBX, [DI] ; Size of block + Mov [DI], ESI ; New size of this block + + Mov EAX, [DI+4] ; To get next in HEAX + Mov ECX, EDI ; ECX = Current offset + ShR ECX, 4 ; ECX = Segment reference + Mov AX, CX ; AX = segment, HEAX = next seg + + Sub EBX, ESI ; Bytes in next block + JZ AllocateBlockPerfectEnd + Sub EBX, 16 + + LEA ESI, [ESI+EDI+16] ; ESI = position of split block + Push ESI + ShR ESI, 4 ; SI = segment of split block + Mov [DI+6], SI ; Store pointer to next block + Pop EDI ; EDI = position of split block + + Mov ECX, EDI ; ECX = position of split block + ShR ECX, 6 + And CH, Not 3 + Mov CL, 8 + Call E_MapEMSMemory + + Mov [DI], EBX ; bytes in block + Mov [DI+4], EAX ; Last block & Next block + Mov Byte Ptr [DI+8], 0 ; Unused block + + Push AX + Mov AX, [DI+6] + + Test AX, AX + JZ NoNextBlockSplit + + Call E_MapAlignedBlockEMS ; DS:SI Pointing to next + ShR EDI, 4 + Mov [SI+4], DI + +NoNextBlockSplit: + Pop AX + + ClC + Jmp AllocateBlockQuit + +AllocateBlockPerfectEnd: +; Mov Word Ptr [DI+6], 0 ; Last block. + ClC + Jmp AllocateBlockQuit + +AllocateBlockEMSNext: + Mov CX, [DI+6] ; Next segment + And ECX, 0FFFFh + JZ AllocateBlockQuitError + +; Check EDI and ECX for the same frame.. if the same, then skip updating (E)DI +; and only update DI + + ShLD EAX, EDI, 16 ; AL = 64k frame + Mov EDI, ECX + ShR CH, 4 + ShL EDI, 4 + + Cmp AL, CH + JE AllocateBlockEMS1 + + ShL CH, 2 + Mov CL, 8 + Jmp AllocateBlockEMS2 + +AllocateBlockQuitError: + StC + +AllocateBlockQuit: + Pop ES DS EDI ESI EDX ECX EBX + StI + Ret + +EndP E_AllocateBlockEMS + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc E_ReleaseBlockEMS Far ; Given AX = 'segment'. + + ClI + Push EAX EBX DS SI + + Mov BX, AX ; BX = current segment + Call E_MapAlignedBlockEMS + ; DS:SI points to structure. + + Mov Byte Ptr [DS:SI+8], 0 ; This block unused. + +; Release later block first, if possible + + Mov AX, [DS:SI+6] + Test AX, AX + JZ E_ReleaseBlockEMSNoneAfter ; Nope, this is the + ; last block. + Call E_MapAlignedBlockEMS ; OK, DS:0 points to next block + Mov EAX, [DS:SI+4] ; HEAX = next block, AX = last block + Mov EBX, [DS:SI] ; Free memory + Cmp Byte Ptr [DS:SI+8], 0 ; Used? + JNE E_ReleaseBlockAfterEnd + + Call E_MapAlignedBlockEMS + Add EBX, 16 + Add [DS:SI], EBX + + Push AX + Mov AX, [DS:SI+4] + Mov [DS:SI+4], EAX + Pop AX + + Jmp E_ReleaseBlockEMSBefore + +E_ReleaseBlockAfterEnd: + Call E_MapAlignedBlockEMS + Jmp E_ReleaseBlockEMSBefore + +E_ReleaseBlockEMSNoneAfter: + Mov AX, BX + +E_ReleaseBlockEMSBefore: + Test AX, AX + JZ E_ReleaseBlockFinished + + Mov EAX, [DS:SI+4] + Mov EBX, [DS:SI] + Call E_MapAlignedBlockEMS + + Cmp Byte Ptr [DS:SI+8], 0 + JNE E_ReleaseBlockPreviousFailed + + Push AX + + Mov AX, [DS:SI+4] ; Last field + Mov [DS:SI+4], EAX ; Next field written + Add EBX, 16 + Add [DS:SI], EBX + + Pop AX + Jmp E_ReleaseBlockFinished + +E_ReleaseBlockPreviousFailed: + Mov AX, [DS:SI+6] + +E_ReleaseBlockFinished: + Mov BX, AX + Call E_MapAlignedBlockEMS ; DS:SI points to 'base' block + Mov AX, [SI+6] ; Next + + Test AX, AX + JZ E_ReleaseBlockCleanup + + Call E_MapAlignedblockEMS + Mov [SI+4], BX + +E_ReleaseBlockCleanup: + + Pop SI DS EBX EAX + StI + Ret + +EndP E_ReleaseBlockEMS + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc E_AllocateEMS Far ; EAX = number of bytes + ; Returns AX with handle + ; 0 if no handle allocated + ; given carry = essential + ; no carry = spare EMS + + Push EBX + Push ECX + Push EDX + + Mov DX, CS:EMSHandlesRemaining + JC E_AllocateEMS3 + + Cmp DX, 10 + JB E_AllocateEMS2 + +E_AllocateEMS3: + Test DX, DX + JZ E_AllocateEMS1 + + Cmp CS:EMSAvailable, 0 + JE E_AllocateEMS2 + + Mov EBX, EAX + Add EBX, 16*1024-1 + SHR EBX, 14 + + Mov AH, 43h + Int 67h + Test AH, AH + JNZ E_AllocateEMS2 + + Dec CS:EMSHandlesRemaining + Jmp E_AllocateEMS1 + +E_AllocateEMS2: + Xor DX, DX + +E_AllocateEMS1: + Mov AX, DX + + Pop EDX + Pop ECX + Pop EBX + Ret + +EndP E_AllocateEMS + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc E_EMSAvailable Far ; Returns Zero flag set if no EMS + + Cmp CS:EMSAvailable, 0 + Ret + +EndP E_EMSAvailable + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Comment ~ + +Proc E_SavePageFrame Far ; Given DX = Handle +Public E_SavePageFrame + + Push AX + Push DX + + Mov AH, 47h + Int 67h + Test AH, AH + JZ E_SavePageFrame1 + + Call EMSWarning + +E_SavePageFrame1: + Pop DX + Pop AX + + Ret + +EndP E_SavePageFrame + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc E_RestorePageFrame Far ; Given DX = Handle +Public E_RestorePageFrame + + Push AX + Push DX + + Mov AH, 48h + Int 67h + Test AH, AH + JZ E_RestorePageFrame1 + + Call EMSWarning + +E_RestorePageFrame1: + Pop DX + Pop AX + + Ret + +EndP E_RestorePageFrame + +~ + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc E_SaveEMSPageFrame Far + + Cmp CS:EMSAvailable, 0 + JE E_SaveEMSPageFrame1 + + Push AX + Push DX + + Mov DX, CS:EMSHandle + Mov AH, 47h + Int 67h + +; Cmp AH, 1 + +; Test AH, AH +; JZ E_SaveEMSPageFrame2 + +; Call EMSWarning + + And AH, AH + JZ E_SaveEMSPageFrame2 + + StC + +E_SaveEMSPageFrame2: + Pop DX + Pop AX + +E_SaveEMSPageFrame1: + Ret + +EndP E_SaveEMSPageFrame + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc E_RestoreEMSPageFrame Far + + Cmp CS:EMSAvailable, 0 + JE E_RestoreEMSPageFrame1 + + Push AX + Push DX + + Mov DX, EMSHandle + Mov AH, 48h + Int 67h + + Pop DX + Pop AX + +E_RestoreEMSPageFrame1: + Ret + +EndP E_RestoreEMSPageFrame + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc E_GetEMSVersion Far + + Mov AL, CS:EMSVersion + Ret + +EndP E_GetEMSVersion + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc E_GetInternalEMSHandle Far + + Mov AX, CS:EMSHandle + Ret + +EndP E_GetInternalEMSHandle + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +IF EMSDEBUG + +Proc E_DumpEMSMemory Far + + Push CS + Pop DS + Assume DS:EMS + + Mov AH, 3Ch + Xor CX, CX + Mov DX, Offset EMSDumpName + Int 21h + + Mov BX, AX + + Mov CX, 8 + Mov DX, EMSHandle + Call E_MapEMSMemory + + Mov AH, 40h + Mov CX, 32768 + Mov DS, EMSPageFrame + Xor DX, DX + Int 21h + + Mov AH, 40h + Mov DX, 32768 + Mov CX, DX + Int 21h + + Mov CX, 408h + Mov DX, CS:EMSHandle + Call E_MapEMSMemory + + Mov AH, 40h + Mov CX, 32768 + Xor DX, DX + Int 21h + + Mov AH, 40h + Mov DX, 32768 + Mov CX, DX + Int 21h + + Mov AH, 3Eh + Int 21h + + Xor AX, AX + Ret + +EndP E_DumpEMSMemory + Assume DS:Nothing + +ENDIF + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +EndS + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +End diff --git a/IT_ERR.ASM b/IT_ERR.ASM new file mode 100644 index 0000000..cfa1c54 --- /dev/null +++ b/IT_ERR.ASM @@ -0,0 +1,168 @@ +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Critical Error handler. ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Jumps + .386 + +include switch.inc + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Externals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Globals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Global Error_InitHandler:Far + Global Error_UnInitHandler:Far + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +Segment Error BYTE Public 'Code' USE16 + Assume CS:Error + +CREATENEWLOGFILE EQU 0 +include debug.inc + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Variables ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +OldHandlerOffset DW ? +OldHandlerSegment DW ? + +ErrorMsgs Label Word + DW Offset Error0 + DW Offset Error1 + DW Offset Error2 + DW Offset Error3 + DW Offset Error4 + DW Offset Error5 + DW Offset Error6 + DW Offset Error7 + DW Offset Error8 + DW Offset Error9 + DW Offset ErrorA + DW Offset ErrorB + DW Offset UnknownError + DW Offset UnknownError + DW Offset UnknownError + DW Offset ErrorF + +Error0 DB "Write protect error", 0 +Error1 DB "Unknown unit error", 0 +Error2 DB "Drive not ready error", 0 +Error3 DB "Unknown command error", 0 +Error4 DB "Data integrity error", 0 +Error5 DB "Bad request structure length error", 0 +Error6 DB "Seek error", 0 +Error7 DB "Unknown media type error", 0 +Error8 DB "Sector not found error", 0 +Error9 DB "Printer error", 0 +ErrorA DB "Read fault error", 0 +ErrorB DB "General failure error", 0 +ErrorF DB "Invalid disk change error", 0 +UnknownError DB "Unknown critical error", 0 + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Functions ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Proc ErrorHandler Far + + PushA + Push DS + Push ES + + Push CS + Pop DS + Assume DS:Error + + Mov BX, DI + And BX, 0FFh + Cmp BX, 0Fh + JBE ErrorHandler1 + + Mov SI, Offset UnknownError + Jmp ErrorHandler2 + +ErrorHandler1: + Add BX, BX + Mov SI, [ErrorMsgs+BX] + +ErrorHandler2: + Mov AH, 20h + Mov DI, 0B800h + Mov ES, DI + Mov DI, (2+49*80)*2 + +ErrorHandler3: + LodsB + And AL, AL + JZ ErrorHandler4 + StosW + + Jmp ErrorHandler3 + +ErrorHandler4: + Pop ES + Pop DS + PopA + + Xor AX, AX + + IRet + +EndP ErrorHandler + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Error_InitHandler Far + + Push ES + + Trace " - Installing error handler" + + Xor AX, AX + Mov ES, AX + + Mov AX, CS + ShL EAX, 16 + Mov AX, Offset ErrorHandler + + XChg [ES:90h], EAX + Mov DWord Ptr CS:OldHandlerOffset, EAX + + Pop ES + Ret + +EndP Error_InitHandler + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Error_UnInitHandler Far + + Push ES + Xor AX, AX + Mov ES, AX + + Mov EAX, DWord Ptr CS:OldHandlerOffset + Mov [ES:90h], EAX + + Pop ES + Ret + +EndP Error_UnInitHandler + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +EndS + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +End diff --git a/IT_F.ASM b/IT_F.ASM new file mode 100644 index 0000000..2ae1157 --- /dev/null +++ b/IT_F.ASM @@ -0,0 +1,5950 @@ +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Functions ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Jumps + .386 + +include switch.inc +include network.inc + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Externals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +IF MEMORYDEBUG + +Segment StartUp BYTE Public 'Code' +EndS + +Segment InfoPage BYTE Public 'Code' +EndS + +Segment Glbl BYTE Public 'Code' +EndS + +Segment Help BYTE Public 'Code' +EndS + +Segment Error BYTE Public 'Code' +EndS + +Segment EMS BYTE Public 'Code' +EndS + +Segment KeyBoard BYTE Public 'Code' +EndS + +Segment InfoLine BYTE Public 'Code' +EndS + +Segment Main BYTE Public 'Code' +EndS + +ENDIF + +Segment Pattern BYTE Public 'Code' + Extrn PatternDataArea:Word +EndS + +Segment Inst BYTE Public 'Code' + Extrn MaxNode:Word +EndS + +Segment Music BYTE Public 'Code' + Extrn SongDataArea:Word + Extrn MIDIDataArea:Word +EndS + +Segment Disk BYTE Public 'Code' + Extrn DiskDataArea:Word +EndS + +Segment Screen BYTE Public 'Code' +EndS + +Segment Object1 BYTE Public 'Data' +EndS + +;------------------------------------------------------------------------------- + + Extrn LastInstrument:Byte + + Extrn D_GetLoadSampleVars:Far + Extrn D_ClearFileName:Far + Extrn D_SaveSong:Far + Extrn D_ResetTimer:Far + + Extrn E_UnInitEMS:Far + Extrn E_GetFreeEMS:Far + + Extrn Glbl_F2_2:Far + Extrn Glbl_F3:Far + Extrn Glbl_Ctrl_F3:Far + Extrn Glbl_Ctrl_F4:Far + Extrn Glbl_F4:Far + Extrn Glbl_F5:Far + Extrn Glbl_Ctrl_F5:Far + Extrn Glbl_F6:Far + Extrn PE_F7:Far + Extrn Glbl_Shift_F6:Far + Extrn Glbl_Shift_F9:Far + Extrn Glbl_F9:Far + Extrn Glbl_F10:Far + Extrn Glbl_F11_2:Far + Extrn Glbl_F12:Far + + Extrn Glbl_GetHeaderMode:Far + + Extrn H_Help:Far + + Extrn I_GetInstrumentOffset:Far + Extrn I_GetSampleOffset:Far + + Extrn I_DrawWaveForm:Far + Extrn I_MapEnvelope:Far + Extrn D_DrawWaveForm:Far + + Extrn S_InitScreen:Far + Extrn S_Set80x25Mode:Far + Extrn S_SetPalette2:Far + Extrn S_RedefineCharacters:Far + Extrn S_UnInitScreen:Far + Extrn S_DrawBox:Far + Extrn S_UpdateScreen:Far + Extrn S_OverrideVGADetection:Far + Extrn S_SetDirectMode:Far + Extrn S_DrawString:Far + Extrn S_HiLight:Far + Extrn S_GetDestination:Far + Extrn S_SaveScreen:Far + Extrn S_RestoreScreen:Far + + + Extrn Music_GetSongSegment:Far + Extrn Music_InitMixTable:Far + Extrn Music_InitMuteTable:Far + Extrn Music_ClearAllInstruments:Far + Extrn Music_SetGlobalVolume:Far + Extrn Music_InitStereo:Far + Extrn Music_Stop:Far + + Extrn Music_RegetLoopInformation:Far + + Extrn Music_ReleaseAllSamples:Far ; For New Song Function + Extrn Music_ReleaseAllPatterns:Far + Extrn Music_ClearAllInstruments:Far + Extrn Music_ClearAllSampleNames:Far + Extrn Music_GetFreeSoundCardMemory:Far + Extrn Music_SoundCardLoadAllSamples:Far + Extrn Music_ReinitSoundCard:Far + Extrn Music_TimeSong:Far + + Extrn Glbl_DriverScreen:Far + Extrn Music_GetDriverVariable:Far + Extrn Music_SetDriverVariable:Far + + Extrn M_Object1List:Far + + Extrn Msg_ResetMessage:Far + + Extrn O1_EmptyList:Far + Extrn O1_ThumbStringList:Far + Extrn O1_InitialiseInstrumentList:Far + Extrn O1_NewSongList:Far + + Extrn O1_MainMenu:Far + Extrn O1_FileMenu:Far + Extrn O1_PlaybackMenu:Far + Extrn O1_SampleMenu:Far + Extrn O1_InstrumentMenu:Far + + Extrn PE_ConvAX2Num:Far + Extrn PE_ResetOrderPattern:Far + + Extrn DOSShell:Far + Extrn Quit:Far + + Extrn MouseAddEvent:Far, AddMouseQueue:Far, MouseClearEvents:Far + Extrn SetKeyboardLock:Far, NewCharacterSet:Far + Extrn MouseRemoveEvents:Far, MouseRestoreEvents:Far + Extrn MultiChannelInfo:Byte + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Globals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Global F_MainMenu:Far + Global F_FileMenu:Far + Global F_PlaybackMenu:Far + Global F_SampleMenu:Far + Global F_InstrumentMenu:Far + + Global F_DrawHeader:Far + + Global F_InstrumentButtonHandler:Far + + Global F_NewSong:Far + Global F_DrawStringInput:Far + Global F_PreStringInput:Far + Global F_PostStringInput:Far + Global F_RedrawScreen:Far + Global F_Nothing:Far + Global F_DrawBoxObject:Far + Global F_DrawTextObject:Far + Global F_PostExitObject:Far + Global F_SetDirectMode:Far + Global F_CharacterDefinitions:Far + Global F_CallFarFunction:Far + Global F_CallFarPreFunction:Far + Global F_CallFarPostFunction:Far + + Global F_DrawToggle:Far + Global F_PreToggle:Far + Global F_PostToggle:Far + + Global F_Draw5Num:Far + Global F_Pre5Num:Far + Global F_Post5Num:Far + + Global F_Draw3Num:Far + Global F_Pre3Num:Far + Global F_Post3Num:Far + + Global F_DrawButtonObject:Far + Global F_PreButtonObject:Far + Global F_PostButtonObject:Far + + Global F_Return0:Far + Global F_Return1:Far + Global F_Return64:Far + Global F_Return192:Far + + Global F_DrawThumbBar:Far + Global F_DrawScalableThumbBar:Far + Global F_PreThumbBar:Far + Global F_PreScalableThumbBar:Far + Global F_PostThumbBar:Far + Global F_PostScalableThumbBar:Far + + Global F_DrawInfoLine:Far + + Global F_ShowChannels:Far + Global F_GotoEmptyList:Far + Global F_DrawSMCChannels:Far + + Global F_SetControlInstrument:Far + Global F_SetControlSample:Far + Global F_ConfigButtonSetup:Far + + Global F_SetStereo:Far + Global F_SetMono:Far + Global F_SetAmiga:Far + Global F_SetLinear:Far + + Global F_Reset5NumInputPos:Far + + Global AddressInput:Byte + Global ThumbStringEnter:Byte + + Global F_MessageEditor:Far + Global F_Help:Far ; Main menu + Global F_ViewPattern:Far + Global F_ViewVariables:Far + Global F_ViewOrderPan:Far + + Global F_FileLoad:Far + Global F_FileNew:Far + Global F_FileSaveCurrent:Far + Global F_FileSaveAs:Far + Global F_FileDOSShell:Far + Global F_FileQuit:Far + + Global F_InfoPage:Far ; Playback menu + Global F_PlaySong:Far + Global F_PlayPattern:Far + Global F_PlayOrder:Far + Global F_Stop:Far + Global F_PlayMark:Far + Global F_DriverScreen:Far + Global F_ReinitSoundCard:Far + Global F_CalculateLength:Far + + Global F_SampleList:Far + Global F_SampleLibrary:Far + Global F_ReloadGravis:Far + + Global F_InstrumentList:Far + Global F_InstrumentLibrary:Far + +IF MEMORYDEBUG + + Global F_DrawDebug:Far + Global F_DebugUp:Far + Global F_DebugDown:Far + Global F_DebugPgUp:Far + Global F_DebugPgDn:Far + Global F_DebugStringInput:Far + Public F_PostDebug + +ENDIF + + Public F_ShowMIDIZxxInput + Public F_MIDI_Up + Public F_MIDI_Down + Public F_MIDI_PgUp, F_MIDI_PgDn + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +Segment Functions BYTE Public 'Code' USE16 + Assume CS:Functions, DS:Nothing + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Variables ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +ButtonVariables Label Word + DW 220h ; Standard SB Configs + DW 7 + DW 1 + DW 1 ; Clear patterns + DW 1 ; Clear samples + DW 1 ; Clear instruments + DW 1 ; Clear order list + +ButtonTypes Label Word + DW Offset ButtonType0 ; Press/Release buttons + DW Offset ButtonType1 ; Toggle Press/Release + DW Offset ButtonType2 ; One of Selection + +ButtonEffects Label Word + DW Offset ButtonEffect0 ; Return value + DW Offset ButtonEffect1 ; New object list + DW Offset ButtonEffect2 ; Call function + DW Offset ButtonEffect3 ; Set var at offset + DW Offset ButtonEffect4 ; Jump to function + DW Offset ButtonEffect5 ; Set var + DW Offset ButtonEffect6 ; Jump to function + +ButtonWidth Label Word + DW 0, 0, 0, 0, 0, 0, 0, 0 + DW 7, 7, 7, 7, 7, 7, 7, 7 + DW 0, 0, 0, 0, 0, 0, 0, 0 + DW 7, 7, 7, 7, 0, 0, 0, 0 + +MouseEventData DW 7 Dup (0), Functions + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +GetThumbValues Label Word + DW Offset GetPanning + DW Offset GetPEVariables + DW Offset GetSampleVariables + DW Offset GetMusicVariables + DW Offset GetPanning ; ChannelVol + DW Offset GetLoadSampleVariables + DW Offset GetInstVariables + DW Offset GetScreenVariables + DW Offset GetInstrumentVariables + DW Offset GetDriverVariables + +DrawThumbValues Label Word + DW Offset DrawPanning + DW Offset F_NothingNear + DW Offset F_NothingNear + DW Offset F_NothingNear + DW Offset F_NothingNear + DW Offset F_NothingNear + DW Offset DrawMIDIChannel + DW Offset F_NothingNear + DW Offset F_NothingNear + DW Offset F_NothingNear + +PreThumbFuncs Label Word + DW Offset HiLightPanning + DW Offset GetPEVariables + DW Offset GetSampleVariables + DW Offset GetMusicVariables + DW Offset GetPanning ; Channelvol + DW Offset GetLoadSampleVariables + DW Offset GetInstVariables + DW Offset GetScreenVariables + DW Offset GetInstrumentVariables + DW Offset GetDriverVariables + +PostThumbFuncs Label Word + DW Offset SetPanning + DW Offset SetPEVariables + DW Offset SetSampleVariables + DW Offset SetMusicVariables + DW Offset SetPanning + DW Offset SetLoadSampleVariables + DW Offset SetInstVariables ; Inst + DW Offset SetScreenVariables + DW Offset SetInstrumentVariables ; Inst segment + DW Offset SetDriverVariables + +PostThumbCheck Label Word + DW Offset PanningKeys + DW Offset F_NothingNear + DW Offset F_NothingNear + DW Offset F_NothingNear + DW Offset F_NothingNear + DW Offset F_NothingNear + DW Offset FilterKeys + DW Offset F_NothingNear + DW Offset F_NothingNear + DW Offset F_NothingNear + +ThumbStringEnter DB 0 + DB 4 Dup (0) + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +; LastStringData DD 0 + +StringInputOffset Label Word + DW Offset GetSIODiskSegment + DW Offset GetSampleString + DW Offset GetSIOInstSegment + DW Offset GetLoadSampleString + DW Offset GetMusicSegmentString ; Songsegment + DW Offset GetPatternSegmentString + DW Offset GetInstrumentString + DW Offset GetMIDIString + +PostStringInput Label Word + DW Offset F_NothingNear + DW Offset SetSampleString + DW Offset F_NothingNear + DW Offset F_NothingNear + DW Offset SetMusicSegmentString ; Songsegment + DW Offset F_NothingNear + DW Offset SetInstrumentString + DW Offset F_NothingNear + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +GetToggleStatus Label Word + DW Offset GetSampleToggle + DW Offset GetPatternSegmentToggle + DW Offset GetMusicSegmentToggle + DW Offset GetLoadSampleToggle + DW Offset GetInstrumentToggle + +ToggleBit Label Word + DW Offset SampleToggle + DW Offset PatternSegmentToggle + DW Offset MusicSegmentToggle + DW Offset LoadSampleToggle + DW Offset InstrumentToggle + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +TripleNumberPos DW 0 + +Get3NumValues Label Word + DW Offset GetInstrument3Num + +Set3NumValues Label Word + DW Offset SetInstrument3Num + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +NumberPos DW 0 + +Get5NumValues Label Word + DW Offset GetSample5Num + DW Offset GetLoadSample5Num + Dw Offset GetInst5Num + +Set5NumValues Label Word + DW Offset SetSample5Num + DW Offset SetLoadSample5Num + DW Offset SetInst5Num + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +HeaderMsg1 Label Byte +IF SHOWVERSION + DB 0FFh, 9, ' ', "Impulse Tracker v2.14 Copyright (C) 1995-2000 Jeffrey Lim", 13 +ELSE + DB 0FFh, 12, ' ', "Impulse Tracker Copyright (C) 1995-2000 Jeffrey Lim", 13 +ENDIF + DB 0FFh, 9, ' ', 0FEh, 21h, 139, 0FFh, 25, 134, 138, 0FFh, 11, ' ', 139, 0FFh, 28, 134, 138, 13 + DB 0FEh, 20h, "Song Name", 0FEh, 21h, 132, 0FEh, 5, 0FFh, 25, ' ', 0FEh, 23h, 131, 0FEh, 20h, 0 + +HeaderMsg2 DB " Instrument" + DB 0FEh, 21h, 132, 0FEh, 7, " :", 0FFh, 25, ' ', 0FEh, 23h, 131, 0 + +HeaderMsg3 DB 0FFh, 5, " Sample" + DB 0FEh, 21h, 132, 0FEh, 7, " :", 0FFh, 25, ' ', 0FEh, 23h, 131, 0 + +HeaderMsg4 DB "File Name", 0FEh, 21h, 132, 0FEh, 5, 0FFh, 18, ' ', 0FEh, 23h, 128, 0FFh, 6, 129, 136, 0FEh, 20h, "Speed/Tempo", 0FEh, 21h, 132, 0FEh, 5, " ", 0FEh, 1, "/", 0FEh, 5, " ", 0FEh, 23h, 128, 0FFh, 20, 129, 136, 13 + DB 0FEh, 20h, 0FFh, 4, " Order", 0FEh, 21h, 132, 0FEh, 5, " ", 0FEh, 1, "/", 0FEh, 5, " ", 0FEh, 23h, 128, 0FFh, 10, 129, 136, 0FEh, 20h, 0FFh, 12, " Octave", 0FEh, 21h, 132, 0FEh, 5, " ", 0FEh, 23h, 128, 0FFh, 5, 129, 136, 13 + DB 0FEh, 20h, " Pattern", 0FEh, 21h, 132, 0FEh, 5, " ", 0FEh, 1, "/", 0FEh, 5, " ", 0FEh, 23h, 131, 0FEh, 20h, " F1...Help F9.....Load ", 0FEh, 23h, 137, 129, 136, 0FEh, 20h, 0FFh, 11, " FreeMem ", 0FDh, "Dk ", 13 + DB 0FEh, 20h, 0FFh, 6, " Row", 0FEh, 21h, 132, 0FEh, 5, " ", 0FEh, 1, "/", 0FEh, 5, " ", 0FEh, 23h, 131, 0FEh, 20h, " ESC..Main Menu F5/F8..Play / Stop", 0FFh, 8, " FreeEMS ", 0FDh, "Dk", 13 + DB 0FEh, 23h, 0FFh, 9, ' ', 137, 0FFh, 7, 129, 136 + DB 0 + +ChannelMsg DB "Channel " +ChannelNumbers DB "xx", 0 + +HexNumbers DB "0123456789ABCDEF" +SurroundMessage DB "Surround", 0 +MutedMessage DB " Muted", 0 +ForwardMsg DB "Forwards", 0 +PingPongMsg DB "Ping Pong", 0 +ZxxString DB "Z", 0FDh, "X", 0 +NumberStorage DW 0, 0, 0, 0, 0, 0, 0, 0, 0 +PitchMessage DB "Pitch", 0 +FilterMessage DB "Filter", 0 + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Functions ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Proc F_Nothing Far + + Xor AX, AX + Ret + +EndP F_Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_InstrumentButtonHandler Far + + Test AX, AX + JZ F_InstrumentButtonHandler1 + + NetworkSendInstrument + +F_InstrumentButtonHandler1: + Push DS + Call I_GetInstrumentOffset ; Returns DS:BX + Push DS + Pop ES + Mov DI, BX + Pop DS + + Add DI, [SI+24] + Ret + +EndP F_InstrumentButtonHandler + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_NothingNear + + Xor AX, AX + Ret + +EndP F_NothingNear + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_CallFarPreFunction Far + + Call DWord Ptr [SI+6] + + Ret + +EndP F_CallFarPreFunction + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_CallFarPostFunction Far + + Mov SI, [BX] + + Call DWord Ptr [SI+10] + + Ret + +EndP F_CallFarPostFunction + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_CallFarFunction Far + + Call DWord Ptr [SI+2] + + Ret + +EndP F_CallFarFunction + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_DrawBoxObject Far + + LodsW + Xor AH, AH + LodsB + Push AX + LodsB + Push AX + LodsB + Push AX + LodsB + Push AX + LodsB + Push AX + Call S_DrawBox + Add SP, 10 + + Ret + +EndP F_DrawBoxObject + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_DrawTextObject Far + + LodsW + + Mov BX, 3 + Xor CX, CX ; CX = string length count + Xor DX, DX + +F_DrawTextObject1: + Mov AL, [SI+BX] + Inc BX + Cmp AL, 0 + JE F_DrawTextObject2 + + Cmp AL, 0FDh + JNE F_DrawTextObject1 + Inc CX + Cmp Byte Ptr [SI+BX], 'L' + JNE F_DrawTextObject1 + Inc CX + Jmp F_DrawTextObject1 + +F_DrawTextObject2: + JCXZ F_DrawTextObject3 + Push Word Ptr [SI+BX] + Add BX, 2 + Inc DX + Dec CX + Jmp F_DrawTextObject2 + +F_DrawTextObject3: + Mov AL, 80 + Mul Byte Ptr [SI+1] + Add AL, [SI] + AdC AH, 0 + Add AX, AX + Mov DI, AX + Mov AH, [SI+2] + Add SI, 3 + Call S_DrawString + + Add DX, DX + Add SP, DX + + Ret + +EndP F_DrawTextObject + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_PostExitObject Far + + Xor AX, AX + Test CH, 1 + JNZ F_PostExitObject1 + + Mov SI, [BX] + Mov DX, [SI+2] + Mov AX, 4 ; Exit from MainProc + +F_PostExitObject1: + Ret + +EndP F_PostExitObject + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_SetDirectMode Far + + LodsW + LodsB + Call S_SetDirectMode + + Ret + +EndP F_SetDirectMode + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_CharacterDefinitions Far + + LodsW + LodsW + Mov BX, [SI] + Add SI, 2 + Call S_RedefineCharacters + + Ret + +EndP F_CharacterDefinitions + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MouseButtonPress Far ; Given CX, DX = coords + ; Given AX = Object number + ; DS:SI points to mouse obj + Mov CX, 11Ch + Xor DX, DX + Call AddMouseQueue + + Mov Word Ptr [SI+8], 1108h + Mov Word Ptr [SI+12], Offset MouseButtonRelease + + Mov AL, 2 + Call SetKeyboardLock + + Xor AX, AX + Ret + +EndP MouseButtonPress + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MouseButtonRelease Far + + Mov CX, 01Ch + Xor DX, DX + Call AddMouseQueue + + Mov Word Ptr [SI+8], 102h + Mov Word Ptr [SI+12], Offset MouseButtonPress + + Xor AX, AX + Call SetKeyboardLock + + Ret + +EndP MouseButtonRelease + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_DrawButtonObject Far ; AX = object number + ; SI = object + + Mov [CS:MouseEventData+10], AX ; Store object number + + Cmp Word Ptr [SI+16], 5 + JB F_DrawButtonObject1 + + Xor AX, AX + Call DWord Ptr [SI+18] + Mov AX, [SI+22] + ScasB +; Cmp [ES:DI], AL + + SetE [SI+33] + +F_DrawButtonObject1: + Mov BX, [SI+32] + And BX, 0FFh + Add SI, 28 + Add BX, BX + Mov DX, [CS:ButtonWidth+BX] + + Xor AH, AH + LodsB + LEA CX, [EAX*8+EDX] + Mov [CS:MouseEventData+0], CX + Push AX + + LodsB + LEA CX, [EAX*8+EDX] + Mov [CS:MouseEventData+2], CX + Push AX + + Sub DX, 7 + + LodsB + Mov CX, AX + ShL CX, 3 + Sub CX, DX + Mov [CS:MouseEventData+4], CX + Push AX + + LodsB + Mov CX, AX + ShL CX, 3 + Sub CX, DX + Mov [CS:MouseEventData+6], CX + Push AX + + LodsB ; Base Style + Mov BL, [SI] ; Up/Down + And BL, 1 + Mov [SI], BL + Add AL, BL + Push AX + Call S_DrawBox + Add SP, 10 + + Inc SI + + Mov AL, 80 + Mul Byte Ptr [SI-5] + Add AL, [SI-6] + AdC AH, 0 + Add AX, AX + Add AX, 162 + Mov DI, AX + Mov AH, 20h + + Call S_DrawString + + Push CS + Pop DS + Mov SI, Offset MouseEventData + Mov [MouseEventData+8], 102h ; Left mouse button pressed + Mov [MouseEventData+12], Offset MouseButtonPress + Call MouseAddEvent + + Ret + +EndP F_DrawButtonObject + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_PreButtonObject Far + + Add SI, 28 + Xor AH, AH + LodsB + Push AX + LodsB + Push AX + LodsB + Push AX + LodsB + Push AX + LodsB ; Base Style + Mov BL, [SI] ; Up/Down + And BL, 1 + Add AL, BL + Push AX + Call S_DrawBox + Add SP, 10 + + Inc SI + + Mov AL, 80 + Mul Byte Ptr [SI-5] + Add AL, [SI-6] + AdC AH, 0 + Add AX, AX + Add AX, 162 + Mov DI, AX + Mov AH, 23h + + Call S_DrawString + + Ret + +EndP F_PreButtonObject + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_PostButtonObject Far + + Mov SI, [BX] + Push SI + Push DI + Push BX + Push CX + Push DX + + Add SI, 28 + Mov AL, 80 + Mul Byte Ptr [SI+1] + Add AL, [SI] + AdC AH, 0 + Add AX, AX + Add AX, 162 + Mov DI, AX + Mov AL, 20h + Mov CL, [SI+2] + Sub CL, [SI] + Dec CL + Xor CH, CH + Call S_HiLight + + Pop DX + Pop CX + Pop BX + Pop DI + Pop SI + + Test CH, 80h + JNZ F_PostButtonNoMIDI + + Mov AL, [SI+33] + Cmp CL, 1Ch + JE F_PostButtonObject6 ; Enter + + Test AL, 2 + JNZ F_PostButtonObject7 + + Cmp CX, 1C8h ; Up pressed + JE F_PostButtonObject1 + + Cmp CX, 1D0h + JE F_PostButtonObject2 ; Down + + Cmp CX, 1CBh + JE F_PostButtonObject3 ; Left + + Cmp CX, 1CDh + JE F_PostButtonObject4 ; Right + + Cmp CX, 10Fh ; Tab + JE F_PostButtonObject4 + +; Test CL, CL +; JZ F_PostButtonNOMIDI + + Cmp DX, 0F00h ; Shift tab + JE F_PostButtonObject3 + +F_PostButtonNOMIDI: + Xor AX, AX + Ret + +F_PostButtonObject7: + Test AL, 4 + JZ F_PostButtonObject8 + Test CH, 1 + JZ F_PostButtonObject8 + + And AX, 1 + Xor AL, 1 + Mov [SI+33], AL + +F_PostButtonObject8: + Mov AX, 2 + Ret + +F_PostButtonObject4: + LodsW + +F_PostButtonObject3: + LodsW + +F_PostButtonObject2: + LodsW + +F_PostButtonObject1: + LodsW + + LodsW + Cmp AX, 0FFFFh + JNE F_PostButtonObject5 + + Xor AX, AX + Ret + +F_PostButtonObject5: + Mov [DI], AX + Mov AX, 2 + Ret + +F_PostButtonObject6: ; Enter pressed + Push BX + + Mov BX, [SI+10] + Add BX, BX + Jmp [CS:ButtonTypes+BX] + +EndP F_PostButtonObject + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ButtonType0 Far + + Pop BX + + Test CH, 1 + JZ ButtonType0_1 + + Or Byte Ptr [SI+33], 7 + +ButtonType0_2: + Mov AX, 2 + Ret + +ButtonType0_1: + Test AL, 1 + JNZ ButtonType0_4 + + Test AL, 2 + JZ ButtonType0_2 + +ButtonType0_4: + Mov Byte Ptr [SI+33], 0 + + Jmp ButtonEffect + +EndP ButtonType0 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ButtonType1 Far + + Pop BX + + And CH, CH + JZ ButtonType1_2 + + Test AL, 2 + JNZ ButtonType1_1 + + Xor Byte Ptr [SI+33], 7 + +ButtonType1_1: + Mov AX, 2 + Ret + +ButtonType1_2: + And Byte Ptr [SI+33], 1 + + Jmp ButtonEffect + +EndP ButtonType1 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ButtonEffect Far + + Mov BX, [SI+16] + Add BX, BX + Jmp [CS:ButtonEffects+BX] + +EndP ButtonEffect + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ButtonType2 Far + + Pop BX + + And CH, CH + JZ ButtonEffect + + Test AL, 2 + JZ ButtonType2_1 + + Mov AX, 2 + Ret + +ButtonType2_1: + Add SI, 12 + LodsW + Mov CX, AX + LodsW + Mov DX, AX + Add DX, DX + Add DI, 6 + Add DX, DI + Add CX, CX + Add DI, CX + + Xor AX, AX + +ButtonType2_2: + Mov SI, [DI] + Mov [SI+33], AL + + ScasW +; Add DI, 2 + Cmp DI, DX + JBE ButtonType2_2 + + Mov SI, [BX] + Mov Byte Ptr [SI+33], 1 + + Mov AX, 1 + Ret + +EndP ButtonType2 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ButtonEffect0 Far + + Mov DX, [SI+18] + Mov AX, 4 + Ret + +EndP ButtonEffect0 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ButtonEffect1 Far + + Mov CX, [SI+20] + Mov DX, [SI+18] + Mov AX, 5 + Mov SI, 1 + Ret + +EndP ButtonEffect1 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ButtonEffect2 Far + + Push DS + Push SI + + Mov AL, [SI+33] + Call DWord Ptr [SI+18] + + Pop SI + Pop DS + + Mov AX, 1 + + Ret + +EndP ButtonEffect2 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ButtonEffect3 Far + + Mov BX, [SI+18] ; Var number + Mov AX, [SI+20] + Add BX, BX + Mov [CS:ButtonVariables+BX], AX + + Mov AX, 1 + Ret + +EndP ButtonEffect3 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ButtonEffect4 Far + + Jmp DWord Ptr [SI+18] + +EndP ButtonEffect4 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ButtonEffect5 Far + + Mov AX, 1 + Call DWord Ptr [SI+18] + Mov AX, [SI+22] + + StosB +; Mov [ES:DI], AL + + Mov AX, 1 + Ret + +EndP ButtonEffect5 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ButtonEffect6 Far + + Jmp DWord Ptr [SI+24] + +EndP ButtonEffect6 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetPanning ; DI = channel no. + + Push DS + + Call Music_GetSongSegment + Mov DS, AX + + Mov DL, [DI+64] + Xor DH, DH + + Pop DS + + Ret + +EndP GetPanning + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetPEVariables + + Push DS + + Mov DX, Pattern + Mov DS, DX +; Call PE_GetPatternSegment + Mov DL, [DI] + Xor DH, DH + + Pop DS + Ret + +EndP GetPEVariables + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetScreenVariables + + Push DS + + Mov DX, Screen + Mov DS, DX + Mov DL, [DI] + Xor DH, DH + + Pop DS + Ret + +EndP GetScreenVariables + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SetScreenVariables + + Push DS + Push AX + + Mov AX, Screen + Mov DS, AX + Pop AX + + Mov [DI], AL + Call S_SetPalette2 + + Pop DS + Ret + +EndP SetScreenVariables + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SetPanning + + Push DS + + Push AX + Call Music_GetSongSegment + Mov DS, AX + Pop AX + Add DI, 64 + + Mov [DI], AL + +IF NETWORKENABLED + Mov CX, 1 + Mov DX, DI + Call Network_SendSongDataInformation +ENDIF + + Pop DS + Ret + +EndP SetPanning + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SetPEVariables + + Push DS + + Push AX + Mov AX, Pattern + Mov DS, AX +; Call PE_GetPatternSegment + Pop AX + + Mov [DI], AL + + Pop DS + Ret + +EndP SetPEVariables + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetInstVariables + + Push DS + Push AX + Push BX + + Call I_GetInstrumentOffset + + Mov DX, [BX+DI] + Cmp DI, 19h + JNE GetInstVariables1 + + And DX, 7Fh + +GetInstVariables1: + +; If DI = 3Ah or 3Bh, the XOR top bit. + Cmp DI, 3Ah + JB GetInstVariables4 + Cmp DI, 3Bh + JA GetInstVariables4 + + Xor DL, 80h + Jmp GetInstVariables3 + +GetInstVariables4: + + Cmp DI, 14h + JE GetInstVariables2 + Xor DH, DH + Cmp DI, 3Dh + JAE GetInstVariables3 + Cmp DI, 16h + JNE GetInstVariables2 + +GetInstVariables3: + MovSX DX, DL + +GetInstVariables2: + Pop BX + Pop AX + Pop DS + + Ret + +EndP GetInstVariables + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetSampleVariables + + Push DS + Push AX + Push BX + + Call I_GetSampleOffset + + Mov DL, [BX+DI] + Xor DH, DH + Cmp DI, 2Fh + JNE GetSampleVariables1 + + And DL, 7Fh + +GetSampleVariables1: + Pop BX + Pop AX + Pop DS + + Ret + +EndP GetSampleVariables + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetMusicVariables + + Push DS + + Call Music_GetSongSegment + Mov DS, AX + Xor DX, DX + Mov DL, [DI] + + Pop DS + + Ret + +EndP GetMusicVariables + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetInstrumentVariables + + Push DS + + Mov AX, Inst + Mov DS, AX + Mov DX, [DI] + + Pop DS + + Ret + +EndP GetInstrumentVariables + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetDriverVariables + + Call Music_GetDriverVariable + Mov DX, AX + Ret + +EndP GetDriverVariables + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SetDriverVariables + + Call Music_SetDriverVariable + Ret + +EndP SetDriverVariables + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetLoadSampleVariables + + Push DS + Push SI + Push BX + + Call D_GetLoadSampleVars + Mov BX, SI + + Mov DL, [BX+DI] + Xor DH, DH + + Pop BX + Pop SI + Pop DS + + Ret + +EndP GetLoadSampleVariables + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SetInstVariables + + Push DS + Push BX + Push AX + + Call I_GetInstrumentOffset + + Pop AX + +IF FILTERENVELOPES + Cmp DI, 3Ah + JB SetInstVariables3 + Cmp DI, 3Bh + JA SetInstVariables3 + + Xor AL, 80h +ELSE + And Word Ptr [BX+3Ah], 7F7Fh +ENDIF + +SetInstVariables3: + Mov [BX+DI], AL + Cmp DI, 14h + JNE SetInstVariables1 + +SetInstVariables2: + Mov [BX+DI], AX + +SetInstVariables1: + NetworkSendInstrument + + Pop BX + Pop DS + + Ret + +EndP SetInstVariables + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SetSampleVariables + + Push DS + Push BX + Push AX + + Call I_GetSampleOffset + + Pop AX + Cmp DI, 2Fh + JNE SetSampleVariables1 + + Or AL, 80h ; Turn on. + +SetSampleVariables1: + Mov [BX+DI], AL + + Pop BX + Pop DS + + NetworkSendSample + + Ret + +EndP SetSampleVariables + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SetMusicVariables + + Push DS + Push AX + + Call Music_GetSongSegment + Mov DS, AX + + Pop AX + Mov [DI], AL + +IF NETWORKENABLED + Mov CX, 1 + Mov DX, DI + Call Network_SendSongDataInformation +ENDIF + + Cmp DI, 31h + JNE SetMusicVariables1 + + Call Music_InitMixTable + Jmp SetMusicVariablesEnd + +SetMusicVariables1: + Cmp DI, 30h + JNE SetMusicVariables3 + + Call Music_SetGlobalVolume + +SetMusicVariables3: + +SetMusicVariablesEnd: + Pop DS + + Ret + +EndP SetMusicVariables + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SetInstrumentVariables + + Push DS + Push AX + + Mov AX, Inst + Mov DS, AX + + Pop AX + Mov [DI], AX + + Pop DS + + Ret + +EndP SetInstrumentVariables + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SetLoadSampleVariables + + Push DS + Push SI + Push BX + + Call D_GetLoadSampleVars + Mov BX, SI + + Mov [BX+DI], AL + + Pop BX + Pop SI + Pop DS + + Ret + +EndP SetLoadSampleVariables + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MousePressThumbBar Far + + Mov DX, CX + Mov CX, 8010h + Call AddMouseQueue + + Mov Word Ptr [SI+8], 1109h ; move or release + Mov Word Ptr [SI+12], Offset MouseHeldThumbBar + + Mov AL, 1 + Call SetKeyboardLock + + Xor AX, AX + + Ret + +EndP MousePressThumbBar + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MouseHeldThumbBar Far + + Test BH, 8 + JNZ MouseHeldThumbBar2 + +MouseHeldThumbBar1: + Mov DX, CX + Mov CX, 8010h + Call AddMouseQueue + Ret + +MouseHeldThumbBar2: + Mov CX, 8001h ; Redraw screen + Call AddMouseQueue + +; Mov Word Ptr [SI+8], 102h +; Mov Word Ptr [SI+12], Offset MousePressThumbBar + + Xor AX, AX + Call SetKeyboardLock + + Ret + +EndP MouseHeldThumbBar + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_DrawThumbBar Far + + Mov [CS:MouseEventData+10], AX ; Store object number + + Call S_GetDestination + + Mov BX, [SI+8] + Mov DI, [SI+10] + Add BX, BX + Call [CS:GetThumbValues+BX] ; DX returns thumbbar value + + Mov AL, 80 + Mul Byte Ptr [SI+3] + Add AL, [SI+2] + AdC AH, 0 + Add AX, AX + Mov DI, AX ; ES:DI points to area... + + Cmp DX, [SI+6] + JG F_DrawThumbBar2 + Cmp DX, [SI+4] + JL F_DrawThumbBar2 + + Mov CX, [SI+6] + Sub CX, [SI+4] + Add CX, 15 + ShR CX, 3 + Mov BX, CX + Mov AX, 300h +; Xor AX, AX + + Push DI + Push DI + + Rep StosW + + Pop DI + Push BX + Push DI + Mov BX, DX ; DX = value to show. + Sub BX, [SI+4] + Inc BX + Mov AX, BX + ShR BX, 3 + Add BX, BX + Add DI, BX + And AX, 7 + Add AX, 155 + Mov AH, 2 + StosW + + Cmp AL, 157 + JBE F_DrawThumbBar1 + Add AL, 5 + StosW + +F_DrawThumbBar1: + Pop DI + Pop BX + LEA DI, [EDI+EBX*2+2] + Mov CH, 21h + Mov AX, DX + Call PE_ConvAX2Num + + Pop DI + +F_DrawThumbBar2: + Mov BX, [SI+8] + Add BX, BX + Call [CS:DrawThumbValues+BX] ; DX returns pan value + + Mov CX, [SI+6] + Sub CX, [SI+4] + Add CX, 15 + ShR CX, 3 + + Xor AH, AH + Mov AL, [SI+2] + ShL AX, 3 + Mov [CS:MouseEventData+0], AX + ShL CX, 3 + Add AX, CX + Dec AX + Mov [CS:MouseEventData+4], AX + + Xor AH, AH + Mov AL, [SI+3] + ShL AX, 3 + Mov [CS:MouseEventData+2], AX + Add AX, 7 + Mov [CS:MouseEventData+6], AX + + Push CS + Pop DS + Assume DS:Functions + Mov SI, Offset MouseEventData + Mov Word Ptr [SI+8], 102h + Mov Word Ptr [SI+12], Offset MousePressThumbBar + Call MouseAddEvent + + Ret + +EndP F_DrawThumbBar + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_DrawScalableThumbBar Far + + Mov [CS:MouseEventData+10], AX ; Store object number + + Call S_GetDestination + + Mov BX, [SI+8] + Mov DI, [SI+10] + Add BX, BX + Call [CS:GetThumbValues+BX] ; DX returns thumbbar value + + Mov AL, 80 + Mul Byte Ptr [SI+3] + Add AL, [SI+2] + AdC AH, 0 + Add AX, AX + Mov DI, AX ; ES:DI points to area... + + Cmp DX, [SI+6] + JG F_DrawScalableThumbBar2 + Cmp DX, [SI+4] + JL F_DrawScalableThumbBar2 + + Push DI + Push DI + + Mov AX, 300h + Mov CX, [SI+24] ; Display length + Inc CX + Rep StosW + + ; Volume bar position = Value*Width / (MaxVal-MinVal) + + Pop DI + Push DI + + Push DX + + Mov AX, [SI+24] + ShL AX, 3 + Sub DX, [SI+4] + Mul DX + Mov CX, [SI+6] + Sub CX, [SI+4] + Div CX + + Inc AX + Mov BX, AX + ShR BX, 3 + Add BX, BX + Add DI, BX + And AX, 7 + Add AX, 155 + Mov AH, 2 + StosW + + Cmp AL, 157 + JBE F_DrawScalableThumbBar1 + Add AL, 5 + StosW + +F_DrawScalableThumbBar1: + Pop DX + + Pop DI + + Mov AX, [SI+24] + LEA DI, [EDI+EAX*2+4] + Mov CH, 21h + Mov AX, DX + Call PE_ConvAX2Num + + Pop DI + +F_DrawScalableThumbBar2: + Mov BX, [SI+8] + Add BX, BX + Call [CS:DrawThumbValues+BX] ; DX returns pan value + + Xor AH, AH + Mov AL, [SI+2] + Mov CX, AX + ShL AX, 3 + Mov [CS:MouseEventData+0], AX + Mov CX, [SI+24] + Inc CX + ShL CX, 3 + Add AX, CX + Dec AX + Mov [CS:MouseEventData+4], AX + + Xor AH, AH + Mov AL, [SI+3] + ShL AX, 3 + Mov [CS:MouseEventData+2], AX + Add AX, 7 + Mov [CS:MouseEventData+6], AX + + Push CS + Pop DS + Assume DS:Functions + Mov SI, Offset MouseEventData + Mov Word Ptr [SI+8], 102h + Mov Word Ptr [SI+12], Offset MousePressThumbBar + Call MouseAddEvent + + Ret + +EndP F_DrawScalableThumbBar + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc HiLightPanning + + Mov AL, 80 + Mul Byte Ptr [SI+3] + Add AL, [SI+2] + AdC AH, 0 + Sub AX, 11 + Add AX, AX + Mov DI, AX + + Mov AL, 23h + Mov CX, 10 + Call S_HiLight + + Ret + +EndP HiLightPanning + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_PreThumbBar Far + + Call S_GetDestination + + Mov BX, [SI+8] + Mov DI, [SI+10] + Add BX, BX + Call [CS:GetThumbValues+BX] ; DX returns thumbbar value + + Mov AL, 80 + Mul Byte Ptr [SI+3] + Add AL, [SI+2] + AdC AH, 0 + Add AX, AX + Mov DI, AX ; ES:DI points to area... + + Cmp DX, [SI+6] + JG F_PreThumbBar2 + Cmp DX, [SI+4] + JL F_PreThumbBar2 + + Mov CX, [SI+6] + Sub CX, [SI+4] + Add CX, 15 + ShR CX, 3 + Mov BX, CX + Mov AX, 300h +; Xor AX, AX + + Push DI + Push DI + + Rep StosW + + Pop DI + Push BX + Push DI + Mov BX, DX ; DX = value to show. + Sub BX, [SI+4] + Inc BX + Mov AX, BX + ShR BX, 3 + Add BX, BX + Add DI, BX + And AX, 7 + Add AX, 155 + Mov AH, 3 + StosW + + Cmp AL, 157 + JBE F_PreThumbBar1 + Add AL, 5 + StosW + +F_PreThumbBar1: + Pop DI + Pop BX + LEA DI, [EDI+EBX*2+2] + Mov CH, 21h + Mov AX, DX + Call PE_ConvAX2Num + + Pop DI + +F_PreThumbBar2: + Mov BX, [SI+8] + Add BX, BX + Call [CS:DrawThumbValues+BX] ; DX returns pan value + +; Ret + + Call S_GetDestination + + Mov BX, [SI+8] + Mov DI, [SI+10] + Add BX, BX + Call [CS:PreThumbFuncs+BX] ; DX returns pan value + + Mov AL, 80 + Mul Byte Ptr [SI+3] + Add AL, [SI+2] + AdC AH, 0 + Add AX, AX + Mov DI, AX ; ES:DI points to area... + +F_PreThumbBar3: + Mov CX, [SI+6] + Sub CX, [SI+4] + Add CX, 15 + ShR CX, 3 + Mov AL, 3 + Call S_HiLight + Ret + +EndP F_PreThumbBar + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_PreScalableThumbBar Far + + Call S_GetDestination + + Mov BX, [SI+8] + Mov DI, [SI+10] + Add BX, BX + Call [CS:GetThumbValues+BX] ; DX returns thumbbar value + + Mov AL, 80 + Mul Byte Ptr [SI+3] + Add AL, [SI+2] + AdC AH, 0 + Add AX, AX + Mov DI, AX ; ES:DI points to area... + + Cmp DX, [SI+6] + JG F_PreScalableThumbBar2 + Cmp DX, [SI+4] + JL F_PreScalableThumbBar2 + + Push DI + Push DI + + Mov AX, 300h + Mov CX, [SI+24] ; Display length + Inc CX + Rep StosW + + ; Volume bar position = Value*Width / (MaxVal-MinVal) + + Pop DI + Push DI + + Push DX + + Mov AX, [SI+24] + ShL AX, 3 + Sub DX, [SI+4] + Mul DX + Mov CX, [SI+6] + Sub CX, [SI+4] + Div CX + + Inc AX + Mov BX, AX + ShR BX, 3 + Add BX, BX + Add DI, BX + And AX, 7 + Add AX, 155 + Mov AH, 2 + StosW + + Cmp AL, 157 + JBE F_PreScalableThumbBar1 + Add AL, 5 + StosW + +F_PreScalableThumbBar1: + Pop DX + + Pop DI + + Mov AX, [SI+24] + LEA DI, [EDI+EAX*2+4] + Mov CH, 21h + Mov AX, DX + Call PE_ConvAX2Num + + Pop DI + +F_PreScalableThumbBar2: + Mov BX, [SI+8] + Add BX, BX + Call [CS:DrawThumbValues+BX] ; DX returns pan value + +; Ret + + Call S_GetDestination + + Mov BX, [SI+8] + Mov DI, [SI+10] + Add BX, BX + Call [CS:PreThumbFuncs+BX] ; DX returns pan value + + Mov AL, 80 + Mul Byte Ptr [SI+3] + Add AL, [SI+2] + AdC AH, 0 + Add AX, AX + Mov DI, AX ; ES:DI points to area... + +F_PreScalableThumbBar3: + Mov CX, [SI+24] + Inc CX + Mov AL, 3 + Call S_HiLight + Ret + +EndP F_PreScalableThumbBar + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_PostScalableThumbBar Far + + Cmp CX, 8010h + JE F_PostScalableThumbBarMouse1 + + Jmp F_PostThumbBar + +F_PostScalableThumbBarMouse1: ; DX = pixel... + Mov SI, [BX] + + Xor AX, AX + Mov AL, [SI+2] ; Left point + ShL AX, 3 ; Left pixel + Add AX, 4 + + Sub DX, AX + JNC F_PostScalableThumbBarMouse2 + + Xor DX, DX + +F_PostScalableThumbBarMouse2: ; Value = (Pixel / NumPixels)*(Max-Min)+Min + Mov CX, [SI+24] ; Length + ShL CX, 3 ; AX = MaxPixel + Cmp DX, CX + JB F_PostScalableThumbBarMouse3 + + Mov DX, CX + +F_PostScalableThumbBarMouse3: + Mov AX, [SI+6] + Sub AX, [SI+4] + Mul DX + Div CX + + ShR CX, 1 + Cmp CX, DX + AdC AX, 0 + + Add AX, [SI+4] + + Mov BX, [SI+8] + Mov DI, [SI+10] + Add BX, BX + Call [CS:PostThumbFuncs+BX] + + Mov AX, 2 + Ret + +EndP F_PostScalableThumbBar + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_PostThumbBar Far + + Mov SI, [BX] + + Push ES + Push DI + + Call S_GetDestination + + Mov BX, [SI+8] + Mov DI, [SI+10] + Add BX, BX + Push BX + Push DX + Call [CS:GetThumbValues+BX] ; AX contains value. + Mov AX, DX + Pop DX + Pop BX + + Pop DI + Pop ES + + Push AX + Push BX + + Call [CS:PostThumbCheck+BX] + Test AX, AX + JNZ F_PostThumbBar23 + + Pop BX + Pop AX + + Cmp CX, 8010h + JE F_PostThumbBarMouse1 + + Cmp CX, 8001h + JE F_PostThumbBarMouseRedrawScreen + + Cmp CX, 1CBh + JE F_PostThumbBar2 + + Cmp CX, 1CDh + JE F_PostThumbBar4 + + Cmp CX, 1C7h + JE F_PostThumbBar10 + + Cmp CX, 1CFh + JE F_PostThumbBar11 + + Cmp CX, 1C8h + JE F_PostThumbBar5 + + Cmp CX, 1D0h + JE F_PostThumbBar6 + + Cmp CX, 10Fh + JE F_PostThumbBar7 + + Cmp CX, 1C9h + JE F_PostThumbBar21 + + Cmp CX, 1D1h + JE F_PostThumbBar22 + + Test CL, CL + JZ F_PostThumbBar20 + + Cmp DX, 0F00h + JE F_PostThumbBar8 + + Cmp DX, '0' + JB F_PostThumbBar50 + Cmp DX, '9' + JA F_PostThumbBar50 + + Jmp F_PostThumbBar30 + +F_PostThumbBar50: + Test CX, 600h + JNZ F_PostThumbBar17 + + Test CX, 1800h + JNZ F_PostThumbBar16 + +F_PostThumbBar20: + Xor AX, AX + Ret + +F_PostThumbBar23: + Pop BX + Pop AX + +F_PostThumbBarMouseRedrawScreen: + Mov AX, 1 + Ret + +F_PostThumbBar16: + Mov DI, CX + And DI, 1FFh + Cmp DI, 1CBh + JE F_PostThumbBar14 + + Cmp DI, 1CDh + JE F_PostThumbBar12 + + Jmp F_PostThumbBar20 + +F_PostThumbBar17: + Mov DI, CX + And DI, 1FFh + Cmp DI, 1CBh + JE F_PostThumbBar18 + + Cmp DI, 1CDh + JE F_PostThumbBar19 + + Jmp F_PostThumbBar20 + +F_PostThumbBar2: + Dec AX + Cmp AX, [SI+6] + JG F_PostThumbBar9 + Cmp Ax, [SI+4] + JL F_PostThumbBar9 + +F_PostThumbBar15: + Cmp AX, [SI+6] + JG F_PostThumbBarMin + Cmp AX, [SI+4] + JGE F_PostThumbBar3 + +F_PostThumbBarMin: + Mov AX, [SI+4] + +F_PostThumbBar3: + Mov DI, [SI+10] + Call [CS:PostThumbFuncs+BX] + +F_PostThumbBar9: + Mov AX, 1 + Ret + +F_PostThumbBar10: + Mov AX, [SI+4] + Jmp F_PostThumbBar3 + +F_PostThumbBar11: + Mov AX, [SI+6] + Jmp F_PostThumbBar3 + +F_PostThumbBar4: + Inc AX + Cmp AX, [SI+4] + JL F_PostThumbBar9 + + Cmp AX, [SI+6] + JG F_PostThumbBar9 + +F_PostThumbBar13: + Cmp AX, [SI+4] + JL F_PostThumbBarMax + Cmp AX, [SI+6] + JLE F_PostThumbBar3 + +F_PostThumbBarMax: + Mov AX, [SI+6] + Jmp F_PostThumbBar3 + +F_PostThumbBar12: + Add AX, 2 + Jmp F_PostThumbBar13 + +F_PostThumbBar14: + Sub AX, 2 + Jmp F_PostThumbBar15 + +F_PostThumbBar18: + Sub AX, 4 + Jmp F_PostThumbBar15 + +F_PostThumbBar19: + Add AX, 4 + Jmp F_PostThumbBar13 + +F_PostThumbBar22: + LodsW + +F_PostThumbBar21: + LodsW + +F_PostThumbBar8: + LodsW + +F_PostThumbBar7: + LodsW + +F_PostThumbBar6: + LodsW + +F_PostThumbBar5: + Add SI, 12 + LodsW + Cmp AX, 0FFFFh + JE F_PostThumbBar20 + + Mov [DI], AX + Jmp F_PostThumbBar9 + +F_PostThumbBarMouse1: ; DX = pixel... + Xor AX, AX + Mov AL, [SI+2] ; Left point + ShL AX, 3 ; Left pixel + Sub DX, AX + Sub DX, 4 + Mov AX, [SI+4] + Add AX, DX + + Cmp AX, [SI+4] + JG F_PostThumbBarMouse2 + + Mov AX, [SI+4] + Jmp F_PostThumbBarMouse3 + +F_PostThumbBarMouse2: + Cmp AX, [SI+6] + JL F_PostThumbBarMouse3 + + Mov AX, [SI+6] + +F_PostThumbBarMouse3: + Mov BX, [SI+8] + Mov DI, [SI+10] + Add BX, BX + Call [CS:PostThumbFuncs+BX] + + Mov AX, 2 + Ret + +F_PostThumbBar30: + Push DS + Push SI + + Call S_SaveScreen + + Mov DI, Offset ThumbStringEnter + Push CS + Pop ES + Mov AL, DL + StosB + + Xor AL, AL + Mov CX, 4 + Rep StosB + + Mov DI, Offset O1_ThumbStringList + Mov CX, 3 + Call M_Object1List + + Call S_RestoreScreen + + Pop SI + Pop DS + + And DX, DX + JZ F_PostThumbBar31 + + ; Now get value... + Xor CX, CX + Mov DI, Offset ThumbStringEnter + +F_PostThumbBar32: + Mov AL, [CS:DI] + And AL, AL + JZ F_PostThumbBar33 + + Inc DI + + Push AX + Mov AX, 10 + Mul CX + Mov CX, AX + Pop AX + + Cmp AL, '0' + JB F_PostThumbBar31 + Cmp AL, '9' + JA F_PostThumbBar31 + + Sub AL, '0' + Xor AH, AH + Add CX, AX + Jmp F_PostThumbBar32 + +F_PostThumbBar33: ; now save value. + Cmp DI, Offset ThumbStringEnter + JE F_PostThumbBar31 + + Mov AX, CX + + Cmp AX, [SI+4] + JL F_PostThumbBar31 + Cmp AX, [SI+6] + JG F_PostThumbBar31 + + Mov BX, [SI+8] + Mov DI, [SI+10] + Add BX, BX + Call [CS:PostThumbFuncs+BX] + +F_PostThumbBar31: + Mov AX, 1 + Ret + +EndP F_PostThumbBar + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_DrawInfoLine Far + + Push ES + LodsW + Push SI + Xor DX, DX + +F_DrawInfoLine1: + LodsB + Inc DX + And AL, AL + JNZ F_DrawInfoLine1 + + Dec DX + Pop SI ; DX contains length of string + Call S_GetDestination + + Mov DI, (1+11*80)*2 + Mov BX, 78 + Mov CX, BX + Cmp Byte Ptr [SI], 0 + JE F_DrawInfoLine3 + + Sub CX, DX + ShR CX, 1 + Sub BX, CX + Sub BX, DX + Sub BX, 2 + + Mov AX, 219Ah + Rep StosW + + Mov AX, 2020h + StosW + +F_DrawInfoLine2: + LodsB + StosW + Dec DX + JNZ F_DrawInfoLine2 + + Mov AX, 2020h + StosW + + Mov CX, BX + +F_DrawInfoLine3: + Mov AX, 219Ah + Rep StosW + + Pop ES + Ret + +EndP F_DrawInfoLine + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_ShowChannels Far + + Push DS + + Push CS + Pop DS + Assume DS:Functions + + Mov DI, (20+15*80)*2 + Mov CX, 32 + Mov AX, 3130h + Mov Word Ptr ChannelNumbers, AX + Mov AH, 20h + Call F_ShowChannel1 + + Mov DI, (54+15*80)*2 + Mov CX, 32 + Call F_ShowChannel1 + + Pop DS + Assume DS:Nothing + Ret + +EndP F_ShowChannels + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_ShowChannel1 + + Assume DS:Functions + +F_ShowChannel1_1: + Mov SI, Offset ChannelMsg + Call S_DrawString + + Inc Byte Ptr [ChannelNumbers+1] + Cmp Byte Ptr [ChannelNumbers+1], '9' + JBE F_ShowChannel1_2 + + Inc Byte Ptr [ChannelNumbers] + Mov Byte Ptr [ChannelNumbers+1], '0' + +F_ShowChannel1_2: + Add DI, 140 + Loop F_ShowChannel1_1 + + Assume DS:Nothing + + Ret + +EndP F_ShowChannel1 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_RedrawScreen Far + + Mov AX, 1 + Ret + +EndP F_RedrawScreen + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_Return0 Far ; ESC pressed on opening scrn + + Xor DX, DX + Mov AX, 4 + Ret + +EndP F_Return0 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_Return64 Far + + Mov DX, 64 + Mov AX, 4 + Ret + +EndP F_Return64 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_Return192 Far + + Mov DX, 192 + Mov AX, 4 + Ret + +EndP F_Return192 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PanningKeys + + Push AX + Mov AX, DX + Cmp AX, 'a' + JB PanningKeys1 + + Cmp AX, 'z' + JA PanningKeys3 + + Sub AX, 32 + +PanningKeys1: + Cmp AL, 'L' + JE PanningKeysLeft + Cmp AL, 'R' + JE PanningKeysRight + Cmp AL, 'M' + JE PanningKeysMiddle + Cmp AL, 'S' + JE PanningKeysSurround + Cmp AL, ' ' + JE PanningKeysSpace + +PanningKeys3: + Pop AX + Xor AX, AX + Ret + +PanningKeysLeft: + Xor AX, AX + Jmp PanningKeys2 + +PanningKeysRight: + Mov AX, 64 + Jmp PanningKeys2 + +PanningKeysMiddle: + Mov AX, 32 + Jmp PanningKeys2 + +PanningKeysSurround: + Mov AX, 100 + +PanningKeys2: + Mov DI, [SI+10] + Call SetPanning + Pop AX + + Mov AX, 1 + Ret + +PanningKeysSpace: + Pop AX + Xor AL, 128 + Push AX + + Mov BX, [ES:DI] + Cmp BX, 74 + JAE PanningKeys2 + + Inc Word Ptr [ES:DI] + + Jmp PanningKeys2 + +EndP PanningKeys + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc FilterKeys + + Push DI + Mov DI, [SI+10] + + Cmp DI, 3Ah + JB FilterKeys1 + Cmp DI, 3Bh + JA FilterKeys1 + + Cmp DX, ' ' + JNE FilterKeys1 + + Xor AL, 80h + Call SetInstVariables + + Mov AX, 1 + Jmp FilterKeysEnd + +FilterKeys1: + Xor AX, AX +FilterKeysEnd: + Pop DI + Ret + +EndP FilterKeys + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DrawPanning + + Push DS + Push SI + + Push CS + Pop DS + + Test DL, 128 + JZ DrawPanning2 + + Mov SI, Offset MutedMessage + Mov AH, 5 + Call S_DrawString + + Jmp DrawPanning1 + +DrawPanning2: + Cmp DX, 100 + JNE DrawPanning1 + + Mov SI, Offset SurroundMessage + Mov AH, 5 + Call S_DrawString + +DrawPanning1: + Pop SI + Pop DS + Ret + +EndP DrawPanning + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DrawMIDIChannel + + Mov AX, [SI+0Ah] + Cmp AX, 3Fh + JA DrawMIDIChannel2 + Cmp AX, 3Ah + JB DrawMIDIChannel2 + + Cmp AX, 3Ch + JNE DrawMIDIChannel4 + +DrawMIDIChannel1: + Cmp DL, 17 + JNE DrawMIDIChannel5 + + Add DI, 22 + Mov AX, 200h+'M' + StosW + Mov AL, 'a' + StosW + Mov AL, 'p' + StosW + StosW + Mov AL, 'e' + StosW + Mov AL, 'd' + StosW + +DrawMIDIChannel5: + Test DL, DL + JZ DrawMIDIChannel3 + Jmp DrawMIDIChannel2 + +DrawMIDIChannel4: + Test DX, DX + JNS DrawMIDIChannel2 + +DrawMIDIChannel3: + Mov AX, 200h+'O' + StosW + Mov AL, 'f' + StosW + StosW + Jmp DrawMIDIChannel2 + +DrawMIDIChannel2: + Ret + +EndP DrawMIDIChannel + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_Return1 Far + + Mov DX, 1 + Mov AX, 4 + Ret + +EndP F_Return1 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetSIOInstSegment + + Mov SI, Inst + Mov DS, SI + Mov SI, CX + + Ret + +EndP GetSIOInstSegment + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetSIODiskSegment + + Mov SI, Disk + Mov DS, SI + Mov SI, CX + + Ret + +EndP GetSIODiskSegment + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetLoadSampleString ; Returns DS:SI + + Call D_GetLoadSampleVars ; Gets SI = currentsample offset + ; DS = DiskDataArea + Add SI, CX + + Ret + +EndP GetLoadSampleString + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetMusicSegmentString + + Call Music_GetSongSegment + Mov DS, AX + + Mov SI, CX + + Ret + +EndP GetMusicSegmentString + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SetMusicSegmentString + +IF NETWORKENABLED + Mov CX, 26 + Mov DX, 4 + Call Network_SendSongDataInformation +ENDIF + Ret + +EndP SetMusicSegmentString + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetPatternSegmentString + + Push CS + Pop DS + + Mov SI, CX + + Ret + +EndP GetPatternSegmentString + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetSampleString + + Call I_GetSampleOffset + Mov SI, BX + Add SI, CX + + Ret + +EndP GetSampleString + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SetSampleString + + NetworkSendSample + + Ret + +EndP SetSampleString + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetInstrumentString + + Call I_GetInstrumentOffset + Mov SI, BX + Add SI, CX + + Ret + +EndP GetInstrumentString + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SetInstrumentString + + NetworkSendInstrument + Ret + +EndP SetInstrumentString + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +TopMIDIMacro DW 80h + +Proc GetMIDIString ; CX = select2 + + Push Music + Pop DS + Assume DS:Music + + Mov DS, MIDIDataArea + Assume DS:Nothing + + Mov SI, CX + Test CX, CX + JNS GetMIDIString1 + + Mov CX, CS:TopMIDIMacro + Sub SI, 8000h+80h*20h + ShL CX, 5 + Add SI, CX + +GetMIDIString1: + Ret + +EndP GetMIDIString + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MouseSelectString Far + + Mov CX, 8010h + Xor DX, DX + Call AddMouseQueue + + Xor AX, AX + + Ret + +EndP MouseSelectString + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +PostStringFunction DW 0 + +Proc F_GetStringInputOffset + + Mov BX, [SI+4] + Mov CX, [SI+6] + + Mov [CS:PostStringFunction], Offset F_NothingNear + + Cmp BX, 10h + JA F_GetStringInputOffset1 + + Add BX, BX + Push AX + + Mov AX, [CS:PostStringInput+BX] + Mov PostStringFunction, AX + + Pop AX + Call [CS:StringInputOffset+BX] ; DS:SI points to string + Ret + +F_GetStringInputOffset1: + Mov DS, BX + Mov SI, CX + Ret + +EndP F_GetStringInputOffset + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_DrawStringInput Far + + Mov [CS:MouseEventData+10], AX ; Store object number + + Push DS + Push SI + + Mov AL, 80 + Mul Byte Ptr [SI+3] + Add AL, [SI+2] + AdC AH, 0 + Add AX, AX + Mov DI, AX + Call S_GetDestination + + Call F_GetStringInputOffset + + Mov AH, 2h + +F_DrawStringInput1: + LodsB + Test AL, AL + JZ F_DrawStringInput2 + Cmp AL, 226 + JB F_DrawStringInput3 + + Mov AL, ' ' + +F_DrawStringInput3: + + StosW + Jmp F_DrawStringInput1 + +F_DrawStringInput2: + Pop SI + Pop DS + + Xor AH, AH + Mov AL, [SI+2] ; XValue + Mov CX, AX + ShL CX, 3 + Mov [CS:MouseEventData+0], CX + + Add AL, [SI+8] + Mov CX, AX + ShL CX, 3 + Dec CX + Mov [CS:MouseEventData+4], CX + + Mov AL, [SI+3] + ShL AX, 3 + Mov [CS:MouseEventData+2], AX + Add AX, 7 + Mov [CS:MouseEventData+6], AX + + Push CS + Pop DS + Assume DS:Functions + + Mov SI, Offset MouseEventData + Mov [MouseEventData+8], 102h + Mov [MouseEventData+12], Offset MouseSelectString + + Call MouseAddEvent + + Ret + +EndP F_DrawStringInput + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_PreStringInput Far + + Mov AL, 80 + Mul Byte Ptr [SI+3] + Add AL, [SI+2] + AdC AH, 0 + Add AX, AX + Mov DI, AX + Call S_GetDestination + + Call F_GetStringInputOffset + +F_PreStringInput1: + LodsB + And AL, AL + JZ F_PreStringInput2 + ScasW +; Add DI, 2 + Jmp F_PreStringInput1 + +F_PreStringInput2: + Inc DI + Mov AL, 30h + StosB + Ret + +EndP F_PreStringInput + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_PostStringInput Far + + Test CL, CL + JZ F_PostStringInput9 + + Mov SI, [BX] + + Cmp CX, 8010h + JE F_PostStringInput5 + + Cmp CX, 1C8h + JNE F_PostStringInput1 + + Mov AX, [SI+14] + Jmp F_PostStringInput4 + +F_PostStringInput1: + Cmp CX, 1D0h + JNE F_PostStringInput2 + + Mov AX, [SI+16] + Jmp F_PostStringInput4 + +F_PostStringInput2: + Cmp CX, 10Fh ; Tab + JNE F_PostStringInput3 + + Mov AX, [SI+18] + Jmp F_PostStringInput4 + +F_PostStringInput3: + Cmp DX, 0F00h + JNE F_PostStringInput6 + + Mov AX, [SI+20] + +F_PostStringInput4: + Cmp AX, 0FFFFh + JE F_PostStringInput12 + +; Mov Word Ptr CS:LastStringData, 0 +; Mov Word Ptr CS:LastStringData+2, 0 + + Mov [DI], AX + +F_PostStringInput5: + Mov AX, 1 + Ret + +F_PostStringInput6: + Cmp CX, 11Ch ; Enter + JNE F_PostStringInput7 + + Cmp Word Ptr [SI+10], 0 + JNE F_PostStringInput13 + + Cmp Word Ptr [SI+12], 0 + JE F_PostStringInput12 + +F_PostStringInput13: + Jmp DWord Ptr [SI+10] + +F_PostStringInput7: + Cmp CX, 10Eh ; Backspace + JNE F_PostStringInput8 + + Call F_GetStringInputOffset + + Cmp Byte Ptr [DS:SI], 0 + JE F_PostStringBackSpace2 + +F_PostStringBackSpace1: + LodsB + And AL, AL + JNZ F_PostStringBackSpace1 + + Mov [SI-2], AL + +F_PostStringBackSpace2: + Jmp F_PostStringInput11 + +F_PostStringInput8: + Cmp DX, 127 ; Ctrl-Backspace + JNE F_PostStringInput12 + + Mov DX, [SI+8] + Call F_GetStringInputOffset + + Mov CX, DX + Mov AX, DS + Mov ES, AX + Mov DI, SI + Xor AL, AL + Rep StosB + + Jmp F_PostStringInput11 + +F_PostStringInput12: + Test CL, CL + JZ F_PostStringInput9 + Cmp DL, 32 + JB F_PostStringInput9 + + Mov DI, [SI+8] + Call F_GetStringInputOffset + + Xor BX, BX + +F_PostStringInput10: + LodsB + Inc BX + And AL, AL + JNZ F_PostStringInput10 + + Dec SI + Cmp BX, DI + JAE F_PostStringInput11 + + Mov AL, DL + Xor AH, AH + Mov [DS:SI], AX + +F_PostStringInput11: + Call [CS:PostStringFunction] + + Mov AX, 1 + Ret + +F_PostStringInput9: + Xor AX, AX + Ret + +EndP F_PostStringInput + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_GotoEmptyList Far + + Mov AX, 5 + Mov SI, 1 + Mov DI, AX + Mov CX, Object1 + Mov DX, Offset O1_EmptyList + + Ret + +EndP F_GotoEmptyList + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetSampleToggle + + Push DS + + Call I_GetSampleOffset + Xor CL, CL + + Mov DH, [BX+DI] + Test DH, DL + JZ GetSampleToggle1 + + Inc CX + + Cmp DI, 2Fh + JE GetSampleToggle1 + + ShL DL, 1 + ShL DL, 1 + + Pop DS + Push DS + + Mov AL, 80 + Mul Byte Ptr [SI+3] + Add AL, [SI+2] + AdC AH, 0 + Add AX, AX + LEA DI, [EAX+6] ; DI points to screen part. + Push DS + Push SI + + Mov SI, Offset ForwardMsg + Test DH, DL + JZ GetSampleToggle2 + + Mov SI, Offset PingPongMsg + +GetSampleToggle2: + Push CS + Pop DS + Mov AH, 2 + Call S_DrawString + + Pop SI + Pop DS + +GetSampleToggle1: + Pop DS + Ret + +EndP GetSampleToggle + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetInstrumentToggle + + Push DS + + Call I_GetInstrumentOffset + Xor CL, CL + + Mov DH, [BX+DI] + Test DH, DL + JZ GetInstrumentToggle1 + + Inc CX + + Cmp DI, 1D4h + JNE GetInstrumentToggle1 + Cmp DL, 1 + JNE GetInstrumentToggle1 + + Push DS + Push SI + + Push CS + Pop DS + + Mov DI, (28*80+57)*2 + Mov AH, 2 + Mov SI, Offset PitchMessage + Test DH, DH + JNS GetInstrumentToggle3 + + Mov SI, Offset FilterMessage + +GetInstrumentToggle3: + Call S_DrawString + + Pop SI + Pop DS + +GetInstrumentToggle1: + Cmp DI, 19h + JNE GetInstrumentToggle2 + + Xor CL, 1 + +GetInstrumentToggle2: + Pop DS + Ret + +EndP GetInstrumentToggle + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetLoadSampleToggle + + Push DS + Push SI + Call D_GetLoadSampleVars ; Gets SI = currentsample offset + ; DS = DiskDataArea + + Mov BX, SI + Pop SI + + Xor CL, CL + + Mov DH, [BX+DI] + Test DH, DL + JZ GetLoadSampleToggle1 + + Inc CX + + ShL DL, 1 + ShL DL, 1 + + Pop DS + Push DS + + Mov AL, 80 + Mul Byte Ptr [SI+3] + Add AL, [SI+2] + AdC AH, 0 + Add AX, AX + LEA DI, [EAX+6] ; DI points to screen part + Push DS + Push SI + + Mov SI, Offset ForwardMsg + Test DH, DL + JZ GetLoadSampleToggle2 + + Mov SI, Offset PingPongMsg + +GetLoadSampleToggle2: + Push CS + Pop DS + Mov AH, 2 + Call S_DrawString + + Pop SI + Pop DS + +GetLoadSampleToggle1: + Pop DS + Ret + +EndP GetLoadSampleToggle + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetPatternSegmentToggle + + Push DS + + Mov AX, Pattern + Mov DS, AX + + Xor CL, CL + Test [DS:DI], DL + JZ GetPatternSegmentToggle1 + + Inc CX + +GetPatternSegmentToggle1: + Pop DS + Ret + +EndP GetPatternSegmentToggle + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetMusicSegmentToggle + + Push DS + + Call Music_GetSongSegment + Mov DS, AX + + Xor CL, CL + Test [DS:DI], DL + JZ GetMusicSegmentToggle1 + + Inc CX + +GetMusicSegmentToggle1: + Pop DS + Ret + +EndP GetMusicSegmentToggle + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SampleToggle + + Push DS + + Call I_GetSampleOffset + + Cmp DI, 2Fh + JNE SampleToggle6 + + Xor [BX+DI], DL + + Jmp SampleToggleEnd + +SampleToggle6: + Mov DH, DL + ShL DH, 1 + ShL DH, 1 + Test [BX+DI], DL + JZ SampleToggle3 + + Test [BX+DI], DH + JNZ SampleToggle3 + + Xor [BX+DI], DH + + Call Music_RegetLoopInformation + Jmp SampleToggleEnd + +SampleToggle3: + Xor [BX+DI], DL + Test [BX+DI], DL + JZ SampleToggle1 + ; Something was just toggled On. + Not DH + And [BX+DI], DH + + Cmp DL, 10h + JE SampleToggle2 + Cmp DL, 20h + JNE SampleToggle1 ; Safety Check. + ; Sustain Loop. + Mov EAX, [BX+40h] ; SusLBeg + Cmp EAX, [BX+30h] + JB SampleToggle4 + + Xor EAX, EAX + Mov [BX+40h], EAX + +SampleToggle4: + Cmp EAX, [BX+44h] + JB SampleToggle1 + + Mov EAX, [BX+30h] + Mov [BX+44h], EAX + Jmp SampleToggle1 + +SampleToggle2: ; Normal Loop + Mov EAX, [BX+34h] + Cmp EAX, [BX+30h] + JB SampleToggle5 + + Xor EAX, EAX + Mov [BX+34h], EAX + +SampleToggle5: + Cmp EAX, [BX+38h] + JB SampleToggle1 + + Mov EAX, [BX+30h] + Mov [BX+38h], EAX + +SampleToggle1: + Call Music_RegetLoopInformation + Call I_DrawWaveForm + +SampleToggleEnd: + NetworkSendSample + + Pop DS + Ret + +EndP SampleToggle + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc InstrumentToggle + + Push DS + + Call I_GetInstrumentOffset + +IF FILTERENVELOPES + Cmp DI, 1D4h + JNE InstrumentToggle2 + Cmp DL, 1 + JNE InstrumentToggle2 + + Xor Byte Ptr [BX+DI], 80h + JNS InstrumentToggle3 + + Test [BX+DI], DL + JZ InstrumentToggle2 + + And Byte Ptr [BX+DI], 7Fh + +InstrumentToggle2: +ELSE + And Byte Ptr [BX+1D4h], 7Fh +ENDIF + Xor [BX+DI], DL + +InstrumentToggle3: + Call I_MapEnvelope + + NetworkSendInstrument + + Pop DS + Ret + +EndP InstrumentToggle + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc LoadSampleToggle + + Push DS + Push SI + Call D_GetLoadSampleVars ; Gets SI = currentsample offset + ; DS = DiskDataArea + + Mov BX, SI + Pop SI + + Mov DH, DL + ShL DH, 1 + ShL DH, 1 + Test [BX+DI], DL + JZ LoadSampleToggle3 + + Test [BX+DI], DH + JNZ LoadSampleToggle3 + + Xor [BX+DI], DH + Pop DS + Ret + +LoadSampleToggle3: + Xor [BX+DI], DL + Test [BX+DI], DL + JZ LoadSampleToggle1 + ; Something was just toggled On. + Not DH + And [BX+DI], DH + + Cmp DL, 10h + JE LoadSampleToggle2 + Cmp DL, 20h + JNE LoadSampleToggle1 ; Safety Check. + ; Sustain Loop. + Mov EAX, [BX+40h] ; SusLBeg + Cmp EAX, [BX+30h] + JB LoadSampleToggle4 + + Xor EAX, EAX + Mov [BX+40h], EAX + +LoadSampleToggle4: + Cmp EAX, [BX+44h] + JB LoadSampleToggle1 + + Mov EAX, [BX+30h] + Mov [BX+44h], EAX + Jmp LoadSampleToggle1 + +LoadSampleToggle2: ; Normal Loop + Mov EAX, [BX+34h] + Cmp EAX, [BX+30h] + JB LoadSampleToggle5 + + Xor EAX, EAX + Mov [BX+34h], EAX + +LoadSampleToggle5: + Cmp EAX, [BX+38h] + JB LoadSampleToggle1 + + Mov EAX, [BX+30h] + Mov [BX+38h], EAX + +LoadSampleToggle1: + Call D_DrawWaveForm + + Pop DS + Ret + +EndP LoadSampleToggle + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PatternSegmentToggle + + Push DS + Mov AX, Pattern + Mov DS, AX + Assume DS:Pattern + + Xor [DS:DI], DL + + Cmp DI, Offset MultiChannelInfo + JB PatternSegmentToggle1 + Cmp DI, Offset MultiChannelInfo+64 + JAE PatternSegmentToggle1 + + Test CX, 8000h + JNZ PatternSegmentToggle1 + + Inc Word Ptr [ES:BP] + +PatternSegmentToggle1: + Pop DS + Ret + +EndP PatternSegmentToggle + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MusicSegmentToggle + + Push DS + Call Music_GetSongSegment + Mov DS, AX + + Xor [DS:DI], DL + +IF NETWORKENABLED + Mov CX, 1 + Mov DX, DI + Call Network_SendSongDataInformation +ENDIF + + Pop DS + Ret + +EndP MusicSegmentToggle + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MouseToggle Far + + Mov CX, 8010h + Mov DX, ' ' + Call AddMouseQueue + + Xor AX, AX + + Ret + +EndP MouseToggle + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_DrawToggle Far + + Mov [CS:MouseEventData+10], AX ; Store object number + + Call S_GetDestination + Mov BX, [SI+4] ; Segment no. + Mov DI, [SI+6] + Mov DL, [SI+8] + Add BX, BX + Call [CS:GetToggleStatus+BX] ; Returns CL with 0=off, 1=on + + Mov AL, 80 + Mul Byte Ptr [SI+3] + Add AL, [SI+2] + AdC AH, 0 + Add AX, AX + Mov DI, AX ; DI points to screen part. + + Mov AX, 200h+'O' + StosW + And CL, CL + JZ F_DrawToggle1 + + Mov AL, 'n' + StosW + Jmp F_DrawToggle2 + +F_DrawToggle1: + Mov AL, 'f' + StosW + StosW + +F_DrawToggle2: + Xor AH, AH + Mov AL, [SI+2] ; XValue + ShL AX, 3 + Mov [CS:MouseEventData+0], AX + Add AX, 23 + Mov [CS:MouseEventData+4], AX + + Xor AH, AH + Mov AL, [SI+3] + ShL AX, 3 + Mov [CS:MouseEventData+2], AX + Add AX, 7 + Mov [CS:MouseEventData+6], AX + + Push CS + Pop DS + Assume DS:Functions + + Mov SI, Offset MouseEventData + Mov [MouseEventData+8], 102h + Mov [MouseEventData+12], Offset MouseToggle + + Call MouseAddEvent + + Ret + +EndP F_DrawToggle + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_PreToggle Far + + Call S_GetDestination + Mov BX, [SI+4] ; Segment no. + Mov DI, [SI+6] + Mov DL, [SI+8] + Add BX, BX + Call [CS:GetToggleStatus+BX] ; Returns CL with 0=off, 1=on + + Xor CH, CH + Neg CL + Add CL, 3 ; CL = number to hilight + + Mov AL, 80 + Mul Byte Ptr [SI+3] + Add AL, [SI+2] + AdC AH, 0 + Add AX, AX + Mov DI, AX + + Mov AL, 30h + Call S_HiLight + + Ret + +EndP F_PreToggle + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_PostToggle Far + + Mov SI, [BX] + + Test CL, CL + JZ F_PostToggle7 + + Cmp DX, ' ' + JNE F_PostToggle1 + + Mov BP, DI + + Mov BX, [SI+4] ; Segment no. + Mov DI, [SI+6] + Mov DL, [SI+8] + Add BX, BX + Call [CS:ToggleBit+BX] + + Mov AX, 1 + Ret + +F_PostToggle1: + Cmp CX, 1C8h + JE F_PostToggle5 + Cmp CX, 1D0h + JE F_PostToggle4 + Cmp CX, 10Fh ; Tab + JE F_PostToggle3 + Cmp CX, 1CDh + JE F_PostToggle3 + Cmp DX, 0F00h + JE F_PostToggle2 + Cmp CX, 1CBh + JE F_PostToggle2 + +F_PostToggle7: + Xor AX, AX + Ret + +F_PostToggle2: + LodsW +F_PostToggle3: + LodsW +F_PostToggle4: + LodsW +F_PostToggle5: + Add SI, 9 + LodsW + Cmp AX, 0FFFFh + JE F_PostToggle7 + + Mov [DI], AX + +F_PostToggle6: + Mov AX, 1 + Ret + +EndP F_PostToggle + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetInstrument3Num + + Push DS + + Call I_GetInstrumentOffset + + Mov AL, [BX+DI] + Xor AH, AH + + Pop DS + Ret + +EndP GetInstrument3Num + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SetInstrument3Num ; AX = value. + + Push DS + Push SI + Push AX + + Mov AX, Inst + Mov DS, AX + Assume DS:Inst + + Mov CX, MaxNode + Dec CL + Assume DS:Nothing + + + Call I_GetInstrumentOffset + + Pop AX + Cmp AL, CL + JB SetInstrument3Num1 + + Mov AL, CL + +SetInstrument3Num1: + Mov [BX+DI], AL + + Mov SI, 132h + Call Near Ptr SetInstrument3Num2 + + Mov SI, 134h + Call Near Ptr SetInstrument3Num2 + + Mov SI, 184h + Call Near Ptr SetInstrument3Num2 + + Mov SI, 186h + Call Near Ptr SetInstrument3Num2 + + Mov SI, 1D6h + Call Near Ptr SetInstrument3Num2 + + Mov SI, 1D8h + Call Near Ptr SetInstrument3Num2 + + Call I_MapEnvelope + + Pop SI + Pop DS + + Ret + +SetInstrument3Num2: + Mov AL, [BX+SI] + Cmp AL, [BX+SI+1] + JBE SetInstrument3Num3 + + Mov [BX+SI+1], AL + +SetInstrument3Num3: + RetN + +EndP SetInstrument3Num + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetSample5Num + + Push DS + + Call I_GetSampleOffset + + Mov EAX, [BX+DI] + + Pop DS + Ret + +EndP GetSample5Num + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetLoadSample5Num + + Push DS + Push SI + Call D_GetLoadSampleVars ; Gets SI = currentsample offset + ; DS = DiskDataArea + + Mov BX, SI + Mov EAX, [BX+DI] + + Pop SI + Pop DS + + Ret + +EndP GetLoadSample5Num + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetInst5Num + + Push DS + Mov AX, Inst + + Mov DS, AX + Mov EAX, [DI] + + Pop DS + Ret + +EndP GetInst5Num + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SetSample5Num ; AX = value. + + Push DS + Push AX + + Call I_GetSampleOffset + + Pop AX + Mov [BX+DI], EAX + + Pop DS + + NetworkSendSample + + Ret + +EndP SetSample5Num + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SetLoadSample5Num ; AX = value. + + Push DS + Push SI + + Call D_GetLoadSampleVars ; Gets SI = currentsample offset + Mov BX, SI + + Mov [BX+DI], EAX + + Pop SI + Pop DS + Ret + +EndP SetLoadSample5Num + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SetInst5Num + + Push DS + + Mov BX, Inst + Mov DS, BX + Mov [DI], EAX + + Pop DS + + Ret + +EndP SetInst5Num + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MouseNumberDecrement Far + + Mov CX, 8010h + Mov DX, '-' + Call AddMouseQueue + + Xor AX, AX + + Ret + +EndP MouseNumberDecrement + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MouseNumberIncrement Far + + Mov CX, 8010h + Mov DX, '+' + Call AddMouseQueue + + Xor AX, AX + + Ret + +EndP MouseNumberIncrement + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_Draw3Num Far + + Mov [CS:MouseEventData+10], AX ; Store object number + + Mov BX, [SI+4] + Add BX, BX + Mov DI, [SI+6] + + Call [CS:Get3NumValues+BX] ; AX = value. + + Push AX + + Mov AL, 80 + Mul Byte Ptr [SI+3] + Add AL, [SI+2] + AdC AH, 0 + Add AX, AX + Mov DI, AX + Call S_GetDestination + + Pop AX + Xor DX, DX + Mov CH, 2 + Call PE_ConvAX2Num + + Xor AX, AX + Mov AL, [SI+2] ; X value + ShL AX, 3 + Mov [CS:MouseEventData+0], AX + Add AX, 3*8-1 + Mov [CS:MouseEventData+4], AX + Xor AX, AX + Mov AL, [SI+3] + ShL AX, 3 + Mov [CS:MouseEventData+2], AX + Add AX, 7 + Mov [CS:MouseEventData+6], AX + + Push CS + Pop DS + + Mov SI, Offset MouseEventData + Mov Word Ptr [SI+8], 102h + Mov Word Ptr [SI+12], Offset MouseNumberDecrement + Call MouseAddEvent + Mov Word Ptr [SI+8], 110h + Mov Word Ptr [SI+12], Offset MouseNumberIncrement + Call MouseAddEvent + + Ret + +EndP F_Draw3Num + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_Pre3Num Far + + Mov AL, 80 + Mul Byte Ptr [SI+3] + Add AL, [SI+2] + AdC AH, 0 + Mov DI, AX + Add DI, CS:TripleNumberPos + Add DI, DI + + Mov CX, 1 + Mov AL, 30h + Call S_HiLight + + Ret + +EndP F_Pre3Num + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_Post3Num Far + + Mov SI, [BX] + Test CL, CL + JZ F_Post3Num7 + + Cmp DX, 8 + JE F_Post3Num16 + Cmp CX, 1CBh ; Left + JNE F_Post3Num1 + +F_Post3Num16: + Mov AX, CS:TripleNumberPos + Dec AX + JS F_Post3Num2 + +F_Post3Num5: + Mov CS:TripleNumberPos, AX + +F_Post3Num2: + Mov AX, 1 + Ret + +F_Post3Num1: + Cmp CX, 1CDh ; Right + JNE F_Post3Num3 + +F_Post3Num4: + Mov AX, CS:TripleNumberPos + Inc AX + Cmp AX, 2 + JA F_Post3Num2 + Jmp F_Post3Num5 + +F_Post3Num3: + Cmp CX, 1C8h ; Up + JE F_Post3Num14 + Cmp CX, 1D0h ; Down + JE F_Post3Num13 + Cmp CX, 10Fh + JE F_Post3Num12 + Cmp DX, 0F00h + JNE F_Post3Num6 + + LodsW +F_Post3Num12: + LodsW +F_Post3Num13: + LodsW +F_Post3Num14: + Add SI, 12 + LodsW + Cmp AX, 0FFFFh + JE F_Post3Num7 + + Mov [DI], AX + +F_Post3Num15: + Mov AX, 1 + Ret + +F_Post3Num18: + Mov BX, [SI+4] + Add BX, BX + Mov DI, [SI+6] + + Push BX + Call [CS:Get3NumValues+BX] ; AX = value. + Pop BX + Add AX, 1 + JC F_Post3Num15 + Call [CS:Set3NumValues+BX] ; AX = value. + Call Near Ptr F_Post3Num20 + Jmp F_Post3Num15 + +F_Post3Num19: + Mov BX, [SI+4] + Add BX, BX + Mov DI, [SI+6] + + Push BX + Call [CS:Get3NumValues+BX] ; AX = value. + Pop BX + Sub AX, 1 + JC F_Post3Num15 + Call [CS:Set3NumValues+BX] ; AX = value. + Call Near Ptr F_Post3Num20 + Jmp F_Post3Num15 + +F_Post3Num6: + Cmp DX, '+' + JE F_Post3Num18 + Cmp DX, '-' + JE F_Post3Num19 + + Cmp DX, '0' + JL F_Post3Num7 + Cmp DX, '9' + JLE F_Post3Num8 + +F_Post3Num7: + Xor AX, AX + Ret + +F_Post3Num8: ; OK... a number was inputted. + Push DX + + Mov BX, [SI+4] + Add BX, BX + Mov DI, [SI+6] + + Call [CS:Get3NumValues+BX] ; AX = value. + + Mov CX, 3 + Mov BX, 10 + Mov DI, Offset NumberStorage+6 + +F_Post3Num9: + Xor DX, DX + Div BX + Sub DI, 2 + Mov [CS:DI], DX + Loop F_Post3Num9 + + Mov BX, CS:TripleNumberPos + Add BX, BX + + Pop DX + Sub DX, '0' + Mov [CS:DI+BX], DX + + Xor AX, AX + Mov BX, 10 + Mov CX, 3 + Xor DX, DX + +F_Post3Num10: + Mul BX + Add AX, [CS:DI] + AdC DX, 0 + ScasW +; Add DI, 2 + Loop F_Post3Num10 + + And DX, DX + JZ F_Post3Num11 + + Mov AX, 0FFFFh + +F_Post3Num11: + Mov BX, [SI+4] + Add BX, BX + Mov DI, [SI+6] + + Call [CS:Set3NumValues+BX] ; AX = value. + Call Near Ptr F_Post3Num20 + Jmp F_Post3Num4 + +F_Post3Num20: + Cmp Word Ptr [SI+8], 0 + JNZ F_Post3Num17 + + Cmp Word Ptr [SI+10], 0 + JZ F_Post3Num21 + +F_Post3Num17: + Call DWord Ptr [SI+8] + +F_Post3Num21: + RetN + + +EndP F_Post3Num + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_ConvEAX2Num Far + + Push EAX ; CH = colour + Push EBX ; DX:AX = number + Push CX + Push EDX + + Mov EBX, 10 + Mov CL, 7 + +F_ConvEAX2Num1: + Xor EDX, EDX + Div EBX + Push DX + Dec CL + JNZ F_ConvEAX2Num1 + + Mov CL, 7 + +F_ConvEAX2Num2: + Pop AX + Add AL, '0' + Mov AH, CH + StosW + + Dec CL + JNZ F_ConvEAX2Num2 + + Pop EDX + Pop CX + Pop EBX + Pop EAX + + Ret + +EndP F_ConvEAX2Num + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_Draw5Num Far + + Mov [CS:MouseEventData+10], AX + + Mov BX, [SI+4] + Add BX, BX + Mov DI, [SI+6] + + Call [CS:Get5NumValues+BX] ; AX = value. + + Push AX + + Mov AL, 80 + Mul Byte Ptr [SI+3] + Add AL, [SI+2] + AdC AH, 0 + Add AX, AX + Mov DI, AX + Call S_GetDestination + + Pop AX + Xor DX, DX + Mov CH, 2 + Call F_ConvEAX2Num + + Xor AX, AX + Mov AL, [SI+2] ; X value + ShL AX, 3 + Mov [CS:MouseEventData+0], AX + Add AX, 7*8-1 + Mov [CS:MouseEventData+4], AX + Xor AX, AX + Mov AL, [SI+3] + ShL AX, 3 + Mov [CS:MouseEventData+2], AX + Add AX, 7 + Mov [CS:MouseEventData+6], AX + + Push CS + Pop DS + + Mov SI, Offset MouseEventData + Mov Word Ptr [SI+8], 102h + Mov Word Ptr [SI+12], Offset MouseNumberDecrement + Call MouseAddEvent + Mov Word Ptr [SI+8], 110h + Mov Word Ptr [SI+12], Offset MouseNumberIncrement + Call MouseAddEvent + + Ret + +EndP F_Draw5Num + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_Pre5Num Far + + Mov AL, 80 + Mul Byte Ptr [SI+3] + Add AL, [SI+2] + AdC AH, 0 + Mov DI, AX + Add DI, CS:NumberPos + Add DI, DI + + Mov CX, 1 + Mov AL, 30h + Call S_HiLight + + Ret + +EndP F_Pre5Num + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_Post5Num Far + + Mov SI, [BX] + Test CL, CL + JZ F_Post5Num7 + + Cmp DX, 8 + JE F_Post5Num16 + Cmp CX, 1CBh ; Left + JNE F_Post5Num1 + +F_Post5Num16: + Mov AX, CS:NumberPos + Dec AX + JS F_Post5Num2 + +F_Post5Num5: + Mov CS:NumberPos, AX + +F_Post5Num2: + Mov AX, 1 + Ret + +F_Post5Num1: + Cmp CX, 1CDh ; Right + JNE F_Post5Num3 + +F_Post5Num4: + Mov AX, CS:NumberPos + Inc AX + Cmp AX, 6 + JA F_Post5Num2 + Jmp F_Post5Num5 + +F_Post5Num3: + Cmp CX, 1C8h ; Up + JE F_Post5Num14 + Cmp CX, 1D0h ; Down + JE F_Post5Num13 + Cmp CX, 10Fh + JE F_Post5Num12 + Cmp DX, 0F00h + JNE F_Post5Num6 + + LodsW +F_Post5Num12: + LodsW +F_Post5Num13: + LodsW +F_Post5Num14: + Add SI, 12 + LodsW + Cmp AX, 0FFFFh + JE F_Post5Num7 + + Mov [DI], AX + +F_Post5Num15: + Mov AX, 1 + Ret + +F_Post5Num18: + Mov BX, [SI+4] + Add BX, BX + Mov DI, [SI+6] + + Push BX + Call [CS:Get5NumValues+BX] ; AX = value. + Pop BX + Inc EAX + Call [CS:Set5NumValues+BX] ; AX = value. + Call Near Ptr F_Post5Num20 + Jmp F_Post5Num15 + +F_Post5Num19: + Mov BX, [SI+4] + Add BX, BX + Mov DI, [SI+6] + + Push BX + Call [CS:Get5NumValues+BX] ; AX = value. + Pop BX + Sub EAX, 1 + JC F_Post5Num15 + Call [CS:Set5NumValues+BX] ; AX = value. + Call Near Ptr F_Post5Num20 + Jmp F_Post5Num15 + +F_Post5Num6: + Cmp DX, '+' + JE F_Post5Num18 + Cmp DX, '-' + JE F_Post5Num19 + + Cmp DX, '0' + JL F_Post5Num7 + Cmp DX, '9' + JLE F_Post5Num8 + +F_Post5Num7: + Xor AX, AX + Ret + +F_Post5Num8: ; OK... a number was inputted. + Push DX + + Mov BX, [SI+4] + Add BX, BX + Mov DI, [SI+6] + + Call [CS:Get5NumValues+BX] ; EAX = value. + + Mov CX, 7 + Mov EBX, 10 + Mov DI, Offset NumberStorage+14 + +F_Post5Num9: + Xor EDX, EDX + Div EBX + Sub DI, 2 + Mov [CS:DI], DX + Loop F_Post5Num9 + + Mov BX, CS:NumberPos + Add BX, BX + + Pop DX + Sub DX, '0' + Mov [CS:DI+BX], DX + + Xor EAX, EAX + Mov BX, 10 + Mov CX, 7 + +F_Post5Num10: + IMul EAX, 10 + MovZX EBX, Word Ptr [CS:DI] + Add EAX, EBX + +; Add DI, 2 + ScasW + Loop F_Post5Num10 + +F_Post5Num11: + Mov BX, [SI+4] + Add BX, BX + Mov DI, [SI+6] + + Call [CS:Set5NumValues+BX] ; AX = value. + Call Near Ptr F_Post5Num20 + Jmp F_Post5Num4 + +F_Post5Num20: + Cmp Word Ptr [SI+8], 0 + JNZ F_Post5Num17 + + Cmp Word Ptr [SI+10], 0 + JZ F_Post5Num21 + +F_Post5Num17: + Call DWord Ptr [SI+8] + +F_Post5Num21: + RetN + +EndP F_Post5Num + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_DrawHeader Far + +; Call MouseClearEvents + + Call Music_GetSongSegment + Mov DS, AX + Mov DL, [DS:2Ch] + + Push CS + Pop DS + + Call E_GetFreeEMS + Push AX + + Mov AH, 48h + Mov BX, 0FFFFh + Int 21h + ShR BX, 6 + Push BX + + Mov AH, 20h + Mov SI, Offset HeaderMsg1 + Mov DI, ((1*80)+2)*2 + Call S_DrawString + + Mov SI, Offset HeaderMsg2 + Call Glbl_GetHeaderMode + And AH, AH + JNZ F_DrawHeader1 + + Mov SI, Offset HeaderMsg3 + +F_DrawHeader1: + Mov AH, 20h + Call S_DrawString + + Mov SI, Offset HeaderMsg4 + Mov DI, ((4*80)+2)*2 + Call S_DrawString + + Add SP, 4 + + Call Music_GetFreeSoundCardMemory + ; Returns DS:SI, Carry set if nothing to show + JC F_DrawHeader2 ; and AX = value to print. + + Push BX + Push AX + + Mov AH, 20h + Mov DI, (63+8*80)*2 + Call S_DrawString + + Pop AX + Pop BX + +F_DrawHeader2: + Ret + +EndP F_DrawHeader + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_DrawSMCChannels Far + +; Call MouseClearEvents + + Push CS + Pop DS + + Xor CX, CX + +F_DrawSMCChannels1: + Mov AL, CL + Inc AX + Xor AH, AH + Mov BH, 10 + Div BH + Add AX, 3030h + Mov Word Ptr ChannelNumbers, AX + + Mov BX, CX + And BX, 0Fh + Mov AX, 160 ; Calculate DI (offset on screen) + Mul BX + Mov DI, AX + Add DI, (22*80+9)*2 + Mov BX, CX + And BX, 00F0h + ShL BX, 1 + Add DI, BX + + Mov SI, Offset ChannelMsg + Mov AH, 20h + Call S_DrawString + + Inc CX + Cmp CX, 64 + JB F_DrawSMCChannels1 + + Ret + +EndP F_DrawSMCChannels + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_ConfigButtonSetup Far + + Call Music_GetSongSegment + Mov DS, AX ; OK... now check for + ; control mode first. + Mov CL, [DS:2Ch] ; CL = Flags. + Add DI, 50 ; ES:DI points to inst button + + Mov BX, [ES:DI] ; ES:BX points to inst button data +; Add DI, 2 + ScasW + Xor CH, CH + Test CL, 4 + JZ F_ConfigButtonSetup1 + + Inc CH + +F_ConfigButtonSetup1: + Mov [ES:BX+33], CH ; Instrument button + + Xor CH, 1 + Mov BX, [ES:DI] +; Add DI, 2 + ScasW + Mov [ES:BX+33], CH ; Sample button + + Mov BX, [ES:DI] +; Add DI, 2 + ScasW + Xor CH, CH + Test CL, 1 + JZ F_ConfigButtonSetup2 + + Inc CH + +F_ConfigButtonSetup2: + Mov [ES:BX+33], CH ; Stereo button + + Xor CH, 1 + Mov BX, [ES:DI] +; Add DI, 2 + ScasW + Mov [ES:BX+33], CH ; Mono button + + Mov BX, [ES:DI] +; Add DI, 2 + ScasW + Xor CH, CH + Test CL, 8 ; Slides... + JZ F_ConfigButtonSetup3 + + Inc CH + +F_ConfigButtonSetup3: + Mov [ES:BX+33], CH + + Xor CH, 1 + Mov BX, [ES:DI] +; Add DI, 2 ; Compression reasons + ScasW + Mov [ES:BX+33], CH + + Ret + +EndP F_ConfigButtonSetup + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +IF NETWORKENABLED +Proc F_SendSongFlags + + Push CX + Push DX + + Mov CX, 1 + Mov DX, 2Ch + Call Network_SendSongDataInformation + + Pop DX + Pop CX + + Ret + +EndP F_SendSongFlags + +SendSongFlags EQU Call F_SendSongFlags + +ELSE + +SendSongFlags EQU ; + +ENDIF + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_SetControlSample Far + + Call Music_GetSongSegment + Mov DS, AX + + And Byte Ptr [DS:2Ch], NOT 4 + + SendSongFlags + + Ret + +EndP F_SetControlSample + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_SetControlInstrument Far + + Call Music_GetSongSegment + Mov DS, AX + + Or Byte Ptr [DS:2Ch], 4 + + Push DS + + Mov DI, Offset O1_InitialiseInstrumentList + Mov CX, 3 + Call M_Object1List + ; DX = 0 -> don't initialise + ; DX = 1 -> initialise + Pop DS ; DS = SongDataSegment + + SendSongFlags + + Test DX, DX + JZ F_SetControlInstrument3 + + Call Music_ClearAllInstruments + + ; OK.. for samples 1..99 + ; check if sample exists. + ; if so, copy name&set all + ; notes of instrument. + Push DS + Pop ES ; ES = SongDataSegment + + Xor DX, DX + +F_SetControlInstrument1: + Mov BX, DX + Add BX, BX + Mov SI, [DS:BX+64912] ; SI points to sample + Mov DI, [DS:BX+64712] ; DI points to instrument + + Test Byte Ptr [DS:SI+12h], 1 + JZ F_SetControlInstrument2 + ; No sample there! + + ; Copy name + Mov CX, 26 + Add SI, 14h + Add DI, 20h + Rep MovsB + Add DI, 7 + + Mov AL, DL ; DL = sample number + Inc AX + Mov CX, 120 + +F_SetControlInstrument4: + StosB + Inc DI + Loop F_SetControlInstrument4 + +F_SetControlInstrument2: +IF NETWORKENABLED + Call Network_GetSendQueue + JZ F_SetControlInstrument5 + + Mov AX, 400h + StosW + Mov AX, DX + StosB + +F_SetControlInstrument5: + Call Network_FinishedSendQueue +ENDIF + Inc DX + Cmp DX, 99 + JBE F_SetControlInstrument1 + +F_SetControlInstrument3: + + Ret + +EndP F_SetControlInstrument + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_SetStereo Far + + Call Music_GetSongSegment + Mov DS, AX + + Or Byte Ptr [DS:2Ch], 1 + + Call Music_InitStereo + + SendSongFlags + + Ret + +EndP F_SetStereo + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_SetMono Far + + Call Music_GetSongSegment + Mov DS, AX + + And Byte Ptr [DS:2Ch], NOT 1 + + Call Music_InitStereo + + SendSongFlags + + Ret + +EndP F_SetMono + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_SetLinear Far + + Call Music_GetSongSegment + Mov DS, AX + + Or Byte Ptr [DS:2Ch], 8 + + SendSongFlags + + Ret + +EndP F_SetLinear + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_SetAmiga Far + + Call Music_GetSongSegment + Mov DS, AX + + And Byte Ptr [DS:2Ch], NOT 8 + + SendSongFlags + + Ret + +EndP F_SetAmiga + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_Reset5NumInputPos Far + + Mov CS:NumberPos, 0 + Ret + +EndP F_Reset5NumInputPos + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_NewSong Far + + EnsureNoNetwork + + Mov DI, Offset O1_NewSongList + Mov CX, 11 ; OK Button.. + Call M_Object1List + And DX, DX + JZ F_NewSongEnd + + Call Music_Stop + + Cmp Word Ptr [CS:ButtonVariables+8], 0 + JE F_NewSong2 + + Call Music_ReleaseAllSamples + Call Music_ClearAllSampleNames + +F_NewSong2: + Cmp Word Ptr [CS:ButtonVariables+10], 0 + JE F_NewSong3 + + Call Music_ClearAllInstruments + +F_NewSong3: + Cmp Word Ptr [CS:ButtonVariables+12], 0 + JE F_NewSong1 + + Call D_ClearFileName + Call D_ResetTimer + + Call Music_GetSongSegment + Mov ES, AX + + Mov DI, 4 ; Clear song name + Mov CX, 13 + Xor AX, AX + Rep StosW + + Mov DI, 3Ch ; Clear Time + Xor AX, AX + StosW + StosW + + Mov CX, 64 + Mov AL, 32 + Rep StosB + + Mov CX, 64 ; Channel volume + Mov AL, 64 + Rep StosB + + Mov DI, 100h ; Orders. + Mov AL, 0FFh + Mov CX, 256 + Rep StosB + + Call Music_InitMuteTable + Call Msg_ResetMessage + +F_NewSong1: + Cmp Word Ptr [CS:ButtonVariables+6], 0 + JE F_NewSongEnd + ; Clear patterns. + Call D_ClearFileName + Call D_ResetTimer + Call Music_ReleaseAllPatterns + Call PE_ResetOrderPattern + +F_NewSongEnd: + Mov AX, 1 + Ret + +EndP F_NewSong + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_MainMenu Far + + Call S_SaveScreen + + Mov CX, 0FFFFh + Mov DI, Offset O1_MainMenu + Call M_Object1List + + Call S_RestoreScreen + + Mov AX, 1 + Ret + +EndP F_MainMenu + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_ViewPattern Far + + Call MouseRestoreEvents + Add SP, 20 + Jmp Glbl_F2_2 + +EndP F_ViewPattern + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_ViewVariables Far + + Call MouseRestoreEvents + Add SP, 20 + Jmp Glbl_F12 + +EndP F_ViewVariables + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_ViewOrderPan Far + + Call MouseRestoreEvents + Add SP, 20 + Jmp Glbl_F11_2 + +EndP F_ViewOrderPan + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_MessageEditor Far + + Call MouseRestoreEvents + Add SP, 20 + Jmp Glbl_Shift_F9 + +EndP F_MessageEditor + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_Help Far + + Call S_RestoreScreen + Call MouseRestoreEvents + Add SP, 20 + Jmp H_Help + +EndP F_Help + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_PlaybackMenu Far + + Mov CX, 0FFFFh + Mov DI, Offset O1_PlaybackMenu + Call M_Object1List + + Call S_RestoreScreen + Mov AX, 1 + Ret + +EndP F_PlaybackMenu + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_InfoPage Far + + Call MouseRestoreEvents + Call MouseRestoreEvents + + Add SP, 48 + Jmp Glbl_F5 + +EndP F_InfoPage + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_PlaySong Far + + Call MouseRestoreEvents + Call MouseRestoreEvents + Add SP, 48 + Jmp Glbl_Ctrl_F5 + +EndP F_PlaySong + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_PlayPattern Far + + Call MouseRestoreEvents + Call MouseRestoreEvents + Add SP, 48 + Jmp Glbl_F6 + +EndP F_PlayPattern + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_PlayOrder Far + + Call MouseRestoreEvents + Call MouseRestoreEvents + Add SP, 48 + Jmp Glbl_Shift_F6 + +EndP F_PlayOrder + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_PlayMark Far + + Call MouseRestoreEvents + Call MouseRestoreEvents + Add SP, 48 + Jmp PE_F7 + +EndP F_PlayMark + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_Stop Far + + Call MouseRestoreEvents + Call MouseRestoreEvents + Add SP, 48 + Jmp Music_Stop + +EndP F_Stop + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_ReinitSoundCard Far + + Call MouseRestoreEvents + Call MouseRestoreEvents + Add SP, 48 + Jmp Music_ReinitSoundCard + +EndP F_ReinitSoundCard + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_CalculateLength Far + + Call S_RestoreScreen + Call MouseRestoreEvents + Call MouseRestoreEvents + Add SP, 48 + Jmp Music_TimeSong + +EndP F_CalculateLEngth + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_DriverScreen Far + + Call MouseRestoreEvents + Call MouseRestoreEvents + Add SP, 48 + Jmp Glbl_DriverScreen + +EndP F_DriverScreen + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_SampleMenu Far + + Mov CX, 0FFFFh + Mov DI, Offset O1_SampleMenu + Call M_Object1List + + Call S_RestoreScreen + Mov AX, 1 + Ret + +EndP F_SampleMenu + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_InstrumentMenu Far + + Mov CX, 0FFFFh + Mov DI, Offset O1_InstrumentMenu + Call M_Object1List + + Call S_RestoreScreen + Mov AX, 1 + Ret + +EndP F_InstrumentMenu + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_SampleList Far + + Call MouseRestoreEvents + Call MouseRestoreEvents + Add SP, 48 + Jmp Glbl_F3 + +EndP F_SampleList + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_InstrumentList Far + + Call MouseRestoreEvents + Call MouseRestoreEvents + Add SP, 48 + Jmp Glbl_F4 + +EndP F_InstrumentList + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_InstrumentLibrary Far + + Call MouseRestoreEvents + Call MouseRestoreEvents + Add SP, 48 + Jmp Glbl_Ctrl_F4 + +EndP F_InstrumentLibrary + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_ReloadGravis Far + + Call MouseRestoreEvents + Call MouseRestoreEvents + Add SP, 48 + Jmp Music_SoundCardLoadAllSamples + +EndP F_ReloadGravis + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_SampleLibrary Far + + Call MouseRestoreEvents + Call MouseRestoreEvents + Add SP, 48 + Jmp Glbl_Ctrl_F3 + +EndP F_SampleLibrary + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_FileMenu Far + + Mov CX, 0FFFFh + Mov DI, Offset O1_FileMenu + Call M_Object1List + + Call S_RestoreScreen + Mov AX, 1 + Ret + +EndP F_FileMenu + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_FileLoad Far + + Call MouseRestoreEvents + Call MouseRestoreEvents + Add SP, 48 + Jmp Glbl_F9 + +EndP F_FileLoad + + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_FileNew Far + + Call MouseRestoreEvents + Call MouseRestoreEvents + Call S_RestoreScreen + Add SP, 48 + Jmp F_NewSong + +EndP F_FileNew + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_FileSaveCurrent Far + + Call MouseRestoreEvents + Call MouseRestoreEvents + Call S_RestoreScreen + Add SP, 48 + Jmp D_SaveSong + +EndP F_FileSaveCurrent + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_FileSaveAs Far + + Call MouseRestoreEvents + Call MouseRestoreEvents + Add SP, 48 + Jmp Glbl_F10 + +EndP F_FileSaveAs + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_FileDOSShell Far + + Call MouseRestoreEvents + Call MouseRestoreEvents + Call S_RestoreScreen + Add SP, 48 + Jmp DOSShell + +EndP F_FileDOSShell + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_FileQuit Far + + Call MouseRestoreEvents + Call MouseRestoreEvents + Call S_RestoreScreen + Add SP, 48 + Jmp Quit + +EndP F_FileQuit + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +IF MEMORYDEBUG + +DebugOffset DW 0 +DebugSegment DW 0 + +AddressInput DB 0 + DB 19 Dup (0) +SegmentMsg DB "Segment: ", 0FDh, 'Xh', 0 + +DebugSegmentNames DB 10, "STARTUP", 0 + DW Startup + + DB 11, "KEYBOARD", 0 + DW Keyboard + + DB 10, "PATTERN", 0 + DW Pattern + + DB 7, "DISK", 0 + DW Disk + + DB 6, "EMS", 0 + DW EMS + + DB 8, "ERROR", 0 + DW Error + + DB 7, "INST", 0 + DW Inst + + DB 12, "FUNCTIONS", 0 + DW Functions + + DB 9, "GLOBAL", 0 + DW Glbl + + DB 7, "HELP", 0 + DW Help + + DB 11, "INFOLINE", 0 + DW InfoLine + + DB 7, "MAIN", 0 + DW Main + + DB 8, "MUSIC", 0 + DW Music + + DB 9, "SCREEN", 0 + DW Screen + + DB 10, "OBJECT1", 0 + DW Object1 + + DB 11, "INFOPAGE", 0 + DW InfoPage + + DB 11, "SONGDATA", 0 +DebugSongDataSegment DW 0 + + DB 11, "DISKDATA", 0 +DebugDiskDataSegment DW 0 + + DB 14, "PATTERNDATA", 0 +DebugPatternDataSegment DW 0 + + DB 0FFh ; End of list. + +DebugMsg DB "CX: ", 0FDh, "X, DX: ", 0FDh, "X ", 0 +DebugCX DW 0 +DebugDX DW 0 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_DrawDebug Far + + Push CS + Pop DS + Assume DS:Functions + + Call S_GetDestination + Mov SI, Offset SegmentMsg + Mov DI, (4+13*80)*2 + + Push DebugSegment +; Mov AX, DebugSegment +; Push AX + Mov AH, 21h + Call S_DrawString ; OK segment done + Pop AX ; Clear stack. + + ; Put offsets on screen. + ; Work out digits. + Mov CX, 1E04h + Mov DI, (3+15*80)*2 + Mov DX, DebugOffset + Xor BH, BH + Mov AH, 2 + +F_DrawDebug1: + Push DI + + Mov BL, DH + ShR BL, CL + Mov AL, [HexNumbers+BX] ; Blah.. how inefficient + StosW + Mov BL, DH + And BL, 0Fh + Mov AL, [HexNumbers+BX] + StosW + Mov BL, DL + ShR BL, CL + Mov AL, [HexNumbers+BX] + StosW + Mov BL, DL + And BL, 0Fh + Mov AL, [HexNumbers+BX] + StosW ; Offset is on screen. + + Mov AL, ':' + StosW + + Pop DI + Add DI, 160 + Add DX, 16 + Dec CH + JNZ F_DrawDebug1 + + ; Now to shove debug stuff. + Mov SI, DebugOffset + Mov DS, DebugSegment + Assume DS:Nothing + Mov DI, (10+15*80)*2 + + Mov DX, 30 + +F_DrawDebug2: + Push DI + Push SI + + Mov CX, 1004h + +F_DrawDebug3: + Cmp CH, 8 + JNE F_DrawDebug4 + + Mov AL, '-' + StosW + Xor AL, AL + StosW + +F_DrawDebug4: + LodsB ; Number. + Mov BL, AL + ShR BL, CL + Mov BL, [CS:HexNumbers+BX] + XChg AL, BL + And BL, 0Fh + StosW + Mov AL, [CS:HexNumbers+BX] + StosW + + Xor AL, AL + StosW + + Dec CH ; Hex number loop + JNZ F_DrawDebug3 + + StosW + + Pop SI + Mov CX, 16 + +F_DrawDebug5: + LodsB + StosW + Loop F_DrawDebug5 + + Pop DI + Add DI, 160 ; Next line. + + Dec DX ; line loop. + JNZ F_DrawDebug2 + + Push CS + Pop DS + + Push DebugDX + Push DebugCX + + Mov SI, Offset DebugMsg + Mov AH, 20h + Mov DI, (40+47*80)*2 + Call S_DrawString + Pop AX + Pop AX + + Mov AX, 1 + Ret + +EndP F_DrawDebug + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_PostDebug Far + + Mov CS:DebugCX, CX + Mov CS:DebugDX, DX + + Xor AX, AX + Ret + +EndP F_PostDebug + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_DebugUp Far + + Sub CS:DebugOffset, 16 + + Mov AX, 1 + Ret + +EndP F_DebugUp + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_DebugDown Far + + Add CS:DebugOffset, 16 + + Mov AX, 1 + Ret + +EndP F_DebugDown + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_DebugPgUp Far + + Sub CS:DebugOffset, 16*30 + + Mov AX, 1 + Ret + +EndP F_DebugPgUp + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_DebugPgDn Far + + Add CS:DebugOffset, 16*30 + + Mov AX, 1 + Ret + +EndP F_DebugPgDn + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_DebugStringInput Far + + Mov AX, Disk + Mov DS, AX + Assume DS:Disk + Mov DX, DiskDataArea + + Xor BP, BP ; BP = ':' count. + + Mov AX, Music + Mov DS, AX + Assume DS:Music + Mov BX, SongDataArea + + Mov AX, Pattern + Mov DS, AX + Assume DS:Pattern + Mov SI, PatternDataArea + + Push CS + Push CS + Pop DS + Pop ES + Assume DS:Functions ; ES = functions also. + + Mov DebugSongDataSegment, BX + Mov DebugDiskDataSegment, DX + Mov DebugPatternDataSegment, SI + + Mov SI, Offset DebugSegmentNames + Xor BX, BX + +F_DebugStringInput1: + Mov DI, Offset AddressInput + LodsB + Cmp AL, 0FFh + JE F_DebugStringInput2 + + Mov BL, AL + Push SI + ; OK.. compare in here.. +F_DebugStringInput4: + LodsB + Mov AH, [DI] + + And AL, AL + JZ F_DebugStringInput3 + + And AH, AH + JZ F_DebugStringInput6 + + Cmp AH, 'a' + JB F_DebugStringInput6 + Cmp AH, 'z' + JA F_DebugStringInput6 + + Add AH, 'A'-'a' + +F_DebugStringInput6: + Inc DI + Cmp AH, AL + JE F_DebugStringInput4 + + +F_DebugStringInput5: + Pop SI + Add SI, BX + Jmp F_DebugStringInput1 + + +F_DebugStringInput3: + And AH, AH + JNZ F_DebugStringInput6 + + LodsW + Pop SI + Mov DebugSegment, AX + Mov DebugOffset, 0 + + Mov AX, 1 + Ret + +F_DebugStringInput2: ; We have a hex address(?) + Mov SI, Offset AddressInput + Cmp Byte Ptr [SI], 0 + JE F_DebugStringInput15 + +F_DebugStringInput7: + LodsB + And AL, AL + JZ F_DebugStringInput10 + + Cmp AL, '0' + JB F_DebugStringInput8 + Cmp AL, '9' + JBE F_DebugStringInput7 + +F_DebugStringInput8: + Cmp AL, 'A' + JB F_DebugStringInput9 + Cmp AL, 'F' + JBE F_DebugStringInput7 + + +F_DebugStringInput9: + Cmp AL, 'a' + JB F_DebugStringInput16 + Cmp AL, 'f' + JBE F_DebugStringInput7 + +F_DebugStringInput16: + Cmp AL, ':' + JE F_DebugStringInput7 + +F_DebugStringInput15: + Xor AX, AX + Ret + +F_DebugStringInput10: ; Hex address + Mov BX, DebugSegment + Mov CL, 4 + Xor DX, DX ; BX:DX contains address + + Xor AX, AX + Mov SI, Offset AddressInput + +F_DebugStringInput11: + LodsB + And AL, AL + JZ F_DebugStringInput12 + + Cmp AL, ':' + JE F_DebugStringInput13 + + Sub AL, '0' + Cmp AL, 9 + JBE F_DebugStringInput14 + + Sub AL, '@'-'9' + Cmp AL, 15 + JBE F_DebugStringInput14 + + Sub AL, 32 + +F_DebugStringInput14: + ShL DX, CL + Add DX, AX + + Jmp F_DebugStringInput11 + +F_DebugStringInput13: + Inc BP + Cmp BP, 2 + JAE F_DebugStringInput17 + + Mov BX, DX + Xor DX, DX + Jmp F_DebugStringInput11 + +F_DebugStringInput17: + Mov DebugSegment, BX + Mov DebugOffset, DX + Xor DX, DX + Jmp F_DebugStringInput11 + +F_DebugStringInput12: + Cmp BP, 2 + JB F_DebugStringInput18 + + LDS SI, DWord Ptr [DebugOffset] + Mov [SI], DL + Jmp F_DebugStringInput19 + +F_DebugStringInput18: + Mov DebugSegment, BX + Mov DebugOffset, DX + +F_DebugStringInput19: + Mov AX, 1 + Ret + +EndP F_DebugStringInput + +ENDIF + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_ShowMIDIZxxInput Far + + Push CS + Pop DS + Assume DS:Functions + + Mov SI, Offset ZxxString + Mov AX, TopMIDIMacro + Add AX, 6 + Mov CX, 7 + +F_ShowMIDIZxxInput1: + Push AX + Dec AX + Loop F_ShowMIDIZxxInput1 + + Mov CX, 7 + Mov DI, (13+42*80)*2 + +F_ShowMIDIZxxInput2: + Mov AH, 20h + Call S_DrawString + Pop AX + Add DI, (80-3)*2 + Loop F_ShowMIDIZxxInput2 + + Ret + +EndP F_ShowMIDIZxxInput + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_MIDI_Up Far + + Cmp CS:TopMIDIMacro, 80h + JBE F_MIDI_Up1 + + Dec CS:TOPMIDIMacro + Jmp F_MIDI_Up2 + +F_MIDI_Up1: + Mov Word Ptr [ES:DI], 33 + +F_MIDI_Up2: + Mov AX, 1 + Ret + +EndP F_MIDI_Up + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_MIDI_Down Far + + Cmp CS:TopMIDIMacro, 0F9h + JAE F_MIDI_Down1 + + Inc CS:TOPMIDIMacro + +F_MIDI_Down1: + Mov AX, 1 + Ret + +EndP F_MIDI_Down + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_MIDI_PgUp Far + + Cmp Word Ptr [ES:DI], 33 + JBE F_MIDI_PgUp1 + + Sub Byte Ptr [CS:TopMIDIMacro], 7 + JS F_MIDI_PgUp1 + + Mov Byte Ptr [CS:TopMIDIMacro], 80h + +F_MIDI_PgUp1: + Mov AX, 1 + Ret + +EndP F_MIDI_PgUp + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc F_MIDI_PgDn Far + + Cmp Word Ptr [ES:DI], 33 + JBE F_MIDI_PgDn1 + + Add [CS:TopMIDIMacro], 7 + Cmp [CS:TopMIDIMacro], 0F9h + JB F_MIDI_PgDn1 + + Mov [CS:TopMIDIMacro], 0F9h + +F_MIDI_PgDn1: + Mov AX, 1 + Ret + +EndP F_MIDI_PgDn + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +EndS + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +End diff --git a/IT_FOUR.ASM b/IT_FOUR.ASM new file mode 100644 index 0000000..8f9058a --- /dev/null +++ b/IT_FOUR.ASM @@ -0,0 +1,612 @@ +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Fast Fourier Transform Module ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Jumps + .386P + .387 + +include switch.inc + +IF SPECTRUMANALYSER + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Externals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Segment Object1 BYTE Public 'Data' +EndS +Segment DiskData PARA Public 'Data' +EndS + + Extrn O1_FourierDisplay:Far + + Extrn M_Object1List:Far + + Extrn Music_GetWaveForm:Far + + Extrn S_InitScreen:Far + Extrn S_SetDirectMode:Far + + Global MouseUpdateEnable:Far, MouseUpdateDisable:Far + Extrn VESA_Detect:Far + Extrn VESA_SetMode:Far + Extrn VESA_SetBlock:Far + Extrn InitMouse:Far, UnInitMouse:Far + Extrn S_DefineSmallNumbers:Far + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + + +Segment Infopage BYTE Public 'Code' USE16 + Assume CS:Infopage, DS:Nothing, ES:Nothing + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Variables ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Functions ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Fourier_CreateTable Far ; Fills in ES:16384 +Public Fourier_CreateTable + + Mov DI, 20480 + Xor CX, CX + +Fourier_CreateTable1: + Mov DX, 11 + + Xor AX, AX + Mov BX, CX + +Fourier_CreateTable2: + ShR BX, 1 + AdC AX, AX + + Dec DX + JNZ Fourier_CreateTable2 + + ShL AX, 3 + StosW + + Inc CX + Cmp CX, 2048 + JB Fourier_CreateTable1 + + Ret + +EndP Fourier_CreateTable + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Const1_2048 DD 3C000000h +ConstHalf DD 3F000000h +Steps DW 0 +CurrentOffset DW 0 + +Proc Fourier_Transform Far +Public Fourier_Transform + ; Given DS:16384->DS:20480 = 2048 16-bit signed int samples + ; Given DS:20480->24576 = relocation table + ; Given DS:0->DS:16384 = working area + + ; Returns: DS:24576 -> 16-bit table of frequencies. (first 1024) + + Push DiskData + Pop DS + + Push DS + Pop ES + + Mov CX, 2048 ; Prepare 2048 samples + Mov SI, 16384 + Xor EDX, EDX + +Fourier_TransformRelocate1: + FILd Word Ptr [SI] + Mov DI, [SI+4096] + LodsW ; Add SI, 2 + Mov [DI+4], EDX + FStP DWord Ptr [DI] + Dec CX + JNZ Fourier_TransformRelocate1 + +; Samples relocated - now for transform + Mov CX, 1 + +Fourier_Transform1: + Mov [DS:24576], CX ; Store count + + FLdZ + FLd1 ; CurrentPhase.r, CurrentPhase.i + + FLdPi + FChs + FIDiv Word Ptr [DS:24576] ; -Pi/Step + FSinCos ; deltaphase.r, deltaphase.i, currentphase.r, currentphase.i + + Xor DX, DX + +Fourier_Transform2: + Mov SI, DX ; SI = k + Mov DI, CX ; DI = k+i + Mov BX, CX ; BX = i*2 + Add DI, DX + ShL SI, 3 ; SI = k*8 + ShL DI, 3 ; DI = (k+i)*8 + ShL BX, 4 ; BX = i*8*2 + +Fourier_Transform3: + FLd DWord Ptr [DI] + FMul ST, ST(3) ; cr*sr + FLd DWord Ptr [DI+4] + FMul ST, ST(4) ; cr*si, cr*sr, dr, di, cr, ci + FLd DWord Ptr [DI] + FMul ST, ST(6) + FLd DWord Ptr [DI+4] + FMul ST, ST(7) ; ci*si, ci*sr, cr*si, cr*sr, dr, di, cr, ci + FXCh + FAddP ST(2), ST + FSubP ST(2), ST ; tempi, tempr, dr, di, cr, ci + FLd DWord Ptr [SI+4] ; ri, tempi, tempr, dr, di, cr, ci + FAdd ST, ST(1) + FLd DWord Ptr [SI] + FAdd ST, ST(3) ; rr, ri, tempi, tempr, dr, di, cr, ci + FXCh ST(3) ; tempr, ri, tempi, rr, dr, di, cr, ci + FSubR DWord Ptr [SI] ; kr, ri, tempi, rr, dr, di, cr, ci + FXCh ST(2) + FSubR DWord Ptr [SI+4] ; ki, ri, kr, rr, dr, di, cr, ci + FXCh ST(3) ; rr, ri, kr, ki, dr, di, cr, ci + FStP DWord Ptr [SI] + FStP DWord Ptr [SI+4] + FStP DWord Ptr [DI] + FStP DWord Ptr [DI+4] + + Add SI, BX + Add DI, BX + + Cmp SI, 16384 + JB Fourier_Transform3 + +; Left with deltaphase.r, deltaphase.i, currentphase.r, currentphase.i + FLd ST ; d.r, d.r, d.i, c.r, c.i + FMul ST, ST(3) ; d.r*c.r, d.r, d.i, c.r, c.i + FXCh ST(3) ; c.r, d.r, d.i, d.r*c.r, c.i + FMul ST, ST(2) ; c.r*d.i, d.r, d.i, d.r*c.r, c.i + FLd ST(2) ; d.i, c.r*d.i, d.r, d.i, d.r*c.r, c.i + FMul ST, ST(5) ; d.i*c.i, c.r*d.i, d.r, d.i, d.r*c.r, c.i + FSubP ST(4), ST ; c.r*d.i, d.r, d.i, newr, c.i + FXCh ST(4) ; c.i, d.r, d.i, newr, c.r*d.i + FMul ST, ST(1) ; c.i*d.r, d.r, d.i, newr, c.r*d.i + FAddP ST(4), ST ; d.r, d.i, newr, newi + + Inc DX + Cmp DX, CX + JB Fourier_Transform2 + + FComPP + FComPP + + ShL CX, 1 + Cmp CX, 2048 + JB Fourier_Transform1 + +; Cleanup code. + Mov CX, 1024 + Xor SI, SI + Mov DI, 24576 + + FLd CS:Const1_2048 +; FMul ST, ST ; Include if no sqrt +; FMul ST, ST + +Fourier_CalculateMagnitudes1: ; Could be interleaved, but speed isn't + ; *really* a problem. + FLd DWord Ptr [SI] + FMul ST, ST + FLd DWord Ptr [SI+4] + FMul ST, ST + FAdd + FSqrt + FMul ST, ST(1) + + FStP DWord Ptr [DI] + + Add SI, 8 + Add DI, 4 + + Dec CX + JNZ Fourier_CalculateMagnitudes1 + + FStP ST + + Ret + +EndP Fourier_Transform + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +FourierPalette DB 0 + +Proc Fourier_ChangePalette Far +Public Fourier_ChangePalette + + Xor [CS:FourierPalette], 1 + Call Fourier_SetPalette + + Mov AX, 1 + Ret + +EndP Fourier_ChangePalette + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Fourier_SetPalette + + Mov DX, 3C8h + Xor AL, AL + Out DX, AL + Inc DX + + Cmp [CS:FourierPalette], 0 + JE Fourier_PaletteB + + Mov CX, 64 + +Fourier_PaletteA1: + Xor AL, AL + Out DX, AL + Out DX, AL + Mov AL, 64 + Sub AL, CL + ShR AL, 1 + Out DX, AL + Loop Fourier_PaletteA1 + + Mov CX, 64 + +Fourier_PaletteA2: + Xor AL, AL + Out DX, AL + Mov BL, 64 + Sub BL, CL + ShR BL, 1 + Mov AL, BL + Out DX, AL + Mov AL, BL + Add AL, 32 + Out DX, AL + Loop Fourier_PaletteA2 + + Mov CX, 128 + +Fourier_PaletteA3: + Mov AL, 128 + Sub AL, CL + ShR AL, 1 + Out DX, AL + ShR AL, 1 + Add AL, 32 + Out DX, AL + Mov AL, 63 + Out DX, AL + Loop Fourier_PaletteA3 + + Ret + +Fourier_PaletteB: + Mov CX, 32 + Xor BX, BX + +Fourier_PaletteB1: + Xor AL, AL + Out DX, AL + Out DX, AL + Mov AL, BL + Out DX, AL + Add BX, 2 + Loop Fourier_PaletteB1 + + Mov CX, 32 + Xor BL, BL + +Fourier_PaletteB2: + Mov AL, BL + Out DX, AL + Xor AL, AL + Out DX, AL + Mov AL, 63 + Out DX, AL + Add BX, 2 + + Loop Fourier_PaletteB2 + + Mov CX, 32 + +Fourier_PaletteB3: + Mov AL, 63 + Out DX, AL + Xor AL, AL + Out DX, AL + Mov AL, CL + Add AL, AL + Dec AL + Out DX, AL + Loop Fourier_PaletteB3 + + Mov CX, 32 + Xor BX, BX + +Fourier_PaletteB4: + Mov AL, 63 + Out DX, AL + Mov AL, BL + Out DX, AL + Xor AL, AL + Out DX, AL + Add BX, 2 + Loop Fourier_PaletteB4 + + Mov CX, 128 + Xor BX, BX + +Fourier_PaletteB5: + Mov AL, 63 + Out DX, AL + Out DX, AL + Mov AL, BL + ShR AL, 1 + Out DX, AL + Inc BX + Loop Fourier_PaletteB5 + + Ret + +EndP Fourier_SetPalette + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +ScreenWidth DW 0 +ScreenHeight DW 0 + +Proc Fourier_Start Far +Public Fourier_Start + + Push DiskData + Pop ES + Xor DI, DI + Mov CX, 32768 + Xor AX, AX + Rep StosW ; Clear data area first. + + Call Fourier_CreateTable + + Mov AL, 1 ; Prevent S_Update calls. + Call S_SetDirectMode + + Call VESA_Detect + JC Fourier_End + + Mov AX, 107h + +Fourier_NextMode: + Call VESA_SetMode ; Returns CX = width, DX = height + JNC Fourier_ModeOK + + Sub AL, 2 + JC Fourier_End + Jmp Fourier_NextMode + +Fourier_ModeOK: + Mov ScreenWidth, CX + Mov ScreenHeight, DX + + Call Fourier_SetPalette + + Mov CurrentOffset, 0 + + Call UnInitMouse + Mov DI, Offset O1_FourierDisplay + Xor CX, CX + Call M_Object1List + +Fourier_End: + Call S_InitScreen + Call InitMouse + Call S_DefineSmallNumbers + + Ret + +EndP Fourier_Start + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Fourier_PreDrawScreen Far +Public Fourier_PreDrawScreen + + Ret + +EndP Fourier_PreDrawScreen + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +ControlWord DW 003Fh + +Proc Fourier_DrawScreen Far +Public Fourier_DrawScreen + + FLdCW [CS:ControlWord] + + Push DiskData + Pop ES + Mov DI, 16384 + Call Music_GetWaveForm + JC Fourier_DrawScreen1 + + Push ES + Pop DS + Call Fourier_Transform ; Have table at DS:0 + + Mov CX, 1024 + Mov SI, 24576 + +Fourier_ConvertToInteger: + FLd DWord Ptr [SI] + FIStP DWord Ptr [SI] + Mov EDX, [SI] + ShR EDX, 6 + Cmp EDX, 255 + JB Fourier_DrawScreen3 + + Mov DL, 255 + +Fourier_DrawScreen3: + Mov [SI], DL + Add SI, 4 + Loop Fourier_ConvertToInteger + + Xor AX, AX + Call VESA_SetBlock + + Push 0A000h + Pop ES + Mov DI, CurrentOffset + Mov CX, ScreenHeight + Sub CX, 64 + Mov BX, ScreenWidth + LEA SI, [24576+ECX*4] + +Fourier_DrawScreen2: + Mov DL, [SI] + Mov [ES:DI], DL + + Sub SI, 4 + Add DI, BX + JNC Fourier_DrawScreen4 + + Inc AX + Call VESA_SetBlock + +Fourier_DrawScreen4: + Dec CX + JNZ Fourier_DrawScreen2 + + Mov AX, CurrentOffset + Inc AX + Xor DX, DX + Div BX + Mov CurrentOffset, DX + +; Now to draw volume bars. + + Mov CX, 64 + And EBX, 0FFFFh + + Mov BP, BX + Xor EDI, EDI + Cmp BP, 1024 + JB Fourier_DrawBars2 + + Mov DI, BX + Mov BP, 1024 + Sub DI, BP + ShR DI, 1 + +Fourier_DrawBars2: + +Fourier_DrawBars1: + Push BX + Push CX + Push EDI + + Xor EAX, EAX + + Mov AX, ScreenHeight + Sub AX, CX + Mul EBX ; EAX = offset. + Add EAX, EDI + + Mov DI, AX + ShR EAX, 16 + Call VESA_SetBlock + + Mov DX, BP + Mov BL, CL + Dec BL + ShL BL, 2 ; BL = 0->256 + + Push AX + Mov SI, 24580 + +Fourier_DrawBars3: + Cmp BL, Byte Ptr [SI] + SBB AL, AL + + Mov [ES:DI], AL + + Add DI, 1 + JNC Fourier_DrawBars4 + + Pop AX + Inc AX + Call VESA_SetBlock + Push AX + +Fourier_DrawBars4: + Add SI, 4 + Dec DX + JNZ Fourier_DrawBars3 + + Pop AX + + Pop EDI + Pop CX + Pop BX + Loop Fourier_DrawBars1 + +Fourier_DrawScreen1: + Ret + +EndP Fourier_DrawScreen + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Fourier_IdleList Far +Public Fourier_IdleList + + Mov AX, 1 + Ret + +EndP Fourier_IdleList + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Fourier_PostFunction Far +Public Fourier_PostFunction + + Cmp CX, 101h + JE Fourier_PostFunction2 + +Fourier_PostFunction1: + Xor AX, AX + Ret + +Fourier_PostFunction2: + Mov AX, 4 + Ret + +EndP Fourier_PostFunction + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + + +EndS + +ENDIF + +End + diff --git a/IT_G.ASM b/IT_G.ASM new file mode 100644 index 0000000..081b030 --- /dev/null +++ b/IT_G.ASM @@ -0,0 +1,1026 @@ +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Global Key Handler ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Jumps + +include switch.inc +include network.inc + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Externals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Segment Pattern BYTE Public 'Code' + Extrn LastInstrument:Byte + Extrn Order:Word + Extrn MaxRow:Word + Extrn NumberOfRows:Word + Extrn PatternNumber:Word +EndS + +Segment Inst BYTE Public 'Code' + Extrn SampleNumber:Byte + Extrn InstrumentScreen:Word +EndS + +Segment Object1 BYTE Public 'Data' +EndS + + Extrn D_InitLoadModule:Far + Extrn D_InitLoadSamples:Far + Extrn D_InitLoadInstruments:Far + Extrn Display_SelectDisplayList:Far + + Extrn M_Object1List:Far + + Extrn I_ClearTables:Far + + Extrn Music_GetInstrumentMode:Far + Extrn Music_GetPlayMode:Far + Extrn Music_PlayPattern:Far + Extrn Music_PlaySong:Far + Extrn Music_Stop:Far + Extrn Music_ToggleChannel:Far + Extrn Music_GetSlaveChannelInformationTable:Far + Extrn Music_IncreaseSpeed:Far + Extrn Music_DecreaseSpeed:Far + Extrn Music_IncreaseVolume:Far + Extrn Music_DecreaseVolume:Far + Extrn Music_GetSongSegment:Far + Extrn Music_GetDriverScreen:Far + + Extrn SetInfoLine:Far + + Extrn PE_GetCurrentPattern:Far + Extrn PE_SetPatternModified:far + + Extrn O1_InstrumentListGeneral:Far + Extrn O1_InstrumentListVolume:Far + Extrn O1_InstrumentListPanning:Far + Extrn O1_InstrumentListPitch:Far + + Extrn O1_KeyboardList:Far + Extrn O1_LoadSampleList:Far + Extrn O1_OrderPanningList:Far + Extrn O1_PatternEditList:Far + Extrn O1_PEConfigList:Far + Extrn O1_SampleList:Far + Extrn O1_LoadModuleList:Far + Extrn O1_ViewInstrumentLibrary:Far + Extrn O1_SaveModuleList:Far + Extrn O1_LoadInstrumentList:Far + Extrn O1_MessageList:Far + Extrn O1_OrderVolumeList:Far + Extrn O1_DisplayList:Far + Extrn I_DrawWaveForm:Far + Extrn S_DefineSmallNumbers:Far + Extrn S_SaveScreen:Far, S_RestoreScreen:Far + Extrn RestoreMouse:Far, RestoreMouseGraphics:Far + Extrn D_ClearFileSpecifier:Far + Extrn O1_ConfigureITList:Far + Extrn O1_ViewSampleLibrary:Far + Extrn O1_ConfigurePaletteList:Far + Extrn O1_MIDIScreen:Far + Extrn O1_TimerList:Far + Extrn I_MapEnvelope:Far + Extrn NewCharacterSet:Far + Extrn S_GetDestination:Far + Extrn S_DefineHiASCII:Far + +IF MEMORYDEBUG + Extrn O1_DebugList:Far +ENDIF + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Globals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Global Glbl_Ctrl_F1:Far + Global Glbl_Ctrl_F3:Far + Global Glbl_Ctrl_F4:Far + Global Glbl_Ctrl_F5:Far + Global Glbl_Ctrl_F12:Far + Global Glbl_F2:Far + Global Glbl_F3:Far + Global Glbl_F4:Far + Global Glbl_F4_2:Far + Global Glbl_F5:Far + Global Glbl_F6:Far + Global Glbl_Shift_F1:Far + Global Glbl_Shift_F6:Far + Global Glbl_Shift_F9:Far + Global Glbl_F8:Far + Global Glbl_F9:Far + Global Glbl_F10:Far + Global Glbl_F11:Far + Global Glbl_F12:Far + Global Glbl_Alt_F1:Far + Global Glbl_Alt_F2:Far + Global Glbl_Alt_F3:Far + Global Glbl_Alt_F4:Far + Global Glbl_Alt_F5:Far + Global Glbl_Alt_F6:Far + Global Glbl_Alt_F7:Far + Global Glbl_Alt_F8:Far + Global Glbl_LeftBrace:Far + Global Glbl_RightBrace:Far + Global Glbl_LeftSquareBracket:Far + Global Glbl_RightSquareBracket:Far + Global Glbl_LoadSample:Far + Global Glbl_LoadInstrument:Far + Global Glbl_GetHeaderMode:Far + Global Glbl_SetCurrentMode:Far + Global Glbl_GetCurrentMode:Far + Global Glbl_SaveMode:Far + Global Glbl_RestoreMode:Far + +IF TIMERSCREEN + Global Glbl_TimerScreen:Far +ENDIF + + Global CurrentMode:Byte + + Public Glbl_F2_2 + Public Glbl_F11_2 + +IF MEMORYDEBUG + Global Glbl_Debug:Far +ENDIF + Global Glbl_DriverScreen:Far + + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +Segment Glbl BYTE Public 'Code' + Assume CS:Glbl, DS:Nothing + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Variables ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +SLAVECHANNELSIZE EQU 128 + +CurrentMode DB 0 ; 2 = Pattern edit + ; 3 = Sample list + ; 4 = Instrument list + ; 5 = Info list + ; 6 = configure pattern edit + ; 9 = load list + ; 10 = save list + ; 11 = order/panning list + ; 12 = configure IT list + ; 13 = load sample list. + ; 14 = palette config list. + ; 15 = load instrument list + ; 16 = message list + ; 21 = order/volume list + ; 22 = debug + ; 23 = timer + ; 24 = Network screen + ; 31 = MIDI list + ; 1 = Keyboard list + ; 0 = Nothing in particular :) + ; 100 = Driver Screen + ; 200 = Full screen display + ; 201 = VGA display + +CurrentMode2 DB 0 +CurrentList DW 0 +CurrentListSegment DW 0 + +TempoSetMsg DB "Tempo set to ", 0FDh, "D beats per minute", 0 +SpeedSetMsg DB "Speed set to ", 0FDh, "D frames per row", 0 +VolumeSetMsg DB "Global Volume set to ", 0FDh, "D", 0 + +InstrumentScreenTable Label + DW Offset O1_InstrumentListGeneral + DW Offset O1_InstrumentListVolume + DW Offset O1_InstrumentListPanning + DW Offset O1_InstrumentListPitch + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Functions ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Proc Glbl_F2 Far + + Call Glbl_SampleToInstrument + Cmp CS:CurrentMode, 2 + + JE Glbl_F2_1 + +Glbl_F2_2: + Call S_DefineSmallNumbers + + Mov AX, 5 + Mov SI, 1 + Mov CX, Object1 + Mov CS:CurrentMode, 2 + + Mov DX, Offset O1_PatternEditList + + Ret + +Glbl_F2_1: + Mov CS:CurrentMode, 6 + + Mov AX, Pattern + Mov DS, AX + Assume DS:Pattern + + Mov AX, MaxRow + Inc AX + Mov NumberOfRows, AX + + Mov DI, Offset O1_PEConfigList + Mov CX, 0FFFFh + Call M_Object1List + Call PE_SetPatternModified + + Mov AX, Pattern + Mov DS, AX + Assume DS:Pattern + + Mov BX, NumberOfRows + Dec BX + Mov MaxRow, BX + +IF NETWORKENABLED + Call Network_GetSendQueue + JZ Glbl_F2_Network + + Mov AX, NETWORK_SETPATTERNLENGTH*100h ; Destination ALL + StosW + Mov AH, BL + Mov AL, [Byte Ptr PatternNumber] + StosW + +Glbl_F2_Network: + Call Network_FinishedSendQueue +ENDIF + Mov CS:CurrentMode, 2 + + Mov AX, 1 + Ret + +EndP Glbl_F2 + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_F3 Far + + Call I_DrawWaveForm + + Mov AX, 5 + Mov SI, 1 + Mov CX, Object1 + Mov CS:CurrentMode, 3 + + Mov DX, Offset O1_SampleList + Ret + +EndP Glbl_F3 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_F4 Far + + ; Init SampleNumber + Call Glbl_SampleToInstrument + + Mov AX, Pattern + Mov DS, AX + Assume DS:Pattern + + Mov BL, LastInstrument + And BL, BL + JNZ Glbl_F4_1 + + Mov LastInstrument, 1 + +Glbl_F4_1: + Mov AX, Inst + Mov DS, AX + Assume DS:Inst + Mov SampleNumber, BL + +Proc Glbl_F4_2 Far + + Call I_MapEnvelope + + Mov DI, InstrumentScreen + Add DI, DI + Mov DX, [DI+InstrumentScreenTable] + + Mov AX, 5 + Mov SI, 1 + Mov CX, Object1 + Mov CS:CurrentMode, 4 + + Ret + +EndP Glbl_F4_2 + +EndP Glbl_F4 + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_F5 Far + + Cmp CS:CurrentMode, 5 + JE Glbl_F5_1 + + Call S_DefineSmallNumbers + + Call Music_GetPlayMode + Test AX, AX + JNZ Glbl_F5_4 + + Call Music_GetSlaveChannelInformationTable + +Glbl_F5_3: + Test Byte Ptr [SI], 1 + JNZ Glbl_F5_4 + + Add SI, SLAVECHANNELSIZE + Loop Glbl_F5_3 + + Call I_ClearTables + + Xor AX, AX + Call Music_PlaySong + +Glbl_F5_4: + Jmp Display_SelectDisplayList + +Glbl_F5_1: + Call Music_GetPlayMode + And AX, AX + JNZ Glbl_F5_2 + + Call I_ClearTables + + Xor AX, AX + Call Music_PlaySong + +Glbl_F5_2: + Mov AX, 1 + Ret + +EndP Glbl_F5 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_F6 Far + + Call I_ClearTables + + Call PE_GetCurrentPattern + Xor CX, CX + Call Music_PlayPattern + + Mov AX, 1 + Ret + +EndP Glbl_F6 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_LoadSample Far + + Call D_InitLoadSamples + + Mov AX, 5 + Mov SI, 1 + Mov CX, Object1 + Mov CS:CurrentMode, 13 + + Mov DX, Offset O1_LoadSampleList + Ret + +EndP Glbl_LoadSample + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_LoadInstrument Far + + Call D_InitLoadInstruments + + Mov AX, 5 + Mov SI, 1 + Mov CX, Object1 + Mov CS:CurrentMode, 15 + + Mov DX, Offset O1_LoadInstrumentList + Ret + +EndP Glbl_LoadInstrument + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_Shift_F1 Far + + Mov AX, 5 + Mov SI, 1 + Mov CX, Object1 + Mov CS:CurrentMode, 31 + + Mov DX, Offset O1_MIDIScreen + Ret + +EndP Glbl_Shift_F1 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_Shift_F9 Far + + Call S_DefineHIASCII + + Mov AX, 5 + Mov SI, 1 + Mov CX, Object1 + Mov CS:CurrentMode, 16 + + Mov DX, Offset O1_MessageList + Ret + +EndP Glbl_Shift_F9 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_Shift_F6 Far + + Call I_ClearTables + + Mov AX, Pattern + Mov DS, AX + Assume DS:Pattern + Mov AX, Order + + Call Music_PlaySong + + Mov AX, 1 + Ret + +EndP Glbl_Shift_F6 + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_F8 Far + + Call Music_Stop + + Mov AX, 1 + Ret + +EndP Glbl_F8 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_F9 Far + + Call D_InitLoadModule + + Mov AX, 5 + Mov SI, 1 + Mov CX, Object1 + Mov CS:CurrentMode, 9 + + Mov DX, Offset O1_LoadModuleList + + Mov DS, CX + Mov BX, DX + Mov Word Ptr [BX], 12 + + Ret + +EndP Glbl_F9 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_F10 Far + + Call D_InitLoadModule + + Mov AX, 5 + Mov SI, 1 + Mov CX, Object1 + Mov CS:CurrentMode, 10 + + Mov DX, Offset O1_SaveModuleList + + Mov DS, CX + Mov BX, DX + Mov Word Ptr [BX], 15 + + Call D_ClearFileSpecifier + + Ret + +EndP Glbl_F10 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_F11 Far + + Cmp CS:CurrentMode, 11 + JE Glbl_F11_1 + +Glbl_F11_2: + Mov AX, 5 + Mov SI, 1 + Mov CX, Object1 + Mov DX, Offset O1_OrderPanningList + + Mov CS:CurrentMode, 11 + Ret + +Glbl_F11_1: + Mov AX, 5 + Mov SI, 1 + Mov CX, Object1 + Mov DX, Offset O1_OrderPanningList + + Mov CS:CurrentMode, 21 + Mov DX, Offset O1_OrderVolumeList + Ret + +EndP Glbl_F11 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_F12 Far + + Mov AX, 5 + Mov SI, 1 + Mov CX, Object1 + Mov CS:CurrentMode, 12 + + Mov DX, Offset O1_ConfigureITList + Ret + +EndP Glbl_F12 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_Ctrl_F1 Far + + Mov AX, 5 + Mov SI, 1 + Mov CX, Object1 + Mov CS:CurrentMode, 1 + + Mov DX, Offset O1_KeyboardList + Ret + +EndP Glbl_Ctrl_F1 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_Ctrl_F3 Far + + Call D_InitLoadSamples + + Mov AX, 5 + Mov SI, 1 + Mov CX, Object1 + Mov CS:CurrentMode, 13 + + Mov DX, Offset O1_ViewSampleLibrary + Ret + +EndP Glbl_Ctrl_F3 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_Ctrl_F4 Far + + Call D_InitLoadInstruments + + Mov AX, 5 + Mov SI, 1 + Mov CX, Object1 + Mov CS:CurrentMode, 15 + + Mov DX, Offset O1_ViewInstrumentLibrary + Ret + +EndP Glbl_Ctrl_F4 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_Ctrl_F5 Far + + Call I_ClearTables + + Xor AX, AX + Call Music_PlaySong + + Mov AX, 1 + Ret + +EndP Glbl_Ctrl_F5 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_Ctrl_F12 Far + + Mov AX, 5 + Mov SI, 1 + Mov CX, Object1 + Mov CS:CurrentMode, 14 + + Mov DX, Offset O1_ConfigurePaletteList + + Ret + +EndP Glbl_Ctrl_F12 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_GetHeaderMode Far + + Push DS + Mov AX, Pattern + Mov DS, AX + Assume DS:Pattern + Mov AL, LastInstrument + Pop DS + + Xor AH, AH + + Cmp CS:CurrentMode, 3 ; Sample list + JE Glbl_GetHeaderMode1 + + Cmp CS:CurrentMode, 13 ; Sample load list + JE Glbl_GetHeaderMode1 + + Cmp CS:CurrentMode, 4 + JE Glbl_GetHeaderMode2 + + Call Music_GetInstrumentMode + +Glbl_GetHeaderMode1: + Ret + +Glbl_GetHeaderMode2: + Push DS + Push AX + + Mov AX, Inst + Mov DS, AX + Assume DS:Inst + + Pop AX + Mov AL, SampleNumber + + Pop DS + Ret + +EndP Glbl_GetHeaderMode + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_SetCurrentMode Far + + Mov CS:CurrentMode, AL + + Ret + +EndP Glbl_SetCurrentMode + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_GetCurrentMode Far ; Returns AL + + Mov AL, CS:CurrentMode + + Ret + +EndP Glbl_GetCurrentMode + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_Alt_F1 Far + + Mov AX, 0 + Call Music_ToggleChannel + + Mov AX, 1 + Ret + +EndP Glbl_Alt_F1 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_Alt_F2 Far + + Mov AX, 1 + Call Music_ToggleChannel + + Mov AX, 1 + Ret + +EndP Glbl_Alt_F2 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_Alt_F3 Far + + Mov AX, 2 + Call Music_ToggleChannel + + Mov AX, 1 + Ret + +EndP Glbl_Alt_F3 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_Alt_F4 Far + + Mov AX, 3 + Call Music_ToggleChannel + + Mov AX, 1 + Ret + +EndP Glbl_Alt_F4 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_Alt_F5 Far + + Mov AX, 4 + Call Music_ToggleChannel + + Mov AX, 1 + Ret + +EndP Glbl_Alt_F5 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_Alt_F6 Far + + Mov AX, 5 + Call Music_ToggleChannel + + Mov AX, 1 + Ret + +EndP Glbl_Alt_F6 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_Alt_F7 Far + + Mov AX, 6 + Call Music_ToggleChannel + + Mov AX, 1 + Ret + +EndP Glbl_Alt_F7 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_Alt_F8 Far + + Mov AX, 7 + Call Music_ToggleChannel + + Mov AX, 1 + Ret + +EndP Glbl_Alt_F8 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_LeftBrace Far + + Push CS + Pop DS + + Call Music_IncreaseSpeed + Mov SI, Offset SpeedSetMsg + Call SetInfoLine + + Mov AX, 1 + Ret + +EndP Glbl_LeftBrace + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_RightBrace Far + + Push CS + Pop DS + + Call Music_DecreaseSpeed + Mov SI, Offset SpeedSetMsg + Call SetInfoLine + + Mov AX, 1 + Ret + +EndP Glbl_RightBrace + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_LeftSquareBracket Far + + Push CS + Pop DS + + Call Music_DecreaseVolume + + Mov SI, Offset VolumeSetMsg + Call SetInfoLine + + Mov AX, 1 + Ret + +EndP Glbl_LeftSquareBracket + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_RightSquareBracket Far + + Push CS + Pop DS + + Call Music_IncreaseVolume + + Mov SI, Offset VolumeSetMsg + Call SetInfoLine + + Mov AX, 1 + Ret + +EndP Glbl_RightSquareBracket + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_SaveMode Far + +; Call S_GetDestination +; Mov AX, 0B800h +; Mov ES, AX +; Call RestoreMouse + + Call S_SaveScreen + + Mov AL, CurrentMode + Mov CurrentMode2, AL + + Mov BP, SP + Mov AX, [BP+16] + Mov CurrentList, AX + Mov AX, [BP+18] + Mov CurrentListSegment, AX + Mov CurrentMode, 0 + + Ret + +EndP Glbl_SaveMode + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_RestoreMode Far + +; Call NewCharacterSet + + Call S_RestoreScreen + + Mov AL, CurrentMode2 + Mov CurrentMode, AL + + Mov AX, 5 + Mov SI, 1 + Mov CX, CurrentListSegment + Mov DX, CurrentList + + Ret + +EndP Glbl_RestoreMode + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +IF MEMORYDEBUG + +Proc Glbl_Debug Far + + Mov AX, 5 + Mov SI, 1 + Mov CX, Object1 + Mov CS:CurrentMode, 22 + + Mov DX, Offset O1_DebugList + Ret + +EndP Glbl_Debug + +ENDIF + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_SampleToInstrument + + Cmp CS:CurrentMode, 3 + JNE Glbl_SampleToInstrument1 + + Call Music_GetSongSegment + Mov DS, AX + Assume DS:Nothing + + Test Byte Ptr [DS:2Ch], 4 + JZ Glbl_SampleToInstrument1 + + Mov AX, Pattern + Mov ES, AX + Assume ES:Pattern + + Mov AH, ES:LastInstrument + Mov BX, [DS:64712] ; Offset of first instrument + + ; Search for sample in tables. + Mov DX, 99 + +Glbl_SampleToInstrument2: + Push BX + + Add BX, 41h ; To note/sample tables + Mov CX, 120 + +Glbl_SampleToInstrument4: + Cmp [BX], AH + JE Glbl_SampleToInstrument3 + Add BX, 2 + Loop Glbl_SampleToInstrument4 + + Pop BX + Add BX, 554 ; Length of instrument + Dec DX + JNZ Glbl_SampleToInstrument2 + + Ret + +Glbl_SampleToInstrument3: + Pop BX + + Mov AL, 100 + Sub AL, DL + Mov ES:LastInstrument, AL + +Glbl_SampleToInstrument1: + Ret + +EndP Glbl_SampleToInstrument + Assume ES:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +IF TIMERSCREEN + +Proc Glbl_TimerScreen Far + + Mov AX, 5 + Mov SI, 1 + Mov CX, Object1 + Mov CS:CurrentMode, 23 + + Mov DX, Offset O1_TimerList + Ret + +EndP Glbl_TimerScreen + +ENDIF + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_DriverScreen Far + + Call Music_GetDriverScreen + JC Glbl_DriverScreen1 + + Mov CurrentMode, 100 + +Glbl_DriverScreen1: + Ret + +EndP Glbl_DriverScreen + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +EndS + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +End diff --git a/IT_H.ASM b/IT_H.ASM new file mode 100644 index 0000000..4d99b62 --- /dev/null +++ b/IT_H.ASM @@ -0,0 +1,1552 @@ +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Help Module ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + .386 + Jumps + +include switch.inc + +Segment Object1 BYTE Public 'Data' +EndS + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Externals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Extrn M_Object1List:Far + Extrn Glbl_SaveMode:Far + Extrn Glbl_RestoreMode:Far + + Extrn S_DrawString:Far + + Extrn O1_HelpList:Far + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Globals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Global H_SetHelpContext:Far + Global H_DrawHelp:Far + Global H_Help:Far + Global H_HelpUp:Far + Global H_HelpDown:Far + Global H_HelpPgUp:Far + Global H_HelpPgDn:Far + Global H_HelpESC:Far + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +Segment Object1 BYTE Public 'Data' +EndS + +Segment Help BYTE Public USE16 'Code' + Assume CS:Help, DS:Nothing + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Variables ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + ; Help contexts.... + ; 0 = Order list & Panning + ; 1 = Pattern edit list + ; 2 = Sample list + ; 3 = Load module + ; 4 = Order list & Volume + ; 5 = Configuration screen + ; 6 = Load sample list + ; 7 = Instrument list + ; 8 = Keyboard list + ; 9 = Info page + ; 10 = Palette configuration + ; 11 = Instrument list + ; 12 = message editor + ; 13 = MIDI Input + ; 14 = MIDI Output + +HelpContext DW 0 +TopLine DW 0 + +Positions DW 15 Dup (0) + +HelpContextPtrs Label Word + DW Offset HelpContext0Ptrs + DW Offset HelpContext1Ptrs + DW Offset HelpContext2Ptrs + DW Offset NoHelpContext + DW Offset HelpContext4Ptrs + DW Offset NoHelpContext + DW Offset NoHelpContext + DW Offset HelpContext7Ptrs + DW Offset NoHelpContext + DW Offset HelpContext9Ptrs + DW Offset NoHelpContext + DW Offset NoHelpContext + DW Offset HelpContext12Ptrs + DW Offset NoHelpContext + DW Offset NoHelpContext + +NoHelpContext DW Offset NewLine + DW Offset HelpGlobal_0 + DW Offset HelpGlobal_1 + DW Offset HelpGlobal_37 + DW Offset HelpGlobal_3 + DW Offset HelpGlobal_4 + DW Offset HelpGlobal_20 + DW Offset HelpGlobal_9 + DW Offset HelpGlobal_10 + DW Offset HelpGlobal_19 + DW Offset HelpGlobal_11 + DW Offset HelpGlobal_12 + DW Offset HelpGlobal_33 + DW Offset HelpGlobal_13 + DW Offset HelpGlobal_5 + DW Offset HelpGlobal_6 + DW Offset HelpGlobal_2 + DW Offset HelpGlobal_7 + DW Offset HelpGlobal_8 + DW Offset HelpGlobal_32 + DW Offset NewLine + DW Offset HelpGlobal_17 + DW Offset HelpGlobal_31 + DW Offset HelpGlobal_18 + DW Offset NewLine + DW Offset HelpGlobal_16 + DW Offset HelpGlobal_34 + DW Offset HelpGlobal_35 + DW Offset HelpGlobal_36 + DW Offset HelpGlobal_21 + DW Offset HelpGlobal_14 + DW Offset HelpGlobal_15 + DW 0 + +HelpContext0Ptrs DW Offset HelpContext0_26 + DW Offset HelpContext0_0 + DW Offset HelpContext0_27 + DW Offset NewLine + DW Offset HelpContext0_6 + DW Offset HelpContext0_28 + DW Offset HelpContext0_8 + DW Offset HelpContext0_9 + DW Offset HelpContext0_13 + DW Offset HelpContext0_14 + DW Offset HelpContext0_12 + DW Offset HelpContext0_15 + DW Offset NewLine + DW Offset HelpContext0_30 + DW Offset HelpContext0_29 + DW Offset NewLine + DW Offset Divider + DW Offset NewLine + DW Offset HelpGlobal_0 + DW Offset HelpGlobal_1 + DW Offset HelpGlobal_37 + DW Offset HelpGlobal_3 + DW Offset HelpGlobal_4 + DW Offset HelpGlobal_9 + DW Offset HelpGlobal_10 + DW Offset HelpGlobal_19 + DW Offset HelpGlobal_11 + DW Offset HelpGlobal_12 + DW Offset HelpGlobal_33 + DW Offset HelpGlobal_13 + DW Offset HelpGlobal_5 + DW Offset HelpGlobal_6 + DW Offset HelpGlobal_2 + DW Offset HelpGlobal_7 + DW Offset HelpGlobal_8 + DW Offset HelpGlobal_32 + DW Offset NewLine + DW Offset HelpGlobal_17 + DW Offset HelpGlobal_31 + DW Offset HelpGlobal_18 + DW Offset NewLine + DW Offset HelpGlobal_16 + DW Offset HelpGlobal_34 + DW Offset HelpGlobal_35 + DW Offset HelpGlobal_36 + DW Offset HelpGlobal_21 + DW Offset HelpGlobal_14 + DW Offset HelpGlobal_15 + DW Offset NewLine + DW Offset Divider + DW 0 + +HelpContext4Ptrs DW Offset HelpContext4_0 + DW Offset HelpContext4_1 + DW Offset HelpContext4_2 + DW Offset NewLine + DW Offset HelpContext0_6 + DW Offset HelpContext0_28 + DW Offset HelpContext0_8 + DW Offset HelpContext0_9 + DW Offset HelpContext0_13 + DW Offset HelpContext0_14 + DW Offset HelpContext0_12 + DW Offset HelpContext0_15 + DW Offset NewLine + DW Offset Divider + DW Offset NewLine + DW Offset HelpGlobal_0 + DW Offset HelpGlobal_1 + DW Offset HelpGlobal_37 + DW Offset HelpGlobal_3 + DW Offset HelpGlobal_4 + DW Offset HelpGlobal_20 + DW Offset HelpGlobal_9 + DW Offset HelpGlobal_22 + DW Offset HelpGlobal_10 + DW Offset HelpGlobal_19 + DW Offset HelpGlobal_11 + DW Offset HelpGlobal_12 + DW Offset HelpGlobal_33 + DW Offset HelpGlobal_13 + DW Offset HelpGlobal_5 + DW Offset HelpGlobal_23 + DW Offset HelpGlobal_6 + DW Offset HelpGlobal_2 + DW Offset HelpGlobal_7 + DW Offset HelpGlobal_8 + DW Offset HelpGlobal_32 + DW Offset NewLine + DW Offset HelpGlobal_17 + DW Offset HelpGlobal_31 + DW Offset HelpGlobal_18 + DW Offset NewLine + DW Offset HelpGlobal_16 + DW Offset HelpGlobal_34 + DW Offset HelpGlobal_35 + DW Offset HelpGlobal_36 + DW Offset HelpGlobal_21 + DW Offset HelpGlobal_14 + DW Offset HelpGlobal_15 + DW Offset NewLine + DW Offset Divider + DW 0 + +NewLine DB 0, 0 +Divider DB 2, 0FFh, 76, 154, 0 + +HelpContext0_26 DB 27, 0FFh, 1, 139, 0FFh, 26, 134, 0FFh, 1, 138, 0 +HelpContext0_0 DB 27, 0FFh, 1, 132, ' ', 0B9h, 0AAh, 0A1h, 0B8h, ' ', 0FFh, 1, 145, 0 +HelpContext0_27 DB 27, 0FFh, 1, 137, 0FFh, 26, 143, 0FFh, 1, 150, 0 + +HelpContext4_0 DB 22, 0FFh, 1, 139, 0FFh, 33, 134, 0FFh, 1, 138, 0 +HelpContext4_1 DB 22, 0FFh, 1, 132, ' ', 0B9h, 0AAh, 0A1h, 8Dh, 89h, ' ', 0FFh, 1, 145, 0 +HelpContext4_2 DB 22, 0FFh, 1, 137, 0FFh, 33, 143, 0FFh, 1, 150, 0 + +HelpContext0_6 DB 3, 0B9h, 0ADh, '.', 0 +HelpContext0_28 DB 5, 'N', 0FFh, 17, ' ', 83h, 0B4h, 85h, 0 +HelpContext0_8 DB 5, '-', 0FFh, 17, ' End ', 0BEh, 'song mark', 0 +HelpContext0_9 DB 5, '+', 0FFh, 17, ' Skip ', 0B1h, 0B4h, 0B9h, 'mark', 0 +HelpContext0_13 DB 5, 0C1h, 0FFh, 15, ' ', 83h, 0BFh, 85h, 0 +HelpContext0_14 DB 5, 0C2h, 0FFh, 15, ' ', 84h, 0BFh, 85h, 0 +HelpContext0_12 DB 5, 'Tab/', 82h, 'Tab', 0FFh, 5, ' ', 9Ch, 0B1h, 0B4h, 0B6h, 0 +HelpContext0_15 DB 5, 81h, 'F7', 0FFh, 11, ' ', 9Fh, 'this ', 0B9h, 0B4h, 0 + +HelpContext0_30 DB 3, 0B8h, 0ADh, '.', 0 +HelpContext0_29 DB 5, 'L/M/R/S', 0FFh, 11, ' ', 0A6h, 0B5h, 0B1h, 'Left/Middle/Right/Surround', 0 + +HelpGlobal_0 DB 3, 'G', 0B2h, 0ADh, '.', 0 +HelpGlobal_1 DB 5, 'F1', 0FFh, 16, ' Help (Context sensitive!)', 0 +HelpGlobal_37 DB 5, 82h, 'F1', 0FFh, 10, ' MIDI Screen', 0 +HelpGlobal_3 DB 5, 'F2', 0FFh, 16, ' ', 86h, 'Editor / ', 86h, 'Editor Options', 0 +HelpGlobal_4 DB 5, 'F3', 0FFh, 16, ' ', 94h, 0AAh, 0 +HelpGlobal_20 DB 5, 81h, 'F3', 0FFh, 11, ' ', 94h, 0ABh, 0 +HelpGlobal_9 DB 5, 'F4', 0FFh, 16, ' ', 8Eh, 0AAh, 0 +HelpGlobal_22 DB 5, 81h, 'F4', 0FFh, 11, ' ', 8Eh, 0ABh, 0 +HelpGlobal_10 DB 5, 'F5', 0FFh, 16, ' ', 9Fh, 'Information / ', 9Fh, 'song', 0 +HelpGlobal_19 DB 5, 81h, 'F5', 0FFh, 11, ' ', 9Fh, 'Song', 0 +HelpGlobal_11 DB 5, 'F6', 0FFh, 16, ' ', 9Fh, 0A2h, 85h, 0 +HelpGlobal_12 DB 5, 82h, 'F6', 0FFh, 10, ' ', 9Fh, 'song ', 0A9h, 0A2h, 0B9h, 0 +HelpGlobal_33 DB 5, 'F7', 0FFh, 16, ' ', 9Fh, 0A9h, 'mark / ', 0A2h, 'row', 0 +HelpGlobal_13 DB 5, 'F8', 0FFh, 16, ' Stop Playback', 0 +HelpGlobal_5 DB 5, 'F9', 0FFh, 16, ' Load Module', 0 +HelpGlobal_23 DB 5, 82h, 'F9', 0FFh, 10, ' Message Editor', 0 +HelpGlobal_6 DB 5, 'F10', 0FFh, 15, ' Save Module', 0 +HelpGlobal_2 DB 5, 'F11', 0FFh, 15, ' ', 0B9h, 0AAh, 0A1h, 0B8h, 0 +HelpGlobal_7 DB 3, '2*F11', 0FFh, 15, ' ', 0B9h, 0AAh, 0A1h, 8Dh, 89h, 0 +HelpGlobal_8 DB 5, 'F12', 0FFh, 15, ' Song Variables & Directory Configuration', 0 +HelpGlobal_32 DB 5, 81h, 'F12', 0FFh, 10, ' Palette Configuration', 0 + +HelpGlobal_17 DB 5, '{ }', 0FFh, 15, ' ', 93h, '/', 92h, ' playback ', 0C4h, 0 +HelpGlobal_31 DB 5, '[ ]', 0FFh, 15, ' ', 93h, '/', 92h, ' g', 0B2h, 8Ah, 0 +HelpGlobal_18 DB 5, 80h, 'F1 -> ', 80h, 'F8 ', 9Dh, 0A3h, 's 1->8', 0 + +HelpGlobal_16 DB 5, 81h, 'D', 0FFh, 12, ' DOS Shell', 0 +HelpGlobal_34 DB 5, 81h, 'E', 0FFh, 12, ' Refresh screen ', 0A1h, 'reset cache identification', 0 +HelpGlobal_35 DB 5, 81h, 'I', 0FFh, 12, ' Reinitialise sound driver', 0 +HelpGlobal_36 DB 5, 81h, 'M', 0FFh, 12, ' ', 9Dh, 'mouse cursor', 0 +HelpGlobal_21 DB 5, 81h, 'N', 0FFh, 12, ' New Song', 0 +HelpGlobal_14 DB 5, 81h, 'Q', 0FFh, 12, ' Quit ', 0B1h, 'DOS', 0 +HelpGlobal_15 DB 5, 81h, 'S', 0FFh, 12, ' Save ', 0A2h, 'song', 0 + + +HelpContext1Ptrs Label Word + DW Offset HelpContext1_0 + DW Offset HelpContext1_1 + DW Offset HelpContext1_2 + DW Offset NewLine + DW Offset HelpContext1_3 + DW Offset NewLine + DW Offset HelpContext1_200 + DW Offset HelpContext1_201 + DW Offset HelpContext1_202 + DW Offset HelpContext1_203 + DW Offset HelpContext1_204 + DW Offset HelpContext1_205 + DW Offset HelpContext1_206 + DW Offset HelpContext1_207 + DW Offset HelpContext1_208 + DW Offset NewLine + DW Offset HelpContext1_299 + DW Offset HelpContext1_4 + DW Offset HelpContext1_5 + DW Offset HelpContext1_6 + DW Offset HelpContext1_7 + DW Offset HelpContext1_8 + DW Offset HelpContext1_9 + DW Offset HelpContext1_10 + DW Offset HelpContext1_11 + DW Offset HelpContext1_12 + DW Offset HelpContext1_13 + DW Offset HelpContext1_14 + DW Offset HelpContext1_15 + DW Offset HelpContext1_16 + DW Offset HelpContext1_17 + DW Offset HelpContext1_18 + DW Offset HelpContext1_19 + DW Offset HelpContext1_20 + DW Offset HelpContext1_21 + DW Offset HelpContext1_22 + DW Offset HelpContext1_23 + DW Offset HelpContext1_24 + DW Offset HelpContext1_141 + DW Offset HelpContext1_142 + DW Offset HelpContext1_143 + DW Offset HelpContext1_25 + DW Offset HelpContext1_26 + DW Offset HelpContext1_135 + DW Offset HelpContext1_136 + DW Offset HelpContext1_137 + DW Offset HelpContext1_27 + DW Offset HelpContext1_28 + DW Offset HelpContext1_29 + DW Offset HelpContext1_30 + DW Offset HelpContext1_31 + DW Offset HelpContext1_32 + DW Offset HelpContext1_33 + DW Offset HelpContext1_34 + DW Offset HelpContext1_35 + DW Offset HelpContext1_36 + DW Offset HelpContext1_45 + DW Offset HelpContext1_46 + DW Offset HelpContext1_47 + DW Offset HelpContext1_48 + DW Offset HelpContext1_49 + DW Offset HelpContext1_50 + DW Offset HelpContext1_51 + DW Offset HelpContext1_62 + DW Offset HelpContext1_63 + DW Offset HelpContext1_64 + DW Offset HelpContext1_65 + DW Offset HelpContext1_66 + DW Offset HelpContext1_52 + DW Offset HelpContext1_53 + DW Offset HelpContext1_144 + DW Offset HelpContext1_145 + DW Offset HelpContext1_153 + DW Offset HelpContext1_154 + DW Offset HelpContext1_155 + DW Offset HelpContext1_156 + DW Offset HelpContext1_157 + DW Offset HelpContext1_162 + DW Offset HelpContext1_168 + DW Offset HelpContext1_169 + DW Offset HelpContext1_170 + DW Offset HelpContext1_171 + DW Offset HelpContext1_54 + DW Offset HelpContext1_55 + DW Offset HelpContext1_56 + DW Offset HelpContext1_57 + DW Offset HelpContext1_146 + DW Offset HelpContext1_58 + DW Offset HelpContext1_59 + DW Offset HelpContext1_60 + DW Offset HelpContext1_61 + DW Offset HelpContext1_179 + DW Offset HelpContext1_180 + DW Offset HelpContext1_67 + DW Offset HelpContext1_68 + DW Offset HelpContext1_69 + DW Offset HelpContext1_70 + DW Offset HelpContext1_138 + DW Offset HelpContext1_139 + DW Offset HelpContext1_140 + DW Offset HelpContext1_71 + DW Offset HelpContext1_72 + DW Offset HelpContext1_73 + DW Offset NewLine + DW Offset Divider + DW Offset NewLine + DW Offset HelpContext1_74 + DW Offset HelpContext1_114 + DW Offset HelpContext1_115 + DW Offset HelpContext1_134 + DW Offset HelpContext1_75 + DW Offset HelpContext1_76 + DW Offset HelpContext1_77 + DW Offset HelpContext1_78 + DW Offset HelpContext1_79 + DW Offset HelpContext1_80 + DW Offset HelpContext1_81 + DW Offset HelpContext1_181 + DW Offset NewLine + DW Offset HelpContext1_82 + DW Offset HelpContext1_83 + DW Offset HelpContext1_163 + DW Offset HelpContext1_84 + DW Offset HelpContext1_85 + DW Offset NewLine + DW Offset HelpContext1_86 + DW Offset HelpContext1_127 + DW Offset NewLine + DW Offset HelpContext1_87 + DW Offset HelpContext1_164 + DW Offset HelpContext1_129 + DW Offset HelpContext1_88 + DW Offset HelpContext1_131 + DW Offset HelpContext1_90 + DW Offset HelpContext1_89 + DW Offset HelpContext1_160 + DW Offset HelpContext1_91 + DW Offset HelpContext1_92 + DW Offset HelpContext1_93 + DW Offset NewLine + DW Offset HelpContext1_116 + DW Offset HelpContext1_124 + DW Offset NewLine + DW Offset HelpContext1_130 + DW Offset HelpContext1_117 + DW Offset HelpContext1_161 + DW Offset NewLine + DW Offset HelpContext1_166 + DW Offset HelpContext1_174 + DW Offset HelpContext1_300 + DW Offset NewLine + DW Offset HelpContext1_176 + DW Offset NewLine + DW Offset HelpContext1_118 + DW Offset HelpContext1_119 + DW Offset HelpContext1_120 + DW Offset HelpContext1_121 + DW Offset HelpContext1_122 + DW Offset HelpContext1_123 + DW Offset HelpContext1_128 + DW Offset NewLine + DW Offset HelpContext1_167 + DW Offset NewLine + DW Offset HelpContext1_159 + DW Offset NewLine + DW Offset HelpContext1_94 + DW Offset HelpContext1_95 + DW Offset HelpContext1_96 + DW Offset HelpContext1_97 + DW Offset HelpContext1_98 + DW Offset HelpContext1_165 + DW Offset NewLine + DW Offset HelpContext1_99 + DW Offset NewLine + DW Offset HelpContext1_113 + DW Offset HelpContext1_100 + DW Offset HelpContext1_101 + DW Offset HelpContext1_102 + DW Offset HelpContext1_103 + DW Offset HelpContext1_104 + DW Offset HelpContext1_133 + DW Offset HelpContext1_105 + DW Offset HelpContext1_106 + DW Offset HelpContext1_132 + DW Offset HelpContext1_107 + DW Offset NewLine + DW Offset HelpContext1_108 + DW Offset HelpContext1_109 + DW Offset HelpContext1_110 + DW Offset HelpContext1_111 + DW Offset HelpContext1_173 + DW Offset NewLine + DW Offset HelpContext1_125 + DW Offset HelpContext1_126 + DW Offset NewLine + DW Offset HelpContext1_112 + DW Offset HelpContext1_175 + DW Offset NewLine + DW Offset HelpContext1_147 + DW Offset HelpContext1_148 + DW Offset HelpContext1_149 + DW Offset NewLine + DW Offset HelpContext1_152 + DW Offset HelpContext1_158 + DW Offset NewLine + DW Offset HelpContext1_150 + DW Offset HelpContext1_151 + DW Offset NewLine + DW Offset HelpContext1_172 + DW Offset HelpContext1_177 + DW Offset HelpContext1_178 + DW Offset NewLine + DW Offset Divider + DW Offset NewLine + DW Offset HelpGlobal_0 + DW Offset HelpGlobal_1 + DW Offset HelpGlobal_37 + DW Offset HelpGlobal_3 + DW Offset HelpGlobal_4 + DW Offset HelpGlobal_20 + DW Offset HelpGlobal_9 + DW Offset HelpGlobal_22 + DW Offset HelpGlobal_10 + DW Offset HelpGlobal_19 + DW Offset HelpGlobal_11 + DW Offset HelpGlobal_12 + DW Offset HelpGlobal_33 + DW Offset HelpGlobal_13 + DW Offset HelpGlobal_5 + DW Offset HelpGlobal_23 + DW Offset HelpGlobal_6 + DW Offset HelpGlobal_2 + DW Offset HelpGlobal_7 + DW Offset HelpGlobal_8 + DW Offset HelpGlobal_32 + DW Offset NewLine + DW Offset HelpGlobal_17 + DW Offset HelpGlobal_31 + DW Offset HelpGlobal_18 + DW Offset NewLine + DW Offset HelpGlobal_16 + DW Offset HelpGlobal_34 + DW Offset HelpGlobal_35 + DW Offset HelpGlobal_36 + DW Offset HelpGlobal_21 + DW Offset HelpGlobal_14 + DW Offset HelpGlobal_15 + DW Offset NewLine + DW Offset Divider + + Comment & + + DW Offset NewLine + DW Offset HelpHexTable0 + DW Offset HelpHexTable1 + DW Offset HelpHexTable2 + DW Offset NewLine + DW Offset HelpHexTable3 + DW Offset Divider + DW Offset HelpHexTable4 + DW Offset HelpHexTable5 + DW Offset HelpHexTable6 + DW Offset HelpHexTable7 + DW Offset HelpHexTable8 + DW Offset HelpHexTable9 + DW Offset HelpHexTable10 + DW Offset HelpHexTable11 + DW Offset HelpHexTable12 + DW Offset HelpHexTable13 + DW Offset HelpHexTable14 + DW Offset HelpHexTable15 + DW Offset HelpHexTable16 + DW Offset HelpHexTable17 + DW Offset HelpHexTable18 + DW Offset HelpHexTable19 + DW Offset HelpHexTable20 + DW Offset HelpHexTable21 + DW Offset HelpHexTable22 + DW Offset HelpHexTable23 + DW Offset HelpHexTable24 + DW Offset HelpHexTable25 + DW Offset HelpHexTable26 + DW Offset HelpHexTable27 + DW Offset HelpHexTable28 + DW Offset HelpHexTable29 + DW Offset HelpHexTable30 + DW Offset HelpHexTable31 + DW Offset HelpHexTable32 + DW Offset HelpHexTable33 + DW Offset HelpHexTable34 + DW Offset HelpHexTable35 + DW Offset Divider + + & + DW 0 + +HelpContext1_0 DB 32, 0FFh, 1, 139, 0FFh, 16, 134, 0FFh, 1, 138, 0 +HelpContext1_1 DB 32, 0FFh, 1, 132, ' ', 86h, 'Edit ', 0FFh, 1, 145, 0 +HelpContext1_2 DB 32, 0FFh, 1, 137, 0FFh, 16, 143, 0FFh, 1, 150, 0 +HelpContext1_3 DB 3, 'Summary ', 0BEh, 'Effects.', 0 + +HelpContext1_200 DB 4, 89h, 'Column ', 0BDh, 's.', 0 +HelpContext1_201 DB 5, 'Ax', 8Bh, 8Ah, 87h, 0 +HelpContext1_202 DB 5, 'Bx', 8Bh, 8Ah, 88h, 0 +HelpContext1_203 DB 5, 'Cx ', 89h, 87h, 0 +HelpContext1_204 DB 5, 'Dx ', 89h, 88h, 0 +HelpContext1_205 DB 5, 'Ex ', 0BAh, 88h, 0 +HelpContext1_206 DB 5, 'Fx ', 0BAh, 87h, 0 +HelpContext1_207 DB 5, 'Gx ', 0BCh, 0B1h, 0A5h, 0A0h, 0C4h, 'x', 0 +HelpContext1_208 DB 5, 'Hx V', 0B3h, 0A0h, 0C6h, 'x', 0 + +HelpContext1_299 DB 4, 'General ', 0BDh, 's.', 0 + +HelpContext1_4 DB 5, 'Axx ', 0A6h, 'song ', 0C4h, '(hex)', 0 +HelpContext1_5 DB 5, 'Bxx Jump ', 0B1h, 0B9h, '(hex)', 0 +HelpContext1_6 DB 5, 'Cxx Break ', 0B1h, 'row xx (hex) ', 0BEh, 0B4h, 85h, 0 +HelpContext1_7 DB 5, 'D0x ', 89h, 88h, 0 +HelpContext1_8 DB 5, 'Dx0 ', 89h, 87h, 0 +HelpContext1_9 DB 5, 'DFx', 8Bh, 8Ah, 88h, 0 +HelpContext1_10 DB 5, 'DxF', 8Bh, 8Ah, 87h, 0 +HelpContext1_11 DB 5, 'Exx ', 0BAh, 88h, 'x', 0 +HelpContext1_12 DB 5, 'EFx', 8Bh, 0BBh, 88h, 0 +HelpContext1_13 DB 5, 'EEx Extra fine ', 0BBh, 88h, 0 +HelpContext1_14 DB 5, 'Fxx ', 0BAh, 87h, 'x', 0 +HelpContext1_15 DB 5, 'FFx', 8Bh, 0BBh, 87h, 0 +HelpContext1_16 DB 5, 'FEx Extra fine ', 0BBh, 87h, 0 +HelpContext1_17 DB 5, 'Gxx ', 0BCh, 0B1h, 0A5h, 0A0h, 0C4h, 'xx', 0 +HelpContext1_18 DB 5, 'Hxy V', 0B3h, 0A0h, 0C5h, 0 +HelpContext1_19 DB 5, 'Ixy Tremor ', 0A0h, 'ontime x ', 0A1h, 'offtime y', 0 +HelpContext1_20 DB 5, 'Jxy Arpeggio ', 0A0h, 'halftones x ', 0A1h, 'y', 0 +HelpContext1_21 DB 5, 'Kxx', 9Bh, 'H00 & Dxx', 0 +HelpContext1_22 DB 5, 'Lxx', 9Bh, 'G00 & Dxx', 0 +HelpContext1_23 DB 5, 'Mxx ', 0A6h, 0A4h, 8Ah, 0B1h, 'xx (0->40h)', 0 +HelpContext1_24 DB 5, 'N0x ', 8Dh, 8Ah, 88h, 0 +HelpContext1_141 DB 5, 'Nx0 ', 8Dh, 8Ah, 87h, 0 +HelpContext1_142 DB 5, 'NFx', 8Bh, 0A4h, 8Ah, 88h, 0 +HelpContext1_143 DB 5, 'NxF', 8Bh, 0A4h, 8Ah, 87h, 0 +HelpContext1_25 DB 5, 'Oxx ', 0A6h, 95h, ' offset ', 0B1h, 'yxx00h, y set ', 0A0h, 'SAy', 0 +HelpContext1_26 DB 5, 'P0x ', 0B8h, 0A7h, 0B1h, 'right ', 0B0h, 'x', 0 +HelpContext1_135 DB 5, 'Px0 ', 0B8h, 0A7h, 0B1h, 'left ', 0B0h, 'x', 0 +HelpContext1_136 DB 5, 'PFx', 8Bh, 0B5h, 0A7h, 0B1h, 'right ', 0B0h, 'x', 0 +HelpContext1_137 DB 5, 'PxF', 8Bh, 0B5h, 0A7h, 0B1h, 'left ', 0B0h, 'x', 0 +HelpContext1_27 DB 5, 'Qxy Retrigger ', 0A5h, 'every y ticks ', 0A0h, 8Ah, 'modifier x', 0 +HelpContext1_28 DB 7, 'Values for x:', 0 +HelpContext1_29 DB 9, '0: No ', 8Ah, 0C9h, 0FFh, 8, ' 8: Not used', 0 +HelpContext1_30 DB 9, '1: -1', 0FFh, 23, ' 9: +1', 0 +HelpContext1_31 DB 9, '2: -2', 0FFh, 23, ' A: +2', 0 +HelpContext1_32 DB 9, '3: -4', 0FFh, 23, ' B: +4', 0 +HelpContext1_33 DB 9, '4: -8', 0FFh, 23, ' C: +8', 0 +HelpContext1_34 DB 9, '5: -16', 0FFh, 22, ' D: +16', 0 +HelpContext1_35 DB 9, '6: *2/3', 0FFh, 21, ' E: *3/2', 0 +HelpContext1_36 DB 9, '7: *1/2', 0FFh, 21, ' F: *2', 0 +; HelpContext1_37 DB 9, '8: Not used', 0 +; HelpContext1_38 DB 9, '9: +1', 0 +; HelpContext1_39 DB 9, 'A: +2', 0 +; HelpContext1_40 DB 9, 'B: +4', 0 +; HelpContext1_41 DB 9, 'C: +8', 0 +; HelpContext1_42 DB 9, 'D: +16', 0 +; HelpContext1_43 DB 9, 'E: *3/2', 0 +; HelpContext1_44 DB 9, 'F: *2', 0 +HelpContext1_45 DB 5, 'Rxy Tremelo ', 0A0h, 0C5h, 0 +HelpContext1_46 DB 5, 0FEh, 7, 'S0x ', 0A6h, 'filter', 0 +HelpContext1_47 DB 5, 0FEh, 7, 'S1x ', 0A6h, 'glissando control', 0 +HelpContext1_48 DB 5, 0FEh, 7, 'S2x ', 0A6h, 'finetune', 0 +HelpContext1_49 DB 5, 'S3x ', 0A6h, 'v', 0B3h, 9Ah, 0 +HelpContext1_50 DB 5, 'S4x ', 0A6h, 'tremelo ', 9Ah, 0 +HelpContext1_51 DB 5, 'S5x ', 0A6h, 'panbrello ', 9Ah, 0 +HelpContext1_62 DB 7, 'Waveforms for commands S3x, S4x ', 0A1h, 'S5x:', 0 +HelpContext1_63 DB 9, '0: Sine wave', 0 +HelpContext1_64 DB 9, '1: Ramp down', 0 +HelpContext1_65 DB 9, '2: Square wave', 0 +HelpContext1_66 DB 9, '3: Random wave', 0 +HelpContext1_52 DB 5, 'S6x ', 86h, 'delay for x ticks', 0 +HelpContext1_53 DB 5, 'S70', 0C0h, 0A5h, 'cut', 0 +HelpContext1_144 DB 5, 'S71', 0C0h, 0A5h, 'off', 0 +HelpContext1_145 DB 5, 'S72', 0C0h, 0A5h, 'fade', 0 +HelpContext1_153 DB 5, 'S73', 96h, 0A5h, 'cut', 0 +HelpContext1_154 DB 5, 'S74', 96h, 'continue', 0 +HelpContext1_155 DB 5, 'S75', 96h, 0A5h, 'off', 0 +HelpContext1_156 DB 5, 'S76', 96h, 0A5h, 'fade', 0 +HelpContext1_157 DB 5, 'S77 ', 0ACh, 'off ', 8Ah, 8Ch, 0 +HelpContext1_162 DB 5, 'S78 ', 0ACh, 'on ', 8Ah, 8Ch, 0 +HelpContext1_168 DB 5, 'S79 ', 0ACh, 'off ', 0B5h, 8Ch, 0 +HelpContext1_169 DB 5, 'S7A ', 0ACh, 'on ', 0B5h, 8Ch, 0 +HelpContext1_170 DB 5, 'S7B ', 0ACh, 'off ', 0BBh, 8Ch, 0 +HelpContext1_171 DB 5, 'S7C ', 0ACh, 'on ', 0BBh, 8Ch, 0 +HelpContext1_54 DB 5, 'S8x ', 0A6h, 0B5h, 'position', 0 +HelpContext1_55 DB 5, 'S91 ', 0A6h, 'surround sound', 0 +HelpContext1_56 DB 5, 'SAy ', 0A6h, 'high value ', 0BEh, 95h, ' offset yxx00h', 0 +HelpContext1_57 DB 5, 'SB0 ', 0A6h, 'loopback point', 0 +HelpContext1_146 DB 5, 'SBx Loop x times ', 0B1h, 'loopback point', 0 +HelpContext1_58 DB 5, 'SCx ', 0C3h, 'cut after x ticks', 0 +HelpContext1_59 DB 5, 'SDx ', 0C3h, 'delay for x ticks', 0 +HelpContext1_60 DB 5, 'SEx ', 86h, 'delay for x rows', 0 +HelpContext1_61 DB 5, 'SFx ', 0A6h, 'parameterised MIDI Macro', 0 +HelpContext1_179 DB 5, 'T0x ', 97h, 88h, 0 +HelpContext1_180 DB 5, 'T1x ', 97h, 87h, 0 +HelpContext1_67 DB 5, 'Txx ', 0A6h, 97h, 0B1h, 'xx (20h->0FFh)', 0 +HelpContext1_68 DB 5, 'Uxy', 8Bh, 'v', 0B3h, 0A0h, 0C5h, 0 +HelpContext1_69 DB 5, 'Vxx ', 0A6h, 'g', 0B2h, 8Ah, 0B1h, 'xx (0->80h)', 0 +HelpContext1_70 DB 5, 'W0x G', 0B2h, 8Ah, 88h, 0 +HelpContext1_138 DB 5, 'Wx0 G', 0B2h, 8Ah, 87h, 0 +HelpContext1_139 DB 5, 'WFx', 8Bh, 'g', 0B2h, 8Ah, 88h, 0 +HelpContext1_140 DB 5, 'WxF', 8Bh, 'g', 0B2h, 8Ah, 87h, 0 +HelpContext1_71 DB 5, 'Xxx ', 0A6h, 0B5h, 'position (0->0FFh)', 0 +HelpContext1_72 DB 5, 'Yxy Panbrello ', 0A0h, 0C5h, 0 +HelpContext1_73 DB 5, 'Zxx MIDI Macros', 0 + +HelpContext1_74 DB 3, 86h, 'Edit ', 0ADh, '.', 0 +HelpContext1_114 DB 5, 'Grey +,-', 0FFh, 9, ' ', 0C7h, 85h, 0CDh, 0 +HelpContext1_115 DB 5, 'Shift +,-', 0FFh, 8, ' ', 0C7h, '4 ', 85h, 0CDh, 0 +HelpContext1_134 DB 5, "Ctrl +,-", 0FFh, 9, " ", 0C7h, "order's ", 85h, 0CDh, 0 +HelpContext1_75 DB 5, '0-9', 0FFh, 14, ' ', 0C8h, 'octave/volume/', 8Fh, 0 +HelpContext1_76 DB 5, '0-9, A-F', 0FFh, 9, ' ', 0C8h, 0BDh, 'value', 0 +HelpContext1_77 DB 5, 'A-Z', 0FFh, 14, ' ', 0C8h, 0BDh, 0 +HelpContext1_78 DB 5, '. (Period)', 0FFh, 7, ' Clear field(s)', 0 +HelpContext1_79 DB 5, '1', 0FFh, 16, ' ', 0C3h, 'cut (^^^)', 0 +HelpContext1_80 DB 5, '`', 0FFh, 16, ' ', 0C3h, 'off (', 0FFh, 3, 'Í) / ', 0B8h, 9Dh, 0 + +HelpContext1_81 DB 5, 'Spacebar', 0FFh, 9, ' Use last note/', 8Fh, '/volume/', 0BDh, '/', 0BDh, 'value', 0 +HelpContext1_181 DB 5, 'Caps Lock+Key', 0FFh, 4, ' Preview ', 0A5h, 0 +HelpContext1_82 DB 5, 99h, 0FFh, 11, ' Get default note/', 8Fh, '/volume/', 0BDh, 0 +HelpContext1_83 DB 5, '< or ', 81h, 'Up', 0FFh, 5, ' ', 93h, ' ', 8Fh, 0 +HelpContext1_163 DB 5, '> or ', 81h, 'Down ', 92h, ' ', 8Fh, 0 +HelpContext1_84 DB 5, 'Grey /,*', 0FFh, 9, ' ', 93h, '/', 92h, ' octave', 0 +HelpContext1_85 DB 5, ', (Comma)', 0FFh, 8, ' ', 9Dh, 'edit mask for ', 0A2h, 'field', 0 +HelpContext1_86 DB 5, 0C1h, '/', 0C2h, 0FFh, 10, ' ', 9Eh, 0BFh, 'row to/', 0A9h, 0A2h, 0A3h, 0 +HelpContext1_127 DB 5, 80h, 0C1h, '/', 0C2h, 0FFh, 6, ' ', 9Eh, 'an entire row to/', 0A9h, 85h, 0CDh, 0 +HelpContext1_87 DB 5, 'Up/Down', 0FFh, 10, ' ', 9Ch, 0B7h, 0B0h, 'the skipvalue (set ', 0A0h, 'Alt 0-9)', 0 +HelpContext1_164 DB 5, 81h, 'Home/End', 0FFh, 4, ' ', 9Ch, 0B7h, 0B0h, '1 row', 0 +HelpContext1_129 DB 5, 80h, 'Up/Down', 0FFh, 6, ' ', 0BCh, 85h, 0B7h, 0B0h, '1 row', 0 +HelpContext1_88 DB 5, 'Left/Right', 0FFh, 7, ' ', 9Ch, 'cursor left/right', 0 +HelpContext1_131 DB 5, 80h, 'Left/Right ', 9Ch, 'forwards/backwards one ', 0A3h, 0 +HelpContext1_90 DB 5, 'Tab/', 82h, 'Tab', 0FFh, 4, ' ', 9Ch, 'forwards/backwards ', 0B1h, 0A5h, 'column', 0 +HelpContext1_89 DB 5, 'PgUp/PgDn', 0FFh, 8, ' ', 9Ch, 0B7h, 'n lines (n=Row Hilight Major)', 0 +HelpContext1_160 DB 5, 81h, 'PgUp/PgDn ', 9Ch, 0B1h, 'top/bottom ', 0BEh, 85h, 0 +HelpContext1_91 DB 5, 'Home', 0FFh, 13, ' ', 9Ch, 0B1h, 'start ', 0BEh, 'column/start of line/start of ', 85h, 0 +HelpContext1_92 DB 5, 'End', 0FFh, 14, ' ', 9Ch, 0B1h, 'end ', 0BEh, 'column/end ', 0BEh, 'line/end of', 85h, 0 +HelpContext1_93 DB 5, 'Backspace', 0FFh, 8, ' ', 9Ch, 0B1h, 'previous position (accounts for Multi', 0A3h, ')', 0 +HelpContext1_116 DB 5, 80h, 'N', 0FFh, 12, ' ', 9Dh, 'Multichannel mode for ', 0A2h, 0A3h, 0 +HelpContext1_124 DB 3, '2*', 80h, 'N', 0FFh, 12, ' Multichannel Selection menu', 0 +HelpContext1_130 DB 5, 80h, 99h, 0FFh, 7, ' Store ', 85h, 90h, 0 +HelpContext1_117 DB 5, 80h, 'Backspace', 0FFh, 4, ' Revert ', 85h, 90h, ' ', 0CDh, 0 +HelpContext1_161 DB 5, 81h, 'Backspace Undo - any function ', 0A0h, 0CDh, ' can be undone', 0 + +HelpContext1_166 DB 5, 81h, 'C', 0FFh, 11, ' ', 9Dh, 'centralise cursor', 0 +HelpContext1_174 DB 5, 81h, 'H', 0FFh, 11, ' ', 9Dh, 0A2h, 'row hilight', 0 +HelpContext1_300 DB 5, 81h, 'V', 0FFh, 11, ' ', 9Dh, 'default ', 8Ah, 'display', 0 + +HelpContext1_176 DB 5, 81h, 'F2', 0FFh, 10, ' ', 0A6h, 85h, 'length', 0 + +HelpContext1_118 DB 4, 'Track View Functions.', 0 +HelpContext1_119 DB 5, 80h, "T", 0FFh, 12, " Cycle ", 0A2h, "track's view", 0 +HelpContext1_120 DB 5, 80h, 'R', 0FFh, 12, ' Clear all ', 0CBh, 'views', 0 +HelpContext1_121 DB 5, 80h, 'H', 0FFh, 12, ' ', 9Dh, 0CBh, 'view divisions', 0 +HelpContext1_122 DB 5, 81h, '0', 0FFh, 11, ' Deselect ', 0A2h, 0CBh, 0 +HelpContext1_123 DB 5, 81h, '1 - ', 81h, '5 View ', 0A2h, 0CBh, 'in scheme 1-5', 0 +HelpContext1_128 DB 5, 81h, 'Left/Right ', 9Ch, 'left/right ', 0A8h, 0CBh, 'view columns', 0 + +HelpContext1_167 DB 5, 'L-Ctrl&Shift 1-4 Quick view scheme setup', 0 + +HelpContext1_159 DB 5, 81h, 'T', 0FFh, 11, ' ', 9Dh, 'View-', 8Dh, 'cursor-tracking', 0 + +HelpContext1_94 DB 4, 'Block Functions.', 0 +HelpContext1_95 DB 5, 80h, 'B', 0FFh, 12, ' ', 0CAh, 'beginning ', 0BEh, 0CCh, 0 +HelpContext1_96 DB 5, 80h, 'E', 0FFh, 12, ' ', 0CAh, 'end ', 0BEh, 0CCh, 0 +HelpContext1_97 DB 5, 80h, 'D', 0FFh, 12, ' Quick mark n/2n/4n/... lines (n=Row Hilight Major)', 0 +HelpContext1_98 DB 5, 80h, 'L', 0FFh, 12, ' ', 0CAh, 'entire column/', 85h, 0 +HelpContext1_165 DB 5, 82h, 'Arrows', 0FFh, 5, ' ', 0CAh, 0CCh, 0 + +HelpContext1_99 DB 5, 80h, 'U', 0FFh, 12, ' Unmark block/Release ', 98h, 'memory', 0 + +HelpContext1_113 DB 5, 80h, 'Q', 0FFh, 12, ' Raise notes ', 0B0h, 0BFh, 0AFh, 0CDh, 0 +HelpContext1_100 DB 5, 80h, 'A', 0FFh, 12, ' Lower notes ', 0B0h, 0BFh, 0AFh, 0CDh, 0 +HelpContext1_101 DB 5, 80h, 'S', 0FFh, 12, ' ', 0A6h, 8Eh, 0CDh, 0 +HelpContext1_102 DB 5, 80h, 'V', 0FFh, 12, ' ', 0A6h, 'volume/', 0B5h, 0CDh, 0 +HelpContext1_103 DB 5, 80h, 'W', 0FFh, 12, ' ', 0CEh, 'vol/pan not associated ', 0A0h, 0BFh, 'note/', 8Fh, ' ', 0CDh, 0 +HelpContext1_104 DB 5, 80h, 'K', 0FFh, 12, ' ', 0BCh, 'volume/', 0B5h, 'column ', 0CDh, 0 +HelpContext1_133 DB 3, '2*', 80h, 'K', 0FFh, 12, ' ', 0CEh, 'all volume/', 0B5h, 'controls ', 0CDh, 0 +HelpContext1_105 DB 5, 80h, 'J', 0FFh, 12, ' ', 89h, 'amplifier ', 0CDh, ' / Fast ', 8Ah, 'attenuate ', 0CDh, 0 +HelpContext1_106 DB 5, 80h, 'Z', 0FFh, 12, ' Cut ', 0CCh, 0CDh, 0 +HelpContext1_132 DB 5, 80h, 'X', 0FFh, 12, ' ', 0BCh, 0BDh, ' value ', 0CDh, 0 +HelpContext1_107 DB 3, '2*', 80h, 'X', 0FFh, 12, ' ', 0CEh, 'all ', 0BDh, ' ', 90h, ' ', 0CDh, 0 + +HelpContext1_108 DB 5, 80h, 'C', 0FFh, 12, ' Copy ', 0CCh, 'into ', 98h, 0 +HelpContext1_109 DB 5, 80h, 'P', 0FFh, 12, ' Paste ', 90h, ' ', 0A9h, 98h, 0CDh, 0 +HelpContext1_110 DB 5, 80h, 'O', 0FFh, 12, ' Overwrite ', 0A0h, 90h, ' ', 0A9h, 98h, ' ', 0CDh, 0 +HelpContext1_111 DB 5, 80h, 'M', 0FFh, 12, ' Mix each row ', 0A9h, 98h, 0A0h, 85h, 90h, ' ', 0CDh, 0 +HelpContext1_173 DB 3, '2*', 80h, 'M', 0FFh, 12, ' Mix each field ', 0A9h, 98h, 0A0h, 85h, 90h, 0 + +HelpContext1_125 DB 5, 80h, 'F', 0FFh, 12, ' Double ', 0CCh, 'length ', 0CDh, 0 +HelpContext1_126 DB 5, 80h, 'G', 0FFh, 12, ' Halve ', 0CCh, 'length ', 0CDh, 0 + +HelpContext1_112 DB 5, 80h, 'I', 0FFh, 12, ' Select Template mode / Fast ', 8Ah, 'amplify ', 0CDh, 0 + +HelpContext1_175 DB 5, 81h, 'J', 0FFh, 11, ' ', 9Dh, 'fast ', 8Ah, 'mode', 0 + +HelpContext1_147 DB 3, 'Playback Functions.', 0 +HelpContext1_148 DB 5, '4', 0FFh, 16, ' ', 9Fh, 0A5h, 'under cursor', 0 +HelpContext1_149 DB 5, '8', 0FFh, 16, ' ', 9Fh, 'row', 0 + +HelpContext1_152 DB 5, 81h, 'F6', 0FFh, 10, ' ', 9Fh, 0A9h, 0A2h, 'row', 0 +HelpContext1_158 DB 5, 81h, 'F7', 0FFh, 10, ' Set/Clear playback mark (for use ', 0A0h, 'F7)', 0 + +HelpContext1_150 DB 5, 80h, 'F9', 0FFh, 11, ' ', 9Dh, 0A2h, 0A3h, 0 +HelpContext1_151 DB 5, 80h, 'F10', 0FFh, 10, ' Solo ', 0A2h, 0A3h, 0 + +HelpContext1_172 DB 5, 'Scroll Lock', 0FFh, 6, ' ', 9Dh, 'playback tracing', 0 +HelpContext1_177 DB 5, 81h, 'Z', 0FFh, 11, ' ', 0C8h, 'MIDI playback trigger', 0 +HelpContext1_178 DB 5, 80h, 'Scroll Lock ', 9Dh, 'MIDI input', 0 + +HelpContext2Ptrs Label Word + DW Offset HelpContext2_0 + DW Offset HelpContext2_1 + DW Offset HelpContext2_2 + DW Offset NewLine + DW Offset HelpContext2_3 + DW Offset HelpContext2_10 + DW Offset HelpContext2_4 + DW Offset HelpContext2_5 + DW Offset NewLine + DW Offset HelpContext2_11 + DW Offset HelpContext2_23 + DW Offset HelpContext2_8 + DW Offset HelpContext2_6 + DW Offset HelpContext2_17 + DW Offset HelpContext2_18 + DW Offset HelpContext2_27 + DW Offset HelpContext2_30 + DW Offset HelpContext2_33 + DW Offset HelpContext2_7 + DW Offset HelpContext2_29 + DW Offset HelpContext2_28 + DW Offset HelpContext2_14 + DW Offset HelpContext2_19 + DW Offset HelpContext2_12 + DW Offset HelpContext2_13 + DW Offset HelpContext2_16 + DW Offset HelpContext2_15 + DW Offset HelpContext2_9 + DW Offset NewLine + DW Offset HelpContext2_31 + DW Offset HelpContext2_32 + DW Offset NewLine + DW Offset HelpContext2_26 + DW Offset NewLine + DW Offset HelpContext2_21 + DW Offset HelpContext2_22 + DW Offset HelpContext2_24 + DW Offset HelpContext2_25 + DW Offset NewLine + DW Offset Divider + DW Offset NewLine + DW Offset HelpGlobal_0 + DW Offset HelpGlobal_1 + DW Offset HelpGlobal_37 + DW Offset HelpGlobal_3 + DW Offset HelpGlobal_4 + DW Offset HelpGlobal_20 + DW Offset HelpGlobal_9 + DW Offset HelpGlobal_22 + DW Offset HelpGlobal_10 + DW Offset HelpGlobal_19 + DW Offset HelpGlobal_11 + DW Offset HelpGlobal_12 + DW Offset HelpGlobal_33 + DW Offset HelpGlobal_13 + DW Offset HelpGlobal_5 + DW Offset HelpGlobal_23 + DW Offset HelpGlobal_6 + DW Offset HelpGlobal_2 + DW Offset HelpGlobal_7 + DW Offset HelpGlobal_8 + DW Offset HelpGlobal_32 + DW Offset NewLine + DW Offset HelpGlobal_17 + DW Offset HelpGlobal_31 + DW Offset HelpGlobal_18 + DW Offset NewLine + DW Offset HelpGlobal_16 + DW Offset HelpGlobal_34 + DW Offset HelpGlobal_35 + DW Offset HelpGlobal_36 + DW Offset HelpGlobal_21 + DW Offset HelpGlobal_14 + DW Offset HelpGlobal_15 + DW Offset NewLine + DW Offset Divider + DW 0 ; End of list. + +HelpContext2_0 DB 31, 0FFh, 1, 139, 0FFh, 17, 134, 0FFh, 1, 138, 0 +HelpContext2_1 DB 31, 0FFh, 1, 132, ' ', 94h, 0AAh, ' ', 0FFh, 1, 145, 0 +HelpContext2_2 DB 31, 0FFh, 1, 137, 0FFh, 17, 143, 0FFh, 1, 150, 0 + +HelpContext2_3 DB 3, 94h, 0AAh, 0ADh, '.', 0 +HelpContext2_10 DB 5, 99h, 0FFh, 7, ' Load new ', 95h, 0 +HelpContext2_4 DB 5, 'Tab', 0FFh, 10, ' ', 9Ch, 0A8h, 'options', 0 +HelpContext2_5 DB 5, 'PgUp/PgDn', 0FFh, 4, ' ', 9Ch, 0B7h, '(when not on list)', 0 + +HelpContext2_11 DB 5, 80h, 'A', 0FFh, 8, ' Convert Signed to/', 0A9h, 'Unsigned ', 95h, 's', 0 +HelpContext2_23 DB 5, 80h, 'B', 0FFh, 8, ' Pre-Loop cut ', 95h, 0 +HelpContext2_8 DB 5, 80h, 'C', 0FFh, 8, ' Clear ', 94h, 'Name & Filename (Used in ', 94h, 'Name ', 0B6h, ')', 0 +HelpContext2_6 DB 5, 80h, 'D', 0FFh, 8, ' ', 084h, 94h, 0 +HelpContext2_17 DB 5, 80h, 'E', 0FFh, 8, ' Resize ', 94h, '(', 0A0h, 'interpolation)', 0 +HelpContext2_18 DB 5, 80h, 'F', 0FFh, 8, ' Resize ', 94h, '(without interpolation)', 0 +HelpContext2_27 DB 5, 80h, 'G', 0FFh, 8, ' Reverse ', 94h, 0 +HelpContext2_30 DB 5, 80h, 'H', 0FFh, 8, ' Centralise ', 94h, 0 +HelpContext2_33 DB 5, 80h, 'I', 0FFh, 8, ' Invert ', 94h, 0 +HelpContext2_7 DB 5, 80h, 'L', 0FFh, 8, ' Post-Loop cut ', 95h, 0 +HelpContext2_29 DB 5, 80h, 'M', 0FFh, 8, ' ', 94h, 'amplifier', 0 +HelpContext2_28 DB 5, 80h, 'N', 0FFh, 8, ' ', 9Dh, 'Multi', 0A4h, 'playback', 0 +HelpContext2_14 DB 5, 80h, 'O', 0FFh, 8, ' Save ', 0A2h, 95h, ' ', 0B1h, 'disk (IT Format)', 0 +HelpContext2_19 DB 5, 80h, 'Q', 0FFh, 8, ' ', 9Dh, 95h, ' quality', 0 +HelpContext2_12 DB 5, 80h, 'R', 0FFh, 8, ' Replace ', 0A2h, 95h, ' in song', 0 +HelpContext2_13 DB 5, 80h, 'S', 0FFh, 8, ' Swap ', 95h, ' (in song also)', 0 +HelpContext2_16 DB 5, 80h, 'T', 0FFh, 8, ' Save ', 0A2h, 95h, ' ', 0B1h, 'disk (ST3 Format)', 0 + +IF SAVESAMPLEWAV +HelpContext2_15 DB 5, 80h, 'W', 0FFh, 8, ' Save ', 0A2h, 95h, ' ', 0B1h, 'disk (WAV Format)', 0 +ELSE +HelpContext2_15 DB 5, 80h, 'W', 0FFh, 8, ' Save ', 0A2h, 95h, ' ', 0B1h, 'disk (RAW Format)', 0 +ENDIF + +HelpContext2_9 DB 5, 80h, 'X', 0FFh, 8, ' Ex', 0C9h, 95h, ' (only in ', 94h, 'List)', 0 + +HelpContext2_31 DB 5, 80h, 0C1h, 0FFh, 6, ' ', 83h, 95h, ' ', 91h, 0 +HelpContext2_32 DB 5, 80h, 0C2h, 0FFh, 6, ' Remove ', 95h, ' ', 91h, 0 + +HelpContext2_26 DB 5, '< >', 0FFh, 10, ' ', 93h, '/', 92h, ' playback ', 0A3h, 0 + +HelpContext2_21 DB 5, 80h, 'Grey + ', 92h, 0AEh, 'octave', 0 +HelpContext2_22 DB 5, 80h, 'Grey - ', 93h, 0AEh, 'octave', 0 +HelpContext2_24 DB 5, 81h, 'Grey + ', 92h, 0AEh, 0AFh, 0 +HelpContext2_25 DB 5, 81h, 'Grey - ', 93h, 0AEh, 0AFh, 0 + +HelpContext7Ptrs Label Word + DW Offset HelpContext7_0 + DW Offset HelpContext7_1 + DW Offset HelpContext7_2 + DW Offset NewLine + DW Offset HelpContext7_8 + DW Offset HelpContext7_26 + DW Offset HelpContext7_9 + DW Offset HelpContext7_10 + DW Offset HelpContext7_36 + DW Offset HelpContext7_22 + DW Offset NewLine + DW Offset HelpContext7_25 + DW Offset HelpContext7_24 + DW Offset HelpContext7_23 + DW Offset HelpContext7_28 + DW Offset HelpContext7_11 + DW Offset HelpContext7_12 + DW Offset HelpContext7_13 + DW Offset HelpContext7_14 + DW Offset NewLine + DW Offset HelpContext7_34 + DW Offset HelpContext7_35 + DW Offset NewLine + DW Offset HelpContext7_33 + DW Offset NewLine + DW Offset HelpContext7_3 + DW Offset HelpContext7_4 + DW Offset HelpContext7_5 + DW Offset NewLine + DW Offset HelpContext7_6 + DW Offset HelpContext7_7 + DW Offset HelpContext7_27 + DW Offset HelpContext7_29 + DW Offset HelpContext7_30 + DW Offset NewLine + DW Offset HelpContext7_15 + DW Offset HelpContext7_16 + DW Offset HelpContext7_17 + DW Offset HelpContext7_18 + DW Offset HelpContext7_19 + DW Offset NewLine + DW Offset HelpContext7_20 + DW Offset HelpContext7_21 + DW Offset NewLine + DW Offset Divider + DW Offset NewLine + DW Offset HelpGlobal_0 + DW Offset HelpGlobal_1 + DW Offset HelpGlobal_37 + DW Offset HelpGlobal_3 + DW Offset HelpGlobal_4 + DW Offset HelpGlobal_20 + DW Offset HelpGlobal_9 + DW Offset HelpGlobal_22 + DW Offset HelpGlobal_10 + DW Offset HelpGlobal_19 + DW Offset HelpGlobal_11 + DW Offset HelpGlobal_12 + DW Offset HelpGlobal_33 + DW Offset HelpGlobal_13 + DW Offset HelpGlobal_5 + DW Offset HelpGlobal_23 + DW Offset HelpGlobal_6 + DW Offset HelpGlobal_2 + DW Offset HelpGlobal_7 + DW Offset HelpGlobal_8 + DW Offset HelpGlobal_32 + DW Offset NewLine + DW Offset HelpGlobal_17 + DW Offset HelpGlobal_31 + DW Offset HelpGlobal_18 + DW Offset NewLine + DW Offset HelpGlobal_16 + DW Offset HelpGlobal_34 + DW Offset HelpGlobal_35 + DW Offset HelpGlobal_36 + DW Offset HelpGlobal_21 + DW Offset HelpGlobal_14 + DW Offset HelpGlobal_15 + DW Offset NewLine + DW Offset Divider + + DW 0 ; End of list + +HelpContext7_0 DB 29, 0FFh, 1, 139, 0FFh, 21, 134, 0FFh, 1, 138, 0 +HelpContext7_1 DB 29, 0FFh, 1, 132, ' ', 8Eh, 0AAh, ' ', 0FFh, 1, 145, 0 +HelpContext7_2 DB 29, 0FFh, 1, 137, 0FFh, 21, 143, 0FFh, 1, 150, 0 + +HelpContext7_8 DB 3, 8Eh, 0AAh, 0ADh, ".", 0 +HelpContext7_26 DB 5, 99h, 0FFh, 10, " Load new ", 8Fh, 0 +HelpContext7_9 DB 5, 81h, "PgUp/PgDn ", 9Ch, 8Fh, " ", 0B7h, "(when not on list)", 0 +HelpContext7_10 DB 5, 80h, "C", 0FFh, 11, " Clear ", 8Fh, " name & filename", 0 +HelpContext7_36 DB 5, 80h, "W", 0FFh, 11, ' ', 0CEh, 8Fh, " ", 90h, 0 +HelpContext7_22 DB 5, "Spacebar", 0FFh, 8, " Edit ", 8Fh, " name (ESC ", 0B1h, "exit)", 0 + +HelpContext7_25 DB 5, 80h, 'D', 0FFh, 11, ' ', 084h, 8Fh, ' & all related ', 95h, 's', 0 +HelpContext7_24 DB 5, 80h, 'N', 0FFh, 11, ' ', 9Dh, 'Multi', 0A4h, 'playback', 0 +HelpContext7_23 DB 5, 80h, 'O', 0FFh, 11, ' Save ', 0A2h, 8Fh, ' ', 0B1h, 'disk', 0 +HelpContext7_28 DB 5, 80h, 'P', 0FFh, 11, ' Copy ', 8Fh, 0 +HelpContext7_11 DB 5, 80h, 'R', 0FFh, 11, ' Replace ', 0A2h, 8Fh, ' in song', 0 +HelpContext7_12 DB 5, 80h, 'S', 0FFh, 11, ' Swap ', 08Fh, 's (in song also)', 0 +HelpContext7_13 DB 5, 80h, 'U', 0FFh, 11, ' Update ', 85h, 90h, 0 +HelpContext7_14 DB 5, 80h, 'X', 0FFh, 11, ' Ex', 0C9h, 08Fh, 's (only in ', 08Eh, 'List)', 0 + +HelpContext7_34 DB 5, 80h, 0C1h, 0FFh, 9, ' ', 83h, 8Fh, ' ', 91h, 0 +HelpContext7_35 DB 5, 80h, 0C2h, 0FFh, 9, ' Remove ', 8Fh, ' ', 91h, 0 + +HelpContext7_33 DB 5, '< >', 0FFh, 13, ' ', 93h, '/', 92h, ' playback ', 0A3h, 0 + +HelpContext7_3 DB 3, 0C3h, "Translation.", 0 +HelpContext7_4 DB 5, 99h, 0FFh, 10, " Pickup ", 95h, " number & default play ", 0A5h, 0 +HelpContext7_5 DB 5, "< >", 0FFh, 13, " ", 93h, "/", 92h, " ", 95h, " number", 0 +HelpContext7_6 DB 5, 80h, "A", 0FFh, 11, " ", 0C8h, "all ", 95h, "s", 0 +HelpContext7_7 DB 5, 80h, "N", 0FFh, 11, " ", 99h, 0B4h, 0A5h, 0 +HelpContext7_27 DB 5, 80h, "P", 0FFh, 11, " ", 99h, "previous ", 0A5h, 0 +HelpContext7_29 DB 5, 80h, "Up/Down", 0FFh, 5, " Transpose all notes ", 0BFh, 0AFh, 0B7h, 0 +HelpContext7_30 DB 5, 80h, 0C1h, "/", 0C2h, 0FFh, 5, " ", 9Eh, 0BFh, "row ", 0A9h, "the table", 0 + +HelpContext7_15 DB 3, 'Envelope ', 0ADh, '.', 0 +HelpContext7_16 DB 5, 99h, 0FFh, 10, ' Pick up/Drop ', 0A2h, 'node', 0 +HelpContext7_17 DB 5, 83h, 0FFh, 9, ' Add node', 0 +HelpContext7_18 DB 5, 84h, 0FFh, 9, ' ', 084h, 'node', 0 +HelpContext7_19 DB 5, 80h, 'Arrow ', 0ADh, ' ', 9Ch, 'node (fast)', 0 + +HelpContext7_20 DB 5, 'Press Spacebar ', 9Fh, 'default ', 0A5h, 0 +HelpContext7_21 DB 5, 'Release Space ', 0C3h, 'off command', 0 + +HelpContext9Ptrs Label Word + DW Offset HelpContext9_0 + DW Offset HelpContext9_1 + DW Offset HelpContext9_2 + DW Offset NewLine + DW Offset HelpContext9_3 + DW Offset HelpContext9_4 + DW Offset HelpContext9_11 + DW Offset HelpContext9_5 + DW Offset HelpContext9_6 + DW Offset HelpContext9_7 + DW Offset NewLine + DW Offset HelpContext9_15 + DW Offset HelpContext9_16 + DW Offset NewLine + DW Offset HelpContext9_8 + DW Offset HelpContext9_9 + DW Offset NewLine + DW Offset HelpContext9_10 + DW Offset NewLine + DW Offset HelpContext9_12 + DW Offset HelpContext9_14 + DW Offset NewLine + DW Offset HelpContext9_13 + DW Offset NewLine + DW Offset Divider + DW Offset NewLine + DW Offset HelpGlobal_0 + DW Offset HelpGlobal_1 + DW Offset HelpGlobal_37 + DW Offset HelpGlobal_3 + DW Offset HelpGlobal_4 + DW Offset HelpGlobal_20 + DW Offset HelpGlobal_9 + DW Offset HelpGlobal_22 + DW Offset HelpGlobal_10 + DW Offset HelpGlobal_19 + DW Offset HelpGlobal_11 + DW Offset HelpGlobal_12 + DW Offset HelpGlobal_33 + DW Offset HelpGlobal_13 + DW Offset HelpGlobal_5 + DW Offset HelpGlobal_23 + DW Offset HelpGlobal_6 + DW Offset HelpGlobal_2 + DW Offset HelpGlobal_7 + DW Offset HelpGlobal_8 + DW Offset HelpGlobal_32 + DW Offset NewLine + DW Offset HelpGlobal_17 + DW Offset HelpGlobal_31 + DW Offset HelpGlobal_18 + DW Offset NewLine + DW Offset HelpGlobal_16 + DW Offset HelpGlobal_34 + DW Offset HelpGlobal_35 + DW Offset HelpGlobal_36 + DW Offset HelpGlobal_21 + DW Offset HelpGlobal_14 + DW Offset HelpGlobal_15 + DW Offset NewLine + DW Offset Divider + DW 0 + +HelpContext9_0 DB 33, 0FFh, 1, 139, 0FFh, 13, 134, 0FFh, 1, 138, 0 +HelpContext9_1 DB 33, 0FFh, 1, 132, ' Info Page ', 0FFh, 1, 145, 0 +HelpContext9_2 DB 33, 0FFh, 1, 137, 0FFh, 13, 143, 0FFh, 1, 150, 0 + +HelpContext9_3 DB 3, 83h, 0FFh, 11, ' Add ', 0BFh, 'new ', 0B6h, 0 +HelpContext9_4 DB 3, 84h, 0FFh, 11, ' ', 084h, 0A2h, 0B6h, 0 +HelpContext9_11 DB 3, 'Tab/', 82h, 'Tab', 0FFh, 5, ' ', 9Ch, 0A8h, 0B6h, 's', 0 +HelpContext9_5 DB 3, 'Up/Dn/Left/Right ', 9Ch, 'highlighted ', 0A3h, 0 +HelpContext9_6 DB 3, 'PgUp/PgDn', 0FFh, 9, ' ', 0C8h, 0B6h, ' type', 0 +HelpContext9_7 DB 3, 80h, 'Up/Down', 0FFh, 7, ' ', 9Ch, 0B6h, ' base ', 0B7h, 0 + +HelpContext9_15 DB 3, 'V', 0FFh, 17, ' ', 9Dh, 0A8h, 'volume/velocity bars', 0 +HelpContext9_16 DB 3, 'I', 0FFh, 17, ' ', 9Dh, 0A8h, 95h, '/', 8Fh, ' names', 0 + +HelpContext9_8 DB 3, 'Q', 0FFh, 17, ' Mute/Unmute ', 0A2h, 0A3h, 0 +HelpContext9_9 DB 3, 'S', 0FFh, 17, ' Solo ', 0A2h, 0A3h, 0 + +HelpContext9_10 DB 3, 'Grey +, Grey -', 0FFh, 4, ' ', 9Ch, 'forwards/backwards one ', 85h, 'in song', 0 + +HelpContext9_12 DB 3, 80h, 'S', 0FFh, 13, ' ', 9Dh, 'Stereo playback', 0 +HelpContext9_14 DB 3, 80h, 'R', 0FFh, 13, ' Reverse output ', 0A3h, 's', 0 + +Helpcontext9_13 DB 3, 'G', 0FFh, 17, ' Goto ', 85h, 'currently playing', 0 + +HelpContext12Ptrs Label Word + DW Offset HelpContext12_0 + DW Offset HelpContext12_1 + DW Offset HelpContext12_2 + DW Offset NewLine + DW Offset HelpContext12_3 + DW Offset NewLine + DW Offset HelpContext12_4 + DW Offset HelpContext12_5 + DW Offset HelpContext12_6 + DW Offset NewLine + DW Offset Divider + DW Offset NewLine + DW Offset HelpGlobal_0 + DW Offset HelpGlobal_1 + DW Offset HelpGlobal_37 + DW Offset HelpGlobal_3 + DW Offset HelpGlobal_4 + DW Offset HelpGlobal_20 + DW Offset HelpGlobal_9 + DW Offset HelpGlobal_22 + DW Offset HelpGlobal_10 + DW Offset HelpGlobal_19 + DW Offset HelpGlobal_11 + DW Offset HelpGlobal_12 + DW Offset HelpGlobal_33 + DW Offset HelpGlobal_13 + DW Offset HelpGlobal_5 + DW Offset HelpGlobal_23 + DW Offset HelpGlobal_6 + DW Offset HelpGlobal_2 + DW Offset HelpGlobal_7 + DW Offset HelpGlobal_8 + DW Offset HelpGlobal_32 + DW Offset NewLine + DW Offset HelpGlobal_17 + DW Offset HelpGlobal_31 + DW Offset HelpGlobal_18 + DW Offset NewLine + DW Offset HelpGlobal_16 + DW Offset HelpGlobal_34 + DW Offset HelpGlobal_35 + DW Offset HelpGlobal_36 + DW Offset HelpGlobal_21 + DW Offset HelpGlobal_14 + DW Offset HelpGlobal_15 + DW Offset NewLine + DW Offset Divider + DW 0 + +HelpContext12_0 DB 31, 0FFh, 1, 139, 0FFh, 18, 134, 0FFh, 1, 138, 0 +HelpContext12_1 DB 31, 0FFh, 1, 132, ' Message Editor ', 0FFh, 1, 145, 0 +HelpContext12_2 DB 31, 0FFh, 1, 137, 0FFh, 18, 143, 0FFh, 1, 150, 0 + +HelpContext12_3 DB 3, 99h, '/ ESC', 0FFh, 5, ' Edit message / finished editing', 0 + +HelpContext12_4 DB 3, 'Editing ', 0ADh, '.', 0 +HelpContext12_5 DB 5, 81h, 'Y', 0FFh, 8, ' ', 084h, 'line', 0 +HelpContext12_6 DB 5, 80h, 'C', 0FFh, 9, ' Clear message', 0 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +DecodeWord80h DB "Alt-", 0 +DecodeWord81h DB "Ctrl-", 0 +DecodeWord82h DB "Shift-", 0 +DecodeWord83h DB 0C1h, "ert ", 0 +DecodeWord84h DB 0C2h, "ete ", 0 +DecodeWord85h DB "pattern ", 0 +DecodeWord86h DB "Pattern ", 0 +DecodeWord87h DB 0A7h, "up ", 0B0h, "x", 0 +DecodeWord88h DB 0A7h, "down ", 0B0h, "x", 0 +DecodeWord89h DB "Volume ", 0 +DecodeWord8Ah DB "volume ", 0 +DecodeWord8Bh DB " Fine ", 0 +DecodeWord8Ch DB "envelope", 0 +DecodeWord8Dh DB "Channel ", 0 +DecodeWord8Eh DB 0C1h, "trument ", 0 +DecodeWord8Fh DB "instrument", 0 +DecodeWord90h DB "data", 0 +DecodeWord91h DB "slot (updates ", 85h, 90h, ")", 0 +DecodeWord92h DB "Increase", 0 +DecodeWord93h DB "Decrease", 0 +DecodeWord94h DB "Sample ", 0 +DecodeWord95h DB "sample", 0 +DecodeWord96h DB " ", 0A6h, "NNA ", 0B1h, 0 +DecodeWord97h DB "Tempo ", 0 +DecodeWord98h DB "clipboard ", 0 +DecodeWord99h DB "Enter ", 0 +DecodeWord9Ah DB "waveform ", 0B1h, "type x", 0 +DecodeWord9Bh DB " Dual Command: ", 0 +DecodeWord9Ch DB "Move ", 0 +DecodeWord9Dh DB "Toggle ", 0 +DecodeWord9Eh DB 0C1h, "ert/", 0C2h, "ete ", 0 +DecodeWord9Fh DB "Play ", 0 +DecodeWordA0h DB "with ", 0 +DecodeWordA1h DB "and ", 0 +DecodeWordA2h DB "current ", 0 +DecodeWordA3h DB "channel", 0 +DecodeWordA4h DB 0A3h, ' ', 0 +DecodeWordA5h DB "note ", 0 +DecodeWordA6h DB "Set ", 0 +DecodeWordA7h DB "slide ", 0 +DecodeWordA8h DB "between ", 0 +DecodeWordA9h DB "from ", 0 +DecodeWordAAh DB "List ", 0 +DecodeWordABh DB "Library ", 0 +DecodeWordACh DB "Turn ", 0 +DecodeWordADh DB "Keys", 0 +DecodeWordAEh DB ' C-5 Frequency by 1 ', 0 +DecodeWordAFh DB 'semitone ', 0 +DecodeWordB0h DB "by ", 0 +DecodeWordB1h DB "to ", 0 +DecodeWordB2h DB "lobal ", 0 +DecodeWordB3h DB "ibra", 0B1h, 0 +DecodeWordB4h DB "next ", 0 +DecodeWordB5h DB "panning ", 0 +DecodeWordB6h DB "window", 0 +DecodeWordB7h DB "up/down ", 0 +DecodeWordB8h DB "Panning ", 0 +DecodeWordB9h DB "Order ", 0 +DecodeWordBAh DB "Pitch ", 0 +DecodeWordBBh DB "pitch ", 0 +DecodeWordBCh DB "Slide ", 0 +DecodeWordBDh DB "effect", 0 +DecodeWordBEh DB "of ", 0 +DecodeWordBFh DB "a ", 0 +DecodeWordC0h DB " Past ", 0 +DecodeWordC1h DB "Ins", 0 +DecodeWordC2h DB "Del", 0 +DecodeWordC3h DB "Note ", 0 +DecodeWordC4h DB "speed ", 0 +DecodeWordC5h DB 0C4h, "x, ", 0C6h, "y", 0 +DecodeWordC6h DB "depth ", 0 +DecodeWordC7h DB "Next/Previous ", 0 +DecodeWordC8h DB "Change ", 0 +DecodeWordC9h DB "change ", 0 +DecodeWordCAh DB "Mark ", 0 +DecodeWordCBh DB "track ", 0 +DecodeWordCCh DB "block ", 0 +DecodeWordCDh DB " (*)", 0 +DecodeWordCEh DB "Wipe ", 0 + +; channel, pitch, column, effect, note, current, list, library +; speed/width, turn, on, off, down, instrument +; semitone, octave, block, edit, save, (g)lobal, (v)ibrato, (p)anbrello +; cursor, window + +DecodeBuffer DB 80 Dup (0) +DecodeWords DW Offset DecodeWord80h, Offset DecodeWord81h + DW Offset DecodeWord82h, Offset DecodeWord83h + DW Offset DecodeWord84h, Offset DecodeWord85h + DW Offset DecodeWord86h, Offset DecodeWord87h + DW Offset DecodeWord88h, Offset DecodeWord89h + DW Offset DecodeWord8Ah, Offset DecodeWord8Bh + DW Offset DecodeWord8Ch, Offset DecodeWord8Dh + DW Offset DecodeWord8Eh, Offset DecodeWord8Fh + DW Offset DecodeWord90h, Offset DecodeWord91h + DW Offset DecodeWord92h, Offset DecodeWord93h + DW Offset DecodeWord94h, Offset DecodeWord95h + DW Offset DecodeWord96h, Offset DecodeWord97h + DW Offset DecodeWord98h, Offset DecodeWord99h + DW Offset DecodeWord9Ah, Offset DecodeWord9Bh + DW Offset DecodeWord9Ch, Offset DecodeWord9Dh + DW Offset DecodeWord9Eh, Offset DecodeWord9Fh + DW Offset DecodeWordA0h, Offset DecodeWordA1h + DW Offset DecodeWordA2h, Offset DecodeWordA3h + DW Offset DecodeWordA4h, Offset DecodeWordA5h + DW Offset DecodeWordA6h, Offset DecodeWordA7h + DW Offset DecodeWordA8h, Offset DecodeWordA9h + DW Offset DecodeWordAAh, Offset DecodeWordABh + DW Offset DecodeWordACh, Offset DecodeWordADh + DW Offset DecodeWordAEh, Offset DecodeWordAFh + DW Offset DecodeWordB0h, Offset DecodeWordB1h + DW Offset DecodeWordB2h, Offset DecodeWordB3h + DW Offset DecodeWordB4h, Offset DecodeWordB5h + DW Offset DecodeWordB6h, Offset DecodeWordB7h + DW Offset DecodeWordB8h, Offset DecodeWordB9h + DW Offset DecodeWordBAh, Offset DecodeWordBBh + DW Offset DecodeWordBCh, Offset DecodeWordBDh + DW Offset DecodeWordBEh, Offset DecodeWordBFh + DW Offset DecodeWordC0h, Offset DecodeWordC1h + DW Offset DecodeWordC2h, Offset DecodeWordC3h + DW Offset DecodeWordC4h, Offset DecodeWordC5h + DW Offset DecodeWordC6h, Offset DecodeWordC7h + DW Offset DecodeWordC8h, Offset DecodeWordC9h + DW Offset DecodeWordCAh, Offset DecodeWordCBh + DW Offset DecodeWordCCh, Offset DecodeWordCDh + DW Offset DecodeWordCEh + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Functions ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Proc H_DrawHelp Far + + Push CS + Pop DS + + Push CS + Pop ES + + Assume DS:Help + + Mov CX, 32 + Mov SI, HelpContext + Add SI, SI + Mov SI, [HelpContextPtrs+SI] + Mov DI, 13*160 + + Mov AX, TopLine + Add AX, AX + Add SI, AX + +H_DrawHelp1: + Push SI + Push DI + + Mov SI, [SI] + LodsB + Xor AH, AH + Add AX, AX + Add DI, AX + +; DS:SI points to string. Deposit into buffer + + Push DI + Mov DI, Offset DecodeBuffer + + Mov DX, 1 + +H_DecodeBuffer1: + LodsB + Test AL, AL + JZ H_DecodeBuffer4 + JS H_DecodeBuffer2 + + StosB + Jmp H_DecodeBuffer1 + +H_DecodeBuffer2: + Cmp AL, -2 + JGE H_DecodeBuffer3 + + ; Insert word + Push SI + LEA SI, [EAX*2 + Offset DecodeWords - 100h] + Inc DX + Mov SI, [SI] + Jmp H_DecodeBuffer1 + +H_DecodeBuffer3: + StosB + JE H_DecodeBuffer1 + MovsB + MovsB + Jmp H_DecodeBuffer1 + +H_DecodeBuffer4: + Dec DX + JZ H_DecodeBufferEnd + + Pop SI + Jmp H_DecodeBuffer1 + +H_DecodeBufferEnd: + Xor AL, AL + StosB + Pop DI + + Mov SI, Offset DecodeBuffer + Mov AH, 6 + Call S_DrawString + + Pop DI + Pop SI + LodsW ; Add SI, 2 + Add DI, 160 + Cmp Word Ptr [SI], 0 + LoopNZ H_DrawHelp1 + + Ret + +EndP H_DrawHelp + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc H_Help Far + + Call Glbl_SaveMode + + Mov BX, CS:HelpContext + Add BX, BX + Mov AX, [CS:Positions+BX] + + Mov CS:TopLine, AX + + Mov AX, 5 + Mov CX, Object1 + Mov DX, Offset O1_HelpList + Mov SI, 1 + + Ret + +EndP H_Help + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc H_HelpUp Far + + Sub CS:TopLine, 1 + AdC CS:Topline, 0 + + Mov AX, 1 + Ret + +EndP H_HelpUp + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc H_HelpDown Far + + Push CX + + Push CS + Pop DS + Assume DS:Help + + Mov SI, HelpContext + Add SI, SI + Mov SI, [HelpContextPtrs+SI] + Mov BX, TopLine + Add BX, BX + Add SI, BX + Mov CX, 32 + +H_HelpDown2: + Add SI, 2 + Cmp Word Ptr [SI], 0 + LoopNZ H_HelpDown2 + JZ H_HelpDown1 + + Inc TopLine + +H_HelpDown1: + Pop CX + + Mov AX, 1 + Ret + +EndP H_HelpDown + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc H_HelpPgUp Far + + Mov AX, CS:TopLine + Sub AX, 32 + JNS H_HelpPgUp1 + + Xor AX, AX +H_HelpPgUp1: + Mov CS:TopLine, AX + + Mov AX, 1 + Ret + +EndP H_HelpPgUp + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc H_HelpPgDn Far + + Mov CX, 32 + +H_HelpPgDn1: + Call H_HelpDown + Loop H_HelpPgDn1 + + Ret ; AX = 1, set by H_HelpDown + +EndP H_HelpPgDn + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc H_HelpESC Far + + Mov AX, CS:TopLine + Mov BX, CS:HelpContext + Add BX, BX + + Mov [CS:Positions+BX], AX + + Jmp Glbl_RestoreMode + +EndP H_HelpESC + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc H_SetHelpContext Far + + Mov AX, [SI+2] + Mov CS:HelpContext, AX + + Ret + +EndP H_SetHelpContext + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +EndS + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +End diff --git a/IT_I.ASM b/IT_I.ASM new file mode 100644 index 0000000..a9e4f49 --- /dev/null +++ b/IT_I.ASM @@ -0,0 +1,9023 @@ +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Instrument List module ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Jumps + .386 + +include switch.inc +include network.inc + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Externals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Segment Object1 BYTE Public 'Data' + Extrn SampleFrequency:Word +EndS + +Segment DiskData PARA Public 'Data' +EndS + +Segment Pattern BYTE Public 'Code' + Extrn BaseOctave:Byte + Extrn LastInstrument:Byte +EndS + + Extrn F_Reset5NumInputPos:Far + Extrn Glbl_F4_2:Far + + Extrn Glbl_GetCurrentMode:Far + Extrn S_GetDestination:Far + Extrn S_SaveScreen:Far + Extrn S_RestoreScreen:Far + Extrn S_DrawString:Far + Extrn M_FunctionDivider:Far + Extrn M_Object1List:Far + Extrn M_Object1ListDefault:Far + Extrn Music_GetSongSegment:Far + Extrn Music_ReleaseSample:Far + Extrn Music_ClearSampleName:Far + Extrn Music_PlaySample:Far + Extrn Music_GetInstrumentMode:Far +; Extrn Music_UpdateSampleLocation:Far + + Extrn S_GetGenerationTableOffset:Far + Extrn S_GenerateCharacters:Far + Extrn S_SetDirectMode:Far + Extrn S_DrawBox:Far + Extrn S_DrawSmallBox:Far + + Extrn O1_ConfirmDeleteSample:Far + Extrn O1_ConfirmConvertList:Far + Extrn O1_ConfirmConvert2List:Far + Extrn O1_ConfirmCutSample:Far + Extrn O1_ExchangeSampleList:Far + Extrn O1_ExchangeInstrumentList:Far + Extrn O1_SwapSampleList:Far + Extrn O1_SwapInstrumentList:Far + Extrn O1_ReplaceSampleList:Far + Extrn O1_ReplaceInstrumentList:Far + Extrn O1_ResizeSampleList:Far + Extrn O1_ShowSampleFrequencyList:Far + Extrn O1_FrequencyIndeterminedList:Far + Extrn O1_ConfirmDeleteInstrument:Far + Extrn O1_SampleAmplificationList:Far + Extrn O1_CopyInstrumentList:Far + Extrn O1_SampleCenterList:Far + + Extrn O1_InstrumentListGeneral:Far + Extrn O1_InstrumentListVolume:Far + Extrn O1_InstrumentListPanning:Far + Extrn O1_InstrumentListPitch:Far + Extrn O1_C5FrequencyList:Far + Extrn O1_GetInstrumentAmpList:Far + + Extrn PE_GetLastInstrument:Far + Extrn PE_SwapInstruments:Far + Extrn PE_UpdateInstruments:Far + Extrn PEFunction_OutOfMemoryMessage:Far + Extrn PE_TranslateMIDI:Far, PE_RestoreMIDINote:Far + Extrn PE_InsertInstrument:Far + Extrn PE_DeleteInstrument:Far + + Extrn Music_PlayPattern:Far + Extrn Music_Stop:Far + Extrn Music_PlaySong:Far + Extrn Music_PlayNote:Far + Extrn Music_ToggleChannel:Far + Extrn Music_SoloChannel:Far + Extrn Music_GetSampleLocation:Far + Extrn Music_ClearInstrument:Far + Extrn Music_GetInstrumentMode:Far + Extrn Music_AllocateSample:Far + Extrn Music_GetSlaveChannelInformationTable:Far + Extrn Music_SoundCardLoadAllSamples:Far + Extrn Music_GetNumChannels:Far + + Extrn Music_RegetLoopInformation:Far + + Extrn SetInfoLine:Far + + Extrn MouseAddEvent:Far, AddMouseQueue:Far, MouseClearEvents:Far + Extrn SetKeyboardLock:Far, MouseSetXY:Far + Extrn MouseRemoveEvents:Far, MouseGetStatus:Far + Extrn SetMouseCursorType:Far + + Extrn Fourier_Transform:Far, Fourier_CreateTable:Far + + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Globals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Global I_DrawPitchPanCenter:Far + Global I_PrePitchPanCenter:Far + Global I_PostPitchPanCenter:Far + + Global I_ClearTables:Far + Global I_TagInstrument:Far + Global I_TagSample:Far + + Global I_DrawEnvelope:Far + Global I_PreEnvelope:Far + Global I_PostEnvelope:Far + + Global I_ConvertSample:Far + Global I_DeleteSample:Far + Global I_CutSample:Far + Global I_ClearSampleName:Far + Global I_ExchangeSamples:Far + Global I_ReplaceInstrument:Far + Global I_ToggleSampleQuality:Far + Global I_CenterSample:Far + + Global I_InstrumentListSpace:Far + Global I_InstrumentListNoteOff:Far + Global I_IncreasePlayChannel:Far + Global I_DecreasePlayChannel:Far + Global I_ToggleMultiChannel:Far + + Global I_ScaleInstrumentVolumes:Far + Global I_ScaleSampleVolumes:Far + Global I_CopyInstrument:Far + Global I_DeleteInstrument:Far + Global I_DrawSampleList:Far + Global I_PreSampleList:Far + Global I_PostSampleList:Far + Global I_ShowSampleInfo:Far + Global I_SampleUp:Far + Global I_SampleDown:Far + Global I_CheckLoopValues:Far + Global I_CheckSusLoopValues:Far + Global I_MapEnvelope:Far + Global I_DrawWaveForm:Far + Global I_SampleButtonHandler:Far + + Global I_DrawInstrumentWindow:Far + Global I_PreInstrumentWindow:Far + Global I_PostInstrumentWindow:Far + + Global I_DrawNoteWindow:Far + Global I_PreNoteWindow:Far + Global I_PostNoteWindow:Far + + Global I_AmplifySample:Far + Global I_ExchangeInstruments:Far + Global I_ReverseSample:Far + Global I_SwapSamples:Far + Global I_SwapInstruments:Far + Global I_ReplaceSample:Far + Global I_UpdateInstrument:Far + Global I_ResizeSample:Far + Global I_ResizeSampleNoInt:Far + Global I_InvertSample:Far + + Global I_GetInstrumentOffset:Far + Global I_GetSampleOffset:Far + Global I_CutSampleBeforeLoop:Far + + Global I_CalculateC5Speed:Far + Global I_PrintC5Frequency:Far + + Global I_DoubleSampleSpeed:Far + Global I_HalveSampleSpeed:Far + Global I_SampleSpeedSemiUp:Far + Global I_SampleSpeedSemiDown:Far + + Global I_ShowSamplePlay:Far + Global I_ShowInstrumentPlay:Far + + Global I_PlaySample:Far + Global I_SelectScreen:Far + + Global I_GetInstrumentScreen:Far + Global I_IdleUpdateEnvelope:Far + + Global I_PlayNote:Far + + Global SampleNumberInput:Byte + Global SampleNumber:Byte + + Global MaxNode:Word + Global NewSampleSize:DWord + Global SampleAmplification:Word + + Global InstrumentEdit:Byte + Global NodeHeld:Byte + Global InstrumentScreen:Word + + Global I_GetPresetEnvelopeOffset:Far + + Public UpdateWAVEForm + Public MIDI_PlayNote, MIDI_NoteOff, MIDI_ClearTable + Public MIDI_PlaySample, MIDI_FindChannel, MIDI_AllocateChannel + Public MIDI_GetChannel + + Global InstrumentAmplification + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +Segment Inst WORD Public 'Code' USE16 + Assume CS:Inst, DS:Nothing + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Variables ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +SLAVECHANNELSIZE EQU 128 +HOSTCHANNELSIZE EQU 80 +ENVELOPEGRANULARITY EQU 50 +MAXENVELOPETICK EQU 9999 + +InstrumentAmplification DW 50 +InstrumentScreen DW 0 + +LastPlaySample DB 5*12 +SampleNumber DB 1 ; For instrument-sample + ; editing + +NoteReleased DB 1 +TopInstrument DW 1 +InstrumentPos DW 0 + +SamplePlayTable DB 128 Dup (0) +InstrumentPlayTable DB 128 Dup (0) + +TopNote DW 0 +CurrentNote DW 0 +NotePos DW 0 ; 0->4 + +SampleNumberInput DB 0 + DB 3 Dup(0) + +NewSampleSize DD 0 + +CurrentNode DW 0 ; Volume envelope +MaxNode DW 0 + +AmplitudeCompensate DB 0 + DB 0 ; Filler +CurrentAmplitude DW 0 +CurrentTick DW 0 +LastAmplitude DW 0 +LastTick DW 0 +UpperLimit DW 0 + +NodeHeld DB 0 + DB 0 +WaveLength DW 0 +SearchDirection DW 0 +EndPoint DW 0 + +InstrumentEdit DB 0 +LastKey DW 0 + +Interpolate DB 0 ; For resizing routines +Quality DB 0 +MultiChannel DB 0 + +PlayChannel DW 0 +SampleAmplification DW 0 ; Percentage + +MIDITable DB 128 Dup (0) ; Contains channel of each note + +NoteData DB 0, 0, 0FFh, 0, 0 ; For noteplay in notelist + +PlayNote DB 5*12 + +NotePosTable DB 4, 6, 8, 9 +SamplePos DW 25 + +Resolution DB 0 +UpdateInstrumentScreen DB 1 + +CompleteMsg DB 0FDh, "D% Complete", 0 +TopSample DW 1 +NoSampleMsg DB "No sample", 0 +Quality8Msg DB "8 bits", 0 +Quality16Msg DB "16 bits", 0 +LengthMsg DB 0FDh, 'L', 0 + +EnvelopeSetMsg DB "Envelope copied into slot ", 0FDh, "D", 0 + +EnvelopeMsg DB "Node ", 0FDh, "D/", 0FDh, "D", 13, 13 + DB "Tick ", 0FDh, "D", 13, 13 + DB "Value ", 0FDh, "S", 0 + +PlayChannelMsg DB "Using channel ", 0FDh, "D for playback", 0 + +MultiChannelEnabledMsg DB "Multichannel playback enabled", 0 +MultiChannelDisabledMsg DB "Multichannel playback disabled", 0 + +C5FrequencyText DB "Calculated C5Speed: ", 0FDh, "L", 0 + +LastWaveformValues DW 0 + +EnvelopeHeaderTable Label + DW Offset VolEnv, Offset VolEnvEdit + DW Offset PanEnv, Offset PanEnvEdit + DW Offset PitchEnv, Offset PitchEnvEdit + +VolEnv DB "Volume Envelope", 0 +VolEnvEdit DB "Volume Envelope (Edit)", 0 +PanEnv DB "Panning Envelope", 0 +PanEnvEdit DB "Panning Envelope (Edit)", 0 +PitchEnv DB "Frequency Envelope", 0 +PitchEnvEdit DB "Frequency Envelope (Edit)", 0 + +EnvelopeOffsets Label Word + DW 130h, 182h, 1D4h + +NoteTable DB "C-C#D-D#E-F-F#G-G#A-A#B-" +KeyBoardTable DW 12Ch, 0, 11Fh, 1, 12Dh, 2, 120h, 3, 12Eh, 4 + DW 12Fh, 5, 122h, 6, 130h, 7, 123h, 8, 131h, 9 + DW 124h, 10, 132h, 11, 110h, 12, 103h, 13, 111h, 14 + DW 104h, 15, 112h, 16, 113h, 17, 106h, 18, 114h, 19 + DW 107h, 20, 115h, 21, 108h, 22, 116h, 23, 117h, 24 + DW 10Ah, 25, 118h, 26, 10Bh, 27, 119h, 28, 0FFFFh + +SampleMouseEvent DW 5*8, 13*8, 35*8-1, 48*8-1 +SampleMouseCondition DW 102h, 28, Offset MouseSelectInst, Inst +SampleMouseOffEvent DW 0, 0, 0, 0, 1108h, 28, MouseSelectOff, Inst +NoteMouseEvent DW 32*8, 16*8, 42*8-1, 48*8-1 +NoteMouseCondition DW 102h, 10, Offset MouseSelectNote, Inst +NoteMouseOffEvent DW 0, 0, 0, 0, 1108h, 10, MouseSelectNoteOff, Inst + +ENVELOPELEFT EQU 32 +ENVELOPETOP EQU 18 + +MouseNodeHeld DB 0 + +MouseX DW 0 +MouseY DW 0 +LowerTickLimit DW 0 +UpperTickLimit DW 0 + +EnvelopeEvent1 DW ENVELOPELEFT*8, ENVELOPETOP*8 + DW (ENVELOPELEFT+32)*8-1, (ENVELOPETOP+8)*8-1 + DW 102h, 10, Offset MouseEnvelopeEvent1, Inst +EnvelopeEvent4 DW ENVELOPELEFT*8, ENVELOPETOP*8 + DW (ENVELOPELEFT+32)*8-1, (ENVELOPETOP+8)*8-1 + DW 110h, 10, Offset MouseEnvelopeEvent4, Inst +EnvelopeEvent2 DW 0, 0, 0, 0, 1005h, 10, Offset MouseEnvelopeEvent2, Inst +EnvelopeEvent3 DW 0, 0, 0, 0, 1108h, 10, Offset MouseEnvelopeEvent3, Inst + ; Release + +PresetEnvelopes Label Byte + DB 0, 2, 0, 0, 0, 0, 32, 0, 0, 32, 100, 0, 69 Dup (0) + DB 0, 2, 0, 0, 0, 0, 32, 0, 0, 32, 100, 0, 69 Dup (0) + DB 0, 2, 0, 0, 0, 0, 32, 0, 0, 32, 100, 0, 69 Dup (0) + DB 0, 2, 0, 0, 0, 0, 32, 0, 0, 32, 100, 0, 69 Dup (0) + DB 0, 2, 0, 0, 0, 0, 32, 0, 0, 32, 100, 0, 69 Dup (0) + DB 0, 2, 0, 0, 0, 0, 32, 0, 0, 32, 100, 0, 69 Dup (0) + DB 0, 2, 0, 0, 0, 0, 32, 0, 0, 32, 100, 0, 69 Dup (0) + DB 0, 2, 0, 0, 0, 0, 32, 0, 0, 32, 100, 0, 69 Dup (0) + DB 0, 2, 0, 0, 0, 0, 32, 0, 0, 32, 100, 0, 69 Dup (0) + DB 0, 2, 0, 0, 0, 0, 32, 0, 0, 32, 100, 0, 69 Dup (0) + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +InstrumentScreenTable Label + DW Offset O1_InstrumentListGeneral + DW Offset O1_InstrumentListVolume + DW Offset O1_InstrumentListPanning + DW Offset O1_InstrumentListPitch + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +SampleListKeys Label + DB 0 ; Mouse left button + DW 8010h + DW Offset I_SelectInstrument + + DB 0 ; 0 = CX, 1 = DX, 2 = Alt CX, 3 = Ctrl + DW 1C8h + DW Offset I_SampleUp + + DB 0 + DW 1D0h + DW Offset I_SampleDown + + DB 0 + DW 1C9h + DW Offset I_SamplePgUp + + DB 0 + DW 1D1h + DW Offset I_SamplePgDn + + DB 3 + DW 1C9h + DW Offset I_SampleCtrlPgUp + + DB 3 + DW 1D1h + DW Offset I_SampleCtrlPgDn + + DB 2 + DW 1D2h ; Alt Ins + DW Offset I_InsertSample + + DB 2 + DW 1D3h ; Alt Del + DW Offset I_RemoveSample + + DB 0 + DW 1CBh + DW Offset I_SampleLeft + + DB 0 + DW 1CDh + DW Offset I_SampleRight + + DB 0 + DW 1C7h + DW Offset I_SampleHome + + DB 0 + DW 1CFh + DW Offset I_SampleEnd + + DB 0 + DW 10Fh + DW Offset I_SampleTab + + DB 1 ; Alt... + DW 2E00h ; 'C' + DW Offset I_ClearSampleName + + DB 0FFh + +InstrumentListKeys Label + DB 0 ; Mouse left button + DW 8010h + DW Offset I_SelectInstrument2 + + DB 0 ; 0 = CX, 1 = DX, 2 = Alt CX, 3 = Ctrl + DW 1C8h + DW Offset I_SampleUp + + DB 0 + DW 1D0h + DW Offset I_SampleDown + + DB 0 + DW 1C9h + DW Offset I_SamplePgUp + + DB 0 + DW 1D1h + DW Offset I_SamplePgDn + + DB 2 + DW 1D2h ; Alt Ins + DW Offset I_InsertInstrument + + DB 2 + DW 1D3h ; Alt Del + DW Offset I_RemoveInstrument + + DB 3 + DW 1C9h + DW Offset I_SampleCtrlPgUp + + DB 3 + DW 1D1h + DW Offset I_SampleCtrlPgDn + + DB 0 + DW 1CBh + DW Offset I_InstrumentLeft + + DB 0 + DW 1CDh + DW Offset I_InstrumentRight + + DB 0 + DW 1C7h + DW Offset I_InstrumentHome + + DB 0 + DW 1CFh + DW Offset I_InstrumentEnd + + DB 0 + DW 10Fh + DW Offset I_InstrumentTab + + DB 4 + DW 10Fh + DW Offset I_InstrumentShiftTab + + DB 1 ; Alt + DW 2E00h ; 'C' + DW Offset I_InstrumentNameClear + + DB 1 ; Alt... + DW 1100h ; 'W' + DW Offset I_InstrumentClear + + DB 0FFh + +NoteListKeys Label + DB 0 + DW 8010h + DW Offset I_SelectNoteMouse + + DB 0 ; 0 = CX, 1 = DX, 2 = Alt CX, 3 = Ctrl + DW 1C8h + DW Offset I_NoteUp + + DB 0 + DW 1D0h + DW Offset I_NoteDown + + DB 0 + DW 1C9h + DW Offset I_NotePgUp + + DB 0 + DW 1D1h + DW Offset I_NotePgDn + + DB 0 + DW 1C7h + DW Offset I_NoteHome + + DB 0 + DW 1CFh + DW Offset I_NoteEnd + + DB 0 + DW 1CBh + DW Offset I_NoteLeft + + DB 0 + DW 1CDh + DW Offset I_NoteRight + + DB 0 + DW 10Fh + DW Offset I_NoteTab + + DB 4 + DW 10Fh ; Shift-Tab + DW Offset I_NoteShiftTab + + DB 1 + DW '>' + DW Offset I_NoteSampleIncrease + + DB 1 + DW "'" + DW Offset I_NoteSampleIncrease + + DB 1 + DW '<' + DW Offset I_NoteSampleDecrease + + DB 1 + DW ';' + DW Offset I_NoteSampleDecrease + + DB 1 ; Alt... + DW 1E00h ; 'A' + DW Offset I_NoteAll + + DB 1 ; Alt... + DW 3100h ; 'N' + DW Offset I_NoteNext + + DB 1 ; Alt... + DW 1900h ; 'P' + DW Offset I_NotePrevious + + DB 2 ; Alt up + DW 1C8h + DW Offset I_NoteTransposeUp + + DB 2 ; Alt down + DW 1D0h + DW Offset I_NoteTransposeDown + + DB 2 + DW 1D2h ; Alt Ins + DW Offset I_NoteInsert + + DB 2 + DW 1D3h ; Alt Del + DW Offset I_NoteDelete + + DB 1 + DW ' ' + DW Offset I_NoteSpace + + DB 0 + DW 11Ch ; Enter + DW Offset I_NoteSamplePickup + + DB 0FFh + +VolumeEnvelopeKeys Label + DB 0 + DW 8010h + DW Offset I_MouseEnvelopePress + + DB 0 + DW 8001h + DW Offset I_MouseEnvelopeDrag + + DB 0 + DW 8002h + DW Offset I_MouseEnvelopeReleased + + DB 0 + DW 8003h + DW Offset I_MouseEnvelopeDelete + + DB 0 + DW 10Fh ; Tab + DW Offset I_NoteShiftTab + + DB 4 ; Shifttab + DW 10Fh + DW Offset I_NoteShiftTab + + DB 0 + DW 1CBh + DW Offset I_VolumeEnvelopeLeft + + DB 0 + DW 1CDh + DW Offset I_VolumeEnvelopeRight + + DB 0 ; Enter + DW 11Ch + DW Offset I_VolumeEnvelopeEnter + + DB 0 ; Up arrow + DW 1C8h + DW Offset I_VolumeEnvelopeUp + + DB 0 ; Up arrow + DW 1D0h + DW Offset I_VolumeEnvelopeDown + + DB 0 + DW 1D2h + DW Offset I_VolumeEnvelopeInsert + + DB 0 + DW 1D3h + DW Offset I_VolumeEnvelopeDelete + + DB 0FFh + +VolumeEnvelopeNodeKeys Label + DB 0 + DW 8010h + DW Offset I_MouseEnvelopePress + + DB 0 + DW 8001h + DW Offset I_MouseEnvelopeDrag + + DB 0 + DW 8002h + DW Offset I_MouseEnvelopeReleased + + DB 0 + DW 8003h + DW Offset I_MouseEnvelopeDelete + + DB 0 ; Enter + DW 11Ch + DW Offset I_VolumeEnvelopeEnter + + DB 0 + DW 1C8h ; Up arrow + DW Offset I_VolumeEnvelopeHeldUp + + DB 0 + DW 1D0h ; Down arrow + DW Offset I_VolumeEnvelopeHeldDown + + DB 2 + DW 1C8h + DW Offset I_VolumeEnvelopeHeldPgUp + + DB 2 + DW 1D0h + DW Offset I_VolumeEnvelopeHeldPgDn + + DB 0 + DW 1CBh + DW Offset I_VolumeEnvelopeHeldLeft + + DB 0 + DW 1CDh + DW Offset I_VolumeEnvelopeHeldRight + + DB 0 + DW 10Fh + DW Offset I_VolumeEnvelopeHeldRightFast + + DB 4 + DW 10Fh + DW Offset I_VolumeEnvelopeHeldLeftFast + + DB 2 + DW 1CBh + DW Offset I_VolumeEnvelopeHeldLeftFast + + DB 2 + DW 1CDh + DW Offset I_VolumeEnvelopeHeldRightFast + + DB 0 + DW 1C9h + DW Offset I_VolumeEnvelopeHeldPgUp + + DB 0 + DW 1D1h + DW Offset I_VolumeEnvelopeHeldPgDn + + DB 0 + DW 1C7h + DW Offset I_VolumeEnvelopeHeldHome + + DB 0 + DW 1CFh + DW Offset I_VolumeEnvelopeHeldEnd + + DB 0 + DW 1D2h + DW Offset I_VolumeEnvelopeInsert + + DB 0 + DW 1D3h + DW Offset I_VolumeEnvelopeDelete + + DB 3 + DW 1CBh + DW Offset I_VolumeEnvelopeLeft + + DB 3 + DW 1CDh + DW Offset I_VolumeEnvelopeRight + + DB 0FFh + +PitchPanCenterKeys Label + DB 0 + DW 10Fh ; Tab + DW Offset I_NoteShiftTab + + DB 4 ; Shifttab + DW 10Fh + DW Offset I_NoteShiftTab + + DB 0 + DW 1C8h ; Up arrow + DW Offset I_PitchPanCenterUp + + DB 0 + DW 1D0h ; Down arrow + DW Offset I_PitchPanCenterDown + + DB 1 + DW '+' + DW Offset I_PitchPanCenterSemiUp + + DB 1 + DW '-' + DW Offset I_PitchPanCenterSemiDown + + DB 0 + DW 1CBh + DW Offset I_PitchPanCenterSemiDown + + DB 0 + DW 1CDh + DW Offset I_PitchPanCenterSemiUp + + DB 0FFh + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Functions ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_GetInstrumentScreen Far + + Push CS + Pop ES + Mov DI, Offset InstrumentScreen + + Ret + +EndP I_GetInstrumentScreen + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_GetInstrumentOffset Far + + Call PE_GetLastInstrument + Add BX, BX + Call Music_GetSongSegment + Mov DS, AX + Mov BX, [DS:64712+BX] + + Ret + +EndP I_GetInstrumentOffset + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_GetSampleOffset Far + + Call PE_GetLastInstrument + Add BX, BX + Call Music_GetSongSegment + Mov DS, AX + Mov BX, [DS:64912+BX] + + Ret + +EndP I_GetSampleOffset + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_GetEnvelopeOffset ; Returns DS:SI + + Push AX + Call I_GetInstrumentOffset ; Returns DS:BX + Mov SI, CS:InstrumentScreen + Add SI, SI + Mov SI, [SI+EnvelopeOffsets-2] + Add SI, BX + Pop AX + + Ret + +EndP I_GetEnvelopeOffset + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_SelectScreen Far + + Mov BX, [SI+22] + + Push CS + Pop DS + Assume DS:Inst + + Mov InstrumentScreen, BX + + Mov AX, [ES:DI] + + Add BX, BX + Mov BX, [CS:InstrumentScreenTable+BX] + Mov [ES:BX], AX + + Jmp Glbl_F4_2 + +EndP I_SelectScreen + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MouseSelectOff Far + + Mov Word Ptr [SI-16+8], 102h + Mov CS:SampleMouseCondition, 102h + Mov AX, 1 + + Ret + +EndP MouseSelectOff + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MouseSelectNoteOff Far + + Mov Word Ptr [SI-16+8], 102h + Mov CS:NoteMouseCondition, 102h + Mov AX, 1 + Ret + +EndP MouseSelectNoteOff + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MouseSelectNote Far + + Mov CS:NoteMouseCondition, 1107h + + Push CX + Mov CX, 8010h + Call AddMouseQueue + Pop CX + + Cmp DX, 16*8 + JA MouseSelectNote1 + + Mov DX, 16*8 + +MouseSelectNote1: + Cmp DX, 48*8-1 + JB MouseSelectNote2 + + Mov DX, 48*8-1 + +MouseSelectNote2: + Call MouseSetXY + + Xor AX, AX + Ret + +EndP MouseSelectNote + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MouseSelectInst Far + + Mov CS:MouseX, CX + + Mov CS:SampleMouseCondition, 1107h + + Push CX + + Mov CX, 8010h + ShR DX, 3 + Sub DX, 13 + Call AddMouseQueue + + Pop CX + And DX, DX + JNS MouseSelectInst1 + + Mov DX, 13*8 + Jmp MouseSelectInst2 + +MouseSelectInst1: + Cmp DX, 35 + JB MouseSelectInst3 + + Mov DX, 48*8-1 + +MouseSelectInst2: + Call MouseSetXY + +MouseSelectInst3: + Xor AX, AX + Ret + +EndP MouseSelectInst + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc AddSelectEvent + + Call MouseGetStatus + Test AL, 6 + JNZ AddSelectEvent1 + + Mov Word Ptr [SI+8], 102h + +AddSelectEvent1: + Call MouseAddEvent + + Ret + +EndP AddSelectEvent + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_DrawSampleList Far + + Call S_GetDestination + + Mov AX, Pattern + Mov DS, AX + Assume DS:Pattern + + Mov AL, LastInstrument + + Test AL, AL + JNZ I_DrawSampleList1 + + Inc AX + Mov LastInstrument, AL + +I_DrawSampleList1: + Push CS + Pop DS + Assume DS:Inst + + Mov BX, TopSample + Cmp BL, AL + JBE I_DrawSampleList2 + + Mov BL, AL + +I_DrawSampleList2: ; BL = top, AL = current + Mov CL, BL + Add CL, 34 + Cmp CL, AL + JAE I_DrawSampleList3 + + Mov BL, AL + Sub BL, 34 + +I_DrawSampleList3: + Mov TopSample, BX + ; BX = topinstrument + + Mov DI, (2+13*80)*2 + + Mov DX, 0A23h + +I_DrawSampleList4: + Mov AX, BX + Div DH + ; AH = units, AL = tens + Add AL, '0' + StosB + Mov AL, 20h + StosB + XChg AH, AL + Add AL, '0' + StosW + + Inc BX + Add DI, 156 + Dec DL + JNE I_DrawSampleList4 + + Mov BX, TopSample + + Call Music_GetSongSegment + Mov DS, AX + Assume DS:Nothing + + Mov CX, 35 + Mov DI, (5+13*80)*2 + Dec BX + Add BX, BX + Mov SI, [BX+64912] + +I_DrawSampleList5: + Push CX + Push SI + Push DI + + Add SI, 14h + Mov CX, 25 + Mov AH, 6 + +I_DrawSampleList6: + LodsB + Cmp AL, 226 + JB I_DrawSampleNoMouse + + Mov AL, ' ' + +I_DrawSampleNoMouse: + StosW + Loop I_DrawSampleList6 + + Mov AX, 2A8h + StosW + + Mov AX, 700h+'P' + + Test Byte Ptr [SI-14h-25+12h], 1 + JZ I_DrawSampleList8 + + Mov AH, 6 + +I_DrawSampleList8: + StosW + Mov AL, 'l' + StosW + Mov AL, 'a' + StosW + Mov AL, 'y' + StosW + + Pop DI + Pop SI + Pop CX + Add SI, 80 + Add DI, 160 + + Loop I_DrawSampleList5 + + Mov AX, Pattern + Mov DS, AX + Assume DS:Pattern + + Mov AL, LastInstrument + Xor AH, AH + Sub AX, TopSample + Add AX, 13 + Mov BX, 160 + Mul BX + Add AX, 10 + Mov DI, AX + + Mov CX, 30 + +I_DrawSampleList7: + Mov AX, [ES:DI] + And AH, 0Fh + Or AH, 0E0h + StosW + + Loop I_DrawSampleList7 + + ; Add on pointer... + Push CS + Pop DS + Assume DS:Inst + + Mov SI, Offset SampleMouseEvent + Mov Word Ptr [SI+4], 35*8-1 + Mov Word Ptr [SI+10], 28 + Call AddSelectEvent + Mov SI, Offset SampleMouseOffEvent + Mov Word Ptr [SI+4], 35*8-1 + Call MouseAddEvent + + Ret + +EndP I_DrawSampleList + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_PreSampleList Far + + Call S_GetDestination + Mov AX, Pattern + Mov DS, AX + Assume DS:Pattern + + Mov AL, LastInstrument + Xor AH, AH + Mov SI, AX + Sub AX, TopSample + Add AX, 13 + Mov BX, 160 + Mul BX + Add AX, 10 + Mov DI, AX + + Mov AX, SamplePos + Cmp AX, 25 + JB I_PreSampleList1 + + Call Music_GetSongSegment + Mov DS, AX + Assume DS:Nothing + + Dec SI + Add SI, SI + Mov SI, [SI+64912] + + Mov CX, 4 + Add DI, 52 + Mov AL, 30h + Test Byte Ptr [SI+12h], 1 + JNZ I_PreSampleList2 + + Mov AL, 60h + +I_PreSampleList2: + Inc DI + StosB + + Loop I_PreSampleList2 + + Ret + +I_PreSampleList1: + Add DI, AX + Add DI, AX + + Mov AL, 30h + Inc DI + StosB + Ret + +EndP I_PreSampleList + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_PostSampleList Far + + Push CS + Pop DS + Assume DS:Inst + + Mov SI, Offset SampleListKeys + Call M_FunctionDivider + JC I_PostSampleList7 + + Jmp [SI] + +I_PostSampleList7: + + Mov AX, Pattern + Mov DS, AX + Assume DS:Pattern + + Mov AL, LastInstrument + Xor AH, AH + Mov SI, AX + Dec SI + + Mov AX, SamplePos + Cmp AX, 25 + JAE I_PostSampleList2 + + Mov BX, AX ; BX = Pos. SI = LastInst + Call Music_GetSongSegment + Mov DS, AX + Assume DS:Nothing + + Add SI, SI + Mov SI, [64912+SI] ; SI = sample offset. + + Test CL, CL + JZ I_PostSampleList1 + Cmp DL, 32 ; Space bar or less?? + JB I_PostSampleList1 + + Add BX, 14h ; To sample name. + Add BX, SI + Add SI, 2Ch + +I_PostSampleList3: + Cmp SI, BX + JBE I_PSL3 + + Mov AL, [SI-1] + Mov [SI], AL + Dec SI + Jmp I_PostSampleList3 + +I_PSL3: + Mov [SI], DL + + Inc SamplePos + + Jmp I_PostSampleListEnd + +I_PostSampleList1: + Cmp CX, 10Eh + JNE I_PostSampleList4 + + And BX, BX + JZ I_PostSampleList4 + + Dec SamplePos + Add BX, 14h + Add BX, SI + Add SI, 2Dh + +I_PostSampleList5: + Mov AL, [BX] + Mov [BX-1], AL + Inc BX + Cmp BX, SI + JB I_PostSampleList5 + + Mov Byte Ptr [BX-1], 0 + +I_PostSampleListEnd: + NetworkSendSample + + Mov AX, 1 + Ret + +I_PostSampleList4: + Cmp CX, 1D3h ; Delete... + JNE I_PostSampleList6 + + Add BX, 15h + Add BX, SI + Add SI, 2Dh + Jmp I_PostSampleList5 + +I_PostSampleList6: + Xor AX, AX + Ret + +I_PostSampleList2: ; Play note.... + Push CS + Pop DS + + Test CH, Not 1 + JNZ I_PostSampleList9 + + Cmp CX, LastKey + JE I_PostSampleList9 + + Mov LastKey, CX + + + Mov SI, Offset KeyBoardTable + +I_PostSampleList8: + LodsW + Cmp AX, 0FFFFh + JE I_PostSampleList9 + + Mov BX, AX + LodsW + + Cmp BL, CL + JNE I_PostSampleList8 + ; Note to play... + ; AX = notemod. + And CH, CH + JZ I_PostSampleList10 + + Mov CX, AX + + Mov AX, Pattern + Mov DS, AX + Assume DS:Pattern + + Mov AL, 12 + Mul BaseOctave + Add AL, CL + Mov AH, LastInstrument + + Push CS + Pop DS + Assume DS:Inst + + Call UpdateMultiChannel + + Mov LastPlaySample, AL + + Mov CX, PlayChannel + Call Music_PlaySample + Jmp I_PostSampleList9 + +I_PostSampleList10: + Mov SI, Offset NoteData + Mov Word Ptr [SI], 0FFh + Mov AX, PlayChannel + Mov DH, 32+128 + Call Music_PlayNote ; Note off. + +I_PostSampleList9: + Xor AX, AX + Ret + +EndP I_PostSampleList + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_SampleLeft Far + + Mov AX, SamplePos + Dec AX + JS I_SampleLeft1 + + Mov SamplePos, AX + +I_SampleLeft1: + Mov AX, 1 + Ret + +EndP I_SampleLeft + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_SampleRight Far + + Mov AX, SamplePos + Inc AX + Cmp AX, 25 + JA I_SampleRight1 + + Mov SamplePos, AX + +I_SampleRight1: + Mov AX, 1 + Ret + +EndP I_SampleRight + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_RedrawWave + + Call Glbl_GetCurrentMode + + Cmp AL, 3 + JE I_RedrawWave1 + Cmp AL, 4 + JNE I_RedrawWave2 + + Call I_MapEnvelope + Ret + +I_RedrawWave1: + Call I_DrawWaveForm + +I_RedrawWave2: + Ret + +EndP I_RedrawWave + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_SelectInstrument2 + Assume DS:Inst + + ; Set Instrument pos... + Mov AX, MouseX + ShR AX, 3 + Sub AX, 5 + JNC I_SelectInstrument8 + + Xor AX, AX + +I_SelectInstrument8: + Cmp AX, 24 + JB I_SelectInstrument7 + + Mov AX, 24 + +I_SelectInstrument7: + Mov InstrumentPos, AX + + Add DX, TopInstrument + Jmp I_SelectInstrument4 + +Proc I_SelectInstrument Far + + Mov AX, MouseX + Sub AX, 40 + ShR AX, 3 + Cmp AX, 25 + JB I_SelectInstrument6 + + Mov AX, 25 + +I_SelectInstrument6: + Mov SamplePos, AX + + Add DX, TopSample + +I_SelectInstrument4: + Cmp DX, 1 + JGE I_SelectInstrument1 + + Mov DX, 1 + +I_SelectInstrument1: + Cmp DX, 99 + JL I_SelectInstrument3 + + Mov DX, 99 + +I_SelectInstrument3: + Mov AX, Pattern + Mov DS, AX + Assume DS:Pattern + + Cmp DL, LastInstrument + Mov LastInstrument, DL + JE I_SelectInstrument5 + + Call I_RedrawWave + +I_SelectInstrument5: + Mov AX, 1 + Ret + +EndP I_SelectInstrument + +EndP I_SelectInstrument2 + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_SampleDown Far + + Mov AX, Pattern + Mov DS, AX + Assume DS:Pattern + + Mov AL, LastInstrument + + Inc AX + Cmp AL, 100 + JAE I_SampleDown1 + + Mov LastInstrument, AL + Call I_RedrawWave + +I_SampleDown1: + + Mov AX, 1 + Ret + +EndP I_SampleDown + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_SampleUp Far + + Mov AX, Pattern + Mov DS, AX + Assume DS:Pattern + + Mov AL, LastInstrument + + Dec AL + JZ I_SampleUp1 + + Mov LastInstrument, AL + Call I_RedrawWave + +I_SampleUp1: + Mov AX, 1 + Ret + +EndP I_SampleUp + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_SamplePgUp Far + + Mov AX, Pattern + Mov DS, AX + Assume DS:Pattern + + Mov AL, LastInstrument + + Cmp AL, 1 + JE I_SamplePgUp3 + + Sub AL, 16 + JZ I_SamplePgUp1 + JNC I_SamplePgUp2 + +I_SamplePgUp1: + Mov AL, 1 + +I_SamplePgUp2: + Mov LastInstrument, AL + Call I_RedrawWave + +I_SamplePgUp3: + Mov AX, 1 + Ret + +EndP I_SamplePgUp + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_SamplePgDn Far + + Mov AX, Pattern + Mov DS, AX + Assume DS:Pattern + + Mov AL, LastInstrument + Cmp AL, 99 + JE I_SamplePgDn2 + + Add AL, 16 + Cmp AL, 99 + JBE I_SamplePgDn1 + + Mov AL, 99 + +I_SamplePgDn1: + Mov LastInstrument, AL + Call I_RedrawWave + +I_SamplePgDn2: + Mov AX, 1 + Ret + +EndP I_SamplePgDn + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_SampleCtrlPgUp Far + + Mov AX, Pattern + Mov DS, AX + Assume DS:Pattern + + Mov LastInstrument, 1 + Call I_RedrawWave + + Mov AX, 1 + Ret + +EndP I_SampleCtrlPgUp + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_SampleCtrlPgDn Far + + Mov AX, Pattern + Mov DS, AX + Assume DS:Pattern + + Mov LastInstrument, 99 + Call I_RedrawWave + + Mov AX, 1 + Ret + +EndP I_SampleCtrlPgDn + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_SampleEnd Far + + Mov SamplePos, 25 + + Mov AX, 1 + Ret + +EndP I_SampleEnd + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_SampleHome Far + + Mov SamplePos, 0 + + Mov AX, 1 + Ret + +EndP I_SampleHome + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_SampleTab Far + + Mov Word Ptr [ES:DI], 7 + + Mov AX, 1 + Ret + +EndP I_SampleTab + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_ShowSampleInfo Far + + Call I_GetSampleOffset + + Push DWord Ptr [BX+30h] + + Mov AL, [BX+12h] + + Push CS + Pop DS + Assume DS:Inst + + Mov SI, Offset NoSampleMsg + + Mov AH, 2 + Test AL, 1 + JZ I_ShowSampleInfo1 + + Mov SI, Offset Quality8Msg + Test AL, 2 + JZ I_ShowSampleInfo1 + + Mov SI, Offset Quality16Msg + +I_ShowSampleInfo1: + Mov DI, (64+22*80)*2 + Call S_DrawString + +I_ShowSampleInfo2: + Mov DI, (64+23*80)*2 + Mov SI, Offset LengthMsg + Call S_DrawString + + Pop EAX + + Ret + +EndP I_ShowSampleInfo + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_VibratoButtonSelect Far + + Call I_GetSampleOffset + Mov AL, [BX+04Fh] ; AL = type. + Xor AH, AH + + Add DI, 82 + Xor CX, CX + +I_VibratoButtonSelect1: + Mov SI, [ES:DI] + + Mov CH, AH ; Assume up + Cmp AL, CL + JNE I_VibratoButtonSelect2 + + Inc CH + +I_VibratoButtonSelect2: + Mov [ES:SI+33], CH + +; Add DI, 2 + ScasW + Inc CX + Cmp CL, 3 + JLE I_VibratoButtonSelect1 + + Ret + +EndP I_VibratoButtonSelect + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_SetVibratoWaveform Far ; AH = waveform. + + Mov AX, [SI+24] + Push AX + Call I_GetSampleOffset + Pop AX + + Mov [BX+4Fh], AL + + Ret + +EndP I_SetVibratoWaveform + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_CheckLoopValues Far + + Call I_GetSampleOffset + + Mov EAX, [BX+30h] + Sub EAX, 1 + AdC EAX, 0 + Cmp EAX, [BX+34h] + JA I_CheckLoopValues3 + + Mov [BX+34h], EAX + +I_CheckLoopValues3: + Inc EAX + Cmp EAX, [BX+38h] + JAE I_CheckLoopValues2 + + Mov [BX+38h], EAX + +I_CheckLoopValues2: + Mov EAX, [BX+38h] + Cmp EAX, [BX+34h] + JA I_CheckLoopValues1 + + And Byte Ptr [BX+12h], NOT 00010000b + +I_CheckLoopValues1: + Call Music_RegetLoopInformation + Call I_DrawWaveForm + Ret + +EndP I_CheckLoopValues + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_CheckSusLoopValues Far + + Call I_GetSampleOffset + + Mov EAX, [BX+30h] + Sub EAX, 1 + AdC EAX, 0 + Cmp EAX, [BX+40h] + JA I_CheckSusLoopValues3 + + Mov [BX+40h], EAX + +I_CheckSusLoopValues3: + Inc EAX + Cmp EAX, [BX+44h] + JAE I_CheckSusLoopValues2 + + Mov [BX+44h], EAX + +I_CheckSusLoopValues2: + Mov EAX, [BX+44h] + Cmp EAX, [BX+40h] + JA I_CheckLoopValues1 + + And Byte Ptr [BX+12h], NOT 00100000b + +I_CheckSusLoopValues1: + Call Music_RegetLoopInformation + Call I_DrawWaveForm + Ret + +EndP I_CheckSusLoopValues + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_DrawWaveForm Far + + Mov [CS:LastWaveformValues], 7f80h + + Call S_GetGenerationTableOffset + Push DI + Mov CX, 176*32 + Xor AL, AL + Rep StosB + Pop DI + + Mov AX, Pattern + Mov DS, AX + Assume DS:Pattern + + Mov AL, LastInstrument + And AL, AL + JNZ I_DrawWaveForm1 + + Mov AL, 1 + +I_DrawWaveForm1: + Mov LastInstrument, AL + Xor AH, AH + Xor CX, CX + Call Music_GetSampleLocation + Assume DS:Nothing + + JC I_DrawWaveFormEnd + + SetNZ CS:Resolution + JZ I_DrawWaveForm8Bit + + Add ECX, ECX + Inc SI + +I_DrawWaveForm8Bit: + Test ECX, ECX + JZ I_DrawWaveFormEnd + + Push AX ; AX = instrument num + ; DS:ESI = waveform, ECX = length + ; ES:DI = charactergenerationtable + + Mov EAX, ECX + Mov ECX, 176 + Xor EDX, EDX + Div ECX ; EAX = major shift. EDX = minor shift. + + Mov EBX, EAX + Xor EAX, EAX + Div ECX + + Mov EDX, EAX + Xor EAX, EAX + + Mov EBP, ESI + +I_DrawWaveForm6: + Add EAX, EDX + AdC EBP, EBX + Push EAX + Push EBX + Push ECX + Push EDX + + Mov CL, [SI] + Mov CH, CL + MovZX BX, CS:Resolution + Inc BX + +I_DrawWaveForm10: + Cmp ESI, EBP + JAE I_DrawWaveForm7 + + Mov AL, [SI] + Add SI, BX ; Get max/min vals. + JC I_DrawWaveformNewBlock + +I_DrawWaveformResume: + Cmp AL, CL + JL I_DrawWaveForm8 + + Cmp AL, CH + JLE I_DrawWaveForm10 + + Mov CH, AL + Jmp I_DrawWaveForm10 + +I_DrawWaveformNewBlock: + Add ESI, 10000h + Int 3 + Jmp I_DrawWaveFormResume + +I_DrawWaveForm8: + Mov CL, AL + Jmp I_DrawWaveForm10 + +I_DrawWaveForm7: ; CL = min, CH = max. + Mov AX, CX + + XChg CX, [CS:LastWaveformValues] + + Cmp AL, CH + JL I_DrawWaveform7a + + Mov AL, CH + +I_DrawWaveform7a: + Cmp AH, CL + JG I_DrawWaveform7b + + Mov AH, CL + +I_DrawWaveform7b: + SAR AH, 1 + SAR AL, 1 + Add AX, 202h + SAR AH, 2 + SAR AL, 2 + + Xor CH, CH + Mov CL, AH + Sub CL, AL ; CX = iterations. + Inc CX + + Mov AL, 16 + Sub AL, AH + Cmp AL, 32 + JNE I_DrawWaveForm13 + + Mov AL, 31 + +I_DrawWaveForm13: + Mov AH, 176 + Mul AH + Mov BX, AX + +I_DrawWaveForm11: + Mov Byte Ptr [ES:DI+BX], 1 + Add BX, 176 + Loop I_DrawWaveForm11 + +I_DrawWaveForm12: + Pop EDX + Pop ECX + Pop EBX + Pop EAX + Inc DI + Loop I_DrawWaveForm6 + + ; Get Sample header offset. + Call Music_GetSongSegment + Mov DS, AX + Pop SI + Dec SI + Add SI, SI + Mov SI, [64912+SI] + + Mov EBX, [DS:SI+30h] + Test Byte Ptr [DS:SI+12h], 10h + JZ I_DrawWaveForm14 + + Mov ECX, EBX + ShR ECX, 1 + + Mov EAX, 175 + Mul DWord Ptr [DS:SI+34h] + Add EAX, ECX + AdC EDX, 0 + Div EBX + + Push EAX ; AX = loop start. + + Mov EAX, 175 + Mul DWord Ptr [DS:SI+38h] + Add EAX, ECX + AdC EDX, 0 + Div EBX + Mov EDX, EAX + Pop EAX ; EDX = loop end (0-175) + ; EAX = loop start (0-175) + + Call S_GetGenerationTableOffset + ; ES:DI + Add DI, AX + Sub DX, AX + Dec DX + Mov CX, 32 + Mov AH, 1 + +I_DrawSampleWaveFormLoop1: + Push DI + +; Xor AL, AL +; Test AH, 2 +; JZ I_DrawSampleWaveFormLoop2 +; +; Inc AL +; +;I_DrawSampleWaveFormLoop2: + Mov AL, AH + ShR AL, 1 + And AL, 1 + + StosB + Add DI, DX + StosB + + Pop DI + Add DI, 176 + Inc AH + Loop I_DrawSampleWaveFormLoop1 + +I_DrawWaveForm14: + Test Byte Ptr [DS:SI+12h], 20h + JZ I_DrawWaveFormEnd + + Mov ECX, EBX + ShR ECX, 1 + + Mov EAX, 175 + Mul DWord Ptr [DS:SI+40h] + Add EAX, ECX + AdC EDX, 0 + Div EBX + + Push EAX ; AX = loop start. + + Mov EAX, 175 + Mul DWord Ptr [DS:SI+44h] + Add EAX, ECX + AdC EDX, 0 + Div EBX + Mov EDX, EAX + Pop EAX ; DX = loop end (0-175) + ; AX = loop start (0-175) + + Call S_GetGenerationTableOffset + ; ES:DI + Add DI, AX + Sub DX, AX + Dec DX + Mov CX, 32 + Mov AL, 1 + +I_DrawSampleWaveFormSusLoop1: + Push DI + + StosB + Add DI, DX + StosB + + Pop DI + Add DI, 176 + Xor AL, 1 + Loop I_DrawSampleWaveFormSusLoop1 + +I_DrawWaveFormEnd: + Mov AX, 1 + Mov BX, 22 + Mov CX, 4 + Call S_GenerateCharacters + + Ret + +EndP I_DrawWaveForm + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_DeleteSample Far + + Mov DI, Offset O1_ConfirmDeleteSample + Mov CX, 4 + Call M_Object1List + + And DX, DX + JZ I_DeleteSample1 + + Call Music_Stop + + Mov AX, Pattern + Mov DS, AX + Assume DS:Pattern + + Mov AL, LastInstrument + Dec AX + Xor AH, AH + + Call Music_ReleaseSample + Call Music_ClearSampleName + + Call I_DrawWaveForm + +I_DeleteSample1: + Mov AX, 1 + Ret + +EndP I_DeleteSample + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +C5Speed DD 0 + +Proc I_CalculateC5Speed Far + + Mov AX, 1 + Ret + +Comment ! + Push DiskData + Pop ES + Call Fourier_CreateTable + + Call PE_GetLastInstrument ; Into BX + Mov AX, BX + Inc AX + + Xor CX, CX + Call Music_GetSampleLocation ; Returns DS:ESI, ECX + JC I_CalculateC5SpeedEnd + + PushF + Mov DX, 2048 + Mov DI, 16384 + + Cmp CX, DX + JB I_CalculateC5Speed1 + + Mov CX, DX + +I_CalculateC5Speed1: + Sub DX, CX + PopF + JNZ I_CalculateC5Speed16Bit + +I_CalculateC5Speed8Bit: + LodsB + StosW + Loop I_CalculateC5Speed8Bit + Jmp I_CalculateC5Speed2 + +I_CalculateC5Speed16Bit: + Rep MovsW + +I_CalculateC5Speed2: + Mov CX, DX + Xor AX, AX + Rep StosW + + Push ES + Pop DS + Call Fourier_Transform + +Comment ~ + + Mov DX, 1 + JZ I_CalculateC5BitSkip + + Inc DX + +I_CalculateC5BitSkip: + Mov EBP, ECX ; EBP = number of samples + +I_CalculateC5Speed1: + Sub EBP, 512 + JC I_CalculateC5SpeedDisplay + + Mov DI, 16384 + Mov BX, 512 + +I_CalculateC5Loop1: + Cmp DX, 2 + JE I_CalculateC5Speed16Bit + +I_CalculateC5Speed8Bit: + Mov AL, [SI] + Mov AH, AL + Jmp I_CalculateC5SpeedTransfer + +I_CalculateC5Speed16Bit: + Mov AX, [SI] + +I_CalculateC5SpeedTransfer: +; StosW + Mov CX, 4 + Rep StosW + + Add SI, DX + JC I_CalculateC5UpdateSampleLocation + +I_CalculateC5Continue: + Dec BX + JNZ I_CalculateC5Loop1 + +; OK.. do fourier + Push DS + PushAD + + Call Fourier_Transform + +; Now accumulate + Mov CX, 1024-64 + Mov SI, 24576+64*4 + Mov DI, 32768+64*4 + +I_CalculateC5Speed2: + FLd DWord Ptr [SI] + FAdd DWord Ptr [DI] + FStP DWord Ptr [DI] + Add SI, 4 + Add DI, 4 + Loop I_CalculateC5Speed2 + + PopAD + Pop DS + Jmp I_CalculateC5Speed1 + +I_CalculateC5UpdateSampleLocation: + Add ESI, 10000h + Int 3 + Jmp I_CalculateC5Continue + +I_CalculateC5SpeedDisplay: + Push ES + Pop DS +~ + Mov SI, 24768 + Xor CX, CX + Xor EAX, EAX + Xor EBX, EBX + +I_CalculateC5Speed3: + Cmp EAX, [SI] + JAE I_CalculateC5Speed4 + + Mov BX, CX + Mov EAX, [SI] + +I_CalculateC5Speed4: + Add SI, 4 + Inc CX + + Cmp CX, 1024 + JB I_CalculateC5Speed3 + +; Have BX = wavelength. + Mov EAX, 17145893 ; = C5Freq * 65536 + Mul EBX ; EDX:EAX = frequency in 48:16 format + ShRD EAX, EDX, 16 + + Mov CS:C5Speed, EAX +; EAX = C5Freq + Mov DI, Offset O1_C5FrequencyList + Call M_Object1ListDefault + +I_CalculateC5SpeedEnd: + Mov AX, 1 + Ret +! + +EndP I_CalculateC5Speed + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_PrintC5Frequency Far + + Push CS + Pop DS + Assume DS:Inst + + Push C5Speed + + Mov SI, Offset C5FrequencyText + Mov AH, 20h + Mov DI, (27+27*80)*2 + Call S_DrawString + + Pop AX ; Clean up stack. + Pop BX + + Ret + +EndP I_PrintC5Frequency + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_DeleteInstrument Far + + Mov DI, Offset O1_ConfirmDeleteInstrument + Mov CX, 4 + Call M_Object1List + + And DX, DX + JZ I_DeleteInstrument1 + + Call Music_Stop + + Call I_GetInstrumentOffset ; Gets DS:BX + + Mov CX, 120 + Add BX, 41h + +I_DeleteInstrument2: + Mov AL, [BX] + And AX, 0FFh + JZ I_DeleteInstrument3 + + Push DS + Push BX + Push CX + + Dec AX + + Call Music_ReleaseSample + Call Music_ClearSampleName + + Pop CX + Pop BX + Pop DS + +I_DeleteInstrument3: + Add BX, 2 + Loop I_DeleteInstrument2 + + Call I_InstrumentClear ; This sends network data already + +I_DeleteInstrument1: + Mov AX, 1 + Ret + +EndP I_DeleteInstrument + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_ConvertSample Far ; Signed/Unsigned + + EnsureNoNetwork + + Call PE_GetLastInstrument + Mov CX, BX + Inc CX + Add BX, BX + + Call Music_GetSongSegment + Mov DS, AX + Mov SI, [64912+BX] + Test Byte Ptr [DS:SI+12h], 1 + JZ I_ConvertSample1 + + Push CX + + Mov DI, Offset O1_ConfirmConvertList + Mov CX, 3 + Call M_Object1List + + Pop AX ; AX = sample number + + And DX, DX + JZ I_ConvertSample1 + + Call Music_Stop + + Xor CX, CX + Call Music_GetSampleLocation ; DS:SI = location + JC I_ConvertSample1 ; CX = length. + + SetNZ BL + Xor BH, BH + Add SI, BX + + Inc BX + + +I_ConvertSample2: + Xor Byte Ptr [SI], 80h + Add SI, BX + JC I_ConvertSample3 + +I_ConvertSample4: + LoopD I_ConvertSample2 + + Call I_DrawWaveForm + Call Music_SoundCardLoadAllSamples + +I_ConvertSample1: + Mov AX, 1 + Ret + +I_ConvertSample3: + Add ESI, 10000h + Int 3 + Jmp I_ConvertSample4 + +EndP I_ConvertSample + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_InvertSample Far ; Signed/Unsigned + + EnsureNoNetwork + + Call PE_GetLastInstrument + Mov CX, BX + Inc CX + Add BX, BX + + Call Music_GetSongSegment + Mov DS, AX + Mov SI, [64912+BX] + Test Byte Ptr [DS:SI+12h], 1 + JZ I_InvertSample1 + + XChg AX, CX ; AX = sample number. + + Xor CX, CX + Call Music_GetSampleLocation ; DS:SI = location + JC I_InvertSample1 ; CX = length. + JNZ I_InvertSample_16Bit + +I_InvertSample2: + Neg Byte Ptr [SI] + Add SI, 1 + JC I_InvertSample3 + +I_InvertSample4: + LoopD I_InvertSample2 + +I_InvertSampleExit: + Call I_DrawWaveForm + Call Music_SoundCardLoadAllSamples + +I_InvertSample1: + Mov AX, 1 + Ret + +I_InvertSample3: + Add ESI, 10000h + Int 3 + Jmp I_InvertSample4 + +I_InvertSample_16Bit: + Neg Word Ptr [SI] + Add SI, 2 + JC I_InvertSample_16Bit2 + +I_InvertSample_16Bit1: + LoopD I_InvertSample_16Bit + + Jmp I_InvertSampleExit + +I_InvertSample_16Bit2: + Add ESI, 10000h + Int 3 + Jmp I_InvertSample_16Bit1 + +EndP I_InvertSample + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_CutSampleBeforeLoopUpdateLoop Near + + Sub [DS:BX+DI], EDX + JNC I_CutSampleBeforeLoopUpdateLoop1 + + Mov DWord Ptr [DS:BX+DI], 0 + +I_CutSampleBeforeLoopUpdateLoop1: + Add DI, 4 + Ret + +EndP I_CutSampleBeforeLoopUpdateLoop + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_CutSampleBeforeLoop Far + + EnsureNoNetwork + + Call I_GetSampleOffset + + Cmp DWord Ptr [DS:BX+34h], 0 +; Test Byte Ptr [DS:BX+12h], 10h + JZ I_CutSampleBeforeLoop1 + + Push DS + Push BX + + Mov DI, Offset O1_ConfirmCutSample + Mov CX, 4 + Call M_Object1List + + Pop BX + Pop DS + + And DX, DX + JZ I_CutSampleBeforeLoop1 + + Call Music_Stop + + Mov EDX, [DS:BX+34h] + Test Byte Ptr [DS:BX+12h], 32 + JZ I_CutSampleBeforeLoop2 + + Mov EAX, [DS:BX+40h] + + Cmp EDX, EAX + JB I_CutSampleBeforeLoop2 + Mov EDX, EAX + +I_CutSampleBeforeLoop2: + Mov DI, 34h + Call I_CutSampleBeforeLoopUpdateLoop ; BX+34h - Begin + Call I_CutSampleBeforeLoopUpdateLoop ; BX+38h - End + + Add DI, 4 + Call I_CutSampleBeforeLoopUpdateLoop ; BX+40h - SusLBeg + Call I_CutSampleBeforeLoopUpdateLoop ; BX+44h - SusLEnd + +I_CutSampleBeforeLoop4: + Sub [BX+30h], EDX + Mov ECX, [BX+30h] + + Test Byte Ptr [BX+12h], 2 + JZ I_CutSampleBeforeLoop6 + + Add EDX, EDX + Add ECX, ECX + +I_CutSampleBeforeLoop6: + Mov ESI, EDX + Call I_RepositionSample + + ; To diskdata segment first. + Mov AX, DiskData + Mov ES, AX + Assume ES:Nothing + + Xor EDI, EDI + +I_CutSampleBeforeLoop7: + Mov AL, [SI] + Mov [ES:DI], AL + + Add SI, 1 + JC I_CutSampleBeforeLoop8 + +I_CutSampleBeforeLoop9: + Add DI, 1 + JC I_CutSampleBeforeLoop10 + +I_CutSampleBeforeLoop11: + LoopD I_CutSampleBeforeLoop7 + + Mov ESI, EDI + Int 3 + Mov CX, DI + + Push DS + Push ES + Pop DS + Pop ES ; Swap DS and ES + + Xor SI, SI + Xor DI, DI + Rep MovsB + + Call I_DrawWaveForm + Call Music_SoundCardLoadAllSamples + +I_CutSampleBeforeLoop1: + Mov AX, 1 + Ret + +I_CutSampleBeforeLoop8: + Add ESI, 10000h + Int 3 + Jmp I_CutSampleBeforeLoop9 + +I_CutSampleBeforeLoop10: + PushAD + Push DS + Push ES + + Mov ESI, EDI + Int 3 + + Push DS + Push ES + Pop DS + Pop ES ; Swap DS and ES + + Mov CX, 16384 + Xor SI, SI + Xor DI, DI + Rep MovsD + + Pop ES + Pop DS + PopAD + + Add EDI, 10000h + + Int 3 + Jmp I_CutSampleBeforeLoop11 + +EndP I_CutSampleBeforeLoop + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_CutSample Far + + EnsureNoNetwork + + Call I_GetSampleOffset + + Cmp DWord Ptr [DS:BX+38h], 0 +; Test Byte Ptr [DS:BX+12h], 10h ; Loop? + JZ I_CutSample1 + + Push DS + Push BX + + Mov DI, Offset O1_ConfirmCutSample + Mov CX, 4 + Call M_Object1List + + Pop BX + Pop DS + + And DX, DX + JZ I_CutSample1 + + Call Music_Stop + + Mov EAX, [DS:BX+38h] + Mov EDX, [DS:BX+44h] + Cmp EAX, EDX + JAE I_CutSample2 + Mov EAX, EDX + +I_CutSample2: + Mov [DS:BX+30h], EAX + + Call I_DrawWaveForm + Call Music_SoundCardLoadAllSamples + +I_CutSample1: + Mov AX, 1 + Ret + +Proc I_CutSampleCheckValue Near + + Cmp DWord Ptr [DS:BX+DI], EAX + JBE I_CutSampleCheckValue1 + + Mov [DS:BX+DI], EAX + +I_CutSampleCheckValue1: + Ret + +EndP I_CutSampleCheckValue + +EndP I_CutSample + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_ClearSampleName Far + Assume DS:Inst + + Mov SamplePos, 0 + +I_ClearSampleName2: + Call I_GetSampleOffset + + Push DS + Pop ES + + Mov DI, BX + +I_ClearSampleName3: + Add DI, 4 + + Mov CX, 6 + Xor AX, AX + Rep StosW + + Add DI, 4 + Mov CX, 13 + Rep StosW + + NetworkSendSample + + Inc AX + Ret + +EndP I_ClearSampleName + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_InsertSample Far + + EnsureNoNetwork + + Call Music_GetSongSegment + Mov DS, AX + Mov SI, [DS:64912+(99-1)*2] + Test Byte Ptr [SI+12h], 1 + JNZ I_InsertSampleEnd + + Call PE_GetLastInstrument + Cmp BL, 98 + JE I_InsertSampleEnd + + Call Music_Stop + + Call PE_GetLastInstrument + Mov DL, BL + Push BX + + Call Music_GetSongSegment + + Mov ES, AX + Mov DS, AX + + Mov AX, 98 + Sub AX, BX + Mov CX, 80 + Add BX, BX + Mul CX + Mov SI, [DS:64912+BX] + Add SI, AX + Dec SI + LEA DI, [SI+80] + Mov CX, AX + + StD + Rep MovsB + ClD + + Mov DWord Ptr [SI+1+48h], 0 + Mov Byte Ptr [SI+1+12h], 0 + + Call Music_SoundCardLoadAllSamples + + Pop AX + Push AX + Call Music_ClearSampleName + + Pop DX + Inc DX ; DL = instrument + + Call Music_GetInstrumentMode + JZ I_InsertSampleSampleMode + ; Instrument mode.. + ; step through inst. + + Xor EAX, EAX + +I_InsertSample4: + Mov SI, [DS:64712+EAX*2] + Add SI, 41h + + Mov CX, 120 + +I_InsertSample5: + Cmp [SI], DL + JB I_InsertSample6 + + Cmp Byte Ptr [SI], 99 + JAE I_InsertSample6 + + Inc Byte Ptr [SI] + +I_InsertSample6: + Add SI, 2 + Loop I_InsertSample5 + + Inc AX + Cmp AX, 99 + JB I_InsertSample4 + + Jmp I_InsertSampleFinished + +I_InsertSampleSampleMode: + Call PE_InsertInstrument + +I_InsertSampleFinished: + Call I_DrawWaveform + +I_InsertSampleEnd: + Mov AX, 1 + Ret + +EndP I_InsertSample + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_RemoveSample Far + + EnsureNoNetwork + + Call I_GetSampleOffset + Test Byte Ptr [BX+12h], 1 + JNZ I_RemoveSampleEnd + + Call Music_Stop + + Call PE_GetLastInstrument + Mov DL, BL + Push BX + + Call Music_GetSongSegment + + Mov ES, AX + Mov DS, AX + + Mov AX, 98 + Sub AX, BX + Mov CX, 80 + Add BX, BX + Mul CX + Mov DI, [DS:64912+BX] + LEA SI, [DI+80] + Mov CX, AX + + Rep MovsB + + Pop DX + Inc DX ; DL = instrument + + Push DS + Push DI + + Mov DWord Ptr [DI+48h], 0 + Mov Byte Ptr [DI+12h], 0 + + Call Music_SoundCardLoadAllSamples + + Call Music_GetInstrumentMode + JZ I_RemoveSampleSampleMode + ; Instrument mode.. + ; step through inst. + + Xor EAX, EAX + +I_RemoveSample4: + Mov SI, [DS:64712+EAX*2] + Add SI, 41h + + Mov CX, 120 + +I_RemoveSample5: + Cmp [SI], DL + JB I_RemoveSample6 + + Dec Byte Ptr [SI] + +I_RemoveSample6: + Add SI, 2 + Loop I_RemoveSample5 + + Inc AX + Cmp AX, 99 + JB I_RemoveSample4 + + Jmp I_RemoveSampleFinished + +I_RemoveSampleSampleMode: + Call PE_DeleteInstrument + +I_RemoveSampleFinished: + Call I_DrawWaveform + + Pop DI + Pop ES + Jmp I_ClearSampleName3 + +I_RemoveSampleEnd: + Mov AX, 1 + Ret + +EndP I_RemoveSample + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_InsertInstrument Far + + EnsureNoNetwork + + Call PE_GetLastInstrument + Cmp BL, 98 + JE I_InsertInstrumentEnd + + Call Music_Stop + + Call PE_GetLastInstrument + Mov DL, BL + Push BX + + Call Music_GetSongSegment + + Mov ES, AX + Mov DS, AX + + Mov AX, 98 + Sub AX, BX + Mov CX, 554 + Add BX, BX + Mul CX + Mov SI, [DS:64712+BX] + Add SI, AX + Dec SI + LEA DI, [SI+554] + Mov CX, AX + + StD + Rep MovsB + ClD + + Pop DX + Inc DX ; DL = instrument + + Call Music_GetInstrumentMode + JZ I_InsertInstrumentFinished + + Call PE_InsertInstrument + +I_InsertInstrumentFinished: + Jmp I_InstrumentClear ; Sends network data + +I_InsertInstrumentEnd: + Mov AX, 1 + Ret + +EndP I_InsertInstrument + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_RemoveInstrument Far + + EnsureNoNetwork + + Call Music_Stop + + Call PE_GetLastInstrument + Mov DL, BL + Push BX + + Call Music_GetSongSegment + + Mov ES, AX + Mov DS, AX + + Mov AX, 98 + Sub AX, BX + Mov CX, 554 + Add BX, BX + Mul CX + MOv DI, [DS:64712+BX] + LEA SI, [DI+554] + Mov CX, AX + + Rep MovsB + + Pop DX + Inc DX ; DL = instrument + + Call Music_GetInstrumentMode + JZ I_RemoveInstrumentFinished + + Call PE_DeleteInstrument + +I_RemoveInstrumentFinished: + Mov AX, 98 + Call Music_ClearInstrument + + Call I_MapEnvelope + +I_RemoveInstrumentEnd: + Mov AX, 1 + Ret + +EndP I_RemoveInstrument + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetSampleNumber ; Carry if not a num. + ; DX otherwise, + Push CS + Pop DS + + Mov SI, Offset SampleNumberInput + Xor DX, DX + +GetSampleNumber1: + LodsB + And AL, AL + JZ GetSampleNumber2 + + Cmp AL, '0' + JB GetSampleNumber3 + Cmp AL, '9' + JA GetSampleNumber3 + + Sub AL, '0' + XChg DL, AL + Mov AH, 10 + Mul AH + Add DL, AL + + Jmp GetSampleNumber1 + +GetSampleNumber3: + StC + Ret + +GetSampleNumber2: + Test DX, DX + JZ GetSampleNumber3 + +; ClC + Ret + +EndP GetSampleNumber + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetNumberInput ; DI = Offset of list. + ; Returns DX with sample number. + + Push DI + + Mov DI, Offset SampleNumberInput + Push CS + Pop ES + Xor AL, AL + Mov CX, 4 + Rep StosB + + Pop DI + + Call S_SaveScreen + + Mov CX, 3 + Call M_Object1List + + Call S_RestoreScreen + + And DX, DX + JZ GetNumberInput1 + + Call Music_Stop + + Call GetSampleNumber + JC GetNumberInput1 + + Ret + +GetNumberInput1: + Pop AX ; Add SP, 2 + Mov AX, 1 + RetF + +EndP GetNumberInput + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_ExchangeSamples Far + + ; Clear input... + + EnsureNoNetwork + + Mov DI, Offset O1_ExchangeSampleList + Call GetNumberInput + + Mov SI, DX + Dec SI + Add SI, SI + + Call PE_GetLastInstrument + Add BX, BX + + Cmp BX, SI + JE I_ExchangeSamples1 + + Call Music_GetSongSegment + Mov ES, AX + Mov DS, AX + Mov DI, [DS:64912+BX] + Mov SI, [DS:64912+SI] ; DS:SI, ES:DI point to + ; sample headers + + Mov CX, 80 + +I_ExchangeSamples2: + Mov AL, [ES:DI] + MovsB + Mov [DS:SI-1], AL + + Loop I_ExchangeSamples2 + + Call I_DrawWaveForm + Call Music_SoundCardLoadAllSamples + +I_ExchangeSamples1: + Mov AX, 1 + Ret + +EndP I_ExchangeSamples + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_SwapSamples Far + + ; Clear input... + + EnsureNoNetwork + + Mov DI, Offset O1_SwapSampleList + Call GetNumberInput + + Mov SI, DX + Dec SI + Add SI, SI + + Call PE_GetLastInstrument + Mov DH, BL + Inc DH ; DH/DL = samples to swap + Add BX, BX + + Cmp DL, DH + JE I_SwapSamples1 + + Call Music_GetSongSegment + Mov ES, AX + Mov DS, AX + Mov DI, [DS:64912+BX] + Mov SI, [DS:64912+SI] ; DS:SI, ES:DI point to + ; sample headers + + Mov CX, 80 + +I_SwapSamples2: + Mov AL, [ES:DI] ; Swapping headers. + MovsB + Mov [DS:SI-1], AL + + Loop I_SwapSamples2 + + ; Now to swap pattern + ; stuff... + Call Music_GetInstrumentMode + JZ I_SwapSamples3 + ; Instrument mode.. + ; step through inst. + Xor AX, AX + +I_SwapSamples4: + Push AX + + Mov BX, AX + Add BX, BX + Mov SI, [DS:64712+BX] + Add SI, 41h + + Mov CX, 120 + +I_SwapSamples5: + Mov AL, [SI] + Cmp AL, DL + JNE I_SwapSamples6 + + Mov [SI], DH + Jmp I_SwapSamples7 + +I_SwapSamples6: + Cmp AL, DH + JNE I_SwapSamples7 + + Mov [SI], DL + +I_SwapSamples7: + Add SI, 2 + Loop I_SwapSamples5 + + Pop AX + + Inc AX + Cmp AX, 99 + JB I_SwapSamples4 + + Jmp I_SwapSamples8 + +I_SwapSamples3: ; Sample mode.. + Call PE_SwapInstruments + +I_SwapSamples8: + Call I_DrawWaveForm + Call Music_SoundCardLoadAllSamples + +I_SwapSamples1: + Mov AX, 1 + Ret + +EndP I_SwapSamples + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_ReplaceSample Far + + EnsureNoNetwork + + Mov DI, Offset O1_ReplaceSampleList + Call GetNumberInput + + Call PE_GetLastInstrument + Mov DH, BL + Inc DH ; DH/DL = samples to swap + + Cmp DL, DH + JE I_ReplaceSample1 + + Call Music_GetSongSegment + Mov ES, AX + Mov DS, AX + ; Now to swap pattern + ; stuff... + Call Music_GetInstrumentMode + JZ I_ReplaceSample3 + ; Instrument mode.. + ; step through inst. + Xor AX, AX + +I_ReplaceSample4: + Push AX + + Mov BX, AX + Add BX, BX + Mov SI, [DS:64712+BX] + Add SI, 41h + + Mov CX, 120 + +I_ReplaceSample5: + Mov AL, [SI] + + Cmp AL, DH + JNE I_ReplaceSample7 + + Mov [SI], DL + +I_ReplaceSample7: + Add SI, 2 + Loop I_ReplaceSample5 + + Pop AX + + Inc AX + Cmp AX, 99 + JBE I_ReplaceSample4 + + Mov AX, 1 + Ret + +I_ReplaceSample3: ; Sample mode.. + XChg DH, DL + Or DH, 80h + Call PE_SwapInstruments + +I_ReplaceSample1: + Mov AX, 1 + Ret + +EndP I_ReplaceSample + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_ReMix + Assume DS:Nothing + + EnsureNoNetwork + + Call Music_Stop + ; OK... + Call I_GetSampleOffset + Mov EDX, CS:NewSampleSize + Mov AX, 99 + + Test Byte Ptr [BX+12h], 2 + JZ I_ReMix1 + + Add EDX, EDX + +I_ReMix1: + ; Limit size of EDX... + Cmp EDX, 4177920 + JBE I_ReMixLimitMaxSize + + Mov EDX, 4177920 + Mov CS:NewSampleSize, EDX + + Test Byte Ptr [BX+12h], 2 + JZ I_ReMixLimitMaxSize + + ShR CS:NewSampleSize, 1 + +I_ReMixLimitMaxSize: + Call Music_AllocateSample ; Returns ES:DI + Mov AX, ES + And AX, AX + JNZ I_ReMixEnoughMem + + Call PEFunction_OutOfMemoryMessage + +I_ReMixNoMix: + Ret + +I_ReMixEnoughMem: + Mov AX, DiskData + Mov ES, AX + Assume ES:Nothing + + Call PE_GetLastInstrument ; Into BX + Mov AX, BX + Inc AX + + Xor CX, CX + Call Music_GetSampleLocation ; Returns DS:ESI, ECX + JNZ I_ReMix16Bit + +I_ReMix8Bit: + Mov EAX, ECX + Xor EDX, EDX + Div CS:NewSampleSize + + Mov BP, AX + ShR EAX, 16 + JNZ I_ReMixNoMix + + Xor EAX, EAX ; BP:AX = skip value... + Div CS:NewSampleSize + + ShR EAX, 16 + Mov BX, AX + + ; BP:BX = skip value. + Xor ESI, ESI ; DS:ESI = source + Xor EDI, EDI ; Go from the start! + Xor CX, CX ; CX = error. + ; ES:EDI = destination + +I_ReMix8Bit2: + Cmp CS:Interpolate, 0 + JNE I_ReMix8BitInterpolate + + Mov AL, [SI] + Jmp I_ReMix8BitStore + +I_ReMix8BitInterpolate: + MovSX AX, Byte Ptr [SI] + Mov DX, 100h + Sub DL, CH + SbB DH, 0 + IMul DX ; AX = [SI]*(1-Remainder)*256 + + Push AX + + Add SI, 1 + JNC I_ReMix8BitInterpolate2 + + Add ESI, 10000h + Int 3 + +I_ReMix8BitInterpolate2: + MovSX AX, Byte Ptr [SI] + Mov DL, CH + Xor DH, DH + Mul DX + + Pop DX ; DX = Old AX = [SI]*(1-Remainder)*256 + Add AX, DX + Add AX, 80h ; Rounding. + Mov AL, AH + + Sub ESI, 1 + +I_ReMix8BitStore: + Mov [ES:DI], AL + + Add CX, BX + AdC SI, BP + JC I_ReMix8Bit3 + +I_ReMix8Bit4: + Add DI, 1 + JC I_ReMix8Bit5 + +I_ReMix8Bit6: + Cmp EDI, CS:NewSampleSize + JB I_ReMix8Bit2 + + Jmp I_ReMixCleanUp + +I_ReMix8Bit3: + Add ESI, 10000h + Int 3 + Jmp I_Remix8Bit4 + +I_ReMix8Bit5: + PushAD + Push DS + Push ES + + Mov AX, 100 + Xor CX, CX + Call Music_GetSampleLocation + Mov ESI, EDI + Int 3 + + Push DS + Push ES + Pop DS + Pop ES + + Mov CX, 16384 + Xor SI, SI + Xor DI, DI + Rep MovsD + + Pop ES + Pop DS + PopAD + + Add EDI, 10000h + + Call I_RepositionSample + Jmp I_ReMix8Bit6 + +I_ReMix16Bit: + Mov EAX, ECX + Xor EDX, EDX + Div CS:NewSampleSize + + Mov BP, AX + Add BP, BP + ShR EAX, 15 + JNZ I_ReMixNoMix + + Xor EAX, EAX ; BP:AX = skip value... + Div CS:NewSampleSize + + ShR EAX, 16 + Mov BX, AX + + ; BP:BX = skip value. + Xor ESI, ESI ; DS:ESI = source + Xor EDI, EDI ; Go from the start! + Xor CX, CX ; CX = error. + ; ES:EDI = destination + +I_ReMix16Bit2: + Cmp CS:Interpolate, 0 + JNE I_ReMix16BitInterpolate + + Mov AX, [SI] + Jmp I_ReMix16BitStore + +I_ReMix16BitInterpolate: + Mov AX, [SI] ; AX = [SI]*(1-Remainder)*256 + Mov DX, 100h + Sub DL, CH + SbB DH, 0 + IMul DX ; DX:AX = [SI]*(1-Remainder)*256 + + Push DX + Push AX + + Add SI, 2 + JNC I_ReMix16BitInterpolate2 + + Add ESI, 10000h + Int 3 + +I_ReMix16BitInterpolate2: + Mov AX, [SI] + + MovZX DX, CH + IMul DX ; DX:AX = Remainder*256 + ShL EDX, 16 + Mov DX, AX + + Pop EAX + + Add EAX, EDX + Add EAX, 80h ; Rounding. + ShR EAX, 8 + + Sub ESI, 2 + +I_ReMix16BitStore: + Mov [ES:DI], AX + + Xor AX, AX + Add CX, BX + SetC AL + Add AX, AX + Add AX, BP + Add SI, AX + JC I_ReMix16Bit3 + +I_ReMix16Bit4: + Add DI, 2 + JC I_ReMix16Bit5 + +I_ReMix16Bit6: + Mov EAX, EDI + ShR EAX, 1 + Cmp EAX, CS:NewSampleSize + JB I_ReMix16Bit2 + + Jmp I_ReMixCleanUp + +I_ReMix16Bit3: + Add ESI, 10000h + Int 3 + Jmp I_Remix16Bit4 + +I_ReMix16Bit5: + PushAD + Push DS + Push ES + + Mov AX, 100 + Xor CX, CX + Call Music_GetSampleLocation + Mov ESI, EDI + Int 3 + + Push DS + Push ES + Pop DS + Pop ES + + Mov CX, 16384 + Xor SI, SI + Xor DI, DI + Rep MovsD + + Pop ES + Pop DS + PopAD + + Add EDI, 10000h + + Call I_RepositionSample + Jmp I_ReMix16Bit6 + +I_ReMixCleanUp: + ; Copy leftover stuff... + Mov AX, 100 + Xor CX, CX + Call Music_GetSampleLocation + Mov ESI, EDI + Int 3 + + Push DS + Push ES + Pop DS + Pop ES + + Mov CX, DI + Xor SI, SI + Xor DI, DI + Rep MovsB + + Call I_GetSampleOffset ; Gets DS:BX + Mov SI, BX + Mov ECX, [SI+30h] + Mov EBX, CS:NewSampleSize + ; ECX = length of old samp + ; EBX = length of new samp + Mov [SI+30h], EBX + Add SI, 34h + + Call Near Ptr I_ReMix5 + Call Near Ptr I_ReMix5 + Call Near Ptr I_ReMix5 + Call Near Ptr I_ReMix5 + Call Near Ptr I_ReMix5 + ; Now grab the data from Inst99 + Call I_SwapMemoryAllocation + + Call I_DrawWaveForm + Call Music_SoundCardLoadAllSamples + + Ret + +I_ReMix5: + Mov EAX, [SI] + Mul EBX + + Cmp EDX, ECX + JAE I_ReMix6 + + Div ECX + Cmp EAX, 9999999 + JB I_ReMix7 + +I_ReMix6: + Mov EAX, 9999999 + +I_ReMix7: + Mov [SI], EAX + Add SI, 4 + +I_ReMixEnd: + Ret + +EndP I_ReMix + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_ResizeSample Far + + Mov CS:Interpolate, 1 + Jmp I_ResizeJumpPoint + +EndP I_ResizeSample + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_ResizeSampleNoInt Far + + Mov CS:Interpolate, 0 + +I_ResizeJumpPoint: + EnsureNoNetwork + + Call I_GetSampleOffset + Mov AL, [BX+12h] + Test AL, 1 + JZ I_ResizeSampleNoInt1 + + And AL, 2 + Mov CS:Quality, AL + + Cmp DWord Ptr [DS:BX+30h], 0 + JE I_ResizeSampleNoInt1 + + Mov EAX, [DS:BX+30h] ; Old length + Mov CS:NewSampleSize, EAX + + Call F_Reset5NumInputPos + Call S_SaveScreen + + Mov DI, Offset O1_ResizeSampleList + Mov CX, 3 + Call M_Object1List + + Call S_RestoreScreen + + And DX, DX + JZ I_ResizeSampleNoInt1 + + Push CS + Pop DS + Assume DS:Inst + + Mov EDX, NewSampleSize + And EDX, EDX + JZ I_ResizeSampleNoInt1 + + Call I_Remix + +I_ResizeSampleNoInt1: + Mov AX, 1 + Ret + +EndP I_ResizeSampleNoInt + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_CenterSample Far + + EnsureNoNetwork + + Call PE_GetLastInstrument + Mov AX, BX + Inc AX + + Xor CX, CX + Call Music_GetSampleLocation ; Gets DS:SI, and ECX. + ; Zero flag if 8 bit. + JNC I_CenterSample1 + + Xor AX, AX + Ret + +I_CenterSample1: + Push AX ; Remember sample num. + ; Scan through wave first, + ; and find max deviation from + ; mean. + JNZ I_CenterSamplePre16Bit1 + Mov BL, [SI] + Mov DL, [SI] + +I_CenterSamplePre8Bit1: + Mov AL, [SI] + Cmp AL, BL + JL I_CenterSamplePre8Bit3 + Cmp AL, DL + JG I_CenterSamplePre8Bit4 + +I_CenterSamplePre8Bit2: + Add SI, 1 + JC I_CenterSamplePre8BitNextBlock + +I_CenterSamplePre8Bit5: + LoopD I_CenterSamplePre8Bit1 + + MovSX BX, BL + MovSX DX, DL + + Add BX, DX + Neg BX + SAR BX, 1 + + Jmp I_CenterSample2 + +I_CenterSamplePre8Bit3: + Mov BL, AL + Jmp I_CenterSamplePre8Bit2 + +I_CenterSamplePre8Bit4: + Mov DL, AL + Jmp I_CenterSamplePre8Bit2 + +I_CenterSamplePre8BitNextBlock: + Add ESI, 10000h + Int 3 + + Jmp I_CenterSamplePre8Bit5 + +I_CenterSamplePre16Bit: + Mov BX, [SI] + Mov DX, [SI] + +I_CenterSamplePre16Bit1: + Mov AX, [SI] + Cmp AX, BX + JL I_CenterSamplePre16Bit3 + Cmp AX, DX + JG I_CenterSamplePre16Bit4 + +I_CenterSamplePre16Bit2: + Add SI, 2 + JC I_CenterSamplePre16BitNextBlock + +I_CenterSamplePre16Bit5: + LoopD I_CenterSamplePre16Bit1 + + MovSX EBX, BX + MovSX EDX, DX + Add EBX, EDX + Neg EBX + SAR EBX, 1 + + Jmp I_CenterSample2 + +I_CenterSamplePre16Bit3: + Mov BX, AX + Jmp I_CenterSamplePre16Bit2 + +I_CenterSamplePre16Bit4: + Mov DX, AX + Jmp I_CenterSamplePre16Bit2 + +I_CenterSamplePre16BitNextBlock: + Add ESI, 10000h + Int 3 + Jmp I_CenterSamplePre16Bit5 + +I_CenterSample2: + Push BX + + Mov DI, Offset O1_SampleCenterList + Mov CX, 3 + Call M_Object1List + + Pop BX + Pop AX ; AX = sample num + Test DL, 1 + JZ I_CenterSampleEnd + + Call Music_Stop + + Xor CX, CX + Call Music_GetSampleLocation ; Loads DS:ESI and ECX again. + JNZ I_CenterSample16Bit1 + +I_CenterSample8Bit1: + Add [SI], BL + Add SI, 1 + JC I_CenterSample8BitNextBlock + +I_CenterSample8Bit2: + LoopD I_CenterSample8Bit1 + Jmp I_CenterSample3 + +I_CenterSample8BitNextBlock: + Add ESI, 10000h + Int 3 + Jmp I_CenterSample8Bit2 + +I_CenterSample16Bit1: + Add [SI], BX + Add SI, 2 + JC I_CenterSample16BitNextBlock + +I_CenterSample16Bit2: + LoopD I_CenterSample16Bit1 + Jmp I_CenterSample3 + +I_CenterSample16BitNextBlock: + Add ESI, 10000h + Int 3 + Jmp I_CenterSample16Bit2 + +I_CenterSample3: + Call I_DrawWaveForm + Call Music_SoundCardLoadAllSamples + +I_CenterSampleEnd: + Mov AX, 1 + Ret + +EndP I_CenterSample + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_AmplifySample Far + + EnsureNoNetwork + + Call PE_GetLastInstrument + Mov AX, BX + Inc AX + + Xor CX, CX + Call Music_GetSampleLocation ; Gets DS:SI, and ECX. + JNC I_AmplifySample1 + + Xor AX, AX + Ret + +I_AmplifySample1: + Push AX ; Remember sample num. + ; Scan through wave first, + ; and find max deviation from + ; mean. + Mov BX, 0 ; BX = deviation from mean + JNZ I_AmplifySample11 ; 16 bit stuff. + +I_AmplifySample2: + Mov AL, [SI] +; Sub AL, 80h + CBW + Xor AL, AH + Sub AL, AH + + Cmp AL, BH + JB I_AmplifySample3 + + Mov BH, AL + +I_AmplifySample3: + Add SI, 1 + JC I_AmplifySample8 + +I_AmplifySample9: + LoopD I_AmplifySample2 + Jmp I_AmplifySample10 + +I_AmplifySample8: + Add ESI, 10000h + Int 3 + Jmp I_AmplifySample9 + +I_AmplifySample11: + Mov AX, [SI] +; Sub AX, 8000h + CWD + Xor AX, DX + Sub AX, DX + Cmp AX, BX + JB I_AmplifySample12 + + Mov BX, AX + +I_AmplifySample12: + Add SI, 2 + JC I_AmplifySample13 + +I_AmplifySample14: + LoopD I_AmplifySample11 + Jmp I_AmplifySample10 + +I_AmplifySample13: + Add ESI, 10000h + Int 3 + Jmp I_AmplifySample14 + + +I_AmplifySample10: + ; OK. so BL contains max dev. + ; Amplificat = (8000h/MaxDev)*100 + Xor AX, AX + Mov DX, 32h + + Cmp DX, BX + JAE I_AmplifySample4 + + Div BX + + Cmp AX, 400 + JB I_AmplifySample5 + +I_AmplifySample4: + Mov AX, 400 + +I_AmplifySample5: + Mov CS:SampleAmplification, AX + + Mov DI, Offset O1_SampleAmplificationList + Mov CX, 3 + Call M_Object1List + + Pop AX ; AX = sample num + And DX, DX + JZ I_AmplifySampleEnd + + Call Music_Stop + + Xor CX, CX + Call Music_GetSampleLocation ; Loads DS:ESI and ECX again. + + PushF + + ; NewSample = OldSample*SampleAmplification/100, clipped. + + Mov AX, CS:SampleAmplification + Xor DX, DX + Mov BX, 100 + Div BX + ShL EAX, 16 + Div BX + Mov EBX, EAX ; EBX = multiplier, 16.16 bit. + + PopF + JNZ I_AmplifySample20 + +I_AmplifySample6: + MovSX EAX, Byte Ptr [SI] + + IMul EBX + + Add EAX, 8000h ; Rounding factor + ShR EAX, 16 + + Cmp AX, 7Fh + JGE I_AmplifySampleClip1 + + Cmp AX, -80h + JGE I_AmplifySample7 + + Mov AL, 80h + Jmp I_AmplifySample7 + +I_AmplifySampleClip1: + Mov AL, 7Fh + +I_AmplifySample7: + Mov [SI], AL + Add SI, 1 + JC I_AmplifySample16 + +I_AmplifySample17: + LoopD I_AmplifySample6 + Jmp I_AmplifySample15 + +I_AmplifySample16: + Add ESI, 10000h + Int 3 + Jmp I_AmplifySample17 + +I_AmplifySample20: ; 16 bit amplification!, EBX = 16.16 bit multiplier. + ; Newsample = OldSample*SampleAmplification/100 + + Mov AX, [SI] + MovSX EAX, AX + + IMul EBX + Add EAX, 8000h ; Rounding factor + AdC EDX, 0 ; Rounding stuff, etc. + + ShRD EAX, EDX, 16 + + Cmp EAX, 7FFFh + JGE I_AmplifySampleClip2 + + Cmp EAX, -8000h + JGE I_AmplifySample18 + + Mov AX, 8000h + Jmp I_AmplifySample18 + +I_AmplifySampleClip2: + Mov AX, 7FFFh + +I_AmplifySample18: + Mov [SI], AX + + Add SI, 2 + JC I_AmplifySample21 + +I_AmplifySample19: + LoopD I_AmplifySample20 + Jmp I_AmplifySample15 + +I_AmplifySample21: + Add ESI, 10000h + Int 3 + Jmp I_AmplifySample19 + +I_AmplifySample15: + Call I_DrawWaveForm + Call Music_SoundCardLoadAllSamples + +I_AmplifySampleEnd: + Mov AX, 1 + Ret + +EndP I_AmplifySample + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_ReverseSample Far + + EnsureNoNetwork + + Call PE_GetLastInstrument + Mov AX, BX + Inc AX + + Xor CX, CX + Call Music_GetSampleLocation ; Gets DS:SI, and CX. + JC I_ReverseSample1 + + JNZ I_ReverseSample10 + + Call Music_Stop + + Push ECX + + Mov EDX, ECX + Mov AX, 99 + Call Music_AllocateSample ; Returns ES:DI + Mov AX, ES + And AX, AX + + Pop ECX + + JZ I_ReverseSampleError + + Mov ESI, ECX + Dec ESI + Call I_RepositionSample + + Mov AX, DiskData + Mov ES, AX + Assume ES:Nothing + + Xor EDI, EDI + +I_ReverseSample2: + Mov AL, [SI] + Mov [ES:DI], AL + + Sub SI, 1 + JC I_ReverseSample4 + +I_ReverseSample5: + Add DI, 1 + JC I_ReverseSample6 + +I_ReverseSample7: + LoopD I_ReverseSample2 + Jmp I_ReverseSample3 + +I_ReverseSample4: + Sub ESI, 10000h + JC I_ReverseSample5 + Int 3 + + Jmp I_ReverseSample5 + +I_ReverseSample6: + PushAD + Push DS + Push ES + + Mov AX, 100 + Xor CX, CX + Call Music_GetSampleLocation + Mov ESI, EDI + Int 3 + + Push DS + Push ES + + Pop DS + Pop ES + + Xor SI, SI + Xor DI, DI + Mov CX, 16384 + Rep MovsD + + Pop ES + Pop DS + PopAD + Add EDI, 10000h + Call I_RepositionSample + Jmp I_ReverseSample7 + +I_ReverseSample10: + Call Music_Stop + + Push ECX + + Mov EDX, ECX + Add EDX, EDX + Mov AX, 99 + Call Music_AllocateSample ; Returns ES:DI + Mov AX, ES + And AX, AX + + Pop ECX + + JZ I_ReverseSampleError + + Mov ESI, ECX + Dec ESI + Add ESI, ESI + Call I_RepositionSample + + Mov AX, DiskData + Mov ES, AX + Assume ES:Nothing + + Xor EDI, EDI + +I_ReverseSample12: + Mov AX, [SI] + Mov [ES:DI], AX + + Sub SI, 2 + JC I_ReverseSample14 + +I_ReverseSample15: + Add DI, 2 + JC I_ReverseSample16 + +I_ReverseSample17: + LoopD I_ReverseSample12 + Jmp I_ReverseSample3 + +I_ReverseSample14: + Sub ESI, 10000h + JC I_ReverseSample15 + Int 3 + + Jmp I_ReverseSample15 + +I_ReverseSample16: + PushAD + Push DS + Push ES + + Mov AX, 100 + Xor CX, CX + Call Music_GetSampleLocation + Mov ESI, EDI + Int 3 + + Push DS + Push ES + + Pop DS + Pop ES + + Xor SI, SI + Xor DI, DI + Mov CX, 16384 + Rep MovsD + + Pop ES + Pop DS + PopAD + Add EDI, 10000h + Call I_RepositionSample + Jmp I_ReverseSample17 + + +I_ReverseSampleError: + Call PEFunction_OutOfMemoryMessage + + Mov AX, 1 + Ret + +I_ReverseSample3: + Mov AX, 100 + Xor CX, CX + Call Music_GetSampleLocation + + Mov ESI, EDI + Int 3 + + Mov CX, DI + + Push DS + Push ES + Pop DS + Pop ES + + Xor SI, SI + Xor DI, DI + Rep MovsB + + ; Now to release old memory, and swap + ; in new lot... + Call I_SwapMemoryAllocation + + Call I_GetSampleOffset ; Returns DS:BX + + Mov EDX, [BX+30h] ; DX = length + Mov EAX, EDX + Mov ECX, EDX + + Sub EAX, [BX+34h] + Sub ECX, [BX+38h] + Mov [BX+34h], ECX + Mov [BX+38h], EAX + + Mov EAX, EDX + Mov ECX, EDX + + Sub EAX, [BX+40h] + Sub ECX, [BX+44h] + Mov [BX+40h], ECX + Mov [BX+44h], EAX + + Call I_DrawWaveForm + Call Music_SoundCardLoadAllSamples + +I_ReverseSample1: + Mov AX, 1 + Ret + +EndP I_ReverseSample + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_SwapMemoryAllocation + + Call I_GetSampleOffset ; Gets DS:BX + Mov SI, [DS:64912+99*2] + Mov EAX, [SI+48h] + XChg [BX+48h], EAX + Mov [SI+48h], EAX + + Mov AX, 99 + Call Music_ReleaseSample + + Ret + +EndP I_SwapMemoryAllocation + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_RepositionSample + + + Push AX + Push BX + Push ECX + Push ESI + + Call PE_GetLastInstrument + Mov AX, BX ; AX = sample no. + Inc AX + Xor CX, CX + Call Music_GetSampleLocation ; Return DS:ESI, ECX + + Pop ESI + Int 3 + + Pop ECX + Pop BX + Pop AX + Ret + +EndP I_RepositionSample + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_ToggleSampleQuality Far + + EnsureNoNetwork + + Call I_GetSampleOffset + Mov AL, [BX+12h] + Test AL, 1 + JZ I_ToggleSampleQuality1 + + Test AL, 2 + JZ I_To16Bit + +I_To8Bit: + Push DS + Push BX + + Mov DI, Offset O1_ConfirmConvert2List + Mov CX, 3 + Call M_Object1List + + Pop BX + Pop DS + + And DX, DX + JZ I_ToggleSampleQuality1 + + Call Music_Stop + + Cmp DX, 1 + JE I_ConvertTo8Bit + + And Byte Ptr [BX+12h], Not 2 + + ShL DWord Ptr [BX+30h], 1 + ShL DWord Ptr [BX+34h], 1 + ShL DWord Ptr [BX+38h], 1 + ShL DWord Ptr [BX+40h], 1 + ShL DWord Ptr [BX+44h], 1 + + Jmp I_ToggleSampleQualityEnd + +I_ConvertTo8Bit: + Mov EDX, [BX+30h] + Mov AX, 99 ; Shove it into inst 99 first. + Call Music_AllocateSample + + Mov AX, ES + And AX, AX + JZ I_OutOfMemory + + And Byte Ptr [BX+12h], Not 2 + + Call PE_GetLastInstrument + Mov AX, BX ; AX = sample no. + Inc AX + + Xor CX, CX + Call Music_GetSampleLocation ; Return DS:ESI + + Mov AX, DiskData + Mov ES, AX + Assume ES:Nothing + + Xor EDI, EDI + +I_ConvertTo8Bit1: + Mov AX, [SI] +; Add AX, 80h +; SBB AH, 0 + Mov [ES:DI], AH + + Add SI, 2 + JC I_ConvertTo8Bit2 + +I_ConvertTo8Bit3: + Add DI, 1 + JC I_ConvertTo8Bit5 + +I_ConvertTo8Bit4: + LoopD I_ConvertTo8Bit1 + + Mov AX, 100 + Xor CX, CX + Call Music_GetSampleLocation + + Mov ESI, EDI + Int 3 + + Mov CX, DI + + Push DS + Push ES + Pop DS + Pop ES + + Xor SI, SI + Xor DI, DI + Rep MovsB + + ; Now to release old memory, and swap + ; in new lot... + Call I_SwapMemoryAllocation + + Jmp I_ToggleSampleQualityEnd + +I_ConvertTo8Bit2: + Add ESI, 10000h + Int 3 + Jmp I_ConvertTo8Bit3 + +I_ConvertTo8Bit5: + PushAD + Push DS + Push ES + + Mov AX, 100 + Xor CX, CX + Call Music_GetSampleLocation + + Mov ESI, EDI + Int 3 + + Push DS + Push ES + + Pop DS + Pop ES + + Xor SI, SI + Xor DI, DI + Mov CX, 16384 + Rep MovsD + + Pop ES + Pop DS + PopAD + + Call I_RepositionSample + + Add EDI, 10000h + Jmp I_ConvertTo8Bit4 + +I_OutOfMemory: + Call PEFunction_OutOfMemoryMessage + Jmp I_ToggleSampleQuality1 + +I_To16Bit: + Push DS + Push BX + + Mov DI, Offset O1_ConfirmConvert2List + Mov CX, 3 + Call M_Object1List + + Pop BX + Pop DS + + And DX, DX + JZ I_ToggleSampleQuality1 + + Call Music_Stop + + Cmp DX, 1 + JE I_ConvertTo16Bit + + Or Byte Ptr [BX+12h], 2 + + ShR DWord Ptr [BX+30h], 1 + ShR DWord Ptr [BX+34h], 1 + ShR DWord Ptr [BX+38h], 1 + ShR DWord Ptr [BX+40h], 1 + ShR DWord Ptr [BX+44h], 1 + + Jmp I_ToggleSampleQualityEnd + +I_ConvertTo16Bit: + Mov EDX, [BX+30h] + Add EDX, EDX + Mov AX, 99 ; Shove it into inst 99 first. + Call Music_AllocateSample + + Mov AX, ES + And AX, AX + JZ I_OutOfMemory + + Or Byte Ptr [BX+12h], 2 + + Mov ECX, [BX+30h] + Xor ESI, ESI + Call I_RepositionSample + + Mov AX, DiskData + Mov ES, AX + Assume ES:Nothing + + Xor EDI, EDI + +I_ConvertTo16Bit1: + Mov AH, [SI] + Xor AL, AL + Mov [ES:DI], AX + + Add SI, 1 + JC I_ConvertTo16Bit2 + +I_ConvertTo16Bit3: + Add DI, 2 + JC I_ConvertTo16Bit5 + +I_ConvertTo16Bit4: + LoopD I_ConvertTo16Bit1 + + Mov AX, 100 + Xor CX, CX + Call Music_GetSampleLocation + + Mov ESI, EDI + Int 3 + + Mov CX, DI + + Push DS + Push ES + Pop DS + Pop ES + + Xor SI, SI + Xor DI, DI + Rep MovsB + + Call I_SwapMemoryAllocation + + Jmp I_ToggleSampleQualityEnd + +I_ConvertTo16Bit2: + Add ESI, 10000h + Int 3 + Jmp I_ConvertTo16Bit3 + +I_ConvertTo16Bit5: + PushAD + Push DS + Push ES + + Mov AX, 100 + Xor CX, CX + Call Music_GetSampleLocation + + Mov ESI, EDI + Int 3 + + Push DS + Push ES + + Pop DS + Pop ES + + Xor SI, SI + Xor DI, DI + Mov CX, 16384 + Rep MovsD + + Pop ES + Pop DS + PopAD + + Call I_RepositionSample + + Add EDI, 10000h + Jmp I_ConvertTo16Bit4 + +I_ToggleSampleQualityEnd: + Call I_DrawWaveForm + Call Music_SoundCardLoadAllSamples + +I_ToggleSampleQuality1: + Mov AX, 1 + Ret + +EndP I_ToggleSampleQuality + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_DrawInstrumentWindow Far + + Call S_GetDestination + + Mov AX, Pattern + Mov DS, AX + Assume DS:Pattern + + Mov AL, LastInstrument + Test AL, AL + JNZ I_DrawInstrumentWindow1 + + Inc AX + Mov LastInstrument, AL + +I_DrawInstrumentWindow1: ; AL = last instrument + Xor AH, AH ; Now for bounds check. + + Push CS + Pop DS + Assume DS:Inst + + Mov BX, TopInstrument + Cmp AX, BX + JAE I_DrawInstrumentWindow2 + + Mov BX, AX + +I_DrawInstrumentWindow2: + Mov CX, BX + Add CX, 34 + Cmp CX, AX + JAE I_DrawInstrumentWindow3 + + Mov BX, AX + Sub BX, 34 + +I_DrawInstrumentWindow3: + Mov TopInstrument, BX ; OK.. now to draw nums + Push AX + + Mov DI, (2+13*80)*2 + + Mov DX, 0A23h + +I_DrawInstrumentWindow4: + Mov AX, BX + Div DH + ; AH = units, AL = tens + Add AL, '0' + StosB + Mov AL, 20h + StosB + XChg AH, AL + Add AL, '0' + StosW + + Inc BX + Add DI, 156 + Dec DL + JNE I_DrawInstrumentWindow4 + + Mov BX, TopInstrument + + Call Music_GetSongSegment + Mov DS, AX + Assume DS:Nothing + + Mov DX, 35 + Mov DI, (5+13*80)*2 + Dec BX + Mov SI, BX + Add SI, SI + Mov SI, [SI+64712] + Add SI, 20h + + Pop CX ; CX = last instrument + Dec CX + +I_DrawInstrumentWindow5: + Push CX + + Mov AH, 6 + Cmp BX, CX + JNE I_DrawInstrumentWindow7 + + Mov AH, 0E6h + +I_DrawInstrumentWindow7: + Mov CX, 25 + +I_DrawInstrumentWindow6: + LodsB + + Cmp AL, 226 + JB I_DrawInstrumentNoMouse + + Mov AL, ' ' + +I_DrawInstrumentNoMouse: + StosW + Loop I_DrawInstrumentWindow6 + + Add DI, 160-(25*2) + Add SI, 554-25 + Pop CX + + Inc BX + Dec DX + JNZ I_DrawInstrumentWindow5 + + Push CS + Pop DS + + Mov SI,Offset SampleMouseEvent + Mov Word Ptr [SI+4], 30*8-1 + Mov Word Ptr [SI+10], 4 + Call AddSelectEvent + Mov SI, Offset SampleMouseOffEvent + Mov Word Ptr [SI+4], 30*8-1 + Call MouseAddEvent + + Ret + +EndP I_DrawInstrumentWindow + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_PreInstrumentWindow Far + + Call S_GetDestination + Mov AX, Pattern + Mov DS, AX + Assume DS:Pattern + + Mov AL, LastInstrument + Xor AH, AH + Mov SI, AX + Sub AX, TopInstrument + Add AX, 13 + Mov BX, 160 + Mul BX + Add AX, 11 + Mov DI, AX + Cmp InstrumentEdit, 1 + JE I_PreInstrumentWindow2 + + Mov CX, 25 + +I_PreInstrumentWindow1: + Mov Byte Ptr [ES:DI], 30h +; Add DI, 2 + ScasW + + Loop I_PreInstrumentWindow1 + Ret + +I_PreInstrumentWindow2: + Mov AX, CS:InstrumentPos + Add AX, AX + Add DI, AX + Mov Byte Ptr [ES:DI], 30h + + Ret + +EndP I_PreInstrumentWindow + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MIDI_AllocateChannel Far ; Given AX = Base channel, DL = note + ; Finds physical channel, returns AX + ; if no channel available, then + ; overtakes channel at base channel + ; Given DI = max channel + Push BX CX DX SI DS + + Push DX + + Push CS + Pop DS + Assume DS:Inst + + Mov DX, AX + Mov BX, AX + +MIDI_AllocateChannel1: + Inc DX + Cmp DX, DI + JA MIDI_AllocateChannelOvertake + + Mov SI, Offset MIDITable + Mov CX, 128 + +MIDI_AllocateChannel2: + LodsB + Cmp AL, DL + JE MIDI_AllocateChannel1 + Loop MIDI_AllocateChannel2 + + Mov AX, DX + Jmp MIDI_AllocateChannelEnd + +MIDI_AllocateChannelOvertake: ; Search for basechannel + Mov SI, Offset MIDITable + +MIDI_AllocateChannel3: + LodsB + Cmp AL, DL + JNE MIDI_AllocateChannel3 + + ; Clear out last entry... + Mov Byte Ptr [SI-1], 0 + Mov AX, BX + Inc AX + +MIDI_AllocateChannelEnd: + Pop BX ; BL = note + And BX, 07Fh + Mov [MIDITable+BX], AL + + Dec AX + + Pop DS SI DX CX BX + Ret + +EndP MIDI_AllocateChannel + + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MIDI_GetChannel Far + + Xor AX, AX + Mov AL, [CS:MIDITable+BX] + Ret + +EndP MIDI_GetChannel + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MIDI_FindChannel Far ; Given BX = Note, returns AX = channel + ; number, cleans up table, AL = 0FFh = + ; note not present + + Xor AX, AX + XChg [CS:MIDITable+BX], AL + Dec AL + + Ret + +EndP MIDI_FindChannel + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MIDI_ClearTable Far + + Push AX CX ES DI + + Push CS + Pop ES + + Mov DI, Offset MIDITable + Xor AX, AX + Mov CX, 64 + Rep StosW + + Pop DI ES CX AX + + Ret + +EndP MIDI_ClearTable + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MIDI_NoteOff Far + + Push CS + Pop DS + Assume DS:Inst + + ; DL = note +MIDI_NoteOff2: + Call Music_GetInstrumentMode + Mov CX, 0FFh + JNZ MIDI_NoteOff3 + + Dec CX + +MIDI_NoteOff3: + MovZX BX, DL + Call MIDI_FindChannel + Cmp AL, 0FFh + JE MIDI_NoteOff1 + + Mov SI, Offset NoteData + Mov Word Ptr [SI], CX ; Note off/cut + Mov Word Ptr [SI+3], 0 ; No effect + Mov DH, 32 + Call Music_PlayNote + +MIDI_NoteOff1: + Mov AX, 1 +; Xor AX, AX + Ret + +EndP MIDI_NoteOff + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MIDI_PlayNote Far + + Push CS + Pop DS + Assume DS:Inst + + Call PE_TranslateMIDI + JC MIDI_PlayNote1 + JZ MIDI_NoteOff2 + + Call PE_GetLastInstrument + Mov AH, BL + Inc AH + Mov AL, DL ; Note + + Mov SI, Offset NoteData + Mov [SI], AX + Mov [SI+2], DH + Mov Word Ptr [SI+3], 0 + + Call Music_GetNumChannels ; Into AX + Mov DI, AX + Mov AX, PlayChannel + Call PE_RestoreMIDINote + Call MIDI_AllocateChannel + + Mov DH, 32 + Call Music_PlayNote + + Mov Byte Ptr [SI+2], 0FFh + Mov AX, 1 + Ret + +MIDI_PlayNote1: + Xor AX, AX + Ret + + +EndP MIDI_PlayNote + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_PlayNote Far + + Push CS + Pop DS + Assume DS:Inst + + Test CH, Not 1 + JNZ I_PlayNote5 + + Cmp CX, LastKey + JE I_PlayNote5 + + Mov LastKey, CX + + Mov SI, Offset KeyBoardTable + +I_PlayNote1: + LodsW + Cmp AX, 0FFFFh + JE I_PlayNote5 + + Mov BX, AX + LodsW + + Cmp BL, CL + JNE I_PlayNote1 + ; Note to play... + ; AX = notemod. + Mov CL, AL + + Mov AX, Pattern + Mov DS, AX + Assume DS:Pattern + + Mov AL, 12 + Mul BaseOctave + Add AL, CL + Cmp AL, 119 + JBE I_PlayNoteMax + + Mov AL, 119 + +I_PlayNoteMax: + Mov DL, AL + + Test CH, CH + JZ MIDI_NoteOff + + Call PE_GetLastInstrument + Mov AH, BL + Inc AH + + Push CS + Pop DS + + MovZX BX, AL + Cmp [MIDITable+BX], 0 + JNE I_PlayNote6 + + Call UpdateMultiChannel + + Mov PlayNote, AL + +I_PlayNote3: + Mov SI, Offset NoteData + Mov [SI], AX + + Push DS + + Call I_GetInstrumentOffset + + Test Byte Ptr [BX+19h], 80h + Mov DH, 32 + JZ I_PlayNote4 + + Add DH, 128 + +I_PlayNote4: + Pop DS + Call Music_GetNumChannels ; Into AX + Mov DI, AX + Mov AX, PlayChannel + Call MIDI_AllocateChannel + Call Music_PlayNote + +I_PlayNote6: + Mov AX, 1 + Ret + +I_PlayNote5: + Xor AX, AX + Ret + +EndP I_PlayNote + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_PostInstrumentWindow Far + Assume DS:Inst + + Push CS + Pop DS + Mov SI, Offset InstrumentListKeys + Call M_FunctionDivider + JC I_PostInstrumentWindow1 + + Jmp [SI] + +I_PostInstrumentWindow1: + Cmp InstrumentEdit, 0 + JE I_PostInstrumentWindow7 + + Cmp CX, 101h + JE I_PostInstrumentWindow15 + Cmp CX, 11Ch + JNE I_PostInstrumentWindow13 + +I_PostInstrumentWindow15: + Mov InstrumentEdit, 0 + Jmp I_PostInstrumentWindow12 + +I_PostInstrumentWindow13: + Call PE_GetLastInstrument + Mov SI, BX + Mov BX, InstrumentPos + ; BX = Pos, SI = LastInst + Call Music_GetSongSegment + Mov DS, AX + Assume DS:Nothing + + Add SI, SI + Mov SI, [64712+SI] ; SI = instrument offset. + + Test CL, CL + JZ I_PostInstrumentWindow3 + Cmp DL, 32 + JB I_PostInstrumentWindow3 + + Add BX, 20h + Add BX, SI + Add SI, 38h + +I_PostInstrumentWindow2: + Cmp SI, BX + JBE I_PIW2 + + Mov AL, [SI-1] + Mov [SI], AL + Dec SI + Jmp I_PostInstrumentWindow2 + +I_PIW2: + + Mov [SI], DL + NetworkSendInstrument + + Push CS + Pop DS + Jmp I_InstrumentRight + +I_PostInstrumentWindow3: + Cmp CX, 10Eh ; Backspace + JNE I_PostInstrumentWindow5 + + And BX, BX + JZ I_PostInstrumentWindow6 + + Dec InstrumentPos + Add BX, 20h + Add BX, SI + Add SI, 39h + +I_PostInstrumentWindow4: + Mov AL, [BX] + Mov [BX-1], AL + Inc BX + Cmp BX, SI + JB I_PostInstrumentWindow4 + + Mov Byte Ptr [BX-1], 0 + NetworkSendInstrument + +I_PostInstrumentWindow12: + + Mov AX, 1 + Ret + +I_PostInstrumentWindow5: + Assume DS:Inst + + Cmp CX, 1D3h ; Delete... + JNE I_PostInstrumentWindow6 + + Add BX, 21h + Add BX, SI + Add SI, 39h + Jmp I_PostInstrumentWindow4 + +I_PostInstrumentWindow6: + Xor AX, AX + Ret + +I_PostInstrumentWindow7: + Assume DS:Inst + Cmp DX, ' ' ; Spacebar + JNE I_PostInstrumentWindow14 + + Mov InstrumentEdit, 1 + Mov InstrumentPos, 0 + + Mov AX, 1 + Ret + +I_PostInstrumentWindow14: + Xor AX, AX + Ret + +EndP I_PostInstrumentWindow + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_InstrumentLeft Far + + Assume DS:Inst + + Cmp InstrumentEdit, 0 + JE I_InstrumentLeft2 + + Cmp InstrumentPos, 0 + JE I_InstrumentLeft1 + + Dec InstrumentPos +; Jmp I_InstrumentLeft1 + +I_InstrumentLeft2: +; Mov Word Ptr [ES:DI], 8 + +I_InstrumentLeft1: + Mov AX, 1 + Ret + +EndP I_InstrumentLeft + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_InstrumentRight Far + + Assume DS:Inst + + Cmp InstrumentEdit, 0 + JE I_InstrumentRight2 + + Cmp InstrumentPos, 24 + JAE I_InstrumentRight1 + + Inc InstrumentPos + Jmp I_InstrumentRight1 + +I_InstrumentRight2: + Mov Word Ptr [ES:DI], 5 + +I_InstrumentRight1: + Mov AX, 1 + Ret + + +EndP I_InstrumentRight + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_InstrumentHome Far + + Assume DS:Inst + + Mov InstrumentPos, 0 + + Mov AX, 1 + Ret + +EndP I_InstrumentHome + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_InstrumentEnd Far + + Assume DS:Inst + + Mov InstrumentPos, 24 + + Mov AX, 1 + Ret + +EndP I_InstrumentEnd + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_InstrumentTab Far + + Mov Word Ptr [ES:DI], 5 + + Mov AX, 1 + Ret + +EndP I_InstrumentTab + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_InstrumentShiftTab Far + + Mov Word Ptr [ES:DI], 8 + + Mov AX, 1 + Ret + +EndP I_InstrumentShiftTab + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_InstrumentNameClear Far + + Call I_GetInstrumentOffset + Push DS + Pop ES + Mov DI, BX + + Xor AX, AX + Mov CX, 6 + Add DI, 4 + Rep StosW + + Add DI, 10h + Mov CX, 13 + Rep StosW + + NetworkSendInstrument + + Inc AX + Ret + +EndP I_InstrumentNameClear + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_InstrumentClear Far + + Call PE_GetLastInstrument + Mov AX, BX + Call Music_ClearInstrument + + Call I_MapEnvelope + + NetworkSendInstrument + + Mov AX, 1 + Ret + +EndP I_InstrumentClear + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_DrawNoteWindow Far + + Push CS + Pop DS + Assume DS:Inst + + Mov SI, Offset NoteMouseEvent + Call AddSelectEvent + Mov SI, Offset NoteMouseOffEvent + Call MouseAddEvent + + Mov AX, CurrentNote + ; Now for bounds check. + + Mov BX, TopNote + Cmp AX, BX + JAE I_DrawNoteWindow2 + + Mov BX, AX + +I_DrawNoteWindow2: + Mov CX, BX + Add CX, 31 + Cmp CX, AX + JAE I_DrawNoteWindow3 + + Mov BX, AX + Sub BX, 31 + +I_DrawNoteWindow3: + Mov TopNote, BX ; OK.. now to draw nums + Mov CX, BX + + Call S_GetDestination + + Call I_GetInstrumentOffset + Add BX, 40h + Add BX, CX + Add BX, CX + Mov DI, (32+16*80)*2 + + Mov DX, 0C20h + XChg SI, BX + ; DS:SI = pointer to translation + ; ES:DI = screen + ; CX = Current note. +I_DrawNoteWindow4: + ; Draw left hand note first. + Mov AX, CX + Div DH ; AH = note, AL = octave. + Push AX + + Mov AL, AH + Mov BX, AX + And BX, 0FFh ; BX = note. + Add BX, BX ; BX = note*2 + Mov AH, 2 + Mov AL, [CS:BX+NoteTable] + StosW + Mov AL, [CS:BX+NoteTable+1] + StosW + + Pop AX ; AL = octave + Add AL, '0' + Mov AH, 2 + StosW + + ; View division... + Mov AL, 0A8h + StosW + ; Note translation... + + LodsB ; AL = note.. + Xor AH, AH + Div DH + Push AX + + Mov AL, AH + Mov BX, AX + And BX, 0FFh ; BX = note. + Add BX, BX ; BX = note*2 + Mov AH, 2 + Mov AL, [CS:BX+NoteTable] + StosW + Mov AL, [CS:BX+NoteTable+1] + StosW + + Pop AX ; AL = octave + Add AL, '0' + Mov AH, 2 + StosW + + Mov AL, ' ' + StosW + ; Now sample number. + LodsB ; AL = sample number (base 0) +; Inc AL ; Convert to base 1 + + And AL, AL + JNZ I_DrawNoteWindow5 + + Mov AL, 173 + StosW + StosW + Jmp I_DrawNoteWindow6 + +I_DrawNoteWindow5: + Xor AH, AH + Mov BL, 10 + Div BL ; AH = units, AL = tens. + Add AX, 3030h + Mov BL, AH + Mov AH, 2 + StosW + Mov AL, BL + StosW + +I_DrawNoteWindow6: + Add DI, 160-10*2 + + Inc CX + Dec DL + JNZ I_DrawNoteWindow4 + + Ret + +EndP I_DrawNoteWindow + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_PreNoteWindow Far + + Push CS + Pop DS + Assume DS:Inst + + Call S_GetDestination + Mov AX, CurrentNote + Sub AX, TopNote + Add AX, 16 + Mov BX, 160 + Mul BX + Add AX, 32*2 + Mov DI, AX ; First hilight the row.. + + Mov CX, 10 + Push DI + +I_PreNoteWindow1: + Inc DI + Or Byte Ptr [ES:DI], 0E0h + Inc DI + Loop I_PreNoteWindow1 + + Pop DI + + Mov BX, NotePos + Mov BL, [NotePosTable+BX] + Xor BH, BH + Add DI, BX + Add DI, BX + + Inc DI + Mov Byte Ptr [ES:DI], 30h + + Ret + +EndP I_PreNoteWindow + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_PostNoteWindow Far + + Push CS + Pop DS + Assume DS:Inst + + Mov SI, Offset NoteListKeys + Call M_FunctionDivider + JC I_PostNoteWindow1 + + Jmp [SI] + +I_PostNoteWindow1: + Cmp NotePos, 0 + JNE I_PostNoteWindow5 + + Mov SI, Offset KeyBoardTable + +I_PostNoteWindow2: + LodsW + Cmp AX, 0FFFFh + JE I_PostNoteWindow3 + + Mov BX, AX + LodsW + + Cmp BX, CX + JNE I_PostNoteWindow2 + ; Note to play... + ; AX = notemod. + Mov CX, AX + + Mov AX, Pattern + Mov DS, AX + Assume DS:Pattern + + Mov AL, 12 + Mul BaseOctave + + Push CS + Pop DS + Assume DS:Inst + Mov SI, CurrentNote + Add SI, SI + + Add CX, AX + Cmp CX, 119 + JA I_PostNoteWindow4 ; If note > B-9... not valid! + + Mov CH, SampleNumber + + Call I_GetInstrumentOffset + Mov [DS:BX+SI+40h], CX + + Push CS + Pop DS + + Mov SI, Offset NoteData + Call PE_GetLastInstrument + Mov AH, BL + Inc AH + Mov AL, Byte Ptr CurrentNote + Mov [SI], AX + + Mov AX, PlayChannel + Mov DH, 32+128 + Call Music_PlayNote + + NetworkSendInstrument + Jmp I_NoteDown + +I_PostNoteWindow4: + Mov AX, 1 + Ret + +I_PostNoteWindow3: + Xor AX, AX + Ret + +I_PostNoteWindow5: + Cmp DL, '0' + JB I_PostNoteWindow6 + Cmp DL, '9' + JA I_PostNoteWindow6 + + Sub DL, '0' + + Mov SI, CurrentNote + Add SI, SI + + Call I_GetInstrumentOffset + Assume DS:Nothing + ; DS:BX points to inst. + Add BX, 40h + + Mov AX, NotePos + Cmp AL, 1 + JE I_PostNoteWindow7 + + Inc BX + + Cmp AL, 2 + JE I_PostNoteWindow8 + + Cmp AL, 3 + JE I_PostNoteWindow9 + +I_PostNoteWindow6: + Cmp DX, '.' + JNE I_PostNoteWindow10 + Cmp NotePos, 2 + JB I_PostNoteWindow10 + + Mov SI, CurrentNote + Add SI, SI + + Call I_GetInstrumentOffset + Assume DS:Nothing + Add BX, SI + Add BX, 41h + Mov Byte Ptr [BX], 0 + + NetworkSendInstrument + Jmp I_NoteDown + +I_PostNoteWindow10: + Xor AX, AX + Ret + +I_PostNoteWindow7: ; Octave of note. + Mov AL, [DS:BX+SI] ; AL = Note + Xor AH, AH + Mov CL, 0Ch + Div CL ; AL = octave, AH = Note + + Mov AL, DL + Mov CH, AH + Mul CL + Add AL, CH ; AL = new note + + Mov [DS:BX+SI], AL + + NetworkSendInstrument + Jmp I_NoteDown + +I_PostNoteWindow8: + Mov AL, [DS:BX+SI] ; AL = sample. + Xor AH, AH + Mov CL, 10 + Div CL ; AL = tens, AH = units + + Mov AL, DL + Mov CH, AH + Mul CL + Add AL, CH + + Mov SampleNumber, AL + Mov [DS:BX+SI], AL + + NetworkSendInstrument + Jmp I_NoteRight + +I_PostNoteWindow9: + Mov AL, [DS:BX+SI] + Xor AH, AH + Mov CL, 10 + Div CL + + Mov CH, AH + Mul CL + + Add AL, DL + + Mov SampleNumber, AL + Mov [DS:BX+SI], AL + + Mov NotePos, 2 + +I_PostNoteWindowEnd: + NetworkSendInstrument + Jmp I_NoteDown + +EndP I_PostNoteWindow + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_SelectNoteMouse Far + Assume DS:Inst + + ShR DX, 3 + Add DX, TopNote + Sub DX, 16 + JNC I_SelectNoteMouse1 + + Xor DX, DX + +I_SelectNoteMouse1: + Cmp DX, 119 + JB I_SelectNoteMouse2 + + Mov DX, 119 + +I_SelectNoteMouse2: + Mov CurrentNote, DX + + Mov AX, 1 + Ret + +EndP I_SelectNoteMouse + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_NoteUp Far + + Assume DS:Inst + + Mov AX, CurrentNote + Dec AX + JS I_NoteUp2 + + Mov CurrentNote, AX + Jmp I_NoteUp1 + +I_NoteUp2: + Mov Word Ptr [ES:DI], 5 + +I_NoteUp1: + Mov AX, 1 + Ret + +EndP I_NoteUp + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_NoteDown Far + + Push CS + Pop DS + Assume DS:Inst + + Mov AX, CurrentNote + Inc AX + Cmp AX, 119 + JA I_NoteDown1 + + Mov CurrentNote, AX + +I_NoteDown1: + Mov AX, 1 + Ret + +EndP I_NoteDown + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_NotePgUp Far + + Assume DS:Inst + + Mov AX, CurrentNote + Sub AX, 12 + JNS I_NotePgUp1 + + Xor AX, AX + +I_NotePgUp1: + Mov CurrentNote, AX + + Mov AX, 1 + Ret + +EndP I_NotePgUp + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_NotePgDn Far + + Assume DS:Inst + + Mov AX, CurrentNote + Add AX, 12 + Cmp AX, 119 + JBE I_NotePgDn1 + + Mov AX, 119 + +I_NotePgDn1: + Mov CurrentNote, AX + + Mov AX, 1 + Ret + +EndP I_NotePgDn + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_NoteRight Far + + Push CS + Pop DS + Assume DS:Inst + + Mov AX, NotePos + Inc AX + Cmp AX, 4 + JB I_NoteRight1 + + Mov AX, 3 + +I_NoteRight1: + Mov NotePos, AX + + Mov AX, 1 + Ret + +EndP I_NoteRight + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_NoteLeft Far + + Assume DS:Inst + Mov AX, NotePos + Dec AX + JS I_NoteLeft1 + + Mov NotePos, AX + +I_NoteLeft1: + Mov AX, 1 + Ret + +EndP I_NoteLeft + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_NoteHome Far + Assume DS:Inst + + Mov CurrentNote, 0 + + Mov AX, 1 + Ret + +EndP I_NoteHome + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_NoteEnd Far + Assume DS:Inst + + Mov CurrentNote, 119 + + Mov AX, 1 + Ret + +EndP I_NoteEnd + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_NoteTab Far + + Mov Word Ptr [ES:DI], 16 + + Mov AX, 1 + Ret + +EndP I_NoteTab + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_NoteShiftTab Far + + Mov Word Ptr [ES:DI], 4 + + Mov AX, 1 + Ret + +EndP I_NoteShiftTab + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_NoteSampleIncrease Far + + Assume DS:Inst + + Mov AL, SampleNumber + Inc AX + Cmp AL, 99 + JA I_NoteSampleIncrease1 + + Mov SampleNumber, AL + +I_NoteSampleIncrease1: + Mov AX, 1 + Ret + +EndP I_NoteSampleIncrease + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_NoteSampleDecrease Far + + Assume DS:Inst + + Mov AL, SampleNumber + Dec AL + JS I_NoteSampleDecrease1 + + Mov SampleNumber, AL + +I_NoteSampleDecrease1: + Mov AX, 1 + Ret + +EndP I_NoteSampleDecrease + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_NoteSamplePickUp Far + + Assume DS:Nothing + + Call I_GetInstrumentOffset + + Mov SI, CurrentNote + Mov AX, SI + Mov PlayNote, AL + Add SI, SI + + Mov AX, [DS:BX+SI+40h] + + Mov SampleNumber, AH + + Mov AX, 1 + Ret + +EndP I_NoteSamplePickUp + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_NoteNext Far + Assume DS:Inst + + Mov SI, CurrentNote + Add SI, SI + JZ I_NoteNext1 + + Call I_GetInstrumentOffset + Assume DS:Nothing + + Add BX, SI + Add BX, 40h + + Mov AX, [DS:BX-2] ; 'Last note.' + Cmp AL, 119 ; Is previous note >= B-9 + JAE I_NoteNext1 + + Inc AX + Mov [DS:BX], AX + + NetworkSendInstrument + Jmp I_NoteDown + +I_NoteNext1: + Mov AX, 1 + Ret + +EndP I_NoteNext + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_NotePrevious Far + Assume DS:Inst + + Mov SI, CurrentNote + Cmp SI, 119 + JAE I_NotePrevious1 + + Add SI, SI + + Call I_GetInstrumentOffset + Assume DS:Nothing + + Add BX, SI + Add BX, 40h + + Mov AX, [DS:BX+2] ; 'Last note.' + Test AL, AL + JZ I_NotePrevious1 + + Dec AX + Mov [DS:BX], AX + + Push CS + Pop DS + Assume DS:Inst + + Mov AX, CurrentNote + Dec AX + JS I_NotePrevious1 + + Mov CurrentNote, AX + NetworkSendInstrument + +I_NotePrevious1: + + Mov AX, 1 + Ret + +EndP I_NotePrevious + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_NoteAll Far + + Assume DS:Nothing + + Call I_GetInstrumentOffset + Push DS + Pop ES + + LEA DI, [BX+40h] + + Mov CX, 120 + Mov AH, SampleNumber + Xor AL, AL + + +I_NoteAll1: + StosW + Inc AX + Loop I_NoteAll1 + + Sub DI, 110h + + MovZX BX, SampleNumber + Add BX, BX + JZ I_NoteAll2 + + Mov SI, [BX+64910] + Add SI, 14h + + Mov CX, 26 + Rep MovsB + +I_NoteAll2: + NetworkSendInstrument + + Mov AX, 1 + Ret + +EndP I_NoteAll + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_NoteInsert Far + + Assume DS:Nothing + + Call I_GetInstrumentOffset + Push DS + Pop ES + LEA DI, [BX+40h+120*2-2] + LEA SI, [DI-2] + Mov CX, 119 + + StD + Rep MovsW + Xor AX, AX + StosW + ClD + + NetworkSendInstrument + Mov AX, 1 + Ret + +EndP I_NoteInsert + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_NoteDelete Far + + Assume DS:Nothing + + Call I_GetInstrumentOffset + Push DS + Pop ES + LEA DI, [BX+40h] + LEA SI, [DI+2] + Mov CX, 119 + + Rep MovsW + Xor AX, AX + StosW + + NetworkSendInstrument + + Mov AX, 1 + Ret + +EndP I_NoteDelete + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_NoteTransposeUp Far + + Assume DS:Nothing + + Call I_GetInstrumentOffset + Push DS + Pop ES + + LEA DI, [BX+40h] + + Mov CX, 120 + +I_NoteTransposeUp1: + Mov AL, [DI] + Inc AX + Cmp AL, 119 + JBE I_NoteTransposeUp2 + + Mov AL, 119 + +I_NoteTransposeUp2: + StosB + Inc DI + Loop I_NoteTransposeUp1 + + NetworkSendInstrument + Mov AX, 1 + Ret + +EndP I_NoteTransposeUp + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_NoteTransposeDown Far + + Assume DS:Nothing + + Call I_GetInstrumentOffset + Push DS + Pop ES + + LEA DI, [BX+40h] + + Mov CX, 120 + +I_NoteTransposeDown1: + Mov AL, [DI] + Sub AL, 1 + AdC AL, 0 + StosB + Inc DI + Loop I_NoteTransposeDown1 + + NetworkSendInstrument + + Mov AX, 1 + Ret + +EndP I_NoteTransposeDown + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_NoteSpace Far + + Assume DS:Inst + Cmp NotePos, 2 + JB I_NoteSpace1 + + Mov SI, CurrentNote + Add SI, SI + + Call I_GetInstrumentOffset + Assume DS:Nothing + Mov AL, SampleNumber + Mov [BX+SI+41h], AL + + Jmp I_NoteDown + +I_NoteSpace1: + NetworkSendInstrument + Xor AX, AX + Ret + +EndP I_NoteSpace + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_ExchangeInstruments Far + + EnsureNoNetwork + + Mov DI, Offset O1_ExchangeInstrumentList + Call GetNumberInput + + Mov SI, DX + Dec SI + Add SI, SI + + Call PE_GetLastInstrument + Add BX, BX + + Cmp SI, BX + JE I_ExchangeInstruments1 + + Call Music_GetSongSegment + Mov ES, AX + Mov DS, AX + Mov DI, [DS:64712+BX] + Mov SI, [DS:64712+SI] ; DS:SI, ES:DI point to + ; sample headers + + Mov CX, 554 + +I_ExchangeInstruments2: + Mov AL, [ES:DI] + MovsB + Mov [DS:SI-1], AL + + Loop I_ExchangeInstruments2 + + Call I_MapEnvelope + +I_ExchangeInstruments1: + Mov AX, 1 + Ret + +EndP I_ExchangeInstruments + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_DoubleSampleSpeed Far + + Call I_GetSampleOffset + Mov EAX, [BX+3Ch] + ShL EAX, 1 + Cmp EAX, 9999999 + JA I_DoubleSampleSpeed1 + + Mov [BX+3Ch], EAX + +I_DoubleSampleSpeed1: + NetworkSendSample + + Mov AX, 1 + Ret + +EndP I_DoubleSampleSpeed + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_HalveSampleSpeed Far + + Call I_GetSampleOffset + ShR DWord Ptr [BX+3Ch], 1 + + NetworkSendSample + + Mov AX, 1 + Ret + +EndP I_HalveSampleSpeed + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_SampleSpeedSemiUp Far + + Call I_GetSampleOffset + + Mov EAX, 255392045 + Mul DWord Ptr [BX+3Ch] + + Add EDX, [BX+3Ch] + JC I_SampleSpeedSemiUp1 + + Mov [BX+3Ch], EDX + +I_SampleSpeedSemiUp1: + NetworkSendSample + + Mov AX, 1 + Ret + +EndP I_SampleSpeedSemiUp + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_SampleSpeedSemiDown Far + + Call I_GetSampleOffset + + Mov EAX, 4053909306 + Mul DWord Ptr [BX+3Ch] + Mov [BX+3Ch], EDX + + NetworkSendSample + + Mov AX, 1 + Ret + +EndP I_SampleSpeedSemiDown + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_ReplaceInstrument Far + + EnsureNoNetwork + + Mov DI, Offset O1_ReplaceInstrumentList + Call GetNumberInput + + Call PE_GetLastInstrument + Mov DH, BL + Inc DH ; DH/DL = samples to swap + + Cmp DL, DH + JE I_ReplaceInstrument1 + + Call Music_GetInstrumentMode + JZ I_ReplaceInstrument1 + + XChg DH, DL + Or DH, 80h + Call PE_SwapInstruments + +I_ReplaceInstrument1: + Mov AX, 1 + Ret + +EndP I_ReplaceInstrument + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_ScaleSampleVolumes Far + + EnsureNoNetwork + + Mov DI, Offset O1_GetInstrumentAmpList + Mov CX, 3 + Call M_Object1List + + Cmp DX, 1 + JNE I_ScaleSampleVolumesEnd + + Mov BP, CS:InstrumentAmplification + Mov BX, 100 + + Call Music_GetSongSegment + Mov DS, AX + Mov SI, 64912 + Mov CX, 99 + +I_ScaleSampleVolumes1: + Xor AX, AX + Mov DI, [SI] + Mov AL, [DI+11h] + Mul BP + Div BX + Cmp AX, 64 + JB I_ScaleSampleVolumes2 + + Mov AX, 64 + +I_ScaleSampleVolumes2: + Mov [DI+11h], AL + + Add SI, 2 + Dec CX + JNZ I_ScaleSampleVolumes1 + +I_ScaleSampleVolumesEnd: + Mov AX, 1 + Ret + +EndP I_ScaleSampleVolumes + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_ScaleInstrumentVolumes Far + + EnsureNoNetwork + + Mov DI, Offset O1_GetInstrumentAmpList + Mov CX, 3 + Call M_Object1List + + Cmp DX, 1 + JNE I_ScaleInstrumentVolumesEnd + + Mov BP, CS:InstrumentAmplification + Mov BX, 100 + + Call Music_GetSongSegment + Mov DS, AX + Mov SI, 64712 + Mov CX, 99 + +I_ScaleInstrumentVolumes1: + Xor AX, AX + Mov DI, [SI] + Mov AL, [DI+18h] + Mul BP + Div BX + Cmp AX, 128 + JB I_ScaleInstrumentVolumes2 + + Mov AX, 128 + +I_ScaleInstrumentVolumes2: + Mov [DI+18h], AL + + Add SI, 2 + Dec CX + JNZ I_ScaleInstrumentVolumes1 + +I_ScaleInstrumentVolumesEnd: + Mov AX, 1 + Ret + +EndP I_ScaleInstrumentVolumes + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_CopyInstrument Far + + Mov DI, Offset O1_CopyInstrumentList + Call GetNumberInput + + Call I_GetInstrumentOffset ; Gets DS:BX with cur inst. + + Mov DI, BX + Mov SI, DX + Add SI, SI + Mov SI, [64710+SI] + + Push DS + Pop ES + + Mov CX, 554/2 + Rep MovsW + + Call I_MapEnvelope + + NetworkSendInstrument + + Mov AX, 1 + Ret + +EndP I_CopyInstrument + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_SwapInstruments Far + + EnsureNoNetwork + + Mov DI, Offset O1_SwapInstrumentList + Call GetNumberInput + + Mov SI, DX +; Dec SI + Add SI, SI + + Call PE_GetLastInstrument + Mov DH, BL + Inc DH ; DH/DL = samples to swap + Add BX, BX + + Cmp DL, DH + JE I_SwapInstruments1 + + Call Music_GetSongSegment + Mov ES, AX + Mov DS, AX + Mov DI, [DS:64712+BX] + Mov SI, [DS:64710+SI] ; DS:SI, ES:DI point to + ; sample headers + + Mov CX, 554 + +I_SwapInstruments2: + Mov AL, [ES:DI] ; Swapping headers. + MovsB + Mov [DS:SI-1], AL + + Loop I_SwapInstruments2 + + ; Now to swap pattern + ; stuff... + Call Music_GetInstrumentMode + JZ I_SwapInstruments3 + + Call PE_SwapInstruments + +I_SwapInstruments3: + Call I_MapEnvelope + +I_SwapInstruments1: + Mov AX, 1 + Ret + +EndP I_SwapInstruments + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_UpdateInstrument Far + + EnsureNoNetwork + + Call PE_GetLastInstrument + Mov DX, BX + Inc DX + Add BX, BX + + Call Music_GetSongSegment + Mov ES, AX + Mov DI, [ES:64712+BX] + Add DI, 40h + + Call PE_UpdateInstruments + + Mov AX, 1 + Ret + +EndP I_UpdateInstrument + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MouseEnvelopeEvent1 Far + + Mov CS:MouseX, CX + Mov CS:MouseY, DX + + Mov CX, 8010h ; Envelope mouse control request.. + Call AddMouseQueue + + Xor AX, AX + Ret + +EndP MouseEnvelopeEvent1 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MouseEnvelopeEvent4 Far ; Delete node + + Test BH, 6 + JNZ MouseEnvelopeEvent4_1 + + Mov CS:MouseX, CX + Mov CS:MouseY, DX + + Mov CX, 8003h ; Envelope mouse control request.. + Call AddMouseQueue + +MouseEnvelopeEvent4_1: + Xor AX, AX + Ret + +EndP MouseEnvelopeEvent4 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MouseEnvelopeEvent2 Far ; Envelope drag + + Mov CS:MouseX, CX + Mov CS:MouseY, DX + + Mov CX, 8001h + Call AddMouseQueue + + Xor AX, AX + Ret + +EndP MouseEnvelopeEvent2 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MouseEnvelopeEvent3 Far ; Release envelope + + Mov CX, 8002h + Call AddMouseQueue + + Xor AX, AX + Ret + +EndP MouseEnvelopeEvent3 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DrawEnvelopeHeader ; AH = colour, DS = inst + Assume DS:Inst + + Mov SI, InstrumentScreen ; 1-3 + Add SI, SI ; 2-6 + Add SI, Word Ptr NodeHeld ; 2-7 + Add SI, SI ; 4-14 + Mov SI, [EnvelopeHeaderTable+SI-4] + Mov DI, (33+16*80)*2 + + Call S_DrawString + + Ret + +EndP DrawEnvelopeHeader + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_DrawEnvelope Far + + Push CS + Pop DS + Assume DS:Inst + + Mov AH, 20h + Call DrawEnvelopeHeader + + Call S_GetDestination + Mov DI, (32+18*80)*2 + Mov AX, 0C00h + + Mov DX, 8 + +I_DrawEnvelope1: + Mov CX, 32 + +I_DrawEnvelope2: + StosW + Inc AX + Loop I_DrawEnvelope2 + + Add DI, (80-32)*2 + Dec DX + JNZ I_DrawEnvelope1 + + Call I_GetEnvelopeOffset ; Returns DS:SI + Mov BX, CS:CurrentNode ; to envelope table + Mov CX, BX + + Add BX, BX + Add BX, CX ; BX = CurrentNode*3 + + Mov AL, [SI+BX+6] + CBW ; Value + + Test Byte Ptr [SI], 80h + JZ I_DrawEnvelope5 + + Add AX, 32 + +I_DrawEnvelope5: + Push AX + Push Word Ptr [SI+BX+7] ; Tick + Push CS:MaxNode + Push CX ; Node + + Mov DI, (66+19*80)*2 + Mov AH, 2 + Push CS + Pop DS + Mov SI, Offset EnvelopeMsg + Call S_DrawString + + Add SP, 8 + + Cmp MouseNodeHeld, 0 + JZ I_DrawEnvelope4 + + Call MouseGetStatus + Test AL, 6 + JNZ I_DrawEnvelope3 + + Call I_MouseEnvelopeReleased + Jmp I_DrawEnvelope4 + +I_DrawEnvelope3: + Mov SI, Offset EnvelopeEvent3 + Call MouseAddEvent + Mov SI, Offset EnvelopeEvent2 + Call MouseAddEvent + + Ret + +I_DrawEnvelope4: + Mov SI, Offset EnvelopeEvent1 + Call MouseAddEvent + Mov SI, Offset EnvelopeEvent4 + Call MouseAddEvent + + Ret + +EndP I_DrawEnvelope + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_PreEnvelope Far + + Push CS + Pop DS + + Mov AH, 23h + Call DrawEnvelopeHeader + + Ret + +EndP I_PreEnvelope + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_PostEnvelope Far + + Push CS + Pop DS + Assume DS:Inst + + Mov SI, Offset VolumeEnvelopeNodeKeys + + Cmp NodeHeld, 1 + JE I_PostEnvelope2 + + Mov SI, Offset VolumeEnvelopeKeys + +I_PostEnvelope2: + Call M_FunctionDivider + JC I_PostEnvelope1 + + Jmp [SI] + +I_PostEnvelope1: +IF ENABLEPRESETENVELOPES + + Cmp DX, '0' + JB I_PostEnvelopeNoPreset + Cmp DX, '9' + JA I_PostEnvelopeNoPreset + + Call I_GetEnvelopeOffset + Push DS + Pop ES + Mov DI, SI ; ES:DI set + + Push CS + Pop DS + Mov AL, 81 + Sub DL, '0' + Mul DL ; AX = offset + Mov SI, AX + Add SI, Offset PresetEnvelopes + + Mov CX, 6/2 + Rep MovsW + Mov CX, 25 + +I_PostEnvelopePreset1: + LodsB + Sub AL, AmplitudeCompensate + StosB + MovsW + Loop I_PostEnvelopePreset1 + + Call I_MapEnvelope + NetworkSendInstrument + + Mov AX, 1 + Ret + +I_PostEnvelopeNoPreset: + Test CH, 60h ; Alt? + JZ I_PostEnvelopeNoSet + Test CH, 1 ; On keypress + JZ I_PostEnvelopeNoSet + + Cmp CL, 2 + JB I_PostEnvelopeNoSet + Cmp CL, 0Bh + JA I_PostEnvelopeNoSet + JNE I_PostEnvelopeSet2 + + Mov CL, 1 + +I_PostEnvelopeSet2: + Mov AX, CX + Dec AX + And AX, 0FFh + Mov SI, Offset EnvelopeSetMsg + Call SetInfoLine + Mov CL, 81 + Mul CL + + Call I_GetEnvelopeOffset ; Gets DS:SI + Push CS + Pop ES + Mov DI, AX + Add DI, Offset PresetEnvelopes ; ES:DI points to dest + + LodsW + And AL, 7Fh + StosW + + Mov CX, 4/2 + Rep MovsW + Mov CX, 25 + +I_PostEnvelopeSet1: + LodsB + Add AL, CS:AmplitudeCompensate + StosB + MovsW + Loop I_PostEnvelopeSet1 + + Call I_MapEnvelope + + Mov AX, 1 + Ret + +I_PostEnvelopeNoSet: +ENDIF ; PRESETENVELOPES + Xor AX, AX + Ret + +EndP I_PostEnvelope + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_MapEnvelope Far + + Push CS + Pop DS + Assume DS:Inst + + Cmp InstrumentScreen, 0 + JNE I_MapEnvelope1 + + Ret + +I_MapEnvelope1: + Mov UpdateInstrumentScreen, 0 + + Push BP + + Call S_GetGenerationTableOffset + Push DI ; ES:DI points to table. + Mov CX, 32*8*8*8/4 + Xor EAX, EAX + Rep StosD + Pop DI + Push DI + + Add DI, 3 + Mov CX, 32 + Inc AX + +I_MapEnvelopeYAxis1: + StosB + Add DI, 511 + Loop I_MapEnvelopeYAxis1 + + Pop DI + Push DI + + Call I_GetEnvelopeOffset ; DS:SI points to envelope + Assume DS:Nothing + + Mov AL, 32 + + Add DI, 31*256 + + Test Byte Ptr [SI], 80h + JNZ I_MapEnvelopeFilterCompensate + Cmp Byte Ptr [CS:InstrumentScreen], 1 + JNE I_MapEnvelopeXAxis1 + + Xor AL, AL +I_MapEnvelopeFilterCompensate: + Add DI, 31*256 + +I_MapEnvelopeXAxis1: + Mov CS:AmplitudeCompensate, AL + + Mov AX, 100h + Mov CX, 128 + + Rep StosW ; X-axis drawn + + Pop DI + + Xor DH, DH + Mov DL, [SI+1] + + Mov CS:MaxNode, DX + Cmp CS:CurrentNode, DX + JB I_MapEnvelope2 + + Mov AX, DX + Sub AX, 1 + AdC AX, 0 + Mov CS:CurrentNode, AX + +I_MapEnvelope2: + Test DX, DX + JZ I_MapEnvelopeEnd + + Sub DX, 1 + AdC DX, 1 + + Push DX + + ; DX = last node + ; DS:SI = envelope, ES:DI = table + Mov BX, DX ; MaxNode + Add BX, BX + Add BX, DX ; BX = MaxNode*3 + + Mov AX, [DS:SI+BX+6+1-3] ; Get last nodes tick + Xor DX, DX + Mov BX, ENVELOPEGRANULARITY + Div BX + Inc AX + Mul BX + Mov CS:UpperLimit, AX + + Push DI + Xor BP, BP + Jmp I_MapEnvelope4 + +I_MapEnvelope3: + Push CX + Push DI + +I_MapEnvelope4: ; Node drawing part + Mov BX, BP + Add BX, BX + Add BX, BP + + Mov AL, 64 + Sub AL, CS:AmplitudeCompensate + Sub AL, [SI+BX+6] + Mov AH, 244 ; 244 = 61/64*256 + Mul AH + ; AX = amplitude + Mov CS:CurrentAmplitude, AX + Mov CX, AX ; CX = amplitude + + Mov AX, [SI+BX+7] + Cmp AX, CS:UpperLimit + JAE I_MapEnvelopeError + + Mov DX, 250 ; 249 if UpperLimit = LastNode tick + Mul DX +; Add AX, 125 +; AdC DX, 0 + Div CS:UpperLimit + + Mov CS:CurrentTick, AX + + ; OK.. plot points + Xor CL, CL + Add DI, AX + Add DI, CX + Add DI, 256+3 + + Mov AX, 101h + Mov [ES:DI], AX + Mov [ES:DI-256], AX + Mov [ES:DI+256], AX + Mov [ES:DI-1], AL + Mov [ES:DI-256-1], AL + Mov [ES:DI+256-1], AL + + Cmp BP, CS:CurrentNode + JNE I_MapEnvelope5 + + Dec AX + Mov [ES:DI+2], AX + Mov [ES:DI+256+2], AX + Mov [ES:DI-256+2], AX + XChg AH, AL + Mov [ES:DI-3], AX + Mov [ES:DI+256-3], AX + Mov [ES:DI-256-3], AX + +I_MapEnvelope5: + Sub DI, CX + Sub DI, 256 + Mov AX, BP + Mov CX, 64 + + Test Byte Ptr [SI], 2 + JZ I_MapEnvelope6 + + Mov AH, 1 + + Cmp AL, [SI+2] + JE I_MapEnvelopeLoop1 + Cmp AL, [SI+3] + JNE I_MapEnvelope6 + +I_MapEnvelopeLoop1: + Mov AL, AH + ShR AL, 1 + StosB + Add DI, 255 + Inc AH + Loop I_MapEnvelopeLoop1 + + Jmp I_MapEnvelope7 + +I_MapEnvelope6: + Test Byte Ptr [SI], 4 + JZ I_MapEnvelope7 + + Cmp AL, [SI+4] + JE I_MapEnvelopeSusLoop2 + Cmp AL, [SI+5] + JNE I_MapEnvelope7 + +I_MapEnvelopeSusLoop2: + Mov AL, 1 + +I_MapEnvelopeSusLoop1: + StosB + Add DI, 255 + Xor AL, 1 + Loop I_MapEnvelopeSusLoop1 + +I_MapEnvelope7: ; Now for line segment + Test BP, BP + JZ I_MapEnvelope8 ; Don't draw line for first node + + Pop DI + Push DI + + Add DI, CS:LastTick + Add DI, 103h + + Mov CX, CS:CurrentTick + Sub CX, CS:LastTick + JC I_MapEnvelope8 ; Error.. + JNZ I_MapEnvelope11 + + ; Vertical line. + Mov AX, CS:LastAmplitude + Mov CX, CS:CurrentAmplitude + Xor AL, AL + Xor CL, CL + + Add DI, AX ; LastAmplitude + + Mov DX, 256 + + Sub CX, AX + JNS I_MapEnvelope9 + + Neg DX + Neg CX + +I_MapEnvelope9: + ShR CX, 8 + JZ I_MapEnvelope12 + +I_MapEnvelope10: + Mov Byte Ptr [ES:DI], 1 + Add DI, DX + Loop I_MapEnvelope10 + +I_MapEnvelope12: + Jmp I_MapEnvelope8 + +I_MapEnvelope11: ; Diagonal line + Push SI + + Xor SI, SI + Mov AX, CS:CurrentAmplitude + Sub AX, CS:LastAmplitude + JNS I_MapEnvelope13 + + Inc SI ; SI = 1 if opp direction + Neg AX + +I_MapEnvelope13: + Xor DX, DX + Div CX + Mov DX, AX + + Test SI, SI + Mov SI, -256 + JZ I_MapEnvelope15 + + Neg SI + Neg DX + +I_MapEnvelope15: + Mov BX, CS:LastAmplitude + Inc CX + Dec DI + Push DI + Jmp I_MapEnvelope17 + +I_MapEnvelope14: + Push DI + Push BX + Xor BL, BL + Add DI, BX + +I_MapEnvelope16: + Mov Byte Ptr [ES:DI], 1 + Add DI, SI + Dec AL + JNZ I_MapEnvelope16 + + Pop BX + +I_MapEnvelope17: + Mov AL, BH + Add BX, DX + Sub AL, BH + + CBW ; + Xor AL, AH ; AL = |AL| + Sub AL, AH ; + Sub AL, 1 + AdC AL, 1 + + Pop DI + Inc DI + Loop I_MapEnvelope14 + + Pop SI + +I_MapEnvelope8: + Mov AX, CS:CurrentAmplitude + Mov BX, CS:CurrentTick + Mov CS:LastAmplitude, AX + Mov CS:LastTick, BX + +I_MapEnvelopeError: + Pop DI + Pop CX + Inc BP + Loop I_MapEnvelope3 + + ; Now shove on playing points. + + Call PE_GetLastInstrument + Inc BX + + Mov CX, CS:InstrumentScreen + Mov BP, CX + Mov DL, 1 + Add CL, 11 + ShL BP, 4 + ShL DX, CL + Add BP, 48h + + Call Music_GetSlaveChannelInformationTable + ; Returns DS:SI, CX + Assume DS:Nothing + +I_MapEnvelopePlaying1: + Cmp [SI+33h], BL + JNE I_MapEnvelopePlayingNext + + Test Byte Ptr [SI], 1 + JZ I_MapEnvelopePlayingNext + + Mov AX, [DS:SI+BP] + And AX, AX + JNZ I_MapEnvelopePlaying2 + + Test [SI], DX + JZ I_MapEnvelopePlayingNext + +I_MapEnvelopePlaying2: + Cmp AX, CS:UpperLimit + JAE I_MapEnvelopePlayingNext + + Push CX + Push DX + + Call S_GetGenerationTableOffset + Add DI, 3 + + Mov DX, 250 + Mul DX + Div CS:UpperLimit + + Add DI, AX + Mov CX, 64 + +I_DrawEnvelopePlaying1: + Mov Byte Ptr [ES:DI], 1 + Add DI, 256 + Loop I_DrawEnvelopePlaying1 + + Mov CS:UpdateInstrumentScreen, 1 + + Pop DX + Pop CX + +I_MapEnvelopePlayingNext: + Add SI, SLAVECHANNELSIZE + Loop I_MapEnvelopePlaying1 + +I_MapEnvelopeEnd: + Xor AX, AX + Mov BX, 32 + Mov CX, 8 + Call S_GenerateCharacters + + Pop BP + + Push CS + Pop DS + + Ret + +EndP I_MapEnvelope + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_GetMouseNode ; Returns DI, carry if none + + Call I_GetEnvelopeOffset + ; Returns DS:SI to envelope + Xor CH, CH + Mov CL, [SI+1] + + Add SI, 6 ; Start of envelope.. have to find + ; a point that fits MouseX, MouseY + ; XPixel = ENVELOPELEFT*8 + 250*Tick/UpperLimit + 3 + ; YPixel = ENVELOPETOP*8 + 61*(64-AmplitudeCompensate-Amplitude)/64 + 1 + + Xor DI, DI ; DI = node number. + JCXZ I_GetMouseNode3 + +I_GetMouseNode1: + Mov BX, DI + Add BX, BX + Add BX, DI + + Mov AX, 250 + Mul Word Ptr [SI+BX+1] + Div CS:UpperLimit + Add AX, ENVELOPELEFT*8+2 + + Mov DL, 64 + Sub DL, CS:AmplitudeCompensate + Sub DL, [SI+BX] + + Mov BX, AX ; BX = XPixel + + Mov AL, 244 ; 244 = 61/64*256 + Mul DL + Mov AL, AH + Xor AH, AH + Add AX, ENVELOPETOP*8 ; AX = YPixel of node... + + Cmp MouseX, BX + JB I_GetMouseNode2 + Cmp MouseY, AX + JB I_GetMouseNode2 + Add AX, 2 + Add BX, 2 + Cmp MouseX, BX + JA I_GetMouseNode2 + Cmp MouseY, AX + JA I_GetMouseNode2 + +I_GetMouseNode3: + ClC + Ret + +I_GetMouseNode2: + Inc DI + Cmp DI, CX + JB I_GetMouseNode1 + + StC + Ret + +EndP I_GetMouseNode + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_MouseEnvelopeDelete Far + + Call I_GetMouseNode + JC I_MouseEnvelopeDelete1 + Mov CS:CurrentNode, DI + + Push CS + Pop DS + Jmp I_VolumeEnvelopeDelete + +I_MouseEnvelopeDelete1: + Mov AX, 1 + Ret + +EndP I_MouseEnvelopeDelete + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_MouseEnvelopePress Far + Assume DS:Nothing + ; If on top of node, then pick up this + ; node, ; MouseNodeHeld = 1 + ; If NOT near node, and nodes < 25, + ; then CREATE new node in appropriate + ; position, MouseNodeHeld = 1. If + ; no node will fit in-between, then + ; do nothing. + ; Else nothing + Call I_GetMouseNode + JNC I_MouseEnvelopeNodeFound1 + Cmp CX, 25 + JAE I_MouseEnvelopePressError + + ; Figger out envelope tick position... + Mov AX, MouseX + Sub AX, ENVELOPELEFT*8+3 + JNC I_MouseEnvelopeCreateNode4 + + Xor AX, AX + +I_MouseEnvelopeCreateNode4: + Mov BX, 250 + Mul CS:UpperLimit + Add AX, 125 + AdC DX, 0 + Div BX + + Mov CX, AX ; CX = new position.... + Cmp AX, MAXENVELOPETICK + JB I_MouseEnvelopeCreateNode3 + + Mov CX, MAXENVELOPETICK + +I_MouseEnvelopeCreateNode3: + Call I_GetEnvelopeOffset + Mov DL, [SI+1] + Mov BX, SI + Xor DH, DH + Xor DI, DI + Add BX, 7 + +I_MouseEnvelopeCreateNode1: + Cmp CX, [BX] + JE I_MouseEnvelopePressError + JB I_MouseEnvelopeCreateNode2 + + Add BX, 3 + Inc DI + Cmp DI, DX + JB I_MouseEnvelopeCreateNode1 + +I_MouseEnvelopeCreateNode2: + ClI + + Inc Byte Ptr [SI+1] + + Push BX + Push CX + Push DI + + Mov CX, DI + Cmp CL, [SI+2] + JA I_MEPIns1 + + Inc Byte Ptr [SI+2] + +I_MEPIns1: + Cmp CL, [SI+3] + JA I_MEPIns2 + + Inc Byte Ptr [SI+3] + +I_MEPIns2: + Cmp CL, [SI+4] + JA I_MEPIns3 + + Inc Byte Ptr [SI+4] + +I_MEPIns3: + Cmp CL, [SI+5] + JA I_MEPIns4 + + Inc Byte Ptr [SI+5] + +I_MEPIns4: + + Push DS + Pop ES + + StD + + Sub DX, DI + Mov CX, DX + Add CX, CX + Add CX, DX ; CX = (Last-New)*3 + + LEA DI, [BX+1] + Add DI, CX + LEA SI, [DI-3] + + Rep MovsB + + ClD + + Pop DI + Pop CX + Pop BX + + Mov [BX], CX + + Mov CX, 61 + Mov AX, MouseY + Sub AX, ENVELOPETOP*8 + JNC I_MEPChk1 + + Xor AX, AX + +I_MEPChk1: + Cmp AX, CX + JB I_MepChk2 + + Mov AX, CX + +I_MEPChk2: + ShL AX, 6 + Xor DX, DX + Div CX + + Mov DL, 64 + Sub DL, AL + Sub DL, CS:AmplitudeCompensate + Mov [BX-1], DL + +I_MouseEnvelopeNodeFound1: ; Have to find limits... + Mov CurrentNode, DI + Call I_EnvelopeSelected + + StI + + Mov BX, DI + Mov CL, BL + Inc CX + Add BX, BX + Add BX, DI + ; AX = lower limit, DX = upper limit + Xor AX, AX + Xor DX, DX + And DI, DI + JZ I_MouseEnvelopeNodeFound3 + + Mov DX, MAXENVELOPETICK + Mov AX, [SI+BX+6+1-3] + Inc AX + +I_MouseEnvelopeNodeFound2: + Cmp CL, [SI+1] + JAE I_MouseEnvelopeNodeFound3 + + Mov DX, [SI+BX+6+1+3] + Dec DX + +I_MouseEnvelopeNodeFound3: + Mov LowerTickLimit, AX + Mov UpperTickLimit, DX + + Mov BX, 2 + Call SetMouseCursorType + + Mov AX, 1 + Mov MouseNodeHeld, AL + Call SetKeyboardLock + Jmp I_MousePressChain + +I_MouseEnvelopePressError: + Mov AX, 1 + Ret + +EndP I_MouseEnvelopePress + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_MouseEnvelopeDrag Far + Assume DS:Nothing + ; CurrentNode update + + Call I_GetEnvelopeOffset + ; Returns DS:SI to envelope + Mov AX, CurrentNode + Mov BX, AX + Add BX, BX + Add BX, AX + LEA SI, [SI+BX+6] ; DS:SI points to current node + + ; Tick first + Mov AX, MouseX + Sub AX, ENVELOPELEFT*8+3 + JNC I_MouseEnvelopeDrag1 + + Xor AX, AX + +I_MouseEnvelopeDrag1: + Mov BX, 250 + Mul CS:UpperLimit + Add AX, 125 + AdC DX, 0 + Div BX + ; AX = tick.. now to check bounds.. + Cmp AX, LowerTickLimit + JAE I_MouseEnvelopeDrag2 + + Mov AX, LowerTickLimit + +I_MouseEnvelopeDrag2: + Cmp AX, UpperTickLimit + JBE I_MouseEnvelopeDrag3 + + Mov AX, UpperTickLimit + +I_MouseEnvelopeDrag3: + ClI + + Mov [SI+1], AX + + Mov AX, MouseY + Mov CX, 61 + Sub AX, ENVELOPETOP*8 + JNC I_MouseEnvelopeDrag4 + + Xor AX, AX + +I_MouseEnvelopeDrag4: + Cmp AX, CX + JBE I_MouseEnvelopeDrag5 + + Mov AX, CX + +I_MouseEnvelopeDrag5: + ShL AX, 6 + Xor DX, DX + Div CX + + Mov DL, 64 + Sub DL, AL + Sub DL, CS:AmplitudeCompensate + Mov [SI], DL + + StI + + ; XPixel = ENVELOPELEFT*8 + 250*Tick/UpperLimit + 3 + ; YPixel = ENVELOPETOP*8 + 61*(64-AmplitudeCompensate-Amplitude)/64 + 1 + +I_MousePressChain: + Push CS:UpperLimit + Call I_RedrawWave + Pop AX + Cmp AX, CS:UpperLimit + JE I_GetMousePositionEnd + + ; Set position.... + Call I_GetEnvelopeOffset + Mov AX, CS:CurrentNode + Add SI, AX + Add SI, AX + Add SI, AX + Add SI, 6 + + Mov AX, 250 + Mul Word Ptr [SI+1] + Div CS:UpperLimit + Add AX, ENVELOPELEFT*8-1 ; +3 + Mov CX, AX + + Xor DX, DX + Mov AL, 64 + Sub AL, CS:AmplitudeCompensate + Sub AL, [SI] + Mov AH, 244 + Mul AH + Mov DL, AH + + Add DX, ENVELOPETOP*8-2 ; +1 + Call MouseSetXY + +I_GetMousePositionEnd: + NetworkSendInstrument + + Mov AX, 1 + Ret + +EndP I_MouseEnvelopeDrag + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_MouseEnvelopeReleased Far + Assume DS:Inst + ; MouseNodeHeld = 0 + + Xor BX, BX + Call SetMouseCursorType + + Xor AX, AX + Mov CS:MouseNodeHeld, AL + Call SetKeyboardLock + + NetworkSendInstrument + + Mov AX, 1 + Ret + +EndP I_MouseEnvelopeReleased + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_VolumeEnvelopeRight Far + + Assume DS:Inst + + Mov AX, CurrentNode + Inc AX + Cmp AX, MaxNode + JAE I_VolumeEnvelopeRight1 + + Mov CurrentNode, AX + Call I_MapEnvelope + +I_VolumeEnvelopeRight1: + Mov AX, 1 + Ret + +EndP I_VolumeEnvelopeRight + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_VolumeEnvelopeLeft Far + + Assume DS:Inst + + Cmp CurrentNode, 0 + JE I_VolumeEnvelopeLeft1 + + Dec CurrentNode + Call I_MapEnvelope + +I_VolumeEnvelopeLeft1: + Mov AX, 1 + Ret + +EndP I_VolumeEnvelopeLeft + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_VolumeEnvelopeUp Far + + Mov Word Ptr [ES:DI], 5 + + Mov AX, 1 + Ret + +EndP I_VolumeEnvelopeUp + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_VolumeEnvelopeDown Far + + Mov Word Ptr [ES:DI], 17 + + Mov AX, 1 + Ret + +EndP I_VolumeEnvelopeDown + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_VolumeEnvelopeHeldUp Far + + Assume DS:Inst + + Mov CX, CurrentNode + + Call I_GetEnvelopeOffset + Assume DS:Nothing + + Add SI, CX + Add SI, CX + Add SI, CX + Add SI, 6 + + Mov AL, [SI] + Add AL, CS:AmplitudeCompensate + + Cmp AL, 64 + JAE I_VolumeEnvelopeHeldUp1 + + Inc Byte Ptr [SI] + + Call I_MapEnvelope + NetworkSendInstrument + +I_VolumeEnvelopeHeldUp1: + Mov AX, 1 + Ret + +EndP I_VolumeEnvelopeHeldUp + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_VolumeEnvelopeHeldDown Far + + Assume DS:Inst + + Mov CX, CurrentNode + + Call I_GetEnvelopeOffset + Assume DS:Nothing + + Add SI, CX + Add SI, CX + Add SI, CX + Add SI, 6 + + Mov AL, [SI] + Add AL, CS:AmplitudeCompensate + + JZ I_VolumeEnvelopeHeldDown1 + + Dec Byte Ptr [SI] + + Call I_MapEnvelope + NetworkSendInstrument + +I_VolumeEnvelopeHeldDown1: + Mov AX, 1 + Ret + +EndP I_VolumeEnvelopeHeldDown + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_VolumeEnvelopeHeldLeft Far + + Assume DS:Inst + + Mov CX, CurrentNode + Mov DX, CX + Add DX, DX + JZ I_VolumeEnvelopeHeldLeft1 + + Call I_GetEnvelopeOffset + Assume DS:Nothing + + Add SI, CX + Add SI, DX + Add SI, 7 ; DS:SI points to node's posn + + Mov AX, [SI] + + Dec AX + Cmp AX, [SI-3] ; Last node. + JE I_VolumeEnvelopeHeldLeft1 + + Mov [SI], AX + + Call I_MapEnvelope + NetworkSendInstrument + +I_VolumeEnvelopeHeldLeft1: + Mov AX, 1 + Ret + +EndP I_VolumeEnvelopeHeldLeft + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_VolumeEnvelopeHeldLeftFast Far + + Assume DS:Inst + + Mov CX, CurrentNode + Mov DX, CX + Add DX, DX + JZ I_VolumeEnvelopeHeldLeftFast2 + + Call I_GetEnvelopeOffset + Assume DS:Nothing + + Add SI, CX + Add SI, DX + Add SI, 7 + + Mov AX, [SI] + + Sub AX, 16 + JNC I_VolumeEnvelopeHeldLeftFast3 + + Xor AX, AX + +I_VolumeEnvelopeHeldLeftFast3: + Cmp AX, [SI-3] ; Last node. + JA I_VolumeEnvelopeHeldLeftFast1 + + Mov AX, [SI-3] + Inc AX + +I_VolumeEnvelopeHeldLeftFast1: + Mov [SI], AX + + Call I_MapEnvelope + NetworkSendInstrument + +I_VolumeEnvelopeHeldLeftFast2: + Mov AX, 1 + Ret + +EndP I_VolumeEnvelopeHeldLeftFast + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_VolumeEnvelopeHeldHome Far + + Assume DS:Inst + + Mov CX, CurrentNode + Mov DX, CX + Add DX, DX + JZ I_VolumeEnvelopeHeldHome1 + + Call I_GetEnvelopeOffset + Assume DS:Nothing + + Add SI, CX + Add SI, DX + Add SI, 7 + + Mov AX, [SI-3] + Inc AX + Mov [SI], AX + + Call I_MapEnvelope + NetworkSendInstrument + +I_VolumeEnvelopeHeldHome1: + Mov AX, 1 + Ret + +EndP I_VolumeEnvelopeHeldHome + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_VolumeEnvelopeHeldRight Far + + Assume DS:Inst + + Mov CX, CurrentNode + Mov DX, CX + Add DX, DX + JZ I_VolumeEnvelopeHeldRight1 + + Call I_GetEnvelopeOffset + Assume DS:Nothing + + Add SI, CX + Add SI, DX + Add SI, 7 + + Mov AX, [SI] + Cmp AX, MAXENVELOPETICK + JAE I_VolumeEnvelopeHeldRight1 + + Inc AX + Inc CX + Cmp CX, CS:MaxNode + JE I_VolumeEnvelopeHeldRight2 + + Cmp AX, [SI+3] ; Last node. + JE I_VolumeEnvelopeHeldRight1 + +I_VolumeEnvelopeHeldRight2: + Mov [SI], AX + + Call I_MapEnvelope + NetworkSendInstrument + +I_VolumeEnvelopeHeldRight1: + Mov AX, 1 + Ret + +EndP I_VolumeEnvelopeHeldRight + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_VolumeEnvelopeHeldEnd Far + + Assume DS:Inst + + Mov CX, CurrentNode + Mov DX, CX + Add DX, DX + JZ I_VolumeEnvelopeHeldEnd1 + + Call I_GetEnvelopeOffset + Assume DS:Nothing + + Add SI, CX + Add SI, DX + Add SI, 7 + + + Mov AX, MAXENVELOPETICK + Inc CX + Cmp CX, CS:MaxNode + JE I_VolumeEnvelopeHeldEnd2 + + Mov AX, [SI+3] + Dec AX + +I_VolumeEnvelopeHeldEnd2: + Mov [SI], AX + + Call I_MapEnvelope + NetworkSendInstrument + +I_VolumeEnvelopeHeldEnd1: + Mov AX, 1 + Ret + +EndP I_VolumeEnvelopeHeldEnd + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_VolumeEnvelopeHeldRightFast Far + + Assume DS:Inst + + Mov CX, CurrentNode + Mov DX, CX + Add DX, DX + JZ I_VolumeEnvelopeHeldRightFast1 + + Call I_GetEnvelopeOffset + Assume DS:Nothing + + Add SI, CX + Add SI, DX + Add SI, 7 + + Mov AX, [SI] + + Add AX, 16 + Inc CX + Cmp CX, CS:MaxNode + JE I_VolumeEnvelopeHeldRightFast3 + + Cmp AX, [SI+3] + JB I_VolumeEnvelopeHeldRightFast2 + + Mov AX, [SI+3] + Dec AX + +I_VolumeEnvelopeHeldRightFast3: + Cmp AX, MAXENVELOPETICK + JBE I_VolumeEnvelopeHeldRightFast2 + + Mov AX, MAXENVELOPETICK + +I_VolumeEnvelopeHeldRightFast2: + Mov [SI], AX + + Call I_MapEnvelope + NetworkSendInstrument + +I_VolumeEnvelopeHeldRightFast1: + Mov AX, 1 + Ret + +EndP I_VolumeEnvelopeHeldRightFast + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_VolumeEnvelopeHeldPgDn Far + + Assume DS:Inst + + Mov CX, CurrentNode + Mov AH, AmplitudeCompensate + + Call I_GetEnvelopeOffset + Assume DS:Nothing + + Add SI, CX + Add SI, CX + Add SI, CX + Add SI, 6 + + Mov AL, [SI] + Add AL, AH + Sub AL, 8 + JNS I_VolumeEnvelopeHeldPgDn1 + + Xor AL, AL + +I_VolumeEnvelopeHeldPgDn1: + Sub AL, AH + Mov [SI], AL + + Call I_MapEnvelope + NetworkSendInstrument + + Mov AX, 1 + Ret + +EndP I_VolumeEnvelopeHeldPgDn + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_VolumeEnvelopeHeldPgUp Far + + Assume DS:Inst + + Mov CX, CurrentNode + Mov AH, AmplitudeCompensate + + Call I_GetEnvelopeOffset + Assume DS:Nothing + + Add SI, CX + Add SI, CX + Add SI, CX + Add SI, 6 + + Mov AL, [SI] + Add AL, AH + Add AL, 8 + Cmp AL, 64 + JBE I_VolumeEnvelopeHeldPgUp1 + + Mov AL, 64 + +I_VolumeEnvelopeHeldPgUp1: + Sub AL, AH + Mov [SI], AL + + Call I_MapEnvelope + NetworkSendInstrument + + Mov AX, 1 + Ret + +EndP I_VolumeEnvelopeHeldPgUp + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_VolumeEnvelopeInsert Far + Assume DS:Inst + + Mov DX, CurrentNode + + Inc DX + Mov CX, MaxNode + Cmp DX, CX + JE I_VolumeEnvelopeInsert1 + + Mov DI, CX + Sub CX, DX + + Cmp DI, 25 + JE I_VolumeEnvelopeInsert1 + + Call I_GetEnvelopeOffset ; DS:SI + Assume DS:Nothing + + LEA BX, [SI+6] + Add BX, DX + Add BX, DX + Add BX, DX + Mov AX, [BX+1] + Sub AX, [BX-2] + Cmp AX, 2 + JB I_VolumeEnvelopeInsert1 + + ClI + + Inc Byte Ptr [SI+1] + + Mov BX, DI + Add BX, BX + Add BX, DI + LEA BX, [BX+SI+6] + +I_VolumeEnvelopeInsert2: + Mov AX, [BX-3] + Mov [BX], AX + Mov AL, [BX-1] + Mov [BX+2], AL + + Sub BX, 3 + Loop I_VolumeEnvelopeInsert2 + + Mov AX, [BX+4] + Add AX, [BX-2] + ShR AX, 1 + Mov [BX+1], AX + + Mov AH, CS:AmplitudeCompensate + Mov AL, [BX+3] + Add AL, [BX-3] + Add AL, AH + Add AL, AH + ShR AL, 1 + Sub AL, AH + Mov [BX], AL + + Mov CL, Byte Ptr CS:CurrentNode + Cmp CL, [SI+2] + JAE I_VolumeEnvelopeInsert4 + + Inc Byte Ptr [SI+2] + +I_VolumeEnvelopeInsert4: + Cmp CL, [SI+3] + JAE I_VolumeEnvelopeInsert5 + + Inc Byte Ptr [SI+3] + +I_VolumeEnvelopeInsert5: + Cmp CL, [SI+4] + JAE I_VolumeEnvelopeInsert6 + + Inc Byte Ptr [SI+4] + +I_VolumeEnvelopeInsert6: + Cmp CL, [SI+5] + JAE I_VolumeEnvelopeInsert7 + + Inc Byte Ptr [SI+5] + +I_VolumeEnvelopeInsert7: + StI + + Call I_MapEnvelope + NetworkSendInstrument + +I_VolumeEnvelopeInsert1: + Mov AX, 1 + Ret + +EndP I_VolumeEnvelopeInsert + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_VolumeEnvelopeDelete Far + + Assume DS:Inst + + Mov DX, CurrentNode + Mov DI, DX + Add DI, DI + Add DI, DX ; DI = CurrentNode*3 + JZ I_VolumeEnvelopeDelete1 + + Mov CX, MaxNode + Cmp CX, 2 + JBE I_VolumeEnvelopeDelete1 + + Call I_GetEnvelopeOffset ; Returns DS:SI + Assume DS:Nothing + + ClI + + Dec Byte Ptr [SI+1] + + Mov BX, SI + LEA SI, [BX+DI+6] + + Sub CX, DX + Dec CX + JZ I_VolumeEnvelopeDelete11 + +I_VolumeEnvelopeDelete2: + Mov AL, [SI+3] + Mov [SI], AL + Mov AX, [SI+4] + Mov [SI+1], AX + + Add SI, 3 + Loop I_VolumeEnvelopeDelete2 + +I_VolumeEnvelopeDelete11: + Xor AX, AX ; Neatness.. clear ending + Mov [SI], AX + Mov [SI+2], AL + ; Ok.. check loop stuff + Mov DL, [BX+1] + Dec DX ; DL = number of nodes + Mov DH, Byte Ptr CS:CurrentNode + + Cmp DH, [BX+2] + JAE I_VolumeEnvelopeDelete7 + + Dec Byte Ptr [BX+2] + +I_VolumeEnvelopeDelete7: + Cmp DH, [BX+3] + JAE I_VolumeEnvelopeDelete8 + + Dec Byte Ptr [BX+3] + +I_VolumeEnvelopeDelete8: + Cmp DH, [BX+4] + JAE I_VolumeEnvelopeDelete9 + + Dec Byte Ptr [BX+4] + +I_VolumeEnvelopeDelete9: + Cmp DH, [BX+5] + JAE I_VolumeEnvelopeDelete10 + + Dec Byte Ptr [BX+5] + +I_VolumeEnvelopeDelete10: + Cmp DL, [BX+2] + JAE I_VolumeEnvelopeDelete3 + + Mov [BX+2], DL + +I_VolumeEnvelopeDelete3: + Cmp DL, [BX+3] + JAE I_VolumeEnvelopeDelete4 + + Mov [BX+3h], DL + +I_VolumeEnvelopeDelete4: + Cmp DL, [BX+4] + JAE I_VolumeEnvelopeDelete5 + + Mov [BX+4], DL + +I_VolumeEnvelopeDelete5: + Cmp DL, [BX+5] + JAE I_VolumeEnvelopeDelete6 + + Mov [BX+5], DL + +I_VolumeEnvelopeDelete6: + StI + Call I_MapEnvelope + +I_VolumeEnvelopeDelete1: + NetworkSendInstrument + + Mov AX, 1 + Ret + +EndP I_VolumeEnvelopeDelete + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_EnvelopeSelected + + Call I_GetEnvelopeOffset ; Returns DS:SI + +IF FILTERENVELOPES + Cmp CS:InstrumentScreen, 3 + JNE I_MouseEnvelopeNoFilter + + Test Byte Ptr [SI], 1 + JNZ I_MouseEnvelopeNoFilter + + Or Byte Ptr [SI], 80h + +I_MouseEnvelopeNoFilter: +ELSE + And Byte Ptr [SI], 7Fh ; Turn of filters. + +ENDIF + + Or Byte Ptr [SI], 1 ; Turn on envelope + Ret + +EndP I_EnvelopeSelected + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_VolumeEnvelopeEnter Far + + Assume DS:Inst + + Xor NodeHeld, 1 + JZ I_VolumeEnvelopeEnter1 + + Call I_EnvelopeSelected + +I_VolumeEnvelopeEnter1: + Mov AX, 1 + Ret + +EndP I_VolumeEnvelopeEnter + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_InstrumentListSpace Far + + Push CS + Pop DS + Assume DS:Inst + + Cmp NoteReleased, 1 + JNE I_InstrumentSpace1 + + Mov NoteReleased, 0 + Mov SI, Offset NoteData + Call PE_GetLastInstrument + Mov AH, BL + Inc AH + Mov AL, PlayNote + Mov [SI], AX + Mov AX, PlayChannel + Mov DH, 32+128 + Call Music_PlayNote + +I_InstrumentSpace1: + Mov AX, 1 + Ret + +EndP I_InstrumentListSpace + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_InstrumentListNoteOff Far + + Push CS + Pop DS + Assume DS:Inst + + Mov NoteReleased, 1 + Mov SI, Offset NoteData + Mov Word Ptr [SI], 255 + Mov AX, PlayChannel + Mov DH, 32+128 + Call Music_PlayNote + + Mov AX, 1 + Ret + +EndP I_InstrumentListNoteOff + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_ShowSamplePlay Far + ; Clear table first. + + Push CS + Pop DS + ; DS = Inst + Mov SI, Offset SamplePlayTable + Mov CX, 100 + +I_ShowSamplePlayClearTable: + And Byte Ptr [SI], Not 3 + Inc SI + Loop I_ShowSamplePlayClearTable + + Call Music_GetSlaveChannelInformationTable + ; DS:SI points to table. + ; CX = numchannels. + Xor BH, BH + +I_ShowSamplePlay1: + Mov AX, [SI] + Test AL, 1 ; Is channel on? + JZ I_ShowSamplePlay2 + + Test AH, 8 ; Is it muted? + JNZ I_ShowSamplePlay2 + + Mov BL, [SI+36h] + Cmp BL, 100 + JAE I_ShowSamplePlay2 + + Or [CS:SamplePlayTable+BX], 1 ; Show sample is on. + + Cmp DWord Ptr [SI+2Ch], 0 + JNE I_ShowSamplePlay2 + + Or [CS:SamplePlayTable+BX], 2 + +I_ShowSamplePlay2: + Add SI, SLAVECHANNELSIZE + Loop I_ShowSamplePlay1 + + ; OK.. now to dump the stuff + ; onscreen + + Mov BX, TopSample + Dec BX + Mov SI, Offset SamplePlayTable + + Jmp I_ShowInstrumentPlay5 + +EndP I_ShowSamplePlay + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_ShowInstrumentPlay Far + ; Clear table first. + + Call Music_GetInstrumentMode + JZ I_ShowInstrumentPlayEnd + + Push CS + Pop DS + ; DS = Inst + Mov SI, Offset InstrumentPlayTable + Mov CX, 100 + +I_ShowInstrumentPlayClearTable: + And Byte Ptr [SI], Not 3 + Inc SI + Loop I_ShowInstrumentPlayClearTable + + Call Music_GetSlaveChannelInformationTable + ; DS:SI points to table. + ; CX = numchannels. + Xor BH, BH + +I_ShowInstrumentPlay1: + Mov AX, [SI] + Test AL, 1 ; Is channel on? + JZ I_ShowInstrumentPlay2 + + Test AH, 8 ; Is it muted? + JNZ I_ShowInstrumentPlay2 + + Mov BL, [SI+33h] + Cmp BL, 100 + JAE I_ShowInstrumentPlay2 + + Or [CS:InstrumentPlayTable+BX], 1 ; Show sample is on. + + Cmp DWord Ptr [SI+2Ch], 0 + JNE I_ShowInstrumentPlay2 + + Or [CS:InstrumentPlayTable+BX], 2 + +I_ShowInstrumentPlay2: + Add SI, SLAVECHANNELSIZE + Loop I_ShowInstrumentPlay1 + + ; OK.. now to dump the stuff + ; onscreen + + Mov BX, TopInstrument + Mov SI, Offset InstrumentPlayTable + +I_ShowInstrumentPlay5: + Call S_GetDestination + + Mov CX, 35 + Mov DI, (1+13*80)*2 + +I_ShowInstrumentPlay3: + Mov AX, 2100h + + Mov DL, [CS:SI+BX] + + Cmp DL, 0 ; No dot. + JE I_ShowInstrumentPlay4 + + Mov AL, 173 + + Cmp DL, 4 ; Dark small dot + JE I_ShowInstrumentPlay4 + + Mov AH, 23h + + Test DL, 2 ; Small bright dot + JZ I_ShowInstrumentPlay4 + + Mov AL, 183 ; Large bright dot. + +I_ShowInstrumentPlay4: + StosW + + Add DI, 158 + Inc BX + Loop I_ShowInstrumentPlay3 + +I_ShowInstrumentPlayEnd: + Ret + + +EndP I_ShowInstrumentPlay + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_ClearTables Far + + Push CS + Pop ES + + Mov DI, Offset SamplePlayTable + Mov CX, 128 + + Xor AX, AX + Rep StosW + + Ret + +EndP I_ClearTables + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_TagInstrument Far + + Mov Byte Ptr [CS:InstrumentPlayTable+BX], 4 + Ret + +EndP I_TagInstrument + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_TagSample Far + + Mov Byte Ptr [CS:SamplePlayTable+BX], 4 + Ret + +EndP I_TagSample + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MIDI_PlaySample Far + + Push CS + Pop DS + Assume DS:Inst + + Test DH, DH + JNZ MIDI_PlaySample1 + + Jmp MIDI_NoteOff2 + +MIDI_PlaySample1: + Call Music_GetNumChannels ; Into AX + Mov DI, AX + Mov AX, PlayChannel + Call MIDI_AllocateChannel + + Call PE_GetLastInstrument + Mov CX, AX + Mov AL, DL + Mov AH, BL + Inc AH + Call Music_PlaySample + +MIDI_PlaySample2: + Mov AX, 1 + Ret + +EndP MIDI_PlaySample + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_PlaySample Far + + Mov AX, Pattern + Mov DS, AX + Assume DS:Pattern + + Mov AH, LastInstrument + Mov AL, CS:LastPlaySample + + Mov CX, CS:PlayChannel + Call Music_PlaySample + + Xor AX, AX + Ret + +EndP I_PlaySample + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_IncreasePlayChannel Far + + Push CS + Pop DS + Assume DS:Inst + + Mov AX, PlayChannel + Cmp AX, 63 + JAE I_IncreasePlayChannel1 + + Inc AX + +I_IncreasePlayChannel1: + Mov PlayChannel, AX + + Inc AX + Mov SI, Offset PlayChannelMsg + + Call SetInfoLine + + Mov AX, 1 + Ret + +EndP I_IncreasePlayChannel + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_DecreasePlayChannel Far + + Push CS + Pop DS + Assume DS:Inst + + Mov AX, PlayChannel + And AX, AX + JZ I_DecreasePlayChannel1 + + Dec AX + +I_DecreasePlayChannel1: + Mov PlayChannel, AX + + Inc AX + Mov SI, Offset PlayChannelMsg + + Call SetInfoLine + + Mov AX, 1 + Ret + +EndP I_DecreasePlayChannel + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc UpdateMultiChannel + + Cmp CS:MultiChannel, 0 + JE UpdateMultiChannel1 + + Push AX + Push BX + Push DS + Push SI + Assume DS:Inst + + Push CS + Pop DS + + Call Music_GetNumChannels ; Into AX + Mov BX, PlayChannel + Inc BX + Cmp BX, AX + JB UpdateMultiChannel2 + + Xor BX, BX + +UpdateMultiChannel2: + Mov PlayChannel, BX + Mov AX, BX + Inc AX + + Mov SI, Offset PlayChannelMsg + Call SetInfoLine + + Pop SI + Pop DS + Pop BX + Pop AX + +UpdateMultiChannel1: + Ret + +EndP UpdateMultiChannel + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_ToggleMultiChannel Far + + Push CS + Pop DS + Assume DS:Inst + + Mov SI, Offset MultiChannelEnabledMsg + Xor MultiChannel, 1 + JNZ I_ToggleMultiChannel1 + + Mov SI, Offset MultiChannelDisabledMsg + +I_ToggleMultiChannel1: + Call SetInfoLine + + Mov AX, 1 + Ret + +EndP I_ToggleMultiChannel + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_DrawPitchPanCenter Far + + Call S_GetDestination + Call I_GetInstrumentOffset ; Returns DS:BX + Mov DI, (54+45*80)*2 + + Mov AL, [BX+17h] + Mov CL, 12 + Xor AH, AH + Xor BH, BH + + Div CL + ; AL = octave, AH = note + Mov BL, AH + Mov DL, AL + Add BX, BX + Add DL, '0' + + Mov AH, 2 + Mov AL, [CS:NoteTable+BX] + StosW + Mov AL, [CS:NoteTable+BX+1] + StosW + Mov AL, DL + StosW + + Ret + +EndP I_DrawPitchPanCenter + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_PrePitchPanCenter Far + + Call S_GetDestination + Mov AL, 3h + Mov DI, (54+45*80)*2+1 + StosB + Inc DI + StosB + Inc DI + StosB + + Ret + +EndP I_PrePitchPanCenter + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_PostPitchPanCenter Far + + Push CS + Pop DS + Assume DS:Inst + + Mov SI, Offset PitchPanCenterKeys + Call M_FunctionDivider + JC I_PostPitchPanCenter1 + + Jmp [SI] + +I_PostPitchPanCenter1: + Xor AX, AX + Ret + +EndP I_PostPitchPanCenter + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_PitchPanCenterUp Far + + Mov Word Ptr [ES:DI], 27 + Mov AX, 1 + Ret + +EndP I_PitchPanCenterUp + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_PitchPanCenterDown Far + + Mov Word Ptr [ES:DI], 29 + Mov AX, 1 + Ret + +EndP I_PitchPanCenterDown + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_PitchPanCenterSemiUp Far + + Call I_GetInstrumentOffset + Mov AL, [BX+17h] + + Cmp AL, 119 + JAE I_PitchPanCenterSemiUp1 + + Inc AX + Mov [BX+17h], AL + +I_PitchPanCenterSemiUp1: + NetworkSendInstrument + + Mov AX, 1 + Ret + +EndP I_PitchPanCenterSemiUp + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_PitchPanCenterSemiDown Far + + Call I_GetInstrumentOffset + Mov AL, [BX+17h] + + Dec AL + JS I_PitchPanCenterSemiDown1 + + Mov [BX+17h], AL + +I_PitchPanCenterSemiDown1: + NetworkSendInstrument + + Mov AX, 1 + Ret + +EndP I_PitchPanCenterSemiDown + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_IdleUpdateEnvelope Far + + Push CS + Pop DS + Assume DS:Inst + + Cmp UpdateInstrumentScreen, 0 + JNE I_IdleUpdateEnvelope2 + + Mov CL, Byte Ptr InstrumentScreen + Add CL, 11 + Mov DL, 1 + ShL DX, CL + + Call PE_GetLastInstrument ; Gets BX + Inc BX + Call Music_GetSlaveChannelInformationTable + Assume DS:Nothing + +I_IdleUpdateEnvelope1: + Cmp Byte Ptr [SI+33h], BL + JNE I_IdleUpdateEnvelope4 + + Test Byte Ptr [SI], 1 + JZ I_IdleUpdateEnvelope4 + + Test [SI], DX + JZ I_IdleUpdateEnvelope4 + +I_IdleUpdateEnvelope2: + Call I_MapEnvelope + Jmp I_IdleUpdateEnvelope3 + +I_IdleUpdateEnvelope4: + Add SI, SLAVECHANNELSIZE + Loop I_IdleUpdateEnvelope1 + +I_IdleUpdateEnvelope3: + Xor AX, AX + Ret + +EndP I_IdleUpdateEnvelope + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc UpdateWAVEForm Far + + Call I_RedrawWave + Ret + +EndP UpdateWAVEForm + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_SampleButtonHandler Far + + Test AX, AX + JZ I_SampleButtonHandler1 + + NetworkSendSample + +I_SampleButtonHandler1: + Push DS + + Call I_GetSampleOffset + Push DS + Pop ES + Mov DI, BX + Pop DS + + Add DI, [SI+24] + + Ret + +EndP I_SampleButtonHandler + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc I_GetPresetEnvelopeOffset Far + + Push CS + Pop DS + Mov DX, Offset PresetEnvelopes + + Ret + +EndP I_GetPresetEnvelopeOffset + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +EndS + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +End diff --git a/IT_K.ASM b/IT_K.ASM new file mode 100644 index 0000000..bfe0816 --- /dev/null +++ b/IT_K.ASM @@ -0,0 +1,1812 @@ +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Keyboard Module ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Jumps + .386 + +include switch.inc + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Externals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Extrn D_GotoStartingDirectory:Far + + Extrn E_UnInitEMS:Far + Extrn S_GetDestination:Far + Extrn Music_Stop:Far + Extrn Music_KBPlaySong:Far + Extrn Music_IncreaseVolume:Far + Extrn Music_DecreaseVolume:Far + Extrn S_DrawString:Far + Extrn CrashRecovery:Far + + Extrn IsStartupKeyList:Far + Extrn GetStartupKeyList:Far + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Globals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Global K_DrawTables:Far + Global K_InitKeyBoard:Far + Global K_UnInitKeyBoard:Far + Global K_IsKeyWaiting:Far + Global K_GetKey:Far + Global K_IsAnyKeyDown:Far + Global K_IsKeyDown:Far + Global K_ClearKeyBoardQueue:Far + Global K_ResetKeyboardTables:Far + Global K_SelectKBButton:Far + Global K_SetKeyboardType:Far + Global K_InstallDOSHandler:Far + Global K_UnInstallDOSHandler:Far + Global K_SwapKeyBoard:Far + Global K_InstallKeyboardType:Far + Global K_RemoveKeyboardType:Far + Global K_SetScrollLock:Far + + Global CountryTable:Byte + + Public MIDIBufferEmpty, MIDISend, K_ShowMIDIInput + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +Segment KeyBoard BYTE Public 'Code' USE16 + Assume CS:KeyBoard, DS:KeyBoard + +CREATENEWLOGFILE EQU 0 +include debug.inc + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Variables ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +KeyBoardTable DB 256 Dup (?) ; Table of current keypresses +KeyBoardBuffer DB 256 Dup (?) ; Queue of keys. +LastKey DW 0 ; For Caps/Numlock processing + ; only on FIRST press +KBStart DW 0 ; Buffer start ptr +KBEnd DW 0 ; Buffer end ptr + +OldKBHandler Label DWord +OldKBHandlerOffset DW ? ; Old Interrupt handler offset +OldKBHandlerSegment DW ? ; Old interrupt handler segment + +HighSet DB 0 + +Caps DB 0 ; Internal flag +NumLock DB 0 ; Internal flag +ScrollLock DB 0 + +KeyboardFile DB "KEYBOARD.CFG", 0 +KeyboardFileLength DW 0 + +KeypadValueFlag DB 0 +KeypadValue DB 0 + +MIDIStatusByte DB 0 +MIDIDataByte1 DB 0 +MIDIDataByte2 DB 0 +MIDIDataInput DB 0 + +MIDIMessage DB "MIDI Input: ", 0FDh, "X ", 0FDh, "X ", 0FDh, "X ", 0 + +TranslationTable Label DWord +TranslationTableOffset DW Offset USKeyboardTable +TranslationTableSegment DW Keyboard + +USKeyboardTable Label Byte + + DB 2 ; 1 + DB 0 + DW '1' + DB 3 ; ! + DW '!' + DB 0FFh + + DB 3 ; 2 + DB 0 + DW '2' + DB 3 ; @ + DW '@' + DB 0FFh + + DB 4 ; 3 + DB 0 + DW '3' + DB 3 ; # + DW '#' + DB 0FFh + + DB 5 ; 4 + DB 0 + DW '4' + DB 3 ; $ + DW '$' + DB 0FFh + + DB 6 ; 5 + DB 0 + DW '5' + DB 3 ; % + DW '%' + DB 0FFh + + DB 7 ; 6 + DB 0 + DW '6' + DB 3 ; ^ + DW '^' + DB 0FFh + + DB 8 ; 7 + DB 0 + DW '7' + DB 3 ; & + DW '&' + DB 0FFh + + DB 9 ; 8 + DB 0 + DW '8' + DB 3 ; * + DW '*' + DB 0FFh + + DB 10 ; 9 + DB 0 + DW '9' + DB 3 ; ( + DW '(' + DB 0FFh + + DB 11 ; 0 + DB 0 + DW '0' + DB 3 ; ) + DW ')' + DB 0FFh + + DB 12 ; - + DB 0 + DW '-' + DB 3 ; _ + DW '_' + DB 0FFh + + DB 13 ; = + DB 0 + DW '=' + DB 3 ; + + DW '+' + DB 0FFh + + DB 14 ; Backspace + DB 4 ; Ctrl-Backspace + DW 127 + DB 0FFh + + DB 15 ; Tab + DB 3 ; ShiftTab + DW 0F00h + DB 0FFh + + DB 16 ; Q + DB 1 + DW 'Q' + DB 2 ; q + DW 'q' + DB 4 ; Ctrl-Q + DW 11h + DB 5 ; Alt-Q + DW 1000h + DB 0FFh + + DB 17 ; W + DB 1 + DW 'W' + DB 2 ; w + DW 'w' + DB 4 ; Ctrl-W + DW 17h + DB 5 ; Alt-W + DW 1100h + DB 0FFh + + DB 18 ; E + DB 1 + DW 'E' + DB 2 ;e + DW 'e' + DB 4 ; Ctrl-E + DW 5 + DB 5 ; Alt-E + DW 1200h + DB 0FFh + + DB 19 ; R + DB 1 + DW 'R' + DB 2 ; r + DW 'r' + DB 4 ; Ctrl-R + DW 12h + DB 5 ; Alt-R + DW 1300h + DB 0FFh + + DB 20 ; T + DB 1 + DW 'T' + DB 2 ; t + DW 't' + DB 4 ; Ctrl-T + DW 14h + DB 5 ; Alt-T + DW 1400h + DB 0FFh + + DB 21 ; Y + DB 1 + DW 'Y' + DB 2 ; y + DW 'y' + DB 4 ; Ctrl-Y + DW 19h + DB 5 ; Alt-Y + DW 1500h + DB 0FFh + + DB 22 ; U + DB 1 + DW 'U' + DB 2 ; u + DW 'u' + DB 4 ; Ctrl-U + DW 15h + DB 5 ; Alt-U + DW 1600h + DB 0FFh + + DB 23 ; I + DB 1 + DW 'I' + DB 2 ; i + DW 'i' + DB 4 ; Ctrl-I + DW 9 + DB 5 ; Alt-I + DW 1700h + DB 0FFh + + DB 24 ; O + DB 1 + DW 'O' + DB 2 ; o + DW 'o' + DB 4 ; Ctrl-O + DW 0Fh + DB 5 ; Alt-O + DW 1800h + DB 0FFh + + DB 25 ; P + DB 1 + DW 'P' + DB 2 ; p + DW 'p' + DB 4 ; Ctrl-P + DW 10h + DB 5 ; Alt-P + DW 1900h + DB 0FFh + + DB 26 ; [ + DB 0 + DW '[' + DB 3 ; { + DW '{' + DB 0FFh + + DB 27 ; ] + DB 0 + DW ']' + DB 3 ; } + DW '}' + DB 0FFh + + DB 30 ; A + DB 1 + DW 'A' + DB 2 ; a + DW 'a' + DB 4 ; Ctrl-A + DW 1 + DB 5 ; Alt-A + DW 1E00h + DB 0FFh + + DB 31 ; S + DB 1 + DW 'S' + DB 2 ; s + DW 's' + DB 4 ; Ctrl-S + DW 13h + DB 5 ; Alt-S + DW 1F00h + DB 0FFh + + DB 32 ; D + DB 1 + DW 'D' + DB 2 ; d + DW 'd' + DB 4 ; Ctrl-D + DW 4 + DB 5 ; Alt-D + DW 2000h + DB 0FFh + + DB 33 ; F + DB 1 + DW 'F' + DB 2 ; f + DW 'f' + DB 4 ; Ctrl-F + DW 6 + DB 5 ; Alt-F + DW 2100h + DB 0FFh + + DB 34 ; G + DB 1 + DW 'G' + DB 2 ; g + DW 'g' + DB 4 ; Ctrl-G + DW 7 + DB 5 ; Alt-G + DW 2200h + DB 0FFh + + DB 35 ; H + DB 1 + DW 'H' + DB 2 ; h + DW 'h' + DB 4 ; Ctrl-H + DW 8 + DB 5 ; Alt-H + DW 2300h + DB 0FFh + + DB 36 ; J + DB 1 + DW 'J' + DB 2 ; j + DW 'j' + DB 4 ; Ctrl-J + DW 0Ah + DB 5 ; Alt-J + DW 2400h + DB 0FFh + + DB 37 ; K + DB 1 + DW 'K' + DB 2 ; k + DW 'k' + DB 4 ; Ctrl-K + DW 0Bh + DB 5 ; Alt-K + DW 2500h + DB 0FFh + + DB 38 ; L + DB 1 + DW 'L' + DB 2 ; l + DW 'l' + DB 4 ; Ctrl-L + DW 0Ch + DB 5 ; Alt-L + DW 2600h + DB 0FFh + + DB 39 ; ; + DB 0 + DW ';' + DB 3 ; : + DW ':' + DB 0FFh + + DB 40 ; ' + DB 0 + DW "'" + DB 3 ; " + DW '"' + DB 0FFh + + DB 41 ; ` + DB 0 + DW '`' + DB 3 ; ~ + DW '~' + DB 0FFh + + DB 43 ; \ + DB 0 + DW '\' + DB 3 ; | + DW '|' + DB 0FFh + + DB 44 ; z + DB 1 + DW 'Z' + DB 2 ; z + DW 'z' + DB 4 ; Ctrl-Z + DW 1Ah + DB 5 ; Alt-Z + DW 2C00h + DB 0FFh + + DB 45 ; X + DB 1 + DW 'X' + DB 2 ; x + DW 'x' + DB 4 ; Ctrl-X + DW 1Ah + DB 5 ; Alt-X + DW 2D00h + DB 0FFh + + DB 46 ; C + DB 1 + DW 'C' + DB 2 ; c + DW 'c' + DB 4 ; Ctrl-C + DW 3 + DB 5 ; Alt-C + DW 2E00h + DB 0FFh + + DB 47 ; V + DB 1 + DW 'V' + DB 2 ; v + DW 'v' + DB 4 ; Ctrl-V + DW 16h + DB 5 ; Alt-V + DW 2F00h + DB 0FFh + + DB 48 ; B + DB 1 + DW 'B' + DB 2 ; b + DW 'b' + DB 4 ; Ctrl-B + DW 2 + DB 5 ; Alt-B + DW 3000h + DB 0FFh + + DB 49 ; N + DB 1 + DW 'N' + DB 2 ; n + DW 'n' + DB 4 ; Ctrl-N + DW 0Eh + DB 5 ; Alt-N + DW 3100h + DB 0FFh + + DB 50 ; M + DB 1 + DW 'M' + DB 2 + DW 'm' + DB 4 ; Ctrl-M + DW 0Dh + DB 5 ; Alt-M + DW 3200h + DB 0FFh + + DB 51 ; , + DB 0 + DW ',' + DB 3 + DW '<' + DB 0FFh + + DB 52 ; . + DB 0 + DW '.' + DB 3 + DW '>' + DB 0FFh + + DB 53 ; / + DB 0 + DW '/' + DB 3 + DW '?' + DB 0FFh + + DB 55 ; XT/AT printscreen, Enhanced keyboard * + DB 0 + DW '*' + DB 0FFh + + DB 57 ; Spacebar + DB 0 + DW ' ' + DB 3 + DW ' ' + DB 0FFh + + DB 71 ; Keypad 7 + DB 8 + DW '7' + DB 10 + DW 7 + DB 0FFh + + DB 72 ; Keypad 8 + DB 8 + DW '8' + DB 10 + DW 8 + DB 0FFh + + DB 73 ; Keypad 9 + DB 8 + DW '9' + DB 10 + DW 9 + DB 0FFh + + DB 74 ; Grey - + DB 0 + DW '-' + DB 0FFh + + DB 75 ; Keypad 4 + DB 8 + DW '4' + DB 10 + DW 4 + DB 0FFh + + DB 76 ; Keypad 5 + DB 8 + DW '5' + DB 10 + DW 5 + DB 0FFh + + DB 77 ; Keypad 6 + DB 8 + DW '6' + DB 10 + DW 6 + DB 0FFh + + DB 78 ; Grey + + DB 0 + DW '+' + DB 0FFh + + DB 79 ; Keypad 1 + DB 8 + DW '1' + DB 10 + DW 1 + DB 0FFh + + DB 80 ; Keypad 2 + DB 8 + DW '2' + DB 10 + DW 2 + DB 0FFh + + DB 81 ; Keypad 3 + DB 8 + DW '3' + DB 10 + DW 3 + DB 0FFh + + DB 82 ; Keypad 0 + DB 8 + DW '0' + DB 10 + DW 0 + DB 0FFh + + DB 83 + DB 8 + DW '.' + DB 0FFh + + DB 128+35h ; Grey / + DB 0 + DW '/' + DB 0FFh + + DB 0FFh + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Functions ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Alt DB 0 +Ctrl DB 0 + +Proc K_KBHandler + + Push AX + Push BX + Push DS + + Push CS + Pop DS + + In AL, 60h ; Get input from port + + Cmp AL, 0FAh + JE K_KBHandler3 ; Is it a LED response?, 2 prev. + + Mov BX, KBEnd ; No... add a key to the queue + Inc BX + And BX, 0FFh + Cmp BX, KBStart + JE K_KBHandler1 + + Mov [KeyBoardBuffer+BX], AL + Mov KBEnd, BX + +K_KBHandler1: + Cmp AL, 1Dh ; Left Ctrl, Right Ctrl + JE K_KBHandlerCtrlPressed + Cmp AL, 9Dh + JE K_KBHandlerCtrlReleased + + Cmp AL, 38h ; Left Alt, Right Alt + JE K_KBHandlerAltPressed + Cmp AL, 0B8h + JE K_KBHandlerAltReleased + + Cmp AL, 42h ; F8 + JNE K_KBHandlerDel + + Cmp Word Ptr [Alt], 0 + JNE K_KBHandler3 + + Call Music_Stop + Jmp K_KBHandler3 + +K_KBHandlerCtrlPressed: + Mov Ctrl, 1 + Jmp K_KBHandler3 + +K_KBHandlerCtrlReleased: + Mov Ctrl, 0 + Jmp K_KBHandler3 + +K_KBHandlerAltPressed: + Mov Alt, 1 + Jmp K_KBHandler3 + +K_KBHandlerAltReleased: + Mov Alt, 0 + Jmp K_KBHandler3 + +K_KBHandlerDel: +CRASHRECOVERYKEY EQU $+1 + Cmp AL, 53h ; Delete, 52h = insert + JNE K_KBHandler3 + + Cmp Word Ptr [Alt], 101h + JNE K_KBHandler3 + + ; Crash recovery + Push BP + Mov BP, SP + DB 66h, 0C7h, 46h, 08h ; Mov DWord Ptr [BP+8], CrashRecovery + DD DWord Ptr CrashRecovery ; + Pop BP + +K_KBHandler3: + In AL, 61h ; KB Acknowledgement. + Mov AH, AL ; (Only for old 8042 chips.) + Or AL, 80h + Out 61h, AL + Mov AL, AH + Out 61h, AL + +K_KBHandler2: + Mov AL, 20h ; IRQ Acknowledgement. + Out 20h, AL + + Pop DS + Pop BX + Pop AX + IRet + +EndP K_KBHandler + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc K_DOSKBHandler Far + + Push AX + + In AL, 60h + + Cmp AL, 4Eh ; Grey plus + JE K_DOSKBHandler5 + + Cmp AL, 4Ah ; Grey Minus + JE K_DOSKBHandler6 + + Cmp AL, 0E0h + JNE K_DOSKBHandler3 + + Mov CS:HighSet, 1 + Jmp K_DOSKBHandler4 + +K_DOSKBHandler3: + Cmp CS:HighSet, 0 + JE K_DOSKBHandler4 + + Mov CS:HighSet, 0 + + Cmp AL, 1Dh ; Right Ctrl. + JNE K_DOSKBHandler1 + + PushF + Call DWord Ptr [CS:OldKBHandler] + Call Music_KBPlaySong + Pop AX + IRet + +K_DOSKBHandler1: + Cmp AL, 38h ; Right Alt. + JNE K_DOSKBHandler4 + + PushF + Call DWord Ptr [CS:OldKBHandler] + Call Music_Stop + Pop AX + IRet + +K_DOSKBHandler4: + Pop AX + Jmp DWord Ptr [CS:OldKBHandler] + +K_DOSKBHandler5: ; Grey Plus + Mov AL, 20h + Out 20h, AL + + Call Music_IncreaseVolume + + Pop AX + IRet + +K_DOSKBHandler6: + Mov AL, 20h + Out 20h, AL + + Call Music_DecreaseVolume ; Grey minus + + Pop AX + IRet + +EndP K_DOSKBHandler + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc K_SetKeyBoardLights ; Reqs: DS:KeyBoard + ; Sets keyboard lights (duh!) + Push AX + Mov AL, 0EDh + Out 60h, AL + + Xor AL, AL + + Cmp Caps, 0 + JE K_SetKeyBoardLights1 + + Mov AL, 4 + +K_SetKeyBoardLights1: + Cmp NumLock, 0 + JE K_SetKeyBoardLights2 + + Or AL, 2 + +K_SetKeyBoardLights2: + Cmp ScrollLock, 0 + JE K_SetKeyboardLights3 + + Or AL, 1 + +K_SetKeyBoardLights3: + Out 60h, AL + Pop AX + + Ret + +EndP K_SetKeyBoardLights + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc K_InitKeyBoard Far ; Raises key repeat rate + ; to 30 char/s, + ; delay before second char=0.25s + ; Gets old IRQ handler + ; and CAPS/NumLock states + ; Checks for Keyboard chip + ; Installs new IRQ handler + + Push AX + Push DS + Push ES + + Push CS + Pop DS + + Trace " - Detecting Windows presence" + + Mov AX, 1600h ; Windows detection. + Int 2Fh + Test AL, 7Fh + JZ NoWindows + + Mov Byte Ptr [CRASHRECOVERYKEY], 52h + +NoWindows: + Trace " - Setting keyboard repeat rate" + + Mov AX, 305h ; Set repeat rate + Xor BX, BX + Int 16h + + Trace " - Installing keyboard handler" + + ClI + + In AL, 21h + Or AL, 00000010b ; Disable keyboard IRQ + Out 21h, AL + + Xor AX, AX + Mov ES, AX + + Mov EAX, [ES:36] + Mov OldKBHandler, EAX + +K_InitKeyBoard3: ; Chained to from K_UnInstallDOSHandler + Mov AL, [ES:417h] ; Keyboard status byte. + Mov AH, AL + And AL, 40h + Mov Caps, AL + And AH, 20h + Mov NumLock, AH + + ; New keyboard IRQ handler + Mov AX, CS + ShL EAX, 16 + Mov AX, Offset K_KBHandler + + Mov Word Ptr [ES:5], 0 ; Screw Int1 + Mov [ES:36], EAX + + In AL, 21h + And AL, 11111101b + Out 21h, AL + + StI + + Trace " - Initialising keyboard tables" + + Call K_ResetKeyboardTables ; Initialise keyboard tables. + + Trace " - Initialising keyboard lights" + + Call K_SetKeyboardLights + + Pop ES + Pop DS + Pop AX + + Ret + +EndP K_InitKeyBoard + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc K_UnInitKeyBoard Far + + Push AX + Push DS + Push ES + + Push CS + Pop DS + + ClI + + In AL, 21h + Or AL, 00000010b + Out 21h, AL + + Xor AX, AX + Mov ES, AX + + Mov EAX, OldKBHandler + Mov [ES:36], EAX + +K_UnInitKeyBoard3: ; Chain to from InstallDOSHandler + In AL, 21h + And AL, 11111101b + Out 21h, AL + + StI + + Mov AL, [ES:417h] + And AL, 10010000b + Cmp CS:Caps, 0 + JE K_UnInitKeyBoard2 + + Or AL, 40h ; Set caps lock flag + +K_UnInitKeyBoard2: + Cmp CS:NumLock, 0 + JZ K_UnInitKeyBoard1 + + Or AL, 20h + +K_UnInitKeyBoard1: + Mov [ES:417h], AL + + Pop ES + Pop DS + Pop AX + + Ret + +EndP K_UnInitKeyBoard + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc K_InstallDOSHandler Far + + Push AX + Push DS + Push ES + + Push CS + Pop DS + + ClI + + In AL, 21h + Or AL, 00000010b + Out 21h, AL + + Xor AX, AX + Mov ES, AX + + Mov AX, CS + ShL EAX, 16 + Mov AX, Offset K_DOSKBHandler + + Mov [ES:36], EAX + + Jmp K_UnInitKeyBoard3 + +EndP K_InstallDOSHandler + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc K_UnInstallDOSHandler Far + + Push AX + Push DS + Push ES + + Push CS + Pop DS + + Mov AX, 305h ; Set repeat rate + Xor BX, BX + Int 16h + + ClI + + In AL, 21h + Or AL, 00000010b ; Disable keyboard IRQ + Out 21h, AL + + Xor AX, AX + Mov ES, AX + + Jmp K_InitKeyBoard3 + +EndP K_UnInstallDOSHandler + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc K_GetNextKeyByte + + Inc BX + And BX, 0FFh + Mov AL, [KeyBoardBuffer+BX] + + Ret + +EndP K_GetNextKeyByte + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc K_IsKeyWaiting Far ; Returns 1 in AX if key is ready + ; 0 in AX if no key is ready + + Push DS + Push BX + Push CX + + Call IsStartupKeyList + And AX, 0FFh + + JNZ K_IsKeyWaiting1 + + Push CS + Pop DS + + Mov AX, KBEnd + Sub AX, KBStart + And AX, 0FFh + JZ K_IsKeyWaiting1 + + Mov CX, AX + + Mov BX, KBStart + Call K_GetNextKeyByte + Cmp AL, 0E0h + JNE K_IsKeyWaiting2 + + Mov AX, CX + Dec AX + Jmp K_IsKeyWaiting1 + +K_IsKeyWaiting2: + Mov AX, 1 + +K_IsKeyWaiting1: + Pop CX + Pop BX + Pop DS + Ret + +EndP K_IsKeyWaiting + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc K_GetKey Far ; CX/DX = input/translated + + Push AX + Push BX + Push DS + Push SI + + Push CS + Pop DS + + Call IsStartupKeyList + Test AL, AL + JZ K_GetKeyNoStartupKeyList + + Call GetStartupKeyList + Jmp K_GetKey20 + +K_GetKeyNoStartupKeyList: + ; Check MIDI first + Cmp [MIDIDataInput], 2 + JB K_GetKey1 + + ; OK.. have MIDI message + + Mov CH, [MIDIStatusByte] + Xor CL, CL + Mov DX, Word Ptr [MIDIDataByte1] + Mov [MIDIDataInput], 0 + Jmp K_GetKey20 + +K_GetKey1: + Call K_IsKeyWaiting + And AX, AX + JZ K_GetKey1 + + Xor SI, SI + + Mov BX, KBStart + Call K_GetNextKeyByte + Cmp AL, 0E0h + JB K_GetKey2 + Cmp AL, 0E1h + JA K_GetKey2 + + Mov CX, AX + And CX, 1 + Inc CX + +K_GetKey18: + Mov KBStart, BX + Call K_IsKeyWaiting + And AX, AX + JZ K_GetKey18 + + Add SI, 128 + Call K_GetNextKeyByte + + Loop K_GetKey18 + + Cmp SI, 128 + JBE K_GetKey2 + + Mov SI, 64 + +K_GetKey2: + Mov KBStart, BX + And AL, AL + JS K_GetKey3 + + Inc BH + +K_GetKey3: + And AX, 07Fh + Add SI, AX + Mov CX, SI + Mov CH, BH + + ; OK test for + ; stupid input. + Cmp CL, 0AAh + JE K_GetKey17 + Cmp CL, 0B6h + JE K_GetKey17 + + Mov [KeyBoardTable+SI], BH + + Cmp CX, 13Ah + JNE K_GetKey14 + + Cmp LastKey, CX + JE K_GetKey10 + + Xor Caps, 40h ; Toggle Caps Lock + Call K_SetKeyBoardLights + Jmp K_GetKey10 + +K_GetKey14: + Cmp CX, 145h ; Num Lock + JNE K_GetKey10 + + Cmp LastKey, CX + JE K_GetKey10 + + Xor NumLock, 20h + Call K_SetKeyBoardLights + +K_GetKey10: + Mov LastKey, CX + Cmp Byte Ptr [KeyBoardTable+02Ah], 0 ; Left Shift Key + JE K_GetKey4 + + Or CH, 2 ; Left Shift Key + +K_GetKey4: + Cmp Byte Ptr [KeyBoardTable+36h], 0 ; Right Shift Key + JE K_GetKey5 + + Or CH, 4 ; Right Shift Key + +K_GetKey5: + Cmp Byte Ptr [KeyBoardTable+1Dh], 0 ; Left Ctrl Key + JE K_GetKey6 + + Or CH, 8 + +K_GetKey6: + Cmp Byte Ptr [KeyBoardTable+9Dh], 0 ; Right Ctrl Key + JE K_GetKey7 + + Or CH, 16 ; Right Ctrl Key + +K_GetKey7: + Cmp Byte Ptr [KeyBoardTable+38h], 0 ; Left Alt Key + JE K_GetKey8 + + Or CH, 32 ; Left Alt Key + +K_GetKey8: + Cmp Byte Ptr [KeyBoardTable+0B8h], 0 ; Right Alt Key + JE K_GetKey9 + + Or CH, 64 ; Right Alt Key + +K_GetKey9: + Test CH, 1 ; Keypress? - actually need to check for + ; Alt-keypad stuff. + JNZ K_TranslateKeyPress + + Cmp CL, 38h + JE K_TranslateAltRelease + Cmp CL, 0B8h + JNE K_TranslateKeyNoKey + +K_TranslateAltRelease: + Xor DX, DX + + Cmp KeypadValueFlag, 0 + JE K_TranslateKeyNoKey + + XChg Word Ptr KeypadValueFlag, DX ; Reset flag + value + ShR DX, 8 + Cmp DL, 32 + JB K_TranslateKeyNoKey + Jmp K_TranslateKeyEnd + +K_TranslateKeyPress: + LDS SI, TranslationTable + Assume DS:Nothing + +K_TranslateKey1: + LodsB + Cmp AL, CL + JE K_TranslateKey3 + Cmp AL, 0FFh + JE K_TranslateKeyNoKey + +K_TranslateKey2: + LodsB + Cmp AL, 0FFh + JE K_TranslateKey1 + LodsW + Jmp K_TranslateKey2 + +K_TranslateKey3: + LodsB + Mov BL, AL + LodsW + Mov DX, AX + Cmp BL, 1 + JB K_TranslateCondition0 + JE K_TranslateCondition1 + + Cmp BL, 3 + JB K_TranslateCondition2 + JE K_TranslateCondition3 + + Cmp BL, 5 + JB K_TranslateCondition4 + JE K_TranslateCondition5 + + Cmp BL, 7 + JB K_TranslateCondition6 + JE K_TranslateCondition7 + + Cmp BL, 9 + JB K_TranslateCondition8 + JE K_TranslateCondition9 + + Cmp BL, 11 + JB K_TranslateCondition10 + + Jmp K_TranslateKeyNoKey + +K_TranslateCondition0: ; Keypress + Test CH, Not 1 + JNZ K_TranslateKey3 + Jmp K_TranslateKeyEnd + +K_TranslateCondition1: + Cmp Caps, 0 + JE K_TranslateCondition3 ; Caps off -> check shift + +K_TranslateConditionNoShift: + Test CH, Not 7 + JNZ K_TranslateKey3 + Test CH, 6 + JNZ K_TranslateKey3 + Jmp K_TranslateKeyEnd + +K_TranslateCondition2: + Cmp Caps, 0 + JE K_TranslateConditionNoShift + ; Fall through to shift check + +K_TranslateCondition3: ; Shift + Test CH, Not 7 + JNZ K_TranslateKey3 + Test CH, 6 + JZ K_TranslateKey3 + Jmp K_TranslateKeyEnd + +K_TranslateCondition4: ; Ctrl + Test CH, Not 19h + JNZ K_TranslateKey3 + Test CH, 18h + JZ K_TranslateKey3 + Jmp K_TranslateKeyEnd + +K_TranslateCondition5: ; Alt + Test CH, Not 61h + JNZ K_TranslateKey3 + Test CH, 60h + JZ K_TranslateKey3 + Jmp K_TranslateKeyEnd + +K_TranslateCondition6: ; Left alt + Test CH, Not 21h + JNZ K_TranslateKey3 + Test CH, 20h + JZ K_TranslateKey3 + Jmp K_TranslateKeyEnd + +K_TranslateCondition7: ; Right alt + Test CH, Not 41h + JNZ K_TranslateKey3 + Test CH, 40h + JZ K_TranslateKey3 + Jmp K_TranslateKeyEnd + +K_TranslateCondition8: + Test CH, Not 1 + JNZ K_TranslateKey3 + Cmp NumLock, 0 + JE K_TranslateKey3 + Jmp K_TranslateKeyEnd + +K_TranslateCondition9: + Test CH, Not 1 + JNZ K_TranslateKey3 + Cmp NumLock, 0 + JNE K_TranslateKey3 + Jmp K_TranslateKeyEnd + +K_TranslateCondition10: + Test CH, Not 61h + JNZ K_TranslateKey3 + Test CH, 60h + JZ K_TranslateKey3 + + Mov CS:KeyPadValueFlag, 1 + Mov AL, 10 + Mul CS:KeyPadValue + Add AL, DL + Mov CS:KeyPadValue, AL + +K_TranslateKeyNoKey: + Xor DX, DX + +K_TranslateKeyEnd: + Cmp NumLock, 0 + JNE K_GetKey15 + + Cmp CL, 47h + JB K_GetKey15 + Cmp CL, 53h + JA K_GetKey15 + Cmp CL, 4Ah + JE K_GetKey15 + Cmp CL, 4Eh + JE K_GetKey15 + + Add CL, 80h + Jmp K_GetKey20 + +K_GetKey15: + Cmp CL, 9Ch ; Grey enter... + JNE K_GetKey20 + + Mov CL, 1Ch ; Normal enter! + Jmp K_GetKey20 + +K_GetKey17: + Xor CX, CX + Xor DX, DX + +K_GetKey20: + Pop SI + Pop DS + Pop BX + Pop AX + Ret + + +EndP K_GetKey + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc K_ClearKeyBoardQueue Far + + Push AX + +K_ClearKeyBoardQueue1: + Call K_IsKeyWaiting + Test AX, AX + JZ K_ClearKeyBoardQueue2 + Call K_GetKey + Jmp K_ClearKeyBoardQueue1 + +K_ClearKeyBoardQueue2: + Pop AX + Ret + +EndP K_ClearKeyBoardQueue + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc K_IsAnyKeyDown Far ; Returns AL = 1 if key is down. + + Push CX + Push DS + Push SI + + Push CS + Pop DS + Assume DS:Keyboard + + Mov SI, Offset KeyBoardTable + Mov CX, 256 + +K_IsAnyKeyDown1: + LodsB + And AL, AL + LoopZ K_IsAnyKeyDown1 + + JCXZ K_IsAnyKeyDown2 + + Mov AL, 1 + +K_IsAnyKeyDown2: + Pop SI + Pop DS + Pop CX + + Ret + +EndP K_IsAnyKeyDown + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc K_IsKeyDown Far ; BX = key to test + + Cmp [CS:KeyboardTable+BX], 0 + Ret + +EndP K_IsKeyDown + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc K_ResetKeyboardTables Far + + Push CS + Pop ES + Mov DI, Offset KeyboardTable + Mov CX, 518 + Xor AL, AL + Rep StosB + + Mov AX, 1 + Ret + +EndP K_ResetKeyboardTables + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc K_DrawTables Far + + Call S_GetDestination + Mov DI, (2+15*80)*2 + + Push CS + Pop DS + Assume DS:KeyBoard + Mov SI, Offset KeyboardBuffer + + Mov CX, 2004h ; CH = row count, CL = ShR + Mov AH, 2h + +K_DrawTables1: + Mov DL, 08h ; BL = count + Push DI + +K_DrawTables3: + LodsB + Mov DH, AL + ShR AL, CL + Cmp AL, 10 + SBB AL, 69h + DAS + StosW + + Mov AL, DH + And AL, 0Fh + Cmp AL, 10 + SBB AL, 69h + DAS + StosW + + Dec DL + JZ K_DrawTables2 + + Mov AL, ' ' + StosW + Jmp K_DrawTables3 + +K_DrawTables2: + Pop DI + Add DI, 160 + + Dec CH + JNZ K_DrawTables1 + + ; Now for keypress tables. + Mov SI, Offset KeyboardTable + Mov DI, (29+15*80)*2 + + Mov CX, 2004h ; CH = row count, CL = ShR + Xor DL, DL + +K_DrawTable4: + Mov DH, 8 + Push DI + +K_DrawTable5: + Mov AH, 2 + LodsB + + Cmp AL, 1 + SBB AH, -1 + + Mov AL, DL + ShR AL, CL + Cmp AL, 10 + SBB AL, 69h + DAS + StosW + + Mov AL, DL + And AL, 0Fh + Cmp AL, 10 + SBB AL, 69h + DAS + StosW + + Inc DL + Dec DH + JZ K_DrawTable7 + + Mov AL, ' ' + StosW + Jmp K_DrawTable5 + +K_DrawTable7: + Pop DI + Add DI, 160 + + Dec CH + JNZ K_DrawTable4 + + Xor AX, AX + Ret + +EndP K_DrawTables + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc K_ShowMIDIInput Far + + Push CS + Pop DS + Assume DS:Keyboard + + ; Now to shove the MIDI input info. + Xor AX, AX + Mov AL, [MIDIDataByte2] + Push AX + Mov AL, [MIDIDataByte1] + Push AX + Mov AL, [MIDIStatusByte] + Push AX + + Mov DI, (2+13*80)*2 + Mov SI, Offset MIDIMessage + Mov AH, 20h + Call S_DrawString + + Add SP, 6 + + Xor AX, AX + Ret + +EndP K_ShowMIDIInput + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc K_InstallKeyboardType Far + + Call D_GotoStartingDirectory + + Push CS + Pop DS + Assume DS:Keyboard + + Mov AX, 3D00h + Mov DX, Offset KeyboardFile + Int 21h + JC K_InstallKeyboardType2 + + Trace " - Custom keyboard file found" + + Mov BX, AX + + Mov AH, 3Fh + Mov CX, 2 ; Read 2 bytes + Mov DX, Offset KeyboardFileLength + Int 21h + JC K_InstallKeyboardType1 + + Trace " - Allocating memory" + + Push BX + Mov AH, 48h ; Allocate memory + Mov BX, KeyboardFileLength + Mov CX, BX ; CX = length for next call. + Add BX, 15 + ShR BX, 4 + Int 21h + Pop BX + JC K_InstallKeyboardType1 + ; AX = load destination + + Trace " - Loading custom keyboard data" + + Mov DS, AX + Xor DX, DX + Mov AH, 3Fh ; Load data + Int 21h + JC K_InstallKeyboardType3 + + Trace " - Installing new keyboard translation table" + + Mov AX, DS + ShL EAX, 16 + Mov CS:TranslationTable, EAX + Jmp K_InstallKeyboardType1 + +K_InstallKeyboardType3: + Push DS + Pop ES + Mov AH, 49h + Int 21h + +K_InstallKeyboardType1: + Mov AH, 3Eh ; Close file + Int 21h + +K_InstallKeyboardType2: + Ret + +EndP K_InstallKeyboardType + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc K_RemoveKeyboardType Far + + Push CS + Pop DS + Assume DS:Keyboard + + Mov AX, TranslationTableSegment + Mov BX, CS + Cmp AX, BX + JE K_RemoveKeyboardType1 + + Mov ES, AX + Mov AH, 49h + Int 21h + +K_RemoveKeyboardType1: + Ret + +EndP K_RemoveKeyboardType + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc K_SetScrollLock Far + + Push CS + Pop DS + Mov ScrollLock, AL + Call K_SetKeyboardLights + Ret + +EndP K_SetScrollLock + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MIDIBufferEmpty Far ; Returns carry set if input OK. + ; Returns carry CLEAR if input full. + + Cmp [CS:MIDIDataInput], 2 + Ret + +EndP MIDIBufferEmpty + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MIDISend Far ; Given AL = data byte. + + Push DS + + Push CS + Pop DS + Assume DS:Keyboard + + Test AL, AL ; Status byte? + JNS MIDISend1 + + Mov [MIDIStatusByte], AL + Mov [MIDIDataInput], 0 + Jmp MIDISendEnd + +MIDISend1: + Xor BX, BX + Mov SI, Offset MIDIDataByte1 + Add BL, [MIDIDataInput] + Mov [SI+BX], AL + Mov AL, [MIDIStatusByte] + Inc BX + Cmp AL, 0C0h + JB MIDISend2 + Cmp AL, 0E0h + JAE MIDISend2 + + Inc BX + Mov [MIDIDataByte2], 0 + +MIDISend2: + Mov [MIDIDataInput], BL + +MIDISendEnd: + Pop DS + Ret + +EndP MIDISend + Assume DS:Nothing + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +EndS + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +End diff --git a/IT_L.ASM b/IT_L.ASM new file mode 100644 index 0000000..7085bce --- /dev/null +++ b/IT_L.ASM @@ -0,0 +1,559 @@ +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Info Line Module - Playing info updates / other messages ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Jumps + .386 + +include switch.inc + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Externals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Segment Glbl BYTE Public 'Code' + Extrn CurrentMode:Byte +EndS + + Extrn I_ShowSamplePlay:Far + Extrn I_ShowInstrumentPlay:Far + + Extrn S_UpdateScreen:Far + Extrn S_DrawString:Far + Extrn S_SetDirectMode:Far + Extrn S_GetDestination:Far + + Extrn Music_GetPlayMode:Far + Extrn Music_Poll:Far + Extrn Music_GetSlaveChannelInformationTable:Far + +IF NETWORKENABLED + Extrn Network_Poll:Far +ENDIF + + Extrn PE_ShowOrder:Far + Extrn PE_FillSpeedTempo:Far + Extrn PE_GetMaxOrder:Far + Extrn Glbl_TutorialHandler:Far + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Globals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Global UpdateInfoLine:Far + Global IdleUpdateInfoLine:Far + Global ClearInfoLine:Far + Global SetInfoLine:Far, SetInfoLine2:Far + Global StartClock:Far + Global GlobalStartTime:Far + Public ShowUsageTime + Public InitTimerHandler + Public UnInitTimerHandler + Public GetTimerCounter + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +Segment InfoLine DWORD Public 'Code' USE16 + Assume CS:InfoLine, DS:InfoLine + +CREATENEWLOGFILE EQU 0 +include debug.inc + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Variables ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +SLAVECHANNELSIZE = 128 + +OldTimerHandler DD 0 +TimerCounter DD 0 +PlaybackTimer DD 0 + +InfoLineText DD 0 +InfoLineDelay DW 0 +InfoLineVariable DW 0 + +; Colouring for ZaStaR +; PatternPlayMsg DB "Playing, Pattern: ", 0FEh, 23h, 0FDh, "D", 0FEh, 20h, ", Row: ", 0FEh, 23h, 0FDh, "D", 0FEh, 20h, "/", 0FDh, "D", 0FFh, 13, " ", 0 +; SongPlayMsg DB "Playing, Order: ", 0FEh, 23h, 0FDh, "D", 0FEh, 20h, "/", 0FDh, "D, Pattern: ", 0FEh, 23h, 0FDh, "D", 0FEh, 20h, ", Row: ", 0FEh, 23h, 0FDh, "D", 0FEh, 20h, "/", 0FDh, "D", 0FFh, 6, " ", 0 + +NoSoundDriverMsg DB "Error: No sound driver loaded.", 0 +PatternPlayMsg DB "Playing, Pattern: ", 0FEh, 23h, 0FDh, "D", 0FEh, 20h, ", Row: ", 0FEh, 23h, 0FDh, "D", 0FEh, 20h, "/", 0FEh, 23h, 0FDh, "D", 0FEh, 20h, ", ", 0FEh, 23h, 0FDh, "D", 0FEh, 20h, " Channels", 0FFh, 10, " ", 0 +SongPlayMsg DB "Playing, Order: ", 0FEh, 23h, 0FDh, "D", 0FEh, 20h, "/", 0FEh, 23h, 0FDh, "D", 0FEh, 20h, ", Pattern: ", 0FEh, 23h, 0FDh, "D", 0FEh, 20h, ", Row: ", 0FEh, 23h, 0FDh, "D", 0FEh, 20h, "/", 0FEh, 23h, 0FDh, "D", 0FEh, 20h, ", ", 0FEh, 23h, 0FDh, "D", 0FEh, 20h, " Channels", 0FFh, 10, " ", 0 +ChannelMsg DB "Playing, ", 0FEh, 23h, 0FDh, "D", 0FEh, 20h, " Channels", 0 +EmptyMsg DB 0 +TimeMsg DB " Time ", 0FDh, "D:" +Minutes DB "00:" +Seconds DB "00", 0 +DisplayChannelMsg DB 0 +ShowUsageTime DB 1 + + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Functions ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Proc TimerInterruptHandler + + Sub CS:InfoLineDelay, 1 + AdC CS:InfoLineDelay, 0 + + Inc CS:TimerCounter + Jmp [CS:OldTimerHandler] + +EndP TimerInterruptHandler + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc InitTimerHandler Far + + Push DS + + Trace " - Installing new timer interrupt" + + Xor AX, AX + Mov DS, AX + + Mov AX, CS + ShL EAX, 16 + Mov AX, Offset TimerInterruptHandler + + ClI + XChg EAX, [DS:20h] + Mov [CS:OldTimerHandler], EAX + StI + + Pop DS + Ret + +EndP InitTimerHandler + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc UninitTimerHandler Far + + Push DS + + Xor AX, AX + Mov DS, AX + + Mov EAX, [CS:OldTimerHandler] + ClI + Mov [DS:20h], EAX + StI + + Pop DS + Ret + +EndP UninitTimerHandler + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc FillToEOL + + Push ES + Mov AX, ' ' + 2000h + Call S_GetDestination + +UpdateInfoLineEOL: + Cmp DI, (61+9*80)*2 + JAE UpdateInfoLineEOL2 + + StosW + Jmp UpdateInfoLineEOL + +UpdateInfoLineEOL2: + Pop ES + Ret + +EndP FillToEOL + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc UpdateInfoLine Far + + Push DS + Push SI + + Push Glbl + Pop DS + Assume DS:Glbl + + Cmp CurrentMode, 200 + JAE UpdateInfoLineEnd2 + + Push CS + Pop DS + + Mov DI, (2+9*80)*2 + + Cmp InfoLineDelay, 0 + JE UpdateInfoLine1 +; Mov CX, InfoLineDelay +; JCXZ UpdateInfoLine1 +; +; Dec InfoLineDelay + +UpdateInfoLine2: + LDS SI, InfoLineText + Mov CX, DS + JCXZ UpdateInfoLineEnd + + Mov AX, CS:InfoLineVariable + Push AX + + Mov AH, 20h + Call S_DrawString + Call FillToEOL + + Pop AX + + Call Music_GetPlayMode +; Call ShowTime + Jmp UpdateInfoLine6 + +UpdateInfoLine1: +; ****** + Call Music_GetSlaveChannelInformationTable + ; DS:SI points to tables + ; CX = numchannels. + Xor DI, DI ; DI = counter of + ; currently act. + ; channels. +CountChannels1: + Mov AX, [SI] + Test AH, 8 + JNZ CountChannels2 + + And AX, 1 + Add DI, AX + +CountChannels2: + Add SI, SLAVECHANNELSIZE + Loop CountChannels1 + + Push CS + Pop DS +; ****** + Call Music_GetPlayMode + ; AX = playmode + ; BX = row + ; CX = pattern + ; DX = order + ; SI = max row. + + Push AX + Push DI + Cmp AX, 1 + JB UpdateInfoLineChanMsg + Push SI + Push BX ; BX = row + Push CX ; CX = pattern + JE UpdateInfoLine3 + JA UpdateInfoLine4 + +UpdateInfoLineChanMsg: + Mov SI, Offset ChannelMsg + Cmp DI, 1 + JA UpdateInfoLineChanMsg2 + + Mov SI, Offset EmptyMsg + +UpdateInfoLineChanMsg2: + Mov DI, (2+9*80)*2 + Mov AH, 20h + Call S_DrawString + Call FillToEOL + Pop AX + + Pop AX + Mov DisplayChannelMsg, 1 + Jmp UpdateInfoLine7 + +UpdateInfoLineEnd: + Call ShowTime + +UpdateInfoLineEnd2: + Pop SI + Pop DS + + Mov AX, 1 + Ret + +UpdateInfoLine3: + Mov DI, (2+9*80)*2 + Mov SI, Offset PatternPlayMsg + Mov AH, 20h + Call S_DrawString + Call FillToEOL + + Add SP, 8 + Jmp UpdateInfoLine5 + +UpdateInfoLine4: + Call PE_GetMaxOrder + + Push AX + Push DX + + Mov DI, (2+9*80)*2 + Mov SI, Offset SongPlayMsg + Mov AH, 20h + Call S_DrawString + Call FillToEOL + + Add SP, 12 + +UpdateInfoLine5: + Pop AX + +UpdateInfoLine6: +; Cmp AX, 2 +; JNE UpdateInfoLine7 + + +UpdateInfoLine7: + Call ShowTime + Call UpdatePointers + + Pop SI + Pop DS + + Mov AX, 1 + Ret + +EndP UpdateInfoLine + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc IdleUpdateInfoLine Far + + Call Music_Poll + +IF TUTORIAL +ELSE + Mov AL, 1 + Call S_SetDirectMode +ENDIF + + Call UpdateInfoLine + +IF TUTORIAL + Call Glbl_TutorialHandler +ENDIF + +IF TUTORIAL + Call S_UpdateScreen +ELSE + Mov AL, 0 + Call S_SetDirectMode +ENDIF + +IF NETWORKENABLED + Jmp Network_Poll +ELSE + Xor AX, AX + Ret +ENDIF + +EndP IdleUpdateInfoLine + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ClearInfoLine Far + + Mov DWord Ptr [CS:InfoLineText], 0 + + Ret + +EndP ClearInfoLine + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SetInfoLine Far ; DS:SI points to msg. + + Mov CS:InfoLineDelay, 20 + +SetInfoLineChain: + Mov Word Ptr [CS:InfoLineText], SI + Mov Word Ptr [CS:InfoLineText+2], DS + Mov Word Ptr [CS:InfoLineVariable], AX + + Ret + +EndP SetInfoLine + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SetInfoLine2 Far ; DS:SI points to msg. + + Mov CS:InfoLineDelay, BX + Jmp SetInfoLineChain + +EndP SetInfoLine2 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc UpdatePointers ; BX = row, CX = pattern + + Mov SI, Glbl + Mov DS, SI + Assume DS:Glbl + + Mov AH, CurrentMode + +; And AH, AH +; JZ UpdatePointers6 + + Push AX + Push BX + Push CX + +; Call S_GetDestination ; Get ES. + Call PE_FillSpeedTempo + + Pop CX + Pop BX + Pop AX + +UpdatePointers6: +; Cmp AH, 2 +; JNE UpdatePointers1 +; +; Cmp AL, 1 +; JB UpdatePointersEnd +; +; Call PE_ShowPatternRow +; Ret +; +; UpdatePointers1: + Cmp AL, 2 ; Playmode. + JNE UpdatePointers3 + + Cmp AH, 11 + JE UpdatePointers2 + Cmp AH, 21 + JNE UpdatePointers3 + +UpdatePointers2: + Call PE_ShowOrder + + Ret + +UpdatePointers3: + Cmp AH, 3 + JNE UpdatePointers4 + + Call I_ShowSamplePlay + Ret + +UpdatePointers4: + Cmp AH, 4 + JNE UpdatePointers5 + + Call I_ShowInstrumentPlay + Ret + +UpdatePointers5: +UpdatePointersEnd: + Ret + +EndP UpdatePointers + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ShowTime + + PushA + Push DS + + Push CS + Pop DS + Assume DS:InfoLine + + Cmp AX, 2 + Mov EAX, [TimerCounter] + JE ShowTime3 + + Cmp ShowUsageTime, 0 + JE ShowTime2 + + Jmp ShowTime4 + +ShowTime3: + Sub EAX, [PlaybackTimer] + +ShowTime4: + Mov EDX, 3600 + Mul EDX + ShRD EAX, EDX, 16 + ShR EDX, 16 + JNZ ShowTime2 + ; EAX = number of seconds + Mov EBX, 60 + Div EBX ; EAX = minutes, EDX = seconds + + Push EDX + Xor EDX, EDX + Div EBX ; EAX = hours, EDX = minutes + + Pop ECX + Push AX ; Hours on stack, CX = seconds, DX = min + Mov BL, 10 + + Mov AX, DX + Div BL + Add AX, 3030h + Mov [Word Ptr Minutes], AX + + Mov AX, CX + Div BL + Add AX, 3030h + Mov [Word Ptr Seconds], AX + + Mov SI, Offset TimeMsg + Mov DI, (62+9*80)*2 + Mov AH, 20h + Call S_DrawString + Pop AX ; To clear stack + +ShowTime2: + Pop DS + PopA + + Ret + +EndP ShowTime + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc StartClock Far + + Push EAX + Mov EAX, CS:TimerCounter + Mov [CS:PlaybackTimer], EAX + Pop EAX + + Ret + +EndP StartClock + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetTimerCounter Far + + Mov EAX, [CS:TimerCounter] + Ret + +EndP GetTimerCounter + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +EndS + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +End diff --git a/IT_M.ASM b/IT_M.ASM new file mode 100644 index 0000000..7ba3bf9 --- /dev/null +++ b/IT_M.ASM @@ -0,0 +1,664 @@ +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Main Module ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Jumps + .386 + +include switch.inc + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Externals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Segment Object1 BYTE Public 'Data' USE16 +EndS + + + Extrn F_DrawStringInput:Far + Extrn F_PreStringInput:Far + Extrn F_PostStringInput:Far + Extrn F_Nothing:Far + Extrn F_DrawBoxObject:Far + Extrn F_DrawTextObject:Far + Extrn F_PostExitObject:Far + Extrn F_SetDirectMode:Far + Extrn F_CharacterDefinitions:Far + Extrn F_DrawButtonObject:Far + Extrn F_PreButtonObject:Far + Extrn F_PostButtonObject:Far + Extrn F_CallFarFunction:Far + Extrn F_DrawThumbBar:Far + Extrn F_DrawScalableThumbBar:Far + Extrn F_PreThumbBar:Far + Extrn F_PreScalableThumbBar:Far + Extrn F_PostThumbBar:Far + Extrn F_PostScalableThumbBar:Far + Extrn F_DrawInfoLine:Far + Extrn F_CallFarPreFunction:Far + Extrn F_CallFarPostFunction:Far + Extrn F_DrawToggle:Far + Extrn F_PreToggle:Far + Extrn F_PostToggle:Far + + Extrn F_Draw5Num:Far + Extrn F_Pre5Num:Far + Extrn F_Post5Num:Far + + Extrn F_Draw3Num:Far + Extrn F_Pre3Num:Far + Extrn F_Post3Num:Far + + Extrn Glbl_TutorialHandler:Far + + Extrn H_SetHelpContext:Far + + Extrn K_GetKey:Far + Extrn K_InitKeyBoard:Far + Extrn K_UnInitKeyBoard:Far + Extrn K_IsKeyWaiting:Far + Extrn K_IsAnyKeyDown:Far + + Extrn PE_DrawOrderList:Far + Extrn PE_PreOrderList:Far + Extrn PE_PostOrderList:Far + + Extrn S_Set80x25Mode:Far + Extrn S_SetPalette:Far + Extrn S_RedefineCharacters:Far + Extrn S_DrawBox:Far + Extrn S_ClearScreen:Far + Extrn S_UpdateScreen:Far + +; Extrn MouseDirectEnable:Far, MouseDirectDisable:Far + Extrn MouseSaveEvents:Far, MouseRestoreEvents:Far + Extrn MouseInput:Far, MouseClearEvents:Far + Extrn GetKeyboardLock:Far, MIDIBufferEmpty:Far + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Globals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Global M_FunctionDivider:Far + Global M_FunctionHandler:Far + Global M_Object1List:Far + Global M_Object1ListDefault:Far + Public ReleaseTimeSlice + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +Segment Main DWORD Public 'Code' USE16 + Assume CS:Main, DS:Nothing + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Variables ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +DrawObjectList Label DWord + DD DWord Ptr F_DrawBoxObject ; 0 + DD DWord Ptr F_DrawTextObject ; 1 + DD DWord Ptr F_DrawButtonObject ; 2 + DD DWord Ptr F_Nothing ; Empty obj number, 3 + DD DWord Ptr F_Nothing ; 4 + DD DWord Ptr F_SetDirectMode ; 5 + DD DWord Ptr F_CharacterDefinitions ; 6 + DD DWord Ptr F_Nothing ; Empty obj number 7 + DD DWord Ptr F_CallFarFunction ; 8 + DD DWord Ptr F_DrawThumbBar ; 9 + DD DWord Ptr F_DrawInfoLine ; 10 + DD DWord Ptr H_SetHelpContext ; 11 + DD DWord Ptr PE_DrawOrderList ; 12 + DD DWord Ptr F_Draw3Num ; 13 + DD DWord Ptr F_DrawScalableThumbBar ; 14 + DD DWord Ptr F_CallFarFunction ; 15 + DD DWord Ptr F_DrawStringInput ; 16 + DD DWord Ptr F_DrawToggle ; 17 + DD DWord Ptr F_Draw5Num ; 18 + + +PreFunctionList Label DWord + DD DWord Ptr F_Nothing ; 0 + DD DWord Ptr F_Nothing ; 1 + DD DWord Ptr F_PreButtonObject ; 2 + DD DWord Ptr F_Nothing ; 3 + DD DWord Ptr F_Nothing ; 4 + DD DWord Ptr F_Nothing ; 5 + DD DWord Ptr F_Nothing ; 6 + DD DWord Ptr F_Nothing ; 7 + DD DWord Ptr F_Nothing ; 8 + DD DWord Ptr F_PreThumbBar ; 9 + DD DWord Ptr F_Nothing ; 10 + DD DWord Ptr F_Nothing ; 11 + DD DWord Ptr PE_PreOrderList ; 12 + DD DWord Ptr F_Pre3Num ; 13 + DD DWord Ptr F_PreScalableThumbBar ; 14 + DD DWord Ptr F_CallFarPreFunction ; 15 + DD DWord Ptr F_PreStringInput ; 16 + DD DWord Ptr F_PreToggle ; 17 + DD DWord Ptr F_Pre5Num ; 18 + +PostFunctionList Label DWord + DD DWord Ptr F_Nothing ; 0 + DD DWord Ptr F_Nothing ; 1 + DD DWord Ptr F_PostButtonObject ; 2 + DD DWord Ptr F_Nothing ; 3 + DD DWord Ptr F_PostExitObject ; 4 + DD DWord Ptr F_Nothing ; 5 + DD DWord Ptr F_Nothing ; 6 + DD DWord Ptr F_Nothing ; 7 + DD DWord Ptr F_Nothing ; 8 + DD DWord Ptr F_PostThumbBar ; 9 + DD DWord Ptr F_Nothing ; 10 + DD DWord Ptr F_Nothing ; 11 + DD DWord Ptr PE_PostOrderList ; 12 + DD DWord Ptr F_Post3Num ; 13 + DD DWord Ptr F_PostScalableThumbBar ; 14 + DD DWord Ptr F_CallFarPostFunction ; 15 + DD DWord Ptr F_PostStringInput ; 16 + DD DWord Ptr F_PostToggle ; 17 + DD DWord Ptr F_Post5Num ; 18 + +GlobalKeyList DD ? +ReleaseTimeSlice DB 0 + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Functions ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Proc M_FunctionDivider Far ; Given DS:SI points to list + ; Carry set if none found + Push BX + +M_FunctionDivider1: ; 0 = Direct comparison + ; 1 = Key comparison + ; 2 = Alt, 3 = Ctrl, 4 = Shift + ; 5 = capital key comparison + ; 6 = MIDI message + LodsB + Test AL, AL + JS M_FunctionDivider4 ; End of list + + Mov BX, CX + JZ M_FunctionDivider2 ; If AL = 0 + + Cmp AL, 2 + JE M_FunctionDivider8 + JB M_FunctionDivider5 + + Cmp AL, 4 + JB M_FunctionDivider18 + JE M_FunctionDivider10 ; If AL = 4 + + Cmp AL, 6 + JB M_FunctionDividerCAPS + +M_FunctionDividerMIDI: + Test CL, CL + JNZ M_FunctionDivider9 + Mov BX, CX + And BX, 0F000h + Jmp M_FunctionDividerCheck + +M_FunctionDividerCAPS: + Mov BX, DX + Cmp BX, 'a' + JB M_FunctionDivider6 + Cmp BX, 'z' + JA M_FunctionDivider9 + + Sub BL, 32 + +M_FunctionDivider6: + Cmp BX, 'A' + JB M_FunctionDivider9 + Cmp BX, 'Z' + JA M_FunctionDivider9 + Jmp M_FunctionDivider2 + +M_FunctionDivider5: + Mov BX, DX ; If al = 1... + Jmp M_FunctionDivider2 + +M_FunctionDivider8: + Test CH, 60h + JZ M_FunctionDivider9 + + And BX, 1FFh + Jmp M_FunctionDivider2 + +M_FunctionDivider18: + Test CH, 18h ; Ctrl + JZ M_FunctionDivider9 + And BX, 1FFh + + Jmp M_FunctionDivider2 + +M_FunctionDivider10: + Test CH, 6 + JZ M_FunctionDivider9 + And BX, 1FFh + +M_FunctionDivider2: + Test CL, CL + JZ M_FunctionDivider9 + +M_FunctionDividerCheck: + LodsW + Cmp AX, BX + JE M_FunctionDivider3 + + LodsW + Jmp M_FunctionDivider1 + +M_FunctionDivider9: + LodsW + LodsW + Jmp M_FunctionDivider1 + +M_FunctionDivider3: + DB 85h ; ClC +M_FunctionDivider4: ; + StC ; + + Pop BX + + Ret + +EndP M_FunctionDivider + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc M_FunctionHandler Far + ARG ObjectList:DWord + + Push BP + Mov BP, SP + + Call MouseSaveEvents + +M_FunctionHandler1: ; Draw all objects in list + Call GetKeyboardLock + Cmp AL, 2 + JE MouseInput1 + + Call MouseClearEvents + + LDS SI, ObjectList ; DS:SI points to object list + Add SI, 6 ; Skip pass list header + Xor AX, AX + +M_FunctionHandler2: + Cmp Word Ptr [SI], 0 ; DS:SI points to an offset of + JE M_FunctionHandler4 ; an object + +M_FunctionHandler3: + Push AX ; AX = object number + Push DS + Push SI + Push BP + + LES DI, ObjectList ; ES:DI points to object list + Mov SI, [SI] ; DS:SI points to object + Mov BX, [SI] ; BX = object type + Mov CL, 2 + ShL BX, CL + + Call DWord Ptr [DrawObjectList+BX] + + Pop BP + Pop SI ; DS:SI Points to an offset of + Pop DS ; an object + Pop AX + Inc AX + Add SI, 2 ; Advance Pointer + Jmp M_FunctionHandler2 ; Next Object + +M_FunctionHandler4: ; Call Prefunction for object + LDS SI, ObjectList ; DS:SI points to object list + Mov AX, [SI] ; AX = Active object number + LEA SI, [ESI+EAX*2+6] ; Skip pas list header (+6) + ; AX = object number + + Cmp Word Ptr [SI], 0 ; if list doesn't point to + JE M_FunctionHandler21 ; anything, don't call prefunc + +M_FunctionHandler20: + Mov SI, [SI] ; DS:SI points to object + Mov BX, [SI] ; BX = object type + ShL BX, 2 + + Push BP + Call DWord Ptr [PreFunctionList+BX] + Pop BP + +M_FunctionHandler21: + +IF TUTORIAL + Call Glbl_TutorialHandler +ENDIF + + Call S_UpdateScreen + +M_FunctionHandler5: ; Input... +; Call K_IsAnyKeyDown +; And AL, AL +; JNZ M_KeyBoardInput1 + +MouseInput1: + Call MouseInput ; returns 0 if nothing + ; 1 if input (BX, CX, DX set) + ; 2 if no input, but keyboard + ; locked + Cmp AX, 1 + JB M_KeyBoardInput1 + JA M_FunctionHandler6 ; IdleList + ; Handle postobject, of + ; object BX + + Mov AX, DI + Cmp BX, 0FFFFh + JE M_FunctionHandler23 + + LES DI, ObjectList ; ES:DI points to object list + Push ES + Pop DS + + Mov [DI], BX ; Object number in BX. + LEA BX, [EBX*2+EDI+6] ; ES:BX points to offset of + ; active object. + + Mov SI, [BX] ; DS:SI points to object + + Mov SI, [SI] ; SI = object type of active obj + ShL SI, 2 + + Push BP + Call DWord Ptr [PostFunctionList+SI] + Pop BP + Jmp M_FunctionHandler23 + +M_KeyBoardInput1: + Call MIDIBufferEmpty + JAE M_FunctionHandler8 + + Call K_IsKeyWaiting + + Test AX, AX + JNZ M_FunctionHandler8 + ; Check for mouse info... + +M_FunctionHandler6: ; IdleList + Cmp CS:ReleaseTimeSlice, 0 + JE NoReleaseTimeSlice + + Mov AX, 1680h + Int 2Fh + +NoReleaseTimeSlice: +; StI + + LDS SI, ObjectList ; DS:SI points to object list + Add SI, 2 ; DS:SI points to idle list + + Cmp Word Ptr [SI], 0 + JE M_FunctionHandler5 ; If Offset of IdleList = 0, + ; check for another key + +M_FunctionHandler7: + Mov SI, [SI] + Xor BX, BX ; Clear flag. + +M_FunctionHandler19: + Cmp Word Ptr [SI], 0 + JNE M_FunctionHandler18 + + Cmp Word Ptr [SI+2], 0 + JE M_FunctionHandler29 + +M_FunctionHandler18: + Push SI + Push BX + Push DS + Push BP + + Call DWord Ptr [SI] + + Pop BP + Pop DS + Pop BX + + Cmp AX, 5 + JE M_FunctionHandlerIdleCommand + + Pop SI + + Add SI, 4 + + Or BX, AX + Jmp M_FunctionHandler19 + +M_FunctionHandlerIdleCommand: + Pop AX ; Pull off SI from the stack + Mov AX, DI + Jmp M_FunctionHandler10 +; Mov SI, 1 +; Jmp M_FunctionHandler16 + +M_FunctionHandler29: + Test BX, BX + JZ M_FunctionHandler5 + + Jmp M_FunctionHandler1 + +M_FunctionHandler8: + Call K_GetKey ; CX = Keyboard Input Data + ; DX = Translated Input Data + ; else MIDI input if CL = 0 + +M_FunctionHandler9: + LES DI, ObjectList ; ES:DI points to object list + Push ES + Pop DS + + Mov BX, [DI] ; BX = active object number + LEA BX, [EDI+EBX*2+6] ; ES:BX points to offset of + ; active object. + Xor AX, AX + + Cmp Word Ptr [BX], 0 + JE M_FunctionHandler23 + +M_FunctionHandler22: + Mov SI, [BX] ; DS:SI points to object + + Mov SI, [SI] ; SI = object type of active obj + ShL SI, 2 + + Push BP + Call DWord Ptr [PostFunctionList+SI] + Pop BP + +M_FunctionHandler23: + Push DS + Push SI + + LDS SI, ObjectList + Add SI, 4 + Mov SI, [SI] + Mov Word Ptr CS:GlobalKeyList+2, DS + Mov Word Ptr CS:GlobalKeyList, SI + + Pop SI + Pop DS + +; Xor BX, BX ; Extra key list starts at 0 + +M_FunctionHandler10: + Cmp AX, 1 + JB M_FunctionHandler11 ; If AX = 0 + JE M_FunctionHandler1 ; Redraw screen if AX = 1 + + Cmp AX, 3 + JB M_FunctionHandler4 ; Goto preobject if AX = 2 + JE M_FunctionHandler5 ; Get next input + + Cmp AX, 5 ; New list + JE M_FunctionHandler16 + JA M_FunctionHandler11 ; If > 5 + + Call MouseRestoreEvents + + Pop BP + Ret 4 + +M_FunctionHandler16: + Mov Word Ptr Offset ObjectList, DX + Mov Word Ptr Offset ObjectList+2, CX + Mov AX, SI + + Jmp M_FunctionHandler10 + +M_FunctionHandler11: + LDS SI, CS:GlobalKeyList + + Cmp Word Ptr [SI], 0 + JE M_FunctionHandler4 + +M_FunctionHandler12: + LodsB + Mov BX, DX + Cmp AL, 1 + JE M_FunctionHandler13 ; Keycode compare (1) + Mov BX, CX + JB M_FunctionHandler13 ; Scancode compare (0) + + And BX, 1FFh + + Cmp AL, 3 + JB M_FunctionHandlerAlt ; Alt-keycode compare (2) + JE M_FunctionHandlerCtrl ; Ctrl-keycode compare (3) + + Cmp AL, 5 + JB M_FunctionHandlerForced ; Always call function (4) + JE M_FunctionHandlerNewListNear ; Chain to new list (5) + + Cmp AL, 7 + JB M_FunctionHandlerShift ; Shift-keycode compare (6) + JE M_FunctionHandlerNewListFar ; Chain to far list (7) + + Cmp AL, 9 + JB M_FunctionHandlerCapCheck ; Capitalised keycode (8) + JE M_FunctionHandlerMIDI ; MIDI message (9) + +; Jmp M_FunctionHandler1 + Jmp M_FunctionHandler4 ; Undefined compare.. +; ; -> end of list + +M_FunctionHandlerAlt: + Test CH, 60h + JZ M_FunctionHandler14 + Jmp M_FunctionHandler13 + +M_FunctionHandlerCtrl: + Test CH, 18h + JZ M_FunctionHandler14 + Jmp M_FunctionHandler13 + +M_FunctionHandlerShift: + Test CH, 6h + JZ M_FunctionHandler14 + Jmp M_FunctionHandler13 + +M_FunctionHandlerNewListNear: + LodsW + Mov Word Ptr CS:GlobalKeyList, AX + Jmp M_FunctionHandler11 + +M_FunctionHandlerNewListFar: + LodsD + Mov CS:GlobalKeyList, EAX + Jmp M_FunctionHandler11 + +M_FunctionHandlerForced: + LodsW + Jmp M_FunctionHandler26 + +M_FunctionHandlerCapCheck: ; Capital OK? (8) + Mov BX, DX + Cmp BX, 'A' + JB M_FunctionHandler14 + Cmp BX, 'z' + JA M_FunctionHandler14 + Cmp BX, 'a' + JB M_FunctionHandlerCapCheck1 + + Sub BL, 32 + +M_FunctionHandlerCapCheck1: + Jmp M_FunctionHandler13 + +M_FunctionHandlerMIDI: + Test CL, CL + JNZ M_FunctionHandler14 + Mov BX, CX + And BX, 0F000h + Jmp M_FunctionHandlerCheck + +M_FunctionHandler13: + Test CL, CL + JZ M_FunctionHandler14 + +M_FunctionHandlerCheck: + LodsW + Cmp BX, AX + JNE M_FunctionHandler14 + +M_FunctionHandler26: + LES DI, ObjectList ; ES:DI points to object list + Push BP + Call DWord Ptr [SI] + Pop BP + Jmp M_FunctionHandler15 + +M_FunctionHandler14: + Xor AX, AX + +M_FunctionHandler15: + Add Word Ptr CS:GlobalKeyList, 7 + Jmp M_FunctionHandler10 + +EndP M_FunctionHandler + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc M_Object1ListDefault Far ; Reqs: DI = offset of list + + Mov CX, 0FFFFh + +Proc M_Object1List Far ; Reqs.. CX = inital object. + ; Reqs.. DI = offset of list + + Mov AX, Object1 + Push AX + Mov ES, AX + Push DI + Cmp CX, 0FFFFh + JE M_Object1List1 + + Mov Word Ptr [ES:DI], CX + +M_Object1List1: + Call M_FunctionHandler + + Ret + +EndP M_Object1List +EndP M_Object1ListDefault + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +EndS + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +End diff --git a/IT_MDATA.ASM b/IT_MDATA.ASM new file mode 100644 index 0000000..e4e01cc --- /dev/null +++ b/IT_MDATA.ASM @@ -0,0 +1,3652 @@ + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +Segment SongData PARA Public 'Data' + +Org 0 + + DB "IMPM", 36 Dup (0) + DW 0, 0, 9, 0 + DB 128, 30h, 6, 125, 128, 0 + DW 0, 0, 0, 0, 0 + DB 64 Dup (32), 64 Dup (64), 64 Dup (0) + + DB 256 Dup (0FFh) ; 512 bytes + +; Instrument headers, unrolled simply because TASM runs out of memory otherwise + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 4 Dup (0) + +; Sample headers + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + + + DW 400 Dup (0) + +OffsetCounter = 512 + +Rept 100 + DW OffsetCounter + OffsetCounter = OffsetCounter + 554 +EndM + +Rept 100 + DW OffsetCounter + OffsetCounter = OffsetCounter + 80 +EndM + + DW 65114 + +MIDISampleHeader Label Byte + DB "MIDI", 13 Dup (0), 64, 11h, 64, "MIDI Instrument", 13 Dup (0) + DD 8, 0, 8, 44100, 0, 0 + DW 1 + + DW SongData+4075 + DD 0 + + DB 22 Dup (0) + DW (128+16+9)*32/2 Dup (0) +EndS + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +End + diff --git a/IT_MMTSR.ASM b/IT_MMTSR.ASM new file mode 100644 index 0000000..7aebdcd --- /dev/null +++ b/IT_MMTSR.ASM @@ -0,0 +1,1028 @@ +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ MMTSR Module ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + .386 + +include switch.inc + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Externals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Extrn E_AllocateEMS:Far + Extrn E_GetEMSPageFrame:Far + Extrn E_ReleaseEMS:Far + Extrn E_MapEMSMemory:Far + Extrn Music_Stop:Far + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Globals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Global MMTSR_InstallMMTSR:Far + Global MMTSR_UninstallMMTSR:Far + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +Segment MMTSR PARA Public USE16 'Code' + Assume CS:MMTSR, DS:MMTSR + +CREATENEWLOGFILE EQU 0 +include debug.inc + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Variables ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +MAX8 equ 0f8H ; decompression constants +MAX16 equ 0fff0h + +BBsize equ 0 ; stucture of MMCMP BigBlocks header +BBcmpsize equ 4 ; (relative offset) +BBxorchk equ 8 +BBnblk equ 12 +BBflag equ 14 +BBntab equ 16 +BBsnbit equ 18 +BBheadersize equ 20 + +InstalledFromIT DB 0 + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Functions ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +Proc MMTSR_InstallMMTSR Far + + Push CS + Push CS + Pop DS + Pop ES + + Trace " - Determining if MMTSR is already installed" + + mov ax,4370h + int 21h ; check if already installed + + cmp eax,4352697ah + je @error ; if installed, don't install it again + +@notinstalled: + Trace " - Allocating 64kb of EMS memory for MMTSR decoding" + + StC + Mov EAX, 65536 ; 64k + Call E_AllocateEMS + + Test AX, AX + JZ @error ; AX = handle, 0 if error. + +@emsdriver: + Mov _memhandle, AX + Call E_GetEMSPageFrame + Mov BaseSeg, AX + +@fixups: + Trace " - Installing new INT21h handler" + + mov si,offset _inbuf+2 + mov [si],ax + mov dx,Bufsize + shr dx,4 + add ax,dx + mov [si+4],ax + add ax,20h + mov [si+8],ax + add ax,110h + mov [si+12],ax + add ax,dx + mov [si+16],ax + + mov ax,3521h + int 21h + mov word ptr [_old21],bx ; get old INT 21h handler + mov word ptr [_old21+2],es + mov dx,offset @new21 + mov ax,2521h + int 21h ; set new INT 21h handler + + mov byte ptr [_actived],1 ; MMTSR is ACTIVE! + + Mov InstalledFromIT, 1 + +@error: +@error0: ; print message at offset DS:DX onto screen + Ret + +EndP MMTSR_InstallMMTSR + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +Proc MMTSR_UninstallMMTSR Far + + Push CS + Pop DS + + Cmp InstalledFromIT, 0 + JE MMTSR_UninstallMMTSR1 + + Mov DX, Word Ptr [_old21] ; Reset handler. + Mov DS, Word Ptr [_old21+2] + Mov AX, 2521h + Int 21h + + Mov AX, CS:_memhandle + Call E_ReleaseEMS + +MMTSR_UninstallMMTSR1: + Ret + +EndP MMTSR_UninstallMMTSR + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + + +;**************************************************************************** +; NEW INTERRUPT 21 HANDLER +;**************************************************************************** + +@activate: + and al,1 + mov byte ptr cs:[_actived],al + IRet + +@installcheck: + mov eax,4352697ah + iret +@new21: ; <<<<---------- INT 21 starts here + cmp ax,4370h + je short @installcheck + cmp ax,4371h + je short @activate + cmp ax,4372h + je short @activate + cmp byte ptr cs:[_actived],1 + jne short @noopen ; originaly intercepts 'open' only... + cmp ah,3dh ; now stands for 'do old interrupt' + je short @intercept + cmp ah,3eh ; MMTSR intercepts 'open file' calls, and + jne short @noopen ; close file if the handle is the + cmp bx,cs:_modulehandle ; temporary decompressed module handle + je short @intercept + +@noopen: + jmp dword ptr cs:[_old21] ; Chain to old interrupt + +@intercept: + mov byte ptr cs:[_actived],0 ; desactivate MMTSR while running + mov byte ptr cs:[_function],ah + mov word ptr cs:[_oldstack],sp ; une hook's stack + mov word ptr cs:[_oldstack+2],ss + + pushf + + Call DWord Ptr [CS:_old21] + + push es bx ax + les bx,cs:[_oldstack] ; + pushf ; + pushf ; preserve "returned from interrupt" flags + pop ax ; and set IF!! ;) + or ah,2 ; + mov word ptr es:[bx+4],ax ; + popf ; "or" modifies flags... + pop ax bx es ; + jc @eoi ; I/O error + cmp cs:[_function],3dh + je short @open + + ; close temporary file and delete it +@close: + cmp byte ptr cs:_openedfile,1 + jne @eoi + pusha + push ds + mov ax,cs + mov ds,ax + mov dx,offset _tempfile + mov ah,41h + int 21h + pop ds + popa + mov word ptr cs:[_modulehandle],0 + mov byte ptr cs:[_openedfile],0 + jmp @eoi + + ; open file, create the temporary one, decompress, etc.... +@open: + mov word ptr cs:[_cmphandle],ax + pushad + push ds + push es + push fs + push gs + +;---------------------------------------------------------------------------- +; all registers are preserved +;---------------------------------------------------------------------------- + mov ax,cs + mov ds,ax + mov bp,sp + + mov bx,[_cmphandle] + mov ax,4400h + int 21h + test dx,0080h + jne @nochg ; handle is a DEVICE handle, not a file! + mov bx,[_cmphandle] + mov cx,8 + mov dx,OFFSET _signaturecheck + mov ah,03fh ; read first 8 bytes of the opened file + int 21h + push ax + mov bx,[_cmphandle] + xor edx,edx ; reset file pointer to its beginning + call @lseek + pop ax + cmp ax,8 + jne @nochg + cmp dword ptr _signaturecheck,4352697ah ; + jne @nochg ; check for ziRCONia + cmp dword ptr [_signaturecheck+4],61694e4fh ; + jne @nochg ; + + Call Music_Stop + +@emsswap: + mov dx,_memhandle + Mov AH, 47h + Int 67h + + Mov CX, 4 + Call E_MapEMSMemory + +;------------------ we now have free mem to work --------------------------- +@afterswap: + mov ah,3ch ; + mov cx,20h ; create temporary file + mov dx,offset _tempfile ; + int 21h + jc @swapback + mov word ptr [_modulehandle],ax + mov byte ptr [_openedfile],1 + mov bx,[_cmphandle] + mov edx,8 + call @lseek + push 16 + push ds + push offset _filehead ; read file header, 16 bytes minimum + call @read ; (as for now, 16 bytes max too....) + add sp,6 + mov bx,[_cmphandle] + mov edx,_blockptr + call @lseek + mov ax,_blktoprocess + shl ax,2 ; load the BigBlock offset table into + push ax ; memory + push dword ptr _blkoffset + call @read + add sp,6 + mov word ptr _curblock,0 + +@blockloop: + les di,_blkoffset + add di,_curblock + add word ptr _curblock,4 + mov edx,es:[di] ; + mov bx,_cmphandle ; lseek to next BigBlock + call @lseek + les di,_BB ; es:0 -> current BB + mov di,BBheadersize + push di + push dword ptr [_BB] ; read the BB + call @read ; + add sp,6 + mov ax,es:[BBnblk] ; number of small block within BB + shl ax,3 + push ax + push es + push di + call @read ; read all 'small blocks' info + add sp,6 ; (dw offset, dw size) = 8 bytes each + mov dword ptr _curblkpos,0 ; offset 0 in the first small blk + mov al,es:[BBsnbit] + mov _snbit,al ; snbit: compression info... + test word ptr es:[BBflag],1 + je @notcompressed ; if not compressed, why bother? + +@compressed: + push word ptr es:[BBntab] + push dword ptr _ttabl ; read translation table (cmp stuff...) + call @read + add sp,6 + movzx eax,ax + mov esi,es:[BBcmpsize] ; esi = toread (copmressed size) + sub esi,eax ; - trans table size + xor eax,eax + mov _lasteax,eax ; _lastXXXX: since blocks may be larger + ; than the buffer, small blocks may have + ; to be decompressed in more than one shot. + ; _lastXXX preserve current state of reg. + + mov dword ptr _left,eax ; changes also _lastsmp + mov byte ptr _lastch,al + jmp @compressloopend +@compressloop: + movzx eax,word ptr Bufsize + sub ax,_left + cmp esi,eax ; read the most we can... + jnb short @readbuf + mov eax,esi +@readbuf: + push ax + mov eax,_inbuf + add ax,_left + push eax + call @read ; fill inbuf + add sp,6 + movzx eax,ax + sub esi,eax + add ax,_left + mov _rd,ax ; _rd = number of bytes of data in inbuf + test word ptr es:[BBflag],4 + jne short @16bits + call @Uncompbuf8 ; (inbuf, outbuf, &used) in DS + mov _towrite,ax + call @Translatebuf8 ; (outbuf, towrite) in DS + test word ptr es:[BBflag],2 + je short @nodelta8 + call @Undeltabuf8; (outbuf, towrite, lastbyte) in DS +@nodelta8: + mov cl,8 + jmp short @deltadone +@16bits: + call @UncompBuf16 ; for now, write function is ok even is we have a + mov _towrite,ax ; 16 bits buffer with and odd length. + call @UndeltaBuf16 ; (outbuf, towrite, lastbyte) in DS + xor cl,cl + +@deltadone: + lfs bx,_outbuf + add bx,_towrite + mov ax,fs:[bx-2] + shr ax,cl + mov word ptr _lastsmp,ax ; keep the last sample for future 'undelta' + mov cx,_rd + sub cx,_used + jnb short @leftok + xor cx,cx +@leftok: + mov _left,cx ; inbuf might not have been used up, some is left + je short @writeblock + add cx,3 + shr cx,2 + push ds es si di + les di,_inbuf + mov si,_used ; copy unused part of inbuf to its bottom + add si,di + mov ds,word ptr [_inbuf+2] + rep movsd + pop di si es ds +@writeblock: + call @writeblk ; function to write blocks of data (see it...) +@compressloopend: + movzx eax,word ptr _left + or eax,esi ; is there something left to uncompress? + jne @compressloop + jmp short @blockloopend + + ; this part simply copy the uncompressed buffer from the compressed + ; module to the temp uncompressed module +@notcompressed: + mov esi,es:[BBcmpsize] ; esi = toread +@continuenc: + movzx eax,word ptr Bufsize + cmp esi,eax + jnb short @readubuf + mov ax,si +@readubuf: + push ax + push dword ptr _outbuf + call @read + add sp,6 + mov _towrite,ax + movzx eax,ax + sub esi,eax + call @writeblk + or esi,esi + jne short @continuenc + +@blockloopend: + dec word ptr _blktoprocess ; BigBlocks loop end + jne @blockloop + +; ----------------------------- done decompressing! ------------------------- + mov bx,_modulehandle + mov ah,3eh + int 21h ; close temp file to set file size correctly + mov dx,offset _tempfile + mov ax,3d00h + int 21h ; reeopen it in read only for the Player/tracker + mov _modulehandle,bx + mov [bp+36],bx ; put handle in preserved register + mov ah,3eh + mov bx,_cmphandle + int 21h + +;------------------ swap back memory --------------------------- + +@swapback: +@emsswapback: + mov ah,48h + mov dx,_memhandle + int 67h + +@swapbackdone: +; pop gs ; this part must be used to return +; pop fs ; after somthing has been done when +; pop es ; debugging. +; pop ds +; popad +; lss sp,cs:[_oldstack] +; mov cs:byte ptr [_actived],1 +; iret +;---------------------------------------------------------------------------- +; restore all registers +;---------------------------------------------------------------------------- +@nochg: + pop gs + pop fs + pop es + pop ds + popad +@eoi: +; lss sp,cs:[_oldstack] + mov cs:byte ptr [_actived],1 + iret + +;**************************************************************************** +; I/O ROUTINES +;**************************************************************************** + + ; writes decompressed blocks of data at their respective offsets + ; withing the temp module + ; _towrite = lenght to write + ; _curblkpos = current position relative to beginning of the current + ; small block +@writeblk proc near + push ebp + push si + xor si,si + mov ebp,_curblkpos +@writeloop: + mov edx,es:[di] + add edx,ebp + mov bx,_modulehandle + call @lseek + mov ecx,es:[di+4] + sub ecx,ebp + xor ebx,ebx + mov bx,_towrite + cmp ebx,ecx + jnb short @100 + mov cx,bx +@100:push cx + mov bx,_modulehandle + mov ah,40h + push ds + lds dx,_outbuf + add dx,si + int 21h + pop ds + pop ax + add si,ax + sub _towrite,ax + movzx eax,ax + add ebp,eax + cmp ebp,es:[di+4] + jne short @notblockend + add di,8 + dec word ptr es:[BBnblk] + xor ebp,ebp +@notblockend: + or word ptr _towrite,0 + jz short @writeend + or word ptr es:[BBnblk],0 + jnz short @writeloop +@writeend: + mov _curblkpos,ebp + pop si + pop ebp + ret +@writeblk endp + + ; this reads only from the compressed module! +@read proc near + push bp + +; Mov DX, _memhandle +; Mov CX, 4 +; Call E_MapEMSMemory + + mov bp,sp + mov bx,_cmphandle + push ds + lds dx,[bp+4] + mov cx,[bp+8] + mov ah,3fh + int 21h + pop ds bp + ret +@read endp + +@lseek proc near + shld ecx,edx,16 + mov ax,4200h + int 21h + ret +@lseek endp + +;**************************************************************************** +; ROUTINES TO UNCOMPRESS +;**************************************************************************** + + ; unsigned int Uncompress(char far *ib, char far *ob, word far *used) +@Uncompbuf8 proc near + push bp + mov bp,sp + sub sp,2 + push si + push di + push fs + push es + lfs si,_inbuf + les di,_outbuf + + lea ax,[di-100h] + add ax,Bufsize + mov [bp-2],ax + + mov ch,_lastch ; bit count in eax + mov eax,_lasteax ; eax : data + mov cl,_snbit ; num of bit to use + inc cl + xor bh,bh + xor dx,dx + jmp short @017 + +@012:shrd dx,ax,cl + shr eax,cl + rol dx,cl + sub ch,cl + mov bl,cl +@013:cmp dl,[bx+_bchg8-1] + jb short @016 + shl bx,1 + jmp word ptr [bx+_fct1-2] +@015c:and dl,7 ; 3 bits used + jmp short @011 +@015b:and dl,3 ; 2 bits used, get highest bit + shr eax,1 + rcl dl,1 + sub ch,1 + jmp short @011 +@015a:and dl,1 ; 1 bit used, get 2 highest bits + shl dl,2 + shrd dx,ax,2 + shr eax,2 + rol dx,2 + sub ch,2 + jmp short @011 +@015:xor dl,dl ; no bit used, get 3 bits + shrd dx,ax,3 + shr eax,3 + rol dx,3 + sub ch,3 +@011:shr bx,1 + inc dl + cmp cl,dl + je short @011a + mov cl,dl + jmp short @017 +@011a: ; Special commands (254,255, end); + mov dl,al + shr eax,3 + sub ch,3 + and dl,7 + cmp dl,7 + je short @019 ; maybe end-of-buf command +@016a:add dl,MAX8 +@016:mov es:[di],dl ; Store uncompressed data + inc di + cmp di,[bp-2] + je short @019b + xor dl,dl +@017:cmp ch,10H + jnb short @012 +@018:xchg cl,ch + ror eax,cl + mov ax,fs:[si] + add si,2 + rol eax,cl + add cl,10H + xchg cl,ch + jmp @012 +@019:dec ch + shr eax,1 + jnc @016a ; no only a 255 +@019b: + mov _lastch,ch + mov _lasteax,eax + dec cl + mov _snbit,cl + sub si,word ptr _inbuf + mov _used,si + sub di,word ptr _outbuf + mov ax,di + pop es + pop fs + pop di + pop si + leave + ret +@Uncompbuf8 endp + +; void UndeltaBuf8(void far *buf, unsigned int len, char lastbyte) +@UndeltaBuf8 proc near + push ds + mov cx,_towrite + add cx,3 + and cl,0fch + mov dl,byte ptr _lastsmp + lds bx,_outbuf + add cx,bx +@091:mov eax,[bx] + add al,dl + add ah,al + mov dl,ah + ror eax,16 + add al,dl + add ah,al + mov dl,ah + ror eax,16 + mov [bx],eax + add bx,4 + cmp bx,cx + jne short @091 +@092:pop ds + ret +@UndeltaBuf8 endp + +; void TranslateBuf8(char far *buf, unsigned int len) +@TranslateBuf8 proc near + push es + push ds + push si + push di + mov cx,_towrite + add cx,3 + shr cx,2 + les di,_outbuf + lds si,_ttabl + xor bh,bh +@110: mov eax,es:[di] + mov bl,al + mov al,[bx+si] + mov bl,ah + mov ah,[bx+si] + ror eax,16 + mov bl,al + mov al,[bx+si] + mov bl,ah + mov ah,[bx+si] + ror eax,16 + stosd + dec cx + jne short @110 + pop di + pop si + pop ds + pop es + ret +@TranslateBuf8 endp + +;******************************************************************* +;******************** 16 bits decompression code ******************* + + ; unsigned int Uncompbuf16(char far *ib, char far *ob, CompProcess *CP) +@Uncompbuf16 proc near + push bp + mov bp,sp + sub sp,2 + push si + push di + push fs + push es + lfs si,_inbuf + les di,_outbuf + + lea ax,[di-100h] + add ax,Bufsize + mov [bp-2],ax + + mov ch,_lastch ; bit count in eax + mov eax,_lasteax ; eax : data + mov cl,_snbit ; num of bit to use + + inc cl + xor dx,dx + xor ebx,ebx + jmp @217 + +@212:shrd dx,ax,cl + shr eax,cl + rol dx,cl + sub ch,cl + mov bl,cl + cmp ch,10H + jnb short @213 + xchg cl,ch + ror eax,cl + mov ax,fs:[si] + add si,2 + rol eax,cl + add cl,10H + xchg cl,ch +@213: dd 1b943b67H ;\ + dw (_bchg16-2) ; } cmp dx,[ebx+ebx+_bchg16-2] + dw 0 ;/ + jb @216 + dd 1ba4ff67H ;\ jmp word ptr [ebx+ebx+_fct3-2] still this + dw (_fct3-2) ; } bug with 16 bits labels... + dw 0 ;/ +@215d:and dx,15 ; 4 bits used + jmp short @211 +@215c:and dl,7 ; 3 bits used, get highest bit + shr eax,1 + rcl dl,1 + dec ch + jmp short @211 +@215b:and dl,3 ; 2 bit used, get 2 highest bits + shl dl,2 + shrd dx,ax,2 + shr eax,2 + rol dx,2 + sub ch,2 + jmp short @211 +@215a:and dl,1 ; 1 bit used, get 3 highest bits + shl dl,3 + shrd dx,ax,3 + shr eax,3 + rol dx,3 + sub ch,3 + jmp short @211 +@215:xor dl,dl ; no bit used, get 4 bits + shrd dx,ax,4 + shr eax,4 + rol dx,4 + sub ch,4 +@211:inc dl + cmp cl,dl + je short @211a + mov cl,dl + jmp short @217 +@211a: ; Special commands; + cmp ch,10H + jnb short @216b + xchg cl,ch + ror eax,cl + mov ax,fs:[si] + add si,2 + rol eax,cl + add cl,10H + xchg cl,ch +@216b:mov dl,al + shr eax,4 + sub ch,4 + and dx,15 + cmp dl,15 + je short @219 ; maybe end-of-buf command +@216a:add dx,MAX16 +@216:mov es:[di],dx ; Store uncompressed data + add di,2 + cmp di,[bp-2] + je short @219b + xor dx,dx +@217:cmp ch,10H + jnb @212 +@218:xchg cl,ch + ror eax,cl + mov ax,fs:[si] + add si,2 + rol eax,cl + add cl,10H + xchg cl,ch + jmp @212 +@219:cmp ch,10H + jnb short @219a + xchg cl,ch + ror eax,cl + mov ax,fs:[si] + add si,2 + rol eax,cl + add cl,10H + xchg cl,ch +@219a:dec ch + shr eax,1 + jnc @216a ; no only a 65535 +@219b: + mov _lastch,ch + mov _lasteax,eax + dec cl + mov _snbit,cl + sub si,word ptr _inbuf + mov _used,si + sub di,word ptr _outbuf + mov ax,di + pop es + pop fs + pop di + pop si + leave + ret +@Uncompbuf16 endp + +; void UndeltaBuf16(char far *buf, unsigned int len, CompProcess *CP) +@UndeltaBuf16 proc near + push ds + push si + mov cx,_towrite + add cx,3 + shr cx,2 + mov bx,_lastsmp + lds si,_outbuf + test word ptr es:[BBflag],2 + je short @321 +@320:mov eax,[si] + shr ax,1 + rcr dx,1 + sar dx,15 + xor ax,dx + add ax,bx + mov bx,ax + ror eax,16 + shr ax,1 + rcr dx,1 + sar dx,15 + xor ax,dx + add ax,bx + mov bx,ax + ror eax,16 + mov [si],eax + add si,4 + dec cx + jne short @320 + jmp short @323 +@321:test word ptr es:[BBflag],200h + je short @323 +@322:mov eax,[si] + shr ax,1 + rcr dx,1 + sar dx,15 + xor ax,dx + ror eax,16 + shr ax,1 + rcr dx,1 + sar dx,15 + xor ax,dx + ror eax,16 + mov [si],eax + add si,4 + dec cx + jne short @322 +@323:pop si + pop ds + mov word ptr _lastsmp,bx + ret +@UndeltaBuf16 endp + +;******************************************************************* +;******************** 8 bits decompression data ******************** +_bchg8 label byte + db 01H + db 03H + db 07H + db 0fH + db 1eH + db 3cH + db 78H + db 0f8H +EVEN +_fct1 label word + dw @015 + dw @015 + dw @015 + dw @015 + dw @015a + dw @015b + dw @015c + dw @015c +;******************************************************************* +;********************* 16 bits compression data ******************** +_bchg16 label word + dw 00001H ;1 + dw 00003H ;2 + dw 00007H ;3 + dw 0000fH ;4 + dw 0001eH ;5 + dw 0003cH ;6 + dw 00078H ;7 + dw 000f0H ;8 + dw 001f0H ;9 + dw 003f0H ;10 + dw 007f0H ;11 + dw 00ff0H ;12 + dw 01ff0H ;13 + dw 03ff0H ;14 + dw 07ff0H ;15 + dw 0fff0H ;16 + +_fct3 label word + dw @215 + dw @215 + dw @215 + dw @215 + dw @215a + dw @215b + dw @215c + dw @215d + dw @215d + dw @215d + dw @215d + dw @215d + dw @215d + dw @215d + dw @215d + dw @215d + +@settings: +align 4 +BaseSeg dw 08000h +Bufsize dw 06E00h ; 0b000h or anything else for XMS... + +_inbuf dd 0 ; size: Bufsize ; Basemem +_ttabl dd 0 ; size: 200h ; Basemem + Bufsize +_BB dd 0 ; size: 1100h ; Basemem + Bufsize + 200h +_outbuf dd 0 ; size: Bufsize ; Basemem + Bufsize + 1300h +_blkoffset dd 0 ; size: 2000h ; Basemem + 2*Bufsize + 1300h + +_tempfile db 'C:\_~zirc~_.tmp',0,0,0,0,0,0,0,0 ; 23 b + NULL (24 b) + +_old21 dd 0 +_driver dd 0 +_oldstack dd 0 +_memhandle dw 0 +_actived db 0 +_openedfile db 0 +_function db 0 + +_signaturecheck label qword +_filehead: + _headersize dw 0 + _version dw 0 + _blktoprocess dw 0 + _unpacklen dd 0 + _blockptr dd 0 + _dummy dw 0 + +_cmphandle dw 0 +_modulehandle dw 0 + +_lasteax dd 0 +_left dw 0 +_lastsmp dw 0 +_lastch db 0 + +_curblock dw 0 +_curblkpos dd 0 +_towrite dw 0 +_rd dw 0 +_used dw 0 +_snbit db 0 + +align 2 + +EndS + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +EndS + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +End diff --git a/IT_MOUSE.ASM b/IT_MOUSE.ASM new file mode 100644 index 0000000..d58a965 --- /dev/null +++ b/IT_MOUSE.ASM @@ -0,0 +1,1412 @@ +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Mouse Module ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Jumps + .386P + +; MouseRecord Structure... +; Area DW Left, Top, Right, Bottom +; Condition DB ? +; Flags DB ? +; ObjectNumber DW ? +; Function DD DWord FunctionPtr +; +; Condition bits +; Bit 0: Mouse moved +; Bit 1: Left button pressed +; Bit 2: Left button held +; Bit 3: Left button released +; Bit 4: Right button pressed +; Bit 5: Right button held +; Bit 6: Right button released +; +; Flags +; Bit 0-1: Condition test +; 0 = equal +; 1 = result when ANDed +; 2, 3 = reserved +; Bit 2: NOT of condition test +; Bit 3: Off - Cursor within area +; On - Cursor outside area +; Bit 4: Always call, ignore area + +include switch.inc + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Externals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Extrn S_SetSequencer:Far, S_ResetSequencer:Far + Extrn S_SetDirectMode:Far + Extrn S_GetDestination:Far + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Globals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Global InitMouse:Far, UnInitMouse:Far + Global MouseCharacterGenerationOffset:Word + Global RestoreMouse:Far, DrawMouse:Far + Global MouseSecondSetEnable:Far, MouseSecondSetDisable:Far + Global RestoreMouseGraphics:Far, MouseToggle:Far + Global MouseInput:Far, AddMouseQueue:Far + Global SetKeyboardLock:Far, GetKeyboardLock:Far + Global MouseSaveEvents:Far, MouseRestoreEvents:Far + Global MouseAddEvent:Far, MouseClearEvents:Far + Global MouseRemoveEvents:Far, MouseSetXY:Far + Global MouseGetStatus:Far, NewCharacterSet:Far + Global MouseUpdateEnable:Far, MouseUpdateDisable:Far + Global SetMouseCursorType:Far, CmdLineDisableMouse:Far + Global ForceMouseRestore:Far + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +Segment Mouse PARA Public 'Code' USE16 + Assume CS:Mouse, DS:Nothing + +CREATENEWLOGFILE EQU 0 +include debug.inc + + ; Assumes 80x50 display (512 characters, 8x8 pixels per char.) + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Variables ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +STARTINGCHARACTER EQU 247 ; Use last 9 characters +QUEUEELEMENTSIZE EQU 8 +MAXXPIXEL EQU 639 +MAXYPIXEL EQU 399 + +MouseCharacterGenerationOffset DW 512*32 +MouseAvailable DB 0 +MouseDisplay DB 1 +MouseEnabled DB 1 + +MouseCursorType DW 0 + +MouseCursorOffset DW 0 +MouseCursorWidth DB 0 +MouseCursorHeight DB 0 + +NewMouseX DW 40*8 +NewMouseY DW 30*8 +MouseX DW 40*8 +MouseY DW 30*8 +MouseXHotSpot DW 0 +MouseYHotSpot DW 0 + +OldCharacterData DW 9 Dup (0) +Label EndOldCharacterData +CharacterTypes DW 247, 248, 249, 250, 251, 252, 253, 254, 255 + +OldBitmapData DB 9*8 Dup (0) +NewBitmapData DB 24*4 Dup (0) + +OverWriteSecondSet DB 1 +RestoreGraphicsRequired DB 0 +LockKeyBoard DB 0 +UpdateScreen DB 0 + +MouseCursorHotSpot Label + DB 0, 0 + DB 4, 3 +; DB 8, 16 + +MouseCursorTypes Label + DW Offset MouseCursorArrow + DW Offset MouseCursorCrossHairs +; DW Offset MouseCursorDownArrow + +Label MouseCursorArrow + DW 0011111111111111b, 0000000000000000b + DW 0001111111111111b, 0100000000000000b + DW 0000111111111111b, 0110000000000000b + DW 0000011111111111b, 0111000000000000b + DW 0000001111111111b, 0111100000000000b + DW 0000000111111111b, 0111110000000000b + DW 0000000011111111b, 0111111000000000b + DW 0000000001111111b, 0111111100000000b + DW 0000000000111111b, 0111111110000000b + DW 0000000001111111b, 0111111100000000b + DW 0000000111111111b, 0111110000000000b + DW 0000000011111111b, 0100011000000000b + DW 1011000011111111b, 0000011000000000b + DW 1111100001111111b, 0000001100000000b + DW 1111100001111111b, 0000001100000000b + DW 1111110011111111b, 0000000000000000b + +Label MouseCursorCrossHairs + DW 1111111111111111b, 0000000000000000b + DW 1111011111111111b, 0000000000000000b + DW 1100000111111111b, 0000100000000000b + DW 1000000011111111b, 0011111000000000b + DW 1100000111111111b, 0000100000000000b + DW 1111011111111111b, 0000000000000000b + DW 1111111111111111b, 0000000000000000b + DW 1111111111111111b, 0000000000000000b + DW 1111111111111111b, 0000000000000000b + DW 1111111111111111b, 0000000000000000b + DW 1111111111111111b, 0000000000000000b + DW 1111111111111111b, 0000000000000000b + DW 1111111111111111b, 0000000000000000b + DW 1111111111111111b, 0000000000000000b + DW 1111111111111111b, 0000000000000000b + DW 1111111111111111b, 0000000000000000b + + Comment ~ + +Label MouseCursorDownArrow + DW 1111111111111111b, 0000000000000000b + DW 1111000000001111b, 0000000000000000b + DW 1111000000001111b, 0000011111100000b + DW 1111000000001111b, 0000011111100000b + DW 1111000000001111b, 0000011111100000b + DW 1111000000001111b, 0000011111100000b + DW 1111000000001111b, 0000011111100000b + DW 0000000000000000b, 0000011111100000b + DW 0000000000000000b, 0111111111111110b + DW 1000000000000001b, 0011111111111100b + DW 1100000000000011b, 0001111111111000b + DW 1110000000000111b, 0000111111110000b + DW 1111000000001111b, 0000011111100000b + DW 1111100000011111b, 0000001111000000b + DW 1111110000111111b, 0000000110000000b + DW 1111111001111111b, 0000000000000000b + + ~ + +MouseEvents DB 100 * 16 Dup (0) +MouseEventStack DW 8 Dup (0) +MouseEventStackPointer DW 0 +MouseEventStart DW Offset MouseEvents +MouseEventEnd DW Offset MouseEvents + +MouseStatus DB 0 ; Same as conditions... + +MouseQueue DW 128 Dup (0) +MouseQueueStart DB 0 +MouseQueueEnd DB 0 + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Functions ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc RestoreMouse Far + + Push CS + Pop DS + Assume DS:Mouse + + Cmp MouseDisplay, 0 + JE RestoreMouse1 + + Call RemoveMouseCursor + +RestoreMouse1: + Ret + +EndP RestoreMouse + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc RemoveMouseCursor ; Given ES=cursor to remove + + Assume DS:Mouse + Mov BX, Offset OldCharacterData + Mov DI, MouseCursorOffset + + + Mov DX, Word Ptr MouseCursorWidth + Test DH, DH + JZ RemoveMouseCursor3 + Test DL, DL + JZ RemoveMouseCursor3 + + Mov CL, STARTINGCHARACTER + +RemoveMouseCursor1: + Push CX + Push BX + Push DI + Mov DL, MouseCursorWidth + +RemoveMouseCursor2: + Mov AX, [BX] + Test AH, 8 + JNZ RemoveMouseCursor4 + + Cmp [ES:DI], CL + JNE RemoveMouseCursor8 + Mov [ES:DI], AX + Jmp RemoveMouseCursor8 + +RemoveMouseCursor4: + Or RestoreGraphicsRequired, 1 + +RemoveMouseCursor8: +; Add DI, 2 + ScasW + Add BX, 2 + Inc CX + Dec DL + JNZ RemoveMouseCursor2 + + Pop DI + Pop BX + Pop CX + + Add CL, 3 + Add BX, 6 + Add DI, 160 + + Dec DH + JNZ RemoveMouseCursor1 + +RemoveMouseCursor3: + Ret + +EndP RemoveMouseCursor + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc RestoreMouseGraphics Far + + Push CS + Pop DS + Assume DS:Mouse + + Mov AL, RestoreGraphicsRequired + Cmp MouseDisplay, 0 + JE RestoreMouseGraphics4 + Cmp OverWriteSecondSet, 1 + JE RestoreMouseGraphics4 + Test AL, 10 + JNZ RestoreMouseGraphics4 + Test AL, 4 + JZ RestoreMouseGraphics4 + + Or RestoreGraphicsRequired, 8 + Test AL, 1 + JZ RestoreMouseGraphics4 + + Call S_SetSequencer + + Mov AX, 0A000h + Mov ES, AX + + Xor BX, BX + Mov DH, MouseCursorHeight + Test DH, DH + JZ RestoreMouseGraphics4 + +RestoreMouseGraphics1: + Push BX + Mov DL, MouseCursorWidth + +RestoreMouseGraphics2: + Mov AX, [OldCharacterData+BX] + Test AH, 8 + JZ RestoreMouseGraphics3 + + ; AL = character in extended set. + And AX, 0FFh + Mov DI, AX + Mov SI, BX + ShL DI, 5 + ShL SI, 2 ; DS:SI points to OldBitMap table + Add SI, Offset OldBitMapData + Add DI, MouseCharacterGenerationOffset + ; ES:DI points to output table + + Mov CX, 8 + Rep MovsB + +RestoreMouseGraphics3: + Add BX, 2 + Dec DL + JNZ RestoreMouseGraphics2 + + Pop BX + Add BX, 6 + + Dec DH + JNZ RestoreMouseGraphics1 + + Call S_ResetSequencer + +RestoreMouseGraphics4: + Ret + +EndP RestoreMouseGraphics + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SaveMouseCursor + Assume DS:Mouse + + Push CS ; *** + Pop DS ; *** + + PushF + ClI + Mov SI, NewMouseX + Mov AX, NewMouseY + PopF + + Mov MouseX, SI + Mov MouseY, AX + + +; Mov AX, MouseY + ShR AX, 3 + + Mov DX, 50 + Sub DX, AX ; CX = height + + Cmp DX, 3 + JB SaveMouseCursor1 + + Mov DL, 3 + +SaveMouseCursor1: + Mov MouseCursorHeight, DL + + Mov BL, 160 + Mul BL +; Mov SI, MouseX + ShR SI, 3 + + Mov CX, 80 + Sub CX, SI + Cmp CX, 3 + JB SaveMouseCursor2 + + Mov CL, 3 + +SaveMouseCursor2: + Add SI, SI + Mov MouseCursorWidth, CL + + Add SI, AX + Mov MouseCursorOffset, SI + Mov DI, Offset OldCharacterData + Xor EAX, EAX + + Mov DWord Ptr [DI], EAX ; Clear buffer first. + Mov DWord Ptr [DI+4], EAX + Mov DWord Ptr [DI+8], EAX + Mov DWord Ptr [DI+12], EAX + Mov Word Ptr [DI+16], AX + +SaveMouseCursor3: + Push DI + Push SI + Push CX + +SaveMouseCursor4: + Mov AX, [ES:SI] + Mov [DI], AX + + Add SI, 2 +; Add DI, 2 + ScasW + Dec CX + JNZ SaveMouseCursor4 + + Pop CX + Pop SI + Pop DI + Add SI, 160 + Add DI, 6 + + Dec DX + JNZ SaveMouseCursor3 + + ; Now get bitmap data... + + Call S_SetSequencer + + Push ES + + Mov AX, 0A000h + Mov ES, AX + + Mov BX, Offset OldCharacterData + Mov DI, Offset OldBitmapData + +SaveMouseCursor5: + Mov AX, [BX] + Mov SI, AX + And SI, 0FFh + ShL SI, 5 + Test AH, 8 + JZ SaveMouseCursor6 + + Mov AL, RestoreGraphicsRequired + Test AL, 1 + JZ SaveMouseCursor8 + Test AL, 10 + JZ SaveMouseCursor7 ; JNZ 8 +; Test AL, 4 +; JZ SaveMouseCursor7 + +SaveMouseCursor8: + Add SI, MouseCharacterGenerationOffset + +SaveMouseCursor6: + Mov EAX, [ES:SI] + Mov [DI], EAX + Mov EAX, [ES:SI+4] + Mov [DI+4], EAX + +SaveMouseCursor7: + Add DI, 8 + Add BX, 2 + Cmp BX, Offset EndOldCharacterData + JB SaveMouseCursor5 + + Pop ES + + Test RestoreGraphicsRequired, 10 + JZ SaveMouseCursor9 + + And RestoreGraphicsRequired, Not 14 + +SaveMouseCursor9: + Ret + +EndP SaveMouseCursor + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GenerateMouseCursor + Assume DS:Mouse + +; Push CS ; *** +; Pop DS ; *** + + ; Has to work out new table and write chars + Mov SI, Offset OldBitMapData + Mov DI, Offset NewBitMapData + Mov DX, 3 + +GenerateMouseCursor1: + Mov CX, 8 + +GenerateMouseCursor2: +; Mov Byte Ptr [DI], 0 + Mov AL, [SI+16] + Mov [DI+1], AL + Mov AL, [SI+8] + Mov [DI+2], AL + Mov AL, [SI] + Mov [DI+3], AL + + Inc SI + Add DI, 4 + Loop GenerateMouseCursor2 + + Add SI, 16 + + Dec DX + JNZ GenerateMouseCursor1 + + Mov BX, MouseX + And BX, 7 ; CX = MouseX % 8 + Mov CX, 8 + Sub CX, BX + Mov EDX, 0FF000000h + ShL EDX, CL ; EDX = 0FF000000h << (8 - shift); + Mov CX, BX + + Mov SI, MouseCursorType +; Add SI, SI + Mov SI, [MouseCursorTypes+SI] + ; DS:SI points to masks. + Mov DI, MouseY + And DI, 7 + ShL DI, 2 + Add DI, Offset NewBitMapData + + Mov BX, 16 ; Cursor height = 16 + +GenerateMouseCharacter3: + Mov AX, [SI] + ShL EAX, 16 + Mov AX, 0FFFFh + RCR EAX, CL + Or EAX, EDX + And [DI], EAX + + Mov AX, [SI+2] + ShL EAX, 16 + ShR EAX, CL + Or [DI], EAX + + Add SI, 4 + Add DI, 4 + Dec BX + JNZ GenerateMouseCharacter3 + + ; Lets write the characters! + + Push ES + Mov AX, 0A000h + Mov ES, AX + + Mov BX, Offset OldCharacterData + Mov SI, Offset NewBitmapData+3 + + Mov DL, 3 + +GenerateMouseCharacter7: + Mov DH, 3 + +GenerateMouseCharacter4: + Mov AX, [BX] + ; Get DI = char to write to... + Test AH, 8 + JZ GenerateMouseCharacter5 + + Cmp OverWriteSecondSet, 0 + JNE GenerateMouseCharacter6 + + And AX, 0FFh + ShL AX, 5 + Add AX, MouseCharacterGenerationOffset + Mov DI, AX + Jmp GenerateMouseCharacter9 + +GenerateMouseCharacter5: + Mov AX, [BX+18] + ShL AX, 5 + Mov DI, AX + +GenerateMouseCharacter9: + ; ES:DI points to character map memory + + Mov CX, 8 + Push SI + +GenerateMouseCharacter8: + MovsB + Add SI, 3 + +; Mov AL, [SI] +; StosB + Loop GenerateMouseCharacter8 + + Pop SI + +GenerateMouseCharacter6: + Dec SI +; Inc SI + + Add BX, 2 + Dec DH + JNZ GenerateMouseCharacter4 + + Add SI, 35 +; Add SI, 32-3 + + Dec DL + JNZ GenerateMouseCharacter7 + + Cmp BX, Offset EndOldCharacterData + JB GenerateMouseCharacter4 + + + Pop ES + + Ret + +EndP GenerateMouseCursor + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PlotMouseCursor + Assume DS:Mouse + + Push CS ; *** + Pop DS ; *** + + Mov DH, MouseCursorHeight + And DH, DH + JZ PlotMouseCursor4 + + Mov AL, STARTINGCHARACTER + Mov BX, MouseCursorOffset + +PlotMouseCursor1: + Push AX + Push BX + + Mov DL, MouseCursorWidth + +PlotMouseCursor2: + Test Word Ptr [ES:BX], 800h + JNZ PlotMouseCursor3 + + Mov [ES:BX], AL + +PlotMouseCursor3: + Inc AX + Add BX, 2 + Dec DL + JNZ PlotMouseCursor2 + + Pop BX + Pop AX + Add BX, 160 + Add AX, 3 + + Dec DH + JNZ PlotMouseCursor1 + +PlotMouseCursor4: + Ret + +EndP PlotMouseCursor + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DrawMouseCursor ; Given ES to write to. + + Call SaveMouseCursor + Call GenerateMouseCursor + + Call S_ResetSequencer + + ; Write block... + Call PlotMouseCursor + + Ret + +EndP DrawMouseCursor + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DrawMouse Far + + Push CS + Pop DS + Assume DS:Mouse + + Cmp MouseDisplay, 0 + JE DrawMouse1 + + Call DrawMouseCursor + +DrawMouse1: + Ret + +EndP DrawMouse + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MouseInterruptHandler Far + + PushF + + ClI + CLD + + PushAD + Push DS + Push ES + + Push CS + Pop DS + Assume DS:Mouse + + Mov NewMouseX, CX + Mov NewMouseY, DX + + Xor BH, BH ; BH = new status. + Mov BL, MouseStatus + + Test AL, 1 ; Mouse moved + JZ MIH1 + + Or BH, 1 + Or RestoreGraphicsRequired, 4 + +MIH1: + Test AL, 2 ; Left pressed + JZ MIH2 + + Or BH, 2 + Jmp MIH4 + +MIH2: + Test AL, 4 + JZ MIH3 + + Or BH, 8 + Jmp MIH4 + +MIH3: + Test BL, 6 ; If last status had press or + JZ MIH4 ; held... + + Or BH, 4 ; Set held + +MIH4: + Test AL, 8 ; Left pressed + JZ MIH5 + + Or BH, 10h + Jmp MIH7 + +MIH5: + Test AL, 10h + JZ MIH6 + + Or BH, 40h + Jmp MIH7 + +MIH6: + Test BL, 30h ; If last status had press or + JZ MIH7 ; held... + + Or BH, 20h ; Set held + +MIH7: + + Mov MouseStatus, BH + + Cmp MouseDisplay, 0 + JE MouseInterruptHandler1 + + Mov SI, MouseEventStart + + Cmp UpdateScreen, 0 + JE NoUpdateCursor + + Test BH, 1 ; Moved? + JZ NoUpdateCursor + + PushAD + Mov AX, 0B800h + Mov ES, AX + Push ES + Call RemoveMouseCursor + Call RestoreMouseGraphics + Pop ES + Call DrawMouseCursor + PopAD + +NoUpdateCursor: + Add CX, MouseXHotSpot + Add DX, MouseYHotSpot + +MouseInterruptHandler2: ; BH = status + Cmp SI, MouseEventEnd + JAE MouseInterruptHandler1 + Mov AX, [SI+8] ; AH = flags, AL = conditions + ; AH: Bit 0-1 = test case + ; 0 = equal + ; 1 = result when and + ; Bit 2: NOT of test case + ; Bit 3: Inside/outside area + ; Bit 4: Ignore area + Test AH, 10h + JNZ MouseCheckCondition + + Cmp CX, [SI] + JB MouseAreaOutside1 + Cmp CX, [SI+4] + JA MouseAreaOutside1 + Cmp DX, [SI+2] + JB MouseAreaOutside1 + Cmp DX, [SI+6] + JA MouseAreaOutside1 + + Test AH, 8 + JZ MouseCheckCondition + Jmp MouseInterruptHandler3 + +MouseAreaOutside1: + Test AH, 8 + JZ MouseInterruptHandler3 + +MouseCheckCondition: + And AH, 7 + Cmp AH, 1 + JB MouseCheckCondition0 + JE MouseCheckCondition1 + + Cmp AH, 5 + JB MouseCheckCondition4 + JE MouseCheckCondition5 + Jmp MouseInterruptHandler3 + +MouseCheckCondition0: + Cmp AL, BH + JE MouseEventOK + Jmp MouseInterruptHandler3 + +MouseCheckCondition1: + Test AL, BH + JNZ MouseEventOK + Jmp MouseInterruptHandler3 + +MouseCheckCondition4: + Cmp AL, BH + JNE MouseEventOK + Jmp MouseInterruptHandler3 + +MouseCheckCondition5: + Test AL, BH + JNZ MouseInterruptHandler3 +; JZ MouseEventOK +; Jmp MouseInterruptHandler3 + +MouseEventOK: ; Call function! + Mov AX, [SI+10] + Call DWord Ptr [SI+12] + And AX, AX + JZ MouseInterruptHandler1 + +MouseInterruptHandler3: + Add SI, 16 + Jmp MouseInterruptHandler2 + +MouseInterruptHandler1: + Pop ES + Pop DS + PopAD + PopF + + Ret + +EndP MouseInterruptHandler + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc InitMouse Far + + Cmp CS:MouseEnabled, 0 + JE InitMouse2 + + Trace " - Determining mouse availability" + + Xor AX, AX + Mov ES, AX + + Mov Byte Ptr [ES:449h], 6 ; 'Setting' display mode + + Int 33h + + Cmp AX, -1 + JE InitMouse1 + + Mov MouseDisplay, 0 + +InitMouse2: + Ret + +InitMouse1: + Trace " - Setting Mouse extents" + + Mov MouseAvailable, 1 + + Xor CX, CX ; X Limits + Mov DX, MAXXPIXEL + Mov AX, 7 + Int 33h + + Xor CX, CX ; Y Limits + Mov DX, MAXYPIXEL + Mov AX, 8 + Int 33h + + Mov CX, MouseX + Mov DX, MouseY + Call MouseSetXY + + Trace " - Installing mouse handler" + + Push CS + Pop ES + Mov CX, 1Fh ; Call on mouse move + ; left button press, release. + ; right button press, release. + ; Ignores central button (if any) + Mov DX, Offset MouseInterruptHandler + Mov AX, 0Ch + Int 33h + + Ret + +EndP InitMouse + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc UnInitMouse Far + + Xor AX, AX + Int 33h + + Ret + +EndP UnInitMouse + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MouseSecondSetEnable Far + + Mov CS:OverwriteSecondSet, 0 + Ret + +EndP MouseSecondSetEnable + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MouseSecondSetDisable Far + + Mov CS:OverwriteSecondSet, 1 + Ret + +EndP MouseSecondSetDisable + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MouseToggle Far + + Push CS + Pop DS + Assume DS:Mouse + + Cmp MouseAvailable, 0 + JE MouseToggle1 + + Xor MouseDisplay, 1 + JNZ MouseToggle1 + + Mov AX, 0B800h + Mov ES, AX + Call RemoveMouseCursor + Mov MouseDisplay, 1 + Or RestoreGraphicsRequired, 4 + Call RestoreMouseGraphics + Mov MouseDisplay, 0 + +MouseToggle1: + Mov AX, 1 + Ret + +EndP MouseToggle + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MouseSetXY Far + + PushF + + Mov NewMouseX, CX + Mov NewMouseY, DX + + Cmp CS:MouseAvailable, 0 + JE MouseSetXY1 + + ClI + + Mov AX, 4 + Int 33h + + Sub CX, MouseXHotSpot + JNS MouseSetXY2 + + Xor CX, CX + +MouseSetXY2: + Sub DX, MouseYHotSpot + JNS MouseSetXY3 + + Xor DX, DX + +MouseSetXY3: + Cmp CX, MAXXPIXEL + JB MouseSetXY4 + + Mov CX, MAXXPIXEL + +MouseSetXY4: + Cmp DX, MAXYPIXEL + JB MouseSetXY5 + + Mov DX, MAXYPIXEL + +MouseSetXY5: + Mov MouseX, CX + Mov MouseY, DX + + Or CS:RestoreGraphicsRequired, 4 + +MouseSetXY1: + PopF + + Ret + +EndP MouseSetXY + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MouseSaveEvents Far + + PushF + Push DS + + Push CS + Pop DS + Assume DS:Mouse + + Cmp MouseAvailable, 0 + JE MouseSaveEvents1 + + ClI + + Mov AX, MouseEventStart + Mov SI, MouseEventStackPointer + Mov [MouseEventStack+SI], AX + Add MouseEventStackPointer, 2 + + Mov AX, MouseEventEnd + Mov MouseEventStart, AX + +MouseSaveEvents1: + Pop DS + PopF + + Ret + +EndP MouseSaveEvents + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MouseRestoreEvents Far + + PushF + Push DS + + Push CS + Pop DS + Assume DS:Mouse + + Cmp MouseAvailable, 0 + JE MouseRestoreEvents1 + + ClI + + Mov AX, MouseEventStart + Mov MouseEventEnd, AX + + Sub MouseEventStackPointer, 2 + Mov SI, MouseEventStackPointer + Mov AX, [MouseEventStack+SI] + Mov MouseEventStart, AX + +MouseRestoreEvents1: + Pop DS + PopF + + Ret + +EndP MouseRestoreEvents + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SetKeyboardLock Far ; AL = lock state + + Mov CS:LockKeyBoard, AL + Ret + +EndP SetKeyboardLock + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetKeyboardLock Far + + Mov AL, CS:LockKeyBoard + Ret + +EndP GetKeyboardLock + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc AddMouseQueue Far ; AX, CX, DX + + Push DS + + Push CS + Pop DS + Assume DS:Mouse + + Mov BH, QUEUEELEMENTSIZE + Mov BL, MouseQueueEnd + Add BH, BL + Cmp BH, MouseQueueStart + JE AddMouseQueue1 ; No space left on queue. + + Mov MouseQueueEnd, BH + And BX, 0FFh + Mov [MouseQueue+BX], AX + Mov [MouseQueue+BX+2], CX + Mov [MouseQueue+BX+4], DX + Mov [MouseQueue+BX+6], DI + +AddMouseQueue1: + Pop DS + Ret + +EndP AddMouseQueue + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MouseInput Far + + PushF + + Push CS + Pop DS + Assume DS:Mouse + + ClI + + Cmp MouseDisplay, 0 + JE MouseInput1 + + Mov CL, MouseQueueEnd + Mov BL, MouseQueueStart + Sub CL, BL + JNZ MouseInput2 + + Cmp LockKeyBoard, 0 + JE MouseInput1 + + Mov AX, 2 + PopF + Ret + +MouseInput1: + Mov AX, 0 + PopF + Ret + +MouseInput2: + And BX, 0FFh + Mov SI, BX + + Add MouseQueueStart, QUEUEELEMENTSIZE + +MouseInput3: + Mov BX, [MouseQueue+SI] + Mov CX, [MouseQueue+SI+2] + Mov DX, [MouseQueue+SI+4] + Mov DI, [MouseQueue+SI+6] + + Mov AX, 1 + PopF + Ret + +EndP MouseInput + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MouseAddEvent Far ; Given DS:SI to event + + PushF + + Cmp CS:MouseAvailable, 0 + JE MouseAddEvent1 + + Push SI + Push ES + Push DI + + ClI + CLD + + Push CS + Pop ES + Mov DI, CS:MouseEventEnd + + Mov CX, 8 + Rep MovsW + + Mov CS:MouseEventEnd, DI + + Pop DI + Pop ES + Pop SI + +MouseAddEvent1: + PopF + Ret + +EndP MouseAddEvent + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MouseClearEvents Far + + Mov AX, CS:MouseEventStart + Mov CS:MouseEventEnd, AX + Ret + +EndP MouseClearEvents + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MouseRemoveEvents Far ; AX = number to remove + + ShL AX, 4 + Sub CS:MouseEventEnd, AX + Ret + +EndP MouseRemoveEvents + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MouseGetStatus Far + + Mov AL, CS:MouseStatus + Ret + +EndP MouseGetStatus + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc NewCharacterSet Far + + Or CS:RestoreGraphicsRequired, 2 + Ret + +EndP NewCharacterSet + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MouseUpdateEnable Far + + Mov CS:UpdateScreen, 1 + Ret + +EndP MouseUpdateEnable + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MouseUpdateDisable Far + + Mov CS:UpdateScreen, 0 + Ret + +EndP MouseUpdateDisable + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SetMouseCursorType Far + + PushF + Push DS + + Push CS + Pop DS + Assume DS:Mouse + ClI + + Mov MouseCursorType, BX + Mov AX, [MouseCursorHotSpot+BX] + Mov CX, MouseX + Mov DX, MouseY + + Add CX, MouseXHotSpot + Add DX, MouseYHotSpot + + Mov Byte Ptr MouseXHotSpot, AL + Mov Byte Ptr MouseYHotSpot, AH + + Sub CX, MouseXHotSpot + JNS SetMouseCursorType1 + + Xor CX, CX + +SetMouseCursorType1: + Sub DX, MouseYHotSpot + JNS SetMouseCursorType2 + + Xor DX, DX + +SetMouseCursorType2: + Cmp CX, MAXXPIXEL + JB SetMouseCursorType3 + + Mov CX, MAXXPIXEL + +SetMouseCursorType3: + Cmp DX, MAXYPIXEL + JB SetMouseCursorType4 + + Mov DX, MAXYPIXEL + +SetMouseCursorType4: +; Mov NewMouseX, CX +; Mov NewMouseY, DX + + Call MouseSetXY + + Pop DS + PopF + Ret + +EndP SetMouseCursorType + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc CmdLineDisableMouse Far + + Mov Word Ptr CS:MouseDisplay, 0 + Ret + +EndP CmdLineDisableMouse + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ForceMouseRestore Far + + Call MouseUpdateDisable + ClI + Call RestoreMouse + Or RestoreGraphicsRequired, 4 + Call RestoreMouseGraphics + StI + Jmp MouseUpdateEnable + +EndP ForceMouseRestore + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +EndS + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +End diff --git a/IT_MSG.ASM b/IT_MSG.ASM new file mode 100644 index 0000000..8b25efd --- /dev/null +++ b/IT_MSG.ASM @@ -0,0 +1,1031 @@ +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Message Module ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + .386 + Jumps + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Externals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Extrn M_FunctionDivider:Far + Extrn M_Object1List:Far + Extrn S_GetDestination:Far + Extrn O1_LongMessageList:Far + Extrn O1_ConfirmClearMessage:Far + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Globals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Global Msg_ResetMessage:Far + Global Msg_DrawMessage:Far + Global Msg_PreMessage:Far + Global Msg_PostMessage:Far + Global Msg_GetMessageLength:Far + Global Msg_GetMessageOffset:Far + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +Segment Message BYTE Public 'Code' USE16 + Assume CS:Message, DS:Nothing + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Variables ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +MESSAGELENGTH Equ 8000 + +TopLine DW 0 +CurrentPosition DW 0 +MessageData DB MESSAGELENGTH Dup (0) + DW 0 ; Security +MessageDataTerminator DB 0 +Edit DB 0 ; if Edit=1, show '' for enter. +HorizontalPosition DW 0 +CurrentLine DW 0 +CharacterColour DB 12 + +NoEditKeys Label + DB 0 + DW 1C8h ; Up arrow + DW Msg_ViewMsgUp + + DB 0 + DW 1D0h ; Down arrow + DW Msg_ViewMsgDown + + DB 0 + DW 1C9h + DW Msg_ViewMsgPgUp + + DB 0 + DW 1D1h + DW Msg_ViewMsgPgDn + + DB 0 + DW 11Ch + DW Msg_ViewMsgEdit + + DB 1 + DW 'T'-'@' ; Ctrl 'T' + DW Msg_ToggleCharacterSet + + DB 0FFh ; End of List + +EditMsgKeys Label + DB 0 + DW 1C7h + DW Msg_EditMsgHome + + DB 0 + DW 1CFh + DW Msg_EditMsgEnd + + DB 0 + DW 1CBh + DW Msg_EditMsgLeft + + DB 0 + DW 1CDh + DW Msg_EditMsgRight + + DB 0 + DW 1C8h ; Up arrow + DW Msg_EditMsgUp + + DB 0 + DW 1D0h ; Down arrow + DW Msg_EditMsgDown + + DB 0 + DW 1C9h ; PgUp + DW Msg_EditMsgPgUp + + DB 0 + DW 1D1h ; PgDn + DW Msg_EditMsgPgDn + +; DB 2 +; DW 1C8h ; Up arrow +; DW Msg_ViewMsgUp +; +; DB 2 +; DW 1D0h ; Down arrow +; DW Msg_ViewMsgDown + + DB 0 + DW 1D2h ; Insert + DW Msg_EditMsgInsert + + DB 0 + DW 10Fh + DW Msg_Tab + + DB 0 + DW 1D3h ; Delete + DW Msg_EditMsgDelete + + DB 0 + DW 101h ; Escape + DW Msg_EditMsgView + + DB 0 + DW 10Eh ; Backspace + DW Msg_EditMsgBackSpace + + DB 1 + DW 19h + DW Msg_EditMsgDeleteLine + + DB 1 + DW 2E00h ; Alt 'C' + DW Msg_ClearMessage + + DB 1 + DW 'T'-'@' ; Ctrl 'T' + DW Msg_ToggleCharacterSet + + DB 0FFh + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Functions ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Msg_ResetMessage Far + + Push CS + Pop ES + Mov DI, Offset MessageData + Xor AX, AX + Mov CX, 4000 + Rep StosW + + Mov CS:Edit, 0 + Mov CS:TopLine, 0 + + Ret + +EndP Msg_ResetMessage + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Msg_DrawMessage Far + + Call S_GetDestination + + Push CS + Pop DS + Assume DS:Message + + Cmp Edit, 0 + JE Msg_DrawMessage7 + + Mov SI, Offset MessageData + Mov CX, CurrentPosition + Xor DX, DX ; DX = line count. + Xor BX, BX ; BX = cursor position. + JCXZ Msg_DrawMessage4 + +Msg_DrawMessage1: + LodsB + Test AL, AL + JZ Msg_DrawMessage4 + + Inc BX + + Cmp AL, 13 ; Enter? + JNE Msg_DrawMessage2 + + Inc DX ; Increase current line. + Xor BX, BX + +Msg_DrawMessage2: + Loop Msg_DrawMessage1 + +Msg_DrawMessage4: + Mov CurrentLine, DX + Mov HorizontalPosition, BX + + Mov AX, TopLine ; Boundary checking... + Cmp AX, DX + JBE Msg_DrawMessage5 + + Mov AX, DX ; Need new top line. + +Msg_DrawMessage5: + LEA CX, [EAX+34] + Cmp CX, DX + JAE Msg_DrawMessage6 + + Mov AX, DX + Sub AX, 34 + JNC Msg_DrawMessage6 + + Xor AX, AX + +Msg_DrawMessage6: + Mov TopLine, AX + ; Now to get the stuff onto + ; the screen... +Msg_DrawMessage7: + Mov CX, TopLine + Mov SI, Offset MessageData + JCXZ Msg_DrawMessage9 + +Msg_DrawMessage8: + LodsB + And AL, AL + JZ Msg_DrawMessageEnd + + Cmp AL, 13 + JNE Msg_DrawMessage8 + Loop Msg_DrawMessage8 + +Msg_DrawMessage9: + Mov DI, (2+13*80)*2 + Mov BL, CharacterColour + Mov CX, 35 + Mov DX, 20+100h + Mov AH, BL + + Push DI + + Cmp Edit, 1 + JE Msg_DrawMessage10 + + Mov DX, 300h + +Msg_DrawMessage10: + LodsB + And AL, AL + JZ Msg_DrawMessage12 + + Cmp AL, 13 + JE Msg_DrawMessage11 + + Cmp AL, ' ' + JE Msg_DrawMessage14 + + StosW + Jmp Msg_DrawMessage10 + +Msg_DrawMessage14: + Mov AH, 3 + StosW + Mov AH, BL + Jmp Msg_DrawMessage10 + +Msg_DrawMessage11: + Mov AX, DX + StosW + + Mov AH, BL + + Pop DI + Add DI, 160 + Push DI + + Loop Msg_DrawMessage10 + Jmp Msg_DrawMessage13 + +Msg_DrawMessage12: + Mov AX, DX + Inc AH + StosW + +Msg_DrawMessage13: + Pop DI + +Msg_DrawMessageEnd: + Ret + +EndP Msg_DrawMessage + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Msg_PreMessage Far + + Push CS + Pop DS + Assume DS:Message + + Cmp Edit, 0 + JE Msg_PreMessage1 + + Call S_GetDestination + + Mov AX, CurrentLine + Sub AX, TopLine + Mov BX, 80 + Mul BX + Add AX, HorizontalPosition + LEA DI, [EAX*2+(2+13*80)*2+1] + + And Byte Ptr [ES:DI], 8 + Or Byte Ptr [ES:DI], 30h + +Msg_PreMessage1: + Ret + +EndP Msg_PreMessage + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Msg_PostMessage Far + + Push CS + Pop DS + + Cmp Edit, 0 + JNE Msg_PostMessage2 + + Mov SI, Offset NoEditKeys + Call M_FunctionDivider + JC Msg_PostMessage1 + + Jmp [SI] + +Msg_PostMessage1: + Xor AX, AX + Ret + +Msg_PostMessage2: + Mov SI, Offset EditMsgKeys + Call M_FunctionDivider + JC Msg_PostMessage3 + + Jmp [SI] + +Msg_PostMessage3: + Cmp CX, 11Ch ; Enter + JE Msg_PostMessage6 + Test CL, CL + JZ Msg_PostMessage1 + + Cmp DL, 32 + JB Msg_PostMessage1 + Jmp Msg_PostMessage4 + +Msg_PostMessage6: + Mov DL, 13 + +Msg_PostMessage4: + Push DX + + Mov DX, 1 + Mov SI, CurrentPosition + Call InsertData + + Pop DX + + JC Msg_PostMessage5 + + Mov [SI+MessageData], DL + Call CheckWordWrap + Jmp Msg_EditMsgRight + +Msg_PostMessage5: + Mov AX, 1 + Ret + +EndP Msg_PostMessage + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Msg_Tab Far + + Mov CX, 8 + +Msg_Tab1: + Push CX + Mov DX, 32 + Call Far Ptr Msg_PostMessage4 + Pop CX + Loop Msg_Tab1 + + Ret + + +EndP Msg_Tab + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Msg_ViewMsgUp Far + Assume DS:Message + + Mov AX, TopLine + Sub AX, 1 + AdC AX, 0 + Mov TopLine, AX + + Mov AX, 1 + Ret + +EndP Msg_ViewMsgUp + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Msg_ViewMsgDown Far + Assume DS:Message + + Mov AX, TopLine + Inc AX + Cmp AX, 7970 + JB Msg_ViewMsgDown1 + + Mov AX, 7970 + +Msg_ViewMsgDown1: + Mov TopLine, AX + + Mov AX, 1 + Ret + +EndP Msg_ViewMsgDown + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Msg_ViewMsgPgUp Far + Assume DS:Message + + Mov AX, TopLine + Sub AX, 35 + JNC Msg_ViewMsgPgUp1 + + Xor AX, AX + +Msg_ViewMsgPgUp1: + Mov TopLine, AX + + Mov AX, 1 + Ret + +EndP Msg_ViewMsgPgUp + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Msg_ViewMsgPgDn Far + Assume DS:Message + + Mov AX, TopLine + Add AX, 35 + Cmp AX, 7970 + JB Msg_ViewMsgPgDn1 + + Mov AX, 7970 + +Msg_ViewMsgPgDn1: + Mov TopLine, AX + + Mov AX, 1 + Ret + +EndP Msg_ViewMsgPgDn + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Msg_ViewMsgEdit Far + Assume DS:Message + + Mov TopLine, 0 + Mov CurrentLine, 0 + Mov CurrentPosition, 0 + Mov Edit, 1 + + Mov AX, 1 + Ret + +EndP Msg_ViewMsgEdit + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Msg_EditMsgView Far + Assume DS:Message + + Mov Edit, 0 + + Mov AX, 1 + Ret + +EndP Msg_EditMsgView + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Msg_EditMsgLeft Far + Assume DS:Message + + Sub CurrentPosition, 1 + AdC CurrentPosition, 0 + + Mov AX, 1 + Ret + +EndP Msg_EditMsgLeft + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Msg_EditMsgRight Far + Assume DS:Message + + Mov SI, CurrentPosition + Cmp SI, MESSAGELENGTH-2 + JAE Msg_EditMsgRight1 + + Cmp Word Ptr [SI+MessageData], 0 + JE Msg_EditMsgRight1 + + Inc CurrentPosition + +Msg_EditMsgRight1: + Mov AX, 1 + Ret + +EndP Msg_EditMsgRight + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Msg_EditMsgUp Far + Assume DS:Message + + Mov SI, CurrentPosition ; Need to search back + ; twice... + Call FindStart + And SI, SI + JZ Msg_EditMsgUpEnd + Dec SI + Call FindStart + + Add SI, Offset MessageData + + Mov CX, HorizontalPosition + JCXZ Msg_EditMsgUp3 + +Msg_EditMsgUp2: + LodsB + Cmp AL, 13 + LoopNE Msg_EditMsgUp2 + JNE Msg_EditMsgUp3 + + Dec SI + +Msg_EditMsgUp3: + Sub SI, Offset MessageData + Mov CurrentPosition, SI + +Msg_EditMsgUpEnd: + Mov AX, 1 + Ret + +EndP Msg_EditMsgUp + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Msg_EditMsgPgUp Far + + Mov CX, 35 + +Msg_EditMsgPgUp1: + Push CX + Call Msg_EditMsgUp + Pop CX + Loop Msg_EditMsgPgUp1 + + Mov AX, 1 + Ret + +EndP Msg_EditMsgPgUp + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Msg_EditMsgDown Far + Assume DS:Message + ; Search for enter + Mov SI, CurrentPosition + +Msg_EditMsgDown1: + Mov AL, [SI+MessageData] + Inc SI + And AL, AL + JZ Msg_EditMsgDownEnd + + Cmp AL, 13 + JNE Msg_EditMsgDown1 + + Mov CX, HorizontalPosition + JCXZ Msg_EditMsgDown3 + +Msg_EditMsgDown2: + Mov AL, [SI+MessageData] + And AL, AL + JZ Msg_EditMsgDown3 + + Cmp AL, 13 + JE Msg_EditMsgDown3 + + Inc SI + Loop Msg_EditMsgDown2 + +Msg_EditMsgDown3: + Cmp SI, MESSAGELENGTH-2 + JAE Msg_EditMsgDownEnd + + Mov CurrentPosition, SI + +Msg_EditMsgDownEnd: + Mov AX, 1 + Ret + +EndP Msg_EditMsgDown + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Msg_EditMsgPgDn Far + + Mov CX, 35 + +Msg_EditMsgPgDn1: + Push CX + Call Msg_EditMsgDown + Pop CX + Loop Msg_EditMsgPgDn1 + + Mov AX, 1 + Ret + +EndP Msg_EditMsgPgDn + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Msg_EditMsgDelete Far + Assume DS:Message + + Mov SI, CurrentPosition + Mov DX, 1 + Call DeleteData + Call CheckWordWrap + + Mov AX, 1 + Ret + +EndP Msg_EditMsgDelete + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Msg_EditMsgInsert Far + + Mov SI, CurrentPosition + Mov DX, 1 + Call InsertData + JC Msg_EditMsgInsert1 + + Mov Byte Ptr [SI+MessageData], 32 + Call CheckWordWrap + +Msg_EditMsgInsert1: + Mov AX, 1 + Ret + +EndP Msg_EditMsgInsert + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Msg_EditMsgBackspace Far + Assume DS:Message + + Mov SI, CurrentPosition + And SI, SI + JZ Msg_EditMsgBackspace1 + + Call Msg_EditMsgLeft + Call Msg_EditMsgDelete + +Msg_EditMsgBackspace1: + Mov AX, 1 + Ret + +EndP Msg_EditMsgBackspace + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Msg_EditMsgDeleteLine Far + Assume DS:Message + + Mov SI, CurrentPosition ; Search back for + ; start of line.. + Call FindStart + + ; Find length to delete. + Xor BX, BX ; DI = length + +Msg_EditMsgDeleteLine3: + Mov AL, [SI+BX+MessageData] + Inc BX + + And AL, AL + JZ Msg_EditMsgDeleteLine4 + Cmp AL, 13 + JNE Msg_EditMsgDeleteLine3 + +Msg_EditMsgDeleteLine4: + Mov DX, BX + Call DeleteData + + Mov CurrentPosition, SI + + Mov AX, 1 + Ret + +EndP Msg_EditMsgDeleteLine + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Msg_ClearMessage Far + + Mov DI, Offset O1_ConfirmClearMessage + Mov CX, 4 + Call M_Object1List + + And DX, DX + JZ Msg_ClearMessage1 + + Call Msg_ResetMessage + +Msg_ClearMessage1: + Mov AX, 1 + Ret + +EndP Msg_ClearMessage + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Msg_EditMsgHome Far + Assume DS:Message + + Mov SI, CurrentPosition + Call FindStart + Mov CurrentPosition, SI + + Mov AX, 1 + Ret + +EndP Msg_EditMsgHome + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Msg_EditMsgEnd Far + Assume DS:Message + + Mov SI, CurrentPosition + +Msg_EditMsgEndLoop: + Mov AL, [SI+MessageData] + + Inc SI + + And AL, AL + JZ Msg_EditMsgEnd1 + + Cmp AL, 13 + JNE Msg_EditMsgEndLoop + +Msg_EditMsgEnd1: + Dec SI + Mov CurrentPosition, SI + + Mov AX, 1 + Ret + +EndP Msg_EditMsgEnd + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc FindStart + +FindStart1: + Sub SI, 1 + JC FindStart2 + + Cmp Byte Ptr [SI+MessageData], 13 + JNE FindStart1 + +FindStart2: + Inc SI + Ret + +EndP FindStart + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc InsertData ; SI = pos, DX = length. + + Push CX + Push DX + Push SI + + Mov CX, MESSAGELENGTH-1 + Sub CX, SI + Sub CX, DX + + Mov SI, Offset MessageData+MESSAGELENGTH-2 + Mov DI, SI + Sub SI, DX + + Cmp Byte Ptr [SI], 0 + JNE InsertDataError + + Push DS + Pop ES + + StD + Rep MovsB + ClD + + ClC + Jmp InsertDataEnd + +InsertDataError: + Push DS + + Mov DI, Offset O1_LongMessageList + Mov CX, 2 + Call M_Object1List + + Pop DS + + StC + +InsertDataEnd: + Pop SI + Pop DX + Pop CX + Ret + +EndP InsertData + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc DeleteData ; SI = pos, DX = length + ; Assume DS:Message + + Push CX + Push DX + Push SI + + Push CS + Pop ES + + Mov CX, MESSAGELENGTH + Sub CX, SI + Sub CX, DX + JS DeleteData1 + + Add SI, Offset MessageData + Mov DI, SI + Add SI, DX + + Rep MovsB + + Xor AX, AX + Mov CX, DX + Rep StosB + +DeleteData1: + Pop SI + Pop DX + Pop CX + Ret + +EndP DeleteData + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc CheckWordWrap ; Check current line only. + + Mov SI, CurrentPosition + Call FindStart + + ; OK, so SI = pos of last line. + ; Now count length of new line. + Xor BX, BX ; BX = count. + +CheckWordWrap3: + Mov AL, [SI+BX+MessageData] + + Inc BX + + And AL, AL + JZ CheckWordWrap4 + Cmp AL, 13 + JNE CheckWordWrap3 + +CheckWordWrap4: ; OK.. now if BX > 66... + Cmp BX, 75 + JA CheckWordWrap5 + + Ret + +CheckWordWrap5: ; Search back for a space and REPLACE + ; it with an enter... + Mov BX, 75 + +CheckWordWrap6: + Dec BX + JZ CheckWordWrap7 + + Cmp Byte Ptr [SI+BX+MessageData], 32 + JNE CheckWordWrap6 + + Mov Byte Ptr [SI+BX+MessageData], 13 + + Ret + +CheckWordWrap7: ; Insert an enter + Mov DX, 1 + Add SI, 75 + Call InsertData + Mov Byte Ptr [SI+MessageData], 13 + +CheckWordWrap8: + Ret + +EndP CheckWordWrap + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Msg_GetMessageLength Far ; Returns AX + + Push DS + Push SI + + Push CS + Pop DS + + Mov SI, Offset MessageData + +Msg_GetMessageLength1: + LodsB + And AL, AL + JNZ Msg_GetMessageLength1 + + Sub SI, Offset MessageData + Mov AX, SI + + Pop SI + Pop DS + Ret + +EndP Msg_GetMessageLength + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Msg_GetMessageOffset Far + + Push CS + Pop DS + + Mov DX, Offset MessageData + Ret + +EndP Msg_GetMessageOffset + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Msg_ToggleCharacterSet Far + Assume DS:Message + + Xor CharacterColour, 6 xor 12 + + Mov AX, 1 + Ret + +EndP Msg_ToggleCharacterSet + Assume DS:Nothing + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +EndS + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +End diff --git a/IT_MUSIC.ASM b/IT_MUSIC.ASM new file mode 100644 index 0000000..ce4deba --- /dev/null +++ b/IT_MUSIC.ASM @@ -0,0 +1,7481 @@ +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Music Module ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + .386 + .387 + +include switch.inc +include network.inc + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Externals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Extrn D_GotoStartingDirectory:Far + Extrn D_SetDriveDirectoryFar:Far + Extrn D_GetFileName:Far + Extrn D_Showtime:Far + + Extrn E_EMSAvailable:Far + Extrn E_SaveEMSPageFrame:Far + Extrn E_RestoreEMSPageFrame:Far + Extrn E_UnInitEMS:Far + Extrn E_AllocateEMS:Far + Extrn E_MapEMSMemory:Far + Extrn E_GetEMSPageFrame:Far + Extrn E_ReleaseEMS:Far + Extrn E_AllocateBlockEMS:Far, E_ReleaseBlockEMS:Far + Extrn E_MapAlignedBlockEMS:Far + Extrn E_GetInternalEMSHandle:Far + + Extrn I_TagInstrument:Far + Extrn I_TagSample:Far + + Extrn O1_OutOfSoundCardMemoryList:Far + + Extrn M_FunctionHandler:Far + Extrn M_Object1List:Far + + Extrn Network_UpdatePatternIfIdle:Far + + Extrn PE_GetCurrentPattern:Far + Extrn PE_FillHeader:Far + Extrn S_GetDestination:Far + Extrn S_UnInitScreen:Far + Extrn S_DirectDrawString:Far + Extrn S_DrawString:Far + Extrn S_SetDirectMode:Far + Extrn S_SaveScreen:Far + Extrn S_RestoreScreen:Far + Extrn S_DrawBox:Far + Extrn S_DrawString:Far + Extrn S_UpdateScreen:Far + Extrn S_DrawSmallBox:Far + Extrn F_DrawHeader:Far + + Extrn K_GetKey:Far + Extrn StartClock:Far + Extrn SetInfoLine:Far, SetInfoLine2:Far + Extrn M_Object1List:Far + + Extrn MaxRow + + Extrn IdleUpdateInfoLine:Far + Extrn GlobalKeyList:Far + Extrn GetEnvironment:Far + + Extrn MIDIBufferEmpty:Far, MIDISend:Far, MIDI_ClearTable:Far + Extrn O1_ShowTime + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Globals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Global Music_GetDisplayVariables:Far + Global Music_AutoDetectSoundCard:Far + + Global Music_Poll:Far + + Global Music_ReinitSoundCard:Far + Global Music_InitMusic:Far + Global Music_UnInitMusic:Far + Global Music_GetSongSegment:Far + Global Music_GetInstrumentMode:Far + Global Music_ReleasePattern:Far + Global Music_GetPattern:Far + Global Music_GetPatternLocation:Far + Global Music_GetPatternLocationNoCount:Far + Global Music_AllocatePattern:Far + Global Music_AllocateSample:Far + Global Music_IncreaseSpeed:Far + Global Music_DecreaseSpeed:Far + Global Music_GetOutputWaveform:Far + Global Music_PlayPartSong:Far + Global Music_GetPatternLength:Far + Global Music_ShowAutodetectSoundcard:Far + Global Music_GetWaveForm:Far + Global Music_ToggleOrderUpdate:Far + + Global Music_NextOrder:Far + Global Music_LastOrder:Far + + Global Music_SetSoundCard:Far + Global Music_SetDMA:Far + Global Music_SetMixSpeed:Far + Global Music_SetIRQ:Far + Global Music_SetAddress:Far + Global Music_SetLimit:Far + Global Music_ReverseChannels:Far + + Global Music_GetNumChannels:Far + Global Music_InitStereo:Far + Global Music_ReleaseSample:Far + Global Music_ReleaseAllSamples:Far + Global Music_ReleaseAllPatterns:Far + Global Music_ClearSampleName:Far + Global Music_ClearAllSampleNames:Far + Global Music_GetNumberOfSamples:Far + Global Music_GetNumberOfInstruments:Far + Global Music_ClearInstrument:Far + Global Music_ClearAllInstruments:Far + Global Music_GetHostChannelInformationTable:Far + Global Music_GetSlaveChannelInformationTable:Far + Global Music_SetGlobalVolume:Far + + Global Music_InitMuteTable:Far + Global Music_UnmuteAll:Far + + Global Music_GetPlayMode:Far + Global Music_GetPlayMode2:Far + Global Music_PlayPattern:Far + Global Music_PlaySample:Far + Global Music_PlayNote:Far + Global Music_Stop:Far + Global Music_PlaySong:Far + Global Music_ToggleChannel:Far + Global Music_SoloChannel:Far + Global Music_InitMixTable:Far + Global Music_GetSampleLocation:Far + Global Music_UpdatePatternOffset:Far + Global Music_AssignSampleToInstrument:Far + Global Music_KBPlaySong:Far + Global Music_IncreaseVolume:Far + Global Music_DecreaseVolume:Far + Global Music_SetSoundCardDriver:Far + Global Music_RegetLoopInformation:Far + + Global Music_SoundCardLoadSample:Far + Global Music_SoundCardLoadAllSamples:Far + Global Music_GetFreeSoundCardMemory:Far + Global Music_GetPitchTable:Far + Global Music_GetMIDIDataArea:Far + + Global Music_ToggleReverse:Far + Global Music_PatternStorage:Far + + Global Music_GetDriverScreen:Far + Global Music_GetLastChannel:Far + + Global SongDataArea:Word + Global MixDataArea:Word + + Global Music_GetDriverVariable:Far, Music_SetDriverVariable:Far + Public Music_GetDelay + Public Music_SetNextOrder + Public Music_TimeSong + Public Music_ShowTime + Public Music_SaveMIDIConfig + Public MIDIDataArea + + Public Music_ToggleSoloInstrument, Music_ToggleSoloSample + + Extrn PE_GetLastInstrument:Far + Public CurrentPattern + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +; +; Functions for playing control +; Music_PlaySong........ parameters, AX = order +; Music_Stop............ parameters, None +; Music_PlayPattern..... parameters, AX = pattern, BX = number of rows, CX = row +; Music_ToggleChannel... parameters, AX = channel +; Music_SoloChannel..... parameters, AX = channel +; + +Segment SongData PARA Public 'Data' +EndS + +Segment Music DWORD Public 'Code' USE16 + Assume CS:Music + +CREATENEWLOGFILE EQU 0 +include debug.inc + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Variables ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +HOSTCHANNELSIZE EQU 80 +SLAVECHANNELSIZE EQU 128 +MAXSLAVECHANNELS EQU 256 +NONOTE EQU 0FDh + +MIDICOMMAND_START EQU 0 +MIDICOMMAND_STOP EQU 20h +MIDICOMMAND_TICK EQU 40h +MIDICOMMAND_PLAYNOTE EQU 60h +MIDICOMMAND_STOPNOTE EQU 80h +MIDICOMMAND_CHANGEVOLUME EQU 0A0h +MIDICOMMAND_CHANGEPAN EQU 0C0h +MIDICOMMAND_BANKSELECT EQU 0E0h +MIDICOMMAND_PROGRAMSELECT EQU 100h +MIDICOMMAND_CHANGEPITCH EQU 0FFFFh + +FineSineData Label Byte + DB 0, 2, 3, 5, 6, 8, 9, 11, 12, 14, 16, 17, 19, 20, 22, 23 + DB 24, 26, 27, 29, 30, 32, 33, 34, 36, 37, 38, 39, 41, 42, 43, 44 + DB 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59 + DB 59, 60, 60, 61, 61, 62, 62, 62, 63, 63, 63, 64, 64, 64, 64, 64 + DB 64, 64, 64, 64, 64, 64, 63, 63, 63, 62, 62, 62, 61, 61, 60, 60 + DB 59, 59, 58, 57, 56, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46 + DB 45, 44, 43, 42, 41, 39, 38, 37, 36, 34, 33, 32, 30, 29, 27, 26 + DB 24, 23, 22, 20, 19, 17, 16, 14, 12, 11, 9, 8, 6, 5, 3, 2 + DB 0, -2, -3, -5, -6, -8, -9,-11,-12,-14,-16,-17,-19,-20,-22,-23 + DB -24,-26,-27,-29,-30,-32,-33,-34,-36,-37,-38,-39,-41,-42,-43,-44 + DB -45,-46,-47,-48,-49,-50,-51,-52,-53,-54,-55,-56,-56,-57,-58,-59 + DB -59,-60,-60,-61,-61,-62,-62,-62,-63,-63,-63,-64,-64,-64,-64,-64 + DB -64,-64,-64,-64,-64,-64,-63,-63,-63,-62,-62,-62,-61,-61,-60,-60 + DB -59,-59,-58,-57,-56,-56,-55,-54,-53,-52,-51,-50,-49,-48,-47,-46 + DB -45,-44,-43,-42,-41,-39,-38,-37,-36,-34,-33,-32,-30,-29,-27,-26 + DB -24,-23,-22,-20,-19,-17,-16,-14,-12,-11, -9, -8, -6, -5, -3, -2 + +FineRampDownData Label Byte + DB 64, 63, 63, 62, 62, 61, 61, 60, 60, 59, 59, 58, 58, 57, 57, 56 + DB 56, 55, 55, 54, 54, 53, 53, 52, 52, 51, 51, 50, 50, 49, 49, 48 + DB 48, 47, 47, 46, 46, 45, 45, 44, 44, 43, 43, 42, 42, 41, 41, 40 + DB 40, 39, 39, 38, 38, 37, 37, 36, 36, 35, 35, 34, 34, 33, 33, 32 + DB 32, 31, 31, 30, 30, 29, 29, 28, 28, 27, 27, 26, 26, 25, 25, 24 + DB 24, 23, 23, 22, 22, 21, 21, 20, 20, 19, 19, 18, 18, 17, 17, 16 + DB 16, 15, 15, 14, 14, 13, 13, 12, 12, 11, 11, 10, 10, 9, 9, 8 + DB 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0 + DB 0, -1, -1, -2, -2, -3, -3, -4, -4, -5, -5, -6, -6, -7, -7, -8 + DB -8, -9, -9,-10,-10,-11,-11,-12,-12,-13,-13,-14,-14,-15,-15,-16 + DB -16,-17,-17,-18,-18,-19,-19,-20,-20,-21,-21,-22,-22,-23,-23,-24 + DB -24,-25,-25,-26,-26,-27,-27,-28,-28,-29,-29,-30,-30,-31,-31,-32 + DB -32,-33,-33,-34,-34,-35,-35,-36,-36,-37,-37,-38,-38,-39,-39,-40 + DB -40,-41,-41,-42,-42,-43,-43,-44,-44,-45,-45,-46,-46,-47,-47,-48 + DB -48,-49,-49,-50,-50,-51,-51,-52,-52,-53,-53,-54,-54,-55,-55,-56 + DB -56,-57,-57,-58,-58,-59,-59,-60,-60,-61,-61,-62,-62,-63,-63,-64 + +FineSquareWave Label Byte + DB 128 Dup (64), 128 Dup (0) + +EmptyPattern Label + DW 64, 64, 0, 0 + DB 64 Dup (0) + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + + ; Zero globals. + +LastSample DW 0 +PlayMode DW 0 ; Playmode 0 = Freeplay + ; Playmode 1 = Pattern + ; Playmode 2 = Song +CurrentOrder DW 0 ; } Must follow +CurrentPattern DW 0 ; } +CurrentRow DW 0 ; } +ProcessOrder DW 0 +ProcessRow DW 0 +BytesToMix DW 0 ; = Bytes per frame +PatternOffset DW 0 +PatternSegment DW 0 +BreakRow DW 0 +RowDelay DB 0 ; } Must join on. +RowDelayOn DB 0 ; } +PatternArray DB 0 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +ALIGN 4 + +PitchDepthConstant DD 98304.0 +HostChannelInformationTable DB 64*HOSTCHANNELSIZE Dup(?) +SlaveChannelInformationTable DB MAXSLAVECHANNELS*SLAVECHANNELSIZE Dup(?) +MuteChannelTable DB 64 Dup (?) +ChannelCountTable DB 400 Dup (?) +;AllocateCount1 DB 0 +;AllocateCount2 DB 0 +;AllocateCount3 DB 0 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +ALIGN 2 + +PatternDataSegment DW ? +CurrentEditPattern DW ? +PatternEditMaxRow DW ? + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +NumberOfRows DW 64 ; Non zero globals +CurrentTick DW 6 +CurrentSpeed DW 6 +ProcessTick DW 0 +Tempo DB 125 +GlobalVolume DB 128 +NumChannels DW 256 +SoloSample DB 0FFh ; * ORDER IS IMPORTANT +SoloInstrument DB 0FFh ; * ORDER IS IMPORTANT + +AllocateNumChannels DW 0 +AllocateSlaveOffset DW 0 +LastSlaveChannel DW 0 + +DecodeExpectedPattern DW 0FFFEh +DecodeExpectedRow DW 0FFFEh + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +CmdLineNumChannels DW 0FFFFh + +DriverRequiredVariables Label ; * ORDER IS IMPORTANT +BasePort DW 0FFFFh ; * ORDER IS IMPORTANT +IRQ DW 0FFFFh ; * ORDER IS IMPORTANT +DMA DW 0FFFFh ; * ORDER IS IMPORTANT +CmdLineMixSpeed DW 0 ; * ORDER IS IMPORTANT +SongDataArea DW SongData ; * ORDER IS IMPORTANT +MIDIDataArea DW SongData + 4076 + +CmdLineDMASize DW 1024 ; default +ReverseChannels DB 0 + +InstrumentHeader Label Byte + DB "IMPI" + DB 19 Dup (0), 60, 128, 32+128, 34 Dup (0) + DB 0, 0FFh, 0FFh, 0FFh + DB 0, 0, 1, 0, 2, 0, 3, 0, 4, 0 + DB 5, 0, 6, 0, 7, 0, 8, 0, 9, 0 + DB 10, 0, 11, 0, 12, 0, 13, 0, 14, 0 + DB 15, 0, 16, 0, 17, 0, 18, 0, 19, 0 + DB 20, 0, 21, 0, 22, 0, 23, 0, 24, 0 + DB 25, 0, 26, 0, 27, 0, 28, 0, 29, 0 + DB 30, 0, 31, 0, 32, 0, 33, 0, 34, 0 + DB 35, 0, 36, 0, 37, 0, 38, 0, 39, 0 + DB 40, 0, 41, 0, 42, 0, 43, 0, 44, 0 + DB 45, 0, 46, 0, 47, 0, 48, 0, 49, 0 + DB 50, 0, 51, 0, 52, 0, 53, 0, 54, 0 + DB 55, 0, 56, 0, 57, 0, 58, 0, 59, 0 + DB 60, 0, 61, 0, 62, 0, 63, 0, 64, 0 + DB 65, 0, 66, 0, 67, 0, 68, 0, 69, 0 + DB 70, 0, 71, 0, 72, 0, 73, 0, 74, 0 + DB 75, 0, 76, 0, 77, 0, 78, 0, 79, 0 + DB 80, 0, 81, 0, 82, 0, 83, 0, 84, 0 + DB 85, 0, 86, 0, 87, 0, 88, 0, 89, 0 + DB 90, 0, 91, 0, 92, 0, 93, 0, 94, 0 + DB 95, 0, 96, 0, 97, 0, 98, 0, 99, 0 + DB 100, 0, 101, 0, 102, 0, 103, 0, 104, 0 + DB 105, 0, 106, 0, 107, 0, 108, 0, 109, 0 + DB 110, 0, 111, 0, 112, 0, 113, 0, 114, 0 + DB 115, 0, 116, 0, 117, 0, 118, 0, 119, 0 + DB 0, 2, 4 Dup (0), 64, 0, 0, 64, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 0, 2, 4 Dup (0), 0, 0, 0, 0, 100, 0, 70 Dup (0) + DB 7 Dup (0) + +SampleHeader Label Byte + DB "IMPS", 13 Dup (0), 64, 0, 64, 40 Dup (0) + DW 8363 + DB 18 Dup (0) + +MidiPitchSendString DB 65h, 0, 64h, 0, 06 + +PatternLooping DB 0 +PatternStorage DB 1 ; 0 = conventional only + ; 1 = selective + ; 2 = EMS only. + +PrepareSamplesMsg DB "Preparing Samples", 0 +ReverseMsg DB "Left/right outputs reversed", 0 +NoSoundCardMsg DB " No sound card detected", 0 +MIDIConfigFileName DB "ITMIDI.CFG", 0 + +OrderUpdateEnabledMsg DB "Order list unlocked", 0 +OrderUpdateDisabledMsg DB "Order list locked", 0 +OrderLockFlag DB 0 + +UnsoloMsg DB "Solo disabled", 0 +SoloSampleMsg DB "Solo sample ", 0FDh, "D", 0 +SoloInstrumentMsg DB "Solo instrument ", 0FDh, "D", 0 + +IFDEF DEBUG + +LoadDriverMessage DB "Loading driver:", 0 +UnableToReadFileMessage DB "Unable to read file", 0 +DetectingMessage DB "Testing driver", 0 +ScreenOffset DW 0 + +ENDIF + +PCSpeakerDriver DB "ITPCSPKR.DRV", 0 +SBDriver DB "ITSB.DRV", 0 +SB2Driver DB "ITSB2.DRV", 0 +SBProDriver DB "ITSBPRO.DRV", 0 +SB16Driver DB "ITSB16.DRV", 0 +AWE32Driver DB "ITAWE32.DRV", 0 +GUSDriver DB "ITGUS.DRV", 0 +InterwaveDriver DB "ITIW.DRV", 0 +PASDriver DB "ITPAS.DRV", 0 +PAS16Driver DB "ITPAS16.DRV", 0 +WSSDriver DB "ITWSS.DRV", 0 +ESSDriver DB "ITES1868.DRV", 0 +MIDIDriver DB "ITMPU401.DRV", 0 +EWSCodecDriver DB "ITEWSCOD.DRV", 0 +VIVOCodecDriver DB "ITVIVO.DRV", 0 +ST97PCICodecDriver DB "ITSTCODE.DRV", 0 +WAVDriver DB "ITWAV.DRV", 0 +MIDDriver DB "ITMID.DRV", 0 +VSoundMMXDriver DB "ITVSOUND.MMX", 0 +VSoundDriver DB "ITVSOUND.DRV", 0 +DefaultDriver DB "ITSOUND.DRV", 0 + +DriverNameTable Label + DW 0FFFFh + DW Offset PAS16Driver, SB16Driver + DW Offset InterwaveDriver, Offset GUSDriver + DW Offset AWE32Driver, Offset SBProDriver + DW Offset SBDriver, Offset PCSpeakerDriver + DW Offset SB2Driver, Offset PASDriver + DW Offset WAVDriver, Offset WSSDriver + DW Offset ESSDriver, MIDIDriver + DW Offset EWSCodecDriver, VIVOCodecDriver + DW Offset ST97PCICodecDriver, Offset MIDDRIVER + DW Offset DefaultDriver, Offset VSoundMMXDriver + DW Offset VSoundDriver + +DriverName DD 0 + +DriverDetectionOrder DW 19, 20, 21, 17, 16, 15, 13, 1, 10, 2, 12, 3, 4, 5, 6, 9, 7, 8, 0FFFFh +DriverSoundCard DW 0, 8, 7, 9, 6 + DW 2, 5, 4, 3, 10 + DW 1, 12, 13, 15, 16 + DW 0, 0, 0, 0, 14 + DW 11, 18 + +ALIGN 4 + +PitchTable Label DWord + DW 2048, 0, 2170, 0, 2299, 0, 2435, 0, 2580, 0, 2734, 0 + DW 2896, 0, 3069, 0, 3251, 0, 3444, 0, 3649, 0, 3866, 0 + + DW 4096, 0, 4340, 0, 4598, 0, 4871, 0, 5161, 0, 5468, 0 + DW 5793, 0, 6137, 0, 6502, 0, 6889, 0, 7298, 0, 7732, 0 + + DW 8192, 0, 8679, 0, 9195, 0, 9742, 0, 10321, 0, 10935, 0 + DW 11585, 0, 12274, 0, 13004, 0, 13777, 0, 14596, 0, 15464, 0 + + DW 16384, 0, 17358, 0, 18390, 0, 19484, 0, 20643, 0, 21870, 0 + DW 23170, 0, 24548, 0, 26008, 0, 27554, 0, 29193, 0, 30929, 0 + + DW 32768, 0, 34716, 0, 36781, 0, 38968, 0, 41285, 0, 43740, 0 + DW 46341, 0, 49097, 0, 52016, 0, 55109, 0, 58386, 0, 61858, 0 + + DW 0, 1, 3897, 1, 8026, 1, 12400, 1, 17034, 1, 21944, 1 + DW 27146, 1, 32657, 1, 38496, 1, 44682, 1, 51236, 1, 58179, 1 + + DW 0, 2, 7794, 2, 16051, 2, 24800, 2, 34068, 2, 43888, 2 + DW 54292, 2, 65314, 2, 11456, 3, 23828, 3, 36936, 3, 50823, 3 + + DW 0, 4, 15588, 4, 32103, 4, 49600, 4, 2601, 5, 22240, 5 + DW 43048, 5, 65092, 5, 22912, 6, 47656, 6, 8336, 7, 36110, 7 + + DW 0, 8, 31176, 8, 64205, 8, 33663, 9, 5201, 10, 44481, 10 + DW 20559, 11, 64648, 11, 45823, 12, 29776, 13, 16671, 14, 6684, 15 + + DW 0, 16, 62352, 16, 62875, 17, 1790, 19, 10403, 20, 23425, 21 + DW 41118, 22, 63761, 23, 26111, 25, 59552, 26, 33342, 28, 13368, 30 + +; Pitch extention for loading some XIs + + DW 0, 32, 59167, 33, 60214, 35, 3580, 38, 20806, 40, 46850, 42 + DW 16701, 45, 61986, 47, 52221, 50, 53567, 53, 1148, 57, 26736, 60 + +IF USEFPUCODE + +FPSave DB 128 Dup (0) + +Const_14317456 DD 14317456.0 +Const1_On_768 DD 3AAAAAABh +SlideValue DW 0 +NewControlWord DW 7Fh + +ELSE + +FineLinearSlideUpTable Label + DW 0, 1, 59, 1, 118, 1, 178, 1, 237, 1 ; 0->4 + DW 296, 1, 356, 1, 415, 1, 475, 1, 535, 1 ; 5->9 + DW 594, 1, 654, 1, 714, 1, 773, 1, 833, 1 ; 10->14 + DW 893, 1 ; 15 + +LinearSlideUpTable Label ; Value = 2^(Val/192) + DW 0, 1, 237, 1, 475, 1, 714, 1, 953, 1 ; 0->4 + DW 1194, 1, 1435, 1, 1677, 1, 1920, 1, 2164, 1 ; 5->9 + DW 2409, 1, 2655, 1, 2902, 1, 3149, 1, 3397, 1 ; 10->14 + DW 3647, 1, 3897, 1, 4148, 1, 4400, 1, 4653, 1 ; 15->19 + DW 4907, 1, 5157, 1, 5417, 1, 5674, 1, 5932, 1 ; 20->24 + DW 6190, 1, 6449, 1, 6710, 1, 6971, 1, 7233, 1 ; 25->29 + DW 7496, 1, 7761, 1, 8026, 1, 8292, 1, 8559, 1 ; 30->34 + DW 8027, 1, 9096, 1, 9366, 1, 9636, 1, 9908, 1 ; 35->39 + DW 10181, 1, 10455, 1, 10730, 1, 11006, 1, 11283,1 ; 40->44 + DW 11560, 1, 11839, 1, 12119, 1, 12400, 1, 12682,1 ; 45->49 + DW 12965, 1, 13249, 1, 13533, 1, 13819, 1, 14106,1 ; 50->54 + DW 14394, 1, 14684, 1, 14974, 1, 15265, 1, 15557,1 ; 55->59 + DW 15850, 1, 16145, 1, 16440, 1, 16737, 1, 17034,1 ; 60->64 + DW 17333, 1, 17633, 1, 17933, 1, 18235, 1, 18538,1 ; 65->69 + DW 18842, 1, 19147, 1, 19454, 1, 19761, 1, 20070,1 ; 70->74 + DW 20379, 1, 20690, 1, 21002, 1, 21315, 1, 21629,1 ; 75->79 + DW 21944, 1, 22260, 1, 22578, 1, 22897, 1, 23216,1 ; 80->84 + DW 23537, 1, 23860, 1, 24183, 1, 24507, 1, 24833,1 ; 85->89 + DW 25160, 1, 25488, 1, 25817, 1, 26148, 1, 26479,1 ; 90->94 + DW 26812, 1, 27146, 1, 27481, 1, 27818, 1, 28155,1 ; 95->99 + DW 28494, 1, 28834, 1, 29175, 1, 29518, 1, 29862,1 ; 100->104 + DW 30207, 1, 30553, 1, 30900, 1, 31248, 1, 31599,1 ; 105->109 + DW 31951, 1, 32303, 1, 32657, 1, 33012, 1, 33369,1 ; 110->114 + DW 33726, 1, 34085, 1, 34446, 1, 34807, 1, 35170,1 ; 115->119 + DW 35534, 1, 35900, 1, 36267, 1, 36635, 1, 37004,1 ; 120->124 + DW 37375, 1, 37747, 1, 38121, 1, 38496, 1, 38872,1 ; 125->129 + DW 39250, 1, 39629, 1, 40009, 1, 40391, 1, 40774,1 ; 130->134 + DW 41158, 1, 41544, 1, 41932, 1, 42320, 1, 42710,1 ; 135->139 + DW 43102, 1, 43495, 1, 43889, 1, 44285, 1, 44682,1 ; 140->144 + DW 45081, 1, 45481, 1, 45882, 1, 46285, 1, 46690,1 ; 145->149 + DW 47095, 1, 47503, 1, 47917, 1, 48322, 1, 48734,1 ; 150->154 + DW 49147, 1, 49562, 1, 49978, 1, 50396, 1, 50815,1 ; 155->159 + DW 51236, 1, 51658, 1, 52082, 1, 52507, 1, 52934,1 ; 160->164 + DW 53363, 1, 53793, 1, 54224, 1, 54658, 1, 55092,1 ; 165->169 + DW 55529, 1, 55966, 1, 56406, 1, 56847, 1, 57289,1 ; 170->174 + DW 57734, 1, 58179, 1, 58627, 1, 59076, 1, 59527,1 ; 175->179 + DW 59979, 1, 60433, 1, 60889, 1, 61346, 1, 61805,1 ; 180->184 + DW 62265, 1, 62727, 1, 63191, 1, 63657, 1, 64124,1 ; 185->189 + DW 64593, 1, 65064, 1, 0, 2, 474, 2, 950, 2 ; 190->194 + DW 1427, 2, 1906, 2, 2387, 2, 2870, 2, 3355, 2 ; 195->199 + DW 3841, 2, 4327, 2, 4818, 2, 5310, 2, 5803, 2 ; 200->204 + DW 6298, 2, 6795, 2, 7294, 2, 7794, 2, 8296, 2 ; 205->209 + DW 8800, 2, 9306, 2, 9814, 2, 10323, 2, 10835,2 ; 210->214 + DW 11348, 2, 11863, 2, 12380, 2, 12899, 2, 13419,2 ; 215->219 + DW 13942, 2, 14467, 2, 14993, 2, 15521, 2, 16051,2 ; 220->224 + DW 16583, 2, 17117, 2, 17653, 2, 18191, 2, 18731,2 ; 225->229 + DW 19273, 2, 19817, 2, 20362, 2, 20910, 2, 21460,2 ; 230->234 + DW 22011, 2, 22565, 2, 23121, 2, 23678, 2, 24238,2 ; 235->239 + DW 24800, 2, 25363, 2, 25929, 2, 25497, 2, 27067,2 ; 240->244 + DW 27639, 2, 28213, 2, 28789, 2, 29367, 2, 29947,2 ; 245->249 + DW 30530, 2, 31114, 2, 31701, 2, 32289, 2, 32880, 2 ; 250->254 + DW 33473, 2, 34068, 2 ; 255->256 + +FineLinearSlideDownTable Label + DW 65535, 65477, 65418, 65359, 65300, 65241, 65182, 65359 ; 0->7 + DW 65065, 65006, 64947, 64888, 64830, 64772, 64713, 64645 ; 8->15 + +LinearSlideDownTable Label + DW 65535, 65300, 65065, 64830, 64596, 64364, 64132, 63901 ; 0->7 + DW 63670, 63441, 63212, 62984, 62757, 62531, 62306, 62081 ; 8->15 + DW 61858, 61635, 61413, 61191, 60971, 60751, 60532, 60314 ; 16->23 + DW 60097, 59880, 59664, 59449, 59235, 59022, 58809, 58597 ; 24->31 + DW 58386, 58176, 57966, 57757, 57549, 57341, 57135, 56929 ; 32->39 + DW 56724, 56519, 56316, 56113, 55911, 55709, 55508, 55308 ; 40->47 + DW 55109, 54910, 54713, 54515, 54319, 54123, 53928, 53734 ; 48->55 + DW 53540, 53347, 53155, 52963, 52773, 52582, 52393, 52204 ; 56->63 + DW 52016, 51829, 51642, 51456, 51270, 51085, 50901, 50718 ; 64->71 + DW 50535, 50353, 50172, 49991, 49811, 49631, 49452, 49274 ; 72->79 + DW 49097, 48920, 48743, 48568, 48393, 48128, 48044, 47871 ; 80->87 + DW 47699, 47527, 47356, 47185, 47015, 46846, 46677, 46509 ; 88->95 + DW 46341, 46174, 46008, 45842, 45677, 45512, 45348, 45185 ; 96->103 + DW 45022, 44859, 44698, 44537, 44376, 44216, 44057, 43898 ;104->111 + DW 43740, 43582, 43425, 43269, 43113, 42958, 42803, 42649 ;112->119 + DW 42495, 42342, 42189, 42037, 41886, 41735, 41584, 41434 ;120->127 + DW 41285, 41136, 40988, 40840, 40639, 40566, 40400, 40253 ;128->135 + DW 40110, 39965, 39821, 39678, 39535, 39392, 39250, 39109 ;136->143 + DW 38968, 38828, 38688, 38548, 38409, 38271, 38133, 37996 ;144->151 + DW 37859, 37722, 37586, 37451, 37316, 37181, 37047, 36914 ;152->159 + DW 36781, 36648, 36516, 36385, 36254, 36123, 35993, 35863 ;160->167 + DW 35734, 35605, 35477, 35349, 35221, 35095, 34968, 34842 ;168->175 + DW 34716, 34591, 34467, 34343, 34219, 34095, 33973, 33850 ;176->183 + DW 33728, 33607, 33486, 33365, 33245, 33125, 33005, 32887 ;184->191 + DW 32768, 32650, 32532, 32415, 32298, 32182, 32066, 31950 ;192->199 + DW 31835, 31720, 31606, 31492, 31379, 31266, 31153, 31041 ;200->207 + DW 30929, 30817, 30706, 30596, 30485, 30376, 30226, 30157 ;208->215 + DW 30048, 29940, 29832, 29725, 29618, 29511, 29405, 29299 ;216->223 + DW 29193, 29088, 28983, 28879, 28774, 28671, 28567, 28464 ;224->231 + DW 28362, 28260, 28158, 28056, 27955, 27855, 27754, 27654 ;232->239 + DW 27554, 27455, 27356, 27258, 27159, 27062, 26964, 26867 ;240->247 + DW 26770, 26674, 26577, 26482, 26386, 26291, 26196, 26102 ;248->255 + DW 26008 ; 256 + +ENDIF ; USEFPUCODE + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +InitCommandTable Label Word + DW Offset InitNoCommand, Offset InitCommandA + DW Offset InitCommandB, Offset InitCommandC + DW Offset InitCommandD, Offset InitCommandE + DW Offset InitCommandF, Offset InitCommandG + DW Offset InitCommandH, Offset InitCommandI + DW Offset InitCommandJ, Offset InitCommandK + DW Offset InitCommandL, Offset InitCommandM + DW Offset InitCommandN, Offset InitCommandO + DW Offset InitCommandP, Offset InitCommandQ + DW Offset InitCommandR, Offset InitCommandS + DW Offset InitCommandT, Offset InitCommandU + DW Offset InitCommandV, Offset InitCommandW + DW Offset InitCommandX, Offset InitCommandY + DW Offset InitCommandZ, Offset InitNoCommand + DW Offset InitNoCommand, Offset InitNoCommand + DW Offset InitNoCommand, Offset InitNoCommand + +CommandTable Label Word + DW Offset NoCommand, Offset NoCommand + DW Offset NoCommand, Offset NoCommand + DW Offset CommandD, Offset CommandE + DW Offset CommandF, Offset CommandG + DW Offset CommandH, Offset CommandI + DW Offset CommandJ, Offset CommandK + DW Offset CommandL, Offset NoCommand + DW Offset CommandN, Offset NoCommand + DW Offset CommandP, Offset CommandQ + DW Offset CommandR, Offset CommandS + DW Offset CommandT, Offset CommandH + DW Offset NoCommand, Offset CommandW + DW Offset NoCommand, Offset CommandY + DW Offset NoCommand, Offset NoCommand + DW Offset NoCommand, Offset NoCommand + +VolumeEffectTable Label Word + DW Offset NoCommand, Offset NoCommand ; Last 2 of command + ; table + VolumeComA + ; and VolumeComB + DW Offset VolumeCommandC, Offset VolumeCommandD + DW Offset VolumeCommandE, Offset VolumeCommandF + DW Offset VolumeCommandG, Offset CommandH + + +RetrigOffsets Label + DW CommandQ_0, CommandQ_1, CommandQ_2, CommandQ_3 + DW CommandQ_4, CommandQ_5, CommandQ_6, CommandQ_7 + DW CommandQ_8, CommandQ_9, CommandQ_A, CommandQ_B + DW CommandQ_C, CommandQ_D, CommandQ_E, CommandQ_F + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Sound Driver Data ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +IF OLDDRIVER + DriverID DB "Impulse Tracker Sound Driver" +ELSE + DriverID DB "Impulse Tracker Advanced Sound Driver" +ENDIF + +ALIGN 2 +SoundDriverSegment DW 0 + +;******************* + +DriverVariableTable Label +DriverMaxChannels DW 32 +StopEndOfPlaySection DW 0 +DefaultChannels DW 32 +DriverFlags DW 0 ; Bit 1 = MIDI Out supported + ; Bit 2 = Hiqual + ; Bit 3 = Output waveform data available + +IF OLDDRIVER + DB 64 - ($ - DriverVariableTable) Dup (0) +ELSE + DB 16 - ($ - DriverVariableTable) Dup (0) +ENDIF + + +ALIGN 4 + +StartDriverFunctions Label +DriverDetectCard DD 0 +DriverInitSound DD 0 +DriverReinitSound DD 0 +DriverUninitSound DD 0 + +DriverPoll DD 0 + +DriverSetTempo DD 0 +DriverSetMixVolume DD 0 +DriverSetStereo DD 0 + +DriverLoadSample DD 0 +DriverReleaseSample DD 0 +DriverResetMemory DD 0 +DriverGetStatus DD 0 + +DriverSoundCardScreen DD 0 +DriverGetVariable DD 0 +DriverSetVariable DD 0 + +DriverMIDIOut DD 0 +DriverGetWaveform DD 0 + +EndDriverFunctions Label + +IF OLDDRIVER + DD 63-(EndDriverFunctions-StartDriverFunctions)/4 Dup (0) +ELSE + DD 31-(EndDriverFunctions-StartDriverFunctions)/4 Dup (0) +ENDIF + DW 0 + +DriverLength DW 0 + +DriverRequiredFunctions Label + DD DWord Ptr Update + DD DWord Ptr Music_GetSampleHeader + DD DWord Ptr Music_GetSampleLocation + DD DWord Ptr Music_FarUpdateSampleLocation + DD DWord Ptr E_GetEMSPageFrame + DD DWord Ptr E_SaveEMSPageFrame + DD DWord Ptr E_RestoreEMSPageFrame + DD DWord Ptr Music_GetTempo + DD DWord Ptr M_FunctionHandler + DD DWord Ptr SetInfoLine2 + DD DWord Ptr Music_SoundCardLoadAllSamples + DD DWord Ptr GlobalKeyList + DD DWord Ptr IdleUpdateInfoLine + DD DWord Ptr F_DrawHeader + DD DWord Ptr PE_FillHeader + DD DWord Ptr D_GotoStartingDirectory + DD DWord Ptr D_GetFileName + DD DWord Ptr D_SetDriveDirectoryFar + DD DWord Ptr Music_Stop + DD DWord Ptr GetEnvironment + DD DWord Ptr Music_GetSlaveChannelInformationTable + DD DWord Ptr RecalculateAllVolumes + DD DWord Ptr MIDIBufferEmpty + DD DWord Ptr MIDISend + DD DWord Ptr S_GetDestination + DD DWord Ptr S_DrawString + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Functions ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Command/Effect (call it what you like) information here!! ³ +;³ ³ +;³ For initialisation, DS:DI points to host channel data. ³ +;³ Registers for use: All except DS:DI & ES (points to SongDataSegment) ³ +;³ ³ +;³ For update, DS:DI points to host channel data. ³ +;³ Registers for use: AX, BX, DX, ES, SI ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Proc RecalculateAllVolumes Far + + Mov CX, NumChannels + Mov SI, Offset SlaveChannelInformationTable + +RecalculateAllVolumes1: + Or Byte Ptr [SI], 18 + + Add SI, SLAVECHANNELSIZE + Dec CX + JNZ RecalculateAllVolumes1 + + Ret + +EndP RecalculateAllVolumes + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc InitPlayInstrument ; BX = instrument offset + + Push ECX + + Mov [SI+30h], BX ; InsOffset + + Mov AL, [ES:BX+11h] ; NNA + Mov [SI+3Bh], AL + + Mov AX, [ES:BX+12h] ; DCT and DCA + Mov [SI+28h], AX + + Mov AX, [DI+0Ch] ; MCh and MPr + Test AL, AL + JZ InitPlayInstrumentNoMIDI + + Mov [SI+3Ch], AX + Mov AX, [ES:BX+3Eh] ; MidiBank + Mov [SI+3Eh], AX + Mov AL, [DI+3] + Mov [SI+0Bh], AL + +InitPlayInstrumentNoMIDI: + Mov DX, [DI+2Eh] ; ChannelVol=DH, Pan=DL + + Mov AL, [ES:BX+19h] ; Instrument pan + Mov [SI+23h], DH + + Test AL, 80h + JNZ AllocatePan1 + + Mov DL, AL + +AllocatePan1: + Push BX ; Check for sample pan + + Mov BL, [DI+0Fh] + And BX, 0FFh + JZ InitPlayInstrumentNoSamplePan + + Add BX, BX + Mov BX, [ES:64910+BX] ; BX = sample offset + Mov AL, [ES:BX+2Fh] + Test AL, AL + + JNS InitPlayInstrumentNoSamplePan + + And AL, 7Fh + Mov DL, AL + +InitPlayInstrumentNoSamplePan: + Pop BX + + Cmp DL, 100 + JE AllocatePanSurround + + Xor DH, DH + Mov AL, [DI+3] ; Note + Mov CX, [ES:BX+16h] ; Pitch pan separation + Sub AL, CH + IMul CL + + SAR AX, 3 + + Add AX, DX + JS AllocatePan2 + Cmp AX, 64 + JBE AllocatePan3 + + Mov AL, 64 + Jmp AllocatePan3 + +AllocatePan2: + Xor AL, AL + Jmp AllocatePan3 + +AllocatePanSurround: + Mov AL, 100 + +AllocatePan3: + Mov AH, AL + Xor ECX, ECX ; Envelope init + Mov [SI+2Ah], AX ; Write panning + + Mov [SI+58h], ECX + Mov [SI+5Ch], CX + Mov [SI+60h], ECX + Mov [SI+68h], ECX + Mov [SI+6Ch], CX + Mov [SI+70h], ECX + Mov [SI+78h], ECX + Mov [SI+7Ch], CX + Mov DWord Ptr [SI+50h], 400000h ; 64*65536 + + Mov AH, [ES:BX+1D4h] + Mov AL, [ES:BX+182h] + And AX, 101h + ShL AH, 1 + Or AH, AL + Mov AL, [ES:BX+130h] + ShL AH, 1 + And AL, 1 + Or AH, AL + ShL AH, 4 + Or AX, 133h + + Mov Word Ptr [SI], AX + + Push DI + + Mov DI, LastSlaveChannel + Test DI, DI + JZ InitInstrumentCarry + +InitInstrumentVolumeCarry: + Mov AL, [ES:BX+130h] + And AL, 9 + Cmp AL, 9 + JNE InitInstrumentPanCarry + +; Transfer volume data + Mov ECX, [DI+50h] + Mov EDX, [DI+54h] + Mov [SI+50h], ECX + Mov [SI+54h], EDX + Mov ECX, [DI+58h] + Mov DX, [DI+5Ch] + Mov [SI+58h], ECX + Mov [SI+5Ch], DX + +InitInstrumentPanCarry: + Mov AL, [ES:BX+182h] + And AL, 9 + Cmp AL, 9 + JNE InitInstrumentPitchCarry +; Transfer pan data + Mov ECX, [DI+60h] + Mov EDX, [DI+64h] + Mov [SI+60h], ECX + Mov [SI+64h], EDX + Mov ECX, [DI+68h] + Mov DX, [DI+6Ch] + Mov [SI+68h], ECX + Mov [SI+6Ch], DX + + +InitInstrumentPitchCarry: + Mov AL, [ES:BX+1D4h] + And AL, 9 + Cmp AL, 9 + JNE InitInstrumentCarry +; Transfer pitch data + Mov ECX, [DI+70h] + Mov EDX, [DI+74h] + Mov [SI+70h], ECX + Mov [SI+74h], EDX + Mov ECX, [DI+78h] + Mov DX, [DI+7Ch] + Mov [SI+78h], ECX + Mov [SI+7Ch], DX + +InitInstrumentCarry: + Pop DI + + Or Byte Ptr [DI], 80h ; Apply random volume/pan + + Cmp Byte Ptr [DI+0Ch], 0 + JNE InitPlayInstrumentNoSample + + Push BX + Mov BX, [ES:BX+3Ah] ; Initial filter cutoff +; If IFC bit 7 == 1, then set filter cutoff + + Mov Word Ptr [SI+3Eh], 0FFh + +; Test BL, 8080h +; JNZ InitPlayInstrumentFilter +; +;; No filters, reset devices. +; Mov BL, 7Fh +; Call SetFilterCutoff +; Xor BL, BL +; Call SetFilterResonance +; +; Jmp InitPlayInstrumentFilterResonance +; +;InitPlayInstrumentFilter: + Test BL, BL + JNS InitPlayInstrumentFilterCutoff + + And BL, 7Fh +; Mov [SI+3Eh], BL + Call SetFilterCutoff + +InitPlayInstrumentFilterCutoff: +; If IFR bit 7 == 1, then set filter resonance + Test BX, BX + JNS InitPlayInstrumentFilterResonance + + Mov BL, BH + And BL, 7Fh + Mov [SI+3Fh], BL + Call SetFilterResonance + +InitPlayInstrumentFilterResonance: + Pop BX + +InitPlayInstrumentNoSample: + Pop ECX + + Ret + +EndP InitPlayInstrument + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ApplyRandomValues + + Mov SI, [DI+24h] + Mov BX, [SI+30h] + + And Byte Ptr [DI], Not 80h + + Call Random ; AL = -128->+127 + + Mov AH, [ES:BX+1Ah] ; Random volume, 0->100 + Test AH, AH + JZ RandomVolumeEnd + + IMul AH ; AX = -12800->12700 + SAR AX, 6 ; AX = -200->+198(.4) + Inc AX ; AX = -199->+199 + + MovZX DX, Byte Ptr [SI+24h] ; Sample volume set + Mov CX, 199 + Push DX + IMul DX ; AX = -199*128->199*128 + ; AX = -25472->25472 + + IDiv CX ; AX = -128->+128 + Pop CX + Add AX, CX + + Cmp AX, 0 + JL RandomVolume3 + Cmp AX, 128 + JG RandomVolume4 + + Mov [SI+24h], AL + Jmp RandomVolumeEnd + +RandomVolume3: + Mov Byte Ptr [SI+24h], 0 + Jmp RandomVolumeEnd + +RandomVolume4: + Mov Byte Ptr [SI+24h], 128 + +RandomVolumeEnd: + Call Random ; AL = -128->+127 + + Mov AH, [ES:BX+1Bh] ; Random pan, 0->64 + Test AH, AH + JZ RandomPanEnd + + Xor DX, DX + IMul AH ; AX = -64*128->64*127, -8192->8128 + Mov DL, [SI+2Ah] + SAR AX, 7 + Cmp DL, 100 + JE RandomPanEnd + Add DX, AX + JS RandomPan1 + Cmp DX, 64 + JA RandomPan2 + + Mov DH, DL + Mov [SI+2Ah], DX + Ret + +RandomPan2: + Mov Word Ptr [SI+2Ah], 4040h + Ret + +RandomPan1: + Mov Word Ptr [SI+2Ah], 0 + +RandomPanEnd: + Ret + +EndP ApplyRandomValues + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +LastMIDIByte DB 0FFh + +Proc MIDISendFilter + + Test CS:DriverFlags, 1 + JZ MIDISendFilter2 + + Test AL, AL + JNS MIDISendFilter1 + Cmp AL, 0F0h + JAE MIDISendFilter1 + + Cmp AL, CS:LastMIDIByte + JE MIDISendFilter2 + + Mov CS:LastMIDIByte, AL + +MIDISendFilter1: + Call DriverMIDIOut + +MIDISendFilter2: + Ret + +EndP MIDISendFilter + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SetFilterCutoff ; Given BL = filtervalue. + ; Assumes that channel is non-disowned + + Push DI + + Mov DI, [SI+38h] + + Mov AL, 0F0h + Call MIDISendFilter + Mov AL, 0F0h + Call MIDISendFilter + Xor AL, AL + Call MIDISendFilter + Mov AL, BL + Call MIDISendFilter + + Pop DI + Ret + +EndP SetFilterCutoff + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SetFilterResonance ; Given BL = filtervalue. + ; Assumes that channel is non-disowned + + Push DI + + Mov DI, [SI+38h] + + Mov AL, 0F0h + Call MIDISendFilter + Mov AL, 0F0h + Call MIDISendFilter + Mov AL, 1 + Call MIDISendFilter + Mov AL, BL + Call MIDISendFilter + + Pop DI + Ret + +EndP SetFilterResonance + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +MIDIPitchDepthSent DW 0 + +Proc MIDITranslate ; Assumes DS:SI points to slave + ; And DS:DI points to host. + ; BX = offset of MIDI command to interpret + + Assume DS:Music + + Test DriverFlags, 1 + JZ MIDITranslateEnd + + PushA + + Cmp BX, 0F000h + JB MIDITranslateParameterised + +; Internal MIDI commands. + + Test Byte Ptr [ES:2Ch], 64 ; Do pitch wheel? + JZ MIDITranslateInternalEnd + +; Pitch wheel +; Formula is: Depth = 16384*12 / PitchWheelDepth * log2(Freq / OldFreq) +; Do calculation, check whether pitch needs to be sent. + + Xor EAX, EAX + Mov AL, [ES:35h] ; AL = PWD + + Test AL, AL ; No depth! + JZ MIDITranslateInternalEnd + + Mov DWord Ptr [ChannelCountTable+200], EAX ; scratch area + +IFE USEFPUCODE ; If FPU code is being used, FP registers are already saved + FNSave [ChannelCountTable] ; Scratch area + FNInit +ENDIF + FLd [PitchDepthConstant] + FIDiv DWord Ptr [ChannelCountTable+200] + FILd DWord Ptr [SI+10h] ; Current pitch + FIDiv DWord Ptr [SI+1Ch] ; Original pitch + FYL2X + FIStP DWord Ptr [ChannelCountTable+200] +IFE USEFPUCODE + FRstor [ChannelCountTable] +ENDIF + +; OK.. [ChannelCountTable] contains pitch depth. +; Have to check: +; a) Within ranges? +; b) Comparison to old pitch for this channel + + Mov CL, [SI+3Ch] + Mov AX, 1 + Dec CL + JS MIDITranslateInternalEnd + + Cmp DWord Ptr [ChannelCountTable+200], 0 + JE MIDIPitchDepthSent1 + + ShL AX, CL + Test MIDIPitchDepthSent, AX + JNZ MIDIPitchDepthSent1 + + Or MIDIPitchDepthSent, AX + +; Send MIDI Pitch depth stuff + + Push SI + + Mov AL, 0B0h + Or AL, CL + Call MIDISendFilter + + Mov DX, 5 + Mov SI, Offset MIDIPitchSendString + +Music_SendPitchDepth1: + LodsB + Call MIDISendFilter + Dec DX + JNZ Music_SendPitchDepth1 + + Pop SI + + Mov AL, [ES:35h] + Call MIDISendFilter + +MIDIPitchDepthSent1: + Mov EAX, DWord Ptr [ChannelCountTable+200] + Add EAX, 2000h + JNS PitchRange1 + + Xor EAX, EAX + +PitchRange1: + Cmp EAX, 4000h + JL PitchRange2 + + Mov AX, 3FFFh + +PitchRange2: + Mov BL, [SI+3Ch] ; BL = channel + And BX, 0FFh + Add BX, BX + Cmp [MIDIPitch+BX-2], AX + JE MIDITranslateInternalEnd + + Mov [MIDIPitch+BX-2], AX + +; Output pitch change + + Mov AL, 0E0h + Or AL, CL + + Call MIDISendFilter ; Ec command + + Mov AL, Byte Ptr [MIDIPitch+BX-2] + And AL, 7Fh + Call MIDISendFilter + + Mov AX, [MIDIPitch+BX-2] + ShR AX, 7 + And AL, 7Fh + Call MIDISendFilter + +MIDITranslateInternalEnd: + PopA + Ret + +; Now for user input MIDI stuff. + +MIDITranslateParameterised: + Push FS + + Xor AX, AX + Xor CX, CX + Mov FS, MIDIDataArea + +MIDITranslate1: + Mov AH, [FS:BX] + Inc BX + Test AH, AH + JZ MIDITranslate2 + + Cmp AH, ' ' ; Interpretation time. + JNE MIDITranslateNoSpace + + Test CX, CX + JZ MIDITranslate1 + Jmp MIDITranslateSend + +MIDITranslateNoSpace: + Sub AH, '0' + JC MIDITranslate1 + Cmp AH, 9 + JA MIDITranslateValue1 + + ShL AL, 4 + Or AL, AH + Inc CX + Jmp MIDITranslateValueEnd + +MIDITranslateValue1: + Sub AH, 'A'-'0' + JC MIDITranslate1 + Cmp AH, 'F'-'A' + JA MIDITranslateValue2 + + ShL AL, 4 + Add AH, 10 + Or AL, AH + Inc CX + Jmp MIDITranslateValueEnd + +MIDITranslateValue2: + Sub AH, 'a'-'A' + JC MIDITranslate1 + Cmp AH, 'z'-'a' + JA MIDITranslate1 + + Cmp AH, 'c'-'a' + JNE MIDITranslateValue3 + + Test SI, SI + JZ MIDITranslate1 + +; Mov AH, [DI+0Ch] + Mov AH, [SI+3Ch] + ShL AL, 4 + Dec AH + Or AL, AH + Inc CX + Jmp MIDITranslateValueEnd + +MIDITranslateValue3: + Test CX, CX + JZ MIDITranslateValue4 + + Call MIDISendFilter + + Xor CX, CX + +MIDITranslateValue4: + Mov AL, [DI+7] ; Effect. + Cmp AH, 'z'-'a' ; Zxx? + JE MIDITranslateSend + + Mov AL, [DI+12h] + Cmp AH, 'o'-'a' + JE MIDITranslateSend + + Test SI, SI + JZ MIDITranslate1 + + Mov AL, [SI+32h] ; [DI+0Eh] + Cmp AH, 'n'-'a' ; Note? + JE MIDITranslateSend + + Mov AL, [SI+0Bh] + Cmp AH, 'm'-'a' + JE MIDITranslateSend + + Cmp AH, 'v'-'a' ; Velocity? + JNE MIDITranslateValue7 + + Xor AL, AL + Test Word Ptr [SI], 800h + JNZ MIDITranslateSend + + Mov AL, [SI+22h] ; 0->2^6 + Xor DX, DX + Mul GlobalVolume ; 0->2^13 + Mov DL, [SI+23h] ; Channel volume + Mul DX ; 0->2^19 + SHRD AX, DX, 4 ; 0->2^15 + Mov DL, [SI+24h] ; Sample & Instrument Volume + Mul DX ; 0->2^22 + SHRD AX, DX, 15 ; 0->2^7 + Sub AL, 1 + AdC AL, 1 ; 1->2^7 + JNS MIDITranslateSend + Dec AX +; Mov AL, 7Fh + Jmp MIDITranslateSend + +Comment ~ + Mov AL, [SI+22h] ; 0->64 + Add AL, AL ; 0->128 + Sub AL, 1 + AdC AL, 1 ; 1->128 + Cmp AL, 128 + JB MIDITranslateSend + Dec AX + Jmp MIDITranslateSend +~ + +MIDITranslateValue7: + Cmp AH, 'u'-'a' ; Volume? + JNE MIDITranslateValue8 + + Xor AL, AL + Test Word Ptr [SI], 800h + JNZ MIDITranslateSend + + Mov AL, [SI+20h] ; 0->128 + Sub AL, 1 + AdC AL, 1 ; 1->128 + Cmp AL, 128 + JB MIDITranslateSend + Dec AX + Jmp MIDITranslateSend + +MIDITranslateValue8: + Mov AL, [SI+3Ah] ; HCN + And AL, 7Fh + Cmp AH, 'h'-'a' + JE MIDITranslateSend + + Mov AL, [SI+2Ah] ; Pan set + Cmp AH, 'x'-'a' + JE MIDITranslatePanValue + + Mov AL, [SI+25h] ; Final pan + Cmp AH, 'y'-'a' + JE MIDITranslatePanValue + + Mov AL, [SI+3Dh] + Cmp AH, 'p'-'a' ; Program? + JE MIDITranslateSend + + Mov DX, [SI+3Eh] + Mov AL, DL + Add AL, 1 + AdC AX, 0 + Dec AX + Cmp AH, 'b'-'a' + JE MIDITranslateSend + + Mov AL, DH + Add AL, 1 + AdC AX, 0 + Dec AX + Cmp AH, 'a'-'a' + JE MIDITranslateSend + + Xor AX, AX + Jmp MIDITranslate1 + +MIDITranslatePanValue: + Add AL, AL + Cmp AL, 7Fh + JBE MIDITranslateSend + Dec AX + Cmp AL, 7Fh + JBE MIDITranslateSend + Mov AL, 40h + Jmp MIDITranslateSend + +MIDITranslateValueEnd: + Cmp CL, 2 + JB MIDITranslate1 + +MIDITranslateSend: + Call MIDISendFilter + + Xor AX, AX + Xor CX, CX + Jmp MIDITranslate1 + +MIDITranslate2: + Test CX, CX + JZ MIDITranslate3 + + Call MIDISendFilter + +MIDITranslate3: + Pop FS + PopA + +MIDITranslateEnd: + Ret + +EndP MIDITranslate + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc AllocateChannel ; Returns SI. Carry set if problems + Assume DS:Music + + Push CX + Mov LastSlaveChannel, 0 + + Test Byte Ptr [ES:2Ch], 4 + JNZ AllocateChannel1 + +AllocateChannel15: ; Sample handler + MovZX SI, Byte Ptr [DI+20h] + Mov AX, SI + ShL SI, 7 ; SLAVECHANNELSIZE + Add SI, Offset SlaveChannelInformationTable + + Test Byte Ptr CS:DriverFlags, 2 + JZ AllocateChannelHiQual1 + Test Byte Ptr [SI], 1 ; Channel on? + JZ AllocateChannelHiQual1 + +; copy out channel + Push CX + Push SI + Push DI + Push ES + + Push DS + Pop ES + + Or Word Ptr [SI], 200h + Or Byte Ptr [SI+3Ah], 80h + + LEA DI, [SI+64*SLAVECHANNELSIZE] + Mov CX, SLAVECHANNELSIZE/4 + Rep MovsD + + Pop ES + Pop DI + Pop SI + Pop CX + +AllocateChannelHiQual1: + Mov [DI+24h], SI + Mov [SI+38h], DI + Mov [SI+3Ah], AL + Mov Word Ptr [SI], 133h ; Recalc freq,vol&pan Channel on. + + Mov AX, [DI+2Eh] ; ChannelVol=AH, Pan=AL + Mov [SI+23h], AH + Mov AH, AL + Mov [SI+2Ah], AX + ; Get sample offset. +AllocateChannel3: ; General stuff. + Pop CX + + Mov Word Ptr [SI+26h], 0400h ; FadeOut + Mov Word Ptr [SI+52h], 64 + Mov Word Ptr [SI+3Eh], 0FFh ; Filter cutoff + + Mov AX, [DI+3] + Mov [SI+32h], AX ; Nte&Ins + + Mov BL, [DI+0Fh] + And BX, 0FFh + JZ AllocateChannel21 + Dec BX + + Call I_TagSample + + Mov [SI+36h], BL + + Add BX, BX + Mov BX, [ES:64912+BX] + Mov [SI+34h], BX ; Sample memory offset. + + Xor EAX, EAX + Mov [SI+18h], EAX ; Reset vibrato info. + Mov Word Ptr [SI+62h], AX ; No pan deviation + Mov Word Ptr [SI+72h], AX ; No pitch deviation + Mov Byte Ptr [SI+0Bh], AL ; Reset loop dirn + + Cmp [ES:BX+30h], EAX ; No sample! + JE AllocateChannel21 + + Mov AX, [ES:BX+11h] + Test AH, 1 + JZ AllocateChannel21 ; No sample! + + And AH, 2 + Add AL, AL + Mov [SI+18h], AH + Mov [SI+24h], AL ; Sample volume + + ClC + Ret + +AllocateChannel21: + Mov Word Ptr [SI], 200h + And CH, Not 4 + StC + Ret + +AllocateChannel5: + Pop CX + StC + Ret + +AllocateChannel1: ; Instrument handler! + Mov DX, NumChannels + + Mov AllocateSlaveOffset, Offset SlaveChannelInformationTable + Mov AllocateNumChannels, DX + + Mov BX, MAXSLAVECHANNELS + Cmp Byte Ptr [DI+0Fh], 101 + JNE AllocateChannelNoMIDI + Cmp DX, BX + JE AllocateChannelNoMIDI + + Sub BX, DX ; CX = number of channels remaining + ShL DX, 7 + Mov AllocateNumChannels, BX + Add DX, Offset SlaveChannelInformationTable + Mov AllocateSlaveOffset, DX + +AllocateChannelNoMIDI: + Mov BL, [DI+4] + + Cmp BL, 0FFh + JE AllocateChannel15 + + And EBX, 0FFh + JZ AllocateChannel5 + + Call I_TagInstrument + + Mov BX, [ES:64710+EBX*2] ; ES:BX points to instrument + + Test CH, 4 ; Test Byte Ptr [DI], 4 + JZ AllocateChannel8 + ; New note action handling... + Mov SI, [DI+24h] + + Cmp [SI+30h], BX + JNE AllocateLastChannelDifferentInstrument + + Mov LastSlaveChannel, SI + +AllocateLastChannelDifferentInstrument: + Mov AL, [SI+3Bh] + + Test AL, AL + JZ AllocateChannel20 ; Notecut. + + Or Byte Ptr [SI+3Ah], 80h ; Disown channel + +AllocateHandleNNA: + Cmp Byte Ptr [SI+22h], 0 ; Is volume set = 0? + JE AllocateChannel20 + Cmp Byte Ptr [SI+23h], 0 ; Is channel volume = 0? + JE AllocateChannel20 + Cmp Byte Ptr [SI+24h], 0 ; Is sample volume = 0? + JE AllocateChannel20 + + Cmp AL, 2 + JB AllocateChannel8 ; Note continue + JE AllocateChannel14 ; Note off. + + ; AL = 3 -> Fade + Or Byte Ptr [SI], 8 ; Fade flag. + Jmp AllocateChannel8 + +AllocateChannel14: + Or Byte Ptr [SI], 4 ; Note off.. + + Push BX + Call GetLoopInformation + Pop BX + + Jmp AllocateChannel8 + +AllocateChannel20MIDI: + Or Word Ptr [SI], 200h + Or Byte Ptr [SI+3Ah], 80h ; Disown channel + + Cmp Byte Ptr [DI+0Fh], 101 + JNE AllocateChannel4 ; Sample.. + +AllocateChannelMIDIDC: + Mov SI, AllocateSlaveOffset + Mov CX, AllocateNumChannels + + Mov DL, [DI+0Eh] + Mov DH, [DI+4] + Mov BP, 32h + Mov AH, [DI+0Ch] + Mov CH, [ES:BX+13h] ; CH = DCA + Jmp AllocateChannel6 + +AllocateChannel20: + Cmp Byte Ptr [SI+36h], 100 ; MIDI? + JE AllocateChannel20MIDI + +AllocateChannel20Samples: + Test Byte Ptr CS:DriverFlags, 2 + JNZ AllocateChannelHiQual + + Mov AL, [ES:BX+12h] + Mov Word Ptr [SI], 200h + Test AL, AL + JZ AllocateChannelInstrument + Jmp AllocateChannel11 + +AllocateChannelHiQual: + Or Word Ptr [SI], 200h + Or Byte Ptr [SI+3Ah], 80h ; Disown channel + Jmp AllocateChannel4 + +AllocateChannel8: + Cmp Byte Ptr [DI+0Fh], 101 + JE AllocateChannelMIDIDC + + Mov AL, [ES:BX+12h] + Test AL, AL + JZ AllocateChannel4 ; Duplicate check off. + +AllocateChannel11: ; Duplicate check... + Mov SI, AllocateSlaveOffset + Mov CX, AllocateNumChannels + + Mov DX, [DI+3] ; DX = note + Mov BP, 32h + Cmp AL, 1 + JE AllocateDCT + + Mov BP, 33h ; Duplicate instrument + Mov DL, DH + Cmp AL, 3 + JE AllocateDCT + + Mov BP, 36h ; Duplicate sample + Mov DL, [DI+0Fh] + Dec DL + JS AllocateChannel4 + +AllocateDCT: + Mov AH, [DI+20h] ; AH = HCN + Or AH, 80h + Mov CH, [ES:BX+13h] ; CH = DCA + +AllocateChannel6: + Test Byte Ptr [SI], 1 + JZ AllocateChannel7 + + Cmp Byte Ptr [DI+0Fh], 101 + JE AllocateChannelMIDIDCT + + Mov AL, [SI+3Ah] ; AL = HCN of slave. + Cmp AH, AL + JNE AllocateChannel7 + ; OK. same channel... now.. + +AllocateChannelMIDIDCT: + Cmp DH, [SI+33h] ; Same inst? + JNE AllocateChannel7 + + Cmp DL, [DS:SI+BP] ; Same note/sample/inst? + JNE AllocateChannel7 + + Cmp Byte Ptr [DI+0Fh], 101 ; New note is a MIDI? + JE AllocateChannelMIDIHandling + + Cmp CH, [SI+29h] + JNE AllocateChannel7 + + Test CH, CH ; Checks for hiqual + JZ AllocateChannel20Samples + + Mov Word Ptr [SI+28h], 0 + Mov AL, CH + Inc AX + Jmp AllocateHandleNNA + +AllocateChannelMIDIHandling: + Cmp Byte Ptr [SI+36h], 100 ; Is current channel a MIDI chan + JNE AllocateChannel7 + + Cmp AH, [SI+3Ch] + JNE AllocateChannel7 + + Or Word Ptr [SI], 200h + Test Byte Ptr [SI+3Ah], 80h + JNZ AllocateChannel7 + + Mov BP, [SI+38h] + Or Byte Ptr [SI+3Ah], 80h + And Byte Ptr [DS:BP], Not 4 + +AllocateChannel7: + Add SI, SLAVECHANNELSIZE + Dec CL + JNZ AllocateChannel6 + +AllocateChannel4: + Mov CX, AllocateNumChannels + Mov SI, AllocateSlaveOffset + + Cmp Byte Ptr [DI+0Fh], 101 + JNE AllocateChannel10 + +; MIDI 'slave channels' have to be maintained if still referenced + + Push DI + +AllocateMIDIChannel1: + Test Byte Ptr [SI], 1 + JNZ AllocateMIDIChannel2 + + ; Have a channel.. check that it's host's slave isn't SI + Mov DI, [SI+38h] + Test DI, DI + JZ AllocateMIDIChannelFound + Cmp SI, [DI+24h] + JNE AllocateMIDIChannelFound + +AllocateMIDIChannel2: + Add SI, SLAVECHANNELSIZE + Dec CX + JNZ AllocateMIDIChannel1 + + Pop DI + + Jmp AllocateChannel17 + +AllocateChannel10: + Test Byte Ptr [SI], 1 + JZ AllocateChannelInstrument + + Add SI, SLAVECHANNELSIZE + Dec CX + JNZ AllocateChannel10 + +AllocateChannel17: ; Common sample search + Push BX + Push DI + Push ES + + Push CS + Pop ES + + Mov DI, Offset ChannelCountTable + Xor AX, AX + Mov CX, (100+200)/2 + Rep StosW ; Clear table + Dec AX + Mov CX, 100/2 ; Volumes + Rep StosW + + Pop ES + + Mov CX, AllocateNumChannels + Xor EBX, EBX + Mov DI, AllocateSlaveOffset + +AllocateChannelCommonSample1: + Mov BL, [DI+36h] ; BX = sample pointer into + ; table. + Cmp BL, 99 ; Just for safety + JA AllocateChannelCommonSample2 + + Inc Byte Ptr [ChannelCountTable+BX] + + Mov AH, [ChannelCountTable+BX+300] ; Volume + + Test Byte Ptr [DI+3Ah], 80h ; Disowned channel? + JZ AllocateChannelCommonSample2 + + Cmp AH, [DI+20h] ; Lower Volume? + JBE AllocateChannelCommonSample2 + + Mov AH, [DI+20h] ; Get volume + Mov Word Ptr [ChannelCountTable+EBX+EBX+100], DI ; Store location + Mov [ChannelCountTable+BX+300], AH ; Store volume + +AllocateChannelCommonSample2: + Add DI, SLAVECHANNELSIZE + Dec CX + JNZ AllocateChannelCommonSample1 + + ; OK.. now search table for maximum + ; occurrence of sample... + + Xor EDI, EDI + Xor SI, SI + Mov AH, 2 ; Find maximum count, has to be + ; greater than 2 channels + Mov CX, 100 + +AllocateChannelCommonSample3: + Cmp AH, [ChannelCountTable+DI] + JAE AllocateChannelCommonSample4 + + Mov AH, [ChannelCountTable+DI] + Mov SI, Word Ptr [ChannelCountTable+EDI+EDI+100] + +AllocateChannelCommonSample4: + Inc DI + Dec CX + JNZ AllocateChannelCommonSample3 + + Pop DI + Pop BX + +; Inc AllocateCount1 + + Test SI, SI + JNZ AllocateChannelInstrument + +; Dec AllocateCount1 + + ; Find out which host channel has the most + ; (disowned) slave channels + ; Then find the softest non-single sample + ; in that channel. + Push BX + + Push ES + Push DI + + Push CS + Pop ES + Mov DI, Offset ChannelCountTable + Xor AX, AX + Mov CX, 32 + Rep StosW + + Pop DI + Pop ES + + Xor BX, BX + Mov CX, AllocateNumChannels + Mov SI, AllocateSlaveOffset + +AllocateChannelCount1: + Mov BL, [SI+3Ah] ; Host channel number + And BL, 3Fh + Inc Byte Ptr [ChannelCountTable+BX] + +AllocateChannelCount2: + Add SI, SLAVECHANNELSIZE + Dec CX + JNZ AllocateChannelCount1 + +AllocateChannelCountEnd: + ; OK.. search through and find + ; the most heavily used channel + + Mov AX, 100h ; AH = channel count + Xor BX, BX ; AL = channel + Mov CX, 64 ; 64 = physical channels + +AllocateChannelCountSearch1: + Cmp AH, [BX+ChannelCountTable] + JAE AllocateChannelCountSearch2 + + Mov AH, [BX+ChannelCountTable] + Mov AL, BL + +AllocateChannelCountSearch2: + Inc BX + Dec CX + JNZ AllocateChannelCountSearch1 + + Pop BX + + ; AH = channel to use. + Cmp AH, 1 + JBE AllocateChannelSoftestSearch + + Or AL, 80h ; Search for disowned only + + Push BX + Push DI + + Mov BH, [DI+0Fh] + Dec BH + + Mov CX, AllocateNumChannels + Mov DI, AllocateSlaveOffset + Xor SI, SI ; Offset + Mov AH, 0FFh + +AllocateChannelNonSingle1: + Cmp AL, [DI+3Ah] + JNE AllocateChannelNonSingle3 + + Cmp AH, [DI+20h] ; Lower Volume? + JBE AllocateChannelNonSingle3 + + ; Now check if any other + ; channel contains this + ; sample + Cmp BH, [DI+36h] + JE AllocateChannelNonSingle6 + + Push CX + Push SI + + Mov BL, [DI+36h] ; Sample number + Mov Byte Ptr [DI+36h], 0FFh + + Mov SI, AllocateSlaveOffset + Mov CX, AllocateNumChannels + +AllocateChannelNonSingle2: + Cmp BH, [SI+36h] + JE AllocateChannelNonSingle5 + + Cmp BL, [SI+36h] ; A second sample? + JE AllocateChannelNonSingle5 + +AllocateChannelNonSingle4: + Add SI, SLAVECHANNELSIZE + Dec CX + JNZ AllocateChannelNonSingle2 + + Mov [DI+36h], BL + + Pop SI + Pop CX + Jmp AllocateChannelNonSingle3 + +AllocateChannelNonSingle5: + Mov [DI+36h], BL + + Pop SI + Pop CX + +AllocateChannelNonSingle6: ; OK found a second sample. + Mov SI, DI ; get offset. + Mov AH, [DI+20h] ; Get volume + +AllocateChannelNonSingle3: + Add DI, SLAVECHANNELSIZE + Dec CX + JNZ AllocateChannelNonSingle1 + + Pop DI + Pop BX + + Test SI, SI + JNZ AllocateChannelSampleSearch +; JNZ AllocateChannelInstrument + + Push BX + Mov SI, AX + And SI, 03Fh + Mov Byte Ptr [ChannelCountTable+SI], 0 + Jmp AllocateChannelCountEnd ; Next cycle... + +AllocateChannelSampleSearch: +; Inc AllocateCount2 + + Push DI + + Mov AL, [SI+36h] + + Mov CX, AllocateNumChannels + Mov DI, AllocateSlaveOffset + Mov AH, 0FFh + +AllocateChannelSampleSearch1: + Cmp AL, [DI+36h] ; Same sample? + JNE AllocateChannelSampleSearch2 + + Test Byte Ptr [DI+3Ah], 80h ; Disowned channel? + JZ AllocateChannelSampleSearch2 + + Cmp AH, [DI+20h] ; Lower Volume? + JBE AllocateChannelSampleSearch2 + + Mov SI, DI ; get offset. + Mov AH, [DI+20h] ; Get volume + +AllocateChannelSampleSearch2: + Add DI, SLAVECHANNELSIZE + Dec CX + JNZ AllocateChannelSampleSearch1 + + Pop DI + + Jmp AllocateChannelInstrument + +AllocateChannelSoftestSearch: + Push DI ; Now search for softest + ; disowned sample + ; (not non-single) + + Mov CX, AllocateNumChannels + Mov DI, AllocateSlaveOffset + Xor SI, SI ; Offset + Mov AH, 0FFh + +AllocateChannel18: + Test Byte Ptr [DI+3Ah], 80h ; Disowned??? + JZ AllocateChannel19 ; No.. then look for next + + Cmp AH, [DI+20h] ; Volume set... + JB AllocateChannel19 + + Mov SI, DI ; get offset. + Mov AH, [DI+20h] ; Get volume + +AllocateChannel19: + Add DI, SLAVECHANNELSIZE + Dec CX + JNZ AllocateChannel18 + + Pop DI + +; Inc AllocateCount3 + + Test SI, SI + JNZ AllocateChannelInstrument + + Pop CX + And CH, Not 4 + + StC + Ret + +AllocateMIDIChannelFound: + Pop DI + +AllocateChannelInstrument: + Mov [DI+24h], SI ; SCOffset + + Mov AL, [DI+20h] + Mov [SI+3Ah], AL ; HCN + + Mov [SI+38h], DI ; HCOffset + + Xor EAX, EAX + Mov [SI+18h], EAX ; Reset vibrato info. + Mov Byte Ptr [SI+0Bh], AL ; Reset loop dirn + + Call InitPlayInstrument + + Mov AL, [ES:BX+18h] + Mov [SI+24h], AL + + Pop CX + + Mov Word Ptr [SI+26h], 0400h ; FadeOut, VolEnv&Pos + + Mov AX, [DI+3] + Cmp Byte Ptr [DI+0Fh], 101 + JNE NoMIDINote + + Mov AL, [DI+0Eh] + +NoMIDINote: + Mov [SI+32h], AX ; Nte&Ins + + Mov BL, [DI+0Fh] + And BX, 0FFh + JZ AllocateChannel21 + Dec BX + + Call I_TagSample + + Mov [SI+36h], BL + + Add BX, BX + Mov BX, [ES:64912+BX] + Mov [SI+34h], BX ; Sample memory offset. + + Cmp DWord Ptr [ES:BX+30h], 0 + JE AllocateChannelInstrument2 ; No sample! + + Mov AX, [ES:BX+11h] + Test AH, 1 + JZ AllocateChannelInstrument2 ; No sample! + + And AH, 2 + Mov [SI+18h], AH + + Mul Byte Ptr [SI+24h] + ShR AX, 6 + Mov [SI+24h], AL ; SI = 0->128 + + ClC + Ret + +AllocateChannelInstrument2: + Mov Word Ptr [SI], 200h + And CH, Not 4 + StC + Ret + +EndP AllocateChannel + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Seed1 DW 1234h +Seed2 DW 5678h + +Proc Random + + Push BX + Push CX + Push DX + + Mov AX, Seed1 + Mov BX, Seed2 + Mov CX, BX + Mov DX, BX + + Add AX, BX + Rol AX, CL + Xor AX, DX + XChg CL, CH + Add BX, CX + Add DX, BX + Add CX, AX + Ror BX, 1 + SBB AX, DX + Mov Seed2, DX + Mov Seed1, AX + + Pop DX + Pop CX + Pop BX + + Ret + +EndP Random + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetLoopInformation + ; Destroys AX, BX, CX, DX + Mov BX, [SI+34h] ; ES:BX points to sample header + Mov AL, [ES:BX+12h] ; AL = sample flags + + Test AL, 30h ; Loop?? + JZ GetLoopInformation4 + + Mov ECX, [ES:BX+34h] ; CX = loopbeg + Mov EDX, [ES:BX+38h] ; DX = loopend + + Mov AH, AL + + Test AL, 20h ; SusLoop? + JZ GetLoopInformation2 + + Test Byte Ptr [SI], 4 + JNZ GetLoopInformation1 + + Mov ECX, [ES:BX+40h] + Mov EDX, [ES:BX+44h] + ShR AH, 1 + Jmp GetLoopInformation2 + +GetLoopInformation1: + Test AL, 10h + JZ GetLoopInformation4 + +GetLoopInformation2: + Test AH, 40h + JNZ GetLoopInformation3 + + Mov AH, 8 + Jmp GetLoopInformation5 + +GetLoopInformation3: + Mov AH, 24 + Jmp GetLoopInformation5 + +GetLoopInformation4: + Xor ECX, ECX + Mov EDX, [ES:BX+30h] + Mov AH, 0 + +GetLoopInformation5: + Cmp [SI+0Ah], AH + JNE GetLoopInformation6 + Cmp [SI+40h], ECX + JNE GetLoopInformation6 + Cmp [SI+44h], EDX + JNE GetLoopInformation6 + + Ret + +GetLoopInformation6: + Mov [SI+0Ah], AH + Mov [SI+40h], ECX + Mov [SI+44h], EDX + Or Word Ptr [SI], 400h ; Loop changed. + + Ret + +EndP GetLoopInformation + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +include it_m_eff.inc + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PitchSlideDown ; Expects SI to slave + ; BX = slide value + Assume DS:Music + +IF USEFPUCODE + Neg BX + +EndP PitchSlideDown ; EndP for PitchSlideDown + +ELSE + Test Byte Ptr [ES:2Ch], 8 + JNZ PitchSlideDownLinear + ; Go on to amiga slide down. +EndP PitchSlideDown + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PitchSlideDownAmiga + + Or Byte Ptr [SI], 32 ; recalculate pitch! + + Mov EAX, [SI+10h] + MovZX EBX, BX + Mul EBX ; EDX:EAX = cmd*InitialFreq + + Xor CX, CX ; CX = counter. + + Add EAX, 1712*8363 + AdC EDX, 0 + JZ PitchSlideDownAmiga1 + +PitchSlideDownAmiga2: + ShR EDX, 1 + RCR EAX, 1 + Inc CX + + Test EDX, EDX + JNZ PitchSlideDownAmiga2 + +PitchSlideDownAmiga1: + Mov EBX, EAX ; EBX = 1712*8363+Cmd*InitialFreq + + Mov EAX, 8363*1712 + Mul DWord Ptr [SI+10h] + + JCXZ PitchSlideDownAmiga4 + +PitchSlideDownAmiga5: + ShR EDX, 1 + RCR EAX, 1 + Loop PitchSlideDownAmiga5 + +PitchSlideDownAmiga4: + Cmp EBX, EDX + JBE PitchSlideDownAmiga3 + + Div EBX + + Mov [SI+10h], EAX + +PitchSlideDownAmiga3: + Ret + +EndP PitchSlideDownAmiga + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PitchSlideDownLinear +; Given BX = slide down value = 0->1024 + + Or Byte Ptr [SI], 32 ; recalculate pitch! + + Push DI + Mov DI, Offset LinearSlideDownTable + + Cmp BX, 0Fh + JA PitchSlideDownLinear1 + + Mov DI, Offset FineLinearSlideDownTable + Add BX, BX + Jmp PitchSlideDownLinear2 + +PitchSlideDownLinear1: + ShR BX, 1 + And BX, Not 1 + +PitchSlideDownLinear2: + MovZX EAX, Word Ptr [DI+BX] + Mul DWord Ptr [SI+10h] + SHRD EAX, EDX, 16 + + Mov [SI+10h], EAX + + Pop DI + Ret + +EndP PitchSlideDownLinear + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +ENDIF ; USEFPUCODE + +Proc PitchSlideUp ; Expects SI to slave + ; BX = slide value + Test Byte Ptr [ES:2Ch], 8 + JZ PitchSlideUpAmiga + ; Go on to linear slide + +EndP PitchSlideUp + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PitchSlideUpLinear + +IF USEFPUCODE + Mov [CS:SlideValue], BX + FILD Word Ptr [CS:SlideValue] + FMul [CS:Const1_On_768] ; Have SlideValue/768.0 + FLd ST + FRndInt + FSub ST(1), ST + FXCh + F2XM1 + FLd1 + FAdd + FScale + FIMul DWord Ptr [SI+10h] + FIStP DWord Ptr [SI+10h] + FStP ST + +PitchSlideUpFPUFreqCheck: + Or Byte Ptr [SI], 32 ; recalculate pitch! + Cmp DWord Ptr [SI+10h], 07FFFFFFFh + JAE PitchSlideUpLinear1 + Ret + +PitchSlideUpLinear1: ; Turn off channel + Or Word Ptr [SI], 200h + And Byte Ptr [DI], Not 4 +ELSE + + Or Byte Ptr [SI], 32 ; recalculate pitch! + + Push DI + Cmp BX, 0Fh + Mov DI, Offset LinearSlideUpTable + JA PitchSlideUpLinear3 + + Mov DI, Offset FineLinearSlideUpTable + ShL BX, 2 + + Jmp PitchSlideUpLinear2 + +PitchSlideUpLinear3: + And BX, Not 3 + +PitchSlideUpLinear2: + Mov EAX, [SI+10h] + Mul DWord Ptr [DI+BX] + SHRD EAX, EDX, 16 + + Test EDX, 0FFFF0000h + JNZ PitchSlideUpLinear1 + + Mov [SI+10h], EAX + + Pop DI + Ret + +PitchSlideUpLinear1: ; Turn off channel + Pop DI + Or Word Ptr [SI], 200h + And Byte Ptr [DI], Not 4 +; And Byte Ptr [SI], Not 1 +; Or Byte Ptr [SI+1], 2 ; Cut! +; And Byte Ptr [DI], Not 4 + +ENDIF + + Ret + +EndP PitchSlideUpLinear + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PitchSlideUpAmiga + +IF USEFPUCODE + Mov [CS:SlideValue], BX + FILD Word Ptr [CS:SlideValue] + FILD DWord Ptr [SI+10h] ; InitFreq, Cmd + FMul ST(1), ST ; InitFreq, Cmd.InitFreq + FLd [CS:Const_14317456] ; 1712*8363, InitFreq, Cmd.InitFreq + FSubR ST(2), ST ; 1712*8363, InitFreq, 1712*8363-Cmd.InitFreq + FMul ; 1712*8363*InitFreq, 1712*8363-Cmd.InitFreq + FDivRP ST(1), ST ; FinalFreq + FIStP DWord Ptr [SI+10h] + Jmp PitchSlideUpFPUFreqCheck + +ELSE + Or Byte Ptr [SI], 32 ; recalculate pitch! + + Mov EAX, [SI+10h] + MovZX EBX, BX + Mul EBX ; EDX:EAX = InitialFreq*Cmd + + Test EDX, EDX + JNZ PitchSlideUpAmiga1 + + Mov ECX, 1712*8363 + Mov EDX, ECX + Sub ECX, EAX ; ECX = 1712*8363-Cmd*InitialFreq + JBE PitchSlideUpAmiga1 + + Mov EAX, [SI+10h] + Mul EDX + Cmp ECX, EDX + JBE PitchSlideUpAmiga1 + + Div ECX + + Mov [SI+10h], EAX + + Ret + +PitchSlideUpAmiga1: ; Turn off channel + Or Word Ptr [SI], 200h + And Byte Ptr [DI], Not 4 +; And Byte Ptr [SI], Not 1 +; Or Byte Ptr [SI+1], 2 ; Cut! +; And Byte Ptr [DI], Not 4 + + Ret +ENDIF + +EndP PitchSlideUpAmiga + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_GetWaveForm Far + + Test Byte Ptr CS:DriverFlags, 4 + JZ Music_GetWaveForm1 + + Call [CS:DriverGetWaveform] + + DB 85h + +Music_GetWaveForm1: + StC + Ret + +EndP Music_GetWaveForm + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_Poll Far + + Mov AX, CS:PlayMode + Mov BX, CS:CurrentPattern + Jmp [DriverPoll] + +EndP Music_Poll + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_InitTempo Far + + PushA + Call Music_GetTempo + Call [DriverSetTempo] + PopA + + Ret + +EndP Music_InitTempo + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetChannels ; Returns min of NumChannels & DriverMaxChannels + ; Also uses default channels if num channels + ; = 0ffffh + Push DS + + Push CS + Pop DS + Assume DS:Music + + Mov AX, CmdLineNumChannels + Cmp AX, 0FFFFh + JNE GetChannels2 + + Mov AX, DefaultChannels + +GetChannels2: + Cmp AX, DriverMaxChannels + JBE GetChannels1 + + Mov AX, DriverMaxChannels + +GetChannels1: + Cmp AX, MAXSLAVECHANNELS + JB GetChannels3 ; MC4 + + Mov AX, MAXSLAVECHANNELS + +GetChannels3: ; MC4 + Mov NumChannels, AX + + Pop DS + Ret + +EndP GetChannels + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_ReinitSoundCard Far + + Call GetChannels + Call [DriverReinitSound] + Jmp Music_SoundCardLoadAllSamples + +EndP Music_ReinitSoundCard + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_UnInitSoundCard Far + + Jmp [DriverUninitSound] + +EndP Music_UnInitSoundCard + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_InitMusic Far + + PushAD + Push DS + Push ES + + Xor AX, AX + Mov DS, AX + Mov AX, CS + ShL EAX, 16 + Mov AX, Offset Music_UpdateSampleLocation +IF ENABLEINT3 +ELSE + Mov [DS:0Ch], EAX +ENDIF + + Trace " - Initialising SoundDriver Tables" + + Call Music_ClearDriverTables + Call D_GotoStartingDirectory + + Push CS + Pop DS + + Assume DS:Music + + Trace " - Loading MIDI configuration" + + ; Open MIDI Config file. + Mov AX, 3D00h + Mov DX, Offset MIDIConfigFileName + Int 21h + JC Music_InitMusic1 + + Mov BX, AX + + Mov DS, MIDIDataArea + Xor DX, DX + Mov AH, 3Fh + Mov CX, (128+16+9)*32 + Int 21h + + Mov AH, 3Eh ; Close + Int 21h + +Music_InitMusic1: + Trace " - Initialising playback tables" + + Call Music_Stop + + Pop ES + Pop DS + PopAD + Assume DS:Nothing + + Ret + +EndP Music_InitMusic + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_ReleasePattern Far ; AX = pattern number + + Push AX + Push DS + Push SI + Push ES + + LEA SI, [63912+EAX*4] + Push SI + + Mov DS, CS:SongDataArea + + LodsW + Cmp AL, 1 + JB Music_ReleasePattern1 + JA Music_ReleasePattern2 + + LodsW + Mov ES, AX + Mov AH, 49h + Int 21h + Jmp Music_ReleasePattern1 + +Music_ReleasePattern2: + Cmp AL, 3 + JB Music_ReleasePattern3 + JA Music_ReleasePattern1 + + LodsW + Dec AX + Call E_ReleaseBlockEMS + + Jmp Music_ReleasePattern1 + +Music_ReleasePattern3: + LodsW + Call E_ReleaseEMS + +Music_ReleasePattern1: + Pop SI + Mov DWord Ptr [SI], 0 + + Pop ES + Pop SI + Pop DS + Pop AX + + Ret + +EndP Music_ReleasePattern + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_GetPattern Far ; AX = pattern number + ; Returns DS:SI points to pattern data. + + Push AX + +; ShL AX, 2 +; Mov SI, 63912 +; Add SI, AX + LEA SI, [63912+EAX*4] + + Mov DS, CS:SongDataArea + + LodsW + Cmp AL, 1 + JE Music_GetPattern1 + JA Music_GetPattern2 + + Push CS + Pop DS + Mov SI, Offset EmptyPattern + + Pop AX + Ret + +Music_GetPattern1: + LodsW + Mov DS, AX + Xor SI, SI + + Pop AX + Ret + +Music_GetPattern2: + Cmp AL, 3 + JB Music_GetPattern3 + + LodsW + Call E_MapAlignedBlockEMS + + Pop AX + Ret + +Music_GetPattern3: + Push CX + Push DX + + MovZX CX, AH + Mov DX, [SI] + Call E_MapEMSMemory + Call E_GetEMSPageFrame + Mov DS, AX + Xor SI, SI + + Pop DX + Pop CX + + Pop AX + Ret + +EndP Music_GetPattern + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_GetPatternLocation Far ; AX = pattern number + ; Returns AX = handle + ; EBX = page/offset or + ; seg/offset + ; CX = length + + Call Music_GetPattern ; Returns DS:SI + Mov CX, [SI] + Add CX, 8 ; CX = size of data including header + +Proc Music_GetPatternLocationNoCount Far + + LEA SI, [63912+EAX*4] + + Mov DS, CS:SongDataArea + + LodsW + Cmp AL, 1 + JE Music_GetPatternLocation1 + JA Music_GetPatternLocation2 + + Mov BX, CS + Xor AX, AX + ShL EBX, 16 + Xor DX, DX + Mov BX, Offset EmptyPattern + + Ret + +Music_GetPatternLocation1: + LodsW + Mov BX, AX + ShL EBX, 16 + Xor AX, AX + Xor DX, DX + + Ret + +Music_GetPatternLocation2: + Cmp AL, 3 + JB Music_GetPatternLocation3 + + LodsW ; AX = "Segment" into EMS block + ; Want page = (AX >> 10) + ; offset = (AX << 4) & 0xFFFF + Mov BX, AX + ShL AX, 4 + ShL EBX, 6 + + Mov BX, AX + And EBX, 03F3FFFh + + Call E_GetInternalEMSHandle + Mov DL, 1 + + Ret + +Music_GetPatternLocation3: + LodsW + Xor EBX, EBX + Mov DL, 1 + + Ret + +EndP Music_GetPatternLocationNoCount + +EndP Music_GetPatternLocation + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_AllocatePattern Far ; DX = length. + ; SI = Pattern + ; ES:DI points to pattern area + Cmp CS:PatternStorage, 1 + JB Music_AllocatePatternConventionalOnly + JA Music_AllocatePatternEMS2 + +Music_AllocatePatternEMS: ; Try allocating EMS + Xor EAX, EAX + Mov AX, DX + Call E_AllocateBlockEMS + JC Music_AllocatePatternEMS2 + + Mov ES, CS:SongDataArea + LEA DI, [ESI*4+63914] + Inc AX + StosW + Mov Word Ptr [ES:DI-4], 3 + + Push DS + Push SI + + Call E_MapAlignedBlockEMS + + Push DS + Pop ES + Mov DI, SI + + Pop SI + Pop DS + Ret + +Music_AllocatePatternEMS2: + MovZX EAX, DX + ClC + Call E_AllocateEMS + Test AX, AX + JZ Music_AllocatePatternConventional + + Push CX + Push DX + + Mov ES, CS:SongDataArea + LEA DI, [ESI*4+63914] +; Mov DI, SI +; ShL DI, 2 +; Add DI, 63914 + StosW + + Add DX, 16383 + RCR DX, 1 + ShR DX, 13 + Mov CX, DX + Mov DX, AX + Call E_MapEMSMemory + + Mov CH, CL + Mov CL, 2 + + Mov [ES:DI-4], CX + Call E_GetEMSPageFrame + + Mov ES, AX + Xor DI, DI + + Pop DX + Pop CX + + Ret + +Music_AllocatePatternConventionalOnly: + Mov AH, 48h ; How much free? + Mov BX, 0FFFFh + Int 21h + + Cmp BX, -1 + JE Music_AllocatePatternEMS + + Cmp BX, 4096 + JAE Music_AllocatePatternConventional + + ShL BX, 4 ; BX = size in bytes of + ; conv remaining + Cmp DX, BX + JA Music_AllocatePatternEMS + +Music_AllocatePatternConventional: + Mov AH, 48h + Mov BX, DX + + Add BX, 15 + RCR BX, 1 + ShR BX, 3 + + Int 21h + JC Music_AllocatePattern2 + + Push DS + Mov DS, CS:SongDataArea + LEA SI, [ESI*4+63912] +; ShL SI, 2 +; Add SI, 63912 + Mov Word Ptr [SI], 1 + Mov [SI+2], AX + + Pop DS + Mov ES, AX + Xor DI, DI + + Ret + +Music_AllocatePattern2: + Xor AX, AX + Mov ES, AX + + Ret + +EndP Music_AllocatePattern + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_AllocateSample Far ; AX = Sample number, 0 based + ; EDX = length + ; Returns ES:DI, ES = 0 if not. + Push EAX + Push BX + Push CX + Push EDX + Push DS + Push SI + + Mov AH, 2 + Call Music_ReleaseSample + And AX, 0FFh + + Add EDX, 8 ; Extra 8 bytes allocated.. + + Mov BX, AX + Add BX, BX + Mov DS, CS:SongDataArea + Mov SI, [64912+BX] + + Cmp EDX, 1024 + JA Music_AllocateSample5 + + Mov EBX, EDX + Add EBX, 15 + RCR EBX, 1 + SHR EBX, 3 + + Mov AH, 48h + Int 21h + + JNC Music_AllocateSample4 + +Music_AllocateSample5: + Mov EAX, EDX + StC + Call E_AllocateEMS + Test AX, AX ; AX = handle + JZ Music_AllocateSample1 + + Mov Byte Ptr [DS:SI+48h], 2 + Mov [DS:SI+4Ah], AX + Add EDX, 16383 + RCR EDX, 1 + ShR EDX, 13 + Mov [DS:SI+49h], DL + + Xor CH, CH + Mov CL, DL + Mov DX, AX + Call E_MapEMSMemory + + Call E_GetEMSPageFrame + Mov ES, AX + Xor DI, DI + Or Byte Ptr [SI+12h], 1 + + Jmp Music_AllocateSample3 + +Music_AllocateSample1: + Cmp EDX, 1048576 + JAE Music_AllocateSample2 + + Mov EBX, EDX + Add EBX, 15 + RCR EBX, 1 + SHR EBX, 3 + + Mov AH, 48h + Int 21h + + JC Music_AllocateSample2 + +Music_AllocateSample4: + Mov Byte Ptr [SI+48h], 1 + Mov [SI+4Ah], AX + Or Byte Ptr [SI+12h], 1 + + Mov ES, AX + Xor DI, DI + Jmp Music_AllocateSample3 + +Music_AllocateSample2: + And Byte Ptr [SI+12h], 0F0h + + Xor AX, AX + Mov ES, AX + +Music_AllocateSample3: + Pop SI + Pop DS + Pop EDX + Pop CX + Pop BX + Pop EAX + Ret + +EndP Music_AllocateSample + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_ReleaseSample Far ; AX = sample number, 0 based + ; AH = 1 = called from network + ; = 2 = called from allocate + + PushAD + Push DS + Push ES + + Mov DX, AX + And AX, 0FFh + + Mov BX, AX + Add BX, BX + Mov DS, CS:SongDataArea + Mov BX, [BX+64912] + ; DS:BX points to sample + PushAD + Mov SI, BX + Call [DriverReleaseSample] + PopAD + + Mov DI, BX + + Test Byte Ptr [BX+12h], 1 + JZ Music_ReleaseSample1 ; Used to be ReleaseSample5. + ; Changed for network code + + Mov AL, [BX+48h] + Cmp AL, 1 + JB Music_ReleaseSample5 + JE Music_ReleaseSample2 + Cmp AL, 2 + JA Music_ReleaseSample1 + + Mov AX, [BX+4Ah] + Call E_ReleaseEMS + Jmp Music_ReleaseSample1 + +Music_ReleaseSample2: + Mov ES, [BX+4Ah] + Mov AH, 49h + Int 21h + +Music_ReleaseSample1: + Mov DWord Ptr [DI+30h], 0 + Mov DWord Ptr [DI+48h], 0 + + Cmp DH, 1 + JA Music_ReleaseSample5 + JE Music_ReleaseSample6 + +IF NETWORKENABLED + Mov AH, DL + Mov AL, NETWORK_DELETESAMPLEOBJECT + Call Network_AddWordToQueue +ENDIF + +Music_ReleaseSample6: + Push DS + Pop ES + Xor AX, AX + And Byte Ptr [DI+12h], 0FEh + Add DI, 14h + Mov CX, 3Ch/2 + Rep StosW + +Music_ReleaseSample5: + Pop ES + Pop DS + PopAD + Ret + +EndP Music_ReleaseSample + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_ClearSampleName Far ; AX = Sample number (0 based) + + Push CX + Push DS + Push SI + Push ES + Push DI + + Push CS + Pop DS + Mov SI, Offset SampleHeader + + Mov ES, CS:SongDataArea + Mov DI, AX + Add DI, DI + Mov DI, [ES:64912+DI] + + Mov CX, 80 + Rep MovsB + + Pop DI + Pop ES + Pop SI + Pop DS + Pop CX + Ret + +EndP Music_ClearSampleName + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_ClearAllSampleNames Far + + Push AX + Push CX + + Mov CX, 100 + +Music_ClearAllSampleNames1: + Mov AX, CX + Dec AX + Call Music_ClearSampleName + + Loop Music_ClearAllSampleNames1 + + Pop CX + Pop AX + + Ret + +EndP Music_ClearAllSampleNames + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_ReleaseAllSamples Far + + Push AX + Push CX + + Mov CX, 100 + +Music_ReleaseAllSamples1: + Mov AX, CX + Dec AX + Call Music_ReleaseSample + + Loop Music_ReleaseAllSamples1 + + Pop CX + Pop AX + Ret + +EndP Music_ReleaseAllSamples + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_ReleaseAllPatterns Far + + Push AX + Push CX + + Mov CX, 200 + +Music_ReleaseAllPatterns1: + Mov AX, CX + Dec AX + Call Music_ReleasePattern + Loop Music_ReleaseAllPatterns1 + + Pop CX + Pop AX + Ret + +EndP Music_ReleaseAllPatterns + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_ClearInstrument Far ; AX = Instrument number + ; (0 based) + + Push CX + Push DS + Push SI + Push ES + Push DI + + Push CS + Pop DS + Assume DS:Music + + Mov DI, AX + Add DI, DI + Mov ES, SongDataArea + Mov DI, [ES:DI+64712] ; ES:DI points to inst. + Mov SI, Offset InstrumentHeader + Mov CX, 554 + Rep MovsB + + Pop DI + Pop ES + Pop SI + Pop DS + Pop CX + Ret + +EndP Music_ClearInstrument + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_ClearAllInstruments Far + + Mov AX, 99 + +Music_ClearAllInstruments1: + Call Music_ClearInstrument + Dec AX + JNS Music_ClearAllInstruments1 + + Ret + +EndP Music_ClearAllInstruments + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_UnInitMusic Far + + Call Music_UnInitSoundCard + Call Music_UnloadDriver + + Cmp CS:SongDataArea, 0 + JE Music_UnInitMusic1 + + Call Music_ReleaseAllPatterns + Call Music_ReleaseAllSamples + +Music_UnInitMusic1: + Mov ES, CS:SongDataArea + Mov AH, 49h + Int 21h + + Ret + +EndP Music_UnInitMusic + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_GetSongSegment Far + + Mov AX, CS:SongDataArea + Ret + +EndP Music_GetSongSegment + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_UnloadDriver + + Xor AX, AX + XChg AX, CS:SoundDriverSegment + Test AX, AX + JZ Music_UnloadDriver1 + + Mov ES, AX + Mov AH, 49h + Int 21h + +Music_UnloadDriver1: + Ret + +EndP Music_UnloadDriver + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc NoFunction2 + + Push CS + Pop DS + Mov SI, Offset NoSoundCardMsg + +Proc NoFunction Far + + Xor AX, AX + StC + Ret + +EndP NoFunction + +EndP NoFunction2 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_ClearDriverTables + ; Makes all of them point to + ; Xor AX, AX, StC, RetF + Mov AX, CS + Mov ES, AX + + ShL EAX, 16 + Mov AX, Offset NoFunction2 + Mov DI, Offset StartDriverFunctions + StosD + StosD + + Mov AX, Offset NoFunction +IF OLDDRIVER + Mov CX, 61 +ELSE + Mov CX, 29 +ENDIF + Rep StosD + + Xor EAX, EAX + StosD + + Mov DriverMaxChannels, 32 + + Ret + +EndP Music_ClearDriverTables + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_LoadDriver ; Given DS:DX = filename + Assume DS:Nothing + +IFDEF DEBUG + + PushA + Push ES + Push DS + + Mov DI, 0B800h + Mov ES, DI + + Push CS + Pop DS + Assume DS:Music + + Mov DI, [ScreenOffset] + Mov SI, Offset LoadDriverMessage + Mov AH, 2 + +LoadDriverMessage1: + LodsB + StosW + Test AL, AL + JNZ LoadDriverMessage1 + + Pop DS + Assume DS:Nothing + + Mov SI, DX + +LoadDriverMessage2: + LodsB + StosW + Test AL, AL + JNZ LoadDriverMessage2 + + Add [CS:ScreenOffset], 160 + + Pop ES + PopA + +ENDIF + + Mov AX, 3D00h + Int 21h + ClD + JNC Music_LoadDriver2 + +IFDEF DEBUG + + PushA + Push DS + Push ES + + Push CS + Pop DS + Assume DS:Music + + Mov DI, 0B800h + Mov ES, DI + + Mov SI, Offset UnableToReadFileMessage + Mov DI, [ScreenOffset] + Mov AH, 2 + +UnableToReadFileLoop: + LodsB + StosW + Test AL, AL + JNZ UnableToReadFileLoop + + Add [ScreenOffset], 160 + + Pop ES + Pop DS + PopA + Assume DS:Nothing + +ENDIF + + Jmp Music_LoadDriverNoClose + +Music_LoadDriverError: + Mov AH, 3Eh + Int 21h + +Music_LoadDriverNoClose: + ClD + + Call Music_ClearDriverTables + + Push CS + Pop DS + + StC + Ret + +Music_LoadDriver2: + Mov BX, AX ; BX = file handle + Mov AH, 3Fh ; Read file + +IF OLDDRIVER + Mov CX, 256 +ELSE + Mov CX, 128 +ENDIF + + Push CS + Push CS + Pop DS + Pop ES + Assume DS:Music + + Mov DX, Offset StartDriverFunctions + Mov SI, DX + Int 21h + JC Music_LoadDriverError + Cmp AX, CX + JNE Music_LoadDriverError + +IF OLDDRIVER + Mov CX, 28 +ELSE + Mov CX, 37 ; Length of ID +ENDIF + + Mov DI, Offset DriverID + RepE CmpsB + JNE Music_LoadDriverError + + ; OK.. ID OK. Now get length, allocate memory + ; load driver, and fill in headers. + Push BX + + Mov BX, DriverLength + Add BX, 15 + Mov AH, 48h + ShR BX, 4 + Int 21h + Pop BX + JC Music_LoadDriverError ; Insufficient memory + + Mov CX, DriverLength + Mov SoundDriverSegment, AX + Mov DS, AX + Assume DS:Nothing + + Mov DI, AX ; DI = segment of driver... + + Mov AH, 3Fh ; Load driver into memory! + Xor DX, DX + Int 21h + + Push CS + Pop DS + Assume DS:Music + + Mov AH, 3Fh + Mov DX, Offset DriverVariableTable + +IF OLDDRIVER + Mov CX, 64 +ELSE + Mov CX, 16 +ENDIF + Int 21h + + Mov AH, 3Fh + +IF OLDDRIVER + Mov CX, 128 + Mov DX, Offset StartDriverFunctions+128 +ELSE + Mov CX, 64 + Mov DX, Offset StartDriverFunctions+64 +ENDIF + Mov SI, DX + Int 21h + JC Music_LoadDriverError + Cmp AX, CX + JNE Music_LoadDriverError + + Mov AH, 3Eh + Int 21h + + ; Setup reqd function table + SHRD EAX, EDI, 16 ; High word of EAX contains + ; segment... + Mov DI, Offset StartDriverFunctions + +IF OLDDRIVER + Mov CX, 64 +ELSE + Mov CX, 32 +ENDIF + +DriverFunctionLoop1: + LodsW + StosD + Loop DriverFunctionLoop1 + + ; Setup variable table + Mov ES, SoundDriverSegment + Xor DI, DI + +IF OLDDRIVER + Mov CX, 256 +ELSE + Mov CX, 16 +ENDIF + Mov SI, Offset DriverRequiredVariables + Rep MovsB + + Mov SI, Offset DriverRequiredFunctions + +IF OLDDRIVER + Mov CX, 128 +ELSE + Mov CX, 32 +ENDIF + Rep MovsD + +IFDEF DEBUG + + PushA + Push DS + Push ES + + Push CS + Pop DS + Assume DS:Music + + Mov DI, 0B800h + Mov ES, DI + + Mov SI, Offset DetectingMessage + Mov DI, [ScreenOffset] + Mov AH, 2 + +DetectingMessageLoop: + LodsB + StosW + Test AL, AL + JNZ DetectingMessageLoop + + Add [ScreenOffset], 160 + + Pop ES + Pop DS + PopA + Assume DS:Nothing + +ENDIF + ClC + + Ret + +EndP Music_LoadDriver + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +ADSCParams DW 7 Dup (0) + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_AutoDetectSoundCard Far + ; Returns DS:SI = string + ; AX, BX, CX, DX, DI = parameters + + Call D_GotoStartingDirectory + + Xor SI, SI + + Mov DX, Word Ptr [CS:DriverName] + And DX, DX + JZ Music_AutoDetectSoundCard1 + + Trace " - Loading specific soundcard driver" + + Cmp DX, 0FFFFh + JE Music_AutoDetectSoundCard4 + + Mov DS, Word Ptr [CS:DriverName+2] + Call Music_LoadDriver + JC Music_AutoDetectSoundCard4 + + Mov AL, 1 ; Forced + Mov BX, TRACKERVERSION + Mov ECX, [CS:DriverName] + Call [DriverDetectCard] + JC Music_AutodetectSoundCard5 + Cmp EAX, 'Jeff' + JE Music_AutoDetectSoundCard4 + +Music_AutodetectSoundCard5: + Call Music_UnloadDriver + Call Music_ClearDriverTables + Jmp Music_AutoDetectSoundCard4 + +Music_AutoDetectSoundCard1: + Trace " - Testing soundcard driver" + + Push SI + Push CS + Pop DS + Assume DS:Music + + Mov Word Ptr [DriverName+2], DS + + Mov BX, [SI+DriverDetectionOrder] + Cmp BX, 0FFFFh + JE Music_AutoDetectSoundCard2 + + Add BX, BX + Mov DX, [DriverNameTable+BX] + Mov Word Ptr [DriverName], DX + Call Music_LoadDriver + JC Music_AutoDetectSoundCard3 + + Xor AX, AX ; Not forced + Mov BX, TRACKERVERSION + Mov ECX, [CS:DriverName] + Call [DriverDetectCard] + JC Music_AutoDetectSoundCard6 + + Cmp EAX, 'Jeff' + JE Music_AutoDetectSoundCard2 + +Music_AutoDetectSoundCard6: + Call Music_UnloadDriver + Call Music_ClearDriverTables + +Music_AutoDetectSoundCard3: + + Pop SI + Add SI, 2 + Jmp Music_AutoDetectSoundCard1 + +Music_AutoDetectSoundCard2: + Pop AX + +Music_AutoDetectSoundCard4: + Call GetChannels + Call [CS:DriverInitSound] + + Mov [CS:ADSCParams+2], DS + + Push CS + Pop DS + Assume DS:Music + + Mov [ADSCParams], SI + Mov [ADSCParams+12], DI + Mov [ADSCParams+10], DX + Mov [ADSCParams+8], CX + Mov [ADSCParams+6], BX + Mov [ADSCParams+4], AX + + Call Music_InitStereo + + Call Music_InitMixTable + + Ret + +EndP Music_AutoDetectSoundCard + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_ShowAutoDetectSoundCard Far + + Push CS + Pop DS + Assume DS:Music + + Push DWord Ptr [ADSCParams+10] + Push DWord Ptr [ADSCParams+6] + Push [ADSCParams+4] + + LDS SI, DWord Ptr [ADSCParams] + + Mov AH, 20h + Mov DI, (26+28*80)*2 + Call S_DrawString + + Add SP, 10 + Ret + +EndP Music_ShowAutoDetectSoundCard + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_GetInstrumentMode Far + + Push DS + Mov DS, CS:SongDataArea + Mov AH, [DS:2Ch] + And AH, 4 + + Pop DS + + Ret + +EndP Music_GetInstrumentMode + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc UpdateGOTONote ; Get offset & arrayed flag. + + Push DS + Assume DS:Nothing + + Call PE_GetCurrentPattern + ; AX = Pattern number + ; BX = MaxRow + ; DS = PatternDataSegment + Cmp AX, CS:CurrentPattern + JNE UpdateGOTONote1 + + Mov DecodeExpectedPattern, AX + Mov CS:PatternSegment, DS + + Pop DS + Assume DS:Music + Mov NumberOfRows, BX + Mov AX, ProcessRow + Cmp AX, BX + JB UpdateGOTONote2 + + Xor AX, AX + Mov ProcessRow, AX + Mov CurrentRow, AX + +UpdateGOTONote2: + Mov DecodeExpectedRow, AX + + LEA AX, [EAX*4+EAX] ; PatternRowSize = *320 + ShL AX, 6 +; Mov BX, 320 +; Mul BX + Mov PatternOffset, AX + Mov PatternArray, 1 + + Ret + +UpdateGOTONote1: + Pop DS + Assume DS:Music + + Mov AX, CurrentPattern + Mov DecodeExpectedPattern, AX +IF NETWORKENABLED + Call Network_UpdatePatternIfIdle +ENDIF + Call Music_GetPattern + Assume DS:Nothing + ; DS:SI points to pattern. + + LodsW + LodsW ; AX = number of rows + + Mov CX, ProcessRow + Cmp AX, CX + JA UpdateGotoNote3 + + Xor CX, CX + +UpdateGOTONote3: + Mov CurrentRow, CX + Mov ProcessRow, CX + Mov DecodeExpectedRow, CX + Mov NumberOfRows, AX + Add SI, 4 + Inc CX + +UpdateGOTONote10: + Dec CX + JZ UpdateGOTONote5 + +UpdateGOTONote4: ; OK.. now to find the right + ; offset & update tables. + LodsB + Test AL, AL + JZ UpdateGOTONote10 + + Mov DL, AL + + And AX, 7Fh + Dec AX + LEA BX, [EAX*4+EAX] ; BX = AX*5 + ShL BX, 4 ; BX = AX*80 + LEA DI, [HostChannelInformationTable+BX] + + +; And AL, 7Fh +; Dec AL +; Mov AH, HOSTCHANNELSIZE +; Mul AH +; Mov DI, AX +; Add DI, Offset HostChannelInformationTable + ; CS:DI points. + + Mov DH, [CS:DI+2] + Test DL, 80h + JZ UpdateGOTONote6 + + Mov DH, [SI] + Inc SI + Mov [CS:DI+2], DH + +UpdateGOTONote6: + Test DH, 1 + JZ UpdateGOTONote7 + + LodsB + Mov [CS:DI+3], AL + +UpdateGOTONote7: + Test DH, 2 + JZ UpdateGOTONote8 + + LodsB + Mov [CS:DI+4], AL + +UpdateGOTONote8: + Test DH, 4 + JZ UpdateGOTONote9 + + LodsB + Mov [CS:DI+5], AL + +UpdateGOTONote9: + Test DH, 8 + JZ UpdateGOTONote4 + + LodsW + Mov [CS:DI+8], AX + Jmp UpdateGOTONote4 + +UpdateGOTONote5: + Push CS + Pop DS + Assume DS:Music + + Mov PatternOffset, SI + Mov PatternArray, 0 + + Ret + +EndP UpdateGOTONote + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PreInitCommand + + Push DS + Push SI + + Push CS + Pop DS + Assume DS:Music + + Test Byte Ptr [DI+2], 33h + JZ PreInitCommandEnd + + Test Byte Ptr [ES:2Ch], 4 + JNZ PreInitCommand1 + +PreInitCommand2: + Mov AX, [DS:DI+3] + Mov [DS:DI+0Eh], AX ; Sample/note + + Jmp PreInitCommandEnd + +PreInitCommand1: ; Have to xlat. + Mov SI, [DS:DI+3] ; Not a note? + And SI, 0FFh + Cmp SI, 120 + JAE PreInitCommand2 + + Mov BL, [DS:DI+4] + And EBX, 0FFh + JZ PreInitCommand2 + + Add SI, SI + Mov BX, [ES:64710+EBX+EBX] + + Mov AX, [ES:BX+3Ch] + Cmp AL, 0 + JE PreInitCommandNoMIDI + Cmp AL, 17 + JNE PreInitCommandMIDI1 + + Mov AL, [DS:DI+20h] + And AL, 0Fh + Inc AL ; AL = HCN + +PreInitCommandMIDI1: + Mov [DS:DI+0Ch], AX + Mov AH, 101 + Mov AL, [ES:BX+SI+40h] +; Mov AL, [DS:DI+3] + Jmp PreInitCommandMIDIEnd + +PreInitCommandNoMIDI: + Mov AX, [ES:BX+SI+40h] + +PreInitCommandMIDIEnd: + Mov [DS:DI+0Eh], AX + Test AH, AH ; No sample? + JZ PreInitCommand4 + +PreInitCommandEnd: + Mov BL, [DS:DI+6] + And EBX, 31 + + Call Word Ptr [InitCommandTable+EBX+EBX] ; Init note + + Or Byte Ptr [DI], 64 + + MovZX BX, Byte Ptr [DI+20h] ; Check whether chn + ; is on + Test Byte Ptr [ES:BX+40h], 80h + JZ PreInitCommand4 + + Test Byte Ptr [DI], 32 + JNZ PreInitCommand4 + + Test Byte Ptr [DI], 4 + JZ PreInitCommand4 ; Channel was off. + + Mov SI, [DI+24h] + Or Byte Ptr [SI+1], 8 + +PreInitCommand4: + Pop SI + Pop DS + Ret + +EndP PreInitCommand + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc UpdateNoteData + Assume DS:Music + + Mov PatternLooping, 0 + + Mov AX, CurrentPattern + Cmp AX, DecodeExpectedPattern + JNE UpdateNoteData1 + + Mov AX, CurrentRow + Inc DecodeExpectedRow + Cmp AX, DecodeExpectedRow + JE UpdateNoteData2 + +UpdateNoteData1: + Call UpdateGOTONote + +UpdateNoteData2: + Mov CX, 64 ; 64 channels +; Xor AX, AX ; Just to get rid of "jumps" + Mov DI, Offset HostChannelInformationTable + + Cmp PatternArray, 1 + JE UpdateNoteArrayed + +UpdateNoteCompressed: ; First clear all old command&value. +; Mov CX, 64 ; Done above + +UpdateNoteCompressed1: + And Word Ptr [DI], Not (3+32+64+256) + Add DI, HOSTCHANNELSIZE + Dec CX + JNZ UpdateNoteCompressed1 + + Push DS + + Mov AX, CurrentPattern +IF NETWORKENABLED +; Call Network_UpdatePatternIfIdle +ENDIF + Call Music_GetPattern ; Gets DS + + Mov SI, CS:PatternOffset +; Mov DS, PatternSegment + Assume DS:Nothing + +UpdateNoteCompressed2: + LodsB + Test AL, AL + JZ UpdateNoteCompressed3 ; No more! + ; else... go through decoding. + Mov DL, AL + + And AX, 7Fh + Dec AX + LEA DI, [EAX*4+EAX] + ShL DI, 4 ; HOSTCHANNELSIZE + Add DI, Offset HostChannelInformationTable + + Mov DH, [CS:DI+2] ; mask. + Test DL, 80h + JZ UpdateNoteCompressed4 + + Mov DH, [SI] + Inc SI + Mov [CS:DI+2], DH + +UpdateNoteCompressed4: ; DH = mask + Test DH, 1 + JZ UpdateNoteCompressed6 + + LodsB + Mov [CS:DI+3], AL + +UpdateNoteCompressed6: + Test DH, 2 + JZ UpdateNoteCompressed8 + + LodsB + Mov [CS:DI+4], AL + +UpdateNoteCompressed8: + Test DH, 4 + JZ UpdateNoteCompressed10 + + LodsB + Mov [CS:DI+5], AL + +UpdateNoteCompressed10: + Test DH, 8 + JZ UpdateNoteCompressed11 + + LodsW + Mov [CS:DI+8], AX + Jmp UpdateNoteCompressed13 + +UpdateNoteCompressed11: + Test DH, 80h + JZ UpdateNoteCompressed12 + + Mov AX, [CS:DI+8] + Jmp UpdateNoteCompressed13 + +UpdateNoteCompressed12: + Xor AX, AX + +UpdateNoteCompressed13: + Mov [CS:DI+6], AX + Call PreInitCommand + + Jmp UpdateNoteCompressed2 + +UpdateNoteCompressed3: + Pop DS + Assume DS:Music + + Mov PatternOffset, SI + + Ret + +UpdateNoteArrayed: + Assume DS:Music + + Push DS + + Mov SI, PatternOffset + Mov DS, PatternSegment + Assume DS:Nothing + +; Mov CX, 64 ; 64 channels +; Mov DI, Offset HostChannelInformationTable + +UpdateNoteArrayed1: + Xor DL, DL ; DL = mask. + And Word Ptr [CS:DI], Not (3+32+64+256) + ; Turn off all calling... + + LodsB ; AL = note data. + Cmp AL, NONOTE + JE UpdateNoteArrayed2 + + Mov [CS:DI+3], AL + Or DL, 1 + +UpdateNoteArrayed2: + LodsB + Test AL, AL + JZ UpdateNoteArrayed3 + + Mov [CS:DI+4], AL + Or DL, 2 + +UpdateNoteArrayed3: + LodsB + Cmp AL, 0FFh + JE UpdateNoteArrayed4 + + Mov [CS:DI+5], AL + Or DL, 4 + +UpdateNoteArrayed4: + LodsW + Mov [CS:DI+6], AX + Mov [CS:DI+8], AX + + Test AX, AX + JZ UpdateNoteArrayed5 + + Or DL, 8 + +UpdateNoteArrayed5: + Test DL, DL + JZ UpdateNoteArrayed6 + + Mov [CS:DI+2], DL + Push CX + + Call PreInitCommand + + Pop CX + Assume DS:Nothing + + +UpdateNoteArrayed6: + Add DI, HOSTCHANNELSIZE + Dec CX + JNZ UpdateNoteArrayed1 + + Pop DS + Assume DS:Music + + Mov PatternOffset, SI + + Ret + +EndP UpdateNoteData + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc UpdateVibrato ; DS:SI points to slavechannelstruct. + + Mov BX, [SI+34h] ; ES:BX points to sample + Mov DL, [ES:BX+4Dh] ; Vibrato depth + Test DL, DL + JZ UpdateVibrato1 + + Mov CX, [SI+1Ah] + Add CL, [ES:BX+4Eh] ; Vibrato rate + AdC CH, 0 + + Cmp CH, DL + JBE UpdateVibrato5 + + Mov CH, DL + +UpdateVibrato5: + Mov [SI+1Ah], CX + + Mov AH, [ES:BX+4Ch] ; AH = speed + Mov BH, [ES:BX+4Fh] ; BH = waveform + Test AH, AH + JZ UpdateVibrato1 + + Cmp BH, 3 + JE UpdateVibrato2 + + Mov BL, [SI+19h] + + Add BL, AH + Mov [SI+19h], BL ; Update pointer. + + Mov AL, [FineSineData+BX] + Jmp UpdateVibrato3 + +UpdateVibrato2: + Call Random + And AL, 127 + Sub AL, 64 + +UpdateVibrato3: + IMul CH + + SAL AX, 2 + MovSX BX, AH + +IFE USEFPUCODE + JS UpdateVibrato4 +ENDIF + JZ UpdateVibrato1 + + Push DI + Mov DI, [SI+38h] + Call PitchSlideUpLinear + Pop DI + +IFE USEFPUCODE + Jmp UpdateVibrato1 + +UpdateVibrato4: + Neg BX + Call PitchSlideDownLinear +ENDIF + +UpdateVibrato1: + Ret + +EndP UpdateVibrato + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Update Far + + Push CS + Pop DS + Assume DS:Music + +IF USEFPUCODE + FNSave FPSave + FNInit + FLdCW [NewControlWord] +ENDIF + + Mov CX, MAXSLAVECHANNELS + Mov SI, Offset SlaveChannelInformationTable + Mov DI, [SI+38h] + + Mov BX, MIDICOMMAND_TICK + Call MIDITranslate + + Mov ES, SongDataArea + +Update2: + Test Byte Ptr [SI], 1 + JZ Update3 + ; reset volume + Mov BL, [SI+22h] + Cmp BL, [SI+21h] + JE Update4 + + Mov [SI+21h], BL + Or Byte Ptr [SI], 10h + +Update4: + Mov EAX, [SI+14h] ; Freq + Cmp EAX, [SI+10h] + JE Update3 + + Mov [SI+10h], EAX + Or Byte Ptr [SI], 20h ; Recalc freq. + +Update3: + Add SI, SLAVECHANNELSIZE + Dec CX + JNZ Update2 + + Call UpdateData + + Test Byte Ptr [ES:2Ch], 4 + JZ Update5 + + Call UpdateInstruments + Jmp UpdateEnd + +Update5: + Call UpdateSamples + +UpdateEnd: + Mov CX, NumChannels + Mov SI, Offset SlaveChannelInformationTable + Mov AX, PlayMode + +IF USEFPUCODE + FRstor FPSave +ENDIF + Ret + + +EndP Update + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc UpdateSamples + + Assume DS:Music + + Mov CX, NumChannels + Mov SI, Offset SlaveChannelInformationTable + +UpdateSamples1: + Test Byte Ptr [SI], 1 + JZ UpdateSamples2 + + Mov BX, [SI] ; OK.. if recalc volume is on. + ; then recalc volume! :) + Push CX + + Test BL, 16 + JZ UpdateSamples3 + + And BL, Not 16 + Mov CL, SoloSample + + Or BL, 64 ; Recalc final vol + Cmp CL, 0FFh + JE UpdateSamples6 + + Cmp [SI+36h], CL + JE UpdateSamples6 + + Or BH, 8 + +UpdateSamples6: + Xor DX, DX + Mov AL, [SI+21h] ; AL = vol + Mul Byte Ptr [SI+23h] ; Channel volume, AX = 0->64^2 + Mov DL, Byte Ptr [SI+24h] ; Sample volume + Mul DX ; AX = 0->64*64*128 + + SHRD AX, DX, 4 ; AX = 0->32768 + + Mov DL, GlobalVolume + Mul DX ; AX = 0->32768*128 + + SHRD AX, DX, 7 + + Mov [SI+20h], AH ; Final vol stored. + Mov [SI+4Ah], AX + +UpdateSamples3: + Test BL, 2 + JZ UpdateSamples4 + + And BL, Not 2 + Or BH, 128 + + Mov AL, [SI+2Ah] + Mov [SI+25h], AL + Cmp AL, 100 + JE UpdateSamples5 + + Sub AL, 32 + ; Pan = (Pan-32)* Separation/128 + 32 + Mov AH, [ES:34h] + ShR AH, 1 ; AH = 0->64 (Separation) + IMul AH ; AX = -2048->+2048 + ; ie. AH = -8->+8 + SAR AX, 6 ; AL = -32->+32 + + Cmp ReverseChannels, 0 + JE UpdateSamplePan3 + + Neg AL + +UpdateSamplePan3: + Add AL, 32 + +UpdateSamples5: + Mov [SI+37h], AL + +UpdateSamples4: + Mov [SI], BX + + Call UpdateVibrato + + Pop CX + +UpdateSamples2: + Add SI, SLAVECHANNELSIZE + Dec CX + JNZ UpdateSamples1 + + Ret + +EndP UpdateSamples + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc UpdateEnvelope ; Returns Carry if envelope needs + ; to be turned off + ; Reqs ES:DI points to envelope + ; DS:SI points to slave channel envelope structure + ; Called only if envelope is ON + ; BP != 0 if sustain points released, 0 otherwise + + Mov DX, [SI+8] ; DX = current pos + + Cmp DX, [SI+0Ch] ; Expected end pos + JAE UpdateEnvelope1 + + Inc DX + Mov EAX, [SI+4] ; Update value + + Mov [SI+8], DX ; Increase position + Add [SI], EAX + + ClC + Ret + +UpdateEnvelope1: ; Procedure: + ; 1) Get current pos' value + ; 2) Figure out next pos (inc/loop) + ; 3) Figure out delta to next pos + ; 4) Terminate if no loop (with carry) + ; or place new check in [SI+0Ch] + + Xor BX, BX + Mov BL, [SI+0Ah] ; BX = cur env node + LEA AX, [BX+1] + LEA BX, [EBX*2+EBX] ; BX = BX*3 + + Xor DH, DH + Mov DL, [ES:DI+BX+6] + ShL EDX, 16 + Mov [SI], EDX ; Current pos value done. + + ; AX = next cur env node + Mov DX, [ES:DI] + + Test DL, 6 ; Any loop at all? + JZ UpdateEnvelope2 + + Mov BX, [ES:DI+2] ; Normal Loop + + Test DL, 4 ; No SusLoop? + JZ UpdateEnvelope3 + + Test BP, BP + JNZ UpdateEnvelope4 + + Mov BX, [ES:DI+4] + Jmp UpdateEnvelope3 + +UpdateEnvelope4: + Test DL, 2 + JZ UpdateEnvelope2 + +UpdateEnvelope3: ; Loop + Cmp AL, BH + JBE UpdateEnvelope2 + + Xor BH, BH + Mov [SI+0Ah], BL ; BL=New node + LEA BX, [EBX*2+EBX] + + Mov AX, [ES:DI+BX+7] + Mov [SI+8], AX + Mov [SI+0Ch], AX + + ClC + Ret + +UpdateEnvelope2: ; AX = new node + Cmp AL, DH ; DH = number of nodes + JB UpdateEnvelope7 + + StC + Ret + +UpdateEnvelope7: + Mov [SI+0Ah], AL ; New node + LEA BX, [EAX*2+EAX] + + Mov DX, [ES:DI+BX+7] ; New node's tick + Mov [SI+0Ch], DX + Mov AX, [ES:DI+BX+7-3] ; Last node's tick + Sub DX, AX + Inc AX + Mov [SI+8], AX ; For security. + + Mov AL, [ES:DI+BX+6] ; New node's amplitude + Sub AL, [ES:DI+BX+6-3] ; Last node's amplitude + + Mov BX, DX ; BX = delta(ticks) + Xor DX, DX + CBW + Test AX, AX + PushF + JNS UpdateEnvelope5 + + Neg AX + +UpdateEnvelope5: + Sub BX, 1 + AdC BX, 1 ; Just to prevent div 0 errors + + Div BX + ShL EAX, 16 ; This clears AX also + Div BX + ; EAX = value + PopF + JNS UpdateEnvelope6 + + Neg EAX + +UpdateEnvelope6: + Mov [SI+4], EAX ; Delta done + + ClC + Ret + +EndP UpdateEnvelope + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +DoMIDICycle DB 0 + +MIDIPrograms DB 16 Dup (0FFh) ; Do NOT change order! +MIDIBanks DW 16 Dup (0FFFFh) +MIDIPan DB 16 Dup (0FFh) +MIDIPitch DW 16 Dup (2000h) + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc UpdateMIDI + Assume DS:Music + +; Stop cycle + + Mov CX, MAXSLAVECHANNELS + Mov SI, Offset SlaveChannelInformationTable + +UpdateMIDI1: + Test Word Ptr [SI], 200h + JZ UpdateMIDI2 + Cmp Byte Ptr [SI+36h], 100 + JNE UpdateMIDI2 + Test Byte Ptr [SI], 1 + JZ UpdateMIDI2 + + Mov Word Ptr [SI], 0 + Mov DI, [SI+38h] ; Host channel in DI + + Mov BX, MIDICOMMAND_STOPNOTE + Call MIDITranslate + + Test Byte Ptr [SI+3Ah], 80h + JNZ UpdateMIDI2 + + Or Byte Ptr [SI+3Ah], 80h + And Byte Ptr [DI], Not 4 ; Signify channel off + +UpdateMIDI2: + Add SI, SLAVECHANNELSIZE + Dec CX + JNZ UpdateMIDI1 + +; Play cycle + + Mov CX, MAXSLAVECHANNELS + Mov SI, Offset SlaveChannelInformationTable + +UpdateMIDI3: + Cmp Byte Ptr [SI+36h], 100 ; MIDI Instrument? + JNE UpdateMIDI4 + + Mov DX, [SI] + Test DL, 1 + JZ UpdateMIDI4 + + Mov AL, [SI+4Ch] + Mov Byte Ptr [SI+4Ch], 1 + Mov [SI+2Ch], AL + + Test DX, 800h ; Muted? + JNZ UpdateMIDI4 + + Mov DI, [SI+38h] ; Host channel in DI + And Word Ptr [SI], 0111100010001101b + + Test DH, 1 + JZ UpdateMIDINoPlayNote + +UpdateMIDIPlayNote: ; Check if there's a bank select. + Mov AX, [SI+3Eh] ; MIDI Bank + Cmp AX, 0FFFFh + JE UpdatemIDIBankSelectDone + + Mov BL, [SI+3Ch] ; BL = channel + And BX, 0FFh + Add BX, BX + Cmp [MIDIBanks+BX-2], AX + JE UpdateMIDIBankSelectDone + + Mov [MIDIBanks+BX-2], AX + ShR BX, 1 + Mov [MIDIPrograms+BX-1], 0FFh ; Reset program + + Mov BX, MIDICOMMAND_BANKSELECT + Call MIDITranslate + +UpdateMIDIBankSelectDone: ; Check for a program specification + Cmp Byte Ptr [SI+3Dh], 0 + JL UpdateMIDIProgramDone + + Mov BL, [SI+3Ch] ; BL = channel + And BX, 0FFh + Mov AL, [SI+3Dh] ; MIDI program + Cmp [MIDIPrograms+BX-1], AL + JE UpdateMIDIProgramDone + + Mov [MIDIPrograms+BX-1], AL + + Mov BX, MIDICOMMAND_PROGRAMSELECT + Call MIDITranslate + +UpdateMIDIProgramDone: +; Check for MIDI pitch wheel.. + Test Byte Ptr [ES:2Ch], 64 + JZ UpdateMIDINoPitchWheel + + Mov BL, [SI+3Ch] ; BL = channel + And BX, 0FFh + Add BX, BX + Cmp [MIDIPitch+BX-2], 2000h + JE UpdateMIDINoPitchWheel + + Mov [MIDIPitch+BX-2], 2000h + Mov AL, [SI+3Ch] + Dec AL + Or AL, 0E0h + Call MIDISendFilter + Xor AL, AL + Call MIDISendFilter ; Reset pitch wheel + Mov AL, 40h + Call MIDISendFilter + +UpdateMIDINoPitchWheel: + Mov EAX, [SI+14h] + Mov BX, MIDICOMMAND_PLAYNOTE + Mov [SI+1Ch], EAX + Call MIDITranslate + Jmp UpdateMIDINoChangeVolume + +UpdateMIDINoPlayNote: ; Change in volume? + Test DL, 64 + JZ UpdateMIDINoChangeVolume + + Mov BX, MIDICOMMAND_CHANGEVOLUME + Call MIDITranslate + +UpdateMIDINoChangeVolume: + Test DH, 80h ; Pan changed? + JZ UpdateMIDINoChangePan + + Mov BL, [SI+3Ch] ; BL = channel + And BX, 0FFh + Mov AL, [SI+37h] ; FPP + + Cmp [MIDIPan+BX-1], AL + JE UpdateMIDINoChangePan + + Mov [MIDIPan+BX-1], AL + + Mov BX, MIDICOMMAND_CHANGEPAN + Call MIDITranslate + +UpdateMIDINoChangePan: ; Pitch changed? + Test DL, 32 + JZ UpdateMIDINoPitchChange + + Mov BX, MIDICOMMAND_CHANGEPITCH + Call MIDITranslate + +UpdateMIDINoPitchChange: + +UpdateMIDI4: + Add SI, SLAVECHANNELSIZE + Dec CX + JNZ UpdateMIDI3 + + Ret + +EndP UpdateMIDI + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc UpdateInstruments + Assume DS:Music ; Things to update: + ; 1) Volume envelope + ; 2) Fadeout + ; 3) FinalVolume + ; 4) Vibrato. + ; Turn off channel if + ; 1) Volume envelope is off & VEV = 0 or + ; 2) Fadeout = 0 + + Mov CX, MAXSLAVECHANNELS + Mov SI, Offset SlaveChannelInformationTable + Mov [DoMIDICycle], 0 + +UpdateInstruments1: + Test Byte Ptr [SI], 1 + JNZ UpdateInstruments16 ; Channel on!! + +UpdateInstruments2: + Add SI, SLAVECHANNELSIZE + Dec CX + JNZ UpdateInstruments1 + + Cmp [DoMIDICycle], 0 + JE UpdateInstrumentNoMIDICycle + + Call UpdateMIDI + +UpdateInstrumentNoMIDICycle: + Ret + +; UpdateInstruments14: +; Jmp UpdateInstruments5 ; Jump point + +UpdateInstruments16: + Push CX + + Mov CX, [SI] + + MovZX EDI, Word Ptr [SI+30h] ; ES:DI = instrument + + Cmp Byte Ptr [SI+33h], 0FFh ; No instrument? + JE UpdateInstruments5 ; Prev Intruments14 + + Mov BP, CX + And BP, 4 ; BP = sustain for envelope calls + +UpdatePitchEnvelope: + Test CH, 40h + JZ UpdatePitchEnvelopeApply + + Push SI + Push DI + + Add SI, 70h + Add DI, 1D4h + Call UpdateEnvelope + + Pop DI + Pop SI + + JNC UpdatePitchEnvelopeApply + + And CH, Not 40h + +UpdatePitchEnvelopeApply: + Test Byte Ptr [ES:DI+1D4h], 80h + JZ UpdatePitchEnvelopePitch + + Cmp Byte Ptr [SI+36h], 100 + JE UpdatePanEnvelope + +UpdatePitchEnvelopeFilter: + Mov BX, [SI+71h] + SAR BX, 6 ; Range -128 to +128 + Add BX, 128 ; Range 0 -> 256 + Cmp BH, 1 + AdC BL, -1 + Mov [SI+3Eh], BL + + Or CL, 64 ; Recalculate final volume + +; Test Byte Ptr [SI+3Ah], 80h +; JNZ UpdatePanEnvelope +; +; Call SetFilterCutoff +; + Jmp UpdatePanEnvelope + +UpdatePitchEnvelopePitch: + Mov BX, [SI+71h] + SAR BX, 3 + JZ UpdatePanEnvelope +IFE USEFPUCODE + JS UpdatePitchEnvDown +ENDIF + + Push DI + Mov DI, [SI+38h] + + Call PitchSlideUpLinear ; req: DS:SI points to table + ; DS:DI points to host channel + ; BX = magnintude + Pop DI +IFE USEFPUCODE + Jmp UpdatePostPitchEnvelope + +UpdatePitchEnvDown: + Neg BX + Call PitchSlideDownLinear + +UpdatePostPitchEnvelope: +ENDIF + Or CL, 32 ; Recalculate freq + +UpdatePanEnvelope: + Test CH, 20h + JZ UpdateVolumeEnvelope + + Or CL, 2 ; Recalculate pan + + Push SI + Push DI + + Add SI, 60h + Add DI, 182h + Call UpdateEnvelope + + Pop DI + Pop SI + + JNC UpdateVolumeEnvelope + + And CH, Not 20h + +UpdateVolumeEnvelope: + Test CH, 10h ; Volume envelope on? + JZ UpdateInstruments3 + + Or CL, 16 ; Recalculate volume + + Push SI + Push DI + + Add SI, 50h + Add DI, 130h + Call UpdateEnvelope + + Pop DI + Pop SI + + JC UpdateVolumeEnvelope1 + Test CL, 8 ; Note fade on? + JNZ UpdateInstruments13 + + ; Now, check if loop + sustain + ; off + Test BP, BP + JZ UpdateInstruments5 + + Test Byte Ptr [ES:DI+130h], 2 ; Normal vol env loop? + JNZ UpdateInstruments19 + Jmp UpdateInstruments5 ; Volume calculation + +UpdateVolumeEnvelope1: ; Envelope turned off... + And CH, Not 10h ; Turn off envelope flag + + Cmp Byte Ptr [SI+52h], 0 ; Turn off if end of loop is + JE UpdateInstruments17 ; reached + + Jmp UpdateInstruments19 + +UpdateInstruments3: + Test CL, 8 ; Note fade?? + JNZ UpdateInstruments13 + + ; Also apply fade if No vol env + ; AND sustain off + + Test CL, 4 ; Note off issued? + JZ UpdateInstruments5 + +UpdateInstruments19: + Or CL, 8 + +UpdateInstruments13: + Mov AX, [ES:DI+14h] ; AX = fadeout. + Sub [SI+26h], AX + JG UpdateInstruments4 + Mov Word Ptr [SI+26h], 0 + +UpdateInstruments17: ; Turn off channel + Test Byte Ptr [SI+3Ah], 80h + JNZ UpdateInstruments18 + + Or Byte Ptr [SI+3Ah], 80h + ; Host channel exists + Mov BX, [SI+38h] + And Byte Ptr [BX], Not 4 + +UpdateInstruments18: +; Mov Word Ptr [SI], 200h +; Pop CX +; Jmp UpdateInstruments2 + Or CH, 2 + +UpdateInstruments4: + Or CL, 16 ; Recalc volume flag. + +UpdateInstruments5: + Test CL, 16 + JZ UpdateInstrument10 + ; Calculate volume + And CL, Not 16 + Mov DX, Word Ptr [SoloSample] ; DL = sample, DH = inst + + Or CL, 64 ; Recalc final volume + Mov AL, [SI+21h] ; Note volume.. + + Mul Byte Ptr [SI+23h] ; Channel volume + ; AX = (0->4096) + Cmp DL, 0FFh + JE UpdateInstrumentNoSampleSolo + + Cmp [SI+36h], DL + JNE UpdateInstrumentSolo + +UpdateInstrumentNoSampleSolo: + Cmp DH, 0FFh + JE UpdateInstrumentNoInstrumentSolo + + Cmp [SI+33h], DH + JE UpdateInstrumentNoInstrumentSolo + +UpdateInstrumentSolo: + Or CH, 8 + +UpdateInstrumentNoInstrumentSolo: + Mul Word Ptr [SI+26h] ; Fadeout Vol (0->1024) + ; DX:AX = 0->4194304 + SHRD AX, DX, 7 + ; AX = (0->32768) + Mov DL, [SI+24h] ; Sample volume + Mul DX ; DX:AX = 0->4194304 + + SHRD AX, DX, 7 ; AX = 0->32768 + + Mov DX, Word Ptr [SI+51h] ; VEV, 0->64*256 + Mul DX ; DX:AX = 0->536870912 + + SHRD AX, DX, 14 ; AX = 0->32768 + + Xor DH, DH + Mov DL, GlobalVolume + Mul DX ; DX:AX = 0->4194304 + + SHRD AX, DX, 7 + Mov [SI+20h], AH + Mov [SI+4Ah], AX + +UpdateInstrument10: + Test CL, 2 ; Change in panning? + JZ UpdateInstrument20 + + And CL, Not 2 + Or CH, 128 + + Mov DL, [SI+2Ah] ; DL = actual pan + Mov AL, DL + Cmp DL, 100 + JE UpdateInstrumentSurroundPan + + Mov AL, 32 + Sub AL, DL + CBW + Xor AL, AH + Sub AL, AH ; AL = |32-ActualPan| + + Neg AL + Add AL, 32 + IMul Byte Ptr [SI+62h] ; Pan envelope.. + SAR AX, 5 + Add AL, DL + + Mov [SI+25h], AL ; Value to show.. + + Sub AL, 32 + ; Pan = (Pan-32)* Separation/128 + 32 + Mov AH, [ES:34h] + ShR AH, 1 ; AH = 0->64 (Separation) + IMul AH ; AX = -2048->+2048 + ; ie. AH = -8->+8 + SAR AX, 6 ; AL = -32->+32 + + Cmp ReverseChannels, 0 + JE UpdateInstrumentPan3 + + Neg AL + +UpdateInstrumentPan3: + Add AL, 32 + Jmp UpdateInstrumentPan2 + +UpdateInstrumentSurroundPan: + Mov [SI+25h], AL + +UpdateInstrumentPan2: + Mov [SI+37h], AL + +UpdateInstrument20: + Mov [SI], CX + + Call UpdateVibrato + + Cmp Byte Ptr [SI+36h], 100 ; MIDI? + JNE UpdateInstrumentsNoMIDI + + Mov [DoMIDICycle], 1 + +UpdateInstrumentsNoMIDI: + Pop CX + + Jmp UpdateInstruments2 + +EndP UpdateInstruments + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc UpdateData + + Assume DS:Music + + Mov CX, 64 + Mov AX, PlayMode + Cmp AX, 1 + JE UpdateData_PlayMode1 + JB UpdateData_PlayMode0 + Jmp UpdateData_PlayMode2 + +UpdateData_PlayMode0: ; Step through each channel. + ; Check if on/updatemode OK + Mov DI, Offset HostChannelInformationTable + +UpdateData1: + Cmp Byte Ptr [DI+21h], 0 + JE PlayMode0UpdateVolume1 + + Dec Byte Ptr [DI+21h] ; Handle counter + JNZ UpdateData4 + + And Word Ptr [DI], Not 303h ; Turn off mode. + +UpdateData4: + Mov AX, [DI] + + Test AL, 4 ; Channel on? + JZ UpdateData2 + + Test AH, 1 + JZ UpdateData2 ; Don't update effect?? + +PlayMode0UpdateVolume2: + Push CX + + Mov BX, [DI+0Ah] + And BX, 7 + Add BX, BX + + Call Word Ptr [VolumeEffectTable+BX] + + Pop CX + + Mov AL, [DI] + +UpdateData2: + Test AL, 2 + JNZ UpdateData3 ; Update effect regardless.. + + Test AL, 4 ; Channel on? + JZ PlayMode0UpdateVolume1 + + Test AL, 1 + JZ PlayMode0UpdateVolume1 ; Don't update effect?? + +UpdateData3: ; OK. now handle counter. + Push CX + + Mov BX, [DI+6] + And BX, 31 + Add BX, BX + + Call Word Ptr [CommandTable+BX] + + Pop CX + +PlayMode0UpdateVolume1: + Add DI, HOSTCHANNELSIZE ; Progress to next channel + Dec CX + JNZ UpdateData1 + + Ret ; That's all! + +UpdateData_PlayMode1: + ; Pattern stuff.. + Dec ProcessTick + Dec CurrentTick + JZ UpdateData_Pattern1 + +UpdateData_NoNewRow: ; OK. call update command. + Mov DI, Offset HostChannelInformationTable + +UpdateData_NoNewRow1: + Mov AX, [DI] ; AX = host flags. + + Test AL, 4 + JZ UpdateData_NoNewRow5 + + Test AH, 1 + JZ UpdateData_NoNewRow5 + +UpdateData_NoNewRow4: + Push CX + + Mov BX, [DI+0Ah] + And BX, 7 + Add BX, BX + + Call Word Ptr [VolumeEffectTable+BX] + + Pop CX + + Mov AL, [DI] ; AX = host flags. + +UpdateData_NoNewRow5: + Test AL, 3 + JZ UpdateData_NoNewRow2 + + Test AL, 2 + JNZ UpdateData_NoNewRow3 + + Test AL, 4 + JZ UpdateData_NoNewRow2 + +UpdateData_NoNewRow3: + Push CX + + Mov BX, [DI+6] + And BX, 31 + Add BX, BX + + Call Word Ptr [CommandTable+BX] + + Pop CX + +UpdateData_NoNewRow2: + Add DI, HOSTCHANNELSIZE + Dec CX + JNZ UpdateData_NoNewRow1 + + Ret + +UpdateData_Pattern1: ; OK... have to update row. + Mov AX, CurrentSpeed + Mov CurrentTick, AX + Mov ProcessTick, AX + + Dec RowDelay + JNZ UpdateEffectData + + Mov Word Ptr RowDelay, 1 + + Mov AX, ProcessRow + Inc AX ; Progress to new row. + Cmp AX, NumberOfRows + JB UpdateData_Pattern2 + + Cmp StopEndOfPlaySection, 0 + JNE UpdateDataStopSong + ; Wrap row. + Xor AX, AX + XChg AX, BreakRow + +UpdateData_Pattern2: + Jmp UpdateData_Song1 +; Mov ProcessRow, AX +; Mov CurrentRow, AX +; +; ; Gotta get note data. +; Call UpdateNoteData +; Ret + +UpdateEffectData: + Mov DI, Offset HostChannelInformationTable + +UpdateEffectData1: + Test Byte Ptr [DI], 64 + JZ UpdateEffectData2 + + Mov AL, [DI+2] + Test AL, 88h + JZ UpdateEffectData2 + + Push AX + Push CX + + And AL, 88h + Mov [DI+2], AL + + Mov BL, [DI+6] + And BX, 31 + Add BX, BX + + Call Word Ptr [InitCommandTable + BX] ; Init note + + Pop CX + Pop AX + + Mov [DI+2], AL + +UpdateEffectData2: + Add DI, HOSTCHANNELSIZE + Dec CX + JNZ UpdateEffectData1 + Ret + +UpdateData_PlayMode2: + Dec ProcessTick + Dec CurrentTick + JNZ UpdateData_NoNewRow + ; Play song stuff... + + Mov AX, CurrentSpeed + Mov CurrentTick, AX + Mov ProcessTick, AX + + Dec RowDelay + JNZ UpdateEffectData + + Mov Word Ptr RowDelay, 1 + + Mov AX, ProcessRow + Inc AX + Cmp AX, NumberOfRows + JB UpdateData_Song1 + + Test OrderLockFlag, 1 + JNZ UpdateData_Song5 + + Mov BX, ProcessOrder ; Get new pattern. + Xor DX, DX + Inc BX + +UpdateData_Song2: + Cmp BX, 100h + JGE UpdateData_Song4 + + Mov CL, [ES:BX+100h] ; CL = next pattern. + Cmp CL, 200 + JB UpdateData_Song3 + + Inc BX + Cmp CL, 0FEh + JE UpdateData_Song2 + + Mov StopSong, 1 + + Cmp StopEndOfPlaySection, 0 + JE UpdateData_Song4 + +UpdateDataStopSong: + Call Music_Stop ; Optionally.. loop! + Ret + +UpdateData_Song4: + Test DX, DX + JNZ UpdateDataStopSong + + Inc DX + Xor BX, BX + Jmp UpdateData_Song2 + +UpdateData_Song3: + Mov ProcessOrder, BX + Mov CurrentOrder, BX + + Mov Byte Ptr CurrentPattern, CL + +UpdateData_Song5: + Xor AX, AX + XChg AX, BreakRow + +UpdateData_Song1: + Mov ProcessRow, AX + Mov CurrentRow, AX + + Call UpdateNoteData + Ret + +EndP UpdateData + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_GetNumberOfSamples Far ; Returns AX + + Push CX + Push DS + Push SI + Push ES + Push DI + + Push CS + Pop DS + Assume DS:Music + + Mov ES, SongDataArea + Mov DI, 63912-160 + + Mov AX, 99 + +Music_GetNumberOfSamples1: + Mov CX, 80 + Mov SI, Offset SampleHeader + RepE CmpsB + JNE Music_GetNumberOfSamples2 + + Sub DI, 160 + Dec AX + JNZ Music_GetNumberOfSamples1 + +Music_GetNumberOfSamples2: + + Pop DI + Pop ES + Pop SI + Pop DS + Pop CX + + Ret + +EndP Music_GetNumberOfSamples + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_GetNumberOfInstruments Far ; Returns AX + + Push CX + Push DS + Push SI + Push ES + Push DI + + Push CS + Pop DS + Assume DS:Music + + Mov ES, SongDataArea + Mov DI, 55912-554*2 + + Mov AX, 99 + +Music_GetNumberOfInstruments1: + Mov CX, 554 + Mov SI, Offset InstrumentHeader + RepE CmpsB + JNE Music_GetNumberOfInstruments2 + + Sub DI, 1108 + Dec AX + JNZ Music_GetNumberOfInstruments1 + +Music_GetNumberOfInstruments2: + + Pop DI + Pop ES + Pop SI + Pop DS + Pop CX + + Ret + +EndP Music_GetNumberOfInstruments + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_GetSampleHeader Far ; AX = sample, 1 based + + Mov SI, AX + Mov DS, CS:SongDataArea + Add SI, SI + + Mov SI, [DS:64910+SI] + + Ret + +EndP Music_GetSampleHeader + ; Returns DS:SI + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_GetSampleLocation Far ; AX = sample (1based) + ; CH = page. + ; Returns DS:ESI + ; ECX = length + ; Carry if no sample. + ; Zero set if 8 bit + Mov CS:LastSample, AX + + Push AX + Push BX + Push DX + + Mov BX, AX + Add BX, BX + + Mov DS, CS:SongDataArea + Mov BX, [64910+BX] + Test Byte Ptr [BX+12h], 1 + JZ Music_GetSampleLocationEnd + +Music_GetSampleLocation3: + Mov AL, [BX+48h] + Test AL, AL + JZ Music_GetSampleLocationEnd + + Cmp AL, 2 + JA Music_GetSampleLocationEnd + JE Music_GetSampleLocation4 + + Mov AX, [BX+4Ah] + Xor CL, CL + ShL CX, 2 + Add AX, CX + + Jmp Music_GetSampleLocation2 + +Music_GetSampleLocation4: + Mov DX, [BX+4Ah] + Mov CL, [BX+49h] + Call E_MapEMSMemory + Call E_GetEMSPageFrame + +Music_GetSampleLocation2: + Xor ESI, ESI + Mov ECX, [BX+30h] + + Test Byte Ptr [BX+12h], 2 ; Zero flag for 8-bit. + + Mov DS, AX + +Music_GetSampleLocation5: + ClC + Jmp Music_GetSampleLocationEnd2 ; Need to preserve zero flag + +Music_GetSampleLocationEnd: + StC + +Music_GetSampleLocationEnd2: + Pop DX + Pop BX + Pop AX + + Ret + +EndP Music_GetSampleLocation + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +; Accessed via Int 3 +Proc Music_UpdateSampleLocation Far ; Reqs ESI. + + PushAD + + Mov AX, CS:LastSample + Mov ECX, ESI + ShR ECX, 8 + ShL CH, 2 + + Call Music_GetSampleLocation + + PopAD + IRet + +EndP Music_UpdateSampleLocation + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_FarUpdateSampleLocation Far + + PushF + + PushF + ClI + Call Far Ptr Music_UpdateSampleLocation + + PopF + + Ret + +EndP Music_FarUpdateSampleLocation + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_GetPlayMode Far + + Push DS + + Push CS + Pop DS + Assume DS:Music + + Mov AX, PlayMode + Mov BX, CurrentRow + Mov CX, CurrentPattern + Mov DX, CurrentOrder + Mov SI, NumberOfRows + + Pop DS + + Ret + Assume DS:Nothing + +EndP Music_GetPlayMode + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_GetPlayMode2 Far + + Push DS + + Push CS + Pop DS + Assume DS:Music + + Mov AX, PlayMode + Mov EBX, DWord Ptr CurrentOrder + Mov CX, CurrentRow + ShL ECX, 16 + Mov CX, CurrentTick + + Pop DS + Ret + +EndP Music_GetPlayMode2 + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_PlayPattern Far ; AX = pattern, BX = number of rows + ; CX = row to start + + Push DS + + Call Music_Stop + + Push CS + Pop DS + Assume DS:Music + + Mov MIDIPitchDepthSent, 0 + Mov LastMIDIByte, 0FFh + + Mov CurrentPattern, AX + Mov CurrentRow, CX + Dec CX + Mov NumberOfRows, BX + Mov ProcessRow, CX + Mov PlayMode, 1 + + Pop DS + + Ret + +EndP Music_PlayPattern + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_PlaySong Far ; AX = Order + + PushA + Push DS + + Call Music_Stop + + Push CS + Pop DS + Assume DS:Music + + Mov MIDIPitchDepthSent, 0 + Mov LastMIDIByte, 0FFh + + Mov CurrentOrder, AX + Dec AX + Mov ProcessOrder, AX + Mov ProcessRow, 0FFFEh + Mov PlayMode, 2 + + Call StartClock + + Mov BX, MIDICOMMAND_START + Mov SI, Offset SlaveChannelInformationTable + Call MIDITranslate + + Pop DS + PopA + Ret + +EndP Music_PlaySong + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_PlayPartSong Far ; AX = order, BX = row. + + Push AX + Push BX + Push DS + + Call Music_Stop + + Mov CS:NumberOfRows, 200 + Mov CS:ProcessOrder, AX + Mov CS:CurrentOrder, AX + Mov CS:CurrentRow, BX + Dec BX + Mov CS:ProcessRow, BX + + Mov BX, AX + + Mov DS, CS:SongDataArea + MovZX AX, Byte Ptr [DS:BX+100h] + Mov CS:CurrentPattern, AX + + Mov CS:PlayMode, 2 + + Call StartClock + + Pop DS + Pop BX + Pop AX + Ret + +EndP Music_PlayPartSong + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_KBPlaySong Far + + Xor AX, AX + Cmp CS:PlayMode, 2 + JNE Music_PlaySong + + Ret + +EndP Music_KBPlaySong + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_StopChannels + + Push CX + Push DS + Push SI + Push DI + + Push CS + Pop DS + Assume DS:Music + + Mov CX, 64 + Mov SI, Offset HostChannelInformationTable + +Music_StopChannels1: + Mov Word Ptr [SI], 0 + Mov Word Ptr [SI+26h], 0 + Add SI, HOSTCHANNELSIZE + Loop Music_StopChannels1 + + Mov CX, MAXSLAVECHANNELS + Mov SI, Offset SlaveChannelInformationTable + +Music_StopChannels2: + Test Byte Ptr [SI], 1 + JZ Music_StopChannelsNoMIDI + + Cmp Byte Ptr [SI+36h], 100 + JNE Music_StopChannelsNoMIDI + + PushF + ClI + Mov DI, [SI+38h] + Mov BX, MIDICOMMAND_STOPNOTE + Call MIDITranslate + PopF + +Music_StopChannelsNoMIDI: + Mov Word Ptr [SI], 200h + Add SI, SLAVECHANNELSIZE + Loop Music_StopChannels2 + + Pop DI + Pop SI + Pop DS + Pop CX + + Ret + +EndP Music_StopChannels + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_Stop Far + + PushA + PushF + Push DS + Push ES + + CLI + + Push CS + Pop DS + Assume DS:Music + +; Turn off MIDI channels first. + + Test OrderLockFlag, 1 + JZ Music_StopNoOrderLocked + + Call Music_ToggleOrderUpdate + +Music_StopNoOrderLocked: + Mov CX, MAXSLAVECHANNELS + Mov SI, Offset SlaveChannelInformationTable + +Music_StopMIDI1: + Test Byte Ptr [SI], 1 + JZ Music_StopNoMIDI + + Cmp Byte Ptr [SI+36h], 100 + JNE Music_StopNoMIDI + + Mov DI, [SI+38h] + Mov BX, MIDICOMMAND_STOPNOTE + Call MIDITranslate + +Music_StopNoMIDI: + Add SI, SLAVECHANNELSIZE + Loop Music_StopMIDI1 + + Mov BX, MIDICOMMAND_STOP ; Stop + Mov SI, Offset SlaveChannelInformationTable + Call MIDITranslate + + Mov PlayMode, 0 + + Mov DecodeExpectedPattern, 0FFFEh + Mov DecodeExpectedRow, 0FFFEh + Mov RowDelay, 1 + Mov CurrentRow, 0 + Mov CurrentOrder, 0 + Mov CurrentTick, 1 + Mov BreakRow, 0 + + Push CX + Push DS + Push SI + Push DI + + Push CS + Pop ES + + Mov DI, Offset MIDIPrograms + Mov CX, 32 + Mov AX, 0FFFFh + Rep StosW + + Mov DI, Offset HostChannelInformationTable + Mov DS, SongDataArea + Assume DS:Nothing + + Mov SI, 40h + Mov DX, 040h + Xor AX, AX + +Music_Clear1: + Mov CX, 16 + Rep StosW + Mov AL, DH + StosW + + Xor AX, AX + Mov CX, 6 + Rep StosW + + Mov AH, [SI+40h] + LodsB + And AL, 7Fh + StosW + Xor AX, AX + Mov CX, 16 + Rep StosW + + Inc DH + Dec DL + JNZ Music_Clear1 + + ; Now clear SlaveChannel + Mov DX, MAXSLAVECHANNELS + +Music_Clear2: + Mov AX, 200h + StosW + Mov CX, SLAVECHANNELSIZE/2-1 + Xor AX, AX + Rep StosW + Dec DX + JNZ Music_Clear2 + + Push DS + Pop ES ; ES = SongDataArea + + Pop DI + Pop SI + Pop DS + Pop CX + Assume DS:Music + + Mov AX, [ES:32h] ; AL = speed, AH = tempo + Mov BX, [ES:30h] ; BL = globalvol + + Xor DX, DX + Mov DL, AL + Mov GlobalVolume, BL + Mov CurrentSpeed, DX + Mov ProcessTick, DX + Mov Tempo, AH + + Call Music_InitTempo + Call MIDI_ClearTable + + Pop ES + Pop DS + PopF + PopA + + Ret + +EndP Music_Stop + Assume DS:Nothing, ES:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_UpdatePatternOffset Far + + Mov CS:DecodeExpectedPattern, 0FFFEh + + Ret + +EndP Music_UpdatePatternOffset + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_PlayNote Far ; DS:SI points to 5-note struct + ; AX = channel + ; DH = +32 means ignore mute + ; settings + ; DH = +128 means to use central + ; pan and max volume. + PushAD + Push DS + Push ES + + Mov AH, HOSTCHANNELSIZE + Mul AH + Mov DI, Offset HostChannelInformationTable + Add DI, AX + + Mov ES, CS:SongDataArea + + Xor DL, DL ; DL = mask + + ClI + + LodsB + Cmp AL, NONOTE + JE Music_PlayNote1 + + Or DL, 1 + Mov [CS:DI+3], AL + +Music_PlayNote1: + LodsB + Test AL, AL + JZ Music_PlayNote2 + + Or DL, 2 + Mov [CS:DI+4], AL + +Music_PlayNote2: + LodsB + Cmp AL, 0FFh + JE Music_PlayNote3 + + Or DL, 4 + Mov [CS:DI+5], AL + +Music_PlayNote3: + LodsW + Test AX, AX + JZ Music_PlayNote4 + + Or DL, 8 + +Music_PlayNote4: + Push CS + Pop DS + Assume DS:Music + + Push DX + + And DH, 7Fh + Mov [DI+6], AX + Mov [DI+8], AX + Mov [DI+2], DL + And Word Ptr [DI], Not (3+32+64+256) + Or Byte Ptr [DI], DH ; Now for command update count + + Mov AX, CurrentSpeed + Mov [DI+21h], AL + + Call PreInitCommand + + Pop DX + + Test Byte Ptr [DI], 4 + JZ Music_PlayNote5 + + Test DH, 128 + JZ Music_PlayNote5 + + Mov SI, [DI+24h] + Mov Word Ptr [SI+2Ah], 2020h; Pan and pan set. + Mov Byte Ptr [SI+23h], 40h ; Full channel volume. + +Music_PlayNote5: + Mov DecodeExpectedRow, 0FFFEh + StI + + Pop ES + Pop DS + PopAD + + Ret + +EndP Music_PlayNote + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_PlaySample Far + ; AL = Note + ; AH = sample number + ; CX = channel. + + PushAD + Push DS + Push ES + + Push CS + Pop DS + Assume DS:Music + + Mov ES, SongDataArea + + Push AX + + Mov AX, HOSTCHANNELSIZE + Mul CX + Add AX, Offset HostChannelInformationTable + Mov DI, AX + + Pop AX + +; Mov DI, Offset HostChannelInformationTable + + ClI + + Mov Byte Ptr [DI+2], 3 ; Note & Sample + Mov [DI+3], AL ; Note... + Mov Byte Ptr [DI+4], 0FFh + Mov [DI+0Eh], AX + Or Word Ptr [DI], 8020h + + Call InitNoCommand + + Test Byte Ptr [DI], 4 + JZ Music_PlaySample1 + + Mov SI, [DI+24h] + Mov Word Ptr [SI+2Ah], 2020h + Mov Byte Ptr [SI+23h], 40h ; Full channel volume. + Mov Byte Ptr [SI+3Bh], 0 ; Note cut. + Mov Word Ptr [SI+28h], 0 + +Music_PlaySample1: + And Word Ptr [DI], Not 8000h + + Mov DecodeExpectedRow, 0FFFEh + StI + + Pop ES + Pop DS + PopAD + + Ret + +EndP Music_PlaySample + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_GetHostChannelInformationTable Far + + Push CS + Pop DS + Assume DS:Music + + Mov SI, Offset HostChannelInformationTable + + Ret + +EndP Music_GetHostChannelInformationTable + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_GetSlaveChannelInformationTable Far + + Push CS + Pop DS + Assume DS:Music + + Mov SI, Offset SlaveChannelInformationTable + Mov CX, MAXSLAVECHANNELS + + Ret + +EndP Music_GetSlaveChannelInformationTable + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_NextOrder Far + + Push DS + + Push CS + Pop DS + Assume DS:Music + + Cmp PlayMode, 2 + JNE Music_NextOrder1 + + Mov PlayMode, 0 + Call Music_StopChannels + Mov ProcessRow, 0FFFEh + Mov CurrentTick, 1 + Mov RowDelay, 1 + Mov PlayMode, 2 + +Music_NextOrder1: + Pop DS + Ret + +EndP Music_NextOrder + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_LastOrder Far + + Push DS + + Push CS + Pop DS + Assume DS:Music + + Cmp PlayMode, 2 + JNE Music_NextOrder1 + + Mov AX, ProcessOrder + Cmp AX, 0 + JLE Music_LastOrder1 + + ClI + + Mov PlayMode, 0 + Call Music_StopChannels + Sub AX, 2 + Mov ProcessOrder, AX + Mov ProcessRow, 0FFFEh + Mov CurrentTick, 1 + Mov RowDelay, 1 + Mov PlayMode, 2 + + StI + +Music_LastOrder1: + Pop DS + Ret + +EndP Music_LastOrder + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_SetGlobalVolume Far + + Push CX + Push DS + Push SI + + Push CS + Pop DS + Assume DS:Music + + Mov GlobalVolume, AL + Call RecalculateAllVolumes + + Pop SI + Pop DS + Pop CX + Ret + +EndP Music_SetGlobalVolume + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_MuteChannel Far ; AX = channel number + + Push AX + Push CX + Push DS + Push SI + Push DI + + Push CS + Pop DS + Assume DS:Music + + Mov CX, NumChannels + Mov SI, Offset SlaveChannelInformationTable + +Music_MuteChannel1: + Test Byte Ptr [SI], 1 + JZ Music_MuteChannel2 + + Mov AH, [SI+3Ah] + And AH, 07Fh + Cmp AH, AL + JNE Music_MuteChannel2 + + Or Word Ptr [SI], 840h + +Music_MuteChannel2: + Add SI, SLAVECHANNELSIZE + Loop Music_MuteChannel1 + + Pop DI + Pop SI + Pop DS + Pop CX + Pop AX + Ret + +EndP Music_MuteChannel + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_UnmuteChannel Far ; AX = channel number + + Push AX + Push CX + Push DS + Push SI + Push DI + + Push CS + Pop DS + Assume DS:Music + + Mov CX, NumChannels + Mov Word Ptr [SoloSample], 0FFFFh + Mov SI, Offset SlaveChannelInformationTable + +Music_UnmuteChannel1: + Test Byte Ptr [SI], 1 + JZ Music_UnmuteChannel2 + + Mov AH, [SI+3Ah] + And AH, 07Fh + Cmp AH, AL + JNE Music_UnmuteChannel2 + +Comment ~ +Music_UnmuteChannel3: + Test DL, DL + JS Music_UnmuteChannel5 + + Cmp [SI+36h], DL + JE Music_UnmuteChannel2 + +Music_UnmuteChannel4: + Test DH, DH + JS Music_UnmuteChannel5 + + Cmp [SI+33h], DH + JE Music_UnmuteChannel2 + +Music_UnmuteChannel5: +~ + And Byte Ptr [SI+1], Not 8 + Or Byte Ptr [SI], 64 + +Music_UnmuteChannel2: + Add SI, SLAVECHANNELSIZE + Loop Music_UnmuteChannel1 + + Pop DI + Pop SI + Pop DS + Pop CX + Pop AX + Ret + +EndP Music_UnmuteChannel + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_ToggleChannel Far ; AX = channel number. + + Push BX + Push DS + + Mov BX, AX + Mov DS, CS:SongDataArea + + Test Byte Ptr [BX+40h], 80h + JZ Music_ToggleChannel1 + + And Byte Ptr [BX+40h], 7Fh + Call Music_UnmuteChannel + + Mov [CS:MuteChannelTable+BX], 0 + + Pop DS + Pop BX + Ret + +Music_ToggleChannel1: ; Mute channel + Xor [CS:MuteChannelTable+BX], 1 + Or Byte Ptr [BX+40h], 80h + Call Music_MuteChannel + + Pop DS + Pop BX + Ret + +EndP Music_ToggleChannel + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_UnmuteAll Far + + Push BX + Push CX + Push DX + Push DS + Push SI + + Jmp Music_SoloChannel3 + + +Proc Music_SoloChannel Far ; AX = channel + + Push BX + Push CX + Push DX + Push DS + Push SI + ; Check & count whether any playing. + + Mov BX, AX + + Mov DS, CS:SongDataArea + Mov SI, 40h + Mov CX, SI + Mov DX, CX + +Music_SoloChannel1: + LodsB + ShL AL, 1 + SbB DX, 0 + + Loop Music_SoloChannel1 + ; DX = num playing. + Cmp DX, 1 + JNE Music_SoloChannel6 + +Music_SoloChannel2: ; check whether it's the current + Test Byte Ptr [BX+40h], 80h + JZ Music_SoloChannel3 + +Music_SoloChannel6: + Mov CX, 64 ; 64 channel to step through + ; turn 'em all off. +Music_SoloChannel7: + Mov SI, CX + Dec SI + Cmp SI, BX + JE Music_SoloChannel9 + + Test Byte Ptr [SI+40h], 80h + JNZ Music_SoloChannel8 + +Music_SoloChannel10: + Mov AX, SI + Call Music_ToggleChannel + +Music_SoloChannel8: + Loop Music_SoloChannel7 + Jmp Music_SoloChannel11 + +Music_SoloChannel9: + Test Byte Ptr [SI+40h], 80h + JZ Music_SoloChannel8 + Jmp Music_SoloChannel10 + +Music_SoloChannel3: ; solo pressed on already soloed + ; channel -> turn everything on. + Mov CX, 64 + +Music_SoloChannel4: + Mov BX, CX + Dec BX + Cmp [CS:MuteChannelTable+BX], 1 + JNE Music_SoloChannel5 + + Mov AX, BX + Call Music_ToggleChannel + +Music_SoloChannel5: + Loop Music_SoloChannel4 + +Music_SoloChannel11: + Pop SI + Pop DS + Pop DX + Pop CX + Pop BX + + Ret + +EndP Music_SoloChannel +EndP Music_UnmuteAll + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_InitMuteTable Far + + Push AX + Push CX + Push ES + Push DI + + Mov DI, Offset MuteChannelTable + Mov CX, 32 + Push CS + Pop ES + + Xor AX, AX + Rep StosW + + Mov DWord Ptr [CS:SoloSample], 0FFFFh + + Pop DI + Pop ES + Pop CX + Pop AX + + Ret + +EndP Music_InitMuteTable + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_InitStereo Far + + Push DS + + Mov DS, CS:SongDataArea + Mov AL, [DS:2Ch] + And AL, 1 + + Call [DriverSetStereo] + + Push CS + Pop DS + Call RecalculateAllVolumes + + Pop DS + Ret + +EndP Music_InitStereo + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_IncreaseSpeed Far ; Returns AX = speed + + Mov AX, CS:CurrentSpeed + Cmp AX, 1 + JE Music_IncreaseSpeed1 + + Dec AX + Mov CS:CurrentSpeed, AX + Push DS + + Mov DS, SongDataArea + Mov [DS:32h], AL + + Pop DS + +Music_IncreaseSpeed1: + Ret + +EndP Music_IncreaseSpeed + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_DecreaseSpeed Far + + Mov AX, CS:CurrentSpeed + Cmp AX, 0FFh + JAE Music_DecreaseSpeed1 + + Inc AX + Mov CS:CurrentSpeed, AX + Push DS + + Mov DS, SongDataArea + Mov [DS:32h], AL + + Pop DS + + +Music_DecreaseSpeed1: + Ret + +EndP Music_DecreaseSpeed + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_SetSoundCard Far ; AL contains sound card num + + Xor AH, AH + + Push EBX + + Mov BX, CS + ShL EBX, 16 + + Mov BX, AX + Add BX, BX + Mov BX, [CS:DriverSoundCard+BX] + Add BX, BX + Mov BX, [CS:DriverNameTable+BX] + Mov [CS:DriverName], EBX + + Pop EBX + + Ret + +EndP Music_SetSoundCard + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_SetSoundCardDriver Far + + Mov Word Ptr [CS:DriverName], SI + Mov Word Ptr [CS:DriverName+2], DS + + Ret + +EndP Music_SetSoundCardDriver + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_SetDMA Far + + Xor AH, AH + Mov DMA, AX + + Ret + +EndP Music_SetDMA + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_SetMixSpeed Far + Assume DS:Nothing + + Mov CmdLineMixSpeed, CX + + Ret + +EndP Music_SetMixSpeed + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_SetIRQ Far + Assume DS:Nothing + + Mov IRQ, CX + + Ret + +EndP Music_SetIRQ + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_SetAddress Far + + Mov BasePort, DX + + Ret + +EndP Music_SetAddress + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_GetDisplayVariables Far + + Mov AX, CS:CurrentSpeed + MovZX BX, CS:Tempo + MovZX CX, CS:GlobalVolume + + Ret + +EndP Music_GetDisplayVariables + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_AssignSampleToInstrument Far ; BX = sample num + ; returns AX + + Push CX DX DS SI ES DI + + Push CS + Pop DS + Assume DS:Music + + Mov ES, SongDataArea + +; Check for sample-number's instrument first. + Mov AX, 554 + Mul BX + Mov DI, AX + Add DI, 512 + + LEA AX, [BX+1] + Mov SI, Offset InstrumentHeader + Mov CX, 554 + + RepE CmpsB + JE Music_AssignSampleToInstrument4 + +; Search + Mov CX, 99 + Mov DI, 512 ; Points to first inst. + Mov AX, 1 + +Music_AssignSampleToInstrument1: + Push CX + + Mov SI, Offset InstrumentHeader + Mov CX, 554 + + RepE CmpsB + JE Music_AssignSampleToInstrument2 + + Add DI, CX + Pop CX + Inc AX + Loop Music_AssignSampleToInstrument1 + + StC + +Music_AssignSampleToInstrumentEnd: + Pop DI ES SI DS DX CX + Ret + +Music_AssignSampleToInstrument2: + Pop CX ; Clear the stack + +Music_AssignSampleToInstrument4: +IF NETWORKENABLED + Call Network_GetSendQueue + JZ Music_AssignSampleNetwork + + Mov SI, AX + Mov AX, 400h + StosW + Mov AX, SI + Dec AX + StosB + +Music_AssignSampleNetwork: + Call Network_FinishedSendQueue +ENDIF + + Push ES + Pop DS + + Sub DI, 554-20h ; Points to name + Mov SI, BX + Mov SI, [64912+SI+BX] + Add SI, 14h + + Mov CX, 26 + Rep MovsB + + Add DI, 7 + + ; Now to fill in table. + Mov CX, 120 + Inc BX + +Music_AssignSampleToInstrument3: + Mov [DI], BL +; Add DI, 2 + ScasW + Loop Music_AssignSampleToInstrument3 + + ClC + Jmp Music_AssignSampleToInstrumentEnd + +EndP Music_AssignSampleToInstrument + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_SetLimit Far + + Mov CS:CmdLineNumChannels, CX + Ret + +EndP Music_SetLimit + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_ReverseChannels Far + + Mov CS:ReverseChannels, 1 + Ret + +EndP Music_ReverseChannels + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_IncreaseVolume Far + + Push CX + Push DS + Push SI + + Push CS + Pop DS + Assume DS:Music + + Mov AL, GlobalVolume + And AX, 0FFh + Cmp AX, 128 + JAE Music_IncreaseVolume1 + + Inc AX + Mov GlobalVolume, AL + Call RecalculateAllVolumes + +Music_IncreaseVolume1: + Pop SI + Pop DS + Pop CX + + Ret + +EndP Music_IncreaseVolume + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_DecreaseVolume Far + + Push CX + Push DS + Push SI + + Push CS + Pop DS + Assume DS:Music + + Mov AL, GlobalVolume + And AX, 0FFh + JZ Music_DecreaseVolume1 + + Dec AX + Mov GlobalVolume, AL + Call RecalculateAllVolumes + +Music_DecreaseVolume1: + Pop SI + Pop DS + Pop CX + + Ret + +EndP Music_DecreaseVolume + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_RegetLoopInformation Far + + Push AX + Push BX + Push CX + Push DX + + Push DS + Push SI + Push ES + + Push CS + Pop DS ; DS setup + Assume DS:Music + + Mov ES, SongDataArea + + Mov CX, NumChannels + Mov SI, Offset SlaveChannelInformationTable + +Music_RegetLoopInformation1: + Test Byte Ptr [SI], 1 + JZ Music_RegetLoopInformation2 + + Push CX + ClI + + Call GetLoopInformation + + Or Byte Ptr [SI], 40h + + StI + Pop CX + +Music_RegetLoopInformation2: + Add SI, SLAVECHANNELSIZE + Loop Music_RegetLoopInformation1 + + + + Pop ES + Pop SI + Pop DS + + Pop DX + Pop CX + Pop BX + Pop AX + + Ret + +EndP Music_RegetLoopInformation + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ResetSoundCardMemory Far + + Jmp [DriverResetMemory] + +EndP ResetSoundCardMemory + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_SoundCardLoadSample Far ; AX = sample number + ; (1 based) + ; Carry set if insuf mem + PushA + Call [DriverLoadSample] + PushF + + JC Music_SoundCardLoadSample1 + + Mov CX, 2 + Mov DI, Offset O1_OutOfSoundCardMemoryList + Call M_Object1List + +Music_SoundCardLoadSample1: + PopF + PopA + Ret + +EndP Music_SoundCardLoadSample + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_SoundCardLoadAllSamples Far + + PushAD + Push DS + + Call Music_Stop + Call S_SaveScreen + + Push 30 + Push 28 + Push 50 + Push 30 + Push 3 + Call S_DrawBox + Add SP, 10 + + Push CS + Pop DS + + Mov DI, (32+29*80)*2 + Mov SI, Offset PrepareSamplesMsg + Mov AH, 20h + Call S_DrawString + + Call S_UpdateScreen + + Call ResetSoundCardMemory + + Mov AX, 1 + +Music_SoundCardLoadAllSamples1: + Call Music_SoundCardLoadSample + JNC Music_SoundCardLoadAllSamples2 + + Inc AX + Cmp AX, 100 + JBE Music_SoundCardLoadAllSamples1 + +Music_SoundCardLoadAllSamples3: + Call S_RestoreScreen + +Music_SoundCardLoadAllSamples2: + Pop DS + PopAD + + Mov AX, 1 + Ret + +EndP Music_SoundCardLoadAllSamples + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_GetFreeSoundCardMemory Far + + Call [DriverGetStatus] + Ret + +EndP Music_GetFreeSoundCardMemory + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_GetNumChannels Far + + Mov AX, CS:NumChannels + + Ret + +EndP Music_GetNumChannels + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_GetPitchTable Far ; Returns ES:DI to pitch table + + Push CS + Pop ES + Mov DI, Offset PitchTable + + Ret + +EndP Music_GetPitchTable + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_ToggleReverse Far + + Push CS + Pop DS + Assume DS:Music + + Xor ReverseChannels, 1 + Call ReCalculateAllVolumes + Mov SI, Offset ReverseMsg + Call SetInfoLine + + Ret + +EndP Music_ToggleReverse + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_PatternStorage Far + + Mov CS:PatternStorage, AL + Ret + +EndP Music_PatternStorage + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_InitMixTable Far + + Push AX + Push DS + + Xor AX, AX + Mov DS, CS:SongDataArea + Mov AL, Byte Ptr [DS:31h] ; AL = 0->128 + + Call [DriverSetMixVolume] + + Pop DS + Pop AX + Ret + +EndP Music_InitMixTable + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_GetTempo Far + + Xor BH, BH + Mov BL, CS:Tempo + + Ret + +EndP Music_GetTempo + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_GetLastChannel Far ; Returns AX + + Push DS + + Mov DS, CS:SongDataArea + Xor SI, SI + Mov CX, 64 + Xor AX, AX + Xor DX, DX + +Music_GetLastChannel1: + Mov BL, [SI+40h] + ShR BL, 7 + Xor BL, [CS:MuteChannelTable+SI] + JNZ Music_GetLastChannel2 + + Mov AX, DX + +Music_GetLastChannel2: + Inc DX + Inc SI + Loop Music_GetLastChannel1 + + Pop DS + Ret + +EndP Music_GetLastChannel + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_GetDriverScreen Far + + Jmp [DriverSoundCardScreen] + +EndP Music_GetDriverScreen + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_GetDriverVariable Far + + Jmp [DriverGetVariable] + +EndP Music_GetDriverVariable + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_SetDriverVariable Far + + Jmp [DriverSetVariable] + +EndP Music_SetDriverVariable + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_SetNextOrder Far + + Dec AX + Mov CS:ProcessOrder, AX + + Ret + +EndP Music_SetNextOrder + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_GetDelay Far + + ClI + + Xor DX, DX + Mov CX, CS:PlayMode + Test CX, CX + JZ Music_GetDelay2 + + Mov DX, CS:CurrentSpeed + Cmp AX, CS:CurrentRow + JNE Music_GetDelay3 + + Sub DX, CS:ProcessTick + JZ Music_GetDelay2 + + Cmp DX, 0Fh + JAE Music_GetDelay4 + Jmp Music_GetDelay1 + +Music_GetDelay3: + Dec DX + Cmp DX, 0Fh + JBE Music_GetDelay1 + +Music_GetDelay4: + Mov DX, 0Fh + +Music_GetDelay1: + ShL DX, 8 + Or DX, 'S'-'@'+0D000h + +Music_GetDelay2: + StI + Ret + +EndP Music_GetDelay + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +StopSong DB 0 +TimerCounter DD 0 +TotalTimer DD 0 +TotalTimerHigh DD 0 +PleaseWaitMsg DB "Please Wait...", 0 + +Proc InternalTimer Far + + PushAD + + Mov EAX, 0C214h + Mov DX, 16h ; Ticks = (1193181/(2*0.4))/Tempo + Div BX + Add EAX, EAX + Mov CS:TimerCounter, EAX + + PopAD + Ret + +EndP InternalTimer + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_TimeSong Far ; Time song! + + Push CS + Pop DS + Assume DS:Music + + Call S_SaveScreen + + Mov AL, 1 + Call S_SetDirectMode + Call S_DrawSmallBox + + Mov SI, Offset PleaseWaitMsg + Mov AH, 20h + Mov DI, (33+26*80)*2 + Call S_DrawString + + Call Music_Stop + + Mov CX, 0FFFFh + +Music_TimeSong1: + In AL, 21h ; Delay mechanism + In AL, 0A1h ; Delay mechanism + Loop Music_TimeSong1 + + Mov StopSong, 0 + Mov TotalTimer, 0 + Mov TotalTimerHigh, 0 + + ClI + In AL, 0A1h + Mov AH, AL + In AL, 21h + Push AX + + Mov AL, 0FFh + Out 0A1h, AL + Out 21h, AL + + Push DWord Ptr [DriverSetTempo] + + Mov AX, CS + ShL EAX, 16 + Mov AX, Offset InternalTimer + Mov [DriverSetTempo], EAX + + Push Word Ptr [NumChannels] + + Mov ES, SongDataArea + + Push Word Ptr [ES:2Ch] + And Byte Ptr [ES:2Ch], Not 4 + + Xor AX, AX + Call Music_PlaySong + +Music_TimeSong3: + Assume DS:Nothing + Call Update + + Cmp CS:StopSong, 0 + JNE Music_TimeSong4 + + Mov EAX, CS:TimerCounter + Add CS:TotalTimer, EAX + AdC CS:TotalTimerHigh, 0 + Jmp Music_TimeSong3 + +Music_TimeSong4: + Call Music_Stop + + Mov ES, CS:SongDataArea + + Pop Word Ptr [ES:2Ch] + Pop Word Ptr [CS:NumChannels] + Pop DWord Ptr [CS:DriverSetTempo] + + Pop AX + Out 21h, AL + Mov AL, AH + Out 0A1h, AL + + StI + + Mov AL, 0 + Call S_SetDirectMode + + Call S_RestoreScreen + + Mov CX, 0FFFFh + Mov DI, Offset O1_ShowTime + Call M_Object1List + + Mov AX, 1 + Ret + +EndP Music_TimeSong + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_ShowTime Far + + Call S_GetDestination + + Mov EDX, CS:TotalTimerHigh + Mov EAX, CS:TotalTimer + + SHRD EAX, EDX, 16 + + Mov DI, (43+27*80)*2 + Call D_ShowTime + + Ret + +EndP Music_ShowTime + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_GetPatternLength Far + + Mov AX, CS:NumberOfRows + Ret + +EndP Music_GetPatternLength + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_SaveMIDIConfig Far + + Call D_GotoStartingDirectory + + Push CS + Pop DS + Assume DS:Music + + Mov AH, 3Ch + Xor CX, CX + Mov DX, Offset MIDIConfigFileName + Int 21h + JC Music_SaveMIDIConfig1 + + Mov BX, AX + + Mov AH, 40h + Mov DS, CS:MIDIDataArea + Xor DX, DX + Mov CX, (128+16+9)*32 + Int 21h + + Mov AH, 3Eh + Int 21h + +Music_SaveMIDIConfig1: + Xor AX, AX + Ret + +EndP Music_SaveMIDIConfig + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_GetMIDIDataArea Far + + Mov DS, CS:MIDIDataArea + Ret + +EndP Music_GetMIDIDataArea + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_ToggleOrderUpdate Far + + Push CS + Pop DS + Assume DS:Music + + Mov SI, Offset OrderUpdateEnabledMsg + Xor OrderLockFlag, 1 + JZ Music_ToggleOrderUpdate1 + + Mov SI, Offset OrderUpdateDisabledMsg + +Music_ToggleOrderUpdate1: + Call SetInfoLine + + Ret + +EndP Music_ToggleOrderUpdate + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_ToggleSoloInstrument Far + + Mov SI, Offset SoloInstrumentMsg + Mov DI, Offset SoloInstrument + Mov BP, 1 + Jmp Music_ToggleSolo + +EndP Music_ToggleSoloInstrument + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_ToggleSoloSample Far + + Mov SI, Offset SoloSampleMsg + Mov DI, Offset SoloSample + Xor BP, BP + +EndP Music_ToggleSoloSample + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Music_ToggleSolo Far + + Push CS + Pop DS + Assume DS:Music + + Call PE_GetLastInstrument ; Returns BX + + Mov AX, BX + Add BX, BP + + Cmp [DI], BL + Mov Word Ptr [SoloSample], 0FFFFh + JE Music_ToggleSolo1 + + Inc AX + Mov Byte Ptr [DI], BL + + Jmp Music_ToggleSolo2 + +Music_ToggleSolo1: + Mov SI, Offset UnsoloMsg + +Music_ToggleSolo2: + Call SetInfoLine + + Mov CX, NumChannels + Mov SI, Offset SlaveChannelInformationTable + Xor BX, BX + + Mov ES, SongDataArea + +Music_ToggleSolo3: + Or Byte Ptr [SI], 18 + Mov BL, [SI+3Ah] ; BX = channel + + Test Byte Ptr [ES:BX+40h], 80h + JNZ Music_ToggleSolo4 + + And Word Ptr [SI], Not 800h + +Music_ToggleSolo4: + Add SI, SLAVECHANNELSIZE + Dec CX + JNZ Music_ToggleSolo3 + + Call RecalculateAllVolumes + + Mov AX, 1 + Ret + +EndP Music_ToggleSolo + Assume DS:Nothing + + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +EndS + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +End diff --git a/IT_M_EFF.INC b/IT_M_EFF.INC new file mode 100644 index 0000000..0bbc2be --- /dev/null +++ b/IT_M_EFF.INC @@ -0,0 +1,2945 @@ +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +SlideTable DB 1, 4, 8, 16, 32, 64, 96, 128, 255 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Comment ~ + +Proc GetC5Speed + + Push BX + Push SI + Push BP + + Cmp Byte Ptr [DI+0Fh], 101 ; MIDI sample + JNE GetC5Speed1 + +; OK.. we have a MIDI sample +; Check whether the midi sample points to a valid sample +; And if so, use that sample's C5 speed. + Mov SI, [DS:DI+3] ; Not a note? + And SI, 0FFh + + Mov BP, [DS:DI+4] + And EBP, 0FFh + JZ GetC5Speed1 ; No sample? + + Add SI, SI + Mov BP, [ES:64710+EBP+EBP] + + Mov AX, [ES:BP+SI+40h] ; AL = note + ; AH = sample. + + Test AH, AH ; No sample? + JZ GetC5Speed1 + Mov SI, AX + ShR SI, 8 + + Add SI, SI + Mov SI, [ES:64910+SI] ; Sample offset + Test Byte Ptr [ES:SI+12h], 1 + JZ GetC5Speed1 + + Mov BX, SI + +GetC5Speed1: + Mov EAX, [ES:BX+3Ch] ; EAX = C5Spd + + Pop BP + Pop SI + Pop BX + + Ret + +EndP GetC5Speed + +~ + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc InitVolumeEffect ; Done A, B, H + + Test Byte Ptr [DI+2], 44h + JNZ InitVolumeProcess + +InitVolumeEffectNoEffect: + Ret + +InitVolumeProcess: + Mov AL, [DI+5] + Mov AH, AL + + And AL, 7Fh + Sub AL, 65 + JC InitVolumeEffectNoEffect + + Test AH, 80h + JZ InitVolumeEffect1 + + Add AL, 60 + +InitVolumeEffect1: + Mov DL, 10 + Xor AH, AH + Div DL ; AL = effect number + ; AH = effect parameter + Mov [DI+0Ah], AL ; Store effect number + + ; Memory for effects A->D, (EFG)/H dont' share. + + ; Effects Ax and Bx (fine volume slide up and down) require immediate + ; handling. No flags required. (effect 0 and 1) + + ; Effects Cx, Dx, Ex, Fx (volume/pitch slides) require flag to be + ; set (effects 2->5) + + ; Effects Gx and Hx need init (handling) code + flags. + ; (effects 6 and 7). + + Test AH, AH + JZ InitVolumeEffectNoMemory + + Cmp AL, 4 + JB InitNormalMemory + + Cmp AL, 6 + JB InitSlideMemory + JA InitVolumeEffectNoMemory + + MovZX BX, AH + Mov DL, [SlideTable+BX-1] + + Test Byte Ptr [ES:2Ch], 20h ; Link command G? + JZ CommandGMemoryOldEffects + + Mov [DI+1Eh], DL + Jmp InitVolumeEffectNoMemory + +CommandGMemoryOldEffects: + Mov [DI+11h], DL + Jmp InitVolumeEffectNoMemory + +InitSlideMemory: + ShL AH, 2 + Mov [DI+11h], AH + Jmp InitVolumeEffectNoMemory + +InitNormalMemory: + Mov [DI+0Bh], AH + +InitVolumeEffectNoMemory: + Test Byte Ptr [DI], 4 ; Channel not on! + JZ InitVolumeEffect3 + Mov SI, [DI+24h] + + Cmp AL, 1 + JA InitVolumeEffect2 + Mov AL, [DI+0Bh] + JE InitVolumeEffectB + +InitVolumeEffectA: ; Fine volume slide up. + Add AL, [SI+22h] + Cmp AL, 64 + JBE InitVolumeEffectABEnd + Mov AL, 64 + Jmp InitVolumeEffectABEnd + +InitVolumeEffectB: ; Fine volume slide down + Sub AL, [SI+22h] + Neg AL + JNS InitVolumeEffectABEnd + Xor AL, AL + +InitVolumeEffectABEnd: + Jmp CommandD2 + +InitVolumeEffect2: + Or Word Ptr [DI], 100h + + Cmp AL, 6 + JA InitVolumeEffectH + JE InitVolumeEffectG + +InitVolumeEffectCDEF: +InitVolumeEffectEnd: + Ret + +InitVolumeEffect3: + Cmp AL, 7 ; Vibrato? + JNE InitVolumeEffectCDEF + +InitVolumeEffectH: + ShL AH, 2 + JZ InitVolumeEffectH1 + + Mov [DI+3Ah], AH + +InitVolumeEffectH1: + Test Byte Ptr [DI], 4 + JZ InitVolumeEffectCDEF + + Jmp InitVibrato + +InitVolumeEffectG: + Jmp InitCommandG11 + +EndP InitVolumeEffect + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc VolumeCommandC + + Mov SI, [DI+24h] + Mov AL, [DI+0Bh] + Add AL, [SI+22h] + Cmp AL, 64 + JBE VolumeCommandC1 + + And Word Ptr [DI], Not 100h ; Turn off effect calling + Mov AL, 64 + +VolumeCommandC1: + Jmp CommandD2 + +EndP VolumeCommandC + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc VolumeCommandD + + Mov SI, [DI+24h] + Mov AL, [SI+22h] + Sub AL, [DI+0Bh] + JNC VolumeCommandD1 + + And Word Ptr [DI], Not 100h ; Turn off effect calling + Xor AL, AL + +VolumeCommandD1: + Jmp CommandD2 + +EndP VolumeCommandD + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc VolumeCommandE ; Pitch slide down + + Mov BX, [DI+11h] + And BX, 0FFh + ShL BX, 2 + Jmp CommandEChain + Ret + +EndP VolumeCommandE + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc VolumeCommandF + + Mov BX, [DI+11h] + And BX, 0FFh + ShL BX, 2 + Jmp CommandFChain + +EndP VolumeCommandF + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc VolumeCommandG + + Test Byte Ptr [DI], 16 + JZ VolumeCommandGEnd + + Mov BX, [DI+11h] + + Test Byte Ptr [ES:2Ch], 20h ; Command G linked? + JZ VolumeCommandGMemoryOldEffects + + Mov BX, [DI+1Eh] + +VolumeCommandGMemoryOldEffects: + And BX, 0FFh + JZ VolumeCommandGEnd + + ShL BX, 2 + + Mov SI, [DI+24h] + + Cmp Byte Ptr [DI+42h], 1 + JE VolumeCommandG1 + ; Slide down + Call PitchSlideDown + ; Check that frequency is above porta + ; to frequency. + Mov EAX, [SI+10h] + Cmp EAX, [DI+34h] + JA VolumeCommandG6 + +VolumeCommandG4: + Mov EAX, [DI+34h] + And Word Ptr [DI], Not (110h) ; Turn off calling + +VolumeCommandG3: + Mov [SI+10h], EAX + +VolumeCommandG6: + Mov [SI+14h], EAX + +VolumeCommandGEnd: + Ret + +VolumeCommandG1: ; Slide up! + Call PitchSlideUp + ; Check that + ; 1) Channel is on + ; 2) Frequency (set) is below porta to + ; frequency + Mov EAX, [SI+10h] + + Test Word Ptr [SI], 200h + JNZ VolumeCommandG5 + + Cmp EAX, [DI+34h] + JB VolumeCommandG6 + +VolumeCommandG5: + And Word Ptr [SI], Not 200h + Or Byte Ptr [DI], 4 ; Turn on. + Jmp VolumeCommandG4 + +EndP VolumeCommandG + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +InitNoCommand4: + Test CH, 4 + JZ InitNoCommand10 ; Taken if the channel's off. + + Mov SI, [DI+24h] + + Cmp AL, 0FEh + JA InitNoCommand5 ; Noteoff + JNE InitNoCommandNoteFade + + And CH, Not 4 + + Cmp Byte Ptr [SI+36h], 100 + JE MIDINoteCut + + Test Byte Ptr CS:DriverFlags, 2 + JNZ MIDINoteCut + + Mov Word Ptr [SI], 200h + Jmp NoOldEffect + +MIDINoteCut: +; And CH, Not 4 + Or Word Ptr [SI], 200h + +InitNoCommand10: ; Jump point. + Jmp NoOldEffect ; InitNoCommand1 + +InitNoCommandNoteFade: + Or Byte Ptr [SI], 8 ; Note fade + + Jmp NoOldEffect ; InitNoCommand1 + +InitNoCommand5: + Or Byte Ptr [SI], 4 ; Note off + +; Cmp Byte Ptr [SI+22h], 0 ; Volume = 0??? +; JE InitNoCommand13 + Jmp InitNoCommand11 + +Proc InitNoCommand ; DS:DI points to CIT area. + + Assume DS:Music + Mov CL, [DI+2] ; CL = mask + Mov CH, [DI] ; CH = channel info. + + Test CL, 33h + JZ NoOldEffect ; InitCommand1 + + ; Note here! + ; Check for noteoff. + Mov AL, [DI+0Eh] + Cmp AL, 120 + JAE InitNoCommand4 + + Test CH, 4 + JZ InitNoCommand9 + + Mov SI, [DI+24h] + Test CL, 11h + JNZ InitNoCommand9 + + Mov BX, [SI+32h] + Cmp BX, [DI+03h] + JE NoOldEffect ; InitNoCommand1 + +InitNoCommand9: + Test CL, 44h + JZ NoVolumePorta + + Cmp Byte Ptr [DI+5], 193 + JB NoVolumePorta + Cmp Byte Ptr [DI+5], 202 + JA NoVolumePorta + + Test Byte Ptr [DI], 4 + JNZ InitVolumeEffect + +NoVolumePorta: + Call AllocateChannel +; JC InitNoCommand1 + JC NoOldEffect + ; Channel allocated. + ; put volume + Mov BX, [SI+34h] ; Sample offset. + Mov AL, [DI+22h] + Mov AH, AL + Mov [SI+21h], AX ; Volset + + Test Byte Ptr [ES:2Ch], 4 ; Instrument mode? + JNZ InitNoCommandNoDefaultPan + + Mov AL, [ES:BX+2Fh] + Test AL, AL + JNS InitNoCommandNoDefaultPan + + Mov AH, AL + And AX, 7F7Fh + Mov [DI+2Eh], AL + Mov [SI+2Ah], AX + +InitNoCommandNoDefaultPan: + Mov EAX, [ES:BX+3Ch] ; EAX = C5Spd +; Call GetC5Speed + + Xor EBX, EBX + Mov [SI+2Ch], EBX + Mov [SI+48h], BX + Mov [SI+4Ch], EBX + ; Calculate frequency. + Mov BL, [DI+0Eh] ; BL = note. + + Mul [PitchTable+4*EBX] + SHRD EAX, EDX, 16 + Mov [SI+10h], EAX + Mov [SI+14h], EAX + + Or CH, 4 + And CH, Not 16 + +InitNoCommand11: + Push CX + Call GetLoopInformation + Pop CX + +InitNoCommand1: + Test CL, 22h+44h + JZ InitNoCommand3 + + Mov AH, [ES:2Ch] ; Instrument mode and old effects? + And AH, 14h + Cmp AH, 14h + JNE NoOldEffect +; Test AH, 4 +; JZ NoOldEffect + + Test CL, 22h + JZ NoOldEffect + + MovZX EBX, Byte Ptr [DI+4] + Cmp BL, 0FFh + JE NoOldEffect + + Mov Word Ptr [SI+26h], 0400h + Mov BX, [ES:EBX*2+64710] ; Instrument offset. + + Call InitPlayInstrument + +NoOldEffect: + Test CL, 44h + JZ InitNoCommand7 + + Mov AL, [DI+5] + Cmp AL, 64 + JBE InitNoCommand8 ; Volume set... + + Mov AH, AL + And AH, 7Fh + Sub AH, 65 + JNC InitNoCommand7 + +InitNoCommandPanning: ; Panning set! + Mov [DI], CH + + Sub AL, 128 + Call InitCommandX2 ; Destroys (SI), AX + +InitNoCommand7: + Test CL, 22h ; Instrument present? -> + ; Change volume + JZ InitNoCommand3 + + Mov BL, [DI+0Fh] ; Get instrument offset. + And BX, 0FFh + JZ InitNoCommand3 + + Add BX, BX + Mov BX, [ES:64910+BX] + + Mov AL, [ES:BX+13h] ; Default volume + +InitNoCommand8: + Mov [DI+22h], AL + + Test CH, 4 + JZ InitNoCommand3 + + Mov SI, [DI+24h] + + Mov AH, AL + Mov [SI+21h], AX + Or Byte Ptr [SI], 10h ; recalc volume + +InitNoCommand3: ; Randomise volume if required. + Test Byte Ptr [DI], 80h + Mov [DI], CH + JZ InitNoCommandEnd + + Push CX + Call ApplyRandomValues + Pop CX + +InitNoCommandEnd: + Jmp InitVolumeEffect + +EndP InitNoCommand + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc InitCommandA + + Assume DS:Music + + Mov AL, [DS:DI+7] + And AX, 0FFh + JZ InitCommandA_1 + + Mov CX, CurrentSpeed + Sub CurrentTick, CX + Sub ProcessTick, CX + Add CurrentTick, AX + Add ProcessTick, AX + Mov CurrentSpeed, AX + +InitCommandA_1: + Jmp InitNoCommand + +EndP InitCommandA + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc InitCommandB + Assume DS:Music + + MovZX AX, Byte Ptr [DI+7] + Cmp AX, CurrentOrder + JA InitCommandB1 + + Mov StopSong, 1 + +InitCommandB1: + Dec AX + Mov ProcessOrder, AX + Mov ProcessRow, 0FFFEh + + Jmp InitNoCommand + +EndP InitCommandB + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc InitCommandC + + Assume DS:Music + + Cmp PatternLooping, 0 + JNE InitCommandC1 + + MovZX AX, Byte Ptr [DS:DI+7] + Mov BreakRow, AX + + Mov ProcessRow, 0FFFEh + +InitCommandC1: + Jmp InitNoCommand + +EndP InitCommandC + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc InitCommandD + Assume DS:Music + + Call InitNoCommand + + Mov AL, [DI+7] + Test AL, AL + JZ InitCommandD1 + + Mov [DI+10h], AL + +InitCommandD1: + Test Byte Ptr [DI], 4 + JZ InitCommandD6 + + Mov SI, [DI+24h] + +InitCommandD7: ; Jmp point for Lxx + Mov AL, [DI+10h] + Or Byte Ptr [SI], 16 ; Recalc vol + + Mov AH, AL + Test AH, 0Fh + JZ InitCommandD2 + Test AH, 0F0h + JZ InitCommandD3 + And AX, 0FF0h + Cmp AH, 0Fh + JE InitCommandD5 + Cmp AL, 0F0h + JE InitCommandD4 + +InitCommandD6: + Ret + +InitCommandD2: ; Slide up. + ShR AL, 4 + Mov [DI+30h], AL + + Or Byte Ptr [DI], 1 + Cmp AL, 0Fh + JE InitCommandD8 + + Ret + +InitCommandD8: + Jmp CommandD + +InitCommandD3: ; Slide down + Neg AL + Mov [DI+30h], AL + + Or Byte Ptr [DI], 1 + Cmp AL, -15 + JE InitCommandD9 + + Ret + +InitCommandD9: + Jmp CommandD + +InitCommandD4: ; Slide down (fine) + Mov Byte Ptr [DI+30h], 0 + Mov AL, [SI+22h] + Sub AL, AH ; Slide down + JNS InitCommandD4_1 + + Xor AL, AL + +InitCommandD4_1: + Mov AH, AL + Mov [SI+21h], AX + Mov [DI+22h], AL + Ret + +InitCommandD5: ; Slide up (fine) + Mov Byte Ptr [DI+30h], 0 + + ShR AL, 4 + Mov AH, [SI+22h] + Add AL, AH + Cmp AL, 64 + JBE InitCommandD4_1 + + Mov AL, 64 + Jmp InitCommandD4_1 + +EndP InitCommandD + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc InitCommandE + Assume DS:Music + + Call InitNoCommand + + Mov AL, [DI+7] + Test AL, AL + JZ InitCommandE2 + + Mov [DI+11h], AL + +InitCommandE2: + Test Byte Ptr [DI], 4 + JZ InitCommandE1 + + Mov SI, [DI+24h] + Mov AL, [DI+11h] + + Test AL, AL + JZ InitCommandE1 ; still no slide?? + + Mov AH, AL + And AH, 0F0h + Cmp AH, 0E0h + JB InitCommandE4 + + And AL, 0Fh + JZ InitCommandE1 + + Xor BX, BX + + Cmp AH, 0E0h + JE InitCommandE5 + + ShL AL, 2 + +InitCommandE5: + Mov BL, AL + Call PitchSlideDown + + Mov EAX, [SI+10h] + Mov [SI+14h], EAX + Ret + +InitCommandE4: + Xor AH, AH + ShL AX, 2 + Mov [DI+40h], AX + Or Byte Ptr [DI], 1 ; call update only if necess. + +InitCommandE1: + Ret + +EndP InitCommandE + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc InitCommandF + Assume DS:Music + + Call InitNoCommand + + Mov AL, [DI+7] + Test AL, AL + JZ InitCommandF2 + + Mov [DI+11h], AL + +InitCommandF2: + Test Byte Ptr [DI], 4 + JZ InitCommandF1 + + Mov SI, [DI+24h] + ; OK.. now processing is dependent + ; upon slide mode. + + Mov AL, [DI+11h] + Test AL, AL + JZ InitCommandF1 ; still no slide?? + + Mov AH, AL + And AH, 0F0h + Cmp AH, 0E0h + JB InitCommandF4 + + And AL, 0Fh + JZ InitCommandF1 + + Xor BX, BX + + Cmp AH, 0E0h + JE InitCommandF5 + + ShL AL, 2 + +InitCommandF5: + Mov BL, AL + Call PitchSlideUp + + Mov EAX, [SI+10h] ; Update frequency set field. + Mov [SI+14h], EAX + Ret + +InitCommandF4: + Xor AH, AH + ShL AX, 2 + Mov [DI+40h], AX + Or Byte Ptr [DI], 1 ; call update only if necess. + +InitCommandF1: + Ret + +EndP InitCommandF + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +InitCommandG15: + Jmp InitNoCommand + +Proc InitCommandG + Assume DS:Music + ; Check whether channel on/owned + Mov AL, [DI+7] + Test AL, AL + JZ InitCommandG6 + + Test Byte Ptr [ES:2Ch], 20h ; Compatibility Gxx? + JZ InitCommandGNotOldEffects1 + + Mov [DI+1Eh], AL + Jmp InitCommandG6 + +InitCommandGNotOldEffects1: + Mov [DI+11h], AL + +InitCommandG6: + Test Byte Ptr [DI], 4 + JZ InitCommandG15 + +InitcommandG11: ; Jumped to from Lxx + Mov SI, [DI+24h] + + Mov CL, [DI+2] ; CL = mask. + + Test CL, 22h + JZ InitCommandG17 + ; Checking for change of + ; Sample or instrument. + Mov AL, [DI+0Fh] ; Sample + And EAX, 0FFh + JZ InitCommandG17 + + Dec AX + + Mov DX, [DI+3] + Test Byte Ptr [ES:2Ch], 20h + JNZ InitGXXCompat1 + +; Don't overwrite note if MIDI! + Cmp Byte Ptr [DI+0Fh], 101 + JE InitCommandG13 + + Cmp [SI+33h], DH ; Ins the same? + Mov [SI+32h], DX ; Nte + Ins. + + JNE InitCommandG19 + + Cmp AL, [SI+36h] + JNE InitCommandG16 + +InitCommandG17: + Jmp InitCommandG13 + +InitCommandGNoSample: + Mov Word Ptr [SI], 200h + And Byte Ptr [DI], Not 4 + Ret + +InitGXXCompat1: + Mov AL, [SI+36h] + Inc AX + Mov [DI+0Fh], AL + + Mov BX, [ES:EAX+EAX+64910] + Mov AX, [ES:BX+11h] + Add AL, AL + Mov [SI+24h], AL + + Jmp InitCommandG18 + +InitCommandG19: + Cmp AL, [SI+36h] ; Sample the same? + JE InitCommandG18 + +InitCommandG16: + Mov BX, [ES:EAX+EAX+64912] + Mov Byte Ptr [SI+1], 1 + ; Now to update sample info. + Mov [SI+34h], BX ; Offset of sample + Mov [SI+36h], AL ; Sample num. + + Xor EAX, EAX + + Mov [SI+1Ah], AX ; Reset vibrato.. + Mov [SI+0Bh], AL ; Reset loop direction. + Mov [SI+2Ch], EAX + Mov [SI+48h], AX + Mov [SI+4Ch], EAX + + Mov AX, [ES:BX+11h] + Add AL, AL + Mov [SI+24h], AL + + Test AH, 1 + JZ InitCommandGNoSample + + And AH, 2 ; 16 bit... + ShR AX, 8 + Mov [SI+18h], AX + + Call GetLoopInformation + Mov CL, [DI+2] + +InitCommandG18: + Test Byte Ptr [ES:2Ch], 4 ; Instrument/sample mode? + JZ InitCommandG14 + ; Now for instruments + + Mov Word Ptr [SI+26h], 0400h + MovZX EBX, Byte Ptr [DI+4] + + Mov BX, [ES:EBX*2+64710] ; Instrument offset. + + Push Word Ptr [SI] + Call InitPlayInstrument + Pop AX + + Test AL, 1 + JZ InitCommandGXXCompat3 + + And Word Ptr [SI], Not 100h + +InitCommandGXXCompat3: + + Mov AL, [ES:BX+18h] + Mul Byte Ptr [SI+24h] + ShR AX, 7 + Mov [SI+24h], AL + + Jmp InitCommandG14 + +InitCommandG13: + Test CL, 11h + JZ InitCommandG1 + + ; OK. Time to calc freq. +InitCommandG14: + Mov AL, [DI+0Eh] + Cmp AL, 119 + JBE InitCommandG5 + +InitCommandG12: + Test Byte Ptr [DI], 4 + JZ InitCommandG1 + + Cmp AL, 0FEh + JA InitCommandGNoteOff + JNE InitCommandGNoteFade + + And Byte Ptr [DI], Not 4 ; Note cut! + Mov Word Ptr [SI], 200h ; Cut. + Jmp InitCommandG1 + +InitCommandGNoteOff: + Or Byte Ptr [SI], 4 ; Note off + Push CX + Call GetLoopInformation + Pop CX + Jmp InitCommandG1 + +InitcommandGNoteFade: + Or Byte Ptr [SI], 8 + Jmp InitCommandG1 + +InitCommandG5: +; Don't overwrite note if MIDI! + Cmp Byte Ptr [DI+0Fh], 101 + JE InitCommandGMIDI2 + + Mov [SI+32h], AL + +InitCommandGMIDI2: + Xor EDX, EDX + Mov BX, [SI+34h] + Mov DL, AL + Mov EAX, [ES:BX+3Ch] ; BP = C5Spd +; Call GetC5Speed + + Mul [PitchTable+EDX*4] + SHRD EAX, EDX, 16 + + Mov [DI+34h], EAX + Or Byte Ptr [DI], 16 + +InitCommandG1: + Test CL, 44h + JZ InitCommandG2 +; JZ InitCommandG3 + + Mov AL, [DI+5] + + Cmp AL, 64 + JBE InitCommandG4 + + Mov AH, AL + And AH, 7Fh + Sub AH, 65 + JNC InitCommandG2 + +InitCommandGPanning: + Sub AL, 128 + Call InitCommandX2 ; Panning set... + +InitCommandG2: + Test CL, 22h + JZ InitCommandG3 + + Mov BX, [SI+34h] ; Sample memory offset. + Mov AL, [ES:BX+13h] + +InitCommandG4: + Or Byte Ptr [SI], 16 ; recalc volume. + Mov AH, AL + Mov [SI+21h], AX + Mov [DI+22h], AL + +InitCommandG3: + Test Byte Ptr [DI], 16 ; Slide on??? + JZ InitCommandGEnd + + MovZX AX, Byte Ptr [DI+11h] ; Work out magnitude + dirn + + Test Byte Ptr [ES:2Ch], 20h ; Command G memory + JZ InitCommandGNotOldEffects2 + + Mov AL, [DI+1Eh] + +InitCommandGNotOldEffects2: + ShL AX, 2 + JZ PrepareCommandGEnd + + Mov [DI+40h], AX + + Mov AX, [DI+34h] + Mov DX, [DI+36h] ; Port freq. + + Cmp DX, [SI+16h] + JA InitCommandG8 + JB InitCommandG9 + Cmp AX, [SI+14h] + JA InitCommandG8 + JB InitCommandG9 + ; equal?!?!? + ; then don't update effect. + Jmp PrepareCommandGEnd + +InitCommandG8: + Mov Byte Ptr [DI+42h], 1 ; slide up + Jmp InitCommandG10 + +InitCommandG9: + Mov Byte Ptr [DI+42h], 0 ; slide down. + +InitCommandG10: + Test Word Ptr [DI], 100h + JNZ PrepareCommandGEnd + + Or Byte Ptr [DI], 1 ; Update effect if necess. + +PrepareCommandGEnd: + +InitCommandGEnd: ; Don't call volume + ; effects if it has a Gxx! + Test Word Ptr [DI], 100h + JNZ InitCommandGNoVolEffect + + Jmp InitVolumeEffect + +InitCommandGNoVolEffect: + Ret + +EndP InitCommandG + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc InitCommandH + Assume DS:Music + + Test Byte Ptr Byte Ptr [DI+2], 11h + JZ InitCommandH2 + Cmp Byte Ptr [DI+3], 119 + JA InitCommandH2 + + Mov Byte Ptr [DI+39h], 0 + Mov Byte Ptr [DI+2Dh], 0 + +InitCommandH2: + Mov AL, [DI+7] + Mov AH, AL + And AX, 0FF0h ; AH = depth + + JZ InitCommandH4 + + ShR AL, 2 ; AL = speed. + JZ InitCommandH3 + + + Mov [DI+3Bh], AL + +InitCommandH3: + ShL AH, 2 ; Depth * 4 + JZ InitCommandH4 + + Test Byte Ptr [ES:2Ch], 10h + JZ InitCommandH5 + + Add AH, AH + +InitCommandH5: + Mov [DI+3Ah], AH + +InitCommandH4: + Call InitNoCommand + + Test Byte Ptr [DI], 4 + JZ InitCommandH1 + + Or Byte Ptr [DI], 1 ; Update mode. + + Jmp InitVibrato + +InitCommandH1: + Ret + +EndP InitCommandH + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc InitCommandI + + Call InitNoCommand + + Mov AL, [DI+7] + Test AL, AL + JZ InitCommandI2 + + Mov [DI+13h], AL + +InitCommandI2: + Test Byte Ptr [DI], 4 + JZ InitCommandI1 + ; OK.. now to handle tremor + Or Byte Ptr [DI], 1 + + Mov AL, [DI+13h] + Mov AH, AL + And AL, 0Fh + ShR AH, 4 + + Test Byte Ptr [ES:2Ch], 16 + JZ InitCommandI3 + + Add AX, 101h + +InitCommandI3: + Mov [DI+40h], AX ; AL = Offtime, AH = ontime + + Jmp CommandI + +InitCommandI1: + Ret + +EndP InitCommandI + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc InitCommandJ + Assume DS:Music + + Call InitNoCommand + + Mov Word Ptr [DI+40h], 0 + Mov AL, [DI+7] + Test AL, AL + JNZ InitCommandJ2 + + Mov AL, [DI+14h] + Jmp InitCommandJ3 + +InitCommandJ2: + Mov [DI+14h], AL + +InitCommandJ3: + Test Byte Ptr [DI], 4 + JZ InitCommandJ1 + + Mov BL, AL + ShR AL, 4 + And EBX, 0Fh + + Or Byte Ptr [DI], 1 ; Update when channel on + + LEA DX, [EBX*4+PitchTable+240] + Mov BL, AL + Mov [DI+44h], DX + LEA DX, [EBX*4+PitchTable+240] + Mov [DI+42h], DX + +InitCommandJ1: + Ret + +EndP InitCommandJ + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc InitCommandK + + Mov AL, [DI+7] + Test AL, AL + JZ InitCommandK1 + + Mov [DI+10h], AL + +InitCommandK1: + Call InitNoCommand + + Test Byte Ptr [DI], 4 + JZ InitCommandKEnd + + Call InitVibrato + Call InitCommandD7 + Or Byte Ptr [DI], 2 ; Always update. + +InitCommandKEnd: + Ret + +EndP InitCommandK + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc InitCommandL + + Mov AL, [DI+7] + Test AL, AL + JZ InitCommandL1 + + Mov [DI+10h], AL + +InitCommandL1: + Test Byte Ptr [DI], 4 + JZ InitCommandLEnd + + Call InitCommandG11 + Call InitCommandD7 + Or Byte Ptr [DI], 2 ; Always update. + +InitCommandLEnd: + Ret + +EndP InitCommandL + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc InitCommandM + Assume DS:Music + + Call InitNoCommand + + Mov AL, [DI+7] ; AL = command val. + Cmp AL, 40h + JA InitCommandM3 + +InitCommandM2: + Test Byte Ptr [DI], 4 + JZ InitCommandM1 + + Mov SI, [DI+24h] + + Mov [SI+23h], AL + Or Byte Ptr [SI], 16 ; recalc volume + +InitCommandM1: + Mov [DI+2Fh], AL + +InitCommandM3: + Ret + +EndP InitCommandM + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc InitCommandN + Assume DS:Music + + Mov AL, [DI+7] + Test AL, AL + JZ InitCommandN1 + + Mov [DI+16h], AL + +InitCommandN1: + Call InitNoCommand + + Mov AL, [DI+16h] + Mov AH, AL + Test AH, 0Fh + JZ InitCommandN2 + Test AH, 0F0h + JZ InitCommandN3 + And AX, 0FF0h + Cmp AH, 0Fh + JE InitCommandN4 + Cmp AL, 0F0h + JE InitCommandN5 + Ret + +InitCommandN2: + ShR AL, 4 + Mov [DI+40h], AL + Or Byte Ptr [DI], 2 ; Always update effect + Ret + +InitCommandN3: + Neg AL + Mov [DI+40h], AL + Or Byte Ptr [DI], 2 + Ret + +InitCommandN4: + ShR AL, 4 + Add AL, [DI+2Fh] + Cmp AL, 64 + JBE InitCommandN6 + Mov AL, 64 + Jmp InitCommandM2 + +InitCommandN5: + Mov AL, [DI+2Fh] + Sub AL, AH + JNC InitCommandN6 + Xor AL, AL + +InitCommandN6: + Jmp InitCommandM2 + + +EndP InitCommandN + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc InitCommandO + Assume DS:Music + + Mov AL, [DI+7] + Test AL, AL + JZ InitCommandO2 + + Mov [DI+12h], AL + +InitCommandO2: + Call InitNoCommand + +; Mov AL, [DI+2] +; Test AL, 22h +; JNZ InitCommandO1 + +; Test AL, 11h +; Test Byte Ptr [DI+2], 11h + Test Byte Ptr [DI+2], 33h + JZ InitCommandO1 + + Cmp Byte Ptr [DI+0Eh], 120 + JAE InitCommandO1 + +InitCommandO3: + Test Byte Ptr [DI], 4 + JZ InitCommandO1 + + Xor EAX, EAX + Mov SI, [DI+24h] + Mov AH, [DI+1Bh] + Mov AL, [DI+12h] + ShL EAX, 8 + + Cmp EAX, [SI+44h] ; End of sample/end of sample loop + JB InitCommandO4 + + Test Byte Ptr [ES:2Ch], 16 + JZ InitCommandO1 + + Mov EAX, [SI+44h] + Dec EAX + +InitCommandO4: + Mov [SI+4Ch], EAX + Mov [SI+2Ch], EAX + + Xor AX, AX + Mov [SI+48h], AX + Ret + +InitCommandO1: + Ret + +EndP InitCommandO + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc InitCommandP + Assume DS:Music + + Mov AL, [DI+7] + Test AL, AL + JZ InitCommandP1 + + Mov [DI+17h], AL + +InitCommandP1: + Call InitNoCommand + + Mov DL, [DI+2Eh] + Test Byte Ptr [DI], 4 + JZ InitCommandP8 + + Mov SI, [DI+24h] + Mov DL, [SI+2Bh] ; Pan set + +InitCommandP8: + Cmp DL, 100 ; Surround?? + JE InitCommandP7 + + Mov AL, [DI+17h] + Mov AH, AL + Test AH, 0Fh + JZ InitCommandP2 + Test AH, 0F0h + JZ InitCommandP3 + And AX, 0F00Fh + Cmp AL, 0Fh + JE InitCommandP4 + Cmp AH, 0F0h + JE InitCommandP5 + +InitCommandP7: + Ret + +InitCommandP2: + ShR AL, 4 + Neg AL + Mov [DI+40h], AL + Or Byte Ptr [DI], 2 ; Always update effect + Ret + +InitCommandP3: + Mov [DI+40h], AL + Or Byte Ptr [DI], 2 + Ret + +InitCommandP4: + ShR AH, 4 + Mov AL, DL + Sub AL, AH + JNC InitCommandP6 + Xor AL, AL + Jmp InitCommandX2 + +InitCommandP5: + Add AL, DL + Cmp AL, 64 + JBE InitCommandP6 + + Mov AL, 64 + +InitCommandP6: + Jmp InitCommandX2 + +EndP InitCommandP + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc InitCommandQ + + Call InitNoCommand + + Mov AL, [DI+7] + Test AL, AL + JZ InitCommandQ1 + + Mov [DI+18h], AL + +InitCommandQ1: + Test Byte Ptr [DI], 4 + JZ InitCommandQ2 + + Or Byte Ptr [DI], 1 + + Test Byte Ptr [DI+2], 11h + JZ InitCommandQ3 + + Mov AL, [DI+18h] + And AL, 0Fh ; AL = retrig count + Mov [DI+33h], AL ; retrig countdown + +InitCommandQ2: + Ret + +InitCommandQ3: + Jmp CommandQ + +EndP InitCommandQ + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc InitCommandR + Assume DS:Music + + Mov AL, [DI+7] + Mov AH, AL + And AX, 0FF0h ; AH = depth + JZ InitCommandR4 + + ShR AL, 2 ; AL = speed. + JZ InitCommandR3 + + Mov [DI+3Fh], AL + +InitCommandR3: + ShL AH, 1 + JZ InitCommandR4 + + Mov [DI+3Eh], AH + +InitCommandR4: + Call InitNoCommand + + Test Byte Ptr [DI], 4 + JZ InitCommandR1 + + Or Byte Ptr [DI], 1 ; Update mode. + + Jmp InitTremelo + +InitCommandR1: + Ret + +EndP InitCommandR + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +CommandSTable Label Word + DW Offset InitNoCommand ; 0 + DW Offset InitNoCommand ; 1 + DW Offset InitNoCommand ; 2 + DW Offset InitCommandS3x ; 3 - set vibrato waveform + DW Offset InitCommandS4x ; 4 - set tremelo waveform + DW Offset InitCommandS5x ; 5 - set panbrello waveform + DW Offset InitCommandS6x ; 6 - extra delay of x frames + DW Offset InitCommandS7x ; 7 - instrument functions + DW Offset InitCommandS8x ; 8 - set pan + DW Offset InitCommandS9x ; 9 - set surround + DW Offset InitCommandSAx ; A - Set high order offset + DW Offset InitCommandSBx ; B - loop control + DW Offset InitCommandSCx ; C - note cut + DW Offset InitCommandSDx ; D - note delay + DW Offset InitCommandSEx ; E - pattern delay + DW Offset InitCommandSFx ; F - MIDI Macro select + +CommandS7Table Label Word + DW Offset InitCommandS70 ; Past note cut + DW Offset InitCommandS71 ; Past note off + DW Offset InitCommandS72 ; Past note fade + DW Offset InitCommandS73 ; Set NNA to cut + DW Offset InitCommandS73 ; Set NNA to continue + DW Offset InitCommandS73 ; Set NNA to off + DW Offset InitCommandS73 ; Set NNA to fade + DW Offset InitCommandS77 ; Set volume envelope on + DW Offset InitCommandS78 ; Set volume envelope off + DW Offset InitCommandS79 ; Set panning envelope on + DW Offset InitCommandS7A ; Set panning envelope off + DW Offset InitCommandS7B ; Set pitch envelope on + DW Offset InitCommandS7C ; Set pitch envelope off + DW Offset InitNoCommand + DW Offset InitNoCommand + DW Offset InitNoCommand + +Proc InitCommandS + Assume DS:Music + + Mov AL, [DI+7] + Test AL, AL + JNZ @ICS1 + + Mov AL, [DI+1Ah] + +@ICS1: + Mov [DI+1Ah], AL + + Mov AH, AL + And AX, 0F00Fh + + Mov [DI+40h], AX ; Misc effects data. + + Mov BX, AX + ShR BX, 11 ; BX = (AH>>4)*2 + + Jmp [CommandSTable+BX] + +InitCommandS3x: + Cmp AL, 3 + JA @ICS2 + Mov [DI+38h], AL + +@ICS2: + Jmp InitNoCommand + +InitCommandS4x: + Cmp AL, 3 + JA @ICS3 + Mov [DI+3Ch], AL + +@ICS3: + Jmp InitNoCommand + +InitCommandS5x: + Cmp AL, 3 + JA @ICS4 + + Mov [DI+28h], AL + Mov Byte Ptr [DI+29h], 0 + +@ICS4: + Jmp InitNoCommand + +InitCommandS6x: + And AX, 0FFh + Add CurrentTick, AX + Add ProcessTick, AX + Jmp InitNoCommand + +InitCommandS7x: + Mov BL, AL + Add BL, BL + Jmp [CommandS7Table+BX] + +InitCommandS70: ; Past Note cut. + Call InitNoCommand + Mov SI, Offset SlaveChannelInformationTable + Mov CX, NumChannels + Mov AL, [DI+20h] + Or AL, 80h + +InitCommandS70_1: + Cmp AL, [SI+3Ah] + JNE @ICS5 + + Test Byte Ptr CS:DriverFlags, 2 + JZ @ICS70_2 + + Or Word Ptr [SI], 200h + Jmp @ICS5 + +@ICS70_2: + Mov Word Ptr [SI], 200h + +@ICS5: + Add SI, SLAVECHANNELSIZE + Dec CX + JNZ InitCommandS70_1 + + Ret + +InitCommandS71: ; Past note off + Call InitNoCommand + Mov AH, 4 + Jmp InitCommandS72_1 + +InitCommandS72: ; Past note fade. + Call InitNoCommand + Mov AH, 8 + +InitCommandS72_1: + Mov SI, Offset SlaveChannelInformationTable + Mov CX, NumChannels + Mov AL, [DI+20h] + Or AL, 80h + +InitCommandS72_2: + Cmp AL, [SI+3Ah] + JNE @ICS6 + + Or [SI], AH + + Push AX + Push CX + Call GetLoopInformation + Pop CX + Pop AX + +@ICS6: + Add SI, SLAVECHANNELSIZE + Dec CX + JNZ InitCommandS72_2 + + Ret + +InitCommandS73: + Push AX + Call InitNoCommand + Pop AX + + Test Byte Ptr [DI], 4 + JZ @ICS7 + + Sub AL, 3 + Mov SI, [DI+24h] + Mov [SI+3Bh], AL + +@ICS7: + Ret + +InitCommandS77: + Call InitNoCommand + Test Byte Ptr [DI], 4 + JZ @ICS9 + + Mov SI, [DI+24h] + And Word Ptr [SI], Not 1000h + +@ICS9: + Ret + +InitCommandS78: + Call InitNoCommand + Test Byte Ptr [DI], 4 + JZ @ICS9 + + Mov SI, [DI+24h] + Or Word Ptr [SI], 1000h + + Ret + +InitCommandS79: + Call InitNoCommand + Test Byte Ptr [DI], 4 + JZ @ICS9 + + Mov SI, [DI+24h] + And Word Ptr [SI], Not 2000h + + Ret + +InitCommandS7A: + Call InitNoCommand + Test Byte Ptr [DI], 4 + JZ @ICS10 + + Mov SI, [DI+24h] + Or Word Ptr [SI], 2000h + + Ret + +InitCommandS7B: + Call InitNoCommand + Test Byte Ptr [DI], 4 + JZ @ICS10 + + Mov SI, [DI+24h] + And Word Ptr [SI], Not 4000h + +@ICS10: + Ret + +InitCommandS7C: + Call InitNoCommand + Test Byte Ptr [DI], 4 + JZ @ICS10 + + Mov SI, [DI+24h] + Or Word Ptr [SI], 4000h + + Ret + +InitCommandS8x: + Mov AH, AL + ShL AH, 4 + Or AL, AH + And AX, 0FFh + Add AX, 2 + SHR AX, 2 + +InitCommandS8x_1: + Push AX + Call InitNoCommand + Pop AX + + Jmp InitCommandX2 + +InitCommandS9x: + Cmp AL, 1 + Mov AL, 100 + JE InitCommandS8x_1 + Jmp InitNoCommand + +InitCommandSAx: + Mov [DI+1Bh], AL + Jmp InitNoCommand + +InitCommandSBx: + Push AX + Call InitNoCommand + Pop AX + + Test AL, AL + JZ InitCommandSBx_1 + + Cmp Byte Ptr [DI+27h], 0 + JNE InitCommandSBx_2 + + Mov [DI+27h], AL + +InitCommandSBx_3: + MovZX AX, Byte Ptr [DI+26h] + + Dec AX + Mov ProcessRow, AX + Mov PatternLooping, 1 + + Ret + +InitCommandSBx_2: + Dec Byte Ptr [DI+27h] + JNZ InitCommandSBx_3 + Mov AX, CurrentRow + + Inc AX + Mov [DI+26h], AL + Ret + +InitCommandSBx_1: + Mov AX, CurrentRow + Mov [DI+26h], AL + Ret + +InitCommandSCx: + Or Byte Ptr [DI], 1 + Jmp InitNoCommand + +InitCommandSDx: + Or Byte Ptr [DI], 2 + Ret + +InitCommandSEx: + Cmp RowDelayOn, 0 + JNE @ICS8 + + Inc AX + Mov AH, 1 + Mov [Word Ptr RowDelay], AX + +@ICS8: + Jmp InitNoCommand + +InitCommandSFx: ; Set MIDI Macro + Mov [DI+1Fh], AL + Jmp InitNoCommand + +EndP InitCommandS + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc InitCommandT + Assume DS:Music + + Mov AL, [DI+7] + Test AL, AL + JZ InitCommandT2 + + Mov [DI+19h], AL + +InitCommandT2: + Mov AL, [DI+19h] + +InitCommandT3: + Cmp AL, 20h + JB InitCommandT1 + + Mov Tempo, AL + Call Music_InitTempo + Jmp InitNoCommand + +InitCommandT1: + Call InitNoCommand + Or Byte Ptr [DI], 2 ; Update mode + Ret + +EndP InitCommandT + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc InitCommandU + Assume DS:Music + + Test Byte Ptr Byte Ptr [DI+2], 11h + JZ InitCommandU2 + + Mov Byte Ptr [DI+39h], 0 + Mov Byte Ptr [DI+2Dh], 0 + +InitCommandU2: + Mov AL, [DI+7] + Mov AH, AL + And AX, 0FF0h ; AH = depth + + Test AL, AL + JZ InitCommandU3 + + ShR AL, 2 ; AL = speed. + + Mov [DI+3Bh], AL + +InitCommandU3: + Test AH, AH + JZ InitCommandU4 + + Test Byte Ptr [ES:2Ch], 16 + JZ InitCommandU5 + + Add AH, AH + +InitCommandU5: + Mov [DI+3Ah], AH + +InitCommandU4: + Call InitNoCommand + + Test Byte Ptr [DI], 4 + JZ InitCommandU1 + + Or Byte Ptr [DI], 1 ; Update mode. + + Jmp InitVibrato + +InitCommandU1: + Ret + +EndP InitCommandU + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc InitCommandV + Assume DS:Music + + Mov AL, [DI+7] + Cmp AL, 80h + JA InitCommandV1 + + Mov GlobalVolume, AL + Call RecalculateAllVolumes + +InitCommandV1: + Jmp InitNoCommand + +EndP InitCommandV + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc InitCommandW ; Global volume slides! + Assume DS:Music + + Call InitNoCommand + + Mov AL, [DI+7] + Test AL, AL + JNZ InitCommandW1 + + Mov AL, [DI+1Ch] + Jmp InitCommandW2 + +InitCommandW1: + Mov [DI+1Ch], AL + +InitCommandW2: + Mov AH, AL + And AX, 0F00Fh + JZ InitCommandW3 + Test AH, AH + JZ InitCommandW4 + Test AL, AL + JZ InitCommandW5 + Cmp AH, 0F0h + JE InitCommandW6 + Cmp AL, 0Fh + JE InitCommandW8 + + Ret + +InitCommandW4: + Neg AL + Mov [DI+40h], AL + Or Byte Ptr [DI], 2 + Ret + +InitCommandW5: + ShR AH, 4 + Mov [DI+40h], AH + Or Byte Ptr [DI], 2 + Ret + +InitCommandW6: + Mov AH, GlobalVolume + Sub AH, AL + JNC InitCommandW7 + + Xor AH, AH + +InitCommandW7: + Mov GlobalVolume, AH + + Call RecalculateAllVolumes + Ret + +InitCommandW8: + ShR AH, 4 + Mov AL, GlobalVolume + Add AL, AH + JNS InitCommandW9 + + Mov AL, 128 + +InitCommandW9: + Mov GlobalVolume, AL + + Call RecalculateAllVolumes + Ret + +InitCommandW3: + Ret + +EndP InitCommandW + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc InitCommandX + Assume DS:Music + + Call InitNoCommand + + MovZX AX, Byte Ptr [DI+7] ; AL = command val. + Add AX, 2 + SHR AX, 2 + +InitCommandX2: + Test Byte Ptr [DI], 4 + JZ InitCommandX1 + + Mov SI, [DI+24h] + Mov AH, AL + Mov [SI+2Ah], AX + + Or Byte Ptr [SI], 64+2 ; Recalculate pan + +InitCommandX1: + Mov [DI+2Eh], AL + Ret + +EndP InitCommandX + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc InitCommandY + Assume DS:Music + + Mov AL, [DI+7] + Mov AH, AL + And AX, 0FF0h ; AH = depth + JZ InitCommandY4 + + ShR AL, 4 + JZ InitCommandY3 + + Mov [DI+2Bh], AL + +InitCommandY3: + ShL AH, 1 + JZ InitCommandY4 + + Mov [DI+2Ah], AH + +InitCommandY4: + Call InitNoCommand + + Test Byte Ptr [DI], 4 + JZ InitCommandY1 + + Or Byte Ptr [DI], 1 ; Update mode. + + Jmp CommandY + +InitCommandY1: + Ret + +EndP InitCommandY + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc InitCommandZ ; Macros start at 120h, 320h + + Call InitNoCommand + + Mov BL, [DI+7] + Mov SI, [DI+24h] + + Test BL, BL + JS InitCommandZ1 + +; Test SI, SI +; JZ InitCommandZ2 + + Mov BL, [DI+1Fh] ; 0->7Fh + And BX, 0Fh ; BX = SFx number + ShL BX, 5 + Add BX, 120h + Jmp MIDITranslate + +InitCommandZ1: ; Macros! + And BX, 7Fh + ShL BX, 5 ; BX = (xx-80h)*20h + Add BX, 320h + Jmp MIDITranslate + +InitCommandZ2: + Ret + +EndP InitCommandZ + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +Proc NoCommand ; DS:DI points to CIT Area + + Ret + +EndP NoCommand + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc CommandD + Assume DS:Music + + Mov SI, [DI+24h] + Mov AL, [DI+30h] + Add AL, [SI+22h] ; Volset. + JS CommandD1 + + Cmp AL, 64 + JBE CommandD2 + + And Byte Ptr [DI], Not 1 + + Mov AL, 64 + Jmp CommandD2 + +CommandD1: + And Byte Ptr [DI], Not 1 + Xor AL, AL + +CommandD2: + Mov [SI+21h], AL + Mov [SI+22h], AL + Mov [DI+22h], AL + Or Byte Ptr [SI], 16 ; Recalc vol + Ret + +EndP CommandD + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc CommandE + Assume DS:Music + + Mov BX, [DI+40h] + +CommandEChain: + Mov SI, [DI+24h] + Call PitchSlideDown + + Mov EAX, [SI+10h] + Mov [SI+14h], EAX + + Ret + +EndP CommandE + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc CommandF + Assume DS:Music + + Mov BX, [DI+40h] + +CommandFChain: + Mov SI, [DI+24h] + Call PitchSlideUp + + Mov EAX, [SI+10h] + Mov [SI+14h], EAX + + Ret + +EndP CommandF + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc CommandG + + Test Byte Ptr [DI], 16 + JZ CommandGEnd + + Mov BX, [DI+40h] + Mov SI, [DI+24h] + Cmp Byte Ptr [DI+42h], 1 + JE CommandG1 + ; Slide down + Call PitchSlideDown + ; Check that frequency is above porta + ; to frequency. + Mov EAX, [SI+10h] + Cmp EAX, [DI+34h] + JA CommandG6 + +CommandG4: + Mov EAX, [DI+34h] + And Byte Ptr [DI], Not (3 Or 16) ; Turn off calling + +CommandG3: + Mov [SI+10h], EAX + +CommandG6: + Mov [SI+14h], EAX + +CommandGEnd: + Ret + +CommandG1: ; Slide up! + Call PitchSlideUp + ; Check that + ; 1) Channel is on + ; 2) Frequency (set) is below porta to + ; frequency + Mov EAX, [SI+10h] + + Test Word Ptr [SI], 200h + JNZ CommandG5 + + Cmp EAX, [DI+34h] + JB CommandG6 + +CommandG5: +; Or Byte Ptr [SI], 1 +; And Byte Ptr [SI+1], Not 2 + And Word Ptr [SI], Not 200h + Or Byte Ptr [DI], 4 ; Turn on. + Jmp CommandG4 + +EndP CommandG + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +InitVibrato: + Test Byte Ptr [ES:2Ch], 10h + JZ CommandH + + Mov SI, [DI+24h] + Or Byte Ptr [SI], 32 ; Freq change... + Mov AL, [DI+2Dh] + Jmp CommandH5 + +Proc CommandH + + Mov SI, [DI+24h] + Or Byte Ptr [SI], 32 ; Freq change... + + Mov BL, [DI+39h] + Add BL, [DI+3Bh] ; Add speed. + Mov [DI+39h], BL ; Save value + Mov BH, [DI+38h] ; AL = waveform + + Cmp BH, 3 + JE CommandH1 + + Mov AL, [FineSineData+BX] ; AL = -64 -> 64 + + Jmp CommandH2 + +CommandH1: ; Random. + Call Random + And AL, 127 + Sub AL, 64 + +CommandH2: + Mov [DI+2Dh], AL ; Save last vibrato. + +CommandH5: + IMul Byte Ptr [DI+3Ah] + SAL AX, 2 + Add AX, 80h + + Test Byte Ptr [ES:2Ch], 16 + JZ CommandH9 + + Neg AH + +CommandH9: + MovZX BX, AH + ; AH = EEx/FEx command value + Test AH, AH + JS CommandH4 + JNS CommandH3 + Ret + +CommandH3: + Jmp PitchSlideUp + +CommandH4: + Neg BL + Jmp PitchSlideDown + Ret + +EndP CommandH + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc CommandI + + Mov SI, [DI+24h] + + Or Byte Ptr [SI], 16 ; recalc volume + + Dec Byte Ptr [DI+31h] + JS CommandI2 + JZ CommandI2 + +CommandI1: + Cmp Byte Ptr [DI+32h], 1 + JE CommandI3 + + Mov Byte Ptr [SI+21h], 0 + +CommandI3: + Ret + +CommandI2: + Xor Byte Ptr [DI+32h], 1 + MovZX BX, Byte Ptr [DI+32h] + Mov AL, [DI+40h+BX] + Mov [DI+31h], AL + Jmp CommandI1 + +EndP CommandI + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc CommandJ + Assume DS:Music + + Mov SI, [DI+24h] + Mov BX, [DI+40h] + + Or Byte Ptr [SI], 32 + + Add BX, 2 + Cmp BX, 6 + JB CommandJ1 + + Mov Word Ptr [DI+40h], 0 + Ret + +CommandJ1: + Push DI + + Mov [DI+40h], BX + Mov DI, [DI+BX+40h] ; DI points to freq mult. + + Mov EAX, [SI+10h] + Mul DWord Ptr [DI] + + Test EDX, 0FFFF0000h + JNZ CommandJ2 + + SHRD EAX, EDX, 16 + Mov [SI+10h], EAX + + Pop DI + Ret + +CommandJ2: + Xor EAX, EAX + Mov [SI+10h], EAX + + Pop DI + Ret + +EndP CommandJ + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc CommandK + + Call CommandH + Call CommandD + Ret + +EndP CommandK + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc CommandL + + Test Byte Ptr [DI], 16 + JZ CommandL1 + + Call CommandG + Or Byte Ptr [DI], 1 + +CommandL1: + Call CommandD + Ret + +EndP CommandL + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc CommandN + + Mov AL, [DI+2Fh] + Add AL, [DI+40h] + JNS CommandN1 + + Xor AL, AL + Jmp InitCommandM2 + +CommandN1: + Cmp AL, 64 + JBE CommandN2 + + Mov AL, 64 + +CommandN2: + Jmp InitCommandM2 + +EndP CommandN + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc CommandP + + Mov AL, [DI+2Eh] + Test Byte Ptr [DI], 4 + JZ CommandP3 + + Mov SI, [DI+24h] + Mov AL, [SI+2Bh] ; Pan set + +CommandP3: + Add AL, [DI+40h] + JNS CommandP1 + + Xor AL, AL + Jmp InitCommandX2 + +CommandP1: + Cmp AL, 64 + JBE CommandP2 + + Mov AL, 64 + +CommandP2: + Jmp InitCommandX2 + +EndP CommandP + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc CommandQ + + Dec Byte Ptr [DI+33h] + JS CommandQ1 + JZ CommandQ1 + + Ret + +CommandQ1: ; OK... reset counter. + Mov BL, [DI+18h] + Mov BH, BL + And BX, 0F00Fh + Mov [DI+33h], BL ; retrig count done. + + Mov SI, [DI+24h] + + Test Byte Ptr DriverFlags, 2 ; Hiqual? + JZ CommandQNoHiQual + + Push ES + Push DI + + Test Byte Ptr [ES:2Ch], 4 ; Instrument mode? + + Push DS + Pop ES + + JNZ CommandQHiqualInstruments + +CommandQHiqualSamples: + Lea DI, [SI+64*SLAVECHANNELSIZE] + + Mov CX, SLAVECHANNELSIZE/4 + Rep MovsD + Or Byte Ptr [DI-SLAVECHANNELSIZE+1], 2h ; Cut + Or Byte Ptr [DI-SLAVECHANNELSIZE+3Ah], 80h ; Disowned + Sub SI, SLAVECHANNELSIZE + + Pop DI + Jmp CommandQHiqualEnd + +CommandQHiqualInstruments: + Mov DI, Offset SlaveChannelInformationTable + Mov CX, NumChannels + +CommandQFindChannel: + Test Byte Ptr [DI], 1 + JZ CommandQHiqualCopy + + Add DI, SLAVECHANNELSIZE + Loop CommandQFindChannel + Pop DI + Jmp CommandQHiqualEnd + +CommandQHiqualCopy: + Mov CX, SLAVECHANNELSIZE/4 + Rep MovsD + + Or Byte Ptr [SI-SLAVECHANNELSIZE+1], 2h ; Cut + Or Byte Ptr [SI-SLAVECHANNELSIZE+3Ah], 80h ; Disowned + LEA SI, [DI-SLAVECHANNELSIZE] + Pop DI + + Mov [DI+24h], SI + +CommandQHiqualEnd: + Pop ES + +CommandQNoHiQual: + Xor EAX, EAX + Mov [SI+2Ch], EAX + Mov [SI+48h], AX + Mov [SI+4Ch], EAX + + Or Word Ptr [SI], 540h + + Mov AL, [SI+22h] + ShR BX, 11 + + Jmp [RetrigOffsets+BX] + +CommandQ_0: + Ret + +CommandQ_1: + Dec AL + Jmp CommandQCheckLow + +CommandQ_2: + Sub AL, 2 + Jmp CommandQCheckLow + +CommandQ_3: + Sub AL, 4 + Jmp CommandQCheckLow + +CommandQ_4: + Sub AL, 8 + Jmp CommandQCheckLow + +CommandQ_5: + Sub AL, 16 + Jmp CommandQCheckLow + +CommandQ_6: + ShL AL, 1 + Mov BL, 3 + Div BL + Jmp CommandQEnd + +CommandQ_7: + ShR AL, 1 + Jmp CommandQEnd + +CommandQ_8: + Ret + +CommandQ_9: + Inc AX + Jmp CommandQCheckHigh + +CommandQ_A: + Add AL, 2 + Jmp CommandQCheckHigh + +CommandQ_B: + Add AL, 4 + Jmp CommandQCheckHigh + +CommandQ_C: + Add AL, 8 + Jmp CommandQCheckHigh + +CommandQ_D: + Add AL, 16 + Jmp CommandQCheckHigh + +CommandQ_E: + Mov AH, AL + Add AL, AL + Add AL, AH + ShR AL, 1 + Jmp CommandQCheckHigh + +CommandQ_F: + ShL AL, 1 + Jmp CommandQCheckHigh + + +CommandQCheckLow: + JNS CommandQEnd + Xor AL, AL + Jmp CommandQEnd + +CommandQCheckHigh: + Cmp AL, 64 + JBE CommandQEnd + Mov AL, 64 + +CommandQEnd: + Mov [SI+21h], AL + Mov [SI+22h], AL + Mov [DI+22h], AL + Or Byte Ptr [SI], 16 ; recalc volume flag + + Cmp Byte Ptr [DI+0Fh], 101 ; MIDI sample + JNE CommandQNoMidi + + Mov BX, MIDICOMMAND_STOPNOTE + Call MIDITranslate + +CommandQNoMidi: + Ret + +EndP CommandQ + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +InitTremelo: + Test Byte Ptr [ES:2Ch], 10h + JZ CommandR + + Mov SI, [DI+24h] + Or Byte Ptr [SI], 64 ; Volume change... + Mov AL, [DI+23h] + Jmp CommandR2 + +Proc CommandR + + Mov SI, [DI+24h] + Or Byte Ptr [SI], 16 ; Volume change + + Mov BL, [DI+3Dh] + Add BL, [DI+3Fh] ; Add speed. + Mov [DI+3Dh], BL ; Save value + Mov BH, [DI+3Ch] ; AL = waveform + + Cmp BH, 3 + JE CommandR1 + + Mov AL, [FineSineData+BX] ; AL = -64 -> 64 + + Jmp CommandR5 + +CommandR1: ; Random. + Call Random + And AL, 127 + Sub AL, 64 + +CommandR5: + Mov [DI+23h], AL ; Save last tremelo + +CommandR2: + IMul Byte Ptr [DI+3Eh] + SAL AX, 2 + Add AX, 80h + MovZX BX, AH + ; AH = volume change + Mov AL, [SI+21h] ; AL = vol. + Add AL, AH + JNS CommandR3 + + Xor AL, AL + +CommandR3: + Cmp AL, 64 + JBE CommandR4 + + Mov AL, 64 + +CommandR4: + Mov [SI+21h], AL + Ret + +EndP CommandR + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc CommandS ; Have to handle SDx, SCx + Assume DS:Music + + Mov AX, [DI+40h] ; AH = command, AL = value. + Cmp AH, 0D0h + JE CommandS1 + + Cmp AH, 0C0h + JE CommandS3 + +CommandS4: + Ret + +CommandS3: + Test Byte Ptr [DI], 4 + JZ CommandS4 + + Dec Byte Ptr [DI+40h] + JZ CommandS5 + JS CommandS5 + + Ret + +CommandS5: + Mov SI, [DI+24h] ; Note cut. + + Mov AL, [DI] + + And AL, Not 4 + Mov [DI], AL + + Cmp Byte Ptr [SI+36h], 100 + JE CommandS7 + + Test Byte Ptr CS:DriverFlags, 2 + JNZ CommandS7 + + Mov Word Ptr [SI], 200h + Ret + +CommandS7: + Or Word Ptr [SI], 200h + Ret + +CommandS1: + Dec Byte Ptr [DI+40h] + JS CommandS2 + JZ CommandS2 + + Ret + +CommandS2: + And Byte Ptr [DI], Not 3 + Call InitNoCommand + + Or Byte Ptr [DI], 64 + + MovZX BX, Byte Ptr [DI+20h] ; Check whether chn + ; is on + Test Byte Ptr [ES:BX+40h], 80h + JZ CommandS6 + + Test Byte Ptr [DI], 32 + JNZ CommandS6 + + Test Byte Ptr [DI], 4 + JZ CommandS6 ; Channel was off. + + Mov SI, [DI+24h] + Or Byte Ptr [SI+1], 8 + +CommandS6: + Ret + +EndP CommandS + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc CommandT + Assume DS:Music + + Mov AL, [DI+19h] + Mov BL, Tempo + Xor AH, AH + Xor BH, BH + + Test AL, 0F0h + JZ CommandT1 + ; Slide up + Add BX, AX + Sub BX, 10h + Cmp BX, 0FFh + JBE CommandT2 + Mov BL, 0FFh + Jmp CommandT2 + +CommandT1: ; Slide down + Sub BX, AX + Cmp BX, 20h + JGE CommandT2 + + Mov BL, 20h + +CommandT2: + Mov Tempo, BL + PushA + Call [DriverSetTempo] + PopA + Ret + +EndP CommandT + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc CommandW ; Global volume slide! + Assume DS:Music + + Xor BH, BH + MovSX AX, Byte Ptr [DI+40h] + Mov BL, GlobalVolume + + Add AX, BX + + JNS CommandW1 + + Xor AL, AL + +CommandW1: + Cmp AL, 128 + JBE CommandW2 + + Mov AL, 128 + +CommandW2: + Mov GlobalVolume, AL + + Call RecalculateAllVolumes + Ret + +EndP CommandW + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc CommandY + + Test Byte Ptr [DI], 4 + JZ CommandY5 + + Mov SI, [DI+24h] + + Mov BH, [DI+28h] ; AL = waveform + Cmp BH, 3 + JAE CommandY1 + + Mov BL, [DI+29h] ; Pos + Add BL, [DI+2Bh] ; Add speed. + Mov [DI+29h], BL ; Save value + + Mov AL, [FineSineData+BX] ; AL = -64 -> 64 + + Jmp CommandY2 + +CommandY1: ; Random panning make + ; speed the delay time. + Dec Byte Ptr [DI+29h] + JZ CommandY6 + JS CommandY6 + + Mov AL, [DI+2Ch] + Jmp CommandY2 + +CommandY6: + Mov BL, [DI+2Bh] + Mov [DI+29h], BL ; reset countdown. + + Call Random + And AL, 127 + Sub AL, 64 + + Mov [DI+2Ch], AL + +CommandY2: + IMul Byte Ptr [DI+2Ah] + SAL AX, 2 + Add AX, 80h + MovZX BX, AH + ; AH = panning change + Mov AL, [SI+2Bh] ; AL = panning + Cmp AL, 100 ; Surround? + JE CommandY5 + + Add AL, AH + JNS CommandY3 + + Xor AL, AL + +CommandY3: + Cmp AL, 64 + JBE CommandY4 + + Mov AL, 64 + +CommandY4: + Or Byte Ptr [SI], 2 ; Panning change + Mov [SI+2Ah], AL + +CommandY5: + Ret + +EndP CommandY + + diff --git a/IT_NET.ASM b/IT_NET.ASM new file mode 100644 index 0000000..570dd1a --- /dev/null +++ b/IT_NET.ASM @@ -0,0 +1,2722 @@ +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Network Module ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Jumps + .386P + +include switch.inc + +IF NETWORKENABLED + +SHOWQUEUESIZE EQU 0 + +NUMREQUIREDVARIABLES EQU 16 ; Number of bytes required from IT.EXE by Driver +NUMREQUIREDFUNCTIONS EQU 32 ; Number of functions (DD Offsets) required by + ; Network driver +NUMPROVIDEDVARIABLES EQU 16 ; Number of bytes provided from driver to IT.EXE +NUMPROVIDEDFUNCTIONS EQU 16 ; Number of functions (DW Offsets) provided by + ; Network driver + +; Has to handle: +; 1. Loading the network driver +; 2. Messages to/from network driver/buffering, etc. + +; Interface + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Externals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Extrn D_ClearFileName:Far + + Extrn E_AllocateEMS:Far + Extrn E_ReleaseEMS:Far + Extrn E_MapEMSMemory:Far + Extrn E_GetEMSPageFrame:Far + Extrn E_GetEMSVersion:Far +; Extrn E_SavePageFrame:Far +; Extrn E_RestorePageFrame:Far + + Extrn F_DrawHeader:Far + + Extrn Glbl_SetCurrentMode:Far + Extrn Glbl_GetCurrentMode:Far + + Extrn I_MapEnvelope:Far + + Extrn M_FunctionDivider:Far + Extrn M_FunctionHandler:Far + Extrn M_Object1List:Far + + Extrn Music_GetPatternLocation:Far ; Returns AX = handle + ; EBX = segment:offset + ; DL = type. + ; CX = pattern length + Extrn Music_GetPatternLocationNoCount:Far ; Returns AX = handle + ; EBX = segment:offset + ; DL = type. + Extrn Music_ReleasePattern:Far ; Requires AX = pattern + Extrn Music_AllocatePattern:Far ; SI = pattern, DX = length + Extrn Music_UpdatePatternOffset:Far + Extrn Music_ReleaseAllSamples:Far + Extrn Music_AllocateSample:Far + Extrn Music_Stop:Far + Extrn Music_ReleaseSample:Far + + Extrn IdleUpdateInfoLine:Far + Extrn SetInfoLine:Far + Extrn SetInfoLine2:Far + Extrn GetTimerCounter:Far + + Extrn O1_LoadNetworkDriver:Far + Extrn O1_NetworkErrorList:Far + Extrn GlobalKeyList + + Extrn PE_FillHeader:Far + Extrn PE_NewPattern:Far + Extrn PEFunction_OutOfMemoryMessage:Far + Extrn PEFunction_StoreCurrentPattern:Far + Extrn PE_GetLastInstrument:Far + + Extrn S_GetDestination:Far + Extrn S_DrawString:Far + Extrn S_SaveScreen:Far + Extrn S_RestoreScreen:Far + +Segment Object1 BYTE Public 'Data' +EndS + +Segment SongData PARA Public 'Data' +EndS + +Segment SongData PARA Public 'Data' +EndS + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + + Public Network_DriverScreen + Public Network_DrawDriverScreen + Public Network_PreDriverScreen + Public Network_PostDriverScreen + Public Network_Shutdown + Public Network_Poll + Public Network_GetSendQueue ; Returns ES:DI + Public Network_FinishedSendQueue ; Finished with send queue + Public Network_AddWordToQueue + Public Network_UpdatePattern + Public Network_UpdatePatternIfIdle + Public Network_EnsureNoNetwork + Public Network_SendSampleHeader + Public Network_SendInstrumentHeader + Public Network_QueueSampleData + Public Network_SendSongDataInformation + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ +; +; Not used? +; +;Segment Network BYTE Public 'Code' USE16 +; Assume CS:Network, DS:Nothing, ES:Nothing +;EndS +; +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +Segment DiskData PARA Public 'Data' +EndS + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +Segment Pattern BYTE Public 'Code' USE16 + Extrn PatternDataArea:Word + Extrn PatternNumber:Word + Extrn Modified:Byte + Extrn PatternModified:Byte + Extrn MaxRow:Word +EndS + +Segment Music BYTE Public 'Code' USE16 + Extrn CurrentOrder:Word + Extrn CurrentPattern:Word + Extrn CurrentRow:Word +EndS + +Segment Disk DWORD Public 'Code' USE16 + Assume CS:Disk, DS:Nothing, ES:Nothing + + Extrn DiskDataArea:Word + Extrn D_GotoStartingDirectory:Far + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +;******************** THESE BLOCKS CANNOT CHANGE ORDER ************************ + +Label NetworkRequiredVariables + DD DWord Ptr GlobalKeyList + DD DWord Ptr IdleUpdateInfoLine + DW DiskData + DB NUMREQUIREDVARIABLES - ($-Offset NetworkRequiredVariables) Dup (0) + +Label NetworkRequiredFunctions + DD DWord Ptr Network_UnloadDriver + DD DWord Ptr M_FunctionHandler + DD DWord Ptr M_FunctionDivider + DD DWord Ptr Network_ReceiveData + DD DWord Ptr Network_SendData + DD DWord Ptr Network_EstablishConnection + DD DWord Ptr D_GotoStartingDirectory + DD DWord Ptr GetTimerCounter + DD DWord Ptr SetInfoLine2 + DD DWord Ptr F_DrawHeader + DD DWord Ptr PE_FillHeader + DD DWord Ptr S_GetDestination + DD DWord Ptr S_DrawString + DD DWord Ptr S_SaveScreen + DD DWord Ptr S_RestoreScreen + DD DWord Ptr Glbl_GetCurrentMode + DD DWord Ptr Network_NewConnection + DD DWord Ptr Network_DecodeUserName + DD NUMREQUIREDFUNCTIONS - ($-Offset NetworkrequiredFunctions)/4 Dup (0) + +Label NetworkDriverVariables Byte + DB NUMPROVIDEDVARIABLES - ($-Offset NetworkDriverVariables) Dup (0) + +Label NetworkDriverFunctions DWord +NetworkDriver_Initialise DD Network_EmptyFunction +NetworkDriver_Shutdown DD Network_EmptyFunction +NetworkDriver_Screen DD Network_EmptyFunction +NetworkDriver_Update DD Network_EmptyFunction +NetworkDriver_ConnectionStatus DD Network_EmptyFunction + DD NUMPROVIDEDFUNCTIONS - ($-Offset NetworkDriverFunctions)/4 Dup (0) + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +DriverIdentification DB "Impulse Tracker Network Driver" +DriverMask DB "IT*.NET", 0 +NoDriverMsg DB "No Network Drivers Found", 0 +NetworkDriverUnloaded DB "Network driver unloaded", 0 + +IF SHOWQUEUESIZE +DebugMessage DB "SendQueueSize: ", 0FDh, "D", 0 +ENDIF +; NetworkOverflowMessage DB "Network Overflow: Driver Unloaded", 0 + +ALIGN 2 +NumDrivers DW 0 +CurrentDriver DW 0 +TopDriver DW 0 + +DriverSegment DW 0 + +EMS_SENDBUFFERPAGE EQU (0*100h + 4) + +LastReceiveCX DW 0 +NetworkEMSHandle DW 0 ; 384kb -> 64kb = receive buffer 1a + ; 64kb = receive buffer 1b + ; 64kb = receive buffer 2a + ; 64kb = receive buffer 2b + ; 64kb = receive buffer 3a + ; 64kb = receive buffer 3b +NetworkSendEMSHandle DW 0 ; 64kb, separated for Win9x's + ; inattention to the int-flag. + +SendQueueSegment DW 0 ; MUST be adjacent +SendDataQueueTail DW 0 ; MUST be adjacent +SendDataQueueHead DW 0 ; MUST be adjacent +Destination DB 0 ; MUST be adjacent +DriverValidated DB 0 ; MUST be adjacent +SendBufferRemaining DW 0 ; MUST be adjacent +SendBufferOffset DW 0 ; MUST be adjacent + +PatternDataUpdated DW 50 Dup (0) ; Bit table of pattern numbers + +Label NetworkKeys Byte + DB 0 + DW 1C8h ; Up arrow + DW Network_Up + + DB 0 + DW 1D0h ; Down arrow + DW Network_Down + + DB 0 + DW 11Ch + DW Network_LoadDriver + + DB 0FFh + +EMSTransferTable Label +TransferLength DW 0, 0 +SourceType DB 0 +SourceHandle DW 0 +SourceOffset DD 0 +DestinationType DB 0 +DestinationHandle DW 0 +DestinationOffset DD 0 + +PatternModifiedTable DB 200 Dup (0) ; Bit field for 200 patterns + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Network_EmptyFunction Far + + Xor AX, AX + Ret + +EndP Network_EmptyFunction + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Network_DriverScreen Far + +; If no network driver loaded, show load screen +; If driver loaded, then call driver's screen interface + + Mov AL, 24 + Call Glbl_SetCurrentMode + + Push CS + Pop DS + Assume DS:Disk + + Cmp [DriverSegment], 0 + JE Network_DriverScreen1 + + Jmp [NetworkDriver_Screen] + +Network_DriverScreen1: + Call D_GotoStartingDirectory +; Clear data area. + + Mov ES, [DiskDataArea] + Mov CX, 32768 + Xor DI, DI + Xor AX, AX + Rep StosW ; Clear diskdata Area... + + Mov [NumDrivers], AX + Mov [CurrentDriver], AX + Mov [TopDriver], AX + +; Now shift DTA to DS:64000 + + Push DS + + Push ES + Pop DS + + Mov DX, 64000 + Mov AH, 1Ah + Int 21h ; Shift DTA address.. + + Pop DS + +; Load file names. + + Mov DX, Offset DriverMask ; Wanna search for IT*.NET + Xor CX, CX ; Normal File types + Mov AH, 4Eh + +Network_DriverScreenLoadFileNames1: + Int 21h + JC Network_DriverScreenLoadFileNamesEnd + + Push DS + + Push ES + Pop DS ; DS = Diskdata + +; OK.. have the file. +; Open it and read the first 128 bytes in from it. +; Check for identification string. If all OK, then copy details into +; network list. + + Mov AX, 3D00h + Mov DX, 64000+1Eh ; Filename + Int 21h + JC Network_DriverScreenLoadFileNext + + Mov BX, AX ; File handle. + +; Read first 128 bytes of file + + Mov AH, 3Fh + Mov CX, 128 + Mov DX, 65000 + Mov DI, DX + + Int 21h ; Read file. + JC Network_DriverScreenLoadFileNextClose + +; Check for matching ID + + Mov SI, Offset DriverIdentification + Mov CX, 30 + + SegCS RepE CmpSB + JNE Network_DriverScreenLoadFileNextClose + +; Have a matching driver! +; Copy filename and Header. + + Mov DI, [CS:NumDrivers] + Inc [CS:NumDrivers] + ShL DI, 7 ; Deposit information at 128*DI + Mov CX, 13 + Mov SI, 64000+1Eh + Rep MovsB + Mov SI, 65000+64 + Mov CX, 32 + Rep MovsW + +Network_DriverScreenLoadFileNextClose: + Mov AH, 3Eh + Int 21h + +Network_DriverScreenLoadFileNext: + Pop DS + Mov AH, 4Fh + Jmp Network_DriverScreenLoadFileNames1 + +Network_DriverScreenLoadFileNamesEnd: +; OK.. jump to network screen list + + Mov AX, 5 + Mov SI, 1 + Mov CX, Object1 + + Mov DX, Offset O1_LoadNetworkDriver + Ret + +EndP Network_DriverScreen + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Network_DrawDriverScreen Far + + Push CS + Pop DS + Assume DS:Disk + + Call S_GetDestination ; Gets ES + + Cmp [NumDrivers], 0 + JNE Network_DrawDriverScreen1 + + Mov DI, (27+29*80)*2 ; (6, 13) + Mov SI, Offset NoDriverMsg + + Mov AH, 3 + Call S_DrawString + + Ret + +Network_DrawDriverScreen1: + Mov AX, 168+200h + Mov DI, (13*80+15)*2 + Mov CX, 36 + +Network_DrawDriverScreen2: + StosW + Add DI, 158 + Loop Network_DrawDriverScreen2 + + Mov SI, [TopDriver] + Mov DX, [NumDrivers] + Mov BX, [CurrentDriver] + +; Need to make sure they're within bounds. + Cmp BX, SI + JAE Network_DrawDriverScreenClip1 + + Mov SI, BX + +Network_DrawDriverScreenClip1: + LEA DI, [SI+35] + Cmp BX, DI + JBE Network_DrawDriverScreenClip2 + + LEA SI, [BX-35] + +Network_DrawDriverScreenClip2: + Mov DI, (13*80+2)*2 + Mov [TopDriver], SI + + Sub DX, SI + JZ Network_DrawDriverScreenEnd + + ShL SI, 7 + Mov DS, [DiskDataArea] + Assume DS:Nothing + + Cmp DX, 36 + JB Network_DrawDriverScreenClip + + Mov DX, 36 + +Network_DrawDriverScreenClip: + Mov AH, 3 + Mov CX, 13 + +Network_DrawDriverScreenFileNames: + LodsB + StosW + Loop Network_DrawDriverScreenFileNames + +; Add DI, 2 + ScasW + + Mov CX, 62 + +Network_DrawDriverScreenDriverName: + LodsB + StosW + Loop Network_DrawDriverScreenDriverName + + Add SI, 128-62-13 + Add DI, 8 + + Dec DX + JNZ Network_DrawDriverScreenClip + +Network_DrawDriverScreenEnd: + Ret + +EndP Network_DrawDriverScreen + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Network_PreDriverScreen Far + + Push CS + Pop DS + Assume DS:Disk + + Cmp [NumDrivers], 0 + JE Network_PreDriverScreenEnd + + Mov AX, [CurrentDriver] + Sub AX, [TopDriver] + Add AX, 13 + Mov BX, 160 + Mul BX + + Call S_GetDestination + + LEA DI, [EAX+4] + Mov CX, 76 + +Network_PreDriverScreen1: + Mov AX, [ES:DI] + Mov AH, 30h + Cmp CX, 76-13 + JNE Network_PreDriverScreen2 + + Mov AH, 32h + +Network_PreDriverScreen2: + StosW + Loop Network_PreDriverScreen1 + +Network_PreDriverScreenEnd: + Ret + +EndP Network_PreDriverScreen + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Network_Up Far + Assume DS:Disk + + Sub [CurrentDriver], 1 + AdC [CurrentDriver], 0 + + Mov AX, 1 + Ret + +EndP Network_Up + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Network_Down Far + + Mov AX, [CurrentDriver] + Inc AX + Cmp AX, [NumDrivers] + JAE Network_Down1 + + Mov [CurrentDriver], AX + +Network_Down1: + Mov AX, 1 + Ret + +EndP Network_Down + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Network_PostDriverScreen Far + +; Has to handle up, down, Enter. + + Push CS + Pop DS + Assume DS:Disk + + Mov SI, Offset NetworkKeys + Call M_FunctionDivider + JC Network_PostDriverScreen1 + + Jmp [Word Ptr SI] + +Network_PostDriverScreen1: + Xor AX, AX + Ret + +EndP Network_PostDriverScreen + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Network_LoadDriver Far + Assume DS:Disk + +; Allocate EMS memory buffers first + + Cmp NetworkEMSHandle, 1 + JAE Network_LoadDriverMemoryAlreadyAllocated + + Call E_GetEMSVersion + Cmp AL, 40h + JB Network_LoadDriverInsufficientMemory + + ; Carry flag set -> essential allocation + StC + Mov EAX, 384*1024 + Call E_AllocateEMS + Test AX, AX + JNZ Network_LoadDriverMemoryOK + +Network_LoadDriverInsufficientMemory: + Jmp PEFunction_OutOfMemoryMessage + +Network_LoadDriverMemoryOK: + Mov NetworkEMSHandle, AX + +Network_LoadDriverMemoryAlreadyAllocated: + Cmp NetworkSendEMSHandle, 1 + JAE Network_LoadDriverSendEMSHandleAlreadyAllocated + + Mov EAX, 64*1024 + Call E_AllocateEMS + Test AX, AX + JZ Network_LoadDriverInsufficientMemory + + Mov NetworkSendEMSHandle, AX + +Network_LoadDriverSendEMSHandleAlreadyAllocated: + Cmp SendqueueSegment, 0 + JNE Network_LoadDriverMemoryAlreadyAllocated2 + + Mov AH, 48h + Mov BX, 1024 + Int 21h ; Allocate 16kb of memory for the SendQueue + JC Network_LoadDriverInsufficientMemory + + Mov SendQueueSegment, AX + +Network_LoadDriverMemoryAlreadyAllocated2: + Xor EAX, EAX + Mov DWord Ptr [SendDataQueueTail], EAX + Mov DWord Ptr [Destination], EAX + + Mov AX, [NumDrivers] + Mov DX, [CurrentDriver] + + Test AX, AX + JNZ Network_LoadDriver1 + + Ret + +Network_LoadDriver1: + ShL DX, 7 + Mov DS, [DiskDataArea] + Assume DS:Nothing + Mov DI, DX + +; Try allocating memory first. + Mov BX, [DI+13+62] ; Bytes to read + Mov AH, 48h + Add BX, 15 + ShR BX, 4 ; BX = number of parags required. + Int 21h + JNC Network_LoadDriver2 + + Jmp PEFunction_OutOfMemoryMessage + +Network_LoadDriver2: + Mov ES, AX + Mov [CS:DriverSegment], AX + + Mov AX, 3D00h + Int 21h ; Open file + JC Network_LoadDriver3 + + Mov BX, AX + Mov AX, 4200h + Xor CX, CX + Mov DX, 128 + Int 21h + JC Network_LoadDriver4 + + Mov AH, 3Fh + Mov CX, [DI+13+62] + Mov DS, [CS:DriverSegment] + Xor DX, DX + Int 21h ; Read driver + JC Network_LoadDriver4 + + Push CS + Pop DS + Assume DS:Disk + + Mov AH, 3Fh + Mov CX, NUMPROVIDEDVARIABLES + Mov DX, Offset NetworkDriverVariables + Int 21h + JC Network_LoadDriver4 + + Mov AH, 3Fh + Mov CX, NUMPROVIDEDFUNCTIONS*2 + Mov DX, Offset NetworkDriverFunctions+NUMPROVIDEDFUNCTIONS*2 + Int 21h + JC Network_LoadDriver4 + + Mov AH, 3Eh + Int 21h ; Close file. + +; Setup tables + Mov SI, Offset NetworkRequiredVariables + Xor DI, DI + Mov CX, NUMREQUIREDVARIABLES+4*NUMREQUIREDFUNCTIONS + Rep MovsB + + Mov AX, ES + Push DS + Pop ES + Mov SI, DX + Mov DI, Offset NetworkDriverFunctions + Mov CX, NUMPROVIDEDFUNCTIONS + ShL EAX, 16 + +Network_LoadDriver5: + LodsW + StosD + Loop Network_LoadDriver5 + +; Initialise Send/Receive buffers. + Mov DX, CS:NetworkEMSHandle + Mov CL, 512/16 + Mov CH, 28 + Call E_GetEMSPageFrame + Mov ES, AX + +Network_InitialiseBuffers1: + Call E_MapEMSMemory + Mov DWord Ptr [ES:65532], 0 + Sub CH, 4 + JNS Network_InitialiseBuffers1 + +; Should jump to network initialise function now. + + Jmp NetworkDriver_Initialise + Assume DS:Nothing + +Network_LoadDriver4: + Mov AH, 3Eh + Int 21h + +Network_LoadDriver3: + Jmp Network_UnloadDriver + +EndP Network_LoadDriver + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Network_UnloadDriver Far + + Push CS + Push CS + Pop DS + Pop ES + Assume DS:Disk + + Mov SI, Offset NetworkDriverUnloaded + Call SetInfoLine + + Mov AH, 49h + Mov ES, [DriverSegment] + Int 21h + + Mov [DriverSegment], 0 + + Mov AH, 49h + Mov ES, SendQueueSegment + Int 21h + + Mov SendQueueSegment, 0 + + Push CS + Pop ES + + Mov AX, CS + ShL EAX, 16 + Mov AX, Offset Network_EmptyFunction + Mov DI, Offset NetworkDriverFunctions + Mov CX, NUMPROVIDEDFUNCTIONS + Rep StosD + + Jmp Network_DriverScreen + +EndP Network_UnloadDriver + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +; PatternCycle DW 0 + +Proc Network_Poll Far + +Comment ~ + Mov AX, CS:PatternCycle + Inc AX + Cmp AX, 200 + JB Network_Poll1 + + Xor AX, AX + +Network_Poll1: + Mov CS:PatternCycle, AX + + Call Network_UpdatePatternIfIdle +~ + Jmp NetworkDriver_Update + +EndP Network_Poll + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Network_DecodeUserName Far ; Given DS:SI = name + ; CX = count (including key) + + Test CX, CX + JZ Network_DecodeUserName3 + + Mov BX, CX + Xor DX, DX + +Network_DecodeUserName1: + LodsB + Add DL, AL + StosB + Xor DH, DL + Loop Network_DecodeUserName1 + + Add DX, 0FFFFh + JC Network_UnloadDriver + + Sub SI, BX + Mov CX, BX + + Xor AH, AH +Network_DecodeUserName2: + LodsB + Add AH, AL + XChg AL, AH + Xor AL, 0AAh + RoR AL, 2 + Mov [SI-1], AL + Loop Network_DecodeUserName2 + +Network_DecodeUserName3: + Mov CS:DriverValidated, 1 + +Network_DecodeUserNameEnd: + Ret + +EndP Network_DecodeUserName + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Network_Shutdown Far + + Mov AX, CS:NetworkEMSHandle + Test AX, AX + JZ Network_Shutdown1 + + Call E_ReleaseEMS + +Network_Shutdown1: + Mov AX, CS:NetworkSendEMSHandle + Test AX, AX + JZ Network_Shutdown2 + + Call E_ReleaseEMS + +Network_Shutdown2: + Jmp NetworkDriver_Shutdown + +EndP Network_Shutdown + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ +; +; Internal structures +; ------------------- +; +; SendBuffer is the raw data to transmit: +; Offset Size Contents Notes +; 0 DWord Block Header ID 'JLNP' - "J.L. Network Protocol" +; 4 Word Block Size Byte count, includes headers +; and CRC check. +; 6 Byte Block Type +; 7 <...> Data Maximum of 65000 bytes +; Word CRC Calculated +; +; Block types. +; +; SendQueue contains a queue of objects to transmit. +; Structure: +; Offset Size Contents Notes +; 0 Byte Destination 0=all, 1-3=specific, others=ignore +; 1 Byte Object Type +; 2 <> Data +; +; Object types: +; 0: Partial pattern data +; Extra data: Pattern Number (1), Bounding Box (4), Data +; 1: Entire pattern +; Extra data: Pattern Number (1), Data (Compressed) +; 2: Request pattern +; Extra data: Pattern Number (1) +; 3: SongData information (includes order list + song parameters) +; Extra data: Length (2), Offset (2) +; 4: Instrument information +; Extra data: Instrument Number (1) +; 5: Sample information +; Extra data: Sample Number (1) +; 6: Pattern Length +; Extra data: Pattern Number (1), New MaxRow (1) +; 7: Delete sample +; Extra data: Sample Number (1) +; 8: New sample - sends length also +; Extra data: Sample Number (1) +; 9: Sample Data +; Extra data: Sample Number (1), Offset (4) + + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Network_CalculateCRC + ; Calculates CRC and appends 6 byte header + + ; Given ES = EMSSegment + ; Given DI = end of data written + + Push DS + + Push ES + Pop DS + + Mov CX, DI + Xor SI, SI + LEA BX, [DI+2] + Xor DX, DX + Mov Word Ptr [SI+4], BX + Xor AX, AX + Mov DWord Ptr [SI], 'JLNP' + +Network_CalculateCRC1: + LodsB + Add DH, AL + Xor DL, DH + Loop Network_CalculateCRC1 + +; Have DH = sum, DL = xor of running sum. +; Want to have DX = 0 after next two bytes +; second last byte = DL-DH +; last byte = -DL + + Sub AH, DL ; AH = -DL + Sub DL, DH ; DL = DL-DH + Mov AL, DL ; AL = DL-DH + + StosW + Mov CS:SendBufferOffset, 0 + Mov CS:SendBufferRemaining, BX + + Pop DS + + Ret + +EndP Network_CalculateCRC + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Network_GetSendBufferPage Near + ; Returns AX = EMSPageFrame + + Push CX + Push DX + + Mov CX, EMS_SENDBUFFERPAGE + Mov DX, CS:NetworkSendEMSHandle + Call E_MapEMSMemory + Call E_GetEMSPageFrame + + Pop DX + Pop CX + + Ret + +EndP Network_GetSendBufferPage + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +; Send Procedure Jump Table +; Each procedure is given DS:SI = Send queue data +; ES:DI = Send buffer +; Each procedure only need write to ES:DI. +; Count of bytes is taken from return value of DI, CRC+Header will be appended +; Can use AX, BX, CX, DX, DS, SI +; Must update CS:SendDataQueueHead + +NUMBEROFBLOCKTYPES EQU 10 + +ConvertQueueObjectTypes DW Offset SendNetworkBlock0 + DW Offset SendNetworkBlock1 + DW Offset SendNetworkBlock2 + DW Offset SendNetworkBlock3 + DW Offset SendNetworkBlock4 + DW Offset SendNetworkBlock5 + DW Offset SendNetworkBlock6 + DW Offset SendNetworkBlock7 + DW Offset SendNetworkBlock8 + DW Offset SendNetworkBlock9 + +; Receive Procedure Jump Table +; Given DS = Receive buffer +; Can use any register + +InterpretObjectTypes DW Offset ReceiveNetworkBlock0 + DW Offset ReceiveNetworkBlock1 + DW Offset ReceiveNetworkBlock2 + DW Offset ReceiveNetworkBlock3 + DW Offset ReceiveNetworkBlock4 + DW Offset ReceiveNetworkBlock5 + DW Offset ReceiveNetworkBlock6 + DW Offset ReceiveNetworkBlock7 + DW Offset ReceiveNetworkBlock8 + DW Offset ReceiveNetworkBlock9 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ +; +; Block Type 0 notes +; +; If first byte is between 80 and EF, then Val & 7F rows down are empty +; If first byte is between F0 and F7, then +; note field is empty, other fields are: +; Val & 1, ins present +; Val & 2, vol present +; Val & 4, eff present +; +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SendNetworkBlock0 Near + +; Block type 0 +; Offset 0: Pattern Number +; 1: Channel +; 2: Row +; 3: Width +; 4: Height + + LodsB + StosB + Mov DX, AX ; DL = Pattern Number + LodsW + StosW + Mov CX, AX ; CL = Channel, CH = Row + LodsW + Mov BX, AX ; BL = Width, BH = Height + + Mov CS:SendDataQueueHead, SI + + Push Pattern + Pop DS + Assume DS:Pattern + + Cmp DL, Byte Ptr PatternNumber ; Still editing the pattern? + JE SendNetworkBlock0_0 + + Xor AX, AX + StosW + + Ret + +SendNetworkBlock0_0: + StosW + Mov DS, PatternDataArea + Assume DS:Nothing + + Mov AL, 64 + Mul CH + Add AL, CL + LEA ESI, [EAX*4+EAX] + +SendNetworkBlock0_1: + Push BX + Push SI + + Xor DX, DX ; DL = num empty rows + +SendNetworkBlock0_2: + Push SI + + Cmp Byte Ptr [SI], 0FDh + JNE SendNetworkBlock0_3 + Cmp DWord Ptr [SI+1], 0000FF00h + JNE SendNetworkBlock0_3 + + Inc DX + Cmp DL, 6Fh + JB SendNetworkBlock0_NextCell + + Mov AL, 80h + Add AL, DL + StosB + Xor DX, DX + Jmp SendNetworkBlock0_NextCell + +SendNetworkBlock0_3: + Test DX, DX + JZ SendNetworkBlock0_4 + + Mov AL, 80h + Add AL, DL + StosB + Xor DX, DX + +SendNetworkBlock0_4: + LodsB + Cmp AL, 0FDh ; Empty note? + JE SendNetworkBlock0_5 + + StosB + MovsD + Jmp SendNetworkBlock0_NextCell + +SendNetworkBlock0_5: + Push BX + + Mov BX, DI + StosB ; Increment.. needs to be filled later + + Mov CL, 0F0h + LodsB + Test AL, AL ; instrument + JZ SendNetworkBlock0_6 + + StosB + Or CL, 1 + +SendNetworkBlock0_6: ; Volume + LodsB + Cmp AL, 0FFh + JE SendNetworkBlock0_7 + + StosB + Or CL, 2 + +SendNetworkBlock0_7: ; Effect + LodsW + Test AX, AX + JZ SendNetworkBlock0_8 + + StosW + Or CL, 4 + +SendNetworkBlock0_8: + Mov [ES:BX], CL + + Pop BX + +SendNetworkBlock0_NextCell: + Pop SI + Add SI, 320 + + Dec BH + JNZ SendNetworkBlock0_2 + + Test DX, DX + JZ SendNetworkBlock0_9 + + Mov AL, 80h + Or AL, DL + StosB + +SendNetworkBlock0_9: + Pop SI + Pop BX + + Add SI, 5 ; Next column + + Dec BL + JNZ SendNetworkBlock0_1 + + Ret + +EndP SendNetworkBlock0 + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ReceiveNetworkBlock0 Near + + Push Pattern + Pop ES + Assume ES:Pattern + + Mov [Word Ptr ES:Modified], 101h + + Mov AL, [DS:07h] ; AL = Pattern Number + + Cmp AL, [Byte Ptr ES:PatternNumber] + JNE ReceiveNetworkBlock0_1 + + Mov ES, [ES:PatternDataArea] + Assume ES:Nothing + + Mov CX, [DS:08h] ; CL = Channel, CH = Row + Mov BX, [DS:0Ah] ; BL = Width, BH = Height + + Test BX, BX + JZ ReceiveNetworkBlock0_1 + + Mov AL, 64 + Mul CH + Add AL, CL + LEA EDI, [EAX*4+EAX] + Mov AL, 5 + + Mul BL + Mov SI, 0Ch + +ReceiveNetworkBlock0_0: + Push BX + Push DI + +ReceiveNetworkBlock0_3: + LodsB + Cmp AL, 80h + JB ReceiveNetworkBlock0_4 + Cmp AL, 0F8h + JAE ReceiveNetworkBlock0_4 + + Cmp AL, 0F0h + JAE ReceiveNetworkBlock0_6 + +; Empty rows here. + And AL, 7Fh + Sub BH, AL + +ReceiveNetworkBlock0_11: + Mov Byte Ptr [ES:DI], 0FDh + Mov DWord Ptr [ES:DI+1], 0000FF00h + Add DI, 320 + Dec AL + JNZ ReceiveNetworkBlock0_11 + + Test BH, BH + JNZ ReceiveNetworkBlock0_3 + Jmp ReceiveNetworkBlock0_5 + +ReceiveNetworkBlock0_6: ; Partial row here. + Mov AH, AL + + Mov AL, 0FDh ; NONOTE + StosB + + Xor AL, AL + + Test AH, 1 + JZ ReceiveNetworkBlock0_7 + + LodsB + +ReceiveNetworkBlock0_7: + StosB + + Mov AL, 0FFh + Test AH, 2 + JZ ReceiveNetworkBlock0_8 + + LodsB + +ReceiveNetworkBlock0_8: + StosB + Test AH, 4 + Mov AX, 0 ; Don't erase flags + JZ ReceiveNetworkBlock0_9 + + LodsW + +ReceiveNetworkBlock0_9: + StosW + Jmp ReceiveNetworkBlock0_10 + +ReceiveNetworkBlock0_4: + StosB + MovsD + +ReceiveNetworkBlock0_10: + Add DI, 320-5 + + Dec BH + JNZ ReceiveNetworkBlock0_3 + +ReceiveNetworkBlock0_5: + + Pop DI + Pop BX + + Add DI, 5 + Dec BL + JNZ ReceiveNetworkBlock0_0 + + Ret + +ReceiveNetworkBlock0_1: ; Not the same, or zero width -> mark modified + +; DX = connection ID +; AL = Pattern number + + ; Sanity check + Cmp AL, 200 + JAE ReceiveNetworkBlock0_2 + + Mov BX, AX + Inc DX + And BX, 0FFh + Mov [CS:PatternModifiedTable+BX], DL + +ReceiveNetworkBlock0_2: + Ret + +EndP ReceiveNetworkBlock0 + Assume ES:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SendNetworkBlock1 + +; Block type 1 +; Offset 0: Pattern number + + Push FS + + Push Pattern + Pop FS + Assume FS:Pattern + + LodsB + Mov CS:SendDataQueueHead, SI + StosB + + And AX, 0FFh + +; Check whether request should be sent off to another node instead. +; AL = Pattern number + + Mov BX, AX + + Mov DH, [CS:PatternModifiedTable+BX] + + Test DH, DH + JZ SendNetworkBlock1_1 + + Mov CS:Destination, DH + Mov Byte Ptr [ES:DI-2], 2 ; NETWORK_REQUESTPATTERNOBJECT + + Jmp SendNetworkBlock1_2 + +SendNetworkBlock1_1: + Cmp AL, [Byte Ptr FS:PatternNumber] + JNE SendNetworkBlock1_0 + + Mov [FS:PatternModified], 0 + + PushAD + Push DS + Push ES + + Call PEFunction_StoreCurrentPattern + + Pop ES + Pop DS + PopAD + +SendNetworkBlock1_0: + Call Music_GetPatternLocation + ; Returns AX = handle + ; EBX = offset/segment (or page/segment) + ; CX = length (not including header) + ; DL = 0 for conv, 1 for EMS + + Push CS + Pop DS + Assume DS:Disk + + Add CX, 8 +; Setup EMS transfer + Mov TransferLength, CX + + Mov SourceType, DL + Mov SourceHandle, AX + Mov SourceOffset, EBX + + Mov AX, NetworkSendEMSHandle + Mov DestinationType, 1 + Mov DestinationHandle, AX + Mov [Word Ptr DestinationOffset], DI + Mov [Word Ptr DestinationOffset+2], 0 + +; Data is ready to go! + Mov AX, 5700h + Mov SI, Offset EMSTransferTable + Int 67h + + Add DI, CX + +SendNetworkBlock1_2: + Call Network_GetSendBufferPage + Mov ES, AX + + Pop FS + + Ret + +EndP SendNetworkBlock1 + Assume DS:Nothing, FS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ReceiveNetworkBlock1 + + Push FS + + Push Music + Pop FS + Assume FS:Music + + Mov EDX, [DS:8] + Mov AL, [DS:7] + + And AX, 0FFh ; AX = Pattern Number + ; DX = length + +; Sanity check + Cmp AL, 200 + JAE ReceiveNetworkBlock1_2 + + Call Music_ReleasePattern + + Cmp EDX, 400040h + JE ReceiveNetworkBlock1_1 + + Push AX + + Add DX, 8 + Push DX + Push AX + + Mov SI, AX + Call Music_AllocatePattern + + Pop AX + Call Music_GetPatternLocationNoCount + +; Setup EMS transfer + Push CS + Pop DS + Assume DS:Disk + + Mov DestinationType, 1 + Mov DestinationHandle, AX + Mov DestinationOffset, EBX + + Pop DX + + Mov AX, NetworkEMSHandle + Mov CX, LastReceiveCX ; CH = page + Mov TransferLength, DX + ShR CX, 8 + Mov SourceType, 1 + Mov SourceHandle, AX + Mov [Word Ptr SourceOffset], 8 + Mov [Word Ptr SourceOffset+2], CX + +; Data is ready to go! + Mov AX, 5700h + Mov SI, Offset EMSTransferTable + Int 67h + + Pop AX + +; Mark it off as handled +; AX = Pattern number + +ReceiveNetworkBlock1_1: + Mov BX, AX + Mov [CS:PatternModifiedTable+BX], 0 + + Push Pattern + Pop DS + Assume DS:Pattern + + Cmp AL, [Byte Ptr DS:PatternNumber] + JNE ReceiveNetworkBlock1_0 + + Call PE_NewPattern + +ReceiveNetworkBlock1_0: + Cmp AL, [Byte Ptr FS:CurrentPattern] + JNE ReceiveNetworkBlock1_2 + + Call Music_UpdatePatternOffset + +ReceiveNetworkBlock1_2: + Pop FS + Ret + +EndP ReceiveNetworkBlock1 + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SendNetworkBlock2 + + MovsB + Mov CS:SendDataQueueHead, SI + Ret + +EndP SendNetworkBlock2 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ReceiveNetworkBlock2 + + Mov AH, [DS:7] ; AH = pattern + Mov AL, 1 ; NETWORK_ENTIREPATTERNOBJECT + + ; Sanity check + Cmp AH, 200 + JAE ReceiveNetworkBlock2_1 + + Call Network_AddWordToQueue + +ReceiveNetworkBlock2_1: + Ret + +EndP ReceiveNetworkBlock2 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SendNetworkBlock3 + + LodsW ; Length + StosW + Mov CX, AX + LodsW + StosW + Mov CS:SendDataQueueHead, SI + + Push SongData + Pop DS + Mov SI, AX + + Rep MovsB + + Ret + +EndP SendNetworkBlock3 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ReceiveNetworkBlock3 + + Push SongData + Pop ES + + Mov CX, [DS:7] + Mov DI, [DS:9] + Mov SI, 11 + + ; Sanity check + Mov AX, CX + Add AX, DI + + Cmp AX, 512 + JA ReceiveNetworkBlock3_1 + + Rep MovsB + +ReceiveNetworkBlock3_1: + Ret + +EndP ReceiveNetworkBlock3 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SendNetworkBlock4 + + LodsB + StosB + And AX, 0FFh + Mov CS:SendDataQueueHead, SI + Add AX, AX + Mov SI, AX + + Push SongData + Pop DS + Mov SI, [64712+SI] + + Mov CX, 554/2 + Rep MovsW + +SendNetworkBlock4_1: + Ret + +EndP SendNetworkBlock4 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ReceiveNetworkBlock4 + + Mov DI, [DS:7] + And DI, 0FFh + Mov AX, DI ; AX = instrument + + ; Sanity check + Cmp AX, 100 + JAE ReceiveNetworkBlock4_1 + + Add DI, DI + + Push SongData + Pop ES + + Mov DI, [ES:64712+DI] + Mov SI, 8 + Mov CX, 554/2 + Rep MovsW + + Call PE_GetLastInstrument + Cmp AX, BX + JNE ReceiveNetworkBlock4_1 + + Call Glbl_GetCurrentMode + Cmp AL, 4 + JNE ReceiveNetworkBlock4_1 + + Call I_MapEnvelope + +ReceiveNetworkBlock4_1: + + Ret + +EndP ReceiveNetworkBlock4 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SendNetworkBlock5 ; Does not send length or + ; sample pointer. + + LodsB + StosB + And AX, 0FFh + Mov CS:SendDataQueueHead, SI + Add AX, AX + Mov SI, AX + + Push SongData + Pop DS + Mov SI, [64912+SI] + + Add SI, 4 + Mov CX, 2Ch/2 + Rep MovsW + LodsW ; Skip length + LodsW + Mov CX, 14h/2 + Rep MovsW + LodsW + LodsW + MovsW + MovsW + + Ret + +EndP SendNetworkBlock5 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ReceiveNetworkBlock5 + + Mov DI, [DS:7] + And DI, 0FFh + + Cmp DI, 100 + JAE ReceiveNetworkBlock5_1 + + Add DI, DI + + Push SongData + Pop ES + + Mov DI, [ES:64912+DI] + Mov SI, 8 + ScasW + ScasW + Mov CX, 2Ch/2 + Rep MovsW + ScasW + ScasW + Mov CX, 14h/2 + Rep MovsW + ScasW + ScasW + MovsW + MovsW + +ReceiveNetworkBlock5_1: + Ret + +EndP ReceiveNetworkBlock5 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SendNetworkBlock6 + + MovsW + Mov CS:SendDataQueueHead, SI + + Ret + +EndP SendNetworkBlock6 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ReceiveNetworkBlock6 + + Mov AX, [DS:7] ; AL = pattern number, AH = numrows + + Push Pattern + Pop DS + Assume DS:Pattern + + Cmp AL, [Byte Ptr PatternNumber] + JNE ReceiveNetworkBlock6_1 + + Cmp AH, 200 + JAE ReceiveNetworkBlock6_2 + + Mov [Byte Ptr MaxRow], AH + +ReceiveNetworkBlock6_2: + Ret + +ReceiveNetworkBlock6_1: + Jmp ReceiveNetworkBlock0_1 ; Marks pattern as modified. + +EndP ReceiveNetworkBlock6 + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SendNetworkBlock7 + + MovsB + Mov CS:SendDataQueueHead, SI + Ret + +EndP SendNetworkBlock7 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ReceiveNetworkBlock7 + + Mov AL, [DS:7] + Mov AH, 1 + + Cmp AL, 100 + JAE ReceiveNetworkBlock7_1 + + Call Music_ReleaseSample + +ReceiveNetworkBlock7_1: + Ret + +EndP ReceiveNetworkBlock7 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SendNetworkBlock8 ; New sample + + MovsB + MovsD + Mov CS:SendDataQueueHead, SI + + Ret + +EndP SendNetworkBlock8 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ReceiveNetworkBlock8 ; New sample + +; Call Music_Stop + + Mov AX, [DS:7] + And AX, 0FFh ; AX = Sample number + + ; Sanity check + Cmp AX, 100 + JAE ReceiveNetworkBlock8_2 + + Mov SI, AX + Add SI, AX + Mov EDX, [DS:8] + + Push SongData + Pop DS + + Mov SI, [SI+64912] ; DS:SI = sample + Mov ECX, EDX + + Test Byte Ptr [SI+12h], 2 ; 16 bit? + JZ ReceiveNetworkBlock8_1 + + Add EDX, EDX + +ReceiveNetworkBlock8_1: + Call Music_AllocateSample + Mov [SI+30h], ECX + +ReceiveNetworkBlock8_2: + Ret + +EndP ReceiveNetworkBlock8 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetSampleLocation ; Given BX = EMS transfer structure + ; Given DX = sample number + ; Given ECX = offset + ; Returns carry if problem. + + PushAD + Push DS + + Push SongData + Pop DS + Mov SI, DX + Add SI, DX + Mov SI, [64912+SI] ; DS:SI = sample header + + Mov EAX, [SI+30h] + + Test Byte Ptr [SI+12h], 2 + JZ GetSampleLocation2 + + Add EAX, EAX + +GetSampleLocation2: + Cmp EAX, ECX + JB GetSampleLocation1 + + Mov EDX, EAX + Sub EDX, ECX + Cmp EDX, 32768 + JB GetSampleLocation6 + + Mov DX, 32768 + +GetSampleLocation6: + Mov [CS:TransferLength], DX + + Cmp Byte Ptr [SI+48h], 1 + JB GetSampleLocation1 + JA GetSampleLocation4 + +GetSampleLocation3: ; Conventional memory + Mov Byte Ptr [CS:BX], 0 ; type + Mov DWord Ptr [CS:BX+1], 0 ; handle,Offset + ShR ECX, 4 + Add CX, [SI+4Ah] + Mov Word Ptr [CS:BX+5], CX ; segment + + Jmp GetSampleLocation5 + +GetSampleLocation4: ; Expanded memory + Mov AX, [SI+4Ah] + Mov Byte Ptr [CS:BX], 1 + Mov Word Ptr [CS:BX+1], AX ; handle + Mov AX, CX + ShR ECX, 14 + And AX, 3FFFh + Mov [CS:BX+3], AX ; Offset + Mov [CS:BX+5], CX ; Page + + Jmp GetSampleLocation5 + +GetSampleLocation1: + StC + +GetSampleLocation5: + Pop DS + PopAD + + Ret + +EndP GetSampleLocation + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc SendNetworkBlock9 + + LodsB + StosB + Mov DX, AX + LodsD + StosD + Mov ECX, EAX + And DX, 0FFh + Mov CS:SendDataQueueHead, SI + + Mov BX, Offset SourceType + Call GetSampleLocation + JC SendNetworkBlock9_1 + + Push CS + Pop DS + Assume DS:Disk + + Mov AX, NetworkSendEMSHandle + Mov DestinationType, 1 + Mov DestinationHandle, AX + Mov [Word Ptr DestinationOffset], DI + Mov [Word Ptr DestinationOffset+2], 0 + + Add DI, TransferLength + +; Data is ready to go! + Mov AX, 5700h + Mov SI, Offset EMSTransferTable + Int 67h + + Ret + +SendNetworkBlock9_1: + Sub DI, 5 + + Ret + +EndP SendNetworkBlock9 + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ReceiveNetworkBlock9 + + Mov DX, [DS:7] + Mov ECX, [DS:8] + And DX, 0FFh + Mov BX, Offset DestinationType + Mov AX, NetworkEMSHandle + Mov SI, LastReceiveCX ; CH = page + + ; Sanity Check + Cmp DX, 100 + JAE ReceiveNetworkBlock9_1 + + Call GetSampleLocation + JC ReceiveNetworkBlock9_1 + + Push CS + Pop DS + Assume DS:Disk + + ShR SI, 8 + Mov SourceType, 1 + Mov SourceHandle, AX + Mov [Word Ptr SourceOffset], 12 + Mov [Word Ptr SourceOffset+2], SI + +; Data is ready to go! + Mov AX, 5700h + Mov SI, Offset EMSTransferTable + Int 67h + +ReceiveNetworkBlock9_1: + Ret + +EndP ReceiveNetworkBlock9 + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Network_SendData Far +; Called by driver when it is able to send data +; +; Provided: AX = number of bytes it can send. +; ES:DI = buffer location +; +; Returns: CX = number of bytes to send, 0 if no data. +; DX = receiver's connection ID. 0 = all, 1->3 = specific. + + PushF + CLI + Push DS + Push ES + Push DI + + Push AX + Push DX + + Mov AH, 47h + Mov DX, CS:NetworkSendEMSHandle + Int 67h + + Test AH, AH + + Pop DX + Pop AX + + JNZ Network_SendDataError + + Cmp CS:DriverValidated, 1 + JNE Network_SendDataError + + Mov CX, CS:SendBufferRemaining + Test CX, CX + JNZ Network_SendData1 + +; Need to get a new block of data into the buffer. + +Network_SendData3: + Mov CX, CS:SendDataQueueTail + Mov SI, CS:SendDataQueueHead + + Sub CX, SI + JZ Network_SendDataEnd + + Mov DS, SendQueueSegment + Assume DS:Nothing + + Push AX + Push BX + Push BP + Push ES + Push DI + Push FS + +; Mov DX, CS:NetworkEMSHandle +; Call E_SavePageFrame + + Call Network_GetSendBufferPage + Mov ES, AX + Mov DI, 6 + + LodsB + Mov CS:Destination, AL + LodsB + StosB + Mov BL, AL + And BX, 0FFh + Add BX, BX + Call [CS:ConvertQueueObjectTypes+BX] + Call Network_CalculateCRC + + Cmp [CS:SendDataQueueHead], 16384-16 + JB Network_SendData4 + + Mov [CS:SendDataQueueHead], 0 + +Network_SendData4: + + Mov CX, BX ; CX = SendBufferRemaining + + Pop FS + Pop DI + Pop ES + Pop BP + Pop BX + Pop AX + +; Push DX +; Mov DX, CS:NetworkEMSHandle +; Call E_RestorePageFrame +; Pop DX + + Cmp CX, 9 + JA Network_SendData1 + + Mov DWord Ptr [CS:SendBufferRemaining], 0 + Jmp Network_SendData3 + +Network_SendData1: ; Send buffer has data remaining + Mov SI, CS:SendBufferOffset + + Cmp CX, AX + JB Network_SendData2 + + Mov CX, AX + +Network_SendData2: + Add CS:SendBufferOffset, CX + Sub CS:SendBufferRemaining, CX + + Call Network_GetSendBufferPage + Mov DS, AX + + Xor DX, DX + Push CX + Rep MovsB + Pop CX + Mov DL, CS:Destination + +Network_SendDataEnd: + Push DX + + Mov AH, 48h + Mov DX, CS:NetworkSendEMSHandle + Int 67h + + Pop DX + + Pop DI + Pop ES + Pop DS + PopF + + Ret + +Network_SendDataError: + Pop DI + Pop ES + Pop DS + PopF + + Xor CX, CX + Xor DX, DX + Ret + +EndP Network_SendData + + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +ReceiveToBlock DB 0, 8, 16 + +; EMS layout: +; EMS:65532: Check word +; EMS:65534: Buffer Offset + +Proc Network_ReceiveData Far +; Called by driver when data is received +; +; Provided: DS:SI = data block received +; BX = sender's connection ID (0->2) +; CX = byte count received + + PushF + CLI + Push CX + + Mov AH, 47h + Mov DX, CS:NetworkEMSHandle + Int 67h + + Test AH, AH + JNZ Network_ReceiveData3 +; Call E_SavePageFrame + + Cmp CS:DriverValidated, 1 + JNE Network_ReceiveData3 + + Mov CL, 512/16 + Mov CH, [CS:ReceiveToBlock+BX] + Mov CS:LastReceiveCX, CX + Call E_MapEMSMemory + + Call E_GetEMSPageFrame + + Pop CX + + Mov ES, AX + Mov DI, [ES:65534] + +; Consistency check -> if at start of block, make sure that the header contains +; 'JLNP' + + Test DI, DI + JNZ Network_ReceiveData1 + + Cmp DWord Ptr [SI], 'JLNP' + JNE Network_ReceiveDataEnd + +Network_ReceiveData1: + Mov DX, [ES:65532] + +; Assume OK.. now place data into buffer, updating check word. +Network_ReceiveData2: + LodsB + Add DL, AL + StosB + Xor DH, DL + Loop Network_ReceiveData2 + + Cmp DI, [ES:4] + JAE Network_ReceiveDataBlockFinished + + Mov [ES:65532], DX + Mov [ES:65534], DI + +Network_ReceiveDataEnd: + Mov AH, 48h + Mov DX, CS:NetworkEMSHandle + Int 67h +; Mov DX, CS:NetworkEMSHandle +; Call E_RestorePageFrame + + PopF + + ClC + + Ret + +Network_ReceiveDataBlockFinished: + Xor Byte Ptr [CS:ReceiveToBlock+BX], 4 + Mov DWord Ptr [ES:65532], 0 + Test DX, DX + JNZ Network_CRCFail ; CRC check failed + +; ********************* Need to handle block types here. + PushAD + Push DS + + Push ES + Pop DS + + Mov SI, [DS:6] + And SI, 0FFh + + Cmp SI, NUMBEROFBLOCKTYPES + JAE Network_ReceiveDataBlockError + + Add SI, SI + Mov DX, BX + Call [InterpretObjectTypes+SI] + +Network_ReceiveDataBlockError: + Pop DS + PopAD + Jmp Network_ReceiveDataEnd + +Network_CRCFail: + Mov AH, 48h + Mov DX, CS:NetworkEMSHandle + Int 67h + Push CX + +Network_ReceiveData3: + Pop CX + PopF + + StC + + Ret + +EndP Network_ReceiveData + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Network_GetSendQueue Far + + PushAD + PushF + Push DS + Push ES + + Sub SP, 4 + Push BP + Mov BP, SP + Mov EDI, [BP+44] + Mov [BP+2], EDI + Pop BP + + Push AX + Push DS + + ClI + + Push CS + Pop DS + Assume DS:Disk + +Comment ~ + This code is incomplete + Mov AX, SendDataQueueTail + Sub AX, SendDataQueueHead + Cmp AX, 16384-16 + JB Network_GetSendQueue2 + + Call [NetworkDriver_UnloadDriver] + + Xor AX, AX + Jmp Network_GetSendQueue1 + +Network_GetSendQueue2: +~ + Call [NetworkDriver_ConnectionStatus] + Mov DI, [SendQueueSegment] + Or AX, DI + Mov ES, DI + Mov DI, [SendDataQueueTail] + +Network_GetSendQueue1: + Pop DS + Pop AX + + Ret + +EndP Network_GetSendQueue + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Network_FinishedSendQueue Far + + Cmp DI, 16384-16 ; 16 bytes slack area + JB Network_FinishedSendQueue1 + + Xor DI, DI + +Network_FinishedSendQueue1: + Mov [CS:SendDataQueueTail], DI + Mov BP, SP + Pop EAX + Mov [BP+42], EAX + +IF SHOWQUEUESIZE + Push CS + Pop DS + Mov AX, SendDataQueueTail + Sub AX, SendDataQueueHead + Mov SI, Offset DebugMessage + Call SetInfoLine +ENDIF + + Pop ES + Pop DS + PopF + PopAD + + Ret + +EndP Network_FinishedSendQueue + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Network_NewConnection Far ; Called when this computer + ; joins a group + + PushA + Push ES + + Push CS + Pop ES + + Mov CX, 200/2 ; Mark all patterns as requiring + ; update from host connection + Mov DI, Offset PatternModifiedTable + Mov AX, 101h + Rep StosW + + Call Music_Stop + Call D_ClearFileName + + Pop ES + PopA + Ret + + +EndP Network_NewConnection + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ResetDI + + Cmp DI, 16384-16 + JB ResetDI1 + + Xor DI, DI + +ResetDI1: + Ret + +EndP ResetDI + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Network_QueueSampleData Far ; Given CX = Sample number, 0 base + ; DL = ConnectionID + + Push EAX + Push EBX + Push ECX + Push DX + Push SI + Push DS + + Push SongData + Pop DS + + Call Network_GetSendQueue + JZ Network_QueueSampleData2 + + Mov SI, CX + Add SI, CX + Mov SI, [SI+64912] ; DS:SI = sample + + Test Byte Ptr [SI+12h], 1 + JZ Network_QueueSampleData2 + + Mov EBX, [SI+30h] + Test EBX, EBX + JZ Network_QueueSampleData2 + + Mov AL, DL + Mov AH, 8 + StosW + Mov AL, CL + StosB + Mov EAX, EBX ; Length + StosD + Call ResetDI + + Mov DH, CL + + Xor ECX, ECX + Test Byte Ptr [SI+12h], 2 + JZ Network_QueueSampleData1 + + Add EBX, EBX + +Network_QueueSampleData1: + Mov AL, DL + Mov AH, 9 + StosW + Mov AL, DH + StosB + Mov EAX, ECX + StosD + Call ResetDI + + Add ECX, 32768 + Cmp ECX, EBX + JB Network_QueueSampleData1 + +Network_QueueSampleData2: + Call Network_FinishedSendQueue + + Pop DS + Pop SI + Pop DX + Pop ECX + Pop EBX + Pop EAX + + Ret + +EndP Network_QueueSampleData + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Network_EstablishConnection Far ; Called when a connection is + ; made to this computer +; Called when a successful connection is made +; Given AL = new connection number + +; This basically adds all samples, instruments, patterns, +; and order list to the send queue (or requests to the appropriate nodes) + + PushA + Push DS + Push ES + + Mov ES, CS:SendQueueSegment + Mov DI, CS:SendDataQueueTail + +; Send Patterns + Xor CX, CX + Mov DX, AX + +Network_EstablishConnection1: ; 3 * 200 bytes + Mov AL, DL ; Destination + Mov AH, 1 ; NETWORK_ENTIREPATTERNOBJECT + StosW + Mov AL, CL + StosB + Call ResetDI + Inc CX + Cmp CX, 200 + JB Network_EstablishConnection1 + +; Send Instruments + Xor CX, CX + +Network_EstablishConnection2: ; 3 * 100 bytes + Mov AL, DL ; Destination + Mov AH, 4 + StosW + Mov AL, CL + StosB + Call ResetDI + Inc CX + Cmp CX, 100 + JB Network_EstablishConnection2 + +; Send Sample headers + Xor CX, CX + +Network_EstablishConnection3: ; 3 * 100 bytes + Mov AL, DL ; Destination + Mov AH, 5 + StosW + Mov AL, CL + StosB + Call ResetDI + Inc CX + Cmp CX, 100 + JB Network_EstablishConnection3 + +; Now send order list ; 6 bytes + Mov AL, DL ; Destination + Mov AH, 3 ; NETWORK_SONGDATAOBJECT + StosW + Mov AX, 512 ; Length + StosW + Xor AX, AX ; Offset + StosW + Call ResetDI + + Mov CS:SendDataQueueTail, DI + + Xor CX, CX + +Network_EstablishConnection4: + Call Network_QueueSampleData + + Inc CX + + Cmp CX, 100 + JB Network_EstablishConnection4 + +; Loop through patterns and make sure that no patterns are destined for new +; connection + + Push CS + Pop ES + + Mov CX, 200 + Mov DI, Offset PatternModifiedTable + +Network_EstablishConnection5: + Mov AL, [ES:DI] + Cmp AL, DL + JNE Network_EstablishConnection6 + + Xor AL, AL + +Network_EstablishConnection6: + StosB + Loop Network_EstablishConnection5 + + Pop ES + Pop DS + PopA + + Ret + +EndP Network_EstablishConnection + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Network_AddWordToQueue Far ; Given AX, broadcasts to all + + Call Network_GetSendQueue + JZ Network_AddWordToQueue0 + + Push AX + Xor AL, AL + StosB + Pop AX + StosW + +Network_AddWordToQueue0: + Call Network_FinishedSendQueue + Ret + +EndP Network_AddWordToQueue + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Network_UpdatePatternIfIdle Far + + Cmp CS:SendQueueSegment, 0 + JE Network_UpdatePatternEnd + + Push AX + Mov AX, CS:SendDataQueueTail + Cmp AX, CS:SendDataQueueHead + Pop AX + JNE Network_UpdatePatternEnd + +Proc Network_UpdatePattern Far + + PushA + ; AX = pattern number +; Check whether it is current. +; AL = Pattern number + + Mov BX, AX + And BX, 0FFh + Xor AX, AX + + XChg [CS:PatternModifiedTable+BX], AL + Test AL, AL + JZ Network_UpdatePattern1 + +; AL = connection request + Call Network_GetSendQueue + JZ Network_UpdatePattern2 + + StosB + Mov AL, 2 ; NETWORK_REQUESTPATTERNOBJECT + Mov AH, BL + StosW + +Network_UpdatePattern2: + Call Network_FinishedSendQueue + +Network_UpdatePattern1: + PopA + +Network_UpdatePatternEnd: + Ret + +EndP Network_UpdatePattern + +EndP Network_UpdatePatternIfIdle + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Network_EnsureNoNetwork Far + + Push AX + Call [CS:NetworkDriver_ConnectionStatus] + Test AL, AL + Pop AX + JZ Network_EnsureNoNetwork1 + + Mov DI, Offset O1_NetworkErrorList + Mov CX, 2 + Call M_Object1List + + Mov AX, 1 + Add SP, 4 + +Network_EnsureNoNetwork1: + Ret + +EndP Network_EnsureNoNetwork + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Network_SendSampleHeader Far + + Call Network_GetSendQueue + JZ Network_SendSampleHeader1 + + Mov AX, 500h ; Sample header, broadcast + StosW + Call PE_GetLastInstrument + Mov AL, BL + StosB + +Network_SendSampleHeader1: + Call Network_FinishedSendQueue + Ret + +EndP Network_SendSampleHeader + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Network_SendInstrumentHeader Far + + Call Network_GetSendQueue + JZ Network_SendInstrumentHeader1 + + Mov AX, 400h ; Instrument header, broadcast + StosW + Call PE_GetLastInstrument + Mov AL, BL + StosB + +Network_SendInstrumentHeader1: + Call Network_FinishedSendQueue + Ret + +EndP Network_SendInstrumentHeader + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Network_SendSongDataInformation Far ; CX = Count, DX = offset + + Call Network_GetSendQueue + JZ Network_SendSongDataInformation1 + + Mov AX, 300h + StosW + Mov AX, CX + StosW + Mov AX, DX + StosW + +Network_SendSongDataInformation1: + Call Network_FinishedSendQueue + Ret + +EndP Network_SendSongDataInformation + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +EndS + +ENDIF + +End diff --git a/IT_OBJ1.ASM b/IT_OBJ1.ASM new file mode 100644 index 0000000..c825fa7 --- /dev/null +++ b/IT_OBJ1.ASM @@ -0,0 +1,8902 @@ + Jumps + +include switch.inc + + Extrn D_SaveInstrument:Far + Extrn D_LSCheckLoopValues:Far + Extrn D_LSCheckSusLoopValues:Far + + Extrn D_PreLoadSampleWindow:Far + Extrn D_DrawLoadSampleWindow:Far + Extrn D_PostLoadSampleWindow:Far + + Extrn D_LSDrawDriveWindow:Far + Extrn D_LSPreDriveWindow:Far + Extrn D_LSPostDriveWindow:Far + + Extrn D_LIDrawDriveWindow:Far + Extrn D_LIPreDriveWindow:Far + Extrn D_LIPostDriveWindow:Far + + Extrn D_SaveSample:Far + Extrn D_SaveRawSample:Far + Extrn D_SaveST3Sample:Far + + Extrn D_GetFormatType:Far + + Extrn D_SlowSampleSort:Far + Extrn D_SlowInstrumentSort:Far + Extrn D_SaveDirectoryConfiguration:Far + Extrn D_LoadSampleNames:Far + Extrn D_LoadSongNames:Far + Extrn D_DrawFileWindow:Far + Extrn D_DrawDirectoryWindow:Far + Extrn D_DrawDriveWindow:Far + Extrn D_PreFileWindow:Far + Extrn D_SaveModule:Far + Extrn D_PostFileLoadWindow:Far + Extrn D_PostFileSaveWindow:Far + Extrn D_PreDirectoryWindow:Far + Extrn D_PostDirectoryWindow:Far + Extrn D_PostViewSampleLibrary:Far + Extrn D_PreDriveWindow:Far + Extrn D_PostDriveWindow:Far + Extrn D_PostSaveDriveWindow:Far + Extrn D_NewDirectory:Far + Extrn D_NewSpecifier:Far + +IF TUTORIAL +ELSE + Extrn D_LoadXM:Far + Extrn D_LoadS3M:Far + Extrn D_LoadMOD:Far + Extrn D_LoadIT:Far + Extrn D_LoadMTM:Far + Extrn D_Load669:Far +ENDIF + Extrn D_DrawHeader:Far + Extrn D_SaveIT:Far + Extrn D_SaveS3M:Far + Extrn D_SaveSong:Far + Extrn Quit:Far + + Extrn D_DrawLoadInstrument:Far + Extrn D_PreLoadInstrument:Far + Extrn D_PostLoadInstrument:Far + Extrn D_LoadInstrumentNames:Far + Extrn D_ViewInstrument:Far + +IF EMSDEBUG + + Extrn E_DumpEMSMemory:Far + +ENDIF + + Extrn LSWindow_Up:Far + Extrn LSWindow_Down:Far + + Extrn SongDirectory:Byte + Extrn FileSpecifier:Byte + + Extrn F_InstrumentButtonHandler:Far + + + Extrn F_DrawHeader:Far + Extrn F_Return0:Far + Extrn F_Return1:Far + Extrn F_ShowChannels:Far + Extrn F_RedrawScreen:Far + Extrn F_GotoEmptyList:Far + Extrn F_DrawSMCChannels:Far + Extrn F_Nothing:Far + Extrn F_CalculateLength:Far + + Extrn F_MainMenu:Far + Extrn F_Help:Far ; Menu functions + Extrn F_ViewVariables:Far + Extrn F_ViewOrderPan:Far + Extrn F_ViewPattern:Far + + Extrn F_FileMenu:Far + Extrn F_FileLoad:Far + Extrn F_FileNew:Far + Extrn F_FileSaveCurrent:Far + Extrn F_FileSaveAs:Far + Extrn F_FileDOSShell:Far + Extrn F_FileQuit:Far + + Extrn F_PlaybackMenu:Far + Extrn F_InfoPage:Far + Extrn F_PlaySong:Far + Extrn F_PlayPattern:Far + Extrn F_PlayOrder:Far + Extrn F_PlayMark:Far + Extrn F_Stop:Far + Extrn F_ReinitSoundCard:Far + Extrn F_DriverScreen:Far + Extrn F_CalculateLength:Far + + Extrn F_MessageEditor:Far + Extrn F_SampleMenu:Far + Extrn F_SampleList:Far + Extrn F_SampleLibrary:Far + Extrn F_ReloadGravis:Far + + Extrn F_Return64:Far + Extrn F_Return192:Far + + Extrn F_InstrumentMenu:Far + Extrn F_InstrumentList:Far + Extrn F_InstrumentLibrary:Far + + Extrn F_ShowMIDIZxxInput:Far + Extrn F_MIDI_Up:Far, F_MIDI_Down:Far + Extrn F_MIDI_PgUp:Far, F_MIDI_PgDn:Far + +IF SPECTRUMANALYSER + Extrn Fourier_Start:Far + Extrn Fourier_PreDrawScreen:Far + Extrn Fourier_DrawScreen:Far + Extrn Fourier_PostFunction:Far + Extrn Fourier_IdleList:Far + Extrn Fourier_ChangePalette:Far +ENDIF + + Extrn K_DrawTables:Far + Extrn K_ResetKeyboardTables:Far + Extrn K_ShowMIDIInput:Far + + Extrn PEFunction_IncreaseOctave:Far + Extrn PEFunction_DecreaseOctave:Far + + Extrn Glbl_DriverScreen:Far + Extrn Glbl_Ctrl_F1:Far + Extrn Glbl_Ctrl_F3:Far + Extrn Glbl_Ctrl_F4:Far + Extrn Glbl_Ctrl_F5:Far + Extrn Glbl_Ctrl_F12:Far + Extrn Glbl_F8:Far + Extrn Glbl_F9:Far + Extrn Glbl_F10:Far + Extrn Glbl_F11:Far + Extrn Glbl_F12:Far + Extrn Glbl_F2:Far + Extrn Glbl_F3:Far + Extrn Glbl_F4:Far + Extrn Glbl_F5:Far + Extrn Glbl_F6:Far + Extrn PE_F7:Far ; Global... + Extrn Glbl_Shift_F1:Far + Extrn Glbl_Shift_F6:Far + Extrn Glbl_Shift_F9:Far + Extrn Glbl_Alt_F1:Far + Extrn Glbl_Alt_F2:Far + Extrn Glbl_Alt_F3:Far + Extrn Glbl_Alt_F4:Far + Extrn Glbl_Alt_F5:Far + Extrn Glbl_Alt_F6:Far + Extrn Glbl_Alt_F7:Far + Extrn Glbl_Alt_F8:Far + Extrn Glbl_LoadSample:Far + Extrn Glbl_LoadInstrument:Far + Extrn Glbl_LeftBrace:Far + Extrn Glbl_RightBrace:Far + Extrn Glbl_LeftSquareBracket:Far + Extrn Glbl_RightSquareBracket:Far + +IF NETWORKENABLED + Extrn Network_DriverScreen:Far + Extrn Network_DrawDriverScreen:Far + Extrn Network_PreDriverScreen:Far + Extrn Network_PostDriverScreen:Far + + Public O1_LoadNetworkDriver +ENDIF + +IF TIMERSCREEN + Extrn Glbl_TimerScreen:Far + Extrn D_DrawTimer:Far, D_PostTimerList:Far +ENDIF + + Extrn H_HelpESC:Far + Extrn H_Help:Far + Extrn H_DrawHelp:Far + + Extrn H_HelpUp:Far + Extrn H_HelpDown:Far + Extrn H_HelpPgUp:Far + Extrn H_HelpPgDn:Far + + Extrn I_SelectScreen:Far + Extrn I_InstrumentListSpace:Far + Extrn I_InstrumentListNoteOff:Far + Extrn I_AmplifySample:Far + Extrn I_GetInstrumentScreen:Far + Extrn I_SampleButtonHandler:Far + Extrn I_CalculateC5Speed:Far + Extrn I_PrintC5Frequency:Far + + Extrn I_DoubleSampleSpeed:Far + Extrn I_HalveSampleSpeed:Far + Extrn I_SampleSpeedSemiUp:Far + Extrn I_SampleSpeedSemiDown:Far + + Extrn I_PlaySample:Far + Extrn I_PlayNote:Far + + Extrn I_DrawPitchPanCenter:Far + Extrn I_PrePitchPanCenter:Far + Extrn I_PostPitchPanCenter:Far + + Extrn I_IncreasePlayChannel:Far + Extrn I_DecreasePlayChannel:Far + + Extrn I_DeleteInstrument:Far + Extrn I_ReverseSample:Far + Extrn I_InvertSample:Far + Extrn I_CutSampleBeforeLoop:Far + Extrn I_ConvertSample:Far + Extrn I_DeleteSample:Far + Extrn I_CutSample:Far + Extrn I_ExchangeSamples:Far + Extrn I_SwapSamples:Far + Extrn I_ReplaceSample:Far + Extrn I_ReplaceInstrument:Far + Extrn I_SwapInstruments:Far + Extrn I_ResizeSample:Far + Extrn I_ResizeSampleNoInt:Far + Extrn I_UpdateInstrument:Far + Extrn I_ToggleSampleQuality:Far + Extrn I_CopyInstrument:Far + Extrn I_CenterSample:Far + Extrn I_ScaleInstrumentVolumes:Far + Extrn I_ScaleSampleVolumes:Far + + Extrn I_DrawInstrumentWindow:Far + Extrn I_PreInstrumentWindow:Far + Extrn I_PostInstrumentWindow:Far + Extrn I_ToggleMultiChannel:Far + + Extrn I_DrawNoteWindow:Far + Extrn I_PreNoteWindow:Far + Extrn I_PostNoteWindow:Far + + Extrn I_DrawEnvelope:Far + Extrn I_PreEnvelope:Far + Extrn I_PostEnvelope:Far + + Extrn I_ShowSampleInfo:Far + Extrn I_SampleUp:Far + Extrn I_SampleDown:Far + Extrn I_CheckLoopValues:Far + Extrn I_CheckSusLoopValues:Far + + Extrn I_DrawSampleList:Far + Extrn I_PreSampleList:Far + Extrn I_PostSampleList:Far + Extrn I_IdleUpdateEnvelope:Far + + Extrn Msg_DrawMessage:Far + Extrn Msg_PreMessage:Far + Extrn Msg_PostMessage:Far + + Extrn Music_SoundCardLoadAllSamples:Far + Extrn Music_ReinitSoundCard:Far + Extrn Music_SaveMIDIConfig:Far + Extrn Music_ShowAutodetectSoundcard:Far + Extrn Music_ToggleOrderUpdate:Far + + Extrn PE_FillHeader:Far + Extrn PE_SetCommandCursor:Far + Extrn PE_DrawPatternEdit:Far + Extrn PE_PrePatternEdit:Far + Extrn PE_PostPatternEdit:Far + + Extrn PEFunction_DrawUndo:Far + Extrn PEFunction_PreUndo:Far + Extrn PEFunction_PostUndo:Far + + Extrn S_UpdateScreen:Far + Extrn S_RestoreScreen:Far + + Extrn DrawDisplayData:Far + Extrn PostDisplayData:Far + Extrn DisplayUpdateScreen:Far + + Extrn BaseOctave + Extrn SkipValue + Extrn RowHiLight1 + Extrn RowHiLight2 + Extrn NumberOfRows:Word + Extrn Amplification + Extrn InstrumentAmplification + Extrn FastVolumeAmplification + Extrn SampleAmplification + Extrn CommandToValue + Extrn MultiChannelInfo + Extrn SampleNumberInput:Byte + Extrn SongDirectory:Byte + Extrn SampleDirectory:Byte + Extrn InstrumentDirectory:Byte + + Extrn IdleUpdateInfoLine:Far + Extrn DOSShell:Far + + Extrn I_ExchangeInstruments:Far + + Extrn F_ConfigButtonSetup:Far + Extrn F_SetControlInstrument:Far + Extrn F_SetControlSample:Far + Extrn F_SetMono:Far + Extrn F_SetStereo:Far + Extrn F_SetAmiga:Far + Extrn F_SetLinear:Far + + Extrn F_NewSong:Far + + Extrn AddressInput:Byte + Extrn NewSampleSize:Word + Extrn ThumbStringEnter:Byte + Extrn SampleName:Byte + +If MEMORYDEBUG + + Extrn F_PostDebug:Far + Extrn Glbl_Debug:Far + Extrn F_DrawDebug:Far + Extrn F_DebugUp:Far + Extrn F_DebugDown:Far + Extrn F_DebugPgUp:Far + Extrn F_DebugPgDn:Far + Extrn F_DebugStringInput:Far + Global O1_DebugList + +ENDIF + + Extrn PaletteDefs:Byte + + Extrn S_UsePresetPalette:Far + Extrn DisplayMinus:Far + Extrn DisplayPlus:Far + Extrn PatternSetLength, PatternLengthStart, PatternLengthEnd + + Extrn MouseToggle:Far + Extrn Refresh:Far + + Extrn MIDI_SetInstrument:Far, CentraliseCursor + Extrn MIDI_PlayNote:Far, MIDI_NoteOff:Far, MIDI_PlaySample:Far + Extrn MIDICentralNote, MIDIAmplification + + Extrn Music_TimeSong:Far, Music_ShowTime:Far + Extrn Flags + + Extrn Music_ToggleSoloInstrument:Far + Extrn Music_ToggleSoloSample:Far + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + + Global O1_MIDIScreen + Global O1_LongMessageList + Global O1_MessageList + Global O1_ConfirmNoSave + + Global O1_MainMenu + Global O1_PlayBackMenu + Global O1_SampleMenu + Global O1_FileMenu + Global O1_InstrumentMenu + + Global O1_EditSampleName + + Global O1_AutoDetectList + + Global O1_ShowTime + Global O1_SampleCenterList + Global O1_ConfirmClearMessage + Global O1_SampleAmplificationList + Global O1_EnableInstrumentMode + Global O1_OutOfSoundCardMemoryList + Global O1_OutOfSamplesList + Global O1_NewSongList + Global O1_InitInstrument + Global O1_ThumbStringList + Global O1_ConfigureITList + Global O1_OrderVolumeList + Global O1_HelpList + Global O1_OrderPanningList + Global O1_PatternEditList + Global O1_PEConfigList + Global O1_OutOfMemoryList + Global O1_OutOfSoundCardMemoryList + Global O1_SwapOutOfRangeList + Global O1_OverlapBlockList + Global O1_NoBlockMarkedList + Global O1_NoBlockDataList + Global O1_GetAmpList + Global O1_GetInstrumentAmpList + Global O1_GetFastAmpList + +IF SHOWPATTERNLENGTH + Global O1_ShowPatternLengthList +ENDIF + + Global O1_C5FrequencyList + +IF SPECTRUMANALYSER + Global O1_FourierDisplay +ENDIF + Global O1_EMSWarningMessage +IF NETWORKENABLED + Global O1_NetworkErrorList +ENDIF + Global O1_TemplateErrorList + Global O1_PatternTooLongList + Global O1_SampleList + Global O1_LoadModuleList + Global O1_SaveModuleList + Global O1_SaveS3MList + Global O1_LoadS3MList + Global O1_LoadXMList + Global O1_LoadMODList + Global O1_Load669List + Global O1_LoadMTMList + Global O1_LoadITList + Global O1_SaveITList + Global O1_EmptyList + Global O1_ConfirmOverWriteList + Global O1_UnableToSaveList + Global O1_ConfirmQuit + Global O1_SelectMultiChannel + Global O1_ConfirmDelete + Global O1_ConfirmDelete2 + Global O1_ConfirmDelete3 + Global O1_ConfirmDeleteSample + Global O1_ConfirmDeleteInstrument + Global O1_ConfirmCutSample + Global O1_ConfirmConvertList + Global O1_ConfirmConvert2List + Global O1_ExchangeSampleList + Global O1_ExchangeInstrumentList + Global O1_ReplaceSampleList + Global O1_ReplaceInstrumentList + Global O1_LoadSampleList + Global O1_ConfirmSaveRenameList + Global O1_ConfirmResaveList + Global O1_ConfirmDiscardList + Global O1_InitialiseInstrumentList + Global O1_SwapSampleList + Global O1_SwapInstrumentList + Global O1_ResizeSampleList + Global O1_KeyboardList + Global O1_DisplayList + Global O1_FullDisplayList + Global O1_ViewSampleLibrary + Global O1_ConfigurePaletteList + Global O1_LoadInstrumentList + Global O1_ViewInstrumentLibrary + Global O1_ConfirmDeleteInstrument + Global O1_CopyInstrumentList + + Global O1_CrashRecovery + + Global O1_UndoList + + Global O1_InstrumentListGeneral + Global O1_InstrumentListVolume + Global O1_InstrumentListPanning + Global O1_InstrumentListPitch + Global O1_SetPatternLength + + Global O1_StereoSampleList + Global O1_PatternSizeMismatchList + + Global PatternLength + Global HelpKeyValue, OrderKeyValue + Global GlobalKeyList:Byte + Global LogoCharacter:Word + Global EMSErrorValue, EMSErrorValue2 + Global EMSErrorValue3, EMSErrorValue4 + Global EMSErrorValue5, EMSErrorValue6 + Global EMSErrorValue7, EMSErrorValue8 + +IF TIMERSCREEN + Public O1_TimerList +ENDIF + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +Segment Object1 BYTE Public 'Data' + +O1_AutoDetectList DW 6 + DW 0 + DW Near Ptr ESCContinueList + DW Near Ptr AboutBox + DW Near Ptr ImpulseLogo + DW Near Ptr AutoMiniBox + DW Near Ptr AboutText + DW Near Ptr AutoDetectText + DW Near Ptr CallAutoDetect + DW Near Ptr AutoContinueButton + DW 0 + +ESCContinueList DB 0 ; ESC + DW 101h + DD Glbl_F2 + + DB 0FFh + +O1_OrderPanningList DW 10 + DW Near Ptr IdleFunctionList + DW Near Ptr GlobalKeyList + DW Near Ptr FullScreenBox ; 0 + DW Near Ptr ScreenHeader ; 1 + DW Near Ptr FillHeader ; 2 + DW Near Ptr OrderandPanningMsg ; 3 + DW Near Ptr OrderBox ; 4 + DW Near Ptr PanBox1 ; 5 + DW Near Ptr PanBox2 ; 6 + DW Near Ptr ShowChannelMsgs ; 7 + DW Near Ptr PanText1 ; 8 + DW Near Ptr PanText2 ; 9 + DW Near Ptr OrderList ; 10 + DW Near Ptr Channel1 ; 11 + DW Near Ptr Channel2 ; 12 + DW Near Ptr Channel3 ; 13 + DW Near Ptr Channel4 ; 14 + DW Near Ptr Channel5 ; 15 + DW Near Ptr Channel6 ; 16 + DW Near Ptr Channel7 ; 17 + DW Near Ptr Channel8 ; 18 + DW Near Ptr Channel9 ; 19 + DW Near Ptr Channel10 ; 20 + DW Near Ptr Channel11 ; 21 + DW Near Ptr Channel12 ; 22 + DW Near Ptr Channel13 ; 23 + DW Near Ptr Channel14 ; 24 + DW Near Ptr Channel15 ; 25 + DW Near Ptr Channel16 ; 26 + DW Near Ptr Channel17 + DW Near Ptr Channel18 + DW Near Ptr Channel19 + DW Near Ptr Channel20 + DW Near Ptr Channel21 + DW Near Ptr Channel22 + DW Near Ptr Channel23 + DW Near Ptr Channel24 + DW Near Ptr Channel25 + DW Near Ptr Channel26 + DW Near Ptr Channel27 + DW Near Ptr Channel28 + DW Near Ptr Channel29 + DW Near Ptr Channel30 + DW Near Ptr Channel31 + DW Near Ptr Channel32 + DW Near Ptr Channel33 + DW Near Ptr Channel34 + DW Near Ptr Channel35 + DW Near Ptr Channel36 + DW Near Ptr Channel37 + DW Near Ptr Channel38 + DW Near Ptr Channel39 + DW Near Ptr Channel40 + DW Near Ptr Channel41 + DW Near Ptr Channel42 + DW Near Ptr Channel43 + DW Near Ptr Channel44 + DW Near Ptr Channel45 + DW Near Ptr Channel46 + DW Near Ptr Channel47 + DW Near Ptr Channel48 + DW Near Ptr Channel49 + DW Near Ptr Channel50 + DW Near Ptr Channel51 + DW Near Ptr Channel52 + DW Near Ptr Channel53 + DW Near Ptr Channel54 + DW Near Ptr Channel55 + DW Near Ptr Channel56 + DW Near Ptr Channel57 + DW Near Ptr Channel58 + DW Near Ptr Channel59 + DW Near Ptr Channel60 + DW Near Ptr Channel61 + DW Near Ptr Channel62 + DW Near Ptr Channel63 + DW Near Ptr Channel64 + DW Near Ptr SetHelpContext0 + DW 0 + +O1_HelpList DW 6 + DW Near Ptr IdleFunctionList + DW Near Ptr HelpKeyList + DW Near Ptr FullScreenBox ; 0 + DW Near Ptr ScreenHeader ; 1 + DW Near Ptr FillHeader ; 2 + DW Near Ptr HelpMsg ; 3 + DW Near Ptr HelpBox ; 4 + DW Near Ptr ShowHelp ; 5 + DW Near Ptr HelpDoneButton ; 6 + DW 0 + +O1_PatternEditList DW 3 + DW Near Ptr InfoPageIdleList + DW Near Ptr GlobalKeyList + DW Near Ptr FullScreenBox ; 0 + DW Near Ptr ScreenHeader ; 1 + DW Near Ptr PatternEditMsg ; 2 + DW Near Ptr PatternEdit ; 3 + DW Near Ptr FillHeader ; 4 + DW Near Ptr SetHelpContext1 ; 5 + DW 0 + +O1_PEConfigList DW 14 + DW Near Ptr IdleFunctionList + DW Near Ptr ESCF2&ReturnList + DW Near Ptr PEConfigBox ; 0 + DW Near Ptr PEConfigText ; 1 + DW Near Ptr PEConfigBsOctText ; 2 + DW Near Ptr PEConfigSkipValueText ; 3 + DW Near Ptr PEConfigRHLMinorText ; 4 + DW Near Ptr PEConfigRHLMajorText ;5 + DW Near Ptr PEConfigMaxRowsText ; 6 + DW Near Ptr PEConfigCommandCursor ; 7 + DW Near Ptr PECBox1 + DW Near Ptr PECBox2 + DW Near Ptr PECBox3 + DW Near Ptr PECBox4 + DW Near Ptr PECBox5 + DW Near Ptr PEConfigDoneButton ; 13 + DW Near Ptr PETBBaseOctave ; 14 + DW Near Ptr PETBSkipValue ; 15 + DW Near Ptr PETBRHLMinor ; 16 + DW Near Ptr PETBRHLMajor ; 17 + DW Near Ptr PETBMaxRow ; 18 + DW Near Ptr PECLinkButton ; 19 + DW Near Ptr PECSplitButton ; 20 + DW Near Ptr FillHeader + DW 0 + +O1_SetPatternLength DW 4 + DW Near Ptr IdleFunctionList + DW Near Ptr ESC&ReturnList + DW Near Ptr SetPatternLengthBox ; 0 + DW Near Ptr SetPatternLengthHeader + DW Near Ptr SetPatternLengthThumbBox1 + DW Near Ptr SetPatternLengthThumbBox2 + DW Near Ptr SetPatternLengthThumbBar ; 4 + DW Near Ptr SetPatternLengthStart ; 5 + DW Near Ptr SetPatternLengthEnd ; 6 + DW Near Ptr SetPatternLengthOKButton ; 7 + DW Near Ptr SetPatternLengthText + DW 0 + +SetPatternLengthBox DW 0 + DB 15, 19, 65, 33 + DB 3 + +SetPatternLengthHeader DW 1 + DB 31, 21 + DB 20h + DB "Set Pattern Length", 0 + +SetPatternLengthText DW 1 + DB 19, 24 + DB 20h + DB "Pattern Length", 13 + DB 13 + DB 13 + DB " Start Pattern", 13 + DB " End Pattern", 0 + +SetPatternLengthThumbBox1 DW 0 + DB 33, 23, 56, 25 + DB 25 + +SetPatternLengthThumbBox2 DW 0 + DB 33, 26, 60, 29 + DB 25 + +SetPatternLengthThumbBar DW 9 + DB 34, 24 + DW 32, 200 + DW 1, Offset PatternSetLength + DW 0FFFFh, 5, 0FFFFh, 0FFFFh + DW 0FFFFh, 0FFFFh + +SetPatternLengthStart DW 9 + DB 34, 27 + DW 0, 199 + DW 1, Offset PatternLengthStart + DW 4, 6, 0FFFFh, 0FFFFh + DW 0FFFFh, 0FFFFh + +SetPatternLengthEnd DW 9 + DB 34, 28 + DW 0, 199 + DW 1, Offset PatternLengthEnd + DW 5, 7, 0FFFFh, 0FFFFh + DW 0FFFFh, 0FFFFh + +SetPatternLengthOKButton DW 2 + DW 6, 0FFFFh, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 0 + DW 1 ; Returns 1 + DW 0, 0, 0, 0 + DB 35, 30, 44, 32 + DB 8 + DB 0 + DB " OK", 0 + +OKCancelList DB 8 ; 'O' + DW 'O' + DD DWord Ptr F_Return1 + + DB 8 ; 'C' + DW 'C' + DD DWord Ptr F_Return0 + + DB 8 ; 'Y' + DW 'Y' + DD DWord Ptr F_Return1 + + DB 8 ; 'N' + DW 'N' + DD DWord Ptr F_Return0 + +ESCReturnList DB 0 + DW 101h + DD DWord Ptr F_Return0 + + DB 5 + DW Near Ptr ChainMIDICommands + +O1_NoBlockMarkedList DW 2 + DW Near Ptr IdleFunctionList + DW Near Ptr ESCReturnList + DW Near Ptr NBMBox + DW Near Ptr NBMText + DW Near Ptr OKButton + DW Near Ptr FillHeader + DW 0 + +O1_OutOfSoundCardMemoryList DW 2 + DW 0 + DW Near Ptr ESCReturnList + DW Near Ptr NBMBox + DW Near Ptr OOSoundCardMemoryText + DW Near Ptr OKButton + DW Near Ptr FillHeader + DW 0 + +O1_OutOfMemoryList DW 2 + DW 0 + DW Near Ptr ESCReturnList + DW Near Ptr NBMBox + DW Near Ptr OOMText + DW Near Ptr OKButton + DW Near Ptr FillHeader + DW 0 + +O1_PatternSizeMismatchList DW 2 + DW 0 + DW Near Ptr ESCReturnList + DW Near Ptr NBMBox + DW Near Ptr PSMText + DW Near Ptr OKButton + DW Near Ptr FillHeader + DW 0 + +O1_LongMessageList DW 2 + DW 0 + DW Near Ptr ESCReturnList + DW Near Ptr NBMBox + DW Near Ptr LongMsgText + DW Near Ptr OKButton + DW Near Ptr FillHeader + DW 0 + +O1_OutOfSamplesList DW 2 + DW 0 + DW Near Ptr ESCReturnList + DW Near Ptr NBMBox + DW Near Ptr OOSText + DW Near Ptr OKButton + DW Near Ptr FillHeader + DW 0 + +O1_OverlapBlockList DW 2 + DW Near Ptr IdleFunctionList + DW Near Ptr ESCReturnList + DW Near Ptr NBMBox + DW Near Ptr OLBText + DW Near Ptr OKButton + DW Near Ptr FillHeader + DW 0 + +O1_SwapOutOfRangeList DW 2 + DW Near Ptr IdleFunctionList + DW Near Ptr ESCReturnList + DW Near Ptr NBMBox + DW Near Ptr SOORText + DW Near Ptr OKButton + DW Near Ptr FillHeader + DW 0 + +O1_NoBlockDataList DW 2 + DW Near Ptr IdleFunctionList + DW Near Ptr ESCReturnList + DW Near Ptr NBMBox + DW Near Ptr NBDText + DW Near Ptr OKButton + DW Near Ptr FillHeader + DW 0 + +O1_PatternTooLongList DW 2 + DW Near Ptr IdleFunctionList + DW Near Ptr ESCReturnList + DW Near Ptr NBMBox + DW Near Ptr PatternTooLongText + DW Near Ptr OKButton + DW Near Ptr FillHeader + DW 0 + +O1_GetAmpList DW 3 + DW Near Ptr IdleFunctionList + DW Near Ptr AmpExtraKeyList + DW Near Ptr AmpBox ; 0 + DW Near Ptr AmpText ; 1 + DW Near Ptr AmpTBBox ; 2 + DW Near Ptr AmpTB ; 3 + DW Near Ptr ConfirmOKButton ; 4 + DW Near Ptr ConfirmCancelButton ; 5 + DW Near Ptr FillHeader + DW 0 + +O1_GetInstrumentAmpList DW 3 + DW Near Ptr IdleFunctionList + DW Near Ptr AmpExtraKeyList + DW Near Ptr AmpBox ; 0 + DW Near Ptr AmpText ; 1 + DW Near Ptr AmpTBBox ; 2 + DW Near Ptr InstrumentAmpTB ; 3 + DW Near Ptr ConfirmOKButton ; 4 + DW Near Ptr ConfirmCancelButton ; 5 + DW Near Ptr FillHeader + DW 0 + +O1_GetFastAmpList DW 3 + DW Near Ptr IdleFunctionList + DW Near Ptr AmpExtraKeyList + DW Near Ptr AmpBox ; 0 + DW Near Ptr AmpText ; 1 + DW Near Ptr FastAmpTBBox ; 2 + DW Near Ptr FastAmpTB ; 3 + DW Near Ptr ConfirmOKButton ; 4 + DW Near Ptr ConfirmCancelButton ; 5 + DW Near Ptr FillHeader + DW 0 + +O1_SampleAmplificationList DW 3 + DW Near Ptr IdleFunctionList + DW Near Ptr ESC&ReturnList + DW Near Ptr SampleAmpBox + DW Near Ptr SampleAmpText ; 1 + DW Near Ptr SampleAmpTBBox ; 2 + DW Near Ptr SampleAmpTB ; 3 + DW Near Ptr ConfirmOKButton ; 4 + DW Near Ptr ConfirmCancelButton ; 5 + DW Near Ptr FillHeader + DW 0 + +IF SHOWPATTERNLENGTH + +O1_ShowPatternLengthList DW 2 + DW Near Ptr IdleFunctionList + DW Near Ptr ESCReturnList + DW Near Ptr NBMBox + DW Near Ptr PatternLengthText + DW Near Ptr OKButton + DW Near Ptr FillHeader + DW 0 + +ENDIF + +O1_C5FrequencyList DW 2 + DW Near Ptr IdleFunctionList + DW Near Ptr ESCReturnList + DW Near Ptr NBMBox + DW Near Ptr C5FrequencyText + DW Near Ptr OKButton + DW Near Ptr FillHeader + DW 0 + +O1_EMSWarningMessage DW 2 + DW 0 + DW Near Ptr ESCReturnList + DW Near Ptr EMSErrorBox + DW Near Ptr EMSErrorText + DW Near Ptr OKButton + DW Near Ptr FillHeader + DW 0 + +IF NETWORKENABLED +O1_NetworkErrorList DW 2 + DW Near Ptr IdleFunctionList + DW Near Ptr ESCReturnList + DW Near Ptr TemplateErrorBox + DW Near Ptr NetworkErrorText + DW Near Ptr TemplateOKButton + DW Near Ptr FillHeader + DW 0 +ENDIF + +O1_TemplateErrorList DW 2 + DW Near Ptr IdleFunctionList + DW Near Ptr ESCReturnList + DW Near Ptr TemplateErrorBox + DW Near Ptr TemplateErrorText + DW Near Ptr TemplateOKButton + DW Near Ptr FillHeader + DW 0 + +O1_CrashRecovery DW 2 + DW 0 + DW Near Ptr ESCReturnList + DW Near Ptr CrashRecoveryBox + DW Near Ptr CrashRecoveryText + DW Near Ptr CrashRecoveryOKButton + DW 0 + +O1_LoadSampleList DW 15 + DW Near Ptr SampleNameLoader + DW Near Ptr LoadSampleKeyList + DW Near Ptr FullScreenBox ; 0 + DW Near Ptr ScreenHeader ; 1 + DW Near Ptr LoadSampleHeader ; 2 + DW Near Ptr FillHeader ; 3 + DW Near Ptr LoadSampleBox + DW Near Ptr DriveSampleBox + DW Near Ptr LSInfoBox + DW Near Ptr LSInfoText + DW Near Ptr LSWaveFormBox + DW Near Ptr LSParametersBox + DW Near Ptr LSParametersText ; 10 + DW Near Ptr LSParametersVolBox ; 11 + DW Near Ptr LSParametersVibBox + DW Near Ptr LSFileInfoBox + DW Near Ptr LSFileInfoText + DW Near Ptr LoadSampleWindow ; 15 + DW Near Ptr LSDriveWindow ; 16 + DW Near Ptr LSFileNameInput ; 17 + DW Near Ptr LSSpeedInput + DW Near Ptr LSLoopToggle ; 19 + DW Near Ptr LSLoopBeginInput + DW Near Ptr LSLoopEndInput + DW Near Ptr LSSusLoopToggle ; 22 + DW Near Ptr LSSusLoopBeginInput + DW Near Ptr LSSusLoopEndInput + DW Near Ptr LSDefaultVolumeInput ; 25 + DW Near Ptr LSGlobalVolumeInput ; 26 + DW Near Ptr LSVibratoSpeedInput ; 27 + DW Near Ptr LSVibratoDepthInput ; 28 + DW Near Ptr LSVibratoRateInput ; 29 + DW Near Ptr SetHelpContext6 + DW 0 + +O1_ViewSampleLibrary DW 15 + DW Near Ptr SampleNameLoader + DW Near Ptr LoadSampleKeyList + DW Near Ptr FullScreenBox ; 0 + DW Near Ptr ScreenHeader ; 1 + DW Near Ptr ViewSampleHeader ; 2 + DW Near Ptr FillHeader ; 3 + DW Near Ptr LoadSampleBox + DW Near Ptr DriveSampleBox + DW Near Ptr LSInfoBox + DW Near Ptr LSInfoText + DW Near Ptr LSWaveFormBox + DW Near Ptr LSParametersBox + DW Near Ptr LSParametersText ; 10 + DW Near Ptr LSParametersVolBox ; 11 + DW Near Ptr LSParametersVibBox + DW Near Ptr LSFileInfoBox + DW Near Ptr LSFileInfoText + DW Near Ptr ViewSampleWindow ; 15 + DW Near Ptr LSDriveWindow ; 16 + DW Near Ptr LSFileNameInput ; 17 + DW Near Ptr LSSpeedInput + DW Near Ptr LSLoopToggle ; 19 + DW Near Ptr LSLoopBeginInput + DW Near Ptr LSLoopEndInput + DW Near Ptr LSSusLoopToggle ; 22 + DW Near Ptr LSSusLoopBeginInput + DW Near Ptr LSSusLoopEndInput + DW Near Ptr LSDefaultVolumeInput ; 25 + DW Near Ptr LSGlobalVolumeInput ; 26 + DW Near Ptr LSVibratoSpeedInput ; 27 + DW Near Ptr LSVibratoDepthInput ; 28 + DW Near Ptr LSVibratoRateInput ; 29 + DW Near Ptr SetHelpContext6 + DW 0 + + +LSFileNameInput DW 16 + DB 64, 13 + DW 3, 4 + DW 13 + DD 0 + DW 0FFFFh, 18, 25, 16 + +LSSpeedInput DW 18 + DB 64, 14 + DW 1, 3Ch + DD 0 + DW 17, 19, 25, 16 + +LSLoopToggle DW 17 + DB 64, 15 + DW 3, 12h + DB 16 + DW 18, 20, 25, 16 + +LSLoopBeginInput DW 18 + DB 64, 16 + DW 1, 34h + DD DWord Ptr D_LSCheckLoopValues + DW 19, 21, 25, 16 + +LSLoopEndInput DW 18 + DB 64, 17 + DW 1, 38h + DD DWord Ptr D_LSCheckLoopValues + DW 20, 22, 25, 16 + +LSSusLoopToggle DW 17 + DB 64, 18 + DW 3, 12h + DB 32 + DW 21, 23, 25, 16 + +LSSusLoopBeginInput DW 18 + DB 64, 19 + DW 1, 40h + DD DWord Ptr D_LSCheckSusLoopValues + DW 22, 24, 25, 16 + +LSSusLoopEndInput DW 18 + DB 64, 20 + DW 1, 44h + DD DWord Ptr D_LSCheckSusLoopValues + DW 23, 25, 25, 16 + +LSDefaultVolumeInput DW 9 + DB 63, 33 + DW 0, 64 + DW 5, 13h + DW 24, 26, 15, 17 + DW 0FFFFh, 0FFFFh ; PgUp/PgDn + +LSGlobalVolumeInput DW 9 + DB 63, 34 + DW 0, 64 + DW 5, 11h + DW 25, 27, 15, 17 + DW 0FFFFh, 0FFFFh ; PgUp/PgDn + +LSVibratoSpeedInput DW 9 + DB 63, 37 + DW 0, 64 + DW 5, 4Ch + DW 26, 28, 15, 17 + DW 0FFFFh, 0FFFFh ; PgUp/PgDn + +LSVibratoDepthInput DW 14 + DB 63, 38 + DW 0, 32 + DW 5, 4Dh + DW 27, 29, 15, 17 + DW 0FFFFh, 0FFFFh ; PgUp/PgDn + DW 8 + +LSVibratoRateInput DW 14 + DB 63, 39 + DW 0, 255 + DW 5, 4Eh + DW 28, 0FFFFh, 15, 17 + DW 0FFFFh, 0FFFFh ; PgUp/PgDn + DW 8 + +SampleNameLoader DD DWord Ptr D_LoadSampleNames +IdleFunctionList DD DWord Ptr IdleUpdateInfoLine + DD 0 + +IdleInstrumentList DD DWord Ptr IdleUpdateInfoLine + DD DWord Ptr I_IdleUpdateEnvelope + DD 0 + +LoadSampleHeader DW 10 + DB "Load Sample", 0 + +ViewSampleHeader DW 10 + DB "Sample Library (Ctrl-F3)", 0 + +LoadSampleBox DW 0 + DB 5, 12, 44, 48 + DB 27 + +DriveSampleBox DW 0 + DB 45, 12, 54, 23 + DB 27 + +LSInfoBox DW 0 + DB 63, 12, 77, 23 + DB 27 + +LSInfoText DW 1 + DB 55, 13 + DB 20h + DB "Filename", 13 + DB " Speed", 13 + DB " Loop", 13 + DB " LoopBeg", 13 + DB " LoopEnd", 13 + DB " SusLoop", 13 + DB " SusLBeg", 13 + DB " SusLEnd", 13 + DB " Quality", 13 + DB " Length" + DB 0 + +LSWaveFormBox DW 0 + DB 45, 24, 77, 29 + DB 27 + +LSParametersBox DW 0 + DB 45, 30, 77, 42 + DB 9 + +LSParametersText DW 1 + DB 48, 33 + DB 20h + DB "Default Volume", 13 + DB " Global Volume", 13 + DB 13 + DB 13 + DB " Vibrato Speed", 13 + DB " Vibrato Depth", 13 + DB " Vibrato Rate" + DB 0 + +LSParametersVolBox DW 0 + DB 62, 32, 72, 35 + DB 25 + +LSParametersVibBox DW 0 + DB 62, 36, 72, 40 + DB 25 + +LSFileInfoBox DW 0 + DB 52, 43, 77, 48 + DB 27 + +LSFileInfoText DW 1 + DB 46, 44 + DB 20h + DB "Format", 13 + DB " Size", 13 + DB " Date", 13 + DB " Time" + DB 0 + +LoadSampleWindow DW 15 + DD DWord Ptr D_DrawLoadSampleWindow + DD DWord Ptr D_PreLoadSampleWindow + DD DWord Ptr D_PostLoadSampleWindow + +ViewSampleWindow DW 15 + DD DWord Ptr D_DrawLoadSampleWindow + DD DWord Ptr D_PreLoadSampleWindow + DD DWord Ptr D_PostViewSampleLibrary + +LSDriveWindow DW 15 + DD DWord Ptr D_LSDrawDriveWindow + DD DWord Ptr D_LSPreDriveWindow + DD DWord Ptr D_LSPostDriveWindow + +O1_SampleList DW 28 + DW Near Ptr IdleFunctionList + DW Near Ptr SampleGlobalKeyList + DW Near Ptr FullScreenBox ; 0 + DW Near Ptr ScreenHeader ; 1 + DW Near Ptr SampleListHeader + DW Near Ptr SampleListBox + DW Near Ptr InstDVBox + DW Near Ptr InstDVText + DW Near Ptr InstDVTBBox + DW Near Ptr InstDVTB ; 7 + DW Near Ptr InstGVBox + DW Near Ptr InstGVText + DW Near Ptr InstGVTBBox + DW Near Ptr InstGVTB ; 11 + DW Near Ptr InstVSBox + DW Near Ptr InstVSText + DW Near Ptr InstVSTBBox + DW Near Ptr InstVSTB ; 15 + DW Near Ptr InstVDBox + DW Near Ptr InstVDText + DW Near Ptr InstVDTBBox + DW Near Ptr InstVDTB ; 19 + DW Near Ptr InstVRBox + DW Near Ptr InstVRText + DW Near Ptr InstVRTBBox + DW Near Ptr InstVRTB ; 23 + DW Near Ptr InstVWBox + DW Near Ptr InstVWText + DW Near Ptr InstParamBox + DW Near Ptr InstParamText + DW Near Ptr SampleList ; 28 + DW Near Ptr InstFileName ; 29 + DW Near Ptr InstSpeed + DW Near Ptr InstLoopToggle + DW Near Ptr InstLoopBegin + DW Near Ptr InstLoopEnd + DW Near Ptr InstSusLoopToggle + DW Near Ptr InstSusLoopBegin + DW Near Ptr InstSusLoopEnd ;36 + DW Near Ptr InstVibSine ; 37 + DW Near Ptr InstVibRamp ; 38 + DW Near Ptr InstVibSquare ; 39 + DW Near Ptr InstVibRandom ; 40 + DW Near Ptr InstWaveFormBox ; 41 + DW Near Ptr InstWaveFormText ; 42 + DW Near Ptr InstDPBox ; 43 + DW Near Ptr InstDPText + DW Near Ptr InstDPTBBox + DW Near Ptr InstDPToggle ; 46 + DW Near Ptr InstDPTB ; 47 + DW Near Ptr InstFillInfo + DW Near Ptr FillHeader + DW Near Ptr SetHelpContext2 + DW 0 + +O1_LoadModuleList DW 12 + DW Near Ptr SongNameModuleLoader + DW Near Ptr GlobalKeyList + DW Near Ptr FullScreenBox ; 0 + DW Near Ptr ScreenHeader + DW Near Ptr FillHeader + DW Near Ptr LoadModuleText + DW Near Ptr FileBox + DW Near Ptr DirBox ; 5 + DW Near Ptr DriveBox + DW Near Ptr SearchBox + DW Near Ptr FileInfoBox + DW Near Ptr FileNameBox + DW Near Ptr SearchText ; 10 + DW Near Ptr FileText + DW Near Ptr FileWindow ; 12 + DW Near Ptr DirectoryWindow + DW Near Ptr DriveWindow + DW Near Ptr FileNamePrompt ; 15 + DW Near Ptr SongDirectoryPrompt + DW Near Ptr SetHelpContext3 + DW 0 + +O1_SaveModuleList DW 15 + DW Near Ptr SongNameModuleLoader + DW Near Ptr GlobalKeyList + DW Near Ptr FullScreenBox ; 0 + DW Near Ptr ScreenHeader + DW Near Ptr FillHeader + DW Near Ptr SaveModuleText + DW Near Ptr FileBox + DW Near Ptr DirBox ; 5 + DW Near Ptr DriveBox + DW Near Ptr SearchBox + DW Near Ptr FileInfoBox + DW Near Ptr FileNameBox + DW Near Ptr SearchText ; 10 + DW Near Ptr FileText + DW Near Ptr FileSaveWindow ; 12 + DW Near Ptr DirectoryWindow + DW Near Ptr SaveDriveWindow + DW Near Ptr FileNameSavePrompt ; 15 + DW Near Ptr SongDirectoryPrompt + DW Near Ptr ITFormatButton ; 17 + DW Near Ptr S3MFormatButton ; 18 + DW Near Ptr OldITFormatButton ; 19 +IF DDCOMPRESS + DW Near Ptr IT215FormatButton ; 20 +ENDIF + DW 0 + +IF NETWORKENABLED +O1_LoadNetworkDriver DW 6 + DW Near Ptr IdleFunctionList + DW Near Ptr GlobalKeyList + DW Near Ptr FullScreenBox ; 0 + DW Near Ptr ScreenHeader + DW Near Ptr FillHeader + DW Near Ptr SaveModuleText + DW Near Ptr LoadNetworkText + DW Near Ptr LoadNetworkBox + DW Near Ptr LoadNetworkFunctions + DW 0 +ENDIF + +O1_SaveITList DW 7 + DW Near Ptr IdleFunctionGotoEmpty + DW Near Ptr GlobalKeyList + DW Near Ptr FullScreenBox ; 0 + DW Near Ptr ScreenHeader + DW Near Ptr FillHeader + DW Near Ptr SaveModuleText + DW Near Ptr LoadBox + DW Near Ptr SaveITModuleText + DW Near Ptr DirectScreen ; 6 + DW Near Ptr SaveIT ; 7 + DW 0 + +O1_SaveS3MList DW 7 + DW Near Ptr IdleFunctionGotoEmpty + DW Near Ptr GlobalKeyList + DW Near Ptr FullScreenBox ; 0 + DW Near Ptr ScreenHeader + DW Near Ptr FillHeader + DW Near Ptr SaveModuleText + DW Near Ptr LoadBox + DW Near Ptr SaveS3MModuleText + DW Near Ptr DirectScreen ; 6 + DW Near Ptr SaveS3M ; 7 + DW 0 + +IF TUTORIAL +ELSE + +O1_LoadS3MList DW 7 + DW Near Ptr IdleFunctionGotoEmpty + DW Near Ptr GlobalKeyList + DW Near Ptr FullScreenBox ; 0 + DW Near Ptr ScreenHeader + DW Near Ptr FillHeader + DW Near Ptr LoadModuleText + DW Near Ptr LoadBox + DW Near Ptr LoadS3MModuleText + DW Near Ptr DirectScreen ; 6 + DW Near Ptr LoadS3M ; 7 + DW 0 + +O1_LoadXMList DW 7 + DW Near Ptr IdleFunctionGotoEmpty + DW Near Ptr GlobalKeyList + DW Near Ptr FullScreenBox ; 0 + DW Near Ptr ScreenHeader + DW Near Ptr FillHeader + DW Near Ptr LoadModuleText + DW Near Ptr LoadBox + DW Near Ptr LoadXMModuleText + DW Near Ptr DirectScreen ; 6 + DW Near Ptr LoadXM ; 7 + DW 0 + +O1_LoadMTMList DW 7 + DW Near Ptr IdleFunctionGotoEmpty + DW Near Ptr GlobalKeyList + DW Near Ptr FullScreenBox ; 0 + DW Near Ptr ScreenHeader + DW Near Ptr FillHeader + DW Near Ptr LoadModuleText + DW Near Ptr LoadBox + DW Near Ptr LoadMTMModuleText + DW Near Ptr DirectScreen ; 6 + DW Near Ptr LoadMTM ; 7 + DW 0 + +O1_LoadMODList DW 7 + DW Near Ptr IdleFunctionGotoEmpty + DW Near Ptr GlobalKeyList + DW Near Ptr FullScreenBox ; 0 + DW Near Ptr ScreenHeader + DW Near Ptr FillHeader + DW Near Ptr LoadModuleText + DW Near Ptr LoadBox + DW Near Ptr LoadMODModuleText + DW Near Ptr DirectScreen ; 6 + DW Near Ptr LoadMOD ; 7 + DW 0 + +O1_Load669List DW 7 + DW Near Ptr IdleFunctionGotoEmpty + DW Near Ptr GlobalKeyList + DW Near Ptr FullScreenBox ; 0 + DW Near Ptr ScreenHeader + DW Near Ptr FillHeader + DW Near Ptr LoadModuleText + DW Near Ptr LoadBox + DW Near Ptr Load669ModuleText + DW Near Ptr DirectScreen ; 6 + DW Near Ptr Load669 ; 7 + DW 0 + +O1_LoadITList DW 7 + DW Near Ptr IdleFunctionGotoEmpty + DW Near Ptr GlobalKeyList + DW Near Ptr FullScreenBox ; 0 + DW Near Ptr ScreenHeader + DW Near Ptr FillHeader + DW Near Ptr LoadModuleText + DW Near Ptr LoadBox + DW Near Ptr LoadITModuleText + DW Near Ptr DirectScreen ; 6 + DW Near Ptr LoadIT ; 7 + DW 0 +ENDIF + +O1_EmptyList DW 0 + DW Near Ptr IdleFunctionList + DW Near Ptr GlobalKeyList + DW Near Ptr InDirectScreen ; 0 + DW Near Ptr FullScreenBox ; 1 + DW Near Ptr ScreenHeader + DW Near Ptr FillHeader + DW Near Ptr NoText + DW 0 + +ITFormatButton DW 2 + DW 0FFFFh, 18, 14, 15 + DW 0 + DW 0, 0 + DW 5 + DD DWord Ptr D_GetFormatType + DW 0 + DW 0, 0 + DB 69, 12, 77, 14 + DB 8 + DB 0 + DB " IT214", 0 + +S3MFormatButton DW 2 + DW 17, 19, 14, 15 + DW 0 + DW 0, 0 + DW 5 + DD DWord Ptr D_GetFormatType + DW 1 + DW 0, 0 + DB 69, 15, 77, 17 + DB 8 + DB 0 + DB " S3M", 0 + +IF DDCOMPRESS + +OldITFormatButton DW 2 + DW 18, 20, 14, 15 + DW 0 + DW 0, 0 + DW 5 + DD DWord Ptr D_GetFormatType + DW 2 + DW 0, 0 + DB 69, 18, 77, 20 + DB 8 + DB 0 + DB " IT2xx", 0 + +IT215FormatButton DW 2 + DW 19, 15, 14, 15 + DW 0 + DW 0, 0 + DW 5 + DD DWord Ptr D_GetFormatType + DW 3 + DW 0, 0 + DB 69, 21, 77, 23 + DB 8 + DB 0 + DB " IT215", 0 + + +ELSE + +OldITFormatButton DW 2 + DW 18, 15, 14, 15 + DW 0 + DW 0, 0 + DW 5 + DD DWord Ptr D_GetFormatType + DW 2 + DW 0, 0 + DB 69, 18, 77, 20 + DB 8 + DB 0 + DB " IT2xx", 0 +ENDIF + + +NoText DW 10 + DB 0 + +LoadBox DW 0 + DB 1, 12, 78, 48 + DB 27 + +SaveITModuleText DW 1 + DB 3, 14 + DB 2h + DB "Saving Impulse 2 Module", 13 + DB 0FFh, 23, 129, 0 + +SaveS3MModuleText DW 1 + DB 3, 14 + DB 2h + DB "Saving Scream Tracker 3 Module", 13 + DB 0FFh, 30, 129, 0 + +LoadS3MModuleText DW 1 + DB 3, 14 + DB 2h + DB "Scream Tracker III Module", 13 + DB 0FFh, 25, 129, 0 + +LoadXMModuleText DW 1 + DB 3, 14 + DB 2h + DB "Fast Tracker II Module", 13 + DB 0FFh, 22, 129, 0 + +LoadMTMModuleText DW 1 + DB 3, 14 + DB 2h + DB "MultiTracker Module", 13 + DB 0FFh, 19, 129, 0 + +LoadMODModuleText DW 1 + DB 3, 14 + DB 2h + DB "MOD Format Module", 13 + DB 0FFh, 17, 129, 0 + +Load669ModuleText DW 1 + DB 3, 14 + DB 2h + DB "Composer 669 Module", 13 + DB 0FFh, 19, 129, 0 + +LoadITModuleText DW 1 + DB 3, 14 + DB 2h + DB "Impulse Tracker Module", 13 + DB 0FFh, 22, 129, 0 + +IdleFunctionGotoEmpty DD DWord Ptr F_GotoEmptyList + DD 0 + +IF TUTORIAL +ELSE + +LoadMOD DW 15 + DD DWord Ptr F_Return0 + DD DWord Ptr D_LoadMOD + DD DWord Ptr F_GotoEmptyList + +Load669 DW 15 + DD DWord Ptr F_Return0 + DD DWord Ptr D_Load669 + DD DWord Ptr F_GotoEmptyList + +LoadS3M DW 15 + DD DWord Ptr F_Return0 + DD DWord Ptr D_LoadS3M + DD DWord Ptr F_GotoEmptyList + +LoadXM DW 15 + DD DWord Ptr F_Return0 + DD DWord Ptr D_LoadXM + DD DWord Ptr F_GotoEmptyList + +LoadMTM DW 15 + DD DWord Ptr F_Return0 + DD DWord Ptr D_LoadMTM + DD DWord Ptr F_GotoEmptyList + +LoadIT DW 15 + DD DWord Ptr F_Return0 + DD DWord Ptr D_LoadIT + DD DWord Ptr F_GotoEmptyList + +ENDIF + +SaveIT DW 15 + DD DWord Ptr F_Return0 + DD DWord Ptr D_SaveIT + DD DWord Ptr F_GotoEmptyList + +SaveS3M DW 15 + DD DWord Ptr F_Return0 + DD DWord Ptr D_SaveS3M + DD DWord Ptr F_GotoEmptyList + +FileNamePrompt DW 16 + DB 13, 46 + DW 0 ; Disk segment + DW Offset FileSpecifier + DW 64 ; Length + DD D_NewSpecifier + DW 12, 16, 16, 14 + +FileNameSavePrompt DW 16 + DB 13, 46 + DW 0 ; Disk segment + DW Offset FileSpecifier + DW 64 ; Length + DD D_SaveModule + DW 12, 16, 16, 14 + +SongDirectoryPrompt DW 16 + DB 13, 47 + DW 0 + DW Offset SongDirectory + DW 64 + DD D_NewDirectory + DW 15, 12, 12, 15 + +SongNameModuleLoader Label DWord + DD DWord Ptr D_LoadSongNames + DD DWord Ptr IdleUpdateInfoLine + DD 0 + +FileWindow DW 15 + DD DWord Ptr D_DrawFileWindow + DD DWord Ptr D_PreFileWindow + DD DWord Ptr D_PostFileLoadWindow + +FileSaveWindow DW 15 + DD DWord Ptr D_DrawFileWindow + DD DWord Ptr D_PreFileWindow + DD DWord Ptr D_PostFileSaveWindow + +DirectoryWindow DW 15 + DD DWord Ptr D_DrawDirectoryWindow + DD DWord Ptr D_PreDirectoryWindow + DD DWord Ptr D_PostDirectoryWindow + +DriveWindow DW 15 + DD DWord Ptr D_DrawDriveWindow + DD DWord Ptr D_PreDriveWindow + DD DWord Ptr D_PostDriveWindow + +SaveDriveWindow DW 15 + DD DWord Ptr D_DrawDriveWindow + DD DWord Ptr D_PreDriveWindow + DD DWord Ptr D_PostSaveDriveWindow + +IF NETWORKENABLED +LoadNetworkText DW 10 + DB "Load Network Driver", 0 + +LoadNetworkBox DW 0 + DB 1, 12, 78, 49 + DB 27 + +LoadNetworkFunctions DW 15 + DD DWord Ptr Network_DrawDriverScreen + DD DWord Ptr Network_PreDriverScreen + DD DWord Ptr Network_PostDriverScreen + +ENDIF + +LoadModuleText DW 10 + DB "Load Module (F9)", 0 + +SaveModuleText DW 10 + DB "Save Module (F10)", 0 + +FileBox DW 0 + DB 2, 12, 41, 44 + DB 27 + +DirBox DW 0 + DB 43, 12, 56, 34 + DB 27 + +DriveBox DW 0 + DB 58, 12, 67, 34 + DB 27 + +SearchBox DW 0 + DB 50, 36, 77, 38 + DB 27 + +FileInfoBox DW 0 + DB 50, 39, 77, 44 + DB 27 + +FileNameBox DW 0 + DB 12, 45, 77, 48 + DB 27 + +SearchText DW 1 + DB 44, 37 + DB 20h + DB "Search", 13 + DB 13 + DB 13 + DB "Format", 13 + DB " Size", 13 + DB " Date", 13 + DB " Time", 0 + +FileText DW 1 + DB 3, 46 + DB 20h + DB " Filename", 13 + DB "Directory", 0 + +SampleListHeader DW 10 + DB "Sample List (F3)", 0 + +InstFillInfo DW 8 + DD DWord Ptr I_ShowSampleInfo + +InstFileName DW 16 + DB 64, 13 + DW 1 + DW 4 + DW 13 + DD 0 + DW 0FFFFh, 30, 28, 7 + +InstSpeed DW 18 + DB 64, 14 + DW 0 + DW 3Ch + DD DWord Ptr I_PlaySample + DW 29, 31, 28, 7 + +InstLoopToggle DW 17 + DB 64, 15 + DW 0 + DW 12h + DB 16 + DW 30, 32, 28, 7 + +InstLoopBegin DW 18 + DB 64, 16 + DW 0 + DW 34h + DD DWord Ptr I_CheckLoopValues + DW 31, 33, 28, 7 + +InstLoopEnd DW 18 + DB 64, 17 + DW 0 + DW 38h + DD DWord Ptr I_CheckLoopValues + DW 32, 34, 28, 7 + +InstSusLoopToggle DW 17 + DB 64, 18 + DW 0 + DW 12h + DB 32 + DW 33, 35, 28, 7 + +InstSusLoopBegin DW 18 + DB 64, 19 + DW 0 + DW 40h + DD DWord Ptr I_CheckSusLoopValues + DW 34, 36, 28, 7 + +InstSusLoopEnd DW 18 + DB 64, 20 + DW 0 + DW 44h + DD DWord Ptr I_CheckSusLoopValues + DW 35, 37, 28, 7 + +SetHelpContext0 DW 11 + DW 0 + +SetHelpContext1 DW 11 + DW 1 + +SetHelpContext2 DW 11 + DW 2 + +SetHelpContext3 DW 11 + DW 3 + +SetHelpContext4 DW 11 + DW 4 + +SetHelpContext5 DW 11 + DW 5 + +SetHelpContext6 DW 11 + DW 6 + +SetHelpContext7 DW 11 + DW 7 + +SetHelpContext8 DW 11 + DW 8 + +SetHelpContext9 DW 11 + DW 9 + +SetHelpContext10 DW 11 + DW 10 + +SetHelpContext11 DW 11 + DW 11 + +SetHelpContext12 DW 11 + DW 12 + +SetHelpContext13 DW 11 + DW 13 + +SampleListBox DW 0 + DB 4, 12, 35, 48 + DB 27 + +InstDVBox DW 0 + DB 36, 12, 53, 18 + DB 9 + +InstDVTBBox DW 0 + DB 37, 15, 47, 17 + DB 9 + +InstDVTB DW 9 + DB 38, 16 + DW 0, 64 + DW 2, 13h + DW 0FFFFh, 11, 29, 28 + DW 0FFFFh, 0FFFFh ; PgUp/PgDn + +InstGVTBBox DW 0 + DB 37, 22, 47, 24 + DB 9 + +InstGVTB DW 9 + DB 38, 23 + DW 0, 64 + DW 2, 11h + DW 7, 46, 29, 28 + DW 0FFFFh, 0FFFFh ; PgUp/PgDn + +InstDPTBBox DW 0 + DB 37, 29, 47, 32 + DB 25 + +InstDPToggle DW 17 + DB 38, 30 + DW 0, 2Fh + DB 80h + DW 11, 47, 29, 28 + +InstDPTB DW 9 + DB 38, 31 + DW 0, 64 + DW 2, 2Fh + DW 46, 15, 29, 28 + DW 0FFFFh, 0FFFFh ; PgUp/PgDn + +InstVSTBBox DW 0 + DB 37, 38, 47, 40 + DB 9 + +InstVSTB DW 9 + DB 38, 39 + DW 0, 64 + DW 2, 4Ch + DW 47, 19, 37, 28 + DW 0FFFFh, 0FFFFh ; PgUp/PgDn + +InstVDTBBox DW 0 + DB 37, 45, 47, 47 + DB 9 + +InstVDTB DW 14 + DB 38, 46 + DW 0, 32 + DW 2, 4Dh + DW 15, 0FFFFh, 23, 28 + DW 0FFFFh, 0FFFFh ; PgUp/PgDn + DW 8 + +InstVRTBBox DW 0 + DB 55, 45, 72, 47 + DB 9 + +InstVRTB DW 14 + DB 56, 46 + DW 0, 255 + DW 2, 4Eh + DW 39, 0FFFFh, 28, 19 + DW 0FFFFh, 0FFFFh ; PgUp/PgDn + DW 15 + +InstGVBox DW 0 + DB 36, 19, 53, 25 + DB 9 + +InstDPBox DW 0 + DB 36, 26, 53, 33 + DB 9 + +InstVSBox DW 0 + DB 36, 35, 53, 41 + DB 9 + +InstVDBox DW 0 + DB 36, 42, 53, 48 + DB 9 + +InstVRBox DW 0 + DB 54, 42, 77, 48 + DB 9 + +InstParamBox DW 0 + DB 63, 12, 77, 24 + DB 27 + +InstVWBox DW 0 + DB 54, 31, 77, 41 + DB 9 + +InstDVText DW 1 + DB 38, 14 + DB 20h + DB "Default Volume", 0 + +InstGVText DW 1 + DB 38, 21 + DB 20h + DB "Global Volume", 0 + +InstDPText DW 1 + DB 39, 28 + DB 20h + DB "Default Pan", 0 + +InstVSText DW 1 + DB 38, 37 + DB 20h + DB "Vibrato Speed", 0 + +InstVDText DW 1 + DB 38, 44 + DB 20h + DB "Vibrato Depth", 0 + +InstVRText DW 1 + DB 60, 44 + DB 20h + DB "Vibrato Rate", 0 + +InstVWText DW 1 + DB 58, 33 + DB 20h + DB "Vibrato Waveform", 0 + +InstParamText DW 1 + DB 55, 13 + DB 20h + DB "Filename", 13 + DB " Speed", 13 + DB " Loop", 13 + DB " LoopBeg", 13 + DB " LoopEnd", 13 + DB " SusLoop", 13 + DB " SusLBeg", 13 + DB " SusLEnd", 13 + DB 0FFh, 8, ' ', 0FEh, 21h, 146, 0FEh, 3, 0FFh, 13, 154, 0FEh, 20h, 13 + DB " Quality", 13 + DB " Length" + DB 0 + +InstVibSine DW 2 + DW 36, 39, 15, 38 + DW 0 + DW 0, 0 + DW 5 + DD DWord Ptr I_SampleButtonHandler + DW 0, 4Fh, 0 + DB 56, 35, 65, 37 + DB 8 + DB 0 + DB " ", 185, 186, 0 + +InstVibRamp DW 2 + DW 36, 40, 37, 28 + DW 0 + DW 0, 0 + DW 5 + DD DWord Ptr I_SampleButtonHandler + DW 1, 4Fh, 0 + DB 66, 35, 75, 37 + DB 8 + DB 0 + DB " ", 189, 190, 0 + +InstVibSquare DW 2 + DW 37, 23, 15, 40 + DW 0 + DW 0, 0 + DW 5 + DD DWord Ptr I_SampleButtonHandler + DW 2, 4Fh, 0 + DB 56, 38, 65, 40 + DB 8 + DB 0 + DB " ", 187, 188, 0 + +InstVibRandom DW 2 + DW 38, 23, 39, 28 + DW 0 + DW 0, 0 + DW 5 + DD DWord Ptr I_SampleButtonHandler + DW 3, 4Fh, 0 + DB 66, 38, 75, 40 + DB 8 + DB 0 + DB " Random", 0 + +InstWaveFormBox DW 0 + DB 54, 25, 77, 30 + DB 9 + +InstWaveFormText DW 1 + DB 55, 26 + DB 0Dh + DB 1, 2, 3, 4, 5, 6, 7, 8, 9, 0FFh, 1, 10, 11 + DB 12, 0FFh, 1, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 13 + DB 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33 + DB 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 13 + DB 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55 + DB 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 13 + DB 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77 + DB 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88 + DB 0 + +SampleList DW 15 + DD DWord Ptr I_DrawSampleList + DD DWord Ptr I_PreSampleList + DD DWord Ptr I_PostSampleList + +EMSErrorText DW 1 + DB 27, 26 + DB 20h + DB "Crash warning: EMS error", 13 + DB " Debug: ", 0FDh, "Xh, ", 0FDh, "D, ", 0FDh, "D, ", 0FDh, "X", 13 + DB 0FFh, 8, " " + DB 0FDh, "X:" + DB 0FDh, "X:" + DB 0FDh, "X:" + DB 0FDh, "X", 0 +EMSErrorValue7 DW 0 +EMSErrorValue6 DW 0 +EMSErrorValue5 DW 0 +EMSErrorValue4 DW 0 +EMSErrorValue8 DW 0 +EMSErrorValue3 DW 0 +EMSErrorValue2 DW 0 +EMSErrorValue DW 0 + +EMSErrorBox DW 0 + DB 25, 24, 54, 32 + DB 3 + +TemplateErrorBox DW 0 + DB 20, 23, 59, 34 + DB 3 + +TemplateErrorText DW 1 + DB 24, 25 + DB 20h + DB 0FFh, 9, " Template Error", 13, 13 + DB "No note in the top left position", 13 + DB " of the clipboard on which to", 13 + DB 0FFh, 7, " base translations.", 0 + +IF NETWORKENABLED +NetworkErrorText DW 1 + DB 23, 25 + DB 20h + DB 0FFh, 10, " Network Error", 13, 13 + DB "This function is not available in", 13 + DB " multi-composer mode. Disconnect", 13 + DB " from network mode to enable.", 0 +ENDIF + +CrashRecoveryBox DW 0 + DB 20, 19, 60, 30 + DB 3 + +CrashRecoveryText DW 1 + DB 22, 21 + DB 20h + DB 0FFh, 12, " Crash Recovery", 13, 13 + DB " Please save your work under a", 13 + DB " different filename, reboot your", 13 + DB "computer and rerun Impulse Tracker as", 13 + DB " the system is likely to be unstable", 0 + +IF SHOWPATTERNLENGTH + +PatternLengthText DW 1 + DB 27, 27 + DB 20h + DB "Pattern is ", 0FDh, 'D', " bytes long", 0 +PatternLength DW 0 + +ENDIF + +C5FrequencyText DW 8 + DD DWord Ptr I_PrintC5Frequency + +AmpExtraKeyList Label + DB 1 + DW 2400h ; Alt-J + DD DWord Ptr F_Return1 + + DB 0 ; ESC + DW 101h + DD DWord Ptr F_Return0 + + DB 0 ; Enter + DW 11Ch + DD DWord Ptr F_Return1 + + DB 0FFh + +AmpBox DW 0 + DB 22, 25, 57, 35 + DB 3 + +SampleAmpBox DW 0 + DB 9, 25, 69, 35 + DB 3 + +AmpText DW 1 + DB 27, 27 + DB " Volume Amplification %", 0 + +SampleAmpText DW 1 + DB 27, 27 + DB " Sample Amplification %", 0 + +AmpTBBox DW 0 + DB 25, 29, 52, 31 + DB 25 + +FastAmpTBBox DW 0 + DB 32, 29, 44, 31 + DB 25 + +SampleAmpTBBox DW 0 + DB 12, 29, 64, 31 + DB 25 + +AmpTB DW 9 + DB 26, 30 + DW 0, 200 + DW 1, Offset Amplification + DW 4, 4, 4, 4 + DW 0FFFFh, 0FFFFh + +InstrumentAmpTB DW 9 + DB 26, 30 + DW 0, 200 + DW 8, Offset InstrumentAmplification + DW 4, 4, 4, 4 + DW 0FFFFh, 0FFFFh + +FastAmpTB DW 9 + DB 33, 30 + DW 10, 90 + DW 1, Offset FastVolumeAmplification + DW 4, 4, 4, 4 + DW 0FFFFh, 0FFFFh + +SampleAmpTB DW 9 + DB 13, 30 + DW 0, 400 + DW 8, Offset SampleAmplification + DW 4, 4, 4, 4 + DW 0FFFFh, 0FFFFh + + +ConfirmOKButton DW 2 + DW 3, 3, 5, 5 + DW 0 + DW 0, 0 + DW 0 + DW 1 ; Returns 1 + DW 0, 0, 0, 0 + DB 30, 32, 39, 34 + DB 8 + DB 0 + DB " OK", 0 + +ConfirmCancelButton DW 2 + DW 3, 3, 4, 4 + DW 0 + DW 0, 0 + DW 0 + DW 0 ; Returns 0 + DW 0, 0, 0, 0 + DB 40, 32, 49, 34 + DB 8 + DB 0 + DB " Cancel", 0 + +PatternTooLongText DW 1 + DB 28, 27 + DB 20h + DB "Pattern data exceeds 64k", 0 + +NBDText DW 1 + DB 30, 27 + DB 20h + DB "No data in clipboard", 0 + +OOSoundCardMemoryText DW 1 + DB 27, 27 + DB 20h + DB "Insufficient Soundcard RAM", 0 + +OOSText DW 1 + DB 31, 27 + DB 20h + DB "Too many samples!", 0 + + +OOMText DW 1 + DB 30, 27 + DB 20h + DB "Insufficient memory", 0 + +PSMText DW 1 + DB 27, 26 + DB 20h + DB " Crash Warning:", 13 + DB " Pattern Size Mismatch", 13 + DB "Fix: Remove corrupted data", 0 + +LongMsgText DW 1 + DB 29, 27 + DB 20h + DB "Song message too long!", 0 + +OLBText DW 1 + DB 30, 27 + DB 20h + DB "Swap blocks overlap", 0 + +SOORText DW 1 + DB 30, 27 + DB 20h + DB "Out of pattern range", 0 + +NBMBox DW 0 + DB 25, 25, 54, 32 + DB 3 + +NBMText DW 1 + DB 31, 27 + DB 20h + DB "No block is marked", 0 + +OKButton DW 2 + DW 0FFFFh, 0FFFFh, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 0 + DW 0 ; Returns 0 + DW 0, 0, 0, 0 + DB 35, 29, 44, 31 + DB 8 + DB 0 + DB " OK", 0 + + +CrashRecoveryOKButton DW 2 + DW 0FFFFh, 0FFFFh, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 0 + DW 0 ; Returns 0 + DW 0, 0, 0, 0 + DB 35, 27, 44, 29 + DB 8 + DB 0 + DB " OK", 0 + + +TemplateOKButton DW 2 + DW 0FFFFh, 0FFFFh, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 0 + DW 0 ; Returns 0 + DW 0, 0, 0, 0 + DB 35, 31, 44, 33 + DB 8 + DB 0 + DB " OK", 0 + + +PECLinkButton DW 2 + DW 18, 13, 20, 20 + DW 0 + DW 0, 0 + DW 5 + DD DWord Ptr PE_SetCommandCursor + DW 1 + DW 0 + DW 0 + DB 39, 37, 50, 39 + DB 8 + DB 0 + DB " Link", 0 + +PECSplitButton DW 2 + DW 18, 13, 19, 19 + DW 0 + DW 0, 0 + DW 5 + DD DWord Ptr PE_SetCommandCursor + DW 0 + DW 0 + DW 0 + DB 51, 37, 63, 39 + DB 8 + DB 0 + DB " Split", 0 + + +PECBox1 DW 0 + DB 39, 22, 42, 24 + DB 9 + +PECBox2 DW 0 + DB 39, 25, 43, 27 + DB 9 + +PECBox3 DW 0 + DB 39, 28, 45, 30 + DB 9 + +PECBox4 DW 0 + DB 39, 31, 57, 33 + DB 9 + +PECBox5 DW 0 + DB 39, 34, 62, 36 + DB 9 + +PEConfigBox DW 0 + DB 10, 18, 69, 43 + DB 3 + +PEConfigText DW 1 + DB 28, 19 + DB 20h + DB "Pattern Editor Options", 0 + +PEConfigBsOctText DW 1 + DB 28, 23 + DB 20h + DB "Base octave", 0 + +PEConfigSkipValueText DW 1 + DB 28, 26 + DB 20h + DB "Cursor step", 0 + +PEConfigRHLMinorText DW 1 + DB 22, 29 + DB 20h + DB "Row hilight minor", 0 + +PEConfigRHLMajorText DW 1 + DB 22, 32 + DB 20h + DB "Row hilight major", 0 + +PEConfigMaxRowsText DW 1 + DB 14, 35 + DB 20h + DB "Number of rows in pattern", 0 + +PEConfigCommandCursor DW 1 + DB 18, 38 + DB 20h + DB "Command/Value columns", 0 + +PEConfigDoneButton DW 2 + DW 19, 14, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 0 + DW 0 ; Returns 0 + DW 0, 0, 0, 0 + DB 34, 40, 45, 42 + DB 8 + DB 0 + DB " Done", 0 + +PETBBaseOctave DW 9 + DB 40, 23 + DW 0, 8 + DW 1, Offset BaseOctave + DW 13, 15, 15, 13 + DW 0FFFFh, 0FFFFh + +PETBSkipValue DW 9 + DB 40, 26 + DW 0, 16 + DW 1, Offset SkipValue + DW 14, 16, 16, 14 + DW 0FFFFh, 0FFFFh + +PETBRHLMinor DW 9 + DB 40, 29 + DW 0, 32 + DW 1, Offset RowHiLight1 + DW 15, 17, 17, 15 + DW 0FFFFh, 0FFFFh + +PETBRHLMajor DW 9 + DB 40, 32 + DW 0, 128 + DW 1, Offset RowHiLight2 + DW 16, 18, 18, 16 + DW 0FFFFh, 0FFFFh + +PETBMaxRow DW 9 + DB 40, 35 + DW 32, 200 + DW 1, Offset NumberOfRows + DW 17, 19, 19, 17 + DW 0FFFFh, 0FFFFh + +PatternEdit DW 15 + DD DWord Ptr PE_DrawPatternEdit + DD DWord Ptr PE_PrePatternEdit + DD DWord Ptr PE_PostPatternEdit + +PatternEditMsg DW 10 + DB "Pattern Editor (F2)", 0 + +HelpKeyList DB 0 + DW 1C8h + DD DWord Ptr H_HelpUp + + DB 0 + DW 1D0h + DD DWord Ptr H_HelpDown + + DB 0 + DW 1C9h + DD DWord Ptr H_HelpPgUp + + DB 0 + DW 1D1h + DD DWord Ptr H_HelpPgDn + + DB 0 + DW 101h + DD DWord Ptr H_HelpESC + + DB 5 + DW Offset GlobalKeyChain + +ShowHelp DW 8 + DD DWord Ptr H_DrawHelp + +HelpBox DW 0 + DB 1, 12, 78, 45 + DW 27 + +HelpMsg DW 10 + DB "Help", 0 + +HelpDoneButton DW 2 + DW 0FFFFh, 0FFFFh, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 4 + DD DWord Ptr H_HelpESC + DW 0, 0, 0 + DB 34, 46, 45, 48 + DB 8 + DB 0 + DB " Done", 0 + +SetHelpOrderPanning DW 11 + DW 0 + +OrderBox DW 0 + DB 5, 14, 9, 47 + DB 27 + +OrderList DW 12 + DB 2, 15 + DW 32 + DW 11, 43 + +ShowChannelMsgs DW 8 + DD DWord Ptr F_ShowChannels + +FillHeader DW 8 + DD DWord Ptr PE_FillHeader + +PanBox1 DW 0 + DB 30, 14, 40, 47 + DB 15 + +PanBox2 DW 0 + DB 64, 14, 74, 47 + DB 15 + +PanText1 DW 1 + DB 30, 14 + DB 23h + DB 146, 0FEh, 30h, "L M R", 0FEh, 23h, 145, 0 + +PanText2 DW 1 + DB 64, 14 + DB 23h + DB 146, 0FEh, 30h, "L M R", 0FEh, 23h, 145, 0 + +VolumeText1 DW 1 + DB 30, 14 + DB 23h + DB 146, 0FEh, 30h, " Volumes ", 0FEh, 23h, 145, 0 + +VolumeText2 DW 1 + DB 64, 14 + DB 23h + DB 146, 0FEh, 30h, " Volumes ", 0FEh, 23h, 145, 0 + + +Channel1 DW 9 ; Object 9 + DB 31, 15 ; x,y + DW 0, 64 ; Ranges + DW 0, 0 ; Pan/Channel 1 + DW 11, 12, 43, 10 ; Up/Down/Tab/Shift-Tab + DW 11, 19 ; PgUp/PgDn + +Channel2 DW 9 + DB 31, 16 + DW 0, 64 + DW 0, 1 ; Pan/Channel 2 + DW 11, 13, 44, 10 ; Up/Down/Tab/Shift-Tab + DW 11, 20 ; PgUp/PgDn + +Channel3 DW 9 ; Object 9 + DB 31, 17 ; x,y + DW 0, 64 ; Ranges + DW 0, 2 ; Pan/Channel 3 + DW 12, 14, 45, 10 ; Up/Down/Tab/Shift-Tab + DW 11, 21 ; PgUp/PgDn + +Channel4 DW 9 + DB 31, 18 + DW 0, 64 + DW 0, 3 ; Pan/Channel 4 + DW 13, 15, 46, 10 ; Up/Down/Tab/Shift-Tab + DW 11, 22 ; PgUp/PgDn + +Channel5 DW 9 ; Object 9 + DB 31, 19 ; x,y + DW 0, 64 ; Ranges + DW 0, 4 ; Pan/Channel 5 + DW 14, 16, 47, 10 ; Up/Down/Tab/Shift-Tab + DW 11, 23 ; PgUp/PgDn + +Channel6 DW 9 + DB 31, 20 + DW 0, 64 + DW 0, 5 ; Pan/Channel 6 + DW 15, 17, 48, 10 ; Up/Down/Tab/Shift-Tab + DW 11, 24 ; PgUp/PgDn + +Channel7 DW 9 ; Object 9 + DB 31, 21 ; x,y + DW 0, 64 ; Ranges + DW 0, 6 ; Pan/Channel 7 + DW 16, 18, 49, 10 ; Up/Down/Tab/Shift-Tab + DW 11, 25 ; PgUp/PgDn + +Channel8 DW 9 + DB 31, 22 + DW 0, 64 + DW 0, 7 ; Pan/Channel 8 + DW 17, 19, 50, 10 ; Up/Down/Tab/Shift-Tab + DW 11, 26 ; PgUp/PgDn + +Channel9 DW 9 ; Object 9 + DB 31, 23 ; x,y + DW 0, 64 ; Ranges + DW 0, 8 ; Pan/Channel 9 + DW 18, 20, 51, 10 ; Up/Down/Tab/Shift-Tab + DW 11, 27 ; PgUp/PgDn + +Channel10 DW 9 + DB 31, 24 + DW 0, 64 + DW 0, 9 ; Pan/Channel 10 + DW 19, 21, 52, 10 ; Up/Down/Tab/Shift-Tab + DW 12, 28 ; PgUp/PgDn + +Channel11 DW 9 ; Object 9 + DB 31, 25 ; x,y + DW 0, 64 ; Ranges + DW 0, 10 ; Pan/Channel 11 + DW 20, 22, 53, 10 ; Up/Down/Tab/Shift-Tab + DW 13, 29 ; PgUp/PgDn + +Channel12 DW 9 + DB 31, 26 + DW 0, 64 + DW 0, 11 ; Pan/Channel 12 + DW 21, 23, 54, 10 ; Up/Down/Tab/Shift-Tab + DW 14, 30 ; PgUp/PgDn + +Channel13 DW 9 ; Object 9 + DB 31, 27 ; x,y + DW 0, 64 ; Ranges + DW 0, 12 ; Pan/Channel 13 + DW 22, 24, 55, 10 ; Up/Down/Tab/Shift-Tab + DW 15, 31 ; PgUp/PgDn + +Channel14 DW 9 + DB 31, 28 + DW 0, 64 + DW 0, 13 ; Pan/Channel 14 + DW 23, 25, 56, 10 ; Up/Down/Tab/Shift-Tab + DW 16, 32 ; PgUp/PgDn + +Channel15 DW 9 ; Object 9 + DB 31, 29 ; x,y + DW 0, 64 ; Ranges + DW 0, 14 ; Pan/Channel 15 + DW 24, 26, 57, 10 ; Up/Down/Tab/Shift-Tab + DW 17, 33 ; PgUp/PgDn + +Channel16 DW 9 + DB 31, 30 + DW 0, 64 + DW 0, 15 ; Pan/Channel 16 + DW 25, 27, 58, 10 ; Up/Down/Tab/Shift-Tab + DW 18, 34 ; PgUp/PgDn + +Channel17 DW 9 ; Object 9 + DB 31, 31 ; x,y + DW 0, 64 ; Ranges + DW 0, 16 ; Pan/Channel 17 + DW 26, 28, 59, 10 ; Up/Down/Tab/Shift-Tab + DW 19, 35 ; PgUp/PgDn + +Channel18 DW 9 + DB 31, 32 + DW 0, 64 + DW 0, 17 ; Pan/Channel 18 + DW 27, 29, 60, 10 ; Up/Down/Tab/Shift-Tab + DW 20, 36 ; PgUp/PgDn + +Channel19 DW 9 ; Object 9 + DB 31, 33 ; x,y + DW 0, 64 ; Ranges + DW 0, 18 ; Pan/Channel 19 + DW 28, 30, 61, 10 ; Up/Down/Tab/Shift-Tab + DW 21, 37 ; PgUp/PgDn + +Channel20 DW 9 + DB 31, 34 + DW 0, 64 + DW 0, 19 ; Pan/Channel 20 + DW 29, 31, 62, 10 ; Up/Down/Tab/Shift-Tab + DW 22, 38 ; PgUp/PgDn + +Channel21 DW 9 ; Object 9 + DB 31, 35 ; x,y + DW 0, 64 ; Ranges + DW 0, 20 ; Pan/Channel 21 + DW 30, 32, 63, 10 ; Up/Down/Tab/Shift-Tab + DW 23, 39 ; PgUp/PgDn + +Channel22 DW 9 + DB 31, 36 + DW 0, 64 + DW 0, 21 ; Pan/Channel 22 + DW 31, 33, 64, 10 ; Up/Down/Tab/Shift-Tab + DW 24, 40 ; PgUp/PgDn + +Channel23 DW 9 ; Object 9 + DB 31, 37 ; x,y + DW 0, 64 ; Ranges + DW 0, 22 ; Pan/Channel 23 + DW 32, 34, 65, 10 ; Up/Down/Tab/Shift-Tab + DW 25, 41 ; PgUp/PgDn + +Channel24 DW 9 + DB 31, 38 + DW 0, 64 + DW 0, 23 ; Pan/Channel 24 + DW 33, 35, 66, 10 ; Up/Down/Tab/Shift-Tab + DW 26, 42 ; PgUp/PgDn + +Channel25 DW 9 ; Object 9 + DB 31, 39 ; x,y + DW 0, 64 ; Ranges + DW 0, 24 ; Pan/Channel 25 + DW 34, 36, 67, 10 ; Up/Down/Tab/Shift-Tab + DW 27, 43 ; PgUp/PgDn + +Channel26 DW 9 + DB 31, 40 + DW 0, 64 + DW 0, 25 ; Pan/Channel 26 + DW 35, 37, 68, 10 ; Up/Down/Tab/Shift-Tab + DW 28, 44 ; PgUp/PgDn + +Channel27 DW 9 ; Object 9 + DB 31, 41 ; x,y + DW 0, 64 ; Ranges + DW 0, 26 ; Pan/Channel 27 + DW 36, 38, 69, 10 ; Up/Down/Tab/Shift-Tab + DW 29, 45 ; PgUp/PgDn + +Channel28 DW 9 + DB 31, 42 + DW 0, 64 + DW 0, 27 ; Pan/Channel 28 + DW 37, 39, 70, 10 ; Up/Down/Tab/Shift-Tab + DW 30, 46 ; PgUp/PgDn + +Channel29 DW 9 ; Object 9 + DB 31, 43 ; x,y + DW 0, 64 ; Ranges + DW 0, 28 ; Pan/Channel 29 + DW 38, 40, 71, 10 ; Up/Down/Tab/Shift-Tab + DW 31, 47 ; PgUp/PgDn + +Channel30 DW 9 + DB 31, 44 + DW 0, 64 + DW 0, 29 ; Pan/Channel 30 + DW 39, 41, 72, 10 ; Up/Down/Tab/Shift-Tab + DW 32, 48 ; PgUp/PgDn + +Channel31 DW 9 ; Object 9 + DB 31, 45 ; x,y + DW 0, 64 ; Ranges + DW 0, 30 ; Pan/Channel 31 + DW 40, 42, 73, 10 ; Up/Down/Tab/Shift-Tab + DW 33, 49 ; PgUp/PgDn + +Channel32 DW 9 + DB 31, 46 + DW 0, 64 + DW 0, 31 ; Pan/Channel 32 + DW 41, 43, 74, 10 ; Up/Down/Tab/Shift-Tab + DW 34, 50 ; PgUp/PgDn + +Channel33 DW 9 ; Object 9 + DB 65, 15 ; x,y + DW 0, 64 ; Ranges + DW 0, 32 ; Pan/Channel 33 + DW 42, 44, 10, 11 ; Up/Down/Tab/Shift-Tab + DW 35, 51 ; PgUp/PgDn + +Channel34 DW 9 + DB 65, 16 + DW 0, 64 + DW 0, 33 ; Pan/Channel 34 + DW 43, 45, 10, 12 ; Up/Down/Tab/Shift-Tab + DW 36, 52 ; PgUp/PgDn + +Channel35 DW 9 ; Object 9 + DB 65, 17 ; x,y + DW 0, 64 ; Ranges + DW 0, 34 ; Pan/Channel 35 + DW 44, 46, 10, 13 ; Up/Down/Tab/Shift-Tab + DW 37, 53 ; PgUp/PgDn + +Channel36 DW 9 + DB 65, 18 + DW 0, 64 + DW 0, 35 ; Pan/Channel 36 + DW 45, 47, 10, 14 ; Up/Down/Tab/Shift-Tab + DW 38, 54 ; PgUp/PgDn + +Channel37 DW 9 ; Object 9 + DB 65, 19 ; x,y + DW 0, 64 ; Ranges + DW 0, 36 ; Pan/Channel 37 + DW 46, 48, 10, 15 ; Up/Down/Tab/Shift-Tab + DW 39, 55 ; PgUp/PgDn + +Channel38 DW 9 + DB 65, 20 + DW 0, 64 + DW 0, 37 ; Pan/Channel 38 + DW 47, 49, 10, 16 ; Up/Down/Tab/Shift-Tab + DW 40, 56 ; PgUp/PgDn + +Channel39 DW 9 ; Object 9 + DB 65, 21 ; x,y + DW 0, 64 ; Ranges + DW 0, 38 ; Pan/Channel 39 + DW 48, 50, 10, 17 ; Up/Down/Tab/Shift-Tab + DW 41, 57 ; PgUp/PgDn + +Channel40 DW 9 + DB 65, 22 + DW 0, 64 + DW 0, 39 ; Pan/Channel 40 + DW 49, 51, 10, 18 ; Up/Down/Tab/Shift-Tab + DW 42, 58 ; PgUp/PgDn + +Channel41 DW 9 ; Object 9 + DB 65, 23 ; x,y + DW 0, 64 ; Ranges + DW 0, 40 ; Pan/Channel 41 + DW 50, 52, 10, 19 ; Up/Down/Tab/Shift-Tab + DW 43, 59 ; PgUp/PgDn + +Channel42 DW 9 + DB 65, 24 + DW 0, 64 + DW 0, 41 ; Pan/Channel 42 + DW 51, 53, 10, 20 ; Up/Down/Tab/Shift-Tab + DW 44, 60 ; PgUp/PgDn + +Channel43 DW 9 ; Object 9 + DB 65, 25 ; x,y + DW 0, 64 ; Ranges + DW 0, 42 ; Pan/Channel 43 + DW 52, 54, 10, 21 ; Up/Down/Tab/Shift-Tab + DW 45, 61 ; PgUp/PgDn + +Channel44 DW 9 + DB 65, 26 + DW 0, 64 + DW 0, 43 ; Pan/Channel 44 + DW 53, 55, 10, 22 ; Up/Down/Tab/Shift-Tab + DW 46, 62 ; PgUp/PgDn + +Channel45 DW 9 ; Object 9 + DB 65, 27 ; x,y + DW 0, 64 ; Ranges + DW 0, 44 ; Pan/Channel 45 + DW 54, 56, 10, 23 ; Up/Down/Tab/Shift-Tab + DW 47, 63 ; PgUp/PgDn + +Channel46 DW 9 + DB 65, 28 + DW 0, 64 + DW 0, 45 ; Pan/Channel 46 + DW 55, 57, 10, 24 ; Up/Down/Tab/Shift-Tab + DW 48, 64 ; PgUp/PgDn + +Channel47 DW 9 ; Object 9 + DB 65, 29 ; x,y + DW 0, 64 ; Ranges + DW 0, 46 ; Pan/Channel 47 + DW 56, 58, 10, 25 ; Up/Down/Tab/Shift-Tab + DW 49, 65 ; PgUp/PgDn + +Channel48 DW 9 + DB 65, 30 + DW 0, 64 + DW 0, 47 ; Pan/Channel 48 + DW 57, 59, 10, 26 ; Up/Down/Tab/Shift-Tab + DW 50, 66 ; PgUp/PgDn + +Channel49 DW 9 ; Object 9 + DB 65, 31 ; x,y + DW 0, 64 ; Ranges + DW 0, 48 ; Pan/Channel 49 + DW 58, 60, 10, 27 ; Up/Down/Tab/Shift-Tab + DW 51, 67 ; PgUp/PgDn + +Channel50 DW 9 + DB 65, 32 + DW 0, 64 + DW 0, 49 ; Pan/Channel 50 + DW 59, 61, 10, 28 ; Up/Down/Tab/Shift-Tab + DW 52, 68 ; PgUp/PgDn + +Channel51 DW 9 ; Object 9 + DB 65, 33 ; x,y + DW 0, 64 ; Ranges + DW 0, 50 ; Pan/Channel 51 + DW 60, 62, 10, 29 ; Up/Down/Tab/Shift-Tab + DW 53, 69 ; PgUp/PgDn + +Channel52 DW 9 + DB 65, 34 + DW 0, 64 + DW 0, 51 ; Pan/Channel 52 + DW 61, 63, 10, 30 ; Up/Down/Tab/Shift-Tab + DW 54, 70 ; PgUp/PgDn + +Channel53 DW 9 ; Object 9 + DB 65, 35 ; x,y + DW 0, 64 ; Ranges + DW 0, 52 ; Pan/Channel 53 + DW 62, 64, 10, 31 ; Up/Down/Tab/Shift-Tab + DW 55, 71 ; PgUp/PgDn + +Channel54 DW 9 + DB 65, 36 + DW 0, 64 + DW 0, 53 ; Pan/Channel 54 + DW 63, 65, 10, 32 ; Up/Down/Tab/Shift-Tab + DW 56, 72 ; PgUp/PgDn + +Channel55 DW 9 ; Object 9 + DB 65, 37 ; x,y + DW 0, 64 ; Ranges + DW 0, 54 ; Pan/Channel 55 + DW 64, 66, 10, 33 ; Up/Down/Tab/Shift-Tab + DW 57, 73 ; PgUp/PgDn + +Channel56 DW 9 + DB 65, 38 + DW 0, 64 + DW 0, 55 ; Pan/Channel 56 + DW 65, 67, 10, 34 ; Up/Down/Tab/Shift-Tab + DW 58, 74 ; PgUp/PgDn + +Channel57 DW 9 ; Object 9 + DB 65, 39 ; x,y + DW 0, 64 ; Ranges + DW 0, 56 ; Pan/Channel 57 + DW 66, 68, 10, 35 ; Up/Down/Tab/Shift-Tab + DW 59, 74 ; PgUp/PgDn + +Channel58 DW 9 + DB 65, 40 + DW 0, 64 + DW 0, 57 ; Pan/Channel 58 + DW 67, 69, 10, 36 ; Up/Down/Tab/Shift-Tab + DW 60, 74 ; PgUp/PgDn + +Channel59 DW 9 ; Object 9 + DB 65, 41 ; x,y + DW 0, 64 ; Ranges + DW 0, 58 ; Pan/Channel 59 + DW 68, 70, 10, 37 ; Up/Down/Tab/Shift-Tab + DW 61, 74 ; PgUp/PgDn + +Channel60 DW 9 + DB 65, 42 + DW 0, 64 + DW 0, 59 ; Pan/Channel 60 + DW 69, 71, 10, 38 ; Up/Down/Tab/Shift-Tab + DW 62, 74 ; PgUp/PgDn + +Channel61 DW 9 ; Object 9 + DB 65, 43 ; x,y + DW 0, 64 ; Ranges + DW 0, 60 ; Pan/Channel 61 + DW 70, 72, 10, 39 ; Up/Down/Tab/Shift-Tab + DW 63, 74 ; PgUp/PgDn + +Channel62 DW 9 + DB 65, 44 + DW 0, 64 + DW 0, 61 ; Pan/Channel 62 + DW 71, 73, 10, 40 ; Up/Down/Tab/Shift-Tab + DW 64, 74 ; PgUp/PgDn + +Channel63 DW 9 ; Object 9 + DB 65, 45 ; x,y + DW 0, 64 ; Ranges + DW 0, 62 ; Pan/Channel 63 + DW 72, 74, 10, 41 ; Up/Down/Tab/Shift-Tab + DW 65, 74 ; PgUp/PgDn + +Channel64 DW 9 + DB 65, 46 + DW 0, 64 + DW 0, 63 ; Pan/Channel 64 + DW 73, 74, 10, 42 ; Up/Down/Tab/Shift-Tab + DW 66, 74 ; PgUp/PgDn + +OrderAndPanningMsg DW 10 + DB "Order List and Panning (F11)", 0 + +OrderAndVolumeMsg DW 10 + DB "Order List and Channel Volume (F11)", 0 + +FullScreenBox DW 0 + DB 0, 0, 79, 49 + DB 4 + +ScreenHeader DW 8 + DD DWord Ptr F_DrawHeader + +CallAutoDetect DW 8 + DD DWord Ptr Music_ShowAutoDetectSoundCard + +AutoMiniBox DW 0 + DB 25, 25, 55, 30 + DB 0 + +AutoDetectText DW 1 + DB 32, 26 + DB 20h + DB "Sound Card Setup", 0 + +LoadSampleKeyList DB 0 + DW 101h ; ESC + DD DWord Ptr Glbl_F3 + +ViewSampleKeyList Label + DB 0 + DW 1C9h ; PgUp + DD DWord Ptr LSWindow_Up + + DB 0 + DW 1D1h ; PgDn + DD DWord Ptr LSWindow_Down + + DB 1 ; Alt + DW 1F00h ; 'S' + DD DWord Ptr D_SlowSampleSort + + DB 5 ; Chain to... + DW Offset GlobalKeyList + + +LoadInstrumentKeyList DB 0 + DW 101h ; ESC + DD DWord Ptr Glbl_F4 + + DB 1 ; Alt + DW 1F00h ; 'S' + DD DWord Ptr D_SlowInstrumentSort + + DB 5 + DW Offset GlobalKeyList + +GlobalKeyList DB 0 ; F1 +HelpKeyValue DW 13Bh + DD DWord Ptr H_Help + +GlobalKeyChain: + DB 3 ; Ctrl... + DW 13Bh ; F1 + DD DWord Ptr Glbl_Ctrl_F1 + + DB 0 ; F2 + DW 13Ch + DD DWord Ptr Glbl_F2 + + DB 0 ; F3 + DW 13Dh + DD DWord Ptr Glbl_F3 + + DB 3 ; Ctrl... + DW 13Dh ; F3 + DD DWord Ptr Glbl_Ctrl_F3 + + DB 0 ; F4 + DW 13Eh + DD DWord Ptr Glbl_F4 + + DB 3 ; Ctrl... + DW 13Eh ; F4 + DD DWord Ptr Glbl_Ctrl_F4 + + DB 0 ; F5 + DW 13Fh + DD DWord Ptr Glbl_F5 + + DB 1 + DW 12h ; Ctrl 'R' + DD DWord Ptr Glbl_F9 + + DB 1 + DW 0Ch ; Ctrl 'L' + DD DWord Ptr Glbl_F9 + + DB 0 ; F9 + DW 142h + DD DWord Ptr Glbl_F8 + + DB 0 ; F9 + DW 143h + DD DWord Ptr Glbl_F9 + + DB 6 ; F9 + DW 143h + DD DWord Ptr Glbl_Shift_F9 + + DB 1 + DW 17h ; Ctrl 'W' + DD DWord Ptr Glbl_F10 + + DB 0 ; F10 + DW 144h + DD DWord Ptr Glbl_F10 + + DB 0 ; F11 +OrderKeyValue DW 157h + DD DWord Ptr Glbl_F11 + + DB 0 ; F12 + DW 158h + DD DWord Ptr Glbl_F12 + + DB 3 ; Ctrl.. + DW 158h ; F1 + DD DWord Ptr Glbl_Ctrl_F12 + + DB 0 ; ESC + DW 101h + DD DWord Ptr F_MainMenu + + DB 1 + DW 04h ; Ctrl 'D' + DD DWord Ptr DOSShell + + DB 1 + DW 05h ; Ctrl 'E' + DD DWord Ptr Refresh + + DB 1 + DW 13h ; Ctrl 'S' + DD DWord Ptr D_SaveSong + + DB 1 + DW 11h ; Ctrl 'Q' + DD DWord Ptr Quit + + DB 1 + DW 0Dh ; Ctrl 'M' + DD DWord Ptr MouseToggle + + DB 1 + DW 0Eh ; Ctrl 'N' + DD DWord Ptr F_NewSong + + DB 1 + DW 7h ; Ctrl 'G' + DD DWord Ptr Music_SoundCardLoadAllSamples + + DB 1 + DW 9 ; Ctrl 'I' + DD DWord Ptr Music_ReinitSoundCard + + DB 1 + DW 16 ; Ctrl 'P' + DD DWord Ptr Music_TimeSong + +IF MEMORYDEBUG + DB 0 + DW 15B7h ; Right shift+Ctrl+Printscreen + DD DWord Ptr Glbl_Debug +ENDIF + + DB 2 ; Alt.. + DW 13Bh ; F1 + DD DWord Ptr Glbl_Alt_F1 + + DB 2 ; Alt.. + DW 13Ch ; F2 + DD DWord Ptr Glbl_Alt_F2 + + DB 2 ; Alt.. + DW 13Dh ; F3 + DD DWord Ptr Glbl_Alt_F3 + + DB 2 ; Alt.. + DW 13Eh ; F4 + DD DWord Ptr Glbl_Alt_F4 + + DB 2 ; Alt.. + DW 13Fh ; F5 + DD DWord Ptr Glbl_Alt_F5 + + DB 2 ; Alt.. + DW 140h ; F6 + DD DWord Ptr Glbl_Alt_F6 + + DB 2 ; Alt.. + DW 141h ; F7 + DD DWord Ptr Glbl_Alt_F7 + + DB 2 ; Alt.. + DW 142h ; F8 + DD DWord Ptr Glbl_Alt_F8 + + DB 2 ; Alt.. + DW 157h ; F11 + DD DWord Ptr Music_ToggleOrderUpdate + +IF NETWORKENABLED + DB 6 ; Shift + DW 101h ; ESC + DD DWord Ptr Network_DriverScreen +ENDIF + + DB 6 ; Shift F1 + DW 13Bh + DD DWord Ptr Glbl_Shift_F1 + + DB 6 ; Shift F5 + DW 13Fh + DD DWord Ptr Glbl_DriverScreen + +IF TIMERSCREEN + DB 0 ; Left shift, left+right alt + DW 73C6h ; Right ctrl + Pause + DD DWord Ptr Glbl_TimerScreen +ENDIF + +IF EMSDEBUG + DB 0 ; Left shift, Left alt, right alt + DW 6329h ; + ~ + DD DWord Ptr E_DumpEMSMemory +ENDIF + +PlayCommandChain: + DB 3 ; Ctrl... + DW 13Fh ; F5 + DD DWord Ptr Glbl_Ctrl_F5 + + DB 0 ; F6 + DW 140h + DD DWord Ptr Glbl_F6 + + DB 6 ; F6 + DW 140h + DD DWord Ptr Glbl_Shift_F6 + + DB 0 + DW 141h ; F7 + DD DWord Ptr PE_F7 + + DB 3 ; Ctrl + DW 1CBh ; Left + DD DWord Ptr DisplayMinus + + DB 3 ; Ctrl + DW 1CDh ; Right + DD DWord Ptr DisplayPlus + + DB 0 + DW 1B5h + DD DWord Ptr PEFunction_DecreaseOctave + + DB 0 + DW 137h + DD DWord Ptr PEFunction_IncreaseOctave + + DB 6 + DW 1B5h + DD DWord Ptr PEFunction_DecreaseOctave + + DB 6 + DW 137h + DD DWord Ptr PEFunction_IncreaseOctave + + DB 1 + DW '{' + DD DWord Ptr Glbl_LeftBrace + + DB 1 + DW '}' + DD DWord Ptr Glbl_RightBrace + + DB 1 + DW '[' + DD DWord Ptr Glbl_LeftSquareBracket + + DB 1 + DW ']' + DD DWord Ptr Glbl_RightSquareBracket + +ChainMIDICommands: + DB 9 ; MIDI Message + DW 08000h + DD DWord Ptr MIDI_NoteOff + + DB 9 ; MIDI Message + DW 09000h + DD DWord Ptr MIDI_PlayNote + + DB 9 ; MIDI Message + DW 0C000h + DD DWord Ptr MIDI_SetInstrument + + DB 0FFh ; End of list + +ESCExitList DB 0 ; ESC + DW 101h + DD DWord Ptr F_Return0 + + DB 5 + DW Near Ptr ChainMIDICommands + +SampleGlobalKeyList Label +IF ENABLESOLO + DB 1 + DW '`' + DD DWord Ptr Music_ToggleSoloSample +ENDIF + + DB 0 + DW 1C9h + DD DWord Ptr I_SampleUp + + DB 0 + DW 1D1h + DD DWord Ptr I_SampleDown + + DB 1 + DW '<' + DD DWord Ptr I_DecreasePlayChannel + + DB 1 + DW '>' + DD DWord Ptr I_IncreasePlayChannel + + DB 1 + DW ',' + DD DWord Ptr I_DecreasePlayChannel + + DB 1 + DW '.' + DD DWord Ptr I_IncreasePlayChannel + + DB 1 + DW 1E00h ; Alt 'A' + DD DWord Ptr I_ConvertSample + + DB 1 + DW 3000h ; Alt 'B' + DD DWord Ptr I_CutSampleBeforeLoop + + DB 1 + DW 2000h ; Alt 'D' + DD DWord Ptr I_DeleteSample + + DB 1 + DW 1200h ; Alt 'E' + DD DWord Ptr I_ResizeSample + + DB 1 + DW 2100h ; Alt 'F' + DD DWord Ptr I_ResizeSampleNoInt + + DB 1 + DW 2200h ; Alt 'G' + DD DWord Ptr I_ReverseSample + + DB 1 + DW 2300h ; Alt 'H' + DD DWord Ptr I_CenterSample + + DB 1 + DW 1700h ; Alt 'I' + DD DWord Ptr I_InvertSample + + DB 1 ; Alt 'J' + DW 2400h + DD DWord Ptr I_ScaleSampleVolumes + + DB 1 + DW 2600h ; Alt 'L' + DD DWord Ptr I_CutSample + + DB 1 + DW 3200h ; Alt 'M' + DD DWord Ptr I_AmplifySample + + DB 1 + DW 3100h ; Alt 'N' + DD DWord Ptr I_ToggleMultiChannel + + DB 1 + DW 1800h ; Alt 'O' + DD DWord Ptr D_SaveSample + + DB 1 + DW 1000h ; Alt 'Q' + DD DWord Ptr I_ToggleSampleQuality + + DB 1 + DW 1300h ; Alt 'R' + DD DWord Ptr I_ReplaceSample + + DB 1 + DW 1F00h ; Alt 'S' + DD DWord Ptr I_SwapSamples + + DB 1 + DW 1400h ; Alt 'T' + DD DWord Ptr D_SaveST3Sample + + DB 1 + DW 1100h ; Alt 'W' + DD DWord Ptr D_SaveRawSample + + DB 1 + DW 2D00h ; Alt 'X' + DD DWord Ptr I_ExchangeSamples + + DB 1 ; Alt 'Y' + DW 1500h + DD DWord Ptr I_CalculateC5Speed + + + DB 2 ; Alt... + DW 14Eh ; Grey plus + DD DWord Ptr I_DoubleSampleSpeed + + DB 2 ; Alt... + DW 14Ah ; Grey minus + DD DWord Ptr I_HalveSampleSpeed + + DB 3 + DW 14Eh + DD DWord Ptr I_SampleSpeedSemiUp + + DB 3 + DW 14Ah + DD DWord Ptr I_SampleSpeedSemiDown + + DB 9 + DW 9000h + DD DWord Ptr MIDI_PlaySample + + DB 0 ; Enter... to load sample! + DW 11Ch + DD DWord Ptr Glbl_LoadSample + + DB 5 + DW Offset GlobalKeyList + +ScreenBox DW 0 ; Object type 0 + DB 0, 0, 79, 49 ; Coordinates + DB 7 ; Box style + +AboutBox DW 0 ; Object type 0 + DB 11, 16, 68, 34 ; Coordinates + DB 0 ; Box style + +AboutText DW 1 ; Object type 1 + DB 24, 19 + DB 02Bh + DB 0FFh, 1, 0, 4, 8, 0FFh, 8, 55, 37, 41, 0FFh, 5, 55, 56, 58, 62, 66, 0FFh, 6, 55, 88, 92, 13 + DB 1, 5, 9, 12, 15, 18, 22, 25, 28, 31, 34, 38, 42, 45, 48, 51, 55, 55, 57, 59, 63, 67, 70, 73, 76, 79, 82, 85, 89, 93, 96, 99, 102, 105, 13 + DB 2, 6, 0FFh, 1, 10, 0FFh, 1, 13, 16, 19, 23, 26, 29, 32, 35, 39, 43, 46, 49, 52, 54, 55, 55, 60, 64, 68, 71, 74, 77, 80, 83, 86, 90, 94, 97, 100, 103, 106, 13 + DB 3, 7, 11, 14, 17, 20, 24, 27, 30, 33, 36, 40, 44, 47, 50, 53, 55, 55, 55, 61, 65, 69, 72, 75, 78, 81, 84, 87, 91, 95, 98, 101, 104, 107, 13 + DB 0FFh, 5, 55, 21, 0 +; DB 0FEh, 20h +; DB " http://www.citenet.net/noise/it", 0 + +AutoContinueButton DW 2 ; Object type 2 + DW 0FFFFh, 0FFFFh, 0FFFFh, 0FFFFh + DW 0 ; Button usage type + DW 0, 0 ; ???? + DW 4 ; New List + DD DWord Ptr Glbl_F9 + DW 0, 0, 0 ; ???? + DB 32, 31, 47, 33 ; Left/Top/Right/Bottom + DB 8 ; Box initial style + DB 0 ; Button Up + DB " Continue", 0 + +UpdateScreen DW 8 + DD DWord Ptr S_UpdateScreen + +Exit DW 4 ; Object type 4 + DW 0 ; Return value + +DirectScreen DW 5 ; Object type 5 + DB 1 + +InDirectScreen DW 5 ; Object type 5 + DB 0 + +ImpulseLogo DW 6 ; Object type 6 +LogoCharacter DW 256 ; First char to define + DW 108 + DB 0, 0, 0, 0, 1, 7, 15, 31 ; 0 + DB 63, 127, 127, 254, 252, 255, 255, 126 ; 1 + DB 24, 0, 0, 0, 0, 0, 0, 0 ; 2 + DB 0, 1, 3, 3, 3, 1, 0, 0 ; 3 + DB 7, 31, 63, 255, 255, 254, 248, 240 ; 4 + DB 192, 128, 0, 1, 1, 131, 3, 7 ; 5 + DB 7, 15, 14, 30, 60, 60, 120, 240 ; 6 + DB 240, 224, 224, 224, 224, 192, 0, 0 ; 7 + DB 240, 240, 248, 248, 248, 120, 56, 120 ; 8 + DB 112, 240, 240, 224, 224, 192, 192, 131 ; 9 + DB 7, 15, 31, 31, 62, 60, 61, 63 ; 10 + DB 63, 63, 62, 28, 8, 0, 0, 0 ; 11 + DB 0, 0, 0, 0, 0, 0, 193, 227 ; 12 + DB 199, 223, 191, 127, 247, 239, 207, 159 ; 13 + DB 31, 31, 63, 60, 24, 0, 0, 0 ; 14 + DB 0, 0, 0, 0, 0, 240, 240, 240 ; 15 + DB 241, 227, 239, 223, 191, 251, 247, 231 ; 16 + DB 159, 159, 31, 31, 14, 0, 0, 0 ; 17 + DB 0, 0, 0, 0, 0, 48, 112, 248 ; 18 + DB 248, 240, 224, 192, 193, 131, 7, 30 ; 19 + DB 252, 240, 225, 131, 3, 7, 7, 15 ; 20 + DB 15, 30, 30, 28, 8, 0, 0, 0 ; 21 + DB 0, 0, 0, 1, 3, 3, 7, 15 ; 22 + DB 31, 63, 127, 255, 191, 190, 124, 126 ; 23 + DB 255, 255, 255, 255, 199, 128, 128, 0 ; 24 + DB 60, 124, 248, 240, 224, 192, 135, 159 ; 25 + DB 127, 255, 223, 143, 30, 60, 56, 113 ; 26 + DB 255, 255, 252, 240, 192, 0, 0, 0 ; 27 + DB 0, 0, 0, 0, 0, 0, 128, 129 ; 28 + DB 131, 135, 15, 15, 30, 60, 124, 253 ; 29 + DB 191, 31, 31, 14, 0, 0, 0, 0 ; 30 + DB 0, 0, 0, 0, 0, 112, 248, 240 ; 31 + DB 225, 195, 135, 15, 31, 63, 127, 255 ; 32 + DB 239, 223, 159, 15, 14, 0, 0, 0 ; 33 + DB 0, 0, 0, 0, 24, 56, 124, 248 ; 34 + DB 248, 241, 225, 193, 129, 131, 15, 31 ; 35 + DB 249, 241, 225, 192, 0, 0, 0, 0 ; 36 + DB 0, 0, 0, 0, 0, 0, 1, 3 ; 37 + DB 7, 15, 30, 61, 57, 123, 119, 254 ; 38 + DB 252, 248, 240, 224, 192, 192, 192, 225 ; 39 + DB 247, 255, 254, 252, 0, 0, 0, 0 ; 40 + DB 0, 0, 24, 56, 120, 248, 248, 240 ; 41 + DB 112, 96, 224, 192, 192, 128, 0, 1 ; 42 + DB 3, 7, 14, 28, 56, 112, 248, 252 ; 43 + DB 255, 127, 63, 31, 7, 0, 0, 0 ; 44 + DB 0, 0, 0, 48, 120, 120, 248, 248 ; 45 + DB 252, 124, 124, 120, 120, 112, 241, 231 ; 46 + DB 142, 252, 248, 224, 128, 0, 0, 0 ; 47 + DB 0, 0, 0, 0, 0, 0, 3, 7 ; 48 + DB 15, 30, 60, 63, 127, 254, 252, 60 ; 49 + DB 126, 63, 63, 31, 6, 0, 0, 0 ; 50 + DB 0, 0, 0, 0, 60, 254, 254, 222 ; 51 + DB 30, 60, 248, 224, 128, 1, 7, 14 ; 52 + DB 124, 248, 224, 192, 0, 0, 0, 0 ; 53 + DB 0, 0, 0, 0, 128, 128, 0, 0 ; 54 + DB 0, 0, 0, 0, 0, 0, 0, 0 ; 55 + DB 0, 0, 7, 31, 63, 127, 127, 255 ; 56 + DB 255, 252, 127, 0, 0, 0, 0, 0 ; 57 + DB 3, 255, 255, 255, 255, 255, 255, 252 ; 58 + DB 128, 0, 0, 0, 0, 0, 0, 0 ; 59 + DB 0, 0, 0, 1, 1, 3, 3, 7 ; 60 + DB 7, 15, 31, 31, 31, 30, 0, 0 ; 61 + DB 255, 255, 255, 255, 255, 255, 255, 0 ; 62 + DB 0, 1, 3, 7, 7, 15, 31, 62 ; 63 + DB 60, 124, 248, 248, 240, 240, 224, 224 ; 64 + DB 192, 192, 128, 128, 0, 0, 0, 0 ; 65 + DB 128, 224, 240, 240, 248, 248, 248, 112 ; 66 + DB 240, 224, 192, 192, 128, 6, 15, 31 ; 67 + DB 63, 127, 127, 112, 33, 97, 195, 131 ; 68 + DB 7, 7, 7, 3, 1, 0, 0, 0 ; 69 + DB 0, 0, 0, 0, 0, 0, 252, 254 ; 70 + DB 254, 252, 248, 240, 224, 193, 195, 199 ; 71 + DB 223, 253, 240, 224, 128, 0, 0, 0 ; 72 + DB 0, 0, 0, 0, 0, 0, 0, 3 ; 73 + DB 15, 31, 63, 124, 248, 240, 225, 195 ; 74 + DB 199, 254, 252, 120, 48, 0, 0, 0 ; 75 + DB 0, 0, 0, 0, 0, 31, 255, 255 ; 76 + DB 255, 255, 191, 63, 126, 252, 248, 184 ; 77 + DB 63, 127, 127, 126, 124, 48, 0, 0 ; 78 + DB 0, 0, 0, 0, 0, 0, 128, 128 ; 79 + DB 129, 3, 7, 15, 15, 31, 62, 126 ; 80 + DB 239, 207, 143, 7, 3, 0, 0, 0 ; 81 + DB 0, 0, 0, 0, 0, 15, 63, 255 ; 82 + DB 255, 255, 238, 204, 0, 0, 0, 3 ; 83 + DB 15, 255, 254, 248, 224, 0, 0, 0 ; 84 + DB 0, 0, 0, 0, 0, 193, 195, 131 ; 85 + DB 135, 15, 15, 31, 63, 127, 255, 255 ; 86 + DB 190, 60, 28, 24, 0, 0, 0, 0 ; 87 + DB 0, 0, 0, 0, 0, 1, 3, 7 ; 88 + DB 15, 31, 63, 126, 252, 248, 240, 227 ; 89 + DB 199, 223, 188, 112, 225, 199, 254, 252 ; 90 + DB 252, 126, 127, 63, 31, 0, 0, 0 ; 91 + DB 0, 12, 60, 124, 248, 248, 240, 224 ; 92 + DB 192, 128, 0, 0, 0, 48, 248, 248 ; 93 + DB 248, 120, 241, 225, 195, 3, 15, 31 ; 94 + DB 59, 243, 227, 129, 0, 0, 0, 0 ; 95 + DB 0, 0, 0, 0, 1, 15, 31, 62 ; 96 + DB 120, 241, 231, 239, 252, 240, 192, 192 ; 97 + DB 227, 255, 255, 252, 112, 0, 0, 0 ; 98 + DB 0, 0, 0, 0, 192, 240, 241, 243 ; 99 + DB 231, 207, 143, 14, 12, 28, 56, 112 ; 100 + DB 225, 193, 1, 0, 0, 0, 0, 0 ; 101 + DB 0, 0, 0, 0, 0, 192, 255, 255 ; 102 + DB 255, 255, 254, 60, 120, 112, 240, 241 ; 103 + DB 247, 255, 252, 248, 96, 0, 0, 0 ; 104 + DB 0, 0, 0, 0, 0, 0, 0, 128 ; 105 + DB 128, 0, 0, 0, 0, 0, 0, 192 ; 106 + DB 192, 0, 0, 0, 0, 0, 0, 0 ; 107 + +O1_ConfirmConvertList DW 4 + DW Near Ptr IdleFunctionList + DW Near Ptr OKCancelList + DW Near Ptr EmptyObject + DW Near Ptr ConfirmOverWriteBox + DW Near Ptr ConfirmConvertSampleText + DW Near Ptr ConfirmOverWriteOKButton + DW Near Ptr ConfirmOverWriteCancelButton + DW 0 + +O1_ConfirmConvert2List DW 4 + DW Near Ptr IdleFunctionList + DW Near Ptr OKCancelList + DW Near Ptr EmptyObject + DW Near Ptr ConfirmOverWriteBox + DW Near Ptr ConfirmConvertSampleText + DW Near Ptr ConfirmConvertYesButton + DW Near Ptr ConfirmConvertNoButton + DW 0 + +O1_SampleCenterList DW 4 + DW Near Ptr IdleFunctionList + DW Near Ptr OKCancelList + DW Near Ptr EmptyObject + DW Near Ptr ConfirmOverWriteBox + DW Near Ptr ConfirmCenterSampleText + DW Near Ptr ConfirmConvertYesButton + DW Near Ptr ConfirmConvertNoButton + DW 0 + +O1_EnableInstrumentMode DW 3 + DW Near Ptr IdleFunctionList + DW Near Ptr OKCancelList + DW Near Ptr EmptyObject + DW Near Ptr ConfirmOverWriteBox + DW Near Ptr EnableInstrumentModeText + DW Near Ptr ConfirmOverWriteOKButton + DW Near Ptr ConfirmOverWriteCancelButton + DW 0 + + +O1_InitInstrument DW 3 + DW Near Ptr IdleFunctionList + DW Near Ptr OKCancelList + DW Near Ptr EmptyObject + DW Near Ptr ConfirmOverWriteBox + DW Near Ptr InitInstrumentText + DW Near Ptr ConfirmOverWriteOKButton + DW Near Ptr ConfirmInitialiseNoButton + DW 0 + +O1_ConfirmOverWriteList DW 4 + DW Near Ptr IdleFunctionList + DW Near Ptr OKCancelList + DW Near Ptr EmptyObject + DW Near Ptr ConfirmOverWriteBox + DW Near Ptr ConfirmOverWriteText + DW Near Ptr ConfirmOverWriteOKButton + DW Near Ptr ConfirmOverWriteCancelButton + DW 0 + +O1_InitialiseInstrumentList DW 3 + DW Near Ptr IdleFunctionList + DW Near Ptr OKCancelList + DW Near Ptr EmptyObject + DW Near Ptr ConfirmOverWriteBox + DW Near Ptr ConfirmInitialiseText + DW Near Ptr ConfirmOverWriteOKButton + DW Near Ptr ConfirmInitialiseNoButton + DW 0 + +O1_ConfirmDelete DW 4 + DW Near Ptr SongNameModuleLoader + DW Near Ptr OKCancelList + DW Near Ptr DrawFileNameWindow + DW Near Ptr ConfirmOverWriteBox + DW Near Ptr ConfirmDeleteText + DW Near Ptr ConfirmOverWriteOKButton + DW Near Ptr ConfirmOverWriteCancelButton + DW 0 + +O1_ConfirmDelete2 DW 4 + DW Near Ptr SampleNameLoader + DW Near Ptr OKCancelList + DW Near Ptr DrawLoadSampleWindow + DW Near Ptr ConfirmOverWriteBox + DW Near Ptr ConfirmDeleteText + DW Near Ptr ConfirmOverWriteOKButton + DW Near Ptr ConfirmOverWriteCancelButton + DW 0 + +O1_ConfirmDelete3 DW 4 + DW Near Ptr InstrumentNameLoader + DW Near Ptr OKCancelList + DW Near Ptr EmptyObject + DW Near Ptr ConfirmOverWriteBox + DW Near Ptr ConfirmDeleteText + DW Near Ptr ConfirmOverWriteOKButton + DW Near Ptr ConfirmOverWriteCancelButton + DW 0 + + +O1_ConfirmSaveRenameList DW 3 + DW Near Ptr SampleNameLoader + DW Near Ptr OKCancelList + DW Near Ptr DrawLoadSampleWindow + DW Near Ptr ConfirmOverWriteBox + DW Near Ptr ConfirmSaveRenameText + DW Near Ptr ConfirmOverWriteOKButton + DW Near Ptr ConfirmOverWriteCancelButton + DW 0 + +O1_ConfirmResaveList DW 3 + DW Near Ptr SampleNameLoader + DW Near Ptr OKCancelList + DW Near Ptr DrawLoadSampleWindow + DW Near Ptr ConfirmOverWriteBox + DW Near Ptr ConfirmResaveText + DW Near Ptr ConfirmOverWriteOKButton + DW Near Ptr ConfirmOverWriteCancelButton + DW 0 + +O1_ConfirmDiscardList DW 3 + DW Near Ptr SampleNameLoader + DW Near Ptr OKCancelList + DW Near Ptr DrawLoadSampleWindow + DW Near Ptr ConfirmOverWriteBox + DW Near Ptr ConfirmDiscardText + DW Near Ptr ConfirmOverWriteOKButton + DW Near Ptr ConfirmOverWriteCancelButton + DW 0 + +O1_ConfirmCutSample DW 4 + DW Near Ptr IdleFunctionList + DW Near Ptr OKCancelList + DW Near Ptr EmptyObject + DW Near Ptr ConfirmOverWriteBox + DW Near Ptr ConfirmCutSampleText + DW Near Ptr ConfirmOverWriteOKButton + DW Near Ptr ConfirmOverWriteCancelButton + DW 0 + +O1_ConfirmDeleteSample DW 4 + DW Near Ptr IdleFunctionList + DW Near Ptr OKCancelList + DW Near Ptr EmptyObject + DW Near Ptr ConfirmOverWriteBox + DW Near Ptr ConfirmDeleteSampleText + DW Near Ptr ConfirmOverWriteOKButton + DW Near Ptr ConfirmOverWriteCancelButton + DW 0 + +O1_ConfirmDeleteInstrument DW 4 + DW Near Ptr IdleFunctionList + DW Near Ptr OKCancelList + DW Near Ptr EmptyObject + DW Near Ptr ConfirmOverWriteBox + DW Near Ptr ConfirmDeleteInstrumentText + DW Near Ptr ConfirmOverWriteOKButton + DW Near Ptr ConfirmOverWriteCancelButton + DW 0 + +O1_ConfirmClearMessage DW 4 + DW Near Ptr IdleFunctionList + DW Near Ptr OKCancelList + DW Near Ptr EmptyObject + DW Near Ptr ConfirmOverWriteBox + DW Near Ptr ConfirmClearMessageText + DW Near Ptr ConfirmOverWriteOKButton + DW Near Ptr ConfirmOverWriteCancelButton + DW 0 + +O1_ConfirmNoSave DW 4 + DW Near Ptr IdleFunctionList + DW Near Ptr OKCancelList + DW Near Ptr EmptyObject + DW Near Ptr ConfirmNoSaveBox + DW Near Ptr ConfirmNoSaveMessage + DW Near Ptr ConfirmOverWriteOKButton + DW Near Ptr ConfirmOverWriteCancelButton + DW 0 + +EmptyObject DW 8 + DD DWord Ptr F_Nothing + +DrawFileNameWindow DW 8 + DD DWord Ptr D_DrawFileWindow + +DrawLoadSampleWindow DW 8 + DD DWord Ptr D_DrawLoadSampleWindow + +DrawLoadInstrumentWindow DW 8 + DD DWord Ptr D_DrawLoadInstrument + +ConfirmOverWriteBox DW 0 ; Box Object + DB 26, 25, 54, 32 + DB 3 + +ConfirmNosaveBox DW 0 ; Box Object + DB 20, 25, 60, 32 + DB 3 + +EnableInstrumentModeText DW 1 + DB 29, 27 + DB 20h + DB "Enable Instrument mode?", 0 + +ConfirmCenterSampleText DW 1 + DB 31, 27 + DB 20h + DB "Centralise sample?", 0 + +ConfirmOverWriteText DW 1 + DB 33, 27 + DB 20h + DB "Overwrite file?", 0 + +ConfirmDeleteText DW 1 + DB 35, 27 + DB 20h + DB "Delete file?", 0 + +ConfirmDeleteSampleText DW 1 + DB 34, 27 + DB 20h + DB "Delete sample?", 0 + +ConfirmDeleteInstrumentText DW 1 + DB 32, 27 + DB 20h + DB "Delete instrument?", 0 + +ConfirmClearMessageText DW 1 + DB 31, 27 + DB 20h + DB "Clear song message?", 0 + +ConfirmNoSaveMessage DW 1 + DB 23, 27 + DB 20h + DB "Current module not saved. Proceed?", 0 + +ConfirmSaveRenameText DW 1 + DB 31, 27 + DB 20h + DB "Save/Rename sample?", 0 + +ConfirmDiscardText DW 1 + DB 33, 27 + DB 20h + DB "Discard changes?", 0 + +ConfirmResaveText DW 1 + DB 35, 27 + DB 20h + DB "Save sample?", 0 + +InitInstrumentText DW 1 + DB 29, 27 + DB 20h + DB "Create host instrument?", 0 + +ConfirmConvertSampleText DW 1 + DB 33, 27 + DB 20h + DB "Convert sample?", 0 + +ConfirmInitialiseText DW 1 + DB 29, 27 + DB 20h + DB "Initialise instruments?", 0 + +ConfirmCutSampleText DW 1 + DB 35, 27 + DB 20h + DB "Cut sample?", 0 + +ConfirmQuitText DW 1 + DB 30, 27 + DB 20h + DB "Exit Impulse Tracker?", 0 + +ConfirmOverWriteOKButton DW 2 + DW 0FFFFh, 0FFFFh, 4, 4 + DW 0 + DW 0, 0 + DW 0 + DW 1 ; Return OK to overwrite + DW 0, 0, 0, 0 + DB 30, 29, 39, 31 + DB 8 + DB 0 + DB " OK", 0 + +ConfirmOverWriteCancelButton DW 2 + DW 0FFFFh, 0FFFFh, 3, 3 + DW 0 + DW 0, 0 + DW 0 + DW 0 ; Returns 0 + DW 0, 0, 0, 0 + DB 41, 29, 50, 31 + DB 8 + DB 0 + DB " Cancel", 0 + +ConfirmConvertYesButton DW 2 + DW 0FFFFh, 0FFFFh, 4, 4 + DW 0 + DW 0, 0 + DW 0 + DW 1 ; Return 1 + DW 0, 0, 0, 0 + DB 29, 29, 39, 31 + DB 8 + DB 0 + DB " Yes", 0 + +ConfirmConvertNoButton DW 2 + DW 0FFFFh, 0FFFFh, 3, 3 + DW 0 + DW 0, 0 + DW 0 + DW 2 ; Returns 2 + DW 0, 0, 0, 0 + DB 41, 29, 50, 31 + DB 8 + DB 0 + DB " No", 0 + +ConfirmInitialiseNoButton DW 2 + DW 0FFFFh, 0FFFFh, 3, 3 + DW 0 + DW 0, 0 + DW 0 + DW 0 ; Returns 0 + DW 0, 0, 0, 0 + DB 41, 29, 50, 31 + DB 8 + DB 0 + DB " No", 0 + +O1_UnableToSaveList DW 2 + DW 0 + DW Near Ptr ESCReturnList + DW Near Ptr ConfirmOverWriteBox + DW Near Ptr UnableToSaveText + DW Near Ptr NoSaveOKButton + DW 0 + +UnableToSaveText DW 1 + DB 31, 27 + DB 20h + DB "Unable to save file", 0 + +NoSaveOKButton DW 2 + DW 0FFFFh, 0FFFFh, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 0 + DW 1 + DW 0, 0, 0, 0 + DB 36, 29, 45, 31 + DB 8 + DB 0 + DB " OK", 0 + +O1_ConfirmQuit DW 3 + DW Near Ptr IdleFunctionList + DW Near Ptr OKCancelList + DW Near Ptr EmptyObject + DW Near Ptr ConfirmOverWriteBox + DW Near Ptr ConfirmQuitText + DW Near Ptr ConfirmOverWriteOKButton + DW Near Ptr ConfirmOverWriteCancelButton + DW 0 + +O1_SelectMultiChannel DW 7 + DW Near Ptr IdleFunctionList + DW Near Ptr ESCReturnList + DW Near Ptr SMCBox ; 0 + DW Near Ptr SMCText ; 1 + DW Near Ptr SMCInBox1 ; 2 + DW Near Ptr SMCInBox2 ; 3 + DW Near Ptr SMCInBox3 ; 4 + DW Near Ptr SMCInBox4 ; 5 + DW Near Ptr SMCDrawChannel ; 6 + DW Near Ptr SMCChannel00Toggle ; 7 + DW Near Ptr SMCChannel01Toggle + DW Near Ptr SMCChannel02Toggle + DW Near Ptr SMCChannel03Toggle + DW Near Ptr SMCChannel04Toggle + DW Near Ptr SMCChannel05Toggle + DW Near Ptr SMCChannel06Toggle + DW Near Ptr SMCChannel07Toggle + DW Near Ptr SMCChannel08Toggle + DW Near Ptr SMCChannel09Toggle + DW Near Ptr SMCChannel10Toggle + DW Near Ptr SMCChannel11Toggle + DW Near Ptr SMCChannel12Toggle + DW Near Ptr SMCChannel13Toggle + DW Near Ptr SMCChannel14Toggle + DW Near Ptr SMCChannel15Toggle + DW Near Ptr SMCChannel16Toggle + DW Near Ptr SMCChannel17Toggle + DW Near Ptr SMCChannel18Toggle + DW Near Ptr SMCChannel19Toggle + DW Near Ptr SMCChannel20Toggle + DW Near Ptr SMCChannel21Toggle + DW Near Ptr SMCChannel22Toggle + DW Near Ptr SMCChannel23Toggle + DW Near Ptr SMCChannel24Toggle + DW Near Ptr SMCChannel25Toggle + DW Near Ptr SMCChannel26Toggle + DW Near Ptr SMCChannel27Toggle + DW Near Ptr SMCChannel28Toggle + DW Near Ptr SMCChannel29Toggle + DW Near Ptr SMCChannel30Toggle + DW Near Ptr SMCChannel31Toggle + DW Near Ptr SMCChannel32Toggle + DW Near Ptr SMCChannel33Toggle + DW Near Ptr SMCChannel34Toggle + DW Near Ptr SMCChannel35Toggle + DW Near Ptr SMCChannel36Toggle + DW Near Ptr SMCChannel37Toggle + DW Near Ptr SMCChannel38Toggle + DW Near Ptr SMCChannel39Toggle + DW Near Ptr SMCChannel40Toggle + DW Near Ptr SMCChannel41Toggle + DW Near Ptr SMCChannel42Toggle + DW Near Ptr SMCChannel43Toggle + DW Near Ptr SMCChannel44Toggle + DW Near Ptr SMCChannel45Toggle + DW Near Ptr SMCChannel46Toggle + DW Near Ptr SMCChannel47Toggle + DW Near Ptr SMCChannel48Toggle + DW Near Ptr SMCChannel49Toggle + DW Near Ptr SMCChannel50Toggle + DW Near Ptr SMCChannel51Toggle + DW Near Ptr SMCChannel52Toggle + DW Near Ptr SMCChannel53Toggle + DW Near Ptr SMCChannel54Toggle + DW Near Ptr SMCChannel55Toggle + DW Near Ptr SMCChannel56Toggle + DW Near Ptr SMCChannel57Toggle + DW Near Ptr SMCChannel58Toggle + DW Near Ptr SMCChannel59Toggle + DW Near Ptr SMCChannel60Toggle + DW Near Ptr SMCChannel61Toggle + DW Near Ptr SMCChannel62Toggle + DW Near Ptr SMCChannel63Toggle ; 70 + DW Near Ptr SMCOKButton ; 71 + DW 0 + +SMCBox DW 0 + DB 7, 18, 72, 42 + DB 3 + +SMCInBox1 DW 0 + DB 19, 21, 23, 38 + DB 27 + +SMCInBox2 DW 0 + DB 35, 21, 39, 38 + DB 27 + +SMCInBox3 DW 0 + DB 51, 21, 55, 38 + DB 27 + +SMCInBox4 DW 0 + DB 67, 21, 71, 38 + DB 27 + +SMCText DW 1 + DB 29, 19 + DB 23h + DB "Multichannel Selection", 0 + +SMCDrawChannel DW 8 + DD DWord Ptr F_DrawSMCChannels + +SMCChannel00Toggle DW 17 + DB 20, 22 + DW 1 + DW Offset MultiChannelInfo+00 + DB 1 + DW 71, 8, 23, 55 + +SMCChannel01Toggle DW 17 + DB 20, 23 + DW 1 + DW Offset MultiChannelInfo+01 + DB 1 + DW 7, 9, 24, 56 + +SMCChannel02Toggle DW 17 + DB 20, 24 + DW 1 + DW Offset MultiChannelInfo+02 + DB 1 + DW 8, 10, 25, 57 + +SMCChannel03Toggle DW 17 + DB 20, 25 + DW 1 + DW Offset MultiChannelInfo+03 + DB 1 + DW 9, 11, 26, 58 + +SMCChannel04Toggle DW 17 + DB 20, 26 + DW 1 + DW Offset MultiChannelInfo+04 + DB 1 + DW 10, 12, 27, 59 + +SMCChannel05Toggle DW 17 + DB 20, 27 + DW 1 + DW Offset MultiChannelInfo+05 + DB 1 + DW 11, 13, 28, 60 + +SMCChannel06Toggle DW 17 + DB 20, 28 + DW 1 + DW Offset MultiChannelInfo+06 + DB 1 + DW 12, 14, 29, 61 + +SMCChannel07Toggle DW 17 + DB 20, 29 + DW 1 + DW Offset MultiChannelInfo+07 + DB 1 + DW 13, 15, 30, 62 + +SMCChannel08Toggle DW 17 + DB 20, 30 + DW 1 + DW Offset MultiChannelInfo+08 + DB 1 + DW 14, 16, 31, 63 + +SMCChannel09Toggle DW 17 + DB 20, 31 + DW 1 + DW Offset MultiChannelInfo+09 + DB 1 + DW 15, 17, 32, 64 + +SMCChannel10Toggle DW 17 + DB 20, 32 + DW 1 + DW Offset MultiChannelInfo+10 + DB 1 + DW 16, 18, 33, 65 + +SMCChannel11Toggle DW 17 + DB 20, 33 + DW 1 + DW Offset MultiChannelInfo+11 + DB 1 + DW 17, 19, 34, 66 + +SMCChannel12Toggle DW 17 + DB 20, 34 + DW 1 + DW Offset MultiChannelInfo+12 + DB 1 + DW 18, 20, 35, 67 + +SMCChannel13Toggle DW 17 + DB 20, 35 + DW 1 + DW Offset MultiChannelInfo+13 + DB 1 + DW 19, 21, 36, 68 + +SMCChannel14Toggle DW 17 + DB 20, 36 + DW 1 + DW Offset MultiChannelInfo+14 + DB 1 + DW 20, 22, 37, 69 + +SMCChannel15Toggle DW 17 + DB 20, 37 + DW 1 + DW Offset MultiChannelInfo+15 + DB 1 + DW 21, 71, 38, 70 + +SMCChannel16Toggle DW 17 + DB 36, 22 + DW 1 + DW Offset MultiChannelInfo+16 + DB 1 + DW 71, 24, 39, 7 + +SMCChannel17Toggle DW 17 + DB 36, 23 + DW 1 + DW Offset MultiChannelInfo+17 + DB 1 + DW 23, 25, 40, 8 + +SMCChannel18Toggle DW 17 + DB 36, 24 + DW 1 + DW Offset MultiChannelInfo+18 + DB 1 + DW 24, 26, 41, 9 + +SMCChannel19Toggle DW 17 + DB 36, 25 + DW 1 + DW Offset MultiChannelInfo+19 + DB 1 + DW 25, 27, 42, 10 + +SMCChannel20Toggle DW 17 + DB 36, 26 + DW 1 + DW Offset MultiChannelInfo+20 + DB 1 + DW 26, 28, 43, 11 + +SMCChannel21Toggle DW 17 + DB 36, 27 + DW 1 + DW Offset MultiChannelInfo+21 + DB 1 + DW 27, 29, 44, 12 + +SMCChannel22Toggle DW 17 + DB 36, 28 + DW 1 + DW Offset MultiChannelInfo+22 + DB 1 + DW 28, 30, 45, 13 + +SMCChannel23Toggle DW 17 + DB 36, 29 + DW 1 + DW Offset MultiChannelInfo+23 + DB 1 + DW 29, 31, 46, 14 + +SMCChannel24Toggle DW 17 + DB 36, 30 + DW 1 + DW Offset MultiChannelInfo+24 + DB 1 + DW 30, 32, 47, 15 + +SMCChannel25Toggle DW 17 + DB 36, 31 + DW 1 + DW Offset MultiChannelInfo+25 + DB 1 + DW 31, 33, 48, 16 + +SMCChannel26Toggle DW 17 + DB 36, 32 + DW 1 + DW Offset MultiChannelInfo+26 + DB 1 + DW 32, 34, 49, 17 + +SMCChannel27Toggle DW 17 + DB 36, 33 + DW 1 + DW Offset MultiChannelInfo+27 + DB 1 + DW 33, 35, 50, 18 + +SMCChannel28Toggle DW 17 + DB 36, 34 + DW 1 + DW Offset MultiChannelInfo+28 + DB 1 + DW 34, 36, 51, 19 + +SMCChannel29Toggle DW 17 + DB 36, 35 + DW 1 + DW Offset MultiChannelInfo+29 + DB 1 + DW 35, 37, 52, 20 + +SMCChannel30Toggle DW 17 + DB 36, 36 + DW 1 + DW Offset MultiChannelInfo+30 + DB 1 + DW 36, 38, 53, 21 + +SMCChannel31Toggle DW 17 + DB 36, 37 + DW 1 + DW Offset MultiChannelInfo+31 + DB 1 + DW 37, 71, 54, 22 + +SMCChannel32Toggle DW 17 + DB 52, 22 + DW 1 + DW Offset MultiChannelInfo+32 + DB 1 + DW 71, 40, 55, 23 + +SMCChannel33Toggle DW 17 + DB 52, 23 + DW 1 + DW Offset MultiChannelInfo+33 + DB 1 + DW 39, 41, 56, 24 + +SMCChannel34Toggle DW 17 + DB 52, 24 + DW 1 + DW Offset MultiChannelInfo+34 + DB 1 + DW 40, 42, 57, 25 + +SMCChannel35Toggle DW 17 + DB 52, 25 + DW 1 + DW Offset MultiChannelInfo+35 + DB 1 + DW 41, 43, 58, 26 + +SMCChannel36Toggle DW 17 + DB 52, 26 + DW 1 + DW Offset MultiChannelInfo+36 + DB 1 + DW 42, 44, 59, 27 + +SMCChannel37Toggle DW 17 + DB 52, 27 + DW 1 + DW Offset MultiChannelInfo+37 + DB 1 + DW 43, 45, 60, 28 + +SMCChannel38Toggle DW 17 + DB 52, 28 + DW 1 + DW Offset MultiChannelInfo+38 + DB 1 + DW 44, 46, 61, 29 + +SMCChannel39Toggle DW 17 + DB 52, 29 + DW 1 + DW Offset MultiChannelInfo+39 + DB 1 + DW 45, 47, 62, 30 + +SMCChannel40Toggle DW 17 + DB 52, 30 + DW 1 + DW Offset MultiChannelInfo+40 + DB 1 + DW 46, 48, 63, 31 + +SMCChannel41Toggle DW 17 + DB 52, 31 + DW 1 + DW Offset MultiChannelInfo+41 + DB 1 + DW 47, 49, 64, 32 + +SMCChannel42Toggle DW 17 + DB 52, 32 + DW 1 + DW Offset MultiChannelInfo+42 + DB 1 + DW 48, 50, 65, 33 + +SMCChannel43Toggle DW 17 + DB 52, 33 + DW 1 + DW Offset MultiChannelInfo+43 + DB 1 + DW 49, 51, 66, 34 + +SMCChannel44Toggle DW 17 + DB 52, 34 + DW 1 + DW Offset MultiChannelInfo+44 + DB 1 + DW 50, 52, 67, 35 + +SMCChannel45Toggle DW 17 + DB 52, 35 + DW 1 + DW Offset MultiChannelInfo+45 + DB 1 + DW 51, 53, 68, 36 + +SMCChannel46Toggle DW 17 + DB 52, 36 + DW 1 + DW Offset MultiChannelInfo+46 + DB 1 + DW 52, 54, 69, 37 + +SMCChannel47Toggle DW 17 + DB 52, 37 + DW 1 + DW Offset MultiChannelInfo+47 + DB 1 + DW 53, 71, 70, 38 + +SMCChannel48Toggle DW 17 + DB 68, 22 + DW 1 + DW Offset MultiChannelInfo+48 + DB 1 + DW 71, 56, 7, 39 + +SMCChannel49Toggle DW 17 + DB 68, 23 + DW 1 + DW Offset MultiChannelInfo+49 + DB 1 + DW 55, 57, 8, 40 + +SMCChannel50Toggle DW 17 + DB 68, 24 + DW 1 + DW Offset MultiChannelInfo+50 + DB 1 + DW 56, 58, 9, 41 + +SMCChannel51Toggle DW 17 + DB 68, 25 + DW 1 + DW Offset MultiChannelInfo+51 + DB 1 + DW 57, 59, 10, 42 + +SMCChannel52Toggle DW 17 + DB 68, 26 + DW 1 + DW Offset MultiChannelInfo+52 + DB 1 + DW 58, 60, 11, 43 + +SMCChannel53Toggle DW 17 + DB 68, 27 + DW 1 + DW Offset MultiChannelInfo+53 + DB 1 + DW 59, 61, 12, 44 + +SMCChannel54Toggle DW 17 + DB 68, 28 + DW 1 + DW Offset MultiChannelInfo+54 + DB 1 + DW 60, 62, 13, 45 + +SMCChannel55Toggle DW 17 + DB 68, 29 + DW 1 + DW Offset MultiChannelInfo+55 + DB 1 + DW 61, 63, 14, 46 + +SMCChannel56Toggle DW 17 + DB 68, 30 + DW 1 + DW Offset MultiChannelInfo+56 + DB 1 + DW 62, 64, 15, 47 + +SMCChannel57Toggle DW 17 + DB 68, 31 + DW 1 + DW Offset MultiChannelInfo+57 + DB 1 + DW 63, 65, 16, 48 + +SMCChannel58Toggle DW 17 + DB 68, 32 + DW 1 + DW Offset MultiChannelInfo+58 + DB 1 + DW 64, 66, 17, 49 + +SMCChannel59Toggle DW 17 + DB 68, 33 + DW 1 + DW Offset MultiChannelInfo+59 + DB 1 + DW 65, 67, 18, 50 + +SMCChannel60Toggle DW 17 + DB 68, 34 + DW 1 + DW Offset MultiChannelInfo+60 + DB 1 + DW 66, 68, 19, 51 + +SMCChannel61Toggle DW 17 + DB 68, 35 + DW 1 + DW Offset MultiChannelInfo+61 + DB 1 + DW 67, 69, 20, 52 + +SMCChannel62Toggle DW 17 + DB 68, 36 + DW 1 + DW Offset MultiChannelInfo+62 + DB 1 + DW 68, 70, 21, 53 + +SMCChannel63Toggle DW 17 + DB 68, 37 + DW 1 + DW Offset MultiChannelInfo+63 + DB 1 + DW 69, 71, 22, 54 + +SMCOKButton DW 2 + DW 22, 7, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 0 + DW 0 + DW 0, 0, 0, 0 + DB 35, 39, 44, 41 + DB 8 + DB 0 + DB " OK ", 0 + +O1_ExchangeSampleList DW 3 + DW Near Ptr IdleFunctionList + DW Near Ptr OKCancelList + DW Near Ptr ExchangeSampleBox + DW Near Ptr ExchangeSampleText + DW Near Ptr ExchangeSampleInputBox + DW Near Ptr ExchangeSampleInput ; 3 + DW Near Ptr CancelExchangeButton ; 4 + DW 0 + +O1_ReplaceSampleList DW 3 + DW Near Ptr IdleFunctionList + DW Near Ptr OKCancelList + DW Near Ptr ExchangeSampleBox + DW Near Ptr ReplaceSampleText + DW Near Ptr ExchangeSampleInputBox + DW Near Ptr ExchangeSampleInput ; 3 + DW Near Ptr CancelExchangeButton ; 4 + DW 0 + +O1_ReplaceInstrumentList DW 3 + DW Near Ptr IdleFunctionList + DW Near Ptr OKCancelList + DW Near Ptr ExchangeSampleBox + DW Near Ptr ReplaceInstrumentText + DW Near Ptr ExchangeSampleInputBox + DW Near Ptr ExchangeSampleInput ; 3 + DW Near Ptr CancelExchangeButton ; 4 + DW 0 + +O1_SwapSampleList DW 3 + DW Near Ptr IdleFunctionList + DW Near Ptr OKCancelList + DW Near Ptr ExchangeSampleBox + DW Near Ptr SwapSampleText + DW Near Ptr ExchangeSampleInputBox + DW Near Ptr ExchangeSampleInput ; 3 + DW Near Ptr CancelExchangeButton ; 4 + DW 0 + +O1_SwapInstrumentList DW 3 + DW Near Ptr IdleFunctionList + DW Near Ptr OKCancelList + DW Near Ptr ExchangeSampleBox + DW Near Ptr SwapInstrumentText + DW Near Ptr ExchangeSampleInputBox + DW Near Ptr ExchangeSampleInput ; 3 + DW Near Ptr CancelExchangeButton ; 4 + DW 0 + +O1_CopyInstrumentList DW 3 + DW Near Ptr IdleFunctionList + DW Near Ptr OKCancelList + DW Near Ptr ExchangeSampleBox + DW Near Ptr CopyInstrumentText + DW Near Ptr ExchangeSampleInputBox + DW Near Ptr ExchangeSampleInput ; 3 + DW Near Ptr CancelExchangeButton ; 4 + DW 0 + +O1_ExchangeInstrumentList DW 3 + DW Near Ptr IdleFunctionList + DW Near Ptr OKCancelList + DW Near Ptr ExchangeSampleBox + DW Near Ptr ExchangeInstrumentText + DW Near Ptr ExchangeSampleInputBox + DW Near Ptr ExchangeSampleInput ; 3 + DW Near Ptr CancelExchangeButton ; 4 + DW 0 + +O1_ResizeSampleList DW 3 + DW Near Ptr IdleFunctionList + DW Near Ptr ESC&ReturnList + DW Near Ptr ResizeSampleBox ; 0 + DW Near Ptr ResizeSampleText ; 1 + DW Near Ptr ResizeSampleInputBox ; 2 + DW Near Ptr ResizeSampleInput ; 3 + DW Near Ptr CancelExchangeButton + DW 0 + +ESCF2&ReturnList DB 0 + DW 13Ch + DD DWord Ptr F_Return0 + +ESC&ReturnList DB 0 + DW 101h + DD DWord Ptr F_Return0 + + DB 0 + DW 11Ch + DD DWord Ptr F_Return1 + + DB 5 + DW Near Ptr ChainMIDICommands + +ExchangeSampleBox DW 0 + DB 26, 23, 54, 32 + DB 3 + +ExchangeSampleText DW 1 + DB 30, 25 + DB 20h + DB "Exchange sample with:", 13 + DB 13 + DB 0FFh, 5, " Sample", 0 + +ResizeSampleBox DW 0 + DB 26, 22, 54, 32 + DB 3 + +ResizeSampleText DW 1 + DB 31, 24 + DB 23h + DB " Resize Sample", 13, 13 + DB 13, 0FEh, 20h + DB "New Length", 0 + +ResizeSampleInputBox DW 0 + DB 41, 26, 49, 28 + DB 27 + +ResizeSampleInput DW 18 + DB 42, 27 + DW 2 + DW Offset NewSampleSize + DD 0 + DW 0FFFFh, 4, 4, 0FFFFh + +SwapSampleText DW 1 + DB 32, 25 + DB 20h + DB "Swap sample with:", 13 + DB 13 + DB " Sample", 0 + +SwapInstrumentText DW 1 + DB 29, 25 + DB 20h + DB "Swap instrument with:", 13 + DB 13 + DB " Instrument", 0 + +CopyInstrumentText DW 1 + DB 31, 25 + DB 20h + DB " Copy instrument:", 13 + DB 13 + DB "Instrument", 0 + +ReplaceSampleText DW 1 + DB 30, 25 + DB 20h + DB "Replace sample with:", 13 + DB 13 + DB 0FFh, 5, " Sample", 0 + +ReplaceInstrumentText DW 1 + DB 28, 25 + DB 20h + DB "Replace instrument with:", 13 + DB 13 + DB " Instrument", 0 + +ExchangeInstrumentText DW 1 + DB 28, 25 + DB 20h + DB "Exchange instrument with:", 13 + DB 13 + DB " Instrument", 0 + +ExchangeSampleInputBox DW 0 + DB 41, 26, 45, 28 + DB 27 + +ExchangeSampleInput DW 16 + DB 42, 27 + DW 2 + DW Offset SampleNumberInput + DW 3 + DD DWord Ptr F_Return1 + DW 0FFFFh, 4, 4, 0FFFFh + +CancelExchangeButton DW 2 + DW 3, 0FFFFh, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 0 + DW 0 ; Returns 0 + DW 0, 0, 0, 0 + DB 35, 29, 44, 31 + DB 8 + DB 0 + DB " Cancel", 0 + + +O1_OrderVolumeList DW 10 + DW Near Ptr IdleFunctionList + DW Near Ptr GlobalKeyList + DW Near Ptr FullScreenBox ; 0 + DW Near Ptr ScreenHeader ; 1 + DW Near Ptr FillHeader ; 2 + DW Near Ptr OrderandVolumeMsg ; 3 + DW Near Ptr OrderBox ; 4 + DW Near Ptr PanBox1 ; 5 + DW Near Ptr PanBox2 ; 6 + DW Near Ptr ShowChannelMsgs ; 7 + DW Near Ptr VolumeText1 ; 8 + DW Near Ptr VolumeText2 ; 9 + DW Near Ptr OrderList ; 10 + DW Near Ptr ChannelVol1 ; 11 + DW Near Ptr ChannelVol2 ; 12 + DW Near Ptr ChannelVol3 ; 13 + DW Near Ptr ChannelVol4 ; 14 + DW Near Ptr ChannelVol5 ; 15 + DW Near Ptr ChannelVol6 ; 16 + DW Near Ptr ChannelVol7 ; 17 + DW Near Ptr ChannelVol8 ; 18 + DW Near Ptr ChannelVol9 ; 19 + DW Near Ptr ChannelVol10 ; 20 + DW Near Ptr ChannelVol11 ; 21 + DW Near Ptr ChannelVol12 ; 22 + DW Near Ptr ChannelVol13 ; 23 + DW Near Ptr ChannelVol14 ; 24 + DW Near Ptr ChannelVol15 ; 25 + DW Near Ptr ChannelVol16 ; 26 + DW Near Ptr ChannelVol17 + DW Near Ptr ChannelVol18 + DW Near Ptr ChannelVol19 + DW Near Ptr ChannelVol20 + DW Near Ptr ChannelVol21 + DW Near Ptr ChannelVol22 + DW Near Ptr ChannelVol23 + DW Near Ptr ChannelVol24 + DW Near Ptr ChannelVol25 + DW Near Ptr ChannelVol26 + DW Near Ptr ChannelVol27 + DW Near Ptr ChannelVol28 + DW Near Ptr ChannelVol29 + DW Near Ptr ChannelVol30 + DW Near Ptr ChannelVol31 + DW Near Ptr ChannelVol32 + DW Near Ptr ChannelVol33 + DW Near Ptr ChannelVol34 + DW Near Ptr ChannelVol35 + DW Near Ptr ChannelVol36 + DW Near Ptr ChannelVol37 + DW Near Ptr ChannelVol38 + DW Near Ptr ChannelVol39 + DW Near Ptr ChannelVol40 + DW Near Ptr ChannelVol41 + DW Near Ptr ChannelVol42 + DW Near Ptr ChannelVol43 + DW Near Ptr ChannelVol44 + DW Near Ptr ChannelVol45 + DW Near Ptr ChannelVol46 + DW Near Ptr ChannelVol47 + DW Near Ptr ChannelVol48 + DW Near Ptr ChannelVol49 + DW Near Ptr ChannelVol50 + DW Near Ptr ChannelVol51 + DW Near Ptr ChannelVol52 + DW Near Ptr ChannelVol53 + DW Near Ptr ChannelVol54 + DW Near Ptr ChannelVol55 + DW Near Ptr ChannelVol56 + DW Near Ptr ChannelVol57 + DW Near Ptr ChannelVol58 + DW Near Ptr ChannelVol59 + DW Near Ptr ChannelVol60 + DW Near Ptr ChannelVol61 + DW Near Ptr ChannelVol62 + DW Near Ptr ChannelVol63 + DW Near Ptr ChannelVol64 ; 74 + DW Near Ptr SetHelpContext4 + DW 0 + +ChannelVol1 DW 9 ; Object 9 + DB 31, 15 ; x,y + DW 0, 64 ; Ranges + DW 4, 0+64 ; Volume/Channel 1 + DW 11, 12, 43, 10 ; Up/Down/Tab/Shift-Tab + DW 11, 19 ; PgUp/PgDn + +ChannelVol2 DW 9 + DB 31, 16 + DW 0, 64 + DW 4, 1+64 ; Volume/Channel 2 + DW 11, 13, 44, 10 ; Up/Down/Tab/Shift-Tab + DW 11, 20 ; PgUp/PgDn + +ChannelVol3 DW 9 ; Object 9 + DB 31, 17 ; x,y + DW 0, 64 ; Ranges + DW 4, 2+64 ; Volume/Channel 3 + DW 12, 14, 45, 10 ; Up/Down/Tab/Shift-Tab + DW 11, 21 ; PgUp/PgDn + +ChannelVol4 DW 9 + DB 31, 18 + DW 0, 64 + DW 4, 3+64 ; Volume/Channel 4 + DW 13, 15, 46, 10 ; Up/Down/Tab/Shift-Tab + DW 11, 22 ; PgUp/PgDn + +ChannelVol5 DW 9 ; Object 9 + DB 31, 19 ; x,y + DW 0, 64 ; Ranges + DW 4, 4+64 ; Volume/Channel 5 + DW 14, 16, 47, 10 ; Up/Down/Tab/Shift-Tab + DW 11, 23 ; PgUp/PgDn + +ChannelVol6 DW 9 + DB 31, 20 + DW 0, 64 + DW 4, 5+64 ; Volume/Channel 6 + DW 15, 17, 48, 10 ; Up/Down/Tab/Shift-Tab + DW 11, 24 ; PgUp/PgDn + +ChannelVol7 DW 9 ; Object 9 + DB 31, 21 ; x,y + DW 0, 64 ; Ranges + DW 4, 6+64 ; Volume/Channel 7 + DW 16, 18, 49, 10 ; Up/Down/Tab/Shift-Tab + DW 11, 25 ; PgUp/PgDn + +ChannelVol8 DW 9 + DB 31, 22 + DW 0, 64 + DW 4, 7+64 ; Volume/Channel 8 + DW 17, 19, 50, 10 ; Up/Down/Tab/Shift-Tab + DW 11, 26 ; PgUp/PgDn + +ChannelVol9 DW 9 ; Object 9 + DB 31, 23 ; x,y + DW 0, 64 ; Ranges + DW 4, 8+64 ; Volume/Channel 9 + DW 18, 20, 51, 10 ; Up/Down/Tab/Shift-Tab + DW 11, 27 ; PgUp/PgDn + +ChannelVol10 DW 9 + DB 31, 24 + DW 0, 64 + DW 4, 9+64 ; Volume/Channel 10 + DW 19, 21, 52, 10 ; Up/Down/Tab/Shift-Tab + DW 12, 28 ; PgUp/PgDn + +ChannelVol11 DW 9 ; Object 9 + DB 31, 25 ; x,y + DW 0, 64 ; Ranges + DW 4, 10+64 ; Volume/Channel 11 + DW 20, 22, 53, 10 ; Up/Down/Tab/Shift-Tab + DW 13, 29 ; PgUp/PgDn + +ChannelVol12 DW 9 + DB 31, 26 + DW 0, 64 + DW 4, 11+64 ; Volume/Channel 12 + DW 21, 23, 54, 10 ; Up/Down/Tab/Shift-Tab + DW 14, 30 ; PgUp/PgDn + +ChannelVol13 DW 9 ; Object 9 + DB 31, 27 ; x,y + DW 0, 64 ; Ranges + DW 4, 12+64 ; Volume/Channel 13 + DW 22, 24, 55, 10 ; Up/Down/Tab/Shift-Tab + DW 15, 31 ; PgUp/PgDn + +ChannelVol14 DW 9 + DB 31, 28 + DW 0, 64 + DW 4, 13+64 ; Volume/Channel 14 + DW 23, 25, 56, 10 ; Up/Down/Tab/Shift-Tab + DW 16, 32 ; PgUp/PgDn + +ChannelVol15 DW 9 ; Object 9 + DB 31, 29 ; x,y + DW 0, 64 ; Ranges + DW 4, 14+64 ; Volume/Channel 15 + DW 24, 26, 57, 10 ; Up/Down/Tab/Shift-Tab + DW 17, 33 ; PgUp/PgDn + +ChannelVol16 DW 9 + DB 31, 30 + DW 0, 64 + DW 4, 15+64 ; Volume/Channel 16 + DW 25, 27, 58, 10 ; Up/Down/Tab/Shift-Tab + DW 18, 34 ; PgUp/PgDn + +ChannelVol17 DW 9 ; Object 9 + DB 31, 31 ; x,y + DW 0, 64 ; Ranges + DW 4, 16+64 ; Volume/Channel 17 + DW 26, 28, 59, 10 ; Up/Down/Tab/Shift-Tab + DW 19, 35 ; PgUp/PgDn + +ChannelVol18 DW 9 + DB 31, 32 + DW 0, 64 + DW 4, 17+64 ; Volume/Channel 18 + DW 27, 29, 60, 10 ; Up/Down/Tab/Shift-Tab + DW 20, 36 ; PgUp/PgDn + +ChannelVol19 DW 9 ; Object 9 + DB 31, 33 ; x,y + DW 0, 64 ; Ranges + DW 4, 18+64 ; Volume/Channel 19 + DW 28, 30, 61, 10 ; Up/Down/Tab/Shift-Tab + DW 21, 37 ; PgUp/PgDn + +ChannelVol20 DW 9 + DB 31, 34 + DW 0, 64 + DW 4, 19+64 ; Volume/Channel 20 + DW 29, 31, 62, 10 ; Up/Down/Tab/Shift-Tab + DW 22, 38 ; PgUp/PgDn + +ChannelVol21 DW 9 ; Object 9 + DB 31, 35 ; x,y + DW 0, 64 ; Ranges + DW 4, 20+64 ; Volume/Channel 21 + DW 30, 32, 63, 10 ; Up/Down/Tab/Shift-Tab + DW 23, 39 ; PgUp/PgDn + +ChannelVol22 DW 9 + DB 31, 36 + DW 0, 64 + DW 4, 21+64 ; Volume/Channel 22 + DW 31, 33, 64, 10 ; Up/Down/Tab/Shift-Tab + DW 24, 40 ; PgUp/PgDn + +ChannelVol23 DW 9 ; Object 9 + DB 31, 37 ; x,y + DW 0, 64 ; Ranges + DW 4, 22+64 ; Volume/Channel 23 + DW 32, 34, 65, 10 ; Up/Down/Tab/Shift-Tab + DW 25, 41 ; PgUp/PgDn + +ChannelVol24 DW 9 + DB 31, 38 + DW 0, 64 + DW 4, 23+64 ; Volume/Channel 24 + DW 33, 35, 66, 10 ; Up/Down/Tab/Shift-Tab + DW 26, 42 ; PgUp/PgDn + +ChannelVol25 DW 9 ; Object 9 + DB 31, 39 ; x,y + DW 0, 64 ; Ranges + DW 4, 24+64 ; Volume/Channel 25 + DW 34, 36, 67, 10 ; Up/Down/Tab/Shift-Tab + DW 27, 43 ; PgUp/PgDn + +ChannelVol26 DW 9 + DB 31, 40 + DW 0, 64 + DW 4, 25+64 ; Volume/Channel 26 + DW 35, 37, 68, 10 ; Up/Down/Tab/Shift-Tab + DW 28, 44 ; PgUp/PgDn + +ChannelVol27 DW 9 ; Object 9 + DB 31, 41 ; x,y + DW 0, 64 ; Ranges + DW 4, 26+64 ; Volume/Channel 27 + DW 36, 38, 69, 10 ; Up/Down/Tab/Shift-Tab + DW 29, 45 ; PgUp/PgDn + +ChannelVol28 DW 9 + DB 31, 42 + DW 0, 64 + DW 4, 27+64 ; Volume/Channel 28 + DW 37, 39, 70, 10 ; Up/Down/Tab/Shift-Tab + DW 30, 46 ; PgUp/PgDn + +ChannelVol29 DW 9 ; Object 9 + DB 31, 43 ; x,y + DW 0, 64 ; Ranges + DW 4, 28+64 ; Volume/Channel 29 + DW 38, 40, 71, 10 ; Up/Down/Tab/Shift-Tab + DW 31, 47 ; PgUp/PgDn + +ChannelVol30 DW 9 + DB 31, 44 + DW 0, 64 + DW 4, 29+64 ; Volume/Channel 30 + DW 39, 41, 72, 10 ; Up/Down/Tab/Shift-Tab + DW 32, 48 ; PgUp/PgDn + +ChannelVol31 DW 9 ; Object 9 + DB 31, 45 ; x,y + DW 0, 64 ; Ranges + DW 4, 30+64 ; Volume/Channel 31 + DW 40, 42, 73, 10 ; Up/Down/Tab/Shift-Tab + DW 33, 49 ; PgUp/PgDn + +ChannelVol32 DW 9 + DB 31, 46 + DW 0, 64 + DW 4, 31+64 ; Volume/Channel 32 + DW 41, 43, 74, 10 ; Up/Down/Tab/Shift-Tab + DW 34, 50 ; PgUp/PgDn + +ChannelVol33 DW 9 ; Object 9 + DB 65, 15 ; x,y + DW 0, 64 ; Ranges + DW 4, 32+64 ; Volume/Channel 33 + DW 42, 44, 10, 11 ; Up/Down/Tab/Shift-Tab + DW 35, 51 ; PgUp/PgDn + +ChannelVol34 DW 9 + DB 65, 16 + DW 0, 64 + DW 4, 33+64 ; Volume/Channel 34 + DW 43, 45, 10, 12 ; Up/Down/Tab/Shift-Tab + DW 36, 52 ; PgUp/PgDn + +ChannelVol35 DW 9 ; Object 9 + DB 65, 17 ; x,y + DW 0, 64 ; Ranges + DW 4, 34+64 ; Volume/Channel 35 + DW 44, 46, 10, 13 ; Up/Down/Tab/Shift-Tab + DW 37, 53 ; PgUp/PgDn + +ChannelVol36 DW 9 + DB 65, 18 + DW 0, 64 + DW 4, 35+64 ; Volume/Channel 36 + DW 45, 47, 10, 14 ; Up/Down/Tab/Shift-Tab + DW 38, 54 ; PgUp/PgDn + +ChannelVol37 DW 9 ; Object 9 + DB 65, 19 ; x,y + DW 0, 64 ; Ranges + DW 4, 36+64 ; Volume/Channel 37 + DW 46, 48, 10, 15 ; Up/Down/Tab/Shift-Tab + DW 39, 55 ; PgUp/PgDn + +ChannelVol38 DW 9 + DB 65, 20 + DW 0, 64 + DW 4, 37+64 ; Volume/Channel 38 + DW 47, 49, 10, 16 ; Up/Down/Tab/Shift-Tab + DW 40, 56 ; PgUp/PgDn + +ChannelVol39 DW 9 ; Object 9 + DB 65, 21 ; x,y + DW 0, 64 ; Ranges + DW 4, 38+64 ; Volume/Channel 39 + DW 48, 50, 10, 17 ; Up/Down/Tab/Shift-Tab + DW 41, 57 ; PgUp/PgDn + +ChannelVol40 DW 9 + DB 65, 22 + DW 0, 64 + DW 4, 39+64 ; Volume/Channel 40 + DW 49, 51, 10, 18 ; Up/Down/Tab/Shift-Tab + DW 42, 58 ; PgUp/PgDn + +ChannelVol41 DW 9 ; Object 9 + DB 65, 23 ; x,y + DW 0, 64 ; Ranges + DW 4, 40+64 ; Volume/Channel 41 + DW 50, 52, 10, 19 ; Up/Down/Tab/Shift-Tab + DW 43, 59 ; PgUp/PgDn + +ChannelVol42 DW 9 + DB 65, 24 + DW 0, 64 + DW 4, 41+64 ; Volume/Channel 42 + DW 51, 53, 10, 20 ; Up/Down/Tab/Shift-Tab + DW 44, 60 ; PgUp/PgDn + +ChannelVol43 DW 9 ; Object 9 + DB 65, 25 ; x,y + DW 0, 64 ; Ranges + DW 4, 42+64 ; Volume/Channel 43 + DW 52, 54, 10, 21 ; Up/Down/Tab/Shift-Tab + DW 45, 61 ; PgUp/PgDn + +ChannelVol44 DW 9 + DB 65, 26 + DW 0, 64 + DW 4, 43+64 ; Volume/Channel 44 + DW 53, 55, 10, 22 ; Up/Down/Tab/Shift-Tab + DW 46, 62 ; PgUp/PgDn + +ChannelVol45 DW 9 ; Object 9 + DB 65, 27 ; x,y + DW 0, 64 ; Ranges + DW 4, 44+64 ; Volume/Channel 45 + DW 54, 56, 10, 23 ; Up/Down/Tab/Shift-Tab + DW 47, 63 ; PgUp/PgDn + +ChannelVol46 DW 9 + DB 65, 28 + DW 0, 64 + DW 4, 45+64 ; Volume/Channel 46 + DW 55, 57, 10, 24 ; Up/Down/Tab/Shift-Tab + DW 48, 64 ; PgUp/PgDn + +ChannelVol47 DW 9 ; Object 9 + DB 65, 29 ; x,y + DW 0, 64 ; Ranges + DW 4, 46+64 ; Volume/Channel 47 + DW 56, 58, 10, 25 ; Up/Down/Tab/Shift-Tab + DW 49, 65 ; PgUp/PgDn + +ChannelVol48 DW 9 + DB 65, 30 + DW 0, 64 + DW 4, 47+64 ; Volume/Channel 48 + DW 57, 59, 10, 26 ; Up/Down/Tab/Shift-Tab + DW 50, 66 ; PgUp/PgDn + +ChannelVol49 DW 9 ; Object 9 + DB 65, 31 ; x,y + DW 0, 64 ; Ranges + DW 4, 48+64 ; Volume/Channel 49 + DW 58, 60, 10, 27 ; Up/Down/Tab/Shift-Tab + DW 51, 67 ; PgUp/PgDn + +ChannelVol50 DW 9 + DB 65, 32 + DW 0, 64 + DW 4, 49+64 ; Volume/Channel 50 + DW 59, 61, 10, 28 ; Up/Down/Tab/Shift-Tab + DW 52, 68 ; PgUp/PgDn + +ChannelVol51 DW 9 ; Object 9 + DB 65, 33 ; x,y + DW 0, 64 ; Ranges + DW 4, 50+64 ; Volume/Channel 51 + DW 60, 62, 10, 29 ; Up/Down/Tab/Shift-Tab + DW 53, 69 ; PgUp/PgDn + +ChannelVol52 DW 9 + DB 65, 34 + DW 0, 64 + DW 4, 51+64 ; Volume/Channel 52 + DW 61, 63, 10, 30 ; Up/Down/Tab/Shift-Tab + DW 54, 70 ; PgUp/PgDn + +ChannelVol53 DW 9 ; Object 9 + DB 65, 35 ; x,y + DW 0, 64 ; Ranges + DW 4, 52+64 ; Volume/Channel 53 + DW 62, 64, 10, 31 ; Up/Down/Tab/Shift-Tab + DW 55, 71 ; PgUp/PgDn + +ChannelVol54 DW 9 + DB 65, 36 + DW 0, 64 + DW 4, 53+64 ; Volume/Channel 54 + DW 63, 65, 10, 32 ; Up/Down/Tab/Shift-Tab + DW 56, 72 ; PgUp/PgDn + +ChannelVol55 DW 9 ; Object 9 + DB 65, 37 ; x,y + DW 0, 64 ; Ranges + DW 4, 54+64 ; Volume/Channel 55 + DW 64, 66, 10, 33 ; Up/Down/Tab/Shift-Tab + DW 57, 73 ; PgUp/PgDn + +ChannelVol56 DW 9 + DB 65, 38 + DW 0, 64 + DW 4, 55+64 ; Volume/Channel 56 + DW 65, 67, 10, 34 ; Up/Down/Tab/Shift-Tab + DW 58, 74 ; PgUp/PgDn + +ChannelVol57 DW 9 ; Object 9 + DB 65, 39 ; x,y + DW 0, 64 ; Ranges + DW 4, 56+64 ; Volume/Channel 57 + DW 66, 68, 10, 35 ; Up/Down/Tab/Shift-Tab + DW 59, 74 ; PgUp/PgDn + +ChannelVol58 DW 9 + DB 65, 40 + DW 0, 64 + DW 4, 57+64 ; Volume/Channel 58 + DW 67, 69, 10, 36 ; Up/Down/Tab/Shift-Tab + DW 60, 74 ; PgUp/PgDn + +ChannelVol59 DW 9 ; Object 9 + DB 65, 41 ; x,y + DW 0, 64 ; Ranges + DW 4, 58+64 ; Volume/Channel 59 + DW 68, 70, 10, 37 ; Up/Down/Tab/Shift-Tab + DW 61, 74 ; PgUp/PgDn + +ChannelVol60 DW 9 + DB 65, 42 + DW 0, 64 + DW 4, 59+64 ; Volume/Channel 60 + DW 69, 71, 10, 38 ; Up/Down/Tab/Shift-Tab + DW 62, 74 ; PgUp/PgDn + +ChannelVol61 DW 9 ; Object 9 + DB 65, 43 ; x,y + DW 0, 64 ; Ranges + DW 4, 60+64 ; Volume/Channel 61 + DW 70, 72, 10, 39 ; Up/Down/Tab/Shift-Tab + DW 63, 74 ; PgUp/PgDn + +ChannelVol62 DW 9 + DB 65, 44 + DW 0, 64 + DW 4, 61+64 ; Volume/Channel 62 + DW 71, 73, 10, 40 ; Up/Down/Tab/Shift-Tab + DW 64, 74 ; PgUp/PgDn + +ChannelVol63 DW 9 ; Object 9 + DB 65, 45 ; x,y + DW 0, 64 ; Ranges + DW 4, 62+64 ; Volume/Channel 63 + DW 72, 74, 10, 41 ; Up/Down/Tab/Shift-Tab + DW 65, 74 ; PgUp/PgDn + +ChannelVol64 DW 9 + DB 65, 46 + DW 0, 64 + DW 4, 63+64 ; Volume/Channel 64 + DW 73, 74, 10, 42 ; Up/Down/Tab/Shift-Tab + DW 66, 74 ; PgUp/PgDn + +O1_ConfigureITList DW 14 ; Song name input + DW Near Ptr IdleFunctionList + DW Near Ptr GlobalKeyList + DW Near Ptr FullScreenBox ; 0 + DW Near Ptr ScreenHeader ; 1 + DW Near Ptr FillHeader ; 2 + DW Near Ptr ConfigureListHeader + DW Near Ptr DivisionLine + DW Near Ptr SongVarText1 + DW Near Ptr SongNameBox + DW Near Ptr InitialSpeedBox + DW Near Ptr VolumeBox + DW Near Ptr SongVarText2 + DW Near Ptr LinkCommandGToggle ; 10 + DW Near Ptr DirectoryText1 + DW Near Ptr DirectoryText2 + DW Near Ptr DirectoryInputBox + DW Near Ptr SongNameInput ; 14 + DW Near Ptr InitialTempoInput ; 15 + DW Near Ptr InitialSpeedInput ; 16 + DW Near Ptr GlobalVolumeInput ; 17 + DW Near Ptr MixingVolumeInput ; 18 + DW Near Ptr SeparationInput ; 19 + DW Near Ptr OldEffectsModeToggle ; 20 + DW Near Ptr ConfigSetupButtons ; 21 + DW Near Ptr ControlInstrumentButton ; 22 + DW Near Ptr ControlSampleButton ; 23 + DW Near Ptr PlayBackStereoButton ; 24 + DW Near Ptr PlayBackMonoButton ; 25 + DW Near Ptr SlideLinearButton ; 26 + DW Near Ptr SlideAmigaButton ; 27 + DW Near Ptr SongDirectoryInput ; 28 + DW Near Ptr SampleDirectoryInput ; 29 + DW Near Ptr InstrumentDirectoryInput ; 30 + DW Near Ptr SaveDirectoryConfigButton ; 31 + DW Near Ptr LinkCommandGToggle ; 32 + DW Near Ptr SetHelpContext5 + DW 0 + +ConfigureListHeader DW 10 + DB "Song Variables & Directory Configuration (F12)", 0 + +DivisionLine DW 1 + DB 1, 39 + DB 21h + DB 0FFh, 78, 129, 0 + +SongVarText1 DW 1 + DB 33, 13 + DB 23h + DB "Song Variables", 0 + +SongNameBox DW 0 + DB 16, 15, 43, 17 + DB 25 + +InitialSpeedBox DW 0 + DB 16, 18, 50, 21 + DB 9 + +VolumeBox DW 0 + DB 16, 22, 34, 28 + DB 25 + +SongVarText2 DW 1 + DB 2, 16 + DB 20h + DB 0FFh, 5, " Song Name", 13 + DB 13 + DB 13 + DB " Initial Tempo", 13 + DB " Initial Speed", 13 + DB 13 + DB 13 + DB " Global Volume", 13 + DB " Mixing Volume", 13 + DB 0FFh, 4, " Separation", 13 + DB " Old Effects", 13 + DB "Compatible Gxx", 13 + DB 13 + DB 13 + DB 0FFh, 7, " Control", 13 + DB 13 + DB 13 + DB 0FFh, 6, " Playback", 13 + DB 13 + DB 13 + DB " Pitch Slides" + DB 0 + +DirectoryText1 DW 1 + DB 34, 40 + DB 23h + DB "Directories", 0 + +DirectoryText2 DW 1 + DB 2, 42 + DB 20h + DB 0FFh, 4, " Module", 13 + DB 0FFh, 4, " Sample", 13 + DB "Instrument", 13 + DB 0 + +DirectoryInputBox DW 0 + DB 12, 41, 78, 45 + DB 27 + +SongNameInput DW 16 + DB 17, 16 + DW 4, 4 ; Song seg, Song name + DW 26 + DD 0 + DW 0FFFFh, 15, 15, 0FFFFh + +InitialTempoInput DW 14 + DB 17, 19 + DW 31, 255 + DW 3, 33h ; Init. Tempo=Music:33h + DW 14, 16, 16, 14 + DW 0FFFFh, 0FFFFh ; PgUp/PgDn + DW 32 + +InitialSpeedInput DW 14 + DB 17, 20 + DW 1, 255 + DW 3, 32h ; Init. Tempo=Music:33h + DW 15, 17, 17, 15 + DW 0FFFFh, 0FFFFh ; PgUp/PgDn + DW 32 + +GlobalVolumeInput DW 9 + DB 17, 23 + DW 0, 128 + DW 3, 30h + DW 16, 18, 18, 16 + DW 0FFFFh, 0FFFFh ; PgUp/PgDn + +MixingVolumeInput DW 9 + DB 17, 24 + DW 0, 128 + DW 3, 31h + DW 17, 19, 19, 17 + DW 0FFFFh, 0FFFFh ; PgUp/PgDn + +SeparationInput DW 9 + DB 17, 25 + DW 0, 128 + DW 3, 34h + DW 18, 20, 20, 18 + DW 0FFFFh, 0FFFFh ; PgUp/PgDn + +OldEffectsModeToggle DW 17 + DB 17, 26 + DW 2 + DW 2Ch ; Offset of 'Flags' + DB 16 + DW 19, 10, 10, 19 + +LinkCommandGToggle DW 17 + DB 17, 27 + DW 2 + DW 2Ch ; Offset of 'Flags' + DB 32 + DW 20, 22, 22, 20 + +ConfigSetupButtons DW 8 + DD DWord Ptr F_ConfigButtonSetup + +ControlInstrumentButton DW 2 + DW 10, 24, 23, 23 + DW 0 + DW 0, 0 ; Empty Data... + DW 2 ; Call Function + DD DWord Ptr F_SetControlInstrument + DW 0, 0, 0 ; Empty data... + DB 16, 29, 30, 31 + DB 8 + DB 0 + DB " Instruments", 0 + +ControlSampleButton DW 2 + DW 10, 25, 22, 22 + DW 0 + DW 0, 0 ; Empty Data... + DW 2 ; Call Function + DD DWord Ptr F_SetControlSample + DW 0, 0, 0 ; Empty data... + DB 31, 29, 45, 31 + DB 8 + DB 0 + DB " Samples", 0 + +PlayBackStereoButton DW 2 + DW 22, 26, 25, 25 + DW 0 + DW 0, 0 ; Empty Data... + DW 2 ; Call Function + DD DWord Ptr F_SetStereo + DW 0, 0, 0 ; Empty data... + DB 16, 32, 30, 34 + DB 8 + DB 0 + DB " Stereo", 0 + +PlayBackMonoButton DW 2 + DW 23, 27, 24, 24 + DW 0 + DW 0, 0 ; Empty Data... + DW 2 ; Call Function + DD DWord Ptr F_SetMono + DW 0, 0, 0 ; Empty data... + DB 31, 32, 45, 34 + DB 8 + DB 0 + DB " Mono", 0 + +SlideLinearButton DW 2 + DW 24, 28, 27, 27 + DW 0 + DW 0, 0 ; Empty Data... + DW 2 ; Call Function + DD DWord Ptr F_SetLinear + DW 0, 0, 0 ; Empty data... + DB 16, 35, 30, 37 + DB 8 + DB 0 + DB " Linear", 0 + +SlideAmigaButton DW 2 + DW 25, 28, 26, 26 + DW 0 + DW 0, 0 ; Empty Data... + DW 2 ; Call Function + DD DWord Ptr F_SetAmiga + DW 0, 0, 0 ; Empty data... + DB 31, 35, 45, 37 + DB 8 + DB 0 + DB " Amiga", 0 + + + +SongDirectoryInput DW 16 + DB 13, 42 + DW 0, Offset SongDirectory + DW 65 + DD 0 + DW 26, 29, 29, 26 + +SampleDirectoryInput DW 16 + DB 013, 43 + DW 0, Offset SampleDirectory + DW 65 + DD 0 + DW 28, 30, 30, 28 + +InstrumentDirectoryInput DW 16 + DB 13, 44 + DW 0, Offset InstrumentDirectory + DW 65 + DD 0 + DW 29, 31, 31, 29 + +SaveDirectoryConfigButton DW 2 + DW 30, 0FFFFh, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 ; Press... no data reqd + DW 2 + DD DWord Ptr D_SaveDirectoryConfiguration + DW 0, 0, 0 ; Unused data.. + DB 27, 46, 52, 48 + DB 8 ; Thin box up + DB 0 ; Button up + DB " Save all Preferences", 0 + +O1_KeyboardList DW 8 + DW Near Ptr IdleKeyboardFunctionList + DW Near Ptr GlobalKeyList + DW Near Ptr FullScreenBox ; 0 + DW Near Ptr ScreenHeader ; 1 + DW Near Ptr FillHeader ; 2 + DW Near Ptr KeyboardHeader ; 3 + DW Near Ptr KeyboardBox1 ; 4 + DW Near Ptr KeyboardBox2 ; 5 + DW Near Ptr KeyboardText1 ; 6 + DW Near Ptr KeyboardText2 ; 7 + DW Near Ptr KBClearTableButton ; 8 + DW Near Ptr KBDrawTables + DW Near Ptr SetHelpContext8 + DW 0 + +IdleKeyboardFunctionList DD DWord Ptr IdleUpdateInfoLine + DD DWord Ptr K_DrawTables + DD 0 + +KBDrawTables DW 8 + DD DWord Ptr K_DrawTables + +KeyboardHeader DW 10 + DB "Keyboard Information (Ctrl-F1)", 0 + +KeyboardBox1 DW 0 + DB 1, 14, 25, 47 + DB 27 + +KeyboardBox2 DW 0 + DB 28, 14, 52, 47 + DB 27 + +KeyboardText1 DW 1 + DB 2, 13 + DB 20h + DB "Keyboard Queue", 0 + +KeyboardText2 DW 1 + DB 29, 13 + DB 20h + DB "Keypress Table", 0 + +KBClearTableButton DW 2 + DW 0FFFFh, 0FFFFh, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 2 + DD DWord Ptr K_ResetKeyboardTables + DW 0, 0, 0 + DB 53, 14, 77, 16 + DB 8 + DB 0 + DB " Clear Keyboard Tables", 0 + + +O1_InstrumentListGeneral DW 4 + DW Near Ptr IdleFunctionList + DW Near Ptr InstrumentGlobalKeyList + DW Near Ptr FullScreenBox ; 0 + DW Near Ptr ScreenHeader ; 1 + DW Near Ptr InstrumentListHeader ; 2 + DW Near Ptr InstrumentNameBox ; 3 + DW Near Ptr InstrumentWindow ; 4 + DW Near Ptr GInstrumentGeneralButton ; 5 + DW Near Ptr GInstrumentVolumeButton ; 6 + DW Near Ptr GInstrumentPanningButton ; 7 + DW Near Ptr GInstrumentPitchButton ; 8 + DW Near Ptr InstrumentTranslateBox ; 9 + DW Near Ptr InstrumentNoteWindow ; 10 + DW Near Ptr InstrumentFileDivision + DW Near Ptr InstrumentDCTDivision + DW Near Ptr InstrumentGeneralNNAText + DW Near Ptr InstrumentGeneralDCTText + DW Near Ptr InstrumentGeneralFileNameText ; 15 + DW Near Ptr NNAButtonCut ; 16 + DW Near Ptr NNAButtonContinue ; 17 + DW Near Ptr NNAButtonOff ;18 + DW Near Ptr NNAButtonFade ; 19 + DW Near Ptr DCTButtonOff ; 20 + DW Near Ptr DCTButtonNote ; 21 + DW Near Ptr DCTButtonSample ; 22 + DW Near Ptr DCTButtonInstrument ; 23 + DW Near Ptr DCAButtonCut ; 24 + DW Near Ptr DCAButtonOff ; 25 + DW Near Ptr DCAButtonFade ; 26 + DW Near Ptr InstrumentFilenameBox ; 27 + DW Near Ptr InstrumentFilename ; 28 + DW Near Ptr InstrumentNNADivision + DW Near Ptr FillHeader + DW Near Ptr SetHelpContext7 + DW 0 + +InstrumentDCTDivision DW 1 + DB 44, 30 + DB 20h + DB 0FFh, 35, 134, 0 + +InstrumentFileDivision DW 1 + DB 44, 45 + DB 20h + DB 0FFh, 35, 154, 0 + +InstrumentNNADivision DW 1 + DB 44, 15 + DB 20h + DB 0FFh, 35, 134, 0 + +NNAButtonCut DW 2 + DW 6, 17, 10, 4 + DW 0 + DW 0, 0 + DW 5 + DD DWord Ptr F_InstrumentButtonHandler + DW 0 ; Set to 0 + DW 11h + DW 0 ; Unused + DB 45, 18, 77, 20, 8 + DB 0 + DB " Note Cut", 0 + +NNAButtonContinue DW 2 + DW 16, 18, 10, 4 + DW 0 + DW 0, 0 + DW 5 + DD DWord Ptr F_InstrumentButtonHandler + DW 1 ; Set to 1 + DW 11h + DW 0 ; Unused + DB 45, 21, 77, 23, 8 + DB 0 + DB " Continue", 0 + +NNAButtonOff DW 2 + DW 17, 19, 10, 4 + DW 0 + DW 0, 0 + DW 5 + DD DWord Ptr F_InstrumentButtonHandler + DW 2 + DW 11h + DW 0 ; Unused + DB 45, 24, 77, 26, 8 + DB 0 + DB " Note Off", 0 + +NNAButtonFade DW 2 + DW 18, 20, 10, 4 + DW 0 + DW 0, 0 + DW 5 + DD DWord Ptr F_InstrumentButtonHandler + DW 3 + DW 11h + DW 0 ; Unused + DB 45, 27, 77, 29, 8 + DB 0 + DB " Note Fade", 0 + +DCTButtonOff DW 2 + DW 19, 21, 10, 24 + DW 0 + DW 0, 0 + DW 5 + DD DWord Ptr F_InstrumentButtonHandler + DW 0 ; Set to 0 + DW 12h + DW 0 ; Unused + DB 45, 33, 60, 35, 8 + DB 0 + DB " Disabled", 0 + +DCTButtonNote DW 2 + DW 20, 22, 10, 25 + DW 0 + DW 0, 0 + DW 5 + DD DWord Ptr F_InstrumentButtonHandler + DW 1 + DW 12h + DW 0 ; Unused + DB 45, 36, 60, 38, 8 + DB 0 + DB " Note", 0 + +DCTButtonSample DW 2 + DW 21, 23, 10, 26 + DW 0 + DW 0, 0 + DW 5 + DD DWord Ptr F_InstrumentButtonHandler + DW 2 + DW 12h + DW 0 ; Unused + DB 45, 39, 60, 41, 8 + DB 0 + DB " Sample", 0 + +DCTButtonInstrument DW 2 + DW 22, 28, 10, 0FFFFh + DW 0 + DW 0, 0 + DW 5 + DD DWord Ptr F_InstrumentButtonHandler + DW 3 + DW 12h + DW 0 ; Unused + DB 45, 42, 60, 44, 8 + DB 0 + DB " Instrument", 0 + +DCAButtonCut DW 2 + DW 19, 25, 20, 4 + DW 0 + DW 0, 0 + DW 5 + DD DWord Ptr F_InstrumentButtonHandler + DW 0 ; Set to 0 + DW 13h + DW 0 ; Unused + DB 61, 33, 77, 35, 8 + DB 0 + DB " Note Cut", 0 + +DCAButtonOff DW 2 + DW 24, 26, 21, 4 + DW 0 + DW 0, 0 + DW 5 + DD DWord Ptr F_InstrumentButtonHandler + DW 1 ; Set to 0 + DW 13h + DW 0 ; Unused + DB 61, 36, 77, 38, 8 + DB 0 + DB " Note Off", 0 + +DCAButtonFade DW 2 + DW 25, 28, 22, 4 + DW 0 + DW 0, 0 + DW 5 + DD DWord Ptr F_InstrumentButtonHandler + DW 2 ; Set to 0 + DW 13h + DW 0 ; Unused + DB 61, 39, 77, 41, 8 + DB 0 + DB " Note Fade", 0 + + +InstrumentGeneralNNAText DW 1 + DB 54, 17 + DB 20h + DB "New Note Action", 0 + +InstrumentGeneralDCTText DW 1 + DB 47, 32 + DB 20h + DB "Duplicate Check Type & Action", 0 + +InstrumentGeneralFileNameText DW 1 + DB 47, 47 + DB 20h + DB "Filename", 0 + +InstrumentFilenameBox DW 0 + DB 55, 46, 73, 48 + DB 27 + +InstrumentFileName DW 16 + DB 56, 47 + DW 6, 4 + DW 13 + DD 0 + DW 22, 0FFFFh, 4, 10 + +GInstrumentGeneralButton DW 2 + DW 0FFFFh, 10, 4, 6 + DW 0, 0, 0 + DW 6 + DD I_GetInstrumentScreen + DW 0 + DD I_SelectScreen + DB 31, 12, 41, 14 + DB 8, 0 + DB " General", 0 + +GInstrumentVolumeButton DW 2 + DW 0FFFFh, 16, 5, 7 + DW 0, 0, 0 + DW 6 + DD I_GetInstrumentScreen + DW 1 + DD I_SelectScreen + DB 43, 12, 53, 14 + DB 8, 0 + DB " Volume", 0 + +GInstrumentPanningButton DW 2 + DW 0FFFFh, 16, 6, 8 + DW 0, 0, 0 + DW 6 + DD I_GetInstrumentScreen + DW 2 + DD I_SelectScreen + DB 55, 12, 65, 14 + DB 8, 0 + DB " Panning", 0 + +GInstrumentPitchButton DW 2 + DW 0FFFFh, 16, 7, 4 + DW 0, 0, 0 + DW 6 + DD I_GetInstrumentScreen + DW 3 + DD I_SelectScreen + DB 67, 12, 77, 14 + DB 8, 0 + DB " Pitch", 0 + + +O1_InstrumentListVolume DW 4 + DW Near Ptr IdleInstrumentList + DW Near Ptr InstrumentGlobalKeyList + DW Near Ptr FullScreenBox ; 0 + DW Near Ptr ScreenHeader ; 1 + DW Near Ptr InstrumentListHeader ; 2 + DW Near Ptr InstrumentNameBox ; 3 + DW Near Ptr InstrumentWindow ; 4 + DW Near Ptr VInstrumentGeneralButton ; 5 + DW Near Ptr VInstrumentVolumeButton ; 6 + DW Near Ptr VInstrumentPanningButton ; 7 + DW Near Ptr VInstrumentPitchButton ; 8 + DW Near Ptr InstrumentEnvelopeBox ; 9 + DW Near Ptr InstrumentEnvelope ; 10 + DW Near Ptr InstrumentVEBox ; 11 + DW Near Ptr InstrumentVELBox ; 12 + DW Near Ptr InstrumentVESLBox ; 13 + DW Near Ptr InstrumentVEText ; 14 + DW Near Ptr InstrumentVELText ; 15 + DW Near Ptr InstrumentVESLText ; 16 + DW Near Ptr InstrumentVEToggle ; 17 + DW Near Ptr InstrumentVELToggle ; 18 + DW Near Ptr InstrumentVELBeg ; 19 + DW Near Ptr InstrumentVELEnd ; 20 + DW Near Ptr InstrumentVESLToggle ; 21 + DW Near Ptr InstrumentVESLBeg ; 22 + DW Near Ptr InstrumentVESLEnd ; 23 + DW Near Ptr InstrumentGlobalVolumeBox ; 24 + DW Near Ptr InstrumentGlobalVolumeText ; 25 + DW Near Ptr InstrumentVolume2 ; 26 + DW Near Ptr InstrumentFadeOut2 ; 27 + DW Near Ptr InstrumentRandomVolBox ; 28 + DW Near Ptr InstrumentRandomVolBar ; 29 + DW Near Ptr InstrumentVECToggle ; 30 + DW Near Ptr FillHeader + DW Near Ptr SetHelpContext7 + DW 0 + +InstrumentVEBox DW 0 + DB 53, 27, 63, 30 + DB 27 + +InstrumentVEText DW 1 + DB 38, 28 + DB 20h + DB "Volume Envelope", 13 + DB " Carry", 0 + +InstrumentVEToggle DW 17 + DB 54, 28 + DW 4, 130h + DB 1 + DW 10, 30, 4, 4 + +InstrumentVECToggle DW 17 + DB 54, 29 + DW 4, 130h + DB 8 + DW 17, 18, 4, 4 + +InstrumentVELBox DW 0 + DB 53, 31, 63, 35 + DB 27 + +InstrumentVELToggle DW 17 + DB 54, 32 + DW 4, 130h + DB 2 + DW 30, 19, 4, 4 + +InstrumentVELBeg DW 13 + DB 54, 33 + DW 0, 132h + DD 0 + DW 18, 20, 4, 4 + +InstrumentVELEnd DW 13 + DB 54, 34 + DW 0, 133h + DD 0 + DW 19, 21, 4, 4 + +InstrumentVELText DW 1 + DB 40, 32 + DB 20h + DB "Envelope Loop", 13 + DB " Loop Begin", 13 + DB 0FFh, 5, " Loop End", 0 + +InstrumentVESLBox DW 0 + DB 53, 36, 63, 40 + DB 27 + +InstrumentVESLText DW 1 + DB 40, 37 + DB 20h + DB " Sustain Loop", 13 + DB "SusLoop Begin", 13 + DB " SusLoop End", 0 + +InstrumentVESLToggle DW 17 + DB 54, 37 + DW 4, 130h + DB 4 + DW 20, 22, 4, 4 + +InstrumentVESLBeg DW 13 + DB 54, 38 + DW 0, 134h + DD 0 + DW 21, 23, 4, 4 + +InstrumentVESLEnd DW 13 + DB 54, 39 + DW 0, 135h + DD 0 + DW 22, 26, 4, 4 + +InstrumentEnvelopeBox DW 0 + DB 31, 17, 77, 26 + DB 27 + +InstrumentGlobalVolumeBox DW 0 + DB 53, 41, 71, 44 + DB 27 + +InstrumentGlobalVolumeText DW 1 + DB 39, 42 + DB 20h + DB " Global Volume", 13 + DB 0FFh, 7, " Fadeout", 13 + DB 13 + DB 13 + DB "Volume Swing %", 0 + +InstrumentRandomVolBox DW 0 + DB 53, 45, 71, 47 + DB 27 + +InstrumentRandomVolBar DW 14 + DB 54, 46 + DW 0, 100 + DW 6, 1Ah + DW 27, 0FFFFh, 4, 4 + DW 0FFFFh, 0FFFFh + DW 16 + +InstrumentVolume2 DW 9 + DB 54, 42 + DW 0, 128 + DW 6, 18h + DW 23, 27, 4, 4 + DW 0FFFFh, 0FFFFh + +InstrumentFadeOut2 DW 14 + DB 54, 43 + DW 0, 256 + DW 6, 14h + DW 26, 29, 4, 4 + DW 0FFFFh, 0FFFFh + DW 16 + +InstrumentEnvelope DW 15 + DD DWord Ptr I_DrawEnvelope + DD DWord Ptr I_PreEnvelope + DD DWord Ptr I_PostEnvelope + +VInstrumentGeneralButton DW 2 + DW 0FFFFh, 10, 4, 6 + DW 0, 0, 0 + DW 6 + DD I_GetInstrumentScreen + DW 0 + DD I_SelectScreen + DB 31, 12, 41, 14 + DB 8, 0 + DB " General", 0 + +VInstrumentVolumeButton DW 2 + DW 0FFFFh, 10, 5, 7 + DW 0, 0, 0 + DW 6 + DD I_GetInstrumentScreen + DW 1 + DD I_SelectScreen + DB 43, 12, 53, 14 + DB 8, 0 + DB " Volume", 0 + +VInstrumentPanningButton DW 2 + DW 0FFFFh, 10, 6, 8 + DW 0, 0, 0 + DW 6 + DD I_GetInstrumentScreen + DW 2 + DD I_SelectScreen + DB 55, 12, 65, 14 + DB 8, 0 + DB " Panning", 0 + +VInstrumentPitchButton DW 2 + DW 0FFFFh, 10, 7, 4 + DW 0, 0, 0 + DW 6 + DD I_GetInstrumentScreen + DW 3 + DD I_SelectScreen + DB 67, 12, 77, 14 + DB 8, 0 + DB " Pitch", 0 + +O1_InstrumentListPanning DW 4 + DW Near Ptr IdleInstrumentList + DW Near Ptr InstrumentGlobalKeyList + DW Near Ptr FullScreenBox ; 0 + DW Near Ptr ScreenHeader ; 1 + DW Near Ptr InstrumentListHeader ; 2 + DW Near Ptr InstrumentNameBox ; 3 + DW Near Ptr InstrumentWindow ; 4 + DW Near Ptr VInstrumentGeneralButton ; 5 + DW Near Ptr VInstrumentVolumeButton ; 6 + DW Near Ptr VInstrumentPanningButton ; 7 + DW Near Ptr VInstrumentPitchButton ; 8 + DW Near Ptr InstrumentEnvelopeBox ; 9 + DW Near Ptr InstrumentEnvelope ; 10 + DW Near Ptr InstrumentVEBox ; 11 + DW Near Ptr InstrumentVELBox ; 12 + DW Near Ptr InstrumentVESLBox ; 13 + DW Near Ptr InstrumentPanText ; 14 + DW Near Ptr InstrumentVELText ; 15 + DW Near Ptr InstrumentVESLText ; 16 + DW Near Ptr InstrumentPanToggle ; 17 + DW Near Ptr InstrumentPanLToggle ; 18 + DW Near Ptr InstrumentPanLBeg ; 19 + DW Near Ptr InstrumentPanLEnd ; 20 + DW Near Ptr InstrumentPanSLToggle ; 21 + DW Near Ptr InstrumentPanSLBeg ; 22 + DW Near Ptr InstrumentPanSLEnd ; 23 + DW Near Ptr InstrumentDefaultPanBox ; 24 + DW Near Ptr InstrumentDefaultPanText ; 25 + DW Near Ptr InstrumentDefaultPanToggle ; 26 + DW Near Ptr InstrumentDefaultPanValue ; 27 + DW Near Ptr InstrumentPitchPanCenter ; 28 + DW Near Ptr InstrumentPitchPanSeparation ; 29 + DW Near Ptr InstrumentPanSwing ; 30 + DW Near Ptr InstrumentPanBoxFiller + DW Near Ptr InstrumentPanCToggle ; 32 + DW Near Ptr FillHeader + DW Near Ptr SetHelpContext7 + DW 0 + +InstrumentPanBoxFiller DW 1 + DB 54, 44 + DB 2 + DB 0FFh, 9, 09Ah, 0 + +InstrumentPanText DW 1 + DB 37, 28 + DB 20h + DB "Panning Envelope", 13 + DB " Carry", 0 + +InstrumentPanToggle DW 17 + DB 54, 28 + DW 4, 182h + DB 1 + DW 10, 32, 4, 4 + +InstrumentPanCToggle DW 17 + DB 54, 29 + DW 4, 182h + DB 8 + DW 17, 18, 4, 4 + +InstrumentPanLToggle DW 17 + DB 54, 32 + DW 4, 182h + DB 2 + DW 32, 19, 4, 4 + +InstrumentPanLBeg DW 13 + DB 54, 33 + DW 0, 184h + DD 0 + DW 18, 20, 4, 4 + +InstrumentPanLEnd DW 13 + DB 54, 34 + DW 0, 185h + DD 0 + DW 19, 21, 4, 4 + +InstrumentPanSLToggle DW 17 + DB 54, 37 + DW 4, 182h + DB 4 + DW 20, 22, 4, 4 + +InstrumentPanSLBeg DW 13 + DB 54, 38 + DW 0, 186h + DD 0 + DW 21, 23, 4, 4 + +InstrumentPanSLEnd DW 13 + DB 54, 39 + DW 0, 187h + DD 0 + DW 22, 26, 4, 4 + +InstrumentDefaultPanBox DW 0 + DB 53, 41, 63, 48 + DB 27 + +InstrumentDefaultPanText DW 1 + DB 33, 42 + DB 20h + DB 0FFh, 9, " Default Pan", 13 + DB 0FFh, 11, " Pan Value", 13, 13 + DB 0FFh, 4, " Pitch-Pan Center", 13 + DB "Pitch-Pan Separation", 13 + DB 0FFh, 11, " Pan swing", 0 + +InstrumentDefaultPanToggle DW 17 + DB 54, 42 + DW 4, 19h + DB 80h + DW 23, 27, 4, 4 + +InstrumentDefaultPanValue DW 9 + DB 54, 43 + DW 0, 64 + DW 6, 19h + DW 26, 28, 4, 4 + DW 0FFFFh, 0FFFFh + +InstrumentPitchPanCenter DW 15 + DD DWord Ptr I_DrawPitchPanCenter + DD DWord Ptr I_PrePitchPanCenter + DD DWord Ptr I_PostPitchPanCenter + +InstrumentPitchPanSeparation DW 9 + DB 54, 46 + DW -32, 32 + DW 6, 16h + DW 28, 30, 4, 4 + DW 0FFFFh, 0FFFFh + +InstrumentPanSwing DW 9 + DB 54, 47 + DW 0, 64 + DW 6, 1Bh + DW 29, 0FFFFh, 4, 4 + DW 0FFFFh, 0FFFFh + +O1_InstrumentListPitch DW 4 + DW Near Ptr IdleInstrumentList + DW Near Ptr InstrumentGlobalKeyList + DW Near Ptr FullScreenBox ; 0 + DW Near Ptr ScreenHeader ; 1 + DW Near Ptr InstrumentListHeader ; 2 + DW Near Ptr InstrumentNameBox ; 3 + DW Near Ptr InstrumentWindow ; 4 + DW Near Ptr VInstrumentGeneralButton ; 5 + DW Near Ptr VInstrumentVolumeButton ; 6 + DW Near Ptr VInstrumentPanningButton ; 7 + DW Near Ptr VInstrumentPitchButton ; 8 + DW Near Ptr InstrumentEnvelopeBox ; 9 + DW Near Ptr InstrumentEnvelope ; 10 + DW Near Ptr InstrumentVEBox ; 11 + DW Near Ptr InstrumentVELBox ; 12 + DW Near Ptr InstrumentVESLBox ; 13 + DW Near Ptr InstrumentPitchText ; 14 + DW Near Ptr InstrumentVELText ; 15 + DW Near Ptr InstrumentVESLText ; 16 + DW Near Ptr InstrumentPitchToggle ; 17 + DW Near Ptr InstrumentPitchLToggle ; 18 + DW Near Ptr InstrumentPitchLBeg ; 19 + DW Near Ptr InstrumentPitchLEnd ; 20 + DW Near Ptr InstrumentPitchSLToggle ; 21 + DW Near Ptr InstrumentPitchSLBeg ; 22 + DW Near Ptr InstrumentPitchSLEnd ; 23 + DW Near Ptr InstrumentMIDIBox1 ; 24 + DW Near Ptr InstrumentMIDIChannel ; 25 + DW Near Ptr InstrumentMIDIProgram ; 26 + DW Near Ptr InstrumentMIDIBank1 ; 27 + DW Near Ptr InstrumentMIDIBank2 ; 28 + DW Near Ptr InstrumentPitchCToggle ; 29 +IF FILTERENVELOPES + DW Near Ptr InstrumentFilterCutoff ; 30 + DW Near Ptr InstrumentFilterResonance ; 31 +ENDIF + DW Near Ptr InstrumentMIDIText + DW Near Ptr FillHeader + DW Near Ptr SetHelpContext7 + DW 0 + +InstrumentMIDIText DW 1 + DB 36, 42 + DB 20h + +IF FILTERENVELOPES + DB "Default Cutoff", 13 + DB "Default Resonance", 13 +ENDIF + DB "MIDI Channel", 13 + DB "MIDI Program", 13 + DB "MIDI Bank Low", 13 + DB "MIDI Bank High", 0 + +InstrumentPitchText DW 1 + DB 35, 28 + DB 20h + DB "Frequency Envelope", 13 + DB " Carry", 0 + +InstrumentPitchToggle DW 17 + DB 54, 28 + DW 4, 1D4h + DB 1 + DW 10, 29, 4, 4 + +InstrumentPitchCToggle DW 17 + DB 54, 29 + DW 4, 1D4h + DB 8 + DW 17, 18, 4, 4 + +InstrumentPitchLToggle DW 17 + DB 54, 32 + DW 4, 1D4h + DB 2 + DW 29, 19, 4, 4 + +InstrumentPitchLBeg DW 13 + DB 54, 33 + DW 0, 1D6h + DD 0 + DW 18, 20, 4, 4 + +InstrumentPitchLEnd DW 13 + DB 54, 34 + DW 0, 1D7h + DD 0 + DW 19, 21, 4, 4 + +InstrumentPitchSLToggle DW 17 + DB 54, 37 + DW 4, 1D4h + DB 4 + DW 20, 22, 4, 4 + +InstrumentPitchSLBeg DW 13 + DB 54, 38 + DW 0, 1D8h + DD 0 + DW 21, 23, 4, 4 + +InstrumentPitchSLEnd DW 13 + DB 54, 39 + DW 0, 1D9h + DD 0 +IF FILTERENVELOPES + DW 22, 30, 4, 4 +ELSE + DW 22, 25, 4, 4 +ENDIF + +InstrumentMIDIChannel DW 14 +IF FILTERENVELOPES + DB 54, 44 +ELSE + DB 54, 42 +ENDIF + DW 0, 17 + DW 6, 3Ch +IF FILTERENVELOPES + DW 30, 26, 4, 4 +ELSE + DW 23, 26, 4, 4 +ENDIF + + DW 0FFFFh, 0FFFFh + DW 16 + +InstrumentFilterCutoff DW 14 + DB 54, 42 + DW 0, 127 + DW 6, 3Ah + DW 23, 31, 4, 4 + DW 0FFFFh, 0FFFFh + DW 16 + +InstrumentFilterResonance DW 14 + DB 54, 43 + DW 0, 127 + DW 6, 3Bh + DW 30, 25, 4, 4 + DW 0FFFFh, 0FFFFh + DW 16 + +InstrumentMIDIProgram DW 14 +IF FILTERENVELOPES + DB 54, 45 +ELSE + DB 54, 43 +ENDIF + DW -1, 127 + DW 6, 3Dh + DW 25, 27, 4, 4 + DW 0FFFFh, 0FFFFh + DW 16 + +InstrumentMIDIBank1 DW 14 +IF FILTERENVELOPES + DB 54, 46 +ELSE + DB 54, 44 +ENDIF + DW -1, 127 + DW 6, 3Eh + DW 26, 28, 4, 4 + DW 0FFFFh, 0FFFFh + DW 16 + +InstrumentMIDIBank2 DW 14 +IF FILTERENVELOPES + DB 54, 47 +ELSE + DB 54, 45 +ENDIF + DW -1, 127 + DW 6, 3Fh + DW 27, 0FFFFh, 4, 4 + DW 0FFFFh, 0FFFFh + DW 16 + +InstrumentListHeader DW 10 + DB "Instrument List (F4)", 0 + +InstrumentNameBox DW 0 + DB 4, 12, 30, 48 + DB 27 + +InstrumentTranslateBox DW 0 + DB 31, 15, 42, 48 + DB 27 + +InstrumentMIDIBox1 DW 0 +IF FILTERENVELOPES + DB 53, 41, 71, 48 +ELSE + DB 53, 41, 71, 46 +ENDIF + DB 27 + +InstrumentWindow DW 15 + DD DWord Ptr I_DrawInstrumentWindow + DD DWord Ptr I_PreInstrumentWindow + DD DWord Ptr I_PostInstrumentWindow + +InstrumentNoteWindow DW 15 + DD DWord Ptr I_DrawNoteWindow + DD DWord Ptr I_PreNoteWindow + DD DWord Ptr I_PostNoteWindow + +InstrumentGlobalKeyList Label +IF ENABLESOLO + DB 1 + DW '`' + DD DWord Ptr Music_ToggleSoloInstrument +ENDIF + + DB 3 ; Ctrl + DW 1C9h + DD DWord Ptr I_SampleUp + + DB 3 ; Ctrl. + DW 1D1h + DD DWord Ptr I_SampleDown + + DB 0 + DW 1C9h + DD DWord Ptr I_SampleUp + + DB 0 + DW 1D1h + DD DWord Ptr I_SampleDown + + DB 1 + DW '<' + DD DWord Ptr I_DecreasePlayChannel + + DB 1 + DW '>' + DD DWord Ptr I_IncreasePlayChannel + + DB 1 + DW ',' + DD DWord Ptr I_DecreasePlayChannel + + DB 1 + DW '.' + DD DWord Ptr I_IncreasePlayChannel + + DB 1 + DW 2000h ; Alt 'D' + DD DWord Ptr I_DeleteInstrument + + DB 1 + DW 1300h ; Alt 'R' + DD DWord Ptr I_ReplaceInstrument + + DB 1 + DW 1F00h ; Alt 'S' + DD DWord Ptr I_SwapInstruments + + DB 1 + DW 1800h ; Alt 'O' + DD DWord Ptr D_SaveInstrument + + DB 1 + DW 1900h ; Alt 'P' + DD DWord Ptr I_CopyInstrument + + DB 1 + DW 1600h ; Alt 'U' + DD DWord Ptr I_UpdateInstrument + + DB 1 ; Alt 'J' + DW 2400h + DD DWord Ptr I_ScaleInstrumentVolumes + + DB 1 + DW 2D00h ; Alt 'X' + DD DWord Ptr I_ExchangeInstruments + + DB 1 + DW 3100h ; Alt 'N' + DD DWord Ptr I_ToggleMultiChannel + + DB 0 + DW 139h + DD DWord Ptr I_InstrumentListSpace + + DB 0 + DW 039h + DD DWord Ptr I_InstrumentListNoteOff + + DB 0 ; Enter... to load sample! + DW 11Ch + DD DWord Ptr Glbl_LoadInstrument + + DB 4 ; Always call function + DW 0 + DD DWord Ptr I_PlayNote + + DB 5 + DW Offset GlobalKeyList + +O1_DisplayList DW 4 + DW Near Ptr InfoPageIdleList + DW Near Ptr GlobalKeyList + DW Near Ptr FullScreenBox ; 0 + DW Near Ptr ScreenHeader ; 1 + DW Near Ptr FillHeader ; 2 + DW Near Ptr DisplayHeader ; 3 + DW Near Ptr DisplayObject ; 4 + DW Near Ptr SetHelpContext9 + DW 0 + +O1_FullDisplayList DW 1 + DW Near Ptr InfoPageIdleList + DW Near Ptr GlobalKeyList + DW Near Ptr FullScreenBox ; 0 + DW Near Ptr DisplayObject ; 1 + DW Near Ptr SetHelpContext9 + DW 0 + +InfoPageIdleList Label DWord + DD DWord Ptr DisplayUpdateScreen + DD 0 + +DisplayHeader DW 10 + DB "Info Page (F5)", 0 + +DisplayObject DW 15 + DD DWord Ptr DrawDisplayData + DD DWord Ptr F_Nothing + DD DWord Ptr PostDisplayData + +O1_ThumbStringList DW 3 + DW Near Ptr IdleFunctionList + DW Near Ptr ESC&ReturnList + DW Near Ptr ThumbBox + DW Near Ptr ThumbInputText + DW Near Ptr ThumbInputBox + DW Near Ptr ThumbInput + DW 0 + +ThumbBox DW 0 + DB 29, 24, 50, 28 + DB 3 + +ThumbInputText DW 1 + DB 32, 26 + DB 23h + DB "Enter Value", 0 + +ThumbInputBox DW 0 + DB 43, 25, 48, 27 + DB 27 + +ThumbInput DW 16 + DB 44, 26 + DW 5, Offset ThumbStringEnter + DW 4 + DD 0 ; No function + DW 0FFFFh, 0FFFFh, 0FFFFh, 0FFFFh + +O1_NewSongList DW 11 + DW Near Ptr IdleFunctionList + DW Near Ptr ESCReturnList + DW Near Ptr NewSongBox ; 0 + DW Near Ptr NewSongText ; 1 + DW Near Ptr NewSongText2 ; 2 + DW Near Ptr KeepPatternButton ; 3 + DW Near Ptr ClearPatternButton ; 4 + DW Near Ptr KeepSampleButton ; 5 + DW Near Ptr ClearSampleButton ; 6 + DW Near Ptr KeepInstrumentButton ; 7 + DW Near Ptr ClearInstrumentButton ; 8 + DW Near Ptr KeepOrderListButton ; 9 + DW Near Ptr ClearOrderListButton ; 10 + DW Near Ptr NewSongOKButton ; 11 + DW Near Ptr NewSongCancelButton ; 12 + + DW 0 + +NewSongBox DW 0 + DB 21, 20, 58, 38 + DB 3 + +NewSongText DW 1 + DB 36, 21 + DB 23h + DB "New Song", 0 + +NewSongText2 DW 1 + DB 23, 24 + DB 20h + DB " Patterns", 13 + DB 13 + DB 13 + DB 0FFh, 4, " Samples", 13 + DB 13 + DB 13 + DB "Instruments", 13 + DB 13 + DB 13 + DB " Order List", 0 + +KeepPatternButton DW 2 + DW 0FFFFh, 5, 4, 4 + DW 2 + DW 3, 4 + DW 3 ; Set var! + DW 3, 0 + DW 0, 0, 0 + DB 34, 23, 43, 25 + DB 8 + DB 0 + DB " Keep", 0 + +ClearPatternButton DW 2 + DW 4, 6, 3, 3 + DW 2 + DW 3, 4 + DW 3 + DW 3, 1 ; Clear pattern flag + DW 0, 0, 0 + DB 44, 23, 54, 25 + DB 8 + DB 3 ; Default to down + DB " Clear", 0 + +KeepSampleButton DW 2 + DW 3, 7, 6, 6 + DW 2 + DW 5, 6 + DW 3 ; Set var! + DW 4, 0 + DW 0, 0, 0 + DB 34, 26, 43, 28 + DB 8 + DB 0 + DB " Keep", 0 + +ClearSampleButton DW 2 + DW 4, 8, 5, 5 + DW 2 + DW 5, 6 + DW 3 + DW 4, 1 ; Clear pattern flag + DW 0, 0, 0 + DB 44, 26, 54, 28 + DB 8 + DB 3 ; Default to down + DB " Clear", 0 + +KeepInstrumentButton DW 2 + DW 5, 9, 8, 8 + DW 2 + DW 7, 8 + DW 3 ; Set var! + DW 5, 0 + DW 0, 0, 0 + DB 34, 29, 43, 31 + DB 8 + DB 0 + DB " Keep", 0 + +ClearInstrumentButton DW 2 + DW 6, 10, 7, 7 + DW 2 + DW 7, 8 + DW 3 + DW 5, 1 ; Clear pattern flag + DW 0, 0, 0 + DB 44, 29, 54, 31 + DB 8 + DB 3 ; Default to down + DB " Clear", 0 + +KeepOrderListButton DW 2 + DW 7, 11, 10, 10 + DW 2 + DW 9, 10 + DW 3 ; Set var! + DW 6, 0 + DW 0, 0, 0 + DB 34, 32, 43, 34 + DB 8 + DB 0 + DB " Keep", 0 + +ClearOrderListButton DW 2 + DW 8, 12, 9, 9 + DW 2 + DW 9, 10 + DW 3 + DW 6, 1 ; Clear pattern flag + DW 0, 0, 0 + DB 44, 32, 54, 34 + DB 8 + DB 3 ; Default to down + DB " Clear", 0 + +NewSongOKButton DW 2 + DW 9, 0FFFFh, 12, 12 + DW 0 ; Press. + DW 0, 0 + DW 0 ; Return value. + DW 1 ; Return OK. + DW 0, 0, 0, 0 + DB 27, 35, 38, 37 + DB 8 + DB 0 + DB " OK", 0 + +NewSongCancelButton DW 2 + DW 9, 0FFFFh, 11, 11 + DW 0 + DW 0, 0 + DW 0 + DW 0 + DW 0, 0, 0, 0 + DB 40, 35, 51, 37 + DB 8 + DB 0 + DB " Cancel", 0 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +O1_MainMenu DW 3 + DW Near Ptr IdleFunctionList + DW Near Ptr ESCReturnList + DW Near Ptr MainMenuBox1 ; 0 + DW Near Ptr MainMenuBox2 ; 1 + DW Near Ptr MainMenuText ; 2 + DW Near Ptr MainMenuFile ; 3 + DW Near Ptr MainMenuPlayBack ; 4 + DW Near Ptr MainMenuViewPatterns ; 5 + DW Near Ptr MainMenuViewSamples ; 6 + DW Near Ptr MainMenuViewInstruments; 7 + DW Near Ptr MainMenuViewOrderPan ; 8 + DW Near Ptr MainMenuViewVariables ; 9 + DW Near Ptr MainMenuMessage + DW Near Ptr MainMenuHelp ; 11 + + DW 0 + +MainMenuBox1 DW 0 + DB 6, 14, 38, 46 + DB 3 + +MainMenuBox2 DW 0 + DB 7, 15, 37, 45 + DB 0 + +MainMenuText DW 1 + DB 12, 16 + DB 23h + DB "Main Menu", 0 + +MainMenuFile DW 2 + DW 0FFFFh, 4, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 2 + DD DWord Ptr F_FileMenu + DW 0, 0, 0 + DB 8, 18, 36, 20 + DB 28 + DB 0 + DB " File Menu...", 0 + +MainMenuPlayBack DW 2 + DW 3, 5, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 2 + DD DWord Ptr F_PlayBackMenu + DW 0, 0, 0 + DB 8, 21, 36, 23 + DB 28 + DB 0 + DB " Playback Menu...", 0 + +MainMenuViewPatterns DW 2 + DW 4, 6, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 4 ; Jump to function + DD DWord Ptr F_ViewPattern + DW 0, 0, 0 + DB 8, 24, 36, 26 + DB 28 + DB 0 + DB " View Patterns (F2)", 0 + +MainMenuViewSamples DW 2 + DW 5, 7, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 2 + DD DWord Ptr F_SampleMenu + DW 0, 0, 0 + DB 8, 27, 36, 29 + DB 28 + DB 0 + DB " Sample Menu...", 0 + +MainMenuViewInstruments DW 2 + DW 6, 8, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 2 + DD DWord Ptr F_InstrumentMenu + DW 0, 0, 0 + DB 8, 30, 36, 32 + DB 28 + DB 0 + DB " Instrument Menu...", 0 + +MainMenuViewOrderPan DW 2 + DW 7, 9, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 4 + DD DWord Ptr F_ViewOrderPan + DW 0, 0, 0 + DB 8, 33, 36, 35 + DB 28 + DB 0 + DB " View Orders/Panning (F11)", 0 + +MainMenuViewVariables DW 2 + DW 8, 10, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 4 + DD DWord Ptr F_ViewVariables + DW 0, 0, 0 + DB 8, 36, 36, 38 + DB 28 + DB 0 + DB " View Variables (F12)", 0 + +MainMenuMessage DW 2 + DW 9, 11, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 4 + DD DWord Ptr F_MessageEditor + DW 0, 0, 0 + DB 8, 39, 36, 41 + DB 28 + DB 0 + DB " Message Editor (Shift-F9)", 0 + +MainMenuHelp DW 2 + DW 10, 0FFFFh, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 4 + DD DWord Ptr F_Help + DW 0, 0, 0 + DB 8, 42, 36, 44 + DB 28 + DB 0 + DB " Help! (F1)", 0 + +O1_FileMenu DW 3 + DW Near Ptr IdleFunctionList + DW Near Ptr ESCReturnList + DW Near Ptr FileBox1 ; 0 + DW Near Ptr FileBox2 ; 1 + DW Near Ptr FileMenuText ; 2 + DW Near Ptr FileLoad ; 3 + DW Near Ptr FileNew + DW Near Ptr FileSaveCurrent + DW Near Ptr FileSaveAs + DW Near Ptr FileDOSShell + DW Near Ptr FileQuit + DW 0 + +FileBox1 DW 0 + DB 25, 16, 54, 39 + DB 1 + +FileBox2 DW 0 + DB 26, 17, 53, 38 + DB 0 + +FileMenuText DW 1 + DB 30, 18 + DB 23h + DB "File Menu", 0 + +FileLoad DW 2 + DW 0FFFFh, 4, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 4 + DD DWord Ptr F_FileLoad + DW 0, 0, 0 + DB 27, 20, 52, 22 + DB 28 + DB 0 + DB " Load... (F9)", 0 + +FileNew DW 2 + DW 3, 5, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 4 + DD DWord Ptr F_FileNew + DW 0, 0, 0 + DB 27, 23, 52, 25 + DB 28 + DB 0 + DB " New... (Ctrl-N)", 0 + +FileSaveCurrent DW 2 + DW 4, 6, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 4 + DD DWord Ptr F_FileSaveCurrent + DW 0, 0, 0 + DB 27, 26, 52, 28 + DB 28 + DB 0 + DB " Save Current (Ctrl-S)", 0 + +FileSaveAs DW 2 + DW 5, 7, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 4 + DD DWord Ptr F_FileSaveAs + DW 0, 0, 0 + DB 27, 29, 52, 31 + DB 28 + DB 0 + DB " Save As... (F10)", 0 + +FileDOSShell DW 2 + DW 6, 8, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 4 + DD DWord Ptr F_FileDOSShell + DW 0, 0, 0 + DB 27, 32, 52, 34 + DB 28 + DB 0 + DB " Shell to DOS (Ctrl-D)", 0 + +FileQuit DW 2 + DW 7, 0FFFFh, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 4 + DD DWord Ptr F_FileQuit + DW 0, 0, 0 + DB 27, 35, 52, 37 + DB 28 + DB 0 + DB " Quit (Ctrl-Q)", 0 + +O1_PlayBackMenu DW 3 + DW Near Ptr IdleFunctionList + DW Near Ptr ESCReturnList + DW Near Ptr PlayBackBox1 ; 0 + DW Near Ptr PlayBackBox2 ; 1 + DW Near Ptr PlayBackText ; 2 + DW Near Ptr PlayBackShowInfoPage ; 3 + DW Near Ptr PlayBackSong ; 4 + DW Near Ptr PlayBackPattern ; 5 + DW Near Ptr PlayBackOrder ; 6 + DW Near Ptr PlayBackMark ; 7 + DW Near Ptr PlayBackStop ; 8 + DW Near Ptr PlayBackReinit ; 9 + DW Near Ptr PlayBackDriverScreen ; 10 + DW Near Ptr PlayBackCalculateLength ; 11 + DW 0 + +PlayBackBox1 DW 0 + DB 25, 16, 59, 48 + DB 1 + +PlayBackBox2 DW 0 + DB 26, 17, 58, 47 + DB 0 + +PlayBackText DW 1 + DB 31, 18 + DB 23h + DB "Playback Menu", 0 + +PlayBackShowInfoPage DW 2 + DW 0FFFFh, 4, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 4 + DD DWord Ptr F_InfoPage + DW 0, 0, 0 + DB 27, 20, 57, 22 + DB 28 + DB 0 + DB " Show Infopage (F5)", 0 + +PlayBackSong DW 2 + DW 3, 5, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 4 + DD DWord Ptr F_PlaySong + DW 0, 0, 0 + DB 27, 23, 57, 25 + DB 28 + DB 0 + DB " Play Song (Ctrl-F5)", 0 + +PlayBackPattern DW 2 + DW 4, 6, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 4 + DD DWord Ptr F_PlayPattern + DW 0, 0, 0 + DB 27, 26, 57, 28 + DB 28 + DB 0 + DB " Play Pattern (F6)", 0 + +PlayBackOrder DW 2 + DW 5, 7, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 4 + DD DWord Ptr F_PlayOrder + DW 0, 0, 0 + DB 27, 29, 57, 31 + DB 28 + DB 0 + DB " Play from Order (Shift-F6)", 0 + +PlayBackMark DW 2 + DW 6, 8, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 4 + DD DWord Ptr F_PlayMark + DW 0, 0, 0 + DB 27, 32, 57, 34 + DB 28 + DB 0 + DB " Play from Mark/Cursor (F7)", 0 + +PlayBackStop DW 2 + DW 7, 9, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 4 + DD DWord Ptr F_Stop + DW 0, 0, 0 + DB 27, 35, 57, 37 + DB 28 + DB 0 + DB " Stop (F8)", 0 + +PlayBackReinit DW 2 + DW 8, 10, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 4 + DD DWord Ptr F_ReinitSoundCard + DW 0, 0, 0 + DB 27, 38, 57, 40 + DB 28 + DB 0 + DB " Reinit Soundcard (Ctrl-I)", 0 + +PlayBackDriverScreen DW 2 + DW 9, 11, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 4 + DD DWord Ptr F_DriverScreen + DW 0, 0, 0 + DB 27, 41, 57, 43 + DB 28 + DB 0 + DB " Driver Screen (Shift-F5)", 0 + +PlayBackCalculateLength DW 2 + DW 10, 0FFFFh, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 4 + DD DWord Ptr F_CalculateLength + DW 0, 0, 0 + DB 27, 44, 57, 46 + DB 28 + DB 0 + DB " Calculate Length (Ctrl-P)", 0 + + +O1_SampleMenu DW 3 + DW Near Ptr IdleFunctionList + DW Near Ptr ESCReturnList + DW Near Ptr SampleBox1 ; 0 + DW Near Ptr SampleBox2 ; 1 + DW Near Ptr SampleText ; 2 + DW Near Ptr SampleMenuList ; 3 + DW Near Ptr SampleLibrary ; 4 + DW Near Ptr ReloadGravis ; 5 + + DW 0 + +SampleBox1 DW 0 + DB 25, 23, 57, 37 + DB 1 + + +SampleBox2 DW 0 + DB 26, 24, 56, 36 + DB 0 + +SampleText DW 1 + DB 30, 25 + DB 23h + DB "Sample Menu", 0 + +SampleMenuList DW 2 + DW 0FFFFh, 4, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 4 + DD DWord Ptr F_SampleList + DW 0, 0, 0 + DB 27, 27, 55, 29 + DB 28 + DB 0 + DB " Sample List (F3)", 0 + +SampleLibrary DW 2 + DW 3, 5, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 4 + DD DWord Ptr F_SampleLibrary + DW 0, 0, 0 + DB 27, 30, 55, 32 + DB 28 + DB 0 + DB " Sample Library (Ctrl-F3)", 0 + +ReloadGravis DW 2 + DW 4, 0FFFFh, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 4 + DD DWord Ptr F_ReloadGravis + DW 0, 0, 0 + DB 27, 33, 55, 35 + DB 28 + DB 0 + DB " Reload Soundcard (Ctrl-G)", 0 + +O1_InstrumentMenu DW 3 + DW Near Ptr IdleFunctionList + DW Near Ptr ESCReturnList + DW Near Ptr InstrumentBox1 ; 0 + DW Near Ptr InstrumentBox2 ; 1 + DW Near Ptr InstrumentText ; 2 + DW Near Ptr InstrumentMenuList ; 3 + DW Near Ptr InstrumentLibrary ; 4 + DW 0 + +InstrumentBox1 DW 0 + DB 20, 23, 56, 34 + DB 1 + + +InstrumentBox2 DW 0 + DB 21, 24, 55, 33 + DB 0 + +InstrumentText DW 1 + DB 25, 25 + DB 23h + DB "Instrument Menu", 0 + +InstrumentMenuList DW 2 + DW 0FFFFh, 4, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 4 + DD DWord Ptr F_InstrumentList + DW 0, 0, 0 + DB 22, 27, 54, 29 + DB 28 + DB 0 + DB " Instrument List (F4)", 0 + +InstrumentLibrary DW 2 + DW 3, 0FFFFh, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 4 + DD DWord Ptr F_InstrumentLibrary + DW 0, 0, 0 + DB 22, 30, 54, 32 + DB 28 + DB 0 + DB " Instrument Library (Ctrl-F4)", 0 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +O1_EditSampleName DW 3 + DW IdleFunctionList + DW ESCReturnList + DW EditSampleNameBox ; 0 + DW EditSampleNameText ; 1 + DW EditSampleNameInputBox ; 2 + DW EditSampleNameInput ;3 + DW 0 + +EditSampleNameBox DW 0 + DB 23, 25, 56, 31 + DB 3 + +EditSampleNameText DW 1 + DB 32, 26 + DB 23h + DB "Edit Sample Name", 0 + +EditSampleNameInputBox DW 0 + DB 26, 28, 53, 30 + DB 27 + +EditSampleNameInput DW 16 + DB 27, 29 + DW 0, Offset SampleName + DW 26 + DD DWord Ptr F_Return1 + DW 0FFFFh, 0FFFFh, 0FFFFh, 0FFFFh + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +IF MEMORYDEBUG + +O1_DebugList DW 5 + DW Near Ptr IdleDebugFunctionList + DW Near Ptr DebugKeyList + DW Near Ptr FullScreenBox + DW Near Ptr ScreenHeader + DW Near Ptr DebugBox + DW Near Ptr DebugText + DW Near Ptr DebugInputBox + DW Near Ptr DebugAddressInput + DW Near Ptr DebugInfo + DW Near Ptr FillHeader + DW Near Ptr DebugHeader + DW 0 + + +DebugInfo DW 8 +IdleDebugFunctionList DD DWord Ptr F_DrawDebug + DD DWord Ptr IdleUpdateInfoLine + DD 0 + +DebugKeyList Label + DB 4 + DW 0 + DD DWord Ptr F_PostDebug + + DB 0 + DW 1C8h + DD DWord Ptr F_DebugUp + + DB 0 + DW 1D0h + DD DWord Ptr F_DebugDown + + DB 0 + DW 1C9h + DD DWord Ptr F_DebugPgUp + + DB 0 + DW 1D1h + DD DWord Ptr F_DebugPgDn + + DB 5 + DW Offset GlobalKeyList + + +DebugBox DW 0 + DB 1, 14, 78, 45 + DB 27 + +DebugText DW 1 + DB 4, 47 + DB 20h + DB "Address", 0 + +DebugInputBox DW 0 + DB 11, 46, 30, 48 + DB 25 + +DebugAddressInput DW 16 + DB 12, 47 + DW 5, Offset AddressInput + DW 18 + DD DWord Ptr F_DebugStringInput + DW 0FFFFh, 0FFFFh, 0FFFFh, 0FFFFh + +DebugHeader DW 10 + DB "Debug", 0 + +ENDIF + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +O1_ConfigurePaletteList DW 53 + DW IdleFunctionList + DW GlobalKeyList + DW Near Ptr FullScreenBox ; 0 + DW Near Ptr ScreenHeader ; 1 + DW Near Ptr FillHeader ; 2 + DW Near Ptr ConfigurePaletteHeader ; 3 + DW Near Ptr SetHelpContext10 + DW Near Ptr PaletteColourBorder1 + DW Near Ptr PaletteColourBorder2 + DW Near Ptr PaletteColourBorder3 + DW Near Ptr PaletteColourBorder4 + DW Near Ptr PaletteColourBorder5 + DW Near Ptr PaletteColourBorder6 ; 10 + DW Near Ptr PaletteColourBorder7 + DW Near Ptr PaletteColourBorder8 + DW Near Ptr PaletteColourBorder9 + DW Near Ptr PaletteColourBorder10 + DW Near Ptr PaletteColourBorder11 + DW Near Ptr PaletteColourBorder12 + DW Near Ptr PaletteColourBorder13 + DW Near Ptr PaletteColourBorder14 + DW Near Ptr PaletteColourBorder15 + DW Near Ptr PaletteColourBorder16 ; 20 + DW Near Ptr PaletteColourBox1 + DW Near Ptr PaletteColourBox2 + DW Near Ptr PaletteColourBox3 + DW Near Ptr PaletteColourBox4 + DW Near Ptr PaletteColourBox5 + DW Near Ptr PaletteColourBox6 + DW Near Ptr PaletteColourBox7 + DW Near Ptr PaletteColourBox8 + DW Near Ptr PaletteColourBox9 + DW Near Ptr PaletteColourBox10 ; 30 + DW Near Ptr PaletteColourBox11 + DW Near Ptr PaletteColourBox12 + DW Near Ptr PaletteColourBox13 + DW Near Ptr PaletteColourBox14 + DW Near Ptr PaletteColourBox15 + DW Near Ptr PaletteColourBox16 + DW Near Ptr PaletteInputBox1 + DW Near Ptr PaletteInputBox2 + DW Near Ptr PaletteInputBox3 + DW Near Ptr PaletteInputBox4 ; 40 + DW Near Ptr PaletteInputBox5 + DW Near Ptr PaletteInputBox6 + DW Near Ptr PaletteInputBox7 + DW Near Ptr PaletteInputBox8 + DW Near Ptr PaletteInputBox9 + DW Near Ptr PaletteInputBox10 + DW Near Ptr PaletteInputBox11 + DW Near Ptr PaletteInputBox12 + DW Near Ptr PaletteInputBox13 + DW Near Ptr PaletteInputBox14 ; 50 + DW Near Ptr PaletteInputBox15 + DW Near Ptr PaletteInputBox16 + DW Near Ptr Colour0RedInput ; 53 + DW Near Ptr Colour0GreenInput + DW Near Ptr Colour0BlueInput + DW Near Ptr Colour1RedInput ; 56 + DW Near Ptr Colour1GreenInput + DW Near Ptr Colour1BlueInput + DW Near Ptr Colour2RedInput + DW Near Ptr Colour2GreenInput ; 60 + DW Near Ptr Colour2BlueInput + DW Near Ptr Colour3RedInput + DW Near Ptr Colour3GreenInput + DW Near Ptr Colour3BlueInput + DW Near Ptr Colour4RedInput + DW Near Ptr Colour4GreenInput + DW Near Ptr Colour4BlueInput + DW Near Ptr Colour5RedInput + DW Near Ptr Colour5GreenInput + DW Near Ptr Colour5BlueInput ; 70 + DW Near Ptr Colour6RedInput + DW Near Ptr Colour6GreenInput + DW Near Ptr Colour6BlueInput + DW Near Ptr Colour7RedInput ; 74 + DW Near Ptr Colour7GreenInput + DW Near Ptr Colour7BlueInput + DW Near Ptr Colour8RedInput + DW Near Ptr Colour8GreenInput + DW Near Ptr Colour8BlueInput + DW Near Ptr Colour9RedInput ; 80 + DW Near Ptr Colour9GreenInput + DW Near Ptr Colour9BlueInput + DW Near Ptr Colour10RedInput + DW Near Ptr Colour10GreenInput + DW Near Ptr Colour10BlueInput + DW Near Ptr Colour11RedInput + DW Near Ptr Colour11GreenInput + DW Near Ptr Colour11BlueInput + DW Near Ptr Colour12RedInput + DW Near Ptr Colour12GreenInput ; 90 + DW Near Ptr Colour12BlueInput + DW Near Ptr Colour13RedInput + DW Near Ptr Colour13GreenInput + DW Near Ptr Colour13BlueInput + DW Near Ptr Colour14RedInput + DW Near Ptr Colour14GreenInput + DW Near Ptr Colour14BlueInput + DW Near Ptr Colour15RedInput + DW Near Ptr Colour15GreenInput + DW Near Ptr Colour15BlueInput ; 100 + DW Near Ptr PredefinedPaletteMsg + DW Near Ptr PredefinedPalette1 + DW Near Ptr PredefinedPalette2 + DW Near Ptr PredefinedPalette3 + DW Near Ptr PredefinedPalette4 + DW Near Ptr PredefinedPalette5 + DW Near Ptr PredefinedPalette6 + DW Near Ptr PredefinedPalette7 + DW 0 + +ConfigurePaletteHeader DW 10 + DB "Palette Configuration (Ctrl-F12)", 0 + +PaletteColourBorder1 DW 0 + DB 2, 13, 8, 17 + DB 11 + +PaletteColourBorder2 DW 0 + DB 2, 18, 8, 22 + DB 11 + +PaletteColourBorder3 DW 0 + DB 2, 23, 8, 27 + DB 11 + +PaletteColourBorder4 DW 0 + DB 2, 28, 8, 32 + DB 11 + +PaletteColourBorder5 DW 0 + DB 2, 33, 8, 37 + DB 11 + +PaletteColourBorder6 DW 0 + DB 2, 38, 8, 42 + DB 11 + +PaletteColourBorder7 DW 0 + DB 2, 43, 8, 47 + DB 11 + +PaletteColourBorder8 DW 0 + DB 29, 13, 35, 17 + DB 11 + +PaletteColourBorder9 DW 0 + DB 29, 18, 35, 22 + DB 11 + +PaletteColourBorder10 DW 0 + DB 29, 23, 35, 27 + DB 11 + +PaletteColourBorder11 DW 0 + DB 29, 28, 35, 32 + DB 11 + +PaletteColourBorder12 DW 0 + DB 29, 33, 35, 37 + DB 11 + +PaletteColourBorder13 DW 0 + DB 29, 38, 35, 42 + DB 11 + +PaletteColourBorder14 DW 0 + DB 29, 43, 35, 47 + DB 11 + +PaletteColourBorder15 DW 0 + DB 56, 13, 62, 17 + DB 11 + +PaletteColourBorder16 DW 0 + DB 56, 18, 62, 22 + DB 11 + +PaletteColourBox1 DW 1 + DB 3, 14 + DB 00h + DB 0FFh, 5, " ", 13 + DB 0FFh, 5, " ", 13 + DB 0FFh, 5, " ", 0 + +PaletteColourBox2 DW 1 + DB 3, 19 + DB 10h + DB 0FFh, 5, " ", 13 + DB 0FFh, 5, " ", 13 + DB 0FFh, 5, " ", 0 + +PaletteColourBox3 DW 1 + DB 3, 24 + DB 20h + DB 0FFh, 5, " ", 13 + DB 0FFh, 5, " ", 13 + DB 0FFh, 5, " ", 0 + +PaletteColourBox4 DW 1 + DB 3, 29 + DB 30h + DB 0FFh, 5, " ", 13 + DB 0FFh, 5, " ", 13 + DB 0FFh, 5, " ", 0 + +PaletteColourBox5 DW 1 + DB 3, 34 + DB 40h + DB 0FFh, 5, " ", 13 + DB 0FFh, 5, " ", 13 + DB 0FFh, 5, " ", 0 + +PaletteColourBox6 DW 1 + DB 3, 39 + DB 50h + DB 0FFh, 5, " ", 13 + DB 0FFh, 5, " ", 13 + DB 0FFh, 5, " ", 0 + +PaletteColourBox7 DW 1 + DB 3, 44 + DB 60h + DB 0FFh, 5, " ", 13 + DB 0FFh, 5, " ", 13 + DB 0FFh, 5, " ", 0 + +PaletteColourBox8 DW 1 + DB 30, 14 + DB 70h + DB 0FFh, 5, " ", 13 + DB 0FFh, 5, " ", 13 + DB 0FFh, 5, " ", 0 + +PaletteColourBox9 DW 1 + DB 30, 19 + DB 80h + DB 0FFh, 5, " ", 13 + DB 0FFh, 5, " ", 13 + DB 0FFh, 5, " ", 0 + +PaletteColourBox10 DW 1 + DB 30, 24 + DB 90h + DB 0FFh, 5, " ", 13 + DB 0FFh, 5, " ", 13 + DB 0FFh, 5, " ", 0 + +PaletteColourBox11 DW 1 + DB 30, 29 + DB 0A0h + DB 0FFh, 5, " ", 13 + DB 0FFh, 5, " ", 13 + DB 0FFh, 5, " ", 0 + +PaletteColourBox12 DW 1 + DB 30, 34 + DB 0B0h + DB 0FFh, 5, " ", 13 + DB 0FFh, 5, " ", 13 + DB 0FFh, 5, " ", 0 + +PaletteColourBox13 DW 1 + DB 30, 39 + DB 0C0h + DB 0FFh, 5, " ", 13 + DB 0FFh, 5, " ", 13 + DB 0FFh, 5, " ", 0 + +PaletteColourBox14 DW 1 + DB 30, 44 + DB 0D0h + DB 0FFh, 5, " ", 13 + DB 0FFh, 5, " ", 13 + DB 0FFh, 5, " ", 0 + +PaletteColourBox15 DW 1 + DB 57, 14 + DB 0E0h + DB 0FFh, 5, " ", 13 + DB 0FFh, 5, " ", 13 + DB 0FFh, 5, " ", 0 + +PaletteColourBox16 DW 1 + DB 57, 19 + DB 0F0h + DB 0FFh, 5, " ", 13 + DB 0FFh, 5, " ", 13 + DB 0FFh, 5, " ", 0 + +PaletteInputBox1 DW 0 + DB 9, 13, 19, 17 + DB 27 + +PaletteInputBox2 DW 0 + DB 9, 18, 19, 22 + DB 27 + +PaletteInputBox3 DW 0 + DB 9, 23, 19, 27 + DB 27 + +PaletteInputBox4 DW 0 + DB 9, 28, 19, 32 + DB 27 + +PaletteInputBox5 DW 0 + DB 9, 33, 19, 37 + DB 27 + +PaletteInputBox6 DW 0 + DB 9, 38, 19, 42 + DB 27 + +PaletteInputBox7 DW 0 + DB 9, 43, 19, 47 + DB 27 + +PaletteInputBox8 DW 0 + DB 36, 13, 46, 17 + DB 27 + +PaletteInputBox9 DW 0 + DB 36, 18, 46, 22 + DB 27 + +PaletteInputBox10 DW 0 + DB 36, 23, 46, 27 + DB 27 + +PaletteInputBox11 DW 0 + DB 36, 28, 46, 32 + DB 27 + +PaletteInputBox12 DW 0 + DB 36, 33, 46, 37 + DB 27 + +PaletteInputBox13 DW 0 + DB 36, 38, 46, 42 + DB 27 + +PaletteInputBox14 DW 0 + DB 36, 43, 46, 47 + DB 27 + +PaletteInputBox15 DW 0 + DB 63, 13, 73, 17 + DB 27 + +PaletteInputBox16 DW 0 + DB 63, 18, 73, 22 + DB 27 + +Colour0RedInput DW 9 + DB 10, 14 + DW 0, 63 + DW 7, Offset PaletteDefs + DW 0FFFFh, 54, 74, 95, 0FFFFh, 56 + +Colour0GreenInput DW 9 + DB 10, 15 + DW 0, 63 + DW 7, Offset PaletteDefs+1 + DW 53, 55, 75, 96, 0FFFFh, 57 + +Colour0BlueInput DW 9 + DB 10, 16 + DW 0, 63 + DW 7, Offset PaletteDefs+2 + DW 54, 56, 76, 97, 0FFFFh, 58 + +Colour1RedInput DW 9 + DB 10, 19 + DW 0, 63 + DW 7, Offset PaletteDefs+3 + DW 55, 57, 77, 98, 53, 59 + +Colour1GreenInput DW 9 + DB 10, 20 + DW 0, 63 + DW 7, Offset PaletteDefs+4 + DW 56, 58, 78, 99, 54, 60 + +Colour1BlueInput DW 9 + DB 10, 21 + DW 0, 63 + DW 7, Offset PaletteDefs+5 + DW 57, 59, 79, 100, 55, 61 + +Colour2RedInput DW 9 + DB 10, 24 + DW 0, 63 + DW 7, Offset PaletteDefs+6 + DW 58, 60, 80, 0FFFFh, 56, 62 + +Colour2GreenInput DW 9 + DB 10, 25 + DW 0, 63 + DW 7, Offset PaletteDefs+7 + DW 59, 61, 81, 0FFFFh, 57, 63 + +Colour2BlueInput DW 9 + DB 10, 26 + DW 0, 63 + DW 7, Offset PaletteDefs+8 + DW 60, 62, 82, 0FFFFh, 58, 64 + +Colour3RedInput DW 9 + DB 10, 29 + DW 0, 63 + DW 7, Offset PaletteDefs+9 + DW 61, 63, 83, 0FFFFh, 59, 65 + +Colour3GreenInput DW 9 + DB 10, 30 + DW 0, 63 + DW 7, Offset PaletteDefs+10 + DW 62, 64, 84, 0FFFFh, 60, 66 + +Colour3BlueInput DW 9 + DB 10, 31 + DW 0, 63 + DW 7, Offset PaletteDefs+11 + DW 63, 65, 85, 0FFFFh, 61, 67 + +Colour4RedInput DW 9 + DB 10, 34 + DW 0, 63 + DW 7, Offset PaletteDefs+12 + DW 64, 66, 86, 0FFFFh, 62, 68 + +Colour4GreenInput DW 9 + DB 10, 35 + DW 0, 63 + DW 7, Offset PaletteDefs+13 + DW 65, 67, 87, 0FFFFh, 63, 69 + +Colour4BlueInput DW 9 + DB 10, 36 + DW 0, 63 + DW 7, Offset PaletteDefs+14 + DW 66, 68, 88, 0FFFFh, 64, 70 + +Colour5RedInput DW 9 + DB 10, 39 + DW 0, 63 + DW 7, Offset PaletteDefs+15 + DW 67, 69, 89, 0FFFFh, 65, 71 + +Colour5GreenInput DW 9 + DB 10, 40 + DW 0, 63 + DW 7, Offset PaletteDefs+16 + DW 68, 70, 90, 0FFFFh, 66, 72 + +Colour5BlueInput DW 9 + DB 10, 41 + DW 0, 63 + DW 7, Offset PaletteDefs+17 + DW 69, 71, 91, 0FFFFh, 67, 73 + +Colour6RedInput DW 9 + DB 10, 44 + DW 0, 63 + DW 7, Offset PaletteDefs+18 + DW 70, 72, 92, 0FFFFh, 68, 74 + +Colour6GreenInput DW 9 + DB 10, 45 + DW 0, 63 + DW 7, Offset PaletteDefs+19 + DW 71, 73, 93, 0FFFFh, 69, 75 + +Colour6BlueInput DW 9 + DB 10, 46 + DW 0, 63 + DW 7, Offset PaletteDefs+20 + DW 72, 74, 94, 0FFFFh, 70, 76 + +Colour7RedInput DW 9 + DB 37, 14 + DW 0, 63 + DW 7, Offset PaletteDefs+21 + DW 73, 75, 95, 53, 71, 77 + +Colour7GreenInput DW 9 + DB 37, 15 + DW 0, 63 + DW 7, Offset PaletteDefs+22 + DW 74, 76, 96, 54, 72, 78 + +Colour7BlueInput DW 9 + DB 37, 16 + DW 0, 63 + DW 7, Offset PaletteDefs+23 + DW 75, 77, 97, 55, 73, 79 + +Colour8RedInput DW 9 + DB 37, 19 + DW 0, 63 + DW 7, Offset PaletteDefs+24 + DW 76, 78, 98, 56, 74, 80 + +Colour8GreenInput DW 9 + DB 37, 20 + DW 0, 63 + DW 7, Offset PaletteDefs+25 + DW 77, 79, 99, 57, 75, 81 + +Colour8BlueInput DW 9 + DB 37, 21 + DW 0, 63 + DW 7, Offset PaletteDefs+26 + DW 78, 80, 100, 58, 76, 82 + +Colour9RedInput DW 9 + DB 37, 24 + DW 0, 63 + DW 7, Offset PaletteDefs+27 + DW 79, 81, 102, 59, 77, 83 + +Colour9GreenInput DW 9 + DB 37, 25 + DW 0, 63 + DW 7, Offset PaletteDefs+28 + DW 80, 82, 102, 60, 78, 84 + +Colour9BlueInput DW 9 + DB 37, 26 + DW 0, 63 + DW 7, Offset PaletteDefs+29 + DW 81, 83, 102, 61, 79, 85 + +Colour10RedInput DW 9 + DB 37, 29 + DW 0, 63 + DW 7, Offset PaletteDefs+30 + DW 82, 84, 102, 62, 80, 86 + +Colour10GreenInput DW 9 + DB 37, 30 + DW 0, 63 + DW 7, Offset PaletteDefs+31 + DW 83, 85, 102, 63, 81, 87 + +Colour10BlueInput DW 9 + DB 37, 31 + DW 0, 63 + DW 7, Offset PaletteDefs+32 + DW 84, 86, 102, 64, 82, 88 + +Colour11RedInput DW 9 + DB 37, 34 + DW 0, 63 + DW 7, Offset PaletteDefs+33 + DW 85, 87, 102, 65, 83, 89 + +Colour11GreenInput DW 9 + DB 37, 35 + DW 0, 63 + DW 7, Offset PaletteDefs+34 + DW 86, 88, 102, 66, 84, 90 + +Colour11BlueInput DW 9 + DB 37, 36 + DW 0, 63 + DW 7, Offset PaletteDefs+35 + DW 87, 89, 102, 67, 85, 91 + +Colour12RedInput DW 9 + DB 37, 39 + DW 0, 63 + DW 7, Offset PaletteDefs+36 + DW 88, 90, 102, 68, 86, 92 + +Colour12GreenInput DW 9 + DB 37, 40 + DW 0, 63 + DW 7, Offset PaletteDefs+37 + DW 89, 91, 102, 69, 87, 93 + +Colour12BlueInput DW 9 + DB 37, 41 + DW 0, 63 + DW 7, Offset PaletteDefs+38 + DW 90, 92, 102, 70, 88, 94 + +Colour13RedInput DW 9 + DB 37, 44 + DW 0, 63 + DW 7, Offset PaletteDefs+39 + DW 91, 93, 102, 71, 89, 95 + +Colour13GreenInput DW 9 + DB 37, 45 + DW 0, 63 + DW 7, Offset PaletteDefs+40 + DW 92, 94, 102, 72, 90, 96 + +Colour13BlueInput DW 9 + DB 37, 46 + DW 0, 63 + DW 7, Offset PaletteDefs+41 + DW 93, 95, 102, 73, 91, 97 + +Colour14RedInput DW 9 + DB 64, 14 + DW 0, 63 + DW 7, Offset PaletteDefs+42 + DW 94, 96, 53, 74, 92, 98 + +Colour14GreenInput DW 9 + DB 64, 15 + DW 0, 63 + DW 7, Offset PaletteDefs+43 + DW 95, 97, 54, 75, 93, 99 + +Colour14BlueInput DW 9 + DB 64, 16 + DW 0, 63 + DW 7, Offset PaletteDefs+44 + DW 96, 98, 55, 76, 94, 100 + +Colour15RedInput DW 9 + DB 64, 19 + DW 0, 63 + DW 7, Offset PaletteDefs+45 + DW 97, 99, 56, 77, 95, 102 + +Colour15GreenInput DW 9 + DB 64, 20 + DW 0, 63 + DW 7, Offset PaletteDefs+46 + DW 98, 100, 57, 78, 96, 102 + +Colour15BlueInput DW 9 + DB 64, 21 + DW 0, 63 + DW 7, Offset PaletteDefs+47 + DW 99, 102, 58, 79, 97, 102 + +PredefinedPaletteMsg DW 1 + DB 57, 25 + DB 20h + DB "Predefined Palettes", 0 + +PredefinedPalette1 DW 2 + DW 100, 103, 82, 61 + DW 0 + DW 0, 0 + DW 4 ; Jump to function + DD DWord Ptr S_UsePresetPalette + DW 0 ; First palette + DW 0, 0 ; Unused data + DB 55, 27, 77, 29 + DB 8 + DB 0 + DB " Light Blue", 0 + +PredefinedPalette2 DW 2 + DW 102, 104, 85, 64 + DW 0 + DW 0, 0 + DW 4 ; Jump to function + DD DWord Ptr S_UsePresetPalette + DW 1 ; First palette + DW 0, 0 ; Unused data + DB 55, 30, 77, 32 + DB 8 + DB 0 + DB " Gold", 0 + +PredefinedPalette3 DW 2 + DW 103, 105, 86, 65 + DW 0 + DW 0, 0 + DW 4 ; Jump to function + DD DWord Ptr S_UsePresetPalette + DW 2 ; First palette + DW 0, 0 ; Unused data + DB 55, 33, 77, 35 + DB 8 + DB 0 + DB " Camouflage", 0 + +PredefinedPalette4 DW 2 + DW 104, 106, 88, 67 + DW 0 + DW 0, 0 + DW 4 ; Jump to function + DD DWord Ptr S_UsePresetPalette + DW 3 + DW 0, 0 ; Unused data + DB 55, 36, 77, 38 + DB 8 + DB 0 + DB " Midnight Tracking", 0 + +PredefinedPalette5 DW 2 + DW 105, 107, 90, 69 + DW 0 + DW 0, 0 + DW 4 ; Jump to function + DD DWord Ptr S_UsePresetPalette + DW 4 + DW 0, 0 ; Unused data + DB 55, 39, 77, 41 + DB 8 + DB 0 + DB " Pine Colours", 0 + +PredefinedPalette6 DW 2 + DW 106, 108, 91, 70 + DW 0 + DW 0, 0 + DW 4 ; Jump to function + DD DWord Ptr S_UsePresetPalette + DW 5 + DW 0, 0 ; Unused data + DB 55, 42, 77, 44 + DB 8 + DB 0 + DB " Soundtracker", 0 + +PredefinedPalette7 DW 2 + DW 107, 0FFFFh, 94, 73 + DW 0 + DW 0, 0 + DW 4 ; Jump to function + DD DWord Ptr S_UsePresetPalette + DW 6 + DW 0, 0 ; Unused data + DB 55, 45, 77, 47 + DB 8 + DB 0 + DB " Volcanic", 0 + +O1_LoadInstrumentList DW 5 + DW Near Ptr InstrumentNameLoader ; Idlekey + DW Near Ptr LoadInstrumentKeyList + DW Near Ptr FullScreenBox ; 0 + DW Near Ptr ScreenHeader ; 1 + DW Near Ptr LoadInstrumentHeader ; 2 + DW Near Ptr FillHeader ; 3 + DW Near Ptr LoadInstrumentWindow + DW Near Ptr LoadInstrument ; 5 + DW Near Ptr LoadInstrumentDriveWindow + DW Near Ptr LoadInstrumentDrive + DW Near Ptr SetHelpContext11 + DW 0 + +LoadInstrumentDriveWindow DW 0 + DB 63, 15, 72, 48 + DB 27 + +LoadInstrumentDrive DW 15 + DD DWord Ptr D_LIDrawDriveWindow + DD DWord Ptr D_LIPreDriveWindow + DD DWord Ptr D_LIPostDriveWindow + +O1_ViewInstrumentLibrary DW 5 + DW Near Ptr InstrumentNameLoader ; Idlekey + DW Near Ptr LoadInstrumentKeyList + DW Near Ptr FullScreenBox ; 0 + DW Near Ptr ScreenHeader ; 1 + DW Near Ptr InstrumentLibraryHeader ; 2 + DW Near Ptr FillHeader ; 3 + DW Near Ptr LoadInstrumentWindow + DW Near Ptr ViewInstrument ; 5 + DW Near Ptr LoadInstrumentDriveWindow + DW Near Ptr LoadInstrumentDrive + DW Near Ptr SetHelpContext11 + DW 0 + +LoadInstrumentHeader DW 10 + DB "Load Instrument", 0 + +InstrumentLibraryHeader DW 10 + DB "Instrument Library (Ctrl-F4)", 0 + +LoadInstrumentWindow DW 0 + DB 5, 12, 62, 48 + DB 27 + +LoadInstrument DW 15 + DD DWord Ptr D_DrawLoadInstrument + DD DWord Ptr D_PreLoadInstrument + DD DWord Ptr D_PostLoadInstrument + +ViewInstrument DW 15 + DD DWord Ptr D_DrawLoadInstrument + DD DWord Ptr D_PreLoadInstrument + DD DWord Ptr D_ViewInstrument + +InstrumentNameLoader DD DWord Ptr D_LoadInstrumentNames + DD DWord Ptr IdleUpdateInfoLine + DD 0 + +O1_UndoList DW 3 + DW Near Ptr IdleFunctionList + DW Near Ptr ESCExitList + DW Near Ptr UndoBox1 + DW Near Ptr UndoBox2 + DW Near Ptr UndoText + DW Near Ptr UndoSelector + DW 0 + +UndoBox1 DW 0 + DB 16, 21, 63, 36 + DB 3 + +UndoBox2 DW 0 + DB 19, 23, 60, 34 + DB 27 + +UndoText DW 1 + DB 38, 22 + DB 23h + DB "Undo", 0 + +UndoSelector DW 15 + DD DWord Ptr PEFunction_DrawUndo + DD DWord Ptr PEFunction_PreUndo + DD DWord Ptr PEFunction_PostUndo + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +O1_MessageList DW 4 + DW Near Ptr IdleFunctionList + DW Near Ptr GlobalKeyList + DW Near Ptr FullScreenBox + DW Near Ptr ScreenHeader + DW Near Ptr FillHeader + DW Near Ptr MessageBox + DW Near Ptr MessageObject + DW Near Ptr MessageHeader + DW Near Ptr SetHelpContext12 + DW 0 + +MessageBox DW 0 + DB 1, 12, 78, 48 + DB 27 + +MessageObject DW 15 + DD DWord Ptr Msg_DrawMessage + DD DWord Ptr Msg_PreMessage + DD DWord Ptr Msg_PostMessage + +MessageHeader DW 10 + DB "Message Editor (Shift-F9)", 0 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +O1_MIDIOutputScreen DW 9 + DW Near Ptr IdleFunctionList + DW Near Ptr MIDIOutKeyList + DW Near Ptr FullScreenBox ; 0 + DW Near Ptr ScreenHeader + DW Near Ptr FillHeader + DW Near Ptr MIDIOutputHeader + DW Near Ptr MIDIOutputMainConfigText + DW Near Ptr MIDIOutputSFxConfigText + DW Near Ptr MIDIOutputMainConfigBox + DW Near Ptr MIDIOutputSFxConfigBox + DW Near Ptr MIDIOutputZxxConfigBox ; 8 + DW Near Ptr MIDIStartInput ; 9 + DW Near Ptr MIDIStopInput ; 10 + DW Near Ptr MIDITickInput ; 11 + DW Near Ptr MIDINoteOnInput ; 12 + DW Near Ptr MIDINoteOffInput ; 13 + DW Near Ptr MIDIChangeVolumeInput ; 14 + DW Near Ptr MIDIChangePanInput ; 15 + DW Near Ptr MIDIBankSelectInput ; 16 + DW Near Ptr MIDIProgramChangeInput ; 17 + DW Near Ptr MIDISF0Input + DW Near Ptr MIDISF1Input + DW Near Ptr MIDISF2Input + DW Near Ptr MIDISF3Input + DW Near Ptr MIDISF4Input + DW Near Ptr MIDISF5Input + DW Near Ptr MIDISF6Input + DW Near Ptr MIDISF7Input + DW Near Ptr MIDISF8Input + DW Near Ptr MIDISF9Input + DW Near Ptr MIDISFAInput + DW Near Ptr MIDISFBInput + DW Near Ptr MIDISFCInput + DW Near Ptr MIDISFDInput + DW Near Ptr MIDISFEInput + DW Near Ptr MIDISFFInput ; 33 + DW Near Ptr MIDIZ1Input + DW Near Ptr MIDIZ2Input + DW Near Ptr MIDIZ3Input + DW Near Ptr MIDIZ4Input + DW Near Ptr MIDIZ5Input + DW Near Ptr MIDIZ6Input + DW Near Ptr MIDIZ7Input + DW Near Ptr MIDIZxxNumbering + DW 0 + +MIDIOutputHeader DW 10 + DB "MIDI Output Configuration", 0 + +MIDIZxxNumbering DW 8 + DD DWord Ptr F_ShowMIDIZxxInput + +MIDIOutKeyList DB 0 + DW 1C8h + DD DWord Ptr F_MIDI_Up + + DB 0 + DW 1D0h + DD DWord Ptr F_MIDI_Down + + DB 0 + DW 1C9h + DD DWord Ptr F_MIDI_PgUp + + DB 0 + DW 1D1h + DD DWord Ptr F_MIDI_PgDn + + DB 5 + DW Offset GlobalKeyChain + +MIDIOutputMainConfigText DW 1 + DB 2, 13 + DB 20h + DB 0FFh, 4, " MIDI Start", 13 + DB 0FFh, 5, " MIDI Stop", 13 + DB 0FFh, 5, " MIDI Tick", 13 + DB 0FFh, 7, " Note On", 13 + DB 0FFh, 6, " Note Off", 13 + DB " Change Volume", 13 + DB 0FFh, 4, " Change Pan", 13 + DB " Bank Select", 13 + DB "Program Change", 13 + DB 13 + DB 13 + DB " Macro", 13 + DB " Setup", 0 + +MIDIOutputSFxConfigText DW 1 + DB 13, 24 + DB 20h + DB "SF0", 13 + DB "SF1", 13 + DB "SF2", 13 + DB "SF3", 13 + DB "SF4", 13 + DB "SF5", 13 + DB "SF6", 13 + DB "SF7", 13 + DB "SF8", 13 + DB "SF9", 13 + DB "SFA", 13 + DB "SFB", 13 + DB "SFC", 13 + DB "SFD", 13 + DB "SFE", 13 + DB "SFF", 0 + +MIDIOutputMainConfigBox DW 0 + DB 16, 12, 60, 22 + DB 27 + +MIDIOutputSFxConfigBox DW 0 + DB 16, 23, 60, 40 + DB 27 + +MIDIOutputZxxConfigBox DW 0 + DB 16, 41, 60, 49 + DB 27 + + +MIDIStartInput DW 16 + DB 17, 13 + DW 7, 0 + DW 32 + DD 0 + DW 9, 10, 0FFFFh, 0FFFFh + +MIDIStopInput DW 16 + DB 17, 14 + DW 7, 20h + DW 32 + DD 0 + DW 9, 11, 0FFFFh, 0FFFFh + +MIDITickInput DW 16 + DB 17, 15 + DW 7, 40h + DW 32 + DD 0 + DW 10, 12, 0FFFFh, 0FFFFh + +MIDINoteOnInput DW 16 + DB 17, 16 + DW 7, 60h + DW 32 + DD 0 + DW 11, 13, 0FFFFh, 0FFFFh + +MIDINoteOffInput DW 16 + DB 17, 17 + DW 7, 80h + DW 32 + DD 0 + DW 12, 14, 0FFFFh, 0FFFFh + +MIDIChangeVolumeInput DW 16 + DB 17, 18 + DW 7, 0A0h + DW 32 + DD 0 + DW 13, 15, 0FFFFh, 0FFFFh + +MIDIChangePanInput DW 16 + DB 17, 19 + DW 7, 0C0h + DW 32 + DD 0 + DW 14, 16, 0FFFFh, 0FFFFh + +MIDIBankSelectInput DW 16 + DB 17, 20 + DW 7, 0E0h + DW 32 + DD 0 + DW 15, 17, 0FFFFh, 0FFFFh + +MIDIProgramChangeInput DW 16 + DB 17, 21 + DW 7, 100h + DW 32 + DD 0 + DW 16, 18, 0FFFFh, 0FFFFh + +MIDISF0Input DW 16 + DB 17, 24 + DW 7, 120h + DW 32 + DD 0 + DW 17, 19, 0FFFFh, 0FFFFh + +MIDISF1Input DW 16 + DB 17, 25 + DW 7, 140h + DW 32 + DD 0 + DW 18, 20, 0FFFFh, 0FFFFh + +MIDISF2Input DW 16 + DB 17, 26 + DW 7, 160h + DW 32 + DD 0 + DW 19, 21, 0FFFFh, 0FFFFh + +MIDISF3Input DW 16 + DB 17, 27 + DW 7, 180h + DW 32 + DD 0 + DW 20, 22, 0FFFFh, 0FFFFh + +MIDISF4Input DW 16 + DB 17, 28 + DW 7, 1A0h + DW 32 + DD 0 + DW 21, 23, 0FFFFh, 0FFFFh + +MIDISF5Input DW 16 + DB 17, 29 + DW 7, 1C0h + DW 32 + DD 0 + DW 22, 24, 0FFFFh, 0FFFFh + +MIDISF6Input DW 16 + DB 17, 30 + DW 7, 1E0h + DW 32 + DD 0 + DW 23, 25, 0FFFFh, 0FFFFh + +MIDISF7Input DW 16 + DB 17, 31 + DW 7, 200h + DW 32 + DD 0 + DW 24, 26, 0FFFFh, 0FFFFh + +MIDISF8Input DW 16 + DB 17, 32 + DW 7, 220h + DW 32 + DD 0 + DW 25, 27, 0FFFFh, 0FFFFh + +MIDISF9Input DW 16 + DB 17, 33 + DW 7, 240h + DW 32 + DD 0 + DW 26, 28, 0FFFFh, 0FFFFh + +MIDISFAInput DW 16 + DB 17, 34 + DW 7, 260h + DW 32 + DD 0 + DW 27, 29, 0FFFFh, 0FFFFh + +MIDISFBInput DW 16 + DB 17, 35 + DW 7, 280h + DW 32 + DD 0 + DW 28, 30, 0FFFFh, 0FFFFh + +MIDISFCInput DW 16 + DB 17, 36 + DW 7, 2A0h + DW 32 + DD 0 + DW 29, 31, 0FFFFh, 0FFFFh + +MIDISFDInput DW 16 + DB 17, 37 + DW 7, 2C0h + DW 32 + DD 0 + DW 30, 32, 0FFFFh, 0FFFFh + +MIDISFEInput DW 16 + DB 17, 38 + DW 7, 2E0h + DW 32 + DD 0 + DW 31, 33, 0FFFFh, 0FFFFh + +MIDISFFInput DW 16 + DB 17, 39 + DW 7, 300h + DW 32 + DD 0 + DW 32, 34, 0FFFFh, 0FFFFh + +MIDIZ1Input DW 16 + DB 17, 42 + DW 7, 8320h + DW 32 + DD 0 + DW 0FFFFh, 35, 0FFFFh, 0FFFFh + +MIDIZ2Input DW 16 + DB 17, 43 + DW 7, 8340h + DW 32 + DD 0 + DW 34, 36, 0FFFFh, 0FFFFh + +MIDIZ3Input DW 16 + DB 17, 44 + DW 7, 8360h + DW 32 + DD 0 + DW 35, 37, 0FFFFh, 0FFFFh + +MIDIZ4Input DW 16 + DB 17, 45 + DW 7, 8380h + DW 32 + DD 0 + DW 36, 38, 0FFFFh, 0FFFFh + +MIDIZ5Input DW 16 + DB 17, 46 + DW 7, 83A0h + DW 32 + DD 0 + DW 37, 39, 0FFFFh, 0FFFFh + +MIDIZ6Input DW 16 + DB 17, 47 + DW 7, 83C0h + DW 32 + DD 0 + DW 38, 40, 0FFFFh, 0FFFFh + +MIDIZ7Input DW 16 + DB 17, 48 + DW 7, 83E0h + DW 32 + DD 0 + DW 39, 0FFFFh, 0FFFFh, 0FFFFh + +O1_MIDIScreen DW 7 + DW Near Ptr MIDIIdleList + DW Near Ptr GlobalKeyList + DW Near Ptr FullScreenBox ; 0 + DW Near Ptr ScreenHeader + DW Near Ptr FillHeader + DW Near Ptr MIDIHeader + DW Near Ptr ShowMIDIInput + DW Near Ptr MIDIOptionsBox ; 5 + DW Near Ptr MIDIOptions ; 6 + DW Near Ptr ProgramChangeToggle ; 7 + DW Near Ptr Program1Toggle ; 8 + DW Near Ptr RecordNoteOffToggle ; 9 + DW Near Ptr RecordVelocityToggle ; 10 + DW Near Ptr RecordAfterTouchToggle ; 11 + DW Near Ptr MIDITranslateBox ; 12 + DW Near Ptr MIDIAmplificationTB ; 13 + DW Near Ptr MIDICentralNoteTB ; 14 + DW Near Ptr MIDIOutputButton ; 15 + DW Near Ptr MIDISaveConfigButton ; 16 + DW Near Ptr MIDINoteOffCut ; 17 + DW Near Ptr MIDIPitchBox ; 18 + DW Near Ptr MIDIPitchToggle ; 19 + DW Near Ptr MIDIPWDInput ; 20 + DW Near Ptr MIDIEmbedBox + DW NEar Ptr MIDIEmbedToggle + DW Near Ptr SetHelpContext13 + DW 0 + +MIDIHeader DW 10 + DB "MIDI Screen (Shift-F1)", 0 + +MIDIPitchToggle DW 17 + DB 25, 27 + DW 2 + DW 2Ch ; Offset of 'Flags' + DB 64 + DW 14, 20, 0FFFFh, 0FFFFh + +MIDIEmbedToggle DW 17 + DB 25, 31 + DW 2 + DW 2Ch ; Offset of 'Flags' + DB 128 + DW 20, 15, 0FFFFh, 0FFFFh + +MIDIPWDInput DW 14 + DB 25, 28 + DW 0, 32 + DW 3, 35h + DW 19, 22, 0FFFFh, 0FFFFh + DW 0FFFFh, 0FFFFh ; PgUp/PgDn + DW 25 + +MIDIOutputButton DW 2 + DW 22, 16, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 1 + DD DWord Ptr O1_MIDIOutputScreen + DW 0, 0, 0 + DB 2, 34, 32, 36 + DB 8 + DB 0 + DB " MIDI Output Configuration", 0 + +MIDISaveConfigButton DW 2 + DW 15, 0FFFFh, 0FFFFh, 0FFFFh + DW 0 + DW 0, 0 + DW 2 + DD DWord Ptr Music_SaveMIDIConfig + DW 0, 0, 0 + DB 2, 37, 32, 39 + DB 8 + DB 0 + DB " Save Output Configuration", 0 + +ShowMIDIInput DW 8 +MIDIIdleList DD DWord Ptr K_ShowMIDIInput + DD DWord Ptr IdleUpdateInfoLine + DD 0 + +MIDIOptionsBox DW 0 + DB 24, 14, 30, 21 + DB 27 + +MIDITranslateBox DW 0 + DB 24, 22, 51, 25 + DB 27 + +MIDIPitchBox DW 0 + DB 24, 26, 51, 29 + DB 27 + +MIDIEmbedBox DW 0 + DB 24, 30, 51, 32 + DB 27 + +MIDIOptions DW 1 + DB 7, 15 + DB 20h + DB 0FFh, 4, " Tick quantize", 13 + DB " Base Program 1", 13 + DB " Record Note-Off", 13 + DB " Record Velocity", 13 + DB "Record Aftertouch", 13 + DB 0FFh, 5, " Cut note off", 13 + DB 13 + DB 13 + DB 0FFh, 4, " Amplification", 13 + DB " C-5 Note-value", 13 + DB 13 + DB 13 + DB "Output MIDI pitch", 13 + DB "Pitch wheel depth", 13 + DB 13 + DB 13 + DB " Embed MIDI data", 0 + +ProgramChangeToggle DW 17 + DB 25, 15 + DW 1, Offset CentraliseCursor + DB 8 + DW 0FFFFh, 8, 0FFFFh, 0FFFFh, 0FFFFh, 0FFFFh + +Program1Toggle DW 17 + DB 25, 16 + DW 1, Offset CentraliseCursor + DB 16 + DW 7, 9, 0FFFFh, 0FFFFh, 0FFFFh, 0FFFFh + +RecordNoteOffToggle DW 17 + DB 25, 17 + DW 1, Offset CentraliseCursor + DB 32 + DW 8, 10, 0FFFFh, 0FFFFh, 0FFFFh, 0FFFFh + +RecordVelocityToggle DW 17 + DB 25, 18 + DW 1, Offset CentraliseCursor + DB 64 + DW 9, 11, 0FFFFh, 0FFFFh, 0FFFFh, 0FFFFh + +RecordAfterTouchToggle DW 17 + DB 25, 19 + DW 1, Offset CentraliseCursor + DB 128 + DW 10, 17, 0FFFFh, 0FFFFh, 0FFFFh, 0FFFFh + +MIDINoteOffCut DW 17 + DB 25, 20 + DW 1, Offset Flags + DB 2 + DW 11, 13, 0FFFFh, 0FFFFh, 0FFFFh, 0FFFFh + +MIDIAmplificationTB DW 9 + DB 25, 23 + DW 0, 200 + DW 1, Offset MIDIAmplification + DW 17, 14, 0FFFFh, 0FFFFh, 0FFFFh, 0FFFFh + +MIDICentralNoteTB DW 14 + DB 25, 24 + DW 0, 127 + DW 1, Offset MIDICentralNote + DW 13, 19, 0FFFFh, 0FFFFh, 0FFFFh, 0FFFFh + DW 25 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +IF TIMERSCREEN + +O1_TimerList DW 5 + DW Near Ptr InfoPageIdleList + DW Near Ptr GlobalKeyList + DW Near Ptr FullScreenBox ; 0 + DW Near Ptr ScreenHeader ; 1 + DW Near Ptr FillHeader ; 2 + DW Near Ptr TimerHeader + DW Near Ptr TimerText ; 4 + DW Near Ptr DrawTimer + DW Near Ptr Divider + DW Near Ptr SetHelpContext0 + DW 0 + +TimerHeader DW 10 + DB "Time Information", 0 + +TimerText DW 1 + DB 2, 13 + DB 20h + DB 0FFh, 4, " Module time:", 13 + DB "Current session:", 13 + DB 13 + DB 0FFh, 5, " Total time:", 0 + +DrawTimer DW 15 + DD DWord Ptr D_DrawTimer + DD DWord Ptr F_Nothing + DD DWord Ptr D_PostTimerList + +Divider DW 1 + DB 1, 18 + DB 20h + DB 0FFh, 78, 09Ah, 0 + +ENDIF + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +O1_StereoSampleList DW 2 + DW Near Ptr IdleFunctionList + DW Near Ptr LRKeyList + DW Near Ptr StereoSampleBox ; 0 + DW Near Ptr StereoSampleText + DW Near Ptr StereoButtonLeft ; 2 + DW Near Ptr StereoButtonRight ; 3 + DW 0 + +LRKeyList DB 8 + DW 'L' + DD DWord Ptr F_Return64 + + DB 8 + DW 'R' + DD DWord Ptr F_Return192 + + DB 0FFh + +StereoSampleBox DW 0 + DB 26, 22, 54, 29 + DB 3 + +StereoSampleText DW 1 + DB 30, 24 + DB 20h + DB "Loading Stereo Sample", 0 + +StereoButtonLeft DW 2 + DW 0FFFFh, 0FFFFh, 3, 3 + DW 0 + DW 0, 0 ; Unused + DW 0 ; Return + DW 64 + DW 0, 0, 0, 0 ; Unused + DB 30, 26, 39, 28 + DB 8 + DB 0 + DB " Left", 0 + +StereoButtonRight DW 2 + DW 0FFFFh, 0FFFFh, 2, 2 + DW 0 + DW 0, 0 ; Unused + DW 0 ; Return + DW 64+128 + DW 0, 0, 0, 0 ; Unused + DB 40, 26, 50, 28 + DB 8 + DB 0 + DB " Right", 0 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +O1_ShowTime DW 2 + DW 0 + DW Near Ptr ESCReturnList + DW Near Ptr NBMBox + DW Near Ptr ShowTime + DW Near Ptr OKButton + DW Near Ptr SongLengthText + DW 0 + +SongLengthText DW 1 + DB 27, 27 + DB 20h + DB "Total song time: ", 0 + +ShowTime DW 8 + DD Music_ShowTime + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +IF SPECTRUMANALYSER +O1_FourierDisplay DW 0 +; DW Near Ptr FourierIdleList + DW Near Ptr InfoPageIdleList + DW Near Ptr FourierKeyList + DW Near Ptr FourierDisplay + DW 0 + +;FourierIdleList DD DWord Ptr Fourier_IdleList +; DD 0 + +FourierKeyList DB 1 + DW '-' + DD DWord Ptr DisplayMinus + + DB 1 + DW '+' + DD DWord Ptr DisplayPlus + + DB 0 + DW 13Fh + DD DWord Ptr Glbl_Ctrl_F5 + + DB 1 + DW 'p' + DD DWord Ptr Fourier_ChangePalette + + DB 5 + DW Near Ptr PlayCommandChain + +FourierDisplay DW 15 + DD DWord Ptr Fourier_PreDrawScreen + DD DWord Ptr Fourier_DrawScreen + DD DWord Ptr Fourier_PostFunction + +ENDIF + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +EndS + +End diff --git a/IT_PE.ASM b/IT_PE.ASM new file mode 100644 index 0000000..cba174d --- /dev/null +++ b/IT_PE.ASM @@ -0,0 +1,12312 @@ +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ PatternEdit module ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Jumps + .386 + +include switch.inc + +include network.inc + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Externals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Segment Object1 BYTE Public 'Data' +EndS + +Segment Disk BYTE Public 'Code' +EndS + +Segment Inst BYTE Public 'Code' + Extrn InstrumentEdit:Byte + Extrn NodeHeld:Byte +EndS + + Extrn E_GetFreeEMS:Far + Extrn E_UnInitEMS:Far + Extrn E_ReleaseEMS:Far + Extrn E_AllocateEMS:Far + Extrn E_MapAvailableEMSMemory:Far + Extrn E_GetEMSPageFrame:Far + + Extrn Glbl_F2:Far, Glbl_F6:Far + Extrn Glbl_GetHeaderMode:Far + Extrn Glbl_LeftBrace:Far, Glbl_RightBrace:Far + Extrn Glbl_LeftSquareBracket:Far, Glbl_RightSquareBracket:Far + + Extrn I_ClearTables:Far + + Extrn K_UnInitKeyBoard:Far + Extrn K_SetScrollLock:Far + Extrn K_IsKeyDown:Far + + Extrn M_FunctionHandler:Far + Extrn M_Object1List:Far + Extrn M_FunctionDivider:Far + + Extrn Music_PlayPartSong:Far + Extrn Music_GetSongSegment:Far + Extrn Music_UnInitMusic:Far + Extrn Music_ReleasePattern:Far + Extrn Music_AllocatePattern:Far + Extrn Music_GetPattern:Far + Extrn Music_GetInstrumentMode:Far + Extrn Music_UpdatePatternOffset:Far + Extrn Music_PlayNote:Far + Extrn Music_InitMixTable:Far + Extrn Music_InitMuteTable:Far + Extrn Music_InitStereo:Far + Extrn Music_ToggleChannel:Far + Extrn Music_SoloChannel:Far + Extrn Music_GetPlayMode:Far + Extrn Music_PlayPattern:Far + Extrn Music_GetLastChannel:Far + Extrn Music_SetNextOrder:Far + Extrn Music_NextOrder:Far + Extrn Music_LastOrder:Far + Extrn Music_Stop:Far + + Extrn Music_UnmuteAll:Far + + Extrn Music_SoundCardLoadSample:Far + Extrn Music_SoundCardLoadAllSamples:Far + Extrn Music_GetDisplayVariables:Far + + Extrn Network_UpdatePattern:Far + + Extrn FileName:Byte + + Extrn O1_ConfirmNoSave:Far + Extrn O1_NoBlockMarkedList:Far + Extrn O1_SwapOutOfRangeList:Far + Extrn O1_OverlapBlockList:Far + Extrn O1_OutOfMemoryList:Far + Extrn O1_NoBlockDataList:Far + Extrn O1_GetAmpList:Far + Extrn O1_GetFastAmpList:Far + +IF SHOWPATTERNLENGTH + Extrn O1_ShowPatternLengthList:Far +ENDIF + + Extrn O1_TemplateErrorList:Far + Extrn O1_PatternTooLongList:Far + Extrn O1_SelectMultiChannel:Far + Extrn O1_UndoList:Far + Extrn O1_SetPatternLength:Far + Extrn O1_PatternSizeMismatchList:Far + + Extrn S_UnInitScreen:Far + Extrn S_DrawBox:Far + Extrn S_DrawString:Far + Extrn S_GetDestination:Far + Extrn S_SaveScreen:Far + Extrn S_RestoreScreen:Far + Extrn S_SetDirectMode:Far + Extrn S_DrawSmallBox:Far + Extrn S_InvertCursor:Far + + Extrn PatternLength + + Extrn UpdateInfoLine:Far + Extrn SetInfoLine:Far + Extrn MouseUpdateDisable:Far + Extrn UpdateWAVEForm:Far + + Extrn MIDI_AllocateChannel:Far, MIDI_FindChannel:Far + Extrn Music_GetDelay:Far, MIDI_GetChannel:Far + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Globals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Global PE_ClearUndoBuffer:Far + + Global PE_ShowOrder:Far + Global PE_NewPattern:Far + + Global PE_InitPatternEdit:Far + Global PE_UnInitPatternEdit:Far + Global PE_DrawOrderList:Far + Global PE_FillHeader:Far + Global PE_PreOrderList:Far + Global PE_PostOrderList:Far + Global PE_ConvAX2Num:Far + Global PE_GetCurrentPattern:Far + Global PE_GetMaxPattern:Far + Global PE_FillSpeedTempo:Far + + Global PE_SetPatternModified:Far + Global PE_GetLastInstrument:Far + Global PE_DrawPatternEdit:Far + Global PE_PrePatternEdit:Far + Global PE_PostPatternEdit:Far + Global PE_SetCommandCursor:Far + Global PEFunction_IncreaseOctave:Far + Global PEFunction_DecreaseOctave:Far + + Global PE_F7:Far + + Global PE_GetPatternConfigOffset:Far + + Global PE_SwapInstruments:Far + Global PE_GetMaxOrder:Far + Global PE_GotoPattern:Far + Global PECheckModified:Far + + Global PE_TranslateXMPattern:Far + Global PE_TranslateS3MPattern:Far + Global PE_TranslateMODPattern:Far + Global PE_TranslateMTMPattern:Far + Global PE_Translate669Pattern:Far + Global PE_ResetOrderPattern:Far + Global PEFunction_OutOfMemoryMessage:Far + Global PE_UpdateInstruments:Far + + Global PEFunction_DrawUndo:Far + Global PEFunction_PreUndo:Far + Global PEFunction_PostUndo:Far + Global PEResetModified:Far + + Global PE_SaveCurrentPattern:Far + Global PE_RestoreCurrentPattern:Far + Global PEFunction_StoreCurrentPattern:Far + + Global BaseOctave + Global SkipValue + Global RowHiLight1:Byte + Global RowHiLight2:Byte + Global MaxRow:Word + Global NumberOfRows:Word + Global Amplification + Global FastVolumeAmplification + Global CommandToValue:Byte + Global LastInstrument:Byte + Public MultiChannelInfo + Public PatternDataArea + Public Order, CentraliseCursor + Public PatternSetLength, PatternLengthStart, PatternLengthEnd + Public MIDI_SetInstrument, PE_TranslateMIDI + Public MIDIAmplification, MIDICentralNote, PE_RestoreMIDINote + Public PE_InsertInstrument, PE_DeleteInstrument + Public Flags, Modified, PatternModified + + Public LastKeyBoard1, PatternNumber + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +Segment Pattern WORD Public 'Code' USE16 + Assume CS:Pattern, DS:Nothing + +CREATENEWLOGFILE EQU 0 +include debug.inc + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Variables ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +NONOTE EQU 0FDh +MAXNOTE EQU 119 + +;PatternSize DW 0 +;PatternEnd DW 0 +PatternDataArea DW PatternData + +TempVariableArea DW 0 +TempVariableArea2 DW 0 +TempVariableArea3 DW 0 +TempVariableArea4 DW 0 +TempVariableArea5 DW 0 +TempVariableArea6 DW 0 + +TopOrder DW 0 +Order DW 0 +OrderCursor DW 0 +PatternNumber DW 0 +TopRow DW 0 +Row DW 0 +MaxRow DW 63 +NumberOfRows DW 64 + +LeftChannel DW 0 +Channel DW 0 +MIDIChannel DW 0 +PatternCursor DW 0 +BaseOctave DW 4 +SkipValue DW 1 +MultiChannelInfo DB 64 Dup (0) +BlockMark DW 0 ; 0 if no block marked, 1 if block is marked +BlockLeft DW 0 +BlockTop DW 0 +BlockRight DW 0 +BlockBottom DW 0 +BlockDataArea DW 0 +BlockAnchorChannel DW 0 +BlockAnchorRow DW 0 +BlockReset DW 0 +LastKeyBoard1 DW 0, 0 +LastKeyBoard2 DW 0, 0 +LastKeyBoard3 DW 0, 0 + +EmptyRow DB 64 Dup ( NONOTE, 0, 0FFh, 0, 0 ) + +KeyBoardTable DW 12Ch, 0, 11Fh, 1, 12Dh, 2, 120h, 3, 12Eh, 4 + DW 12Fh, 5, 122h, 6, 130h, 7, 123h, 8, 131h, 9 + DW 124h, 10, 132h, 11, 110h, 12, 103h, 13, 111h, 14 + DW 104h, 15, 112h, 16, 113h, 17, 106h, 18, 114h, 19 + DW 107h, 20, 115h, 21, 108h, 22, 116h, 23, 117h, 24 + DW 10Ah, 25, 118h, 26, 10Bh, 27, 119h, 28 + DW 0FFFFh + +MODPeriodTable DW 1712, 1616, 1525, 1440, 1357, 1281 ; Octave 0 + DW 1209, 1141, 1077, 1017, 961, 907 + DW 856, 808, 762, 720, 678, 640 ; Octave 1 + DW 604, 570, 538, 508, 480, 453 + DW 428, 404, 381, 360, 339, 320 ; Octave 2 + DW 302, 285, 269, 254, 240, 226 + DW 214, 202, 190, 180, 170, 160 ; Octave 3 + DW 151, 143, 135, 127, 120, 113 + DW 107, 101, 95, 90, 85, 80 ; Octave 4 + DW 75, 71, 67, 63, 60, 56 + DW 53, 50, 47, 45, 42, 40 ; Octave 5 + DW 37, 35, 33, 31, 30, 28 + +Amplification DW 100 + +PlayMarkPattern DW 0 +PlayMarkRow DW 0 +PlayMarkOn DB 0 +VolumePan DB 0 + +UndoBuffer DW 20 Dup (0) ; Word for segment, word for + ; type: + +UndoBufferTypes Label Word + DW Offset UndoBufferType0, Offset UndoBufferType1 + DW Offset UndoBufferType2, Offset UndoBufferType3 + DW Offset UndoBufferType4, Offset UndoBufferType5 + DW Offset UndoBufferType6, Offset UndoBufferType7 + DW Offset UndoBufferType8, Offset UndoBufferType9 + DW Offset UndoBufferType10, Offset UndoBufferType11 + DW Offset UndoBufferType12, Offset UndoBufferType13 + DW Offset UndoBufferType14, Offset UndoBufferType15 + DW Offset UndoBufferType16, Offset UndoBufferType17 + DW Offset UndoBufferType18, Offset UndoBufferType19 + DW Offset UndoBufferType20, Offset UndoBufferType21 + DW Offset UndoBufferType22 + +UndoBufferType0 DB "Empty", 0 +UndoBufferType1 DB "Undo revert pattern data (Alt-BkSpace)", 0 +UndoBufferType2 DB "Undo transposition up", 0FFh, 10, " (Alt-Q)", 0 +UndoBufferType3 DB "Undo transposition down", 0FFh, 8, " (Alt-A)", 0 +UndoBufferType4 DB "Undo block length double", 0FFh, 7, " (Alt-F)", 0 +UndoBufferType5 DB "Undo block length halve", 0FFh, 8, " (Alt-G)", 0 +UndoBufferType6 DB "Undo volume amplification", 0FFh, 6, " (Alt-J)", 0 +UndoBufferType7 DB "Undo volume or panning slide (Alt-K)", 0 +UndoBufferType8 DB "Recover volumes/pannings", 0FFh, 5, " (2*Alt-K)", 0 +UndoBufferType9 DB "Replace mixed data", 0FFh, 13, " (Alt-M)", 0 +UndoBufferType10 DB "Replace overwritten data", 0FFh, 7, " (Alt-O)", 0 +UndoBufferType11 DB "Undo paste data", 0FFh, 16, " (Alt-P)", 0 +UndoBufferType12 DB "Undo set sample/instrument", 0FFh, 5, " (Alt-S)", 0 +UndoBufferType13 DB "Undo set volume/panning", 0FFh, 8, " (Alt-V)", 0 +UndoBufferType14 DB "Replace extra volumes/pannings (Alt-W)", 0 +UndoBufferType15 DB "Undo effect data slide", 0FFh, 9, " (Alt-X)", 0 +UndoBufferType16 DB "Recover effects/effect data (2*Alt-X)", 0 +UndoBufferType17 DB "Undo swap block", 0FFh, 16, " (Alt-Y)", 0 +UndoBufferType18 DB "Undo block cut", 0FFh, 17, " (Alt-Z)", 0 +UndoBufferType19 DB "Remove inserted row(s)", 0FFh, 4, " (Alt-Insert)", 0 +UndoBufferType20 DB "Replace deleted row(s)", 0FFh, 4, " (Alt-Delete)", 0 +UndoBufferType21 DB "Redo", 0FFh, 28, " (Undo)", 0 +UndoBufferType22 DB "Pattern ", 0FDh, "D", 0 + +SelectUndo DW 0 +ShiftPressed DB 0 +NoteEntered DB 0 + +PreviewNote DB 0, 0, 0FFh, 0, 0 + +Modified DB 0 ; } Order important +PatternModified DB 0 ; } + +MIDIPlayTrigger DB 0 ; 0 = nothing, 1 = play + ; pattern, 2 = play song. + +CompleteMsg DB 0FDh, "D% Complete", 0 +Template DB 0 +TemplateMsg1 DB "Template, Overwrite", 0 +TemplateMsg2 DB "Template, Mix - Pattern data precedence", 0 +TemplateMsg3 DB "Template, Mix - Clipboard data precedence", 0 +TemplateMsg4 DB "Template, Notes only", 0 +TriggerMsg1 DB "No MIDI Trigger", 0 +TriggerMsg2 DB "Pattern MIDI Trigger", 0 +TriggerMsg3 DB "Song MIDI Trigger", 0 +NextOrderMsg DB "Playing order ", 0FDh, "D next", 0 +CursorStepMSg DB "Cursor step set to ", 0FDh, "D", 0 + +EncodingInfo DB 384 Dup (0) +PatternSetLength DW 64 +PatternLengthStart DW 0 +PatternLengthEnd DW 0 +TempData DB 320 Dup (0) + +PEFunctions Label Word + DB 0 + DW 11Ch ; Enter + DW Offset PEFunction_PickUp + +IF SHOWPATTERNLENGTH + DB 0 + DW 111Ch ; Right Ctrl+Enter + DW Offset PE_ShowPatternLength +ENDIF + + DB 1 + DW '{' + DW Near Ptr PE_LeftBrace + + DB 1 + DW '}' + DW Near Ptr PE_RightBrace + + DB 1 + DW '[' + DW Near Ptr PE_LeftSquareBracket + + DB 1 + DW ']' + DW Near Ptr PE_RightSquareBracket + + DB 0 + DW 1C8h + DW Offset PEFunction_Up + + DB 0 + DW 1D0h + DW Offset PEFunction_Down + + DB 0 + DW 1CBh + DW Offset PEFunction_Left + + DB 0 + DW 1CDh + DW Offset PEFunction_Right + + DB 0 + DW 1C9h + DW PEFunction_PgUp + + DB 0 + DW 1D1h + DW PEFunction_PgDn + + DB 2 + DW 1C7h + DW Offset PEFunction_Alt_Home + + DB 2 + DW 1CFh + DW Offset PEFunction_Alt_End + + DB 0 + DW 1C7h + DW Offset PEFunction_Home + + DB 0 + DW 1CFh + DW Offset PEFunction_End + + DB 3 + DW 1C9h + DW PEFunction_Ctrl_PgUp + + DB 3 + DW 1D1h + DW PEFunction_Ctrl_PgDn + + DB 2 ; Alt... + DW 1CBh ; Left Arrow + DW Offset PEFunction_AltLeft + + DB 2 ; Alt... + DW 1CDh ; Right Arrow + DW Offset PEFunction_AltRight + + DB 3 ; Ctrl... + DW 1CBh ; Left Arrow + DW Offset PEFunction_ViewLeft + + DB 3 + DW 1CDh + DW Offset PEFunction_ViewRight + + DB 2 ; Alt... + DW 1C8h ; Up Arrow + DW Offset PEFunction_AltUp + + DB 2 + DW 1D0h + DW Offset PEFunction_AltDown + + DB 3 + DW 1C7h + DW Offset PEFunction_Ctrl_Home + + DB 3 + DW 1CFh + DW Offset PEFunction_Ctrl_End + + DB 4 + DW 1C8h + DW Offset PEFunction_Up + + DB 4 + DW 1D0h + DW Offset PEFunction_Down + + DB 4 + DW 1CBh + DW Offset PEFunction_AltLeft + + DB 4 + DW 1CDh + DW Offset PEFunction_AltRight + + DB 4 + DW 1C9h + DW PEFunction_ShiftPgUp + + DB 4 + DW 1D1h + DW PEFunction_ShiftPgDn + + DB 4 + DW 1C7h + DW Offset PEFunction_Home + + DB 4 + DW 1CFh + DW Offset PEFunction_End + + DB 4 + DW 12Ah + DW Offset PEFunction_Press_Shift + + DB 4 + DW 136h + DW Offset PEFunction_Press_Shift + + DB 0 + DW 2Ah + DW Offset PEFunction_Release_Shift + + DB 0 + DW 36h + DW Offset PEFunction_Release_Shift + + DB 0 + DW 10Fh + DW Offset PEFunction_Tab + + DB 4 + DW 10Fh + DW Offset PEFunction_ShiftTab + + DB 1 + DW ',' + DW Offset PEFunction_SetMask + + DB 0 + DW 1D2h + DW Offset PEFunction_Insert + + DB 0 + DW 1D3h ; Delete + DW Offset PEFunction_Delete + + DB 2 ; Alt... + DW 1D2h ; Insert + DW Offset PEFunction_RowInsert + + DB 2 ; Alt... + DW 1D3h ; Delete + DW Offset PEFunction_RowDelete + + DB 3 ; Ctrl... + DW 1D2h ; Insert + DW Offset PEFunction_RollDown + + DB 3 ; Ctrl... + DW 1D3h ; Delete + DW Offset PEFunction_RollUp + + DB 0 + DW 10Eh + DW Offset PEFunction_BackSpace + + DB 3 ; Ctrl... + DW 10Eh ; Backspace + DW Offset PEFunction_Undo + + DB 1 + DW '<' + DW Offset PEFunction_DecreaseInstrument + + DB 1 + DW '>' + DW Offset PEFunction_IncreaseInstrument + + DB 1 + DW ';' + DW Offset PEFunction_DecreaseInstrument + + DB 1 + DW "'" + DW Offset PEFunction_IncreaseInstrument + + DB 3 ; Ctrl + DW 1C8h + DW Offset PEFunction_DecreaseInstrument + + DB 3 + DW 1D0h + DW Offset PEFunction_IncreaseInstrument + + DB 1 + DW 3000h ; Alt 'B' + DW Offset PEFunction_MarkBeginBlock + + DB 1 + DW 3100h ; Alt 'N' + DW Offset PEFunction_ToggleMultiChannel + + DB 1 + DW 1200h ; Alt 'E' + DW Offset PEFunction_MarkEndBlock + + DB 1 + DW 1600h ; Alt 'U' + DW Offset PEFunction_UnMarkBlock + + DB 1 + DW 1700h ; Alt 'I' + DW Offset PEFunction_ToggleTemplate + + DB 1 + DW ':' + DW Offset PEFunction_TemplateOff + + DB 1 + DW 2000h ; Alt 'D' + DW Offset PEFunction_AltD + + DB 1 + DW 1F00h ; Alt 'S' + DW Offset PEFunction_AltS + + DB 1 + DW 2500h ; Alt 'K' + DW Offset PEFunction_AltK + + DB 1 + DW 2C00h ; Alt 'Z' + DW Offset PEFunction_WipeBlock + + DB 1 + DW 2600h ; Alt 'L' + DW Offset PEFunction_AltL + + DB 1 + DW 1800h ; Alt 'O' + DW Offset PEFunction_BlockOverwrite + + DB 1 + DW 1900h ; Alt 'P' + DW Offset PEFunction_BlockPaste + + DB 1 + DW 2E00h ; Alt 'C' + DW Offset PEFunction_BlockCopy + + DB 1 + DW 3h ; Ctrl 'C' + DW Offset PEFunction_ToggleCentralise + + DB 0 + DW 146h ; Scroll Lock + DW Offset PEFunction_ToggleTrace + + DB 2 ; Alt Scroll Lock + DW 146h + DW Offset MIDIInputToggle + + DB 1 + DW 3200h ; Alt 'M' + DW Offset PEFunction_BlockMix + + DB 1 + DW 1000h ; Alt 'Q' + DW Offset PEFunction_SemiUp + + DB 1 + DW 1E00h ; Alt 'A' + DW Offset PEFunction_SemiDown + + DB 1 + DW 2D00h ; Alt 'X' + DW Offset PEFunction_WipeCommands + + DB 1 + DW 2400h ; Alt 'J' + DW Offset PEFunction_VolumeAmp + + DB 1 ; Ctrl... + DW 0Ah ; 'J' + DW Offset ToggleFastVolume + + DB 1 + DW 2F00h ; Alt 'V' + DW Offset PEFunction_BlockVolume + + DB 1 + DW 1100h ; Alt 'W' + DW Offset PEFunction_WipeExcessVolumes + + DB 1 + DW 1400h ; Alt 'T' + DW Offset PEFunction_ViewTrack + + DB 1 ; Ctrl... + DW 14h ; 'T' + DW Offset PEFunction_ToggleTracking + + DB 1 ; Ctrl... + DW 8h ; 'H' + DW Offset PEFunction_ToggleRowHilight + + DB 1 + DW 2300h ; Alt 'H' + DW Offset PEFunction_ToggleDivision + + DB 1 + DW 1300h ; Alt 'R' + DW Offset PEFunction_ClearViews + + DB 1 + DW 1500h ; Alt 'Y' + DW Offset PEFunction_BlockSwap + + DB 1 + DW 2200h ; Alt 'G' + DW Offset PEFunction_BlockHalve + + DB 1 + DW 2100h ; Alt 'F' + DW Offset PEFunction_BlockDouble + +; DB 0 +; DW 14Eh ; Grey Plus +; DW Offset PEFunction_NextPattern +; +; DB 0 +; DW 14Ah ; Grey Minus +; DW Offset PEFunction_LastPattern + + DB 4 ; Shift + DW 14Eh + DW Offset PEFunction_Next4Patterns + + DB 4 + DW 14Ah + DW Offset PEFunction_Last4Patterns + + DB 3 ; Ctrl.. + DW 14Eh ; Grey Plus + DW Offset PEFunction_NextOrderPattern + + DB 3 ; Ctrl.. + DW 14Ah ; Grey Minus + DW Offset PEFunction_LastOrderPattern + + DB 1 + DW '+' + DW Offset PEFunction_NextPattern + + DB 1 + DW '-' + DW Offset PEFunction_LastPattern + + DB 3 ; Ctrl + DW 141h ; F7 + DW Offset PEFunction_SetPlayMark + + DB 2 + DW 10Bh + DW Offset PEFunction_Alt0 + + DB 2 ; Alt Backspace + DW 10Eh + DW Offset PEFunction_RestoreData + + DB 2 ; Alt.. + DW 11Ch ; Enter + DW Offset PEFunction_StoreCurrentPattern + + DB 0 + DW 0B02h ; Left-Shift, Left-Ctrl '1' + DW Offset PEFunction_Ctrl_Shift1 + + DB 0 + DW 0B03h ; Left-Shift, Left-Ctrl '2' + DW Offset PEFunction_Ctrl_Shift2 + + DB 0 + DW 0B04h ; Left-Shift, Left-Ctrl '3' + DW Offset PEFunction_Ctrl_Shift3 + + DB 0 + DW 0B05h ; Left-Shift, Left-Ctrl '4' + DW Offset PEFunction_Ctrl_Shift4 + + DB 3 ; Ctrl.. + DW 10Bh ; '0' + DW Offset PEFunction_Ctrl0 + + DB 3 ; Ctrl... + DW 102h ; '1' + DW Offset PEFunction_Ctrl1 + + DB 3 ; Ctrl... + DW 103h ; '2' + DW Offset PEFunction_Ctrl2 + + DB 3 ; Ctrl... + DW 104h ; '3' + DW Offset PEFunction_Ctrl3 + + DB 3 ; Ctrl... + DW 105h ; '4' + DW Offset PEFunction_Ctrl4 + + DB 3 ; Ctrl... + DW 106h ; '5' + DW Offset PEFunction_Ctrl5 + + DB 1 + DW '\' + DW Offset PEFunction_Alt_F9 + + DB 0 + DW 135h + DW Offset PEFunction_MuteNext + + DB 1 + DW '?' + DW Offset PEFunction_MutePrevious + + DB 2 ; Alt + DW 143h ; F9 + DW Offset PEFunction_Alt_F9 + + DB 1 + DW '|' + DW Offset PEFunction_SoloGotoNext + + DB 2 ; Alt \ + DW 12Bh + DW Offset PEFunction_UnmuteAll + + DB 2 ; Alt + DW 144h ; F10 + DW Offset PEFunction_Alt_F10 + + DB 3 ; Ctrl + DW 140h ; F6 + DW Offset PE_PlayCurrentPosition + + DB 3 ; Ctrl + DW 13Ch ; F2 + DW Offset PE_SetPatternLength + + DB 1 ; Ctrl 'V' + DW 16h + DW Offset PE_ToggleDefaultVolume + + DB 1 ; Ctrl 'Z' + DW 1Ah + DW Offset PE_CycleMIDIPlayTrigger + + DB 6 ; MIDI message + DW 8000h + DW Offset PE_MIDINoteOff + + DB 6 ; MIDI message + DW 9000h + DW Offset PE_MIDINote + + DB 6 ; MIDI message + DW 0A000h + DW Offset PE_MIDIAftertouch + + DB 0FFh + +CursorPositions DB 0, 2, 4, 5, 7, 8, 10, 11, 12 + DB 0, 2, 3, 4, 5, 6, 7, 8, 9 + DB 0, 2, 3, 3, 4, 4, 5, 6, 6 + + DB 20h, 2, 1, 2, 1, 2, 0, 1, 2 + DB 10h, 1, 0, 1, 0, 1, 0, 1, 1 + +MaskChange DB 0, 0, 1, 1, 2, 2, 4, 4, 4 +ChannelMsg DB " Channel xx ", 0 +ChannelMsg2 DB "Channel xx", 0 +ChannelMsg3 DB " Chnl xx", 0 +ChannelMsg4 DB " xx", 0 +ChannelMsg5 DB "xx", 0 +ChannelMsg6 DB "Ch xx", 0 +ChannelMsg7 DB "Chnl xx", 0 + +NoteNames Label Byte + DB "C-C#D-D#E-F-F#G-G#A-A#B-" ; Cmaj +StartChannelEdit DW 5 + + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ +; Don't change order of variables within here!!!! + +KeySignature DW 0 +NumChannelsEdit DW 5 + +RowHiLight1 DB 4 +RowHiLight2 DB 16 + +EditMask DB 3 ; Bit 0 = ins + ; Bit 1 = vol + ; Bit 2 = commands +ViewDivision DB 1 +ViewWidth DW 0 +ViewChannels DW 100 Dup (0FFFFh) ; Contains channel/viewmethod +ViewChannelTracking DB 0 +CommandToValue DB 0 +CentraliseCursor DB 0E8h ; Bit 0 = centralise cursor + ; Bit 1 = hilight row + ; Bit 2 = fast volume changes + ; Bit 3 = Record tick base + ; Bit 4 = Program base 1 + ; Bit 5 = Record note off + ; Bit 6 = Record velocity + ; Bit 7 = Record aftertouch +MIDIAmplification DB 100 +MIDICentralNote DB 60 +FastVolumeAmplification DW 67 +Flags DB 0 ; Extra flags + ; Bit 0 = display defaults. + ; Bit 1 = Record note cuts. + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +ViewMethodInfo Label + DW Offset ViewFull + DW 13 ; Width + + DW Offset ViewCompress + DW 10 ; Width + + DW Offset ViewAllSmall + DW 7 + + DW Offset ViewNote + DW 3 + + DW Offset ViewTiny + DW 2 + +EmptyData DB 253, 0, 255, 0, 0 + +TempNumbers DB 3 Dup (0) + +ErrorMsg DB "Unable to allocate memory for pattern edit area.", 13, 10 + DB "Sorry, more conventional memory is required to run this program.", 13, 10, "$" + +ViewChannelTrackingMsg DB "View-Channel cursor tracking enabled", 0 +NoViewChannelTrackingMsg DB "View-Channel cursor tracking disabled", 0 +CentraliseCursorMsg DB "Centralise cursor enabled", 0 +NoCentraliseCursorMsg DB "Centralise cursor disabled", 0 +TraceMsg DB "Playback tracing enabled", 0 +NoTraceMsg DB "Playback tracing disabled", 0 +PanningControlSetMsg DB "Panning control set", 0 +VolumeControlSetMsg DB "Volume control set", 0 +NoRowHilightMsg DB "Row hilight disabled", 0 +RowHilightMsg DB "Row hilight enabled", 0 +NoFastVolumeMsg DB "Alt-I / Alt-J fast volume changes disabled", 0 +FastVolumeMsg DB "Alt-I / Alt-J fast volume changes enabled", 0 +FastVolumeNotEnabledMsg DB "Alt-I / Alt-J fast volume changes not enabled", 0 +DefaultVolumeOn DB "Default volumes enabled", 0 +DefaultVolumeOff DB "Default volumes disabled", 0 +MIDIInputDisabledMsg DB "MIDI Input Disabled", 0 +MIDIInputEnabledMsg DB "MIDI Input Enabled", 0 +MIDIInputEnabled DB 1 + +LastNote DB 60 +LastInstrument DB 1 +LastVolume DB 0FFh +LastCommand DB 0 +LastCommandValue DB 0 +TracePlayback DB 0 + +OrderListKeys Label + +IF ORDERSORT + DB 1 + DW 1300h ; Alt-R + DW Offset PE_PostOrderListReorder +ENDIF + + DB 0 + DW 10Fh + DW Offset PE_PostOrderList20 + + DB 1 + DW 0F00h + DW Offset PE_PostOrderList21 + + DB 3 ; Ctrl-F7 + DW 141h + DW Offset PE_PostOrderListNextOrder + + DB 1 ; Spacebar + DW ' ' + DW Offset PE_PostOrderListNextOrder + + DB 0 + DW 1C8h ; Up + DW Offset PE_PostOrderList1 + + DB 0 + DW 1D0h ; Down + DW Offset PE_PostOrderList3 + + DB 0 + DW 1C9h ; PgUp + DW Offset PE_PostOrderList4 + + DB 0 + DW 1D1h ; PgDn + DW Offset PE_PostOrderList6 + + DB 0 + DW 1CBh ; Left + DW Offset PE_PostOrderList7 + + DB 0 + DW 1CDh ; Right + DW Offset PE_PostOrderList9 + + DB 5 + DW 'G' + DW Offset PE_PostOrderList24 + + DB 1 + DW '-' + DW Offset PE_PostOrderList16 + + DB 1 + DW '+' + DW Offset PE_PostOrderList17 + + DB 0 + DW 1D3h ; Insert + DW Offset PE_PostOrderList18 + + DB 0 + DW 1D2h ; Delete + DW Offset PE_PostOrderList19 + + DB 0 + DW 1CFh ; End + DW PE_PostOrderListEndKey + + DB 0 + DW 1C7h + DW PE_PostOrderListHomeKey + + DB 5 + DW 'N' + DW PE_PostOrderList22 + + DB 0FFh + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Functions ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Proc PE_ConvAX2Num Far ; ES:DI points to screen + ; CH = colour + ; AX = number + + Push AX + Push BX + Push DX + + Mov BX, 10 + + And AX, AX + JNS PE_ConvAX2Num1 + + Mov Byte Ptr [ES:DI], '-' + Inc DI + Neg AX + Mov [ES:DI], CH + Inc DI + Jmp PE_ConvAX2Num2 + +PE_ConvAX2Num1: + Xor DX, DX + Div BX + Add DL, '0' + Mov DH, CH + Mov [ES:DI+4], DX + +PE_ConvAX2Num2: + Xor DX, DX + Div BX + Add DL, '0' + Mov DH, CH + Mov [ES:DI+2], DX + + Xor DX, DX + Div BX + Add DL, '0' + Mov DH, CH + Mov [ES:DI], DX + + Pop DX + Pop BX + Pop AX + + Ret + +EndP PE_ConvAX2Num + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_ConvHexAL Near + + Cmp AL, 10 + SBB AL, 69h + DAS + StosW + + Ret + +EndP PE_ConvHexAL + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_GetMaxOrder Far ; Returns AX with max order + + Push CX + Push ES + Push DI + + Call Music_GetSongSegment + Mov ES, AX + Mov DI, 256 + Mov CX, 257 + Mov AL, 0FFh + RepNE ScasB + Mov AX, 256 + Sub AX, CX + + And AX, AX + JZ PE_GetMaxOrder1 + + Dec AX + +PE_GetMaxOrder1: + Pop DI + Pop ES + Pop CX + + Ret + +EndP PE_GetMaxOrder + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ClearEncodingInfo ; Encoding info + ; 1.Mask, 2.Instrument, 3.Volume, 4.Cmd + ; 5.CmdVal, 6.Note + + Push CS + Pop ES + + Mov DI, Offset EncodingInfo + + Mov CX, 64 + +ClearEncodingInfo1: + Mov AX, NONOTE*100h ; Mask&Note + StosW + Mov AH, 0FFh ; Ins&Vol + StosW + Xor AX, AX ; Cmd&Value + StosW + + Loop ClearEncodingInfo1 + + Ret + +EndP ClearEncodingInfo + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +IF ORDERSORT + +Proc PE_PostOrderListSwapPatterns ; Given BX = pattern 1 + ; DX = Pattern 2 + + PushA + + Mov AX, CS:PatternNumber + + Cmp AX, BX + JNE PE_PostOrderListSwapPatterns1 + Mov AX, DX + Jmp PE_PostOrderLIstSwapPatterns2 + +PE_PostOrderListSwapPatterns1: + Cmp AX, DX + JNE PE_PostOrderListSwapPatterns2 + Mov AX, BX + +PE_PostOrderListSwapPatterns2: + Mov CS:PatternNumber, AX + +; Search through order list and swap BX with DX + + Mov SI, 100h + Mov CX, SI + +PE_PostOrderListSwapPatterns3: + LodsB + + Cmp AL, BL + JNE PE_PostOrderListSwapPatterns4 + + Mov [SI-1], DL + Jmp PE_PostOrderListSwapPatterns5 + +PE_PostOrderListSwapPatterns4: + Cmp AL, DL + JNE PE_PostOrderListSwapPatterns5 + + Mov [SI-1], BL + +PE_PostOrderListSwapPatterns5: + Loop PE_PostOrderListSwapPatterns3 + +; Now swap memory references to patterns. + + LEA BX, [EBX*4+63912] + LEA DI, [EDX*4+63912] + + Mov EAX, [BX] + XChg EAX, [DI] + Mov [BX], EAX + +; Finished! + + PopA + Ret + +EndP PE_PostOrderListSwapPatterns + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_PostOrderListReorder Far + + EnsureNoNetwork + + Call Music_Stop + + Call Music_GetSongSegment + Mov DS, AX ; DS:100h = order list. + ; DS:63912 (4) = pattern data + Mov SI, 100h + Xor DX, DX ; DX = min pattern + Mov CX, SI + Xor BX, BX + +PE_PostOrderListReorder1: + LodsB + Cmp AL, 200 + JAE PE_PostOrderListReorder2 + + Cmp AL, DL + JB PE_PostOrderListReorder2 + JE PE_PostOrderListReorder3 + + Mov BL, AL + Call PE_PostOrderListSwapPatterns + +PE_PostOrderListReorder3: + Inc DX + +PE_PostOrderListReorder2: + Loop PE_PostOrderListReorder1 + +PE_PostOrderListReorderExit: + Mov AX, 1 + Ret + +EndP PE_PostOrderListReorder + Assume DS:Nothing + +ENDIF ; ORDERSORT + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_ResetOrderPattern Far + + Push CS + Pop DS + Assume DS:Pattern + + Xor AX, AX + Mov Order, AX + Mov OrderCursor, AX + Mov Channel, AX + Mov PatternCursor, AX + Mov LastInstrument, 1 + Mov PlayMarkOn, 0 + + Mov BX, AX + + Call Music_GetSongSegment + Mov ES, AX + MovZX AX, Byte Ptr [ES:BX+256] + + Cmp AX, 199 + JBE PE_ResetOrderPattern1 + + Xor AX, AX + +PE_ResetOrderPattern1: + Mov PatternNumber, AX + Call NewPattern + Mov Word Ptr [CS:Modified], 0 + + Call Music_InitMixTable ; Here 'cos it's called + ; on file loading. + Call Music_InitMuteTable ; ditto. + Call Music_InitStereo + Call Music_SoundCardLoadAllSamples + Call PE_ClearUndoBuffer + + Mov AX, Inst + Mov DS, AX + Assume DS:Inst + Mov NodeHeld, 0 + Mov InstrumentEdit, 0 + + Ret + +EndP PE_ResetOrderPattern + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_GetMaxPattern Far ; Assumes DS:SongData + + Push CX + Push DS + Push SI + Push DI + + Call Music_GetSongSegment + Mov DS, AX + + Mov SI, 63912 + + Xor AX, AX + Xor DI, DI + Mov CX, 200 + +PE_GetMaxPattern1: + Cmp Word Ptr [SI], 0 + JE PE_GetMaxPattern2 + + Mov AX, DI + +PE_GetMaxPattern2: + Inc DI + Add SI, 4 + Loop PE_GetMaxPattern1 + + Pop DI + Pop SI + Pop DS + Pop CX + Ret + +EndP PE_GetMaxPattern + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_FillHeader Far + + Call Music_GetSongSegment + Mov DS, AX + Call S_GetDestination + Mov SI, 4 + Mov DI, (12+3*80)*2 + Mov CX, 25 + Mov AH, 5 + +PE_FillHeader1: + LodsB + Cmp AL, 226 + JB PE_FillHeader14 + + Mov AL, ' ' + +PE_FillHeader14: + StosW + Loop PE_FillHeader1 + + Push DS + + Mov AX, Disk + Mov DS, AX + Mov SI, Offset FileName + Mov DI, (12+4*80)*2 + Mov AH, 5 + +PE_FillHeader11: + LodsB + StosW + And AL, AL + JNZ PE_FillHeader11 + + Pop DS + + Mov CH, AH + Mov AX, Order + Mov DI, (12+5*80)*2 + Call PE_ConvAX2Num + + Call PE_GetMaxOrder + Mov DI, (16+5*80)*2 + Call PE_ConvAX2Num + + Mov AX, PatternNumber + Mov DI, (12+6*80)*2 + Call PE_ConvAX2Num + + Call PE_GetMaxPattern + Mov DI, (16+6*80)*2 + Call PE_ConvAX2Num + + Mov AX, Row + Mov DI, (12+7*80)*2 + Call PE_ConvAX2Num + + Mov AX, MaxRow + Mov DI, (16+7*80)*2 + Call PE_ConvAX2Num + + Call Glbl_GetHeaderMode + ; AL = inst + ; AH = mode. + Mov DI, (50+3*80)*2 + And AL, AL + JNZ PE_FillHeader6 + + Mov AX, 5*256+'.' + StosW + StosW + ScasW +; Add DI, 2 + Mov AL, '.' + Mov CX, 25 + Rep StosW + Jmp PE_FillHeader7 + +PE_FillHeader6: + Push AX + + Mov DL, 10 + Xor AH, AH + Mov CX, AX + Div DL + Add AX, 3030h + Mov DL, AH + Mov AH, 5 + StosW + Mov AL, DL + StosW + ScasW +; Add DI, 2 + + Pop AX + + Dec CX + And AH, AH ; CX = ins number + JZ PE_FillHeader8 + + ; Complex instrument mode + Mov AX, 554 + Mul CX + Add AX, 544 + Jmp PE_FillHeader9 + +PE_FillHeader8: ; Simple instrument mode + Mov AX, 80 + Mul CX + Add AX, 55932 + +PE_FillHeader9: + Mov SI, AX + Mov CX, 25 + Mov AH, 5 + +PE_FillHeader10: + LodsB + Cmp AL, 226 + JB PE_FillHeader13 + + Mov AL, ' ' + +PE_FillHeader13: + StosW + Loop PE_FillHeader10 + +PE_FillHeader7: +; Mov AL, LastVolume + + Call PE_FillSpeedTempo + +; Cmp AL, 0FFh +; JNE PE_FillHeader4 +; +; Mov AX, 5*256+'.' +; StosW +; StosW +; Jmp PE_FillHeader5 +; +;PE_FillHeader4: +; Xor AH, AH +; Mov CL, 10 +; Div CL +; Add AX, 3030h +; Mov DL, AH +; Mov AH, 5 +; StosW +; Mov AL, DL +; StosW + +PE_FillHeader5: + Mov AX, BaseOctave + Add AL, '0' + Mov AH, 5 + Mov [ES:((50+5*80)*2)], AX + +; Mov AH, 48h +; Mov BX, 0FFFFh +; Int 21h +; Mov AX, BX +; Mov CX, 2006h +; ShR AX, CL +; Mov DI, (71+6*80)*2 +; Call PE_ConvAX2Num +; +; Call E_GetFreeEMS +; Xor DX, DX +; Mov BX, 1000 +; Div BX +; +; Add AL, '0' +; Mov AH, CH +; Mov [ES:(70+7*80)*2], AX +; Mov AX, DX +; Mov DI, (71+7*80)*2 +; Call PE_ConvAX2Num + + +; Call K_GetCaps +; Mov AH, 21h +; And AL, AL +; JZ PE_FillHeader2 +; +; Mov AH, 23h +; +;PE_FillHeader2: +; Mov DI, (75+10*80)*2 +; Mov SI, Offset CapsMsg +; Mov CX, 4 +; +;PE_FillHeader3: +; SegCS LodsB +; StosW +; Loop PE_FillHeader3 + + Call UpdateInfoLine + + Ret + +EndP PE_FillHeader + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_FillSpeedTempo Far + + Call S_GetDestination + + Call Music_GetDisplayVariables ; AX = current speed. + Mov CH, 5 + Mov DI, (50+4*80)*2 + Call PE_ConvAX2Num + + Mov AX, BX + Mov DI, (54+4*80)*2 + Call PE_ConvAX2Num + + Ret + +EndP PE_FillSpeedTempo + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_DrawOrderList Far + + Mov AL, 80 + Mul Byte Ptr [SI+3] + Add AL, [SI+2] + AdC AH, 0 + Add AX, AX + Mov DI, AX + Mov CX, [SI+4] + + Push CS + Pop DS + Assume DS:Pattern + + Mov AX, TopOrder ; Bounds checking... + Mov BX, Order + Cmp AX, BX + JBE PE_DrawOrderList1 + + Mov AX, BX + +PE_DrawOrderList1: + Mov DX, AX + Add DX, CX + Cmp DX, BX + JA PE_DrawOrderList2 + + LEA AX, [BX+1] + Sub AX, CX + +PE_DrawOrderList2: + Mov TopOrder, AX + Mov BX, AX + + Call S_GetDestination + Push CX + Push DI + +PE_DrawOrderList3: + Push CX + + Mov CH, 20h + Call PE_ConvAX2Num + + Add DI, 160 + Inc AX + + Pop CX + Loop PE_DrawOrderList3 + + Pop DI + Pop CX + Add DI, 8 ; BX = toporder, DI = order area + + Call Music_GetSongSegment + Mov DS, AX + Add BX, 256 + +PE_DrawOrderList4: + Push CX + + Mov CH, 2 + MovZX AX, Byte Ptr [BX] + Cmp AX, 0FEh + JB PE_DrawOrderList5 + + Mov CL, '-' + Cmp AL, 0FEh + JNE PE_DrawOrderList7 + + Mov CL, '+' + +PE_DrawOrderList7: + Mov AX, CX + StosW + StosW + StosW + Sub DI, 6 + + Jmp PE_DrawOrderList6 + + +PE_DrawOrderList5: + Call PE_ConvAX2Num + +PE_DrawOrderList6: + Pop CX + Inc BX + Add DI, 160 + Loop PE_DrawOrderList4 + + Call Music_GetPlayMode + Cmp AX, 2 + JNE PE_DrawOrderList8 + + Jmp PE_ShowOrder + +PE_DrawOrderList8: + Ret + +EndP PE_DrawOrderList + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_PreOrderList Far + + Mov AL, 80 + Mov BX, Order + Sub BX, TopOrder + Add BL, [SI+3] + Mul BL + Add AL, [SI+2] + AdC AH, 0 + Add AX, 4 + Add AX, OrderCursor + Add AX, AX + Mov DI, AX + + Call S_GetDestination + Inc DI + Mov Byte Ptr [ES:DI], 30h + + Ret + +EndP PE_PreOrderList + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc NetworkOrderList Near + +IF NETWORKENABLED + Call Network_GetSendQueue + JZ NetworkOrderList1 + + Mov AX, NETWORK_SONGDATAOBJECT*100h ; Destination ALL + StosW + Mov AX, 256 + StosW + StosW + +NetworkOrderList1: + Call Network_FinishedSendQueue +ENDIF + Ret + +EndP NetworkOrderList + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_PostOrderList Far + + Push ES + Pop DS + Mov SI, [BX] + + Push BX + + Mov AL, 80 + Mov BX, Order + Sub BX, TopOrder + Add BL, [SI+3] + Mul BL + Add AL, [SI+2] + AdC AH, 0 + Add AX, 4 + + Pop BX + +; Push ES +; Push DI + + Push CS + Pop DS + Assume DS:Pattern + + Push ES + Pop FS + + Call Music_GetSongSegment + Mov ES, AX + + Mov SI, Offset OrderListKeys + Call M_FunctionDivider + Mov AX, Order + JC PE_NoKeyFound + + Jmp [SI] + +PE_NoKeyFound: + Test CH, Not 1 + JNZ PE_PostOrderList10 + + Cmp DX, '0' + JB PE_PostOrderList10 + + Cmp DX, '9' + JBE PE_PostOrderList11 + +PE_PostOrderList10: + Xor AX, AX + Ret + +PE_PostOrderListNextOrder: + Call Music_GetPlayMode + Cmp AX, 2 + JNE PE_PostOrderListNextOrderEnd + + Mov AX, Order + Mov SI, Offset NextOrderMsg + Call SetInfoLine + + Call Music_SetNextOrder + +PE_PostOrderListNextOrderEnd: + Mov AX, 1 + Ret + +PE_PostOrderListHomeKey: + Mov Order, 0 + Jmp PE_PostOrderList2 + +PE_PostOrderListEndKey: + Call Music_GetSongSegment + Mov DS, AX + Mov SI, 100h + +PE_PostOrderListEndKeyLoop: + LodsB + Cmp AL, 0FFh + JE PE_postOrderListEndKeyLoopEnd + + Cmp SI, 100h+255 + JBE PE_PostOrderListEndKeyLoop + +PE_PostOrderListEndKeyLoopEnd: + Sub SI, 101h + Mov CS:Order, SI + + Jmp PE_PostOrderList2 + +PE_PostOrderList20: + Push FS + Pop DS + Mov SI, [BX] + + Mov AX, [SI+6] + Mov [DI], AX + Jmp PE_PostOrderList2 + +PE_PostOrderList21: + Push FS + Pop DS + Mov SI, [BX] + + Mov AX, [SI+8] + Mov [DI], AX + Jmp PE_PostOrderList2 + +PE_PostOrderList1: ; Up + And AX, AX + JZ PE_PostOrderList2 + + Dec AX + Mov Order, AX + +PE_PostOrderList2: + Mov AX, 1 + Ret + +PE_PostOrderList3b: + Call NetworkOrderList + +PE_PostOrderList3: ; Down + Cmp AX, 255 + JAE PE_PostOrderList2 + Inc AX + Mov Order, AX + Jmp PE_PostOrderList2 + +PE_PostOrderList4: ; PgUp + Sub AX, 16 + JNS PE_PostOrderList5 + + Xor AX, AX + +PE_PostOrderList5: + Mov Order, AX + Jmp PE_PostOrderList2 + +PE_PostOrderList6: ; PgDn + Add AX, 16 + And AH, AH + JZ PE_PostOrderList5 + + Mov AX, 255 + Jmp PE_PostOrderList5 + +PE_PostOrderList7: ; Left + Mov AX, OrderCursor + Dec AX + JNS PE_PostOrderList8 + + Mov AX, 2 + +PE_PostOrderList8: + Mov OrderCursor, AX + Jmp PE_PostOrderList2 + +PE_PostOrderList9: ; Right + Mov AX, OrderCursor + Inc AX + Cmp AX, 2 + JBE PE_PostOrderList8 + + Xor AX, AX + Jmp PE_PostOrderList8 + +PE_PostOrderList11: + Mov SI, AX + MovZX AX, Byte Ptr [ES:SI+256] ; AX = pattern number + Cmp AL, 199 + JBE PE_PostOrderList15 + + Xor AL, AL + +PE_PostOrderList15: ; Number + Mov CL, 10 + Div CL + Mov [TempNumbers+2], AH + Xor AH, AH + Div CL + Mov [TempNumbers+1], AH + Xor AH, AH + Div CL + Mov [TempNumbers], AH + + Mov BX, OrderCursor + Sub DX, '0' + Mov TempNumbers[BX], DL + + Mov AL, [TempNumbers] + Mul CL + Add AL, [TempNumbers+1] + Mul CL + Add AL, [TempNumbers+2] + + Cmp AX, 199 + JBE PE_PostOrderList12 + + Mov AX, 199 + +PE_PostOrderList12: + Mov [ES:SI+256], AL + Call NetworkOrderList + + Inc BX + Cmp BX, 2 + JBE PE_PostOrderList13 + + Cmp SI, 255 + JE PE_PostOrderList2 + + Xor BX, BX + Inc Order + +PE_PostOrderList13: + Mov OrderCursor, BX + Jmp PE_PostOrderList2 + + +PE_PostOrderList16: ; '-' + Mov SI, AX + Mov Byte Ptr [ES:SI+256], 0FFh + Mov OrderCursor, 0 + + Jmp PE_PostOrderList3b + +PE_PostOrderList17: ; '+' + Mov SI, AX + Mov Byte Ptr [ES:SI+256], 0FEh + Mov OrderCursor, 0 + + Jmp PE_PostOrderList3b + +PE_PostOrderList18: ; Del + Mov SI, AX + Add SI, 256 + Mov DI, SI + Inc SI + + Push ES + Pop DS + + Mov CX, 512 + Sub CX, SI + Rep MovsB + Mov AL, 0FFh + StosB + + Call NetworkOrderList + Jmp PE_PostOrderList2 + +PE_PostOrderList19: ; Ins + Mov CX, 255 + Mov DI, 511 + Mov SI, DI + Sub CX, AX + Dec SI + + Push ES + Pop DS + + StD + Rep MovsB + ClD + Mov AL, 0FFh + StosB + + Call NetworkOrderList + Jmp PE_PostOrderList2 + +PE_PostOrderList22: + Mov SI, Order + And SI, SI + JZ PE_PostOrderList23 + + Mov AL, [ES:SI+255] + Cmp AL, 198 + JA PE_PostOrderList23 + + Inc AX + Mov [ES:SI+256], AL + + Mov AX, SI + Jmp PE_PostOrderList3b + +PE_PostOrderList23: + Xor AX, AX + Ret + +PE_PostOrderList24: ; 'G' + Mov BX, AX + MovZX AX, Byte Ptr [ES:BX+256] + Cmp AL, 200 + JAE PE_PostOrderList23 + + Jmp PE_GotoPattern2 + +EndP PE_PostOrderList + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_UnInitPatternEdit Far + + Mov AX, CS:BlockDataArea + And AX, AX + JZ PE_UnInitPatternEdit1 + + Mov ES, AX + Mov AH, 49h + Int 21h + +PE_UnInitPatternEdit1: + Call PE_ClearUndoBuffer + + Ret + +EndP PE_UnInitPatternEdit + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_ClearPatternData + + Push CX DX DS SI ES DI + + Push CS + Pop DS + Assume DS:Pattern + + Mov ES, PatternDataArea + Xor DI, DI + + Mov DX, 200 + +PE_ClearPatternData1: + Mov CX, 320/4 + Mov SI, Offset EmptyRow + Rep MovsD + + Dec DX + JNZ PE_ClearPatternData1 + + Pop DI ES SI DS DX CX + Ret + +EndP PE_ClearPatternData + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_InitPatternEdit Far + + Trace " - Initialising pattern data area" + + Call PE_ClearPatternData + Ret + +EndP PE_InitPatternEdit + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +include it_pe_v.inc + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_DrawPatternEdit Far + + Push CS + Pop DS + Assume DS:Pattern + + Cmp TracePlayback, 0 + JE PE_TraceOff + + Call Music_GetPlayMode ; AX = playmode + ; BX = current row + ; CX = current pattern + ; DX = order. + Cmp AX, 1 + JB PE_TraceOff + JE PE_NoTraceOrder + + Mov Order, DX + +PE_NoTraceOrder: + Cmp BX, Row + JE PE_SetMIDIChannel + + Mov AX, Channel + Mov MIDIChannel, AX + + Mov Row, BX + +PE_SetMIDIChannel: + Cmp CX, PatternNumber + JE PE_TraceOff + + Push CX ; Pattern number + Push CS + Push Offset PE_TraceTurnOffError + + Cmp PatternModified, 0 + JE PE_NoStoreRequired + + Call PEFunction_StorePattern + +PE_NoStoreRequired: + Pop AX + Pop AX + Pop AX + + Mov PatternNumber, AX + Call NewPattern + Jmp PE_TraceOff + +PE_TraceTurnOffError: + Pop AX + +PE_TraceTurnOff: + Mov CS:TracePlayback, 0 + +PE_TraceOff: + Push CS + Pop DS + + Call S_GetDestination + Mov AL, Template + Cmp AL, 1 + JB PE_DrawPAtternEdit30 + + Mov SI, Offset TemplateMsg1 + JE PE_DrawPatternEdit31 + + Mov SI, Offset TemplateMsg2 + Cmp AL, 3 + JB PE_DrawPatternEdit31 + + Mov SI, Offset TemplateMsg3 + JE PE_DrawPatternEdit31 + + Mov SI, Offset TemplateMsg4 + +PE_DrawPatternEdit31: + Mov DI, (2+12*80)*2 + Mov AH, 23h + Call S_DrawString + +PE_DrawPatternEdit30: + Test CentraliseCursor, 1 + JZ PE_NoCentraliseCursor + + Call PE_CentraliseCursor + +PE_NoCentraliseCursor: + Mov AX, MaxRow + Cmp AX, Row + JAE PE_DrawPatternEdit27 + + Mov Row, AX + +PE_DrawPatternEdit27: + Mov BX, BlockTop + Cmp BX, AX + JLE PE_DrawPatternEdit28 + + Mov BlockTop, AX + +PE_DrawPatternEdit28: + Mov BX, BlockBottom + Cmp BX, AX + JLE PE_DrawPatternEdit29 + + Mov BlockBottom, AX + +PE_DrawPatternEdit29: + Mov BX, ViewWidth + Test BX, BX + JZ PE_DrawPatternEdit1 + + Mov CX, 3 + Cmp NumChannelsEdit, 0 + JE PE_DrawPatternEditNoEditChannels + + Xor CX, CX + +PE_DrawPatternEditNoEditChannels: + Mov AX, 1 + Add AX, CX + Push AX + Push 14 + Mov AX, BX + Add AX, CX + Push AX + Push 47 + Push 27 + Call S_DrawBox + Add SP, 10 + +PE_DrawPatternEdit1: + Cmp NumChannelsEdit, 0 + JE PE_DrawPatternEdit34 + + Mov CX, 4 + Add CX, BX + Push CX + Mov AX, 14 + Push AX + Mul NumChannelsEdit + Add AX, CX + Push AX + Push 47 + Push 27 + Call S_DrawBox + Add SP, 10 + + Mov AX, LeftChannel + Mov CX, Channel + + Cmp AX, CX + JLE PE_DrawPatternEdit21 + + Mov AX, CX + +PE_DrawPatternEdit21: + Mov DX, AX + Add DX, NumChannelsEdit + Cmp DX, CX + JG PE_DrawPatternEdit22 + + Mov AX, CX + Sub AX, NumChannelsEdit + Inc AX + +PE_DrawPatternEdit22: + Mov LeftChannel, AX + ; Channel markers. + Mov DX, AX ; DL = left channel + Mov AX, 5+14*80 + Add AX, ViewWidth + Add AX, AX + Mov DI, AX + Mov DH, 10 + + Mov CX, NumChannelsEdit + +PE_DrawPatternEdit23: + Push CX + + MovZX AX, DL + Inc AX + Div DH + Add AX, 3030h + Mov SI, Offset ChannelMsg + Mov [SI+9], AX + + Push DS + Push SI + + Call Music_GetSongSegment + Mov DS, AX + + Mov SI, DX + And SI, 0FFh + Add SI, 40h + Mov AH, 13h + Test Byte Ptr [SI], 80h + JZ PE_DrawPatternEdit32 + + Mov AH, 10h + +PE_DrawPatternEdit32: + Pop SI + Pop DS + + Mov CX, 12 + +PE_DrawPatternEdit24: + LodsB + StosW + Loop PE_DrawPatternEdit24 + + Pop CX + Add DI, 4 + Inc DX + Loop PE_DrawPatternEdit23 + +PE_DrawPatternEdit34: + Cmp ViewChannelTracking, 0 + JE PE_DrawPatternEditNormal + + ; OK.. using view windows ONLY. + ; now to perform scrolling if necessary. + Mov SI, Offset ViewChannels + Mov DL, [SI] + + Cmp DL, 0FFh + JE PE_DrawPatternEditNormal + + Mov DH, DL ; DL = min channel, DH = max channel + Mov CX, Channel ; Also check + +PE_DrawPatternViewChannelOnly1: + LodsW + + Cmp AL, CL + JE PE_DrawPatternEditNormalJP + + Cmp AL, 0FFh + JE PE_DrawPatternViewChannelOnly2 + + Cmp AL, DL + JB PE_DrawPatternViewChannelOnly3 + + Cmp AL, DH + JA PE_DrawPatternViewChannelOnly4 + + Jmp PE_DrawPatternViewChannelOnly1 + +PE_DrawPatternViewChannelOnly3: + Mov DL, AL + Jmp PE_DrawPatternViewChannelOnly1 + +PE_DrawPatternViewChannelOnly4: + Mov DH, AL + Jmp PE_DrawPatternViewChannelOnly1 + +PE_DrawPatternEditNormalJP: + Jmp PE_DrawPatternEditNormal + +PE_DrawPatternViewChannelOnly2: ; OK.. so channel is not in list, + ; DL = min channel, DH = max channel. + Mov CH, CL + Sub CH, DH ; CH = curchannel-maxchannel + + Cmp DH, CL + JBE PE_DrawPatternViewChannelOnly5 + + Mov CH, CL + Sub CH, DL + +PE_DrawPatternViewChannelOnly5: ; CH = modifier. + + Mov SI, Offset ViewChannels + +PE_DrawPatternViewChannelOnly6: + LodsW + Cmp AL, 0FFh + JE PE_DrawPatternEditNormal + + Add AL, CH + JS PE_DrawPatternViewChannelOnly7 + + Cmp AL, 63 + JBE PE_DrawPatternViewChannelOnly8 + + Mov AL, 63 + Jmp PE_DrawPatternViewChannelOnly8 + +PE_DrawPatternViewChannelOnly7: + Xor AL, AL + +PE_DrawPatternViewChannelOnly8: + Mov [SI-2], AL + Jmp PE_DrawPatternViewChannelOnly6 + +PE_DrawPatternEditNormal: + Mov AX, TopRow + Mov CX, Row + + Cmp AX, CX + JLE PE_DrawPatternEdit2 + + Mov AX, CX ; if row < toprow, toprow = row + +PE_DrawPatternEdit2: + LEA DX, [EAX+32] + Cmp DX, CX + JG PE_DrawPatternEdit3 + + LEA AX, [ECX-31] + +PE_DrawPatternEdit3: + Mov TopRow, AX + + Mov CX, MaxRow + Sub CX, 31 + Cmp AX, CX + JBE PE_DrawPatternEdit35 + + Mov TopRow, CX + Mov AX, CX + +PE_DrawPatternEdit35: + Mov DI, (1+15*80)*2 + Cmp NumChannelsEdit, 0 + JNE PE_DrawPatternEditAllView + + Xor BX, BX + +PE_DrawPatternEditAllView: + LEA DI, [EDI+EBX*2] + + Xor BX, BX + Cmp PlayMarkOn, 0 + JE PE_DrawPlayMark + + Mov CX, PlayMarkPattern + Cmp CX, PatternNumber + JNE PE_DrawPlayMark + + Mov BX, 1 ; Check to draw playmark + +PE_DrawPlayMark: + Push DI + + Mov DX, 32 + +PE_DrawPatternEdit4: + Push DI + + Mov CH, 20h + And BX, BX + JZ PE_DrawPatternEditRowNumber + + Cmp AX, PlayMarkRow + JNE PE_DrawPatternEditRowNumber + + Mov CH, 0B0h + +PE_DrawPatternEditRowNumber: + Call PE_ConvAX2Num + + Pop DI + Inc AX + Add DI, 160 + + Dec DX + JNZ PE_DrawPatternEdit4 + + Mov BX, Offset NoteNames ; CS:BX points to notenames + + Push DS + ; Viewing columns... + Mov SI, Offset ViewChannels + Mov DI, (15*80+2)*2 + Cmp NumChannelsEdit, 0 + JNE PE_DrawviewColumnStart + + Add DI, 6 + +PE_DrawViewColumnStart: + LodsW + Cmp AL, 0FFh + JE PE_DrawViewColumn2 + +PE_DrawViewColumn1: + ; AL = channel, AH = view method. + Mov DL, AL + MovZX CX, AH + LEA BP, [ViewMethodInfo+ECX*4] + + Push DS + Push SI + Push ES + Push DI + Push BP + + Mov SI, 5 + Xor AH, AH + Push DX + Mul SI + Mov SI, AX + Mov AX, 320 + Mov CX, TopRow + Mul CX + Pop DX + Mov DS, PatternDataArea + Add SI, AX ; DS:SI points to appropriate data. + ; CS:BX points to note type. + ; ES:DI points to screen area. + ; DL = Channel number + ; CX = Row number + + Call [Near Ptr CS:BP] + + Pop BP + Pop DI + Pop ES + Pop SI + Pop DS + + LodsW + Cmp AL, 0FFh + JE PE_DrawViewColumn2 + + Push AX + + Mov CX, [CS:BP+2] + Add DI, CX + Add DI, CX + + Cmp ViewDivision, 0 + JE PE_DrawViewColumn4 + + Mov CX, 32 + Push DI + + Mov AX, 2A8h + +PE_DrawViewColumn3: + StosW + Add DI, 158 + Loop PE_DrawViewColumn3 + + Pop DI + StosW ; Just to do: Add DI, 2 + +PE_DrawViewColumn4: + Pop AX + Jmp PE_DrawViewColumn1 + +PE_DrawViewColumn2: + Pop DS + Pop DI + Add DI, 8 + + Cmp NumChannelsEdit, 0 + JE PE_DrawPatternHilightRow + +PE_DrawPatternEdit33: + Mov AX, 320 + Mov BP, TopRow + Mul BP + Mov SI, AX + Mov AX, 5 + Mul LeftChannel + Add SI, AX ; SI contains offset to channel data + Mov DX, NumChannelsEdit + + Mov CX, 32 ; 32 rows + Mov DS, PatternDataArea + Assume DS:Nothing + +PE_DrawPatternEdit5: + Push CX + Push DX + Push SI + Push DI + Push BP + + Mov CX, 60Ch + + Mov AX, BP + Cmp RowHiLight2, 0 + JZ PE_DrawPatternEdit8 + Div RowHiLight2 + And AH, AH + JNZ PE_DrawPatternEdit8 + + Mov CH, 0E6h + Jmp PE_DrawPatternEdit6 + +PE_DrawPatternEdit8: + Mov AX, BP + Cmp RowHiLight1, 0 + JZ PE_DrawPatternEdit6 + Div RowHiLight1 + And AH, AH + JNZ PE_DrawPatternEdit6 + + Mov CH, 0F6h + +PE_DrawPatternEdit6: ; CH = colour, CL = 12 (for division) + Push CX + Push DX + + Cmp CS:BlockMark, 0 + JE PE_DrawPatternEdit25 + + Cmp BP, CS:BlockTop + JB PE_DrawPatternEdit25 + + Cmp BP, CS:BlockBottom + JA PE_DrawPatternEdit25 + + Mov AX, CS:LeftChannel + Add AX, CS:NumChannelsEdit + Sub AX, DX + + Cmp AX, CS:BlockLeft + JB PE_DrawPatternEdit25 + + Cmp AX, CS:BlockRight + JA PE_DrawPatternEdit25 + + Test CH, 80h + JZ PE_DrawPatternEdit26 + + Mov CH, 93h + Jmp PE_DrawPatternHilight1 + +PE_DrawPatternEdit26: + Mov CH, 83h + Jmp PE_DrawPatternHilight1 + +PE_DrawPatternEdit25: + Cmp BP, Row + JNE PE_DrawPatternHilight1 + + Test CentraliseCursor, 2 + JZ PE_DrawPatternHilight1 + + Mov CH, 016h + +PE_DrawPatternHilight1: + LodsB + + Call Draw_3Note + + Mov AL, 20h + StosW ; Note->Instrument space + + Mov DL, 10 + LodsB + + Call Draw_2Instrument + + Mov AL, 20h + StosW + + LodsB + Cmp AL, 0FFh + JNE PE_DrawPattern16 + + Test CS:Flags, 1 + JZ PE_DrawPatternNoDefaultVolume + + Cmp Byte Ptr [SI-3], MAXNOTE + JA PE_DrawPatternNoDefaultVolume + Cmp Byte Ptr [SI-2], 0 + JE PE_DrawPatternNoDefaultVolume + + Sub DI, 2 + Mov AL, 191 + StosW + + Push BX + + Call Music_GetSongSegment + Mov FS, AX + Mov BL, [SI-2] ; Sample/Instrument + And BX, 0FFh + Add BX, BX + + Test Byte Ptr [FS:2Ch], 4 ; Sample mode? + JZ DefaultVolumeSample + +DefaultVolumeInstrument: + Push DI + + Mov BX, [FS:64710+BX] ; Instrument pointer + Mov DI, [SI-3] + And DI, 0FFh ; DI = Note + Add DI, DI + Mov BX, [FS:BX+DI+41h] ; BL = sample + + Pop DI + And BX, 0FFh + Add BX, BX + JZ DefaultVolumeNoSample + +DefaultVolumeSample: + Mov BX, [FS:64910+BX] ; Sample + Mov AL, [FS:BX+13h] ; Default volume + + Pop BX + Mov DL, 10 + Xor AH, AH + Div DL + Add AX, '00' + Mov DH, AH + Mov AH, CH + StosW + Mov AL, DH + StosW + Mov AL, 192 + StosW + Jmp PE_DrawPatternEffect + +DefaultVolumeNoSample: + Pop BX + + Mov AH, CH + Mov AL, 173 ; Replace with default volume + StosW + StosW + Mov AL, 192 + StosW + Jmp PE_DrawPatternEffect + +PE_DrawPatternNoDefaultVolume: + Mov AL, 173 ; '.' + StosW + StosW + Jmp PE_DrawPattern17 + +PE_DrawPattern16: + Mov AH, AL + And AH, 7Fh + Sub AH, 65 + JC PE_DrawPatternNoVEffect + + Test AL, 80h + JZ PE_DrawPatternVEffect1 + + Add AH, 60 + +PE_DrawPatternVEffect1: + Mov AL, AH + Xor AH, AH + Div DL + ; AL = effect, AH = num + Add AX, 'A'+'0'*256 + Mov DH, AH + Mov AH, CH + StosW + Mov AL, DH + StosW + + Jmp PE_DrawPattern17 + +PE_DrawPatternNoVEffect: + Mov CL, CH + + Test AL, 80h + JZ PE_DrawPatternNoPan + + And CL, 0F0h + Or CL, 2 + And AL, 7Fh ; Filter out panning stuff. + + +PE_DrawPatternNoPan: + Xor AH, AH + Div DL + ; AH = units, AL = tens + Mov DH, AH + Mov AH, CL + Add AL, '0' + StosW + Mov AL, DH + Add AL, '0' + StosW + + Mov AH, CH + +PE_DrawPattern17: + Mov AL, 20h + StosW + +PE_DrawPatternEffect: + LodsB + Add AL, 64 + Cmp AL, 64 + JNE PE_DrawPattern18 + + Mov AL, '.' + +PE_DrawPattern18: + StosW + LodsB ; Commandvalue + Mov DH, AL + ShR AL, 4 + + Call PE_ConvHexAL + + Mov AL, DH + And AL, 15 + Call PE_ConvHexAL + + Pop DX + Pop CX + Dec DX + JZ PE_DrawPatternEdit9 + + And AX, 0F000h + Or AX, 2A8h + Cmp AH, 80h + JB PE_DrawDiv1 + Cmp AH, 0A0h + JAE PE_DrawDiv1 + + Mov AX, 2A8h + +PE_DrawDiv1: + StosW + Jmp PE_DrawPatternEdit6 + +PE_DrawPatternEdit9: + Pop BP + Pop DI + Pop SI + Pop DX + Pop CX + Add DI, 160 ; Screen + Add SI, 320 ; PatternData + Inc BP ; Row + Loop PE_DrawPatternEdit5 + +PE_DrawPatternHilightRow: + Call Music_GetPlayMode + Test AX, AX + JZ PE_DrawPattern40 + + Cmp CX, CS:PatternNumber + JNE PE_DrawPattern40 + + Sub BX, CS:TopRow + JC PE_DrawPattern40 + Cmp BL, 32 + JAE PE_DrawPattern40 + Mov AL, 80 + Mul BL + + Mov DI, AX + Add DI, 1+15*80 + Cmp CS:NumChannelsEdit, 0 + JE PE_DrawPattern41 + + Add DI, CS:ViewWidth + +PE_DrawPattern41: + Add DI, DI + + Push ES + Pop DS + + Mov CL, 3 + +PE_DrawPattern42: + Inc DI + Mov AL, [DI] + And AL, 0F0h + Or AL, 3 + StosB + + Dec CL + JNZ PE_DrawPattern42 + +PE_DrawPattern40: + Ret + +EndP PE_DrawPatternEdit + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_PrePatternEdit Far + + Push CS + Pop DS + Assume DS:Pattern + + Cmp NumChannelsEdit, 0 + JNE PE_PrePatternEdit18 + + Ret + +PE_PrePatternEdit18: + Call S_GetDestination + + Mov AX, 80 + Mov BX, 15 + Add BX, Row + Sub BX, TopRow + Mul BL + Add AX, ViewWidth + Add AX, 5 + Mov BX, PatternCursor + Add AL, [CursorPositions+BX] + AdC AH, 0 + Mov DI, AX + Mov AL, 14 + Mov BX, Channel + Sub BX, LeftChannel + Mul BL + Add DI, AX + Add DI, DI + Inc DI + Mov Byte Ptr [ES:DI], 30h + + Mov DI, 8+47*80 + Add DI, ViewWidth + Add DI, DI + Mov SI, LeftChannel + Mov DX, NumChannelsEdit + +PE_PrePatternEdit16: + Cmp [MultiChannelInfo+SI], 0 ; Put the 'M's in. + JE PE_PrePatternEdit17 + + Mov Byte Ptr [ES:DI], 172 + +PE_PrePatternEdit17: + Inc SI + Add DI, 28 + Dec DX + JNZ PE_PrePatternEdit16 + + Mov DI, 5+47*80 + Add DI, ViewWidth + Mov AL, 14 + Mov BX, Channel + Sub BX, LeftChannel + Mul BL + Add DI, AX + Add DI, DI ; Points to bottom of channel. + + Mov DX, 1 + Cmp Template, 0 + JE PE_PrePatternEditLoop +; Test CL, CL +; JZ PE_PrePatternEditLoop + Cmp BlockDataArea, 0 + JE PE_PrePatternEditLoop + + Mov FS, BlockDataArea + Mov AX, [FS:0] ; Block width + Mov DX, NumChannelsEdit + Add DX, LeftChannel + Sub DX, Channel + Cmp DX, AX + JB PE_PrePatternEditLoop + + Mov DX, AX + +PE_PrePatternEditLoop: + Push DI + + Mov AX, 23A9h + Mov CX, PatternCursor + Mov CH, EditMask + + Test CL, CL + JZ PE_PrePatternEdit1 + + Mov AL, 0AAh + +PE_PrePatternEdit1: + StosW + StosW + StosW +; Add DI, 2 + ScasW + + Test CH, 1 + JZ PE_PrePatternEdit2 + + StosW + StosW + Jmp PE_PrePatternEdit3 + +PE_PrePatternEdit2: + Add DI, 4 + +PE_PrePatternEdit3: +; Add DI, 2 + ScasW + + Test CH, 2 + JZ PE_PrePatternEdit4 + + StosW + StosW + Jmp PE_PrePatternEdit5 + +PE_PrePatternEdit4: + Add DI, 4 + +PE_PrePatternEdit5: +; Add DI, 2 + ScasW + + Test CH, 4 + JZ PE_PrePatternEdit6 + + StosW + StosW + StosW + +PE_PrePatternEdit6: + Pop DI ; Mark in the actual channels + Mov AL, 0A9h + Test CL, CL + JNZ PE_PrePatternEdit7 + + Mov AL, 0ABh + StosW + StosW + StosW + + Add DI, 22 + Dec DX + JNZ PE_PrePatternEditLoop + + Ret + +PE_PrePatternEdit7: + Cmp CL, 1 + JA PE_PrePatternEdit8 + + Mov AL, 0ABh + Add DI, 4 + StosW + Ret + +PE_PrePatternEdit8: + Cmp CL, 3 + JA PE_PrePatternEdit10 + + Test CH, 1 + JZ PE_PrePatternEdit9 + + Mov AL, 0ABh + +PE_PrePatternEdit9: + Add DI, 8 + StosW + StosW + Ret + +PE_PrePatternEdit10: + Cmp CL, 5 + JA PE_PrePatternEdit12 + + Test CH, 2 + JZ PE_PrePatternEdit11 + + Mov AL, 0ABh + +PE_PrePatternEdit11: + + Add DI, 14 + StosW + StosW + Ret + +PE_PrePatternEdit12: + Cmp CL, 6 + JA PE_PrePatternEdit14 + + Test CH, 4 + JZ PE_PrePatternEdit13 + + Mov AL, 0ABh + +PE_PrePatternEdit13: + Add DI, 20 + StosW + Ret + +PE_PrePatternEdit14: + Test CH, 4 + JZ PE_PrePatternEdit15 + + Mov AL, 0ABh + +PE_PrePatternEdit15: + Add DI, 22 + StosW + StosW + Ret + +EndP PE_PrePatternEdit + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetPatternOffset + + Assume DS:Pattern + + Push AX + Push BX + Push DX + + Mov AX, 64 + Mul Row + Add AX, Channel + Mov BX, 5 + Mul BX + Mov DI, AX + Mov ES, PatternDataArea + + Pop DX + Pop BX + Pop AX + Ret + +EndP GetPatternOffset + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc NetworkPatternBlock Near ; CL = width, CH = Height, BL = Channel, BH = Row + +IF NETWORKENABLED + Call Network_GetSendQueue + JZ PE_GotoNextInputNoNetwork + + Mov AX, NETWORK_PARTIALPATTERNOBJECT*100h ; Destination ALL + StosW + Mov AL, Byte Ptr PatternNumber + StosB + Mov AX, BX + StosW + Mov AX, CX + StosW + +PE_GotoNextInputNoNetwork: + Call Network_FinishedSendQueue + + Ret +ENDIF + +EndP NetworkPatternBlock + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc NetworkPartialPattern Near ; CL = width, CH = Height + +IF NETWORKENABLED + Push BX + Mov BL, Byte Ptr Channel + Mov BH, Byte Ptr Row + Call NetworkPatternBlock + Pop BX +ENDIF + Ret + +EndP NetworkPartialPattern + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc NetworkBlock Near + +IF NETWORKENABLED + Mov BL, Byte Ptr BlockLeft + Mov BH, Byte Ptr BlockTop + Mov CL, Byte Ptr BlockRight + Mov CH, Byte Ptr BlockBottom + Sub CX, BX + Add CX, 101h + Call NetworkPatternBlock +ENDIF + Ret + +EndP NetworkBlock + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +PatternCursorJumpTable DW Offset PE_PatternCursorPos0 + DW Offset PE_PatternCursorPos1 + DW Offset PE_PatternCursorPos2 + DW Offset PE_PatternCursorPos3 + DW Offset PE_PatternCursorPos4 + DW Offset PE_PatternCursorPos5 + DW Offset PE_PatternCursorPos6 + DW Offset PE_PatternCursorPos7 + DW Offset PE_PatternCursorPos8 + +Proc PE_PostPatternEdit Far + + Push CS + Pop DS + Assume DS:Pattern + + Test CH, 1 + JZ PE_PostPatternEdit17 + + Mov EAX, [DWord Ptr LastKeyBoard1] + Mov EBX, [DWord Ptr LastKeyBoard2] + + Mov [DWord Ptr LastKeyBoard2], EAX + Mov [DWord Ptr LastKeyBoard3], EBX + + Mov [LastKeyBoard1], CX + Mov [LastKeyBoard1+2], DX + +PE_PostPatternEdit17: + Mov AL, CH + Mov SI, Offset PEFunctions + And AL, 6 + Mov ShiftPressed, AL + + Test CH, 6 + PushF + Call M_FunctionDivider + JC PE_PostPatternEdit1 + + PopF + JNZ PE_PostPatternEditShift + +PE_PostPatternEditNotShift: + Jmp [SI] + +PE_PostPatternEditShift: + Cmp Byte Ptr [SI-3], 6 ; MIDI message + JE PE_PostPatternEditNotshift + + Mov AX, [SI-2] + + Cmp AX, 10Fh ; Shift Tab + JE PE_PostPatternEditNotShift + + Cmp AX, '?' + JE PE_PostPatternEditNotShift + + Cmp AX, '|' + JE PE_PostPatternEditNotShift + + Push [Row] + Push [Channel] + + Push CS + + Call [SI] + + Push CS + Pop DS + +; Mov CX, BlockAnchorRow +; Mov DX, BlockAnchorChannel + Pop DX + Pop CX + + Cmp CX, Row + JNE PE_PostPatternEditShift1 + + Cmp DX, Channel + JE PE_PostPatternEditShift2 + +PE_PostPatternEditShift1: + Cmp BlockReset, 0 + JE PE_PostPatternEditShift3 + + Mov BlockReset, 0 + Mov BlockMark, 0 + +PE_PostPatternEditShift3: + ; Set block marks. + Mov AX, BlockAnchorChannel + Mov BX, BlockAnchorRow + + Push CS + Call PEFunction_MarkBeginBlockChain + Jmp PEFunction_MarkEndBlock + +PE_PostPatternEditShift2: + Mov AX, 1 + Ret + +PE_PostPatternEdit1: + PopF + Test CH, 60h + JNZ PE_PostPatternEdit6 + + Call GetPatternOffset + Mov BX, PatternCursor + Add BX, BX + Jmp [PatternCursorJumpTable+BX] + +PE_PostPatternEdit6: + Mov AX, CX + And AX, 1FFh + Cmp AX, 10Ah + JA PE_PostPatternEdit7 + + Cmp AX, 102h + JB PE_PostPatternEdit7 + ; Alt-1 -> Alt-9 + Sub AX, 101h +; Dec AL +; Dec AH + Mov SkipValue, AX + + Mov SI, Offset CursorStepMsg + Call SetInfoLine + + Mov AX, 1 + Ret + +PE_PostPatternEdit7: + Xor AX, AX + Ret + +EndP PE_PostPatternEdit + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_Ctrl_PgUp Far + + Mov Row, 0 + + Mov AX, 1 + Ret + +EndP PEFunction_Ctrl_PgUp + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_Ctrl_PgDn Far + + Mov AX, MaxRow + Mov Row, AX + + Mov AX, 1 + Ret + +EndP PEFunction_Ctrl_PgDn + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_Up Far + + Mov BX, SkipValue + And BX, BX + JNZ PEFunction_Up2 + + Mov BX, 1 + +PEFunction_Up2: + Mov AX, Row + Sub AX, BX + JS PEFunction_Up1 + + Mov Row, AX + +PEFunction_Up1: + Mov AX, 1 + Ret + +EndP PEFunction_Up + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_Down Far + + Push CS + Pop DS + + Mov BX, SkipValue + And BX, BX + JNZ PEFunction_Down2 + + Mov BX, 1 + +PEFunction_Down2: + Mov AX, Row + Add AX, BX + Cmp AX, MaxRow + JA PEFunction_Down1 + + Mov Row, AX + +PEFunction_Down1: + Mov AX, 1 + Ret + +EndP PEFunction_Down + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_Left Far + + Mov CX, PatternCursor + Mov BX, Channel + Dec CX + JNS PEFunction_Left1 + + Mov CX, 8 + Dec BX + JS PEFunction_Left2 + + Mov Channel, BX + + Cmp CommandToValue, 0 + JE PEFunction_Left1 + + Call GetPatternOffset +; Mov ES, PatternDataArea +; Mov AX, 64 +; Mul Row +; Add AX, BX +; Mov DX, 5 +; Mul DX +; Mov DI, AX + Cmp Word Ptr [ES:DI+3], 0 + JNE PEFunction_Left1 + + Mov CX, 6 + +PEFunction_Left1: + Mov PatternCursor, CX + +PEFunction_Left2: + Mov AX, 1 + Ret + +EndP PEFunction_Left + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_Right Far ; If there is no + ; command value... skip! + + Mov CX, PatternCursor + Mov BX, Channel + Inc CX + Cmp CX, 6 + JBE PEFunction_Right1 + + Cmp CommandToValue, 0 + JE PEFunction_Right4 + + Call GetPatternOffset +; Mov ES, PatternDataArea +; Mov AX, 64 +; Mul Row +; Add AX, Channel +; Mov DX, 5 +; Mul DX +; Mov DI, AX + Cmp Word Ptr [ES:DI+3], 0 + JE PEFunction_Right3 + +PEFunction_Right4: + Cmp CX, 9 + JB PEFunction_Right1 + +PEFunction_Right3: + Xor CX, CX + Inc BX + Cmp BX, 64 + JAE PEFunction_Right2 + +PEFunction_Right1: + Mov PatternCursor, CX + Mov Channel, BX + +PEFunction_Right2: + Mov AX, 1 + Ret + +EndP PEFunction_Right + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_Press_Shift Far + + Mov AX, Channel + Mov BX, Row + + Mov BlockAnchorChannel, AX + Mov BlockAnchorRow, BX + Mov BlockReset, 1 + Mov NoteEntered, 0 + + Xor AX, AX + Ret + +EndP PEFunction_Press_Shift + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_Release_Shift Far + + Cmp NoteEntered, 0 + JE PEFunction_Release_Shift1 + + Mov AX, BlockAnchorChannel + Mov BX, BlockAnchorRow + + Mov Channel, AX + Mov Row, BX + + Call PE_GotoNextInput + +PEFunction_Release_Shift1: + Xor AX, AX + Ret + +EndP PEFunction_Release_Shift + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_Alt_Home Far + Mov BL, RowHilight1 + Jmp PEFunction_PgUpChain + +Proc PEFunction_PgUp Far + + Mov BL, RowHiLight2 + +PEFunction_PgUpChain: + Mov AX, Row + Mov CX, MaxRow + Mov DX, SkipValue + And DX, 0FFh + JNZ PEFunction_PgUp3 + + Mov DL, 1 + +PEFunction_PgUp3: + And BX, 0FFh + + JNZ PEFunction_PgUp2 + + Mov BX, 16 + +PEFunction_PgUp2: + Sub CX, DX ; Sub maxrow, skipvalue + Cmp CX, AX + JAE PEFunction_PgUp4 + + Dec AX + Div BL + Mul BL + Jmp PEFunction_PgUp1 + +PEFunction_PgUp4: + Sub AX, BX + JNS PEFunction_PgUp1 + + Xor AX, AX + +PEFunction_PgUp1: + Mov Row, AX + + Mov AX, 1 + Ret + +EndP PEFunction_PgUp + +EndP PEFunction_Alt_Home + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_CentraliseCursor + + Mov AX, Row + Sub AX, 16 + JNC PE_CentraliseCursor1 + + Xor AX, AX + +PE_CentraliseCursor1: + Mov TopRow, AX + Ret + +EndP PE_CentraliseCursor + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + + +Proc PEFunction_Alt_End Far + Mov BL, RowHilight1 + Jmp PEFunction_PgDnChain + +Proc PEFunction_PgDn Far + + Mov BL, RowHiLight2 + +PEFunction_PgDnChain: + Mov AX, Row + And BX, 0FFh + JNZ PEFunction_PgDn2 + + Mov BX, 16 + +PEFunction_PgDn2: + Add AX, BX + Cmp AX, MaxRow + JBE PEFunction_PgDn1 + + Mov AX, MaxRow + +PEFunction_PgDn1: + Mov Row, AX + + Mov AX, 1 + Ret + +EndP PEFunction_PgDn + +EndP PEFunction_Alt_End + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_ShiftPgUp Far + + Call PEFunction_PgUp + Call PE_CentraliseCursor + + Mov AX, 1 + Ret + +EndP PEFunction_ShiftPgUp + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_ShiftPgDn Far + + Call PEFunction_PgDn + Call PE_CentraliseCursor + + Mov AX, 1 + Ret + +EndP PEFunction_ShiftPgDn + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_Home Far + + Cmp PatternCursor, 0 + JE PEFunction_Home1 + + Mov PatternCursor, 0 + Jmp PEFunction_Home3 + +PEFunction_Home1: + Cmp Channel, 0 + JE PEFunction_Home2 + + Mov Channel, 0 + Jmp PEFunction_Home3 + +PEFunction_Home2: + Mov Row, 0 + +PEFunction_Home3: + Mov AX, 1 + Ret + +EndP PEFunction_Home + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_End Far + + Cmp PatternCursor, 8 + JE PEFunction_End1 + + Mov PatternCursor, 8 + Jmp PEFunction_End3 + +PEFunction_End1: + Call Music_GetLastChannel + + Cmp Channel, AX + JE PEFunction_End2 + + Mov Channel, AX + Jmp PEFunction_End3 + +PEFunction_End2: + Mov AX, MaxRow + Mov Row, AX + +PEFunction_End3: + Mov AX, 1 + Ret + +EndP PEFunction_End + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_Tab Far + + Mov AX, Channel + Cmp AX, 63 + JAE PEFunction_Tab1 + + Mov PatternCursor, 0 + Inc Channel + +PEFunction_Tab1: + Mov AX, 1 + Ret + +EndP PEFunction_Tab + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_ShiftTab Far + + Cmp PatternCursor, 0 + JNE PEFunction_ShiftTab2 + + Mov AX, Channel + And AX, AX + JZ PEFunction_ShiftTab1 + + Dec Channel + +PEFunction_ShiftTab2: + Mov PatternCursor, 0 + +PEFunction_ShiftTab1: + Mov AX, 1 + Ret + +EndP PEFunction_ShiftTab + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_SetMask Far + + Mov BX, PatternCursor + Mov AL, [MaskChange+BX] + Xor EditMask, AL + + Mov AX, 1 + Ret + +EndP PEFunction_SetMask + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_ToggleMultiChannel Far + + Mov BX, Channel + Xor [MultiChannelInfo+BX], 1 + + Cmp [Word Ptr LastKeyBoard2+2], 3100h + JNE PEFunction_ToggleMultiChannel1 + + Mov CX, 7 + Add CX, Channel + Mov DI, Offset O1_SelectMultiChannel + Call M_Object1List + +PEFunction_ToggleMultiChannel1: + Mov AX, 1 + Ret + +EndP PEFunction_ToggleMultiChannel + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_BackSpace Far + + Xor CX, CX + + Mov AX, Row + Mov BX, Channel + Sub AX, SkipValue + JS PEFunction_BackSpace3 + + Mov Row, AX + Cmp [MultiChannelInfo+BX], 0 + JE PEFunction_BackSpace5 + + Mov DX, BX + +PEFunction_BackSpace1: + Dec BX + JNS PEFunction_BackSpace4 + + And AX, AX + JZ PEFunction_BackSpace3 + + Inc CX + +PEFunction_BackSpace4: + And BX, 63 + Cmp BX, DX + JE PEFunction_BackSpace2 + + Cmp [MultiChannelInfo+BX], 0 + JE PEFunction_BackSpace1 + +PEFunction_BackSpace2: + Mov Channel, BX + Cmp SkipValue, 0 + JNE PEFunction_BackSpace3 + + And CX, CX + JZ PEFunction_BackSpace3 + + And AX, AX + JZ PEFunction_BackSpace3 + + Dec Row + Jmp PEFunction_BackSpace3 + +PEFunction_BackSpace5: ; AX = row + Cmp SkipValue, 0 + JNE PEFunction_BackSpace3 + + Mov BX, Channel + Dec BX + JNS PEFunction_BackSpace6 + + And AX, AX + JZ PEFunction_BackSpace3 + Dec AX + +PEFunction_BackSpace6: + And BX, 63 + Mov Row, AX + Mov Channel, BX + +PEFunction_BackSpace3: + Mov AX, 1 + Ret + +EndP PEFunction_BackSpace + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_PickUp Far + + Cmp Template, 4 + JE PEFunction_PickUp2 + + Mov Template, 0 ; Turn off templates + +PEFunction_PickUp2: + Call GetPatternOffset + Mov EAX, [ES:DI] + + Test AH, AH + JNZ PEFunction_PickUp1 + + Mov AH, LastInstrument + +PEFunction_PickUp1: + Mov DWord Ptr [LastNote], EAX + Mov AL, [ES:DI+4] + Mov LastCommandValue, AL + + Mov AX, 1 + Ret + +EndP PEFunction_PickUp + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_PatternCursorPos1 Far + + Test CL, CL + JZ PE_PatternCursorPos1_1 + + Cmp DX, '0' + JB PE_PatternCursorPos1_1 + + Cmp DX, '9' + JA PE_PatternCursorPos1_1 + + Mov AL, [ES:DI] + Cmp AL, 120 + JA PE_PatternCursorPos1_2 + + AAM 12 ; AH = octave, AL = note + Mov AH, DL + Sub AH, '0' + AAD 12 + StosB + +PE_PatternCursorPos1_2: + Mov CX, 101h + Call NetworkPartialPattern + + Jmp PE_GotoNextInput + +PE_PatternCursorPos1_1: + Xor AX, AX + Ret + +EndP PE_PatternCursorPos1 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_PatternCursorPos0 Far + + Test CL, CL + JZ PE_PatternCursorPos0_4 + + Push CX + Mov SI, Offset KeyBoardTable + + And CH, Not 6 ; Remove shift mask. + +PE_PatternCursorPos0_1: + LodsW + Cmp AX, 0FFFFh + JE PE_PatternCursorPos0_3 + + Cmp AX, CX + JNE PE_PatternCursorPos0_2 + + Pop CX + + Mov BX, 3Ah + Call K_IsKeyDown + JNZ PE_PatternCursorPreview + + Jmp PE_NewNote + +PE_PatternCursorPreview: + Mov AX, 12 + Mul BaseOctave + Mov BX, AX + LodsW + Add AX, BX + + Mov SI, Offset PreviewNote + + Cmp AX, MAXNOTE + JA PE_PatternCursorPos0_4 + + Mov AH, LastInstrument + Mov [SI], AX + + Mov AX, CS:Channel + Mov DH, 32 + Call Music_PlayNote + + Xor AX, AX + Ret + +PE_PatternCursorPos0_2: + LodsW ; Add SI, 2 + Jmp PE_PatternCursorPos0_1 + +PE_PatternCursorPos0_3: + Pop CX + + Mov AL, NONOTE + Cmp DX, '.' + JE WipeNote + + Inc AX + Cmp DX, '1' + JE WipeNote + Cmp DX, '!' + JE WipeNote + + Inc AX + Cmp DX, '`' + JE WipeNote + Cmp DX, '~' + JE WipeNote + + Cmp DX, ' ' + JE NoteSpace + + Cmp DX, '4' + JE PEFunction_PlayCurrentNote + Cmp DX, '$' + JE PEFunction_PlayCurrentNote + + Cmp DX, '8' + JE PEFunction_PlayCurrentRow + +PE_PatternCursorPos0_4: + Xor AX, AX + Ret + +EndP PE_PatternCursorPos0 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc NoteSpace Far + + Mov AL, LastNote + Jmp PE_NewNote4 + +EndP NoteSpace + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc WipeNote Far + + Mov AH, EditMask + + Mov BP, 1 + Cmp Template, 0 + JE WipeNote4 + + Cmp BlockDataArea, 0 + JE WipeNote4 + + Mov FS, BlockDataArea + Cmp Word Ptr [FS:2], 1 + JNE WipeNote4 + + Mov BP, [FS:0] + +WipeNote4: + Mov CX, BP + Mov CH, 1 + Call NetworkPartialPattern + +WipeNote5: + Mov [ES:DI], AL + Mov LastNote, AL + Test AH, 1 + JZ WipeNote1 + + Mov Byte Ptr [ES:DI+1], 0 + +WipeNote1: + Test AH, 2 + JZ WipeNote2 + + Mov Byte Ptr [ES:DI+2], 0FFh + +WipeNote2: + Test AH, 4 + JZ WipeNote3 + + Mov Word Ptr [ES:DI+3], 0 + +WipeNote3: + Add DI, 5 + Dec BP + JNZ WipeNote5 + +IF CHORDENTRY + Cmp ShiftPressed, 0 + JE PE_GotoNextInput + + Push SkipValue + Mov SkipValue, 0 + Mov NoteEntered, 1 + + Call PE_GotoNextInput + Pop SkipValue + + Mov AX, 1 + Ret +ELSE + Jmp PE_GotoNextInput +ENDIF + +EndP WipeNote + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_GotoNextInput Far + + + Mov CX, PatternCursor + And CX, CX + JZ PE_GotoNextInput4 + + Cmp CX, 1 + JE PE_GotoNextInput4 + + Cmp CX, 2 + JNE PE_GotoNextInput5 + +PE_GotoNextInput7: + Inc PatternCursor + Jmp PE_GotoNextInput3 + +PE_GotoNextInput5: + Cmp CX, 3 + JNE PE_GotoNextInput6 + +PE_GotoNextInput8: + Dec PatternCursor + Jmp PE_GotoNextInput4 + +PE_GotoNextInput6: + Cmp CX, 4 + JE PE_GotoNextInput7 + + Cmp CX, 5 + JE PE_GotoNextInput8 + + Cmp CX, 6 + JNE PE_GotoNextInput9 + + Cmp CommandToValue, 0 + JZ PE_GotoNextInput4 + + Jmp PE_GotoNextInput7 + +PE_GotoNextInput9: + Cmp CX, 7 + JE PE_GotoNextInput7 + + Cmp CommandToValue, 0 + JE PE_GotoNextInput8 + + Sub PatternCursor, 2 + +PE_GotoNextInput4: + Mov AX, Row + Mov BX, Channel + Add AX, SkipValue + Cmp AX, MaxRow + JA PE_GotoNextInput3 + + Mov Row, AX + Cmp PatternCursor, 0 + JNE PE_GotoNextInput10 + + Cmp [MultiChannelInfo+BX], 0 + JE PE_GotoNextInput10 + + Mov DX, BX + Xor CX, CX + +PE_GotoNextInput1: + Inc BX + Cmp BX, 63 + JBE PE_GotoNextInput11 + + Inc CX + +PE_GotoNextInput11: + And BX, 63 + Cmp DX, BX + JE PE_GotoNextInput2 + + Cmp [MultiChannelInfo+BX], 0 + JE PE_GotoNextInput1 + +PE_GotoNextInput2: + Mov Channel, BX + Cmp SkipValue, 0 + JNE PE_GotoNextInput3 + + And CX, CX + JZ PE_GotoNextInput3 + + Mov Word Ptr [Modified], 101h + + Jmp PEFunction_Down + +PE_GotoNextInput10: + Cmp SkipValue, 0 + JNE PE_GotoNextInput3 + + Mov AX, Channel + Mov CX, Row + Inc AX + Cmp AX, 63 + JBE PE_GotoNextInput12 + Cmp CX, MaxRow + JAE PE_GotoNextInput3 + + Inc CX + +PE_GotoNextInput12: + And AX, 63 + Mov Row, CX + Mov Channel, AX + +PE_GotoNextInput3: + Mov Word Ptr [Modified], 101h + + Mov AX, 1 + Ret + +EndP PE_GotoNextInput + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc TemplateSetup + + Mov AH, AL + Push AX + + Mov BX, Channel + Mov AX, 320 + Mov BP, MaxRow + Inc BP + Mul BP + Mov BP, AX ; BP = max offset. + + Mov AX, 64 + Mul Row + Add AX, BX + Mov CX, 5 + Mul CX + + Mov DI, AX ; DI = pattern offset. + Mov ES, PatternDataArea + Mov DS, BlockDataArea + Xor SI, SI + + LodsW + Mov DX, AX ; DX = width + LodsW + Mov CX, AX ; CX = height + + Pop AX ; AH = note. + Sub AH, [DS:4] + + Ret + +EndP TemplateSetup + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_TemplateOverwrite ; AX = note + + Push DS + Push ES + + Call TemplateSetup + +PE_TemplateOverWrite1: + Push BX + Push CX + Push DI + + Mov CX, DX + +PE_TemplateOverWrite2: + Cmp BX, 64 + JAE PE_TemplateOverWrite3 + + LodsB + Cmp AL, MAXNOTE + JA PE_TemplateOverWrite6 + + Add AL, AH + Cmp AL, MAXNOTE + JBE PE_TemplateOverWrite6 + + Mov AL, NONOTE + +PE_TemplateOverWrite6: + StosB + MovsW + MovsW + Jmp PE_TemplateOverWrite4 + +PE_TemplateOverWrite3: + Add SI, 5 + Add DI, 5 + +PE_TemplateOverWrite4: + Inc BX + Loop PE_TemplateOverWrite2 + + Pop DI + Pop CX + Pop BX + Add DI, 320 + Cmp DI, BP + JAE PE_TemplateOverWrite5 + + Loop PE_TemplateOverWrite1 + +PE_TemplateOverWrite5: + Pop ES + Pop DS + Ret + +EndP PE_TemplateOverWrite + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_TemplateMixPattern ; AX = note + + Push DS + Push ES + + Call TemplateSetup + +PE_TemplateMixPattern1: + Push BX + Push CX + Push DI + + Mov CX, DX + +PE_TemplateMixPattern2: + Cmp BX, 64 + JAE PE_TemplateMixPattern3 + + Mov AL, [DS:SI] + Cmp AL, MAXNOTE + JA PE_TemplateMixPattern6 + + Add AL, AH + Cmp AL, MAXNOTE + JBE PE_TemplateMixPattern6 + + Mov AL, NONOTE + +PE_TemplateMixPattern6: + Cmp Byte Ptr [ES:DI], NONOTE + JNE PE_TemplateMixPattern7 + + Mov [ES:DI], AL + +PE_TemplateMixPattern7: + Cmp Byte Ptr [ES:DI+1], 0 + JNE PE_TemplateMixPattern8 + + Mov AL, [DS:SI+1] + Mov [ES:DI+1], AL + +PE_TemplateMixPattern8: + Cmp Byte Ptr [ES:DI+2], 0FFh + JNE PE_TemplateMixPattern9 + + Mov AL, [DS:SI+2] + Mov [ES:DI+2], AL + +PE_TemplateMixPattern9: + Cmp Word Ptr [ES:DI+3], 0 + JNE PE_TemplateMixPattern3 + + Push AX + Mov AX, [DS:SI+3] + Mov [ES:DI+3], AX + Pop AX + +PE_TemplateMixPattern3: + Add SI, 5 + Add DI, 5 + +PE_TemplateMixPattern4: + Inc BX + Loop PE_TemplateMixPattern2 + + Pop DI + Pop CX + Pop BX + Add DI, 320 + Cmp DI, BP + JAE PE_TemplateMixPattern5 + + Loop PE_TemplateMixPattern1 + +PE_TemplateMixPattern5: + Pop ES + Pop DS + Ret + +EndP PE_TemplateMixPattern + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_TemplateMixClipBoard ; AX = note + + Push DS + Push ES + + Call TemplateSetup + +PE_TemplateMixClipBoard1: + Push BX + Push CX + Push DI + + Mov CX, DX + +PE_TemplateMixClipBoard2: + Cmp BX, 64 + JAE PE_TemplateMixClipBoard3 + + Mov AL, [DS:SI] + Cmp AL, MAXNOTE + JA PE_TemplateMixClipBoard6 + + Add AL, AH + Cmp AL, MAXNOTE + JBE PE_TemplateMixClipBoard6 + + Mov AL, NONOTE + +PE_TemplateMixClipBoard6: + Cmp Byte Ptr [DS:SI], NONOTE + JE PE_TemplateMixClipBoard7 + + Mov [ES:DI], AL + +PE_TemplateMixClipBoard7: + Cmp Byte Ptr [DS:SI+1], 0 + JE PE_TemplateMixClipBoard8 + + Mov AL, [DS:SI+1] + Mov [ES:DI+1], AL + +PE_TemplateMixClipBoard8: + Cmp Byte Ptr [DS:SI+2], 0FFh + JE PE_TemplateMixClipBoard9 + + Mov AL, [DS:SI+2] + Mov [ES:DI+2], AL + +PE_TemplateMixClipBoard9: + Cmp Word Ptr [DS:SI+3], 0 + JE PE_TemplateMixClipBoard3 + + Push AX + Mov AX, [DS:SI+3] + Mov [ES:DI+3], AX + Pop AX + +PE_TemplateMixClipBoard3: + Add SI, 5 + Add DI, 5 + +PE_TemplateMixClipBoard4: + Inc BX + Loop PE_TemplateMixClipBoard2 + + Pop DI + Pop CX + Pop BX + Add DI, 320 + Cmp DI, BP + JAE PE_TemplateMixClipBoard5 + + Loop PE_TemplateMixClipBoard1 + +PE_TemplateMixClipBoard5: + Pop ES + Pop DS + Ret + +EndP PE_TemplateMixClipBoard + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_TemplateNotesOnly + + Push DS + Push ES + + Call TemplateSetup + +PE_TemplateNotesOnly1: + Push BP + Push BX + Push CX + Push DI + + Mov CX, DX + Mov BP, Word Ptr [CS:EditMask] + +PE_TemplateNotesOnly2: + Cmp BX, 64 + JAE PE_TemplateNotesOnly3 + + Or BP, 8 + Mov AL, [SI] + Cmp AL, MAXNOTE + JA PE_TemplateNotesOnly7 + + Add AL, AH + And BP, Not 8 + Cmp AL, MAXNOTE + JA PE_TemplateNotesOnly3 + +PE_TemplateNotesOnly7: + Mov [ES:DI], AL + + Test BP, 8 + JNZ PE_TemplateNotesOnly3 + Test BP, 1 + JZ PE_TemplateNotesOnly5 + + Mov AL, CS:LastInstrument + Mov [ES:DI+1], AL + +PE_TemplateNotesOnly5: + Test BP, 2 + JZ PE_TemplateNotesOnly6 + + Mov AL, CS:LastVolume + Mov [ES:DI+2], AL + +PE_TemplateNotesOnly6: + Test BP, 4 + JZ PE_TemplateNotesOnly3 + + Mov AX, [Word Ptr CS:LastCommand] + Mov [ES:DI+3], AX + +PE_TemplateNotesOnly3: + Add SI, 5 + Add DI, 5 + + Inc BX + Loop PE_TemplateNotesOnly2 + + Pop DI + Pop CX + Pop BX + Pop BP + + Add DI, 320 + Cmp DI, BP + JAE PE_TemplateNotesOnly4 + + Loop PE_TemplateNotesOnly1 + +PE_TemplateNotesOnly4: + Pop ES + Pop DS + + Ret + +EndP PE_TemplateNotesOnly + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_Template Far ; AX = note. + + Mov BX, BlockDataArea + Test BX, BX + JZ PEFunction_NoBlockData + + Mov ES, BX + Cmp Byte Ptr [ES:4], 119 + JBE PE_Template3 + + Mov DI, Offset O1_TemplateErrorList + Mov CX, 2 + Call M_Object1List + + Mov AX, 1 + Ret + +PE_Template3: + Mov Word Ptr [Modified], 101h + + Mov BL, Template + Cmp BL, 2 + JE PE_Template1 + JA PE_Template2 + + Call PE_TemplateOverWrite + Jmp PE_Template4 + +PE_Template1: + Call PE_TemplateMixPattern + Jmp PE_Template4 + +PE_Template2: + Cmp BL, 4 + JE PE_Template6 + + Call PE_TemplateMixClipBoard + Jmp PE_Template4 + +PE_Template6: + Call PE_TemplateNotesOnly + +PE_Template4: ; Play notes, if clipboard height = 1 + Mov CL, [ES:0] + Mov CH, [ES:2] + Call NetworkPartialPattern + + Cmp Word Ptr [ES:2], 1 ; height + JNE PE_TemplateNoPlay + + Mov AX, 64 + Mul Row + Add AX, Channel + Mov DX, 5 + Mul DX + Mov SI, AX + + Mov CX, [ES:0] ; CX = Width + Mov AX, Channel + Push DS + Mov DS, PatternDataArea + Mov DH, 32 + +PE_TemplatePlay: + Call Music_PlayNote + + Add SI, 5 + Inc AX + Dec CX + JNZ PE_TemplatePlay + + Pop DS + +PE_TemplateNoPlay: + Cmp SkipValue, 0 + JNE PE_GotoNextInput + + Mov AX, Row + Mov BX, MaxRow + Add AX, [ES:2] + Cmp AX, BX + JBE PE_Template5 + + Mov AX, BX + +PE_Template5: + Mov Row, AX + + Mov AX, 1 + Ret + +EndP PE_Template + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_NewNote Far + + Mov AX, 12 + Mul BaseOctave + Mov BX, AX + LodsW + Add AX, BX + + Cmp AX, MAXNOTE + JBE PE_NewNote5 + + Mov AX, 1 + Ret + +PE_NewNote5: + Cmp Template, 0 + JNE PE_Template + +PE_NewNote4: + Mov AH, EditMask + + Mov SI, DI + + Mov LastNote, AL + StosB + + Test AH, 1 + JZ PE_NewNote1 + + Mov AL, LastInstrument + Mov [ES:DI], AL + +PE_NewNote1: + Test AH, 2 + JZ PE_NewNote2 + + Mov AL, LastVolume + Mov [ES:DI+1], AL + +PE_NewNote2: + Test AH, 4 + JZ PE_NewNote3 + + Mov AL, LastCommand + Mov AH, LastCommandValue + Mov [ES:DI+2], AX + +PE_NewNote3: ; Play routine reqd here... + Push DS + + Push ES + Pop DS ; DS = patterndatasegment + + Mov AX, CS:Channel + Mov DH, 32 + Call Music_PlayNote + + Pop DS + + Mov CX, 101h + Call NetworkPartialPattern + +IF CHORDENTRY + Cmp ShiftPressed, 0 + JE PE_GotoNextInput + + Push SkipValue + Mov SkipValue, 0 + Mov NoteEntered, 1 + + Call PE_GotoNextInput + Pop SkipValue + + Mov AX, 1 + Ret +ELSE + Jmp PE_GotoNextInput +ENDIF + +EndP PE_NewNote + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_Delete Far + + Mov Word Ptr [Modified], 101h + + Mov AX, 320 + Mul MaxRow + + Call GetPatternOffset + + Mov BP, 1 + Cmp Template, 0 + JE PEFunction_Delete3 + + Cmp PatternCursor, 0 + JNE PEFunction_Delete3 + + Cmp BlockDataArea, 0 + JE PEFunction_Delete3 + + Mov FS, BlockDataArea + Cmp Word Ptr [FS:2], 1 + JNE PEFunction_Delete3 + + Mov BP, [FS:0] + +PEFunction_Delete3: + Mov CX, BP + Mov CH, Byte Ptr MaxRow + Sub CH, Byte Ptr Row + Inc CH + Call NetworkPartialPattern + + Push AX DI + + Mov SI, DI + Push ES + Pop DS ; DS:SI and ES:DI point to pat + + Add SI, 320 + Mov DX, 315 + +PEFunction_Delete1: + Cmp DI, AX + JAE PEFunction_Delete2 + + Mov CX, 5 + Rep MovsB + Add SI, DX + Add DI, DX + Jmp PEFunction_Delete1 + +PEFunction_Delete2: + Mov AX, NONOTE + StosW + Mov AL, 0FFh + StosB + Xor AX, AX + StosW + + Pop DI AX + Add DI, 5 + + Dec BP + JNZ PEFunction_Delete3 + + Mov AX, 1 + Ret + +EndP PEFunction_Delete + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_Insert Far + + Mov BP, 1 + Cmp Template, 0 + JE PEFunction_Insert3 + + Cmp PatternCursor, 0 + JNE PEFunction_Insert3 + + Cmp BlockDataArea, 0 + JE PEFunction_Insert3 + + Mov FS, BlockDataArea + Cmp Word Ptr [FS:2], 1 + JNE PEFunction_Insert3 + + Mov BP, [FS:0] + +PEFunction_Insert3: + Mov Word Ptr [Modified], 101h + + Mov CX, BP + Mov CH, Byte Ptr MaxRow + Sub CH, Byte Ptr Row + Inc CH + Call NetworkPartialPattern + + Mov AX, 64 + Mul MaxRow + Add AX, Channel + Mov BX, 5 + Mul BX + Mov SI, AX + Call GetPatternOffset + Push ES + Pop DS + Mov BX, DI + Mov DX, -325 + +PEFunction_Insert4: + Push SI + + Mov DI, SI + Sub SI, 320 + +PEFunction_Insert1: + Cmp DI, BX + JBE PEFunction_Insert2 + + Mov CX, 5 + Rep MovsB + Add SI, DX + Add DI, DX + Jmp PEFunction_Insert1 + +PEFunction_Insert2: + Mov AX, NONOTE + StosW + Mov AL, 0FFh + StosB + Xor AX, AX + StosW + + Pop SI + Add SI, 5 + Add BX, 5 + + Dec BP + JNZ PEFunction_Insert4 + + Mov AX, 1 + Ret + +EndP PEFunction_Insert + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_RowDelete Far + + Cmp Byte Ptr LastKeyBoard2, 0D3h + JE PEFunction_RowDelete2 + + Mov DI, 20 + Call PE_AddToUndoBuffer + +PEFunction_RowDelete2: + Mov AX, 320 + Mul Row + Mov DI, AX + + Mov CX, MaxRow + Sub CX, Row + Mov AX, 320 + Mul CX + Mov CX, AX + + Mov DS, PatternDataArea + Push DS + Pop ES + Mov SI, DI + Add SI, 320 + Rep MovsB + + Mov DX, 64 + + Push CS + Pop DS + +PEFunction_RowDelete1: + Mov CX, 5 + Mov SI, Offset EmptyData + Rep MovsB + + Dec DX + JNZ PEFunction_RowDelete1 + + Mov BL, 0 + Mov BH, Byte Ptr Row + Mov CL, 64 + Mov CH, Byte Ptr MaxRow + Sub CH, Byte Ptr Row + Inc CH + Call NetworkPatternBlock + + Mov AX, 1 + Ret + +EndP PEFunction_RowDelete + + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_RowInsert Far + + Cmp Byte Ptr LastKeyBoard2, 0D2h + JE PEFunction_RowInsert2 + + Mov DI, 19 + Call PE_AddToUndoBuffer + +PEFunction_RowInsert2: + Mov AX, 320 + Mul MaxRow + Add AX, 63*5 + Mov DI, AX + + Mov CX, MaxRow + Sub CX, Row + Mov AX, 320 + Mul CX + Mov CX, AX + + Mov DS, PatternDataArea + Push DS + Pop ES + Mov SI, DI + Sub SI, 320 + StD + Rep MovsB + ClD + + Push CS + Pop DS + + Mov AX, 320 + Mul Row + Mov DI, AX + + Mov DX, 64 + + +PEFunction_RowInsert1: + Mov CX, 5 + Mov SI, Offset EmptyData + Rep MovsB + + Dec DX + JNZ PEFunction_RowInsert1 + + Mov BL, 0 + Mov BH, Byte Ptr Row + Mov CL, 64 + Mov CH, Byte Ptr MaxRow + Sub CH, BH + Inc CH + Call NetworkPatternBlock + + Mov AX, 1 + Ret + +EndP PEFunction_RowInsert + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_DecreaseInstrument Far + + Sub LastInstrument, 1 + AdC LastInstrument, 0 + + Mov AX, 1 + Ret + +EndP PEFunction_DecreaseInstrument + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_IncreaseInstrument Far + + Cmp LastInstrument, 99 + AdC LastInstrument, 0 + + Mov AX, 1 + Ret + +EndP PEFunction_IncreaseInstrument + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_DecreaseOctave Far + + Push CS + Pop DS + + Sub BaseOctave, 1 + AdC BaseOctave, 0 + + Mov AX, 1 + Ret + +EndP PEFunction_DecreaseOctave + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_IncreaseOctave Far + + Push CS + Pop DS + + Cmp BaseOctave, 9 + AdC BaseOctave, 0 + + Mov AX, 1 + Ret + +EndP PEFunction_IncreaseOctave + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_PatternCursorPos2 Far ; Tens column of ins. + + Test CL, CL + JZ PE_PatternCursorPos2_1 + + Mov BX, Offset PE_GotoNextInput4 + Mov AL, LastInstrument + Cmp DX, ' ' + JE PE_PatternCursorPos2_2 + + Xor AL, AL + Cmp DX, '.' + JE PE_PatternCursorPos2_2 + + Cmp DX, '0' + JB PE_PatternCursorPos2_1 + + Cmp DX, '9' + JA PE_PatternCursorPos2_1 + + MovZX AX, Byte Ptr [ES:DI+1] + Mov CL, 10 + Div CL + ; AH = units/AL = tens + Mov BL, AH + Mov AL, DL + Sub AL, '0' + + Mul CL + Add AL, BL + + Mov BX, Offset PE_GotoNextInput + + Mov LastInstrument, AL + +PE_PatternCursorPos2_2: + Mov [ES:DI+1], AL + + Mov CX, 101h + Call NetworkPartialPattern + + Jmp BX + +PE_PatternCursorPos2_1: + Xor AX, AX + Ret + +EndP PE_PatternCursorPos2 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_PatternCursorPos3 Far ; Unit column of ins. + + Test CL, CL + JZ PE_PatternCursorPos3_1 + + Mov BX, Offset PE_GotoNextInput4 + Mov AL, LastInstrument + Cmp DX, ' ' + JE PE_PatternCursorPos3_2 + + Xor AL, AL + Cmp DX, '.' + JE PE_PatternCursorPos3_2 + + Cmp DX, '0' + JB PE_PatternCursorPos3_1 + + Cmp DX, '9' + JA PE_PatternCursorPos3_1 + + MovZX AX, Byte Ptr [ES:DI+1] + Mov CL, 10 + Div CL + ; AH = units/AL = tens + Mul CL + Sub DL, '0' + Add AL, DL + + Mov BX, Offset PE_GotoNextInput + Mov LastInstrument, AL + +PE_PatternCursorPos3_2: + Mov [ES:DI+1], AL + + Mov CX, 101h + Call NetworkPartialPattern + + Jmp BX + +PE_PatternCursorPos3_1: + Xor AX, AX + Ret + +EndP PE_PatternCursorPos3 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_PatternCursorPos4 Far ; Tens column of vol. + + Test CL, CL + JZ PE_PatternCursorPos4_1 + + Cmp DX, '`' + JE PE_VolumePan + + Mov BX, Offset PE_GotoNextInput4 + Mov AL, LastVolume + Cmp DX, ' ' + JE PE_PatternCursorPos4_9 + + Mov AL, 0FFh + Cmp DX, '.' + JE PE_PatternCursorPos4_9 + + Mov BX, Offset PE_GotoNextInput + Mov AL, [ES:DI+2] + Cmp AL, 255 + JNE PE_PatternCursorPos4_2 + + Xor AL, AL + +PE_PatternCursorPos4_2: + And AX, 7Fh + Cmp AL, 65 + JB PE_PatternCursorPos4_4 + + Sub AL, 65 + +PE_PatternCursorPos4_4: + Cmp DX, '0' + JB PE_PatternCursorPos4_5 + + Cmp DX, '9' + JA PE_PatternCursorPos4_5 + + Mov CL, 10 + Div CL + ; AH = units/AL = tens + Mov DH, AH + Mov AL, DL + Sub AL, '0' + + Mul CL + Add AL, DH + + Cmp AL, 64 + JBE PE_PatternCursorPos4_3 + + Mov AL, 64 + +PE_PatternCursorPos4_3: + Or AL, VolumePan ; Panning flag. + +PE_PatternCursorPos4_9: + Mov [ES:DI+2], AL + Mov LastVolume, AL + + Mov CX, 101h + Call NetworkPartialPattern + + Jmp BX + +PE_PatternCursorPos4_5: + Cmp DX, 'A' + JB PE_PatternCursorPos4_6 + Cmp DX, 'H' + JA PE_PatternCursorPos4_6 + Sub DX, 'A' + Jmp PE_PatternCursorPos4_7 + +PE_PatternCursorPos4_6: + Cmp DX, 'a' + JB PE_PatternCursorPos4_1 + Cmp DX, 'h' + JA PE_PatternCursorPos4_1 + + Sub DX, 'a' + +PE_PatternCursorPos4_7: + Mov CL, 10 + Div CL + Mov CH, AH + Mov AL, DL + Mul CL ; AL = tens. + + Cmp AL, 60 + JB PE_PatternCursorPos4_8 + + Add AL, 128-60 + +PE_PatternCursorPos4_8: + Add AL, 65 + Add AL, CH + Jmp PE_PatternCursorPos4_9 + +PE_PatternCursorPos4_1: + Xor AX, AX + Ret + +EndP PE_PatternCursorPos4 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_VolumePan Far + + Xor VolumePan, 80h + Mov SI, Offset PanningControlSetMsg + + JNZ PE_VolumePan1 + + Mov SI, Offset VolumeControlSetMsg + +PE_VolumePan1: + Call SetInfoLine + + Mov AX, 1 + Ret + +EndP PE_VolumePan + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_PatternCursorPos5 Far ; Unit column of vol. + + Test CL, CL + JZ PE_PatternCursorPos5_1 + + Cmp DX, '`' + JE PE_VolumePan + + Mov BX, Offset PE_GotoNextInput4 + Mov AL, LastVolume + Cmp DX, ' ' + JE PE_PatternCursorPos5_6 + + Mov AL, 0FFh + Cmp DX, '.' + JE PE_PatternCursorPos5_6 + + Mov BX, Offset PE_GotoNextInput + Cmp DX, '0' + JB PE_PatternCursorPos5_1 + + Cmp DX, '9' + JA PE_PatternCursorPos5_1 + + Mov AL, [ES:DI+2] + Cmp AL, 255 + JNE PE_PatternCursorPos5_2 + + Xor AL, AL + +PE_PatternCursorPos5_2: + And AX, 7Fh + Cmp AL, 65 + JB PE_PatternCursorPos5_4 + + Sub AL, 65 + +PE_PatternCursorPos5_4: + Mov CL, 10 + Div CL + ; AH = units/AL = tens + Mul CL + Sub DL, '0' + Add AL, DL + + Mov AH, [ES:DI+2] + Cmp AH, 255 + JE PE_PatternCursorPos5_5 + And AH, 7Fh + Cmp AH, 64 + JBE PE_PatternCursorPos5_5 + + Add AL, 65 + Test Byte Ptr [ES:DI+2], 80h + JZ PE_PatternCursorPos5_6 + Add AL, 128 + Jmp PE_PatternCursorPos5_6 + +PE_PatternCursorPos5_5: + Cmp AL, 64 + JBE PE_PatternCursorPos5_3 + + Mov AL, 64 + +PE_PatternCursorPos5_3: + Or AL, VolumePan + +PE_PatternCursorPos5_6: + Mov [ES:DI+2], AL + Mov LastVolume, AL + + Mov CX, 101h + Call NetworkPartialPattern + + Jmp BX + +PE_PatternCursorPos5_1: + Xor AX, AX + Ret + +EndP PE_PatternCursorPos5 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_PatternCursorPos6 Far + + Test CL, CL + JZ PE_PatternCursorPos6_2 + + Mov AL, LastCommand + Cmp DX, ' ' + JE PE_PatternCursorPos6_3 + + Xor AL, AL + Cmp DX, '.' + JE PE_PatternCursorPos6_3 + + Mov AX, DX + + Cmp AX, 'a' + JB PE_PatternCursorPos6_1 + + Cmp AX, 'z' + JA PE_PatternCursorPos6_1 + + Sub AX, 32 + +PE_PatternCursorPos6_1: + Cmp AX, 'A' + JB PE_PatternCursorPos6_2 + + Cmp AX, 'Z' + JA PE_PatternCursorPos6_2 + + Sub AL, '@' + +PE_PatternCursorPos6_3: + Mov LastCommand, AL + Mov [ES:DI+3], AL + + Mov CX, 101h + Call NetworkPartialPattern + + Jmp PE_GotoNextInput + +PE_PatternCursorPos6_2: + Xor AX, AX + Ret + +EndP PE_PatternCursorPos6 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_PatternCursorPos7 Far + + Test CL, CL + JZ PE_PatternCursorPos7_3 + + Mov BX, Offset PE_GotoNextInput4 + Xor AL, AL + Cmp DX, '.' + JE PE_PatternCursorPos7_5 + + Mov AL, LastCommandValue + Cmp DX, ' ' + JE PE_PatternCursorPos7_5 + + Mov BX, Offset PE_GotoNextInput + Mov AX, DX + Cmp AX, 'a' + JB PE_PatternCursorPos7_1 + + Cmp AX, 'f' + JA PE_PatternCursorPos7_1 + + Sub AX, 32 + +PE_PatternCursorPos7_1: + Cmp AX, 'A' + JB PE_PatternCursorPos7_2 + + Cmp AX, 'F' + JA PE_PatternCursorPos7_2 + + Sub AX, 'A'-10 + Jmp PE_PatternCursorPos7_4 + +PE_PatternCursorPos7_2: + Cmp AX, '0' + JB PE_PatternCursorPos7_3 + + Cmp AX, '9' + JA PE_PatternCursorPos7_3 + + Sub AX, '0' + +PE_PatternCursorPos7_4: + Mov AH, AL + Mov AL, [ES:DI+4] + SHL AH, 4 + And AL, 0Fh + Or AL, AH + +PE_PatternCursorPos7_5: + Mov [ES:DI+4], AL + Mov LastCommandValue, AL + + Mov CX, 101h + Call NetworkPartialPattern + + Jmp BX + +PE_PatternCursorPos7_3: + Xor AX, AX + Ret + +EndP PE_PatternCursorPos7 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_PatternCursorPos8 Far + + Test CL, CL + JZ PE_PatternCursorPos8_3 + + Mov BX, Offset PE_GotoNextInput4 + Xor AH, AH + Cmp DX, '.' + JE PE_PatternCursorPos8_5 + + Mov AH, LastCommandValue + Cmp DX, ' ' + JE PE_PatternCursorPos8_5 + + Mov BX, Offset PE_GotoNextInput + Mov AX, DX + Cmp AX, 'a' + JB PE_PatternCursorPos8_1 + + Cmp AX, 'f' + JA PE_PatternCursorPos8_1 + + Sub AX, 32 + +PE_PatternCursorPos8_1: + Cmp AX, 'A' + JB PE_PatternCursorPos8_2 + + Cmp AX, 'F' + JA PE_PatternCursorPos8_2 + + Sub AX, 'A'-10 + Jmp PE_PatternCursorPos8_4 + +PE_PatternCursorPos8_2: + Cmp AX, '0' + JB PE_PatternCursorPos7_3 + + Cmp AX, '9' + JA PE_PatternCursorPos7_3 + + Sub AX, '0' + +PE_PatternCursorPos8_4: + Mov AH, [ES:DI+4] + And AH, 0F0h + Or AH, AL + +PE_PatternCursorPos8_5: + Mov [ES:DI+4], AH + Mov LastCommandValue, AH + + Mov CX, 101h + Call NetworkPartialPattern + + Jmp BX + +PE_PatternCursorPos8_3: + Xor AX, AX + Ret + +EndP PE_PatternCursorPos8 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_SetCommandCursor Far + + Push CS + Pop ES + Mov DI, Offset CommandToValue +; Mov AL, [SI+24] +; Mov CS:CommandToValue, AL + + Ret + +EndP PE_SetCommandCursor + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_MarkBeginBlock Far + + Mov AX, Channel + Mov BX, Row + +PEFunction_MarkBeginBlockChain: + Cmp BlockMark, 0 + JNE PEFunction_MarkBeginBlock1 + + Mov BlockMark, 1 + Mov BlockLeft, AX + Mov BlockRight, AX + Mov BlockTop, BX + Mov BlockBottom, BX + Jmp PEFunction_MarkBeginBlock5 + +PEFunction_MarkBeginBlock1: + Cmp AX, BlockRight + JBE PEFunction_MarkBeginBlock2 + + Mov CX, BlockRight + Mov BlockRight, AX + Mov BlockLeft, CX + Jmp PEFunction_MarkBeginBlock3 + +PEFunction_MarkBeginBlock2: + Mov BlockLeft, AX + +PEFunction_MarkBeginBlock3: + Cmp BX, BlockBottom + JBE PEFunction_MarkBeginBlock4 + + Mov CX, BlockBottom + Mov BlockBottom, BX + Mov BlockTop, CX + Jmp PEFunction_MarkBeginBlock5 + +PEFunction_MarkBeginBlock4: + Mov BlockTop, BX + +PEFunction_MarkBeginBlock5: + Mov AX, 1 + Ret + +EndP PEFunction_MarkBeginBlock + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_MarkEndBlock Far + + Mov AX, Channel + Mov BX, Row + +PEFunction_MarkEndChain: + Cmp BlockMark, 0 + JNE PEFunction_MarkEndBlock1 + + Mov BlockMark, 1 + Mov BlockLeft, AX + Mov BlockRight, AX + Mov BlockTop, BX + Mov BlockBottom, BX + Jmp PEFunction_MarkEndBlock5 + +PEFunction_MarkEndBlock1: + Cmp AX, BlockLeft + JAE PEFunction_MarkEndBlock2 + + Mov CX, BlockLeft + Mov BlockLeft, AX + Mov BlockRight, CX + Jmp PEFunction_MarkEndBlock3 + +PEFunction_MarkEndBlock2: + Mov BlockRight, AX + +PEFunction_MarkEndBlock3: + Cmp BX, BlockTop + JAE PEFunction_MarkEndBlock4 + + Mov CX, BlockTop + Mov BlockTop, BX + Mov BlockBottom, CX + Jmp PEFunction_MarkEndBlock5 + +PEFunction_MarkEndBlock4: + Mov BlockBottom, BX + +PEFunction_MarkEndBlock5: + Mov AX, 1 + Ret + +EndP PEFunction_MarkEndBlock + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_AltD Far + + Mov AX, Channel + Mov BX, Row + MovZX DX, RowHiLight2 + + Cmp Word Ptr [LastKeyBoard2+2], 2000h + JNE PEFunction_AltD1 + ; OK, at least 1 Alt-D already.. + ; Now double length... + Mov DX, BlockBottom + Sub DX, BlockTop + Inc DX + Add DX, DX + Add DX, BlockTop + Dec DX + Cmp DX, MaxRow + JBE PEFunction_AltD3 + + Mov DX, MaxRow + +PEFunction_AltD3: + Mov BlockBottom, DX + Jmp PEFunction_AltD4 + +PEFunction_AltD1: + Dec DX + Mov BlockTop, BX + Mov BlockLeft, AX + Mov BlockRight, AX + + Add BX, DX + Cmp BX, MaxRow + JBE PEFunction_AltD2 + + Mov BX, MaxRow + +PEFunction_AltD2: + Mov BlockBottom, BX + Mov BlockMark, 1 + +PEFunction_AltD4: + Mov AX, 1 + Ret + +EndP PEFunction_AltD + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_AltS Far + + Cmp BlockMark, 0 + JE PEFunction_NoBlockMarkedMessage + + Cmp [Word Ptr LastKeyBoard2+2], 1F00h + JE PEFunction_AltS5 + Call NetworkBlock + + Mov DI, 12 + Call PE_AddToUndoBuffer + +PEFunction_AltS5: + Mov AX, 64 + Mul BlockTop + Add AX, BlockLeft + Mov BX, 5 + Mul BX + + Mov SI, AX + Inc SI + + Mov AH, LastInstrument + Mov DX, BlockRight + Sub DX, BlockLeft + Inc DX + Mov CX, BlockBottom + Sub CX, BlockTop + Inc CX + + Mov DS, PatternDataArea + +PEFunction_AltS1: + Push SI + Push CX + + Mov CX, DX + +PEFunction_AltS2: + Cmp Byte Ptr [SI], 0 + JE PEFunction_AltS3 + + Mov [SI], AH + +PEFunction_AltS3: + Add SI, 5 + Loop PEFunction_AltS2 + + Pop CX + Pop SI + Add SI, 320 + Loop PEFunction_AltS1 + +PEFunction_AltS4: + Mov AX, 1 + Ret + +EndP PEFunction_AltS + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEGetVolume ; Given DL = note, DH = instrument + ; Returns DL, Carry if none + + Push AX BX DI DS + + Cmp DL, MAXNOTE + JA PEGetVolumeError + + Call Music_GetSongSegment + Mov DS, AX + + Mov BL, DH + And BX, 0FFh + JZ PEGetVolumeError + Add BX, BX + + Test Byte Ptr [DS:2Ch], 4 + JZ PEGetVolumeSample + + Mov DI, DX + Mov BX, [DS:64710+BX] + And DI, 0FFh ; Note + Add DI, DI + Mov BX, [DS:BX+DI+41h] + And BX, 0FFh ; BX = sample + JZ PEGetVolumeError + Add BX, BX + +PEGetVolumeSample: + Mov BX, [DS:64910+BX] + Mov DL, [BX+13h] + + DB 85h ; +PEGetVolumeError: ; + StC ; + +PEGetVolumeEnd: + Pop DS DI BX AX + Ret + +EndP PEGetVolume + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_AltK Far + + Cmp BlockMark, 0 + JE PEFunction_NoBlockMarkedMessage + + Cmp [Word Ptr LastKeyBoard2+2], 2500h + JNE PEFunction_AltK7 + + Cmp [Word Ptr LastKeyBoard3+2], 2500h + JE PEFunction_AltK11 + + Mov DI, 8 + Call PE_AddToUndoBuffer + Call NetworkBlock + + ; OK.. wipe volume data... + Mov AX, 64 + Mul BlockTop + Add AX, BlockLeft + Mov BX, 5 + Mul BX + Mov DI, AX + + Mov DX, BlockRight + Sub DX, BlockLeft + Inc DX + + Mov CX, BlockBottom + Sub CX, BlockTop + Inc CX + + Mov ES, PatternDataArea +; Add DI, 2 + ScasW + + Mov AL, 0FFh + +PEFunction_AltK12: + Push CX + Push DI + + Mov CX, DX + +PEFunction_AltK13: + StosB + Add DI, 4 + Loop PEFunction_AltK13 + + Pop DI + Pop CX + Add DI, 320 + Loop PEFunction_AltK12 + +PEFunction_AltK11: + Mov AX, 1 + Ret + +PEFunction_AltK7: + Mov DI, 7 + Call PE_AddToUndoBuffer + Call NetworkBlock + + Mov AX, 64 + Mul BlockTop + Add AX, BlockLeft + Mov BX, 5 + Mul BX + Mov SI, AX + + Mov AX, 64 + Mul BlockBottom + Add AX, BlockLeft + Mul BX + Mov DI, AX + + Mov DX, BlockRight + Sub DX, BlockLeft + Inc DX + + Mov CX, BlockBottom + Sub CX, BlockTop + JZ PEFunction_AltK2 ; CX contains number of rows + +; Add SI, 2 +; Add DI, 2 + LodsW + ScasW + Mov DS, PatternDataArea + +PEFunction_AltK1: + Push CX + Push DX + Push SI + +; AltK6 = don't slide. + + MovZX AX, Byte Ptr [DI] + Cmp AL, 0FFh + JNE PEFunction_KVolume1 + + Mov DX, [DI-2] + Call PEGetVolume + JC PEFunction_AltK6 + MovZX AX, DL + +PEFunction_KVolume1: + MovZX BX, Byte Ptr [SI] + Cmp BL, 0FFh + JNE PEFunction_KVolume2 + + Mov DX, [SI-2] + Call PEGetVolume + JC PEFunction_AltK6 + MovZX BX, DL + +PEFunction_KVolume2: ; Now BOTH AL and BL are pan + ; Or BOTH AL and BL are volume + Mov DL, AL + Mov DH, BL + + And DX, 7F7Fh + Cmp DL, 64 + JA PEFunction_AltK6 + Cmp DH, 64 + JA PEFunction_AltK6 + + Mov DL, AL + Mov DH, BL + + And DX, 8080h + JZ PEFunction_AltK14 + Cmp DX, 8080h + JNE PEFunction_AltK6 + +PEFunction_AltK14: + Mov [DI], AL + Mov [SI], BL + + Sub AX, BX ; AX = change. + JS PEFunction_AltK4 + + Div CL + Mov BH, AL + Xor AL, AL + Div CL + Mov BL, AL + + Xor AL, AL + Jmp PEFunction_AltK5 + + +PEFunction_AltK4: + Neg AX + Div CL + Mov BH, AL + Xor AL, AL + Div CL + Mov BL, AL + Neg BX + + Mov AL, 0FFh + +PEFunction_AltK5: + Mov AH, [SI] + +PEFunction_AltK3: + Mov [SI], AH + + Add AX, BX + Add SI, 320 + Loop PEFunction_AltK3 + +PEFunction_AltK6: + Pop SI + Pop DX + Pop CX + Add SI, 5 + Add DI, 5 + Dec DX + JNZ PEFunction_AltK1 + +PEFunction_AltK2: + Mov AX, 1 + Ret + +EndP PEFunction_AltK + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_AltL Far + + Call Music_GetLastChannel ; AX = max channel. + Mov BX, MaxRow + + Cmp [Word Ptr LastKeyBoard2+2], 2600h + JNE PEFunction_AltL1 + + Xor CX, CX + Cmp CX, BlockTop + JNE PEFunction_AltL2 + Cmp CX, BlockLeft + JNE PEFunction_AltL2 + Cmp BlockRight, AX + JNE PEFunction_AltL2 + Cmp BX, BlockBottom + JNE PEFunction_AltL2 + Jmp PEFunction_AltL1 + +PEFunction_AltL2: + Xor CX, CX + Mov BlockTop, CX + Mov BlockLeft, CX + Mov BlockRight, AX + Mov BlockBottom, BX + Jmp PEFunction_AltL3 + +PEFunction_AltL1: + Mov AX, Channel + Mov BlockTop, 0 + Mov BlockLeft, AX + Mov BlockRight, AX + Mov BlockBottom, BX + +PEFunction_AltL3: + Mov BlockMark, 1 + + Mov AX, 1 + Ret + +EndP PEFunction_AltL + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_WipeBlock Far + + Cmp BlockMark, 0 + JE PEFunction_NoBlockMarkedMessage + + Cmp [Word Ptr LastKeyBoard2+2], 2C00h + JE PEFunction_WipeBlock1 + + Mov DI, 18 + Call PE_AddToUndoBuffer + Call NetworkBlock + + Cmp Template, 0 + JNE PEFunction_WipeBlock4 + + Push DS + Call PEFunction_BlockCopy + Pop DS + +PEFunction_WipeBlock4: + + Mov AX, 64 + Mul BlockTop + Add AX, BlockLeft + Mov BX, 5 + Mul BX + Mov DI, AX + + Mov CX, BlockBottom + Sub CX, BlockTop + Inc CX + + Mov DX, BlockRight + Sub DX, BlockLeft + Inc DX + + Mov ES, PatternDataArea + +PEFunction_WipeBlock2: + Push DI + Push CX + + Mov CX, DX + +PEFunction_WipeBlock3: + Mov AX, NONOTE + StosW + Mov AL, 0FFh + StosB + Xor AX, AX + StosW + Loop PEFunction_WipeBlock3 + + Pop CX + Pop DI + Add DI, 320 + Loop PEFunction_WipeBlock2 + +PEFunction_WipeBlock1: + Mov AX, 1 + Ret + +EndP PEFunction_WipeBlock + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_RollUp Far + + Cmp BlockMark, 0 + JE PEFunction_NoBlockMarkedMessage + + Mov AX, 64 + Mul BlockTop + Add AX, BlockLeft + Mov BX, 5 + Mul BX + Mov SI, AX + + Mov BP, BlockBottom + Sub BP, BlockTop + JZ PEFunction_RollUpEnd + + Call NetworkBlock + + Mov DX, BlockRight + Sub DX, BlockLeft + Inc DX + Mov AX, 5 + Mul DX + + Mov CX, AX + + Push CS + Pop ES + Mov DI, Offset TempData + Mov DS, PatternDataArea + + Push SI + Rep MovsB + Pop DI + + Push DS + Pop ES + LEA SI, [DI+320] + +PEFunction_RollUp1: + Push SI + Push DI + + Mov CX, AX + Rep MovsB + + Pop DI + Pop SI + Add SI, 320 + Add DI, 320 + + Dec BP + JNZ PEFunction_RollUp1 + + Push CS + Pop DS + Mov SI, Offset TempData + Mov CX, AX + Rep MovsB + +PEFunction_RollUpEnd: + Mov AX, 1 + Ret + +EndP PEFunction_RollUp + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_RollDown Far + + Cmp BlockMark, 0 + JE PEFunction_NoBlockMarkedMessage + + Mov AX, 64 + Mul BlockBottom + Add AX, BlockLeft + Mov BX, 5 + Mul BX + Mov SI, AX + + Mov BP, BlockBottom + Sub BP, BlockTop + JZ PEFunction_RollDownEnd + + Call NetworkBlock + + Mov DX, BlockRight + Sub DX, BlockLeft + Inc DX + Mov AX, 5 + Mul DX + + Mov CX, AX + + Push CS + Pop ES + Mov DI, Offset TempData + Mov DS, PatternDataArea + + Push SI + Rep MovsB + Pop DI + + Push DS + Pop ES + LEA SI, [DI-320] + +PEFunction_RollDown1: + Push SI + Push DI + + Mov CX, AX + Rep MovsB + + Pop DI + Pop SI + Sub SI, 320 + Sub DI, 320 + + Dec BP + JNZ PEFunction_RollDown1 + + Push CS + Pop DS + Mov SI, Offset TempData + Mov CX, AX + Rep MovsB + +PEFunction_RollDownEnd: + Mov AX, 1 + Ret + +EndP PEFunction_RollDown + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_BlockHalve Far + + Cmp BlockMark, 0 + JE PEFunction_NoBlockMarkedMessage + + Mov DI, 5 + Call PE_AddToUndoBuffer + + Mov BL, Byte Ptr BlockLeft + Mov BH, Byte Ptr BlockTop + Mov CH, Byte Ptr MaxRow + Mov CL, Byte Ptr BlockRight + Sub CX, BX + Add CX, 101h + Call NetworkPatternBlock + + Mov AX, 320 + Mul BlockTop + Mov BX, AX + Mov AX, 5 + Mul BlockLeft + Add BX, AX + Mov SI, BX + Mov DI, BX + + Mov DX, BlockBottom + Sub DX, BlockTop + Inc DX + + Mov CX, BlockRight + Sub CX, BlockLeft + Inc CX + + Mov AX, BlockTop + + Mov DS, PatternDataArea + Push DS + Pop ES + +PEFunction_BlockHalve1: + Push AX + Push CX + Push DX + Push SI + Push DI + + Cmp AX, CS:MaxRow + JBE PEFunction_BlockHalve3 + +PEFunction_BlockHalve2: + Mov AX, NONOTE + StosW + Mov AL, 0FFh + StosB + Xor AX, AX + StosW + Loop PEFunction_BlockHalve2 + + Jmp PEFunction_BlockHalve4 + +PEFunction_BlockHalve3: + Mov AX, 5 + Mul CX + Mov CX, AX + Rep MovsB + +PEFunction_BlockHalve4: + + Pop DI + Pop SI + Pop DX + Pop CX + Pop AX + Add SI, 640 + Add DI, 320 + Add AX, 2 + Dec DX + JNZ PEFunction_BlockHalve1 + + Mov AX, 1 + Ret + +EndP PEFunction_BlockHalve + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_BlockDouble Far + + Cmp BlockMark, 0 + JE PEFunction_NoBlockMarkedMessage + + Mov DI, 4 + Call PE_AddToUndoBuffer + + Mov BL, Byte Ptr BlockLeft + Mov BH, Byte Ptr BlockTop + Mov CH, Byte Ptr MaxRow + Mov CL, Byte Ptr BlockRight + Sub CX, BX + Add CX, 101h + Call NetworkPatternBlock + + Mov AX, 320 + Mov CX, BlockBottom + Mul CX + Mov SI, AX + Add CX, CX ; CX = 2*number of rows+2*top + Sub CX, BlockTop ; CX = 2*number of rows+top + Inc CX + Mov AX, 320 + Mul CX + Mov DI, AX + + Push CX ; CX = output row. + + Mov CX, BlockRight + Sub CX, BlockLeft + Inc CX + + Mov AX, 5 + Mul BlockLeft + Add SI, AX + Add DI, AX + + Pop DX ; DX = output row + + Mov DS, PatternDataArea + Push DS + Pop ES + +PEFunction_BlockDouble1: + Push DI + + Cmp DX, CS:MaxRow + JA PEFunction_BlockDouble2 + ; Empty stuff now.. + Push CX + +PEFunction_BlockDouble4: + Mov AX, NONOTE + StosW + Mov AL, 0FFh + StosB + Xor AX, AX + StosW + Loop PEFunction_BlockDouble4 + + Pop CX + +PEFunction_BlockDouble2: + Pop DI + Sub DI, 320 + Dec DX + + Push SI + Push DI + Cmp DX, CS:MaxRow + JA PEFunction_BlockDouble3 + + Push CX + Push DX + + Mov AX, 5 + Mul CX + Mov CX, AX + Rep MovsB + + Pop DX + Pop CX + +PEFunction_BlockDouble3: + Pop DI + Pop SI + Sub SI, 320 + Sub DI, 320 + + Cmp DX, CS:BlockTop + JBE PEFunction_BlockDouble5 + + Dec DX + Jmp PEFunction_BlockDouble1 + +PEFunction_BlockDouble5: + Mov AX, 1 + Ret + +EndP PEFunction_BlockDouble + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_BlockSwap Far ; Alt-H... sorry. + + Cmp BlockMark, 0 + JE PEFunction_NoBlockMarkedMessage + + ; Check that boundaries + ; are OK.. + + ; 1. Check that vertices of new block + ; don't lie in old block. + ; 2. Check that 2nd block < channels + ; and 2nd block < maxrow. + + Mov AX, Channel + Mov BX, Row + Call Near Ptr PEFunction_BlockSwap1 + Add AX, BlockRight + Sub AX, BlockLeft + Call Near Ptr PEFunction_BlockSwap1 + Add BX, BlockBottom + Sub BX, BlockTop + Call Near Ptr PEFunction_BlockSwap1 + Mov AX, Channel + Call Near Ptr PEFunction_BlockSwap1 + Jmp PEFunction_BlockSwap3 + +PEFunction_BlockSwap1: + Cmp AX, BlockLeft + JB PEFunction_BlockSwap2 + Cmp AX, BlockRight + JA PEFunction_BlockSwap2 + + Cmp BX, BlockTop + JB PEFunction_BlockSwap2 + Cmp BX, BlockBottom + JA PEFunction_BlockSwap2 + + ; Uh oh... cursor is in block. + + Mov DI, Offset O1_OverlapBlockList + Mov CX, 2 + Call M_Object1List + + Pop AX ; Clear stack + Mov AX, 1 + RetF + +PEFunction_BlockSwap2: + RetN + +PEFunction_BlockSwap3: + Mov DI, 17 + Call PE_AddToUndoBuffer + Call NetworkBlock + + Mov BL, Byte Ptr Channel + Mov BH, Byte Ptr Row + Mov CL, Byte Ptr BlockRight + Mov CH, Byte Ptr BlockBottom + Sub CL, Byte Ptr BlockLeft + Sub CH, Byte Ptr BlockTop + Add CX, 101h + Call NetworkPatternBlock + + + Mov AX, Channel + Mov BX, Row + + Mov CX, BlockRight + Sub CX, BlockLeft + Inc CX ; CX = block width. + Add AX, CX + Cmp AX, 64 + JA PEFunction_BlockSwap4 + + Mov DX, BlockBottom + Sub DX, BlockTop ; DX = block height-1. + Add BX, DX + Cmp BX, MaxRow + JBE PEFunction_BlockSwap5 + +PEFunction_BlockSwap4: + Mov DI, Offset O1_SwapOutOfRangeList + Mov CX, 2 + Call M_Object1List + + Mov AX, 1 + Ret + +PEFunction_BlockSwap5: ; Do swap. + Mov AX, 320 + Mul BlockTop + Mov BX, AX + Mov AX, 5 + Mul BlockLeft + Add BX, AX + Mov SI, BX ; SI = "marked" block + + Call GetPatternOffset ; DI = implied block +; Mov AX, 320 +; Mul Row +; Mov BX, AX +; Mov AX, 5 +; Mul Channel +; Add BX, AX +; Mov SI, BX ; SI = implied block. + + Mov CX, BlockRight + Sub CX, BlockLeft + Inc CX ; CX = width of block. + Mov AX, 5 + Mul CX + Mov CX, AX + + Mov DX, BlockBottom + Sub DX, BlockTop + Inc DX ; DX = height of block + +; Mov ES, PatternDataArea + Push ES + Pop DS + +PEFunction_BlockSwap6: + Push CX + Push DX + Push SI + Push DI + +PEFunction_BlockSwap7: + Mov AL, [DS:DI] + MovsB + Mov [DS:SI-1], AL + Loop PEFunction_BlockSwap7 + + Pop DI + Pop SI + Pop DX + Pop CX + Add SI, 320 + Add DI, 320 + Dec DX + JNZ PEFunction_BlockSwap6 + + Mov AX, 1 + Ret + +EndP PEFunction_BlockSwap + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_BlockCopy Far + + Cmp BlockMark, 0 + JE PEFunction_NoBlockMarkedMessage + + Mov AX, BlockDataArea + And AX, AX + JZ PEFunction_BlockCopy1 + + Mov ES, AX + Mov AH, 49h + Int 21h + +PEFunction_BlockCopy1: + Mov AX, BlockBottom + Sub AX, BlockTop + Inc AX + + Mov BX, BlockRight + Sub BX, BlockLeft + Inc BX + Mul BX + Mov BX, 5 + Mul BX + ; AX = size of block + Mov BX, AX + Add BX, 19 ; + space for width/height + ShR BX, 4 + Mov AH, 48h + Int 21h + JNC PEFunction_BlockCopy2 + + Jmp PEFunction_OutOfMemoryMessage + +PEFunction_BlockCopy2: + Mov BlockDataArea, AX + Xor DI, DI + Mov ES, AX + + Mov AX, BlockRight + Sub AX, BlockLeft + Inc AX + StosW + Mov BX, 5 + Mul BX + Mov DX, AX ; DX = width*5 + + Mov AX, BlockBottom + Sub AX, BlockTop + Inc AX + StosW + Mov CX, AX ; CX = height + + Push DX + + Mov AX, 64 + Mul BlockTop + Add AX, BlockLeft + Mul BX + Mov SI, AX + + Pop DX + Mov DS, PatternDataArea + +PEFunction_BlockCopy3: + Push SI + Push CX + + Mov CX, DX + Rep MovsB + + Pop CX + Pop SI + Add SI, 320 + Loop PEFunction_BlockCopy3 + + Mov AX, 1 + Ret + +EndP PEFunction_BlockCopy + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_NoBlockMarkedMessage Far + + Mov DI, Offset O1_NoBlockMarkedList + Mov CX, 2 + Call M_Object1List + + Mov AX, 1 + Ret + +EndP PEFunction_NoBlockMarkedMessage + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_OutOfMemoryMessage Far + + Call PE_FillHeader + Call S_SaveScreen + + Mov DI, Offset O1_OutOfMemoryList + Mov CX, 2 + Call M_Object1List + + Call S_RestoreScreen + + Mov AX, 1 + Ret + +EndP PEFunction_OutOfMemoryMessage + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_NoBlockData Far + + Mov DI, Offset O1_NoBlockDataList + Mov CX, 2 + Call M_Object1List + + Mov AX, 1 + Ret + +EndP PEFunction_NoBlockData + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_BlockOverWrite Far + + Mov AX, BlockDataArea + And AX, AX + JZ PEFunction_NoBlockData + + Cmp [Word Ptr LastKeyBoard2+2], 1800h + JE PEFunction_BlockOverWrite5 + + Mov DI, 10 + Call PE_AddToUndoBuffer + + Mov ES, AX + Mov CL, [ES:0] + Mov CH, [ES:2] + Call NetworkPartialPattern + +PEFunction_BlockOverWrite6: + + Mov BP, MaxRow + Mov BX, Row + Mov CX, Channel + + Call GetPatternOffset + + Mov DS, AX + + Mov SI, 4 ; DS:SI points to block + + Mov AX, CX + Mov DX, [DS:0] + Mov CX, [DS:2] ; DX = width, CX = height + +PEFunction_BlockOverWrite1: + Push AX + Push CX + Push DX + Push DI + +PEFunction_BlockOverWrite2: + Cmp AX, 63 + JA PEFunction_BlockOverWrite3 + + Mov CX, 5 + Rep MovsB + + Jmp PEFunction_BlockOverWrite4 + +PEFunction_BlockOverWrite3: + Add SI, 5 + +PEFunction_BlockOverWrite4: + Inc AX ; AX = channel + Dec DX + JNZ PEFunction_BlockOverWrite2 + + Pop DI + Pop DX + Pop CX + Pop AX + Add DI, 320 + Inc BX + Cmp BX, BP + JA PEFunction_BlockOverWrite5 + + Loop PEFunction_BlockOverWrite1 + +PEFunction_BlockOverWrite5: + Mov AX, 1 + Ret + +EndP PEFunction_BlockOverWrite + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_BlockPaste Far + + Mov AX, BlockDataArea + And AX, AX + JZ PEFunction_NoBlockData + + Cmp [Word Ptr LastKeyBoard2+2], 1900h + JE PEFunction_BlockPaste6 + + Mov DI, 11 + Call PE_AddToUndoBuffer + +PEFunction_BlockPaste6: + Push DS + Mov BP, MaxRow + + Mov ES, AX + + Mov CH, Byte Ptr MaxRow + Sub CH, Byte Ptr Row + Inc CH + Mov CL, [ES:0] + Call NetworkPartialPattern + + Mov BX, [ES:0] ; width + Mov CX, [ES:2] ; height + +; Condition: +; If Row == 0 && Channel == 0 && height > MaxRow && width > 1, then set maxrow = height + Cmp CX, BP + JB PEFunction_BlockPaste7 + + Mov AX, Channel + Or AX, Row + JNZ PEFunction_BlockPaste7 + + Cmp BX, 1 + JBE PEFunction_BlockPaste7 + + Mov BP, CX + Dec BP + Mov MaxRow, BP + +PEFunction_BlockPaste7: + Mov AX, 64 + Mul BP + Add AX, Channel + Mov DX, 5 + Mul DX + Mov SI, AX + Mov DI, AX + + Mov AX, 320 + Mul CX + Add DI, AX ; DI has destination... + + Mov AX, Channel + Mov DS, PatternDataArea + Push DS + Pop ES + +PEFunction_BlockPaste1: + Push AX + Push CX + Push SI + Push DI + + Mov AX, CS:Row + Add AX, CX + Mov DX, BP + Add DX, CX + +PEFunction_BlockPaste5: + Cmp DX, BP + JA PEFunction_BlockPaste3 + + Mov CX, 5 + Rep MovsB + Sub SI, 325 + Sub DI, 325 + + Jmp PEFunction_BlockPaste4 + +PEFunction_BlockPaste3: + Sub SI, 320 + Sub DI, 320 + +PEFunction_BlockPaste4: + Dec DX + Cmp DX, AX + JAE PEFunction_BlockPaste5 + + Pop DI + Pop SI + Pop CX + Pop AX + + Add SI, 5 + Add DI, 5 + Inc AX + Cmp AX, 63 + JA PEFunction_BlockPaste2 + + Dec BX + JNZ PEFunction_BlockPaste1 + +PEFunction_BlockPaste2: + Pop DS + + Mov AX, BlockDataArea + Jmp PEFunction_BlockOverWrite6 + +EndP PEFunction_BlockPaste + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_SecondBlockMix Far + + Mov BP, MaxRow + Mov BX, Row + Mov CX, Channel + + Call GetPatternOffset + + Mov DS, BlockDataArea + + Mov SI, 4 ; DS:SI points to block + + Mov AX, CX + + Mov CL, [DS:0] + Mov CH, [DS:2] + Call NetworkPartialPattern + + Mov DX, [DS:0] + Mov CX, [DS:2] ; DX = width, CX = height + +PEFunction_SecondBlockMix1: + Push AX + Push CX + Push DX + Push DI + +PEFunction_SecondBlockMix2: + Cmp AX, 63 + JA PEFunction_SecondBlockMix3 + + Cmp Byte Ptr [ES:DI], NONOTE ; Note + JNE PEFunction_SecondBlockMix7 + + Mov CL, [DS:SI] + Mov [ES:DI], CL + +PEFunction_SecondBlockMix7: + Inc SI + Inc DI + + Cmp Byte Ptr [ES:DI], 0 ; Instrument + JNE PEFunction_SecondBlockMix8 + + Mov CL, [DS:SI] + Mov [ES:DI], CL + +PEFunction_SecondBlockMix8: + Inc SI + Inc DI + + Cmp Byte Ptr [ES:DI], 0FFh ; Volume + JNE PEFunction_SecondBlockMix9 + + Mov CL, [DS:SI] + Mov [ES:DI], CL + +PEFunction_SecondBlockMix9: + Inc SI + Inc DI + + Cmp Byte Ptr [ES:DI], 0 ; Command + JNE PEFunction_SecondBlockMix10 + + Mov CL, [DS:SI] + Mov [ES:DI], CL + +PEFunction_SecondBlockMix10: + Inc SI + Inc DI + + Cmp Byte Ptr [ES:DI], 0 ; Commandvalue + JNE PEFunction_SecondBlockMix11 + + Mov CL, [DS:SI] + Mov [ES:DI], CL + +PEFunction_SecondBlockMix11: + Inc SI + Inc DI + Jmp PEFunction_SecondBlockMix4 + +PEFunction_SecondBlockMix3: + Add SI, 5 + +PEFunction_SecondBlockMix4: + Inc AX ; AX = channel + Dec DX + JNZ PEFunction_SecondBlockMix2 + + Pop DI + Pop DX + Pop CX + Pop AX + Add DI, 320 + Inc BX + Cmp BX, BP + JA PEFunction_SecondBlockMix5 + + Loop PEFunction_SecondBlockMix1 + +PEFunction_SecondBlockMix5: + Mov AX, 1 + Ret + +EndP PEFunction_SecondBlockMix + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_BlockMix Far + + Cmp BlockDataArea, 0 + JE PEFunction_NoBlockData + + Cmp [Word Ptr LastKeyBoard2+2], 3200h + JNE PEFunction_BlockMix1 + + Cmp [Word Ptr LastKeyboard3+2], 3200h + JE PEFunction_BlockMix6 + + Jmp PEFunction_SecondBlockMix + +PEFunction_BlockMix1: + Mov DI, 9 + Call PE_AddToUndoBuffer + Call NetworkBlock + + Mov BP, MaxRow + Mov BX, Row + Mov CX, Channel + + Call GetPatternOffset + + Mov DS, BlockDataArea + Mov SI, 4 ; DS:SI points to block + + Mov AX, CX + + Mov CL, [DS:0] + Mov CH, [DS:2] + Call NetworkPartialPattern + + Mov DX, [DS:0] + Mov CX, [DS:2] ; DX = width, CX = height + +PEFunction_BlockMix2: + Push AX + Push CX + Push DX + Push DI + +PEFunction_BlockMix3: + Cmp AX, 63 + JA PEFunction_BlockMix4 + + Cmp DWord Ptr [ES:DI], NONOTE + 0FF0000h + JNE PEFunction_BlockMix7 + Cmp Byte Ptr [ES:DI+4], 0 + JNE PEFunction_BlockMix7 + + Mov CX, 5 + Rep MovsB + + Jmp PEFunction_BlockMix5 + +PEFunction_BlockMix7: + Add DI, 5 + +PEFunction_BlockMix4: + Add SI, 5 + +PEFunction_BlockMix5: + Inc AX ; AX = channel + Dec DX + JNZ PEFunction_BlockMix3 + + Pop DI + Pop DX + Pop CX + Pop AX + Add DI, 320 + Inc BX + Cmp BX, BP + JA PEFunction_BlockMix6 + + Loop PEFunction_BlockMix2 + +PEFunction_BlockMix6: + Mov AX, 1 + Ret + +EndP PEFunction_BlockMix + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_UnMarkBlock Far + + Cmp BlockMark, 0 + JZ PEFunction_UnMarkBlock1 + + Mov BlockMark, 0 + Jmp PEFunction_UnMarkBlock2 + +PEFunction_UnMarkBlock1: + Mov AX, BlockDataArea + And AX, AX + JZ PEFunction_NoBlockData + + Mov ES, AX + Mov AH, 49h + Int 21h + + Mov BlockDataArea, 0 +PEFunction_UnMarkBlock2: + Mov AX, 1 + Ret + +EndP PEFunction_UnMarkBlock + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_SemiUp Far + + Cmp [Word Ptr LastKeyBoard2+2], 1000h + JE PEFunction_SemiUp6 + + Mov DI, 2 + Call PE_AddToUndoBuffer + +PEFunction_SemiUp6: + Cmp BlockMark, 0 + JNE PEFunction_SemiUp4 + + Mov CX, 101h + Call NetworkPartialPattern + + Mov AX, 64 + Mul Row + Add AX, Channel + Mov BX, 5 + Mul BX + Mov SI, AX + Mov CX, 1 + Mov DX, CX + Jmp PEFunction_SemiUp5 + +PEFunction_SemiUp4: + Call NetworkBlock + + Mov AX, 64 + Mul BlockTop + Add AX, BlockLeft + Mov BX, 5 + Mul BX ; AX = start offset + + Mov SI, AX + + Mov DX, BlockRight + Sub DX, BlockLeft + Inc DX + + Mov CX, BlockBottom + Sub CX, BlockTop + Inc CX + +PEFunction_SemiUp5: + Mov DS, PatternDataArea + +PEFunction_SemiUp1: + Push DX + Push SI + +PEFunction_SemiUp2: + Cmp Byte Ptr [SI], 119 + JAE PEFunction_SemiUp3 + + Inc Byte Ptr [SI] + +PEFunction_SemiUp3: + Add SI, 5 + Dec DX + JNZ PEFunction_SemiUp2 + + Pop SI + Pop DX + Add SI, 320 + Loop PEFunction_SemiUp1 + + Mov AX, 1 + Ret + +EndP PEFunction_SemiUp + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_SemiDown Far + + Cmp [Word Ptr LastKeyBoard2+2], 1E00h + JE PEFunction_SemiDown6 + + Mov DI, 3 + Call PE_AddToUndoBuffer + +PEFunction_SemiDown6: + Cmp BlockMark, 0 + JNE PEFunction_SemiDown4 + + Mov CX, 101h + Call NetworkPartialPattern + + Mov AX, 64 + Mul Row + Add AX, Channel + Mov BX, 5 + Mul BX + Mov SI, AX + Mov CX, 1 + Mov DX, CX + Jmp PEFunction_SemiDown5 + +PEFunction_SemiDown4: + Call NetworkBlock + + Mov AX, 64 + Mul BlockTop + Add AX, BlockLeft + Mov BX, 5 + Mul BX ; AX = start offset + + Mov SI, AX + + Mov DX, BlockRight + Sub DX, BlockLeft + Inc DX + + Mov CX, BlockBottom + Sub CX, BlockTop + Inc CX + +PEFunction_SemiDown5: + Mov DS, PatternDataArea + +PEFunction_SemiDown1: + Push DX + Push SI + +PEFunction_SemiDown2: + Cmp Byte Ptr [SI], 0 + JLE PEFunction_SemiDown3 + + Dec Byte Ptr [SI] + +PEFunction_SemiDown3: + Add SI, 5 + Dec DX + JNZ PEFunction_SemiDown2 + + Pop SI + Pop DX + Add SI, 320 + Loop PEFunction_SemiDown1 + + Mov AX, 1 + Ret + +EndP PEFunction_SemiDown + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_SlideCommand Far + + Mov DI, 15 + Call PE_AddToUndoBuffer + Call NetworkBlock + + Mov AX, 64 + Mul BlockTop + Add AX, BlockLeft + Mov BX, 5 + Mul BX + Mov SI, AX + + Mov AX, 64 + Mul BlockBottom + Add AX, BlockLeft + Mul BX + Mov DI, AX + + Mov DX, BlockRight + Sub DX, BlockLeft + Inc DX + + Mov CX, BlockBottom + Sub CX, BlockTop + JZ PEFunction_AltX2 ; CX contains number of rows + + Add SI, 4 + Add DI, 4 + Mov DS, PatternDataArea + +PEFunction_AltX1: + Push CX + Push DX + Push SI + + MovZX AX, Byte Ptr [DI] + MovZX BX, Byte Ptr [SI] + Sub AX, BX ; AX = change. + JS PEFunction_AltX4 + + Div CL + Mov BH, AL + Xor AL, AL + Div CL + Mov BL, AL + + Xor AL, AL + Jmp PEFunction_AltX5 + + +PEFunction_AltX4: + Neg AX + Div CL + Mov BH, AL + Xor AL, AL + Div CL + Mov BL, aL + Neg BX + + Mov AL, 0FFh + +PEFunction_AltX5: + Mov AH, [SI] + +PEFunction_AltX3: + Mov [SI], AH + + Add AX, BX + Add SI, 320 + Loop PEFunction_AltX3 + + Pop SI + Pop DX + Pop CX + Add SI, 5 + Add DI, 5 + Dec DX + JNZ PEFunction_AltX1 + +PEFunction_AltX2: + Mov AX, 1 + Ret + +EndP PEFunction_SlideCommand + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_WipeCommands Far + + Cmp BlockMark, 0 + JE PEFunction_NoBlockMarkedMessage + + Cmp [Word Ptr LastKeyBoard2+2], 2D00h + JE PEFunction_WipeCommands4 + + Jmp PEFunction_SlideCommand + +PEFunction_WipeCommands4: + Cmp [Word Ptr LastKeyBoard3+2], 2D00h + JE PEFunction_WipeCommands6 + + Mov DI, 16 + Call PE_AddToUndoBuffer + Call NetworkBlock + +PEFunction_WipeCommands6: + Mov AX, 64 + Mul BlockTop + Add AX, BlockLeft + Mov BX, 5 + Mul BX + Mov DI, AX + + Mov DX, BlockRight + Sub DX, BlockLeft + Inc DX + + Mov CX, BlockBottom + Sub CX, BlockTop + Inc CX + + Mov ES, PatternDataArea + Add DI, 3 + + Xor AX, AX + +PEFunction_WipeCommands2: + Push CX + Push DI + + Mov CX, DX + +PEFunction_WipeCommands3: + StosW + Add DI, 3 + Loop PEFunction_WipeCommands3 + + Pop DI + Pop CX + Add DI, 320 + Loop PEFunction_WipeCommands2 + +PEFunction_WipeCommands1: + Mov AX, 1 + Ret + +EndP PEFunction_WipeCommands + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_VolumeAmp Far + + Cmp BlockMark, 0 + JE PEFunction_NoBlockMarkedMessage + + Test CentraliseCursor, 4 + JZ PENoFast1 + + Mov AX, FastVolumeAmplification + Mov Amplification, AX + Jmp PEFastVolumeAmp + +PENoFast1: + Cmp Amplification, 200 + JBE PENoFast2 + + Mov Amplification, 200 + +PENoFast2: + Push DS + + Mov DI, Offset O1_GetAmpList + Mov CX, 3 + Call M_Object1List + + Pop DS + + Cmp DX, 1 + JNE PEFunction_VolumeAmp1 + +PEFastVolumeAmp: + Mov DI, 6 + Call PE_AddToUndoBuffer + Call NetworkBlock + + Mov AX, 64 + Mul BlockTop + Add AX, BlockLeft + Mov BX, 5 + Mul BX + Mov SI, AX + + Mov CX, BlockBottom + Sub CX, BlockTop + Inc CX + + Mov DX, BlockRight + Sub DX, BlockLeft + Inc DX + + Mov BP, Amplification + Mov BX, 100 +; Mov BH, 100 ; For division + + Mov DS, PatternDataArea + Add SI, 2 + + Call Music_GetSongSegment + Mov ES, AX + +PEFunction_VolumeAmp2: + Push CX + Push DX + Push SI + + Mov CX, DX + +PEFunction_VolumeAmp3: + Mov AL, [SI] + Cmp AL, 0FFh + JNE PEFunction_VolumeAmp6 + + Mov DI, [SI-1] + And DI, 0FFh + JZ PEFunction_VolumeAmp4 + ; OK.. find whether inst/sample + ; then get default vol. + Call Music_GetInstrumentMode + JZ PEFunction_VolumeAmp7 + + Add DI, DI + Mov DI, [ES:64712+DI-2] + Mov AL, [SI-2] + And AX, 0FFh + JZ PEFunction_VolumeAmp4 + Add AX, AX + Add DI, AX + Mov DI, [ES:DI+41h] + And DI, 0FFh + JZ PEFunction_VolumeAmp4 + +PEFunction_VolumeAmp7: + Dec DI + Add DI, DI + Mov DI, [ES:64912+DI] + Mov AL, [ES:DI+13h] + +PEFunction_VolumeAmp6: + Cmp AL, 64 + JA PEFunction_VolumeAmp4 + + Xor AH, AH + Push DX + + Mul BP + Div BX + + Pop DX + + Cmp AX, 64 + JBE PEFunction_VolumeAmp5 + + Mov AL, 64 + +PEFunction_VolumeAmp5: + Mov [SI], AL + +PEFunction_VolumeAmp4: + Add SI, 5 + Loop PEFunction_VolumeAmp3 + + Pop SI + Pop DX + Pop CX + Add SI, 320 + Loop PEFunction_VolumeAmp2 + +PEFunction_VolumeAmp1: + Mov AX, 1 + Ret + +EndP PEFunction_VolumeAmp + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc GetPatternLength + + Push AX + Push BX + Push CX + Push DS + Push SI + Push ES + Push DI + + Call ClearEncodingInfo + ; OK, masks are reset. + + Mov CX, CS:MaxRow + Inc CX + Mov DX, CX ; DX = count of bytes. + ; End of row bytes added. + + Mov DS, CS:PatternDataArea + Xor SI, SI ; SI = pattern area. + + Mov DI, Offset EncodingInfo ; ES:DI points to encoding info + +GetPatternLength1: + Push CX + Push DI + + Mov CX, 64 + +GetPatternLength2: + Cmp Word Ptr [SI], NONOTE + JNE GetPatternLength4 + Cmp Byte Ptr [SI+2], 0FFh + JNE GetPatternLength4 + Cmp Word Ptr [SI+3], 0 + JE GetPatternLength3 + +GetPatternLength4: + Inc DX ; 1 byte for channel + ; indication + JZ GetPatternLength13 + ; AH will be mask + MovZX AX, Byte Ptr [SI] ; Note + Cmp AL, NONOTE + JE GetPatternLength5 + Cmp AL, [ES:DI+1] ; 5 is note. + JE GetPatternLength12 + + Mov [ES:DI+1], AL + Inc DX + JZ GetPatternLength13 + Or AH, 1 + Jmp GetPatternLength5 + +GetPatternLength12: + Or AH, 16 + +GetPatternLength5: + Mov AL, [SI+1] ; Instrument + And AL, AL + JZ GetPatternLength7 + + Cmp AL, [ES:DI+2] + JE GetPatternLength6 + + Mov [ES:DI+2], AL + Inc DX + JZ GetPatternLength13 + Or AH, 2 + Jmp GetPatternLength7 + +GetPatternLength6: + Or AH, 32 + +GetPatternLength7: + Mov AL, [SI+2] ; Volume + Cmp AL, 0FFh + JE GetPatternLength8 + + Cmp AL, [ES:DI+3] + JE GetPatternLength9 + + Mov [ES:DI+3], AL + Inc DX + JZ GetPatternLength13 + Or AH, 4 + Jmp GetPatternLength8 + +GetPatternLength9: + Or AH, 64 + +GetPatternLength8: + Mov BX, [SI+3] + And BX, BX + JZ GetPatternLength11 + Cmp BX, [ES:DI+4] + JE GetPatternLength10 + + Mov [ES:DI+4], BX + + Inc DX + JZ GetPatternLength13 + Inc DX + JZ GetPatternLength13 + Or AH, 8 + + Jmp GetPatternLength11 + +GetPatternLength10: + Or AH, 128 + +GetPatternLength11: + Cmp AH, [ES:DI] + JE GetPatternLength3 + + Inc DX + JZ GetPatternLength13 + Mov [ES:DI], AH + +GetPatternLength3: + + Add SI, 5 + Add DI, 6 + Loop GetPatternLength2 + + Pop DI + Pop CX + Loop GetPatternLength1 + + Pop DI + Pop ES + Pop SI + Pop DS + Pop CX + Pop BX + Pop AX + + Ret + +GetPatternLength13: + Mov DI, Offset O1_PatternTooLongList + Mov CX, 2 + Call M_Object1List + + Add SP, 22 ; yes! + Mov AX, 1 + RetF + +EndP GetPatternLength + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +IF SHOWPATTERNLENGTH + +Proc PE_ShowPatternLength Far + + Push AX ; Just for stack length.. + Call GetPatternLength + Pop AX + + Mov AX, Object1 + Push AX + Mov DS, AX + Mov AX, Offset O1_ShowPatternLengthList + Push AX + Mov SI, Offset PatternLength + Mov [SI], DX + Call M_FunctionHandler + + Mov AX, 1 + Ret + +EndP PE_ShowPatternLength + +ENDIF + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +DecodePatternBytes DW 0 +DecodePatternOffset DW 0 + +Proc DecodePattern ; DS:SI points to pattern info to decode + + PushA + Push DS + Push ES + +; Call ClearEncodingInfo ; Should be unnecess. + + + Push CS + Pop ES + Mov BX, Offset EncodingInfo + + LodsW ; AX = number of bytes + Mov CS:DecodePatternBytes, AX + LodsW ; AX = maxrow + Mov CX, AX + Dec AX + Mov CS:MaxRow, AX + LodsW + LodsW + + Mov CS:DecodePatternOffset, SI + + Call PE_ClearPatternData + + Mov ES, CS:PatternDataArea + Xor DI, DI + +DecodePattern1: + Push CX + +DecodePattern5: + LodsB ; AL = channel byte. + Test AL, AL + JZ DecodePattern2 + + Push BX + Push DI + + Mov CX, AX + Dec CX + And CX, 63 + + ; DI = DI + Channel*5 + ; BX = EncodingInfo + Channel*6 + + LEA BX, [ECX*4+ECX] + LEA DI, [DI+BX] + LEA BX, [EBX+ECX+EncodingInfo] + + Test AL, 128 + JZ DecodePattern3 + + Mov DL, [SI] + Inc SI + + Mov [CS:BX], DL + Jmp DecodePattern4 + +DecodePattern3: + Mov DL, [CS:BX] ; DL = mask + +DecodePattern4: + Test DL, 1 + JZ DecodePattern13 + + LodsB + + Mov [ES:DI], AL + Mov [CS:BX+1], AL + Jmp DecodePattern6 + +DecodePattern13: + Test DL, 16 + JZ DecodePattern6 + + Mov AL, [CS:BX+1] + Mov [ES:DI], AL + +DecodePattern6: + Test DL, 2 + JZ DecodePattern7 + + LodsB + + Mov [ES:DI+1], AL + Mov [CS:BX+2], AL + Jmp DecodePattern8 + +DecodePattern7: + Test DL, 32 + JZ DecodePattern8 + + Mov AL, [CS:BX+2] + Mov [ES:DI+1], AL + +DecodePattern8: + Test DL, 4 + JZ DecodePattern9 + + LodsB + + Mov [ES:DI+2], AL + Mov [CS:BX+3], AL + Jmp DecodePattern10 + +DecodePattern9: + Test DL, 64 + JZ DecodePattern10 + + Mov AL, [CS:BX+3] + Mov [ES:DI+2], AL + +DecodePattern10: + Test DL, 8 + JZ DecodePattern11 + + LodsW + + Mov [ES:DI+3], AX + Mov [CS:BX+4], AX + Jmp DecodePattern12 + +DecodePattern11: + Test DL, 128 + JZ DecodePattern12 + + Mov AX, [CS:BX+4] + Mov [ES:DI+3], AX + +DecodePattern12: + Pop DI + Pop BX + Jmp DecodePattern5 + +DecodePattern2: + Pop CX + Add DI, 320 + Loop DecodePattern1 + + Sub SI, CS:DecodePatternOffset + Cmp SI, CS:DecodePatternBytes + JE DecodePatternEnd + + Mov CX, 0FFFFh + Mov DI, Offset O1_PatternSizeMismatchList + Call M_Object1List + +DecodePatternEnd: + Pop ES + Pop DS + PopA + + Call Music_UpdatePatternOffset + + Ret + +EndP DecodePattern + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc EncodePattern ; ES:DI points to area to deposit data + ; DX = length of data + + Push AX + Push BX + Push CX + Push DX + Push DS + Push SI + + Push ES + Push DI + + Call ClearEncodingInfo + + Pop DI + Pop ES + + Mov BX, Offset EncodingInfo + + Mov AX, DX + StosW + + Mov CX, CS:MaxRow + Inc CX + + Mov AX, CX + StosW + + Xor AX, AX + StosW + StosW ; This is the header. + + Xor SI, SI + Mov DS, CS:PatternDataArea + +EncodePattern1: + Push BX + Push CX + + Xor DX, DX ; DL = channelnumber + ; DH is used as mask val. + Mov CX, 64 + +EncodePattern2: + Cmp Word Ptr [SI], NONOTE + JNE EncodePattern3 + Cmp Byte Ptr [SI+2], 0FFh + JNE EncodePattern8 + Cmp Word Ptr [SI+3], 0 + JE EncodePattern4 + Jmp EncodePattern10 + +EncodePattern3: + Mov AL, [SI] + Cmp AL, NONOTE + JE EncodePattern5 + Cmp AL, [CS:BX+1] ; 1=note + JE EncodePattern6 + + Mov [CS:BX+1], AL + Or DH, 1 + Jmp EncodePattern5 + +EncodePattern6: + Or DH, 16 + +EncodePattern5: + Mov AL, [SI+1] + And AL, AL + JZ EncodePattern8 + Cmp AL, [CS:BX+2] ; 2=ins + JE EncodePattern7 + + Mov [CS:BX+2], AL + Or DH, 2 + Jmp EncodePattern8 + +EncodePattern7: + Or DH, 32 + +EncodePattern8: + Mov AL, [SI+2] + Cmp AL, 0FFh + JE EncodePattern10 + Cmp AL, [CS:BX+3] ; 3=vol + JE EncodePattern9 + + Mov [CS:BX+3], AL + Or DH, 4 + Jmp EncodePattern10 + +EncodePattern9: + Or DH, 64 + +EncodePattern10: + Mov AX, [SI+3] + Test AX, AX + JZ EncodePattern12 + Cmp AX, [CS:BX+4] ; 4=effect + JE EncodePattern11 + + Mov [CS:BX+4], AX + Or DH, 8 + Jmp EncodePattern12 + +EncodePattern11: + Or DH, 128 + +EncodePattern12: + Mov AL, DL + Inc AX + + Cmp [CS:BX], DH ; 0 = mask + JE EncodePattern13 + + Mov [CS:BX], DH + Or AL, 128 ; read another mask... + StosB + Mov AL, DH + StosB + Jmp EncodePattern14 + +EncodePattern13: + StosB + +EncodePattern14: + Test DH, 1 + JZ EncodePattern15 + + Mov AL, [SI] + StosB + +EncodePattern15: + Test DH, 2 + JZ EncodePattern16 + + Mov AL, [SI+1] + StosB + +EncodePattern16: + Test DH, 4 + JZ EncodePattern17 + + Mov AL, [SI+2] + StosB + +EncodePattern17: + Test DH, 8 + JZ EncodePattern18 + + Mov AX, [SI+3] + StosW + +EncodePattern18: + Xor DH, DH + +EncodePattern4: + Add SI, 5 + Add BX, 6 + Inc DX + Loop EncodePattern2 + + Pop CX + Pop BX + Xor AL, AL + StosB + Loop EncodePattern1 + + Pop SI + Pop DS + Pop DX + Pop CX + Pop BX + Pop AX + Ret + +EndP EncodePattern + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_StorePattern + +IF NETWORKENABLED + Cmp PatternModified, 0 + JE PEFunction_StorePattern5 + + Mov AX, PatternNumber + ShL AX, 8 + Add AX, NETWORK_ENTIREPATTERNOBJECT + Call Network_AddWordToQueue + +PEFunction_StorePattern5: +ENDIF + + Mov AX, PatternNumber + Mov SI, AX + Call Music_ReleasePattern + + Call GetPatternLength + Cmp DX, 64 + JNE PEFunction_StorePattern1 + Cmp CS:MaxRow, 63 + JE PEFunction_StorePattern2 + +PEFunction_StorePattern1: + Add DX, 8 + JC PEFunction_StorePattern4 + + ClI + + Call Music_AllocatePattern + Mov AX, ES + And AX, AX + JZ PEFunction_StorePattern3 + Sub DX, 8 + Call EncodePattern + + StI + +PEFunction_StorePattern2: + Ret + +PEFunction_StorePattern3: + StI + + Add SP, 2 + Jmp PEFunction_OutOfMemoryMessage + +PEFunction_StorePattern4: + Mov DI, Offset O1_PatternTooLongList + Mov CX, 2 + Call M_Object1List + + Pop AX + Mov AX, 1 + RetF + +EndP PEFunction_StorePattern + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_StoreCurrentPattern Far + + Push CS + Pop DS + Call PEFunction_StorePattern + + Mov AX, 1 + Ret + +EndP PEFunction_StoreCurrentPattern + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc NewPattern ; Reqs. AX = pattern + +IF NETWORKENABLED + Call Network_UpdatePattern +ENDIF + Call Music_GetPattern + Call DecodePattern + + Mov CS:PatternModified, 0 + Mov AH, CS:Byte Ptr PatternNumber + Mov AL, 22 + Mov DI, AX +; Mov DI, 22 + Call PE_AddToUndoBuffer + + Ret + +EndP NewPattern + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_GotoPattern Far ; AX = pattern. + + Push CS + Pop DS + + Mov Row, BX + Mov Channel, CX + +PE_GotoPattern2: + Cmp PatternModified, 0 + JE PE_GotoPattern1 + + Mov TempVariableArea, AX + Call PEFunction_StorePattern + Mov AX, TempVariableArea + +PE_GotoPattern1: + Mov PatternNumber, AX + Call NewPattern + + Jmp Glbl_F2 + +EndP PE_GotoPattern + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +include pe_trans.inc + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_NextPattern Far + + Cmp TracePlayback, 0 + JE PEFunction_NextPatternNoTrace + + Call Music_GetPlayMode + Cmp AX, 1 + JE PEFunction_NextPattern1 + JB PEFunction_NextPatternNoTrace + + Call Music_NextOrder + Jmp PEFunction_NextPattern1 + +PEFunction_NextPatternNoTrace: + Cmp PatternNumber, 199 + JAE PEFunction_NextPattern1 + + Cmp PatternModified, 0 + JE PEFunction_NextPattern2 + + Call PEFunction_StorePattern + +PEFunction_NextPattern2: + Inc PatternNumber + Mov AX, PatternNumber + + Call NewPattern + +PEFunction_NextPattern1: + Mov AX, 1 + Ret + +EndP PEFunction_NextPattern + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_LastPattern Far + + Cmp TracePlayback, 0 + JE PEFunction_LastPatternNoTrace + + Call Music_GetPlayMode + Cmp AX, 1 + JE PEFunction_LastPattern1 + JB PEFunction_LastPatternNoTrace + + Call Music_LastOrder + Jmp PEFunction_LastPattern1 + +PEFunction_LastPatternNoTrace: + Cmp PatternNumber, 0 + JE PEFunction_LastPattern1 + + Cmp PatternModified, 0 + JE PEFunction_LastPattern2 + + Call PEFunction_StorePattern + +PEFunction_LastPattern2: + Dec PatternNumber + Mov AX, PatternNumber + + Call NewPattern + +PEFunction_LastPattern1: + Mov AX, 1 + Ret + +EndP PEFunction_LastPattern +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_Next4Patterns Far + + Cmp PatternModified, 0 + JE PEFunction_Next4Patterns2 + + Call PEFunction_StorePattern + +PEFunction_Next4Patterns2: + Mov AX, PatternNumber + Add AX, 4 + Cmp AX, 199 + JBE PEFunction_Next4Patterns1 + + Mov AX, 199 + +PEFunction_Next4Patterns1: + Mov PatternNumber, AX + + Call NewPattern + + Mov AX, 1 + Ret + +EndP PEFunction_Next4Patterns + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_Last4Patterns Far + + Cmp PatternModified, 0 + JE PEFunction_Last4Patterns2 + + Call PEFunction_StorePattern + +PEFunction_Last4Patterns2: + Mov AX, PatternNumber + Sub AX, 4 + JNS PEFunction_Last4Patterns1 + + Xor AX, AX + +PEFunction_Last4Patterns1: + Mov PatternNumber, AX + + Call NewPattern + + Mov AX, 1 + Ret + +EndP PEFunction_Last4Patterns + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_LastOrderPattern Far + + Cmp PatternModified, 0 + JE PEFunction_LastOrderPattern3 + + Call PEFunction_StorePattern + +PEFunction_LastOrderPattern3: + Call Music_GetSongSegment + Mov ES, AX + + Mov BX, Order + And BX, BX + JZ PEFunction_LastOrderPattern2 + + Cmp Byte Ptr [ES:BX+0FFh], 200 + JAE PEFunction_LastOrderPattern2 + + Dec BX + Mov Order, BX + +PEFunction_LastOrderPattern2: + MovZX AX, Byte Ptr [ES:BX+0100h] + Cmp AL, 200 + JAE PEFunction_LastOrderPattern1 + + Mov PatternNumber, AX + + Call NewPattern + +PEFunction_LastOrderPattern1: + Mov AX, 1 + Ret + +EndP PEFunction_LastOrderPattern + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_NextOrderPattern Far + + Cmp PatternModified, 0 + JE PEFunction_NextOrderPattern3 + + Call PEFunction_StorePattern + +PEFunction_NextOrderPattern3: + Mov BX, Order + + Cmp BX, 0FFh + JAE PEFunction_NextOrderPattern1 + + Call Music_GetSongSegment + Mov ES, AX + Cmp Byte Ptr [ES:BX+101h], 200 + JAE PEFunction_NextOrderPattern2 + + Inc BX + Mov Order, BX + +PEFunction_NextOrderPattern2: + MovZX AX, Byte Ptr [ES:BX+100h] + Cmp AL, 200 + JAE PEFunction_NextOrderPattern1 + + Mov PatternNumber, AX + + Call NewPattern + +PEFunction_NextOrderPattern1: + Mov AX, 1 + Ret + +EndP PEFunction_NextOrderPattern + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_Alt0 Far + + Xor AX, AX + Mov SkipValue, AX + Mov SI, Offset CursorStepMsg + Call SetInfoLine + + Inc AX + + Ret + +EndP PEFunction_Alt0 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_BlockVolume Far + + Cmp BlockMark, 0 + JE PEFunction_NoBlockMarkedMessage + + Cmp [Word Ptr LastKeyBoard2], 2F00h + JE PEFunction_BlockVolume3 + + Mov DI, 13 + Call PE_AddToUndoBuffer + Call NetworkBlock + +PEFunction_BlockVolume3: + Mov AX, 64 + Mul BlockTop + Add AX, BlockLeft + Mov BX, 5 + Mul BX + + Mov SI, AX + Mov CX, BlockBottom + Sub CX, BlockTop + Inc CX + + Mov DX, BlockRight + Sub DX, BlockLeft + Inc DX + + Mov AL, LastVolume + + Mov DS, PatternDataArea + Add SI, 2 + +PEFunction_BlockVolume1: + Push CX + Push SI + + Mov CX, DX + +PEFunction_BlockVolume2: + Mov [SI], AL + + Add SI, 5 + Loop PEFunction_BlockVolume2 + + Pop SI + Pop CX + Add SI, 320 + Loop PEFunction_BlockVolume1 + + Mov AX, 1 + Ret + +EndP PEFunction_BlockVolume + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_WipeExcessVolumes Far + + Cmp BlockMark, 0 + JE PEFunction_NoBlockMarkedMessage + + Cmp [Word Ptr LastKeyBoard2+2], 1100h + JE PEFunction_WipeExcessVolumesEnd + + Mov DI, 14 + Call PE_AddToUndoBuffer + Call NetworkBlock + + Mov AX, 64 + Mul BlockTop + Add AX, BlockLeft + Mov BX, 5 + Mul BX + Mov SI, AX + + Mov CX, BlockBottom + Sub CX, BlockTop + Inc CX + + Mov DX, BlockRight + Sub DX, BlockLeft + Inc DX + + Mov DS, PatternDataArea + Mov AL, 0FFh + +PEFunction_WipeExcessVolumes1: + Push CX + Push SI + + Mov CX, DX + +PEFunction_WipeExcessVolumes2: + Cmp Byte Ptr [SI+1], 0 + JNE PEFunction_WipeExcessVolumes3 + + Cmp Byte Ptr [SI], NONOTE + JAE PEFunction_WipeExcessVolumes4 + +PEFunction_WipeExcessVolumes3: + Add SI, 5 + Loop PEFunction_WipeExcessVolumes2 + + Pop SI + Pop CX + Add SI, 320 + Loop PEFunction_WipeExcessVolumes1 + +PEFunction_WipeExcessVolumesEnd: + Mov AX, 1 + Ret + +PEFunction_WipeExcessVolumes4: + Mov [SI+2], AL + Jmp PEFunction_WipeExcessVolumes3 + +EndP PEFunction_WipeExcessVolumes + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_PlayCurrentNote Far + + Mov AX, 64 + Mul Row + Add AX, Channel + Mov BX, 5 + Mul BX + Mov SI, AX + Mov AX, Channel + Mov DS, PatternDataArea + Mov DH, 32 + Call Music_PlayNote + +IF CHORDENTRY + Push CS + Pop DS + + Cmp ShiftPressed, 0 + JE PE_GotoNextInput + + Push SkipValue + Mov SkipValue, 0 + Mov NoteEntered, 1 + + Call PE_GotoNextInput + Pop SkipValue + + Mov AX, 1 + Ret +ELSE + Jmp PEFunction_Down +ENDIF + +EndP PEFunction_PlayCurrentNote + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_PlayCurrentRow Far + + Mov CX, 64 + Mov DS, PatternDataArea + + Mov AX, 320 + Mul CS:Row + Mov SI, AX + Xor AX, AX + +PEFunction_PlayCurrentRow1: +; Push CX + +; Dec CX +; Mov AX, 64 +; Mul CS:Row +; Add AX, CX +; Mov BX, 5 +; Mul BX +; Mov SI, AX +; Mov AX, CX + Xor DH, DH + Call Music_PlayNote + +; Pop CX + Inc AX + Add SI, 5 + Loop PEFunction_PlayCurrentRow1 + + Jmp PEFunction_Down + +EndP PEFunction_PlayCurrentRow + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_RestoreData Far + +; Mov PatternModified, 0 + + Cmp Byte Ptr LastKeyBoard2, 0Eh + JE PEFunction_RestoreData1 + + Mov DI, 1 + Call PE_AddToUndoBuffer + +PEFunction_RestoreData1: + Mov AX, PatternNumber + + Call Music_GetPattern + Call DecodePattern + + Xor BX, BX + Mov CL, 64 + Mov CH, Byte Ptr [CS:MaxRow] + Inc CH + Call NetworkPatternBlock + + Mov AX, 1 + Ret + + Ret + +EndP PEFunction_RestoreData + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_ToggleDefaultVolume Far + + Xor Flags, 1 + Mov SI, Offset DefaultVolumeOn + Test Flags, 1 + JNZ PEFunction_ToggleDefaultVolume1 + + Mov SI, Offset DefaultVolumeOff + +PEFunction_ToggleDefaultVolume1: + Call SetInfoLine + + Mov AX, 1 + Ret + +EndP PE_ToggleDefaultVolume + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_ToggleTemplate Far + + Test CentraliseCursor, 4 + JZ ToggleTemplate2 + + Cmp BlockMark, 0 + JE PEFunction_NoBlockMarkedMessage + + ; Amplification = 1/(FastVolumeAmplification/100) + ; = 10050/FastvolumeAmplification + Mov AX, 10050 + Xor DX, DX + Div FastVolumeAmplification + Mov Amplification, AX + Jmp PEFastVolumeAmp + +ToggleTemplate2: + Mov AL, Template + Inc AX + Cmp AL, 4 + JBE PEFunction_ToggleTemplate1 + +Proc PEFunction_TemplateOff Far + + Xor AL, AL + +PEFunction_ToggleTemplate1: + Mov Template, AL + + Mov AX, 1 + Ret + +EndP PEFunction_TemplateOff + +EndP PEFunction_ToggleTemplate + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_GetCurrentPattern Far + + Mov AX, CS:PatternNumber + Mov BX, CS:MaxRow + Inc BX + Mov DS, CS:PatternDataArea + + Ret + +EndP PE_GetCurrentPattern + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_CheckWidth + + Xor DX, DX ; Time to work out width + Xor CX, CX ; Count of channels. + Mov SI, Offset ViewChannels + +PE_CheckWidth1: + LodsW + Cmp AL, 0FFh + JE PE_CheckWidth2 + + MovZX BX, AH + ShL BX, 2 + Add DX, [ViewMethodInfo+BX+2] + Inc CX + Jmp PE_CheckWidth1 + +PE_CheckWidth2: + And CX, CX + JZ PE_CheckWidth3 + + Add DX, 2 + + Cmp ViewDivision, 0 + JE PE_CheckWidth3 + + Dec CX + Add DX, CX + +PE_CheckWidth3: + Cmp DX, 76 ; Too big to fit screen? + JAE PE_CheckWidth5 + + Mov ViewWidth, DX + Xor AX, AX + Cmp DX, 74 + JAE PE_CheckWidth4 + + Mov AX, 74 + Sub AX, DX + Mov BL, 14 + Div BL + Xor AH, AH + +PE_CheckWidth4: + Mov NumChannelsEdit, AX + + DB 85h ; +PE_CheckWidth5: ; + StC ; + Ret + +EndP PE_CheckWidth + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_ViewTrack Far + + Mov DX, Channel + Mov SI, Offset ViewChannels + +PEFunction_ViewTrack2: + LodsW + Cmp AL, 0FFh ; No more in list?? + JE PEFunction_ViewTrack1 + + Cmp AL, DL + JNE PEFunction_ViewTrack2 + +PEFunction_ViewTrack1: + Sub SI, 2 + + Mov CX, AX ; Store old value. + Mov AL, DL + Inc AH + Cmp AH, 4 ; Number of view methods + JBE PEFunction_ViewTrack3 + + LodsW + +PEFunction_ViewTrack8: + LodsW + Mov [SI-4], AX + Cmp AX, 0FFFFh + JNE PEFunction_ViewTrack8 + + Jmp PEFunction_ViewTrack9 + +PEFunction_ViewTrack3: + Mov [SI], AX ; Update... + +PEFunction_ViewTrack9: + Push CX + Push SI + + Call PE_CheckWidth + JC PEFunction_ViewTrack7 + + Add SP, 4 + Mov AX, 1 + Ret + +PEFunction_ViewTrack7: + Pop SI + Pop CX + Mov AX, [SI] + Inc AH + Cmp AH, 4 ; Number of view methods + JE PEFunction_ViewTrack10 + + Mov [SI], AX + + Jmp PEFunction_ViewTrack9 + +PEFunction_ViewTrack10: + Mov [SI], CX + + Mov AX, 1 + Ret + +EndP PEFunction_ViewTrack + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_ClearViews Far + + Push CS + Pop ES + Mov DI, Offset ViewChannels + Mov CX, 100 + Mov AX, 0FFFFh + Rep StosW + + Mov ViewWidth, 0 + Mov AX, StartChannelEdit + Mov NumChannelsEdit, AX + Mov ViewChannelTracking, 0 + + Mov AX, 1 + Ret + +EndP PEFunction_ClearViews + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_SelectColour Near + + MovZX AX, CL ; AL = row number + + Mov CH, 0E6h + Cmp CS:RowHilight2, 0 + JE PE_SelectColour4 + Div CS:RowHilight2 + And AH, AH + JZ PE_SelectColour1 + +PE_SelectColour4: + MovZX AX, CL + Mov CH, 0F6h + Cmp CS:RowHilight1, 0 + JE PE_SelectColour5 + Div CS:RowHiLight1 + And AH, AH + JZ PE_SelectColour1 + +PE_SelectColour5: + Mov CH, 6 + +PE_SelectColour1: ; Check for block, CL = rownum, BP = ch + MovZX AX, CL ; AX = row number + Cmp CS:BlockMark, 0 + JE PE_SelectColour3 + Cmp BP, CS:BlockLeft + JB PE_SelectColour3 + Cmp BP, CS:BlockRight + JA PE_SelectColour3 + Cmp AX, CS:BlockTop + JB PE_SelectColour3 + Cmp AX, CS:BlockBottom + JA PE_SelectColour3 + + Test CH, 80h + JZ PE_SelectColour2 + + Mov CH, 96h + Ret + +PE_SelectColour2: + Mov CH, 86h + Ret + +PE_SelectColour3: + Cmp AX, CS:Row + JNE PE_SelectColour6 + + Test CS:CentraliseCursor, 2 + JZ PE_SelectColour6 + + Mov CH, 16h + +PE_SelectColour6: + Ret + +EndP PE_SelectColour + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_HilightCursor Near + + Mov AX, [ES:DI] + And AH, 8 + Or AH, 30h + StosW + + Ret + +EndP PE_HilightCursor + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_HilightView Near + + Mov AX, 1 + Cmp CS:Template, 0 + JE PE_HilightView1 + + Cmp CS:ShiftPressed, 0 + JNE PE_HilightView1 + + Cmp CS:PatternCursor, 0 + JNE PE_HilightView1 + + Cmp CS:BlockDataArea, 0 + JE PE_HilightView1 + + Mov FS, CS:BlockDataArea + Mov AX, [FS:0] + +PE_HilightView1: + Mov CX, CS:Channel + Cmp DX, CX + JB PE_HilightViewEnd + Add CX, AX + Cmp DX, CX + JAE PE_HilightViewEnd + + Sub DI, (32*160) + Mov AL, 160 + Mov CX, CS:Row + Sub CX, CS:TopRow + Mul CL + Add DI, AX + Add BP, CS:PatternCursor + + Mov CL, Byte Ptr [CS:BP] + Mov AX, CX + And AX, 0Fh + + Add AX, AX + Add DI, AX + + Mov DX, [ES:DI] + Test DH, 8 + JNZ PE_HilightView4 + Cmp DL, 184 + JE PE_HilightView4 + Cmp DL, 226 + JB PE_HilightView2 + Cmp DL, 246 + JAE PE_HilightView2 + +PE_HilightView4: + Mov AH, 0Fh ; mask value + Cmp CL, Byte Ptr [CS:BP+1] + JE PE_HilightView3 + + Mov AH, 0F0h + +PE_HilightView3: + Call S_InvertCursor + + Mov AX, 246+3000h + StosW + +PE_HilightViewEnd: + Ret + +PE_HilightView2: + Mov AX, [ES:DI] + Mov AH, 30h + StosW + + Sub CL, 10h + JNC PE_HilightView2 + + Ret + +EndP PE_HilightView + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_GetChannelColour ; Puts colour in AH + ; Param: BP = channel + + Push DS + + Call Music_GetSongSegment + Mov DS, AX + + Mov AH, 13h + Test Byte Ptr [DS:BP+40h], 80h + JZ PE_GetChannelColour1 + + Mov AH, 10h + +PE_GetChannelColour1: + Pop DS + + Ret + +EndP PE_GetChannelColour + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ViewCommon + + Push DS + Push ES + Push DI + + Mov BP, DX + And BP, 0FFh + + Push CS + Pop DS + MovZX AX, DL + Inc AX + Mov DX, 0A0Ch + Div DH +; Mov DL, 10 +; Div DL + + Add AX, 3030h + Mov [SI+BX], AX + Sub DI, 160 + Call PE_GetChannelColour + Call S_DrawString + + Pop DI + Pop ES + Pop DS + +; Mov DX, 0A0Ch ; DH = 10, DL = 12 (for div.) + + Mov CH, 32 + + Ret + +EndP ViewCommon + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + + +Proc ViewFull ; DS:SI = pattern data + ; ES:DI = screen pointer + ; CS:BX = note data + ; CX = row number + ; DL = channel number. + + Push SI + Push BX + + Mov SI, Offset ChannelMsg + Mov BX, 9 + Call ViewCommon + + Pop BX + Pop SI + +ViewFull1: + Push CX + Push DX + Push DI + + Call PE_SelectColour + + LodsB + Call Draw_3Note + Mov AL, 20h + StosW + + LodsB ; Instrument + Call Draw_2Instrument + Mov AL, 20h + StosW + + LodsB ; Volume + Cmp AL, 0FFh + JNE ViewFull8 + + Mov AL, 173 + StosW + StosW + + Jmp ViewFull9 + +ViewFull8: + Mov AH, AL + And AH, 7Fh + Sub AH, 65 + JC ViewFullNoVEffect + + Test AL, 80h + JZ ViewFullVEffect1 + + Add AH, 60 + +ViewFullVEffect1: + Mov AL, AH + Xor AH, AH + Div DH + ; AL = effect, AH = num + Add AX, 'A'+'0'*256 + Mov CL, AH + Mov AH, CH + StosW + Mov AL, CL + StosW + + Jmp ViewFull9 + +ViewFullNoVEffect: + Mov DL, CH + + Test AL, 80h + JZ ViewFull12 + + And DL, 0F0h + Or DL, 2 + And AL, 7Fh ; Filter out panning stuff. + +ViewFull12: + Xor AH, AH + Div DH + Add AX, 3030h + Mov CL, AH + Mov AH, DL + StosW + Mov AL, CL + StosW + + Mov AH, CH + +ViewFull9: + Mov AL, 20h + StosW + + LodsB ; Command + And AL, AL + JNZ ViewFull10 + + Mov AL, '.' + StosW + Jmp ViewFull11 + +ViewFull10: + Add AL, '@' + StosW + +ViewFull11: + LodsB ; Command value + + AAM 16 ; AH = High nibble, AL = low nibble + Mov CL, AL + Mov AL, AH + Mov AH, CH + Call PE_ConvHexAL + + Mov AL, CL + Call PE_ConvHexAL + + Add SI, 315 + Pop DI + Add DI, 160 + Pop DX + Pop CX + Inc CX + Dec CH + JNZ ViewFull1 + + Mov DX, BP + Mov BP, Offset CursorPositions + Jmp PE_HilightView + +EndP ViewFull + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ViewCompress ; DS:SI = pattern data + ; ES:DI = screen pointer + ; CS:BX = note data + ; CX = row number + ; DL = channel number. + + Push SI + Push BX + + Mov SI, Offset ChannelMsg2 + Mov BX, 8 + Call ViewCommon + + Pop BX + Pop SI + +ViewCompress1: + Push CX + Push DX + Push DI + + Call PE_SelectColour + + LodsB + + Call Draw_3Note + + LodsB ; Instrument + Sub CH, 4 + Call Draw_2Instrument + Add CH, 4 + + LodsB ; Volume + Mov AH, CH + + Cmp AL, 0FFh + JNE ViewCompress8 + + Mov AL, 173 + StosW + StosW + + Jmp ViewCompress9 + +ViewCompress8: + Mov AH, AL + And AH, 7Fh + Sub AH, 65 + JC ViewCompressNoVEffect + + Test AL, 80h + JZ ViewCompressVEffect1 + + Add AH, 60 + +ViewCompressVEffect1: + Mov AL, AH + Xor AH, AH + Div DH + ; AL = effect, AH = num + Add AX, 'A'+'0'*256 + Mov CL, AH + Mov AH, CH + StosW + Mov AL, CL + StosW + + Jmp ViewCompress9 + +ViewCompressNoVEffect: + Mov DL, CH + + Test AL, 80h + JZ ViewCompress12 + + And DL, 0F0h + Or DL, 2 + And AL, 7Fh ; Filter out panning stuff. + +ViewCompress12: + Xor AH, AH + Div DH + Add AX, 3030h + Mov CL, AH + Mov AH, DL + StosW + Mov AL, CL + StosW + Mov AH, CH + +ViewCompress9: + LodsB ; Command + Sub AH, 4 + And AL, AL + JNZ ViewCompress10 + + Mov AL, '.' + StosW + Jmp ViewCompress11 + +ViewCompress10: + Add AL, '@' + StosW + +ViewCompress11: + LodsB ; Command value + AAM 16 ; AH = High nibble, AL = low nibble + Mov CL, AL + Mov AL, AH + Mov AH, CH + Sub AH, 4 + Call PE_ConvHexAL + + Mov AL, CL + Call PE_ConvHexAL + + Add SI, 315 + Pop DI + Add DI, 160 + Pop DX + Pop CX + Inc CX + Dec CH + JNZ ViewCompress1 + + Mov DX, BP + Mov BP, Offset CursorPositions+9 + Jmp PE_HilightView + +EndP ViewCompress + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ViewAllSmall ; DS:SI = pattern data + ; ES:DI = screen pointer + ; CS:BX = note data + ; CX = row number + ; DL = channel number. + + Push SI + Push BX + + Mov SI, Offset ChannelMsg7 + Mov BX, 5 + Call ViewCommon + + Pop BX + Pop SI + +ViewAllSmall1: + Push CX + Push DI + + Call PE_SelectColour + + LodsB + Call Draw_3Note + + LodsB ; Instrument + And AL, AL + JNZ ViewAllSmall6 + + Mov AL, 184 + Sub AH, 4 + StosW + Jmp ViewAllSmall7 + +ViewAllSmall6: + Xor AH, AH + Div DH + ShL AL, 4 + Or AL, AH + Mov AH, CH + Add AH, 4 + StosW + +ViewAllSmall7: + LodsB ; Volume + Cmp AL, 0FFh + JNE ViewAllSmall8 + + Mov AL, 184 + Mov AH, CH + StosW + + Jmp ViewAllSmall9 + +ViewAllSmall8: + Mov CL, CH + Add CL, 6 + + Mov AH, AL + And AH, 7Fh + Sub AH, 65 + JC ViewAllSmallNoVEffect + + Test AL, 80h + JZ ViewAllSmallVEffect1 + + Mov AL, AH + Add AL, 226 + Mov AH, CH + StosW + Jmp ViewAllSmall9 + +ViewAllSmallVEffect1: + Mov AL, AH + Mov AH, 0 + Div DH + ; AL = effect, AH = num + Add AL, 0Ah + ShL AL, 4 + Or AL, AH + Mov AH, CL + StosW + + Jmp ViewAllSmall9 + +ViewAllSmallNoVEffect: + Test AL, 80h + JZ ViewAllSmall12 + + Sub CL, 2 + And AL, 7Fh ; Filter out panning stuff. + +ViewAllSmall12: + Xor AH, AH + Div DH + ShL AL, 4 + Or AL, AH + Mov AH, CL + StosW + +ViewAllSmall9: + LodsB ; Command + Mov AH, CH + Sub AH, 4 + + And AL, AL + JNZ ViewAllSmall10 + + Mov AL, '.' + StosW + Jmp ViewAllSmall11 + +ViewAllSmall10: + Add AL, '@' + StosW + +ViewAllSmall11: + LodsB ; Command value + Add AH, 8 + StosW + + Add SI, 315 + Pop DI + Add DI, 160 + Pop CX + Inc CX + Dec CH + JNZ ViewAllSmall1 + + Mov DX, BP + Mov BP, Offset CursorPositions+18 + Jmp PE_HilightView + +EndP ViewAllSmall + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ViewNote ; DS:SI = pattern data + ; ES:DI = screen pointer + ; CS:BX = note data + ; CX = row number + ; DL = channel number. + + Push SI + Push BX + + Mov SI, Offset ChannelMsg4 + Mov BX, 1 + Call ViewCommon + + Pop BX + Pop SI + +ViewNote1: + Push CX + Push SI + Push DI + + Call PE_SelectColour + + LodsB + Cmp AL, NONOTE + JE ViewNote4 + + Call Draw_3Note + Jmp ViewNoteEnd + +ViewNote4: + LodsB + + Test AL, AL + JZ ViewNote5 + + Push AX + + Mov AH, CH + Mov AL, 20h + StosW + + Pop AX + + Call Draw_2Instrument + Jmp ViewNoteEnd + +ViewNote5: ; Volume + LodsB + Cmp AL, 0FFh + JE ViewNote6 + + Push AX + Mov AH, CH + Sub AH, 4 + Mov AL, 20h + StosW + Pop AX + + Mov AH, AL + And AH, 7Fh + Sub AH, 65 + JC ViewNoteNoVEffect + + Test AL, 80h + JZ ViewNoteVEffect1 + + Add AH, 60 + +ViewNoteVEffect1: + Mov AL, AH + Xor AH, AH + Div DH + ; AL = effect, AH = num + Add AX, 'A'+'0'*256 + Mov CL, AH + Mov AH, CH + StosW + Mov AL, CL + StosW + + Jmp ViewNoteEnd + +ViewNoteNoVEffect: + Mov CL, CH + Sub CL, 4 + + Test AL, 80h + JZ ViewNote25 + + Dec CX + And AL, 7Fh + +ViewNote25: + Xor AH, AH + Div DH + Add AX, 3030h + XChg CL, AH + StosW + Mov AL, CL + StosW + + Jmp ViewNoteEnd + +ViewNote6: + LodsW + And AX, AX + JZ ViewNote11 + + Mov CL, AH + And AL, AL + JZ ViewNote7 + + Add AL, '@' + Jmp ViewNote8 + +ViewNote7: + Mov AL, '.' + +ViewNote8: + Mov AH, CH + Sub AH, 4 + StosW + + Mov AL, CL + AAM 16 ; AH = High nibble, AL = low nibble + Mov CL, AL + Mov AL, AH + Mov AH, CH + Sub AH, 4 + Call PE_ConvHexAL + + Mov AL, CL + Call PE_ConvHexAL + + Jmp ViewNoteEnd + +ViewNote11: ; Nothing to show except dots... + Mov AH, CH + Mov AL, 173 + StosW + StosW + StosW + +ViewNoteEnd: + + Pop DI + Add DI, 160 + Pop SI + Add SI, 320 + Pop CX + Inc CX + Dec CH + JNZ ViewNote1 + + Cmp BP, CS:Channel + JE ViewNote12 + + Mov DX, BP + Mov BP, Offset CursorPositions+27 + Jmp PE_HilightView + + Ret + +ViewNote12: + Push DI + + Sub SI, (320*32) + Sub DI, (32*160) + Mov AL, 160 + Mov DX, CS:Row + Sub DX, CS:TopRow + + Mul DL + Add DI, AX + Add AX, AX + Add SI, AX + + Mov CX, CS:Row + Call PE_SelectColour ; CH = colour. + + Mov DX, CS:PatternCursor + +ViewNote13: + LodsB + Cmp DL, 1 + JA ViewNote16 + + Cmp AL, NONOTE + JNE ViewNote15 + + Mov AH, CH + Mov AL, 173 + StosW + StosW + StosW + +ViewNote15: + Jmp ViewNoteEndHilight + +ViewNote16: + LodsB + Cmp DL, 3 + JA ViewNote19 + + Mov DH, AL + + Mov AH, CH + Mov AL, 20h + StosW + And DH, DH + JZ ViewNote17 + + MovZX AX, DH + Mov DH, 10 + Div DH + + Add AX, 3030h + Mov DH, AH + Mov AH, CH + StosW + Mov AL, DH + StosW + Jmp ViewNoteEndHilight + +ViewNote17: + Mov AL, 173 + StosW + StosW + Jmp ViewNoteEndHilight + +ViewNote19: + LodsB + Cmp DL, 5 + JA ViewNote22 + + Mov DH, AL + + Mov AH, CH + Sub AH, 4 + Mov AL, 20h + StosW + + Cmp DH, 0FFh + JE ViewNote20 + + Mov AH, DH + And AH, 7Fh + Sub AH, 65 + JC ViewNoteNoVEffect2 + + Test DH, 80h + JZ ViewNoteVEffect2 + + Add AH, 60 + +ViewNoteVEffect2: + Mov AL, AH + Xor AH, AH + Mov DH, 10 + Div DH + ; AL = effect, AH = num + Add AX, 'A'+'0'*256 + Mov CL, AH + Mov AH, CH + StosW + Mov AL, CL + StosW + + Jmp ViewNoteEndHilight + +ViewNoteNoVEffect2: + Sub CH, 4 + + Test DH, 80h + JZ ViewNote26 + + Dec CH + And DH, 7Fh + +ViewNote26: + MovZX AX, DH + Mov DH, 10 + Div DH + + Add AX, 3030h + XChg CH, AH + StosW + Mov AL, CH + StosW + Jmp ViewNoteEndHilight + +ViewNote20: + Mov AL, 173 + StosW + StosW + Jmp ViewNoteEndHilight + +ViewNote22: + LodsB + Mov AH, CH + Sub AH, 4 + And AL, AL + JNZ ViewNote23 + + Mov AL, '.' + Jmp ViewNote24 + +ViewNote23: + Add AL, '@' + +ViewNote24: + Mov AH, CH + Sub AH, 4 + StosW + + LodsB + AAM 16 ; AH = High nibble, AL = low nibble + Mov CL, AL + Mov AL, AH + Mov AH, CH + Sub AH, 4 + Call PE_ConvHexAL + + Mov AL, CL + Call PE_ConvHexAL + +ViewNoteEndHilight: + Pop DI + + Mov DX, BP + Mov BP, Offset CursorPositions+27 + Jmp PE_HilightView + + +EndP ViewNote + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ViewTiny ; DS:SI = pattern data + ; ES:DI = screen pointer + ; CS:BX = note data + ; CX = row number + ; DL = channel number. + + Push SI + Push BX + + Mov SI, Offset ChannelMsg5 + Mov BX, 0 + Call ViewCommon + + Pop BX + Pop SI + +ViewTiny1: + Push CX + Push SI + Push DI + + Call PE_SelectColour + + LodsB + Cmp AL, NONOTE + JE ViewTiny4 + + Call Draw_2Note + Jmp ViewTinyEnd + +ViewTiny4: + LodsB + Test AL, AL + JZ ViewTiny5 + + Call Draw_2Instrument + Jmp ViewTinyEnd + +ViewTiny5: ; Volume + LodsB + Cmp AL, 0FFh + JE ViewTiny6 + + Mov AH, AL + And AH, 7Fh + Sub AH, 65 + JC ViewTinyNoVEffect + + Test AL, 80h + JZ ViewTinyVEffect1 + + Add AH, 60 + +ViewTinyVEffect1: + Mov AL, AH + Xor AH, AH + Div DH + ; AL = effect, AH = num + Add AX, 'A'+'0'*256 + Mov CL, AH + Mov AH, CH + StosW + Mov AL, CL + StosW + + Jmp ViewTinyEnd + +ViewtinyNoVEffect: + Mov CL, CH + Sub CL, 4 + + Test AL, 80h + JZ ViewTiny27 + + Dec CX + And AL, 7Fh + +ViewTiny27: + Xor AH, AH + Div DH + Add AX, 3030h + XChg AH, CL + StosW + Mov AL, CL + StosW + + Jmp ViewTinyEnd + +ViewTiny6: + LodsW + And AX, AX + JZ ViewTiny11 + + Mov CL, AH + And AL, AL + JZ ViewTiny7 + + Add AL, '@' + Jmp ViewTiny8 + +ViewTiny7: + Mov AL, '.' + +ViewTiny8: + Mov AH, CH + Sub AH, 4 + StosW + Add AH, 8 + Mov AL, CL + StosW + + Jmp ViewTinyEnd + +ViewTiny11: ; Nothing to show except dots... + Mov AH, CH + Mov AL, 173 + StosW + StosW + +ViewTinyEnd: + + Pop DI + Pop SI + Pop CX + + Add DI, 160 + Inc CX + Add SI, 320 + + Dec CH + JNZ ViewTiny1 + + Cmp BP, CS:Channel + JE ViewTiny14 + + Mov DX, BP + Mov BP, Offset CursorPositions+36 + Jmp PE_HilightView + +ViewTiny14: + Push DI + + Sub SI, (32*320) + Sub DI, (32*160) + Mov AL, 160 + Mov CX, CS:Row + Sub CX, CS:TopRow + Mul CL + Add DI, AX + Add AX, AX + Add SI, AX + + Mov CX, CS:Row + Call PE_SelectColour ; CH = colour. + + Mov DX, CS:PatternCursor + LodsB + Cmp DL, 1 + JA ViewTiny17 + + Cmp AL, NONOTE + JE ViewTinyDots + + Jmp ViewTinyEndHilight + +ViewTiny17: + LodsB ; Instrument + Cmp DL, 3 + JA ViewTiny20 + + And AL, AL + JZ ViewTinyDots + + Mov DH, 10 + Xor AH, AH + Div DH + Add AX, 3030h + Mov DH, AH + Mov AH, CH + StosW + Mov AL, DH + StosW + Jmp ViewTinyEndHilight + +ViewTiny20: + LodsB ; Volume + Cmp DL, 5 + JA ViewTiny23 + + Cmp AL, 0FFh + JE ViewTiny21 + + Mov AH, AL + And AH, 7Fh + Sub AH, 65 + JC ViewTinyNoVEffect2 + + Test AL, 80h + JZ ViewTinyVEffect2 + + Add AH, 60 + +ViewTinyVEffect2: + Mov AL, AH + Xor AH, AH + Mov DH, 10 + Div DH + ; AL = effect, AH = num + Add AX, 'A'+'0'*256 + Mov CL, AH + Mov AH, CH + StosW + Mov AL, CL + StosW + + Jmp ViewTinyEndHilight + +ViewTinyNoVEffect2: + Sub CH, 4 + Test AL, 80h + JZ ViewTiny28 + + Dec CH + And AL, 7Fh + +ViewTiny28: + Mov DH, 10 + Xor AH, AH + Div DH + Add AX, 3030h + XChg CH, AH + StosW + Mov AL, CH + StosW + Jmp ViewTinyEndHilight + +ViewTiny21: + Sub CH, 4 + +ViewTinyDots: + Mov AH, CH + Mov AL, 173 + StosW + StosW + Jmp ViewTinyEndHilight + +ViewTiny23: + LodsB ; CommandValue. + And AL, AL + JNZ ViewTiny24 + + Mov AL, '.' + Jmp ViewTiny25 + +ViewTiny24: + Add AL, '@' + +ViewTiny25: + Mov AH, CH + Sub AH, 4 + StosW + + Add AH, 8 + LodsB + StosW + +ViewTinyEndHilight: + Pop DI + + Mov DX, BP + Mov BP, Offset CursorPositions+36 + Jmp PE_HilightView + +EndP ViewTiny + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_ToggleDivision Far + + Xor ViewDivision, 1 + + Call PE_CheckWidth + JC PEFunction_ToggleDivision1 + + Mov AX, 1 + Ret + +PEFunction_ToggleDivision1: + Xor ViewDivision, 1 + + Mov AX, 1 + Ret + +EndP PEFunction_ToggleDivision + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_Ctrl0 Far + + Mov AX, 0 + Jmp PE_FastView + +EndP PEFunction_Ctrl0 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_Ctrl1 Far + + Mov AX, 1 + Jmp PE_FastView + +EndP PEFunction_Ctrl1 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_Ctrl2 Far + + Mov AX, 2 + Jmp PE_FastView + +EndP PEFunction_Ctrl2 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_Ctrl3 Far + + Mov AX, 3 + Jmp PE_FastView + +EndP PEFunction_Ctrl3 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_Ctrl4 Far + + Mov AX, 4 + Jmp PE_FastView + +EndP PEFunction_Ctrl4 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_Ctrl5 Far + + Mov AX, 5 + Jmp PE_FastView + +EndP PEFunction_Ctrl5 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_QuickViewSetup Far ; CX = num with div + ; BX = num without div + ; AH = type. + Cmp ViewDivision, 0 + JNE PEFunction_QuickViewSetup1 + + Mov CX, BX + Mov BX, 100 + Sub BX, CX + +PEFunction_QuickViewSetup1: + Push CS + Pop ES + Mov DI, Offset ViewChannels + +PEFunction_QuickViewSetup3: + StosW + + Inc AL + Loop PEFunction_QuickViewSetup3 + + Mov CX, BX + Mov AX, 0FFFFh + Rep StosW + + Call PE_CheckWidth + + Cmp ViewChannelTracking, 0 + JNE PEFunction_QuickViewSetup2 + + Call PEFunction_ToggleTracking + +PEFunction_QuickViewSetup2: + + Mov AX, 1 + Ret + +EndP PEFunction_QuickViewSetup + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_Ctrl_Shift1 Far + + Mov AX, 100h + Mov BX, 7 + Mov CX, 6 + Jmp PEFunction_QuickViewSetup + +EndP PEFunction_Ctrl_Shift1 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_Ctrl_Shift2 Far + + Mov AX, 200h + Mov BX, 10 + Mov CX, 9 + Jmp PEFunction_QuickViewSetup + +EndP PEFunction_Ctrl_Shift2 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_Ctrl_Shift3 Far + + Mov AX, 300h + Mov BX, 24 + Mov CX, 18 + Jmp PEFunction_QuickViewSetup + +EndP PEFunction_Ctrl_Shift3 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_Ctrl_Shift4 Far + + Mov AX, 400h + Mov BX, 36 + Mov CX, 24 + Jmp PEFunction_QuickViewSetup + +EndP PEFunction_Ctrl_Shift4 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_FastView Far + + Dec AX ; AL = viewmethod + Mov CL, AL + Mov BX, Channel + Mov SI, Offset ViewChannels + + Cmp CL, 0FFh + JE PE_FastView4 + +PE_FastView1: + LodsW + Cmp AL, 0FFh + JE PE_FastView2 + + Cmp AL, BL + JE PE_FastView2 + Jmp PE_FastView1 + +PE_FastView2: + Sub SI, 2 + Push AX + Push SI + + Mov AL, BL + Mov AH, CL + Mov [SI], AX + + Call PE_CheckWidth + JC PE_FastView3 + + Add SP, 4 + Mov AX, 1 + Ret + +PE_FastView3: + Pop SI + Pop AX + Mov [SI], AX + + Mov AX, 1 + Ret + +PE_FastView4: + LodsW + Cmp AL, 0FFh + JE PE_FastView6 + + Cmp AL, BL + JNE PE_FastView4 + +PE_FastView5: + LodsW + Mov [SI-4], AX + Cmp AX, 0FFFFh + JNE PE_FastView5 + + Call PE_CheckWidth + +PE_FastView6: + Mov AX, 1 + Ret + +EndP PE_FastView + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_ViewLeft Far + ; First find current channel. + Mov DX, Channel + Mov SI, Offset ViewChannels + +PEFunction_ViewLeft1: + LodsW + Cmp AL, 0FFh + JE PEFunction_ViewLeft2 + + Cmp AL, DL + JNE PEFunction_ViewLeft1 + + Cmp SI, Offset ViewChannels+2 + JE PEFunction_ViewLeft2 + + Mov DL, [SI-4] + Mov Channel, DX + +PEFunction_ViewLeft2: ; Else decrease channel + Mov AX, 1 + Ret + +EndP PEFunction_ViewLeft + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_ViewRight Far + + Mov DX, Channel + Mov SI, Offset ViewChannels + +PEFunction_ViewRight1: + LodsW + Cmp AL, 0FFh + JE PEFunction_ViewRight2 + + Cmp AL, DL + JNE PEFunction_ViewRight1 + + LodsW + Cmp AL, 0FFh + JE PEFunction_ViewRight2 + + Xor AH, AH + Mov Channel, AX + +PEFunction_ViewRight2: + Mov AX, 1 + Ret + +EndP PEFunction_ViewRight + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_AltRight Far + + Mov AX, Channel + Inc AX + Cmp AX, 64 + JAE PEFunction_AltRight1 + + Mov Channel, AX + +PEFunction_AltRight1: + Mov AX, 1 + Ret + +EndP PEFunction_AltRight + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_AltLeft Far + + Mov AX, Channel + And AX, AX + JZ PEFunction_AltLeft1 + + Dec AX + Mov Channel, AX + +PEFunction_AltLeft1: + Mov AX, 1 + Ret + +EndP PEFunction_AltLeft + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_Ctrl_Home Far + + Mov AX, Row + Sub AL, 1 + AdC AL, 0 + Mov Row, AX + + Mov AX, 1 + Ret + +EndP PEFunction_Ctrl_Home + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_Ctrl_End Far + + Mov AX, Row + Cmp AX, MaxRow + AdC AX, 0 + Mov Row, AX + + Mov AX, 1 + Ret + +EndP PEFunction_Ctrl_End + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_AltUp Far + + Mov AX, TopRow + Mov BX, Row + Test AX, AX + JZ PEFunction_AltUp1 + + Dec AX + Mov TopRow, AX + Sub BX, AX + Cmp BX, 32 + JB PEFunction_AltUp1 + + Dec Row + +PEFunction_AltUp1: + Mov AX, 1 + Ret + +EndP PEFunction_AltUp + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_AltDown Far + + Mov AX, TopRow + Mov BX, MaxRow + + Inc AX + Sub BX, AX + Cmp BX, 31 + JB PEFunction_AltDown1 + + Mov TopRow, AX + Cmp AX, Row + JBE PEFunction_AltDown1 + + Mov Row, AX + +PEFunction_AltDown1: + Mov AX, 1 + Ret + +EndP PEFunction_AltDown + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_GetLastInstrument Far + + MovZX BX, [CS:LastInstrument] + Dec BX + Ret + +EndP PE_GetLastInstrument + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_SwapInstruments Far ; DH/DL = instruments + ; to swap. + Call Music_GetSongSegment + Mov DS, AX + Push CS + Pop DS + Assume DS:Pattern + + Mov TempVariableArea2, DX + Mov AX, PatternNumber + Mov TempVariableArea, AX + Call PEFunction_StorePattern + + Call PE_GetMaxPattern + Inc AX + Mov TempVariableArea4, AX ; 1=OldPattern + ; 2=Instrument swap + ; 3=Current pattern + ; 4=Max pattern + + ; OK... + Mov AL, 1 + Call S_SetDirectMode + + ; Draw Box first... + Call S_DrawSmallBox + + Mov TempVariableArea3, 0 + Assume DS:Nothing + +PE_SwapInstruments1: ; Draw % Complete on screen first + Mov AX, 100 + Mul TempVariableArea3 + Div TempVariableArea4 ; AX = percentage + + Push AX + + Push CS + Pop DS + Assume DS:Pattern + + Mov SI, Offset CompleteMsg + Mov DI, (34+26*80)*2 + Mov AH, 20h + Call S_DrawString + Add SP, 2 ; OK message is on screen. + + + Mov AX, TempVariableArea3 + Mov PatternNumber, AX + Assume DS:Nothing + + Call Music_GetPattern + Call DecodePattern ; Next pattern should be in mem + + Mov AX, MaxRow + Inc AX + Mov CX, 64 + Mul CX + ; AX = number of "blocks" + Mov CX, AX + Mov DX, TempVariableArea2 + + Mov DS, PatternDataArea + Mov SI, 1 + +PE_SwapInstruments3: + Mov AL, [SI] + Cmp AL, DL + JNE PE_SwapInstruments4 + + Mov AL, DH + And AL, 7Fh + Mov [SI], AL + Jmp PE_SwapInstruments5 + +PE_SwapInstruments4: + Test DH, 80h + JNZ PE_SwapInstruments5 + + Cmp AL, DH + JNE PE_SwapInstruments5 + + Mov [SI], DL + +PE_SwapInstruments5: + Add SI, 5 + Loop PE_SwapInstruments3 + + Push CS + Pop DS + + Mov AX, TempVariableArea3 + Call PEFunction_StorePattern + ; OK.. onto next pattern + + Mov AX, TempVariableArea3 + Inc AX + Cmp AX, TempVariableArea4 + JAE PE_SwapInstruments2 + + Mov TempVariableArea3, AX + Jmp PE_SwapInstruments1 + +PE_SwapInstruments2: + Mov AL, 0 + Call S_SetDirectMode + + Push CS + Pop DS + Assume DS:Pattern + + Mov AX, TempVariableArea + Mov PatternNumber, AX + Call Music_GetPattern + Call DecodePattern + + Ret + +EndP PE_SwapInstruments + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_InsertInstrument Far ; DL = instrument + + Push CS + Pop DS + Assume DS:Pattern + + Mov TempVariableArea2, DX + Mov AX, PatternNumber + Mov TempVariableArea, AX + Call PEFunction_StorePattern + + Call PE_GetMaxPattern + Inc AX + Mov TempVariableArea4, AX ; 1=OldPattern + ; 2=Instrument swap + ; 3=Current pattern + ; 4=Max pattern + + ; OK... + Mov AL, 1 + Call S_SetDirectMode + + ; Draw Box first... + Call S_DrawSmallBox + + Mov TempVariableArea3, 0 + Assume DS:Nothing + +PE_InsertInstrument1: ; Draw % Complete on screen first + Mov AX, 100 + Mul TempVariableArea3 + Div TempVariableArea4 ; AX = percentage + + Push AX + + Push CS + Pop DS + Assume DS:Pattern + + Mov SI, Offset CompleteMsg + Mov DI, (34+26*80)*2 + Mov AH, 20h + Call S_DrawString + Add SP, 2 ; OK message is on screen. + + + Mov AX, TempVariableArea3 + Mov PatternNumber, AX + Assume DS:Nothing + + Call Music_GetPattern + Call DecodePattern ; Next pattern should be in mem + + Mov AX, MaxRow + Inc AX + Mov CX, 64 + Mul CX + ; AX = number of "blocks" + Mov CX, AX + Mov DX, TempVariableArea2 + + Mov DS, PatternDataArea + Mov SI, 1 + +PE_InsertInstrument3: + Cmp [SI], DL + JB PE_InsertInstrument4 + + Cmp Byte Ptr [SI], 99 + JAE PE_InsertInstrument4 + + Inc Byte Ptr [SI] + +PE_InsertInstrument4: + Add SI, 5 + Loop PE_InsertInstrument3 + + Push CS + Pop DS + + Mov AX, TempVariableArea3 + Call PEFunction_StorePattern + ; OK.. onto next pattern + + Mov AX, TempVariableArea3 + Inc AX + Cmp AX, TempVariableArea4 + JAE PE_InsertInstrument2 + + Mov TempVariableArea3, AX + Jmp PE_InsertInstrument1 + +PE_InsertInstrument2: + Mov AL, 0 + Call S_SetDirectMode + + Push CS + Pop DS + Assume DS:Pattern + + Mov AX, TempVariableArea + Mov PatternNumber, AX + Call Music_GetPattern + Call DecodePattern + + Ret + +EndP PE_InsertInstrument + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_DeleteInstrument Far ; DL = instrument + + Push CS + Pop DS + Assume DS:Pattern + + Mov TempVariableArea2, DX + Mov AX, PatternNumber + Mov TempVariableArea, AX + Call PEFunction_StorePattern + + Call PE_GetMaxPattern + Inc AX + Mov TempVariableArea4, AX ; 1=OldPattern + ; 2=Instrument swap + ; 3=Current pattern + ; 4=Max pattern + + ; OK... + Mov AL, 1 + Call S_SetDirectMode + + ; Draw Box first... + Call S_DrawSmallBox + + Mov TempVariableArea3, 0 + Assume DS:Nothing + +PE_DeleteInstrument1: ; Draw % Complete on screen first + Mov AX, 100 + Mul TempVariableArea3 + Div TempVariableArea4 ; AX = percentage + + Push AX + + Push CS + Pop DS + Assume DS:Pattern + + Mov SI, Offset CompleteMsg + Mov DI, (34+26*80)*2 + Mov AH, 20h + Call S_DrawString + Add SP, 2 ; OK message is on screen. + + + Mov AX, TempVariableArea3 + Mov PatternNumber, AX + Assume DS:Nothing + + Call Music_GetPattern + Call DecodePattern ; Next pattern should be in mem + + Mov AX, MaxRow + Inc AX + Mov CX, 64 + Mul CX + ; AX = number of "blocks" + Mov CX, AX + Mov DX, TempVariableArea2 + + Mov DS, PatternDataArea + Mov SI, 1 + +PE_DeleteInstrument3: + Cmp [SI], DL + JB PE_DeleteInstrument4 + + Dec Byte Ptr [SI] + +PE_DeleteInstrument4: + Add SI, 5 + Loop PE_DeleteInstrument3 + + Push CS + Pop DS + + Mov AX, TempVariableArea3 + Call PEFunction_StorePattern + ; OK.. onto next pattern + + Mov AX, TempVariableArea3 + Inc AX + Cmp AX, TempVariableArea4 + JAE PE_DeleteInstrument2 + + Mov TempVariableArea3, AX + Jmp PE_DeleteInstrument1 + +PE_DeleteInstrument2: + Mov AL, 0 + Call S_SetDirectMode + + Push CS + Pop DS + Assume DS:Pattern + + Mov AX, TempVariableArea + Mov PatternNumber, AX + Call Music_GetPattern + Call DecodePattern + + Ret + +EndP PE_DeleteInstrument + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_UpdateInstruments Far ; ES:DI = instrument table + ; DL = instrument number + Push CS + Pop DS + Assume DS:Pattern + + Mov Byte Ptr TempVariableArea2, DL + Mov AX, PatternNumber + Mov TempVariableArea, AX + Mov TempVariableArea5, ES + Mov TempVariableArea6, DI + Call PEFunction_StorePattern + + Call PE_GetMaxPattern + Inc AX + Mov TempVariableArea4, AX ; 1=OldPattern + ; 2=Instrument + ; 3=Current pattern + ; 4=Max pattern + ; 5=ES + ; 6=DI + + Mov AL, 1 + Call S_SetDirectMode + + ; Draw Box first... + Call S_DrawSmallBox + + Mov TempVariableArea3, 0 + Assume DS:Nothing + +PE_UpdateInstruments1: ; Draw % Complete on screen first + Mov AX, 100 + Mul TempVariableArea3 + Div TempVariableArea4 ; AX = percentage + + Push AX + + Push CS + Pop DS + Assume DS:Pattern + + Mov SI, Offset CompleteMsg + Mov DI, (34+26*80)*2 + Mov AH, 20h + Call S_DrawString + Pop AX ; Remove AX from stack + + Mov AX, TempVariableArea3 + Mov PatternNumber, AX + Assume DS:Nothing + + Call Music_GetPattern + Call DecodePattern ; Next pattern should be in mem + + Mov AX, MaxRow + Inc AX + Mov CX, 64 + Mul CX + ; AX = number of "blocks" + Mov CX, AX + Mov BL, CS:Byte Ptr TempVariableArea2 + Mov ES, CS:TempVariableArea5 + + Mov DS, PatternDataArea + Xor SI, SI + +PE_UpdateInstruments3: + LodsW + Cmp AL, NONOTE + JAE PE_UpdateInstrument4 + + And AH, AH ; AH = instrument + JZ PE_UpdateInstrument4 + + Xor DX, DX + Mov DI, CS:TempVariableArea6 + +PE_UpdateInstrument5: + Cmp AX, [ES:DI] + JE PE_UpdateInstrument7 + +; Add DI, 2 + ScasW + Inc DX ; Not it... + Cmp DX, 120 + JB PE_UpdateInstrument5 + + Jmp PE_UpdateInstrument4 + +PE_UpdateInstrument7: + Mov DH, BL + Mov [DS:SI-2], DX + + +PE_UpdateInstrument4: + Add SI, 3 + Loop PE_UpdateInstruments3 + + Push CS + Pop DS + + Mov AX, TempVariableArea3 + Call PEFunction_StorePattern + ; OK.. onto next pattern + + Mov AX, TempVariableArea3 + Inc AX + Cmp AX, TempVariableArea4 + JAE PE_UpdateInstruments2 + + Mov TempVariableArea3, AX + Jmp PE_UpdateInstruments1 + +PE_UpdateInstruments2: + Mov AL, 0 + Call S_SetDirectMode + + Push CS + Pop DS + Assume DS:Pattern + + Mov AX, TempVariableArea + Mov PatternNumber, AX + Call Music_GetPattern + Call DecodePattern + + Ret + +EndP PE_UpdateInstruments + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_Alt_F9 Far + Assume DS:Pattern + + Mov AX, Channel + Call Music_ToggleChannel + + Mov AX, 1 + Ret + +EndP PEFunction_Alt_F9 + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_MuteNext Far + Assume DS:Pattern + + Call PEFunction_Alt_F9 + Jmp PEFunction_Tab + +EndP PEFunction_MuteNext + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_MutePrevious Far + Assume DS:Pattern + + Sub Channel, 1 + AdC Channel, 0 + Jmp PEFunction_Alt_F9 + +EndP PEFunction_MutePrevious + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_Alt_F10 Far + Assume DS:Pattern + + Mov AX, Channel + Call Music_SoloChannel + + Mov AX, 1 + Ret + +EndP PEFunction_Alt_F10 + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_SoloGotoNext Far + + Call PEFunction_Alt_F10 + Jmp PEFunction_Tab + +EndP PEFunction_SoloGotoNext + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_UnmuteAll Far + + Call Music_UnmuteAll + + Mov AX, 1 + Ret + +EndP PEFunction_UnmuteAll + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_ShowOrder Far ; DX = order. + + Call S_GetDestination + Mov CX, 32 + + Mov DI, (2+15*80)*2+1 + Mov BX, TopOrder + +PE_ShowOrder1: + Mov AL, 23h + Cmp BX, DX + JE PE_ShowOrder2 + + Mov AL, 20h + +PE_ShowOrder2: + StosB + Inc DI + StosB + Inc DI + StosB + + Add DI, 155 + Inc BX + Loop PE_ShowOrder1 + + Ret + +EndP PE_ShowOrder + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_PlayCurrentPosition Far + Assume DS:Pattern + + Call I_ClearTables + + Mov AX, PatternNumber + Mov BX, MaxRow + Inc BX + Mov CX, Row + + Call Music_PlayPattern + + Mov AX, 1 + Ret + +EndP PE_PlayCurrentPosition + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_SetPlayMark Far + Assume DS:Pattern + + Cmp PlayMarkOn, 1 ; If on.. + JNE PEFunction_SetPlayMarkNew + + Mov AX, PatternNumber + Cmp AX, PlayMarkPattern + JNE PEFunction_SetPlayMarkNew + + Mov AX, Row + Cmp AX, PlayMarkRow + JNe PEFunction_SetPlayMarkNew + + Mov PlayMarkOn, 0 + Jmp PEFunction_SetPlayMarkEnd + +PEFunction_SetPlayMarkNew: + Mov PlayMarkOn, 1 + Mov AX, PatternNumber + Mov PlayMarkPattern, AX + Mov AX, Row + Mov PlayMarkRow, AX + +PEFunction_SetPlayMarkEnd: + Mov AX, 1 + Ret + +EndP PEFunction_SetPlayMark + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_F7 Far ; If no mark is set, use + ; current pattern & row + Call I_ClearTables + + Push CS + Pop DS + Assume DS:Pattern + + Mov CX, PatternNumber + Mov BX, Row + + Cmp PlayMarkOn, 1 + JNE PE_F7_1 + + Mov CX, PlayMarkPattern + Mov BX, PlayMarkRow + +PE_F7_1: + Mov SI, Order + + Call Music_GetSongSegment + Mov ES, AX + + Cmp CL, [ES:SI+100h] + JNE PE_F7_3 + + Mov AX, SI + Jmp PE_F7_4 + +PE_F7_3: + Mov AL, CL ; AL = pattern. + Mov DI, 100h + Mov CX, 256 + + RepNE ScasB + JNE PE_F7_2 + + Mov AX, DI + Sub AX, 101h ; AX = order. + +PE_F7_4: + Call Music_PlayPartSong + + Mov AX, 1 + Ret + +PE_F7_2: + Mov CX, BX + + Mov AX, PatternNumber + Mov BX, MaxRow + Inc BX + Call Music_PlayPattern + + Mov AX, 1 + Ret + +EndP PE_F7 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_ToggleTracking Far + Assume DS:Pattern + + Mov SI, Offset NoViewChannelTrackingMsg + Xor ViewChannelTracking, 1 + JZ PEFunction_ToggleTracking1 + + Mov SI, Offset ViewChannelTrackingMsg + +PEFunction_ToggleTracking1: + Call SetInfoLine + + Mov AX, 1 + Ret + +EndP PEFunction_ToggleTracking + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_ToggleRowHilight Far + Assume DS:Pattern + + Mov SI, Offset NoRowHilightMsg + Xor CentraliseCursor, 2 + Test CentraliseCursor, 2 + JZ PEFunction_ToggleRowHilight1 + + Mov SI, Offset RowHilightMsg + +PEFunction_ToggleRowHilight1: + Call SetInfoLine + + Mov AX, 1 + Ret + +EndP PEFunction_ToggleRowHilight + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_ToggleCentralise Far + Assume DS:Pattern + + Mov SI, Offset NoCentraliseCursorMsg + Xor CentraliseCursor, 1 + Test CentraliseCursor, 1 + JZ PEFunction_ToggleCentralise1 + + Mov SI, Offset CentraliseCursorMsg + +PEFunction_ToggleCentralise1: + Call SetInfoLine + + Mov AX, 1 + Ret + +EndP PEFunction_ToggleCentralise + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_ToggleTrace Far + Assume DS:Pattern + + Mov SI, Offset NoTraceMsg + Xor TracePlayback, 1 + JZ PEFunction_ToggleTrace1 + + Mov SI, Offset TraceMsg + +PEFunction_ToggleTrace1: + Call SetInfoLine + + Mov AL, TracePlayback + Call K_SetScrollLock + + Mov AX, 1 + Ret + +EndP PEFunction_ToggleTrace + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_GetPatternConfigOffset Far + + Push CS + Pop DS + + Mov DX, Offset KeySignature + + Ret + +EndP PE_GetPatternConfigOffset + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ReleaseUndoMemory + + Test AX, AX + JZ ReleaseUndoMemoryEnd + + Push AX + And AH, 0F0h + Cmp AH, 0A0h + Pop AX + JE ReleaseUndoMemoryEMS + +ReleaseUndoMemoryConventional: + Push ES + + Mov ES, AX + Mov AH, 49h + Int 21h + + Pop ES + Ret + +ReleaseUndoMemoryEMS: + And AX, 0FFFh + Call E_ReleaseEMS + +ReleaseUndoMemoryEnd: + Ret + +EndP ReleaseUndoMemory + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_AddToUndoBuffer Far ; 1) Release oldest data. + ; 2) Shift all stuff down. + ; 3) Store newest data. + + ; Parameter: DI = buffer TYPE. + + PushA + Push DS + Push ES + + Push CS + Pop DS + Assume DS:Pattern + + Mov AX, DI + Cmp AL, 22 + JE PE_NotModified + + Mov Word Ptr [Modified], 101h + +PE_NotModified: + ; Error maintenance... sorta + Push CS + Push Offset PE_AddToUndoBufferEnd + Push AX ; Just for stack alignment + + Call GetPatternLength ; Get's pattern length in DX + + Add SP, 6 + ; For GetPatternLength's error stuff.. + + Add DX, 8 + JNC PE_AddToUndoBuffer3 + + Mov DI, Offset O1_PatternTooLongList + Mov CX, 2 + Call M_Object1List + Jmp PE_AddToUndoBufferEnd + +PE_AddToUndoBuffer3: +; ClC ; Carry already not set to get here - for + ; Non essential EMS allocation + MovZX EAX, DX + Call E_AllocateEMS + Test AX, AX + JZ PE_AddToUndoBuffer1 ; No EMS allocated? + + Call E_MapAvailableEMSMemory + + Or AH, 0A0h ; EMS tag + Push AX + Call E_GetEMSPageFrame + Push AX + Jmp PE_AddToUndoBuffer4 + +PE_AddToUndoBuffer1: + Mov BX, DX ; BX = length of pattern. + Add BX, 15 + RCR BX, 1 + ShR BX, 3 + + Mov AH, 48h + Int 21h + JC PE_AddToUndoBufferEnd + + Push AX ; Handle + Push AX ; Memory region + +PE_AddToUndoBuffer4: + Mov SI, Offset UndoBuffer+36 + Mov AX, [SI] + Call ReleaseUndoMemory + + Mov CX, 9 + +PE_AddToUndoBuffer2: + Mov EAX, [SI-4] + Mov [SI], EAX + + Sub SI, 4 + Loop PE_AddToUndoBuffer2 + + Pop ES + Pop AX + + Mov [SI], AX + Mov [SI+2], DI + + Sub DX, 8 + Xor DI, DI ; ES:DI points to data, DX = length + + Call EncodePattern + +PE_AddToUndoBufferEnd: + Pop ES + Pop DS + PopA + + Ret + +EndP PE_AddToUndoBuffer + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_ClearUndoBuffer Far + + Push EAX + Push CX + Push DS + Push SI + + Push CS + Pop DS + Assume DS:Pattern + + Mov CX, 10 + Mov SI, Offset UndoBuffer + +PE_ClearUndoBuffer1: + Mov AX, [SI] + Call ReleaseUndoMemory + + Xor EAX, EAX + Mov [SI], EAX + + Add SI, 4 + + Loop PE_ClearUndoBuffer1 + + Pop SI + Pop DS + Pop CX + Pop EAX + + Ret + +EndP PE_ClearUndoBuffer + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_Undo Far + + Mov SelectUndo, 0 + + Mov DI, Offset O1_UndoList + Mov CX, 3 + Call M_Object1List + + Mov AX, 1 + Ret + +EndP PEFunction_Undo + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_DrawUndo Far + + Assume DS:Pattern + Push CS + Pop DS + + Call S_GetDestination + Mov CX, 10 + Mov DI, (21+24*80)*2 + Mov BX, Offset UndoBuffer+2 + +PEFunction_DrawUndo1: + Push DI + + Mov SI, [BX] + Mov AX, SI + And SI, 0FFh + Add SI, SI + + MovZX AX, AH + + Push AX + Mov SI, [UndoBufferTypes+SI] + Mov AH, 2 + Call S_DrawString + Pop AX + + Add BX, 4 + Pop DI + Add DI, 160 + Loop PEFunction_DrawUndo1 + + Ret + +EndP PEFunction_DrawUndo + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_PreUndo Far + + Push CS + Pop DS + Assume DS:Pattern + + Call S_GetDestination + Mov AX, 160 + Mul SelectUndo + Add AX, (20+24*80)*2+1 + Mov DI, AX + + Mov CX, 40 + Mov AL, 30h + +PEFunction_PreUndo1: + StosB + Inc DI + Loop PEFunction_PreUndo1 + + Ret + +EndP PEFunction_PreUndo + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEFunction_PostUndo Far + + Push CS + Pop DS + Assume DS:Pattern + + Mov BX, SelectUndo + + Cmp CX, 1C8h + JE PEFunction_PostUndoUp + + Cmp CX, 1D0h + JE PEFunction_PostUndoDown + + Cmp CX, 11Ch ; Enter + JE PEFunction_PostUndoEnter + + Xor AX, AX + Ret + +PEFunction_PostUndoUp: + Sub BL, 1 + AdC BL, 0 + Jmp PEFunction_PostUndoShift + +PEFunction_PostUndoDown: + Cmp BX, 8 + JA PEFunction_PostUndoShift + + Inc BX + +PEFunction_PostUndoShift: + Mov SelectUndo, BX + + Mov AX, 1 + Ret + +PEFunction_PostUndoEnter: + ShL BX, 2 + Add BX, Offset UndoBuffer + + Mov CX, [BX+2] + JCXZ PEFunction_PostUndoEnd + + Push Word Ptr [BX] + + Mov DI, 21 + Call PE_AddToUndoBuffer + + Pop AX + Mov CH, AH + And CH, 0F0h + Cmp CH, 0A0h + JNE PEFunction_PostUndoEnterEnd + +PEFunction_PostUndoEMS: + And AX, 0FFFh + Call E_MapAvailableEMSMemory + Call E_GetEMSPageFrame + +PEFunction_PostUndoEnterEnd: + Mov DS, AX + Assume DS:Nothing + Xor SI, SI + Call DecodePattern + + Xor BX, BX + Mov CL, 64 + Mov CH, Byte Ptr [CS:MaxRow] + Inc CH + Call NetworkPatternBlock + +PEFunction_PostUndoEnd: + Mov AX, 4 + Ret + +EndP PEFunction_PostUndo + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ToggleFastVolume Far + Assume DS:Pattern + + Mov SI, Offset NoFastVolumeMsg + Xor CentraliseCursor, 4 + Test CentraliseCursor, 4 + JZ ToggleFastVolume3 + + Push DS + + Mov DI, Offset O1_GetFastAmpList + Mov CX, 3 + Call M_Object1List + + Pop DS + + Cmp DX, 1 + JNE ToggleFastVolume2 + + Mov SI, Offset FastVolumeMsg + Jmp ToggleFastVolume3 + +ToggleFastVolume2: + And CentraliseCursor, Not 4 + Mov SI, Offset FastVolumeNotEnabledMsg + +ToggleFastVolume3: + Call SetInfoLine + + Mov AX, 1 + Ret + +EndP ToggleFastVolume + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PECheckModified Far + + Cmp CS:Modified, 0 + JE PECheckModified1 + + Mov CX, 4 + Mov DI, Offset O1_ConfirmNoSave + Call M_Object1List + + And DX, DX + JNZ PECheckModified1 + + Add SP, 4 + + Mov AX, 1 + +PECheckModified1: + Ret + +EndP PECheckModified + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PEResetModified Far + + Mov CS:Modified, 0 + + Ret + +EndP PEResetModified + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_SetPatternLength Far + Assume DS:Pattern + +; Mov AX, MaxRow +; Inc AX +; Mov PatternSetLength, AX + Mov AX, PatternNumber + Mov PatternLengthStart, AX + Mov PatternLengthEnd, AX + + Assume DS:Nothing + + Mov CX, 4 + Mov DI, Offset O1_SetPatternLength + Call M_Object1List + + Test DX, DX + JZ PE_SetPatternLength2 + + Push CS + Pop DS + Assume DS:Pattern + + Call PEFunction_StorePattern + + Mov AX, PatternNumber + Mov TempVariableArea, AX + + Mov AX, PatternLengthStart + Mov TempVariableArea2, AX + +PE_SetPatternLength3: + Mov AX, TempVariableArea2 + Cmp AX, PatternLengthEnd + JA PE_SetPatternLength4 + + Mov PatternNumber, AX + Assume DS:Nothing + + Call Music_GetPattern + Call DecodePattern ; Next pattern should be in mem + + Push CS + Pop DS + Assume DS:Pattern + + Mov AX, PatternSetLength + Mov PatternModified, 1 + Dec AX + Mov MaxRow, AX + Call PEFunction_StorePattern + + Inc TempVariableArea2 + Jmp PE_SetPatternLength3 + +PE_SetPatternLength4: ; Cleanup + Mov AX, TempVariableArea + Mov PatternNumber, AX + Call Music_GetPattern + Call DecodePattern + +PE_SetPatternLength2: + Mov AX, 1 + Ret + +EndP PE_SetPatternLength + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_LeftBrace Far + + Jmp Glbl_LeftBrace + +EndP PE_LeftBrace + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_RightBrace Far + + Jmp Glbl_RightBrace + +EndP PE_RightBrace + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_LeftSquareBracket Far + + Jmp Glbl_LeftSquareBracket + +EndP PE_LeftSquareBracket + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_RightSquareBracket Far + + Jmp Glbl_RightSquareBracket + +EndP PE_RightSquareBracket + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MIDI_SetInstrument Far + + Test Byte Ptr CS:CentraliseCursor, 16 + JZ MIDI_SetInstrument2 + + Inc DX + +MIDI_SetInstrument2: + Cmp DX, 99 + JA MIDI_SetInstrument1 + + Mov CS:LastInstrument, DL + + Test DL, DL + JZ MIDI_SetInstrument1 + + Call UpdateWAVEForm + +MIDI_SetInstrument1: + Mov AX, 1 + Ret + +EndP MIDI_SetInstrument + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_MIDIAfterTouch Far + Assume DS:Pattern + + Cmp MIDIInputEnabled, 0 + JNE PE_MIDIAfterTouch2 + + Xor AX, AX + Ret + +PE_MIDIAfterTouch2: + Test CentraliseCursor, 128 + + MovZX BX, DL + Call MIDI_GetChannel + ; Returns AX + Sub AL, 1 + JC PE_MIDIAfterTouch1 +; Cmp AL, 0FFh +; JE PE_MIDIAfterTouch1 + + Call PE_TranslateMIDI + ; DL = note, DH = volume + + Mov AH, 5 + Mul AL + Mov SI, AX + Mov BL, DH + Mov AX, 320 + Mul Row + Mov Word Ptr [Modified], 101h + Add SI, AX + Mov DS, PatternDataArea + Assume DS:Nothing + Cmp SI, 64000 + JAE PE_MIDIAfterTouch1 + + Mov [SI+2], BL + +PE_MIDIAfterTouch1: + Mov AX, 1 + Ret + +EndP PE_MIDIAfterTouch + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_MIDINoteOff Far + Assume DS:Pattern + + Cmp MIDIInputEnabled, 0 + JNE PE_MIDINoteOff1 + + Xor AX, AX + Ret + +PE_MIDINoteOff1: + MovSX BX, DL + Call MIDI_FindChannel ; Returns AX + Cmp AL, 0FFh + JE PE_MIDINoteOff2 + + Test CentraliseCursor, 32 + JZ PE_MIDINoteOff2 ; Dont' record note-offs + + Cmp TracePlayback, 0 + JE PE_MIDINoteOff2 + + Push AX + Mov AX, Row + Call Music_GetDelay ; DX = delay value + ; CX = playmode + Pop AX + + Test CX, CX + JZ PE_MIDINoteOff2 + + Push DX + Push AX + + Mov AH, 5 + Mul AH + Mov SI, AX + Mov AX, 320 + Mul Row + Add SI, AX + Cmp SI, 64000 + JAE PE_MIDINoteOff3 + + Mov DS, PatternDataArea + Assume DS:Nothing + + Cmp Word Ptr [SI], NONOTE + JE PE_MIDINoteOff4 + ; check next spot. + Mov AX, Row + Cmp AX, MaxRow + JAE PE_MIDINoteOff3 ; Already at end of pattern + + Add SI, 320 ; Try very next spot. + Cmp SI, 64000 + JAE PE_MIDINoteOff3 + + Xor DX, DX ; Tick 0 + Cmp Word Ptr [SI], NONOTE + JNE PE_MIDINoteOff3 + +PE_MIDINoteOff4: + Mov BX, 0FFh + + Mov [SI+2], BX + Mov [SI+4], BH + Test [CS:Flags], 2 + JZ PE_MIDINoteOffCut + + Dec BX + +PE_MIDINoteOffCut: + Mov [SI], BX + + Mov Word Ptr [CS:Modified], 101h + + Pop AX + Mov DL, 32 + Call Music_PlayNote + Pop DX + + Test CS:CentraliseCursor, 8 + JZ PE_MIDINoteOff2 + + Mov [SI+3], DX + +PE_MIDINoteOff2: + Mov AX, 1 + Ret + +PE_MIDINoteOff3: + Pop AX + Pop AX + Mov AX, 1 + Ret + +EndP PE_MIDINoteOff + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_MIDINote Far + Assume DS:Pattern + + Cmp MIDIInputEnabled, 0 + JNE PE_MIDINote6 + + Xor AX, AX + Ret + +PE_MIDINote6: + Push DX + Call Music_GetLastChannel + Mov DI, AX + Pop DX + + Call PE_TranslateMIDI + JC PE_MIDINote1 ; Note out of range? + JZ PE_MIDINoteOff1 ; Note off? + + Mov BL, DH + Test CentraliseCursor, 64 + JNZ PE_MIDINote3 + + Mov BL, LastVolume + Test EditMask, 2 + JNZ PE_MIDINote3 + + Mov BL, 0FFh + +PE_MIDINote3: + ; If TracePlayback = 1 *AND* Playmode > 1, then + ; Basechannel = MIDIChannel, else + ; Basechannel = Channel + Push DX + + Mov AX, Row + Call Music_GetDelay ; CX = playmode + ; DX = delay value + PushA + + Cmp MIDIPlayTrigger, 1 + JB PE_MIDINoteTriggerEnd + JA MIDIPlayTriggerSong + +MIDIPlayTriggerPattern: + Mov Row, 0 + + Call Glbl_F6 + Jmp PE_MIDINoteTriggerCleanup + +MIDIPlayTriggerSong: + + Call PE_F7 + +PE_MIDINoteTriggerCleanup: + Push CS + Pop DS + + Mov AX, Channel + Mov MIDIChannel, AX + + Mov TracePlayback, 1 + Mov MIDIPlayTrigger, 0 + +PE_MIDINoteTriggerEnd: + PopA + + Mov AX, Channel + Test CX, CX + JZ PE_MIDINote2 + + Cmp TracePlayback, 0 + JE PE_MIDINote2 + + Mov AX, MIDIChannel + +PE_MIDINote2: + Pop CX ; CX = note/volume + Xor CH, CH + Test EditMask, 1 + JZ PE_MIDINote4 + + Mov CH, LastInstrument + +PE_MIDINote4: + + XChg CX, DX + ; CX = delay + ; DX = note/ins + + Push DX + Call PE_RestoreMIDINote + Call MIDI_AllocateChannel ; Returns AX = channel to use + Pop DX + + XChg CX, DX + + Push DX + Push AX + + Inc AX + Cmp AX, 63 + JA PE_MIDINote5 + + Mov MIDIChannel, AX +PE_MIDINote5: + Dec AX + + Mov AH, 5 + Mul AH + Mov SI, AX + Mov AX, 320 + Mul Row + Add SI, AX + + Pop AX + Cmp SI, 64000 + JAE PE_MIDINote1 + + Mov DS, PatternDataArea + Assume DS:Nothing + + Mov [SI], CX + Mov [SI+2], BL + Mov Word Ptr [SI+3], 0 + + Mov DH, 32 + Call Music_PlayNote + Pop DX + + Mov Word Ptr [CS:Modified], 101h + + Test CS:CentraliseCursor, 8 + JZ PE_MIDINote1 + + Mov [SI+3], DX + +PE_MIDINote1: + Mov AX, 1 + Ret + +EndP PE_MIDINote + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_TranslateMIDI Far + ; Given DL = 0->127, return DL = 0->127 + ; Given DH = 0->127, return DH=0->64 + + ; Apply note swing. Return carry + ; if note out of range. + + ; Apply volume swing. Return zero + ; flag set if note off. + Push AX + + Test DH, DH + JZ PE_TranslateMIDIVolumeEnd + + MovSX BX, DL + MovSX AX, CS:MIDICentralNote + Add AX, BX + Sub AX, 60 + JS PE_TranslateMIDIError1 + +PE_TranslateMIDIPitch1: + Cmp AX, 119 + JBE PE_TranslateMIDIPitch2 + +PE_TranslateMIDIError1: + StC + Pop AX + Ret + +PE_TranslateMIDIPitch2: + Mov DL, AL + ; OK.. pitch done. + Mov AL, DH + Mul CS:MIDIAmplification + ; AX = (Volume*VolumeAmp) + ; = 0->127*200 + ; = 0->25400 + ; Req AX = 0->128 + ; ie. Div AX 198.4 + ; or Mul AX, 331 + ; >> 16 + + Mov BL, DL ; Note + Mov DX, 331 + Mul DX + Mov DH, DL + Mov DL, BL + Cmp DH, 64 + JB PS_TranslateMIDIVolume1 + + Mov DH, 64 + +PS_TranslateMIDIVolume1: + Test DL, DL ; Clear zero flag + carry. + +PE_TranslateMIDIVolumeEnd: + Pop AX + Ret + +EndP PE_TranslateMIDI + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_RestoreMIDINote Far + + Add DL, 60 + Sub DL, CS:MIDICentralNote + + Ret + +EndP PE_RestoreMIDINote + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_CycleMIDIPlayTrigger Far + Assume DS:Pattern + + Mov AL, MIDIPlayTrigger + Inc AX + Cmp AL, 2 + JBE PE_CycleMIDIPlayTrigger1 + + Xor AL, AL + Mov SI, Offset TriggerMsg1 + Jmp PE_CycleMIDIPlayTriggerEnd + +PE_CycleMIDIPlayTrigger1: + Mov SI, Offset TriggerMsg2 + Cmp AL, 1 + JE PE_CycleMIDIPlayTriggerEnd + + Mov SI, Offset TriggerMsg3 + +PE_CycleMIDIPlayTriggerEnd: + Mov MIDIPlayTrigger, AL + + Call SetInfoLine + + Mov AX, 1 + Ret + +EndP PE_CycleMIDIPlayTrigger + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc MIDIInputToggle Far ; Ctrl-Scroll Lock + Assume DS:Pattern + + Mov SI, Offset MIDIInputEnabledMsg + Xor MIDIInputEnabled, 1 + JNZ MIDIInputToggle1 + Mov SI, Offset MIDIInputDisabledMsg + +MIDIInputToggle1: + Call SetInfoLine + + Mov AX, 1 + Ret + +EndP MIDIInputToggle + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_SetPatternModified Far + + Mov Word Ptr [CS:Modified], 101h + Ret + +EndP PE_SetPatternModified + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_SaveCurrentPattern Far + + PushAD + Push DS + Push ES + + Call PEFunction_StoreCurrentPattern + + Mov AX, 0FFFFh + XChg AX, CS:PatternNumber + Mov Word Ptr CS:TempNumbers, AX + + Call Music_UpdatePatternOffset + + Pop ES + Pop DS + PopAD + Ret + +EndP PE_SaveCurrentPattern + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_RestoreCurrentPattern Far + + PushAD + Push DS + Push ES + Mov AX, Word Ptr CS:TempNumbers + Mov CS:PatternNumber, AX + Call Music_GetPattern + Call DecodePattern + Pop ES + Pop DS + PopAD + Ret + +EndP PE_RestoreCurrentPattern + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_NewPattern Far + + Mov AX, CS:PatternNumber + Call Music_GetPattern + Call DecodePattern + + Mov CS:PatternModified, 0 + Ret + +EndP PE_NewPattern + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +EndS + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +Segment PatternData PARA Public 'Data' + DB 64000 Dup (?) +EndS + + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +End diff --git a/IT_PE_V.INC b/IT_PE_V.INC new file mode 100644 index 0000000..b021381 --- /dev/null +++ b/IT_PE_V.INC @@ -0,0 +1,140 @@ +; +; Pattern edit view functions +; + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Draw_3Note Near ; Given AL = note. + + Cmp AL, NONOTE + JB Draw_3Note2 + + Mov CL, AL + Mov AL, 173 ; '.' + JE Draw_3Note1 + + Mov AL, '^' + Cmp CL, 0FEh + JE Draw_3Note1 + + Mov AL, 'Í' + Cmp CL, 0FFh + JE Draw_3Note1 + + Mov AL, '!' + +Draw_3Note1: + Mov AH, CH + StosW + StosW + StosW + + Ret + +Draw_3Note2: + Push SI + + AAM 12 ; AH = octave, AL = note + Mov CL, AH + And AX, 0FFh + LEA SI, [EBX+EAX*2] + + Mov AH, CH + SegCS LodsB + StosW + SegCS LodsB + StosW + Mov AL, CL + Add AL, 30h + StosW + + Pop SI + + Ret + +EndP Draw_3Note + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Draw_2Note Near ; Given AL = note. + + Cmp AL, NONOTE + JB Draw_2Note2 + + Mov DL, AL + Mov AL, 173 ; '.' + JE Draw_2Note1 + + Mov AL, '^' + Cmp DL, 0FEh + JE Draw_2Note1 + + Mov AL, 'Í' + Cmp DL, 0FFh + JE Draw_2Note1 + + Mov AL, '!' + +Draw_2Note1: + Mov AH, CH + StosW + StosW + + Ret + +Draw_2Note2: + Push SI + + AAM 12 ; AH = octave, AL = note + Mov CL, AH + And AX, 0FFh + LEA SI, [EBX+EAX*2] + + SegCS LodsW + Cmp AH, '-' + JNE Draw_2Note3 + + Add AL, 'a'-'A' + +Draw_2Note3: + Mov AH, CH + StosW + Mov AL, CL + Add AL, 30h + StosW + + Pop SI + + Ret + +EndP Draw_2Note + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Draw_2Instrument + + Test AL, AL + JNZ Draw_2Instrument1 + + Mov AL, 173 ; '.' + Mov AH, CH + + StosW + StosW + Ret + +Draw_2Instrument1: + AAM 10 + Add AX, '00' + + Mov CL, AL + Mov AL, AH + Mov AH, CH + StosW + Mov AL, CL + StosW + + Ret + +EndP Draw_2Instrument + diff --git a/IT_S.ASM b/IT_S.ASM new file mode 100644 index 0000000..a0b9de7 --- /dev/null +++ b/IT_S.ASM @@ -0,0 +1,1685 @@ +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Screen Module ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +include switch.inc + + Jumps + .386 + +Segment Mouse BYTE Public 'Code' + Extrn MouseCharacterGenerationOffset:Word +EndS + + Extrn E_UnInitEMS:Far + Extrn DrawMouse:Far, RestoreMouse:Far, ForceMouseRestore:Far + Extrn RestoreMouseGraphics:Far, NewCharacterSet:Far + Extrn MouseSecondSetEnable:Far, MouseSecondSetDisable:Far + Extrn MouseUpdateEnable:Far, MouseUpdateDisable:Far + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Globals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Global S_InitScreen:Far + Global S_SetPalette:Far + Global S_UnInitScreen:Far + Global S_DrawBox:Far + Global S_UpdateScreen:Far + Global S_OverrideVGADetection:Far + Global S_SetDirectMode:Far + Global S_DrawString:Far + Global S_DirectDrawString:Far + Global S_HiLight:Far + Global S_ClearScreen:Far + Global S_GetDestination:Far + Global S_GetGenerationTableOffset:Far + Global S_GenerateCharacters:Far + Global S_SaveScreen:Far + Global S_RestoreScreen:Far + Global S_DefineSmallNumbers:Far + Global S_DefineHiASCII:Far + Global S_DrawSmallBox:Far + Global S_GetPaletteOffset:Far + Global S_SetPalette2:Far + Global S_UsePresetPalette:Far + Global S_InvertCursor:Far + + Global S_SetSequencer:Far, S_ResetSequencer:Far + + Global CharacterGenerationOffset:Word + + Public PaletteDefs + Public S_RedefineCharacters + Public VGAFlags + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +Segment Screen BYTE Public 'Code' USE16 + Assume CS:Screen, DS:Screen + +CREATENEWLOGFILE EQU 0 +include debug.inc + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Variables ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +STORESCREENADDRESS EQU 0BA00h + +NoVGAMsg DB "Sorry, this program requires VGA", 13, 10 + DB "$" + +ScreenDataArea DW ScreenData + +PaletteDefs Label Byte + ; Default to camouflage + DB 0, 0, 0, 31, 22, 17, 45, 37, 30, 58, 58, 50 + DB 44, 0, 21, 63, 63, 21, 17, 38, 18, 19, 3, 6 + DB 8, 21, 0, 6, 29, 11, 14, 39, 29, 55, 58, 56 + DB 40, 40, 40, 35, 5, 21, 22, 16, 15, 13, 12, 11 + +PresetPalettes Label Byte + ; Light Blue palette + DB 0, 0, 0, 10, 25, 45, 30, 40, 55, 51, 58, 63 + DB 63, 21, 21, 21, 63, 21, 44, 44, 44, 22, 22, 22 + DB 0, 0, 32, 0, 0, 42, 30, 40, 55, 51, 58, 63 + DB 44, 44, 44, 21, 63, 21, 18, 16, 15, 12, 11, 10 ; Greyish brown + + ; Gold + DB 0, 0, 0, 20, 17, 10, 41, 36, 21, 63, 55, 33 + DB 63, 21, 21, 18, 53, 18, 38, 37, 36, 22, 22, 22 + DB 0, 0, 32, 0, 0, 42, 41, 36, 21, 48, 49, 46 + DB 44, 44, 44, 21, 50, 21, 18, 16, 15, 12, 11, 10 + + ; Camouflage / Jari Karppinen + DB 0, 0, 0, 31, 22, 17, 45, 37, 30, 58, 58, 50 + DB 44, 0, 21, 63, 63, 21, 17, 38, 18, 19, 3, 6 + DB 8, 21, 0, 6, 29, 11, 14, 39, 29, 55, 58, 56 + DB 40, 40, 40, 35, 5, 21, 22, 16, 15, 13, 12, 11 + + ; Midnight Tracking palette + DB 0, 0, 0, 0, 8, 16, 0, 19, 32, 16, 28, 48 + DB 63, 21, 21, 0, 48, 36, 32, 32, 32, 22, 22, 22 + DB 0, 0, 24, 0, 0, 32, 0, 18, 32, 40, 40, 40 + DB 32, 32, 32, 28, 0, 24, 4, 13, 20, 6, 7, 11 + + Comment ~ + ; Cool Hot Colours - Zoner / EPI / XLM + DB 11, 0, 18, 0, 0, 22, 42, 35, 33, 53, 45, 41 + DB 51, 0, 0, 34, 22, 35, 34, 33, 52, 22, 22, 22 + DB 26, 26, 32, 32, 32, 42, 41, 36, 21, 48, 49, 46 + DB 44, 44, 44, 21, 40, 21, 27, 16, 24, 21, 11, 19 + ~ + + ; Pine colours - Jari Karppinen + DB 0, 0, 0, 2, 16, 13, 21, 32, 29, 51, 58, 63 + DB 63, 34, 0, 52, 51, 33, 42, 41, 33, 31, 22, 22 + DB 12, 10, 16, 18, 0, 24, 30, 40, 55, 58, 58, 33 + DB 44, 44, 44, 49, 39, 21, 13, 15, 14, 14, 11, 14 + + ; Soundtracker - Chris Jarvis + DB 0, 0, 0, 18, 24, 28, 35, 42, 47, 51, 56, 60 + DB 63, 21, 21, 21, 63, 22, 0, 35, 63, 22, 22, 22 + DB 32, 13, 38, 37, 16, 62, 27, 40, 55, 51, 58, 63 + DB 44, 44, 44, 21, 63, 21, 18, 16, 17, 13, 14, 13 + + ; Volcanic + DB 0, 0, 0, 25, 9, 0, 40, 14, 0, 51, 23, 0 + DB 63, 8, 16, 0, 39, 5, 32, 32, 32, 0, 20, 20 + DB 21, 0, 0, 28, 0, 0, 32, 32, 32, 62, 31, 0 + DB 40, 40, 40, 0, 28, 38, 10, 16, 27, 8, 11, 19 + + Comment ~ + ; Atlantic - Delta X / NOiSE + DB 0, 0, 0, 2, 0, 30, 8, 18, 43, 21, 43, 63 + DB 63, 8, 16, 27, 32, 63, 0, 54, 63, 10, 15, 35 + DB 0, 0, 30, 0, 0, 36, 0, 18, 32, 40, 40, 40 + DB 18, 52, 63, 21, 50, 21, 10, 16, 27, 8, 11, 19 + ~ + ; Original Palette +; DB 0, 0, 0, 10, 25, 45, 30, 40, 55, 51, 58, 63 +; DB 63, 21, 21, 21, 63, 21, 44, 44, 44, 22, 22, 22 +; DB 0, 0, 32, 0, 0, 42, 30, 40, 55, 51, 58, 63 +; DB 44, 44, 44, 21, 63, 21, 18, 16, 15, 12, 11, 10 ; Greyish brown + +CharacterDefinitions Label Byte + DB 255, 128, 128, 128, 128, 128, 128, 128 ; 128 + DB 255, 0, 0, 0, 0, 0, 0, 0 ; 129 + DB 255, 1, 1, 1, 1, 1, 1, 1 ; 130 + DB 128, 128, 128, 128, 128, 128, 128, 128 ; 131 + DB 1, 1, 1, 1, 1, 1, 1, 1 ; 132 + DB 128, 128, 128, 128, 128, 128, 128, 255 ; 133 + DB 0, 0, 0, 0, 0, 0, 0, 255 ; 134 + DB 1, 1, 1, 1, 1, 1, 1, 255 ; 135 + DB 128, 0, 0, 0, 0, 0, 0, 0 ; 136 + DB 1, 0, 0, 0, 0, 0, 0, 0 ; 137 + DB 0, 0, 0, 0, 0, 0, 0, 128 ; 138 + DB 0, 0, 0, 0, 0, 0, 0, 1 ; 139 + DB 128, 192, 224, 240, 248, 252, 254,255 ; 140 + DB 255, 127, 63, 31, 15, 7, 3, 1 ; 141 + DB 255, 255, 192, 192, 192, 192, 192, 192 ; 142 + DB 255, 255, 0, 0, 0, 0, 0, 0 ; 143 + DB 255, 255, 3, 3, 3, 3, 3, 3 ; 144 + DB 192, 192, 192, 192, 192, 192, 192, 192 ; 145 + DB 3, 3, 3, 3, 3, 3, 3, 3 ; 146 + DB 192, 192, 192, 192, 192, 192, 255, 255 ; 147 + DB 0, 0, 0, 0, 0, 0, 255, 255 ; 148 + DB 3, 3, 3, 3, 3, 3, 255, 255 ; 149 + DB 192, 192, 0, 0, 0, 0, 0, 0 ; 150 + DB 3, 3, 0, 0, 0, 0, 0, 0 ; 151 + DB 0, 0, 0, 0, 0, 0, 192, 192 ; 152 + DB 0, 0, 0, 0, 0, 0, 3, 3 ; 153 + DB 0, 0, 0, 85, 0, 0, 0, 0 ; 154 +; DB 251, 155, 138, 138, 138, 138, 155, 251 ; 155 +; DB 239, 40, 41, 41, 41, 41, 40, 239 ; 156 +; DB 255, 0, 157, 85, 85, 157, 0, 255 ; 157 +; DB 255, 0, 29, 29, 20, 220, 0, 255 ; 158 +; DB 255, 0, 65, 67, 129, 131, 0, 255 ; 159 +; DB 255, 0, 171, 42, 171, 58, 0, 255 ; 160 +; DB 255, 0, 51, 170, 50, 171, 0, 255 ; 161 +; DB 255, 0, 170, 171, 171, 170, 0, 255 ; 162 +; DB 255, 1, 177, 169, 169, 177, 1, 255 ; 163 + + DB 0, 252, 252, 252, 252, 252, 252, 0 ; 155 + DB 0, 126, 126, 126, 126, 126, 126, 0 ; 156 + DB 0, 63, 63, 63, 63, 63, 63, 0 ; 157 + DB 0, 31, 31, 31, 31, 31, 31, 0 ; 158 + DB 0, 15, 15, 15, 15, 15, 15, 0 ; 159 + DB 0, 7, 7, 7, 7, 7, 7, 0 ; 160 + DB 0, 3, 3, 3, 3, 3, 3, 0 ; 161 + DB 0, 1, 1, 1, 1, 1, 1, 0 ; 162 + DB 0, 128, 128, 128, 128, 128, 128, 0 ; 163 + DB 0, 192, 192, 192, 192, 192, 192, 0 ; 164 + DB 0, 224, 224, 224, 224, 224, 224, 0 ; 165 + DB 0, 240, 240, 240, 240, 240, 240, 0 ; 166 + DB 0, 248, 248, 248, 248, 248, 248, 0 ; 167 + DB 126, 126, 126, 126, 126, 126, 126, 126 ; 168 + DB 255, 255, 0, 24, 60, 126, 255, 0 ; 169 + DB 255, 255, 0, 0, 0, 0, 24, 24 ; 170 + DB 255, 255, 0, 24, 60, 126, 255, 24 ; 171 + DB 255, 255, 0, 66, 102, 90, 66, 66 ; 172 + DB 0, 0, 0, 24, 24, 0, 0, 0 ; 173 + DB 0, 192, 192, 192, 192, 192, 192, 192 ; 174 + DB 0, 216, 216, 216, 216, 216, 216, 216 ; 175 + DB 0, 219, 219, 219, 219, 219, 219, 219 ; 176 + DB 0, 96, 96, 96, 96, 96, 96, 96 ; 177 + DB 0, 108, 108, 108, 108, 108, 108, 108 ; 178 + DB 0, 109, 109, 109, 109, 109, 109, 109 ; 179 + DB 0, 128, 128, 128, 128, 128, 128, 128 ; 180 + DB 0, 176, 176, 176, 176, 176, 176, 176 ; 181 + DB 0, 182, 182, 182, 182, 182, 182, 182 ; 182 + DB 0, 0, 24, 60, 60, 24, 0, 0 ; 183 + DB 0, 0, 0, 66h, 0, 0, 0, 0 ; 184 + DB 0, 1Eh, 21h, 40h, 0, 0, 0, 0 ; 185Sine + DB 0, 0, 0, 82h, 44h, 38h, 0, 0 ; 186 + DB 0, 3Eh, 22h, 22h, 22h, 22h, 63h, 0 ; 187Square + DB 0, 3Eh, 22h, 22h, 22h, 22h, 0E3h, 0 ; 188 + DB 0, 30h, 2Ch, 23h, 20h, 20h, 20h, 0 ; 189RampDown + DB 0, 4, 4, 4, 0C4h, 34h, 0Ch, 0 ; 190 + DB 0, 6, 4, 4, 4, 4, 6, 0 ; 191, Left bracket + DB 0, 0C0h, 40h, 40h, 40h, 40h, 0C0h, 0 ; 192, Right bracket + DB 0, 0, 0, 18h, 18h, 0, 0, 0 ; 193, Notedots + DB 0, 0, 18h, 3Ch, 3Ch, 18h, 0, 0 ; 194 + DB 0, 0, 18h, 3Ch, 3Ch, 18h, 0, 0 ; 195 + DB 0, 0, 3Ch, 3Ch, 3Ch, 3Ch, 0, 0 ; 196 + DB 0, 0, 3Ch, 3Ch, 3Ch, 3Ch, 0, 0 ; 197 + DB 0, 18h, 3Ch, 7Eh, 7Eh, 3Ch, 18h, 0 ; 198 + DB 0, 18h, 3Ch, 7Eh, 7Eh, 3Ch, 18h, 0 ; 199 + DB 0, 3Ch, 7Eh, 7Eh, 7Eh, 7Eh, 3Ch, 0 ; 200 + DB 0, 3Ch, 7Eh, 7Eh, 7Eh, 7Eh, 3Ch, 0 ; 201, end note dots + + Comment & + ; Volume bars + DB 0, 0, 0, 0, 0, 0, 0, 254 + DB 0, 0, 0, 0, 0, 254, 0, 254 + DB 0, 0, 0, 254, 0, 254, 0, 254 + DB 0, 254, 0, 254, 0, 254, 0, 254 + + Comment & + +EndCharacterDefinitions Label Byte + +HexNumeralDefinitions Label Byte + DB 4, 10, 10, 10, 10, 10, 4 ; '0' + DB 0, 4, 12, 4, 4, 4, 4, 14 ; '1' + DB 0, 4, 10, 2, 4, 4, 8, 14 ; '2' + DB 0, 12, 2, 2, 4, 2, 2, 12 ; '3' + DB 0, 10, 10, 10, 14, 2, 2, 2 ; '4' + DB 0, 14, 8, 8, 12, 2, 2, 12 ; '5' + DB 0, 4, 10, 8, 12, 10, 10, 4 ; '6' + DB 0, 14, 2, 2, 2, 2, 2, 2 ; '7' + DB 0, 4, 10, 10, 4, 10, 10, 4 ; '8' + DB 0, 14, 10, 10, 14, 2, 2, 2 ; '9' + DB 0, 4, 10, 10, 14, 10, 10, 10 ; 'A' + DB 0, 12, 10, 10, 12, 10, 10, 12 ; 'B' + DB 0, 6, 8, 8, 8, 8, 8, 6 ; 'C' + DB 0, 12, 10, 10, 10, 10, 10, 12 ; 'D' + DB 0, 14, 8, 8, 12, 8, 8, 14 ; 'E' + DB 0, 14, 8, 8, 12, 8, 8, 8 ; 'F' + DB 0, 6, 8, 8, 10, 10, 10, 6 ; 'G' + DB 0, 10, 10, 10, 14, 10, 10, 10 ; 'H' + + +BoxDefinitions Label Byte + DB 128,21h,129,21h,130,21h,131,21h,32,23h,132,21h,133,21h,134,21h,135,21h + DB 128,23h,129,23h,130,23h,131,23h,32,23h,132,23h,133,23h,134,23h,135,23h + DB 142,21h,143,21h,144,21h,145,21h,32,23h,146,21h,147,21h,148,21h,149,21h + DB 142,23h,143,23h,144,23h,145,23h,32,23h,146,23h,147,23h,148,23h,149,23h + DB 128,23h,129,23h,129,23h,131,23h,32,23h, 32,23h,131,23h, 32,23h, 32,23h + DB 128,21h,129,21h,129,21h,131,21h,32,23h, 32,21h,131,21h, 32,21h, 32,21h + DB 142,23h,143,23h,143,23h,145,23h,32,23h, 32,23h,145,23h, 32,23h, 32,23h + DB 142,21h,143,21h,143,21h,145,21h,32,23h, 32,21h,145,21h, 32,21h, 32,21h + DB 139,23h,134,23h,138,21h,132,23h,32,23h,131,21h,137,21h,129,21h,136,21h + DB 139,21h,134,21h,138,23h,132,21h,32,23h,131,23h,137,23h,129,23h,136,23h + DB 153,23h,148,23h,152,21h,146,23h,32,23h,145,21h,151,21h,143,21h,150,21h + DB 153,21h,148,21h,152,23h,146,21h,32,23h,145,23h,151,23h,143,23h,150,23h ; 11 + DB 139,21h,134,21h,138,21h,132,21h,32, 3h,131,21h,137,21h,129,21h,136,21h + DB 139,23h,134,23h,138,23h,132,23h,32, 3h,131,23h,137,23h,129,23h,136,23h + DB 153,21h,148,21h,152,21h,146,21h,32, 3h,145,21h,151,21h,143,21h,150,21h + DB 153,23h,148,23h,152,23h,146,23h,32, 3h,145,23h,151,23h,143,23h,150,23h + DB 128,21h,129,21h,130,21h,131,21h,32, 3h,132,21h,133,21h,134,21h,135,21h + DB 128,23h,129,23h,130,23h,131,23h,32, 3h,132,23h,133,23h,134,23h,135,23h + DB 142,21h,143,21h,144,21h,145,21h,32, 3h,146,21h,147,21h,148,21h,149,21h + DB 142,23h,143,23h,144,23h,145,23h,32, 3h,146,23h,147,23h,148,23h,149,23h + DB 128,23h,129,23h,129,23h,131,23h,32, 3h, 32,23h,131,23h, 32,23h, 32,23h + DB 128,21h,129,21h,129,21h,131,21h,32, 3h, 32,21h,131,21h, 32,21h, 32,21h + DB 142,23h,143,23h,143,23h,145,23h,32, 3h, 32,23h,145,23h, 32,23h, 32,23h + DB 142,21h,143,21h,143,21h,145,21h,32, 3h, 32,21h,145,21h, 32,21h, 32,21h + DB 139,23h,134,23h,138,21h,132,23h,32, 3h,131,21h,137,21h,129,21h,136,21h + DB 139,21h,134,21h,138,23h,132,21h,32, 3h,131,23h,137,23h,129,23h,136,23h + DB 153,23h,148,23h,152,21h,146,23h,32, 3h,145,21h,151,21h,143,21h,150,21h + DB 153,21h,148,21h,152,21h,146,21h,32, 3h,145,23h,151,21h,143,23h,150,23h ; 27 + DB 128,23h,129,23h,141,21h,131,23h,32,23h,132,21h,140,21h,134,21h,135,21h + DB 128,21h,129,21h,141,21h,131,21h,32,23h,132,23h,140,21h,134,23h,135,23h +IF TUTORIAL + DB 128,13h,129,13h,130,13h,131,13h,32,13h,132,13h,133,13h,134,13h,135,13h +ENDIF + +CharacterGenerationOffset DW 512*32 +VGAFlags DB 0 ; Bit 0 = override VGA detection + ; Bit 1 = PreserveRetrace + ; Bit 2 = Wait for VRetrace +DirectVideo DB 0 +TestBytes DB '®CHARACTERúTEST¯' + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Functions ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +; InitScreen - Sets up buffer area for screen functions & character generation +; - Sets up 50 line mode +; - Sets up palette +; - Defines basic characters (128->163) +; - AX returns non-zero if error occurs + +Proc S_InitScreen Far + + Push DS + + Push CS + Pop DS + Assume DS:Screen + + Mov DirectVideo, 0 + + Test VGAFlags, 1 + JNZ S_InitScreen4 + + Trace " - VGA Detection" + +; Check for VGA + Mov AX, 1A00h + Int 10h + + Cmp BL, 8 + JGE S_InitScreen5 + + Mov DX, Offset NoVGAMsg + Mov AH, 9 + Int 21h + + Call E_UnInitEMS + + Mov AX, 4C01h ; Return to DOS with errorlevel + Int 21h + +S_InitScreen5: + Trace " - Matrox-error detection" + + Mov AX, 3 + Int 10h + + Mov AX, 1100h + Mov BX, 1001h + Mov CX, 1 + Xor DX, DX + Push CS + Pop ES + Mov BP, Offset TestBytes + Int 10h + + Call S_SetSequencer + + Push 0A000h + Pop ES + + Mov DI, 4000h + Mov SI, Offset TestBytes + + Mov CX, 4 + RepE CmpSD + JE S_InitScreen8 + + Mov CharacterGenerationOffset, 2000h + + Push Mouse + Pop FS + Assume FS:Mouse + + Mov FS:MouseCharacterGenerationOffset, 2000h + Assume FS:Nothing + +S_InitScreen8: + Call S_ResetSequencer + +S_InitScreen4: + Trace " - Screen Mode Setup" + + Call S_Set80x50Mode + + Trace " - Screen Palette Setup" + + Call S_SetPalette + + ; OK.. save all characters above 128 + + Trace " - Character Generation Setup" + + Call S_SetSequencer + + Mov AX, 0A000h + Mov DS, AX + Mov ES, AX + + Mov AX, 16 + Xor SI, SI + Mov DX, 256 + Mov DI, AX + +S_InitScreen6: + Mov CX, 4 + Rep MovsD + + Add SI, AX + Add DI, AX + + Dec DX + JNZ S_InitScreen6 + + Call S_ResetSequencer + + Push CS + Pop DS + + Mov SI, Offset CharacterDefinitions + Mov BX, (EndCharacterDefinitions-CharacterDefinitions+7) / 8 + Mov AX, 128 + Call S_RedefineCharacters + + Call S_UpdateScreen + + Pop DS + Ret + +EndP S_InitScreen + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc S_SaveScreen Far + + PushF + PushAD + Push DS + Push ES + + ClD + Push 0B800h + Push STORESCREENADDRESS + Pop ES + Pop DS + Xor SI, SI + Xor DI, DI + +IF USE32BITSCREENCOPY + Mov CX, 2000 + Rep MovsD +ELSE + Mov CX, 4000 + Rep MovsW +ENDIF + + Call ForceMouseRestore + + Pop ES + Pop DS + PopAD + PopF + + Ret + +EndP S_SaveScreen + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc S_RestoreScreen Far + + PushF + PushAD + Push DS + Push ES + + ClD + + Call S_GetDestination + + Push STORESCREENADDRESS + Pop DS + Xor SI, SI + Xor DI, DI +IF USE32BITSCREENCOPY + Mov CX, 2000 + Rep MovsD +ELSE + Mov CX, 4000 + Rep MovsW +ENDIF + + Call ForceMouseRestore + + Pop ES + Pop DS + PopAD + PopF + + Call S_UpdateScreen + + Ret + +EndP S_RestoreScreen + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc S_Set80x50Mode Far + + Push AX + Push DX + + Mov AX, 3 + Int 10h + + Mov AX, 1112h + Xor BX, BX + Int 10h + + Mov AH, 1 + Mov CH, 20h + Int 10h + + Mov AX, 1003h + Xor BX, BX + Int 10h + + Mov DX, 03C4h ; Character Map + Mov AX, 0403h + Out DX, AX + + Test CS:VGAFlags, 2 + JNZ S_Set80x50Mode1 + + Mov AX, 0101h + Out DX, AX + + Mov DX, 03C2h + Mov AL, 63h + Out DX, AL + + Mov DX, 03DAh + In AL, DX + + Mov DX, 03C0h + Mov AL, 13h + Out DX, AL + Xor AL, AL + Out DX, AL + Mov AL, 32h + Out DX, AL + +S_Set80x50Mode1: + Pop DX + Pop AX + + Ret + +EndP S_Set80x50Mode + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc S_SetPalette2 Far + + PushA + Push DS + + Jmp SP3 + +EndP S_SetPalette2 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc S_SetPalette Far + + PushA + Push DS + + Mov CX, 16 + +SP1: + Mov AX, 1000h + Mov BL, CL + Dec BX + Mov BH, BL +; And BH, 7 + Int 10h + + Loop SP1 + +SP3: + Mov DX, 3C8h + Xor AL, AL + Out DX, AL + + Inc DX + + Mov CX, 16*3 + + Push CS + Pop DS + + Assume DS:Screen + Mov SI, Offset PaletteDefs + +SP2: + LodsB + Out DX, AL + Loop SP2 + + Pop DS + + Assume DS:Nothing + PopA + + Ret + +EndP S_SetPalette + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +SequencerSemaphore DB 0FFh + +Proc S_SetSequencer Far + + Inc [CS:SequencerSemaphore] + JNZ S_SetSequencer1 + + Push AX + Push DX + + Mov DX, 3C4h ; Sequencer + Mov AX, 704h + Out DX, AX + + Mov AX, 402h + Out DX, AX + + Mov DX, 3CEh ; Controller + Mov AX, 204h + Out DX, AX + Mov AX, 5 + Out DX, AX + Mov AX, 406h + Out DX, AX + + Pop DX + Pop AX + +S_SetSequencer1: + Ret + +EndP S_SetSequencer + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc S_ResetSequencer Far + + Dec [CS:SequencerSemaphore] + JNS S_ResetSequencer1 + + Push AX + Push DX + + Mov DX, 3C4h ; Sequencer + Mov AX, 302h + Out DX, AX + Mov AX, 304h + Out DX, AX + + Mov DX, 3CEh ; Controller + Mov AX, 4 + Out DX, AX + Mov AX, 1005h + Out DX, AX + Mov AX, 0E06h + Out DX, AX + + Pop DX + Pop AX + +S_ResetSequencer1: + Ret + +EndP S_ResetSequencer + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc S_RedefineCharacters Far + ; DS:SI = Offset to characterdefs + ; BX = Number of characters + ; AX = First character + Push CX + Push DS + Push SI + Push ES + Push DI + + Call MouseUpdateDisable + Call NewCharacterSet + + Mov DI, 0A000h + Mov ES, DI + + Mov DI, AX + Mov CL, 5 + ShL DI, CL + + Cmp AX, 256 + JB RedefineCharacters2 + + Sub DI, 256*32 + Add DI, CS:CharacterGenerationOffset + +RedefineCharacters2: + Call S_SetSequencer + +RedefineCharacters1: + Mov CX, 8 + Rep MovsB + + Add DI, (32-8) + Dec BX + JNZ RedefineCharacters1 + + Call S_ResetSequencer + Call MouseUpdateEnable + + Pop DI + Pop ES + Pop SI + Pop DS + Pop CX + + Ret + +EndP S_RedefineCharacters + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc S_DefineSmallNumbers Far + + Push DS + Push SI + Push ES + Push DI + + Call MouseUpdateDisable + + Push CS + Pop DS + Mov DI, 0A000h + Mov ES, DI + + Call S_SetSequencer + + Xor DX, DX + Mov DI, CharacterGenerationOffset + +S_DefineSmallNumbers1: + Mov AL, DL + Mov AH, AL + And AX, 0FF0h + ShL AH, 4 + ShR AX, 1 + Mov BL, AH + Xor BH, BH + Mov SI, AX + And SI, 0FFh + Add BX, Offset HexNumeralDefinitions + Add SI, Offset HexNumeralDefinitions + + Mov CH, 8 + +S_DefineSmallNumbers2: + Mov AH, [BX] + Inc BX + LodsB + ShL AL, 4 + Or AL, AH + StosB + Dec CH + JNZ S_DefineSmallNumbers2 + + Inc DX + Add DI, 24 + Cmp DX, 256 + JB S_DefineSmallNumbers1 + + ; Have to define G0->G9,H0->H9 + Mov DH, 2 + Mov BX, Offset HexNumeralDefinitions+16*8 + Mov DI, 226*32 ; start at char 226. + +S_DefineSmallNumbers3: + Mov SI, Offset HexNumeralDefinitions + Mov DL, 10 + +S_DefineSmallNumbers4: + Push BX + + Mov CH, 8 + +S_DefineSmallNumbers5: + Mov AH, [BX] + ShL AH, 4 + Inc BX + LodsB + Or AL, AH + StosB + Dec CH + JNZ S_DefineSmallNumbers5 + + Pop BX + Add DI, 24 + + Dec DL + JNZ S_DefineSmallNumbers4 + + Add BX, 8 + + Dec DH + JNZ S_DefineSmallNumbers3 + + Call S_ResetSequencer + + Pop DI + Pop ES + Pop SI + Pop DS + + Call NewCharacterSet + Call MouseSecondSetDisable + Call MouseUpdateEnable + + Ret + +EndP S_DefineSmallNumbers + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc S_UnInitScreen Far + + Push ES + + Mov AH, 49h + Mov ES, ScreenDataArea + Int 21h + + Pop ES + + Mov AX, 3 + Int 10h + + Ret + +EndP S_UnInitScreen + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc S_GetDestination Far + + Mov ES, CS:ScreenDataArea + + Cmp CS:DirectVideo, 0 + JE S_GetDestination1 + + Push AX + Mov AX, 0B800h + Mov ES, AX + Pop AX + +S_GetDestination1: + Ret + +EndP S_GetDestination + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc S_ClearScreen Far + + Push CX + Push ES + Push DI + + Call S_GetDestination +IF USE32BITSCREENCOPY + Mov CX, 2000 + Mov EAX, 03000300h + Xor DI, DI + Rep StosD +ELSE + Mov CX, 4000 + Mov AX, 300h + Xor DI, DI + Rep StosW +ENDIF + Pop DI + Pop ES + Pop CX + + Ret + +EndP S_ClearScreen + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +; Style - Low byte: Box style number +; - High byte: Flags - Bit 0: Filled box/empty box; on = don't fill + +Proc S_DrawBox Far + ARG Style, Bottom, Right, Top, Left + + Push BP + Mov BP, SP + + PushA + Push DS + Push ES + + Push CS + Pop DS + + Call S_GetDestination + Mov DX, Style ; SI = Box Style + Mov AL, 18 + Mul DL ; AX = Box Style*18 + Mov SI, AX + Add SI, Offset BoxDefinitions + + Mov AX, 80 + Mul Top + Add AX, Left + Add AX, AX + + Mov DI, AX ; ES:DI points to top left + MovsW + + LodsW + Mov CX, Right + Sub CX, Left + Dec CX + Mov DX, CX ; DX = width + + Rep StosW + + MovsW ; OK.... top line drawn + + Mov BX, Bottom + Sub BX, Top + +DrawBox1: + Add DI, 156 + Sub DI, DX + Sub DI, DX + + Dec BX + JZ DrawBox3 + + Push SI + + MovsW + + LodsW + + Test Style, 100h + JNZ DrawBox2 + + Mov CX, DX + Rep StosW + + MovsW + Pop SI + + Jmp DrawBox1 + +DrawBox2: + Add DI, DX + Add DI, DX + + MovsW + + Pop SI + Jmp DrawBox1 + +DrawBox3: + Add SI, 6 + + MovsW + + LodsW + Mov CX, DX + Rep StosW + + MovsW + + Pop ES + Pop DS + PopA + + Pop BP + Ret + +EndP S_DrawBox + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc S_UpdateScreen Far + + Cmp CS:DirectVideo, 0 + JNE S_UpdateScreen1 + + PushAD + Push DS + Push ES + + Call MouseUpdateDisable ; * + + Mov ES, CS:ScreenDataArea + Call RestoreMouse + Call RestoreMouseGraphics + + + Test CS:VGAFlags, 4 ; Wait for vertical retrace? + JZ S_UpdateScreen2 + + Mov DX, 3DAh + +S_UpdateScreen3: + In AL, DX + Test AL, 8 + JZ S_UpdateScreen3 + +S_UpdateScreen2: + Mov ES, CS:ScreenDataArea + Call DrawMouse + + Xor SI, SI + Xor DI, DI + + Mov DS, CS:ScreenDataArea + Mov CX, 0B800h + Mov ES, CX +IF USE32BITSCREENCOPY + Mov CX, 2000 + Rep MovsD +ELSE + Mov CX, 4000 + Rep MovsW +ENDIF + + Mov ES, CS:ScreenDataArea + Call RestoreMouse + + Call MouseUpdateEnable ; * + + Pop ES + Pop DS + PopAD + +S_UpdateScreen1: + Ret + +EndP S_UpdateScreen + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc S_SetDirectMode Far + + Cmp CS:DirectVideo, AL + JE S_SetDirectMode2 + + And AL, AL + JZ S_SetDirectMode1 + + Call S_UpdateScreen + Jmp S_SetDirectMode2 + +S_SetDirectMode1: + PushAD + Push DS + Push ES + + Call MouseUpdateDisable + + Mov ES, CS:ScreenDataArea + Mov CX, 0B800h + Mov DS, CX + Xor SI, SI + Xor DI, DI +IF USE32BITSCREENCOPY + Mov CX, 2000 + Rep MovsD +ELSE + Mov CX, 4000 + Rep MovsW +ENDIF + + Call RestoreMouse + + Call MouseUpdateEnable ; * + + Pop ES + Pop DS + PopAD + +S_SetDirectMode2: + Mov CS:DirectVideo, AL + Ret + +EndP S_SetDirectMode + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc S_HiLight Far ; DI points to offset + ; AL = colour + ; CX = number of characters + Push ES + Push CX + Push DI + + Call S_GetDestination + +HiLight1: + Inc DI + StosB + Loop HiLight1 + + Pop DI + Pop CX + Pop ES + + Ret + +EndP S_HiLight + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc S_DirectDrawString Far + + Push BP + Mov BP, SP + Add BP, 6 + + Push AX + Push BX + Push CX + Push DX + Push SI + Push ES + + Mov DX, 0B800h + Mov ES, DX + Mov DX, DI + + Jmp DrawString001 + +EndP S_DirectDrawString + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc S_DrawString Far ; DS:SI points to string + ; DI points to offset + ; AH = colour + + ; 0 = End of string + ; 13 = Next line + ; 10 = Toggle character sets + ; 0FFh, x, n = repeat character n 'x' times + ; 0FEh, x = set colour to x + ; 0FDh, 'D' = show decimal number + ; 0FDh, 'X' = show hex number + ; 0FDh, 'S' = show signed number + ; 0FDh, 'L' = show long number + + + Push BP + Mov BP, SP + Add BP, 6 + + Push AX + Push BX + Push CX + Push DX + Push SI + Push ES + + Call S_GetDestination + + Mov DX, DI + +DrawString001: + LodsB + And AL, AL + JZ DrawString002 + + Cmp AL, 0FDh + JE DrawString007 + + Cmp AL, 13 + JE DrawString003 + + Cmp AL, 10 + JE DrawString004 + + Cmp AL, 0FEh + JAE DrawString005 + + StosW + Jmp DrawString001 + +DrawString002: + Pop ES + Pop SI + Pop DX + Pop CX + Pop BX + Pop AX + Pop BP + + Ret + +DrawString003: ; Next line + Add DX, 160 + Mov DI, DX + Jmp DrawString001 + +DrawString004: ; Toggle character sets + Xor AH, 8h + Jmp DrawString001 + +DrawString005: + Cmp AL, 0FEH + JE DrawString006 + + LodsB ; RepeatCharacters + Mov CL, AL + Xor CH, CH + + LodsB + Rep StosW + Jmp DrawString001 + +DrawString006: + LodsB ; New Colour + Mov AH, AL + Jmp DrawString001 + +DrawString007: + LodsB + Cmp AL, 'D' + JE DrawString008 + + Cmp AL, 'X' + JE DrawString012 + + Cmp AL, 'L' + JE DrawString015 + + Cmp AL, 'S' + JE DrawStringSigned + + Push AX + Mov AL, 0FDh + StosW + Pop AX + StosW + Jmp DrawString001 + +DrawStringSigned: + Push AX + Push BX + Push CX + Push DX + + Mov CH, AH + + Push 0FFFFh + + Mov AX, [BP] + Mov BX, 10 + + And AX, AX + JNS DrawString009 + + Neg AX + Mov CL, '-' + Mov [ES:DI], CX + ScasW +; Add DI, 2 + Jmp DrawString009 + +DrawString008: + Push AX + Push BX + Push CX + Push DX + + Mov CH, AH + + Push 0FFFFh + + Mov AX, [BP] + Mov BX, 10 + +DrawString009: + Xor DX, DX + Div BX + + Push DX + And AX, AX + JNZ DrawString009 + +DrawString010: + Pop AX + Cmp AX, 0FFFFh + JE DrawString011 + + Mov AH, CH + Add AL, '0' + StosW + Jmp DrawString010 + +DrawString011: + Add BP, 2 + + Pop DX + Pop CX + Pop BX + Pop AX + Jmp DrawString001 + +DrawString012: + Push AX + Push BX + Push DX + + Push 0FFFFh + + Mov DX, [BP] + Add BP, 2 + +DrawString013: + Mov AL, DL + And AL, 0Fh + Cmp AL, 10 + SBB AL, 69h + DAS + Push AX + + ShR DX, 4 + JNZ DrawString013 + + Pop AX + +DrawString014: + StosW + + Pop AX + Cmp AX, 0FFFFh + JNE DrawString014 + + Pop DX + Pop BX + Pop AX + Jmp DrawString001 + +DrawString015: + Push EAX + Push EBX + Push ECX + Push EDX + + Mov CH, AH + + Push 0FFFFh + + Mov EAX, [BP] + Mov EBX, 10 + +DrawString016: + Xor EDX, EDX + Div EBX + + Push DX + And EAX, EAX + JNZ DrawString016 + +DrawString017: + Pop AX + Cmp AX, 0FFFFh + JE DrawString018 + + Mov AH, CH + Add AL, '0' + StosW + Jmp DrawString017 + +DrawString018: + Add BP, 4 + + Pop EDX + Pop ECX + Pop EBX + Pop EAX + Jmp DrawString001 + + +EndP S_DrawString + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc S_GetGenerationTableOffset Far ; returns ES:DI + + Mov ES, CS:ScreenDataArea + Mov DI, 8000 + + Ret + +EndP S_GetGenerationTableOffset + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc S_GenerateCharacters Far ; AX = starting char. + ; BX = chars per row. + ; CX = number of rows. + PushAD + Push DS + Push ES + + Push AX + Push BX + Push CX + + Call MouseUpdateDisable + Call NewCharacterSet + + Pop CX + Pop BX + Pop AX + + Call MouseSecondSetEnable + + Call S_SetSequencer + + Mov DL, 32 + Mul DL ; AX = starting offset. + Mov DI, AX + Add DI, CharacterGenerationOffset + + Push 0A000h + Pop ES + + Mov DS, CS:ScreenDataArea + Mov SI, 8000 + + Mov DX, BX + +S_GenerateCharacters1: + Push CX + Push SI + +S_GenerateCharacters5: + Push DI + Push SI + Mov CX, 8 + +S_GenerateCharacters4: + Xor AH, AH + Mov BP, 8 + +S_GenerateCharacters2: + LodsB + + ShR AL, 1 + RCL AH, 1 + Dec BP + JNZ S_GenerateCharacters2 + + Mov AL, AH + StosB + + Mov AX, DX + ShL AX, 3 + Add SI, AX ; Add SI, 8*BX + Sub SI, 8 + Loop S_GenerateCharacters4 + + Pop SI + Add SI, 8 + + Pop DI + Add DI, 32 + + Dec BX + JNZ S_GenerateCharacters5 + + Pop SI + Mov BX, DX + + Mov AX, BX + Mov CL, 6 + ShL AX, CL + Add SI, AX + + Pop CX + + Loop S_GenerateCharacters1 ; Rows.. + + Call S_ResetSequencer + + Call MouseUpdateEnable + + Pop ES + Pop DS + PopAD + + Ret + +EndP S_GenerateCharacters + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc S_DrawSmallBox Far + + Mov AX, 30 + Push AX + Mov AX, 25 + Push AX + Mov AX, 49 + Push AX + Mov AX, 27 + Push AX + Mov AX, 3 + Push AX + Call S_DrawBox + Add SP, 10 + + Ret + +EndP S_DrawSmallBox + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc S_GetPaletteOffset Far + + Push CS + Pop DS + Mov DX, Offset PaletteDefs + + Ret + +EndP S_GetPaletteOffset + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc S_UsePresetPalette Far + + Mov AL, 48 + Mul Byte Ptr [DS:SI+22] + Mov SI, AX + + Mov AX, CS + Mov DS, AX + Mov ES, AX + Assume DS:Screen + + Add SI, Offset PresetPalettes + Mov DI, Offset PaletteDefs + Mov CX, 48 + Rep MovsB + + Call S_SetPalette2 + + Mov AX, 1 + Ret + +EndP S_UsePresetPalette + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc S_DefineHiASCII Far + + Call MouseUpdateDisable + + Call S_SetSequencer + + + Push DS + Push ES + + Mov AX, 0A000h + Mov DS, AX + Mov ES, AX + + Mov AX, 16 + Mov DI, CS:CharacterGenerationOffset + Mov SI, AX + + Xor DX, DX + +S_DefineHIASCII1: + Mov CX, AX + Rep MovsB + + Add SI, AX + Add DI, AX + Dec DL + JNZ S_DefineHIASCII1 + + Pop ES + Pop DS + + Call S_ResetSequencer + + Call NewCharacterSet + Call MouseSecondSetDisable + Call MouseUpdateEnable + + Ret + +EndP S_DefineHiASCII + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc S_InvertCursor Far ; AL = char, AH = mask. + + PushA + Push DS + Push ES + + Mov SI, 0A000h + Mov DS, SI + Mov ES, SI + + Mov SI, DX + And SI, 0FFh + ShL SI, 5 + Test DH, 8 + JZ S_InvertCursor2 + + Add SI, CS:CharacterGenerationOffset + +S_InvertCursor2: + ClI + Call S_SetSequencer + Mov CX, 8 + Mov DI, (246*32) + +S_InvertCursor1: + LodsB + Xor AL, AH + StosB + Loop S_InvertCursor1 + + Call S_ResetSequencer + StI + + Pop ES + Pop DS + PopA + Ret + +EndP S_InvertCursor + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +Segment ScreenData PARA Public 'Data' + DB 1542 * 16 Dup (0) +EndS + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +EndS + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +End diff --git a/IT_TIMER.INC b/IT_TIMER.INC new file mode 100644 index 0000000..2c4d844 --- /dev/null +++ b/IT_TIMER.INC @@ -0,0 +1,90 @@ + +Proc GetCurrentTime + + Push DS + Push ES + + Push CS + Pop DS + Assume DS:Disk + + Cmp TimerData, 0 + JE GetCurrentTimeEnd + + Mov ES, TimerData + Mov DI, NumTimerData + ShL DI, 3 + + Mov AH, 2Ah + Int 21h ; Get Date + Mov AX, CX ; Now to get date in yyyyyyym mmmddddd + Sub AX, 1980 + ShL AX, 9 ; Year + Or AL, DL ; Day + Xor DL, DL + ShR DX, 3 + Or AX, DX ; Month + StosW + + Mov AH, 2Ch + Int 21h ; Get time + Mov AX, CX ; Now to get time in hhhhhmmm mmmsssss + ShL AL, 2 ; AX = ...hhhhh mmmmmm.. + ShL AX, 3 ; AX = hhhhhmmm mmm..... + ShR DH, 1 ; DH = ...sssss + Or AL, DH + StosW + +GetCurrentTimeEnd: + Pop ES + Pop DS + Ret + +EndP GetCurrentTime + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc CheckTimerData + Assume DS:Disk + + Cmp TimerData, 0 + JNE CheckTimerData1 + + Mov NumTimerData, 0 + Mov AH, 48h + Mov BX, 1 + Int 21h + JC CheckTimerData1 + + Mov TimerData, AX + Call GetCurrentTime + +CheckTimerData1: + Ret + +EndP CheckTimerData + Assume DS:Nothing + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc ReleaseTimerData + + Mov AX, CS:TimerData + Test AX, AX + JZ ReleaseTimerData1 + + Mov ES, AX + Mov AH, 49h + Int 21h + Xor AX, AX + +ReleaseTimerData1: + Mov CS:TimerData, AX + Mov CS:NumTimerData, AX + + Ret + +EndP ReleaseTimerData + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ diff --git a/IT_TUTE.ASM b/IT_TUTE.ASM new file mode 100644 index 0000000..40aafb3 --- /dev/null +++ b/IT_TUTE.ASM @@ -0,0 +1,519 @@ + + Jumps + .386 + +include switch.inc + +IF TUTORIAL + + Extrn S_DrawBox:Far + Extrn S_DrawString:Far + Extrn Music_GetSongSegment:Far + Extrn Music_GetPlayMode:Far + Extrn PE_GetLastInstrument:Far ; Returns BX = LastInst-1 + +Segment Pattern BYTE Public 'Code' + Extrn PatternDataArea:Word + Extrn LastKeyBoard1:Word + Extrn LastKeyBoard2:Word +EndS + +Segment Disk Byte Public 'Code' USE16 + Extrn SamplesInModule:Byte + Extrn InSampleFileName:Byte +EndS + + Public Glbl_TutorialHandler + +Segment Glbl BYTE Public 'Code' USE16 + Assume CS:Glbl, DS:Nothing, GS:Pattern + +Extrn CurrentMode:Byte + +TutorialState DW 0 + + +; TutorialInfo structure: +; DW Offset function +; DB x, y (top left) +; DB x, y (bottom right) +; DB colour +; DB Message, 0 + +TutorialFunctionArray Label Word + DW Offset Tute_State0 + DW Offset Tute_State1 + DW Offset Tute_State2 + DW Offset Tute_State3 + DW Offset Tute_State4 + DW Offset Tute_State5 + DW Offset Tute_State6 + DW Offset Tute_State7 + DW Offset Tute_State8 + DW Offset Tute_State9 + DW Offset Tute_State10 + DW Offset Tute_State1 + DW Offset Tute_State12 + DW Offset Tute_State2 + DW Offset Tute_State14 + DW Offset Tute_State5 + DW Offset Tute_State16 + DW Offset Tute_State9 + DW Offset Tute_State18 + DW Offset Tute_State19 + DW Offset Tute_StateEnd + +MAXTUTESTATE = ($-Offset TutorialFunctionArray)/2 + + +TutorialInfoArray Label Word + DW Offset TutorialDisplayState0 + DW Offset TutorialDisplayState1 + DW Offset TutorialDisplayState2 + DW Offset TutorialDisplayState3 + DW Offset TutorialDisplayState4 + DW Offset TutorialDisplayState5 + DW Offset TutorialDisplayState6 + DW Offset TutorialDisplayState7 + DW Offset TutorialDisplayState8 + DW Offset TutorialDisplayState9 + DW Offset TutorialDisplayState10 + DW Offset TutorialDisplayState11 + DW Offset TutorialDisplayState12 + DW Offset TutorialDisplayState13 + DW Offset TutorialDisplayState14 + DW Offset TutorialDisplayState15 + DW Offset TutorialDisplayState16 + DW Offset TutorialDisplayState17 + DW Offset TutorialDisplayState18 + DW Offset TutorialDisplayState19 + DW Offset TutorialDisplayState20 + DW Offset TutorialDisplayStatexx + +TutorialDisplayState0 DB 0, 40, 79, 49 + DB 0FFh, 20, " Welcome to the Impulse Tracker Tutorial!", 13, 13 + DB "This tutorial was designed to provide you with a basic understanding of how", 13 + DB "this program works. Everything that you learn here is exactly the same as in", 13 + DB "the main program. By the end of this tutorial, you should be able to compose", 13 + DB "your own modules!", 13, 13 + DB "Good luck! (Press Enter to continue)", 0 + +TutorialDisplayState1 DB 0, 0, 79, 4 + DB "This is the load-module screen that Impulse Tracker will normally begin with.", 13 + DB "As we will start a song afresh, switch to the sample list screen by pressing", 13 + DB "F3.", 0 + +TutorialDisplayState2 DB 36, 1, 78, 13 + DB "There are two basic elements to an", 13 + DB "Impulse Tracker module: patterns and", 13 + DB "samples. Samples provide all the 'real'", 13 + DB "sound information to the program. These", 13 + DB "sounds can be instruments, voices, WAV", 13 + DB "files - anything you like! IT understands", 13 + DB "a wide variety of sound files and even", 13 + DB "allows you to take sounds directly from", 13 + DB "other modules. Since there are no samples", 13 + DB "currently loaded, press Enter to switch", 13 + DB "to the load sample screen.", 0 + +TutorialDisplayState3 DB 0, 0, 79, 5 + DB "A file called TUTE.IT was included with this tutorial. You should be able to", 13 + DB "see it highlighted in the listing below. IT will hilight any file that it", 13 + DB "recognises as a sound file. You can also navigate through your directories", 13 + DB "from this menu. Select TUTE.IT and step into it by pressing Enter.", 0 + +TutorialDisplayState4 DB 2, 28, 45, 39 + DB "Here you can see a list of all the samples", 13 + DB "that are contained within TUTE.IT. To have", 13 + DB "a listen to how they sound, press the down", 13 + DB "arrow once to hilight the first sample and", 13 + DB "press 'Q'. Try moving to the other samples", 13 + DB "and playing them. Try pressing 'W', 'E',", 13 + DB "'R'. You will notice that the samples are", 13 + DB "played at a different pitch. Once you've", 13 + DB "heard all of the samples, select the Bass", 13 + DB "Drum and press Enter.", 0 + +TutorialDisplayState5 DB 36, 14, 78, 20 + DB "OK! You have now loaded the Bass Drum", 13 + DB "into memory. This means that you can use", 13 + DB "it in your songs. Lets do that now!", 13, 13 + DB "Press F2 to go to the pattern editor.", 0 + +TutorialDisplayState6 DB 33, 16, 78, 19 + DB "The pattern editor is where you set out the", 13 + DB "notes that you want to play. Press 'Q'", 0 + +TutorialDisplayState7 DB 33, 16, 78, 35 + DB "So what does this mean?", 13, 13 + DB "C-5 01 ", 173, 173, " .00", 13, 13 + DB "C-5 means to play the note C at octave 5.", 13 + DB "01 means to use sample number 1.", 13, 13 + DB "If this doesn't make sense now, don't worry!", 13 + DB "All of this will be explained later in this", 13 + DB "tutorial.", 13, 13 + DB "For now, try to enter a Bass Drum every four", 13 + DB "rows in Channel 1 (ie. on row 4, 8, 12, ...)", 13, 13 + DB "Continue to use 'Q' to enter the notes. The", 13 + DB "arrow keys may be of assistance. If you make", 13 + DB "a mistake, use the '.' key to blank out the", 13 + DB "entry.", 0 + +TutorialDisplayState8 DB 33, 16, 78, 21 + DB "OK, that's enough!", 13, 13 + DB "Lets take a listen to what you've done.", 13 + DB "Press F6 to play what you've entered.", 0 + +TutorialDisplayState9 DB 33, 16, 78, 23 + DB "As the pattern is played to you, you will", 13 + DB "notice that a cursor on the left hand side", 13 + DB "of the screen indicates the current playback", 13 + DB "position. Press F6 to watch that again.", 13, 13 + DB "When you're ready, press F8 to stop playback", 0 + +TutorialDisplayState10 DB 33, 16, 78, 25 + DB "To finish off the task of entering the Bass", 13 + DB "Drum, move up one row to row 16 and press", 13 + DB "Alt-4. This will cause the cursor to step", 13 + DB "4 rows after every note that you enter", 13 + DB "instead of 1.", 13, 13 + DB "Hold down 'Q' until Channel 1 has a Bass", 13 + DB "Drum every 4 rows until row 60.", 0 + +TutorialDisplayState11 DB 33, 16, 78, 21 + DB "Now we'll add in a snare drum. Before we do", 13 + DB "that though, set the cursor step back to", 13 + DB "a single row at a time. Press Alt-1, then", 13 + DB "F3 to go back to the sample list.", 0 + +TutorialDisplayState12 DB 36, 14, 78, 18 + DB "To load a sample into the second sample", 13 + DB "slot, first press the down arrow a single", 13 + DB "time so that sample two is hilighted.", 0 + +TutorialDisplayState13 DB 36, 14, 72, 17 + DB "Now press Enter to call up the Load", 13 + DB "Sample screen.", 0 + +TutorialDisplayState14 DB 7, 25, 42, 28 + DB "Select the Snare Drum and load it", 13 + DB "(by pressing Enter).", 0 + +TutorialDisplayState15 DB 36, 14, 74, 17 + DB "And now return to the Pattern Editor", 13 + DB "(F2)", 0 + +TutorialDisplayState16 DB 36, 16, 78, 24 + DB "Press Ctrl-PgUp to move to the top of", 13 + DB "the pattern and enter a snare drum in", 13 + DB "every 4th row starting at line 2.", 13 + DB 13 + DB "Use C-5 again, and to make it easier, you", 13 + DB "can set the skip to 4 once you've moved", 13 + DB "to line 2.", 0 + +TutorialDisplayState17 DB 34, 16, 78, 19 + DB "Have a listen to what you've just created!", 13 + DB "(Press F6)", 0 + +TutorialDisplayState18 DB 36, 16, 78, 28 + DB "As part of this tutorial, we'll try out", 13 + DB "one of the block functions that IT", 13 + DB "offers. Our goal is to halve the speed", 13 + DB "at which this plays just by modifying", 13 + DB "the pattern data. IT has two functions", 13 + DB "that will automatically halve or double", 13 + DB "the length of a hilighted block.", 13, 13 + DB "First, hilight channel 1.", 13 + DB "Move to the top of the channel first", 13 + DB "by pressing Ctrl-PgUp, then press Alt-L", 0 + +TutorialDisplayState19 DB 36, 16, 78, 26 + DB "Alt-L is a function which will mark the", 13 + DB "entire channel that your cursor is", 13 + DB "currently on. Pressing it twice will", 13 + DB "mark the entire pattern. For now, we", 13 + DB "only need the first channel so you do", 13 + DB "not need to press it a second time.", 13 + DB 13 + DB "Now that the block is marked, press", 13 + DB "Alt-G to actually double the block size!", 0 + +TutorialDisplayState20 DB 36, 16, 78, 33 + DB "Uhhh. Ooops!! That was supposed to be", 13 + DB "Alt-F. No matter - the automatic undo", 13 + DB "in IT will be able to recover our data.", 13 + DB "(Yes, we could just double it twice and", 13 + DB "everything would be perfectly fine, but", 13 + DB "this is meant to teach you about IT,", 13 + DB "right? [smile])", 13 + DB 13 + DB "Whenever you do a block function in IT", 13 + DB "the contents of the entire pattern is", 13 + DB "saved first. IT will store up to 10 of", 13 + DB "these in memory so that you can recover", 13 + DB "from any mistakes that you make.", 13 + DB 13 + DB "Press Ctrl-Backspace to pull up the", 13 + DB "undo menu.", 0 + +TutorialDisplayStatexx DB 33, 16, 78, 21 + DB "Incomplete...", 0 + +TuteFileName DB "TUTE.IT" +BassDrumText DB "Bass Drum" +SnareDrumText DB "Snare Drum" + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Tute_State0 + + Cmp AL, 9 + Ret + +EndP Tute_State0 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Tute_State1 + + Cmp AL, 3 + Ret + +EndP Tute_State1 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Tute_State2 + + Cmp AL, 13 + Ret + +EndP Tute_State2 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Tute_State3 + + Push Disk + Pop ES + Assume ES:Disk + + Cmp ES:SamplesInModule, 1 + JNE Tute_State3a + + Mov DI, Offset InSampleFileName + Mov SI, Offset TuteFileName + Mov CX, 7 + RepE CmpsB + +Tute_State3a: + Ret + +EndP Tute_State3 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Tute_State4 + + Call Music_GetSongSegment + Mov ES, AX + Mov DI, [ES:64912] + Mov SI, Offset BassDrumText + Add DI, 14h + Mov CX, 9 + RepE CmpSB + Ret + +EndP Tute_State4 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Tute_State5 + + Cmp AL, 2 + Ret + +EndP Tute_State5 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Tute_State6 + + Cmp Word Ptr [FS:0], 13Ch + Ret + +EndP Tute_State6 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Tute_State7 + + Cmp Word Ptr [FS:320*16], 13Ch + Ret + +EndP Tute_State7 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Tute_State8 + + Call Music_GetPlayMode + Cmp AX, 1 + + Ret + +EndP Tute_State8 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Tute_State9 + + Call Music_GetPlayMode + Test AX, AX + Ret + +EndP Tute_State9 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Tute_State10 + + Cmp Word Ptr [FS:60*320], 13Ch + Ret + +EndP Tute_State10 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Tute_State12 + + Call PE_GetLastInstrument + Cmp BX, 1 + Ret + +EndP Tute_State12 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Tute_State14 + + Call Music_GetSongSegment + Mov ES, AX + Mov DI, [ES:64914] + Mov SI, Offset SnareDrumText + Add DI, 14h + Mov CX, 10 + RepE CmpSB + Ret + +EndP Tute_State14 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Tute_StateEnd + + Inc AX ; Ensure zero flag is not set. + Ret + +EndP Tute_StateEnd + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Tute_State16 + + Cmp Word Ptr [FS:62*320], 23Ch + Ret + +EndP Tute_State16 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Tute_State18 + + Cmp [Word Ptr GS:LastKeyboard1+2], 2600h + Ret + +EndP Tute_State18 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Tute_State19 + + Cmp [Word Ptr GS:LastKeyboard1+2], 2200h + Ret + +EndP Tute_State19 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc Glbl_TutorialHandler Far + + PushAD + Push DS + + Push CS + Pop DS + Assume DS:Glbl + + Push Pattern + Pop GS + + Mov FS, [GS:PatternDataArea] + Assume FS:Nothing + + Mov BX, [TutorialState] + Mov AL, CurrentMode + LEA SI, [EBX+EBX] + + Push BX + Call [TutorialFunctionArray+SI] + Pop BX + JNE Glbl_TutorialHandler1 + + Inc BX + +Glbl_TutorialHandler1: + Mov [TutorialState], BX + + Cmp BX, MAXTUTESTATE + JAE Tute_TuteFinished + + Xor AX, AX + LEA SI, [EBX+EBX] + Mov SI, [TutorialInfoArray+SI] + LodsB + Push AX + LodsB + Push AX + LodsB + Push AX + LodsB + Push AX + Mov AL, 30 + Push AX + + Call S_DrawBox + Add SP, 10 + Mov AL, 80 + Mul Byte Ptr [SI-3] ; y*80 + Add AL, Byte Ptr [SI-4] + AdC AH, 0 + LEA DI, [EAX+EAX] + Add DI, (80+1)*2 + Mov AH, 13h + Call S_DrawString + +Tute_TuteFinished: + Pop DS + PopAD + Ret + +EndP Glbl_TutorialHandler + Assume DS:Nothing, FS:Nothing + +EndS + +ENDIF + +End diff --git a/IT_VESA.ASM b/IT_VESA.ASM new file mode 100644 index 0000000..4565ddb --- /dev/null +++ b/IT_VESA.ASM @@ -0,0 +1,226 @@ +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Vesa Module ³ +;ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ +;³ Functions provided: ³ +;³ DetectVESA ³ +;³ SetVESAMode ³ +;³ ³ +;ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ +;³ DetectVESA ³ +;³ - No parameters required ³ +;³ - Detects the presence of a VESA driver ³ +;³ - Returns carry SET if no VESA driver found ³ +;³ - Returns carry CLEAR if VESA driver found ³ +;³ - All registers preserved ³ +;ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ +;³ SetVESAMode ³ +;³ - Requires AX = VESA Mode ³ +;³ - Returns carry SET if VESA Mode isn't supported ³ +;³ - Returns carry CLEAR if VESA mode change OK ³ +;³ - All registers preserved ³ +;ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ +;³ VESAGetInfo ³ +;³ - Requires AX = VESA Mode to get information on ³ +;³ - Returns carry SET if VESA Mode isn't supported ³ +;³ - Returns carry clear if information is OK ³ +;³ - Returns ES:DI to Table, all other registers preserved ³ +;³ ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Jumps + .386P + +include switch.inc + +IF SPECTRUMANALYSER + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Externals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Globals ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +Segment Vesa BYTE Public 'Code' USE16 + Assume CS:Vesa, DS:Nothing + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Variables ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +VESAInformationTable Label +VESASignature DB 4 Dup (0) +VESAVersion DW 0 +VESAOEMStringPrt DD 0 +VESACapabilities DD 0 +VESAVideoModePtr DD 0 +VESATotalMemory DW 0 + DB 256-($-VESAInformationTable) Dup(0) + +VESAModeInformationTable Label + DB 256-($-VESAModeInformationTable) Dup (0) + +ModeInformationStructure Struc + ModeAtributes DW ? + WindowAAtributes DB ? + WindowBAttributes DB ? + WindowGranularity DW ? + WindowSize DW ? + WindowASegment DW ? + WindowBSegment DW ? + WindowFunction DD ? + BytesPerScanLine DW ? + + XResolution DW ? + YResolution DW ? + XCharacterSize DB ? + YCharacterSize DB ? + NumberOfPlanes DB ? + BitsPerPixel DB ? + NumberOfBanks DB ? + MemoryModel DB ? + BankSize DB ? + NumberOfImagePages DB ? + Reserved DB ? + + RedMaskSize DB ? + RedFieldPosition DB ? + GreenMaskSize DB ? + GreenFieldPosition DB ? + BlueMaskSize DB ? + BlueFieldPosition DB ? + RSVDMaskSize DB ? + DirectColourModeInfo DB ? + +ModeInformationStructure EndS + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ Functions ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Proc VESA_Detect Far +Public VESA_Detect + + PushA + Push ES + + Mov AX, 4F00h + Push CS + Pop ES + Mov DI, Offset VESAInformationTable + Int 10h + + Cmp AX, 4Fh + JNE DetectVESA1 + Cmp [DWord Ptr ES:DI], "ASEV" ; 'VESA' identification + JNE DetectVESA1 + + DB 85h + +DetectVESA1: + StC + + Pop ES + PopA + Ret + +EndP VESA_Detect + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc VESA_SetMode Far +Public VESA_SetMode + + PushA + Push DS + Push ES + + Call VESA_GetInfo + JC VESA_SetMode3 + + Mov BX, AX + Mov AX, 4F02h ; Set Mode + Int 10h + Cmp AX, 4Fh + JE VESA_SetMode3 + + StC + +VESA_SetMode3: + Pop ES + Pop DS + PopA + + Mov CX, [VESAModeInformationTable.XResolution] + Mov DX, [VESAModeInformationTable.YResolution] + + Ret + +EndP VESA_SetMode + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc VESA_GetInfo +Public VESA_GetInfo + + Push AX + Push CX + + Mov CX, AX + + Push CS + Pop ES + Mov DI, Offset VESAModeInformationTable + Mov AX, 4F01h + Int 10h + + Cmp AX, 4Fh + JE VESA_GetInfo1 + + StC + +VESA_GetInfo1: + Pop CX + Pop AX + + Ret + +EndP VESA_GetInfo + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc VESA_SetBlock Far ; Gives access to a 64kb block +Public VESA_SetBlock ; Given AX = block number. + + PushA + Push AX + + Mov AX, 64 + Xor DX, DX + Div Word Ptr [VESAModeInformationTable.WindowGranularity] + Mov DX, AX + Pop AX + Mul DX + Mov DX, AX + Xor BX, BX + Call DWord Ptr [VESAModeInformationTable.WindowFunction] + + PopA + Ret + +EndP VESA_SetBlock + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +EndS + +;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + +ENDIF + +End diff --git a/MAKEFILE.MAK b/MAKEFILE.MAK new file mode 100644 index 0000000..c00a2f8 --- /dev/null +++ b/MAKEFILE.MAK @@ -0,0 +1,9 @@ +IT.EXE: IT.OBJ IT_DISK.OBJ IT_DISPL.OBJ IT_EMS.OBJ IT_ERR.OBJ IT_F.OBJ IT_G.OBJ IT_H.OBJ \ +IT_I.OBJ IT_K.OBJ IT_L.OBJ IT_M.OBJ IT_NET.OBJ IT_MSG.OBJ IT_MUSIC.OBJ IT_NET.OBJ IT_OBJ1.OBJ IT_PE.OBJ IT_S.OBJ \ +IT_TUTE.OBJ IT_MMTSR.OBJ IT_MOUSE.OBJ IT_MDATA.OBJ IT_FOUR.OBJ IT_VESA.OBJ + tlink /3 /s /v @source.lst + +.ASM.OBJ: +# TASM /Zi /m /uT310 /jSMART $*.asm + TASM /m /uT310 /jSMART $*.asm + diff --git a/NETWORK.INC b/NETWORK.INC new file mode 100644 index 0000000..932f279 --- /dev/null +++ b/NETWORK.INC @@ -0,0 +1,32 @@ +IF NETWORKENABLED + Extrn Network_GetSendQueue:Far + Extrn Network_FinishedSendQueue:Far + Extrn Network_AddWordToQueue:Far + Extrn Network_EnsureNoNetwork:Far + Extrn Network_SendSampleHeader:Far + Extrn Network_SendInstrumentHeader:Far + Extrn Network_QueueSampleData:Far + Extrn Network_SendSongDataInformation:Far + +NETWORK_PARTIALPATTERNOBJECT EQU 0 +NETWORK_ENTIREPATTERNOBJECT EQU 1 +NETWORK_REQUESTPATTERNOBJECT EQU 2 +NETWORK_SONGDATAOBJECT EQU 3 +NETWORK_INSTRUMENTHEADEROBJECT EQU 4 +NETWORK_SAMPLEHEADEROBJECT EQU 5 +NETWORK_SETPATTERNLENGTH EQU 6 +NETWORK_DELETESAMPLEOBJECT EQU 7 + +EnsureNoNetwork EQU Call Network_EnsureNoNetwork +NetworkSendSample EQU Call Network_SendSampleHeader +NetworkSendInstrument EQU Call Network_SendInstrumentHeader + +ELSE + +EnsureNoNetwork EQU ; +NetworkSendSample EQU ; +NetworkSendInstrument EQU ; + +ENDIF + + diff --git a/PE_TRANS.INC b/PE_TRANS.INC new file mode 100644 index 0000000..78a9771 --- /dev/null +++ b/PE_TRANS.INC @@ -0,0 +1,1703 @@ + +XMVolume DB 0 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc TranslateXMNote + + Cmp AL, 96 + JBE TranslateXMNote1 + + Mov AL, 0FFh-11 ; Note off + +TranslateXMNote1: + Add AL, 11 + StosB + Ret + +EndP TranslateXMNote + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +XMEffectG DB 193, 193+4, 193+5, 193+6, 193+6, 193+7, 193+7, 193+8 + DB 193+8, 193+9 + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc TranslateXMInstrument + + Cmp AL, 99 + JBE TranslateXMInstrument1 + + Xor AL, AL + + Cmp Byte Ptr [ES:DI-1], 0FFh ; note off? + JE TranslateXMInstrument2 + Mov Byte Ptr [ES:DI-1], 0FDh + Jmp TranslateXMInstrument2 + +TranslateXMInstrument1: + Cmp Byte Ptr [ES:DI-1], 0FFh ; note off? + JNE TranslateXMInstrument2 + + Xor AL, AL + +TranslateXMInstrument2: + StosB + Ret + +EndP TranslateXMInstrument + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc TranslateXMVolume + + Push AX + + Mov AH, AL + Mov DX, AX + Mov AL, 0FFh + Cmp AH, 10h ; Nothing + JB TranslateXMVolume1 + + Mov AL, AH + Sub AL, 10h + Cmp AH, 50h ; Volume + JBE TranslateXMVolume1 + + Mov AL, 0FFh + Cmp AH, 60h ; Nothing + JB TranslateXMVolume1 + + Mov AL, AH + And AX, 0F00Fh + + Cmp AL, 9 + JBE TranslateXMVolume2 + + Mov AL, 9 + +TranslateXMVolume2: + Cmp AH, 70h + JAE TranslateXMVolume3 + + Add AL, 95 ; Volume down + Jmp TranslateXMVolume1 + +TranslateXMVolume3: + Cmp AH, 80h + JAE TranslateXMVolume4 + + Add AL, 85 ; volume up + Jmp TranslateXMVolume1 + +TranslateXMVolume4: + Cmp AH, 90h + JAE TranslateXMVolume5 + + Add AL, 75 ; Fine volume down + Jmp TranslateXMVolume1 + +TranslateXMVolume5: + Cmp AH, 0A0h + JAE TranslateXMVolume6 + + Add AL, 65 ; fine volume up + Jmp TranslateXMVolume1 + +TranslateXMVolume6: + Cmp AH, 0B0h + JAE TranslateXMVolume7 + + Mov AL, 0FFh ; Vibrato speed + Jmp TranslateXMVolume1 + +TranslateXMVolume7: + Cmp AH, 0C0h + JAE TranslateXMVolume8 + + Cmp AL, 3 + JBE TranslateXMVolumeH + + Dec AX + +TranslateXMVolumeH: + Add AL, 203 ; Vibrato + Jmp TranslateXMVolume1 + +TranslateXMVolume8: + Cmp AH, 0D0h + JAE TranslateXMVolume9 + + Mov AL, DL + Sub AL, 0C0h + Mov AH, AL + ShL AL, 2 + Or AL, AH ;Panning + Add AL, 128 + Jmp TranslateXMVolume1 + +TranslateXMVolume9: + Cmp AH, 0F0h + JAE TranslateXMVolume10 + + Mov AL, 0FFh ; Pan slide left/right + Jmp TranslateXMVolume1 + +TranslateXMVolume10: ; Porta + Push BX + Mov BX, AX + And BX, 0FFh + Mov AL, [CS:XMEffectG+BX] + Pop BX + +TranslateXMVolume1: + StosB + Pop AX + Ret + +EndP TranslateXMVolume + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc TranslateXMEffect ; Given AX = data + + Test AX, AX + JNZ TranslateXMEffect1 + +TranslateXMEffectVol: + Xor AX, AX + Cmp CS:XMVolume, 60h + JB TranslateXMEffectEnd + Mov DH, 0FFh + Jmp TranslateXMEffectVolume + +TranslateXMEffect1: + Cmp AL, 'K'-'A'+0Ah + JNE TranslateXMEffect24 + + Mov AL, [ES:DI-3] + Cmp AL, 0FDh + JNE TranslateXMEffectVol + + Mov Word Ptr [ES:DI-3], 0FFh + Jmp TranslateXMEffectVol + +TranslateXMEffect24: + Cmp AL, 0 + JNE TranslateXMEffect2 + + Mov AL, 'J'-'@' + Jmp TranslateXMEffectEnd + +TranslateXMEffect2: + Cmp AL, 1 + JNE TranslateXMEffect3 + + Mov AL, 'F'-'@' + Test AH, AH + JNZ TranslateXMEffectEnd + Cmp CS:XMVolume, 60h + JB TranslateXMEffectEnd + Mov DH, 105 + Jmp TranslateXMEffectVolume + +TranslateXMEffect3: + Cmp AL, 2 + JNE TranslateXMEffect4 + + Mov AL, 'E'-'@' + Test AH, AH + JNZ TranslateXMEffectEnd + Cmp CS:XMVolume, 60h + JB TranslateXMEffectEnd + Mov DH, 115 + Jmp TranslateXMEffectVolume + +TranslateXMEffect4: + Cmp AL, 3 + JNE TranslateXMEffect5 + + Mov AL, 'G'-'@' + Test AH, AH + JNZ TranslateXMEffectEnd + Cmp CS:XMVolume, 60h + JB TranslateXMEffectEnd + Mov DH, 193 + Jmp TranslateXMEffectVolume + +TranslateXMEffect5: + Cmp AL, 4 + JNE TranslateXMEffect6 + + Mov AL, AH + And AX, 0FF0h + Cmp AH, 4 + JBE TranslateXMEffectH1 + + Dec AH + +TranslateXMEffectH1: + Or AH, AL + Mov AL, 'H'-'@' + Test AH, AH + JNZ TranslateXMEffectEnd + Cmp CS:XMVolume, 60h + JB TranslateXMEffectEnd + Mov DH, 203 + Jmp TranslateXMEffectVolume + +TranslateXMEffect6: + Cmp AL, 5 + JNE TranslateXMEffect7 + + Mov AL, 'L'-'@' + Jmp TranslateXMEffectEnd + +TranslateXMEffect7: + Cmp AL, 6 + JNE TranslateXMEffect8 + + Mov AL, 'K'-'@' + Jmp TranslateXMEffectEnd + +TranslateXMEffect8: + Cmp AL, 7 + JNE TranslateXMEffect9 + + Mov AL, 'R'-'@' + Jmp TranslateXMEffectEnd + +TranslateXMEffect9: + Cmp AL, 8 + JNE TranslateXMEffect10 + + Mov AL, 'X'-'@' + Cmp CS:XMVolume, 60h + JB TranslateXMEffectEnd + Mov DH, AH + ShR DH, 2 + AdC DH, 128 + Jmp TranslateXMEffectVolume + +TranslateXMEffect10: + Cmp AL, 9 + JNE TranslateXMEffect11 + + Mov AL, 'O'-'@' + Jmp TranslateXMEffectEnd + +TranslateXMEffect11: + Cmp AL, 0Ah + JNE TranslateXMEffect12 + + Mov AL, 'D'-'@' + Jmp TranslateXMEffectEnd + +TranslateXMEffect12: + Cmp AL, 0Bh + JNE TranslateXMEffect13 + + Mov AL, 'B'-'@' + Jmp TranslateXMEffectEnd + +TranslateXMEffect13: + Cmp AL, 0Ch + JNE TranslateXMEffect14 + + Mov DH, AH + Cmp DH, 64 + JB TranslateXMEffectVolume + + Mov DH, 64 + +TranslateXMEffectVolume: + Mov AL, CS:XMVolume + Mov AH, AL + And AH, 0Fh + + Cmp AL, 60h + JAE TranslateXMEffectVolume1 + + Xor AX, AX + Jmp TranslateXMEffectVolumeEnd + +TranslateXMEffectVolume1: + Cmp AL, 70h + JAE TranslateXMEffectVolume2 + + Mov AL, 'D'-'@' + Jmp TranslateXMEffectVolumeEnd + +TranslateXMEffectVolume2: + Cmp AL, 80h + JAE TranslateXMEffectVolume3 + + Mov AL, 'D'-'@' + ShL AH, 4 + Jmp TranslateXMEffectVolumeEnd + +TranslateXMEffectVolume3: + Cmp AL, 90h + JAE TranslateXMEffectVolume4 + + Mov AL, 'D'-'@' + Test AH, AH + JZ TranslateXMEffect3Memory + Or AH, 0F0h + Cmp AH, 0FFh + JNE TranslateXMEffect3Memory + + Dec AH + +TranslateXMEffect3Memory: + Jmp TranslateXMEffectVolumeEnd + +TranslateXMEffectVolume4: + Cmp AL, 0A0h + JAE TranslateXMEffectVolume5 + + Mov AL, 'D'-'@' + Test AH, AH + JZ TranslateXMEffect4Memory + + ShL AH, 4 + Or AH, 0Fh + +TranslateXMEffect4Memory: + Jmp TranslateXMEffectVolumeEnd + +TranslateXMEffectVolume5: + Cmp AL, 0B0h + JAE TranslateXMEffectVolume6 + + Mov AL, 'H'-'@' + ShL AH, 4 + Jmp TranslateXMEffectVolumeEnd + +TranslateXMEffectVolume6: + Cmp AL, 0C0h + JAE TranslateXMEffectVolume7 + + Cmp AH, 4 + JBE TranslateXMEffectVolumeH6 + + Dec AH + +TranslateXMEffectVolumeH6: + Mov AL, 'H'-'@' + Jmp TranslateXMEffectVolumeEnd + +TranslateXMEffectVolume7: + Cmp AL, 0D0h + JAE TranslateXMEffectVolume8 + + Mov AL, 'S'-'@' + Or AH, 80h + Jmp TranslateXMEffectVolumeEnd + +TranslateXMEffectVolume8: + Cmp AL, 0E0h + JAE TranslateXMEffectVolume9 + + Mov AL, 'P'-'@' + ShL AH, 4 + Jmp TranslateXMEffectVolumeEnd + +TranslateXMEffectVolume9: + Cmp AL, 0F0h + JAE TranslateXMEffectVolume10 + + Mov AL, 'P'-'@' + Jmp TranslateXMEffectVolumeEnd + +TranslateXMEffectVolume10: + Mov AL, 'G'-'@' + ShL AH, 4 + +TranslateXMEffectVolumeEnd: + Mov [ES:DI-1], DH + StosW + Ret + +TranslateXMEffect14: + Cmp AL, 0Dh + JNE TranslateXMEffect15 + + Mov AL, AH + And AX, 0F00Fh + ShR AH, 1 + Add AL, AH + ShR AH, 2 + Add AH, AL + Mov AL, 'C'-'@' + Jmp TranslateXMEffectEnd + +TranslateXMEffect15: + Cmp AL, 0Eh + JNE TranslateXMEffect16 + + ; 'Multiplex' effect + Mov AL, AH + And AX, 0FF0h + Test AL, AL + JNZ TranslateXMEffectE1 + + Xor AX, AX + Jmp TranslateXMEffectEnd + +TranslateXMEffectE1: + Cmp AL, 10h + JNE TranslateXMEffectE2 + + Test AH, AH + JZ TranslateE1Memory + Or AH, 0F0h + +TranslateE1Memory: + Mov AL, 'F'-'@' + + Jmp TranslateXMEffectEnd + +TranslateXMEffectE2: + Cmp AL, 20h + JNE TranslateXMEffectE3 + + Test AH, AH + JZ TranslateE2Memory + Or AH, 0F0h + +TranslateE2Memory: + Mov AL, 'E'-'@' + + Jmp TranslateXMEffectEnd + +TranslateXMEffectE3: + Cmp AL, 30h + JNE TranslateXMEffectE4 + + Xor AX, AX + Jmp TranslateXMEffectEnd + +TranslateXMEffectE4: + Cmp AL, 40h + JNE TranslateXMEffectE5 + + Or AH, 30h + Mov AL, 'S'-'@' + + Jmp TranslateXMEffectEnd + +TranslateXMEffectE5: + Cmp AL, 50h + JNE TranslateXMEffectE6 + + Xor AX, AX + Jmp TranslateXMEffectEnd + +TranslateXMEffectE6: + Cmp AL, 60h + JNE TranslateXMEffectE7 + + Or AH, 0B0h + Mov AL, 'S'-'@' + + Jmp TranslateXMEffectEnd + +TranslateXMEffectE7: + Cmp AL, 70h + JNE TranslateXMEffectE8 + + Or AH, 040h + Mov AL, 'S'-'@' + + Jmp TranslateXMEffectEnd + +TranslateXMEffectE8: + Cmp AL, 80h + JNE TranslateXMEffectE9 + + Or AH, 80h + Mov AL, 'S'-'@' + + Jmp TranslateXMEffectEnd + +TranslateXMEffectE9: + Cmp AL, 90h + JNE TranslateXMEffectEA + + Mov AL, 'Q'-'@' + Test AH, AH + JNZ TranslateXMEffectEnd + Jmp TranslateXMEffectVol + +TranslateXMEffectEA: + Cmp AL, 0A0h + JNE TranslateXMEffectEB + + Test AH, AH + JZ TranslateXMEAMemory + + ShL AH, 4 + Or AH, 0Fh + +TranslateXMEAMemory: + Mov AL, 'D'-'@' + + Jmp TranslateXMEffectEnd + +TranslateXMEffectEB: + Cmp AL, 0B0h + JNE TranslateXMEffectEC + + Test AH, AH + JZ TranslateXMEBMemory + + Or AH, 0F0h + Cmp AH, 0FFh + JNE TranslateXMEBMemory + + Dec AH + +TranslateXMEBMemory: + Mov AL, 'D'-'@' + + Jmp TranslateXMEffectEnd + +TranslateXMEffectEC: + Cmp AL, 0C0h + JNE TranslateXMEffectED + + Or AH, 0C0h + Mov AL, 'S'-'@' + + Jmp TranslateXMEffectEnd + +TranslateXMEffectED: + Cmp AL, 0D0h + JNE TranslateXMEffectEE + + Or AH, 0D0h + Mov AL, 'S'-'@' + + Jmp TranslateXMEffectEnd + +TranslateXMEffectEE: + Cmp AL, 0E0h + JNE TranslateXMEffectEF + + Or AH, 0E0h + Mov AL, 'S'-'@' + Jmp TranslateXMEffectEnd + +TranslateXMEffectEF: + Xor AX, AX + Jmp TranslateXMEffectEnd + +TranslateXMEffect16: + Cmp AL, 0Fh + JNE TranslateXMEffect18 + + Mov AL, 'T'-'@' + Cmp AH, 20h + JAE TranslateXMTempo1 + + Mov AL, 'A'-'@' + +TranslateXMTempo1: + Jmp TranslateXMEffectEnd + +TranslateXMEffect18: + Cmp AL, 10h ; 'G'lobal volume + JNE TranslateXMEffect19 + + Mov AL, 'V'-'@' + Cmp AH, 40h + JB TranslateXMEffectV + + Mov AH, 80h + Jmp TranslateXMEffectEnd + +TranslateXMEffectV: + ShL AH, 1 + Jmp TranslateXMEffectEnd + +TranslateXMEffect19: + Cmp AL, 11h ; 'H' + JNE TranslateXMEffect20 + + Mov AL, AH + And AX, 0FF0h + ShL AH, 1 + Cmp AH, 0Fh + JBE TranslateGlobalVolSlide2 + + Mov AH, 0Fh + +TranslateGlobalVolSlide2: + ShL AL, 1 + JNC TranslateGlobalVolSlide1 + + Mov AL, 0F0h + +TranslateGlobalVolSlide1: + Or AH, AL + Mov AL, 'W'-'@' + Jmp TranslateXMEffectEnd + +TranslateXMEffect20: + Cmp AL, 'R'-'A'+0Ah + JNE TranslateXMEffect21 + + Mov AL, 'Q'-'@' + Jmp TranslateXMEffectEnd + +TranslateXMEffect21: + Cmp AL, 'T'-'A'+0Ah + JNE TranslateXMEffect22 + + Mov AL, AH + And AX, 0FF0h + Test AH, AH + JNZ Tremor1 + + Inc AH + +Tremor1: + Test AL, AL + JNZ Tremor2 + + Inc AX +Tremor2: + Or AH, AL + Mov AL, 'I'-'@' + Jmp TranslateXMEffectEnd + +TranslateXMEffect22: + Cmp AL, 'X'-'A'+0Ah + JNE TranslateXMEffect23 + + Mov AL, AH + And AX, 0FF0h + Or AH, 0E0h + Cmp AL, 10h + JE TranslateXMEffectX1 + Cmp AL, 20h + JE TranslateXMEffectX2 + + Xor AX, AX + Jmp TranslateXMEffectEnd + +TranslateXMEffectX1: + Mov AL, 'F'-'@' + Jmp TranslateXMEffectEnd + +TranslateXMEffectX2: + Mov AL, 'E'-'@' + Jmp TranslateXMEffectEnd + +TranslateXMEffect23: + Cmp AL, 'Z'-'A'+0Ah + JNE TranslateXMEffect25 + + Mov AL, 'Z'-'@' + Jmp TranslateXMEffectEnd + +TranslateXMEFfect25: + Jmp TranslateXMEffectVol +; Xor AX, AX + +TranslateXMEffectEnd: + StosW + Ret + +EndP TranslateXMEffect + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_TranslateXMPattern Far ; DS:SI points to + ; data, AX = rows + ; CX = channels + ; DX = pattern num + + ; Has to return DS:SI + PushA + Push DS + Push ES + + Dec AX + Mov CS:TempVariableArea3, AX + Cmp AX, 31 + JAE PE_XMLimitRows + + Mov AX, 31 + +PE_XMLimitRows: + Mov CS:MaxRow, AX + Mov CS:PatternNumber, DX ; Pattern number + Mov CS:TempVariableArea2, CX ; Channels + + Call PE_ClearPatternData + + Mov ES, CS:PatternDataArea + Xor DI, DI + Xor AX, AX ; AX = row number + +PE_TranslateXMPattern1: + Push AX + Push DI + + Mov CX, CS:TempVariableArea2 ; CX = channels + +PE_TranslateXMPattern2: + Push CX + + LodsB ; AL = either note or compression + ; control. + Test AL, AL + JS PE_TranslateXMPatternCompressed + + Call TranslateXMNote + LodsB + Call TranslateXMInstrument + LodsB + Mov CS:XMVolume, AL + Call TranslateXMVolume + LodsW + Call TranslateXMEffect + Jmp PE_TranslateXMPattern3 + +PE_TranslateXMPatternCompressed: + Mov CS:XMVolume, 0 + Mov AH, AL + Test AH, 1 + JZ PE_TranslateXMPattern4 + + LodsB + Call TranslateXMNote + Dec DI + +PE_TranslateXMPattern4: + Inc DI + + Test AH, 2 + JZ PE_TranslateXMPattern5 + + LodsB + Call TranslateXMInstrument + Dec DI + +PE_TranslateXMPattern5: + Inc DI + + Test AH, 4 + JZ PE_TranslateXMPattern6 + + LodsB + Mov CS:XMVolume, AL + Call TranslateXMVolume + Dec DI + +PE_TranslateXMPattern6: + Inc DI + + Xor AL, AL + Test AH, 8 + JZ PE_TranslateXMPattern7 + + LodsB + +PE_TranslateXMPattern7: + Test AH, 10h + Mov AH, 0 + JZ PE_TranslateXMPattern8 + + Mov AH, [SI] + Inc SI + +PE_TranslateXMPattern8: + Call TranslateXMEffect + +PE_TranslateXMPattern3: + Pop CX + Dec CX + JNZ PE_TranslateXMPattern2 + + Pop DI + Pop AX + Add DI, 320 ; Next row. + Inc AX + Cmp AX, CS:TempVariableArea3 + JBE PE_TranslateXMPattern1 + + Mov CS:TempVariableArea, SI + + Mov AX, CS:TempVariableArea3 + Cmp AX, CS:MaxRow + JE PE_TranslateXMPatternNoBreak + + Mov DX, 320 + Mul DX + Mov DI, AX + Add DI, 3 + +PE_TranslateXMPatternBreak1: + Cmp Word Ptr [ES:DI], 0 + JE PE_TranslateXMPatternBreak2 + + Add DI, 5 + Jmp PE_TranslateXMPatternBreak1 + +PE_TranslateXMPatternBreak2: + Mov Word Ptr [ES:DI], 'C'-'@' ; Break. + +PE_TranslateXMPatternNoBreak: + Push CS + Pop DS + + Call Far Ptr PE_TranslateS3MPointer8 + + + Pop ES + Pop DS + PopA + + Mov SI, CS:TempVariableArea + + Ret + +EndP PE_TranslateXMPattern + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc TranslateMODCommand ; AL = command + ; AH = command value + ; ES:DI points to + ; command destination + + Test AX, AX + JNZ TranslateMODCommand7 + + StosW + Ret + +TranslateMODCommand7: + Cmp AL, 0 + JNE TranslateMODCommand8 + + Mov AL, 'J'-'@' + StosW + Ret + +TranslateMODCommand8: + Cmp AL, 1 + JNE TranslateMODCommand9 + + Mov AL, 'F'-'@' + Jmp TranslateMODCommand36 + +TranslateMODCommand9: + Cmp AL, 2 + JNE TranslateMODCommand10 + + Mov AL, 'E'-'@' + Jmp TranslateMODCommand36 + +TranslateMODCommand10: + Cmp AL, 3 + JNE TranslateMODCommand11 + + Mov AL, 'G'-'@' + StosW + Ret + +TranslateMODCommand11: + Cmp AL, 4 + JNE TranslateMODCommand12 + + Mov AL, 'H'-'@' + + StosW + Ret + +TranslateMODCommand12: + Cmp AL, 5 + JNE TranslateMODCommand13 + + Mov AL, 'L'-'@' + Test AH, AH + JNZ TranslateMODCommand40 + + Mov AX, 'G'-'@' + +TranslateMODCommand40: + StosW + Ret + +TranslateMODCommand13: + Cmp AL, 6 + JNE TranslateMODCommand14 + + Mov AL, 'K'-'@' + Test AH, AH + JNZ TranslateMODCommand39 + + Mov AX, 'H'-'@' + +TranslateMODCommand39: + StosW + Ret + +TranslateMODCommand14: + Cmp AL, 7 + JNE TranslateMODCommand15 + + Mov AL, 'R'-'@' + StosW + Ret + +TranslateMODCommand15: + Cmp AL, 8 + JNE TranslateMODCommand16 + + Mov AL, 'X'-'@' + Cmp AH, 0A4h + JNE TranslateMODNoSurround + + Mov AX, 'S'-'@'+9100h + +TranslateMODNoSurround: + StosW + Ret + +TranslateMODCommand16: + Cmp AL, 9 + JNE TranslateMODCommand17 + + Mov AL, 'O'-'@' + StosW + Ret + +TranslateMODCommand17: + Cmp AL, 10 + JNE TranslateMODCommand18 + + Mov AL, 'D'-'@' + Test AH, 0Fh + JZ TranslateMODVolumeSlide1 + Test AH, 0F0h + JZ TranslateMODVolumeSlide1 + + And AH, 0F0h + +TranslateMODVolumeSlide1: + Jmp TranslateMODCommand36 + +TranslateMODCommand18: + Cmp AL, 11 + JNE TranslateMODCommand19 + + Mov AL, 'B'-'@' + StosW + Ret + +TranslateMODCommand19: + Cmp AL, 12 + JNE TranslateMODCommand20 + + Cmp AH, 64 + JBE TranslateMODCommand37 + + Mov AH, 64 + +TranslateMODCommand37: + Mov [ES:DI-1], AH + Add DI, 2 + Ret + +TranslateMODCommand20: + Cmp AL, 13 + JNE TranslateMODCommand21 + + Mov AL, AH + And AX, 0F00Fh + ShR AH, 1 ; AH = highnibble*8 + Add AL, AH + + ShR AH, 2 ; AH = highnibble*2 + Add AH, AL + + Mov AL, 'C'-'@' + StosW + Ret + +TranslateMODCommand21: + Cmp AL, 14 + JNE TranslateMODCommand34 + + Mov AL, AH + And AX, 0FF0h + + Cmp AL, 0 + JNE TranslateMODCommand22 + + Test AH, AH + JZ TranslateMODCommand36 + + Mov AL, 'S'-'@' + StosW + Ret + +TranslateMODCommand22: + Cmp AL, 10h + JNE TranslateMODCommand23 + + Test AH, AH + JZ TranslateMODCommand36 + + Mov AL, 'F'-'@' + Or AH, 0F0h + StosW + Ret + +TranslateMODCommand23: + Cmp AL, 20h + JNE TranslateMODCommand24 + + Test AH, AH + JZ TranslateMODCommand36 + + Mov AL, 'E'-'@' + Or AH, 0F0h + StosW + Ret + +TranslateMODCommand24: + Cmp AL, 30h + JNE TranslateMODCommand25 + + Mov AL, 'S'-'@' + Or AH, 010h + StosW + Ret + +TranslateMODCommand25: + Cmp AL, 40h + JNE TranslateMODCommand26 + + Mov AL, 'S'-'@' + Or AH, 030h + StosW + Ret + +TranslateMODCommand26: + Cmp AL, 50h + JNE TranslateMODCommand27 + + Mov AL, 'S'-'@' + Or AH, 020h + StosW + Ret + +TranslateMODCommand27: + Cmp AL, 60h + JNE TranslateMODCommand28 + + Mov AL, 'S'-'@' + Or AH, 0B0h + StosW + Ret + +TranslateMODCommand28: + Cmp AL, 70h + JNE TranslateMODCommand29 + + Mov AL, 'S'-'@' + Or AH, 40h + StosW + Ret + +TranslateMODCommand29: + Cmp AL, 80h + JNE TranslateMODCommand30 + + Or AH, AL + Mov AL, 'S'-'@' + StosW + Ret + +TranslateMODCommand30: + Cmp AL, 90h + JNE TranslateMODCommand31 + + Test AH, AH + JZ TranslateMODCommand36 + + Mov AL, 'Q'-'@' + Jmp TranslateMODCommand36 + +TranslateMODCommand31: + Cmp AL, 0A0h + JNE TranslateMODCommand32 + + And AH, 0Fh + JZ TranslateMODCommand36 + + Mov AL, 'D'-'@' + ShL AH, 4 + Or AH, 0Fh + StosW + Ret + +TranslateMODCommand32: + Cmp AL, 0B0h + JNE TranslateMODCommand33 + + And AH, 0Fh + JZ TranslateMODCommand36 + + Mov AL, 'D'-'@' + Or AH, 0F0h + StosW + Ret + + +TranslateMODCommand33: + Or AH, AL + Mov AL, 'S'-'@' + StosW + Ret + +TranslateMODCommand34: ; Set speed. + Cmp AH, 20h + JA TranslateMODCommand35 + + Mov AL, 'A'-'@' + Jmp TranslateMODCommand36 + +TranslateMODCommand35: + Mov AL, 'T'-'@' + StosW + Ret + +TranslateMODCommand36: + Test AH, AH + JNZ TranslateMODCommand38 + + Xor AX, AX + +TranslateMODCommand38: + StosW + Ret + +EndP TranslateMODCommand + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_TranslateMTMPattern Far ; DS:SI points to data + ; DX = pattern no. + PushA + Push DS + Push ES + + Mov CS:MaxRow, 63 + Mov CS:PatternNumber, DX + + Call PE_ClearPatternData + + Mov ES, CS:PatternDataArea + Xor DI, DI + + Mov CX, 32 + +PE_TranslateMTMPattern1: + Push CX + Push DI + + Mov CX, 64 + +PE_TranslateMTMPattern2: + LodsW ; Layout of AX + XChg AH, AL + ; ppppppiiiiiieeee + ; p = pitch val + ; i = ins + ; e = effect + Mov DL, AL + And DL, 0Fh ; DL = effect. + ShR AX, 2 ; AX = 00pppppp iiiiiixx + ShR AL, 2 ; AH = pitch, AL = ins. + XChg AH, AL ; AH = ins. AL =pitch + + Test AL, AL + JZ PE_TranslateMTMPattern3 + + Add AL, 36 ; Middle octave C-5 + Jmp PE_TranslateMTMPattern4 + +PE_TranslateMTMPattern3: + Mov AL, NONOTE + +PE_TranslateMTMPattern4: + StosB ; Pitch. + + Mov AL, AH ; Instrument + Mov AH, 0FFh ; volume + StosW + + LodsB ; DL = effect, AL = effectval. + Mov AH, AL ; AH = AL = effectval. DL = eff. + Mov AL, DL + + Call TranslateMODCommand + + Add DI, 315 + Loop PE_TranslateMTMPattern2 + + Pop DI + Pop CX + Add DI, 5 + Loop PE_TranslateMTMPattern1 + + Push CS + Pop DS + Call Far Ptr PE_TranslateMODPattern1 + + Pop ES + Pop DS + PopA + + Ret + +EndP PE_TranslateMTMPattern + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_TranslateMODPattern Far ; DS:SI points to data + ; DX = pattern no. + ; AX = number of channels + PushA + Push DS + Push ES + + Mov CS:MaxRow, 63 + Mov CS:PatternNumber, DX + + Call PE_ClearPatternData + + Mov ES, CS:PatternDataArea + Xor DI, DI + Mov CX, 64 + +PE_TranslateMODPattern2: + Push AX + Push CX + Push DI + + Mov CX, AX + +PE_TranslateMODPattern3: + Mov AL, [DS:SI+1] + Mov AH, [DS:SI] + And AX, 0FFFh ; AX = period of note. + Mov DX, 72 + Xor BX, BX + +PE_TranslateMODPattern4: + Cmp AX, [CS:MODPeriodTable+BX] + JAE PE_TranslateMODPattern5 + + Add BX, 2 + Dec DX + JNZ PE_TranslateMODPattern4 + + Inc DI + Jmp PE_TranslateMODPattern6 + +PE_TranslateMODPattern5: + ShR BX, 1 ; BL = note. + Mov AL, BL + Add AL, 36 ; For C5 as central note. + StosB + +PE_TranslateMODPattern6: + Mov AL, [DS:SI] + Mov AH, [DS:SI+2] + ShR AH, 4 + And AL, 0F0h + Or AL, AH + StosB ; Sample stored. + + Inc DI ; Points to effect/commandvalue + + Mov AH, [DS:SI+3] + Mov AL, [DS:SI+2] + And AL, 0Fh ; AL = effect, AH = param. + + Call TranslateMODCommand + + Add SI, 4 + Loop PE_TranslateMODPattern3 + + Pop DI + Pop CX + Pop AX + Add DI, 320 + Loop PE_TranslateMODPattern2 + + Push CS + Pop DS + Call Far Ptr PE_TranslateMODPattern1 + + Pop ES + Pop DS + PopA + + Ret + +PE_TranslateMODPattern1: + Call PEFunction_StorePattern + + RetF + +EndP PE_TranslateMODPattern + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_Translate669Pattern Far + + PushA ; DS:0 points to data + Push DS ; CL = Maxrow + Push ES ; AH = Starting tempo + ; BP = PatternNumber + Mov Byte Ptr [CS:MaxRow], CL + Mov [CS:PatternNumber], BP + + Call PE_ClearPatternData + + Mov ES, CS:PatternDataArea + Cmp CL, 31 + JAE Pattern669Rows + + Mov [CS:MaxRow], 31 + + Mov AL, 5 + Mul CL + Mov DI, AX + ShL DI, 6 + + Mov Word Ptr [ES:DI+8*5+3], 'C'-'@' + +Pattern669Rows: + Xor DI, DI + + Mov AL, 'A'-'@' + Mov [ES:DI+8*5+3], AX ; Tempo setting + Inc CL + Xor SI, SI + + Xor EAX, EAX + Mov BP, Offset EncodingInfo + Mov [CS:BP], EAX + Mov [CS:BP+4], EAX + Mov [CS:BP+8], EAX + Mov [CS:BP+12], EAX + +Translate669Pattern1: + Mov CH, 8 + +Translate669Pattern2: + LodsW + Cmp AL, 0FEh + JB Translate669Pattern4 + JE Translate669Pattern3 + + Add DI, 3 + Jmp Translate669Pattern5 + +Translate669Pattern3: + Add DI, 2 + ShR AX, 6 + And AL, 3Ch + StosB + Jmp Translate669Pattern5 + +Translate669Pattern4: + Mov DX, AX ; Note + + And AX, 0F003h + ShL AL, 4 + ShR AH, 4 + Or AH, AL + Inc AH + Mov AL, DL + ShR AL, 2 + Add AL, 36 + StosW + + Mov AL, DH ; Volume + ShL AL, 2 + And AL, 3Ch + StosB + + Mov Word Ptr [CS:BP], 0 + +Translate669Pattern5: + LodsB + + Cmp AL, 0FFh + JE Translate669NoEffect + + Mov AH, AL + And AX, 00FF0h + +Translate669EffectA: ; Portamento Up + Cmp AL, 0 + JNE Translate669EffectB + + Mov AL, 'F'-'@' + Mov [CS:BP], AX + Jmp Translate669EffectEnd + +Translate669EffectB: ; Portamento down + Cmp AL, 10h + JNE Translate669EffectC + + Mov AL, 'E'-'@' + Mov [CS:BP], AX + Jmp Translate669EffectEnd + +Translate669EffectC: ; Portamento to + Cmp AL, 20h + JNE Translate669EffectD + + Mov AL, 'G'-'@' + Mov [CS:BP], AX + Jmp Translate669EffectEnd + +Translate669EffectD: ; Frequency Adjust + Cmp AL, 30h + JNE Translate669EffectE + + Mov AX, ('E'-'@')+0F100h + Mov Word Ptr [CS:BP], 0 + Jmp Translate669EffectEnd + +Translate669EffectE: ; Vibrato + Cmp AL, 40h + JNE Translate669EffectF + + Mov AL, 'H'-'@' + Or AH, 80h + Mov [CS:BP], AX + Jmp Translate669EffectEnd + +Translate669EffectF: + Cmp AL, 50h + JNE Translate669NoEffect + + Mov AL, 'A'-'@' + Mov Word Ptr [CS:BP], 0 + Jmp Translate669EffectEnd + +Translate669NoEffect: + Mov AX, [CS:BP] + +Translate669EffectEnd: + StosW + + Add BP, 2 + + Dec CH + JNZ Translate669Pattern2 + + Add DI, 320-8*5 + Mov BP, Offset EncodingInfo + + Dec CL + JNZ Translate669Pattern1 + + Push CS + Pop DS + + Call Far Ptr PE_TranslateS3MPointer8 + + Pop ES + Pop DS + PopA + + Ret + +EndP PE_Translate669Pattern + +;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + +Proc PE_TranslateS3MPattern Far ; DS:SI points to data. + ; DX = pattern no. + PushA + Push DS + Push ES + + Mov CS:MaxRow, 63 + Mov CS:PatternNumber, DX + + Call PE_ClearPatternData + + Mov ES, CS:PatternDataArea + Xor DI, DI + Mov CX, 64 + +PE_TranslateS3MPattern1: + Push DI + +PE_TranslateS3MPattern2: + LodsB + Test AL, AL + JNZ PE_TranslateS3MPattern3 + + Pop DI + Add DI, 320 + + Loop PE_TranslateS3MPattern1 + + Push CS + Pop DS + + Call Far Ptr PE_TranslateS3MPointer8 + + Pop ES + Pop DS + PopA + + Ret + +PE_TranslateS3MPointer8: + Call PEFunction_StorePattern + + RetF + +PE_TranslateS3MPattern3: + Push DI + Mov BH, AL + And AL, 31 + Mov AH, 5 + Mul AH ; DI+AX = offset. + Add DI, AX + Test BH, 32 + JZ PE_TranslateS3MPattern6 + + LodsB +; Cmp AL, 0FFH +; JE PE_TranslateS3MPattern5 + Cmp AL, 0FEh + JE PE_TranslateS3MPattern4 + Cmp AL, 07Fh + JA PE_TranslateS3MPattern5 + + Mov BL, AL + And BL, 0Fh + ShR AL, 4 + Mov AH, 12 + Mul AH + Add AL, BL + Add AL, 12 ; C5 is now central octave + Mov [ES:DI], AL ; Note + Jmp PE_TranslateS3MPattern5 + +PE_TranslateS3MPattern4: + Mov Byte Ptr [ES:DI], 0FEh + +PE_TranslateS3MPattern5: + LodsB ; Instrument + Cmp AL, 99 + JBE PE_TranslateS3MPattern13 + + Xor AL, AL + +PE_TranslateS3MPattern13: + Mov [ES:DI+1], AL + +PE_TranslateS3MPattern6: + Test BH, 64 + JZ PE_TranslateS3MPattern7 + + LodsB ; Volume + Cmp AL, 64 + JBE PE_TranslateS3MPattern12 + Cmp AL, 0FFh + JE PE_TranslateS3MPattern12 + + Mov AL, 64 + +PE_TranslateS3MPattern12: + Mov [ES:DI+2], AL + +PE_TranslateS3MPattern7: + Test BH, 128 + JZ PE_TranslateS3MPattern8 + + LodsW + Cmp AL, 'C'-'@' + JNE PE_TranslateS3MPattern9 + + Mov AL, AH + And AX, 0F00Fh + ShR AH, 1 + Add AL, AH + ShR AH, 2 + Add AH, AL + Mov AL, 'C'-'@' + Jmp PE_TranslateS3MPattern10 + +PE_TranslateS3MPattern9: + Cmp AL, 'V'-'@' + JNE PE_TranslateS3MPattern11 + + Jmp PE_TranslateS3MPattern14 + +PE_TranslateS3MPattern11: + Cmp AL, 'X'-'@' + JNE PE_TranslateS3MPattern15 + + Cmp AH, 0A4h + JNE PE_TranslateS3MPattern14 + + Mov AX, 'S'-'@'+9100h + Jmp PE_TranslateS3MPattern10 + +PE_TranslateS3MPattern14: + ShL AH, 1 + JNC PE_TranslateS3MPattern10 + + Mov AH, 0FFh + Jmp PE_TranslateS3MPattern10 + +PE_TranslateS3MPattern15: + Cmp AL, 'D'-'@' + JNE PE_TranslateS3MPattern10 + Test AL, 0Fh + JZ PE_TranslateS3MPattern10 + Test AL, 0F0h + JZ PE_TranslateS3MPattern10 + + Mov BL, AH + Mov BH, AH + And BX, 0FF0h + Cmp BH, 0Fh + JE PE_TranslateS3MPattern10 + Cmp BL, 0F0h + JE PE_TranslateS3MPattern10 + + And AH, 0Fh + +PE_TranslateS3MPattern10: + Mov [ES:DI+3], AX + +PE_TranslateS3MPattern8: + Pop DI + + Jmp PE_TranslateS3MPattern2 + +EndP PE_TranslateS3MPattern + + diff --git a/SWITCH.INC b/SWITCH.INC new file mode 100644 index 0000000..e984f26 --- /dev/null +++ b/SWITCH.INC @@ -0,0 +1,44 @@ + +TRACEENABLED EQU 0 + +TUTORIAL = 0 + + EMSUSE41 = 0 + + SHOWVERSION = 0 + SHOWREGISTERNAME = 1 + + USE32BITSCREENCOPY = 0 + + SORTENABLED = 1 + DDCOMPRESS = 1 + ORDERSORT = 1 + FILTERENVELOPES = 1 + CHORDENTRY = 1 + SPECTRUMANALYSER = 1 + SAVESAMPLEWAV = 1 + ENABLEPRESETENVELOPES = 1 + ENABLESOLO = 1 + + DEFAULTFORMAT = 3 ; 0 = IT214, 1 = S3M, 2 = IT2xx, 3 = IT215 + + USEFPUCODE = 1 ; For IT_MUSIC, this will change from LUT to FPU code + + OLDDRIVER = 0 + + MUSICDEBUG = 0 + EMSDEBUG = 0 + MEMORYDEBUG = 0 + ENABLEINT3 = 0 ; For debugging. + + TIMERSCREEN = 1 + + NETWORKENABLED = 1 + SHOWPATTERNLENGTH = 0 + +IF TUTORIAL + SORTENABLED = 1 + DDCOMPRESS = 1 +ENDIF + +TRACKERVERSION = 217h ; Still have to change text in IT.ASM, IT_F.ASM diff --git a/USERNAME.INC b/USERNAME.INC new file mode 100644 index 0000000..f86c59b --- /dev/null +++ b/USERNAME.INC @@ -0,0 +1 @@ +REGISTERNAME EQU "Unregistered" \ No newline at end of file diff --git a/WAVSWITC.INC b/WAVSWITC.INC new file mode 100644 index 0000000..c3512e9 --- /dev/null +++ b/WAVSWITC.INC @@ -0,0 +1,22 @@ + +REGISTERED = 1 + +VOLUMERAMP = 1 +DOUBLEVOLUME = 0 +DITHEROUTPUT = 1 + +USECLICKFADETHRESHHOLD= 0 +CLICKFADETHRESHHOLD = 4096 + +RAMPSPEED = 8 +RAMPCOMPENSATE = 255 + +CUBICINTERPOLATION = 1 +QUADRATICINTERPOLATION = 0 +LINEARINTERPOLATION = 0 +POINTSAMPLED = 0 + +INTELOPTIMISED = 0 + +FileID DW 0 + diff --git a/source.lst b/source.lst new file mode 100644 index 0000000..5fd4c3a --- /dev/null +++ b/source.lst @@ -0,0 +1 @@ +it it_disk it_displ it_ems it_err it_f it_g it_h it_i it_k it_l it_m it_music it_net it_obj1 it_pe it_s it_mouse It_MMTSR It_msg IT_TUTE it_mdata it_four it_vesa