www.pudn.com > rtu.rar > CSTART.A96
; ; This is an example STARTUP file. ; @(#)cstart.a96 1.4 (nt-ef) ; ; To Assemble: ; asm196 cstart.a96 oj(cstart.obj) cmain model(nt) ; The 'cmain' control will allow symbol 'main' to be used. ; ; If FPAL96 is used, enable the calling of 'fpinit'. ; ; Read Chapter 13 of Intel's 8xC196NT Microcontroller User's ; Manual very carefully. ; It tells you exactly how to access external memory, as this ; determines the usage of EPORT and P5. ; (Intel User's Manual Order number: 272317-002) ; Note that an example initialization is given below in comment. ; cstart module cmain $include(_SFR_INC_) rseg extrn TMPREG0 extrn WORK extrn WTMP cseg at 0ff2080h public _cstart extrn fpinit:null extrn main:null extrn _main:null _cstart: st r0,epa8_time_3e; ld sp,#STACK di; clr WORK; inc WORK; ; external memory access initialization: ldb wsr, #3Fh ; 64 byte window at 1f80 ; From now on use SFR names with _3f suffix ldb TMPREG0, #00 stb TMPREG0, ep_reg ; set page number to 0 ldb TMPREG0, #0fh stb TMPREG0, ep_mode ; use pins as extended address pins ldb TMPREG0, #0ffh stb TMPREG0, p5_mode ; set all pins to 'special function' ldb TMPREG0, #00 stb TMPREG0, p6_mode ; set all pins to 'special function' ldb TMPREG0, #00 stb TMPREG0, p6_dir; ; set all pins to 'special function' clr WTMP; loop: inc WTMP clr WORK; loop3: inc WORK ldb TMPREG0, #0fh; stb TMPREG0, p6_reg; ; set all pins to 'special function' ldb TMPREG0, #4fh; stb TMPREG0, p6_reg; ; set all pins to 'special function' cmp WORK, #010000; jnc loop3; cmp WTMP, #2; jnc loop; if _24_BITS_ and _FAR_CODE_ ; ecall fpinit ; ejmp main ejmp _main else ; lcall fpinit ; ljmp main ljmp _main endif ; ; Some applications might want to do a CALL to main, ; and also have exit() calls. ; In that case enable the following: ;if _24_BITS_ and _FAR_CODE_ ; ECALL main ;else ; LCALL main ;endif ; _exit: PUBLIC _exit BR _exit ;exit: ; PUBLIC exit ;_cstop: ; PUBLIC _cstop ; public for debuggers to set a breakpoint ; BR _cstop ; keep on looping end