?? datapage.c
字號:
RTS
}
#else /* USE_SEVERAL_PAGES */
asm {
PSHA ;/* save A register */
LDAA PAGE_ADDR ;/* save page register */
STAB PAGE_ADDR ;/* set page register */
LDAB 0,Y ;/* actual load, overwrites page */
STAA PAGE_ADDR ;/* restore page register */
PULA ;/* restore A register */
RTS
}
#endif /* USE_SEVERAL_PAGES */
}
/*--------------------------- _LOAD_FAR_16 --------------------------------
This runtime routine is used to access paged memory via a runtime function.
It may also be used if the compiler option -Cp is not used with the runtime argument.
Arguments :
- offset part of an address in the Y register
- page part of an address in the B register
Result :
- value to be read in the Y register
- all other registers remains unchanged
- all page register still contain the same value
--------------------------- _LOAD_FAR_16 ----------------------------------*/
#ifdef __cplusplus
extern "C"
#endif
#pragma NO_ENTRY
#pragma NO_EXIT
#pragma NO_FRAME
void NEAR _LOAD_FAR_16(void) {
#if USE_SEVERAL_PAGES
asm {
PSHX ;/* save X register */
__PIC_JSR(_GET_PAGE_REG)
BEQ L_NOPAGE
PSHA ;/* save A register */
LDAA 0,X ;/* save page register */
STAB 0,X ;/* set page register */
LDY 0,Y ;/* actual load, overwrites address */
STAA 0,X ;/* restore page register */
PULA ;/* restore A register */
PULX ;/* restore X register */
RTS
L_NOPAGE:
LDY 0,Y ;/* actual load, overwrites address */
PULX ;/* restore X register */
RTS
}
#else /* USE_SEVERAL_PAGES */
asm {
PSHA ;/* save A register */
LDAA PAGE_ADDR ;/* save page register */
STAB PAGE_ADDR ;/* set page register */
LDY 0,Y ;/* actual load, overwrites address */
STAA PAGE_ADDR ;/* restore page register */
PULA ;/* restore A register */
RTS
}
#endif /* USE_SEVERAL_PAGES */
}
/*--------------------------- _LOAD_FAR_24 --------------------------------
This runtime routine is used to access paged memory via a runtime function.
It may also be used if the compiler option -Cp is not used with the runtime argument.
Arguments :
- offset part of an address in the Y register
- page part of an address in the B register
Result :
- value to be read in the Y:B registers
- all other registers remains unchanged
- all page register still contain the same value
--------------------------- _LOAD_FAR_24 ----------------------------------*/
#ifdef __cplusplus
extern "C"
#endif
#pragma NO_ENTRY
#pragma NO_EXIT
#pragma NO_FRAME
void NEAR _LOAD_FAR_24(void) {
#if USE_SEVERAL_PAGES
asm {
PSHX ;/* save X register */
__PIC_JSR(_GET_PAGE_REG)
BEQ L_NOPAGE
PSHA ;/* save A register */
LDAA 0,X ;/* save page register */
STAB 0,X ;/* set page register */
LDAB 0,Y ;/* actual load, overwrites page of address */
LDY 1,Y ;/* actual load, overwrites offset of address */
STAA 0,X ;/* restore page register */
PULA ;/* restore A register */
PULX ;/* restore X register */
RTS
L_NOPAGE:
LDAB 0,Y ;/* actual load, overwrites page of address */
LDY 1,Y ;/* actual load, overwrites offset of address */
PULX ;/* restore X register */
RTS
}
#else /* USE_SEVERAL_PAGES */
asm {
PSHA ;/* save A register */
LDAA PAGE_ADDR ;/* save page register */
STAB PAGE_ADDR ;/* set page register */
LDAB 0,Y ;/* actual load, overwrites page of address */
LDY 1,Y ;/* actual load, overwrites offset of address */
STAA PAGE_ADDR ;/* restore page register */
PULA ;/* restore A register */
RTS
}
#endif /* USE_SEVERAL_PAGES */
}
/*--------------------------- _LOAD_FAR_32 --------------------------------
This runtime routine is used to access paged memory via a runtime function.
It may also be used if the compiler option -Cp is not used with the runtime argument.
Arguments :
- offset part of an address in the Y register
- page part of an address in the B register
Result :
- low 16 bit of value to be read in the D registers
- high 16 bit of value to be read in the Y registers
- all other registers remains unchanged
- all page register still contain the same value
--------------------------- _LOAD_FAR_32 ----------------------------------*/
#ifdef __cplusplus
extern "C"
#endif
#pragma NO_ENTRY
#pragma NO_EXIT
#pragma NO_FRAME
void NEAR _LOAD_FAR_32(void) {
#if USE_SEVERAL_PAGES
asm {
PSHX ;/* save X register */
__PIC_JSR(_GET_PAGE_REG)
BEQ L_NOPAGE
LDAA 0,X ;/* save page register */
PSHA ;/* put it onto the stack */
STAB 0,X ;/* set page register */
LDD 2,Y ;/* actual load, low word */
LDY 0,Y ;/* actual load, high word */
MOVB 1,SP+,0,X ;/* restore page register */
PULX ;/* restore X register */
RTS
L_NOPAGE:
LDD 2,Y ;/* actual load, low word */
LDY 0,Y ;/* actual load, high word */
PULX ;/* restore X register */
RTS
}
#else /* USE_SEVERAL_PAGES */
asm {
LDAA PAGE_ADDR ;/* save page register */
PSHA ;/* put it onto the stack */
STAB PAGE_ADDR ;/* set page register */
LDD 2,Y ;/* actual load, low word */
LDY 0,Y ;/* actual load, high word */
MOVB 1,SP+,PAGE_ADDR ;/* restore page register */
RTS
}
#endif /* USE_SEVERAL_PAGES */
}
/*--------------------------- _STORE_FAR_8 --------------------------------
This runtime routine is used to access paged memory via a runtime function.
It may also be used if the compiler option -Cp is not used with the runtime argument.
Arguments :
- offset part of an address in the Y register
- page part of an address in the B register
- value to be stored in the B register
Result :
- value stored at the address
- all registers remains unchanged
- all page register still contain the same value
--------------------------- _STORE_FAR_8 ----------------------------------*/
#ifdef __cplusplus
extern "C"
#endif
#pragma NO_ENTRY
#pragma NO_EXIT
#pragma NO_FRAME
void NEAR _STORE_FAR_8(void) {
#if USE_SEVERAL_PAGES
asm {
PSHX ;/* save X register */
__PIC_JSR(_GET_PAGE_REG)
BEQ L_NOPAGE
PSHB ;/* save B register */
LDAB 0,X ;/* save page register */
MOVB 0,SP, 0,X ;/* set page register */
STAA 0,Y ;/* store the value passed in A */
STAB 0,X ;/* restore page register */
PULB ;/* restore B register */
PULX ;/* restore X register */
RTS
L_NOPAGE:
STAA 0,Y ;/* store the value passed in A */
PULX ;/* restore X register */
RTS
}
#else /* USE_SEVERAL_PAGES */
asm {
PSHB ;/* save A register */
LDAB PAGE_ADDR ;/* save page register */
MOVB 0,SP,PAGE_ADDR ;/* set page register */
STAA 0,Y ;/* store the value passed in A */
STAB PAGE_ADDR ;/* restore page register */
PULB ;/* restore B register */
RTS
}
#endif /* USE_SEVERAL_PAGES */
}
/*--------------------------- _STORE_FAR_16 --------------------------------
This runtime routine is used to access paged memory via a runtime function.
It may also be used if the compiler option -Cp is not used with the runtime argument.
Arguments :
- offset part of an address in the Y register
- page part of an address in the B register
- value to be stored in the X register
Result :
- value stored at the address
- all registers remains unchanged
- all page register still contain the same value
--------------------------- _STORE_FAR_16 ----------------------------------*/
#ifdef __cplusplus
extern "C"
#endif
#pragma NO_ENTRY
#pragma NO_EXIT
#pragma NO_FRAME
void NEAR _STORE_FAR_16(void) {
#if USE_SEVERAL_PAGES
asm {
PSHX ;/* save X register */
__PIC_JSR(_GET_PAGE_REG)
BEQ L_NOPAGE
PSHA
LDAA 0,X ;/* save page register */
STAB 0,X ;/* set page register */
MOVW 1,SP,0,Y ;/* store the value passed in X */
STAA 0,X ;/* restore page register */
PULA ;/* restore A register */
PULX ;/* restore X register */
RTS
L_NOPAGE:
STX 0,Y ;/* store the value passed in X */
PULX ;/* restore X register */
RTS
}
#else /* USE_SEVERAL_PAGES */
asm {
PSHA ;/* save A register */
LDAA PAGE_ADDR ;/* save page register */
STAB PAGE_ADDR ;/* set page register */
STX 0,Y ;/* store the value passed in X */
STAA PAGE_ADDR ;/* restore page register */
PULA ;/* restore A register */
RTS
}
#endif /* USE_SEVERAL_PAGES */
}
/*--------------------------- _STORE_FAR_24 --------------------------------
This runtime routine is used to access paged memory via a runtime function.
It may also be used if the compiler option -Cp is not used with the runtime argument.
Arguments :
- offset part of an address in the Y register
- page part of an address in the B register
- value to be stored in the X:A registers (X : low 16 bit, A : high 8 bit)
Result :
- value stored at the address
- all registers remains unchanged
- all page register still contain the same value
--------------------------- _STORE_FAR_24 ----------------------------------*/
#ifdef __cplusplus
extern "C"
#endif
#pragma NO_ENTRY
#pragma NO_EXIT
#pragma NO_FRAME
void NEAR _STORE_FAR_24(void) {
#if USE_SEVERAL_PAGES
asm {
PSHX ;/* save X register */
__PIC_JSR(_GET_PAGE_REG)
BEQ L_NOPAGE
PSHA
LDAA 0,X ;/* save page register */
STAB 0,X ;/* set page register */
MOVW 1,SP, 1,Y ;/* store the value passed in X */
MOVB 0,SP, 0,Y ;/* store the value passed in A */
STAA 0,X ;/* restore page register */
PULA ;/* restore A register */
PULX ;/* restore X register */
RTS
L_NOPAGE:
STX 1,Y ;/* store the value passed in X */
STAA 0,Y ;/* store the value passed in X */
PULX ;/* restore X register */
RTS
}
#else /* USE_SEVERAL_PAGES */
asm {
PSHA ;/* save A register */
LDAA PAGE_ADDR ;/* save page register */
STAB PAGE_ADDR ;/* set page register */
MOVB 0,SP, 0,Y ;/* store the value passed in A */
STX 1,Y ;/* store the value passed in X */
STAA PAGE_ADDR ;/* restore page register */
PULA ;/* restore A register */
RTS
}
#endif /* USE_SEVERAL_PAGES */
}
/*--------------------------- _STORE_FAR_32 --------------------------------
This runtime routine is used to access paged memory via a runtime function.
It may also be used if the compiler option -Cp is not used with the runtime argument.
Arguments :
- offset part of an address in the Y register
- page part of an address is on the stack at 3,SP (just below the return address)
- value to be stored in the X:D registers (D : low 16 bit, X : high 16 bit)
Result :
- value stored at the address
- all registers remains unchanged
- the page part is removed from the stack
- all page register still contain the same value
--------------------------- _STORE_FAR_32 ----------------------------------*/
#ifdef __cplusplus
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -