FIX.SRC 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948
  1. ************************************************************************
  2. * *
  3. * [[[ NOP ]]] SYSTEM MESSAGE OUTPUT ROUTINE *
  4. * by S.OKADA from 91/09/17 Tue 09:47 *
  5. * *
  6. ************************************************************************
  7. XDEF NOP_MESS_OUT
  8. XREF ?A5
  9. INCLUDE NEO_GEO.INC @@@
  10. INCLUDE LABEL.INC
  11. SECT.S SYS,,C
  12. NOP_MESS_OUT:
  13. ; output message buffer data LSPC
  14. ; NEO-GEO system MESS_OUT up conversion
  15. ; all register broked
  16. TST.B MESS_BUSY(A5)
  17. BNE.S NOP_MESS_OUT_3 now buffer busy
  18. ADDQ.B #1,MESS_BUSY(A5) flag set
  19. MOVE.L #MESS_STACK+4,MESS_STACK(A5)
  20. MOVE.L #MESS_BUFFER,MESS_OUT_POINT(A5) start pointer
  21. LEA.L BCD_ASCII(PC),A4
  22. LEA.L LSPC_DATA,A2 LSPC data write register
  23. NOP_MESS_OUT_1:
  24. MOVE.L MESS_OUT_POINT(A5),A0
  25. CMPA.L MESS_POINT(A5),A0
  26. BLO.S NOP_MESS_OUT_4
  27. ; output job over
  28. NOP_MESS_OUT_2:
  29. MOVE.L #MESS_BUFFER,MESS_POINT(A5) pointer first position
  30. CLR.B MESS_BUSY(A5) flag clear
  31. NOP_MESS_OUT_3:
  32. RTS
  33. NOP_MESS_OUT_4:
  34. MOVE.L (A0)+,A3 command brock start address
  35. MOVE.L A0,MESS_OUT_POINT(A5)
  36. MOVE.L A3,MESS_COM_MODE(A5)
  37. BMI.S NOP_MESS_OUT_5
  38. BNE.S NOP_MESS_OUT_7
  39. MOVE.L A0,A3 command ram mode
  40. BRA.S NOP_MESS_OUT_7
  41. NOP_MESS_OUT_5:
  42. ; L_WORK set
  43. ADDQ.B #1,MESS_COM_MODE(A5)
  44. BNE.S NOP_MESS_OUT_6
  45. MOVE.L MESS_COM_MODE(A5),A6
  46. JMP NOP_MESS_OUT_1(PC)
  47. NOP_MESS_OUT_6:
  48. ; continue fix out
  49. CLR.B MESS_COM_MODE(A5)
  50. MOVE.L MESS_COM_MODE(A5),A6
  51. JSR CONTINUE_FIX(PC)
  52. JMP NOP_MESS_OUT_1(PC)
  53. NOP_MESS_OUT_7:
  54. MOVE.B (A3)+,D1 command hi-byte (parameter)
  55. MOVEQ.L #0,D0
  56. MOVE.B (A3)+,D0 command low-byte (command No)
  57. CMP.B #(COMMAND_VECTOR_END-COMMAND_VECTOR)/4,D0
  58. BCC NOP_MESS_OUT_ERROR command error
  59. ADD.W D0,D0
  60. ADD.W D0,D0
  61. JSR COMMAND_VECTOR(PC,D0.W)
  62. JMP NOP_MESS_OUT_7(PC)
  63. COMMAND_VECTOR:
  64. JMP COMMAND_END(PC) 00
  65. JMP DATA_FORMAT(PC) 01
  66. JMP INCREMENT(PC) 02
  67. JMP OUT_ADDRESS(PC) 03
  68. JMP DATA_ADDRESS(PC) 04
  69. JMP ADDRESS_INC(PC) 05
  70. JMP DATA_CONT(PC) 06
  71. JMP DIRECT_DATA(PC) 07
  72. JMP FIX_OUT(PC) 08
  73. JMP KANA_OUT(PC) 09
  74. JMP SUB_COMMAND(PC) 0A
  75. JMP RET_COMMAND(PC) 0B
  76. JMP SAME_DATA(PC) 0C
  77. JMP INC_DATA(PC) 0D
  78. ; below only NOP_MESS_OUT
  79. JMP WORK_CHANGE(PC) 0E
  80. JMP TABLE_CALL(PC) 0F
  81. JMP CML_POINTER(PC) 10
  82. JMP CML_SAVE(PC) 11
  83. JMP BCD_BASE_SET(PC) 12
  84. JMP BCD_OUT(PC) 13
  85. JMP ADDRESS_INC_BYTE(PC) 14
  86. JMP CONTINUE_FIX(PC) 15
  87. JMP PRINTF(PC) 16
  88. JMP TABLE_COMMAND(PC) 17
  89. JMP KNJ_OUT(PC) 18
  90. COMMAND_VECTOR_END:
  91. BCD_ASCII:
  92. DC.B '0123456789ABCDEF ',0
  93. NOP_MESS_OUT_ERROR:
  94. MOVE.W 1,D0
  95. TABLE_COMMAND:
  96. ; No 17 single command table choice
  97. ; command-hi 0:A6 offset else:A5 offset
  98. ; parms) work offset (.w)
  99. ; table base offset (.w)
  100. ; command parms (.w)
  101. ; table is word offset from table base
  102. LEA.L (A6),A0
  103. TST.B D1
  104. BEQ.S TABLE_COMMAND_1
  105. LEA.L (A5),A0
  106. TABLE_COMMAND_1:
  107. MOVE.W (A3)+,D0
  108. MOVEQ.L #0,D1
  109. MOVE.B 0(A0,D0.W),D1
  110. ADD.W D1,D1
  111. LEA.L (A3),A0
  112. ADD.W (A3)+,A0
  113. LEA.L 0(A0,D1.W),A0
  114. ADD.W (A0),A0
  115. MOVE.B (A3)+,D1 command hi-byte (parameter)
  116. MOVEQ.L #0,D0
  117. MOVE.B (A3)+,D0 command low-byte (command No)
  118. CMP.B #(COMMAND_VECTOR_END-COMMAND_VECTOR)/4,D0
  119. BCC NOP_MESS_OUT_ERROR command error
  120. MOVE.L A3,-(SP)
  121. LEA.L (A0),A3
  122. ADD.W D0,D0
  123. ADD.W D0,D0
  124. LEA.L COMMAND_VECTOR(PC),A0
  125. JSR 0(A0,D0.W)
  126. MOVE.L (SP)+,A3
  127. RTS
  128. COMMAND_END:
  129. ; No 0 command end
  130. ; command-hi d7 next mode (rom or cml mode)
  131. ; 0:non next 1:next ram mode
  132. ; d0 save mode (cml mode only)
  133. ; 0:no save else:pointer save
  134. TST.L MESS_COM_MODE(A5) mode check
  135. BEQ.S COMMAND_END_1 ram mode
  136. BMI.S COMMAND_END_2 cml mode
  137. BPL.S COMMAND_END_3 normal mode
  138. COMMAND_END_1:
  139. MOVE.L A3,MESS_OUT_POINT(A5) ram mode,pointer back
  140. MOVE.L #NOP_MESS_OUT_1,(SP)
  141. RTS
  142. COMMAND_END_2:
  143. BTST.L #0,D1
  144. BEQ.S COMMAND_END_3
  145. MOVE.L A3,ADRS2(A6) pointer save
  146. COMMAND_END_3:
  147. TST.B D1
  148. BPL.S COMMAND_END_4
  149. MOVE.L MESS_OUT_POINT(A5),A3
  150. CLR.L MESS_COM_MODE(A5)
  151. RTS
  152. COMMAND_END_4:
  153. MOVE.L #NOP_MESS_OUT_1,(SP)
  154. RTS
  155. DATA_FORMAT:
  156. ; No 1 data format
  157. SWAP D1
  158. MOVE.L D1,D5 format data store
  159. MOVE.W (A3)+,D5 parameter get
  160. RTS
  161. INCREMENT:
  162. ; No 2 auto increment value
  163. EXT.W D1 sign extent 16 bit
  164. MOVE.W D1,2(A2) set auto increment value
  165. RTS
  166. OUT_ADDRESS:
  167. ; No 3 output v-ram address
  168. MOVE.W (A3)+,D6 address get
  169. MOVE.W D6,-2(A2) set address
  170. RTS
  171. DATA_ADDRESS:
  172. ; No 4 get data address and data output
  173. MOVE.L (A3)+,A1
  174. BSR DATA_OUT data output
  175. MOVE.L A1,MESS_DATA_POINT(A5)
  176. RTS
  177. ADDRESS_INC:
  178. ; No 5 address increment
  179. ADD.W (A3)+,D6
  180. MOVE.W D6,-2(A2) set address
  181. RTS
  182. DATA_CONT:
  183. ; No 6 data continue output
  184. MOVE.L MESS_DATA_POINT(A5),A1
  185. BSR DATA_OUT
  186. MOVE.L A1,MESS_DATA_POINT(A5)
  187. RTS
  188. DIRECT_DATA:
  189. ; No 7 direct data
  190. LEA.L (A3),A1 data ram mode
  191. BSR DATA_OUT
  192. ADDQ.W #1,A1
  193. MOVE.L A1,D0
  194. ; AND.W #0FFFEH,D0 address to even
  195. BCLR.L #0,D0 address to even
  196. MOVE.L D0,A3 pointer back
  197. RTS
  198. DATA_OUT:
  199. BTST #17,D5 data type byte or word
  200. BNE.S WORD_OUT
  201. BYTE_OUT: ;data byte type
  202. MOVE.W D5,D2 output hi-byte
  203. MOVE.B D5,D7 end code or data number
  204. BTST #16,D5 end type
  205. BNE.S BYTE_NUMBER
  206. BYTE_CH: ;end code type
  207. MOVE.B (A1)+,D2
  208. CMP.B D2,D7 end code ?
  209. BEQ.S BYTE_END
  210. MOVE.W D2,(A2) v-ram output
  211. BRA.S BYTE_CH
  212. BYTE_NUMBER: ;data number type
  213. MOVE.B (A1)+,D2
  214. MOVE.W D2,(A2) v-ram output
  215. SUBQ.B #1,D7
  216. BNE.S BYTE_NUMBER
  217. BYTE_END:
  218. RTS
  219. WORD_OUT:
  220. ; data word type
  221. MOVE.W D5,D7
  222. BTST #16,D5 end type
  223. BNE.S WORD_NUMBER
  224. WORD_CH: ;end code type
  225. MOVE.W (A1)+,D2
  226. CMP.W D2,D5 end code ?
  227. BEQ.S WORD_END
  228. MOVE.W D2,(A2) v-ram output
  229. BRA.S WORD_CH
  230. WORD_NUMBER: ;data number type
  231. MOVE.W (A1)+,(A2) v-ram output
  232. SUBQ.W #1,D7
  233. BNE.S WORD_NUMBER
  234. WORD_END:
  235. RTS
  236. FIX_OUT:
  237. ; No 8 common Fix 8*16 font output
  238. MOVE.W #20H,2(A2)
  239. MOVE.B D1,(A5)
  240. MOVE.W (A5),D2
  241. LEA.L (A3),A1
  242. JSR FIX_OUT_SUB(PC) upper line
  243. ADDQ.W #1,D6
  244. MOVE.W D6,-2(A2)
  245. LEA.L (A3),A1
  246. ADD.W #100H,D2 down line
  247. JSR FIX_OUT_SUB(PC)
  248. ADDQ.W #1,A1
  249. MOVE.L A1,D0
  250. ; AND.W #0FFFEH,D0 address to even
  251. BCLR.L #0,D0 address to even
  252. MOVE.L D0,A3 pointer back
  253. RTS
  254. FIX_OUT_SUB:
  255. MOVE.B (A1)+,D2
  256. CMP.B #0FFH,D2
  257. BEQ.S FOS_END FF is end code
  258. MOVE.W D2,(A2) data output
  259. BRA FIX_OUT_SUB
  260. FOS_END:
  261. RTS
  262. KANA_OUT:
  263. ; No 9 common Fix 8*16 font output
  264. MOVE.W #20H,2(A2)
  265. MOVE.B D1,(A5)
  266. MOVE.W (A5),D2
  267. LEA.L (A3),A1
  268. JSR KANA_OUT_SUB(PC) upper line
  269. ADDQ.W #1,D6
  270. MOVE.W D6,-2(A2)
  271. LEA.L (A3),A1
  272. ADD.W #100H,D2 down line
  273. JSR KANA_OUT_SUB(PC)
  274. ADDQ.W #1,A1
  275. MOVE.L A1,D0
  276. ; AND.W #0FFFEH,D0 address to even
  277. BCLR.L #0,D0 address to even
  278. MOVE.L D0,A3 pointer back
  279. RTS
  280. KANA_OUT_SUB:
  281. MOVE.B (A1)+,D2
  282. CMP.B #0FFH,D2
  283. BEQ.S KOS_END FF is end code
  284. CMP.B #20H,D2
  285. BCS.S DAKU_OUT (han)dakuten hiragana
  286. CMP.B #60H,D2
  287. BCS.S KOS_1
  288. TST.B D2
  289. BMI KOS_1
  290. SUB.B #40H,D2
  291. DAKU_OUT:
  292. ADD.B #80H,D2
  293. MOVE.W D2,D1
  294. AND.W #0F0FFH,D1
  295. BTST.L #8,D2
  296. BNE.S DAKU_OUT_1
  297. ADD.B #40H,D1 down line
  298. DAKU_OUT_1:
  299. MOVE.W D1,(A2) data output
  300. BRA KANA_OUT_SUB
  301. KOS_1:
  302. MOVE.W D2,(A2) data output
  303. BRA KANA_OUT_SUB
  304. KOS_END:
  305. RTS
  306. KNJ_OUT:
  307. ; No 18 common Fix 16*16 font output
  308. ; command-hi 0:palette
  309. ; end code 0FFH
  310. MOVE.W #20H,2(A2)
  311. MOVE.B D1,(A5)
  312. MOVE.W (A5),D2
  313. LEA.L (A3),A1
  314. JSR KNJ_OUT_SUB(PC) upper line
  315. ADDQ.W #1,D6
  316. MOVE.W D6,-2(A2)
  317. LEA.L (A3),A1
  318. ADD.W #100H,D2 down line
  319. JSR KNJ_OUT_SUB(PC)
  320. LEA.L (A1),A3
  321. RTS
  322. KNJ_OUT_SUB:
  323. MOVE.W (A1)+,D0
  324. CMP.W #0FFH,D0
  325. BEQ.S KNJ_END FF is end code
  326. ADD.W D2,D0
  327. MOVE.W D0,(A2) data output
  328. ADDQ.W #1,D0
  329. NOP
  330. MOVE.W D0,(A2)
  331. BRA KNJ_OUT_SUB
  332. KNJ_END:
  333. RTS
  334. SUB_COMMAND:
  335. ; No 0A sub data call
  336. ; command-hi 0:absolute address else:word offset
  337. TST.B D1
  338. BNE.S SUB_COMMAND_WORD
  339. MOVE.L (A3)+,D0
  340. MOVE.L MESS_STACK(A5),A0
  341. MOVE.L A3,(A0)+
  342. MOVE.L A0,MESS_STACK(A5)
  343. MOVE.L D0,A3
  344. RTS
  345. SUB_COMMAND_WORD:
  346. MOVE.W (A3)+,D0
  347. MOVE.L MESS_STACK(A5),A0
  348. MOVE.L A3,(A0)+
  349. MOVE.L A0,MESS_STACK(A5)
  350. LEA.L -2(A3,D0.W),A3
  351. RTS
  352. RET_COMMAND:
  353. ; No 0B sub data return
  354. MOVE.L MESS_STACK(A5),A0
  355. MOVE.L -(A0),A3
  356. MOVE.L A0,MESS_STACK(A5)
  357. RTS
  358. SAME_DATA:
  359. ; No 0C same data output
  360. MOVE.W (A3)+,D0
  361. SAME_DATA_1:
  362. MOVE.W D0,(A2)
  363. SUBQ.B #1,D1
  364. BNE.S SAME_DATA_1
  365. RTS
  366. INC_DATA:
  367. ; No 0D increment data output
  368. MOVE.W (A3)+,D0
  369. INC_DATA_1:
  370. MOVE.W D0,(A2)
  371. ADDQ.B #1,D0
  372. SUBQ.B #1,D1
  373. BNE.S INC_DATA_1
  374. RTS
  375. WORK_CHANGE:
  376. ; No 0E A6 work change
  377. ; command-hi 0-3:WORK_N0-3 80H-:MASTER_WORK
  378. TST.B D1
  379. BMI.S WORK_CHANGE_MASTER
  380. AND.W #0FFH,D1
  381. MOVE.B WORK_N0(A6,D1.W),(A5)
  382. BRA.S WORK_CHANGE_1
  383. WORK_CHANGE_MASTER:
  384. MOVE.B MASTER_No(A6),(A5)
  385. WORK_CHANGE_1:
  386. MOVE.W (A5),D0
  387. BMI.S PWORK_SET
  388. LEA.L -LOG(A5,D0.W),A6
  389. RTS
  390. PWORK_SET:
  391. AND.W #7F00H,D0
  392. LEA.L 0(A5,D0.W),A6
  393. RTS
  394. TABLE_CALL:
  395. ; No 0F command table call
  396. ; command-hi 0:A6 offset else:A5 offset
  397. ; parms) work offset (.w)
  398. ; table base offset (.w)
  399. ; table is word offset from table base
  400. LEA.L (A6),A0
  401. TST.B D1
  402. BEQ.S TABLE_CALL_1
  403. LEA.L (A5),A0
  404. TABLE_CALL_1:
  405. MOVE.W (A3)+,D0
  406. MOVEQ.L #0,D1
  407. MOVE.B 0(A0,D0.W),D1
  408. ADD.W D1,D1
  409. JSR SUB_COMMAND_WORD(PC)
  410. LEA.L 0(A3,D1.W),A3
  411. ADD.W (A3),A3
  412. RTS
  413. CML_POINTER:
  414. ; No 10 command pointer to cml
  415. MOVE.L ADRS2(A6),A3
  416. MOVE.B #0FFH,MESS_COM_MODE(A5)
  417. RTS
  418. CML_SAVE:
  419. ; No 11 cml pointer save
  420. MOVE.L A3,ADRS2(A6)
  421. RTS
  422. BCD_BASE_SET:
  423. ; No 12 BCD convert data table set
  424. ; parms) data table address (.l)
  425. MOVE.L (A3)+,A4
  426. RTS
  427. ;*** data table format ***
  428. ; +0~+F characer code 0-F
  429. ; +10 space code
  430. BCD_OUT:
  431. ; No 13 BCD data output by BCD table
  432. ; command-hi
  433. ; d7 output size
  434. ; 0:8*8 1:8*16
  435. ; d6 masking upper zero
  436. ; 0:off 1:on
  437. ; d5 start code
  438. ; 0:d4- 1:d0-
  439. ; d4 base register
  440. ; 0:A5 1:A6
  441. ; d0-3 data number-1
  442. ; parms) output address(.w)
  443. ; data offset from A5(.w)
  444. ; output hi-byte(.w)
  445. MOVE.W #20H,2(A2) inc 20H
  446. MOVE.W (A3)+,D6
  447. LEA.L (A5),A1
  448. BTST.L #4,D1
  449. BEQ.S BCD_OUT_1
  450. LEA.L (A6),A1
  451. BCD_OUT_1:
  452. ADD.W (A3)+,A1
  453. MOVE.W (A3)+,D2
  454. TST.B D1
  455. BPL.S BCD_OUT_SUB
  456. MOVE.L A1,-(SP)
  457. BSR BCD_OUT_SUB
  458. MOVE.L (SP)+,A1
  459. ADD.W #100H,D2
  460. ADDQ.W #1,D6
  461. BCD_OUT_SUB:
  462. MOVE.W D6,-2(A2)
  463. MOVEQ.L #1111B,D7
  464. AND.W D1,D7
  465. MOVEQ.L #0,D3
  466. BTST.L #6,D1
  467. BEQ.S BCD_OUT_SUB_1
  468. MOVEQ.L #10H,D3
  469. BCD_OUT_SUB_1:
  470. BTST.L #5,D1
  471. BNE.S BCD_OUT_SUB_3
  472. BCD_OUT_SUB_2:
  473. MOVE.B (A1),D0
  474. LSR.B #4,D0
  475. BSR BOS_SUB
  476. DBRA D7,BCD_OUT_SUB_3
  477. RTS
  478. BCD_OUT_SUB_3:
  479. MOVEQ.L #0FH,D0
  480. AND.B (A1)+,D0
  481. BSR BOS_SUB
  482. DBRA D7,BCD_OUT_SUB_2
  483. RTS
  484. BOS_SUB:
  485. BEQ.S BOS_SUB_1
  486. MOVEQ.L #0,D3
  487. BOS_SUB_1:
  488. AND.B #11110000B,D3
  489. OR.B D0,D3
  490. TST.W D7
  491. BNE.S BOS_SUB_2
  492. MOVE.B D0,D3
  493. BOS_SUB_2:
  494. MOVE.B 0(A4,D3.W),D2
  495. MOVE.W D2,(A2)
  496. RTS
  497. ADDRESS_INC_BYTE:
  498. ; No 14 address increment byte type
  499. ; command-hi offset (word extende)
  500. EXT.W D1
  501. ADD.W D1,D6
  502. MOVE.W D6,-2(A2) set address
  503. RTS
  504. PRINTF:
  505. ; No 16 C language printf
  506. ; parms) output data address(.l)
  507. ; data format)
  508. ; code,code,..,%(ctrl code),count,valu offs(-A5 .w-even),code,.
  509. ; ....,0FFH(end code)
  510. ; value) output hi-byte(.b),value....
  511. ;
  512. MOVE.W #20H,2(A2) inc 20H
  513. MOVE.W D5,D0
  514. PRINTF_1:
  515. MOVE.B (A3)+,D0
  516. CMP.B #'%',D0
  517. BEQ.S PRINTF_3
  518. CMP.B #0FFH,D0
  519. BEQ.S PRINTF_2
  520. MOVE.W D0,(A2)
  521. BRA.S PRINTF_1
  522. PRINTF_2:
  523. ADDQ.W #1,A3
  524. MOVE.L A3,D0
  525. ; AND.W #0FFFEH,D0 address to even
  526. BCLR.L #0,D0 address to even
  527. MOVE.L D0,A3 pointer back
  528. RTS
  529. PRINTF_3:
  530. MOVE.B (A3)+,D7
  531. ADDQ.W #1,A3
  532. MOVE.L A3,D0
  533. ; AND.W #0FFFEH,D0 address to even
  534. BCLR.L #0,D0 address to even
  535. MOVE.L D0,A3 pointer back
  536. LEA.L (A5),A0
  537. ADD.W (A3)+,A0
  538. MOVE.B (A0)+,(A5)
  539. MOVE.W (A5),D1
  540. BTST.L #0,D7
  541. BNE.S PRINTF_5
  542. PRINTF_4:
  543. MOVE.B (A0),D0
  544. LSR.B #4,D0
  545. AND.W #0FH,D0
  546. MOVE.B 0(A4,D0.W),D1
  547. MOVE.W D1,(A2)
  548. PRINTF_5:
  549. MOVEQ.L #0FH,D0
  550. AND.B (A0)+,D0
  551. MOVE.B 0(A4,D0.W),D1
  552. MOVE.W D1,(A2)
  553. SUBQ.B #2,D7
  554. BGT.S PRINTF_4
  555. MOVE.W D5,D0
  556. JMP PRINTF_1(PC)
  557. CONTINUE_FIX:
  558. ; No 16 fix continue output
  559. MOVE.L ADRS2(A6),A1
  560. CONT_FIX_1:
  561. TST.B BYTE_TIMER(A6)
  562. BEQ.S CONT_FIX_2
  563. SUBQ.B #1,BYTE_TIMER(A6)
  564. BLS.S CONT_FIX_2
  565. RTS
  566. CONT_FIX_2:
  567. MOVE.W CHAR_INC(A6),D3
  568. MOVE.W D3,2(A2)
  569. MOVE.W TEMP_ADRS(A6),-2(A2)
  570. MOVE.W CHAR_ATTR(A6),D2
  571. CONT_FIX_3:
  572. MOVE.B (A1)+,D2
  573. CMP.B COMMAND_CHAR(A6),D2
  574. BEQ CONT_FIX_COMMAND
  575. MOVE.W D2,(A2)
  576. CONT_FIX_4:
  577. ADD.W D3,TEMP_ADRS(A6)
  578. MOVE.B CHAR_WAIT(A6),BYTE_TIMER(A6)
  579. BEQ.S CONT_FIX_3
  580. MOVE.L A1,ADRS2(A6)
  581. RTS
  582. CONT_FIX_COMMAND:
  583. MOVEQ.L #0,D0
  584. MOVE.B (A1)+,D0
  585. ADD.W D0,D0
  586. ADD.W D0,D0
  587. JMP CF_VECTOR(PC,D0.W)
  588. CF_VECTOR:
  589. JMP CF_END(PC) 00:
  590. JMP CF_FIRST(PC) 01:
  591. JMP LINE_FEED(PC) 02:
  592. JMP NEXT_PAGE(PC) 03:
  593. JMP LINE_CLEAR(PC) 04:
  594. JMP PAGE_CLEAR(PC) 05:
  595. JMP CF_TABLE_SUB_A5(PC) 06:
  596. JMP CF_TABLE_SUB_A6(PC) 07:
  597. JMP CF_SUB_RETURN(PC) 08:
  598. JMP CF_WORD_OUT(PC) 09:
  599. JMP CF_ATTR_CHANGE(PC) 0A:
  600. CF_END:
  601. ; CF No 00 data end
  602. BSET.B #7,FLAG(A6)
  603. RTS
  604. CF_FIRST:
  605. ; CF No 01 first parm set
  606. ; parms) ***start even
  607. ; BASE_ADRS,CHAR_INC,LINE_INC(.w)
  608. ; CHAR_ATTR(.w)
  609. ADDQ.W #1,A1
  610. MOVE.L A1,D0
  611. ; AND.W #0FFFEH,D0
  612. BCLR.L #0,D0 address to even
  613. MOVE.L D0,A1
  614. MOVE.W (A1)+,BASE_ADRS(A6)
  615. MOVE.W (A1)+,CHAR_INC(A6)
  616. MOVE.W (A1)+,LINE_INC(A6)
  617. MOVE.W (A1)+,CHAR_ATTR(A6)
  618. MOVE.W BASE_ADRS(A6),TEMP_ADRS(A6)
  619. MOVE.W BASE_ADRS(A6),TEMP_HEAD(A6)
  620. JMP CONT_FIX_2(PC)
  621. LINE_FEED:
  622. ; CF No 02 line feed
  623. MOVE.W TEMP_HEAD(A6),D0
  624. ADD.W LINE_INC(A6),D0
  625. MOVE.W D0,TEMP_HEAD(A6)
  626. MOVE.W D0,TEMP_ADRS(A6)
  627. MOVE.W D0,-2(A2)
  628. BSET.B #5,FLAG(A6)
  629. MOVE.B LINE_WAIT(A6),BYTE_TIMER(A6)
  630. BEQ CONT_FIX_3
  631. MOVE.L A1,ADRS2(A6)
  632. RTS
  633. NEXT_PAGE:
  634. ; CF No 03 next page
  635. MOVE.W BASE_ADRS(A6),D0
  636. MOVE.W D0,TEMP_ADRS(A6)
  637. MOVE.W D0,TEMP_HEAD(A6)
  638. MOVE.W D0,-2(A2)
  639. BSET.B #6,FLAG(A6)
  640. MOVE.B PAGE_WAIT(A6),BYTE_TIMER(A6)
  641. BEQ CONT_FIX_3
  642. MOVE.L A1,ADRS2(A6)
  643. RTS
  644. LINE_CLEAR:
  645. ; CF No 04 temporary 1 line clear
  646. ; parms) line length (.b)
  647. MOVE.B (A1)+,D7
  648. MOVE.W TEMP_HEAD(A6),-2(A2)
  649. MOVE.W CLEAR_CODE(A6),D0
  650. LINE_CLEAR_1:
  651. MOVE.W D0,(A2)
  652. SUBQ.B #1,D7
  653. BNE.S LINE_CLEAR_1
  654. JMP CONT_FIX_3(PC)
  655. PAGE_CLEAR:
  656. ; CF No 05 page clear
  657. ; parms) line length,page length (.b)
  658. MOVE.B 1(A1),D7
  659. MOVE.W BASE_ADRS(A6),D1
  660. MOVE.W CLEAR_CODE(A6),D0
  661. PAGE_CLEAR_1:
  662. MOVE.W D1,-2(A2)
  663. MOVE.B (A1),D4
  664. PAGE_CLEAR_2:
  665. MOVE.W D0,(A2)
  666. SUBQ.B #1,D4
  667. BNE.S PAGE_CLEAR_2
  668. ADD.W LINE_INC(A6),D1
  669. SUBQ.B #1,D7
  670. BNE.S PAGE_CLEAR_1
  671. JMP CONT_FIX_3(PC)
  672. CF_TABLE_SUB_A5:
  673. ; CF No 06 table sub data call with d16(A5)
  674. ; parms) ***start even
  675. ; work offset,table offset (.w)
  676. ADDQ.W #1,A1
  677. MOVE.L A1,D0
  678. ; AND.W #0FFFEH,D0
  679. BCLR.L #0,D0 address to even
  680. MOVE.L D0,A1
  681. MOVE.W (A1)+,D0
  682. MOVEQ.L #0,D1
  683. MOVE.B 0(A5,D0.W),D1
  684. JMP CF_TABLE_SUB(PC)
  685. CF_TABLE_SUB_A6:
  686. ; CF No 07 table sub data call with d16(A6)
  687. ; parms) ***start even
  688. ; work offset,table offset (.w)
  689. ADDQ.W #1,A1
  690. MOVE.L A1,D0
  691. ; AND.W #0FFFEH,D0
  692. BCLR.L #0,D0 address to even
  693. MOVE.L D0,A1
  694. MOVE.W (A1)+,D0
  695. MOVEQ.L #0,D1
  696. MOVE.B 0(A6,D0.W),D1
  697. CF_TABLE_SUB:
  698. ADD.W D1,D1
  699. ADD.W D1,D1
  700. ADD.W (A1)+,D1
  701. MOVE.L A1,CF_STACK(A6)
  702. MOVE.L -2(A1,D1.W),A1
  703. JMP CONT_FIX_3(PC)
  704. CF_SUB_RETURN:
  705. ; CF No 08 return from sub data
  706. MOVE.L CF_STACK(A6),A1
  707. JMP CONT_FIX_3(PC)
  708. CF_WORD_OUT:
  709. ; CF No 09 word output
  710. ; parms) ch-hi,ch-low(.b)
  711. MOVE.B (A1)+,(A5)
  712. MOVE.W (A5),D0
  713. MOVE.B (A1)+,D0
  714. MOVE.W D0,(A2)
  715. JMP CONT_FIX_4(PC)
  716. CF_ATTR_CHANGE:
  717. ; CF No 0A CHAR_ATTR change
  718. ; parms) ch-hi(.b)
  719. MOVE.B (A1)+,CHAR_ATTR(A6)
  720. MOVE.W CHAR_ATTR(A6),D2
  721. JMP CONT_FIX_3(PC)
  722. INCLUDE WORK.INC
  723.