You will not often need to make use of the Input/Output ports on the Notepad, but all the details you need are here for when you do, including mapping the video RAM into the core 64K of RAM, determining the battery and memory card status, communications configuration and so on.
Port | Description | Port | Description |
&00 | Start address of Display Memory | &10-&13 | Memory Management Control |
&20 | Memory Card Wait State Control | &30 | Baud Rate |
&40 | Parallel Interface Data | &50-&53 | Sound Channels Period Control |
&60 | Interrupt Request Mask | &70 | Power Off Control |
&90 | IRQ Status | &A0 | Memory Card/Battery Status |
&B0-&B9 | Keyboard Data | &C0-&C1 | UART Control/Data |
&D0-&DF | Real Time Clock Chip (TM8521) |
&00 | WRITE ONLY | Start address of Display Memory |
bit 0-3 | Not used | |
bit 4 | Address line | &0C |
bit 5 | Address line | &0D |
bit 6 | Address line | &0E |
bit 7 | Address line | &0F |
On reset this is set to 0. |
The display memory for the 8-line NC computers consists of a block of 4096 bytes where the first byte
defines the state of the pixels in the top left-hand corner of the screen.
A 1 bit set means the pixel is set to black. The first byte controls the first eight dots with bit 7
controlling the bit on the left. The next 59 bytes complete the first raster line of 480 dots.
The bytes which define the second raster line start at byte 64 to make the hardware simpbler so bytes 60, 61,
62 and 63 are wasted. There are then another 64 bytes (with the last four unused) which define the second
raster line and so on straight down the screen.
So the layout is like this:
BYTE 00 BYTE 01 BYTE 02 Bit no. 76543210 76543210 76543210 Pixel No. 00000000 00111111 11112222 01234567 89012345 67890123 Character No. 0-----0- ----0--- --0----- (for 1 row) 0-----1- ----2--- --3-----
This continues on for subsequent lines. For example, the second line is the range of bytes 64-127, and line three is 128-191, and so on. You may also have noticed that displayed characters are only six pixels wide, so slightly unusual routines are required to read and write them, although you can use the Jump Block calls to do this for you.
&10-&13 | READ/WRITE: | Memory Management Control |
These addresses control the NC100's bank switch capabilites. Writers of external applications will most likely use them for accessing the display RAM for direct screen reading and writing. Port:
&10 | controls 0000-3FFF | |
&11 | controls 4000-7FFF | |
&12 | controls 8000-BFFF | |
&13 | controls C000-FFFF |
On reset all are set to 0. For each address the byte written has the following meaning:
bits 0-5 | determine address lines 14-19. |
bit 6 | selects internal RAM |
bit 7 | selects card RAM |
If neither bit 6 or bit 7 are set, then ROM is selected. Therefore:
&00 | 0000 0000b | is the first 16K of ROM | ||
&01 | 0000 0001b | is the second 16K of ROM | ||
&40 | 0100 0000b | is the first 16K of internal RAM | ||
&41 | 0100 0001b | is the second 16K of internal RAM | ||
&80 | 1000 0000b | is the first 16K of card RAM | ||
&81 | 1000 0001b | is the second 16K of card RAM |
So, for example, if you want to switch the third 16K of internal RAM so the processor sees it at
&4000-&7FFF you would output the value &42 to I/O address &11.
&42 has bits 6 set to 1 and bit 7 to 0, while bits 0-6 are 00010b which is the third 16K of internal RAM.
Therefor, to switch the screen (which is the fourth 16K of internal RAM) into the fourth 16K of mapped RAM so that the processor sees it between &C000 and &FFFF, you would output the value &43 (67 decimal) to port &13.
Here is a broad overview of the NC100's layout and the values required to map each 16K block in to one of the four areas of memory:
&00 | 0000 0000b | ROM - Operating System | ||
&01 | 0000 0001b | ROM - Control code | ||
&02 | 0000 0010b | ROM - Calculator | ||
&03 | 0000 0011b | ROM - Address book | ||
&04 | 0000 0100b | ROM - Diary | ||
&05 | 0000 0101b | ROM - BBC Basic | ||
&06 | 0000 0110b | ROM - Protext | ||
&07 | 0000 0111b | ROM - Protext | ||
&08 | 0000 1000b | ROM - Spell Check Code | ||
&09 | 0000 1001b | ROM - Spell Check Code | ||
&0A | 0000 1010b | ROM - Dictionary | ||
&0B | 0000 1011b | ROM - Dictionary | ||
&0C | 0000 1100b | ROM - Dictionary | ||
&0D | 0000 1101b | ROM - Dictionary | ||
&0E | 0000 1110b | ROM - Dictionary | ||
&0F | 0000 1111b | ROM - Dictionary | ||
&40 | 0100 0000b | RAM - Internal RAM | ||
&41 | 0100 0001b | RAM - Internal RAM | ||
&42 | 0100 0010b | RAM - Internal RAM | ||
&43 | 0100 0011b | RAM - Internal RAM - Including Video RAM | ||
&80- | 1000 0000b | RAM - Card RAM (up to 64 16K blocks) |
&20 | WRITE ONLY | Memory Card Wait State Control |
bit 7 = 1 for wait states, 0 for no wait
On reset this is set to 1. The bit should be set if the card RAM/ROM is 200nS or slower.
&30 | WRITE ONLY | Baud Rate |
bits 0-2 | set the baud rate as follows: 000 = 150 001 = 300 010 = 600 011 = 1200 100 = 2400 101 = 4800 110 = 9600 111 = 19200 | |
bit 3 | UART clock and reset: 1=off, 0=on | |
bit 4 | uPD4711 line driver: 1=off, 0=on | |
bit 5 | not used | |
bit 6 | parallel interface Strobe signal | |
bit 7 | select card registers: 1=common, 0=attribute |
On reset all data is set to 1. If programmig the UART directly ensure that TxD clock is operating x16
&40 | WRITE ONLY | Parallel Interface Data |
The byte written here is latched into the parallel port output register. To print it you must then take the Strobe signal (I/O address 30 bit 6) low and then high again. If the printer sends ACK this may generate an IRQ if the mask bit is set in I/O address 60 - IRQ mask.
&50-&53 | WRITE ONLY | Sound Channels Period Control |
&50 | channel A period low | |
&51 | channel A period high | |
&52 | channel B period low | |
&53 | channel B period high |
On reset all data is set to &FF. The top bit in the high byte (&51 and &53) switches the respective sound generator on or off: 1=off, 0=on. The frequency generated is determined as:
Frequency = 307,200 ------- data
So if the data word programmed into &50 and &51 was &7800 (that is, &50=0, &51=78) then the frequency generated would be:
Frequency = 307,200 = 307,200 = 10Hz ------- ------- &7800 30,720
&60 | WRITE ONLY | Interrupt Request Mask |
bit 0 | Rx Ready from UART | |
bit 1 | Tx Ready from UART | |
bit 2 | ACK from parallel interface | |
bit 3 | Key Scan interrupt (every 10mS) | |
bit 4-7 | Not used |
On reset all bit are 0. for each bit: 1=allow that interrupt source to produce IRQs, 0=interrupt source is masked.
&70 | WRITE ONLY | Power Off Control |
bit 0 | 1 = no effect, 0 = power off | |
bit 1-7 | Not Used | |
On reset this is set to 1. |
&90 | READ/WRITE | IRQ Status |
bit 0 | Rx Ready interrupt | |
bit 1 | Tx Ready interrupt | |
bit 2 | ACK from parallel interface | |
bit 3 | Key scan | |
bit 4-7 | Not used |
When an interrupt occurs this port should be read to determine its source. The bit will be set to 0 to identify the interrupting device. The interrupt can then be cleared by writing 0 to that bit.
&A0 | READ ONLY | Memory Card/Battery Status |
bit 0 | Parallel interface ACK: 1 if ACK | |
bit 1 | Parallel interface BUSY: 0 if busy | |
bit 2 | Lithium battery: 1 if less than 2.7 Volts | |
bit 3 | Alkaline batteries: 1 if less than 3.2 Vols. (Although test show this may be nearer to 4.2 volts in practice). | |
bit 4 | RAM card battery: 1 if battery is OK | |
bit 5 | Mains Adapter: 1 if less thatn 4 Volts | |
bit 6 | Card wirte protected: 1 = yes, 0 = no | |
bit 7 | Memory card preset: 0 = yes, 1 = no |
&B0-&B9 | READ ONLY | Keyboard Data |
Each key of the 64 on the keyboard will set a bit in one of these bytes while pressed.
The gate array scans the keyboard every 10mS and then generates an interrupt. The program should then read these 10 I/O locations to etermine which key has been pushed. When I/O address &B9 is read the key scan interrupt is cleard automatically and the next scan cycle will start from &B0.
&C0-&C1 | READ/WRITE | UART Control/Data |
&C0 | UART data register | |
&C1 | UART status/control register |
The UART is the NEC uPD71051. Programmers are advised to study the data sheep for that chip for more information. The Serial interface requires that the uPD4711 line driver hip be turned on by writing a 0 to bit 4 of I/O address &30. While turned on, power consumption increases so this should only be done when necessary. Calling PADINITSERIAL (&B85A) first will ensure no bytes are lost when writing.
&D0-&DF | READ/WRITE | Real Time Clock Chip (TM8521) |
&D0-&DC | Data | |
&DD | Control register | |
&DE | Control register (Write only) | |
&DF | Control register (Write only) |
See the chip data sheet for more information.