Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Help

Name: Anonymous 2009-04-20 8:35

What does this do in a .bat file?
Is it some sort of assembly?

@debug <%0 >nul
e100 48 e6 61 be 3f 01 31 db 8a 1c 80 fb ff 74 f4 81
e110 c3 d0 00 b0 b6 e6 43 31 d2 66 b8 dd 34 12 00 66
e120 f7 f3 e6 42 88 e0 e6 42 46 8a 0c 46 ba da 03 ec
e130 a8 08 74 fb ec a8 08 75 fb fe c9 74 c9 eb f0 00
e140 0c 19 0c 45 0c 19 0c 8d 24 8d 24 67 48 00 0c 19
e150 0c 45 0c 19 0c 67 24 67 24 45 24 36 0c 19 18 00
e160 0c 19 0c 45 0c 19 0c 45 30 67 18 36 24 19 0c 00
e170 30 00 18 67 18 45 18 45 34 00 0c 19 0c 45 0c 19
e180 0c 8d 30 8d 18 67 48 00 0c 19 0c 45 0c 19 0c cf
e190 30 45 18 45 24 36 0c 19 18 00 0c 19 0c 45 0c 19
e1a0 0c 45 30 67 18 36 24 19 0c 00 30 00 18 67 30 45
e1b0 6b ff
g

Name: Anonymous 2009-04-20 13:41

It seems to be a small audio demo, here's a dumb disassembly:


seg000:0100
seg000:0100                 public start
seg000:0100 start           proc near
seg000:0100                 dec     ax
seg000:0101                 out     61h, al         ; possibly speaker enable, may have side-effects
seg000:0103
seg000:0103 loop1:                                  ; CODE XREF: start+Dj
seg000:0103                 mov     si, offset song
seg000:0106
seg000:0106 next_command:                           ; CODE XREF: start+3Bj
seg000:0106                 xor     bx, bx          ; null bx
seg000:0108                 mov     bl, [si]        ; bl = *song
seg000:010A                 cmp     bl, 0FFh        ; if end, start from the beginning
seg000:010D                 jz      short loop1
seg000:010F                 add     bx, 0D0h
seg000:0113                 mov     al, 10110110b   ; timer: counter 2 select, r/w counter bits 0-7 first then 8-15, mode 3 select - square wave generator(counts down twice by two at a time; latch status and check
seg000:0113                                         ;                   value of OUT pin to determine which half-cycle is active
seg000:0113                                         ;                 divisor factor 3 not allowed!), binary counter 16bits
seg000:0115                 out     43h, al         ; program the speaker
seg000:0117                 xor     dx, dx          ; null dx(prepare for division)
seg000:0119                 mov     eax, 1234DDh
seg000:011F                 div     ebx             ; ax = 0x1234DD/*song, following instructions output these values to speaker, first lower 8bits then higher 8 bits
seg000:0122                 out     42h, al         ; Timer 8253-5 (AT: 8254.2).
seg000:0124                 mov     al, ah
seg000:0126                 out     42h, al         ; Timer 8253-5 (AT: 8254.2).
seg000:0128                 inc     si              ; song++
seg000:0129                 mov     cl, [si]        ; get value
seg000:012B                 inc     si              ; song++
seg000:012C                 mov     dx, 3DAh        ; wait 2 retraces
seg000:012F
seg000:012F wait_for_retrace:                       ; CODE XREF: start+32j
seg000:012F                                         ; start+3Dj
seg000:012F                 in      al, dx          ; 03DA  R-  CGA status register
seg000:012F                                         ;         color EGA/VGA: input status 1 register
seg000:0130                 test    al, 1000b       ; in vertical retrace?
seg000:0132                 jz      short wait_for_retrace
seg000:0134
seg000:0134 wait_for_retrace2:                      ; CODE XREF: start+37j
seg000:0134                 in      al, dx
seg000:0135                 test    al, 1000b
seg000:0137                 jnz     short wait_for_retrace2
seg000:0139                 dec     cl              ; decrement duration and check if it's null yet, if so, process next command
seg000:013B                 jz      short next_command
seg000:013D                 jmp     short wait_for_retrace
seg000:013D start           endp
seg000:013D
seg000:013D ; ---------------------------------------------------------------------------
seg000:013F song            dw  0C00h, 0C19h, 0C45h, 0C19h, 248Dh, 248Dh, 4867h, 0C00h; 0
seg000:013F                                         ; DATA XREF: start:loop1o
seg000:013F                 dw  0C19h, 0C45h, 0C19h, 2467h, 2467h, 2445h, 0C36h, 1819h; 8 ; each word in the song buffer has this format:
seg000:013F                 dw  0C00h, 0C19h, 0C45h, 0C19h, 3045h, 1867h, 2436h, 0C19h; 16 ; byte audio_sample; // 0x1234DD/audio_sample is output to speaker
seg000:013F                 dw  3000h, 1800h, 1867h, 1845h, 3445h, 0C00h, 0C19h, 0C45h; 24 ; byte duration; // it will wait 2*retraces ( a retrace usually happens 60 times per second, 60Hz)
seg000:013F                 dw  0C19h, 308Dh, 188Dh, 4867h, 0C00h, 0C19h, 0C45h, 0C19h; 32 ; audio sample 0xFF marks the end
seg000:013F                 dw  30CFh, 1845h, 2445h, 0C36h, 1819h, 0C00h, 0C19h, 0C45h; 40
seg000:013F                 dw  0C19h, 3045h, 1867h, 2436h, 0C19h, 3000h, 1800h, 3067h; 48
seg000:013F                 dw  6B45h               ; 56
seg000:01B1 end_song        db 0FFh                 ; 0FF = end
seg000:01B1 seg000          ends
seg000:01B1
seg000:01B1
seg000:01B1                 end start

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List