Skip to content
Snippets Groups Projects
Commit 2bc67e6c authored by Stephen D's avatar Stephen D
Browse files
parents 590e27e5 0bc41ac6
No related branches found
No related tags found
No related merge requests found
......@@ -33,13 +33,7 @@ load_bootloader:
;mov dh, [SEC_COUNT]
;call print_hex
pusha
mov es, [CURRENT_REG_LOAD]
mov bx, 0;[CURRENT_MEM_LOAD] ; Read from disk and store into ax
mov dh, [HEAD_COUNT] ; dh <- head number (0x0 .. 0xF) //Redundant?
mov cl, al
mov al, 1 ;Num sectors
mov ch, [CYL_COUNT] ;Cylinder number
mov dl, [BOOT_DRIVE]
call disk_load
popa
mov bx, SECTOR_LOADED
......
disk_load:
pusha
; reading from disk requires setting specific values in all registers
retry:
mov es, [CURRENT_REG_LOAD]
mov bx, 0;[CURRENT_MEM_LOAD] ; Read from disk and store into ax
mov dh, [HEAD_COUNT] ; dh <- head number (0x0 .. 0xF) //Redundant?
mov cl, al
mov al, 1 ;Num sectors
mov ch, [CYL_COUNT] ;Cylinder number
mov dl, [BOOT_DRIVE]
mov ah, 0x02 ; ah <- int 0x13 function. 0x02 = 'read'
;mov cl, 0x02 ; cl <- sector (0x01 .. 0x11)
; 0x01 is our boot sector, 0x02 is the first 'available' sector
......@@ -11,7 +18,6 @@ disk_load:
; [es:bx] <- pointer to buffer where the data will be stored
; caller sets it up for us, and it is actually the standard location for int 13h
retry:
int 0x13 ; BIOS interrupt
jc disk_error ; if error (stored in the carry bit)
......@@ -22,13 +28,13 @@ retry:
disk_error:
mov bx, DISK_ERROR
call print
call print_nl
mov dh, ah ; ah = error code, dl = disk drive that dropped the error
call print_hex ; check out the code at http://stanislavs.org/helppc/int_13-1.html
jmp disk_loop
jmp retry ;Try again. Forever.
mov bx, DISK_ERROR
call print
call print_nl
mov dh, ah ; ah = error code, dl = disk drive that dropped the error
call print_hex ; check out the code at http://stanislavs.org/helppc/int_13-1.html
;jmp disk_loop
jmp retry ;Try again. Forever.
sectors_error:
mov bx, SECTORS_ERROR
......
......@@ -67,5 +67,6 @@ void scroll_up(u8 lines);
u8 COLOR_BYTES;
u16 SCN_WIDTH;
u16 SCN_HEIGHT;
u16 SCN_PITCH;
u32 VIDEO_ADDRESS;
#endif
......@@ -32,9 +32,9 @@ void main() {
generate_fractal(SCN_WIDTH - 64 - 8, 8, 64, 64);
if (!init_floppy()) {
println("WARNING: This type of floppy drive is not supported by the system.");
}
// if (!init_floppy()) {
// println("WARNING: This type of floppy drive is not supported by the system.");
//}
println("STEVEOS V0.0.2");
println("WRITTEN BY STEPHEN DOWNWARD");
......
......@@ -61,19 +61,19 @@ int strcmp(char s1[], char s2[]) {
void strsplit(char *orig, char separator, char *a, char *b) {
int found = 0;
for(int i = 0; i < strlen(orig); i++) {
if (orig[i] == separator) found = i + 1; //+1 for the seperator char
if (found > 0) {
b[i - found] = orig[i];
} else {
a[i] = orig[i];
}
if (orig[i] == separator && found == 0) found = i + 1; //+1 for the seperator char
if (found > 0) {
b[i - found] = orig[i];
} else {
a[i] = orig[i];
}
}
}
void tolowercase(char *in) {
for(int i = 0; i < strlen(in); i++) {
if(in[i] >= 65 && in[i] <= 90) {
in[i] += 32;
}
if(in[i] >= 65 && in[i] <= 90) {
in[i] += 32;
}
}
}
......@@ -79,6 +79,8 @@ u16 characters[26 * 8 + 31 * 8 + 16*8] = {
};
void draw_char(int x, int y, char c) {
unsigned where = x*COLOR_BYTES + y*SCN_PITCH;
u8 *screen = (u8 *) VIDEO_ADDRESS;
if (c == 124) { //Custom code for |
for(int r = 0; r < 8; r++) {//Rows
putpixel(x + 3, y - r, 255, 255, 255); //TODO: CHANGE THIS
......@@ -95,9 +97,13 @@ void draw_char(int x, int y, char c) {
uint16 row = characters[c * 8 + r];
for (int i = 0; i < 8; i++) {
if (row&(1 << i)) {
putpixel(x + i, y - r, 255, 255, 255); //TODO: CHANGE THIS
}
screen[where + i*COLOR_BYTES] = 255;
screen[where + i*COLOR_BYTES + 1] = 255;
screen[where + i*COLOR_BYTES + 2] = 255;
}
}
where -= SCN_PITCH;
}
}
}
......
......@@ -80,14 +80,14 @@ void register_command(char *cmd, void (*handler)(char *)) {
int parse_command(char *linein) {
for(int i = 0; i < 255; i++) {
char cmd[256] = "";
char args[256] = "";
strsplit(linein, ' ', cmd, args);
tolowercase(cmd);
if(strcmp(cmd, commands[i]) == 0) {
cmd_handlers[i](args);
return 1;
}
char cmd[256] = "";
char args[256] = "";
strsplit(linein, ' ', cmd, args);
tolowercase(cmd);
if(strcmp(cmd, commands[i]) == 0) {
cmd_handlers[i](args);
return 1;
}
}
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment