Program Miscelaneous Sound

PROGRAM MISCELLANEOUS SOUND

Ini adalah program jadul alias jaman dulu yang dijalankan dengan sistem operasi PC-DOS. Jaman dulu, prosesor yang digunakan pun masih 8088. Prosesor yang sangat kuno dari generasi awal Personal Computer (PC) clone. Program ini diposting di blog supaya terdokumentasi dan dapat dimodifikasi. Hari ini, terutama di Linux, terdapat program assembler yang dapat diperoleh secara gratis, misalnya NASM (http://www.nasm.us/).

Untuk dapat dijalankan, mungkin program ini harus dimodifikasi lagi. Bila prosesor 8088 sangat lambat dipakai hari ini, suara-suara yang dihasilkan jadi tidak ada. Itu adalah salah satu modifikasi yang harus dilakukan.

File ini juga ternyata meng-include tiga file lain yaitu TMAC2, BIOS.INC, DOS.INC. File TMAC2 merupakan file yang berisi macro seperti @push, @ModBlok ax dan seterusnya. Pada posting berikutnya, file-file include itu akan diuraikan.

Program selengkapnya adalah sebagai berikut.

;1-4-93
;—————————-;
; MISCELANEOUS SOUND Ver 1.0 ;
; (C) 10 September 1992 ;
; by Prana D.I. ;
; IKIP Bandung 40154 ;
;—————————-;
DOSSEG
include TMAC2
include BIOS.INC
include DOS.INC
;.model small
STACK_SEG segment stack
;STACK label byte
db 256 dup (?)
STACK_SEG ends

DATA_SEG segment
TEMPORARY dw 0
BEAT db 10,9,8,7,6,5,4,3,2
FREQUENCY dw 2280,2031,1809,1709
dw 1521,1355,1207,1139
MELODY db 1,2,3,4,5,6,7,8,0FFh

SCREEN dw 0B800h
STATUS_PORT dw 3DAh
ROWS dw 24
MODE db 0
PAG db 0
CGAMONO db 10b
NEWVID db 0
PHANTOM db 112
SAVE_ATTR db 0
LPLDN dw 0

;-form: ATTR,CENTR,PLDN,FLICKR,REST
FLAG db ?
FLKR_OFF label word
db ‘ Flicker off ‘,0
FLKR_ON label word
db ‘ Flicker on ‘,0
;-form si/di, si/di, dl, cl, al, char
;-strc ofs_dt,ofs_scr,#clmn,#lins,colr,char

FORM_2 label byte
dw 0, 0 ;offset TEMP2, 0
db 1,2,37,4,’G’
db 0 ;flag
dw 0, 0, 0, 0, 0
db ‘ ‘,0
db ‘ M I S C E L A N E O U S S O U N D ‘,0
db ‘ (C) 10 SEPTEMBER 1992 BY PRANA D.I. ‘,0
db ‘ ‘,0
FORM_3 label byte
dw 0, 0 ;offset TEMP3, 0
db 1,6,37,15,’G’
db 0
dw 13, TABLE, EXKEYS, LEXKEYS, EXTABLE
db ‘ BOOP (c) Wyatt: 238 ‘,0
db ‘ SLIDING TONES (c) Jourdain: 83 ‘,0
db ‘ FIRE ! (c) Pappas: 59 ‘,0
db ‘ WARBLE (c) Wyatt: 238 ‘,0
db ‘ SOUND EFFECT (c) Jourdain: 85 ‘,0
db ‘ SIMULTAN SOUND (c) Jourdain: 87 ‘,0
db ‘ STRNG OF TONES (c) Jourdain: 77 ‘,0
db ‘ HACKERS` BEEP (c) Hackers Team ‘,0
db ‘ ERROR BEEP (c) Microsoft Corp. ‘,0
db ‘ SMLTN 2 OTR OP (c) Jourdain: 72 ‘,0
db ‘ Test all ‘,0
db ‘ About… ‘,0
FLKR_STAT label word
db ‘ Flicker on ‘,0
db ‘ Exit ‘,0
db ‘ ‘,0

TABLE label word
dw BOOP,SLI_T,FIRE,WARBLE,SOU_E
dw SIM_S,STR_T,HCK_B,ERR_B,SIM_T
dw TES_A,ABOUT,FLKR_NF,WKP_EXIT

LEXKEYS dw LEXKEYSS
EXKEYS db 72,80
LEXKEYSS equ $-EXKEYS
EXTABLE label word
dw UP_MENU,DN_MENU
; dw LF_MENU,RT_MENU
dw WKP_NONEK

COPYRIGHT label word
dw 0, 0 ;offset TEMP1, 0
db 0,0,34,8,17h
db 01000b
dw 0, 0, 0, 0, 0
db ‘ ‘,0
db ‘ Miscelaneous Sound Ver 1.0 ‘,0
db ‘ ‘,0
db ‘ Copyright (C) 1992 by ‘,0
db ‘ Prana Dwija Iswara ‘,0
db ‘ ‘,0
db ‘ Hackin` all the time ! ‘,0
db ‘ ‘,0

LR_TABLE label word
dw FORM_2,FORM_3,COPYRIGHT,0

CALL_PTR dw ?
;SCR_PTR dw ?
SBUFFER dw ? ;TEMP_SEG
LBUFFER dw ?

;ZSEG segment
;–make it automatic ptr
;TEMP1 db 33*2*8 dup (?)
;TEMP2 db 37*2*4 dup (?)
;TEMP3 db 37*2*15 dup (?)

;STEMP_PTR dw ?
TEMP_PTR dw 0
dw 10 dup (?)
;TEMP label word
;ZSEG ends
DATA_DS dw ?
DATA_A dw ? ;AUX_A

DATA_SEG ends

ZSEG segment
TEMP label word
ZSEG ends

CODE_SEG segment ‘code’
assume cs:CODE_SEG,ds:DATA_SEG,ss:STACK_SEG
MULAI:
@push
mov ax, ZSEG
mov [DATA_A], ax
mov ax,DATA_SEG ;Initialize data segment
mov [DATA_DS], ax
mov ds,ax
; cli ;Turn off interrupts
; mov ss,ax ;Make SS and
; mov sp,offset STACK ;SP relative to DGROUP
; sti
; Adjust memory allocation
mov bx,sp ;Convert stack pointer to paragraphs
mov cl,4 ; to get stack siz
shr bx,cl
add ax,bx ;Add SS to get end of program
mov bx,es ;Get start of program
sub ax,bx ;Subtract start from end
@ModBlok ax ;Release memory after program
; Allocate dynamic memory for file buffer
@GetBlok 0FFFh ;Try to allocate 64K
mov SBUFFER,ax ;Save buffer segment
mov LBUFFER,bx ;Save actual length allocated

; mov bx, DATA_SEG
; mov ds, bx
@POP
call INIT_VID
cmp [CGAMONO], 1 ;mono?
jnz M_TRS
mov si, offset LR_TABLE ;yes
M_LOOP:
mov bx, [si] inc si
inc si
mov byte ptr [bx+8], 112 ;phantom
cmp word ptr [si], 0
jnz M_LOOP
mov [PHANTOM], 0F0h ;blink rev
M_TRS:
; push [SCREEN] ; test [CGAMONO], 10b
; jnz M_NOCHGSTAT
; mov si, offset FLKR_OFF
; mov di, ds
; mov [SCREEN], di
; mov di, offset FLKR_STAT
;; call TULIS_KALIMAT
; @push
;M_J1:
; mov al, [si] ; or al, al
; jz M_EXIT
;;-put char
; push es
; mov es, [SCREEN] ; cld
; stosb
;; inc di
; pop es
;
; inc si
; jmp short M_J1
;M_EXIT:
; @pop
; pop [SCREEN] M_NOCHGSTAT:
call OPEN_MENU_1
mov ax, 4C00h
int 21h

ABOUT proc
@PUSH
lea bx, COPYRIGHT
; or [FLAG], 1000b
; and [FLAG], 1010b
call CENTER_SR_MSG_PLDN
@WAIT_KEYPRESSED
lea bx, COPYRIGHT
; or [FLAG], 0001b
; and [FLAG], 1011b
call CENTER_SR_MSG_PLDN
@POP
ret
ABOUT endp

FLKR_NF proc
push si
test [CGAMONO], 10b
jz FNF_ONING
and [CGAMONO], 11111101b
mov si, offset FLKR_OFF
jmp short FNF_GOLGSG
FNF_ONING:
or [CGAMONO], 00000010b
mov si, offset FLKR_ON
FNF_GOLGSG:
@PUSH
call TULIS_KALIMAT
@POP
pop si
ret
FLKR_NF endp

TES_A proc
call BOOP
call SLI_T
call FIRE
call WARBLE
call SOU_E
call SIM_S
call STR_T
call HCK_B
call ERR_B
call SIM_T
call ABOUT
ret
TES_A endp

OPEN_MENU_1 proc
push bx
lea bx, [FORM_2] ; and [FLAG], 0010b
call CENTER_SR_MSG_PLDN
lea bx, [FORM_3] ; or [FLAG], 100b
; and [FLAG], 0110b
; mov [LPLDN], 13
call CENTER_SR_MSG_PLDN
lea bx, [FORM_3] ; or [FLAG], 1b
; and [FLAG], 0111b
; or byte ptr [bx+9], 1
call CENTER_SR_MSG_PLDN
lea bx, [FORM_2] ; or [FLAG], 1b ;flag REST=1
; and [FLAG], 0011b
; or byte ptr [bx+9], 1
call CENTER_SR_MSG_PLDN
pop bx
ret
OPEN_MENU_1 endp

PHANTOM_MENU proc
push ax
mov [SAVE_ATTR], al
mov al, [PHANTOM] or [FLAG], 10000b
call PUT_CHAR_N_COLUMN
and [FLAG], 01111b
call WAIT_KEYPRESSED_PLDN
pop ax
ret
PHANTOM_MENU endp

WAIT_KEYPRESSED_PLDN proc
@PUSH
xor si, si
WKP_NEXTKEY:
mov ah, 7
int 21h
WKP_NEXTKEY2:
or al, al ;ext?
je WKP_EXTENDED
cmp al, 0Dh ;enter?
jne WKP_NEXTKEY ;No? Ignore unknown cmd
WKP_ENTERK:
cmp si, [bx+10] ;LPLDN
jz WKP_EXIT
@push
add si, si
add si, [bx+12] ;TABLE
mov ax, [si] mov [CALL_PTR], ax
@pop
call [CALL_PTR] jmp short WKP_NEXTKEY
WKP_EXIT:
cmp NEWVID, 1 ;Rest vid?
jne WKP_THATSALL ;No?
mov al, [MODE] ;Rest vidMODE,PAG,cur
xor ah, ah
int 10h
mov al, [PAG] mov ah, 5
int 10h
WKP_THATSALL:
@pop
WKP_NONEK:
ret
WKP_EXTENDED:
mov ah, 7
int 21h
@PUSH
push ds ;Load DS into ES
pop es
;—mov di, offset EXKEYS
mov di, [bx+14] ;EXKEYS Load addr &
;—mov cx, LEXKEYS+1 ;length of k list
mov si, [bx+16] mov cx, [si] inc cx
repne scasb ;Find pos
pop es
;—sub di, (offset EXKEYS)+1 ;Point to k
mov si, [bx+14] ;EXKEYS
inc si
sub di, si
shl di, 1 ;Adj ptr for word addrs
add di, [bx+18] ;EXTABLE
mov si, [di] mov [CALL_PTR], si
@pop
call [CALL_PTR] jmp WKP_NEXTKEY
WAIT_KEYPRESSED_PLDN endp

;ret si,scr
DN_MENU proc
push ax
cmp si, 13
jz DM_DN
mov al, [SAVE_ATTR] or [FLAG], 10000b
call PUT_CHAR_N_COLUMN
inc si
add di, 80*2
mov al, [PHANTOM] call PUT_CHAR_N_COLUMN
and [FLAG], 01111b
DM_DN:
pop ax
ret
DN_MENU endp

;ret si,scr
UP_MENU proc
push ax
or si, si
jz UM_UP
mov al, [SAVE_ATTR] or [FLAG], 10000b
call PUT_CHAR_N_COLUMN
dec si
sub di, 80*2
mov al, [PHANTOM] call PUT_CHAR_N_COLUMN
and [FLAG], 01111b
UM_UP:
pop ax
ret
UP_MENU endp

;ret STATUS_PORT,ROWS,CGA,
; PAG,MONO,SCREEN,NEWVID
INIT_VID proc
@PUSH
mov bx, 40h
mov es, bx
mov bx, es:63h
add bx, 6
mov [STATUS_PORT], bx
;Prps Determines if an EGA is active
;Inpt None
;Outp 0 if no,lines per screen if yes
;ISEGA proc
@push
mov ah, 12h ;Call EGA stat func
mov bl, 10h
sub cx, cx ;Clear stat bits
int 10h
sub ax, ax ;Seg 0 & assume no EGA
jcxz IV_NOEGA ;If stat stil 0,no EGA
mov es, ax ;ES=0
test byte ptr es:[487h], 1000b
jnz IV_NOEGA ;If set, not active
mov ax, 1130h ;Get EGA info
int 10h
mov al, dl ;Ret lin per scr
cbw
IV_NOEGA:
@pop
; ret
;ISEGA endp
or ax, ax ;If 0 mustbe CGA/MA
je IV_MODECHK ;Leave default
mov ROWS, ax ;Load ROWS
and [CGAMONO], 11111101b ;Not CGA
IV_MODECHK: ;mode chk
mov ah, 0Fh
int 10h
mov [MODE], al
mov [PAG], bh
mov dl, al ;Work on copy
cmp dl, 7 ;Is it MONO 7?
je IV_LOADMONO ;Yes? Set MONO
cmp dl, 15 ;Is it MONO 15?
jne IV_GRAPHCHK ;No? Chk graph
IV_LOADMONO:
mov [SCREEN], 0B000h ;Load MONO addr
and [CGAMONO], 11111101b ;Not CGA
or [CGAMONO], 00000001b
cmp al, 15 ;Is it MONO 15?
jne IV_RET_VID ;No? Done
mov dl, 7 ;Yes? Set stndrd MONO
jmp short IV_CHMODE
IV_GRAPHCHK:
cmp dl, 7 ;>=7?
jg IV_COLOR ;8to14:colr (7 and 15 done)
cmp dl, 4 ;>=4?
jg IV_BNW ;5&6 are probably BNW
je IV_COLOR ;4 is color
test dl, 1 ;Even?
jz IV_BNW ;0&2 are BNW
IV_COLOR: ;1&3 are col
cmp dl, 3 ;3?
je IV_RET_VID ;Yes? Done
mov dl, 3 ;Chmod to 3
jmp short IV_CHMODE
IV_BNW:
cmp dl, 2 ;2?
je IV_RET_VID ;Yes? Done
mov dl, 2 ;Make it 2
IV_CHMODE:
mov al, dl ;Set vid mod
xor ah, ah
int 10h
mov ax, 500h ;Set vid pag
int 10h
mov [NEWVID], 1 ;Set flag
IV_RET_VID:
@POP
ret
INIT_VID endp

;————;

;test REST,CENTER,PLDN
CENTER_SR_MSG_PLDN proc
@PUSH
mov al, [bx+9] ;FLAG
mov [FLAG], al
test [FLAG], 1000b ;centr?
jz CSMP_BYPASS
;—centering col
push ax
mov ah, [bx+6] ;#row
shr ah, 1 ;row/2
mov al, 40
sub al, ah
mov [bx+4], al ;pos row
;—centering lines
mov ah, [bx+7] ;#lines
shr ah, 1 ;lines/2
mov al, 12
sub al, ah
mov [bx+5], al ;pos lines
pop ax
CSMP_BYPASS:
;—internal proc
; cmp word ptr [bx+2], 0
; jnz CSMP_EX
push ax
xor ah, ah
mov al, [bx+5] ;2 Pos row
shl ax, 1
shl ax, 1
shl ax, 1
shl ax, 1
mov [bx+2], ax
shl ax, 1
shl ax, 1
add [bx+2], ax
mov al, [bx+4] ;3 Pos col
xor ah, ah
add [bx+2], ax
shl word ptr [bx+2], 1
pop ax
;—end of ip
CSMP_EX:
test [FLAG], 1b ;0=save,1=rest
jnz CSMP_RESTO ;jz=save,jnz=rest

push es
; push ax
mov di, [TEMP_PTR] mov [bx], di
;; mov di, [bx] ;DATA_SEG
; mov ax, SBUFFER
; mov es, ax
; pop ax

mov si, [bx+2] ;vid
mov dl, [bx+6] ;4 #clmn/#tms sav rest
xor dh, dh
mov cl, [bx+7] ;5 #lines
xor ch, ch
CSMP_LEW:
call SR_N_LINES

pop es

mov di, [bx+2] ;sav frm scr to DATA_SEG
mov al, [bx+8] ;colr
or [FLAG], 10000b
call PUT_CHAR_N_LINES
and [FLAG], 11101111b
mov si, bx ;si as str ptr
add si, 20
call PUT_KAL_N_LINES
cmp word ptr [bx+10], 0 ;pldn?
jz CSMP_QUIT ;no so quit
call PHANTOM_MENU
jmp short CSMP_QUIT
CSMP_RESTO:

dec [TEMP_PTR] dec [TEMP_PTR] mov si, [TEMP_PTR] mov bx, si
; mov si, [bx] ;vid
mov di, [bx+2] ;DATA_SEG
mov dl, [bx+6] ;4 #clmn/#tms sav rest
xor dh, dh
mov cl, [bx+7] ;5#lines
xor ch, ch
push ds
push ax
mov ax, [SBUFFER] mov ds, ax
pop ax
call SR_N_LINES
pop ds

CSMP_QUIT:
test byte ptr [bx+9], 1 ;rest?
jz CSMP_TOREST
and byte ptr [bx+9], 11111110b
jmp short CSMP_LEW2
CSMP_TOREST:
or byte ptr [bx+9], 00000001b
CSMP_LEW2:
@POP
ret
CENTER_SR_MSG_PLDN endp

;test FLKR,MULTI_MONITOR
PUT_CHAR proc
push es
mov es, [SCREEN] test [FLAG], 10000b ;attr?
jz PC_TRS
inc di ;yes
PC_TRS:
cld
; test byte ptr [CGAMONO], 10b ;0NOFLKR,1FLKR
; jz PC_NO_FLKR ;jzNOFLKR,jnzFLKR
;;@FLICKER_ROUTINE macro
;;local W_1ST,W_2ND,OK
;; @TEST_DSES
; @PUSH
; mov dx, DATA_SEG
; mov ds, dx
; mov dx, [STATUS_PORT] ;3DAh
;W_1ST: ;wait
; in al, dx
; test al, 1
; jnz W_1ST
;W_2ND:
; in al, dx
; test al, 1
; jz W_2ND
; @POP
;; endm
PC_NO_FLKR:
stosb
test [FLAG], 10000b ;attr?
jnz PC_OV
inc di ;yes
PC_OV:
pop es
ret
PUT_CHAR endp

PUT_CHAR_N_COLUMN proc
@PUSH
mov cx, dx
PCNC_LP: ;loop 2
call PUT_CHAR
loop PCNC_LP
@POP
ret
PUT_CHAR_N_COLUMN endp

PUT_CHAR_N_LINES proc
@PUSH
PCNL_LP:
call PUT_CHAR_N_COLUMN
add di, 80*2
loop PCNL_LP
@POP
ret
PUT_CHAR_N_LINES endp

PUT_KAL_N_LINES proc ;put klmt n lns
@PUSH
PKNL_PUT_MENU:
call TULIS_KALIMAT
add di, 80*2
inc si
loop PKNL_PUT_MENU
@POP
ret
PUT_KAL_N_LINES endp

SR_N_LINES proc ;sav rest n lnes
@PUSH
test [FLAG], 1b ; 0=save,1=rest
jnz SRNL_RESTO ;jz=SAVE1,jnz=RESTO2
SRNL_SAVE:
push si
call SR_N_TIMES
pop si
add si, 80*2
loop SRNL_SAVE
; inc [TEMP_PTR] ; inc [TEMP_PTR] ; mov [TEMP_PTR], di
push bx
mov bx, offset TEMP_PTR
inc bx
inc bx
mov [bx], di
pop bx
jmp short SRNL_EX ;loop exit
SRNL_RESTO:
push di
call SR_N_TIMES
pop di
add di, 80*2
loop SRNL_RESTO
SRNL_EX:
@POP
ret
SR_N_LINES endp

;test REST,FLKR
SR_N_TIMES proc
@PUSH
mov ax, [SCREEN] mov bx, ZSEG
mov cx, dx
test [FLAG], 1b ;0=save,1=rest
jz SRNT_SAVE ;jz=SAVE,jnz=REST
mov es, ax
jmp short SRNT_TST_FLKR
SRNT_SAVE:
mov es, bx
mov ds, ax
SRNT_TST_FLKR:
; push ds
; mov ds, bx
; test byte ptr [CGAMONO], 10b
; pop ds
; jz SRNT_NOT_FLKR
;SRNT_TERUS:
;; @FLICKER_ROUTINE macro
;;local W_1ST,W_2ND,OK
;; @TEST_DSES
; @PUSH
; mov dx, DATA_SEG
; mov ds, dx
; mov dx, [STATUS_PORT] ;3DAh
;W_1ST2: ;wait
; in al, dx
; test al, 1
; jnz W_1ST2
;W_2ND2:
; in al, dx
; test al, 1
; jz W_2ND2
; @POP
;; endm
SRNT_NOT_FLKR:
cld
movsw
loop SRNT_TST_FLKR
@POP
ret
SR_N_TIMES endp

TULIS_KALIMAT proc
@PUSH
TK_J1: ;jump 1
mov al, [si] or al, al
jz TK_EXIT
call PUT_CHAR
inc si
jmp short TK_J1
TK_EXIT:
@POP
ret
TULIS_KALIMAT endp

;———-;

BOOP proc
@PUSH
mov bp, sp
in al, 61h
push ax
mov bx, 6818
call WARBCOM
mov cx, 4B4Bh
B_DELAY:
loop B_DELAY
pop ax
out 61h, al
@POP
ret
BOOP endp

WARBCOM proc
@PUSH
mov al, 10110110b
out 43h, al
mov ax, bx
out 42h, al
mov al, ah
out 42h, al
in al, 61h
or al, 11b
out 61h, al
@POP
ret
WARBCOM endp

SLI_T proc
@PUSH
in al, 61h
or al, 1
out 61h, al
;–set freq and duration
mov bx, 9000
mov dx, 90
;–on spkr
ST_REPEAT:
or al, 10b
out 61h, al
mov cx, bx
ST_CYCLE1:
loop ST_CYCLE1
;–off spkr
and al, 11111101b
out 61h, al
mov cx, bx
ST_CYCLE2:
loop ST_CYCLE2
;–go to next cycle
dec bx
dec bx
dec dx
jnz ST_REPEAT
@POP
ret
SLI_T endp

FIRE proc
@PUSH
xor dx, dx
in al, 61h
and al, 0FCh
F_MORE:
mov TEMPORARY, 0
inc dx
cmp dx, 9
je F_FINISH
F_GO:
xor al, 2
mov cx, TEMPORARY
cmp cx, 258
je F_MORE
inc TEMPORARY
out 61h, al
F_DELAY:
loop F_DELAY
jmp F_GO
F_FINISH:
@POP
ret
FIRE endp

WARBLE proc
@PUSH
mov bp, sp
in al, 61h
push ax
mov dx, 0Bh
W_MAIN:
mov bx, 477
call WARBCOM
mov cx, 2600h
W_DELAY1:
loop W_DELAY1
mov bx, 36
call WARBCOM
mov cx, 1300h
W_DELAY2:
loop W_DELAY2
dec dx
jnz W_MAIN
pop ax
out 61h, al
@POP
ret
WARBLE endp

SOU_E proc
@PUSH
cli
mov dx, 300
in al, 61h
and al, 11111110b
SE_NEXT_CYCLE:
or al, 10b
out 61h, al
mov cx, 50
SE_FIRST_HALF:
loop SE_FIRST_HALF
and al, 11111101b
out 61h, al
mov cx, 3200
SE_SECOND_HALF:
loop SE_SECOND_HALF
dec dx
jnz SE_NEXT_CYCLE
sti
@POP
ret
SOU_E endp

SIM_S proc
@PUSH
in al, 61h
or al, 3
out 61h, al
mov al, 10110110b
out 43h, al
mov ax, 600h
out 42h, al
mov al, ah
out 42h, al
cli
mov dx, 150
in al, 61h
and al, 11111111b
SS_NEXT_CYCLE:
or al, 10b
out 61h, al
mov cx, 150
SS_FIRST_HALF:
loop SS_FIRST_HALF
and al, 11111101B
out 61h, al
mov cx, 150
SS_SECOND_HALF:
loop SS_SECOND_HALF
dec dx
jnz SS_NEXT_CYCLE
sti
in al, 61h
and al, 11111100b
out 61h, al
@POP
ret
SIM_S endp

STR_T proc
@PUSH
in al, 61h
or al, 11b
out 61h, al
xor si, si
mov al, 0B6h
out 43h, al
ST_NEXT_NOTE:
lea bx, MELODY
mov al, [bx][si] cmp al, 0FFh
jz ST_NO_MORE
cbw
;-get the freq
mov bx, offset FREQUENCY
dec ax
shl ax, 1
mov di, ax
mov dx, [bx][di] ;-strt playing
mov al, dl
out 42h, al
mov al, dh
out 42h, al
;-delay
mov ah, 0
int 1Ah
mov bx, offset BEAT
mov cl, [bx][si] xor ch, ch
mov bx, dx
add bx, cx
ST_STILL_SOUND:
int 1Ah
cmp dx, bx
jne ST_STILL_SOUND
inc si
jmp ST_NEXT_NOTE
ST_NO_MORE:
in al, 61h
and al, 0FCh
out 61h, al
@POP
ret
STR_T endp

HCK_B proc
@PUSH
mov dx, 61h
in al, dx
mov cx, 0Fh
HB_LOCLOOP_1:
push cx
and al, 0FCh
or al, 2
out dx, al
mov cx, 40h
HB_LOCLOOP_2:
loop HB_LOCLOOP_2
and al, 0FCh
out dx, al
mov cx, 40h
HB_LOCLOOP_3:
loop HB_LOCLOOP_3
pop cx
loop HB_LOCLOOP_1
@POP
ret
HCK_B endp

ERR_B proc
@PUSH
in al, 61h
or al, 3
out 61h, al
mov al, 10110110b
out 43h, al

mov ax, 1600
out 42h, al
mov al, ah
out 42h, al

mov ah, 0
int 1Ah
add dx, 91/79
mov bx, dx
EB_REPT1:
int 1Ah
cmp dx, bx
jne EB_REPT1

mov ax, 1800
out 42h, al
mov al, ah
out 42h, al

mov ah, 0
int 1Ah
add dx, 91/78
mov bx, dx
EB_REPT2:
int 1Ah
cmp dx, bx
jne EB_REPT2

in al, 61h
and al, 11111100b
out 61h, al
@POP
ret
ERR_B endp

SIM_T proc
@PUSH
in al, 61h
or al, 3
out 61h, al
mov al, 10110110b
out 43h, al
mov ax, 2705
out 42h, al
mov al, ah
out 42h, al
@WAIT_KEYPRESSED
in al, 61h
and al, 11111100b
out 61h, al
@POP
ret
SIM_T endp

CODE_SEG ends

end MULAI

Mari membuat program dengan assembly!

Komputer MENDOWNLOAD FILM DARI YOUTUBE TANPA PROGRAM

MEN-DOWNLOAD FILM DARI YOUTUBE TANPA PROGRAM
Cara mendownload film dari youtube yang mudah adalah membuka cache yang digunakan sebagai temporary file. Ternyata tempat temporary file-nya di C:Users<penguna>AppDataLocalGoogleChromeUser DataDefaultCache. Ketika film itu diputar, file itu terus membesar. Dengan mengklik sort size (file size) akan terlihatlah file film yang sedang diputar. Selesai film itu diputar, tinggal copy paste saja file film itu di lokasi yang diinginkan. Sistem operasi yang digunakan adalah Windows Vista.
Sebenarnya cara ini agak ribet karena mesti me-rename file. Tetapi memang demikianlah semestinya.
Cara ini digunakan karena youtube memblok untuk men-download sejumlah film.