1 ; **************************************************************************** 2 ; cgaplay.s - TRDOS 386 (TRDOS v2.0.9) WAV PLAYER - Video Mode 13h 3 ; ---------------------------------------------------------------------------- 4 ; CGAPLAY.PRG ! AC'97 (ICH) .WAV PLAYER program by Erdogan TAN 5 ; 6 ; 27/12/2024 - play music from multiple wav files - 7 ; 8 ; [ Last Modification: 05/02/2025 ] 9 ; 10 ; Modified from VGAPLAY3.PRG .wav player program by Erdogan Tan, 30/12/2024 11 ; 12 ; **************************************************************************** 13 ; nasm cgaplay.s -l cgaplay.txt -o CGAPLAY.PRG -Z error.txt 14 15 ; 30/12/2024 16 ; vgaplay3.s 17 ; 27/12/2024 18 ; vgaplay2.s : DMA buffer tracking (instead of user's audio buffer) 19 ; 18/12/2024 20 ; ac97play.s : TUNELOOP version (playing without AC97 interrupt) 21 22 ; vgaplay.s (26/12/2024) - play music from multiple wav files - 23 ; dplayvga.s (25/12/2024) - play music from single wav file - 24 ; ac97play.s (18/12/2024) - play music from multiple wav files - 25 26 ; 07/12/2024 - playwav9.s - interrupt (srb) + tuneloop version 27 ; ------------------------------------------------------------ 28 ; INTERRUPT (SRB) + TUNELOOP version ; 24/11/2024 (PLAYWAV9.ASM) 29 ; (running in DOSBOX, VIRTUALBOX, QEMU is ok) 30 ; Signal Response Byte = message/signal to user about an event/interrupt 31 ; as requested (TuneLoop procedure continuously checks this SRB) 32 ; (TRDOS 386 v2 feature is used here as very simple interrupt handler output) 33 34 ; ------------------------------------------------------------ 35 36 ; 30/11/2024 37 ; 20/08/2024 ; TRDOS 386 v2.0.9 38 ; 29/04/2016 39 _ver equ 0 40 _exit equ 1 41 _fork equ 2 42 _read equ 3 43 _write equ 4 44 _open equ 5 45 _close equ 6 46 _wait equ 7 47 _creat equ 8 48 _link equ 9 49 _unlink equ 10 50 _exec equ 11 51 _chdir equ 12 52 _time equ 13 53 _mkdir equ 14 54 _chmod equ 15 55 _chown equ 16 56 _break equ 17 57 _stat equ 18 58 _seek equ 19 59 _tell equ 20 60 _mount equ 21 61 _umount equ 22 62 _setuid equ 23 63 _getuid equ 24 64 _stime equ 25 65 _quit equ 26 66 _intr equ 27 67 _fstat equ 28 68 _emt equ 29 69 _mdate equ 30 70 _video equ 31 71 _audio equ 32 72 _timer equ 33 73 _sleep equ 34 74 _msg equ 35 75 _geterr equ 36 76 _fpsave equ 37 77 _pri equ 38 78 _rele equ 39 79 _fff equ 40 80 _fnf equ 41 81 _alloc equ 42 82 _dalloc equ 43 83 _calbac equ 44 84 _dma equ 45 85 _stdio equ 46 86 87 ; ------------------------------------------------------------ 88 89 %macro sys 1-4 90 ; 29/04/2016 - TRDOS 386 (TRDOS v2.0) 91 ; 03/09/2015 92 ; 13/04/2015 93 ; Retro UNIX 386 v1 system call. 94 %if %0 >= 2 95 mov ebx, %2 96 %if %0 >= 3 97 mov ecx, %3 98 %if %0 = 4 99 mov edx, %4 100 %endif 101 %endif 102 %endif 103 mov eax, %1 104 ;int 30h 105 int 40h ; TRDOS 386 (TRDOS v2.0) 106 %endmacro 107 108 ; Retro UNIX 386 v1 system call format: 109 ; sys systemcall (eax) , , 110 111 ; ------------------------------------------------------------ 112 113 ; player internal variables and other equates. 114 BUFFERSIZE equ 65536 115 ENDOFFILE equ 1 ; flag for knowing end of file 116 117 ; ------------------------------------------------------------ 118 119 [BITS 32] ; 32-bit intructions 120 121 [ORG 0] 122 123 START_CODE: 124 ; Prints the Credits Text. 125 sys _msg, Credits, 255, 0Bh 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 00000000 BB[A42D0000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 00000005 B9FF000000 <1> mov ecx, %3 98 <1> %if %0 = 4 99 0000000A BA0B000000 <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 0000000F B823000000 <1> mov eax, %1 104 <1> 105 00000014 CD40 <1> int 40h 126 127 ; clear bss 128 00000016 BF[EC330000] mov edi, bss_start 129 0000001B B976010000 mov ecx, (bss_end - bss_start)/4 130 00000020 31C0 xor eax, eax 131 00000022 F3AB rep stosd 132 133 ; ------------------------------------------------------------- 134 135 ; 21/12/2024 136 ; Detect (& Enable) AC'97 Audio Device 137 00000024 E8F1070000 call DetectAC97 138 00000029 731B jnc short ac97_hardware_ready 139 140 ; 30/11/2024 141 ; 30/05/2024 142 _dev_not_ready: 143 ; couldn't find the audio device! 144 sys _msg, noDevMsg, 255, 0Fh 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 0000002B BB[472E0000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 00000030 B9FF000000 <1> mov ecx, %3 98 <1> %if %0 = 4 99 00000035 BA0F000000 <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 0000003A B823000000 <1> mov eax, %1 104 <1> 105 0000003F CD40 <1> int 40h 145 00000041 E9C0040000 jmp Exit 146 147 ac97_hardware_ready: 148 00000046 E8120E0000 call write_audio_dev_info 149 150 ; ------------------------------------------------------------- 151 152 ; 30/12/2024 153 ;;; 154 ; DIRECT VGA MEMORY ACCESS 155 ; bl = 0, bh = 5 156 ; Direct access/map to VGA memory (0A0000h) 157 158 sys _video, 0500h 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 0000004B BB00050000 <1> mov ebx, %2 96 <1> %if %0 >= 3 97 <1> mov ecx, %3 98 <1> %if %0 = 4 99 <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 00000050 B81F000000 <1> mov eax, %1 104 <1> 105 00000055 CD40 <1> int 40h 159 00000057 3D00000A00 cmp eax, 0A0000h 160 0000005C 7405 je short _a 161 162 ; 30/12/2024 163 0000005E E9EB040000 jmp trdos386_error 164 165 _a: 166 ;; Set Video Mode to 13h 167 ;sys _video, 0813h 168 ;cmp eax, 14h 169 ;je short mode_13h_set_ok 170 171 ; set VGA mode by using int 31h 172 00000063 66B81300 mov ax, 13h ; mode 13h ; 173 00000067 CD31 int 31h ; real mode: int 10h 174 175 ; ------------------------------------------------------------- 176 177 mode_13h_set_ok: 178 ; 30/12/2024 179 ; 24/12/2024 (setting for wave lighting points) 180 ;mov eax, 0A0000h 181 ;;add eax, 12*8*320 182 ;add eax, (13*8*320)+(2*320) 183 ; wave graphics start (top) line/row 184 ; 64 volume levels 185 ;mov [graphstart], eax 186 ; 30/12/2024 187 ;mov dword [graphstart], 0A0000h+(13*8*320)+(4*320) 188 ; 01/01/2025 189 00000069 C705[DC330000]0073- mov dword [graphstart], 0A0000h+(11*8*320)+(4*320) 189 00000071 0A00 190 191 ; ------------------------------------------------------------- 192 193 ; 25/12/2024 194 ; 28/11/2024 195 Player_InitalizePSP: 196 ; 30/11/2024 197 ; (TRDOS 386 -Retro UNIX 386- argument transfer method) 198 ; (stack: argc,argv0addr,argv1addr,argv2addr .. 199 ; .. argv0text, argv1text ..) 200 ; ---- argc, argv[] ---- 201 00000073 89E6 mov esi, esp 202 00000075 AD lodsd 203 00000076 83F802 cmp eax, 2 ; two arguments 204 ; (program file name & mod file name) 205 00000079 0F8290040000 jb pmsg_usage ; nothing to do 206 ;mov [argc], al 207 0000007F C1E002 shl eax, 2 ; *4 208 00000082 01E0 add eax, esp 209 ; eax = last argument's address pointer 210 00000084 A3[3C390000] mov [argvl], eax ; last wav file (argument) 211 00000089 8935[34390000] mov [argv], esi ; current argument (PRG file name) 212 0000008F AD lodsd ; skip program (PRG) file name 213 00000090 8935[38390000] mov [argvf], esi ; 1st wav file (argument) 214 215 ; 30/12/2024 216 Player_ParseParameters: 217 00000096 EB2A jmp short Player_ParseNextParameter 218 ; 25/12/2024 219 check_p_command: 220 ; 07/12/2024 221 00000098 8B35[34390000] mov esi, [argv] 222 ; 223 0000009E 803D[FE380000]50 cmp byte [command], 'P' 224 000000A5 7410 je short Player_ParsePreviousParameter 225 226 ; 07/12/2024 227 ; 30/11/2024 228 ;mov esi, [argv] ; current argument (wav file) ptr 229 000000A7 83C604 add esi, 4 230 000000AA 3B35[3C390000] cmp esi, [argvl] ; last argument (wav file) ptr 231 000000B0 7610 jna short Player_ParseNextParameter 232 jmp_Player_Quit: 233 000000B2 E91B050000 jmp Player_Quit 234 235 Player_ParsePreviousParameter: 236 ; 29/11/2024 237 ;mov byte [command], 0 238 ; 30/11/2024 239 ;mov esi, [argv] ; 07/12/2024 240 000000B7 3B35[38390000] cmp esi, [argvf] ; first argument (wav file) ptr 241 000000BD 7603 jna short Player_ParseNextParameter 242 000000BF 83EE04 sub esi, 4 243 Player_ParseNextParameter: 244 ; 30/11/2024 245 000000C2 8935[34390000] mov [argv], esi ; set as current argument 246 247 ; 01/12/2024 248 000000C8 8B36 mov esi, [esi] 249 250 ; 30/12/2024 251 ; 29/11/2024 252 000000CA E83C000000 call GetFileName 253 ;jcxz jmp_Player_Quit 254 000000CF E3E1 jecxz jmp_Player_Quit ; 30/11/2024 255 256 ; 30/12/2024 257 ; open existing file 258 ; 28/11/2024 259 000000D1 BA[40390000] mov edx, wav_file_name 260 000000D6 E88F070000 call openFile ; no error? ok. 261 000000DB 7376 jnc getwavparms ; 14/11/2024 262 263 ; 29/11/2024 264 000000DD 803D[FF380000]00 cmp byte [filecount], 0 265 000000E4 77B2 ja short check_p_command 266 267 ; 25/12/2024 268 ; 21/12/2024 269 000000E6 E8DF040000 call set_text_mode 270 ; file not found! 271 ; 30/11/2024 272 sys _msg, noFileErrMsg, 255, 0Ch 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 000000EB BB[722E0000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 000000F0 B9FF000000 <1> mov ecx, %3 98 <1> %if %0 = 4 99 000000F5 BA0C000000 <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 000000FA B823000000 <1> mov eax, %1 104 <1> 105 000000FF CD40 <1> int 40h 273 00000101 E900040000 jmp Exit 274 275 _exit_: 276 00000106 E9F6030000 jmp terminate 277 278 ; ------------------------------------------------------------- 279 280 ; 26/12/2024 281 ; 25/12/2024 282 ; 30/11/2024 (32bit) 283 ; 29/11/2024 284 ; 30/05/2024 285 GetFileName: 286 0000010B BF[40390000] mov edi, wav_file_name 287 ; 30/11/2024 288 ;mov esi, [argv] 289 00000110 31C9 xor ecx, ecx ; 0 290 ScanName: 291 00000112 AC lodsb 292 ;test al, al 293 ;jz short a_4 294 ; 29/11/2024 295 00000113 3C0D cmp al, 0Dh 296 00000115 7638 jna short a_4 297 00000117 3C20 cmp al, 20h 298 00000119 74F7 je short ScanName ; scan start of name. 299 0000011B AA stosb 300 0000011C B4FF mov ah, 0FFh 301 ;;; 302 ; 14/11/2024 303 ; (max. path length = 64 bytes for MSDOS ?) (*) 304 ;xor ecx, ecx ; 0 305 ;;; 306 a_0: 307 0000011E FEC4 inc ah 308 a_1: 309 ;;; 310 ; 14/11/2024 311 00000120 41 inc ecx 312 ;;; 313 00000121 AC lodsb 314 00000122 AA stosb 315 00000123 3C2E cmp al, '.' 316 00000125 74F7 je short a_0 317 ; 29/11/2024 318 00000127 3C20 cmp al, 20h 319 ;and al, al 320 ;jnz short a_1 321 ;;; 322 ; 14/11/2024 323 00000129 7613 jna short a_3 324 0000012B 20E4 and ah, ah 325 0000012D 7406 jz short a_2 326 0000012F 3C2F cmp al, '/' ; 14/12/2024 327 00000131 7502 jne short a_2 328 00000133 B400 mov ah, 0 329 a_2: 330 00000135 80F94B cmp cl, 75 ; 64+8+'.'+3 -> offset 75 is the last chr 331 00000138 72E6 jb short a_1 332 ; 29/11/2024 333 0000013A 29C9 sub ecx, ecx 334 0000013C EB11 jmp short a_4 335 a_3: 336 ; 29/11/2024 337 0000013E 4F dec edi 338 ;;; 339 0000013F 08E4 or ah, ah ; if period NOT found, 340 00000141 750C jnz short a_4 ; then add a .WAV extension. 341 SetExt: 342 ; 29/11/2024 343 ;dec edi 344 00000143 C7072E574156 mov dword [edi], '.WAV' 345 ; ! 64+12 is DOS limit 346 ; but writing +4 must not 347 ; destroy the following data 348 ;mov byte [edi+4], 0 ; so, 80 bytes path + 0 is possible here 349 ; 29/11/2024 350 00000149 83C104 add ecx, 4 351 0000014C 83C704 add edi, 4 352 a_4: 353 0000014F C60700 mov byte [edi], 0 354 ; 30/11/2024 355 00000152 C3 retn 356 357 ; ------------------------------------------------------------- 358 359 getwavparms: 360 ; 14/11/2024 361 00000153 E844070000 call getWAVParameters 362 00000158 72AC jc short _exit_ ; nothing to do 363 364 ; 17/11/2024 365 0000015A B304 mov bl, 4 366 0000015C 2A1D[20390000] sub bl, byte [WAVE_BlockAlign] 367 ; = 0 for 16 bit stereo 368 ; = 2 for 8 bit stereo or 16 bit mono 369 ; = 3 for 8 bit mono 370 371 00000162 D0EB shr bl, 1 ; 0 --> 0, 2 --> 1, 3 --> 1 372 ; 15/11/2024 373 00000164 80D300 adc bl, 0 ; 3 --> 1 --> 2 374 00000167 881D[92390000] mov byte [fbs_shift], bl ; = 2 mono and 8 bit 375 ; = 0 stereo and 16 bit 376 ; = 1 mono or 8 bit 377 ; 29/12/2024 378 ; 30/05/2024 379 0000016D E897080000 call codecConfig ; unmute codec, set rates. 380 00000172 0F82B4030000 jc init_err 381 382 ; ------------------------------------------------------------- 383 384 StartPlay: 385 ; 30/12/2024 386 00000178 C605[F3380000]01 mov byte [wpoints], 1 387 388 ;;; 389 ; 09/12/2024 390 0000017F B834290000 mov eax, 10548 ; (48000*10/182)*4 391 00000184 803D[FD380000]00 cmp byte [VRA], 0 392 0000018B 7614 jna short _w ; 48kHZ (interpolation) 393 ; 394 0000018D 66A1[18390000] mov ax, [WAVE_SampleRate] 395 00000193 B90A000000 mov ecx, 10 396 00000198 F7E1 mul ecx 397 0000019A B1B6 mov cl, 182 398 0000019C F7F1 div ecx 399 ; ax = samples per 1/18.2 second 400 ;mov cl, byte [WAVE_BlockAlign] 401 ; 09/12/2024 402 ;mov cl, 4 ; 16 bit, stereo 403 ;mul ecx 404 0000019E C1E002 shl eax, 2 ; * 4 405 _w: 406 000001A1 A3[D8330000] mov [wpoints_dif], eax ; buffer read differential (distance) 407 ; for wave volume leds update 408 ; (byte stream per 1/18.2 second) 409 410 ; ------------------------------------------------------------- 411 412 ; 25/12/2024 413 000001A6 FE05[FF380000] inc byte [filecount] 414 000001AC C605[FE380000]00 mov byte [command], 0 415 ; 30/12/2024 416 000001B3 C605[E9330000]FF mov byte [pbprev], -1 417 418 ; ------------------------------------------------------------- 419 420 ; 07/12/2024 (playwav9.s) 421 422 ; 18/11/2023 (ich_wav4.asm) 423 ; 13/11/2023 (ich_wav3.asm) 424 425 000001BA 803D[FD380000]01 cmp byte [VRA], 1 426 000001C1 7226 jb short chk_sample_rate 427 428 playwav_48_khz: 429 000001C3 C705[A0390000]- mov dword [loadfromwavfile], loadFromFile 429 000001C9 [8F0D0000] 430 ;mov dword [loadsize], 0 ; 65536 431 ;;; 432 ; 17/11/2024 433 ;mov word [buffersize], 32768 434 ;mov ax, BUFFERSIZE/2 ; 32760 435 ; 30/11/2024 436 ;mov eax, BUFFERSIZE/2 ; 32768 437 ; 07/12/2024 438 000001CD B800000100 mov eax, BUFFERSIZE ; 65536 439 000001D2 A3[A8390000] mov [buffersize], eax ; 16 bit samples 440 ; 07/12/2024 441 ;shl eax, 1 ; bytes 442 000001D7 8A0D[92390000] mov cl, [fbs_shift] 443 000001DD D3E8 shr eax, cl 444 ;mov [loadsize], ax ; 16380 or 32760 or 65520 445 000001DF A3[A4390000] mov [loadsize], eax ; 16384 or 32768 or 65536 446 ;;; 447 ;jmp PlayNow ; 30/05/2024 448 ; 07/12/2024 449 000001E4 E9AA020000 jmp Player_Template 450 451 ; 05/02/2025 452 chk_sample_rate: 453 ; set conversion parameters 454 ; (for 8, 11.025, 16, 22.050, 24, 32 kHZ) 455 000001E9 66A1[18390000] mov ax, [WAVE_SampleRate] 456 000001EF 663D80BB cmp ax, 48000 457 000001F3 74CE je short playwav_48_khz 458 chk_22khz: 459 000001F5 663D2256 cmp ax, 22050 460 000001F9 7545 jne short chk_11khz 461 000001FB 803D[22390000]08 cmp byte [WAVE_BitsPerSample], 8 462 00000202 7615 jna short chk_22khz_1 463 00000204 BB[FF1C0000] mov ebx, load_22khz_stereo_16_bit 464 00000209 803D[16390000]01 cmp byte [WAVE_NumChannels], 1 465 00000210 751A jne short chk_22khz_2 466 00000212 BB[721C0000] mov ebx, load_22khz_mono_16_bit 467 00000217 EB13 jmp short chk_22khz_2 468 chk_22khz_1: 469 00000219 BB[EB1B0000] mov ebx, load_22khz_stereo_8_bit 470 0000021E 803D[16390000]01 cmp byte [WAVE_NumChannels], 1 471 00000225 7505 jne short chk_22khz_2 472 00000227 BB[621B0000] mov ebx, load_22khz_mono_8_bit 473 chk_22khz_2: 474 0000022C B85A1D0000 mov eax, 7514 ; (442*17) 475 00000231 BA25000000 mov edx, 37 476 00000236 B911000000 mov ecx, 17 477 0000023B E926020000 jmp set_sizes 478 chk_11khz: 479 00000240 663D112B cmp ax, 11025 480 00000244 7545 jne short chk_44khz 481 00000246 803D[22390000]08 cmp byte [WAVE_BitsPerSample], 8 482 0000024D 7615 jna short chk_11khz_1 483 0000024F BB[1B1F0000] mov ebx, load_11khz_stereo_16_bit 484 00000254 803D[16390000]01 cmp byte [WAVE_NumChannels], 1 485 0000025B 751A jne short chk_11khz_2 486 0000025D BB[A21E0000] mov ebx, load_11khz_mono_16_bit 487 00000262 EB13 jmp short chk_11khz_2 488 chk_11khz_1: 489 00000264 BB[281E0000] mov ebx, load_11khz_stereo_8_bit 490 00000269 803D[16390000]01 cmp byte [WAVE_NumChannels], 1 491 00000270 7505 jne short chk_11khz_2 492 00000272 BB[B01D0000] mov ebx, load_11khz_mono_8_bit 493 chk_11khz_2: 494 00000277 B8AD0E0000 mov eax, 3757 ; (221*17) 495 0000027C BA4A000000 mov edx, 74 496 00000281 B911000000 mov ecx, 17 497 00000286 E9DB010000 jmp set_sizes 498 chk_44khz: 499 0000028B 663D44AC cmp ax, 44100 500 0000028F 7545 jne short chk_16khz 501 00000291 803D[22390000]08 cmp byte [WAVE_BitsPerSample], 8 502 00000298 7615 jna short chk_44khz_1 503 0000029A BB[22210000] mov ebx, load_44khz_stereo_16_bit 504 0000029F 803D[16390000]01 cmp byte [WAVE_NumChannels], 1 505 000002A6 751A jne short chk_44khz_2 506 000002A8 BB[A9200000] mov ebx, load_44khz_mono_16_bit 507 000002AD EB13 jmp short chk_44khz_2 508 chk_44khz_1: 509 000002AF BB[2C200000] mov ebx, load_44khz_stereo_8_bit 510 000002B4 803D[16390000]01 cmp byte [WAVE_NumChannels], 1 511 000002BB 7505 jne short chk_44khz_2 512 000002BD BB[B01F0000] mov ebx, load_44khz_mono_8_bit 513 chk_44khz_2: 514 ; 30/11/2024 (TRDOS 386, 32bit DOS) 515 000002C2 B8D93A0000 mov eax, 15065 ; (655*23) 516 ; 18/11/2023 ((file size + bss + stack) <= 64KB) 517 ;mov ax, 14076 ; (612*23) 518 ; 17/11/2024 519 ;mov ax, 12650 ; (550*23) 520 000002C7 BA19000000 mov edx, 25 521 000002CC B917000000 mov ecx, 23 522 000002D1 E990010000 jmp set_sizes 523 chk_16khz: 524 000002D6 663D803E cmp ax, 16000 525 000002DA 7545 jne short chk_8khz 526 000002DC 803D[22390000]08 cmp byte [WAVE_BitsPerSample], 8 527 000002E3 7615 jna short chk_16khz_1 528 000002E5 BB[A1160000] mov ebx, load_16khz_stereo_16_bit 529 000002EA 803D[16390000]01 cmp byte [WAVE_NumChannels], 1 530 000002F1 751A jne short chk_16khz_2 531 000002F3 BB[20160000] mov ebx, load_16khz_mono_16_bit 532 000002F8 EB13 jmp short chk_16khz_2 533 chk_16khz_1: 534 000002FA BB[66150000] mov ebx, load_16khz_stereo_8_bit 535 000002FF 803D[16390000]01 cmp byte [WAVE_NumChannels], 1 536 00000306 7505 jne short chk_16khz_2 537 00000308 BB[E7140000] mov ebx, load_16khz_mono_8_bit 538 chk_16khz_2: 539 ; 30/11/2024 (TRDOS 386, 32bit DOS) 540 0000030D B855150000 mov eax, 5461 541 ; 17/11/2024 542 ;mov ax, 5460 543 00000312 BA03000000 mov edx, 3 544 00000317 B901000000 mov ecx, 1 545 0000031C E945010000 jmp set_sizes 546 chk_8khz: 547 00000321 663D401F cmp ax, 8000 548 00000325 7545 jne short chk_24khz 549 00000327 803D[22390000]08 cmp byte [WAVE_BitsPerSample], 8 550 0000032E 7615 jna short chk_8khz_1 551 00000330 BB[9C130000] mov ebx, load_8khz_stereo_16_bit 552 00000335 803D[16390000]01 cmp byte [WAVE_NumChannels], 1 553 0000033C 751A jne short chk_8khz_2 554 0000033E BB[CC120000] mov ebx, load_8khz_mono_16_bit 555 00000343 EB13 jmp short chk_8khz_2 556 chk_8khz_1: 557 00000345 BB[9C110000] mov ebx, load_8khz_stereo_8_bit 558 0000034A 803D[16390000]01 cmp byte [WAVE_NumChannels], 1 559 00000351 7505 jne short chk_8khz_2 560 00000353 BB[B8100000] mov ebx, load_8khz_mono_8_bit 561 chk_8khz_2: 562 00000358 B8AA0A0000 mov eax, 2730 563 0000035D BA06000000 mov edx, 6 564 00000362 B901000000 mov ecx, 1 565 00000367 E9FA000000 jmp set_sizes 566 chk_24khz: 567 0000036C 663DC05D cmp ax, 24000 568 00000370 7545 jne short chk_32khz 569 00000372 803D[22390000]08 cmp byte [WAVE_BitsPerSample], 8 570 00000379 7615 jna short chk_24khz_1 571 ; 18/01/2025 (BugFix) 572 ; bx -> ebx 573 0000037B BB[CE180000] mov ebx, load_24khz_stereo_16_bit 574 00000380 803D[16390000]01 cmp byte [WAVE_NumChannels], 1 575 00000387 751A jne short chk_24khz_2 576 00000389 BB[68180000] mov ebx, load_24khz_mono_16_bit 577 0000038E EB13 jmp short chk_24khz_2 578 chk_24khz_1: 579 00000390 BB[DE170000] mov ebx, load_24khz_stereo_8_bit 580 00000395 803D[16390000]01 cmp byte [WAVE_NumChannels], 1 581 0000039C 7505 jne short chk_24khz_2 582 0000039E BB[77170000] mov ebx, load_24khz_mono_8_bit 583 chk_24khz_2: 584 ; 30/11/2024 (TRDOS 386, 32bit DOS) 585 000003A3 B800200000 mov eax, 8192 586 ; 17/11/2024 587 ;mov ax, 8190 588 000003A8 BA02000000 mov edx, 2 589 000003AD B901000000 mov ecx, 1 590 000003B2 E9AF000000 jmp set_sizes ; 02/02/2025 591 592 chk_32khz: 593 000003B7 663D007D cmp ax, 32000 594 ;jne short vra_needed 595 ; 05/02/2025 596 000003BB 7563 jne short chk_12khz 597 000003BD 803D[22390000]08 cmp byte [WAVE_BitsPerSample], 8 598 000003C4 7615 jna short chk_32khz_1 599 000003C6 BB[D21A0000] mov ebx, load_32khz_stereo_16_bit 600 000003CB 803D[16390000]01 cmp byte [WAVE_NumChannels], 1 601 000003D2 751A jne short chk_32khz_2 602 000003D4 BB[651A0000] mov ebx, load_32khz_mono_16_bit 603 000003D9 EB13 jmp short chk_32khz_2 604 chk_32khz_1: 605 000003DB BB[C8190000] mov ebx, load_32khz_stereo_8_bit 606 000003E0 803D[16390000]01 cmp byte [WAVE_NumChannels], 1 607 000003E7 7505 jne short chk_32khz_2 608 000003E9 BB[55190000] mov ebx, load_32khz_mono_8_bit 609 chk_32khz_2: 610 ; 30/11/2024 (TRDOS 386, 32bit DOS) 611 000003EE B8AA2A0000 mov eax, 10922 612 ; 17/11/2024 613 ;mov ax, 10920 614 000003F3 BA03000000 mov edx, 3 615 000003F8 B902000000 mov ecx, 2 616 ; 05/02/2025 617 000003FD EB67 jmp short set_sizes 618 619 ; 07/12/2024 620 vra_needed: 621 ; 30/11/2024 (TRDOS 386, ax -> eax) 622 ; 13/11/2023 623 000003FF 58 pop eax ; discard return address to the caller 624 ; 30/05/2024 625 vra_err: 626 ; 21/12/2024 627 00000400 E8C5010000 call set_text_mode 628 ; 30/11/2024 629 sys _msg, msg_no_vra, 255, 0Fh 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 00000405 BB[DC2E0000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 0000040A B9FF000000 <1> mov ecx, %3 98 <1> %if %0 = 4 99 0000040F BA0F000000 <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 00000414 B823000000 <1> mov eax, %1 104 <1> 105 00000419 CD40 <1> int 40h 630 0000041B E9E6000000 jmp Exit 631 632 ;;;; 633 ; 05/02/2025 634 chk_12khz: 635 00000420 663DE02E cmp ax, 12000 636 00000424 75D9 jne short vra_needed 637 00000426 803D[22390000]08 cmp byte [WAVE_BitsPerSample], 8 638 0000042D 7615 jna short chk_12khz_1 639 0000042F BB[8E220000] mov ebx, load_12khz_stereo_16_bit 640 00000434 803D[16390000]01 cmp byte [WAVE_NumChannels], 1 641 0000043B 751A jne short chk_12khz_2 642 0000043D BB[3F220000] mov ebx, load_12khz_mono_16_bit 643 00000442 EB13 jmp short chk_12khz_2 644 chk_12khz_1: 645 00000444 BB[E9210000] mov ebx, load_12khz_stereo_8_bit 646 00000449 803D[16390000]01 cmp byte [WAVE_NumChannels], 1 647 00000450 7505 jne short chk_12khz_2 648 00000452 BB[A1210000] mov ebx, load_12khz_mono_8_bit 649 chk_12khz_2: 650 00000457 B800100000 mov eax, 4096 651 0000045C BA04000000 mov edx, 4 652 00000461 B901000000 mov ecx, 1 653 ; 05/02/2025 654 ;jmp short set_sizes 655 ;;;; 656 657 set_sizes: 658 ; 30/11/2024 (TRDOS 386, 32bit DOS) 659 ;;; 660 ; 17/11/2024 661 00000466 51 push ecx 662 00000467 B102 mov cl, 2 663 00000469 2A0D[92390000] sub cl, [fbs_shift] 664 ; = 2 for 16 bit stereo 665 ; = 1 for 16 bit mono or 8 bit stereo 666 ; = 0 for 8 bit mono 667 0000046F D3E0 shl eax, cl 668 00000471 59 pop ecx 669 00000472 A3[A4390000] mov [loadsize], eax ; (one) read count in bytes 670 ;;; 671 00000477 F7E2 mul edx 672 00000479 83F901 cmp ecx, 1 673 0000047C 7402 je short s_2 674 s_1: 675 0000047E F7F1 div ecx 676 s_2: 677 ;;; 678 ; eax = byte count of (to be) converted samples 679 680 ; 17/11/2024 681 ;;; 682 00000480 8A0D[92390000] mov cl, [fbs_shift] 683 684 00000486 D3E0 shl eax, cl 685 ; *1 for 16 bit stereo 686 ; *2 for 16 bit mono or 8 bit stereo 687 ; *4 for for 8 bit mono 688 ;;; 689 690 ; eax = 16 bit stereo byte count (target buffer size) 691 692 ; 07/12/2024 693 ;shr eax, 1 ; buffer size is 16 bit sample count 694 00000488 A3[A8390000] mov [buffersize], eax ; buffer size in bytes 695 0000048D 891D[A0390000] mov [loadfromwavfile], ebx 696 697 ; ------------------------------------------------------------- 698 699 ; 30/12/2024 700 Player_Template: 701 ; 21/12/2024 702 00000493 E8DF000000 call clearscreen 703 00000498 E8E9000000 call drawplayingscreen 704 705 ; 14/11/2024 706 0000049D E8D6250000 call SetTotalTime 707 000004A2 E8A3260000 call UpdateFileInfo 708 709 ; ------------------------------------------------------------- 710 711 ; 30/12/2024 (cgaplay.s) 712 ; 29/12/2024 (vgaplay3.s) 713 ; 18/12/2024 (ac97play.s) 714 PlayNow: 715 ; 01/12/2024 (32bit) 716 ; 14/11/2024 717 ;mov al, 3 ; 0 = max, 31 = min 718 ; 14/12/2024 719 000004A7 A0[5B2A0000] mov al, [volume] 720 000004AC E855030000 call SetPCMOutVolume@ 721 ; 15/11/2024 722 ;;call SetMasterVolume 723 ;call SetPCMOutVolume 724 725 ;;; 726 ; 14/11/2024 727 000004B1 E89A270000 call UpdateProgressBar 728 ;;; 729 730 ; 30/05/2024 731 ; playwav4.asm 732 _2: 733 000004B6 E83D250000 call check4keyboardstop ; flush keyboard buffer 734 000004BB 72F9 jc short _2 ; 07/11/2023 735 736 ; play the .wav file. Most of the good stuff is in here. 737 738 ; 05/12/2024 739 ; 02/12/2024 740 ;mov eax, [_bdl_buffer] ; BDL_BUFFER physical address 741 ;_3: 742 000004BD E815010000 call PlayWav 743 744 ; 30/12/2024 745 ; 29/12/2024 (vgaplay3.s) 746 ; 27/12/2024 (vgaplay.s) 747 _3: 748 749 ; close the .wav file and exit. 750 751 ; 25/12/2024 752 000004C2 E8BE030000 call closeFile 753 754 ; 25/12/2024 755 ;;; 756 ; reset file loading and EOF parameters 757 ; 18/12/2024 758 000004C7 C705[B4390000]0000- mov dword [count], 0 758 000004CF 0000 759 000004D1 C705[B8390000]0000- mov dword [LoadedDataBytes], 0 759 000004D9 0000 760 000004DB C605[2E390000]00 mov byte [flags], 0 761 000004E2 C605[F0380000]00 mov byte [stopped], 0 762 ; 29/12/2024 763 000004E9 C705[F8380000]0000- mov dword [pbuf_s], 0 763 000004F1 0000 764 ;;; 765 766 000004F3 803D[FE380000]51 cmp byte [command], 'Q' 767 000004FA 7405 je short terminate 768 000004FC E997FBFFFF jmp check_p_command 769 770 terminate: 771 00000501 E8C4000000 call set_text_mode 772 Exit: 773 sys _exit 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 <1> mov ebx, %2 96 <1> %if %0 >= 3 97 <1> mov ecx, %3 98 <1> %if %0 = 4 99 <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 00000506 B801000000 <1> mov eax, %1 104 <1> 105 0000050B CD40 <1> int 40h 774 halt: 775 0000050D EBFE jmp short halt 776 777 ; ------------------------------------------------------------- 778 779 ; 30/05/2024 780 pmsg_usage: 781 ; 21/12/2024 782 0000050F E8B6000000 call set_text_mode 783 ; 01/12/2024 784 sys _msg, msg_usage, 255, 0Fh 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 00000514 BB[182E0000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 00000519 B9FF000000 <1> mov ecx, %3 98 <1> %if %0 = 4 99 0000051E BA0F000000 <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 00000523 B823000000 <1> mov eax, %1 104 <1> 105 00000528 CD40 <1> int 40h 785 0000052A EBDA jmp short Exit 786 787 ; ------------------------------------------------------------- 788 789 ; 30/05/2024 790 init_err: 791 ; 21/12/2024 792 0000052C E899000000 call set_text_mode 793 ; 01/12/2024 794 sys _msg, msg_init_err, 255, 0Fh 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 00000531 BB[AB2E0000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 00000536 B9FF000000 <1> mov ecx, %3 98 <1> %if %0 = 4 99 0000053B BA0F000000 <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 00000540 B823000000 <1> mov eax, %1 104 <1> 105 00000545 CD40 <1> int 40h 795 00000547 EBBD jmp short Exit 796 797 ; ------------------------------------------------------------- 798 799 ; 07/12/2024 800 error_exit: 801 ; 21/12/2024 802 00000549 E87C000000 call set_text_mode 803 trdos386_error: 804 sys _msg, trdos386_err_msg, 255, 0Eh 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 0000054E BB[8B2E0000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 00000553 B9FF000000 <1> mov ecx, %3 98 <1> %if %0 = 4 99 00000558 BA0E000000 <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 0000055D B823000000 <1> mov eax, %1 104 <1> 105 00000562 CD40 <1> int 40h 805 00000564 EBA0 jmp short Exit 806 807 ; ------------------------------------------------------------- 808 809 ; 21/12/2024 810 print_msg: 811 00000566 B40E mov ah, 0Eh 812 00000568 BB07000000 mov ebx, 7 813 ;mov bl, 7 ; char attribute & color 814 p_next_chr: 815 0000056D AC lodsb 816 0000056E 08C0 or al, al 817 00000570 7404 jz short p_retn ; retn 818 00000572 CD31 int 31h 819 00000574 EBF7 jmp short p_next_chr 820 p_retn: 821 00000576 C3 retn 822 823 ; ------------------------------------------------------------- 824 825 ; 30/12/2024 826 clearscreen: 827 ; fast clear 828 ; 320*200, 256 colors 829 00000577 BF00000A00 mov edi, 0A0000h 830 0000057C B9803E0000 mov ecx, (320*200*1)/4 831 00000581 31C0 xor eax, eax 832 00000583 F3AB rep stosd 833 00000585 C3 retn 834 835 ; ------------------------------------------------------------- 836 837 ; 30/12/2024 (VGA Mode 13h, 320*200 pixels, 256 colors) 838 ; 26/12/2024 839 ; 21/12/2024 840 drawplayingscreen: 841 00000586 BD[04300000] mov ebp, PlayingScreen 842 ;mov esi, 0 ; row 0, column 0 843 0000058B BE00000200 mov esi, 00020000h ; row 2, column 0 ; top margin = 2 844 p_d_x: 845 00000590 C605[E8330000]28 mov byte [columns], 40 846 00000597 B601 mov dh, 01h ; 8x8 system font 847 p_d_x_n: 848 00000599 8A5500 mov dl, [ebp] 849 0000059C 20D2 and dl, dl 850 0000059E 7429 jz short p_d_x_ok 851 852 ; sysvideo system call 853 ; BH = 01h = VGA graphics (0A0000h) data transfers 854 ; BL = 0Fh = write character/font 855 ; DH = 01h = 8*8 system font 856 ; CL = 0Fh = color (white) 857 ; ESI = cursor/writing position (pixels) 858 ; HW = row, SI = column 859 860 sys _video, 010Fh, 0Fh 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 000005A0 BB0F010000 <1> mov ebx, %2 96 <1> %if %0 >= 3 97 000005A5 B90F000000 <1> mov ecx, %3 98 <1> %if %0 = 4 99 <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 000005AA B81F000000 <1> mov eax, %1 104 <1> 105 000005AF CD40 <1> int 40h 861 862 000005B1 45 inc ebp 863 000005B2 6683C608 add si, 8 ; next char pos 864 000005B6 FE0D[E8330000] dec byte [columns] 865 000005BC 75DB jnz short p_d_x_n ; next column 866 000005BE 6631F6 xor si, si 867 000005C1 81C600000800 add esi, 00080000h ; next row ; 8*8 868 000005C7 EBC7 jmp short p_d_x 869 p_d_x_ok: 870 000005C9 C3 retn 871 872 ; ------------------------------------------------------------- 873 874 ; 21/12/2024 875 set_text_mode: 876 000005CA 30E4 xor ah, ah 877 000005CC B003 mov al, 3 878 ;int 10h ; al = 03h text mode, int 10 video 879 000005CE CD31 int 31h ; TRDOS 386 - Video interrupt 880 000005D0 C3 retn 881 882 ; ------------------------------------------------------------- 883 884 ; 02/12/2024 885 Player_Quit@: 886 000005D1 58 pop eax ; return addr (call PlayWav@) 887 888 ; 29/11/2024 889 Player_Quit: 890 000005D2 E92AFFFFFF jmp terminate 891 892 ; ------------------------------------------------------------- 893 894 ; 30/12/2024 (cgaplay.s) 895 ; 29/12/2024 (vgaplay3.s) 896 ; 02/12/2024 (ac97play.s) 897 PlayWav: 898 ; 30/12/2024 899 000005D7 A1[C0390000] mov eax, [_bdl_buffer] ; BDL_BUFFER physical address 900 000005DC 09C0 or eax, eax 901 000005DE 751D jnz short PlayWav@ 902 903 ; 29/05/2024 904 ; Allocate memory block (33 pages) 905 sys _alloc, BDL_BUFFER, 33*4096, 0 ; no upper limit 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 000005E0 BB[00400000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 000005E5 B900100200 <1> mov ecx, %3 98 <1> %if %0 = 4 99 000005EA BA00000000 <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 000005EF B82A000000 <1> mov eax, %1 104 <1> 105 000005F4 CD40 <1> int 40h 906 ;jc short Player_Quit ; 01/12/2024 907 000005F6 72D9 jc short Player_Quit@ ; 02/12/2024 908 909 000005F8 A3[C0390000] mov [_bdl_buffer], eax ; BDL_BUFFER physical address 910 911 PlayWav@: 912 ; create Buffer Descriptor List 913 914 ; Generic Form of Buffer Descriptor 915 ; --------------------------------- 916 ; 63 62 61-48 47-32 31-0 917 ; --- --- -------- ------- ----- 918 ; IOC BUP -reserved- Buffer Buffer 919 ; Length Pointer 920 ; [15:0] [31:0] 921 922 ; 30/12/2024 923 924 000005FD 0500100000 add eax, 4096 ; WAVBUFFER_1 physical address 925 00000602 89C3 mov ebx, eax 926 ;mov [wav_buffer1], eax 927 ;add eax, 65536 ; WAVBUFFER_2 physical address 928 ;mov [wav_buffer2], eax 929 930 00000604 BF[00400000] mov edi, BDL_BUFFER 931 00000609 B910000000 mov ecx, 16 932 _pw0: 933 ;mov eax, WAVBUFFER_1 934 0000060E 89D8 mov eax, ebx ; WAVBUFFER_1 physical address 935 00000610 AB stosd 936 937 00000611 A1[A8390000] mov eax, [buffersize] 938 ; 02/12/2024 939 00000616 D1E8 shr eax, 1 ; buffer size in word 940 00000618 0D00000040 or eax, BUP ; tuneloop (without interrupt) 941 0000061D AB stosd 942 943 ;mov eax, WAVBUFFER_2 944 0000061E 89D8 mov eax, ebx 945 00000620 0500000100 add eax, 65536 ; WAVBUFFER_2 physical address 946 00000625 AB stosd 947 948 00000626 A1[A8390000] mov eax, [buffersize] 949 ; 02/12/2024 950 0000062B D1E8 shr eax, 1 ; buffer size in word 951 0000062D 0D00000040 or eax, BUP ; tuneloop (without interrupt) 952 00000632 AB stosd 953 954 00000633 E2D9 loop _pw0 955 956 ; 14/11/2024 957 ;mov dword [count], ecx ; 0 958 ;mov dword [LoadedDataBytes], 0 959 960 RePlayWav: 961 ; 01/12/2024 962 ; load 64k into buffer 1 963 00000635 BF[00500000] mov edi, WAVBUFFER_1 964 ; 05/02/2025 965 0000063A 893D[EC330000] mov [audio_buffer], edi 966 00000640 FF15[A0390000] call dword [loadfromwavfile] 967 ; 01/12/2024 968 ; 14/11/2024 969 00000646 A1[B4390000] mov eax, [count] 970 0000064B 0105[B8390000] add [LoadedDataBytes], eax 971 972 ; 18/12/2024 973 00000651 C705[B4390000]0000- mov dword [count], 0 973 00000659 0000 974 975 ; and 64k into buffer 2 976 0000065B BF[00500100] mov edi, WAVBUFFER_2 977 ; 05/02/2025 978 00000660 893D[EC330000] mov [audio_buffer], edi 979 00000666 FF15[A0390000] call dword [loadfromwavfile] 980 ; 01/12/2024 981 ; 14/11/2024 982 0000066C A1[B4390000] mov eax, [count] 983 00000671 0105[B8390000] add [LoadedDataBytes], eax 984 985 ; write NABMBAR+10h with offset of buffer descriptor list 986 987 ;;mov eax, BDL_BUFFER 988 ;mov eax, esi ; BDL_BUFFER physical address 989 990 ;mov eax, [_bdl_buffer] ; BDL_BUFFER physical address 991 ; 02/12/2024 992 00000677 8B1D[C0390000] mov ebx, [_bdl_buffer] 993 994 0000067D 668B15[9E390000] mov dx, [NABMBAR] 995 00000684 6683C210 add dx, PO_BDBAR_REG ; set pointer to BDL 996 ;out dx, eax ; write to AC97 controller 997 ; 29/05/2024 998 ;mov ebx, eax ; data, dword 999 ; 02/12/2024 1000 ; ebx = [_bdl_buffer] ; data, dword 1001 00000688 B405 mov ah, 5 ; write port dword 1002 0000068A CD34 int 34h 1003 1004 ; 31/05/2024 1005 ; 19/05/2024 1006 ;call delay1_4ms 1007 1008 0000068C B01F mov al, 31 1009 0000068E E8EC060000 call setLastValidIndex 1010 1011 ; 31/05/2024 1012 ; 19/05/2024 1013 ;call delay1_4ms 1014 1015 ; 17/02/2017 1016 00000693 668B15[9E390000] mov dx, [NABMBAR] 1017 0000069A 6683C21B add dx, PO_CR_REG ; PCM out Control Register 1018 ;mov al, IOCE + RPBM ; Enable 'Interrupt On Completion' + run 1019 ; ; (LVBI interrupt will not be enabled) 1020 ; 06/11/2023 (TUNELOOP version, without interrupt) 1021 0000069E B001 mov al, RPBM 1022 ;out dx, al ; Start bus master operation. 1023 ; 29/05/2024 1024 ; al = data, byte 1025 000006A0 B401 mov ah, 1 ; write port, byte 1026 000006A2 CD34 int 34h 1027 1028 ; 30/12/2024 1029 1030 ; ------------------------------------------- 1031 1032 ; 30/12/2024 (cgaplay.s) 1033 ; 29/12/2024 (vgaplay3.s) 1034 ; 18/12/2024 (ac97play.s) 1035 ; 01/12/2024 (32bit) 1036 ; 29/11/2024 1037 tuneLoop: 1038 ; 30/05/2024 1039 ; 18/11/2023 (ich_wav4.asm) 1040 ; 08/11/2023 1041 ; 06/11/2023 1042 tLWait: 1043 ; 18/11/2024 1044 000006A4 803D[F0380000]00 cmp byte [stopped], 0 1045 ;jna short tL@ 1046 ; 21/11/2024 1047 000006AB 7718 ja short tLWait@ 1048 000006AD A0[F2380000] mov al, [tLP] 1049 000006B2 3C31 cmp al, '1' 1050 000006B4 7458 je short tL1@ 1051 000006B6 0F87A9000000 ja tL2@ 1052 000006BC B031 mov al, '1' 1053 000006BE A2[F2380000] mov [tLP], al 1054 000006C3 EB49 jmp short tL1@ 1055 tLWait@: ; 21/11/2024 1056 ;;; 1057 ; 09/12/2024 1058 000006C5 803D[F0380000]03 cmp byte [stopped], 3 1059 000006CC 0F83EB000000 jnb _exitt_ 1060 ;;; 1061 000006D2 E863210000 call checkUpdateEvents 1062 000006D7 0F82E0000000 jc _exitt_ 1063 ;;; 1064 ; 29/11/2024 1065 000006DD 803D[FE380000]4E cmp byte [command], 'N' 1066 000006E4 0F84D3000000 je _exitt_ 1067 000006EA 803D[FE380000]50 cmp byte [command], 'P' 1068 000006F1 0F84C6000000 je _exitt_ 1069 ;;; 1070 000006F7 803D[F1380000]30 cmp byte [tLO], '0' 1071 000006FE 74A4 je short tLWait 1072 00000700 E8C2000000 call tLZ 1073 00000705 C605[F1380000]30 mov byte [tLO], '0' 1074 0000070C EB96 jmp short tLWait 1075 1076 ;tLO: db 0 1077 1078 tL1@: 1079 ;mov al, '1' 1080 ; 19/11/2024 1081 0000070E A2[F1380000] mov [tLO], al 1082 00000713 E8B1000000 call tL0 1083 tL1: 1084 00000718 E825060000 call updateLVI ; /set LVI != CIV/ 1085 0000071D 0F849A000000 jz _exitt_ ; 08/11/2023 1086 ;;; 1087 ;call check4keyboardstop 1088 ; 14/11/2024 1089 00000723 E812210000 call checkUpdateEvents 1090 00000728 0F828F000000 jc _exitt_ 1091 ; 18/11/2024 1092 0000072E 803D[F0380000]00 cmp byte [stopped], 0 1093 00000735 778E ja short tLWait@ ; 21/11/2024 1094 ;;; 1095 00000737 E8F6050000 call getCurrentIndex 1096 0000073C A801 test al, BIT0 1097 0000073E 74D8 jz short tL1 ; loop if buffer 2 is not playing 1098 1099 ; load buffer 1 1100 ;mov ax, [WAV_BUFFER1] 1101 ; 01/12/2024 1102 00000740 BF[00500000] mov edi, WAVBUFFER_1 1103 ; 05/02/2025 1104 00000745 893D[EC330000] mov [audio_buffer], edi 1105 1106 ;call loadFromFile 1107 ; 18/11/2023 1108 ;call word [loadfromwavfile] 1109 ; 01/12/2024 1110 0000074B FF15[A0390000] call dword [loadfromwavfile] 1111 00000751 726A jc short _exitt_ ; end of file 1112 1113 ; 14/11/2024 1114 ;mov ax, [count] 1115 ;add [LoadedDataBytes], ax 1116 ;adc word [LoadedDataBytes+2], 0 1117 ; 01/12/2024 1118 00000753 A1[B4390000] mov eax, [count] 1119 00000758 0105[B8390000] add [LoadedDataBytes], eax 1120 1121 0000075E B032 mov al, '2' 1122 ; 21/11/2024 1123 00000760 A2[F2380000] mov [tLP], al 1124 tL2@: 1125 ; 19/11/2024 1126 00000765 A2[F1380000] mov [tLO], al 1127 0000076A E85A000000 call tL0 1128 tL2: 1129 0000076F E8CE050000 call updateLVI 1130 00000774 7447 jz short _exitt_ ; 08/11/2023 1131 ;;; 1132 ;call check4keyboardstop 1133 ; 14/11/2024 1134 00000776 E8BF200000 call checkUpdateEvents 1135 0000077B 7240 jc short _exitt_ 1136 ; 18/11/2024 1137 0000077D 803D[F0380000]00 cmp byte [stopped], 0 1138 00000784 0F873BFFFFFF ja tLWait@ ; 21/11/2024 1139 ;;; 1140 0000078A E8A3050000 call getCurrentIndex 1141 0000078F A801 test al, BIT0 1142 00000791 75DC jnz short tL2 ; loop if buffer 1 is not playing 1143 1144 ; load buffer 2 1145 ;mov ax, [WAV_BUFFER2] 1146 ; 01/12/2024 1147 00000793 BF[00500100] mov edi, WAVBUFFER_2 1148 ; 05/02/2025 1149 00000798 893D[EC330000] mov [audio_buffer], edi 1150 1151 ;call loadFromFile 1152 ; 18/11/2023 1153 ;call word [loadfromwavfile] 1154 ; 01/12/2024 1155 0000079E FF15[A0390000] call dword [loadfromwavfile] 1156 ;jnc short tuneLoop 1157 000007A4 7217 jc short _exitt_ 1158 1159 ; 14/11/2024 1160 ;mov ax, [count] 1161 ;add [LoadedDataBytes], ax 1162 ;adc word [LoadedDataBytes+2], 0 1163 ; 01/12/2024 1164 000007A6 A1[B4390000] mov eax, [count] 1165 000007AB 0105[B8390000] add [LoadedDataBytes], eax 1166 1167 ; 21/11/2024 1168 000007B1 C605[F2380000]31 mov byte [tLP], '1' 1169 000007B8 E9E7FEFFFF jmp tuneLoop 1170 1171 ; 29/12/2024 (vgaplay3.s) 1172 _exitt_: 1173 ; 07/12/2024 1174 ; Stop Playing 1175 ;mov byte [stopped], 2 1176 ;sys _audio, 0700h 1177 000007BD E802050000 call ac97_stop 1178 1179 ;;; 1180 ; 14/11/2024 1181 000007C2 E889240000 call UpdateProgressBar 1182 ;;; 1183 1184 ; 18/11/2024 1185 tLZ: 1186 ; 30/05/2024 1187 000007C7 B030 mov al, '0' 1188 1189 ;add al, '0' 1190 ;call tL0 1191 ; 1192 ;retn 1193 ; 06/11/2023 1194 ;jmp short tL0 1195 ;retn 1196 1197 tL0: 1198 ; 30/12/2024 (cgaplay.s) 1199 ; 29/05/2024 (TRDOS 386) 1200 ; 08/11/2023 1201 ; 05/11/2023 1202 ; 17/02/2017 - Buffer switch test (temporary) 1203 ; 06/11/2023 1204 ; al = buffer indicator ('1', '2' or '0' -stop- ) 1205 1206 ; 30/12/2024 (video mode 13h modification) 1207 ; (320*200, 256 colors) 1208 ;;; 1209 000007C9 88C2 mov dl, al ; character 1210 000007CB BF00000A00 mov edi, 0A0000h 1211 1212 000007D0 BB08000000 mov ebx, 8 ; 8 pixels (8*8 pixels font) 1213 1214 000007D5 B00C mov al, 0Ch ; red 1215 tL0_1: 1216 ;mov ecx, 8 ; 8 pixels (8*8 pixels font) 1217 000007D7 B907000000 mov ecx, 7 1218 tL0_2: 1219 000007DC AA stosb 1220 000007DD 49 dec ecx 1221 000007DE 75FC jnz short tL0_2 1222 000007E0 4B dec ebx 1223 000007E1 7408 jz short tL0_3 1224 ;add edi, 320-8 ; next line 1225 000007E3 81C739010000 add edi, 320-7 1226 000007E9 EBEC jmp short tL0_1 1227 tL0_3: 1228 ; write system font 1229 000007EB B601 mov dh, 01h 1230 ;mov dl, al ; character 1231 000007ED 31F6 xor esi, esi ; = row 0, column 0 1232 sys _video, 010Fh, 0Eh ; yellow 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 000007EF BB0F010000 <1> mov ebx, %2 96 <1> %if %0 >= 3 97 000007F4 B90E000000 <1> mov ecx, %3 98 <1> %if %0 = 4 99 <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 000007F9 B81F000000 <1> mov eax, %1 104 <1> 105 000007FE CD40 <1> int 40h 1233 ;;; 1234 1235 00000800 C3 retn 1236 1237 ; ------------------------------------------- 1238 1239 ; 29/12/2024 (vgaplay3.s) 1240 ; 18/12/2024 (ac97play.s) 1241 ; 14/11/2024 1242 ;SetMasterVolume: 1243 ; 15/11/2024 1244 SetPCMOutVolume: 1245 ;cmp al, 31 1246 ;ja short setvolume_ok 1247 00000801 A2[5B2A0000] mov [volume], al ; max = 0, min = 31 1248 SetPCMOutVolume@: ; 19/11/2024 1249 00000806 88C4 mov ah, al 1250 00000808 668B15[9C390000] mov dx, [NAMBAR] 1251 ; 15/11/2024 (QEMU) 1252 ;add dx, CODEC_MASTER_VOL_REG 1253 0000080F 6683C218 add dx, CODEC_PCM_OUT_REG 1254 ;out dx, ax 1255 ; 01/12/2024 1256 ; bx = data, word 1257 ; 03/12/2024 1258 00000813 89C3 mov ebx, eax 1259 00000815 B403 mov ah, 3 ; write port, word 1260 00000817 CD34 int 34h 1261 ;setvolume_ok: 1262 00000819 C3 retn 1263 1264 ; ------------------------------------------- 1265 1266 ; 29/12/2024 (vgaplay3.s) 1267 ; 18/12/2024 (ac97play.s) 1268 ; 30/05/2024 1269 DetectAC97: 1270 DetectICH: 1271 ; 22/11/2023 1272 ; 19/11/2023 1273 ; 01/11/2023 - TRDOS 386 Kernel v2.0.7 1274 ;; 10/06/2017 1275 ;; 05/06/2017 1276 ;; 29/05/2017 1277 ;; 28/05/2017 1278 1279 ; 01/12/2024 1280 ; 19/11/2023 1281 0000081A BE[4C2D0000] mov esi, valid_ids ; address of Valid ICH (AC97) Device IDs 1282 0000081F B915000000 mov ecx, valid_id_count 1283 pfd_1: 1284 00000824 AD lodsd 1285 00000825 E8B4000000 call pciFindDevice 1286 0000082A 7303 jnc short d_ac97_1 1287 0000082C E2F6 loop pfd_1 1288 1289 ;stc 1290 0000082E C3 retn 1291 1292 d_ac97_1: 1293 ; eax = BUS/DEV/FN 1294 ; 00000000BBBBBBBBDDDDDFFF00000000 1295 ; edx = DEV/VENDOR 1296 ; DDDDDDDDDDDDDDDDVVVVVVVVVVVVVVVV 1297 1298 ; playwav4.asm - 19/05/2024 1299 1300 0000082F A3[94390000] mov [bus_dev_fn], eax 1301 00000834 8915[98390000] mov [dev_vendor], edx 1302 1303 ; get ICH base address regs for mixer and bus master 1304 1305 0000083A B010 mov al, NAMBAR_REG 1306 0000083C E82B010000 call pciRegRead16 ; read PCI registers 10-11 1307 ;and dx, IO_ADDR_MASK ; mask off BIT0 1308 ; 19/05/2024 1309 00000841 80E2FE and dl, 0FEh 1310 1311 00000844 668915[9C390000] mov [NAMBAR], dx ; save audio mixer base addr 1312 1313 0000084B B014 mov al, NABMBAR_REG 1314 0000084D E81A010000 call pciRegRead16 1315 ;and dx, IO_ADDR_MASK 1316 ; 19/05/2024 1317 00000852 80E2C0 and dl, 0C0h 1318 1319 00000855 668915[9E390000] mov [NABMBAR], dx ; save bus master base addr 1320 1321 0000085C B03C mov al, AC97_INT_LINE ; Interrupt line register (3Ch) 1322 0000085E E802010000 call pciRegRead8 ; 17/02/2017 1323 1324 00000863 8815[2F390000] mov [ac97_int_ln_reg], dl 1325 1326 ;clc 1327 1328 00000869 C3 retn 1329 1330 ; ---------------------------------- 1331 1332 ; 26/12/2024 1333 ; 07/12/2024 1334 ; 01/12/2024 1335 ; 14/11/2024 1336 ; INPUT: ds:dx = file name address 1337 ; OUTPUT: [filehandle] = ; -1 = not open 1338 openFile: 1339 ; 26/12/2024 1340 ; 01/12/2024 1341 sys _open, edx, 0 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 0000086A 89D3 <1> mov ebx, %2 96 <1> %if %0 >= 3 97 0000086C B900000000 <1> mov ecx, %3 98 <1> %if %0 = 4 99 <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 00000871 B805000000 <1> mov eax, %1 104 <1> 105 00000876 CD40 <1> int 40h 1342 ; 07/12/2024 1343 ;sys _open, wav_file_name, 0 1344 00000878 7305 jnc short _of1 1345 1346 0000087A B8FFFFFFFF mov eax, -1 1347 ; cf = 1 -> not found or access error 1348 _of1: 1349 0000087F A3[30390000] mov [filehandle], eax 1350 00000884 C3 retn 1351 1352 ; ---------------------------------- 1353 1354 ; close the currently open file 1355 1356 ; 01/12/2024 1357 ; 14/11/2024 1358 ; INPUT: [filehandle] ; -1 = not open 1359 ; OUTPUT: none 1360 closeFile: 1361 00000885 833D[30390000]FF cmp dword [filehandle], -1 1362 0000088C 740D jz short _cf1 1363 ; 01/12/2024 1364 sys _close, [filehandle] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 0000088E 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 <1> mov ecx, %3 98 <1> %if %0 = 4 99 <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 00000894 B806000000 <1> mov eax, %1 104 <1> 105 00000899 CD40 <1> int 40h 1365 ;mov dword [filehandle], -1 1366 _cf1: 1367 0000089B C3 retn 1368 1369 ; ---------------------------------- 1370 1371 ; 05/02/2025 1372 ; 01/12/2024 1373 ; 14/11/2024 - Erdogan Tan 1374 getWAVParameters: 1375 ; reads WAV file header(s) (44 bytes) from the .wav file. 1376 ; entry: none - assumes file is already open 1377 ; exit: ax = sample rate (11025, 22050, 44100, 48000) 1378 ; cx = number of channels (mono=1, stereo=2) 1379 ; dx = bits per sample (8, 16) 1380 ; bx = number of bytes per sample (1 to 4) 1381 1382 ;mov dx, WAVFILEHEADERbuff 1383 ;mov bx, [filehandle] 1384 ;mov cx, 44 ; 44 bytes 1385 ;mov ah, 3Fh 1386 ;int 21h 1387 ;jc short gwavp_retn 1388 ; 01/12/2024 (TRDOS 386) 1389 sys _read, [filehandle], WAVFILEHEADERbuff, 44 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 0000089C 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 000008A2 B9[00390000] <1> mov ecx, %3 98 <1> %if %0 = 4 99 000008A7 BA2C000000 <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 000008AC B803000000 <1> mov eax, %1 104 <1> 105 000008B1 CD40 <1> int 40h 1390 000008B3 7228 jc short gwavp_retn 1391 1392 000008B5 83F82C cmp eax, 44 1393 000008B8 7223 jb short gwavp_retn 1394 1395 000008BA 813D[08390000]5741- cmp dword [RIFF_Format], 'WAVE' 1395 000008C2 5645 1396 000008C4 7516 jne short gwavp_stc_retn 1397 1398 000008C6 66833D[14390000]01 cmp word [WAVE_AudioFormat], 1 ; Offset 20, must be 1 (= PCM) 1399 ; 05/02/2025 1400 000008CE 750C jne short gwavp_stc_retn 1401 ;je short gwavp_retn ; 15/11/2024 1402 1403 ; 05/02/2025 1404 ; (Open MPT creates wav files with a new type header, 1405 ; this program can not use the new type 1406 ; because of 'data' offset is not at DATA_SubchunkID.) 1407 ; ((GoldWave creates common type wav file.)) 1408 000008D0 813D[24390000]6461- cmp dword [DATA_SubchunkID], 'data' 1408 000008D8 7461 1409 000008DA 7401 je short gwavp_retn 1410 1411 ; 15/11/2024 1412 ;mov cx, [WAVE_NumChannels] ; return num of channels in CX 1413 ;mov ax, [WAVE_SampleRate] ; return sample rate in AX 1414 ;mov dx, [WAVE_BitsPerSample] 1415 ; return bits per sample value in DX 1416 ;mov bx, [WAVE_BlockAlign] ; return bytes per sample in BX 1417 ;gwavp_retn: 1418 ;retn 1419 1420 gwavp_stc_retn: 1421 000008DC F9 stc 1422 gwavp_retn: 1423 000008DD C3 retn 1424 1425 1426 ; 29/12/2024 (vgaplay3.s) 1427 ; 18/12/2024 (ac97play.s) 1428 ; -------------------------------------------------------- 1429 ; 27/05/2024 - (TRDOS 386 Kernel) audio.s 1430 ; -------------------------------------------------------- 1431 1432 NOT_PCI32_PCI16 EQU 03FFFFFFFh ; NOT BIT31+BIT30 ; 19/03/2017 1433 NOT_BIT31 EQU 7FFFFFFFh 1434 1435 pciFindDevice: 1436 ; 19/11/2023 1437 ; 03/04/2017 ('pci.asm', 20/03/2017) 1438 ; 1439 ; scan through PCI space looking for a device+vendor ID 1440 ; 1441 ; Entry: EAX=Device+Vendor ID 1442 ; 1443 ; Exit: EAX=PCI address if device found 1444 ; EDX=Device+Vendor ID 1445 ; CY clear if found, set if not found. EAX invalid if CY set. 1446 ; 1447 ; Destroys: ebx, edi ; 19/11/2023 1448 1449 ; 19/11/2023 1450 000008DE 89C3 mov ebx, eax 1451 000008E0 BF00000080 mov edi, 80000000h 1452 nextPCIdevice: 1453 000008E5 89F8 mov eax, edi ; read PCI registers 1454 000008E7 E88C000000 call pciRegRead32 1455 ; 19/11/2023 1456 000008EC 39DA cmp edx, ebx 1457 000008EE 7412 je short PCIScanExit ; found 1458 ; 19/11/2023 1459 000008F0 81FF00F8FF80 cmp edi, 80FFF800h 1460 000008F6 7308 jnb short pfd_nf ; not found 1461 000008F8 81C700010000 add edi, 100h 1462 000008FE EBE5 jmp short nextPCIdevice 1463 pfd_nf: 1464 00000900 F9 stc 1465 00000901 C3 retn 1466 PCIScanExit: 1467 ;pushf 1468 00000902 B8FFFFFF7F mov eax, NOT_BIT31 ; 19/03/2017 1469 00000907 21F8 and eax, edi ; return only bus/dev/fn # 1470 00000909 C3 retn 1471 1472 pciRegRead: 1473 ; 01/12/2024 1474 ; 03/04/2017 ('pci.asm', 20/03/2017) 1475 ; 1476 ; 8/16/32bit PCI reader 1477 ; 1478 ; Entry: EAX=PCI Bus/Device/fn/register number 1479 ; BIT30 set if 32 bit access requested 1480 ; BIT29 set if 16 bit access requested 1481 ; otherwise defaults to 8 bit read 1482 ; 1483 ; Exit: DL,DX,EDX register data depending on requested read size 1484 ; 1485 ; Note1: this routine is meant to be called via pciRegRead8, 1486 ; pciRegread16 or pciRegRead32, listed below. 1487 ; 1488 ; Note2: don't attempt to read 32 bits of data from a non dword 1489 ; aligned reg number. Likewise, don't do 16 bit reads from 1490 ; non word aligned reg # 1491 1492 0000090A 53 push ebx 1493 0000090B 51 push ecx 1494 0000090C 89C3 mov ebx, eax ; save eax, dh 1495 0000090E 88F1 mov cl, dh 1496 1497 00000910 25FFFFFF3F and eax, NOT_PCI32_PCI16 ; clear out data size request 1498 00000915 0D00000080 or eax, BIT31 ; make a PCI access request 1499 0000091A 24FC and al, ~3 ; NOT 3 ; 0FCh ; force index to be dword 1500 1501 0000091C 66BAF80C mov dx, PCI_INDEX_PORT 1502 ;out dx, eax ; write PCI selector 1503 ; 29/05/2024 1504 00000920 53 push ebx 1505 00000921 89C3 mov ebx, eax ; data, dword 1506 00000923 B405 mov ah, 5 ; write port, dword 1507 ; dx = port number 1508 00000925 CD34 int 34h 1509 00000927 5B pop ebx 1510 1511 00000928 66BAFC0C mov dx, PCI_DATA_PORT 1512 0000092C 88D8 mov al, bl 1513 0000092E 2403 and al, 3 ; figure out which port to 1514 00000930 00C2 add dl, al ; read to 1515 1516 00000932 F7C3000000C0 test ebx, PCI32+PCI16 1517 00000938 750A jnz short _pregr0 1518 1519 ;in al, dx ; return 8 bits of data 1520 ; 29/05/2024 1521 0000093A B400 mov ah, 0 ; read port, byte 1522 ; dx = port number 1523 0000093C CD34 int 34h 1524 1525 0000093E 88C2 mov dl, al 1526 00000940 88CE mov dh, cl ; restore dh for 8 bit read 1527 00000942 EB17 jmp short _pregr2 1528 _pregr0: 1529 00000944 F7C300000080 test ebx, PCI32 1530 0000094A 7509 jnz short _pregr1 1531 1532 ;in ax, dx 1533 ; 29/05/2024 1534 0000094C B402 mov ah, 2 ; read port, word 1535 ; dx = port number 1536 0000094E CD34 int 34h 1537 1538 00000950 6689C2 mov dx, ax ; return 16 bits of data 1539 00000953 EB06 jmp short _pregr2 1540 _pregr1: 1541 ;in eax, dx ; return 32 bits of data 1542 ; 29/05/2024 1543 00000955 B404 mov ah, 4 ; read port, dword 1544 ; dx = port number 1545 00000957 CD34 int 34h 1546 1547 00000959 89C2 mov edx, eax 1548 _pregr2: 1549 0000095B 89D8 mov eax, ebx ; restore eax 1550 0000095D 25FFFFFF3F and eax, NOT_PCI32_PCI16 ; clear out data size request 1551 00000962 59 pop ecx 1552 00000963 5B pop ebx 1553 00000964 C3 retn 1554 1555 pciRegRead8: 1556 00000965 25FFFFFF3F and eax, NOT_PCI32_PCI16 ; set up 8 bit read size 1557 0000096A EB9E jmp short pciRegRead ; call generic PCI access 1558 1559 pciRegRead16: 1560 0000096C 25FFFFFF3F and eax, NOT_PCI32_PCI16 ; set up 16 bit read size 1561 00000971 0D00000040 or eax, PCI16 ; call generic PCI access 1562 00000976 EB92 jmp short pciRegRead 1563 1564 pciRegRead32: 1565 00000978 25FFFFFF3F and eax, NOT_PCI32_PCI16 ; set up 32 bit read size 1566 0000097D 0D00000080 or eax, PCI32 ; call generic PCI access 1567 00000982 EB86 jmp pciRegRead 1568 1569 pciRegWrite: 1570 ; 01/12/2024 1571 ; 03/04/2017 ('pci.asm', 29/11/2016) 1572 ; 1573 ; 8/16/32bit PCI writer 1574 ; 1575 ; Entry: EAX=PCI Bus/Device/fn/register number 1576 ; BIT31 set if 32 bit access requested 1577 ; BIT30 set if 16 bit access requested 1578 ; otherwise defaults to 8bit read 1579 ; DL/DX/EDX data to write depending on size 1580 ; 1581 ; Note1: this routine is meant to be called via pciRegWrite8, 1582 ; pciRegWrite16 or pciRegWrite32 as detailed below. 1583 ; 1584 ; Note2: don't attempt to write 32bits of data from a non dword 1585 ; aligned reg number. Likewise, don't do 16 bit writes from 1586 ; non word aligned reg # 1587 1588 00000984 53 push ebx 1589 00000985 51 push ecx 1590 00000986 89C3 mov ebx, eax ; save eax, edx 1591 00000988 89D1 mov ecx, edx 1592 0000098A 25FFFFFF3F and eax, NOT_PCI32_PCI16 ; clear out data size request 1593 0000098F 0D00000080 or eax, BIT31 ; make a PCI access request 1594 00000994 24FC and al, ~3 ; NOT 3 ; 0FCh ; force index to be dword 1595 1596 00000996 66BAF80C mov dx, PCI_INDEX_PORT 1597 ;out dx, eax ; write PCI selector 1598 ; 29/05/2024 1599 0000099A 53 push ebx 1600 0000099B 89C3 mov ebx, eax ; data, dword 1601 0000099D B405 mov ah, 5 ; write port, dword 1602 ; dx = port number 1603 0000099F CD34 int 34h 1604 000009A1 5B pop ebx 1605 1606 000009A2 66BAFC0C mov dx, PCI_DATA_PORT 1607 000009A6 88D8 mov al, bl 1608 000009A8 2403 and al, 3 ; figure out which port to 1609 000009AA 00C2 add dl, al ; write to 1610 1611 000009AC F7C3000000C0 test ebx, PCI32+PCI16 1612 000009B2 7508 jnz short _pregw0 1613 000009B4 88C8 mov al, cl ; put data into al 1614 ;out dx, al 1615 ; 29/05/2024 1616 ; al = data, byte 1617 000009B6 B401 mov ah, 1 ; write port, byte 1618 ; dx = port number 1619 000009B8 CD34 int 34h 1620 1621 000009BA EB1F jmp short _pregw2 1622 _pregw0: 1623 000009BC F7C300000080 test ebx, PCI32 1624 000009C2 750D jnz short _pregw1 1625 000009C4 6689C8 mov ax, cx ; put data into ax 1626 ;out dx, ax 1627 ; 29/05/2024 1628 000009C7 53 push ebx 1629 000009C8 89C3 mov ebx, eax ; data, word 1630 000009CA B403 mov ah, 3 ; write port, word 1631 ; dx = port number 1632 000009CC CD34 int 34h 1633 000009CE 5B pop ebx 1634 1635 000009CF EB0A jmp short _pregw2 1636 _pregw1: 1637 000009D1 89C8 mov eax, ecx ; put data into eax 1638 ;out dx, eax 1639 ; 29/05/2024 1640 000009D3 53 push ebx 1641 000009D4 89C3 mov ebx, eax ; data, dword 1642 000009D6 B405 mov ah, 5 ; write port, dword 1643 ; dx = port number 1644 000009D8 CD34 int 34h 1645 000009DA 5B pop ebx 1646 _pregw2: 1647 000009DB 89D8 mov eax, ebx ; restore eax 1648 000009DD 25FFFFFF3F and eax, NOT_PCI32_PCI16 ; clear out data size request 1649 000009E2 89CA mov edx, ecx ; restore dx 1650 000009E4 59 pop ecx 1651 000009E5 5B pop ebx 1652 000009E6 C3 retn 1653 1654 pciRegWrite8: 1655 000009E7 25FFFFFF3F and eax, NOT_PCI32_PCI16 ; set up 8 bit write size 1656 000009EC EB96 jmp short pciRegWrite ; call generic PCI access 1657 1658 pciRegWrite16: 1659 000009EE 25FFFFFF3F and eax, NOT_PCI32_PCI16 ; set up 16 bit write size 1660 000009F3 0D00000040 or eax, PCI16 ; call generic PCI access 1661 000009F8 EB8A jmp short pciRegWrite 1662 1663 pciRegWrite32: 1664 000009FA 25FFFFFF3F and eax, NOT_PCI32_PCI16 ; set up 32 bit write size 1665 000009FF 0D00000080 or eax, PCI32 ; call generic PCI access 1666 00000A04 E97BFFFFFF jmp pciRegWrite 1667 1668 ; -------------------------------------------------------- 1669 ; 19/05/2024 - (playwav4.asm) ac97_vra.asm 1670 ; -------------------------------------------------------- 1671 1672 ; 13/11/2023 1673 1674 ;VRA: db 1 1675 1676 codecConfig: 1677 ; 01/12/2024 (ac97play.s) 1678 ; 29/05/2024 (playwav7.s modification) 1679 ; 19/05/2024 1680 ; 19/11/2023 1681 ; 15/11/2023 1682 ; 04/11/2023 1683 ; 17/02/2017 1684 ; 07/11/2016 (Erdogan Tan) 1685 1686 ;AC97_EA_VRA equ 1 1687 AC97_EA_VRA equ BIT0 1688 1689 ; 04/11/2023 1690 init_ac97_controller: 1691 00000A09 A1[94390000] mov eax, [bus_dev_fn] 1692 00000A0E B004 mov al, PCI_CMD_REG 1693 00000A10 E857FFFFFF call pciRegRead16 ; read PCI command register 1694 00000A15 80CA05 or dl, IO_ENA+BM_ENA ; enable IO and bus master 1695 00000A18 E8D1FFFFFF call pciRegWrite16 1696 1697 ;call delay_100ms 1698 1699 ; 19/05/2024 1700 ; ('PLAYMOD3.ASM', Erdogan Tan, 18/05/2024) 1701 1702 init_ac97_codec: 1703 ; 18/11/2023 1704 00000A1D BD28000000 mov ebp, 40 1705 ; 29/05/2024 1706 ;mov ebp, 1000 1707 _initc_1: 1708 ; 29/05/2024 1709 00000A22 66BA3000 mov dx, GLOB_STS_REG ; 30h 1710 00000A26 660315[9E390000] add dx, [NABMBAR] 1711 ;in eax, dx 1712 00000A2D B404 mov ah, 4 ; read port, dword 1713 00000A2F CD34 int 34h 1714 1715 ; 19/05/2024 1716 ;call delay1_4ms 1717 1718 00000A31 83F8FF cmp eax, 0FFFFFFFFh ; -1 1719 00000A34 750A jne short _initc_3 1720 _initc_2: 1721 00000A36 4D dec ebp 1722 00000A37 7425 jz short _ac97_codec_ready 1723 1724 ; 31/05/2024 1725 00000A39 E8B3020000 call delay_100ms 1726 00000A3E EBE2 jmp short _initc_1 1727 _initc_3: 1728 00000A40 A900030010 test eax, CTRL_ST_CREADY 1729 00000A45 7517 jnz short _ac97_codec_ready 1730 1731 ; 30/05/2024 1732 00000A47 803D[EE2D0000]01 cmp byte [reset], 1 1733 00000A4E 73E6 jnb short _initc_2 1734 1735 00000A50 E893010000 call reset_ac97_codec 1736 ; 30/05/2024 1737 00000A55 C605[EE2D0000]01 mov byte [reset], 1 1738 ; 19/05/2024 1739 00000A5C EBD8 jmp short _initc_2 1740 1741 _ac97_codec_ready: 1742 00000A5E 668B15[9C390000] mov dx, [NAMBAR] 1743 ;add dx, 0 ; ac_reg_0 ; reset register 1744 ;out dx, ax 1745 ; 29/05/2024 1746 00000A65 53 push ebx 1747 00000A66 89C3 mov ebx, eax ; bx = data, word 1748 00000A68 B403 mov ah, 3 ; write port, word 1749 00000A6A CD34 int 34h 1750 00000A6C 5B pop ebx 1751 1752 ; 31/05/2024 1753 ; 29/05/2024 1754 ;call delay_100ms 1755 1756 ; 19/11/2023 1757 00000A6D 09ED or ebp, ebp 1758 00000A6F 7539 jnz short _ac97_codec_init_ok 1759 1760 00000A71 31C0 xor eax, eax ; 0 1761 00000A73 668B15[9C390000] mov dx, [NAMBAR] 1762 00000A7A 6683C226 add dx, CODEC_REG_POWERDOWN 1763 ;out dx, ax 1764 ; 29/05/2024 1765 00000A7E 53 push ebx 1766 00000A7F 89C3 mov ebx, eax 1767 00000A81 B403 mov ah, 3 ; write port, word 1768 00000A83 CD34 int 34h 1769 00000A85 5B pop ebx 1770 1771 ; 19/11/2023 1772 ; wait for 1 second 1773 ; 19/05/2024 1774 00000A86 B9E8030000 mov ecx, 1000 ; 1000*4*0.25ms = 1s 1775 ;;mov ecx, 10 1776 ; 30/05/2024 1777 ;mov ecx, 40 1778 _ac97_codec_rloop: 1779 ;call delay_100ms 1780 ; 31/05/2024 1781 00000A8B E870020000 call delay1_4ms 1782 1783 ;mov dx, [NAMBAR] 1784 ;add dx, CODEC_REG_POWERDOWN 1785 ;in ax, dx 1786 ; 29/05/2024 1787 00000A90 668B15[9C390000] mov dx, [NAMBAR] 1788 00000A97 6683C226 add dx, CODEC_REG_POWERDOWN 1789 ; 31/05/2024 1790 00000A9B B402 mov ah, 2 ; read port, word 1791 00000A9D CD34 int 34h 1792 1793 ; 31/05/2024 1794 ;call delay1_4ms 1795 1796 00000A9F 6683E00F and ax, 0Fh 1797 00000AA3 3C0F cmp al, 0Fh 1798 00000AA5 7403 je short _ac97_codec_init_ok 1799 00000AA7 E2E2 loop _ac97_codec_rloop 1800 1801 init_ac97_codec_err1: 1802 ;stc ; cf = 1 ; 19/05/2024 1803 init_ac97_codec_err2: 1804 00000AA9 C3 retn 1805 1806 _ac97_codec_init_ok: 1807 00000AAA E8DA000000 call reset_ac97_controller 1808 1809 ; 31/05/2024 1810 ; 30/05/2024 1811 ; 19/05/2024 1812 ;call delay_100ms 1813 1814 ; 30/05/2024 1815 ;call delay1_4ms 1816 ;call delay1_4ms 1817 ;call delay1_4ms 1818 ;call delay1_4ms 1819 1820 ; 01/12/2024 1821 setup_ac97_codec: 1822 ; 12/11/2023 1823 00000AAF 66813D[18390000]80- cmp word [WAVE_SampleRate], 48000 1823 00000AB7 BB 1824 00000AB8 0F849C000000 je skip_rate 1825 1826 ; 31/05/2024 1827 ; 30/05/2024 1828 ; 29/05/2024 1829 ;cmp byte [VRA], 0 1830 ;jna short skip_rate 1831 1832 ; 11/11/2023 1833 00000ABE 668B15[9C390000] mov dx, [NAMBAR] 1834 00000AC5 6683C22A add dx, CODEC_EXT_AUDIO_CTRL_REG ; 2Ah 1835 ;in ax, dx 1836 ; 29/05/2024 1837 00000AC9 B402 mov ah, 2 ; read port, word 1838 00000ACB CD34 int 34h 1839 1840 ; 30/05/2024 1841 ; 19/05/2024 1842 00000ACD E82E020000 call delay1_4ms 1843 1844 ;and al, ~BIT1 ; Clear DRA 1845 ;;; 1846 ; 30/05/2024 1847 00000AD2 24FC and al, ~(BIT1+BIT0) ; Clear DRA+VRA 1848 ; 01/12/2024 (FASM) 1849 ;and al, NOT (BIT1+BIT0) ; 0FCh 1850 ;out dx, ax 1851 ; 31/05/2024 1852 00000AD4 53 push ebx 1853 00000AD5 89C3 mov ebx, eax 1854 00000AD7 668B15[9C390000] mov dx, [NAMBAR] 1855 00000ADE 6683C22A add dx, CODEC_EXT_AUDIO_CTRL_REG ; 2Ah 1856 00000AE2 B403 mov ah, 3 ; write port, word 1857 00000AE4 CD34 int 34h 1858 00000AE6 5B pop ebx 1859 1860 ; 31/05/2024 1861 00000AE7 E8B1010000 call check_vra 1862 1863 ; 31/05/2024 - temporary (interpolated sample rate test) 1864 ;mov byte [VRA], 0 1865 1866 ; 31/05/2024 1867 00000AEC 803D[FD380000]00 cmp byte [VRA], 0 1868 00000AF3 7665 jna short skip_rate 1869 1870 00000AF5 668B15[9C390000] mov dx, [NAMBAR] 1871 00000AFC 6683C22A add dx, CODEC_EXT_AUDIO_CTRL_REG ; 2Ah 1872 ;in ax, dx 1873 ; 31/05/2024 1874 00000B00 B402 mov ah, 2 ; read port, word 1875 00000B02 CD34 int 34h 1876 1877 ;and al, ~BIT1 ; Clear DRA 1878 ;;; 1879 1880 00000B04 0C01 or al, AC97_EA_VRA ; 1 ; 04/11/2023 1881 ;out dx, ax ; Enable variable rate audio 1882 ; 29/05/2024 1883 00000B06 53 push ebx 1884 00000B07 89C3 mov ebx, eax 1885 ; 1886 ; 30/05/2024 1887 00000B09 668B15[9C390000] mov dx, [NAMBAR] 1888 00000B10 6683C22A add dx, CODEC_EXT_AUDIO_CTRL_REG ; 2Ah 1889 ; 1890 00000B14 B403 mov ah, 3 ; write port, word 1891 00000B16 CD34 int 34h 1892 00000B18 5B pop ebx 1893 1894 ;mov cx, 10 1895 00000B19 B90A000000 mov ecx, 10 ; 30/05/2024 1896 check_vra_loop: 1897 ; 31/05/2024 1898 ;call delay_100ms 1899 ; 30/05/2024 1900 00000B1E E8DD010000 call delay1_4ms 1901 1902 ; 11/11/2023 1903 ;in ax, dx 1904 ; 29/05/2024 1905 00000B23 668B15[9C390000] mov dx, [NAMBAR] 1906 00000B2A 6683C22A add dx, CODEC_EXT_AUDIO_CTRL_REG ; 2Ah 1907 00000B2E B402 mov ah, 2 ; read port, word 1908 00000B30 CD34 int 34h 1909 1910 00000B32 A801 test al, AC97_EA_VRA ; 1 1911 00000B34 750B jnz short set_rate 1912 1913 ; 11/11/2023 1914 00000B36 E2E6 loop check_vra_loop 1915 1916 ;vra_not_supported: ; 19/05/2024 1917 00000B38 C605[FD380000]00 mov byte [VRA], 0 1918 00000B3F EB19 jmp short skip_rate 1919 1920 set_rate: 1921 ;mov ax, [sample_rate] ; 17/02/2017 (Erdogan Tan) 1922 ; 01/12/2024 1923 00000B41 66A1[18390000] mov ax, [WAVE_SampleRate] 1924 1925 00000B47 668B15[9C390000] mov dx, [NAMBAR] 1926 00000B4E 6683C22C add dx, CODEC_PCM_FRONT_DACRATE_REG ; 2Ch 1927 ;out dx, ax ; PCM Front/Center Output Sample Rate 1928 ; 29/05/2024 1929 00000B52 53 push ebx 1930 00000B53 89C3 mov ebx, eax ; bx = data, word 1931 00000B55 B403 mov ah, 3 ; write port, word 1932 00000B57 CD34 int 34h 1933 00000B59 5B pop ebx 1934 1935 ; 29/05/2024 1936 ;call delay_100ms 1937 ; 30/05/2024 1938 ;call delay1_4ms 1939 1940 ; 12/11/2023 1941 skip_rate: 1942 00000B5A 66B80202 mov ax, 0202h 1943 00000B5E 668B15[9C390000] mov dx, [NAMBAR] 1944 00000B65 6683C202 add dx, CODEC_MASTER_VOL_REG ;02h 1945 ;out dx, ax 1946 ; 29/05/2024 1947 00000B69 53 push ebx 1948 00000B6A 89C3 mov ebx, eax ; bx = data, word 1949 00000B6C B403 mov ah, 3 ; write port, word 1950 00000B6E CD34 int 34h 1951 00000B70 5B pop ebx 1952 1953 ; 29/05/2024 1954 ;call delay1_4ms 1955 ;call delay1_4ms 1956 ;call delay1_4ms 1957 ;call delay1_4ms 1958 1959 00000B71 66B80202 mov ax, 0202h 1960 00000B75 668B15[9C390000] mov dx, [NAMBAR] 1961 00000B7C 6683C218 add dx, CODEC_PCM_OUT_REG ;18h 1962 ;out dx, ax 1963 ; 29/05/2024 1964 00000B80 53 push ebx 1965 00000B81 89C3 mov ebx, eax ; bx = data, word 1966 00000B83 B403 mov ah, 3 ; write port, word 1967 00000B85 CD34 int 34h 1968 00000B87 5B pop ebx 1969 1970 ; 29/05/2024 1971 ;call delay1_4ms 1972 ;call delay1_4ms 1973 ;call delay1_4ms 1974 ;call delay1_4ms 1975 1976 ; 19/05/2024 1977 ;clc 1978 1979 00000B88 C3 retn 1980 1981 reset_ac97_controller: 1982 ; 29/05/2024 (TRDOS 386) 1983 ; 19/05/2024 1984 ; 11/11/2023 1985 ; 10/06/2017 1986 ; 29/05/2017 1987 ; 28/05/2017 1988 ; reset AC97 audio controller registers 1989 00000B89 31C0 xor eax, eax 1990 00000B8B 66BA0B00 mov dx, PI_CR_REG 1991 00000B8F 660315[9E390000] add dx, [NABMBAR] 1992 ;out dx, al 1993 ; 29/05/2024 1994 ; al = data, byte 1995 00000B96 B401 mov ah, 1 ; write port, byte 1996 00000B98 CD34 int 34h 1997 1998 ; 19/05/2024 1999 ;call delay1_4ms 2000 2001 00000B9A 66BA1B00 mov dx, PO_CR_REG 2002 00000B9E 660315[9E390000] add dx, [NABMBAR] 2003 ;out dx, al 2004 ; 29/05/2024 2005 ; al = data, byte 2006 00000BA5 B401 mov ah, 1 ; write port, byte 2007 00000BA7 CD34 int 34h 2008 2009 ; 19/05/2024 2010 ;call delay1_4ms 2011 2012 00000BA9 66BA2B00 mov dx, MC_CR_REG 2013 00000BAD 660315[9E390000] add dx, [NABMBAR] 2014 ;out dx, al 2015 ; 29/05/2024 2016 ; al = data, byte 2017 00000BB4 B401 mov ah, 1 ; write port, byte 2018 00000BB6 CD34 int 34h 2019 2020 ; 19/05/2024 2021 ;call delay1_4ms 2022 2023 00000BB8 B002 mov al, RR 2024 00000BBA 66BA0B00 mov dx, PI_CR_REG 2025 00000BBE 660315[9E390000] add dx, [NABMBAR] 2026 ;out dx, al 2027 ; 29/05/2024 2028 ; al = data, byte 2029 00000BC5 B401 mov ah, 1 ; write port, byte 2030 00000BC7 CD34 int 34h 2031 2032 ; 19/05/2024 2033 ;call delay1_4ms 2034 2035 00000BC9 66BA1B00 mov dx, PO_CR_REG 2036 00000BCD 660315[9E390000] add dx, [NABMBAR] 2037 ;out dx, al 2038 ; 29/05/2024 2039 ; al = data, byte 2040 00000BD4 B401 mov ah, 1 ; write port, byte 2041 00000BD6 CD34 int 34h 2042 2043 ; 19/05/2024 2044 ;call delay1_4ms 2045 2046 00000BD8 66BA2B00 mov dx, MC_CR_REG 2047 00000BDC 660315[9E390000] add dx, [NABMBAR] 2048 ;out dx, al 2049 ; 29/05/2024 2050 ; al = data, byte 2051 00000BE3 B401 mov ah, 1 ; write port, byte 2052 00000BE5 CD34 int 34h 2053 2054 ; 19/05/2024 2055 ;call delay1_4ms 2056 2057 00000BE7 C3 retn 2058 2059 reset_ac97_codec: 2060 ; 29/05/2024 (TRDOS 386) 2061 ; 11/11/2023 2062 ; 28/05/2017 - Erdogan Tan (Ref: KolibriOS, intelac97.asm) 2063 00000BE8 66BA2C00 mov dx, GLOB_CNT_REG ; 2Ch 2064 00000BEC 660315[9E390000] add dx, [NABMBAR] 2065 ;in eax, dx 2066 ; 29/05/2024 2067 00000BF3 B404 mov ah, 4 ; read port, dword 2068 00000BF5 CD34 int 34h 2069 2070 ;test eax, 2 2071 ; 06/08/2022 2072 00000BF7 A802 test al, 2 2073 00000BF9 7407 jz short _r_ac97codec_cold 2074 2075 00000BFB E80F000000 call warm_ac97codec_reset 2076 00000C00 7308 jnc short _r_ac97codec_ok 2077 _r_ac97codec_cold: 2078 00000C02 E845000000 call cold_ac97codec_reset 2079 00000C07 7301 jnc short _r_ac97codec_ok 2080 2081 ; 16/04/2017 2082 ;xor eax, eax ; timeout error 2083 ;stc 2084 00000C09 C3 retn 2085 2086 _r_ac97codec_ok: 2087 00000C0A 31C0 xor eax, eax 2088 ;mov al, VIA_ACLINK_C00_READY ; 1 2089 00000C0C FEC0 inc al 2090 00000C0E C3 retn 2091 2092 warm_ac97codec_reset: 2093 ; 29/05/2024 (TRDOS 386) 2094 ; 11/11/2023 2095 ; 06/08/2022 - TRDOS 386 v2.0.5 2096 ; 28/05/2017 - Erdogan Tan (Ref: KolibriOS, intelac97.asm) 2097 00000C0F B806000000 mov eax, 6 2098 00000C14 66BA2C00 mov dx, GLOB_CNT_REG ; 2Ch 2099 00000C18 660315[9E390000] add dx, [NABMBAR] 2100 ;out dx, eax 2101 ; 29/05/2024 2102 00000C1F 53 push ebx 2103 00000C20 89C3 mov ebx, eax ; ebx = data, dword 2104 00000C22 B405 mov ah, 5 ; write port, dword 2105 00000C24 CD34 int 34h 2106 00000C26 5B pop ebx 2107 2108 ; 30/05/2024 2109 00000C27 B90A000000 mov ecx, 10 ; total 1s 2110 ; 29/05/2024 2111 ;mov ecx, 4000 2112 _warm_ac97c_rst_wait: 2113 ; 30/05/2024 2114 00000C2C E8C0000000 call delay_100ms 2115 2116 00000C31 66BA3000 mov dx, GLOB_STS_REG ; 30h 2117 00000C35 660315[9E390000] add dx, [NABMBAR] 2118 ;in eax, dx 2119 ; 29/05/2024 2120 00000C3C B404 mov ah, 4 ; read port, dword 2121 00000C3E CD34 int 34h 2122 2123 00000C40 A900030010 test eax, CTRL_ST_CREADY 2124 00000C45 7504 jnz short _warm_ac97c_rst_ok 2125 2126 00000C47 49 dec ecx 2127 00000C48 75E2 jnz short _warm_ac97c_rst_wait 2128 2129 _warm_ac97c_rst_fail: 2130 00000C4A F9 stc 2131 _warm_ac97c_rst_ok: 2132 00000C4B C3 retn 2133 2134 cold_ac97codec_reset: 2135 ; 11/11/2023 2136 ; 06/08/2022 - TRDOS 386 v2.0.5 2137 ; 28/05/2017 - Erdogan Tan (Ref: KolibriOS, intelac97.asm) 2138 00000C4C B802000000 mov eax, 2 2139 00000C51 66BA2C00 mov dx, GLOB_CNT_REG ; 2Ch 2140 00000C55 660315[9E390000] add dx, [NABMBAR] 2141 ;out dx, eax 2142 ; 29/05/2024 2143 00000C5C 53 push ebx 2144 00000C5D 89C3 mov ebx, eax ; ebx = data, dword 2145 00000C5F B405 mov ah, 5 ; write port, dword 2146 00000C61 CD34 int 34h 2147 00000C63 5B pop ebx 2148 2149 ; 30/05/2024 2150 00000C64 E888000000 call delay_100ms ; wait 100 ms 2151 00000C69 E883000000 call delay_100ms ; wait 100 ms 2152 00000C6E E87E000000 call delay_100ms ; wait 100 ms 2153 00000C73 E879000000 call delay_100ms ; wait 100 ms 2154 2155 ; 30/05/2024 2156 00000C78 B910000000 mov ecx, 16 ; total 20*100 ms = 2s 2157 ; 29/05/2024 2158 ;mov ecx, 16000 2159 _cold_ac97c_rst_wait: 2160 00000C7D 66BA3000 mov dx, GLOB_STS_REG ; 30h 2161 00000C81 660315[9E390000] add dx, [NABMBAR] 2162 ;in eax, dx 2163 ; 29/05/2024 2164 00000C88 B404 mov ah, 4 ; read port, dword 2165 00000C8A CD34 int 34h 2166 2167 00000C8C A900030010 test eax, CTRL_ST_CREADY 2168 00000C91 7509 jnz short _cold_ac97c_rst_ok 2169 2170 ; 30/05/2024 2171 ; 29/05/2024 2172 00000C93 E859000000 call delay_100ms 2173 2174 00000C98 49 dec ecx 2175 00000C99 75E2 jnz short _cold_ac97c_rst_wait 2176 2177 _cold_ac97c_rst_fail: 2178 00000C9B F9 stc 2179 _cold_ac97c_rst_ok: 2180 00000C9C C3 retn 2181 2182 ; 29/12/2024 (vgaplay3.s, NASM) 2183 ; 18/12/2024 (ac97play.s, FASM) 2184 ; 13/11/2024 2185 ; 30/05/2024 2186 %if 1 2187 ;if 1 2188 check_vra: 2189 ; 29/05/2024 2190 00000C9D C605[FD380000]01 mov byte [VRA], 1 2191 2192 ; 29/05/2024 - audio.s (TRDOS 386 Kernel) - 27/05/2024 2193 ; 24/05/2024 2194 ; 23/05/2024 2195 00000CA4 668B15[9C390000] mov dx, [NAMBAR] 2196 00000CAB 6683C228 add dx, CODEC_EXT_AUDIO_REG ; 28h 2197 ;in ax, dx 2198 ; 29/05/2024 2199 00000CAF B402 mov ah, 2 ; read port, word 2200 00000CB1 CD34 int 34h 2201 2202 ; 30/05/2024 2203 ; 23/05/2024 2204 00000CB3 E848000000 call delay1_4ms 2205 2206 ; 29/05/2024 2207 00000CB8 A801 test al, BIT0 2208 ;test al, 1 ; BIT0 ; Variable Rate Audio bit 2209 00000CBA 7507 jnz short check_vra_ok 2210 2211 vra_not_supported: 2212 ; 13/11/2023 2213 00000CBC C605[FD380000]00 mov byte [VRA], 0 2214 check_vra_ok: 2215 00000CC3 C3 retn 2216 ;end if 2217 %endif 2218 2219 ; -------------------------------------------------------- 2220 ; -------------------------------------------------------- 2221 2222 ; 29/12/2024 (vgaplay3.s) 2223 ; 18/12/2024 (ac97play.s) 2224 ; 2225 ; 18/11/2024 2226 ; Ref: TRDOS 386 v2.0.9, audio.s, Erdogan Tan, 06/06/2024 2227 2228 ac97_stop: 2229 ; 18/11/2024 2230 00000CC4 C605[F0380000]02 mov byte [stopped], 2 2231 2232 ac97_po_cmd@: 2233 00000CCB 30C0 xor al, al ; 0 2234 ac97_po_cmd: 2235 00000CCD 668B15[9E390000] mov dx, [NABMBAR] 2236 00000CD4 6683C21B add dx, PO_CR_REG ; PCM out control register 2237 ;out dx, al 2238 ; 01/12/2024 2239 00000CD8 B401 mov ah, 1 ; write port, byte 2240 00000CDA CD34 int 34h 2241 00000CDC C3 retn 2242 2243 ac97_pause: 2244 00000CDD C605[F0380000]01 mov byte [stopped], 1 ; paused 2245 ;mov al, 0 2246 ;jmp short ac97_po_cmd 2247 00000CE4 EBE5 jmp short ac97_po_cmd@ 2248 2249 ac97_play: ; continue to play (after pause) 2250 00000CE6 C605[F0380000]00 mov byte [stopped], 0 2251 00000CED B001 mov al, RPBM 2252 00000CEF EBDC jmp short ac97_po_cmd 2253 2254 ; -------------------------------------------------------- 2255 2256 PORTB EQU 061h 2257 REFRESH_STATUS EQU 010h ; Refresh signal status 2258 2259 ; 29/12/2024 (vgaplay3.s) 2260 ; 18/12/2024 2261 ; 01/12/2024 (ac97play.s) 2262 delay_100ms: 2263 ; 30/05/2024 (playwav7.s) 2264 00000CF1 51 push ecx 2265 00000CF2 B990010000 mov ecx, 400 ; 400*0.25ms 2266 _delay_x_ms: 2267 00000CF7 E804000000 call delay1_4ms 2268 00000CFC E2F9 loop _delay_x_ms 2269 00000CFE 59 pop ecx 2270 00000CFF C3 retn 2271 2272 delay1_4ms: 2273 ; 30/05/2024 (TRDOS 386) 2274 00000D00 50 push eax 2275 00000D01 51 push ecx 2276 00000D02 53 push ebx 2277 00000D03 52 push edx 2278 00000D04 B910000000 mov ecx, 16 ; close enough. 2279 ;in al, PORTB 2280 ; 30/05/2024 2281 00000D09 66BA6100 mov dx, PORTB 2282 00000D0D B400 mov ah, 0 ; read port, byte 2283 00000D0F CD34 int 34h 2284 2285 00000D11 2410 and al, REFRESH_STATUS 2286 ;mov ah, al ; Start toggle state 2287 00000D13 88C3 mov bl, al 2288 00000D15 09C9 or ecx, ecx 2289 00000D17 7401 jz short _d4ms1 2290 00000D19 41 inc ecx ; Throwaway first toggle 2291 _d4ms1: 2292 ;in al, PORTB ; Read system control port 2293 ; 30/05/2024 2294 00000D1A 66BA6100 mov dx, PORTB 2295 00000D1E B400 mov ah, 0 ; read port, byte 2296 00000D20 CD34 int 34h 2297 2298 00000D22 2410 and al, REFRESH_STATUS ; Refresh toggles 15.085 microseconds 2299 ;cmp ah, al 2300 00000D24 38C3 cmp bl, al 2301 00000D26 74F2 je short _d4ms1 ; Wait for state change 2302 2303 ;mov ah, al ; Update with new state 2304 00000D28 88C3 mov bl, al 2305 00000D2A 49 dec ecx 2306 00000D2B 75ED jnz short _d4ms1 2307 2308 00000D2D 5A pop edx 2309 00000D2E 5B pop ebx 2310 00000D2F 59 pop ecx 2311 00000D30 58 pop eax 2312 c4ue_okk: 2313 00000D31 C3 retn 2314 2315 ; -------------------------------------------------------- 2316 2317 getCurrentIndex: 2318 ; returns AL = current index value 2319 ; 01/12/2024 2320 ; 29/05/2024 (TRDOS 386) 2321 ; 08/11/2023 2322 00000D32 668B15[9E390000] mov dx, [NABMBAR] 2323 00000D39 6683C214 add dx, PO_CIV_REG 2324 ;in al, dx 2325 ; 29/05/2024 2326 00000D3D B400 mov ah, 0 ; read port, byte 2327 00000D3F CD34 int 34h 2328 uLVI2: ; 06/11/2023 2329 00000D41 C3 retn 2330 2331 ; -------------------------------------------------------- 2332 2333 updateLVI: 2334 ; 01/12/2024 2335 ; 29/05/2024 (TRDOS 386) 2336 ; 08/11/2023 2337 ; 07/11/2023 2338 ; 06/11/2023 2339 00000D42 668B15[9E390000] mov dx, [NABMBAR] 2340 00000D49 6683C214 add dx, PO_CIV_REG 2341 ; (Current Index Value and Last Valid Index value) 2342 ;in ax, dx 2343 ; 29/05/2024 2344 00000D4D B402 mov ah, 2 ; read port, word 2345 00000D4F CD34 int 34h 2346 2347 00000D51 38E0 cmp al, ah ; is current index = last index ? 2348 00000D53 75EC jne short uLVI2 2349 2350 ; 08/11/2023 2351 00000D55 E8D8FFFFFF call getCurrentIndex 2352 2353 00000D5A F605[2E390000]01 test byte [flags], ENDOFFILE 2354 ;jnz short uLVI1 2355 00000D61 7418 jz short uLVI0 ; 08/11/2023 2356 2357 ; 08/11/2023 2358 00000D63 50 push eax ; 29/05/2024 (32 bit) 2359 00000D64 668B15[9E390000] mov dx, [NABMBAR] 2360 00000D6B 6683C216 add dx, PO_SR_REG ; PCM out status register 2361 ;in ax, dx 2362 ; 29/05/2024 2363 00000D6F B402 mov ah, 2 ; read port, word 2364 00000D71 CD34 int 34h 2365 2366 00000D73 A803 test al, 3 ; bit 1 = Current Equals Last Valid (CELV) 2367 ; (has been processed) 2368 ; bit 0 = 1 -> DMA Controller Halted (DCH) 2369 00000D75 58 pop eax 2370 00000D76 7407 jz short uLVI1 2371 uLVI3: 2372 00000D78 31C0 xor eax, eax 2373 ; zf = 1 2374 00000D7A C3 retn 2375 uLVI0: 2376 ; not at the end of the file yet. 2377 00000D7B FEC8 dec al 2378 00000D7D 241F and al, 1Fh 2379 uLVI1: 2380 ;call setLastValidIndex 2381 ;uLVI2: 2382 ;retn 2383 2384 ;input AL = index # to stop on 2385 setLastValidIndex: 2386 ; 01/12/2024 2387 ; 29/05/2024 (TRDOS 386) 2388 ; 08/11/2023 2389 00000D7F 668B15[9E390000] mov dx, [NABMBAR] 2390 00000D86 6683C215 add dx, PO_LVI_REG 2391 ;out dx, al 2392 ; 29/05/2024 2393 ; al = data, byte 2394 00000D8A B401 mov ah, 1 ; write port, byte 2395 00000D8C CD34 int 34h 2396 00000D8E C3 retn 2397 2398 ; -------------------------------------------------------- 2399 ; 07/12/2024 2400 ; -------------------------------------------------------- 2401 2402 ; ///// 2403 ; 14/12/2024 2404 ; 07/12/2024 2405 ; 01/12/2024 2406 ; 30/05/2024 (ich_wav4.asm, 19/05/2024) 2407 loadFromFile: 2408 ; 07/11/2023 2409 2410 00000D8F F605[2E390000]01 test byte [flags], ENDOFFILE ; have we already read the 2411 ; last of the file? 2412 00000D96 7402 jz short lff_0 ; no 2413 00000D98 F9 stc 2414 00000D99 C3 retn 2415 2416 lff_0: 2417 ; 07/12/2024 2418 ; 26/11/2023 (playwav8.s) 2419 ;mov edi, audio_buffer 2420 2421 ; 01/12/2024 (TRDOS 386) 2422 ; edi = audio buffer address 2423 2424 ; 14/12/2024 2425 ; 01/12/2024 2426 ; 17/11/2024 2427 ;mov ebx, [filehandle] 2428 ; 02/12/2024 2429 ;mov edx, [loadsize] 2430 2431 ; 17/11/2024 2432 00000D9A 803D[92390000]00 cmp byte [fbs_shift], 0 2433 00000DA1 7677 jna short lff_1 ; stereo, 16 bit 2434 2435 lff_2: 2436 ; 01/12/2024 2437 00000DA3 BE[00500200] mov esi, temp_buffer 2438 ; 14/12/2024 2439 sys _read, [filehandle], esi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 00000DA8 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 00000DAE 89F1 <1> mov ecx, %3 98 <1> %if %0 = 4 99 00000DB0 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 00000DB6 B803000000 <1> mov eax, %1 104 <1> 105 00000DBB CD40 <1> int 40h 2440 00000DBD 0F8289000000 jc lff_4 ; error ! 2441 2442 ; 01/12/2024 2443 ; 14/11/2024 2444 00000DC3 A3[B4390000] mov [count], eax 2445 2446 ; 01/12/2024 2447 00000DC8 21C0 and eax, eax 2448 ;jz short lff_3 2449 ; 14/12/2024 2450 00000DCA 0F8485000000 jz lff_10 2451 2452 00000DD0 8A1D[92390000] mov bl, [fbs_shift] 2453 2454 ; 14/12/2024 2455 00000DD6 89FA mov edx, edi ; audio buffer start address 2456 2457 ; 01/12/2024 2458 00000DD8 89C1 mov ecx, eax 2459 00000DDA 803D[22390000]08 cmp byte [WAVE_BitsPerSample], 8 ; bits per sample (8 or 16) 2460 00000DE1 751E jne short lff_7 ; 16 bit samples 2461 ; 8 bit samples 2462 00000DE3 FECB dec bl ; shift count, 1 = stereo, 2 = mono 2463 00000DE5 740E jz short lff_6 ; 8 bit, stereo 2464 ; 01/12/2024 (32bit registers) 2465 lff_5: 2466 ; mono & 8 bit 2467 00000DE7 AC lodsb 2468 00000DE8 2C80 sub al, 80h ; 08/11/2023 2469 00000DEA C1E008 shl eax, 8 ; convert 8 bit sample to 16 bit sample 2470 00000DED 66AB stosw ; left channel 2471 00000DEF 66AB stosw ; right channel 2472 00000DF1 E2F4 loop lff_5 2473 00000DF3 EB16 jmp short lff_9 2474 lff_6: 2475 ; stereo & 8 bit 2476 00000DF5 AC lodsb 2477 00000DF6 2C80 sub al, 80h ; 08/11/2023 2478 00000DF8 C1E008 shl eax, 8 ; convert 8 bit sample to 16 bit sample 2479 00000DFB 66AB stosw 2480 00000DFD E2F6 loop lff_6 2481 00000DFF EB0A jmp short lff_9 2482 lff_7: 2483 00000E01 D1E9 shr ecx, 1 ; word count 2484 lff_8: 2485 00000E03 66AD lodsw 2486 00000E05 66AB stosw ; left channel 2487 00000E07 66AB stosw ; right channel 2488 00000E09 E2F8 loop lff_8 2489 lff_9: 2490 ; 14/12/2024 2491 00000E0B 89F8 mov eax, edi 2492 00000E0D 8B0D[A8390000] mov ecx, [buffersize] 2493 00000E13 01D1 add ecx, edx ; + buffer start address 2494 00000E15 39C8 cmp eax, ecx 2495 00000E17 7225 jb short lff_3 2496 00000E19 C3 retn 2497 2498 lff_1: 2499 ; 07/12/2024 2500 ; 01/12/2024 2501 ;sys _read, [filehandle], esi, [loadsize] ; edx 2502 ; 14/12/2024 2503 sys _read, [filehandle], edi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 00000E1A 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 00000E20 89F9 <1> mov ecx, %3 98 <1> %if %0 = 4 99 00000E22 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 00000E28 B803000000 <1> mov eax, %1 104 <1> 105 00000E2D CD40 <1> int 40h 2504 ; 07/11/2023 2505 00000E2F 721B jc short lff_4 ; error ! 2506 2507 ; 01/12/2024 2508 ; 14/11/2024 2509 00000E31 A3[B4390000] mov [count], eax 2510 2511 ; 02/12/2024 2512 00000E36 39D0 cmp eax, edx ; cmp eax, [loadsize] 2513 00000E38 7411 je short endLFF 2514 ; edi = buffer (start) address 2515 00000E3A 01C7 add edi, eax 2516 00000E3C 89D1 mov ecx, edx 2517 lff_3: 2518 ;call padfill ; blank pad the remainder 2519 ; 21/12/2024 2520 padfill: 2521 ; 14/12/2024 2522 ; 01/12/2024 (TRDOS 386, 32bit registers) 2523 ; 17/11/2024 2524 ; di = offset (to be filled with ZEROs) 2525 ; bp = buffer segment 2526 ; ax = di = number of bytes loaded 2527 ; cx = buffer size (> loaded bytes) 2528 ; 07/11/2023 2529 ; 06/11/2023 2530 ; 17/02/2017 2531 ; 01/12/2024 2532 00000E3E 29C1 sub ecx, eax 2533 ; 01/12/2024 2534 ; 25/11/2024 2535 00000E40 31C0 xor eax, eax 2536 ; 14/12/2024 2537 00000E42 F3AA rep stosb 2538 ; 21/12/2024 2539 ;retn 2540 ; ---------- 2541 ;clc ; don't exit with CY yet. 2542 00000E44 800D[2E390000]01 or byte [flags], ENDOFFILE ; end of file flag 2543 endLFF: 2544 00000E4B C3 retn 2545 lff_4: 2546 ; 08/11/2023 2547 00000E4C B021 mov al, '!' ; error 2548 00000E4E E876F9FFFF call tL0 2549 2550 ; 01/12/2024 2551 00000E53 31C0 xor eax, eax 2552 lff_10: 2553 ; 14/12/2024 2554 00000E55 8B0D[A8390000] mov ecx, [buffersize] 2555 00000E5B EBE1 jmp short lff_3 2556 2557 ; ///// 2558 2559 ; -------------------------------------------------------- 2560 ; -------------------------------------------------------- 2561 2562 write_audio_dev_info: 2563 ; 30/05/2024 2564 ;sys_msg msgAudioCardInfo, 0Fh 2565 ; 01/12/2024 2566 sys _msg, msgAudioCardInfo, 255, 0Fh 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 00000E5D BB[EF2D0000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 00000E62 B9FF000000 <1> mov ecx, %3 98 <1> %if %0 = 4 99 00000E67 BA0F000000 <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 00000E6C B823000000 <1> mov eax, %1 104 <1> 105 00000E71 CD40 <1> int 40h 2567 00000E73 C3 retn 2568 2569 ; -------------------------------------------------------- 2570 2571 write_ac97_pci_dev_info: 2572 ; 19/11/2024 2573 ; 30/05/2024 2574 ; 06/06/2017 2575 ; 03/06/2017 2576 ; BUS/DEV/FN 2577 ; 00000000BBBBBBBBDDDDDFFF00000000 2578 ; DEV/VENDOR 2579 ; DDDDDDDDDDDDDDDDVVVVVVVVVVVVVVVV 2580 2581 00000E74 A1[98390000] mov eax, [dev_vendor] 2582 00000E79 31DB xor ebx, ebx 2583 00000E7B 88C3 mov bl, al 2584 00000E7D 88DA mov dl, bl 2585 00000E7F 80E30F and bl, 0Fh 2586 00000E82 8A83[152F0000] mov al, [hex_chars+ebx] 2587 00000E88 A2[5C2F0000] mov [msgVendorId+3], al 2588 00000E8D 88D3 mov bl, dl 2589 00000E8F C0EB04 shr bl, 4 2590 00000E92 8A83[152F0000] mov al, [hex_chars+ebx] 2591 00000E98 A2[5B2F0000] mov [msgVendorId+2], al 2592 00000E9D 88E3 mov bl, ah 2593 00000E9F 88DA mov dl, bl 2594 00000EA1 80E30F and bl, 0Fh 2595 00000EA4 8A83[152F0000] mov al, [hex_chars+ebx] 2596 00000EAA A2[5A2F0000] mov [msgVendorId+1], al 2597 00000EAF 88D3 mov bl, dl 2598 00000EB1 C0EB04 shr bl, 4 2599 00000EB4 8A83[152F0000] mov al, [hex_chars+ebx] 2600 00000EBA A2[592F0000] mov [msgVendorId], al 2601 00000EBF C1E810 shr eax, 16 2602 00000EC2 88C3 mov bl, al 2603 00000EC4 88DA mov dl, bl 2604 00000EC6 80E30F and bl, 0Fh 2605 00000EC9 8A83[152F0000] mov al, [hex_chars+ebx] 2606 00000ECF A2[6D2F0000] mov [msgDevId+3], al 2607 00000ED4 88D3 mov bl, dl 2608 00000ED6 C0EB04 shr bl, 4 2609 00000ED9 8A83[152F0000] mov al, [hex_chars+ebx] 2610 00000EDF A2[6C2F0000] mov [msgDevId+2], al 2611 00000EE4 88E3 mov bl, ah 2612 00000EE6 88DA mov dl, bl 2613 00000EE8 80E30F and bl, 0Fh 2614 00000EEB 8A83[152F0000] mov al, [hex_chars+ebx] 2615 00000EF1 A2[6B2F0000] mov [msgDevId+1], al 2616 00000EF6 88D3 mov bl, dl 2617 00000EF8 C0EB04 shr bl, 4 2618 00000EFB 8A83[152F0000] mov al, [hex_chars+ebx] 2619 00000F01 A2[6A2F0000] mov [msgDevId], al 2620 2621 00000F06 A1[94390000] mov eax, [bus_dev_fn] 2622 00000F0B C1E808 shr eax, 8 2623 00000F0E 88C3 mov bl, al 2624 00000F10 88DA mov dl, bl 2625 00000F12 80E307 and bl, 7 ; bit 0,1,2 2626 00000F15 8A83[152F0000] mov al, [hex_chars+ebx] 2627 00000F1B A2[922F0000] mov [msgFncNo+1], al 2628 00000F20 88D3 mov bl, dl 2629 00000F22 C0EB03 shr bl, 3 2630 00000F25 88DA mov dl, bl 2631 00000F27 80E30F and bl, 0Fh 2632 00000F2A 8A83[152F0000] mov al, [hex_chars+ebx] 2633 00000F30 A2[842F0000] mov [msgDevNo+1], al 2634 00000F35 88D3 mov bl, dl 2635 00000F37 C0EB04 shr bl, 4 2636 00000F3A 8A83[152F0000] mov al, [hex_chars+ebx] 2637 00000F40 A2[832F0000] mov [msgDevNo], al 2638 00000F45 88E3 mov bl, ah 2639 00000F47 88DA mov dl, bl 2640 00000F49 80E30F and bl, 0Fh 2641 00000F4C 8A83[152F0000] mov al, [hex_chars+ebx] 2642 00000F52 A2[782F0000] mov [msgBusNo+1], al 2643 00000F57 88D3 mov bl, dl 2644 00000F59 C0EB04 shr bl, 4 2645 00000F5C 8A83[152F0000] mov al, [hex_chars+ebx] 2646 00000F62 A2[772F0000] mov [msgBusNo], al 2647 2648 ;mov ax, [ac97_NamBar] 2649 00000F67 66A1[9C390000] mov ax, [NAMBAR] 2650 00000F6D 88C3 mov bl, al 2651 00000F6F 88DA mov dl, bl 2652 00000F71 80E30F and bl, 0Fh 2653 00000F74 8A83[152F0000] mov al, [hex_chars+ebx] 2654 00000F7A A2[A22F0000] mov [msgNamBar+3], al 2655 00000F7F 88D3 mov bl, dl 2656 00000F81 C0EB04 shr bl, 4 2657 00000F84 8A83[152F0000] mov al, [hex_chars+ebx] 2658 00000F8A A2[A12F0000] mov [msgNamBar+2], al 2659 00000F8F 88E3 mov bl, ah 2660 00000F91 88DA mov dl, bl 2661 00000F93 80E30F and bl, 0Fh 2662 00000F96 8A83[152F0000] mov al, [hex_chars+ebx] 2663 00000F9C A2[A02F0000] mov [msgNamBar+1], al 2664 00000FA1 88D3 mov bl, dl 2665 00000FA3 C0EB04 shr bl, 4 2666 00000FA6 8A83[152F0000] mov al, [hex_chars+ebx] 2667 00000FAC A2[9F2F0000] mov [msgNamBar], al 2668 2669 ;mov ax, [ac97_NabmBar] 2670 00000FB1 66A1[9E390000] mov ax, [NABMBAR] 2671 00000FB7 88C3 mov bl, al 2672 00000FB9 88DA mov dl, bl 2673 00000FBB 80E30F and bl, 0Fh 2674 00000FBE 8A83[152F0000] mov al, [hex_chars+ebx] 2675 00000FC4 A2[B22F0000] mov [msgNabmBar+3], al 2676 00000FC9 88D3 mov bl, dl 2677 00000FCB C0EB04 shr bl, 4 2678 00000FCE 8A83[152F0000] mov al, [hex_chars+ebx] 2679 00000FD4 A2[B12F0000] mov [msgNabmBar+2], al 2680 00000FD9 88E3 mov bl, ah 2681 00000FDB 88DA mov dl, bl 2682 00000FDD 80E30F and bl, 0Fh 2683 00000FE0 8A83[152F0000] mov al, [hex_chars+ebx] 2684 00000FE6 A2[B02F0000] mov [msgNabmBar+1], al 2685 00000FEB 88D3 mov bl, dl 2686 00000FED C0EB04 shr bl, 4 2687 00000FF0 8A83[152F0000] mov al, [hex_chars+ebx] 2688 00000FF6 A2[AF2F0000] mov [msgNabmBar], al 2689 2690 00000FFB 31C0 xor eax, eax 2691 00000FFD A0[2F390000] mov al, [ac97_int_ln_reg] 2692 00001002 B10A mov cl, 10 2693 00001004 F6F1 div cl 2694 ; 23/11/2024 2695 ;add [msgIRQ], ax 2696 00001006 66053030 add ax, 3030h 2697 0000100A 66A3[BB2F0000] mov [msgIRQ], ax 2698 ;and al, al 2699 00001010 3C30 cmp al, 30h 2700 00001012 750D jnz short _w_ac97imsg_ 2701 00001014 A0[BC2F0000] mov al, byte [msgIRQ+1] 2702 00001019 B420 mov ah, ' ' 2703 0000101B 66A3[BB2F0000] mov [msgIRQ], ax 2704 _w_ac97imsg_: 2705 ; 19/11/2024 2706 00001021 E8111D0000 call clear_window 2707 ;mov dh, 13 2708 ; 30/12/2024 (video mode 13h) 2709 00001026 B60B mov dh, 11 2710 00001028 B200 mov dl, 0 2711 0000102A E82D1A0000 call setCursorPosition 2712 ;;; 2713 ; 21/12/2024 2714 0000102F BD[262F0000] mov ebp, msgAC97Info ; message 2715 ; 22/12/2024 2716 ;mov cl, 07h ; color 2717 00001034 E81F000000 call sys_gmsg 2718 ; 2719 ; 30/05/2024 2720 write_VRA_info: 2721 ; 21/12/2024 2722 00001039 BD[C02F0000] mov ebp, msgVRAheader ; message 2723 ;mov cl, 07h ; color 2724 0000103E E815000000 call sys_gmsg 2725 ; 2726 00001043 803D[FD380000]00 cmp byte [VRA], 0 2727 0000104A 7607 jna short _w_VRAi_no 2728 _w_VRAi_yes: 2729 0000104C BD[CF2F0000] mov ebp, msgVRAyes 2730 00001051 EB05 jmp short _w_VRAi_yn_msg 2731 _w_VRAi_no: 2732 00001053 BD[D52F0000] mov ebp, msgVRAno 2733 _w_VRAi_yn_msg: 2734 ;mov cl, 07h ; color 2735 ;call sys_msg 2736 ;retn 2737 ;jmp short sys_gmsg 2738 ;;; 2739 ; -------------------------------------------------------- 2740 2741 ; 30/12/2024 (Video Mode 13h) 2742 ; (write message in VGA/CGA mode) 2743 ; 22/12/2024 2744 ; 21/12/2024 2745 ; (write message in VGA/VESA-VBE mode) 2746 sys_gmsg: 2747 00001058 8A4500 mov al, [ebp] 2748 0000105B 20C0 and al, al 2749 0000105D 7458 jz short sys_gmsg_ok 2750 0000105F 3C20 cmp al, 20h 2751 00001061 731E jnb short sys_gmsg_3 2752 00001063 3C0D cmp al, CR ; 13 2753 00001065 750C jne short sys_gmsg_2 2754 ; carriege return, move cursor to column 0 2755 00001067 66C705[E0330000]00- mov word [screenpos], 0 2755 0000106F 00 2756 sys_gmsg_1: 2757 00001070 45 inc ebp 2758 00001071 EBE5 jmp short sys_gmsg 2759 sys_gmsg_2: 2760 00001073 3C0A cmp al, LF ; 10 2761 00001075 7540 jne short sys_gmsg_ok ; 22/12/2024 2762 ; line feed, move cursor to next row 2763 ;add word [screenpos+2], 16 2764 ; 30/12/2024 2765 00001077 668305[E2330000]08 add word [screenpos+2], 8 2766 0000107F EBEF jmp short sys_gmsg_1 2767 sys_gmsg_3: 2768 00001081 8B35[E0330000] mov esi, [screenpos] 2769 ; hw = (cursor) row 2770 ; si = (cursor) column 2771 00001087 B907000000 mov ecx, 07h ; gray (light) 2772 0000108C E8851B0000 call write_character 2773 00001091 83C608 add esi, 8 2774 ;;; 2775 ;cmp si, 640 2776 ; 30/12/2024 (cgaplay.s) 2777 00001094 6681FE4001 cmp si, 320 2778 00001099 7213 jb short sys_gmsg_5 2779 0000109B C1EE10 shr esi, 16 2780 ;add si, 16 2781 ;cmp si, 480 2782 ; 30/12/2024 2783 0000109E 6683C608 add si, 8 2784 000010A2 6681FEC800 cmp si, 200 2785 000010A7 7202 jb short sys_gmsg_4 2786 000010A9 31F6 xor esi, esi 2787 sys_gmsg_4: 2788 000010AB C1E610 shl esi, 16 2789 ;;; 2790 sys_gmsg_5: 2791 000010AE 8935[E0330000] mov [screenpos], esi 2792 000010B4 45 inc ebp 2793 000010B5 EBA1 jmp short sys_gmsg 2794 sys_gmsg_ok: 2795 000010B7 C3 retn 2796 ;;; 2797 2798 ; -------------------------------------------------------- 2799 2800 ; 05/02/2025 - cgaplay.s 2801 ; 02/02/2025 - playwav9.s - ac97play.s - dplaywav.s - dplayw2.s 2802 ; 29/12/2024 - vgaplay3.s 2803 ; 18/12/2024 2804 ; 01/12/2024 - ac97play.s 2805 ; 29/05/2024 2806 ; 26/11/2023 2807 ; 25/11/2023 - playwav6.s (32 bit registers, TRDOS 386 adaption) 2808 ; 15/11/2023 - PLAYWAV5.COM, ich_wav5.asm 2809 ; 14/11/2023 2810 ; 13/11/2023 - Erdogan Tan - (VRA, sample rate conversion) 2811 ; -------------------------------------------------------- 2812 2813 ;;Note: At the end of every buffer load, 2814 ;; during buffer switch/swap, there will be discontinuity 2815 ;; between the last converted sample and the 1st sample 2816 ;; of the next buffer. 2817 ;; (like as a dot noises vaguely between normal sound samples) 2818 ;; -To avoid this defect, the 1st sample of 2819 ;; the next buffer may be read from the wav file but 2820 ;; the file pointer would need to be set to 1 sample back 2821 ;; again via seek system call. Time comsumption problem! - 2822 ;; 2823 ;; Erdogan Tan - 15/11/2023 2824 ;; 2825 ;; ((If entire wav data would be loaded at once.. conversion 2826 ;; defect/noise would disappear.. but for DOS, to keep 2827 ;; 64KB buffer limit is important also it is important 2828 ;; for running under 1MB barrier without HIMEM.SYS or DPMI. 2829 ;; I have tested this program by using 2-30MB wav files.)) 2830 ;; 2831 ;; Test Computer: ASUS desktop/mainboard, M2N4-SLI, 2010. 2832 ;; AMD Athlon 64 X2 2200 MHZ CPU. 2833 ;; NFORCE4 (CK804) AC97 audio hardware. 2834 ;; Realtek ALC850 codec. 2835 ;; Retro DOS v4.2 (MSDOS 6.22) operating system. 2836 2837 load_8khz_mono_8_bit: 2838 ; 02/02/2025 2839 ; 15/11/2023 2840 ; 14/11/2023 2841 ; 13/11/2023 2842 000010B8 F605[2E390000]01 test byte [flags], ENDOFFILE ; have we already read the 2843 ; last of the file? 2844 000010BF 7402 jz short lff8m_0 ; no 2845 000010C1 F9 stc 2846 000010C2 C3 retn 2847 2848 lff8m_0: 2849 ; 01/12/2024 2850 ; edi = audio buffer address 2851 000010C3 BE[00500200] mov esi, temp_buffer ; temporary buffer for wav data 2852 ;mov edx, [loadsize] 2853 2854 ; esi = buffer address 2855 ;; edx = buffer size 2856 2857 ; load file into memory 2858 sys _read, [filehandle], esi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 000010C8 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 000010CE 89F1 <1> mov ecx, %3 98 <1> %if %0 = 4 99 000010D0 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 000010D6 B803000000 <1> mov eax, %1 104 <1> 105 000010DB CD40 <1> int 40h 2859 000010DD 7305 jnc short lff8m_6 2860 000010DF E9AF000000 jmp lff8m_5 ; error ! 2861 2862 lff8m_6: 2863 ; 01/12/2024 2864 000010E4 A3[B4390000] mov [count], eax 2865 ;;; 2866 ; 29/05/2024 2867 ;mov edi, [audio_buffer] 2868 ;;; 2869 000010E9 21C0 and eax, eax 2870 000010EB 0F8499000000 jz lff8_eof 2871 2872 000010F1 89C1 mov ecx, eax ; byte count 2873 lff8m_1: 2874 000010F3 AC lodsb 2875 000010F4 A2[31280000] mov [previous_val], al 2876 000010F9 2C80 sub al, 80h 2877 000010FB 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 2878 000010FF 66AB stosw ; original sample (left channel) 2879 00001101 66AB stosw ; original sample (right channel) 2880 ; 02/02/2025 2881 ;xor eax, eax 2882 00001103 8A06 mov al, [esi] 2883 00001105 49 dec ecx 2884 00001106 7502 jnz short lff8m_2 2885 00001108 B080 mov al, 80h 2886 lff8m_2: 2887 ;mov [next_val], ax 2888 0000110A 88C7 mov bh, al ; [next_val] 2889 0000110C 8A25[31280000] mov ah, [previous_val] 2890 00001112 00E0 add al, ah ; [previous_val] 2891 00001114 D0D8 rcr al, 1 2892 00001116 88C2 mov dl, al ; this is interpolated middle (3th) sample 2893 00001118 00E0 add al, ah ; [previous_val] 2894 0000111A D0D8 rcr al, 1 2895 0000111C 88C3 mov bl, al ; this is temporary interpolation value 2896 0000111E 00E0 add al, ah ; [previous_val] 2897 00001120 D0D8 rcr al, 1 2898 00001122 2C80 sub al, 80h 2899 00001124 66C1E008 shl ax, 8 2900 00001128 66AB stosw ; this is 1st interpolated sample (L) 2901 0000112A 66AB stosw ; this is 1st interpolated sample (R) 2902 0000112C 88D8 mov al, bl 2903 0000112E 00D0 add al, dl 2904 00001130 D0D8 rcr al, 1 2905 00001132 2C80 sub al, 80h 2906 00001134 66C1E008 shl ax, 8 2907 00001138 66AB stosw ; this is 2nd interpolated sample (L) 2908 0000113A 66AB stosw ; this is 2nd interpolated sample (R) 2909 0000113C 88D0 mov al, dl 2910 0000113E 2C80 sub al, 80h 2911 00001140 66C1E008 shl ax, 8 2912 00001144 66AB stosw ; this is middle (3th) interpolated sample (L) 2913 00001146 66AB stosw ; this is middle (3th) interpolated sample (R) 2914 ;mov al, [next_val] 2915 00001148 88F8 mov al, bh 2916 0000114A 00D0 add al, dl 2917 0000114C D0D8 rcr al, 1 2918 0000114E 88C3 mov bl, al ; this is temporary interpolation value 2919 00001150 00D0 add al, dl 2920 00001152 D0D8 rcr al, 1 2921 00001154 2C80 sub al, 80h 2922 00001156 66C1E008 shl ax, 8 2923 0000115A 66AB stosw ; this is 4th interpolated sample (L) 2924 0000115C 66AB stosw ; this is 4th interpolated sample (R) 2925 ;mov al, [next_val] 2926 0000115E 88F8 mov al, bh 2927 00001160 00D8 add al, bl 2928 00001162 D0D8 rcr al, 1 2929 00001164 2C80 sub al, 80h 2930 00001166 66C1E008 shl ax, 8 2931 0000116A 66AB stosw ; this is 5th interpolated sample (L) 2932 0000116C 66AB stosw ; this is 5th interpolated sample (R) 2933 ; 8 kHZ mono to 48 kHZ stereo conversion of the sample is OK 2934 0000116E 09C9 or ecx, ecx 2935 00001170 7581 jnz short lff8m_1 2936 2937 ; -------------- 2938 2939 lff8s_3: 2940 lff8m_3: 2941 lff8s2_3: 2942 lff8m2_3: 2943 lff16s_3: 2944 lff16m_3: 2945 lff16s2_3: 2946 lff16m2_3: 2947 lff24_3: 2948 lff32_3: 2949 lff44_3: 2950 lff22_3: 2951 lff11_3: 2952 lff12_3: ; 02/02/2025 2953 ; 08/12/2024 (BugFix) 2954 ; 31/05/2024 (BugFix) 2955 00001172 8B0D[A8390000] mov ecx, [buffersize] ; 16 bit (48 kHZ, stereo) sample size 2956 ;shl ecx, 1 ; byte count ; Bug ! 2957 ; 08/12/2024 2958 ;add ecx, audio_buffer 2959 ; 05/02/2025 2960 00001178 030D[EC330000] add ecx, [audio_buffer] 2961 0000117E 29F9 sub ecx, edi 2962 00001180 7607 jna short lff8m_4 2963 ;inc ecx 2964 00001182 C1E902 shr ecx, 2 2965 00001185 31C0 xor eax, eax ; fill (remain part of) buffer with zeros 2966 00001187 F3AB rep stosd 2967 lff8m_4: 2968 ; 31/05/2024 (BugFix) 2969 ; cf=1 ; Bug ! 2970 ; 08/12/2024 2971 ;clc 2972 00001189 C3 retn 2973 2974 lff8_eof: 2975 lff16_eof: 2976 lff24_eof: 2977 lff32_eof: 2978 lff44_eof: 2979 lff22_eof: 2980 lff11_eof: 2981 lff12_eof: ; 02/02/2025 2982 ; 15/11/2023 2983 0000118A C605[2E390000]01 mov byte [flags], ENDOFFILE 2984 00001191 EBDF jmp short lff8m_3 2985 2986 lff8s_5: 2987 lff8m_5: 2988 lff8s2_5: 2989 lff8m2_5: 2990 lff16s_5: 2991 lff16m_5: 2992 lff16s2_5: 2993 lff16m2_5: 2994 lff24_5: 2995 lff32_5: 2996 lff44_5: 2997 lff22_5: 2998 lff11_5: 2999 lff12_5: ; 02/02/2025 3000 00001193 B021 mov al, '!' ; error 3001 00001195 E82FF6FFFF call tL0 3002 3003 ;jmp short lff8m_3 3004 ; 15/11/2023 3005 0000119A EBEE jmp lff8_eof 3006 3007 ; -------------- 3008 3009 load_8khz_stereo_8_bit: 3010 ; 02/02/2025 3011 ; 15/11/2023 3012 ; 14/11/2023 3013 ; 13/11/2023 3014 0000119C F605[2E390000]01 test byte [flags], ENDOFFILE ; have we already read the 3015 ; last of the file? 3016 000011A3 7402 jz short lff8s_0 ; no 3017 000011A5 F9 stc 3018 000011A6 C3 retn 3019 3020 lff8s_0: 3021 ; 01/12/2024 3022 ; edi = audio buffer address 3023 000011A7 BE[00500200] mov esi, temp_buffer ; temporary buffer for wav data 3024 ;mov edx, [loadsize] 3025 3026 ; esi = buffer address 3027 ;; edx = buffer size 3028 3029 ; load file into memory 3030 sys _read, [filehandle], esi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 000011AC 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 000011B2 89F1 <1> mov ecx, %3 98 <1> %if %0 = 4 99 000011B4 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 000011BA B803000000 <1> mov eax, %1 104 <1> 105 000011BF CD40 <1> int 40h 3031 000011C1 72D0 jc short lff8s_5 ; error ! 3032 3033 ; 01/12/2024 3034 000011C3 A3[B4390000] mov [count], eax 3035 ;;; 3036 ; 29/05/2024 3037 ;mov edi, [audio_buffer] 3038 ;;; 3039 000011C8 D1E8 shr eax, 1 3040 000011CA 74BE jz short lff8_eof 3041 3042 000011CC 89C1 mov ecx, eax ; word count 3043 lff8s_1: 3044 000011CE AC lodsb 3045 000011CF A2[31280000] mov [previous_val_l], al 3046 000011D4 2C80 sub al, 80h 3047 000011D6 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3048 000011DA 66AB stosw ; original sample (L) 3049 000011DC AC lodsb 3050 000011DD A2[33280000] mov [previous_val_r], al 3051 000011E2 2C80 sub al, 80h 3052 000011E4 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3053 000011E8 66AB stosw ; original sample (R) 3054 3055 ;xor eax, eax 3056 ; 02/02/2025 3057 000011EA 668B06 mov ax, [esi] 3058 000011ED 49 dec ecx 3059 000011EE 7504 jnz short lff8s_2 3060 ; convert 8 bit sample to 16 bit sample 3061 000011F0 66B88080 mov ax, 8080h 3062 lff8s_2: 3063 000011F4 A2[35280000] mov [next_val_l], al 3064 000011F9 8825[37280000] mov [next_val_r], ah 3065 000011FF 8A25[31280000] mov ah, [previous_val_l] 3066 00001205 00E0 add al, ah 3067 00001207 D0D8 rcr al, 1 3068 00001209 88C2 mov dl, al ; this is interpolated middle (3th) sample (L) 3069 0000120B 00E0 add al, ah 3070 0000120D D0D8 rcr al, 1 3071 0000120F 88C3 mov bl, al ; this is temporary interpolation value (L) 3072 00001211 00E0 add al, ah 3073 00001213 D0D8 rcr al, 1 3074 00001215 2C80 sub al, 80h 3075 00001217 66C1E008 shl ax, 8 3076 0000121B 66AB stosw ; this is 1st interpolated sample (L) 3077 0000121D A0[37280000] mov al, [next_val_r] 3078 00001222 8A25[33280000] mov ah, [previous_val_r] 3079 00001228 00E0 add al, ah 3080 0000122A D0D8 rcr al, 1 3081 0000122C 88C6 mov dh, al ; this is interpolated middle (3th) sample (R) 3082 0000122E 00E0 add al, ah 3083 00001230 D0D8 rcr al, 1 3084 00001232 88C7 mov bh, al ; this is temporary interpolation value (R) 3085 00001234 00E0 add al, ah 3086 00001236 D0D8 rcr al, 1 3087 00001238 2C80 sub al, 80h 3088 0000123A 66C1E008 shl ax, 8 3089 0000123E 66AB stosw ; this is 1st interpolated sample (R) 3090 00001240 88D8 mov al, bl 3091 00001242 00D0 add al, dl 3092 00001244 D0D8 rcr al, 1 3093 00001246 2C80 sub al, 80h 3094 00001248 66C1E008 shl ax, 8 3095 0000124C 66AB stosw ; this is 2nd interpolated sample (L) 3096 0000124E 88F8 mov al, bh 3097 00001250 00F0 add al, dh 3098 00001252 D0D8 rcr al, 1 3099 00001254 2C80 sub al, 80h 3100 00001256 66C1E008 shl ax, 8 3101 0000125A 66AB stosw ; this is 2nd interpolated sample (R) 3102 0000125C 88D0 mov al, dl 3103 0000125E 2C80 sub al, 80h 3104 00001260 66C1E008 shl ax, 8 3105 00001264 66AB stosw ; this is middle (3th) interpolated sample (L) 3106 00001266 88F0 mov al, dh 3107 00001268 2C80 sub al, 80h 3108 0000126A 66C1E008 shl ax, 8 3109 0000126E 66AB stosw ; this is middle (3th) interpolated sample (R) 3110 00001270 A0[35280000] mov al, [next_val_l] 3111 00001275 00D0 add al, dl 3112 00001277 D0D8 rcr al, 1 3113 00001279 88C3 mov bl, al ; this is temporary interpolation value (L) 3114 0000127B 00D0 add al, dl 3115 0000127D D0D8 rcr al, 1 3116 0000127F 2C80 sub al, 80h 3117 00001281 66C1E008 shl ax, 8 3118 00001285 66AB stosw ; this is 4th interpolated sample (L) 3119 00001287 A0[37280000] mov al, [next_val_r] 3120 0000128C 00F0 add al, dh 3121 0000128E D0D8 rcr al, 1 3122 00001290 88C7 mov bh, al ; this is temporary interpolation value (R) 3123 00001292 00F0 add al, dh 3124 00001294 D0D8 rcr al, 1 3125 00001296 2C80 sub al, 80h 3126 00001298 66C1E008 shl ax, 8 3127 0000129C 66AB stosw ; this is 4th interpolated sample (R) 3128 0000129E A0[35280000] mov al, [next_val_l] 3129 000012A3 00D8 add al, bl 3130 000012A5 D0D8 rcr al, 1 3131 000012A7 2C80 sub al, 80h 3132 000012A9 66C1E008 shl ax, 8 3133 000012AD 66AB stosw ; this is 5th interpolated sample (L) 3134 000012AF A0[37280000] mov al, [next_val_r] 3135 000012B4 00F8 add al, bh 3136 000012B6 D0D8 rcr al, 1 3137 000012B8 2C80 sub al, 80h 3138 000012BA 66C1E008 shl ax, 8 3139 000012BE 66AB stosw ; this is 5th interpolated sample (R) 3140 ; 8 kHZ stereo to 48 kHZ stereo conversion of the sample is OK 3141 000012C0 E305 jecxz lff8s_6 3142 000012C2 E907FFFFFF jmp lff8s_1 3143 lff8s_6: 3144 000012C7 E9A6FEFFFF jmp lff8s_3 3145 3146 load_8khz_mono_16_bit: 3147 ; 02/02/2025 3148 ; 13/11/2023 3149 000012CC F605[2E390000]01 test byte [flags], ENDOFFILE ; have we already read the 3150 ; last of the file? 3151 000012D3 7402 jz short lff8m2_0 ; no 3152 000012D5 F9 stc 3153 000012D6 C3 retn 3154 3155 lff8m2_0: 3156 ; 01/12/2024 3157 ; edi = audio buffer address 3158 000012D7 BE[00500200] mov esi, temp_buffer ; temporary buffer for wav data 3159 ;mov edx, [loadsize] 3160 3161 ; esi = buffer address 3162 ;; edx = buffer size 3163 3164 ; load file into memory 3165 sys _read, [filehandle], esi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 000012DC 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 000012E2 89F1 <1> mov ecx, %3 98 <1> %if %0 = 4 99 000012E4 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 000012EA B803000000 <1> mov eax, %1 104 <1> 105 000012EF CD40 <1> int 40h 3166 000012F1 0F82A0000000 jc lff8m2_7 ; error ! 3167 3168 ; 01/12/2024 3169 000012F7 A3[B4390000] mov [count], eax 3170 ;;; 3171 ; 29/05/2024 3172 ;mov edi, [audio_buffer] 3173 ;;; 3174 000012FC D1E8 shr eax, 1 3175 000012FE 7505 jnz short lff8m2_8 3176 00001300 E985FEFFFF jmp lff8_eof 3177 3178 lff8m2_8: 3179 00001305 89C1 mov ecx, eax ; word count 3180 lff8m2_1: 3181 00001307 66AD lodsw 3182 00001309 66AB stosw ; original sample (left channel) 3183 0000130B 66AB stosw ; original sample (right channel) 3184 0000130D 80C480 add ah, 80h ; convert sound level to 0-65535 format 3185 00001310 66A3[31280000] mov [previous_val], ax 3186 ; 02/02/2025 3187 00001316 668B06 mov ax, [esi] 3188 00001319 49 dec ecx 3189 0000131A 7502 jnz short lff8m2_2 3190 0000131C 31C0 xor eax, eax 3191 lff8m2_2: 3192 0000131E 80C480 add ah, 80h ; convert sound level to 0-65535 format 3193 00001321 89C5 mov ebp, eax ; [next_val] 3194 00001323 660305[31280000] add ax, [previous_val] 3195 0000132A 66D1D8 rcr ax, 1 3196 0000132D 89C2 mov edx, eax ; this is interpolated middle (3th) sample 3197 0000132F 660305[31280000] add ax, [previous_val] 3198 00001336 66D1D8 rcr ax, 1 ; this is temporary interpolation value 3199 00001339 89C3 mov ebx, eax 3200 0000133B 660305[31280000] add ax, [previous_val] 3201 00001342 66D1D8 rcr ax, 1 3202 00001345 80EC80 sub ah, 80h ; -32768 to +32767 format again 3203 00001348 66AB stosw ; this is 1st interpolated sample (L) 3204 0000134A 66AB stosw ; this is 1st interpolated sample (R) 3205 0000134C 89D8 mov eax, ebx 3206 0000134E 6601D0 add ax, dx 3207 00001351 66D1D8 rcr ax, 1 3208 00001354 80EC80 sub ah, 80h 3209 00001357 66AB stosw ; this is 2nd interpolated sample (L) 3210 00001359 66AB stosw ; this is 2nd interpolated sample (R) 3211 0000135B 89D0 mov eax, edx 3212 0000135D 80EC80 sub ah, 80h ; -32768 to +32767 format again 3213 00001360 66AB stosw ; this is middle (3th) interpolated sample (L) 3214 00001362 66AB stosw ; this is middle (3th) interpolated sample (R) 3215 00001364 89E8 mov eax, ebp 3216 00001366 6601D0 add ax, dx 3217 00001369 66D1D8 rcr ax, 1 3218 0000136C 89C3 mov ebx, eax ; this is temporary interpolation value 3219 0000136E 6601D0 add ax, dx 3220 00001371 66D1D8 rcr ax, 1 3221 00001374 80EC80 sub ah, 80h 3222 00001377 66AB stosw ; this is 4th interpolated sample (L) 3223 00001379 66AB stosw ; this is 4th interpolated sample (R) 3224 0000137B 89E8 mov eax, ebp 3225 0000137D 6601D8 add ax, bx 3226 00001380 66D1D8 rcr ax, 1 3227 00001383 80EC80 sub ah, 80h ; -32768 to +32767 format again 3228 00001386 66AB stosw ; this is 5th interpolated sample (L) 3229 00001388 66AB stosw ; this is 5th interpolated sample (R) 3230 ; 8 kHZ mono to 48 kHZ stereo conversion of the sample is OK 3231 0000138A 09C9 or ecx, ecx 3232 0000138C 0F8575FFFFFF jnz lff8m2_1 3233 00001392 E9DBFDFFFF jmp lff8m2_3 3234 3235 lff8m2_7: 3236 lff8s2_7: 3237 00001397 E9F7FDFFFF jmp lff8m2_5 ; error 3238 3239 load_8khz_stereo_16_bit: 3240 ; 02/02/2025 3241 ; 16/11/2023 3242 ; 15/11/2023 3243 ; 13/11/2023 3244 0000139C F605[2E390000]01 test byte [flags], ENDOFFILE ; have we already read the 3245 ; last of the file? 3246 000013A3 7402 jz short lff8s2_0 ; no 3247 000013A5 F9 stc 3248 000013A6 C3 retn 3249 3250 lff8s2_0: 3251 ; 01/12/2024 3252 ; edi = audio buffer address 3253 000013A7 BE[00500200] mov esi, temp_buffer ; temporary buffer for wav data 3254 ;mov edx, [loadsize] 3255 3256 ; esi = buffer address 3257 ;; edx = buffer size 3258 3259 ; load file into memory 3260 sys _read, [filehandle], esi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 000013AC 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 000013B2 89F1 <1> mov ecx, %3 98 <1> %if %0 = 4 99 000013B4 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 000013BA B803000000 <1> mov eax, %1 104 <1> 105 000013BF CD40 <1> int 40h 3261 000013C1 72D4 jc short lff8s2_7 ; error ! 3262 3263 ; 01/12/2024 3264 000013C3 A3[B4390000] mov [count], eax 3265 ;;; 3266 ; 29/05/2024 3267 ;mov edi, [audio_buffer] 3268 ;;; 3269 000013C8 C1E802 shr eax, 2 3270 000013CB 7505 jnz short lff8s2_8 3271 000013CD E9B8FDFFFF jmp lff8_eof 3272 3273 lff8s2_8: 3274 000013D2 89C1 mov ecx, eax ; dword count 3275 lff8s2_1: 3276 000013D4 66AD lodsw 3277 000013D6 66AB stosw ; original sample (L) 3278 ; 15/11/2023 3279 000013D8 80C480 add ah, 80h ; convert sound level to 0-65535 format 3280 000013DB 66A3[31280000] mov [previous_val_l], ax 3281 000013E1 66AD lodsw 3282 000013E3 66AB stosw ; original sample (R) 3283 000013E5 80C480 add ah, 80h ; convert sound level to 0-65535 format 3284 000013E8 66A3[33280000] mov [previous_val_r], ax 3285 ; 02/02/2025 3286 000013EE 668B06 mov ax, [esi] 3287 000013F1 668B5602 mov dx, [esi+2] 3288 ; 16/11/2023 3289 000013F5 49 dec ecx 3290 000013F6 7504 jnz short lff8s2_2 3291 000013F8 31D2 xor edx, edx 3292 000013FA 31C0 xor eax, eax 3293 lff8s2_2: 3294 000013FC 80C480 add ah, 80h ; convert sound level to 0-65535 format 3295 000013FF 66A3[35280000] mov [next_val_l], ax 3296 00001405 80C680 add dh, 80h ; convert sound level to 0-65535 format 3297 00001408 668915[37280000] mov [next_val_r], dx 3298 0000140F 660305[31280000] add ax, [previous_val_l] 3299 00001416 66D1D8 rcr ax, 1 3300 00001419 89C2 mov edx, eax ; this is interpolated middle (3th) sample (L) 3301 0000141B 660305[31280000] add ax, [previous_val_l] 3302 00001422 66D1D8 rcr ax, 1 3303 00001425 89C3 mov ebx, eax ; this is temporary interpolation value (L) 3304 00001427 660305[31280000] add ax, [previous_val_l] 3305 0000142E 66D1D8 rcr ax, 1 3306 00001431 80EC80 sub ah, 80h ; -32768 to +32767 format again 3307 00001434 66AB stosw ; this is 1st interpolated sample (L) 3308 00001436 66A1[37280000] mov ax, [next_val_r] 3309 0000143C 660305[33280000] add ax, [previous_val_r] 3310 00001443 66D1D8 rcr ax, 1 3311 00001446 89C5 mov ebp, eax ; this is interpolated middle (3th) sample (R) 3312 00001448 660305[33280000] add ax, [previous_val_r] 3313 0000144F 66D1D8 rcr ax, 1 3314 00001452 50 push eax ; * ; this is temporary interpolation value (R) 3315 00001453 660305[33280000] add ax, [previous_val_r] 3316 0000145A 66D1D8 rcr ax, 1 3317 0000145D 80EC80 sub ah, 80h 3318 00001460 66AB stosw ; this is 1st interpolated sample (R) 3319 00001462 89D8 mov eax, ebx 3320 00001464 6601D0 add ax, dx 3321 00001467 66D1D8 rcr ax, 1 3322 0000146A 80EC80 sub ah, 80h ; -32768 to +32767 format again 3323 0000146D 66AB stosw ; this is 2nd interpolated sample (L) 3324 0000146F 58 pop eax ; * 3325 00001470 6601E8 add ax, bp 3326 00001473 66D1D8 rcr ax, 1 3327 00001476 80EC80 sub ah, 80h 3328 00001479 66AB stosw ; this is 2nd interpolated sample (R) 3329 0000147B 89D0 mov eax, edx 3330 0000147D 80EC80 sub ah, 80h 3331 00001480 66AB stosw ; this is middle (3th) interpolated sample (L) 3332 00001482 89E8 mov eax, ebp 3333 00001484 80EC80 sub ah, 80h ; -32768 to +32767 format again 3334 00001487 66AB stosw ; this is middle (3th) interpolated sample (R) 3335 00001489 66A1[35280000] mov ax, [next_val_l] 3336 0000148F 6601D0 add ax, dx 3337 00001492 66D1D8 rcr ax, 1 3338 00001495 89C3 mov ebx, eax ; this is temporary interpolation value (L) 3339 00001497 6601D0 add ax, dx 3340 0000149A 66D1D8 rcr ax, 1 3341 0000149D 80EC80 sub ah, 80h 3342 000014A0 66AB stosw ; this is 4th interpolated sample (L) 3343 000014A2 66A1[37280000] mov ax, [next_val_r] 3344 000014A8 6601E8 add ax, bp 3345 000014AB 66D1D8 rcr ax, 1 3346 000014AE 50 push eax ; ** ; this is temporary interpolation value (R) 3347 000014AF 6601E8 add ax, bp 3348 000014B2 66D1D8 rcr ax, 1 3349 000014B5 80EC80 sub ah, 80h 3350 000014B8 66AB stosw ; this is 4th interpolated sample (R) 3351 000014BA 66A1[35280000] mov ax, [next_val_l] 3352 000014C0 6601D8 add ax, bx 3353 000014C3 66D1D8 rcr ax, 1 3354 000014C6 80EC80 sub ah, 80h ; -32768 to +32767 format again 3355 000014C9 66AB stosw ; this is 5th interpolated sample (L) 3356 000014CB 58 pop eax ; ** 3357 000014CC 660305[37280000] add ax, [next_val_r] 3358 000014D3 66D1D8 rcr ax, 1 3359 000014D6 80EC80 sub ah, 80h 3360 000014D9 66AB stosw ; this is 5th interpolated sample (R) 3361 ; 8 kHZ stereo to 48 kHZ stereo conversion of the sample is OK 3362 000014DB E305 jecxz lff8_s2_9 3363 000014DD E9F2FEFFFF jmp lff8s2_1 3364 lff8_s2_9: 3365 000014E2 E98BFCFFFF jmp lff8s2_3 3366 3367 ; ..................... 3368 3369 load_16khz_mono_8_bit: 3370 ; 02/02/2025 3371 ; 14/11/2023 3372 ; 13/11/2023 3373 000014E7 F605[2E390000]01 test byte [flags], ENDOFFILE ; have we already read the 3374 ; last of the file? 3375 000014EE 7402 jz short lff16m_0 ; no 3376 000014F0 F9 stc 3377 000014F1 C3 retn 3378 3379 lff16m_0: 3380 ; 01/12/2024 3381 ; edi = audio buffer address 3382 000014F2 BE[00500200] mov esi, temp_buffer ; temporary buffer for wav data 3383 ;mov edx, [loadsize] 3384 3385 ; esi = buffer address 3386 ;; edx = buffer size 3387 3388 ; load file into memory 3389 sys _read, [filehandle], esi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 000014F7 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 000014FD 89F1 <1> mov ecx, %3 98 <1> %if %0 = 4 99 000014FF 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 00001505 B803000000 <1> mov eax, %1 104 <1> 105 0000150A CD40 <1> int 40h 3390 0000150C 7253 jc short lff16m_7 ; error ! 3391 3392 ; 01/12/2024 3393 0000150E A3[B4390000] mov [count], eax 3394 ;;; 3395 ; 29/05/2024 3396 ;mov edi, [audio_buffer] 3397 ;;; 3398 00001513 21C0 and eax, eax 3399 00001515 7505 jnz short lff16m_8 3400 00001517 E96EFCFFFF jmp lff16_eof 3401 3402 lff16m_8: 3403 0000151C 89C1 mov ecx, eax ; byte count 3404 lff16m_1: 3405 0000151E AC lodsb 3406 ;mov [previous_val], al 3407 0000151F 88C3 mov bl, al 3408 00001521 2C80 sub al, 80h 3409 00001523 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3410 00001527 66AB stosw ; original sample (left channel) 3411 00001529 66AB stosw ; original sample (right channel) 3412 ;xor eax, eax 3413 ; 02/02/2025 3414 0000152B 8A06 mov al, [esi] 3415 0000152D 49 dec ecx 3416 0000152E 7502 jnz short lff16m_2 3417 ; 14/11/2023 3418 00001530 B080 mov al, 80h 3419 lff16m_2: 3420 ;mov [next_val], al 3421 00001532 88C7 mov bh, al 3422 ;add al, [previous_val] 3423 00001534 00D8 add al, bl 3424 00001536 D0D8 rcr al, 1 3425 00001538 88C2 mov dl, al ; this is interpolated middle (temp) sample 3426 ;add al, [previous_val] 3427 0000153A 00D8 add al, bl 3428 0000153C D0D8 rcr al, 1 3429 0000153E 2C80 sub al, 80h 3430 00001540 66C1E008 shl ax, 8 3431 00001544 66AB stosw ; this is 1st interpolated sample (L) 3432 00001546 66AB stosw ; this is 1st interpolated sample (R) 3433 ;mov al, [next_val] 3434 00001548 88F8 mov al, bh 3435 0000154A 00D0 add al, dl 3436 0000154C D0D8 rcr al, 1 3437 0000154E 2C80 sub al, 80h 3438 00001550 66C1E008 shl ax, 8 3439 00001554 66AB stosw ; this is 2nd interpolated sample (L) 3440 00001556 66AB stosw ; this is 2nd interpolated sample (R) 3441 3442 ; 16 kHZ mono to 48 kHZ stereo conversion of the sample is OK 3443 00001558 09C9 or ecx, ecx 3444 0000155A 75C2 jnz short lff16m_1 3445 0000155C E911FCFFFF jmp lff16m_3 3446 3447 lff16m_7: 3448 lff16s_7: 3449 00001561 E92DFCFFFF jmp lff16m_5 ; error 3450 3451 load_16khz_stereo_8_bit: 3452 ; 02/02/2025 3453 ; 14/11/2023 3454 ; 13/11/2023 3455 00001566 F605[2E390000]01 test byte [flags], ENDOFFILE ; have we already read the 3456 ; last of the file? 3457 0000156D 7402 jz short lff16s_0 ; no 3458 0000156F F9 stc 3459 00001570 C3 retn 3460 3461 lff16s_0: 3462 ; 01/12/2024 3463 ; edi = audio buffer address 3464 00001571 BE[00500200] mov esi, temp_buffer ; temporary buffer for wav data 3465 ;mov edx, [loadsize] 3466 3467 ; esi = buffer address 3468 ;; edx = buffer size 3469 3470 ; load file into memory 3471 sys _read, [filehandle], esi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 00001576 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 0000157C 89F1 <1> mov ecx, %3 98 <1> %if %0 = 4 99 0000157E 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 00001584 B803000000 <1> mov eax, %1 104 <1> 105 00001589 CD40 <1> int 40h 3472 0000158B 72D4 jc short lff16s_7 ; error ! 3473 3474 ; 01/12/2024 3475 0000158D A3[B4390000] mov [count], eax 3476 ;;; 3477 ; 29/05/2024 3478 ;mov edi, [audio_buffer] 3479 ;;; 3480 00001592 D1E8 shr eax, 1 3481 00001594 7505 jnz short lff16s_8 3482 00001596 E9EFFBFFFF jmp lff16_eof 3483 3484 lff16s_8: 3485 0000159B 89C1 mov ecx, eax ; word count 3486 lff16s_1: 3487 0000159D AC lodsb 3488 0000159E A2[31280000] mov [previous_val_l], al 3489 000015A3 2C80 sub al, 80h 3490 000015A5 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3491 000015A9 66AB stosw ; original sample (L) 3492 000015AB AC lodsb 3493 000015AC A2[33280000] mov [previous_val_r], al 3494 000015B1 2C80 sub al, 80h 3495 000015B3 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3496 000015B7 66AB stosw ; original sample (R) 3497 3498 ;xor eax, eax 3499 ; 02/02/2025 3500 000015B9 668B06 mov ax, [esi] 3501 000015BC 49 dec ecx 3502 000015BD 7504 jnz short lff16s_2 3503 ; convert 8 bit sample to 16 bit sample 3504 ; 14/11/2023 3505 000015BF 66B88080 mov ax, 8080h 3506 lff16s_2: 3507 ;mov [next_val_l], al 3508 ;mov [next_val_r], ah 3509 000015C3 89C3 mov ebx, eax 3510 000015C5 0205[31280000] add al, [previous_val_l] 3511 000015CB D0D8 rcr al, 1 3512 000015CD 88C2 mov dl, al ; this is temporary interpolation value (L) 3513 000015CF 0205[31280000] add al, [previous_val_l] 3514 000015D5 D0D8 rcr al, 1 3515 000015D7 2C80 sub al, 80h 3516 000015D9 66C1E008 shl ax, 8 3517 000015DD 66AB stosw ; this is 1st interpolated sample (L) 3518 000015DF 88F8 mov al, bh ; [next_val_r] 3519 000015E1 0205[33280000] add al, [previous_val_r] 3520 000015E7 D0D8 rcr al, 1 3521 000015E9 88C6 mov dh, al ; this is temporary interpolation value (R) 3522 000015EB 0205[33280000] add al, [previous_val_r] 3523 000015F1 D0D8 rcr al, 1 3524 000015F3 2C80 sub al, 80h 3525 000015F5 66C1E008 shl ax, 8 3526 000015F9 66AB stosw ; this is 1st interpolated sample (R) 3527 000015FB 88D0 mov al, dl 3528 000015FD 00D8 add al, bl ; [next_val_l] 3529 000015FF D0D8 rcr al, 1 3530 00001601 2C80 sub al, 80h 3531 00001603 66C1E008 shl ax, 8 3532 00001607 66AB stosw ; this is 2nd interpolated sample (L) 3533 00001609 88F0 mov al, dh 3534 0000160B 00F8 add al, bh ; [next_val_r] 3535 0000160D D0D8 rcr al, 1 3536 0000160F 2C80 sub al, 80h 3537 00001611 66C1E008 shl ax, 8 3538 00001615 66AB stosw ; this is 2nd interpolated sample (R) 3539 3540 ; 16 kHZ stereo to 48 kHZ stereo conversion of the sample is OK 3541 00001617 09C9 or ecx, ecx 3542 00001619 7582 jnz short lff16s_1 3543 0000161B E952FBFFFF jmp lff16s_3 3544 3545 load_16khz_mono_16_bit: 3546 ; 02/02/2025 3547 ; 15/11/2023 3548 ; 13/11/2023 3549 00001620 F605[2E390000]01 test byte [flags], ENDOFFILE ; have we already read the 3550 ; last of the file? 3551 00001627 7402 jz short lff16m2_0 ; no 3552 00001629 F9 stc 3553 0000162A C3 retn 3554 3555 lff16m2_0: 3556 ; 01/12/2024 3557 ; edi = audio buffer address 3558 0000162B BE[00500200] mov esi, temp_buffer ; temporary buffer for wav data 3559 ;mov edx, [loadsize] 3560 3561 ; esi = buffer address 3562 ;; edx = buffer size 3563 3564 ; load file into memory 3565 sys _read, [filehandle], esi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 00001630 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 00001636 89F1 <1> mov ecx, %3 98 <1> %if %0 = 4 99 00001638 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 0000163E B803000000 <1> mov eax, %1 104 <1> 105 00001643 CD40 <1> int 40h 3566 00001645 7255 jc short lff16m2_7 ; error ! 3567 3568 ; 01/12/2024 3569 00001647 A3[B4390000] mov [count], eax 3570 ;;; 3571 ; 29/05/2024 3572 ;mov edi, [audio_buffer] 3573 ;;; 3574 0000164C D1E8 shr eax, 1 3575 0000164E 7505 jnz short lff16m2_8 3576 00001650 E935FBFFFF jmp lff16_eof 3577 3578 lff16m2_8: 3579 00001655 89C1 mov ecx, eax ; word count 3580 lff16m2_1: 3581 00001657 66AD lodsw 3582 00001659 66AB stosw ; original sample (left channel) 3583 0000165B 66AB stosw ; original sample (right channel) 3584 0000165D 80C480 add ah, 80h ; convert sound level 0 to 65535 format 3585 ;mov [previous_val], ax 3586 00001660 89C3 mov ebx, eax 3587 ; 02/02/2025 3588 00001662 668B06 mov ax, [esi] 3589 00001665 49 dec ecx 3590 00001666 7502 jnz short lff16m2_2 3591 00001668 31C0 xor eax, eax 3592 lff16m2_2: 3593 0000166A 80C480 add ah, 80h ; convert sound level 0 to 65535 format 3594 0000166D 89C5 mov ebp, eax ; [next_val] 3595 ;add ax, [previous_val] 3596 0000166F 6601D8 add ax, bx 3597 00001672 66D1D8 rcr ax, 1 3598 00001675 89C2 mov edx, eax ; this is temporary interpolation value 3599 ;add ax, [previous_val] 3600 00001677 6601D8 add ax, bx 3601 0000167A 66D1D8 rcr ax, 1 3602 0000167D 80EC80 sub ah, 80h ; -32768 to +32767 format again 3603 00001680 66AB stosw ; this is 1st interpolated sample (L) 3604 00001682 66AB stosw ; this is 1st interpolated sample (R) 3605 00001684 89E8 mov eax, ebp 3606 00001686 6601D0 add ax, dx 3607 00001689 66D1D8 rcr ax, 1 3608 0000168C 80EC80 sub ah, 80h ; -32768 to +32767 format again 3609 0000168F 66AB stosw ; this is 2nd interpolated sample (L) 3610 00001691 66AB stosw ; this is 2nd interpolated sample (R) 3611 ; 16 kHZ mono to 48 kHZ stereo conversion of the sample is OK 3612 00001693 09C9 or ecx, ecx 3613 00001695 75C0 jnz short lff16m2_1 3614 00001697 E9D6FAFFFF jmp lff16m2_3 3615 3616 lff16m2_7: 3617 lff16s2_7: 3618 0000169C E9F2FAFFFF jmp lff16m2_5 ; error 3619 3620 load_16khz_stereo_16_bit: 3621 ; 02/02/2025 3622 ; 16/11/2023 3623 ; 15/11/2023 3624 ; 13/11/2023 3625 000016A1 F605[2E390000]01 test byte [flags], ENDOFFILE ; have we already read the 3626 ; last of the file? 3627 000016A8 7402 jz short lff16s2_0 ; no 3628 000016AA F9 stc 3629 000016AB C3 retn 3630 3631 lff16s2_0: 3632 ; 01/12/2024 3633 ; edi = audio buffer address 3634 000016AC BE[00500200] mov esi, temp_buffer ; temporary buffer for wav data 3635 ;mov edx, [loadsize] 3636 3637 ; esi = buffer address 3638 ;; edx = buffer size 3639 3640 ; load file into memory 3641 sys _read, [filehandle], esi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 000016B1 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 000016B7 89F1 <1> mov ecx, %3 98 <1> %if %0 = 4 99 000016B9 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 000016BF B803000000 <1> mov eax, %1 104 <1> 105 000016C4 CD40 <1> int 40h 3642 000016C6 72D4 jc short lff16s2_7 ; error ! 3643 3644 ; 01/12/2024 3645 000016C8 A3[B4390000] mov [count], eax 3646 ;;; 3647 ; 29/05/2024 3648 ;mov edi, [audio_buffer] 3649 ;;; 3650 000016CD C1E802 shr eax, 2 3651 000016D0 7505 jnz short lff16s2_8 3652 000016D2 E9B3FAFFFF jmp lff16_eof 3653 3654 lff16s2_8: 3655 000016D7 89C1 mov ecx, eax ; dword count 3656 lff16s2_1: 3657 000016D9 66AD lodsw 3658 000016DB 66AB stosw ; original sample (L) 3659 000016DD 80C480 add ah, 80h ; convert sound level 0 to 65535 format 3660 000016E0 66A3[31280000] mov [previous_val_l], ax 3661 000016E6 66AD lodsw 3662 000016E8 66AB stosw ; original sample (R) 3663 000016EA 80C480 add ah, 80h ; convert sound level 0 to 65535 format 3664 000016ED 66A3[33280000] mov [previous_val_r], ax 3665 ; 02/02/2025 3666 000016F3 668B06 mov ax, [esi] 3667 000016F6 668B5602 mov dx, [esi+2] 3668 ; 16/11/2023 3669 000016FA 49 dec ecx 3670 000016FB 7504 jnz short lff16s2_2 3671 000016FD 31D2 xor edx, edx 3672 000016FF 31C0 xor eax, eax 3673 lff16s2_2: 3674 00001701 80C480 add ah, 80h ; convert sound level 0 to 65535 format 3675 ;mov [next_val_l], ax 3676 00001704 89C5 mov ebp, eax 3677 00001706 80C680 add dh, 80h ; convert sound level 0 to 65535 format 3678 00001709 668915[37280000] mov [next_val_r], dx 3679 00001710 660305[31280000] add ax, [previous_val_l] 3680 00001717 66D1D8 rcr ax, 1 3681 0000171A 89C2 mov edx, eax ; this is temporary interpolation value (L) 3682 0000171C 660305[31280000] add ax, [previous_val_l] 3683 00001723 66D1D8 rcr ax, 1 3684 00001726 80EC80 sub ah, 80h ; -32768 to +32767 format again 3685 00001729 66AB stosw ; this is 1st interpolated sample (L) 3686 0000172B 66A1[37280000] mov ax, [next_val_r] 3687 00001731 660305[33280000] add ax, [previous_val_r] 3688 00001738 66D1D8 rcr ax, 1 3689 0000173B 89C3 mov ebx, eax ; this is temporary interpolation value (R) 3690 0000173D 660305[33280000] add ax, [previous_val_r] 3691 00001744 66D1D8 rcr ax, 1 3692 00001747 80EC80 sub ah, 80h ; -32768 to +32767 format again 3693 0000174A 66AB stosw ; this is 1st interpolated sample (R) 3694 ;mov ax, [next_val_l] 3695 0000174C 89E8 mov eax, ebp 3696 0000174E 6601D0 add ax, dx 3697 00001751 66D1D8 rcr ax, 1 3698 00001754 80EC80 sub ah, 80h ; -32768 to +32767 format again 3699 00001757 66AB stosw ; this is 2nd interpolated sample (L) 3700 00001759 66A1[37280000] mov ax, [next_val_r] 3701 0000175F 6601D8 add ax, bx 3702 00001762 66D1D8 rcr ax, 1 3703 00001765 80EC80 sub ah, 80h ; -32768 to +32767 format again 3704 00001768 66AB stosw ; this is 2nd interpolated sample (R) 3705 3706 ; 16 kHZ stereo to 48 kHZ stereo conversion of the sample is OK 3707 0000176A 09C9 or ecx, ecx 3708 0000176C 0F8567FFFFFF jnz lff16s2_1 3709 00001772 E9FBF9FFFF jmp lff16s2_3 3710 3711 ; ..................... 3712 3713 load_24khz_mono_8_bit: 3714 ; 02/02/2025 3715 ; 15/11/2023 3716 00001777 F605[2E390000]01 test byte [flags], ENDOFFILE ; have we already read the 3717 ; last of the file? 3718 0000177E 7402 jz short lff24m_0 ; no 3719 00001780 F9 stc 3720 00001781 C3 retn 3721 3722 lff24m_0: 3723 ; 01/12/2024 3724 ; edi = audio buffer address 3725 00001782 BE[00500200] mov esi, temp_buffer ; temporary buffer for wav data 3726 ;mov edx, [loadsize] 3727 3728 ; esi = buffer address 3729 ;; edx = buffer size 3730 3731 ; load file into memory 3732 sys _read, [filehandle], esi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 00001787 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 0000178D 89F1 <1> mov ecx, %3 98 <1> %if %0 = 4 99 0000178F 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 00001795 B803000000 <1> mov eax, %1 104 <1> 105 0000179A CD40 <1> int 40h 3733 0000179C 723B jc short lff24m_7 ; error ! 3734 3735 ; 01/12/2024 3736 0000179E A3[B4390000] mov [count], eax 3737 ;;; 3738 ; 29/05/2024 3739 ;mov edi, [audio_buffer] 3740 ;;; 3741 000017A3 21C0 and eax, eax 3742 000017A5 7505 jnz short lff24m_8 3743 000017A7 E9DEF9FFFF jmp lff24_eof 3744 3745 lff24m_8: 3746 000017AC 89C1 mov ecx, eax ; byte count 3747 lff24m_1: 3748 000017AE AC lodsb 3749 ;mov [previous_val], al 3750 000017AF 88C3 mov bl, al 3751 000017B1 2C80 sub al, 80h 3752 000017B3 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3753 000017B7 66AB stosw ; original sample (left channel) 3754 000017B9 66AB stosw ; original sample (right channel) 3755 ;xor eax, eax 3756 ; 02/02/2025 3757 000017BB 8A06 mov al, [esi] 3758 000017BD 49 dec ecx 3759 000017BE 7502 jnz short lff24m_2 3760 000017C0 B080 mov al, 80h 3761 lff24m_2: 3762 ;;mov [next_val], al 3763 ;mov bh, al 3764 ;add al, [previous_val] 3765 000017C2 00D8 add al, bl 3766 000017C4 D0D8 rcr al, 1 3767 000017C6 2C80 sub al, 80h 3768 000017C8 66C1E008 shl ax, 8 3769 000017CC 66AB stosw ; this is interpolated sample (L) 3770 000017CE 66AB stosw ; this is interpolated sample (R) 3771 3772 ; 24 kHZ mono to 48 kHZ stereo conversion of the sample is OK 3773 000017D0 09C9 or ecx, ecx 3774 000017D2 75DA jnz short lff24m_1 3775 000017D4 E999F9FFFF jmp lff24_3 3776 3777 lff24m_7: 3778 lff24s_7: 3779 000017D9 E9B5F9FFFF jmp lff24_5 ; error 3780 3781 load_24khz_stereo_8_bit: 3782 ; 02/02/2025 3783 ; 15/11/2023 3784 000017DE F605[2E390000]01 test byte [flags], ENDOFFILE ; have we already read the 3785 ; last of the file? 3786 000017E5 7402 jz short lff24s_0 ; no 3787 000017E7 F9 stc 3788 000017E8 C3 retn 3789 3790 lff24s_0: 3791 ; 01/12/2024 3792 ; edi = audio buffer address 3793 000017E9 BE[00500200] mov esi, temp_buffer ; temporary buffer for wav data 3794 ;mov edx, [loadsize] 3795 3796 ; esi = buffer address 3797 ;; edx = buffer size 3798 3799 ; load file into memory 3800 sys _read, [filehandle], esi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 000017EE 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 000017F4 89F1 <1> mov ecx, %3 98 <1> %if %0 = 4 99 000017F6 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 000017FC B803000000 <1> mov eax, %1 104 <1> 105 00001801 CD40 <1> int 40h 3801 00001803 72D4 jc short lff24s_7 ; error ! 3802 3803 ; 01/12/2024 3804 00001805 A3[B4390000] mov [count], eax 3805 ;;; 3806 ; 29/05/2024 3807 ;mov edi, [audio_buffer] 3808 ;;; 3809 0000180A D1E8 shr eax, 1 3810 0000180C 7505 jnz short lff24s_8 3811 0000180E E977F9FFFF jmp lff24_eof 3812 3813 lff24s_8: 3814 00001813 89C1 mov ecx, eax ; word count 3815 lff24s_1: 3816 00001815 AC lodsb 3817 00001816 A2[31280000] mov [previous_val_l], al 3818 0000181B 2C80 sub al, 80h 3819 0000181D 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3820 00001821 66AB stosw ; original sample (L) 3821 00001823 AC lodsb 3822 00001824 A2[33280000] mov [previous_val_r], al 3823 00001829 2C80 sub al, 80h 3824 0000182B 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 3825 0000182F 66AB stosw ; original sample (R) 3826 3827 ;xor eax, eax 3828 ; 02/02/2025 3829 00001831 668B06 mov ax, [esi] 3830 00001834 49 dec ecx 3831 00001835 7504 jnz short lff24s_2 3832 ; convert 8 bit sample to 16 bit sample 3833 00001837 66B88080 mov ax, 8080h 3834 lff24s_2: 3835 ;;mov [next_val_l], al 3836 ;;mov [next_val_r], ah 3837 ;mov bx, ax 3838 0000183B 88E7 mov bh, ah 3839 0000183D 0205[31280000] add al, [previous_val_l] 3840 00001843 D0D8 rcr al, 1 3841 ;mov dl, al 3842 00001845 2C80 sub al, 80h 3843 00001847 66C1E008 shl ax, 8 3844 0000184B 66AB stosw ; this is interpolated sample (L) 3845 0000184D 88F8 mov al, bh ; [next_val_r] 3846 0000184F 0205[33280000] add al, [previous_val_r] 3847 00001855 D0D8 rcr al, 1 3848 ;mov dh, al 3849 00001857 2C80 sub al, 80h 3850 00001859 66C1E008 shl ax, 8 3851 0000185D 66AB stosw ; this is interpolated sample (R) 3852 3853 ; 24 kHZ stereo to 48 kHZ stereo conversion of the sample is OK 3854 0000185F 09C9 or ecx, ecx 3855 00001861 75B2 jnz short lff24s_1 3856 00001863 E90AF9FFFF jmp lff24_3 3857 3858 load_24khz_mono_16_bit: 3859 ; 02/02/2025 3860 ; 15/11/2023 3861 00001868 F605[2E390000]01 test byte [flags], ENDOFFILE ; have we already read the 3862 ; last of the file? 3863 0000186F 7402 jz short lff24m2_0 ; no 3864 00001871 F9 stc 3865 00001872 C3 retn 3866 3867 lff24m2_0: 3868 ; 01/12/2024 3869 ; edi = audio buffer address 3870 00001873 BE[00500200] mov esi, temp_buffer ; temporary buffer for wav data 3871 ;mov edx, [loadsize] 3872 3873 ; esi = buffer address 3874 ;; edx = buffer size 3875 3876 ; load file into memory 3877 sys _read, [filehandle], esi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 00001878 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 0000187E 89F1 <1> mov ecx, %3 98 <1> %if %0 = 4 99 00001880 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 00001886 B803000000 <1> mov eax, %1 104 <1> 105 0000188B CD40 <1> int 40h 3878 0000188D 723A jc short lff24m2_7 ; error ! 3879 3880 ; 01/12/2024 3881 0000188F A3[B4390000] mov [count], eax 3882 ;;; 3883 ; 29/05/2024 3884 ;mov edi, [audio_buffer] 3885 ;;; 3886 00001894 D1E8 shr eax, 1 3887 00001896 7505 jnz short lff24m2_8 3888 00001898 E9EDF8FFFF jmp lff24_eof 3889 3890 lff24m2_8: 3891 0000189D 89C1 mov ecx, eax ; word count 3892 lff24m2_1: 3893 0000189F 66AD lodsw 3894 000018A1 66AB stosw ; original sample (left channel) 3895 000018A3 66AB stosw ; original sample (right channel) 3896 000018A5 80C480 add ah, 80h ; convert sound level 0 to 65535 format 3897 ;mov [previous_val], ax 3898 ;mov ebx, eax 3899 ; 02/02/2025 3900 000018A8 668B1E mov bx, [esi] 3901 000018AB 49 dec ecx 3902 000018AC 7502 jnz short lff24m2_2 3903 ;xor eax, eax 3904 000018AE 31DB xor ebx, ebx 3905 lff24m2_2: 3906 ; 02/02/2025 3907 000018B0 80C780 add bh, 80h ; convert sound level 0 to 65535 format 3908 ;add ah, 80h 3909 ;mov ebp, eax ; [next_val] 3910 ;add ax, [previous_val] 3911 ; ax = [previous_val] 3912 ; bx = [next_val] 3913 000018B3 6601D8 add ax, bx 3914 000018B6 66D1D8 rcr ax, 1 3915 000018B9 80EC80 sub ah, 80h ; -32768 to +32767 format again 3916 000018BC 66AB stosw ; this is interpolated sample (L) 3917 000018BE 66AB stosw ; this is interpolated sample (R) 3918 ; 24 kHZ mono to 48 kHZ stereo conversion of the sample is OK 3919 000018C0 09C9 or ecx, ecx 3920 000018C2 75DB jnz short lff24m2_1 3921 000018C4 E9A9F8FFFF jmp lff24_3 3922 3923 lff24m2_7: 3924 lff24s2_7: 3925 000018C9 E9C5F8FFFF jmp lff24_5 ; error 3926 3927 load_24khz_stereo_16_bit: 3928 ; 02/02/2025 3929 ; 16/11/2023 3930 ; 15/11/2023 3931 000018CE F605[2E390000]01 test byte [flags], ENDOFFILE ; have we already read the 3932 ; last of the file? 3933 000018D5 7402 jz short lff24s2_0 ; no 3934 000018D7 F9 stc 3935 000018D8 C3 retn 3936 3937 lff24s2_0: 3938 ; 01/12/2024 3939 ; edi = audio buffer address 3940 000018D9 BE[00500200] mov esi, temp_buffer ; temporary buffer for wav data 3941 ;mov edx, [loadsize] 3942 3943 ; esi = buffer address 3944 ;; edx = buffer size 3945 3946 ; load file into memory 3947 sys _read, [filehandle], esi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 000018DE 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 000018E4 89F1 <1> mov ecx, %3 98 <1> %if %0 = 4 99 000018E6 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 000018EC B803000000 <1> mov eax, %1 104 <1> 105 000018F1 CD40 <1> int 40h 3948 000018F3 72D4 jc short lff24s2_7 ; error ! 3949 3950 ; 01/12/2024 3951 000018F5 A3[B4390000] mov [count], eax 3952 ;;; 3953 ; 29/05/2024 3954 ;mov edi, [audio_buffer] 3955 ;;; 3956 000018FA C1E802 shr eax, 2 3957 000018FD 7505 jnz short lff24s2_8 3958 000018FF E986F8FFFF jmp lff24_eof 3959 3960 lff24s2_8: 3961 00001904 89C1 mov ecx, eax ; dword count 3962 lff24s2_1: 3963 00001906 66AD lodsw 3964 00001908 66AB stosw ; original sample (L) 3965 0000190A 80C480 add ah, 80h ; convert sound level 0 to 65535 format 3966 0000190D 66A3[31280000] mov [previous_val_l], ax 3967 00001913 66AD lodsw 3968 00001915 66AB stosw ; original sample (R) 3969 00001917 80C480 add ah, 80h ; convert sound level 0 to 65535 format 3970 ;mov [previous_val_r], ax 3971 0000191A 89C3 mov ebx, eax 3972 ; 02/02/2025 3973 0000191C 668B06 mov ax, [esi] 3974 0000191F 668B5602 mov dx, [esi+2] 3975 ; 16/11/2023 3976 00001923 49 dec ecx 3977 00001924 7504 jnz short lff24s2_2 3978 00001926 31D2 xor edx, edx 3979 00001928 31C0 xor eax, eax 3980 lff24s2_2: 3981 0000192A 80C480 add ah, 80h ; convert sound level 0 to 65535 format 3982 ;;mov [next_val_l], ax 3983 ;mov ebp, eax 3984 0000192D 80C680 add dh, 80h ; convert sound level 0 to 65535 format 3985 ;mov [next_val_r], dx 3986 00001930 660305[31280000] add ax, [previous_val_l] 3987 00001937 66D1D8 rcr ax, 1 3988 0000193A 80EC80 sub ah, 80h ; -32768 to +32767 format again 3989 0000193D 66AB stosw ; this is interpolated sample (L) 3990 ;mov ax, [next_val_r] 3991 0000193F 89D0 mov eax, edx 3992 ;add ax, [previous_val_r] 3993 00001941 6601D8 add ax, bx 3994 00001944 66D1D8 rcr ax, 1 3995 00001947 80EC80 sub ah, 80h ; -32768 to +32767 format again 3996 0000194A 66AB stosw ; this is interpolated sample (R) 3997 3998 ; 24 kHZ stereo to 48 kHZ stereo conversion of the sample is OK 3999 0000194C 09C9 or ecx, ecx 4000 0000194E 75B6 jnz short lff24s2_1 4001 00001950 E91DF8FFFF jmp lff24_3 4002 4003 ; ..................... 4004 4005 load_32khz_mono_8_bit: 4006 ; 02/02/2025 4007 ; 15/11/2023 4008 00001955 F605[2E390000]01 test byte [flags], ENDOFFILE ; have we already read the 4009 ; last of the file? 4010 0000195C 7402 jz short lff32m_0 ; no 4011 0000195E F9 stc 4012 0000195F C3 retn 4013 4014 lff32m_0: 4015 ; 01/12/2024 4016 ; edi = audio buffer address 4017 00001960 BE[00500200] mov esi, temp_buffer ; temporary buffer for wav data 4018 ;mov edx, [loadsize] 4019 4020 ; esi = buffer address 4021 ;; edx = buffer size 4022 4023 ; load file into memory 4024 sys _read, [filehandle], esi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 00001965 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 0000196B 89F1 <1> mov ecx, %3 98 <1> %if %0 = 4 99 0000196D 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 00001973 B803000000 <1> mov eax, %1 104 <1> 105 00001978 CD40 <1> int 40h 4025 0000197A 7247 jc short lff32m_7 ; error ! 4026 4027 ; 01/12/2024 4028 0000197C A3[B4390000] mov [count], eax 4029 ;;; 4030 ; 29/05/2024 4031 ;mov edi, [audio_buffer] 4032 ;;; 4033 00001981 21C0 and eax, eax 4034 00001983 7505 jnz short lff32m_8 4035 00001985 E900F8FFFF jmp lff32_eof 4036 4037 lff32m_8: 4038 0000198A 89C1 mov ecx, eax ; byte count 4039 lff32m_1: 4040 0000198C AC lodsb 4041 ;mov [previous_val], al 4042 0000198D 88C3 mov bl, al 4043 0000198F 2C80 sub al, 80h 4044 00001991 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4045 00001995 66AB stosw ; original sample (left channel) 4046 00001997 66AB stosw ; original sample (right channel) 4047 ;xor eax, eax 4048 ; 02/02/2025 4049 00001999 8A06 mov al, [esi] 4050 0000199B 49 dec ecx 4051 0000199C 7502 jnz short lff32m_2 4052 0000199E B080 mov al, 80h 4053 lff32m_2: 4054 ;;mov [next_val], al 4055 ;mov bh, al 4056 ;add al, [previous_val] 4057 000019A0 00D8 add al, bl 4058 000019A2 D0D8 rcr al, 1 4059 000019A4 2C80 sub al, 80h 4060 000019A6 66C1E008 shl ax, 8 4061 000019AA 66AB stosw ; this is interpolated sample (L) 4062 000019AC 66AB stosw ; this is interpolated sample (R) 4063 4064 ; different than 8-16-24 kHZ ! 4065 ; 'original-interpolated-original' trio samples 4066 000019AE E30E jecxz lff32m_3 4067 4068 000019B0 AC lodsb 4069 000019B1 2C80 sub al, 80h 4070 000019B3 66C1E008 shl ax, 8 4071 000019B7 66AB stosw ; original sample (left channel) 4072 000019B9 66AB stosw ; original sample (right channel) 4073 4074 ; 32 kHZ mono to 48 kHZ stereo conversion of the sample is OK 4075 000019BB 49 dec ecx 4076 000019BC 75CE jnz short lff32m_1 4077 lff32m_3: 4078 000019BE E9AFF7FFFF jmp lff32_3 4079 4080 lff32m_7: 4081 lff32s_7: 4082 000019C3 E9CBF7FFFF jmp lff32_5 ; error 4083 4084 load_32khz_stereo_8_bit: 4085 ; 02/02/2025 4086 ; 15/11/2023 4087 000019C8 F605[2E390000]01 test byte [flags], ENDOFFILE ; have we already read the 4088 ; last of the file? 4089 000019CF 7402 jz short lff32s_0 ; no 4090 000019D1 F9 stc 4091 000019D2 C3 retn 4092 4093 lff32s_0: 4094 ; 01/12/2024 4095 ; edi = audio buffer address 4096 000019D3 BE[00500200] mov esi, temp_buffer ; temporary buffer for wav data 4097 ;mov edx, [loadsize] 4098 4099 ; esi = buffer address 4100 ;; edx = buffer size 4101 4102 ; load file into memory 4103 sys _read, [filehandle], esi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 000019D8 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 000019DE 89F1 <1> mov ecx, %3 98 <1> %if %0 = 4 99 000019E0 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 000019E6 B803000000 <1> mov eax, %1 104 <1> 105 000019EB CD40 <1> int 40h 4104 000019ED 72D4 jc short lff32s_7 ; error ! 4105 4106 ; 01/12/2024 4107 000019EF A3[B4390000] mov [count], eax 4108 ;;; 4109 ; 29/05/2024 4110 ;mov edi, [audio_buffer] 4111 ;;; 4112 000019F4 D1E8 shr eax, 1 4113 000019F6 7505 jnz short lff32s_8 4114 000019F8 E98DF7FFFF jmp lff32_eof 4115 4116 lff32s_8: 4117 000019FD 89C1 mov ecx, eax ; word count 4118 lff32s_1: 4119 000019FF AC lodsb 4120 00001A00 A2[31280000] mov [previous_val_l], al 4121 00001A05 2C80 sub al, 80h 4122 00001A07 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4123 00001A0B 66AB stosw ; original sample (L) 4124 00001A0D AC lodsb 4125 00001A0E A2[33280000] mov [previous_val_r], al 4126 00001A13 2C80 sub al, 80h 4127 00001A15 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 4128 00001A19 66AB stosw ; original sample (R) 4129 4130 ;xor eax, eax 4131 ; 02/02/2025 4132 00001A1B 668B06 mov ax, [esi] 4133 00001A1E 49 dec ecx 4134 00001A1F 7504 jnz short lff32s_2 4135 ; convert 8 bit sample to 16 bit sample 4136 00001A21 66B88080 mov ax, 8080h 4137 lff32s_2: 4138 ;;mov [next_val_l], al 4139 ;;mov [next_val_r], ah 4140 ;mov bx, ax 4141 00001A25 88E7 mov bh, ah 4142 00001A27 0205[31280000] add al, [previous_val_l] 4143 00001A2D D0D8 rcr al, 1 4144 ;mov dl, al 4145 00001A2F 2C80 sub al, 80h 4146 00001A31 66C1E008 shl ax, 8 4147 00001A35 66AB stosw ; this is interpolated sample (L) 4148 00001A37 88F8 mov al, bh ; [next_val_r] 4149 00001A39 0205[33280000] add al, [previous_val_r] 4150 00001A3F D0D8 rcr al, 1 4151 ;mov dh, al 4152 00001A41 2C80 sub al, 80h 4153 00001A43 66C1E008 shl ax, 8 4154 00001A47 66AB stosw ; this is interpolated sample (R) 4155 4156 ; different than 8-16-24 kHZ ! 4157 ; 'original-interpolated-original' trio samples 4158 00001A49 E315 jecxz lff32s_3 4159 4160 00001A4B AC lodsb 4161 00001A4C 2C80 sub al, 80h 4162 00001A4E 66C1E008 shl ax, 8 4163 00001A52 66AB stosw ; original sample (left channel) 4164 4165 00001A54 AC lodsb 4166 00001A55 2C80 sub al, 80h 4167 00001A57 66C1E008 shl ax, 8 4168 00001A5B 66AB stosw ; original sample (right channel) 4169 4170 ; 32 kHZ stereo to 48 kHZ stereo conversion of the sample is OK 4171 00001A5D 49 dec ecx 4172 00001A5E 759F jnz short lff32s_1 4173 lff32s_3: 4174 00001A60 E90DF7FFFF jmp lff32_3 4175 4176 load_32khz_mono_16_bit: 4177 ; 02/02/2025 4178 ; 15/11/2023 4179 00001A65 F605[2E390000]01 test byte [flags], ENDOFFILE ; have we already read the 4180 ; last of the file? 4181 00001A6C 7402 jz short lff32m2_0 ; no 4182 00001A6E F9 stc 4183 00001A6F C3 retn 4184 4185 lff32m2_0: 4186 ; 01/12/2024 4187 ; edi = audio buffer address 4188 00001A70 BE[00500200] mov esi, temp_buffer ; temporary buffer for wav data 4189 ;mov edx, [loadsize] 4190 4191 ; esi = buffer address 4192 ;; edx = buffer size 4193 4194 ; load file into memory 4195 sys _read, [filehandle], esi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 00001A75 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 00001A7B 89F1 <1> mov ecx, %3 98 <1> %if %0 = 4 99 00001A7D 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 00001A83 B803000000 <1> mov eax, %1 104 <1> 105 00001A88 CD40 <1> int 40h 4196 00001A8A 7241 jc short lff32m2_7 ; error ! 4197 4198 ; 01/12/2024 4199 00001A8C A3[B4390000] mov [count], eax 4200 ;;; 4201 ; 29/05/2024 4202 ;mov edi, [audio_buffer] 4203 ;;; 4204 00001A91 D1E8 shr eax, 1 4205 00001A93 7505 jnz short lff32m2_8 4206 00001A95 E9F0F6FFFF jmp lff32_eof 4207 4208 lff32m2_8: 4209 00001A9A 89C1 mov ecx, eax ; word count 4210 lff32m2_1: 4211 00001A9C 66AD lodsw 4212 00001A9E 66AB stosw ; original sample (left channel) 4213 00001AA0 66AB stosw ; original sample (right channel) 4214 00001AA2 80C480 add ah, 80h ; convert sound level 0 to 65535 format 4215 ;mov [previous_val], ax 4216 ;mov ebx, eax 4217 ;xor eax, eax 4218 ; 02/02/2025 4219 ;mov ax, [esi] 4220 00001AA5 668B1E mov bx, [esi] 4221 00001AA8 49 dec ecx 4222 00001AA9 7502 jnz short lff32m2_2 4223 00001AAB 31DB xor ebx, ebx 4224 lff32m2_2: 4225 ; 02/02/2025 4226 00001AAD 80C780 add bh, 80h ; convert sound level 0 to 65535 format 4227 ;add ah, 80h 4228 ;mov ebp, eax ; [next_val] 4229 ;add ax, [previous_val] 4230 ; ax = [previous_val] 4231 ; bx = [next_val] 4232 00001AB0 6601D8 add ax, bx 4233 00001AB3 66D1D8 rcr ax, 1 4234 00001AB6 80EC80 sub ah, 80h ; -32768 to +32767 format again 4235 00001AB9 66AB stosw ; this is interpolated sample (L) 4236 00001ABB 66AB stosw ; this is interpolated sample (R) 4237 4238 ; different than 8-16-24 kHZ ! 4239 ; 'original-interpolated-original' trio samples 4240 00001ABD E309 jecxz lff32m2_3 4241 4242 00001ABF 66AD lodsw 4243 00001AC1 66AB stosw ; original sample (left channel) 4244 00001AC3 66AB stosw ; original sample (right channel) 4245 4246 ; 32 kHZ mono to 48 kHZ stereo conversion of the sample is OK 4247 00001AC5 49 dec ecx 4248 00001AC6 75D4 jnz short lff32m2_1 4249 lff32m2_3: 4250 00001AC8 E9A5F6FFFF jmp lff32_3 4251 4252 lff32m2_7: 4253 lff32s2_7: 4254 00001ACD E9C1F6FFFF jmp lff32_5 ; error 4255 4256 load_32khz_stereo_16_bit: 4257 ; 02/02/2025 4258 ; 16/11/2023 4259 ; 15/11/2023 4260 00001AD2 F605[2E390000]01 test byte [flags], ENDOFFILE ; have we already read the 4261 ; last of the file? 4262 00001AD9 7402 jz short lff32s2_0 ; no 4263 00001ADB F9 stc 4264 00001ADC C3 retn 4265 4266 lff32s2_0: 4267 ; 01/12/2024 4268 ; edi = audio buffer address 4269 00001ADD BE[00500200] mov esi, temp_buffer ; temporary buffer for wav data 4270 ;mov edx, [loadsize] 4271 4272 ; esi = buffer address 4273 ;; edx = buffer size 4274 4275 ; load file into memory 4276 sys _read, [filehandle], esi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 00001AE2 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 00001AE8 89F1 <1> mov ecx, %3 98 <1> %if %0 = 4 99 00001AEA 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 00001AF0 B803000000 <1> mov eax, %1 104 <1> 105 00001AF5 CD40 <1> int 40h 4277 00001AF7 72D4 jc short lff32s2_7 ; error ! 4278 4279 ; 01/12/2024 4280 00001AF9 A3[B4390000] mov [count], eax 4281 ;;; 4282 ; 29/05/2024 4283 ;mov edi, [audio_buffer] 4284 ;;; 4285 00001AFE C1E802 shr eax, 2 4286 00001B01 7505 jnz short lff32s2_8 4287 00001B03 E982F6FFFF jmp lff32_eof 4288 4289 lff32s2_8: 4290 00001B08 89C1 mov ecx, eax ; dword count 4291 lff32s2_1: 4292 00001B0A 66AD lodsw 4293 00001B0C 66AB stosw ; original sample (L) 4294 00001B0E 80C480 add ah, 80h ; convert sound level 0 to 65535 format 4295 00001B11 66A3[31280000] mov [previous_val_l], ax 4296 00001B17 66AD lodsw 4297 00001B19 66AB stosw ; original sample (R) 4298 00001B1B 80C480 add ah, 80h ; convert sound level 0 to 65535 format 4299 ;mov [previous_val_r], ax 4300 00001B1E 89C3 mov ebx, eax 4301 ; 02/02/2025 4302 00001B20 668B06 mov ax, [esi] 4303 00001B23 668B5602 mov dx, [esi+2] 4304 ; 16/11/2023 4305 00001B27 49 dec ecx 4306 00001B28 7504 jnz short lff32s2_2 4307 00001B2A 31D2 xor edx, edx 4308 00001B2C 31C0 xor eax, eax 4309 lff32s2_2: 4310 00001B2E 80C480 add ah, 80h ; convert sound level 0 to 65535 format 4311 ;;mov [next_val_l], ax 4312 ;mov ebp, eax 4313 00001B31 80C680 add dh, 80h ; convert sound level 0 to 65535 format 4314 ;mov [next_val_r], dx 4315 00001B34 660305[31280000] add ax, [previous_val_l] 4316 00001B3B 66D1D8 rcr ax, 1 4317 00001B3E 80EC80 sub ah, 80h ; -32768 to +32767 format again 4318 00001B41 66AB stosw ; this is interpolated sample (L) 4319 ;mov ax, [next_val_r] 4320 00001B43 89D0 mov eax, edx 4321 ;add ax, [previous_val_r] 4322 00001B45 6601D8 add ax, bx 4323 00001B48 66D1D8 rcr ax, 1 4324 00001B4B 80EC80 sub ah, 80h ; -32768 to +32767 format again 4325 00001B4E 66AB stosw ; this is interpolated sample (R) 4326 4327 ; different than 8-16-24 kHZ ! 4328 ; 'original-interpolated-original' trio samples 4329 00001B50 E30B jecxz lff32s2_3 4330 4331 00001B52 66AD lodsw 4332 00001B54 66AB stosw ; original sample (L) 4333 00001B56 66AD lodsw 4334 00001B58 66AB stosw ; original sample (R) 4335 4336 ; 32 kHZ stereo to 48 kHZ stereo conversion of the sample is OK 4337 00001B5A 49 dec ecx 4338 00001B5B 75AD jnz short lff32s2_1 4339 lff32s2_3: 4340 00001B5D E910F6FFFF jmp lff32_3 4341 4342 ; ..................... 4343 4344 load_22khz_mono_8_bit: 4345 ; 02/02/2025 4346 ; 16/11/2023 4347 00001B62 F605[2E390000]01 test byte [flags], ENDOFFILE ; have we already read the 4348 ; last of the file? 4349 00001B69 7402 jz short lff22m_0 ; no 4350 00001B6B F9 stc 4351 00001B6C C3 retn 4352 4353 lff22m_0: 4354 ; 01/12/2024 4355 ; edi = audio buffer address 4356 00001B6D BE[00500200] mov esi, temp_buffer ; temporary buffer for wav data 4357 ;mov edx, [loadsize] 4358 4359 ; esi = buffer address 4360 ;; edx = buffer size 4361 4362 ; load file into memory 4363 sys _read, [filehandle], esi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 00001B72 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 00001B78 89F1 <1> mov ecx, %3 98 <1> %if %0 = 4 99 00001B7A 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 00001B80 B803000000 <1> mov eax, %1 104 <1> 105 00001B85 CD40 <1> int 40h 4364 00001B87 725D jc short lff22m_7 ; error ! 4365 4366 ; 01/12/2024 4367 00001B89 A3[B4390000] mov [count], eax 4368 ;;; 4369 ; 29/05/2024 4370 ;mov edi, [audio_buffer] 4371 ;;; 4372 00001B8E 21C0 and eax, eax 4373 00001B90 7505 jnz short lff22m_8 4374 00001B92 E9F3F5FFFF jmp lff22_eof 4375 4376 lff22m_8: 4377 00001B97 89C1 mov ecx, eax ; byte count 4378 lff22m_9: 4379 00001B99 BD05000000 mov ebp, 5 ; interpolation (one step) loop count 4380 00001B9E C605[39280000]03 mov byte [faz], 3 ; 3 steps/phases 4381 lff22m_1: 4382 ; 3:2:2:2:2:2::3:2:2:2:2::3:2:2:2:2:2 ; 37/17 4383 00001BA5 AC lodsb 4384 ; 02/02/2025 4385 00001BA6 8A16 mov dl, [esi] 4386 00001BA8 49 dec ecx 4387 00001BA9 7502 jnz short lff22m_2_1 4388 00001BAB B280 mov dl, 80h 4389 lff22m_2_1: 4390 ; al = [previous_val] 4391 ; dl = [next_val] 4392 00001BAD E835070000 call interpolating_3_8bit_mono ; 1 of 17 4393 00001BB2 E32D jecxz lff22m_3 4394 lff22m_2_2: 4395 00001BB4 AC lodsb 4396 ; 02/02/2025 4397 00001BB5 8A16 mov dl, [esi] 4398 00001BB7 49 dec ecx 4399 00001BB8 7502 jnz short lff22m_2_3 4400 00001BBA B280 mov dl, 80h 4401 lff22m_2_3: 4402 00001BBC E8B0070000 call interpolating_2_8bit_mono ; 2 of 17 .. 6 of 17 4403 00001BC1 E31E jecxz lff22m_3 4404 00001BC3 4D dec ebp 4405 00001BC4 75EE jnz short lff22m_2_2 4406 4407 00001BC6 A0[39280000] mov al, [faz] 4408 00001BCB FEC8 dec al 4409 00001BCD 74CA jz short lff22m_9 4410 00001BCF FE0D[39280000] dec byte [faz] 4411 00001BD5 BD04000000 mov ebp, 4 4412 00001BDA FEC8 dec al 4413 00001BDC 75C7 jnz short lff22m_1 ; 3:2:2:2:2 ; 7-11 of 17 4414 00001BDE 45 inc ebp ; 5 4415 00001BDF EBC4 jmp short lff22m_1 ; 3:2:2:2:2:2 ; 12-17 of 17 4416 4417 lff22m_3: 4418 lff22s_3: 4419 00001BE1 E98CF5FFFF jmp lff22_3 ; padfill 4420 ; (put zeros in the remain words of the buffer) 4421 lff22m_7: 4422 lff22s_7: 4423 00001BE6 E9A8F5FFFF jmp lff22_5 ; error 4424 4425 load_22khz_stereo_8_bit: 4426 ; 02/02/2025 4427 ; 16/11/2023 4428 00001BEB F605[2E390000]01 test byte [flags], ENDOFFILE ; have we already read the 4429 ; last of the file? 4430 00001BF2 7402 jz short lff22s_0 ; no 4431 00001BF4 F9 stc 4432 00001BF5 C3 retn 4433 4434 lff22s_0: 4435 ; 01/12/2024 4436 ; edi = audio buffer address 4437 00001BF6 BE[00500200] mov esi, temp_buffer ; temporary buffer for wav data 4438 ;mov edx, [loadsize] 4439 4440 ; esi = buffer address 4441 ;; edx = buffer size 4442 4443 ; load file into memory 4444 sys _read, [filehandle], esi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 00001BFB 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 00001C01 89F1 <1> mov ecx, %3 98 <1> %if %0 = 4 99 00001C03 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 00001C09 B803000000 <1> mov eax, %1 104 <1> 105 00001C0E CD40 <1> int 40h 4445 00001C10 72D4 jc short lff22s_7 ; error ! 4446 4447 ; 01/12/2024 4448 00001C12 A3[B4390000] mov [count], eax 4449 ;;; 4450 ; 29/05/2024 4451 ;mov edi, [audio_buffer] 4452 ;;; 4453 00001C17 D1E8 shr eax, 1 4454 00001C19 7505 jnz short lff22s_8 4455 00001C1B E96AF5FFFF jmp lff22_eof 4456 4457 lff22s_8: 4458 00001C20 89C1 mov ecx, eax ; word count 4459 lff22s_9: 4460 00001C22 BD05000000 mov ebp, 5 ; interpolation (one step) loop count 4461 00001C27 C605[39280000]03 mov byte [faz], 3 ; 3 steps/phase 4462 lff22s_1: 4463 ; 3:2:2:2:2:2::3:2:2:2:2::3:2:2:2:2:2 ; 37/17 4464 00001C2E 66AD lodsw 4465 ; 02/02/2025 4466 00001C30 668B16 mov dx, [esi] 4467 00001C33 49 dec ecx 4468 00001C34 7504 jnz short lff22s_2_1 4469 00001C36 66BA8080 mov dx, 8080h 4470 lff22s_2_1: 4471 ; al = [previous_val_l] 4472 ; ah = [previous_val_r] 4473 ; dl = [next_val_l] 4474 ; dh = [next_val_r] 4475 00001C3A E8DB060000 call interpolating_3_8bit_stereo ; 1 of 17 4476 00001C3F E3A0 jecxz lff22s_3 4477 lff22s_2_2: 4478 00001C41 66AD lodsw 4479 ; 02/02/2025 4480 00001C43 668B16 mov dx, [esi] 4481 00001C46 49 dec ecx 4482 00001C47 7504 jnz short lff22s_2_3 4483 00001C49 66BA8080 mov dx, 8080h 4484 lff22s_2_3: 4485 00001C4D E83C070000 call interpolating_2_8bit_stereo ; 2 of 17 .. 6 of 17 4486 00001C52 E38D jecxz lff22s_3 4487 00001C54 4D dec ebp 4488 00001C55 75EA jnz short lff22s_2_2 4489 4490 00001C57 A0[39280000] mov al, [faz] 4491 00001C5C FEC8 dec al 4492 00001C5E 74C2 jz short lff22s_9 4493 00001C60 FE0D[39280000] dec byte [faz] 4494 00001C66 BD04000000 mov ebp, 4 4495 00001C6B FEC8 dec al 4496 00001C6D 75BF jnz short lff22s_1 ; 3:2:2:2:2 ; 7-11 of 17 4497 00001C6F 45 inc ebp ; 5 4498 00001C70 EBBC jmp short lff22s_1 ; 3:2:2:2:2:2 ; 12-17 of 17 4499 4500 load_22khz_mono_16_bit: 4501 ; 02/02/2025 4502 ; 16/11/2023 4503 00001C72 F605[2E390000]01 test byte [flags], ENDOFFILE ; have we already read the 4504 ; last of the file? 4505 00001C79 7402 jz short lff22m2_0 ; no 4506 00001C7B F9 stc 4507 00001C7C C3 retn 4508 4509 lff22m2_0: 4510 ; 01/12/2024 4511 ; edi = audio buffer address 4512 00001C7D BE[00500200] mov esi, temp_buffer ; temporary buffer for wav data 4513 ;mov edx, [loadsize] 4514 4515 ; esi = buffer address 4516 ;; edx = buffer size 4517 4518 ; load file into memory 4519 sys _read, [filehandle], esi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 00001C82 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 00001C88 89F1 <1> mov ecx, %3 98 <1> %if %0 = 4 99 00001C8A 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 00001C90 B803000000 <1> mov eax, %1 104 <1> 105 00001C95 CD40 <1> int 40h 4520 00001C97 7261 jc short lff22m2_7 ; error ! 4521 4522 ; 01/12/2024 4523 00001C99 A3[B4390000] mov [count], eax 4524 ;;; 4525 ; 29/05/2024 4526 ;mov edi, [audio_buffer] 4527 ;;; 4528 00001C9E D1E8 shr eax, 1 4529 00001CA0 7505 jnz short lff22m2_8 4530 00001CA2 E9E3F4FFFF jmp lff22_eof 4531 4532 lff22m2_8: 4533 00001CA7 89C1 mov ecx, eax ; word count 4534 lff22m2_9: 4535 00001CA9 BD05000000 mov ebp, 5 ; interpolation (one step) loop count 4536 00001CAE C605[39280000]03 mov byte [faz], 3 ; 3 steps/phases 4537 lff22m2_1: 4538 ; 3:2:2:2:2:2::3:2:2:2:2::3:2:2:2:2:2 ; 37/17 4539 00001CB5 66AD lodsw 4540 ; 02/02/2025 4541 00001CB7 668B16 mov dx, [esi] 4542 00001CBA 49 dec ecx 4543 00001CBB 7502 jnz short lff22m2_2_1 4544 00001CBD 31D2 xor edx, edx 4545 lff22m2_2_1: 4546 ; ax = [previous_val] 4547 ; dx = [next_val] 4548 00001CBF E8FB060000 call interpolating_3_16bit_mono ; 1 of 17 4549 00001CC4 E32F jecxz lff22m2_3 4550 lff22m2_2_2: 4551 00001CC6 66AD lodsw 4552 ; 02/02/2025 4553 00001CC8 668B16 mov dx, [esi] 4554 00001CCB 49 dec ecx 4555 00001CCC 7502 jnz short lff22m2_2_3 4556 00001CCE 31D2 xor edx, edx 4557 lff22m2_2_3: 4558 00001CD0 E87D070000 call interpolating_2_16bit_mono ; 2 of 17 .. 6 of 17 4559 00001CD5 E31E jecxz lff22m2_3 4560 00001CD7 4D dec ebp 4561 00001CD8 75EC jnz short lff22m2_2_2 4562 4563 00001CDA A0[39280000] mov al, [faz] 4564 00001CDF FEC8 dec al 4565 00001CE1 74C6 jz short lff22m2_9 4566 00001CE3 FE0D[39280000] dec byte [faz] 4567 00001CE9 BD04000000 mov ebp, 4 4568 00001CEE FEC8 dec al 4569 00001CF0 75C3 jnz short lff22m2_1 ; 3:2:2:2:2 ; 7-11 of 17 4570 00001CF2 45 inc ebp ; 5 4571 00001CF3 EBC0 jmp short lff22m2_1 ; 3:2:2:2:2:2 ; 12-17 of 17 4572 4573 lff22m2_3: 4574 lff22s2_3: 4575 00001CF5 E978F4FFFF jmp lff22_3 ; padfill 4576 ; (put zeros in the remain words of the buffer) 4577 lff22m2_7: 4578 lff22s2_7: 4579 00001CFA E994F4FFFF jmp lff22_5 ; error 4580 4581 load_22khz_stereo_16_bit: 4582 ; 16/11/2023 4583 00001CFF F605[2E390000]01 test byte [flags], ENDOFFILE ; have we already read the 4584 ; last of the file? 4585 00001D06 7402 jz short lff22s2_0 ; no 4586 00001D08 F9 stc 4587 00001D09 C3 retn 4588 4589 lff22s2_0: 4590 ; 01/12/2024 4591 ; edi = audio buffer address 4592 00001D0A BE[00500200] mov esi, temp_buffer ; temporary buffer for wav data 4593 ;mov edx, [loadsize] 4594 4595 ; esi = buffer address 4596 ;; edx = buffer size 4597 4598 ; load file into memory 4599 sys _read, [filehandle], esi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 00001D0F 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 00001D15 89F1 <1> mov ecx, %3 98 <1> %if %0 = 4 99 00001D17 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 00001D1D B803000000 <1> mov eax, %1 104 <1> 105 00001D22 CD40 <1> int 40h 4600 00001D24 72D4 jc short lff22s2_7 ; error ! 4601 4602 ; 01/12/2024 4603 00001D26 A3[B4390000] mov [count], eax 4604 ;;; 4605 ; 29/05/2024 4606 ;mov edi, [audio_buffer] 4607 ;;; 4608 00001D2B C1E802 shr eax, 2 ; dword (left chan word + right chan word) 4609 00001D2E 7505 jnz short lff22s2_8 4610 00001D30 E955F4FFFF jmp lff22_eof 4611 4612 lff22s2_8: 4613 00001D35 89C1 mov ecx, eax ; dword count 4614 lff22s2_9: 4615 00001D37 BD05000000 mov ebp, 5 ; interpolation (one step) loop count 4616 00001D3C C605[39280000]03 mov byte [faz], 3 ; 3 steps/phase 4617 lff22s2_1: 4618 ; 3:2:2:2:2:2::3:2:2:2:2::3:2:2:2:2:2 ; 37/17 4619 00001D43 66AD lodsw 4620 00001D45 89C3 mov ebx, eax 4621 00001D47 66AD lodsw 4622 00001D49 8B16 mov edx, [esi] 4623 00001D4B 668915[35280000] mov [next_val_l], dx 4624 ; 26/11/2023 4625 00001D52 C1EA10 shr edx, 16 4626 00001D55 49 dec ecx 4627 00001D56 7509 jnz short lff22s2_2_1 4628 00001D58 31D2 xor edx, edx ; 0 4629 00001D5A 668915[35280000] mov [next_val_l], dx 4630 lff22s2_2_1: 4631 ; bx = [previous_val_l] 4632 ; ax = [previous_val_r] 4633 ; [next_val_l] 4634 ; dx = [next_val_r] 4635 00001D61 E889060000 call interpolating_3_16bit_stereo ; 1 of 17 4636 00001D66 E38D jecxz lff22s2_3 4637 lff22s2_2_2: 4638 00001D68 66AD lodsw 4639 00001D6A 89C3 mov ebx, eax 4640 00001D6C 66AD lodsw 4641 00001D6E 8B16 mov edx, [esi] 4642 00001D70 668915[35280000] mov [next_val_l], dx 4643 ; 26/11/2023 4644 00001D77 C1EA10 shr edx, 16 4645 00001D7A 49 dec ecx 4646 00001D7B 7509 jnz short lff22s2_2_3 4647 00001D7D 31D2 xor edx, edx ; 0 4648 00001D7F 668915[35280000] mov [next_val_l], dx 4649 lff22s2_2_3: 4650 00001D86 E8DF060000 call interpolating_2_16bit_stereo ; 2 of 17 .. 6 of 17 4651 00001D8B E31E jecxz lff22s2_2_4 4652 4653 00001D8D 4D dec ebp 4654 00001D8E 75D8 jnz short lff22s2_2_2 4655 4656 00001D90 A0[39280000] mov al, [faz] 4657 00001D95 FEC8 dec al 4658 00001D97 749E jz short lff22s2_9 4659 00001D99 FE0D[39280000] dec byte [faz] 4660 00001D9F BD04000000 mov ebp, 4 4661 00001DA4 FEC8 dec al 4662 00001DA6 759B jnz short lff22s2_1 ; 3:2:2:2:2 ; 7-11 of 17 4663 00001DA8 45 inc ebp ; 5 4664 00001DA9 EB98 jmp short lff22s2_1 ; 3:2:2:2:2:2 ; 12-17 of 17 4665 4666 lff22s2_2_4: 4667 ; 26/11/2023 4668 00001DAB E9C2F3FFFF jmp lff22_3 ; padfill 4669 4670 ; ..................... 4671 4672 load_11khz_mono_8_bit: 4673 ; 02/02/2025 4674 ; 18/11/2023 4675 00001DB0 F605[2E390000]01 test byte [flags], ENDOFFILE ; have we already read the 4676 ; last of the file? 4677 00001DB7 7402 jz short lff11m_0 ; no 4678 00001DB9 F9 stc 4679 00001DBA C3 retn 4680 4681 lff11m_0: 4682 ; 01/12/2024 4683 ; edi = audio buffer address 4684 00001DBB BE[00500200] mov esi, temp_buffer ; temporary buffer for wav data 4685 ;mov edx, [loadsize] 4686 4687 ; esi = buffer address 4688 ;; edx = buffer size 4689 4690 ; load file into memory 4691 sys _read, [filehandle], esi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 00001DC0 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 00001DC6 89F1 <1> mov ecx, %3 98 <1> %if %0 = 4 99 00001DC8 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 00001DCE B803000000 <1> mov eax, %1 104 <1> 105 00001DD3 CD40 <1> int 40h 4692 00001DD5 7247 jc short lff11m_7 ; error ! 4693 4694 ; 01/12/2024 4695 00001DD7 A3[B4390000] mov [count], eax 4696 ;;; 4697 ; 29/05/2024 4698 ;mov edi, [audio_buffer] 4699 ;;; 4700 00001DDC 21C0 and eax, eax 4701 00001DDE 7505 jnz short lff11m_8 4702 00001DE0 E9A5F3FFFF jmp lff11_eof 4703 4704 lff11m_8: 4705 00001DE5 89C1 mov ecx, eax ; byte count 4706 lff11m_9: 4707 00001DE7 BD06000000 mov ebp, 6 ; interpolation (one step) loop count 4708 lff11m_1: 4709 ; 5:4:4::5:4:4::5:4:4::5:4:4::5:4:4::5:4 ; 74/17 4710 00001DEC AC lodsb 4711 ; 02/02/2025 4712 00001DED 8A16 mov dl, [esi] 4713 00001DEF 49 dec ecx 4714 00001DF0 7502 jnz short lff11m_2_1 4715 00001DF2 B280 mov dl, 80h 4716 lff11m_2_1: 4717 ; al = [previous_val] 4718 ; dl = [next_val] 4719 00001DF4 E8A0060000 call interpolating_5_8bit_mono 4720 00001DF9 E328 jecxz lff11m_3 4721 lff11m_2_2: 4722 00001DFB AC lodsb 4723 ; 02/02/2025 4724 00001DFC 8A16 mov dl, [esi] 4725 00001DFE 49 dec ecx 4726 00001DFF 7502 jnz short lff11m_2_3 4727 00001E01 B280 mov dl, 80h 4728 lff11m_2_3: 4729 00001E03 E89D070000 call interpolating_4_8bit_mono 4730 00001E08 E319 jecxz lff11m_3 4731 4732 00001E0A 4D dec ebp 4733 00001E0B 74DA jz short lff11m_9 4734 4735 00001E0D AC lodsb 4736 ; 02/02/2025 4737 00001E0E 8A16 mov dl, [esi] 4738 00001E10 49 dec ecx 4739 00001E11 7502 jnz short lff11m_2_4 4740 00001E13 B280 mov dl, 80h 4741 lff11m_2_4: 4742 00001E15 E88B070000 call interpolating_4_8bit_mono 4743 00001E1A E307 jecxz lff11m_3 4744 00001E1C EBCE jmp short lff11m_1 4745 4746 lff11m_7: 4747 lff11s_7: 4748 00001E1E E970F3FFFF jmp lff11_5 ; error 4749 4750 lff11m_3: 4751 lff11s_3: 4752 00001E23 E94AF3FFFF jmp lff11_3 ; padfill 4753 ; (put zeros in the remain words of the buffer) 4754 4755 load_11khz_stereo_8_bit: 4756 ; 02/02/2025 4757 ; 18/11/2023 4758 00001E28 F605[2E390000]01 test byte [flags], ENDOFFILE ; have we already read the 4759 ; last of the file? 4760 00001E2F 7402 jz short lff11s_0 ; no 4761 00001E31 F9 stc 4762 00001E32 C3 retn 4763 4764 lff11s_0: 4765 ; 01/12/2024 4766 ; edi = audio buffer address 4767 00001E33 BE[00500200] mov esi, temp_buffer ; temporary buffer for wav data 4768 ;mov edx, [loadsize] 4769 4770 ; esi = buffer address 4771 ;; edx = buffer size 4772 4773 ; load file into memory 4774 sys _read, [filehandle], esi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 00001E38 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 00001E3E 89F1 <1> mov ecx, %3 98 <1> %if %0 = 4 99 00001E40 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 00001E46 B803000000 <1> mov eax, %1 104 <1> 105 00001E4B CD40 <1> int 40h 4775 00001E4D 72CF jc short lff11s_7 ; error ! 4776 4777 ; 01/12/2024 4778 00001E4F A3[B4390000] mov [count], eax 4779 ;;; 4780 ; 29/05/2024 4781 ;mov edi, [audio_buffer] 4782 ;;; 4783 00001E54 D1E8 shr eax, 1 4784 00001E56 7505 jnz short lff11s_8 4785 00001E58 E92DF3FFFF jmp lff11_eof 4786 4787 lff11s_8: 4788 00001E5D 89C1 mov ecx, eax ; word count 4789 lff11s_9: 4790 00001E5F BD06000000 mov ebp, 6 ; interpolation (one step) loop count 4791 lff11s_1: 4792 ; 5:4:4::5:4:4::5:4:4::5:4:4::5:4:4::5:4 ; 74/17 4793 00001E64 66AD lodsw 4794 ; 02/02/2025 4795 00001E66 668B16 mov dx, [esi] 4796 00001E69 49 dec ecx 4797 00001E6A 7504 jnz short lff11s_2_1 4798 00001E6C 66BA8080 mov dx, 8080h 4799 lff11s_2_1: 4800 ; al = [previous_val_l] 4801 ; ah = [previous_val_r] 4802 ; dl = [next_val_l] 4803 ; dh = [next_val_r] 4804 00001E70 E883060000 call interpolating_5_8bit_stereo 4805 00001E75 E3AC jecxz lff11s_3 4806 lff11s_2_2: 4807 00001E77 66AD lodsw 4808 ; 02/02/2025 4809 00001E79 668B16 mov dx, [esi] 4810 00001E7C 49 dec ecx 4811 00001E7D 7504 jnz short lff11s_2_3 4812 00001E7F 66BA8080 mov dx, 8080h 4813 lff11s_2_3: 4814 00001E83 E85C070000 call interpolating_4_8bit_stereo 4815 00001E88 E399 jecxz lff11s_3 4816 4817 00001E8A 4D dec ebp 4818 00001E8B 74D2 jz short lff11s_9 4819 4820 00001E8D 66AD lodsw 4821 ; 02/02/2025 4822 00001E8F 668B16 mov dx, [esi] 4823 00001E92 49 dec ecx 4824 00001E93 7504 jnz short lff11s_2_4 4825 00001E95 66BA8080 mov dx, 8080h 4826 lff11s_2_4: 4827 00001E99 E846070000 call interpolating_4_8bit_stereo 4828 00001E9E E383 jecxz lff11s_3 4829 00001EA0 EBC2 jmp short lff11s_1 4830 4831 load_11khz_mono_16_bit: 4832 ; 02/02/2025 4833 ; 18/11/2023 4834 00001EA2 F605[2E390000]01 test byte [flags], ENDOFFILE ; have we already read the 4835 ; last of the file? 4836 00001EA9 7402 jz short lff11m2_0 ; no 4837 00001EAB F9 stc 4838 00001EAC C3 retn 4839 4840 lff11m2_0: 4841 ; 01/12/2024 4842 ; edi = audio buffer address 4843 00001EAD BE[00500200] mov esi, temp_buffer ; temporary buffer for wav data 4844 ;mov edx, [loadsize] 4845 4846 ; esi = buffer address 4847 ;; edx = buffer size 4848 4849 ; load file into memory 4850 sys _read, [filehandle], esi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 00001EB2 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 00001EB8 89F1 <1> mov ecx, %3 98 <1> %if %0 = 4 99 00001EBA 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 00001EC0 B803000000 <1> mov eax, %1 104 <1> 105 00001EC5 CD40 <1> int 40h 4851 00001EC7 724D jc short lff11m2_7 ; error ! 4852 4853 ; 01/12/2024 4854 00001EC9 A3[B4390000] mov [count], eax 4855 ;;; 4856 ; 29/05/2024 4857 ;mov edi, [audio_buffer] 4858 ;;; 4859 00001ECE D1E8 shr eax, 1 4860 00001ED0 7505 jnz short lff11m2_8 4861 00001ED2 E9B3F2FFFF jmp lff11_eof 4862 4863 lff11m2_8: 4864 00001ED7 89C1 mov ecx, eax ; word count 4865 lff11m2_9: 4866 00001ED9 BD06000000 mov ebp, 6 ; interpolation (one step) loop count 4867 lff11m2_1: 4868 ; 5:4:4::5:4:4::5:4:4::5:4:4::5:4:4::5:4 ; 74/17 4869 00001EDE 66AD lodsw 4870 ; 02/02/2025 4871 00001EE0 668B16 mov dx, [esi] 4872 00001EE3 49 dec ecx 4873 00001EE4 7502 jnz short lff11m2_2_1 4874 00001EE6 31D2 xor edx, edx 4875 lff11m2_2_1: 4876 ; ax = [previous_val] 4877 ; dx = [next_val] 4878 00001EE8 E864070000 call interpolating_5_16bit_mono 4879 00001EED E362 jecxz lff11m2_3 4880 lff11m2_2_2: 4881 00001EEF 66AD lodsw 4882 ; 02/02/2025 4883 00001EF1 668B16 mov dx, [esi] 4884 00001EF4 49 dec ecx 4885 00001EF5 7502 jnz short lff11m2_2_3 4886 00001EF7 31D2 xor edx, edx 4887 lff11m2_2_3: 4888 00001EF9 E87D080000 call interpolating_4_16bit_mono 4889 00001EFE E351 jecxz lff11m2_3 4890 4891 00001F00 4D dec ebp 4892 00001F01 74D6 jz short lff11m2_9 4893 4894 00001F03 66AD lodsw 4895 ; 02/02/2025 4896 00001F05 668B16 mov dx, [esi] 4897 00001F08 49 dec ecx 4898 00001F09 7502 jnz short lff11m2_2_4 4899 00001F0B 31D2 xor edx, edx 4900 lff11m2_2_4: 4901 00001F0D E869080000 call interpolating_4_16bit_mono 4902 00001F12 E33D jecxz lff11m2_3 4903 00001F14 EBC8 jmp short lff11m2_1 4904 4905 lff11m2_7: 4906 lff11s2_7: 4907 00001F16 E978F2FFFF jmp lff11_5 ; error 4908 4909 load_11khz_stereo_16_bit: 4910 ; 17/01/2025 4911 ; 18/11/2023 4912 00001F1B F605[2E390000]01 test byte [flags], ENDOFFILE ; have we already read the 4913 ; last of the file? 4914 00001F22 7402 jz short lff11s2_0 ; no 4915 00001F24 F9 stc 4916 00001F25 C3 retn 4917 4918 lff11s2_0: 4919 ; 01/12/2024 4920 ; edi = audio buffer address 4921 00001F26 BE[00500200] mov esi, temp_buffer ; temporary buffer for wav data 4922 ;mov edx, [loadsize] 4923 4924 ; esi = buffer address 4925 ;; edx = buffer size 4926 4927 ; load file into memory 4928 sys _read, [filehandle], esi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 00001F2B 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 00001F31 89F1 <1> mov ecx, %3 98 <1> %if %0 = 4 99 00001F33 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 00001F39 B803000000 <1> mov eax, %1 104 <1> 105 00001F3E CD40 <1> int 40h 4929 00001F40 72D4 jc short lff11s2_7 ; error ! 4930 4931 ; 01/12/2024 4932 00001F42 A3[B4390000] mov [count], eax 4933 ;;; 4934 ; 29/05/2024 4935 ;mov edi, [audio_buffer] 4936 ;;; 4937 00001F47 C1E802 shr eax, 2 ; dword (left chan word + right chan word) 4938 00001F4A 750A jnz short lff11s2_8 4939 00001F4C E939F2FFFF jmp lff11_eof 4940 4941 lff11m2_3: 4942 lff11s2_3: 4943 00001F51 E91CF2FFFF jmp lff11_3 ; padfill 4944 ; (put zeros in the remain words of the buffer) 4945 4946 lff11s2_8: 4947 00001F56 89C1 mov ecx, eax ; dword count 4948 lff11s2_9: 4949 00001F58 BD06000000 mov ebp, 6 ; interpolation (one step) loop count 4950 lff11s2_1: 4951 ; 5:4:4::5:4:4::5:4:4::5:4:4::5:4:4::5:4 ; 74/17 4952 00001F5D 66AD lodsw 4953 00001F5F 89C3 mov ebx, eax 4954 00001F61 66AD lodsw 4955 00001F63 8B16 mov edx, [esi] 4956 ; 17/01/2025 4957 ;mov [next_val_l], edx 4958 ; 26/11/2023 4959 ;shr edx, 16 4960 ;mov [next_val_r], dx 4961 00001F65 49 dec ecx 4962 00001F66 7502 jnz short lff11s2_2_1 4963 00001F68 31D2 xor edx, edx ; 0 4964 ;mov [next_val_l], dx 4965 ;mov [next_val_r], dx 4966 lff11s2_2_1: 4967 ; bx = [previous_val_l] 4968 ; ax = [previous_val_r] 4969 ; [next_val_l] 4970 ; dx = [next_val_r] 4971 ;;; 4972 ; 17/01/2025 (BugFix) 4973 00001F6A 8915[35280000] mov [next_val_l], edx 4974 ;;; 4975 00001F70 E837070000 call interpolating_5_16bit_stereo 4976 00001F75 E3DA jecxz lff11s2_3 4977 lff11s2_2_2: 4978 00001F77 66AD lodsw 4979 00001F79 89C3 mov ebx, eax 4980 00001F7B 66AD lodsw 4981 00001F7D 8B16 mov edx, [esi] 4982 ; 17/01/2025 4983 ;mov [next_val_l], dx 4984 ; 26/11/2023 4985 ;shr edx, 16 4986 ;mov [next_val_r], dx 4987 00001F7F 49 dec ecx 4988 00001F80 7502 jnz short lff11s2_2_3 4989 00001F82 31D2 xor edx, edx ; 0 4990 ;mov [next_val_l], dx 4991 ;mov [next_val_r], dx 4992 lff11s2_2_3: 4993 ;;; 4994 ; 17/01/2025 (BugFix) 4995 00001F84 8915[35280000] mov [next_val_l], edx 4996 ;;; 4997 00001F8A E825080000 call interpolating_4_16bit_stereo 4998 00001F8F E3C0 jecxz lff11s2_3 4999 5000 00001F91 4D dec ebp 5001 00001F92 74C4 jz short lff11s2_9 5002 5003 00001F94 66AD lodsw 5004 00001F96 89C3 mov ebx, eax 5005 00001F98 66AD lodsw 5006 00001F9A 8B16 mov edx, [esi] 5007 ; 17/01/2025 5008 ;mov [next_val_l], dx 5009 ; 26/11/2023 5010 ;shr edx, 16 5011 ;mov [next_val_r], dx 5012 00001F9C 49 dec ecx 5013 00001F9D 7502 jnz short lff11s2_2_4 5014 00001F9F 31D2 xor edx, edx ; 0 5015 ;mov [next_val_l], dx 5016 ;mov [next_val_r], dx 5017 lff11s2_2_4: 5018 ;;; 5019 ; 17/01/2025 (BugFix) 5020 00001FA1 8915[35280000] mov [next_val_l], edx 5021 ;;; 5022 00001FA7 E808080000 call interpolating_4_16bit_stereo 5023 00001FAC E3A3 jecxz lff11s2_3 5024 00001FAE EBAD jmp short lff11s2_1 5025 5026 ; ..................... 5027 5028 load_44khz_mono_8_bit: 5029 ; 02/02/2025 5030 ; 18/11/2023 5031 00001FB0 F605[2E390000]01 test byte [flags], ENDOFFILE ; have we already read the 5032 ; last of the file? 5033 00001FB7 7402 jz short lff44m_0 ; no 5034 00001FB9 F9 stc 5035 00001FBA C3 retn 5036 5037 lff44m_0: 5038 ; 01/12/2024 5039 ; edi = audio buffer address 5040 00001FBB BE[00500200] mov esi, temp_buffer ; temporary buffer for wav data 5041 ;mov edx, [loadsize] 5042 5043 ; esi = buffer address 5044 ;; edx = buffer size 5045 5046 ; load file into memory 5047 sys _read, [filehandle], esi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 00001FC0 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 00001FC6 89F1 <1> mov ecx, %3 98 <1> %if %0 = 4 99 00001FC8 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 00001FCE B803000000 <1> mov eax, %1 104 <1> 105 00001FD3 CD40 <1> int 40h 5048 00001FD5 7250 jc short lff44m_7 ; error ! 5049 5050 ; 01/12/2024 5051 00001FD7 A3[B4390000] mov [count], eax 5052 ;;; 5053 ; 29/05/2024 5054 ;mov edi, [audio_buffer] 5055 ;;; 5056 00001FDC 21C0 and eax, eax 5057 00001FDE 7505 jnz short lff44m_8 5058 00001FE0 E9A5F1FFFF jmp lff44_eof 5059 5060 lff44m_8: 5061 00001FE5 89C1 mov ecx, eax ; byte count 5062 lff44m_9: 5063 00001FE7 BD0A000000 mov ebp, 10 ; interpolation (one step) loop count 5064 00001FEC C605[39280000]02 mov byte [faz], 2 ; 2 steps/phases 5065 lff44m_1: 5066 ; 2:1:1:1:1:1:1:1:1:1:1:: ; 25/23 5067 ; 2:1:1:1:1:1:1:1:1:1:1:1 5068 00001FF3 AC lodsb 5069 ; 02/02/2025 5070 00001FF4 8A16 mov dl, [esi] 5071 00001FF6 49 dec ecx 5072 00001FF7 7502 jnz short lff44m_2_1 5073 00001FF9 B280 mov dl, 80h 5074 lff44m_2_1: 5075 ; al = [previous_val] 5076 ; dl = [next_val] 5077 00001FFB E871030000 call interpolating_2_8bit_mono 5078 00002000 E320 jecxz lff44m_3 5079 lff44m_2_2: 5080 00002002 AC lodsb 5081 00002003 2C80 sub al, 80h 5082 00002005 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5083 00002009 66AB stosw ; (L) 5084 0000200B 66AB stosw ; (R) 5085 5086 0000200D 49 dec ecx 5087 0000200E 7412 jz short lff44m_3 5088 00002010 4D dec ebp 5089 00002011 75EF jnz short lff44m_2_2 5090 5091 00002013 FE0D[39280000] dec byte [faz] 5092 00002019 74CC jz short lff44m_9 5093 0000201B BD0B000000 mov ebp, 11 5094 00002020 EBD1 jmp short lff44m_1 5095 5096 lff44m_3: 5097 lff44s_3: 5098 00002022 E94BF1FFFF jmp lff44_3 ; padfill 5099 ; (put zeros in the remain words of the buffer) 5100 lff44m_7: 5101 lff44s_7: 5102 00002027 E967F1FFFF jmp lff44_5 ; error 5103 5104 load_44khz_stereo_8_bit: 5105 ; 02/02/2025 5106 ; 16/11/2023 5107 0000202C F605[2E390000]01 test byte [flags], ENDOFFILE ; have we already read the 5108 ; last of the file? 5109 00002033 7402 jz short lff44s_0 ; no 5110 00002035 F9 stc 5111 00002036 C3 retn 5112 5113 lff44s_0: 5114 ; 01/12/2024 5115 ; edi = audio buffer address 5116 00002037 BE[00500200] mov esi, temp_buffer ; temporary buffer for wav data 5117 ;mov edx, [loadsize] 5118 5119 ; esi = buffer address 5120 ;; edx = buffer size 5121 5122 ; load file into memory 5123 sys _read, [filehandle], esi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 0000203C 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 00002042 89F1 <1> mov ecx, %3 98 <1> %if %0 = 4 99 00002044 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 0000204A B803000000 <1> mov eax, %1 104 <1> 105 0000204F CD40 <1> int 40h 5124 00002051 72D4 jc short lff44s_7 ; error ! 5125 5126 ; 01/12/2024 5127 00002053 A3[B4390000] mov [count], eax 5128 ;;; 5129 ; 29/05/2024 5130 ;mov edi, [audio_buffer] 5131 ;;; 5132 00002058 D1E8 shr eax, 1 5133 0000205A 7505 jnz short lff44s_8 5134 0000205C E929F1FFFF jmp lff44_eof 5135 5136 lff44s_8: 5137 00002061 89C1 mov ecx, eax ; word count 5138 lff44s_9: 5139 00002063 BD0A000000 mov ebp, 10 ; interpolation (one step) loop count 5140 00002068 C605[39280000]02 mov byte [faz], 2 ; 2 steps/phase 5141 lff44s_1: 5142 ; 2:1:1:1:1:1:1:1:1:1:1:: ; 25/23 5143 ; 2:1:1:1:1:1:1:1:1:1:1:1 5144 0000206F 66AD lodsw 5145 ; 02/02/2025 5146 00002071 668B16 mov dx, [esi] 5147 00002074 49 dec ecx 5148 00002075 7504 jnz short lff44s_2_1 5149 00002077 66BA8080 mov dx, 8080h 5150 lff44s_2_1: 5151 ; al = [previous_val_l] 5152 ; ah = [previous_val_r] 5153 ; dl = [next_val_l] 5154 ; dh = [next_val_r] 5155 0000207B E80E030000 call interpolating_2_8bit_stereo 5156 00002080 E3A0 jecxz lff44s_3 5157 lff44s_2_2: 5158 00002082 AC lodsb 5159 00002083 2C80 sub al, 80h 5160 00002085 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5161 00002089 66AB stosw ; (L) 5162 0000208B AC lodsb 5163 0000208C 2C80 sub al, 80h 5164 0000208E 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5165 00002092 66AB stosw ; (R) 5166 5167 00002094 49 dec ecx 5168 00002095 748B jz short lff44s_3 5169 00002097 4D dec ebp 5170 00002098 75E8 jnz short lff44s_2_2 5171 5172 0000209A FE0D[39280000] dec byte [faz] 5173 000020A0 74C1 jz short lff44s_9 5174 000020A2 BD0B000000 mov ebp, 11 5175 000020A7 EBC6 jmp short lff44s_1 5176 5177 load_44khz_mono_16_bit: 5178 ; 02/02/2025 5179 ; 18/11/2023 5180 000020A9 F605[2E390000]01 test byte [flags], ENDOFFILE ; have we already read the 5181 ; last of the file? 5182 000020B0 7402 jz short lff44m2_0 ; no 5183 000020B2 F9 stc 5184 000020B3 C3 retn 5185 5186 lff44m2_0: 5187 ; 01/12/2024 5188 ; edi = audio buffer address 5189 000020B4 BE[00500200] mov esi, temp_buffer ; temporary buffer for wav data 5190 ;mov edx, [loadsize] 5191 5192 ; esi = buffer address 5193 ;; edx = buffer size 5194 5195 ; load file into memory 5196 sys _read, [filehandle], esi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 000020B9 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 000020BF 89F1 <1> mov ecx, %3 98 <1> %if %0 = 4 99 000020C1 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 000020C7 B803000000 <1> mov eax, %1 104 <1> 105 000020CC CD40 <1> int 40h 5197 000020CE 724D jc short lff44m2_7 ; error ! 5198 5199 ; 01/12/2024 5200 000020D0 A3[B4390000] mov [count], eax 5201 ;;; 5202 ; 29/05/2024 5203 ;mov edi, [audio_buffer] 5204 ;;; 5205 000020D5 D1E8 shr eax, 1 5206 000020D7 7505 jnz short lff44m2_8 5207 000020D9 E9ACF0FFFF jmp lff44_eof 5208 5209 lff44m2_8: 5210 000020DE 89C1 mov ecx, eax ; word count 5211 lff44m2_9: 5212 000020E0 BD0A000000 mov ebp, 10 ; interpolation (one step) loop count 5213 000020E5 C605[39280000]02 mov byte [faz], 2 ; 2 steps/phases 5214 lff44m2_1: 5215 ; 2:1:1:1:1:1:1:1:1:1:1:: ; 25/23 5216 ; 2:1:1:1:1:1:1:1:1:1:1:1 5217 000020EC 66AD lodsw 5218 ; 02/02/2025 5219 000020EE 668B16 mov dx, [esi] 5220 000020F1 49 dec ecx 5221 000020F2 7502 jnz short lff44m2_2_1 5222 000020F4 31D2 xor edx, edx 5223 lff44m2_2_1: 5224 ; ax = [previous_val] 5225 ; dx = [next_val] 5226 000020F6 E857030000 call interpolating_2_16bit_mono 5227 000020FB E31B jecxz lff44m2_3 5228 lff44m2_2_2: 5229 000020FD 66AD lodsw 5230 000020FF 66AB stosw ; (L)eft Channel 5231 00002101 66AB stosw ; (R)ight Channel 5232 5233 00002103 49 dec ecx 5234 00002104 7412 jz short lff44m2_3 5235 00002106 4D dec ebp 5236 00002107 75F4 jnz short lff44m2_2_2 5237 5238 00002109 FE0D[39280000] dec byte [faz] 5239 0000210F 74CF jz short lff44m2_9 5240 00002111 BD0B000000 mov ebp, 11 5241 00002116 EBD4 jmp short lff44m2_1 5242 5243 lff44m2_3: 5244 lff44s2_3: 5245 00002118 E955F0FFFF jmp lff44_3 ; padfill 5246 ; (put zeros in the remain words of the buffer) 5247 lff44m2_7: 5248 lff44s2_7: 5249 0000211D E971F0FFFF jmp lff44_5 ; error 5250 5251 load_44khz_stereo_16_bit: 5252 ; 18/11/2023 5253 00002122 F605[2E390000]01 test byte [flags], ENDOFFILE ; have we already read the 5254 ; last of the file? 5255 00002129 7402 jz short lff44s2_0 ; no 5256 0000212B F9 stc 5257 0000212C C3 retn 5258 5259 lff44s2_0: 5260 ; 01/12/2024 5261 ; edi = audio buffer address 5262 0000212D BE[00500200] mov esi, temp_buffer ; temporary buffer for wav data 5263 ;mov edx, [loadsize] 5264 5265 ; esi = buffer address 5266 ;; edx = buffer size 5267 5268 ; load file into memory 5269 sys _read, [filehandle], esi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 00002132 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 00002138 89F1 <1> mov ecx, %3 98 <1> %if %0 = 4 99 0000213A 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 00002140 B803000000 <1> mov eax, %1 104 <1> 105 00002145 CD40 <1> int 40h 5270 00002147 72D4 jc short lff44s2_7 ; error ! 5271 5272 ; 01/12/2024 5273 00002149 A3[B4390000] mov [count], eax 5274 ;;; 5275 ; 29/05/2024 5276 ;mov edi, [audio_buffer] 5277 ;;; 5278 0000214E C1E802 shr eax, 2 ; dword (left chan word + right chan word) 5279 00002151 7505 jnz short lff44s2_8 5280 00002153 E932F0FFFF jmp lff44_eof 5281 5282 lff44s2_8: 5283 00002158 89C1 mov ecx, eax ; dword count 5284 lff44s2_9: 5285 0000215A BD0A000000 mov ebp, 10 ; interpolation (one step) loop count 5286 0000215F C605[39280000]02 mov byte [faz], 2 ; 2 steps/phase 5287 lff44s2_1: 5288 ; 2:1:1:1:1:1:1:1:1:1:1:: ; 25/23 5289 ; 2:1:1:1:1:1:1:1:1:1:1:1 5290 00002166 66AD lodsw 5291 00002168 89C3 mov ebx, eax 5292 0000216A 66AD lodsw 5293 ;mov dx, [esi] 5294 ;mov [next_val_l], dx 5295 ;mov dx, [esi+2] 5296 ; 26/11/2023 5297 0000216C 8B16 mov edx, [esi] 5298 0000216E 668915[35280000] mov [next_val_l], dx 5299 00002175 C1EA10 shr edx, 16 5300 00002178 49 dec ecx 5301 00002179 7509 jnz short lff44s2_2_1 5302 0000217B 31D2 xor edx, edx ; 0 5303 0000217D 668915[35280000] mov [next_val_l], dx 5304 lff44s2_2_1: 5305 ; bx = [previous_val_l] 5306 ; ax = [previous_val_r] 5307 ; [next_val_l] 5308 ; dx = [next_val_r] 5309 00002184 E8E1020000 call interpolating_2_16bit_stereo 5310 00002189 E38D jecxz lff44s2_3 5311 lff44s2_2_2: 5312 ;movsw ; (L)eft Channel 5313 ;movsw ; (R)ight Channel 5314 0000218B A5 movsd 5315 5316 0000218C 49 dec ecx 5317 0000218D 7489 jz short lff44s2_3 5318 0000218F 4D dec ebp 5319 00002190 75F9 jnz short lff44s2_2_2 5320 5321 00002192 FE0D[39280000] dec byte [faz] 5322 00002198 74C0 jz short lff44s2_9 5323 0000219A BD0B000000 mov ebp, 11 5324 0000219F EBC5 jmp short lff44s2_1 5325 5326 ; ..................... 5327 5328 ; 02/02/2025 5329 load_12khz_mono_8_bit: 5330 000021A1 F605[2E390000]01 test byte [flags], ENDOFFILE ; have we already read the 5331 ; last of the file? 5332 000021A8 7402 jz short lff12m_0 ; no 5333 000021AA F9 stc 5334 000021AB C3 retn 5335 5336 lff12m_0: 5337 ; edi = audio buffer address 5338 000021AC BE[00500200] mov esi, temp_buffer ; temporary buffer for wav data 5339 5340 ; load file into memory 5341 sys _read, [filehandle], esi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 000021B1 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 000021B7 89F1 <1> mov ecx, %3 98 <1> %if %0 = 4 99 000021B9 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 000021BF B803000000 <1> mov eax, %1 104 <1> 105 000021C4 CD40 <1> int 40h 5342 000021C6 7256 jc short lff12m_7 ; error ! 5343 5344 000021C8 A3[B4390000] mov [count], eax 5345 5346 000021CD 21C0 and eax, eax 5347 000021CF 7505 jnz short lff12m_8 5348 000021D1 E9B4EFFFFF jmp lff12_eof 5349 5350 lff12m_8: 5351 000021D6 89C1 mov ecx, eax ; byte count 5352 lff12m_1: 5353 ; original-interpolated-interpolated-interpolated 5354 000021D8 AC lodsb 5355 ; 02/02/2025 5356 000021D9 8A16 mov dl, [esi] 5357 000021DB 49 dec ecx 5358 000021DC 7502 jnz short lff12m_2 5359 000021DE B280 mov dl, 80h 5360 lff12m_2: 5361 ; al = [previous_val] 5362 ; dl = [next_val] 5363 000021E0 E8C0030000 call interpolating_4_8bit_mono 5364 000021E5 E353 jecxz lff12m_3 5365 000021E7 EBEF jmp short lff12m_1 5366 5367 ; 02/02/2025 5368 load_12khz_stereo_8_bit: 5369 000021E9 F605[2E390000]01 test byte [flags], ENDOFFILE ; have we already read the 5370 ; last of the file? 5371 000021F0 7402 jz short lff12s_0 ; no 5372 000021F2 F9 stc 5373 000021F3 C3 retn 5374 5375 lff12s_0: 5376 ; edi = audio buffer address 5377 000021F4 BE[00500200] mov esi, temp_buffer ; temporary buffer for wav data 5378 5379 ; load file into memory 5380 sys _read, [filehandle], esi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 000021F9 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 000021FF 89F1 <1> mov ecx, %3 98 <1> %if %0 = 4 99 00002201 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 00002207 B803000000 <1> mov eax, %1 104 <1> 105 0000220C CD40 <1> int 40h 5381 0000220E 720E jc short lff12s_7 ; error ! 5382 5383 00002210 A3[B4390000] mov [count], eax 5384 5385 00002215 D1E8 shr eax, 1 5386 00002217 750A jnz short lff12s_8 5387 00002219 E96CEFFFFF jmp lff12_eof 5388 5389 lff12m_7: 5390 lff12s_7: 5391 0000221E E970EFFFFF jmp lff12_5 ; error 5392 5393 lff12s_8: 5394 00002223 89C1 mov ecx, eax ; word count 5395 lff12s_1: 5396 ; original-interpolated-interpolated-interpolated 5397 00002225 66AD lodsw 5398 ; 02/02/2025 5399 00002227 668B16 mov dx, [esi] 5400 0000222A 49 dec ecx 5401 0000222B 7504 jnz short lff12s_2 5402 0000222D 66BA8080 mov dx, 8080h 5403 lff12s_2: 5404 ; al = [previous_val_l] 5405 ; ah = [previous_val_r] 5406 ; dl = [next_val_l] 5407 ; dh = [next_val_r] 5408 00002231 E8AE030000 call interpolating_4_8bit_stereo 5409 00002236 E302 jecxz lff12s_3 5410 00002238 EBEB jmp short lff12s_1 5411 5412 lff12m_3: 5413 lff12s_3: 5414 0000223A E933EFFFFF jmp lff12_3 ; padfill 5415 ; (put zeros in the remain words of the buffer) 5416 5417 ; 02/02/2025 5418 load_12khz_mono_16_bit: 5419 0000223F F605[2E390000]01 test byte [flags], ENDOFFILE ; have we already read the 5420 ; last of the file? 5421 00002246 7402 jz short lff12m2_0 ; no 5422 00002248 F9 stc 5423 00002249 C3 retn 5424 5425 lff12m2_0: 5426 ; edi = audio buffer address 5427 0000224A BE[00500200] mov esi, temp_buffer ; temporary buffer for wav data 5428 5429 ; load file into memory 5430 sys _read, [filehandle], esi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 0000224F 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 00002255 89F1 <1> mov ecx, %3 98 <1> %if %0 = 4 99 00002257 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 0000225D B803000000 <1> mov eax, %1 104 <1> 105 00002262 CD40 <1> int 40h 5431 00002264 7223 jc short lff12m2_7 ; error ! 5432 5433 00002266 A3[B4390000] mov [count], eax 5434 5435 0000226B D1E8 shr eax, 1 5436 0000226D 7505 jnz short lff12m2_8 5437 0000226F E916EFFFFF jmp lff12_eof 5438 5439 lff12m2_8: 5440 00002274 89C1 mov ecx, eax ; word count 5441 lff12m2_1: 5442 ; original-interpolated-interpolated-interpolated 5443 00002276 66AD lodsw 5444 ; 02/02/2025 5445 00002278 668B16 mov dx, [esi] 5446 0000227B 49 dec ecx 5447 0000227C 7502 jnz short lff12m2_2 5448 0000227E 31D2 xor edx, edx 5449 lff12m2_2: 5450 ; ax = [previous_val] 5451 ; dx = [next_val] 5452 00002280 E8F6040000 call interpolating_4_16bit_mono 5453 00002285 E3B3 jecxz lff12m_3 5454 00002287 EBED jmp short lff12m2_1 5455 5456 lff12m2_7: 5457 lff12s2_7: 5458 00002289 E905EFFFFF jmp lff12_5 ; error 5459 5460 ; 02/02/2025 5461 load_12khz_stereo_16_bit: 5462 0000228E F605[2E390000]01 test byte [flags], ENDOFFILE ; have we already read the 5463 ; last of the file? 5464 00002295 7402 jz short lff12s2_0 ; no 5465 00002297 F9 stc 5466 00002298 C3 retn 5467 5468 lff12s2_0: 5469 ; edi = audio buffer address 5470 00002299 BE[00500200] mov esi, temp_buffer ; temporary buffer for wav data 5471 5472 ; load file into memory 5473 sys _read, [filehandle], esi, [loadsize] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 0000229E 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 000022A4 89F1 <1> mov ecx, %3 98 <1> %if %0 = 4 99 000022A6 8B15[A4390000] <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 000022AC B803000000 <1> mov eax, %1 104 <1> 105 000022B1 CD40 <1> int 40h 5474 000022B3 72D4 jc short lff12s2_7 ; error ! 5475 5476 000022B5 A3[B4390000] mov [count], eax 5477 5478 000022BA C1E802 shr eax, 2 ; dword (left chan word + right chan word) 5479 000022BD 750A jnz short lff12s2_8 5480 000022BF E9C6EEFFFF jmp lff12_eof 5481 5482 lff12m2_3: 5483 lff12s2_3: 5484 000022C4 E9A9EEFFFF jmp lff12_3 ; padfill 5485 ; (put zeros in the remain words of the buffer) 5486 5487 lff12s2_8: 5488 000022C9 89C1 mov ecx, eax ; dword count 5489 lff12s2_1: 5490 ; original-interpolated-interpolated-interpolated 5491 000022CB 66AD lodsw 5492 000022CD 89C3 mov ebx, eax 5493 000022CF 66AD lodsw 5494 000022D1 8B16 mov edx, [esi] 5495 000022D3 49 dec ecx 5496 000022D4 7502 jnz short lff12s2_2 5497 000022D6 31D2 xor edx, edx ; 0 5498 lff12s2_2: 5499 ;mov [next_val_l], dx 5500 ;shr edx, 16 5501 ;mov [next_val_r], dx 5502 ; 02/02/2025 5503 000022D8 8915[35280000] mov [next_val_l], edx 5504 5505 ; bx = [previous_val_l] 5506 ; ax = [previous_val_r] 5507 ; [next_val_l] 5508 ; [next_val_r] 5509 000022DE E8D1040000 call interpolating_4_16bit_stereo 5510 000022E3 E3DF jecxz lff12s2_3 5511 000022E5 EBE4 jmp short lff12s2_1 5512 5513 ; ..................... 5514 5515 interpolating_3_8bit_mono: 5516 ; 02/02/2025 5517 ; 16/11/2023 5518 ; al = [previous_val] 5519 ; dl = [next_val] 5520 ; original-interpolated-interpolated 5521 000022E7 88C3 mov bl, al 5522 000022E9 2C80 sub al, 80h 5523 000022EB 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5524 000022EF 66AB stosw ; original sample (L) 5525 000022F1 66AB stosw ; original sample (R) 5526 000022F3 88D8 mov al, bl 5527 000022F5 00D0 add al, dl 5528 000022F7 D0D8 rcr al, 1 5529 000022F9 88C7 mov bh, al ; interpolated middle (temporary) 5530 000022FB 00D8 add al, bl 5531 000022FD D0D8 rcr al, 1 5532 000022FF 2C80 sub al, 80h 5533 00002301 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5534 00002305 66AB stosw ; interpolated sample 1 (L) 5535 00002307 66AB stosw ; interpolated sample 1 (R) 5536 00002309 88F8 mov al, bh 5537 0000230B 00D0 add al, dl ; [next_val] 5538 0000230D D0D8 rcr al, 1 5539 ; 02/02/2025 5540 0000230F 2C80 sub al, 80h 5541 00002311 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5542 00002315 66AB stosw ; interpolated sample 2 (L) 5543 00002317 66AB stosw ; interpolated sample 2 (R) 5544 00002319 C3 retn 5545 5546 interpolating_3_8bit_stereo: 5547 ; 02/02/2025 5548 ; 16/11/2023 5549 ; al = [previous_val_l] 5550 ; ah = [previous_val_r] 5551 ; dl = [next_val_l] 5552 ; dh = [next_val_r] 5553 ; original-interpolated-interpolated 5554 0000231A 89C3 mov ebx, eax 5555 0000231C 2C80 sub al, 80h 5556 0000231E 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5557 00002322 66AB stosw ; original sample (L) 5558 00002324 88F8 mov al, bh 5559 00002326 2C80 sub al, 80h 5560 00002328 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5561 0000232C 66AB stosw ; original sample (R) 5562 0000232E 88D8 mov al, bl 5563 00002330 00D0 add al, dl ; [next_val_l] 5564 00002332 D0D8 rcr al, 1 5565 00002334 50 push eax ; * ; al = interpolated middle (L) (temporary) 5566 00002335 00D8 add al, bl ; [previous_val_l] 5567 00002337 D0D8 rcr al, 1 5568 00002339 2C80 sub al, 80h 5569 0000233B 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5570 0000233F 66AB stosw ; interpolated sample 1 (L) 5571 00002341 88F8 mov al, bh 5572 00002343 00F0 add al, dh ; [next_val_r] 5573 00002345 D0D8 rcr al, 1 5574 00002347 50 push eax ; ** ; al = interpolated middle (R) (temporary) 5575 00002348 00F8 add al, bh ; [previous_val_r] 5576 0000234A D0D8 rcr al, 1 5577 0000234C 2C80 sub al, 80h 5578 0000234E 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5579 00002352 66AB stosw ; interpolated sample 1 (R) 5580 00002354 5B pop ebx ; ** 5581 00002355 58 pop eax ; * 5582 00002356 00D0 add al, dl ; [next_val_l] 5583 00002358 D0D8 rcr al, 1 5584 ; 02/02/2025 5585 0000235A 2C80 sub al, 80h 5586 0000235C 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5587 00002360 66AB stosw ; interpolated sample 2 (L) 5588 00002362 88D8 mov al, bl 5589 00002364 00F0 add al, dh ; [next_val_r] 5590 00002366 D0D8 rcr al, 1 5591 ; 02/02/2025 5592 00002368 2C80 sub al, 80h 5593 0000236A 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5594 0000236E 66AB stosw ; interpolated sample 2 (R) 5595 00002370 C3 retn 5596 5597 interpolating_2_8bit_mono: 5598 ; 16/11/2023 5599 ; al = [previous_val] 5600 ; dl = [next_val] 5601 ; original-interpolated 5602 00002371 88C3 mov bl, al 5603 00002373 2C80 sub al, 80h 5604 00002375 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5605 00002379 66AB stosw ; original sample (L) 5606 0000237B 66AB stosw ; original sample (R) 5607 0000237D 88D8 mov al, bl 5608 0000237F 00D0 add al, dl 5609 00002381 D0D8 rcr al, 1 5610 00002383 2C80 sub al, 80h 5611 00002385 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5612 00002389 66AB stosw ; interpolated sample (L) 5613 0000238B 66AB stosw ; interpolated sample (R) 5614 0000238D C3 retn 5615 5616 interpolating_2_8bit_stereo: 5617 ; 16/11/2023 5618 ; al = [previous_val_l] 5619 ; ah = [previous_val_r] 5620 ; dl = [next_val_l] 5621 ; dh = [next_val_r] 5622 ; original-interpolated 5623 0000238E 89C3 mov ebx, eax 5624 00002390 2C80 sub al, 80h 5625 00002392 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5626 00002396 66AB stosw ; original sample (L) 5627 00002398 88F8 mov al, bh 5628 0000239A 2C80 sub al, 80h 5629 0000239C 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5630 000023A0 66AB stosw ; original sample (R) 5631 000023A2 88D8 mov al, bl ; [previous_val_l] 5632 000023A4 00D0 add al, dl ; [next_val_l] 5633 000023A6 D0D8 rcr al, 1 5634 000023A8 2C80 sub al, 80h 5635 000023AA 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5636 000023AE 66AB stosw ; interpolated sample (L) 5637 000023B0 88F8 mov al, bh 5638 000023B2 00F0 add al, dh ; [next_val_r] 5639 000023B4 D0D8 rcr al, 1 5640 000023B6 2C80 sub al, 80h 5641 000023B8 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5642 000023BC 66AB stosw ; interpolated sample (R) 5643 000023BE C3 retn 5644 5645 interpolating_3_16bit_mono: 5646 ; 16/11/2023 5647 ; ax = [previous_val] 5648 ; dx = [next_val] 5649 ; original-interpolated-interpolated 5650 5651 000023BF 66AB stosw ; original sample (L) 5652 000023C1 66AB stosw ; original sample (R) 5653 000023C3 80C480 add ah, 80h ; convert sound level 0 to 65535 format 5654 000023C6 50 push eax ; * ; [previous_val] 5655 000023C7 80C680 add dh, 80h 5656 000023CA 6601D0 add ax, dx 5657 000023CD 66D1D8 rcr ax, 1 5658 000023D0 5B pop ebx ; * 5659 000023D1 93 xchg ebx, eax ; bx = interpolated middle (temporary) 5660 000023D2 6601D8 add ax, bx ; [previous_val] + interpolated middle 5661 000023D5 66D1D8 rcr ax, 1 5662 000023D8 80EC80 sub ah, 80h ; -32768 to +32767 format again 5663 000023DB 66AB stosw ; interpolated sample 1 (L) 5664 000023DD 66AB stosw ; interpolated sample 1 (R) 5665 000023DF 89D8 mov eax, ebx 5666 000023E1 6601D0 add ax, dx ; interpolated middle + [next_val] 5667 000023E4 66D1D8 rcr ax, 1 5668 000023E7 80EC80 sub ah, 80h ; -32768 to +32767 format again 5669 000023EA 66AB stosw ; interpolated sample 2 (L) 5670 000023EC 66AB stosw ; interpolated sample 2 (R) 5671 000023EE C3 retn 5672 5673 interpolating_3_16bit_stereo: 5674 ; 16/11/2023 5675 ; bx = [previous_val_l] 5676 ; ax = [previous_val_r] 5677 ; [next_val_l] 5678 ; dx = [next_val_r] 5679 ; original-interpolated-interpolated 5680 5681 000023EF 93 xchg eax, ebx 5682 000023F0 66AB stosw ; original sample (L) 5683 000023F2 93 xchg eax, ebx 5684 000023F3 66AB stosw ; original sample (R) 5685 000023F5 80C480 add ah, 80h ; convert sound level 0 to 65535 format 5686 000023F8 50 push eax ; * ; [previous_val_r] 5687 000023F9 80C780 add bh, 80h 5688 000023FC 8005[36280000]80 add byte [next_val_l+1], 80h 5689 00002403 66A1[35280000] mov ax, [next_val_l] 5690 00002409 6601D8 add ax, bx ; [previous_val_l] 5691 0000240C 66D1D8 rcr ax, 1 5692 0000240F 93 xchg eax, ebx ; ax = [previous_val_l] 5693 00002410 6601D8 add ax, bx ; bx = interpolated middle (L) 5694 00002413 66D1D8 rcr ax, 1 5695 00002416 80EC80 sub ah, 80h ; -32768 to +32767 format again 5696 00002419 66AB stosw ; interpolated sample 1 (L) 5697 0000241B 58 pop eax ; * 5698 0000241C 80C680 add dh, 80h ; convert sound level 0 to 65535 format 5699 0000241F 52 push edx ; * ; [next_val_r] 5700 00002420 92 xchg eax, edx 5701 00002421 6601D0 add ax, dx ; [next_val_r] + [previous_val_r] 5702 00002424 66D1D8 rcr ax, 1 ; / 2 5703 00002427 50 push eax ; ** ; interpolated middle (R) 5704 00002428 6601D0 add ax, dx ; + [previous_val_r] 5705 0000242B 66D1D8 rcr ax, 1 5706 0000242E 80EC80 sub ah, 80h ; -32768 to +32767 format again 5707 00002431 66AB stosw ; interpolated sample 1 (R) 5708 00002433 66A1[35280000] mov ax, [next_val_l] 5709 00002439 6601D8 add ax, bx ; + interpolated middle (L) 5710 0000243C 66D1D8 rcr ax, 1 5711 0000243F 80EC80 sub ah, 80h ; -32768 to +32767 format again 5712 00002442 66AB stosw ; interpolated sample 2 (L) 5713 00002444 58 pop eax ; ** 5714 00002445 5A pop edx ; * 5715 00002446 6601D0 add ax, dx ; interpolated middle + [next_val_r] 5716 00002449 66D1D8 rcr ax, 1 ; / 2 5717 0000244C 80EC80 sub ah, 80h ; -32768 to +32767 format again 5718 0000244F 66AB stosw ; interpolated sample 2 (L) 5719 00002451 C3 retn 5720 5721 interpolating_2_16bit_mono: 5722 ; 16/11/2023 5723 ; ax = [previous_val] 5724 ; dx = [next_val] 5725 ; original-interpolated 5726 5727 00002452 66AB stosw ; original sample (L) 5728 00002454 66AB stosw ; original sample (R) 5729 00002456 80C480 add ah, 80h ; convert sound level 0 to 65535 format 5730 00002459 80C680 add dh, 80h 5731 0000245C 6601D0 add ax, dx 5732 0000245F 66D1D8 rcr ax, 1 5733 00002462 80EC80 sub ah, 80h ; -32768 to +32767 format again 5734 00002465 66AB stosw ; interpolated sample (L) 5735 00002467 66AB stosw ; interpolated sample (R) 5736 00002469 C3 retn 5737 5738 interpolating_2_16bit_stereo: 5739 ; 17/01/2025 5740 ; 16/11/2023 5741 ; bx = [previous_val_l] 5742 ; ax = [previous_val_r] 5743 ; [next_val_l] 5744 ; dx = [next_val_r] 5745 ; original-interpolated 5746 5747 0000246A 93 xchg eax, ebx 5748 0000246B 66AB stosw ; original sample (L) 5749 0000246D 93 xchg eax, ebx 5750 0000246E 66AB stosw ; original sample (R) 5751 00002470 80C480 add ah, 80h ; convert sound level 0 to 65535 format 5752 00002473 80C680 add dh, 80h 5753 00002476 6601D0 add ax, dx ; [previous_val_r] + [next_val_r] 5754 00002479 66D1D8 rcr ax, 1 ; / 2 5755 ; 17/01/2025 5756 0000247C 80EC80 sub ah, 80h ; -32768 to +32767 format again 5757 ;push eax ; * ; interpolated sample (R) 5758 ; 17/01/2025 5759 0000247F C1E010 shl eax, 16 5760 00002482 66A1[35280000] mov ax, [next_val_l] 5761 00002488 80C480 add ah, 80h 5762 0000248B 80C780 add bh, 80h 5763 0000248E 6601D8 add ax, bx ; [next_val_l] + [previous_val_l] 5764 00002491 66D1D8 rcr ax, 1 ; / 2 5765 00002494 80EC80 sub ah, 80h ; -32768 to +32767 format again 5766 ; 17/01/2025 5767 ;stosw ; interpolated sample (L) 5768 ;pop eax ; * 5769 ;sub ah, 80h ; -32768 to +32767 format again 5770 ;stosw ; interpolated sample (R) 5771 ; 17/01/2025 5772 00002497 AB stosd 5773 00002498 C3 retn 5774 5775 interpolating_5_8bit_mono: 5776 ; 17/11/2023 5777 ; al = [previous_val] 5778 ; dl = [next_val] 5779 ; original-interpltd-interpltd-interpltd-interpltd 5780 00002499 88C3 mov bl, al 5781 0000249B 2C80 sub al, 80h 5782 0000249D 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5783 000024A1 66AB stosw ; original sample (L) 5784 000024A3 66AB stosw ; original sample (R) 5785 000024A5 88D8 mov al, bl 5786 000024A7 00D0 add al, dl 5787 000024A9 D0D8 rcr al, 1 5788 000024AB 88C7 mov bh, al ; interpolated middle (temporary) 5789 000024AD 00D8 add al, bl ; [previous_val] 5790 000024AF D0D8 rcr al, 1 5791 000024B1 88C6 mov dh, al ; interpolated 1st quarter (temporary) 5792 000024B3 00D8 add al, bl 5793 000024B5 D0D8 rcr al, 1 5794 000024B7 2C80 sub al, 80h 5795 000024B9 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5796 000024BD 66AB stosw ; interpolated sample 1 (L) 5797 000024BF 66AB stosw ; interpolated sample 1 (R) 5798 000024C1 88F8 mov al, bh 5799 000024C3 00F0 add al, dh 5800 000024C5 D0D8 rcr al, 1 5801 000024C7 2C80 sub al, 80h 5802 000024C9 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5803 000024CD 66AB stosw ; interpolated sample 2 (L) 5804 000024CF 66AB stosw ; interpolated sample 2 (R) 5805 000024D1 88F8 mov al, bh 5806 000024D3 00D0 add al, dl ; [next_val] 5807 000024D5 D0D8 rcr al, 1 5808 000024D7 88C6 mov dh, al ; interpolated 3rd quarter (temporary) 5809 000024D9 00F8 add al, bh 5810 000024DB D0D8 rcr al, 1 5811 000024DD 2C80 sub al, 80h 5812 000024DF 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5813 000024E3 66AB stosw ; interpolated sample 3 (L) 5814 000024E5 66AB stosw ; interpolated sample 3 (R) 5815 000024E7 88F0 mov al, dh 5816 000024E9 00D0 add al, dl 5817 000024EB D0D8 rcr al, 1 5818 000024ED 2C80 sub al, 80h 5819 000024EF 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5820 000024F3 66AB stosw ; interpolated sample 4 (L) 5821 000024F5 66AB stosw ; interpolated sample 4 (R) 5822 000024F7 C3 retn 5823 5824 interpolating_5_8bit_stereo: 5825 ; 17/11/2023 5826 ; al = [previous_val_l] 5827 ; ah = [previous_val_r] 5828 ; dl = [next_val_l] 5829 ; dh = [next_val_r] 5830 ; original-interpltd-interpltd-interpltd-interpltd 5831 000024F8 89C3 mov ebx, eax 5832 000024FA 2C80 sub al, 80h 5833 000024FC 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5834 00002500 66AB stosw ; original sample (L) 5835 00002502 88F8 mov al, bh 5836 00002504 2C80 sub al, 80h 5837 00002506 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5838 0000250A 66AB stosw ; original sample (R) 5839 0000250C 52 push edx ; * 5840 0000250D 88D8 mov al, bl 5841 0000250F 00D0 add al, dl ; [next_val_l] 5842 00002511 D0D8 rcr al, 1 5843 00002513 50 push eax ; ** ; al = interpolated middle (L) (temporary) 5844 00002514 00D8 add al, bl ; [previous_val_l] 5845 00002516 D0D8 rcr al, 1 5846 00002518 86D8 xchg al, bl 5847 0000251A 00D8 add al, bl ; bl = interpolated 1st quarter (L) (temp) 5848 0000251C D0D8 rcr al, 1 5849 0000251E 2C80 sub al, 80h 5850 00002520 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5851 00002524 66AB stosw ; interpolated sample 1 (L) 5852 00002526 88F8 mov al, bh 5853 00002528 00F0 add al, dh ; [next_val_r] 5854 0000252A D0D8 rcr al, 1 5855 0000252C 50 push eax ; *** ; al = interpolated middle (R) (temporary) 5856 0000252D 00F8 add al, bh ; [previous_val_r] 5857 0000252F D0D8 rcr al, 1 5858 00002531 86F8 xchg al, bh 5859 00002533 00F8 add al, bh ; bh = interpolated 1st quarter (R) (temp) 5860 00002535 D0D8 rcr al, 1 5861 00002537 2C80 sub al, 80h 5862 00002539 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5863 0000253D 66AB stosw ; interpolated sample 1 (R) 5864 0000253F 5A pop edx ; *** 5865 00002540 58 pop eax ; ** ; al = interpolated middle (L) (temporary) 5866 00002541 86D8 xchg al, bl ; al = interpolated 1st quarter (L) (temp) 5867 00002543 00D8 add al, bl ; bl = interpolated middle (L) (temporary) 5868 00002545 D0D8 rcr al, 1 5869 00002547 2C80 sub al, 80h 5870 00002549 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5871 0000254D 66AB stosw ; interpolated sample 2 (L) 5872 0000254F 88D0 mov al, dl ; interpolated middle (R) (temporary) 5873 00002551 86F8 xchg al, bh ; al = interpolated 1st quarter (R) (temp) 5874 00002553 00F8 add al, bh ; bh = interpolated middle (R) (temporary) 5875 00002555 D0D8 rcr al, 1 5876 00002557 2C80 sub al, 80h 5877 00002559 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5878 0000255D 66AB stosw ; interpolated sample 2 (R) 5879 0000255F 5A pop edx ; * 5880 00002560 88D8 mov al, bl ; interpolated middle (L) (temporary) 5881 00002562 00D0 add al, dl ; [next_val_l] 5882 00002564 D0D8 rcr al, 1 5883 00002566 86D8 xchg al, bl ; al = interpolated middle (R) (temporary) 5884 00002568 00D8 add al, bl ; bl = interpolated 3rd quarter (L) (temp) 5885 0000256A D0D8 rcr al, 1 5886 0000256C 2C80 sub al, 80h 5887 0000256E 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5888 00002572 66AB stosw ; interpolated sample 3 (L) 5889 00002574 88F8 mov al, bh 5890 00002576 00F0 add al, dh ; interpolated middle (R) + [next_val_r] 5891 00002578 D0D8 rcr al, 1 5892 0000257A 86F8 xchg al, bh ; al = interpolated middle (R) 5893 0000257C 00F8 add al, bh ; bh = interpolated 3rd quarter (R) (temp) 5894 0000257E D0D8 rcr al, 1 5895 00002580 2C80 sub al, 80h 5896 00002582 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5897 00002586 66AB stosw ; interpolated sample 3 (R) 5898 00002588 88D8 mov al, bl 5899 0000258A 00D0 add al, dl ; [next_val_l] 5900 0000258C D0D8 rcr al, 1 5901 0000258E 2C80 sub al, 80h 5902 00002590 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5903 00002594 66AB stosw ; interpolated sample 4 (L) 5904 00002596 88F8 mov al, bh 5905 00002598 00F0 add al, dh ; [next_val_r] 5906 0000259A D0D8 rcr al, 1 5907 0000259C 2C80 sub al, 80h 5908 0000259E 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5909 000025A2 66AB stosw ; interpolated sample 4 (R) 5910 000025A4 C3 retn 5911 5912 interpolating_4_8bit_mono: 5913 ; 17/11/2023 5914 ; al = [previous_val] 5915 ; dl = [next_val] 5916 ; original-interpolated-interpolated-interpolated 5917 000025A5 88C3 mov bl, al 5918 000025A7 2C80 sub al, 80h 5919 000025A9 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5920 000025AD 66AB stosw ; original sample (L) 5921 000025AF 66AB stosw ; original sample (R) 5922 000025B1 88D8 mov al, bl 5923 000025B3 00D0 add al, dl 5924 000025B5 D0D8 rcr al, 1 5925 000025B7 86D8 xchg al, bl ; al = [previous_val] 5926 000025B9 00D8 add al, bl ; bl = interpolated middle (sample 2) 5927 000025BB D0D8 rcr al, 1 5928 000025BD 2C80 sub al, 80h 5929 000025BF 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5930 000025C3 66AB stosw ; interpolated sample 1 (L) 5931 000025C5 66AB stosw ; interpolated sample 1 (R) 5932 000025C7 88D8 mov al, bl ; interpolated middle (sample 2) 5933 000025C9 2C80 sub al, 80h 5934 000025CB 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5935 000025CF 66AB stosw ; interpolated sample 2 (L) 5936 000025D1 66AB stosw ; interpolated sample 2 (R) 5937 000025D3 88D8 mov al, bl 5938 000025D5 00D0 add al, dl ; [next_val] 5939 000025D7 D0D8 rcr al, 1 5940 000025D9 2C80 sub al, 80h 5941 000025DB 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5942 000025DF 66AB stosw ; interpolated sample 3 (L) 5943 000025E1 66AB stosw ; interpolated sample 3 (R) 5944 000025E3 C3 retn 5945 5946 interpolating_4_8bit_stereo: 5947 ; 17/11/2023 5948 ; al = [previous_val_l] 5949 ; ah = [previous_val_r] 5950 ; dl = [next_val_l] 5951 ; dh = [next_val_r] 5952 ; original-interpolated-interpolated-interpolated 5953 000025E4 89C3 mov ebx, eax 5954 000025E6 2C80 sub al, 80h 5955 000025E8 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5956 000025EC 66AB stosw ; original sample (L) 5957 000025EE 88F8 mov al, bh 5958 000025F0 2C80 sub al, 80h 5959 000025F2 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5960 000025F6 66AB stosw ; original sample (R) 5961 000025F8 88D8 mov al, bl 5962 000025FA 00D0 add al, dl ; [next_val_l] 5963 000025FC D0D8 rcr al, 1 5964 000025FE 86D8 xchg al, bl ; al = [previous_val_l] 5965 00002600 00D8 add al, bl ; bl = interpolated middle (L) (sample 2) 5966 00002602 D0D8 rcr al, 1 5967 00002604 2C80 sub al, 80h 5968 00002606 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5969 0000260A 66AB stosw ; interpolated sample 1 (L) 5970 0000260C 88F8 mov al, bh 5971 0000260E 00F0 add al, dh ; [next_val_r] 5972 00002610 D0D8 rcr al, 1 5973 00002612 86F8 xchg al, bh ; al = [previous_val_h] 5974 00002614 00F8 add al, bh ; bh = interpolated middle (R) (sample 2) 5975 00002616 D0D8 rcr al, 1 5976 00002618 2C80 sub al, 80h 5977 0000261A 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5978 0000261E 66AB stosw ; interpolated sample 1 (R) 5979 00002620 88D8 mov al, bl ; interpolated middle (L) (sample 2) 5980 00002622 2C80 sub al, 80h 5981 00002624 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5982 00002628 66AB stosw ; interpolated sample 2 (L) 5983 0000262A 88F8 mov al, bh ; interpolated middle (L) (sample 2) 5984 0000262C 2C80 sub al, 80h 5985 0000262E 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5986 00002632 66AB stosw ; interpolated sample 2 (L) 5987 00002634 88D8 mov al, bl 5988 00002636 00D0 add al, dl ; [next_val_l] 5989 00002638 D0D8 rcr al, 1 5990 0000263A 2C80 sub al, 80h 5991 0000263C 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5992 00002640 66AB stosw ; interpolated sample 3 (L) 5993 00002642 88F8 mov al, bh 5994 00002644 00F0 add al, dh ; [next_val_r] 5995 00002646 D0D8 rcr al, 1 5996 00002648 2C80 sub al, 80h 5997 0000264A 66C1E008 shl ax, 8 ; convert 8 bit sample to 16 bit sample 5998 0000264E 66AB stosw ; interpolated sample 3 (R) 5999 00002650 C3 retn 6000 6001 interpolating_5_16bit_mono: 6002 ; 18/11/2023 6003 ; ax = [previous_val] 6004 ; dx = [next_val] 6005 ; original-interpltd-interpltd-interpltd-interpltd 6006 00002651 66AB stosw ; original sample (L) 6007 00002653 66AB stosw ; original sample (R) 6008 00002655 80C480 add ah, 80h ; convert sound level 0 to 65535 format 6009 00002658 89C3 mov ebx, eax ; [previous_val] 6010 0000265A 80C680 add dh, 80h 6011 0000265D 6601D0 add ax, dx 6012 00002660 66D1D8 rcr ax, 1 6013 00002663 50 push eax ; * ; interpolated middle (temporary) 6014 00002664 6601D8 add ax, bx ; interpolated middle + [previous_val] 6015 00002667 66D1D8 rcr ax, 1 6016 0000266A 50 push eax ; ** ; interpolated 1st quarter (temporary) 6017 0000266B 6601D8 add ax, bx ; 1st quarter + [previous_val] 6018 0000266E 66D1D8 rcr ax, 1 6019 00002671 80EC80 sub ah, 80h ; -32768 to +32767 format again 6020 00002674 66AB stosw ; interpolated sample 1 (L) 6021 00002676 66AB stosw ; interpolated sample 1 (R) 6022 00002678 58 pop eax ; ** 6023 00002679 5B pop ebx ; * 6024 0000267A 6601D8 add ax, bx ; 1st quarter + middle 6025 0000267D 66D1D8 rcr ax, 1 ; / 2 6026 00002680 80EC80 sub ah, 80h ; -32768 to +32767 format again 6027 00002683 66AB stosw ; interpolated sample 2 (L) 6028 00002685 66AB stosw ; interpolated sample 2 (R) 6029 00002687 89D8 mov eax, ebx 6030 00002689 6601D0 add ax, dx ; interpolated middle + [next_val] 6031 0000268C 66D1D8 rcr ax, 1 6032 0000268F 50 push eax ; * ; interpolated 3rd quarter (temporary) 6033 00002690 6601D8 add ax, bx ; + interpolated middle 6034 00002693 66D1D8 rcr ax, 1 6035 00002696 80EC80 sub ah, 80h ; -32768 to +32767 format again 6036 00002699 66AB stosw ; interpolated sample 3 (L) 6037 0000269B 66AB stosw ; interpolated sample 3 (R) 6038 0000269D 58 pop eax ; * 6039 0000269E 6601D0 add ax, dx ; 3rd quarter + [next_val] 6040 000026A1 66D1D8 rcr ax, 1 ; / 2 6041 000026A4 80EC80 sub ah, 80h ; -32768 to +32767 format again 6042 000026A7 66AB stosw ; interpolated sample 4 (L) 6043 000026A9 66AB stosw ; interpolated sample 4 (R) 6044 000026AB C3 retn 6045 6046 interpolating_5_16bit_stereo: 6047 ; 18/11/2023 6048 ; bx = [previous_val_l] 6049 ; ax = [previous_val_r] 6050 ; [next_val_l] 6051 ; [next_val_r] 6052 ; original-interpltd-interpltd-interpltd-interpltd 6053 000026AC 51 push ecx ; ! 6054 000026AD 93 xchg eax, ebx 6055 000026AE 66AB stosw ; original sample (L) 6056 000026B0 93 xchg eax, ebx 6057 000026B1 66AB stosw ; original sample (R) 6058 000026B3 80C480 add ah, 80h ; convert sound level 0 to 65535 format 6059 000026B6 50 push eax ; * ; [previous_val_r] 6060 000026B7 80C780 add bh, 80h 6061 000026BA 8005[36280000]80 add byte [next_val_l+1], 80h 6062 000026C1 66A1[35280000] mov ax, [next_val_l] 6063 000026C7 6601D8 add ax, bx ; [previous_val_l] 6064 000026CA 66D1D8 rcr ax, 1 6065 000026CD 89C1 mov ecx, eax ; interpolated middle (L) 6066 000026CF 6601D8 add ax, bx 6067 000026D2 66D1D8 rcr ax, 1 6068 000026D5 89C2 mov edx, eax ; interpolated 1st quarter (L) 6069 000026D7 6601D8 add ax, bx ; [previous_val_l] 6070 000026DA 66D1D8 rcr ax, 1 6071 000026DD 80EC80 sub ah, 80h ; -32768 to +32767 format again 6072 000026E0 66AB stosw ; interpolated sample 1 (L) 6073 000026E2 89C8 mov eax, ecx 6074 000026E4 6601D0 add ax, dx ; middle (L) + 1st quarter (L) 6075 000026E7 66D1D8 rcr ax, 1 ; / 2 6076 000026EA 89C3 mov ebx, eax ; interpolated sample 2 (L) 6077 000026EC 5A pop edx ; * ; [previous_val_r] 6078 000026ED 89D0 mov eax, edx 6079 000026EF 8005[38280000]80 add byte [next_val_r+1], 80h 6080 000026F6 660305[37280000] add ax, [next_val_r] 6081 000026FD 66D1D8 rcr ax, 1 6082 00002700 50 push eax ; * ; interpolated middle (R) 6083 00002701 6601D0 add ax, dx 6084 00002704 66D1D8 rcr ax, 1 6085 00002707 50 push eax ; ** ; interpolated 1st quarter (R) 6086 00002708 6601D0 add ax, dx ; [previous_val_r] 6087 0000270B 66D1D8 rcr ax, 1 6088 0000270E 80EC80 sub ah, 80h ; -32768 to +32767 format again 6089 00002711 66AB stosw ; interpolated sample 1 (R) 6090 00002713 89D8 mov eax, ebx 6091 00002715 80EC80 sub ah, 80h ; -32768 to +32767 format again 6092 00002718 66AB stosw ; interpolated sample 2 (L) 6093 0000271A 58 pop eax ; ** 6094 0000271B 5A pop edx ; * 6095 0000271C 6601D0 add ax, dx ; 1st quarter (R) + middle (R) 6096 0000271F 66D1D8 rcr ax, 1 ; / 2 6097 00002722 80EC80 sub ah, 80h ; -32768 to +32767 format again 6098 00002725 66AB stosw ; interpolated sample 2 (R) 6099 00002727 89C8 mov eax, ecx 6100 00002729 660305[35280000] add ax, [next_val_l] 6101 00002730 66D1D8 rcr ax, 1 6102 00002733 50 push eax ; * ; interpolated 3rd quarter (L) 6103 00002734 6601C8 add ax, cx ; interpolated middle (L) 6104 00002737 66D1D8 rcr ax, 1 6105 0000273A 80EC80 sub ah, 80h ; -32768 to +32767 format again 6106 0000273D 66AB stosw ; interpolated sample 3 (L) 6107 0000273F 89D0 mov eax, edx 6108 00002741 660305[37280000] add ax, [next_val_r] 6109 00002748 66D1D8 rcr ax, 1 6110 0000274B 50 push eax ; ** ; interpolated 3rd quarter (R) 6111 0000274C 6601D0 add ax, dx ; interpolated middle (R) 6112 0000274F 66D1D8 rcr ax, 1 6113 00002752 80EC80 sub ah, 80h ; -32768 to +32767 format again 6114 00002755 66AB stosw ; interpolated sample 3 (R) 6115 00002757 5B pop ebx ; ** 6116 00002758 58 pop eax ; * 6117 00002759 660305[35280000] add ax, [next_val_l] 6118 00002760 66D1D8 rcr ax, 1 6119 00002763 80EC80 sub ah, 80h ; -32768 to +32767 format again 6120 00002766 66AB stosw ; interpolated sample 4 (L) 6121 00002768 89D8 mov eax, ebx 6122 0000276A 660305[37280000] add ax, [next_val_r] 6123 00002771 66D1D8 rcr ax, 1 6124 00002774 80EC80 sub ah, 80h ; -32768 to +32767 format again 6125 00002777 66AB stosw ; interpolated sample 4 (R) 6126 00002779 59 pop ecx ; ! 6127 0000277A C3 retn 6128 6129 interpolating_4_16bit_mono: 6130 ; 18/11/2023 6131 ; ax = [previous_val] 6132 ; dx = [next_val] 6133 ; 02/02/2025 6134 ; original-interpolated-interpolated-interpolated 6135 6136 0000277B 66AB stosw ; original sample (L) 6137 0000277D 66AB stosw ; original sample (R) 6138 0000277F 80C480 add ah, 80h ; convert sound level 0 to 65535 format 6139 00002782 89C3 mov ebx, eax ; [previous_val] 6140 00002784 80C680 add dh, 80h 6141 00002787 6601D0 add ax, dx ; [previous_val] + [next_val] 6142 0000278A 66D1D8 rcr ax, 1 6143 0000278D 93 xchg eax, ebx 6144 0000278E 6601D8 add ax, bx ; [previous_val] + interpolated middle 6145 00002791 66D1D8 rcr ax, 1 6146 00002794 80EC80 sub ah, 80h ; -32768 to +32767 format again 6147 00002797 66AB stosw ; interpolated sample 1 (L) 6148 00002799 66AB stosw ; interpolated sample 1 (R) 6149 0000279B 89D8 mov eax, ebx ; interpolated middle 6150 0000279D 80EC80 sub ah, 80h ; -32768 to +32767 format again 6151 000027A0 66AB stosw ; interpolated sample 2 (L) 6152 000027A2 66AB stosw ; interpolated sample 2 (R) 6153 000027A4 89D8 mov eax, ebx 6154 000027A6 6601D0 add ax, dx ; interpolated middle + [next_val] 6155 000027A9 66D1D8 rcr ax, 1 6156 000027AC 80EC80 sub ah, 80h ; -32768 to +32767 format again 6157 000027AF 66AB stosw ; interpolated sample 3 (L) 6158 000027B1 66AB stosw ; interpolated sample 3 (R) 6159 000027B3 C3 retn 6160 6161 interpolating_4_16bit_stereo: 6162 ; 18/11/2023 6163 ; bx = [previous_val_l] 6164 ; ax = [previous_val_r] 6165 ; [next_val_l] 6166 ; [next_val_r] 6167 ; original-interpolated-interpolated-interpolated 6168 000027B4 93 xchg eax, ebx 6169 000027B5 66AB stosw ; original sample (L) 6170 000027B7 93 xchg eax, ebx 6171 000027B8 66AB stosw ; original sample (R) 6172 000027BA 80C480 add ah, 80h ; convert sound level 0 to 65535 format 6173 000027BD 89C2 mov edx, eax ; [previous_val_r] 6174 000027BF 80C780 add bh, 80h 6175 000027C2 8005[36280000]80 add byte [next_val_l+1], 80h 6176 000027C9 66A1[35280000] mov ax, [next_val_l] 6177 000027CF 6601D8 add ax, bx ; [previous_val_l] 6178 000027D2 66D1D8 rcr ax, 1 6179 000027D5 93 xchg eax, ebx 6180 000027D6 6601D8 add ax, bx ; bx = interpolated middle (L) 6181 000027D9 66D1D8 rcr ax, 1 6182 000027DC 80EC80 sub ah, 80h ; -32768 to +32767 format again 6183 000027DF 66AB stosw ; interpolated sample 1 (L) 6184 000027E1 8005[38280000]80 add byte [next_val_r+1], 80h 6185 000027E8 89D0 mov eax, edx ; [previous_val_r] 6186 000027EA 660305[37280000] add ax, [next_val_r] 6187 000027F1 66D1D8 rcr ax, 1 6188 000027F4 92 xchg eax, edx 6189 000027F5 6601D0 add ax, dx ; dx = interpolated middle (R) 6190 000027F8 66D1D8 rcr ax, 1 6191 000027FB 80EC80 sub ah, 80h ; -32768 to +32767 format again 6192 000027FE 66AB stosw ; interpolated sample 1 (R) 6193 00002800 89D8 mov eax, ebx 6194 00002802 80EC80 sub ah, 80h ; -32768 to +32767 format again 6195 00002805 66AB stosw ; interpolated sample 2 (L) 6196 00002807 89D0 mov eax, edx 6197 00002809 80EC80 sub ah, 80h ; -32768 to +32767 format again 6198 0000280C 66AB stosw ; interpolated sample 2 (R) 6199 0000280E 89D8 mov eax, ebx 6200 00002810 660305[35280000] add ax, [next_val_l] 6201 00002817 66D1D8 rcr ax, 1 6202 0000281A 80EC80 sub ah, 80h ; -32768 to +32767 format again 6203 0000281D 66AB stosw ; interpolated sample 3 (L) 6204 0000281F 89D0 mov eax, edx 6205 00002821 660305[37280000] add ax, [next_val_r] 6206 00002828 66D1D8 rcr ax, 1 6207 0000282B 80EC80 sub ah, 80h ; -32768 to +32767 format again 6208 0000282E 66AB stosw ; interpolated sample 3 (R) 6209 00002830 C3 retn 6210 6211 ; 13/11/2023 6212 previous_val: 6213 00002831 0000 previous_val_l: dw 0 6214 00002833 0000 previous_val_r: dw 0 6215 next_val: 6216 00002835 0000 next_val_l: dw 0 6217 00002837 0000 next_val_r: dw 0 6218 6219 ; 16/11/2023 6220 00002839 00 faz: db 0 6221 6222 ; -------------------------------------------------------- 6223 ; 14/11/2024 - Erdogan Tan 6224 ; -------------------------------------------------------- 6225 6226 ; 07/12/2024 6227 ; 01/12/2024 (32bit registers) 6228 ; 29/11/2024 6229 checkUpdateEvents: 6230 0000283A E8B9010000 call check4keyboardstop 6231 0000283F 7272 jc short c4ue_ok 6232 6233 ; 18/11/2024 6234 00002841 50 push eax ; * 6235 00002842 09C0 or eax, eax 6236 00002844 0F84D1000000 jz c4ue_cpt 6237 6238 ; 18/11/2024 6239 0000284A 3C20 cmp al, 20h ; SPACE (spacebar) ; pause/play 6240 0000284C 7543 jne short c4ue_chk_s 6241 0000284E 803D[F0380000]00 cmp byte [stopped], 0 6242 00002855 7714 ja short c4ue_chk_ps 6243 ; pause 6244 00002857 E881E4FFFF call ac97_pause 6245 ; 21/11/2024 6246 0000285C A0[F1380000] mov al, [tLO] 6247 00002861 A2[F2380000] mov byte [tLP], al 6248 00002866 E9B0000000 jmp c4ue_cpt 6249 c4ue_chk_ps: 6250 0000286B 803D[F0380000]01 cmp byte [stopped], 1 6251 00002872 770A ja short c4ue_replay 6252 ; continue to play (after a pause) 6253 00002874 E86DE4FFFF call ac97_play 6254 00002879 E99D000000 jmp c4ue_cpt 6255 c4ue_replay: 6256 ; 19/11/2024 6257 0000287E 58 pop eax ; * 6258 0000287F 58 pop eax ; return address 6259 ; 07/02/2024 6260 ;mov al, [volume] 6261 ;call SetmasterVolume 6262 00002880 C605[F0380000]00 mov byte [stopped], 0 6263 00002887 E87C040000 call move_to_beginning 6264 ;jmp PlayWav 6265 ; 07/12/2024 6266 0000288C E9A4DDFFFF jmp RePlayWav 6267 6268 c4ue_chk_s: 6269 00002891 3C53 cmp al, 'S' ; stop 6270 00002893 751F jne short c4ue_chk_fb 6271 00002895 803D[F0380000]00 cmp byte [stopped], 0 6272 0000289C 777D ja c4ue_cpt ; Already stopped/paused 6273 0000289E E821E4FFFF call ac97_stop 6274 ; 19/11/2024 6275 000028A3 C605[F1380000]00 mov byte [tLO], 0 6276 ; 21/11/2024 6277 000028AA C605[F2380000]30 mov byte [tLP], '0' 6278 000028B1 EB68 jmp c4ue_cpt 6279 6280 ; 01/12/2024 6281 ; 18/11/2024 6282 c4ue_ok: 6283 000028B3 C3 retn 6284 6285 c4ue_chk_fb: 6286 ; 17/11/2024 6287 000028B4 3C46 cmp al, 'F' 6288 000028B6 7507 jne short c4ue_chk_b 6289 000028B8 E823040000 call Player_ProcessKey_Forwards 6290 000028BD EB5C jmp c4ue_cpt 6291 6292 c4ue_chk_b: 6293 000028BF 3C42 cmp al, 'B' 6294 ;;jne short c4ue_cpt 6295 ; 19/11/2024 6296 ;jne short c4ue_chk_h 6297 ; 25/12/2024 6298 ; 29/11/2024 6299 000028C1 7507 jne short c4ue_chk_n 6300 000028C3 E814040000 call Player_ProcessKey_Backwards 6301 000028C8 EB51 jmp short c4ue_cpt 6302 6303 ;;; 6304 ; 25/12/2024 6305 ; 29/11/2024 6306 c4ue_chk_n: 6307 000028CA 3C4E cmp al, 'N' 6308 000028CC 7404 je short c4ue_nps 6309 c4ue_chk_p: 6310 000028CE 3C50 cmp al, 'P' 6311 000028D0 7509 jne short c4ue_chk_h 6312 c4ue_nps: 6313 000028D2 C605[F0380000]03 mov byte [stopped], 3 6314 000028D9 EB40 jmp short c4ue_cpt 6315 ;;; 6316 6317 c4ue_chk_h: 6318 ; 19/11/2024 6319 000028DB 3C48 cmp al, 'H' 6320 000028DD 750E jne short c4ue_chk_cr 6321 000028DF C605[F3380000]00 mov byte [wpoints], 0 6322 000028E6 E889E5FFFF call write_ac97_pci_dev_info 6323 ; 30/12/2024 6324 000028EB EB2E jmp short c4ue_cpt 6325 c4ue_chk_cr: 6326 ;;; 6327 ; 24/12/2024 (wave lighting points option) 6328 ;mov ah, [wpoints] 6329 ; 30/12/2024 6330 000028ED 31DB xor ebx, ebx 6331 000028EF 8A1D[F3380000] mov bl, [wpoints] 6332 000028F5 3C47 cmp al, 'G' 6333 000028F7 7406 je short c4ue_g 6334 ; 19/11/2024 6335 000028F9 3C0D cmp al, 0Dh ; ENTER/CR key 6336 000028FB 751E jne short c4ue_cpt 6337 ; 23/11/2024 6338 ;xor ebx, ebx 6339 ; 30/12/2024 6340 ;mov bl, ah ; 24/12/2024 6341 000028FD FEC3 inc bl 6342 c4ue_g: ; 30/12/2024 6343 000028FF 80E307 and bl, 07h 6344 00002902 7501 jnz short c4ue_sc 6345 00002904 43 inc ebx 6346 c4ue_sc: 6347 00002905 881D[F3380000] mov [wpoints], bl 6348 ; 30/12/2024 6349 0000290B 8A83[CD330000] mov al, [ebx+colors-1] ; 1 to 7 6350 ; 24/12/2024 6351 00002911 A2[D5330000] mov [ccolor], al 6352 ; 30/12/2024 6353 00002916 E81C040000 call clear_window 6354 ;;; 6355 c4ue_cpt: 6356 ; 24/12/2024 6357 ; 18/11/2024 6358 0000291B 59 pop ecx ; * 6359 ;;; 6360 ; 29/12/2024 6361 ; 24/12/2024 (skip wave lighting if data is not loaded yet) 6362 ;cmp byte [SRB], 0 6363 ;ja short c4ue_vb_ok 6364 ;;; 6365 ; 01/12/2024 (TRDOS 386) 6366 sys _time, 4 ; get timer ticks (18.2 ticks/second), 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 0000291C BB04000000 <1> mov ebx, %2 96 <1> %if %0 >= 3 97 <1> mov ecx, %3 98 <1> %if %0 = 4 99 <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 00002921 B80D000000 <1> mov eax, %1 104 <1> 105 00002926 CD40 <1> int 40h 6367 ; 24/12/2024 6368 ; 18/11/2024 6369 ;pop ecx ; * 6370 ; 01/12/2024 6371 00002928 3B05[BC390000] cmp eax, [timerticks] 6372 ;je short c4ue_ok 6373 ; 18/11/2024 6374 0000292E 7408 je short c4ue_skip_utt 6375 c4ue_utt: 6376 ; 01/12/2024 6377 00002930 A3[BC390000] mov [timerticks], eax 6378 00002935 EB05 jmp short c4ue_cpt_@ 6379 6380 ; 30/12/2024 6381 c4ue_vb_ok: 6382 00002937 C3 retn 6383 6384 c4ue_skip_utt: 6385 ; 18/11/2024 6386 00002938 21C9 and ecx, ecx 6387 0000293A 74FB jz short c4ue_vb_ok 6388 c4ue_cpt_@: 6389 ; 18/11/2024 6390 0000293C 803D[F0380000]00 cmp byte [stopped], 0 6391 00002943 77F2 ja short c4ue_vb_ok 6392 6393 00002945 E8E0010000 call CalcProgressTime 6394 6395 ;cmp ax, [ProgressTime] 6396 ; 01/12/2024 6397 0000294A 3B05[B0390000] cmp eax, [ProgressTime] 6398 ;je short c4ue_vb_ok 6399 ; same second, no need to update 6400 ; 23/11/2024 6401 00002950 7405 je short c4ue_uvb 6402 6403 ;call UpdateProgressTime 6404 ;call UpdateProgressBar@ 6405 00002952 E8F9020000 call UpdateProgressBar 6406 6407 ; 23/11/2024 6408 c4ue_uvb: 6409 00002957 803D[F3380000]00 cmp byte [wpoints], 0 6410 0000295E 76D7 jna short c4ue_vb_ok 6411 6412 ; 30/12/2024 6413 ;call UpdateWavePoints 6414 ;retn 6415 6416 ; -------------------------------------------------------- 6417 ; 27/12/2024 - Erdogan Tan 6418 ; -------------------------------------------------------- 6419 6420 ; 30/12/2024 (cgaplay.s) 6421 ; * 320*200 pixels, 256 colors 6422 ; * 64 volume levels 6423 ; 29/12/2024 6424 ; 27/12/2024 (DMA Buffer Tracking) 6425 ; 26/12/2024 6426 ; 24/12/2024 6427 UpdateWavePoints: 6428 00002960 BE[F0330000] mov esi, prev_points 6429 00002965 833E00 cmp dword [esi], 0 6430 00002968 740B jz short lights_off_ok 6431 ;mov ecx, 640 6432 ; 30/12/2024 6433 0000296A B940010000 mov ecx, 320 6434 light_off: 6435 0000296F AD lodsd 6436 ; eax = wave point (lighting point) address 6437 00002970 C60000 mov byte [eax], 0 ; black point (light off) 6438 00002973 E2FA loop light_off 6439 6440 lights_off_ok: 6441 ; 29/12/2024 6442 00002975 803D[F1380000]32 cmp byte [tLO],'2' 6443 0000297C 7507 jne short lights_on_buff_1 6444 lights_on_buff_2: 6445 0000297E BA[00500100] mov edx, WAVBUFFER_2 6446 00002983 EB05 jmp short lights_on 6447 lights_on_buff_1: 6448 00002985 BA[00500000] mov edx, WAVBUFFER_1 6449 lights_on: 6450 0000298A 3915[F8380000] cmp [pbuf_s], edx 6451 00002990 7520 jne short lights_on_2 6452 00002992 8B1D[D8330000] mov ebx, [wpoints_dif] 6453 00002998 8B35[F4380000] mov esi, [pbuf_o] 6454 0000299E 8B0D[A8390000] mov ecx, [buffersize] ; bytes 6455 000029A4 29D9 sub ecx, ebx ; sub ecx, [wpoints_dif] 6456 000029A6 01DE add esi, ebx 6457 000029A8 7204 jc short lights_on_1 6458 000029AA 39CE cmp esi, ecx 6459 000029AC 760C jna short lights_on_3 6460 lights_on_1: 6461 000029AE 89CE mov esi, ecx 6462 000029B0 EB08 jmp short lights_on_3 6463 6464 lights_on_2: 6465 ; 29/12/2024 6466 000029B2 8915[F8380000] mov [pbuf_s], edx 6467 000029B8 31F6 xor esi, esi ; 0 6468 lights_on_3: 6469 000029BA 8935[F4380000] mov [pbuf_o], esi 6470 ; 29/12/2024 6471 ;add esi, [pbuf_s] 6472 000029C0 01D6 add esi, edx 6473 ;mov ecx, 640 6474 ; 30/12/2024 6475 000029C2 B940010000 mov ecx, 320 6476 000029C7 89CD mov ebp, ecx 6477 ; 26/12/2024 6478 000029C9 BF[F0330000] mov edi, prev_points 6479 000029CE 8B1D[DC330000] mov ebx, [graphstart] ; start (top) line 6480 lights_on_4: 6481 000029D4 31C0 xor eax, eax ; 0 6482 000029D6 66AD lodsw ; left 6483 000029D8 80C480 add ah, 80h 6484 000029DB 89C2 mov edx, eax 6485 000029DD 66AD lodsw ; right 6486 ;add ax, dx 6487 000029DF 80C480 add ah, 80h 6488 ;;shr eax, 9 ; 128 volume levels 6489 ; 01/01/2025 6490 000029E2 01D0 add eax, edx 6491 ;;shr eax, 10 ; (L+R/2) & 128 volume levels 6492 ;shr eax, 9 ; (L+R/2) & 256 volume levels 6493 ; 30/12/2024 6494 000029E4 C1E80B shr eax, 11 ; (L+R/2) & 64 volume levels 6495 ; * 320 row ; 30/12/2024 6496 000029E7 F7E5 mul ebp ; * 640 (row) 6497 000029E9 01D8 add eax, ebx ; + column 6498 000029EB 8A15[D5330000] mov dl, [ccolor] 6499 000029F1 8810 mov [eax], dl ; pixel (light on) color 6500 000029F3 AB stosd ; save light on addr in prev_points 6501 000029F4 43 inc ebx 6502 000029F5 E2DD loop lights_on_4 6503 000029F7 C3 retn 6504 6505 ; -------------------------------------------------------- 6506 ; 19/05/2024 - (playwav4.asm) ich_wav4.asm 6507 ; -------------------------------------------------------- 6508 6509 ; 29/12/2024 6510 ; 25/12/2024 6511 ; 07/12/2024 6512 ; 01/12/2024 (TRDOS 386) 6513 ; 29/11/2024 6514 check4keyboardstop: 6515 ; 19/05/2024 6516 ; 08/11/2023 6517 ; 04/11/2023 6518 000029F8 B401 mov ah, 1 6519 ;int 16h 6520 ; 01/12/2024 (TRDOS 386 keyboard interrupt) 6521 000029FA CD32 int 32h 6522 ;clc 6523 000029FC 7433 jz short _cksr 6524 6525 000029FE 30E4 xor ah, ah 6526 ;int 16h 6527 ; 01/12/2024 (TRDOS 386 keyboard interrupt) 6528 00002A00 CD32 int 32h 6529 6530 ; 25/12/2024 6531 ; 29/11/2024 6532 ;mov [command], al 6533 6534 ;;; 6535 ; 19/05/2024 (change PCM out volume) 6536 00002A02 3C2B cmp al, '+' 6537 00002A04 750D jne short p_1 6538 6539 00002A06 A0[5B2A0000] mov al, [volume] 6540 00002A0B 3C00 cmp al, 0 6541 00002A0D 7624 jna short p_3 6542 00002A0F FEC8 dec al 6543 00002A11 EB0F jmp short p_2 6544 p_1: 6545 00002A13 3C2D cmp al, '-' 6546 00002A15 751D jne short p_4 6547 6548 00002A17 A0[5B2A0000] mov al, [volume] 6549 00002A1C 3C1F cmp al, 31 6550 00002A1E 7313 jnb short p_3 6551 00002A20 FEC0 inc al 6552 p_2: 6553 00002A22 A2[5B2A0000] mov [volume], al 6554 ; 29/12/2024 6555 ; 14/11/2024 6556 00002A27 E8D5DDFFFF call SetPCMOutVolume 6557 ; 15/11/2024 (QEMU) 6558 ; 07/12/2024 6559 ;call SetMasterVolume 6560 ;call UpdateVolume 6561 ;;clc 6562 ;retn 6563 00002A2C E99A010000 jmp UpdateVolume 6564 ;mov ah, al 6565 ;mov dx, [NAMBAR] 6566 ;;add dx, CODEC_MASTER_VOL_REG 6567 ;add dx, CODEC_PCM_OUT_REG 6568 ;out dx, ax 6569 ; 6570 ;call delay1_4ms 6571 ;call delay1_4ms 6572 ;call delay1_4ms 6573 ;call delay1_4ms 6574 _cksr: ; 19/05/2024 6575 ; 18/12/2024 6576 00002A31 31C0 xor eax, eax 6577 ;clc 6578 p_3: 6579 00002A33 C3 retn 6580 p_4: 6581 ; 17/11/2024 6582 00002A34 80FC01 cmp ah, 01h ; ESC 6583 00002A37 7419 je short p_q 6584 ;cmp ax, 2E03h ; 21/12/2024 6585 00002A39 3C03 cmp al, 03h ; CTRL+C 6586 00002A3B 7415 je short p_q 6587 6588 ; 18/11/2024 6589 00002A3D 3C20 cmp al, 20h 6590 00002A3F 7419 je short p_r 6591 6592 ; 19/11/2024 6593 00002A41 3C0D cmp al, 0Dh ; CR/ENTER 6594 00002A43 7415 je short p_r 6595 6596 00002A45 24DF and al, 0DFh 6597 6598 ; 25/12/2024 6599 ; 29/11/2024 6600 00002A47 A2[FE380000] mov [command], al 6601 6602 ;cmp al, 'B' 6603 ;je short p_r 6604 ;cmp al, 'F' 6605 ;je short p_r 6606 6607 ; 29/11/2024 6608 ;cmp al, 'N' 6609 ;je short p_r 6610 ;cmp al, 'P' 6611 ;je short p_r 6612 6613 00002A4C 3C51 cmp al, 'Q' 6614 ;je short p_q 6615 00002A4E 7409 je short p_quit ; 29/11/2024 6616 6617 00002A50 F8 clc 6618 00002A51 C3 retn 6619 6620 ;;; 6621 ;_cskr: 6622 p_q: 6623 ; 27/12/2024 6624 00002A52 C605[FE380000]51 mov byte [command], 'Q' 6625 p_quit: 6626 00002A59 F9 stc 6627 p_r: 6628 00002A5A C3 retn 6629 6630 ; 29/05/2024 6631 ; 19/05/2024 6632 volume: 6633 ;db 02h 6634 ; 26/12/2024 6635 00002A5B 03 db 03h 6636 6637 ; -------------------------------------------------------- 6638 6639 ; 30/12/2024 6640 ; simulate cursor position in VGA mode 13h 6641 ; ! for 320*200, 256 colors (1 byte/pixel) ! 6642 setCursorPosition: 6643 ; dh = Row 6644 ; dl = Column 6645 6646 00002A5C 31C0 xor eax, eax 6647 ; row height is 8 pixels (8*8) 6648 00002A5E 88F0 mov al, dh 6649 00002A60 C1E003 shl eax, 3 6650 00002A63 6683C002 add ax, 2 ; top margin 6651 00002A67 C1E010 shl eax, 16 6652 00002A6A 88D0 mov al, dl ; * 8 ; character width = 8 pixels 6653 00002A6C 66C1E003 shl ax, 3 6654 ; hw = row, ax = column 6655 00002A70 A3[E0330000] mov [screenpos], eax 6656 ; 22/12/2024 6657 00002A75 31C0 xor eax, eax 6658 00002A77 C3 retn 6659 6660 ; -------------------------------------------------------- 6661 ; 14/11/2024 6662 ; (Ref: player.asm, out_cs.asm, Matan Alfasi, 2017) 6663 6664 ;; NAME: SetTotalTime 6665 ;; DESCRIPTION: Calculates the total time in seconds in file 6666 ;; INPUT: DATA_SubchunkSize, WAVE_SampleRate, WAVE_BlockAlign 6667 ;; OUTPUT: CurrentTotalTime=Total time in seconds in file, 6668 ;; Output on the screen of the total time in seconds 6669 6670 ; 01/12/2024 (32 bit registers) 6671 SetTotalTime: 6672 ;; Calculate total seconds in file 6673 ;mov ax, [DATA_SubchunkSize] 6674 ;mov dx, [DATA_SubchunkSize + 2] 6675 ;mov bx, [WAVE_SampleRate] 6676 ;div bx 6677 ;xor dx, dx 6678 ; 01/12/2024 6679 00002A78 A1[28390000] mov eax, [DATA_SubchunkSize] 6680 00002A7D 0FB71D[18390000] movzx ebx, word [WAVE_SampleRate] 6681 00002A84 31D2 xor edx, edx 6682 00002A86 F7F3 div ebx 6683 6684 ;mov bx, [WAVE_BlockAlign] 6685 ;div bx 6686 ; 01/12/2024 6687 00002A88 668B1D[20390000] mov bx, [WAVE_BlockAlign] 6688 00002A8F 31D2 xor edx, edx 6689 00002A91 F7F3 div ebx 6690 6691 ;mov [TotalTime], ax 6692 00002A93 A3[AC390000] mov [TotalTime], eax 6693 6694 00002A98 B33C mov bl, 60 6695 00002A9A F6F3 div bl 6696 6697 ;; al = minutes, ah = seconds 6698 00002A9C 50 push eax ; ** 6699 00002A9D 50 push eax ; * 6700 6701 ;mov dh, 24 6702 ; 21/12/2024 (640*480) 6703 ;mov dh, 32 6704 ;mov dl, 42 6705 ; 30/12/2024 (320*200) 6706 00002A9E B617 mov dh, 23 6707 00002AA0 B216 mov dl, 22 6708 00002AA2 E8B5FFFFFF call setCursorPosition 6709 6710 00002AA7 58 pop eax ; * 6711 00002AA8 30E4 xor ah, ah 6712 00002AAA BD02000000 mov ebp, 2 6713 00002AAF E812000000 call PrintNumber 6714 6715 ;mov dh, 24 6716 ; 21/12/2024 (640*480) 6717 ;mov dh, 32 6718 ;mov dl, 45 6719 ; 30/12/2024 (320*200) 6720 00002AB4 B617 mov dh, 23 6721 00002AB6 B219 mov dl, 25 6722 00002AB8 E89FFFFFFF call setCursorPosition 6723 6724 00002ABD 58 pop eax ; ** 6725 00002ABE 88E0 mov al, ah 6726 00002AC0 30E4 xor ah, ah 6727 ; 21/12/2024 6728 00002AC2 66BD0200 mov bp, 2 6729 ;jmp short PrintNumber 6730 6731 ; -------------------------------------------------------- 6732 6733 ; 21/12/2024 (write numbers in VESA VBE graphics mode) 6734 ; 01/12/2024 (32bit registers) 6735 PrintNumber: 6736 ; eax = binary number 6737 ; ebp = digits 6738 00002AC6 8B35[E0330000] mov esi, [screenpos] 6739 ; hw = row, si = column 6740 00002ACC BB0A000000 mov ebx, 10 6741 00002AD1 31C9 xor ecx, ecx 6742 printNumber_CutNumber: 6743 00002AD3 41 inc ecx 6744 00002AD4 31D2 xor edx, edx 6745 00002AD6 F7F3 div ebx 6746 00002AD8 52 push edx 6747 00002AD9 39E9 cmp ecx, ebp 6748 00002ADB 7402 je short printNumber_printloop 6749 00002ADD EBF4 jmp printNumber_CutNumber 6750 6751 printNumber_printloop: 6752 00002ADF 58 pop eax 6753 ; 21/12/2024 6754 ; ebp = count of digits 6755 ; eax <= 9 6756 6757 00002AE0 0430 add al, '0' 6758 6759 ; esi = pixel position (hw = row, si = column) 6760 ; eax = al = character 6761 ;call write_character 6762 ; 22/12/2024 6763 00002AE2 E82A010000 call write_character_white 6764 6765 00002AE7 4D dec ebp 6766 00002AE8 7405 jz short printNumber_ok 6767 00002AEA 83C608 add esi, 8 ; next column 6768 00002AED EBF0 jmp short printNumber_printloop 6769 printNumber_ok: 6770 00002AEF C3 retn 6771 6772 ; -------------------------------------------------------- 6773 6774 ; 14/11/2024 - Erdogan Tan 6775 SetProgressTime: 6776 ;; Calculate playing/progress seconds in file 6777 00002AF0 E835000000 call CalcProgressTime 6778 6779 ; 01/12/2024 (32bit registers) 6780 UpdateProgressTime: 6781 ; eax = (new) progress time 6782 6783 00002AF5 A3[B0390000] mov [ProgressTime], eax 6784 6785 00002AFA B33C mov bl, 60 6786 00002AFC F6F3 div bl 6787 6788 ;; al = minutes, ah = seconds 6789 00002AFE 50 push eax ; ** 6790 00002AFF 50 push eax ; * 6791 6792 ;mov dh, 24 6793 ; 21/12/2024 (640*480) 6794 ;mov dh, 32 6795 ;mov dl, 33 6796 ; 30/12/2024 (320*200) 6797 00002B00 B617 mov dh, 23 6798 00002B02 B20D mov dl, 13 6799 00002B04 E853FFFFFF call setCursorPosition 6800 6801 00002B09 58 pop eax ; * 6802 00002B0A 30E4 xor ah, ah 6803 00002B0C BD02000000 mov ebp, 2 6804 00002B11 E8B0FFFFFF call PrintNumber 6805 6806 ;mov dh, 24 6807 ; 21/12/2024 (640*480) 6808 ;mov dh, 32 6809 ;mov dl, 36 6810 ; 30/12/2024 (320*200) 6811 00002B16 B617 mov dh, 23 6812 00002B18 B210 mov dl, 16 6813 00002B1A E83DFFFFFF call setCursorPosition 6814 6815 00002B1F 58 pop eax ; ** 6816 00002B20 88E0 mov al, ah 6817 00002B22 30E4 xor ah, ah 6818 ; 21/12/2024 6819 00002B24 66BD0200 mov bp, 2 6820 00002B28 EB9C jmp short PrintNumber 6821 6822 ; -------------------------------------------------------- 6823 6824 ; 01/12/2024 (32bit registers) 6825 ; 17/11/2024 6826 ; 14/11/2024 6827 CalcProgressTime: 6828 ;mov ax, [LoadedDataBytes] 6829 ;mov dx, [LoadedDataBytes+2] 6830 ;mov bx, ax 6831 ;or bx, dx 6832 ;jz short cpt_ok 6833 ; 01/12/2024 6834 00002B2A A1[B8390000] mov eax, [LoadedDataBytes] 6835 00002B2F 09C0 or eax, eax 6836 00002B31 7416 jz short cpt_ok 6837 6838 ;mov bx, [WAVE_SampleRate] 6839 ;div bx 6840 ;xor dx, dx 6841 ;mov bx, [WAVE_BlockAlign] 6842 ;div bx 6843 ; 01/12/2024 6844 00002B33 0FB71D[18390000] movzx ebx, word [WAVE_SampleRate] 6845 00002B3A 31D2 xor edx, edx 6846 00002B3C F7F3 div ebx 6847 00002B3E 31D2 xor edx, edx 6848 00002B40 668B1D[20390000] mov bx, [WAVE_BlockAlign] 6849 00002B47 F7F3 div ebx 6850 cpt_ok: 6851 ; eax = (new) progress time 6852 00002B49 C3 retn 6853 6854 ; -------------------------------------------------------- 6855 ; 14/11/2024 6856 ; (Ref: player.asm, out_cs.asm, Matan Alfasi, 2017) 6857 6858 ;; DESCRIPTION: Update file information on template 6859 ;; PARAMS: WAVE parameters and other variables 6860 ;; REGS: AX(RW) 6861 ;; VARS: CurrentFileName, WAVE_SampleRate, 6862 ;; RETURNS: On-screen file info is updated. 6863 6864 ; 01/12/2024 (32bit registers) 6865 UpdateFileInfo: 6866 ;; Print File Name 6867 ;mov dh, 9 6868 ; 21/12/2024 (640*480 graphics display) 6869 ;mov dh, 8 6870 ;mov dl, 23 6871 ; 30/12/2024 (320*200, video mode 13h) 6872 00002B4A B607 mov dh, 7 6873 00002B4C B208 mov dl, 8 6874 00002B4E E809FFFFFF call setCursorPosition 6875 6876 00002B53 BE[40390000] mov esi, wav_file_name 6877 6878 ;;; 6879 ; 14/11/2024 6880 ; skip directory separators 6881 ; (note: asciiz string, max. 79 bytes except zero tail) 6882 00002B58 89F3 mov ebx, esi 6883 chk4_nxt_sep: 6884 00002B5A AC lodsb 6885 00002B5B 3C2F cmp al, '/' ; 14/12/2024 6886 00002B5D 7406 je short chg_fpos 6887 00002B5F 20C0 and al, al 6888 00002B61 7406 jz short chg_fpos_ok 6889 00002B63 EBF5 jmp short chk4_nxt_sep 6890 chg_fpos: 6891 00002B65 89F3 mov ebx, esi 6892 00002B67 EBF1 jmp short chk4_nxt_sep 6893 chg_fpos_ok: 6894 00002B69 89DE mov esi, ebx ; file name (without its path/directory) 6895 ;;; 6896 _fnl_chk: 6897 ; 30/12/2024 (cgaplay.s) 6898 ; ????????.wav 6899 ; 26/12/2024 (file name length limit -display-) 6900 00002B6B BB0C000000 mov ebx, 12 6901 ;mov ebx, 17 ; ????????.wav????? 6902 00002B70 56 push esi 6903 _fnl_chk_loop: 6904 00002B71 AC lodsb 6905 00002B72 20C0 and al, al 6906 00002B74 7406 jz short _fnl_ok 6907 00002B76 4B dec ebx 6908 00002B77 75F8 jnz short _fnl_chk_loop 6909 00002B79 C60600 mov byte [esi], 0 6910 _fnl_ok: 6911 00002B7C 5E pop esi 6912 ;;; 6913 6914 00002B7D E870000000 call PrintString 6915 6916 ;; Print Frequency 6917 ;mov dh, 10 6918 ; 21/12/2024 (640*480 graphics display) 6919 ;mov dh, 9 6920 ;mov dl, 23 6921 ; 30/12/2024 (320*200, video mode 13h) 6922 00002B82 B608 mov dh, 8 6923 00002B84 B208 mov dl, 8 6924 00002B86 E8D1FEFFFF call setCursorPosition 6925 ;movzx eax, word [WAVE_SampleRate] 6926 ; 22/12/2024 6927 ; eax = 0 6928 00002B8B 66A1[18390000] mov ax, [WAVE_SampleRate] 6929 00002B91 BD05000000 mov ebp, 5 6930 00002B96 E82BFFFFFF call PrintNumber 6931 6932 ;; Print BitRate 6933 ;mov dh, 9 6934 ; 21/12/2024 (640*480 graphics display) 6935 ;mov dh, 8 6936 ;mov dl, 57 6937 ; 30/12/2024 (320*200, video mode 13h) 6938 00002B9B B607 mov dh, 7 6939 00002B9D B21F mov dl, 31 6940 00002B9F E8B8FEFFFF call setCursorPosition 6941 00002BA4 66A1[22390000] mov ax, [WAVE_BitsPerSample] 6942 00002BAA 66BD0200 mov bp, 2 6943 00002BAE E813FFFFFF call PrintNumber 6944 6945 ;; Print Channel Number 6946 ;mov dh, 10 6947 ; 21/12/2024 (640*480 graphics display) 6948 ;mov dh, 9 6949 ;mov dl, 57 6950 ; 30/12/2024 (320*200, video mode 13h) 6951 00002BB3 B608 mov dh, 8 6952 00002BB5 B21F mov dl, 31 6953 00002BB7 E8A0FEFFFF call setCursorPosition 6954 00002BBC 66A1[16390000] mov ax, [WAVE_NumChannels] 6955 00002BC2 66BD0100 mov bp, 1 6956 00002BC6 E8FBFEFFFF call PrintNumber 6957 6958 ;call UpdateVolume 6959 ;retn 6960 6961 ; -------------------------------------------------------- 6962 6963 ; 14/11/2024 6964 UpdateVolume: 6965 ;; Print Volume 6966 ;mov dh, 24 6967 ; 21/12/2024 (640*480) 6968 ;mov dh, 32 6969 ;mov dl, 75 6970 ; 30/12/2024 (320*200, video mode 13h) 6971 00002BCB B617 mov dh, 23 6972 00002BCD B223 mov dl, 35 6973 00002BCF E888FEFFFF call setCursorPosition 6974 ; 22/12/2024 6975 ; eax = 0 6976 6977 00002BD4 A0[5B2A0000] mov al, [volume] 6978 6979 00002BD9 B364 mov bl, 100 6980 00002BDB F6E3 mul bl 6981 6982 00002BDD B31F mov bl, 31 6983 00002BDF F6F3 div bl 6984 6985 ;neg ax 6986 ;add ax, 100 6987 ; 01/12/2024 6988 00002BE1 B464 mov ah, 100 6989 00002BE3 28C4 sub ah, al 6990 00002BE5 0FB6C4 movzx eax, ah 6991 ;xor ah, ah 6992 ;mov bp, 3 6993 00002BE8 BD03000000 mov ebp, 3 6994 ;call PrintNumber 6995 ;retn 6996 00002BED E9D4FEFFFF jmp PrintNumber 6997 6998 ; -------------------------------------------------------- 6999 7000 ; 21/12/2024 7001 ; write text in VESA VBE graphics mode 7002 PrintString: 7003 ; esi = string address 7004 printstr_loop: 7005 00002BF2 31C0 xor eax, eax 7006 00002BF4 AC lodsb 7007 00002BF5 08C0 or al, al 7008 00002BF7 7417 jz short printstr_ok 7009 7010 00002BF9 56 push esi 7011 7012 00002BFA 8B35[E0330000] mov esi, [screenpos] 7013 7014 ; esi = pixel position (hw = row, si = column) 7015 ; eax = al = character 7016 ;call write_character 7017 ; 22/12/2024 7018 00002C00 E80C000000 call write_character_white 7019 7020 00002C05 668305[E0330000]08 add word [screenpos], 8 ; update column (only, not row) 7021 7022 00002C0D 5E pop esi 7023 00002C0E EBE2 jmp short printstr_loop 7024 7025 printstr_ok: 7026 00002C10 C3 retn 7027 7028 ; -------------------------------------------------------- 7029 7030 ; 30/12/2024 7031 ; write character (at cursor position) 7032 ; in video mode 13h (320*200, 256 colors) 7033 ; 21/12/2024 7034 ; write character (at cursor position) 7035 ; in graphics mode (640*480, 256 colors) 7036 ; 22/12/2024 7037 write_character_white: 7038 00002C11 B90F000000 mov ecx, 0Fh 7039 ; 26/12/2024 7040 ;movzx ecx, byte [tcolor] 7041 write_character: 7042 ; esi = pixel position (hw = row, si = column) 7043 ; eax = al = character 7044 ; cl = color 7045 00002C16 890D[E4330000] mov [wcolor], ecx ; 22/12/2024 7046 7047 ; 30/12/2024 7048 ; 22/12/2024 7049 00002C1C 50 push eax 7050 ; clear previous character pixels 7051 00002C1D BF[C4330000] mov edi, fillblock 7052 ;;sys _video, 020Fh, 0, 8001h 7053 ; 30/12/2024 7054 sys _video, 010Fh, 0, 8000h ; 8*8 userfont 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 00002C22 BB0F010000 <1> mov ebx, %2 96 <1> %if %0 >= 3 97 00002C27 B900000000 <1> mov ecx, %3 98 <1> %if %0 = 4 99 00002C2C BA00800000 <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 00002C31 B81F000000 <1> mov eax, %1 104 <1> 105 00002C36 CD40 <1> int 40h 7055 00002C38 58 pop eax 7056 7057 ; 30/12/2024 7058 ;shl eax, 4 ; 8*16 pixel user font 7059 ;mov edi, fontbuff2 ; start of user font data 7060 ;add edi, eax 7061 7062 ; 21/12/2024 7063 ; NOTE: 7064 ; TRDOS 386 does not use 8*14 pixel fonts in sysvideo 7065 ; system calls -in graphics mode- 7066 ; because 8*16 pixel operations are faster 7067 ; than 8*14 pixel operations. 7068 ; ((so, 8*14 fonts can be converted to 8*16 fonts by 7069 ; adding 2 empty lines)) 7070 ; (8*14 characters can be written via pixel operations) 7071 7072 ; 21/12/2024 (TRDOS 386 v2.0.9, trdosk6.s, 27/09/2024) 7073 ;;;;;;;;;;;;;;;;; ; sysvideo system call 7074 ;sysvideo: 7075 ; function in BH 7076 ; 02h: Super VGA, LINEAR FRAME BUFFER data transfers 7077 ; sub function in BL 7078 ; 0Fh: WRITE CHARACTER (FONT) 7079 ; CL = char's color (8 bit, 256 colors) 7080 ; If DH bit 7 = 1 7081 ; USER FONT (from user buffer) 7082 ; DL = 1 -> 8x16 pixel font 7083 ; EDI = user's font buffer address 7084 ; (NOTE: byte order is as row0,row1,row2..) 7085 ; ESI = start position (row, column) 7086 ; (HW = row, SI = column) 7087 ;;;;;;;;;;;;;;;;; 7088 7089 ;sys _video, 020Fh, [wcolor], 8001h 7090 7091 ; 30/12/2024 7092 ; sysvideo system call 7093 ; BH = 01h = VGA graphics (0A0000h) data transfers 7094 ; BL = 0Fh = write character/font 7095 ; DH = 01h = 8*8 system font 7096 ; CL = [wcolor] = color 7097 ; ESI = cursor/writing position (pixels) 7098 ; HW = row, SI = column 7099 ; DL = character (ASCII code) 7100 7101 00002C39 B401 mov ah, 01h ; 8*8 pixels 7102 7103 sys _video, 010Fh, [wcolor], eax 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 00002C3B BB0F010000 <1> mov ebx, %2 96 <1> %if %0 >= 3 97 00002C40 8B0D[E4330000] <1> mov ecx, %3 98 <1> %if %0 = 4 99 00002C46 89C2 <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 00002C48 B81F000000 <1> mov eax, %1 104 <1> 105 00002C4D CD40 <1> int 40h 7104 7105 00002C4F C3 retn 7106 7107 ; -------------------------------------------------------- 7108 7109 ; 30/12/2024 7110 ; write characters in video mode 13h 7111 ; (320*200 pixels, 256 colors) 7112 ; 22/12/2024 7113 ; 21/12/2024 7114 ; (write chars in VESA VBE graphics mode) 7115 ; 14/11/2024 7116 ; (Ref: player.asm, Matan Alfasi, 2017) 7117 ; (Modification: Erdogan Tan, 14/11/2024) 7118 7119 ;PROGRESSBAR_ROW equ 23 7120 ; 21/12/2024 (640*480) 7121 ;PROGRESSBAR_ROW equ 31 7122 ; 30/12/2024 (320*200) 7123 PROGRESSBAR_ROW equ 22 7124 7125 UpdateProgressBar: 7126 00002C50 E89BFEFFFF call SetProgressTime ; 14/11/2024 7127 7128 ; 01/12/2024 (32bit registers) 7129 00002C55 A1[B0390000] mov eax, [ProgressTime] 7130 UpdateProgressBar@: 7131 ;mov edx, 80 7132 ; 30/12/2024 7133 00002C5A BA28000000 mov edx, 40 ; 320*200 pixels, 40 columns 7134 00002C5F F7E2 mul edx 7135 00002C61 8B1D[AC390000] mov ebx, [TotalTime] 7136 00002C67 F7F3 div ebx 7137 7138 ; 22/12/2024 7139 ; check progress bar indicator position if it is same 7140 00002C69 3A05[E9330000] cmp al, [pbprev] 7141 00002C6F 7430 je short UpdateProgressBar_ok 7142 00002C71 A2[E9330000] mov [pbprev], al 7143 7144 UpdateProgressBar@@: 7145 ;; Push for the 'Clean' part 7146 00002C76 50 push eax ; ** 7147 00002C77 50 push eax ; * 7148 7149 ;; Set cursor position 7150 00002C78 B616 mov dh, PROGRESSBAR_ROW 7151 00002C7A B200 mov dl, 0 7152 00002C7C E8DBFDFFFF call setCursorPosition 7153 7154 00002C81 58 pop eax ; * 7155 00002C82 09C0 or eax, eax 7156 00002C84 742D jz short UpdateProgressBar_Clean 7157 7158 UpdateProgressBar_DrawProgress: 7159 ; 22/12/2024 7160 ; 21/12/2024 7161 ; (write progress bar chars in graphics mode) 7162 ;;;; 7163 00002C86 89C5 mov ebp, eax 7164 00002C88 50 push eax ; *** 7165 00002C89 8B35[E0330000] mov esi, [screenpos] 7166 UpdateProgressBar_DrawProgress_@: 7167 00002C8F B8DF000000 mov eax, 223 7168 7169 ; esi = pixel position (hw = row, si = column) 7170 ; eax = al = character 7171 ;call write_character 7172 ; 22/12/2024 7173 00002C94 E878FFFFFF call write_character_white 7174 7175 00002C99 4D dec ebp 7176 00002C9A 7406 jz short UpdateProgressBar_DrawCursor 7177 7178 00002C9C 83C608 add esi, 8 ; next column 7179 00002C9F EBEE jmp short UpdateProgressBar_DrawProgress_@ 7180 ;;; 7181 7182 UpdateProgressBar_ok: 7183 00002CA1 C3 retn 7184 7185 UpdateProgressBar_DrawCursor: 7186 ; 22/12/2024 7187 00002CA2 5A pop edx ; *** 7188 00002CA3 B616 mov dh, PROGRESSBAR_ROW 7189 00002CA5 E8B2FDFFFF call setCursorPosition 7190 7191 ; 21/12/2024 7192 ; (write progress bar character in graphics mode) 7193 ;;;; 7194 ;;;mov eax, 223 7195 ;;;shl eax, 4 ; 8*16 pixel user font 7196 ;;mov eax, 223*16 7197 ;;mov edi, fontbuff2 ; start of user font data 7198 ;;add edi, eax 7199 ;mov edi, fontbuff2+(223*16) 7200 ; 7201 ;sys _video, 020Fh, 0Ch, 8001h 7202 ; 22/12/2024 7203 ;mov eax, 223 7204 ; eax = 0 7205 00002CAA B0DF mov al, 223 7206 00002CAC B10C mov cl, 0Ch ; red 7207 00002CAE E863FFFFFF call write_character 7208 ;;;; 7209 7210 UpdateProgressBar_Clean: 7211 ;pop eax ; ** 7212 ; 22/12/2024 7213 00002CB3 5A pop edx ; ** 7214 ; 30/12/2024 7215 ; 21/12/2024 7216 ;mov ebp, 80 7217 ; 30/12/2024 7218 00002CB4 BD28000000 mov ebp, 40 ; 40 columns (320*200 pixels) 7219 ;sub bp, ax 7220 00002CB9 6629D5 sub bp, dx ; 22/12/2024 7221 00002CBC 74E3 jz short UpdateProgressBar_ok 7222 7223 00002CBE B616 mov dh, PROGRESSBAR_ROW 7224 ;mov dl, al ; 22/12/2024 7225 00002CC0 E897FDFFFF call setCursorPosition 7226 7227 ; 21/12/2024 7228 ; (write progress bar chars in graphics mode) 7229 ;;;; 7230 00002CC5 8B35[E0330000] mov esi, [screenpos] 7231 UpdateProgressBar_Clean_@: 7232 ;;;mov eax, 223 7233 ;;;shl eax, 4 ; 8*16 pixel user font 7234 ;;mov eax, 223*16 7235 ;mov edi, fontbuff2 ; start of user font data 7236 ;add edi, eax 7237 ;mov edi, fontbuff2+(223*16) 7238 ; 7239 ;sys _video, 020Fh, 08h, 8001h 7240 ; 22/12/2024 7241 ;mov eax, 223 7242 ; eax = 0 7243 00002CCB B0DF mov al, 223 7244 00002CCD B108 mov cl, 08h ; gray (dark) 7245 00002CCF E842FFFFFF call write_character 7246 ;;;; 7247 7248 00002CD4 4D dec ebp 7249 00002CD5 74CA jz short UpdateProgressBar_ok 7250 7251 00002CD7 83C608 add esi, 8 ; next column 7252 00002CDA EBEF jmp short UpdateProgressBar_Clean_@ 7253 ;;;; 7254 7255 ; -------------------------------------------------------- 7256 ; 17/11/2024 7257 7258 Player_ProcessKey_Backwards: 7259 ;; In order to go backwards 5 seconds: 7260 ;; Update file pointer to the beginning, skip headers 7261 00002CDC B142 mov cl, 'B' 7262 00002CDE EB02 jmp short Player_ProcessKey_B_or_F 7263 7264 Player_ProcessKey_Forwards: 7265 ;; In order to fast-forward 5 seconds, set the file pointer 7266 ;; to CUR_SEEK + 5 * Freq 7267 7268 00002CE0 B146 mov cl, 'F' 7269 ;jmp short Player_ProcessKey_B_or_F 7270 7271 ; 01/12/2024 (32bit regsisters) 7272 Player_ProcessKey_B_or_F: 7273 ; 17/11/2024 7274 ; 04/11/2024 7275 ; (Ref: player.asm, Matan Alfasi, 2017) 7276 7277 ; 04/11/2024 7278 00002CE2 B805000000 mov eax, 5 7279 00002CE7 0FB71D[20390000] movzx ebx, word [WAVE_BlockAlign] 7280 00002CEE F7E3 mul ebx 7281 00002CF0 668B1D[18390000] mov bx, [WAVE_SampleRate] 7282 00002CF7 F7E3 mul ebx 7283 ; eax = transfer byte count for 5 seconds 7284 7285 ; 17/11/2024 7286 00002CF9 80F942 cmp cl, 'B' 7287 ;mov bx, [LoadedDataBytes] 7288 ;mov cx, [LoadedDataBytes+2] 7289 ; 01/12/2024 7290 00002CFC 8B0D[B8390000] mov ecx, [LoadedDataBytes] 7291 00002D02 7508 jne short move_forward ; cl = 'F' 7292 move_backward: 7293 ;sub bx, ax 7294 ;sbb cx, dx 7295 00002D04 29C1 sub ecx, eax 7296 00002D06 7316 jnc short move_file_pointer 7297 move_to_beginning: 7298 ;xor cx, cx ; 0 7299 ;xor bx, bx ; 0 7300 00002D08 31C9 xor ecx, ecx 7301 00002D0A EB12 jmp short move_file_pointer 7302 move_forward: 7303 ;add bx, ax 7304 ;adc cx, dx 7305 00002D0C 01C1 add ecx, eax 7306 00002D0E 7208 jc short move_to_end 7307 ;cmp cx, [DATA_SubchunkSize+2] 7308 ;ja short move_to_end 7309 ;jb short move_file_pointer 7310 ;cmp bx, [DATA_SubchunkSize] 7311 ;jna short move_file_pointer 7312 00002D10 3B0D[28390000] cmp ecx, [DATA_SubchunkSize] 7313 00002D16 7606 jna short move_file_pointer 7314 move_to_end: 7315 ;mov bx, [DATA_SubchunkSize] 7316 ;mov cx, [DATA_SubchunkSize+2] 7317 00002D18 8B0D[28390000] mov ecx, [DATA_SubchunkSize] 7318 move_file_pointer: 7319 ;mov dx, bx 7320 ;mov [LoadedDataBytes], dx 7321 ;mov [LoadedDataBytes+2], cx 7322 00002D1E 890D[B8390000] mov [LoadedDataBytes], ecx 7323 ;add dx, 44 ; + header 7324 ;adc cx, 0 7325 00002D24 83C12C add ecx, 44 7326 7327 ; seek 7328 ;mov bx, [filehandle] 7329 ;mov ax, 4200h 7330 ;int 21h 7331 ; 01/12/2024 7332 00002D27 31D2 xor edx, edx ; offset from beginning of the file 7333 ; ecx = offset 7334 ; ebx = file handle 7335 ; edx = 0 7336 sys _seek, [filehandle] 90 <1> 91 <1> 92 <1> 93 <1> 94 <1> %if %0 >= 2 95 00002D29 8B1D[30390000] <1> mov ebx, %2 96 <1> %if %0 >= 3 97 <1> mov ecx, %3 98 <1> %if %0 = 4 99 <1> mov edx, %4 100 <1> %endif 101 <1> %endif 102 <1> %endif 103 00002D2F B813000000 <1> mov eax, %1 104 <1> 105 00002D34 CD40 <1> int 40h 7337 00002D36 C3 retn 7338 7339 ; -------------------------------------------------------- 7340 7341 ; 30/12/2024 (video mode 13h) 7342 ; (320*200, 256 colors) 7343 ; 25/12/2024 7344 ; 22/12/2024 (VESA VBE mode graphics) 7345 ; (640*480, 256 colors) 7346 clear_window: 7347 ;mov edi, [LFB_ADDR] 7348 ; 30/12/2024 7349 ;mov edi, 0A0000h 7350 ;;add edi, (13*80*8*14) 7351 ; 25/12/2024 7352 ;;add edi, 164*640 7353 ;add edi, 12*8*320 7354 ; 30/12/2024 7355 ;mov edi, [graphstart] ; 12*8*320 7356 00002D37 BF80700A00 mov edi, 0A0000h+(11*8*320)+(2*320) ; * 7357 ; AC97 info start 7358 00002D3C 29C0 sub eax, eax 7359 ;;mov ecx, (16*640*14)/4 ; 16 rows 7360 ;mov ecx, 64*640 ; 256 volume level points 7361 ; 30/12/2024 7362 ;mov ecx, (8*8*320)/4 ; 8 rows 7363 00002D3E B900190000 mov ecx, (10*8*320)/4 ; * 7364 00002D43 F3AB rep stosd 7365 ; 24/12/2024 7366 00002D45 A3[F0330000] mov [prev_points], eax ; 0 7367 ; 7368 00002D4A C3 retn 7369 7370 ; ------------------------------------------------------------- 7371 ; ac97.inc (11/11/2023) 7372 ; ------------------------------------------------------------- 7373 7374 ; special characters 7375 LF EQU 10 7376 CR EQU 13 7377 7378 ; PCI stuff 7379 7380 BIT0 EQU 1 7381 BIT1 EQU 2 7382 BIT2 EQU 4 7383 BIT8 EQU 100h 7384 BIT9 EQU 200h 7385 BIT28 EQU 10000000h 7386 BIT30 EQU 40000000h 7387 BIT31 EQU 80000000h 7388 7389 BUP equ BIT30 ; Buffer Underrun Policy. 7390 ; if this buffer is the last buffer 7391 ; in a playback, fill the remaining 7392 ; samples with 0 (silence) or not. 7393 ; It's a good idea to set this to 1 7394 ; for the last buffer in playback, 7395 ; otherwise you're likely to get a lot 7396 ; of noise at the end of the sound. 7397 7398 RR equ BIT1 ; reset registers. Nukes all regs 7399 ; except bits 4:2 of this register. 7400 ; Only set this bit if BIT 0 is 0 7401 RPBM equ BIT0 ; Run/Pause 7402 ; set this bit to start the codec! 7403 IO_ENA EQU BIT0 ; i/o decode enable 7404 BM_ENA EQU BIT2 ; bus master enable 7405 7406 PCI_INDEX_PORT EQU 0CF8h 7407 PCI_DATA_PORT EQU 0CFCh 7408 PCI32 EQU BIT31 ; bitflag to signal 32bit access 7409 PCI16 EQU BIT30 ; bitflag for 16bit access 7410 7411 AC97_INT_LINE equ 3Ch ; AC97 Interrupt Line register offset 7412 7413 ; Intel ICH2 equates. It is assumed that ICH0 and plain ole ICH are compatible. 7414 7415 INTEL_VID equ 8086h ; Intel's PCI vendor ID 7416 ; 03/11/2023 - Erdogan Tan (Ref: MenuetOS AC97 WAV Player source code, 2004) 7417 SIS_VID equ 1039h 7418 NVIDIA_VID equ 10DEh ; Ref: MPXPLAY/SBEMU/KOLIBRIOS AC97 source c. 7419 AMD_VID equ 1022h 7420 7421 ICH_DID equ 2415h ; ICH device ID 7422 ICH0_DID equ 2425h ; ICH0 7423 ICH2_DID equ 2445h ; ICH2 I think there are more ICHes. 7424 ; they all should be compatible. 7425 7426 ; 17/02/2017 (Erdogan Tan, ref: ALSA Device IDs, ALSA project) 7427 ICH3_DID equ 2485h ; ICH3 7428 ICH4_DID equ 24C5h ; ICH4 7429 ICH5_DID equ 24D5h ; ICH5 7430 ICH6_DID equ 266Eh ; ICH6 7431 ESB6300_DID equ 25A6h ; 6300ESB 7432 ESB631X_DID equ 2698h ; 631XESB 7433 ICH7_DID equ 27DEh ; ICH7 7434 ; 03/11/2023 - Erdogan Tan (Ref: MenuetOS AC97 WAV Player source code, 2004) 7435 MX82440_DID equ 7195h 7436 SI7012_DID equ 7012h 7437 NFORCE_DID equ 01B1h 7438 NFORCE2_DID equ 006Ah 7439 AMD8111_DID equ 746Dh 7440 AMD768_DID equ 7445h 7441 ; 03/11/2023 - Erdogan Tan - Ref: MPXPLAY/SBEMU/KOLIBRIOS AC97 source code 7442 CK804_DID equ 0059h 7443 MCP04_DID equ 003Ah 7444 CK8_DID equ 008Ah 7445 NFORCE3_DID equ 00DAh 7446 CK8S_DID equ 00EAh 7447 7448 NAMBAR_REG equ 10h ; native audio mixer BAR 7449 NABMBAR_REG equ 14h ; native audio bus mastering BAR 7450 7451 CODEC_MASTER_VOL_REG equ 02h ; master volume 7452 CODEC_MASTER_TONE_REG equ 08h ; master tone (R+L) 7453 CODEC_PCM_OUT_REG equ 18h ; PCM output volume 7454 CODEC_EXT_AUDIO_REG equ 28h ; extended audio 7455 CODEC_EXT_AUDIO_CTRL_REG equ 2Ah ; extended audio control 7456 CODEC_PCM_FRONT_DACRATE_REG equ 2Ch ; PCM out sample rate 7457 7458 ; ICH supports 3 different types of register sets for three types of things 7459 ; it can do, thus: 7460 ; 7461 ; PCM in (for recording) aka PI 7462 ; PCM out (for playback) aka PO 7463 ; MIC in (for recording) aka MC 7464 7465 PI_BDBAR_REG equ 0 ; PCM in buffer descriptor BAR 7466 PO_BDBAR_REG equ 10h ; PCM out buffer descriptor BAR 7467 7468 GLOB_CNT_REG equ 2Ch ; Global control register 7469 GLOB_STS_REG equ 30h ; Global Status register (RO) 7470 7471 PI_CR_REG equ 0Bh ; PCM in Control Register 7472 PO_CR_REG equ 1Bh ; PCM out Control Register 7473 MC_CR_REG equ 2Bh ; MIC in Control Register 7474 7475 PCI_CMD_REG EQU 04h ; reg 04h, command register 7476 7477 CTRL_ST_CREADY equ BIT8+BIT9+BIT28 ; Primary Codec Ready 7478 CODEC_REG_POWERDOWN equ 26h 7479 7480 PO_CIV_REG equ 14h ; PCM out current Index value (RO) 7481 PO_LVI_REG equ 15h ; PCM out Last Valid Index 7482 PO_SR_REG equ 16h ; PCM out Status register 7483 7484 ; ------------------------------------------------------------- 7485 7486 ; 22/12/2024 7487 00002D4B 90 align 4 7488 7489 ; 13/11/2024 7490 ; ('<<' to 'shl' conversion for FASM) 7491 ; 7492 ; 29/05/2024 (TRDOS 386) 7493 ; 17/02/2017 7494 ; Valid ICH device IDs 7495 7496 valid_ids: 7497 ;dd (ICH_DID shl 16) + INTEL_VID ; 8086h:2415h 7498 00002D4C 86801524 dd (ICH_DID << 16) + INTEL_VID ; 8086h:2415h 7499 00002D50 86802524 dd (ICH0_DID << 16) + INTEL_VID ; 8086h:2425h 7500 00002D54 86804524 dd (ICH2_DID << 16) + INTEL_VID ; 8086h:2445h 7501 00002D58 86808524 dd (ICH3_DID << 16) + INTEL_VID ; 8086h:2485h 7502 00002D5C 8680C524 dd (ICH4_DID << 16) + INTEL_VID ; 8086h:24C5h 7503 00002D60 8680D524 dd (ICH5_DID << 16) + INTEL_VID ; 8086h:24D5h 7504 00002D64 86806E26 dd (ICH6_DID << 16) + INTEL_VID ; 8086h:266Eh 7505 00002D68 8680A625 dd (ESB6300_DID << 16) + INTEL_VID ; 8086h:25A6h 7506 00002D6C 86809826 dd (ESB631X_DID << 16) + INTEL_VID ; 8086h:2698h 7507 00002D70 8680DE27 dd (ICH7_DID << 16) + INTEL_VID ; 8086h:27DEh 7508 ; 03/11/2023 - Erdogan Tan 7509 00002D74 86809571 dd (MX82440_DID << 16) + INTEL_VID ; 8086h:7195h 7510 00002D78 39101270 dd (SI7012_DID << 16) + SIS_VID ; 1039h:7012h 7511 00002D7C DE10B101 dd (NFORCE_DID << 16) + NVIDIA_VID ; 10DEh:01B1h 7512 00002D80 DE106A00 dd (NFORCE2_DID << 16) + NVIDIA_VID ; 10DEh:006Ah 7513 00002D84 22106D74 dd (AMD8111_DID << 16) + AMD_VID ; 1022h:746Dh 7514 00002D88 22104574 dd (AMD768_DID << 16) + AMD_VID ; 1022h:7445h 7515 00002D8C DE105900 dd (CK804_DID << 16) + NVIDIA_VID ; 10DEh:0059h 7516 00002D90 DE103A00 dd (MCP04_DID << 16) + NVIDIA_VID ; 10DEh:003Ah 7517 00002D94 DE108A00 dd (CK8_DID << 16) + NVIDIA_VID ; 1022h:008Ah 7518 00002D98 DE10DA00 dd (NFORCE3_DID << 16) + NVIDIA_VID ; 10DEh:00DAh 7519 00002D9C DE10EA00 dd (CK8S_DID << 16) + NVIDIA_VID ; 10DEh:00EAh 7520 7521 valid_id_count equ (($ - valid_ids)>>2) ; 05/11/2023 7522 ; 13/11/2024 7523 ;valid_id_count = ($ - valid_ids) shr 2 ; 05/11/2023 7524 7525 00002DA0 00000000 dd 0 7526 7527 Credits: 7528 00002DA4 564741205741562050- db 'VGA WAV Player for TRDOS 386 by Erdogan Tan. ' 7528 00002DAD 6C6179657220666F72- 7528 00002DB6 205452444F53203338- 7528 00002DBF 36206279204572646F- 7528 00002DC8 67616E2054616E2E20 7529 ;db 'January 2025.',10,13,0 7530 00002DD1 466562727561727920- db 'February 2025.', 10,13,0 7530 00002DDA 323032352E0A0D00 7531 ;;db '01/01/2025', 10,13 7532 ;db '18/01/2025', 10,13 7533 00002DE2 30352F30322F323032- db '05/02/2025', 10,13 7533 00002DEB 350A0D 7534 ; 15/11/2024 7535 reset: 7536 00002DEE 00 db 0 7537 7538 msgAudioCardInfo: 7539 00002DEF 666F7220496E74656C- db 'for Intel AC97 (ICH) Audio Controller.', 10,13,0 7539 00002DF8 204143393720284943- 7539 00002E01 482920417564696F20- 7539 00002E0A 436F6E74726F6C6C65- 7539 00002E13 722E0A0D00 7540 7541 ; 30/12/2024 7542 msg_usage: 7543 00002E18 75736167653A204347- db 'usage: CGAPLAY <...>',10,13,0 7543 00002E21 41504C4159203C4669- 7543 00002E2A 6C654E616D65313E20- 7543 00002E33 3C46696C654E616D65- 7543 00002E3C 323E203C2E2E2E3E0A- 7543 00002E45 0D00 7544 7545 noDevMsg: 7546 00002E47 4572726F723A20556E- db 'Error: Unable to find AC97 audio device!' 7546 00002E50 61626C6520746F2066- 7546 00002E59 696E64204143393720- 7546 00002E62 617564696F20646576- 7546 00002E6B 69636521 7547 00002E6F 0A0D00 db 10,13,0 7548 7549 noFileErrMsg: 7550 00002E72 4572726F723A206669- db 'Error: file not found.',10,13,0 7550 00002E7B 6C65206E6F7420666F- 7550 00002E84 756E642E0A0D00 7551 7552 ; 07/12/2024 7553 trdos386_err_msg: 7554 00002E8B 5452444F5320333836- db 'TRDOS 386 System call error !',10,13,0 7554 00002E94 2053797374656D2063- 7554 00002E9D 616C6C206572726F72- 7554 00002EA6 20210A0D00 7555 7556 ; 29/05/2024 7557 ; 11/11/2023 7558 msg_init_err: 7559 00002EAB 0D0A db CR, LF 7560 00002EAD 4143393720436F6E74- db 'AC97 Controller/Codec initialization error !' 7560 00002EB6 726F6C6C65722F436F- 7560 00002EBF 64656320696E697469- 7560 00002EC8 616C697A6174696F6E- 7560 00002ED1 206572726F722021 7561 00002ED9 0D0A00 db CR, LF, 0 ; 07/12/2024 7562 7563 ; 25/11/2023 7564 msg_no_vra: 7565 00002EDC 0A0D db 10,13 7566 00002EDE 4E6F20565241207375- db 'No VRA support ! Only 48 kHZ sample rate supported !' 7566 00002EE7 70706F72742021204F- 7566 00002EF0 6E6C79203438206B48- 7566 00002EF9 5A2073616D706C6520- 7566 00002F02 726174652073757070- 7566 00002F0B 6F727465642021 7567 00002F12 0A0D00 db 10,13,0 7568 7569 ; 19/11/2024 7570 ; 03/06/2017 7571 hex_chars: 7572 00002F15 303132333435363738- db '0123456789ABCDEF', 0 7572 00002F1E 3941424344454600 7573 msgAC97Info: 7574 00002F26 0D0A db 0Dh, 0Ah 7575 00002F28 204143393720417564- db ' AC97 Audio Controller & Codec Info', 0Dh, 0Ah 7575 00002F31 696F20436F6E74726F- 7575 00002F3A 6C6C6572202620436F- 7575 00002F43 64656320496E666F0D- 7575 00002F4C 0A 7576 00002F4D 2056656E646F722049- db ' Vendor ID: ' 7576 00002F56 443A20 7577 msgVendorId: 7578 00002F59 303030306820446576- db '0000h Device ID: ' 7578 00002F62 6963652049443A20 7579 msgDevId: 7580 00002F6A 30303030680D0A db '0000h', 0Dh, 0Ah 7581 00002F71 204275733A20 db ' Bus: ' 7582 msgBusNo: 7583 00002F77 303068204465766963- db '00h Device: ' 7583 00002F80 653A20 7584 msgDevNo: 7585 00002F83 3030682046756E6374- db '00h Function: ' 7585 00002F8C 696F6E3A20 7586 msgFncNo: 7587 00002F91 303068 db '00h' 7588 00002F94 0D0A db 0Dh, 0Ah 7589 00002F96 204E414D4241523A20 db ' NAMBAR: ' 7590 msgNamBar: 7591 00002F9F 30303030682020 db '0000h ' 7592 00002FA6 4E41424D4241523A20 db 'NABMBAR: ' 7593 msgNabmBar: 7594 00002FAF 303030306820204952- db '0000h IRQ: ' 7594 00002FB8 513A20 7595 msgIRQ: 7596 00002FBB 3030 dw 3030h 7597 00002FBD 0D0A00 db 0Dh, 0Ah, 0 7598 ; 25/11/2023 7599 msgVRAheader: 7600 00002FC0 205652412073757070- db ' VRA support: ' 7600 00002FC9 6F72743A20 7601 00002FCE 00 db 0 7602 msgVRAyes: 7603 00002FCF 5945530D0A00 db 'YES', 0Dh, 0Ah, 0 7604 msgVRAno: 7605 00002FD5 4E4F200D0A db 'NO ', 0Dh, 0Ah 7606 ;db ' (Interpolated sample rate playing method)' 7607 ; 30/12/2024 7608 00002FDA 2028496E746572706F- db ' (Interpolated samplerate play method)' 7608 00002FE3 6C617465642073616D- 7608 00002FEC 706C65726174652070- 7608 00002FF5 6C6179206D6574686F- 7608 00002FFE 6429 7609 00003000 0D0A00 db 0Dh, 0Ah, 0 7610 7611 00003003 90 align 4 7612 7613 ; ------------------------------------------------------------- 7614 7615 ; 30/12/2024 7616 PlayingScreen: 7617 00003004 DBDBDBDBDBDBDBDBDB- db 14 dup(219), " DOS Player ", 14 dup(219) 7617 0000300D DBDBDBDBDB20444F53- 7617 00003016 20506C6179657220DB- 7617 0000301F DBDBDBDBDBDBDBDBDB- 7617 00003028 DBDBDBDB 7618 0000302C C9CDCDCDCDCDCDCDCD- db 201, 38 dup(205), 187 7618 00003035 CDCDCDCDCDCDCDCDCD- 7618 0000303E CDCDCDCDCDCDCDCDCD- 7618 00003047 CDCDCDCDCDCDCDCDCD- 7618 00003050 CDCDCDBB 7619 00003054 BA203C53706163653E- db 186, " Play/Pause /

Next/Prev ", 186 7619 0000305D 20506C61792F506175- 7619 00003066 7365203C4E3E2F3C50- 7619 0000306F 3E204E6578742F5072- 7619 00003078 657620BA 7620 0000307C BA203C533E20202020- db 186, " Stop Color ", 186 7620 00003085 2053746F7020202020- 7620 0000308E 2020203C456E746572- 7620 00003097 3E20436F6C6F722020- 7620 000030A0 202020BA 7621 000030A4 BA203C463E20202020- db 186, " Forwards <+>/<-> Volume ", 186 7621 000030AD 20466F727761726473- 7621 000030B6 2020203C2B3E2F3C2D- 7621 000030BF 3E20566F6C756D6520- 7621 000030C8 202020BA 7622 000030CC BA203C423E20202020- db 186, " Backwards Quit Prg ", 186 7622 000030D5 204261636B77617264- 7622 000030DE 7320203C513E202020- 7622 000030E7 202051756974205072- 7622 000030F0 672020BA 7623 000030F4 CCCDCDCDCDCDCDCDCD- db 204, 38 dup(205), 185 7623 000030FD CDCDCDCDCDCDCDCDCD- 7623 00003106 CDCDCDCDCDCDCDCDCD- 7623 0000310F CDCDCDCDCDCDCDCDCD- 7623 00003118 CDCDCDB9 7624 0000311C BA2046696C653A2020- db 186, " File: Bits: 0 ", 186 7624 00003125 202020202020202020- 7624 0000312E 202020426974733A20- 7624 00003137 202020203020202020- 7624 00003140 202020BA 7625 00003144 BA20467265713A2030- db 186, " Freq: 0 Hz Channels: 0 ", 186 7625 0000314D 2020202020487A2020- 7625 00003156 2020204368616E6E65- 7625 0000315F 6C733A203020202020- 7625 00003168 202020BA 7626 0000316C C8CDCDCDCDCDCDCDCD- db 200, 38 dup(205), 188 7626 00003175 CDCDCDCDCDCDCDCDCD- 7626 0000317E CDCDCDCDCDCDCDCDCD- 7626 00003187 CDCDCDCDCDCDCDCDCD- 7626 00003190 CDCDCDBC 7627 00003194 202020202020202020- db 40 dup(32) 7627 0000319D 202020202020202020- 7627 000031A6 202020202020202020- 7627 000031AF 202020202020202020- 7627 000031B8 20202020 7628 improper_samplerate_txt: 7629 read_error_txt: 7630 000031BC 202020202020202020- db 40 dup(32) 7630 000031C5 202020202020202020- 7630 000031CE 202020202020202020- 7630 000031D7 202020202020202020- 7630 000031E0 20202020 7631 000031E4 202020202020202020- db 40 dup(32) 7631 000031ED 202020202020202020- 7631 000031F6 202020202020202020- 7631 000031FF 202020202020202020- 7631 00003208 20202020 7632 0000320C 202020202020202020- db 40 dup(32) 7632 00003215 202020202020202020- 7632 0000321E 202020202020202020- 7632 00003227 202020202020202020- 7632 00003230 20202020 7633 00003234 202020202020202020- db 40 dup(32) 7633 0000323D 202020202020202020- 7633 00003246 202020202020202020- 7633 0000324F 202020202020202020- 7633 00003258 20202020 7634 0000325C 202020202020202020- db 40 dup(32) 7634 00003265 202020202020202020- 7634 0000326E 202020202020202020- 7634 00003277 202020202020202020- 7634 00003280 20202020 7635 00003284 202020202020202020- db 40 dup(32) 7635 0000328D 202020202020202020- 7635 00003296 202020202020202020- 7635 0000329F 202020202020202020- 7635 000032A8 20202020 7636 000032AC 202020202020202020- db 40 dup(32) 7636 000032B5 202020202020202020- 7636 000032BE 202020202020202020- 7636 000032C7 202020202020202020- 7636 000032D0 20202020 7637 000032D4 202020202020202020- db 40 dup(32) 7637 000032DD 202020202020202020- 7637 000032E6 202020202020202020- 7637 000032EF 202020202020202020- 7637 000032F8 20202020 7638 000032FC 202020202020202020- db 40 dup(32) 7638 00003305 202020202020202020- 7638 0000330E 202020202020202020- 7638 00003317 202020202020202020- 7638 00003320 20202020 7639 00003324 202020202020202020- db 40 dup(32) 7639 0000332D 202020202020202020- 7639 00003336 202020202020202020- 7639 0000333F 202020202020202020- 7639 00003348 20202020 7640 0000334C CDCDCDCDCDCDCDCDCD- db 40 dup(205) 7640 00003355 CDCDCDCDCDCDCDCDCD- 7640 0000335E CDCDCDCDCDCDCDCDCD- 7640 00003367 CDCDCDCDCDCDCDCDCD- 7640 00003370 CDCDCDCD 7641 00003374 202020202020202020- db 40 dup(32) 7641 0000337D 202020202020202020- 7641 00003386 202020202020202020- 7641 0000338F 202020202020202020- 7641 00003398 20202020 7642 0000339C 202020202020202020- db 13 dup(32), "00:00 ", 174, 175, " 00:00", 4 dup(32), "VOL 000%" 7642 000033A5 2020202030303A3030- 7642 000033AE 20AEAF2030303A3030- 7642 000033B7 20202020564F4C2030- 7642 000033C0 303025 7643 ;db 40 dup(32) ; not necessary 7644 000033C3 00 db 0 7645 7646 ; ------------------------------------------------------------- 7647 7648 ; 30/12/2024 7649 fillblock: 7650 000033C4 FF times 8 db 0FFh 7651 000033CC 0000 dw 0 7652 7653 ; ------------------------------------------------------------- 7654 7655 ; 30/12/2024 7656 ; 23/11/2024 7657 colors: 7658 000033CE 0F0B0A0C0E090D db 0Fh, 0Bh, 0Ah, 0Ch, 0Eh, 09h, 0Dh 7659 ; white, cyan, green, red, yellow, blue, magenta 7660 000033D5 0B ccolor: db 0Bh ; cyan 7661 7662 EOF: 7663 7664 ; ------------------------------------------------------------- 7665 7666 bss: 7667 7668 ABSOLUTE bss 7669 7670 000033D6 ???? alignb 4 7671 7672 ; 24/12/2024 7673 wpoints_dif: ; wave lighting points factor (differential) 7674 000033D8 ???????? resd 1 ; required bytes for 1/18 second wave lighting 7675 graphstart: 7676 000033DC ???????? resd 1 ; start (top) line/row for wave lighting points 7677 7678 ; 30/12/2024 7679 ;LFB_ADDR: 7680 ; resd 1 7681 7682 ;nextrow: 7683 ;resd 1 7684 screenpos: ; hw = (cursor) row, lw = (cursor) column 7685 000033E0 ???????? resd 1 7686 000033E4 ???????? wcolor: resd 1 7687 ; 26/12/2024 7688 ;tcolor: resb 1 ; text color 7689 columns: 7690 000033E8 ?? resb 1 7691 000033E9 ?? pbprev: resb 1 ; previous progress bar indicator position 7692 7693 000033EA ???? alignb 4 7694 7695 bss_start: 7696 7697 ; 29/12/2024 7698 audio_buffer: 7699 000033EC ???????? resd 1 7700 7701 ; 30/12/2024 7702 prev_points: 7703 000033F0 resd 320 ; previous wave points (which are lighting) 7704 7705 ; 18/11/2024 7706 stopped: 7707 000038F0 ?? resb 1 7708 000038F1 ?? tLO: resb 1 7709 ; 21/11/2024 7710 000038F2 ?? tLP: resb 1 7711 ; 30/12/2024 7712 wpoints: 7713 000038F3 ?? resb 1 7714 000038F4 ???????? pbuf_o: resd 1 7715 ; 29/12/2024 7716 000038F8 ???????? pbuf_s: resd 1 7717 7718 ; 07/12/2024 7719 ; 24/11/2024 7720 half_buffer: 7721 000038FC ?? resb 1 ; dma half buffer 1 or 2 (0 or 1) 7722 7723 ; 30/05/2024 7724 000038FD ?? VRA: resb 1 ; Variable Rate Audio Support Status 7725 7726 ; 25/12/2024 7727 ; 29/11/2024 7728 command: 7729 000038FE ?? resb 1 7730 filecount: 7731 000038FF ?? resb 1 7732 7733 ; 30/11/2024 7734 alignb 4 7735 7736 ;;;;;;;;;;;;;; 7737 ; 14/11/2024 7738 ; (Ref: player.asm, Matan Alfasi, 2017) 7739 WAVFILEHEADERbuff: 7740 RIFF_ChunkID: 7741 00003900 ???????? resd 1 ; Must be equal to "RIFF" - big-endian 7742 ; 0x52494646 7743 RIFF_ChunkSize: 7744 00003904 ???????? resd 1 ; Represents total file size, not 7745 ; including the first 2 fields 7746 ; (Total_File_Size - 8), little-endian 7747 RIFF_Format: 7748 00003908 ???????? resd 1 ; Must be equal to "WAVE" - big-endian 7749 ; 0x57415645 7750 7751 ;; WAVE header parameters ("Sub-chunk") 7752 WAVE_SubchunkID: 7753 0000390C ???????? resd 1 ; Must be equal to "fmt " - big-endian 7754 ; 0x666d7420 7755 WAVE_SubchunkSize: 7756 00003910 ???????? resd 1 ; Represents total chunk size 7757 WAVE_AudioFormat: 7758 00003914 ???? resw 1 ; PCM (Raw) - is 1, other - is a form 7759 ; of compression, not supported. 7760 WAVE_NumChannels: 7761 00003916 ???? resw 1 ; Number of channels, Mono-1, Stereo-2 7762 WAVE_SampleRate: 7763 00003918 ???????? resd 1 ; Frequency rate, in Hz (8000, 44100 ...) 7764 WAVE_ByteRate: 7765 0000391C ???????? resd 1 ; SampleRate * NumChannels * BytesPerSample 7766 WAVE_BlockAlign: 7767 00003920 ???? resw 1 ; NumChannels * BytesPerSample 7768 ; Number of bytes for one sample. 7769 WAVE_BitsPerSample: 7770 00003922 ???? resw 1 ; 8 = 8 bits, 16 = 16 bits, etc. 7771 7772 ;; DATA header parameters 7773 DATA_SubchunkID: 7774 00003924 ???????? resd 1 ; Must be equal to "data" - big-endian 7775 ; 0x64617461 7776 DATA_SubchunkSize: 7777 00003928 ???????? resd 1 ; NumSamples * NumChannels * BytesPerSample 7778 ; Number of bytes in the data. 7779 ;;;;;;;;;;;;;; 7780 7781 ; 28/12/2024 7782 ; 15/11/2024 7783 ;cursortype: 7784 0000392C ???? resw 1 7785 0000392E ?? flags: resb 1 7786 ; 06/11/2023 7787 ac97_int_ln_reg: 7788 0000392F ?? resb 1 7789 filehandle: 7790 00003930 ???????? resd 1 7791 7792 ; 25/12/2024 7793 ; 30/11/2024 7794 ;argc: resb 1 ; argument count 7795 00003934 ???????? argv: resd 1 ; current argument (wav file) ptr 7796 00003938 ???????? argvf: resd 1 ; 1st argument (wav file) ptr 7797 0000393C ???????? argvl: resd 1 ; last argument (wav file) ptr 7798 7799 ; 30/05/2024 7800 wav_file_name: 7801 00003940 resb 80 ; wave file, path name (<= 80 bytes) 7802 00003990 ???? resw 1 ; 30/11/2024 7803 7804 ; 08/11/2023 7805 ; 07/11/2023 7806 fbs_shift: 7807 00003992 ?? resb 1 7808 ; 07/12/2024 7809 00003993 ?? SRB: resb 1 7810 7811 ; 12/11/2016 - Erdogan Tan 7812 bus_dev_fn: 7813 00003994 ???????? resd 1 7814 dev_vendor: 7815 00003998 ???????? resd 1 7816 7817 ; 17/02/2017 7818 ; NAMBAR: Native Audio Mixer Base Address Register 7819 ; (ICH, Audio D31:F5, PCI Config Space) Address offset: 10h-13h 7820 ; NABMBAR: Native Audio Bus Mastering Base Address register 7821 ; (ICH, Audio D31:F5, PCI Config Space) Address offset: 14h-17h 7822 0000399C ???? NAMBAR: resw 1 ; BAR for mixer 7823 NABMBAR: 7824 0000399E ???? resw 1 ; BAR for bus master regs 7825 7826 ; 15/11/2024 7827 loadfromwavfile: 7828 000039A0 ???????? resd 1 ; 'loadfromfile' or load+conversion proc address 7829 loadsize: 7830 000039A4 ???????? resd 1 ; (.wav file) read count (bytes) per one time 7831 buffersize: 7832 000039A8 ???????? resd 1 ; 16 bit samples (not bytes) 7833 7834 ; 14/11/2024 7835 TotalTime: 7836 000039AC ???????? resd 1 ; Total (WAV File) Playing Time in seconds 7837 ProgressTime: 7838 000039B0 ???????? resd 1 7839 000039B4 ???????? count: resd 1 ; byte count of one (wav file) read 7840 LoadedDataBytes: 7841 000039B8 ???????? resd 1 ; total read/load count 7842 7843 timerticks: 7844 000039BC ???????? resd 1 ; (to eliminate excessive lookup of events in tuneloop) 7845 ; (in order to get the emulator/qemu to run correctly) 7846 ; 01/12/2024 7847 _bdl_buffer: 7848 000039C0 ???????? resd 1 7849 7850 ; 14/11/2024 7851 bss_end: 7852 7853 ; 29/12/2024 7854 000039C4 alignb 4096 7855 7856 ; 01/12/2024 7857 BDL_BUFFER: 7858 00004000 resb 256 7859 ; 02/12/2024 7860 00004100 resb 4096-256 7861 7862 ;alignb 4096 7863 7864 ; 29/05/2024 7865 WAVBUFFER_1: 7866 00005000 resb 65536 7867 WAVBUFFER_2: 7868 00015000 resb 65536 7869 7870 ; 01/12/2024 7871 ; 26/11/2023 7872 temp_buffer: 7873 00025000 resb 65536 ; resb BUFFERSIZE