NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

;PLAYING SOUND WITH LIST OF TONE
;ORACL4
;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;REFERENCE : 1. https://stackoverflow.com/questions/34500138/play-music-with-assembly-code
;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;SOUND VARIABLE
;BAGIAN INI MERUPAKAN NILAI-NILAI YANG MENENTUKAN FREKUENSI SUARA YANG DIHASILKAN
;VARIABEL FREQUENCY

C1 = 9121
C1S = 8609
D1 = 8126
D1S = 7670
E1 = 7239
F1 = 6833
F1S = 6449
G1 = 6087
G1S = 5746
A1 = 5423
A1S = 5119
B1 = 4831

C2 = 4560
C2S = 4304
D2 = 4063
D2S = 3834
E2 = 3619
E2S = 3509
F2 = 3416
F2S = 3224
G2 = 3043
G2S = 2873
A2 = 2711
A2S = 2559
B2 = 2415

C3 = 2280
C3S = 2152
D3 = 2031
D3S = 1917
E3 = 1809
F3 = 1715
F3S = 1612
G3 = 1521
G3S = 1436
A3 = 1355
A3S = 1292
B3 = 1207

C4 = 1140

;BAGIAN INI MERUPAKAN NILAI DELAY BERAPA LAMA NADA YANG DIBUNYIKAN AKAN DIJALANKAN
;VARIABEL DELAY

P8 = 1500
P7 = P8/2 + P8/4
P6 = P8/2
P5 = P8/4 + P8/8
P4 = P8/4
P3 = P8/8 + P8/16
P2 = P8/8
P1 = P8/16 + P8/32
P0 = P8/16

PAUSE = 300

LOCALS

.MODEL SMALL

.STACK

.DATA
;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
DIV1 DD 14318180
DIV2 DD 786432000

;LIST OF SOUND
;BAGIAN INI MERUPAKAN LIST SUARA/TANGGA NADA YANG AKAN DIBUNYIKAN
LAGU_ABB DW 0, P3

DW E2, P4
DW D2, P3
DW C2, P4
DW E2, P3
DW E2, P4

DW E2, P4
DW D2, P3
DW C2, P4
DW F2, P3
DW F2, P4
DW F2, P5

DW F2, P4
DW E2, P3
DW D2, P4

;
DW E2, P3
DW G2, P4
DW G2, P4
DW F2, P3
DW E2, P4
DW D2, P3
DW C2, P4
DW D2, P5

DW E2, P3
DW D2, P4
DW C2, P5

DW C2, P4
DW C2, P5
DW B2, P4

;

DW B2, P4
DW A2, P4
DW F2, P3
DW E2, P4
DW D2, P5

DW D2, P4
DW B2, P5
DW A2, P4
DW A2, P4
DW G2, P5
DW E2, P3
DW D2, P3
DW C2, P3

;

DW E2, P3
DW E2, P4
DW E2, P6

DW E2, P5
DW D2, P4
DW C2, P5

DW F2, P4
DW F2, P5
DW F2, P6

DW F2, P5
DW E2, P4
DW D2, P5
;
DW E2, P4
DW G2, P5
DW G2, P5
DW F2, P4
DW E2, P5
DW D2, P4
DW C2, P5
DW C2, P7


DW 0,0




;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
.CODE
;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
.486
;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;PROCEDURE UNTUK OUTPUT SUARA
;SOUND PROCEDURE

;DELAY SUARA PADA LAGU
DELAY PROC NEAR MS:WORD
PUSH BP
MOV BP, SP
SUB SP, 4

XOR AX, AX
MOV ES, AX
MOV EDX, ES:[046CH]

FILD WORD PTR MS
FIMUL DWORD PTR DIV1
FIDIV DWORD PTR DIV2
FISTP DWORD PTR [BP-4]

ADD EDX, [BP-4]

@@L1:
MOV EAX, ES:[046CH]
CMP EAX, EDX
JB @@L1

LEAVE

RET 2
DELAY ENDP

;PROCEDUR UNTUK MEM-PLAY LIST NADA YANG SUDAH DISEDIAKAN
PLAY PROC NEAR
MOV DI, SI

@@L1:
CMP WORD PTR [SI], 0
JE @@J1

;MENGATUR FREQUENCY
CLI
MOV AL, 0B6H
OUT 43H, AL
MOV AX, [SI]
OUT 42H, AL
MOV AL, AH
OUT 42H, AL
STI

IN AL, 61H ;SPEAKER ON
OR AL, 03H
OUT 61H, AL

@@J1:
PUSH WORD PTR [SI+2]
CALL DELAY

IN AL, 61H ;SPEAKER OFF
AND AL, 0FCH
OUT 61H, AL

ADD SI, 4
CALL CHECK_KEY ;CEK INPUT DARI KEYBOARD USER
CMP WORD PTR [SI+2], 0
JNE @@L1

RET
PLAY ENDP

;CEK INPUT KEYBOARD DARI USER
CHECK_KEY PROC

MOV AH, 1 ;CEK INPUT KEYBOARD
INT 16H
JZ @@DONE
MOV AH, 0
INT 16H

@@K2: ;KETIKA USER MENEKAN APAPUN SELAIN '`' MAKA EXIT DARI LOOP LAGU
CMP AL, '`'
JNE ENDD

@@DONE:

RET
CHECK_KEY ENDP

;PROGRAM UTAMA
.STARTUP
;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
MOV AX, @DATA
MOV DS, AX

MAIN :

LOOPSONG:

LEA SI, LAGU_ABB
CALL PLAY

JMP LOOPSONG

;SELESAI
ENDD:

MOV AX, 4C00H
INT 21H

.EXIT
END
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.