sigh. i dont know

This commit is contained in:
Nero 2020-02-28 19:55:00 +00:00
parent f4f89e8e48
commit 30ae244ef1
9 changed files with 110 additions and 212 deletions

BIN
src/cp437.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

45
src/scripts/bmp2font.c Normal file
View file

@ -0,0 +1,45 @@
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdint.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
FILE* in;
FILE* out;
void *addr;
void copyline(int c) {
uint8_t *ptr = addr + 0x82 + (128/8)*(127 - c);
int i;
for (i=0; i<16; i++) {
fputc(*ptr++, out);
}
}
int main(int argc, char** argv) {
struct stat sbuf;
in = fopen(argv[1], "r+");
out = fopen(argv[2], "w");
fstat(fileno(in), &sbuf);
if (sbuf.st_size != 2178) {
printf("File must be a 128x128 pixel 1 bit monochrome bmp\n");
exit(1);
}
addr = mmap(NULL, sbuf.st_size, PROT_READ | PROT_WRITE, MAP_SHARED, fileno(in), 0);
int i, j;
for(j=0; j<8; j++) {
for(i=0; i<16; i++) {
copyline(j+i*8);
}
}
}

99
src/vga11.asm Normal file
View file

@ -0,0 +1,99 @@
org 0x7C00
cols: equ 80
rows: equ 30
main:
mov ax, cs
mov ds, ax
mov es, ax
mov ss, ax
xor sp, sp
mov ah, 0x42
mov si, dap
int 0x13
mov ax, 0x0011
int 0x10
mov di, txtbuf
.loop:
call sync
xor ax, ax
int 0x16
stosb
jmp .loop
hlt:
hlt
jmp hlt
sync:
push ax
push si
push di
push es
mov si, txtbuf
mov ax, 0xA000
mov es, ax
mov di, 0
mov bx, font
mov cx, rows
.loop:
call charline
loop .loop
pop es
pop di
pop si
pop ax
ret
charline:
push bx
push cx
mov cx, 8
.loop:
call scanline
call scanline
inc bh
loop .loop
add si, cols
pop cx
pop bx
ret
scanline:
push si
push cx
mov cx, cols
.loop:
lodsb
mov bl, al
mov al, [bx]
stosb
loop .loop
pop cx
pop si
ret
dap:
db 0x10
db 1
dw 20
dw font, 0
dq 1
times (510 - ($-$$)) nop
dw 0xAA55
font:
incbin "cp437.bin"
txtbuf:
times (rows * cols) db 0
end: