Added a 128x96 Textmode renderer using 8x8 tiles on an 1024x768 SVGA screen.

You can change resolution by modifying boot.S and textDISP.hpp
This commit is contained in:
Morten Delenk 2016-05-29 08:30:53 +02:00
parent 6a4a634bd0
commit f0ae0c7c36
18 changed files with 488 additions and 124 deletions

View file

@ -20,7 +20,7 @@
namespace MTGosHAL {
BlockDevice::BlockDevice(): numDevices(0), ata0(0x1F0,0), ata1(0x170,1), ata2(0x1E8,2), ata3(0x168,3) {
if(getDriveCnt()==0) {
err<<"Not a single device was found!\n";
//err<<"Not a single device was found!\n";
}
}
auto BlockDevice::getDriveCnt() -> int32_t {return ata0.getDriveCnt()+ata1.getDriveCnt()+ata2.getDriveCnt()+ata3.getDriveCnt();}

View file

@ -36,7 +36,7 @@ namespace MTGosHAL {
numDevices++;
}
} else {
err << "ATA device could not be found!\n";
//err << "ATA device could not be found!\n";
}
outb(baseport+ALTCMD,0x40);
inb(baseport+CMD);

View file

@ -1,11 +1,14 @@
.section multiboot
#define MB_MAGIC 0x1BADB002
#define MB_FLAGS 0x0
#define MB_FLAGS 0x7
#define MB_CHECKSUM -(MB_MAGIC + MB_FLAGS)
.align 4
.int MB_MAGIC
.int MB_FLAGS
.int MB_CHECKSUM
.int 0,0,0,0,0
.int 0
.int 1024, 768, 32
.section .text
.extern init
.global _start

View file

@ -268,7 +268,42 @@ struct multiboot_apm_info
multiboot_uint16_t cseg_16_len;
multiboot_uint16_t dseg_len;
};
struct MODE_INFO
{
unsigned short ModeAttributes ;
unsigned char WinAAttributes ;
unsigned char WinBAttributes ;
unsigned short WinGranularity ;
unsigned short WinSize ;
unsigned short WinASegment ;
unsigned short WinBSegment ;
unsigned int WinFuncPtr ;
unsigned short BytesPerScanLine ;
unsigned short XResolution ;
unsigned short YResolution ;
unsigned char XCharSize ;
unsigned char YCharSize ;
unsigned char NumberOfPlanes ;
unsigned char BitsPerPixel ;
unsigned char NumberOfBanks ;
unsigned char MemoryModel ;
unsigned char BankSize ;
unsigned char NumberOfImagePages ;
unsigned char Reserved_page ;
unsigned char RedMaskSize ;
unsigned char RedMaskPos ;
unsigned char GreenMaskSize ;
unsigned char GreenMaskPos ;
unsigned char BlueMaskSize ;
unsigned char BlueMaskPos ;
unsigned char ReservedMaskSize ;
unsigned char ReservedMaskPos ;
unsigned char DirectColorModeInfo ;
unsigned int PhysBasePtr ;
unsigned int OffScreenMemOffset ;
unsigned short OffScreenMemSize ;
unsigned char Reserved[206] ;
}__attribute__ ((packed));
#endif /* ! ASM_FILE */
#endif /* ! MULTIBOOT_HEADER */

View file

