diff --git a/Makefile b/Makefile index dc9ff32..e9b37a9 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,7 @@ SRC = \ src/printf.c \ src/lfsr.c \ src/matrix.c \ + src/mmap.c \ src/flipflap.c \ \ diff --git a/src/main.c b/src/main.c index 890f7e8..844d9a7 100644 --- a/src/main.c +++ b/src/main.c @@ -6,6 +6,7 @@ #include "io.h" #include "lfsr.h" #include "matrix.h" +#include "mmap.h" #include "printf.h" #include "video.h" @@ -44,7 +45,7 @@ const uint8_t FVB[15 * 8] = { }; int main(void) { - io_out(0x81, io_in(0x81) & ~0x01); + mmap_set(MMAP_MODE_CEDA_VIDEO); for (;;) { cursor_enable(false); @@ -96,7 +97,4 @@ int main(void) { crt_waitFrames(250); } - - io_out(0x81, io_in(0x81) | 0x01); - return 0; } diff --git a/src/video.c b/src/video.c index f5e893c..83b910d 100644 --- a/src/video.c +++ b/src/video.c @@ -1,6 +1,7 @@ #include "video.h" #include "io.h" +#include "mmap.h" #include @@ -29,9 +30,9 @@ void video_putchar(char c) { } if (hstretch) { - io_out(0x81, io_in(0x81) | 0x80); + mmap_set(MMAP_MODE_CEDA_ATTR); *(VIDEO_MEMORY + offset) |= 0x08; - io_out(0x81, io_in(0x81) & ~0x80); + mmap_set(MMAP_MODE_CEDA_VIDEO); } if (c == '\t') { @@ -44,12 +45,12 @@ void video_putchar(char c) { if (vstretch) { *(VIDEO_MEMORY + offset + 80) = c; - io_out(0x81, io_in(0x81) | 0x80); + mmap_set(MMAP_MODE_CEDA_ATTR); *(VIDEO_MEMORY + offset) |= 0x60; *(VIDEO_MEMORY + offset + 80) |= 0x70; if (hstretch) *(VIDEO_MEMORY + offset + 80) |= 0x08; - io_out(0x81, io_in(0x81) & ~0x80); + mmap_set(MMAP_MODE_CEDA_VIDEO); } ++offset;