├── C_Layout.hwl ├── Default.mem ├── Full_Chip_Simulation.ini ├── Hell Fire.mcp ├── Hell_Fire----_Data ├── CWSettingsWindows.stg └── Standard │ ├── ObjectCode │ ├── Control.c.o │ ├── Hardware.c.o │ ├── Hardwaredriver.c.o │ ├── LCD.c.o │ ├── MC9S12XS128.c.o │ ├── Sensor.c.o │ ├── Start12.c.o │ ├── SureLocation.c.o │ ├── base.c.o │ ├── datapage.c.o │ └── main.c.o │ └── TargetDataWindows.tdt ├── Hell_Fire_Data ├── CWSettingsWindows.stg └── Standard │ ├── ObjectCode │ ├── Hardware.c.o │ ├── LCD.c.o │ ├── MC9S12XS128.c.o │ ├── Start12.c.o │ ├── base.c.o │ ├── datapage.c.o │ └── main.c.o │ └── TargetDataWindows.tdt ├── P&E_Multilink_CyclonePro.ini ├── README.md ├── Sources ├── Control.c ├── Control.h ├── Hardware.c ├── Hardware.h ├── Hardwaredriver.c ├── Hardwaredriver.h ├── Include.h ├── LCD.c ├── LCD.h ├── Sensor.c ├── Sensor.h ├── Start12.c ├── SureLocation.c ├── SureLocation.h ├── base.c ├── base.h ├── datapage.c ├── derivative.h └── main.c ├── TBDML.ini ├── bestcar_Data ├── CWSettingsWindows.stg └── Standard │ ├── ObjectCode │ ├── Control.c.o │ ├── Hardware.c.o │ ├── Hardwaredriver.c.o │ ├── MC9S12XS128.c.o │ ├── Sensor.c.o │ ├── Start12.c.o │ ├── SureLocation.c.o │ ├── base.c.o │ ├── datapage.c.o │ └── main.c.o │ └── TargetDataWindows.tdt ├── bin ├── Project.abs ├── Project.abs.glo ├── Project.abs.s19 ├── Project.map └── Project.xpr ├── cmd ├── Full_Chip_Simulation_Postload.cmd ├── Full_Chip_Simulation_Preload.cmd ├── Full_Chip_Simulation_Reset.cmd ├── Full_Chip_Simulation_SetCPU.cmd ├── Full_Chip_Simulation_Startup.cmd ├── P&E_Multilink_CyclonePro_Erase_unsecure_hcs12xe.cmd ├── P&E_Multilink_CyclonePro_Postload.cmd ├── P&E_Multilink_CyclonePro_Preload.cmd ├── P&E_Multilink_CyclonePro_Reset.cmd ├── P&E_Multilink_CyclonePro_Startup.cmd ├── P&E_Multilink_CyclonePro_Vppoff.cmd ├── P&E_Multilink_CyclonePro_Vppon.cmd ├── TBDML_Erase_unsecure_hcs12xe.cmd ├── TBDML_Postload.cmd ├── TBDML_Preload.cmd ├── TBDML_Reset.cmd ├── TBDML_Startup.cmd ├── TBDML_Vppoff.cmd └── TBDML_Vppon.cmd ├── prm ├── Project.prm └── burner.bbl ├── sure location.txt └── 新建 文本文档.txt /C_Layout.hwl: -------------------------------------------------------------------------------- 1 | OPEN source 0 0 60 39 2 | Source < attributes MARKS off 3 | OPEN assembly 60 0 40 31 4 | Assembly < attributes ADR on,CODE off,ABSADR on,SYMB off,TOPPC 0xF88C 5 | OPEN procedure 0 39 60 17 6 | Procedure < attributes VALUES on,TYPES off 7 | OPEN register 60 31 40 25 8 | Register < attributes FORMAT AUTO,COMPLEMENT None 9 | OPEN memory 60 56 40 22 10 | Memory < attributes FORMAT hex,COMPLEMENT None,WORD 1,ASC on,ADR on,ADDRESS 0x80 11 | OPEN data 0 56 60 22 12 | Data:1 < attributes SCOPE global,COMPLEMENT None,FORMAT Symb,MODE automatic,UPDATERATE 10,NAMEWIDTH 16 13 | OPEN data 0 78 60 22 14 | Data:2 < attributes SCOPE local,COMPLEMENT None,FORMAT Symb,MODE automatic,UPDATERATE 10,NAMEWIDTH 16 15 | OPEN command 60 78 40 22 16 | Command < attributes CACHESIZE 1000 17 | bckcolor 50331647 18 | font 'Courier New' 9 BLACK 19 | AUTOSIZE on 20 | ACTIVATE Data:2 Command Procedure Data:1 Source Register Assembly Memory 21 | -------------------------------------------------------------------------------- /Default.mem: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Default.mem -------------------------------------------------------------------------------- /Full_Chip_Simulation.ini: -------------------------------------------------------------------------------- 1 | [Environment Variables] 2 | GENPATH={Project}Sources;{Compiler}lib\hc12c\src;{Compiler}lib\hc12c\include;{Compiler}lib\hc12c\lib;{Compiler}lib\xgatec\src;{Compiler}lib\xgatec\include;{Compiler}lib\xgatec\lib 3 | LIBPATH={Compiler}lib\hc12c\include;{Compiler}lib\xgatec\include 4 | OBJPATH={Project}bin 5 | TEXTPATH={Project}bin 6 | ABSPATH={Project}bin 7 | 8 | [HI-WAVE] 9 | Target=sim 10 | Layout=C_layout.hwl 11 | LoadDialogOptions=AUTOERASEANDFLASH RUNANDSTOPAFTERLOAD="main" 12 | CPU=HC12 13 | MainFrame=0,1,-1,-1,-1,-1,46,19,1071,550 14 | TOOLBAR=57600 57601 32795 0 57635 57634 57637 0 57671 57669 0 32777 32776 32782 32780 32781 32778 0 32806 15 | 16 | 17 | 18 | [Simulator] 19 | CMDFILE0=CMDFILE STARTUP ON ".\cmd\Full_Chip_Simulation_startup.cmd" 20 | 21 | [Simulator HC12] 22 | CMDFILE0=CMDFILE RESET ON ".\cmd\Full_Chip_Simulation_reset.cmd" 23 | CMDFILE1=CMDFILE PRELOAD ON ".\cmd\Full_Chip_Simulation_preload.cmd" 24 | CMDFILE2=CMDFILE POSTLOAD ON ".\cmd\Full_Chip_Simulation_postload.cmd" 25 | CMDFILE3=CMDFILE SETCPU ON ".\cmd\Full_Chip_Simulation_setcpu.cmd" 26 | HCS12_SUPPORT=4 27 | FCS=MC9S12XS128 28 | -------------------------------------------------------------------------------- /Hell Fire.mcp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Hell Fire.mcp -------------------------------------------------------------------------------- /Hell_Fire----_Data/CWSettingsWindows.stg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Hell_Fire----_Data/CWSettingsWindows.stg -------------------------------------------------------------------------------- /Hell_Fire----_Data/Standard/ObjectCode/Control.c.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Hell_Fire----_Data/Standard/ObjectCode/Control.c.o -------------------------------------------------------------------------------- /Hell_Fire----_Data/Standard/ObjectCode/Hardware.c.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Hell_Fire----_Data/Standard/ObjectCode/Hardware.c.o -------------------------------------------------------------------------------- /Hell_Fire----_Data/Standard/ObjectCode/Hardwaredriver.c.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Hell_Fire----_Data/Standard/ObjectCode/Hardwaredriver.c.o -------------------------------------------------------------------------------- /Hell_Fire----_Data/Standard/ObjectCode/LCD.c.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Hell_Fire----_Data/Standard/ObjectCode/LCD.c.o -------------------------------------------------------------------------------- /Hell_Fire----_Data/Standard/ObjectCode/MC9S12XS128.c.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Hell_Fire----_Data/Standard/ObjectCode/MC9S12XS128.c.o -------------------------------------------------------------------------------- /Hell_Fire----_Data/Standard/ObjectCode/Sensor.c.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Hell_Fire----_Data/Standard/ObjectCode/Sensor.c.o -------------------------------------------------------------------------------- /Hell_Fire----_Data/Standard/ObjectCode/Start12.c.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Hell_Fire----_Data/Standard/ObjectCode/Start12.c.o -------------------------------------------------------------------------------- /Hell_Fire----_Data/Standard/ObjectCode/SureLocation.c.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Hell_Fire----_Data/Standard/ObjectCode/SureLocation.c.o -------------------------------------------------------------------------------- /Hell_Fire----_Data/Standard/ObjectCode/base.c.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Hell_Fire----_Data/Standard/ObjectCode/base.c.o -------------------------------------------------------------------------------- /Hell_Fire----_Data/Standard/ObjectCode/datapage.c.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Hell_Fire----_Data/Standard/ObjectCode/datapage.c.o -------------------------------------------------------------------------------- /Hell_Fire----_Data/Standard/ObjectCode/main.c.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Hell_Fire----_Data/Standard/ObjectCode/main.c.o -------------------------------------------------------------------------------- /Hell_Fire----_Data/Standard/TargetDataWindows.tdt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Hell_Fire----_Data/Standard/TargetDataWindows.tdt -------------------------------------------------------------------------------- /Hell_Fire_Data/CWSettingsWindows.stg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Hell_Fire_Data/CWSettingsWindows.stg -------------------------------------------------------------------------------- /Hell_Fire_Data/Standard/ObjectCode/Hardware.c.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Hell_Fire_Data/Standard/ObjectCode/Hardware.c.o -------------------------------------------------------------------------------- /Hell_Fire_Data/Standard/ObjectCode/LCD.c.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Hell_Fire_Data/Standard/ObjectCode/LCD.c.o -------------------------------------------------------------------------------- /Hell_Fire_Data/Standard/ObjectCode/MC9S12XS128.c.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Hell_Fire_Data/Standard/ObjectCode/MC9S12XS128.c.o -------------------------------------------------------------------------------- /Hell_Fire_Data/Standard/ObjectCode/Start12.c.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Hell_Fire_Data/Standard/ObjectCode/Start12.c.o -------------------------------------------------------------------------------- /Hell_Fire_Data/Standard/ObjectCode/base.c.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Hell_Fire_Data/Standard/ObjectCode/base.c.o -------------------------------------------------------------------------------- /Hell_Fire_Data/Standard/ObjectCode/datapage.c.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Hell_Fire_Data/Standard/ObjectCode/datapage.c.o -------------------------------------------------------------------------------- /Hell_Fire_Data/Standard/ObjectCode/main.c.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Hell_Fire_Data/Standard/ObjectCode/main.c.o -------------------------------------------------------------------------------- /Hell_Fire_Data/Standard/TargetDataWindows.tdt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Hell_Fire_Data/Standard/TargetDataWindows.tdt -------------------------------------------------------------------------------- /P&E_Multilink_CyclonePro.ini: -------------------------------------------------------------------------------- 1 | [Environment Variables] 2 | GENPATH={Project}Sources;{Compiler}lib\hc12c\src;{Compiler}lib\hc12c\include;{Compiler}lib\hc12c\lib;{Compiler}lib\xgatec\src;{Compiler}lib\xgatec\include;{Compiler}lib\xgatec\lib 3 | LIBPATH={Compiler}lib\hc12c\include;{Compiler}lib\xgatec\include 4 | OBJPATH={Project}bin 5 | TEXTPATH={Project}bin 6 | ABSPATH={Project}bin 7 | 8 | [HI-WAVE] 9 | Target=icd12 10 | Layout=C_layout.hwl 11 | LoadDialogOptions=AUTOERASEANDFLASH RUNANDSTOPAFTERLOAD="main" 12 | CPU=HC12 13 | 14 | [ICD12] 15 | CMDFILE0=CMDFILE STARTUP ON ".\cmd\P&E_Multilink_CyclonePro_startup.cmd" 16 | CMDFILE1=CMDFILE RESET ON ".\cmd\P&E_Multilink_CyclonePro_reset.cmd" 17 | CMDFILE2=CMDFILE PRELOAD ON ".\cmd\P&E_Multilink_CyclonePro_preload.cmd" 18 | CMDFILE3=CMDFILE POSTLOAD ON ".\cmd\P&E_Multilink_CyclonePro_postload.cmd" 19 | CMDFILE4=CMDFILE VPPON ON ".\cmd\P&E_Multilink_CyclonePro_vppon.cmd" 20 | CMDFILE5=CMDFILE VPPOFF ON ".\cmd\P&E_Multilink_CyclonePro_vppoff.cmd" 21 | CMDFILE6=CMDFILE UNSECURE ON ".\cmd\P&E_Multilink_CyclonePro_erase_unsecure_hcs12xe.cmd" 22 | MCUID=0x2E1 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Smart_car 2 | 大学时代的美好回忆,飞思卡尔杯电磁组智能小车控制代码 3 | 配合的硬件是飞思卡尔芯片,需要编译后烧录,小车早送人了,电路图自己凭想象发挥吧 4 | -------------------------------------------------------------------------------- /Sources/Control.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Sources/Control.c -------------------------------------------------------------------------------- /Sources/Control.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Sources/Control.h -------------------------------------------------------------------------------- /Sources/Hardware.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Sources/Hardware.c -------------------------------------------------------------------------------- /Sources/Hardware.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Sources/Hardware.h -------------------------------------------------------------------------------- /Sources/Hardwaredriver.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Sources/Hardwaredriver.c -------------------------------------------------------------------------------- /Sources/Hardwaredriver.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Sources/Hardwaredriver.h -------------------------------------------------------------------------------- /Sources/Include.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Sources/Include.h -------------------------------------------------------------------------------- /Sources/LCD.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Sources/LCD.c -------------------------------------------------------------------------------- /Sources/LCD.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Sources/LCD.h -------------------------------------------------------------------------------- /Sources/Sensor.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Sources/Sensor.c -------------------------------------------------------------------------------- /Sources/Sensor.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Sources/Sensor.h -------------------------------------------------------------------------------- /Sources/Start12.c: -------------------------------------------------------------------------------- 1 | /***************************************************** 2 | start12.c - standard startup code 3 | The startup code may be optimized to special user requests 4 | ---------------------------------------------------- 5 | Copyright (c) Metrowerks, Basel, Switzerland 6 | All rights reserved 7 | 8 | Note: ROM libraries are not implemented in this startup code 9 | Note: C++ destructors of global objects are NOT yet supported in the HIWARE Object File Format. 10 | To use this feature, please build your application with the ELF object file format. 11 | *****************************************************/ 12 | /*lint -esym(750, __NO_FLAGS_OFFSET, __NO_MAIN_OFFSET, __NO_STACKOFFSET_OFFSET) */ 13 | /* these macros remove some unused fields in the startup descriptor */ 14 | #define __NO_FLAGS_OFFSET /* we do not need the flags field in the startup data descriptor */ 15 | #define __NO_MAIN_OFFSET /* we do not need the main field in the startup data descriptor */ 16 | #define __NO_STACKOFFSET_OFFSET /* we do not need the stackOffset field in the startup data descriptor */ 17 | 18 | /*#define __BANKED_COPY_DOWN : allow to allocate .copy in flash area */ 19 | #if defined(__BANKED_COPY_DOWN) && (!defined(__HCS12X__) || !defined(__ELF_OBJECT_FILE_FORMAT__)) 20 | #error /* the __BANKED_COPY_DOWN switch is only supported for the HCS12X with ELF */ 21 | /* (and not for the HC12, HCS12 or for the HIWARE object file format) */ 22 | #endif 23 | 24 | #include "hidef.h" 25 | #include "start12.h" 26 | 27 | /***************************************************************************/ 28 | /* Macros to control how the startup code handles the COP: */ 29 | /* #define _DO_FEED_COP_ : do feed the COP */ 30 | /* #define _DO_ENABLE_COP_: do enable the COP */ 31 | /* #define _DO_DISABLE_COP_: disable the COP */ 32 | /* Without defining any of these, the startup code does NOT handle the COP */ 33 | /***************************************************************************/ 34 | /* __ONLY_INIT_SP define: */ 35 | /* This define selects an shorter version of the startup code */ 36 | /* which only loads the stack pointer and directly afterwards calls */ 37 | /* main. This version does however NOT initialized global variables */ 38 | /* (So this version is not ANSI compliant!) */ 39 | /***************************************************************************/ 40 | /* __FAR_DATA define: */ 41 | /* By default, the startup code only supports to initialize the default */ 42 | /* kind of memory. If some memory is allocated far in the small or banked */ 43 | /* memory model, then the startup code only supports to initialize this */ 44 | /* memory blocks if __FAR_DATA is defined. If __FAR_DATA is not defined, */ 45 | /* then the linker will issue a message like */ 46 | /* "L1128: Cutting value _Range beg data member from 0xF01000 to 0x1000" */ 47 | /* and this startup code writes to the cutted address */ 48 | /***************************************************************************/ 49 | /* __BANKED_COPY_DOWN define: */ 50 | /* by default, the startup code assumes that the startup data structure */ 51 | /* _startupData, the zero out areas and the .copy section are all */ 52 | /* allocated in NON_BANKED memory. Especially the .copy section can be */ 53 | /* if there are many or large RAM areas to initialize. */ 54 | /* for the HCS12X, which also copies the XGATE RAM located code via .copy */ 55 | /* section, the startup code supports to allocate .copy in a banked flash */ 56 | /* The placement of .copy in the prm file has to be adapted when adding or */ 57 | /* removing the this macro. */ 58 | /* Note: This macro is only supported for the HCS12X and when using ELF */ 59 | /***************************************************************************/ 60 | 61 | #ifdef __cplusplus 62 | #define __EXTERN_C extern "C" 63 | #else 64 | #define __EXTERN_C 65 | #endif 66 | 67 | __EXTERN_C void main(void); /* prototype of main function */ 68 | 69 | #ifndef __ONLY_INIT_SP 70 | #pragma DATA_SEG __NEAR_SEG STARTUP_DATA /* _startupData can be accessed using 16 bit accesses. */ 71 | /* This is needed because it contains the stack top, and without stack, far data cannot be accessed */ 72 | /*lint -e1065 */ 73 | struct _tagStartup _startupData; /* read-only: */ 74 | /* _startupData is allocated in ROM and */ 75 | /* initialized by the linker */ 76 | /*lint +e1065 */ 77 | #pragma DATA_SEG DEFAULT 78 | #endif /* __ONLY_INIT_SP */ 79 | 80 | #if defined(FAR_DATA) && (!defined(__HCS12X__) || defined(__BANKED_COPY_DOWN)) 81 | #include "non_bank.sgm" 82 | /* the init function must be in non banked memory if banked variables are used */ 83 | /* because _SET_PAGE is called, which may change any page register. */ 84 | 85 | __EXTERN_C void _SET_PAGE(void); /* the inline assembler needs a prototype */ 86 | /* this is a runtime routine with a special */ 87 | /* calling convention, do not use it in c code! */ 88 | #else 89 | #include "default.sgm" 90 | #endif /* defined(FAR_DATA) && (!defined(__HCS12X__) || defined(__BANKED_COPY_DOWN)) */ 91 | 92 | 93 | /* define value and bits for Windef Register */ 94 | #ifdef HC812A4 95 | #define WINDEF (*(volatile unsigned char*) 0x37) 96 | #if defined( __BANKED__) || defined(__LARGE__) || defined(__PPAGE__) 97 | #define __ENABLE_PPAGE__ 0x40 98 | #else 99 | #define __ENABLE_PPAGE__ 0x0 100 | #endif 101 | #if defined(__DPAGE__) 102 | #define __ENABLE_DPAGE__ 0x80 103 | #else 104 | #define __ENABLE_DPAGE__ 0x0 105 | #endif 106 | #if defined(__EPAGE__) 107 | #define __ENABLE_EPAGE__ 0x20 108 | #else 109 | #define __ENABLE_EPAGE__ 0x0 110 | #endif 111 | #endif /* HC812A4 */ 112 | 113 | #ifdef _HCS12_SERIALMON 114 | /* for Monitor based software remap the RAM & EEPROM to adhere 115 | to EB386. Edit RAM and EEPROM sections in PRM file to match these. */ 116 | #define ___INITRM (*(volatile unsigned char *) 0x0010) 117 | #define ___INITRG (*(volatile unsigned char *) 0x0011) 118 | #define ___INITEE (*(volatile unsigned char *) 0x0012) 119 | #endif 120 | 121 | #if defined(_DO_FEED_COP_) 122 | #define __FEED_COP_IN_HLI() } __asm movb #0x55, _COP_RST_ADR; __asm movb #0xAA, _COP_RST_ADR; __asm { 123 | #else 124 | #define __FEED_COP_IN_HLI() /* do nothing */ 125 | #endif 126 | 127 | #ifndef __ONLY_INIT_SP 128 | #if (!defined(FAR_DATA) || defined(__HCS12X__)) && (defined( __BANKED__) || defined(__LARGE__) || defined(__BANKED_COPY_DOWN)) 129 | static void __far Init(void) 130 | #else 131 | static void Init(void) 132 | #endif 133 | { 134 | /* purpose: 1) zero out RAM-areas where data is allocated */ 135 | /* 2) copy initialization data from ROM to RAM */ 136 | /* 3) call global constructors in C++ */ 137 | /* called from: _Startup, LibInits */ 138 | __asm { 139 | ZeroOut: 140 | #if defined(__HIWARE_OBJECT_FILE_FORMAT__) && defined(__LARGE__) 141 | LDX _startupData.pZeroOut:1 ; in the large memory model in the HIWARE format, pZeroOut is a 24 bit pointer 142 | #else 143 | LDX _startupData.pZeroOut ; *pZeroOut 144 | #endif 145 | LDY _startupData.nofZeroOuts ; nofZeroOuts 146 | BEQ CopyDown ; if nothing to zero out 147 | 148 | NextZeroOut: PSHY ; save nofZeroOuts 149 | #if defined(FAR_DATA) 150 | LDAB 1,X+ ; load page of destination address 151 | LDY 2,X+ ; load offset of destination address 152 | #if defined(__HCS12X__) 153 | STAB __GPAGE_ADR__ 154 | #else /* defined(__HCS12X__) */ 155 | __PIC_JSR(_SET_PAGE) ; sets the page in the correct page register 156 | #endif /* defined(__HCS12X__) */ 157 | #else /* FAR_DATA */ 158 | LDY 2,X+ ; start address and advance *pZeroOut (X = X+4) 159 | #endif /* FAR_DATA */ 160 | 161 | #if defined(__HCS12X__) && defined(FAR_DATA) 162 | PSHX 163 | LDX 0,X ; byte count 164 | #if defined(__OPTIMIZE_FOR_SIZE__) 165 | CLRA 166 | NextWord: GSTAA 1,Y+ ; clear memory byte 167 | __FEED_COP_IN_HLI() ; feed the COP if necessary /*lint !e505 !e522 asm code */ 168 | DBNE X, NextWord ; dec byte count 169 | #else 170 | LDD #0 171 | LSRX 172 | BEQ LoopClrW1 ; do we copy more than 1 byte? 173 | NextWord: GSTD 2,Y+ ; clear memory word 174 | __FEED_COP_IN_HLI() ; feed the COP if necessary /*lint !e505 !e522 asm code */ 175 | DBNE X, NextWord ; dec word count 176 | LoopClrW1: 177 | BCC LastClr ; handle last byte 178 | GSTAA 1,Y+ ; handle last byte 179 | LastClr: 180 | #endif 181 | PULX 182 | LEAX 2,X 183 | #elif defined(__OPTIMIZE_FOR_SIZE__) /* -os, default */ 184 | LDD 2,X+ ; byte count 185 | NextWord: CLR 1,Y+ ; clear memory byte 186 | __FEED_COP_IN_HLI() ; feed the COP if necessary /*lint !e505 !e522 asm code */ 187 | DBNE D, NextWord ; dec byte count 188 | #else /* __OPTIMIZE_FOR_TIME__ */ 189 | LDD 2,X+ ; byte count 190 | LSRD ; /2 and save bit 0 in the carry 191 | BEQ LoopClrW1 ; do we copy more than 1 byte? 192 | PSHX 193 | LDX #0 194 | LoopClrW: STX 2,Y+ ; Word-Clear 195 | __FEED_COP_IN_HLI() ; feed the COP if necessary /*lint !e505 !e522 asm code */ 196 | DBNE D, LoopClrW 197 | PULX 198 | LoopClrW1: 199 | BCC LastClr ; handle last byte 200 | CLR 1,Y+ 201 | LastClr: 202 | #endif /* __OPTIMIZE_FOR_SIZE__/__OPTIMIZE_FOR_TIME__ */ 203 | PULY ; restore nofZeroOuts 204 | DEY ; dec nofZeroOuts 205 | BNE NextZeroOut 206 | CopyDown: 207 | #if defined(__BANKED_COPY_DOWN) 208 | LDAA _startupData.toCopyDownBeg:0 ; get PAGE address of .copy section 209 | STAA __PPAGE_ADR__ ; set PPAGE address 210 | LDX _startupData.toCopyDownBeg:1 ; load address of copy down desc. 211 | #elif defined(__ELF_OBJECT_FILE_FORMAT__) 212 | LDX _startupData.toCopyDownBeg ; load address of copy down desc. 213 | #else 214 | LDX _startupData.toCopyDownBeg:2 ; load address of copy down desc. 215 | #endif 216 | NextBlock: 217 | LDD 2,X+ ; size of init-data -> D 218 | BEQ funcInits ; end of copy down desc. 219 | #ifdef FAR_DATA 220 | PSHD ; save counter 221 | LDAB 1,X+ ; load destination page 222 | LDY 2,X+ ; destination address 223 | #if defined(__HCS12X__) 224 | STAB __GPAGE_ADR__ 225 | #else /* __HCS12X__ */ 226 | __PIC_JSR(_SET_PAGE) ; sets the destinations page register 227 | #endif /* __HCS12X__ */ 228 | PULD ; restore counter 229 | #else /* FAR_DATA */ 230 | LDY 2,X+ ; load destination address 231 | #endif /* FAR_DATA */ 232 | 233 | #if defined(__HCS12X__) && defined(FAR_DATA) 234 | #if defined(__OPTIMIZE_FOR_SIZE__) /* -os, default */ 235 | Copy: PSHA 236 | LDAA 1,X+ 237 | GSTAA 1,Y+ ; move a byte from ROM to the data area 238 | PULA 239 | __FEED_COP_IN_HLI() ; feed the COP if necessary /*lint !e505 !e522 asm code */ 240 | DBNE D,Copy ; copy-byte loop 241 | #else 242 | LSRD ; /2 and save bit 0 in the carry 243 | BEQ Copy1 ; do we copy more than 1 byte? 244 | 245 | Copy: PSHD 246 | LDD 2,X+ 247 | GSTD 2,Y+ ; move a word from ROM to the data area 248 | PULD 249 | __FEED_COP_IN_HLI() ; feed the COP if necessary /*lint !e505 !e522 asm code */ 250 | DBNE D,Copy ; copy-word loop 251 | Copy1: 252 | BCC NextBlock ; handle last byte? 253 | LDAA 1,X+ 254 | GSTAA 1,Y+ ; move a byte from ROM to the data area 255 | #endif 256 | #elif defined(__OPTIMIZE_FOR_SIZE__) /* -os, default */ 257 | Copy: MOVB 1,X+,1,Y+ ; move a byte from ROM to the data area 258 | __FEED_COP_IN_HLI() ; feed the COP if necessary /*lint !e505 !e522 asm code */ 259 | DBNE D,Copy ; copy-byte loop 260 | #else /* __OPTIMIZE_FOR_TIME__ */ 261 | LSRD ; /2 and save bit 0 in the carry 262 | BEQ Copy1 ; do we copy more than 1 byte? 263 | Copy: MOVW 2,X+,2,Y+ ; move a word from ROM to the data area 264 | __FEED_COP_IN_HLI() ; feed the COP if necessary /*lint !e505 !e522 asm code */ 265 | DBNE D,Copy ; copy-word loop 266 | Copy1: 267 | BCC NextBlock ; handle last byte? 268 | MOVB 1,X+,1,Y+ ; copy the last byte 269 | #endif /* __OPTIMIZE_FOR_SIZE__/__OPTIMIZE_FOR_TIME__ */ 270 | BRA NextBlock 271 | funcInits: ; call of global construtors is only in c++ necessary 272 | #if defined(__cplusplus) 273 | #if defined(__ELF_OBJECT_FILE_FORMAT__) 274 | #if defined( __BANKED__) || defined(__LARGE__) 275 | LDY _startupData.nofInitBodies; load number of cpp. 276 | BEQ done ; if cppcount == 0, goto done 277 | LDX _startupData.initBodies ; load address of first module to initialize 278 | nextInit: 279 | LEAX 3,X ; increment to next init 280 | PSHX ; save address of next function to initialize 281 | PSHY ; save cpp counter 282 | CALL [-3,X] ; use double indirect call to load the page register also 283 | PULY ; restore cpp counter 284 | PULX ; restore actual address 285 | DEY ; decrement cpp counter 286 | BNE nextInit 287 | #else /* defined( __BANKED__) || defined(__LARGE__) */ 288 | 289 | LDD _startupData.nofInitBodies; load number of cpp. 290 | BEQ done ; if cppcount == 0, goto done 291 | LDX _startupData.initBodies ; load address of first module to initialize 292 | nextInit: 293 | LDY 2,X+ ; load address of first module to initialize 294 | PSHD 295 | PSHX ; save actual address 296 | JSR 0,Y ; call initialization function 297 | PULX ; restore actual address 298 | PULD ; restore cpp counter 299 | DBNE D, nextInit 300 | #endif /* defined( __BANKED__) || defined(__LARGE__) */ 301 | #else /* __ELF_OBJECT_FILE_FORMAT__ */ 302 | LDX _startupData.mInits ; load address of first module to initialize 303 | #if defined( __BANKED__) || defined(__LARGE__) 304 | nextInit: LDY 3,X+ ; load address of initialization function 305 | BEQ done ; stop when address == 0 306 | ; in common environments the offset of a function is never 0, so this test could be avoided 307 | #ifdef __InitFunctionsMayHaveOffset0__ 308 | BRCLR -1,X, done, 0xff ; stop when address == 0 309 | #endif /* __InitFunctionsMayHaveOffset0__ */ 310 | PSHX ; save address of next function to initialize 311 | CALL [-3,X] ; use double indirect call to load the page register also 312 | #else /* defined( __BANKED__) || defined(__LARGE__) */ 313 | nextInit: 314 | LDY 2,X+ ; load address of first module to initialize 315 | BEQ done ; stop when address of function == 0 316 | PSHX ; save actual address 317 | JSR 0,Y ; call initialization function 318 | #endif /* defined( __BANKED__) || defined(__LARGE__) */ 319 | PULX ; restore actual address 320 | BRA nextInit 321 | #endif /* __ELF_OBJECT_FILE_FORMAT__ */ 322 | done: 323 | #endif /* __cplusplus */ 324 | } 325 | } 326 | #endif /* __ONLY_INIT_SP */ 327 | 328 | #if defined( __ELF_OBJECT_FILE_FORMAT__) && defined(__cplusplus ) && 0 /* the call to main does not support to return anymore */ 329 | 330 | #if !defined(FAR_DATA) && (defined( __BANKED__) || defined(__LARGE__)) 331 | static void __far Fini(void) 332 | #else 333 | static void Fini(void) 334 | #endif 335 | { 336 | /* purpose: 1) call global destructors in C++ */ 337 | __asm { 338 | #if defined( __BANKED__) || defined(__LARGE__) 339 | 340 | LDY _startupData.nofFiniBodies; load number of cpp. 341 | BEQ done ; if cppcount == 0, goto done 342 | LDX _startupData.finiBodies ; load address of first module to finalize 343 | nextInit2: 344 | LEAX 3,X ; increment to next init 345 | PSHX ; save address of next function to finalize 346 | PSHY ; save cpp counter 347 | CALL [-3,X] ; use double indirect call to load the page register also 348 | PULY ; restore cpp counter 349 | PULX ; restore actual address 350 | DEY ; decrement cpp counter 351 | BNE nextInit2 352 | #else /* defined( __BANKED__) || defined(__LARGE__) */ 353 | 354 | LDD _startupData.nofFiniBodies; load number of cpp. 355 | BEQ done ; if cppcount == 0, goto done 356 | LDX _startupData.finiBodies ; load address of first module to finalize 357 | nextInit2: 358 | LDY 2,X+ ; load address of first module to finalize 359 | PSHD 360 | PSHX ; save actual address 361 | JSR 0,Y ; call finalize function 362 | PULX ; restore actual address 363 | PULD ; restore cpp counter 364 | DBNE D, nextInit2 365 | #endif /* defined(__BANKED__) || defined(__LARGE__) */ 366 | done:; 367 | } 368 | } 369 | #endif 370 | 371 | 372 | #include "non_bank.sgm" 373 | 374 | #pragma MESSAGE DISABLE C12053 /* Stack-pointer change not in debugging-information */ 375 | #pragma NO_FRAME 376 | #pragma NO_ENTRY 377 | #if !defined(__SMALL__) 378 | #pragma NO_EXIT 379 | #endif 380 | 381 | /* The function _Startup must be called in order to initialize global variables and to call main */ 382 | /* You can adapt this function or call it from your startup code to implement a different startup */ 383 | /* functionality. */ 384 | 385 | /* You should also setup the needed IO registers as WINDEF (HC12A4 only) or the COP registers to run */ 386 | /* on hardware */ 387 | 388 | /* to set the reset vector several ways are possible : */ 389 | /* 1. define the function with "interrupt 0" as done below in the first case */ 390 | /* 2. add the following line to your prm file : VECTOR ADDRESS 0xfffe _Startup */ 391 | /* of course, even more posibilities exists */ 392 | /* the reset vector must be set so that the application has a defined entry point */ 393 | 394 | #if defined(__SET_RESET_VECTOR__) 395 | __EXTERN_C void __interrupt 0 _Startup(void) { 396 | #else 397 | __EXTERN_C void _Startup(void) { 398 | #endif 399 | /* purpose: 1) initialize the stack 400 | 2) initialize the RAM, copy down init data etc (Init) 401 | 3) call main; 402 | parameters: NONE 403 | called from: _PRESTART-code generated by the Linker 404 | or directly referenced by the reset vector */ 405 | 406 | /* initialize the stack pointer */ 407 | INIT_SP_FROM_STARTUP_DESC(); /*lint !e522 asm code */ /* HLI macro definition in hidef.h */ 408 | 409 | #if defined(_HCS12_SERIALMON) 410 | /* for Monitor based software remap the RAM & EEPROM to adhere 411 | to EB386. Edit RAM and EEPROM sections in PRM file to match these. */ 412 | ___INITRG = 0x00; /* lock registers block to 0x0000 */ 413 | ___INITRM = 0x39; /* lock Ram to end at 0x3FFF */ 414 | ___INITEE = 0x09; /* lock EEPROM block to end at 0x0fff */ 415 | #endif 416 | 417 | /* Here user defined code could be inserted, the stack could be used */ 418 | #if defined(_DO_DISABLE_COP_) 419 | _DISABLE_COP(); 420 | #endif 421 | 422 | /* Example : Set up WinDef Register to allow Paging */ 423 | #ifdef HC812A4 /* HC12 A4 derivative needs WINDEF to configure which pages are available */ 424 | #if (__ENABLE_EPAGE__ != 0 || __ENABLE_DPAGE__ != 0 || __ENABLE_PPAGE__ != 0) 425 | WINDEF= __ENABLE_EPAGE__ | __ENABLE_DPAGE__ | __ENABLE_PPAGE__; 426 | #endif 427 | #endif 428 | 429 | #if (defined(__MAP_RAM__) || defined(__MAP_FLASH__) || defined(__MAP_EXTERNAL__)) && !defined(__DO_SET_MMCTL1__) 430 | #define __DO_SET_MMCTL1__ 431 | #endif 432 | 433 | 434 | #if defined(__DO_SET_MMCTL1__) 435 | /* Set the MMCTL1 byte. Please use for HCS12XE and change the bits according */ 436 | /* to your configuration. */ 437 | /* Note: MMCTL1 is write once therefore please adapt this initialization here. */ 438 | /* This has to be done prior to the call to Init. */ 439 | #define _MMCTL1_ADR (0x00000013) 440 | #define _MMCTL1_BIT_TGMRAMON (1<<7) /* EEE Tag RAM and FTM SCRATCH RAM visible in the memory map */ 441 | #define _MMCTL1_BIT_EEEIFRON (1<<5) /* EEE IFR visible in the memory map */ 442 | #define _MMCTL1_BIT_PGMIFRON (1<<4) /* Program IFR visible in the memory map */ 443 | #define _MMCTL1_BIT_RAMHM (1<<3) /* RAM only in the higher half of the memory map */ 444 | #define _MMCTL1_BIT_EROMON (1<<2) /* Enables emulated Flash or ROM memory in the memory map */ 445 | #define _MMCTL1_BIT_ROMHM (1<<1) /* FLASH or ROM only in higher Half of Memory Map */ 446 | #define _MMCTL1_BIT_ROMON (1<<0) /* Enable FLASH or ROM in the memory map */ 447 | 448 | #define _MMCTL1_SET(value) ((*(volatile unsigned char*)_MMCTL1_ADR)= (value)) 449 | 450 | #if defined(__MAP_FLASH__) 451 | _MMCTL1_SET(_MMCTL1_BIT_ROMON | _MMCTL1_BIT_EROMON); 452 | #elif defined(__MAP_EXTERNAL__) 453 | _MMCTL1_SET(_MMCTL1_BIT_ROMON | _MMCTL1_BIT_EROMON | _MMCTL1_BIT_ROMHM); 454 | #else /* RAM */ 455 | _MMCTL1_SET(_MMCTL1_BIT_ROMON | _MMCTL1_BIT_EROMON | _MMCTL1_BIT_RAMHM | _MMCTL1_BIT_ROMHM); 456 | #endif 457 | #endif 458 | 459 | #ifndef __ONLY_INIT_SP 460 | Init(); /* zero out, copy down, call constructors */ 461 | #endif 462 | 463 | /* Here user defined code could be inserted, all global variables are initilized */ 464 | #if defined(_DO_ENABLE_COP_) 465 | _ENABLE_COP(1); 466 | #endif 467 | 468 | /* call main() */ 469 | main(); 470 | } 471 | -------------------------------------------------------------------------------- /Sources/SureLocation.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Sources/SureLocation.c -------------------------------------------------------------------------------- /Sources/SureLocation.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Sources/SureLocation.h -------------------------------------------------------------------------------- /Sources/base.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Sources/base.c -------------------------------------------------------------------------------- /Sources/base.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Sources/base.h -------------------------------------------------------------------------------- /Sources/datapage.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | FILE : datapage.c 3 | PURPOSE : paged data access runtime routines 4 | MACHINE : Freescale 68HC12 (Target) 5 | LANGUAGE : ANSI-C 6 | HISTORY : 21.7.96 first version created 7 | ******************************************************************************/ 8 | 9 | #include "hidef.h" 10 | 11 | #include "non_bank.sgm" 12 | #include "runtime.sgm" 13 | 14 | 15 | 16 | #ifndef __HCS12X__ /* it's different for the HCS12X. See the text below at the #else // __HCS12X__ */ 17 | 18 | /* 19 | According to the -Cp option of the compiler the 20 | __DPAGE__, __PPAGE__ and __EPAGE__ macros are defined. 21 | If none of them is given as argument, then no page accesses should occur and 22 | this runtime routine should not be used ! 23 | To be on the save side, the runtime routines are created anyway. 24 | If some of the -Cp options are given an adapted versions which only covers the 25 | needed cases is produced. 26 | */ 27 | 28 | /* if no compiler option -Cp is given, it is assumed that all possible are given : */ 29 | 30 | /* Compile with option -DHCS12 to activate this code */ 31 | #if defined(HCS12) || defined(_HCS12) || defined(__HCS12__) /* HCS12 family has PPAGE register only at 0x30 */ 32 | #define PPAGE_ADDR (0x30+REGISTER_BASE) 33 | #ifndef __PPAGE__ /* may be set already by option -CPPPAGE */ 34 | #define __PPAGE__ 35 | #endif 36 | /* Compile with option -DDG128 to activate this code */ 37 | #elif defined DG128 /* HC912DG128 derivative has PPAGE register only at 0xFF */ 38 | #define PPAGE_ADDR (0xFF+REGISTER_BASE) 39 | #ifndef __PPAGE__ /* may be set already by option -CPPPAGE */ 40 | #define __PPAGE__ 41 | #endif 42 | #elif defined(HC812A4) 43 | /* all setting default to A4 already */ 44 | #endif 45 | 46 | 47 | #if !defined(__EPAGE__) && !defined(__PPAGE__) && !defined(__DPAGE__) 48 | /* as default use all page registers */ 49 | #define __DPAGE__ 50 | #define __EPAGE__ 51 | #define __PPAGE__ 52 | #endif 53 | 54 | /* modify the following defines to your memory configuration */ 55 | 56 | #define EPAGE_LOW_BOUND 0x400u 57 | #define EPAGE_HIGH_BOUND 0x7ffu 58 | 59 | #define DPAGE_LOW_BOUND 0x7000u 60 | #define DPAGE_HIGH_BOUND 0x7fffu 61 | 62 | #define PPAGE_LOW_BOUND (DPAGE_HIGH_BOUND+1) 63 | #define PPAGE_HIGH_BOUND 0xBFFFu 64 | 65 | #define REGISTER_BASE 0x0u 66 | #ifndef DPAGE_ADDR 67 | #define DPAGE_ADDR (0x34u+REGISTER_BASE) 68 | #endif 69 | #ifndef EPAGE_ADDR 70 | #define EPAGE_ADDR (0x36u+REGISTER_BASE) 71 | #endif 72 | #ifndef PPAGE_ADDR 73 | #define PPAGE_ADDR (0x35u+REGISTER_BASE) 74 | #endif 75 | 76 | /* 77 | The following parts about the defines are assumed in the code of _GET_PAGE_REG : 78 | - the memory region controlled by DPAGE is above the area controlled by the EPAGE and 79 | below the area controlled by the PPAGE. 80 | - the lower bound of the PPAGE area is equal to be the higher bound of the DPAGE area + 1 81 | */ 82 | #if EPAGE_LOW_BOUND >= EPAGE_HIGH_BOUND || EPAGE_HIGH_BOUND >= DPAGE_LOW_BOUND || DPAGE_LOW_BOUND >= DPAGE_HIGH_BOUND || DPAGE_HIGH_BOUND >= PPAGE_LOW_BOUND || PPAGE_LOW_BOUND >= PPAGE_HIGH_BOUND 83 | #error /* please adapt _GET_PAGE_REG for this non default page configuration */ 84 | #endif 85 | 86 | #if DPAGE_HIGH_BOUND+1 != PPAGE_LOW_BOUND 87 | #error /* please adapt _GET_PAGE_REG for this non default page configuration */ 88 | #endif 89 | 90 | 91 | /* this module does either control if any access is in the bounds of the specified page or */ 92 | /* ,if only one page is specified, just use this page. */ 93 | /* This behavior is controlled by the define USE_SEVERAL_PAGES. */ 94 | /* If !USE_SEVERAL_PAGES does increase the performance significantly */ 95 | /* NOTE : When !USE_SEVERAL_PAGES, the page is also set for accesses outside of the area controlled */ 96 | /* by this single page. But this is should not cause problems because the page is restored to the old value before any other access could occur */ 97 | 98 | #if !defined(__DPAGE__) && !defined(__EPAGE__) && !defined(__PPAGE__) 99 | /* no page at all is specified */ 100 | /* only specifying the right pages will speed up these functions a lot */ 101 | #define USE_SEVERAL_PAGES 1 102 | #elif defined(__DPAGE__) && defined(__EPAGE__) || defined(__DPAGE__) && defined(__PPAGE__) || defined(__EPAGE__) && defined(__PPAGE__) 103 | /* more than one page register is used */ 104 | #define USE_SEVERAL_PAGES 1 105 | #else 106 | 107 | #define USE_SEVERAL_PAGES 0 108 | 109 | #if defined(__DPAGE__) /* check which pages are used */ 110 | #define PAGE_ADDR PPAGE_ADDR 111 | #elif defined(__EPAGE__) 112 | #define PAGE_ADDR EPAGE_ADDR 113 | #elif defined(__PPAGE__) 114 | #define PAGE_ADDR PPAGE_ADDR 115 | #else /* we do not know which page, decide it at runtime */ 116 | #error /* must not happen */ 117 | #endif 118 | 119 | #endif 120 | 121 | 122 | #if USE_SEVERAL_PAGES /* only needed for several pages support */ 123 | /*--------------------------- _GET_PAGE_REG -------------------------------- 124 | Runtime routine to detect the right register depending on the 16 bit offset part 125 | of an address. 126 | This function is only used by the functions below. 127 | 128 | Depending on the compiler options -Cp different versions of _GET_PAGE_REG are produced. 129 | 130 | Arguments : 131 | - Y : offset part of an address 132 | 133 | Result : 134 | if address Y is controlled by a page register : 135 | - X : address of page register if Y is controlled by an page register 136 | - Zero flag cleared 137 | - all other registers remain unchanged 138 | 139 | if address Y is not controlled by a page register : 140 | - Zero flag is set 141 | - all registers remain unchanged 142 | 143 | --------------------------- _GET_PAGE_REG ----------------------------------*/ 144 | 145 | #if defined(__DPAGE__) 146 | 147 | #ifdef __cplusplus 148 | extern "C" 149 | #endif 150 | #pragma NO_ENTRY 151 | #pragma NO_EXIT 152 | #pragma NO_FRAME 153 | 154 | static void NEAR _GET_PAGE_REG(void) { /*lint -esym(528, _GET_PAGE_REG) used in asm code */ 155 | __asm { 156 | L_DPAGE: 157 | CPY #DPAGE_LOW_BOUND ;// test of lower bound of DPAGE 158 | #if defined(__EPAGE__) 159 | BLO L_EPAGE ;// EPAGE accesses are possible 160 | #else 161 | BLO L_NOPAGE ;// no paged memory below accesses 162 | #endif 163 | CPY #DPAGE_HIGH_BOUND ;// test of higher bound DPAGE/lower bound PPAGE 164 | #if defined(__PPAGE__) 165 | BHI L_PPAGE ;// EPAGE accesses are possible 166 | #else 167 | BHI L_NOPAGE ;// no paged memory above accesses 168 | #endif 169 | FOUND_DPAGE: 170 | LDX #DPAGE_ADDR ;// load page register address and clear zero flag 171 | RTS 172 | 173 | #if defined(__PPAGE__) 174 | L_PPAGE: 175 | CPY #PPAGE_HIGH_BOUND ;// test of higher bound of PPAGE 176 | BHI L_NOPAGE 177 | FOUND_PPAGE: 178 | LDX #PPAGE_ADDR ;// load page register address and clear zero flag 179 | RTS 180 | #endif 181 | 182 | #if defined(__EPAGE__) 183 | L_EPAGE: 184 | CPY #EPAGE_LOW_BOUND ;// test of lower bound of EPAGE 185 | BLO L_NOPAGE 186 | CPY #EPAGE_HIGH_BOUND ;// test of higher bound of EPAGE 187 | BHI L_NOPAGE 188 | 189 | FOUND_EPAGE: 190 | LDX #EPAGE_ADDR ;// load page register address and clear zero flag 191 | RTS 192 | #endif 193 | 194 | L_NOPAGE: 195 | ORCC #0x04 ;// sets zero flag 196 | RTS 197 | } 198 | } 199 | 200 | #else /* !defined(__DPAGE__) */ 201 | 202 | #if defined( __PPAGE__ ) 203 | 204 | #ifdef __cplusplus 205 | extern "C" 206 | #endif 207 | #pragma NO_ENTRY 208 | #pragma NO_EXIT 209 | #pragma NO_FRAME 210 | 211 | static void NEAR _GET_PAGE_REG(void) { /*lint -esym(528, _GET_PAGE_REG) used in asm code */ 212 | __asm { 213 | L_PPAGE: 214 | CPY #PPAGE_LOW_BOUND ;// test of lower bound of PPAGE 215 | #if defined( __EPAGE__ ) 216 | BLO L_EPAGE 217 | #else 218 | BLO L_NOPAGE ;// no paged memory below 219 | #endif 220 | CPY #PPAGE_HIGH_BOUND ;// test of higher bound PPAGE 221 | BHI L_NOPAGE 222 | FOUND_PPAGE: 223 | LDX #PPAGE_ADDR ;// load page register address and clear zero flag 224 | RTS 225 | #if defined( __EPAGE__ ) 226 | L_EPAGE: 227 | CPY #EPAGE_LOW_BOUND ;// test of lower bound of EPAGE 228 | BLO L_NOPAGE 229 | CPY #EPAGE_HIGH_BOUND ;// test of higher bound of EPAGE 230 | BHI L_NOPAGE 231 | FOUND_EPAGE: 232 | LDX #EPAGE_ADDR ;// load page register address and clear zero flag 233 | RTS 234 | #endif 235 | 236 | L_NOPAGE: ;// not in any allowed page area 237 | ;// its a far access to a non paged variable 238 | ORCC #0x04 ;// sets zero flag 239 | RTS 240 | } 241 | } 242 | 243 | #else /* !defined(__DPAGE__ ) && !defined( __PPAGE__) */ 244 | #if defined(__EPAGE__) 245 | 246 | #ifdef __cplusplus 247 | extern "C" 248 | #endif 249 | #pragma NO_ENTRY 250 | #pragma NO_EXIT 251 | #pragma NO_FRAME 252 | 253 | static void NEAR _GET_PAGE_REG(void) { /*lint -esym(528, _GET_PAGE_REG) used in asm code */ 254 | __asm { 255 | L_EPAGE: 256 | CPY #EPAGE_LOW_BOUND ;// test of lower bound of EPAGE 257 | BLO L_NOPAGE 258 | CPY #EPAGE_HIGH_BOUND ;// test of higher bound of EPAGE 259 | BHI L_NOPAGE 260 | FOUND_EPAGE: 261 | LDX #EPAGE_ADDR ;// load page register address and clear zero flag 262 | RTS 263 | 264 | L_NOPAGE: ;// not in any allowed page area 265 | ;// its a far access to a non paged variable 266 | ORCC #0x04 ;// sets zero flag 267 | RTS 268 | } 269 | } 270 | 271 | #endif /* defined(__EPAGE__) */ 272 | #endif /* defined(__PPAGE__) */ 273 | #endif /* defined(__DPAGE__) */ 274 | 275 | #endif /* USE_SEVERAL_PAGES */ 276 | 277 | /*--------------------------- _SET_PAGE -------------------------------- 278 | Runtime routine to set the right page register. This routine is used if the compiler 279 | does not know the right page register, i.e. if the option -Cp is used for more than 280 | one page register or if the runtime option is used for one of the -Cp options. 281 | 282 | Arguments : 283 | - offset part of an address in the Y register 284 | - page part of an address in the B register 285 | 286 | Result : 287 | - page part written into the correct page register. 288 | - the old page register content is destroyed 289 | - all processor registers remains unchanged 290 | --------------------------- _SET_PAGE ----------------------------------*/ 291 | 292 | #ifdef __cplusplus 293 | extern "C" 294 | #endif 295 | #pragma NO_ENTRY 296 | #pragma NO_EXIT 297 | #pragma NO_FRAME 298 | 299 | void NEAR _SET_PAGE(void) { 300 | #if USE_SEVERAL_PAGES 301 | __asm { 302 | PSHX ;// save X register 303 | __PIC_JSR(_GET_PAGE_REG) 304 | BEQ L_NOPAGE 305 | STAB 0,X ;// set page register 306 | L_NOPAGE: 307 | PULX ;// restore X register 308 | RTS 309 | } 310 | #else /* USE_SEVERAL_PAGES */ 311 | __asm { 312 | STAB PAGE_ADDR ;// set page register 313 | RTS 314 | } 315 | #endif /* USE_SEVERAL_PAGES */ 316 | } 317 | 318 | /*--------------------------- _LOAD_FAR_8 -------------------------------- 319 | This runtime routine is used to access paged memory via a runtime function. 320 | It may also be used if the compiler option -Cp is not used with the runtime argument. 321 | 322 | Arguments : 323 | - offset part of an address in the Y register 324 | - page part of an address in the B register 325 | 326 | Result : 327 | - value to be read in the B register 328 | - all other registers remains unchanged 329 | - all page register still contain the same value 330 | --------------------------- _LOAD_FAR_8 ----------------------------------*/ 331 | 332 | #ifdef __cplusplus 333 | extern "C" 334 | #endif 335 | #pragma NO_ENTRY 336 | #pragma NO_EXIT 337 | #pragma NO_FRAME 338 | 339 | void NEAR _LOAD_FAR_8(void) { 340 | #if USE_SEVERAL_PAGES 341 | __asm { 342 | PSHX ;// save X register 343 | __PIC_JSR(_GET_PAGE_REG) 344 | BEQ L_NOPAGE 345 | PSHA ;// save A register 346 | LDAA 0,X ;// save page register 347 | STAB 0,X ;// set page register 348 | LDAB 0,Y ;// actual load, overwrites page 349 | STAA 0,X ;// restore page register 350 | PULA ;// restore A register 351 | PULX ;// restore X register 352 | RTS 353 | L_NOPAGE: 354 | LDAB 0,Y ;// actual load, overwrites page 355 | PULX ;// restore X register 356 | RTS 357 | } 358 | #else /* USE_SEVERAL_PAGES */ 359 | __asm { 360 | PSHA ;// save A register 361 | LDAA PAGE_ADDR ;// save page register 362 | STAB PAGE_ADDR ;// set page register 363 | LDAB 0,Y ;// actual load, overwrites page 364 | STAA PAGE_ADDR ;// restore page register 365 | PULA ;// restore A register 366 | RTS 367 | } 368 | #endif /* USE_SEVERAL_PAGES */ 369 | } 370 | 371 | /*--------------------------- _LOAD_FAR_16 -------------------------------- 372 | This runtime routine is used to access paged memory via a runtime function. 373 | It may also be used if the compiler option -Cp is not used with the runtime argument. 374 | 375 | Arguments : 376 | - offset part of an address in the Y register 377 | - page part of an address in the B register 378 | 379 | Result : 380 | - value to be read in the Y register 381 | - all other registers remains unchanged 382 | - all page register still contain the same value 383 | --------------------------- _LOAD_FAR_16 ----------------------------------*/ 384 | 385 | #ifdef __cplusplus 386 | extern "C" 387 | #endif 388 | #pragma NO_ENTRY 389 | #pragma NO_EXIT 390 | #pragma NO_FRAME 391 | 392 | void NEAR _LOAD_FAR_16(void) { 393 | #if USE_SEVERAL_PAGES 394 | __asm { 395 | PSHX ;// save X register 396 | __PIC_JSR(_GET_PAGE_REG) 397 | BEQ L_NOPAGE 398 | PSHA ;// save A register 399 | LDAA 0,X ;// save page register 400 | STAB 0,X ;// set page register 401 | LDY 0,Y ;// actual load, overwrites address 402 | STAA 0,X ;// restore page register 403 | PULA ;// restore A register 404 | PULX ;// restore X register 405 | RTS 406 | L_NOPAGE: 407 | LDY 0,Y ;// actual load, overwrites address 408 | PULX ;// restore X register 409 | RTS 410 | } 411 | #else /* USE_SEVERAL_PAGES */ 412 | __asm { 413 | PSHA ;// save A register 414 | LDAA PAGE_ADDR ;// save page register 415 | STAB PAGE_ADDR ;// set page register 416 | LDY 0,Y ;// actual load, overwrites address 417 | STAA PAGE_ADDR ;// restore page register 418 | PULA ;// restore A register 419 | RTS 420 | } 421 | #endif /* USE_SEVERAL_PAGES */ 422 | } 423 | /*--------------------------- _LOAD_FAR_24 -------------------------------- 424 | This runtime routine is used to access paged memory via a runtime function. 425 | It may also be used if the compiler option -Cp is not used with the runtime argument. 426 | 427 | Arguments : 428 | - offset part of an address in the Y register 429 | - page part of an address in the B register 430 | 431 | Result : 432 | - value to be read in the Y:B registers 433 | - all other registers remains unchanged 434 | - all page register still contain the same value 435 | --------------------------- _LOAD_FAR_24 ----------------------------------*/ 436 | 437 | #ifdef __cplusplus 438 | extern "C" 439 | #endif 440 | #pragma NO_ENTRY 441 | #pragma NO_EXIT 442 | #pragma NO_FRAME 443 | 444 | void NEAR _LOAD_FAR_24(void) { 445 | #if USE_SEVERAL_PAGES 446 | __asm { 447 | PSHX ;// save X register 448 | __PIC_JSR(_GET_PAGE_REG) 449 | BEQ L_NOPAGE 450 | PSHA ;// save A register 451 | LDAA 0,X ;// save page register 452 | STAB 0,X ;// set page register 453 | LDAB 0,Y ;// actual load, overwrites page of address 454 | LDY 1,Y ;// actual load, overwrites offset of address 455 | STAA 0,X ;// restore page register 456 | PULA ;// restore A register 457 | PULX ;// restore X register 458 | RTS 459 | L_NOPAGE: 460 | LDAB 0,Y ;// actual load, overwrites page of address 461 | LDY 1,Y ;// actual load, overwrites offset of address 462 | PULX ;// restore X register 463 | RTS 464 | } 465 | #else /* USE_SEVERAL_PAGES */ 466 | __asm { 467 | PSHA ;// save A register 468 | LDAA PAGE_ADDR ;// save page register 469 | STAB PAGE_ADDR ;// set page register 470 | LDAB 0,Y ;// actual load, overwrites page of address 471 | LDY 1,Y ;// actual load, overwrites offset of address 472 | STAA PAGE_ADDR ;// restore page register 473 | PULA ;// restore A register 474 | RTS 475 | } 476 | #endif /* USE_SEVERAL_PAGES */ 477 | 478 | } 479 | 480 | /*--------------------------- _LOAD_FAR_32 -------------------------------- 481 | This runtime routine is used to access paged memory via a runtime function. 482 | It may also be used if the compiler option -Cp is not used with the runtime argument. 483 | 484 | Arguments : 485 | - offset part of an address in the Y register 486 | - page part of an address in the B register 487 | 488 | Result : 489 | - low 16 bit of value to be read in the D registers 490 | - high 16 bit of value to be read in the Y registers 491 | - all other registers remains unchanged 492 | - all page register still contain the same value 493 | --------------------------- _LOAD_FAR_32 ----------------------------------*/ 494 | 495 | #ifdef __cplusplus 496 | extern "C" 497 | #endif 498 | #pragma NO_ENTRY 499 | #pragma NO_EXIT 500 | #pragma NO_FRAME 501 | 502 | void NEAR _LOAD_FAR_32(void) { 503 | #if USE_SEVERAL_PAGES 504 | __asm { 505 | PSHX ;// save X register 506 | __PIC_JSR(_GET_PAGE_REG) 507 | BEQ L_NOPAGE 508 | LDAA 0,X ;// save page register 509 | PSHA ;// put it onto the stack 510 | STAB 0,X ;// set page register 511 | LDD 2,Y ;// actual load, low word 512 | LDY 0,Y ;// actual load, high word 513 | MOVB 1,SP+,0,X ;// restore page register 514 | PULX ;// restore X register 515 | RTS 516 | L_NOPAGE: 517 | LDD 2,Y ;// actual load, low word 518 | LDY 0,Y ;// actual load, high word 519 | PULX ;// restore X register 520 | RTS 521 | } 522 | #else /* USE_SEVERAL_PAGES */ 523 | __asm { 524 | LDAA PAGE_ADDR ;// save page register 525 | PSHA ;// put it onto the stack 526 | STAB PAGE_ADDR ;// set page register 527 | LDD 2,Y ;// actual load, low word 528 | LDY 0,Y ;// actual load, high word 529 | MOVB 1,SP+,PAGE_ADDR ;// restore page register 530 | RTS 531 | } 532 | #endif /* USE_SEVERAL_PAGES */ 533 | } 534 | 535 | /*--------------------------- _STORE_FAR_8 -------------------------------- 536 | This runtime routine is used to access paged memory via a runtime function. 537 | It may also be used if the compiler option -Cp is not used with the runtime argument. 538 | 539 | Arguments : 540 | - offset part of an address in the Y register 541 | - page part of an address in the B register 542 | - value to be stored in the B register 543 | 544 | Result : 545 | - value stored at the address 546 | - all registers remains unchanged 547 | - all page register still contain the same value 548 | --------------------------- _STORE_FAR_8 ----------------------------------*/ 549 | 550 | #ifdef __cplusplus 551 | extern "C" 552 | #endif 553 | #pragma NO_ENTRY 554 | #pragma NO_EXIT 555 | #pragma NO_FRAME 556 | 557 | void NEAR _STORE_FAR_8(void) { 558 | #if USE_SEVERAL_PAGES 559 | __asm { 560 | PSHX ;// save X register 561 | __PIC_JSR(_GET_PAGE_REG) 562 | BEQ L_NOPAGE 563 | PSHB ;// save B register 564 | LDAB 0,X ;// save page register 565 | MOVB 0,SP, 0,X ;// set page register 566 | STAA 0,Y ;// store the value passed in A 567 | STAB 0,X ;// restore page register 568 | PULB ;// restore B register 569 | PULX ;// restore X register 570 | RTS 571 | L_NOPAGE: 572 | STAA 0,Y ;// store the value passed in A 573 | PULX ;// restore X register 574 | RTS 575 | } 576 | #else /* USE_SEVERAL_PAGES */ 577 | __asm { 578 | PSHB ;// save A register 579 | LDAB PAGE_ADDR ;// save page register 580 | MOVB 0,SP,PAGE_ADDR ;// set page register 581 | STAA 0,Y ;// store the value passed in A 582 | STAB PAGE_ADDR ;// restore page register 583 | PULB ;// restore B register 584 | RTS 585 | } 586 | #endif /* USE_SEVERAL_PAGES */ 587 | } 588 | 589 | /*--------------------------- _STORE_FAR_16 -------------------------------- 590 | This runtime routine is used to access paged memory via a runtime function. 591 | It may also be used if the compiler option -Cp is not used with the runtime argument. 592 | 593 | Arguments : 594 | - offset part of an address in the Y register 595 | - page part of an address in the B register 596 | - value to be stored in the X register 597 | 598 | Result : 599 | - value stored at the address 600 | - all registers remains unchanged 601 | - all page register still contain the same value 602 | --------------------------- _STORE_FAR_16 ----------------------------------*/ 603 | 604 | #ifdef __cplusplus 605 | extern "C" 606 | #endif 607 | #pragma NO_ENTRY 608 | #pragma NO_EXIT 609 | #pragma NO_FRAME 610 | 611 | void NEAR _STORE_FAR_16(void) { 612 | #if USE_SEVERAL_PAGES 613 | __asm { 614 | PSHX ;// save X register 615 | __PIC_JSR(_GET_PAGE_REG) 616 | BEQ L_NOPAGE 617 | 618 | PSHA 619 | LDAA 0,X ;// save page register 620 | STAB 0,X ;// set page register 621 | MOVW 1,SP,0,Y ;// store the value passed in X 622 | STAA 0,X ;// restore page register 623 | PULA ;// restore A register 624 | PULX ;// restore X register 625 | RTS 626 | 627 | L_NOPAGE: 628 | STX 0,Y ;// store the value passed in X 629 | PULX ;// restore X register 630 | RTS 631 | } 632 | #else /* USE_SEVERAL_PAGES */ 633 | __asm { 634 | PSHA ;// save A register 635 | LDAA PAGE_ADDR ;// save page register 636 | STAB PAGE_ADDR ;// set page register 637 | STX 0,Y ;// store the value passed in X 638 | STAA PAGE_ADDR ;// restore page register 639 | PULA ;// restore A register 640 | RTS 641 | } 642 | #endif /* USE_SEVERAL_PAGES */ 643 | } 644 | /*--------------------------- _STORE_FAR_24 -------------------------------- 645 | This runtime routine is used to access paged memory via a runtime function. 646 | It may also be used if the compiler option -Cp is not used with the runtime argument. 647 | 648 | Arguments : 649 | - offset part of an address in the Y register 650 | - page part of an address in the B register 651 | - value to be stored in the X:A registers (X : low 16 bit, A : high 8 bit) 652 | 653 | Result : 654 | - value stored at the address 655 | - all registers remains unchanged 656 | - all page register still contain the same value 657 | --------------------------- _STORE_FAR_24 ----------------------------------*/ 658 | 659 | #ifdef __cplusplus 660 | extern "C" 661 | #endif 662 | #pragma NO_ENTRY 663 | #pragma NO_EXIT 664 | #pragma NO_FRAME 665 | 666 | void NEAR _STORE_FAR_24(void) { 667 | #if USE_SEVERAL_PAGES 668 | __asm { 669 | PSHX ;// save X register 670 | __PIC_JSR(_GET_PAGE_REG) 671 | BEQ L_NOPAGE 672 | 673 | PSHA 674 | LDAA 0,X ;// save page register 675 | STAB 0,X ;// set page register 676 | MOVW 1,SP, 1,Y ;// store the value passed in X 677 | MOVB 0,SP, 0,Y ;// store the value passed in A 678 | STAA 0,X ;// restore page register 679 | PULA ;// restore A register 680 | PULX ;// restore X register 681 | RTS 682 | 683 | L_NOPAGE: 684 | STX 1,Y ;// store the value passed in X 685 | STAA 0,Y ;// store the value passed in X 686 | PULX ;// restore X register 687 | RTS 688 | } 689 | #else /* USE_SEVERAL_PAGES */ 690 | __asm { 691 | PSHA ;// save A register 692 | LDAA PAGE_ADDR ;// save page register 693 | STAB PAGE_ADDR ;// set page register 694 | MOVB 0,SP, 0,Y ;// store the value passed in A 695 | STX 1,Y ;// store the value passed in X 696 | STAA PAGE_ADDR ;// restore page register 697 | PULA ;// restore A register 698 | RTS 699 | } 700 | #endif /* USE_SEVERAL_PAGES */ 701 | } 702 | /*--------------------------- _STORE_FAR_32 -------------------------------- 703 | This runtime routine is used to access paged memory via a runtime function. 704 | It may also be used if the compiler option -Cp is not used with the runtime argument. 705 | 706 | Arguments : 707 | - offset part of an address in the Y register 708 | - page part of an address is on the stack at 3,SP (just below the return address) 709 | - value to be stored in the X:D registers (D : low 16 bit, X : high 16 bit) 710 | 711 | Result : 712 | - value stored at the address 713 | - all registers remains unchanged 714 | - the page part is removed from the stack 715 | - all page register still contain the same value 716 | --------------------------- _STORE_FAR_32 ----------------------------------*/ 717 | 718 | #ifdef __cplusplus 719 | extern "C" 720 | #endif 721 | #pragma NO_ENTRY 722 | #pragma NO_EXIT 723 | #pragma NO_FRAME 724 | 725 | void NEAR _STORE_FAR_32(void) { 726 | #if USE_SEVERAL_PAGES 727 | __asm { 728 | PSHX ;// save X register 729 | __PIC_JSR(_GET_PAGE_REG) 730 | BEQ L_NOPAGE 731 | 732 | PSHD 733 | LDAA 0,X ;// save page register 734 | MOVB 6,SP, 0,X ;// set page register 735 | MOVW 2,SP, 0,Y ;// store the value passed in X (high word) 736 | MOVW 0,SP, 2,Y ;// store the value passed in D (low word) 737 | STAA 0,X ;// restore page register 738 | PULD ;// restore A register 739 | BRA done 740 | 741 | L_NOPAGE: 742 | MOVW 0,SP, 0,Y ;// store the value passed in X (high word) 743 | STD 2,Y ;// store the value passed in D (low word) 744 | done: 745 | PULX ;// restore X register 746 | MOVW 0,SP, 1,+SP ;// move return address 747 | RTS 748 | } 749 | #else /* USE_SEVERAL_PAGES */ 750 | __asm { 751 | PSHD ;// save D register 752 | LDAA PAGE_ADDR ;// save page register 753 | LDAB 4,SP ;// load page part of address 754 | STAB PAGE_ADDR ;// set page register 755 | STX 0,Y ;// store the value passed in X 756 | MOVW 0,SP, 2,Y ;// store the value passed in D (low word) 757 | STAA PAGE_ADDR ;// restore page register 758 | PULD ;// restore D register 759 | MOVW 0,SP, 1,+SP ;// move return address 760 | RTS 761 | } 762 | #endif /* USE_SEVERAL_PAGES */ 763 | } 764 | 765 | /*--------------------------- _FAR_COPY_RC -------------------------------- 766 | This runtime routine is used to access paged memory via a runtime function. 767 | It may also be used if the compiler option -Cp is not used with the runtime argument. 768 | 769 | Arguments : 770 | - offset part of the source int the X register 771 | - page part of the source in the A register 772 | - offset part of the dest int the Y register 773 | - page part of the dest in the B register 774 | - number of bytes to be copied is defined by the next 2 bytes after the return address. 775 | 776 | Result : 777 | - memory area copied 778 | - no registers are saved, i.e. all registers may be destroyed 779 | - all page register still contain the same value as before the call 780 | - the function returns after the constant defining the number of bytes to be copied 781 | 782 | 783 | stack-structure at the loop-label: 784 | 0,SP : destination offset 785 | 2,SP : source page 786 | 3,SP : destination page 787 | 4,SP : source offset 788 | 6,SP : points to length to be copied. This function returns after the size 789 | 790 | A usual call to this function looks like: 791 | 792 | struct Huge src, dest; 793 | ; ... 794 | LDX #src 795 | LDAA #PAGE(src) 796 | LDY #dest 797 | LDAB #PAGE(dest) 798 | JSR _FAR_COPY_RC 799 | DC.W sizeof(struct Huge) 800 | ; ... 801 | 802 | --------------------------- _FAR_COPY_RC ----------------------------------*/ 803 | 804 | #ifdef __cplusplus 805 | extern "C" 806 | #endif 807 | #pragma NO_ENTRY 808 | #pragma NO_EXIT 809 | #pragma NO_FRAME 810 | 811 | void NEAR _FAR_COPY_RC(void) { 812 | #if USE_SEVERAL_PAGES 813 | __asm { 814 | DEX ;// source addr-=1, because loop counter ends at 1 815 | PSHX ;// save source offset 816 | PSHD ;// save both pages 817 | DEY ;// destination addr-=1, because loop counter ends at 1 818 | PSHY ;// save destination offset 819 | LDY 6,SP ;// Load Return address 820 | LDX 2,Y+ ;// Load Size to copy 821 | STY 6,SP ;// Store adjusted return address 822 | loop: 823 | LDD 4,SP ;// load source offset 824 | LEAY D,X ;// calculate actual source address 825 | LDAB 2,SP ;// load source page 826 | __PIC_JSR(_LOAD_FAR_8) ;// load 1 source byte 827 | PSHB ;// save value 828 | LDD 0+1,SP ;// load destination offset 829 | LEAY D,X ;// calculate actual destination address 830 | PULA ;// restore value 831 | LDAB 3,SP ;// load destination page 832 | __PIC_JSR(_STORE_FAR_8) ;// store one byte 833 | DEX 834 | BNE loop 835 | LEAS 6,SP ;// release stack 836 | _SRET ;// debug info only: This is the last instr of a function with a special return 837 | RTS ;// return 838 | } 839 | #else 840 | __asm { 841 | PSHD ;// store page registers 842 | TFR X,D 843 | PSHY ;// temporary space 844 | LDY 4,SP ;// load return address 845 | ADDD 2,Y+ ;// calculate source end address. Increment return address 846 | STY 4,SP 847 | PULY 848 | PSHD ;// store src end address 849 | LDAB 2,SP ;// reload source page 850 | LDAA PAGE_ADDR ;// save page register 851 | PSHA 852 | loop: 853 | STAB PAGE_ADDR ;// set source page 854 | LDAA 1,X+ ;// load value 855 | MOVB 4,SP, PAGE_ADDR ;// set destination page 856 | STAA 1,Y+ 857 | CPX 1,SP 858 | BNE loop 859 | 860 | LDAA 5,SP+ ;// restore old page value and release stack 861 | STAA PAGE_ADDR ;// store it into page register 862 | _SRET ;// debug info only: This is the last instr of a function with a special return 863 | RTS 864 | } 865 | #endif 866 | } 867 | 868 | /*--------------------------- _FAR_COPY -------------------------------- 869 | 870 | The _FAR_COPY runtime routine was used to copied large memory blocks in previous compiler releases. 871 | However this release now does use _FAR_COPY_RC instead. The only difference is how the size of 872 | the area to be copied is passed into the function. For _FAR_COPY the size is passed on the stack just 873 | above the return address. _FAR_COPY_RC does expect the return address just after the JSR _FAR_COPY_RC call 874 | in the code of the caller. This allows for denser code calling _FAR_COPY_RC but does also need a slightly 875 | larger runtime routine and it is slightly slower. 876 | The _FAR_COPY routine is here now mainly for compatibility with previous releases. 877 | The current compiler does not use it. 878 | 879 | --------------------------- _FAR_COPY ----------------------------------*/ 880 | 881 | #ifdef __cplusplus 882 | extern "C" 883 | #endif 884 | #pragma NO_ENTRY 885 | #pragma NO_EXIT 886 | #pragma NO_FRAME 887 | 888 | void NEAR _FAR_COPY(void) { 889 | #if USE_SEVERAL_PAGES 890 | __asm { 891 | DEX ;// source addr-=1, because loop counter ends at 1 892 | PSHX ;// save source offset 893 | PSHD ;// save both pages 894 | DEY ;// destination addr-=1, because loop counter ends at 1 895 | PSHY ;// save destination offset 896 | LDX 8,SP ;// load counter, assuming counter > 0 897 | 898 | loop: 899 | LDD 4,SP ;// load source offset 900 | LEAY D,X ;// calculate actual source address 901 | LDAB 2,SP ;// load source page 902 | __PIC_JSR(_LOAD_FAR_8) ;// load 1 source byte 903 | PSHB ;// save value 904 | LDD 0+1,SP ;// load destination offset 905 | LEAY D,X ;// calculate actual destination address 906 | PULA ;// restore value 907 | LDAB 3,SP ;// load destination page 908 | __PIC_JSR(_STORE_FAR_8) ;// store one byte 909 | DEX 910 | BNE loop 911 | LDX 6,SP ;// load return address 912 | LEAS 10,SP ;// release stack 913 | JMP 0,X ;// return 914 | } 915 | #else 916 | __asm { 917 | PSHD ;// store page registers 918 | TFR X,D 919 | ADDD 4,SP ;// calculate source end address 920 | STD 4,SP 921 | PULB ;// reload source page 922 | LDAA PAGE_ADDR ;// save page register 923 | PSHA 924 | loop: 925 | STAB PAGE_ADDR ;// set source page 926 | LDAA 1,X+ ;// load value 927 | MOVB 1,SP, PAGE_ADDR ;// set destination page 928 | STAA 1,Y+ 929 | CPX 4,SP 930 | BNE loop 931 | 932 | LDAA 2,SP+ ;// restore old page value and release stack 933 | STAA PAGE_ADDR ;// store it into page register 934 | LDX 4,SP+ ;// release stack and load return address 935 | JMP 0,X ;// return 936 | } 937 | #endif 938 | } 939 | 940 | #else /* __HCS12X__ */ 941 | 942 | /* 943 | The HCS12X knows two different kind of addresses: 944 | - Logical addresses. E.g. 945 | MOVB #page(var),RPAGE 946 | INC var 947 | 948 | - Global addresses E.g. 949 | MOVB #page(var),GPAGE 950 | GLDAA var 951 | INCA 952 | GSTAA var 953 | 954 | Global addresses are used with G-Load's and G-Store's, logical addresses are used for all the other instructions 955 | and occasions. As HC12's or HCS12's do not have the G-Load and G-Store instructions, 956 | global addresses are not used with these processor families. 957 | They are only used with HCS12X chips (and maybe future ones deriving from a HCS12X). 958 | 959 | Logical and Global addresses can point to the same object, however the global and logical address of an object 960 | are different for most objects (actually for all except the registers from 0 to 0x7FF). 961 | Therefore the compiler needs to transform in between them. 962 | 963 | HCS12X Pointer types: 964 | 965 | The following are logical addresses: 966 | - all 16 bit pointers 967 | - "char* __near": always. 968 | - "char *" in the small and banked memory model 969 | - 24 bit dpage, epage, ppage or rpage pointers (*1) (note: the first HCS12X compilers may not support these pointer types) 970 | - "char *__dpage": Note this type only exists for 971 | orthogonality with the HC12 A4 chip which has a DPAGE reg. 972 | It does not apply to the HCS12X. 973 | - "char *__epage": 24 bit pointer using the EPAGE register 974 | - "char *__ppage": 24 bit pointer using the PPAGE register. 975 | As the PPAGE is also used for BANKED code, 976 | using this pointer type is only legal from non banked code. 977 | - "char *__rpage": 24 bit pointer using the RPAGE register 978 | 979 | 980 | The following are global addresses: 981 | "char*": in the large memory model (only HCS12X) 982 | "char* __far": always for HCS12X. 983 | 984 | (*1): For the HC12 and HCS12 "char* __far" and "char*" in the large memory model are also logical. 985 | 986 | Some notes for the HC12/HCS12 programmers. 987 | 988 | The address of a far object for a HC12 and for a HCS12X is different, even if they are at the same place in the memory map. 989 | For the HC12, a far address is using the logical addresses, for the HCS12X however, far addresses are using global addresses. 990 | This does cause troubles for the unaware! 991 | 992 | The conversion routines implemented in this file support the special HCS12XE RAM mapping (when RAMHM is set). 993 | To enable this mapping compile this file with the "-MapRAM" compiler option. 994 | 995 | HCS12X Logical Memory map 996 | 997 | Logical Addresses Used for shadowed at page register Global Address 998 | 999 | 0x000000 .. 0x0007FF Peripheral Registers Not Paged 0x000000 1000 | 0x??0800 .. 0x??0BFF Paged EEPROM EPAGE (@0x17) 0x100000+EPAGE*0x0400 1001 | 0x000C00 .. 0x000FFF Non Paged EEPROM 0xFF0800..0xFF0FFF Not Paged 0x13FC00 1002 | 0x??1000 .. 0x??1FFF Paged RAM RPAGE (@0x16) 0x000000+RPAGE*0x1000 1003 | 0x002000 .. 0x003FFF Non Paged RAM 0xFE1000..0xFF1FFF Not Paged 0x0FE000 1004 | 0x004000 .. 0x007FFF Non Paged FLASH 0xFC8000..0xFCBFFF Not Paged 0x7F4000 1005 | 0x??8000 .. 0x00BFFF Paged FLASH PPAGE (@0x30) 0x400000+PPAGE*0x4000 1006 | 0x00C000 .. 0x00FFFF Non Paged FLASH 0xFF8000..0xFFBFFF Not Paged 0x7FC000 1007 | 1008 | NA: Not Applicable 1009 | 1010 | HCS12X Global Memory map 1011 | 1012 | Global Addresses Used for Logical mapped at 1013 | 1014 | 0x000000 .. 0x0007FF Peripheral Registers 0x000000 .. 0x0007FF 1015 | 0x000800 .. 0x000FFF DMA registers Not mapped 1016 | 0x001000 .. 0x0FFFFF RAM 0x??1000 .. 0x??1FFF 1017 | 0x0FE000 .. 0x0FFFFF RAM, Log non paged 0x002000 .. 0x003FFF 1018 | 0x100000 .. 0x13FFFF EEPROM 0x??0800 .. 0x??0BFF 1019 | 0x13FC00 .. 0x13FFFF EEPROM non paged 0x000C00 .. 0x000FFF 1020 | 0x140000 .. 0x3FFFFF External Space Not mapped 1021 | 0x400000 .. 0x7FFFFF FLASH 0x??8000 .. 0x??BFFF 1022 | 0x7F4000 .. 0x7F7FFF FLASH, Log non paged 0x004000 .. 0x007FFF 1023 | 0x7FC000 .. 0x7FFFFF FLASH, Log non paged 0x00C000 .. 0x00FFFF 1024 | 1025 | HCS12XE Logical Memory map (with RAMHM set) 1026 | 1027 | Logical Addresses Used for shadowed at page register Global Address 1028 | 1029 | 0x000000 .. 0x0007FF Peripheral Registers Not Paged 0x000000 1030 | 0x??0800 .. 0x??0BFF Paged EEPROM EPAGE 0x100000+EPAGE*0x0400 1031 | 0x000C00 .. 0x000FFF Non Paged EEPROM 0xFF0800..0xFF0FFF Not Paged 0x13FC00 1032 | 0x??1000 .. 0x??1FFF Paged RAM RPAGE 0x000000+RPAGE*0x1000 1033 | 0x002000 .. 0x003FFF Non Paged RAM 0xFA1000..0xFB1FFF Not Paged 0x0FA000 1034 | 0x004000 .. 0x007FFF Non Paged RAM 0xFC1000..0xFF1FFF Not Paged 0x0FC000 1035 | 0x??8000 .. 0x00BFFF Paged FLASH PPAGE 0x400000+PPAGE*0x4000 1036 | 0x00C000 .. 0x00FFFF Non Paged FLASH 0xFF8000..0xFFBFFF Not Paged 0x7FC000 1037 | 1038 | NA: Not Applicable 1039 | 1040 | HCS12X Global Memory map (with RAMHM set) 1041 | 1042 | Global Addresses Used for Logical mapped at 1043 | 1044 | 0x000000 .. 0x0007FF Peripheral Registers 0x000000 .. 0x0007FF 1045 | 0x000800 .. 0x000FFF DMA registers Not mapped 1046 | 0x001000 .. 0x0FFFFF RAM 0x??1000 .. 0x??1FFF 1047 | 0x0FA000 .. 0x0FFFFF RAM, Log non paged 0x002000 .. 0x007FFF 1048 | 0x100000 .. 0x13FFFF EEPROM 0x??0800 .. 0x??0BFF 1049 | 0x13FC00 .. 0x13FFFF EEPROM non paged 0x000C00 .. 0x000FFF 1050 | 0x140000 .. 0x3FFFFF External Space Not mapped 1051 | 0x400000 .. 0x7FFFFF FLASH 0x??8000 .. 0x??BFFF 1052 | 0x7F4000 .. 0x7F7FFF FLASH, Log non paged Not mapped 1053 | 0x7FC000 .. 0x7FFFFF FLASH, Log non paged 0x00C000 .. 0x00FFFF 1054 | 1055 | 1056 | How to read this table: 1057 | For logical addresses, the lower 16 bits of the address do determine in which area the address is, 1058 | if this address is paged, then this entry also controls and which of the EPAGE, PPAGE or RPAGE 1059 | page register is controlling the bits 16 to 23 of the address. 1060 | For global addresses, the bits 16 to 23 have to be in the GPAGE register and the lower 16 bits 1061 | have to be used with the special G load or store instructions (e.g. GLDAA). 1062 | As example the logical address 0x123456 is invalid. Because its lower bits 0x3456 are in a 1063 | non paged area, so the page 0x12 does not exist. 1064 | The address 0xFE1020 however does exist. To access it, the RPAGE has to contain 0xFE and the 1065 | offset 0x1020 has to be used. 1066 | 1067 | ORG $7000 1068 | MOVB #0xFE, 0x16 ; RPAGE 1069 | LDAA 0x1020 ; reads at the logical address 0xFE1020 1070 | 1071 | Because the last two RAM pages are also accessible directly from 0x2000 to 0x3FFF, the 1072 | following shorter code does read the same memory location: 1073 | 1074 | ORG $7000 1075 | LDAA 0x2020 ; reads at the logical address 0x2020 1076 | ; which maps to the same memory as 0xFE1020 1077 | 1078 | This memory location also has a global address. For logical 0xFE1020 the global address is 0x0FE020. 1079 | So the following code does once more access the same memory location: 1080 | 1081 | ORG $7000 1082 | MOVB #0x0F, 0x10 ; GPAGE 1083 | GLDAA 0xE020 ; reads at the global address 0x0FE020 1084 | ; which maps to the same memory as the logical addr. 0xFE1020 1085 | 1086 | Therefore every memory location for the HCS12X has up to 3 different addresses. 1087 | Up to two logical and one global. 1088 | Notes. 1089 | - Not every address has a logical equivalent. The external space is only available in the global address space. 1090 | 1091 | - The PPAGE must only be set if the code is outside of the 0x8000 to 0xBFFF range. 1092 | If not, the next code fetch will be from the new wrong PPAGE value. 1093 | 1094 | - Inside of the paged area, the highest pages are allocated first. So all HCS12X's do have the FF pages 1095 | (if they have this memory type at all). 1096 | 1097 | - For RPAGE, the value 0 is illegal. Otherwise the global addresses would overlap with the registers. 1098 | 1099 | */ 1100 | 1101 | #if __OPTION_ACTIVE__("-MapRAM") 1102 | #define __HCS12XE_RAMHM_SET__ 1103 | #endif 1104 | 1105 | /*--------------------------- pointer conversion operations -------------------------------*/ 1106 | 1107 | /*--------------------------- _CONV_GLOBAL_TO_LOGICAL -------------------------------- 1108 | Convert 24 bit logical to 24 bit global pointer 1109 | ("char*__far" to "char*__gpage") 1110 | 1111 | Arguments : 1112 | - B : page part of global address 1113 | - X : 16 offset part of global address 1114 | 1115 | Postcondition : 1116 | - B == page of returned logical address 1117 | - X == offset of returned logical address 1118 | - Y remains unchanged 1119 | - A remains unchanged 1120 | */ 1121 | /*--------------------------- Convert 24 bit global to 24 bit logical pointer ----------------------------------*/ 1122 | 1123 | /* B:X = Logical(B:X) */ 1124 | #ifdef __cplusplus 1125 | extern "C" 1126 | #endif 1127 | 1128 | #pragma NO_FRAME 1129 | #pragma NO_ENTRY 1130 | #pragma NO_EXIT 1131 | 1132 | void NEAR _CONV_GLOBAL_TO_LOGICAL(void) { 1133 | __asm { 1134 | CMPB #0x40 ;// flash (0x400000..0x7FFFFF) or not? 1135 | BLO Below400000 1136 | // from 0x400000 to 0x7FFFFF 1137 | CMPB #0x7F ;// check for Unpaged areas 0x7FC000..0x7FFFFF and 0x7F4000..0x7F7FFF 1138 | BNE PAGED_FLASH_AREA 1139 | #ifndef __HCS12XE_RAMHM_SET__ 1140 | BITX #0x4000 1141 | BEQ PAGED_FLASH_AREA 1142 | #else 1143 | CPX #0xC000 1144 | BLO PAGED_FLASH_AREA 1145 | #endif 1146 | // from 0x7F4000 to 0x7F7FFF or 0x7FC000 to 0x7FFFFF 1147 | ;// Note: offset in X is already OK. 1148 | CLRB ;// logical page == 0 1149 | RTS 1150 | PAGED_FLASH_AREA: ;// paged flash. Map to 0x8000..0xBFFF 1151 | // from 0x400000 to 0x7F3FFF or 0x7F8000 to 0x7FBFFF 1152 | LSLX ; // shift 24 bit address 2 bits to the left to get correct page in B 1153 | ROLB 1154 | LSLX 1155 | ROLB 1156 | LSRX ; // shift back to get offset from 0x8000 to 0xBFFF 1157 | SEC 1158 | RORX 1159 | RTS ;// done 1160 | 1161 | Below400000: 1162 | // from 0x000000 to 0x3FFFFF 1163 | #if 0 /* How should we handle mapping to External Space. There is no logical equivalent. This is an error case! */ 1164 | CMPB #0x14 ;// check if above 0x140000. If so, its in the external space 1165 | BLO Below140000 1166 | ERROR !!!! ;// this mapping is not possible! What should we do? 1167 | RTS 1168 | Below140000: 1169 | // from 0x000000 to 0x13FFFF 1170 | #endif 1171 | CMPB #0x10 ;// if >= 0x100000 it's EEPROM 1172 | BLO Below100000 1173 | // from 0x100000 to 0x13FFFF (or 0x3FFFFF) 1174 | CMPB #0x13 ;// check if its is in the non paged EEPROM area at 0x13FC00..0x13FFFF 1175 | BLO Below13FC00 1176 | CPX #0xFC00 1177 | BLO Below13FC00 1178 | // from 0x13FC00 to 0x13FFFF (or 0x3FFFFF) 1179 | LEAX 0x1000,X ;// same as SUBX #0xF000 // map from 0xFC00 to 0x0C00 1180 | CLRB 1181 | RTS 1182 | Below13FC00: 1183 | // from 0x100000 to 0x13FBFF 1184 | PSHA 1185 | TFR XH,A ;// calculate logical page 1186 | EXG A,B 1187 | LSRD 1188 | LSRD 1189 | PULA 1190 | ANDX #0x03FF 1191 | LEAX 0x0800,X ;// same as ORX #0x0800 1192 | RTS 1193 | 1194 | Below100000: 1195 | // from 0x000000 to 0x0FFFFF 1196 | TSTB 1197 | BNE RAM_AREA 1198 | CPX #0x1000 1199 | BLO Below001000 1200 | RAM_AREA: 1201 | // from 0x001000 to 0x0FFFFF 1202 | CMPB #0x0F 1203 | BNE PagedRAM_AREA 1204 | #ifndef __HCS12XE_RAMHM_SET__ 1205 | CPX #0xE000 1206 | BLO PagedRAM_AREA 1207 | // from 0x0FE000 to 0x0FFFFF 1208 | SUBX #(0xE000-0x2000) ;// map 0xE000 to 0x2000 1209 | #else 1210 | CPX #0xA000 1211 | BLO PagedRAM_AREA 1212 | // from 0x0FA000 to 0x0FFFFF 1213 | SUBX #(0xA000-0x2000) ;// map 0xA000 to 0x2000 1214 | #endif 1215 | CLRB ;// Page is 0 1216 | RTS 1217 | PagedRAM_AREA: 1218 | // from 0x001000 to 0x0FDFFF 1219 | PSHA 1220 | TFR XH, A ;// calculate logical page 1221 | EXG A,B 1222 | LSRD 1223 | LSRD 1224 | LSRD 1225 | LSRD 1226 | PULA 1227 | 1228 | ANDX #0x0FFF 1229 | LEAX 0x1000,X ;// same as ORX #0x1000 1230 | RTS 1231 | 1232 | Below001000: 1233 | // from 0x000000 to 0x000FFF 1234 | #if 0 1235 | CMPA #0x08 1236 | BLO Below000800 1237 | // from 0x000800 to 0x000FFF 1238 | // ??? DMA Regs? 1239 | RTS 1240 | Below000800: 1241 | // from 0x000000 to 0x0007FF 1242 | #endif 1243 | CLRB 1244 | RTS 1245 | } 1246 | } 1247 | 1248 | /*--------------------------- _CONV_GLOBAL_TO_NEAR -------------------------------- 1249 | Convert 24 bit global to 16 bit logical pointer 1250 | ("char*__far" to "char*") 1251 | 1252 | Arguments : 1253 | - B : page part of global address 1254 | - X : 16 offset part of global address 1255 | 1256 | Postcondition : 1257 | - B is undefined 1258 | - A remains unchanged 1259 | - X == offset of returned logical address 1260 | - Y remains unchanged 1261 | */ 1262 | /*--------------------------- Convert 24 bit global to 16 bit logical pointer ----------------------------------*/ 1263 | 1264 | /* X = Logical(B:X) */ 1265 | 1266 | #ifdef __cplusplus 1267 | extern "C" 1268 | #endif 1269 | 1270 | #define _REUSE_CONV_GLOBAL_TO_LOGICAL 1 1271 | 1272 | #pragma NO_FRAME 1273 | #pragma NO_ENTRY 1274 | #pragma NO_EXIT 1275 | 1276 | void NEAR _CONV_GLOBAL_TO_NEAR(void){ 1277 | #if _REUSE_CONV_GLOBAL_TO_LOGICAL /* do we want an optimized version? */ 1278 | __asm JMP _CONV_GLOBAL_TO_LOGICAL; /* offset for NEAR is same as for LOGICAL. */ 1279 | #else 1280 | __asm { 1281 | CMPB #0x40 ;// flash (0x400000..0x7FFFFF) or not? 1282 | BLO Below400000 1283 | // from 0x400000 to 0x7FFFFF 1284 | #ifndef __HCS12XE_RAMHM_SET__ 1285 | CMPB #0x7F ;// check for Unpaged areas 0x7FC000..0x7FFFFF and 0x7F4000..0x7F7FFF 1286 | BNE PAGED_FLASH_AREA 1287 | CPX #0x4000 1288 | BLO PAGED_FLASH_AREA 1289 | // from 0x7F4000 to 0x7FFFFF 1290 | #else 1291 | CMPB #0x7F ;// check for Unpaged area 0x7FC000..0x7FFFFF 1292 | BNE PAGED_FLASH_AREA 1293 | CPX #0xC000 1294 | BLO PAGED_FLASH_AREA 1295 | // from 0x7FC000 to 0x7FFFFF 1296 | #endif 1297 | ;// note non PAGED flash areas or paged area 0x7F8000..0x7FBFFF which are mapping all correctly 1298 | RTS 1299 | PAGED_FLASH_AREA: ;// paged flash. Map to 0x8000..0xBFFF 1300 | // from 0x400000 to 0x7F3FFF 1301 | ANDX #0x3F00 ;// cut to 0.. 0x3FFF 1302 | LEAX 0x8000,X ;// same as ORX #0x8000 ;// move to 0x8000..0xBFFF 1303 | RTS ;// done 1304 | 1305 | Below400000: 1306 | // from 0x000000 to 0x3FFFFF 1307 | #if 0 /* How should we handle mapping to External Space. There is no logical equivalent. This is an error case! */ 1308 | CMPB #0x14 ;// check if above 0x140000. If so, its in the external space 1309 | BLO Below140000 1310 | ERROR !!!! ;// this mapping is not possible! What should we do? 1311 | RTS 1312 | Below140000: 1313 | // from 0x000000 to 0x13FFFF 1314 | #endif 1315 | CMPB #0x10 ;// if >= 0x100000 it's EEPROM 1316 | BLO Below100000 1317 | // from 0x100000 to 0x13FFFF (or 0x3FFFFF) 1318 | CMPB #0x13 ;// check if its is in the non paged EEPROM area at 0x13FC00..0x13FFFF 1319 | BNE Below13FC00 1320 | CPX #0xFC00 1321 | BLO Below13FC00 1322 | // from 0x13FC00 to 0x13FFFF (or 0x3FFFFF) 1323 | SUBX #0xF000 ;// map from 0xFC00 to 0x0C00 1324 | RTS 1325 | Below13FC00: 1326 | // from 0x100000 to 0x13FBFF 1327 | ANDX #0x03FF 1328 | LEAX 0x800,X ;// same as ORX #0x0800 1329 | RTS 1330 | 1331 | Below100000: 1332 | // from 0x000000 to 0x0FFFFF 1333 | TBNE B,RAM_AREA 1334 | CPX #0x1000 1335 | BLO Below001000 1336 | RAM_AREA: 1337 | // from 0x001000 to 0x0FFFFF 1338 | CMPB #0x0F 1339 | BNE PagedRAM_AREA 1340 | #ifndef __HCS12XE_RAMHM_SET__ 1341 | CPX #0xE000 1342 | BLO PagedRAM_AREA 1343 | // from 0x0FE000 to 0x0FFFFF 1344 | SUBX #(0xE000-0x2000) ;// map 0xE000 to 0x2000 1345 | #else 1346 | CPX #0xA000 1347 | BLO PagedRAM_AREA 1348 | // from 0x0FA000 to 0x0FFFFF 1349 | SUBX #(0xA000-0x2000) ;// map 0xA000 to 0x2000 1350 | #endif 1351 | RTS 1352 | PagedRAM_AREA: 1353 | // from 0x001000 to 0x0FDFFF (0x001000 to 0x0F9FFF if HCS12XE RAM mapping is enabled) 1354 | ANDX #0x0FFF 1355 | LEAX 0x1000,X ;// same as ORX #0x1000 1356 | RTS 1357 | 1358 | Below001000: 1359 | // from 0x000000 to 0x000FFF 1360 | RTS 1361 | } 1362 | #endif 1363 | } 1364 | 1365 | /*--------------------------- _CONV_NEAR_TO_GLOBAL -------------------------------- 1366 | Convert 16 bit logical to 24 bit global pointer 1367 | ("char*__near" to "char*__far") 1368 | 1369 | Arguments : 1370 | - X : 16 bit near pointer 1371 | 1372 | Postcondition : 1373 | - B == page of returned global address 1374 | - X == offset of returned global address 1375 | - Y remains unchanged 1376 | - A is unspecified 1377 | */ 1378 | /*--------------------------- Convert 16 bit logical to 24 bit global pointer ----------------------------------*/ 1379 | 1380 | /* B:X = Global(X) */ 1381 | 1382 | #ifdef __cplusplus 1383 | extern "C" 1384 | #endif 1385 | 1386 | #pragma NO_FRAME 1387 | #pragma NO_ENTRY 1388 | #pragma NO_EXIT 1389 | 1390 | void NEAR _CONV_NEAR_TO_GLOBAL(void){ 1391 | __asm { 1392 | // syntax: 1393 | // input 16 bit offset is bit15..bit0 1394 | // ppage values: ppage7..ppage0 1395 | // epage values: epage7..epage0 1396 | // dpage values: dpage7..dpage0 1397 | // rpage values: rpage7..rpage0 1398 | PSHX ;// D contains bit15..bit0 1399 | TFR X,D ;// D is cheaper to shift 1400 | LSLD ;// D contains 0 bit14..bit0, C contains bit15 1401 | BCC Below8000 ;// bit15 == 0? 1402 | // from 0x8000 to 0xFFFF 1403 | LSLD ;// D contains 00 bit13..bit0, C contains bit14 1404 | BCC BelowC000 1405 | LDAB #0x7F 1406 | PULX 1407 | RTS ;// returns 0b0111 1111 11 bit13...bit0 1408 | BelowC000: ;// from 0x8000 to 0xBFFF 1409 | TFR D,X 1410 | LDAB __PPAGE_ADR__ 1411 | SEC 1412 | RORB 1413 | RORX 1414 | LSRB 1415 | RORX 1416 | LEAS 2,SP 1417 | RTS ;// returns 0b01 ppage7..ppage0 bit13...bit0 1418 | Below8000: 1419 | LSLD ;// D contains 00 bit13..bit0, C contains bit14 1420 | BCC Below4000 1421 | // from 0x4000 to 0x7FFF 1422 | PULX 1423 | #ifndef __HCS12XE_RAMHM_SET__ 1424 | LDAB #0x7F 1425 | #else 1426 | LEAX (0xC000-0x4000),X 1427 | LDAB #0x0F 1428 | #endif 1429 | RTS ;// returns 0b0111 1111 01 bit13...bit0 1430 | 1431 | Below4000: 1432 | LSLD ;// D contains 000 bit12..bit0, C contains bit13 1433 | BCC Below2000 1434 | // from 0x2000 to 0x3FFF 1435 | PULX 1436 | #ifndef __HCS12XE_RAMHM_SET__ 1437 | LEAX (0xE000-0x2000),X 1438 | #else 1439 | LEAX (0xA000-0x2000),X 1440 | #endif 1441 | LDAB #0x0F 1442 | RTS ;// returns 0b0000 1111 111 bit12...bit0 1443 | 1444 | Below2000: 1445 | LSLD ;// D contains 0000 bit11..bit0, C contains bit12 1446 | BCC Below1000 1447 | // from 0x1000 to 0x1FFF 1448 | LDAB __RPAGE_ADR__ 1449 | LDAA #0x10 1450 | MUL 1451 | EORB 0,SP 1452 | EORB #0x10 ;// clear 1 bit 1453 | STAB 0,SP 1454 | TFR A,B 1455 | PULX 1456 | RTS 1457 | 1458 | Below1000: 1459 | LSLD ;// D contains 0000 0 bit10..bit0, C contains bit11 1460 | BCC Below0800 1461 | // from 0x0800 to 0x0FFF 1462 | LSLD ;// D contains 0000 00 bit9..bit0, C contains bit10 1463 | BCC Below0C00 1464 | // from 0x0C00 to 0x0FFF 1465 | LDAB #0x13 1466 | PULX 1467 | LEAX 0xF000,X 1468 | RTS ;// returns 0b0001 0011 1111 11 bit9...bit0 1469 | Below0C00: 1470 | // from 0x0800 to 0x0BFF 1471 | LDAB __EPAGE_ADR__ 1472 | LDAA #0x04 1473 | MUL 1474 | EORB 0,SP 1475 | EORB #0x08 1476 | STAB 0,SP 1477 | TFR A,B 1478 | ORAB #0b00010000 1479 | PULX 1480 | RTS 1481 | Below0800: 1482 | PULX 1483 | CLRB 1484 | RTS 1485 | } 1486 | } 1487 | 1488 | /*--------------------------- _CONV_STACK_NEAR_TO_GLOBAL -------------------------------- 1489 | Convert 16 bit logical of address on the stack 24 bit global pointer 1490 | ("char*__near" to "char*__far") 1491 | 1492 | Arguments : 1493 | - X : 16 bit near pointer 1494 | 1495 | Postcondition : 1496 | - B == page of returned global address 1497 | - X == offset of returned global address 1498 | - Y remains unchanged 1499 | - A is unspecified 1500 | */ 1501 | /*--------------------------- Convert 16 bit logical stack address to 24 bit global pointer ----------------------------------*/ 1502 | 1503 | /* B:X = Global(D) */ 1504 | 1505 | #ifdef __cplusplus 1506 | extern "C" 1507 | #endif 1508 | 1509 | #pragma NO_FRAME 1510 | #pragma NO_ENTRY 1511 | #pragma NO_EXIT 1512 | 1513 | void NEAR _CONV_STACK_NEAR_TO_GLOBAL(void){ 1514 | __asm { 1515 | // syntax: 1516 | // input 16 bit offset is bit15..bit0 1517 | // ppage values: ppage7..ppage0 1518 | // epage values: epage7..epage0 1519 | // dpage values: dpage7..dpage0 1520 | // rpage values: rpage7..rpage0 1521 | // stack must be between $1000 and $3FFF. 1522 | // actually placing the stack at $1000 implies that the RPAGE register is not set (and correctly initialized) 1523 | CPX #0x2000 1524 | BLO PAGED_RAM 1525 | // Map 0x2000 to 0x0FE000 (0x0FA000 for HCS12XE RAM mapping is enabled) 1526 | LDAB #0x0F 1527 | #ifndef __HCS12XE_RAMHM_SET__ 1528 | LEAX (0xE000-0x2000),X ;// LEAX is one cycle faster than ADDX # 1529 | #else 1530 | LEAX (0xA000-0x2000),X ;// LEAX is one cycle faster than ADDX # 1531 | #endif 1532 | RTS 1533 | PAGED_RAM: 1534 | PSHX 1535 | LDAB __RPAGE_ADR__ 1536 | LDAA #0x20 1537 | MUL 1538 | EORB 0,SP 1539 | EORB #0x10 ;// clear 1 bit 1540 | STAB 0,SP 1541 | TFR A,B 1542 | PULX 1543 | RTS 1544 | } 1545 | } 1546 | 1547 | 1548 | 1549 | /*--------------------------- _CONV_LOGICAL_TO_GLOBAL -------------------------------- 1550 | Convert 24 bit global to 24 bit logical pointer 1551 | ("char*__far" to "char*__gpage") 1552 | 1553 | Arguments : 1554 | - B : page part of logical address 1555 | - X : 16 offset part of logical address 1556 | 1557 | Postcondition : 1558 | - B == page of returned global address 1559 | - X == offset of returned global address 1560 | - Y remains unchanged 1561 | - A remains unchanged 1562 | */ 1563 | /*--------------------------- Convert 24 bit logical to 24 bit global pointer ----------------------------------*/ 1564 | 1565 | /* B:X = Logical(B:X) */ 1566 | 1567 | #ifdef __cplusplus 1568 | extern "C" 1569 | #endif 1570 | 1571 | #pragma NO_FRAME 1572 | #pragma NO_ENTRY 1573 | #pragma NO_EXIT 1574 | 1575 | void NEAR _CONV_LOGICAL_TO_GLOBAL(void) { 1576 | 1577 | __asm { 1578 | // syntax: 1579 | // input 16 bit offset is bit15..bit0 1580 | // ppage values: ppage7..ppage0 1581 | // epage values: epage7..epage0 1582 | // dpage values: dpage7..dpage0 1583 | // rpage values: rpage7..rpage0 1584 | PSHA ;// save A across this routine. 1585 | PSHX ;// D contains bit15..bit0 1586 | PSHB ;// store page 1587 | TFR X,D ;// D is cheaper to shift 1588 | LSLD ;// D contains 0 bit14..bit0, C contains bit15 1589 | BCC Below8000 ;// bit15 == 0? 1590 | // from 0x8000 to 0xFFFF 1591 | LSLD ;// D contains 00 bit13..bit0, C contains bit14 1592 | BCC BelowC000 1593 | PULB ;// cleanup stack 1594 | LDAB #0x7F 1595 | PULX 1596 | PULA 1597 | RTS ;// returns 0b0111 1111 11 bit13...bit0 1598 | BelowC000: ;// from 0x8000 to 0xBFFF 1599 | TFR D,X 1600 | PULB ;// cleanup stack 1601 | SEC 1602 | RORB 1603 | RORX 1604 | LSRB 1605 | RORX 1606 | LEAS 2,SP 1607 | PULA 1608 | RTS ;// returns 0b01 ppage7..ppage0 bit13...bit0 1609 | Below8000: 1610 | LSLD ;// D contains 00 bit13..bit0, C contains bit14 1611 | BCC Below4000 1612 | ;// from 0x4000 to 0x7FFF 1613 | PULB ;// cleanup stack 1614 | PULX 1615 | #ifndef __HCS12XE_RAMHM_SET__ 1616 | LDAB #0x7F 1617 | #else 1618 | LEAX (0xC000-0x4000),X 1619 | LDAB #0x0F 1620 | #endif 1621 | PULA 1622 | RTS ;// returns 0b0111 1111 01 bit13...bit0 1623 | 1624 | Below4000: 1625 | LSLD ;// D contains 000 bit12..bit0, C contains bit13 1626 | BCC Below2000 1627 | // from 0x2000 to 0x3FFF 1628 | PULB ;// cleanup stack 1629 | PULX 1630 | #ifndef __HCS12XE_RAMHM_SET__ 1631 | LEAX (0xE000-0x2000),X 1632 | #else 1633 | LEAX (0xA000-0x2000),X 1634 | #endif 1635 | LDAB #0x0F 1636 | PULA 1637 | RTS ;// returns 0b0000 1111 111 bit12...bit0 1638 | 1639 | Below2000: 1640 | LSLD ;// D contains 0000 bit11..bit0, C contains bit12 1641 | BCC Below1000 1642 | // from 0x1000 to 0x1FFF 1643 | PULB 1644 | LDAA #0x10 1645 | MUL 1646 | EORB 0,SP 1647 | EORB #0x10 ;// clear 1 bit 1648 | STAB 0,SP 1649 | TFR A,B 1650 | PULX 1651 | PULA 1652 | RTS 1653 | 1654 | Below1000: 1655 | LSLD ;// D contains 0000 0 bit10..bit0, C contains bit11 1656 | BCC Below0800 1657 | // from 0x0800 to 0x0FFF 1658 | LSLD ;// D contains 0000 00 bit9..bit0, C contains bit10 1659 | BCC Below0C00 1660 | // from 0x0C00 to 0x0FFF 1661 | PULB ;// cleanup stack 1662 | LDAB #0x13 1663 | PULX 1664 | LEAX 0xF000,X 1665 | PULA 1666 | RTS ;// returns 0b0001 0011 1111 11 bit9...bit0 1667 | Below0C00: 1668 | // from 0x0800 to 0x0BFF 1669 | PULB 1670 | LDAA #0x04 1671 | MUL 1672 | EORB 0,SP 1673 | EORB #0x08 1674 | STAB 0,SP 1675 | TFR A,B 1676 | ORAB #0b00010000 1677 | PULX 1678 | PULA 1679 | RTS 1680 | Below0800: 1681 | PULB 1682 | PULX 1683 | PULA 1684 | CLRB 1685 | RTS 1686 | } 1687 | } 1688 | 1689 | /*--------------------------- _FAR_COPY_RC HCS12X Routines -------------------------------- 1690 | copy larger far memory blocks 1691 | There are the following memory block copy routines: 1692 | _COPY : 16 bit logical copies. 1693 | Src and dest are both near. Note: implemented in rtshc12.c and not here. 1694 | _FAR_COPY_RC HC12/HCS12 struct copy routine. 1695 | Expects HC12/HCS12 logical 24 bit address. 1696 | Note: Does not exist for the HCS12X. 1697 | The HC12/HCS12 implementation is implemented above. 1698 | _FAR_COPY_GLOBAL_GLOBAL_RC: 1699 | _FAR_COPY_GLOBAL_LOGICAL_RC: 1700 | _FAR_COPY_LOGICAL_GLOBAL_RC: 1701 | _FAR_COPY_LOGICAL_LOGICAL_RC: 1702 | _FAR_COPY_NEAR_GLOBAL_RC: 1703 | _FAR_COPY_NEAR_LOGICAL_RC: 1704 | _FAR_COPY_GLOBAL_NEAR_RC: 1705 | _FAR_COPY_LOGICAL_NEAR_RC: HCS12X specific far copy routine. The name describes what the src/dest address format are. 1706 | All near src arguments are passed in X, all 24 bit src in X/B. 1707 | All near dest arguments are passed in Y, all 24 bit src in Y/A. 1708 | (Note: HC12 _FAR_COPY_RC is using X/A as src and Y/B as dest, so the register usage is not the same!) 1709 | 1710 | Arguments : 1711 | - B:X : src address (for NEAR/_COPY: only X) 1712 | - A:Y : dest address (for NEAR/_COPY: only Y) 1713 | - number of bytes to be copied behind return address (for _COPY: in D register). The number of bytes is always > 0 1714 | 1715 | Result : 1716 | - memory area copied 1717 | - no registers are saved, i.e. all registers may be destroyed 1718 | - for _COPY: D contains 0. 1719 | - for HCS12X _FAR_COPY_... routines: GPAGE state is unknown 1720 | */ 1721 | 1722 | 1723 | #ifdef __cplusplus 1724 | extern "C" 1725 | #endif 1726 | #pragma NO_ENTRY 1727 | #pragma NO_EXIT 1728 | #pragma NO_FRAME 1729 | 1730 | void NEAR _FAR_COPY_GLOBAL_GLOBAL_RC(void) { 1731 | __asm { 1732 | PSHD 1733 | PSHY 1734 | LDY 4,SP ;// load return address 1735 | LDD 2,Y+ ;// load size 1736 | STY 4,SP ;// store return address 1737 | PULY 1738 | PSHD 1739 | LDAB 3,SP 1740 | Loop: 1741 | STAB __GPAGE_ADR__ 1742 | GLDAA 1,X+ 1743 | MOVB 2,SP,__GPAGE_ADR__ 1744 | GSTAA 1,Y+ 1745 | DECW 0,SP 1746 | BNE Loop 1747 | LEAS 4,SP 1748 | _SRET ;// debug info only: This is the last instr of a function with a special return 1749 | RTS 1750 | } 1751 | } 1752 | 1753 | #ifdef __cplusplus 1754 | extern "C" 1755 | #endif 1756 | #pragma NO_ENTRY 1757 | #pragma NO_EXIT 1758 | #pragma NO_FRAME 1759 | 1760 | void NEAR _SET_PAGE_REG_HCS12X(void) { 1761 | // Sets the page contained in A to the register controlling the logical addr contained in X. 1762 | // saves the old page before and returns it in A together with the page address just below the return address. 1763 | // X/Y both remain valid. 1764 | __asm { 1765 | PSHX 1766 | // 0000..FFFF 1767 | CPX #0x8000 1768 | BLO _LO8000 1769 | LDX #__PPAGE_ADR__ 1770 | BRA Handle 1771 | _LO8000: 1772 | // 0000..7FFF 1773 | CPX #0x1000 1774 | BLO _LO1000 1775 | LDX #__RPAGE_ADR__ 1776 | BRA Handle 1777 | _LO1000: 1778 | LDX #__EPAGE_ADR__ 1779 | Handle: 1780 | LDAA 0,X ;// load old page register content 1781 | STAB 0,X ;// set new page register 1782 | STX 4,SP 1783 | PULX 1784 | RTS 1785 | } 1786 | } 1787 | 1788 | 1789 | #ifdef __cplusplus 1790 | extern "C" 1791 | #endif 1792 | #pragma NO_ENTRY 1793 | #pragma NO_EXIT 1794 | #pragma NO_FRAME 1795 | 1796 | void NEAR _FAR_COPY_GLOBAL_LOGICAL_RC(void) { 1797 | __asm { 1798 | STAB __GPAGE_ADR__ 1799 | EXG X,Y 1800 | TFR A,B 1801 | PSHY ;// space to store size 1802 | PSHX ;// allocate some space where _SET_PAGE_REG_HCS12X can return the page 1803 | LDY 4,SP ;// load return address 1804 | LDX 2,Y+ ;// load size 1805 | STY 4,SP 1806 | LDY 2,SP ;// restore dest pointer 1807 | STX 2,SP ;// store size 1808 | LDX 0,SP ;// reload src pointer 1809 | __PIC_JSR(_SET_PAGE_REG_HCS12X) 1810 | 1811 | Loop: GLDAB 1,Y+ 1812 | STAB 1,X+ 1813 | DECW 2,SP 1814 | BNE Loop 1815 | 1816 | PULX ;// reload page register address 1817 | STAA 0,X ;// restore old page content (necessary if it was PPAGE) 1818 | PULX ;// clean up stack 1819 | _SRET ;// debug info only: This is the last instr of a function with a special return 1820 | RTS 1821 | } 1822 | } 1823 | 1824 | #ifdef __cplusplus 1825 | extern "C" 1826 | #endif 1827 | #pragma NO_ENTRY 1828 | #pragma NO_EXIT 1829 | #pragma NO_FRAME 1830 | 1831 | void NEAR _FAR_COPY_LOGICAL_GLOBAL_RC(void) { 1832 | __asm { 1833 | STAA __GPAGE_ADR__ 1834 | PSHY ;// space to store size 1835 | PSHX ;// allocate some space where _SET_PAGE_REG_HCS12X can return the page 1836 | LDY 4,SP ;// load return address 1837 | LDX 2,Y+ ;// load size 1838 | STY 4,SP 1839 | LDY 2,SP ;// restore dest pointer 1840 | STX 2,SP ;// store size 1841 | LDX 0,SP ;// reload src pointer 1842 | 1843 | __PIC_JSR(_SET_PAGE_REG_HCS12X) 1844 | 1845 | Loop: LDAB 1,X+ 1846 | GSTAB 1,Y+ 1847 | DECW 2,SP 1848 | BNE Loop 1849 | 1850 | PULX 1851 | STAA 0,X ;// restore old page content (necessary if it was PPAGE) 1852 | PULX ;// clean up stack 1853 | _SRET ;// debug info only: This is the last instr of a function with a special return 1854 | RTS 1855 | } 1856 | } 1857 | 1858 | #ifdef __cplusplus 1859 | extern "C" 1860 | #endif 1861 | #pragma NO_ENTRY 1862 | #pragma NO_EXIT 1863 | #pragma NO_FRAME 1864 | 1865 | void NEAR _FAR_COPY_LOGICAL_LOGICAL_RC(void) { 1866 | __asm { 1867 | PSHA 1868 | __PIC_JSR(_CONV_LOGICAL_TO_GLOBAL); 1869 | PULA 1870 | __PIC_JMP(_FAR_COPY_GLOBAL_LOGICAL_RC); 1871 | } 1872 | } 1873 | 1874 | #ifdef __cplusplus 1875 | extern "C" 1876 | #endif 1877 | #pragma NO_ENTRY 1878 | #pragma NO_EXIT 1879 | #pragma NO_FRAME 1880 | 1881 | void NEAR _FAR_COPY_NEAR_GLOBAL_RC(void) { 1882 | __asm { 1883 | CLRB 1884 | __PIC_JMP(_FAR_COPY_LOGICAL_GLOBAL_RC); 1885 | } 1886 | } 1887 | 1888 | #ifdef __cplusplus 1889 | extern "C" 1890 | #endif 1891 | #pragma NO_ENTRY 1892 | #pragma NO_EXIT 1893 | #pragma NO_FRAME 1894 | 1895 | void NEAR _FAR_COPY_NEAR_LOGICAL_RC(void) { 1896 | __asm { 1897 | PSHA 1898 | __PIC_JSR(_CONV_NEAR_TO_GLOBAL); 1899 | PULA 1900 | __PIC_JMP(_FAR_COPY_GLOBAL_LOGICAL_RC); 1901 | } 1902 | } 1903 | 1904 | #ifdef __cplusplus 1905 | extern "C" 1906 | #endif 1907 | #pragma NO_ENTRY 1908 | #pragma NO_EXIT 1909 | #pragma NO_FRAME 1910 | 1911 | void NEAR _FAR_COPY_GLOBAL_NEAR_RC(void) { 1912 | __asm { 1913 | CLRA /* near to logical (we may have to use another runtime if this gets non trivial as well :-( */ 1914 | __PIC_JMP(_FAR_COPY_GLOBAL_LOGICAL_RC); 1915 | } 1916 | } 1917 | 1918 | #ifdef __cplusplus 1919 | extern "C" 1920 | #endif 1921 | #pragma NO_ENTRY 1922 | #pragma NO_EXIT 1923 | #pragma NO_FRAME 1924 | 1925 | void NEAR _FAR_COPY_LOGICAL_NEAR_RC(void) { 1926 | __asm { 1927 | EXG A,B 1928 | EXG X,Y 1929 | PSHA 1930 | __PIC_JSR(_CONV_NEAR_TO_GLOBAL); 1931 | PULA 1932 | EXG A,B 1933 | EXG X,Y 1934 | __PIC_JMP(_FAR_COPY_LOGICAL_GLOBAL_RC); 1935 | } 1936 | } 1937 | 1938 | /* _FAR_COPY_LOGICAL_GLOBAL: is used by some old wizard generated projects. Not used by current setup anymore */ 1939 | 1940 | #ifdef __cplusplus 1941 | extern "C" 1942 | #endif 1943 | #pragma NO_ENTRY 1944 | #pragma NO_EXIT 1945 | #pragma NO_FRAME 1946 | 1947 | void NEAR _FAR_COPY_LOGICAL_GLOBAL(void) { 1948 | __asm { 1949 | STAA __GPAGE_ADR__ 1950 | PSHX ;// allocate some space where _SET_PAGE_REG_HCS12X can return the page 1951 | __PIC_JSR(_SET_PAGE_REG_HCS12X) 1952 | 1953 | Loop: LDAB 1,X+ 1954 | GSTAB 1,Y+ 1955 | DECW 4,SP 1956 | BNE Loop 1957 | 1958 | PULX 1959 | STAA 0,X ;// restore old page content (necessary if it was PPAGE) 1960 | 1961 | LDX 4,SP+ ;// load return address and clean stack 1962 | JMP 0,X 1963 | } 1964 | } 1965 | 1966 | 1967 | #endif /* __HCS12X__ */ 1968 | 1969 | 1970 | /*----------------- end of code ------------------------------------------------*/ 1971 | -------------------------------------------------------------------------------- /Sources/derivative.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: This file is recreated by the project wizard whenever the MCU is 3 | * changed and should not be edited by hand 4 | */ 5 | 6 | /* Include the derivative-specific header file */ 7 | #include 8 | 9 | #pragma LINK_INFO DERIVATIVE "MC9S12XS128" 10 | 11 | -------------------------------------------------------------------------------- /Sources/main.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/Sources/main.c -------------------------------------------------------------------------------- /TBDML.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/TBDML.ini -------------------------------------------------------------------------------- /bestcar_Data/CWSettingsWindows.stg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/bestcar_Data/CWSettingsWindows.stg -------------------------------------------------------------------------------- /bestcar_Data/Standard/ObjectCode/Control.c.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/bestcar_Data/Standard/ObjectCode/Control.c.o -------------------------------------------------------------------------------- /bestcar_Data/Standard/ObjectCode/Hardware.c.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/bestcar_Data/Standard/ObjectCode/Hardware.c.o -------------------------------------------------------------------------------- /bestcar_Data/Standard/ObjectCode/Hardwaredriver.c.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/bestcar_Data/Standard/ObjectCode/Hardwaredriver.c.o -------------------------------------------------------------------------------- /bestcar_Data/Standard/ObjectCode/MC9S12XS128.c.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/bestcar_Data/Standard/ObjectCode/MC9S12XS128.c.o -------------------------------------------------------------------------------- /bestcar_Data/Standard/ObjectCode/Sensor.c.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/bestcar_Data/Standard/ObjectCode/Sensor.c.o -------------------------------------------------------------------------------- /bestcar_Data/Standard/ObjectCode/Start12.c.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/bestcar_Data/Standard/ObjectCode/Start12.c.o -------------------------------------------------------------------------------- /bestcar_Data/Standard/ObjectCode/SureLocation.c.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/bestcar_Data/Standard/ObjectCode/SureLocation.c.o -------------------------------------------------------------------------------- /bestcar_Data/Standard/ObjectCode/base.c.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/bestcar_Data/Standard/ObjectCode/base.c.o -------------------------------------------------------------------------------- /bestcar_Data/Standard/ObjectCode/datapage.c.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/bestcar_Data/Standard/ObjectCode/datapage.c.o -------------------------------------------------------------------------------- /bestcar_Data/Standard/ObjectCode/main.c.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/bestcar_Data/Standard/ObjectCode/main.c.o -------------------------------------------------------------------------------- /bestcar_Data/Standard/TargetDataWindows.tdt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/bestcar_Data/Standard/TargetDataWindows.tdt -------------------------------------------------------------------------------- /bin/Project.abs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/bin/Project.abs -------------------------------------------------------------------------------- /bin/Project.abs.glo: -------------------------------------------------------------------------------- 1 | S03A0000453A5C31D6C7C4DCD0A1B3B55C312DB5DAC1F9BDECB7C9CBBCBFA8B6FB5C48656C6C20466972655C62696E5C50726F6A6563742E61627325 2 | S2247FC000CF2100C6055B134A8021FE4A8000FE0001C015C0AB2100013814104D4EFE4D60BD 3 | S2247FC02040DC50C300BBCEFFF518105C50DD627D2118CC10E013CE04EC18107E211AF603A0 4 | S2247FC04045C4F0CA017B03454C6040187900624A84E8FE4A8295FE10EF0B1410C601874A1D 5 | S2247FC060852AFEC6807B026F18722102FC21028C00022606C601877C211410EF0B3037E186 6 | S2247FC080310460022504E61F2002E6E51AE5330500EE8097260CE1002208E12122FC2702A8 7 | S2167FC0A0EE8037E6011AE5E6B2050000012101010000BE 8 | S2067FFFCEC05A93 9 | S2067FFFEEC019B4 10 | S2067FFFFEC000BD 11 | S2247F800014104A8191FECC07D04A852AFE1C0240801C0250011879210010EF4A81A6FE2037 12 | S2247F8020FAFEC011FDC00F270E35ED31EC3169700434FB310326F2FEC013EC31270BED31EC 13 | S2247F8040180A30700434F920F10A8C00002C06B7451840B7540A790039CC02E15B3A5A34E3 14 | S2247F8060475A35A7A7A74F3708FCC6805B390ACC550F5B40575B4D5A4AC6405B60C6015BF2 15 | S2247F80804CC7875C625C44C6805B460ACC80FF5B025B007900025B037900017B02427B02E1 16 | S2247F80A0447B02451D0240017B025A7B02581C0252011D0250017B026A7B02687B026C791B 17 | S2247F80C0026A79026D7A026E7B025B0A790300CC30447B03037903027A0305C6FF7B03017B 18 | S2247F80E0790304CE75307E0314CD08347D031CC696877C0316C6467C031E437A03000ACC18 19 | S2247F810010077B02C07902C17A02C2C6C07B02C3C6447B02C4C6307B02C5187902CC0A1843 20 | S2247F812069AEC10722618716C07D085B08121C26303A444EF602D00752F602D12044F6027E 21 | S2247F8140D20748F602D3203AF602D4073EF602D52030F602D60734F602D72026F602D80732 22 | S2247F81602AF602D9201CF602DA0720F602DB2012F602DC0716F602DD2008F602DE070CF679 23 | S2247F818002DF871AE66E80E681300AB710C7B7453D4A8056FE4A806FFE4A808CFE4A80CC5E 24 | S2247F81A0FE4A80FFFE0AD600877C211CF6211DC415C115222516C0911522000E010F04105C 25 | S2247F81C0051A100F11101511C6268FC62A8FC62E8FC6368FC63A8FC63E8FC632877C21163A 26 | S2247F81E0F6211DC4402704C1402604C77C211E0A4A82A1FE7C2104FC2100042406C63C0781 27 | S2247F8200582006C6640752C6737C210AFC21063BFC21083BFC210A3BFC21043BFC210C3B19 28 | S2247F8220FC210E3BFC21103BFC21124A8597FE1B8E7C2120CC0834B321207C21228C054661 29 | S2247F82402C05CC054620088C0B222F06CC0B227C2122FC21227C031C0A877C2106C77C2112 30 | S2247F8260083D3BFC21244A804AFE8C00022D08C602877C21002013C601877C2100FE2116A5 31 | S2247F82806E80FE21008E00022607FE21161A056E80EC80300A4A8262FE7C031E4A81F0FE26 32 | S2247F82A00A3BF621256B81CC22263BC6084A853FFE6BA1C1072657FC22328C00252C42FCE8 33 | S2247F82C022348C001E2F198C002A2C05C60516841CFC22348C002A2F35C60416841C202E30 34 | S2247F82E08C00112F04C60620138C00072F04C607200A8C00042F03C6088FC60B16841C20A8 35 | S2247F83000D8C00302C03C6038FC60216841CE680C106261FFC22348C002F2F04C602200A67 36 | S2247F8320FC22328C00262F07C60116841C200418792124E680C102260418792124C10226F8 37 | S2247F83401BFC22268C002D2C13FC222A8C00342F05CCFFFE2003CCFFFF7C2124E680C10266 38 | S2247F8360260EFC22268C002D2F06CCFFFD7C2124E680261BFC22288C00282F13FC22268CD7 39 | S2247F838000382C05CCFFFD2003CCFFFC7C2124E680263DFC22288C00282C35C6FF5B01FC3C 40 | S2247F83A022268C001C2F198C003B2F05CCFFFB200D8C002F2F05CCFFFA2003CCFFF9200D4B 41 | S2247F83C08C000B2F05CCFFF82003CCFFF57C2124E680B7151848ECE222268C00082C38E661 42 | S2247F83E0812C09FC21202F04C60A0730E6812C0BFC21202C06CCFFF67C2124E6812F09FCA2 43 | S2247F840021202F04C60A0714E6812F0BFC21202C06CCFFF67C2124FC2124300A877C212424 44 | S2247F84203D6CAB3B69846986201CE684860A12B745E68687591AE6E684344A811FFE873080 45 | S2247F84406CE221266286E68687AC822FDD6284E684C10823D16A85E68587B745C60AB7502D 46 | S2247F846012C321263BE6856E824A856EFEEEA118486CE221766285E685C10823DA1C02C6BB 47 | S2247F8480801B870AC60A37C608A680B70637C6108713B745E680B714591AE6ECE221666C86 48 | S2247F84A0E221763353D72CE16380E680C1012ED7C7B7151848EDE221766DE2218652C108DB 49 | S2247F84C02DEF320ACC21863BC60A4A853FFE308759B745EEE221868E00032E051879223606 50 | S2247F84E00AC601877C22360AC605874A8421FE4A8484FE4A84C4FEFC22362714C787375936 51 | S2247F8500B745EDE221866DE222263352C10825ED0A6CAC1869822009C752C11825FB186294 52 | S2247F852082EC82AC802DF11B840A3B1887200AC66487344A8511FE3008AE802DF23A0A6BD9 53 | S2247F8540AD69826981201CE6828759E386B745E6818759E386B746EC00AC402C04E6816BA5 54 | S2247F8560826281E681E18025DEE6821B830A6BAD186981C7200F873759E387B745EC00E3DB 55 | S2247F8580826C823352E18025EDE68087B745EC811815B7541B830A6CA8EC8F6C8DECF01144 56 | S2247F85A0E38BEEF01118A08DEDF013B7C5136C86ECF015B756136C82EDF017ECF011136CC5 57 | S2177F85C084EC82AC802F03186982EC84E382E3861B880AE6 58 | S9030000FC 59 | -------------------------------------------------------------------------------- /bin/Project.abs.s19: -------------------------------------------------------------------------------- 1 | S03A0000453A5C31D6C7C4DCD0A1B3B55C312DB5DAC1F9BDECB7C9CBBCBFA8B6FB5C48656C6C20466972655C62696E5C50726F6A6563742E61627325 2 | S123C000CF2100C6055B134A8021FE4A8000FE0001C015C0AB2100013814104D4EFE4D603D 3 | S123C02040DC50C300BBCEFFF518105C50DD627D2118CC10E013CE04EC18107E211AF60320 4 | S123C04045C4F0CA017B03454C6040187900624A84E8FE4A8295FE10EF0B1410C601874A9D 5 | S123C060852AFEC6807B026F18722102FC21028C00022606C601877C211410EF0B3037E106 6 | S123C080310460022504E61F2002E6E51AE5330500EE8097260CE1002208E12122FC270228 7 | S115C0A0EE8037E6011AE5E6B20500000121010100003E 8 | S105FFCEC05A13 9 | S105FFEEC01934 10 | S105FFFEC0003D 11 | S224FE800014104A8191FECC07D04A852AFE1C0240801C0250011879210010EF4A81A6FE20B8 12 | S224FE8020FAFEC011FDC00F270E35ED31EC3169700434FB310326F2FEC013EC31270BED316D 13 | S224FE8040180A30700434F920F10A8C00002C06B7451840B7540A790039CC02E15B3A5A3464 14 | S224FE8060475A35A7A7A74F3708FCC6805B390ACC550F5B40575B4D5A4AC6405B60C6015B73 15 | S224FE80804CC7875C625C44C6805B460ACC80FF5B025B007900025B037900017B02427B0262 16 | S224FE80A0447B02451D0240017B025A7B02581C0252011D0250017B026A7B02687B026C799C 17 | S224FE80C0026A79026D7A026E7B025B0A790300CC30447B03037903027A0305C6FF7B0301FC 18 | S224FE80E0790304CE75307E0314CD08347D031CC696877C0316C6467C031E437A03000ACC99 19 | S224FE810010077B02C07902C17A02C2C6C07B02C3C6447B02C4C6307B02C5187902CC0A18C4 20 | S224FE812069AEC10722618716C07D085B08121C26303A444EF602D00752F602D12044F602FF 21 | S224FE8140D20748F602D3203AF602D4073EF602D52030F602D60734F602D72026F602D807B3 22 | S224FE81602AF602D9201CF602DA0720F602DB2012F602DC0716F602DD2008F602DE070CF6FA 23 | S224FE818002DF871AE66E80E681300AB710C7B7453D4A8056FE4A806FFE4A808CFE4A80CCDF 24 | S224FE81A0FE4A80FFFE0AD600877C211CF6211DC415C115222516C0911522000E010F0410DD 25 | S224FE81C0051A100F11101511C6268FC62A8FC62E8FC6368FC63A8FC63E8FC632877C2116BB 26 | S224FE81E0F6211DC4402704C1402604C77C211E0A4A82A1FE7C2104FC2100042406C63C0702 27 | S224FE8200582006C6640752C6737C210AFC21063BFC21083BFC210A3BFC21043BFC210C3B9A 28 | S224FE8220FC210E3BFC21103BFC21124A8597FE1B8E7C2120CC0834B321207C21228C0546E2 29 | S224FE82402C05CC054620088C0B222F06CC0B227C2122FC21227C031C0A877C2106C77C2193 30 | S224FE8260083D3BFC21244A804AFE8C00022D08C602877C21002013C601877C2100FE211626 31 | S224FE82806E80FE21008E00022607FE21161A056E80EC80300A4A8262FE7C031E4A81F0FEA7 32 | S224FE82A00A3BF621256B81CC22263BC6084A853FFE6BA1C1072657FC22328C00252C42FC69 33 | S224FE82C022348C001E2F198C002A2C05C60516841CFC22348C002A2F35C60416841C202EB1 34 | S224FE82E08C00112F04C60620138C00072F04C607200A8C00042F03C6088FC60B16841C2029 35 | S224FE83000D8C00302C03C6038FC60216841CE680C106261FFC22348C002F2F04C602200AE8 36 | S224FE8320FC22328C00262F07C60116841C200418792124E680C102260418792124C1022679 37 | S224FE83401BFC22268C002D2C13FC222A8C00342F05CCFFFE2003CCFFFF7C2124E680C102E7 38 | S224FE8360260EFC22268C002D2F06CCFFFD7C2124E680261BFC22288C00282F13FC22268C58 39 | S224FE838000382C05CCFFFD2003CCFFFC7C2124E680263DFC22288C00282C35C6FF5B01FCBD 40 | S224FE83A022268C001C2F198C003B2F05CCFFFB200D8C002F2F05CCFFFA2003CCFFF9200DCC 41 | S224FE83C08C000B2F05CCFFF82003CCFFF57C2124E680B7151848ECE222268C00082C38E6E2 42 | S224FE83E0812C09FC21202F04C60A0730E6812C0BFC21202C06CCFFF67C2124E6812F09FC23 43 | S224FE840021202F04C60A0714E6812F0BFC21202C06CCFFF67C2124FC2124300A877C2124A5 44 | S224FE84203D6CAB3B69846986201CE684860A12B745E68687591AE6E684344A811FFE873001 45 | S224FE84406CE221266286E68687AC822FDD6284E684C10823D16A85E68587B745C60AB750AE 46 | S224FE846012C321263BE6856E824A856EFEEEA118486CE221766285E685C10823DA1C02C63C 47 | S224FE8480801B870AC60A37C608A680B70637C6108713B745E680B714591AE6ECE221666C07 48 | S224FE84A0E221763353D72CE16380E680C1012ED7C7B7151848EDE221766DE2218652C1085C 49 | S224FE84C02DEF320ACC21863BC60A4A853FFE308759B745EEE221868E00032E051879223687 50 | S224FE84E00AC601877C22360AC605874A8421FE4A8484FE4A84C4FEFC22362714C7873759B7 51 | S224FE8500B745EDE221866DE222263352C10825ED0A6CAC1869822009C752C11825FB186215 52 | S224FE852082EC82AC802DF11B840A3B1887200AC66487344A8511FE3008AE802DF23A0A6B5A 53 | S224FE8540AD69826981201CE6828759E386B745E6818759E386B746EC00AC402C04E6816B26 54 | S224FE8560826281E681E18025DEE6821B830A6BAD186981C7200F873759E387B745EC00E35C 55 | S224FE8580826C823352E18025EDE68087B745EC811815B7541B830A6CA8EC8F6C8DECF011C5 56 | S224FE85A0E38BEEF01118A08DEDF013B7C5136C86ECF015B756136C82EDF017ECF011136C46 57 | S217FE85C084EC82AC802F03186982EC84E382E3861B880A67 58 | S9030000FC 59 | -------------------------------------------------------------------------------- /bin/Project.map: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/bin/Project.map -------------------------------------------------------------------------------- /bin/Project.xpr: -------------------------------------------------------------------------------- 1 | Data:1 < ADDXPR ONLY_ADD_IF_NEW "ADdata" 2 | Data:1 < ADDXPR ONLY_ADD_IF_NEW "location" 3 | Data:1 < ADDXPR ONLY_ADD_IF_NEW "levelflag" 4 | Data:1 < ADDXPR ONLY_ADD_IF_NEW "PWMDTY23" 5 | Data:1 < ADDXPR ONLY_ADD_IF_NEW "PORTAB" 6 | Data:1 < ADDXPR ONLY_ADD_IF_NEW "PORTA" 7 | Data:1 < ADDXPR ONLY_ADD_IF_NEW "PWMDTY01" 8 | Data:1 < ADDXPR ONLY_ADD_IF_NEW "ADdataorigenal" 9 | Data:2 < ADDXPR ONLY_ADD_IF_NEW "uout" 10 | Data:2 < ADDXPR ONLY_ADD_IF_NEW "Hardware.c::_PWMDTY23" 11 | Data:2 < ADDXPR ONLY_ADD_IF_NEW "location" 12 | Data:2 < ADDXPR ONLY_ADD_IF_NEW "speedlost" 13 | Data:2 < ADDXPR ONLY_ADD_IF_NEW "speed" 14 | Data:2 < ADDXPR ONLY_ADD_IF_NEW "PWMDTY23" 15 | Data:2 < ADDXPR ONLY_ADD_IF_NEW "modeflag" 16 | Data:2 < ADDXPR ONLY_ADD_IF_NEW "forecast" 17 | Data:2 < ADDXPR ONLY_ADD_IF_NEW "ADdata" 18 | -------------------------------------------------------------------------------- /cmd/Full_Chip_Simulation_Postload.cmd: -------------------------------------------------------------------------------- 1 | // After load the commands written below will be executed 2 | -------------------------------------------------------------------------------- /cmd/Full_Chip_Simulation_Preload.cmd: -------------------------------------------------------------------------------- 1 | // Before load the commands written below will be executed 2 | -------------------------------------------------------------------------------- /cmd/Full_Chip_Simulation_Reset.cmd: -------------------------------------------------------------------------------- 1 | // After reset the commands written below will be executed 2 | -------------------------------------------------------------------------------- /cmd/Full_Chip_Simulation_SetCPU.cmd: -------------------------------------------------------------------------------- 1 | // At startup the commands written below will be executed 2 | -------------------------------------------------------------------------------- /cmd/Full_Chip_Simulation_Startup.cmd: -------------------------------------------------------------------------------- 1 | // At startup the commands written below will be executed 2 | -------------------------------------------------------------------------------- /cmd/P&E_Multilink_CyclonePro_Erase_unsecure_hcs12xe.cmd: -------------------------------------------------------------------------------- 1 | // ver 0.2 (28-Mar-06) 2 | // HCS12XE Core erasing + unsecuring command file: 3 | // These commands mass erase the chip then program the security byte to 0xFE (unsecured state). 4 | 5 | DEFINEVALUEDLG "Information required to unsecure the device" "FCLKDIV" 17 "To unsecure the device, the command script needs \nthe correct value for the FCLKDIV onchip register.\n\nDatasheet proposed values:\n\noscillator frequency\tFCLKDIV value (decimal)\n\n 16 \tMHz\t\t17\n 12 \tMHz\t\t13\n 8 \tMHz\t\t9\n 4 \tMHz\t\t5\n" 6 | 7 | FLASH RELEASE 8 | 9 | reset 10 | wb 0x03c 0x00 //disable cop 11 | wait 20 12 | 13 | 14 | WB 0x100 FCLKDIV // clock divider 15 | 16 | WB 0x106 0x30 // clear any error flags 17 | WB 0x102 0x00 // CCOBIX = 0 18 | WB 0x10A 0x08 // load erase all blocks command 19 | WB 0x106 0x80 // launch command 20 | WAIT 10 21 | 22 | reset 23 | 24 | WB 0x100 FCLKDIV // clock divider 25 | WB 0x106 0x30 // clear any error flags 26 | WB 0x102 0x00 // CCOBIX = 0 27 | WB 0x10A 0x06 // load program command 28 | WB 0x10B 0x7F // load GPAGE 29 | WB 0x102 0x01 // CCOBIX = 1 30 | WB 0x10A 0xFF // load addr hi 31 | WB 0x10B 0x08 // load addr lo 32 | WB 0x102 0x02 // CCOBIX = 2 33 | WB 0x10A 0xFF // load data 34 | WB 0x10B 0xFF // load data 35 | WB 0x102 0x03 // CCOBIX = 3 36 | WB 0x10A 0xFF // load data 37 | WB 0x10B 0xFF // load data 38 | WB 0x102 0x04 // CCOBIX = 4 39 | WB 0x10A 0xFF // load data 40 | WB 0x10B 0xFF // load data 41 | WB 0x102 0x05 // CCOBIX = 5 42 | WB 0x10A 0xFF // load data 43 | WB 0x10B 0xFE // load data 44 | WB 0x106 0x80 // launch command 45 | WAIT 1 46 | 47 | undef FCLKDIV // undefine variable 48 | 49 | -------------------------------------------------------------------------------- /cmd/P&E_Multilink_CyclonePro_Postload.cmd: -------------------------------------------------------------------------------- 1 | // After load the commands written below will be executed 2 | -------------------------------------------------------------------------------- /cmd/P&E_Multilink_CyclonePro_Preload.cmd: -------------------------------------------------------------------------------- 1 | // Before load the commands written below will be executed 2 | -------------------------------------------------------------------------------- /cmd/P&E_Multilink_CyclonePro_Reset.cmd: -------------------------------------------------------------------------------- 1 | // After reset the commands written below will be executed 2 | -------------------------------------------------------------------------------- /cmd/P&E_Multilink_CyclonePro_Startup.cmd: -------------------------------------------------------------------------------- 1 | // At startup the commands written below will be executed 2 | -------------------------------------------------------------------------------- /cmd/P&E_Multilink_CyclonePro_Vppoff.cmd: -------------------------------------------------------------------------------- 1 | // After programming the flash, the commands written below will be executed 2 | -------------------------------------------------------------------------------- /cmd/P&E_Multilink_CyclonePro_Vppon.cmd: -------------------------------------------------------------------------------- 1 | // Before programming the flash, the commands written below will be executed 2 | -------------------------------------------------------------------------------- /cmd/TBDML_Erase_unsecure_hcs12xe.cmd: -------------------------------------------------------------------------------- 1 | // ver 0.2 (28-Mar-06) 2 | // HCS12XE Core erasing + unsecuring command file: 3 | // These commands mass erase the chip then program the security byte to 0xFE (unsecured state). 4 | 5 | DEFINEVALUEDLG "Information required to unsecure the device" "FCLKDIV" 17 "To unsecure the device, the command script needs \nthe correct value for the FCLKDIV onchip register.\n\nDatasheet proposed values:\n\noscillator frequency\tFCLKDIV value (decimal)\n\n 16 \tMHz\t\t17\n 12 \tMHz\t\t13\n 8 \tMHz\t\t9\n 4 \tMHz\t\t5\n" 6 | 7 | FLASH RELEASE 8 | 9 | reset 10 | wb 0x03c 0x00 //disable cop 11 | wait 20 12 | 13 | 14 | WB 0x100 FCLKDIV // clock divider 15 | 16 | WB 0x106 0x30 // clear any error flags 17 | WB 0x102 0x00 // CCOBIX = 0 18 | WB 0x10A 0x08 // load erase all blocks command 19 | WB 0x106 0x80 // launch command 20 | WAIT 10 21 | 22 | reset 23 | 24 | WB 0x100 FCLKDIV // clock divider 25 | WB 0x106 0x30 // clear any error flags 26 | WB 0x102 0x00 // CCOBIX = 0 27 | WB 0x10A 0x06 // load program command 28 | WB 0x10B 0x7F // load GPAGE 29 | WB 0x102 0x01 // CCOBIX = 1 30 | WB 0x10A 0xFF // load addr hi 31 | WB 0x10B 0x08 // load addr lo 32 | WB 0x102 0x02 // CCOBIX = 2 33 | WB 0x10A 0xFF // load data 34 | WB 0x10B 0xFF // load data 35 | WB 0x102 0x03 // CCOBIX = 3 36 | WB 0x10A 0xFF // load data 37 | WB 0x10B 0xFF // load data 38 | WB 0x102 0x04 // CCOBIX = 4 39 | WB 0x10A 0xFF // load data 40 | WB 0x10B 0xFF // load data 41 | WB 0x102 0x05 // CCOBIX = 5 42 | WB 0x10A 0xFF // load data 43 | WB 0x10B 0xFE // load data 44 | WB 0x106 0x80 // launch command 45 | WAIT 1 46 | 47 | undef FCLKDIV // undefine variable 48 | 49 | -------------------------------------------------------------------------------- /cmd/TBDML_Postload.cmd: -------------------------------------------------------------------------------- 1 | // After load the commands written below will be executed 2 | -------------------------------------------------------------------------------- /cmd/TBDML_Preload.cmd: -------------------------------------------------------------------------------- 1 | // Before load the commands written below will be executed 2 | -------------------------------------------------------------------------------- /cmd/TBDML_Reset.cmd: -------------------------------------------------------------------------------- 1 | // After reset the commands written below will be executed 2 | -------------------------------------------------------------------------------- /cmd/TBDML_Startup.cmd: -------------------------------------------------------------------------------- 1 | // At startup the commands written below will be executed 2 | -------------------------------------------------------------------------------- /cmd/TBDML_Vppoff.cmd: -------------------------------------------------------------------------------- 1 | // After programming the flash, the commands written below will be executed 2 | -------------------------------------------------------------------------------- /cmd/TBDML_Vppon.cmd: -------------------------------------------------------------------------------- 1 | // Before programming the flash, the commands written below will be executed 2 | -------------------------------------------------------------------------------- /prm/Project.prm: -------------------------------------------------------------------------------- 1 | /* This is a linker parameter file for the MC9S12XS128 */ 2 | 3 | /* 4 | This file is setup to use the HCS12X core only. 5 | If you plan to also use the XGATE in your project, best create a new project with the 6 | 'New Project Wizard' (File|New... menu in the CodeWarrior IDE) and choose the appropriate 7 | project parameters. 8 | */ 9 | 10 | NAMES 11 | /* CodeWarrior will pass all the needed files to the linker by command line. But here you may add your additional files */ 12 | END 13 | 14 | SEGMENTS /* here all RAM/ROM areas of the device are listed. Used in PLACEMENT below. All addresses are 'logical' */ 15 | /* Register space */ 16 | /* IO_SEG = PAGED 0x0000 TO 0x07FF; intentionally not defined */ 17 | 18 | /* non-paged RAM */ 19 | RAM = READ_WRITE DATA_NEAR 0x2000 TO 0x3FFF; 20 | 21 | /* non-banked FLASH */ 22 | ROM_4000 = READ_ONLY DATA_NEAR IBCC_NEAR 0x4000 TO 0x7FFF; 23 | ROM_C000 = READ_ONLY DATA_NEAR IBCC_NEAR 0xC000 TO 0xFEFF; 24 | /* VECTORS = READ_ONLY 0xFF00 TO 0xFFFF; intentionally not defined: used for VECTOR commands below */ 25 | //OSVECTORS = READ_ONLY 0xFF10 TO 0xFFFF; /* OSEK interrupt vectors (use your vector.o) */ 26 | 27 | /* paged EEPROM 0x0800 TO 0x0BFF; addressed through EPAGE */ 28 | EEPROM_00 = READ_ONLY DATA_FAR IBCC_FAR 0x000800 TO 0x000BFF; 29 | EEPROM_01 = READ_ONLY DATA_FAR IBCC_FAR 0x010800 TO 0x010BFF; 30 | EEPROM_02 = READ_ONLY DATA_FAR IBCC_FAR 0x020800 TO 0x020BFF; 31 | EEPROM_03 = READ_ONLY DATA_FAR IBCC_FAR 0x030800 TO 0x030BFF; 32 | EEPROM_04 = READ_ONLY DATA_FAR IBCC_FAR 0x040800 TO 0x040BFF; 33 | EEPROM_05 = READ_ONLY DATA_FAR IBCC_FAR 0x050800 TO 0x050BFF; 34 | EEPROM_06 = READ_ONLY DATA_FAR IBCC_FAR 0x060800 TO 0x060BFF; 35 | EEPROM_07 = READ_ONLY DATA_FAR IBCC_FAR 0x070800 TO 0x070BFF; 36 | 37 | /* paged RAM: 0x1000 TO 0x1FFF; addressed through RPAGE */ 38 | /* RAM_FE = READ_WRITE 0xFE1000 TO 0xFE1FFF; intentionally not defined: equivalent to RAM: 0x2000..0x2FFF */ 39 | /* RAM_FF = READ_WRITE 0xFF1000 TO 0xFF1FFF; intentionally not defined: equivalent to RAM: 0x3000..0x3FFF */ 40 | 41 | /* paged FLASH: 0x8000 TO 0xBFFF; addressed through PPAGE */ 42 | PAGE_F8 = READ_ONLY DATA_FAR IBCC_FAR 0xF88000 TO 0xF8BFFF; 43 | PAGE_F9 = READ_ONLY DATA_FAR IBCC_FAR 0xF98000 TO 0xF9BFFF; 44 | PAGE_FA = READ_ONLY DATA_FAR IBCC_FAR 0xFA8000 TO 0xFABFFF; 45 | PAGE_FB = READ_ONLY DATA_FAR IBCC_FAR 0xFB8000 TO 0xFBBFFF; 46 | PAGE_FC = READ_ONLY DATA_FAR IBCC_FAR 0xFC8000 TO 0xFCBFFF; 47 | /* PAGE_FD = READ_ONLY 0xFD8000 TO 0xFDBFFF; intentionally not defined: equivalent to ROM_4000 */ 48 | PAGE_FE = READ_ONLY DATA_FAR IBCC_FAR 0xFE8000 TO 0xFEBFFF; 49 | /* PAGE_FF = READ_ONLY 0xFF8000 TO 0xFFBFFF; intentionally not defined: equivalent to ROM_C000 */ 50 | END 51 | 52 | PLACEMENT /* here all predefined and user segments are placed into the SEGMENTS defined above. */ 53 | _PRESTART, /* Used in HIWARE format: jump to _Startup at the code start */ 54 | STARTUP, /* startup data structures */ 55 | ROM_VAR, /* constant variables */ 56 | STRINGS, /* string literals */ 57 | VIRTUAL_TABLE_SEGMENT, /* C++ virtual table segment */ 58 | //.ostext, /* eventually OSEK code */ 59 | NON_BANKED, /* runtime routines which must not be banked */ 60 | COPY /* copy down information: how to initialize variables */ 61 | /* in case you want to use ROM_4000 here as well, make sure 62 | that all files (incl. library files) are compiled with the 63 | option: -OnB=b */ 64 | INTO ROM_C000/*, ROM_4000*/; 65 | 66 | DEFAULT_ROM INTO PAGE_FE, PAGE_FC, PAGE_FB, PAGE_FA, PAGE_F9, PAGE_F8; 67 | 68 | //.stackstart, /* eventually used for OSEK kernel awareness: Main-Stack Start */ 69 | SSTACK, /* allocate stack first to avoid overwriting variables on overflow */ 70 | //.stackend, /* eventually used for OSEK kernel awareness: Main-Stack End */ 71 | PAGED_RAM, /* there is no need for paged data accesses on this derivative */ 72 | 73 | DEFAULT_RAM /* all variables, the default RAM location */ 74 | INTO RAM; 75 | 76 | DISTRIBUTE DISTRIBUTE_INTO 77 | ROM_4000, PAGE_FE, PAGE_FC, PAGE_FB, PAGE_FA, PAGE_F9, PAGE_F8; 78 | CONST_DISTRIBUTE DISTRIBUTE_INTO 79 | ROM_4000, PAGE_FE, PAGE_FC, PAGE_FB, PAGE_FA, PAGE_F9, PAGE_F8; 80 | DATA_DISTRIBUTE DISTRIBUTE_INTO 81 | RAM; 82 | //.vectors INTO OSVECTORS; /* OSEK vector table */ 83 | END 84 | 85 | 86 | ENTRIES /* keep the following unreferenced variables */ 87 | /* OSEK: always allocate the vector table and all dependent objects */ 88 | //_vectab OsBuildNumber _OsOrtiStackStart _OsOrtiStart 89 | END 90 | 91 | STACKSIZE 0x100 /* size of the stack (will be allocated in DEFAULT_RAM) */ 92 | 93 | /* use these definitions in plane of the vector table ('vectors') above */ 94 | VECTOR 0 _Startup /* reset vector: this is the default entry point for a C/C++ application. */ 95 | //VECTOR 0 Entry /* reset vector: this is the default entry point for an Assembly application. */ 96 | //INIT Entry /* for assembly applications: that this is as well the initialization entry point */ 97 | -------------------------------------------------------------------------------- /prm/burner.bbl: -------------------------------------------------------------------------------- 1 | /* global s-record file */ 2 | OPENFILE "%ABS_FILE%.glo" 3 | format = motorola 4 | busWidth = 1 5 | SRECORD=Sx 6 | 7 | /* "EABI compliant encoded global" address to global */ 8 | len = 0x1800000 9 | origin = 0x1000000 10 | destination = 0 11 | SENDBYTE 1 "%ABS_FILE%" 12 | 13 | /* physical flash window to global */ 14 | len = 0x4000 15 | destination = 0x7F8000 16 | origin = 0x008000 17 | SENDBYTE 1 "%ABS_FILE%" 18 | 19 | /* logical non banked flash at $4000 and $C000 to global */ 20 | len = 0x4000 21 | destination = 0x7F4000 22 | origin = 0x004000 23 | SENDBYTE 1 "%ABS_FILE%" 24 | destination = 0x7FC000 25 | origin = 0x00C000 26 | SENDBYTE 1 "%ABS_FILE%" 27 | 28 | /* logical 1 MB banked flash to global */ 29 | destination = 0x700000 30 | origin = 0xc08000 31 | SENDBYTE 1 "%ABS_FILE%" 32 | destination = 0x704000 33 | origin = 0xc18000 34 | SENDBYTE 1 "%ABS_FILE%" 35 | destination = 0x708000 36 | origin = 0xc28000 37 | SENDBYTE 1 "%ABS_FILE%" 38 | destination = 0x70c000 39 | origin = 0xc38000 40 | SENDBYTE 1 "%ABS_FILE%" 41 | destination = 0x710000 42 | origin = 0xc48000 43 | SENDBYTE 1 "%ABS_FILE%" 44 | destination = 0x714000 45 | origin = 0xc58000 46 | SENDBYTE 1 "%ABS_FILE%" 47 | destination = 0x718000 48 | origin = 0xc68000 49 | SENDBYTE 1 "%ABS_FILE%" 50 | destination = 0x71c000 51 | origin = 0xc78000 52 | SENDBYTE 1 "%ABS_FILE%" 53 | destination = 0x720000 54 | origin = 0xc88000 55 | SENDBYTE 1 "%ABS_FILE%" 56 | destination = 0x724000 57 | origin = 0xc98000 58 | SENDBYTE 1 "%ABS_FILE%" 59 | destination = 0x728000 60 | origin = 0xca8000 61 | SENDBYTE 1 "%ABS_FILE%" 62 | destination = 0x72c000 63 | origin = 0xcb8000 64 | SENDBYTE 1 "%ABS_FILE%" 65 | destination = 0x730000 66 | origin = 0xcc8000 67 | SENDBYTE 1 "%ABS_FILE%" 68 | destination = 0x734000 69 | origin = 0xcd8000 70 | SENDBYTE 1 "%ABS_FILE%" 71 | destination = 0x738000 72 | origin = 0xce8000 73 | SENDBYTE 1 "%ABS_FILE%" 74 | destination = 0x73c000 75 | origin = 0xcf8000 76 | SENDBYTE 1 "%ABS_FILE%" 77 | destination = 0x740000 78 | origin = 0xd08000 79 | SENDBYTE 1 "%ABS_FILE%" 80 | destination = 0x744000 81 | origin = 0xd18000 82 | SENDBYTE 1 "%ABS_FILE%" 83 | destination = 0x748000 84 | origin = 0xd28000 85 | SENDBYTE 1 "%ABS_FILE%" 86 | destination = 0x74c000 87 | origin = 0xd38000 88 | SENDBYTE 1 "%ABS_FILE%" 89 | destination = 0x750000 90 | origin = 0xd48000 91 | SENDBYTE 1 "%ABS_FILE%" 92 | destination = 0x754000 93 | origin = 0xd58000 94 | SENDBYTE 1 "%ABS_FILE%" 95 | destination = 0x758000 96 | origin = 0xd68000 97 | SENDBYTE 1 "%ABS_FILE%" 98 | destination = 0x75c000 99 | origin = 0xd78000 100 | SENDBYTE 1 "%ABS_FILE%" 101 | destination = 0x760000 102 | origin = 0xd88000 103 | SENDBYTE 1 "%ABS_FILE%" 104 | destination = 0x764000 105 | origin = 0xd98000 106 | SENDBYTE 1 "%ABS_FILE%" 107 | destination = 0x768000 108 | origin = 0xda8000 109 | SENDBYTE 1 "%ABS_FILE%" 110 | destination = 0x76c000 111 | origin = 0xdb8000 112 | SENDBYTE 1 "%ABS_FILE%" 113 | destination = 0x770000 114 | origin = 0xdc8000 115 | SENDBYTE 1 "%ABS_FILE%" 116 | destination = 0x774000 117 | origin = 0xdd8000 118 | SENDBYTE 1 "%ABS_FILE%" 119 | destination = 0x778000 120 | origin = 0xde8000 121 | SENDBYTE 1 "%ABS_FILE%" 122 | destination = 0x77c000 123 | origin = 0xdf8000 124 | SENDBYTE 1 "%ABS_FILE%" 125 | destination = 0x780000 126 | origin = 0xe08000 127 | SENDBYTE 1 "%ABS_FILE%" 128 | destination = 0x784000 129 | origin = 0xe18000 130 | SENDBYTE 1 "%ABS_FILE%" 131 | destination = 0x788000 132 | origin = 0xe28000 133 | SENDBYTE 1 "%ABS_FILE%" 134 | destination = 0x78c000 135 | origin = 0xe38000 136 | SENDBYTE 1 "%ABS_FILE%" 137 | destination = 0x790000 138 | origin = 0xe48000 139 | SENDBYTE 1 "%ABS_FILE%" 140 | destination = 0x794000 141 | origin = 0xe58000 142 | SENDBYTE 1 "%ABS_FILE%" 143 | destination = 0x798000 144 | origin = 0xe68000 145 | SENDBYTE 1 "%ABS_FILE%" 146 | destination = 0x79c000 147 | origin = 0xe78000 148 | SENDBYTE 1 "%ABS_FILE%" 149 | destination = 0x7a0000 150 | origin = 0xe88000 151 | SENDBYTE 1 "%ABS_FILE%" 152 | destination = 0x7a4000 153 | origin = 0xe98000 154 | SENDBYTE 1 "%ABS_FILE%" 155 | destination = 0x7a8000 156 | origin = 0xea8000 157 | SENDBYTE 1 "%ABS_FILE%" 158 | destination = 0x7ac000 159 | origin = 0xeb8000 160 | SENDBYTE 1 "%ABS_FILE%" 161 | destination = 0x7b0000 162 | origin = 0xec8000 163 | SENDBYTE 1 "%ABS_FILE%" 164 | destination = 0x7b4000 165 | origin = 0xed8000 166 | SENDBYTE 1 "%ABS_FILE%" 167 | destination = 0x7b8000 168 | origin = 0xee8000 169 | SENDBYTE 1 "%ABS_FILE%" 170 | destination = 0x7bc000 171 | origin = 0xef8000 172 | SENDBYTE 1 "%ABS_FILE%" 173 | destination = 0x7c0000 174 | origin = 0xf08000 175 | SENDBYTE 1 "%ABS_FILE%" 176 | destination = 0x7c4000 177 | origin = 0xf18000 178 | SENDBYTE 1 "%ABS_FILE%" 179 | destination = 0x7c8000 180 | origin = 0xf28000 181 | SENDBYTE 1 "%ABS_FILE%" 182 | destination = 0x7cc000 183 | origin = 0xf38000 184 | SENDBYTE 1 "%ABS_FILE%" 185 | destination = 0x7d0000 186 | origin = 0xf48000 187 | SENDBYTE 1 "%ABS_FILE%" 188 | destination = 0x7d4000 189 | origin = 0xf58000 190 | SENDBYTE 1 "%ABS_FILE%" 191 | destination = 0x7d8000 192 | origin = 0xf68000 193 | SENDBYTE 1 "%ABS_FILE%" 194 | destination = 0x7dc000 195 | origin = 0xf78000 196 | SENDBYTE 1 "%ABS_FILE%" 197 | destination = 0x7e0000 198 | origin = 0xf88000 199 | SENDBYTE 1 "%ABS_FILE%" 200 | destination = 0x7e4000 201 | origin = 0xf98000 202 | SENDBYTE 1 "%ABS_FILE%" 203 | destination = 0x7e8000 204 | origin = 0xfa8000 205 | SENDBYTE 1 "%ABS_FILE%" 206 | destination = 0x7ec000 207 | origin = 0xfb8000 208 | SENDBYTE 1 "%ABS_FILE%" 209 | destination = 0x7f0000 210 | origin = 0xfc8000 211 | SENDBYTE 1 "%ABS_FILE%" 212 | destination = 0x7f4000 213 | origin = 0xfd8000 214 | SENDBYTE 1 "%ABS_FILE%" 215 | destination = 0x7f8000 216 | origin = 0xfe8000 217 | SENDBYTE 1 "%ABS_FILE%" 218 | destination = 0x7fc000 219 | origin = 0xff8000 220 | SENDBYTE 1 "%ABS_FILE%" 221 | 222 | CLOSE 223 | 224 | /*****************************************************************************/ 225 | 226 | /* logical s-record file */ 227 | 228 | OPENFILE "%ABS_FILE%.s19" 229 | format = motorola 230 | busWidth = 1 231 | SRECORD=Sx 232 | 233 | /* logical non banked flash at $4000 and $C000 to logical */ 234 | len = 0x4000 235 | origin = 0x004000 236 | destination = 0x004000 237 | SENDBYTE 1 "%ABS_FILE%" 238 | 239 | len = 0x4000 240 | origin = 0x00C000 241 | destination = 0xC000 242 | SENDBYTE 1 "%ABS_FILE%" 243 | 244 | /* physical flash window to logical */ 245 | len = 0x4000 246 | origin = 0x008000 247 | destination = 0xFE8000 248 | SENDBYTE 1 "%ABS_FILE%" 249 | 250 | 251 | /* logical 1 MB banked flash to logical */ 252 | len = 0x400000 253 | origin = 0xC00000 254 | destination = 0xC00000 255 | SENDBYTE 1 "%ABS_FILE%" 256 | 257 | 258 | /* global 1 MB banked flash to logical */ 259 | len = 0x4000 260 | origin = 0x1700000 261 | destination = 0xc08000 262 | SENDBYTE 1 "%ABS_FILE%" 263 | origin = 0x1704000 264 | destination = 0xc18000 265 | SENDBYTE 1 "%ABS_FILE%" 266 | origin = 0x1708000 267 | destination = 0xc28000 268 | SENDBYTE 1 "%ABS_FILE%" 269 | origin = 0x170c000 270 | destination = 0xc38000 271 | SENDBYTE 1 "%ABS_FILE%" 272 | origin = 0x1710000 273 | destination = 0xc48000 274 | SENDBYTE 1 "%ABS_FILE%" 275 | origin = 0x1714000 276 | destination = 0xc58000 277 | SENDBYTE 1 "%ABS_FILE%" 278 | origin = 0x1718000 279 | destination = 0xc68000 280 | SENDBYTE 1 "%ABS_FILE%" 281 | origin = 0x171c000 282 | destination = 0xc78000 283 | SENDBYTE 1 "%ABS_FILE%" 284 | origin = 0x1720000 285 | destination = 0xc88000 286 | SENDBYTE 1 "%ABS_FILE%" 287 | origin = 0x1724000 288 | destination = 0xc98000 289 | SENDBYTE 1 "%ABS_FILE%" 290 | origin = 0x1728000 291 | destination = 0xca8000 292 | SENDBYTE 1 "%ABS_FILE%" 293 | origin = 0x172c000 294 | destination = 0xcb8000 295 | SENDBYTE 1 "%ABS_FILE%" 296 | origin = 0x1730000 297 | destination = 0xcc8000 298 | SENDBYTE 1 "%ABS_FILE%" 299 | origin = 0x1734000 300 | destination = 0xcd8000 301 | SENDBYTE 1 "%ABS_FILE%" 302 | origin = 0x1738000 303 | destination = 0xce8000 304 | SENDBYTE 1 "%ABS_FILE%" 305 | origin = 0x173c000 306 | destination = 0xcf8000 307 | SENDBYTE 1 "%ABS_FILE%" 308 | origin = 0x1740000 309 | destination = 0xd08000 310 | SENDBYTE 1 "%ABS_FILE%" 311 | origin = 0x1744000 312 | destination = 0xd18000 313 | SENDBYTE 1 "%ABS_FILE%" 314 | origin = 0x1748000 315 | destination = 0xd28000 316 | SENDBYTE 1 "%ABS_FILE%" 317 | origin = 0x174c000 318 | destination = 0xd38000 319 | SENDBYTE 1 "%ABS_FILE%" 320 | origin = 0x1750000 321 | destination = 0xd48000 322 | SENDBYTE 1 "%ABS_FILE%" 323 | origin = 0x1754000 324 | destination = 0xd58000 325 | SENDBYTE 1 "%ABS_FILE%" 326 | origin = 0x1758000 327 | destination = 0xd68000 328 | SENDBYTE 1 "%ABS_FILE%" 329 | origin = 0x175c000 330 | destination = 0xd78000 331 | SENDBYTE 1 "%ABS_FILE%" 332 | origin = 0x1760000 333 | destination = 0xd88000 334 | SENDBYTE 1 "%ABS_FILE%" 335 | origin = 0x1764000 336 | destination = 0xd98000 337 | SENDBYTE 1 "%ABS_FILE%" 338 | origin = 0x1768000 339 | destination = 0xda8000 340 | SENDBYTE 1 "%ABS_FILE%" 341 | origin = 0x176c000 342 | destination = 0xdb8000 343 | SENDBYTE 1 "%ABS_FILE%" 344 | origin = 0x1770000 345 | destination = 0xdc8000 346 | SENDBYTE 1 "%ABS_FILE%" 347 | origin = 0x1774000 348 | destination = 0xdd8000 349 | SENDBYTE 1 "%ABS_FILE%" 350 | origin = 0x1778000 351 | destination = 0xde8000 352 | SENDBYTE 1 "%ABS_FILE%" 353 | origin = 0x177c000 354 | destination = 0xdf8000 355 | SENDBYTE 1 "%ABS_FILE%" 356 | origin = 0x1780000 357 | destination = 0xe08000 358 | SENDBYTE 1 "%ABS_FILE%" 359 | origin = 0x1784000 360 | destination = 0xe18000 361 | SENDBYTE 1 "%ABS_FILE%" 362 | origin = 0x1788000 363 | destination = 0xe28000 364 | SENDBYTE 1 "%ABS_FILE%" 365 | origin = 0x178c000 366 | destination = 0xe38000 367 | SENDBYTE 1 "%ABS_FILE%" 368 | origin = 0x1790000 369 | destination = 0xe48000 370 | SENDBYTE 1 "%ABS_FILE%" 371 | origin = 0x1794000 372 | destination = 0xe58000 373 | SENDBYTE 1 "%ABS_FILE%" 374 | origin = 0x1798000 375 | destination = 0xe68000 376 | SENDBYTE 1 "%ABS_FILE%" 377 | origin = 0x179c000 378 | destination = 0xe78000 379 | SENDBYTE 1 "%ABS_FILE%" 380 | origin = 0x17a0000 381 | destination = 0xe88000 382 | SENDBYTE 1 "%ABS_FILE%" 383 | origin = 0x17a4000 384 | destination = 0xe98000 385 | SENDBYTE 1 "%ABS_FILE%" 386 | origin = 0x17a8000 387 | destination = 0xea8000 388 | SENDBYTE 1 "%ABS_FILE%" 389 | origin = 0x17ac000 390 | destination = 0xeb8000 391 | SENDBYTE 1 "%ABS_FILE%" 392 | origin = 0x17b0000 393 | destination = 0xec8000 394 | SENDBYTE 1 "%ABS_FILE%" 395 | origin = 0x17b4000 396 | destination = 0xed8000 397 | SENDBYTE 1 "%ABS_FILE%" 398 | origin = 0x17b8000 399 | destination = 0xee8000 400 | SENDBYTE 1 "%ABS_FILE%" 401 | origin = 0x17bc000 402 | destination = 0xef8000 403 | SENDBYTE 1 "%ABS_FILE%" 404 | origin = 0x17c0000 405 | destination = 0xf08000 406 | SENDBYTE 1 "%ABS_FILE%" 407 | origin = 0x17c4000 408 | destination = 0xf18000 409 | SENDBYTE 1 "%ABS_FILE%" 410 | origin = 0x17c8000 411 | destination = 0xf28000 412 | SENDBYTE 1 "%ABS_FILE%" 413 | origin = 0x17cc000 414 | destination = 0xf38000 415 | SENDBYTE 1 "%ABS_FILE%" 416 | origin = 0x17d0000 417 | destination = 0xf48000 418 | SENDBYTE 1 "%ABS_FILE%" 419 | origin = 0x17d4000 420 | destination = 0xf58000 421 | SENDBYTE 1 "%ABS_FILE%" 422 | origin = 0x17d8000 423 | destination = 0xf68000 424 | SENDBYTE 1 "%ABS_FILE%" 425 | origin = 0x17dc000 426 | destination = 0xf78000 427 | SENDBYTE 1 "%ABS_FILE%" 428 | origin = 0x17e0000 429 | destination = 0xf88000 430 | SENDBYTE 1 "%ABS_FILE%" 431 | origin = 0x17e4000 432 | destination = 0xf98000 433 | SENDBYTE 1 "%ABS_FILE%" 434 | origin = 0x17e8000 435 | destination = 0xfa8000 436 | SENDBYTE 1 "%ABS_FILE%" 437 | origin = 0x17ec000 438 | destination = 0xfb8000 439 | SENDBYTE 1 "%ABS_FILE%" 440 | origin = 0x17f0000 441 | destination = 0xfc8000 442 | SENDBYTE 1 "%ABS_FILE%" 443 | origin = 0x17f4000 444 | destination = 0xfd8000 445 | SENDBYTE 1 "%ABS_FILE%" 446 | origin = 0x17f8000 447 | destination = 0xfe8000 448 | SENDBYTE 1 "%ABS_FILE%" 449 | origin = 0x17fc000 450 | destination = 0xff8000 451 | SENDBYTE 1 "%ABS_FILE%" 452 | 453 | CLOSE 454 | -------------------------------------------------------------------------------- /sure location.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/sure location.txt -------------------------------------------------------------------------------- /新建 文本文档.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuxie2015/Smart_car/602005a1a4d08ea81b6298a4a6c01d07f4caf7fc/新建 文本文档.txt --------------------------------------------------------------------------------