Previous 199869 Revisions Next

r26450 Saturday 30th November, 2013 at 07:08:10 UTC by Jürgen Buchmüller
Tried the emu/machine/74181.c implementation of the ALU, which doesn't want to work (copy error?). Enable USE_ALU_74181 with the working implementation.
[/branches/alto2/src/emu/cpu/alto2]a2disp.c a2mem.c a2mem.h alto2cpu.c alto2cpu.h

branches/alto2/src/emu/cpu/alto2/a2mem.c
r26449r26450
629629       * currently we don't do anything special
630630       */
631631      LOG((LOG_MEM,5, "   MAR←; refresh cycle @ %#o\n", addr));
632      m_mem.mar = addr;
633      m_mem.access = ALTO2_MEM_REFRESH;
634      m_mem.cycle = cycle();
632635      return;
633636   }
634637
branches/alto2/src/emu/cpu/alto2/a2mem.h
r26449r26450
2121   ALTO2_MEM_NONE,
2222   ALTO2_MEM_ODD      = (1 << 0),
2323   ALTO2_MEM_RAM      = (1 << 1),
24   ALTO2_MEM_INVALID   = (1 << 2)
24   ALTO2_MEM_REFRESH   = (1 << 2),
25   ALTO2_MEM_INVALID   = (1 << 3)
2526};
2627
2728struct {
branches/alto2/src/emu/cpu/alto2/a2disp.c
r26449r26450
247247//! update the internal bitmap to a byte array
248248void alto2_cpu_device::update_bitmap_word(UINT16* bitmap, int x, int y, UINT16 word)
249249{
250   /* mixing with the cursor */
250   // mixing with the cursor
251251   if (x == m_dsp.curxpos + 0)
252252      word ^= m_dsp.cursor0;
253253   if (x == m_dsp.curxpos + 1)
254254      word ^= m_dsp.cursor1;
255   // no change?
255256   if (word == bitmap[x])
256257      return;
257258   bitmap[x] = word;
r26449r26450
485486}
486487
487488/**
488 * @brief f2_evenfield late: branch on evenfield
489 * @brief branch on evenfield
489490 *
490491 * NEXT(09) = even field ? 1 : 0
491492 */
492493void alto2_cpu_device::f2_late_evenfield()
493494{
494495   UINT16 r = HLC1024 ^ 1;
495   LOG((LOG_DISPL,2,"   evenfield branch on HLC1024 (%#o | %#o)\n", m_next2, r));
496   LOG((LOG_DISPL,2,"   EVENFIELD branch (%#o | %#o)\n", m_next2, r));
496497   m_next2 |= r;
497498}
498499
branches/alto2/src/emu/cpu/alto2/alto2cpu.c
r26449r26450
20232023 * @param smc S function [0-15], M arithmetic/logic flag, C carry
20242024 * @return resulting ALU output
20252025 */
2026#if   1
20262027UINT32 alto2_cpu_device::alu_74181(UINT32 a, UINT32 b, UINT8 smc)
20272028{
20282029   register UINT32 f;
r26449r26450
22392240   }
22402241   return f;
22412242}
2243#else
2244
2245#define   DO_74181(ci,mp,s0,s1,s2,s3,a,b,_b0,_b1,_b2,_b3,f,co) do { \
2246   int a0 = BIT(a,_b0), a1 = BIT(a,_b1), a2 = BIT(a,_b2), a3 = BIT(a,_b3); \
2247   int b0 = BIT(b,_b0), b1 = BIT(b,_b1), b2 = BIT(b,_b2), b3 = BIT(b,_b3); \
2248   int ap0 = !(a0 | (b0 & s0) | (s1 & !b0)); \
2249   int bp0 = !(((!b0) & s2 & a0) | (a0 & b0 & s3)); \
2250   int ap1 = !(a1 | (b1 & s0) | (s1 & !b1)); \
2251   int bp1 = !(((!b1) & s2 & a1) | (a1 & b1 & s3)); \
2252   int ap2 = !(a2 | (b2 & s0) | (s1 & !b2)); \
2253   int bp2 = !(((!b2) & s2 & a2) | (a2 & b2 & s3)); \
2254   int ap3 = !(a3 | (b3 & s0) | (s1 & !b3)); \
2255   int bp3 = !(((!b3) & s2 & a3) | (a3 & b3 & s3)); \
2256   int fp0 = !(ci & mp) ^ ((!ap0) & bp0); \
2257   int fp1 = (!((mp & ap0) | (mp & bp0 & ci))) ^ ((!ap1) & bp1); \
2258   int fp2 = (!((mp & ap1) | (mp & ap0 & bp1) | (mp & ci & bp0 & bp1))) ^ ((!ap2) & bp2); \
2259   int fp3 = (!((mp & ap2) | (mp & ap1 & bp2) | (mp & ap0 & bp1 & bp2) | (mp & ci & bp0 & bp1 & bp2))) ^ ((!ap3) & bp3); \
2260   f |= (fp0 << _b0) | (fp1 << _b1) | (fp2 << _b2) | (fp3 << _b3); \
2261   int g = !((ap0 & bp1 & bp2 & bp3) | (ap1 & bp2 & bp3) | (ap2 & bp3) | ap3); \
2262   co = (!(ci & bp0 & bp1 & bp2 & bp3)) | g; \
2263} while (0)
2264
2265
2266UINT32 alto2_cpu_device::alu_74181(UINT32 a, UINT32 b, UINT8 smc)
2267{
2268   // inputs
2269   int ci = !BIT(smc, 2);
2270   int mp = !BIT(smc, 3);
2271   int s0 = !BIT(smc, 4), s1 = !BIT(smc, 5), s2 = !BIT(smc, 6), s3 = !BIT(smc, 7);
2272
2273   // outputs
2274   UINT32 f = 0;
2275   int cn_x;
2276   DO_74181(ci,  mp,s0,s1,s2,s3,a,b, 0, 1, 2, 3,f,cn_x);   // 74181 #1
2277   int cn_y;
2278   DO_74181(cn_x,mp,s0,s1,s2,s3,a,b, 4, 5, 6, 7,f,cn_y);   // 74181 #2
2279   int cn_z;
2280   DO_74181(cn_y,mp,s0,s1,s2,s3,a,b, 8, 9,10,11,f,cn_z);   // 74181 #3
2281   int co;
2282   DO_74181(cn_z,mp,s0,s1,s2,s3,a,b,12,13,14,15,f,co);      // 74181 #4
2283   f |= co << 16;
2284   return f;
2285}
2286#endif   // 0
22422287#endif
22432288
22442289/** @brief flag that tells whether to load the T register from BUS or ALU */
branches/alto2/src/emu/cpu/alto2/alto2cpu.h
r26449r26450
5353#define   ALTO2_FAKE_STATUS_H      12         //!< number of extra scanlines to display some status info
5454
5555#define   USE_PRIO_F9318         0         //!< define to 1 to use the F9318 priority encoder code
56#define   USE_ALU_74181         0         //!< define to 1 to use the SN74181 ALU code
56#define   USE_ALU_74181         1         //!< define to 1 to use the SN74181 ALU code
5757#define   USE_BITCLK_TIMER      0         //!< define to 1 to use a very high rate timer for the disk bit clock
5858#define   USE_HAMMING_CHECK      1         //!< define to 1 to use the Hamming code and Parity check in a2mem
5959

Previous 199869 Revisions Next


© 1997-2024 The MAME Team