VDP implemented.
This commit is contained in:
132
font.h
Normal file
132
font.h
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
unsigned char char_map[2048] = {
|
||||||
|
0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
|
||||||
|
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0xFF, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0xFF,
|
||||||
|
0x03, 0x03, 0x03, 0x3F, 0x03, 0x03, 0x03, 0x00, 0xFF, 0x0F, 0x3F, 0x3F, 0x3F, 0x3F, 0x0F, 0xFF,
|
||||||
|
0x00, 0x01, 0x03, 0x03, 0x0F, 0x0F, 0x03, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0x03, 0x3F, 0x00,
|
||||||
|
0x00, 0x00, 0x03, 0x03, 0xFF, 0x03, 0x03, 0x00, 0x00, 0x00, 0x03, 0x03, 0xFF, 0x03, 0x03, 0x00,
|
||||||
|
0x03, 0x03, 0x03, 0x03, 0x3F, 0x3F, 0x0F, 0x03, 0x03, 0x0F, 0x3F, 0x3F, 0x03, 0x03, 0x03, 0x03,
|
||||||
|
0x03, 0x0F, 0x0F, 0x0F, 0x3F, 0x3F, 0x0F, 0x03, 0x00, 0x03, 0x0F, 0x0F, 0x7F, 0x03, 0x03, 0x00,
|
||||||
|
0x0F, 0x0F, 0xFF, 0x3F, 0x3F, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x3F, 0x3F, 0x0F, 0x0F, 0x0F,
|
||||||
|
0xFF, 0x0F, 0x0F, 0xFF, 0x0F, 0x0F, 0x0F, 0xFF, 0x0F, 0x3F, 0x3F, 0x3F, 0x7F, 0x0F, 0x0F, 0x0F,
|
||||||
|
0x0F, 0x0F, 0x0F, 0x7F, 0x3F, 0x3F, 0x3F, 0x0F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,
|
||||||
|
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00,
|
||||||
|
0x00, 0x0F, 0x0F, 0xFF, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x03, 0x03, 0x3F, 0x03, 0x03, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x01, 0x00,
|
||||||
|
0x1F, 0x0F, 0x1F, 0x1F, 0x1F, 0x0F, 0x1F, 0x00, 0x03, 0x07, 0x03, 0x03, 0x03, 0x03, 0x3F, 0x00,
|
||||||
|
0x0F, 0x0F, 0x03, 0x0F, 0x03, 0x0F, 0x3F, 0x00, 0x0F, 0x0F, 0x03, 0x07, 0x03, 0x0F, 0x0F, 0x00,
|
||||||
|
0x07, 0x0F, 0x0F, 0x0F, 0x7F, 0x03, 0x0F, 0x00, 0x3F, 0x07, 0x03, 0x1F, 0x03, 0x0F, 0x0F, 0x00,
|
||||||
|
0x0F, 0x0F, 0x03, 0x1F, 0x0F, 0x0F, 0x0F, 0x00, 0x3F, 0x0F, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00,
|
||||||
|
0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x0F, 0x0F, 0x0F, 0x1F, 0x03, 0x0F, 0x0F, 0x00,
|
||||||
|
0x00, 0x00, 0x03, 0x03, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x03, 0x03, 0x03,
|
||||||
|
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x3F, 0x00, 0x00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x1F, 0x00, 0x0F, 0x0F, 0x03, 0x0F, 0x03, 0x0F, 0x0F, 0x00,
|
||||||
|
0x3F, 0x0F, 0x03, 0x03, 0x03, 0x03, 0x0F, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x00,
|
||||||
|
0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x03, 0x00, 0x0F, 0x0F, 0x0F, 0x1F, 0x7F, 0x3F, 0x0F, 0x00,
|
||||||
|
0x0F, 0x0F, 0x07, 0x07, 0x0F, 0x0F, 0x0F, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x03, 0x03, 0x0F, 0x00,
|
||||||
|
0x7F, 0x0F, 0x07, 0x03, 0x07, 0x0F, 0x7F, 0x00, 0x0F, 0x03, 0x03, 0x03, 0x03, 0x03, 0x0F, 0x00,
|
||||||
|
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x01, 0x00, 0x0F, 0x03, 0x03, 0x03, 0x03, 0x03, 0x0F, 0x00,
|
||||||
|
0x03, 0x0F, 0x3F, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
|
||||||
|
0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x03, 0x1F, 0x0F, 0x1F, 0x00,
|
||||||
|
0x07, 0x03, 0x1F, 0x0F, 0x0F, 0x0F, 0x1F, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x03, 0x0F, 0x0F, 0x00,
|
||||||
|
0x07, 0x03, 0x1F, 0x0F, 0x0F, 0x0F, 0x1F, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x3F, 0x03, 0x0F, 0x00,
|
||||||
|
0x07, 0x0F, 0x03, 0x0F, 0x03, 0x03, 0x0F, 0x00, 0x00, 0x00, 0x1F, 0x0F, 0x0F, 0x1F, 0x03, 0x1F,
|
||||||
|
0x07, 0x03, 0x0F, 0x1F, 0x0F, 0x0F, 0x1F, 0x00, 0x03, 0x00, 0x07, 0x03, 0x03, 0x03, 0x0F, 0x00,
|
||||||
|
0x03, 0x00, 0x07, 0x03, 0x03, 0x0F, 0x0F, 0x0F, 0x07, 0x03, 0x0F, 0x0F, 0x0F, 0x0F, 0x1F, 0x00,
|
||||||
|
0x07, 0x03, 0x03, 0x03, 0x03, 0x03, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x7F, 0x1F, 0x1F, 0x0F, 0x00,
|
||||||
|
0x00, 0x00, 0x1F, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x00,
|
||||||
|
0x00, 0x00, 0x1F, 0x0F, 0x0F, 0x1F, 0x03, 0x0F, 0x00, 0x00, 0x1F, 0x0F, 0x0F, 0x1F, 0x03, 0x0F,
|
||||||
|
0x00, 0x00, 0x1F, 0x1F, 0x03, 0x03, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x03, 0x0F, 0x03, 0x1F, 0x00,
|
||||||
|
0x03, 0x03, 0x1F, 0x03, 0x03, 0x0F, 0x07, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x1F, 0x00,
|
||||||
|
0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x03, 0x00, 0x00, 0x00, 0x0F, 0x1F, 0x1F, 0x7F, 0x0F, 0x00,
|
||||||
|
0x00, 0x00, 0x0F, 0x0F, 0x07, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x1F, 0x03, 0x1F,
|
||||||
|
0x00, 0x00, 0x3F, 0x07, 0x03, 0x07, 0x3F, 0x00, 0x07, 0x03, 0x03, 0x07, 0x03, 0x03, 0x07, 0x00,
|
||||||
|
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x07, 0x03, 0x03, 0x07, 0x03, 0x03, 0x07, 0x00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x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x1F, 0x0F, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
|
||||||
|
0x00, 0x00, 0x00, 0x0F, 0x1F, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x1F, 0x1F, 0x03, 0x03, 0x03,
|
||||||
|
0x00, 0x00, 0x00, 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x1F, 0x0F, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0xFF, 0xFF, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x0F, 0x1F, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x1F, 0x1F, 0x03, 0x03, 0x03,
|
||||||
|
0x00, 0x00, 0x00, 0xFF, 0xFF, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0xFF, 0xFF, 0x03, 0x03, 0x03,
|
||||||
|
0x01, 0x07, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x0F, 0x1F, 0x1F, 0x0F, 0x00,
|
||||||
|
0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x03, 0x07, 0x3F, 0x03, 0x03, 0x07, 0x00,
|
||||||
|
0x07, 0x03, 0x1F, 0x07, 0x1F, 0x03, 0x07, 0x00, 0x3F, 0x1F, 0x1F, 0x0F, 0x07, 0x07, 0x07, 0x00,
|
||||||
|
0x0F, 0x03, 0x07, 0x0F, 0x07, 0x03, 0x0F, 0x00, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x01, 0x03, 0x03, 0x07, 0x07, 0x0F, 0x01, 0x00, 0x01, 0x03, 0x07, 0x07, 0x03, 0x01, 0x0F, 0x00,
|
||||||
|
0x07, 0x01, 0x07, 0x07, 0x1F, 0x0F, 0x01, 0x00, 0x07, 0x07, 0x00, 0x1F, 0x0F, 0x0F, 0x0F, 0x00,
|
||||||
|
0x03, 0x03, 0x00, 0x3F, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x03, 0x03, 0x00, 0x00,
|
||||||
|
0x03, 0x00, 0x03, 0x03, 0x0F, 0x0F, 0x0F, 0x00, 0x03, 0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00,
|
||||||
|
0x00, 0x00, 0x1F, 0x3F, 0x0F, 0x3F, 0x1F, 0x00, 0x1F, 0x0F, 0x0F, 0x3F, 0x0F, 0x0F, 0x1F, 0x03,
|
||||||
|
0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x0F, 0x03, 0x03, 0x0F, 0x0F, 0x0F, 0x0F, 0x00,
|
||||||
|
0x00, 0x00, 0x0F, 0x03, 0x1F, 0x03, 0x0F, 0x00, 0x07, 0x0F, 0x0F, 0x7F, 0x0F, 0x0F, 0x07, 0x00,
|
||||||
|
0x00, 0x03, 0x03, 0x03, 0x07, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x1F, 0x03, 0x03,
|
||||||
|
0x00, 0x00, 0x00, 0x7F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x0F, 0x0F, 0x07, 0x00,
|
||||||
|
0x03, 0x03, 0x03, 0x0F, 0x0F, 0x0F, 0x03, 0x03, 0x03, 0x03, 0x03, 0x0F, 0x0F, 0x0F, 0x03, 0x03,
|
||||||
|
0x00, 0x1F, 0x0F, 0x03, 0x07, 0x0F, 0x1F, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x3F, 0x3F, 0x3F, 0x00,
|
||||||
|
0x7F, 0x0F, 0x03, 0x03, 0x03, 0x0F, 0x7F, 0x00, 0x00, 0x1F, 0x0F, 0x0F, 0x0F, 0x0F, 0x3F, 0x00,
|
||||||
|
0x03, 0x03, 0x03, 0x03, 0x01, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x01, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, 0x03,
|
||||||
|
0x03, 0x0F, 0x0F, 0x0F, 0x03, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
|
||||||
|
0x00, 0x00, 0x00, 0x03, 0x0F, 0x0F, 0x0F, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
|
||||||
|
0x03, 0x03, 0x03, 0x07, 0x07, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x07, 0x07, 0x03, 0x03, 0x03,
|
||||||
|
0x03, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x03, 0x0F, 0x3F, 0x3F, 0x0F, 0x0F, 0x3F, 0x3F, 0x0F,
|
||||||
|
0x03, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x03, 0x03, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x03,
|
||||||
|
0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
|
||||||
|
0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
|
||||||
|
0xFF, 0x7F, 0x3F, 0x1F, 0x0F, 0x07, 0x03, 0x01, 0xFF, 0x7F, 0x3F, 0x1F, 0x0F, 0x07, 0x03, 0x01,
|
||||||
|
0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF, 0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF,
|
||||||
|
0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
|
||||||
|
0x0F, 0x07, 0x07, 0x03, 0x03, 0x01, 0x01, 0x00, 0x0F, 0x0F, 0x07, 0x07, 0x03, 0x03, 0x01, 0x01,
|
||||||
|
0x01, 0x01, 0x03, 0x03, 0x07, 0x07, 0x0F, 0x0F, 0x00, 0x01, 0x01, 0x03, 0x03, 0x07, 0x07, 0x0F,
|
||||||
|
0x3F, 0xFF, 0x0F, 0xFF, 0x3F, 0x0F, 0xFF, 0x3F, 0x3F, 0xFF, 0x0F, 0xFF, 0x0F, 0x3F, 0xFF, 0x3F,
|
||||||
|
0x07, 0x07, 0x7F, 0x7F, 0x7F, 0x01, 0x07, 0x00, 0x01, 0x07, 0x1F, 0x7F, 0x1F, 0x07, 0x01, 0x00,
|
||||||
|
0x0F, 0x7F, 0x7F, 0x7F, 0x1F, 0x07, 0x01, 0x00, 0x01, 0x07, 0x1F, 0x7F, 0x7F, 0x01, 0x07, 0x00,
|
||||||
|
0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x0F, 0x3F, 0xFF, 0xFF, 0x3F, 0x0F, 0x00,
|
||||||
|
0x00, 0x3F, 0x0F, 0x0F, 0x0F, 0x0F, 0x3F, 0x00, 0x00, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x00,
|
||||||
|
0x0F, 0x07, 0x07, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x03, 0x3F, 0x03,
|
||||||
|
0x03, 0x03, 0x03, 0x03, 0x03, 0x0F, 0x1F, 0x07, 0x03, 0x07, 0x0F, 0x0F, 0x03, 0x0F, 0x1F, 0x07,
|
||||||
|
0x0F, 0x0F, 0x03, 0x0F, 0x0F, 0x03, 0x0F, 0x0F, 0x01, 0x07, 0x07, 0x07, 0x07, 0x07, 0x1F, 0x1F,
|
||||||
|
0x03, 0x0F, 0x3F, 0xFF, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0xFF, 0x3F, 0x0F, 0x03,
|
||||||
|
0x01, 0x03, 0x07, 0xFF, 0xFF, 0x07, 0x03, 0x01, 0x01, 0x03, 0x07, 0xFF, 0xFF, 0x07, 0x03, 0x01,
|
||||||
|
0x00, 0x00, 0x03, 0x0F, 0x3F, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x3F, 0x0F, 0x03, 0x00,
|
||||||
|
0x01, 0x07, 0x1F, 0x7F, 0x1F, 0x07, 0x01, 0x00, 0x01, 0x07, 0x1F, 0x7F, 0x1F, 0x07, 0x01, 0x00,
|
||||||
|
0x07, 0x07, 0x07, 0x1F, 0x01, 0x03, 0x03, 0x03, 0x07, 0x07, 0x01, 0x7F, 0x01, 0x03, 0x03, 0x03,
|
||||||
|
0x07, 0x07, 0x03, 0x1F, 0x03, 0x03, 0x03, 0x03, 0x07, 0x07, 0x03, 0x1F, 0x03, 0x03, 0x03, 0x03,
|
||||||
|
0x00, 0x0F, 0x03, 0x0F, 0x0F, 0x0F, 0x03, 0x00, 0x0F, 0xFF, 0xFF, 0x03, 0x03, 0x03, 0x03, 0x03,
|
||||||
|
0x03, 0x0F, 0x3F, 0x03, 0x03, 0x3F, 0x0F, 0x03, 0x00, 0x03, 0x0F, 0xFF, 0x0F, 0x03, 0x00, 0x00
|
||||||
|
};
|
||||||
27
main.cpp
27
main.cpp
@@ -1,10 +1,35 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "vm.h"
|
#include "vm.h"
|
||||||
|
#include "vdp.h"
|
||||||
|
#include <SDL.h>
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
|
|
||||||
vm_init("test.bin");
|
vm_init("test.bin");
|
||||||
vm_step();
|
vdp_init();
|
||||||
|
vm_register_out_port(10, vdp_data_out);
|
||||||
|
vm_register_out_port(11, vdp_cmd_out);
|
||||||
|
|
||||||
|
static bool should_quit = false;
|
||||||
|
static SDL_Event sdlEvent;
|
||||||
|
SDL_Scancode just_pressed;
|
||||||
|
|
||||||
|
while (!should_quit) {
|
||||||
|
just_pressed = SDL_SCANCODE_UNKNOWN;
|
||||||
|
while (SDL_PollEvent(&sdlEvent)) {
|
||||||
|
if (sdlEvent.type == SDL_QUIT) { should_quit = true; break; }
|
||||||
|
else if (sdlEvent.type == SDL_KEYDOWN) {
|
||||||
|
//anyKey = true;
|
||||||
|
just_pressed = sdlEvent.key.keysym.scancode;
|
||||||
|
if (sdlEvent.key.keysym.scancode == SDL_SCANCODE_ESCAPE) { should_quit = true; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vm_step();
|
||||||
|
}
|
||||||
|
|
||||||
|
vdp_quit();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -26,7 +26,7 @@ const unsigned char stack_pop(t_stack& stack) {
|
|||||||
if (!stack_isempty(stack)) {
|
if (!stack_isempty(stack)) {
|
||||||
return stack.data[stack.top--];
|
return stack.data[stack.top--];
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const unsigned char stack_peek(t_stack& stack) {
|
const unsigned char stack_peek(t_stack& stack) {
|
||||||
|
|||||||
@@ -41,6 +41,8 @@
|
|||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<IncludePath>C:\dev\lib\sdl2\include;$(IncludePath)</IncludePath>
|
||||||
|
<LibraryPath>C:\dev\lib\sdl2\lib\x86;$(LibraryPath)</LibraryPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
@@ -54,8 +56,9 @@
|
|||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>SDL2.lib;SDL2main.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
@@ -78,10 +81,14 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="main.cpp" />
|
<ClCompile Include="main.cpp" />
|
||||||
<ClCompile Include="stack.cpp" />
|
<ClCompile Include="stack.cpp" />
|
||||||
|
<ClCompile Include="vdp.cpp" />
|
||||||
<ClCompile Include="vm.cpp" />
|
<ClCompile Include="vm.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClInclude Include="font.h" />
|
||||||
<ClInclude Include="stack.h" />
|
<ClInclude Include="stack.h" />
|
||||||
|
<ClInclude Include="stb_image.h" />
|
||||||
|
<ClInclude Include="vdp.h" />
|
||||||
<ClInclude Include="vm.h" />
|
<ClInclude Include="vm.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
|||||||
@@ -24,6 +24,9 @@
|
|||||||
<ClCompile Include="vm.cpp">
|
<ClCompile Include="vm.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="vdp.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="vm.h">
|
<ClInclude Include="vm.h">
|
||||||
@@ -32,5 +35,14 @@
|
|||||||
<ClInclude Include="stack.h">
|
<ClInclude Include="stack.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="stb_image.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="vdp.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="font.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
187
vdp.cpp
Normal file
187
vdp.cpp
Normal file
@@ -0,0 +1,187 @@
|
|||||||
|
#include <SDL.h>
|
||||||
|
//#define STB_IMAGE_IMPLEMENTATION
|
||||||
|
//#include "stb_image.h"
|
||||||
|
#include <string.h>
|
||||||
|
#include "font.h"
|
||||||
|
|
||||||
|
#define VDP_CMD_LOCATE 0
|
||||||
|
#define VDP_CMD_PRINT 1
|
||||||
|
#define VDP_CMD_PUTCHAR 2
|
||||||
|
#define VDP_CMD_SETCHAR 3
|
||||||
|
#define VDP_CMD_PUTSPRITE 4
|
||||||
|
#define VDP_CMD_SETSPRITE 5
|
||||||
|
#define VDP_CMD_FLIP 6
|
||||||
|
#define VDP_CMD_COLOR 7
|
||||||
|
#define VDP_CMD_BORDER 8
|
||||||
|
|
||||||
|
SDL_Window* sdlWindow = NULL;
|
||||||
|
SDL_Renderer* sdlRenderer = NULL;
|
||||||
|
SDL_Texture* sdlTexture = NULL;
|
||||||
|
SDL_Rect src, dst;
|
||||||
|
const Uint8* keys = nullptr;
|
||||||
|
Uint8 just_pressed = SDL_SCANCODE_UNKNOWN;
|
||||||
|
|
||||||
|
Uint8 screen_map[16 * 12];
|
||||||
|
Uint8 screen_color[16 * 12];
|
||||||
|
//Uint8 char_map[256 * 8];
|
||||||
|
Uint8 screen_buffer[128 * 96 * 4];
|
||||||
|
static Uint8 cursor_x = 0;
|
||||||
|
static Uint8 cursor_y = 0;
|
||||||
|
|
||||||
|
static Uint8 color = 0x24;
|
||||||
|
static Uint8 border = 0x02;
|
||||||
|
static Uint8 data_stack[256];
|
||||||
|
static int data_stack_pos = 0;
|
||||||
|
|
||||||
|
static Uint8 palette[16][4] = {
|
||||||
|
{ 255, 0, 0, 255 },
|
||||||
|
{ 255, 0, 255, 0 },
|
||||||
|
{ 255, 255, 0, 0 },
|
||||||
|
{ 255, 255, 0, 255 },
|
||||||
|
{ 255, 0, 255, 255 },
|
||||||
|
{ 255, 255, 255, 0 },
|
||||||
|
{ 255, 255, 255, 255 },
|
||||||
|
{ 255, 0, 0, 0 },
|
||||||
|
{ 255, 0, 0, 128 },
|
||||||
|
{ 255, 0, 128, 0 },
|
||||||
|
{ 255, 128, 0, 0 },
|
||||||
|
{ 255, 128, 0, 128 },
|
||||||
|
{ 255, 0, 128, 128 },
|
||||||
|
{ 255, 128, 128, 0 },
|
||||||
|
{ 255, 128, 128, 128 },
|
||||||
|
{ 255, 0, 0, 0 },
|
||||||
|
};
|
||||||
|
|
||||||
|
void vdp_init() {
|
||||||
|
SDL_Init(SDL_INIT_EVERYTHING);
|
||||||
|
sdlWindow = SDL_CreateWindow("PaCo", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 608, 480, SDL_WINDOW_SHOWN);
|
||||||
|
sdlRenderer = SDL_CreateRenderer(sdlWindow, -1, SDL_RENDERER_PRESENTVSYNC);
|
||||||
|
//SDL_SetRenderDrawBlendMode(sdlRenderer, SDL_BLENDMODE_BLEND);
|
||||||
|
SDL_RenderSetLogicalSize(sdlRenderer, 152, 120);
|
||||||
|
|
||||||
|
//jtexture texture = (jtexture)malloc(sizeof(jtexture_t));
|
||||||
|
//FILE* f = fopen("font.png", "rb");
|
||||||
|
//if (!f) { error = 2; return; }
|
||||||
|
//int c;
|
||||||
|
//int size = 128;
|
||||||
|
//Uint8* buffer = stbi_load_from_file(f, &size, &size, &c, 4);
|
||||||
|
sdlTexture = SDL_CreateTexture(sdlRenderer, SDL_PIXELFORMAT_ABGR8888, SDL_TEXTUREACCESS_STATIC, 128, 128);
|
||||||
|
//SDL_UpdateTexture(sdlTexture, NULL, buffer, 128 * sizeof(Uint32));
|
||||||
|
//SDL_SetTextureBlendMode(sdlTexture, SDL_BLENDMODE_BLEND);
|
||||||
|
//stbi_image_free(buffer);
|
||||||
|
//fclose(f);
|
||||||
|
|
||||||
|
src.x = src.y = 0;
|
||||||
|
dst.x = dst.y = 12;
|
||||||
|
src.w = dst.w = 128;
|
||||||
|
src.h = dst.h = 96;
|
||||||
|
}
|
||||||
|
|
||||||
|
void vdp_quit() {
|
||||||
|
SDL_DestroyTexture(sdlTexture);
|
||||||
|
SDL_DestroyRenderer(sdlRenderer);
|
||||||
|
SDL_DestroyWindow(sdlWindow);
|
||||||
|
SDL_Quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void flip() {
|
||||||
|
Uint8* sb = screen_buffer;
|
||||||
|
Uint8* sm = screen_map;
|
||||||
|
Uint8* sc = screen_color;
|
||||||
|
for (int y = 0; y < 12; y++) {
|
||||||
|
for (int x = 0; x < 16; x++) {
|
||||||
|
Uint8* cm = &char_map[*sm << 3];
|
||||||
|
Uint8* sbt = sb;
|
||||||
|
for (int l = 0; l < 8; l++) {
|
||||||
|
if (*cm & 128) memcpy(sbt, palette[*sc & 0x0F], 4); else memcpy(sbt, palette[*sc >> 4], 4); sbt += 4;
|
||||||
|
if (*cm & 64) memcpy(sbt, palette[*sc & 0x0F], 4); else memcpy(sbt, palette[*sc >> 4], 4); sbt += 4;
|
||||||
|
if (*cm & 32) memcpy(sbt, palette[*sc & 0x0F], 4); else memcpy(sbt, palette[*sc >> 4], 4); sbt += 4;
|
||||||
|
if (*cm & 16) memcpy(sbt, palette[*sc & 0x0F], 4); else memcpy(sbt, palette[*sc >> 4], 4); sbt += 4;
|
||||||
|
if (*cm & 8) memcpy(sbt, palette[*sc & 0x0F], 4); else memcpy(sbt, palette[*sc >> 4], 4); sbt += 4;
|
||||||
|
if (*cm & 4) memcpy(sbt, palette[*sc & 0x0F], 4); else memcpy(sbt, palette[*sc >> 4], 4); sbt += 4;
|
||||||
|
if (*cm & 2) memcpy(sbt, palette[*sc & 0x0F], 4); else memcpy(sbt, palette[*sc >> 4], 4); sbt += 4;
|
||||||
|
if (*cm & 1) memcpy(sbt, palette[*sc & 0x0F], 4); else memcpy(sbt, palette[*sc >> 4], 4); sbt += 512;
|
||||||
|
cm++;
|
||||||
|
}
|
||||||
|
sm++; sc++; sb += 32;
|
||||||
|
}
|
||||||
|
sb += 3584;
|
||||||
|
}
|
||||||
|
SDL_UpdateTexture(sdlTexture, NULL, screen_buffer, 128 * sizeof(Uint32));
|
||||||
|
SDL_RenderCopy(sdlRenderer, sdlTexture, &src, &dst);
|
||||||
|
SDL_RenderPresent(sdlRenderer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void vdp_data_out(const unsigned char& value) {
|
||||||
|
data_stack[data_stack_pos++] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void vdp_cmd_out(const unsigned char& value) {
|
||||||
|
Uint8 n;
|
||||||
|
switch (value) {
|
||||||
|
case VDP_CMD_LOCATE:
|
||||||
|
cursor_y = data_stack[--data_stack_pos]; cursor_x = data_stack[--data_stack_pos]; break;
|
||||||
|
case VDP_CMD_PRINT:
|
||||||
|
for (int i = 0; i < data_stack_pos; i++) {
|
||||||
|
screen_map[cursor_x + (cursor_y << 7)] = data_stack[i];
|
||||||
|
screen_color[cursor_x + (cursor_y << 7)] = color;
|
||||||
|
cursor_x++; if (cursor_x == 16) { cursor_x = 0; cursor_y++; }
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case VDP_CMD_PUTCHAR:
|
||||||
|
cursor_x = data_stack[data_stack_pos - 4];
|
||||||
|
cursor_y = data_stack[data_stack_pos - 3];
|
||||||
|
screen_map[cursor_x + (cursor_y << 7)] = data_stack[data_stack_pos-2];
|
||||||
|
screen_color[cursor_x + (cursor_y << 7)] = data_stack[data_stack_pos - 1];
|
||||||
|
break;
|
||||||
|
case VDP_CMD_SETCHAR:
|
||||||
|
n = data_stack[data_stack_pos - 9];
|
||||||
|
char_map[(n << 3)] = data_stack[data_stack_pos - 8];
|
||||||
|
char_map[(n << 3) + 1] = data_stack[data_stack_pos - 7];
|
||||||
|
char_map[(n << 3) + 2] = data_stack[data_stack_pos - 6];
|
||||||
|
char_map[(n << 3) + 3] = data_stack[data_stack_pos - 5];
|
||||||
|
char_map[(n << 3) + 4] = data_stack[data_stack_pos - 4];
|
||||||
|
char_map[(n << 3) + 5] = data_stack[data_stack_pos - 3];
|
||||||
|
char_map[(n << 3) + 6] = data_stack[data_stack_pos - 2];
|
||||||
|
char_map[(n << 3) + 7] = data_stack[data_stack_pos - 1];
|
||||||
|
break;
|
||||||
|
case VDP_CMD_PUTSPRITE:
|
||||||
|
break;
|
||||||
|
case VDP_CMD_SETSPRITE:
|
||||||
|
break;
|
||||||
|
case VDP_CMD_FLIP:
|
||||||
|
flip(); break;
|
||||||
|
case VDP_CMD_COLOR:
|
||||||
|
color = data_stack[0];
|
||||||
|
break;
|
||||||
|
case VDP_CMD_BORDER:
|
||||||
|
border = data_stack[0];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
data_stack_pos = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char vdp_in() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*int main(int argc, char* argv[]) {
|
||||||
|
static bool should_quit = false;
|
||||||
|
static SDL_Event sdlEvent;
|
||||||
|
|
||||||
|
while (!should_quit) {
|
||||||
|
just_pressed = SDL_SCANCODE_UNKNOWN;
|
||||||
|
while (SDL_PollEvent(&sdlEvent)) {
|
||||||
|
if (sdlEvent.type == SDL_QUIT) { should_quit = true; break; }
|
||||||
|
else if (sdlEvent.type == SDL_KEYDOWN) {
|
||||||
|
//anyKey = true;
|
||||||
|
just_pressed = sdlEvent.key.keysym.scancode;
|
||||||
|
if (sdlEvent.key.keysym.scancode == SDL_SCANCODE_ESCAPE) { should_quit = true; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//if (!should_quit) should_quit = currentLoop();
|
||||||
|
}
|
||||||
|
|
||||||
|
vbm_quit();
|
||||||
|
return 0;
|
||||||
|
}*/
|
||||||
Reference in New Issue
Block a user