Add support for the TRS-80 Model 3
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@690 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
e1192ac67b
commit
7c9d7db3d9
5 changed files with 275 additions and 1 deletions
76
arch/z80/include/io.h
Normal file
76
arch/z80/include/io.h
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
/****************************************************************************
|
||||
* arch/z80/include/io.h
|
||||
* arch/chip/io.h
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ARCH_IO_H
|
||||
#define __ARCH_IO_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <arch/chip/io.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __ARCH_IO_H */
|
||||
85
arch/z80/include/z80/io.h
Normal file
85
arch/z80/include/z80/io.h
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
/****************************************************************************
|
||||
* arch/z80/include/z80/io.h
|
||||
* arch/chip/io.h
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* This file should never be included directed but, rather, only indirectly
|
||||
* through arch/io.h
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_Z80_IO_H
|
||||
#define __ARCH_Z80_IO_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Inline functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
EXTERN void outp(char p, char c);
|
||||
EXTERN char inp(char p);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __ARCH_Z80_IO_H */
|
||||
|
|
@ -153,8 +153,16 @@ pass1.ihx: up_mem.h asm_mem.h $(SDCCLIBDIR)/myz80.lib $(HEAD_AOBJ) board/libboar
|
|||
echo "-l $(TOPDIR)/$$LIB" >> pass1.lnk ;\
|
||||
done
|
||||
@echo "-l myz80.lib" >>pass1.lnk # Name of SDCC z80 library
|
||||
ifneq ($(CONFIG_LINKER_START_AREA),)
|
||||
@echo "-b START=$(CONFIG_LINKER_START_AREA)" >>pass1.lnk # Start of START area
|
||||
else
|
||||
@echo "-b START=0" >>pass1.lnk # Start of START area
|
||||
endif
|
||||
ifneq ($(CONFIG_LINKER_CODE_AREA),)
|
||||
@echo "-b _CODE=$(CONFIG_LINKER_CODE_AREA)" >>pass1.lnk # Start of _CODE area
|
||||
else
|
||||
@echo "-b _CODE=256" >>pass1.lnk # Start of _CODE area
|
||||
endif
|
||||
@echo "-i" >>pass1.lnk # Intel hex format
|
||||
@echo "-x" >>pass1.lnk # Hexadecimal
|
||||
@echo "-m" >>pass1.lnk # Generate a map file
|
||||
|
|
@ -178,8 +186,16 @@ nuttx.ihx: up_mem.h asm_mem.h $(SDCCLIBDIR)/myz80.lib $(HEAD_AOBJ) board/libboar
|
|||
echo "-l $(TOPDIR)/$$LIB" >> nuttx.lnk ;\
|
||||
done
|
||||
@echo "-l myz80.lib" >>nuttx.lnk # Name of SDCC z80 library
|
||||
ifneq ($(CONFIG_LINKER_START_AREA),)
|
||||
@echo "-b START=$(CONFIG_LINKER_START_AREA)" >>nuttx.lnk # Start of START area
|
||||
else
|
||||
@echo "-b START=0" >>nuttx.lnk # Start of START area
|
||||
endif
|
||||
ifneq ($(CONFIG_LINKER_CODE_AREA),)
|
||||
@echo "-b _CODE=$(CONFIG_LINKER_CODE_AREA)" >>nuttx.lnk # Start of _CODE area
|
||||
else
|
||||
@echo "-b _CODE=256" >>nuttx.lnk # Start of _CODE area
|
||||
endif
|
||||
@echo "-i" >>nuttx.lnk # Intel hex format
|
||||
@echo "-x" >>nuttx.lnk # Hexadecimal
|
||||
@echo "-m" >>nuttx.lnk # Generate a map file
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ CMN_CSRCS = up_initialize.c up_allocateheap.c up_createstack.c \
|
|||
up_mdelay.c up_udelay.c up_usestack.c
|
||||
|
||||
CHIP_ASRCS = z80_saveusercontext.asm z80_restoreusercontext.asm
|
||||
CHIP_CSRCS = z80_initialstate.c z80_irq.c z80_copystate.c \
|
||||
CHIP_CSRCS = z80_initialstate.c z80_io.c z80_irq.c z80_copystate.c \
|
||||
z80_schedulesigaction.c z80_sigdeliver.c \
|
||||
z80_registerdump.c
|
||||
|
||||
|
|
|
|||
97
arch/z80/src/z80/z80_io.c
Normal file
97
arch/z80/src/z80/z80_io.c
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
/****************************************************************************
|
||||
* arch/z80/src/z80/z80_io.c
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
/* #include <nuttx/irq.h> */
|
||||
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: outb
|
||||
*
|
||||
* Description:
|
||||
* Output byte c on port p
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void outp(char p, char c)
|
||||
{
|
||||
_asm
|
||||
ld c, 4(ix) ; port
|
||||
ld a, 5(ix) ; value
|
||||
out (c), a
|
||||
_endasm;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Name: inpb
|
||||
*
|
||||
* Description:
|
||||
* Input byte from port p
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
char inp(char p)
|
||||
{
|
||||
_asm
|
||||
ld c, 4(ix) ;port
|
||||
in l, (c)
|
||||
_endasm;
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue