1 ; **************************************************************************** 2 ; playwav6.s (for TRDOS 386) 3 ; ---------------------------------------------------------------------------- 4 ; PLAYWAV6.PRG ! AC'97 (ICH) .WAV PLAYER program by Erdogan TAN 5 ; 6 ; 25/11/2023 7 ; 8 ; [ Last Modification: 02/02/2025 ] 9 ; 10 ; Modified from PLAYWAV5.PRG .wav player program by Erdogan Tan, 18/08/2020 11 ; 12 ; Assembler: NASM version 2.15 13 ; nasm playwav6.s -l playwav6.txt -o PLAYWAV6.PRG 14 ; ---------------------------------------------------------------------------- 15 ; Derived from '.wav file player for DOS' Jeff Leyda, Sep 02, 2002 16 17 ; previous version: playwav3.s (17/06/2017) 18 19 ; CODE 20 21 ; 20/10/2024 22 ; 20/08/2024 ; TRDOS 386 v2.0.9 23 ; TRDOS 386 system calls 24 _ver equ 0 25 _exit equ 1 26 _fork equ 2 27 _read equ 3 28 _write equ 4 29 _open equ 5 30 _close equ 6 31 _wait equ 7 32 _creat equ 8 33 _rename equ 9 34 _delete equ 10 35 _exec equ 11 36 _chdir equ 12 37 _time equ 13 38 _mkdir equ 14 39 _chmod equ 15 40 _rmdir equ 16 41 _break equ 17 42 _drive equ 18 43 _seek equ 19 44 _tell equ 20 45 _mem equ 21 46 _prompt equ 22 47 _path equ 23 48 _env equ 24 49 _stime equ 25 50 _quit equ 26 51 _intr equ 27 52 _dir equ 28 53 _emt equ 29 54 _ldvrt equ 30 55 _video equ 31 56 _audio equ 32 57 _timer equ 33 58 _sleep equ 34 59 _msg equ 35 60 _geterr equ 36 61 _fpsave equ 37 62 _pri equ 38 63 _rele equ 39 64 _fff equ 40 65 _fnf equ 41 66 _alloc equ 42 67 _dalloc equ 43 68 _calbac equ 44 69 _dma equ 45 70 _stdio equ 46 ; TRDOS 386 v2.0.9 71 72 %macro sys 1-4 73 ; 29/04/2016 - TRDOS 386 (TRDOS v2.0) 74 ; 03/09/2015 75 ; 13/04/2015 76 ; Retro UNIX 386 v1 system call. 77 %if %0 >= 2 78 mov ebx, %2 79 %if %0 >= 3 80 mov ecx, %3 81 %if %0 = 4 82 mov edx, %4 83 %endif 84 %endif 85 %endif 86 mov eax, %1 87 ;int 30h 88 int 40h ; TRDOS 386 (TRDOS v2.0) 89 %endmacro 90 91 ; TRDOS 386 (and Retro UNIX 386 v1) system call format: 92 ; sys systemcall (eax) , , 93 94 BUFFERSIZE equ 32768 ; audio buffer size 95 ENDOFFILE equ 1 ; flag for knowing end of file 96 97 [BITS 32] 98 99 [ORG 0] 100 101 _STARTUP: 102 ; Prints the Credits Text. 103 sys _msg, Credits, 255, 0Bh 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00000000 BB[E2210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 00000005 B9FF000000 <1> mov ecx, %3 81 <1> %if %0 = 4 82 0000000A BA0B000000 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 0000000F B823000000 <1> mov eax, %1 87 <1> 88 00000014 CD40 <1> int 40h 104 105 ; clear bss 106 00000016 B9[59250000] mov ecx, bss_end 107 0000001B BF[CD240000] mov edi, bss_start 108 00000020 29F9 sub ecx, edi 109 00000022 D1E9 shr ecx, 1 110 00000024 31C0 xor eax, eax 111 00000026 F366AB rep stosw 112 113 ; Detect (& Enable) AC'97 Audio Device 114 00000029 E8DA040000 call DetectAC97 115 0000002E 731B jnc short GetFileName 116 117 _dev_not_ready: 118 ; couldn't find the audio device! 119 sys _msg, noDevMsg, 255, 0Fh 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00000030 BB[C4220000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 00000035 B9FF000000 <1> mov ecx, %3 81 <1> %if %0 = 4 82 0000003A BA0F000000 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 0000003F B823000000 <1> mov eax, %1 87 <1> 88 00000044 CD40 <1> int 40h 120 00000046 E997040000 jmp Exit 121 122 GetFileName: 123 0000004B 89E6 mov esi, esp 124 0000004D AD lodsd 125 0000004E 83F802 cmp eax, 2 ; two arguments 126 ; (program file name & mod file name) 127 00000051 0F8299040000 jb pmsg_usage ; nothing to do 128 129 00000057 AD lodsd ; program file name address 130 00000058 AD lodsd ; mod file name address (file to be read) 131 00000059 89C6 mov esi, eax 132 0000005B BF[F9240000] mov edi, wav_file_name 133 ScanName: 134 00000060 AC lodsb 135 00000061 84C0 test al, al 136 00000063 0F8487040000 je pmsg_usage 137 00000069 3C20 cmp al, 20h 138 0000006B 74F3 je short ScanName ; scan start of name. 139 0000006D AA stosb 140 0000006E B4FF mov ah, 0FFh 141 a_0: 142 00000070 FEC4 inc ah 143 a_1: 144 00000072 AC lodsb 145 00000073 AA stosb 146 00000074 3C2E cmp al, '.' 147 00000076 74F8 je short a_0 148 00000078 20C0 and al, al 149 0000007A 75F6 jnz short a_1 150 151 0000007C 08E4 or ah, ah ; if period NOT found, 152 0000007E 750B jnz short _1 ; then add a .WAV extension. 153 SetExt: 154 00000080 4F dec edi 155 00000081 C7072E574156 mov dword [edi], '.WAV' 156 00000087 C6470400 mov byte [edi+4], 0 157 158 _1: 159 160 ; 26/11/2023 161 %if 0 162 ; Allocate Audio Buffer (for user) 163 ;sys _audio, 0200h, BUFFERSIZE, audio_buffer 164 ; 26/11/2023 165 sys _audio, 0200h, [buffersize], audio_buffer 166 jnc short _2 167 error_exit: 168 sys _msg, trdos386_err_msg, 255, 0Eh 169 jmp Exit 170 _2: 171 ; DIRECT CGA (TEXT MODE) MEMORY ACCESS 172 ; bl = 0, bh = 4 173 ; Direct access/map to CGA (Text) memory (0B8000h) 174 175 sys _video, 0400h 176 cmp eax, 0B8000h 177 jne short error_exit 178 179 ; Initialize Audio Device (bh = 3) 180 sys _audio, 0301h, 0, audio_int_handler 181 ; jc short error_exit 182 _3: 183 184 %endif 185 0000008B E8D6060000 call write_audio_dev_info 186 187 ; open the file 188 ; open existing file 189 00000090 E880040000 call openFile ; no error? ok. 190 00000095 731B jnc short _gsr 191 192 ; file not found! 193 sys _msg, noFileErrMsg, 255, 0Fh 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00000097 BB[EF220000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 0000009C B9FF000000 <1> mov ecx, %3 81 <1> %if %0 = 4 82 000000A1 BA0F000000 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 000000A6 B823000000 <1> mov eax, %1 87 <1> 88 000000AB CD40 <1> int 40h 194 _exit_: 195 000000AD E930040000 jmp Exit 196 197 _gsr: 198 000000B2 E898040000 call getSampleRate ; read the sample rate 199 ; pass it onto codec. 200 ;jc Exit 201 ; 25/11/2023 202 000000B7 72F4 jc short _exit_ 203 204 000000B9 66A3[D2240000] mov [sample_rate], ax 205 000000BF 880D[D0240000] mov [stmo], cl 206 000000C5 8815[D1240000] mov [bps], dl 207 208 ; 26/11/2023 209 000000CB C605[4C250000]00 mov byte [fbs_shift], 0 ; 0 = stereo and 16 bit 210 000000D2 FEC9 dec cl 211 000000D4 7506 jnz short _gsr_1 ; stereo 212 000000D6 FE05[4C250000] inc byte [fbs_shift] ; 1 = mono or 8 bit 213 _gsr_1: 214 000000DC 80FA08 cmp dl, 8 215 000000DF 7706 ja short _gsr_2 ; 16 bit samples 216 000000E1 FE05[4C250000] inc byte [fbs_shift] ; 2 = mono and 8 bit 217 _gsr_2: 218 ; 06/06/2017 219 sys _audio, 0E00h ; get audio controller info 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 000000E7 BB000E0000 <1> mov ebx, %2 79 <1> %if %0 >= 3 80 <1> mov ecx, %3 81 <1> %if %0 = 4 82 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 000000EC B820000000 <1> mov eax, %1 87 <1> 88 000000F1 CD40 <1> int 40h 220 000000F3 0F823D030000 jc error_exit ; 25/11/2023 221 222 ;cmp ah, 2 ; ICH ? (Intel AC'97 Audio Controller) 223 ;jne _dev_not_ready 224 225 ; EAX = IRQ Number in AL 226 ; Audio Device Number in AH 227 ; EBX = DEV/VENDOR ID 228 ; (DDDDDDDDDDDDDDDDVVVVVVVVVVVVVVVV) 229 ; ECX = BUS/DEV/FN 230 ; (00000000BBBBBBBBDDDDDFFF00000000) 231 ; EDX = NABMBAR/NAMBAR (for AC97) 232 ; (Low word, DX = NAMBAR address) 233 ; EDX = Base IO Addr (DX) for SB16 & VT8233 234 235 000000F9 A2[4B250000] mov [ac97_int_ln_reg], al 236 000000FE 891D[4D250000] mov [dev_vendor], ebx 237 00000104 890D[51250000] mov [bus_dev_fn], ecx 238 ;mov [ac97_NamBar], dx 239 ;shr dx, 16 240 ;mov [ac97_NabmBar], dx 241 0000010A 8915[55250000] mov [ac97_NamBar], edx 242 243 ; 01/06/2024 244 ; Reset Audio Device (bh = 8) 245 sys _audio, 0800h 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00000110 BB00080000 <1> mov ebx, %2 79 <1> %if %0 >= 3 80 <1> mov ecx, %3 81 <1> %if %0 = 4 82 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00000115 B820000000 <1> mov eax, %1 87 <1> 88 0000011A CD40 <1> int 40h 246 ;jc error_exit 247 0000011C 7230 jc short init_err 248 249 0000011E E825070000 call write_ac97_pci_dev_info 250 251 ; 01/06/2024 252 ; 25/11/2023 253 ; Get AC'97 Codec info 254 ; (Function 14, sub function 1) 255 sys _audio, 0E01h 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00000123 BB010E0000 <1> mov ebx, %2 79 <1> %if %0 >= 3 80 <1> mov ecx, %3 81 <1> %if %0 = 4 82 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00000128 B820000000 <1> mov eax, %1 87 <1> 88 0000012D CD40 <1> int 40h 256 ; Save Variable Rate Audio support bit 257 0000012F 2401 and al, 1 258 00000131 A2[DC240000] mov [VRA], al 259 260 ; 25/11/2023 261 00000136 E8D4080000 call write_VRA_info 262 263 ; 01/05/2017 264 0000013B E83D060000 call write_wav_file_info 265 266 ; 25/11/2023 267 ; ------------------------------------------ 268 269 00000140 803D[DC240000]01 cmp byte [VRA], 1 270 00000147 7220 jb short chk_sample_rate 271 272 playwav_48_khz: 273 ;mov dword [loadfromwavfile], loadFromFile 274 ;mov dword [buffersize], 65536 275 00000149 E9CF020000 jmp PlayNow 276 277 ; 01/06/2024 278 init_err: 279 sys _msg, msg_init_err, 255, 0Eh 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 0000014E BB[28230000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 00000153 B9FF000000 <1> mov ecx, %3 81 <1> %if %0 = 4 82 00000158 BA0E000000 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 0000015D B823000000 <1> mov eax, %1 87 <1> 88 00000162 CD40 <1> int 40h 280 00000164 E979030000 jmp Exit 281 282 ; 02/02/2025 283 chk_sample_rate: 284 ; set conversion parameters 285 ; (for 8, 11.025, 16, 22.050, 24, 32 kHZ) 286 00000169 66A1[D2240000] mov ax, [sample_rate] 287 0000016F 663D80BB cmp ax, 48000 288 00000173 74D4 je short playwav_48_khz 289 chk_22khz: 290 00000175 663D2256 cmp ax, 22050 291 00000179 7545 jne short chk_11khz 292 0000017B 803D[D1240000]08 cmp byte [bps], 8 293 00000182 7615 jna short chk_22khz_1 294 00000184 BB[A3160000] mov ebx, load_22khz_stereo_16_bit 295 00000189 803D[D0240000]01 cmp byte [stmo], 1 296 00000190 751A jne short chk_22khz_2 297 00000192 BB[16160000] mov ebx, load_22khz_mono_16_bit 298 00000197 EB13 jmp short chk_22khz_2 299 chk_22khz_1: 300 00000199 BB[8F150000] mov ebx, load_22khz_stereo_8_bit 301 0000019E 803D[D0240000]01 cmp byte [stmo], 1 302 000001A5 7505 jne short chk_22khz_2 303 000001A7 BB[06150000] mov ebx, load_22khz_mono_8_bit 304 chk_22khz_2: 305 000001AC B85A1D0000 mov eax, 7514 ; (442*17) 306 000001B1 BA25000000 mov edx, 37 307 000001B6 B911000000 mov ecx, 17 308 000001BB E9BA010000 jmp set_sizes 309 chk_11khz: 310 000001C0 663D112B cmp ax, 11025 311 000001C4 7545 jne short chk_44khz 312 000001C6 803D[D1240000]08 cmp byte [bps], 8 313 000001CD 7615 jna short chk_11khz_1 314 000001CF BB[BF180000] mov ebx, load_11khz_stereo_16_bit 315 000001D4 803D[D0240000]01 cmp byte [stmo], 1 316 000001DB 751A jne short chk_11khz_2 317 000001DD BB[46180000] mov ebx, load_11khz_mono_16_bit 318 000001E2 EB13 jmp short chk_11khz_2 319 chk_11khz_1: 320 000001E4 BB[CC170000] mov ebx, load_11khz_stereo_8_bit 321 000001E9 803D[D0240000]01 cmp byte [stmo], 1 322 000001F0 7505 jne short chk_11khz_2 323 000001F2 BB[54170000] mov ebx, load_11khz_mono_8_bit 324 chk_11khz_2: 325 000001F7 B8AD0E0000 mov eax, 3757 ; (221*17) 326 000001FC BA4A000000 mov edx, 74 327 00000201 B911000000 mov ecx, 17 328 00000206 E96F010000 jmp set_sizes 329 chk_44khz: 330 0000020B 663D44AC cmp ax, 44100 331 0000020F 7545 jne short chk_16khz 332 00000211 803D[D1240000]08 cmp byte [bps], 8 333 00000218 7615 jna short chk_44khz_1 334 0000021A BB[C61A0000] mov ebx, load_44khz_stereo_16_bit 335 0000021F 803D[D0240000]01 cmp byte [stmo], 1 336 00000226 751A jne short chk_44khz_2 337 00000228 BB[4D1A0000] mov ebx, load_44khz_mono_16_bit 338 0000022D EB13 jmp short chk_44khz_2 339 chk_44khz_1: 340 0000022F BB[D0190000] mov ebx, load_44khz_stereo_8_bit 341 00000234 803D[D0240000]01 cmp byte [stmo], 1 342 0000023B 7505 jne short chk_44khz_2 343 0000023D BB[54190000] mov ebx, load_44khz_mono_8_bit 344 chk_44khz_2: 345 00000242 B8D93A0000 mov eax, 15065 ; (655*23) 346 00000247 BA19000000 mov edx, 25 347 0000024C B917000000 mov ecx, 23 348 00000251 E924010000 jmp set_sizes 349 chk_16khz: 350 00000256 663D803E cmp ax, 16000 351 0000025A 7545 jne short chk_8khz 352 0000025C 803D[D1240000]08 cmp byte [bps], 8 353 00000263 7615 jna short chk_16khz_1 354 00000265 BB[45100000] mov ebx, load_16khz_stereo_16_bit 355 0000026A 803D[D0240000]01 cmp byte [stmo], 1 356 00000271 751A jne short chk_16khz_2 357 00000273 BB[C40F0000] mov ebx, load_16khz_mono_16_bit 358 00000278 EB13 jmp short chk_16khz_2 359 chk_16khz_1: 360 0000027A BB[0A0F0000] mov ebx, load_16khz_stereo_8_bit 361 0000027F 803D[D0240000]01 cmp byte [stmo], 1 362 00000286 7505 jne short chk_16khz_2 363 00000288 BB[8B0E0000] mov ebx, load_16khz_mono_8_bit 364 chk_16khz_2: 365 0000028D B855150000 mov eax, 5461 366 00000292 BA03000000 mov edx, 3 367 00000297 B901000000 mov ecx, 1 368 0000029C E9D9000000 jmp set_sizes 369 chk_8khz: 370 000002A1 663D401F cmp ax, 8000 371 000002A5 7545 jne short chk_24khz 372 000002A7 803D[D1240000]08 cmp byte [bps], 8 373 000002AE 7615 jna short chk_8khz_1 374 000002B0 BB[400D0000] mov ebx, load_8khz_stereo_16_bit 375 000002B5 803D[D0240000]01 cmp byte [stmo], 1 376 000002BC 751A jne short chk_8khz_2 377 000002BE BB[700C0000] mov ebx, load_8khz_mono_16_bit 378 000002C3 EB13 jmp short chk_8khz_2 379 chk_8khz_1: 380 000002C5 BB[400B0000] mov ebx, load_8khz_stereo_8_bit 381 000002CA 803D[D0240000]01 cmp byte [stmo], 1 382 000002D1 7505 jne short chk_8khz_2 383 000002D3 BB[5C0A0000] mov ebx, load_8khz_mono_8_bit 384 chk_8khz_2: 385 000002D8 B8AA0A0000 mov eax, 2730 386 000002DD BA06000000 mov edx, 6 387 000002E2 B901000000 mov ecx, 1 388 000002E7 E98E000000 jmp set_sizes 389 chk_24khz: 390 000002EC 663DC05D cmp ax, 24000 391 000002F0 7542 jne short chk_32khz 392 000002F2 803D[D1240000]08 cmp byte [bps], 8 393 000002F9 7615 jna short chk_24khz_1 394 000002FB BB[72120000] mov ebx, load_24khz_stereo_16_bit 395 00000300 803D[D0240000]01 cmp byte [stmo], 1 396 00000307 751A jne short chk_24khz_2 397 00000309 BB[0C120000] mov ebx, load_24khz_mono_16_bit 398 0000030E EB13 jmp short chk_24khz_2 399 chk_24khz_1: 400 00000310 BB[82110000] mov ebx, load_24khz_stereo_8_bit 401 00000315 803D[D0240000]01 cmp byte [stmo], 1 402 0000031C 7505 jne short chk_24khz_2 403 0000031E BB[1B110000] mov ebx, load_24khz_mono_8_bit 404 chk_24khz_2: 405 00000323 B800200000 mov eax, 8192 406 00000328 BA02000000 mov edx, 2 407 0000032D B901000000 mov ecx, 1 408 00000332 EB46 jmp short set_sizes 409 chk_32khz: 410 00000334 663D007D cmp ax, 32000 411 ;jne short vra_needed 412 ; 02/02/2025 413 00000338 7574 jne short chk_12khz 414 0000033A 803D[D1240000]08 cmp byte [bps], 8 415 00000341 7615 jna short chk_32khz_1 416 00000343 BB[76140000] mov ebx, load_32khz_stereo_16_bit 417 00000348 803D[D0240000]01 cmp byte [stmo], 1 418 0000034F 751A jne short chk_32khz_2 419 00000351 BB[09140000] mov ebx, load_32khz_mono_16_bit 420 00000356 EB13 jmp short chk_32khz_2 421 chk_32khz_1: 422 00000358 BB[6C130000] mov ebx, load_32khz_stereo_8_bit 423 0000035D 803D[D0240000]01 cmp byte [stmo], 1 424 00000364 7505 jne short chk_32khz_2 425 00000366 BB[F9120000] mov ebx, load_32khz_mono_8_bit 426 chk_32khz_2: 427 0000036B B8AA2A0000 mov eax, 10922 428 00000370 BA03000000 mov edx, 3 429 00000375 B902000000 mov ecx, 2 430 ;jmp short set_sizes 431 432 set_sizes: 433 0000037A 803D[D0240000]01 cmp byte [stmo], 1 434 00000381 7402 je short ss_1 435 00000383 D1E0 shl eax, 1 436 ss_1: 437 00000385 803D[D1240000]08 cmp byte [bps], 8 438 0000038C 7602 jna short ss_2 439 ; 16 bit samples 440 0000038E D1E0 shl eax, 1 441 ss_2: 442 00000390 A3[15040000] mov [loadsize], eax 443 00000395 F7E2 mul edx 444 ;cmp ecx, 1 445 ;je short ss_3 446 ;ss_3: 447 00000397 F7F1 div ecx 448 00000399 8A0D[4C250000] mov cl, [fbs_shift] 449 0000039F D3E0 shl eax, cl 450 ; 26/11/2023 451 ;shr eax, 1 ; buffer size is 16 bit sample count 452 000003A1 A3[19040000] mov [buffersize], eax ; buffer size in bytes 453 000003A6 891D[11040000] mov [loadfromwavfile], ebx 454 000003AC EB6F jmp short PlayNow 455 456 ;;;; 457 ; 02/02/2025 458 chk_12khz: 459 000003AE 663DE02E cmp ax, 12000 460 000003B2 7542 jne short vra_needed 461 000003B4 803D[D1240000]08 cmp byte [bps], 8 462 000003BB 7615 jna short chk_12khz_1 463 000003BD BB[321C0000] mov ebx, load_12khz_stereo_16_bit 464 000003C2 803D[D0240000]01 cmp byte [stmo], 1 465 000003C9 751A jne short chk_12khz_2 466 000003CB BB[E31B0000] mov ebx, load_12khz_mono_16_bit 467 000003D0 EB13 jmp short chk_12khz_2 468 chk_12khz_1: 469 000003D2 BB[8D1B0000] mov ebx, load_12khz_stereo_8_bit 470 000003D7 803D[D0240000]01 cmp byte [stmo], 1 471 000003DE 7505 jne short chk_12khz_2 472 000003E0 BB[451B0000] mov ebx, load_12khz_mono_8_bit 473 chk_12khz_2: 474 000003E5 B800100000 mov eax, 4096 475 000003EA BA04000000 mov edx, 4 476 000003EF B901000000 mov ecx, 1 477 000003F4 EB84 jmp set_sizes 478 ;;;; 479 480 vra_needed: 481 sys _msg, msg_no_vra, 255, 07h 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 000003F6 BB[59230000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 000003FB B9FF000000 <1> mov ecx, %3 81 <1> %if %0 = 4 82 00000400 BA07000000 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00000405 B823000000 <1> mov eax, %1 87 <1> 88 0000040A CD40 <1> int 40h 482 0000040C E9D1000000 jmp Exit 483 484 ; 26/11/2023 485 ; 13/11/2023 486 loadfromwavfile: 487 00000411 [C1050000] dd loadFromFile 488 loadsize: ; read from wav file 489 00000415 00000000 dd 0 490 buffersize: ; write to DMA buffer 491 00000419 00000100 dd 65536 ; bytes 492 493 PlayNow: 494 495 ; 26/11/2023 496 %if 1 497 ; Allocate Audio Buffer (for user) 498 ;sys _audio, 0200h, BUFFERSIZE, audio_buffer 499 ; 26/11/2023 500 sys _audio, 0200h, [buffersize], audio_buffer 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 0000041D BB00020000 <1> mov ebx, %2 79 <1> %if %0 >= 3 80 00000422 8B0D[19040000] <1> mov ecx, %3 81 <1> %if %0 = 4 82 00000428 BA[00300000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 0000042D B820000000 <1> mov eax, %1 87 <1> 88 00000432 CD40 <1> int 40h 501 00000434 731B jnc short _2 502 503 ; 26/11/2023 - temporary 504 ;sys _msg, test_1, 255, 0Ch 505 506 error_exit: 507 sys _msg, trdos386_err_msg, 255, 0Eh 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00000436 BB[08230000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 0000043B B9FF000000 <1> mov ecx, %3 81 <1> %if %0 = 4 82 00000440 BA0E000000 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00000445 B823000000 <1> mov eax, %1 87 <1> 88 0000044A CD40 <1> int 40h 508 0000044C E991000000 jmp Exit 509 _2: 510 ; DIRECT CGA (TEXT MODE) MEMORY ACCESS 511 ; bl = 0, bh = 4 512 ; Direct access/map to CGA (Text) memory (0B8000h) 513 514 sys _video, 0400h 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00000451 BB00040000 <1> mov ebx, %2 79 <1> %if %0 >= 3 80 <1> mov ecx, %3 81 <1> %if %0 = 4 82 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00000456 B81F000000 <1> mov eax, %1 87 <1> 88 0000045B CD40 <1> int 40h 515 0000045D 3D00800B00 cmp eax, 0B8000h 516 00000462 75D2 jne short error_exit 517 518 ; 01/06/2024 519 ; Initialize Audio Device (bh = 3) 520 sys _audio, 0301h, 0, audio_int_handler 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00000464 BB01030000 <1> mov ebx, %2 79 <1> %if %0 >= 3 80 00000469 B900000000 <1> mov ecx, %3 81 <1> %if %0 = 4 82 0000046E BA[AD050000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00000473 B820000000 <1> mov eax, %1 87 <1> 88 00000478 CD40 <1> int 40h 521 ;jc short error_exit 522 0000047A 0F82CEFCFFFF jc init_err 523 _3: 524 525 %endif 526 527 ; 528 ; position file pointer to start in actual wav data 529 ; MUCH improvement should really be done here to check if sample size is 530 ; supported, make sure there are 2 channels, etc. 531 ; 532 ;mov ah, 42h 533 ;mov al, 0 ; from start of file 534 ;mov bx, [FileHandle] 535 ;xor cx, cx 536 ;mov dx, 44 ; jump past .wav/riff header 537 ;int 21h 538 539 sys _seek, [FileHandle], 44, 0 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00000480 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 00000486 B92C000000 <1> mov ecx, %3 81 <1> %if %0 = 4 82 0000048B BA00000000 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00000490 B813000000 <1> mov eax, %1 87 <1> 88 00000495 CD40 <1> int 40h 540 541 sys _msg, nextline, 255, 07h ; 01/05/2017 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00000497 BB[DE230000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 0000049C B9FF000000 <1> mov ecx, %3 81 <1> %if %0 = 4 82 000004A1 BA07000000 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 000004A6 B823000000 <1> mov eax, %1 87 <1> 88 000004AB CD40 <1> int 40h 542 543 ; play the .wav file. Most of the good stuff is in here. 544 545 000004AD E8C2010000 call PlayWav 546 547 ; close the .wav file and exit. 548 549 StopPlaying: 550 ; Stop Playing 551 sys _audio, 0700h 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 000004B2 BB00070000 <1> mov ebx, %2 79 <1> %if %0 >= 3 80 <1> mov ecx, %3 81 <1> %if %0 = 4 82 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 000004B7 B820000000 <1> mov eax, %1 87 <1> 88 000004BC CD40 <1> int 40h 552 ; Cancel callback service (for user) 553 sys _audio, 0900h 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 000004BE BB00090000 <1> mov ebx, %2 79 <1> %if %0 >= 3 80 <1> mov ecx, %3 81 <1> %if %0 = 4 82 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 000004C3 B820000000 <1> mov eax, %1 87 <1> 88 000004C8 CD40 <1> int 40h 554 ; Deallocate Audio Buffer (for user) 555 sys _audio, 0A00h 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 000004CA BB000A0000 <1> mov ebx, %2 79 <1> %if %0 >= 3 80 <1> mov ecx, %3 81 <1> %if %0 = 4 82 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 000004CF B820000000 <1> mov eax, %1 87 <1> 88 000004D4 CD40 <1> int 40h 556 ; Disable Audio Device 557 sys _audio, 0C00h 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 000004D6 BB000C0000 <1> mov ebx, %2 79 <1> %if %0 >= 3 80 <1> mov ecx, %3 81 <1> %if %0 = 4 82 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 000004DB B820000000 <1> mov eax, %1 87 <1> 88 000004E0 CD40 <1> int 40h 558 Exit: 559 000004E2 E847000000 call closeFile 560 561 sys _exit ; Bye! 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 <1> mov ebx, %2 79 <1> %if %0 >= 3 80 <1> mov ecx, %3 81 <1> %if %0 = 4 82 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 000004E7 B801000000 <1> mov eax, %1 87 <1> 88 000004EC CD40 <1> int 40h 562 here: 563 000004EE EBFE jmp short here 564 565 pmsg_usage: 566 sys _msg, msg_usage, 255, 0Bh 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 000004F0 BB[A5220000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 000004F5 B9FF000000 <1> mov ecx, %3 81 <1> %if %0 = 4 82 000004FA BA0B000000 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 000004FF B823000000 <1> mov eax, %1 87 <1> 88 00000504 CD40 <1> int 40h 567 00000506 EBDA jmp short Exit 568 569 ; 25/11/2023 570 DetectAC97: 571 ; Detect (BH=1) AC'97 (BL=2) Audio Device 572 sys _audio, 0102h 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00000508 BB02010000 <1> mov ebx, %2 79 <1> %if %0 >= 3 80 <1> mov ecx, %3 81 <1> %if %0 = 4 82 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 0000050D B820000000 <1> mov eax, %1 87 <1> 88 00000512 CD40 <1> int 40h 573 574 ; 01/06/2024 575 %if 0 576 jc short DetectAC97_retn 577 578 ; 25/11/2023 579 ; Get AC'97 Codec info 580 ; (Function 14, sub function 1) 581 sys _audio, 0E01h 582 ; Save Variable Rate Audio support bit 583 and al, 1 584 mov [VRA], al 585 %endif 586 587 DetectAC97_retn: 588 00000514 C3 retn 589 590 ;open or create file 591 ; 592 ;input: ds:dx-->filename (asciiz) 593 ; al=file Mode (create or open) 594 ;output: none cs:[FileHandle] filled 595 ; 596 openFile: 597 ;mov ah, 3Bh ; start with a mode 598 ;add ah, al ; add in create or open mode 599 ;xor ecx, ecx 600 ;int 21h 601 ;jc short _of1 602 ;;mov [cs:FileHandle], ax 603 604 sys _open, wav_file_name, 0 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00000515 BB[F9240000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 0000051A B900000000 <1> mov ecx, %3 81 <1> %if %0 = 4 82 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 0000051F B805000000 <1> mov eax, %1 87 <1> 88 00000524 CD40 <1> int 40h 605 00000526 7205 jc short _of1 606 607 00000528 A3[DE210000] mov [FileHandle], eax 608 _of1: 609 0000052D C3 retn 610 611 ; close the currently open file 612 ; input: none, uses cs:[FileHandle] 613 closeFile: 614 0000052E 833D[DE210000]FF cmp dword [FileHandle], -1 615 00000535 7417 je short _cf1 616 ;mov bx, [FileHandle] 617 ;mov ax, 3E00h 618 ;int 21h ;close file 619 620 sys _close, [FileHandle] 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00000537 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 <1> mov ecx, %3 81 <1> %if %0 = 4 82 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 0000053D B806000000 <1> mov eax, %1 87 <1> 88 00000542 CD40 <1> int 40h 621 00000544 C705[DE210000]FFFF- mov dword [FileHandle], -1 621 0000054C FFFF 622 _cf1: 623 0000054E C3 retn 624 625 getSampleRate: 626 627 ; reads the sample rate from the .wav file. 628 ; entry: none - assumes file is already open 629 ; exit: ax = sample rate (11025, 22050, 44100, 48000) 630 ; cx = number of channels (mono=1, stereo=2) 631 ; dx = bits per sample (8, 16) 632 633 0000054F 53 push ebx 634 635 ;mov ah, 42h 636 ;mov al, 0 ; from start of file 637 ;mov bx, [FileHandle] 638 ;xor ecx, ecx 639 ;mov dx, 08h ; "WAVE" 640 ;int 21h 641 642 sys _seek, [FileHandle], 8, 0 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00000550 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 00000556 B908000000 <1> mov ecx, %3 81 <1> %if %0 = 4 82 0000055B BA00000000 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00000560 B813000000 <1> mov eax, %1 87 <1> 88 00000565 CD40 <1> int 40h 643 644 ;mov dx, smpRBuff 645 ;mov cx, 28 ; 28 bytes 646 ;mov ah, 3fh 647 ;int 21h 648 649 sys _read, [FileHandle], smpRBuff, 28 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00000567 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 0000056D B9[DD240000] <1> mov ecx, %3 81 <1> %if %0 = 4 82 00000572 BA1C000000 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00000577 B803000000 <1> mov eax, %1 87 <1> 88 0000057C CD40 <1> int 40h 650 651 0000057E 813D[DD240000]5741- cmp dword [smpRBuff], 'WAVE' 651 00000586 5645 652 00000588 7520 jne short gsr_stc 653 654 0000058A 66833D[E9240000]01 cmp word [smpRBuff+12], 1 ; Offset 20, must be 1 (= PCM) 655 00000592 7516 jne short gsr_stc 656 657 00000594 668B0D[EB240000] mov cx, [smpRBuff+14] ; return num of channels in CX 658 0000059B 66A1[ED240000] mov ax, [smpRBuff+16] ; return sample rate in AX 659 000005A1 668B15[F7240000] mov dx, [smpRBuff+26] ; return bits per sample value in DX 660 gsr_retn: 661 000005A8 5B pop ebx 662 000005A9 C3 retn 663 gsr_stc: 664 000005AA F9 stc 665 000005AB EBFB jmp short gsr_retn 666 667 audio_int_handler: 668 ; 13/12/2024 669 ; 18/08/2020 (14/10/2020, 'wavplay2.s') 670 671 ;mov byte [srb], 1 ; interrupt (or signal response byte) 672 673 ;cmp byte [cbs_busy], 1 674 ;jnb short _callback_bsy_retn 675 676 ;mov byte [cbs_busy], 1 677 678 ; 13/12/2024 679 ;mov al, [half_buff] 680 ; 681 ;cmp al, 1 682 ;jb short _callback_retn 683 684 ; 18/08/2020 685 ;mov byte [srb], 1 686 ; 13/12/2024 687 000005AD FE05[DA240000] inc byte [srb] 688 689 ; 13/12/2024 690 ;xor byte [half_buff], 3 ; 2->1, 1->2 691 692 ; 13/12/2024 693 ;add al, '0' 694 ;tL0: ; 26/11/2023 695 ;mov ah, 4Eh 696 ;mov ebx, 0B8000h ; video display page address 697 ;mov [ebx], ax ; show playing buffer (1, 2) 698 ;_callback_retn: 699 ;;mov byte [cbs_busy], 0 700 ;_callback_bsy_retn: 701 sys _rele ; return from callback service 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 <1> mov ebx, %2 79 <1> %if %0 >= 3 80 <1> mov ecx, %3 81 <1> %if %0 = 4 82 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 000005B3 B827000000 <1> mov eax, %1 87 <1> 88 000005B8 CD40 <1> int 40h 702 ; we must not come here ! 703 sys _exit 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 <1> mov ebx, %2 79 <1> %if %0 >= 3 80 <1> mov ecx, %3 81 <1> %if %0 = 4 82 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 000005BA B801000000 <1> mov eax, %1 87 <1> 88 000005BF CD40 <1> int 40h 704 705 loadFromFile: 706 ; 26/11/2023 707 000005C1 F605[D8240000]01 test byte [flags], ENDOFFILE ; have we already read the 708 ; last of the file? 709 000005C8 7402 jz short lff_0 ; no 710 000005CA F9 stc 711 000005CB C3 retn 712 lff_0: 713 ; 13/06/2017 714 ;mov edx, BUFFERSIZE 715 ; 26/11/2023 716 000005CC BF[00300000] mov edi, audio_buffer 717 000005D1 8B15[19040000] mov edx, [buffersize] ; bytes 718 000005D7 8A0D[4C250000] mov cl, [fbs_shift] 719 000005DD 20C9 and cl, cl 720 000005DF 7409 jz short lff_1 ; stereo, 16 bit 721 722 ; fbs_shift = 723 ; 2 for mono and 8 bit sample (multiplier = 4) 724 ; 1 for mono or 8 bit sample (multiplier = 2) 725 000005E1 D3EA shr edx, cl 726 ;inc edx 727 728 000005E3 BE[00300100] mov esi, temp_buffer 729 000005E8 EB02 jmp short lff_2 730 lff_1: 731 ;mov esi, audio_buffer 732 000005EA 89FE mov esi, edi ; audio_buffer 733 lff_2: 734 ; 17/03/2017 735 ; esi = buffer address 736 ; edx = buffer size 737 738 ; 26/11/2023 739 ; load file into memory 740 sys _read, [FileHandle], esi 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 000005EC 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 000005F2 89F1 <1> mov ecx, %3 81 <1> %if %0 = 4 82 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 000005F4 B803000000 <1> mov eax, %1 87 <1> 88 000005F9 CD40 <1> int 40h 741 ; 14/12/2024 742 000005FB 8B0D[19040000] mov ecx, [buffersize] 743 ;jc short padfill ; error ! 744 ; 14/12/2024 745 00000601 7255 jc short lff_10 746 747 00000603 21C0 and eax, eax 748 00000605 7453 jz short padfill 749 lff_3: 750 ; 26/11/2023 751 00000607 8A1D[4C250000] mov bl, [fbs_shift] 752 0000060D 20DB and bl, bl 753 0000060F 7456 jz short lff_11 754 755 ; 14/12/2024 756 ;sub ecx, eax 757 ;mov ebp, ecx 758 ; 14/12/2024 759 00000611 29C2 sub edx, eax 760 761 ;mov esi, temp_buffer 762 ;mov edi, audio_buffer 763 00000613 89C1 mov ecx, eax ; byte count 764 765 00000615 803D[D1240000]08 cmp byte [bps], 8 ; bits per sample (8 or 16) 766 0000061C 751E jne short lff_6 ; 16 bit samples 767 ; 8 bit samples 768 0000061E FECB dec bl ; shift count, 1 = stereo, 2 = mono 769 00000620 740E jz short lff_5 ; 8 bit, stereo 770 lff_4: 771 ; mono & 8 bit 772 00000622 AC lodsb 773 00000623 2C80 sub al, 80h ; 08/11/2023 774 00000625 C1E008 shl eax, 8 ; convert 8 bit sample to 16 bit sample 775 00000628 66AB stosw ; left channel 776 0000062A 66AB stosw ; right channel 777 0000062C E2F4 loop lff_4 778 0000062E EB16 jmp short lff_8 779 lff_5: 780 ; stereo & 8 bit 781 00000630 AC lodsb 782 00000631 2C80 sub al, 80h ; 08/11/2023 783 00000633 C1E008 shl eax, 8 ; convert 8 bit sample to 16 bit sample 784 00000636 66AB stosw 785 00000638 E2F6 loop lff_5 786 0000063A EB0A jmp short lff_8 787 lff_6: 788 0000063C D1E9 shr ecx, 1 ; word count 789 lff_7: 790 0000063E 66AD lodsw 791 00000640 66AB stosw ; left channel 792 00000642 66AB stosw ; right channel 793 00000644 E2F8 loop lff_7 794 lff_8: 795 ; 27/11/2023 796 00000646 F8 clc 797 ; 14/12/2024 798 ;mov ecx, ebp 799 ;jecxz endLFF_retn 800 00000647 09D2 or edx, edx 801 00000649 741B jz short endLFF_retn 802 803 ; 14/12/2024 804 0000064B B9[00300000] mov ecx, audio_buffer 805 00000650 030D[19040000] add ecx, [buffersize] 806 00000656 29F9 sub ecx, edi 807 808 ; 14/12/2024 809 lff_10: 810 00000658 31C0 xor eax, eax ; silence 811 padfill: 812 0000065A D1E9 shr ecx, 1 813 0000065C F366AB rep stosw 814 lff_9: 815 0000065F 800D[D8240000]01 or byte [flags], ENDOFFILE ; end of file flag 816 endLFF_retn: 817 00000666 C3 retn 818 819 lff_11: 820 ; 16 bit stereo 821 ; ecx = buffer size 822 ; eax = read count 823 00000667 29C1 sub ecx, eax 824 00000669 76FB jna short endLFF_retn 825 0000066B 01C7 add edi, eax ; audio_buffer + eax 826 0000066D EBE9 jmp short lff_10 ; padfill 827 828 error_exit_2: 829 ; 26/11/2023 - temporary 830 ;sys _msg, test_2, 255, 0Ch 831 832 0000066F E9C2FDFFFF jmp error_exit 833 834 ; 26/11/2023 - temporary 835 ;test_1: 836 ; db 13, 10, 'Test 1', 13,10, 0 837 ;test_2: 838 ; db 13, 10, 'Test 2', 13,10, 0 839 840 PlayWav: 841 ; 26/11/2023 842 ; 18/08/2020 (27/07/2020, 'wavplay2.s') 843 ; 13/06/2017 844 ; Convert 8 bit samples to 16 bit samples 845 ; and convert mono samples to stereo samples 846 847 ; 26/11/2023 848 ; load 32768 bytes into audio buffer 849 ;mov edi, audio_buffer 850 ;;mov edx, BUFFERSIZE 851 ; 26/11/2023 852 ;mov edx, [buffersize] 853 ;call loadFromFile 854 ; 26/11/2023 855 00000674 FF15[11040000] call dword [loadfromwavfile] 856 0000067A 72F3 jc short error_exit_2 857 0000067C C605[D9240000]01 mov byte [half_buff], 1 ; (DMA) Buffer 1 858 859 ; 18/08/2020 (27/07/2020, 'wavplay2.s') 860 00000683 F605[D8240000]01 test byte [flags], ENDOFFILE ; end of file 861 0000068A 7512 jnz short _6 ; yes 862 ; bypass filling dma half buffer 2 863 864 ; bh = 16 : update (current, first) dma half buffer 865 ; bl = 0 : then switch to the next (second) half buffer 866 sys _audio, 1000h 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 0000068C BB00100000 <1> mov ebx, %2 79 <1> %if %0 >= 3 80 <1> mov ecx, %3 81 <1> %if %0 = 4 82 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00000691 B820000000 <1> mov eax, %1 87 <1> 88 00000696 CD40 <1> int 40h 867 868 ; 18/08/2020 869 ; [audio_flag] = 1 (in TRDOS 386 kernel) 870 871 ; audio_buffer must be filled again after above system call 872 ; (Because audio interrupt will be generated by AC97 hardware 873 ; at the end of the first half of dma buffer.. so, 874 ; the second half must be ready. 'sound_play' will use it.) 875 876 ; 26/11/2023 877 ;mov edi, audio_buffer 878 ;;mov edx, BUFFERSIZE 879 ; 26/11/2023 880 ;mov edx, [buffersize] 881 ;call loadFromFile 882 ; 26/11/2023 883 00000698 FF15[11040000] call dword [loadfromwavfile] 884 ;jc short p_return 885 _6: 886 ; Set Master Volume Level (BL=0 or 80h) 887 ; for next playing (BL>=80h) 888 ;sys _audio, 0B80h, 1D1Dh 889 sys _audio, 0B00h, 1D1Dh 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 0000069E BB000B0000 <1> mov ebx, %2 79 <1> %if %0 >= 3 80 000006A3 B91D1D0000 <1> mov ecx, %3 81 <1> %if %0 = 4 82 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 000006A8 B820000000 <1> mov eax, %1 87 <1> 88 000006AD CD40 <1> int 40h 890 891 ; 18/08/2020 892 ;mov byte [volume_level], 1Dh 893 000006AF 880D[DB240000] mov [volume_level], cl 894 895 ; Start to play 896 000006B5 A0[D1240000] mov al, [bps] 897 000006BA C0E804 shr al, 4 ; 8 -> 0, 16 -> 1 898 000006BD D0E0 shl al, 1 ; 16 -> 2, 8 -> 0 899 000006BF 8A1D[D0240000] mov bl, [stmo] 900 000006C5 FECB dec bl 901 000006C7 08C3 or bl, al 902 000006C9 668B0D[D2240000] mov cx, [sample_rate] 903 000006D0 B704 mov bh, 4 ; start to play 904 sys _audio 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 <1> mov ebx, %2 79 <1> %if %0 >= 3 80 <1> mov ecx, %3 81 <1> %if %0 = 4 82 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 000006D2 B820000000 <1> mov eax, %1 87 <1> 88 000006D7 CD40 <1> int 40h 905 906 ;mov ebx, 0B8000h ; video display page address 907 ;mov ah, 4Eh 908 ;mov al, [half_buffer] 909 ;mov [ebx], ax ; show playing buffer (1, 2) 910 911 ; 18/08/2020 (27/07/2020, 'wavplay2.s') 912 ; Here.. 913 ; If byte [flags] <> ENDOFFILE ... 914 ; user's audio_buffer has been copied to dma half buffer 2 915 916 ; [audio_flag] = 0 (in TRDOS 386 kernel) 917 918 ; audio_buffer must be filled again after above system call 919 ; (Because, audio interrupt will be generated by VT8237R 920 ; at the end of the first half of dma buffer.. so, 921 ; the 2nd half of dma buffer is ready but the 1st half 922 ; must be filled again.) 923 924 ; 14/12/2024 925 %if 0 926 ; 18/08/2020 927 test byte [flags], ENDOFFILE ; end of file 928 jnz short p_loop ; yes 929 930 ; 18/08/2020 931 ; load 32768 bytes into audio buffer 932 ;; (for the second half of DMA buffer) 933 ; 27/11/2023 934 ; 20/05/2017 935 ;mov edi, audio_buffer 936 ;mov edx, BUFFERSIZE 937 ; 26/11/2023 938 ;mov edx, [buffersize] 939 ;call loadFromFile 940 ; 26/11/2023 941 call dword [loadfromwavfile] 942 ;jc short p_return 943 ;mov byte [half_buff], 2 ; (DMA) Buffer 2 944 %endif 945 946 ; we need to wait for 'SRB' (audio interrupt) 947 ; (we can not return from 'PlayWav' here 948 ; even if we have got an error from file reading) 949 ; ((!!current audio data must be played!!)) 950 951 ; 18/08/2020 952 ;mov byte [srb], 1 953 954 p_loop: 955 ;mov ah, 1 ; any key pressed? 956 ;int 32h ; no, Loop. 957 ;jz short q_loop 958 ; 959 ;mov ah, 0 ; flush key buffer... 960 ;int 32h 961 962 ; 18/08/2020 (14/10/2017, 'wavplay2.s') 963 000006D9 803D[DA240000]00 cmp byte [srb], 0 964 000006E0 7627 jna short q_loop 965 000006E2 C605[DA240000]00 mov byte [srb], 0 966 ; 13/12/2024 967 000006E9 8035[D9240000]03 xor byte [half_buff], 3 ; 2->1, 1->2 968 969 ; 27/11/2023 970 ;mov edi, audio_buffer 971 ;mov edx, BUFFERSIZE 972 ; 26/11/2023 973 ;mov edx, [buffersize] 974 ;call loadFromFile 975 ; 26/11/2023 976 000006F0 FF15[11040000] call dword [loadfromwavfile] 977 000006F6 7223 jc short p_return 978 979 ; 14/12/2024 980 ;;; 981 ; bh = 16 : update (current, first) dma half buffer 982 ; bl = 0 : then switch to the other half buffer 983 sys _audio, 1000h 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 000006F8 BB00100000 <1> mov ebx, %2 79 <1> %if %0 >= 3 80 <1> mov ecx, %3 81 <1> %if %0 = 4 82 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 000006FD B820000000 <1> mov eax, %1 87 <1> 88 00000702 CD40 <1> int 40h 984 ;;;; 985 986 ; 13/12/2024 987 00000704 E819000000 call tL0 988 q_loop: 989 00000709 B401 mov ah, 1 ; any key pressed? 990 0000070B CD32 int 32h ; no, Loop. 991 0000070D 74CA jz short p_loop 992 993 0000070F B400 mov ah, 0 ; flush key buffer... 994 00000711 CD32 int 32h 995 996 00000713 3C2B cmp al, '+' ; increase sound volume 997 00000715 741D je short inc_volume_level 998 00000717 3C2D cmp al, '-' 999 00000719 743C je short dec_volume_level 1000 1001 p_return: 1002 0000071B C605[D9240000]00 mov byte [half_buff], 0 1003 ; 13/12/2024 1004 ;call tL0 1005 ;retn 1006 1007 ; 13/12/2024 1008 tL0: 1009 00000722 A0[D9240000] mov al, [half_buff] 1010 00000727 0430 add al, '0' 1011 00000729 B44E mov ah, 4Eh 1012 0000072B BB00800B00 mov ebx, 0B8000h ; video display page address 1013 00000730 668903 mov [ebx], ax ; show playing buffer (1, 2) 1014 00000733 C3 retn 1015 1016 ; 18/08/2020 (14/10/2017, 'wavplay2.s') 1017 inc_volume_level: 1018 00000734 8A0D[DB240000] mov cl, [volume_level] 1019 0000073A 80F91F cmp cl, 1Fh ; 31 1020 0000073D 73CA jnb short q_loop 1021 0000073F FEC1 inc cl 1022 change_volume_level: 1023 00000741 880D[DB240000] mov [volume_level], cl 1024 00000747 88CD mov ch, cl 1025 ; Set Master Volume Level 1026 sys _audio, 0B00h 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00000749 BB000B0000 <1> mov ebx, %2 79 <1> %if %0 >= 3 80 <1> mov ecx, %3 81 <1> %if %0 = 4 82 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 0000074E B820000000 <1> mov eax, %1 87 <1> 88 00000753 CD40 <1> int 40h 1027 00000755 EB82 jmp short p_loop 1028 dec_volume_level: 1029 00000757 8A0D[DB240000] mov cl, [volume_level] 1030 0000075D 80F901 cmp cl, 1 ; 1 1031 ;jna short p_loop 1032 ; 14/12/2024 1033 00000760 76A7 jna short q_loop 1034 00000762 FEC9 dec cl 1035 00000764 EBDB jmp short change_volume_level 1036 1037 write_audio_dev_info: 1038 ; EBX = Message address 1039 ; ECX = Max. message length (or stop on ZERO character) 1040 ; (1 to 255) 1041 ; DL = Message color (07h = light gray, 0Fh = white) 1042 sys _msg, msgAudioCardInfo, 255, 0Fh 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00000766 BB[7C220000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 0000076B B9FF000000 <1> mov ecx, %3 81 <1> %if %0 = 4 82 00000770 BA0F000000 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00000775 B823000000 <1> mov eax, %1 87 <1> 88 0000077A CD40 <1> int 40h 1043 0000077C C3 retn 1044 1045 write_wav_file_info: 1046 ; 01/05/2017 1047 sys _msg, msgWavFileName, 255, 0Fh 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 0000077D BB[92230000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 00000782 B9FF000000 <1> mov ecx, %3 81 <1> %if %0 = 4 82 00000787 BA0F000000 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 0000078C B823000000 <1> mov eax, %1 87 <1> 88 00000791 CD40 <1> int 40h 1048 sys _msg, wav_file_name, 255, 0Fh 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00000793 BB[F9240000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 00000798 B9FF000000 <1> mov ecx, %3 81 <1> %if %0 = 4 82 0000079D BA0F000000 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 000007A2 B823000000 <1> mov eax, %1 87 <1> 88 000007A7 CD40 <1> int 40h 1049 1050 write_sample_rate: 1051 ; 01/05/2017 1052 000007A9 66A1[D2240000] mov ax, [sample_rate] 1053 ; ax = sample rate (hertz) 1054 000007AF 31D2 xor edx, edx 1055 000007B1 66B90A00 mov cx, 10 1056 000007B5 66F7F1 div cx 1057 000007B8 0015[B7230000] add [msgHertz+4], dl 1058 000007BE 29D2 sub edx, edx 1059 000007C0 66F7F1 div cx 1060 000007C3 0015[B6230000] add [msgHertz+3], dl 1061 000007C9 29D2 sub edx, edx 1062 000007CB 66F7F1 div cx 1063 000007CE 0015[B5230000] add [msgHertz+2], dl 1064 000007D4 29D2 sub edx, edx 1065 000007D6 66F7F1 div cx 1066 000007D9 0015[B4230000] add [msgHertz+1], dl 1067 000007DF 0005[B3230000] add [msgHertz], al 1068 1069 sys _msg, msgSampleRate, 255, 0Fh 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 000007E5 BB[A4230000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 000007EA B9FF000000 <1> mov ecx, %3 81 <1> %if %0 = 4 82 000007EF BA0F000000 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 000007F4 B823000000 <1> mov eax, %1 87 <1> 88 000007F9 CD40 <1> int 40h 1070 1071 000007FB BE[CE230000] mov esi, msg16Bits 1072 00000800 803D[D1240000]10 cmp byte [bps], 16 1073 00000807 7405 je short wsr_1 1074 00000809 BE[BE230000] mov esi, msg8Bits 1075 wsr_1: 1076 sys _msg, esi, 255, 0Fh 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 0000080E 89F3 <1> mov ebx, %2 79 <1> %if %0 >= 3 80 00000810 B9FF000000 <1> mov ecx, %3 81 <1> %if %0 = 4 82 00000815 BA0F000000 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 0000081A B823000000 <1> mov eax, %1 87 <1> 88 0000081F CD40 <1> int 40h 1077 1078 00000821 BE[C7230000] mov esi, msgMono 1079 00000826 803D[D0240000]01 cmp byte [stmo], 1 1080 0000082D 7405 je short wsr_2 1081 0000082F BE[D8230000] mov esi, msgStereo 1082 wsr_2: 1083 sys _msg, esi, 255, 0Fh 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00000834 89F3 <1> mov ebx, %2 79 <1> %if %0 >= 3 80 00000836 B9FF000000 <1> mov ecx, %3 81 <1> %if %0 = 4 82 0000083B BA0F000000 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00000840 B823000000 <1> mov eax, %1 87 <1> 88 00000845 CD40 <1> int 40h 1084 00000847 C3 retn 1085 1086 write_ac97_pci_dev_info: 1087 ; 06/06/2017 1088 ; 03/06/2017 1089 ; BUS/DEV/FN 1090 ; 00000000BBBBBBBBDDDDDFFF00000000 1091 ; DEV/VENDOR 1092 ; DDDDDDDDDDDDDDDDVVVVVVVVVVVVVVVV 1093 1094 00000848 8B35[4D250000] mov esi, [dev_vendor] 1095 0000084E 89F0 mov eax, esi 1096 00000850 0FB6D8 movzx ebx, al 1097 00000853 88DA mov dl, bl 1098 00000855 80E30F and bl, 0Fh 1099 00000858 8A83[E1230000] mov al, [ebx+hex_chars] 1100 0000085E A2[26240000] mov [msgVendorId+3], al 1101 00000863 88D3 mov bl, dl 1102 00000865 C0EB04 shr bl, 4 1103 00000868 8A83[E1230000] mov al, [ebx+hex_chars] 1104 0000086E A2[25240000] mov [msgVendorId+2], al 1105 00000873 88E3 mov bl, ah 1106 00000875 88DA mov dl, bl 1107 00000877 80E30F and bl, 0Fh 1108 0000087A 8A83[E1230000] mov al, [ebx+hex_chars] 1109 00000880 A2[24240000] mov [msgVendorId+1], al 1110 00000885 88D3 mov bl, dl 1111 00000887 C0EB04 shr bl, 4 1112 0000088A 8A83[E1230000] mov al, [ebx+hex_chars] 1113 00000890 A2[23240000] mov [msgVendorId], al 1114 00000895 C1E810 shr eax, 16 1115 00000898 88C3 mov bl, al 1116 0000089A 88DA mov dl, bl 1117 0000089C 80E30F and bl, 0Fh 1118 0000089F 8A83[E1230000] mov al, [ebx+hex_chars] 1119 000008A5 A2[37240000] mov [msgDevId+3], al 1120 000008AA 88D3 mov bl, dl 1121 000008AC C0EB04 shr bl, 4 1122 000008AF 8A83[E1230000] mov al, [ebx+hex_chars] 1123 000008B5 A2[36240000] mov [msgDevId+2], al 1124 000008BA 88E3 mov bl, ah 1125 000008BC 88DA mov dl, bl 1126 000008BE 80E30F and bl, 0Fh 1127 000008C1 8A83[E1230000] mov al, [ebx+hex_chars] 1128 000008C7 A2[35240000] mov [msgDevId+1], al 1129 000008CC 88D3 mov bl, dl 1130 000008CE C0EB04 shr bl, 4 1131 000008D1 8A83[E1230000] mov al, [ebx+hex_chars] 1132 000008D7 A2[34240000] mov [msgDevId], al 1133 1134 000008DC 8B35[51250000] mov esi, [bus_dev_fn] 1135 000008E2 C1EE08 shr esi, 8 1136 000008E5 6689F0 mov ax, si 1137 000008E8 88C3 mov bl, al 1138 000008EA 88DA mov dl, bl 1139 000008EC 80E307 and bl, 7 ; bit 0,1,2 1140 000008EF 8A83[E1230000] mov al, [ebx+hex_chars] 1141 000008F5 A2[5B240000] mov [msgFncNo+1], al 1142 000008FA 88D3 mov bl, dl 1143 000008FC C0EB03 shr bl, 3 1144 000008FF 88DA mov dl, bl 1145 00000901 80E30F and bl, 0Fh 1146 00000904 8A83[E1230000] mov al, [ebx+hex_chars] 1147 0000090A A2[4D240000] mov [msgDevNo+1], al 1148 0000090F 88D3 mov bl, dl 1149 00000911 C0EB04 shr bl, 4 1150 00000914 8A83[E1230000] mov al, [ebx+hex_chars] 1151 0000091A A2[4C240000] mov [msgDevNo], al 1152 0000091F 88E3 mov bl, ah 1153 00000921 88DA mov dl, bl 1154 00000923 80E30F and bl, 0Fh 1155 00000926 8A83[E1230000] mov al, [ebx+hex_chars] 1156 0000092C A2[41240000] mov [msgBusNo+1], al 1157 00000931 88D3 mov bl, dl 1158 00000933 C0EB04 shr bl, 4 1159 00000936 8A83[E1230000] mov al, [ebx+hex_chars] 1160 0000093C A2[40240000] mov [msgBusNo], al 1161 1162 00000941 66A1[55250000] mov ax, [ac97_NamBar] 1163 00000947 88C3 mov bl, al 1164 00000949 88DA mov dl, bl 1165 0000094B 80E30F and bl, 0Fh 1166 0000094E 8A83[E1230000] mov al, [ebx+hex_chars] 1167 00000954 A2[6A240000] mov [msgNamBar+3], al 1168 00000959 88D3 mov bl, dl 1169 0000095B C0EB04 shr bl, 4 1170 0000095E 8A83[E1230000] mov al, [ebx+hex_chars] 1171 00000964 A2[69240000] mov [msgNamBar+2], al 1172 00000969 88E3 mov bl, ah 1173 0000096B 88DA mov dl, bl 1174 0000096D 80E30F and bl, 0Fh 1175 00000970 8A83[E1230000] mov al, [ebx+hex_chars] 1176 00000976 A2[68240000] mov [msgNamBar+1], al 1177 0000097B 88D3 mov bl, dl 1178 0000097D C0EB04 shr bl, 4 1179 00000980 8A83[E1230000] mov al, [ebx+hex_chars] 1180 00000986 A2[67240000] mov [msgNamBar], al 1181 1182 0000098B 66A1[57250000] mov ax, [ac97_NabmBar] 1183 00000991 88C3 mov bl, al 1184 00000993 88DA mov dl, bl 1185 00000995 80E30F and bl, 0Fh 1186 00000998 8A83[E1230000] mov al, [ebx+hex_chars] 1187 0000099E A2[7A240000] mov [msgNabmBar+3], al 1188 000009A3 88D3 mov bl, dl 1189 000009A5 C0EB04 shr bl, 4 1190 000009A8 8A83[E1230000] mov al, [ebx+hex_chars] 1191 000009AE A2[79240000] mov [msgNabmBar+2], al 1192 000009B3 88E3 mov bl, ah 1193 000009B5 88DA mov dl, bl 1194 000009B7 80E30F and bl, 0Fh 1195 000009BA 8A83[E1230000] mov al, [ebx+hex_chars] 1196 000009C0 A2[78240000] mov [msgNabmBar+1], al 1197 000009C5 88D3 mov bl, dl 1198 000009C7 C0EB04 shr bl, 4 1199 000009CA 8A83[E1230000] mov al, [ebx+hex_chars] 1200 000009D0 A2[77240000] mov [msgNabmBar], al 1201 1202 000009D5 30E4 xor ah, ah 1203 000009D7 A0[4B250000] mov al, [ac97_int_ln_reg] 1204 000009DC B10A mov cl, 10 1205 000009DE F6F1 div cl 1206 000009E0 660105[83240000] add [msgIRQ], ax 1207 000009E7 20C0 and al, al 1208 000009E9 750D jnz short _w_ac97imsg_ 1209 000009EB A0[84240000] mov al, [msgIRQ+1] 1210 000009F0 B420 mov ah, ' ' 1211 000009F2 66A3[83240000] mov [msgIRQ], ax 1212 _w_ac97imsg_: 1213 sys _msg, msgAC97Info, 255, 07h 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 000009F8 BB[F2230000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 000009FD B9FF000000 <1> mov ecx, %3 81 <1> %if %0 = 4 82 00000A02 BA07000000 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00000A07 B823000000 <1> mov eax, %1 87 <1> 88 00000A0C CD40 <1> int 40h 1214 1215 00000A0E C3 retn 1216 1217 write_VRA_info: 1218 ; 25/11/2023 1219 sys _msg, msgVRAheader, 255, 07h 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00000A0F BB[88240000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 00000A14 B9FF000000 <1> mov ecx, %3 81 <1> %if %0 = 4 82 00000A19 BA07000000 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00000A1E B823000000 <1> mov eax, %1 87 <1> 88 00000A23 CD40 <1> int 40h 1220 00000A25 803D[DC240000]00 cmp byte [VRA], 0 1221 00000A2C 7617 jna short _w_VRAi_no 1222 _w_VRAi_yes: 1223 sys _msg, msgVRAyes, 255, 07h 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00000A2E BB[96240000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 00000A33 B9FF000000 <1> mov ecx, %3 81 <1> %if %0 = 4 82 00000A38 BA07000000 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00000A3D B823000000 <1> mov eax, %1 87 <1> 88 00000A42 CD40 <1> int 40h 1224 00000A44 C3 retn 1225 _w_VRAi_no: 1226 sys _msg, msgVRAno, 255, 07h 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00000A45 BB[9C240000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 00000A4A B9FF000000 <1> mov ecx, %3 81 <1> %if %0 = 4 82 00000A4F BA07000000 <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00000A54 B823000000 <1> mov eax, %1 87 <1> 88 00000A59 CD40 <1> int 40h 1227 00000A5B C3 retn 1228 1229 ; 02/02/2025 1230 ; 1231 ; 26/11/2023 1232 ; 25/11/2023 - playwav6.s (32 bit registers, TRDOS 386 adaption) 1233 ; 15/11/2023 - PLAYWAV5.COM, ich_wav5.asm 1234 ; 14/11/2023 1235 ; 13/11/2023 - Erdogan Tan - (VRA, sample rate conversion) 1236 ; -------------------------------------------------------- 1237 1238 ;;Note: At the end of every buffer load, 1239 ;; during buffer switch/swap, there will be discontinuity 1240 ;; between the last converted sample and the 1st sample 1241 ;; of the next buffer. 1242 ;; (like as a dot noises vaguely between normal sound samples) 1243 ;; -To avoid this defect, the 1st sample of 1244 ;; the next buffer may be read from the wav file but 1245 ;; the file pointer would need to be set to 1 sample back 1246 ;; again via seek system call. Time comsumption problem! - 1247 ;; 1248 ;; Erdogan Tan - 15/11/2023 1249 ;; 1250 ;; ((If entire wav data would be loaded at once.. conversion 1251 ;; defect/noise would disappear.. but for DOS, to keep 1252 ;; 64KB buffer limit is important also it is important 1253 ;; for running under 1MB barrier without HIMEM.SYS or DPMI. 1254 ;; I have tested this program by using 2-30MB wav files.)) 1255 ;; 1256 ;; Test Computer: ASUS desktop/mainboard, M2N4-SLI, 2010. 1257 ;; AMD Athlon 64 X2 2200 MHZ CPU. 1258 ;; NFORCE4 (CK804) AC97 audio hardware. 1259 ;; Realtek ALC850 codec. 1260 ;; Retro DOS v4.2 (MSDOS 6.22) operating system. 1261 1262 load_8khz_mono_8_bit: 1263 ; 02/02/2025 1264 ; 15/11/2023 1265 ; 14/11/2023 1266 ; 13/11/2023 1267 00000A5C F605[D8240000]01 test byte [flags], ENDOFFILE ; have we already read the 1268 ; last of the file? 1269 00000A63 7402 jz short lff8m_0 ; no 1270 00000A65 F9 stc 1271 00000A66 C3 retn 1272 1273 lff8m_0: 1274 00000A67 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 1275 ;mov edx, [loadsize] 1276 1277 ; esi = buffer address 1278 ;; edx = buffer size 1279 1280 ; load file into memory 1281 sys _read, [FileHandle], esi, [loadsize] 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00000A6C 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 00000A72 89F1 <1> mov ecx, %3 81 <1> %if %0 = 4 82 00000A74 8B15[15040000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00000A7A B803000000 <1> mov eax, %1 87 <1> 88 00000A7F CD40 <1> int 40h 1282 00000A81 7305 jnc short lff8m_6 1283 00000A83 E9AF000000 jmp lff8m_5 ; error ! 1284 1285 lff8m_6: 1286 00000A88 BF[00300000] mov edi, audio_buffer 1287 00000A8D 21C0 and eax, eax 1288 00000A8F 0F8499000000 jz lff8_eof 1289 1290 00000A95 89C1 mov ecx, eax ; byte count 1291 lff8m_1: 1292 00000A97 AC lodsb 1293 00000A98 A2[D5210000] mov [previous_val], al 1294 00000A9D 2C80 sub al, 80h 1295 00000A9F 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 1296 00000AA3 66AB stosw ; original sample (left channel) 1297 00000AA5 66AB stosw ; original sample (right channel) 1298 ; 02/02/2025 1299 ;xor eax, eax 1300 00000AA7 8A06 mov al, [esi] 1301 00000AA9 49 dec ecx 1302 00000AAA 7502 jnz short lff8m_2 1303 00000AAC B080 mov al, 80h 1304 lff8m_2: 1305 ;mov [next_val], ax 1306 00000AAE 88C7 mov bh, al ; [next_val] 1307 00000AB0 8A25[D5210000] mov ah, [previous_val] 1308 00000AB6 00E0 add al, ah ; [previous_val] 1309 00000AB8 D0D8 rcr al, 1 1310 00000ABA 88C2 mov dl, al ; this is interpolated middle (3th) sample 1311 00000ABC 00E0 add al, ah ; [previous_val] 1312 00000ABE D0D8 rcr al, 1 1313 00000AC0 88C3 mov bl, al ; this is temporary interpolation value 1314 00000AC2 00E0 add al, ah ; [previous_val] 1315 00000AC4 D0D8 rcr al, 1 1316 00000AC6 2C80 sub al, 80h 1317 00000AC8 66C1E008 shl ax, 8 1318 00000ACC 66AB stosw ; this is 1st interpolated sample (L) 1319 00000ACE 66AB stosw ; this is 1st interpolated sample (R) 1320 00000AD0 88D8 mov al, bl 1321 00000AD2 00D0 add al, dl 1322 00000AD4 D0D8 rcr al, 1 1323 00000AD6 2C80 sub al, 80h 1324 00000AD8 66C1E008 shl ax, 8 1325 00000ADC 66AB stosw ; this is 2nd interpolated sample (L) 1326 00000ADE 66AB stosw ; this is 2nd interpolated sample (R) 1327 00000AE0 88D0 mov al, dl 1328 00000AE2 2C80 sub al, 80h 1329 00000AE4 66C1E008 shl ax, 8 1330 00000AE8 66AB stosw ; this is middle (3th) interpolated sample (L) 1331 00000AEA 66AB stosw ; this is middle (3th) interpolated sample (R) 1332 ;mov al, [next_val] 1333 00000AEC 88F8 mov al, bh 1334 00000AEE 00D0 add al, dl 1335 00000AF0 D0D8 rcr al, 1 1336 00000AF2 88C3 mov bl, al ; this is temporary interpolation value 1337 00000AF4 00D0 add al, dl 1338 00000AF6 D0D8 rcr al, 1 1339 00000AF8 2C80 sub al, 80h 1340 00000AFA 66C1E008 shl ax, 8 1341 00000AFE 66AB stosw ; this is 4th interpolated sample (L) 1342 00000B00 66AB stosw ; this is 4th interpolated sample (R) 1343 ;mov al, [next_val] 1344 00000B02 88F8 mov al, bh 1345 00000B04 00D8 add al, bl 1346 00000B06 D0D8 rcr al, 1 1347 00000B08 2C80 sub al, 80h 1348 00000B0A 66C1E008 shl ax, 8 1349 00000B0E 66AB stosw ; this is 5th interpolated sample (L) 1350 00000B10 66AB stosw ; this is 5th interpolated sample (R) 1351 ; 8 kHZ mono to 48 kHZ stereo conversion of the sample is OK 1352 00000B12 09C9 or ecx, ecx 1353 00000B14 7581 jnz short lff8m_1 1354 1355 ; -------------- 1356 1357 lff8s_3: 1358 lff8m_3: 1359 lff8s2_3: 1360 lff8m2_3: 1361 lff16s_3: 1362 lff16m_3: 1363 lff16s2_3: 1364 lff16m2_3: 1365 lff24_3: 1366 lff32_3: 1367 lff44_3: 1368 lff22_3: 1369 lff11_3: 1370 lff12_3: ; 02/02/2025 1371 ; 08/12/2024 (BugFix) 1372 ; 01/06/2024 (BugFix) 1373 00000B16 8B0D[19040000] mov ecx, [buffersize] ; 16 bit (48 kHZ, stereo) sample size 1374 ;shl ecx, 1 ; byte count ; Bug ! 1375 ; 08/12/2024 1376 00000B1C 81C1[00300000] add ecx, audio_buffer 1377 00000B22 29F9 sub ecx, edi 1378 00000B24 7607 jna short lff8m_4 1379 ;inc ecx 1380 00000B26 C1E902 shr ecx, 2 1381 00000B29 31C0 xor eax, eax ; fill (remain part of) buffer with zeros 1382 00000B2B F3AB rep stosd 1383 lff8m_4: 1384 ; 01/06/2024 (BugFix) 1385 ; cf=1 ; Bug ! 1386 ; 08/12/2024 1387 ;clc 1388 00000B2D C3 retn 1389 1390 lff8_eof: 1391 lff16_eof: 1392 lff24_eof: 1393 lff32_eof: 1394 lff44_eof: 1395 lff22_eof: 1396 lff11_eof: 1397 lff12_eof: ; 02/02/2025 1398 ; 15/11/2023 1399 00000B2E C605[D8240000]01 mov byte [flags], ENDOFFILE 1400 00000B35 EBDF jmp short lff8m_3 1401 1402 lff8s_5: 1403 lff8m_5: 1404 lff8s2_5: 1405 lff8m2_5: 1406 lff16s_5: 1407 lff16m_5: 1408 lff16s2_5: 1409 lff16m2_5: 1410 lff24_5: 1411 lff32_5: 1412 lff44_5: 1413 lff22_5: 1414 lff11_5: 1415 lff12_5: ; 02/02/2025 1416 00000B37 B021 mov al, '!' ; error 1417 00000B39 E8E4FBFFFF call tL0 1418 1419 ;jmp short lff8m_3 1420 ; 15/11/2023 1421 00000B3E EBEE jmp lff8_eof 1422 1423 ; -------------- 1424 1425 load_8khz_stereo_8_bit: 1426 ; 02/02/2025 1427 ; 15/11/2023 1428 ; 14/11/2023 1429 ; 13/11/2023 1430 00000B40 F605[D8240000]01 test byte [flags], ENDOFFILE ; have we already read the 1431 ; last of the file? 1432 00000B47 7402 jz short lff8s_0 ; no 1433 00000B49 F9 stc 1434 00000B4A C3 retn 1435 1436 lff8s_0: 1437 00000B4B BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 1438 ;mov edx, [loadsize] 1439 1440 ; esi = buffer address 1441 ;; edx = buffer size 1442 1443 ; load file into memory 1444 sys _read, [FileHandle], esi, [loadsize] 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00000B50 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 00000B56 89F1 <1> mov ecx, %3 81 <1> %if %0 = 4 82 00000B58 8B15[15040000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00000B5E B803000000 <1> mov eax, %1 87 <1> 88 00000B63 CD40 <1> int 40h 1445 00000B65 72D0 jc short lff8s_5 ; error ! 1446 1447 00000B67 BF[00300000] mov edi, audio_buffer 1448 1449 00000B6C D1E8 shr eax, 1 1450 00000B6E 74BE jz short lff8_eof 1451 1452 00000B70 89C1 mov ecx, eax ; word count 1453 lff8s_1: 1454 00000B72 AC lodsb 1455 00000B73 A2[D5210000] mov [previous_val_l], al 1456 00000B78 2C80 sub al, 80h 1457 00000B7A 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 1458 00000B7E 66AB stosw ; original sample (L) 1459 00000B80 AC lodsb 1460 00000B81 A2[D7210000] mov [previous_val_r], al 1461 00000B86 2C80 sub al, 80h 1462 00000B88 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 1463 00000B8C 66AB stosw ; original sample (R) 1464 1465 ;xor eax, eax 1466 ; 02/02/2025 1467 00000B8E 668B06 mov ax, [esi] 1468 00000B91 49 dec ecx 1469 00000B92 7504 jnz short lff8s_2 1470 ; convert 8 bit sample to 16 bit sample 1471 00000B94 66B88080 mov ax, 8080h 1472 lff8s_2: 1473 00000B98 A2[D9210000] mov [next_val_l], al 1474 00000B9D 8825[DB210000] mov [next_val_r], ah 1475 00000BA3 8A25[D5210000] mov ah, [previous_val_l] 1476 00000BA9 00E0 add al, ah 1477 00000BAB D0D8 rcr al, 1 1478 00000BAD 88C2 mov dl, al ; this is interpolated middle (3th) sample (L) 1479 00000BAF 00E0 add al, ah 1480 00000BB1 D0D8 rcr al, 1 1481 00000BB3 88C3 mov bl, al ; this is temporary interpolation value (L) 1482 00000BB5 00E0 add al, ah 1483 00000BB7 D0D8 rcr al, 1 1484 00000BB9 2C80 sub al, 80h 1485 00000BBB 66C1E008 shl ax, 8 1486 00000BBF 66AB stosw ; this is 1st interpolated sample (L) 1487 00000BC1 A0[DB210000] mov al, [next_val_r] 1488 00000BC6 8A25[D7210000] mov ah, [previous_val_r] 1489 00000BCC 00E0 add al, ah 1490 00000BCE D0D8 rcr al, 1 1491 00000BD0 88C6 mov dh, al ; this is interpolated middle (3th) sample (R) 1492 00000BD2 00E0 add al, ah 1493 00000BD4 D0D8 rcr al, 1 1494 00000BD6 88C7 mov bh, al ; this is temporary interpolation value (R) 1495 00000BD8 00E0 add al, ah 1496 00000BDA D0D8 rcr al, 1 1497 00000BDC 2C80 sub al, 80h 1498 00000BDE 66C1E008 shl ax, 8 1499 00000BE2 66AB stosw ; this is 1st interpolated sample (R) 1500 00000BE4 88D8 mov al, bl 1501 00000BE6 00D0 add al, dl 1502 00000BE8 D0D8 rcr al, 1 1503 00000BEA 2C80 sub al, 80h 1504 00000BEC 66C1E008 shl ax, 8 1505 00000BF0 66AB stosw ; this is 2nd interpolated sample (L) 1506 00000BF2 88F8 mov al, bh 1507 00000BF4 00F0 add al, dh 1508 00000BF6 D0D8 rcr al, 1 1509 00000BF8 2C80 sub al, 80h 1510 00000BFA 66C1E008 shl ax, 8 1511 00000BFE 66AB stosw ; this is 2nd interpolated sample (R) 1512 00000C00 88D0 mov al, dl 1513 00000C02 2C80 sub al, 80h 1514 00000C04 66C1E008 shl ax, 8 1515 00000C08 66AB stosw ; this is middle (3th) interpolated sample (L) 1516 00000C0A 88F0 mov al, dh 1517 00000C0C 2C80 sub al, 80h 1518 00000C0E 66C1E008 shl ax, 8 1519 00000C12 66AB stosw ; this is middle (3th) interpolated sample (R) 1520 00000C14 A0[D9210000] mov al, [next_val_l] 1521 00000C19 00D0 add al, dl 1522 00000C1B D0D8 rcr al, 1 1523 00000C1D 88C3 mov bl, al ; this is temporary interpolation value (L) 1524 00000C1F 00D0 add al, dl 1525 00000C21 D0D8 rcr al, 1 1526 00000C23 2C80 sub al, 80h 1527 00000C25 66C1E008 shl ax, 8 1528 00000C29 66AB stosw ; this is 4th interpolated sample (L) 1529 00000C2B A0[DB210000] mov al, [next_val_r] 1530 00000C30 00F0 add al, dh 1531 00000C32 D0D8 rcr al, 1 1532 00000C34 88C7 mov bh, al ; this is temporary interpolation value (R) 1533 00000C36 00F0 add al, dh 1534 00000C38 D0D8 rcr al, 1 1535 00000C3A 2C80 sub al, 80h 1536 00000C3C 66C1E008 shl ax, 8 1537 00000C40 66AB stosw ; this is 4th interpolated sample (R) 1538 00000C42 A0[D9210000] mov al, [next_val_l] 1539 00000C47 00D8 add al, bl 1540 00000C49 D0D8 rcr al, 1 1541 00000C4B 2C80 sub al, 80h 1542 00000C4D 66C1E008 shl ax, 8 1543 00000C51 66AB stosw ; this is 5th interpolated sample (L) 1544 00000C53 A0[DB210000] mov al, [next_val_r] 1545 00000C58 00F8 add al, bh 1546 00000C5A D0D8 rcr al, 1 1547 00000C5C 2C80 sub al, 80h 1548 00000C5E 66C1E008 shl ax, 8 1549 00000C62 66AB stosw ; this is 5th interpolated sample (R) 1550 ; 8 kHZ stereo to 48 kHZ stereo conversion of the sample is OK 1551 00000C64 E305 jecxz lff8s_6 1552 00000C66 E907FFFFFF jmp lff8s_1 1553 lff8s_6: 1554 00000C6B E9A6FEFFFF jmp lff8s_3 1555 1556 load_8khz_mono_16_bit: 1557 ; 02/02/2025 1558 ; 13/11/2023 1559 00000C70 F605[D8240000]01 test byte [flags], ENDOFFILE ; have we already read the 1560 ; last of the file? 1561 00000C77 7402 jz short lff8m2_0 ; no 1562 00000C79 F9 stc 1563 00000C7A C3 retn 1564 1565 lff8m2_0: 1566 00000C7B BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 1567 ;mov edx, [loadsize] 1568 1569 ; esi = buffer address 1570 ;; edx = buffer size 1571 1572 ; load file into memory 1573 sys _read, [FileHandle], esi, [loadsize] 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00000C80 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 00000C86 89F1 <1> mov ecx, %3 81 <1> %if %0 = 4 82 00000C88 8B15[15040000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00000C8E B803000000 <1> mov eax, %1 87 <1> 88 00000C93 CD40 <1> int 40h 1574 00000C95 0F82A0000000 jc lff8m2_7 ; error ! 1575 1576 00000C9B BF[00300000] mov edi, audio_buffer 1577 1578 00000CA0 D1E8 shr eax, 1 1579 00000CA2 7505 jnz short lff8m2_8 1580 00000CA4 E985FEFFFF jmp lff8_eof 1581 1582 lff8m2_8: 1583 00000CA9 89C1 mov ecx, eax ; word count 1584 lff8m2_1: 1585 00000CAB 66AD lodsw 1586 00000CAD 66AB stosw ; original sample (left channel) 1587 00000CAF 66AB stosw ; original sample (right channel) 1588 00000CB1 80C480 add ah, 80h ; convert sound level to 0-65535 format 1589 00000CB4 66A3[D5210000] mov [previous_val], ax 1590 ; 02/02/2025 1591 00000CBA 668B06 mov ax, [esi] 1592 00000CBD 49 dec ecx 1593 00000CBE 7502 jnz short lff8m2_2 1594 00000CC0 31C0 xor eax, eax 1595 lff8m2_2: 1596 00000CC2 80C480 add ah, 80h ; convert sound level to 0-65535 format 1597 00000CC5 89C5 mov ebp, eax ; [next_val] 1598 00000CC7 660305[D5210000] add ax, [previous_val] 1599 00000CCE 66D1D8 rcr ax, 1 1600 00000CD1 89C2 mov edx, eax ; this is interpolated middle (3th) sample 1601 00000CD3 660305[D5210000] add ax, [previous_val] 1602 00000CDA 66D1D8 rcr ax, 1 ; this is temporary interpolation value 1603 00000CDD 89C3 mov ebx, eax 1604 00000CDF 660305[D5210000] add ax, [previous_val] 1605 00000CE6 66D1D8 rcr ax, 1 1606 00000CE9 80EC80 sub ah, 80h ; -32768 to +32767 format again 1607 00000CEC 66AB stosw ; this is 1st interpolated sample (L) 1608 00000CEE 66AB stosw ; this is 1st interpolated sample (R) 1609 00000CF0 89D8 mov eax, ebx 1610 00000CF2 6601D0 add ax, dx 1611 00000CF5 66D1D8 rcr ax, 1 1612 00000CF8 80EC80 sub ah, 80h 1613 00000CFB 66AB stosw ; this is 2nd interpolated sample (L) 1614 00000CFD 66AB stosw ; this is 2nd interpolated sample (R) 1615 00000CFF 89D0 mov eax, edx 1616 00000D01 80EC80 sub ah, 80h ; -32768 to +32767 format again 1617 00000D04 66AB stosw ; this is middle (3th) interpolated sample (L) 1618 00000D06 66AB stosw ; this is middle (3th) interpolated sample (R) 1619 00000D08 89E8 mov eax, ebp 1620 00000D0A 6601D0 add ax, dx 1621 00000D0D 66D1D8 rcr ax, 1 1622 00000D10 89C3 mov ebx, eax ; this is temporary interpolation value 1623 00000D12 6601D0 add ax, dx 1624 00000D15 66D1D8 rcr ax, 1 1625 00000D18 80EC80 sub ah, 80h 1626 00000D1B 66AB stosw ; this is 4th interpolated sample (L) 1627 00000D1D 66AB stosw ; this is 4th interpolated sample (R) 1628 00000D1F 89E8 mov eax, ebp 1629 00000D21 6601D8 add ax, bx 1630 00000D24 66D1D8 rcr ax, 1 1631 00000D27 80EC80 sub ah, 80h ; -32768 to +32767 format again 1632 00000D2A 66AB stosw ; this is 5th interpolated sample (L) 1633 00000D2C 66AB stosw ; this is 5th interpolated sample (R) 1634 ; 8 kHZ mono to 48 kHZ stereo conversion of the sample is OK 1635 00000D2E 09C9 or ecx, ecx 1636 00000D30 0F8575FFFFFF jnz lff8m2_1 1637 00000D36 E9DBFDFFFF jmp lff8m2_3 1638 1639 lff8m2_7: 1640 lff8s2_7: 1641 00000D3B E9F7FDFFFF jmp lff8m2_5 ; error 1642 1643 load_8khz_stereo_16_bit: 1644 ; 02/02/2025 1645 ; 16/11/2023 1646 ; 15/11/2023 1647 ; 13/11/2023 1648 00000D40 F605[D8240000]01 test byte [flags], ENDOFFILE ; have we already read the 1649 ; last of the file? 1650 00000D47 7402 jz short lff8s2_0 ; no 1651 00000D49 F9 stc 1652 00000D4A C3 retn 1653 1654 lff8s2_0: 1655 00000D4B BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 1656 ;mov edx, [loadsize] 1657 1658 ; esi = buffer address 1659 ;; edx = buffer size 1660 1661 ; load file into memory 1662 sys _read, [FileHandle], esi, [loadsize] 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00000D50 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 00000D56 89F1 <1> mov ecx, %3 81 <1> %if %0 = 4 82 00000D58 8B15[15040000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00000D5E B803000000 <1> mov eax, %1 87 <1> 88 00000D63 CD40 <1> int 40h 1663 00000D65 72D4 jc short lff8s2_7 ; error ! 1664 1665 00000D67 BF[00300000] mov edi, audio_buffer 1666 1667 00000D6C C1E802 shr eax, 2 1668 00000D6F 7505 jnz short lff8s2_8 1669 00000D71 E9B8FDFFFF jmp lff8_eof 1670 1671 lff8s2_8: 1672 00000D76 89C1 mov ecx, eax ; dword count 1673 lff8s2_1: 1674 00000D78 66AD lodsw 1675 00000D7A 66AB stosw ; original sample (L) 1676 ; 15/11/2023 1677 00000D7C 80C480 add ah, 80h ; convert sound level to 0-65535 format 1678 00000D7F 66A3[D5210000] mov [previous_val_l], ax 1679 00000D85 66AD lodsw 1680 00000D87 66AB stosw ; original sample (R) 1681 00000D89 80C480 add ah, 80h ; convert sound level to 0-65535 format 1682 00000D8C 66A3[D7210000] mov [previous_val_r], ax 1683 ; 02/02/2025 1684 00000D92 668B06 mov ax, [esi] 1685 00000D95 668B5602 mov dx, [esi+2] 1686 ; 16/11/2023 1687 00000D99 49 dec ecx 1688 00000D9A 7504 jnz short lff8s2_2 1689 00000D9C 31D2 xor edx, edx 1690 00000D9E 31C0 xor eax, eax 1691 lff8s2_2: 1692 00000DA0 80C480 add ah, 80h ; convert sound level to 0-65535 format 1693 00000DA3 66A3[D9210000] mov [next_val_l], ax 1694 00000DA9 80C680 add dh, 80h ; convert sound level to 0-65535 format 1695 00000DAC 668915[DB210000] mov [next_val_r], dx 1696 00000DB3 660305[D5210000] add ax, [previous_val_l] 1697 00000DBA 66D1D8 rcr ax, 1 1698 00000DBD 89C2 mov edx, eax ; this is interpolated middle (3th) sample (L) 1699 00000DBF 660305[D5210000] add ax, [previous_val_l] 1700 00000DC6 66D1D8 rcr ax, 1 1701 00000DC9 89C3 mov ebx, eax ; this is temporary interpolation value (L) 1702 00000DCB 660305[D5210000] add ax, [previous_val_l] 1703 00000DD2 66D1D8 rcr ax, 1 1704 00000DD5 80EC80 sub ah, 80h ; -32768 to +32767 format again 1705 00000DD8 66AB stosw ; this is 1st interpolated sample (L) 1706 00000DDA 66A1[DB210000] mov ax, [next_val_r] 1707 00000DE0 660305[D7210000] add ax, [previous_val_r] 1708 00000DE7 66D1D8 rcr ax, 1 1709 00000DEA 89C5 mov ebp, eax ; this is interpolated middle (3th) sample (R) 1710 00000DEC 660305[D7210000] add ax, [previous_val_r] 1711 00000DF3 66D1D8 rcr ax, 1 1712 00000DF6 50 push eax ; * ; this is temporary interpolation value (R) 1713 00000DF7 660305[D7210000] add ax, [previous_val_r] 1714 00000DFE 66D1D8 rcr ax, 1 1715 00000E01 80EC80 sub ah, 80h 1716 00000E04 66AB stosw ; this is 1st interpolated sample (R) 1717 00000E06 89D8 mov eax, ebx 1718 00000E08 6601D0 add ax, dx 1719 00000E0B 66D1D8 rcr ax, 1 1720 00000E0E 80EC80 sub ah, 80h ; -32768 to +32767 format again 1721 00000E11 66AB stosw ; this is 2nd interpolated sample (L) 1722 00000E13 58 pop eax ; * 1723 00000E14 6601E8 add ax, bp 1724 00000E17 66D1D8 rcr ax, 1 1725 00000E1A 80EC80 sub ah, 80h 1726 00000E1D 66AB stosw ; this is 2nd interpolated sample (R) 1727 00000E1F 89D0 mov eax, edx 1728 00000E21 80EC80 sub ah, 80h 1729 00000E24 66AB stosw ; this is middle (3th) interpolated sample (L) 1730 00000E26 89E8 mov eax, ebp 1731 00000E28 80EC80 sub ah, 80h ; -32768 to +32767 format again 1732 00000E2B 66AB stosw ; this is middle (3th) interpolated sample (R) 1733 00000E2D 66A1[D9210000] mov ax, [next_val_l] 1734 00000E33 6601D0 add ax, dx 1735 00000E36 66D1D8 rcr ax, 1 1736 00000E39 89C3 mov ebx, eax ; this is temporary interpolation value (L) 1737 00000E3B 6601D0 add ax, dx 1738 00000E3E 66D1D8 rcr ax, 1 1739 00000E41 80EC80 sub ah, 80h 1740 00000E44 66AB stosw ; this is 4th interpolated sample (L) 1741 00000E46 66A1[DB210000] mov ax, [next_val_r] 1742 00000E4C 6601E8 add ax, bp 1743 00000E4F 66D1D8 rcr ax, 1 1744 00000E52 50 push eax ; ** ; this is temporary interpolation value (R) 1745 00000E53 6601E8 add ax, bp 1746 00000E56 66D1D8 rcr ax, 1 1747 00000E59 80EC80 sub ah, 80h 1748 00000E5C 66AB stosw ; this is 4th interpolated sample (R) 1749 00000E5E 66A1[D9210000] mov ax, [next_val_l] 1750 00000E64 6601D8 add ax, bx 1751 00000E67 66D1D8 rcr ax, 1 1752 00000E6A 80EC80 sub ah, 80h ; -32768 to +32767 format again 1753 00000E6D 66AB stosw ; this is 5th interpolated sample (L) 1754 00000E6F 58 pop eax ; ** 1755 00000E70 660305[DB210000] add ax, [next_val_r] 1756 00000E77 66D1D8 rcr ax, 1 1757 00000E7A 80EC80 sub ah, 80h 1758 00000E7D 66AB stosw ; this is 5th interpolated sample (R) 1759 ; 8 kHZ stereo to 48 kHZ stereo conversion of the sample is OK 1760 00000E7F E305 jecxz lff8_s2_9 1761 00000E81 E9F2FEFFFF jmp lff8s2_1 1762 lff8_s2_9: 1763 00000E86 E98BFCFFFF jmp lff8s2_3 1764 1765 ; ..................... 1766 1767 load_16khz_mono_8_bit: 1768 ; 02/02/2025 1769 ; 14/11/2023 1770 ; 13/11/2023 1771 00000E8B F605[D8240000]01 test byte [flags], ENDOFFILE ; have we already read the 1772 ; last of the file? 1773 00000E92 7402 jz short lff16m_0 ; no 1774 00000E94 F9 stc 1775 00000E95 C3 retn 1776 1777 lff16m_0: 1778 00000E96 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 1779 ;mov edx, [loadsize] 1780 1781 ; esi = buffer address 1782 ;; edx = buffer size 1783 1784 ; load file into memory 1785 sys _read, [FileHandle], esi, [loadsize] 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00000E9B 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 00000EA1 89F1 <1> mov ecx, %3 81 <1> %if %0 = 4 82 00000EA3 8B15[15040000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00000EA9 B803000000 <1> mov eax, %1 87 <1> 88 00000EAE CD40 <1> int 40h 1786 00000EB0 7253 jc short lff16m_7 ; error ! 1787 1788 00000EB2 BF[00300000] mov edi, audio_buffer 1789 1790 00000EB7 21C0 and eax, eax 1791 00000EB9 7505 jnz short lff16m_8 1792 00000EBB E96EFCFFFF jmp lff16_eof 1793 1794 lff16m_8: 1795 00000EC0 89C1 mov ecx, eax ; byte count 1796 lff16m_1: 1797 00000EC2 AC lodsb 1798 ;mov [previous_val], al 1799 00000EC3 88C3 mov bl, al 1800 00000EC5 2C80 sub al, 80h 1801 00000EC7 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 1802 00000ECB 66AB stosw ; original sample (left channel) 1803 00000ECD 66AB stosw ; original sample (right channel) 1804 ;xor eax, eax 1805 ; 02/02/2025 1806 00000ECF 8A06 mov al, [esi] 1807 00000ED1 49 dec ecx 1808 00000ED2 7502 jnz short lff16m_2 1809 ; 14/11/2023 1810 00000ED4 B080 mov al, 80h 1811 lff16m_2: 1812 ;mov [next_val], al 1813 00000ED6 88C7 mov bh, al 1814 ;add al, [previous_val] 1815 00000ED8 00D8 add al, bl 1816 00000EDA D0D8 rcr al, 1 1817 00000EDC 88C2 mov dl, al ; this is interpolated middle (temp) sample 1818 ;add al, [previous_val] 1819 00000EDE 00D8 add al, bl 1820 00000EE0 D0D8 rcr al, 1 1821 00000EE2 2C80 sub al, 80h 1822 00000EE4 66C1E008 shl ax, 8 1823 00000EE8 66AB stosw ; this is 1st interpolated sample (L) 1824 00000EEA 66AB stosw ; this is 1st interpolated sample (R) 1825 ;mov al, [next_val] 1826 00000EEC 88F8 mov al, bh 1827 00000EEE 00D0 add al, dl 1828 00000EF0 D0D8 rcr al, 1 1829 00000EF2 2C80 sub al, 80h 1830 00000EF4 66C1E008 shl ax, 8 1831 00000EF8 66AB stosw ; this is 2nd interpolated sample (L) 1832 00000EFA 66AB stosw ; this is 2nd interpolated sample (R) 1833 1834 ; 16 kHZ mono to 48 kHZ stereo conversion of the sample is OK 1835 00000EFC 09C9 or ecx, ecx 1836 00000EFE 75C2 jnz short lff16m_1 1837 00000F00 E911FCFFFF jmp lff16m_3 1838 1839 lff16m_7: 1840 lff16s_7: 1841 00000F05 E92DFCFFFF jmp lff16m_5 ; error 1842 1843 load_16khz_stereo_8_bit: 1844 ; 02/02/2025 1845 ; 14/11/2023 1846 ; 13/11/2023 1847 00000F0A F605[D8240000]01 test byte [flags], ENDOFFILE ; have we already read the 1848 ; last of the file? 1849 00000F11 7402 jz short lff16s_0 ; no 1850 00000F13 F9 stc 1851 00000F14 C3 retn 1852 1853 lff16s_0: 1854 00000F15 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 1855 ;mov edx, [loadsize] 1856 1857 ; esi = buffer address 1858 ;; edx = buffer size 1859 1860 ; load file into memory 1861 sys _read, [FileHandle], esi, [loadsize] 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00000F1A 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 00000F20 89F1 <1> mov ecx, %3 81 <1> %if %0 = 4 82 00000F22 8B15[15040000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00000F28 B803000000 <1> mov eax, %1 87 <1> 88 00000F2D CD40 <1> int 40h 1862 00000F2F 72D4 jc short lff16s_7 ; error ! 1863 1864 00000F31 BF[00300000] mov edi, audio_buffer 1865 1866 00000F36 D1E8 shr eax, 1 1867 00000F38 7505 jnz short lff16s_8 1868 00000F3A E9EFFBFFFF jmp lff16_eof 1869 1870 lff16s_8: 1871 00000F3F 89C1 mov ecx, eax ; word count 1872 lff16s_1: 1873 00000F41 AC lodsb 1874 00000F42 A2[D5210000] mov [previous_val_l], al 1875 00000F47 2C80 sub al, 80h 1876 00000F49 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 1877 00000F4D 66AB stosw ; original sample (L) 1878 00000F4F AC lodsb 1879 00000F50 A2[D7210000] mov [previous_val_r], al 1880 00000F55 2C80 sub al, 80h 1881 00000F57 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 1882 00000F5B 66AB stosw ; original sample (R) 1883 1884 ;xor eax, eax 1885 ; 02/02/2025 1886 00000F5D 668B06 mov ax, [esi] 1887 00000F60 49 dec ecx 1888 00000F61 7504 jnz short lff16s_2 1889 ; convert 8 bit sample to 16 bit sample 1890 ; 14/11/2023 1891 00000F63 66B88080 mov ax, 8080h 1892 lff16s_2: 1893 ;mov [next_val_l], al 1894 ;mov [next_val_r], ah 1895 00000F67 89C3 mov ebx, eax 1896 00000F69 0205[D5210000] add al, [previous_val_l] 1897 00000F6F D0D8 rcr al, 1 1898 00000F71 88C2 mov dl, al ; this is temporary interpolation value (L) 1899 00000F73 0205[D5210000] add al, [previous_val_l] 1900 00000F79 D0D8 rcr al, 1 1901 00000F7B 2C80 sub al, 80h 1902 00000F7D 66C1E008 shl ax, 8 1903 00000F81 66AB stosw ; this is 1st interpolated sample (L) 1904 00000F83 88F8 mov al, bh ; [next_val_r] 1905 00000F85 0205[D7210000] add al, [previous_val_r] 1906 00000F8B D0D8 rcr al, 1 1907 00000F8D 88C6 mov dh, al ; this is temporary interpolation value (R) 1908 00000F8F 0205[D7210000] add al, [previous_val_r] 1909 00000F95 D0D8 rcr al, 1 1910 00000F97 2C80 sub al, 80h 1911 00000F99 66C1E008 shl ax, 8 1912 00000F9D 66AB stosw ; this is 1st interpolated sample (R) 1913 00000F9F 88D0 mov al, dl 1914 00000FA1 00D8 add al, bl ; [next_val_l] 1915 00000FA3 D0D8 rcr al, 1 1916 00000FA5 2C80 sub al, 80h 1917 00000FA7 66C1E008 shl ax, 8 1918 00000FAB 66AB stosw ; this is 2nd interpolated sample (L) 1919 00000FAD 88F0 mov al, dh 1920 00000FAF 00F8 add al, bh ; [next_val_r] 1921 00000FB1 D0D8 rcr al, 1 1922 00000FB3 2C80 sub al, 80h 1923 00000FB5 66C1E008 shl ax, 8 1924 00000FB9 66AB stosw ; this is 2nd interpolated sample (R) 1925 1926 ; 16 kHZ stereo to 48 kHZ stereo conversion of the sample is OK 1927 00000FBB 09C9 or ecx, ecx 1928 00000FBD 7582 jnz short lff16s_1 1929 00000FBF E952FBFFFF jmp lff16s_3 1930 1931 load_16khz_mono_16_bit: 1932 ; 02/02/2025 1933 ; 15/11/2023 1934 ; 13/11/2023 1935 00000FC4 F605[D8240000]01 test byte [flags], ENDOFFILE ; have we already read the 1936 ; last of the file? 1937 00000FCB 7402 jz short lff16m2_0 ; no 1938 00000FCD F9 stc 1939 00000FCE C3 retn 1940 1941 lff16m2_0: 1942 00000FCF BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 1943 ;mov edx, [loadsize] 1944 1945 ; esi = buffer address 1946 ;; edx = buffer size 1947 1948 ; load file into memory 1949 sys _read, [FileHandle], esi, [loadsize] 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00000FD4 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 00000FDA 89F1 <1> mov ecx, %3 81 <1> %if %0 = 4 82 00000FDC 8B15[15040000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00000FE2 B803000000 <1> mov eax, %1 87 <1> 88 00000FE7 CD40 <1> int 40h 1950 00000FE9 7255 jc short lff16m2_7 ; error ! 1951 1952 00000FEB BF[00300000] mov edi, audio_buffer 1953 1954 00000FF0 D1E8 shr eax, 1 1955 00000FF2 7505 jnz short lff16m2_8 1956 00000FF4 E935FBFFFF jmp lff16_eof 1957 1958 lff16m2_8: 1959 00000FF9 89C1 mov ecx, eax ; word count 1960 lff16m2_1: 1961 00000FFB 66AD lodsw 1962 00000FFD 66AB stosw ; original sample (left channel) 1963 00000FFF 66AB stosw ; original sample (right channel) 1964 00001001 80C480 add ah, 80h ; convert sound level 0 to 65535 format 1965 ;mov [previous_val], ax 1966 00001004 89C3 mov ebx, eax 1967 ; 02/02/2025 1968 00001006 668B06 mov ax, [esi] 1969 00001009 49 dec ecx 1970 0000100A 7502 jnz short lff16m2_2 1971 0000100C 31C0 xor eax, eax 1972 lff16m2_2: 1973 0000100E 80C480 add ah, 80h ; convert sound level 0 to 65535 format 1974 00001011 89C5 mov ebp, eax ; [next_val] 1975 ;add ax, [previous_val] 1976 00001013 6601D8 add ax, bx 1977 00001016 66D1D8 rcr ax, 1 1978 00001019 89C2 mov edx, eax ; this is temporary interpolation value 1979 ;add ax, [previous_val] 1980 0000101B 6601D8 add ax, bx 1981 0000101E 66D1D8 rcr ax, 1 1982 00001021 80EC80 sub ah, 80h ; -32768 to +32767 format again 1983 00001024 66AB stosw ; this is 1st interpolated sample (L) 1984 00001026 66AB stosw ; this is 1st interpolated sample (R) 1985 00001028 89E8 mov eax, ebp 1986 0000102A 6601D0 add ax, dx 1987 0000102D 66D1D8 rcr ax, 1 1988 00001030 80EC80 sub ah, 80h ; -32768 to +32767 format again 1989 00001033 66AB stosw ; this is 2nd interpolated sample (L) 1990 00001035 66AB stosw ; this is 2nd interpolated sample (R) 1991 ; 16 kHZ mono to 48 kHZ stereo conversion of the sample is OK 1992 00001037 09C9 or ecx, ecx 1993 00001039 75C0 jnz short lff16m2_1 1994 0000103B E9D6FAFFFF jmp lff16m2_3 1995 1996 lff16m2_7: 1997 lff16s2_7: 1998 00001040 E9F2FAFFFF jmp lff16m2_5 ; error 1999 2000 load_16khz_stereo_16_bit: 2001 ; 02/02/2025 2002 ; 16/11/2023 2003 ; 15/11/2023 2004 ; 13/11/2023 2005 00001045 F605[D8240000]01 test byte [flags], ENDOFFILE ; have we already read the 2006 ; last of the file? 2007 0000104C 7402 jz short lff16s2_0 ; no 2008 0000104E F9 stc 2009 0000104F C3 retn 2010 2011 lff16s2_0: 2012 00001050 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 2013 ;mov edx, [loadsize] 2014 2015 ; esi = buffer address 2016 ;; edx = buffer size 2017 2018 ; load file into memory 2019 sys _read, [FileHandle], esi, [loadsize] 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00001055 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 0000105B 89F1 <1> mov ecx, %3 81 <1> %if %0 = 4 82 0000105D 8B15[15040000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00001063 B803000000 <1> mov eax, %1 87 <1> 88 00001068 CD40 <1> int 40h 2020 0000106A 72D4 jc short lff16s2_7 ; error ! 2021 2022 0000106C BF[00300000] mov edi, audio_buffer 2023 2024 00001071 C1E802 shr eax, 2 2025 00001074 7505 jnz short lff16s2_8 2026 00001076 E9B3FAFFFF jmp lff16_eof 2027 2028 lff16s2_8: 2029 0000107B 89C1 mov ecx, eax ; dword count 2030 lff16s2_1: 2031 0000107D 66AD lodsw 2032 0000107F 66AB stosw ; original sample (L) 2033 00001081 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2034 00001084 66A3[D5210000] mov [previous_val_l], ax 2035 0000108A 66AD lodsw 2036 0000108C 66AB stosw ; original sample (R) 2037 0000108E 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2038 00001091 66A3[D7210000] mov [previous_val_r], ax 2039 ; 02/02/2025 2040 00001097 668B06 mov ax, [esi] 2041 0000109A 668B5602 mov dx, [esi+2] 2042 ; 16/11/2023 2043 0000109E 49 dec ecx 2044 0000109F 7504 jnz short lff16s2_2 2045 000010A1 31D2 xor edx, edx 2046 000010A3 31C0 xor eax, eax 2047 lff16s2_2: 2048 000010A5 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2049 ;mov [next_val_l], ax 2050 000010A8 89C5 mov ebp, eax 2051 000010AA 80C680 add dh, 80h ; convert sound level 0 to 65535 format 2052 000010AD 668915[DB210000] mov [next_val_r], dx 2053 000010B4 660305[D5210000] add ax, [previous_val_l] 2054 000010BB 66D1D8 rcr ax, 1 2055 000010BE 89C2 mov edx, eax ; this is temporary interpolation value (L) 2056 000010C0 660305[D5210000] add ax, [previous_val_l] 2057 000010C7 66D1D8 rcr ax, 1 2058 000010CA 80EC80 sub ah, 80h ; -32768 to +32767 format again 2059 000010CD 66AB stosw ; this is 1st interpolated sample (L) 2060 000010CF 66A1[DB210000] mov ax, [next_val_r] 2061 000010D5 660305[D7210000] add ax, [previous_val_r] 2062 000010DC 66D1D8 rcr ax, 1 2063 000010DF 89C3 mov ebx, eax ; this is temporary interpolation value (R) 2064 000010E1 660305[D7210000] add ax, [previous_val_r] 2065 000010E8 66D1D8 rcr ax, 1 2066 000010EB 80EC80 sub ah, 80h ; -32768 to +32767 format again 2067 000010EE 66AB stosw ; this is 1st interpolated sample (R) 2068 ;mov ax, [next_val_l] 2069 000010F0 89E8 mov eax, ebp 2070 000010F2 6601D0 add ax, dx 2071 000010F5 66D1D8 rcr ax, 1 2072 000010F8 80EC80 sub ah, 80h ; -32768 to +32767 format again 2073 000010FB 66AB stosw ; this is 2nd interpolated sample (L) 2074 000010FD 66A1[DB210000] mov ax, [next_val_r] 2075 00001103 6601D8 add ax, bx 2076 00001106 66D1D8 rcr ax, 1 2077 00001109 80EC80 sub ah, 80h ; -32768 to +32767 format again 2078 0000110C 66AB stosw ; this is 2nd interpolated sample (R) 2079 2080 ; 16 kHZ stereo to 48 kHZ stereo conversion of the sample is OK 2081 0000110E 09C9 or ecx, ecx 2082 00001110 0F8567FFFFFF jnz lff16s2_1 2083 00001116 E9FBF9FFFF jmp lff16s2_3 2084 2085 ; ..................... 2086 2087 load_24khz_mono_8_bit: 2088 ; 02/02/2025 2089 ; 15/11/2023 2090 0000111B F605[D8240000]01 test byte [flags], ENDOFFILE ; have we already read the 2091 ; last of the file? 2092 00001122 7402 jz short lff24m_0 ; no 2093 00001124 F9 stc 2094 00001125 C3 retn 2095 2096 lff24m_0: 2097 00001126 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 2098 ;mov edx, [loadsize] 2099 2100 ; esi = buffer address 2101 ;; edx = buffer size 2102 2103 ; load file into memory 2104 sys _read, [FileHandle], esi, [loadsize] 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 0000112B 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 00001131 89F1 <1> mov ecx, %3 81 <1> %if %0 = 4 82 00001133 8B15[15040000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00001139 B803000000 <1> mov eax, %1 87 <1> 88 0000113E CD40 <1> int 40h 2105 00001140 723B jc short lff24m_7 ; error ! 2106 2107 00001142 BF[00300000] mov edi, audio_buffer 2108 2109 00001147 21C0 and eax, eax 2110 00001149 7505 jnz short lff24m_8 2111 0000114B E9DEF9FFFF jmp lff24_eof 2112 2113 lff24m_8: 2114 00001150 89C1 mov ecx, eax ; byte count 2115 lff24m_1: 2116 00001152 AC lodsb 2117 ;mov [previous_val], al 2118 00001153 88C3 mov bl, al 2119 00001155 2C80 sub al, 80h 2120 00001157 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 2121 0000115B 66AB stosw ; original sample (left channel) 2122 0000115D 66AB stosw ; original sample (right channel) 2123 ;xor eax, eax 2124 ; 02/02/2025 2125 0000115F 8A06 mov al, [esi] 2126 00001161 49 dec ecx 2127 00001162 7502 jnz short lff24m_2 2128 00001164 B080 mov al, 80h 2129 lff24m_2: 2130 ;;mov [next_val], al 2131 ;mov bh, al 2132 ;add al, [previous_val] 2133 00001166 00D8 add al, bl 2134 00001168 D0D8 rcr al, 1 2135 0000116A 2C80 sub al, 80h 2136 0000116C 66C1E008 shl ax, 8 2137 00001170 66AB stosw ; this is interpolated sample (L) 2138 00001172 66AB stosw ; this is interpolated sample (R) 2139 2140 ; 24 kHZ mono to 48 kHZ stereo conversion of the sample is OK 2141 00001174 09C9 or ecx, ecx 2142 00001176 75DA jnz short lff24m_1 2143 00001178 E999F9FFFF jmp lff24_3 2144 2145 lff24m_7: 2146 lff24s_7: 2147 0000117D E9B5F9FFFF jmp lff24_5 ; error 2148 2149 load_24khz_stereo_8_bit: 2150 ; 02/02/2025 2151 ; 15/11/2023 2152 00001182 F605[D8240000]01 test byte [flags], ENDOFFILE ; have we already read the 2153 ; last of the file? 2154 00001189 7402 jz short lff24s_0 ; no 2155 0000118B F9 stc 2156 0000118C C3 retn 2157 2158 lff24s_0: 2159 0000118D BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 2160 ;mov edx, [loadsize] 2161 2162 ; esi = buffer address 2163 ;; edx = buffer size 2164 2165 ; load file into memory 2166 sys _read, [FileHandle], esi, [loadsize] 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00001192 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 00001198 89F1 <1> mov ecx, %3 81 <1> %if %0 = 4 82 0000119A 8B15[15040000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 000011A0 B803000000 <1> mov eax, %1 87 <1> 88 000011A5 CD40 <1> int 40h 2167 000011A7 72D4 jc short lff24s_7 ; error ! 2168 2169 000011A9 BF[00300000] mov edi, audio_buffer 2170 2171 000011AE D1E8 shr eax, 1 2172 000011B0 7505 jnz short lff24s_8 2173 000011B2 E977F9FFFF jmp lff24_eof 2174 2175 lff24s_8: 2176 000011B7 89C1 mov ecx, eax ; word count 2177 lff24s_1: 2178 000011B9 AC lodsb 2179 000011BA A2[D5210000] mov [previous_val_l], al 2180 000011BF 2C80 sub al, 80h 2181 000011C1 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 2182 000011C5 66AB stosw ; original sample (L) 2183 000011C7 AC lodsb 2184 000011C8 A2[D7210000] mov [previous_val_r], al 2185 000011CD 2C80 sub al, 80h 2186 000011CF 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 2187 000011D3 66AB stosw ; original sample (R) 2188 2189 ;xor eax, eax 2190 ; 02/02/2025 2191 000011D5 668B06 mov ax, [esi] 2192 000011D8 49 dec ecx 2193 000011D9 7504 jnz short lff24s_2 2194 ; convert 8 bit sample to 16 bit sample 2195 000011DB 66B88080 mov ax, 8080h 2196 lff24s_2: 2197 ;;mov [next_val_l], al 2198 ;;mov [next_val_r], ah 2199 ;mov bx, ax 2200 000011DF 88E7 mov bh, ah 2201 000011E1 0205[D5210000] add al, [previous_val_l] 2202 000011E7 D0D8 rcr al, 1 2203 ;mov dl, al 2204 000011E9 2C80 sub al, 80h 2205 000011EB 66C1E008 shl ax, 8 2206 000011EF 66AB stosw ; this is interpolated sample (L) 2207 000011F1 88F8 mov al, bh ; [next_val_r] 2208 000011F3 0205[D7210000] add al, [previous_val_r] 2209 000011F9 D0D8 rcr al, 1 2210 ;mov dh, al 2211 000011FB 2C80 sub al, 80h 2212 000011FD 66C1E008 shl ax, 8 2213 00001201 66AB stosw ; this is interpolated sample (R) 2214 2215 ; 24 kHZ stereo to 48 kHZ stereo conversion of the sample is OK 2216 00001203 09C9 or ecx, ecx 2217 00001205 75B2 jnz short lff24s_1 2218 00001207 E90AF9FFFF jmp lff24_3 2219 2220 load_24khz_mono_16_bit: 2221 ; 02/02/2025 2222 ; 15/11/2023 2223 0000120C F605[D8240000]01 test byte [flags], ENDOFFILE ; have we already read the 2224 ; last of the file? 2225 00001213 7402 jz short lff24m2_0 ; no 2226 00001215 F9 stc 2227 00001216 C3 retn 2228 2229 lff24m2_0: 2230 00001217 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 2231 ;mov edx, [loadsize] 2232 2233 ; esi = buffer address 2234 ;; edx = buffer size 2235 2236 ; load file into memory 2237 sys _read, [FileHandle], esi, [loadsize] 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 0000121C 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 00001222 89F1 <1> mov ecx, %3 81 <1> %if %0 = 4 82 00001224 8B15[15040000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 0000122A B803000000 <1> mov eax, %1 87 <1> 88 0000122F CD40 <1> int 40h 2238 00001231 723A jc short lff24m2_7 ; error ! 2239 2240 00001233 BF[00300000] mov edi, audio_buffer 2241 2242 00001238 D1E8 shr eax, 1 2243 0000123A 7505 jnz short lff24m2_8 2244 0000123C E9EDF8FFFF jmp lff24_eof 2245 2246 lff24m2_8: 2247 00001241 89C1 mov ecx, eax ; word count 2248 lff24m2_1: 2249 00001243 66AD lodsw 2250 00001245 66AB stosw ; original sample (left channel) 2251 00001247 66AB stosw ; original sample (right channel) 2252 00001249 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2253 ;mov [previous_val], ax 2254 ;mov ebx, eax 2255 ; 02/02/2025 2256 0000124C 668B1E mov bx, [esi] 2257 0000124F 49 dec ecx 2258 00001250 7502 jnz short lff24m2_2 2259 ;xor eax, eax 2260 00001252 31DB xor ebx, ebx 2261 lff24m2_2: 2262 ; 02/02/2025 2263 00001254 80C780 add bh, 80h ; convert sound level 0 to 65535 format 2264 ;add ah, 80h 2265 ;mov ebp, eax ; [next_val] 2266 ;add ax, [previous_val] 2267 ; ax = [previous_val] 2268 ; bx = [next_val] 2269 00001257 6601D8 add ax, bx 2270 0000125A 66D1D8 rcr ax, 1 2271 0000125D 80EC80 sub ah, 80h ; -32768 to +32767 format again 2272 00001260 66AB stosw ; this is interpolated sample (L) 2273 00001262 66AB stosw ; this is interpolated sample (R) 2274 ; 24 kHZ mono to 48 kHZ stereo conversion of the sample is OK 2275 00001264 09C9 or ecx, ecx 2276 00001266 75DB jnz short lff24m2_1 2277 00001268 E9A9F8FFFF jmp lff24_3 2278 2279 lff24m2_7: 2280 lff24s2_7: 2281 0000126D E9C5F8FFFF jmp lff24_5 ; error 2282 2283 load_24khz_stereo_16_bit: 2284 ; 02/02/2025 2285 ; 16/11/2023 2286 ; 15/11/2023 2287 00001272 F605[D8240000]01 test byte [flags], ENDOFFILE ; have we already read the 2288 ; last of the file? 2289 00001279 7402 jz short lff24s2_0 ; no 2290 0000127B F9 stc 2291 0000127C C3 retn 2292 2293 lff24s2_0: 2294 0000127D BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 2295 ;mov edx, [loadsize] 2296 2297 ; esi = buffer address 2298 ;; edx = buffer size 2299 2300 ; load file into memory 2301 sys _read, [FileHandle], esi, [loadsize] 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00001282 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 00001288 89F1 <1> mov ecx, %3 81 <1> %if %0 = 4 82 0000128A 8B15[15040000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00001290 B803000000 <1> mov eax, %1 87 <1> 88 00001295 CD40 <1> int 40h 2302 00001297 72D4 jc short lff24s2_7 ; error ! 2303 2304 00001299 BF[00300000] mov edi, audio_buffer 2305 2306 0000129E C1E802 shr eax, 2 2307 000012A1 7505 jnz short lff24s2_8 2308 000012A3 E986F8FFFF jmp lff24_eof 2309 2310 lff24s2_8: 2311 000012A8 89C1 mov ecx, eax ; dword count 2312 lff24s2_1: 2313 000012AA 66AD lodsw 2314 000012AC 66AB stosw ; original sample (L) 2315 000012AE 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2316 000012B1 66A3[D5210000] mov [previous_val_l], ax 2317 000012B7 66AD lodsw 2318 000012B9 66AB stosw ; original sample (R) 2319 000012BB 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2320 ;mov [previous_val_r], ax 2321 000012BE 89C3 mov ebx, eax 2322 ; 02/02/2025 2323 000012C0 668B06 mov ax, [esi] 2324 000012C3 668B5602 mov dx, [esi+2] 2325 ; 16/11/2023 2326 000012C7 49 dec ecx 2327 000012C8 7504 jnz short lff24s2_2 2328 000012CA 31D2 xor edx, edx 2329 000012CC 31C0 xor eax, eax 2330 lff24s2_2: 2331 000012CE 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2332 ;;mov [next_val_l], ax 2333 ;mov ebp, eax 2334 000012D1 80C680 add dh, 80h ; convert sound level 0 to 65535 format 2335 ;mov [next_val_r], dx 2336 000012D4 660305[D5210000] add ax, [previous_val_l] 2337 000012DB 66D1D8 rcr ax, 1 2338 000012DE 80EC80 sub ah, 80h ; -32768 to +32767 format again 2339 000012E1 66AB stosw ; this is interpolated sample (L) 2340 ;mov ax, [next_val_r] 2341 000012E3 89D0 mov eax, edx 2342 ;add ax, [previous_val_r] 2343 000012E5 6601D8 add ax, bx 2344 000012E8 66D1D8 rcr ax, 1 2345 000012EB 80EC80 sub ah, 80h ; -32768 to +32767 format again 2346 000012EE 66AB stosw ; this is interpolated sample (R) 2347 2348 ; 24 kHZ stereo to 48 kHZ stereo conversion of the sample is OK 2349 000012F0 09C9 or ecx, ecx 2350 000012F2 75B6 jnz short lff24s2_1 2351 000012F4 E91DF8FFFF jmp lff24_3 2352 2353 ; ..................... 2354 2355 load_32khz_mono_8_bit: 2356 ; 02/02/2025 2357 ; 15/11/2023 2358 000012F9 F605[D8240000]01 test byte [flags], ENDOFFILE ; have we already read the 2359 ; last of the file? 2360 00001300 7402 jz short lff32m_0 ; no 2361 00001302 F9 stc 2362 00001303 C3 retn 2363 2364 lff32m_0: 2365 00001304 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 2366 ;mov edx, [loadsize] 2367 2368 ; esi = buffer address 2369 ;; edx = buffer size 2370 2371 ; load file into memory 2372 sys _read, [FileHandle], esi, [loadsize] 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00001309 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 0000130F 89F1 <1> mov ecx, %3 81 <1> %if %0 = 4 82 00001311 8B15[15040000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00001317 B803000000 <1> mov eax, %1 87 <1> 88 0000131C CD40 <1> int 40h 2373 0000131E 7247 jc short lff32m_7 ; error ! 2374 2375 00001320 BF[00300000] mov edi, audio_buffer 2376 2377 00001325 21C0 and eax, eax 2378 00001327 7505 jnz short lff32m_8 2379 00001329 E900F8FFFF jmp lff32_eof 2380 2381 lff32m_8: 2382 0000132E 89C1 mov ecx, eax ; byte count 2383 lff32m_1: 2384 00001330 AC lodsb 2385 ;mov [previous_val], al 2386 00001331 88C3 mov bl, al 2387 00001333 2C80 sub al, 80h 2388 00001335 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 2389 00001339 66AB stosw ; original sample (left channel) 2390 0000133B 66AB stosw ; original sample (right channel) 2391 ;xor eax, eax 2392 ; 02/02/2025 2393 0000133D 8A06 mov al, [esi] 2394 0000133F 49 dec ecx 2395 00001340 7502 jnz short lff32m_2 2396 00001342 B080 mov al, 80h 2397 lff32m_2: 2398 ;;mov [next_val], al 2399 ;mov bh, al 2400 ;add al, [previous_val] 2401 00001344 00D8 add al, bl 2402 00001346 D0D8 rcr al, 1 2403 00001348 2C80 sub al, 80h 2404 0000134A 66C1E008 shl ax, 8 2405 0000134E 66AB stosw ; this is interpolated sample (L) 2406 00001350 66AB stosw ; this is interpolated sample (R) 2407 2408 ; different than 8-16-24 kHZ ! 2409 ; 'original-interpolated-original' trio samples 2410 00001352 E30E jecxz lff32m_3 2411 2412 00001354 AC lodsb 2413 00001355 2C80 sub al, 80h 2414 00001357 66C1E008 shl ax, 8 2415 0000135B 66AB stosw ; original sample (left channel) 2416 0000135D 66AB stosw ; original sample (right channel) 2417 2418 ; 32 kHZ mono to 48 kHZ stereo conversion of the sample is OK 2419 0000135F 49 dec ecx 2420 00001360 75CE jnz short lff32m_1 2421 lff32m_3: 2422 00001362 E9AFF7FFFF jmp lff32_3 2423 2424 lff32m_7: 2425 lff32s_7: 2426 00001367 E9CBF7FFFF jmp lff32_5 ; error 2427 2428 load_32khz_stereo_8_bit: 2429 ; 02/02/2025 2430 ; 15/11/2023 2431 0000136C F605[D8240000]01 test byte [flags], ENDOFFILE ; have we already read the 2432 ; last of the file? 2433 00001373 7402 jz short lff32s_0 ; no 2434 00001375 F9 stc 2435 00001376 C3 retn 2436 2437 lff32s_0: 2438 00001377 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 2439 ;mov edx, [loadsize] 2440 2441 ; esi = buffer address 2442 ;; edx = buffer size 2443 2444 ; load file into memory 2445 sys _read, [FileHandle], esi, [loadsize] 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 0000137C 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 00001382 89F1 <1> mov ecx, %3 81 <1> %if %0 = 4 82 00001384 8B15[15040000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 0000138A B803000000 <1> mov eax, %1 87 <1> 88 0000138F CD40 <1> int 40h 2446 00001391 72D4 jc short lff32s_7 ; error ! 2447 2448 00001393 BF[00300000] mov edi, audio_buffer 2449 2450 00001398 D1E8 shr eax, 1 2451 0000139A 7505 jnz short lff32s_8 2452 0000139C E98DF7FFFF jmp lff32_eof 2453 2454 lff32s_8: 2455 000013A1 89C1 mov ecx, eax ; word count 2456 lff32s_1: 2457 000013A3 AC lodsb 2458 000013A4 A2[D5210000] mov [previous_val_l], al 2459 000013A9 2C80 sub al, 80h 2460 000013AB 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 2461 000013AF 66AB stosw ; original sample (L) 2462 000013B1 AC lodsb 2463 000013B2 A2[D7210000] mov [previous_val_r], al 2464 000013B7 2C80 sub al, 80h 2465 000013B9 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 2466 000013BD 66AB stosw ; original sample (R) 2467 2468 ;xor eax, eax 2469 ; 02/02/2025 2470 000013BF 668B06 mov ax, [esi] 2471 000013C2 49 dec ecx 2472 000013C3 7504 jnz short lff32s_2 2473 ; convert 8 bit sample to 16 bit sample 2474 000013C5 66B88080 mov ax, 8080h 2475 lff32s_2: 2476 ;;mov [next_val_l], al 2477 ;;mov [next_val_r], ah 2478 ;mov bx, ax 2479 000013C9 88E7 mov bh, ah 2480 000013CB 0205[D5210000] add al, [previous_val_l] 2481 000013D1 D0D8 rcr al, 1 2482 ;mov dl, al 2483 000013D3 2C80 sub al, 80h 2484 000013D5 66C1E008 shl ax, 8 2485 000013D9 66AB stosw ; this is interpolated sample (L) 2486 000013DB 88F8 mov al, bh ; [next_val_r] 2487 000013DD 0205[D7210000] add al, [previous_val_r] 2488 000013E3 D0D8 rcr al, 1 2489 ;mov dh, al 2490 000013E5 2C80 sub al, 80h 2491 000013E7 66C1E008 shl ax, 8 2492 000013EB 66AB stosw ; this is interpolated sample (R) 2493 2494 ; different than 8-16-24 kHZ ! 2495 ; 'original-interpolated-original' trio samples 2496 000013ED E315 jecxz lff32s_3 2497 2498 000013EF AC lodsb 2499 000013F0 2C80 sub al, 80h 2500 000013F2 66C1E008 shl ax, 8 2501 000013F6 66AB stosw ; original sample (left channel) 2502 2503 000013F8 AC lodsb 2504 000013F9 2C80 sub al, 80h 2505 000013FB 66C1E008 shl ax, 8 2506 000013FF 66AB stosw ; original sample (right channel) 2507 2508 ; 32 kHZ stereo to 48 kHZ stereo conversion of the sample is OK 2509 00001401 49 dec ecx 2510 00001402 759F jnz short lff32s_1 2511 lff32s_3: 2512 00001404 E90DF7FFFF jmp lff32_3 2513 2514 load_32khz_mono_16_bit: 2515 ; 02/02/2025 2516 ; 15/11/2023 2517 00001409 F605[D8240000]01 test byte [flags], ENDOFFILE ; have we already read the 2518 ; last of the file? 2519 00001410 7402 jz short lff32m2_0 ; no 2520 00001412 F9 stc 2521 00001413 C3 retn 2522 2523 lff32m2_0: 2524 00001414 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 2525 ;mov edx, [loadsize] 2526 2527 ; esi = buffer address 2528 ;; edx = buffer size 2529 2530 ; load file into memory 2531 sys _read, [FileHandle], esi, [loadsize] 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00001419 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 0000141F 89F1 <1> mov ecx, %3 81 <1> %if %0 = 4 82 00001421 8B15[15040000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00001427 B803000000 <1> mov eax, %1 87 <1> 88 0000142C CD40 <1> int 40h 2532 0000142E 7241 jc short lff32m2_7 ; error ! 2533 2534 00001430 BF[00300000] mov edi, audio_buffer 2535 2536 00001435 D1E8 shr eax, 1 2537 00001437 7505 jnz short lff32m2_8 2538 00001439 E9F0F6FFFF jmp lff32_eof 2539 2540 lff32m2_8: 2541 0000143E 89C1 mov ecx, eax ; word count 2542 lff32m2_1: 2543 00001440 66AD lodsw 2544 00001442 66AB stosw ; original sample (left channel) 2545 00001444 66AB stosw ; original sample (right channel) 2546 00001446 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2547 ;mov [previous_val], ax 2548 ;mov ebx, eax 2549 ;xor eax, eax 2550 ; 02/02/2025 2551 ;mov ax, [esi] 2552 00001449 668B1E mov bx, [esi] 2553 0000144C 49 dec ecx 2554 0000144D 7502 jnz short lff32m2_2 2555 0000144F 31DB xor ebx, ebx 2556 lff32m2_2: 2557 ; 02/02/2025 2558 00001451 80C780 add bh, 80h ; convert sound level 0 to 65535 format 2559 ;add ah, 80h 2560 ;mov ebp, eax ; [next_val] 2561 ;add ax, [previous_val] 2562 ; ax = [previous_val] 2563 ; bx = [next_val] 2564 00001454 6601D8 add ax, bx 2565 00001457 66D1D8 rcr ax, 1 2566 0000145A 80EC80 sub ah, 80h ; -32768 to +32767 format again 2567 0000145D 66AB stosw ; this is interpolated sample (L) 2568 0000145F 66AB stosw ; this is interpolated sample (R) 2569 2570 ; different than 8-16-24 kHZ ! 2571 ; 'original-interpolated-original' trio samples 2572 00001461 E309 jecxz lff32m2_3 2573 2574 00001463 66AD lodsw 2575 00001465 66AB stosw ; original sample (left channel) 2576 00001467 66AB stosw ; original sample (right channel) 2577 2578 ; 32 kHZ mono to 48 kHZ stereo conversion of the sample is OK 2579 00001469 49 dec ecx 2580 0000146A 75D4 jnz short lff32m2_1 2581 lff32m2_3: 2582 0000146C E9A5F6FFFF jmp lff32_3 2583 2584 lff32m2_7: 2585 lff32s2_7: 2586 00001471 E9C1F6FFFF jmp lff32_5 ; error 2587 2588 load_32khz_stereo_16_bit: 2589 ; 02/02/2025 2590 ; 16/11/2023 2591 ; 15/11/2023 2592 00001476 F605[D8240000]01 test byte [flags], ENDOFFILE ; have we already read the 2593 ; last of the file? 2594 0000147D 7402 jz short lff32s2_0 ; no 2595 0000147F F9 stc 2596 00001480 C3 retn 2597 2598 lff32s2_0: 2599 00001481 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 2600 ;mov edx, [loadsize] 2601 2602 ; esi = buffer address 2603 ;; edx = buffer size 2604 2605 ; load file into memory 2606 sys _read, [FileHandle], esi, [loadsize] 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00001486 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 0000148C 89F1 <1> mov ecx, %3 81 <1> %if %0 = 4 82 0000148E 8B15[15040000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00001494 B803000000 <1> mov eax, %1 87 <1> 88 00001499 CD40 <1> int 40h 2607 0000149B 72D4 jc short lff32s2_7 ; error ! 2608 2609 0000149D BF[00300000] mov edi, audio_buffer 2610 2611 000014A2 C1E802 shr eax, 2 2612 000014A5 7505 jnz short lff32s2_8 2613 000014A7 E982F6FFFF jmp lff32_eof 2614 2615 lff32s2_8: 2616 000014AC 89C1 mov ecx, eax ; dword count 2617 lff32s2_1: 2618 000014AE 66AD lodsw 2619 000014B0 66AB stosw ; original sample (L) 2620 000014B2 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2621 000014B5 66A3[D5210000] mov [previous_val_l], ax 2622 000014BB 66AD lodsw 2623 000014BD 66AB stosw ; original sample (R) 2624 000014BF 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2625 ;mov [previous_val_r], ax 2626 000014C2 89C3 mov ebx, eax 2627 ; 02/02/2025 2628 000014C4 668B06 mov ax, [esi] 2629 000014C7 668B5602 mov dx, [esi+2] 2630 ; 16/11/2023 2631 000014CB 49 dec ecx 2632 000014CC 7504 jnz short lff32s2_2 2633 000014CE 31D2 xor edx, edx 2634 000014D0 31C0 xor eax, eax 2635 lff32s2_2: 2636 000014D2 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2637 ;;mov [next_val_l], ax 2638 ;mov ebp, eax 2639 000014D5 80C680 add dh, 80h ; convert sound level 0 to 65535 format 2640 ;mov [next_val_r], dx 2641 000014D8 660305[D5210000] add ax, [previous_val_l] 2642 000014DF 66D1D8 rcr ax, 1 2643 000014E2 80EC80 sub ah, 80h ; -32768 to +32767 format again 2644 000014E5 66AB stosw ; this is interpolated sample (L) 2645 ;mov ax, [next_val_r] 2646 000014E7 89D0 mov eax, edx 2647 ;add ax, [previous_val_r] 2648 000014E9 6601D8 add ax, bx 2649 000014EC 66D1D8 rcr ax, 1 2650 000014EF 80EC80 sub ah, 80h ; -32768 to +32767 format again 2651 000014F2 66AB stosw ; this is interpolated sample (R) 2652 2653 ; different than 8-16-24 kHZ ! 2654 ; 'original-interpolated-original' trio samples 2655 000014F4 E30B jecxz lff32s2_3 2656 2657 000014F6 66AD lodsw 2658 000014F8 66AB stosw ; original sample (L) 2659 000014FA 66AD lodsw 2660 000014FC 66AB stosw ; original sample (R) 2661 2662 ; 32 kHZ stereo to 48 kHZ stereo conversion of the sample is OK 2663 000014FE 49 dec ecx 2664 000014FF 75AD jnz short lff32s2_1 2665 lff32s2_3: 2666 00001501 E910F6FFFF jmp lff32_3 2667 2668 ; ..................... 2669 2670 load_22khz_mono_8_bit: 2671 ; 02/02/2025 2672 ; 16/11/2023 2673 00001506 F605[D8240000]01 test byte [flags], ENDOFFILE ; have we already read the 2674 ; last of the file? 2675 0000150D 7402 jz short lff22m_0 ; no 2676 0000150F F9 stc 2677 00001510 C3 retn 2678 2679 lff22m_0: 2680 00001511 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 2681 ;mov edx, [loadsize] 2682 2683 ; esi = buffer address 2684 ;; edx = buffer size 2685 2686 ; load file into memory 2687 sys _read, [FileHandle], esi, [loadsize] 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00001516 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 0000151C 89F1 <1> mov ecx, %3 81 <1> %if %0 = 4 82 0000151E 8B15[15040000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00001524 B803000000 <1> mov eax, %1 87 <1> 88 00001529 CD40 <1> int 40h 2688 0000152B 725D jc short lff22m_7 ; error ! 2689 2690 0000152D BF[00300000] mov edi, audio_buffer 2691 2692 00001532 21C0 and eax, eax 2693 00001534 7505 jnz short lff22m_8 2694 00001536 E9F3F5FFFF jmp lff22_eof 2695 2696 lff22m_8: 2697 0000153B 89C1 mov ecx, eax ; byte count 2698 lff22m_9: 2699 0000153D BD05000000 mov ebp, 5 ; interpolation (one step) loop count 2700 00001542 C605[DD210000]03 mov byte [faz], 3 ; 3 steps/phases 2701 lff22m_1: 2702 ; 3:2:2:2:2:2::3:2:2:2:2::3:2:2:2:2:2 ; 37/17 2703 00001549 AC lodsb 2704 ; 02/02/2025 2705 0000154A 8A16 mov dl, [esi] 2706 0000154C 49 dec ecx 2707 0000154D 7502 jnz short lff22m_2_1 2708 0000154F B280 mov dl, 80h 2709 lff22m_2_1: 2710 ; al = [previous_val] 2711 ; dl = [next_val] 2712 00001551 E835070000 call interpolating_3_8bit_mono ; 1 of 17 2713 00001556 E32D jecxz lff22m_3 2714 lff22m_2_2: 2715 00001558 AC lodsb 2716 ; 02/02/2025 2717 00001559 8A16 mov dl, [esi] 2718 0000155B 49 dec ecx 2719 0000155C 7502 jnz short lff22m_2_3 2720 0000155E B280 mov dl, 80h 2721 lff22m_2_3: 2722 00001560 E8B0070000 call interpolating_2_8bit_mono ; 2 of 17 .. 6 of 17 2723 00001565 E31E jecxz lff22m_3 2724 00001567 4D dec ebp 2725 00001568 75EE jnz short lff22m_2_2 2726 2727 0000156A A0[DD210000] mov al, [faz] 2728 0000156F FEC8 dec al 2729 00001571 74CA jz short lff22m_9 2730 00001573 FE0D[DD210000] dec byte [faz] 2731 00001579 BD04000000 mov ebp, 4 2732 0000157E FEC8 dec al 2733 00001580 75C7 jnz short lff22m_1 ; 3:2:2:2:2 ; 7-11 of 17 2734 00001582 45 inc ebp ; 5 2735 00001583 EBC4 jmp short lff22m_1 ; 3:2:2:2:2:2 ; 12-17 of 17 2736 2737 lff22m_3: 2738 lff22s_3: 2739 00001585 E98CF5FFFF jmp lff22_3 ; padfill 2740 ; (put zeros in the remain words of the buffer) 2741 lff22m_7: 2742 lff22s_7: 2743 0000158A E9A8F5FFFF jmp lff22_5 ; error 2744 2745 load_22khz_stereo_8_bit: 2746 ; 02/02/2025 2747 ; 16/11/2023 2748 0000158F F605[D8240000]01 test byte [flags], ENDOFFILE ; have we already read the 2749 ; last of the file? 2750 00001596 7402 jz short lff22s_0 ; no 2751 00001598 F9 stc 2752 00001599 C3 retn 2753 2754 lff22s_0: 2755 0000159A BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 2756 ;mov edx, [loadsize] 2757 2758 ; esi = buffer address 2759 ;; edx = buffer size 2760 2761 ; load file into memory 2762 sys _read, [FileHandle], esi, [loadsize] 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 0000159F 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 000015A5 89F1 <1> mov ecx, %3 81 <1> %if %0 = 4 82 000015A7 8B15[15040000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 000015AD B803000000 <1> mov eax, %1 87 <1> 88 000015B2 CD40 <1> int 40h 2763 000015B4 72D4 jc short lff22s_7 ; error ! 2764 2765 000015B6 BF[00300000] mov edi, audio_buffer 2766 2767 000015BB D1E8 shr eax, 1 2768 000015BD 7505 jnz short lff22s_8 2769 000015BF E96AF5FFFF jmp lff22_eof 2770 2771 lff22s_8: 2772 000015C4 89C1 mov ecx, eax ; word count 2773 lff22s_9: 2774 000015C6 BD05000000 mov ebp, 5 ; interpolation (one step) loop count 2775 000015CB C605[DD210000]03 mov byte [faz], 3 ; 3 steps/phase 2776 lff22s_1: 2777 ; 3:2:2:2:2:2::3:2:2:2:2::3:2:2:2:2:2 ; 37/17 2778 000015D2 66AD lodsw 2779 ; 02/02/2025 2780 000015D4 668B16 mov dx, [esi] 2781 000015D7 49 dec ecx 2782 000015D8 7504 jnz short lff22s_2_1 2783 000015DA 66BA8080 mov dx, 8080h 2784 lff22s_2_1: 2785 ; al = [previous_val_l] 2786 ; ah = [previous_val_r] 2787 ; dl = [next_val_l] 2788 ; dh = [next_val_r] 2789 000015DE E8DB060000 call interpolating_3_8bit_stereo ; 1 of 17 2790 000015E3 E3A0 jecxz lff22s_3 2791 lff22s_2_2: 2792 000015E5 66AD lodsw 2793 ; 02/02/2025 2794 000015E7 668B16 mov dx, [esi] 2795 000015EA 49 dec ecx 2796 000015EB 7504 jnz short lff22s_2_3 2797 000015ED 66BA8080 mov dx, 8080h 2798 lff22s_2_3: 2799 000015F1 E83C070000 call interpolating_2_8bit_stereo ; 2 of 17 .. 6 of 17 2800 000015F6 E38D jecxz lff22s_3 2801 000015F8 4D dec ebp 2802 000015F9 75EA jnz short lff22s_2_2 2803 2804 000015FB A0[DD210000] mov al, [faz] 2805 00001600 FEC8 dec al 2806 00001602 74C2 jz short lff22s_9 2807 00001604 FE0D[DD210000] dec byte [faz] 2808 0000160A BD04000000 mov ebp, 4 2809 0000160F FEC8 dec al 2810 00001611 75BF jnz short lff22s_1 ; 3:2:2:2:2 ; 7-11 of 17 2811 00001613 45 inc ebp ; 5 2812 00001614 EBBC jmp short lff22s_1 ; 3:2:2:2:2:2 ; 12-17 of 17 2813 2814 load_22khz_mono_16_bit: 2815 ; 02/02/2025 2816 ; 16/11/2023 2817 00001616 F605[D8240000]01 test byte [flags], ENDOFFILE ; have we already read the 2818 ; last of the file? 2819 0000161D 7402 jz short lff22m2_0 ; no 2820 0000161F F9 stc 2821 00001620 C3 retn 2822 2823 lff22m2_0: 2824 00001621 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 2825 ;mov edx, [loadsize] 2826 2827 ; esi = buffer address 2828 ;; edx = buffer size 2829 2830 ; load file into memory 2831 sys _read, [FileHandle], esi, [loadsize] 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00001626 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 0000162C 89F1 <1> mov ecx, %3 81 <1> %if %0 = 4 82 0000162E 8B15[15040000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00001634 B803000000 <1> mov eax, %1 87 <1> 88 00001639 CD40 <1> int 40h 2832 0000163B 7261 jc short lff22m2_7 ; error ! 2833 2834 0000163D BF[00300000] mov edi, audio_buffer 2835 2836 00001642 D1E8 shr eax, 1 2837 00001644 7505 jnz short lff22m2_8 2838 00001646 E9E3F4FFFF jmp lff22_eof 2839 2840 lff22m2_8: 2841 0000164B 89C1 mov ecx, eax ; word count 2842 lff22m2_9: 2843 0000164D BD05000000 mov ebp, 5 ; interpolation (one step) loop count 2844 00001652 C605[DD210000]03 mov byte [faz], 3 ; 3 steps/phases 2845 lff22m2_1: 2846 ; 3:2:2:2:2:2::3:2:2:2:2::3:2:2:2:2:2 ; 37/17 2847 00001659 66AD lodsw 2848 ; 02/02/2025 2849 0000165B 668B16 mov dx, [esi] 2850 0000165E 49 dec ecx 2851 0000165F 7502 jnz short lff22m2_2_1 2852 00001661 31D2 xor edx, edx 2853 lff22m2_2_1: 2854 ; ax = [previous_val] 2855 ; dx = [next_val] 2856 00001663 E8FB060000 call interpolating_3_16bit_mono ; 1 of 17 2857 00001668 E32F jecxz lff22m2_3 2858 lff22m2_2_2: 2859 0000166A 66AD lodsw 2860 ; 02/02/2025 2861 0000166C 668B16 mov dx, [esi] 2862 0000166F 49 dec ecx 2863 00001670 7502 jnz short lff22m2_2_3 2864 00001672 31D2 xor edx, edx 2865 lff22m2_2_3: 2866 00001674 E87D070000 call interpolating_2_16bit_mono ; 2 of 17 .. 6 of 17 2867 00001679 E31E jecxz lff22m2_3 2868 0000167B 4D dec ebp 2869 0000167C 75EC jnz short lff22m2_2_2 2870 2871 0000167E A0[DD210000] mov al, [faz] 2872 00001683 FEC8 dec al 2873 00001685 74C6 jz short lff22m2_9 2874 00001687 FE0D[DD210000] dec byte [faz] 2875 0000168D BD04000000 mov ebp, 4 2876 00001692 FEC8 dec al 2877 00001694 75C3 jnz short lff22m2_1 ; 3:2:2:2:2 ; 7-11 of 17 2878 00001696 45 inc ebp ; 5 2879 00001697 EBC0 jmp short lff22m2_1 ; 3:2:2:2:2:2 ; 12-17 of 17 2880 2881 lff22m2_3: 2882 lff22s2_3: 2883 00001699 E978F4FFFF jmp lff22_3 ; padfill 2884 ; (put zeros in the remain words of the buffer) 2885 lff22m2_7: 2886 lff22s2_7: 2887 0000169E E994F4FFFF jmp lff22_5 ; error 2888 2889 load_22khz_stereo_16_bit: 2890 ; 16/11/2023 2891 000016A3 F605[D8240000]01 test byte [flags], ENDOFFILE ; have we already read the 2892 ; last of the file? 2893 000016AA 7402 jz short lff22s2_0 ; no 2894 000016AC F9 stc 2895 000016AD C3 retn 2896 2897 lff22s2_0: 2898 000016AE BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 2899 ;mov edx, [loadsize] 2900 2901 ; esi = buffer address 2902 ;; edx = buffer size 2903 2904 ; load file into memory 2905 sys _read, [FileHandle], esi, [loadsize] 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 000016B3 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 000016B9 89F1 <1> mov ecx, %3 81 <1> %if %0 = 4 82 000016BB 8B15[15040000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 000016C1 B803000000 <1> mov eax, %1 87 <1> 88 000016C6 CD40 <1> int 40h 2906 000016C8 72D4 jc short lff22s2_7 ; error ! 2907 2908 000016CA BF[00300000] mov edi, audio_buffer 2909 2910 000016CF C1E802 shr eax, 2 ; dword (left chan word + right chan word) 2911 000016D2 7505 jnz short lff22s2_8 2912 000016D4 E955F4FFFF jmp lff22_eof 2913 2914 lff22s2_8: 2915 000016D9 89C1 mov ecx, eax ; dword count 2916 lff22s2_9: 2917 000016DB BD05000000 mov ebp, 5 ; interpolation (one step) loop count 2918 000016E0 C605[DD210000]03 mov byte [faz], 3 ; 3 steps/phase 2919 lff22s2_1: 2920 ; 3:2:2:2:2:2::3:2:2:2:2::3:2:2:2:2:2 ; 37/17 2921 000016E7 66AD lodsw 2922 000016E9 89C3 mov ebx, eax 2923 000016EB 66AD lodsw 2924 000016ED 8B16 mov edx, [esi] 2925 000016EF 668915[D9210000] mov [next_val_l], dx 2926 ; 26/11/2023 2927 000016F6 C1EA10 shr edx, 16 2928 000016F9 49 dec ecx 2929 000016FA 7509 jnz short lff22s2_2_1 2930 000016FC 31D2 xor edx, edx ; 0 2931 000016FE 668915[D9210000] mov [next_val_l], dx 2932 lff22s2_2_1: 2933 ; bx = [previous_val_l] 2934 ; ax = [previous_val_r] 2935 ; [next_val_l] 2936 ; dx = [next_val_r] 2937 00001705 E889060000 call interpolating_3_16bit_stereo ; 1 of 17 2938 0000170A E38D jecxz lff22s2_3 2939 lff22s2_2_2: 2940 0000170C 66AD lodsw 2941 0000170E 89C3 mov ebx, eax 2942 00001710 66AD lodsw 2943 00001712 8B16 mov edx, [esi] 2944 00001714 668915[D9210000] mov [next_val_l], dx 2945 ; 26/11/2023 2946 0000171B C1EA10 shr edx, 16 2947 0000171E 49 dec ecx 2948 0000171F 7509 jnz short lff22s2_2_3 2949 00001721 31D2 xor edx, edx ; 0 2950 00001723 668915[D9210000] mov [next_val_l], dx 2951 lff22s2_2_3: 2952 0000172A E8DF060000 call interpolating_2_16bit_stereo ; 2 of 17 .. 6 of 17 2953 0000172F E31E jecxz lff22s2_2_4 2954 2955 00001731 4D dec ebp 2956 00001732 75D8 jnz short lff22s2_2_2 2957 2958 00001734 A0[DD210000] mov al, [faz] 2959 00001739 FEC8 dec al 2960 0000173B 749E jz short lff22s2_9 2961 0000173D FE0D[DD210000] dec byte [faz] 2962 00001743 BD04000000 mov ebp, 4 2963 00001748 FEC8 dec al 2964 0000174A 759B jnz short lff22s2_1 ; 3:2:2:2:2 ; 7-11 of 17 2965 0000174C 45 inc ebp ; 5 2966 0000174D EB98 jmp short lff22s2_1 ; 3:2:2:2:2:2 ; 12-17 of 17 2967 2968 lff22s2_2_4: 2969 ; 26/11/2023 2970 0000174F E9C2F3FFFF jmp lff22_3 ; padfill 2971 2972 ; ..................... 2973 2974 load_11khz_mono_8_bit: 2975 ; 02/02/2025 2976 ; 18/11/2023 2977 00001754 F605[D8240000]01 test byte [flags], ENDOFFILE ; have we already read the 2978 ; last of the file? 2979 0000175B 7402 jz short lff11m_0 ; no 2980 0000175D F9 stc 2981 0000175E C3 retn 2982 2983 lff11m_0: 2984 0000175F BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 2985 ;mov edx, [loadsize] 2986 2987 ; esi = buffer address 2988 ;; edx = buffer size 2989 2990 ; load file into memory 2991 sys _read, [FileHandle], esi, [loadsize] 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00001764 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 0000176A 89F1 <1> mov ecx, %3 81 <1> %if %0 = 4 82 0000176C 8B15[15040000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00001772 B803000000 <1> mov eax, %1 87 <1> 88 00001777 CD40 <1> int 40h 2992 00001779 7247 jc short lff11m_7 ; error ! 2993 2994 0000177B BF[00300000] mov edi, audio_buffer 2995 2996 00001780 21C0 and eax, eax 2997 00001782 7505 jnz short lff11m_8 2998 00001784 E9A5F3FFFF jmp lff11_eof 2999 3000 lff11m_8: 3001 00001789 89C1 mov ecx, eax ; byte count 3002 lff11m_9: 3003 0000178B BD06000000 mov ebp, 6 ; interpolation (one step) loop count 3004 lff11m_1: 3005 ; 5:4:4::5:4:4::5:4:4::5:4:4::5:4:4::5:4 ; 74/17 3006 00001790 AC lodsb 3007 ; 02/02/2025 3008 00001791 8A16 mov dl, [esi] 3009 00001793 49 dec ecx 3010 00001794 7502 jnz short lff11m_2_1 3011 00001796 B280 mov dl, 80h 3012 lff11m_2_1: 3013 ; al = [previous_val] 3014 ; dl = [next_val] 3015 00001798 E8A0060000 call interpolating_5_8bit_mono 3016 0000179D E328 jecxz lff11m_3 3017 lff11m_2_2: 3018 0000179F AC lodsb 3019 ; 02/02/2025 3020 000017A0 8A16 mov dl, [esi] 3021 000017A2 49 dec ecx 3022 000017A3 7502 jnz short lff11m_2_3 3023 000017A5 B280 mov dl, 80h 3024 lff11m_2_3: 3025 000017A7 E89D070000 call interpolating_4_8bit_mono 3026 000017AC E319 jecxz lff11m_3 3027 3028 000017AE 4D dec ebp 3029 000017AF 74DA jz short lff11m_9 3030 3031 000017B1 AC lodsb 3032 ; 02/02/2025 3033 000017B2 8A16 mov dl, [esi] 3034 000017B4 49 dec ecx 3035 000017B5 7502 jnz short lff11m_2_4 3036 000017B7 B280 mov dl, 80h 3037 lff11m_2_4: 3038 000017B9 E88B070000 call interpolating_4_8bit_mono 3039 000017BE E307 jecxz lff11m_3 3040 000017C0 EBCE jmp short lff11m_1 3041 3042 lff11m_7: 3043 lff11s_7: 3044 000017C2 E970F3FFFF jmp lff11_5 ; error 3045 3046 lff11m_3: 3047 lff11s_3: 3048 000017C7 E94AF3FFFF jmp lff11_3 ; padfill 3049 ; (put zeros in the remain words of the buffer) 3050 3051 load_11khz_stereo_8_bit: 3052 ; 02/02/2025 3053 ; 18/11/2023 3054 000017CC F605[D8240000]01 test byte [flags], ENDOFFILE ; have we already read the 3055 ; last of the file? 3056 000017D3 7402 jz short lff11s_0 ; no 3057 000017D5 F9 stc 3058 000017D6 C3 retn 3059 3060 lff11s_0: 3061 000017D7 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 3062 ;mov edx, [loadsize] 3063 3064 ; esi = buffer address 3065 ;; edx = buffer size 3066 3067 ; load file into memory 3068 sys _read, [FileHandle], esi, [loadsize] 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 000017DC 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 000017E2 89F1 <1> mov ecx, %3 81 <1> %if %0 = 4 82 000017E4 8B15[15040000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 000017EA B803000000 <1> mov eax, %1 87 <1> 88 000017EF CD40 <1> int 40h 3069 000017F1 72CF jc short lff11s_7 ; error ! 3070 3071 000017F3 BF[00300000] mov edi, audio_buffer 3072 3073 000017F8 D1E8 shr eax, 1 3074 000017FA 7505 jnz short lff11s_8 3075 000017FC E92DF3FFFF jmp lff11_eof 3076 3077 lff11s_8: 3078 00001801 89C1 mov ecx, eax ; word count 3079 lff11s_9: 3080 00001803 BD06000000 mov ebp, 6 ; interpolation (one step) loop count 3081 lff11s_1: 3082 ; 5:4:4::5:4:4::5:4:4::5:4:4::5:4:4::5:4 ; 74/17 3083 00001808 66AD lodsw 3084 ; 02/02/2025 3085 0000180A 668B16 mov dx, [esi] 3086 0000180D 49 dec ecx 3087 0000180E 7504 jnz short lff11s_2_1 3088 00001810 66BA8080 mov dx, 8080h 3089 lff11s_2_1: 3090 ; al = [previous_val_l] 3091 ; ah = [previous_val_r] 3092 ; dl = [next_val_l] 3093 ; dh = [next_val_r] 3094 00001814 E883060000 call interpolating_5_8bit_stereo 3095 00001819 E3AC jecxz lff11s_3 3096 lff11s_2_2: 3097 0000181B 66AD lodsw 3098 ; 02/02/2025 3099 0000181D 668B16 mov dx, [esi] 3100 00001820 49 dec ecx 3101 00001821 7504 jnz short lff11s_2_3 3102 00001823 66BA8080 mov dx, 8080h 3103 lff11s_2_3: 3104 00001827 E85C070000 call interpolating_4_8bit_stereo 3105 0000182C E399 jecxz lff11s_3 3106 3107 0000182E 4D dec ebp 3108 0000182F 74D2 jz short lff11s_9 3109 3110 00001831 66AD lodsw 3111 ; 02/02/2025 3112 00001833 668B16 mov dx, [esi] 3113 00001836 49 dec ecx 3114 00001837 7504 jnz short lff11s_2_4 3115 00001839 66BA8080 mov dx, 8080h 3116 lff11s_2_4: 3117 0000183D E846070000 call interpolating_4_8bit_stereo 3118 00001842 E383 jecxz lff11s_3 3119 00001844 EBC2 jmp short lff11s_1 3120 3121 load_11khz_mono_16_bit: 3122 ; 02/02/2025 3123 ; 18/11/2023 3124 00001846 F605[D8240000]01 test byte [flags], ENDOFFILE ; have we already read the 3125 ; last of the file? 3126 0000184D 7402 jz short lff11m2_0 ; no 3127 0000184F F9 stc 3128 00001850 C3 retn 3129 3130 lff11m2_0: 3131 00001851 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 3132 ;mov edx, [loadsize] 3133 3134 ; esi = buffer address 3135 ;; edx = buffer size 3136 3137 ; load file into memory 3138 sys _read, [FileHandle], esi, [loadsize] 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00001856 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 0000185C 89F1 <1> mov ecx, %3 81 <1> %if %0 = 4 82 0000185E 8B15[15040000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00001864 B803000000 <1> mov eax, %1 87 <1> 88 00001869 CD40 <1> int 40h 3139 0000186B 724D jc short lff11m2_7 ; error ! 3140 3141 0000186D BF[00300000] mov edi, audio_buffer 3142 3143 00001872 D1E8 shr eax, 1 3144 00001874 7505 jnz short lff11m2_8 3145 00001876 E9B3F2FFFF jmp lff11_eof 3146 3147 lff11m2_8: 3148 0000187B 89C1 mov ecx, eax ; word count 3149 lff11m2_9: 3150 0000187D BD06000000 mov ebp, 6 ; interpolation (one step) loop count 3151 lff11m2_1: 3152 ; 5:4:4::5:4:4::5:4:4::5:4:4::5:4:4::5:4 ; 74/17 3153 00001882 66AD lodsw 3154 ; 02/02/2025 3155 00001884 668B16 mov dx, [esi] 3156 00001887 49 dec ecx 3157 00001888 7502 jnz short lff11m2_2_1 3158 0000188A 31D2 xor edx, edx 3159 lff11m2_2_1: 3160 ; ax = [previous_val] 3161 ; dx = [next_val] 3162 0000188C E864070000 call interpolating_5_16bit_mono 3163 00001891 E362 jecxz lff11m2_3 3164 lff11m2_2_2: 3165 00001893 66AD lodsw 3166 ; 02/02/2025 3167 00001895 668B16 mov dx, [esi] 3168 00001898 49 dec ecx 3169 00001899 7502 jnz short lff11m2_2_3 3170 0000189B 31D2 xor edx, edx 3171 lff11m2_2_3: 3172 0000189D E87D080000 call interpolating_4_16bit_mono 3173 000018A2 E351 jecxz lff11m2_3 3174 3175 000018A4 4D dec ebp 3176 000018A5 74D6 jz short lff11m2_9 3177 3178 000018A7 66AD lodsw 3179 ; 02/02/2025 3180 000018A9 668B16 mov dx, [esi] 3181 000018AC 49 dec ecx 3182 000018AD 7502 jnz short lff11m2_2_4 3183 000018AF 31D2 xor edx, edx 3184 lff11m2_2_4: 3185 000018B1 E869080000 call interpolating_4_16bit_mono 3186 000018B6 E33D jecxz lff11m2_3 3187 000018B8 EBC8 jmp short lff11m2_1 3188 3189 lff11m2_7: 3190 lff11s2_7: 3191 000018BA E978F2FFFF jmp lff11_5 ; error 3192 3193 load_11khz_stereo_16_bit: 3194 ; 17/01/2025 3195 ; 18/11/2023 3196 000018BF F605[D8240000]01 test byte [flags], ENDOFFILE ; have we already read the 3197 ; last of the file? 3198 000018C6 7402 jz short lff11s2_0 ; no 3199 000018C8 F9 stc 3200 000018C9 C3 retn 3201 3202 lff11s2_0: 3203 000018CA BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 3204 ;mov edx, [loadsize] 3205 3206 ; esi = buffer address 3207 ;; edx = buffer size 3208 3209 ; load file into memory 3210 sys _read, [FileHandle], esi, [loadsize] 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 000018CF 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 000018D5 89F1 <1> mov ecx, %3 81 <1> %if %0 = 4 82 000018D7 8B15[15040000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 000018DD B803000000 <1> mov eax, %1 87 <1> 88 000018E2 CD40 <1> int 40h 3211 000018E4 72D4 jc short lff11s2_7 ; error ! 3212 3213 000018E6 BF[00300000] mov edi, audio_buffer 3214 3215 000018EB C1E802 shr eax, 2 ; dword (left chan word + right chan word) 3216 000018EE 750A jnz short lff11s2_8 3217 000018F0 E939F2FFFF jmp lff11_eof 3218 3219 lff11m2_3: 3220 lff11s2_3: 3221 000018F5 E91CF2FFFF jmp lff11_3 ; padfill 3222 ; (put zeros in the remain words of the buffer) 3223 3224 lff11s2_8: 3225 000018FA 89C1 mov ecx, eax ; dword count 3226 lff11s2_9: 3227 000018FC BD06000000 mov ebp, 6 ; interpolation (one step) loop count 3228 lff11s2_1: 3229 ; 5:4:4::5:4:4::5:4:4::5:4:4::5:4:4::5:4 ; 74/17 3230 00001901 66AD lodsw 3231 00001903 89C3 mov ebx, eax 3232 00001905 66AD lodsw 3233 00001907 8B16 mov edx, [esi] 3234 ; 17/01/2025 3235 ;mov [next_val_l], edx 3236 ; 26/11/2023 3237 ;shr edx, 16 3238 ;mov [next_val_r], dx 3239 00001909 49 dec ecx 3240 0000190A 7502 jnz short lff11s2_2_1 3241 0000190C 31D2 xor edx, edx ; 0 3242 ;mov [next_val_l], dx 3243 ;mov [next_val_r], dx 3244 lff11s2_2_1: 3245 ; bx = [previous_val_l] 3246 ; ax = [previous_val_r] 3247 ; [next_val_l] 3248 ; dx = [next_val_r] 3249 ;;; 3250 ; 17/01/2025 (BugFix) 3251 0000190E 8915[D9210000] mov [next_val_l], edx 3252 ;;; 3253 00001914 E837070000 call interpolating_5_16bit_stereo 3254 00001919 E3DA jecxz lff11s2_3 3255 lff11s2_2_2: 3256 0000191B 66AD lodsw 3257 0000191D 89C3 mov ebx, eax 3258 0000191F 66AD lodsw 3259 00001921 8B16 mov edx, [esi] 3260 ; 17/01/2025 3261 ;mov [next_val_l], dx 3262 ; 26/11/2023 3263 ;shr edx, 16 3264 ;mov [next_val_r], dx 3265 00001923 49 dec ecx 3266 00001924 7502 jnz short lff11s2_2_3 3267 00001926 31D2 xor edx, edx ; 0 3268 ;mov [next_val_l], dx 3269 ;mov [next_val_r], dx 3270 lff11s2_2_3: 3271 ;;; 3272 ; 17/01/2025 (BugFix) 3273 00001928 8915[D9210000] mov [next_val_l], edx 3274 ;;; 3275 0000192E E825080000 call interpolating_4_16bit_stereo 3276 00001933 E3C0 jecxz lff11s2_3 3277 3278 00001935 4D dec ebp 3279 00001936 74C4 jz short lff11s2_9 3280 3281 00001938 66AD lodsw 3282 0000193A 89C3 mov ebx, eax 3283 0000193C 66AD lodsw 3284 0000193E 8B16 mov edx, [esi] 3285 ; 17/01/2025 3286 ;mov [next_val_l], dx 3287 ; 26/11/2023 3288 ;shr edx, 16 3289 ;mov [next_val_r], dx 3290 00001940 49 dec ecx 3291 00001941 7502 jnz short lff11s2_2_4 3292 00001943 31D2 xor edx, edx ; 0 3293 ;mov [next_val_l], dx 3294 ;mov [next_val_r], dx 3295 lff11s2_2_4: 3296 ;;; 3297 ; 17/01/2025 (BugFix) 3298 00001945 8915[D9210000] mov [next_val_l], edx 3299 ;;; 3300 0000194B E808080000 call interpolating_4_16bit_stereo 3301 00001950 E3A3 jecxz lff11s2_3 3302 00001952 EBAD jmp short lff11s2_1 3303 3304 ; ..................... 3305 3306 load_44khz_mono_8_bit: 3307 ; 02/02/2025 3308 ; 18/11/2023 3309 00001954 F605[D8240000]01 test byte [flags], ENDOFFILE ; have we already read the 3310 ; last of the file? 3311 0000195B 7402 jz short lff44m_0 ; no 3312 0000195D F9 stc 3313 0000195E C3 retn 3314 3315 lff44m_0: 3316 0000195F BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 3317 ;mov edx, [loadsize] 3318 3319 ; esi = buffer address 3320 ;; edx = buffer size 3321 3322 ; load file into memory 3323 sys _read, [FileHandle], esi, [loadsize] 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00001964 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 0000196A 89F1 <1> mov ecx, %3 81 <1> %if %0 = 4 82 0000196C 8B15[15040000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00001972 B803000000 <1> mov eax, %1 87 <1> 88 00001977 CD40 <1> int 40h 3324 00001979 7250 jc short lff44m_7 ; error ! 3325 3326 0000197B BF[00300000] mov edi, audio_buffer 3327 3328 00001980 21C0 and eax, eax 3329 00001982 7505 jnz short lff44m_8 3330 00001984 E9A5F1FFFF jmp lff44_eof 3331 3332 lff44m_8: 3333 00001989 89C1 mov ecx, eax ; byte count 3334 lff44m_9: 3335 0000198B BD0A000000 mov ebp, 10 ; interpolation (one step) loop count 3336 00001990 C605[DD210000]02 mov byte [faz], 2 ; 2 steps/phases 3337 lff44m_1: 3338 ; 2:1:1:1:1:1:1:1:1:1:1:: ; 25/23 3339 ; 2:1:1:1:1:1:1:1:1:1:1:1 3340 00001997 AC lodsb 3341 ; 02/02/2025 3342 00001998 8A16 mov dl, [esi] 3343 0000199A 49 dec ecx 3344 0000199B 7502 jnz short lff44m_2_1 3345 0000199D B280 mov dl, 80h 3346 lff44m_2_1: 3347 ; al = [previous_val] 3348 ; dl = [next_val] 3349 0000199F E871030000 call interpolating_2_8bit_mono 3350 000019A4 E320 jecxz lff44m_3 3351 lff44m_2_2: 3352 000019A6 AC lodsb 3353 000019A7 2C80 sub al, 80h 3354 000019A9 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3355 000019AD 66AB stosw ; (L) 3356 000019AF 66AB stosw ; (R) 3357 3358 000019B1 49 dec ecx 3359 000019B2 7412 jz short lff44m_3 3360 000019B4 4D dec ebp 3361 000019B5 75EF jnz short lff44m_2_2 3362 3363 000019B7 FE0D[DD210000] dec byte [faz] 3364 000019BD 74CC jz short lff44m_9 3365 000019BF BD0B000000 mov ebp, 11 3366 000019C4 EBD1 jmp short lff44m_1 3367 3368 lff44m_3: 3369 lff44s_3: 3370 000019C6 E94BF1FFFF jmp lff44_3 ; padfill 3371 ; (put zeros in the remain words of the buffer) 3372 lff44m_7: 3373 lff44s_7: 3374 000019CB E967F1FFFF jmp lff44_5 ; error 3375 3376 load_44khz_stereo_8_bit: 3377 ; 02/02/2025 3378 ; 16/11/2023 3379 000019D0 F605[D8240000]01 test byte [flags], ENDOFFILE ; have we already read the 3380 ; last of the file? 3381 000019D7 7402 jz short lff44s_0 ; no 3382 000019D9 F9 stc 3383 000019DA C3 retn 3384 3385 lff44s_0: 3386 000019DB BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 3387 ;mov edx, [loadsize] 3388 3389 ; esi = buffer address 3390 ;; edx = buffer size 3391 3392 ; load file into memory 3393 sys _read, [FileHandle], esi, [loadsize] 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 000019E0 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 000019E6 89F1 <1> mov ecx, %3 81 <1> %if %0 = 4 82 000019E8 8B15[15040000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 000019EE B803000000 <1> mov eax, %1 87 <1> 88 000019F3 CD40 <1> int 40h 3394 000019F5 72D4 jc short lff44s_7 ; error ! 3395 3396 000019F7 BF[00300000] mov edi, audio_buffer 3397 3398 000019FC D1E8 shr eax, 1 3399 000019FE 7505 jnz short lff44s_8 3400 00001A00 E929F1FFFF jmp lff44_eof 3401 3402 lff44s_8: 3403 00001A05 89C1 mov ecx, eax ; word count 3404 lff44s_9: 3405 00001A07 BD0A000000 mov ebp, 10 ; interpolation (one step) loop count 3406 00001A0C C605[DD210000]02 mov byte [faz], 2 ; 2 steps/phase 3407 lff44s_1: 3408 ; 2:1:1:1:1:1:1:1:1:1:1:: ; 25/23 3409 ; 2:1:1:1:1:1:1:1:1:1:1:1 3410 00001A13 66AD lodsw 3411 ; 02/02/2025 3412 00001A15 668B16 mov dx, [esi] 3413 00001A18 49 dec ecx 3414 00001A19 7504 jnz short lff44s_2_1 3415 00001A1B 66BA8080 mov dx, 8080h 3416 lff44s_2_1: 3417 ; al = [previous_val_l] 3418 ; ah = [previous_val_r] 3419 ; dl = [next_val_l] 3420 ; dh = [next_val_r] 3421 00001A1F E80E030000 call interpolating_2_8bit_stereo 3422 00001A24 E3A0 jecxz lff44s_3 3423 lff44s_2_2: 3424 00001A26 AC lodsb 3425 00001A27 2C80 sub al, 80h 3426 00001A29 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3427 00001A2D 66AB stosw ; (L) 3428 00001A2F AC lodsb 3429 00001A30 2C80 sub al, 80h 3430 00001A32 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3431 00001A36 66AB stosw ; (R) 3432 3433 00001A38 49 dec ecx 3434 00001A39 748B jz short lff44s_3 3435 00001A3B 4D dec ebp 3436 00001A3C 75E8 jnz short lff44s_2_2 3437 3438 00001A3E FE0D[DD210000] dec byte [faz] 3439 00001A44 74C1 jz short lff44s_9 3440 00001A46 BD0B000000 mov ebp, 11 3441 00001A4B EBC6 jmp short lff44s_1 3442 3443 load_44khz_mono_16_bit: 3444 ; 02/02/2025 3445 ; 18/11/2023 3446 00001A4D F605[D8240000]01 test byte [flags], ENDOFFILE ; have we already read the 3447 ; last of the file? 3448 00001A54 7402 jz short lff44m2_0 ; no 3449 00001A56 F9 stc 3450 00001A57 C3 retn 3451 3452 lff44m2_0: 3453 00001A58 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 3454 ;mov edx, [loadsize] 3455 3456 ; esi = buffer address 3457 ;; edx = buffer size 3458 3459 ; load file into memory 3460 sys _read, [FileHandle], esi, [loadsize] 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00001A5D 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 00001A63 89F1 <1> mov ecx, %3 81 <1> %if %0 = 4 82 00001A65 8B15[15040000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00001A6B B803000000 <1> mov eax, %1 87 <1> 88 00001A70 CD40 <1> int 40h 3461 00001A72 724D jc short lff44m2_7 ; error ! 3462 3463 00001A74 BF[00300000] mov edi, audio_buffer 3464 3465 00001A79 D1E8 shr eax, 1 3466 00001A7B 7505 jnz short lff44m2_8 3467 00001A7D E9ACF0FFFF jmp lff44_eof 3468 3469 lff44m2_8: 3470 00001A82 89C1 mov ecx, eax ; word count 3471 lff44m2_9: 3472 00001A84 BD0A000000 mov ebp, 10 ; interpolation (one step) loop count 3473 00001A89 C605[DD210000]02 mov byte [faz], 2 ; 2 steps/phases 3474 lff44m2_1: 3475 ; 2:1:1:1:1:1:1:1:1:1:1:: ; 25/23 3476 ; 2:1:1:1:1:1:1:1:1:1:1:1 3477 00001A90 66AD lodsw 3478 ; 02/02/2025 3479 00001A92 668B16 mov dx, [esi] 3480 00001A95 49 dec ecx 3481 00001A96 7502 jnz short lff44m2_2_1 3482 00001A98 31D2 xor edx, edx 3483 lff44m2_2_1: 3484 ; ax = [previous_val] 3485 ; dx = [next_val] 3486 00001A9A E857030000 call interpolating_2_16bit_mono 3487 00001A9F E31B jecxz lff44m2_3 3488 lff44m2_2_2: 3489 00001AA1 66AD lodsw 3490 00001AA3 66AB stosw ; (L)eft Channel 3491 00001AA5 66AB stosw ; (R)ight Channel 3492 3493 00001AA7 49 dec ecx 3494 00001AA8 7412 jz short lff44m2_3 3495 00001AAA 4D dec ebp 3496 00001AAB 75F4 jnz short lff44m2_2_2 3497 3498 00001AAD FE0D[DD210000] dec byte [faz] 3499 00001AB3 74CF jz short lff44m2_9 3500 00001AB5 BD0B000000 mov ebp, 11 3501 00001ABA EBD4 jmp short lff44m2_1 3502 3503 lff44m2_3: 3504 lff44s2_3: 3505 00001ABC E955F0FFFF jmp lff44_3 ; padfill 3506 ; (put zeros in the remain words of the buffer) 3507 lff44m2_7: 3508 lff44s2_7: 3509 00001AC1 E971F0FFFF jmp lff44_5 ; error 3510 3511 load_44khz_stereo_16_bit: 3512 ; 18/11/2023 3513 00001AC6 F605[D8240000]01 test byte [flags], ENDOFFILE ; have we already read the 3514 ; last of the file? 3515 00001ACD 7402 jz short lff44s2_0 ; no 3516 00001ACF F9 stc 3517 00001AD0 C3 retn 3518 3519 lff44s2_0: 3520 00001AD1 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 3521 ;mov edx, [loadsize] 3522 3523 ; esi = buffer address 3524 ;; edx = buffer size 3525 3526 ; load file into memory 3527 sys _read, [FileHandle], esi, [loadsize] 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00001AD6 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 00001ADC 89F1 <1> mov ecx, %3 81 <1> %if %0 = 4 82 00001ADE 8B15[15040000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00001AE4 B803000000 <1> mov eax, %1 87 <1> 88 00001AE9 CD40 <1> int 40h 3528 00001AEB 72D4 jc short lff44s2_7 ; error ! 3529 3530 00001AED BF[00300000] mov edi, audio_buffer 3531 3532 00001AF2 C1E802 shr eax, 2 ; dword (left chan word + right chan word) 3533 00001AF5 7505 jnz short lff44s2_8 3534 00001AF7 E932F0FFFF jmp lff44_eof 3535 3536 lff44s2_8: 3537 00001AFC 89C1 mov ecx, eax ; dword count 3538 lff44s2_9: 3539 00001AFE BD0A000000 mov ebp, 10 ; interpolation (one step) loop count 3540 00001B03 C605[DD210000]02 mov byte [faz], 2 ; 2 steps/phase 3541 lff44s2_1: 3542 ; 2:1:1:1:1:1:1:1:1:1:1:: ; 25/23 3543 ; 2:1:1:1:1:1:1:1:1:1:1:1 3544 00001B0A 66AD lodsw 3545 00001B0C 89C3 mov ebx, eax 3546 00001B0E 66AD lodsw 3547 ;mov dx, [esi] 3548 ;mov [next_val_l], dx 3549 ;mov dx, [esi+2] 3550 ; 26/11/2023 3551 00001B10 8B16 mov edx, [esi] 3552 00001B12 668915[D9210000] mov [next_val_l], dx 3553 00001B19 C1EA10 shr edx, 16 3554 00001B1C 49 dec ecx 3555 00001B1D 7509 jnz short lff44s2_2_1 3556 00001B1F 31D2 xor edx, edx ; 0 3557 00001B21 668915[D9210000] mov [next_val_l], dx 3558 lff44s2_2_1: 3559 ; bx = [previous_val_l] 3560 ; ax = [previous_val_r] 3561 ; [next_val_l] 3562 ; dx = [next_val_r] 3563 00001B28 E8E1020000 call interpolating_2_16bit_stereo 3564 00001B2D E38D jecxz lff44s2_3 3565 lff44s2_2_2: 3566 ;movsw ; (L)eft Channel 3567 ;movsw ; (R)ight Channel 3568 00001B2F A5 movsd 3569 3570 00001B30 49 dec ecx 3571 00001B31 7489 jz short lff44s2_3 3572 00001B33 4D dec ebp 3573 00001B34 75F9 jnz short lff44s2_2_2 3574 3575 00001B36 FE0D[DD210000] dec byte [faz] 3576 00001B3C 74C0 jz short lff44s2_9 3577 00001B3E BD0B000000 mov ebp, 11 3578 00001B43 EBC5 jmp short lff44s2_1 3579 3580 ; ..................... 3581 3582 ; 02/02/2025 3583 load_12khz_mono_8_bit: 3584 00001B45 F605[D8240000]01 test byte [flags], ENDOFFILE ; have we already read the 3585 ; last of the file? 3586 00001B4C 7402 jz short lff12m_0 ; no 3587 00001B4E F9 stc 3588 00001B4F C3 retn 3589 3590 lff12m_0: 3591 00001B50 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 3592 3593 ; load file into memory 3594 sys _read, [FileHandle], esi, [loadsize] 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00001B55 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 00001B5B 89F1 <1> mov ecx, %3 81 <1> %if %0 = 4 82 00001B5D 8B15[15040000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00001B63 B803000000 <1> mov eax, %1 87 <1> 88 00001B68 CD40 <1> int 40h 3595 00001B6A 7256 jc short lff12m_7 ; error ! 3596 3597 00001B6C BF[00300000] mov edi, audio_buffer 3598 3599 00001B71 21C0 and eax, eax 3600 00001B73 7505 jnz short lff12m_8 3601 00001B75 E9B4EFFFFF jmp lff12_eof 3602 3603 lff12m_8: 3604 00001B7A 89C1 mov ecx, eax ; byte count 3605 lff12m_1: 3606 ; original-interpolated-interpolated-interpolated 3607 00001B7C AC lodsb 3608 ; 02/02/2025 3609 00001B7D 8A16 mov dl, [esi] 3610 00001B7F 49 dec ecx 3611 00001B80 7502 jnz short lff12m_2 3612 00001B82 B280 mov dl, 80h 3613 lff12m_2: 3614 ; al = [previous_val] 3615 ; dl = [next_val] 3616 00001B84 E8C0030000 call interpolating_4_8bit_mono 3617 00001B89 E353 jecxz lff12m_3 3618 00001B8B EBEF jmp short lff12m_1 3619 3620 ; 02/02/2025 3621 load_12khz_stereo_8_bit: 3622 00001B8D F605[D8240000]01 test byte [flags], ENDOFFILE ; have we already read the 3623 ; last of the file? 3624 00001B94 7402 jz short lff12s_0 ; no 3625 00001B96 F9 stc 3626 00001B97 C3 retn 3627 3628 lff12s_0: 3629 00001B98 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 3630 3631 ; load file into memory 3632 sys _read, [FileHandle], esi, [loadsize] 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00001B9D 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 00001BA3 89F1 <1> mov ecx, %3 81 <1> %if %0 = 4 82 00001BA5 8B15[15040000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00001BAB B803000000 <1> mov eax, %1 87 <1> 88 00001BB0 CD40 <1> int 40h 3633 00001BB2 720E jc short lff12s_7 ; error ! 3634 3635 00001BB4 BF[00300000] mov edi, audio_buffer 3636 3637 00001BB9 D1E8 shr eax, 1 3638 00001BBB 750A jnz short lff12s_8 3639 00001BBD E96CEFFFFF jmp lff12_eof 3640 3641 lff12m_7: 3642 lff12s_7: 3643 00001BC2 E970EFFFFF jmp lff12_5 ; error 3644 3645 lff12s_8: 3646 00001BC7 89C1 mov ecx, eax ; word count 3647 lff12s_1: 3648 ; original-interpolated-interpolated-interpolated 3649 00001BC9 66AD lodsw 3650 ; 02/02/2025 3651 00001BCB 668B16 mov dx, [esi] 3652 00001BCE 49 dec ecx 3653 00001BCF 7504 jnz short lff12s_2 3654 00001BD1 66BA8080 mov dx, 8080h 3655 lff12s_2: 3656 ; al = [previous_val_l] 3657 ; ah = [previous_val_r] 3658 ; dl = [next_val_l] 3659 ; dh = [next_val_r] 3660 00001BD5 E8AE030000 call interpolating_4_8bit_stereo 3661 00001BDA E302 jecxz lff12s_3 3662 00001BDC EBEB jmp short lff12s_1 3663 3664 lff12m_3: 3665 lff12s_3: 3666 00001BDE E933EFFFFF jmp lff12_3 ; padfill 3667 ; (put zeros in the remain words of the buffer) 3668 3669 ; 02/02/2025 3670 load_12khz_mono_16_bit: 3671 00001BE3 F605[D8240000]01 test byte [flags], ENDOFFILE ; have we already read the 3672 ; last of the file? 3673 00001BEA 7402 jz short lff12m2_0 ; no 3674 00001BEC F9 stc 3675 00001BED C3 retn 3676 3677 lff12m2_0: 3678 00001BEE BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 3679 3680 ; load file into memory 3681 sys _read, [FileHandle], esi, [loadsize] 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00001BF3 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 00001BF9 89F1 <1> mov ecx, %3 81 <1> %if %0 = 4 82 00001BFB 8B15[15040000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00001C01 B803000000 <1> mov eax, %1 87 <1> 88 00001C06 CD40 <1> int 40h 3682 00001C08 7223 jc short lff12m2_7 ; error ! 3683 3684 00001C0A BF[00300000] mov edi, audio_buffer 3685 3686 00001C0F D1E8 shr eax, 1 3687 00001C11 7505 jnz short lff12m2_8 3688 00001C13 E916EFFFFF jmp lff12_eof 3689 3690 lff12m2_8: 3691 00001C18 89C1 mov ecx, eax ; word count 3692 lff12m2_1: 3693 ; original-interpolated-interpolated-interpolated 3694 00001C1A 66AD lodsw 3695 ; 02/02/2025 3696 00001C1C 668B16 mov dx, [esi] 3697 00001C1F 49 dec ecx 3698 00001C20 7502 jnz short lff12m2_2 3699 00001C22 31D2 xor edx, edx 3700 lff12m2_2: 3701 ; ax = [previous_val] 3702 ; dx = [next_val] 3703 00001C24 E8F6040000 call interpolating_4_16bit_mono 3704 00001C29 E3B3 jecxz lff12m_3 3705 00001C2B EBED jmp short lff12m2_1 3706 3707 lff12m2_7: 3708 lff12s2_7: 3709 00001C2D E905EFFFFF jmp lff12_5 ; error 3710 3711 ; 02/02/2025 3712 load_12khz_stereo_16_bit: 3713 00001C32 F605[D8240000]01 test byte [flags], ENDOFFILE ; have we already read the 3714 ; last of the file? 3715 00001C39 7402 jz short lff12s2_0 ; no 3716 00001C3B F9 stc 3717 00001C3C C3 retn 3718 3719 lff12s2_0: 3720 00001C3D BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 3721 3722 ; load file into memory 3723 sys _read, [FileHandle], esi, [loadsize] 73 <1> 74 <1> 75 <1> 76 <1> 77 <1> %if %0 >= 2 78 00001C42 8B1D[DE210000] <1> mov ebx, %2 79 <1> %if %0 >= 3 80 00001C48 89F1 <1> mov ecx, %3 81 <1> %if %0 = 4 82 00001C4A 8B15[15040000] <1> mov edx, %4 83 <1> %endif 84 <1> %endif 85 <1> %endif 86 00001C50 B803000000 <1> mov eax, %1 87 <1> 88 00001C55 CD40 <1> int 40h 3724 00001C57 72D4 jc short lff12s2_7 ; error ! 3725 3726 00001C59 BF[00300000] mov edi, audio_buffer 3727 3728 00001C5E C1E802 shr eax, 2 ; dword (left chan word + right chan word) 3729 00001C61 750A jnz short lff12s2_8 3730 00001C63 E9C6EEFFFF jmp lff12_eof 3731 3732 lff12m2_3: 3733 lff12s2_3: 3734 00001C68 E9A9EEFFFF jmp lff12_3 ; padfill 3735 ; (put zeros in the remain words of the buffer) 3736 3737 lff12s2_8: 3738 00001C6D 89C1 mov ecx, eax ; dword count 3739 lff12s2_1: 3740 ; original-interpolated-interpolated-interpolated 3741 00001C6F 66AD lodsw 3742 00001C71 89C3 mov ebx, eax 3743 00001C73 66AD lodsw 3744 00001C75 8B16 mov edx, [esi] 3745 00001C77 49 dec ecx 3746 00001C78 7502 jnz short lff12s2_2 3747 00001C7A 31D2 xor edx, edx ; 0 3748 lff12s2_2: 3749 ;mov [next_val_l], dx 3750 ;shr edx, 16 3751 ;mov [next_val_r], dx 3752 ; 02/02/2025 3753 00001C7C 8915[D9210000] mov [next_val_l], edx 3754 3755 ; bx = [previous_val_l] 3756 ; ax = [previous_val_r] 3757 ; [next_val_l] 3758 ; [next_val_r] 3759 00001C82 E8D1040000 call interpolating_4_16bit_stereo 3760 00001C87 E3DF jecxz lff12s2_3 3761 00001C89 EBE4 jmp short lff12s2_1 3762 3763 ; ..................... 3764 3765 interpolating_3_8bit_mono: 3766 ; 02/02/2025 3767 ; 16/11/2023 3768 ; al = [previous_val] 3769 ; dl = [next_val] 3770 ; original-interpolated-interpolated 3771 00001C8B 88C3 mov bl, al 3772 00001C8D 2C80 sub al, 80h 3773 00001C8F 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3774 00001C93 66AB stosw ; original sample (L) 3775 00001C95 66AB stosw ; original sample (R) 3776 00001C97 88D8 mov al, bl 3777 00001C99 00D0 add al, dl 3778 00001C9B D0D8 rcr al, 1 3779 00001C9D 88C7 mov bh, al ; interpolated middle (temporary) 3780 00001C9F 00D8 add al, bl 3781 00001CA1 D0D8 rcr al, 1 3782 00001CA3 2C80 sub al, 80h 3783 00001CA5 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3784 00001CA9 66AB stosw ; interpolated sample 1 (L) 3785 00001CAB 66AB stosw ; interpolated sample 1 (R) 3786 00001CAD 88F8 mov al, bh 3787 00001CAF 00D0 add al, dl ; [next_val] 3788 00001CB1 D0D8 rcr al, 1 3789 ; 02/02/2025 3790 00001CB3 2C80 sub al, 80h 3791 00001CB5 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3792 00001CB9 66AB stosw ; interpolated sample 2 (L) 3793 00001CBB 66AB stosw ; interpolated sample 2 (R) 3794 00001CBD C3 retn 3795 3796 interpolating_3_8bit_stereo: 3797 ; 02/02/2025 3798 ; 16/11/2023 3799 ; al = [previous_val_l] 3800 ; ah = [previous_val_r] 3801 ; dl = [next_val_l] 3802 ; dh = [next_val_r] 3803 ; original-interpolated-interpolated 3804 00001CBE 89C3 mov ebx, eax 3805 00001CC0 2C80 sub al, 80h 3806 00001CC2 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3807 00001CC6 66AB stosw ; original sample (L) 3808 00001CC8 88F8 mov al, bh 3809 00001CCA 2C80 sub al, 80h 3810 00001CCC 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3811 00001CD0 66AB stosw ; original sample (R) 3812 00001CD2 88D8 mov al, bl 3813 00001CD4 00D0 add al, dl ; [next_val_l] 3814 00001CD6 D0D8 rcr al, 1 3815 00001CD8 50 push eax ; * ; al = interpolated middle (L) (temporary) 3816 00001CD9 00D8 add al, bl ; [previous_val_l] 3817 00001CDB D0D8 rcr al, 1 3818 00001CDD 2C80 sub al, 80h 3819 00001CDF 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3820 00001CE3 66AB stosw ; interpolated sample 1 (L) 3821 00001CE5 88F8 mov al, bh 3822 00001CE7 00F0 add al, dh ; [next_val_r] 3823 00001CE9 D0D8 rcr al, 1 3824 00001CEB 50 push eax ; ** ; al = interpolated middle (R) (temporary) 3825 00001CEC 00F8 add al, bh ; [previous_val_r] 3826 00001CEE D0D8 rcr al, 1 3827 00001CF0 2C80 sub al, 80h 3828 00001CF2 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3829 00001CF6 66AB stosw ; interpolated sample 1 (R) 3830 00001CF8 5B pop ebx ; ** 3831 00001CF9 58 pop eax ; * 3832 00001CFA 00D0 add al, dl ; [next_val_l] 3833 00001CFC D0D8 rcr al, 1 3834 ; 02/02/2025 3835 00001CFE 2C80 sub al, 80h 3836 00001D00 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3837 00001D04 66AB stosw ; interpolated sample 2 (L) 3838 00001D06 88D8 mov al, bl 3839 00001D08 00F0 add al, dh ; [next_val_r] 3840 00001D0A D0D8 rcr al, 1 3841 ; 02/02/2025 3842 00001D0C 2C80 sub al, 80h 3843 00001D0E 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3844 00001D12 66AB stosw ; interpolated sample 2 (R) 3845 00001D14 C3 retn 3846 3847 interpolating_2_8bit_mono: 3848 ; 16/11/2023 3849 ; al = [previous_val] 3850 ; dl = [next_val] 3851 ; original-interpolated 3852 00001D15 88C3 mov bl, al 3853 00001D17 2C80 sub al, 80h 3854 00001D19 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3855 00001D1D 66AB stosw ; original sample (L) 3856 00001D1F 66AB stosw ; original sample (R) 3857 00001D21 88D8 mov al, bl 3858 00001D23 00D0 add al, dl 3859 00001D25 D0D8 rcr al, 1 3860 00001D27 2C80 sub al, 80h 3861 00001D29 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3862 00001D2D 66AB stosw ; interpolated sample (L) 3863 00001D2F 66AB stosw ; interpolated sample (R) 3864 00001D31 C3 retn 3865 3866 interpolating_2_8bit_stereo: 3867 ; 16/11/2023 3868 ; al = [previous_val_l] 3869 ; ah = [previous_val_r] 3870 ; dl = [next_val_l] 3871 ; dh = [next_val_r] 3872 ; original-interpolated 3873 00001D32 89C3 mov ebx, eax 3874 00001D34 2C80 sub al, 80h 3875 00001D36 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3876 00001D3A 66AB stosw ; original sample (L) 3877 00001D3C 88F8 mov al, bh 3878 00001D3E 2C80 sub al, 80h 3879 00001D40 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3880 00001D44 66AB stosw ; original sample (R) 3881 00001D46 88D8 mov al, bl ; [previous_val_l] 3882 00001D48 00D0 add al, dl ; [next_val_l] 3883 00001D4A D0D8 rcr al, 1 3884 00001D4C 2C80 sub al, 80h 3885 00001D4E 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3886 00001D52 66AB stosw ; interpolated sample (L) 3887 00001D54 88F8 mov al, bh 3888 00001D56 00F0 add al, dh ; [next_val_r] 3889 00001D58 D0D8 rcr al, 1 3890 00001D5A 2C80 sub al, 80h 3891 00001D5C 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3892 00001D60 66AB stosw ; interpolated sample (R) 3893 00001D62 C3 retn 3894 3895 interpolating_3_16bit_mono: 3896 ; 16/11/2023 3897 ; ax = [previous_val] 3898 ; dx = [next_val] 3899 ; original-interpolated-interpolated 3900 3901 00001D63 66AB stosw ; original sample (L) 3902 00001D65 66AB stosw ; original sample (R) 3903 00001D67 80C480 add ah, 80h ; convert sound level 0 to 65535 format 3904 00001D6A 50 push eax ; * ; [previous_val] 3905 00001D6B 80C680 add dh, 80h 3906 00001D6E 6601D0 add ax, dx 3907 00001D71 66D1D8 rcr ax, 1 3908 00001D74 5B pop ebx ; * 3909 00001D75 93 xchg ebx, eax ; bx = interpolated middle (temporary) 3910 00001D76 6601D8 add ax, bx ; [previous_val] + interpolated middle 3911 00001D79 66D1D8 rcr ax, 1 3912 00001D7C 80EC80 sub ah, 80h ; -32768 to +32767 format again 3913 00001D7F 66AB stosw ; interpolated sample 1 (L) 3914 00001D81 66AB stosw ; interpolated sample 1 (R) 3915 00001D83 89D8 mov eax, ebx 3916 00001D85 6601D0 add ax, dx ; interpolated middle + [next_val] 3917 00001D88 66D1D8 rcr ax, 1 3918 00001D8B 80EC80 sub ah, 80h ; -32768 to +32767 format again 3919 00001D8E 66AB stosw ; interpolated sample 2 (L) 3920 00001D90 66AB stosw ; interpolated sample 2 (R) 3921 00001D92 C3 retn 3922 3923 interpolating_3_16bit_stereo: 3924 ; 16/11/2023 3925 ; bx = [previous_val_l] 3926 ; ax = [previous_val_r] 3927 ; [next_val_l] 3928 ; dx = [next_val_r] 3929 ; original-interpolated-interpolated 3930 3931 00001D93 93 xchg eax, ebx 3932 00001D94 66AB stosw ; original sample (L) 3933 00001D96 93 xchg eax, ebx 3934 00001D97 66AB stosw ; original sample (R) 3935 00001D99 80C480 add ah, 80h ; convert sound level 0 to 65535 format 3936 00001D9C 50 push eax ; * ; [previous_val_r] 3937 00001D9D 80C780 add bh, 80h 3938 00001DA0 8005[DA210000]80 add byte [next_val_l+1], 80h 3939 00001DA7 66A1[D9210000] mov ax, [next_val_l] 3940 00001DAD 6601D8 add ax, bx ; [previous_val_l] 3941 00001DB0 66D1D8 rcr ax, 1 3942 00001DB3 93 xchg eax, ebx ; ax = [previous_val_l] 3943 00001DB4 6601D8 add ax, bx ; bx = interpolated middle (L) 3944 00001DB7 66D1D8 rcr ax, 1 3945 00001DBA 80EC80 sub ah, 80h ; -32768 to +32767 format again 3946 00001DBD 66AB stosw ; interpolated sample 1 (L) 3947 00001DBF 58 pop eax ; * 3948 00001DC0 80C680 add dh, 80h ; convert sound level 0 to 65535 format 3949 00001DC3 52 push edx ; * ; [next_val_r] 3950 00001DC4 92 xchg eax, edx 3951 00001DC5 6601D0 add ax, dx ; [next_val_r] + [previous_val_r] 3952 00001DC8 66D1D8 rcr ax, 1 ; / 2 3953 00001DCB 50 push eax ; ** ; interpolated middle (R) 3954 00001DCC 6601D0 add ax, dx ; + [previous_val_r] 3955 00001DCF 66D1D8 rcr ax, 1 3956 00001DD2 80EC80 sub ah, 80h ; -32768 to +32767 format again 3957 00001DD5 66AB stosw ; interpolated sample 1 (R) 3958 00001DD7 66A1[D9210000] mov ax, [next_val_l] 3959 00001DDD 6601D8 add ax, bx ; + interpolated middle (L) 3960 00001DE0 66D1D8 rcr ax, 1 3961 00001DE3 80EC80 sub ah, 80h ; -32768 to +32767 format again 3962 00001DE6 66AB stosw ; interpolated sample 2 (L) 3963 00001DE8 58 pop eax ; ** 3964 00001DE9 5A pop edx ; * 3965 00001DEA 6601D0 add ax, dx ; interpolated middle + [next_val_r] 3966 00001DED 66D1D8 rcr ax, 1 ; / 2 3967 00001DF0 80EC80 sub ah, 80h ; -32768 to +32767 format again 3968 00001DF3 66AB stosw ; interpolated sample 2 (L) 3969 00001DF5 C3 retn 3970 3971 interpolating_2_16bit_mono: 3972 ; 16/11/2023 3973 ; ax = [previous_val] 3974 ; dx = [next_val] 3975 ; original-interpolated 3976 3977 00001DF6 66AB stosw ; original sample (L) 3978 00001DF8 66AB stosw ; original sample (R) 3979 00001DFA 80C480 add ah, 80h ; convert sound level 0 to 65535 format 3980 00001DFD 80C680 add dh, 80h 3981 00001E00 6601D0 add ax, dx 3982 00001E03 66D1D8 rcr ax, 1 3983 00001E06 80EC80 sub ah, 80h ; -32768 to +32767 format again 3984 00001E09 66AB stosw ; interpolated sample (L) 3985 00001E0B 66AB stosw ; interpolated sample (R) 3986 00001E0D C3 retn 3987 3988 interpolating_2_16bit_stereo: 3989 ; 17/01/2025 3990 ; 16/11/2023 3991 ; bx = [previous_val_l] 3992 ; ax = [previous_val_r] 3993 ; [next_val_l] 3994 ; dx = [next_val_r] 3995 ; original-interpolated 3996 3997 00001E0E 93 xchg eax, ebx 3998 00001E0F 66AB stosw ; original sample (L) 3999 00001E11 93 xchg eax, ebx 4000 00001E12 66AB stosw ; original sample (R) 4001 00001E14 80C480 add ah, 80h ; convert sound level 0 to 65535 format 4002 00001E17 80C680 add dh, 80h 4003 00001E1A 6601D0 add ax, dx ; [previous_val_r] + [next_val_r] 4004 00001E1D 66D1D8 rcr ax, 1 ; / 2 4005 ; 17/01/2025 4006 00001E20 80EC80 sub ah, 80h ; -32768 to +32767 format again 4007 ;push eax ; * ; interpolated sample (R) 4008 ; 17/01/2025 4009 00001E23 C1E010 shl eax, 16 4010 00001E26 66A1[D9210000] mov ax, [next_val_l] 4011 00001E2C 80C480 add ah, 80h 4012 00001E2F 80C780 add bh, 80h 4013 00001E32 6601D8 add ax, bx ; [next_val_l] + [previous_val_l] 4014 00001E35 66D1D8 rcr ax, 1 ; / 2 4015 00001E38 80EC80 sub ah, 80h ; -32768 to +32767 format again 4016 ; 17/01/2025 4017 ;stosw ; interpolated sample (L) 4018 ;pop eax ; * 4019 ;sub ah, 80h ; -32768 to +32767 format again 4020 ;stosw ; interpolated sample (R) 4021 ; 17/01/2025 4022 00001E3B AB stosd 4023 00001E3C C3 retn 4024 4025 interpolating_5_8bit_mono: 4026 ; 17/11/2023 4027 ; al = [previous_val] 4028 ; dl = [next_val] 4029 ; original-interpltd-interpltd-interpltd-interpltd 4030 00001E3D 88C3 mov bl, al 4031 00001E3F 2C80 sub al, 80h 4032 00001E41 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4033 00001E45 66AB stosw ; original sample (L) 4034 00001E47 66AB stosw ; original sample (R) 4035 00001E49 88D8 mov al, bl 4036 00001E4B 00D0 add al, dl 4037 00001E4D D0D8 rcr al, 1 4038 00001E4F 88C7 mov bh, al ; interpolated middle (temporary) 4039 00001E51 00D8 add al, bl ; [previous_val] 4040 00001E53 D0D8 rcr al, 1 4041 00001E55 88C6 mov dh, al ; interpolated 1st quarter (temporary) 4042 00001E57 00D8 add al, bl 4043 00001E59 D0D8 rcr al, 1 4044 00001E5B 2C80 sub al, 80h 4045 00001E5D 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4046 00001E61 66AB stosw ; interpolated sample 1 (L) 4047 00001E63 66AB stosw ; interpolated sample 1 (R) 4048 00001E65 88F8 mov al, bh 4049 00001E67 00F0 add al, dh 4050 00001E69 D0D8 rcr al, 1 4051 00001E6B 2C80 sub al, 80h 4052 00001E6D 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4053 00001E71 66AB stosw ; interpolated sample 2 (L) 4054 00001E73 66AB stosw ; interpolated sample 2 (R) 4055 00001E75 88F8 mov al, bh 4056 00001E77 00D0 add al, dl ; [next_val] 4057 00001E79 D0D8 rcr al, 1 4058 00001E7B 88C6 mov dh, al ; interpolated 3rd quarter (temporary) 4059 00001E7D 00F8 add al, bh 4060 00001E7F D0D8 rcr al, 1 4061 00001E81 2C80 sub al, 80h 4062 00001E83 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4063 00001E87 66AB stosw ; interpolated sample 3 (L) 4064 00001E89 66AB stosw ; interpolated sample 3 (R) 4065 00001E8B 88F0 mov al, dh 4066 00001E8D 00D0 add al, dl 4067 00001E8F D0D8 rcr al, 1 4068 00001E91 2C80 sub al, 80h 4069 00001E93 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4070 00001E97 66AB stosw ; interpolated sample 4 (L) 4071 00001E99 66AB stosw ; interpolated sample 4 (R) 4072 00001E9B C3 retn 4073 4074 interpolating_5_8bit_stereo: 4075 ; 17/11/2023 4076 ; al = [previous_val_l] 4077 ; ah = [previous_val_r] 4078 ; dl = [next_val_l] 4079 ; dh = [next_val_r] 4080 ; original-interpltd-interpltd-interpltd-interpltd 4081 00001E9C 89C3 mov ebx, eax 4082 00001E9E 2C80 sub al, 80h 4083 00001EA0 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4084 00001EA4 66AB stosw ; original sample (L) 4085 00001EA6 88F8 mov al, bh 4086 00001EA8 2C80 sub al, 80h 4087 00001EAA 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4088 00001EAE 66AB stosw ; original sample (R) 4089 00001EB0 52 push edx ; * 4090 00001EB1 88D8 mov al, bl 4091 00001EB3 00D0 add al, dl ; [next_val_l] 4092 00001EB5 D0D8 rcr al, 1 4093 00001EB7 50 push eax ; ** ; al = interpolated middle (L) (temporary) 4094 00001EB8 00D8 add al, bl ; [previous_val_l] 4095 00001EBA D0D8 rcr al, 1 4096 00001EBC 86D8 xchg al, bl 4097 00001EBE 00D8 add al, bl ; bl = interpolated 1st quarter (L) (temp) 4098 00001EC0 D0D8 rcr al, 1 4099 00001EC2 2C80 sub al, 80h 4100 00001EC4 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4101 00001EC8 66AB stosw ; interpolated sample 1 (L) 4102 00001ECA 88F8 mov al, bh 4103 00001ECC 00F0 add al, dh ; [next_val_r] 4104 00001ECE D0D8 rcr al, 1 4105 00001ED0 50 push eax ; *** ; al = interpolated middle (R) (temporary) 4106 00001ED1 00F8 add al, bh ; [previous_val_r] 4107 00001ED3 D0D8 rcr al, 1 4108 00001ED5 86F8 xchg al, bh 4109 00001ED7 00F8 add al, bh ; bh = interpolated 1st quarter (R) (temp) 4110 00001ED9 D0D8 rcr al, 1 4111 00001EDB 2C80 sub al, 80h 4112 00001EDD 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4113 00001EE1 66AB stosw ; interpolated sample 1 (R) 4114 00001EE3 5A pop edx ; *** 4115 00001EE4 58 pop eax ; ** ; al = interpolated middle (L) (temporary) 4116 00001EE5 86D8 xchg al, bl ; al = interpolated 1st quarter (L) (temp) 4117 00001EE7 00D8 add al, bl ; bl = interpolated middle (L) (temporary) 4118 00001EE9 D0D8 rcr al, 1 4119 00001EEB 2C80 sub al, 80h 4120 00001EED 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4121 00001EF1 66AB stosw ; interpolated sample 2 (L) 4122 00001EF3 88D0 mov al, dl ; interpolated middle (R) (temporary) 4123 00001EF5 86F8 xchg al, bh ; al = interpolated 1st quarter (R) (temp) 4124 00001EF7 00F8 add al, bh ; bh = interpolated middle (R) (temporary) 4125 00001EF9 D0D8 rcr al, 1 4126 00001EFB 2C80 sub al, 80h 4127 00001EFD 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4128 00001F01 66AB stosw ; interpolated sample 2 (R) 4129 00001F03 5A pop edx ; * 4130 00001F04 88D8 mov al, bl ; interpolated middle (L) (temporary) 4131 00001F06 00D0 add al, dl ; [next_val_l] 4132 00001F08 D0D8 rcr al, 1 4133 00001F0A 86D8 xchg al, bl ; al = interpolated middle (R) (temporary) 4134 00001F0C 00D8 add al, bl ; bl = interpolated 3rd quarter (L) (temp) 4135 00001F0E D0D8 rcr al, 1 4136 00001F10 2C80 sub al, 80h 4137 00001F12 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4138 00001F16 66AB stosw ; interpolated sample 3 (L) 4139 00001F18 88F8 mov al, bh 4140 00001F1A 00F0 add al, dh ; interpolated middle (R) + [next_val_r] 4141 00001F1C D0D8 rcr al, 1 4142 00001F1E 86F8 xchg al, bh ; al = interpolated middle (R) 4143 00001F20 00F8 add al, bh ; bh = interpolated 3rd quarter (R) (temp) 4144 00001F22 D0D8 rcr al, 1 4145 00001F24 2C80 sub al, 80h 4146 00001F26 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4147 00001F2A 66AB stosw ; interpolated sample 3 (R) 4148 00001F2C 88D8 mov al, bl 4149 00001F2E 00D0 add al, dl ; [next_val_l] 4150 00001F30 D0D8 rcr al, 1 4151 00001F32 2C80 sub al, 80h 4152 00001F34 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4153 00001F38 66AB stosw ; interpolated sample 4 (L) 4154 00001F3A 88F8 mov al, bh 4155 00001F3C 00F0 add al, dh ; [next_val_r] 4156 00001F3E D0D8 rcr al, 1 4157 00001F40 2C80 sub al, 80h 4158 00001F42 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4159 00001F46 66AB stosw ; interpolated sample 4 (R) 4160 00001F48 C3 retn 4161 4162 interpolating_4_8bit_mono: 4163 ; 17/11/2023 4164 ; al = [previous_val] 4165 ; dl = [next_val] 4166 ; original-interpolated-interpolated-interpolated 4167 00001F49 88C3 mov bl, al 4168 00001F4B 2C80 sub al, 80h 4169 00001F4D 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4170 00001F51 66AB stosw ; original sample (L) 4171 00001F53 66AB stosw ; original sample (R) 4172 00001F55 88D8 mov al, bl 4173 00001F57 00D0 add al, dl 4174 00001F59 D0D8 rcr al, 1 4175 00001F5B 86D8 xchg al, bl ; al = [previous_val] 4176 00001F5D 00D8 add al, bl ; bl = interpolated middle (sample 2) 4177 00001F5F D0D8 rcr al, 1 4178 00001F61 2C80 sub al, 80h 4179 00001F63 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4180 00001F67 66AB stosw ; interpolated sample 1 (L) 4181 00001F69 66AB stosw ; interpolated sample 1 (R) 4182 00001F6B 88D8 mov al, bl ; interpolated middle (sample 2) 4183 00001F6D 2C80 sub al, 80h 4184 00001F6F 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4185 00001F73 66AB stosw ; interpolated sample 2 (L) 4186 00001F75 66AB stosw ; interpolated sample 2 (R) 4187 00001F77 88D8 mov al, bl 4188 00001F79 00D0 add al, dl ; [next_val] 4189 00001F7B D0D8 rcr al, 1 4190 00001F7D 2C80 sub al, 80h 4191 00001F7F 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4192 00001F83 66AB stosw ; interpolated sample 3 (L) 4193 00001F85 66AB stosw ; interpolated sample 3 (R) 4194 00001F87 C3 retn 4195 4196 interpolating_4_8bit_stereo: 4197 ; 17/11/2023 4198 ; al = [previous_val_l] 4199 ; ah = [previous_val_r] 4200 ; dl = [next_val_l] 4201 ; dh = [next_val_r] 4202 ; original-interpolated-interpolated-interpolated 4203 00001F88 89C3 mov ebx, eax 4204 00001F8A 2C80 sub al, 80h 4205 00001F8C 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4206 00001F90 66AB stosw ; original sample (L) 4207 00001F92 88F8 mov al, bh 4208 00001F94 2C80 sub al, 80h 4209 00001F96 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4210 00001F9A 66AB stosw ; original sample (R) 4211 00001F9C 88D8 mov al, bl 4212 00001F9E 00D0 add al, dl ; [next_val_l] 4213 00001FA0 D0D8 rcr al, 1 4214 00001FA2 86D8 xchg al, bl ; al = [previous_val_l] 4215 00001FA4 00D8 add al, bl ; bl = interpolated middle (L) (sample 2) 4216 00001FA6 D0D8 rcr al, 1 4217 00001FA8 2C80 sub al, 80h 4218 00001FAA 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4219 00001FAE 66AB stosw ; interpolated sample 1 (L) 4220 00001FB0 88F8 mov al, bh 4221 00001FB2 00F0 add al, dh ; [next_val_r] 4222 00001FB4 D0D8 rcr al, 1 4223 00001FB6 86F8 xchg al, bh ; al = [previous_val_h] 4224 00001FB8 00F8 add al, bh ; bh = interpolated middle (R) (sample 2) 4225 00001FBA D0D8 rcr al, 1 4226 00001FBC 2C80 sub al, 80h 4227 00001FBE 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4228 00001FC2 66AB stosw ; interpolated sample 1 (R) 4229 00001FC4 88D8 mov al, bl ; interpolated middle (L) (sample 2) 4230 00001FC6 2C80 sub al, 80h 4231 00001FC8 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4232 00001FCC 66AB stosw ; interpolated sample 2 (L) 4233 00001FCE 88F8 mov al, bh ; interpolated middle (L) (sample 2) 4234 00001FD0 2C80 sub al, 80h 4235 00001FD2 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4236 00001FD6 66AB stosw ; interpolated sample 2 (L) 4237 00001FD8 88D8 mov al, bl 4238 00001FDA 00D0 add al, dl ; [next_val_l] 4239 00001FDC D0D8 rcr al, 1 4240 00001FDE 2C80 sub al, 80h 4241 00001FE0 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4242 00001FE4 66AB stosw ; interpolated sample 3 (L) 4243 00001FE6 88F8 mov al, bh 4244 00001FE8 00F0 add al, dh ; [next_val_r] 4245 00001FEA D0D8 rcr al, 1 4246 00001FEC 2C80 sub al, 80h 4247 00001FEE 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4248 00001FF2 66AB stosw ; interpolated sample 3 (R) 4249 00001FF4 C3 retn 4250 4251 interpolating_5_16bit_mono: 4252 ; 18/11/2023 4253 ; ax = [previous_val] 4254 ; dx = [next_val] 4255 ; original-interpltd-interpltd-interpltd-interpltd 4256 00001FF5 66AB stosw ; original sample (L) 4257 00001FF7 66AB stosw ; original sample (R) 4258 00001FF9 80C480 add ah, 80h ; convert sound level 0 to 65535 format 4259 00001FFC 89C3 mov ebx, eax ; [previous_val] 4260 00001FFE 80C680 add dh, 80h 4261 00002001 6601D0 add ax, dx 4262 00002004 66D1D8 rcr ax, 1 4263 00002007 50 push eax ; * ; interpolated middle (temporary) 4264 00002008 6601D8 add ax, bx ; interpolated middle + [previous_val] 4265 0000200B 66D1D8 rcr ax, 1 4266 0000200E 50 push eax ; ** ; interpolated 1st quarter (temporary) 4267 0000200F 6601D8 add ax, bx ; 1st quarter + [previous_val] 4268 00002012 66D1D8 rcr ax, 1 4269 00002015 80EC80 sub ah, 80h ; -32768 to +32767 format again 4270 00002018 66AB stosw ; interpolated sample 1 (L) 4271 0000201A 66AB stosw ; interpolated sample 1 (R) 4272 0000201C 58 pop eax ; ** 4273 0000201D 5B pop ebx ; * 4274 0000201E 6601D8 add ax, bx ; 1st quarter + middle 4275 00002021 66D1D8 rcr ax, 1 ; / 2 4276 00002024 80EC80 sub ah, 80h ; -32768 to +32767 format again 4277 00002027 66AB stosw ; interpolated sample 2 (L) 4278 00002029 66AB stosw ; interpolated sample 2 (R) 4279 0000202B 89D8 mov eax, ebx 4280 0000202D 6601D0 add ax, dx ; interpolated middle + [next_val] 4281 00002030 66D1D8 rcr ax, 1 4282 00002033 50 push eax ; * ; interpolated 3rd quarter (temporary) 4283 00002034 6601D8 add ax, bx ; + interpolated middle 4284 00002037 66D1D8 rcr ax, 1 4285 0000203A 80EC80 sub ah, 80h ; -32768 to +32767 format again 4286 0000203D 66AB stosw ; interpolated sample 3 (L) 4287 0000203F 66AB stosw ; interpolated sample 3 (R) 4288 00002041 58 pop eax ; * 4289 00002042 6601D0 add ax, dx ; 3rd quarter + [next_val] 4290 00002045 66D1D8 rcr ax, 1 ; / 2 4291 00002048 80EC80 sub ah, 80h ; -32768 to +32767 format again 4292 0000204B 66AB stosw ; interpolated sample 4 (L) 4293 0000204D 66AB stosw ; interpolated sample 4 (R) 4294 0000204F C3 retn 4295 4296 interpolating_5_16bit_stereo: 4297 ; 18/11/2023 4298 ; bx = [previous_val_l] 4299 ; ax = [previous_val_r] 4300 ; [next_val_l] 4301 ; [next_val_r] 4302 ; original-interpltd-interpltd-interpltd-interpltd 4303 00002050 51 push ecx ; ! 4304 00002051 93 xchg eax, ebx 4305 00002052 66AB stosw ; original sample (L) 4306 00002054 93 xchg eax, ebx 4307 00002055 66AB stosw ; original sample (R) 4308 00002057 80C480 add ah, 80h ; convert sound level 0 to 65535 format 4309 0000205A 50 push eax ; * ; [previous_val_r] 4310 0000205B 80C780 add bh, 80h 4311 0000205E 8005[DA210000]80 add byte [next_val_l+1], 80h 4312 00002065 66A1[D9210000] mov ax, [next_val_l] 4313 0000206B 6601D8 add ax, bx ; [previous_val_l] 4314 0000206E 66D1D8 rcr ax, 1 4315 00002071 89C1 mov ecx, eax ; interpolated middle (L) 4316 00002073 6601D8 add ax, bx 4317 00002076 66D1D8 rcr ax, 1 4318 00002079 89C2 mov edx, eax ; interpolated 1st quarter (L) 4319 0000207B 6601D8 add ax, bx ; [previous_val_l] 4320 0000207E 66D1D8 rcr ax, 1 4321 00002081 80EC80 sub ah, 80h ; -32768 to +32767 format again 4322 00002084 66AB stosw ; interpolated sample 1 (L) 4323 00002086 89C8 mov eax, ecx 4324 00002088 6601D0 add ax, dx ; middle (L) + 1st quarter (L) 4325 0000208B 66D1D8 rcr ax, 1 ; / 2 4326 0000208E 89C3 mov ebx, eax ; interpolated sample 2 (L) 4327 00002090 5A pop edx ; * ; [previous_val_r] 4328 00002091 89D0 mov eax, edx 4329 00002093 8005[DC210000]80 add byte [next_val_r+1], 80h 4330 0000209A 660305[DB210000] add ax, [next_val_r] 4331 000020A1 66D1D8 rcr ax, 1 4332 000020A4 50 push eax ; * ; interpolated middle (R) 4333 000020A5 6601D0 add ax, dx 4334 000020A8 66D1D8 rcr ax, 1 4335 000020AB 50 push eax ; ** ; interpolated 1st quarter (R) 4336 000020AC 6601D0 add ax, dx ; [previous_val_r] 4337 000020AF 66D1D8 rcr ax, 1 4338 000020B2 80EC80 sub ah, 80h ; -32768 to +32767 format again 4339 000020B5 66AB stosw ; interpolated sample 1 (R) 4340 000020B7 89D8 mov eax, ebx 4341 000020B9 80EC80 sub ah, 80h ; -32768 to +32767 format again 4342 000020BC 66AB stosw ; interpolated sample 2 (L) 4343 000020BE 58 pop eax ; ** 4344 000020BF 5A pop edx ; * 4345 000020C0 6601D0 add ax, dx ; 1st quarter (R) + middle (R) 4346 000020C3 66D1D8 rcr ax, 1 ; / 2 4347 000020C6 80EC80 sub ah, 80h ; -32768 to +32767 format again 4348 000020C9 66AB stosw ; interpolated sample 2 (R) 4349 000020CB 89C8 mov eax, ecx 4350 000020CD 660305[D9210000] add ax, [next_val_l] 4351 000020D4 66D1D8 rcr ax, 1 4352 000020D7 50 push eax ; * ; interpolated 3rd quarter (L) 4353 000020D8 6601C8 add ax, cx ; interpolated middle (L) 4354 000020DB 66D1D8 rcr ax, 1 4355 000020DE 80EC80 sub ah, 80h ; -32768 to +32767 format again 4356 000020E1 66AB stosw ; interpolated sample 3 (L) 4357 000020E3 89D0 mov eax, edx 4358 000020E5 660305[DB210000] add ax, [next_val_r] 4359 000020EC 66D1D8 rcr ax, 1 4360 000020EF 50 push eax ; ** ; interpolated 3rd quarter (R) 4361 000020F0 6601D0 add ax, dx ; interpolated middle (R) 4362 000020F3 66D1D8 rcr ax, 1 4363 000020F6 80EC80 sub ah, 80h ; -32768 to +32767 format again 4364 000020F9 66AB stosw ; interpolated sample 3 (R) 4365 000020FB 5B pop ebx ; ** 4366 000020FC 58 pop eax ; * 4367 000020FD 660305[D9210000] add ax, [next_val_l] 4368 00002104 66D1D8 rcr ax, 1 4369 00002107 80EC80 sub ah, 80h ; -32768 to +32767 format again 4370 0000210A 66AB stosw ; interpolated sample 4 (L) 4371 0000210C 89D8 mov eax, ebx 4372 0000210E 660305[DB210000] add ax, [next_val_r] 4373 00002115 66D1D8 rcr ax, 1 4374 00002118 80EC80 sub ah, 80h ; -32768 to +32767 format again 4375 0000211B 66AB stosw ; interpolated sample 4 (R) 4376 0000211D 59 pop ecx ; ! 4377 0000211E C3 retn 4378 4379 interpolating_4_16bit_mono: 4380 ; 18/11/2023 4381 ; ax = [previous_val] 4382 ; dx = [next_val] 4383 ; 02/02/2025 4384 ; original-interpolated-interpolated-interpolated 4385 4386 0000211F 66AB stosw ; original sample (L) 4387 00002121 66AB stosw ; original sample (R) 4388 00002123 80C480 add ah, 80h ; convert sound level 0 to 65535 format 4389 00002126 89C3 mov ebx, eax ; [previous_val] 4390 00002128 80C680 add dh, 80h 4391 0000212B 6601D0 add ax, dx ; [previous_val] + [next_val] 4392 0000212E 66D1D8 rcr ax, 1 4393 00002131 93 xchg eax, ebx 4394 00002132 6601D8 add ax, bx ; [previous_val] + interpolated middle 4395 00002135 66D1D8 rcr ax, 1 4396 00002138 80EC80 sub ah, 80h ; -32768 to +32767 format again 4397 0000213B 66AB stosw ; interpolated sample 1 (L) 4398 0000213D 66AB stosw ; interpolated sample 1 (R) 4399 0000213F 89D8 mov eax, ebx ; interpolated middle 4400 00002141 80EC80 sub ah, 80h ; -32768 to +32767 format again 4401 00002144 66AB stosw ; interpolated sample 2 (L) 4402 00002146 66AB stosw ; interpolated sample 2 (R) 4403 00002148 89D8 mov eax, ebx 4404 0000214A 6601D0 add ax, dx ; interpolated middle + [next_val] 4405 0000214D 66D1D8 rcr ax, 1 4406 00002150 80EC80 sub ah, 80h ; -32768 to +32767 format again 4407 00002153 66AB stosw ; interpolated sample 3 (L) 4408 00002155 66AB stosw ; interpolated sample 3 (R) 4409 00002157 C3 retn 4410 4411 interpolating_4_16bit_stereo: 4412 ; 18/11/2023 4413 ; bx = [previous_val_l] 4414 ; ax = [previous_val_r] 4415 ; [next_val_l] 4416 ; [next_val_r] 4417 ; original-interpolated-interpolated-interpolated 4418 00002158 93 xchg eax, ebx 4419 00002159 66AB stosw ; original sample (L) 4420 0000215B 93 xchg eax, ebx 4421 0000215C 66AB stosw ; original sample (R) 4422 0000215E 80C480 add ah, 80h ; convert sound level 0 to 65535 format 4423 00002161 89C2 mov edx, eax ; [previous_val_r] 4424 00002163 80C780 add bh, 80h 4425 00002166 8005[DA210000]80 add byte [next_val_l+1], 80h 4426 0000216D 66A1[D9210000] mov ax, [next_val_l] 4427 00002173 6601D8 add ax, bx ; [previous_val_l] 4428 00002176 66D1D8 rcr ax, 1 4429 00002179 93 xchg eax, ebx 4430 0000217A 6601D8 add ax, bx ; bx = interpolated middle (L) 4431 0000217D 66D1D8 rcr ax, 1 4432 00002180 80EC80 sub ah, 80h ; -32768 to +32767 format again 4433 00002183 66AB stosw ; interpolated sample 1 (L) 4434 00002185 8005[DC210000]80 add byte [next_val_r+1], 80h 4435 0000218C 89D0 mov eax, edx ; [previous_val_r] 4436 0000218E 660305[DB210000] add ax, [next_val_r] 4437 00002195 66D1D8 rcr ax, 1 4438 00002198 92 xchg eax, edx 4439 00002199 6601D0 add ax, dx ; dx = interpolated middle (R) 4440 0000219C 66D1D8 rcr ax, 1 4441 0000219F 80EC80 sub ah, 80h ; -32768 to +32767 format again 4442 000021A2 66AB stosw ; interpolated sample 1 (R) 4443 000021A4 89D8 mov eax, ebx 4444 000021A6 80EC80 sub ah, 80h ; -32768 to +32767 format again 4445 000021A9 66AB stosw ; interpolated sample 2 (L) 4446 000021AB 89D0 mov eax, edx 4447 000021AD 80EC80 sub ah, 80h ; -32768 to +32767 format again 4448 000021B0 66AB stosw ; interpolated sample 2 (R) 4449 000021B2 89D8 mov eax, ebx 4450 000021B4 660305[D9210000] add ax, [next_val_l] 4451 000021BB 66D1D8 rcr ax, 1 4452 000021BE 80EC80 sub ah, 80h ; -32768 to +32767 format again 4453 000021C1 66AB stosw ; interpolated sample 3 (L) 4454 000021C3 89D0 mov eax, edx 4455 000021C5 660305[DB210000] add ax, [next_val_r] 4456 000021CC 66D1D8 rcr ax, 1 4457 000021CF 80EC80 sub ah, 80h ; -32768 to +32767 format again 4458 000021D2 66AB stosw ; interpolated sample 3 (R) 4459 000021D4 C3 retn 4460 4461 ; 13/11/2023 4462 previous_val: 4463 000021D5 0000 previous_val_l: dw 0 4464 000021D7 0000 previous_val_r: dw 0 4465 next_val: 4466 000021D9 0000 next_val_l: dw 0 4467 000021DB 0000 next_val_r: dw 0 4468 4469 ; 16/11/2023 4470 000021DD 00 faz: db 0 4471 4472 ; -------------------------------------------------------- 4473 4474 ; DATA 4475 4476 FileHandle: 4477 000021DE FFFFFFFF dd -1 4478 4479 Credits: 4480 000021E2 54696E792057415620- db 'Tiny WAV Player for TRDOS 386 by Erdogan Tan. ' 4480 000021EB 506C6179657220666F- 4480 000021F4 72205452444F532033- 4480 000021FD 383620627920457264- 4480 00002206 6F67616E2054616E2E- 4480 0000220F 20 4481 ;;;;;db 'August 2020.',10,13,0 4482 ;;;;db 'November 2023.',10,13,0 4483 ;;;db 'June 2024.', 10,13,0 4484 ;;db 'December 2024.', 10,13,0 4485 ;db 'January 2025.', 10,13,0 4486 00002210 466562727561727920- db 'February 2025.', 10,13,0 4486 00002219 323032352E0A0D00 4487 00002221 31372F30362F323031- db '17/06/2017', 10,13,0 4487 0000222A 370A0D00 4488 0000222E 31382F30382F323032- db '18/08/2020', 10,13,0 4488 00002237 300A0D00 4489 0000223B 32372F31312F323032- db '27/11/2023', 10,13,0 4489 00002244 330A0D00 4490 00002248 30312F30362F323032- db '01/06/2024', 10,13,0 4490 00002251 340A0D00 4491 00002255 31342F31322F323032- db '14/12/2024', 10,13,0 4491 0000225E 340A0D00 4492 00002262 31372F30312F323032- db '17/01/2025', 10,13,0 4492 0000226B 350A0D00 4493 0000226F 30322F30322F323032- db '02/02/2025', 10,13,0 4493 00002278 350A0D00 4494 4495 msgAudioCardInfo: 4496 0000227C 666F7220496E74656C- db 'for Intel AC97 (ICH) Audio Controller.', 10,13,0 4496 00002285 204143393720284943- 4496 0000228E 482920417564696F20- 4496 00002297 436F6E74726F6C6C65- 4496 000022A0 722E0A0D00 4497 4498 msg_usage: 4499 000022A5 75736167653A20706C- db 'usage: playwav6 filename.wav',10,13,0 4499 000022AE 617977617636206669- 4499 000022B7 6C656E616D652E7761- 4499 000022C0 760A0D00 4500 4501 noDevMsg: 4502 000022C4 4572726F723A20556E- db 'Error: Unable to find AC97 audio device!' 4502 000022CD 61626C6520746F2066- 4502 000022D6 696E64204143393720- 4502 000022DF 617564696F20646576- 4502 000022E8 69636521 4503 000022EC 0A0D00 db 10,13,0 4504 4505 noFileErrMsg: 4506 000022EF 4572726F723A206669- db 'Error: file not found.',10,13,0 4506 000022F8 6C65206E6F7420666F- 4506 00002301 756E642E0A0D00 4507 4508 trdos386_err_msg: 4509 00002308 5452444F5320333836- db 'TRDOS 386 System call error !',10,13,0 4509 00002311 2053797374656D2063- 4509 0000231A 616C6C206572726F72- 4509 00002323 20210A0D00 4510 4511 ; 01/06/2024 4512 msg_init_err: 4513 00002328 0A0D db 10,13 4514 0000232A 4143393720436F6E74- db "AC97 Controller/Codec initialization error !" 4514 00002333 726F6C6C65722F436F- 4514 0000233C 64656320696E697469- 4514 00002345 616C697A6174696F6E- 4514 0000234E 206572726F722021 4515 00002356 0A0D00 db 10,13,0 4516 4517 ; 25/11/2023 4518 msg_no_vra: 4519 00002359 0A0D db 10,13 4520 0000235B 4E6F20565241207375- db "No VRA support ! Only 48 kHZ sample rate supported !" 4520 00002364 70706F72742021204F- 4520 0000236D 6E6C79203438206B48- 4520 00002376 5A2073616D706C6520- 4520 0000237F 726174652073757070- 4520 00002388 6F727465642021 4521 0000238F 0A0D00 db 10,13,0 4522 4523 00002392 0D0A5741562046696C- msgWavFileName: db 0Dh, 0Ah, "WAV File Name: ",0 4523 0000239B 65204E616D653A2000 4524 000023A4 0D0A53616D706C6520- msgSampleRate: db 0Dh, 0Ah, "Sample Rate: " 4524 000023AD 526174653A20 4525 000023B3 303030303020487A2C- msgHertz: db "00000 Hz, ", 0 4525 000023BC 2000 4526 000023BE 3820626974732C2000 msg8Bits: db "8 bits, ", 0 4527 000023C7 4D6F6E6F0D0A00 msgMono: db "Mono", 0Dh, 0Ah, 0 4528 000023CE 313620626974732C20- msg16Bits: db "16 bits, ", 0 4528 000023D7 00 4529 000023D8 53746572656F msgStereo: db "Stereo" 4530 000023DE 0D0A00 nextline: db 0Dh, 0Ah, 0 4531 4532 ; 03/06/2017 4533 000023E1 303132333435363738- hex_chars db "0123456789ABCDEF", 0 4533 000023EA 3941424344454600 4534 000023F2 0D0A msgAC97Info db 0Dh, 0Ah 4535 000023F4 414339372041756469- db "AC97 Audio Controller & Codec Info", 0Dh, 0Ah 4535 000023FD 6F20436F6E74726F6C- 4535 00002406 6C6572202620436F64- 4535 0000240F 656320496E666F0D0A 4536 00002418 56656E646F72204944- db "Vendor ID: " 4536 00002421 3A20 4537 00002423 303030306820446576- msgVendorId db "0000h Device ID: " 4537 0000242C 6963652049443A20 4538 00002434 30303030680D0A msgDevId db "0000h", 0Dh, 0Ah 4539 0000243B 4275733A20 db "Bus: " 4540 00002440 303068204465766963- msgBusNo db "00h Device: " 4540 00002449 653A20 4541 0000244C 3030682046756E6374- msgDevNo db "00h Function: " 4541 00002455 696F6E3A20 4542 0000245A 303068 msgFncNo db "00h" 4543 0000245D 0D0A db 0Dh, 0Ah 4544 0000245F 4E414D4241523A20 db "NAMBAR: " 4545 00002467 30303030682020 msgNamBar db "0000h " 4546 0000246E 4E41424D4241523A20 db "NABMBAR: " 4547 00002477 303030306820204952- msgNabmBar db "0000h IRQ: " 4547 00002480 513A20 4548 00002483 3030 msgIRQ dw 3030h 4549 00002485 0D0A00 db 0Dh, 0Ah, 0 4550 ; 25/11/2023 4551 00002488 56524120737570706F- msgVRAheader: db "VRA support: " 4551 00002491 72743A20 4552 00002495 00 db 0 4553 00002496 5945530D0A00 msgVRAyes: db "YES", 0Dh, 0Ah, 0 4554 0000249C 4E4F200D0A msgVRAno: db "NO ", 0Dh, 0Ah 4555 000024A1 28496E746572706F6C- db "(Interpolated sample rate playing method)" 4555 000024AA 617465642073616D70- 4555 000024B3 6C6520726174652070- 4555 000024BC 6C6179696E67206D65- 4555 000024C5 74686F6429 4556 000024CA 0D0A00 db 0Dh, 0Ah, 0 4557 EOF: 4558 4559 ; BSS 4560 4561 bss_start: 4562 4563 ABSOLUTE bss_start 4564 4565 000024CD ?????? alignb 4 4566 4567 000024D0 ?? stmo: resb 1 ; stereo or mono (1=stereo) 4568 000024D1 ?? bps: resb 1 ; bits per sample (8,16) 4569 000024D2 ???? sample_rate: resw 1 ; Sample Frequency (Hz) 4570 4571 ; 25/11/2023 4572 000024D4 ???????? bufferSize: resd 1 4573 4574 000024D8 ?? flags: resb 1 4575 ;cbs_busy: resb 1 4576 000024D9 ?? half_buff: resb 1 4577 000024DA ?? srb: resb 1 4578 ; 18/08/2020 4579 000024DB ?? volume_level: resb 1 4580 ; 25/11/2023 4581 000024DC ?? VRA: resb 1 ; Variable Rate Audio Support Status 4582 4583 000024DD smpRBuff: resw 14 4584 4585 wav_file_name: 4586 000024F9 resb 80 ; wave file, path name (<= 80 bytes) 4587 4588 00002549 ???? resw 1 4589 0000254B ?? ac97_int_ln_reg: resb 1 4590 0000254C ?? fbs_shift: resb 1 ; 26/11/2023 4591 0000254D ???????? dev_vendor: resd 1 4592 00002551 ???????? bus_dev_fn: resd 1 4593 00002555 ???? ac97_NamBar: resw 1 4594 00002557 ???? ac97_NabmBar: resw 1 4595 4596 bss_end: 4597 00002559 alignb 4096 4598 ;audio_buffer: resb BUFFERSIZE ; DMA Buffer Size / 2 (32768) 4599 ; 26/11/2023 4600 00003000 audio_buffer: resb 65536 4601 ; 13/06/2017 4602 ;temp_buffer: resb BUFFERSIZE 4603 ; 26/11/2023 4604 00013000 temp_buffer: resb 65536