Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2014
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.29 KB | None | 0 0
  1. ;
  2. ; EVM320C243 Test Code
  3. ; Copyright (c) 1997.
  4. ; Spectrum Digital, Inc.
  5. ; ALL RIGHTS RESERVED
  6. ;
  7.  
  8. ;
  9. ; This is a modification of the boot routine V6.60 from the TI run time
  10. ; support library. This was chosen as a starting point because TI
  11. ; split the C5x and 2x/2xx combination.
  12. ;
  13.  
  14. ;
  15. ;
  16. ; This module contains the following definitions :
  17. ;
  18. ; __stack - Stack memory area
  19. ; _c_int0 - Boot function
  20. ; _var_init - Function which processes initialization tables
  21. ;
  22. ;
  23. .include LF240x.h ; hier die pripherieadressen für asm-prog klein geschrieben
  24.  
  25. .global _c_int0, cinit
  26. .global _main, _abort
  27. .global .bss, end
  28.  
  29.  
  30. WD_CNTR .set 07023h ;WD Counter reg
  31. WD_KEY .set 07025h ;WD Key reg
  32. WD_CNTL .set 07029h ;WD Control reg
  33.  
  34. scsr1 .set 07018h
  35. dp7000 .set 224 ;page 1 of peripheral file (7000h/80h)
  36.  
  37. WSGR .set 0FFFFh ;Wait State Generator Register
  38.  
  39.  
  40. ;-----------------------------------------------------------------------------
  41. ; Debug directives
  42. ;-----------------------------------------------------------------------------
  43. .def GPR0 ;General purpose registers.
  44. .def GPR1
  45. .def GPR2
  46. .def GPR3
  47.  
  48.  
  49. ;-----------------------------------------------------------------------------
  50. ; Variable Declarations for on chip RAM Blocks
  51. ;-----------------------------------------------------------------------------
  52. .bss GPR0,1 ;General purpose registers.
  53. .bss GPR1,1
  54. .bss GPR2,1
  55. .bss GPR3,1
  56. .bss REG5,1
  57. .bss REGA,1
  58.  
  59.  
  60.  
  61. ;-----------------------------------------------------------------------------
  62. ; M A C R O - Definitions
  63. ;-----------------------------------------------------------------------------
  64. SBIT0 .macro DMA, MASK ;Clear bit Macro
  65. LACC DMA
  66. AND #(0FFFFh-MASK)
  67. SACL DMA
  68. .endm
  69.  
  70. SBIT1 .macro DMA, MASK ;Set bit Macro
  71. LACC DMA
  72. OR #MASK
  73. SACL DMA
  74. .endm
  75.  
  76. kickdog .macro ;Watchdog reset macro
  77. LDP #00E0h
  78. SPLK #05555h, WD_KEY
  79. SPLK #0AAAAh, WD_KEY
  80. LDP #0h
  81. .endm
  82.  
  83.  
  84. ;
  85. ; CONST COPY OPTION
  86. ; If your system cannot support allocating an initialized section to data
  87. ; memory, and you want the boot routine to copy .const from program to
  88. ; data memory, then set this CONST_COPY variable to 1
  89. ;
  90. ; Note the code that does the copy depends on you having the following
  91. ; in your linker command file
  92. ;
  93. ; MEMORY
  94. ; {
  95. ; PAGE 0 : PROG : ... /* 'PROG' AND 'DATA' ARE EXAMPLE NAMES */
  96. ; PAGE 1 : DATA : ...
  97. ; ...
  98. ; }
  99. ;
  100. ; SECTIONS
  101. ; {
  102. ; ...
  103. ; .const : load = PROG PAGE 0, run = DATA PAGE 1
  104. ; {
  105. ; __const_run = . ;
  106. ; *(.c_mark)
  107. ; *(.const)
  108. ; __const_length = . - __const_run;
  109. ; }
  110. ; ...
  111. ; }
  112. ;
  113. CONST_COPY .set 0
  114.  
  115. ;
  116. ; For CONST COPY, Define the load address of the .const section
  117. ; depends on linker command file being written as above
  118. ;
  119. .if CONST_COPY
  120. .sect ".c_mark"
  121. .label __const_load
  122.  
  123. .global __const_run, __const_length
  124.  
  125. .text
  126. .endif ; CONST_COPY
  127.  
  128. ;
  129. ; Declare the stack. Size is determined by the linker option -stack
  130. ;
  131. __stack: .usect ".stack",0
  132.  
  133. ;
  134. ; FUNCTION DEF : _c_int0
  135. ;
  136. ; 1) Set up stack
  137. ; 2) Set up proper status
  138. ; 3) If "cinit" is not -1, init global variables
  139. ; 4) call users' program
  140. ;
  141. ;
  142. ;
  143. _c_int0: ; entry point from reset vector
  144.  
  145. SETC INTM ;Disable interrupts
  146. ;
  147. ; Initialize status bit fields *NOT* initialized at reset
  148. ;
  149. CLRC XF ; turn off xf bit
  150. CLRC SXM ;Clear Sign Extension Mode
  151. CLRC OVM ;Reset Overflow Mode
  152. CLRC CNF ;Config Block B0 to Data mem.
  153.  
  154. LDP #0E0h
  155. SPLK #006Fh,WD_CNTL
  156. kickdog
  157. LDP #00E0h
  158.  
  159.  
  160. ; ldp #mcra >> 7 ; der org.-code nimmt GPR3 ist bei def. von ram vor main aber nicht sicher zuerreichen
  161. ; SPLK #4h,mcra
  162. ; OUT mcra,WSGR ;Set XMIF to run w/no(0) wait states
  163. ; SPLK #0h,mcra ; mcra zurück in den resetzustand
  164.  
  165. ldp #dp300 ; der org.-code nimmt GPR3 ist bei def. von ram vor main aber nicht sicher zuerreichen
  166. SPLK #0h,0 ; 0x300
  167. OUT 0,WSGR ; 0x300 nach WSGR Set XMIF to run w/no(0) wait states
  168.  
  169. nop
  170. LDP #dp7000
  171. lacl scsr1
  172. ;
  173. ;Set PLL for x4 mode
  174. ; 5432109876543210
  175. and #1111000111111111b
  176. sacl scsr1
  177.  
  178. LDP #padatdir >> 7
  179. lacl padatdir
  180. ; 7654321076543210
  181. or #0000010000000000b ; iopa2 auf ausgang laufzeitmessung
  182. sacl padatdir
  183.  
  184. lauf:
  185. LDP #padatdir >> 7
  186. lacl padatdir
  187. ; 7654321076543210
  188. and #1111111111111011b ; iopa2 auf ausgang laufzeitmessung
  189. sacl padatdir
  190. lacl padatdir
  191. or #bit2
  192. sacl padatdir
  193. ; b lauf
  194.  
  195. call clrram60h ; 60-iger Bereich auf Null
  196. call clrram300h ; 300-iger Bereich auf Null
  197. call clrram200h ; 200-iger Bereich auf Null
  198. call clrram800h ; 800-iger Bereich auf Null
  199.  
  200. ; call initpwmA ; init PWM-A
  201. ; call initpwmB ; init PWM-B
  202. ; call initadc ; init Analog-Digi.-Wandler
  203. ;
  204. ; Set up initial stack and frame pointers
  205. ;
  206. LRLK AR0,__stack ; set up frame pointer
  207. LRLK AR1,__stack ; set up stack pointer
  208.  
  209. ;
  210. ; Initialize status bit fields which are set to these same values by reset.
  211. ; If you run this routine from reset, you can comment out this code.
  212. ;
  213. SPM 0 ; product shift count of zero
  214. MAR *,AR0 ; AR = 0, mls 10/07/96
  215.  
  216. SSXM ; set SXM=1 for next instruction
  217. ;
  218. ; If cinit is not -1, process initialization tables
  219. ;
  220. LALK cinit ; get pointer to init tables
  221. ADDK 1
  222. BZ skip ; if (cinit == -1)
  223.  
  224. CALL _var_init,AR1 ; var_init()
  225.  
  226. ;
  227. ; Call the user's program
  228. ;
  229. skip:
  230. .if CONST_COPY
  231. CALL const_copy
  232. .endif
  233.  
  234. ; start of hw stack init code
  235. LACK #0014h ; vectors for underflow
  236. SACL *
  237. PSHD *
  238. PSHD *
  239. PSHD *
  240. PSHD *
  241. PSHD *
  242. PSHD *
  243. PSHD *
  244. PSHD *
  245.  
  246. CALL _main,AR1
  247. CALL _abort,AR1 ; to never return...
  248.  
  249. .page
  250.  
  251. ; setze ram auf Null
  252.  
  253. clrram60h ; 32 worte
  254. lar ar1,#60H ;begin des ram nach ar1
  255. mar *,ar1 ; arp mit ar1 laden
  256. lac #0 ;accu auf null
  257. rptk 31 ; 31 mal speichen von accu mit increment
  258. sacl *+ ; 32-ste mal
  259. ret
  260.  
  261. clrram300h ; 255 worte
  262. lar ar1,#300H ; begin des ram nach ar1
  263. mar *,ar1 ; arp mit ar1 laden
  264. lac #0 ; accu auf null
  265. rptk 255 ; 255 mal speichen von accu mit increment
  266. sacl *+
  267. ret
  268.  
  269. clrram200h ; 255 worte
  270. lar ar1,#200H ; begin des ram nach ar1
  271. mar *,ar1 ; arp mit ar1 laden
  272. lac #0 ; accu auf null
  273. rptk 255 ; 255 mal speichen von accu mit increment
  274. sacl *+
  275. ret
  276. clrram800h ; 2048 worte
  277. lar ar1,#800H ; begin des ram nach ar1
  278. mar *,ar1 ; arp mit ar1 laden
  279. lacl #2048
  280. c800 push
  281. kickdog
  282. lac #0 ; accu auf null
  283. sacl *+
  284. pop
  285. sub #1
  286. bcnd c800,neq
  287. nop
  288. nop
  289. ret
  290.  
  291.  
  292. ;----------------------------------------------------
  293. ; Init ADC registers
  294. ;---------------------------------------------------
  295. initadc
  296. ldp #dp7000
  297. lacl scsr1
  298. or #0000000010000000b ; Enable clock to ADC module
  299. sacl scsr1
  300. LDP #dp7080;0E1h
  301. SPLK #0100000000000000b,adctrl1 ; Reset ADC module
  302. nop
  303. nop
  304. SPLK #0011000100010000b,adctrl1 ; Take ADC out of reset
  305. ; ||||||||||||||||
  306. ; 5432109876543210
  307. ; bit 15 RSVD |
  308. ; bit 14 Reset(1) |
  309. ; bit 13,12 Soft & Free
  310. ; bit 11->8 0001 = 385 Ohm Acq.prescalers
  311. ; bit 7 0 Clock prescaler
  312. ; bit 6 Cont.run (1)
  313. ; bit 5 Int.priority (Hi.0)
  314. ; bit 4 Seq.casc (0dual)
  315. ; Setup a maximum of 16 conversions
  316. ; SPLK #15,max_conv ; Setup for 16 conversions
  317. ; Setup of 5 conversions
  318. ; adc0 x1=y aus Reihenschwingkreis;
  319. ; adc1 x2 aus Reihenschwingkreis
  320. ; adc2 Y1 aus Zweigrößemregelung
  321. ; adc3 Y2 aus Zweigrößemregelung
  322. ; adc4 sollwertsprung zwischen 1,988 und 1,25 Volt
  323. SPLK #4,max_conv ; Setup for 5 conversions
  324.  
  325. ; Program the conversion sequence. This is the sequence of channels that will
  326. ; be used for the 16 conversions.
  327. SPLK #03210h, chselseq1 ; Convert Channels 0,1,2,3
  328. SPLK #07654h, chselseq2 ; Convert Channels 4,5,6,7
  329. SPLK #0BA98h, chselseq3 ; Convert Channels 8,9,10,11
  330. SPLK #0FEDCh, chselseq4 ; Convert Channels 12,13,14,15
  331.  
  332. ret
  333.  
  334.  
  335. ;=====================================================================
  336. ; init PWM AAAAAAAAAAAAAAAAAAAAAAAA
  337. ; achtung gptcona wird nicht beruehrt
  338. ;=====================================================================
  339. initpwmA:
  340.  
  341. ; switch on EVA
  342. LDP #dp7000
  343. lacl scsr1
  344. ; 5432109876543210
  345. or #0000000000000100b
  346. SACL scsr1
  347.  
  348. LDP #dp7080 ;DP-->7080h-70FFh
  349. lacl mcra ;Set IOPA pins and IOPB pins Seite 5-6
  350. ;to primary function for pwm.
  351. ; 5432109876543210
  352. or #0000111111000000b ;
  353. sacl mcra
  354.  
  355.  
  356. LDP #dp7400
  357. ; Initialize counter registers
  358. SPLK #00000H,t1cnt ;7401h GP Timer 1 counter
  359.  
  360. ;----------------------------------------------------------------------
  361. ; init PWM The following section of codes initializes asymmetric PWM with
  362. ; dead band Configure ACTRA
  363. ;-----------------------------------------------------------------------
  364. ldp #dp7400
  365. ;
  366.  
  367. SPLK #0000011001100110b,actra ; neg bei label
  368. ; |||||||||||||||| gopwm4 darf nicht aktiv sein
  369. ; 5432109876543210
  370. ;
  371. * bit 15 0 SV rotation direction (for here not applicable)
  372. * bits 14-12 000 Space vector bits (for here not applicable)
  373. * bits 11-10 01 PWM6 active low
  374. * bits 9-8 10 PWM5 active high
  375. * bits 7-6 10 PWM4 active low
  376. * bits 5-4 01 PWM3 active high
  377. * bits 3-2 01 PWM2 active low
  378. * bits 1-0 10 PWM1 active high
  379. ;
  380.  
  381.  
  382. ;--------------------------------------------------------------------
  383. ; init PWM Configure DBTCONA
  384. ;-----------------------------------------------------------------------
  385. ldp #dp7400
  386. ; SPLK #0000000111100100b,dbtcona ; fuer IGBT-Treiber
  387. SPLK #0000011111100100b,dbtcona ; totzeit
  388. SPLK #0000000111100000b,dbtcona ; totzeit
  389. ; SPLK #0000111111100100b,dbtcona ; totzeit
  390. ; ||||||||||||||||
  391. ; 5432109876543210
  392. ; bit 15-12 reserved
  393. ;
  394. ; bit 7 1 dead-band timer 3 enable PWM5 und 6
  395. ; bit 6 1 dead-band timer 2 enable PWM3 und 4
  396. ; bit 5 1 dead-band timer 1 enable PWM1 und 2
  397. ; bit 4-2 001 dead-band timer prescaler 000 x/1 001 x/2 010 x/4 011 x/8
  398. ; bit 1-0 reserved
  399. ; bit 4-2 001
  400. ; bit 11-8 1111 1 uSek tot
  401. ; bit 11-8 0001 100 nSek tot
  402. ; bit 11-8 1000 0,6 uSek tot
  403. ; bit 11-8 1111 1uSek tot
  404. ; bit 11-8 0111
  405. ; eupec-modul bei 0001 ca. 43°c gemessen nachgeben des bef14
  406. ; 0111 gewählt. Bei 0000 steig dei temp deutlich
  407. ; für IXYS 0100
  408. ; temperaturen an den HARRIS-IGBTs bei verschiederenen totzeiten
  409. ; gemessen wurde ohne Last, Positiooniert bei 20°C Raumtemperatur
  410. ; im schraubloch des IGBTS neben dem Shopper IGBT
  411. ; totzeit 0111 35.1°C
  412. ; totzeit 0100 36.9°C
  413. ; totzeit 0000 41.2°C
  414. ; Initialize period registers
  415. ldp #dp7400
  416. SPLK #64000,t1per ; this is the period of pwm !!!!
  417.  
  418. ; Initialize compare registers for 50% duty cycle, about 25KHz frequency
  419. SPLK #3,cmpr1 ;7417h F. Comp U 1 compare value
  420. SPLK #3,cmpr2 ;7418h F. Comp U 2 compare value
  421. SPLK #3,cmpr3 ;7419h F. Comp U 3 compare value
  422.  
  423. ;-----------------------------------------------------------------------------
  424. ; init PWM initialize comcona registers
  425. ;----------------------------------------------------------------------
  426. ;
  427. ldp #dp7400
  428. SPLK #1100100000000000b,comcona ;7411h
  429. ; 5432109876543210
  430. ; bit 15 1 enable compare aktion
  431. ; bit 14-13 10 immediate reload condition ?????? 01 00
  432. ; bit 12 0 space vektor disbale
  433. ; bit 11-10 10 immediate actionreg reload condition ??????? 01 00
  434. ; bit 9 0 PWMout in high impedance
  435. ; bit 8-0 -- reseviert
  436. ;
  437. ;----------------------------------------------------------------
  438. ; Configure T1CON and start GP Timers 1
  439. ldp #dp7400
  440. splk #1100111101000110b,t1con
  441. ; FEDCBA9876543210
  442. ; f-e 01 nach emulatorstopp mache weiter bis zum compare.
  443. ; Damit werden die ausgaenge auf def. Zustand gebracht
  444. ; D -------------
  445. ; c-b 10 contin. up count for asym. waveform
  446. ; c-b 01 contin up/down-count for sym. pwm-waveform
  447. ; a-8 000 inputclock pre = 128
  448. ; 7 0 use own tenable bit
  449. ; 6 0 tenable achtng bit 6 wird am schluss von intall gesetzt
  450. ; 5-4 00 clock source intern
  451. ; 3-2 00 timer compare reg reload ??????????? vergkl. mit copmare
  452. ; 1 1 enable timer compare
  453. ; 0 0 use own period register
  454. ; b initall
  455. ; !!!!!!!!!! PWM AAAAAAAAA is now running wenn in comcona bit 9=1 gestzt wird !!!!!!!!!!
  456. ; b $+0
  457. ret
  458.  
  459. ;=====================================================================
  460. ; init PWM BBBBBBBBBBBBBBBBBBBBB
  461. ;=====================================================================
  462. initpwmB:
  463.  
  464. ; switch on EVB
  465. LDP #dp7000
  466. lacl scsr1
  467. ; 5432109876543210
  468. or #0000000000001000b
  469. SACL scsr1
  470.  
  471. LDP #dp7080 ;DP-->7080h-70FFh
  472. lacl mcrc ;Set only IOPE4 PWM10 und IOPE6 PWM12 !!!! Seite 5-8
  473. ;to primary function for pwm.
  474. ; 5432109876543210
  475. or #0000000001010000b ;
  476. sacl mcrc
  477.  
  478. LDP #dp7500
  479. ; Initialize counter registers
  480. SPLK #00000H,t3cnt ;
  481.  
  482. ;----------------------------------------------------------------------
  483. ;init PWM The following section of codes initializes asymmetric PWM with
  484. ; dead band Configure ACTRB
  485. ;-----------------------------------------------------------------------
  486. ldp #dp7500
  487. ; in diesem Fall gibt es in der drehzahlregelung kein anderes
  488. ; als bei dem fall, wenn neg bei hopwm4 aktiv ist (bei kleinen
  489. ; drehzahlen kein unterschied. der unterschied ist das mit neg
  490. ; aktiv mehr energie zurueckgespeist wird, waehrend im anderen fall
  491. ; die bremsenergie in den igbts umgesetzt wird
  492. ; SPLK #0000011010010110b,actrb ; neg bei label
  493. ; |||||||||||||||| gopwm4 muss aktiv sein
  494. ; 5432109876543210
  495. ;
  496. * bit 15 0 SV rotation direction (for here not applicable)
  497. * bits 14-12 000 Space vector bits (for here not applicable)
  498. * bits 11-10 01 PWM6 active low
  499. * bits 9-8 10 PWM5 active high
  500. * bits 7-6 10 PWM4 active high
  501. * bits 5-4 01 PWM3 active low
  502. * bits 3-2 01 PWM2 active low
  503. * bits 1-0 10 PWM1 active high
  504. ;
  505.  
  506. SPLK #0000011001100110b,actrb ; neg bei label
  507. ; |||||||||||||||| gopwm4 darf nicht aktiv sein
  508. ; 5432109876543210
  509. ;
  510. * bit 15 0 SV rotation direction (for here not applicable)
  511. * bits 14-12 000 Space vector bits (for here not applicable)
  512. * bits 11-10 01 PWM6 active low
  513. * bits 9-8 10 PWM5 active high
  514. * bits 7-6 10 PWM4 active low
  515. * bits 5-4 01 PWM3 active high
  516. * bits 3-2 01 PWM2 active low
  517. * bits 1-0 10 PWM1 active high
  518. ;
  519.  
  520.  
  521. ;--------------------------------------------------------------------
  522. ; init PWM Configure DBTCONB
  523. ;-----------------------------------------------------------------------
  524. ldp #dp7500
  525. ; SPLK #0000000111100100b,dbtcona ; fuer
  526. SPLK #0000000111100100b,dbtconb ; totzeit fuer amtec-treiber
  527. ; ||||||||||||||||
  528. ; 5432109876543210
  529. ; bit 5-2 reserved
  530. ; bit 1-8 1111 periode dead-band timers
  531. ; bit 7 1 dead-band timer 3 enable PWM11und 12
  532. ; bit 6 1 dead-band timer 2 enable PWM9 und 10
  533. ; bit 5 1 dead-band timer 1 enable PWM7 und 8
  534. ; bit 4-2 001 dead-band timer prescaler
  535. ; bit 1-0 reserved
  536. ; bit 4-2 001
  537. ; bit 11-8 1111 1 uSek tot
  538. ; bit 11-8 0001 100 nSek tot
  539. ; bit 11-8 1000 0,6 uSek tot
  540. ; bit 11-8 1111 1uSek tot
  541.  
  542. ; Initialize period registers
  543. ldp #dp7500
  544. SPLK #1024,t3per ; this is the period of pwm !!!!
  545. ; 25nSek * 1024 = 39,625 kHz Grundfrequenz
  546. ; auflösung 10 bit
  547. ; Initialize compare registers for 50% duty cycle, about 25KHz frequency
  548. SPLK #512,cmpr4 ;7517h F. Comp U 1 compare value
  549. SPLK #512,cmpr5 ;7518h F. Comp U 2 compare value
  550. SPLK #512,cmpr6 ;7519h F. Comp U 3 compare value
  551.  
  552. ;-----------------------------------------------------------------------------
  553. ; init PWM initialize comconb registers
  554. ;----------------------------------------------------------------------
  555. ;
  556. ldp #dp7500
  557. SPLK #1100101000000000b,comconb ;
  558. ; FEDCBA9876543210
  559. ; bit F 1 enable compare aktion
  560. ; bit E-D 10 immediate reload condition ?????? 01 00
  561. ; bit C 0 space vektor disbale
  562. ; bit B-A 10 immediate actionreg reload condition ??????? 01 00
  563. ; bit 9 0 PWMout in high impedance
  564. ; bit 8-0 -- reseviert
  565. ;
  566. ;----------------------------------------------------------------
  567. ; Configure T1CON and start GP Timers 1
  568. ldp #dp7500
  569. splk #1101000001000110b,t3con
  570. ; FEDCBA9876543210
  571. ; f-e 01 nach emulatorstopp mache weiter bis zum compare.
  572. ; Damit werden die ausgaenge auf def. Zustand gebracht
  573. ; D -------------
  574. ; c-b 10 contin up count
  575. ; a-8 000 inputclock pre =0
  576. ; 7 0 use own tenable bit
  577. ; 6 0 tenable achtng bit 6 wird am schluss von intall gesetzt
  578. ; 5-4 00 clock source intern
  579. ; 3-2 00 timer compare reg reload ??????????? vergkl. mit copmare
  580. ; 1 1 enable timer compare
  581. ; 0 0 use own period register
  582. ; b initall
  583. ; !!!!!!!!!! PWMBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB ist now runing
  584.  
  585. ret
  586.  
  587.  
  588. ;
  589. ; FUNCTION DEF : _var_init
  590. ;
  591. ; PROCESS INITIALIZATION TABLES. TABLES ARE IN
  592. ; PROGRAM MEMORY IN THE FOLLOWING FORMAT :
  593. ;
  594. ; .word <length of init data in words>
  595. ; .word <address of variable to initialize>
  596. ; .word <init data>
  597. ; .word ...
  598. ;
  599. ; The init table is terminated with a zero length
  600. ;
  601. ;
  602.  
  603. _var_init:
  604.  
  605. ;
  606. ; C2xx Version
  607. ;
  608. ADRK 2 ; allocate two words of local memory
  609. LALK cinit ; load accumulator with base of table
  610. LARP AR0
  611.  
  612. ;
  613. ; Read init record header.
  614. ; An init record with a zero length terminates the list.
  615. ;
  616. loop:
  617. TBLR *+ ; read length
  618. ADDK 1
  619. TBLR * ; read address
  620.  
  621. LAR AR2,*- ; load variable address into ar2
  622. LAR AR3,*,AR3 ; load count into ar3
  623. BANZ copy,*-,AR2 ; check for end of table
  624.  
  625. ;
  626. ; At end of list, return to caller
  627. ;
  628. LARP AR1
  629. SBRK 2 ; deallocate locals
  630. RET ; return to _c_int0
  631.  
  632. ;
  633. ; Perform the copy of data from program to data
  634. ;
  635. copy:
  636. ADDK 1 ; increment pointer to data
  637. TBLR *+,AR3 ; copy data from program to variable
  638. BANZ copy,*-,AR2 ; until count is zero
  639.  
  640. ADDK 1 ; point to beginning of next record
  641. B loop,AR0 ; go process next record
  642.  
  643.  
  644. .page
  645.  
  646. ;
  647. ; CONST COPY Routine - copies the .const section from program to data memory
  648. ;
  649. .if CONST_COPY
  650. const_copy:
  651.  
  652. ;
  653. ; C2xx version - must use 'RPT *' because RPTK count isn't big enough
  654. ;
  655. LALK #__const_length ; load length of const section
  656. BZ quit ; if 0, quit
  657. LRLK AR2,#__const_run ; AR2 = const address in data
  658. LALK #__const_length-1 ; load length - 1
  659. SACL * ; write to temp
  660.  
  661. RPT *,AR2 ; repeat length times
  662. BLKP #__const_load,*+ ; block copy from program
  663.  
  664. LARP AR1 ; restore ARP to SP
  665. quit:
  666. RET ; return
  667.  
  668. .endif ; CONST_COPY
  669.  
  670. .end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement