Skip to content

Commit

Permalink
added two octaves and a way to switch between them
Browse files Browse the repository at this point in the history
  • Loading branch information
spagootie committed Jul 1, 2020
1 parent 2d5e106 commit 9dcd6fc
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
40 changes: 39 additions & 1 deletion pcano.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
Binary file modified pcano.img
Binary file not shown.

0 comments on commit 9dcd6fc

Please sign in to comment.