@ -0,0 +1,260 @@
//Thanks to masterq32 for this font!
//You should check out his OS project (https://github.com/MasterQ32/DasOS)
uint8_t font[256][8] = {
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, // ?
{ 0x00, 0x00, 0x0D, 0x12, 0x12, 0x09, 0x09, 0x00 }, // ?
{ 0x00, 0x00, 0x11, 0x11, 0x11, 0x19, 0x16, 0x00 }, // ?
{ 0x00, 0x00, 0x11, 0x11, 0x0A, 0x0A, 0x04, 0x00 }, // ?
{ 0x00, 0x00, 0x11, 0x11, 0x15, 0x15, 0x0A, 0x00 }, // ?
{ 0x00, 0x02, 0x06, 0x0E, 0x06, 0x02, 0x00, 0x00 }, // ?
{ 0x04, 0x0E, 0x1F, 0x0E, 0x0E, 0x00, 0x00, 0x00 }, // ?
{ 0x00, 0x00, 0x0E, 0x0E, 0x1F, 0x0E, 0x04, 0x00 }, // ?
{ 0x08, 0x14, 0x04, 0x04, 0x04, 0x05, 0x02, 0x00 }, // ?
{ 0x00, 0x11, 0x0A, 0x04, 0x0A, 0x11, 0x00, 0x00 }, // ?
{ 0x00, 0x00, 0x00, 0x0E, 0x0A, 0x0E, 0x00, 0x00 }, // ?
{ 0x00, 0x00, 0x00, 0x04, 0x0E, 0x04, 0x00, 0x00 }, // ?
{ 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00 }, // ?
{ 0x00, 0x00, 0x00, 0x07, 0x02, 0x02, 0x02, 0x00 }, // ?
{ 0x06, 0x08, 0x06, 0x08, 0x06, 0x00, 0x00, 0x00 }, // ?
{ 0x1F, 0x03, 0x03, 0x0F, 0x03, 0x03, 0x03, 0x00 }, // ?
{ 0x1C, 0x04, 0x04, 0x04, 0x05, 0x06, 0x04, 0x00 }, // ?
{ 0x18, 0x10, 0x13, 0x10, 0x10, 0x00, 0x00, 0x00 }, // ?
{ 0x06, 0x08, 0x04, 0x02, 0x0E, 0x00, 0x00, 0x00 }, // ?
{ 0x00, 0x00, 0x10, 0x08, 0x04, 0x02, 0x1F, 0x00 }, // ?
{ 0x06, 0x09, 0x09, 0x06, 0x00, 0x00, 0x00, 0x00 }, // ?
{ 0x0D, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 }, // ?
{ 0x0E, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00 }, // ?
{ 0x10, 0x0C, 0x03, 0x0C, 0x10, 0x00, 0x1F, 0x00 }, // ?
{ 0x08, 0x08, 0x1F, 0x04, 0x1F, 0x02, 0x02, 0x00 }, // ?
{ 0x01, 0x06, 0x18, 0x06, 0x01, 0x00, 0x1F, 0x00 }, // ?
{ 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00 }, // ?
{ 0x00, 0x00, 0x1E, 0x02, 0x0E, 0x02, 0x1E, 0x00 }, // ?
{ 0x00, 0x04, 0x08, 0x1F, 0x08, 0x04, 0x00, 0x00 }, // ?
{ 0x00, 0x00, 0x1D, 0x15, 0x15, 0x15, 0x1D, 0x00 }, // ?
{ 0x04, 0x0E, 0x15, 0x04, 0x04, 0x04, 0x04, 0x00 }, // ?
{ 0x04, 0x04, 0x04, 0x04, 0x15, 0x0E, 0x04, 0x00 }, // ?
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, //
{ 0x04, 0x04, 0x04, 0x04, 0x00, 0x04, 0x04, 0x00 }, // !
{ 0x0A, 0x0A, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00 }, // "
{ 0x0A, 0x0A, 0x1F, 0x0A, 0x1F, 0x0A, 0x0A, 0x00 }, // #
{ 0x02, 0x0A, 0x0E, 0x08, 0x08, 0x00, 0x00, 0x00 }, // $
{ 0x03, 0x13, 0x08, 0x04, 0x02, 0x19, 0x18, 0x00 }, // %
{ 0x02, 0x05, 0x05, 0x02, 0x15, 0x09, 0x16, 0x00 }, // &
{ 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00 }, // '
{ 0x08, 0x04, 0x02, 0x02, 0x02, 0x04, 0x08, 0x00 }, // (
{ 0x02, 0x04, 0x08, 0x08, 0x08, 0x04, 0x02, 0x00 }, // )
{ 0x00, 0x04, 0x15, 0x0E, 0x15, 0x04, 0x00, 0x00 }, // *
{ 0x00, 0x04, 0x04, 0x1F, 0x04, 0x04, 0x00, 0x00 }, // +
{ 0x00, 0x00, 0x00, 0x00, 0x06, 0x04, 0x02, 0x00 }, // ,
{ 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x00 }, // -
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x00 }, // .
{ 0x00, 0x10, 0x08, 0x04, 0x02, 0x01, 0x00, 0x00 }, // /
{ 0x0E, 0x11, 0x19, 0x15, 0x13, 0x11, 0x0E, 0x00 }, // 0
{ 0x04, 0x06, 0x04, 0x04, 0x04, 0x04, 0x0E, 0x00 }, // 1
{ 0x0E, 0x11, 0x10, 0x08, 0x04, 0x02, 0x1F, 0x00 }, // 2
{ 0x1F, 0x08, 0x04, 0x08, 0x10, 0x11, 0x0E, 0x00 }, // 3
{ 0x08, 0x0C, 0x0A, 0x09, 0x1F, 0x08, 0x08, 0x00 }, // 4
{ 0x1F, 0x01, 0x0F, 0x10, 0x10, 0x11, 0x0E, 0x00 }, // 5
{ 0x0C, 0x02, 0x01, 0x0F, 0x11, 0x11, 0x0E, 0x00 }, // 6
{ 0x1F, 0x10, 0x08, 0x04, 0x02, 0x02, 0x02, 0x00 }, // 7
{ 0x0E, 0x11, 0x11, 0x0E, 0x11, 0x11, 0x0E, 0x00 }, // 8
{ 0x0E, 0x11, 0x11, 0x1E, 0x10, 0x08, 0x06, 0x00 }, // 9
{ 0x00, 0x06, 0x06, 0x00, 0x06, 0x06, 0x00, 0x00 }, // :
{ 0x00, 0x06, 0x06, 0x00, 0x06, 0x04, 0x02, 0x00 }, // ;
{ 0x08, 0x04, 0x02, 0x01, 0x02, 0x04, 0x08, 0x00 }, // <
{ 0x00, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x00, 0x00 }, // =
{ 0x02, 0x04, 0x08, 0x10, 0x08, 0x04, 0x02, 0x00 }, // >
{ 0x0E, 0x11, 0x10, 0x08, 0x04, 0x00, 0x04, 0x00 }, // ?
{ 0x0E, 0x11, 0x15, 0x1D, 0x05, 0x01, 0x1E, 0x00 }, // @
{ 0x0E, 0x11, 0x11, 0x1F, 0x11, 0x11, 0x11, 0x00 }, // A
{ 0x0F, 0x11, 0x11, 0x0F, 0x11, 0x11, 0x0F, 0x00 }, // B
{ 0x0E, 0x11, 0x01, 0x01, 0x01, 0x11, 0x0E, 0x00 }, // C
{ 0x0F, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0F, 0x00 }, // D
{ 0x1F, 0x01, 0x01, 0x0F, 0x01, 0x01, 0x1F, 0x00 }, // E
{ 0x1F, 0x01, 0x01, 0x0F, 0x01, 0x01, 0x01, 0x00 }, // F
{ 0x0E, 0x11, 0x01, 0x1D, 0x11, 0x11, 0x1E, 0x00 }, // G
{ 0x11, 0x11, 0x11, 0x1F, 0x11, 0x11, 0x11, 0x00 }, // H
{ 0x0E, 0x04, 0x04, 0x04, 0x04, 0x04, 0x0E, 0x00 }, // I
{ 0x1C, 0x08, 0x08, 0x08, 0x08, 0x09, 0x06, 0x00 }, // J
{ 0x11, 0x09, 0x05, 0x03, 0x05, 0x09, 0x11, 0x00 }, // K
{ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x1F, 0x00 }, // L
{ 0x11, 0x1B, 0x15, 0x15, 0x11, 0x11, 0x11, 0x00 }, // M
{ 0x11, 0x11, 0x13, 0x15, 0x19, 0x11, 0x11, 0x00 }, // N
{ 0x0E, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0E, 0x00 }, // O
{ 0x0F, 0x11, 0x11, 0x0F, 0x01, 0x01, 0x01, 0x00 }, // P
{ 0x0E, 0x11, 0x11, 0x11, 0x15, 0x09, 0x16, 0x00 }, // Q
{ 0x0F, 0x11, 0x11, 0x0F, 0x05, 0x09, 0x11, 0x00 }, // R
{ 0x1E, 0x01, 0x01, 0x0E, 0x10, 0x10, 0x0F, 0x00 }, // S
{ 0x1F, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00 }, // T
{ 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0E, 0x00 }, // U
{ 0x11, 0x11, 0x11, 0x11, 0x0A, 0x0A, 0x04, 0x00 }, // V
{ 0x11, 0x11, 0x11, 0x15, 0x15, 0x15, 0x0A, 0x00 }, // W
{ 0x11, 0x11, 0x0A, 0x04, 0x0A, 0x11, 0x11, 0x00 }, // X
{ 0x11, 0x11, 0x11, 0x0A, 0x04, 0x04, 0x04, 0x00 }, // Y
{ 0x1F, 0x10, 0x08, 0x04, 0x02, 0x01, 0x1F, 0x00 }, // Z
{ 0x0C, 0x12, 0x11, 0x1F, 0x11, 0x09, 0x06, 0x00 }, // [
{ 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x00, 0x00 }, // \d
{ 0x06, 0x04, 0x04, 0x04, 0x04, 0x04, 0x06, 0x00 }, // ]
{ 0x04, 0x0A, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00 }, // ^
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00 }, // _
{ 0x04, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00 }, // `
{ 0x00, 0x00, 0x0E, 0x10, 0x1E, 0x11, 0x1E, 0x00 }, // a
{ 0x01, 0x01, 0x0D, 0x13, 0x11, 0x11, 0x0F, 0x00 }, // b
{ 0x00, 0x00, 0x0E, 0x01, 0x01, 0x11, 0x0E, 0x00 }, // c
{ 0x10, 0x10, 0x16, 0x19, 0x11, 0x11, 0x1E, 0x00 }, // d
{ 0x00, 0x00, 0x0E, 0x11, 0x1F, 0x01, 0x0E, 0x00 }, // e
{ 0x0C, 0x12, 0x02, 0x07, 0x02, 0x02, 0x02, 0x00 }, // f
{ 0x00, 0x1E, 0x11, 0x11, 0x1E, 0x10, 0x0E, 0x00 }, // g
{ 0x01, 0x01, 0x0D, 0x13, 0x11, 0x11, 0x11, 0x00 }, // h
{ 0x04, 0x00, 0x06, 0x04, 0x04, 0x04, 0x0E, 0x00 }, // i
{ 0x08, 0x00, 0x0C, 0x08, 0x08, 0x09, 0x06, 0x00 }, // j
{ 0x02, 0x02, 0x12, 0x0A, 0x06, 0x0A, 0x12, 0x00 }, // k
{ 0x06, 0x04, 0x04, 0x04, 0x04, 0x04, 0x0E, 0x00 }, // l
{ 0x00, 0x00, 0x0B, 0x15, 0x15, 0x11, 0x11, 0x00 }, // m
{ 0x00, 0x00, 0x0D, 0x13, 0x11, 0x11, 0x11, 0x00 }, // n
{ 0x00, 0x00, 0x0E, 0x11, 0x11, 0x11, 0x0E, 0x00 }, // o
{ 0x00, 0x00, 0x0F, 0x11, 0x0F, 0x01, 0x01, 0x00 }, // p
{ 0x00, 0x00, 0x16, 0x19, 0x1E, 0x10, 0x10, 0x00 }, // q
{ 0x00, 0x00, 0x0D, 0x13, 0x01, 0x01, 0x01, 0x00 }, // r
{ 0x00, 0x00, 0x0E, 0x01, 0x0E, 0x10, 0x0F, 0x00 }, // s
{ 0x02, 0x02, 0x07, 0x02, 0x02, 0x12, 0x0C, 0x00 }, // t
{ 0x00, 0x00, 0x11, 0x11, 0x11, 0x19, 0x16, 0x00 }, // u
{ 0x00, 0x00, 0x11, 0x11, 0x11, 0x0A, 0x04, 0x00 }, // v
{ 0x00, 0x00, 0x11, 0x11, 0x15, 0x15, 0x0A, 0x00 }, // w
{ 0x00, 0x00, 0x11, 0x0A, 0x04, 0x0A, 0x11, 0x00 }, // x
{ 0x00, 0x00, 0x11, 0x11, 0x1E, 0x10, 0x0E, 0x00 }, // y
{ 0x00, 0x00, 0x1F, 0x08, 0x04, 0x02, 0x1F, 0x00 }, // z
{ 0x18, 0x04, 0x04, 0x02, 0x04, 0x04, 0x18, 0x00 }, // {
{ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00 }, // |
{ 0x03, 0x04, 0x04, 0x08, 0x04, 0x04, 0x03, 0x00 }, // }
{ 0x00, 0x02, 0x15, 0x08, 0x00, 0x00, 0x00, 0x00 }, // ~
{ 0x1F, 0x1F, 0x11, 0x1F, 0x11, 0x1F, 0x1F, 0x00 }, // ?
{ 0x00, 0x00, 0x0E, 0x0A, 0x0A, 0x0A, 0x0E, 0x00 }, // ?
{ 0x00, 0x00, 0x04, 0x06, 0x04, 0x04, 0x04, 0x00 }, // ?
{ 0x00, 0x00, 0x06, 0x08, 0x04, 0x02, 0x0E, 0x00 }, // ?
{ 0x00, 0x00, 0x06, 0x08, 0x04, 0x08, 0x06, 0x00 }, // ?
{ 0x00, 0x00, 0x02, 0x0A, 0x0E, 0x08, 0x08, 0x00 }, // ?
{ 0x00, 0x00, 0x0E, 0x02, 0x06, 0x08, 0x06, 0x00 }, // ?
{ 0x00, 0x00, 0x0C, 0x02, 0x0E, 0x0A, 0x0E, 0x00 }, // ?
{ 0x00, 0x00, 0x0E, 0x08, 0x04, 0x02, 0x02, 0x00 }, // ?
{ 0x00, 0x00, 0x0E, 0x0A, 0x0E, 0x0A, 0x0E, 0x00 }, // ?
{ 0x00, 0x00, 0x0E, 0x0A, 0x0E, 0x08, 0x06, 0x00 }, // ?
{ 0x08, 0x04, 0x0E, 0x11, 0x11, 0x1F, 0x11, 0x00 }, // ?
{ 0x02, 0x04, 0x0E, 0x11, 0x11, 0x1F, 0x11, 0x00 }, // ?
{ 0x04, 0x0A, 0x00, 0x0E, 0x11, 0x1F, 0x11, 0x00 }, // ?
{ 0x0A, 0x00, 0x0E, 0x11, 0x11, 0x1F, 0x11, 0x00 }, // ?
{ 0x08, 0x04, 0x0E, 0x10, 0x1E, 0x11, 0x1E, 0x00 }, // ?
{ 0x02, 0x04, 0x0E, 0x10, 0x1E, 0x11, 0x1E, 0x00 }, // ?
{ 0x04, 0x0A, 0x0E, 0x10, 0x1E, 0x11, 0x1E, 0x00 }, // ?
{ 0x0A, 0x00, 0x0E, 0x10, 0x1E, 0x11, 0x1E, 0x00 }, // ?
{ 0x08, 0x04, 0x1F, 0x01, 0x0F, 0x01, 0x1F, 0x00 }, // ?
{ 0x02, 0x04, 0x1F, 0x01, 0x0F, 0x01, 0x1F, 0x00 }, // ?
{ 0x04, 0x0A, 0x1F, 0x01, 0x0F, 0x01, 0x1F, 0x00 }, // ?
{ 0x0A, 0x00, 0x1F, 0x01, 0x0F, 0x01, 0x1F, 0x00 }, // ?
{ 0x08, 0x04, 0x0E, 0x11, 0x1F, 0x01, 0x0E, 0x00 }, // ?
{ 0x02, 0x04, 0x0E, 0x11, 0x1F, 0x01, 0x0E, 0x00 }, // ?
{ 0x04, 0x0A, 0x0E, 0x11, 0x1F, 0x01, 0x0E, 0x00 }, // ?
{ 0x0A, 0x00, 0x0E, 0x11, 0x1F, 0x01, 0x0E, 0x00 }, // ?
{ 0x08, 0x04, 0x0E, 0x04, 0x04, 0x04, 0x0E, 0x00 }, // ?
{ 0x02, 0x04, 0x0E, 0x04, 0x04, 0x04, 0x0E, 0x00 }, // ?
{ 0x04, 0x0A, 0x0E, 0x04, 0x04, 0x04, 0x0E, 0x00 }, // ?
{ 0x0A, 0x00, 0x0E, 0x04, 0x04, 0x04, 0x0E, 0x00 }, // ?
{ 0x08, 0x04, 0x00, 0x06, 0x04, 0x04, 0x0E, 0x00 }, // ?
{ 0x02, 0x04, 0x00, 0x06, 0x04, 0x04, 0x0E, 0x00 }, // ?
{ 0x04, 0x0A, 0x00, 0x06, 0x04, 0x04, 0x0E, 0x00 }, //
{ 0x0A, 0x00, 0x00, 0x06, 0x04, 0x04, 0x0E, 0x00 }, // ¡
{ 0x08, 0x04, 0x0E, 0x11, 0x11, 0x11, 0x0E, 0x00 }, // ¢
{ 0x02, 0x04, 0x0E, 0x11, 0x11, 0x11, 0x0E, 0x00 }, // £
{ 0x04, 0x0A, 0x0E, 0x11, 0x11, 0x11, 0x0E, 0x00 }, // ¤
{ 0x0A, 0x00, 0x0E, 0x11, 0x11, 0x11, 0x0E, 0x00 }, // ¥
{ 0x08, 0x04, 0x00, 0x0E, 0x11, 0x11, 0x0E, 0x00 }, // ¦
{ 0x02, 0x04, 0x00, 0x0E, 0x11, 0x11, 0x0E, 0x00 }, // §
{ 0x04, 0x0A, 0x00, 0x0E, 0x11, 0x11, 0x0E, 0x00 }, // ¨
{ 0x0A, 0x00, 0x00, 0x0E, 0x11, 0x11, 0x0E, 0x00 }, // ©
{ 0x08, 0x04, 0x11, 0x11, 0x11, 0x11, 0x0E, 0x00 }, // ª
{ 0x02, 0x04, 0x11, 0x11, 0x11, 0x11, 0x0E, 0x00 }, // «
{ 0x04, 0x0A, 0x00, 0x11, 0x11, 0x11, 0x0E, 0x00 }, // ¬
{ 0x0A, 0x00, 0x11, 0x11, 0x11, 0x11, 0x0E, 0x00 }, // ­
{ 0x08, 0x04, 0x11, 0x11, 0x11, 0x19, 0x16, 0x00 }, // ®
{ 0x02, 0x04, 0x11, 0x11, 0x11, 0x19, 0x16, 0x00 }, // ¯
{ 0x04, 0x0A, 0x00, 0x11, 0x11, 0x19, 0x16, 0x00 }, // °
{ 0x0A, 0x00, 0x11, 0x11, 0x11, 0x19, 0x16, 0x00 }, // ±
{ 0x0E, 0x11, 0x01, 0x11, 0x0E, 0x04, 0x07, 0x00 }, // ²
{ 0x00, 0x00, 0x0E, 0x01, 0x11, 0x0E, 0x07, 0x00 }, // ³
{ 0x14, 0x0A, 0x11, 0x13, 0x15, 0x19, 0x11, 0x00 }, // ´
{ 0x14, 0x0A, 0x00, 0x0D, 0x13, 0x11, 0x11, 0x00 }, // µ
{ 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00 }, // ¶
{ 0x01, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00 }, // ·
{ 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, // ¸
{ 0x04, 0x00, 0x04, 0x02, 0x01, 0x11, 0x0E, 0x00 }, // ¹
{ 0x04, 0x04, 0x00, 0x04, 0x04, 0x04, 0x04, 0x00 }, // º
{ 0x00, 0x00, 0x16, 0x09, 0x09, 0x09, 0x16, 0x00 }, // »
{ 0x0C, 0x12, 0x12, 0x0E, 0x12, 0x12, 0x0D, 0x00 }, // ¼
{ 0x00, 0x00, 0x12, 0x15, 0x08, 0x08, 0x08, 0x00 }, // ½
{ 0x00, 0x00, 0x00, 0x04, 0x0A, 0x11, 0x1F, 0x00 }, // ¾
{ 0x0C, 0x02, 0x04, 0x08, 0x1E, 0x11, 0x0E, 0x00 }, // ¿
{ 0x00, 0x00, 0x0E, 0x01, 0x0F, 0x01, 0x0E, 0x00 }, // À
{ 0x0C, 0x04, 0x04, 0x04, 0x04, 0x04, 0x0C, 0x00 }, // Á
{ 0x00, 0x02, 0x04, 0x08, 0x0C, 0x12, 0x11, 0x00 }, // Â
{ 0x00, 0x00, 0x09, 0x09, 0x09, 0x17, 0x01, 0x00 }, // Ã
{ 0x00, 0x00, 0x1F, 0x0A, 0x0A, 0x0A, 0x19, 0x00 }, // Ä
{ 0x00, 0x0C, 0x12, 0x12, 0x0E, 0x02, 0x01, 0x00 }, // Å
{ 0x1F, 0x02, 0x04, 0x08, 0x04, 0x02, 0x1F, 0x00 }, // Æ
{ 0x00, 0x00, 0x1E, 0x09, 0x09, 0x09, 0x06, 0x00 }, // Ç
{ 0x00, 0x00, 0x1E, 0x05, 0x04, 0x14, 0x08, 0x00 }, // È
{ 0x04, 0x04, 0x0E, 0x15, 0x0E, 0x04, 0x04, 0x00 }, // É
{ 0x0E, 0x11, 0x11, 0x11, 0x0A, 0x0A, 0x1B, 0x00 }, // Ê
{ 0x1F, 0x00, 0x11, 0x0A, 0x04, 0x0A, 0x11, 0x00 }, // Ë
{ 0x1F, 0x00, 0x11, 0x11, 0x1E, 0x10, 0x0E, 0x00 }, // Ì
{ 0x14, 0x08, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00 }, // Í
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00 }, // Î
{ 0x00, 0x08, 0x0C, 0x0E, 0x0C, 0x08, 0x00, 0x00 }, // Ï
{ 0x00, 0x00, 0x07, 0x07, 0x07, 0x00, 0x00, 0x00 }, // Ð
{ 0x08, 0x08, 0x08, 0x04, 0x02, 0x02, 0x02, 0x00 }, // Ñ
{ 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00 }, // Ò
{ 0x0E, 0x08, 0x0E, 0x02, 0x0E, 0x00, 0x00, 0x00 }, // Ó
{ 0x0E, 0x0A, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00 }, // Ô
{ 0x06, 0x08, 0x04, 0x08, 0x06, 0x00, 0x00, 0x00 }, // Õ
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, // Ö
{ 0x02, 0x00, 0x03, 0x02, 0x02, 0x0A, 0x04, 0x00 }, // ×
{ 0x04, 0x0A, 0x0F, 0x11, 0x0F, 0x01, 0x01, 0x00 }, // Ø
{ 0x01, 0x12, 0x0A, 0x04, 0x0A, 0x09, 0x10, 0x00 }, // Ù
{ 0x1F, 0x11, 0x05, 0x07, 0x05, 0x01, 0x01, 0x00 }, // Ú
{ 0x00, 0x00, 0x0E, 0x11, 0x0F, 0x01, 0x06, 0x00 }, // Û
{ 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x1C, 0x00 }, // Ü
{ 0x11, 0x13, 0x17, 0x1F, 0x1D, 0x19, 0x11, 0x00 }, // Ý
{ 0x05, 0x0A, 0x14, 0x14, 0x14, 0x0A, 0x05, 0x00 }, // Þ
{ 0x00, 0x02, 0x07, 0x0F, 0x07, 0x02, 0x00, 0x00 }, // ß
{ 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x00 }, // à
{ 0x1F, 0x1B, 0x11, 0x0A, 0x1B, 0x1B, 0x1B, 0x00 }, // á
{ 0x1F, 0x1B, 0x15, 0x11, 0x15, 0x15, 0x1F, 0x00 }, // â
{ 0x1F, 0x1B, 0x17, 0x13, 0x15, 0x13, 0x1F, 0x00 }, // ã
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00 }, // ä
{ 0x04, 0x0E, 0x15, 0x04, 0x04, 0x00, 0x1F, 0x00 }, // å
{ 0x04, 0x0A, 0x0E, 0x0A, 0x0A, 0x00, 0x1F, 0x00 }, // æ
{ 0x04, 0x08, 0x0C, 0x0A, 0x0C, 0x00, 0x1F, 0x00 }, // ç
{ 0x00, 0x00, 0x02, 0x04, 0x08, 0x10, 0x00, 0x00 }, // è
{ 0x03, 0x07, 0x0E, 0x1C, 0x18, 0x10, 0x00, 0x00 }, // é
{ 0x1F, 0x1E, 0x1C, 0x18, 0x10, 0x00, 0x00, 0x00 }, // ê
{ 0x00, 0x00, 0x01, 0x03, 0x07, 0x0F, 0x1F, 0x00 }, // ë
{ 0x00, 0x08, 0x14, 0x17, 0x14, 0x08, 0x00, 0x00 }, // ì
{ 0x00, 0x04, 0x0A, 0x0A, 0x0A, 0x04, 0x00, 0x00 }, // í
{ 0x00, 0x01, 0x00, 0x04, 0x00, 0x10, 0x00, 0x00 }, // î
{ 0x04, 0x0E, 0x1F, 0x0E, 0x0E, 0x0E, 0x00, 0x00 }, // ï
{ 0x00, 0x0E, 0x0E, 0x0E, 0x1F, 0x0E, 0x04, 0x00 }, // ð
{ 0x15, 0x0A, 0x15, 0x0A, 0x15, 0x0A, 0x15, 0x00 }, // ñ
{ 0x04, 0x1E, 0x05, 0x0E, 0x14, 0x0F, 0x04, 0x00 }, // ò
{ 0x04, 0x0E, 0x1F, 0x0E, 0x0E, 0x00, 0x00, 0x00 }, // ó
{ 0x06, 0x09, 0x09, 0x0D, 0x11, 0x11, 0x0D, 0x00 }, // ô
{ 0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x1F, 0x00 }, // õ
{ 0x00, 0x10, 0x18, 0x0C, 0x06, 0x03, 0x01, 0x00 }, // ö
{ 0x15, 0x00, 0x11, 0x00, 0x11, 0x00, 0x15, 0x00 }, // ÷
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, // ø
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, // ù
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, // ú
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, // û
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, // ü
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, // ý
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, // þ
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } // ÿ
};

