4 * Copyright (C) 1989-2009 Alan R. Baldwin
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 * ported to the Rabbit2000 by
25 * Ulrich Raich and Razaq Ijoduola
29 * email: Ulrich dot Raich at cern dot ch
33 * xerr messages Copyright (C) 1989-2021 Alan R. Baldwin
38 * Extensions: P. Felber
40 * Altered by Leland Morrison to support rabbit 2000
41 * and rabbit 4000 instruction sets (2011)
47 char *cpu
= "Rabbit 2000/4000";
50 char imtab
[3] = { 0x46, 0x56, 0x5E };
52 static const unsigned char ipset
[4] = { 0x46, 0x56, 0x4E, 0x5E };
57 /* when set, generate op-code for Rabbit-4000 instead of Rabbit 2000/3000 */
62 * Opcode Cycle Definitions
64 #define OPCY_SDP ((char) (0xFF))
65 #define OPCY_ERR ((char) (0xFE))
67 /* OPCY_NONE ((char) (0x80)) */
68 /* OPCY_MASK ((char) (0x7F)) */
70 #define OPCY_CPU ((char) (0xFD))
72 #define UN ((char) (OPCY_NONE | 0x00))
73 #define P2 ((char) (OPCY_NONE | 0x01))
74 #define P3 ((char) (OPCY_NONE | 0x02))
75 #define P4 ((char) (OPCY_NONE | 0x03))
76 #define P5 ((char) (OPCY_NONE | 0x04))
77 #define P6 ((char) (OPCY_NONE | 0x05))
78 #define P7 ((char) (OPCY_NONE | 0x06))
81 * Process a machine op.
83 VOID
machine(struct mne
* mp
)
92 op
= (int) mp
->m_valu
;
95 if (!r4k_mode
&& rf
> X_R4K_MODE
)
121 if ((v1
= admode(CND
)) != 0) {
124 xerr('a', "Condition code required.");
135 } else if ((v1
= admode(R8IP
)) != 0) {
138 outab(0x76); /* push */
140 outab(0x7E); /* pop */
143 if ((v1
= admode(R16
)) != 0 && (v1
&= 0xFF) != SP
) {
144 if (v1
!= gixiy(v1
)) {
150 } else if (r4k_mode
) {
151 if ( (v1
= admode(R32_JKHL
)) != 0 ) {
155 } else if ( (v1
= admode(R32_BCDE
)) != 0 ) {
161 xerr('a', "Invalid Addressing Mode.");
165 v1
= (int) absexpr();
167 * block RST 00, 08, and 30 b/c those opcodes
168 * are assigned to different instructions in the
171 if ((v1
== 0x00) || (v1
== 0x08) || (v1
== 0x30)) {
172 xerr('a', "Rabbit 2000/4000: 0x00, 0x08, and 0x30 are not allowed");
176 xerr('a', "Allowed values: N * 0x08, N = 0 -> 7.");
182 /* Rabbit processor use the opcode to set interrupt level */
188 xerr('a', "Values of 0, 1, 2, and 3 are valid.");
192 outab(ipset
[e1
.e_addr
]);
198 v1
= (int) e1
.e_addr
;
207 if (genop(0xCB, op
, &e2
, 0) || t1
)
208 xerr('a', "Invalid Addressing Mode.");
214 if ((t2
== S_IMMED
) && r4k_mode
)
216 v1
= (int) e2
.e_addr
;
217 /* v1 should be shift count of 1,2,4, or 8 */
222 if ((t2
!= S_R32_BCDE
) && (t2
!= S_R32_JKHL
))
231 else if ((v1
== 8) && (op
< 0x20 /* op is rlc|rrc|rl|rr */))
238 /* 00 rlc, 08 rrc, 10 rl , 18 rr *
239 * 20 sla, 28 sra, 38 srl, [30 sll == sla] */
240 outab( ((t2
== S_R32_JKHL
)?JKHL_PG
:BCDE_PG
) );
241 outab(v1
+ (op
<< 1));
245 if ((t2
!= S_R8
) || (e2
.e_addr
!= A
))
250 } else if (t2
== S_R16
) {
251 v2
= (int) e2
.e_addr
;
253 ((op
== 0x10 /* rl */) || (op
== 0x18 /* rr */))) {
254 outab( 0xF3 - 0x10 + op
);
258 if ((v2
== HL
) && (op
== 0x18 /* rr */)) {
264 if ((v2
== HL
) && (op
== 0x10 /* rl */)) {
268 if (((v2
== BC
)||(v2
== DE
)) &&
269 (op
< 0x20 /* 00 rlc, 08 rrc, 10 rl, 18 rr */)) {
270 outab( 0x50 + (op
>> 3) + ((v2
==BC
)?0x10:0x00) );
277 if (genop(0xCB, op
, &e2
, 0) || t1
)
281 case S_AND
: /* and, xor, or, cp */
282 case S_SUB
: /* sub */
283 case S_SBC
: /* sbc */
287 /* handle case for implicit target of 'A' register */
291 v2
= (int) e1
.e_addr
;
296 v1
= (int) e1
.e_addr
;
297 v2
= (int) e2
.e_addr
;
301 if ((t1
== S_R8
) && (v1
== A
)) {
302 if ( ((t2
== S_R8
) && (v2
== A
)) &&
303 ((op
== 0xA8) || (op
== 0xB0)) ) {
304 /* AF: "xor a,a" || B7: "or a,a" */
309 if ((t2
== S_R8
) || (t2
== S_IDHL
)) {
310 /* ljm - rabbit 4000 support
311 * (sub,sbc,and,xor,or,cp) A,R or A,(HL)
312 * needs a 0x7F prefix byte when
313 * operating in rabbit 4000 mode
320 if (t2
== S_IMMED
) { /* AND,XOR,OR,CP,SUB A, #n */
321 /* opcode for (sub,sbc,and,xor,or,cp) A,#immediate
322 * do not need 0x7F prefix byte
324 outab(op
|0x46); /* 0xA0 | 0x46 => 0xE6, etc */
329 if (genop(0, op
, ep
, 1))
334 if ((t1
== S_R16
) && (v1
== HL
) &&
335 (t2
== S_R16
) && (rf
== S_SBC
)) {
336 /* sbc hl, [bc|de|hl|sp] */
337 if ( v2
!= gixiy(v2
) )
338 /* sorry, sbc hl, [ix|iy] do not exist */
339 xerr('a', "Second argument: must be BC, DE, HL or SP.");
342 outab(0x42 | v2
<< 4);
345 if ((t1
== S_R16
) && (v1
== HL
) &&
346 (t2
== S_R16
) && (v2
== DE
)) {
348 /* sbc hl, de does not exist */
352 /* ED 48 cp hl, de */
353 if (rf
== S_SBC
) /* op == 0x98 */
354 xerr('a', "Not valid for SBC.");
357 case 0x90: /* sub */ outab(0x55); break;
358 case 0xA0: /* and */ outab(0xDC); break;
359 case 0xA8: /* xor */ outab(0x54); break;
360 case 0xB0: /* or */ outab(0xEC); break;
369 if ((t1
== S_R16
) && ((v1
== IX
) || (v1
== IY
)) &&
370 (t2
== S_R16
) && (v2
== DE
) &&
371 ((op
== 0xA0 /* and */) || (op
== 0xB0 /* or */))) {
377 if ((t1
== S_R32_JKHL
) && (t2
== S_R32_BCDE
)) {
378 /* ED D6 sub jkhl, bcde */
379 /* sbc jkhl, bcde does not exist */
380 /* ED E6 and jkhl, bcde */
381 /* ED EE xor jkhl, bcde */
382 /* ED F6 or jkhl, bcde */
383 /* ED 58 cp jkhl, bcde */
384 if (rf
== S_SBC
) /* op == 0x98 */
385 xerr('a', "Not valid for SBC.");
389 case 0x90: /* sub */ outab(0xD6); break;
390 case 0xA0: /* and */ outab(0xE6); break;
391 case 0xA8: /* xor */ outab(0xEE); break;
392 case 0xB0: /* or */ outab(0xF6); break;
393 case 0xB8: /* cp */ outab(0x58); break;
398 if ((t1
== S_R16
) && (v1
== HL
) && (t2
== S_IMMED
)) {
399 /* cp hl, #signed displacement */
405 xerr('a', "Not valid for SBC.");
417 /* implied destination of the 8-bit 'a' register */
418 if ((t1
== S_R8
) || (t1
== S_IDHL
)) {
419 /* ljm - rabbit 4000 support
420 * (add,adc,sub,sbc,and,xor,or,cp) A,R or A,(HL)
421 * needs a 0x7F prefix byte when
422 * operating in rabbit 4000 mode
428 if (genop(0, op
, &e1
, 1))
429 xerr('a', "Invalid Addressing Mode.");
432 if ((t1
== S_R8
) && (e1
.e_addr
== A
)) {
433 if ( ((t2
== S_R8
) || (t2
== S_IDHL
)) && r4k_mode
)
434 /* ljm - rabbit 4000 support, see note in t2==0 */
437 if (genop(0, op
, &e2
, 1))
438 xerr('a', "Second argument: Invalid Addressing Mode.");
442 if ((t1
== S_R32_JKHL
) && (t2
== S_R32_BCDE
) &&
444 /* rabbit 4000 - ED C6 "add jkhl, bcde" */
450 v1
= (int) e1
.e_addr
;
451 v2
= (int) e2
.e_addr
;
453 if ((t1
== S_R16
) && (v1
== SP
) && (t2
== S_IMMED
)) {
454 /* rabbit 4000 - add sp,#n n=signed displacement */
460 if ((t1
== S_R16
) && (v1
== HL
) && (t2
== S_R16
)) {
467 op
= (rf
== S_ADD
) ? 0x09 : 0x4A;
468 outab(op
| (v2
<< 4) );
472 if ((t1
== S_R16
) && ((v1
== IX
) || (v1
== IY
)) &&
476 (((v2
== IX
) || (v2
== IY
)) && (v2
!= v1
)))
479 if ((v2
== IX
) || (v2
== IY
))
483 outab(0x09 | (v2
<< 4));
486 xerr('a', "Invalid Addressing Mode.");
491 v1
= (int) e1
.e_addr
;
494 v2
= (int) e2
.e_addr
;
498 outab((e1
.e_addr
<<3) | 0x06);
503 if (r4k_mode
&& (v1
== A
) && (t2
== S_R8
) && (v2
== A
)) {
504 /* exception for "ld a,a"
505 * on rabbit 4000 0x7F is a prefix instead of "ld a,a"
507 xerr('a', "Not A Rabbit 4000 Instruction");
510 if ((v1
== A
) && (t2
== S_R8
)) {
511 /* "ld a,r", (except "ld a,a") */
512 v1
= op
| e1
.e_addr
<<3;
513 if (genop(0, v1
, &e2
, 0))
518 /* ld [b,c,d,e,h,l,a], _ */
519 if ((t2
== S_R8
) && (v2
!= A
)) {
520 /* 8-bit register to 8-bit register */
521 /* use 0x7F prefix when in rabbit 4000 mode */
522 v1
= op
| e1
.e_addr
<<3;
525 if (genop(0, v1
, &e2
, 0) == 0)
531 if ((t2
== S_R8
) && (v2
== A
) &&
532 ((v1
!= A
) || (!r4k_mode
))) {
533 /* "ld r,a", but except "ld a,a"
534 * on rabbit 4000 0x7F is a prefix instead of "ld a,a" */
535 v1
= op
| e1
.e_addr
<<3;
536 if (genop(0, v1
, &e2
, 0))
541 if ((t2
== S_IDHL
) || (t2
== S_IDIX
) || (t2
== S_IDIY
)) {
542 /* "ld r,(hl)" or "ld r,disp (ix|iy)" */
543 v1
= op
| e1
.e_addr
<<3;
544 if (genop(0, v1
, &e2
, 0))
550 if ((t1
== S_R16
) && (t2
== S_IMMED
)) {
551 v1
= gixiy(v1
); /* generayes prefix when ix or iy */
556 if ((t1
== S_R16
) && (t2
== S_INDM
)) {
557 if (gixiy(v1
) == HL
) {
561 outab(0x4B | (v1
<<4));
566 if ((t1
== S_R16
) && (v1
== HL
))
568 if ((t2
== S_IDIX
) || (t2
== S_IDIY
) ||
569 (t2
== S_IDHL
) || (t2
== S_IDHL_OFFSET
))
571 /* ljm - added rabbit instruction LD HL,n(IX|HL|IY) */
574 else if ((t2
== S_IDHL
) || (t2
== S_IDHL_OFFSET
))
575 /* ljm - added rabbit instruction LD HL,n(IY)
576 * normally 0xFD generated by "gixiy(v1)", but
577 * 0xDD results in n(HL) instead of n(IX)
585 if ((t2
== S_R16
) && ((v2
== IX
) || (v2
== IY
))) {
586 outab( ((v2
==IX
)?0xDD:0xFD) );
591 if ((t2
== S_R16
) && ((v2
== BC
) || (v2
== DE
))) {
592 outab( 0x81 + ((v2
== DE
) ? 0x20 : 0) );
597 if ((t2
== S_R16
) && (v2
== HL
)) /* ld n(IX|IY|HL), HL */
599 if ((t1
== S_IDIY
) || (t1
== S_IDHL
) ||
600 (t1
== S_IDHL_OFFSET
))
601 outab( ((t1
==S_IDIY
) ? 0xFD : 0xDD) );
603 if ((t1
== S_IDIY
) || (t1
== S_IDIX
) ||
604 (t1
== S_IDHL
) || (t1
== S_IDHL_OFFSET
)) {
610 if ((t1
== S_R16
) && ((v1
== IX
) || (v1
== IY
))) {
611 outab( ((v1
==IX
)?0xDD:0xFD) );
616 if ((t1
== S_INDM
) && (t2
== S_R16
)) {
617 if (gixiy(v2
) == HL
) {
621 outab(0x43 | (v2
<<4));
626 if ((t1
== S_R8
) && (v1
== A
) && (t2
== S_INDM
)) {
631 if ((t1
== S_INDM
) && (t2
== S_R8
) && (v2
== A
)) {
636 if ((t2
== S_R8
) && (gixiy(t1
) == S_IDHL
)) {
642 if ((t2
== S_IMMED
) && (gixiy(t1
) == S_IDHL
)) {
649 if ((t1
== S_R8X
) && (t2
== S_R8
) && (v2
== A
)) {
654 if ((t1
== S_R8
) && (v1
== A
) && (t2
== S_R8X
)) {
659 if ((t1
== S_R16
) && (v1
== SP
)) {
660 if ((t2
== S_R16
) && (gixiy(v2
) == HL
)) {
665 if ((t1
== S_R16
) && (t2
== S_IDSP
))
667 if ( (v1
=gixiy(v1
)) == HL
) {
668 /* ljm - added rabbit instruction:
677 if ((t1
== S_IDSP
) && (t2
== S_R16
))
679 //printf( "at %s: %d, t1=%d, v1=%d, t2=%d, v2=%d\n",
680 // __FILE__, __LINE__, t1, v1, t2, v2 );
681 if ( (v2
=gixiy(v2
)) == HL
) {
682 /* ljm - added rabbit instruction:
690 if ((t1
== S_R8
) && (v1
== A
)) {
691 if ((t2
== S_IDBC
) || (t2
== S_IDDE
)) {
692 outab(0x0A | ((t2
-S_INDR
)<<4));
696 if ((t2
== S_R8
) && (v2
== A
)) {
697 if ((t1
== S_IDBC
) || (t1
== S_IDDE
)) {
698 outab(0x02 | ((t1
-S_INDR
)<<4));
703 /* load/save code bank register "xpc" */
704 if ((t1
== S_RXPC
) && (t2
== S_R8
) && (v2
== A
)) {
710 if ((t1
== S_RXPC
) && r4k_mode
&&
711 (t2
== S_R16
) && (v2
== HL
)) {
716 if ((t2
== S_RXPC
) && (t1
== S_R8
) && (v1
== A
)) {
722 if ((t2
== S_RXPC
) && r4k_mode
&&
723 (t1
== S_R16
) && (v1
== HL
)) {
728 if ((t1
== S_R16_ALT
) && (t2
== S_R16
)) {
729 if ((v2
== BC
) || (v2
== DE
)) {
730 /* LD BC'|DE'|HL', BC|DE */
732 outab(((v2
== BC
) ? 0x49 : 0x41) | (v1
<< 4));
737 /* 16-bit operations valid only in rabbit 4000 mode */
738 if (r4k_mode
&& (t1
== S_R16
) && (t2
== S_R16
)) {
739 if ((v1
== HL
) && ((v2
== BC
) || (v2
== DE
))) {
740 outab( 0x81 + ((v2
==DE
)?0x20:0x00) );
743 if ((v2
== HL
) && ((v1
== BC
) || (v1
== DE
))) {
744 outab( 0x91 + ((v1
==DE
)?0x20:0x00) );
749 /* 32-bit operations valid in rabbit 4000 mode */
750 if (r4k_mode
&& ((t1
== S_R32_JKHL
) || (t1
== S_R32_BCDE
))) {
752 outab( ((t1
== S_R32_JKHL
)?JKHL_PG
:BCDE_PG
) );
756 if ((t2
== S_IDIX
) || (t2
== S_IDIY
) || (t2
== S_IDSP
)) {
757 outab( ((t1
== S_R32_JKHL
)?JKHL_PG
:BCDE_PG
) );
761 v2
= ((t2
== S_IDIY
) ? 0x10 : 0x00);
768 outab( 0x93 + ((t1
== S_R32_JKHL
) ? 1 : 0) );
773 outab( 0xA3 + ((t1
== S_R32_JKHL
) ? 1 : 0) );
779 if (r4k_mode
&& ((t2
== S_R32_JKHL
) || (t2
== S_R32_BCDE
))) {
781 outab( ((t2
== S_R32_JKHL
)?JKHL_PG
:BCDE_PG
) );
785 if ((t1
== S_IDIX
) || (t1
== S_IDIY
) || (t1
== S_IDSP
)) {
786 outab( ((t2
== S_R32_JKHL
)?JKHL_PG
:BCDE_PG
) );
790 v1
= ((t1
== S_IDIY
) ? 0x10 : 0x00);
797 outab( 0x83 + ((t2
== S_R32_JKHL
) ? 1 : 0) );
802 xerr('a', "Invalid Addressing Mode.");
810 v1
= (int) e1
.e_addr
;
811 v2
= (int) e2
.e_addr
;
813 if ((v1
== DE
) && (v2
== HL
)) {
817 if (r4k_mode
&& (v1
==BC
) && (v2
==HL
)) {
822 else if (t1
== S_R16_ALT
) {
823 if ((v1
== DE
) && (v2
== HL
)) {
828 if (r4k_mode
&& (v1
==BC
) && (v2
==HL
)) {
836 if ((t1
== S_IDSP
) && (v1
== 0)) {
837 /* 0xE3 is EX DE',HL on rabbit 2000
838 * but DD/FD E3 "ex (sp),ix|iy" is valid
845 else if (gixiy(v2
) == HL
) {
851 if ((t1
== S_R16AF
) && (t2
== S_R16AF_ALT
)) {
855 if ((t1
==S_R32_JKHL
) && (t2
==S_R32_BCDE
)) {
859 xerr('a', "Invalid Addressing Mode.");
870 v1
= (int) e1
.e_addr
;
879 if (t1
!= gixiy(t1
)) {
895 xerr('a', "Invalid Addressing Mode.");
900 /* "neg" implies "neg a" */
906 v1
= (int) e1
.e_addr
;
907 if ((t1
== S_R8
) && (v1
== A
)) { /* "neg a" */
913 if ((t1
== S_R16
) && (v1
== HL
) && r4k_mode
) { /* "neg hl" */
919 ((t1
== S_R32_JKHL
) || (t1
== S_R32_BCDE
))) {
921 outab( ( (t1
== S_R32_BCDE
) ? 0xDD : 0xFD ) );
929 if ((v1
= admode(CND
)) != 0 && rf
!= S_DJNZ
) {
930 if ((v1
&= 0xFF) <= 0x03) {
933 xerr('a', "Condition code required.");
940 v2
= (int) (e2
.e_addr
- dot
.s_addr
- 1);
941 if (pass
== 2 && ((v2
< -128) || (v2
> 127)))
942 xerr('a', "Branching Range Exceeded.");
947 if (e2
.e_mode
!= S_USER
)
959 if ((v1
= admode(CND
)) != 0) {
973 if ((e1
.e_addr
== 0) && (gixiy(t1
) == S_IDHL
)) {
977 xerr('a', "Invalid Addressing Mode.");
985 if (mchtyp
!= X_HD64
)
986 xerr('a', "A Z180 Instruction.");
993 if (mchtyp
!= X_HD64
)
994 xerr('a', "A Z180 Instruction.");
1004 if ((t1
== S_R8
) && (t2
== S_INDM
)) {
1006 outab(op
| (e1
.e_addr
<<3));
1010 xerr('a', "Invalid Addressing Mode.");
1014 if (mchtyp
!= X_HD64
)
1015 xerr('a', "A Z180 Instruction.");
1017 if ((t1
== S_R16
) && ((v1
= (int) e1
.e_addr
) <= SP
)) {
1019 outab(op
| (v1
<<4));
1022 xerr('a', "Only BC, DE, HL and SP are allowed.");
1026 if (mchtyp
!= X_HD64
)
1027 xerr('a', "A Z180 Instruction.");
1031 outab(op
| (e1
.e_addr
<<3));
1039 if (t1
== S_IMMED
) {
1045 xerr('a', "Invalid Addressing Mode.");
1049 if (mchtyp
!= X_HD64
)
1050 xerr('a', "A Z180 Instruction.");
1052 if (t1
== S_IMMED
) {
1058 xerr('a', "Invalid Addressing Mode.");
1063 /* bank jump or call for rabbit processor */
1067 v1
= (int) e1
.e_addr
;
1068 if ((t1
== S_USER
) && (t2
== S_IMMED
)) {
1078 v1
= (int) e1
.e_addr
;
1079 if ((t1
== S_R16
) && ((v1
== HL
) || (v1
== IX
) || (v1
== IY
))) {
1084 xerr('a', "Invalid Addressing Mode.");
1089 v1
= (int) e1
.e_addr
;
1092 v2
= (int) e2
.e_addr
;
1093 /* LDP (mn), HL|IX|IY */
1094 if ((t1
== S_INDM
) && (t2
== S_R16
)) {
1095 if ((v2
!= HL
) && (v2
!= IX
) && (v2
!= IY
)) {
1096 xerr('a', "Second argument: must be HL, IX, or IY.");
1108 /* LDP HL|IX|IY, (mn) */
1109 if ((t1
== S_R16
) && (t2
== S_INDM
)) {
1110 if ((v1
!= HL
) && (v1
!= IX
) && (v1
!= IY
)) {
1111 xerr('a', "First argument: must be HL, IX, or IY.");
1123 /* LDP (HL|IX|IY), HL */
1124 if ((t2
== S_R16
) && (v2
== HL
)) {
1125 if ((t1
!= S_IDHL
) && (t1
!= S_IDIX
) && (t1
!= S_IDIY
)) {
1126 xerr('a', "First argument: must be (HL), (IX), or (IY).");
1129 if ((e1
.e_base
.e_ap
!= NULL
) || (v1
!= 0)) {
1130 xerr('a', "First argument: (HL+D, (IX+D), and (IY+D) are invalid.");
1141 /* LDP HL, (HL|IX|IY) */
1142 if ((t1
== S_R16
) && (v1
== HL
)) {
1143 if ((t2
!= S_IDHL
) && (t2
!= S_IDIX
) && (t2
!= S_IDIY
)) {
1144 xerr('a', "Second argument: must be (HL), (IX), or (IY).");
1147 if ((e2
.e_base
.e_ap
!= NULL
) || (v2
!= 0)) {
1148 xerr('a', "Second argument: (HL+D, (IX+D), and (IY+D) are invalid.");
1159 xerr('a', "Invalid Addressing Mode.");
1163 if (!(r3k_mode
|| r4k_mode
))
1164 xerr('o', "A Rabbit 3000/4000 Instruction.");
1170 if (!(r3k_mode
|| r4k_mode
))
1171 xerr('o', "A Rabbit 3000/4000 Instruction.");
1179 xerr('o', "A Rabbit 4000 Instruction.");
1187 xerr('o', "A Rabbit 4000 Instruction.");
1194 xerr('o', "A Rabbit 4000 Instruction.");
1196 if ((v1
= admode(ALT_CND
)) != 0) {
1205 v2
= (int) (e2
.e_addr
- dot
.s_addr
- 1);
1206 if (pass
== 2 && ((v2
< -32768) || (v2
> 32767)))
1208 outab( (v2
& 0xFF) );
1213 if (e2
.e_mode
!= S_USER
)
1219 xerr('o', "A Rabbit 4000 Instruction.");
1221 v1
= (int) e1
.e_addr
;
1222 if ((t1
== S_R16
) && (v1
== HL
)) {
1230 xerr('o', "Internal Opcode Error.");
1236 * general addressing evaluation
1237 * return(0) if general addressing mode output, else
1238 * return(esp->e_mode)
1241 genop(int pop
, int op
, struct expr
*esp
, int f
)
1247 if ((t1
= esp
->e_mode
) == S_R8
) {
1250 outab(op
|esp
->e_addr
);
1257 if ((esp
->e_base
.e_ap
!= NULL
) || (esp
->e_addr
!= 0))
1258 xerr('a', "(HL+D) is invalid.");
1268 if (gixiy(t1
) == S_IDHL
) {
1283 if ((t1
== S_IMMED
) && (f
)) {
1294 * IX and IY prebyte check
1302 } else if (v
== IY
) {
1305 } else if (v
== S_IDIX
) {
1308 } else if (v
== S_IDIY
) {
1316 * Branch/Jump PCR Mode Check
1319 mchpcr(struct expr
*esp
)
1321 if (esp
->e_base
.e_ap
== dot
.s_area
) {
1324 if (esp
->e_flag
==0 && esp
->e_base
.e_ap
==NULL
) {
1326 * Absolute Destination
1328 * Use the global symbol '.__.ABS.'
1329 * of value zero and force the assembler
1330 * to use this absolute constant as the
1331 * base value for the relocation.
1334 esp
->e_base
.e_sp
= &sym
[1];
1340 * Machine dependent initialization
1357 sym
[2].s_addr
= X_R2K
;