;organ.asm ;This is an assembly language program written by Myron Berg ;for CS 210. It demonstrates the polling of the keyboard for more ;than one key at a time. It also demonstrates the use of the pc speaker ;to simulate harmony. ;Each key that is pressed is added to the list of currently played keys. ;When a scan code contains a 1 in the 7th bit, then the key is being released ;so the key is removed from the currently played keys list. ;To achieve the harmony sound, since the pc speaker can play only one ;pitch at a time, the pitches are rapidly cycled. Too rapid cycling produces ;static sound. The vibrato rate can be increased by pressing the grey + ;key and decrease by pressing the grey - key on the keypad. ;To prevent this vibrato from changing too much from machine to machine, ;I created a procedure to count how many cycles are performed in 1 machine ;cycle (1/18th of a second). This number is stored in the variable ;counter and is used to determine how many cycles must be performed before a ;change in pitch is allowed. When more keys are pressed at the same time, ;a faster vibrato rate is needed to make the sound correct, ;so the number of cycles is decreased. ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ displayString macro string ;write string on screen push dx push ax lea dx, string mov ah, 9 int 21h pop ax pop dx endm ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ clearScreen macro scrollup 0 endm ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ newLine macro number ;line feed and carriage return local Repeat pusha ifnb mov cx, number endif Repeat: mov al, 0Dh mov ah, 0Eh int 10h mov al, 0Ah mov ah, 0Eh int 10h ifnb loop Repeat endif popa endm ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ scrollup macro number ;scroll screen up pusha mov ah, 6 ;up mov al, number ;lines mov ch, 0 ;starting at 0,0 mov cl, 0 mov dh, 24 ;ending at 24, 79 mov dl, 79 mov bh, 15 ;black background, white fore int 10h popa endm ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ .model small .stack 100h .386 .data Message1 db 'This is an organ program. It uses the ' db 'pc speaker to simulate harmony. ', 10, 13 db 'All the keys above, below, and to the left' db ' of the enter key produce a sound', 10, 13 db '(except the esc key and the bottom row).' db 10,13 db 'You may play more than one key at a time,' db ' for harmony. ', 10, 13, 10, 13 db 'The grey - and + keys on the keypad ' db 'will decrease or increase the vibrato rate.' db 10,13 db 'Written by:',10,13 db 'Myron Berg ', 10, 13 db 'Dickinson State University', 10, 13 db 'May, 1999', 10, 13, 10, 13, 10, 13 db 'Notes playing: ', 10, 13, 10, 13, 10, 13 db 'Vibrato Rate: $' Message2 db 'Press the escape key to quit.$' currentMode db ? ;current mode of port keys dw 120 dup (?) ;storage for keys played notes dd 120 dup (0) ;storage for names of keys keysize dw 0 ;number of keys pressed at once keyplayed db 1 ;current key being played pressed db 0 ;a key is being pressed timer dw 0 ;used to calculate computer speed counter dd ? ;used to calculate computer speed storeCounter dd ? ;stores counter temporarily singleKey dw 0 ;pitch when only 1 key pressed FirstTime db 0 ;first time through single key loop displayed db 0 ;currently being displayed vibratoRate db 35h ;current rate of vibrato .CODE .startup clearscreen newline 6 displaystring Message1 newline 2 ;1 blank line scrollup 1 displaystring Message2 call getSpeed ;Calculates the speed of the current ;computer for the proper delays ;needed by the program call setVibratoRate call displayVibrato ;display vibrato rate on screen mov bh, 3 ;set keyboard repeat delay long mov bl, 1Fh ;set keyboard repeat rate slow mov ah, 3 mov al, 5 int 16h mov ecx, 0 ;ecx is counter for loop cycle: inc ecx in al,60h ;get input from keyboard port cmp al, 0 je cycle call clearKB ;clear keyboard buffer call actionKeys ;escape key or other function key? call upOrDown ;is key pressed or released? call displayNotes ;display notes on screen cmp keysize, 0 ;if no key pressed, cycle je cycle movzx ebx, keysize ;speed up vibrato when a single cmp keysize, 1 ;key is pressed jne x1 mov ebx, 2 x1: ;multiply counter by keysize to imul ebx, ecx ;speed up vibrato rate if many cmp ebx, counter ;keys are pressed. It sounds better. jbe cycle call musicKeys ;play sounds mov ecx, 0 ;start loop over again for proper jmp cycle ;delay ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; upOrDown proc locals ;Checks if a key is being pressed or released and calls appropriate procecure. test al, 10000000b ;check if key is down jnz @@n6 ;if being released, call up instead call down jmp @@n7 @@n6: call up ;key is being released @@n7: ret upOrDown endp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; actionKeys proc locals ;process escape, grey + and grey - keys pusha @@a2: cmp al, 1 ;esc key quits jne @@a3 call done @@a3: cmp al, 4Eh ;grey + key increases vibrato jne @@a4 ;rate call moreVib @@wait3:in al, 60h ;loop until key is released to call clearKB cmp al, 0CEh ;avoid multiple calls to the jne @@wait3 ;function. Scan code for release jmp @@bottom ;is 4E but with the 7th bit set. @@a4: cmp al, 4Ah ;grey - key decreases vibrato jne @@bottom ;rate call lessVib @@wait2:in al, 60h ;loop until key is released. call clearKB cmp al, 0CAh ;Scan code for release is 0CAh jne @@wait2 jmp @@bottom @@bottom:popa ret actionKeys endp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; up proc locals ;if a key is being released, then a search is made through the list of keys ;being played until the key is found. The keys after the found keys are ;moved to the front, overwriting the key that should be removed. Also, ;the note name is removed from the screen. pusha and al, 01111111b ;clear 7th bit call lookup ;get pitch for key pressed mov bx, 0 @@u3: inc bx mov si, bx shl si, 1 cmp bx, keysize ja @@u2 cmp ax, keys[si] jne @@u3 @@u1: mov dx, keys[si+2] mov keys[si], dx ;delete pitch mov edx, notes[si+4] mov notes[si], edx ;delete note name inc bx cmp bx, keysize ja @@u4 jmp @@u1 @@u4: mov si, keysize dec si shl si, 2 ;remove note name from screen push ax push fs mov ax, 0B8B6h mov fs, ax mov byte ptr fs:[si], ' ' mov byte ptr fs:[si+1], 00000111b mov byte ptr fs:[si+2], ' ' mov byte ptr fs:[si+3], 00000111b pop fs pop ax dec keysize cmp keysize, 0 jne @@u2 mov pressed, 0 call quiet @@u2: popa ret up endp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; down proc locals ;When a key is pressed, a key and a note are added to the list of currently ;played keys, unless the note is already in the list. The list is checked, ;and if the note is not found, it is added to the end of the list. pusha call lookUp mov bx, 0 @@d7: inc bx mov si, bx shl si, 1 cmp bx, keysize ;end of list? ja @@d8 cmp keys[si], ax ;does key match value in list already? jne @@d7 jmp @@d12 @@d8: inc keysize mov bx, keysize ;add to list mov keys[si], ax shl si, 1 mov notes[si], edx mov displayed, 0 @@d12: popa ret down endp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; musicKeys proc locals ;this section cycles through all the keys on the current play list. If ;only one key is pressed, a value is generated with is 1.01 times the value ;for a second note to cycle with. This produces a vibrato effect for the ;single note. pusha inc keyplayed mov dx, keysize cmp dl, keyplayed jae @@m9 mov keyplayed, 1 @@m9: ;generate vibrato when only 1 key cmp keysize, 1 ;is pressed. jne @@skip1 not firstTime cmp firstTime, 0 jne @@skip1 push eax push edx mov ebx, 101 ;multiply by 1.01 movzx eax, singleKey mul ebx mov ebx, 100 div ebx mov di, ax pop edx pop eax call play jmp @@bottom @@skip1:movzx bx, keyplayed shl bx, 1 mov ax, keys[bx] mov di, ax call play @@bottom: popa ret musicKeys endp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; quiet proc ;shuts off the speaker pusha mov al, currentMode ; Previous mode and al,0FCh ; out 61h,al ; Restore mode mov firstTime, 0 popa ret quiet endp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; displayNotes proc locals ;Displays currently played notes on the screen. pusha mov cx, keysize shl cx, 2 mov si, 0 @@cycle:cmp si, cx jae @@done mov al, byte ptr notes[si+4] push fs push ax mov ax, 0B8B6h mov fs, ax pop ax mov fs:[si], al pop fs inc si jmp @@cycle @@done: popa ret displayNotes endp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; play proc locals pusha cmp pressed, 1 je @@around in al,61h ; read port mov currentMode,al ; Save current mode or al,3 ; Switch on speaker and timer out 61h,al mov al,0B6h out 43h,al @@around:mov dx,14h mov ax,4F38h ; divisor of frequency div di ; out 42h,al ; lower byte of frequency mov al,ah ; out 42h,al ; higher byte of frequency mov pressed, 1 mov singlekey, di popa ret play endp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; done proc call quiet mov ax, 0040h ;set caps lock off. mov es, ax ;if it was pushed as a key mov bx, 0017h and byte ptr es:[bx], 10111111b mov bh, 0 ;set keyboard repeat delay long mov bl, 0 ;set keyboard repeat rate slow mov ah, 3 mov al, 5 int 16h .exit done endp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; moreVib proc locals ;increase vibrato rate pushad cmp vibratoRate, 39h jae @@skip inc vibratoRate call setVibratoRate call displayVibrato ;display vibrato rate on screen @@skip: popad ret moreVib endp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; lessVib proc locals ;decrease vibrato rate pushad cmp vibratoRate, 31h jbe @@skip dec vibratoRate call setVibratoRate call displayVibrato ;display vibrato rate on screen @@skip: popad ret lessVib endp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; displayVibrato proc ;Display vibrato rate on screen. pusha mov bx, 480 mov al, vibratoRate push fs push ax mov ax, 0B8B6h mov fs, ax pop ax mov fs:[bx], al mov byte ptr fs:[bx+1], 01110101b mov byte ptr fs:[bx-1], 01110101b mov byte ptr fs:[bx+3], 01110101b pop fs popa ret displayVibrato endp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SetVibratoRate proc pusha movzx ebx, vibratoRate sub bl, 30h add bl, 2 mov eax, storeCounter cdq div ebx mov counter, eax popa ret setVibratoRate endp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; clearKB proc pusha ;Clear keyboard buffer by setting head of keyboard buffer equal to the tail. push gs push ax mov ax, 0 mov gs, ax pop ax mov ax,gs:[041Ah] ;Head mov gs:[041Ch],ax ;Tail pop gs popa ret clearKB endp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; getSpeed proc locals ;calculate the speed of the computer running the organ program. First cycle ;until a timer tick has just occured (every 1/18 second). Then, loop through ;most of the same statements and procedures as are contained in the main ;program at the top to see how many are performed before one more timer ;tick occurs. This value is stored and is used to calculate how many ;cycles through the top are needed when the organ is playing. Since the ;interrupt to get the time is not in the loop at the top of the program, ;this program reads the time directly from the timer memory while in the ;timing loop. pushad mov ah,0 ; read time int 1Ah ; mov timer, dx @@cycle:mov ah,0 ; read time int 1Ah ; cmp timer, dx je @@cycle mov timer, dx mov ecx, 0 @@cycle2: inc ecx ;the only function of these statements is ;to see how many times they can be performed in al,60h ;in one timer tick on the current computer. call actionKeys call upOrDown call clearKB call displayNotes cmp keysize, 0 movzx ebx, keysize imul ebx, ecx cmp ebx, counter push ax push es mov bx, 006Ch mov ax, 0040h mov es, ax mov dx, es:[bx] ;read time counter directly from ;memory pop es pop ax cmp timer, dx je @@cycle2 shl ecx, 4 mov counter, ecx mov storeCounter, ecx popad ret getSpeed endp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; lookUp proc locals ;Match the key being pressed with the correct pitch and note name. @@lu1: cmp al, 2Ah ;LEFT SHIFT jne @@lu2 mov ax, 165 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'E' jmp @@bottom @@lu2: cmp al, 2Ch ;Z jne @@lu3 mov ax, 175 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'F' jmp @@bottom @@lu3: cmp al, 2Dh ;X jne @@lu4 mov ax, 186 mov dh, 01110100b mov dl, '#' shl edx, 16 mov dh, 01110100b mov dl, 'F' jmp @@bottom @@lu4: cmp al, 2Eh ;C jne @@lu5 mov ax, 196 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'G' jmp @@bottom @@lu5: cmp al, 2Fh ;V jne @@lu6 mov ax, 208 mov dh, 01110100b mov dl, '#' shl edx, 16 mov dh, 01110100b mov dl, 'G' jmp @@bottom @@lu6: cmp al, 30h ;B jne @@lu7 mov ax, 220 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'A' jmp @@bottom @@lu7: cmp al, 31h ;N jne @@lu8 mov ax, 233 mov dh, 01110100b mov dl, '#' shl edx, 16 mov dh, 01110100b mov dl, 'A' jmp @@bottom @@lu8: cmp al, 32h ;M jne @@lu9 mov ax, 247 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'B' jmp @@bottom @@lu9: cmp al, 33h ;, jne @@lu10 mov ax, 262 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'C' jmp @@bottom @@lu10: cmp al, 34h ;. jne @@lu11 mov ax, 277 mov dh, 01110100b mov dl, '#' shl edx, 16 mov dh, 01110100b mov dl, 'C' jmp @@bottom @@lu11: cmp al, 35h ;/ jne @@lu12 mov ax, 294 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'D' jmp @@bottom @@lu12: cmp al, 36h ;RIGHT SHIFT jne @@lu13 mov ax, 311 mov dh, 01110100b mov dl, '#' shl edx, 16 mov dh, 01110100b mov dl, 'D' jmp @@bottom @@lu13: cmp al, 3Ah ;CAPS LOCK jne @@lu14 mov ax, 330 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'E' jmp @@bottom @@lu14: cmp al, 1Eh ;A jne @@lu15 mov ax, 349 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'F' jmp @@bottom @@lu15: cmp al, 1Fh ;S jne @@lu16 mov ax, 370 mov dh, 01110100b mov dl, '#' shl edx, 16 mov dh, 01110100b mov dl, 'F' jmp @@bottom @@lu16: cmp al, 20h ;D jne @@lu17 mov ax, 392 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'G' jmp @@bottom @@lu17: cmp al, 21h ;F jne @@lu18 mov ax, 415 mov dh, 01110100b mov dl, '#' shl edx, 16 mov dh, 01110100b mov dl, 'G' jmp @@bottom @@lu18: cmp al, 22h ;G jne @@lu19 mov ax, 440 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'A' jmp @@bottom @@lu19: cmp al, 23h ;H jne @@lu20 mov ax, 466 mov dh, 01110100b mov dl, '#' shl edx, 16 mov dh, 01110100b mov dl, 'A' jmp @@bottom @@lu20: cmp al, 24h ;J jne @@lu21 mov ax, 494 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'B' jmp @@bottom @@lu21: cmp al, 25h ;K jne @@lu22 mov ax, 523 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'C' jmp @@bottom @@lu22: cmp al, 26h ;L jne @@lu23 mov ax, 554 mov dh, 01110100b mov dl, '#' shl edx, 16 mov dh, 01110100b mov dl, 'C' jmp @@bottom @@lu23: cmp al, 27h ;; jne @@lu24 mov ax, 587 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'D' jmp @@bottom @@lu24: cmp al, 28h ;' jne @@lu25 mov ax, 622 mov dh, 01110100b mov dl, '#' shl edx, 16 mov dh, 01110100b mov dl, 'D' jmp @@bottom @@lu25: cmp al, 1Ch ;ENTER jne @@lu26 mov ax, 659 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'E' jmp @@bottom @@lu26: cmp al, 0Fh ;TAB jne @@lu27 mov ax, 698 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'F' jmp @@bottom @@lu27: cmp al, 10h ;Q jne @@lu28 mov ax, 740 mov dh, 01110100b mov dl, '#' shl edx, 16 mov dh, 01110100b mov dl, 'F' jmp @@bottom @@lu28: cmp al, 11h ;W jne @@lu29 mov ax, 784 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'G' jmp @@bottom @@lu29: cmp al, 12h ;E jne @@lu30 mov ax, 831 mov dh, 01110100b mov dl, '#' shl edx, 16 mov dh, 01110100b mov dl, 'G' jmp @@bottom @@lu30: cmp al, 13h ;R jne @@lu31 mov ax, 880 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'A' jmp @@bottom @@lu31: cmp al, 14h ;T jne @@lu32 mov ax, 932 mov dh, 01110100b mov dl, '#' shl edx, 16 mov dh, 01110100b mov dl, 'A' jmp @@bottom @@lu32: cmp al, 15h ;Y jne @@lu33 mov ax, 988 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'B' jmp @@bottom @@lu33: cmp al, 16h ;U jne @@lu34 mov ax, 1046 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'C' jmp @@bottom @@lu34: cmp al, 17h ;I jne @@lu35 mov ax, 1109 mov dh, 01110100b mov dl, '#' shl edx, 16 mov dh, 01110100b mov dl, 'C' jmp @@bottom @@lu35: cmp al, 18h ;O jne @@lu36 mov ax, 1175 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'D' jmp @@bottom @@lu36: cmp al, 19h ;P jne @@lu37 mov ax, 1244 mov dh, 01110100b mov dl, '#' shl edx, 16 mov dh, 01110100b mov dl, 'D' jmp @@bottom @@lu37: cmp al, 1Ah ;[ jne @@lu38 mov ax, 1318 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'E' jmp @@bottom @@lu38: cmp al, 1Bh ;] jne @@lu39 mov ax, 1397 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'F' jmp @@bottom @@lu39: cmp al, 2Bh ;\ jne @@lu40 mov ax, 1480 mov dh, 01110100b mov dl, '#' shl edx, 16 mov dh, 01110100b mov dl, 'F' jmp @@bottom @@lu40: cmp al, 29h ;` jne @@lu41 mov ax, 1568 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'G' jmp @@bottom @@lu41: cmp al, 02h ;1 jne @@lu42 mov ax, 1661 mov dh, 01110100b mov dl, '#' shl edx, 16 mov dh, 01110100b mov dl, 'G' jmp @@bottom @@lu42: cmp al, 03h ;2 jne @@lu43 mov ax, 1760 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'A' jmp @@bottom @@lu43: cmp al, 04h ;3 jne @@lu44 mov ax, 1864 mov dh, 01110100b mov dl, '#' shl edx, 16 mov dh, 01110100b mov dl, 'A' jmp @@bottom @@lu44: cmp al, 05h ;4 jne @@lu45 mov ax, 1975 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'B' jmp @@bottom @@lu45: cmp al, 06h ;5 jne @@lu46 mov ax, 2093 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'C' jmp @@bottom @@lu46: cmp al, 07h ;6 jne @@lu47 mov ax, 2217 mov dh, 01110100b mov dl, '#' shl edx, 16 mov dh, 01110100b mov dl, 'C' jmp @@bottom @@lu47: cmp al, 08h ;7 jne @@lu48 mov ax, 2349 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'D' jmp @@bottom @@lu48: cmp al, 09h ;8 jne @@lu49 mov ax, 2489 mov dh, 01110100b mov dl, '#' shl edx, 16 mov dh, 01110100b mov dl, 'D' jmp @@bottom @@lu49: cmp al, 0Ah ;9 jne @@lu50 mov ax, 2637 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'E' jmp @@bottom @@lu50: cmp al, 0Bh ;0 jne @@lu51 mov ax, 2794 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'F' jmp @@bottom @@lu51: cmp al, 0Ch ;- jne @@lu52 mov ax, 2960 mov dh, 01110100b mov dl, '#' shl edx, 16 mov dh, 01110100b mov dl, 'F' jmp @@bottom @@lu52: cmp al, 0Dh ;= jne @@lu53 mov ax, 3136 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'G' jmp @@bottom @@lu53: cmp al, 0Eh ;BACKSPACE jne @@lu54 mov ax, 3322 mov dh, 01110100b mov dl, '#' shl edx, 16 mov dh, 01110100b mov dl, 'G' jmp @@bottom @@lu54: cmp al, 3Bh ;F1 jne @@lu55 mov ax, 3519 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'A' jmp @@bottom @@lu55: cmp al, 3Ch ;F2 jne @@lu56 mov ax, 3728 mov dh, 01110100b mov dl, '#' shl edx, 16 mov dh, 01110100b mov dl, 'A' jmp @@bottom @@lu56: cmp al, 3Dh ;F3 jne @@lu57 mov ax, 3949 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'B' jmp @@bottom @@lu57: cmp al, 3Eh ;F4 jne @@lu58 mov ax, 4183 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'C' jmp @@bottom @@lu58: cmp al, 3Fh ;F5 jne @@lu59 mov ax, 4431 mov dh, 01110100b mov dl, '#' shl edx, 16 mov dh, 01110100b mov dl, 'C' jmp @@bottom @@lu59: cmp al, 40h ;F6 jne @@lu60 mov ax, 4694 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'D' jmp @@bottom @@lu60: cmp al, 41h ;F7 jne @@lu61 mov ax, 4972 mov dh, 01110100b mov dl, '#' shl edx, 16 mov dh, 01110100b mov dl, 'D' jmp @@bottom @@lu61: cmp al, 42h ;F8 jne @@lu62 mov ax, 5267 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'E' jmp @@bottom @@lu62: cmp al, 43h ;F9 jne @@lu63 mov ax, 5579 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'F' jmp @@bottom @@lu63: cmp al, 44h ;F10 jne @@lu64 mov ax, 5910 mov dh, 01110100b mov dl, '#' shl edx, 16 mov dh, 01110100b mov dl, 'F' jmp @@bottom @@lu64: cmp al, 57h ;F11 jne @@lu65 mov ax, 6261 mov dh, 01110100b mov dl, ' ' shl edx, 16 mov dh, 01110100b mov dl, 'G' jmp @@bottom @@lu65: cmp al, 58h ;F12 jne @@lu66 mov ax, 6632 mov dh, 01110100b mov dl, '#' shl edx, 16 mov dh, 01110100b mov dl, 'G' jmp @@bottom @@lu66: mov ax, 10000 ;if invalid key is pressed, play mov dh, 00000000b ;an inaudible pitch mov dl, ' ' shl edx, 16 mov dh, 00000000b mov dl, ' ' @@bottom:ret lookUp endp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; END