TARGET_LIST = platform-nc100 platform-micropack platform-pcw8256 platform-socz80 platform-spec3 platform-trs80 platform-z80pack platform-z80pack-lite
-export TARGET= px4plus
+export TARGET= nc100
export CPU = z80
#export TARGET = 6809test
#export CPU = 6809
export CROSS_LD=sdldz80
export CROSS_CC=sdcc
#export CROSS_CCOPTS=-c --std-sdcc99 --no-std-crt0 -mz80 -I$(ROOT_DIR)/cpu-z80 -I$(ROOT_DIR)/platform-$(TARGET) -I$(ROOT_DIR)/include --max-allocs-per-node 1000000 --opt-code-size --Werror --stack-auto --constseg CONST
-export CROSS_CCOPTS=-c --std-sdcc99 --no-std-crt0 -mz80 -I$(ROOT_DIR)/cpu-z80 -I$(ROOT_DIR)/platform-$(TARGET) -I$(ROOT_DIR)/include --max-allocs-per-node 200000 --opt-code-size --Werror --stack-auto --constseg CONST
-#export CROSS_CCOPTS=-c --std-sdcc99 --no-std-crt0 -mz80 -I$(ROOT_DIR)/cpu-z80 -I$(ROOT_DIR)/platform-$(TARGET) -I$(ROOT_DIR)/include --max-allocs-per-node 30000 --opt-code-size --Werror --stack-auto --constseg CONST
+#export CROSS_CCOPTS=-c --std-sdcc99 --no-std-crt0 -mz80 -I$(ROOT_DIR)/cpu-z80 -I$(ROOT_DIR)/platform-$(TARGET) -I$(ROOT_DIR)/include --max-allocs-per-node 200000 --opt-code-size --Werror --stack-auto --constseg CONST
+export CROSS_CCOPTS=-c --std-sdcc99 --no-std-crt0 -mz80 -I$(ROOT_DIR)/cpu-z80 -I$(ROOT_DIR)/platform-$(TARGET) -I$(ROOT_DIR)/include --max-allocs-per-node 30000 --opt-code-size --Werror --stack-auto --constseg CONST
#export CROSS_CCOPTS+=--nostdlib --nostdinc -Isdcclib/include
export CROSS_CC_SEG2=--codeseg CODE2
export CROSS_CC_SEGDISC=--codeseg DISCARD
The NC200 differs from the NC100 in various ways we care about
-- Video default is at 0xE000
-- Display height is doubled
+- Video default is at 0xE000 (DONE)
+- Display height is doubled (DONE)
- Display is designed for 80 column x 16 lines in 6x8 characters (we need
a 6x8 font and driver for this)
-- Writing 1 to 0x70 bit 0 activates the backlight, 7 deactivates it
+- 0x70 bit 2 = 0 for backlight on ?
- The keyboard is bit 3 as before but bit 4 is now power switch rather
than it causing an NMI (so we can do CP/M emulation)
- serial interrupts are bit 2 on NC200 and bit 0 on NC100
- NC200 requires keyboard interrupts are explicitly cleared, NC100
- doesn't in fact care (but its harmless to do so)
+ doesn't in fact care (but its harmless to do so) (DONE)
- Need to mask the serial interrupt when the line driver is off (may
- need that on NC100 too ideally)
-- The keymap is slightly different (see ZCN)
-- There is a floppy drive, but where/how its wired is undocumented it seems
- Obvious candidates are 0x80, 0xE0 and 0xF0. All other Amstrad devices use
- a 765 controller except the PCW16.
+ need that on NC100 too ideally) (DONE)
+- The keymap is slightly different (see ZCN) (DONE)
+- Parallel port busy is now on 0x80 bit 0 ? (DONE)
+- Different rtc (same base address but a 146818 not a tc8521)
+- There is a floppy drive, this is sort of described in MESS
+
+ 0x30 bit 5 set to 0 for FDC use ?
+ 0x60 bit 5 is the FDC interrupt (same bit masks in 0x90 as usual)
+ 0x70 bit 1 is the disk motor (1 = off)
+ 0x70 bit 0 is the 765 terminal count
+ 0xE0/E1 is the upd765
#include <devlpr.h>
__sfr __at 0xa0 lpstat;
+__sfr __at 0x80 lpstat200;
__sfr __at 0x40 lpdata;
int lpr_open(uint8_t minor, uint16_t flag)
ct = 0;
/* Try and balance polling and sleeping */
+#ifdef CONFIG_NC200
+ while (lpstat200 & 1) {
+#else
while (lpstat & 2) {
+#endif
ct++;
if (ct == 10000) {
udata.u_ptab->p_timeout = 3;
mod_control(0, 0x10); /* turn on the line driver */
nap();
mod_control(0x06, 0x01); /* 9600 baud */
+#ifdef CONFIG_NC200
+ irqen = 0x1C;
+#else
irqen = 0x0B; /* Allow serial interrupts */
+#endif
}
return (0);
}
{
tty_close(minor);
if (minor == 2) {
+#ifdef CONFIG_NC200
+ irqen = 0x18;
+#else
irqen = 0x08; /* mask serial interrupts */
+#endif
mod_control(0x10, 0); /* turn off the line driver */
}
return (0);
uint16_t b;
if (minor == 1)
return;
- b = ttydata[2].c_cflags & CBAUD;
+ b = ttydata[2].c_cflag & CBAUD;
if (b < B150)
b = B150;
- if (b > B19200
+ if (b > B19200)
b = B19200;
/* 0 = B150 .. 7 = B19200 in the same spacing and order as termios,
how convenient */
}
+#ifdef CONFIG_NC200
+
void platform_interrupt(void)
{
uint8_t a = irqmap;
uint8_t c;
- if (!(a & 2))
+ if (!(a & 4)) {
+ /* FIXME: need to check uart itself to see wake cause */
wakeup(&ttydata[2]);
- if (!(a & 1)) {
/* work around sdcc bug */
c = uarta;
tty_inproc(2, c);
/* FIXME: Power button */
;
}
+ if (!(a & 32)) {
+ /* FIXME: FDC interrupt */
+ ;
+ }
+ /* clear the mask */
+ irqmap = a;
+}
+
+
+#else
+
+void platform_interrupt(void)
+{
+ uint8_t a = irqmap;
+ uint8_t c;
+ if (!(a & 2))
+ wakeup(&ttydata[2]);
+ if (!(a & 1)) {
+ /* work around sdcc bug */
+ c = uarta;
+ tty_inproc(2, c);
+ }
+ if (!(a & 8)) {
+ keyin[0] = kmap0;
+ keyin[1] = kmap1;
+ keyin[2] = kmap2;
+ keyin[3] = kmap3;
+ keyin[4] = kmap4;
+ keyin[5] = kmap5;
+ keyin[6] = kmap6;
+ keyin[7] = kmap7;
+ keyin[8] = kmap8;
+ keyin[9] = kmap9; /* This resets the scan for 10mS on */
+
+ newkey = 0;
+ keyproc();
+ if (keysdown < 3 && newkey)
+ keydecode();
+ timer_interrupt();
+ }
/* clear the mask */
irqmap = a;
}
+#endif
+
/* This is used by the vt asm code, but needs to live at the top of the kernel */
uint16_t cursorpos;
.include "kernel.def"
.include "../kernel.def"
+ .include "nc100.def"
; -----------------------------------------------------------------------------
; COMMON MEMORY BANK (0xF000 upwards)
push af
ld a, #0x43 ; main memory, bank 3 (video etc)
out (0x11), a
- ld hl, #0x7000 + 384
- ld de, #0x7000
- ld bc, #0x1000 - 384 - 1
+ ld hl, #VIDEO_BASE + 384
+ ld de, #VIDEO_BASE
+ ld bc, #VIDEO_SIZE - 384 - 1
ldir
jr vtdone
push af
ld a, #0x43 ; main memory, bank 3 (video etc)
out (0x11), a
- ld hl, #0x7FFF
- ld de, #0x7FFF - 384
- ld bc, #0x1000 - 384 - 1
+ ld hl, #VIDEO_BASE + 0xFFF
+ ld de, #VIDEO_BASE + 0xFFF - 384
+ ld bc, #VIDEO_SIZE - 384 - 1
lddr
vtdone: pop af
out (0x11), a
rr d ; roll two bits into D
srl a
rr d
- add #VIDEO_BASE_H ; screen start (0x7000 or 0x6000 for NC200)
+ add #VIDEO_BASEH ; screen start (0x7000 or 0x6000 for NC200)
ld e, d
ld d, a
ret