From 9dcd6fc9168a03b146ee980fda407879e527cfb7 Mon Sep 17 00:00:00 2001 From: FreeByrd Date: Wed, 1 Jul 2020 12:58:32 -0400 Subject: [PATCH] added two octaves and a way to switch between them --- README.md | 2 ++ pcano.asm | 40 +++++++++++++++++++++++++++++++++++++++- pcano.img | Bin 512 -> 512 bytes 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0e05666..cb500d2 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,8 @@ USAGE: Use the keys a, s, d, f, j, k, l, and ; to play notes. +Use the keys q, w, and e to change between three different octaves. + the Star Wars theme is a, j, f, d, s, ;, j, f, d, s, ;, j, f, d, f, s. ASSEMBLING: diff --git a/pcano.asm b/pcano.asm index 7e6412c..771a83a 100644 --- a/pcano.asm +++ b/pcano.asm @@ -10,6 +10,12 @@ int 10h input: ; takes user input in al, 60h + cmp al, 18 + je lower + cmp al, 16 + je upper + cmp al, 17 + je middle cmp al, 30 je seta cmp al, 31 @@ -28,6 +34,18 @@ input: ; takes user input je setcolon jmp stopnote +lower: + mov cl, 1 + jmp input + +middle: + mov cl, 0 + jmp input + +upper: + mov cl, 2 + jmp input + seta: mov bx, 4560 jmp playnote @@ -59,10 +77,30 @@ setl: setcolon: mov bx, 2280 jmp playnote + +octlow: + xor dl, dl + mov ax, bx + mov bx, 2 + div bx + mov bx, ax + jmp portnote + +octhigh: + mov ax, 2 + mul bx + mov bx, ax + jmp portnote + playnote: mov al, 182 ; playing sounds n stuff out 43h, al + cmp cl, 2 + je octhigh + cmp cl, 1 + je octlow +portnote: mov ax, bx out 42h, al mov al, ah @@ -71,7 +109,7 @@ playnote: or al, 00000011b out 61h, al - in al, 60 ; makes it so the note stops when the key is released + in al, 60h ; makes it so the note stops when the key is released mov dl, al waitforrelease: in al, 60h diff --git a/pcano.img b/pcano.img index 92230c0017fb640b57539dde33b75dd5a06fbff1..fc35c1c394682cb259f103756e9870ad550e3433 100644 GIT binary patch delta 183 zcmV;o07(CU1b_sP7Jm|SDm)N$E<6!*COjT=Dm))_D?A`{EIc7}Ej%Q2E<7c4FFYo6 zFgz!8G3#=%0qe}M0PD!H0_()P&=Ko7yWbD%G`k}X>o2=l4eKhq;|uF0yO#>l?f12w8-gkhB>d)K=~e%+kw5_gRjS7SRO|o% delta 100 zcmV-q0Gt1S1b_sP7EK;>9y}j(A3Pv*AUq*-Av`2>B0ME@BRnQ_Bs?c{CF@4J&=Kn+ zyWbD%9=jtB>lwRP4eJ!U;|uE#yO#><3cGI!>jk^$2