home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume5 / z80ad / part01 next >
Encoding:
Internet Message Format  |  1989-02-03  |  49.4 KB

  1. Path: xanth!nic.MR.NET!hal!ncoast!allbery
  2. From: bownesrm@beowulf.UUCP (Keptin Comrade Dr. Bob)
  3. Newsgroups: comp.sources.misc
  4. Subject: v05i086: Z80 Assembler/Disassembler part 1 of 3
  5. Message-ID: <1124@beowulf.UUCP>
  6. Date: 19 Dec 88 01:06:26 GMT
  7. Sender: allbery@ncoast.UUCP
  8. Reply-To: bownesrm@beowulf.UUCP (Keptin Comrade Dr. Bob)
  9. Organization: Reality Central
  10. Lines: 1931
  11. Approved: allbery@ncoast.UUCP
  12.  
  13. Posting-number: Volume 5, Issue 86
  14. Submitted-by: "Keptin Comrade Dr. Bob" <bownesrm@beowulf.UUCP>
  15. Archive-name: z80ad/part01
  16.  
  17. [Cross-assembler runs on UNIX, outputs Intel hex records.  I suspect from the
  18. memory-as-file code that you need a demand-paged system to use this.  ++bsa]
  19.  
  20.     This is a Z80 assembler and disassembler written by someone else to run
  21. under UNIX. It should be straightforward, though the doc's are a little
  22. sparse. Best of luck,
  23.             Bob
  24.  
  25.  
  26. -------------------------- CUT HERE -------------------------------->8 Snip!!
  27. #!/bin/sh
  28. # shar:    Shell Archiver  (v1.12)
  29. #
  30. #  if this archive has been broken into several parts,
  31. #  DO NOT combine them, unpack them in order
  32. #
  33. #    Run the following text with /bin/sh to create:
  34. #      zmac/Makefile
  35. #      zmac/memcpy.c
  36. #      zmac/mio.c
  37. #      zmac/serial.hex
  38. #      zmac/serial.z
  39. #      zmac/zdis.1
  40. #      zmac/zdis.c
  41. #      zmac/zmac.1
  42. #      zmac/zmac.y
  43. #
  44. if test -r ._seq_
  45. then echo "Must unpack archives in sequence!"
  46.      next=`cat ._seq_`; echo "Please unpack part $next next"
  47.      exit 1; fi
  48. sed 's/^X//' << 'SHAR_EOF' > zmac/Makefile
  49. X# Makefile to make z80 macro assembler.
  50. XCFLAGS =
  51. X
  52. Xall:    zmac zdis
  53. X
  54. Xzmac:    y.tab.o mio.o
  55. X    cc $(CFLAGS) -o zmac y.tab.o mio.o -lsx
  56. X
  57. Xy.tab.c: zmac.y
  58. X    yacc zmac.y
  59. X
  60. Xzdis:    zdis.o
  61. X    cc $(CFLAGS) -o zdis zdis.o
  62. X
  63. Xinstall:
  64. X    install -s zmac /usr/local/bin
  65. X    install -s zdis /usr/local/bin
  66. X
  67. Xinstall_man:
  68. X    cp zmac.1 /usr/man/manl/zmac.l
  69. X    cp zdis.1 /usr/man/manl/zdis.l
  70. X
  71. Xclean:
  72. X    rm -f zdis.o zmac.o mio.o y.tab.c y.tab.o a.out core
  73. X
  74. Xshar: zmac.shar.1 zmac.shar.2
  75. X
  76. Xzmac.shar.1: Makefile zmac.y mio.c zmac.1 zdis.1
  77. X    shar -vc Makefile zmac.y mio.c zmac.1 zdis.1 > zmac.shar.1
  78. X
  79. Xzmac.shar.2: zdis.c serial.z serial.hex
  80. X    shar -vc zdis.c serial.z serial.hex > zmac.shar.2
  81. SHAR_EOF
  82. chmod 0755 zmac/Makefile
  83. sed 's/^X//' << 'SHAR_EOF' > zmac/memcpy.c
  84. X/*
  85. X * memcpy - copy bytes
  86. X */
  87. X
  88. Xint *
  89. Xmemcpy(dst, src, size)
  90. Xint * dst;
  91. Xint * src;
  92. Xint size;
  93. X{
  94. X    register char *d;
  95. X    register  char *s;
  96. X    register int n;
  97. X
  98. X    if (size <= 0)
  99. X        return(dst);
  100. X
  101. X    s = src;
  102. X    d = dst;
  103. X    if (s <= d && s + (size-1) >= d) {
  104. X        /* Overlap, must copy right-to-left. */
  105. X        s += size-1;
  106. X        d += size-1;
  107. X        for (n = size; n > 0; n--)
  108. X            *d-- = *s--;
  109. X    } else
  110. X        for (n = size; n > 0; n--)
  111. X            *d++ = *s++;
  112. X
  113. X    return(dst);
  114. X}
  115. SHAR_EOF
  116. chmod 0644 zmac/memcpy.c
  117. sed 's/^X//' << 'SHAR_EOF' > zmac/mio.c
  118. X/*
  119. X * mio.c - Colin Kelley  1-18-87
  120. X *   routines to emulate temporary file handling with memory instead
  121. X *
  122. X */
  123. X
  124. X#include <stdio.h>
  125. X#define MALLOC_SIZE 10000
  126. X
  127. Xunsigned char *malloc(), *realloc();
  128. X
  129. Xstatic unsigned char *mhead;        /* pointer to start of malloc()d area */
  130. Xstatic unsigned char *mend;            /* pointer to current (just beyond) EOF*/
  131. Xstatic unsigned char *mptr;            /* pointer to current position */
  132. Xstatic unsigned int msize;            /* size of chunk mhead points to */
  133. X
  134. XFILE *
  135. Xmfopen(filename,mode)
  136. Xchar *filename,*mode;
  137. X{
  138. X    if ((mhead = malloc(MALLOC_SIZE)) == 0) {
  139. X        msize = 0;
  140. X        return (0);
  141. X    }
  142. X    msize = MALLOC_SIZE;
  143. X    mend = mptr = mhead;
  144. X    return ((FILE *)1);                /* not used */
  145. X}
  146. X
  147. Xmfclose(f)
  148. XFILE *f;
  149. X{
  150. X    if (mhead) {
  151. X        free(mhead);
  152. X        return (0);
  153. X    }
  154. X    else
  155. X        return (-1);
  156. X}
  157. X
  158. Xunsigned int
  159. Xmfputc(c,f)
  160. Xunsigned int c;
  161. XFILE *f;
  162. X{
  163. Xregister unsigned char *p;
  164. X    while (mptr >= mhead + msize) {
  165. X        if ((p = realloc(mhead,msize+MALLOC_SIZE)) == (unsigned char *)-1) {
  166. X            fputs("mio: out of memory\n",stderr);
  167. X            return (-1);
  168. X        }
  169. X        else {
  170. X            msize += MALLOC_SIZE;
  171. X            mptr = (unsigned char *) (p + (unsigned int)(mptr - mhead));
  172. X            mhead = p;
  173. X        }
  174. X    }
  175. X    *mptr = c & 255;
  176. X    mend = ++mptr;
  177. X    return c;
  178. X}
  179. X
  180. Xunsigned int
  181. Xmfgetc(f)
  182. XFILE *f;
  183. X{
  184. X    if (mptr >= mend)        /* no characters left */
  185. X        return (-1);
  186. X    else
  187. X        return (*mptr++);
  188. X}
  189. X
  190. Xmfseek(f,loc,origin)
  191. XFILE *f;
  192. Xlong loc;
  193. Xint origin;
  194. X{
  195. X    if (origin != 0) {
  196. X        fputs("mseek() only implemented with 0 origin",stderr);
  197. X        return (-1);
  198. X    }
  199. X    mptr = mhead + loc;
  200. X    return (0);
  201. X}
  202. X
  203. Xmfread(ptr, size, nitems,f)
  204. Xchar *ptr;
  205. Xunsigned int size, nitems;
  206. XFILE *f;
  207. X{
  208. Xregister unsigned int i = 0;
  209. X    while (i < nitems) {
  210. X        if ((mptr + size) > mend)
  211. X            break;
  212. X        bcopy(mptr,ptr,size);
  213. X        ptr += size;
  214. X        mptr += size;
  215. X        i++;
  216. X    }
  217. X    return (i);
  218. X}
  219. X
  220. Xmfwrite(ptr, size, nitems, f)
  221. Xchar *ptr;
  222. Xint size, nitems;
  223. XFILE *f;
  224. X{
  225. Xregister unsigned int i = 0;
  226. Xregister unsigned char *p;
  227. X    while (i < nitems) {
  228. X        while (mptr + size >= mhead + msize) {
  229. X            if ((p = realloc(mhead,msize+MALLOC_SIZE)) == (unsigned char *)-1){
  230. X                fputs("mio: out of memory\n",stderr);
  231. X                return (-1);
  232. X            }
  233. X            else {
  234. X                msize += MALLOC_SIZE;
  235. X                mptr = (unsigned char *) (p + (unsigned int)(mptr - mhead));
  236. X                mhead = p;
  237. X            }
  238. X        }
  239. X        if ((mptr + size) > mhead + msize)
  240. X            break;
  241. X        bcopy(ptr,mend,size);
  242. X        ptr += size;
  243. X        mend += size;
  244. X        mptr = mend;
  245. X    }
  246. X    return (i);
  247. X}
  248. SHAR_EOF
  249. chmod 0755 zmac/mio.c
  250. sed 's/^X//' << 'SHAR_EOF' > zmac/serial.hex
  251. X:10000000C30F0073657269616C2E7A20312E38310E
  252. X:10001000FFFFCD1001CD7F01CD9801DD210BFF3A0F
  253. X:1000200000FFE6803E11C4F901DB054FDB0647CB3C
  254. X:10003000612808CD7102CD980118EECD4900CDB0F0
  255. X:1000400000CDDB00CDEB0018E0CB41C8DD2105FF82
  256. X:100050003A00FF67E640DB002806CDF901C3E20263
  257. X:10006000E67FFE20301DFE0D20063E013201FFC955
  258. X:10007000CB7CC8210FFFFE132003CBC6C9FE11C0E5
  259. X:10008000CB86C9CBEFFE6C200ACD40023202FF3294
  260. X:1000900003FFC9FE6D2007CD40023204FFC9FE7385
  261. X:1000A0002008CD40022F3200FFC9CD0A02C3E20270
  262. X:1000B000CB70C0DD210BFFDD7E02C603D83A00FF06
  263. X:1000C000E620DB80C2F901CD20023A02FFA7C82159
  264. X:1000D00003FF35C0773A04FFC3F901CB78C8DD21AF
  265. X:1000E00005FFCDDD01D8D380C3B402CB69C8DD21C3
  266. X:1000F0000BFF3A00FFE6802005CB60C8180B3A10D2
  267. X:10010000FFA72005DDCB0446C0CDDD01D8D300C953
  268. X:10011000DB4047DB40B820FED12100FC06FF4870E1
  269. X:1001200005237CB520F92100FC7EA9280C47E60FA9
  270. X:1001300028FE78E6F028FE18FE0D237CB520EAD5CF
  271. X:10014000DB03A720FE3E80D303DB03FE8020FE3EC0
  272. X:1001500003D300DB00D60320FED301DB01A720FE82
  273. X:10016000DB03D68020FED303DB03A720FE3E07D3AC
  274. X:1001700003DB03D60720FED301DB01A720FEC9CD98
  275. X:1001800071023E07D303AFD3013E03D304DB06CB9A
  276. X:100190007720FADB80D380C9AFDD2105FFDD770052
  277. X:1001A000DD7701DD77022100FCDD7403DD7704DDFE
  278. X:1001B0007705DD210BFFDD7700DD7701DD7702219B
  279. X:1001C00000FDDD7403DD7704DD77053E013201FFBC
  280. X:1001D0003E0D3204FFAF3202FF3203FFC9DD7E0560
  281. X:1001E000DD360500A7C0DDBE0237C8DD3502DD6E95
  282. X:1001F00001DD6603DD3401B6C9DD340228FEDD66AB
  283. X:1002000003DD6E0077DD3400A7C9CD5D022101FF5B
  284. X:10021000CB4628068787878777C9B63601C3F90199
  285. X:100220005F1F1F1F1FE60FFE0A3802C607C630CD2C
  286. X:10023000F9017BE60FFE0A3802C607C630C3F90192
  287. X:10024000DB05CB4728FADB00CD5D02878787876710
  288. X:10025000DB05CB4728FADB00CD5D02B4C9CBEFD676
  289. X:1002600030380CFE0AD8D627FE0A3803FE10D8AF65
  290. X:10027000C9DB03F680D303DB403200FFE60F8721A2
  291. X:1002800094025F1600197ED300237ED301DB03E6C0
  292. X:100290007FD303C905000A0014001B0028003500A5
  293. X:1002A00050006B00A0004001800200059405D106BB
  294. X:1002B000000A000FDD2105FFDDCB0446C83E28DD26
  295. X:1002C000BE02D83A00FFCB7F280DCB6FC02110FFB4
  296. X:1002D0007EA7C036111806DB04CBC7D304DDCB04E0
  297. X:1002E00086C9DD2105FFDDCB0446C03ED8DDBE0258
  298. X:1002F000D03A00FFCB7F280DCB6FC02110FF7EA727
  299. X:10030000C036131806DB04CB87D304DDCB04C6C983
  300. X:0000000000
  301. SHAR_EOF
  302. chmod 0755 zmac/serial.hex
  303. sed 's/^X//' << 'SHAR_EOF' > zmac/serial.z
  304. X
  305. X; SCCS flags:        serial.z    1.8    9/21/82
  306. X
  307. X
  308. X;
  309. X; This program is a quick and dirty controller program
  310. X; for the simple Z80 serial interface card for the Red
  311. X; display controller.
  312. X;
  313. X; It uses two 256 byte buffers to buffer data to and from the
  314. X; host. This helps make up for the obnoxiously slow rs232.
  315. X;
  316. X; History:
  317. X; jrp    3-18-82    v1.0 Initial version by John Providenza.
  318. X;
  319. X; jrp    3-22-82    v1.1 Added code to send a Xon (Cntrlq) at reset
  320. X;        if the dip switch is set to Xon/Xoff mode.
  321. X;
  322. X; jrp    4-20-82    v1.2 Added SCCS flags as comment in header and
  323. X;        as a "ascii" block after a reset jmp.
  324. X;
  325. X; jrp    4-20-82    v1.3 Changed crt modem flags to RLSD = Out Buf Full,
  326. X;        RI = In Buf Full.
  327. X;
  328. X; jrp    4-21-82    v1.4 Added diagnostic code to test ram, switches, and
  329. X;        uart.
  330. X;
  331. X; jrp    4-30-82    v1.5 Cleaned up some code, added some more comments.
  332. X;
  333. X; jrp    5-27-82    v1.6 Fixed bug that caused output buffer to overflow
  334. X;        in Hex mode.
  335. X;
  336. X; jrp    6-22-82    v1.7 Added 'end of message' command in hex mode.
  337. X;        This is active only in hex mode and only if a
  338. X;        non 0 byte count is specified (0 is default)
  339. X;        'l' is used to specify byte count, 'm' specifies
  340. X;        the eom char. Both expect 2 hex digits following
  341. X;        to specify the apropriate parameter.
  342. X;
  343. X; jrp    8-23-82    v1.8 Added code to allow send/recv in different modes.
  344. X;        Thus the host can send in raw mode and receive in hex
  345. X;        mode, allowing CntrlS/Q flow control.
  346. X;        Also added 's' command in 'hex' mode to reset the SWTCH
  347. X;        settings.
  348. X;        Also added break detect to reset the mode/baud to the
  349. X;        switch settings.
  350. X;            switch    dIN    dOUT    Flow Control.
  351. X;            7 6 5
  352. X;            0 0 0    raw    raw    No flow control.
  353. X;            0 0 1    raw    hex    Xon/Xoff sent to host.
  354. X;            0 1 0    hex    raw    Xon/Xoff received from host.
  355. X;            0 1 1    hex    hex    Full Xon/Xoff.
  356. X;            1 0 0    raw    raw    Full modem flow control.
  357. X;            1 0 1    raw    hex    Full modem flow control.
  358. X;            1 1 0    hex    raw    Full modem flow control.
  359. X;            1 1 1    hex    hex    Full modem flow control.
  360. X;
  361. X; SCCS flags:    serial.z 1.8 9/21/82
  362. X    eject    1
  363. X; Serial port equates.
  364. XSerial    equ    00H    ; base address of 8250 controller.
  365. XIer    equ    01H    ; Interrupt Enable Reg
  366. XIir    equ    02H    ; Interrupt Ident Reg
  367. XLcr    equ    03H    ; Line Control Reg
  368. XMcr    equ    04H    ; Modem Control Reg
  369. XLsr    equ    05H    ; Line Status Reg
  370. XMsr    equ    06H    ; Modem Status Reg
  371. X
  372. X; These equates define bits in the Msr.
  373. XDsrIn    equ    05    ; Data Set Ready input
  374. XCtsIn    equ    04    ; Clear to Send input
  375. XInMt    equ    06    ; No data from display controller = 1 (Ring In)
  376. XOutMt    equ    07    ; Crt ready for next byte = 1 (Rcvd Line Signal Detct)
  377. X
  378. X; These equates define bits in the Lsr
  379. XDataRdy    equ    00    ; Input data ready.
  380. XBreak    equ    04    ; Break condition.
  381. XXmitMt    equ    05    ; Xmitter buffer empty.
  382. X
  383. X; These equates define bits in the Mcr
  384. XDtrOut    equ    00    ; Data terminal ready output.
  385. XRtsOut    equ    01    ; Request to send output.
  386. X
  387. X; Misc definitions.
  388. XCrt    equ    80H    ; Parallel port to display controller.
  389. XBaud    equ    40H    ; Switches port.
  390. XStack    equ    0FFFFH
  391. X
  392. X; Mailbox equates.
  393. XHead    equ    0
  394. XTail    equ    1
  395. XCount    equ    2
  396. XBase    equ    3
  397. XStatus    equ    4
  398. XUnChar    equ    5    ; Should be used only for CntrlS and CntrlQ
  399. X
  400. X; Equates for the Queue status byte
  401. XXmitOff    equ    00        ; xmitter is disabled.
  402. X
  403. X; Baud/Switch equates.
  404. XBmask    equ    0FH
  405. XRawout    equ    020H
  406. XRObit    equ    5
  407. XRawin    equ    040H
  408. XRIbit    equ    6
  409. XXon    equ    080H
  410. XXonbit    equ    7
  411. X
  412. X; Some ASCII character equates.
  413. XCntrlS    equ    19        ; Xoff
  414. XCntrlQ    equ    17        ; Xon
  415. XCr    equ    13        ; Carriage return.
  416. X    eject    1
  417. X    ORG    0FC00H
  418. XRAM_START:
  419. X; Variable declarations
  420. X; Ram is in the top 1K of memory.
  421. X
  422. X; Queues.
  423. X; These are the actual data buffers. The only routine that should use
  424. X; these labels re INIT_V to set the mailbox data pointers up.
  425. X; All I/O is via GETQ and PUTQ routines.
  426. XINBUF:    block    256        ; input buffer q.
  427. XOUTBUF:    block    256        ; output buffer q.
  428. X
  429. XUNUSED:    block    256        ; unused ram
  430. X
  431. X; Now the ram for variables and stack.
  432. X
  433. XSWTCH:    block    1        ; Current baud/switches
  434. X
  435. X; Variable for the H_to_Q routine
  436. X; It holds the upper nibble of hex until the lower one arrives.
  437. X; Bit 0 = 1 for empty, 0 for upper nibble full.
  438. XH_to_QV:    block    1
  439. X
  440. X; End of message variables.
  441. XMESS_LEN:    block    1    ; How long messages are.
  442. XMESS_CNT:    block    1    ; Number of chars in current message.
  443. XEOM_CHAR:    block    1    ; The end of message char.
  444. X
  445. X
  446. X; In and Out queues variables.
  447. XINBOX:    block    6
  448. XOUTBOX:    block    6
  449. X    eject    1
  450. X; Mainline loop.
  451. X    ORG    0
  452. X    JP    RESET        ; Jmp to the code
  453. X                ; Put in ID string
  454. X    ascii    'serial.z 1.8'
  455. XRESET:
  456. X    LD    SP, Stack
  457. X    CALL    CHECK        ; Check the hardware out.
  458. X    CALL    INIT_HW        ; Init the hardware devices.
  459. X    CALL    INIT_V        ; Init the variables.
  460. X
  461. X    LD    IX,OUTBOX    ; Point to the outbox.
  462. X    LD    A,(SWTCH)    ; Check if we're in Xon/Xoff mode.
  463. X    AND    Xon
  464. X    LD    A,Cntrlq    ; Send a Xon to host if we're in that mode
  465. X    CALL    NZ,PUTQ
  466. X
  467. X; Now loop checking for data available from host or display controller.
  468. X; Also check if we can send data to them.
  469. XLOOP:
  470. X    IN    A,(Lsr)        ; Get the line status.
  471. X    LD    C,A
  472. X    IN    A,(Msr)        ; Get the modem status.
  473. X    LD    B,A        ; and save it
  474. X                ; B = Msr, C = Lsr.
  475. X; Check for break condition.
  476. X    BIT    Break,C        ; test the bit in the Lsr
  477. X    JR    Z,LOOP1
  478. X    CALL    SETBAUD        ; reset the SWTCH variable.
  479. X    CALL    INIT_V        ; reset all the variables
  480. X    JR    LOOP
  481. XLOOP1:
  482. X    CALL    HOST_IN
  483. X    CALL    DISP_IN
  484. X    CALL    DISP_OUT
  485. X    CALL    HOST_OUT
  486. X    JR    LOOP
  487. X    eject    1
  488. X; Check if data is ready from host.
  489. XHOST_IN:
  490. X    BIT    DataRdy,C    ; Data ready?
  491. X    RET    Z        ; Ret if no.
  492. X                ; Handle a byte from the Host.
  493. X    LD    IX,INBOX    ; data will go into the Input Q.
  494. X    LD    A,(SWTCH)    ; check for Raw or encoded mode.
  495. X    LD    H,A
  496. X    AND    Rawin        ; NZ for Raw mode
  497. X    IN    A,(Serial)    ; get the data byte.
  498. X    JR    Z,HEX_IN    ; Jmp if hex data in.
  499. XRAW_IN:                ; Process Raw data
  500. X    CALL    PUTQ
  501. X    JP    STOP_IN        ; stop the input if needed.
  502. XHEX_IN:
  503. X    AND    7FH        ; Kill any parity bit.
  504. X    CP    ' '        ; Printable ASCII?
  505. X    JR    NC,PRINT    ; Jmp if yes
  506. X; Control character.
  507. X    CP    Cr        ; Carriage Ret?
  508. X    JR    NZ,IN_FLOW    ; Jp if no.
  509. X    LD    A,1        ; Set the H_to_Q variable to empty.
  510. X    LD    (H_to_QV),A    ; This flushes any partially assembled byte.
  511. X    RET            ; Done
  512. X; Test for Xon/Xoff commands.
  513. XIN_FLOW:
  514. X    BIT    Xonbit,H    ; Are we sensitive to them?
  515. X    RET    Z        ; Ret if no.
  516. X    LD    HL,OUTBOX+Status    ; Get a pointer to our outbox status.
  517. X    CP    CntrlS        ; Xoff our transmitter?
  518. X    JR    NZ,NOT_XOFF    ; Jmp if no.
  519. XOFF:
  520. X    SET    XmitOff,(HL)
  521. X    RET
  522. XNOT_XOFF:
  523. X    CP    CntrlQ        ; Xon our xmitter?
  524. X    RET    NZ        ; ret if no.
  525. XON:
  526. X    RES    XmitOff,(HL)
  527. X    RET
  528. X; Printable char received from host.
  529. XPRINT:                ; Printable character received in hex mode.
  530. X    SET    5,A        ; Convert to lower case.
  531. X    CP    'l'        ; Message length command?
  532. X    JR    NZ,PRINT1    ; Jmp if no.
  533. X    CALL    GET_HEX        ; Get byte from UART
  534. X    LD    (MESS_LEN),A    ; Set the message length.
  535. X    LD    (MESS_CNT),A    ; Reset the number of chars sent so far.
  536. X    RET
  537. XPRINT1:
  538. X    CP    'm'        ; EOM char set command?
  539. X    JR    NZ,PRINT2
  540. X    CALL    GET_HEX        ; Get byte from UART
  541. X    LD    (EOM_CHAR),A
  542. X    RET
  543. XPRINT2:
  544. X    CP    's'        ; change SWTCH command?
  545. X    JR    NZ,PRINT3
  546. X    CALL    GET_HEX        ; Get byte from UART
  547. X    CPL            ; Toggle them.
  548. X    LD    (SWTCH),A
  549. X    RET
  550. XPRINT3:
  551. X    CALL    H_to_Q        ; Pack the encoded data into bytes.
  552. X    JP    STOP_IN        ; stop the input if needed.
  553. X    eject    1
  554. X; Data ready from controller?
  555. XDISP_IN:
  556. X    BIT    InMt,B        ; data from controller?
  557. X    RET    NZ        ; ret if no.
  558. X    LD    IX,OUTBOX
  559. X    LD    A,(IX+Count)    ; Get the Q count.
  560. X    ADD    A,3        ; Check if Q has room for 3 more bytes.
  561. X    RET    C        ; ret if no
  562. X    LD    A,(SWTCH)    ; check if we need to encode the data.
  563. X    AND    Rawout
  564. X    IN    A,(Crt)        ; get the data from the crt.
  565. X    JP    NZ,PUTQ        ; send the raw data and return.
  566. X; hex data out to host.
  567. X    CALL    B_to_H        ; convert byte to hex format and stick in Q.
  568. X                ; Check if we need to stick an EOM char in.
  569. X    LD    A,(MESS_LEN)    ; Get the length.
  570. X    AND    A
  571. X    RET    Z        ; Zero means no EOM character to be sent.
  572. X    LD    HL,MESS_CNT    ; Point to the counter.
  573. X    DEC    (HL)        ; Time to send a EOM char?
  574. X    RET    NZ        ; Ret if no.
  575. X    LD    (HL),A        ; reset the length.
  576. X    LD    A,(EOM_CHAR)    ; Get the char and stick it in the Q.
  577. X    JP    PUTQ        ; and return when done
  578. X    eject    1
  579. X; Controller ready for data?
  580. XDISP_OUT:
  581. X    BIT    OutMt,B        ; controller ready for data?
  582. X    RET    Z        ; Jmp if no
  583. X    LD    IX,INBOX
  584. X    CALL    GETQ        ; get a byte for controller.
  585. X    RET    C        ; ret if no byte available.
  586. X    OUT    (Crt),A        ; send char to display.
  587. X    JP    STRT_IN        ; re-enable host xmitter if needed.
  588. X    eject    1
  589. X; Host ready for data?
  590. XHOST_OUT:
  591. X    BIT    XmitMt,C    ; Uart xmitter empty?
  592. X    RET    Z        ; ret if no.
  593. X    LD    IX,OUTBOX    ; Get OutBox pointer.
  594. X    LD    A,(SWTCH)    ; Check for Xon mode
  595. X    AND    Xon
  596. X    JR    NZ,H_O_Xon    ; Jp if Xon mode.
  597. X    BIT    CtsIn,B        ; Clear to send?
  598. X    RET    Z        ; ret if no.
  599. X    JR    H_O_Send    ; We are clear to send.
  600. XH_O_Xon:
  601. X    LD    A,(OUTBOX+UnChar)
  602. X    AND    A
  603. X    JR    NZ,H_O_Send    ; Always send an 'UnChar'
  604. X    BIT    XmitOff,(IX+Status)
  605. X    RET    NZ        ; ret if xmitter is disabled.
  606. XH_O_Send:
  607. X    CALL    GETQ
  608. X    RET    C        ; Ret if no character available.
  609. X    OUT    (Serial),A
  610. X    RET
  611. X    eject    1
  612. X; Check the hardware out.
  613. X; Call this routine only after a external reset!!!!
  614. X
  615. XCHECK:
  616. X; Check the baud switch (really crude).
  617. X    IN    A,(BAUD)    ; Get the baud switch.
  618. X    LD    B,A        ; Save it.
  619. X    IN    A,(BAUD)
  620. X    CP    B        ; Same as last time?
  621. XBAD_B:    ; Switch ERROR - Can't read switches twice in a row.
  622. X    JR    NZ,BAD_B    ; Loop if no.
  623. X; Check the ram.
  624. X; Write the complement of the low byte of address out to all ram,
  625. X; then check if it stayed the same.
  626. X; Note that this destroys all ram contents.
  627. X    POP    DE        ; Save the return address in a register.
  628. X    LD    HL,RAM_START    ; Get the first address of ram.
  629. X    LD    B, NOT [RAM_START & 0FFH]
  630. X    LD    C,B        ; Get complement of low address byte.
  631. X                ; Load the ram with the pattern.
  632. XRAM1:
  633. X    LD    (HL),B
  634. X    DEC    B
  635. X    INC    HL
  636. X    LD    A,H        ; Test for done.
  637. X    OR    L
  638. X    JR    NZ,RAM1        ; Loop till all locations written.
  639. X    LD    HL,RAM_START    ; Get the first address of ram.
  640. X; Check if ram agrees with what should be there.
  641. XRAM2:
  642. X    LD    A,(HL)        ; Get the byte.
  643. X    XOR    C        ; Same as its low address byte?
  644. X    JR    Z,RAM6        ; Jmp if yes.
  645. X; Ram error. We have three loops: low bad, high bad, both bad.
  646. X    LD    B,A        ; Save the symptom.
  647. X    AND    0FH        ; Low nibble bad?
  648. XRAM3:    ; Ram ERROR - bad high nibble.
  649. X    JR    Z,RAM3        ; Jmp if no.
  650. X    LD    A,B        ; get the symptom back.
  651. X    AND    0F0H        ; High nibble bad too?
  652. XRAM4:    ; Ram ERROR - bad low nibble.
  653. X    JR    Z,RAM4        ; Loop if error.
  654. XRAM5:    ; Ram ERROR - both nibbles bad.
  655. X    JR    RAM5
  656. XRAM6:
  657. X    DEC    C
  658. X    INC    HL
  659. X    LD    A,H        ; Done?
  660. X    OR    L
  661. X    JR    NZ,RAM2        ; Jmp if no.
  662. X    PUSH    DE        ; Fix the stack back up.
  663. X; Check out the National Semi INS8250 Uart.
  664. X; Since we were reset, Lcr should be zero.
  665. X    IN    A,(Lcr)        ; Get the Line Control reg
  666. X    AND    A
  667. XU0:    ; Uart ERROR - Lcr not reset properly.
  668. X    JR    NZ,U0        ; Loop if error.
  669. X    LD    A,80H
  670. X    OUT    (Lcr),A        ; And set the Divisor access bit.
  671. X    IN    A,(Lcr)        ; Check that it got set.
  672. X    CP    80H        ; Still set?
  673. XU1:    ; Uart ERROR - Lcr won't hold divisor access bit.
  674. X    JR    NZ,U1        ; Loop if error.
  675. X    LD    A,3        ; Try to set 38.4K baud
  676. X    OUT    (Serial),A    ; Ld the divisor.
  677. X    IN    A,(Serial)    ; Test that it loaded OK.
  678. X    SUB    3        ; Check if same (also set A to zero)
  679. XU2:    ; Uart ERROR - unexpected low divisor.
  680. X    JR    NZ,U2        ; Loop if error.
  681. X    OUT    (Ier),A        ; Set high byte to zero
  682. X    IN    A,(Ier)
  683. X    AND    A        ; Still zero?
  684. XU3:    ; Uart ERROR - unexpected high divisor.
  685. X    JR    NZ,U3        ; Loop if no (ie, error).
  686. X    IN    A,(Lcr)        ; Get the Line reg back.
  687. X    SUB    80H        ; Is it the same as before?
  688. XU4:    ; Uart ERROR - unexpected Lcr value after setting divisor.
  689. X    JR    NZ,U4        ; loop if error.
  690. X    OUT    (Lcr),A        ; Turn off divisor access bit.
  691. X    IN    A,(Lcr)        ; Check it.
  692. X    AND    A
  693. XU5:    ; Uart ERROR - Lcr won't reset after setting divisor.
  694. X    JR    NZ,U5
  695. X    LD    A,7
  696. X    OUT    (Lcr),A        ; 8 bits, no parity, 2 stop bits
  697. X    IN    A,(Lcr)
  698. X    SUB    7        ; Test if the same (also set A to zero)
  699. XU6:    ; Uart ERROR - Can't set proper operating Lcr.
  700. X    JR    NZ,U6        ; If we succeed, assume Lcr is Ok.
  701. X    OUT    (Ier),A        ; Disable all 8250 interrupt conditions (set to 0).
  702. X    IN    A,(Ier)
  703. X    AND    A
  704. XU7:    ; Uart ERROR - Can't reset Ier.
  705. X    JR    NZ,U7
  706. X    RET
  707. X    eject    1
  708. X; Init the hardware.
  709. XINIT_HW:
  710. X    CALL    SETBAUD        ; Set the Uart baud
  711. X    LD    A,7
  712. X    OUT    (Lcr),A        ; 8 bits, no parity, 2 stop bits
  713. X    XOR    A        ; Disable all 8250 interrupt conditions.
  714. X    OUT    (Ier),A
  715. X    LD    A,3        ; Dtr, Rts on.
  716. X    OUT    (Mcr),A
  717. X
  718. X; Perform the I/O diagnostic with the controller.
  719. X; Wait for data from controller, then echo it back.
  720. XINITH1:
  721. X    IN    A,(Msr)        ; Check if controller data ready.
  722. X    BIT    InMt,A        ; Ready?
  723. X    JR    NZ,INITH1    ; Jmp if no.
  724. X    IN    A,(Crt)        ; Get the data.
  725. X    OUT    (Crt),A        ; And send it back to controller.
  726. X    RET
  727. X
  728. X
  729. X; Init the variables.
  730. XINIT_V:
  731. X    XOR    A        ; zero A
  732. X
  733. X; Init the Q's
  734. X    LD    IX,INBOX    ; Init the inbox.
  735. X    LD    (IX + Head),A
  736. X    LD    (IX + Tail),A
  737. X    LD    (IX + Count),A
  738. X    LD    HL,INBUF
  739. X    LD    (IX + Base),H
  740. X    LD    (IX + Status),A
  741. X    LD    (IX + UnChar),A
  742. X
  743. X    LD    IX,OUTBOX    ; Init the outbox.
  744. X    LD    (IX + Head),A
  745. X    LD    (IX + Tail),A
  746. X    LD    (IX + Count),A
  747. X    LD    HL,OUTBUF
  748. X    LD    (IX + Base),H
  749. X    LD    (IX + Status),A
  750. X    LD    (IX + UnChar),A
  751. X
  752. X; Init the H_to_Q variable.
  753. X    LD    A,1
  754. X    LD    (H_to_QV),A
  755. X
  756. X; init the 'end of message' stuff
  757. X    LD    A,Cr        ; default r is a carriage return.
  758. X    LD    (EOM_CHAR),A
  759. X    XOR    A
  760. X    LD    (MESS_LEN),A
  761. X    LD    (MESS_CNT),A
  762. X    RET
  763. X    eject    1
  764. X; These routines handle the input and output queues.
  765. X; The Q pointer is passed in IX, result/source in A.
  766. X; Queues must be 256 bytes long. We use only 8 bit
  767. X; arithmetic for Q manipulation.
  768. X; A Q is defined as 6 bytes of status:
  769. X;    Tail    Offset for getting next char
  770. X;    Head    Offset for putting next char
  771. X;    Count    Number of chars in q
  772. X;    Base    High byte of the q origin
  773. X;    Status    Status of Q
  774. X;    UnChar    The 'un_get' char if non-zero
  775. X; and 256 bytes of storage.
  776. X;
  777. X
  778. XGETQ:
  779. X; Get an element from the Q.
  780. X; entry    ix = Q pointer
  781. X; exit    a  = result
  782. X;    ca = set for empty Q, cleared for full Q.
  783. X;    bc & de are unchanged.
  784. X;    hl = garbage
  785. X;
  786. X    LD    A,(IX + UnChar) ; Get the unget char
  787. X    LD    (IX + UnChar),0    ; Set the byte to 0 (empty).
  788. X    AND    A
  789. X    RET    NZ        ; Ret if we got an unget char.
  790. X                ; A == 0 here.
  791. X    CP    (IX + Count)    ; Get the q count
  792. X    SCF
  793. X    RET    Z        ; empty Q return (Count == 0).
  794. X    DEC    (IX + Count)    ; one less item in the Q.
  795. X    LD    L,(IX + Tail)    ; get a pointer to the element in the Q.
  796. X    LD    H,(IX + Base)
  797. X    INC    (IX + Tail)    ; bump the pointer to the next char.
  798. X    OR    (HL)        ; Get the element, and clear the carry.
  799. X    RET
  800. X
  801. X
  802. XPUTQ:
  803. X; Routine to put a char in a Q.
  804. X;entry    ix = pointer to Q structure.
  805. X;    a = char to put.
  806. X;exit    hl = garbage
  807. X;    a, bc & de unchanged.
  808. X;    Ca = 1 for Q full, character discarded.
  809. X;
  810. X    INC    (IX + Count)    ; Bump the Q count.
  811. XQPUT_ERR:
  812. X    JR    Z,QPUT_ERR
  813. XQPUT1:
  814. X    LD    H,(IX + Base)
  815. X    LD    L,(IX + Head)
  816. X    LD    (HL),A        ; Put the char in the Q
  817. X    INC    (IX + Head)
  818. X    AND    A        ; Clear the carry bit
  819. X    RET
  820. X    eject    1
  821. X; These routines pack and unpack bytes into Hex
  822. X; suitable for sending as ASCII over a serial line.
  823. X; H_to_Q takes Hex characters
  824. X; and packs them into 8 bit bytes to send to the display.
  825. X; B_to_H takes bytes from the display and converts them into
  826. X; the Hex character stream.
  827. X;
  828. X; Both routines use Q calls. IX must be set up with the proper
  829. X; Q address.
  830. X;
  831. X;
  832. X
  833. X
  834. X
  835. XH_to_Q:
  836. X;
  837. X; entry    A    = Ascii Hex char (0-9, a-f)
  838. X;    IX    = Q pointer
  839. X; exit    A, Hl    = Garbage
  840. X;    bc, de    = unchanged.
  841. X;    Ca    = 1 if Q too full.
  842. X;
  843. X    CALL    H_to_B        ; convert the character to binary.
  844. X    LD    HL,H_to_QV    ; Point hl to our variable
  845. X    BIT    0,(HL)        ; check if the upper nibble is full.
  846. X    JR    Z,H_SEND    ; Jmp if yes.
  847. X    ADD    A,A        ; Move the nibble to the high 4 bits.
  848. X    ADD    A,A
  849. X    ADD    A,A
  850. X    ADD    A,A
  851. X    LD    (HL),A        ; Save away the high nibble with low nibble = 0.
  852. X    RET
  853. XH_SEND:
  854. X    OR    (HL)        ; Merge in the upper nibble from ram.
  855. X    LD    (HL),1        ; Set the variable to empty.
  856. X    JP    PUTQ        ; Send the byte and return.
  857. X    eject    1
  858. X
  859. X
  860. X
  861. XB_to_H:
  862. X; B_to_H takes the byte in A and splits it into two hex characters
  863. X; to be sent to the Q specified in IX.
  864. X;
  865. X; Entry    A    = byte of data to convert to Hex.
  866. X;    IX    = Q address.
  867. X; Exit    A E Hl    = garbage
  868. X;    D Bc Ix    = unchanged.
  869. X;
  870. X
  871. X    LD    E,A        ; Save the byte
  872. X    RRA            ; Move the upper nibble to low nibble.
  873. X    RRA
  874. X    RRA
  875. X    RRA
  876. X    AND    0Fh        ; Get only the upper nibble.
  877. X    CP    10        ; 0 thru 9?
  878. X    JR    C,B_to_H1    ; Jmp if yes.
  879. X    ADD    A,'A'-'0'-10
  880. XB_to_H1:
  881. X    ADD    A,'0'
  882. X    CALL    PUTQ
  883. X    LD    A,E        ; Get the byte back
  884. X    AND    0Fh        ; Mask for only low nibble.
  885. X    CP    10        ; 0 thru 9?
  886. X    JR    C,B_to_H2    ; Jmp if yes.
  887. X    ADD    A,'A'-'0'-10
  888. XB_to_H2:
  889. X    ADD    A,'0'
  890. X    JP    PUTQ        ; Send and return.
  891. X    eject    1
  892. XGET_HEX:
  893. X; This routine gets two hex characters from the UART and
  894. X; munches them into a byte in A.
  895. X; Entry:    No Params.
  896. X; Exit:     A=byte    H = trash
  897. X;        all others unchanged (except for flags)
  898. X    IN    A,(Lsr)        ; Get the line status
  899. X    BIT    DataRdy,A    ; Data ready from host?
  900. X    JR    Z,GET_HEX    ; Jmp if no.
  901. X    IN    A,(Serial)    ; get the data.
  902. X    CALL    H_to_B        ; convert to binary.
  903. X    ADD    A,A        ; Shift up 4 bits
  904. X    ADD    A,A
  905. X    ADD    A,A
  906. X    ADD    A,A
  907. X    LD    H,A        ; Save in B
  908. XGET_HX1:
  909. X    IN    A,(Lsr)        ; Get the line status
  910. X    BIT    DataRdy,A    ; Data ready from host?
  911. X    JR    Z,GET_HX1    ; Jmp if no.
  912. X    IN    A,(Serial)    ; get the data.
  913. X    CALL    H_to_B        ; convert to binary.
  914. X    OR    H
  915. X    RET            ; A = 2 input chars munched together.
  916. X
  917. X; Convert hex char to binary.
  918. XH_to_B:
  919. X    SET    5,A        ; convert to lower case.
  920. X    SUB    '0'        ; less than 0?
  921. X    JR    C,HB_ERR    ; Jmp if out of bounds.
  922. X    CP    10        ; bigger than 9?
  923. X    RET    C        ; Ret if no (0..9)
  924. X    SUB    'a'-'0'-10    ; try to make it range 10-15
  925. X    CP    10
  926. X    JR    C,HB_ERR    ; Jmp if out of bounds.
  927. X    CP    16
  928. X    RET    C        ; Ret if hex.
  929. XHB_ERR:
  930. X    XOR    A        ; Set to zero.
  931. X    RET
  932. X
  933. X    eject    1
  934. XSETBAUD:
  935. X; This routine reads the BAUD switches and looks the code
  936. X; up in the BTABLE to set the baudrate of the 8250 serial chip.
  937. X;
  938. X; Entry    No parameters
  939. X; exit    A Hl De    = garbage.
  940. X    IN    A,(Lcr)    ; Set the divisor access bit on
  941. X    OR    80H
  942. X    OUT    (Lcr),A
  943. X    IN    A,(Baud)    ; Get the baud rate code
  944. X    LD    (SWTCH),A
  945. X    AND    Bmask        ; Get only the baud specifier bits.
  946. X    ADD    A,A        ; Double it to index into table.
  947. X    LD    HL,BTABLE    ; Index into table to get the divisor
  948. X    LD    E,A
  949. X    LD    D,0
  950. X    ADD    HL,DE
  951. X    LD    A,(HL)        ; Get the low order divisor byte
  952. X    OUT    (Serial),A
  953. X    INC    HL
  954. X    LD    A,(HL)        ; Get the high divisor byte
  955. X    OUT    (Serial+1),A
  956. X    IN    A,(Lcr)    ; Set the divisor access bit off
  957. X    AND    7FH
  958. X    OUT    (Lcr),A
  959. X    RET
  960. X
  961. X; Baud rate look up table
  962. X; Only allow 16 entries.
  963. XBTABLE:
  964. X    WORD    5    ; 38.4 Kbaud
  965. X    WORD    10    ; 19.2
  966. X    WORD    20    ; 9600
  967. X    WORD    27    ; 7200
  968. X    WORD    40    ; 4800
  969. X    WORD    53    ; 3600
  970. X    WORD    80    ; 2400
  971. X    WORD    107    ; 1800
  972. X    WORD    160    ; 1200
  973. X    WORD    320    ; 600
  974. X    WORD    640    ; 300
  975. X    WORD    1280    ; 150
  976. X    WORD    1428    ; 134.5
  977. X    WORD    1745    ; 110
  978. X    WORD    2560    ; 75
  979. X    WORD    3840    ; 50
  980. X    eject    1
  981. X; STRT_IN and STOP_IN are called when the Input Q is may be too full/empty.
  982. X; They check and enable/disable the host xmitter apropriately.
  983. X;
  984. X
  985. XSTRT_IN:
  986. X; Entry    No registers set.
  987. X; Exit    A Ix Hl    = garbage.
  988. X;    Bc De    = unchanged.
  989. X;
  990. X    LD    IX,INBOX    ; Point to the Q.
  991. X    BIT    XmitOff,(IX + Status)    ; Is it off?
  992. X    RET    Z        ; ret if no.
  993. X    LD    A,40        ; Check if we've gone below low water mark.
  994. X    CP    (IX + Count)
  995. X    RET    C        ; Ret if no, Q still too full.
  996. X    LD    A,(SWTCH)    ; get the switch settings.
  997. X    BIT    Xonbit,A
  998. X    JR    Z,STRT_DTR    ; Jmp if rs232 modem mode flow control.
  999. X; Try to use Xon/Xoff control flow methods.
  1000. X    BIT    RObit,A        ; Raw Output mode?
  1001. X    RET    NZ        ; No way to start/stop host xmitter.
  1002. X    LD    HL,OUTBOX+UnChar
  1003. X    LD    A,(HL)        ; Anything in unget spot?
  1004. X    AND    A
  1005. X    RET    NZ        ; Ret if yes.
  1006. X    LD    (HL),CntrlQ    ; 'unget' a control Q.
  1007. X    JR    STRT_END
  1008. X; Set DTR bit on.
  1009. XSTRT_DTR:
  1010. X    IN    A,(Mcr)        ; get the modem controls.
  1011. X    SET    DtrOut,A
  1012. X    OUT    (Mcr),A
  1013. XSTRT_END:
  1014. X    RES    XmitOff,(IX + Status)    ; Mark as enabled.
  1015. X    RET
  1016. X
  1017. X
  1018. XSTOP_IN:
  1019. X; Entry    No registers set.
  1020. X; Exit    A Ix Hl    = garbage.
  1021. X;    Bc De    = unchanged.
  1022. X;
  1023. X    LD    IX,INBOX    ; Point to the Q.
  1024. X    BIT    XmitOff,(IX + Status)    ; Already disabled?
  1025. X    RET    NZ        ; ret if yes.
  1026. X    LD    A,256-40    ; Check if we've gone above high water mark.
  1027. X    CP    (IX + Count)
  1028. X    RET    NC        ; Ret if no, Q still too empty.
  1029. X    LD    A,(SWTCH)
  1030. X    BIT    Xonbit,A    ; test for Xon/Xoff vs. modem flow cntrl.
  1031. X    JR    Z,STP_DTR    ; jmp if rs232 modem mode
  1032. X; try to send an Xoff to the host.
  1033. X    BIT    RObit,A        ; Are we in raw out?
  1034. X    RET    NZ        ; Can't control the host xmitter.
  1035. X    LD    HL,OUTBOX+UnChar
  1036. X    LD    A,(HL)        ; Anything in unget spot?
  1037. X    AND    A
  1038. X    RET    NZ        ; Ret if yes.
  1039. X    LD    (HL),CntrlS    ; 'unget' a control S.
  1040. X    JR    STP_END
  1041. X; Modem mode flow control, set DTR bit off.
  1042. XSTP_DTR:
  1043. X    IN    A,(Mcr)        ; get the modem controls.
  1044. X    RES    DtrOut,A
  1045. X    OUT    (Mcr),A
  1046. XSTP_END:
  1047. X    SET    XmitOff,(IX + Status)    ; Mark as disabled.
  1048. X    RET
  1049. X
  1050. X    END
  1051. SHAR_EOF
  1052. chmod 0755 zmac/serial.z
  1053. sed 's/^X//' << 'SHAR_EOF' > zmac/zdis.1
  1054. X.TH ZDIS l 
  1055. X.SH NAME
  1056. Xzdis \- disassembler for Z80 cross-assembler
  1057. X.SH SYNOPSIS
  1058. Xzdis < infile.hex
  1059. X.SH DESCRIPTION
  1060. X.I Zdis
  1061. Xreads a hex file created by
  1062. X.I zmac
  1063. Xand produces a disassembly on stdout.
  1064. X.SH SEE ALSO
  1065. Xzmac(l)
  1066. X.SH FILES
  1067. XSource is in /usr/local/src/zmac directory.
  1068. X.SH BUGS
  1069. XZdis ignores the program counter field in the hex file.  Instead it assumes
  1070. Xthat the hex file has an ORG of 0.
  1071. X.sp
  1072. XThe man page is incomplete.  If anyone discovers more information about
  1073. Xusing zdis, please consider helping to update the man page.
  1074. SHAR_EOF
  1075. chmod 0755 zmac/zdis.1
  1076. sed 's/^X//' << 'SHAR_EOF' > zmac/zdis.c
  1077. Xchar undefined[] = "undefined";
  1078. X
  1079. Xstruct opcode {
  1080. X    char    *name;
  1081. X    int    args;
  1082. X};
  1083. X
  1084. Xstruct opcode major[256] = {
  1085. X    "nop",            0,        /* 00 */
  1086. X    "ld    bc,%02x%02xh",    2,        /* 01 */
  1087. X    "ld    bc,a",        0,        /* 02 */
  1088. X    "inc    bc",        0,        /* 03 */
  1089. X    "inc    b",        0,        /* 04 */
  1090. X    "dec    b",        0,        /* 05 */
  1091. X    "ld    b,%02xh",    1,        /* 06 */
  1092. X    "rlc    a",        0,        /* 07 */
  1093. X
  1094. X    "ex    af,af'",    0,        /* 08 */
  1095. X    "add    hl,bc",        0,        /* 09 */
  1096. X    "ld    a,(bc)",    0,        /* 0a */
  1097. X    "dec    bc",        0,        /* 0b */
  1098. X    "inc    c",        0,        /* 0c */
  1099. X    "dec    c",        0,        /* 0d */
  1100. X    "ld    c,%02xh",    1,        /* 0e */
  1101. X    "rrc    a",        0,        /* 0f */
  1102. X
  1103. X    "djnz    %02xh",        1,        /* 10 */
  1104. X    "ld    de,%02x%02xh",    2,        /* 11 */
  1105. X    "ld    (de),a",    0,        /* 12 */
  1106. X    "inc    de",        0,        /* 13 */
  1107. X    "inc    d",        0,        /* 14 */
  1108. X    "dec    d",        0,        /* 15 */
  1109. X    "ld    d,%02xh",    1,        /* 16 */
  1110. X    "rla",            0,        /* 17 */
  1111. X
  1112. X    "jr    %02xh",        1,        /* 18 */
  1113. X    "add    hl,de",        0,        /* 19 */
  1114. X    "ld    a,(de)",    0,        /* 1a */
  1115. X    "dec    de",        0,        /* 1b */
  1116. X    "inc    e",        0,        /* 1c */
  1117. X    "dec    e",        0,        /* 1d */
  1118. X    "ld    e,%02xh",    1,        /* 1e */
  1119. X    "rra",            0,        /* 1f */
  1120. X
  1121. X    "jr    nz,%02xh",    1,        /* 20 */
  1122. X    "ld    hl,%02x%02xh",    2,        /* 21 */
  1123. X    "ld    (%02x%02xh),hl",2,        /* 22 */
  1124. X    "inc    hl",        0,        /* 23 */
  1125. X    "inc    h",        0,        /* 24 */
  1126. X    "dec    h",        0,        /* 25 */
  1127. X    "ld    h,%02xh",    1,        /* 26 */
  1128. X    "daa",            0,        /* 27 */
  1129. X
  1130. X    "jr    z,%02xh",    1,        /* 28 */
  1131. X    "add    hl,hl",        0,        /* 29 */
  1132. X    "ld    hl,(%02x%02xh)",2,        /* 2a */
  1133. X    "dec    hl",        0,        /* 2b */
  1134. X    "inc    l",        0,        /* 2c */
  1135. X    "dec    l",        0,        /* 2d */
  1136. X    "ld    l,%02xh",    1,        /* 2e */
  1137. X    "cpl",            0,        /* 2f */
  1138. X
  1139. X    "jr    nc,%02xh",    1,        /* 30 */
  1140. X    "ld    sp,%02x%02xh",    2,        /* 31 */
  1141. X    "ld    (%02x%02xh),a",    2,        /* 32 */
  1142. X    "inc    sp",        0,        /* 33 */
  1143. X    "inc    (hl)",        0,        /* 34 */
  1144. X    "dec    (hl)",        0,        /* 35 */
  1145. X    "ld    (hl),%02xh",    1,        /* 36 */
  1146. X    "scf",            0,        /* 37 */
  1147. X
  1148. X    "jr    c,%02xh",    1,        /* 38 */
  1149. X    "add    hl,sp",        0,        /* 39 */
  1150. X    "ld    a,(%02x%02xh)",    2,        /* 3a */
  1151. X    "dec    sp",        0,        /* 3b */
  1152. X    "inc    a",        0,        /* 3c */
  1153. X    "dec    a",        0,        /* 3d */
  1154. X    "ld    a,%02xh",    1,        /* 3e */
  1155. X    "ccf",            0,        /* 3f */
  1156. X
  1157. X    "ld    b,b",        0,        /* 40 */
  1158. X    "ld    b,c",        0,        /* 41 */
  1159. X    "ld    b,d",        0,        /* 42 */
  1160. X    "ld    b,e",        0,        /* 43 */
  1161. X    "ld    b,h",        0,        /* 44 */
  1162. X    "ld    b,l",        0,        /* 45 */
  1163. X    "ld    b,(hl)",    0,        /* 46 */
  1164. X    "ld    b,a",        0,        /* 47 */
  1165. X
  1166. X    "ld    c,b",        0,        /* 48 */
  1167. X    "ld    c,c",        0,        /* 49 */
  1168. X    "ld    c,d",        0,        /* 4a */
  1169. X    "ld    c,e",        0,        /* 4b */
  1170. X    "ld    c,h",        0,        /* 4c */
  1171. X    "ld    c,l",        0,        /* 4d */
  1172. X    "ld    c,(hl)",    0,        /* 4e */
  1173. X    "ld    c,a",        0,        /* 4f */
  1174. X
  1175. X    "ld    d,b",        0,        /* 50 */
  1176. X    "ld    d,c",        0,        /* 51 */
  1177. X    "ld    d,d",        0,        /* 52 */
  1178. X    "ld    d,e",        0,        /* 53 */
  1179. X    "ld    d,h",        0,        /* 54 */
  1180. X    "ld    d,l",        0,        /* 55 */
  1181. X    "ld    d,(hl)",    0,        /* 56 */
  1182. X    "ld    d,a",        0,        /* 57 */
  1183. X
  1184. X    "ld    e,b",        0,        /* 58 */
  1185. X    "ld    e,c",        0,        /* 59 */
  1186. X    "ld    e,d",        0,        /* 5a */
  1187. X    "ld    e,e",        0,        /* 5b */
  1188. X    "ld    e,h",        0,        /* 5c */
  1189. X    "ld    e,l",        0,        /* 5d */
  1190. X    "ld    e,(hl)",    0,        /* 5e */
  1191. X    "ld    e,a",        0,        /* 5f */
  1192. X
  1193. X    "ld    h,b",        0,        /* 60 */
  1194. X    "ld    h,c",        0,        /* 61 */
  1195. X    "ld    h,d",        0,        /* 62 */
  1196. X    "ld    h,e",        0,        /* 63 */
  1197. X    "ld    h,h",        0,        /* 64 */
  1198. X    "ld    h,l",        0,        /* 65 */
  1199. X    "ld    h,(hl)",    0,        /* 66 */
  1200. X    "ld    h,a",        0,        /* 67 */
  1201. X
  1202. X    "ld    l,b",        0,        /* 68 */
  1203. X    "ld    l,c",        0,        /* 69 */
  1204. X    "ld    l,d",        0,        /* 6a */
  1205. X    "ld    l,e",        0,        /* 6b */
  1206. X    "ld    l,h",        0,        /* 6c */
  1207. X    "ld    l,l",        0,        /* 6d */
  1208. X    "ld    l,(hl)",    0,        /* 6e */
  1209. X    "ld    l,a",        0,        /* 6f */
  1210. X
  1211. X    "ld    (hl),b",    0,        /* 70 */
  1212. X    "ld    (hl),c",    0,        /* 71 */
  1213. X    "ld    (hl),d",    0,        /* 72 */
  1214. X    "ld    (hl),e",    0,        /* 73 */
  1215. X    "ld    (hl),h",    0,        /* 74 */
  1216. X    "ld    (hl),l",    0,        /* 75 */
  1217. X    "halt",            0,        /* 76 */
  1218. X    "ld    (hl),a",    0,        /* 77 */
  1219. X
  1220. X    "ld    a,b",        0,        /* 78 */
  1221. X    "ld    a,c",        0,        /* 79 */
  1222. X    "ld    a,d",        0,        /* 7a */
  1223. X    "ld    a,e",        0,        /* 7b */
  1224. X    "ld    a,h",        0,        /* 7c */
  1225. X    "ld    a,l",        0,        /* 7d */
  1226. X    "ld    a,(hl)",    0,        /* 7e */
  1227. X    "ld    a,a",        0,        /* 7f */
  1228. X
  1229. X    "add    a,b",        0,        /* 80 */
  1230. X    "add    a,c",        0,        /* 81 */
  1231. X    "add    a,d",        0,        /* 82 */
  1232. X    "add    a,e",        0,        /* 83 */
  1233. X    "add    a,h",        0,        /* 84 */
  1234. X    "add    a,l",        0,        /* 85 */
  1235. X    "add    a,(hl)",    0,        /* 86 */
  1236. X    "add    a,a",        0,        /* 87 */
  1237. X
  1238. X    "adc    a,b",        0,        /* 88 */
  1239. X    "adc    a,c",        0,        /* 89 */
  1240. X    "adc    a,d",        0,        /* 8a */
  1241. X    "adc    a,e",        0,        /* 8b */
  1242. X    "adc    a,h",        0,        /* 8c */
  1243. X    "adc    a,l",        0,        /* 8d */
  1244. X    "adc    a,(hl)",    0,        /* 8e */
  1245. X    "adc    a,a",        0,        /* 8f */
  1246. X
  1247. X    "sub    b",        0,        /* 90 */
  1248. X    "sub    c",        0,        /* 91 */
  1249. X    "sub    d",        0,        /* 92 */
  1250. X    "sub    e",        0,        /* 93 */
  1251. X    "sub    h",        0,        /* 94 */
  1252. X    "sub    l",        0,        /* 95 */
  1253. X    "sub    (hl)",        0,        /* 96 */
  1254. X    "sub    a",        0,        /* 97 */
  1255. X
  1256. X    "sbc    a,b",        0,        /* 98 */
  1257. X    "sbc    a,c",        0,        /* 99 */
  1258. X    "sbc    a,d",        0,        /* 9a */
  1259. X    "sbc    a,e",        0,        /* 9b */
  1260. X    "sbc    a,h",        0,        /* 9c */
  1261. X    "sbc    a,l",        0,        /* 9d */
  1262. X    "sbc    a,(hl)",    0,        /* 9e */
  1263. X    "sbc    a,a",        0,        /* 9f */
  1264. X
  1265. X    "and    b",        0,        /* a0 */
  1266. X    "and    c",        0,        /* a1 */
  1267. X    "and    d",        0,        /* a2 */
  1268. X    "and    e",        0,        /* a3 */
  1269. X    "and    h",        0,        /* a4 */
  1270. X    "and    l",        0,        /* a5 */
  1271. X    "and    (hl)",        0,        /* a6 */
  1272. X    "and    a",        0,        /* a7 */
  1273. X
  1274. X    "xor    b",        0,        /* a8 */
  1275. X    "xor    c",        0,        /* a9 */
  1276. X    "xor    d",        0,        /* aa */
  1277. X    "xor    e",        0,        /* ab */
  1278. X    "xor    h",        0,        /* ac */
  1279. X    "xor    l",        0,        /* ad */
  1280. X    "xor    (hl)",        0,        /* ae */
  1281. X    "xor    a",        0,        /* af */
  1282. X
  1283. X    "or    b",        0,        /* b0 */
  1284. X    "or    c",        0,        /* b1 */
  1285. X    "or    d",        0,        /* b2 */
  1286. X    "or    e",        0,        /* b3 */
  1287. X    "or    h",        0,        /* b4 */
  1288. X    "or    l",        0,        /* b5 */
  1289. X    "or    (hl)",        0,        /* b6 */
  1290. X    "or    a",        0,        /* b7 */
  1291. X
  1292. X    "cp    b",        0,        /* b8 */
  1293. X    "cp    c",        0,        /* b9 */
  1294. X    "cp    d",        0,        /* ba */
  1295. X    "cp    e",        0,        /* bb */
  1296. X    "cp    h",        0,        /* bc */
  1297. X    "cp    l",        0,        /* bd */
  1298. X    "cp    (hl)",        0,        /* be */
  1299. X    "cp    a",        0,        /* bf */
  1300. X
  1301. X    "ret    nz",        0,        /* c0 */
  1302. X    "pop    bc",        0,        /* c1 */
  1303. X    "jp    nz,%02x%02xh",    2,        /* c2 */
  1304. X    "jp    %02x%02xh",    2,        /* c3 */
  1305. X    "call    nz,%02x%02xh",    2,        /* c4 */
  1306. X    "push    bc",        0,        /* c5 */
  1307. X    "add    a,%02xh",    1,        /* c6 */
  1308. X    "rst    0",        0,        /* c7 */
  1309. X
  1310. X    "ret    z",        0,        /* c8 */
  1311. X    "ret",            0,        /* c9 */
  1312. X    "jp    z,%02x%02xh",    2,        /* ca */
  1313. X    0,            0,        /* cb */
  1314. X    "call    z,%02x%02xh",    2,        /* cc */
  1315. X    "call    %02x%02xh",    2,        /* cd */
  1316. X    "adc    a,%02xh",    1,        /* ce */
  1317. X    "rst    8",        0,        /* cf */
  1318. X    
  1319. X    "ret    nc",        0,        /* d0 */
  1320. X    "pop    de",        0,        /* d1 */
  1321. X    "jp    nc,%02x%02xh",    2,        /* d2 */
  1322. X    "out    (%02xh),a",    1,        /* d3 */
  1323. X    "call    nc,%02x%02xh",    2,        /* d4 */
  1324. X    "push    de",        0,        /* d5 */
  1325. X    "sub    %02xh",        1,        /* d6 */
  1326. X    "rst    10h",        0,        /* d7 */
  1327. X    
  1328. X    "ret    c",        0,        /* d8 */
  1329. X    "exx",            0,        /* d9 */
  1330. X    "jp    c,%02x%02xh",    2,        /* da */
  1331. X    "in    a,(%02xh)",    1,        /* db */
  1332. X    "call    c,%02x%02xh",    2,        /* dc */
  1333. X    0,            1,        /* dd */
  1334. X    "sbc    a,%02xh",    1,        /* de */
  1335. X    "rst    18h",        0,        /* df */
  1336. X    
  1337. X    "ret    po",        0,        /* e0 */
  1338. X    "pop    hl",        0,        /* e1 */
  1339. X    "jp    po,%02x%02xh",    2,        /* e2 */
  1340. X    "ex    (sp),hl",    0,        /* e3 */
  1341. X    "call    po,%02x%02xh",    2,        /* e4 */
  1342. X    "push    hl",        0,        /* e5 */
  1343. X    "and    %02xh",        1,        /* e6 */
  1344. X    "rst    20h",        0,        /* e7 */
  1345. X    "ret    pe",        0,        /* e8 */
  1346. X    
  1347. X    "jp    (hl)",        0,        /* e9 */
  1348. X    "jp    pe,%02x%02xh",    2,        /* ea */
  1349. X    "ex    de,hl",        0,        /* eb */
  1350. X    "call    pe,%02x%02xh",    2,        /* ec */
  1351. X    0,            2,        /* ed */
  1352. X    "xor    %02xh",        1,        /* ee */
  1353. X    "rst    28h",        0,        /* ef */
  1354. X    
  1355. X    "ret    p",        0,        /* f0 */
  1356. X    "pop    af",        0,        /* f1 */
  1357. X    "jp    p,%02x%02xh",    2,        /* f2 */
  1358. X    "di",            0,        /* f3 */
  1359. X    "call    p,%02x%02xh",    2,        /* f4 */
  1360. X    "push    af",        0,        /* f5 */
  1361. X    "or    %02xh",        1,        /* f6 */
  1362. X    "rst    30h",        0,        /* f7 */
  1363. X    
  1364. X    "ret    m",        0,        /* f8 */
  1365. X    "ld    sp,hl",        0,        /* f9 */
  1366. X    "jp    m,%02x%02xh",    2,        /* fa */
  1367. X    "ei",            0,        /* fb */
  1368. X    "call    m,%02x%02xh",    2,        /* fc */
  1369. X    0,            3,        /* fd */
  1370. X    "cp    %02xh",        1,        /* fe */
  1371. X    "rst    38h",        0,        /* ff */
  1372. X};
  1373. X
  1374. Xstruct opcode minor[4][256] = {
  1375. X                            /* cb */
  1376. X    "rlc    b",        0,        /* cb00 */
  1377. X    "rlc    c",        0,        /* cb01 */
  1378. X    "rlc    d",        0,        /* cb02 */
  1379. X    "rlc    e",        0,        /* cb03 */
  1380. X    "rlc    h",        0,        /* cb04 */
  1381. X    "rlc    l",        0,        /* cb05 */
  1382. X    "rlc    (hl)",        0,        /* cb06 */
  1383. X    "rlc    a",        0,        /* cb07 */
  1384. X    
  1385. X    "rrc    b",        0,        /* cb08 */
  1386. X    "rrc    c",        0,        /* cb09 */
  1387. X    "rrc    d",        0,        /* cb0a */
  1388. X    "rrc    e",        0,        /* cb0b */
  1389. X    "rrc    h",        0,        /* cb0c */
  1390. X    "rrc    l",        0,        /* cb0d */
  1391. X    "rrc    (hl)",        0,        /* cb0e */
  1392. X    "rrc    a",        0,        /* cb0f */
  1393. X    
  1394. X    "rl    b",        0,        /* cb10 */
  1395. X    "rl    c",        0,        /* cb11 */
  1396. X    "rl    d",        0,        /* cb12 */
  1397. X    "rl    e",        0,        /* cb13 */
  1398. X    "rl    h",        0,        /* cb14 */
  1399. X    "rl    l",        0,        /* cb15 */
  1400. X    "rl    (hl)",        0,        /* cb16 */
  1401. X    "rl    a",        0,        /* cb17 */
  1402. X    
  1403. X    "rr    b",        0,        /* cb18 */
  1404. X    "rr    c",        0,        /* cb19 */
  1405. X    "rr    d",        0,        /* cb1a */
  1406. X    "rr    e",        0,        /* cb1b */
  1407. X    "rr    h",        0,        /* cb1c */
  1408. X    "rr    l",        0,        /* cb1d */
  1409. X    "rr    (hl)",        0,        /* cb1e */
  1410. X    "rr    a",        0,        /* cb1f */
  1411. X    
  1412. X    "sla    b",        0,        /* cb20 */
  1413. X    "sla    c",        0,        /* cb21 */
  1414. X    "sla    d",        0,        /* cb22 */
  1415. X    "sla    e",        0,        /* cb23 */
  1416. X    "sla    h",        0,        /* cb24 */
  1417. X    "sla    l",        0,        /* cb25 */
  1418. X    "sla    (hl)",        0,        /* cb26 */
  1419. X    "sla    a",        0,        /* cb27 */
  1420. X    
  1421. X    "sra    b",        0,        /* cb28 */
  1422. X    "sra    c",        0,        /* cb29 */
  1423. X    "sra    d",        0,        /* cb2a */
  1424. X    "sra    e",        0,        /* cb2b */
  1425. X    "sra    h",        0,        /* cb2c */
  1426. X    "sra    l",        0,        /* cb2d */
  1427. X    "sra    (hl)",        0,        /* cb2e */
  1428. X    "sra    a",        0,        /* cb2f */
  1429. X    
  1430. X    undefined,        0,        /* cb30 */
  1431. X    undefined,        0,        /* cb31 */
  1432. X    undefined,        0,        /* cb32 */
  1433. X    undefined,        0,        /* cb33 */
  1434. X    undefined,        0,        /* cb34 */
  1435. X    undefined,        0,        /* cb35 */
  1436. X    undefined,        0,        /* cb36 */
  1437. X    undefined,        0,        /* cb37 */
  1438. X    
  1439. X    "srl    b",        0,        /* cb38 */
  1440. X    "srl    c",        0,        /* cb39 */
  1441. X    "srl    d",        0,        /* cb3a */
  1442. X    "srl    e",        0,        /* cb3b */
  1443. X    "srl    h",        0,        /* cb3c */
  1444. X    "srl    l",        0,        /* cb3d */
  1445. X    "srl    (hl)",        0,        /* cb3e */
  1446. X    "srl    a",        0,        /* cb3f */
  1447. X    
  1448. X    "bit    0,b",        0,        /* cb40 */
  1449. X    "bit    0,c",        0,        /* cb41 */
  1450. X    "bit    0,d",        0,        /* cb42 */
  1451. X    "bit    0,e",        0,        /* cb43 */
  1452. X    "bit    0,h",        0,        /* cb44 */
  1453. X    "bit    0,l",        0,        /* cb45 */
  1454. X    "bit    0,(hl)",    0,        /* cb46 */
  1455. X    "bit    0,a",        0,        /* cb47 */
  1456. X    
  1457. X    "bit    1,b",        0,        /* cb48 */
  1458. X    "bit    1,c",        0,        /* cb49 */
  1459. X    "bit    1,d",        0,        /* cb4a */
  1460. X    "bit    1,e",        0,        /* cb4b */
  1461. X    "bit    1,h",        0,        /* cb4c */
  1462. X    "bit    1,l",        0,        /* cb4d */
  1463. X    "bit    1,(hl)",    0,        /* cb4e */
  1464. X    "bit    1,a",        0,        /* cb4f */
  1465. X    
  1466. X    "bit    2,b",        0,        /* cb50 */
  1467. X    "bit    2,c",        0,        /* cb51 */
  1468. X    "bit    2,d",        0,        /* cb52 */
  1469. X    "bit    2,e",        0,        /* cb53 */
  1470. X    "bit    2,h",        0,        /* cb54 */
  1471. X    "bit    2,l",        0,        /* cb55 */
  1472. X    "bit    2,(hl)",    0,        /* cb56 */
  1473. X    "bit    2,a",        0,        /* cb57 */
  1474. X    
  1475. X    "bit    3,b",        0,        /* cb58 */
  1476. X    "bit    3,c",        0,        /* cb59 */
  1477. X    "bit    3,d",        0,        /* cb5a */
  1478. X    "bit    3,e",        0,        /* cb5b */
  1479. X    "bit    3,h",        0,        /* cb5c */
  1480. X    "bit    3,l",        0,        /* cb5d */
  1481. X    "bit    3,(hl)",    0,        /* cb5e */
  1482. X    "bit    3,a",        0,        /* cb5f */
  1483. X    
  1484. X    "bit    4,b",        0,        /* cb60 */
  1485. X    "bit    4,c",        0,        /* cb61 */
  1486. X    "bit    4,d",        0,        /* cb62 */
  1487. X    "bit    4,e",        0,        /* cb63 */
  1488. X    "bit    4,h",        0,        /* cb64 */
  1489. X    "bit    4,l",        0,        /* cb65 */
  1490. X    "bit    4,(hl)",    0,        /* cb66 */
  1491. X    "bit    4,a",        0,        /* cb67 */
  1492. X    
  1493. X    "bit    5,b",        0,        /* cb68 */
  1494. X    "bit    5,c",        0,        /* cb69 */
  1495. X    "bit    5,d",        0,        /* cb6a */
  1496. X    "bit    5,e",        0,        /* cb6b */
  1497. X    "bit    5,h",        0,        /* cb6c */
  1498. X    "bit    5,l",        0,        /* cb6d */
  1499. X    "bit    5,(hl)",    0,        /* cb6e */
  1500. X    "bit    5,a",        0,        /* cb6f */
  1501. X    
  1502. X    "bit    6,b",        0,        /* cb70 */
  1503. X    "bit    6,c",        0,        /* cb71 */
  1504. X    "bit    6,d",        0,        /* cb72 */
  1505. X    "bit    6,e",        0,        /* cb73 */
  1506. X    "bit    6,h",        0,        /* cb74 */
  1507. X    "bit    6,l",        0,        /* cb75 */
  1508. X    "bit    6,(hl)",    0,        /* cb76 */
  1509. X    "bit    6,a",        0,        /* cb77 */
  1510. X    
  1511. X    "bit    7,b",        0,        /* cb78 */
  1512. X    "bit    7,c",        0,        /* cb79 */
  1513. X    "bit    7,d",        0,        /* cb7a */
  1514. X    "bit    7,e",        0,        /* cb7b */
  1515. X    "bit    7,h",        0,        /* cb7c */
  1516. X    "bit    7,l",        0,        /* cb7d */
  1517. X    "bit    7,(hl)",    0,        /* cb7e */
  1518. X    "bit    7,a",        0,        /* cb7f */
  1519. X    
  1520. X    "res    0,b",        0,        /* cb80 */
  1521. X    "res    0,c",        0,        /* cb81 */
  1522. X    "res    0,d",        0,        /* cb82 */
  1523. X    "res    0,e",        0,        /* cb83 */
  1524. X    "res    0,h",        0,        /* cb84 */
  1525. X    "res    0,l",        0,        /* cb85 */
  1526. X    "res    0,(hl)",    0,        /* cb86 */
  1527. X    "res    0,a",        0,        /* cb87 */
  1528. X    
  1529. X    "res    1,b",        0,        /* cb88 */
  1530. X    "res    1,c",        0,        /* cb89 */
  1531. X    "res    1,d",        0,        /* cb8a */
  1532. X    "res    1,e",        0,        /* cb8b */
  1533. X    "res    1,h",        0,        /* cb8c */
  1534. X    "res    1,l",        0,        /* cb8d */
  1535. X    "res    1,(hl)",    0,        /* cb8e */
  1536. X    "res    1,a",        0,        /* cb8f */
  1537. X    
  1538. X    "res    2,b",        0,        /* cb90 */
  1539. X    "res    2,c",        0,        /* cb91 */
  1540. X    "res    2,d",        0,        /* cb92 */
  1541. X    "res    2,e",        0,        /* cb93 */
  1542. X    "res    2,h",        0,        /* cb94 */
  1543. X    "res    2,l",        0,        /* cb95 */
  1544. X    "res    2,(hl)",    0,        /* cb96 */
  1545. X    "res    2,a",        0,        /* cb97 */
  1546. X    
  1547. X    "res    3,b",        0,        /* cb98 */
  1548. X    "res    3,c",        0,        /* cb99 */
  1549. X    "res    3,d",        0,        /* cb9a */
  1550. X    "res    3,e",        0,        /* cb9b */
  1551. X    "res    3,h",        0,        /* cb9c */
  1552. X    "res    3,l",        0,        /* cb9d */
  1553. X    "res    3,(hl)",    0,        /* cb9e */
  1554. X    "res    3,a",        0,        /* cb9f */
  1555. X    
  1556. X    "res    4,b",        0,        /* cba0 */
  1557. X    "res    4,c",        0,        /* cba1 */
  1558. X    "res    4,d",        0,        /* cba2 */
  1559. X    "res    4,e",        0,        /* cba3 */
  1560. X    "res    4,h",        0,        /* cba4 */
  1561. X    "res    4,l",        0,        /* cba5 */
  1562. X    "res    4,(hl)",    0,        /* cba6 */
  1563. X    "res    4,a",        0,        /* cba7 */
  1564. X    
  1565. X    "res    5,b",        0,        /* cba8 */
  1566. X    "res    5,c",        0,        /* cba9 */
  1567. X    "res    5,d",        0,        /* cbaa */
  1568. X    "res    5,e",        0,        /* cbab */
  1569. X    "res    5,h",        0,        /* cbac */
  1570. X    "res    5,l",        0,        /* cbad */
  1571. X    "res    5,(hl)",    0,        /* cbae */
  1572. X    "res    5,a",        0,        /* cbaf */
  1573. X    
  1574. X    "res    6,b",        0,        /* cbb0 */
  1575. X    "res    6,c",        0,        /* cbb1 */
  1576. X    "res    6,d",        0,        /* cbb2 */
  1577. X    "res    6,e",        0,        /* cbb3 */
  1578. X    "res    6,h",        0,        /* cbb4 */
  1579. X    "res    6,l",        0,        /* cbb5 */
  1580. X    "res    6,(hl)",    0,        /* cbb6 */
  1581. X    "res    6,a",        0,        /* cbb7 */
  1582. X    
  1583. X    "res    7,b",        0,        /* cbb8 */
  1584. X    "res    7,c",        0,        /* cbb9 */
  1585. X    "res    7,d",        0,        /* cbba */
  1586. X    "res    7,e",        0,        /* cbbb */
  1587. X    "res    7,h",        0,        /* cbbc */
  1588. X    "res    7,l",        0,        /* cbbd */
  1589. X    "res    7,(hl)",    0,        /* cbbe */
  1590. X    "res    7,a",        0,        /* cbbf */
  1591. X    
  1592. X    "set    0,b",        0,        /* cbc0 */
  1593. X    "set    0,c",        0,        /* cbc1 */
  1594. X    "set    0,d",        0,        /* cbc2 */
  1595. X    "set    0,e",        0,        /* cbc3 */
  1596. X    "set    0,h",        0,        /* cbc4 */
  1597. X    "set    0,l",        0,        /* cbc5 */
  1598. X    "set    0,(hl)",    0,        /* cbc6 */
  1599. X    "set    0,a",        0,        /* cbc7 */
  1600. X    
  1601. X    "set    1,b",        0,        /* cbc8 */
  1602. X    "set    1,c",        0,        /* cbc9 */
  1603. X    "set    1,d",        0,        /* cbca */
  1604. X    "set    1,e",        0,        /* cbcb */
  1605. X    "set    1,h",        0,        /* cbcc */
  1606. X    "set    1,l",        0,        /* cbcd */
  1607. X    "set    1,(hl)",    0,        /* cbce */
  1608. X    "set    1,a",        0,        /* cbcf */
  1609. X    
  1610. X    "set    2,b",        0,        /* cbd0 */
  1611. X    "set    2,c",        0,        /* cbd1 */
  1612. X    "set    2,d",        0,        /* cbd2 */
  1613. X    "set    2,e",        0,        /* cbd3 */
  1614. X    "set    2,h",        0,        /* cbd4 */
  1615. X    "set    2,l",        0,        /* cbd5 */
  1616. X    "set    2,(hl)",    0,        /* cbd6 */
  1617. X    "set    2,a",        0,        /* cbd7 */
  1618. X    
  1619. X    "set    3,b",        0,        /* cbd8 */
  1620. X    "set    3,c",        0,        /* cbd9 */
  1621. X    "set    3,d",        0,        /* cbda */
  1622. X    "set    3,e",        0,        /* cbdb */
  1623. X    "set    3,h",        0,        /* cbdc */
  1624. X    "set    3,l",        0,        /* cbdd */
  1625. X    "set    3,(hl)",    0,        /* cbde */
  1626. X    "set    3,a",        0,        /* cbdf */
  1627. X    
  1628. X    "set    4,b",        0,        /* cbe0 */
  1629. X    "set    4,c",        0,        /* cbe1 */
  1630. X    "set    4,d",        0,        /* cbe2 */
  1631. X    "set    4,e",        0,        /* cbe3 */
  1632. X    "set    4,h",        0,        /* cbe4 */
  1633. X    "set    4,l",        0,        /* cbe5 */
  1634. X    "set    4,(hl)",    0,        /* cbe6 */
  1635. X    "set    4,a",        0,        /* cbe7 */
  1636. X    
  1637. X    "set    5,b",        0,        /* cbe8 */
  1638. X    "set    5,c",        0,        /* cbe9 */
  1639. X    "set    5,d",        0,        /* cbea */
  1640. X    "set    5,e",        0,        /* cbeb */
  1641. X    "set    5,h",        0,        /* cbec */
  1642. X    "set    5,l",        0,        /* cbed */
  1643. X    "set    5,(hl)",    0,        /* cbee */
  1644. X    "set    5,a",        0,        /* cbef */
  1645. X    
  1646. X    "set    6,b",        0,        /* cbf0 */
  1647. X    "set    6,c",        0,        /* cbf1 */
  1648. X    "set    6,d",        0,        /* cbf2 */
  1649. X    "set    6,e",        0,        /* cbf3 */
  1650. X    "set    6,h",        0,        /* cbf4 */
  1651. X    "set    6,l",        0,        /* cbf5 */
  1652. X    "set    6,(hl)",    0,        /* cbf6 */
  1653. X    "set    6,a",        0,        /* cbf7 */
  1654. X    
  1655. X    "set    7,b",        0,        /* cbf8 */
  1656. X    "set    7,c",        0,        /* cbf9 */
  1657. X    "set    7,d",        0,        /* cbfa */
  1658. X    "set    7,e",        0,        /* cbfb */
  1659. X    "set    7,h",        0,        /* cbfc */
  1660. X    "set    7,l",        0,        /* cbfd */
  1661. X    "set    7,(hl)",    0,        /* cbfe */
  1662. X    "set    7,a",        0,        /* cbff */
  1663. X                            /* dd */
  1664. X    undefined,        0,        /* dd00 */
  1665. X    undefined,        0,        /* dd01 */
  1666. X    undefined,        0,        /* dd02 */
  1667. X    undefined,        0,        /* dd03 */
  1668. X    undefined,        0,        /* dd04 */
  1669. X    undefined,        0,        /* dd05 */
  1670. X    undefined,        0,        /* dd06 */
  1671. X    undefined,        0,        /* dd07 */
  1672. X
  1673. X    undefined,        0,        /* dd08 */
  1674. X    "add    ix,bc",        0,        /* dd09 */
  1675. X    undefined,        0,        /* dd0a */
  1676. X    undefined,        0,        /* dd0b */
  1677. X    undefined,        0,        /* dd0c */
  1678. X    undefined,        0,        /* dd0d */
  1679. X    undefined,        0,        /* dd0e */
  1680. X    undefined,        0,        /* dd0f */
  1681. X
  1682. X    undefined,        0,        /* dd10 */
  1683. X    undefined,        0,        /* dd11 */
  1684. X    undefined,        0,        /* dd12 */
  1685. X    undefined,        0,        /* dd13 */
  1686. X    undefined,        0,        /* dd14 */
  1687. X    undefined,        0,        /* dd15 */
  1688. X    undefined,        0,        /* dd16 */
  1689. X    undefined,        0,        /* dd17 */
  1690. X
  1691. X    undefined,        0,        /* dd18 */
  1692. X    "add    ix,de",        0,        /* dd19 */
  1693. X    undefined,        0,        /* dd1a */
  1694. X    undefined,        0,        /* dd1b */
  1695. X    undefined,        0,        /* dd1c */
  1696. X    undefined,        0,        /* dd1d */
  1697. X    undefined,        0,        /* dd1e */
  1698. X    undefined,        0,        /* dd1f */
  1699. X
  1700. X    undefined,        0,        /* dd20 */
  1701. X    "ld    ix,%02x%02xh",    2,        /* dd21 */
  1702. X    "ld    (%02x%02xh),ix",2,        /* dd22 */
  1703. X    "inc    ix",        0,        /* dd23 */
  1704. X    undefined,        0,        /* dd24 */
  1705. X    undefined,        0,        /* dd25 */
  1706. X    undefined,        0,        /* dd26 */
  1707. X    undefined,        0,        /* dd27 */
  1708. X
  1709. X    undefined,        0,        /* dd28 */
  1710. X    "add    ix,ix",        0,        /* dd29 */
  1711. X    "ld    ix,(%02x%02xh)",2,        /* dd2a */
  1712. X    "dec    ix",        0,        /* dd2b */
  1713. X    undefined,        0,        /* dd2c */
  1714. X    undefined,        0,        /* dd2d */
  1715. X    undefined,        0,        /* dd2e */
  1716. X    undefined,        0,        /* dd2f */
  1717. X
  1718. X    undefined,        0,        /* dd30 */
  1719. X    undefined,        0,        /* dd31 */
  1720. X    undefined,        0,        /* dd32 */
  1721. X    undefined,        0,        /* dd33 */
  1722. X    "inc    (ix+%02xh)",    1,        /* dd34 */
  1723. X    "dec    (ix+%02xh)",    1,        /* dd35 */
  1724. X    "ld    (ix+%02xh),%02xh",2,        /* dd36 */
  1725. X    undefined,        0,        /* dd37 */
  1726. X
  1727. X    undefined,        0,        /* dd38 */
  1728. X    "add    ix,sp",        0,        /* dd39 */
  1729. X    undefined,        0,        /* dd3a */
  1730. X    undefined,        0,        /* dd3b */
  1731. X    undefined,        0,        /* dd3c */
  1732. X    undefined,        0,        /* dd3d */
  1733. X    undefined,        0,        /* dd3e */
  1734. X    undefined,        0,        /* dd3f */
  1735. X
  1736. X    undefined,        0,        /* dd40 */
  1737. X    undefined,        0,        /* dd41 */
  1738. X    undefined,        0,        /* dd42 */
  1739. X    undefined,        0,        /* dd43 */
  1740. X    undefined,        0,        /* dd44 */
  1741. X    undefined,        0,        /* dd45 */
  1742. X    "ld    b,(ix+%02xh)",    1,        /* dd46 */
  1743. X    undefined,        0,        /* dd47 */
  1744. X
  1745. X    undefined,        0,        /* dd48 */
  1746. X    undefined,        0,        /* dd49 */
  1747. X    undefined,        0,        /* dd4a */
  1748. X    undefined,        0,        /* dd4b */
  1749. X    undefined,        0,        /* dd4c */
  1750. X    undefined,        0,        /* dd4d */
  1751. X    "ld    c,(ix+%02xh)",    1,        /* dd4e */
  1752. X    undefined,        0,        /* dd4f */
  1753. X    
  1754. X    undefined,        0,        /* dd50 */
  1755. X    undefined,        0,        /* dd51 */
  1756. X    undefined,        0,        /* dd52 */
  1757. X    undefined,        0,        /* dd53 */
  1758. X    undefined,        0,        /* dd54 */
  1759. X    undefined,        0,        /* dd55 */
  1760. X    "ld    d,(ix+%02xh)",    1,        /* dd56 */
  1761. X    undefined,        0,        /* dd57 */
  1762. X
  1763. X    undefined,        0,        /* dd58 */
  1764. X    undefined,        0,        /* dd59 */
  1765. X    undefined,        0,        /* dd5a */
  1766. X    undefined,        0,        /* dd5b */
  1767. X    undefined,        0,        /* dd5c */
  1768. X    undefined,        0,        /* dd5d */
  1769. X    "ld    e,(ix+%02xh)",    1,        /* dd5e */
  1770. X    undefined,        0,        /* dd5f */
  1771. X    
  1772. X    undefined,        0,        /* dd60 */
  1773. X    undefined,        0,        /* dd61 */
  1774. X    undefined,        0,        /* dd62 */
  1775. X    undefined,        0,        /* dd63 */
  1776. X    undefined,        0,        /* dd64 */
  1777. X    undefined,        0,        /* dd65 */
  1778. X    "ld    h,(ix+%02xh)",    1,        /* dd66 */
  1779. X    undefined,        0,        /* dd67 */
  1780. X
  1781. X    undefined,        0,        /* dd68 */
  1782. X    undefined,        0,        /* dd69 */
  1783. X    undefined,        0,        /* dd6a */
  1784. X    undefined,        0,        /* dd6b */
  1785. X    undefined,        0,        /* dd6c */
  1786. X    undefined,        0,        /* dd6d */
  1787. X    "ld    l,(ix+%02xh)",    1,        /* dd6e */
  1788. X    undefined,        0,        /* dd6f */
  1789. X    
  1790. X    "ld    (ix+%02xh),b",    1,        /* dd70 */
  1791. X    "ld    (ix+%02xh),c",    1,        /* dd71 */
  1792. X    "ld    (ix+%02xh),d",    1,        /* dd72 */
  1793. X    "ld    (ix+%02xh),e",    1,        /* dd73 */
  1794. X    "ld    (ix+%02xh),h",    1,        /* dd74 */
  1795. X    "ld    (ix+%02xh),l",    1,        /* dd75 */
  1796. X    undefined,        0,        /* dd76 */
  1797. X    "ld    (ix+%02xh),a",    1,        /* dd77 */
  1798. X
  1799. X    undefined,        0,        /* dd78 */
  1800. X    undefined,        0,        /* dd79 */
  1801. X    undefined,        0,        /* dd7a */
  1802. X    undefined,        0,        /* dd7b */
  1803. X    undefined,        0,        /* dd7c */
  1804. X    undefined,        0,        /* dd7d */
  1805. X    "ld    a,(ix+%02xh)",    1,        /* dd7e */
  1806. X    undefined,        0,        /* dd7f */
  1807. X
  1808. X    undefined,        0,        /* dd80 */
  1809. X    undefined,        0,        /* dd81 */
  1810. X    undefined,        0,        /* dd82 */
  1811. X    undefined,        0,        /* dd83 */
  1812. X    undefined,        0,        /* dd84 */
  1813. X    undefined,        0,        /* dd85 */
  1814. X    "add    a,(ix+%02xh)",    1,        /* dd86 */
  1815. X    undefined,        0,        /* dd87 */
  1816. X
  1817. X    undefined,        0,        /* dd88 */
  1818. X    undefined,        0,        /* dd89 */
  1819. X    undefined,        0,        /* dd8a */
  1820. X    undefined,        0,        /* dd8b */
  1821. X    undefined,        0,        /* dd8c */
  1822. X    undefined,        0,        /* dd8d */
  1823. X    "adc    a,(ix+%02xh)",    1,        /* dd8e */
  1824. X    undefined,        0,        /* dd8f */
  1825. X    
  1826. X    undefined,        0,        /* dd90 */
  1827. X    undefined,        0,        /* dd91 */
  1828. X    undefined,        0,        /* dd92 */
  1829. X    undefined,        0,        /* dd93 */
  1830. X    undefined,        0,        /* dd94 */
  1831. X    undefined,        0,        /* dd95 */
  1832. X    "sub    (ix+%02xh)",    1,        /* dd96 */
  1833. X    undefined,        0,        /* dd97 */
  1834. X
  1835. X    undefined,        0,        /* dd98 */
  1836. X    undefined,        0,        /* dd99 */
  1837. X    undefined,        0,        /* dd9a */
  1838. X    undefined,        0,        /* dd9b */
  1839. X    undefined,        0,        /* dd9c */
  1840. X    undefined,        0,        /* dd9d */
  1841. X    "sbc    a,(ix+%02xh)",    1,        /* dd9e */
  1842. X    undefined,        0,        /* dd9f */
  1843. X    
  1844. X    undefined,        0,        /* dda0 */
  1845. X    undefined,        0,        /* dda1 */
  1846. X    undefined,        0,        /* dda2 */
  1847. X    undefined,        0,        /* dda3 */
  1848. X    undefined,        0,        /* dda4 */
  1849. X    undefined,        0,        /* dda5 */
  1850. X    "and    (ix+%02xh)",    1,        /* dda6 */
  1851. X    undefined,        0,        /* dda7 */
  1852. X
  1853. X    undefined,        0,        /* dda8 */
  1854. X    undefined,        0,        /* dda9 */
  1855. X    undefined,        0,        /* ddaa */
  1856. X    undefined,        0,        /* ddab */
  1857. X    undefined,        0,        /* ddac */
  1858. X    undefined,        0,        /* ddad */
  1859. X    "xor    (ix+%02xh)",    1,        /* ddae */
  1860. X    undefined,        0,        /* ddaf */
  1861. X    
  1862. X    undefined,        0,        /* ddb0 */
  1863. X    undefined,        0,        /* ddb1 */
  1864. X    undefined,        0,        /* ddb2 */
  1865. X    undefined,        0,        /* ddb3 */
  1866. X    undefined,        0,        /* ddb4 */
  1867. X    undefined,        0,        /* ddb5 */
  1868. X    "or    (ix+%02xh)",    1,        /* ddb6 */
  1869. X    undefined,        0,        /* ddb7 */
  1870. X
  1871. X    undefined,        0,        /* ddb8 */
  1872. X    undefined,        0,        /* ddb9 */
  1873. X    undefined,        0,        /* ddba */
  1874. X    undefined,        0,        /* ddbb */
  1875. X    undefined,        0,        /* ddbc */
  1876. X    undefined,        0,        /* ddbd */
  1877. X    "cp    (ix+%02xh)",    1,        /* ddbe */
  1878. X    undefined,        0,        /* ddbf */
  1879. X    
  1880. X    undefined,        0,        /* ddc0 */
  1881. X    undefined,        0,        /* ddc1 */
  1882. X    undefined,        0,        /* ddc2 */
  1883. X    undefined,        0,        /* ddc3 */
  1884. X    undefined,        0,        /* ddc4 */
  1885. X    undefined,        0,        /* ddc5 */
  1886. X    undefined,        0,        /* ddc6 */
  1887. X    undefined,        0,        /* ddc7 */
  1888. X
  1889. X    undefined,        0,        /* ddc8 */
  1890. X    undefined,        0,        /* ddc9 */
  1891. X    undefined,        0,        /* ddca */
  1892. X    "dd cb    %02x,%02x",    2,        /* ddcb */
  1893. X    undefined,        0,        /* ddcc */
  1894. X    undefined,        0,        /* ddcd */
  1895. X    undefined,        0,        /* ddce */
  1896. X    undefined,        0,        /* ddcf */
  1897. X    
  1898. X    undefined,        0,        /* ddd0 */
  1899. X    undefined,        0,        /* ddd1 */
  1900. X    undefined,        0,        /* ddd2 */
  1901. X    undefined,        0,        /* ddd3 */
  1902. X    undefined,        0,        /* ddd4 */
  1903. X    undefined,        0,        /* ddd5 */
  1904. X    undefined,        0,        /* ddd6 */
  1905. X    undefined,        0,        /* ddd7 */
  1906. X
  1907. X    undefined,        0,        /* ddd8 */
  1908. X    undefined,        0,        /* ddd9 */
  1909. X    undefined,        0,        /* ddda */
  1910. X    undefined,        0,        /* dddb */
  1911. X    undefined,        0,        /* dddc */
  1912. X    undefined,        0,        /* dddd */
  1913. X    undefined,        0,        /* ddde */
  1914. X    undefined,        0,        /* dddf */
  1915. X    
  1916. X    undefined,        0,        /* dde0 */
  1917. X    "pop    ix",        0,        /* dde1 */
  1918. X    undefined,        0,        /* dde2 */
  1919. X    "ex    (sp),ix",    0,        /* dde3 */
  1920. X    undefined,        0,        /* dde4 */
  1921. X    "push    ix",        0,        /* dde5 */
  1922. X    undefined,        0,        /* dde6 */
  1923. X    undefined,        0,        /* dde7 */
  1924. X
  1925. X    undefined,        0,        /* dde8 */
  1926. X    "jp    (ix)",        0,        /* dde9 */
  1927. X    undefined,        0,        /* ddea */
  1928. X    undefined,        0,        /* ddeb */
  1929. X    undefined,        0,        /* ddec */
  1930. X    undefined,        0,        /* dded */
  1931. X    undefined,        0,        /* ddee */
  1932. X    undefined,        0,        /* ddef */
  1933. X    
  1934. X    undefined,        0,        /* ddf0 */
  1935. X    undefined,        0,        /* ddf1 */
  1936. X    undefined,        0,        /* ddf2 */
  1937. SHAR_EOF
  1938. echo "2" > ._seq_
  1939. -- 
  1940. "If I'd known it was harmless, I'd have killed it myself"  Phillip K. Dick
  1941. Bob Bownes, aka iii, aka captain comrade doktor bobwrench
  1942. 3 A Pinehurst Ave,    Albany, New York, 12203, (518)-482-8798 voice 
  1943.  bownesrm@beowulf.uucp {uunet!steinmetz,rutgers!brspyr1}!beowulf!bownesrm
  1944.