home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / bugs / 2bsd / 79 < prev    next >
Encoding:
Text File  |  1992-08-29  |  31.1 KB  |  1,066 lines

  1. Newsgroups: comp.bugs.2bsd
  2. Path: sparky!uunet!europa.asd.contel.com!awds.imsd.contel.com!wlbr!sms
  3. From: sms@WLV.IIPO.GTEGSC.COM (Steven M. Schultz)
  4. Subject: TOY clock support for the 11/93 and 11/94 (#72)
  5. Message-ID: <1992Aug29.075349.19889@wlbr.iipo.gtegsc.com>
  6. Sender: news@wlbr.iipo.gtegsc.com (news)
  7. Nntp-Posting-Host: wlv.iipo.gtegsc.com
  8. Organization: GTE Government Systems
  9. Date: Sat, 29 Aug 92 07:53:49 GMT
  10. Lines: 1054
  11.  
  12. #! /bin/sh
  13. # This is a shell archive, meaning:
  14. # 1. Remove everything above the #! /bin/sh line.
  15. # 2. Save the resulting text in a file.
  16. # 3. Execute the file with /bin/sh (not csh) to create:
  17. #    c
  18. #    toy.s
  19. # This archive created: Sat Aug 29 00:33:00 1992
  20. export PATH; PATH=/bin:/usr/bin:$PATH
  21. if test -f 'c'
  22. then
  23.     echo shar: "will not over-write existing file 'c'"
  24. else
  25. sed 's/^X//' << \SHAR_EOF > 'c'
  26. XSubject: TOY clock support for the 11/93 and 11/94 (#72)
  27. XIndex:    sys/<several> 2.11BSD
  28. X
  29. XDescription:
  30. X
  31. X    Time Of Year clock support has come to 2.11BSD at last.  In order
  32. X    to add this new feature the cpu type probe code had to be totally
  33. X    rewritten.  /boot will now properly announce an 84 as an 84 rather
  34. X    than 44 and the more recent additions to the pdp-11 family will
  35. X    also be correctly announced when as "93boot" and "94boot".
  36. X
  37. X    The first few diffs add "toy.s" and "toy.o" to the _prototype_
  38. X    makefiles, you will have to add similar modifications to your locally
  39. X    configured kernel Make.files.  It's not hard, just add toy.s in
  40. X    the same place as the diffs do, the toy.o can be put wherever
  41. X    you have about 500 bytes (it was a _lot_ of fun squeezing it down
  42. X    that tight.  Whee!) free in an overlay - the code's only called
  43. X    once so placement is definitely non critical.
  44. X
  45. X    On 11/93 and 11/94 systems (the TOY code checks the cputype and
  46. X    returns an "error" which is ignored if not on a 93 or 94) the TOY 
  47. X    clock is read at system startup time just after the root filesystem 
  48. X    is mounted, overriding the time read from the superblock.
  49. X
  50. X    NOTE:  The toy clock MUST be set (via the ODT monitor) to run
  51. X    on UCT (otherwise known as GMT).  The 'date', usw.  commands will
  52. X    provide the necessary timezone and daylight savings time corrections.
  53. X    (can you imagine trying to put the Elz timezone stuff in the _kernel_?)
  54. X
  55. X    The cpu probe logic was removed from the kernel - there was no
  56. X    sense in replicating the effort which /boot went thru.  The cputype
  57. X    is passed thru from /boot and the kernel takes advantage of that
  58. X    fact.  ALSO, the 'dump code (hardly _ever_ used any more since
  59. X    autoreboot with crash dump capability was added) in mch_dump.s
  60. X    was streamlined - it pays attention to whether or not a Unibus
  61. X    Map is present, _not_ simply whether the cpu type is 44 or 70.
  62. X
  63. X    In init_main.c there the "auto attach" call (the loop which
  64. X    previously called _every_ driver's "XXroot" entry point) has
  65. X    changed.  This happened quite a while ago (locally) when a second
  66. X    MSCP controller was added and i wanted to boot from it rather than
  67. X    the default/"first" controller.  The comments in that diff should
  68. X    make it clear what's going on - but a brief summary here might be
  69. X    a good idea:
  70. X
  71. X        All drivers work as before, in fact they don't even know
  72. X        the protocol has changed!
  73. X
  74. X        /boot passes thru both the unit number _and_ CSR of the
  75. X        controller from which the boot block was loaded.  The
  76. X        kernel now pays attention to this information, but a way
  77. X        was needed to pass it along to the driver which handles
  78. X        the system disc [N.B. the kernel still only understands
  79. X        booting from unit 0 - but it can be on _any_ controller].
  80. X        The "auto attach" loop was removed (why attach every possible
  81. X        controller when all that's needed is the drive we booted 
  82. X        from - and possibly the swap device?) and in its place
  83. X        two calls to the "root" and "swap" device drivers made.
  84. X
  85. X        As of now only the MSCP (ra.c) driver has been modified
  86. X        to handle this situation - all other drivers use hardcoded
  87. X        CSR addresses in their XXroot() routine.  I have not as
  88. X        yet posted the diffs to the ra.c driver - the changes
  89. X        to init_main.c will not be noticed by older ra.c drivers.
  90. X
  91. X        The ra.c changes (not yet posted) include a new and (i think) 
  92. X        vastly superior partition scheme, it's not a substitute for
  93. X        labels, but it does recognize _all_ MSCP drives! This change 
  94. X        was made necessary by the need to get 2.11BSD up on a 93 with
  95. X        RZ23L and RZ24L drives without adding _yet more_ tables
  96. X        to ra.c.  Watch for it Real Soon Now on comp.bugs.2bsd
  97. X
  98. X    The changes have been tested on an 11/44, 11/73, 11/84 and 11/93.  
  99. X
  100. X    Hats off and many many thanks to Terry Kennedy for the 11/93
  101. X    "donated" (bent or warped? ;-)) to the 2.11BSD effort!  The TOY 
  102. X    support wouldn't have been possible without his help.  Thank you.
  103. X
  104. XRepeat-By:
  105. X
  106. X    Not really applicable, it's all "new" stuff/features.
  107. X
  108. XFix:
  109. X    Assuming you've kept up with the previous fixes posted (available
  110. X    by request, i'm also working up a "master patch set" from the base
  111. X    2.11BSD kit) these patches should apply with no problems.  Apply
  112. X    the patches below and remake the kernel and /boot.  If you're 
  113. X    really paranoid make sure you have an old boot tape handy.  But
  114. X    definitely _do_ try this at home :-)
  115. X
  116. X    This fix is in two parts (both included).  First unshar this
  117. X    file, it will produce two files: /tmp/c and /tmp/toy.s.  Move
  118. X    /tmp/toy.s to /sys/pdp/toy.s:  mv /tmp/toy.s /sys/pdp/toy.s.
  119. X
  120. X    Then apply the rest of the patch by:  patch -p0 < /tmp/c
  121. X
  122. X=================================cut here==================================
  123. X*** /usr/src/sys/conf/Make.pdp.old    Fri Sep  2 20:20:58 1988
  124. X--- /usr/src/sys/conf/Make.pdp    Sat Jul 11 23:07:00 1992
  125. X***************
  126. X*** 32,43 ****
  127. X      ${M}/mch_click.s ${M}/mch_copy.s ${M}/mch_csv.s ${M}/mch_dump.s \
  128. X      ${M}/mch_dzpdma.s ${M}/mch_fpsim.s ${M}/mch_KScall.s \
  129. X      ${M}/mch_profile.s ${M}/mch_start.s ${M}/mch_trap.s \
  130. X!     ${M}/mch_vars.s ${M}/mch_xxx.s ${M}/scb.s
  131. X  SOBJS=    libc_bcmp.o libc_bcopy.o libc_bzero.o libc_ffs.o libc_insque.o \
  132. X      libc_ldiv.o libc_lmul.o libc_lrem.o libc_remque.o libc_strlen.o \
  133. X      libc_udiv.o mch_backup.o mch_click.o mch_copy.o mch_csv.o \
  134. X      mch_dump.o mch_dzpdma.o mch_fpsim.o mch_KScall.o mch_profile.o \
  135. X!     mch_start.o mch_trap.o mch_vars.o mch_xxx.o scb.o
  136. X  
  137. X  .c.o:
  138. X      ${CC} ${CFLAGS} -S $*.c
  139. X--- 32,43 ----
  140. X      ${M}/mch_click.s ${M}/mch_copy.s ${M}/mch_csv.s ${M}/mch_dump.s \
  141. X      ${M}/mch_dzpdma.s ${M}/mch_fpsim.s ${M}/mch_KScall.s \
  142. X      ${M}/mch_profile.s ${M}/mch_start.s ${M}/mch_trap.s \
  143. X!     ${M}/mch_vars.s ${M}/mch_xxx.s ${M}/scb.s ${M}/toy.s
  144. X  SOBJS=    libc_bcmp.o libc_bcopy.o libc_bzero.o libc_ffs.o libc_insque.o \
  145. X      libc_ldiv.o libc_lmul.o libc_lrem.o libc_remque.o libc_strlen.o \
  146. X      libc_udiv.o mch_backup.o mch_click.o mch_copy.o mch_csv.o \
  147. X      mch_dump.o mch_dzpdma.o mch_fpsim.o mch_KScall.o mch_profile.o \
  148. X!     mch_start.o mch_trap.o mch_vars.o mch_xxx.o scb.o toy.o
  149. X  
  150. X  .c.o:
  151. X      ${CC} ${CFLAGS} -S $*.c
  152. X*** /usr/src/sys/conf/Make.nsunix.old    Sun Dec 22 16:15:43 1991
  153. X--- /usr/src/sys/conf/Make.nsunix    Sat Jul 11 23:13:10 1992
  154. X***************
  155. X*** 74,80 ****
  156. X      sys_pipe.o
  157. X  # OV6 gets the (hopefully) never used routines
  158. X  OV6=    clock.o dn.o init_main.o kern_pdp.o machdep2.o subr_prf.o syscalls.o \
  159. X!     subr_log.o
  160. X  OV7=    tmscp.o
  161. X  
  162. X  KERNOBJ=${CONF} ${BASE} ${OV1} ${OV2} ${OV3} ${OV4} ${OV5} \
  163. X--- 74,80 ----
  164. X      sys_pipe.o
  165. X  # OV6 gets the (hopefully) never used routines
  166. X  OV6=    clock.o dn.o init_main.o kern_pdp.o machdep2.o subr_prf.o syscalls.o \
  167. X!     subr_log.o toy.o
  168. X  OV7=    tmscp.o
  169. X  
  170. X  KERNOBJ=${CONF} ${BASE} ${OV1} ${OV2} ${OV3} ${OV4} ${OV5} \
  171. X*** /usr/src/sys/conf/Make.sunix.old    Sun Dec 22 16:16:31 1991
  172. X--- /usr/src/sys/conf/Make.sunix    Sat Jul 11 23:13:33 1992
  173. X***************
  174. X*** 58,64 ****
  175. X      kern_xxx.o machdep2.o quota_sys.o subr_prf.o sys_process.o \
  176. X      syscalls.o ufs_mount.o
  177. X  OV4=    hk.o init_main.o kern_prot.o tty_pty.o quota_kern.o quota_subr.o \
  178. X!     quota_ufs.o subr_log.o vm_swap.o vm_proc.o
  179. X  OV5=    ht.o tm.o ts.o
  180. X  OV6=    tmscp.o
  181. X  
  182. X--- 58,64 ----
  183. X      kern_xxx.o machdep2.o quota_sys.o subr_prf.o sys_process.o \
  184. X      syscalls.o ufs_mount.o
  185. X  OV4=    hk.o init_main.o kern_prot.o tty_pty.o quota_kern.o quota_subr.o \
  186. X!     quota_ufs.o subr_log.o vm_swap.o vm_proc.o toy.o
  187. X  OV5=    ht.o tm.o ts.o
  188. X  OV6=    tmscp.o
  189. X  
  190. X*** /usr/src/sys/conf/Make.unix.old    Thu Feb 20 13:33:30 1992
  191. X--- /usr/src/sys/conf/Make.unix    Sat Jul 11 23:14:10 1992
  192. X***************
  193. X*** 55,61 ****
  194. X      kern_subr.o kern_synch.o kern_time.o kern_xxx.o lp.o machdep.o \
  195. X      machdep2.o mem.o quota_kern.o quota_subr.o quota_sys.o \
  196. X      quota_ufs.o ra.o ram.o rk.o rl.o rx.o si.o subr_prf.o subr_rmap.o \
  197. X!     subr_xxx.o sys_generic.o sys_inode.o sys_kern.o         \
  198. X      sys_pipe.o sys_process.o syscalls.o tm.o trap.o tmscp.o ts.o tty.o \
  199. X      tty_conf.o tty_pty.o tty_subr.o tty_tb.o tty_tty.o ufs_alloc.o \
  200. X      ufs_bio.o ufs_bmap.o ufs_dsort.o ufs_fio.o ufs_inode.o \
  201. X--- 55,61 ----
  202. X      kern_subr.o kern_synch.o kern_time.o kern_xxx.o lp.o machdep.o \
  203. X      machdep2.o mem.o quota_kern.o quota_subr.o quota_sys.o \
  204. X      quota_ufs.o ra.o ram.o rk.o rl.o rx.o si.o subr_prf.o subr_rmap.o \
  205. X!     subr_xxx.o sys_generic.o sys_inode.o sys_kern.o toy.o \
  206. X      sys_pipe.o sys_process.o syscalls.o tm.o trap.o tmscp.o ts.o tty.o \
  207. X      tty_conf.o tty_pty.o tty_subr.o tty_tb.o tty_tty.o ufs_alloc.o \
  208. X      ufs_bio.o ufs_bmap.o ufs_dsort.o ufs_fio.o ufs_inode.o \
  209. X*** /usr/src/sys/sys/init_main.c.old    Sun Sep 22 09:50:36 1991
  210. X--- /usr/src/sys/sys/init_main.c    Sun Jul 12 16:27:15 1992
  211. X***************
  212. X*** 46,54 ****
  213. X--- 46,57 ----
  214. X   */
  215. X  main()
  216. X  {
  217. X+     extern dev_t bootdev;
  218. X+     extern caddr_t bootcsr;
  219. X      register struct proc *p;
  220. X      register int i;
  221. X      register struct fs *fs;
  222. X+     time_t  toytime, toyclk();
  223. X  
  224. X      startup();
  225. X  
  226. X***************
  227. X*** 94,101 ****
  228. X      nchinit();
  229. X      clkstart();
  230. X  
  231. X!     for (i = 0; i < nblkdev; i++)
  232. X!         (void)(*bdevsw[i].d_root)();
  233. X      (*bdevsw[major(swapdev)].d_open)(swapdev, B_READ);
  234. X      fs = mountfs(rootdev, boothowto & RB_RDONLY, (struct inode *)0);
  235. X      if (!fs)
  236. X--- 97,118 ----
  237. X      nchinit();
  238. X      clkstart();
  239. X  
  240. X! /*
  241. X!  * Need to attach the root device.  The CSR is passed thru because this
  242. X!  * may be a 2nd or 3rd controller rather than the 1st.  NOTE: This poses
  243. X!  * a big problem if 'swapdev' is not on the same controller as 'rootdev'
  244. X!  * _or_ if 'swapdev' itself is on a 2nd or 3rd controller.  Short of moving
  245. X!  * autconfigure back in to the kernel it is not known what can be done about
  246. X!  * this.
  247. X!  *
  248. X!  * As a "compatibility hack" call swapdev's attach routine with a zero
  249. X!  * address.  The MSCP driver treats the 0 as a signal to perform the
  250. X!  * old (fixed address) attach.  Drivers (all the rest at this point) which
  251. X!  * do not support alternate controller booting always attach the first
  252. X!  * (primary) CSR and do not expect an argument to be passed.
  253. X! */
  254. X!     (void)(*bdevsw[major(bootdev)].d_root)(bootcsr);
  255. X!     (void)(*bdevsw[major(swapdev)].d_root)((caddr_t) 0);    /* XXX */
  256. X      (*bdevsw[major(swapdev)].d_open)(swapdev, B_READ);
  257. X      fs = mountfs(rootdev, boothowto & RB_RDONLY, (struct inode *)0);
  258. X      if (!fs)
  259. X***************
  260. X*** 104,109 ****
  261. X--- 121,128 ----
  262. X      fs->fs_fsmnt[0] = '/';
  263. X      fs->fs_fsmnt[1] = '\0';
  264. X      time.tv_sec = fs->fs_time;
  265. X+     if    (toytime = toyclk())
  266. X+         time.tv_sec = toytime;
  267. X      boottime = time;
  268. X  
  269. X  /* kick off timeout driven events by calling first time */
  270. X*** /usr/src/sys/pdp/mch_start.s.old    Sat Apr 20 21:44:52 1991
  271. X--- /usr/src/sys/pdp/mch_start.s    Fri Jul  3 23:21:46 1992
  272. X***************
  273. X*** 4,9 ****
  274. X--- 4,10 ----
  275. X   * specifies the terms and conditions for redistribution.
  276. X   *
  277. X   *    @(#)mch_start.s    1.1 (2.10BSD Berkeley) 6/11/88
  278. X+  *            1.2 (2.11BSD GTE) 7/03/92
  279. X   */
  280. X  
  281. X  #include "DEFS.h"
  282. X***************
  283. X*** 15,20 ****
  284. X--- 16,22 ----
  285. X      bit    $1,SSR0            / is memory management enabled?
  286. X      beq    .            / better be !!!
  287. X  
  288. X+     mov    r0,_cputype        / save cpu type passed by boot
  289. X      /*
  290. X       * The following two instructions change the contents of the "sys"
  291. X       * instruction vector (034-037) to read:
  292. X***************
  293. X*** 137,142 ****
  294. X--- 139,149 ----
  295. X   * on any processor but still take advantage of hardware that is present.
  296. X   * This is also a plus for a site which wants to maintain one kernel for a
  297. X   * number of different processors.
  298. X+  *
  299. X+  * Might as well use the cpu type from /boot after all the hoops it jumped
  300. X+  * thru to figure it out.  No sense in duplicating that code here in the
  301. X+  * kernel.  /boot also stuffed the right bits into the MSCR register to 
  302. X+  * disable cache and unibus traps.
  303. X   */
  304. X  hardprobe:
  305. X      mov    $1f,nofault
  306. X***************
  307. X*** 147,160 ****
  308. X      /*
  309. X       * Test for SSR3 and UNIBUS map capability.  If there is no SSR3, the
  310. X       * first test of SSR3 will trap and we skip past the separate I/D test.
  311. X       */
  312. X!     mov    $cputest,nofault
  313. X! #ifdef UNIBUS_MAP
  314. X      bit    $40,SSR3
  315. X      beq    1f
  316. X      incb    _ubmap
  317. X  1:
  318. X- #endif
  319. X  
  320. X  #ifdef NONSEPARATE
  321. X      /*
  322. X--- 154,166 ----
  323. X      /*
  324. X       * Test for SSR3 and UNIBUS map capability.  If there is no SSR3, the
  325. X       * first test of SSR3 will trap and we skip past the separate I/D test.
  326. X+      * 2.11BSD will be _seriously_ upset if I/D is not available!
  327. X       */
  328. X!     mov    $2f,nofault
  329. X      bit    $40,SSR3
  330. X      beq    1f
  331. X      incb    _ubmap
  332. X  1:
  333. X  
  334. X  #ifdef NONSEPARATE
  335. X      /*
  336. X***************
  337. X*** 165,217 ****
  338. X      bic    $1,SSR3
  339. X  #else
  340. X      bit    $1,SSR3            / Test for separate I/D capability
  341. X!     beq    cputest
  342. X      incb    _sep_id
  343. X  #endif
  344. X! 
  345. X!     /*
  346. X!      * Try to find out what kind of cpu this is.  Defaults are 40 for
  347. X!      * nonseparate and 45 for separate.  Cputype will be one of: 24,
  348. X!      * 40, 60, 45, 44, 70, 73.
  349. X!      */
  350. X! cputest:
  351. X! #ifndef NONSEPARATE
  352. X!     tstb    _sep_id
  353. X!     beq    nonsepcpu
  354. X! 
  355. X!     tstb    _ubmap            / sep_id: 44, 45, 70, 73
  356. X!     bne    1f
  357. X! 
  358. X!     mov    $cpudone,nofault    / sep_id && !ubmap: 45 or 73
  359. X!     tst    *$PDP1170_MSER        / mem sys err reg implies 73
  360. X!     mov    $73.,_cputype
  361. X!     bis    $CCR_DT,*$PDP1170_CCR    / disable cache traps
  362. X!     br    cpudone
  363. X! 1:
  364. X!     mov    $1f,nofault        / sep_id && ubmap: 44 or 70
  365. X!     mfpt                / if mfpt instruction exists, this is
  366. X!     mov    $44.,_cputype        /   a 44
  367. X!     bis    $CCR_DCPI,*$PDP1144_CCR    / Disable cache parity interrupts.
  368. X!     br    cpudone
  369. X! 1:
  370. X!     mov    $70.,_cputype
  371. X!     bis    $CCR_DUT|CCR_DT,*$PDP1170_CCR / Disable UNIBUS and nonfatal
  372. X!     br    cpudone            /   traps.
  373. X! 
  374. X! nonsepcpu:
  375. X! #endif !NONSEPARATE
  376. X!     tstb    _ubmap            / !sep_id: 24, 40, 60
  377. X!     bne    1f
  378. X! 
  379. X!     mov    $cpudone,nofault    / !sep_id && !ubmap: 40, 60
  380. X!     tst    PDP1160_MSR
  381. X!     mov    $60.,_cputype
  382. X!     bis    $CCR_DT,*$PDP1160_CCR    / Disable cache parity error traps.
  383. X!     br    cpudone
  384. X! 1:
  385. X!     mov    $24.,_cputype        / !sepid && ubmap: 24
  386. X! 
  387. X! cpudone:
  388. X          / Test for stack limit register; set it if present.
  389. X      mov    $1f,nofault
  390. X      mov    $intstk-256.,STACKLIM
  391. X--- 171,180 ----
  392. X      bic    $1,SSR3
  393. X  #else
  394. X      bit    $1,SSR3            / Test for separate I/D capability
  395. X!     beq    2f
  396. X      incb    _sep_id
  397. X  #endif
  398. X! 2:
  399. X          / Test for stack limit register; set it if present.
  400. X      mov    $1f,nofault
  401. X      mov    $intstk-256.,STACKLIM
  402. X*** /usr/src/sys/pdp/mch_dump.s.old    Fri Aug  4 14:59:46 1989
  403. X--- /usr/src/sys/pdp/mch_dump.s    Sat Jul  4 00:22:11 1992
  404. X***************
  405. X*** 4,9 ****
  406. X--- 4,10 ----
  407. X   * specifies the terms and conditions for redistribution.
  408. X   *
  409. X   *    @(#)mch_dump.s    1.1 (2.10BSD Berkeley) 2/10/87
  410. X+  *            1.2 (2.11BSD GTE) 7/03/92
  411. X   */
  412. X  #include "DEFS.h"
  413. X  #include "../machine/mch_iopage.h"
  414. X***************
  415. X*** 153,163 ****
  416. X       * reg 5 -- is used as an interation counter when mapping is enabled 
  417. X       */
  418. X  
  419. X!     clr    r4            / clear UB map used indicator
  420. X!     cmp    _cputype,$44.        / is a 44?
  421. X!     beq    1f            / yes, skip next
  422. X!     cmp    _cputype,$70.        / is a 70?
  423. X!     bne    2f            / not a 70 either, no UBMAP
  424. X  1:
  425. X      /*
  426. X       * This section of code initializes the Unibus map registers and
  427. X--- 154,161 ----
  428. X       * reg 5 -- is used as an interation counter when mapping is enabled 
  429. X       */
  430. X  
  431. X!     movb    _ubmap,r4        / UB map used indicator
  432. X!     beq    2f            / no UBMAP - br
  433. X  1:
  434. X      /*
  435. X       * This section of code initializes the Unibus map registers and
  436. X***************
  437. X*** 167,173 ****
  438. X       * Kernal I space 7 points to the I/O page.
  439. X       */
  440. X  
  441. X-     inc    r4            / indicate that UB mapping is needed
  442. X      mov    $UBMR0,r1        / point to  map register 0
  443. X      clr    r2            / init for low map reg
  444. X      clr    r3            / init for high map reg
  445. X--- 165,170 ----
  446. X***************
  447. X*** 241,253 ****
  448. X       * reg 5 -- is used as an interation counter when mapping is enabled
  449. X       */
  450. X  
  451. X!     cmp    _cputype,$44.        / is a 44?
  452. X!     beq    1f            / yes, skip next
  453. X!     cmp    _cputype,$70.        / is a 70?
  454. X!     bne    2f            / not a 70 either, no UBMAP
  455. X! 1:
  456. X! /    tst    _ubmap            / unibus map present?
  457. X! /    beq    2f            / no, skip map init
  458. X  
  459. X      /*
  460. X       * This section of code initializes the Unibus map registers and
  461. X--- 238,245 ----
  462. X       * reg 5 -- is used as an interation counter when mapping is enabled
  463. X       */
  464. X  
  465. X!     movb    _ubmap,setmap        / unibus map present?
  466. X!     beq    2f            / no, skip map init
  467. X  
  468. X      /*
  469. X       * This section of code initializes the Unibus map registers and
  470. X***************
  471. X*** 259,265 ****
  472. X       * Kernal I space 7 points to the I/O page.
  473. X       */
  474. X  
  475. X-     inc    setmap            / indicate that UB mapping is needed
  476. X      mov    $UBMR0,r0        / point to  map register 0
  477. X      clr    r2            / init for low map reg
  478. X      clr    r3            / init for high map reg
  479. X--- 251,256 ----
  480. X*** /usr/src/sys/pdp/mch_vars.s.old    Sat Sep  8 11:02:01 1990
  481. X--- /usr/src/sys/pdp/mch_vars.s    Sat Jul  4 00:26:50 1992
  482. X***************
  483. X*** 12,17 ****
  484. X--- 12,18 ----
  485. X  
  486. X  INT(GLOBAL, _fpp, 0)            / we have a floating point processor
  487. X  INT(GLOBAL, _ubmap, 0)            / we have a unibus map
  488. X+ INT(GLOBAL, _cputype, 0)        / cpu type
  489. X  CHAR(GLOBAL, _sep_id, 0)        / we have a separate I&D CPU
  490. X  
  491. X  #ifdef ENABLE34
  492. X***************
  493. X*** 19,25 ****
  494. X  #endif
  495. X  .even
  496. X  
  497. X- 
  498. X  /*
  499. X   * Define _ka6 and give it a reasonable initial value
  500. X   */
  501. X--- 20,25 ----
  502. X***************
  503. X*** 29,36 ****
  504. X  #    else
  505. X          INT(GLOBAL, _ka6, KISA6)
  506. X  #    endif
  507. X- 
  508. X-     INT(GLOBAL, _cputype, 40.)
  509. X  #else
  510. X  #    ifdef ENABLE34
  511. X          INT(GLOBAL, _ka6, DEC_KDSA6)
  512. X--- 29,34 ----
  513. X***************
  514. X*** 37,46 ****
  515. X  #    else
  516. X          INT(GLOBAL, _ka6, KDSA6)
  517. X  #    endif
  518. X- 
  519. X-     INT(GLOBAL, _cputype, 45.)
  520. X  #endif
  521. X- 
  522. X  
  523. X  SPACE(GLOBAL, intstk, INTSTK)        / temp stack while KDSA6 is unmapped
  524. X  CONST(GLOBAL, eintstk, intstk+INTSTK)    / top of interuupt stack
  525. X--- 35,41 ----
  526. X*** /usr/src/sys/pdpstand/M.s.old    Tue Apr 23 10:21:47 1991
  527. X--- /usr/src/sys/pdpstand/M.s    Sat Jul  4 00:03:21 1992
  528. X***************
  529. X*** 1,12 ****
  530. X  /
  531. X  /    SCCS id    @(#)M.s    1.7 (Berkeley)    7/11/83
  532. X! /        @(#)M.s    2.0 (2.11BSD)    4/12/91 (sms@wlv.imsd.contel.com)
  533. X  /
  534. X  / Startup code for two-stage bootstrap with support for autoboot.
  535. X  / Supports 11/45, 11/70, 11/53, 11/73, 11/83, 11/84, 11/93, 11/94
  536. X  
  537. X- systrap = 104400    / trap 0
  538. X- 
  539. X  /  The boot options and device are placed in the last SZFLAGS bytes
  540. X  /  at the end of core by the kernel if this is an autoboot.
  541. X  /  The first-stage boot will leave them in registers for us;
  542. X--- 1,10 ----
  543. X  /
  544. X  /    SCCS id    @(#)M.s    1.7 (Berkeley)    7/11/83
  545. X! /        @(#)M.s    3.0 (2.11BSD)    7/03/92 (sms@wlv.iipo.gtegsc.com)
  546. X  /
  547. X  / Startup code for two-stage bootstrap with support for autoboot.
  548. X  / Supports 11/45, 11/70, 11/53, 11/73, 11/83, 11/84, 11/93, 11/94
  549. X  
  550. X  /  The boot options and device are placed in the last SZFLAGS bytes
  551. X  /  at the end of core by the kernel if this is an autoboot.
  552. X  /  The first-stage boot will leave them in registers for us;
  553. X***************
  554. X*** 60,102 ****
  555. X      clr    ENDCORE-BOOTDEV
  556. X      clr    ENDCORE-CHECKWORD
  557. X  /
  558. X! / determine what kind of cpu we are running on
  559. X! / The check for the switch register removed because:  1) the only use
  560. X! / of it was in xp.c for the drive type and an alternate method of 
  561. X! / modifying xptype is provided, 2) the only machine with a front panel
  562. X! / which can run the system is the 11/70 and i got tired of having the
  563. X! / system think it was on a 11/40 because switches were left up after the
  564. X! / boot, 3) the standalone code was becoming large enough that 'restor'
  565. X! / was having size problems due to the addition of multi-controller support,
  566. X! / 4) the probing proceedure adequately determines the hardware capabilities.
  567. X  
  568. X      clrb    _sep_id
  569. X      clrb    _ubmap
  570. X!     mov    $40.,r0        / assume 11/40
  571. X!     mov    $2f,nofault
  572. X!     mov    *$KDSA6,r1    / then we have sep i/d 45, 70, 73
  573. X!     incb    _sep_id
  574. X!     mov    $45.,r0
  575. X!     mov    $3f,nofault
  576. X!     mov    *$UBMAP,r1    / then we have a unibus map. 44 or 70
  577. X!     incb    _ubmap
  578. X!     mov    $70.,r0
  579. X!     mov    $1f,nofault
  580. X!     mfpt            / if mfpt instruction exists, this is
  581. X!     mov    $44.,r0        /   a 44
  582. X!     br    1f
  583. X! 3:                / br here with sep i/d, no ubmap. 45 or 73.
  584. X!     mov    $1f,nofault
  585. X!     mov    *$MSCR,r1    / if no MSCR, 45 !
  586. X!     mov    $73.,r0        / sep i/d, no ubmap, MSCR. 73!
  587. X!     br    1f
  588. X! 2:                / br here if no sep. I/D. 23, 24, 34, 40, 60
  589. X!     mov    $1f,nofault
  590. X!     mov    *$UBMAP,r1    / then we have a unibus map
  591. X!     incb    _ubmap
  592. X!     mov    $24.,r0        / unibus map, no sep. I/D = 24
  593. X! 1:    clr    nofault
  594. X!     mov    r0,_cputype
  595. X  
  596. X  /
  597. X  /    Set kernel I space registers to physical 0 and I/O page
  598. X--- 58,71 ----
  599. X      clr    ENDCORE-BOOTDEV
  600. X      clr    ENDCORE-CHECKWORD
  601. X  /
  602. X! / determine what kind of cpu we are running on.  this was totally rewritten
  603. X! / when support for the 93 and 94 was added.
  604. X  
  605. X      clrb    _sep_id
  606. X      clrb    _ubmap
  607. X!     jsr    pc,cpuprobe    / fill in _cputype, _ubmap and _sep_id
  608. X!                 / also sets MSCR bits
  609. X!     clr    nofault
  610. X  
  611. X  /
  612. X  /    Set kernel I space registers to physical 0 and I/O page
  613. X***************
  614. X*** 138,144 ****
  615. X  /
  616. X  /    If 11/40 class processor, only need set the I space registers
  617. X  /
  618. X!     tstb    _sep_id
  619. X      jeq    1f
  620. X  
  621. X  /
  622. X--- 107,113 ----
  623. X  /
  624. X  /    If 11/40 class processor, only need set the I space registers
  625. X  /
  626. X!     movb    _sep_id, _ksep
  627. X      jeq    1f
  628. X  
  629. X  /
  630. X***************
  631. X*** 161,167 ****
  632. X  
  633. X  1:
  634. X  / enable map
  635. X-     clrb    _ksep
  636. X      tstb    _ubmap
  637. X      beq    2f
  638. X      jsr    pc,_ubmapset    / 24, 44, 70 -> ubmap
  639. X--- 130,135 ----
  640. X***************
  641. X*** 171,195 ****
  642. X      br    1f
  643. X  3:
  644. X      mov    $65,SSR3    / 44, 70 -> ubmap, I/D
  645. X-     incb    _ksep
  646. X-     mov    $3,MSCR        / 44, 70: $1: disable cache parity traps
  647. X-                 / 44:     $2: ignored
  648. X-                 / 70:     $2: disable UNIBUS traps
  649. X      br    1f
  650. X  2:
  651. X      tstb    _sep_id        / 23, 34, 40, 45, 60, 73 -> no ubmap
  652. X      beq    1f
  653. X      mov    $25,SSR3    / 45, 73 -> no ubmap, I/D; maybe 22-bit
  654. X-     incb    _ksep
  655. X  1:
  656. X      mov    $30340,PS
  657. X!     inc    SSR0
  658. X  
  659. X- 
  660. X  / copy program to user I space
  661. X      mov    $_end,r0
  662. X!     asr    r0
  663. X!     bic    $100000,r0
  664. X      clr    r1
  665. X  1:
  666. X      mov    (r1),-(sp)
  667. X--- 139,157 ----
  668. X      br    1f
  669. X  3:
  670. X      mov    $65,SSR3    / 44, 70 -> ubmap, I/D
  671. X      br    1f
  672. X  2:
  673. X      tstb    _sep_id        / 23, 34, 40, 45, 60, 73 -> no ubmap
  674. X      beq    1f
  675. X      mov    $25,SSR3    / 45, 73 -> no ubmap, I/D; maybe 22-bit
  676. X  1:
  677. X      mov    $30340,PS
  678. X!     inc    SSR0        / turn on memory management
  679. X  
  680. X  / copy program to user I space
  681. X      mov    $_end,r0
  682. X!     clc
  683. X!     ror    r0
  684. X      clr    r1
  685. X  1:
  686. X      mov    (r1),-(sp)
  687. X***************
  688. X*** 228,237 ****
  689. X      com    r2        / checkword
  690. X      mov    $160000,-(sp)    / set ksp to very top so that the trap
  691. X      mtpi    sp        / puts the return address and psw at 157774,6
  692. X!     systrap
  693. X  
  694. X      br    user
  695. X  
  696. X  setseg:
  697. X      mov    $8,r0
  698. X  1:
  699. X--- 190,255 ----
  700. X      com    r2        / checkword
  701. X      mov    $160000,-(sp)    / set ksp to very top so that the trap
  702. X      mtpi    sp        / puts the return address and psw at 157774,6
  703. X!     sys    0        / can't use "trap" because that's a label
  704. X  
  705. X      br    user
  706. X  
  707. X+ cpuprobe:
  708. X+     mov    $1f,nofault    / catch possible trap
  709. X+     tst    *$UBMAP        / look for unibus map
  710. X+     incb    _ubmap        / we've got one, note that and continue on
  711. X+ 1:
  712. X+     mov    $1f,nofault
  713. X+     tst    *$KDSA6        / look for split I/D
  714. X+     incb    _sep_id
  715. X+ 1:
  716. X+     mov    $nomfpt,nofault    / catch possible fault from instruction
  717. X+     mfpt            / 23/24, 44, and KDJ-11 have this instruction
  718. X+     cmp    r0,$1        / 44?
  719. X+     bne    1f        / no - br
  720. X+     mov    $1,*$MSCR    / disable cache parity traps
  721. X+     mov    $44.,_cputype
  722. X+     rts    pc
  723. X+ 1:
  724. X+     cmp    r0,$5        / KDJ-11?
  725. X+     bne    2f        / no - br
  726. X+     mov    *$MAINT,r0    / get system maint register
  727. X+     ash    $-4,r0        / move down and
  728. X+     bic    $177760,r0    /  isolate the module id
  729. X+     mov    $1,*$MSCR    / disable cache parity traps
  730. X+     movb    j11typ(r0),r0    / lookup cpu type
  731. X+     movb    _ubmap,r1    / unibus?
  732. X+     beq    1f        / nope - br
  733. X+     bis    $2,*$MSCR    / disable unibus traps
  734. X+ 1:
  735. X+     add    r1,r0        / bump the cpu type (93 -> 94, 83 ->84)
  736. X+     br    out
  737. X+ 2:
  738. X+     cmp    r0,$3        / 23 or 24?
  739. X+     bne    nomfpt        / mfpt returned other than 1,3,5 - HELP!
  740. X+     mov    $23.,r0        / assume 23
  741. X+     movb    _ubmap,r1    / add in...
  742. X+     add    r1,r0        / the unibus flag (23 -> 24)
  743. X+     br    out
  744. X+ nomfpt:
  745. X+     tstb    _sep_id        / split I/D present?
  746. X+     beq    2f        / no - br
  747. X+     mov    $45.,r0        / assume 45
  748. X+     tstb    _ubmap        / is that correct?
  749. X+     beq    out        / yes - br
  750. X+     mov    $3,*$MSCR    / disable unibus and cache traps
  751. X+     mov    $70.,r0
  752. X+     br    out
  753. X+ 2:
  754. X+     mov    $40.,r0        / assume 40
  755. X+     mov    $out,nofault
  756. X+     tst    *$MSCR        / 60 has MSCR, 40 doesn't
  757. X+     mov    $60.,r0
  758. X+     mov    $1,*$MSCR
  759. X+ out:
  760. X+     mov    r0,_cputype
  761. X+     rts    pc
  762. X+ 
  763. X  setseg:
  764. X      mov    $8,r0
  765. X  1:
  766. X***************
  767. X*** 341,346 ****
  768. X--- 359,365 ----
  769. X  UDSA0    = 177660
  770. X  UDSD0    = 177620
  771. X  MSCR    = 177746    / 11/44/60/70 memory system cache control register
  772. X+ MAINT    = 177750    / KDJ-11 system maintenance register
  773. X  IO    = 177600
  774. X  UBMAP    = 170200
  775. X  
  776. X***************
  777. X*** 350,356 ****
  778. X  .globl    _bootopts, _bootdev, _checkword, _bootcsr
  779. X  
  780. X  nofault:    .=.+2    / where to go on predicted trap
  781. X! _cputype:    .=.+2    / cpu type (currently 40,45 or 70)
  782. X  _sep_id:    .=.+1    / 1 if we have separate I and D
  783. X  _ksep:        .=.+1    / 1 if kernel mode has sep I/D enabled
  784. X  _ubmap:        .=.+2    / 1 if we have a unibus map
  785. X--- 369,375 ----
  786. X  .globl    _bootopts, _bootdev, _checkword, _bootcsr
  787. X  
  788. X  nofault:    .=.+2    / where to go on predicted trap
  789. X! _cputype:    .=.+2    / cpu type
  790. X  _sep_id:    .=.+1    / 1 if we have separate I and D
  791. X  _ksep:        .=.+1    / 1 if kernel mode has sep I/D enabled
  792. X  _ubmap:        .=.+2    / 1 if we have a unibus map
  793. X***************
  794. X*** 358,360 ****
  795. X--- 377,380 ----
  796. X  _bootdev:    .=.+2    / device booted from
  797. X  _bootcsr:    .=.+2    / csr of device booted from
  798. X  _checkword:    .=.+2    / saved r2, complement of bootopts if an autoboot
  799. X+ j11typ:    .byte 0, 73., 83., 0, 53., 93.
  800. SHAR_EOF
  801. fi
  802. if test -f 'toy.s'
  803. then
  804.     echo shar: "will not over-write existing file 'toy.s'"
  805. else
  806. sed 's/^X//' << \SHAR_EOF > 'toy.s'
  807. X/ the notes say that the TOY clock uses 24 hour time, but then later on
  808. X/ mention flags dealing with AM/PM...  So, code is present but disabled
  809. X/ to handle 12 hour time.  If this code is needed change the 0 below to
  810. X/ a 1.
  811. X
  812. Xtoy24=0
  813. X
  814. X/ extraneous flag bit possible in the day field.  this "should never
  815. X/ happen", but if it does change the 0 to a 1 below.
  816. X
  817. Xdayflags=0
  818. X
  819. X    .globl    TOYCSR
  820. XTOYCSR    = 177526
  821. X
  822. X    .globl    _toyclk
  823. X    .text
  824. X_toyclk:
  825. X    jsr    r5,csv            / callable from C, save regs
  826. X    sub    $8.,sp            / need 8 byte scratch area
  827. Xtdata = -20
  828. X    cmp    _cputype,$93.        / are we a 11/93?
  829. X    beq    1f            / yes - br
  830. X    cmp    _cputype,$94.        / are we a 11/94?
  831. X    bne    err            / no, go return "error"
  832. X1:
  833. X    jsr    pc,initoy        / initialize the clock for reading
  834. X    mov    r5,(sp)
  835. X    add    $tdata,(sp)        / pointer to scratch area
  836. X    jsr    pc,_gettoy        / read the toy clock
  837. X    mov    (sp),r2            / pointer to scratch area
  838. X    mov    $8.,r3            / number of bytes of clock data
  839. X2:
  840. X    clr    r1
  841. X    bisb    (r2),r1            / fetch byte of clock data (!sign ext)
  842. X.if    toy24
  843. X    cmp    r3,$5            / are we on the hours field?
  844. X    bne    3f            / no - br
  845. X    bic    $240,r1            / clear am/pm flags
  846. X3:
  847. X.endif
  848. X    jsr    pc,bcd            / convert 2 nybbles bcd to binary
  849. X.if    toy24
  850. X    cmp    r3,$5            / hours field?
  851. X    bne    4f            / no - skip am/pm stuff
  852. X    tstb    (r2)            / $200 = am/pm in use
  853. X    bpl    4f            / not am/pm, skip it
  854. X    cmp    r1,$12.            / exactly 12?
  855. X    bne    5f            / no - br
  856. X    clr    r1            / make midnight
  857. X5:
  858. X    bitb    $40,(r2)        / PM?
  859. X    beq    4f            / no  - br
  860. X    add    $12.,r1            / convert to 24 hour time
  861. X.endif
  862. X4:
  863. X    movb    r1,(r2)+        / store converted/correct binary value
  864. X    sob    r3,2b            / continue on for rest of the bytes
  865. X    sub    $7,r2            / back up to seconds field
  866. X.if    dayflags
  867. X    bicb    $177770,4(r2)        / clear possible excess bits in day
  868. X.endif
  869. X    mov    $bounds,r3        / do bounds checking now, not 100ths
  870. X1:
  871. X    movb    (r2)+,r1        / get byte of clock data
  872. X    cmpb    r1,(r3)+        / below lo bound?
  873. X    blo    err            / yes - br
  874. X    cmpb    r1,(r3)+        / above hi bound
  875. X    bhi    err            / yes - br
  876. X    cmp    r3,$bounds+14.        / at end (7 limits * 2 bytes per = 14)?
  877. X    blo    1b            / no - br
  878. X    sub    $8.,r2            / back to seconds field
  879. X    movb    7(r2),r0        / fetch the year of century
  880. X    cmp    r0,$90.            / are we a "90s" system?
  881. X    bhis    1f            / yep - br
  882. X    add    $100.,r0        / next century for years 00 - 89
  883. X1:
  884. X    movb    r0,7(r2)        / store fixed up year
  885. X    decb    6(r2)            / convert 1-12 month to 0-11
  886. X    mov    r2,(sp)            / pointer to the toy clock data
  887. X    jsr    pc,_tm2t        / convert to a 32bit # of seconds time
  888. X    br    ret
  889. Xerr:
  890. X    clr    r0            / a double precision value
  891. X    clr    r1            / of 0 signals an error
  892. Xret:
  893. X    jmp    cret            / return
  894. X    .data
  895. Xbounds:
  896. X    .byte    0,59.            / seconds lo,hi
  897. X    .byte    0,59.            / minutes lo,hi
  898. X    .byte    0,23.            / hours lo,hi
  899. X    .byte    0,7            / day of week lo,hi
  900. X    .byte    1,31.            / day of month lo,hi
  901. X    .byte    1,12.            / month of year lo,hi
  902. X    .byte    0,99.            / year of century lo,hi
  903. X    .text
  904. Xinitoy:
  905. X    tst    *$TOYCSR        / strobe the clock register
  906. X    clr    -(sp)            / save previous high byte of register
  907. X    movb    *$TOYCSR+1,(sp)        / only bit 8 belongs to TOY!
  908. X    bic    $1,(sp)            / make sure bit 8 (TOY bit) is clear
  909. X    mov    $2,r2            / number of double words to send clock
  910. X1:
  911. X    mov    $35305,r0        / first word of recognition code
  912. X    jsr    pc,toyload        / send it to clock
  913. X    mov    $56243,r0        / second word
  914. X    jsr    pc,toyload        / send it
  915. X    sob    r2,1b            / do the whole thing twice
  916. X    tst    (sp)+            / clean stack
  917. X    rts    pc
  918. X
  919. X/ send contents of r0 to the TOY.  2(sp) has the old bits 9-15, bit 8
  920. X/ has been cleared.
  921. X
  922. Xtoyload:
  923. X    mov    $16.,r1            / number of bits to send
  924. X1:
  925. X    mov    r0,r3            / scratch copy
  926. X    bic    $177776,r3        / clear all but bit being sent
  927. X    bis    2(sp),r3        / merge in old_csr_bits
  928. X    movb    r3,*$TOYCSR+1        / send bit to clock
  929. X    asr    r0            / shift pattern down
  930. X    sob    r1,1b            / do all 16 bits in the word
  931. X    rts    pc
  932. X
  933. X    .globl    _gettoy
  934. X_gettoy:                / (void)gettoy(&char[8]);
  935. X    jsr    r5,csv            / C callable
  936. X    mov    4(r5),r2        / buffer address
  937. X    mov    $4,r3            / number of words in buffer
  938. X1:
  939. X    mov    $16.,r4            / number of bits in word
  940. X2:
  941. X    movb    *$TOYCSR+1,r0        / low bit of top byte is a clock bit
  942. X    asr    r0            / put it in carry
  943. X    ror    r1            / ripple in at top end of r1
  944. X    sob    r4,2b            / do all 16 bits
  945. X    mov    r1,(r2)+        / store the word in the buffer
  946. X    sob    r3,1b            / do all 4 words
  947. X    jmp    cret            / and return
  948. X
  949. Xbcd:
  950. X    clr    r0
  951. X    div    $16.,r0
  952. X    mov    r1,-(sp)
  953. X    mov    r0,r1
  954. X    mul    $10.,r1
  955. X    add    (sp)+,r1
  956. X    rts    pc
  957. X
  958. X    .globl    _tm2t
  959. X_tm2t:
  960. X    jsr    r5,csv
  961. X    mov    4(r5),r4
  962. X    movb    1(r4),r1
  963. X    mov    r1,-(sp)
  964. X    clr    -(sp)
  965. X    movb    2(r4),r0
  966. X    mul    $74,r0
  967. X    mov    r1,-(sp)
  968. X    mov    r0,-(sp)
  969. X    mov    $7020,-(sp)
  970. X    sxt    -(sp)
  971. X    movb    3(r4),r1
  972. X    mov    r1,-(sp)
  973. X    clr    -(sp)
  974. X    jsr    pc,lmul
  975. X    add    $10,sp
  976. X    mov    r1,-(sp)
  977. X    mov    r0,-(sp)
  978. X    mov    $50600,-(sp)
  979. X    mov    $1,-(sp)
  980. X    mov    r4,-(sp)
  981. X    jsr    pc,_ndays        / return value in r1
  982. X    tst    (sp)+
  983. X    dec    r1
  984. X    mov    r1,-(sp)
  985. X    sxt    -(sp)
  986. X    jsr    pc,lmul
  987. X    add    $10,sp
  988. X    add    (sp)+,r0
  989. X    add    (sp)+,r1
  990. X    adc    r0
  991. X    add    (sp)+,r0
  992. X    add    (sp)+,r1
  993. X    adc    r0
  994. X    add    (sp)+,r0
  995. X    add    (sp)+,r1
  996. X    adc    r0
  997. X    jmp    cret
  998. X
  999. X_leap:                / r2 = year number, r1 clobbered
  1000. X    mov    r2,r1
  1001. X    add    $3554,r1
  1002. X    sxt    r0
  1003. X    div    $620,r0
  1004. X    tst    r1
  1005. X    bne    2f
  1006. X    br    3f
  1007. X1:
  1008. X    clr    r0        / return false
  1009. X    br    4f
  1010. X2:
  1011. X    mov    r2,r1
  1012. X    sxt    r0
  1013. X    div    $144,r0
  1014. X    tst    r1
  1015. X    jeq    1b
  1016. X    bit    $3,r2
  1017. X    jne    1b
  1018. X3:
  1019. X    mov    $1,r0        / return true
  1020. X4:
  1021. X    rts    pc
  1022. X    .data
  1023. Xmdays:
  1024. X    .byte 37,34,37,36,37,36,37,37,36,37,36,37,0
  1025. X    .even
  1026. X    .text
  1027. X_ndays:
  1028. X    jsr    r5,csv
  1029. X    mov    4(r5),r0
  1030. X    movb    5(r0),r4
  1031. X    mov    $106,r2
  1032. X    jbr    3f
  1033. X1:
  1034. X    add    $555,r4
  1035. X    jsr    pc,*$_leap        / r2 has year in it already
  1036. X    add    r0,r4
  1037. X    inc    r2
  1038. X3:
  1039. X    mov    4(r5),r0
  1040. X    movb    7(r0),r0
  1041. X    cmp    r2,r0
  1042. X    jlt    1b
  1043. X    clr    r3
  1044. X    jbr    8f
  1045. X4:
  1046. X    clr    r0
  1047. X    cmp    $1,r3
  1048. X    jne    5f
  1049. X    jsr    pc,*$_leap    / r2 has year
  1050. X5:
  1051. X    movb    mdays(r3),r1
  1052. X    add    r1,r0
  1053. X    add    r0,r4
  1054. X    inc    r3
  1055. X8:
  1056. X    mov    4(r5),r0
  1057. X    movb    6(r0),r0
  1058. X    cmp    r3,r0
  1059. X    jlt    4b
  1060. X    mov    r4,r1        / return value in r1 not r0
  1061. X    jmp    cret
  1062. SHAR_EOF
  1063. fi
  1064. exit 0
  1065. #    End of shell archive
  1066.