bmd.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. /* $OpenBSD: bmd.c,v 1.4 2013/10/29 21:49:07 miod Exp $ */
  2. /* $NetBSD: bmd.c,v 1.2 2013/01/20 13:35:43 tsutsui Exp $ */
  3. /*
  4. * Copyright (c) 1992 OMRON Corporation.
  5. *
  6. * This code is derived from software contributed to Berkeley by
  7. * OMRON Corporation.
  8. *
  9. * Redistribution and use in source and binary forms, with or without
  10. * modification, are permitted provided that the following conditions
  11. * are met:
  12. * 1. Redistributions of source code must retain the above copyright
  13. * notice, this list of conditions and the following disclaimer.
  14. * 2. Redistributions in binary form must reproduce the above copyright
  15. * notice, this list of conditions and the following disclaimer in the
  16. * documentation and/or other materials provided with the distribution.
  17. * 3. All advertising materials mentioning features or use of this software
  18. * must display the following acknowledgement:
  19. * This product includes software developed by the University of
  20. * California, Berkeley and its contributors.
  21. * 4. Neither the name of the University nor the names of its contributors
  22. * may be used to endorse or promote products derived from this software
  23. * without specific prior written permission.
  24. *
  25. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  26. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  27. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  28. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  29. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  30. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  31. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  32. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  33. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  34. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  35. * SUCH DAMAGE.
  36. *
  37. * @(#)bmd.c 8.2 (Berkeley) 8/15/93
  38. */
  39. /*
  40. * Copyright (c) 1992, 1993
  41. * The Regents of the University of California. All rights reserved.
  42. *
  43. * This code is derived from software contributed to Berkeley by
  44. * OMRON Corporation.
  45. *
  46. * Redistribution and use in source and binary forms, with or without
  47. * modification, are permitted provided that the following conditions
  48. * are met:
  49. * 1. Redistributions of source code must retain the above copyright
  50. * notice, this list of conditions and the following disclaimer.
  51. * 2. Redistributions in binary form must reproduce the above copyright
  52. * notice, this list of conditions and the following disclaimer in the
  53. * documentation and/or other materials provided with the distribution.
  54. * 3. Neither the name of the University nor the names of its contributors
  55. * may be used to endorse or promote products derived from this software
  56. * without specific prior written permission.
  57. *
  58. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  59. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  60. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  61. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  62. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  63. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  64. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  65. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  66. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  67. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  68. * SUCH DAMAGE.
  69. *
  70. * @(#)bmd.c 8.2 (Berkeley) 8/15/93
  71. */
  72. /*
  73. * bmd.c --- Bitmap-Display raw-level driver routines
  74. *
  75. * by A.Fujita, SEP-09-1992
  76. */
  77. #include <sys/param.h>
  78. #include <machine/board.h>
  79. #include <luna88k/stand/boot/samachdep.h>
  80. /*
  81. * RFCNT register
  82. */
  83. union bmd_rfcnt {
  84. struct {
  85. short rfc_hcnt;
  86. short rfc_vcnt;
  87. } p;
  88. uint32_t u;
  89. };
  90. #define isprint(c) ((c) >= 0x20 && (c) < 0x7f)
  91. /*
  92. * Width & Height
  93. */
  94. #define PB_WIDTH 2048 /* Plane Width (Bit) */
  95. #define PB_HEIGHT 1024 /* Plane Height (Bit) */
  96. #define PS_WIDTH 128 /* Plane Width (Short) */
  97. #define P_WIDTH 256 /* Plane Width (Byte) */
  98. #define SB_WIDTH 1280 /* Screen Width (Bit) */
  99. #define SB_HEIGHT 1024 /* Screen Height (Bit) */
  100. #define SS_WIDTH 80 /* Screen Width (Short) */
  101. #define S_WIDTH 160 /* Screen Width (Byte) */
  102. #define FB_WIDTH 12 /* Font Width (Bit) */
  103. #define FB_HEIGHT 20 /* Font Height (Bit) */
  104. #define NEXT_LINE(addr) ((addr) + (PS_WIDTH * FB_HEIGHT))
  105. #define SKIP_NEXT_LINE(addr) (addr) += (PS_WIDTH - SS_WIDTH)
  106. void bmd_draw_char(char *, char *, int, int, int);
  107. void bmd_reverse_char(char *, char *, int, int);
  108. void bmd_erase_char(char *, char *, int, int);
  109. void bmd_erase_screen(volatile u_short *);
  110. void bmd_scroll_screen(volatile u_short *, volatile u_short *,
  111. int, int, int, int);
  112. struct bmd_linec {
  113. struct bmd_linec *bl_next;
  114. struct bmd_linec *bl_prev;
  115. int bl_col;
  116. int bl_end;
  117. u_char bl_line[128];
  118. };
  119. struct bmd_softc {
  120. int bc_stat;
  121. char *bc_raddr;
  122. char *bc_waddr;
  123. int bc_xmin;
  124. int bc_xmax;
  125. int bc_ymin;
  126. int bc_ymax;
  127. int bc_col;
  128. int bc_row;
  129. struct bmd_linec *bc_bl;
  130. char bc_escseq[8];
  131. char *bc_esc;
  132. void (*bc_escape)(int);
  133. };
  134. #define STAT_NORMAL 0x0000
  135. #define STAT_ESCAPE 0x0001
  136. #define STAT_INSERT 0x0100
  137. struct bmd_softc bmd_softc;
  138. struct bmd_linec bmd_linec[52];
  139. void bmd_escape(int);
  140. void bmd_escape_0(int);
  141. void bmd_escape_1(int);
  142. /*
  143. * Escape-Sequence
  144. */
  145. void
  146. bmd_escape(int c)
  147. {
  148. struct bmd_softc *bp = &bmd_softc;
  149. switch (c) {
  150. case '[':
  151. bp->bc_escape = bmd_escape_0;
  152. break;
  153. default:
  154. bp->bc_stat &= ~STAT_ESCAPE;
  155. bp->bc_esc = &bp->bc_escseq[0];
  156. bp->bc_escape = bmd_escape;
  157. break;
  158. }
  159. }
  160. void
  161. bmd_escape_0(int c)
  162. {
  163. struct bmd_softc *bp = &bmd_softc;
  164. struct bmd_linec *bq = bp->bc_bl;
  165. switch (c) {
  166. case 'A':
  167. if (bp->bc_row > bp->bc_ymin) {
  168. bp->bc_row--;
  169. }
  170. break;
  171. case 'C':
  172. if (bq->bl_col < bp->bc_xmax - 1) {
  173. bq->bl_col++;
  174. }
  175. break;
  176. case 'K':
  177. if (bq->bl_col < bp->bc_xmax) {
  178. int col;
  179. for (col = bq->bl_col; col < bp->bc_xmax; col++)
  180. bmd_erase_char(bp->bc_raddr,
  181. bp->bc_waddr,
  182. col, bp->bc_row);
  183. }
  184. bq->bl_end = bq->bl_col;
  185. break;
  186. case 'H':
  187. bq->bl_col = bq->bl_end = bp->bc_xmin;
  188. bp->bc_row = bp->bc_ymin;
  189. break;
  190. default:
  191. /*
  192. *bp->bc_esc++ = c;
  193. bp->bc_escape = bmd_escape_1;
  194. return;
  195. */
  196. break;
  197. }
  198. bp->bc_stat &= ~STAT_ESCAPE;
  199. bp->bc_esc = &bp->bc_escseq[0];
  200. bp->bc_escape = bmd_escape;
  201. }
  202. void
  203. bmd_escape_1(int c)
  204. {
  205. struct bmd_softc *bp = &bmd_softc;
  206. struct bmd_linec *bq = bp->bc_bl;
  207. int col = 0, row = 0;
  208. char *p;
  209. switch (c) {
  210. case 'J':
  211. bp->bc_stat &= ~STAT_ESCAPE;
  212. bp->bc_esc = &bp->bc_escseq[0];
  213. bp->bc_escape = bmd_escape;
  214. break;
  215. case 'H':
  216. for (p = &bp->bc_escseq[0]; *p != ';'; p++)
  217. row = (row * 10) + (*p - 0x30);
  218. p++;
  219. for (p = &bp->bc_escseq[0]; p != bp->bc_esc; p++)
  220. col = (col * 10) + (*p - 0x30);
  221. bq->bl_col = col + bp->bc_xmin;
  222. bp->bc_row = row + bp->bc_ymin;
  223. bp->bc_stat &= ~STAT_ESCAPE;
  224. bp->bc_esc = &bp->bc_escseq[0];
  225. bp->bc_escape = bmd_escape;
  226. break;
  227. default:
  228. *bp->bc_esc++ = c;
  229. break;
  230. }
  231. }
  232. /*
  233. * Entry Routine
  234. */
  235. void
  236. bmdinit(void)
  237. {
  238. volatile uint32_t *bmd_rfcnt = (volatile uint32_t *)BMAP_RFCNT;
  239. volatile long *bmd_bmsel = (volatile long *)BMAP_BMSEL;
  240. struct bmd_softc *bp = &bmd_softc;
  241. struct bmd_linec *bq;
  242. int i;
  243. union bmd_rfcnt rfcnt;
  244. /*
  245. * adjust plane position
  246. */
  247. bp->bc_raddr = (char *)(BMAP_BMAP0 + 8); /* plane-0 hardware address */
  248. bp->bc_waddr = (char *)(BMAP_BMP + 8); /* common bitmap hardware address */
  249. rfcnt.p.rfc_hcnt = 7; /* shift left 16 dot */
  250. rfcnt.p.rfc_vcnt = -27; /* shift down 1 dot */
  251. *bmd_rfcnt = rfcnt.u;
  252. bp->bc_stat = STAT_NORMAL;
  253. bp->bc_xmin = 8;
  254. bp->bc_xmax = 96;
  255. bp->bc_ymin = 2;
  256. bp->bc_ymax = 48;
  257. bp->bc_row = bp->bc_ymin;
  258. for (i = bp->bc_ymin; i < bp->bc_ymax; i++) {
  259. bmd_linec[i].bl_next = &bmd_linec[i+1];
  260. bmd_linec[i].bl_prev = &bmd_linec[i-1];
  261. }
  262. bmd_linec[bp->bc_ymax-1].bl_next = &bmd_linec[bp->bc_ymin];
  263. bmd_linec[bp->bc_ymin].bl_prev = &bmd_linec[bp->bc_ymax-1];
  264. bq = bp->bc_bl = &bmd_linec[bp->bc_ymin];
  265. bq->bl_col = bq->bl_end = bp->bc_xmin;
  266. bp->bc_col = bp->bc_xmin;
  267. bp->bc_esc = &bp->bc_escseq[0];
  268. bp->bc_escape = bmd_escape;
  269. *bmd_bmsel = 0xff; /* all planes */
  270. bmd_erase_screen((u_short *) bp->bc_waddr); /* clear screen */
  271. *bmd_bmsel = 0x01; /* 1 plane */
  272. /* turn on cursole */
  273. bmd_reverse_char(bp->bc_raddr,
  274. bp->bc_waddr,
  275. bq->bl_col, bp->bc_row);
  276. }
  277. void
  278. bmdadjust(short hcnt, short vcnt)
  279. {
  280. volatile uint32_t *bmd_rfcnt = (volatile uint32_t *)BMAP_RFCNT;
  281. union bmd_rfcnt rfcnt;
  282. printf("bmdadjust: hcnt = %d, vcnt = %d\n", hcnt, vcnt);
  283. rfcnt.p.rfc_hcnt = hcnt; /* shift left 16 dot */
  284. rfcnt.p.rfc_vcnt = vcnt; /* shift down 1 dot */
  285. *bmd_rfcnt = rfcnt.u;
  286. }
  287. int
  288. bmdputc(int c)
  289. {
  290. struct bmd_softc *bp = &bmd_softc;
  291. struct bmd_linec *bq = bp->bc_bl;
  292. int i;
  293. c &= 0x7F;
  294. /* turn off cursole */
  295. bmd_reverse_char(bp->bc_raddr,
  296. bp->bc_waddr,
  297. bq->bl_col, bp->bc_row);
  298. /* do escape-sequence */
  299. if (bp->bc_stat & STAT_ESCAPE) {
  300. *bp->bc_esc++ = c;
  301. (*bp->bc_escape)(c);
  302. goto done;
  303. }
  304. if (isprint(c)) {
  305. bmd_draw_char(bp->bc_raddr, bp->bc_waddr,
  306. bq->bl_col, bp->bc_row, c);
  307. bq->bl_col++;
  308. bq->bl_end++;
  309. if (bq->bl_col >= bp->bc_xmax) {
  310. bq->bl_col = bq->bl_end = bp->bc_xmin;
  311. bp->bc_row++;
  312. if (bp->bc_row >= bp->bc_ymax) {
  313. bmd_scroll_screen((u_short *) bp->bc_raddr,
  314. (u_short *) bp->bc_waddr,
  315. bp->bc_xmin, bp->bc_xmax,
  316. bp->bc_ymin, bp->bc_ymax);
  317. bp->bc_row = bp->bc_ymax - 1;
  318. }
  319. }
  320. } else {
  321. switch (c) {
  322. case 0x08: /* BS */
  323. if (bq->bl_col > bp->bc_xmin) {
  324. bq->bl_col--;
  325. }
  326. break;
  327. case 0x09: /* HT */
  328. case 0x0B: /* VT */
  329. i = ((bq->bl_col / 8) + 1) * 8;
  330. if (i < bp->bc_xmax) {
  331. bq->bl_col = bq->bl_end = i;
  332. }
  333. break;
  334. case 0x0A: /* NL */
  335. bp->bc_row++;
  336. if (bp->bc_row >= bp->bc_ymax) {
  337. bmd_scroll_screen((u_short *) bp->bc_raddr,
  338. (u_short *) bp->bc_waddr,
  339. bp->bc_xmin, bp->bc_xmax,
  340. bp->bc_ymin, bp->bc_ymax);
  341. bp->bc_row = bp->bc_ymax - 1;
  342. }
  343. break;
  344. case 0x0D: /* CR */
  345. bq->bl_col = bp->bc_xmin;
  346. break;
  347. case 0x1b: /* ESC */
  348. bp->bc_stat |= STAT_ESCAPE;
  349. *bp->bc_esc++ = 0x1b;
  350. break;
  351. case 0x7F: /* DEL */
  352. if (bq->bl_col > bp->bc_xmin) {
  353. bq->bl_col--;
  354. bmd_erase_char(bp->bc_raddr,
  355. bp->bc_waddr,
  356. bq->bl_col, bp->bc_row);
  357. }
  358. break;
  359. default:
  360. break;
  361. }
  362. }
  363. done:
  364. /* turn on cursole */
  365. bmd_reverse_char(bp->bc_raddr,
  366. bp->bc_waddr,
  367. bq->bl_col, bp->bc_row);
  368. return(c);
  369. }
  370. void
  371. bmdclear(void)
  372. {
  373. struct bmd_softc *bp = &bmd_softc;
  374. struct bmd_linec *bq = bp->bc_bl;
  375. bmd_erase_screen((u_short *) bp->bc_waddr); /* clear screen */
  376. bq->bl_col = bq->bl_end = bp->bc_xmin;
  377. bp->bc_row = bp->bc_ymin;
  378. bmd_reverse_char(bp->bc_raddr,
  379. bp->bc_waddr,
  380. bq->bl_col, bp->bc_row); /* turn on cursole */
  381. }
  382. /*
  383. * charactor operation routines
  384. */
  385. void
  386. bmd_draw_char(char *raddr, char *waddr, int col, int row, int c)
  387. {
  388. volatile u_short *p, *q;
  389. const u_short *fp;
  390. int i;
  391. fp = &bmdfont[c][0];
  392. switch (col % 4) {
  393. case 0:
  394. p = (u_short *) ( raddr + (( row * FB_HEIGHT ) << 8 ) + (( col / 4 ) * 6 ));
  395. q = (u_short *) ( waddr + (( row * FB_HEIGHT ) << 8 ) + (( col / 4 ) * 6 ));
  396. for (i = 0; i < FB_HEIGHT; i++) {
  397. *q = (*p & 0x000F) | (*fp & 0xFFF0);
  398. p += 128;
  399. q += 128;
  400. fp++;
  401. }
  402. break;
  403. case 1:
  404. p = (u_short *) ( raddr + (( row * FB_HEIGHT ) << 8 ) + (( col / 4 ) * 6 ));
  405. q = (u_short *) ( waddr + (( row * FB_HEIGHT ) << 8 ) + (( col / 4 ) * 6 ));
  406. for (i = 0; i < FB_HEIGHT; i++) {
  407. q[0] = (p[0] & 0xFFF0) | ((*fp & 0xF000) >> 12);
  408. q[1] = (p[1] & 0x00FF) | ((*fp & 0x0FF0) << 4);
  409. p += 128;
  410. q += 128;
  411. fp++;
  412. }
  413. break;
  414. case 2:
  415. p = (u_short *) ( raddr + (( row * FB_HEIGHT ) << 8 ) + (( col / 4 ) * 6 ) + 2 );
  416. q = (u_short *) ( waddr + (( row * FB_HEIGHT ) << 8 ) + (( col / 4 ) * 6 ) + 2 );
  417. for (i = 0; i < FB_HEIGHT; i++) {
  418. q[0] = (p[0] & 0xFF00) | ((*fp & 0xFF00) >> 8);
  419. q[1] = (p[1] & 0x0FFF) | ((*fp & 0x00F0) << 8);
  420. p += 128;
  421. q += 128;
  422. fp++;
  423. }
  424. break;
  425. case 3:
  426. p = (u_short *) ( raddr + (( row * FB_HEIGHT ) << 8 ) + (( col / 4 ) * 6 ) + 4 );
  427. q = (u_short *) ( waddr + (( row * FB_HEIGHT ) << 8 ) + (( col / 4 ) * 6 ) + 4 );
  428. for (i = 0; i < FB_HEIGHT; i++) {
  429. *q = (*p & 0xF000) | ((*fp & 0xFFF0) >> 4);
  430. p += 128;
  431. q += 128;
  432. fp++;
  433. }
  434. break;
  435. default:
  436. break;
  437. }
  438. }
  439. void
  440. bmd_reverse_char(char *raddr, char *waddr, int col, int row)
  441. {
  442. volatile u_short *p, *q;
  443. int i;
  444. switch (col%4) {
  445. case 0:
  446. p = (u_short *) ( raddr + (( row * FB_HEIGHT ) << 8 ) + (( col / 4 ) * 6 ));
  447. q = (u_short *) ( waddr + (( row * FB_HEIGHT ) << 8 ) + (( col / 4 ) * 6 ));
  448. for (i = 0; i < FB_HEIGHT; i++) {
  449. *q = (*p & 0x000F) | (~(*p) & 0xFFF0);
  450. p += 128;
  451. q += 128;
  452. }
  453. break;
  454. case 1:
  455. p = (u_short *) ( raddr + (( row * FB_HEIGHT ) << 8 ) + (( col / 4 ) * 6 ));
  456. q = (u_short *) ( waddr + (( row * FB_HEIGHT ) << 8 ) + (( col / 4 ) * 6 ));
  457. for (i = 0; i < FB_HEIGHT; i++) {
  458. q[0] = (p[0] & 0xFFF0) | (~p[0] & 0x000F);
  459. q[1] = (p[1] & 0x00FF) | (~p[1] & 0xFF00);
  460. p += 128;
  461. q += 128;
  462. }
  463. break;
  464. case 2:
  465. p = (u_short *) ( raddr + (( row * FB_HEIGHT ) << 8 ) + (( col / 4 ) * 6 ) + 2 );
  466. q = (u_short *) ( waddr + (( row * FB_HEIGHT ) << 8 ) + (( col / 4 ) * 6 ) + 2 );
  467. for (i = 0; i < FB_HEIGHT; i++) {
  468. q[0] = (p[0] & 0xFF00) | (~p[0] & 0x00FF);
  469. q[1] = (p[1] & 0x0FFF) | (~p[1] & 0xF000);
  470. p += 128;
  471. q += 128;
  472. }
  473. break;
  474. case 3:
  475. p = (u_short *) ( raddr + (( row * FB_HEIGHT ) << 8 ) + (( col / 4 ) * 6 ) + 4 );
  476. q = (u_short *) ( waddr + (( row * FB_HEIGHT ) << 8 ) + (( col / 4 ) * 6 ) + 4 );
  477. for (i = 0; i < FB_HEIGHT; i++) {
  478. *q = (*p & 0xF000) | (~(*p) & 0x0FFF);
  479. p += 128;
  480. q += 128;
  481. }
  482. break;
  483. default:
  484. break;
  485. }
  486. }
  487. void
  488. bmd_erase_char(char *raddr, char *waddr, int col, int row)
  489. {
  490. bmd_draw_char(raddr, waddr, col, row, 0);
  491. return;
  492. }
  493. /*
  494. * screen operation routines
  495. */
  496. void
  497. bmd_erase_screen(volatile u_short *p)
  498. {
  499. int i, j;
  500. for (i = 0; i < SB_HEIGHT; i++) {
  501. for (j = 0; j < SS_WIDTH; j++)
  502. *p++ = 0;
  503. SKIP_NEXT_LINE(p);
  504. }
  505. return;
  506. }
  507. void
  508. bmd_scroll_screen(volatile u_short *p, volatile u_short *q,
  509. int xmin, int xmax, int ymin, int ymax)
  510. {
  511. int i, j;
  512. p += ((PS_WIDTH * FB_HEIGHT) * (ymin + 1));
  513. q += ((PS_WIDTH * FB_HEIGHT) * ymin);
  514. for (i = 0; i < ((ymax - ymin -1) * FB_HEIGHT); i++) {
  515. for (j = 0; j < SS_WIDTH; j++) {
  516. *q++ = *p++;
  517. }
  518. p += (PS_WIDTH - SS_WIDTH);
  519. q += (PS_WIDTH - SS_WIDTH);
  520. }
  521. for (i = 0; i < FB_HEIGHT; i++) {
  522. for (j = 0; j < SS_WIDTH; j++) {
  523. *q++ = 0;
  524. }
  525. q += (PS_WIDTH - SS_WIDTH);
  526. }
  527. }