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 ; 14/07/2020 22 ; 31/12/2017 23 ; TRDOS 386 (v2.0) 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 _create 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 _memory 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 _ldrvt 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 _fpstat 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 71 %macro sys 1-4 72 ; 29/04/2016 - TRDOS 386 (TRDOS v2.0) 73 ; 03/09/2015 74 ; 13/04/2015 75 ; Retro UNIX 386 v1 system call. 76 %if %0 >= 2 77 mov ebx, %2 78 %if %0 >= 3 79 mov ecx, %3 80 %if %0 = 4 81 mov edx, %4 82 %endif 83 %endif 84 %endif 85 mov eax, %1 86 ;int 30h 87 int 40h ; TRDOS 386 (TRDOS v2.0) 88 %endmacro 89 90 ; TRDOS 386 (and Retro UNIX 386 v1) system call format: 91 ; sys systemcall (eax) , , 92 93 BUFFERSIZE equ 32768 ; audio buffer size 94 ENDOFFILE equ 1 ; flag for knowing end of file 95 96 [BITS 32] 97 98 [ORG 0] 99 100 _STARTUP: 101 ; Prints the Credits Text. 102 sys _msg, Credits, 255, 0Bh 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00000000 BB[85220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 00000005 B9FF000000 <1> mov ecx, %3 80 <1> %if %0 = 4 81 0000000A BA0B000000 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 0000000F B823000000 <1> mov eax, %1 86 <1> 87 00000014 CD40 <1> int 40h 103 104 ; clear bss 105 00000016 B9[49260000] mov ecx, bss_end 106 0000001B BF[BD250000] mov edi, bss_start 107 00000020 29F9 sub ecx, edi 108 00000022 D1E9 shr ecx, 1 109 00000024 31C0 xor eax, eax 110 00000026 F366AB rep stosw 111 112 ; Detect (& Enable) AC'97 Audio Device 113 00000029 E8E3040000 call DetectAC97 114 0000002E 731B jnc short GetFileName 115 116 _dev_not_ready: 117 ; couldn't find the audio device! 118 sys _msg, noDevMsg, 255, 0Fh 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00000030 BB[81230000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 00000035 B9FF000000 <1> mov ecx, %3 80 <1> %if %0 = 4 81 0000003A BA0F000000 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 0000003F B823000000 <1> mov eax, %1 86 <1> 87 00000044 CD40 <1> int 40h 119 00000046 E9A0040000 jmp Exit 120 121 GetFileName: 122 0000004B 89E6 mov esi, esp 123 0000004D AD lodsd 124 0000004E 83F802 cmp eax, 2 ; two arguments 125 ; (program file name & mod file name) 126 00000051 0F82A2040000 jb pmsg_usage ; nothing to do 127 128 00000057 AD lodsd ; program file name address 129 00000058 AD lodsd ; mod file name address (file to be read) 130 00000059 89C6 mov esi, eax 131 0000005B BF[E9250000] mov edi, wav_file_name 132 ScanName: 133 00000060 AC lodsb 134 00000061 84C0 test al, al 135 00000063 0F8490040000 je pmsg_usage 136 00000069 3C20 cmp al, 20h 137 0000006B 74F3 je short ScanName ; scan start of name. 138 0000006D AA stosb 139 0000006E B4FF mov ah, 0FFh 140 a_0: 141 00000070 FEC4 inc ah 142 a_1: 143 00000072 AC lodsb 144 00000073 AA stosb 145 00000074 3C2E cmp al, '.' 146 00000076 74F8 je short a_0 147 00000078 20C0 and al, al 148 0000007A 75F6 jnz short a_1 149 150 0000007C 08E4 or ah, ah ; if period NOT found, 151 0000007E 750B jnz short _1 ; then add a .WAV extension. 152 SetExt: 153 00000080 4F dec edi 154 00000081 C7072E574156 mov dword [edi], '.WAV' 155 00000087 C6470400 mov byte [edi+4], 0 156 157 _1: 158 159 ; 26/11/2023 160 %if 0 161 ; Allocate Audio Buffer (for user) 162 ;sys _audio, 0200h, BUFFERSIZE, audio_buffer 163 ; 26/11/2023 164 sys _audio, 0200h, [buffersize], audio_buffer 165 jnc short _2 166 error_exit: 167 sys _msg, trdos386_err_msg, 255, 0Eh 168 jmp Exit 169 _2: 170 ; DIRECT CGA (TEXT MODE) MEMORY ACCESS 171 ; bl = 0, bh = 4 172 ; Direct access/map to CGA (Text) memory (0B8000h) 173 174 sys _video, 0400h 175 cmp eax, 0B8000h 176 jne short error_exit 177 178 ; Initialize Audio Device (bh = 3) 179 sys _audio, 0301h, 0, audio_int_handler 180 ; jc short error_exit 181 _3: 182 183 %endif 184 0000008B E8DF060000 call write_audio_dev_info 185 186 ; open the file 187 ; open existing file 188 00000090 E889040000 call openFile ; no error? ok. 189 00000095 731B jnc short _gsr 190 191 ; file not found! 192 sys _msg, noFileErrMsg, 255, 0Fh 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00000097 BB[AC230000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 0000009C B9FF000000 <1> mov ecx, %3 80 <1> %if %0 = 4 81 000000A1 BA0F000000 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 000000A6 B823000000 <1> mov eax, %1 86 <1> 87 000000AB CD40 <1> int 40h 193 _exit_: 194 000000AD E939040000 jmp Exit 195 196 _gsr: 197 000000B2 E8A1040000 call getSampleRate ; read the sample rate 198 ; pass it onto codec. 199 ;jc Exit 200 ; 25/11/2023 201 000000B7 72F4 jc short _exit_ 202 203 000000B9 66A3[C2250000] mov [sample_rate], ax 204 000000BF 880D[C0250000] mov [stmo], cl 205 000000C5 8815[C1250000] mov [bps], dl 206 207 ; 26/11/2023 208 000000CB C605[3C260000]00 mov byte [fbs_shift], 0 ; 0 = stereo and 16 bit 209 000000D2 FEC9 dec cl 210 000000D4 7506 jnz short _gsr_1 ; stereo 211 000000D6 FE05[3C260000] inc byte [fbs_shift] ; 1 = mono or 8 bit 212 _gsr_1: 213 000000DC 80FA08 cmp dl, 8 214 000000DF 7706 ja short _gsr_2 ; 16 bit samples 215 000000E1 FE05[3C260000] inc byte [fbs_shift] ; 2 = mono and 8 bit 216 _gsr_2: 217 ; 06/06/2017 218 sys _audio, 0E00h ; get audio controller info 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 000000E7 BB000E0000 <1> mov ebx, %2 78 <1> %if %0 >= 3 79 <1> mov ecx, %3 80 <1> %if %0 = 4 81 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 000000EC B820000000 <1> mov eax, %1 86 <1> 87 000000F1 CD40 <1> int 40h 219 000000F3 0F8246030000 jc error_exit ; 25/11/2023 220 221 ;cmp ah, 2 ; ICH ? (Intel AC'97 Audio Controller) 222 ;jne _dev_not_ready 223 224 ; EAX = IRQ Number in AL 225 ; Audio Device Number in AH 226 ; EBX = DEV/VENDOR ID 227 ; (DDDDDDDDDDDDDDDDVVVVVVVVVVVVVVVV) 228 ; ECX = BUS/DEV/FN 229 ; (00000000BBBBBBBBDDDDDFFF00000000) 230 ; EDX = NABMBAR/NAMBAR (for AC97) 231 ; (Low word, DX = NAMBAR address) 232 ; EDX = Base IO Addr (DX) for SB16 & VT8233 233 234 000000F9 A2[3B260000] mov [ac97_int_ln_reg], al 235 000000FE 891D[3D260000] mov [dev_vendor], ebx 236 00000104 890D[41260000] mov [bus_dev_fn], ecx 237 ;mov [ac97_NamBar], dx 238 ;shr dx, 16 239 ;mov [ac97_NabmBar], dx 240 0000010A 8915[45260000] mov [ac97_NamBar], edx 241 242 ; 01/06/2024 243 ; Reset Audio Device (bh = 8) 244 sys _audio, 0800h 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00000110 BB00080000 <1> mov ebx, %2 78 <1> %if %0 >= 3 79 <1> mov ecx, %3 80 <1> %if %0 = 4 81 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00000115 B820000000 <1> mov eax, %1 86 <1> 87 0000011A CD40 <1> int 40h 245 ;jc error_exit 246 0000011C 7239 jc short init_err 247 248 0000011E E82E070000 call write_ac97_pci_dev_info 249 250 ; 01/06/2024 251 ; 25/11/2023 252 ; Get AC'97 Codec info 253 ; (Function 14, sub function 1) 254 sys _audio, 0E01h 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00000123 BB010E0000 <1> mov ebx, %2 78 <1> %if %0 >= 3 79 <1> mov ecx, %3 80 <1> %if %0 = 4 81 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00000128 B820000000 <1> mov eax, %1 86 <1> 87 0000012D CD40 <1> int 40h 255 ; 06/06/2024 256 0000012F 7302 jnc short _gsr_3 257 258 00000131 D1E0 shl eax, 1 ; clears AL BIT 0 259 _gsr_3: 260 ; Save Variable Rate Audio support bit 261 00000133 2401 and al, 1 262 00000135 A2[CC250000] mov [VRA], al 263 264 ; 06/06/2024 265 ; ebx = codec vendor id1 & id2 (bx) 266 0000013A E826090000 call write_codec_info 267 268 ; 25/11/2023 269 0000013F E8D4080000 call write_VRA_info 270 271 ; 01/05/2017 272 00000144 E83D060000 call write_wav_file_info 273 274 ; 25/11/2023 275 ; ------------------------------------------ 276 277 00000149 803D[CC250000]01 cmp byte [VRA], 1 278 00000150 7220 jb short chk_sample_rate 279 280 playwav_48_khz: 281 ;mov dword [loadfromwavfile], loadFromFile 282 ;mov dword [buffersize], 65536 283 00000152 E9CF020000 jmp PlayNow 284 285 ; 01/06/2024 286 init_err: 287 sys _msg, msg_init_err, 255, 0Eh 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00000157 BB[E5230000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 0000015C B9FF000000 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00000161 BA0E000000 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00000166 B823000000 <1> mov eax, %1 86 <1> 87 0000016B CD40 <1> int 40h 288 0000016D E979030000 jmp Exit 289 290 ; 02/02/2025 291 chk_sample_rate: 292 ; set conversion parameters 293 ; (for 8, 11.025, 16, 22.050, 24, 32 kHZ) 294 00000172 66A1[C2250000] mov ax, [sample_rate] 295 00000178 663D80BB cmp ax, 48000 296 0000017C 74D4 je short playwav_48_khz 297 chk_22khz: 298 0000017E 663D2256 cmp ax, 22050 299 00000182 7545 jne short chk_11khz 300 00000184 803D[C1250000]08 cmp byte [bps], 8 301 0000018B 7615 jna short chk_22khz_1 302 0000018D BB[46170000] mov ebx, load_22khz_stereo_16_bit 303 00000192 803D[C0250000]01 cmp byte [stmo], 1 304 00000199 751A jne short chk_22khz_2 305 0000019B BB[B9160000] mov ebx, load_22khz_mono_16_bit 306 000001A0 EB13 jmp short chk_22khz_2 307 chk_22khz_1: 308 000001A2 BB[32160000] mov ebx, load_22khz_stereo_8_bit 309 000001A7 803D[C0250000]01 cmp byte [stmo], 1 310 000001AE 7505 jne short chk_22khz_2 311 000001B0 BB[A9150000] mov ebx, load_22khz_mono_8_bit 312 chk_22khz_2: 313 000001B5 B85A1D0000 mov eax, 7514 ; (442*17) 314 000001BA BA25000000 mov edx, 37 315 000001BF B911000000 mov ecx, 17 316 000001C4 E9BA010000 jmp set_sizes 317 chk_11khz: 318 000001C9 663D112B cmp ax, 11025 319 000001CD 7545 jne short chk_44khz 320 000001CF 803D[C1250000]08 cmp byte [bps], 8 321 000001D6 7615 jna short chk_11khz_1 322 000001D8 BB[62190000] mov ebx, load_11khz_stereo_16_bit 323 000001DD 803D[C0250000]01 cmp byte [stmo], 1 324 000001E4 751A jne short chk_11khz_2 325 000001E6 BB[E9180000] mov ebx, load_11khz_mono_16_bit 326 000001EB EB13 jmp short chk_11khz_2 327 chk_11khz_1: 328 000001ED BB[6F180000] mov ebx, load_11khz_stereo_8_bit 329 000001F2 803D[C0250000]01 cmp byte [stmo], 1 330 000001F9 7505 jne short chk_11khz_2 331 000001FB BB[F7170000] mov ebx, load_11khz_mono_8_bit 332 chk_11khz_2: 333 00000200 B8AD0E0000 mov eax, 3757 ; (221*17) 334 00000205 BA4A000000 mov edx, 74 335 0000020A B911000000 mov ecx, 17 336 0000020F E96F010000 jmp set_sizes 337 chk_44khz: 338 00000214 663D44AC cmp ax, 44100 339 00000218 7545 jne short chk_16khz 340 0000021A 803D[C1250000]08 cmp byte [bps], 8 341 00000221 7615 jna short chk_44khz_1 342 00000223 BB[691B0000] mov ebx, load_44khz_stereo_16_bit 343 00000228 803D[C0250000]01 cmp byte [stmo], 1 344 0000022F 751A jne short chk_44khz_2 345 00000231 BB[F01A0000] mov ebx, load_44khz_mono_16_bit 346 00000236 EB13 jmp short chk_44khz_2 347 chk_44khz_1: 348 00000238 BB[731A0000] mov ebx, load_44khz_stereo_8_bit 349 0000023D 803D[C0250000]01 cmp byte [stmo], 1 350 00000244 7505 jne short chk_44khz_2 351 00000246 BB[F7190000] mov ebx, load_44khz_mono_8_bit 352 chk_44khz_2: 353 0000024B B8D93A0000 mov eax, 15065 ; (655*23) 354 00000250 BA19000000 mov edx, 25 355 00000255 B917000000 mov ecx, 23 356 0000025A E924010000 jmp set_sizes 357 chk_16khz: 358 0000025F 663D803E cmp ax, 16000 359 00000263 7545 jne short chk_8khz 360 00000265 803D[C1250000]08 cmp byte [bps], 8 361 0000026C 7615 jna short chk_16khz_1 362 0000026E BB[E8100000] mov ebx, load_16khz_stereo_16_bit 363 00000273 803D[C0250000]01 cmp byte [stmo], 1 364 0000027A 751A jne short chk_16khz_2 365 0000027C BB[67100000] mov ebx, load_16khz_mono_16_bit 366 00000281 EB13 jmp short chk_16khz_2 367 chk_16khz_1: 368 00000283 BB[AD0F0000] mov ebx, load_16khz_stereo_8_bit 369 00000288 803D[C0250000]01 cmp byte [stmo], 1 370 0000028F 7505 jne short chk_16khz_2 371 00000291 BB[2E0F0000] mov ebx, load_16khz_mono_8_bit 372 chk_16khz_2: 373 00000296 B855150000 mov eax, 5461 374 0000029B BA03000000 mov edx, 3 375 000002A0 B901000000 mov ecx, 1 376 000002A5 E9D9000000 jmp set_sizes 377 chk_8khz: 378 000002AA 663D401F cmp ax, 8000 379 000002AE 7545 jne short chk_24khz 380 000002B0 803D[C1250000]08 cmp byte [bps], 8 381 000002B7 7615 jna short chk_8khz_1 382 000002B9 BB[E30D0000] mov ebx, load_8khz_stereo_16_bit 383 000002BE 803D[C0250000]01 cmp byte [stmo], 1 384 000002C5 751A jne short chk_8khz_2 385 000002C7 BB[130D0000] mov ebx, load_8khz_mono_16_bit 386 000002CC EB13 jmp short chk_8khz_2 387 chk_8khz_1: 388 000002CE BB[E30B0000] mov ebx, load_8khz_stereo_8_bit 389 000002D3 803D[C0250000]01 cmp byte [stmo], 1 390 000002DA 7505 jne short chk_8khz_2 391 000002DC BB[FF0A0000] mov ebx, load_8khz_mono_8_bit 392 chk_8khz_2: 393 000002E1 B8AA0A0000 mov eax, 2730 394 000002E6 BA06000000 mov edx, 6 395 000002EB B901000000 mov ecx, 1 396 000002F0 E98E000000 jmp set_sizes 397 chk_24khz: 398 000002F5 663DC05D cmp ax, 24000 399 000002F9 7542 jne short chk_32khz 400 000002FB 803D[C1250000]08 cmp byte [bps], 8 401 00000302 7615 jna short chk_24khz_1 402 00000304 BB[15130000] mov ebx, load_24khz_stereo_16_bit 403 00000309 803D[C0250000]01 cmp byte [stmo], 1 404 00000310 751A jne short chk_24khz_2 405 00000312 BB[AF120000] mov ebx, load_24khz_mono_16_bit 406 00000317 EB13 jmp short chk_24khz_2 407 chk_24khz_1: 408 00000319 BB[25120000] mov ebx, load_24khz_stereo_8_bit 409 0000031E 803D[C0250000]01 cmp byte [stmo], 1 410 00000325 7505 jne short chk_24khz_2 411 00000327 BB[BE110000] mov ebx, load_24khz_mono_8_bit 412 chk_24khz_2: 413 0000032C B800200000 mov eax, 8192 414 00000331 BA02000000 mov edx, 2 415 00000336 B901000000 mov ecx, 1 416 0000033B EB46 jmp short set_sizes 417 chk_32khz: 418 0000033D 663D007D cmp ax, 32000 419 ;jne short vra_needed 420 ; 02/02/2025 421 00000341 7574 jne short chk_12khz 422 00000343 803D[C1250000]08 cmp byte [bps], 8 423 0000034A 7615 jna short chk_32khz_1 424 0000034C BB[19150000] mov ebx, load_32khz_stereo_16_bit 425 00000351 803D[C0250000]01 cmp byte [stmo], 1 426 00000358 751A jne short chk_32khz_2 427 0000035A BB[AC140000] mov ebx, load_32khz_mono_16_bit 428 0000035F EB13 jmp short chk_32khz_2 429 chk_32khz_1: 430 00000361 BB[0F140000] mov ebx, load_32khz_stereo_8_bit 431 00000366 803D[C0250000]01 cmp byte [stmo], 1 432 0000036D 7505 jne short chk_32khz_2 433 0000036F BB[9C130000] mov ebx, load_32khz_mono_8_bit 434 chk_32khz_2: 435 00000374 B8AA2A0000 mov eax, 10922 436 00000379 BA03000000 mov edx, 3 437 0000037E B902000000 mov ecx, 2 438 ;jmp short set_sizes 439 440 set_sizes: 441 00000383 803D[C0250000]01 cmp byte [stmo], 1 442 0000038A 7402 je short ss_1 443 0000038C D1E0 shl eax, 1 444 ss_1: 445 0000038E 803D[C1250000]08 cmp byte [bps], 8 446 00000395 7602 jna short ss_2 447 ; 16 bit samples 448 00000397 D1E0 shl eax, 1 449 ss_2: 450 00000399 A3[1E040000] mov [loadsize], eax 451 0000039E F7E2 mul edx 452 ;cmp ecx, 1 453 ;je short ss_3 454 ;ss_3: 455 000003A0 F7F1 div ecx 456 000003A2 8A0D[3C260000] mov cl, [fbs_shift] 457 000003A8 D3E0 shl eax, cl 458 ; 26/11/2023 459 ;shr eax, 1 ; buffer size is 16 bit sample count 460 000003AA A3[22040000] mov [buffersize], eax ; buffer size in bytes 461 000003AF 891D[1A040000] mov [loadfromwavfile], ebx 462 000003B5 EB6F jmp short PlayNow 463 464 ;;;; 465 ; 02/02/2025 466 chk_12khz: 467 000003B7 663DE02E cmp ax, 12000 468 000003BB 7542 jne short vra_needed 469 000003BD 803D[C1250000]08 cmp byte [bps], 8 470 000003C4 7615 jna short chk_12khz_1 471 000003C6 BB[D51C0000] mov ebx, load_12khz_stereo_16_bit 472 000003CB 803D[C0250000]01 cmp byte [stmo], 1 473 000003D2 751A jne short chk_12khz_2 474 000003D4 BB[861C0000] mov ebx, load_12khz_mono_16_bit 475 000003D9 EB13 jmp short chk_12khz_2 476 chk_12khz_1: 477 000003DB BB[301C0000] mov ebx, load_12khz_stereo_8_bit 478 000003E0 803D[C0250000]01 cmp byte [stmo], 1 479 000003E7 7505 jne short chk_12khz_2 480 000003E9 BB[E81B0000] mov ebx, load_12khz_mono_8_bit 481 chk_12khz_2: 482 000003EE B800100000 mov eax, 4096 483 000003F3 BA04000000 mov edx, 4 484 000003F8 B901000000 mov ecx, 1 485 000003FD EB84 jmp set_sizes 486 ;;;; 487 488 vra_needed: 489 sys _msg, msg_no_vra, 255, 07h 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 000003FF BB[16240000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 00000404 B9FF000000 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00000409 BA07000000 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 0000040E B823000000 <1> mov eax, %1 86 <1> 87 00000413 CD40 <1> int 40h 490 00000415 E9D1000000 jmp Exit 491 492 ; 26/11/2023 493 ; 13/11/2023 494 loadfromwavfile: 495 0000041A [CA050000] dd loadFromFile 496 loadsize: ; read from wav file 497 0000041E 00000000 dd 0 498 buffersize: ; write to DMA buffer 499 00000422 00000100 dd 65536 ; bytes 500 501 PlayNow: 502 503 ; 26/11/2023 504 %if 1 505 ; Allocate Audio Buffer (for user) 506 ;sys _audio, 0200h, BUFFERSIZE, audio_buffer 507 ; 26/11/2023 508 sys _audio, 0200h, [buffersize], audio_buffer 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00000426 BB00020000 <1> mov ebx, %2 78 <1> %if %0 >= 3 79 0000042B 8B0D[22040000] <1> mov ecx, %3 80 <1> %if %0 = 4 81 00000431 BA[00300000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00000436 B820000000 <1> mov eax, %1 86 <1> 87 0000043B CD40 <1> int 40h 509 0000043D 731B jnc short _2 510 511 ; 26/11/2023 - temporary 512 ;sys _msg, test_1, 255, 0Ch 513 514 error_exit: 515 sys _msg, trdos386_err_msg, 255, 0Eh 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 0000043F BB[C5230000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 00000444 B9FF000000 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00000449 BA0E000000 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 0000044E B823000000 <1> mov eax, %1 86 <1> 87 00000453 CD40 <1> int 40h 516 00000455 E991000000 jmp Exit 517 _2: 518 ; DIRECT CGA (TEXT MODE) MEMORY ACCESS 519 ; bl = 0, bh = 4 520 ; Direct access/map to CGA (Text) memory (0B8000h) 521 522 sys _video, 0400h 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 0000045A BB00040000 <1> mov ebx, %2 78 <1> %if %0 >= 3 79 <1> mov ecx, %3 80 <1> %if %0 = 4 81 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 0000045F B81F000000 <1> mov eax, %1 86 <1> 87 00000464 CD40 <1> int 40h 523 00000466 3D00800B00 cmp eax, 0B8000h 524 0000046B 75D2 jne short error_exit 525 526 ; 01/06/2024 527 ; Initialize Audio Device (bh = 3) 528 sys _audio, 0301h, 0, audio_int_handler 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 0000046D BB01030000 <1> mov ebx, %2 78 <1> %if %0 >= 3 79 00000472 B900000000 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00000477 BA[B6050000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 0000047C B820000000 <1> mov eax, %1 86 <1> 87 00000481 CD40 <1> int 40h 529 ;jc short error_exit 530 00000483 0F82CEFCFFFF jc init_err 531 _3: 532 533 %endif 534 535 ; 536 ; position file pointer to start in actual wav data 537 ; MUCH improvement should really be done here to check if sample size is 538 ; supported, make sure there are 2 channels, etc. 539 ; 540 ;mov ah, 42h 541 ;mov al, 0 ; from start of file 542 ;mov bx, [FileHandle] 543 ;xor cx, cx 544 ;mov dx, 44 ; jump past .wav/riff header 545 ;int 21h 546 547 sys _seek, [FileHandle], 44, 0 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00000489 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 0000048F B92C000000 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00000494 BA00000000 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00000499 B813000000 <1> mov eax, %1 86 <1> 87 0000049E CD40 <1> int 40h 548 549 sys _msg, nextline, 255, 07h ; 01/05/2017 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 000004A0 BB[9B240000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 000004A5 B9FF000000 <1> mov ecx, %3 80 <1> %if %0 = 4 81 000004AA BA07000000 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 000004AF B823000000 <1> mov eax, %1 86 <1> 87 000004B4 CD40 <1> int 40h 550 551 ; play the .wav file. Most of the good stuff is in here. 552 553 000004B6 E8C2010000 call PlayWav 554 555 ; close the .wav file and exit. 556 557 StopPlaying: 558 ; Stop Playing 559 sys _audio, 0700h 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 000004BB BB00070000 <1> mov ebx, %2 78 <1> %if %0 >= 3 79 <1> mov ecx, %3 80 <1> %if %0 = 4 81 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 000004C0 B820000000 <1> mov eax, %1 86 <1> 87 000004C5 CD40 <1> int 40h 560 ; Cancel callback service (for user) 561 sys _audio, 0900h 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 000004C7 BB00090000 <1> mov ebx, %2 78 <1> %if %0 >= 3 79 <1> mov ecx, %3 80 <1> %if %0 = 4 81 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 000004CC B820000000 <1> mov eax, %1 86 <1> 87 000004D1 CD40 <1> int 40h 562 ; Deallocate Audio Buffer (for user) 563 sys _audio, 0A00h 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 000004D3 BB000A0000 <1> mov ebx, %2 78 <1> %if %0 >= 3 79 <1> mov ecx, %3 80 <1> %if %0 = 4 81 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 000004D8 B820000000 <1> mov eax, %1 86 <1> 87 000004DD CD40 <1> int 40h 564 ; Disable Audio Device 565 sys _audio, 0C00h 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 000004DF BB000C0000 <1> mov ebx, %2 78 <1> %if %0 >= 3 79 <1> mov ecx, %3 80 <1> %if %0 = 4 81 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 000004E4 B820000000 <1> mov eax, %1 86 <1> 87 000004E9 CD40 <1> int 40h 566 Exit: 567 000004EB E847000000 call closeFile 568 569 sys _exit ; Bye! 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 <1> mov ebx, %2 78 <1> %if %0 >= 3 79 <1> mov ecx, %3 80 <1> %if %0 = 4 81 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 000004F0 B801000000 <1> mov eax, %1 86 <1> 87 000004F5 CD40 <1> int 40h 570 here: 571 000004F7 EBFE jmp short here 572 573 pmsg_usage: 574 sys _msg, msg_usage, 255, 0Bh 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 000004F9 BB[62230000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 000004FE B9FF000000 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00000503 BA0B000000 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00000508 B823000000 <1> mov eax, %1 86 <1> 87 0000050D CD40 <1> int 40h 575 0000050F EBDA jmp short Exit 576 577 ; 25/11/2023 578 DetectAC97: 579 ; Detect (BH=1) AC'97 (BL=2) Audio Device 580 sys _audio, 0102h 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00000511 BB02010000 <1> mov ebx, %2 78 <1> %if %0 >= 3 79 <1> mov ecx, %3 80 <1> %if %0 = 4 81 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00000516 B820000000 <1> mov eax, %1 86 <1> 87 0000051B CD40 <1> int 40h 581 582 ; 01/06/2024 583 %if 0 584 jc short DetectAC97_retn 585 586 ; 25/11/2023 587 ; Get AC'97 Codec info 588 ; (Function 14, sub function 1) 589 sys _audio, 0E01h 590 ; Save Variable Rate Audio support bit 591 and al, 1 592 mov [VRA], al 593 %endif 594 595 DetectAC97_retn: 596 0000051D C3 retn 597 598 ;open or create file 599 ; 600 ;input: ds:dx-->filename (asciiz) 601 ; al=file Mode (create or open) 602 ;output: none cs:[FileHandle] filled 603 ; 604 openFile: 605 ;mov ah, 3Bh ; start with a mode 606 ;add ah, al ; add in create or open mode 607 ;xor ecx, ecx 608 ;int 21h 609 ;jc short _of1 610 ;;mov [cs:FileHandle], ax 611 612 sys _open, wav_file_name, 0 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 0000051E BB[E9250000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 00000523 B900000000 <1> mov ecx, %3 80 <1> %if %0 = 4 81 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00000528 B805000000 <1> mov eax, %1 86 <1> 87 0000052D CD40 <1> int 40h 613 0000052F 7205 jc short _of1 614 615 00000531 A3[81220000] mov [FileHandle], eax 616 _of1: 617 00000536 C3 retn 618 619 ; close the currently open file 620 ; input: none, uses cs:[FileHandle] 621 closeFile: 622 00000537 833D[81220000]FF cmp dword [FileHandle], -1 623 0000053E 7417 je short _cf1 624 ;mov bx, [FileHandle] 625 ;mov ax, 3E00h 626 ;int 21h ;close file 627 628 sys _close, [FileHandle] 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00000540 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 <1> mov ecx, %3 80 <1> %if %0 = 4 81 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00000546 B806000000 <1> mov eax, %1 86 <1> 87 0000054B CD40 <1> int 40h 629 0000054D C705[81220000]FFFF- mov dword [FileHandle], -1 629 00000555 FFFF 630 _cf1: 631 00000557 C3 retn 632 633 getSampleRate: 634 635 ; reads the sample rate from the .wav file. 636 ; entry: none - assumes file is already open 637 ; exit: ax = sample rate (11025, 22050, 44100, 48000) 638 ; cx = number of channels (mono=1, stereo=2) 639 ; dx = bits per sample (8, 16) 640 641 00000558 53 push ebx 642 643 ;mov ah, 42h 644 ;mov al, 0 ; from start of file 645 ;mov bx, [FileHandle] 646 ;xor ecx, ecx 647 ;mov dx, 08h ; "WAVE" 648 ;int 21h 649 650 sys _seek, [FileHandle], 8, 0 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00000559 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 0000055F B908000000 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00000564 BA00000000 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00000569 B813000000 <1> mov eax, %1 86 <1> 87 0000056E CD40 <1> int 40h 651 652 ;mov dx, smpRBuff 653 ;mov cx, 28 ; 28 bytes 654 ;mov ah, 3fh 655 ;int 21h 656 657 sys _read, [FileHandle], smpRBuff, 28 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00000570 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 00000576 B9[CD250000] <1> mov ecx, %3 80 <1> %if %0 = 4 81 0000057B BA1C000000 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00000580 B803000000 <1> mov eax, %1 86 <1> 87 00000585 CD40 <1> int 40h 658 659 00000587 813D[CD250000]5741- cmp dword [smpRBuff], 'WAVE' 659 0000058F 5645 660 00000591 7520 jne short gsr_stc 661 662 00000593 66833D[D9250000]01 cmp word [smpRBuff+12], 1 ; Offset 20, must be 1 (= PCM) 663 0000059B 7516 jne short gsr_stc 664 665 0000059D 668B0D[DB250000] mov cx, [smpRBuff+14] ; return num of channels in CX 666 000005A4 66A1[DD250000] mov ax, [smpRBuff+16] ; return sample rate in AX 667 000005AA 668B15[E7250000] mov dx, [smpRBuff+26] ; return bits per sample value in DX 668 gsr_retn: 669 000005B1 5B pop ebx 670 000005B2 C3 retn 671 gsr_stc: 672 000005B3 F9 stc 673 000005B4 EBFB jmp short gsr_retn 674 675 audio_int_handler: 676 ; 13/12/2024 677 ; 18/08/2020 (14/10/2020, 'wavplay2.s') 678 679 ;mov byte [srb], 1 ; interrupt (or signal response byte) 680 681 ;cmp byte [cbs_busy], 1 682 ;jnb short _callback_bsy_retn 683 684 ;mov byte [cbs_busy], 1 685 686 ; 13/12/2024 687 ;mov al, [half_buff] 688 ; 689 ;cmp al, 1 690 ;jb short _callback_retn 691 692 ; 18/08/2020 693 ;mov byte [srb], 1 694 ; 13/12/2024 695 000005B6 FE05[CA250000] inc byte [srb] 696 697 ; 13/12/2024 698 ;xor byte [half_buff], 3 ; 2->1, 1->2 699 700 ; 13/12/2024 701 ;add al, '0' 702 ;tL0: ; 26/11/2023 703 ;mov ah, 4Eh 704 ;mov ebx, 0B8000h ; video display page address 705 ;mov [ebx], ax ; show playing buffer (1, 2) 706 ;_callback_retn: 707 ;;mov byte [cbs_busy], 0 708 ;_callback_bsy_retn: 709 sys _rele ; return from callback service 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 <1> mov ebx, %2 78 <1> %if %0 >= 3 79 <1> mov ecx, %3 80 <1> %if %0 = 4 81 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 000005BC B827000000 <1> mov eax, %1 86 <1> 87 000005C1 CD40 <1> int 40h 710 ; we must not come here ! 711 sys _exit 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 <1> mov ebx, %2 78 <1> %if %0 >= 3 79 <1> mov ecx, %3 80 <1> %if %0 = 4 81 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 000005C3 B801000000 <1> mov eax, %1 86 <1> 87 000005C8 CD40 <1> int 40h 712 713 loadFromFile: 714 ; 26/11/2023 715 000005CA F605[C8250000]01 test byte [flags], ENDOFFILE ; have we already read the 716 ; last of the file? 717 000005D1 7402 jz short lff_0 ; no 718 000005D3 F9 stc 719 000005D4 C3 retn 720 lff_0: 721 ; 13/06/2017 722 ;mov edx, BUFFERSIZE 723 ; 26/11/2023 724 000005D5 BF[00300000] mov edi, audio_buffer 725 000005DA 8B15[22040000] mov edx, [buffersize] ; bytes 726 000005E0 8A0D[3C260000] mov cl, [fbs_shift] 727 000005E6 20C9 and cl, cl 728 000005E8 7409 jz short lff_1 ; stereo, 16 bit 729 730 ; fbs_shift = 731 ; 2 for mono and 8 bit sample (multiplier = 4) 732 ; 1 for mono or 8 bit sample (multiplier = 2) 733 000005EA D3EA shr edx, cl 734 ;inc edx 735 736 000005EC BE[00300100] mov esi, temp_buffer 737 000005F1 EB02 jmp short lff_2 738 lff_1: 739 ;mov esi, audio_buffer 740 000005F3 89FE mov esi, edi ; audio_buffer 741 lff_2: 742 ; 17/03/2017 743 ; esi = buffer address 744 ; edx = buffer size 745 746 ; 26/11/2023 747 ; load file into memory 748 sys _read, [FileHandle], esi 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 000005F5 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 000005FB 89F1 <1> mov ecx, %3 80 <1> %if %0 = 4 81 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 000005FD B803000000 <1> mov eax, %1 86 <1> 87 00000602 CD40 <1> int 40h 749 ; 14/12/2024 750 00000604 8B0D[22040000] mov ecx, [buffersize] 751 ;jc short padfill ; error ! 752 ; 14/12/2024 753 0000060A 7255 jc short lff_10 754 755 0000060C 21C0 and eax, eax 756 0000060E 7453 jz short padfill 757 lff_3: 758 ; 26/11/2023 759 00000610 8A1D[3C260000] mov bl, [fbs_shift] 760 00000616 20DB and bl, bl 761 00000618 7456 jz short lff_11 762 763 ; 14/12/2024 764 ;sub ecx, eax 765 ;mov ebp, ecx 766 ; 14/12/2024 767 0000061A 29C2 sub edx, eax 768 769 ;mov esi, temp_buffer 770 ;mov edi, audio_buffer 771 0000061C 89C1 mov ecx, eax ; byte count 772 773 0000061E 803D[C1250000]08 cmp byte [bps], 8 ; bits per sample (8 or 16) 774 00000625 751E jne short lff_6 ; 16 bit samples 775 ; 8 bit samples 776 00000627 FECB dec bl ; shift count, 1 = stereo, 2 = mono 777 00000629 740E jz short lff_5 ; 8 bit, stereo 778 lff_4: 779 ; mono & 8 bit 780 0000062B AC lodsb 781 0000062C 2C80 sub al, 80h ; 08/11/2023 782 0000062E C1E008 shl eax, 8 ; convert 8 bit sample to 16 bit sample 783 00000631 66AB stosw ; left channel 784 00000633 66AB stosw ; right channel 785 00000635 E2F4 loop lff_4 786 00000637 EB16 jmp short lff_8 787 lff_5: 788 ; stereo & 8 bit 789 00000639 AC lodsb 790 0000063A 2C80 sub al, 80h ; 08/11/2023 791 0000063C C1E008 shl eax, 8 ; convert 8 bit sample to 16 bit sample 792 0000063F 66AB stosw 793 00000641 E2F6 loop lff_5 794 00000643 EB0A jmp short lff_8 795 lff_6: 796 00000645 D1E9 shr ecx, 1 ; word count 797 lff_7: 798 00000647 66AD lodsw 799 00000649 66AB stosw ; left channel 800 0000064B 66AB stosw ; right channel 801 0000064D E2F8 loop lff_7 802 lff_8: 803 ; 27/11/2023 804 0000064F F8 clc 805 ; 14/12/2024 806 ;mov ecx, ebp 807 ;jecxz endLFF_retn 808 00000650 09D2 or edx, edx 809 00000652 741B jz short endLFF_retn 810 811 ; 14/12/2024 812 00000654 B9[00300000] mov ecx, audio_buffer 813 00000659 030D[22040000] add ecx, [buffersize] 814 0000065F 29F9 sub ecx, edi 815 816 ; 14/12/2024 817 lff_10: 818 00000661 31C0 xor eax, eax ; silence 819 padfill: 820 00000663 D1E9 shr ecx, 1 821 00000665 F366AB rep stosw 822 lff_9: 823 00000668 800D[C8250000]01 or byte [flags], ENDOFFILE ; end of file flag 824 endLFF_retn: 825 0000066F C3 retn 826 827 lff_11: 828 ; 16 bit stereo 829 ; ecx = buffer size 830 ; eax = read count 831 00000670 29C1 sub ecx, eax 832 00000672 76FB jna short endLFF_retn 833 00000674 01C7 add edi, eax ; audio_buffer + eax 834 00000676 EBE9 jmp short lff_10 ; padfill 835 836 error_exit_2: 837 ; 26/11/2023 - temporary 838 ;sys _msg, test_2, 255, 0Ch 839 840 00000678 E9C2FDFFFF jmp error_exit 841 842 ; 26/11/2023 - temporary 843 ;test_1: 844 ; db 13, 10, 'Test 1', 13,10, 0 845 ;test_2: 846 ; db 13, 10, 'Test 2', 13,10, 0 847 848 PlayWav: 849 ; 26/11/2023 850 ; 18/08/2020 (27/07/2020, 'wavplay2.s') 851 ; 13/06/2017 852 ; Convert 8 bit samples to 16 bit samples 853 ; and convert mono samples to stereo samples 854 855 ; 26/11/2023 856 ; load 32768 bytes into audio buffer 857 ;mov edi, audio_buffer 858 ;;mov edx, BUFFERSIZE 859 ; 26/11/2023 860 ;mov edx, [buffersize] 861 ;call loadFromFile 862 ; 26/11/2023 863 0000067D FF15[1A040000] call dword [loadfromwavfile] 864 00000683 72F3 jc short error_exit_2 865 00000685 C605[C9250000]01 mov byte [half_buff], 1 ; (DMA) Buffer 1 866 867 ; 18/08/2020 (27/07/2020, 'wavplay2.s') 868 0000068C F605[C8250000]01 test byte [flags], ENDOFFILE ; end of file 869 00000693 7512 jnz short _6 ; yes 870 ; bypass filling dma half buffer 2 871 872 ; bh = 16 : update (current, first) dma half buffer 873 ; bl = 0 : then switch to the next (second) half buffer 874 sys _audio, 1000h 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00000695 BB00100000 <1> mov ebx, %2 78 <1> %if %0 >= 3 79 <1> mov ecx, %3 80 <1> %if %0 = 4 81 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 0000069A B820000000 <1> mov eax, %1 86 <1> 87 0000069F CD40 <1> int 40h 875 876 ; 18/08/2020 877 ; [audio_flag] = 1 (in TRDOS 386 kernel) 878 879 ; audio_buffer must be filled again after above system call 880 ; (Because audio interrupt will be generated by AC97 hardware 881 ; at the end of the first half of dma buffer.. so, 882 ; the second half must be ready. 'sound_play' will use it.) 883 884 ; 26/11/2023 885 ;mov edi, audio_buffer 886 ;;mov edx, BUFFERSIZE 887 ; 26/11/2023 888 ;mov edx, [buffersize] 889 ;call loadFromFile 890 ; 26/11/2023 891 000006A1 FF15[1A040000] call dword [loadfromwavfile] 892 ;jc short p_return 893 _6: 894 ; Set Master Volume Level (BL=0 or 80h) 895 ; for next playing (BL>=80h) 896 ;sys _audio, 0B80h, 1D1Dh 897 sys _audio, 0B00h, 1D1Dh 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 000006A7 BB000B0000 <1> mov ebx, %2 78 <1> %if %0 >= 3 79 000006AC B91D1D0000 <1> mov ecx, %3 80 <1> %if %0 = 4 81 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 000006B1 B820000000 <1> mov eax, %1 86 <1> 87 000006B6 CD40 <1> int 40h 898 899 ; 18/08/2020 900 ;mov byte [volume_level], 1Dh 901 000006B8 880D[CB250000] mov [volume_level], cl 902 903 ; Start to play 904 000006BE A0[C1250000] mov al, [bps] 905 000006C3 C0E804 shr al, 4 ; 8 -> 0, 16 -> 1 906 000006C6 D0E0 shl al, 1 ; 16 -> 2, 8 -> 0 907 000006C8 8A1D[C0250000] mov bl, [stmo] 908 000006CE FECB dec bl 909 000006D0 08C3 or bl, al 910 000006D2 668B0D[C2250000] mov cx, [sample_rate] 911 000006D9 B704 mov bh, 4 ; start to play 912 sys _audio 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 <1> mov ebx, %2 78 <1> %if %0 >= 3 79 <1> mov ecx, %3 80 <1> %if %0 = 4 81 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 000006DB B820000000 <1> mov eax, %1 86 <1> 87 000006E0 CD40 <1> int 40h 913 914 ;mov ebx, 0B8000h ; video display page address 915 ;mov ah, 4Eh 916 ;mov al, [half_buffer] 917 ;mov [ebx], ax ; show playing buffer (1, 2) 918 919 ; 18/08/2020 (27/07/2020, 'wavplay2.s') 920 ; Here.. 921 ; If byte [flags] <> ENDOFFILE ... 922 ; user's audio_buffer has been copied to dma half buffer 2 923 924 ; [audio_flag] = 0 (in TRDOS 386 kernel) 925 926 ; audio_buffer must be filled again after above system call 927 ; (Because, audio interrupt will be generated by VT8237R 928 ; at the end of the first half of dma buffer.. so, 929 ; the 2nd half of dma buffer is ready but the 1st half 930 ; must be filled again.) 931 932 ; 14/12/2024 933 %if 0 934 ; 18/08/2020 935 test byte [flags], ENDOFFILE ; end of file 936 jnz short p_loop ; yes 937 938 ; 18/08/2020 939 ; load 32768 bytes into audio buffer 940 ;; (for the second half of DMA buffer) 941 ; 27/11/2023 942 ; 20/05/2017 943 ;mov edi, audio_buffer 944 ;mov edx, BUFFERSIZE 945 ; 26/11/2023 946 ;mov edx, [buffersize] 947 ;call loadFromFile 948 ; 26/11/2023 949 call dword [loadfromwavfile] 950 ;jc short p_return 951 ;mov byte [half_buff], 2 ; (DMA) Buffer 2 952 %endif 953 954 ; we need to wait for 'SRB' (audio interrupt) 955 ; (we can not return from 'PlayWav' here 956 ; even if we have got an error from file reading) 957 ; ((!!current audio data must be played!!)) 958 959 ; 18/08/2020 960 ;mov byte [srb], 1 961 962 p_loop: 963 ;mov ah, 1 ; any key pressed? 964 ;int 32h ; no, Loop. 965 ;jz short q_loop 966 ; 967 ;mov ah, 0 ; flush key buffer... 968 ;int 32h 969 970 ; 18/08/2020 (14/10/2017, 'wavplay2.s') 971 000006E2 803D[CA250000]00 cmp byte [srb], 0 972 000006E9 7627 jna short q_loop 973 000006EB C605[CA250000]00 mov byte [srb], 0 974 ; 13/12/2024 975 000006F2 8035[C9250000]03 xor byte [half_buff], 3 ; 2->1, 1->2 976 977 ; 27/11/2023 978 ;mov edi, audio_buffer 979 ;mov edx, BUFFERSIZE 980 ; 26/11/2023 981 ;mov edx, [buffersize] 982 ;call loadFromFile 983 ; 26/11/2023 984 000006F9 FF15[1A040000] call dword [loadfromwavfile] 985 000006FF 7223 jc short p_return 986 987 ; 14/12/2024 988 ;;; 989 ; bh = 16 : update (current, first) dma half buffer 990 ; bl = 0 : then switch to the other half buffer 991 sys _audio, 1000h 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00000701 BB00100000 <1> mov ebx, %2 78 <1> %if %0 >= 3 79 <1> mov ecx, %3 80 <1> %if %0 = 4 81 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00000706 B820000000 <1> mov eax, %1 86 <1> 87 0000070B CD40 <1> int 40h 992 ;;;; 993 994 ; 13/12/2024 995 0000070D E819000000 call tL0 996 q_loop: 997 00000712 B401 mov ah, 1 ; any key pressed? 998 00000714 CD32 int 32h ; no, Loop. 999 00000716 74CA jz short p_loop 1000 1001 00000718 B400 mov ah, 0 ; flush key buffer... 1002 0000071A CD32 int 32h 1003 1004 0000071C 3C2B cmp al, '+' ; increase sound volume 1005 0000071E 741D je short inc_volume_level 1006 00000720 3C2D cmp al, '-' 1007 00000722 743C je short dec_volume_level 1008 1009 p_return: 1010 00000724 C605[C9250000]00 mov byte [half_buff], 0 1011 ; 13/12/2024 1012 ;call tL0 1013 ;retn 1014 1015 ; 13/12/2024 1016 tL0: 1017 0000072B A0[C9250000] mov al, [half_buff] 1018 00000730 0430 add al, '0' 1019 00000732 B44E mov ah, 4Eh 1020 00000734 BB00800B00 mov ebx, 0B8000h ; video display page address 1021 00000739 668903 mov [ebx], ax ; show playing buffer (1, 2) 1022 0000073C C3 retn 1023 1024 ; 18/08/2020 (14/10/2017, 'wavplay2.s') 1025 inc_volume_level: 1026 0000073D 8A0D[CB250000] mov cl, [volume_level] 1027 00000743 80F91F cmp cl, 1Fh ; 31 1028 00000746 73CA jnb short q_loop 1029 00000748 FEC1 inc cl 1030 change_volume_level: 1031 0000074A 880D[CB250000] mov [volume_level], cl 1032 00000750 88CD mov ch, cl 1033 ; Set Master Volume Level 1034 sys _audio, 0B00h 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00000752 BB000B0000 <1> mov ebx, %2 78 <1> %if %0 >= 3 79 <1> mov ecx, %3 80 <1> %if %0 = 4 81 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00000757 B820000000 <1> mov eax, %1 86 <1> 87 0000075C CD40 <1> int 40h 1035 0000075E EB82 jmp short p_loop 1036 dec_volume_level: 1037 00000760 8A0D[CB250000] mov cl, [volume_level] 1038 00000766 80F901 cmp cl, 1 ; 1 1039 ;jna short p_loop 1040 ; 14/12/2024 1041 00000769 76A7 jna short q_loop 1042 0000076B FEC9 dec cl 1043 0000076D EBDB jmp short change_volume_level 1044 1045 write_audio_dev_info: 1046 ; EBX = Message address 1047 ; ECX = Max. message length (or stop on ZERO character) 1048 ; (1 to 255) 1049 ; DL = Message color (07h = light gray, 0Fh = white) 1050 sys _msg, msgAudioCardInfo, 255, 0Fh 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 0000076F BB[39230000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 00000774 B9FF000000 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00000779 BA0F000000 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 0000077E B823000000 <1> mov eax, %1 86 <1> 87 00000783 CD40 <1> int 40h 1051 00000785 C3 retn 1052 1053 write_wav_file_info: 1054 ; 01/05/2017 1055 sys _msg, msgWavFileName, 255, 0Fh 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00000786 BB[4F240000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 0000078B B9FF000000 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00000790 BA0F000000 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00000795 B823000000 <1> mov eax, %1 86 <1> 87 0000079A CD40 <1> int 40h 1056 sys _msg, wav_file_name, 255, 0Fh 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 0000079C BB[E9250000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 000007A1 B9FF000000 <1> mov ecx, %3 80 <1> %if %0 = 4 81 000007A6 BA0F000000 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 000007AB B823000000 <1> mov eax, %1 86 <1> 87 000007B0 CD40 <1> int 40h 1057 1058 write_sample_rate: 1059 ; 01/05/2017 1060 000007B2 66A1[C2250000] mov ax, [sample_rate] 1061 ; ax = sample rate (hertz) 1062 000007B8 31D2 xor edx, edx 1063 000007BA 66B90A00 mov cx, 10 1064 000007BE 66F7F1 div cx 1065 000007C1 0015[74240000] add [msgHertz+4], dl 1066 000007C7 29D2 sub edx, edx 1067 000007C9 66F7F1 div cx 1068 000007CC 0015[73240000] add [msgHertz+3], dl 1069 000007D2 29D2 sub edx, edx 1070 000007D4 66F7F1 div cx 1071 000007D7 0015[72240000] add [msgHertz+2], dl 1072 000007DD 29D2 sub edx, edx 1073 000007DF 66F7F1 div cx 1074 000007E2 0015[71240000] add [msgHertz+1], dl 1075 000007E8 0005[70240000] add [msgHertz], al 1076 1077 sys _msg, msgSampleRate, 255, 0Fh 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 000007EE BB[61240000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 000007F3 B9FF000000 <1> mov ecx, %3 80 <1> %if %0 = 4 81 000007F8 BA0F000000 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 000007FD B823000000 <1> mov eax, %1 86 <1> 87 00000802 CD40 <1> int 40h 1078 1079 00000804 BE[8B240000] mov esi, msg16Bits 1080 00000809 803D[C1250000]10 cmp byte [bps], 16 1081 00000810 7405 je short wsr_1 1082 00000812 BE[7B240000] mov esi, msg8Bits 1083 wsr_1: 1084 sys _msg, esi, 255, 0Fh 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00000817 89F3 <1> mov ebx, %2 78 <1> %if %0 >= 3 79 00000819 B9FF000000 <1> mov ecx, %3 80 <1> %if %0 = 4 81 0000081E BA0F000000 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00000823 B823000000 <1> mov eax, %1 86 <1> 87 00000828 CD40 <1> int 40h 1085 1086 0000082A BE[84240000] mov esi, msgMono 1087 0000082F 803D[C0250000]01 cmp byte [stmo], 1 1088 00000836 7405 je short wsr_2 1089 00000838 BE[95240000] mov esi, msgStereo 1090 wsr_2: 1091 sys _msg, esi, 255, 0Fh 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 0000083D 89F3 <1> mov ebx, %2 78 <1> %if %0 >= 3 79 0000083F B9FF000000 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00000844 BA0F000000 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00000849 B823000000 <1> mov eax, %1 86 <1> 87 0000084E CD40 <1> int 40h 1092 00000850 C3 retn 1093 1094 write_ac97_pci_dev_info: 1095 ; 06/06/2017 1096 ; 03/06/2017 1097 ; BUS/DEV/FN 1098 ; 00000000BBBBBBBBDDDDDFFF00000000 1099 ; DEV/VENDOR 1100 ; DDDDDDDDDDDDDDDDVVVVVVVVVVVVVVVV 1101 1102 00000851 8B35[3D260000] mov esi, [dev_vendor] 1103 00000857 89F0 mov eax, esi 1104 00000859 0FB6D8 movzx ebx, al 1105 0000085C 88DA mov dl, bl 1106 0000085E 80E30F and bl, 0Fh 1107 00000861 8A83[9E240000] mov al, [ebx+hex_chars] 1108 00000867 A2[E3240000] mov [msgVendorId+3], al 1109 0000086C 88D3 mov bl, dl 1110 0000086E C0EB04 shr bl, 4 1111 00000871 8A83[9E240000] mov al, [ebx+hex_chars] 1112 00000877 A2[E2240000] mov [msgVendorId+2], al 1113 0000087C 88E3 mov bl, ah 1114 0000087E 88DA mov dl, bl 1115 00000880 80E30F and bl, 0Fh 1116 00000883 8A83[9E240000] mov al, [ebx+hex_chars] 1117 00000889 A2[E1240000] mov [msgVendorId+1], al 1118 0000088E 88D3 mov bl, dl 1119 00000890 C0EB04 shr bl, 4 1120 00000893 8A83[9E240000] mov al, [ebx+hex_chars] 1121 00000899 A2[E0240000] mov [msgVendorId], al 1122 0000089E C1E810 shr eax, 16 1123 000008A1 88C3 mov bl, al 1124 000008A3 88DA mov dl, bl 1125 000008A5 80E30F and bl, 0Fh 1126 000008A8 8A83[9E240000] mov al, [ebx+hex_chars] 1127 000008AE A2[F4240000] mov [msgDevId+3], al 1128 000008B3 88D3 mov bl, dl 1129 000008B5 C0EB04 shr bl, 4 1130 000008B8 8A83[9E240000] mov al, [ebx+hex_chars] 1131 000008BE A2[F3240000] mov [msgDevId+2], al 1132 000008C3 88E3 mov bl, ah 1133 000008C5 88DA mov dl, bl 1134 000008C7 80E30F and bl, 0Fh 1135 000008CA 8A83[9E240000] mov al, [ebx+hex_chars] 1136 000008D0 A2[F2240000] mov [msgDevId+1], al 1137 000008D5 88D3 mov bl, dl 1138 000008D7 C0EB04 shr bl, 4 1139 000008DA 8A83[9E240000] mov al, [ebx+hex_chars] 1140 000008E0 A2[F1240000] mov [msgDevId], al 1141 1142 000008E5 8B35[41260000] mov esi, [bus_dev_fn] 1143 000008EB C1EE08 shr esi, 8 1144 000008EE 6689F0 mov ax, si 1145 000008F1 88C3 mov bl, al 1146 000008F3 88DA mov dl, bl 1147 000008F5 80E307 and bl, 7 ; bit 0,1,2 1148 000008F8 8A83[9E240000] mov al, [ebx+hex_chars] 1149 000008FE A2[18250000] mov [msgFncNo+1], al 1150 00000903 88D3 mov bl, dl 1151 00000905 C0EB03 shr bl, 3 1152 00000908 88DA mov dl, bl 1153 0000090A 80E30F and bl, 0Fh 1154 0000090D 8A83[9E240000] mov al, [ebx+hex_chars] 1155 00000913 A2[0A250000] mov [msgDevNo+1], al 1156 00000918 88D3 mov bl, dl 1157 0000091A C0EB04 shr bl, 4 1158 0000091D 8A83[9E240000] mov al, [ebx+hex_chars] 1159 00000923 A2[09250000] mov [msgDevNo], al 1160 00000928 88E3 mov bl, ah 1161 0000092A 88DA mov dl, bl 1162 0000092C 80E30F and bl, 0Fh 1163 0000092F 8A83[9E240000] mov al, [ebx+hex_chars] 1164 00000935 A2[FE240000] mov [msgBusNo+1], al 1165 0000093A 88D3 mov bl, dl 1166 0000093C C0EB04 shr bl, 4 1167 0000093F 8A83[9E240000] mov al, [ebx+hex_chars] 1168 00000945 A2[FD240000] mov [msgBusNo], al 1169 1170 0000094A 66A1[45260000] mov ax, [ac97_NamBar] 1171 00000950 88C3 mov bl, al 1172 00000952 88DA mov dl, bl 1173 00000954 80E30F and bl, 0Fh 1174 00000957 8A83[9E240000] mov al, [ebx+hex_chars] 1175 0000095D A2[27250000] mov [msgNamBar+3], al 1176 00000962 88D3 mov bl, dl 1177 00000964 C0EB04 shr bl, 4 1178 00000967 8A83[9E240000] mov al, [ebx+hex_chars] 1179 0000096D A2[26250000] mov [msgNamBar+2], al 1180 00000972 88E3 mov bl, ah 1181 00000974 88DA mov dl, bl 1182 00000976 80E30F and bl, 0Fh 1183 00000979 8A83[9E240000] mov al, [ebx+hex_chars] 1184 0000097F A2[25250000] mov [msgNamBar+1], al 1185 00000984 88D3 mov bl, dl 1186 00000986 C0EB04 shr bl, 4 1187 00000989 8A83[9E240000] mov al, [ebx+hex_chars] 1188 0000098F A2[24250000] mov [msgNamBar], al 1189 1190 00000994 66A1[47260000] mov ax, [ac97_NabmBar] 1191 0000099A 88C3 mov bl, al 1192 0000099C 88DA mov dl, bl 1193 0000099E 80E30F and bl, 0Fh 1194 000009A1 8A83[9E240000] mov al, [ebx+hex_chars] 1195 000009A7 A2[37250000] mov [msgNabmBar+3], al 1196 000009AC 88D3 mov bl, dl 1197 000009AE C0EB04 shr bl, 4 1198 000009B1 8A83[9E240000] mov al, [ebx+hex_chars] 1199 000009B7 A2[36250000] mov [msgNabmBar+2], al 1200 000009BC 88E3 mov bl, ah 1201 000009BE 88DA mov dl, bl 1202 000009C0 80E30F and bl, 0Fh 1203 000009C3 8A83[9E240000] mov al, [ebx+hex_chars] 1204 000009C9 A2[35250000] mov [msgNabmBar+1], al 1205 000009CE 88D3 mov bl, dl 1206 000009D0 C0EB04 shr bl, 4 1207 000009D3 8A83[9E240000] mov al, [ebx+hex_chars] 1208 000009D9 A2[34250000] mov [msgNabmBar], al 1209 1210 000009DE 30E4 xor ah, ah 1211 000009E0 A0[3B260000] mov al, [ac97_int_ln_reg] 1212 000009E5 B10A mov cl, 10 1213 000009E7 F6F1 div cl 1214 000009E9 660105[40250000] add [msgIRQ], ax 1215 000009F0 20C0 and al, al 1216 000009F2 750D jnz short _w_ac97imsg_ 1217 000009F4 A0[41250000] mov al, [msgIRQ+1] 1218 000009F9 B420 mov ah, ' ' 1219 000009FB 66A3[40250000] mov [msgIRQ], ax 1220 _w_ac97imsg_: 1221 sys _msg, msgAC97Info, 255, 07h 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00000A01 BB[AF240000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 00000A06 B9FF000000 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00000A0B BA07000000 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00000A10 B823000000 <1> mov eax, %1 86 <1> 87 00000A15 CD40 <1> int 40h 1222 1223 00000A17 C3 retn 1224 1225 write_VRA_info: 1226 ; 25/11/2023 1227 sys _msg, msgVRAheader, 255, 07h 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00000A18 BB[78250000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 00000A1D B9FF000000 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00000A22 BA07000000 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00000A27 B823000000 <1> mov eax, %1 86 <1> 87 00000A2C CD40 <1> int 40h 1228 00000A2E 803D[CC250000]00 cmp byte [VRA], 0 1229 00000A35 7617 jna short _w_VRAi_no 1230 _w_VRAi_yes: 1231 sys _msg, msgVRAyes, 255, 07h 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00000A37 BB[86250000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 00000A3C B9FF000000 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00000A41 BA07000000 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00000A46 B823000000 <1> mov eax, %1 86 <1> 87 00000A4B CD40 <1> int 40h 1232 00000A4D C3 retn 1233 _w_VRAi_no: 1234 sys _msg, msgVRAno, 255, 07h 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00000A4E BB[8C250000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 00000A53 B9FF000000 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00000A58 BA07000000 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00000A5D B823000000 <1> mov eax, %1 86 <1> 87 00000A62 CD40 <1> int 40h 1235 00000A64 C3 retn 1236 1237 ; 06/06/2024 1238 write_codec_info: 1239 00000A65 89DA mov edx, ebx 1240 00000A67 83E30F and ebx, 0Fh 1241 00000A6A 8A83[9E240000] mov al, [ebx+hex_chars] 1242 00000A70 A2[71250000] mov [msgCodecId2+3], al 1243 00000A75 88D3 mov bl, dl 1244 00000A77 C0EB04 shr bl, 4 1245 00000A7A 8A83[9E240000] mov al, [ebx+hex_chars] 1246 00000A80 A2[70250000] mov [msgCodecId2+2], al 1247 00000A85 88F3 mov bl, dh 1248 00000A87 80E30F and bl, 0Fh 1249 00000A8A 8A83[9E240000] mov al, [ebx+hex_chars] 1250 00000A90 A2[6F250000] mov [msgCodecId2+1], al 1251 00000A95 88F3 mov bl, dh 1252 00000A97 C0EB04 shr bl, 4 1253 00000A9A 8A83[9E240000] mov al, [ebx+hex_chars] 1254 00000AA0 A2[6E250000] mov [msgCodecId2], al 1255 00000AA5 C1EA10 shr edx, 16 1256 00000AA8 88D3 mov bl, dl 1257 00000AAA 80E30F and bl, 0Fh 1258 00000AAD 8A83[9E240000] mov al, [ebx+hex_chars] 1259 00000AB3 A2[5E250000] mov [msgCodecId1+3], al 1260 00000AB8 88D3 mov bl, dl 1261 00000ABA C0EB04 shr bl, 4 1262 00000ABD 8A83[9E240000] mov al, [ebx+hex_chars] 1263 00000AC3 A2[5D250000] mov [msgCodecId1+2], al 1264 00000AC8 88F3 mov bl, dh 1265 00000ACA 80E30F and bl, 0Fh 1266 00000ACD 8A83[9E240000] mov al, [ebx+hex_chars] 1267 00000AD3 A2[5C250000] mov [msgCodecId1+1], al 1268 00000AD8 88F3 mov bl, dh 1269 00000ADA C0EB04 shr bl, 4 1270 00000ADD 8A83[9E240000] mov al, [ebx+hex_chars] 1271 00000AE3 A2[5B250000] mov [msgCodecId1], al 1272 ; 1273 sys _msg, msgCodec, 255, 07h 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00000AE8 BB[45250000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 00000AED B9FF000000 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00000AF2 BA07000000 <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00000AF7 B823000000 <1> mov eax, %1 86 <1> 87 00000AFC CD40 <1> int 40h 1274 00000AFE C3 retn 1275 1276 ; 02/02/2025 1277 ; 1278 ; 26/11/2023 1279 ; 25/11/2023 - playwav6.s (32 bit registers, TRDOS 386 adaption) 1280 ; 15/11/2023 - PLAYWAV5.COM, ich_wav5.asm 1281 ; 14/11/2023 1282 ; 13/11/2023 - Erdogan Tan - (VRA, sample rate conversion) 1283 ; -------------------------------------------------------- 1284 1285 ;;Note: At the end of every buffer load, 1286 ;; during buffer switch/swap, there will be discontinuity 1287 ;; between the last converted sample and the 1st sample 1288 ;; of the next buffer. 1289 ;; (like as a dot noises vaguely between normal sound samples) 1290 ;; -To avoid this defect, the 1st sample of 1291 ;; the next buffer may be read from the wav file but 1292 ;; the file pointer would need to be set to 1 sample back 1293 ;; again via seek system call. Time comsumption problem! - 1294 ;; 1295 ;; Erdogan Tan - 15/11/2023 1296 ;; 1297 ;; ((If entire wav data would be loaded at once.. conversion 1298 ;; defect/noise would disappear.. but for DOS, to keep 1299 ;; 64KB buffer limit is important also it is important 1300 ;; for running under 1MB barrier without HIMEM.SYS or DPMI. 1301 ;; I have tested this program by using 2-30MB wav files.)) 1302 ;; 1303 ;; Test Computer: ASUS desktop/mainboard, M2N4-SLI, 2010. 1304 ;; AMD Athlon 64 X2 2200 MHZ CPU. 1305 ;; NFORCE4 (CK804) AC97 audio hardware. 1306 ;; Realtek ALC850 codec. 1307 ;; Retro DOS v4.2 (MSDOS 6.22) operating system. 1308 1309 load_8khz_mono_8_bit: 1310 ; 02/02/2025 1311 ; 15/11/2023 1312 ; 14/11/2023 1313 ; 13/11/2023 1314 00000AFF F605[C8250000]01 test byte [flags], ENDOFFILE ; have we already read the 1315 ; last of the file? 1316 00000B06 7402 jz short lff8m_0 ; no 1317 00000B08 F9 stc 1318 00000B09 C3 retn 1319 1320 lff8m_0: 1321 00000B0A BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 1322 ;mov edx, [loadsize] 1323 1324 ; esi = buffer address 1325 ;; edx = buffer size 1326 1327 ; load file into memory 1328 sys _read, [FileHandle], esi, [loadsize] 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00000B0F 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 00000B15 89F1 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00000B17 8B15[1E040000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00000B1D B803000000 <1> mov eax, %1 86 <1> 87 00000B22 CD40 <1> int 40h 1329 00000B24 7305 jnc short lff8m_6 1330 00000B26 E9AF000000 jmp lff8m_5 ; error ! 1331 1332 lff8m_6: 1333 00000B2B BF[00300000] mov edi, audio_buffer 1334 00000B30 21C0 and eax, eax 1335 00000B32 0F8499000000 jz lff8_eof 1336 1337 00000B38 89C1 mov ecx, eax ; byte count 1338 lff8m_1: 1339 00000B3A AC lodsb 1340 00000B3B A2[78220000] mov [previous_val], al 1341 00000B40 2C80 sub al, 80h 1342 00000B42 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 1343 00000B46 66AB stosw ; original sample (left channel) 1344 00000B48 66AB stosw ; original sample (right channel) 1345 ; 02/02/2025 1346 ;xor eax, eax 1347 00000B4A 8A06 mov al, [esi] 1348 00000B4C 49 dec ecx 1349 00000B4D 7502 jnz short lff8m_2 1350 00000B4F B080 mov al, 80h 1351 lff8m_2: 1352 ;mov [next_val], ax 1353 00000B51 88C7 mov bh, al ; [next_val] 1354 00000B53 8A25[78220000] mov ah, [previous_val] 1355 00000B59 00E0 add al, ah ; [previous_val] 1356 00000B5B D0D8 rcr al, 1 1357 00000B5D 88C2 mov dl, al ; this is interpolated middle (3th) sample 1358 00000B5F 00E0 add al, ah ; [previous_val] 1359 00000B61 D0D8 rcr al, 1 1360 00000B63 88C3 mov bl, al ; this is temporary interpolation value 1361 00000B65 00E0 add al, ah ; [previous_val] 1362 00000B67 D0D8 rcr al, 1 1363 00000B69 2C80 sub al, 80h 1364 00000B6B 66C1E008 shl ax, 8 1365 00000B6F 66AB stosw ; this is 1st interpolated sample (L) 1366 00000B71 66AB stosw ; this is 1st interpolated sample (R) 1367 00000B73 88D8 mov al, bl 1368 00000B75 00D0 add al, dl 1369 00000B77 D0D8 rcr al, 1 1370 00000B79 2C80 sub al, 80h 1371 00000B7B 66C1E008 shl ax, 8 1372 00000B7F 66AB stosw ; this is 2nd interpolated sample (L) 1373 00000B81 66AB stosw ; this is 2nd interpolated sample (R) 1374 00000B83 88D0 mov al, dl 1375 00000B85 2C80 sub al, 80h 1376 00000B87 66C1E008 shl ax, 8 1377 00000B8B 66AB stosw ; this is middle (3th) interpolated sample (L) 1378 00000B8D 66AB stosw ; this is middle (3th) interpolated sample (R) 1379 ;mov al, [next_val] 1380 00000B8F 88F8 mov al, bh 1381 00000B91 00D0 add al, dl 1382 00000B93 D0D8 rcr al, 1 1383 00000B95 88C3 mov bl, al ; this is temporary interpolation value 1384 00000B97 00D0 add al, dl 1385 00000B99 D0D8 rcr al, 1 1386 00000B9B 2C80 sub al, 80h 1387 00000B9D 66C1E008 shl ax, 8 1388 00000BA1 66AB stosw ; this is 4th interpolated sample (L) 1389 00000BA3 66AB stosw ; this is 4th interpolated sample (R) 1390 ;mov al, [next_val] 1391 00000BA5 88F8 mov al, bh 1392 00000BA7 00D8 add al, bl 1393 00000BA9 D0D8 rcr al, 1 1394 00000BAB 2C80 sub al, 80h 1395 00000BAD 66C1E008 shl ax, 8 1396 00000BB1 66AB stosw ; this is 5th interpolated sample (L) 1397 00000BB3 66AB stosw ; this is 5th interpolated sample (R) 1398 ; 8 kHZ mono to 48 kHZ stereo conversion of the sample is OK 1399 00000BB5 09C9 or ecx, ecx 1400 00000BB7 7581 jnz short lff8m_1 1401 1402 ; -------------- 1403 1404 lff8s_3: 1405 lff8m_3: 1406 lff8s2_3: 1407 lff8m2_3: 1408 lff16s_3: 1409 lff16m_3: 1410 lff16s2_3: 1411 lff16m2_3: 1412 lff24_3: 1413 lff32_3: 1414 lff44_3: 1415 lff22_3: 1416 lff11_3: 1417 lff12_3: ; 02/02/2025 1418 ; 08/12/2024 (BugFix) 1419 ; 01/06/2024 (BugFix) 1420 00000BB9 8B0D[22040000] mov ecx, [buffersize] ; 16 bit (48 kHZ, stereo) sample size 1421 ;shl ecx, 1 ; byte count ; Bug ! 1422 ; 08/12/2024 1423 00000BBF 81C1[00300000] add ecx, audio_buffer 1424 00000BC5 29F9 sub ecx, edi 1425 00000BC7 7607 jna short lff8m_4 1426 ;inc ecx 1427 00000BC9 C1E902 shr ecx, 2 1428 00000BCC 31C0 xor eax, eax ; fill (remain part of) buffer with zeros 1429 00000BCE F3AB rep stosd 1430 lff8m_4: 1431 ; 01/06/2024 (BugFix) 1432 ; cf=1 ; Bug ! 1433 ; 08/12/2024 1434 ;clc 1435 00000BD0 C3 retn 1436 1437 lff8_eof: 1438 lff16_eof: 1439 lff24_eof: 1440 lff32_eof: 1441 lff44_eof: 1442 lff22_eof: 1443 lff11_eof: 1444 lff12_eof: ; 02/02/2025 1445 ; 15/11/2023 1446 00000BD1 C605[C8250000]01 mov byte [flags], ENDOFFILE 1447 00000BD8 EBDF jmp short lff8m_3 1448 1449 lff8s_5: 1450 lff8m_5: 1451 lff8s2_5: 1452 lff8m2_5: 1453 lff16s_5: 1454 lff16m_5: 1455 lff16s2_5: 1456 lff16m2_5: 1457 lff24_5: 1458 lff32_5: 1459 lff44_5: 1460 lff22_5: 1461 lff11_5: 1462 lff12_5: ; 02/02/2025 1463 00000BDA B021 mov al, '!' ; error 1464 00000BDC E84AFBFFFF call tL0 1465 1466 ;jmp short lff8m_3 1467 ; 15/11/2023 1468 00000BE1 EBEE jmp lff8_eof 1469 1470 ; -------------- 1471 1472 load_8khz_stereo_8_bit: 1473 ; 02/02/2025 1474 ; 15/11/2023 1475 ; 14/11/2023 1476 ; 13/11/2023 1477 00000BE3 F605[C8250000]01 test byte [flags], ENDOFFILE ; have we already read the 1478 ; last of the file? 1479 00000BEA 7402 jz short lff8s_0 ; no 1480 00000BEC F9 stc 1481 00000BED C3 retn 1482 1483 lff8s_0: 1484 00000BEE BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 1485 ;mov edx, [loadsize] 1486 1487 ; esi = buffer address 1488 ;; edx = buffer size 1489 1490 ; load file into memory 1491 sys _read, [FileHandle], esi, [loadsize] 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00000BF3 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 00000BF9 89F1 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00000BFB 8B15[1E040000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00000C01 B803000000 <1> mov eax, %1 86 <1> 87 00000C06 CD40 <1> int 40h 1492 00000C08 72D0 jc short lff8s_5 ; error ! 1493 1494 00000C0A BF[00300000] mov edi, audio_buffer 1495 1496 00000C0F D1E8 shr eax, 1 1497 00000C11 74BE jz short lff8_eof 1498 1499 00000C13 89C1 mov ecx, eax ; word count 1500 lff8s_1: 1501 00000C15 AC lodsb 1502 00000C16 A2[78220000] mov [previous_val_l], al 1503 00000C1B 2C80 sub al, 80h 1504 00000C1D 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 1505 00000C21 66AB stosw ; original sample (L) 1506 00000C23 AC lodsb 1507 00000C24 A2[7A220000] mov [previous_val_r], al 1508 00000C29 2C80 sub al, 80h 1509 00000C2B 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 1510 00000C2F 66AB stosw ; original sample (R) 1511 1512 ;xor eax, eax 1513 ; 02/02/2025 1514 00000C31 668B06 mov ax, [esi] 1515 00000C34 49 dec ecx 1516 00000C35 7504 jnz short lff8s_2 1517 ; convert 8 bit sample to 16 bit sample 1518 00000C37 66B88080 mov ax, 8080h 1519 lff8s_2: 1520 00000C3B A2[7C220000] mov [next_val_l], al 1521 00000C40 8825[7E220000] mov [next_val_r], ah 1522 00000C46 8A25[78220000] mov ah, [previous_val_l] 1523 00000C4C 00E0 add al, ah 1524 00000C4E D0D8 rcr al, 1 1525 00000C50 88C2 mov dl, al ; this is interpolated middle (3th) sample (L) 1526 00000C52 00E0 add al, ah 1527 00000C54 D0D8 rcr al, 1 1528 00000C56 88C3 mov bl, al ; this is temporary interpolation value (L) 1529 00000C58 00E0 add al, ah 1530 00000C5A D0D8 rcr al, 1 1531 00000C5C 2C80 sub al, 80h 1532 00000C5E 66C1E008 shl ax, 8 1533 00000C62 66AB stosw ; this is 1st interpolated sample (L) 1534 00000C64 A0[7E220000] mov al, [next_val_r] 1535 00000C69 8A25[7A220000] mov ah, [previous_val_r] 1536 00000C6F 00E0 add al, ah 1537 00000C71 D0D8 rcr al, 1 1538 00000C73 88C6 mov dh, al ; this is interpolated middle (3th) sample (R) 1539 00000C75 00E0 add al, ah 1540 00000C77 D0D8 rcr al, 1 1541 00000C79 88C7 mov bh, al ; this is temporary interpolation value (R) 1542 00000C7B 00E0 add al, ah 1543 00000C7D D0D8 rcr al, 1 1544 00000C7F 2C80 sub al, 80h 1545 00000C81 66C1E008 shl ax, 8 1546 00000C85 66AB stosw ; this is 1st interpolated sample (R) 1547 00000C87 88D8 mov al, bl 1548 00000C89 00D0 add al, dl 1549 00000C8B D0D8 rcr al, 1 1550 00000C8D 2C80 sub al, 80h 1551 00000C8F 66C1E008 shl ax, 8 1552 00000C93 66AB stosw ; this is 2nd interpolated sample (L) 1553 00000C95 88F8 mov al, bh 1554 00000C97 00F0 add al, dh 1555 00000C99 D0D8 rcr al, 1 1556 00000C9B 2C80 sub al, 80h 1557 00000C9D 66C1E008 shl ax, 8 1558 00000CA1 66AB stosw ; this is 2nd interpolated sample (R) 1559 00000CA3 88D0 mov al, dl 1560 00000CA5 2C80 sub al, 80h 1561 00000CA7 66C1E008 shl ax, 8 1562 00000CAB 66AB stosw ; this is middle (3th) interpolated sample (L) 1563 00000CAD 88F0 mov al, dh 1564 00000CAF 2C80 sub al, 80h 1565 00000CB1 66C1E008 shl ax, 8 1566 00000CB5 66AB stosw ; this is middle (3th) interpolated sample (R) 1567 00000CB7 A0[7C220000] mov al, [next_val_l] 1568 00000CBC 00D0 add al, dl 1569 00000CBE D0D8 rcr al, 1 1570 00000CC0 88C3 mov bl, al ; this is temporary interpolation value (L) 1571 00000CC2 00D0 add al, dl 1572 00000CC4 D0D8 rcr al, 1 1573 00000CC6 2C80 sub al, 80h 1574 00000CC8 66C1E008 shl ax, 8 1575 00000CCC 66AB stosw ; this is 4th interpolated sample (L) 1576 00000CCE A0[7E220000] mov al, [next_val_r] 1577 00000CD3 00F0 add al, dh 1578 00000CD5 D0D8 rcr al, 1 1579 00000CD7 88C7 mov bh, al ; this is temporary interpolation value (R) 1580 00000CD9 00F0 add al, dh 1581 00000CDB D0D8 rcr al, 1 1582 00000CDD 2C80 sub al, 80h 1583 00000CDF 66C1E008 shl ax, 8 1584 00000CE3 66AB stosw ; this is 4th interpolated sample (R) 1585 00000CE5 A0[7C220000] mov al, [next_val_l] 1586 00000CEA 00D8 add al, bl 1587 00000CEC D0D8 rcr al, 1 1588 00000CEE 2C80 sub al, 80h 1589 00000CF0 66C1E008 shl ax, 8 1590 00000CF4 66AB stosw ; this is 5th interpolated sample (L) 1591 00000CF6 A0[7E220000] mov al, [next_val_r] 1592 00000CFB 00F8 add al, bh 1593 00000CFD D0D8 rcr al, 1 1594 00000CFF 2C80 sub al, 80h 1595 00000D01 66C1E008 shl ax, 8 1596 00000D05 66AB stosw ; this is 5th interpolated sample (R) 1597 ; 8 kHZ stereo to 48 kHZ stereo conversion of the sample is OK 1598 00000D07 E305 jecxz lff8s_6 1599 00000D09 E907FFFFFF jmp lff8s_1 1600 lff8s_6: 1601 00000D0E E9A6FEFFFF jmp lff8s_3 1602 1603 load_8khz_mono_16_bit: 1604 ; 02/02/2025 1605 ; 13/11/2023 1606 00000D13 F605[C8250000]01 test byte [flags], ENDOFFILE ; have we already read the 1607 ; last of the file? 1608 00000D1A 7402 jz short lff8m2_0 ; no 1609 00000D1C F9 stc 1610 00000D1D C3 retn 1611 1612 lff8m2_0: 1613 00000D1E BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 1614 ;mov edx, [loadsize] 1615 1616 ; esi = buffer address 1617 ;; edx = buffer size 1618 1619 ; load file into memory 1620 sys _read, [FileHandle], esi, [loadsize] 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00000D23 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 00000D29 89F1 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00000D2B 8B15[1E040000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00000D31 B803000000 <1> mov eax, %1 86 <1> 87 00000D36 CD40 <1> int 40h 1621 00000D38 0F82A0000000 jc lff8m2_7 ; error ! 1622 1623 00000D3E BF[00300000] mov edi, audio_buffer 1624 1625 00000D43 D1E8 shr eax, 1 1626 00000D45 7505 jnz short lff8m2_8 1627 00000D47 E985FEFFFF jmp lff8_eof 1628 1629 lff8m2_8: 1630 00000D4C 89C1 mov ecx, eax ; word count 1631 lff8m2_1: 1632 00000D4E 66AD lodsw 1633 00000D50 66AB stosw ; original sample (left channel) 1634 00000D52 66AB stosw ; original sample (right channel) 1635 00000D54 80C480 add ah, 80h ; convert sound level to 0-65535 format 1636 00000D57 66A3[78220000] mov [previous_val], ax 1637 ; 02/02/2025 1638 00000D5D 668B06 mov ax, [esi] 1639 00000D60 49 dec ecx 1640 00000D61 7502 jnz short lff8m2_2 1641 00000D63 31C0 xor eax, eax 1642 lff8m2_2: 1643 00000D65 80C480 add ah, 80h ; convert sound level to 0-65535 format 1644 00000D68 89C5 mov ebp, eax ; [next_val] 1645 00000D6A 660305[78220000] add ax, [previous_val] 1646 00000D71 66D1D8 rcr ax, 1 1647 00000D74 89C2 mov edx, eax ; this is interpolated middle (3th) sample 1648 00000D76 660305[78220000] add ax, [previous_val] 1649 00000D7D 66D1D8 rcr ax, 1 ; this is temporary interpolation value 1650 00000D80 89C3 mov ebx, eax 1651 00000D82 660305[78220000] add ax, [previous_val] 1652 00000D89 66D1D8 rcr ax, 1 1653 00000D8C 80EC80 sub ah, 80h ; -32768 to +32767 format again 1654 00000D8F 66AB stosw ; this is 1st interpolated sample (L) 1655 00000D91 66AB stosw ; this is 1st interpolated sample (R) 1656 00000D93 89D8 mov eax, ebx 1657 00000D95 6601D0 add ax, dx 1658 00000D98 66D1D8 rcr ax, 1 1659 00000D9B 80EC80 sub ah, 80h 1660 00000D9E 66AB stosw ; this is 2nd interpolated sample (L) 1661 00000DA0 66AB stosw ; this is 2nd interpolated sample (R) 1662 00000DA2 89D0 mov eax, edx 1663 00000DA4 80EC80 sub ah, 80h ; -32768 to +32767 format again 1664 00000DA7 66AB stosw ; this is middle (3th) interpolated sample (L) 1665 00000DA9 66AB stosw ; this is middle (3th) interpolated sample (R) 1666 00000DAB 89E8 mov eax, ebp 1667 00000DAD 6601D0 add ax, dx 1668 00000DB0 66D1D8 rcr ax, 1 1669 00000DB3 89C3 mov ebx, eax ; this is temporary interpolation value 1670 00000DB5 6601D0 add ax, dx 1671 00000DB8 66D1D8 rcr ax, 1 1672 00000DBB 80EC80 sub ah, 80h 1673 00000DBE 66AB stosw ; this is 4th interpolated sample (L) 1674 00000DC0 66AB stosw ; this is 4th interpolated sample (R) 1675 00000DC2 89E8 mov eax, ebp 1676 00000DC4 6601D8 add ax, bx 1677 00000DC7 66D1D8 rcr ax, 1 1678 00000DCA 80EC80 sub ah, 80h ; -32768 to +32767 format again 1679 00000DCD 66AB stosw ; this is 5th interpolated sample (L) 1680 00000DCF 66AB stosw ; this is 5th interpolated sample (R) 1681 ; 8 kHZ mono to 48 kHZ stereo conversion of the sample is OK 1682 00000DD1 09C9 or ecx, ecx 1683 00000DD3 0F8575FFFFFF jnz lff8m2_1 1684 00000DD9 E9DBFDFFFF jmp lff8m2_3 1685 1686 lff8m2_7: 1687 lff8s2_7: 1688 00000DDE E9F7FDFFFF jmp lff8m2_5 ; error 1689 1690 load_8khz_stereo_16_bit: 1691 ; 02/02/2025 1692 ; 16/11/2023 1693 ; 15/11/2023 1694 ; 13/11/2023 1695 00000DE3 F605[C8250000]01 test byte [flags], ENDOFFILE ; have we already read the 1696 ; last of the file? 1697 00000DEA 7402 jz short lff8s2_0 ; no 1698 00000DEC F9 stc 1699 00000DED C3 retn 1700 1701 lff8s2_0: 1702 00000DEE BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 1703 ;mov edx, [loadsize] 1704 1705 ; esi = buffer address 1706 ;; edx = buffer size 1707 1708 ; load file into memory 1709 sys _read, [FileHandle], esi, [loadsize] 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00000DF3 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 00000DF9 89F1 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00000DFB 8B15[1E040000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00000E01 B803000000 <1> mov eax, %1 86 <1> 87 00000E06 CD40 <1> int 40h 1710 00000E08 72D4 jc short lff8s2_7 ; error ! 1711 1712 00000E0A BF[00300000] mov edi, audio_buffer 1713 1714 00000E0F C1E802 shr eax, 2 1715 00000E12 7505 jnz short lff8s2_8 1716 00000E14 E9B8FDFFFF jmp lff8_eof 1717 1718 lff8s2_8: 1719 00000E19 89C1 mov ecx, eax ; dword count 1720 lff8s2_1: 1721 00000E1B 66AD lodsw 1722 00000E1D 66AB stosw ; original sample (L) 1723 ; 15/11/2023 1724 00000E1F 80C480 add ah, 80h ; convert sound level to 0-65535 format 1725 00000E22 66A3[78220000] mov [previous_val_l], ax 1726 00000E28 66AD lodsw 1727 00000E2A 66AB stosw ; original sample (R) 1728 00000E2C 80C480 add ah, 80h ; convert sound level to 0-65535 format 1729 00000E2F 66A3[7A220000] mov [previous_val_r], ax 1730 ; 02/02/2025 1731 00000E35 668B06 mov ax, [esi] 1732 00000E38 668B5602 mov dx, [esi+2] 1733 ; 16/11/2023 1734 00000E3C 49 dec ecx 1735 00000E3D 7504 jnz short lff8s2_2 1736 00000E3F 31D2 xor edx, edx 1737 00000E41 31C0 xor eax, eax 1738 lff8s2_2: 1739 00000E43 80C480 add ah, 80h ; convert sound level to 0-65535 format 1740 00000E46 66A3[7C220000] mov [next_val_l], ax 1741 00000E4C 80C680 add dh, 80h ; convert sound level to 0-65535 format 1742 00000E4F 668915[7E220000] mov [next_val_r], dx 1743 00000E56 660305[78220000] add ax, [previous_val_l] 1744 00000E5D 66D1D8 rcr ax, 1 1745 00000E60 89C2 mov edx, eax ; this is interpolated middle (3th) sample (L) 1746 00000E62 660305[78220000] add ax, [previous_val_l] 1747 00000E69 66D1D8 rcr ax, 1 1748 00000E6C 89C3 mov ebx, eax ; this is temporary interpolation value (L) 1749 00000E6E 660305[78220000] add ax, [previous_val_l] 1750 00000E75 66D1D8 rcr ax, 1 1751 00000E78 80EC80 sub ah, 80h ; -32768 to +32767 format again 1752 00000E7B 66AB stosw ; this is 1st interpolated sample (L) 1753 00000E7D 66A1[7E220000] mov ax, [next_val_r] 1754 00000E83 660305[7A220000] add ax, [previous_val_r] 1755 00000E8A 66D1D8 rcr ax, 1 1756 00000E8D 89C5 mov ebp, eax ; this is interpolated middle (3th) sample (R) 1757 00000E8F 660305[7A220000] add ax, [previous_val_r] 1758 00000E96 66D1D8 rcr ax, 1 1759 00000E99 50 push eax ; * ; this is temporary interpolation value (R) 1760 00000E9A 660305[7A220000] add ax, [previous_val_r] 1761 00000EA1 66D1D8 rcr ax, 1 1762 00000EA4 80EC80 sub ah, 80h 1763 00000EA7 66AB stosw ; this is 1st interpolated sample (R) 1764 00000EA9 89D8 mov eax, ebx 1765 00000EAB 6601D0 add ax, dx 1766 00000EAE 66D1D8 rcr ax, 1 1767 00000EB1 80EC80 sub ah, 80h ; -32768 to +32767 format again 1768 00000EB4 66AB stosw ; this is 2nd interpolated sample (L) 1769 00000EB6 58 pop eax ; * 1770 00000EB7 6601E8 add ax, bp 1771 00000EBA 66D1D8 rcr ax, 1 1772 00000EBD 80EC80 sub ah, 80h 1773 00000EC0 66AB stosw ; this is 2nd interpolated sample (R) 1774 00000EC2 89D0 mov eax, edx 1775 00000EC4 80EC80 sub ah, 80h 1776 00000EC7 66AB stosw ; this is middle (3th) interpolated sample (L) 1777 00000EC9 89E8 mov eax, ebp 1778 00000ECB 80EC80 sub ah, 80h ; -32768 to +32767 format again 1779 00000ECE 66AB stosw ; this is middle (3th) interpolated sample (R) 1780 00000ED0 66A1[7C220000] mov ax, [next_val_l] 1781 00000ED6 6601D0 add ax, dx 1782 00000ED9 66D1D8 rcr ax, 1 1783 00000EDC 89C3 mov ebx, eax ; this is temporary interpolation value (L) 1784 00000EDE 6601D0 add ax, dx 1785 00000EE1 66D1D8 rcr ax, 1 1786 00000EE4 80EC80 sub ah, 80h 1787 00000EE7 66AB stosw ; this is 4th interpolated sample (L) 1788 00000EE9 66A1[7E220000] mov ax, [next_val_r] 1789 00000EEF 6601E8 add ax, bp 1790 00000EF2 66D1D8 rcr ax, 1 1791 00000EF5 50 push eax ; ** ; this is temporary interpolation value (R) 1792 00000EF6 6601E8 add ax, bp 1793 00000EF9 66D1D8 rcr ax, 1 1794 00000EFC 80EC80 sub ah, 80h 1795 00000EFF 66AB stosw ; this is 4th interpolated sample (R) 1796 00000F01 66A1[7C220000] mov ax, [next_val_l] 1797 00000F07 6601D8 add ax, bx 1798 00000F0A 66D1D8 rcr ax, 1 1799 00000F0D 80EC80 sub ah, 80h ; -32768 to +32767 format again 1800 00000F10 66AB stosw ; this is 5th interpolated sample (L) 1801 00000F12 58 pop eax ; ** 1802 00000F13 660305[7E220000] add ax, [next_val_r] 1803 00000F1A 66D1D8 rcr ax, 1 1804 00000F1D 80EC80 sub ah, 80h 1805 00000F20 66AB stosw ; this is 5th interpolated sample (R) 1806 ; 8 kHZ stereo to 48 kHZ stereo conversion of the sample is OK 1807 00000F22 E305 jecxz lff8_s2_9 1808 00000F24 E9F2FEFFFF jmp lff8s2_1 1809 lff8_s2_9: 1810 00000F29 E98BFCFFFF jmp lff8s2_3 1811 1812 ; ..................... 1813 1814 load_16khz_mono_8_bit: 1815 ; 02/02/2025 1816 ; 14/11/2023 1817 ; 13/11/2023 1818 00000F2E F605[C8250000]01 test byte [flags], ENDOFFILE ; have we already read the 1819 ; last of the file? 1820 00000F35 7402 jz short lff16m_0 ; no 1821 00000F37 F9 stc 1822 00000F38 C3 retn 1823 1824 lff16m_0: 1825 00000F39 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 1826 ;mov edx, [loadsize] 1827 1828 ; esi = buffer address 1829 ;; edx = buffer size 1830 1831 ; load file into memory 1832 sys _read, [FileHandle], esi, [loadsize] 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00000F3E 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 00000F44 89F1 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00000F46 8B15[1E040000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00000F4C B803000000 <1> mov eax, %1 86 <1> 87 00000F51 CD40 <1> int 40h 1833 00000F53 7253 jc short lff16m_7 ; error ! 1834 1835 00000F55 BF[00300000] mov edi, audio_buffer 1836 1837 00000F5A 21C0 and eax, eax 1838 00000F5C 7505 jnz short lff16m_8 1839 00000F5E E96EFCFFFF jmp lff16_eof 1840 1841 lff16m_8: 1842 00000F63 89C1 mov ecx, eax ; byte count 1843 lff16m_1: 1844 00000F65 AC lodsb 1845 ;mov [previous_val], al 1846 00000F66 88C3 mov bl, al 1847 00000F68 2C80 sub al, 80h 1848 00000F6A 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 1849 00000F6E 66AB stosw ; original sample (left channel) 1850 00000F70 66AB stosw ; original sample (right channel) 1851 ;xor eax, eax 1852 ; 02/02/2025 1853 00000F72 8A06 mov al, [esi] 1854 00000F74 49 dec ecx 1855 00000F75 7502 jnz short lff16m_2 1856 ; 14/11/2023 1857 00000F77 B080 mov al, 80h 1858 lff16m_2: 1859 ;mov [next_val], al 1860 00000F79 88C7 mov bh, al 1861 ;add al, [previous_val] 1862 00000F7B 00D8 add al, bl 1863 00000F7D D0D8 rcr al, 1 1864 00000F7F 88C2 mov dl, al ; this is interpolated middle (temp) sample 1865 ;add al, [previous_val] 1866 00000F81 00D8 add al, bl 1867 00000F83 D0D8 rcr al, 1 1868 00000F85 2C80 sub al, 80h 1869 00000F87 66C1E008 shl ax, 8 1870 00000F8B 66AB stosw ; this is 1st interpolated sample (L) 1871 00000F8D 66AB stosw ; this is 1st interpolated sample (R) 1872 ;mov al, [next_val] 1873 00000F8F 88F8 mov al, bh 1874 00000F91 00D0 add al, dl 1875 00000F93 D0D8 rcr al, 1 1876 00000F95 2C80 sub al, 80h 1877 00000F97 66C1E008 shl ax, 8 1878 00000F9B 66AB stosw ; this is 2nd interpolated sample (L) 1879 00000F9D 66AB stosw ; this is 2nd interpolated sample (R) 1880 1881 ; 16 kHZ mono to 48 kHZ stereo conversion of the sample is OK 1882 00000F9F 09C9 or ecx, ecx 1883 00000FA1 75C2 jnz short lff16m_1 1884 00000FA3 E911FCFFFF jmp lff16m_3 1885 1886 lff16m_7: 1887 lff16s_7: 1888 00000FA8 E92DFCFFFF jmp lff16m_5 ; error 1889 1890 load_16khz_stereo_8_bit: 1891 ; 02/02/2025 1892 ; 14/11/2023 1893 ; 13/11/2023 1894 00000FAD F605[C8250000]01 test byte [flags], ENDOFFILE ; have we already read the 1895 ; last of the file? 1896 00000FB4 7402 jz short lff16s_0 ; no 1897 00000FB6 F9 stc 1898 00000FB7 C3 retn 1899 1900 lff16s_0: 1901 00000FB8 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 1902 ;mov edx, [loadsize] 1903 1904 ; esi = buffer address 1905 ;; edx = buffer size 1906 1907 ; load file into memory 1908 sys _read, [FileHandle], esi, [loadsize] 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00000FBD 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 00000FC3 89F1 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00000FC5 8B15[1E040000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00000FCB B803000000 <1> mov eax, %1 86 <1> 87 00000FD0 CD40 <1> int 40h 1909 00000FD2 72D4 jc short lff16s_7 ; error ! 1910 1911 00000FD4 BF[00300000] mov edi, audio_buffer 1912 1913 00000FD9 D1E8 shr eax, 1 1914 00000FDB 7505 jnz short lff16s_8 1915 00000FDD E9EFFBFFFF jmp lff16_eof 1916 1917 lff16s_8: 1918 00000FE2 89C1 mov ecx, eax ; word count 1919 lff16s_1: 1920 00000FE4 AC lodsb 1921 00000FE5 A2[78220000] mov [previous_val_l], al 1922 00000FEA 2C80 sub al, 80h 1923 00000FEC 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 1924 00000FF0 66AB stosw ; original sample (L) 1925 00000FF2 AC lodsb 1926 00000FF3 A2[7A220000] mov [previous_val_r], al 1927 00000FF8 2C80 sub al, 80h 1928 00000FFA 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 1929 00000FFE 66AB stosw ; original sample (R) 1930 1931 ;xor eax, eax 1932 ; 02/02/2025 1933 00001000 668B06 mov ax, [esi] 1934 00001003 49 dec ecx 1935 00001004 7504 jnz short lff16s_2 1936 ; convert 8 bit sample to 16 bit sample 1937 ; 14/11/2023 1938 00001006 66B88080 mov ax, 8080h 1939 lff16s_2: 1940 ;mov [next_val_l], al 1941 ;mov [next_val_r], ah 1942 0000100A 89C3 mov ebx, eax 1943 0000100C 0205[78220000] add al, [previous_val_l] 1944 00001012 D0D8 rcr al, 1 1945 00001014 88C2 mov dl, al ; this is temporary interpolation value (L) 1946 00001016 0205[78220000] add al, [previous_val_l] 1947 0000101C D0D8 rcr al, 1 1948 0000101E 2C80 sub al, 80h 1949 00001020 66C1E008 shl ax, 8 1950 00001024 66AB stosw ; this is 1st interpolated sample (L) 1951 00001026 88F8 mov al, bh ; [next_val_r] 1952 00001028 0205[7A220000] add al, [previous_val_r] 1953 0000102E D0D8 rcr al, 1 1954 00001030 88C6 mov dh, al ; this is temporary interpolation value (R) 1955 00001032 0205[7A220000] add al, [previous_val_r] 1956 00001038 D0D8 rcr al, 1 1957 0000103A 2C80 sub al, 80h 1958 0000103C 66C1E008 shl ax, 8 1959 00001040 66AB stosw ; this is 1st interpolated sample (R) 1960 00001042 88D0 mov al, dl 1961 00001044 00D8 add al, bl ; [next_val_l] 1962 00001046 D0D8 rcr al, 1 1963 00001048 2C80 sub al, 80h 1964 0000104A 66C1E008 shl ax, 8 1965 0000104E 66AB stosw ; this is 2nd interpolated sample (L) 1966 00001050 88F0 mov al, dh 1967 00001052 00F8 add al, bh ; [next_val_r] 1968 00001054 D0D8 rcr al, 1 1969 00001056 2C80 sub al, 80h 1970 00001058 66C1E008 shl ax, 8 1971 0000105C 66AB stosw ; this is 2nd interpolated sample (R) 1972 1973 ; 16 kHZ stereo to 48 kHZ stereo conversion of the sample is OK 1974 0000105E 09C9 or ecx, ecx 1975 00001060 7582 jnz short lff16s_1 1976 00001062 E952FBFFFF jmp lff16s_3 1977 1978 load_16khz_mono_16_bit: 1979 ; 02/02/2025 1980 ; 15/11/2023 1981 ; 13/11/2023 1982 00001067 F605[C8250000]01 test byte [flags], ENDOFFILE ; have we already read the 1983 ; last of the file? 1984 0000106E 7402 jz short lff16m2_0 ; no 1985 00001070 F9 stc 1986 00001071 C3 retn 1987 1988 lff16m2_0: 1989 00001072 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 1990 ;mov edx, [loadsize] 1991 1992 ; esi = buffer address 1993 ;; edx = buffer size 1994 1995 ; load file into memory 1996 sys _read, [FileHandle], esi, [loadsize] 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00001077 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 0000107D 89F1 <1> mov ecx, %3 80 <1> %if %0 = 4 81 0000107F 8B15[1E040000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00001085 B803000000 <1> mov eax, %1 86 <1> 87 0000108A CD40 <1> int 40h 1997 0000108C 7255 jc short lff16m2_7 ; error ! 1998 1999 0000108E BF[00300000] mov edi, audio_buffer 2000 2001 00001093 D1E8 shr eax, 1 2002 00001095 7505 jnz short lff16m2_8 2003 00001097 E935FBFFFF jmp lff16_eof 2004 2005 lff16m2_8: 2006 0000109C 89C1 mov ecx, eax ; word count 2007 lff16m2_1: 2008 0000109E 66AD lodsw 2009 000010A0 66AB stosw ; original sample (left channel) 2010 000010A2 66AB stosw ; original sample (right channel) 2011 000010A4 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2012 ;mov [previous_val], ax 2013 000010A7 89C3 mov ebx, eax 2014 ; 02/02/2025 2015 000010A9 668B06 mov ax, [esi] 2016 000010AC 49 dec ecx 2017 000010AD 7502 jnz short lff16m2_2 2018 000010AF 31C0 xor eax, eax 2019 lff16m2_2: 2020 000010B1 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2021 000010B4 89C5 mov ebp, eax ; [next_val] 2022 ;add ax, [previous_val] 2023 000010B6 6601D8 add ax, bx 2024 000010B9 66D1D8 rcr ax, 1 2025 000010BC 89C2 mov edx, eax ; this is temporary interpolation value 2026 ;add ax, [previous_val] 2027 000010BE 6601D8 add ax, bx 2028 000010C1 66D1D8 rcr ax, 1 2029 000010C4 80EC80 sub ah, 80h ; -32768 to +32767 format again 2030 000010C7 66AB stosw ; this is 1st interpolated sample (L) 2031 000010C9 66AB stosw ; this is 1st interpolated sample (R) 2032 000010CB 89E8 mov eax, ebp 2033 000010CD 6601D0 add ax, dx 2034 000010D0 66D1D8 rcr ax, 1 2035 000010D3 80EC80 sub ah, 80h ; -32768 to +32767 format again 2036 000010D6 66AB stosw ; this is 2nd interpolated sample (L) 2037 000010D8 66AB stosw ; this is 2nd interpolated sample (R) 2038 ; 16 kHZ mono to 48 kHZ stereo conversion of the sample is OK 2039 000010DA 09C9 or ecx, ecx 2040 000010DC 75C0 jnz short lff16m2_1 2041 000010DE E9D6FAFFFF jmp lff16m2_3 2042 2043 lff16m2_7: 2044 lff16s2_7: 2045 000010E3 E9F2FAFFFF jmp lff16m2_5 ; error 2046 2047 load_16khz_stereo_16_bit: 2048 ; 02/02/2025 2049 ; 16/11/2023 2050 ; 15/11/2023 2051 ; 13/11/2023 2052 000010E8 F605[C8250000]01 test byte [flags], ENDOFFILE ; have we already read the 2053 ; last of the file? 2054 000010EF 7402 jz short lff16s2_0 ; no 2055 000010F1 F9 stc 2056 000010F2 C3 retn 2057 2058 lff16s2_0: 2059 000010F3 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 2060 ;mov edx, [loadsize] 2061 2062 ; esi = buffer address 2063 ;; edx = buffer size 2064 2065 ; load file into memory 2066 sys _read, [FileHandle], esi, [loadsize] 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 000010F8 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 000010FE 89F1 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00001100 8B15[1E040000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00001106 B803000000 <1> mov eax, %1 86 <1> 87 0000110B CD40 <1> int 40h 2067 0000110D 72D4 jc short lff16s2_7 ; error ! 2068 2069 0000110F BF[00300000] mov edi, audio_buffer 2070 2071 00001114 C1E802 shr eax, 2 2072 00001117 7505 jnz short lff16s2_8 2073 00001119 E9B3FAFFFF jmp lff16_eof 2074 2075 lff16s2_8: 2076 0000111E 89C1 mov ecx, eax ; dword count 2077 lff16s2_1: 2078 00001120 66AD lodsw 2079 00001122 66AB stosw ; original sample (L) 2080 00001124 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2081 00001127 66A3[78220000] mov [previous_val_l], ax 2082 0000112D 66AD lodsw 2083 0000112F 66AB stosw ; original sample (R) 2084 00001131 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2085 00001134 66A3[7A220000] mov [previous_val_r], ax 2086 ; 02/02/2025 2087 0000113A 668B06 mov ax, [esi] 2088 0000113D 668B5602 mov dx, [esi+2] 2089 ; 16/11/2023 2090 00001141 49 dec ecx 2091 00001142 7504 jnz short lff16s2_2 2092 00001144 31D2 xor edx, edx 2093 00001146 31C0 xor eax, eax 2094 lff16s2_2: 2095 00001148 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2096 ;mov [next_val_l], ax 2097 0000114B 89C5 mov ebp, eax 2098 0000114D 80C680 add dh, 80h ; convert sound level 0 to 65535 format 2099 00001150 668915[7E220000] mov [next_val_r], dx 2100 00001157 660305[78220000] add ax, [previous_val_l] 2101 0000115E 66D1D8 rcr ax, 1 2102 00001161 89C2 mov edx, eax ; this is temporary interpolation value (L) 2103 00001163 660305[78220000] add ax, [previous_val_l] 2104 0000116A 66D1D8 rcr ax, 1 2105 0000116D 80EC80 sub ah, 80h ; -32768 to +32767 format again 2106 00001170 66AB stosw ; this is 1st interpolated sample (L) 2107 00001172 66A1[7E220000] mov ax, [next_val_r] 2108 00001178 660305[7A220000] add ax, [previous_val_r] 2109 0000117F 66D1D8 rcr ax, 1 2110 00001182 89C3 mov ebx, eax ; this is temporary interpolation value (R) 2111 00001184 660305[7A220000] add ax, [previous_val_r] 2112 0000118B 66D1D8 rcr ax, 1 2113 0000118E 80EC80 sub ah, 80h ; -32768 to +32767 format again 2114 00001191 66AB stosw ; this is 1st interpolated sample (R) 2115 ;mov ax, [next_val_l] 2116 00001193 89E8 mov eax, ebp 2117 00001195 6601D0 add ax, dx 2118 00001198 66D1D8 rcr ax, 1 2119 0000119B 80EC80 sub ah, 80h ; -32768 to +32767 format again 2120 0000119E 66AB stosw ; this is 2nd interpolated sample (L) 2121 000011A0 66A1[7E220000] mov ax, [next_val_r] 2122 000011A6 6601D8 add ax, bx 2123 000011A9 66D1D8 rcr ax, 1 2124 000011AC 80EC80 sub ah, 80h ; -32768 to +32767 format again 2125 000011AF 66AB stosw ; this is 2nd interpolated sample (R) 2126 2127 ; 16 kHZ stereo to 48 kHZ stereo conversion of the sample is OK 2128 000011B1 09C9 or ecx, ecx 2129 000011B3 0F8567FFFFFF jnz lff16s2_1 2130 000011B9 E9FBF9FFFF jmp lff16s2_3 2131 2132 ; ..................... 2133 2134 load_24khz_mono_8_bit: 2135 ; 02/02/2025 2136 ; 15/11/2023 2137 000011BE F605[C8250000]01 test byte [flags], ENDOFFILE ; have we already read the 2138 ; last of the file? 2139 000011C5 7402 jz short lff24m_0 ; no 2140 000011C7 F9 stc 2141 000011C8 C3 retn 2142 2143 lff24m_0: 2144 000011C9 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 2145 ;mov edx, [loadsize] 2146 2147 ; esi = buffer address 2148 ;; edx = buffer size 2149 2150 ; load file into memory 2151 sys _read, [FileHandle], esi, [loadsize] 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 000011CE 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 000011D4 89F1 <1> mov ecx, %3 80 <1> %if %0 = 4 81 000011D6 8B15[1E040000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 000011DC B803000000 <1> mov eax, %1 86 <1> 87 000011E1 CD40 <1> int 40h 2152 000011E3 723B jc short lff24m_7 ; error ! 2153 2154 000011E5 BF[00300000] mov edi, audio_buffer 2155 2156 000011EA 21C0 and eax, eax 2157 000011EC 7505 jnz short lff24m_8 2158 000011EE E9DEF9FFFF jmp lff24_eof 2159 2160 lff24m_8: 2161 000011F3 89C1 mov ecx, eax ; byte count 2162 lff24m_1: 2163 000011F5 AC lodsb 2164 ;mov [previous_val], al 2165 000011F6 88C3 mov bl, al 2166 000011F8 2C80 sub al, 80h 2167 000011FA 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 2168 000011FE 66AB stosw ; original sample (left channel) 2169 00001200 66AB stosw ; original sample (right channel) 2170 ;xor eax, eax 2171 ; 02/02/2025 2172 00001202 8A06 mov al, [esi] 2173 00001204 49 dec ecx 2174 00001205 7502 jnz short lff24m_2 2175 00001207 B080 mov al, 80h 2176 lff24m_2: 2177 ;;mov [next_val], al 2178 ;mov bh, al 2179 ;add al, [previous_val] 2180 00001209 00D8 add al, bl 2181 0000120B D0D8 rcr al, 1 2182 0000120D 2C80 sub al, 80h 2183 0000120F 66C1E008 shl ax, 8 2184 00001213 66AB stosw ; this is interpolated sample (L) 2185 00001215 66AB stosw ; this is interpolated sample (R) 2186 2187 ; 24 kHZ mono to 48 kHZ stereo conversion of the sample is OK 2188 00001217 09C9 or ecx, ecx 2189 00001219 75DA jnz short lff24m_1 2190 0000121B E999F9FFFF jmp lff24_3 2191 2192 lff24m_7: 2193 lff24s_7: 2194 00001220 E9B5F9FFFF jmp lff24_5 ; error 2195 2196 load_24khz_stereo_8_bit: 2197 ; 02/02/2025 2198 ; 15/11/2023 2199 00001225 F605[C8250000]01 test byte [flags], ENDOFFILE ; have we already read the 2200 ; last of the file? 2201 0000122C 7402 jz short lff24s_0 ; no 2202 0000122E F9 stc 2203 0000122F C3 retn 2204 2205 lff24s_0: 2206 00001230 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 2207 ;mov edx, [loadsize] 2208 2209 ; esi = buffer address 2210 ;; edx = buffer size 2211 2212 ; load file into memory 2213 sys _read, [FileHandle], esi, [loadsize] 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00001235 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 0000123B 89F1 <1> mov ecx, %3 80 <1> %if %0 = 4 81 0000123D 8B15[1E040000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00001243 B803000000 <1> mov eax, %1 86 <1> 87 00001248 CD40 <1> int 40h 2214 0000124A 72D4 jc short lff24s_7 ; error ! 2215 2216 0000124C BF[00300000] mov edi, audio_buffer 2217 2218 00001251 D1E8 shr eax, 1 2219 00001253 7505 jnz short lff24s_8 2220 00001255 E977F9FFFF jmp lff24_eof 2221 2222 lff24s_8: 2223 0000125A 89C1 mov ecx, eax ; word count 2224 lff24s_1: 2225 0000125C AC lodsb 2226 0000125D A2[78220000] mov [previous_val_l], al 2227 00001262 2C80 sub al, 80h 2228 00001264 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 2229 00001268 66AB stosw ; original sample (L) 2230 0000126A AC lodsb 2231 0000126B A2[7A220000] mov [previous_val_r], al 2232 00001270 2C80 sub al, 80h 2233 00001272 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 2234 00001276 66AB stosw ; original sample (R) 2235 2236 ;xor eax, eax 2237 ; 02/02/2025 2238 00001278 668B06 mov ax, [esi] 2239 0000127B 49 dec ecx 2240 0000127C 7504 jnz short lff24s_2 2241 ; convert 8 bit sample to 16 bit sample 2242 0000127E 66B88080 mov ax, 8080h 2243 lff24s_2: 2244 ;;mov [next_val_l], al 2245 ;;mov [next_val_r], ah 2246 ;mov bx, ax 2247 00001282 88E7 mov bh, ah 2248 00001284 0205[78220000] add al, [previous_val_l] 2249 0000128A D0D8 rcr al, 1 2250 ;mov dl, al 2251 0000128C 2C80 sub al, 80h 2252 0000128E 66C1E008 shl ax, 8 2253 00001292 66AB stosw ; this is interpolated sample (L) 2254 00001294 88F8 mov al, bh ; [next_val_r] 2255 00001296 0205[7A220000] add al, [previous_val_r] 2256 0000129C D0D8 rcr al, 1 2257 ;mov dh, al 2258 0000129E 2C80 sub al, 80h 2259 000012A0 66C1E008 shl ax, 8 2260 000012A4 66AB stosw ; this is interpolated sample (R) 2261 2262 ; 24 kHZ stereo to 48 kHZ stereo conversion of the sample is OK 2263 000012A6 09C9 or ecx, ecx 2264 000012A8 75B2 jnz short lff24s_1 2265 000012AA E90AF9FFFF jmp lff24_3 2266 2267 load_24khz_mono_16_bit: 2268 ; 02/02/2025 2269 ; 15/11/2023 2270 000012AF F605[C8250000]01 test byte [flags], ENDOFFILE ; have we already read the 2271 ; last of the file? 2272 000012B6 7402 jz short lff24m2_0 ; no 2273 000012B8 F9 stc 2274 000012B9 C3 retn 2275 2276 lff24m2_0: 2277 000012BA BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 2278 ;mov edx, [loadsize] 2279 2280 ; esi = buffer address 2281 ;; edx = buffer size 2282 2283 ; load file into memory 2284 sys _read, [FileHandle], esi, [loadsize] 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 000012BF 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 000012C5 89F1 <1> mov ecx, %3 80 <1> %if %0 = 4 81 000012C7 8B15[1E040000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 000012CD B803000000 <1> mov eax, %1 86 <1> 87 000012D2 CD40 <1> int 40h 2285 000012D4 723A jc short lff24m2_7 ; error ! 2286 2287 000012D6 BF[00300000] mov edi, audio_buffer 2288 2289 000012DB D1E8 shr eax, 1 2290 000012DD 7505 jnz short lff24m2_8 2291 000012DF E9EDF8FFFF jmp lff24_eof 2292 2293 lff24m2_8: 2294 000012E4 89C1 mov ecx, eax ; word count 2295 lff24m2_1: 2296 000012E6 66AD lodsw 2297 000012E8 66AB stosw ; original sample (left channel) 2298 000012EA 66AB stosw ; original sample (right channel) 2299 000012EC 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2300 ;mov [previous_val], ax 2301 ;mov ebx, eax 2302 ; 02/02/2025 2303 000012EF 668B1E mov bx, [esi] 2304 000012F2 49 dec ecx 2305 000012F3 7502 jnz short lff24m2_2 2306 ;xor eax, eax 2307 000012F5 31DB xor ebx, ebx 2308 lff24m2_2: 2309 ; 02/02/2025 2310 000012F7 80C780 add bh, 80h ; convert sound level 0 to 65535 format 2311 ;add ah, 80h 2312 ;mov ebp, eax ; [next_val] 2313 ;add ax, [previous_val] 2314 ; ax = [previous_val] 2315 ; bx = [next_val] 2316 000012FA 6601D8 add ax, bx 2317 000012FD 66D1D8 rcr ax, 1 2318 00001300 80EC80 sub ah, 80h ; -32768 to +32767 format again 2319 00001303 66AB stosw ; this is interpolated sample (L) 2320 00001305 66AB stosw ; this is interpolated sample (R) 2321 ; 24 kHZ mono to 48 kHZ stereo conversion of the sample is OK 2322 00001307 09C9 or ecx, ecx 2323 00001309 75DB jnz short lff24m2_1 2324 0000130B E9A9F8FFFF jmp lff24_3 2325 2326 lff24m2_7: 2327 lff24s2_7: 2328 00001310 E9C5F8FFFF jmp lff24_5 ; error 2329 2330 load_24khz_stereo_16_bit: 2331 ; 02/02/2025 2332 ; 16/11/2023 2333 ; 15/11/2023 2334 00001315 F605[C8250000]01 test byte [flags], ENDOFFILE ; have we already read the 2335 ; last of the file? 2336 0000131C 7402 jz short lff24s2_0 ; no 2337 0000131E F9 stc 2338 0000131F C3 retn 2339 2340 lff24s2_0: 2341 00001320 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 2342 ;mov edx, [loadsize] 2343 2344 ; esi = buffer address 2345 ;; edx = buffer size 2346 2347 ; load file into memory 2348 sys _read, [FileHandle], esi, [loadsize] 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00001325 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 0000132B 89F1 <1> mov ecx, %3 80 <1> %if %0 = 4 81 0000132D 8B15[1E040000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00001333 B803000000 <1> mov eax, %1 86 <1> 87 00001338 CD40 <1> int 40h 2349 0000133A 72D4 jc short lff24s2_7 ; error ! 2350 2351 0000133C BF[00300000] mov edi, audio_buffer 2352 2353 00001341 C1E802 shr eax, 2 2354 00001344 7505 jnz short lff24s2_8 2355 00001346 E986F8FFFF jmp lff24_eof 2356 2357 lff24s2_8: 2358 0000134B 89C1 mov ecx, eax ; dword count 2359 lff24s2_1: 2360 0000134D 66AD lodsw 2361 0000134F 66AB stosw ; original sample (L) 2362 00001351 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2363 00001354 66A3[78220000] mov [previous_val_l], ax 2364 0000135A 66AD lodsw 2365 0000135C 66AB stosw ; original sample (R) 2366 0000135E 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2367 ;mov [previous_val_r], ax 2368 00001361 89C3 mov ebx, eax 2369 ; 02/02/2025 2370 00001363 668B06 mov ax, [esi] 2371 00001366 668B5602 mov dx, [esi+2] 2372 ; 16/11/2023 2373 0000136A 49 dec ecx 2374 0000136B 7504 jnz short lff24s2_2 2375 0000136D 31D2 xor edx, edx 2376 0000136F 31C0 xor eax, eax 2377 lff24s2_2: 2378 00001371 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2379 ;;mov [next_val_l], ax 2380 ;mov ebp, eax 2381 00001374 80C680 add dh, 80h ; convert sound level 0 to 65535 format 2382 ;mov [next_val_r], dx 2383 00001377 660305[78220000] add ax, [previous_val_l] 2384 0000137E 66D1D8 rcr ax, 1 2385 00001381 80EC80 sub ah, 80h ; -32768 to +32767 format again 2386 00001384 66AB stosw ; this is interpolated sample (L) 2387 ;mov ax, [next_val_r] 2388 00001386 89D0 mov eax, edx 2389 ;add ax, [previous_val_r] 2390 00001388 6601D8 add ax, bx 2391 0000138B 66D1D8 rcr ax, 1 2392 0000138E 80EC80 sub ah, 80h ; -32768 to +32767 format again 2393 00001391 66AB stosw ; this is interpolated sample (R) 2394 2395 ; 24 kHZ stereo to 48 kHZ stereo conversion of the sample is OK 2396 00001393 09C9 or ecx, ecx 2397 00001395 75B6 jnz short lff24s2_1 2398 00001397 E91DF8FFFF jmp lff24_3 2399 2400 ; ..................... 2401 2402 load_32khz_mono_8_bit: 2403 ; 02/02/2025 2404 ; 15/11/2023 2405 0000139C F605[C8250000]01 test byte [flags], ENDOFFILE ; have we already read the 2406 ; last of the file? 2407 000013A3 7402 jz short lff32m_0 ; no 2408 000013A5 F9 stc 2409 000013A6 C3 retn 2410 2411 lff32m_0: 2412 000013A7 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 2413 ;mov edx, [loadsize] 2414 2415 ; esi = buffer address 2416 ;; edx = buffer size 2417 2418 ; load file into memory 2419 sys _read, [FileHandle], esi, [loadsize] 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 000013AC 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 000013B2 89F1 <1> mov ecx, %3 80 <1> %if %0 = 4 81 000013B4 8B15[1E040000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 000013BA B803000000 <1> mov eax, %1 86 <1> 87 000013BF CD40 <1> int 40h 2420 000013C1 7247 jc short lff32m_7 ; error ! 2421 2422 000013C3 BF[00300000] mov edi, audio_buffer 2423 2424 000013C8 21C0 and eax, eax 2425 000013CA 7505 jnz short lff32m_8 2426 000013CC E900F8FFFF jmp lff32_eof 2427 2428 lff32m_8: 2429 000013D1 89C1 mov ecx, eax ; byte count 2430 lff32m_1: 2431 000013D3 AC lodsb 2432 ;mov [previous_val], al 2433 000013D4 88C3 mov bl, al 2434 000013D6 2C80 sub al, 80h 2435 000013D8 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 2436 000013DC 66AB stosw ; original sample (left channel) 2437 000013DE 66AB stosw ; original sample (right channel) 2438 ;xor eax, eax 2439 ; 02/02/2025 2440 000013E0 8A06 mov al, [esi] 2441 000013E2 49 dec ecx 2442 000013E3 7502 jnz short lff32m_2 2443 000013E5 B080 mov al, 80h 2444 lff32m_2: 2445 ;;mov [next_val], al 2446 ;mov bh, al 2447 ;add al, [previous_val] 2448 000013E7 00D8 add al, bl 2449 000013E9 D0D8 rcr al, 1 2450 000013EB 2C80 sub al, 80h 2451 000013ED 66C1E008 shl ax, 8 2452 000013F1 66AB stosw ; this is interpolated sample (L) 2453 000013F3 66AB stosw ; this is interpolated sample (R) 2454 2455 ; different than 8-16-24 kHZ ! 2456 ; 'original-interpolated-original' trio samples 2457 000013F5 E30E jecxz lff32m_3 2458 2459 000013F7 AC lodsb 2460 000013F8 2C80 sub al, 80h 2461 000013FA 66C1E008 shl ax, 8 2462 000013FE 66AB stosw ; original sample (left channel) 2463 00001400 66AB stosw ; original sample (right channel) 2464 2465 ; 32 kHZ mono to 48 kHZ stereo conversion of the sample is OK 2466 00001402 49 dec ecx 2467 00001403 75CE jnz short lff32m_1 2468 lff32m_3: 2469 00001405 E9AFF7FFFF jmp lff32_3 2470 2471 lff32m_7: 2472 lff32s_7: 2473 0000140A E9CBF7FFFF jmp lff32_5 ; error 2474 2475 load_32khz_stereo_8_bit: 2476 ; 02/02/2025 2477 ; 15/11/2023 2478 0000140F F605[C8250000]01 test byte [flags], ENDOFFILE ; have we already read the 2479 ; last of the file? 2480 00001416 7402 jz short lff32s_0 ; no 2481 00001418 F9 stc 2482 00001419 C3 retn 2483 2484 lff32s_0: 2485 0000141A BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 2486 ;mov edx, [loadsize] 2487 2488 ; esi = buffer address 2489 ;; edx = buffer size 2490 2491 ; load file into memory 2492 sys _read, [FileHandle], esi, [loadsize] 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 0000141F 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 00001425 89F1 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00001427 8B15[1E040000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 0000142D B803000000 <1> mov eax, %1 86 <1> 87 00001432 CD40 <1> int 40h 2493 00001434 72D4 jc short lff32s_7 ; error ! 2494 2495 00001436 BF[00300000] mov edi, audio_buffer 2496 2497 0000143B D1E8 shr eax, 1 2498 0000143D 7505 jnz short lff32s_8 2499 0000143F E98DF7FFFF jmp lff32_eof 2500 2501 lff32s_8: 2502 00001444 89C1 mov ecx, eax ; word count 2503 lff32s_1: 2504 00001446 AC lodsb 2505 00001447 A2[78220000] mov [previous_val_l], al 2506 0000144C 2C80 sub al, 80h 2507 0000144E 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 2508 00001452 66AB stosw ; original sample (L) 2509 00001454 AC lodsb 2510 00001455 A2[7A220000] mov [previous_val_r], al 2511 0000145A 2C80 sub al, 80h 2512 0000145C 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 2513 00001460 66AB stosw ; original sample (R) 2514 2515 ;xor eax, eax 2516 ; 02/02/2025 2517 00001462 668B06 mov ax, [esi] 2518 00001465 49 dec ecx 2519 00001466 7504 jnz short lff32s_2 2520 ; convert 8 bit sample to 16 bit sample 2521 00001468 66B88080 mov ax, 8080h 2522 lff32s_2: 2523 ;;mov [next_val_l], al 2524 ;;mov [next_val_r], ah 2525 ;mov bx, ax 2526 0000146C 88E7 mov bh, ah 2527 0000146E 0205[78220000] add al, [previous_val_l] 2528 00001474 D0D8 rcr al, 1 2529 ;mov dl, al 2530 00001476 2C80 sub al, 80h 2531 00001478 66C1E008 shl ax, 8 2532 0000147C 66AB stosw ; this is interpolated sample (L) 2533 0000147E 88F8 mov al, bh ; [next_val_r] 2534 00001480 0205[7A220000] add al, [previous_val_r] 2535 00001486 D0D8 rcr al, 1 2536 ;mov dh, al 2537 00001488 2C80 sub al, 80h 2538 0000148A 66C1E008 shl ax, 8 2539 0000148E 66AB stosw ; this is interpolated sample (R) 2540 2541 ; different than 8-16-24 kHZ ! 2542 ; 'original-interpolated-original' trio samples 2543 00001490 E315 jecxz lff32s_3 2544 2545 00001492 AC lodsb 2546 00001493 2C80 sub al, 80h 2547 00001495 66C1E008 shl ax, 8 2548 00001499 66AB stosw ; original sample (left channel) 2549 2550 0000149B AC lodsb 2551 0000149C 2C80 sub al, 80h 2552 0000149E 66C1E008 shl ax, 8 2553 000014A2 66AB stosw ; original sample (right channel) 2554 2555 ; 32 kHZ stereo to 48 kHZ stereo conversion of the sample is OK 2556 000014A4 49 dec ecx 2557 000014A5 759F jnz short lff32s_1 2558 lff32s_3: 2559 000014A7 E90DF7FFFF jmp lff32_3 2560 2561 load_32khz_mono_16_bit: 2562 ; 02/02/2025 2563 ; 15/11/2023 2564 000014AC F605[C8250000]01 test byte [flags], ENDOFFILE ; have we already read the 2565 ; last of the file? 2566 000014B3 7402 jz short lff32m2_0 ; no 2567 000014B5 F9 stc 2568 000014B6 C3 retn 2569 2570 lff32m2_0: 2571 000014B7 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 2572 ;mov edx, [loadsize] 2573 2574 ; esi = buffer address 2575 ;; edx = buffer size 2576 2577 ; load file into memory 2578 sys _read, [FileHandle], esi, [loadsize] 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 000014BC 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 000014C2 89F1 <1> mov ecx, %3 80 <1> %if %0 = 4 81 000014C4 8B15[1E040000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 000014CA B803000000 <1> mov eax, %1 86 <1> 87 000014CF CD40 <1> int 40h 2579 000014D1 7241 jc short lff32m2_7 ; error ! 2580 2581 000014D3 BF[00300000] mov edi, audio_buffer 2582 2583 000014D8 D1E8 shr eax, 1 2584 000014DA 7505 jnz short lff32m2_8 2585 000014DC E9F0F6FFFF jmp lff32_eof 2586 2587 lff32m2_8: 2588 000014E1 89C1 mov ecx, eax ; word count 2589 lff32m2_1: 2590 000014E3 66AD lodsw 2591 000014E5 66AB stosw ; original sample (left channel) 2592 000014E7 66AB stosw ; original sample (right channel) 2593 000014E9 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2594 ;mov [previous_val], ax 2595 ;mov ebx, eax 2596 ;xor eax, eax 2597 ; 02/02/2025 2598 ;mov ax, [esi] 2599 000014EC 668B1E mov bx, [esi] 2600 000014EF 49 dec ecx 2601 000014F0 7502 jnz short lff32m2_2 2602 000014F2 31DB xor ebx, ebx 2603 lff32m2_2: 2604 ; 02/02/2025 2605 000014F4 80C780 add bh, 80h ; convert sound level 0 to 65535 format 2606 ;add ah, 80h 2607 ;mov ebp, eax ; [next_val] 2608 ;add ax, [previous_val] 2609 ; ax = [previous_val] 2610 ; bx = [next_val] 2611 000014F7 6601D8 add ax, bx 2612 000014FA 66D1D8 rcr ax, 1 2613 000014FD 80EC80 sub ah, 80h ; -32768 to +32767 format again 2614 00001500 66AB stosw ; this is interpolated sample (L) 2615 00001502 66AB stosw ; this is interpolated sample (R) 2616 2617 ; different than 8-16-24 kHZ ! 2618 ; 'original-interpolated-original' trio samples 2619 00001504 E309 jecxz lff32m2_3 2620 2621 00001506 66AD lodsw 2622 00001508 66AB stosw ; original sample (left channel) 2623 0000150A 66AB stosw ; original sample (right channel) 2624 2625 ; 32 kHZ mono to 48 kHZ stereo conversion of the sample is OK 2626 0000150C 49 dec ecx 2627 0000150D 75D4 jnz short lff32m2_1 2628 lff32m2_3: 2629 0000150F E9A5F6FFFF jmp lff32_3 2630 2631 lff32m2_7: 2632 lff32s2_7: 2633 00001514 E9C1F6FFFF jmp lff32_5 ; error 2634 2635 load_32khz_stereo_16_bit: 2636 ; 02/02/2025 2637 ; 16/11/2023 2638 ; 15/11/2023 2639 00001519 F605[C8250000]01 test byte [flags], ENDOFFILE ; have we already read the 2640 ; last of the file? 2641 00001520 7402 jz short lff32s2_0 ; no 2642 00001522 F9 stc 2643 00001523 C3 retn 2644 2645 lff32s2_0: 2646 00001524 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 2647 ;mov edx, [loadsize] 2648 2649 ; esi = buffer address 2650 ;; edx = buffer size 2651 2652 ; load file into memory 2653 sys _read, [FileHandle], esi, [loadsize] 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00001529 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 0000152F 89F1 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00001531 8B15[1E040000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00001537 B803000000 <1> mov eax, %1 86 <1> 87 0000153C CD40 <1> int 40h 2654 0000153E 72D4 jc short lff32s2_7 ; error ! 2655 2656 00001540 BF[00300000] mov edi, audio_buffer 2657 2658 00001545 C1E802 shr eax, 2 2659 00001548 7505 jnz short lff32s2_8 2660 0000154A E982F6FFFF jmp lff32_eof 2661 2662 lff32s2_8: 2663 0000154F 89C1 mov ecx, eax ; dword count 2664 lff32s2_1: 2665 00001551 66AD lodsw 2666 00001553 66AB stosw ; original sample (L) 2667 00001555 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2668 00001558 66A3[78220000] mov [previous_val_l], ax 2669 0000155E 66AD lodsw 2670 00001560 66AB stosw ; original sample (R) 2671 00001562 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2672 ;mov [previous_val_r], ax 2673 00001565 89C3 mov ebx, eax 2674 ; 02/02/2025 2675 00001567 668B06 mov ax, [esi] 2676 0000156A 668B5602 mov dx, [esi+2] 2677 ; 16/11/2023 2678 0000156E 49 dec ecx 2679 0000156F 7504 jnz short lff32s2_2 2680 00001571 31D2 xor edx, edx 2681 00001573 31C0 xor eax, eax 2682 lff32s2_2: 2683 00001575 80C480 add ah, 80h ; convert sound level 0 to 65535 format 2684 ;;mov [next_val_l], ax 2685 ;mov ebp, eax 2686 00001578 80C680 add dh, 80h ; convert sound level 0 to 65535 format 2687 ;mov [next_val_r], dx 2688 0000157B 660305[78220000] add ax, [previous_val_l] 2689 00001582 66D1D8 rcr ax, 1 2690 00001585 80EC80 sub ah, 80h ; -32768 to +32767 format again 2691 00001588 66AB stosw ; this is interpolated sample (L) 2692 ;mov ax, [next_val_r] 2693 0000158A 89D0 mov eax, edx 2694 ;add ax, [previous_val_r] 2695 0000158C 6601D8 add ax, bx 2696 0000158F 66D1D8 rcr ax, 1 2697 00001592 80EC80 sub ah, 80h ; -32768 to +32767 format again 2698 00001595 66AB stosw ; this is interpolated sample (R) 2699 2700 ; different than 8-16-24 kHZ ! 2701 ; 'original-interpolated-original' trio samples 2702 00001597 E30B jecxz lff32s2_3 2703 2704 00001599 66AD lodsw 2705 0000159B 66AB stosw ; original sample (L) 2706 0000159D 66AD lodsw 2707 0000159F 66AB stosw ; original sample (R) 2708 2709 ; 32 kHZ stereo to 48 kHZ stereo conversion of the sample is OK 2710 000015A1 49 dec ecx 2711 000015A2 75AD jnz short lff32s2_1 2712 lff32s2_3: 2713 000015A4 E910F6FFFF jmp lff32_3 2714 2715 ; ..................... 2716 2717 load_22khz_mono_8_bit: 2718 ; 02/02/2025 2719 ; 16/11/2023 2720 000015A9 F605[C8250000]01 test byte [flags], ENDOFFILE ; have we already read the 2721 ; last of the file? 2722 000015B0 7402 jz short lff22m_0 ; no 2723 000015B2 F9 stc 2724 000015B3 C3 retn 2725 2726 lff22m_0: 2727 000015B4 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 2728 ;mov edx, [loadsize] 2729 2730 ; esi = buffer address 2731 ;; edx = buffer size 2732 2733 ; load file into memory 2734 sys _read, [FileHandle], esi, [loadsize] 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 000015B9 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 000015BF 89F1 <1> mov ecx, %3 80 <1> %if %0 = 4 81 000015C1 8B15[1E040000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 000015C7 B803000000 <1> mov eax, %1 86 <1> 87 000015CC CD40 <1> int 40h 2735 000015CE 725D jc short lff22m_7 ; error ! 2736 2737 000015D0 BF[00300000] mov edi, audio_buffer 2738 2739 000015D5 21C0 and eax, eax 2740 000015D7 7505 jnz short lff22m_8 2741 000015D9 E9F3F5FFFF jmp lff22_eof 2742 2743 lff22m_8: 2744 000015DE 89C1 mov ecx, eax ; byte count 2745 lff22m_9: 2746 000015E0 BD05000000 mov ebp, 5 ; interpolation (one step) loop count 2747 000015E5 C605[80220000]03 mov byte [faz], 3 ; 3 steps/phases 2748 lff22m_1: 2749 ; 3:2:2:2:2:2::3:2:2:2:2::3:2:2:2:2:2 ; 37/17 2750 000015EC AC lodsb 2751 ; 02/02/2025 2752 000015ED 8A16 mov dl, [esi] 2753 000015EF 49 dec ecx 2754 000015F0 7502 jnz short lff22m_2_1 2755 000015F2 B280 mov dl, 80h 2756 lff22m_2_1: 2757 ; al = [previous_val] 2758 ; dl = [next_val] 2759 000015F4 E835070000 call interpolating_3_8bit_mono ; 1 of 17 2760 000015F9 E32D jecxz lff22m_3 2761 lff22m_2_2: 2762 000015FB AC lodsb 2763 ; 02/02/2025 2764 000015FC 8A16 mov dl, [esi] 2765 000015FE 49 dec ecx 2766 000015FF 7502 jnz short lff22m_2_3 2767 00001601 B280 mov dl, 80h 2768 lff22m_2_3: 2769 00001603 E8B0070000 call interpolating_2_8bit_mono ; 2 of 17 .. 6 of 17 2770 00001608 E31E jecxz lff22m_3 2771 0000160A 4D dec ebp 2772 0000160B 75EE jnz short lff22m_2_2 2773 2774 0000160D A0[80220000] mov al, [faz] 2775 00001612 FEC8 dec al 2776 00001614 74CA jz short lff22m_9 2777 00001616 FE0D[80220000] dec byte [faz] 2778 0000161C BD04000000 mov ebp, 4 2779 00001621 FEC8 dec al 2780 00001623 75C7 jnz short lff22m_1 ; 3:2:2:2:2 ; 7-11 of 17 2781 00001625 45 inc ebp ; 5 2782 00001626 EBC4 jmp short lff22m_1 ; 3:2:2:2:2:2 ; 12-17 of 17 2783 2784 lff22m_3: 2785 lff22s_3: 2786 00001628 E98CF5FFFF jmp lff22_3 ; padfill 2787 ; (put zeros in the remain words of the buffer) 2788 lff22m_7: 2789 lff22s_7: 2790 0000162D E9A8F5FFFF jmp lff22_5 ; error 2791 2792 load_22khz_stereo_8_bit: 2793 ; 02/02/2025 2794 ; 16/11/2023 2795 00001632 F605[C8250000]01 test byte [flags], ENDOFFILE ; have we already read the 2796 ; last of the file? 2797 00001639 7402 jz short lff22s_0 ; no 2798 0000163B F9 stc 2799 0000163C C3 retn 2800 2801 lff22s_0: 2802 0000163D BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 2803 ;mov edx, [loadsize] 2804 2805 ; esi = buffer address 2806 ;; edx = buffer size 2807 2808 ; load file into memory 2809 sys _read, [FileHandle], esi, [loadsize] 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00001642 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 00001648 89F1 <1> mov ecx, %3 80 <1> %if %0 = 4 81 0000164A 8B15[1E040000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00001650 B803000000 <1> mov eax, %1 86 <1> 87 00001655 CD40 <1> int 40h 2810 00001657 72D4 jc short lff22s_7 ; error ! 2811 2812 00001659 BF[00300000] mov edi, audio_buffer 2813 2814 0000165E D1E8 shr eax, 1 2815 00001660 7505 jnz short lff22s_8 2816 00001662 E96AF5FFFF jmp lff22_eof 2817 2818 lff22s_8: 2819 00001667 89C1 mov ecx, eax ; word count 2820 lff22s_9: 2821 00001669 BD05000000 mov ebp, 5 ; interpolation (one step) loop count 2822 0000166E C605[80220000]03 mov byte [faz], 3 ; 3 steps/phase 2823 lff22s_1: 2824 ; 3:2:2:2:2:2::3:2:2:2:2::3:2:2:2:2:2 ; 37/17 2825 00001675 66AD lodsw 2826 ; 02/02/2025 2827 00001677 668B16 mov dx, [esi] 2828 0000167A 49 dec ecx 2829 0000167B 7504 jnz short lff22s_2_1 2830 0000167D 66BA8080 mov dx, 8080h 2831 lff22s_2_1: 2832 ; al = [previous_val_l] 2833 ; ah = [previous_val_r] 2834 ; dl = [next_val_l] 2835 ; dh = [next_val_r] 2836 00001681 E8DB060000 call interpolating_3_8bit_stereo ; 1 of 17 2837 00001686 E3A0 jecxz lff22s_3 2838 lff22s_2_2: 2839 00001688 66AD lodsw 2840 ; 02/02/2025 2841 0000168A 668B16 mov dx, [esi] 2842 0000168D 49 dec ecx 2843 0000168E 7504 jnz short lff22s_2_3 2844 00001690 66BA8080 mov dx, 8080h 2845 lff22s_2_3: 2846 00001694 E83C070000 call interpolating_2_8bit_stereo ; 2 of 17 .. 6 of 17 2847 00001699 E38D jecxz lff22s_3 2848 0000169B 4D dec ebp 2849 0000169C 75EA jnz short lff22s_2_2 2850 2851 0000169E A0[80220000] mov al, [faz] 2852 000016A3 FEC8 dec al 2853 000016A5 74C2 jz short lff22s_9 2854 000016A7 FE0D[80220000] dec byte [faz] 2855 000016AD BD04000000 mov ebp, 4 2856 000016B2 FEC8 dec al 2857 000016B4 75BF jnz short lff22s_1 ; 3:2:2:2:2 ; 7-11 of 17 2858 000016B6 45 inc ebp ; 5 2859 000016B7 EBBC jmp short lff22s_1 ; 3:2:2:2:2:2 ; 12-17 of 17 2860 2861 load_22khz_mono_16_bit: 2862 ; 02/02/2025 2863 ; 16/11/2023 2864 000016B9 F605[C8250000]01 test byte [flags], ENDOFFILE ; have we already read the 2865 ; last of the file? 2866 000016C0 7402 jz short lff22m2_0 ; no 2867 000016C2 F9 stc 2868 000016C3 C3 retn 2869 2870 lff22m2_0: 2871 000016C4 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 2872 ;mov edx, [loadsize] 2873 2874 ; esi = buffer address 2875 ;; edx = buffer size 2876 2877 ; load file into memory 2878 sys _read, [FileHandle], esi, [loadsize] 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 000016C9 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 000016CF 89F1 <1> mov ecx, %3 80 <1> %if %0 = 4 81 000016D1 8B15[1E040000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 000016D7 B803000000 <1> mov eax, %1 86 <1> 87 000016DC CD40 <1> int 40h 2879 000016DE 7261 jc short lff22m2_7 ; error ! 2880 2881 000016E0 BF[00300000] mov edi, audio_buffer 2882 2883 000016E5 D1E8 shr eax, 1 2884 000016E7 7505 jnz short lff22m2_8 2885 000016E9 E9E3F4FFFF jmp lff22_eof 2886 2887 lff22m2_8: 2888 000016EE 89C1 mov ecx, eax ; word count 2889 lff22m2_9: 2890 000016F0 BD05000000 mov ebp, 5 ; interpolation (one step) loop count 2891 000016F5 C605[80220000]03 mov byte [faz], 3 ; 3 steps/phases 2892 lff22m2_1: 2893 ; 3:2:2:2:2:2::3:2:2:2:2::3:2:2:2:2:2 ; 37/17 2894 000016FC 66AD lodsw 2895 ; 02/02/2025 2896 000016FE 668B16 mov dx, [esi] 2897 00001701 49 dec ecx 2898 00001702 7502 jnz short lff22m2_2_1 2899 00001704 31D2 xor edx, edx 2900 lff22m2_2_1: 2901 ; ax = [previous_val] 2902 ; dx = [next_val] 2903 00001706 E8FB060000 call interpolating_3_16bit_mono ; 1 of 17 2904 0000170B E32F jecxz lff22m2_3 2905 lff22m2_2_2: 2906 0000170D 66AD lodsw 2907 ; 02/02/2025 2908 0000170F 668B16 mov dx, [esi] 2909 00001712 49 dec ecx 2910 00001713 7502 jnz short lff22m2_2_3 2911 00001715 31D2 xor edx, edx 2912 lff22m2_2_3: 2913 00001717 E87D070000 call interpolating_2_16bit_mono ; 2 of 17 .. 6 of 17 2914 0000171C E31E jecxz lff22m2_3 2915 0000171E 4D dec ebp 2916 0000171F 75EC jnz short lff22m2_2_2 2917 2918 00001721 A0[80220000] mov al, [faz] 2919 00001726 FEC8 dec al 2920 00001728 74C6 jz short lff22m2_9 2921 0000172A FE0D[80220000] dec byte [faz] 2922 00001730 BD04000000 mov ebp, 4 2923 00001735 FEC8 dec al 2924 00001737 75C3 jnz short lff22m2_1 ; 3:2:2:2:2 ; 7-11 of 17 2925 00001739 45 inc ebp ; 5 2926 0000173A EBC0 jmp short lff22m2_1 ; 3:2:2:2:2:2 ; 12-17 of 17 2927 2928 lff22m2_3: 2929 lff22s2_3: 2930 0000173C E978F4FFFF jmp lff22_3 ; padfill 2931 ; (put zeros in the remain words of the buffer) 2932 lff22m2_7: 2933 lff22s2_7: 2934 00001741 E994F4FFFF jmp lff22_5 ; error 2935 2936 load_22khz_stereo_16_bit: 2937 ; 16/11/2023 2938 00001746 F605[C8250000]01 test byte [flags], ENDOFFILE ; have we already read the 2939 ; last of the file? 2940 0000174D 7402 jz short lff22s2_0 ; no 2941 0000174F F9 stc 2942 00001750 C3 retn 2943 2944 lff22s2_0: 2945 00001751 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 2946 ;mov edx, [loadsize] 2947 2948 ; esi = buffer address 2949 ;; edx = buffer size 2950 2951 ; load file into memory 2952 sys _read, [FileHandle], esi, [loadsize] 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00001756 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 0000175C 89F1 <1> mov ecx, %3 80 <1> %if %0 = 4 81 0000175E 8B15[1E040000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00001764 B803000000 <1> mov eax, %1 86 <1> 87 00001769 CD40 <1> int 40h 2953 0000176B 72D4 jc short lff22s2_7 ; error ! 2954 2955 0000176D BF[00300000] mov edi, audio_buffer 2956 2957 00001772 C1E802 shr eax, 2 ; dword (left chan word + right chan word) 2958 00001775 7505 jnz short lff22s2_8 2959 00001777 E955F4FFFF jmp lff22_eof 2960 2961 lff22s2_8: 2962 0000177C 89C1 mov ecx, eax ; dword count 2963 lff22s2_9: 2964 0000177E BD05000000 mov ebp, 5 ; interpolation (one step) loop count 2965 00001783 C605[80220000]03 mov byte [faz], 3 ; 3 steps/phase 2966 lff22s2_1: 2967 ; 3:2:2:2:2:2::3:2:2:2:2::3:2:2:2:2:2 ; 37/17 2968 0000178A 66AD lodsw 2969 0000178C 89C3 mov ebx, eax 2970 0000178E 66AD lodsw 2971 00001790 8B16 mov edx, [esi] 2972 00001792 668915[7C220000] mov [next_val_l], dx 2973 ; 26/11/2023 2974 00001799 C1EA10 shr edx, 16 2975 0000179C 49 dec ecx 2976 0000179D 7509 jnz short lff22s2_2_1 2977 0000179F 31D2 xor edx, edx ; 0 2978 000017A1 668915[7C220000] mov [next_val_l], dx 2979 lff22s2_2_1: 2980 ; bx = [previous_val_l] 2981 ; ax = [previous_val_r] 2982 ; [next_val_l] 2983 ; dx = [next_val_r] 2984 000017A8 E889060000 call interpolating_3_16bit_stereo ; 1 of 17 2985 000017AD E38D jecxz lff22s2_3 2986 lff22s2_2_2: 2987 000017AF 66AD lodsw 2988 000017B1 89C3 mov ebx, eax 2989 000017B3 66AD lodsw 2990 000017B5 8B16 mov edx, [esi] 2991 000017B7 668915[7C220000] mov [next_val_l], dx 2992 ; 26/11/2023 2993 000017BE C1EA10 shr edx, 16 2994 000017C1 49 dec ecx 2995 000017C2 7509 jnz short lff22s2_2_3 2996 000017C4 31D2 xor edx, edx ; 0 2997 000017C6 668915[7C220000] mov [next_val_l], dx 2998 lff22s2_2_3: 2999 000017CD E8DF060000 call interpolating_2_16bit_stereo ; 2 of 17 .. 6 of 17 3000 000017D2 E31E jecxz lff22s2_2_4 3001 3002 000017D4 4D dec ebp 3003 000017D5 75D8 jnz short lff22s2_2_2 3004 3005 000017D7 A0[80220000] mov al, [faz] 3006 000017DC FEC8 dec al 3007 000017DE 749E jz short lff22s2_9 3008 000017E0 FE0D[80220000] dec byte [faz] 3009 000017E6 BD04000000 mov ebp, 4 3010 000017EB FEC8 dec al 3011 000017ED 759B jnz short lff22s2_1 ; 3:2:2:2:2 ; 7-11 of 17 3012 000017EF 45 inc ebp ; 5 3013 000017F0 EB98 jmp short lff22s2_1 ; 3:2:2:2:2:2 ; 12-17 of 17 3014 3015 lff22s2_2_4: 3016 ; 26/11/2023 3017 000017F2 E9C2F3FFFF jmp lff22_3 ; padfill 3018 3019 ; ..................... 3020 3021 load_11khz_mono_8_bit: 3022 ; 02/02/2025 3023 ; 18/11/2023 3024 000017F7 F605[C8250000]01 test byte [flags], ENDOFFILE ; have we already read the 3025 ; last of the file? 3026 000017FE 7402 jz short lff11m_0 ; no 3027 00001800 F9 stc 3028 00001801 C3 retn 3029 3030 lff11m_0: 3031 00001802 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 3032 ;mov edx, [loadsize] 3033 3034 ; esi = buffer address 3035 ;; edx = buffer size 3036 3037 ; load file into memory 3038 sys _read, [FileHandle], esi, [loadsize] 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00001807 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 0000180D 89F1 <1> mov ecx, %3 80 <1> %if %0 = 4 81 0000180F 8B15[1E040000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00001815 B803000000 <1> mov eax, %1 86 <1> 87 0000181A CD40 <1> int 40h 3039 0000181C 7247 jc short lff11m_7 ; error ! 3040 3041 0000181E BF[00300000] mov edi, audio_buffer 3042 3043 00001823 21C0 and eax, eax 3044 00001825 7505 jnz short lff11m_8 3045 00001827 E9A5F3FFFF jmp lff11_eof 3046 3047 lff11m_8: 3048 0000182C 89C1 mov ecx, eax ; byte count 3049 lff11m_9: 3050 0000182E BD06000000 mov ebp, 6 ; interpolation (one step) loop count 3051 lff11m_1: 3052 ; 5:4:4::5:4:4::5:4:4::5:4:4::5:4:4::5:4 ; 74/17 3053 00001833 AC lodsb 3054 ; 02/02/2025 3055 00001834 8A16 mov dl, [esi] 3056 00001836 49 dec ecx 3057 00001837 7502 jnz short lff11m_2_1 3058 00001839 B280 mov dl, 80h 3059 lff11m_2_1: 3060 ; al = [previous_val] 3061 ; dl = [next_val] 3062 0000183B E8A0060000 call interpolating_5_8bit_mono 3063 00001840 E328 jecxz lff11m_3 3064 lff11m_2_2: 3065 00001842 AC lodsb 3066 ; 02/02/2025 3067 00001843 8A16 mov dl, [esi] 3068 00001845 49 dec ecx 3069 00001846 7502 jnz short lff11m_2_3 3070 00001848 B280 mov dl, 80h 3071 lff11m_2_3: 3072 0000184A E89D070000 call interpolating_4_8bit_mono 3073 0000184F E319 jecxz lff11m_3 3074 3075 00001851 4D dec ebp 3076 00001852 74DA jz short lff11m_9 3077 3078 00001854 AC lodsb 3079 ; 02/02/2025 3080 00001855 8A16 mov dl, [esi] 3081 00001857 49 dec ecx 3082 00001858 7502 jnz short lff11m_2_4 3083 0000185A B280 mov dl, 80h 3084 lff11m_2_4: 3085 0000185C E88B070000 call interpolating_4_8bit_mono 3086 00001861 E307 jecxz lff11m_3 3087 00001863 EBCE jmp short lff11m_1 3088 3089 lff11m_7: 3090 lff11s_7: 3091 00001865 E970F3FFFF jmp lff11_5 ; error 3092 3093 lff11m_3: 3094 lff11s_3: 3095 0000186A E94AF3FFFF jmp lff11_3 ; padfill 3096 ; (put zeros in the remain words of the buffer) 3097 3098 load_11khz_stereo_8_bit: 3099 ; 02/02/2025 3100 ; 18/11/2023 3101 0000186F F605[C8250000]01 test byte [flags], ENDOFFILE ; have we already read the 3102 ; last of the file? 3103 00001876 7402 jz short lff11s_0 ; no 3104 00001878 F9 stc 3105 00001879 C3 retn 3106 3107 lff11s_0: 3108 0000187A BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 3109 ;mov edx, [loadsize] 3110 3111 ; esi = buffer address 3112 ;; edx = buffer size 3113 3114 ; load file into memory 3115 sys _read, [FileHandle], esi, [loadsize] 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 0000187F 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 00001885 89F1 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00001887 8B15[1E040000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 0000188D B803000000 <1> mov eax, %1 86 <1> 87 00001892 CD40 <1> int 40h 3116 00001894 72CF jc short lff11s_7 ; error ! 3117 3118 00001896 BF[00300000] mov edi, audio_buffer 3119 3120 0000189B D1E8 shr eax, 1 3121 0000189D 7505 jnz short lff11s_8 3122 0000189F E92DF3FFFF jmp lff11_eof 3123 3124 lff11s_8: 3125 000018A4 89C1 mov ecx, eax ; word count 3126 lff11s_9: 3127 000018A6 BD06000000 mov ebp, 6 ; interpolation (one step) loop count 3128 lff11s_1: 3129 ; 5:4:4::5:4:4::5:4:4::5:4:4::5:4:4::5:4 ; 74/17 3130 000018AB 66AD lodsw 3131 ; 02/02/2025 3132 000018AD 668B16 mov dx, [esi] 3133 000018B0 49 dec ecx 3134 000018B1 7504 jnz short lff11s_2_1 3135 000018B3 66BA8080 mov dx, 8080h 3136 lff11s_2_1: 3137 ; al = [previous_val_l] 3138 ; ah = [previous_val_r] 3139 ; dl = [next_val_l] 3140 ; dh = [next_val_r] 3141 000018B7 E883060000 call interpolating_5_8bit_stereo 3142 000018BC E3AC jecxz lff11s_3 3143 lff11s_2_2: 3144 000018BE 66AD lodsw 3145 ; 02/02/2025 3146 000018C0 668B16 mov dx, [esi] 3147 000018C3 49 dec ecx 3148 000018C4 7504 jnz short lff11s_2_3 3149 000018C6 66BA8080 mov dx, 8080h 3150 lff11s_2_3: 3151 000018CA E85C070000 call interpolating_4_8bit_stereo 3152 000018CF E399 jecxz lff11s_3 3153 3154 000018D1 4D dec ebp 3155 000018D2 74D2 jz short lff11s_9 3156 3157 000018D4 66AD lodsw 3158 ; 02/02/2025 3159 000018D6 668B16 mov dx, [esi] 3160 000018D9 49 dec ecx 3161 000018DA 7504 jnz short lff11s_2_4 3162 000018DC 66BA8080 mov dx, 8080h 3163 lff11s_2_4: 3164 000018E0 E846070000 call interpolating_4_8bit_stereo 3165 000018E5 E383 jecxz lff11s_3 3166 000018E7 EBC2 jmp short lff11s_1 3167 3168 load_11khz_mono_16_bit: 3169 ; 02/02/2025 3170 ; 18/11/2023 3171 000018E9 F605[C8250000]01 test byte [flags], ENDOFFILE ; have we already read the 3172 ; last of the file? 3173 000018F0 7402 jz short lff11m2_0 ; no 3174 000018F2 F9 stc 3175 000018F3 C3 retn 3176 3177 lff11m2_0: 3178 000018F4 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 3179 ;mov edx, [loadsize] 3180 3181 ; esi = buffer address 3182 ;; edx = buffer size 3183 3184 ; load file into memory 3185 sys _read, [FileHandle], esi, [loadsize] 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 000018F9 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 000018FF 89F1 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00001901 8B15[1E040000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00001907 B803000000 <1> mov eax, %1 86 <1> 87 0000190C CD40 <1> int 40h 3186 0000190E 724D jc short lff11m2_7 ; error ! 3187 3188 00001910 BF[00300000] mov edi, audio_buffer 3189 3190 00001915 D1E8 shr eax, 1 3191 00001917 7505 jnz short lff11m2_8 3192 00001919 E9B3F2FFFF jmp lff11_eof 3193 3194 lff11m2_8: 3195 0000191E 89C1 mov ecx, eax ; word count 3196 lff11m2_9: 3197 00001920 BD06000000 mov ebp, 6 ; interpolation (one step) loop count 3198 lff11m2_1: 3199 ; 5:4:4::5:4:4::5:4:4::5:4:4::5:4:4::5:4 ; 74/17 3200 00001925 66AD lodsw 3201 ; 02/02/2025 3202 00001927 668B16 mov dx, [esi] 3203 0000192A 49 dec ecx 3204 0000192B 7502 jnz short lff11m2_2_1 3205 0000192D 31D2 xor edx, edx 3206 lff11m2_2_1: 3207 ; ax = [previous_val] 3208 ; dx = [next_val] 3209 0000192F E864070000 call interpolating_5_16bit_mono 3210 00001934 E362 jecxz lff11m2_3 3211 lff11m2_2_2: 3212 00001936 66AD lodsw 3213 ; 02/02/2025 3214 00001938 668B16 mov dx, [esi] 3215 0000193B 49 dec ecx 3216 0000193C 7502 jnz short lff11m2_2_3 3217 0000193E 31D2 xor edx, edx 3218 lff11m2_2_3: 3219 00001940 E87D080000 call interpolating_4_16bit_mono 3220 00001945 E351 jecxz lff11m2_3 3221 3222 00001947 4D dec ebp 3223 00001948 74D6 jz short lff11m2_9 3224 3225 0000194A 66AD lodsw 3226 ; 02/02/2025 3227 0000194C 668B16 mov dx, [esi] 3228 0000194F 49 dec ecx 3229 00001950 7502 jnz short lff11m2_2_4 3230 00001952 31D2 xor edx, edx 3231 lff11m2_2_4: 3232 00001954 E869080000 call interpolating_4_16bit_mono 3233 00001959 E33D jecxz lff11m2_3 3234 0000195B EBC8 jmp short lff11m2_1 3235 3236 lff11m2_7: 3237 lff11s2_7: 3238 0000195D E978F2FFFF jmp lff11_5 ; error 3239 3240 load_11khz_stereo_16_bit: 3241 ; 17/01/2025 3242 ; 18/11/2023 3243 00001962 F605[C8250000]01 test byte [flags], ENDOFFILE ; have we already read the 3244 ; last of the file? 3245 00001969 7402 jz short lff11s2_0 ; no 3246 0000196B F9 stc 3247 0000196C C3 retn 3248 3249 lff11s2_0: 3250 0000196D BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 3251 ;mov edx, [loadsize] 3252 3253 ; esi = buffer address 3254 ;; edx = buffer size 3255 3256 ; load file into memory 3257 sys _read, [FileHandle], esi, [loadsize] 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00001972 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 00001978 89F1 <1> mov ecx, %3 80 <1> %if %0 = 4 81 0000197A 8B15[1E040000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00001980 B803000000 <1> mov eax, %1 86 <1> 87 00001985 CD40 <1> int 40h 3258 00001987 72D4 jc short lff11s2_7 ; error ! 3259 3260 00001989 BF[00300000] mov edi, audio_buffer 3261 3262 0000198E C1E802 shr eax, 2 ; dword (left chan word + right chan word) 3263 00001991 750A jnz short lff11s2_8 3264 00001993 E939F2FFFF jmp lff11_eof 3265 3266 lff11m2_3: 3267 lff11s2_3: 3268 00001998 E91CF2FFFF jmp lff11_3 ; padfill 3269 ; (put zeros in the remain words of the buffer) 3270 3271 lff11s2_8: 3272 0000199D 89C1 mov ecx, eax ; dword count 3273 lff11s2_9: 3274 0000199F BD06000000 mov ebp, 6 ; interpolation (one step) loop count 3275 lff11s2_1: 3276 ; 5:4:4::5:4:4::5:4:4::5:4:4::5:4:4::5:4 ; 74/17 3277 000019A4 66AD lodsw 3278 000019A6 89C3 mov ebx, eax 3279 000019A8 66AD lodsw 3280 000019AA 8B16 mov edx, [esi] 3281 ; 17/01/2025 3282 ;mov [next_val_l], edx 3283 ; 26/11/2023 3284 ;shr edx, 16 3285 ;mov [next_val_r], dx 3286 000019AC 49 dec ecx 3287 000019AD 7502 jnz short lff11s2_2_1 3288 000019AF 31D2 xor edx, edx ; 0 3289 ;mov [next_val_l], dx 3290 ;mov [next_val_r], dx 3291 lff11s2_2_1: 3292 ; bx = [previous_val_l] 3293 ; ax = [previous_val_r] 3294 ; [next_val_l] 3295 ; dx = [next_val_r] 3296 ;;; 3297 ; 17/01/2025 (BugFix) 3298 000019B1 8915[7C220000] mov [next_val_l], edx 3299 ;;; 3300 000019B7 E837070000 call interpolating_5_16bit_stereo 3301 000019BC E3DA jecxz lff11s2_3 3302 lff11s2_2_2: 3303 000019BE 66AD lodsw 3304 000019C0 89C3 mov ebx, eax 3305 000019C2 66AD lodsw 3306 000019C4 8B16 mov edx, [esi] 3307 ; 17/01/2025 3308 ;mov [next_val_l], dx 3309 ; 26/11/2023 3310 ;shr edx, 16 3311 ;mov [next_val_r], dx 3312 000019C6 49 dec ecx 3313 000019C7 7502 jnz short lff11s2_2_3 3314 000019C9 31D2 xor edx, edx ; 0 3315 ;mov [next_val_l], dx 3316 ;mov [next_val_r], dx 3317 lff11s2_2_3: 3318 ;;; 3319 ; 17/01/2025 (BugFix) 3320 000019CB 8915[7C220000] mov [next_val_l], edx 3321 ;;; 3322 000019D1 E825080000 call interpolating_4_16bit_stereo 3323 000019D6 E3C0 jecxz lff11s2_3 3324 3325 000019D8 4D dec ebp 3326 000019D9 74C4 jz short lff11s2_9 3327 3328 000019DB 66AD lodsw 3329 000019DD 89C3 mov ebx, eax 3330 000019DF 66AD lodsw 3331 000019E1 8B16 mov edx, [esi] 3332 ; 17/01/2025 3333 ;mov [next_val_l], dx 3334 ; 26/11/2023 3335 ;shr edx, 16 3336 ;mov [next_val_r], dx 3337 000019E3 49 dec ecx 3338 000019E4 7502 jnz short lff11s2_2_4 3339 000019E6 31D2 xor edx, edx ; 0 3340 ;mov [next_val_l], dx 3341 ;mov [next_val_r], dx 3342 lff11s2_2_4: 3343 ;;; 3344 ; 17/01/2025 (BugFix) 3345 000019E8 8915[7C220000] mov [next_val_l], edx 3346 ;;; 3347 000019EE E808080000 call interpolating_4_16bit_stereo 3348 000019F3 E3A3 jecxz lff11s2_3 3349 000019F5 EBAD jmp short lff11s2_1 3350 3351 ; ..................... 3352 3353 load_44khz_mono_8_bit: 3354 ; 02/02/2025 3355 ; 18/11/2023 3356 000019F7 F605[C8250000]01 test byte [flags], ENDOFFILE ; have we already read the 3357 ; last of the file? 3358 000019FE 7402 jz short lff44m_0 ; no 3359 00001A00 F9 stc 3360 00001A01 C3 retn 3361 3362 lff44m_0: 3363 00001A02 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 3364 ;mov edx, [loadsize] 3365 3366 ; esi = buffer address 3367 ;; edx = buffer size 3368 3369 ; load file into memory 3370 sys _read, [FileHandle], esi, [loadsize] 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00001A07 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 00001A0D 89F1 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00001A0F 8B15[1E040000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00001A15 B803000000 <1> mov eax, %1 86 <1> 87 00001A1A CD40 <1> int 40h 3371 00001A1C 7250 jc short lff44m_7 ; error ! 3372 3373 00001A1E BF[00300000] mov edi, audio_buffer 3374 3375 00001A23 21C0 and eax, eax 3376 00001A25 7505 jnz short lff44m_8 3377 00001A27 E9A5F1FFFF jmp lff44_eof 3378 3379 lff44m_8: 3380 00001A2C 89C1 mov ecx, eax ; byte count 3381 lff44m_9: 3382 00001A2E BD0A000000 mov ebp, 10 ; interpolation (one step) loop count 3383 00001A33 C605[80220000]02 mov byte [faz], 2 ; 2 steps/phases 3384 lff44m_1: 3385 ; 2:1:1:1:1:1:1:1:1:1:1:: ; 25/23 3386 ; 2:1:1:1:1:1:1:1:1:1:1:1 3387 00001A3A AC lodsb 3388 ; 02/02/2025 3389 00001A3B 8A16 mov dl, [esi] 3390 00001A3D 49 dec ecx 3391 00001A3E 7502 jnz short lff44m_2_1 3392 00001A40 B280 mov dl, 80h 3393 lff44m_2_1: 3394 ; al = [previous_val] 3395 ; dl = [next_val] 3396 00001A42 E871030000 call interpolating_2_8bit_mono 3397 00001A47 E320 jecxz lff44m_3 3398 lff44m_2_2: 3399 00001A49 AC lodsb 3400 00001A4A 2C80 sub al, 80h 3401 00001A4C 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3402 00001A50 66AB stosw ; (L) 3403 00001A52 66AB stosw ; (R) 3404 3405 00001A54 49 dec ecx 3406 00001A55 7412 jz short lff44m_3 3407 00001A57 4D dec ebp 3408 00001A58 75EF jnz short lff44m_2_2 3409 3410 00001A5A FE0D[80220000] dec byte [faz] 3411 00001A60 74CC jz short lff44m_9 3412 00001A62 BD0B000000 mov ebp, 11 3413 00001A67 EBD1 jmp short lff44m_1 3414 3415 lff44m_3: 3416 lff44s_3: 3417 00001A69 E94BF1FFFF jmp lff44_3 ; padfill 3418 ; (put zeros in the remain words of the buffer) 3419 lff44m_7: 3420 lff44s_7: 3421 00001A6E E967F1FFFF jmp lff44_5 ; error 3422 3423 load_44khz_stereo_8_bit: 3424 ; 02/02/2025 3425 ; 16/11/2023 3426 00001A73 F605[C8250000]01 test byte [flags], ENDOFFILE ; have we already read the 3427 ; last of the file? 3428 00001A7A 7402 jz short lff44s_0 ; no 3429 00001A7C F9 stc 3430 00001A7D C3 retn 3431 3432 lff44s_0: 3433 00001A7E BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 3434 ;mov edx, [loadsize] 3435 3436 ; esi = buffer address 3437 ;; edx = buffer size 3438 3439 ; load file into memory 3440 sys _read, [FileHandle], esi, [loadsize] 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00001A83 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 00001A89 89F1 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00001A8B 8B15[1E040000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00001A91 B803000000 <1> mov eax, %1 86 <1> 87 00001A96 CD40 <1> int 40h 3441 00001A98 72D4 jc short lff44s_7 ; error ! 3442 3443 00001A9A BF[00300000] mov edi, audio_buffer 3444 3445 00001A9F D1E8 shr eax, 1 3446 00001AA1 7505 jnz short lff44s_8 3447 00001AA3 E929F1FFFF jmp lff44_eof 3448 3449 lff44s_8: 3450 00001AA8 89C1 mov ecx, eax ; word count 3451 lff44s_9: 3452 00001AAA BD0A000000 mov ebp, 10 ; interpolation (one step) loop count 3453 00001AAF C605[80220000]02 mov byte [faz], 2 ; 2 steps/phase 3454 lff44s_1: 3455 ; 2:1:1:1:1:1:1:1:1:1:1:: ; 25/23 3456 ; 2:1:1:1:1:1:1:1:1:1:1:1 3457 00001AB6 66AD lodsw 3458 ; 02/02/2025 3459 00001AB8 668B16 mov dx, [esi] 3460 00001ABB 49 dec ecx 3461 00001ABC 7504 jnz short lff44s_2_1 3462 00001ABE 66BA8080 mov dx, 8080h 3463 lff44s_2_1: 3464 ; al = [previous_val_l] 3465 ; ah = [previous_val_r] 3466 ; dl = [next_val_l] 3467 ; dh = [next_val_r] 3468 00001AC2 E80E030000 call interpolating_2_8bit_stereo 3469 00001AC7 E3A0 jecxz lff44s_3 3470 lff44s_2_2: 3471 00001AC9 AC lodsb 3472 00001ACA 2C80 sub al, 80h 3473 00001ACC 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3474 00001AD0 66AB stosw ; (L) 3475 00001AD2 AC lodsb 3476 00001AD3 2C80 sub al, 80h 3477 00001AD5 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3478 00001AD9 66AB stosw ; (R) 3479 3480 00001ADB 49 dec ecx 3481 00001ADC 748B jz short lff44s_3 3482 00001ADE 4D dec ebp 3483 00001ADF 75E8 jnz short lff44s_2_2 3484 3485 00001AE1 FE0D[80220000] dec byte [faz] 3486 00001AE7 74C1 jz short lff44s_9 3487 00001AE9 BD0B000000 mov ebp, 11 3488 00001AEE EBC6 jmp short lff44s_1 3489 3490 load_44khz_mono_16_bit: 3491 ; 02/02/2025 3492 ; 18/11/2023 3493 00001AF0 F605[C8250000]01 test byte [flags], ENDOFFILE ; have we already read the 3494 ; last of the file? 3495 00001AF7 7402 jz short lff44m2_0 ; no 3496 00001AF9 F9 stc 3497 00001AFA C3 retn 3498 3499 lff44m2_0: 3500 00001AFB BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 3501 ;mov edx, [loadsize] 3502 3503 ; esi = buffer address 3504 ;; edx = buffer size 3505 3506 ; load file into memory 3507 sys _read, [FileHandle], esi, [loadsize] 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00001B00 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 00001B06 89F1 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00001B08 8B15[1E040000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00001B0E B803000000 <1> mov eax, %1 86 <1> 87 00001B13 CD40 <1> int 40h 3508 00001B15 724D jc short lff44m2_7 ; error ! 3509 3510 00001B17 BF[00300000] mov edi, audio_buffer 3511 3512 00001B1C D1E8 shr eax, 1 3513 00001B1E 7505 jnz short lff44m2_8 3514 00001B20 E9ACF0FFFF jmp lff44_eof 3515 3516 lff44m2_8: 3517 00001B25 89C1 mov ecx, eax ; word count 3518 lff44m2_9: 3519 00001B27 BD0A000000 mov ebp, 10 ; interpolation (one step) loop count 3520 00001B2C C605[80220000]02 mov byte [faz], 2 ; 2 steps/phases 3521 lff44m2_1: 3522 ; 2:1:1:1:1:1:1:1:1:1:1:: ; 25/23 3523 ; 2:1:1:1:1:1:1:1:1:1:1:1 3524 00001B33 66AD lodsw 3525 ; 02/02/2025 3526 00001B35 668B16 mov dx, [esi] 3527 00001B38 49 dec ecx 3528 00001B39 7502 jnz short lff44m2_2_1 3529 00001B3B 31D2 xor edx, edx 3530 lff44m2_2_1: 3531 ; ax = [previous_val] 3532 ; dx = [next_val] 3533 00001B3D E857030000 call interpolating_2_16bit_mono 3534 00001B42 E31B jecxz lff44m2_3 3535 lff44m2_2_2: 3536 00001B44 66AD lodsw 3537 00001B46 66AB stosw ; (L)eft Channel 3538 00001B48 66AB stosw ; (R)ight Channel 3539 3540 00001B4A 49 dec ecx 3541 00001B4B 7412 jz short lff44m2_3 3542 00001B4D 4D dec ebp 3543 00001B4E 75F4 jnz short lff44m2_2_2 3544 3545 00001B50 FE0D[80220000] dec byte [faz] 3546 00001B56 74CF jz short lff44m2_9 3547 00001B58 BD0B000000 mov ebp, 11 3548 00001B5D EBD4 jmp short lff44m2_1 3549 3550 lff44m2_3: 3551 lff44s2_3: 3552 00001B5F E955F0FFFF jmp lff44_3 ; padfill 3553 ; (put zeros in the remain words of the buffer) 3554 lff44m2_7: 3555 lff44s2_7: 3556 00001B64 E971F0FFFF jmp lff44_5 ; error 3557 3558 load_44khz_stereo_16_bit: 3559 ; 18/11/2023 3560 00001B69 F605[C8250000]01 test byte [flags], ENDOFFILE ; have we already read the 3561 ; last of the file? 3562 00001B70 7402 jz short lff44s2_0 ; no 3563 00001B72 F9 stc 3564 00001B73 C3 retn 3565 3566 lff44s2_0: 3567 00001B74 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 3568 ;mov edx, [loadsize] 3569 3570 ; esi = buffer address 3571 ;; edx = buffer size 3572 3573 ; load file into memory 3574 sys _read, [FileHandle], esi, [loadsize] 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00001B79 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 00001B7F 89F1 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00001B81 8B15[1E040000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00001B87 B803000000 <1> mov eax, %1 86 <1> 87 00001B8C CD40 <1> int 40h 3575 00001B8E 72D4 jc short lff44s2_7 ; error ! 3576 3577 00001B90 BF[00300000] mov edi, audio_buffer 3578 3579 00001B95 C1E802 shr eax, 2 ; dword (left chan word + right chan word) 3580 00001B98 7505 jnz short lff44s2_8 3581 00001B9A E932F0FFFF jmp lff44_eof 3582 3583 lff44s2_8: 3584 00001B9F 89C1 mov ecx, eax ; dword count 3585 lff44s2_9: 3586 00001BA1 BD0A000000 mov ebp, 10 ; interpolation (one step) loop count 3587 00001BA6 C605[80220000]02 mov byte [faz], 2 ; 2 steps/phase 3588 lff44s2_1: 3589 ; 2:1:1:1:1:1:1:1:1:1:1:: ; 25/23 3590 ; 2:1:1:1:1:1:1:1:1:1:1:1 3591 00001BAD 66AD lodsw 3592 00001BAF 89C3 mov ebx, eax 3593 00001BB1 66AD lodsw 3594 ;mov dx, [esi] 3595 ;mov [next_val_l], dx 3596 ;mov dx, [esi+2] 3597 ; 26/11/2023 3598 00001BB3 8B16 mov edx, [esi] 3599 00001BB5 668915[7C220000] mov [next_val_l], dx 3600 00001BBC C1EA10 shr edx, 16 3601 00001BBF 49 dec ecx 3602 00001BC0 7509 jnz short lff44s2_2_1 3603 00001BC2 31D2 xor edx, edx ; 0 3604 00001BC4 668915[7C220000] mov [next_val_l], dx 3605 lff44s2_2_1: 3606 ; bx = [previous_val_l] 3607 ; ax = [previous_val_r] 3608 ; [next_val_l] 3609 ; dx = [next_val_r] 3610 00001BCB E8E1020000 call interpolating_2_16bit_stereo 3611 00001BD0 E38D jecxz lff44s2_3 3612 lff44s2_2_2: 3613 ;movsw ; (L)eft Channel 3614 ;movsw ; (R)ight Channel 3615 00001BD2 A5 movsd 3616 3617 00001BD3 49 dec ecx 3618 00001BD4 7489 jz short lff44s2_3 3619 00001BD6 4D dec ebp 3620 00001BD7 75F9 jnz short lff44s2_2_2 3621 3622 00001BD9 FE0D[80220000] dec byte [faz] 3623 00001BDF 74C0 jz short lff44s2_9 3624 00001BE1 BD0B000000 mov ebp, 11 3625 00001BE6 EBC5 jmp short lff44s2_1 3626 3627 ; ..................... 3628 3629 ; 02/02/2025 3630 load_12khz_mono_8_bit: 3631 00001BE8 F605[C8250000]01 test byte [flags], ENDOFFILE ; have we already read the 3632 ; last of the file? 3633 00001BEF 7402 jz short lff12m_0 ; no 3634 00001BF1 F9 stc 3635 00001BF2 C3 retn 3636 3637 lff12m_0: 3638 00001BF3 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 3639 3640 ; load file into memory 3641 sys _read, [FileHandle], esi, [loadsize] 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00001BF8 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 00001BFE 89F1 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00001C00 8B15[1E040000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00001C06 B803000000 <1> mov eax, %1 86 <1> 87 00001C0B CD40 <1> int 40h 3642 00001C0D 7256 jc short lff12m_7 ; error ! 3643 3644 00001C0F BF[00300000] mov edi, audio_buffer 3645 3646 00001C14 21C0 and eax, eax 3647 00001C16 7505 jnz short lff12m_8 3648 00001C18 E9B4EFFFFF jmp lff12_eof 3649 3650 lff12m_8: 3651 00001C1D 89C1 mov ecx, eax ; byte count 3652 lff12m_1: 3653 ; original-interpolated-interpolated-interpolated 3654 00001C1F AC lodsb 3655 ; 02/02/2025 3656 00001C20 8A16 mov dl, [esi] 3657 00001C22 49 dec ecx 3658 00001C23 7502 jnz short lff12m_2 3659 00001C25 B280 mov dl, 80h 3660 lff12m_2: 3661 ; al = [previous_val] 3662 ; dl = [next_val] 3663 00001C27 E8C0030000 call interpolating_4_8bit_mono 3664 00001C2C E353 jecxz lff12m_3 3665 00001C2E EBEF jmp short lff12m_1 3666 3667 ; 02/02/2025 3668 load_12khz_stereo_8_bit: 3669 00001C30 F605[C8250000]01 test byte [flags], ENDOFFILE ; have we already read the 3670 ; last of the file? 3671 00001C37 7402 jz short lff12s_0 ; no 3672 00001C39 F9 stc 3673 00001C3A C3 retn 3674 3675 lff12s_0: 3676 00001C3B BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 3677 3678 ; load file into memory 3679 sys _read, [FileHandle], esi, [loadsize] 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00001C40 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 00001C46 89F1 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00001C48 8B15[1E040000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00001C4E B803000000 <1> mov eax, %1 86 <1> 87 00001C53 CD40 <1> int 40h 3680 00001C55 720E jc short lff12s_7 ; error ! 3681 3682 00001C57 BF[00300000] mov edi, audio_buffer 3683 3684 00001C5C D1E8 shr eax, 1 3685 00001C5E 750A jnz short lff12s_8 3686 00001C60 E96CEFFFFF jmp lff12_eof 3687 3688 lff12m_7: 3689 lff12s_7: 3690 00001C65 E970EFFFFF jmp lff12_5 ; error 3691 3692 lff12s_8: 3693 00001C6A 89C1 mov ecx, eax ; word count 3694 lff12s_1: 3695 ; original-interpolated-interpolated-interpolated 3696 00001C6C 66AD lodsw 3697 ; 02/02/2025 3698 00001C6E 668B16 mov dx, [esi] 3699 00001C71 49 dec ecx 3700 00001C72 7504 jnz short lff12s_2 3701 00001C74 66BA8080 mov dx, 8080h 3702 lff12s_2: 3703 ; al = [previous_val_l] 3704 ; ah = [previous_val_r] 3705 ; dl = [next_val_l] 3706 ; dh = [next_val_r] 3707 00001C78 E8AE030000 call interpolating_4_8bit_stereo 3708 00001C7D E302 jecxz lff12s_3 3709 00001C7F EBEB jmp short lff12s_1 3710 3711 lff12m_3: 3712 lff12s_3: 3713 00001C81 E933EFFFFF jmp lff12_3 ; padfill 3714 ; (put zeros in the remain words of the buffer) 3715 3716 ; 02/02/2025 3717 load_12khz_mono_16_bit: 3718 00001C86 F605[C8250000]01 test byte [flags], ENDOFFILE ; have we already read the 3719 ; last of the file? 3720 00001C8D 7402 jz short lff12m2_0 ; no 3721 00001C8F F9 stc 3722 00001C90 C3 retn 3723 3724 lff12m2_0: 3725 00001C91 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 3726 3727 ; load file into memory 3728 sys _read, [FileHandle], esi, [loadsize] 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00001C96 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 00001C9C 89F1 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00001C9E 8B15[1E040000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00001CA4 B803000000 <1> mov eax, %1 86 <1> 87 00001CA9 CD40 <1> int 40h 3729 00001CAB 7223 jc short lff12m2_7 ; error ! 3730 3731 00001CAD BF[00300000] mov edi, audio_buffer 3732 3733 00001CB2 D1E8 shr eax, 1 3734 00001CB4 7505 jnz short lff12m2_8 3735 00001CB6 E916EFFFFF jmp lff12_eof 3736 3737 lff12m2_8: 3738 00001CBB 89C1 mov ecx, eax ; word count 3739 lff12m2_1: 3740 ; original-interpolated-interpolated-interpolated 3741 00001CBD 66AD lodsw 3742 ; 02/02/2025 3743 00001CBF 668B16 mov dx, [esi] 3744 00001CC2 49 dec ecx 3745 00001CC3 7502 jnz short lff12m2_2 3746 00001CC5 31D2 xor edx, edx 3747 lff12m2_2: 3748 ; ax = [previous_val] 3749 ; dx = [next_val] 3750 00001CC7 E8F6040000 call interpolating_4_16bit_mono 3751 00001CCC E3B3 jecxz lff12m_3 3752 00001CCE EBED jmp short lff12m2_1 3753 3754 lff12m2_7: 3755 lff12s2_7: 3756 00001CD0 E905EFFFFF jmp lff12_5 ; error 3757 3758 ; 02/02/2025 3759 load_12khz_stereo_16_bit: 3760 00001CD5 F605[C8250000]01 test byte [flags], ENDOFFILE ; have we already read the 3761 ; last of the file? 3762 00001CDC 7402 jz short lff12s2_0 ; no 3763 00001CDE F9 stc 3764 00001CDF C3 retn 3765 3766 lff12s2_0: 3767 00001CE0 BE[00300100] mov esi, temp_buffer ; temporary buffer for wav data 3768 3769 ; load file into memory 3770 sys _read, [FileHandle], esi, [loadsize] 72 <1> 73 <1> 74 <1> 75 <1> 76 <1> %if %0 >= 2 77 00001CE5 8B1D[81220000] <1> mov ebx, %2 78 <1> %if %0 >= 3 79 00001CEB 89F1 <1> mov ecx, %3 80 <1> %if %0 = 4 81 00001CED 8B15[1E040000] <1> mov edx, %4 82 <1> %endif 83 <1> %endif 84 <1> %endif 85 00001CF3 B803000000 <1> mov eax, %1 86 <1> 87 00001CF8 CD40 <1> int 40h 3771 00001CFA 72D4 jc short lff12s2_7 ; error ! 3772 3773 00001CFC BF[00300000] mov edi, audio_buffer 3774 3775 00001D01 C1E802 shr eax, 2 ; dword (left chan word + right chan word) 3776 00001D04 750A jnz short lff12s2_8 3777 00001D06 E9C6EEFFFF jmp lff12_eof 3778 3779 lff12m2_3: 3780 lff12s2_3: 3781 00001D0B E9A9EEFFFF jmp lff12_3 ; padfill 3782 ; (put zeros in the remain words of the buffer) 3783 3784 lff12s2_8: 3785 00001D10 89C1 mov ecx, eax ; dword count 3786 lff12s2_1: 3787 ; original-interpolated-interpolated-interpolated 3788 00001D12 66AD lodsw 3789 00001D14 89C3 mov ebx, eax 3790 00001D16 66AD lodsw 3791 00001D18 8B16 mov edx, [esi] 3792 00001D1A 49 dec ecx 3793 00001D1B 7502 jnz short lff12s2_2 3794 00001D1D 31D2 xor edx, edx ; 0 3795 lff12s2_2: 3796 ;mov [next_val_l], dx 3797 ;shr edx, 16 3798 ;mov [next_val_r], dx 3799 ; 02/02/2025 3800 00001D1F 8915[7C220000] mov [next_val_l], edx 3801 3802 ; bx = [previous_val_l] 3803 ; ax = [previous_val_r] 3804 ; [next_val_l] 3805 ; [next_val_r] 3806 00001D25 E8D1040000 call interpolating_4_16bit_stereo 3807 00001D2A E3DF jecxz lff12s2_3 3808 00001D2C EBE4 jmp short lff12s2_1 3809 3810 ; ..................... 3811 3812 interpolating_3_8bit_mono: 3813 ; 02/02/2025 3814 ; 16/11/2023 3815 ; al = [previous_val] 3816 ; dl = [next_val] 3817 ; original-interpolated-interpolated 3818 00001D2E 88C3 mov bl, al 3819 00001D30 2C80 sub al, 80h 3820 00001D32 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3821 00001D36 66AB stosw ; original sample (L) 3822 00001D38 66AB stosw ; original sample (R) 3823 00001D3A 88D8 mov al, bl 3824 00001D3C 00D0 add al, dl 3825 00001D3E D0D8 rcr al, 1 3826 00001D40 88C7 mov bh, al ; interpolated middle (temporary) 3827 00001D42 00D8 add al, bl 3828 00001D44 D0D8 rcr al, 1 3829 00001D46 2C80 sub al, 80h 3830 00001D48 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3831 00001D4C 66AB stosw ; interpolated sample 1 (L) 3832 00001D4E 66AB stosw ; interpolated sample 1 (R) 3833 00001D50 88F8 mov al, bh 3834 00001D52 00D0 add al, dl ; [next_val] 3835 00001D54 D0D8 rcr al, 1 3836 ; 02/02/2025 3837 00001D56 2C80 sub al, 80h 3838 00001D58 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3839 00001D5C 66AB stosw ; interpolated sample 2 (L) 3840 00001D5E 66AB stosw ; interpolated sample 2 (R) 3841 00001D60 C3 retn 3842 3843 interpolating_3_8bit_stereo: 3844 ; 02/02/2025 3845 ; 16/11/2023 3846 ; al = [previous_val_l] 3847 ; ah = [previous_val_r] 3848 ; dl = [next_val_l] 3849 ; dh = [next_val_r] 3850 ; original-interpolated-interpolated 3851 00001D61 89C3 mov ebx, eax 3852 00001D63 2C80 sub al, 80h 3853 00001D65 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3854 00001D69 66AB stosw ; original sample (L) 3855 00001D6B 88F8 mov al, bh 3856 00001D6D 2C80 sub al, 80h 3857 00001D6F 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3858 00001D73 66AB stosw ; original sample (R) 3859 00001D75 88D8 mov al, bl 3860 00001D77 00D0 add al, dl ; [next_val_l] 3861 00001D79 D0D8 rcr al, 1 3862 00001D7B 50 push eax ; * ; al = interpolated middle (L) (temporary) 3863 00001D7C 00D8 add al, bl ; [previous_val_l] 3864 00001D7E D0D8 rcr al, 1 3865 00001D80 2C80 sub al, 80h 3866 00001D82 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3867 00001D86 66AB stosw ; interpolated sample 1 (L) 3868 00001D88 88F8 mov al, bh 3869 00001D8A 00F0 add al, dh ; [next_val_r] 3870 00001D8C D0D8 rcr al, 1 3871 00001D8E 50 push eax ; ** ; al = interpolated middle (R) (temporary) 3872 00001D8F 00F8 add al, bh ; [previous_val_r] 3873 00001D91 D0D8 rcr al, 1 3874 00001D93 2C80 sub al, 80h 3875 00001D95 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3876 00001D99 66AB stosw ; interpolated sample 1 (R) 3877 00001D9B 5B pop ebx ; ** 3878 00001D9C 58 pop eax ; * 3879 00001D9D 00D0 add al, dl ; [next_val_l] 3880 00001D9F D0D8 rcr al, 1 3881 ; 02/02/2025 3882 00001DA1 2C80 sub al, 80h 3883 00001DA3 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3884 00001DA7 66AB stosw ; interpolated sample 2 (L) 3885 00001DA9 88D8 mov al, bl 3886 00001DAB 00F0 add al, dh ; [next_val_r] 3887 00001DAD D0D8 rcr al, 1 3888 ; 02/02/2025 3889 00001DAF 2C80 sub al, 80h 3890 00001DB1 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3891 00001DB5 66AB stosw ; interpolated sample 2 (R) 3892 00001DB7 C3 retn 3893 3894 interpolating_2_8bit_mono: 3895 ; 16/11/2023 3896 ; al = [previous_val] 3897 ; dl = [next_val] 3898 ; original-interpolated 3899 00001DB8 88C3 mov bl, al 3900 00001DBA 2C80 sub al, 80h 3901 00001DBC 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3902 00001DC0 66AB stosw ; original sample (L) 3903 00001DC2 66AB stosw ; original sample (R) 3904 00001DC4 88D8 mov al, bl 3905 00001DC6 00D0 add al, dl 3906 00001DC8 D0D8 rcr al, 1 3907 00001DCA 2C80 sub al, 80h 3908 00001DCC 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3909 00001DD0 66AB stosw ; interpolated sample (L) 3910 00001DD2 66AB stosw ; interpolated sample (R) 3911 00001DD4 C3 retn 3912 3913 interpolating_2_8bit_stereo: 3914 ; 16/11/2023 3915 ; al = [previous_val_l] 3916 ; ah = [previous_val_r] 3917 ; dl = [next_val_l] 3918 ; dh = [next_val_r] 3919 ; original-interpolated 3920 00001DD5 89C3 mov ebx, eax 3921 00001DD7 2C80 sub al, 80h 3922 00001DD9 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3923 00001DDD 66AB stosw ; original sample (L) 3924 00001DDF 88F8 mov al, bh 3925 00001DE1 2C80 sub al, 80h 3926 00001DE3 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3927 00001DE7 66AB stosw ; original sample (R) 3928 00001DE9 88D8 mov al, bl ; [previous_val_l] 3929 00001DEB 00D0 add al, dl ; [next_val_l] 3930 00001DED D0D8 rcr al, 1 3931 00001DEF 2C80 sub al, 80h 3932 00001DF1 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3933 00001DF5 66AB stosw ; interpolated sample (L) 3934 00001DF7 88F8 mov al, bh 3935 00001DF9 00F0 add al, dh ; [next_val_r] 3936 00001DFB D0D8 rcr al, 1 3937 00001DFD 2C80 sub al, 80h 3938 00001DFF 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3939 00001E03 66AB stosw ; interpolated sample (R) 3940 00001E05 C3 retn 3941 3942 interpolating_3_16bit_mono: 3943 ; 16/11/2023 3944 ; ax = [previous_val] 3945 ; dx = [next_val] 3946 ; original-interpolated-interpolated 3947 3948 00001E06 66AB stosw ; original sample (L) 3949 00001E08 66AB stosw ; original sample (R) 3950 00001E0A 80C480 add ah, 80h ; convert sound level 0 to 65535 format 3951 00001E0D 50 push eax ; * ; [previous_val] 3952 00001E0E 80C680 add dh, 80h 3953 00001E11 6601D0 add ax, dx 3954 00001E14 66D1D8 rcr ax, 1 3955 00001E17 5B pop ebx ; * 3956 00001E18 93 xchg ebx, eax ; bx = interpolated middle (temporary) 3957 00001E19 6601D8 add ax, bx ; [previous_val] + interpolated middle 3958 00001E1C 66D1D8 rcr ax, 1 3959 00001E1F 80EC80 sub ah, 80h ; -32768 to +32767 format again 3960 00001E22 66AB stosw ; interpolated sample 1 (L) 3961 00001E24 66AB stosw ; interpolated sample 1 (R) 3962 00001E26 89D8 mov eax, ebx 3963 00001E28 6601D0 add ax, dx ; interpolated middle + [next_val] 3964 00001E2B 66D1D8 rcr ax, 1 3965 00001E2E 80EC80 sub ah, 80h ; -32768 to +32767 format again 3966 00001E31 66AB stosw ; interpolated sample 2 (L) 3967 00001E33 66AB stosw ; interpolated sample 2 (R) 3968 00001E35 C3 retn 3969 3970 interpolating_3_16bit_stereo: 3971 ; 16/11/2023 3972 ; bx = [previous_val_l] 3973 ; ax = [previous_val_r] 3974 ; [next_val_l] 3975 ; dx = [next_val_r] 3976 ; original-interpolated-interpolated 3977 3978 00001E36 93 xchg eax, ebx 3979 00001E37 66AB stosw ; original sample (L) 3980 00001E39 93 xchg eax, ebx 3981 00001E3A 66AB stosw ; original sample (R) 3982 00001E3C 80C480 add ah, 80h ; convert sound level 0 to 65535 format 3983 00001E3F 50 push eax ; * ; [previous_val_r] 3984 00001E40 80C780 add bh, 80h 3985 00001E43 8005[7D220000]80 add byte [next_val_l+1], 80h 3986 00001E4A 66A1[7C220000] mov ax, [next_val_l] 3987 00001E50 6601D8 add ax, bx ; [previous_val_l] 3988 00001E53 66D1D8 rcr ax, 1 3989 00001E56 93 xchg eax, ebx ; ax = [previous_val_l] 3990 00001E57 6601D8 add ax, bx ; bx = interpolated middle (L) 3991 00001E5A 66D1D8 rcr ax, 1 3992 00001E5D 80EC80 sub ah, 80h ; -32768 to +32767 format again 3993 00001E60 66AB stosw ; interpolated sample 1 (L) 3994 00001E62 58 pop eax ; * 3995 00001E63 80C680 add dh, 80h ; convert sound level 0 to 65535 format 3996 00001E66 52 push edx ; * ; [next_val_r] 3997 00001E67 92 xchg eax, edx 3998 00001E68 6601D0 add ax, dx ; [next_val_r] + [previous_val_r] 3999 00001E6B 66D1D8 rcr ax, 1 ; / 2 4000 00001E6E 50 push eax ; ** ; interpolated middle (R) 4001 00001E6F 6601D0 add ax, dx ; + [previous_val_r] 4002 00001E72 66D1D8 rcr ax, 1 4003 00001E75 80EC80 sub ah, 80h ; -32768 to +32767 format again 4004 00001E78 66AB stosw ; interpolated sample 1 (R) 4005 00001E7A 66A1[7C220000] mov ax, [next_val_l] 4006 00001E80 6601D8 add ax, bx ; + interpolated middle (L) 4007 00001E83 66D1D8 rcr ax, 1 4008 00001E86 80EC80 sub ah, 80h ; -32768 to +32767 format again 4009 00001E89 66AB stosw ; interpolated sample 2 (L) 4010 00001E8B 58 pop eax ; ** 4011 00001E8C 5A pop edx ; * 4012 00001E8D 6601D0 add ax, dx ; interpolated middle + [next_val_r] 4013 00001E90 66D1D8 rcr ax, 1 ; / 2 4014 00001E93 80EC80 sub ah, 80h ; -32768 to +32767 format again 4015 00001E96 66AB stosw ; interpolated sample 2 (L) 4016 00001E98 C3 retn 4017 4018 interpolating_2_16bit_mono: 4019 ; 16/11/2023 4020 ; ax = [previous_val] 4021 ; dx = [next_val] 4022 ; original-interpolated 4023 4024 00001E99 66AB stosw ; original sample (L) 4025 00001E9B 66AB stosw ; original sample (R) 4026 00001E9D 80C480 add ah, 80h ; convert sound level 0 to 65535 format 4027 00001EA0 80C680 add dh, 80h 4028 00001EA3 6601D0 add ax, dx 4029 00001EA6 66D1D8 rcr ax, 1 4030 00001EA9 80EC80 sub ah, 80h ; -32768 to +32767 format again 4031 00001EAC 66AB stosw ; interpolated sample (L) 4032 00001EAE 66AB stosw ; interpolated sample (R) 4033 00001EB0 C3 retn 4034 4035 interpolating_2_16bit_stereo: 4036 ; 17/01/2025 4037 ; 16/11/2023 4038 ; bx = [previous_val_l] 4039 ; ax = [previous_val_r] 4040 ; [next_val_l] 4041 ; dx = [next_val_r] 4042 ; original-interpolated 4043 4044 00001EB1 93 xchg eax, ebx 4045 00001EB2 66AB stosw ; original sample (L) 4046 00001EB4 93 xchg eax, ebx 4047 00001EB5 66AB stosw ; original sample (R) 4048 00001EB7 80C480 add ah, 80h ; convert sound level 0 to 65535 format 4049 00001EBA 80C680 add dh, 80h 4050 00001EBD 6601D0 add ax, dx ; [previous_val_r] + [next_val_r] 4051 00001EC0 66D1D8 rcr ax, 1 ; / 2 4052 ; 17/01/2025 4053 00001EC3 80EC80 sub ah, 80h ; -32768 to +32767 format again 4054 ;push eax ; * ; interpolated sample (R) 4055 ; 17/01/2025 4056 00001EC6 C1E010 shl eax, 16 4057 00001EC9 66A1[7C220000] mov ax, [next_val_l] 4058 00001ECF 80C480 add ah, 80h 4059 00001ED2 80C780 add bh, 80h 4060 00001ED5 6601D8 add ax, bx ; [next_val_l] + [previous_val_l] 4061 00001ED8 66D1D8 rcr ax, 1 ; / 2 4062 00001EDB 80EC80 sub ah, 80h ; -32768 to +32767 format again 4063 ; 17/01/2025 4064 ;stosw ; interpolated sample (L) 4065 ;pop eax ; * 4066 ;sub ah, 80h ; -32768 to +32767 format again 4067 ;stosw ; interpolated sample (R) 4068 ; 17/01/2025 4069 00001EDE AB stosd 4070 00001EDF C3 retn 4071 4072 interpolating_5_8bit_mono: 4073 ; 17/11/2023 4074 ; al = [previous_val] 4075 ; dl = [next_val] 4076 ; original-interpltd-interpltd-interpltd-interpltd 4077 00001EE0 88C3 mov bl, al 4078 00001EE2 2C80 sub al, 80h 4079 00001EE4 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4080 00001EE8 66AB stosw ; original sample (L) 4081 00001EEA 66AB stosw ; original sample (R) 4082 00001EEC 88D8 mov al, bl 4083 00001EEE 00D0 add al, dl 4084 00001EF0 D0D8 rcr al, 1 4085 00001EF2 88C7 mov bh, al ; interpolated middle (temporary) 4086 00001EF4 00D8 add al, bl ; [previous_val] 4087 00001EF6 D0D8 rcr al, 1 4088 00001EF8 88C6 mov dh, al ; interpolated 1st quarter (temporary) 4089 00001EFA 00D8 add al, bl 4090 00001EFC D0D8 rcr al, 1 4091 00001EFE 2C80 sub al, 80h 4092 00001F00 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4093 00001F04 66AB stosw ; interpolated sample 1 (L) 4094 00001F06 66AB stosw ; interpolated sample 1 (R) 4095 00001F08 88F8 mov al, bh 4096 00001F0A 00F0 add al, dh 4097 00001F0C D0D8 rcr al, 1 4098 00001F0E 2C80 sub al, 80h 4099 00001F10 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4100 00001F14 66AB stosw ; interpolated sample 2 (L) 4101 00001F16 66AB stosw ; interpolated sample 2 (R) 4102 00001F18 88F8 mov al, bh 4103 00001F1A 00D0 add al, dl ; [next_val] 4104 00001F1C D0D8 rcr al, 1 4105 00001F1E 88C6 mov dh, al ; interpolated 3rd quarter (temporary) 4106 00001F20 00F8 add al, bh 4107 00001F22 D0D8 rcr al, 1 4108 00001F24 2C80 sub al, 80h 4109 00001F26 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4110 00001F2A 66AB stosw ; interpolated sample 3 (L) 4111 00001F2C 66AB stosw ; interpolated sample 3 (R) 4112 00001F2E 88F0 mov al, dh 4113 00001F30 00D0 add al, dl 4114 00001F32 D0D8 rcr al, 1 4115 00001F34 2C80 sub al, 80h 4116 00001F36 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4117 00001F3A 66AB stosw ; interpolated sample 4 (L) 4118 00001F3C 66AB stosw ; interpolated sample 4 (R) 4119 00001F3E C3 retn 4120 4121 interpolating_5_8bit_stereo: 4122 ; 17/11/2023 4123 ; al = [previous_val_l] 4124 ; ah = [previous_val_r] 4125 ; dl = [next_val_l] 4126 ; dh = [next_val_r] 4127 ; original-interpltd-interpltd-interpltd-interpltd 4128 00001F3F 89C3 mov ebx, eax 4129 00001F41 2C80 sub al, 80h 4130 00001F43 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4131 00001F47 66AB stosw ; original sample (L) 4132 00001F49 88F8 mov al, bh 4133 00001F4B 2C80 sub al, 80h 4134 00001F4D 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4135 00001F51 66AB stosw ; original sample (R) 4136 00001F53 52 push edx ; * 4137 00001F54 88D8 mov al, bl 4138 00001F56 00D0 add al, dl ; [next_val_l] 4139 00001F58 D0D8 rcr al, 1 4140 00001F5A 50 push eax ; ** ; al = interpolated middle (L) (temporary) 4141 00001F5B 00D8 add al, bl ; [previous_val_l] 4142 00001F5D D0D8 rcr al, 1 4143 00001F5F 86D8 xchg al, bl 4144 00001F61 00D8 add al, bl ; bl = interpolated 1st quarter (L) (temp) 4145 00001F63 D0D8 rcr al, 1 4146 00001F65 2C80 sub al, 80h 4147 00001F67 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4148 00001F6B 66AB stosw ; interpolated sample 1 (L) 4149 00001F6D 88F8 mov al, bh 4150 00001F6F 00F0 add al, dh ; [next_val_r] 4151 00001F71 D0D8 rcr al, 1 4152 00001F73 50 push eax ; *** ; al = interpolated middle (R) (temporary) 4153 00001F74 00F8 add al, bh ; [previous_val_r] 4154 00001F76 D0D8 rcr al, 1 4155 00001F78 86F8 xchg al, bh 4156 00001F7A 00F8 add al, bh ; bh = interpolated 1st quarter (R) (temp) 4157 00001F7C D0D8 rcr al, 1 4158 00001F7E 2C80 sub al, 80h 4159 00001F80 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4160 00001F84 66AB stosw ; interpolated sample 1 (R) 4161 00001F86 5A pop edx ; *** 4162 00001F87 58 pop eax ; ** ; al = interpolated middle (L) (temporary) 4163 00001F88 86D8 xchg al, bl ; al = interpolated 1st quarter (L) (temp) 4164 00001F8A 00D8 add al, bl ; bl = interpolated middle (L) (temporary) 4165 00001F8C D0D8 rcr al, 1 4166 00001F8E 2C80 sub al, 80h 4167 00001F90 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4168 00001F94 66AB stosw ; interpolated sample 2 (L) 4169 00001F96 88D0 mov al, dl ; interpolated middle (R) (temporary) 4170 00001F98 86F8 xchg al, bh ; al = interpolated 1st quarter (R) (temp) 4171 00001F9A 00F8 add al, bh ; bh = interpolated middle (R) (temporary) 4172 00001F9C D0D8 rcr al, 1 4173 00001F9E 2C80 sub al, 80h 4174 00001FA0 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4175 00001FA4 66AB stosw ; interpolated sample 2 (R) 4176 00001FA6 5A pop edx ; * 4177 00001FA7 88D8 mov al, bl ; interpolated middle (L) (temporary) 4178 00001FA9 00D0 add al, dl ; [next_val_l] 4179 00001FAB D0D8 rcr al, 1 4180 00001FAD 86D8 xchg al, bl ; al = interpolated middle (R) (temporary) 4181 00001FAF 00D8 add al, bl ; bl = interpolated 3rd quarter (L) (temp) 4182 00001FB1 D0D8 rcr al, 1 4183 00001FB3 2C80 sub al, 80h 4184 00001FB5 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4185 00001FB9 66AB stosw ; interpolated sample 3 (L) 4186 00001FBB 88F8 mov al, bh 4187 00001FBD 00F0 add al, dh ; interpolated middle (R) + [next_val_r] 4188 00001FBF D0D8 rcr al, 1 4189 00001FC1 86F8 xchg al, bh ; al = interpolated middle (R) 4190 00001FC3 00F8 add al, bh ; bh = interpolated 3rd quarter (R) (temp) 4191 00001FC5 D0D8 rcr al, 1 4192 00001FC7 2C80 sub al, 80h 4193 00001FC9 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4194 00001FCD 66AB stosw ; interpolated sample 3 (R) 4195 00001FCF 88D8 mov al, bl 4196 00001FD1 00D0 add al, dl ; [next_val_l] 4197 00001FD3 D0D8 rcr al, 1 4198 00001FD5 2C80 sub al, 80h 4199 00001FD7 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4200 00001FDB 66AB stosw ; interpolated sample 4 (L) 4201 00001FDD 88F8 mov al, bh 4202 00001FDF 00F0 add al, dh ; [next_val_r] 4203 00001FE1 D0D8 rcr al, 1 4204 00001FE3 2C80 sub al, 80h 4205 00001FE5 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4206 00001FE9 66AB stosw ; interpolated sample 4 (R) 4207 00001FEB C3 retn 4208 4209 interpolating_4_8bit_mono: 4210 ; 17/11/2023 4211 ; al = [previous_val] 4212 ; dl = [next_val] 4213 ; original-interpolated-interpolated-interpolated 4214 00001FEC 88C3 mov bl, al 4215 00001FEE 2C80 sub al, 80h 4216 00001FF0 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4217 00001FF4 66AB stosw ; original sample (L) 4218 00001FF6 66AB stosw ; original sample (R) 4219 00001FF8 88D8 mov al, bl 4220 00001FFA 00D0 add al, dl 4221 00001FFC D0D8 rcr al, 1 4222 00001FFE 86D8 xchg al, bl ; al = [previous_val] 4223 00002000 00D8 add al, bl ; bl = interpolated middle (sample 2) 4224 00002002 D0D8 rcr al, 1 4225 00002004 2C80 sub al, 80h 4226 00002006 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4227 0000200A 66AB stosw ; interpolated sample 1 (L) 4228 0000200C 66AB stosw ; interpolated sample 1 (R) 4229 0000200E 88D8 mov al, bl ; interpolated middle (sample 2) 4230 00002010 2C80 sub al, 80h 4231 00002012 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4232 00002016 66AB stosw ; interpolated sample 2 (L) 4233 00002018 66AB stosw ; interpolated sample 2 (R) 4234 0000201A 88D8 mov al, bl 4235 0000201C 00D0 add al, dl ; [next_val] 4236 0000201E D0D8 rcr al, 1 4237 00002020 2C80 sub al, 80h 4238 00002022 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4239 00002026 66AB stosw ; interpolated sample 3 (L) 4240 00002028 66AB stosw ; interpolated sample 3 (R) 4241 0000202A C3 retn 4242 4243 interpolating_4_8bit_stereo: 4244 ; 17/11/2023 4245 ; al = [previous_val_l] 4246 ; ah = [previous_val_r] 4247 ; dl = [next_val_l] 4248 ; dh = [next_val_r] 4249 ; original-interpolated-interpolated-interpolated 4250 0000202B 89C3 mov ebx, eax 4251 0000202D 2C80 sub al, 80h 4252 0000202F 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4253 00002033 66AB stosw ; original sample (L) 4254 00002035 88F8 mov al, bh 4255 00002037 2C80 sub al, 80h 4256 00002039 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4257 0000203D 66AB stosw ; original sample (R) 4258 0000203F 88D8 mov al, bl 4259 00002041 00D0 add al, dl ; [next_val_l] 4260 00002043 D0D8 rcr al, 1 4261 00002045 86D8 xchg al, bl ; al = [previous_val_l] 4262 00002047 00D8 add al, bl ; bl = interpolated middle (L) (sample 2) 4263 00002049 D0D8 rcr al, 1 4264 0000204B 2C80 sub al, 80h 4265 0000204D 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4266 00002051 66AB stosw ; interpolated sample 1 (L) 4267 00002053 88F8 mov al, bh 4268 00002055 00F0 add al, dh ; [next_val_r] 4269 00002057 D0D8 rcr al, 1 4270 00002059 86F8 xchg al, bh ; al = [previous_val_h] 4271 0000205B 00F8 add al, bh ; bh = interpolated middle (R) (sample 2) 4272 0000205D D0D8 rcr al, 1 4273 0000205F 2C80 sub al, 80h 4274 00002061 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4275 00002065 66AB stosw ; interpolated sample 1 (R) 4276 00002067 88D8 mov al, bl ; interpolated middle (L) (sample 2) 4277 00002069 2C80 sub al, 80h 4278 0000206B 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4279 0000206F 66AB stosw ; interpolated sample 2 (L) 4280 00002071 88F8 mov al, bh ; interpolated middle (L) (sample 2) 4281 00002073 2C80 sub al, 80h 4282 00002075 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4283 00002079 66AB stosw ; interpolated sample 2 (L) 4284 0000207B 88D8 mov al, bl 4285 0000207D 00D0 add al, dl ; [next_val_l] 4286 0000207F D0D8 rcr al, 1 4287 00002081 2C80 sub al, 80h 4288 00002083 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4289 00002087 66AB stosw ; interpolated sample 3 (L) 4290 00002089 88F8 mov al, bh 4291 0000208B 00F0 add al, dh ; [next_val_r] 4292 0000208D D0D8 rcr al, 1 4293 0000208F 2C80 sub al, 80h 4294 00002091 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4295 00002095 66AB stosw ; interpolated sample 3 (R) 4296 00002097 C3 retn 4297 4298 interpolating_5_16bit_mono: 4299 ; 18/11/2023 4300 ; ax = [previous_val] 4301 ; dx = [next_val] 4302 ; original-interpltd-interpltd-interpltd-interpltd 4303 00002098 66AB stosw ; original sample (L) 4304 0000209A 66AB stosw ; original sample (R) 4305 0000209C 80C480 add ah, 80h ; convert sound level 0 to 65535 format 4306 0000209F 89C3 mov ebx, eax ; [previous_val] 4307 000020A1 80C680 add dh, 80h 4308 000020A4 6601D0 add ax, dx 4309 000020A7 66D1D8 rcr ax, 1 4310 000020AA 50 push eax ; * ; interpolated middle (temporary) 4311 000020AB 6601D8 add ax, bx ; interpolated middle + [previous_val] 4312 000020AE 66D1D8 rcr ax, 1 4313 000020B1 50 push eax ; ** ; interpolated 1st quarter (temporary) 4314 000020B2 6601D8 add ax, bx ; 1st quarter + [previous_val] 4315 000020B5 66D1D8 rcr ax, 1 4316 000020B8 80EC80 sub ah, 80h ; -32768 to +32767 format again 4317 000020BB 66AB stosw ; interpolated sample 1 (L) 4318 000020BD 66AB stosw ; interpolated sample 1 (R) 4319 000020BF 58 pop eax ; ** 4320 000020C0 5B pop ebx ; * 4321 000020C1 6601D8 add ax, bx ; 1st quarter + middle 4322 000020C4 66D1D8 rcr ax, 1 ; / 2 4323 000020C7 80EC80 sub ah, 80h ; -32768 to +32767 format again 4324 000020CA 66AB stosw ; interpolated sample 2 (L) 4325 000020CC 66AB stosw ; interpolated sample 2 (R) 4326 000020CE 89D8 mov eax, ebx 4327 000020D0 6601D0 add ax, dx ; interpolated middle + [next_val] 4328 000020D3 66D1D8 rcr ax, 1 4329 000020D6 50 push eax ; * ; interpolated 3rd quarter (temporary) 4330 000020D7 6601D8 add ax, bx ; + interpolated middle 4331 000020DA 66D1D8 rcr ax, 1 4332 000020DD 80EC80 sub ah, 80h ; -32768 to +32767 format again 4333 000020E0 66AB stosw ; interpolated sample 3 (L) 4334 000020E2 66AB stosw ; interpolated sample 3 (R) 4335 000020E4 58 pop eax ; * 4336 000020E5 6601D0 add ax, dx ; 3rd quarter + [next_val] 4337 000020E8 66D1D8 rcr ax, 1 ; / 2 4338 000020EB 80EC80 sub ah, 80h ; -32768 to +32767 format again 4339 000020EE 66AB stosw ; interpolated sample 4 (L) 4340 000020F0 66AB stosw ; interpolated sample 4 (R) 4341 000020F2 C3 retn 4342 4343 interpolating_5_16bit_stereo: 4344 ; 18/11/2023 4345 ; bx = [previous_val_l] 4346 ; ax = [previous_val_r] 4347 ; [next_val_l] 4348 ; [next_val_r] 4349 ; original-interpltd-interpltd-interpltd-interpltd 4350 000020F3 51 push ecx ; ! 4351 000020F4 93 xchg eax, ebx 4352 000020F5 66AB stosw ; original sample (L) 4353 000020F7 93 xchg eax, ebx 4354 000020F8 66AB stosw ; original sample (R) 4355 000020FA 80C480 add ah, 80h ; convert sound level 0 to 65535 format 4356 000020FD 50 push eax ; * ; [previous_val_r] 4357 000020FE 80C780 add bh, 80h 4358 00002101 8005[7D220000]80 add byte [next_val_l+1], 80h 4359 00002108 66A1[7C220000] mov ax, [next_val_l] 4360 0000210E 6601D8 add ax, bx ; [previous_val_l] 4361 00002111 66D1D8 rcr ax, 1 4362 00002114 89C1 mov ecx, eax ; interpolated middle (L) 4363 00002116 6601D8 add ax, bx 4364 00002119 66D1D8 rcr ax, 1 4365 0000211C 89C2 mov edx, eax ; interpolated 1st quarter (L) 4366 0000211E 6601D8 add ax, bx ; [previous_val_l] 4367 00002121 66D1D8 rcr ax, 1 4368 00002124 80EC80 sub ah, 80h ; -32768 to +32767 format again 4369 00002127 66AB stosw ; interpolated sample 1 (L) 4370 00002129 89C8 mov eax, ecx 4371 0000212B 6601D0 add ax, dx ; middle (L) + 1st quarter (L) 4372 0000212E 66D1D8 rcr ax, 1 ; / 2 4373 00002131 89C3 mov ebx, eax ; interpolated sample 2 (L) 4374 00002133 5A pop edx ; * ; [previous_val_r] 4375 00002134 89D0 mov eax, edx 4376 00002136 8005[7F220000]80 add byte [next_val_r+1], 80h 4377 0000213D 660305[7E220000] add ax, [next_val_r] 4378 00002144 66D1D8 rcr ax, 1 4379 00002147 50 push eax ; * ; interpolated middle (R) 4380 00002148 6601D0 add ax, dx 4381 0000214B 66D1D8 rcr ax, 1 4382 0000214E 50 push eax ; ** ; interpolated 1st quarter (R) 4383 0000214F 6601D0 add ax, dx ; [previous_val_r] 4384 00002152 66D1D8 rcr ax, 1 4385 00002155 80EC80 sub ah, 80h ; -32768 to +32767 format again 4386 00002158 66AB stosw ; interpolated sample 1 (R) 4387 0000215A 89D8 mov eax, ebx 4388 0000215C 80EC80 sub ah, 80h ; -32768 to +32767 format again 4389 0000215F 66AB stosw ; interpolated sample 2 (L) 4390 00002161 58 pop eax ; ** 4391 00002162 5A pop edx ; * 4392 00002163 6601D0 add ax, dx ; 1st quarter (R) + middle (R) 4393 00002166 66D1D8 rcr ax, 1 ; / 2 4394 00002169 80EC80 sub ah, 80h ; -32768 to +32767 format again 4395 0000216C 66AB stosw ; interpolated sample 2 (R) 4396 0000216E 89C8 mov eax, ecx 4397 00002170 660305[7C220000] add ax, [next_val_l] 4398 00002177 66D1D8 rcr ax, 1 4399 0000217A 50 push eax ; * ; interpolated 3rd quarter (L) 4400 0000217B 6601C8 add ax, cx ; interpolated middle (L) 4401 0000217E 66D1D8 rcr ax, 1 4402 00002181 80EC80 sub ah, 80h ; -32768 to +32767 format again 4403 00002184 66AB stosw ; interpolated sample 3 (L) 4404 00002186 89D0 mov eax, edx 4405 00002188 660305[7E220000] add ax, [next_val_r] 4406 0000218F 66D1D8 rcr ax, 1 4407 00002192 50 push eax ; ** ; interpolated 3rd quarter (R) 4408 00002193 6601D0 add ax, dx ; interpolated middle (R) 4409 00002196 66D1D8 rcr ax, 1 4410 00002199 80EC80 sub ah, 80h ; -32768 to +32767 format again 4411 0000219C 66AB stosw ; interpolated sample 3 (R) 4412 0000219E 5B pop ebx ; ** 4413 0000219F 58 pop eax ; * 4414 000021A0 660305[7C220000] add ax, [next_val_l] 4415 000021A7 66D1D8 rcr ax, 1 4416 000021AA 80EC80 sub ah, 80h ; -32768 to +32767 format again 4417 000021AD 66AB stosw ; interpolated sample 4 (L) 4418 000021AF 89D8 mov eax, ebx 4419 000021B1 660305[7E220000] add ax, [next_val_r] 4420 000021B8 66D1D8 rcr ax, 1 4421 000021BB 80EC80 sub ah, 80h ; -32768 to +32767 format again 4422 000021BE 66AB stosw ; interpolated sample 4 (R) 4423 000021C0 59 pop ecx ; ! 4424 000021C1 C3 retn 4425 4426 interpolating_4_16bit_mono: 4427 ; 18/11/2023 4428 ; ax = [previous_val] 4429 ; dx = [next_val] 4430 ; 02/02/2025 4431 ; original-interpolated-interpolated-interpolated 4432 4433 000021C2 66AB stosw ; original sample (L) 4434 000021C4 66AB stosw ; original sample (R) 4435 000021C6 80C480 add ah, 80h ; convert sound level 0 to 65535 format 4436 000021C9 89C3 mov ebx, eax ; [previous_val] 4437 000021CB 80C680 add dh, 80h 4438 000021CE 6601D0 add ax, dx ; [previous_val] + [next_val] 4439 000021D1 66D1D8 rcr ax, 1 4440 000021D4 93 xchg eax, ebx 4441 000021D5 6601D8 add ax, bx ; [previous_val] + interpolated middle 4442 000021D8 66D1D8 rcr ax, 1 4443 000021DB 80EC80 sub ah, 80h ; -32768 to +32767 format again 4444 000021DE 66AB stosw ; interpolated sample 1 (L) 4445 000021E0 66AB stosw ; interpolated sample 1 (R) 4446 000021E2 89D8 mov eax, ebx ; interpolated middle 4447 000021E4 80EC80 sub ah, 80h ; -32768 to +32767 format again 4448 000021E7 66AB stosw ; interpolated sample 2 (L) 4449 000021E9 66AB stosw ; interpolated sample 2 (R) 4450 000021EB 89D8 mov eax, ebx 4451 000021ED 6601D0 add ax, dx ; interpolated middle + [next_val] 4452 000021F0 66D1D8 rcr ax, 1 4453 000021F3 80EC80 sub ah, 80h ; -32768 to +32767 format again 4454 000021F6 66AB stosw ; interpolated sample 3 (L) 4455 000021F8 66AB stosw ; interpolated sample 3 (R) 4456 000021FA C3 retn 4457 4458 interpolating_4_16bit_stereo: 4459 ; 18/11/2023 4460 ; bx = [previous_val_l] 4461 ; ax = [previous_val_r] 4462 ; [next_val_l] 4463 ; [next_val_r] 4464 ; original-interpolated-interpolated-interpolated 4465 000021FB 93 xchg eax, ebx 4466 000021FC 66AB stosw ; original sample (L) 4467 000021FE 93 xchg eax, ebx 4468 000021FF 66AB stosw ; original sample (R) 4469 00002201 80C480 add ah, 80h ; convert sound level 0 to 65535 format 4470 00002204 89C2 mov edx, eax ; [previous_val_r] 4471 00002206 80C780 add bh, 80h 4472 00002209 8005[7D220000]80 add byte [next_val_l+1], 80h 4473 00002210 66A1[7C220000] mov ax, [next_val_l] 4474 00002216 6601D8 add ax, bx ; [previous_val_l] 4475 00002219 66D1D8 rcr ax, 1 4476 0000221C 93 xchg eax, ebx 4477 0000221D 6601D8 add ax, bx ; bx = interpolated middle (L) 4478 00002220 66D1D8 rcr ax, 1 4479 00002223 80EC80 sub ah, 80h ; -32768 to +32767 format again 4480 00002226 66AB stosw ; interpolated sample 1 (L) 4481 00002228 8005[7F220000]80 add byte [next_val_r+1], 80h 4482 0000222F 89D0 mov eax, edx ; [previous_val_r] 4483 00002231 660305[7E220000] add ax, [next_val_r] 4484 00002238 66D1D8 rcr ax, 1 4485 0000223B 92 xchg eax, edx 4486 0000223C 6601D0 add ax, dx ; dx = interpolated middle (R) 4487 0000223F 66D1D8 rcr ax, 1 4488 00002242 80EC80 sub ah, 80h ; -32768 to +32767 format again 4489 00002245 66AB stosw ; interpolated sample 1 (R) 4490 00002247 89D8 mov eax, ebx 4491 00002249 80EC80 sub ah, 80h ; -32768 to +32767 format again 4492 0000224C 66AB stosw ; interpolated sample 2 (L) 4493 0000224E 89D0 mov eax, edx 4494 00002250 80EC80 sub ah, 80h ; -32768 to +32767 format again 4495 00002253 66AB stosw ; interpolated sample 2 (R) 4496 00002255 89D8 mov eax, ebx 4497 00002257 660305[7C220000] add ax, [next_val_l] 4498 0000225E 66D1D8 rcr ax, 1 4499 00002261 80EC80 sub ah, 80h ; -32768 to +32767 format again 4500 00002264 66AB stosw ; interpolated sample 3 (L) 4501 00002266 89D0 mov eax, edx 4502 00002268 660305[7E220000] add ax, [next_val_r] 4503 0000226F 66D1D8 rcr ax, 1 4504 00002272 80EC80 sub ah, 80h ; -32768 to +32767 format again 4505 00002275 66AB stosw ; interpolated sample 3 (R) 4506 00002277 C3 retn 4507 4508 ; 13/11/2023 4509 previous_val: 4510 00002278 0000 previous_val_l: dw 0 4511 0000227A 0000 previous_val_r: dw 0 4512 next_val: 4513 0000227C 0000 next_val_l: dw 0 4514 0000227E 0000 next_val_r: dw 0 4515 4516 ; 16/11/2023 4517 00002280 00 faz: db 0 4518 4519 ; -------------------------------------------------------- 4520 4521 ; DATA 4522 4523 FileHandle: 4524 00002281 FFFFFFFF dd -1 4525 4526 Credits: 4527 00002285 54696E792057415620- db 'Tiny WAV Player for TRDOS 386 by Erdogan Tan. ' 4527 0000228E 506C6179657220666F- 4527 00002297 72205452444F532033- 4527 000022A0 383620627920457264- 4527 000022A9 6F67616E2054616E2E- 4527 000022B2 20 4528 ;;;;;db 'August 2020.',10,13,0 4529 ;;;;db 'November 2023.',10,13,0 4530 ;;;db 'June 2024.', 10,13,0 4531 ;;db 'December 2024.', 10,13,0 4532 ;db 'January 2025.', 10,13,0 4533 000022B3 466562727561727920- db 'February 2025.', 10,13,0 4533 000022BC 323032352E0A0D00 4534 000022C4 31372F30362F323031- db '17/06/2017', 10,13,0 4534 000022CD 370A0D00 4535 000022D1 31382F30382F323032- db '18/08/2020', 10,13,0 4535 000022DA 300A0D00 4536 000022DE 32372F31312F323032- db '27/11/2023', 10,13,0 4536 000022E7 330A0D00 4537 000022EB 30312F30362F323032- db '01/06/2024', 10,13,0 4537 000022F4 340A0D00 4538 000022F8 30362F30362F323032- db '06/06/2024', 10,13,0 4538 00002301 340A0D00 4539 00002305 30382F31322F323032- db '08/12/2024', 10,13,0 4539 0000230E 340A0D00 4540 00002312 31342F31322F323032- db '14/12/2024', 10,13,0 4540 0000231B 340A0D00 4541 0000231F 31372F30312F323032- db '17/01/2025', 10,13,0 4541 00002328 350A0D00 4542 0000232C 30322F30322F323032- db '02/02/2025', 10,13,0 4542 00002335 350A0D00 4543 4544 msgAudioCardInfo: 4545 00002339 666F7220496E74656C- db 'for Intel AC97 (ICH) Audio Controller.', 10,13,0 4545 00002342 204143393720284943- 4545 0000234B 482920417564696F20- 4545 00002354 436F6E74726F6C6C65- 4545 0000235D 722E0A0D00 4546 4547 msg_usage: 4548 00002362 75736167653A20706C- db 'usage: playwav6 filename.wav',10,13,0 4548 0000236B 617977617636206669- 4548 00002374 6C656E616D652E7761- 4548 0000237D 760A0D00 4549 4550 noDevMsg: 4551 00002381 4572726F723A20556E- db 'Error: Unable to find AC97 audio device!' 4551 0000238A 61626C6520746F2066- 4551 00002393 696E64204143393720- 4551 0000239C 617564696F20646576- 4551 000023A5 69636521 4552 000023A9 0A0D00 db 10,13,0 4553 4554 noFileErrMsg: 4555 000023AC 4572726F723A206669- db 'Error: file not found.',10,13,0 4555 000023B5 6C65206E6F7420666F- 4555 000023BE 756E642E0A0D00 4556 4557 trdos386_err_msg: 4558 000023C5 5452444F5320333836- db 'TRDOS 386 System call error !',10,13,0 4558 000023CE 2053797374656D2063- 4558 000023D7 616C6C206572726F72- 4558 000023E0 20210A0D00 4559 4560 ; 01/06/2024 4561 msg_init_err: 4562 000023E5 0A0D db 10,13 4563 000023E7 4143393720436F6E74- db "AC97 Controller/Codec initialization error !" 4563 000023F0 726F6C6C65722F436F- 4563 000023F9 64656320696E697469- 4563 00002402 616C697A6174696F6E- 4563 0000240B 206572726F722021 4564 00002413 0A0D00 db 10,13,0 4565 4566 ; 25/11/2023 4567 msg_no_vra: 4568 00002416 0A0D db 10,13 4569 00002418 4E6F20565241207375- db "No VRA support ! Only 48 kHZ sample rate supported !" 4569 00002421 70706F72742021204F- 4569 0000242A 6E6C79203438206B48- 4569 00002433 5A2073616D706C6520- 4569 0000243C 726174652073757070- 4569 00002445 6F727465642021 4570 0000244C 0A0D00 db 10,13,0 4571 4572 0000244F 0D0A5741562046696C- msgWavFileName: db 0Dh, 0Ah, "WAV File Name: ",0 4572 00002458 65204E616D653A2000 4573 00002461 0D0A53616D706C6520- msgSampleRate: db 0Dh, 0Ah, "Sample Rate: " 4573 0000246A 526174653A20 4574 00002470 303030303020487A2C- msgHertz: db "00000 Hz, ", 0 4574 00002479 2000 4575 0000247B 3820626974732C2000 msg8Bits: db "8 bits, ", 0 4576 00002484 4D6F6E6F0D0A00 msgMono: db "Mono", 0Dh, 0Ah, 0 4577 0000248B 313620626974732C20- msg16Bits: db "16 bits, ", 0 4577 00002494 00 4578 00002495 53746572656F msgStereo: db "Stereo" 4579 0000249B 0D0A00 nextline: db 0Dh, 0Ah, 0 4580 4581 ; 03/06/2017 4582 0000249E 303132333435363738- hex_chars db "0123456789ABCDEF", 0 4582 000024A7 3941424344454600 4583 000024AF 0D0A msgAC97Info db 0Dh, 0Ah 4584 000024B1 414339372041756469- db "AC97 Audio Controller & Codec Info", 0Dh, 0Ah 4584 000024BA 6F20436F6E74726F6C- 4584 000024C3 6C6572202620436F64- 4584 000024CC 656320496E666F0D0A 4585 000024D5 56656E646F72204944- db "Vendor ID: " 4585 000024DE 3A20 4586 000024E0 303030306820446576- msgVendorId db "0000h Device ID: " 4586 000024E9 6963652049443A20 4587 000024F1 30303030680D0A msgDevId db "0000h", 0Dh, 0Ah 4588 000024F8 4275733A20 db "Bus: " 4589 000024FD 303068204465766963- msgBusNo db "00h Device: " 4589 00002506 653A20 4590 00002509 3030682046756E6374- msgDevNo db "00h Function: " 4590 00002512 696F6E3A20 4591 00002517 303068 msgFncNo db "00h" 4592 0000251A 0D0A db 0Dh, 0Ah 4593 0000251C 4E414D4241523A20 db "NAMBAR: " 4594 00002524 30303030682020 msgNamBar db "0000h " 4595 0000252B 4E41424D4241523A20 db "NABMBAR: " 4596 00002534 303030306820204952- msgNabmBar db "0000h IRQ: " 4596 0000253D 513A20 4597 00002540 3030 msgIRQ dw 3030h 4598 00002542 0D0A00 db 0Dh, 0Ah, 0 4599 ; 06/06/2024 4600 00002545 0D0A msgCodec db 0Dh, 0Ah 4601 00002547 434F44454320 db "CODEC " 4602 0000254D 0D0A db 0Dh, 0Ah 4603 0000254F 56656E646F72204944- db "Vendor ID1: " 4603 00002558 313A20 4604 0000255B 30303030682020 msgCodecId1 db "0000h " 4605 00002562 56656E646F72204944- db "Vendor ID2: " 4605 0000256B 323A20 4606 0000256E 30303030682020 msgCodecId2 db "0000h " 4607 ; 25/11/2023 4608 00002575 0D0A00 db 0Dh, 0Ah, 0 4609 00002578 56524120737570706F- msgVRAheader: db "VRA support: " 4609 00002581 72743A20 4610 00002585 00 db 0 4611 00002586 5945530D0A00 msgVRAyes: db "YES", 0Dh, 0Ah, 0 4612 0000258C 4E4F200D0A msgVRAno: db "NO ", 0Dh, 0Ah 4613 00002591 28496E746572706F6C- db "(Interpolated sample rate playing method)" 4613 0000259A 617465642073616D70- 4613 000025A3 6C6520726174652070- 4613 000025AC 6C6179696E67206D65- 4613 000025B5 74686F6429 4614 000025BA 0D0A00 db 0Dh, 0Ah, 0 4615 EOF: 4616 4617 ; BSS 4618 4619 bss_start: 4620 4621 ABSOLUTE bss_start 4622 4623 000025BD ?????? alignb 4 4624 4625 000025C0 ?? stmo: resb 1 ; stereo or mono (1=stereo) 4626 000025C1 ?? bps: resb 1 ; bits per sample (8,16) 4627 000025C2 ???? sample_rate: resw 1 ; Sample Frequency (Hz) 4628 4629 ; 25/11/2023 4630 000025C4 ???????? bufferSize: resd 1 4631 4632 000025C8 ?? flags: resb 1 4633 ;cbs_busy: resb 1 4634 000025C9 ?? half_buff: resb 1 4635 000025CA ?? srb: resb 1 4636 ; 18/08/2020 4637 000025CB ?? volume_level: resb 1 4638 ; 25/11/2023 4639 000025CC ?? VRA: resb 1 ; Variable Rate Audio Support Status 4640 4641 000025CD smpRBuff: resw 14 4642 4643 wav_file_name: 4644 000025E9 resb 80 ; wave file, path name (<= 80 bytes) 4645 4646 00002639 ???? resw 1 4647 0000263B ?? ac97_int_ln_reg: resb 1 4648 0000263C ?? fbs_shift: resb 1 ; 26/11/2023 4649 0000263D ???????? dev_vendor: resd 1 4650 00002641 ???????? bus_dev_fn: resd 1 4651 00002645 ???? ac97_NamBar: resw 1 4652 00002647 ???? ac97_NabmBar: resw 1 4653 4654 bss_end: 4655 00002649 alignb 4096 4656 ;audio_buffer: resb BUFFERSIZE ; DMA Buffer Size / 2 (32768) 4657 ; 26/11/2023 4658 00003000 audio_buffer: resb 65536 4659 ; 13/06/2017 4660 ;temp_buffer: resb BUFFERSIZE 4661 ; 26/11/2023 4662 00013000 temp_buffer: resb 65536