It's not just big– its large.This website is in light mode.
Unacceptable. This website will be converted to dark mode in time for my August 1st update. Stay tuned for the amazing world that is interrupts.
0 Comments
Things are starting to come to a slow but there has been major progress in the font department, among other news. Fonts and Datastructures The journey is long and hard… and C is doing me no favors. After testing many iterations of storing and handling fonts, using scripts, workarounds, etc. I’ve finally found a solution that has gotten me to the next stage of progress. Here is a list of my architecture attempts. Solution 1: Define two types, fontchar, and font. Fontchars will be free-size two-dimensional char arrays, where a space means no pixel and a # means yes pixel. Fonts simply contain an array of pointers to each character and other metadata like kerning, dimensions, etc. A driver can be written to simply scan across each character and decide to put a pixel. Problems:
Solution 2: Take an already existing font and use a python script to transform it into the same fontchar and font architecture. Problems:
Solution 3: Same as solution 2 but this time design a new architecture and handoff more to my C driver. The new architecture will mirror the BSF font spec and have data in byte arrays. I literally just copy the bitmap representation in the font file, dress it up, and slap a header guard and I’m done. Problems:
Using binary data seems great. It’s very low maintenance in terms of transforming data and it works well with my C code. Writing the bitshift code seems like black magic and also inefficient at the same time. But that’s another topic. I’m currently dealing with a problem where the defined font struct (which is just an array of pointers) has everything at zero for some reason. I’ll use ghidra and gdb to figure what’s happening. Organization After talking to one of my mentors, I am able to see a clearer picture of my big goals and what I need to do to accomplish them. I’m using the strategy to break each goal down into the smallest possible task. That way no matter what I do, I’m always making progress. My mentor used the example of scrum, in how every task for a programmer should be no longer than two weeks. If not, it’s too big. I’m using this philosophy except on a smaller time scale.
This is a small update.
Software licenses are hard. Being able to use other peoples' code is one of the beauties of open source. However, most open source repositories have software licenses, which define exactly how the code can be used and/or redistributed. There are a range of licenses you can use, but the problem is that open source licenses won't always be compatible with one another. The license I plan to use for my repository will probably be the GNU GPLv3 License, and the font has the BSD 2-Clause "Simplified" License. After checking with this tool, they should be compatible. Now all I need to do is make my project a GitHub repository, add the licenses, READMEs, etc. and configure git submodules to include the font. I'll probably create myown gh organization to handle all the repo's like my shell language too. Fonts and Implementation Details
Looking ahead, I knew there were still many challenges before I could get a proper I/O system in place, let alone a tty (TeleTYpewriter or Terminal) or shell. I realized that manually hard-coding in the font characters was going to take too long and wasn’t worth the effort. Even after I kept only the most relevant characters (0x20 to 0x5A plus a few others) and rescaled my bitmap resolution down from 8x8, it was still too much. I instead looked on github for FOSS (Free and Open Source Software) bitmap fonts. The problem was that there were so many file formats, and so many font specifications I had to read before I could understand what I was dealing with. I have to be honest— typography isn’t my strong suit. I eventually found a bitmap font that was simplistic enough for me easily translate into my code. I’ll use python scripting to interpret the necessary information form the font file and output it in source file. I haven’t settled on a font interface/protocol but for now I’ll probably define a font struct which can standardize and map chars to fontchars and create the necessary header and source files. Fontchars will just be 6x8 boolean arrays. You might ask, why can’t I just download the font file and write a font reader driver in c? The problem is I don’t have a working file system. Once I get a file system driver up and preprocessor I can write a proper driver, but this will do for now. Future Goals: IDT Writing the conversion script won’t take too long, and then I can get started on the next big milestone: creating an IDT (Interrupt Descriptor Table). I already mentioned how I can’t use BIOS interrupts to put text to the screen; I also can’t read keyboard input either. To solve this, I’ll have to set up an IDT and write the necesary ISRs (Interrupt Service Routines) to handle everything. After completing this, I’ll probably have to do some more refactoring. Future Goals: TTY and Shell Once I’m able to receive keyboard input, I can start writing the code for a basic terminal. Things like proper text graphics handling will be the first thing. Then I can write rudimentary shell functions like whoami which displays the current username. I don’t have a file system so directory traversal functions like ls or cd won’t be implemented. At least for this stage, there won’t be anything complicated, just a simple switch statement to some functions. Of course, that’s no where near a functioning shell. Aside from the fact I have no file system, I can basically only use one-word commands that just print the same text over and over again. To make a more complex shell, I’ll have to write a language interpreter. It will start pretty simple, just lexing and parsing character by character, keyword by keyword, but my ultimate goal is to have something comparable to bash. Future Goals: Paging, Virtual Addressing, and Memory Management That will… be a problem. I held off on adding paged memory because reading the specification gave me a headache and the structure was too much to take in. Writing a memory manager is already a daunting task in it’s own right, but having to deal with writing handlers for the paging is way more difficult. This is going to be something I’m going to have to deal with very soon. Since now, all my data and buffers have been statically allocated, but sometimes its useful to be able to handle situations you can’t perfectly predict. I already know a bit about writing a programming language, and if I want a shell language as functional as bash, I’ll need to implement an AST (Abstract Syntax Tree). I won’t get too much into the details, but rest assured creating ASTs without a dynamic memory allocator is not something I want to do. Other Future Goals: Filesytem, Mentors, EE I’ll need to create a file system. I’ll probably just implement FAT32 or some other version of FAT. Working out my system architecture will be continuous process. I’m also currently speaking to potential mentors. I’m also going to start research on the boards I need for my EE phase. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
November 2022
Categories |