View file

@ -6,6 +6,7 @@ extern "C" {
#include <stdint.h>
void memmove(void* dst, void* src, uint32_t size);
uint32_t strlen(const char* str);
int strcmp(const char* str1, const char* str2);
#ifdef __cplusplus
}
#endif

View file

@ -13,8 +13,8 @@ namespace MTGosHAL {
class BlockDevice;
class Task;
class VMM3;
enum class BG_color: uint16_t;
enum class FG_color: uint16_t;
enum class BG_color: uint32_t;
enum class FG_color: uint32_t;
extern Serial debug;
extern Screen out;
extern Screen err;

View file

@ -1,56 +1,58 @@
#ifndef _TEXTDISP_H
#define _TEXTDISP_H
#include <base.hpp>
#include <stdint.h>
#include <output.hpp>
#define SCREEN_WIDTH 80
#define SCREEN_HEIGHT 24
#include <multiboot.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 96
namespace MTGosHAL {
enum class BG_color : uint16_t {
BLACK=0x0000,
BLUE=0x1000,
GREEN=0x2000,
CYAN=0x3000,
RED=0x4000,
MAGENTA=0x5000,
BROWN=0x6000,
LIGHT_GREY=0x7000,
GREY=0x8000,
LIGHT_BLUE=0x9000,
LIGHT_GREEN=0xA000,
LIGHT_CYAN=0xB000,
LIGHT_RED=0xC000,
LIGHT_MAGENTA=0xD000,
YELLOW=0xE000,
WHITE=0xF000
enum class BG_color : uint32_t {
BLACK=0x000000,
BLUE=0x0000AA,
GREEN=0x00AA00,
CYAN=0x00AAAA,
RED=0xAA0000,
MAGENTA=0xAA00AA,
BROWN=0xAA5500,
LIGHT_GREY=0xAAAAAA,
GREY=0x555555,
LIGHT_BLUE=0x5555FF,
LIGHT_GREEN=0x55FF55,
LIGHT_CYAN=0x55FFFF,
LIGHT_RED=0xFF5555,
LIGHT_MAGENTA=0xFF55FF,
YELLOW=0xFFFF55,
WHITE=0xFFFFFF
};
enum class FG_color : uint16_t {
BLACK=0x000,
BLUE=0x100,
GREEN=0x200,
CYAN=0x300,
RED=0x400,
MAGENTA=0x500,
BROWN=0x600,
LIGHT_GREY=0x700,
GREY=0x800,
LIGHT_BLUE=0x900,
LIGHT_GREEN=0xA00,
LIGHT_CYAN=0xB00,
LIGHT_RED=0xC00,
LIGHT_MAGENTA=0xD00,
YELLOW=0xE00,
WHITE=0xF00
enum class FG_color : uint32_t {
BLACK=0x000000,
BLUE=0x0000AA,
GREEN=0x00AA00,
CYAN=0x00AAAA,
RED=0xAA0000,
MAGENTA=0xAA00AA,
BROWN=0xAA5500,
LIGHT_GREY=0xAAAAAA,
GREY=0x555555,
LIGHT_BLUE=0x5555FF,
LIGHT_GREEN=0x55FF55,
LIGHT_CYAN=0x55FFFF,
LIGHT_RED=0xFF5555,
LIGHT_MAGENTA=0xFF55FF,
YELLOW=0xFFFF55,
WHITE=0xFFFFFF
};
class Screen: public Output {
private:
FG_color fg;
BG_color bg;
uint16_t* vmem=(uint16_t*)0xB8000;
uint32_t* lfb;
auto putChar(char c) -> void;
public:
Screen(): fg(FG_color::WHITE), bg(BG_color::BLACK) {
clrscr();
}
auto init(struct multiboot_info*) -> void;
template <typename T>
auto operator<< (T output) -> Screen & {
Output::operator<<<T>(output);

View file

@ -23,6 +23,8 @@ namespace MTGosHAL {
BlockDevice disk;
VMM3 mm;
void main(int eax, struct multiboot_info* ebx) {
out.init(ebx);
err.init(ebx);
out << BG_color::BLACK << FG_color::WHITE << "Loading MTGos...\n";
err << BG_color::BLACK << FG_color::RED;
if(eax!=0x2BADB002)

View file

@ -5,7 +5,7 @@ namespace MTGosHAL {
return inb(port+SERIAL_LSR)&0x20;
}
auto Serial::putChar(char chr) -> void {
if(!works)
// if(!works)
return;
int tries=65535;
while(!isTransmitEmpty()) {

View file

@ -1,5 +1,7 @@
#include <base.hpp>
#include <textDISP.hpp>
#include <string.h>
#include <stdfnt.h>
int x=0, y=0;
namespace MTGosHAL {
auto Screen::putChar(char c) -> void {
@ -21,7 +23,16 @@ namespace MTGosHAL {
case '\0':
break;
default:
vmem[y*SCREEN_WIDTH+(x++)]=((uint16_t)fg) | ((uint16_t)bg) | ((uint8_t)c);
for(int lx=0;lx<8;lx++) {
for(int ly=0;ly<8;ly++) {
if(font[(int)((uint8_t)c)][ly]&(1<<lx)) {
lfb[(x*8+lx)+(y*8+ly)*1024]=0xFFFFFF;//static_cast<uint32_t>(fg);
} else {
lfb[(x*8+lx)+(y*8+ly)*1024]=0x000000;//static_cast<uint32_t>(bg);
}
}
}
x++;
if(x==SCREEN_WIDTH) {
x=0; y++;
}
@ -31,15 +42,22 @@ namespace MTGosHAL {
scroll();
}
auto Screen::clrscr() -> void {
for(int p=0; p<SCREEN_HEIGHT*SCREEN_WIDTH+SCREEN_WIDTH; p++)
vmem[p]=((uint16_t)fg) | ((uint16_t)bg) | ((uint16_t)' ');
for(int p=0;p<1024*786;p++) {
lfb[p]=0x000000;//static_cast<uint32_t>(bg);
}
x=y=0;
}
auto Screen::scroll() -> void {
for(int p=0; p<SCREEN_HEIGHT*SCREEN_WIDTH; p++)
vmem[p]=vmem[p+SCREEN_WIDTH];
for(int p=SCREEN_HEIGHT*SCREEN_WIDTH; p<(SCREEN_HEIGHT+1)*SCREEN_WIDTH; p++)
vmem[p]=((uint16_t)fg) | ((uint16_t)bg) | ((uint16_t)' ');
for(int ly=0;ly<786-8;ly++) {
for(int lx=0;lx<1024;lx++) {
lfb[lx+ly*1024]=lfb[lx+(ly+8)*1024];
}
}
for(int ly=786-8;ly<786;ly++) {
for(int lx=0;lx<1024;lx++) {
lfb[lx+ly*1024]=0x000000;//static_cast<uint32_t>(bg);
}
}
y--;
}
template <>
@ -63,4 +81,19 @@ namespace MTGosHAL {
auto Screen::setColor(FG_color fg, BG_color bg) -> Screen &{
return (*this).setColor(fg).setColor(bg);
}
auto Screen::init(struct multiboot_info* mb_info) -> void {
lfb=(uint32_t*)((uint32_t)mb_info->framebuffer_addr);
//clrscr();
//Render '\001' character
for(int tx=0;tx<16;tx++) {
for(int ty=0;ty<16;ty++) {
for(int x=0;x<8;x++) {
for(int y=0;y<8;y++) {
if(font[tx+ty*16][y]&(1<<x))
lfb[(x+tx*8)+(y+ty*8)*1024]=0xFFFFFF;
}
}
}
}
}
}

View file

@ -22,4 +22,17 @@ uint32_t strlen(const char* str) {
}
return i;
}
int strcmp(const char* str1, const char* str2) {
uint32_t len1=strlen(str1);
uint32_t len2=strlen(str2);
if(len1>len2)
return 1;
else if (len1<len2)
return -1;
for(int i=0;i<len1;i++) {
if(str1[i]!=str2[i])
return str1[i]-str2[i];
}
return 0;
}
#pragma GCC pop_options

View file

@ -2,40 +2,40 @@
#define _SYSCALL_HPP
#include <stdint.h>
enum class BGColor : uint32_t {
BLACK=0x0000,
BLUE=0x1000,
GREEN=0x2000,
CYAN=0x3000,
RED=0x4000,
MAGENTA=0x5000,
BROWN=0x6000,
LIGHT_GREY=0x7000,
GREY=0x8000,
LIGHT_BLUE=0x9000,
LIGHT_GREEN=0xA000,
LIGHT_CYAN=0xB000,
LIGHT_RED=0xC000,
LIGHT_MAGENTA=0xD000,
YELLOW=0xE000,
WHITE=0xF000
BLACK=0x000000,
BLUE=0x0000AA,
GREEN=0x00AA00,
CYAN=0x00AAAA,
RED=0xAA0000,
MAGENTA=0xAA00AA,
BROWN=0xAA5500,
LIGHT_GREY=0xAAAAAA,
GREY=0x555555,
LIGHT_BLUE=0x5555FF,
LIGHT_GREEN=0x55FF55,
LIGHT_CYAN=0x55FFFF,
LIGHT_RED=0xFF5555,
LIGHT_MAGENTA=0xFF55FF,
YELLOW=0xFFFF55,
WHITE=0xFFFFFF
};
enum class FGColor : uint32_t {
BLACK=0x000,
BLUE=0x100,
GREEN=0x200,
CYAN=0x300,
RED=0x400,
MAGENTA=0x500,
BROWN=0x600,
LIGHT_GREY=0x700,
GREY=0x800,
LIGHT_BLUE=0x900,
LIGHT_GREEN=0xA00,
LIGHT_CYAN=0xB00,
LIGHT_RED=0xC00,
LIGHT_MAGENTA=0xD00,
YELLOW=0xE00,
WHITE=0xF00
BLACK=0x000000,
BLUE=0x0000AA,
GREEN=0x00AA00,
CYAN=0x00AAAA,
RED=0xAA0000,
MAGENTA=0xAA00AA,
BROWN=0xAA5500,
LIGHT_GREY=0xAAAAAA,
GREY=0x555555,
LIGHT_BLUE=0x5555FF,
LIGHT_GREEN=0x55FF55,
LIGHT_CYAN=0x55FFFF,
LIGHT_RED=0xFF5555,
LIGHT_MAGENTA=0xFF55FF,
YELLOW=0xFFFF55,
WHITE=0xFFFFFF
};
class ScreenOut {
private:

BIN
std.fnt Normal file

Binary file not shown.

BIN
test.elf Executable file

Binary file not shown.

View file

@ -1,46 +1,47 @@
#include <stdint.h>
enum class BGColor : uint32_t {
BLACK=0x0000,
BLUE=0x1000,
GREEN=0x2000,
CYAN=0x3000,
RED=0x4000,
MAGENTA=0x5000,
BROWN=0x6000,
LIGHT_GREY=0x7000,
GREY=0x8000,
LIGHT_BLUE=0x9000,
LIGHT_GREEN=0xA000,
LIGHT_CYAN=0xB000,
LIGHT_RED=0xC000,
LIGHT_MAGENTA=0xD000,
YELLOW=0xE000,
WHITE=0xF000
BLACK=0x000000,
BLUE=0x0000AA,
GREEN=0x00AA00,
CYAN=0x00AAAA,
RED=0xAA0000,
MAGENTA=0xAA00AA,
BROWN=0xAA5500,
LIGHT_GREY=0xAAAAAA,
GREY=0x555555,
LIGHT_BLUE=0x5555FF,
LIGHT_GREEN=0x55FF55,
LIGHT_CYAN=0x55FFFF,
LIGHT_RED=0xFF5555,
LIGHT_MAGENTA=0xFF55FF,
YELLOW=0xFFFF55,
WHITE=0xFFFFFF
};
enum class FGColor : uint32_t {
BLACK=0x000,
BLUE=0x100,
GREEN=0x200,
CYAN=0x300,
RED=0x400,
MAGENTA=0x500,
BROWN=0x600,
LIGHT_GREY=0x700,
GREY=0x800,
LIGHT_BLUE=0x900,
LIGHT_GREEN=0xA00,
LIGHT_CYAN=0xB00,
LIGHT_RED=0xC00,
LIGHT_MAGENTA=0xD00,
YELLOW=0xE00,
WHITE=0xF00
BLACK=0x000000,
BLUE=0x0000AA,
GREEN=0x00AA00,
CYAN=0x00AAAA,
RED=0xAA0000,
MAGENTA=0xAA00AA,
BROWN=0xAA5500,
LIGHT_GREY=0xAAAAAA,
GREY=0x555555,
LIGHT_BLUE=0x5555FF,
LIGHT_GREEN=0x55FF55,
LIGHT_CYAN=0x55FFFF,
LIGHT_RED=0xFF5555,
LIGHT_MAGENTA=0xFF55FF,
YELLOW=0xFFFF55,
WHITE=0xFFFFFF
};
class ScreenOut {
private:
void* handle;
public:
ScreenOut(bool err);
auto operator <<(char*) -> ScreenOut &; // puts(char *)
auto operator <<(const char*) -> ScreenOut &; // puts(char *)
auto operator <<(int) -> ScreenOut &;
auto clrscr() -> ScreenOut &;
auto setColor(BGColor, FGColor) -> ScreenOut &;
~ScreenOut();

View file

@ -1,7 +1,7 @@
#include <mtgos.hpp>
extern "C" {
void * screenout_init(int err);
void * screenout_out(void* handle, char *str);
void * screenout_out(void* handle, const char *str);
void * screenout_clear(void* handle);
void * screenout_setcolor(void* handle, uint32_t BG, uint32_t FG);
void * screenout_destroy(void * handle);
@ -9,10 +9,23 @@ void * screenout_destroy(void * handle);
ScreenOut::ScreenOut(bool err) {
handle=screenout_init(err);
}
auto ScreenOut::operator<<(char * str) -> ScreenOut & {
auto ScreenOut::operator<<(const char * str) -> ScreenOut & {
screenout_out(handle, str);
return *this;
}
auto ScreenOut::operator<<(int output) -> ScreenOut & {
int base=10;
const char* chars="0123456789ABCDEF";
char buf[33];
buf[32]='\0';
char* ptr=buf+31;
do {
*(ptr--)=chars[output%base];
output/=base;
} while(output && (ptr!=buf));
*this << ptr+1;
return *this;
}
auto ScreenOut::clrscr() -> ScreenOut & {
screenout_clear(handle);
return *this;

View file

@ -12,6 +12,7 @@ void main()
ScreenOut out=ScreenOut(false);
int i;
out.setColor(BGColor::BLUE, FGColor::YELLOW);
for(;;)
for(;;) {
out << arr;
}
}