aboutsummaryrefslogtreecommitdiff
path: root/misc/io.txt
blob: 4090b65fc1e9d5e61723f3dd128338b95921fbdd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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!