⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vcxi.c

📁 ESS3890+SL原代码(1*16内存)
💻 C
字号:
/* SCCSID @(#)vcxi.c	4.6 10/17/03  *//* * $Log$ */#include "vcxi.h"#include "spoolint.h"#include "timedef.h"/* global variables */volatile int		dsc_port = 0;/* define PRODUCTION_ROM to save ROM space.. * this should be done after code is finalized, * since debugging is not possible if defined. */#ifdef PRODUCTION_ROM void VCX_init(void){    /* dummy */;}void VCX_service(void){    /* dummy */;}#else#define SPOOL_PRINT	0xf2      /* danielc 040497 */#if defined(VCW) || defined(VCWSPOOL1) || defined(VCWSPOOL2)int spool_ready ;extern int spoolint_job_number;#endifstatic	volatile int	vcxi_state ;	  /* One of the states shown above */static	volatile int	vcxi_cmd = -1;static	volatile unsigned int	vcxi_temp ;	  /* Where the longword being sent				     received is saved 			*/static	volatile int 	*vcxi_addr ;   /* Where address to peek/poke is stored *//* Using the ROM emulator */#define VCXI_NULL       0#define VCXI_CMD        1#define VCXI_WRRAM      2#define VCXI_SETAD      3#define VCXI_RBYTE3     4#define VCXI_RBYTE2     5#define VCXI_RBYTE1     6#define VCXI_RBYTE0     7#define VCXI_RDRAM      8#define VCXI_WRBYTE1    9#define VCXI_WRBYTE2    10#define VCXI_WRBYTE3    11 #define RDRAM           0#define WRRAM           1#define SETAD           2PRIVATE int		VCX_wait_host_status = 0;PRIVATE	unsigned int	VCX_wait_til = 0;PRIVATE int		VCX_needimprove = 0;#ifdef NEW_EMULATORvoid VCX_init(void){    volatile int * ptr = (volatile int *)ROM_BASE_ADDR;    /*     * If we are using actual ROM, then location 0 is not 0, in which     * case, we don't want to run VCX_service.     */    if (*ptr) VCX_emulator = 0;}#endif /* NEW_EMULATOR */int in_vcx;void VCX_service(void){    int flag;#ifdef DSC    if (dsc_port & 0x10000) {	dsc_port = DSC_cmd(dsc_port >> 8, dsc_port);    }#endif#ifdef NEW_EMULATOR    /*     * If this is actual ROM, then don't run this routine. It not     * only waste time, but may also hang things!     */    if (!VCX_emulator) return;#endif    if (in_vcx) return;    in_vcx=1;    /*      * In theory, we should be ready by the time we get here, but if     * if it is still not ready, then it needs improvement!     */    if (VCX_wait_host_status) {	if (HOST_STATUS & 2) {	    /* Give it some time, if it is not back, then just ignore it! */	    if (glbTimer >= VCX_wait_til) VCX_needimprove++;	    else goto exit;	}	VCX_wait_host_status = 0;    }    if (HOST_STATUS & 1) {	switch (vcxi_state) {	   case VCXI_NULL:	    flag = (HOST_DATA & 0xff) ;	    if (flag == 0x5c) 		vcxi_state = VCXI_CMD;#ifndef MKROM	    else if (flag == SPOOL_PRINT) 	    {#if defined(VCW)||defined(VCWSPOOL1)||defined(VCWSPOOL2)		spool_ready = (spoolint_job_number<<8); 		mon_put_long1(spool_ready);	    	if (spool_ready)		   spoolhandler();#else		mon_put_long1(0);#endif	    }#endif	    break;	   case VCXI_CMD:	    vcxi_cmd = HOST_DATA & 0xff;	    switch(vcxi_cmd) {              case RDRAM:                vcxi_cmd = vcxi_state = VCXI_RDRAM;                vcxi_temp = *vcxi_addr;                break;              case WRRAM:                vcxi_cmd = VCXI_WRRAM;		vcxi_state = VCXI_RBYTE3;                break;              case SETAD:                vcxi_cmd = VCXI_SETAD;                vcxi_state = VCXI_RBYTE3;                break;              default: goto exit;                break;            }	    break;	  case VCXI_WRRAM:	  case VCXI_SETAD:          case VCXI_RBYTE3:            vcxi_temp = HOST_DATA & 0xff;            vcxi_state = VCXI_RBYTE2;	    break;          case VCXI_RBYTE2:            vcxi_temp <<= 8;            vcxi_temp |= HOST_DATA & 0xff;            vcxi_state = VCXI_RBYTE1;	    break;          case VCXI_RBYTE1:            vcxi_temp <<= 8;            vcxi_temp |= HOST_DATA & 0xff;            vcxi_state = VCXI_RBYTE0;	    break;          case VCXI_RBYTE0:            vcxi_temp <<= 8;            vcxi_temp |= HOST_DATA & 0xff;            vcxi_state = VCXI_NULL;            if(vcxi_cmd == VCXI_SETAD) {                (int)vcxi_addr = vcxi_temp;            } else {                *vcxi_addr = vcxi_temp;            }            break;	  default: goto exit;	}    }    if ((~HOST_STATUS & 2) && ((vcxi_state>=VCXI_RDRAM) &&			       (vcxi_state<=VCXI_WRBYTE3))) {	HOST_DATA = vcxi_temp;	vcxi_temp >>= 8;	if (vcxi_state == VCXI_WRBYTE3) 	  vcxi_state = VCXI_NULL;	else 	  vcxi_state ++ ;	/* Don't put a while loop here! May hang the machine! */	if (HOST_STATUS & 2) {	    VCX_wait_host_status = 1;	    VCX_wait_til = glbTimer + 3;	}    }exit:    in_vcx=0;}#endif /* PRODUCTION_ROM */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -