📄 e2prom.lis
字号:
0000 ;;=============================================================================
0000 ;; M8C System Macros
0000 ;; These macros should be used when their functions are needed.
0000 ;;=============================================================================
0000
0000 ;----------------------------------------------------
0000 ; Swapping Register Banks
0000 ;----------------------------------------------------
0000 macro M8C_SetBank0
0000 and F, ~FLAG_XIO_MASK
0000 macro M8C_SetBank1
0000 or F, FLAG_XIO_MASK
0000 macro M8C_EnableGInt
0000 or F, FLAG_GLOBAL_IE
0000 macro M8C_DisableGInt
0000 and F, ~FLAG_GLOBAL_IE
0000 macro M8C_DisableIntMask
0000 and reg[@0], ~@1 ; disable specified interrupt enable bit
0000 macro M8C_EnableIntMask
0000 or reg[@0], @1 ; enable specified interrupt enable bit
0000 macro M8C_ClearIntFlag
0000 mov reg[@0], ~@1 ; clear specified interrupt enable bit
0000 macro M8C_EnableWatchDog
0000 and reg[CPU_SCR0], ~CPU_SCR0_PORS_MASK
0000 macro M8C_ClearWDT
0000 mov reg[RES_WDT], 00h
0000 macro M8C_ClearWDTAndSleep
0000 mov reg[RES_WDT], 38h
0000 macro M8C_Stall
0000 or reg[ASY_CR], ASY_CR_SYNCEN
0000 macro M8C_Unstall
0000 and reg[ASY_CR], ~ASY_CR_SYNCEN
0000 macro M8C_Sleep
0000 or reg[CPU_SCR0], CPU_SCR0_SLEEP_MASK
0000 ; The next instruction to be executed depends on the state of the
0000 ; various interrupt enable bits. If some interrupts are enabled
0000 ; and the global interrupts are disabled, the next instruction will
0000 ; be the one that follows the invocation of this macro. If global
0000 ; interrupts are also enabled then the next instruction will be
0000 ; from the interrupt vector table. If no interrupts are enabled
0000 ; then the CPU sleeps forever.
0000 macro M8C_Stop
0000 ; In general, you probably don't want to do this, but here's how:
0000 or reg[CPU_SCR0], CPU_SCR0_STOP_MASK
0000 ; Next instruction to be executed is located in the interrupt
0000 ; vector table entry for Power-On Reset.
0000 macro M8C_Reset
0000 ; Restore CPU to the power-on reset state.
0000 mov A, 0
0000 SSC
0000 ; Next non-supervisor instruction will be at interrupt vector 0.
0000 macro Suspend_CodeCompressor
0000 or F, 0
0000 macro Resume_CodeCompressor
0000 add SP, 0
FFFFFFF4 E2_WR_ARG_cTemperature: equ -12 ; chip temperature
FFFFFFF5 E2_WR_ARG_wByteCount: equ -11 ; Byte Count to Write
FFFFFFF7 E2_WR_ARG_pbData: equ -9 ; Data buffer with data to write
FFFFFFF9 E2_WR_ARG_wAddr: equ -7 ; Address offset in E2PROM to write
FFFFFFFB E2_WR_RETURN_ADDRESS: equ -5 ; callers return address
FFFFFFFD E2_WR_CPU_FLAGS: equ -3 ; CPU flag stored on caller frame for RETI return
FFFFFFFE E2_WR_ARG_wFirstBlockID: equ -2 ; first block ID
0000
0007 E2_WR_ARG_STACK_FRAME_SIZE: equ 7 ; SIZE of the argument list in stack frame
0000
0000
0000 ;-------------------------------------
0000 ; Return Values
0000 ;-------------------------------------
0000 NOERROR: equ 0 ; Successfull completion
FFFFFFFF FAILURE: equ -1 ; Error condition
FFFFFFFE STACKOVERFLOW: equ -2 ; Error Stack Overflow
0000
0000
0000
0000 ;-----------------------------------------------------------------------------
0000 ; FUNCTION NAME: E2Read
0000 ;
0000 ; DESCRIPTION:
0000 ; Reads the specified E2PROM data at offset=wAddr for wByteCount bytes and
0000 ; places the data read into the RAM buffer pbDataDest.
0000 ;
0000 ; Prototype in C is:
0000 ;
0000 ; #pragma fastcall16 E2Read
0000 ; void E2Read( WORD wAddr, BYTE * pbDataDest, WORD wByteCount );
0000 ;
0000 ; ARGUMENTS:
0000 ;
0000 ; wAddr: WORD - relative OFFSET in defined E2PROM to read data
0000 ; pbDataDest: BYTE * - pointer to the RAM buffer to place read data
0000 ; wByteCount: WORD - number of bytes to read from E2PROM
0000 ;
0000 ; Hidden Argument -
0000 ; CPU Flag BYTE - passed on stack after calling return address
0000 ; bFirstBlockId BYTE - first block ID of E2PROM device - passed in Accumulator
0000 ;
0000 ; RETURNS: NONE.
0000 ;
0000 ; SIDE EFFECTS: NONE.
0000 ;
0000 ;-----------------------------------------------------------------------------
FFFFFFF7 E2_RD_ARG_wByteCount: equ -9 ; Byte Count to Read
FFFFFFF9 E2_RD_ARG_pbDataDest: equ -7 ; Data buffer to store read data
FFFFFFFB E2_RD_ARG_wAddr: equ -5 ; Address offset in E2PROM to Read
FFFFFFFD E2_RD_CALLER_RETURN_ADDR: equ -3
FFFFFFFF E2_RD_CPU_FLAG: equ -1 ; CPU flag stored on caller frame for RETI return
0006 E2_RD_ARG_STACK_FRAME_SIZE: equ 6 ; SIZE of argument list in stack frame
0000
0000 ;--------------------
0000 ; End of File
0000 ;--------------------
0000
0000 ;-----------------------------------------------
0000 ; EQUATES
0000 ;-----------------------------------------------
00FF E2PROM_START_BLOCK: equ ffh ; Starting block of E2PROM EEPROM device
3FC0 E2PROM_START_ADDR: equ ffh * 64 ; absolute address of E2PROM EEPROM device
0040 E2PROM_LENGTH: equ 40h ; length of E2PROM EEPROM device
0000
0007 E2_WR_ARG_STACK_FRAME_SIZE: equ 7 ; E2PROM_bE2Write: SIZE of the argument list in stack frame
0006 E2_RD_ARG_STACK_FRAME_SIZE: equ 6 ; E2PROM_bE2Read: SIZE of argument list in stack frame
0000
0000 ;-------------------------------------
0000 ; RETURN VALUES
0000 ;-------------------------------------
0000 E2PROM_NOERROR: equ 0 ; Successfull completion
FFFFFFFF E2PROM_FAILURE: equ -1 ; Error condition
FFFFFFFE E2PROM_STACKOVERFLOW: equ -2 ; Error Stack Overflow
0000
0000
0000 ; end of E2PROM.inc
0000 SYSTEM_STACK_PAGE: equ 0
0000 SYSTEM_STACK_BASE_ADDR: equ 0h
0000 SYSTEM_LARGE_MEMORY_MODEL: equ 0
0001 SYSTEM_SMALL_MEMORY_MODEL: equ 1
0001 SYSTEM_TOOLS: equ 1
0001 SYSTEM_IDXPG_TRACKS_STK_PP: equ 1
0000 SYSTEM_IDXPG_TRACKS_IDX_PP: equ 0
0000 SYSTEM_MULTIPAGE_STACK: equ 0
0000
0000
0000 ; ******* Function Class Definitions *******
0000 ;
0000 ; These definitions are used to describe RAM access patterns. They provide
0000 ; documentation and they control prologue and epilogue macros that perform
0000 ; the necessary housekeeping functions for large memory model devices like
0000 ; the CY8C27x66 and CY8C29x66.
0000
0001 RAM_USE_CLASS_1: equ 1 ; PUSH, POP & I/O access
0002 RAM_USE_CLASS_2: equ 2 ; Indexed address mode on stack page
0004 RAM_USE_CLASS_3: equ 4 ; Indexed address mode to any page
0008 RAM_USE_CLASS_4: equ 8 ; Direct/Indirect address mode access
0000
0000
0000 ; ******* Page Pointer Manipulation Macros *******
0000 ;
0000 ; Most of the following macros are conditionally compiled so they only
0000 ; produce code if the large memory model is selected.
0000
0000 ;-----------------------------------------------
0000 ; Set Stack Page Macro
0000 ;-----------------------------------------------
0000 ;
0000 ; DESC: Modify STK_PP in the large or small memory Models.
0000 ;
0000 ; INPUT: Constant (e.g., SYSTEM_STACK_PAGE) that specifies the RAM page on
0000 ; which stack operations like PUSH and POP store and retrieve their
0000 ; data
0000 ;
0000 ; COST: 8 instruction cycles (in LMM only)
0000
0000 macro RAM_SETPAGE_STK( PG_NUMBER )
0000 IF ( SYSTEM_LARGE_MEMORY_MODEL )
0000 mov reg[STK_PP], @PG_NUMBER
0000 ENDIF
0000 macro RAM_SETPAGE_CUR( PG_NUMBER )
0000 IF ( SYSTEM_LARGE_MEMORY_MODEL )
0000 mov reg[CUR_PP], @PG_NUMBER
0000 ENDIF
0000 macro RAM_SETPAGE_IDX( PG_NUMBER )
0000 IF ( SYSTEM_LARGE_MEMORY_MODEL )
0000 mov reg[IDX_PP], @PG_NUMBER
0000 ENDIF
0000 macro RAM_SETPAGE_MVR( PG_NUMBER )
0000 IF ( SYSTEM_LARGE_MEMORY_MODEL )
0000 mov reg[MVR_PP], @PG_NUMBER
0000 ENDIF
0000 macro RAM_SETPAGE_MVW( PG_NUMBER )
0000 IF ( SYSTEM_LARGE_MEMORY_MODEL )
0000 mov reg[MVW_PP], @PG_NUMBER
0000 ENDIF
0000 macro RAM_SETPAGE_IDX2STK
0000 IF ( SYSTEM_LARGE_MEMORY_MODEL )
0000 IF ( SYSTEM_MULTIPAGE_STACK )
0000 mov A, reg[STK_PP]
0000 mov reg[IDX_PP], A
0000 ELSE
0000 RAM_SETPAGE_IDX SYSTEM_STACK_PAGE
0000 ENDIF
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -