From 5f698eea8594ab603ca4a438819b8e17d96a85fc Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Wed, 25 Nov 2015 18:27:16 +0000 Subject: Add misc files --- misc/io.txt | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 misc/io.txt (limited to 'misc/io.txt') diff --git a/misc/io.txt b/misc/io.txt new file mode 100644 index 0000000..4090b65 --- /dev/null +++ b/misc/io.txt @@ -0,0 +1,47 @@ +I/O Spec + +As of now, there is no standard I/O spec for the DCPU. All we know +for sure is a basic idea of how the assembly will work, but Notch +will be able to add things as 0x10c is developed. That means for +right now, we're basically just guessing on how the display and +input will work. On this page, I will document the current I/O spec +we are conforming to, so you don't have to figure it out yourself. +All of this is subject to change and break old code, so don't get +too attached to one piece of software. Display + +The display is that weird little grey box you see the the right of +your code. How do you write stuff to it? + +It is 32 columns by 16 rows, and the memory is mapped from address +0x8000 to 0x81ff. 0x8000 is the top left cell, 0x8001 is the next +one over, and 0x8020 is first cell of the second row. When you write +to one of these cells, you do it in the following bit format: HRGB +HRGB B CCCCCCC where the first set of HRGB is the color of the text, +the next HRGB is the color of the background (with H being 'highlight', +making the colors brighter), B is whether or not to blink the cell, +and C is the ASCII character value. + +Input + +You can also get keyboard input. The system may seem confusing at +first, but once you get the hang of it, you will be able to make +some sweet games, or maybe a text editor. + +The input buffer is at the address range from 0x9000 to 0x900f. It +is a cyclic buffer, meaning that each time a key is hit, it is saved +in the next address over (and if it gets to 0x900f, it resets back +to 0x9000). If you read a value from there, it is important that +you set the buffer to 0 after you are done. If the buffer still has +something in it, the program won't be able to save new keypresses. +Don't want to have to loop through this buffer to find the last +key? There is a pointer at 0x9010 that stores the address of the +last key the program stored. + +The future + +We will certainly be adding more I/O as Notch announces it, or as +we figure it out. For instance, disk storage will be here shortly. +Also, by the time the real game comes out, we will know how to +control the systems of your ship (weapons, engines, communication, +etc.). Until then, work with what you have, and show us something +awesome! -- cgit v1.2.3