diff --git a/pcano.asm b/pcano.asm index 771a83a..7925d91 100644 --- a/pcano.asm +++ b/pcano.asm @@ -1,15 +1,15 @@ -mov ah, 00h ; clears the screen and makes the cursor invisible -mov al, 03h -int 10h -mov ah, 01h -mov cx, 2607h -int 10h -mov ah, 02h -mov dl, 0 -int 10h +clear: + mov ah, 00h ; clears the screen and sets the cursor to the first position on the screen + mov al, 03h + int 10h + mov ah, 02h + mov dl, 0 + int 10h input: ; takes user input in al, 60h + cmp al, 44 + je clear cmp al, 18 je lower cmp al, 16 @@ -34,74 +34,93 @@ input: ; takes user input je setcolon jmp stopnote -lower: + +lower: ; lower the note later mov cl, 1 jmp input -middle: +middle: ; set note to normal pitch mov cl, 0 jmp input -upper: +upper: ; raise the note later mov cl, 2 jmp input seta: mov bx, 4560 + mov al, 'C' jmp playnote sets: mov bx, 4063 + mov al, 'D' jmp playnote setd: mov bx, 3619 + mov al, 'E' jmp playnote setf: mov bx, 3416 + mov al, 'F' jmp playnote setj: mov bx, 3043 + mov al, 'G' jmp playnote setk: mov bx, 2711 + mov al, 'A' jmp playnote setl: mov bx, 2415 + mov al, 'B' jmp playnote setcolon: mov bx, 2280 + mov al, 'C' jmp playnote -octlow: +octhigh: ; raises the note by an octave xor dl, dl mov ax, bx mov bx, 2 div bx mov bx, ax + mov al, '5' jmp portnote -octhigh: +octlow: ; lowers the note by an octave mov ax, 2 mul bx mov bx, ax + mov al, '3' jmp portnote playnote: - mov al, 182 ; playing sounds n stuff + mov ah, 0x0e ; prints the char in al + int 10h + + mov al, 182 out 43h, al - cmp cl, 2 - je octhigh - cmp cl, 1 + + cmp cl, 2 ; if certain keys were pressed, changes the pitch of the note je octlow + cmp cl, 1 + je octhigh + mov al, '4' portnote: - mov ax, bx + mov ah, 0x0e ; prints the octave number + int 10h + + mov ax, bx ; plays the note out 42h, al mov al, ah out 42h, al @@ -117,7 +136,7 @@ waitforrelease: jne stopnote jmp waitforrelease -stopnote: +stopnote: ; turns off the speaker in al, 61h and al, 11111100b out 61h, al diff --git a/pcano.img b/pcano.img index fc35c1c..8f579f8 100644 Binary files a/pcano.img and b/pcano.img differ