z80.lib 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. ; @CHK MACRO USED FOR CHECKING 8 BIT DISPLACMENTS
  2. ;
  3. @CHK MACRO ?DD ; USED FOR CHECKING RANGE OF 8-BIT DISP.S
  4. IF (?DD GT 0FFH) AND (?DD LT 0H)
  5. 'DISPLACEMENT RANGE ERROR - Z80 LIB'
  6. ENDIF
  7. ENDM
  8. @CHECK MACRO ?N
  9. ?DD SET ?N-$-2
  10. IF (?DD GT 07FH) AND (?DD LT 0FF80H)
  11. 'RANGE ERROR - Z80 LIB'
  12. ?DD SET 0FEH
  13. ENDIF
  14. ENDM
  15. LDX MACRO ?R,?D
  16. @CHK ?D
  17. DB 0DDH,?R*8+46H,?D
  18. ENDM
  19. LDY MACRO ?R,?D
  20. @CHK ?D
  21. DB 0FDH,?R*8+46H,?D
  22. ENDM
  23. STX MACRO ?R,?D
  24. @CHK ?D
  25. DB 0DDH,70H+?R,?D
  26. ENDM
  27. STY MACRO ?R,?D
  28. @CHK ?D
  29. DB 0FDH,70H+?R,?D
  30. ENDM
  31. MVIX MACRO ?N,?D
  32. @CHK ?D
  33. DB 0DDH,36H,?D,?N
  34. ENDM
  35. MVIY MACRO ?N,?D
  36. @CHK ?D
  37. DB 0FDH,36H,?D,?N
  38. ENDM
  39. LDAI MACRO
  40. DB 0EDH,57H
  41. ENDM
  42. LDAR MACRO
  43. DB 0EDH,5FH
  44. ENDM
  45. STAI MACRO
  46. DB 0EDH,47H
  47. ENDM
  48. STAR MACRO
  49. DB 0EDH,4FH
  50. ENDM
  51. LXIX MACRO ?NNNN
  52. DB 0DDH,21H
  53. DW ?NNNN
  54. ENDM
  55. LXIY MACRO ?NNNN
  56. DB 0FDH,21H
  57. DW ?NNNN
  58. ENDM
  59. LDED MACRO ?NNNN
  60. DB 0EDH,5BH
  61. DW ?NNNN
  62. ENDM
  63. LBCD MACRO ?NNNN
  64. DB 0EDH,4BH
  65. DW ?NNNN
  66. ENDM
  67. LSPD MACRO ?NNNN
  68. DB 0EDH,07BH
  69. DW ?NNNN
  70. ENDM
  71. LIXD MACRO ?NNNN
  72. DB 0DDH,2AH
  73. DW ?NNNN
  74. ENDM
  75. LIYD MACRO ?NNNN
  76. DB 0FDH,2AH
  77. DW ?NNNN
  78. ENDM
  79. SBCD MACRO ?NNNN
  80. DB 0EDH,43H
  81. DW ?NNNN
  82. ENDM
  83. SDED MACRO ?NNNN
  84. DB 0EDH,53H
  85. DW ?NNNN
  86. ENDM
  87. SSPD MACRO ?NNNN
  88. DB 0EDH,73H
  89. DW ?NNNN
  90. ENDM
  91. SIXD MACRO ?NNNN
  92. DB 0DDH,22H
  93. DW ?NNNN
  94. ENDM
  95. SIYD MACRO ?NNNN
  96. DB 0FDH,22H
  97. DW ?NNNN
  98. ENDM
  99. SPIX MACRO
  100. DB 0DDH,0F9H
  101. ENDM
  102. SPIY MACRO
  103. DB 0FDH,0F9H
  104. ENDM
  105. PUSHIX MACRO
  106. DB 0DDH,0E5H
  107. ENDM
  108. PUSHIY MACRO
  109. DB 0FDH,0E5H
  110. ENDM
  111. POPIX MACRO
  112. DB 0DDH,0E1H
  113. ENDM
  114. POPIY MACRO
  115. DB 0FDH,0E1H
  116. ENDM
  117. EXAF MACRO
  118. DB 08H
  119. ENDM
  120. EXX MACRO
  121. DB 0D9H
  122. ENDM
  123. XTIX MACRO
  124. DB 0DDH,0E3H
  125. ENDM
  126. XTIY MACRO
  127. DB 0FDH,0E3H
  128. ENDM
  129. LDI MACRO
  130. DB 0EDH,0A0H
  131. ENDM
  132. LDIR MACRO
  133. DB 0EDH,0B0H
  134. ENDM
  135. LDD MACRO
  136. DB 0EDH,0A8H
  137. ENDM
  138. LDDR MACRO
  139. DB 0EDH,0B8H
  140. ENDM
  141. CCI MACRO
  142. DB 0EDH,0A1H
  143. ENDM
  144. CCIR MACRO
  145. DB 0EDH,0B1H
  146. ENDM
  147. CCD MACRO
  148. DB 0EDH,0A9H
  149. ENDM
  150. CCDR MACRO
  151. DB 0EDH,0B9H
  152. ENDM
  153. ADDX MACRO ?D
  154. @CHK ?D
  155. DB 0DDH,86H,?D
  156. ENDM
  157. ADDY MACRO ?D
  158. @CHK ?D
  159. DB 0FDH,86H,?D
  160. ENDM
  161. ADCX MACRO ?D
  162. @CHK ?D
  163. DB 0DDH,8EH,?D
  164. ENDM
  165. ADCY MACRO ?D
  166. @CHK ?D
  167. DB 0FDH,8EH,?D
  168. ENDM
  169. SUBX MACRO ?D
  170. @CHK ?D
  171. DB 0DDH,96H,?D
  172. ENDM
  173. SUBY MACRO ?D
  174. @CHK ?D
  175. DB 0FDH,96H,?D
  176. ENDM
  177. SBCX MACRO ?D
  178. @CHK ?D
  179. DB 0DDH,9EH,?D
  180. ENDM
  181. SBCY MACRO ?D
  182. @CHK ?D
  183. DB 0FDH,9EH,?D
  184. ENDM
  185. ANDX MACRO ?D
  186. @CHK ?D
  187. DB 0DDH,0A6H,?D
  188. ENDM
  189. ANDY MACRO ?D
  190. @CHK ?D
  191. DB 0FDH,0A6H,?D
  192. ENDM
  193. XORX MACRO ?D
  194. @CHK ?D
  195. DB 0DDH,0AEH,?D
  196. ENDM
  197. XORY MACRO ?D
  198. @CHK ?D
  199. DB 0FDH,0AEH,?D
  200. ENDM
  201. ORX MACRO ?D
  202. @CHK ?D
  203. DB 0DDH,0B6H,?D
  204. ENDM
  205. ORY MACRO ?D
  206. @CHK ?D
  207. DB 0FDH,0B6H,?D
  208. ENDM
  209. CMPX MACRO ?D
  210. @CHK ?D
  211. DB 0DDH,0BEH,?D
  212. ENDM
  213. CMPY MACRO ?D
  214. @CHK ?D
  215. DB 0FDH,0BEH,?D
  216. ENDM
  217. INRX MACRO ?D
  218. @CHK ?D
  219. DB 0DDH,34H,?D
  220. ENDM
  221. INRY MACRO ?D
  222. @CHK ?D
  223. DB 0FDH,34H,?D
  224. ENDM
  225. DCRX MACRO ?D
  226. @CHK ?D
  227. DB 0DDH,035H,?D
  228. ENDM
  229. DCRY MACRO ?D
  230. @CHK ?D
  231. DB 0FDH,35H,?D
  232. ENDM
  233. NEG MACRO
  234. DB 0EDH,44H
  235. ENDM
  236. IM0 MACRO
  237. DB 0EDH,46H
  238. ENDM
  239. IM1 MACRO
  240. DB 0EDH,56H
  241. ENDM
  242. IM2 MACRO
  243. DB 0EDH,5EH
  244. ENDM
  245. BC EQU 0
  246. DE EQU 2
  247. HL EQU 4
  248. IX EQU 4
  249. IY EQU 4
  250. DADC MACRO ?R
  251. DB 0EDH,?R*8+4AH
  252. ENDM
  253. DSBC MACRO ?R
  254. DB 0EDH,?R*8+42H
  255. ENDM
  256. DADX MACRO ?R
  257. DB 0DDH,?R*8+09H
  258. ENDM
  259. DADY MACRO ?R
  260. DB 0FDH,?R*8+09H
  261. ENDM
  262. INXIX MACRO
  263. DB 0DDH,23H
  264. ENDM
  265. INXIY MACRO
  266. DB 0FDH,23H
  267. ENDM
  268. DCXIX MACRO
  269. DB 0DDH,2BH
  270. ENDM
  271. DCXIY MACRO
  272. DB 0FDH,2BH
  273. ENDM
  274. BIT MACRO ?N,?R
  275. DB 0CBH,?N*8+?R+40H
  276. ENDM
  277. SETB MACRO ?N,?R
  278. DB 0CBH,?N*8+?R+0C0H
  279. ENDM
  280. RES MACRO ?N,?R
  281. DB 0CBH,?N*8+?R+80H
  282. ENDM
  283. BITX MACRO ?N,?D
  284. @CHK ?D
  285. DB 0DDH,0CBH,?D,?N*8+46H
  286. ENDM
  287. BITY MACRO ?N,?D
  288. @CHK ?D
  289. DB 0FDH,0CBH,?D,?N*8+46H
  290. ENDM
  291. SETX MACRO ?N,?D
  292. @CHK ?D
  293. DB 0DDH,0CBH,?D,?N*8+0C6H
  294. ENDM
  295. SETY MACRO ?N,?D
  296. @CHK ?D
  297. DB 0FDH,0CBH,?D,?N*8+0C6H
  298. ENDM
  299. RESX MACRO ?N,?D
  300. @CHK ?D
  301. DB 0DDH,0CBH,?D,?N*8+86H
  302. ENDM
  303. RESY MACRO ?N,?D
  304. @CHK ?D
  305. DB 0FDH,0CBH,?D,?N*8+86H
  306. ENDM
  307. JR MACRO ?N
  308. @CHECK ?N
  309. DB 18H,?DD
  310. ENDM
  311. JMPR MACRO ?N
  312. @CHECK ?N
  313. DB 18H,?DD
  314. ENDM
  315. JRC MACRO ?N
  316. @CHECK ?N
  317. DB 38H,?DD
  318. ENDM
  319. JRNC MACRO ?N
  320. @CHECK ?N
  321. DB 30H,?DD
  322. ENDM
  323. JRZ MACRO ?N
  324. @CHECK ?N
  325. DB 28H,?DD
  326. ENDM
  327. JRNZ MACRO ?N
  328. @CHECK ?N
  329. DB 20H,?DD
  330. ENDM
  331. DJNZ MACRO ?N
  332. @CHECK ?N
  333. DB 10H,?DD
  334. ENDM
  335. PCIX MACRO
  336. DB 0DDH,0E9H
  337. ENDM
  338. PCIY MACRO
  339. DB 0FDH,0E9H
  340. ENDM
  341. RETI MACRO
  342. DB 0EDH,4DH
  343. ENDM
  344. RETN MACRO
  345. DB 0EDH,45H
  346. ENDM
  347. INP MACRO ?R
  348. DB 0EDH,?R*8+40H
  349. ENDM
  350. OUTP MACRO ?R
  351. DB 0EDH,?R*8+41H
  352. ENDM
  353. INI MACRO
  354. DB 0EDH,0A2H
  355. ENDM
  356. INIR MACRO
  357. DB 0EDH,0B2H
  358. ENDM
  359. IND MACRO
  360. DB 0EDH,0AAH
  361. ENDM
  362. INDR MACRO
  363. DB 0EDH,0BAH
  364. ENDM
  365. OUTI MACRO
  366. DB 0EDH,0A3H
  367. ENDM
  368. OUTIR MACRO
  369. DB 0EDH,0B3H
  370. ENDM
  371. OUTD MACRO
  372. DB 0EDH,0ABH
  373. ENDM
  374. OUTDR MACRO
  375. DB 0EDH,0BBH
  376. ENDM
  377. RLCR MACRO ?R
  378. DB 0CBH, 00H + ?R
  379. ENDM
  380. RLCX MACRO ?D
  381. @CHK ?D
  382. DB 0DDH, 0CBH, ?D, 06H
  383. ENDM
  384. RLCY MACRO ?D
  385. @CHK ?D
  386. DB 0FDH, 0CBH, ?D, 06H
  387. ENDM
  388. RALR MACRO ?R
  389. DB 0CBH, 10H+?R
  390. ENDM
  391. RALX MACRO ?D
  392. @CHK ?D
  393. DB 0DDH, 0CBH, ?D, 16H
  394. ENDM
  395. RALY MACRO ?D
  396. @CHK ?D
  397. DB 0FDH, 0CBH, ?D, 16H
  398. ENDM
  399. RRCR MACRO ?R
  400. DB 0CBH, 08H + ?R
  401. ENDM
  402. RRCX MACRO ?D
  403. @CHK ?D
  404. DB 0DDH, 0CBH, ?D, 0EH
  405. ENDM
  406. RRCY MACRO ?D
  407. @CHK ?D
  408. DB 0FDH, 0CBH, ?D, 0EH
  409. ENDM
  410. RARR MACRO ?R
  411. DB 0CBH, 18H + ?R
  412. ENDM
  413. RARX MACRO ?D
  414. @CHK ?D
  415. DB 0DDH, 0CBH, ?D, 1EH
  416. ENDM
  417. RARY MACRO ?D
  418. @CHK ?D
  419. DB 0FDH, 0CBH, ?D, 1EH
  420. ENDM
  421. SLAR MACRO ?R
  422. DB 0CBH, 20H + ?R
  423. ENDM
  424. SLAX MACRO ?D
  425. @CHK ?D
  426. DB 0DDH, 0CBH, ?D, 26H
  427. ENDM
  428. SLAY MACRO ?D
  429. @CHK ?D
  430. DB 0FDH, 0CBH, ?D, 26H
  431. ENDM
  432. SRAR MACRO ?R
  433. DB 0CBH, 28H+?R
  434. ENDM
  435. SRAX MACRO ?D
  436. @CHK ?D
  437. DB 0DDH, 0CBH, ?D, 2EH
  438. ENDM
  439. SRAY MACRO ?D
  440. @CHK ?D
  441. DB 0FDH, 0CBH, ?D, 2EH
  442. ENDM
  443. SRLR MACRO ?R
  444. DB 0CBH, 38H + ?R
  445. ENDM
  446. SRLX MACRO ?D
  447. @CHK ?D
  448. DB 0DDH, 0CBH, ?D, 3EH
  449. ENDM
  450. SRLY MACRO ?D
  451. @CHK ?D
  452. DB 0FDH, 0CBH, ?D, 3EH
  453. ENDM
  454. RLD MACRO
  455. DB 0EDH, 6FH
  456. ENDM
  457. RRD MACRO
  458. DB 0EDH, 67H
  459. ENDM
  460.