Keyboard IRQ1 & PC Speaker Music | Amateur OS Dev (in C)

Channel:
Subscribers:
5,840
Published on ● Video Link: https://www.youtube.com/watch?v=R4SGAA3A2RY



Duration: 1:50:58
1,093 views
48


Moving the get_key() code into PIC IRQ1, and making functions to play PC Speaker square wave music.

OS Dev playlist:
https://www.youtube.com/playlist?list=PLT7NbkyNWaqajsw8Xh7SP9KJwjfpP8TNX

Source code for this video:
https://git.sr.ht/~queso_fuego/amateur_os_video_sources/tree/master/item/41_irq1_pc_speaker

Git Repos for this OS:
Sourcehut: https://git.sr.ht/~queso_fuego/quesos
Github mirror: https://github.com/queso-fuego/amateuros

Join the Community Discord:
https://discord.gg/yKm4T89QFn

Links to things:
https://www.vgleadsheets.com/
https://pages.mtu.edu/~suits/notefreqs.html
https://onlinetonegenerator.com/
https://wiki.osdev.org/PC_Speaker
https://wiki.osdev.org/PS/2_Keyboard

Notes:
- A lookup table for normal and shifted/modified keys would be better than a bunch of if/elseifs. I realize that more looking back on this. With the scancodes being different
between PS/2 scancode sets 1,2,3, and USB, I didn't want to think of how to do translations
between each scancode set to a standard offset within these lookup tables. The other scancode sets would need a state machine as well, for the F0h prefix for break codes at least, if not other things. But a couple arrays of 256 chars aren't much at all, so a lookup table should be fine and doable.

- Apologies if the voice and sound levels are bad, was being quiet for people in the house, and being on-call the week of recording I was pretty tired. I don't like having an asmr voice, it makes the video worse and editing takes longer to try to balance loudness levels. Such is life.
I do set the language for these so youtube provides automatic subtitles in english, and those usually work pretty well.

Next video ideas:
Virtual memory and paging;
Double buffered graphics and bezier curves;
C programs to replace shell scripts for building the OS;
or other things...

- Let me know if there's anything specific you'd like to see

Outline:
0:00 - Change get_key() and add keyboard IRQ1
52:49 - pc_speaker.h and square wave music functions
1:46:21 - Example song, nindendo don't DMCA please
1:48:28 - Coming up & Outro :^)

Software used:
VMware Workstation Player - https://www.vmware.com/products/workstation-player/workstation-player-evaluation.html
openBSD - https://www.openbsd.org/
freeBSD - https://www.freebsd.org/
qemu - https://www.qemu.org/
vim - https://www.vim.org/
clang - https://clang.llvm.org/
davinci resolve - https://www.blackmagicdesign.com/products/davinciresolve/
OBS Studio - https://obsproject.com/

Peripherals:
Camera: Sony ZV-1, Elgato Camlink 4k
Microphone: Shure SM7B, Cloudlifter CL-1, Focusrite Scarlett Solo
Keyboard: HHKB Pro Hybrid Type S, white/blank keycaps
Mouse: Logitech M590

Contact:
email - fuegoqueso@gmail.com
twitter - @Queso_Fuego
twitch - https://www.twitch.tv/queso_fuego

Thoughts/Notes/Suggestions/Other - Drop a message in the video comments, twitter, or email

Updates for these videos and other things will be on twitter, the YouTube channel community tab, or mailing lists, if I remember.

Credits:
Music from VGleadsheets.com, played by qemu pc speaker emulation

#osdev #programming #music







Tags:
c programming
os dev
operating systems
pc speaker
square wave sound
queso fuego
audio programming
keyboard irq
pic irq1
low level