1 ; **************************************************************************** 2 ; twavply2.s (for TRDOS 386) 3 ; ---------------------------------------------------------------------------- 4 ; TWAVPLY2.PRG ! AC'97 (ICH) WAV PLAYER & VGA DEMO program by Erdogan TAN 5 ; 6 ; 09/12/2023 7 ; 8 ; [ Last Modification: 05/02/2025 ] 9 ; 10 ; Modified from: twavplay.s (VIA VT8237R WAV PLAYER & VGA DEMO) program 11 ; by Erdogan Tan (24/08/2020) 12 ; 13 ; Modified from: 'playwav6.s' (AC'97 WAV player) source code 14 ; by Erdogan Tan (27/11/2023) 15 ; 16 ; Assembler: NASM 2.15 17 ; ---------------------------------------------------------------------------- 18 ; nasm twavplay.s -l twavplay.txt -o TWAVPLAY.PRG 19 ; **************************************************************************** 20 21 ; 09/12/2023 22 ; Modified from: twavplay.s (VIA VT8237R WAV PLAYER & VGA DEMO) program 23 ; by Erdogan Tan (24/08/2020) 24 25 ; 14/07/2020 26 ; 31/12/2017 27 ; TRDOS 386 (v2.0) system calls 28 _ver equ 0 29 _exit equ 1 30 _fork equ 2 31 _read equ 3 32 _write equ 4 33 _open equ 5 34 _close equ 6 35 _wait equ 7 36 _create equ 8 37 _rename equ 9 38 _delete equ 10 39 _exec equ 11 40 _chdir equ 12 41 _time equ 13 42 _mkdir equ 14 43 _chmod equ 15 44 _rmdir equ 16 45 _break equ 17 46 _drive equ 18 47 _seek equ 19 48 _tell equ 20 49 _memory equ 21 50 _prompt equ 22 51 _path equ 23 52 _env equ 24 53 _stime equ 25 54 _quit equ 26 55 _intr equ 27 56 _dir equ 28 57 _emt equ 29 58 _ldrvt equ 30 59 _video equ 31 60 _audio equ 32 61 _timer equ 33 62 _sleep equ 34 63 _msg equ 35 64 _geterr equ 36 65 _fpstat equ 37 66 _pri equ 38 67 _rele equ 39 68 _fff equ 40 69 _fnf equ 41 70 _alloc equ 42 71 _dalloc equ 43 72 _calbac equ 44 73 _dma equ 45 74 75 %macro sys 1-4 76 ; 29/04/2016 - TRDOS 386 (TRDOS v2.0) 77 ; 03/09/2015 78 ; 13/04/2015 79 ; Retro UNIX 386 v1 system call. 80 %if %0 >= 2 81 mov ebx, %2 82 %if %0 >= 3 83 mov ecx, %3 84 %if %0 = 4 85 mov edx, %4 86 %endif 87 %endif 88 %endif 89 mov eax, %1 90 ;int 30h 91 int 40h ; TRDOS 386 (TRDOS v2.0) 92 %endmacro 93 94 ; TRDOS 386 (and Retro UNIX 386 v1) system call format: 95 ; sys systemcall (eax) , , 96 97 ; 19/06/2017 98 BUFFERSIZE equ 32768 99 ; 23/08/2020 100 ENDOFFILE equ 1 ; flag for knowing end of file 101 102 ; ---------------------------------------------------------------------------- 103 ; Tiny MOD Player v0.1b by Carlos Hasan. 104 ; July 14th, 1993. 105 106 ;============================================================================= 107 ; 108 ;============================================================================= 109 110 [BITS 32] 111 [org 0] 112 113 Start: 114 ; clear bss 115 00000000 B9[00000500] mov ecx, EOF 116 00000005 BF[6B690000] mov edi, bss_start 117 0000000A 29F9 sub ecx, edi 118 0000000C D1E9 shr ecx, 1 119 0000000E 31C0 xor eax, eax 120 00000010 F366AB rep stosw 121 122 ; 09/12/2023 123 ; Detect (& Enable) AC'97 Audio Device 124 00000013 E807050000 call DetectAC97 125 00000018 731B jnc short GetFileName 126 127 _dev_not_ready: 128 ; couldn't find the audio device! 129 sys _msg, noDevMsg, 255, 0Fh 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 0000001A BB[93670000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 0000001F B9FF000000 <1> mov ecx, %3 84 <1> %if %0 = 4 85 00000024 BA0F000000 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00000029 B823000000 <1> mov eax, %1 90 <1> 91 0000002E CD40 <1> int 40h 130 00000030 E9C4040000 jmp Exit 131 132 GetFileName: 133 00000035 89E6 mov esi, esp 134 00000037 AD lodsd 135 00000038 83F802 cmp eax, 2 ; two arguments 136 ; (program file name & mod file name) 137 ;jb pmsg_usage ; nothing to do 138 ; 09/12/2023 139 0000003B 7305 jnb short _x 140 0000003D E9C5040000 jmp pmsg_usage 141 142 _x: 143 00000042 AD lodsd ; program file name address 144 00000043 AD lodsd ; wav file name address (file to be read) 145 00000044 89C6 mov esi, eax 146 00000046 BF[B0690000] mov edi, wav_file_name 147 ScanName: 148 0000004B AC lodsb 149 0000004C 84C0 test al, al 150 ;jz pmsg_usage 151 ; 09/12/2023 152 0000004E 7505 jnz short _y 153 00000050 E9B2040000 jmp pmsg_usage 154 _y: 155 00000055 3C20 cmp al, 20h 156 00000057 74F2 je short ScanName ; scan start of name. 157 00000059 AA stosb 158 0000005A B4FF mov ah, 0FFh 159 a_0: 160 0000005C FEC4 inc ah 161 a_1: 162 0000005E AC lodsb 163 0000005F AA stosb 164 00000060 3C2E cmp al, '.' 165 00000062 74F8 je short a_0 166 00000064 20C0 and al, al 167 00000066 75F6 jnz short a_1 168 169 00000068 08E4 or ah, ah ; if period NOT found, 170 0000006A 750B jnz short PrintPMesg ; then add a .MOD extension. 171 SetExt: 172 0000006C 4F dec edi 173 0000006D C7072E574156 mov dword [edi], '.WAV' 174 00000073 C6470400 mov byte [edi+4], 0 175 PrintPMesg: 176 ; 23/08/2020 177 00000077 C605[3E670000]00 mov byte [credits_zero], 0 178 179 ; Prints the Credits Text. 180 sys _msg, Credits, 255, 0Fh 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 0000007E BB[D8660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 00000083 B9FF000000 <1> mov ecx, %3 84 <1> %if %0 = 4 85 00000088 BA0F000000 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 0000008D B823000000 <1> mov eax, %1 90 <1> 91 00000092 CD40 <1> int 40h 181 _1: 182 ; 19/06/2017 183 ; Allocate Audio Buffer (for user) 184 ;sys _audio, 0200h, BUFFERSIZE, audio_buffer 185 ; 09/12/2023 186 sys _audio, 0200h, [buffersize], audio_buffer 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 00000094 BB00020000 <1> mov ebx, %2 82 <1> %if %0 >= 3 83 00000099 8B0D[31040000] <1> mov ecx, %3 84 <1> %if %0 = 4 85 0000009F BA[00800000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 000000A4 B820000000 <1> mov eax, %1 90 <1> 91 000000A9 CD40 <1> int 40h 187 000000AB 7218 jc short error_exit 188 _2: 189 ; 23/08/2020 190 ; Initialize Audio Device (bl = 1 -> Interrupt method) 191 ;sys _audio, 0301h, 0, audio_int_handler 192 ;jc short error_exit 193 194 ; 24/08/2020 195 196 ; 20/10/2017 197 ; Initialize Audio Device (bl = 0 -> SRB method) 198 sys _audio, 0300h, 1, srb 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 000000AD BB00030000 <1> mov ebx, %2 82 <1> %if %0 >= 3 83 000000B2 B901000000 <1> mov ecx, %3 84 <1> %if %0 = 4 85 000000B7 BA[116A0000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 000000BC B820000000 <1> mov eax, %1 90 <1> 91 000000C1 CD40 <1> int 40h 199 ;jc short error_exit 200 ; 09/12/2023 201 000000C3 731B jnc short open_wav_file 202 203 error_exit: 204 sys _msg, trdos386_err_msg, 255, 0Eh 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 000000C5 BB[D7670000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 000000CA B9FF000000 <1> mov ecx, %3 84 <1> %if %0 = 4 85 000000CF BA0E000000 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 000000D4 B823000000 <1> mov eax, %1 90 <1> 91 000000D9 CD40 <1> int 40h 205 000000DB E919040000 jmp Exit 206 207 ; 09/12/2023 208 open_wav_file: 209 ; 23/08/2020 210 211 ; open the wav file 212 ; open existing file 213 000000E0 E85C040000 call openFile ; no error? ok. 214 000000E5 731B jnc short _3 215 216 ; file not found! 217 sys _msg, noFileErrMsg, 255, 0Fh 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 000000E7 BB[BE670000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 000000EC B9FF000000 <1> mov ecx, %3 84 <1> %if %0 = 4 85 000000F1 BA0F000000 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 000000F6 B823000000 <1> mov eax, %1 90 <1> 91 000000FB CD40 <1> int 40h 218 _z: 219 000000FD E9F7030000 jmp Exit 220 221 _3: 222 00000102 E874040000 call getSampleRate ; read the sample rate 223 ; pass it onto codec. 224 ;jc Exit 225 ; 09/12/2023 226 00000107 72F4 jc short _z 227 228 00000109 66A3[7E690000] mov [sample_rate], ax 229 0000010F 880D[7C690000] mov [stmo], cl 230 00000115 8815[7D690000] mov [bps], dl 231 232 ; 09/12/2023 233 ; 'playwav6.s (27/11/2023) 234 235 ; 26/11/2023 236 0000011B C605[036A0000]00 mov byte [fbs_shift], 0 ; 0 = stereo and 16 bit 237 00000122 FEC9 dec cl 238 00000124 7506 jnz short _gsr_1 ; stereo 239 00000126 FE05[036A0000] inc byte [fbs_shift] ; 1 = mono or 8 bit 240 _gsr_1: 241 0000012C 80FA08 cmp dl, 8 242 0000012F 7706 ja short _gsr_2 ; 16 bit samples 243 00000131 FE05[036A0000] inc byte [fbs_shift] ; 2 = mono and 8 bit 244 _gsr_2: 245 246 ; 10/06/2017 247 sys _audio, 0E00h ; get audio controller info 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 00000137 BB000E0000 <1> mov ebx, %2 82 <1> %if %0 >= 3 83 <1> mov ecx, %3 84 <1> %if %0 = 4 85 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 0000013C B820000000 <1> mov eax, %1 90 <1> 91 00000141 CD40 <1> int 40h 248 ;jc error_exit 249 ; 09/12/2023 250 00000143 7280 jc short error_exit 251 252 ; 09/12/2023 253 ;cmp ah, 2 ; ICH ? (Intel AC'97 Audio Controller) 254 ;jne _dev_not_ready 255 256 ; EAX = IRQ Number in AL 257 ; Audio Device Number in AH 258 ; EBX = DEV/VENDOR ID 259 ; (DDDDDDDDDDDDDDDDVVVVVVVVVVVVVVVV) 260 ; ECX = BUS/DEV/FN 261 ; (00000000BBBBBBBBDDDDDFFF00000000) 262 ; EDX = Base IO Addr (DX) for SB16 & VT8233 263 ; EDX = NABMBAR/NAMBAR (for AC97) 264 ; (Low word, DX = NAMBAR address) 265 266 ; 09/12/2023 267 00000145 A2[026A0000] mov [ac97_int_ln_reg], al 268 0000014A 891D[046A0000] mov [dev_vendor], ebx 269 00000150 890D[086A0000] mov [bus_dev_fn], ecx 270 ;mov [ac97_NamBar], dx 271 ;shr dx, 16 272 ;mov [ac97_NabmBar], dx 273 00000156 8915[0C6A0000] mov [ac97_NamBar], edx 274 275 ; 09/12/2023 276 0000015C E82E070000 call write_ac97_pci_dev_info 277 ; 09/12/2023 278 00000161 E8E9080000 call write_VRA_info 279 280 ; 24/08/2020 281 00000166 E859060000 call write_wav_file_info 282 283 ; 09/12/2023 284 ; ----------------------------------- 285 ; 'playwav6.s' (27/11/2023) 286 287 0000016B 803D[136A0000]01 cmp byte [VRA], 1 288 00000172 7205 jb short chk_sample_rate 289 290 playwav_48_khz: 291 ;mov dword [loadfromwavfile], loadFromFile 292 ;mov dword [buffersize], 65536 293 00000174 E9BC020000 jmp PlayNow 294 295 ; 02/02/2025 296 chk_sample_rate: 297 ; set conversion parameters 298 ; (for 8, 11.025, 16, 22.050, 24, 32 kHZ) 299 00000179 66A1[7E690000] mov ax, [sample_rate] 300 0000017F 663D80BB cmp ax, 48000 301 00000183 74EF je short playwav_48_khz 302 chk_22khz: 303 00000185 663D2256 cmp ax, 22050 304 00000189 7545 jne short chk_11khz 305 0000018B 803D[7D690000]08 cmp byte [bps], 8 306 00000192 7615 jna short chk_22khz_1 307 00000194 BB[DC160000] mov ebx, load_22khz_stereo_16_bit 308 00000199 803D[7C690000]01 cmp byte [stmo], 1 309 000001A0 751A jne short chk_22khz_2 310 000001A2 BB[4F160000] mov ebx, load_22khz_mono_16_bit 311 000001A7 EB13 jmp short chk_22khz_2 312 chk_22khz_1: 313 000001A9 BB[C8150000] mov ebx, load_22khz_stereo_8_bit 314 000001AE 803D[7C690000]01 cmp byte [stmo], 1 315 000001B5 7505 jne short chk_22khz_2 316 000001B7 BB[3F150000] mov ebx, load_22khz_mono_8_bit 317 chk_22khz_2: 318 000001BC B85A1D0000 mov eax, 7514 ; (442*17) 319 000001C1 BA25000000 mov edx, 37 320 000001C6 B911000000 mov ecx, 17 321 000001CB E9BA010000 jmp set_sizes 322 chk_11khz: 323 000001D0 663D112B cmp ax, 11025 324 000001D4 7545 jne short chk_44khz 325 000001D6 803D[7D690000]08 cmp byte [bps], 8 326 000001DD 7615 jna short chk_11khz_1 327 000001DF BB[F8180000] mov ebx, load_11khz_stereo_16_bit 328 000001E4 803D[7C690000]01 cmp byte [stmo], 1 329 000001EB 751A jne short chk_11khz_2 330 000001ED BB[7F180000] mov ebx, load_11khz_mono_16_bit 331 000001F2 EB13 jmp short chk_11khz_2 332 chk_11khz_1: 333 000001F4 BB[05180000] mov ebx, load_11khz_stereo_8_bit 334 000001F9 803D[7C690000]01 cmp byte [stmo], 1 335 00000200 7505 jne short chk_11khz_2 336 00000202 BB[8D170000] mov ebx, load_11khz_mono_8_bit 337 chk_11khz_2: 338 00000207 B8AD0E0000 mov eax, 3757 ; (221*17) 339 0000020C BA4A000000 mov edx, 74 340 00000211 B911000000 mov ecx, 17 341 00000216 E96F010000 jmp set_sizes 342 chk_44khz: 343 0000021B 663D44AC cmp ax, 44100 344 0000021F 7545 jne short chk_16khz 345 00000221 803D[7D690000]08 cmp byte [bps], 8 346 00000228 7615 jna short chk_44khz_1 347 0000022A BB[FF1A0000] mov ebx, load_44khz_stereo_16_bit 348 0000022F 803D[7C690000]01 cmp byte [stmo], 1 349 00000236 751A jne short chk_44khz_2 350 00000238 BB[861A0000] mov ebx, load_44khz_mono_16_bit 351 0000023D EB13 jmp short chk_44khz_2 352 chk_44khz_1: 353 0000023F BB[091A0000] mov ebx, load_44khz_stereo_8_bit 354 00000244 803D[7C690000]01 cmp byte [stmo], 1 355 0000024B 7505 jne short chk_44khz_2 356 0000024D BB[8D190000] mov ebx, load_44khz_mono_8_bit 357 chk_44khz_2: 358 00000252 B8D93A0000 mov eax, 15065 ; (655*23) 359 00000257 BA19000000 mov edx, 25 360 0000025C B917000000 mov ecx, 23 361 00000261 E924010000 jmp set_sizes 362 chk_16khz: 363 00000266 663D803E cmp ax, 16000 364 0000026A 7545 jne short chk_8khz 365 0000026C 803D[7D690000]08 cmp byte [bps], 8 366 00000273 7615 jna short chk_16khz_1 367 00000275 BB[7E100000] mov ebx, load_16khz_stereo_16_bit 368 0000027A 803D[7C690000]01 cmp byte [stmo], 1 369 00000281 751A jne short chk_16khz_2 370 00000283 BB[FD0F0000] mov ebx, load_16khz_mono_16_bit 371 00000288 EB13 jmp short chk_16khz_2 372 chk_16khz_1: 373 0000028A BB[430F0000] mov ebx, load_16khz_stereo_8_bit 374 0000028F 803D[7C690000]01 cmp byte [stmo], 1 375 00000296 7505 jne short chk_16khz_2 376 00000298 BB[C40E0000] mov ebx, load_16khz_mono_8_bit 377 chk_16khz_2: 378 0000029D B855150000 mov eax, 5461 379 000002A2 BA03000000 mov edx, 3 380 000002A7 B901000000 mov ecx, 1 381 000002AC E9D9000000 jmp set_sizes 382 chk_8khz: 383 000002B1 663D401F cmp ax, 8000 384 000002B5 7545 jne short chk_24khz 385 000002B7 803D[7D690000]08 cmp byte [bps], 8 386 000002BE 7615 jna short chk_8khz_1 387 000002C0 BB[790D0000] mov ebx, load_8khz_stereo_16_bit 388 000002C5 803D[7C690000]01 cmp byte [stmo], 1 389 000002CC 751A jne short chk_8khz_2 390 000002CE BB[A90C0000] mov ebx, load_8khz_mono_16_bit 391 000002D3 EB13 jmp short chk_8khz_2 392 chk_8khz_1: 393 000002D5 BB[790B0000] mov ebx, load_8khz_stereo_8_bit 394 000002DA 803D[7C690000]01 cmp byte [stmo], 1 395 000002E1 7505 jne short chk_8khz_2 396 000002E3 BB[9C0A0000] mov ebx, load_8khz_mono_8_bit 397 chk_8khz_2: 398 000002E8 B8AA0A0000 mov eax, 2730 399 000002ED BA06000000 mov edx, 6 400 000002F2 B901000000 mov ecx, 1 401 000002F7 E98E000000 jmp set_sizes 402 chk_24khz: 403 000002FC 663DC05D cmp ax, 24000 404 00000300 7542 jne short chk_32khz 405 00000302 803D[7D690000]08 cmp byte [bps], 8 406 00000309 7615 jna short chk_24khz_1 407 0000030B BB[AB120000] mov ebx, load_24khz_stereo_16_bit 408 00000310 803D[7C690000]01 cmp byte [stmo], 1 409 00000317 751A jne short chk_24khz_2 410 00000319 BB[45120000] mov ebx, load_24khz_mono_16_bit 411 0000031E EB13 jmp short chk_24khz_2 412 chk_24khz_1: 413 00000320 BB[BB110000] mov ebx, load_24khz_stereo_8_bit 414 00000325 803D[7C690000]01 cmp byte [stmo], 1 415 0000032C 7505 jne short chk_24khz_2 416 0000032E BB[54110000] mov ebx, load_24khz_mono_8_bit 417 chk_24khz_2: 418 00000333 B800200000 mov eax, 8192 419 00000338 BA02000000 mov edx, 2 420 0000033D B901000000 mov ecx, 1 421 00000342 EB46 jmp short set_sizes 422 chk_32khz: 423 00000344 663D007D cmp ax, 32000 424 ;jne short vra_needed 425 ; 02/02/2025 426 00000348 7579 jne short chk_12khz 427 0000034A 803D[7D690000]08 cmp byte [bps], 8 428 00000351 7615 jna short chk_32khz_1 429 00000353 BB[AF140000] mov ebx, load_32khz_stereo_16_bit 430 00000358 803D[7C690000]01 cmp byte [stmo], 1 431 0000035F 751A jne short chk_32khz_2 432 00000361 BB[42140000] mov ebx, load_32khz_mono_16_bit 433 00000366 EB13 jmp short chk_32khz_2 434 chk_32khz_1: 435 00000368 BB[A5130000] mov ebx, load_32khz_stereo_8_bit 436 0000036D 803D[7C690000]01 cmp byte [stmo], 1 437 00000374 7505 jne short chk_32khz_2 438 00000376 BB[32130000] mov ebx, load_32khz_mono_8_bit 439 chk_32khz_2: 440 0000037B B8AA2A0000 mov eax, 10922 441 00000380 BA03000000 mov edx, 3 442 00000385 B902000000 mov ecx, 2 443 ;jmp short set_sizes 444 set_sizes: 445 0000038A 803D[7C690000]01 cmp byte [stmo], 1 446 00000391 7402 je short ss_1 447 00000393 D1E0 shl eax, 1 448 ss_1: 449 00000395 803D[7D690000]08 cmp byte [bps], 8 450 0000039C 7602 jna short ss_2 451 ; 16 bit samples 452 0000039E D1E0 shl eax, 1 453 ss_2: 454 000003A0 A3[2D040000] mov [loadsize], eax 455 000003A5 F7E2 mul edx 456 457 ;cmp ecx, 1 458 ;je short ss_3 459 460 000003A7 F7F1 div ecx 461 ;ss_3: 462 000003A9 8A0D[036A0000] mov cl, [fbs_shift] 463 000003AF D3E0 shl eax, cl 464 ; 26/11/2023 465 ;shr eax, 1 ; buffer size is 16 bit sample count 466 467 ;;; 468 ; 04/06/2024 (8 byte alignment for BDL) 469 000003B1 83C007 add eax, 7 470 000003B4 24F8 and al, ~7 471 ;;; 472 473 000003B6 A3[31040000] mov [buffersize], eax ; buffer size in bytes 474 000003BB 891D[29040000] mov [loadfromwavfile], ebx 475 000003C1 EB72 jmp short PlayNow 476 477 ;;;; 478 ; 02/02/2025 479 chk_12khz: 480 000003C3 663DE02E cmp ax, 12000 481 000003C7 7545 jne short vra_needed 482 000003C9 803D[7D690000]08 cmp byte [bps], 8 483 000003D0 7615 jna short chk_12khz_1 484 000003D2 BB[6B1C0000] mov ebx, load_12khz_stereo_16_bit 485 000003D7 803D[7C690000]01 cmp byte [stmo], 1 486 000003DE 751A jne short chk_12khz_2 487 000003E0 BB[1C1C0000] mov ebx, load_12khz_mono_16_bit 488 000003E5 EB13 jmp short chk_12khz_2 489 chk_12khz_1: 490 000003E7 BB[C61B0000] mov ebx, load_12khz_stereo_8_bit 491 000003EC 803D[7C690000]01 cmp byte [stmo], 1 492 000003F3 7505 jne short chk_12khz_2 493 000003F5 BB[7E1B0000] mov ebx, load_12khz_mono_8_bit 494 chk_12khz_2: 495 000003FA B800100000 mov eax, 4096 496 000003FF BA04000000 mov edx, 4 497 00000404 B901000000 mov ecx, 1 498 00000409 E97CFFFFFF jmp set_sizes 499 ;;;; 500 501 vra_needed: 502 sys _msg, msg_no_vra, 255, 07h 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 0000040E BB[F7670000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 00000413 B9FF000000 <1> mov ecx, %3 84 <1> %if %0 = 4 85 00000418 BA07000000 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 0000041D B823000000 <1> mov eax, %1 90 <1> 91 00000422 CD40 <1> int 40h 503 00000424 E9D0000000 jmp Exit 504 505 ; 26/11/2023 506 ; 13/11/2023 507 loadfromwavfile: 508 00000429 [CE050000] dd loadFromFile 509 loadsize: ; read from wav file 510 0000042D 00000000 dd 0 511 buffersize: ; write to DMA buffer 512 00000431 00000100 dd 65536 ; bytes 513 514 ; ----------------------------------- 515 516 ; 23/08/2020 517 PlayNow: 518 ; 27/10/2017 519 ;mov cx, 256 520 ; 27/12/2024 521 00000435 B900010000 mov ecx, 256 522 0000043A 31DB xor ebx, ebx 523 0000043C BF[206A0000] mov edi, RowOfs 524 MakeOfs: 525 ; 29/10/2017 526 ;mov ax, 128 527 ;mul bx 528 ;mov al, ah 529 ;mov ah, 80 530 ;mul ah 531 00000441 89D8 mov eax, ebx 532 00000443 66C1E007 shl ax, 7 ; * 128 533 00000447 B050 mov al, 80 534 00000449 F6E4 mul ah 535 0000044B 66AB stosw 536 0000044D 43 inc ebx 537 0000044E E2F1 loop MakeOfs 538 539 ; 23/08/2020 540 541 ; DIRECT VGA MEMORY ACCESS 542 ; bl = 0, bh = 5 543 ; Direct access/map to VGA memory (0A0000h) 544 545 sys _video, 0500h 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 00000450 BB00050000 <1> mov ebx, %2 82 <1> %if %0 >= 3 83 <1> mov ecx, %3 84 <1> %if %0 = 4 85 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00000455 B81F000000 <1> mov eax, %1 90 <1> 91 0000045A CD40 <1> int 40h 546 0000045C 3D00000A00 cmp eax, 0A0000h 547 00000461 7405 je short _4 548 ; 09/12/2023 549 00000463 E95DFCFFFF jmp error_exit 550 551 552 ; Note: Normally IRQ 0 calls the ModPlay Polling at 18.2Hz thru 553 ; the software interrupt 1Ch. If the IRQ 0 is disabled, then 554 ; the INT 1Ch MUST BE CALLED at least MixSpeed/1024 times per 555 ; second, or the module will sound "looped". 556 ; Because we need better sync with the ModPlayer to draw the scope, 557 ; the polling is called from my routine, and then the irq 0 must be 558 ; disabled. The [DmaBuffer] points to the current buffer of 8-bit 559 ; samples played by the Sound Blaster. Note that some samples are 560 ; discarded in the next code, just for fun! 561 562 _4: 563 ;mov ax, 0013h ; Set Mode 320x200x256 564 ;int 31h 565 566 ; 21/10/2017 567 ;mov ax, 0012h ; Set Mode 640x480x16 568 ;int 31h 569 570 ; 22/10/2017 571 00000468 E8AA1D0000 call setgraphmode ; Set video mode to 640*480x16 572 573 ; 22/10/2017 574 ;call loadlbm 575 ;jc short loadlbm_err 576 577 0000046D BE[3A240000] mov esi, LOGO_ADDRESS 578 00000472 E88D1E0000 call putlbm 579 ;jnc short loadlbm_ok 580 00000477 731D jnc short _5 ; 581 582 ;mov byte [error_color], 0Eh ; Yellow 583 584 loadlbm_err: 585 ; 21/10/2017 586 ;mov ax, 0003h ; Set Text Mode 80x25x16 587 ;int 31h 588 ; 22/10/2017 589 00000479 E8B61D0000 call settextmode 590 591 sys _msg, LOGO_ERROR_MSG, 255, 0Ch 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 0000047E BB[0E240000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 00000483 B9FF000000 <1> mov ecx, %3 84 <1> %if %0 = 4 85 00000488 BA0C000000 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 0000048D B823000000 <1> mov eax, %1 90 <1> 91 00000492 CD40 <1> int 40h 592 00000494 EB63 jmp short Exit 593 594 loadlbm_ok: 595 ; 21/10/2017 596 _5: 597 ; 09/10/2017 (2*BUFFERSIZE, 64K) 598 ; 23/06/2017 599 ; Map DMA buffer to user's memory space 600 ;sys _audio, 0D00h, 2*BUFFERSIZE, DMA_Buffer 601 ; 09/12/2023 602 00000496 A1[31040000] mov eax, [buffersize] 603 0000049B D1E0 shl eax, 1 ; *2 604 ; round up to page boundary (may not be necessary) 605 0000049D 05FF0F0000 add eax, 4095 606 000004A2 2500F0FFFF and eax, ~4095 607 000004A7 A3[24740000] mov [DMA_buffer_size], eax 608 ;;sys _audio, 0D00h, 131072, DMA_Buffer 609 ;sys _audio, 0D00h, [DMA_buffer_size], DMA_Buffer 610 ; 27/12/2024 611 sys _audio, 0D00h, eax, DMA_Buffer 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 000004AC BB000D0000 <1> mov ebx, %2 82 <1> %if %0 >= 3 83 000004B1 89C1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 000004B3 BA[00000200] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 000004B8 B820000000 <1> mov eax, %1 90 <1> 91 000004BD CD40 <1> int 40h 612 ;jc error_exit 613 614 ; 23/08/2020 615 616 ; position file pointer to start in actual wav data 617 ; MUCH improvement should really be done here to check if sample size is 618 ; supported, make sure there are 2 channels, etc. 619 ; 620 ;mov ah, 42h 621 ;mov al, 0 ; from start of file 622 ;mov bx, [FileHandle] 623 ;xor cx, cx 624 ;mov dx, 44 ; jump past .wav/riff header 625 ;int 21h 626 627 ; 05/02/2025 628 ;sys _seek, [FileHandle], 44, 0 629 630 ; play the .wav file. Most of the good stuff is in here. 631 632 000004BF E8BD010000 call PlayWav 633 634 ; close the .wav file and exit. 635 636 StopPlaying: 637 ; Stop Playing 638 sys _audio, 0700h 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 000004C4 BB00070000 <1> mov ebx, %2 82 <1> %if %0 >= 3 83 <1> mov ecx, %3 84 <1> %if %0 = 4 85 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 000004C9 B820000000 <1> mov eax, %1 90 <1> 91 000004CE CD40 <1> int 40h 639 ; Cancel callback service (for user) 640 sys _audio, 0900h 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 000004D0 BB00090000 <1> mov ebx, %2 82 <1> %if %0 >= 3 83 <1> mov ecx, %3 84 <1> %if %0 = 4 85 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 000004D5 B820000000 <1> mov eax, %1 90 <1> 91 000004DA CD40 <1> int 40h 641 ; Deallocate Audio Buffer (for user) 642 sys _audio, 0A00h 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 000004DC BB000A0000 <1> mov ebx, %2 82 <1> %if %0 >= 3 83 <1> mov ecx, %3 84 <1> %if %0 = 4 85 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 000004E1 B820000000 <1> mov eax, %1 90 <1> 91 000004E6 CD40 <1> int 40h 643 ; Disable Audio Device 644 sys _audio, 0C00h 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 000004E8 BB000C0000 <1> mov ebx, %2 82 <1> %if %0 >= 3 83 <1> mov ecx, %3 84 <1> %if %0 = 4 85 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 000004ED B820000000 <1> mov eax, %1 90 <1> 91 000004F2 CD40 <1> int 40h 645 646 ; 23/08/2020 647 000004F4 E83B1D0000 call settextmode 648 Exit: 649 000004F9 E85C000000 call closeFile 650 651 sys _exit ; Bye! 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 <1> mov ebx, %2 82 <1> %if %0 >= 3 83 <1> mov ecx, %3 84 <1> %if %0 = 4 85 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 000004FE B801000000 <1> mov eax, %1 90 <1> 91 00000503 CD40 <1> int 40h 652 here: 653 00000505 EBFE jmp short here 654 655 pmsg_usage: 656 sys _msg, msg_usage, 255, 0Bh 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 00000507 BB[D8660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 0000050C B9FF000000 <1> mov ecx, %3 84 <1> %if %0 = 4 85 00000511 BA0B000000 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00000516 B823000000 <1> mov eax, %1 90 <1> 91 0000051B CD40 <1> int 40h 657 0000051D EBDA jmp short Exit 658 659 DetectAC97: 660 ; 09/12/2023 661 ; Detect (BH=1) AC'97 (BL=2) Audio Device 662 sys _audio, 0102h 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 0000051F BB02010000 <1> mov ebx, %2 82 <1> %if %0 >= 3 83 <1> mov ecx, %3 84 <1> %if %0 = 4 85 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00000524 B820000000 <1> mov eax, %1 90 <1> 91 00000529 CD40 <1> int 40h 663 0000052B 7213 jc short DetectAC97_retn 664 665 ; Get AC'97 Codec info 666 ; (Function 14, sub function 1) 667 sys _audio, 0E01h 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 0000052D BB010E0000 <1> mov ebx, %2 82 <1> %if %0 >= 3 83 <1> mov ecx, %3 84 <1> %if %0 = 4 85 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00000532 B820000000 <1> mov eax, %1 90 <1> 91 00000537 CD40 <1> int 40h 668 ; Save Variable Rate Audio support bit 669 00000539 2401 and al, 1 670 0000053B A2[136A0000] mov [VRA], al 671 672 DetectAC97_retn: 673 00000540 C3 retn 674 675 ; 23/08/2020 676 677 ;open or create file 678 ; 679 ;input: ds:dx-->filename (asciiz) 680 ; al=file Mode (create or open) 681 ;output: none cs:[FileHandle] filled 682 ; 683 openFile: 684 ;mov ah, 3Bh ; start with a mode 685 ;add ah, al ; add in create or open mode 686 ;xor cx, cx 687 ;int 21h 688 ;jc short _of1 689 ;;mov [cs:FileHandle], ax 690 691 sys _open, wav_file_name, 0 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 00000541 BB[B0690000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 00000546 B900000000 <1> mov ecx, %3 84 <1> %if %0 = 4 85 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 0000054B B805000000 <1> mov eax, %1 90 <1> 91 00000550 CD40 <1> int 40h 692 00000552 7205 jc short _of1 693 694 00000554 A3[D3660000] mov [FileHandle], eax 695 _of1: 696 00000559 C3 retn 697 698 ; close the currently open file 699 ; input: none, uses cs:[FileHandle] 700 closeFile: 701 0000055A 833D[D3660000]FF cmp dword [FileHandle], -1 702 00000561 7417 je short _cf1 703 ;mov bx, [FileHandle] 704 ;mov ax, 3E00h 705 ;int 21h ;close file 706 707 sys _close, [FileHandle] 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 00000563 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 <1> mov ecx, %3 84 <1> %if %0 = 4 85 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00000569 B806000000 <1> mov eax, %1 90 <1> 91 0000056E CD40 <1> int 40h 708 00000570 C705[D3660000]FFFF- mov dword [FileHandle], -1 708 00000578 FFFF 709 _cf1: 710 0000057A C3 retn 711 712 getSampleRate: 713 714 ; reads the sample rate from the .wav file. 715 ; entry: none - assumes file is already open 716 ; exit: ax = sample rate (11025, 22050, 44100, 48000) 717 ; cx = number of channels (mono=1, stereo=2) 718 ; dx = bits per sample (8, 16) 719 720 0000057B 53 push ebx 721 722 ;mov ah, 42h 723 ;mov al, 0 ; from start of file 724 ;mov bx, [FileHandle] 725 ;xor cx, cx 726 ;mov dx, 08h ; "WAVE" 727 ;int 21h 728 729 ; 05/02/2025 730 ;sys _seek, [FileHandle], 8, 0 731 732 ;mov dx, smpRBuff 733 ;mov cx, 28 ; 28 bytes 734 ;mov ah, 3fh 735 ;int 21h 736 737 ;sys _read, [FileHandle], smpRBuff, 28 738 ; 05/02/2025 739 sys _read, [FileHandle], smpRBuff, 44 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 0000057C 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 00000582 B9[84690000] <1> mov ecx, %3 84 <1> %if %0 = 4 85 00000587 BA2C000000 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 0000058C B803000000 <1> mov eax, %1 90 <1> 91 00000591 CD40 <1> int 40h 740 741 ; 05/02/2025 742 ;cmp dword [smpRBuff], 'WAVE' 743 00000593 813D[8C690000]5741- cmp dword [smpRBuff+8], 'WAVE' 743 0000059B 5645 744 0000059D 752C jne short gsr_stc 745 746 ;cmp word [smpRBuff+12], 1 ; Offset 20, must be 1 (= PCM) 747 0000059F 66833D[98690000]01 cmp word [smpRBuff+20], 1 748 000005A7 7522 jne short gsr_stc 749 750 ; 05/02/2025 751 ; (Open MPT creates wav files with a new type header, 752 ; this program can not use the new type 753 ; because of 'data' offset is not at DATA_SubchunkID.) 754 ; ((GoldWave creates common type wav file.)) 755 000005A9 813D[A8690000]6461- cmp dword [smpRBuff+36], 'data' 755 000005B1 7461 756 000005B3 7516 jne short gsr_stc 757 758 ;mov cx, [smpRBuff+14] ; return num of channels in CX 759 000005B5 668B0D[9A690000] mov cx, [smpRBuff+22] 760 ;mov ax, [smpRBuff+16] ; return sample rate in AX 761 000005BC 66A1[9C690000] mov ax, [smpRBuff+24] 762 ;mov dx, [smpRBuff+26] ; return bits per sample value in DX 763 000005C2 668B15[A6690000] mov dx, [smpRBuff+34] 764 gsr_retn: 765 000005C9 5B pop ebx 766 000005CA C3 retn 767 gsr_stc: 768 000005CB F9 stc 769 000005CC EBFB jmp short gsr_retn 770 771 ;============================================================================= 772 773 ; 09/12/2023 774 %if 0 775 ; 'playwav6.s' (27/11/2023) 776 777 audio_int_handler: 778 ; 18/08/2020 (14/10/2020, 'wavplay2.s') 779 780 ;mov byte [srb], 1 ; interrupt (or signal response byte) 781 782 ;cmp byte [cbs_busy], 1 783 ;jnb short _callback_bsy_retn 784 785 ;mov byte [cbs_busy], 1 786 787 mov al, [half_buff] 788 789 cmp al, 1 790 jb short _callback_retn 791 792 ; 18/08/2020 793 mov byte [srb], 1 794 795 xor byte [half_buff], 3 ; 2->1, 1->2 796 797 add al, '0' 798 tL0: ; 26/11/2023 799 mov ah, 4Eh 800 mov ebx, 0B8000h ; video display page address 801 mov [ebx], ax ; show playing buffer (1, 2) 802 _callback_retn: 803 ;mov byte [cbs_busy], 0 804 _callback_bsy_retn: 805 sys _rele ; return from callback service 806 ; we must not come here ! 807 sys _exit 808 809 %endif 810 811 ;============================================================================= 812 813 ; 09/12/2023 814 ; 'playwav6.s' (27/11/2023) 815 816 loadFromFile: 817 ; 26/11/2023 818 000005CE F605[106A0000]01 test byte [flags], ENDOFFILE ; have we already read the 819 ; last of the file? 820 000005D5 7402 jz short lff_0 ; no 821 000005D7 F9 stc 822 000005D8 C3 retn 823 lff_0: 824 ; 13/06/2017 825 ;mov edx, BUFFERSIZE 826 ; 26/11/2023 827 000005D9 BF[00800000] mov edi, audio_buffer 828 000005DE 8B15[31040000] mov edx, [buffersize] ; bytes 829 000005E4 8A0D[036A0000] mov cl, [fbs_shift] 830 000005EA 20C9 and cl, cl 831 000005EC 7409 jz short lff_1 ; stereo, 16 bit 832 833 ; fbs_shift = 834 ; 2 for mono and 8 bit sample (multiplier = 4) 835 ; 1 for mono or 8 bit sample (multiplier = 2) 836 000005EE D3EA shr edx, cl 837 ;inc edx 838 839 000005F0 BE[00000400] mov esi, temp_buffer 840 000005F5 EB02 jmp short lff_2 841 lff_1: 842 ;mov esi, audio_buffer 843 000005F7 89FE mov esi, edi ; audio_buffer 844 lff_2: 845 ; 17/03/2017 846 ; esi = buffer address 847 ; edx = buffer size 848 849 ; 26/11/2023 850 ; load file into memory 851 sys _read, [FileHandle], esi 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 000005F9 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 000005FF 89F1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00000601 B803000000 <1> mov eax, %1 90 <1> 91 00000606 CD40 <1> int 40h 852 ; 14/12/2024 853 00000608 8B0D[31040000] mov ecx, [buffersize] 854 ;jc short padfill ; error ! 855 ; 14/12/2024 856 0000060E 7255 jc short lff_10 857 858 00000610 21C0 and eax, eax 859 00000612 7453 jz short padfill 860 lff_3: 861 ; 26/11/2023 862 00000614 8A1D[036A0000] mov bl, [fbs_shift] 863 0000061A 20DB and bl, bl 864 0000061C 7456 jz short lff_11 865 866 ; 14/12/2024 867 ;sub ecx, eax 868 ;mov ebp, ecx 869 ; 14/12/2024 870 0000061E 29C2 sub edx, eax 871 872 ;mov esi, temp_buffer 873 ;mov edi, audio_buffer 874 00000620 89C1 mov ecx, eax ; byte count 875 876 00000622 803D[7D690000]08 cmp byte [bps], 8 ; bits per sample (8 or 16) 877 00000629 751E jne short lff_6 ; 16 bit samples 878 ; 8 bit samples 879 0000062B FECB dec bl ; shift count, 1 = stereo, 2 = mono 880 0000062D 740E jz short lff_5 ; 8 bit, stereo 881 lff_4: 882 ; mono & 8 bit 883 0000062F AC lodsb 884 00000630 2C80 sub al, 80h ; 08/11/2023 885 00000632 C1E008 shl eax, 8 ; convert 8 bit sample to 16 bit sample 886 00000635 66AB stosw ; left channel 887 00000637 66AB stosw ; right channel 888 00000639 E2F4 loop lff_4 889 0000063B EB16 jmp short lff_8 890 lff_5: 891 ; stereo & 8 bit 892 0000063D AC lodsb 893 0000063E 2C80 sub al, 80h ; 08/11/2023 894 00000640 C1E008 shl eax, 8 ; convert 8 bit sample to 16 bit sample 895 00000643 66AB stosw 896 00000645 E2F6 loop lff_5 897 00000647 EB0A jmp short lff_8 898 lff_6: 899 00000649 D1E9 shr ecx, 1 ; word count 900 lff_7: 901 0000064B 66AD lodsw 902 0000064D 66AB stosw ; left channel 903 0000064F 66AB stosw ; right channel 904 00000651 E2F8 loop lff_7 905 lff_8: 906 ; 27/11/2023 907 00000653 F8 clc 908 ; 14/12/2024 909 ;mov ecx, ebp 910 ;jecxz endLFF_retn 911 00000654 09D2 or edx, edx 912 00000656 741B jz short endLFF_retn 913 914 ; 14/12/2024 915 00000658 B9[00800000] mov ecx, audio_buffer 916 0000065D 030D[31040000] add ecx, [buffersize] 917 00000663 29F9 sub ecx, edi 918 919 ; 14/12/2024 920 lff_10: 921 00000665 31C0 xor eax, eax ; silence 922 padfill: 923 00000667 D1E9 shr ecx, 1 924 00000669 F366AB rep stosw 925 lff_9: 926 0000066C 800D[106A0000]01 or byte [flags], ENDOFFILE ; end of file flag 927 endLFF_retn: 928 00000673 C3 retn 929 930 lff_11: 931 ; 16 bit stereo 932 ; ecx = buffer size 933 ; eax = read count 934 00000674 29C1 sub ecx, eax 935 00000676 76FB jna short endLFF_retn 936 00000678 01C7 add edi, eax ; audio_buffer + eax 937 0000067A EBE9 jmp short lff_10 ; padfill 938 939 error_exit_2: 940 ; 26/11/2023 - temporary 941 ;sys _msg, test_2, 255, 0Ch 942 0000067C E944FAFFFF jmp error_exit 943 944 ;============================================================================= 945 ; 946 ;============================================================================= 947 948 PlayWav: 949 ; 09/12/2023 950 ;; 23/08/2020 951 ;; load 32768 bytes into audio buffer 952 ;;mov edi, audio_buffer 953 ;;mov edx, BUFFERSIZE 954 ;call loadFromFile 955 ; 09/12/2023 956 00000681 FF15[29040000] call dword [loadfromwavfile] 957 00000687 72F3 jc short error_exit_2 958 959 ;mov byte [half_buff], 1 ; (DMA) Buffer 1 960 961 ; 18/08/2020 (27/07/2020, 'wavplay2.s') 962 00000689 F605[106A0000]01 test byte [flags], ENDOFFILE ; end of file 963 00000690 7512 jnz short _6 ; yes 964 ; bypass filling dma half buffer 2 965 966 ; bh = 16 : update (current, first) dma half buffer 967 ; bl = 0 : then switch to the next (second) half buffer 968 sys _audio, 1000h 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 00000692 BB00100000 <1> mov ebx, %2 82 <1> %if %0 >= 3 83 <1> mov ecx, %3 84 <1> %if %0 = 4 85 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00000697 B820000000 <1> mov eax, %1 90 <1> 91 0000069C CD40 <1> int 40h 969 970 ; 27/07/2020 971 ; [audio_flag] = 1 (in TRDOS 386 kernel) 972 973 ; audio_buffer must be filled again after above system call 974 ; (Because audio interrupt will be generated by VT8237R 975 ; at the end of the first half of dma buffer.. so, 976 ; the second half must be ready. 'sound_play' will use it.) 977 978 ; 09/12/2023 979 ;; 13/10/2017 980 ;;mov edi, audio_buffer 981 ;;mov edx, BUFFERSIZE 982 ;call loadFromFile 983 ; 09/12/2023 984 0000069E FF15[29040000] call dword [loadfromwavfile] 985 ;jc short p_return 986 987 _6: 988 ; Set Master Volume Level 989 sys _audio, 0B00h, 1D1Dh 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 000006A4 BB000B0000 <1> mov ebx, %2 82 <1> %if %0 >= 3 83 000006A9 B91D1D0000 <1> mov ecx, %3 84 <1> %if %0 = 4 85 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 000006AE B820000000 <1> mov eax, %1 90 <1> 91 000006B3 CD40 <1> int 40h 990 ; 24/06/2017 991 ;mov byte [volume_level], 1Dh 992 000006B5 880D[126A0000] mov [volume_level], cl 993 994 ;mov byte [srb], 0 995 996 ; Start to play 997 000006BB A0[7D690000] mov al, [bps] 998 000006C0 C0E804 shr al, 4 ; 8 -> 0, 16 -> 1 999 000006C3 D0E0 shl al, 1 ; 16 -> 2, 8 -> 0 1000 000006C5 8A1D[7C690000] mov bl, [stmo] 1001 000006CB FECB dec bl 1002 000006CD 08C3 or bl, al 1003 000006CF 668B0D[7E690000] mov cx, [sample_rate] 1004 000006D6 B704 mov bh, 4 ; start to play 1005 sys _audio 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 <1> mov ebx, %2 82 <1> %if %0 >= 3 83 <1> mov ecx, %3 84 <1> %if %0 = 4 85 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 000006D8 B820000000 <1> mov eax, %1 90 <1> 91 000006DD CD40 <1> int 40h 1006 1007 ; 27/07/2020 1008 ; Here.. 1009 ; If byte [flags] <> ENDOFFILE ... 1010 ; user's audio_buffer has been copied to dma half buffer 2 1011 1012 ; [audio_flag] = 0 (in TRDOS 386 kernel) 1013 1014 ; audio_buffer must be filled again after above system call 1015 ; (Because, audio interrupt will be generated by VT8237R 1016 ; at the end of the first half of dma buffer.. so, 1017 ; the 2nd half of dma buffer is ready but the 1st half 1018 ; must be filled again.) 1019 1020 ; 14/12/2024 1021 %if 0 1022 ; 18/08/2020 1023 test byte [flags], ENDOFFILE ; end of file 1024 jnz short p_loop ; yes 1025 1026 ; 18/08/2020 1027 ; load 32768 bytes into audio buffer 1028 ;; (for the second half of DMA buffer) 1029 ; 27/11/2023 1030 ; 20/05/2017 1031 ;mov edi, audio_buffer 1032 ;mov edx, BUFFERSIZE 1033 ; 26/11/2023 1034 ;mov edx, [buffersize] 1035 ;call loadFromFile 1036 ; 26/11/2023 1037 call dword [loadfromwavfile] 1038 ;jc short p_return 1039 ;mov byte [half_buff], 2 ; (DMA) Buffer 2 1040 %endif 1041 1042 ; we need to wait for 'SRB' (audio interrupt) 1043 ; (we can not return from 'PlayWav' here 1044 ; even if we have got an error from file reading) 1045 ; ((!!current audio data must be played!!)) 1046 1047 ;mov ebx, 0B8000h ; video display page address 1048 ;mov ah, 4Eh 1049 ;add al, [half_buffer] 1050 ;mov [ebx], ax ; show playing buffer (1, 2) 1051 1052 ;; load 32768 bytes into audio buffer 1053 ;; (for the second half of DMA buffer) 1054 ;; 20/05/2017 1055 ;mov edi, audio_buffer 1056 ;mov edx, BUFFERSIZE 1057 ;call loadFromFile 1058 ;jc short p_return 1059 ;mov byte [half_buff], 2 ; (DMA) Buffer 2 1060 1061 ; 23/08/2020 1062 1063 ; 27/10/2017 1064 1065 ; 03/08/2020 1066 ;jmp short modp_gs ; 23/06/2017 1067 1068 ; 27/12/2024 1069 ; 24/08/2020 1070 ;inc byte [counter] 1071 p_loop: 1072 000006DF 803D[116A0000]00 cmp byte [srb], 0 1073 000006E6 761D jna short q_loop 1074 1075 000006E8 C605[116A0000]00 mov byte [srb], 0 1076 modp_gs: 1077 ; 24/08/2020 1078 ;mov edi, audio_buffer 1079 ;mov edx, BUFFERSIZE 1080 ; 09/12/2023 1081 ;call loadFromFile 1082 ;mov edx, [buffersize] 1083 000006EF FF15[29040000] call dword [loadfromwavfile] 1084 000006F5 723D jc short q_return 1085 1086 ; 14/12/2024 1087 ;;; 1088 ; bh = 16 : update (current, first) dma half buffer 1089 ; bl = 0 : then switch to the other half buffer 1090 sys _audio, 1000h 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 000006F7 BB00100000 <1> mov ebx, %2 82 <1> %if %0 >= 3 83 <1> mov ecx, %3 84 <1> %if %0 = 4 85 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 000006FC B820000000 <1> mov eax, %1 90 <1> 91 00000701 CD40 <1> int 40h 1091 ;;; 1092 1093 ; 23/08/2020 1094 00000703 EB62 jmp short r_loop 1095 q_loop: 1096 ; 27/12/2024 1097 ; 24/08/2020 1098 ;test byte [counter], 63 1099 ;jnz short r_loop 1100 k_loop: 1101 00000705 B401 mov ah, 1 ; any key pressed? 1102 00000707 CD32 int 32h ; no, Loop. 1103 00000709 745C jz short r_loop 1104 1105 0000070B B400 mov ah, 0 ; flush key buffer... 1106 0000070D CD32 int 32h 1107 1108 ; 19/10/2017 (modplay6.s) 1109 0000070F 3C20 cmp al, 20h 1110 00000711 740E je short change_pan 1111 ; 09/10/2017 (playmod5.s) 1112 00000713 3C2B cmp al, '+' ; increase sound volume 1113 00000715 741E je short inc_volume_level 1114 00000717 3C2D cmp al, '-' 1115 00000719 743D je short dec_volume_level 1116 1117 ; 19/10/2017 (modplay6.s) 1118 0000071B 24DF and al, 0DFh 1119 0000071D 3C50 cmp al, 'P' 1120 0000071F 7513 jne short q_return 1121 1122 change_pan: 1123 ; 19/10/2017 (modplay6.s) 1124 00000721 8A0D[146A0000] mov cl, [pan_shift] 1125 00000727 FEC1 inc cl 1126 00000729 80E103 and cl, 3 1127 0000072C 880D[146A0000] mov [pan_shift], cl 1128 00000732 EB33 jmp short r_loop 1129 1130 q_return: 1131 00000734 C3 retn 1132 1133 ; 09/10/2017 (playmod5.s) 1134 ; 24/06/2017 (wavplay2.s) 1135 inc_volume_level: 1136 00000735 8A0D[126A0000] mov cl, [volume_level] 1137 0000073B 80F91F cmp cl, 1Fh ; 31 1138 ;jnb short r_loop 1139 ; 09/12/2023 1140 0000073E 73C5 jnb short k_loop 1141 00000740 FEC1 inc cl 1142 change_volume_level: 1143 00000742 880D[126A0000] mov [volume_level], cl 1144 00000748 88CD mov ch, cl 1145 ; Set Master Volume Level 1146 sys _audio, 0B00h 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 0000074A BB000B0000 <1> mov ebx, %2 82 <1> %if %0 >= 3 83 <1> mov ecx, %3 84 <1> %if %0 = 4 85 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 0000074F B820000000 <1> mov eax, %1 90 <1> 91 00000754 CD40 <1> int 40h 1147 00000756 EB0F jmp short r_loop 1148 dec_volume_level: 1149 00000758 8A0D[126A0000] mov cl, [volume_level] 1150 0000075E 80F901 cmp cl, 1 ; 1 1151 ;jna short r_loop 1152 ; 09/12/2023 1153 00000761 76A2 jna short k_loop 1154 00000763 FEC9 dec cl 1155 00000765 EBDB jmp short change_volume_level 1156 1157 r_loop: 1158 ; 27/12/2024 1159 ; 24/08/2020 1160 ;inc byte [counter] 1161 ;; 09/12/2023 1162 ;;jnz short q_loop 1163 ;;test byte [counter], 0Fh 1164 ;jnz short q_loop 1165 _10: 1166 ; 09/12/2023 1167 00000767 F605[036A0000]FF test byte [fbs_shift], 0FFh 1168 0000076E 7405 jz short _9 1169 1170 ; 23/08/2020 1171 ;test byte [stmo], 2 1172 ;;jz p_loop 1173 ;; 09/12/2023 1174 ;jz short _8 1175 ;cmp byte [bps], 16 1176 ;;jne p_loop 1177 ;; 09/12/2023 1178 ;je short _9 1179 _8: 1180 00000770 E96AFFFFFF jmp p_loop 1181 _9: 1182 ;;; 1183 ; 27/12/2024 1184 sys _time, 4 ; get timer ticks (18.2 ticks/second) 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 00000775 BB04000000 <1> mov ebx, %2 82 <1> %if %0 >= 3 83 <1> mov ecx, %3 84 <1> %if %0 = 4 85 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 0000077A B80D000000 <1> mov eax, %1 90 <1> 91 0000077F CD40 <1> int 40h 1185 00000781 3B05[20740000] cmp eax, [timerticks] 1186 00000787 74E7 je short _8 1187 00000789 A3[20740000] mov [timerticks], eax 1188 ;;; 1189 1190 ; 27/10/2017 1191 ; Get Current DMA buffer Pointer 1192 ; 23/06/2017 ('modplay6.s') 1193 ; bh = 15, get current pointer (DMA buffer offset) 1194 ; bl = 0, for PCM OUT 1195 ; ecx = 0 1196 ; 1197 sys _audio, 0F00h, 0 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 0000078E BB000F0000 <1> mov ebx, %2 82 <1> %if %0 >= 3 83 00000793 B900000000 <1> mov ecx, %3 84 <1> %if %0 = 4 85 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00000798 B820000000 <1> mov eax, %1 90 <1> 91 0000079D CD40 <1> int 40h 1198 1199 ; 28/10/2017 1200 0000079F 24FC and al, 0FCh ; dword alignment (stereo, 16 bit) 1201 ; 23/06/2017 1202 000007A1 BE[00000200] mov esi, DMA_Buffer 1203 000007A6 01C6 add esi, eax ; add offset value 1204 1205 ; 24/06/2017 1206 ;mov ecx, DMA_Buffer + (65536 - (256*4)) 1207 ; 09/12/2023 1208 000007A8 8B0D[24740000] mov ecx, [DMA_buffer_size] 1209 000007AE 81C1[00FC0100] add ecx, DMA_Buffer - (256*4) 1210 1211 000007B4 39CE cmp esi, ecx 1212 000007B6 7602 jna short _7 1213 000007B8 89CE mov esi, ecx 1214 _7: 1215 ; 23/10/2017 ('tmodplay.s') 1216 000007BA E87C1A0000 call drawscopes 1217 1218 000007BF E91BFFFFFF jmp p_loop 1219 1220 ;============================================================================= 1221 ; 1222 ;============================================================================= 1223 1224 ;dword2str: 1225 ; ; 13/11/2016 - Erdogan Tan 1226 ; ; eax = dword value 1227 ; ; 1228 ; call dwordtohex 1229 ; mov [dword_str], edx 1230 ; mov [dword_str+4], eax 1231 ; mov si, dword_str 1232 ; retn 1233 1234 ; 05/03/2017 (TRDOS 386) 1235 ; trdos386.s (unix386.s) - 10/05/2015 1236 ; Convert binary number to hexadecimal string 1237 1238 ;bytetohex: 1239 ; ; INPUT -> 1240 ; ; AL = byte (binary number) 1241 ; ; OUTPUT -> 1242 ; ; AX = hexadecimal string 1243 ; ; 1244 ; push ebx 1245 ; movzx ebx, al 1246 ; shr bl, 4 1247 ; mov bl, [ebx+hex_chars] 1248 ; xchg bl, al 1249 ; and bl, 0Fh 1250 ; mov ah, [ebx+hex_chars] 1251 ; pop ebx 1252 ; retn 1253 1254 ;wordtohex: 1255 ; ; INPUT -> 1256 ; ; AX = word (binary number) 1257 ; ; OUTPUT -> 1258 ; ; EAX = hexadecimal string 1259 ; ; 1260 ; push ebx 1261 ; xor ebx, ebx 1262 ; xchg ah, al 1263 ; push eax 1264 ; mov bl, ah 1265 ; shr bl, 4 1266 ; mov al, [ebx+hex_chars] 1267 ; mov bl, ah 1268 ; and bl, 0Fh 1269 ; mov ah, [ebx+hex_chars] 1270 ; shl eax, 16 1271 ; pop eax 1272 ; pop ebx 1273 ; jmp short bytetohex 1274 1275 ;dwordtohex: 1276 ; ; INPUT -> 1277 ; ; EAX = dword (binary number) 1278 ; ; OUTPUT -> 1279 ; ; EDX:EAX = hexadecimal string 1280 ; ; 1281 ; push eax 1282 ; shr eax, 16 1283 ; call wordtohex 1284 ; mov edx, eax 1285 ; pop eax 1286 ; call wordtohex 1287 ; retn 1288 1289 ; 09/12/2023 1290 ; 'playwav6.s' (27/11/2023) 1291 1292 write_wav_file_info: 1293 ; 01/05/2017 1294 sys _msg, msgWavFileName, 255, 0Fh 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 000007C4 BB[D7680000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 000007C9 B9FF000000 <1> mov ecx, %3 84 <1> %if %0 = 4 85 000007CE BA0F000000 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 000007D3 B823000000 <1> mov eax, %1 90 <1> 91 000007D8 CD40 <1> int 40h 1295 sys _msg, wav_file_name, 255, 0Fh 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 000007DA BB[B0690000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 000007DF B9FF000000 <1> mov ecx, %3 84 <1> %if %0 = 4 85 000007E4 BA0F000000 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 000007E9 B823000000 <1> mov eax, %1 90 <1> 91 000007EE CD40 <1> int 40h 1296 1297 write_sample_rate: 1298 ; 01/05/2017 1299 000007F0 66A1[7E690000] mov ax, [sample_rate] 1300 ; ax = sample rate (hertz) 1301 000007F6 31D2 xor edx, edx 1302 000007F8 66B90A00 mov cx, 10 1303 000007FC 66F7F1 div cx 1304 000007FF 0015[FC680000] add [msgHertz+4], dl 1305 00000805 29D2 sub edx, edx 1306 00000807 66F7F1 div cx 1307 0000080A 0015[FB680000] add [msgHertz+3], dl 1308 00000810 29D2 sub edx, edx 1309 00000812 66F7F1 div cx 1310 00000815 0015[FA680000] add [msgHertz+2], dl 1311 0000081B 29D2 sub edx, edx 1312 0000081D 66F7F1 div cx 1313 00000820 0015[F9680000] add [msgHertz+1], dl 1314 00000826 0005[F8680000] add [msgHertz], al 1315 1316 sys _msg, msgSampleRate, 255, 0Fh 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 0000082C BB[E9680000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 00000831 B9FF000000 <1> mov ecx, %3 84 <1> %if %0 = 4 85 00000836 BA0F000000 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 0000083B B823000000 <1> mov eax, %1 90 <1> 91 00000840 CD40 <1> int 40h 1317 1318 00000842 BE[13690000] mov esi, msg16Bits 1319 00000847 803D[7D690000]10 cmp byte [bps], 16 1320 0000084E 7405 je short wsr_1 1321 00000850 BE[03690000] mov esi, msg8Bits 1322 wsr_1: 1323 sys _msg, esi, 255, 0Fh 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 00000855 89F3 <1> mov ebx, %2 82 <1> %if %0 >= 3 83 00000857 B9FF000000 <1> mov ecx, %3 84 <1> %if %0 = 4 85 0000085C BA0F000000 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00000861 B823000000 <1> mov eax, %1 90 <1> 91 00000866 CD40 <1> int 40h 1324 1325 00000868 BE[0C690000] mov esi, msgMono 1326 0000086D 803D[7C690000]01 cmp byte [stmo], 1 1327 00000874 7405 je short wsr_2 1328 00000876 BE[1D690000] mov esi, msgStereo 1329 wsr_2: 1330 sys _msg, esi, 255, 0Fh 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 0000087B 89F3 <1> mov ebx, %2 82 <1> %if %0 >= 3 83 0000087D B9FF000000 <1> mov ecx, %3 84 <1> %if %0 = 4 85 00000882 BA0F000000 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00000887 B823000000 <1> mov eax, %1 90 <1> 91 0000088C CD40 <1> int 40h 1331 0000088E C3 retn 1332 1333 write_ac97_pci_dev_info: 1334 ; 27/12/2024 1335 ; 06/06/2017 1336 ; 03/06/2017 1337 ; BUS/DEV/FN 1338 ; 00000000BBBBBBBBDDDDDFFF00000000 1339 ; DEV/VENDOR 1340 ; DDDDDDDDDDDDDDDDVVVVVVVVVVVVVVVV 1341 1342 1343 ;mov esi, [dev_vendor] 1344 ; 27/12/2024 1345 0000088F A1[046A0000] mov eax, [dev_vendor] 1346 00000894 0FB6D8 movzx ebx, al 1347 00000897 88DA mov dl, bl 1348 00000899 80E30F and bl, 0Fh 1349 0000089C 8A83[30680000] mov al, [ebx+hex_chars] 1350 000008A2 A2[75680000] mov [msgVendorId+3], al 1351 000008A7 88D3 mov bl, dl 1352 000008A9 C0EB04 shr bl, 4 1353 000008AC 8A83[30680000] mov al, [ebx+hex_chars] 1354 000008B2 A2[74680000] mov [msgVendorId+2], al 1355 000008B7 88E3 mov bl, ah 1356 000008B9 88DA mov dl, bl 1357 000008BB 80E30F and bl, 0Fh 1358 000008BE 8A83[30680000] mov al, [ebx+hex_chars] 1359 000008C4 A2[73680000] mov [msgVendorId+1], al 1360 000008C9 88D3 mov bl, dl 1361 000008CB C0EB04 shr bl, 4 1362 000008CE 8A83[30680000] mov al, [ebx+hex_chars] 1363 000008D4 A2[72680000] mov [msgVendorId], al 1364 ;shr esi, 16 1365 ; 27/12/2024 1366 000008D9 C1E810 shr eax, 16 1367 000008DC 88C3 mov bl, al 1368 000008DE 88DA mov dl, bl 1369 000008E0 80E30F and bl, 0Fh 1370 000008E3 8A83[30680000] mov al, [ebx+hex_chars] 1371 000008E9 A2[86680000] mov [msgDevId+3], al 1372 000008EE 88D3 mov bl, dl 1373 000008F0 C0EB04 shr bl, 4 1374 000008F3 8A83[30680000] mov al, [ebx+hex_chars] 1375 000008F9 A2[85680000] mov [msgDevId+2], al 1376 000008FE 88E3 mov bl, ah 1377 00000900 88DA mov dl, bl 1378 00000902 80E30F and bl, 0Fh 1379 00000905 8A83[30680000] mov al, [ebx+hex_chars] 1380 0000090B A2[84680000] mov [msgDevId+1], al 1381 00000910 88D3 mov bl, dl 1382 00000912 C0EB04 shr bl, 4 1383 00000915 8A83[30680000] mov al, [ebx+hex_chars] 1384 0000091B A2[83680000] mov [msgDevId], al 1385 1386 ;mov esi, [bus_dev_fn] 1387 ;shr esi, 8 1388 ;mov ax, si 1389 ; 27/12/2024 1390 00000920 A1[086A0000] mov eax, [bus_dev_fn] 1391 00000925 C1E808 shr eax, 8 1392 00000928 88C3 mov bl, al 1393 0000092A 88DA mov dl, bl 1394 0000092C 80E307 and bl, 7 ; bit 0,1,2 1395 0000092F 8A83[30680000] mov al, [ebx+hex_chars] 1396 00000935 A2[AA680000] mov [msgFncNo+1], al 1397 0000093A 88D3 mov bl, dl 1398 0000093C C0EB03 shr bl, 3 1399 0000093F 88DA mov dl, bl 1400 00000941 80E30F and bl, 0Fh 1401 00000944 8A83[30680000] mov al, [ebx+hex_chars] 1402 0000094A A2[9C680000] mov [msgDevNo+1], al 1403 0000094F 88D3 mov bl, dl 1404 00000951 C0EB04 shr bl, 4 1405 00000954 8A83[30680000] mov al, [ebx+hex_chars] 1406 0000095A A2[9B680000] mov [msgDevNo], al 1407 0000095F 88E3 mov bl, ah 1408 00000961 88DA mov dl, bl 1409 00000963 80E30F and bl, 0Fh 1410 00000966 8A83[30680000] mov al, [ebx+hex_chars] 1411 0000096C A2[90680000] mov [msgBusNo+1], al 1412 00000971 88D3 mov bl, dl 1413 00000973 C0EB04 shr bl, 4 1414 00000976 8A83[30680000] mov al, [ebx+hex_chars] 1415 0000097C A2[8F680000] mov [msgBusNo], al 1416 1417 00000981 66A1[0C6A0000] mov ax, [ac97_NamBar] 1418 00000987 88C3 mov bl, al 1419 00000989 88DA mov dl, bl 1420 0000098B 80E30F and bl, 0Fh 1421 0000098E 8A83[30680000] mov al, [ebx+hex_chars] 1422 00000994 A2[B9680000] mov [msgNamBar+3], al 1423 00000999 88D3 mov bl, dl 1424 0000099B C0EB04 shr bl, 4 1425 0000099E 8A83[30680000] mov al, [ebx+hex_chars] 1426 000009A4 A2[B8680000] mov [msgNamBar+2], al 1427 000009A9 88E3 mov bl, ah 1428 000009AB 88DA mov dl, bl 1429 000009AD 80E30F and bl, 0Fh 1430 000009B0 8A83[30680000] mov al, [ebx+hex_chars] 1431 000009B6 A2[B7680000] mov [msgNamBar+1], al 1432 000009BB 88D3 mov bl, dl 1433 000009BD C0EB04 shr bl, 4 1434 000009C0 8A83[30680000] mov al, [ebx+hex_chars] 1435 000009C6 A2[B6680000] mov [msgNamBar], al 1436 1437 000009CB 66A1[0E6A0000] mov ax, [ac97_NabmBar] 1438 000009D1 88C3 mov bl, al 1439 000009D3 88DA mov dl, bl 1440 000009D5 80E30F and bl, 0Fh 1441 000009D8 8A83[30680000] mov al, [ebx+hex_chars] 1442 000009DE A2[C9680000] mov [msgNabmBar+3], al 1443 000009E3 88D3 mov bl, dl 1444 000009E5 C0EB04 shr bl, 4 1445 000009E8 8A83[30680000] mov al, [ebx+hex_chars] 1446 000009EE A2[C8680000] mov [msgNabmBar+2], al 1447 000009F3 88E3 mov bl, ah 1448 000009F5 88DA mov dl, bl 1449 000009F7 80E30F and bl, 0Fh 1450 000009FA 8A83[30680000] mov al, [ebx+hex_chars] 1451 00000A00 A2[C7680000] mov [msgNabmBar+1], al 1452 00000A05 88D3 mov bl, dl 1453 00000A07 C0EB04 shr bl, 4 1454 00000A0A 8A83[30680000] mov al, [ebx+hex_chars] 1455 00000A10 A2[C6680000] mov [msgNabmBar], al 1456 1457 00000A15 30E4 xor ah, ah 1458 00000A17 A0[026A0000] mov al, [ac97_int_ln_reg] 1459 00000A1C B10A mov cl, 10 1460 00000A1E F6F1 div cl 1461 00000A20 660105[D2680000] add [msgIRQ], ax 1462 00000A27 20C0 and al, al 1463 00000A29 750D jnz short _w_ac97imsg_ 1464 00000A2B A0[D3680000] mov al, [msgIRQ+1] 1465 00000A30 B420 mov ah, ' ' 1466 00000A32 66A3[D2680000] mov [msgIRQ], ax 1467 _w_ac97imsg_: 1468 sys _msg, msgAC97Info, 255, 07h 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 00000A38 BB[41680000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 00000A3D B9FF000000 <1> mov ecx, %3 84 <1> %if %0 = 4 85 00000A42 BA07000000 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00000A47 B823000000 <1> mov eax, %1 90 <1> 91 00000A4C CD40 <1> int 40h 1469 1470 00000A4E C3 retn 1471 1472 write_VRA_info: 1473 ; 25/11/2023 1474 sys _msg, msgVRAheader, 255, 07h 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 00000A4F BB[26690000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 00000A54 B9FF000000 <1> mov ecx, %3 84 <1> %if %0 = 4 85 00000A59 BA07000000 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00000A5E B823000000 <1> mov eax, %1 90 <1> 91 00000A63 CD40 <1> int 40h 1475 00000A65 803D[136A0000]00 cmp byte [VRA], 0 1476 00000A6C 7617 jna short _w_VRAi_no 1477 _w_VRAi_yes: 1478 sys _msg, msgVRAyes, 255, 07h 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 00000A6E BB[34690000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 00000A73 B9FF000000 <1> mov ecx, %3 84 <1> %if %0 = 4 85 00000A78 BA07000000 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00000A7D B823000000 <1> mov eax, %1 90 <1> 91 00000A82 CD40 <1> int 40h 1479 00000A84 C3 retn 1480 _w_VRAi_no: 1481 sys _msg, msgVRAno, 255, 07h 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 00000A85 BB[3A690000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 00000A8A B9FF000000 <1> mov ecx, %3 84 <1> %if %0 = 4 85 00000A8F BA07000000 <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00000A94 B823000000 <1> mov eax, %1 90 <1> 91 00000A99 CD40 <1> int 40h 1482 00000A9B C3 retn 1483 1484 ; 09/12/2023 1485 ; -------------------------------------------------------- 1486 ; 'playwav6.s' (27/11/2023) 1487 1488 ; 02/02/2025 - playwav8.s - twavply2.s - playwav6.s 1489 ; 08/12/2024 1490 ; 09/12/2023 - twavply2.s 1491 ; 26/11/2023 1492 ; 25/11/2023 - playwav6.s (32 bit registers, TRDOS 386 adaption) 1493 ; 15/11/2023 - PLAYWAV5.COM, ich_wav5.asm 1494 ; 14/11/2023 1495 ; 13/11/2023 - Erdogan Tan - (VRA, sample rate conversion) 1496 ; -------------------------------------------------------- 1497 1498 ;;Note: At the end of every buffer load, 1499 ;; during buffer switch/swap, there will be discontinuity 1500 ;; between the last converted sample and the 1st sample 1501 ;; of the next buffer. 1502 ;; (like as a dot noises vaguely between normal sound samples) 1503 ;; -To avoid this defect, the 1st sample of 1504 ;; the next buffer may be read from the wav file but 1505 ;; the file pointer would need to be set to 1 sample back 1506 ;; again via seek system call. Time comsumption problem! - 1507 ;; 1508 ;; Erdogan Tan - 15/11/2023 1509 ;; 1510 ;; ((If entire wav data would be loaded at once.. conversion 1511 ;; defect/noise would disappear.. but for DOS, to keep 1512 ;; 64KB buffer limit is important also it is important 1513 ;; for running under 1MB barrier without HIMEM.SYS or DPMI. 1514 ;; I have tested this program by using 2-30MB wav files.)) 1515 ;; 1516 ;; Test Computer: ASUS desktop/mainboard, M2N4-SLI, 2010. 1517 ;; AMD Athlon 64 X2 2200 MHZ CPU. 1518 ;; NFORCE4 (CK804) AC97 audio hardware. 1519 ;; Realtek ALC850 codec. 1520 ;; Retro DOS v4.2 (MSDOS 6.22) operating system. 1521 1522 load_8khz_mono_8_bit: 1523 ; 02/02/2025 1524 ; 15/11/2023 1525 ; 14/11/2023 1526 ; 13/11/2023 1527 00000A9C F605[106A0000]01 test byte [flags], ENDOFFILE ; have we already read the 1528 ; last of the file? 1529 00000AA3 7402 jz short lff8m_0 ; no 1530 00000AA5 F9 stc 1531 00000AA6 C3 retn 1532 1533 lff8m_0: 1534 00000AA7 BE[00000400] mov esi, temp_buffer ; temporary buffer for wav data 1535 ;mov edx, [loadsize] 1536 1537 ; esi = buffer address 1538 ;; edx = buffer size 1539 1540 ; load file into memory 1541 sys _read, [FileHandle], esi, [loadsize] 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 00000AAC 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 00000AB2 89F1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 00000AB4 8B15[2D040000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00000ABA B803000000 <1> mov eax, %1 90 <1> 91 00000ABF CD40 <1> int 40h 1542 00000AC1 7305 jnc short lff8m_6 1543 00000AC3 E9AF000000 jmp lff8m_5 ; error ! 1544 1545 lff8m_6: 1546 00000AC8 BF[00800000] mov edi, audio_buffer 1547 00000ACD 21C0 and eax, eax 1548 00000ACF 0F8499000000 jz lff8_eof 1549 1550 00000AD5 89C1 mov ecx, eax ; byte count 1551 lff8m_1: 1552 00000AD7 AC lodsb 1553 00000AD8 A2[0E220000] mov [previous_val], al 1554 00000ADD 2C80 sub al, 80h 1555 00000ADF 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 1556 00000AE3 66AB stosw ; original sample (left channel) 1557 00000AE5 66AB stosw ; original sample (right channel) 1558 ; 02/02/2025 1559 ;xor eax, eax 1560 00000AE7 8A06 mov al, [esi] 1561 00000AE9 49 dec ecx 1562 00000AEA 7502 jnz short lff8m_2 1563 00000AEC B080 mov al, 80h 1564 lff8m_2: 1565 ;mov [next_val], ax 1566 00000AEE 88C7 mov bh, al ; [next_val] 1567 00000AF0 8A25[0E220000] mov ah, [previous_val] 1568 00000AF6 00E0 add al, ah ; [previous_val] 1569 00000AF8 D0D8 rcr al, 1 1570 00000AFA 88C2 mov dl, al ; this is interpolated middle (3th) sample 1571 00000AFC 00E0 add al, ah ; [previous_val] 1572 00000AFE D0D8 rcr al, 1 1573 00000B00 88C3 mov bl, al ; this is temporary interpolation value 1574 00000B02 00E0 add al, ah ; [previous_val] 1575 00000B04 D0D8 rcr al, 1 1576 00000B06 2C80 sub al, 80h 1577 00000B08 66C1E008 shl ax, 8 1578 00000B0C 66AB stosw ; this is 1st interpolated sample (L) 1579 00000B0E 66AB stosw ; this is 1st interpolated sample (R) 1580 00000B10 88D8 mov al, bl 1581 00000B12 00D0 add al, dl 1582 00000B14 D0D8 rcr al, 1 1583 00000B16 2C80 sub al, 80h 1584 00000B18 66C1E008 shl ax, 8 1585 00000B1C 66AB stosw ; this is 2nd interpolated sample (L) 1586 00000B1E 66AB stosw ; this is 2nd interpolated sample (R) 1587 00000B20 88D0 mov al, dl 1588 00000B22 2C80 sub al, 80h 1589 00000B24 66C1E008 shl ax, 8 1590 00000B28 66AB stosw ; this is middle (3th) interpolated sample (L) 1591 00000B2A 66AB stosw ; this is middle (3th) interpolated sample (R) 1592 ;mov al, [next_val] 1593 00000B2C 88F8 mov al, bh 1594 00000B2E 00D0 add al, dl 1595 00000B30 D0D8 rcr al, 1 1596 00000B32 88C3 mov bl, al ; this is temporary interpolation value 1597 00000B34 00D0 add al, dl 1598 00000B36 D0D8 rcr al, 1 1599 00000B38 2C80 sub al, 80h 1600 00000B3A 66C1E008 shl ax, 8 1601 00000B3E 66AB stosw ; this is 4th interpolated sample (L) 1602 00000B40 66AB stosw ; this is 4th interpolated sample (R) 1603 ;mov al, [next_val] 1604 00000B42 88F8 mov al, bh 1605 00000B44 00D8 add al, bl 1606 00000B46 D0D8 rcr al, 1 1607 00000B48 2C80 sub al, 80h 1608 00000B4A 66C1E008 shl ax, 8 1609 00000B4E 66AB stosw ; this is 5th interpolated sample (L) 1610 00000B50 66AB stosw ; this is 5th interpolated sample (R) 1611 ; 8 kHZ mono to 48 kHZ stereo conversion of the sample is OK 1612 00000B52 09C9 or ecx, ecx 1613 00000B54 7581 jnz short lff8m_1 1614 1615 ; -------------- 1616 1617 lff8s_3: 1618 lff8m_3: 1619 lff8s2_3: 1620 lff8m2_3: 1621 lff16s_3: 1622 lff16m_3: 1623 lff16s2_3: 1624 lff16m2_3: 1625 lff24_3: 1626 lff32_3: 1627 lff44_3: 1628 lff22_3: 1629 lff11_3: 1630 lff12_3: ; 02/02/2025 1631 ; 08/12/2024 (BugFix) 1632 ; 01/06/2024 (BugFix) 1633 00000B56 8B0D[31040000] mov ecx, [buffersize] ; 16 bit (48 kHZ, stereo) sample size 1634 ;shl ecx, 1 ; byte count ; Bug ! 1635 ; 08/12/2024 1636 00000B5C 81C1[00800000] add ecx, audio_buffer 1637 00000B62 29F9 sub ecx, edi 1638 00000B64 7607 jna short lff8m_4 1639 ;inc ecx 1640 00000B66 C1E902 shr ecx, 2 1641 00000B69 31C0 xor eax, eax ; fill (remain part of) buffer with zeros 1642 00000B6B F3AB rep stosd 1643 lff8m_4: 1644 ; 01/06/2024 (BugFix) 1645 ; cf=1 ; Bug ! 1646 ; 08/12/2024 1647 ;clc 1648 00000B6D C3 retn 1649 1650 lff8_eof: 1651 lff16_eof: 1652 lff24_eof: 1653 lff32_eof: 1654 lff44_eof: 1655 lff22_eof: 1656 lff11_eof: 1657 lff12_eof: ; 02/02/2025 1658 ; 15/11/2023 1659 00000B6E C605[106A0000]01 mov byte [flags], ENDOFFILE 1660 00000B75 EBDF jmp short lff8m_3 1661 1662 lff8s_5: 1663 lff8m_5: 1664 lff8s2_5: 1665 lff8m2_5: 1666 lff16s_5: 1667 lff16m_5: 1668 lff16s2_5: 1669 lff16m2_5: 1670 lff24_5: 1671 lff32_5: 1672 lff44_5: 1673 lff22_5: 1674 lff11_5: 1675 lff12_5: ; 02/02/2025 1676 ; 09/12/2023 1677 ;mov al, '!' ; error 1678 ;call tL0 1679 1680 ;jmp short lff8m_3 1681 ; 15/11/2023 1682 00000B77 EBF5 jmp lff8_eof 1683 1684 ; -------------- 1685 1686 load_8khz_stereo_8_bit: 1687 ; 02/02/2025 1688 ; 15/11/2023 1689 ; 14/11/2023 1690 ; 13/11/2023 1691 00000B79 F605[106A0000]01 test byte [flags], ENDOFFILE ; have we already read the 1692 ; last of the file? 1693 00000B80 7402 jz short lff8s_0 ; no 1694 00000B82 F9 stc 1695 00000B83 C3 retn 1696 1697 lff8s_0: 1698 00000B84 BE[00000400] mov esi, temp_buffer ; temporary buffer for wav data 1699 ;mov edx, [loadsize] 1700 1701 ; esi = buffer address 1702 ;; edx = buffer size 1703 1704 ; load file into memory 1705 sys _read, [FileHandle], esi, [loadsize] 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 00000B89 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 00000B8F 89F1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 00000B91 8B15[2D040000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00000B97 B803000000 <1> mov eax, %1 90 <1> 91 00000B9C CD40 <1> int 40h 1706 00000B9E 72D7 jc short lff8s_5 ; error ! 1707 1708 00000BA0 BF[00800000] mov edi, audio_buffer 1709 1710 00000BA5 D1E8 shr eax, 1 1711 00000BA7 74C5 jz short lff8_eof 1712 1713 00000BA9 89C1 mov ecx, eax ; word count 1714 lff8s_1: 1715 00000BAB AC lodsb 1716 00000BAC A2[0E220000] mov [previous_val_l], al 1717 00000BB1 2C80 sub al, 80h 1718 00000BB3 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 1719 00000BB7 66AB stosw ; original sample (L) 1720 00000BB9 AC lodsb 1721 00000BBA A2[10220000] mov [previous_val_r], al 1722 00000BBF 2C80 sub al, 80h 1723 00000BC1 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 1724 00000BC5 66AB stosw ; original sample (R) 1725 1726 ;xor eax, eax 1727 ; 02/02/2025 1728 00000BC7 668B06 mov ax, [esi] 1729 00000BCA 49 dec ecx 1730 00000BCB 7504 jnz short lff8s_2 1731 ; convert 8 bit sample to 16 bit sample 1732 00000BCD 66B88080 mov ax, 8080h 1733 lff8s_2: 1734 00000BD1 A2[12220000] mov [next_val_l], al 1735 00000BD6 8825[14220000] mov [next_val_r], ah 1736 00000BDC 8A25[0E220000] mov ah, [previous_val_l] 1737 00000BE2 00E0 add al, ah 1738 00000BE4 D0D8 rcr al, 1 1739 00000BE6 88C2 mov dl, al ; this is interpolated middle (3th) sample (L) 1740 00000BE8 00E0 add al, ah 1741 00000BEA D0D8 rcr al, 1 1742 00000BEC 88C3 mov bl, al ; this is temporary interpolation value (L) 1743 00000BEE 00E0 add al, ah 1744 00000BF0 D0D8 rcr al, 1 1745 00000BF2 2C80 sub al, 80h 1746 00000BF4 66C1E008 shl ax, 8 1747 00000BF8 66AB stosw ; this is 1st interpolated sample (L) 1748 00000BFA A0[14220000] mov al, [next_val_r] 1749 00000BFF 8A25[10220000] mov ah, [previous_val_r] 1750 00000C05 00E0 add al, ah 1751 00000C07 D0D8 rcr al, 1 1752 00000C09 88C6 mov dh, al ; this is interpolated middle (3th) sample (R) 1753 00000C0B 00E0 add al, ah 1754 00000C0D D0D8 rcr al, 1 1755 00000C0F 88C7 mov bh, al ; this is temporary interpolation value (R) 1756 00000C11 00E0 add al, ah 1757 00000C13 D0D8 rcr al, 1 1758 00000C15 2C80 sub al, 80h 1759 00000C17 66C1E008 shl ax, 8 1760 00000C1B 66AB stosw ; this is 1st interpolated sample (R) 1761 00000C1D 88D8 mov al, bl 1762 00000C1F 00D0 add al, dl 1763 00000C21 D0D8 rcr al, 1 1764 00000C23 2C80 sub al, 80h 1765 00000C25 66C1E008 shl ax, 8 1766 00000C29 66AB stosw ; this is 2nd interpolated sample (L) 1767 00000C2B 88F8 mov al, bh 1768 00000C2D 00F0 add al, dh 1769 00000C2F D0D8 rcr al, 1 1770 00000C31 2C80 sub al, 80h 1771 00000C33 66C1E008 shl ax, 8 1772 00000C37 66AB stosw ; this is 2nd interpolated sample (R) 1773 00000C39 88D0 mov al, dl 1774 00000C3B 2C80 sub al, 80h 1775 00000C3D 66C1E008 shl ax, 8 1776 00000C41 66AB stosw ; this is middle (3th) interpolated sample (L) 1777 00000C43 88F0 mov al, dh 1778 00000C45 2C80 sub al, 80h 1779 00000C47 66C1E008 shl ax, 8 1780 00000C4B 66AB stosw ; this is middle (3th) interpolated sample (R) 1781 00000C4D A0[12220000] mov al, [next_val_l] 1782 00000C52 00D0 add al, dl 1783 00000C54 D0D8 rcr al, 1 1784 00000C56 88C3 mov bl, al ; this is temporary interpolation value (L) 1785 00000C58 00D0 add al, dl 1786 00000C5A D0D8 rcr al, 1 1787 00000C5C 2C80 sub al, 80h 1788 00000C5E 66C1E008 shl ax, 8 1789 00000C62 66AB stosw ; this is 4th interpolated sample (L) 1790 00000C64 A0[14220000] mov al, [next_val_r] 1791 00000C69 00F0 add al, dh 1792 00000C6B D0D8 rcr al, 1 1793 00000C6D 88C7 mov bh, al ; this is temporary interpolation value (R) 1794 00000C6F 00F0 add al, dh 1795 00000C71 D0D8 rcr al, 1 1796 00000C73 2C80 sub al, 80h 1797 00000C75 66C1E008 shl ax, 8 1798 00000C79 66AB stosw ; this is 4th interpolated sample (R) 1799 00000C7B A0[12220000] mov al, [next_val_l] 1800 00000C80 00D8 add al, bl 1801 00000C82 D0D8 rcr al, 1 1802 00000C84 2C80 sub al, 80h 1803 00000C86 66C1E008 shl ax, 8 1804 00000C8A 66AB stosw ; this is 5th interpolated sample (L) 1805 00000C8C A0[14220000] mov al, [next_val_r] 1806 00000C91 00F8 add al, bh 1807 00000C93 D0D8 rcr al, 1 1808 00000C95 2C80 sub al, 80h 1809 00000C97 66C1E008 shl ax, 8 1810 00000C9B 66AB stosw ; this is 5th interpolated sample (R) 1811 ; 8 kHZ stereo to 48 kHZ stereo conversion of the sample is OK 1812 00000C9D E305 jecxz lff8s_6 1813 00000C9F E907FFFFFF jmp lff8s_1 1814 lff8s_6: 1815 00000CA4 E9ADFEFFFF jmp lff8s_3 1816 1817 load_8khz_mono_16_bit: 1818 ; 02/02/2025 1819 ; 13/11/2023 1820 00000CA9 F605[106A0000]01 test byte [flags], ENDOFFILE ; have we already read the 1821 ; last of the file? 1822 00000CB0 7402 jz short lff8m2_0 ; no 1823 00000CB2 F9 stc 1824 00000CB3 C3 retn 1825 1826 lff8m2_0: 1827 00000CB4 BE[00000400] mov esi, temp_buffer ; temporary buffer for wav data 1828 ;mov edx, [loadsize] 1829 1830 ; esi = buffer address 1831 ;; edx = buffer size 1832 1833 ; load file into memory 1834 sys _read, [FileHandle], esi, [loadsize] 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 00000CB9 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 00000CBF 89F1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 00000CC1 8B15[2D040000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00000CC7 B803000000 <1> mov eax, %1 90 <1> 91 00000CCC CD40 <1> int 40h 1835 00000CCE 0F82A0000000 jc lff8m2_7 ; error ! 1836 1837 00000CD4 BF[00800000] mov edi, audio_buffer 1838 1839 00000CD9 D1E8 shr eax, 1 1840 00000CDB 7505 jnz short lff8m2_8 1841 00000CDD E98CFEFFFF jmp lff8_eof 1842 1843 lff8m2_8: 1844 00000CE2 89C1 mov ecx, eax ; word count 1845 lff8m2_1: 1846 00000CE4 66AD lodsw 1847 00000CE6 66AB stosw ; original sample (left channel) 1848 00000CE8 66AB stosw ; original sample (right channel) 1849 00000CEA 80C480 add ah, 80h ; convert sound level to 0-65535 format 1850 00000CED 66A3[0E220000] mov [previous_val], ax 1851 ; 02/02/2025 1852 00000CF3 668B06 mov ax, [esi] 1853 00000CF6 49 dec ecx 1854 00000CF7 7502 jnz short lff8m2_2 1855 00000CF9 31C0 xor eax, eax 1856 lff8m2_2: 1857 00000CFB 80C480 add ah, 80h ; convert sound level to 0-65535 format 1858 00000CFE 89C5 mov ebp, eax ; [next_val] 1859 00000D00 660305[0E220000] add ax, [previous_val] 1860 00000D07 66D1D8 rcr ax, 1 1861 00000D0A 89C2 mov edx, eax ; this is interpolated middle (3th) sample 1862 00000D0C 660305[0E220000] add ax, [previous_val] 1863 00000D13 66D1D8 rcr ax, 1 ; this is temporary interpolation value 1864 00000D16 89C3 mov ebx, eax 1865 00000D18 660305[0E220000] add ax, [previous_val] 1866 00000D1F 66D1D8 rcr ax, 1 1867 00000D22 80EC80 sub ah, 80h ; -32768 to +32767 format again 1868 00000D25 66AB stosw ; this is 1st interpolated sample (L) 1869 00000D27 66AB stosw ; this is 1st interpolated sample (R) 1870 00000D29 89D8 mov eax, ebx 1871 00000D2B 6601D0 add ax, dx 1872 00000D2E 66D1D8 rcr ax, 1 1873 00000D31 80EC80 sub ah, 80h 1874 00000D34 66AB stosw ; this is 2nd interpolated sample (L) 1875 00000D36 66AB stosw ; this is 2nd interpolated sample (R) 1876 00000D38 89D0 mov eax, edx 1877 00000D3A 80EC80 sub ah, 80h ; -32768 to +32767 format again 1878 00000D3D 66AB stosw ; this is middle (3th) interpolated sample (L) 1879 00000D3F 66AB stosw ; this is middle (3th) interpolated sample (R) 1880 00000D41 89E8 mov eax, ebp 1881 00000D43 6601D0 add ax, dx 1882 00000D46 66D1D8 rcr ax, 1 1883 00000D49 89C3 mov ebx, eax ; this is temporary interpolation value 1884 00000D4B 6601D0 add ax, dx 1885 00000D4E 66D1D8 rcr ax, 1 1886 00000D51 80EC80 sub ah, 80h 1887 00000D54 66AB stosw ; this is 4th interpolated sample (L) 1888 00000D56 66AB stosw ; this is 4th interpolated sample (R) 1889 00000D58 89E8 mov eax, ebp 1890 00000D5A 6601D8 add ax, bx 1891 00000D5D 66D1D8 rcr ax, 1 1892 00000D60 80EC80 sub ah, 80h ; -32768 to +32767 format again 1893 00000D63 66AB stosw ; this is 5th interpolated sample (L) 1894 00000D65 66AB stosw ; this is 5th interpolated sample (R) 1895 ; 8 kHZ mono to 48 kHZ stereo conversion of the sample is OK 1896 00000D67 09C9 or ecx, ecx 1897 00000D69 0F8575FFFFFF jnz lff8m2_1 1898 00000D6F E9E2FDFFFF jmp lff8m2_3 1899 1900 lff8m2_7: 1901 lff8s2_7: 1902 00000D74 E9FEFDFFFF jmp lff8m2_5 ; error 1903 1904 load_8khz_stereo_16_bit: 1905 ; 02/02/2025 1906 ; 16/11/2023 1907 ; 15/11/2023 1908 ; 13/11/2023 1909 00000D79 F605[106A0000]01 test byte [flags], ENDOFFILE ; have we already read the 1910 ; last of the file? 1911 00000D80 7402 jz short lff8s2_0 ; no 1912 00000D82 F9 stc 1913 00000D83 C3 retn 1914 1915 lff8s2_0: 1916 00000D84 BE[00000400] mov esi, temp_buffer ; temporary buffer for wav data 1917 ;mov edx, [loadsize] 1918 1919 ; esi = buffer address 1920 ;; edx = buffer size 1921 1922 ; load file into memory 1923 sys _read, [FileHandle], esi, [loadsize] 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 00000D89 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 00000D8F 89F1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 00000D91 8B15[2D040000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00000D97 B803000000 <1> mov eax, %1 90 <1> 91 00000D9C CD40 <1> int 40h 1924 00000D9E 72D4 jc short lff8s2_7 ; error ! 1925 1926 00000DA0 BF[00800000] mov edi, audio_buffer 1927 1928 00000DA5 C1E802 shr eax, 2 1929 00000DA8 7505 jnz short lff8s2_8 1930 00000DAA E9BFFDFFFF jmp lff8_eof 1931 1932 lff8s2_8: 1933 00000DAF 89C1 mov ecx, eax ; dword count 1934 lff8s2_1: 1935 00000DB1 66AD lodsw 1936 00000DB3 66AB stosw ; original sample (L) 1937 ; 15/11/2023 1938 00000DB5 80C480 add ah, 80h ; convert sound level to 0-65535 format 1939 00000DB8 66A3[0E220000] mov [previous_val_l], ax 1940 00000DBE 66AD lodsw 1941 00000DC0 66AB stosw ; original sample (R) 1942 00000DC2 80C480 add ah, 80h ; convert sound level to 0-65535 format 1943 00000DC5 66A3[10220000] mov [previous_val_r], ax 1944 ; 02/02/2025 1945 00000DCB 668B06 mov ax, [esi] 1946 00000DCE 668B5602 mov dx, [esi+2] 1947 ; 16/11/2023 1948 00000DD2 49 dec ecx 1949 00000DD3 7504 jnz short lff8s2_2 1950 00000DD5 31D2 xor edx, edx 1951 00000DD7 31C0 xor eax, eax 1952 lff8s2_2: 1953 00000DD9 80C480 add ah, 80h ; convert sound level to 0-65535 format 1954 00000DDC 66A3[12220000] mov [next_val_l], ax 1955 00000DE2 80C680 add dh, 80h ; convert sound level to 0-65535 format 1956 00000DE5 668915[14220000] mov [next_val_r], dx 1957 00000DEC 660305[0E220000] add ax, [previous_val_l] 1958 00000DF3 66D1D8 rcr ax, 1 1959 00000DF6 89C2 mov edx, eax ; this is interpolated middle (3th) sample (L) 1960 00000DF8 660305[0E220000] add ax, [previous_val_l] 1961 00000DFF 66D1D8 rcr ax, 1 1962 00000E02 89C3 mov ebx, eax ; this is temporary interpolation value (L) 1963 00000E04 660305[0E220000] add ax, [previous_val_l] 1964 00000E0B 66D1D8 rcr ax, 1 1965 00000E0E 80EC80 sub ah, 80h ; -32768 to +32767 format again 1966 00000E11 66AB stosw ; this is 1st interpolated sample (L) 1967 00000E13 66A1[14220000] mov ax, [next_val_r] 1968 00000E19 660305[10220000] add ax, [previous_val_r] 1969 00000E20 66D1D8 rcr ax, 1 1970 00000E23 89C5 mov ebp, eax ; this is interpolated middle (3th) sample (R) 1971 00000E25 660305[10220000] add ax, [previous_val_r] 1972 00000E2C 66D1D8 rcr ax, 1 1973 00000E2F 50 push eax ; * ; this is temporary interpolation value (R) 1974 00000E30 660305[10220000] add ax, [previous_val_r] 1975 00000E37 66D1D8 rcr ax, 1 1976 00000E3A 80EC80 sub ah, 80h 1977 00000E3D 66AB stosw ; this is 1st interpolated sample (R) 1978 00000E3F 89D8 mov eax, ebx 1979 00000E41 6601D0 add ax, dx 1980 00000E44 66D1D8 rcr ax, 1 1981 00000E47 80EC80 sub ah, 80h ; -32768 to +32767 format again 1982 00000E4A 66AB stosw ; this is 2nd interpolated sample (L) 1983 00000E4C 58 pop eax ; * 1984 00000E4D 6601E8 add ax, bp 1985 00000E50 66D1D8 rcr ax, 1 1986 00000E53 80EC80 sub ah, 80h 1987 00000E56 66AB stosw ; this is 2nd interpolated sample (R) 1988 00000E58 89D0 mov eax, edx 1989 00000E5A 80EC80 sub ah, 80h 1990 00000E5D 66AB stosw ; this is middle (3th) interpolated sample (L) 1991 00000E5F 89E8 mov eax, ebp 1992 00000E61 80EC80 sub ah, 80h ; -32768 to +32767 format again 1993 00000E64 66AB stosw ; this is middle (3th) interpolated sample (R) 1994 00000E66 66A1[12220000] mov ax, [next_val_l] 1995 00000E6C 6601D0 add ax, dx 1996 00000E6F 66D1D8 rcr ax, 1 1997 00000E72 89C3 mov ebx, eax ; this is temporary interpolation value (L) 1998 00000E74 6601D0 add ax, dx 1999 00000E77 66D1D8 rcr ax, 1 2000 00000E7A 80EC80 sub ah, 80h 2001 00000E7D 66AB stosw ; this is 4th interpolated sample (L) 2002 00000E7F 66A1[14220000] mov ax, [next_val_r] 2003 00000E85 6601E8 add ax, bp 2004 00000E88 66D1D8 rcr ax, 1 2005 00000E8B 50 push eax ; ** ; this is temporary interpolation value (R) 2006 00000E8C 6601E8 add ax, bp 2007 00000E8F 66D1D8 rcr ax, 1 2008 00000E92 80EC80 sub ah, 80h 2009 00000E95 66AB stosw ; this is 4th interpolated sample (R) 2010 00000E97 66A1[12220000] mov ax, [next_val_l] 2011 00000E9D 6601D8 add ax, bx 2012 00000EA0 66D1D8 rcr ax, 1 2013 00000EA3 80EC80 sub ah, 80h ; -32768 to +32767 format again 2014 00000EA6 66AB stosw ; this is 5th interpolated sample (L) 2015 00000EA8 58 pop eax ; ** 2016 00000EA9 660305[14220000] add ax, [next_val_r] 2017 00000EB0 66D1D8 rcr ax, 1 2018 00000EB3 80EC80 sub ah, 80h 2019 00000EB6 66AB stosw ; this is 5th interpolated sample (R) 2020 ; 8 kHZ stereo to 48 kHZ stereo conversion of the sample is OK 2021 00000EB8 E305 jecxz lff8_s2_9 2022 00000EBA E9F2FEFFFF jmp lff8s2_1 2023 lff8_s2_9: 2024 00000EBF E992FCFFFF jmp lff8s2_3 2025 2026 ; ..................... 2027 2028 load_16khz_mono_8_bit: 2029 ; 02/02/2025 2030 ; 14/11/2023 2031 ; 13/11/2023 2032 00000EC4 F605[106A0000]01 test byte [flags], ENDOFFILE ; have we already read the 2033 ; last of the file? 2034 00000ECB 7402 jz short lff16m_0 ; no 2035 00000ECD F9 stc 2036 00000ECE C3 retn 2037 2038 lff16m_0: 2039 00000ECF BE[00000400] mov esi, temp_buffer ; temporary buffer for wav data 2040 ;mov edx, [loadsize] 2041 2042 ; esi = buffer address 2043 ;; edx = buffer size 2044 2045 ; load file into memory 2046 sys _read, [FileHandle], esi, [loadsize] 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 00000ED4 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 00000EDA 89F1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 00000EDC 8B15[2D040000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00000EE2 B803000000 <1> mov eax, %1 90 <1> 91 00000EE7 CD40 <1> int 40h 2047 00000EE9 7253 jc short lff16m_7 ; error ! 2048 2049 00000EEB BF[00800000] mov edi, audio_buffer 2050 2051 00000EF0 21C0 and eax, eax 2052 00000EF2 7505 jnz short lff16m_8 2053 00000EF4 E975FCFFFF jmp lff16_eof 2054 2055 lff16m_8: 2056 00000EF9 89C1 mov ecx, eax ; byte count 2057 lff16m_1: 2058 00000EFB AC lodsb 2059 ;mov [previous_val], al 2060 00000EFC 88C3 mov bl, al 2061 00000EFE 2C80 sub al, 80h 2062 00000F00 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 2063 00000F04 66AB stosw ; original sample (left channel) 2064 00000F06 66AB stosw ; original sample (right channel) 2065 ;xor eax, eax 2066 ; 02/02/2025 2067 00000F08 8A06 mov al, [esi] 2068 00000F0A 49 dec ecx 2069 00000F0B 7502 jnz short lff16m_2 2070 ; 14/11/2023 2071 00000F0D B080 mov al, 80h 2072 lff16m_2: 2073 ;mov [next_val], al 2074 00000F0F 88C7 mov bh, al 2075 ;add al, [previous_val] 2076 00000F11 00D8 add al, bl 2077 00000F13 D0D8 rcr al, 1 2078 00000F15 88C2 mov dl, al ; this is interpolated middle (temp) sample 2079 ;add al, [previous_val] 2080 00000F17 00D8 add al, bl 2081 00000F19 D0D8 rcr al, 1 2082 00000F1B 2C80 sub al, 80h 2083 00000F1D 66C1E008 shl ax, 8 2084 00000F21 66AB stosw ; this is 1st interpolated sample (L) 2085 00000F23 66AB stosw ; this is 1st interpolated sample (R) 2086 ;mov al, [next_val] 2087 00000F25 88F8 mov al, bh 2088 00000F27 00D0 add al, dl 2089 00000F29 D0D8 rcr al, 1 2090 00000F2B 2C80 sub al, 80h 2091 00000F2D 66C1E008 shl ax, 8 2092 00000F31 66AB stosw ; this is 2nd interpolated sample (L) 2093 00000F33 66AB stosw ; this is 2nd interpolated sample (R) 2094 2095 ; 16 kHZ mono to 48 kHZ stereo conversion of the sample is OK 2096 00000F35 09C9 or ecx, ecx 2097 00000F37 75C2 jnz short lff16m_1 2098 00000F39 E918FCFFFF jmp lff16m_3 2099 2100 lff16m_7: 2101 lff16s_7: 2102 00000F3E E934FCFFFF jmp lff16m_5 ; error 2103 2104 load_16khz_stereo_8_bit: 2105 ; 02/02/2025 2106 ; 14/11/2023 2107 ; 13/11/2023 2108 00000F43 F605[106A0000]01 test byte [flags], ENDOFFILE ; have we already read the 2109 ; last of the file? 2110 00000F4A 7402 jz short lff16s_0 ; no 2111 00000F4C F9 stc 2112 00000F4D C3 retn 2113 2114 lff16s_0: 2115 00000F4E BE[00000400] mov esi, temp_buffer ; temporary buffer for wav data 2116 ;mov edx, [loadsize] 2117 2118 ; esi = buffer address 2119 ;; edx = buffer size 2120 2121 ; load file into memory 2122 sys _read, [FileHandle], esi, [loadsize] 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 00000F53 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 00000F59 89F1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 00000F5B 8B15[2D040000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00000F61 B803000000 <1> mov eax, %1 90 <1> 91 00000F66 CD40 <1> int 40h 2123 00000F68 72D4 jc short lff16s_7 ; error ! 2124 2125 00000F6A BF[00800000] mov edi, audio_buffer 2126 2127 00000F6F D1E8 shr eax, 1 2128 00000F71 7505 jnz short lff16s_8 2129 00000F73 E9F6FBFFFF jmp lff16_eof 2130 2131 lff16s_8: 2132 00000F78 89C1 mov ecx, eax ; word count 2133 lff16s_1: 2134 00000F7A AC lodsb 2135 00000F7B A2[0E220000] mov [previous_val_l], al 2136 00000F80 2C80 sub al, 80h 2137 00000F82 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 2138 00000F86 66AB stosw ; original sample (L) 2139 00000F88 AC lodsb 2140 00000F89 A2[10220000] mov [previous_val_r], al 2141 00000F8E 2C80 sub al, 80h 2142 00000F90 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 2143 00000F94 66AB stosw ; original sample (R) 2144 2145 ;xor eax, eax 2146 ; 02/02/2025 2147 00000F96 668B06 mov ax, [esi] 2148 00000F99 49 dec ecx 2149 00000F9A 7504 jnz short lff16s_2 2150 ; convert 8 bit sample to 16 bit sample 2151 ; 14/11/2023 2152 00000F9C 66B88080 mov ax, 8080h 2153 lff16s_2: 2154 ;mov [next_val_l], al 2155 ;mov [next_val_r], ah 2156 00000FA0 89C3 mov ebx, eax 2157 00000FA2 0205[0E220000] add al, [previous_val_l] 2158 00000FA8 D0D8 rcr al, 1 2159 00000FAA 88C2 mov dl, al ; this is temporary interpolation value (L) 2160 00000FAC 0205[0E220000] add al, [previous_val_l] 2161 00000FB2 D0D8 rcr al, 1 2162 00000FB4 2C80 sub al, 80h 2163 00000FB6 66C1E008 shl ax, 8 2164 00000FBA 66AB stosw ; this is 1st interpolated sample (L) 2165 00000FBC 88F8 mov al, bh ; [next_val_r] 2166 00000FBE 0205[10220000] add al, [previous_val_r] 2167 00000FC4 D0D8 rcr al, 1 2168 00000FC6 88C6 mov dh, al ; this is temporary interpolation value (R) 2169 00000FC8 0205[10220000] add al, [previous_val_r] 2170 00000FCE D0D8 rcr al, 1 2171 00000FD0 2C80 sub al, 80h 2172 00000FD2 66C1E008 shl ax, 8 2173 00000FD6 66AB stosw ; this is 1st interpolated sample (R) 2174 00000FD8 88D0 mov al, dl 2175 00000FDA 00D8 add al, bl ; [next_val_l] 2176 00000FDC D0D8 rcr al, 1 2177 00000FDE 2C80 sub al, 80h 2178 00000FE0 66C1E008 shl ax, 8 2179 00000FE4 66AB stosw ; this is 2nd interpolated sample (L) 2180 00000FE6 88F0 mov al, dh 2181 00000FE8 00F8 add al, bh ; [next_val_r] 2182 00000FEA D0D8 rcr al, 1 2183 00000FEC 2C80 sub al, 80h 2184 00000FEE 66C1E008 shl ax, 8 2185 00000FF2 66AB stosw ; this is 2nd interpolated sample (R) 2186 2187 ; 16 kHZ stereo to 48 kHZ stereo conversion of the sample is OK 2188 00000FF4 09C9 or ecx, ecx 2189 00000FF6 7582 jnz short lff16s_1 2190 00000FF8 E959FBFFFF jmp lff16s_3 2191 2192 load_16khz_mono_16_bit: 2193 ; 02/02/2025 2194 ; 15/11/2023 2195 ; 13/11/2023 2196 00000FFD F605[106A0000]01 test byte [flags], ENDOFFILE ; have we already read the 2197 ; last of the file? 2198 00001004 7402 jz short lff16m2_0 ; no 2199 00001006 F9 stc 2200 00001007 C3 retn 2201 2202 lff16m2_0: 2203 00001008 BE[00000400] mov esi, temp_buffer ; temporary buffer for wav data 2204 ;mov edx, [loadsize] 2205 2206 ; esi = buffer address 2207 ;; edx = buffer size 2208 2209 ; load file into memory 2210 sys _read, [FileHandle], esi, [loadsize] 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 0000100D 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 00001013 89F1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 00001015 8B15[2D040000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 0000101B B803000000 <1> mov eax, %1 90 <1> 91 00001020 CD40 <1> int 40h 2211 00001022 7255 jc short lff16m2_7 ; error ! 2212 2213 00001024 BF[00800000] mov edi, audio_buffer 2214 2215 00001029 D1E8 shr eax, 1 2216 0000102B 7505 jnz short lff16m2_8 2217 0000102D E93CFBFFFF jmp lff16_eof 2218 2219 lff16m2_8: 2220 00001032 89C1 mov ecx, eax ; word count 2221 lff16m2_1: 2222 00001034 66AD lodsw 2223 00001036 66AB stosw ; original sample (left channel) 2224 00001038 66AB stosw ; original sample (right channel) 2225 0000103A 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2226 ;mov [previous_val], ax 2227 0000103D 89C3 mov ebx, eax 2228 ; 02/02/2025 2229 0000103F 668B06 mov ax, [esi] 2230 00001042 49 dec ecx 2231 00001043 7502 jnz short lff16m2_2 2232 00001045 31C0 xor eax, eax 2233 lff16m2_2: 2234 00001047 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2235 0000104A 89C5 mov ebp, eax ; [next_val] 2236 ;add ax, [previous_val] 2237 0000104C 6601D8 add ax, bx 2238 0000104F 66D1D8 rcr ax, 1 2239 00001052 89C2 mov edx, eax ; this is temporary interpolation value 2240 ;add ax, [previous_val] 2241 00001054 6601D8 add ax, bx 2242 00001057 66D1D8 rcr ax, 1 2243 0000105A 80EC80 sub ah, 80h ; -32768 to +32767 format again 2244 0000105D 66AB stosw ; this is 1st interpolated sample (L) 2245 0000105F 66AB stosw ; this is 1st interpolated sample (R) 2246 00001061 89E8 mov eax, ebp 2247 00001063 6601D0 add ax, dx 2248 00001066 66D1D8 rcr ax, 1 2249 00001069 80EC80 sub ah, 80h ; -32768 to +32767 format again 2250 0000106C 66AB stosw ; this is 2nd interpolated sample (L) 2251 0000106E 66AB stosw ; this is 2nd interpolated sample (R) 2252 ; 16 kHZ mono to 48 kHZ stereo conversion of the sample is OK 2253 00001070 09C9 or ecx, ecx 2254 00001072 75C0 jnz short lff16m2_1 2255 00001074 E9DDFAFFFF jmp lff16m2_3 2256 2257 lff16m2_7: 2258 lff16s2_7: 2259 00001079 E9F9FAFFFF jmp lff16m2_5 ; error 2260 2261 load_16khz_stereo_16_bit: 2262 ; 02/02/2025 2263 ; 16/11/2023 2264 ; 15/11/2023 2265 ; 13/11/2023 2266 0000107E F605[106A0000]01 test byte [flags], ENDOFFILE ; have we already read the 2267 ; last of the file? 2268 00001085 7402 jz short lff16s2_0 ; no 2269 00001087 F9 stc 2270 00001088 C3 retn 2271 2272 lff16s2_0: 2273 00001089 BE[00000400] mov esi, temp_buffer ; temporary buffer for wav data 2274 ;mov edx, [loadsize] 2275 2276 ; esi = buffer address 2277 ;; edx = buffer size 2278 2279 ; load file into memory 2280 sys _read, [FileHandle], esi, [loadsize] 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 0000108E 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 00001094 89F1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 00001096 8B15[2D040000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 0000109C B803000000 <1> mov eax, %1 90 <1> 91 000010A1 CD40 <1> int 40h 2281 000010A3 72D4 jc short lff16s2_7 ; error ! 2282 2283 000010A5 BF[00800000] mov edi, audio_buffer 2284 2285 000010AA C1E802 shr eax, 2 2286 000010AD 7505 jnz short lff16s2_8 2287 000010AF E9BAFAFFFF jmp lff16_eof 2288 2289 lff16s2_8: 2290 000010B4 89C1 mov ecx, eax ; dword count 2291 lff16s2_1: 2292 000010B6 66AD lodsw 2293 000010B8 66AB stosw ; original sample (L) 2294 000010BA 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2295 000010BD 66A3[0E220000] mov [previous_val_l], ax 2296 000010C3 66AD lodsw 2297 000010C5 66AB stosw ; original sample (R) 2298 000010C7 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2299 000010CA 66A3[10220000] mov [previous_val_r], ax 2300 ; 02/02/2025 2301 000010D0 668B06 mov ax, [esi] 2302 000010D3 668B5602 mov dx, [esi+2] 2303 ; 16/11/2023 2304 000010D7 49 dec ecx 2305 000010D8 7504 jnz short lff16s2_2 2306 000010DA 31D2 xor edx, edx 2307 000010DC 31C0 xor eax, eax 2308 lff16s2_2: 2309 000010DE 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2310 ;mov [next_val_l], ax 2311 000010E1 89C5 mov ebp, eax 2312 000010E3 80C680 add dh, 80h ; convert sound level 0 to 65535 format 2313 000010E6 668915[14220000] mov [next_val_r], dx 2314 000010ED 660305[0E220000] add ax, [previous_val_l] 2315 000010F4 66D1D8 rcr ax, 1 2316 000010F7 89C2 mov edx, eax ; this is temporary interpolation value (L) 2317 000010F9 660305[0E220000] add ax, [previous_val_l] 2318 00001100 66D1D8 rcr ax, 1 2319 00001103 80EC80 sub ah, 80h ; -32768 to +32767 format again 2320 00001106 66AB stosw ; this is 1st interpolated sample (L) 2321 00001108 66A1[14220000] mov ax, [next_val_r] 2322 0000110E 660305[10220000] add ax, [previous_val_r] 2323 00001115 66D1D8 rcr ax, 1 2324 00001118 89C3 mov ebx, eax ; this is temporary interpolation value (R) 2325 0000111A 660305[10220000] add ax, [previous_val_r] 2326 00001121 66D1D8 rcr ax, 1 2327 00001124 80EC80 sub ah, 80h ; -32768 to +32767 format again 2328 00001127 66AB stosw ; this is 1st interpolated sample (R) 2329 ;mov ax, [next_val_l] 2330 00001129 89E8 mov eax, ebp 2331 0000112B 6601D0 add ax, dx 2332 0000112E 66D1D8 rcr ax, 1 2333 00001131 80EC80 sub ah, 80h ; -32768 to +32767 format again 2334 00001134 66AB stosw ; this is 2nd interpolated sample (L) 2335 00001136 66A1[14220000] mov ax, [next_val_r] 2336 0000113C 6601D8 add ax, bx 2337 0000113F 66D1D8 rcr ax, 1 2338 00001142 80EC80 sub ah, 80h ; -32768 to +32767 format again 2339 00001145 66AB stosw ; this is 2nd interpolated sample (R) 2340 2341 ; 16 kHZ stereo to 48 kHZ stereo conversion of the sample is OK 2342 00001147 09C9 or ecx, ecx 2343 00001149 0F8567FFFFFF jnz lff16s2_1 2344 0000114F E902FAFFFF jmp lff16s2_3 2345 2346 ; ..................... 2347 2348 load_24khz_mono_8_bit: 2349 ; 02/02/2025 2350 ; 15/11/2023 2351 00001154 F605[106A0000]01 test byte [flags], ENDOFFILE ; have we already read the 2352 ; last of the file? 2353 0000115B 7402 jz short lff24m_0 ; no 2354 0000115D F9 stc 2355 0000115E C3 retn 2356 2357 lff24m_0: 2358 0000115F BE[00000400] mov esi, temp_buffer ; temporary buffer for wav data 2359 ;mov edx, [loadsize] 2360 2361 ; esi = buffer address 2362 ;; edx = buffer size 2363 2364 ; load file into memory 2365 sys _read, [FileHandle], esi, [loadsize] 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 00001164 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 0000116A 89F1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 0000116C 8B15[2D040000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00001172 B803000000 <1> mov eax, %1 90 <1> 91 00001177 CD40 <1> int 40h 2366 00001179 723B jc short lff24m_7 ; error ! 2367 2368 0000117B BF[00800000] mov edi, audio_buffer 2369 2370 00001180 21C0 and eax, eax 2371 00001182 7505 jnz short lff24m_8 2372 00001184 E9E5F9FFFF jmp lff24_eof 2373 2374 lff24m_8: 2375 00001189 89C1 mov ecx, eax ; byte count 2376 lff24m_1: 2377 0000118B AC lodsb 2378 ;mov [previous_val], al 2379 0000118C 88C3 mov bl, al 2380 0000118E 2C80 sub al, 80h 2381 00001190 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 2382 00001194 66AB stosw ; original sample (left channel) 2383 00001196 66AB stosw ; original sample (right channel) 2384 ;xor eax, eax 2385 ; 02/02/2025 2386 00001198 8A06 mov al, [esi] 2387 0000119A 49 dec ecx 2388 0000119B 7502 jnz short lff24m_2 2389 0000119D B080 mov al, 80h 2390 lff24m_2: 2391 ;;mov [next_val], al 2392 ;mov bh, al 2393 ;add al, [previous_val] 2394 0000119F 00D8 add al, bl 2395 000011A1 D0D8 rcr al, 1 2396 000011A3 2C80 sub al, 80h 2397 000011A5 66C1E008 shl ax, 8 2398 000011A9 66AB stosw ; this is interpolated sample (L) 2399 000011AB 66AB stosw ; this is interpolated sample (R) 2400 2401 ; 24 kHZ mono to 48 kHZ stereo conversion of the sample is OK 2402 000011AD 09C9 or ecx, ecx 2403 000011AF 75DA jnz short lff24m_1 2404 000011B1 E9A0F9FFFF jmp lff24_3 2405 2406 lff24m_7: 2407 lff24s_7: 2408 000011B6 E9BCF9FFFF jmp lff24_5 ; error 2409 2410 load_24khz_stereo_8_bit: 2411 ; 02/02/2025 2412 ; 15/11/2023 2413 000011BB F605[106A0000]01 test byte [flags], ENDOFFILE ; have we already read the 2414 ; last of the file? 2415 000011C2 7402 jz short lff24s_0 ; no 2416 000011C4 F9 stc 2417 000011C5 C3 retn 2418 2419 lff24s_0: 2420 000011C6 BE[00000400] mov esi, temp_buffer ; temporary buffer for wav data 2421 ;mov edx, [loadsize] 2422 2423 ; esi = buffer address 2424 ;; edx = buffer size 2425 2426 ; load file into memory 2427 sys _read, [FileHandle], esi, [loadsize] 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 000011CB 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 000011D1 89F1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 000011D3 8B15[2D040000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 000011D9 B803000000 <1> mov eax, %1 90 <1> 91 000011DE CD40 <1> int 40h 2428 000011E0 72D4 jc short lff24s_7 ; error ! 2429 2430 000011E2 BF[00800000] mov edi, audio_buffer 2431 2432 000011E7 D1E8 shr eax, 1 2433 000011E9 7505 jnz short lff24s_8 2434 000011EB E97EF9FFFF jmp lff24_eof 2435 2436 lff24s_8: 2437 000011F0 89C1 mov ecx, eax ; word count 2438 lff24s_1: 2439 000011F2 AC lodsb 2440 000011F3 A2[0E220000] mov [previous_val_l], al 2441 000011F8 2C80 sub al, 80h 2442 000011FA 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 2443 000011FE 66AB stosw ; original sample (L) 2444 00001200 AC lodsb 2445 00001201 A2[10220000] mov [previous_val_r], al 2446 00001206 2C80 sub al, 80h 2447 00001208 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 2448 0000120C 66AB stosw ; original sample (R) 2449 2450 ;xor eax, eax 2451 ; 02/02/2025 2452 0000120E 668B06 mov ax, [esi] 2453 00001211 49 dec ecx 2454 00001212 7504 jnz short lff24s_2 2455 ; convert 8 bit sample to 16 bit sample 2456 00001214 66B88080 mov ax, 8080h 2457 lff24s_2: 2458 ;;mov [next_val_l], al 2459 ;;mov [next_val_r], ah 2460 ;mov bx, ax 2461 00001218 88E7 mov bh, ah 2462 0000121A 0205[0E220000] add al, [previous_val_l] 2463 00001220 D0D8 rcr al, 1 2464 ;mov dl, al 2465 00001222 2C80 sub al, 80h 2466 00001224 66C1E008 shl ax, 8 2467 00001228 66AB stosw ; this is interpolated sample (L) 2468 0000122A 88F8 mov al, bh ; [next_val_r] 2469 0000122C 0205[10220000] add al, [previous_val_r] 2470 00001232 D0D8 rcr al, 1 2471 ;mov dh, al 2472 00001234 2C80 sub al, 80h 2473 00001236 66C1E008 shl ax, 8 2474 0000123A 66AB stosw ; this is interpolated sample (R) 2475 2476 ; 24 kHZ stereo to 48 kHZ stereo conversion of the sample is OK 2477 0000123C 09C9 or ecx, ecx 2478 0000123E 75B2 jnz short lff24s_1 2479 00001240 E911F9FFFF jmp lff24_3 2480 2481 load_24khz_mono_16_bit: 2482 ; 02/02/2025 2483 ; 15/11/2023 2484 00001245 F605[106A0000]01 test byte [flags], ENDOFFILE ; have we already read the 2485 ; last of the file? 2486 0000124C 7402 jz short lff24m2_0 ; no 2487 0000124E F9 stc 2488 0000124F C3 retn 2489 2490 lff24m2_0: 2491 00001250 BE[00000400] mov esi, temp_buffer ; temporary buffer for wav data 2492 ;mov edx, [loadsize] 2493 2494 ; esi = buffer address 2495 ;; edx = buffer size 2496 2497 ; load file into memory 2498 sys _read, [FileHandle], esi, [loadsize] 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 00001255 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 0000125B 89F1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 0000125D 8B15[2D040000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00001263 B803000000 <1> mov eax, %1 90 <1> 91 00001268 CD40 <1> int 40h 2499 0000126A 723A jc short lff24m2_7 ; error ! 2500 2501 0000126C BF[00800000] mov edi, audio_buffer 2502 2503 00001271 D1E8 shr eax, 1 2504 00001273 7505 jnz short lff24m2_8 2505 00001275 E9F4F8FFFF jmp lff24_eof 2506 2507 lff24m2_8: 2508 0000127A 89C1 mov ecx, eax ; word count 2509 lff24m2_1: 2510 0000127C 66AD lodsw 2511 0000127E 66AB stosw ; original sample (left channel) 2512 00001280 66AB stosw ; original sample (right channel) 2513 00001282 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2514 ;mov [previous_val], ax 2515 ;mov ebx, eax 2516 ; 02/02/2025 2517 00001285 668B1E mov bx, [esi] 2518 00001288 49 dec ecx 2519 00001289 7502 jnz short lff24m2_2 2520 ;xor eax, eax 2521 0000128B 31DB xor ebx, ebx 2522 lff24m2_2: 2523 ; 02/02/2025 2524 0000128D 80C780 add bh, 80h ; convert sound level 0 to 65535 format 2525 ;add ah, 80h 2526 ;mov ebp, eax ; [next_val] 2527 ;add ax, [previous_val] 2528 ; ax = [previous_val] 2529 ; bx = [next_val] 2530 00001290 6601D8 add ax, bx 2531 00001293 66D1D8 rcr ax, 1 2532 00001296 80EC80 sub ah, 80h ; -32768 to +32767 format again 2533 00001299 66AB stosw ; this is interpolated sample (L) 2534 0000129B 66AB stosw ; this is interpolated sample (R) 2535 ; 24 kHZ mono to 48 kHZ stereo conversion of the sample is OK 2536 0000129D 09C9 or ecx, ecx 2537 0000129F 75DB jnz short lff24m2_1 2538 000012A1 E9B0F8FFFF jmp lff24_3 2539 2540 lff24m2_7: 2541 lff24s2_7: 2542 000012A6 E9CCF8FFFF jmp lff24_5 ; error 2543 2544 load_24khz_stereo_16_bit: 2545 ; 02/02/2025 2546 ; 16/11/2023 2547 ; 15/11/2023 2548 000012AB F605[106A0000]01 test byte [flags], ENDOFFILE ; have we already read the 2549 ; last of the file? 2550 000012B2 7402 jz short lff24s2_0 ; no 2551 000012B4 F9 stc 2552 000012B5 C3 retn 2553 2554 lff24s2_0: 2555 000012B6 BE[00000400] mov esi, temp_buffer ; temporary buffer for wav data 2556 ;mov edx, [loadsize] 2557 2558 ; esi = buffer address 2559 ;; edx = buffer size 2560 2561 ; load file into memory 2562 sys _read, [FileHandle], esi, [loadsize] 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 000012BB 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 000012C1 89F1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 000012C3 8B15[2D040000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 000012C9 B803000000 <1> mov eax, %1 90 <1> 91 000012CE CD40 <1> int 40h 2563 000012D0 72D4 jc short lff24s2_7 ; error ! 2564 2565 000012D2 BF[00800000] mov edi, audio_buffer 2566 2567 000012D7 C1E802 shr eax, 2 2568 000012DA 7505 jnz short lff24s2_8 2569 000012DC E98DF8FFFF jmp lff24_eof 2570 2571 lff24s2_8: 2572 000012E1 89C1 mov ecx, eax ; dword count 2573 lff24s2_1: 2574 000012E3 66AD lodsw 2575 000012E5 66AB stosw ; original sample (L) 2576 000012E7 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2577 000012EA 66A3[0E220000] mov [previous_val_l], ax 2578 000012F0 66AD lodsw 2579 000012F2 66AB stosw ; original sample (R) 2580 000012F4 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2581 ;mov [previous_val_r], ax 2582 000012F7 89C3 mov ebx, eax 2583 ; 02/02/2025 2584 000012F9 668B06 mov ax, [esi] 2585 000012FC 668B5602 mov dx, [esi+2] 2586 ; 16/11/2023 2587 00001300 49 dec ecx 2588 00001301 7504 jnz short lff24s2_2 2589 00001303 31D2 xor edx, edx 2590 00001305 31C0 xor eax, eax 2591 lff24s2_2: 2592 00001307 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2593 ;;mov [next_val_l], ax 2594 ;mov ebp, eax 2595 0000130A 80C680 add dh, 80h ; convert sound level 0 to 65535 format 2596 ;mov [next_val_r], dx 2597 0000130D 660305[0E220000] add ax, [previous_val_l] 2598 00001314 66D1D8 rcr ax, 1 2599 00001317 80EC80 sub ah, 80h ; -32768 to +32767 format again 2600 0000131A 66AB stosw ; this is interpolated sample (L) 2601 ;mov ax, [next_val_r] 2602 0000131C 89D0 mov eax, edx 2603 ;add ax, [previous_val_r] 2604 0000131E 6601D8 add ax, bx 2605 00001321 66D1D8 rcr ax, 1 2606 00001324 80EC80 sub ah, 80h ; -32768 to +32767 format again 2607 00001327 66AB stosw ; this is interpolated sample (R) 2608 2609 ; 24 kHZ stereo to 48 kHZ stereo conversion of the sample is OK 2610 00001329 09C9 or ecx, ecx 2611 0000132B 75B6 jnz short lff24s2_1 2612 0000132D E924F8FFFF jmp lff24_3 2613 2614 ; ..................... 2615 2616 load_32khz_mono_8_bit: 2617 ; 02/02/2025 2618 ; 15/11/2023 2619 00001332 F605[106A0000]01 test byte [flags], ENDOFFILE ; have we already read the 2620 ; last of the file? 2621 00001339 7402 jz short lff32m_0 ; no 2622 0000133B F9 stc 2623 0000133C C3 retn 2624 2625 lff32m_0: 2626 0000133D BE[00000400] mov esi, temp_buffer ; temporary buffer for wav data 2627 ;mov edx, [loadsize] 2628 2629 ; esi = buffer address 2630 ;; edx = buffer size 2631 2632 ; load file into memory 2633 sys _read, [FileHandle], esi, [loadsize] 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 00001342 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 00001348 89F1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 0000134A 8B15[2D040000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00001350 B803000000 <1> mov eax, %1 90 <1> 91 00001355 CD40 <1> int 40h 2634 00001357 7247 jc short lff32m_7 ; error ! 2635 2636 00001359 BF[00800000] mov edi, audio_buffer 2637 2638 0000135E 21C0 and eax, eax 2639 00001360 7505 jnz short lff32m_8 2640 00001362 E907F8FFFF jmp lff32_eof 2641 2642 lff32m_8: 2643 00001367 89C1 mov ecx, eax ; byte count 2644 lff32m_1: 2645 00001369 AC lodsb 2646 ;mov [previous_val], al 2647 0000136A 88C3 mov bl, al 2648 0000136C 2C80 sub al, 80h 2649 0000136E 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 2650 00001372 66AB stosw ; original sample (left channel) 2651 00001374 66AB stosw ; original sample (right channel) 2652 ;xor eax, eax 2653 ; 02/02/2025 2654 00001376 8A06 mov al, [esi] 2655 00001378 49 dec ecx 2656 00001379 7502 jnz short lff32m_2 2657 0000137B B080 mov al, 80h 2658 lff32m_2: 2659 ;;mov [next_val], al 2660 ;mov bh, al 2661 ;add al, [previous_val] 2662 0000137D 00D8 add al, bl 2663 0000137F D0D8 rcr al, 1 2664 00001381 2C80 sub al, 80h 2665 00001383 66C1E008 shl ax, 8 2666 00001387 66AB stosw ; this is interpolated sample (L) 2667 00001389 66AB stosw ; this is interpolated sample (R) 2668 2669 ; different than 8-16-24 kHZ ! 2670 ; 'original-interpolated-original' trio samples 2671 0000138B E30E jecxz lff32m_3 2672 2673 0000138D AC lodsb 2674 0000138E 2C80 sub al, 80h 2675 00001390 66C1E008 shl ax, 8 2676 00001394 66AB stosw ; original sample (left channel) 2677 00001396 66AB stosw ; original sample (right channel) 2678 2679 ; 32 kHZ mono to 48 kHZ stereo conversion of the sample is OK 2680 00001398 49 dec ecx 2681 00001399 75CE jnz short lff32m_1 2682 lff32m_3: 2683 0000139B E9B6F7FFFF jmp lff32_3 2684 2685 lff32m_7: 2686 lff32s_7: 2687 000013A0 E9D2F7FFFF jmp lff32_5 ; error 2688 2689 load_32khz_stereo_8_bit: 2690 ; 02/02/2025 2691 ; 15/11/2023 2692 000013A5 F605[106A0000]01 test byte [flags], ENDOFFILE ; have we already read the 2693 ; last of the file? 2694 000013AC 7402 jz short lff32s_0 ; no 2695 000013AE F9 stc 2696 000013AF C3 retn 2697 2698 lff32s_0: 2699 000013B0 BE[00000400] mov esi, temp_buffer ; temporary buffer for wav data 2700 ;mov edx, [loadsize] 2701 2702 ; esi = buffer address 2703 ;; edx = buffer size 2704 2705 ; load file into memory 2706 sys _read, [FileHandle], esi, [loadsize] 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 000013B5 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 000013BB 89F1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 000013BD 8B15[2D040000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 000013C3 B803000000 <1> mov eax, %1 90 <1> 91 000013C8 CD40 <1> int 40h 2707 000013CA 72D4 jc short lff32s_7 ; error ! 2708 2709 000013CC BF[00800000] mov edi, audio_buffer 2710 2711 000013D1 D1E8 shr eax, 1 2712 000013D3 7505 jnz short lff32s_8 2713 000013D5 E994F7FFFF jmp lff32_eof 2714 2715 lff32s_8: 2716 000013DA 89C1 mov ecx, eax ; word count 2717 lff32s_1: 2718 000013DC AC lodsb 2719 000013DD A2[0E220000] mov [previous_val_l], al 2720 000013E2 2C80 sub al, 80h 2721 000013E4 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 2722 000013E8 66AB stosw ; original sample (L) 2723 000013EA AC lodsb 2724 000013EB A2[10220000] mov [previous_val_r], al 2725 000013F0 2C80 sub al, 80h 2726 000013F2 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 2727 000013F6 66AB stosw ; original sample (R) 2728 2729 ;xor eax, eax 2730 ; 02/02/2025 2731 000013F8 668B06 mov ax, [esi] 2732 000013FB 49 dec ecx 2733 000013FC 7504 jnz short lff32s_2 2734 ; convert 8 bit sample to 16 bit sample 2735 000013FE 66B88080 mov ax, 8080h 2736 lff32s_2: 2737 ;;mov [next_val_l], al 2738 ;;mov [next_val_r], ah 2739 ;mov bx, ax 2740 00001402 88E7 mov bh, ah 2741 00001404 0205[0E220000] add al, [previous_val_l] 2742 0000140A D0D8 rcr al, 1 2743 ;mov dl, al 2744 0000140C 2C80 sub al, 80h 2745 0000140E 66C1E008 shl ax, 8 2746 00001412 66AB stosw ; this is interpolated sample (L) 2747 00001414 88F8 mov al, bh ; [next_val_r] 2748 00001416 0205[10220000] add al, [previous_val_r] 2749 0000141C D0D8 rcr al, 1 2750 ;mov dh, al 2751 0000141E 2C80 sub al, 80h 2752 00001420 66C1E008 shl ax, 8 2753 00001424 66AB stosw ; this is interpolated sample (R) 2754 2755 ; different than 8-16-24 kHZ ! 2756 ; 'original-interpolated-original' trio samples 2757 00001426 E315 jecxz lff32s_3 2758 2759 00001428 AC lodsb 2760 00001429 2C80 sub al, 80h 2761 0000142B 66C1E008 shl ax, 8 2762 0000142F 66AB stosw ; original sample (left channel) 2763 2764 00001431 AC lodsb 2765 00001432 2C80 sub al, 80h 2766 00001434 66C1E008 shl ax, 8 2767 00001438 66AB stosw ; original sample (right channel) 2768 2769 ; 32 kHZ stereo to 48 kHZ stereo conversion of the sample is OK 2770 0000143A 49 dec ecx 2771 0000143B 759F jnz short lff32s_1 2772 lff32s_3: 2773 0000143D E914F7FFFF jmp lff32_3 2774 2775 load_32khz_mono_16_bit: 2776 ; 02/02/2025 2777 ; 15/11/2023 2778 00001442 F605[106A0000]01 test byte [flags], ENDOFFILE ; have we already read the 2779 ; last of the file? 2780 00001449 7402 jz short lff32m2_0 ; no 2781 0000144B F9 stc 2782 0000144C C3 retn 2783 2784 lff32m2_0: 2785 0000144D BE[00000400] mov esi, temp_buffer ; temporary buffer for wav data 2786 ;mov edx, [loadsize] 2787 2788 ; esi = buffer address 2789 ;; edx = buffer size 2790 2791 ; load file into memory 2792 sys _read, [FileHandle], esi, [loadsize] 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 00001452 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 00001458 89F1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 0000145A 8B15[2D040000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00001460 B803000000 <1> mov eax, %1 90 <1> 91 00001465 CD40 <1> int 40h 2793 00001467 7241 jc short lff32m2_7 ; error ! 2794 2795 00001469 BF[00800000] mov edi, audio_buffer 2796 2797 0000146E D1E8 shr eax, 1 2798 00001470 7505 jnz short lff32m2_8 2799 00001472 E9F7F6FFFF jmp lff32_eof 2800 2801 lff32m2_8: 2802 00001477 89C1 mov ecx, eax ; word count 2803 lff32m2_1: 2804 00001479 66AD lodsw 2805 0000147B 66AB stosw ; original sample (left channel) 2806 0000147D 66AB stosw ; original sample (right channel) 2807 0000147F 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2808 ;mov [previous_val], ax 2809 ;mov ebx, eax 2810 ;xor eax, eax 2811 ; 02/02/2025 2812 ;mov ax, [esi] 2813 00001482 668B1E mov bx, [esi] 2814 00001485 49 dec ecx 2815 00001486 7502 jnz short lff32m2_2 2816 00001488 31DB xor ebx, ebx 2817 lff32m2_2: 2818 ; 02/02/2025 2819 0000148A 80C780 add bh, 80h ; convert sound level 0 to 65535 format 2820 ;add ah, 80h 2821 ;mov ebp, eax ; [next_val] 2822 ;add ax, [previous_val] 2823 ; ax = [previous_val] 2824 ; bx = [next_val] 2825 0000148D 6601D8 add ax, bx 2826 00001490 66D1D8 rcr ax, 1 2827 00001493 80EC80 sub ah, 80h ; -32768 to +32767 format again 2828 00001496 66AB stosw ; this is interpolated sample (L) 2829 00001498 66AB stosw ; this is interpolated sample (R) 2830 2831 ; different than 8-16-24 kHZ ! 2832 ; 'original-interpolated-original' trio samples 2833 0000149A E309 jecxz lff32m2_3 2834 2835 0000149C 66AD lodsw 2836 0000149E 66AB stosw ; original sample (left channel) 2837 000014A0 66AB stosw ; original sample (right channel) 2838 2839 ; 32 kHZ mono to 48 kHZ stereo conversion of the sample is OK 2840 000014A2 49 dec ecx 2841 000014A3 75D4 jnz short lff32m2_1 2842 lff32m2_3: 2843 000014A5 E9ACF6FFFF jmp lff32_3 2844 2845 lff32m2_7: 2846 lff32s2_7: 2847 000014AA E9C8F6FFFF jmp lff32_5 ; error 2848 2849 load_32khz_stereo_16_bit: 2850 ; 02/02/2025 2851 ; 16/11/2023 2852 ; 15/11/2023 2853 000014AF F605[106A0000]01 test byte [flags], ENDOFFILE ; have we already read the 2854 ; last of the file? 2855 000014B6 7402 jz short lff32s2_0 ; no 2856 000014B8 F9 stc 2857 000014B9 C3 retn 2858 2859 lff32s2_0: 2860 000014BA BE[00000400] mov esi, temp_buffer ; temporary buffer for wav data 2861 ;mov edx, [loadsize] 2862 2863 ; esi = buffer address 2864 ;; edx = buffer size 2865 2866 ; load file into memory 2867 sys _read, [FileHandle], esi, [loadsize] 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 000014BF 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 000014C5 89F1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 000014C7 8B15[2D040000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 000014CD B803000000 <1> mov eax, %1 90 <1> 91 000014D2 CD40 <1> int 40h 2868 000014D4 72D4 jc short lff32s2_7 ; error ! 2869 2870 000014D6 BF[00800000] mov edi, audio_buffer 2871 2872 000014DB C1E802 shr eax, 2 2873 000014DE 7505 jnz short lff32s2_8 2874 000014E0 E989F6FFFF jmp lff32_eof 2875 2876 lff32s2_8: 2877 000014E5 89C1 mov ecx, eax ; dword count 2878 lff32s2_1: 2879 000014E7 66AD lodsw 2880 000014E9 66AB stosw ; original sample (L) 2881 000014EB 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2882 000014EE 66A3[0E220000] mov [previous_val_l], ax 2883 000014F4 66AD lodsw 2884 000014F6 66AB stosw ; original sample (R) 2885 000014F8 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2886 ;mov [previous_val_r], ax 2887 000014FB 89C3 mov ebx, eax 2888 ; 02/02/2025 2889 000014FD 668B06 mov ax, [esi] 2890 00001500 668B5602 mov dx, [esi+2] 2891 ; 16/11/2023 2892 00001504 49 dec ecx 2893 00001505 7504 jnz short lff32s2_2 2894 00001507 31D2 xor edx, edx 2895 00001509 31C0 xor eax, eax 2896 lff32s2_2: 2897 0000150B 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2898 ;;mov [next_val_l], ax 2899 ;mov ebp, eax 2900 0000150E 80C680 add dh, 80h ; convert sound level 0 to 65535 format 2901 ;mov [next_val_r], dx 2902 00001511 660305[0E220000] add ax, [previous_val_l] 2903 00001518 66D1D8 rcr ax, 1 2904 0000151B 80EC80 sub ah, 80h ; -32768 to +32767 format again 2905 0000151E 66AB stosw ; this is interpolated sample (L) 2906 ;mov ax, [next_val_r] 2907 00001520 89D0 mov eax, edx 2908 ;add ax, [previous_val_r] 2909 00001522 6601D8 add ax, bx 2910 00001525 66D1D8 rcr ax, 1 2911 00001528 80EC80 sub ah, 80h ; -32768 to +32767 format again 2912 0000152B 66AB stosw ; this is interpolated sample (R) 2913 2914 ; different than 8-16-24 kHZ ! 2915 ; 'original-interpolated-original' trio samples 2916 0000152D E30B jecxz lff32s2_3 2917 2918 0000152F 66AD lodsw 2919 00001531 66AB stosw ; original sample (L) 2920 00001533 66AD lodsw 2921 00001535 66AB stosw ; original sample (R) 2922 2923 ; 32 kHZ stereo to 48 kHZ stereo conversion of the sample is OK 2924 00001537 49 dec ecx 2925 00001538 75AD jnz short lff32s2_1 2926 lff32s2_3: 2927 0000153A E917F6FFFF jmp lff32_3 2928 2929 ; ..................... 2930 2931 load_22khz_mono_8_bit: 2932 ; 02/02/2025 2933 ; 16/11/2023 2934 0000153F F605[106A0000]01 test byte [flags], ENDOFFILE ; have we already read the 2935 ; last of the file? 2936 00001546 7402 jz short lff22m_0 ; no 2937 00001548 F9 stc 2938 00001549 C3 retn 2939 2940 lff22m_0: 2941 0000154A BE[00000400] mov esi, temp_buffer ; temporary buffer for wav data 2942 ;mov edx, [loadsize] 2943 2944 ; esi = buffer address 2945 ;; edx = buffer size 2946 2947 ; load file into memory 2948 sys _read, [FileHandle], esi, [loadsize] 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 0000154F 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 00001555 89F1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 00001557 8B15[2D040000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 0000155D B803000000 <1> mov eax, %1 90 <1> 91 00001562 CD40 <1> int 40h 2949 00001564 725D jc short lff22m_7 ; error ! 2950 2951 00001566 BF[00800000] mov edi, audio_buffer 2952 2953 0000156B 21C0 and eax, eax 2954 0000156D 7505 jnz short lff22m_8 2955 0000156F E9FAF5FFFF jmp lff22_eof 2956 2957 lff22m_8: 2958 00001574 89C1 mov ecx, eax ; byte count 2959 lff22m_9: 2960 00001576 BD05000000 mov ebp, 5 ; interpolation (one step) loop count 2961 0000157B C605[16220000]03 mov byte [faz], 3 ; 3 steps/phases 2962 lff22m_1: 2963 ; 3:2:2:2:2:2::3:2:2:2:2::3:2:2:2:2:2 ; 37/17 2964 00001582 AC lodsb 2965 ; 02/02/2025 2966 00001583 8A16 mov dl, [esi] 2967 00001585 49 dec ecx 2968 00001586 7502 jnz short lff22m_2_1 2969 00001588 B280 mov dl, 80h 2970 lff22m_2_1: 2971 ; al = [previous_val] 2972 ; dl = [next_val] 2973 0000158A E835070000 call interpolating_3_8bit_mono ; 1 of 17 2974 0000158F E32D jecxz lff22m_3 2975 lff22m_2_2: 2976 00001591 AC lodsb 2977 ; 02/02/2025 2978 00001592 8A16 mov dl, [esi] 2979 00001594 49 dec ecx 2980 00001595 7502 jnz short lff22m_2_3 2981 00001597 B280 mov dl, 80h 2982 lff22m_2_3: 2983 00001599 E8B0070000 call interpolating_2_8bit_mono ; 2 of 17 .. 6 of 17 2984 0000159E E31E jecxz lff22m_3 2985 000015A0 4D dec ebp 2986 000015A1 75EE jnz short lff22m_2_2 2987 2988 000015A3 A0[16220000] mov al, [faz] 2989 000015A8 FEC8 dec al 2990 000015AA 74CA jz short lff22m_9 2991 000015AC FE0D[16220000] dec byte [faz] 2992 000015B2 BD04000000 mov ebp, 4 2993 000015B7 FEC8 dec al 2994 000015B9 75C7 jnz short lff22m_1 ; 3:2:2:2:2 ; 7-11 of 17 2995 000015BB 45 inc ebp ; 5 2996 000015BC EBC4 jmp short lff22m_1 ; 3:2:2:2:2:2 ; 12-17 of 17 2997 2998 lff22m_3: 2999 lff22s_3: 3000 000015BE E993F5FFFF jmp lff22_3 ; padfill 3001 ; (put zeros in the remain words of the buffer) 3002 lff22m_7: 3003 lff22s_7: 3004 000015C3 E9AFF5FFFF jmp lff22_5 ; error 3005 3006 load_22khz_stereo_8_bit: 3007 ; 02/02/2025 3008 ; 16/11/2023 3009 000015C8 F605[106A0000]01 test byte [flags], ENDOFFILE ; have we already read the 3010 ; last of the file? 3011 000015CF 7402 jz short lff22s_0 ; no 3012 000015D1 F9 stc 3013 000015D2 C3 retn 3014 3015 lff22s_0: 3016 000015D3 BE[00000400] mov esi, temp_buffer ; temporary buffer for wav data 3017 ;mov edx, [loadsize] 3018 3019 ; esi = buffer address 3020 ;; edx = buffer size 3021 3022 ; load file into memory 3023 sys _read, [FileHandle], esi, [loadsize] 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 000015D8 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 000015DE 89F1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 000015E0 8B15[2D040000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 000015E6 B803000000 <1> mov eax, %1 90 <1> 91 000015EB CD40 <1> int 40h 3024 000015ED 72D4 jc short lff22s_7 ; error ! 3025 3026 000015EF BF[00800000] mov edi, audio_buffer 3027 3028 000015F4 D1E8 shr eax, 1 3029 000015F6 7505 jnz short lff22s_8 3030 000015F8 E971F5FFFF jmp lff22_eof 3031 3032 lff22s_8: 3033 000015FD 89C1 mov ecx, eax ; word count 3034 lff22s_9: 3035 000015FF BD05000000 mov ebp, 5 ; interpolation (one step) loop count 3036 00001604 C605[16220000]03 mov byte [faz], 3 ; 3 steps/phase 3037 lff22s_1: 3038 ; 3:2:2:2:2:2::3:2:2:2:2::3:2:2:2:2:2 ; 37/17 3039 0000160B 66AD lodsw 3040 ; 02/02/2025 3041 0000160D 668B16 mov dx, [esi] 3042 00001610 49 dec ecx 3043 00001611 7504 jnz short lff22s_2_1 3044 00001613 66BA8080 mov dx, 8080h 3045 lff22s_2_1: 3046 ; al = [previous_val_l] 3047 ; ah = [previous_val_r] 3048 ; dl = [next_val_l] 3049 ; dh = [next_val_r] 3050 00001617 E8DB060000 call interpolating_3_8bit_stereo ; 1 of 17 3051 0000161C E3A0 jecxz lff22s_3 3052 lff22s_2_2: 3053 0000161E 66AD lodsw 3054 ; 02/02/2025 3055 00001620 668B16 mov dx, [esi] 3056 00001623 49 dec ecx 3057 00001624 7504 jnz short lff22s_2_3 3058 00001626 66BA8080 mov dx, 8080h 3059 lff22s_2_3: 3060 0000162A E83C070000 call interpolating_2_8bit_stereo ; 2 of 17 .. 6 of 17 3061 0000162F E38D jecxz lff22s_3 3062 00001631 4D dec ebp 3063 00001632 75EA jnz short lff22s_2_2 3064 3065 00001634 A0[16220000] mov al, [faz] 3066 00001639 FEC8 dec al 3067 0000163B 74C2 jz short lff22s_9 3068 0000163D FE0D[16220000] dec byte [faz] 3069 00001643 BD04000000 mov ebp, 4 3070 00001648 FEC8 dec al 3071 0000164A 75BF jnz short lff22s_1 ; 3:2:2:2:2 ; 7-11 of 17 3072 0000164C 45 inc ebp ; 5 3073 0000164D EBBC jmp short lff22s_1 ; 3:2:2:2:2:2 ; 12-17 of 17 3074 3075 load_22khz_mono_16_bit: 3076 ; 02/02/2025 3077 ; 16/11/2023 3078 0000164F F605[106A0000]01 test byte [flags], ENDOFFILE ; have we already read the 3079 ; last of the file? 3080 00001656 7402 jz short lff22m2_0 ; no 3081 00001658 F9 stc 3082 00001659 C3 retn 3083 3084 lff22m2_0: 3085 0000165A BE[00000400] mov esi, temp_buffer ; temporary buffer for wav data 3086 ;mov edx, [loadsize] 3087 3088 ; esi = buffer address 3089 ;; edx = buffer size 3090 3091 ; load file into memory 3092 sys _read, [FileHandle], esi, [loadsize] 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 0000165F 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 00001665 89F1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 00001667 8B15[2D040000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 0000166D B803000000 <1> mov eax, %1 90 <1> 91 00001672 CD40 <1> int 40h 3093 00001674 7261 jc short lff22m2_7 ; error ! 3094 3095 00001676 BF[00800000] mov edi, audio_buffer 3096 3097 0000167B D1E8 shr eax, 1 3098 0000167D 7505 jnz short lff22m2_8 3099 0000167F E9EAF4FFFF jmp lff22_eof 3100 3101 lff22m2_8: 3102 00001684 89C1 mov ecx, eax ; word count 3103 lff22m2_9: 3104 00001686 BD05000000 mov ebp, 5 ; interpolation (one step) loop count 3105 0000168B C605[16220000]03 mov byte [faz], 3 ; 3 steps/phases 3106 lff22m2_1: 3107 ; 3:2:2:2:2:2::3:2:2:2:2::3:2:2:2:2:2 ; 37/17 3108 00001692 66AD lodsw 3109 ; 02/02/2025 3110 00001694 668B16 mov dx, [esi] 3111 00001697 49 dec ecx 3112 00001698 7502 jnz short lff22m2_2_1 3113 0000169A 31D2 xor edx, edx 3114 lff22m2_2_1: 3115 ; ax = [previous_val] 3116 ; dx = [next_val] 3117 0000169C E8FB060000 call interpolating_3_16bit_mono ; 1 of 17 3118 000016A1 E32F jecxz lff22m2_3 3119 lff22m2_2_2: 3120 000016A3 66AD lodsw 3121 ; 02/02/2025 3122 000016A5 668B16 mov dx, [esi] 3123 000016A8 49 dec ecx 3124 000016A9 7502 jnz short lff22m2_2_3 3125 000016AB 31D2 xor edx, edx 3126 lff22m2_2_3: 3127 000016AD E87D070000 call interpolating_2_16bit_mono ; 2 of 17 .. 6 of 17 3128 000016B2 E31E jecxz lff22m2_3 3129 000016B4 4D dec ebp 3130 000016B5 75EC jnz short lff22m2_2_2 3131 3132 000016B7 A0[16220000] mov al, [faz] 3133 000016BC FEC8 dec al 3134 000016BE 74C6 jz short lff22m2_9 3135 000016C0 FE0D[16220000] dec byte [faz] 3136 000016C6 BD04000000 mov ebp, 4 3137 000016CB FEC8 dec al 3138 000016CD 75C3 jnz short lff22m2_1 ; 3:2:2:2:2 ; 7-11 of 17 3139 000016CF 45 inc ebp ; 5 3140 000016D0 EBC0 jmp short lff22m2_1 ; 3:2:2:2:2:2 ; 12-17 of 17 3141 3142 lff22m2_3: 3143 lff22s2_3: 3144 000016D2 E97FF4FFFF jmp lff22_3 ; padfill 3145 ; (put zeros in the remain words of the buffer) 3146 lff22m2_7: 3147 lff22s2_7: 3148 000016D7 E99BF4FFFF jmp lff22_5 ; error 3149 3150 load_22khz_stereo_16_bit: 3151 ; 16/11/2023 3152 000016DC F605[106A0000]01 test byte [flags], ENDOFFILE ; have we already read the 3153 ; last of the file? 3154 000016E3 7402 jz short lff22s2_0 ; no 3155 000016E5 F9 stc 3156 000016E6 C3 retn 3157 3158 lff22s2_0: 3159 000016E7 BE[00000400] mov esi, temp_buffer ; temporary buffer for wav data 3160 ;mov edx, [loadsize] 3161 3162 ; esi = buffer address 3163 ;; edx = buffer size 3164 3165 ; load file into memory 3166 sys _read, [FileHandle], esi, [loadsize] 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 000016EC 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 000016F2 89F1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 000016F4 8B15[2D040000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 000016FA B803000000 <1> mov eax, %1 90 <1> 91 000016FF CD40 <1> int 40h 3167 00001701 72D4 jc short lff22s2_7 ; error ! 3168 3169 00001703 BF[00800000] mov edi, audio_buffer 3170 3171 00001708 C1E802 shr eax, 2 ; dword (left chan word + right chan word) 3172 0000170B 7505 jnz short lff22s2_8 3173 0000170D E95CF4FFFF jmp lff22_eof 3174 3175 lff22s2_8: 3176 00001712 89C1 mov ecx, eax ; dword count 3177 lff22s2_9: 3178 00001714 BD05000000 mov ebp, 5 ; interpolation (one step) loop count 3179 00001719 C605[16220000]03 mov byte [faz], 3 ; 3 steps/phase 3180 lff22s2_1: 3181 ; 3:2:2:2:2:2::3:2:2:2:2::3:2:2:2:2:2 ; 37/17 3182 00001720 66AD lodsw 3183 00001722 89C3 mov ebx, eax 3184 00001724 66AD lodsw 3185 00001726 8B16 mov edx, [esi] 3186 00001728 668915[12220000] mov [next_val_l], dx 3187 ; 26/11/2023 3188 0000172F C1EA10 shr edx, 16 3189 00001732 49 dec ecx 3190 00001733 7509 jnz short lff22s2_2_1 3191 00001735 31D2 xor edx, edx ; 0 3192 00001737 668915[12220000] mov [next_val_l], dx 3193 lff22s2_2_1: 3194 ; bx = [previous_val_l] 3195 ; ax = [previous_val_r] 3196 ; [next_val_l] 3197 ; dx = [next_val_r] 3198 0000173E E889060000 call interpolating_3_16bit_stereo ; 1 of 17 3199 00001743 E38D jecxz lff22s2_3 3200 lff22s2_2_2: 3201 00001745 66AD lodsw 3202 00001747 89C3 mov ebx, eax 3203 00001749 66AD lodsw 3204 0000174B 8B16 mov edx, [esi] 3205 0000174D 668915[12220000] mov [next_val_l], dx 3206 ; 26/11/2023 3207 00001754 C1EA10 shr edx, 16 3208 00001757 49 dec ecx 3209 00001758 7509 jnz short lff22s2_2_3 3210 0000175A 31D2 xor edx, edx ; 0 3211 0000175C 668915[12220000] mov [next_val_l], dx 3212 lff22s2_2_3: 3213 00001763 E8DF060000 call interpolating_2_16bit_stereo ; 2 of 17 .. 6 of 17 3214 00001768 E31E jecxz lff22s2_2_4 3215 3216 0000176A 4D dec ebp 3217 0000176B 75D8 jnz short lff22s2_2_2 3218 3219 0000176D A0[16220000] mov al, [faz] 3220 00001772 FEC8 dec al 3221 00001774 749E jz short lff22s2_9 3222 00001776 FE0D[16220000] dec byte [faz] 3223 0000177C BD04000000 mov ebp, 4 3224 00001781 FEC8 dec al 3225 00001783 759B jnz short lff22s2_1 ; 3:2:2:2:2 ; 7-11 of 17 3226 00001785 45 inc ebp ; 5 3227 00001786 EB98 jmp short lff22s2_1 ; 3:2:2:2:2:2 ; 12-17 of 17 3228 3229 lff22s2_2_4: 3230 ; 26/11/2023 3231 00001788 E9C9F3FFFF jmp lff22_3 ; padfill 3232 3233 ; ..................... 3234 3235 load_11khz_mono_8_bit: 3236 ; 02/02/2025 3237 ; 18/11/2023 3238 0000178D F605[106A0000]01 test byte [flags], ENDOFFILE ; have we already read the 3239 ; last of the file? 3240 00001794 7402 jz short lff11m_0 ; no 3241 00001796 F9 stc 3242 00001797 C3 retn 3243 3244 lff11m_0: 3245 00001798 BE[00000400] mov esi, temp_buffer ; temporary buffer for wav data 3246 ;mov edx, [loadsize] 3247 3248 ; esi = buffer address 3249 ;; edx = buffer size 3250 3251 ; load file into memory 3252 sys _read, [FileHandle], esi, [loadsize] 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 0000179D 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 000017A3 89F1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 000017A5 8B15[2D040000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 000017AB B803000000 <1> mov eax, %1 90 <1> 91 000017B0 CD40 <1> int 40h 3253 000017B2 7247 jc short lff11m_7 ; error ! 3254 3255 000017B4 BF[00800000] mov edi, audio_buffer 3256 3257 000017B9 21C0 and eax, eax 3258 000017BB 7505 jnz short lff11m_8 3259 000017BD E9ACF3FFFF jmp lff11_eof 3260 3261 lff11m_8: 3262 000017C2 89C1 mov ecx, eax ; byte count 3263 lff11m_9: 3264 000017C4 BD06000000 mov ebp, 6 ; interpolation (one step) loop count 3265 lff11m_1: 3266 ; 5:4:4::5:4:4::5:4:4::5:4:4::5:4:4::5:4 ; 74/17 3267 000017C9 AC lodsb 3268 ; 02/02/2025 3269 000017CA 8A16 mov dl, [esi] 3270 000017CC 49 dec ecx 3271 000017CD 7502 jnz short lff11m_2_1 3272 000017CF B280 mov dl, 80h 3273 lff11m_2_1: 3274 ; al = [previous_val] 3275 ; dl = [next_val] 3276 000017D1 E8A0060000 call interpolating_5_8bit_mono 3277 000017D6 E328 jecxz lff11m_3 3278 lff11m_2_2: 3279 000017D8 AC lodsb 3280 ; 02/02/2025 3281 000017D9 8A16 mov dl, [esi] 3282 000017DB 49 dec ecx 3283 000017DC 7502 jnz short lff11m_2_3 3284 000017DE B280 mov dl, 80h 3285 lff11m_2_3: 3286 000017E0 E89D070000 call interpolating_4_8bit_mono 3287 000017E5 E319 jecxz lff11m_3 3288 3289 000017E7 4D dec ebp 3290 000017E8 74DA jz short lff11m_9 3291 3292 000017EA AC lodsb 3293 ; 02/02/2025 3294 000017EB 8A16 mov dl, [esi] 3295 000017ED 49 dec ecx 3296 000017EE 7502 jnz short lff11m_2_4 3297 000017F0 B280 mov dl, 80h 3298 lff11m_2_4: 3299 000017F2 E88B070000 call interpolating_4_8bit_mono 3300 000017F7 E307 jecxz lff11m_3 3301 000017F9 EBCE jmp short lff11m_1 3302 3303 lff11m_7: 3304 lff11s_7: 3305 000017FB E977F3FFFF jmp lff11_5 ; error 3306 3307 lff11m_3: 3308 lff11s_3: 3309 00001800 E951F3FFFF jmp lff11_3 ; padfill 3310 ; (put zeros in the remain words of the buffer) 3311 3312 load_11khz_stereo_8_bit: 3313 ; 02/02/2025 3314 ; 18/11/2023 3315 00001805 F605[106A0000]01 test byte [flags], ENDOFFILE ; have we already read the 3316 ; last of the file? 3317 0000180C 7402 jz short lff11s_0 ; no 3318 0000180E F9 stc 3319 0000180F C3 retn 3320 3321 lff11s_0: 3322 00001810 BE[00000400] mov esi, temp_buffer ; temporary buffer for wav data 3323 ;mov edx, [loadsize] 3324 3325 ; esi = buffer address 3326 ;; edx = buffer size 3327 3328 ; load file into memory 3329 sys _read, [FileHandle], esi, [loadsize] 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 00001815 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 0000181B 89F1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 0000181D 8B15[2D040000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00001823 B803000000 <1> mov eax, %1 90 <1> 91 00001828 CD40 <1> int 40h 3330 0000182A 72CF jc short lff11s_7 ; error ! 3331 3332 0000182C BF[00800000] mov edi, audio_buffer 3333 3334 00001831 D1E8 shr eax, 1 3335 00001833 7505 jnz short lff11s_8 3336 00001835 E934F3FFFF jmp lff11_eof 3337 3338 lff11s_8: 3339 0000183A 89C1 mov ecx, eax ; word count 3340 lff11s_9: 3341 0000183C BD06000000 mov ebp, 6 ; interpolation (one step) loop count 3342 lff11s_1: 3343 ; 5:4:4::5:4:4::5:4:4::5:4:4::5:4:4::5:4 ; 74/17 3344 00001841 66AD lodsw 3345 ; 02/02/2025 3346 00001843 668B16 mov dx, [esi] 3347 00001846 49 dec ecx 3348 00001847 7504 jnz short lff11s_2_1 3349 00001849 66BA8080 mov dx, 8080h 3350 lff11s_2_1: 3351 ; al = [previous_val_l] 3352 ; ah = [previous_val_r] 3353 ; dl = [next_val_l] 3354 ; dh = [next_val_r] 3355 0000184D E883060000 call interpolating_5_8bit_stereo 3356 00001852 E3AC jecxz lff11s_3 3357 lff11s_2_2: 3358 00001854 66AD lodsw 3359 ; 02/02/2025 3360 00001856 668B16 mov dx, [esi] 3361 00001859 49 dec ecx 3362 0000185A 7504 jnz short lff11s_2_3 3363 0000185C 66BA8080 mov dx, 8080h 3364 lff11s_2_3: 3365 00001860 E85C070000 call interpolating_4_8bit_stereo 3366 00001865 E399 jecxz lff11s_3 3367 3368 00001867 4D dec ebp 3369 00001868 74D2 jz short lff11s_9 3370 3371 0000186A 66AD lodsw 3372 ; 02/02/2025 3373 0000186C 668B16 mov dx, [esi] 3374 0000186F 49 dec ecx 3375 00001870 7504 jnz short lff11s_2_4 3376 00001872 66BA8080 mov dx, 8080h 3377 lff11s_2_4: 3378 00001876 E846070000 call interpolating_4_8bit_stereo 3379 0000187B E383 jecxz lff11s_3 3380 0000187D EBC2 jmp short lff11s_1 3381 3382 load_11khz_mono_16_bit: 3383 ; 02/02/2025 3384 ; 18/11/2023 3385 0000187F F605[106A0000]01 test byte [flags], ENDOFFILE ; have we already read the 3386 ; last of the file? 3387 00001886 7402 jz short lff11m2_0 ; no 3388 00001888 F9 stc 3389 00001889 C3 retn 3390 3391 lff11m2_0: 3392 0000188A BE[00000400] mov esi, temp_buffer ; temporary buffer for wav data 3393 ;mov edx, [loadsize] 3394 3395 ; esi = buffer address 3396 ;; edx = buffer size 3397 3398 ; load file into memory 3399 sys _read, [FileHandle], esi, [loadsize] 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 0000188F 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 00001895 89F1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 00001897 8B15[2D040000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 0000189D B803000000 <1> mov eax, %1 90 <1> 91 000018A2 CD40 <1> int 40h 3400 000018A4 724D jc short lff11m2_7 ; error ! 3401 3402 000018A6 BF[00800000] mov edi, audio_buffer 3403 3404 000018AB D1E8 shr eax, 1 3405 000018AD 7505 jnz short lff11m2_8 3406 000018AF E9BAF2FFFF jmp lff11_eof 3407 3408 lff11m2_8: 3409 000018B4 89C1 mov ecx, eax ; word count 3410 lff11m2_9: 3411 000018B6 BD06000000 mov ebp, 6 ; interpolation (one step) loop count 3412 lff11m2_1: 3413 ; 5:4:4::5:4:4::5:4:4::5:4:4::5:4:4::5:4 ; 74/17 3414 000018BB 66AD lodsw 3415 ; 02/02/2025 3416 000018BD 668B16 mov dx, [esi] 3417 000018C0 49 dec ecx 3418 000018C1 7502 jnz short lff11m2_2_1 3419 000018C3 31D2 xor edx, edx 3420 lff11m2_2_1: 3421 ; ax = [previous_val] 3422 ; dx = [next_val] 3423 000018C5 E864070000 call interpolating_5_16bit_mono 3424 000018CA E362 jecxz lff11m2_3 3425 lff11m2_2_2: 3426 000018CC 66AD lodsw 3427 ; 02/02/2025 3428 000018CE 668B16 mov dx, [esi] 3429 000018D1 49 dec ecx 3430 000018D2 7502 jnz short lff11m2_2_3 3431 000018D4 31D2 xor edx, edx 3432 lff11m2_2_3: 3433 000018D6 E87D080000 call interpolating_4_16bit_mono 3434 000018DB E351 jecxz lff11m2_3 3435 3436 000018DD 4D dec ebp 3437 000018DE 74D6 jz short lff11m2_9 3438 3439 000018E0 66AD lodsw 3440 ; 02/02/2025 3441 000018E2 668B16 mov dx, [esi] 3442 000018E5 49 dec ecx 3443 000018E6 7502 jnz short lff11m2_2_4 3444 000018E8 31D2 xor edx, edx 3445 lff11m2_2_4: 3446 000018EA E869080000 call interpolating_4_16bit_mono 3447 000018EF E33D jecxz lff11m2_3 3448 000018F1 EBC8 jmp short lff11m2_1 3449 3450 lff11m2_7: 3451 lff11s2_7: 3452 000018F3 E97FF2FFFF jmp lff11_5 ; error 3453 3454 load_11khz_stereo_16_bit: 3455 ; 17/01/2025 3456 ; 18/11/2023 3457 000018F8 F605[106A0000]01 test byte [flags], ENDOFFILE ; have we already read the 3458 ; last of the file? 3459 000018FF 7402 jz short lff11s2_0 ; no 3460 00001901 F9 stc 3461 00001902 C3 retn 3462 3463 lff11s2_0: 3464 00001903 BE[00000400] mov esi, temp_buffer ; temporary buffer for wav data 3465 ;mov edx, [loadsize] 3466 3467 ; esi = buffer address 3468 ;; edx = buffer size 3469 3470 ; load file into memory 3471 sys _read, [FileHandle], esi, [loadsize] 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 00001908 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 0000190E 89F1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 00001910 8B15[2D040000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00001916 B803000000 <1> mov eax, %1 90 <1> 91 0000191B CD40 <1> int 40h 3472 0000191D 72D4 jc short lff11s2_7 ; error ! 3473 3474 0000191F BF[00800000] mov edi, audio_buffer 3475 3476 00001924 C1E802 shr eax, 2 ; dword (left chan word + right chan word) 3477 00001927 750A jnz short lff11s2_8 3478 00001929 E940F2FFFF jmp lff11_eof 3479 3480 lff11m2_3: 3481 lff11s2_3: 3482 0000192E E923F2FFFF jmp lff11_3 ; padfill 3483 ; (put zeros in the remain words of the buffer) 3484 3485 lff11s2_8: 3486 00001933 89C1 mov ecx, eax ; dword count 3487 lff11s2_9: 3488 00001935 BD06000000 mov ebp, 6 ; interpolation (one step) loop count 3489 lff11s2_1: 3490 ; 5:4:4::5:4:4::5:4:4::5:4:4::5:4:4::5:4 ; 74/17 3491 0000193A 66AD lodsw 3492 0000193C 89C3 mov ebx, eax 3493 0000193E 66AD lodsw 3494 00001940 8B16 mov edx, [esi] 3495 ; 17/01/2025 3496 ;mov [next_val_l], edx 3497 ; 26/11/2023 3498 ;shr edx, 16 3499 ;mov [next_val_r], dx 3500 00001942 49 dec ecx 3501 00001943 7502 jnz short lff11s2_2_1 3502 00001945 31D2 xor edx, edx ; 0 3503 ;mov [next_val_l], dx 3504 ;mov [next_val_r], dx 3505 lff11s2_2_1: 3506 ; bx = [previous_val_l] 3507 ; ax = [previous_val_r] 3508 ; [next_val_l] 3509 ; dx = [next_val_r] 3510 ;;; 3511 ; 17/01/2025 (BugFix) 3512 00001947 8915[12220000] mov [next_val_l], edx 3513 ;;; 3514 0000194D E837070000 call interpolating_5_16bit_stereo 3515 00001952 E3DA jecxz lff11s2_3 3516 lff11s2_2_2: 3517 00001954 66AD lodsw 3518 00001956 89C3 mov ebx, eax 3519 00001958 66AD lodsw 3520 0000195A 8B16 mov edx, [esi] 3521 ; 17/01/2025 3522 ;mov [next_val_l], dx 3523 ; 26/11/2023 3524 ;shr edx, 16 3525 ;mov [next_val_r], dx 3526 0000195C 49 dec ecx 3527 0000195D 7502 jnz short lff11s2_2_3 3528 0000195F 31D2 xor edx, edx ; 0 3529 ;mov [next_val_l], dx 3530 ;mov [next_val_r], dx 3531 lff11s2_2_3: 3532 ;;; 3533 ; 17/01/2025 (BugFix) 3534 00001961 8915[12220000] mov [next_val_l], edx 3535 ;;; 3536 00001967 E825080000 call interpolating_4_16bit_stereo 3537 0000196C E3C0 jecxz lff11s2_3 3538 3539 0000196E 4D dec ebp 3540 0000196F 74C4 jz short lff11s2_9 3541 3542 00001971 66AD lodsw 3543 00001973 89C3 mov ebx, eax 3544 00001975 66AD lodsw 3545 00001977 8B16 mov edx, [esi] 3546 ; 17/01/2025 3547 ;mov [next_val_l], dx 3548 ; 26/11/2023 3549 ;shr edx, 16 3550 ;mov [next_val_r], dx 3551 00001979 49 dec ecx 3552 0000197A 7502 jnz short lff11s2_2_4 3553 0000197C 31D2 xor edx, edx ; 0 3554 ;mov [next_val_l], dx 3555 ;mov [next_val_r], dx 3556 lff11s2_2_4: 3557 ;;; 3558 ; 17/01/2025 (BugFix) 3559 0000197E 8915[12220000] mov [next_val_l], edx 3560 ;;; 3561 00001984 E808080000 call interpolating_4_16bit_stereo 3562 00001989 E3A3 jecxz lff11s2_3 3563 0000198B EBAD jmp short lff11s2_1 3564 3565 ; ..................... 3566 3567 load_44khz_mono_8_bit: 3568 ; 02/02/2025 3569 ; 18/11/2023 3570 0000198D F605[106A0000]01 test byte [flags], ENDOFFILE ; have we already read the 3571 ; last of the file? 3572 00001994 7402 jz short lff44m_0 ; no 3573 00001996 F9 stc 3574 00001997 C3 retn 3575 3576 lff44m_0: 3577 00001998 BE[00000400] mov esi, temp_buffer ; temporary buffer for wav data 3578 ;mov edx, [loadsize] 3579 3580 ; esi = buffer address 3581 ;; edx = buffer size 3582 3583 ; load file into memory 3584 sys _read, [FileHandle], esi, [loadsize] 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 0000199D 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 000019A3 89F1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 000019A5 8B15[2D040000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 000019AB B803000000 <1> mov eax, %1 90 <1> 91 000019B0 CD40 <1> int 40h 3585 000019B2 7250 jc short lff44m_7 ; error ! 3586 3587 000019B4 BF[00800000] mov edi, audio_buffer 3588 3589 000019B9 21C0 and eax, eax 3590 000019BB 7505 jnz short lff44m_8 3591 000019BD E9ACF1FFFF jmp lff44_eof 3592 3593 lff44m_8: 3594 000019C2 89C1 mov ecx, eax ; byte count 3595 lff44m_9: 3596 000019C4 BD0A000000 mov ebp, 10 ; interpolation (one step) loop count 3597 000019C9 C605[16220000]02 mov byte [faz], 2 ; 2 steps/phases 3598 lff44m_1: 3599 ; 2:1:1:1:1:1:1:1:1:1:1:: ; 25/23 3600 ; 2:1:1:1:1:1:1:1:1:1:1:1 3601 000019D0 AC lodsb 3602 ; 02/02/2025 3603 000019D1 8A16 mov dl, [esi] 3604 000019D3 49 dec ecx 3605 000019D4 7502 jnz short lff44m_2_1 3606 000019D6 B280 mov dl, 80h 3607 lff44m_2_1: 3608 ; al = [previous_val] 3609 ; dl = [next_val] 3610 000019D8 E871030000 call interpolating_2_8bit_mono 3611 000019DD E320 jecxz lff44m_3 3612 lff44m_2_2: 3613 000019DF AC lodsb 3614 000019E0 2C80 sub al, 80h 3615 000019E2 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3616 000019E6 66AB stosw ; (L) 3617 000019E8 66AB stosw ; (R) 3618 3619 000019EA 49 dec ecx 3620 000019EB 7412 jz short lff44m_3 3621 000019ED 4D dec ebp 3622 000019EE 75EF jnz short lff44m_2_2 3623 3624 000019F0 FE0D[16220000] dec byte [faz] 3625 000019F6 74CC jz short lff44m_9 3626 000019F8 BD0B000000 mov ebp, 11 3627 000019FD EBD1 jmp short lff44m_1 3628 3629 lff44m_3: 3630 lff44s_3: 3631 000019FF E952F1FFFF jmp lff44_3 ; padfill 3632 ; (put zeros in the remain words of the buffer) 3633 lff44m_7: 3634 lff44s_7: 3635 00001A04 E96EF1FFFF jmp lff44_5 ; error 3636 3637 load_44khz_stereo_8_bit: 3638 ; 02/02/2025 3639 ; 16/11/2023 3640 00001A09 F605[106A0000]01 test byte [flags], ENDOFFILE ; have we already read the 3641 ; last of the file? 3642 00001A10 7402 jz short lff44s_0 ; no 3643 00001A12 F9 stc 3644 00001A13 C3 retn 3645 3646 lff44s_0: 3647 00001A14 BE[00000400] mov esi, temp_buffer ; temporary buffer for wav data 3648 ;mov edx, [loadsize] 3649 3650 ; esi = buffer address 3651 ;; edx = buffer size 3652 3653 ; load file into memory 3654 sys _read, [FileHandle], esi, [loadsize] 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 00001A19 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 00001A1F 89F1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 00001A21 8B15[2D040000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00001A27 B803000000 <1> mov eax, %1 90 <1> 91 00001A2C CD40 <1> int 40h 3655 00001A2E 72D4 jc short lff44s_7 ; error ! 3656 3657 00001A30 BF[00800000] mov edi, audio_buffer 3658 3659 00001A35 D1E8 shr eax, 1 3660 00001A37 7505 jnz short lff44s_8 3661 00001A39 E930F1FFFF jmp lff44_eof 3662 3663 lff44s_8: 3664 00001A3E 89C1 mov ecx, eax ; word count 3665 lff44s_9: 3666 00001A40 BD0A000000 mov ebp, 10 ; interpolation (one step) loop count 3667 00001A45 C605[16220000]02 mov byte [faz], 2 ; 2 steps/phase 3668 lff44s_1: 3669 ; 2:1:1:1:1:1:1:1:1:1:1:: ; 25/23 3670 ; 2:1:1:1:1:1:1:1:1:1:1:1 3671 00001A4C 66AD lodsw 3672 ; 02/02/2025 3673 00001A4E 668B16 mov dx, [esi] 3674 00001A51 49 dec ecx 3675 00001A52 7504 jnz short lff44s_2_1 3676 00001A54 66BA8080 mov dx, 8080h 3677 lff44s_2_1: 3678 ; al = [previous_val_l] 3679 ; ah = [previous_val_r] 3680 ; dl = [next_val_l] 3681 ; dh = [next_val_r] 3682 00001A58 E80E030000 call interpolating_2_8bit_stereo 3683 00001A5D E3A0 jecxz lff44s_3 3684 lff44s_2_2: 3685 00001A5F AC lodsb 3686 00001A60 2C80 sub al, 80h 3687 00001A62 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3688 00001A66 66AB stosw ; (L) 3689 00001A68 AC lodsb 3690 00001A69 2C80 sub al, 80h 3691 00001A6B 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3692 00001A6F 66AB stosw ; (R) 3693 3694 00001A71 49 dec ecx 3695 00001A72 748B jz short lff44s_3 3696 00001A74 4D dec ebp 3697 00001A75 75E8 jnz short lff44s_2_2 3698 3699 00001A77 FE0D[16220000] dec byte [faz] 3700 00001A7D 74C1 jz short lff44s_9 3701 00001A7F BD0B000000 mov ebp, 11 3702 00001A84 EBC6 jmp short lff44s_1 3703 3704 load_44khz_mono_16_bit: 3705 ; 02/02/2025 3706 ; 18/11/2023 3707 00001A86 F605[106A0000]01 test byte [flags], ENDOFFILE ; have we already read the 3708 ; last of the file? 3709 00001A8D 7402 jz short lff44m2_0 ; no 3710 00001A8F F9 stc 3711 00001A90 C3 retn 3712 3713 lff44m2_0: 3714 00001A91 BE[00000400] mov esi, temp_buffer ; temporary buffer for wav data 3715 ;mov edx, [loadsize] 3716 3717 ; esi = buffer address 3718 ;; edx = buffer size 3719 3720 ; load file into memory 3721 sys _read, [FileHandle], esi, [loadsize] 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 00001A96 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 00001A9C 89F1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 00001A9E 8B15[2D040000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00001AA4 B803000000 <1> mov eax, %1 90 <1> 91 00001AA9 CD40 <1> int 40h 3722 00001AAB 724D jc short lff44m2_7 ; error ! 3723 3724 00001AAD BF[00800000] mov edi, audio_buffer 3725 3726 00001AB2 D1E8 shr eax, 1 3727 00001AB4 7505 jnz short lff44m2_8 3728 00001AB6 E9B3F0FFFF jmp lff44_eof 3729 3730 lff44m2_8: 3731 00001ABB 89C1 mov ecx, eax ; word count 3732 lff44m2_9: 3733 00001ABD BD0A000000 mov ebp, 10 ; interpolation (one step) loop count 3734 00001AC2 C605[16220000]02 mov byte [faz], 2 ; 2 steps/phases 3735 lff44m2_1: 3736 ; 2:1:1:1:1:1:1:1:1:1:1:: ; 25/23 3737 ; 2:1:1:1:1:1:1:1:1:1:1:1 3738 00001AC9 66AD lodsw 3739 ; 02/02/2025 3740 00001ACB 668B16 mov dx, [esi] 3741 00001ACE 49 dec ecx 3742 00001ACF 7502 jnz short lff44m2_2_1 3743 00001AD1 31D2 xor edx, edx 3744 lff44m2_2_1: 3745 ; ax = [previous_val] 3746 ; dx = [next_val] 3747 00001AD3 E857030000 call interpolating_2_16bit_mono 3748 00001AD8 E31B jecxz lff44m2_3 3749 lff44m2_2_2: 3750 00001ADA 66AD lodsw 3751 00001ADC 66AB stosw ; (L)eft Channel 3752 00001ADE 66AB stosw ; (R)ight Channel 3753 3754 00001AE0 49 dec ecx 3755 00001AE1 7412 jz short lff44m2_3 3756 00001AE3 4D dec ebp 3757 00001AE4 75F4 jnz short lff44m2_2_2 3758 3759 00001AE6 FE0D[16220000] dec byte [faz] 3760 00001AEC 74CF jz short lff44m2_9 3761 00001AEE BD0B000000 mov ebp, 11 3762 00001AF3 EBD4 jmp short lff44m2_1 3763 3764 lff44m2_3: 3765 lff44s2_3: 3766 00001AF5 E95CF0FFFF jmp lff44_3 ; padfill 3767 ; (put zeros in the remain words of the buffer) 3768 lff44m2_7: 3769 lff44s2_7: 3770 00001AFA E978F0FFFF jmp lff44_5 ; error 3771 3772 load_44khz_stereo_16_bit: 3773 ; 18/11/2023 3774 00001AFF F605[106A0000]01 test byte [flags], ENDOFFILE ; have we already read the 3775 ; last of the file? 3776 00001B06 7402 jz short lff44s2_0 ; no 3777 00001B08 F9 stc 3778 00001B09 C3 retn 3779 3780 lff44s2_0: 3781 00001B0A BE[00000400] mov esi, temp_buffer ; temporary buffer for wav data 3782 ;mov edx, [loadsize] 3783 3784 ; esi = buffer address 3785 ;; edx = buffer size 3786 3787 ; load file into memory 3788 sys _read, [FileHandle], esi, [loadsize] 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 00001B0F 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 00001B15 89F1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 00001B17 8B15[2D040000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00001B1D B803000000 <1> mov eax, %1 90 <1> 91 00001B22 CD40 <1> int 40h 3789 00001B24 72D4 jc short lff44s2_7 ; error ! 3790 3791 00001B26 BF[00800000] mov edi, audio_buffer 3792 3793 00001B2B C1E802 shr eax, 2 ; dword (left chan word + right chan word) 3794 00001B2E 7505 jnz short lff44s2_8 3795 00001B30 E939F0FFFF jmp lff44_eof 3796 3797 lff44s2_8: 3798 00001B35 89C1 mov ecx, eax ; dword count 3799 lff44s2_9: 3800 00001B37 BD0A000000 mov ebp, 10 ; interpolation (one step) loop count 3801 00001B3C C605[16220000]02 mov byte [faz], 2 ; 2 steps/phase 3802 lff44s2_1: 3803 ; 2:1:1:1:1:1:1:1:1:1:1:: ; 25/23 3804 ; 2:1:1:1:1:1:1:1:1:1:1:1 3805 00001B43 66AD lodsw 3806 00001B45 89C3 mov ebx, eax 3807 00001B47 66AD lodsw 3808 ;mov dx, [esi] 3809 ;mov [next_val_l], dx 3810 ;mov dx, [esi+2] 3811 ; 26/11/2023 3812 00001B49 8B16 mov edx, [esi] 3813 00001B4B 668915[12220000] mov [next_val_l], dx 3814 00001B52 C1EA10 shr edx, 16 3815 00001B55 49 dec ecx 3816 00001B56 7509 jnz short lff44s2_2_1 3817 00001B58 31D2 xor edx, edx ; 0 3818 00001B5A 668915[12220000] mov [next_val_l], dx 3819 lff44s2_2_1: 3820 ; bx = [previous_val_l] 3821 ; ax = [previous_val_r] 3822 ; [next_val_l] 3823 ; dx = [next_val_r] 3824 00001B61 E8E1020000 call interpolating_2_16bit_stereo 3825 00001B66 E38D jecxz lff44s2_3 3826 lff44s2_2_2: 3827 ;movsw ; (L)eft Channel 3828 ;movsw ; (R)ight Channel 3829 00001B68 A5 movsd 3830 3831 00001B69 49 dec ecx 3832 00001B6A 7489 jz short lff44s2_3 3833 00001B6C 4D dec ebp 3834 00001B6D 75F9 jnz short lff44s2_2_2 3835 3836 00001B6F FE0D[16220000] dec byte [faz] 3837 00001B75 74C0 jz short lff44s2_9 3838 00001B77 BD0B000000 mov ebp, 11 3839 00001B7C EBC5 jmp short lff44s2_1 3840 3841 ; ..................... 3842 3843 ; 02/02/2025 3844 load_12khz_mono_8_bit: 3845 00001B7E F605[106A0000]01 test byte [flags], ENDOFFILE ; have we already read the 3846 ; last of the file? 3847 00001B85 7402 jz short lff12m_0 ; no 3848 00001B87 F9 stc 3849 00001B88 C3 retn 3850 3851 lff12m_0: 3852 00001B89 BE[00000400] mov esi, temp_buffer ; temporary buffer for wav data 3853 3854 ; load file into memory 3855 sys _read, [FileHandle], esi, [loadsize] 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 00001B8E 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 00001B94 89F1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 00001B96 8B15[2D040000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00001B9C B803000000 <1> mov eax, %1 90 <1> 91 00001BA1 CD40 <1> int 40h 3856 00001BA3 7256 jc short lff12m_7 ; error ! 3857 3858 00001BA5 BF[00800000] mov edi, audio_buffer 3859 3860 00001BAA 21C0 and eax, eax 3861 00001BAC 7505 jnz short lff12m_8 3862 00001BAE E9BBEFFFFF jmp lff12_eof 3863 3864 lff12m_8: 3865 00001BB3 89C1 mov ecx, eax ; byte count 3866 lff12m_1: 3867 ; original-interpolated-interpolated-interpolated 3868 00001BB5 AC lodsb 3869 ; 02/02/2025 3870 00001BB6 8A16 mov dl, [esi] 3871 00001BB8 49 dec ecx 3872 00001BB9 7502 jnz short lff12m_2 3873 00001BBB B280 mov dl, 80h 3874 lff12m_2: 3875 ; al = [previous_val] 3876 ; dl = [next_val] 3877 00001BBD E8C0030000 call interpolating_4_8bit_mono 3878 00001BC2 E353 jecxz lff12m_3 3879 00001BC4 EBEF jmp short lff12m_1 3880 3881 ; 02/02/2025 3882 load_12khz_stereo_8_bit: 3883 00001BC6 F605[106A0000]01 test byte [flags], ENDOFFILE ; have we already read the 3884 ; last of the file? 3885 00001BCD 7402 jz short lff12s_0 ; no 3886 00001BCF F9 stc 3887 00001BD0 C3 retn 3888 3889 lff12s_0: 3890 00001BD1 BE[00000400] mov esi, temp_buffer ; temporary buffer for wav data 3891 3892 ; load file into memory 3893 sys _read, [FileHandle], esi, [loadsize] 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 00001BD6 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 00001BDC 89F1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 00001BDE 8B15[2D040000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00001BE4 B803000000 <1> mov eax, %1 90 <1> 91 00001BE9 CD40 <1> int 40h 3894 00001BEB 720E jc short lff12s_7 ; error ! 3895 3896 00001BED BF[00800000] mov edi, audio_buffer 3897 3898 00001BF2 D1E8 shr eax, 1 3899 00001BF4 750A jnz short lff12s_8 3900 00001BF6 E973EFFFFF jmp lff12_eof 3901 3902 lff12m_7: 3903 lff12s_7: 3904 00001BFB E977EFFFFF jmp lff12_5 ; error 3905 3906 lff12s_8: 3907 00001C00 89C1 mov ecx, eax ; word count 3908 lff12s_1: 3909 ; original-interpolated-interpolated-interpolated 3910 00001C02 66AD lodsw 3911 ; 02/02/2025 3912 00001C04 668B16 mov dx, [esi] 3913 00001C07 49 dec ecx 3914 00001C08 7504 jnz short lff12s_2 3915 00001C0A 66BA8080 mov dx, 8080h 3916 lff12s_2: 3917 ; al = [previous_val_l] 3918 ; ah = [previous_val_r] 3919 ; dl = [next_val_l] 3920 ; dh = [next_val_r] 3921 00001C0E E8AE030000 call interpolating_4_8bit_stereo 3922 00001C13 E302 jecxz lff12s_3 3923 00001C15 EBEB jmp short lff12s_1 3924 3925 lff12m_3: 3926 lff12s_3: 3927 00001C17 E93AEFFFFF jmp lff12_3 ; padfill 3928 ; (put zeros in the remain words of the buffer) 3929 3930 ; 02/02/2025 3931 load_12khz_mono_16_bit: 3932 00001C1C F605[106A0000]01 test byte [flags], ENDOFFILE ; have we already read the 3933 ; last of the file? 3934 00001C23 7402 jz short lff12m2_0 ; no 3935 00001C25 F9 stc 3936 00001C26 C3 retn 3937 3938 lff12m2_0: 3939 00001C27 BE[00000400] mov esi, temp_buffer ; temporary buffer for wav data 3940 3941 ; load file into memory 3942 sys _read, [FileHandle], esi, [loadsize] 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 00001C2C 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 00001C32 89F1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 00001C34 8B15[2D040000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00001C3A B803000000 <1> mov eax, %1 90 <1> 91 00001C3F CD40 <1> int 40h 3943 00001C41 7223 jc short lff12m2_7 ; error ! 3944 3945 00001C43 BF[00800000] mov edi, audio_buffer 3946 3947 00001C48 D1E8 shr eax, 1 3948 00001C4A 7505 jnz short lff12m2_8 3949 00001C4C E91DEFFFFF jmp lff12_eof 3950 3951 lff12m2_8: 3952 00001C51 89C1 mov ecx, eax ; word count 3953 lff12m2_1: 3954 ; original-interpolated-interpolated-interpolated 3955 00001C53 66AD lodsw 3956 ; 02/02/2025 3957 00001C55 668B16 mov dx, [esi] 3958 00001C58 49 dec ecx 3959 00001C59 7502 jnz short lff12m2_2 3960 00001C5B 31D2 xor edx, edx 3961 lff12m2_2: 3962 ; ax = [previous_val] 3963 ; dx = [next_val] 3964 00001C5D E8F6040000 call interpolating_4_16bit_mono 3965 00001C62 E3B3 jecxz lff12m_3 3966 00001C64 EBED jmp short lff12m2_1 3967 3968 lff12m2_7: 3969 lff12s2_7: 3970 00001C66 E90CEFFFFF jmp lff12_5 ; error 3971 3972 ; 02/02/2025 3973 load_12khz_stereo_16_bit: 3974 00001C6B F605[106A0000]01 test byte [flags], ENDOFFILE ; have we already read the 3975 ; last of the file? 3976 00001C72 7402 jz short lff12s2_0 ; no 3977 00001C74 F9 stc 3978 00001C75 C3 retn 3979 3980 lff12s2_0: 3981 00001C76 BE[00000400] mov esi, temp_buffer ; temporary buffer for wav data 3982 3983 ; load file into memory 3984 sys _read, [FileHandle], esi, [loadsize] 76 <1> 77 <1> 78 <1> 79 <1> 80 <1> %if %0 >= 2 81 00001C7B 8B1D[D3660000] <1> mov ebx, %2 82 <1> %if %0 >= 3 83 00001C81 89F1 <1> mov ecx, %3 84 <1> %if %0 = 4 85 00001C83 8B15[2D040000] <1> mov edx, %4 86 <1> %endif 87 <1> %endif 88 <1> %endif 89 00001C89 B803000000 <1> mov eax, %1 90 <1> 91 00001C8E CD40 <1> int 40h 3985 00001C90 72D4 jc short lff12s2_7 ; error ! 3986 3987 00001C92 BF[00800000] mov edi, audio_buffer 3988 3989 00001C97 C1E802 shr eax, 2 ; dword (left chan word + right chan word) 3990 00001C9A 750A jnz short lff12s2_8 3991 00001C9C E9CDEEFFFF jmp lff12_eof 3992 3993 lff12m2_3: 3994 lff12s2_3: 3995 00001CA1 E9B0EEFFFF jmp lff12_3 ; padfill 3996 ; (put zeros in the remain words of the buffer) 3997 3998 lff12s2_8: 3999 00001CA6 89C1 mov ecx, eax ; dword count 4000 lff12s2_1: 4001 ; original-interpolated-interpolated-interpolated 4002 00001CA8 66AD lodsw 4003 00001CAA 89C3 mov ebx, eax 4004 00001CAC 66AD lodsw 4005 00001CAE 8B16 mov edx, [esi] 4006 00001CB0 49 dec ecx 4007 00001CB1 7502 jnz short lff12s2_2 4008 00001CB3 31D2 xor edx, edx ; 0 4009 lff12s2_2: 4010 ;mov [next_val_l], dx 4011 ;shr edx, 16 4012 ;mov [next_val_r], dx 4013 ; 02/02/2025 4014 00001CB5 8915[12220000] mov [next_val_l], edx 4015 4016 ; bx = [previous_val_l] 4017 ; ax = [previous_val_r] 4018 ; [next_val_l] 4019 ; [next_val_r] 4020 00001CBB E8D1040000 call interpolating_4_16bit_stereo 4021 00001CC0 E3DF jecxz lff12s2_3 4022 00001CC2 EBE4 jmp short lff12s2_1 4023 4024 ; ..................... 4025 4026 interpolating_3_8bit_mono: 4027 ; 02/02/2025 4028 ; 16/11/2023 4029 ; al = [previous_val] 4030 ; dl = [next_val] 4031 ; original-interpolated-interpolated 4032 00001CC4 88C3 mov bl, al 4033 00001CC6 2C80 sub al, 80h 4034 00001CC8 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4035 00001CCC 66AB stosw ; original sample (L) 4036 00001CCE 66AB stosw ; original sample (R) 4037 00001CD0 88D8 mov al, bl 4038 00001CD2 00D0 add al, dl 4039 00001CD4 D0D8 rcr al, 1 4040 00001CD6 88C7 mov bh, al ; interpolated middle (temporary) 4041 00001CD8 00D8 add al, bl 4042 00001CDA D0D8 rcr al, 1 4043 00001CDC 2C80 sub al, 80h 4044 00001CDE 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4045 00001CE2 66AB stosw ; interpolated sample 1 (L) 4046 00001CE4 66AB stosw ; interpolated sample 1 (R) 4047 00001CE6 88F8 mov al, bh 4048 00001CE8 00D0 add al, dl ; [next_val] 4049 00001CEA D0D8 rcr al, 1 4050 ; 02/02/2025 4051 00001CEC 2C80 sub al, 80h 4052 00001CEE 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4053 00001CF2 66AB stosw ; interpolated sample 2 (L) 4054 00001CF4 66AB stosw ; interpolated sample 2 (R) 4055 00001CF6 C3 retn 4056 4057 interpolating_3_8bit_stereo: 4058 ; 02/02/2025 4059 ; 16/11/2023 4060 ; al = [previous_val_l] 4061 ; ah = [previous_val_r] 4062 ; dl = [next_val_l] 4063 ; dh = [next_val_r] 4064 ; original-interpolated-interpolated 4065 00001CF7 89C3 mov ebx, eax 4066 00001CF9 2C80 sub al, 80h 4067 00001CFB 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4068 00001CFF 66AB stosw ; original sample (L) 4069 00001D01 88F8 mov al, bh 4070 00001D03 2C80 sub al, 80h 4071 00001D05 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4072 00001D09 66AB stosw ; original sample (R) 4073 00001D0B 88D8 mov al, bl 4074 00001D0D 00D0 add al, dl ; [next_val_l] 4075 00001D0F D0D8 rcr al, 1 4076 00001D11 50 push eax ; * ; al = interpolated middle (L) (temporary) 4077 00001D12 00D8 add al, bl ; [previous_val_l] 4078 00001D14 D0D8 rcr al, 1 4079 00001D16 2C80 sub al, 80h 4080 00001D18 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4081 00001D1C 66AB stosw ; interpolated sample 1 (L) 4082 00001D1E 88F8 mov al, bh 4083 00001D20 00F0 add al, dh ; [next_val_r] 4084 00001D22 D0D8 rcr al, 1 4085 00001D24 50 push eax ; ** ; al = interpolated middle (R) (temporary) 4086 00001D25 00F8 add al, bh ; [previous_val_r] 4087 00001D27 D0D8 rcr al, 1 4088 00001D29 2C80 sub al, 80h 4089 00001D2B 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4090 00001D2F 66AB stosw ; interpolated sample 1 (R) 4091 00001D31 5B pop ebx ; ** 4092 00001D32 58 pop eax ; * 4093 00001D33 00D0 add al, dl ; [next_val_l] 4094 00001D35 D0D8 rcr al, 1 4095 ; 02/02/2025 4096 00001D37 2C80 sub al, 80h 4097 00001D39 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4098 00001D3D 66AB stosw ; interpolated sample 2 (L) 4099 00001D3F 88D8 mov al, bl 4100 00001D41 00F0 add al, dh ; [next_val_r] 4101 00001D43 D0D8 rcr al, 1 4102 ; 02/02/2025 4103 00001D45 2C80 sub al, 80h 4104 00001D47 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4105 00001D4B 66AB stosw ; interpolated sample 2 (R) 4106 00001D4D C3 retn 4107 4108 interpolating_2_8bit_mono: 4109 ; 16/11/2023 4110 ; al = [previous_val] 4111 ; dl = [next_val] 4112 ; original-interpolated 4113 00001D4E 88C3 mov bl, al 4114 00001D50 2C80 sub al, 80h 4115 00001D52 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4116 00001D56 66AB stosw ; original sample (L) 4117 00001D58 66AB stosw ; original sample (R) 4118 00001D5A 88D8 mov al, bl 4119 00001D5C 00D0 add al, dl 4120 00001D5E D0D8 rcr al, 1 4121 00001D60 2C80 sub al, 80h 4122 00001D62 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4123 00001D66 66AB stosw ; interpolated sample (L) 4124 00001D68 66AB stosw ; interpolated sample (R) 4125 00001D6A C3 retn 4126 4127 interpolating_2_8bit_stereo: 4128 ; 16/11/2023 4129 ; al = [previous_val_l] 4130 ; ah = [previous_val_r] 4131 ; dl = [next_val_l] 4132 ; dh = [next_val_r] 4133 ; original-interpolated 4134 00001D6B 89C3 mov ebx, eax 4135 00001D6D 2C80 sub al, 80h 4136 00001D6F 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4137 00001D73 66AB stosw ; original sample (L) 4138 00001D75 88F8 mov al, bh 4139 00001D77 2C80 sub al, 80h 4140 00001D79 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4141 00001D7D 66AB stosw ; original sample (R) 4142 00001D7F 88D8 mov al, bl ; [previous_val_l] 4143 00001D81 00D0 add al, dl ; [next_val_l] 4144 00001D83 D0D8 rcr al, 1 4145 00001D85 2C80 sub al, 80h 4146 00001D87 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4147 00001D8B 66AB stosw ; interpolated sample (L) 4148 00001D8D 88F8 mov al, bh 4149 00001D8F 00F0 add al, dh ; [next_val_r] 4150 00001D91 D0D8 rcr al, 1 4151 00001D93 2C80 sub al, 80h 4152 00001D95 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4153 00001D99 66AB stosw ; interpolated sample (R) 4154 00001D9B C3 retn 4155 4156 interpolating_3_16bit_mono: 4157 ; 16/11/2023 4158 ; ax = [previous_val] 4159 ; dx = [next_val] 4160 ; original-interpolated-interpolated 4161 4162 00001D9C 66AB stosw ; original sample (L) 4163 00001D9E 66AB stosw ; original sample (R) 4164 00001DA0 80C480 add ah, 80h ; convert sound level 0 to 65535 format 4165 00001DA3 50 push eax ; * ; [previous_val] 4166 00001DA4 80C680 add dh, 80h 4167 00001DA7 6601D0 add ax, dx 4168 00001DAA 66D1D8 rcr ax, 1 4169 00001DAD 5B pop ebx ; * 4170 00001DAE 93 xchg ebx, eax ; bx = interpolated middle (temporary) 4171 00001DAF 6601D8 add ax, bx ; [previous_val] + interpolated middle 4172 00001DB2 66D1D8 rcr ax, 1 4173 00001DB5 80EC80 sub ah, 80h ; -32768 to +32767 format again 4174 00001DB8 66AB stosw ; interpolated sample 1 (L) 4175 00001DBA 66AB stosw ; interpolated sample 1 (R) 4176 00001DBC 89D8 mov eax, ebx 4177 00001DBE 6601D0 add ax, dx ; interpolated middle + [next_val] 4178 00001DC1 66D1D8 rcr ax, 1 4179 00001DC4 80EC80 sub ah, 80h ; -32768 to +32767 format again 4180 00001DC7 66AB stosw ; interpolated sample 2 (L) 4181 00001DC9 66AB stosw ; interpolated sample 2 (R) 4182 00001DCB C3 retn 4183 4184 interpolating_3_16bit_stereo: 4185 ; 16/11/2023 4186 ; bx = [previous_val_l] 4187 ; ax = [previous_val_r] 4188 ; [next_val_l] 4189 ; dx = [next_val_r] 4190 ; original-interpolated-interpolated 4191 4192 00001DCC 93 xchg eax, ebx 4193 00001DCD 66AB stosw ; original sample (L) 4194 00001DCF 93 xchg eax, ebx 4195 00001DD0 66AB stosw ; original sample (R) 4196 00001DD2 80C480 add ah, 80h ; convert sound level 0 to 65535 format 4197 00001DD5 50 push eax ; * ; [previous_val_r] 4198 00001DD6 80C780 add bh, 80h 4199 00001DD9 8005[13220000]80 add byte [next_val_l+1], 80h 4200 00001DE0 66A1[12220000] mov ax, [next_val_l] 4201 00001DE6 6601D8 add ax, bx ; [previous_val_l] 4202 00001DE9 66D1D8 rcr ax, 1 4203 00001DEC 93 xchg eax, ebx ; ax = [previous_val_l] 4204 00001DED 6601D8 add ax, bx ; bx = interpolated middle (L) 4205 00001DF0 66D1D8 rcr ax, 1 4206 00001DF3 80EC80 sub ah, 80h ; -32768 to +32767 format again 4207 00001DF6 66AB stosw ; interpolated sample 1 (L) 4208 00001DF8 58 pop eax ; * 4209 00001DF9 80C680 add dh, 80h ; convert sound level 0 to 65535 format 4210 00001DFC 52 push edx ; * ; [next_val_r] 4211 00001DFD 92 xchg eax, edx 4212 00001DFE 6601D0 add ax, dx ; [next_val_r] + [previous_val_r] 4213 00001E01 66D1D8 rcr ax, 1 ; / 2 4214 00001E04 50 push eax ; ** ; interpolated middle (R) 4215 00001E05 6601D0 add ax, dx ; + [previous_val_r] 4216 00001E08 66D1D8 rcr ax, 1 4217 00001E0B 80EC80 sub ah, 80h ; -32768 to +32767 format again 4218 00001E0E 66AB stosw ; interpolated sample 1 (R) 4219 00001E10 66A1[12220000] mov ax, [next_val_l] 4220 00001E16 6601D8 add ax, bx ; + interpolated middle (L) 4221 00001E19 66D1D8 rcr ax, 1 4222 00001E1C 80EC80 sub ah, 80h ; -32768 to +32767 format again 4223 00001E1F 66AB stosw ; interpolated sample 2 (L) 4224 00001E21 58 pop eax ; ** 4225 00001E22 5A pop edx ; * 4226 00001E23 6601D0 add ax, dx ; interpolated middle + [next_val_r] 4227 00001E26 66D1D8 rcr ax, 1 ; / 2 4228 00001E29 80EC80 sub ah, 80h ; -32768 to +32767 format again 4229 00001E2C 66AB stosw ; interpolated sample 2 (L) 4230 00001E2E C3 retn 4231 4232 interpolating_2_16bit_mono: 4233 ; 16/11/2023 4234 ; ax = [previous_val] 4235 ; dx = [next_val] 4236 ; original-interpolated 4237 4238 00001E2F 66AB stosw ; original sample (L) 4239 00001E31 66AB stosw ; original sample (R) 4240 00001E33 80C480 add ah, 80h ; convert sound level 0 to 65535 format 4241 00001E36 80C680 add dh, 80h 4242 00001E39 6601D0 add ax, dx 4243 00001E3C 66D1D8 rcr ax, 1 4244 00001E3F 80EC80 sub ah, 80h ; -32768 to +32767 format again 4245 00001E42 66AB stosw ; interpolated sample (L) 4246 00001E44 66AB stosw ; interpolated sample (R) 4247 00001E46 C3 retn 4248 4249 interpolating_2_16bit_stereo: 4250 ; 17/01/2025 4251 ; 16/11/2023 4252 ; bx = [previous_val_l] 4253 ; ax = [previous_val_r] 4254 ; [next_val_l] 4255 ; dx = [next_val_r] 4256 ; original-interpolated 4257 4258 00001E47 93 xchg eax, ebx 4259 00001E48 66AB stosw ; original sample (L) 4260 00001E4A 93 xchg eax, ebx 4261 00001E4B 66AB stosw ; original sample (R) 4262 00001E4D 80C480 add ah, 80h ; convert sound level 0 to 65535 format 4263 00001E50 80C680 add dh, 80h 4264 00001E53 6601D0 add ax, dx ; [previous_val_r] + [next_val_r] 4265 00001E56 66D1D8 rcr ax, 1 ; / 2 4266 ; 17/01/2025 4267 00001E59 80EC80 sub ah, 80h ; -32768 to +32767 format again 4268 ;push eax ; * ; interpolated sample (R) 4269 ; 17/01/2025 4270 00001E5C C1E010 shl eax, 16 4271 00001E5F 66A1[12220000] mov ax, [next_val_l] 4272 00001E65 80C480 add ah, 80h 4273 00001E68 80C780 add bh, 80h 4274 00001E6B 6601D8 add ax, bx ; [next_val_l] + [previous_val_l] 4275 00001E6E 66D1D8 rcr ax, 1 ; / 2 4276 00001E71 80EC80 sub ah, 80h ; -32768 to +32767 format again 4277 ; 17/01/2025 4278 ;stosw ; interpolated sample (L) 4279 ;pop eax ; * 4280 ;sub ah, 80h ; -32768 to +32767 format again 4281 ;stosw ; interpolated sample (R) 4282 ; 17/01/2025 4283 00001E74 AB stosd 4284 00001E75 C3 retn 4285 4286 interpolating_5_8bit_mono: 4287 ; 17/11/2023 4288 ; al = [previous_val] 4289 ; dl = [next_val] 4290 ; original-interpltd-interpltd-interpltd-interpltd 4291 00001E76 88C3 mov bl, al 4292 00001E78 2C80 sub al, 80h 4293 00001E7A 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4294 00001E7E 66AB stosw ; original sample (L) 4295 00001E80 66AB stosw ; original sample (R) 4296 00001E82 88D8 mov al, bl 4297 00001E84 00D0 add al, dl 4298 00001E86 D0D8 rcr al, 1 4299 00001E88 88C7 mov bh, al ; interpolated middle (temporary) 4300 00001E8A 00D8 add al, bl ; [previous_val] 4301 00001E8C D0D8 rcr al, 1 4302 00001E8E 88C6 mov dh, al ; interpolated 1st quarter (temporary) 4303 00001E90 00D8 add al, bl 4304 00001E92 D0D8 rcr al, 1 4305 00001E94 2C80 sub al, 80h 4306 00001E96 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4307 00001E9A 66AB stosw ; interpolated sample 1 (L) 4308 00001E9C 66AB stosw ; interpolated sample 1 (R) 4309 00001E9E 88F8 mov al, bh 4310 00001EA0 00F0 add al, dh 4311 00001EA2 D0D8 rcr al, 1 4312 00001EA4 2C80 sub al, 80h 4313 00001EA6 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4314 00001EAA 66AB stosw ; interpolated sample 2 (L) 4315 00001EAC 66AB stosw ; interpolated sample 2 (R) 4316 00001EAE 88F8 mov al, bh 4317 00001EB0 00D0 add al, dl ; [next_val] 4318 00001EB2 D0D8 rcr al, 1 4319 00001EB4 88C6 mov dh, al ; interpolated 3rd quarter (temporary) 4320 00001EB6 00F8 add al, bh 4321 00001EB8 D0D8 rcr al, 1 4322 00001EBA 2C80 sub al, 80h 4323 00001EBC 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4324 00001EC0 66AB stosw ; interpolated sample 3 (L) 4325 00001EC2 66AB stosw ; interpolated sample 3 (R) 4326 00001EC4 88F0 mov al, dh 4327 00001EC6 00D0 add al, dl 4328 00001EC8 D0D8 rcr al, 1 4329 00001ECA 2C80 sub al, 80h 4330 00001ECC 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4331 00001ED0 66AB stosw ; interpolated sample 4 (L) 4332 00001ED2 66AB stosw ; interpolated sample 4 (R) 4333 00001ED4 C3 retn 4334 4335 interpolating_5_8bit_stereo: 4336 ; 17/11/2023 4337 ; al = [previous_val_l] 4338 ; ah = [previous_val_r] 4339 ; dl = [next_val_l] 4340 ; dh = [next_val_r] 4341 ; original-interpltd-interpltd-interpltd-interpltd 4342 00001ED5 89C3 mov ebx, eax 4343 00001ED7 2C80 sub al, 80h 4344 00001ED9 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4345 00001EDD 66AB stosw ; original sample (L) 4346 00001EDF 88F8 mov al, bh 4347 00001EE1 2C80 sub al, 80h 4348 00001EE3 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4349 00001EE7 66AB stosw ; original sample (R) 4350 00001EE9 52 push edx ; * 4351 00001EEA 88D8 mov al, bl 4352 00001EEC 00D0 add al, dl ; [next_val_l] 4353 00001EEE D0D8 rcr al, 1 4354 00001EF0 50 push eax ; ** ; al = interpolated middle (L) (temporary) 4355 00001EF1 00D8 add al, bl ; [previous_val_l] 4356 00001EF3 D0D8 rcr al, 1 4357 00001EF5 86D8 xchg al, bl 4358 00001EF7 00D8 add al, bl ; bl = interpolated 1st quarter (L) (temp) 4359 00001EF9 D0D8 rcr al, 1 4360 00001EFB 2C80 sub al, 80h 4361 00001EFD 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4362 00001F01 66AB stosw ; interpolated sample 1 (L) 4363 00001F03 88F8 mov al, bh 4364 00001F05 00F0 add al, dh ; [next_val_r] 4365 00001F07 D0D8 rcr al, 1 4366 00001F09 50 push eax ; *** ; al = interpolated middle (R) (temporary) 4367 00001F0A 00F8 add al, bh ; [previous_val_r] 4368 00001F0C D0D8 rcr al, 1 4369 00001F0E 86F8 xchg al, bh 4370 00001F10 00F8 add al, bh ; bh = interpolated 1st quarter (R) (temp) 4371 00001F12 D0D8 rcr al, 1 4372 00001F14 2C80 sub al, 80h 4373 00001F16 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4374 00001F1A 66AB stosw ; interpolated sample 1 (R) 4375 00001F1C 5A pop edx ; *** 4376 00001F1D 58 pop eax ; ** ; al = interpolated middle (L) (temporary) 4377 00001F1E 86D8 xchg al, bl ; al = interpolated 1st quarter (L) (temp) 4378 00001F20 00D8 add al, bl ; bl = interpolated middle (L) (temporary) 4379 00001F22 D0D8 rcr al, 1 4380 00001F24 2C80 sub al, 80h 4381 00001F26 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4382 00001F2A 66AB stosw ; interpolated sample 2 (L) 4383 00001F2C 88D0 mov al, dl ; interpolated middle (R) (temporary) 4384 00001F2E 86F8 xchg al, bh ; al = interpolated 1st quarter (R) (temp) 4385 00001F30 00F8 add al, bh ; bh = interpolated middle (R) (temporary) 4386 00001F32 D0D8 rcr al, 1 4387 00001F34 2C80 sub al, 80h 4388 00001F36 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4389 00001F3A 66AB stosw ; interpolated sample 2 (R) 4390 00001F3C 5A pop edx ; * 4391 00001F3D 88D8 mov al, bl ; interpolated middle (L) (temporary) 4392 00001F3F 00D0 add al, dl ; [next_val_l] 4393 00001F41 D0D8 rcr al, 1 4394 00001F43 86D8 xchg al, bl ; al = interpolated middle (R) (temporary) 4395 00001F45 00D8 add al, bl ; bl = interpolated 3rd quarter (L) (temp) 4396 00001F47 D0D8 rcr al, 1 4397 00001F49 2C80 sub al, 80h 4398 00001F4B 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4399 00001F4F 66AB stosw ; interpolated sample 3 (L) 4400 00001F51 88F8 mov al, bh 4401 00001F53 00F0 add al, dh ; interpolated middle (R) + [next_val_r] 4402 00001F55 D0D8 rcr al, 1 4403 00001F57 86F8 xchg al, bh ; al = interpolated middle (R) 4404 00001F59 00F8 add al, bh ; bh = interpolated 3rd quarter (R) (temp) 4405 00001F5B D0D8 rcr al, 1 4406 00001F5D 2C80 sub al, 80h 4407 00001F5F 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4408 00001F63 66AB stosw ; interpolated sample 3 (R) 4409 00001F65 88D8 mov al, bl 4410 00001F67 00D0 add al, dl ; [next_val_l] 4411 00001F69 D0D8 rcr al, 1 4412 00001F6B 2C80 sub al, 80h 4413 00001F6D 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4414 00001F71 66AB stosw ; interpolated sample 4 (L) 4415 00001F73 88F8 mov al, bh 4416 00001F75 00F0 add al, dh ; [next_val_r] 4417 00001F77 D0D8 rcr al, 1 4418 00001F79 2C80 sub al, 80h 4419 00001F7B 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4420 00001F7F 66AB stosw ; interpolated sample 4 (R) 4421 00001F81 C3 retn 4422 4423 interpolating_4_8bit_mono: 4424 ; 17/11/2023 4425 ; al = [previous_val] 4426 ; dl = [next_val] 4427 ; original-interpolated-interpolated-interpolated 4428 00001F82 88C3 mov bl, al 4429 00001F84 2C80 sub al, 80h 4430 00001F86 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4431 00001F8A 66AB stosw ; original sample (L) 4432 00001F8C 66AB stosw ; original sample (R) 4433 00001F8E 88D8 mov al, bl 4434 00001F90 00D0 add al, dl 4435 00001F92 D0D8 rcr al, 1 4436 00001F94 86D8 xchg al, bl ; al = [previous_val] 4437 00001F96 00D8 add al, bl ; bl = interpolated middle (sample 2) 4438 00001F98 D0D8 rcr al, 1 4439 00001F9A 2C80 sub al, 80h 4440 00001F9C 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4441 00001FA0 66AB stosw ; interpolated sample 1 (L) 4442 00001FA2 66AB stosw ; interpolated sample 1 (R) 4443 00001FA4 88D8 mov al, bl ; interpolated middle (sample 2) 4444 00001FA6 2C80 sub al, 80h 4445 00001FA8 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4446 00001FAC 66AB stosw ; interpolated sample 2 (L) 4447 00001FAE 66AB stosw ; interpolated sample 2 (R) 4448 00001FB0 88D8 mov al, bl 4449 00001FB2 00D0 add al, dl ; [next_val] 4450 00001FB4 D0D8 rcr al, 1 4451 00001FB6 2C80 sub al, 80h 4452 00001FB8 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4453 00001FBC 66AB stosw ; interpolated sample 3 (L) 4454 00001FBE 66AB stosw ; interpolated sample 3 (R) 4455 00001FC0 C3 retn 4456 4457 interpolating_4_8bit_stereo: 4458 ; 17/11/2023 4459 ; al = [previous_val_l] 4460 ; ah = [previous_val_r] 4461 ; dl = [next_val_l] 4462 ; dh = [next_val_r] 4463 ; original-interpolated-interpolated-interpolated 4464 00001FC1 89C3 mov ebx, eax 4465 00001FC3 2C80 sub al, 80h 4466 00001FC5 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4467 00001FC9 66AB stosw ; original sample (L) 4468 00001FCB 88F8 mov al, bh 4469 00001FCD 2C80 sub al, 80h 4470 00001FCF 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4471 00001FD3 66AB stosw ; original sample (R) 4472 00001FD5 88D8 mov al, bl 4473 00001FD7 00D0 add al, dl ; [next_val_l] 4474 00001FD9 D0D8 rcr al, 1 4475 00001FDB 86D8 xchg al, bl ; al = [previous_val_l] 4476 00001FDD 00D8 add al, bl ; bl = interpolated middle (L) (sample 2) 4477 00001FDF D0D8 rcr al, 1 4478 00001FE1 2C80 sub al, 80h 4479 00001FE3 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4480 00001FE7 66AB stosw ; interpolated sample 1 (L) 4481 00001FE9 88F8 mov al, bh 4482 00001FEB 00F0 add al, dh ; [next_val_r] 4483 00001FED D0D8 rcr al, 1 4484 00001FEF 86F8 xchg al, bh ; al = [previous_val_h] 4485 00001FF1 00F8 add al, bh ; bh = interpolated middle (R) (sample 2) 4486 00001FF3 D0D8 rcr al, 1 4487 00001FF5 2C80 sub al, 80h 4488 00001FF7 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4489 00001FFB 66AB stosw ; interpolated sample 1 (R) 4490 00001FFD 88D8 mov al, bl ; interpolated middle (L) (sample 2) 4491 00001FFF 2C80 sub al, 80h 4492 00002001 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4493 00002005 66AB stosw ; interpolated sample 2 (L) 4494 00002007 88F8 mov al, bh ; interpolated middle (L) (sample 2) 4495 00002009 2C80 sub al, 80h 4496 0000200B 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4497 0000200F 66AB stosw ; interpolated sample 2 (L) 4498 00002011 88D8 mov al, bl 4499 00002013 00D0 add al, dl ; [next_val_l] 4500 00002015 D0D8 rcr al, 1 4501 00002017 2C80 sub al, 80h 4502 00002019 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4503 0000201D 66AB stosw ; interpolated sample 3 (L) 4504 0000201F 88F8 mov al, bh 4505 00002021 00F0 add al, dh ; [next_val_r] 4506 00002023 D0D8 rcr al, 1 4507 00002025 2C80 sub al, 80h 4508 00002027 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4509 0000202B 66AB stosw ; interpolated sample 3 (R) 4510 0000202D C3 retn 4511 4512 interpolating_5_16bit_mono: 4513 ; 18/11/2023 4514 ; ax = [previous_val] 4515 ; dx = [next_val] 4516 ; original-interpltd-interpltd-interpltd-interpltd 4517 0000202E 66AB stosw ; original sample (L) 4518 00002030 66AB stosw ; original sample (R) 4519 00002032 80C480 add ah, 80h ; convert sound level 0 to 65535 format 4520 00002035 89C3 mov ebx, eax ; [previous_val] 4521 00002037 80C680 add dh, 80h 4522 0000203A 6601D0 add ax, dx 4523 0000203D 66D1D8 rcr ax, 1 4524 00002040 50 push eax ; * ; interpolated middle (temporary) 4525 00002041 6601D8 add ax, bx ; interpolated middle + [previous_val] 4526 00002044 66D1D8 rcr ax, 1 4527 00002047 50 push eax ; ** ; interpolated 1st quarter (temporary) 4528 00002048 6601D8 add ax, bx ; 1st quarter + [previous_val] 4529 0000204B 66D1D8 rcr ax, 1 4530 0000204E 80EC80 sub ah, 80h ; -32768 to +32767 format again 4531 00002051 66AB stosw ; interpolated sample 1 (L) 4532 00002053 66AB stosw ; interpolated sample 1 (R) 4533 00002055 58 pop eax ; ** 4534 00002056 5B pop ebx ; * 4535 00002057 6601D8 add ax, bx ; 1st quarter + middle 4536 0000205A 66D1D8 rcr ax, 1 ; / 2 4537 0000205D 80EC80 sub ah, 80h ; -32768 to +32767 format again 4538 00002060 66AB stosw ; interpolated sample 2 (L) 4539 00002062 66AB stosw ; interpolated sample 2 (R) 4540 00002064 89D8 mov eax, ebx 4541 00002066 6601D0 add ax, dx ; interpolated middle + [next_val] 4542 00002069 66D1D8 rcr ax, 1 4543 0000206C 50 push eax ; * ; interpolated 3rd quarter (temporary) 4544 0000206D 6601D8 add ax, bx ; + interpolated middle 4545 00002070 66D1D8 rcr ax, 1 4546 00002073 80EC80 sub ah, 80h ; -32768 to +32767 format again 4547 00002076 66AB stosw ; interpolated sample 3 (L) 4548 00002078 66AB stosw ; interpolated sample 3 (R) 4549 0000207A 58 pop eax ; * 4550 0000207B 6601D0 add ax, dx ; 3rd quarter + [next_val] 4551 0000207E 66D1D8 rcr ax, 1 ; / 2 4552 00002081 80EC80 sub ah, 80h ; -32768 to +32767 format again 4553 00002084 66AB stosw ; interpolated sample 4 (L) 4554 00002086 66AB stosw ; interpolated sample 4 (R) 4555 00002088 C3 retn 4556 4557 interpolating_5_16bit_stereo: 4558 ; 18/11/2023 4559 ; bx = [previous_val_l] 4560 ; ax = [previous_val_r] 4561 ; [next_val_l] 4562 ; [next_val_r] 4563 ; original-interpltd-interpltd-interpltd-interpltd 4564 00002089 51 push ecx ; ! 4565 0000208A 93 xchg eax, ebx 4566 0000208B 66AB stosw ; original sample (L) 4567 0000208D 93 xchg eax, ebx 4568 0000208E 66AB stosw ; original sample (R) 4569 00002090 80C480 add ah, 80h ; convert sound level 0 to 65535 format 4570 00002093 50 push eax ; * ; [previous_val_r] 4571 00002094 80C780 add bh, 80h 4572 00002097 8005[13220000]80 add byte [next_val_l+1], 80h 4573 0000209E 66A1[12220000] mov ax, [next_val_l] 4574 000020A4 6601D8 add ax, bx ; [previous_val_l] 4575 000020A7 66D1D8 rcr ax, 1 4576 000020AA 89C1 mov ecx, eax ; interpolated middle (L) 4577 000020AC 6601D8 add ax, bx 4578 000020AF 66D1D8 rcr ax, 1 4579 000020B2 89C2 mov edx, eax ; interpolated 1st quarter (L) 4580 000020B4 6601D8 add ax, bx ; [previous_val_l] 4581 000020B7 66D1D8 rcr ax, 1 4582 000020BA 80EC80 sub ah, 80h ; -32768 to +32767 format again 4583 000020BD 66AB stosw ; interpolated sample 1 (L) 4584 000020BF 89C8 mov eax, ecx 4585 000020C1 6601D0 add ax, dx ; middle (L) + 1st quarter (L) 4586 000020C4 66D1D8 rcr ax, 1 ; / 2 4587 000020C7 89C3 mov ebx, eax ; interpolated sample 2 (L) 4588 000020C9 5A pop edx ; * ; [previous_val_r] 4589 000020CA 89D0 mov eax, edx 4590 000020CC 8005[15220000]80 add byte [next_val_r+1], 80h 4591 000020D3 660305[14220000] add ax, [next_val_r] 4592 000020DA 66D1D8 rcr ax, 1 4593 000020DD 50 push eax ; * ; interpolated middle (R) 4594 000020DE 6601D0 add ax, dx 4595 000020E1 66D1D8 rcr ax, 1 4596 000020E4 50 push eax ; ** ; interpolated 1st quarter (R) 4597 000020E5 6601D0 add ax, dx ; [previous_val_r] 4598 000020E8 66D1D8 rcr ax, 1 4599 000020EB 80EC80 sub ah, 80h ; -32768 to +32767 format again 4600 000020EE 66AB stosw ; interpolated sample 1 (R) 4601 000020F0 89D8 mov eax, ebx 4602 000020F2 80EC80 sub ah, 80h ; -32768 to +32767 format again 4603 000020F5 66AB stosw ; interpolated sample 2 (L) 4604 000020F7 58 pop eax ; ** 4605 000020F8 5A pop edx ; * 4606 000020F9 6601D0 add ax, dx ; 1st quarter (R) + middle (R) 4607 000020FC 66D1D8 rcr ax, 1 ; / 2 4608 000020FF 80EC80 sub ah, 80h ; -32768 to +32767 format again 4609 00002102 66AB stosw ; interpolated sample 2 (R) 4610 00002104 89C8 mov eax, ecx 4611 00002106 660305[12220000] add ax, [next_val_l] 4612 0000210D 66D1D8 rcr ax, 1 4613 00002110 50 push eax ; * ; interpolated 3rd quarter (L) 4614 00002111 6601C8 add ax, cx ; interpolated middle (L) 4615 00002114 66D1D8 rcr ax, 1 4616 00002117 80EC80 sub ah, 80h ; -32768 to +32767 format again 4617 0000211A 66AB stosw ; interpolated sample 3 (L) 4618 0000211C 89D0 mov eax, edx 4619 0000211E 660305[14220000] add ax, [next_val_r] 4620 00002125 66D1D8 rcr ax, 1 4621 00002128 50 push eax ; ** ; interpolated 3rd quarter (R) 4622 00002129 6601D0 add ax, dx ; interpolated middle (R) 4623 0000212C 66D1D8 rcr ax, 1 4624 0000212F 80EC80 sub ah, 80h ; -32768 to +32767 format again 4625 00002132 66AB stosw ; interpolated sample 3 (R) 4626 00002134 5B pop ebx ; ** 4627 00002135 58 pop eax ; * 4628 00002136 660305[12220000] add ax, [next_val_l] 4629 0000213D 66D1D8 rcr ax, 1 4630 00002140 80EC80 sub ah, 80h ; -32768 to +32767 format again 4631 00002143 66AB stosw ; interpolated sample 4 (L) 4632 00002145 89D8 mov eax, ebx 4633 00002147 660305[14220000] add ax, [next_val_r] 4634 0000214E 66D1D8 rcr ax, 1 4635 00002151 80EC80 sub ah, 80h ; -32768 to +32767 format again 4636 00002154 66AB stosw ; interpolated sample 4 (R) 4637 00002156 59 pop ecx ; ! 4638 00002157 C3 retn 4639 4640 interpolating_4_16bit_mono: 4641 ; 18/11/2023 4642 ; ax = [previous_val] 4643 ; dx = [next_val] 4644 ; 02/02/2025 4645 ; original-interpolated-interpolated-interpolated 4646 4647 00002158 66AB stosw ; original sample (L) 4648 0000215A 66AB stosw ; original sample (R) 4649 0000215C 80C480 add ah, 80h ; convert sound level 0 to 65535 format 4650 0000215F 89C3 mov ebx, eax ; [previous_val] 4651 00002161 80C680 add dh, 80h 4652 00002164 6601D0 add ax, dx ; [previous_val] + [next_val] 4653 00002167 66D1D8 rcr ax, 1 4654 0000216A 93 xchg eax, ebx 4655 0000216B 6601D8 add ax, bx ; [previous_val] + interpolated middle 4656 0000216E 66D1D8 rcr ax, 1 4657 00002171 80EC80 sub ah, 80h ; -32768 to +32767 format again 4658 00002174 66AB stosw ; interpolated sample 1 (L) 4659 00002176 66AB stosw ; interpolated sample 1 (R) 4660 00002178 89D8 mov eax, ebx ; interpolated middle 4661 0000217A 80EC80 sub ah, 80h ; -32768 to +32767 format again 4662 0000217D 66AB stosw ; interpolated sample 2 (L) 4663 0000217F 66AB stosw ; interpolated sample 2 (R) 4664 00002181 89D8 mov eax, ebx 4665 00002183 6601D0 add ax, dx ; interpolated middle + [next_val] 4666 00002186 66D1D8 rcr ax, 1 4667 00002189 80EC80 sub ah, 80h ; -32768 to +32767 format again 4668 0000218C 66AB stosw ; interpolated sample 3 (L) 4669 0000218E 66AB stosw ; interpolated sample 3 (R) 4670 00002190 C3 retn 4671 4672 interpolating_4_16bit_stereo: 4673 ; 18/11/2023 4674 ; bx = [previous_val_l] 4675 ; ax = [previous_val_r] 4676 ; [next_val_l] 4677 ; [next_val_r] 4678 ; original-interpolated-interpolated-interpolated 4679 00002191 93 xchg eax, ebx 4680 00002192 66AB stosw ; original sample (L) 4681 00002194 93 xchg eax, ebx 4682 00002195 66AB stosw ; original sample (R) 4683 00002197 80C480 add ah, 80h ; convert sound level 0 to 65535 format 4684 0000219A 89C2 mov edx, eax ; [previous_val_r] 4685 0000219C 80C780 add bh, 80h 4686 0000219F 8005[13220000]80 add byte [next_val_l+1], 80h 4687 000021A6 66A1[12220000] mov ax, [next_val_l] 4688 000021AC 6601D8 add ax, bx ; [previous_val_l] 4689 000021AF 66D1D8 rcr ax, 1 4690 000021B2 93 xchg eax, ebx 4691 000021B3 6601D8 add ax, bx ; bx = interpolated middle (L) 4692 000021B6 66D1D8 rcr ax, 1 4693 000021B9 80EC80 sub ah, 80h ; -32768 to +32767 format again 4694 000021BC 66AB stosw ; interpolated sample 1 (L) 4695 000021BE 8005[15220000]80 add byte [next_val_r+1], 80h 4696 000021C5 89D0 mov eax, edx ; [previous_val_r] 4697 000021C7 660305[14220000] add ax, [next_val_r] 4698 000021CE 66D1D8 rcr ax, 1 4699 000021D1 92 xchg eax, edx 4700 000021D2 6601D0 add ax, dx ; dx = interpolated middle (R) 4701 000021D5 66D1D8 rcr ax, 1 4702 000021D8 80EC80 sub ah, 80h ; -32768 to +32767 format again 4703 000021DB 66AB stosw ; interpolated sample 1 (R) 4704 000021DD 89D8 mov eax, ebx 4705 000021DF 80EC80 sub ah, 80h ; -32768 to +32767 format again 4706 000021E2 66AB stosw ; interpolated sample 2 (L) 4707 000021E4 89D0 mov eax, edx 4708 000021E6 80EC80 sub ah, 80h ; -32768 to +32767 format again 4709 000021E9 66AB stosw ; interpolated sample 2 (R) 4710 000021EB 89D8 mov eax, ebx 4711 000021ED 660305[12220000] add ax, [next_val_l] 4712 000021F4 66D1D8 rcr ax, 1 4713 000021F7 80EC80 sub ah, 80h ; -32768 to +32767 format again 4714 000021FA 66AB stosw ; interpolated sample 3 (L) 4715 000021FC 89D0 mov eax, edx 4716 000021FE 660305[14220000] add ax, [next_val_r] 4717 00002205 66D1D8 rcr ax, 1 4718 00002208 80EC80 sub ah, 80h ; -32768 to +32767 format again 4719 0000220B 66AB stosw ; interpolated sample 3 (R) 4720 0000220D C3 retn 4721 4722 ; 13/11/2023 4723 previous_val: 4724 0000220E 0000 previous_val_l: dw 0 4725 00002210 0000 previous_val_r: dw 0 4726 next_val: 4727 00002212 0000 next_val_l: dw 0 4728 00002214 0000 next_val_r: dw 0 4729 4730 ; 16/11/2023 4731 00002216 00 faz: db 0 4732 4733 ;============================================================================= 4734 ; gfx.asm - draw scopes in VGA 640x480x16 mode 4735 ;============================================================================= 4736 4737 ; EX1A.ASM (21/6/1994, Carlos Hasan; MSDOS, 'RUNME.EXE', 'TNYPL211') 4738 4739 ;----------------------------------------------------------------------------- 4740 ; setgraphmode - setup the VGA 640x480x16 graphics mode 4741 ;----------------------------------------------------------------------------- 4742 ; 22/10/2017 4743 setgraphmode: 4744 ;pushad 4745 00002217 66B81200 mov ax,0012h 4746 ;int 10h 4747 0000221B CD31 int 31h 4748 0000221D 66BAC003 mov dx,3C0h 4749 00002221 30C0 xor al,al 4750 setgraphmodel0: 4751 ;out dx,al 4752 00002223 B401 mov ah, 1 ; outb 4753 00002225 CD34 int 34h 4754 ;out dx, al 4755 ;mov ah, 1 4756 00002227 CD34 int 34h 4757 00002229 FEC0 inc al 4758 0000222B 3C10 cmp al, 10h 4759 0000222D 72F4 jb short setgraphmodel0 4760 0000222F B020 mov al, 20h 4761 ;out dx, al 4762 ;mov ah, 1 4763 00002231 CD34 int 34h 4764 ;popad 4765 00002233 C3 retn 4766 4767 ;----------------------------------------------------------------------------- 4768 ; settextmode - restore the VGA 80x25x16 text mode 4769 ;----------------------------------------------------------------------------- 4770 ; 22/10/2017 4771 settextmode: 4772 ;pushad 4773 00002234 66B80300 mov ax, 0003h 4774 ;int 10h 4775 00002238 CD31 int 31h 4776 ;popad 4777 0000223A C3 retn 4778 4779 ;----------------------------------------------------------------------------- 4780 ; drawscopes - draw the track voices sample scopes 4781 ; In: 4782 ; ESI = (current) sample buffer 4783 ;----------------------------------------------------------------------------- 4784 ; 27/12/2024 4785 ; 29/10/2017 4786 ; 28/10/2017 4787 ; (ESI = Current DMA buffer offset) 4788 ; 27/10/2017 4789 ; 26/10/2017 4790 ; 23/10/2017 4791 drawscopes: 4792 ;pushad 4793 ;mov esi, g_buff 4794 ;mov esi, edx 4795 0000223B 31C9 xor ecx, ecx 4796 0000223D 31D2 xor edx, edx 4797 0000223F 31FF xor edi, edi 4798 drawscope0: 4799 00002241 66AD lodsw 4800 00002243 80F480 xor ah, 80h 4801 00002246 0FB6DC movzx ebx, ah ; Left Channel 4802 ;shl bx, 1 4803 ; 27/12/2024 4804 00002249 D1E3 shl ebx, 1 4805 0000224B 668B83[206A0000] mov ax, [RowOfs+ebx] 4806 00002252 668987[206C0000] mov [NewScope_L+edi], ax 4807 00002259 30FF xor bh, bh 4808 0000225B 66AD lodsw 4809 0000225D 80F480 xor ah, 80h 4810 00002260 88E3 mov bl, ah ; Right Channel 4811 ;shl bx, 1 4812 ; 27/12/2024 4813 00002262 D1E3 shl ebx, 1 4814 00002264 668B83[206A0000] mov ax, [RowOfs+ebx] 4815 0000226B 668987[206E0000] mov [NewScope_R+edi], ax 4816 00002272 6683C702 add di, 2 4817 00002276 FEC1 inc cl 4818 00002278 75C7 jnz short drawscope0 4819 4820 0000227A 66BAC403 mov dx, 3C4h 4821 ;mov ax, 0802h 4822 ;out dx, ax 4823 0000227E 66BB0208 mov bx, 0802h 4824 00002282 B403 mov ah, 3 ; outw 4825 00002284 CD34 int 34h 4826 ;mov dx, 3CEh 4827 ; 27/12/2024 4828 00002286 B2CE mov dl, 0CEh 4829 00002288 B008 mov al, 08h 4830 ;out dx, al 4831 0000228A B401 mov ah, 1 ; outb 4832 0000228C CD34 int 34h 4833 ;inc dx 4834 ; 27/12/2024 4835 0000228E 42 inc edx 4836 4837 ; 26/10/2017 4838 0000228F 31F6 xor esi, esi 4839 ;xor edi, edi 4840 00002291 BB45060A00 mov ebx, 0A0645h 4841 drawscopel4: 4842 00002296 B080 mov al, 80h 4843 drawscopel2: 4844 00002298 50 push eax ; * 4845 00002299 52 push edx ; ** 4846 ;out dx, al 4847 0000229A B401 mov ah, 1 ; outb 4848 0000229C CD34 int 34h 4849 4850 0000229E B4FF mov ah, 0FFh 4851 ;mov ecx, 32 4852 000022A0 B120 mov cl, 32 4853 000022A2 28C0 sub al, al 4854 drawscopel3: 4855 ; 23/10/2017 4856 000022A4 668B96[20700000] mov dx, [OldScope_L+esi] 4857 000022AB 663B96[206C0000] cmp dx, [NewScope_L+esi] 4858 000022B2 7414 je short drawscopef3 4859 000022B4 88041A mov [edx+ebx], al ; L 4860 000022B7 668B96[206C0000] mov dx, [NewScope_L+esi] 4861 000022BE 88241A mov [edx+ebx], ah ; L 4862 000022C1 668996[20700000] mov [OldScope_L+esi], dx 4863 drawscopef3: 4864 ; 27/10/2017 4865 000022C8 668B96[20720000] mov dx, [OldScope_R+esi] 4866 000022CF 663B96[206E0000] cmp dx, [NewScope_R+esi] 4867 000022D6 7416 je short drawscopef4 4868 000022D8 88441A26 mov [edx+ebx+38], al ; R 4869 000022DC 668B96[206E0000] mov dx, [NewScope_R+esi] 4870 000022E3 88641A26 mov [edx+ebx+38], ah ; R 4871 000022E7 668996[20720000] mov [OldScope_R+esi], dx 4872 drawscopef4: 4873 000022EE 83C610 add esi, 2*8 4874 000022F1 43 inc ebx 4875 000022F2 E2B0 loop drawscopel3 4876 4877 000022F4 5A pop edx ; ** 4878 000022F5 58 pop eax ; * 4879 000022F6 81EEFE010000 sub esi, 2*256-2 4880 000022FC 83EB20 sub ebx, 32 4881 000022FF D0E8 shr al, 1 4882 00002301 7595 jnz short drawscopel2 4883 ;popad 4884 00002303 C3 retn 4885 4886 ;============================================================================= 4887 ; Load IFF/ILBM files for VGA 640x480x16 graphics mode 4888 ;============================================================================= 4889 4890 ; EX1B.ASM (21/6/1994, Carlos Hasan; MSDOS, 'RUNME.EXE', 'TNYPL211') 4891 4892 ; 21/10/2017 (TRDOS 386, 'tmodplay.s', Erdogan Tan, NASM syntax) 4893 4894 ;----------------------------------------------------------------------------- 4895 ; EQUATES AND STRUCTURES 4896 ;----------------------------------------------------------------------------- 4897 4898 ID_FORM equ 4D524F46h ; IFF/ILBM chunk IDs 4899 ID_ILBM equ 4D424C49h 4900 ID_BMHD equ 44484D42h 4901 ID_CMAP equ 50414D43h 4902 ID_BODY equ 59444F42h 4903 4904 struc Form ; IFF/ILBM header file format 4905 00000000 ???????? .ID: resd 1 4906 00000004 ???????? .Length: resd 1 4907 00000008 ???????? .Type: resd 1 4908 .size: 4909 endstruc 4910 4911 struc Chunk ; IFF/ILBM header chunk format 4912 00000000 ???????? .ID: resd 1 4913 00000004 ???????? .Length: resd 1 4914 .size: 4915 endstruc 4916 4917 struc BMHD ; IFF/ILBM BMHD chunk format 4918 00000000 ???? .Width: resw 1 4919 00000002 ???? .Height: resw 1 4920 00000004 ???? .PosX: resw 1 4921 00000006 ???? .PosY: resw 1 4922 00000008 ?? .Planes: resb 1 4923 00000009 ?? .Masking: resb 1 4924 0000000A ?? .Compression: resb 1 4925 0000000B ?? .Pad: resb 1 4926 0000000C ???? .Transparent: resw 1 4927 0000000E ?? .AspectX resb 1 4928 0000000F ?? .AspectY: resb 1 4929 00000010 ???? .PageWidth: resw 1 4930 00000012 ???? .PageHeight: resw 1 4931 .size: 4932 endstruc 4933 4934 struc CMAP ; IFF/ILBM CMAP chunk format 4935 00000000 .Colors: resb 768 4936 .size: 4937 endstruc 4938 4939 ;LOGO_ADDRESS equ 100000h ; virtual address at the end of the 1st 1MB 4940 4941 ;------------------------------------------------------------------------------ 4942 ; bswap - macro to reverse the byte order of a 32-bit register, converting 4943 ; a value in little/big endian form to big/little endian form. 4944 ;------------------------------------------------------------------------------ 4945 %macro bswap 1 4946 xchg al, ah 4947 rol eax, 16 4948 xchg al, ah 4949 %endmacro 4950 4951 ;------------------------------------------------------------------------------ 4952 ; putlbm - draw the IFF/ILBM picture on VGA 640x480x16 graphics mode 4953 ; In: 4954 ; ESI = IFF/ILBM image file address 4955 ;------------------------------------------------------------------------------ 4956 putlbm: 4957 00002304 60 pushad 4958 4959 ; check if this is a valid IFF/ILBM Deluxe Paint file 4960 4961 00002305 813E464F524D cmp dword [esi+Form.ID], ID_FORM 4962 0000230B 7551 jne short putlbmd0 4963 0000230D 817E08494C424D cmp dword [esi+Form.Type], ID_ILBM 4964 00002314 7548 jne short putlbmd0 4965 4966 ; get the IFF/ILBM file length in bytes 4967 4968 00002316 8B4604 mov eax, [esi+Form.Length] 4969 bswap eax 4946 00002319 86E0 <1> xchg al, ah 4947 0000231B C1C010 <1> rol eax, 16 4948 0000231E 86E0 <1> xchg al, ah 4970 00002320 89C1 mov ecx, eax 4971 4972 ; decrease the file length and updates the file pointer 4973 4974 00002322 83E904 sub ecx, 4 4975 00002325 83C60C add esi, Form.size 4976 4977 ; IFF/ILBM main parser body loop 4978 4979 putlbml0: 4980 00002328 85C9 test ecx, ecx 4981 0000232A 7E64 jle short putlbmd1 4982 4983 ; get the next chunk ID and length in bytes 4984 4985 0000232C 8B1E mov ebx, [esi+Chunk.ID] 4986 0000232E 8B4604 mov eax, [esi+Chunk.Length] 4987 bswap eax 4946 00002331 86E0 <1> xchg al, ah 4947 00002333 C1C010 <1> rol eax, 16 4948 00002336 86E0 <1> xchg al, ah 4988 00002338 93 xchg ebx, eax 4989 00002339 83C608 add esi, Chunk.size 4990 4991 ; word align the chunk length and decrease the file length counter 4992 4993 0000233C 43 inc ebx 4994 0000233D 80E3FE and bl, 0FEh ; ~1 4995 00002340 83E908 sub ecx, Chunk.size 4996 00002343 29D9 sub ecx, ebx 4997 4998 ; check for the BMHD/CMAP/BODY chunk headers 4999 5000 00002345 3D424D4844 cmp eax, ID_BMHD 5001 0000234A 7415 je short putlbmf0 5002 0000234C 3D434D4150 cmp eax, ID_CMAP 5003 00002351 7440 je short putlbmf1 5004 00002353 3D424F4459 cmp eax, ID_BODY 5005 00002358 7454 je short putlbmf2 5006 5007 ; advance to the next IFF/ILBM chunk structure 5008 5009 putlbmc0: 5010 0000235A 01DE add esi, ebx 5011 0000235C EBCA jmp short putlbml0 5012 5013 putlbmd0: 5014 0000235E F9 stc 5015 0000235F 61 popad 5016 00002360 C3 retn 5017 5018 ; process the BMHD bitmap header chunk 5019 5020 putlbmf0: 5021 00002361 807E0804 cmp byte [esi+BMHD.Planes], 4 5022 00002365 75F7 jne short putlbmd0 5023 00002367 807E0A01 cmp byte [esi+BMHD.Compression], 1 5024 0000236B 75F1 jne short putlbmd0 5025 0000236D 807E0B00 cmp byte [esi+BMHD.Pad], 0 5026 00002371 75EB jne short putlbmd0 5027 00002373 0FB706 movzx eax, word [esi+BMHD.Width] 5028 00002376 86E0 xchg al, ah 5029 00002378 83C007 add eax, 7 5030 0000237B C1E803 shr eax, 3 5031 0000237E A3[74690000] mov [picture.width], eax 5032 00002383 0FB74602 movzx eax, word [esi+BMHD.Height] 5033 00002387 86E0 xchg al, ah 5034 00002389 A3[78690000] mov [picture.height], eax 5035 0000238E EBCA jmp short putlbmc0 5036 5037 putlbmd1: 5038 00002390 F8 clc 5039 00002391 61 popad 5040 00002392 C3 retn 5041 5042 ; process the CMAP colormap chunk 5043 5044 putlbmf1: 5045 00002393 66BAC803 mov dx, 3C8h 5046 00002397 30C0 xor al, al 5047 ;out dx, al 5048 00002399 B401 mov ah, 1 ; outb 5049 0000239B CD34 int 34h 5050 ;inc dx 5051 ; 27/11/2023 5052 0000239D 42 inc edx 5053 putlbml1: 5054 0000239E 8A06 mov al, [esi] 5055 000023A0 C0E802 shr al, 2 5056 ;out dx, al 5057 ;mov ah, 1 ; outb 5058 000023A3 CD34 int 34h ; IOCTL interrupt (IN/OUT) 5059 000023A5 46 inc esi 5060 000023A6 4B dec ebx 5061 000023A7 7FF5 jg short putlbml1 5062 000023A9 E97AFFFFFF jmp putlbml0 5063 5064 ; process the BODY bitmap body chunk 5065 5066 putlbmf2: 5067 000023AE 60 pushad 5068 000023AF BF00000A00 mov edi, 0A0000h 5069 ;cld 5070 000023B4 66BACE03 mov dx, 3CEh 5071 ;mov ax, 0FF08h 5072 ;out dx, ax 5073 000023B8 66BB08FF mov bx, 0FF08h 5074 000023BC B403 mov ah, 3 ; outw 5075 000023BE CD34 int 34h ; IOCTL interrupt (IN/OUT) 5076 ;mov dx, 3C4h 5077 ; 27/11/2023 5078 000023C0 B2C4 mov dl, 0C4h 5079 000023C2 B002 mov al, 02h 5080 ;out dx, al 5081 000023C4 B401 mov ah, 1 ; outb 5082 000023C6 CD34 int 34h ; IOCTL interrupt (IN/OUT) 5083 ;inc dx 5084 ; 27/11/2023 5085 000023C8 42 inc edx 5086 000023C9 8B0D[78690000] mov ecx, [picture.height] 5087 putlbml2: 5088 000023CF 51 push ecx 5089 000023D0 B011 mov al, 11h 5090 putlbml3: 5091 000023D2 50 push eax 5092 000023D3 57 push edi 5093 ;out dx, al 5094 000023D4 B401 mov ah, 1 ; outb 5095 000023D6 CD34 int 34h ; IOCTL interrupt (IN/OUT) 5096 000023D8 8B1D[74690000] mov ebx, [picture.width] 5097 putlbml4: 5098 000023DE AC lodsb 5099 000023DF 84C0 test al, al 5100 000023E1 7C0A jl short putlbmf3 5101 000023E3 0FB6C8 movzx ecx, al 5102 000023E6 41 inc ecx 5103 000023E7 29CB sub ebx, ecx 5104 000023E9 F3A4 rep movsb 5105 000023EB EB0B jmp short putlbmc4 5106 putlbmf3: 5107 000023ED F6D8 neg al 5108 000023EF 0FB6C8 movzx ecx, al 5109 000023F2 41 inc ecx 5110 000023F3 29CB sub ebx, ecx 5111 000023F5 AC lodsb 5112 000023F6 F3AA rep stosb 5113 putlbmc4: 5114 000023F8 85DB test ebx, ebx 5115 000023FA 7FE2 jg short putlbml4 5116 000023FC 5F pop edi 5117 000023FD 58 pop eax 5118 000023FE 00C0 add al, al 5119 00002400 73D0 jnc short putlbml3 5120 00002402 83C750 add edi, 80 5121 00002405 59 pop ecx 5122 00002406 E2C7 loop putlbml2 5123 00002408 61 popad 5124 00002409 E94CFFFFFF jmp putlbmc0 5125 5126 ; EX1.C (Carlos Hasan, 21/06/1994) 5127 ;------------------------------------------------------------------------------ 5128 ; loadlbm - load the IFF/ILBM image file ("LOGO.LBM") at memory 5129 ; ESI = IFF/ILBM image file address 5130 ;------------------------------------------------------------------------------ 5131 5132 ;if ((Logo = loadlbm("LOGO.LBM")) == NULL) { 5133 ; printf("Error loading the IFF/ILBM logo picture\n"); 5134 ; MODStopModule(); 5135 ; MODFreeModule(Song); 5136 ; return; 5137 ; } 5138 ; setgraphmode(); 5139 ; putlbm(Logo); 5140 ; while (!kbhit()) 5141 ; drawscopes(Song->NumTracks); 5142 ; settextmode(); 5143 ; free(Logo); 5144 ; MODStopModule(); 5145 ; MODFreeModule(Song); 5146 5147 ;loadlbm: 5148 ; ; ebx = ASCIIZ file name address 5149 ; ; ecx = open mode (0 = open for read) 5150 ; sys _open, LOGO_FILE_NAME, 0 ; open for reading 5151 ; jc short loadlbm_retn 5152 ; 5153 ; mov [LBM_FileHandle], eax 5154 ; 5155 ; ; get file size by moving file pointer to the end of file 5156 ; ; ebx = file handle/number 5157 ; ; ecx : offset = 0 5158 ; ; edx : switch = 2 (move fp to end of file + offset) 5159 ; sys _seek, eax, 0, 2 5160 ; jc short loadlbm_cf 5161 ; 5162 ; mov [LBM_FileSize], eax 5163 ; 5164 ; ; move file pointer to the beginning of the file 5165 ; ; ecx = 0 5166 ; ; edx = 0 5167 ; ;xor ecx, ecx 5168 ; xor dl, dl 5169 ; ; ebx = [LBM_FileHandle] 5170 ; sys _seek 5171 ; ;jc short loadlbm_cf 5172 ; 5173 ; ; ebx = File handle 5174 ; ; ecx = Buffer address 5175 ; ; edx = Byte count 5176 ; ;sys _read, [LBM_FileHandle], LOGO_ADDRESS, [LBM_FileSize] 5177 ; mov ecx, LOGO_ADDRESS 5178 ; mov edx, [LBM_FileSize] 5179 ; sys _read 5180 ; jc short loadlbm_cf 5181 ; 5182 ; cmp eax, edx ; read count = file size ? 5183 ; ;jb short loadlbm_cf 5184 ;loadlbm_cf: 5185 ; pushf 5186 ; sys _close, [LBM_FileHandle] 5187 ; popf 5188 ;loadlbm_retn: 5189 ; retn 5190 ; 5191 ;LOGO_FILE_NAME: 5192 ; db "LOGO.LBM", 0 5193 5194 LOGO_ERROR_MSG: 5195 0000240E 4572726F72206C6F61- db "Error loading the IFF/ILBM logo picture !", 0Dh, 0Ah, 0 5195 00002417 64696E672074686520- 5195 00002420 4946462F494C424D20- 5195 00002429 6C6F676F2070696374- 5195 00002432 75726520210D0A00 5196 5197 align 2 5198 ; 22/10/2017 5199 LOGO_ADDRESS: 5200 ;incbin "LOGO.LBM" 5201 ; 27/10/2017 5202 0000243A incbin "TINYPLAY.LBM" 5203 5204 ;============================================================================= 5205 ; preinitialized data 5206 ;============================================================================= 5207 5208 000066D2 00 db 0 5209 ; 23/08/2020 5210 FileHandle: 5211 000066D3 FFFFFFFF dd -1 5212 000066D7 00 db 0 5213 Credits: 5214 msg_usage: 5215 ; 09/12/2023 5216 000066D8 54696E792057415620- db 'Tiny WAV Player for TRDOS 386 by Erdogan Tan',10,13 5216 000066E1 506C6179657220666F- 5216 000066EA 72205452444F532033- 5216 000066F3 383620627920457264- 5216 000066FC 6F67616E2054616E0A- 5216 00006705 0D 5217 00006706 666F7220496E74656C- db 'for Intel AC97 (ICH) Audio Controller.',10,13 5217 0000670F 204143393720284943- 5217 00006718 482920417564696F20- 5217 00006721 436F6E74726F6C6C65- 5217 0000672A 722E0A0D 5218 ;;;db 'December 2023.',10,13 5219 ;;db 'December 2024.',10,13 5220 ;db 'January 2025.',10,13 5221 0000672E 466562727561727920- db 'February 2025.',10,13 5221 00006737 323032352E0A0D 5222 credits_zero: 5223 0000673E 0A0D db 10,13 5224 00006740 75736167653A207477- db 'usage: twavplay filename.wav',10,13,0 5224 00006749 6176706C6179206669- 5224 00006752 6C656E616D652E7761- 5224 0000675B 760A0D00 5225 0000675F 32342F30382F323032- db '24/08/2020',10,13,0 5225 00006768 300A0D00 5226 0000676C 30392F31322F323032- db '09/12/2023',10,13,0 5226 00006775 330A0D00 5227 ;;;db '08/12/2024',10,13,0 5228 ;;db '14/12/2024',10,13,0 5229 00006779 32372F31322F323032- db '27/12/2024',10,13,0 5229 00006782 340A0D00 5230 ;;db '18/01/2025',10,13,0 5231 ;db '02/02/2025',10,13,0 5232 00006786 30352F30322F323032- db '05/02/2025',10,13,0 5232 0000678F 350A0D00 5233 5234 noDevMsg: 5235 ; 09/12/2023 5236 00006793 4572726F723A20556E- db 'Error: Unable to find AC97 audio device!' 5236 0000679C 61626C6520746F2066- 5236 000067A5 696E64204143393720- 5236 000067AE 617564696F20646576- 5236 000067B7 69636521 5237 000067BB 0A0D00 db 10,13,0 5238 5239 noFileErrMsg: 5240 000067BE 4572726F723A206669- db 'Error: file not found.',10,13,0 5240 000067C7 6C65206E6F7420666F- 5240 000067D0 756E642E0A0D00 5241 5242 trdos386_err_msg: 5243 000067D7 5452444F5320333836- db 'TRDOS 386 System call error !',10,13,0 5243 000067E0 2053797374656D2063- 5243 000067E9 616C6C206572726F72- 5243 000067F2 20210A0D00 5244 5245 ; 09/12/2023 5246 msg_no_vra: 5247 000067F7 0A0D db 10,13 5248 000067F9 4E6F20565241207375- db "No VRA support ! Only 48 kHZ sample rate supported !" 5248 00006802 70706F72742021204F- 5248 0000680B 6E6C79203438206B48- 5248 00006814 5A2073616D706C6520- 5248 0000681D 726174652073757070- 5248 00006826 6F727465642021 5249 0000682D 0A0D00 db 10,13,0 5250 5251 ; 13/11/2016 5252 00006830 303132333435363738- hex_chars: db "0123456789ABCDEF", 0 5252 00006839 3941424344454600 5253 ; 5254 msgAC97Info: 5255 00006841 0D0A db 0Dh, 0Ah 5256 00006843 414339372041756469- db "AC97 Audio Controller & Codec Info", 0Dh, 0Ah 5256 0000684C 6F20436F6E74726F6C- 5256 00006855 6C6572202620436F64- 5256 0000685E 656320496E666F0D0A 5257 00006867 56656E646F72204944- db "Vendor ID: " 5257 00006870 3A20 5258 00006872 303030306820446576- msgVendorId: db "0000h Device ID: " 5258 0000687B 6963652049443A20 5259 00006883 30303030680D0A msgDevId: db "0000h", 0Dh, 0Ah 5260 0000688A 4275733A20 db "Bus: " 5261 0000688F 303068204465766963- msgBusNo db "00h Device: " 5261 00006898 653A20 5262 0000689B 3030682046756E6374- msgDevNo db "00h Function: " 5262 000068A4 696F6E3A20 5263 000068A9 303068 msgFncNo db "00h" 5264 000068AC 0D0A db 0Dh, 0Ah 5265 ; 09/12/2023 5266 000068AE 4E414D4241523A20 db "NAMBAR: " 5267 000068B6 30303030682020 msgNamBar db "0000h " 5268 000068BD 4E41424D4241523A20 db "NABMBAR: " 5269 000068C6 303030306820204952- msgNabmBar db "0000h IRQ: " 5269 000068CF 513A20 5270 000068D2 3030 msgIRQ dw 3030h 5271 000068D4 0D0A00 db 0Dh, 0Ah, 0 5272 5273 000068D7 0D0A5741562046696C- msgWavFileName: db 0Dh, 0Ah, "WAV File Name: ",0 5273 000068E0 65204E616D653A2000 5274 000068E9 0D0A53616D706C6520- msgSampleRate: db 0Dh, 0Ah, "Sample Rate: " 5274 000068F2 526174653A20 5275 000068F8 303030303020487A2C- msgHertz: db "00000 Hz, ", 0 5275 00006901 2000 5276 00006903 3820626974732C2000 msg8Bits: db "8 bits, ", 0 5277 0000690C 4D6F6E6F0D0A00 msgMono: db "Mono", 0Dh, 0Ah, 0 5278 00006913 313620626974732C20- msg16Bits: db "16 bits, ", 0 5278 0000691C 00 5279 0000691D 53746572656F msgStereo: db "Stereo" 5280 00006923 0D0A00 nextline: db 0Dh, 0Ah, 0 5281 5282 ; 09/12/2023 5283 00006926 56524120737570706F- msgVRAheader: db "VRA support: " 5283 0000692F 72743A20 5284 00006933 00 db 0 5285 00006934 5945530D0A00 msgVRAyes: db "YES", 0Dh, 0Ah, 0 5286 0000693A 4E4F200D0A msgVRAno: db "NO ", 0Dh, 0Ah 5287 0000693F 28496E746572706F6C- db "(Interpolated sample rate playing method)" 5287 00006948 617465642073616D70- 5287 00006951 6C6520726174652070- 5287 0000695A 6C6179696E67206D65- 5287 00006963 74686F6429 5288 00006968 0D0A00 db 0Dh, 0Ah, 0 5289 5290 ;============================================================================= 5291 ; uninitialized data 5292 ;============================================================================= 5293 5294 ; 23/08/2020 5295 5296 ; BSS 5297 5298 bss_start: 5299 5300 ABSOLUTE bss_start 5301 5302 0000696B ?? alignb 4 5303 5304 ;------------------------------------------------------------------------------ 5305 ; IFF/ILBM DATA 5306 ;------------------------------------------------------------------------------ 5307 5308 0000696C ???????? LBM_FileHandle: resd 1 5309 00006970 ???????? LBM_FileSize: resd 1 5310 ; 5311 00006974 ???????? picture.width: resd 1 ; current picture width and height 5312 00006978 ???????? picture.height: resd 1 5313 5314 ;------------------------------------------------------------------------------ 5315 5316 ;alignb 4 5317 5318 0000697C ?? stmo: resb 1 ; stereo or mono (1=stereo) 5319 0000697D ?? bps: resb 1 ; bits per sample (8,16) 5320 0000697E ???? sample_rate: resw 1 ; Sample Frequency (Hz) 5321 5322 ; 09/12/2023 5323 ; 'playwav6.s' (27/11/2023) 5324 ; ....... 5325 ; 25/11/2023 5326 00006980 ???????? bufferSize: resd 1 5327 5328 ;smpRBuff: resw 14 5329 ; 05/02/2025 5330 00006984 smpRBuff: resb 44 5331 5332 wav_file_name: 5333 000069B0 resb 80 ; wave file, path name (<= 80 bytes) 5334 ;alignb 4 5335 00006A00 ???? resw 1 5336 5337 00006A02 ?? ac97_int_ln_reg: resb 1 5338 00006A03 ?? fbs_shift: resb 1 ; 26/11/2023 5339 5340 00006A04 ???????? dev_vendor: resd 1 5341 00006A08 ???????? bus_dev_fn: resd 1 5342 00006A0C ???? ac97_NamBar: resw 1 5343 00006A0E ???? ac97_NabmBar: resw 1 5344 5345 00006A10 ?? flags: resb 1 5346 ;half_buff: resb 1 5347 00006A11 ?? srb: resb 1 5348 ; 27/12/2024 5349 ; 23/08/2020 5350 ;counter: resb 1 5351 ; 18/08/2020 5352 00006A12 ?? volume_level: resb 1 5353 ; 25/11/2023 5354 00006A13 ?? VRA: resb 1 ; Variable Rate Audio Support Status 5355 ; 09/12/2023 5356 00006A14 ?? pan_shift: resb 1 5357 ; ....... 5358 5359 00006A15 alignb 16 5360 5361 ; PLAY.ASM 5362 ;Scope: resw 320 5363 00006A20 RowOfs: resw 256 5364 5365 ; 23/10/2017 5366 00006C20 NewScope_L: resw 256 5367 00006E20 NewScope_R: resw 256 5368 00007020 OldScope_L: resw 256 5369 00007220 OldScope_R: resw 256 5370 5371 ; 20/10/2017 (modplay7.s, SB16) 5372 ; 19/10/2017 (modplay6.s, AC97) 5373 ;pan_shift: resb 1 5374 ;volume_level: resb 1 5375 5376 ; 27/12/2024 5377 00007420 ???????? timerticks: resd 1 5378 5379 ; 09/12/2023 5380 00007424 ???????? DMA_buffer_size: resd 1 5381 5382 00007428 alignb 4096 5383 5384 ;audio_buffer: resb BUFFERSIZE ; DMA Buffer Size / 2 (32768) 5385 ; 09/12/2023 5386 00008000 audio_buffer: resb 65536 5387 5388 00018000 alignb 65536 5389 5390 ;DMA_Buffer: resb 2*BUFFERSIZE ; 65536 ; 09/10/2017 5391 ; 09/12/2023 5392 00020000 DMA_Buffer: resb 2*65536 5393 5394 ; 13/06/2017 5395 ;temp_buffer: resb BUFFERSIZE 5396 ; 26/11/2023 5397 00040000 temp_buffer: resb 65536 5398 5399 EOF: