Drive 80h, Scrolling, Refactor Printing Again - Amateur OS Dev (x86 asm)
Changing the drive number to 80h for a hard drive, implementing scrolling down when printing, and changing printing to use cursor x/y addresses instead of values.
Notes: The issue with setting the hard drive number and getting it passed to different programs was, I think, due to segment differences.
DS/data segment is where offsets are generated for data at assemble time. In the bootsector, DS would be 7C00h or 0000h (I think). In the kernel, DS would be 200h because we change that before the jump.
In a loaded program such as the editor, DS is set to 800h. So any memory that is used like '[drive_number]' would be expecting DS=200h (actually points to 2000h linear address) + drive_number as the memory address, in the kernel. Changing DS to 800h means that is no longer valid, so it isn't accessible like that anymore. And from the editor returning to the kernel, changing drive_number after moving 200h into DS would not work. But DX in general should be fine, or an absolute address like [6000h:0000h] 'should' work, but maybe not.
Anyway, I will try this again next time, using a register or absolute address to pass a drive number around instead of hardcoding 80h everywhere.
The next video should be:
Change 80h hardcoding to use a generic "drive_number" and DX passed around, but do it right this time
Replace int 10h in clear screen, and any other place as needed
Create the calculator program for +-*/ and (), using infix notation, using a "simple" recursive descent parser translated mostly from C
Video Outline:
0:00 - Fail to pass around a drive number, and end up hardcoding 80h for hard drive
33:26 - Fix loading binary files in editor
36:32 - Implement scrolling down
52:26 - Change printing to use cursor x/y addresses instead of values
1:38:11 - Coming up next and outro
----------------------------------------------------------------------------------------------------------------------------------------
Playlist for this series:
https://www.youtube.com/playlist?list=PLT7NbkyNWaqajsw8Xh7SP9KJwjfpP8TNX
Git repos:
https://git.sr.ht/~queso_fuego/quesos
https://github.com/queso-fuego/amateuros
Software used:
VMware Workstation Player - https://www.vmware.com/products/workstation-player/workstation-player-evaluation.html
openBSD - https://www.openbsd.org/
qemu - https://www.qemu.org/
vim - https://www.vim.org/ (neovim is probably better :p)
fasm - https://flatassembler.net/
fasm docs - https://flatassembler.net/docs.php?article=manual
Contact:
email - fuegoqueso@gmail.com
twitter - @Queso_Fuego
Thoughts/Notes/Suggestions/Other - Drop a message in the video comments, by twitter, or by email
Credits:
Music from https://incompetech.com:
"Your Call" by Kevin MacLeod (https://incompetech.com)
Licence: CC BY (http://creativecommons.org/licenses/by/4.0/)
The blue title tags:
#osdev #programming #x86