The NC100 I/O Ports


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.

PortDescriptionPortDescription
&00Start address of Display Memory&10-&13Memory Management Control
&20Memory Card Wait State Control&30Baud Rate
&40Parallel Interface Data&50-&53Sound Channels Period Control
&60Interrupt Request Mask&70Power Off Control
&90IRQ Status&A0Memory Card/Battery Status
&B0-&B9Keyboard Data&C0-&C1UART Control/Data
&D0-&DFReal Time Clock Chip (TM8521)

&00WRITE ONLYStart address of Display Memory
bit 0-3Not used
bit 4Address line&0C
bit 5Address line&0D
bit 6Address line&0E
bit 7Address 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-&13READ/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:
&10controls 0000-3FFF
&11controls 4000-7FFF
&12controls 8000-BFFF
&13controls C000-FFFF

On reset all are set to 0. For each address the byte written has the following meaning:

bits 0-5determine address lines 14-19.
bit 6selects internal RAM
bit 7selects card RAM

If neither bit 6 or bit 7 are set, then ROM is selected. Therefore:

&000000 0000bis the first 16K of ROM
&010000 0001bis the second 16K of ROM
&400100 0000bis the first 16K of internal RAM
&410100 0001bis the second 16K of internal RAM
&801000 0000bis the first 16K of card RAM
&811000 0001bis 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:

&000000 0000bROM - Operating System
&010000 0001bROM - Control code
&020000 0010bROM - Calculator
&030000 0011bROM - Address book
&040000 0100bROM - Diary
&050000 0101bROM - BBC Basic
&060000 0110bROM - Protext
&070000 0111bROM - Protext
&080000 1000bROM - Spell Check Code
&090000 1001bROM - Spell Check Code
&0A0000 1010bROM - Dictionary
&0B0000 1011bROM - Dictionary
&0C0000 1100bROM - Dictionary
&0D0000 1101bROM - Dictionary
&0E0000 1110bROM - Dictionary
&0F0000 1111bROM - Dictionary
&400100 0000bRAM - Internal RAM
&410100 0001bRAM - Internal RAM
&420100 0010bRAM - Internal RAM
&430100 0011bRAM - Internal RAM - Including Video RAM
&80-1000 0000bRAM - Card RAM (up to 64 16K blocks)

&20WRITE ONLYMemory 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.

&30WRITE ONLYBaud Rate

bits 0-2set the baud rate as follows:
000 = 150
001 = 300
010 = 600
011 = 1200
100 = 2400
101 = 4800
110 = 9600
111 = 19200
bit 3UART clock and reset: 1=off, 0=on
bit 4uPD4711 line driver: 1=off, 0=on
bit 5not used
bit 6parallel interface Strobe signal
bit 7select 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

&40WRITE ONLYParallel 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-&53WRITE ONLYSound Channels Period Control

&50channel A period low
&51channel A period high
&52channel B period low
&53channel 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
&60WRITE ONLYInterrupt Request Mask

bit 0Rx Ready from UART
bit 1Tx Ready from UART
bit 2ACK from parallel interface
bit 3Key Scan interrupt (every 10mS)
bit 4-7Not used

On reset all bit are 0. for each bit: 1=allow that interrupt source to produce IRQs, 0=interrupt source is masked.

&70WRITE ONLYPower Off Control

bit 01 = no effect, 0 = power off
bit 1-7Not Used
On reset this is set to 1.

&90READ/WRITEIRQ Status

bit 0Rx Ready interrupt
bit 1Tx Ready interrupt
bit 2ACK from parallel interface
bit 3Key scan
bit 4-7Not 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.

&A0READ ONLYMemory Card/Battery Status

bit 0Parallel interface ACK: 1 if ACK
bit 1Parallel interface BUSY: 0 if busy
bit 2Lithium battery: 1 if less than 2.7 Volts
bit 3Alkaline batteries: 1 if less than 3.2 Vols. (Although test show this may be nearer to 4.2 volts in practice).
bit 4RAM card battery: 1 if battery is OK
bit 5Mains Adapter: 1 if less thatn 4 Volts
bit 6Card wirte protected: 1 = yes, 0 = no
bit 7Memory card preset: 0 = yes, 1 = no

&B0-&B9READ ONLYKeyboard 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-&C1READ/WRITEUART Control/Data

&C0UART data register
&C1UART 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-&DFREAD/WRITEReal Time Clock Chip (TM8521)

&D0-&DCData
&DDControl register
&DEControl register (Write only)
&DFControl register (Write only)

See the chip data sheet for more information.