| Previous | 199869 Revisions | Next |
| r17918 Sunday 16th September, 2012 at 05:24:30 UTC by Aaron Giles |
|---|
| Final round of struct/union/enum normalization. |
| [src/emu] | emupal.c hashfile.c sound.h uimenu.h video.h |
| [src/emu/cpu] | vtlb.c vtlb.h x86log.c x86log.h |
| [src/emu/cpu/alph8201] | alph8201.c |
| [src/emu/cpu/am29000] | am29000.c am29ops.h |
| [src/emu/cpu/apexc] | apexcdsm.c |
| [src/emu/cpu/cop400] | cop400.c cop400.h |
| [src/emu/cpu/dsp56k] | dsp56ops.c |
| [src/emu/cpu/e132xs] | e132xs.c |
| [src/emu/cpu/f8] | f8.c |
| [src/emu/cpu/hcd62121] | hcd62121.c |
| [src/emu/cpu/i86] | i86.c |
| [src/emu/cpu/i860] | i860.h |
| [src/emu/cpu/lr35902] | lr35902d.c |
| [src/emu/cpu/m6502] | m4510.c m6502.c m6509.c m65ce02.c |
| [src/emu/cpu/m68000] | m68kcpu.h |
| [src/emu/cpu/minx] | minxd.c |
| [src/emu/cpu/mips] | mips3com.h mips3drc.c |
| [src/emu/cpu/mn10200] | mn10200.c |
| [src/emu/cpu/pic16c5x] | 16c5xdsm.c |
| [src/emu/cpu/pic16c62x] | 16c62xdsm.c |
| [src/emu/cpu/powerpc] | ppccom.h ppcdrc.c |
| [src/emu/cpu/psx] | psx.h |
| [src/emu/cpu/rsp] | rsp.h rspdrc.c |
| [src/emu/cpu/saturn] | saturnds.c |
| [src/emu/cpu/se3208] | se3208dis.c |
| [src/emu/cpu/sharc] | sharc.c |
| [src/emu/cpu/sm8500] | sm8500d.c |
| [src/emu/cpu/tlcs90] | tlcs90.c tlcs90.h |
| [src/emu/cpu/tms32010] | 32010dsm.c tms32010.c |
| [src/emu/cpu/tms32025] | 32025dsm.c tms32025.c |
| [src/emu/cpu/tms34010] | tms34010.c |
| [src/emu/cpu/tms7000] | tms7000.c |
| [src/emu/cpu/tms9900] | 9900dasm.c 99xxcore.h tms9900.h tms9900l.h tms9995.h |
| [src/emu/cpu/unsp] | unsp.h |
| [src/emu/cpu/z180] | z180dasm.c |
| [src/emu/cpu/z80] | z80dasm.c |
| [src/emu/cpu/z8000] | z8000.c z8000cpu.h |
| [src/emu/debug] | textbuf.c textbuf.h |
| [src/emu/imagedev] | cassette.h |
| [src/emu/machine] | 74181.c pic8259.c scsicb.h tms9901.h tms9902.h |
| [src/emu/sound] | aica.c aicadsp.c aicadsp.h aicalfo.c disc_wav.h discrete.h k007232.c multipcm.c nes_defs.h scsp.c scspdsp.c scspdsp.h scsplfo.c sid.c sid.h sid6581.c sidvoice.h sn76496.h tms5220.h wavwrite.c wavwrite.h ymdeltat.h ymf278b.c |
| [src/emu/video] | huc6270.h poly.c poly.h vooddefs.h |
| [src/lib/formats] | cassimg.c cassimg.h flopimg.c flopimg.h |
| [src/lib/util] | aviio.c aviio.h cdrom.c cdrom.h corefile.c corefile.h opresolv.c opresolv.h palette.c palette.h png.h pool.c pool.h un7z.h unzip.h |
| [src/mame/audio] | exidy440.c micro3d.c snes_snd.c snk6502.c tx1.c |
| [src/mame/drivers] | atarisy4.c bfcobra.c cobra.c |
| [src/mame/includes] | atari.h irobot.h micro3d.h model2.h model3.h n64.h seta.h vectrex.h vertigo.h |
| [src/mame/machine] | decocass.c gaelco3d.c pckeybrd.c snes7110.c snesbsx.c snesobc1.c snesrtc.c snessdd1.c steppers.c tait8741.c |
| [src/mame/video] | atarirle.c atarirle.h bfm_dm01.c dc.c mcd212.h midzeus2.c model2.c model3.c n64.h vrender0.c ygv608.c ygv608.h |
| [src/mess/audio] | spchroms.h wswan.c |
| [src/mess/drivers] | vboy.c |
| [src/mess/includes] | coco.h enterp.h kaypro.h lisa.h odyssey2.h pdp1.h rmnimbus.h tx0.h |
| [src/mess/machine] | 990_hd.c 990_tap.c amigacd.c cococart.h corvushd.c i8271.h kay_kbd.c mac.c nes_unif.c rmnimbus.c smartmed.c smc92x4.h strata.c thomflop.c upd7002.c upd7002.h upd765.h |
| [src/mess/machine/ti99] | datamux.h evpc.h genboard.h grom.h gromport.h joyport.h mapper8.h peribox.h speech8.h ti99_hd.h videowrp.h |
| [src/mess/tools/imgtool] | filter.h imgtool.c library.c library.h stream.c stream.h |
| [src/mess/tools/imgtool/modules] | concept.c mac.c ti99.c ti990hd.c vzdos.c |
| [src/mess/video] | 733_asr.c 733_asr.h 911_chr.h 911_vdt.c 911_vdt.h epnick.c gime.h k1ge.c mc6847.h pc_aga.h |
| [src/osd] | osdcore.h osdnet.h |
| [src/osd/osdmini] | miniwork.c |
| [src/osd/sdl] | debugwin.c draw13.c drawogl.c drawsdl.c dview.h osd_opengl.h sdldir.c sdlfile.h sdlsync.h sdlsync_ntc.c sdlsync_os2.c sdlsync_sdl.c sdlsync_tc.c sdlsync_win32.c sdlwork.c |
| [src/osd/windows] | d3dintf.h debugwin.c ledutil.c vconv.c windir.c window.c winfile.h winsync.c winwork.c |
| [src/tools] | jedutil.c romcmp.c unidasm.c |
| r17917 | r17918 | |
|---|---|---|
| 20 | 20 | * |
| 21 | 21 | *************************************/ |
| 22 | 22 | |
| 23 | ||
| 23 | ||
| 24 | 24 | { |
| 25 | 25 | double a0, a1, a2; /* Numerator coefficients */ |
| 26 | 26 | double b0, b1, b2; /* Denominator coefficients */ |
| 27 | } | |
| 27 | } | |
| 28 | 28 | |
| 29 | ||
| 29 | ||
| 30 | 30 | { |
| 31 | 31 | float *history; |
| 32 | 32 | float *coef; |
| 33 | 33 | double fs; |
| 34 | 34 | biquad ProtoCoef[2]; |
| 35 | } | |
| 35 | } | |
| 36 | 36 | |
| 37 | 37 | struct filter_state |
| 38 | 38 | { |
| r17917 | r17918 | |
| 40 | 40 | double exponent; |
| 41 | 41 | }; |
| 42 | 42 | |
| 43 | ||
| 43 | ||
| 44 | 44 | { |
| 45 | 45 | union |
| 46 | 46 | { |
| r17917 | r17918 | |
| 62 | 62 | filter_state noise_filters[4]; |
| 63 | 63 | lp_filter filter; |
| 64 | 64 | sound_stream *stream; |
| 65 | } | |
| 65 | } | |
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | /************************************* |
| r17917 | r17918 | |
|---|---|---|
| 29 | 29 | #define FRAC_ONE (1 << FRAC_BITS) |
| 30 | 30 | #define FRAC_MASK (FRAC_ONE - 1) |
| 31 | 31 | |
| 32 | ||
| 32 | ||
| 33 | 33 | { |
| 34 | 34 | int mute; |
| 35 | 35 | int offset; |
| r17917 | r17918 | |
| 39 | 39 | INT32 sample_step; |
| 40 | 40 | INT32 sample_cur; |
| 41 | 41 | INT16 form[16]; |
| 42 | } | |
| 42 | } | |
| 43 | 43 | |
| 44 | 44 | struct snk6502_sound_state |
| 45 | 45 | { |
| r17917 | r17918 | |
|---|---|---|
| 38 | 38 | |
| 39 | 39 | |
| 40 | 40 | /* channel_data structure holds info about each 6844 DMA channel */ |
| 41 | ||
| 41 | ||
| 42 | 42 | { |
| 43 | 43 | int active; |
| 44 | 44 | int address; |
| r17917 | r17918 | |
| 46 | 46 | UINT8 control; |
| 47 | 47 | int start_address; |
| 48 | 48 | int start_counter; |
| 49 | } | |
| 49 | } | |
| 50 | 50 | |
| 51 | 51 | |
| 52 | 52 | /* channel_data structure holds info about each active sound channel */ |
| 53 | ||
| 53 | ||
| 54 | 54 | { |
| 55 | 55 | INT16 *base; |
| 56 | 56 | int offset; |
| 57 | 57 | int remaining; |
| 58 | } | |
| 58 | } | |
| 59 | 59 | |
| 60 | 60 | |
| 61 | 61 | /* sound_cache_entry structure contains info on each decoded sample */ |
| 62 | ||
| 62 | ||
| 63 | 63 | { |
| 64 | 64 | struct sound_cache_entry *next; |
| 65 | 65 | int address; |
| r17917 | r17918 | |
| 67 | 67 | int bits; |
| 68 | 68 | int frequency; |
| 69 | 69 | INT16 data[1]; |
| 70 | } | |
| 70 | } | |
| 71 | 71 | |
| 72 | 72 | |
| 73 | 73 |
| r17917 | r17918 | |
|---|---|---|
| 16 | 16 | * 8253 Programmable Interval Timer |
| 17 | 17 | * |
| 18 | 18 | *************************************/ |
| 19 | struct | |
| 19 | struct | |
| 20 | 20 | { |
| 21 | 21 | union |
| 22 | 22 | { |
| r17917 | r17918 | |
| 39 | 39 | UINT32 m_step1; |
| 40 | 40 | UINT32 m_step2; |
| 41 | 41 | |
| 42 | | |
| 42 | | |
| 43 | 43 | |
| 44 | 44 | UINT8 m_ay_outputa; |
| 45 | 45 | UINT8 m_ay_outputb; |
| r17917 | r17918 | |
|---|---|---|
| 157 | 157 | TYPE DEFINITIONS |
| 158 | 158 | ***************************************************************************/ |
| 159 | 159 | |
| 160 | ||
| 160 | ||
| 161 | 161 | { |
| 162 | 162 | ATTACK, |
| 163 | 163 | DECAY, |
| 164 | 164 | SUSTAIN, |
| 165 | 165 | RELEASE |
| 166 | } | |
| 166 | } | |
| 167 | 167 | |
| 168 | 168 | ALLOW_SAVE_TYPE(env_state_t32); |
| 169 | 169 | |
| 170 | ||
| 170 | ||
| 171 | 171 | { |
| 172 | 172 | UINT16 mem_ptr; /* Sample data memory pointer */ |
| 173 | 173 | int end; /* End or loop after block */ |
| r17917 | r17918 | |
| 186 | 186 | INT32 smp1; /* Last sample (for BRR filter) */ |
| 187 | 187 | INT32 smp2; /* Second-to-last sample decoded*/ |
| 188 | 188 | short sampbuf[4]; /* Buffer for Gaussian interp */ |
| 189 | } | |
| 189 | } | |
| 190 | 190 | |
| 191 | ||
| 191 | ||
| 192 | 192 | { |
| 193 | 193 | UINT16 vptr; /* Ptr to start of sample data */ |
| 194 | 194 | UINT16 lptr; /* Loop pointer in sample data */ |
| 195 | } | |
| 195 | } | |
| 196 | 196 | |
| 197 | 197 | |
| 198 | 198 | struct snes_sound_state |
| r17917 | r17918 | |
|---|---|---|
| 118 | 118 | { 31, 31 }, |
| 119 | 119 | }; |
| 120 | 120 | |
| 121 | ||
| 121 | ||
| 122 | 122 | { |
| 123 | 123 | running_machine &machine() const { assert(m_machine != NULL); return *m_machine; } |
| 124 | 124 | |
| r17917 | r17918 | |
| 142 | 142 | UINT32 morton32[4][256]; |
| 143 | 143 | |
| 144 | 144 | UINT32 rom_size; |
| 145 | } | |
| 145 | } | |
| 146 | 146 | |
| 147 | 147 | static SPC7110Decomp* SPC7110Decomp_ctor(running_machine &machine, UINT32 size); |
| 148 | 148 | static void SPC7110Decomp_reset(SPC7110Decomp *thisptr); |
| r17917 | r17918 | |
| 788 | 788 | |
| 789 | 789 | static const UINT32 spc7110_months[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; |
| 790 | 790 | |
| 791 | struct | |
| 791 | struct | |
| 792 | 792 | { |
| 793 | 793 | //================== |
| 794 | 794 | //decompression unit |
| r17917 | r17918 | |
| 873 | 873 | UINT32 size; |
| 874 | 874 | }; |
| 875 | 875 | |
| 876 | static | |
| 876 | static | |
| 877 | 877 | |
| 878 | 878 | static void spc7110_init(running_machine& machine) |
| 879 | 879 | { |
| r17917 | r17918 | |
|---|---|---|
| 21 | 21 | }; |
| 22 | 22 | |
| 23 | 23 | |
| 24 | struct | |
| 24 | struct | |
| 25 | 25 | { |
| 26 | 26 | // base regs |
| 27 | 27 | // we don't emulate the base unit yet |
| r17917 | r17918 | |
| 42 | 42 | int ram_source; |
| 43 | 43 | }; |
| 44 | 44 | |
| 45 | static s | |
| 45 | static s | |
| 46 | 46 | |
| 47 | 47 | |
| 48 | 48 | static void bsx_update_memory_map(void) |
| r17917 | r17918 | |
|---|---|---|
| 167 | 167 | |
| 168 | 168 | #define AT_KEYBOARD_QUEUE_MAXSIZE 256 |
| 169 | 169 | |
| 170 | ||
| 170 | ||
| 171 | 171 | { |
| 172 | 172 | AT_KEYBOARD_TYPE type; |
| 173 | 173 | int on; |
| r17917 | r17918 | |
| 184 | 184 | int last_code; |
| 185 | 185 | |
| 186 | 186 | ioport_port *ports[8]; |
| 187 | } | |
| 187 | } | |
| 188 | 188 | |
| 189 | 189 | static at_keyboard keyboard; |
| 190 | 190 | |
| 191 | ||
| 191 | ||
| 192 | 192 | { |
| 193 | 193 | const char *pressed; |
| 194 | 194 | const char *released; |
| 195 | } | |
| 195 | } | |
| 196 | 196 | |
| 197 | 197 | |
| 198 | 198 | static const extended_keyboard_code keyboard_mf2_code[0x10][2/*numlock off, on*/]={ |
| r17917 | r17918 | |
|---|---|---|
| 91 | 91 | buf_t buf[2]; |
| 92 | 92 | }; |
| 93 | 93 | |
| 94 | ||
| 94 | ||
| 95 | 95 | |
| 96 | 96 | struct gaelco_serial_state |
| 97 | 97 | { |
| r17917 | r17918 | |
| 110 | 110 | shmem_t *m_shmem; |
| 111 | 111 | }; |
| 112 | 112 | |
| 113 | struct | |
| 113 | struct | |
| 114 | 114 | { |
| 115 | 115 | char *fn; |
| 116 | 116 | size_t size; |
| r17917 | r17918 | |
|---|---|---|
| 533 | 533 | SDD1_OL_launch(thisptr->OL); |
| 534 | 534 | } |
| 535 | 535 | |
| 536 | ||
| 536 | ||
| 537 | 537 | { |
| 538 | 538 | UINT8 sdd1_enable; // channel bit-mask |
| 539 | 539 | UINT8 xfer_enable; // channel bit-mask |
| r17917 | r17918 | |
| 553 | 553 | UINT32 size; // length of data buffer; reads decrement counter, set ready to false at 0 |
| 554 | 554 | UINT8 ready; // 1 when data[] is valid; 0 to invoke sdd1emu.decompress() |
| 555 | 555 | } buffer; |
| 556 | } | |
| 556 | } | |
| 557 | 557 | |
| 558 | static | |
| 558 | static | |
| 559 | 559 | |
| 560 | 560 | static void sdd1_init(running_machine& machine) |
| 561 | 561 | { |
| r17917 | r17918 | |
|---|---|---|
| 12 | 12 | |
| 13 | 13 | ***************************************************************************/ |
| 14 | 14 | |
| 15 | struct | |
| 15 | struct | |
| 16 | 16 | { |
| 17 | 17 | int address; |
| 18 | 18 | int offset; |
| 19 | 19 | int shift; |
| 20 | 20 | }; |
| 21 | 21 | |
| 22 | static s | |
| 22 | static s | |
| 23 | 23 | |
| 24 | 24 | |
| 25 | 25 | static READ8_HANDLER( obc1_read ) |
| r17917 | r17918 | |
|---|---|---|
| 1831 | 1831 | ***************************************************************************/ |
| 1832 | 1832 | |
| 1833 | 1833 | /* regions within the virtual tape */ |
| 1834 | enum | |
| 1834 | enum | |
| 1835 | 1835 | { |
| 1836 | 1836 | REGION_LEADER, /* in clear leader section */ |
| 1837 | 1837 | REGION_LEADER_GAP, /* in gap between leader and BOT */ |
| r17917 | r17918 | |
| 1844 | 1844 | REGION_TRAILER_GAP, /* in gap between trailer and EOT */ |
| 1845 | 1845 | REGION_TRAILER /* in clear trailer section */ |
| 1846 | 1846 | }; |
| 1847 | typedef enum _tape_region tape_region; | |
| 1848 | 1847 | |
| 1849 | 1848 | |
| 1850 | 1849 | /* bytes within a data block on a virtual tape */ |
| 1851 | enum | |
| 1850 | enum | |
| 1852 | 1851 | { |
| 1853 | 1852 | BYTE_PRE_GAP_0, /* 34 bytes of gap, clock held to 0, no data */ |
| 1854 | 1853 | BYTE_PRE_GAP_33 = BYTE_PRE_GAP_0 + 33, |
| r17917 | r17918 | |
| 1865 | 1864 | BYTE_POSTGAP_33 = BYTE_POSTGAP_0 + 33, |
| 1866 | 1865 | BYTE_BLOCK_TOTAL /* total number of bytes in block */ |
| 1867 | 1866 | }; |
| 1868 | typedef enum _tape_byte tape_byte; | |
| 1869 | 1867 | |
| 1870 | 1868 | |
| 1871 | 1869 | /* state of the tape */ |
| r17917 | r17918 | |
|---|---|---|
| 22 | 22 | RTCM_Write |
| 23 | 23 | }; |
| 24 | 24 | |
| 25 | struct | |
| 25 | struct | |
| 26 | 26 | { |
| 27 | 27 | UINT8 ram[13]; |
| 28 | 28 | INT32 mode; |
| 29 | 29 | INT8 index; |
| 30 | 30 | }; |
| 31 | 31 | |
| 32 | static | |
| 32 | static | |
| 33 | 33 | |
| 34 | 34 | static const UINT8 srtc_months[12] = |
| 35 | 35 | { |
| r17917 | r17918 | |
|---|---|---|
| 31 | 31 | #define CMD_08 1 |
| 32 | 32 | #define CMD_4a 2 |
| 33 | 33 | |
| 34 | ||
| 34 | ||
| 35 | 35 | UINT8 toData; /* to host data */ |
| 36 | 36 | UINT8 fromData; /* from host data */ |
| 37 | 37 | UINT8 fromCmd; /* from host command */ |
| r17917 | r17918 | |
| 48 | 48 | int coins; |
| 49 | 49 | read8_space_func portHandler; |
| 50 | 50 | const char *portName; |
| 51 | } | |
| 51 | } | |
| 52 | 52 | |
| 53 | 53 | static const struct TAITO8741interface *intf; |
| 54 | 54 | //static I8741 *taito8741; |
| r17917 | r17918 | |
| 380 | 380 | |
| 381 | 381 | static int josvolly_nmi_enable; |
| 382 | 382 | |
| 383 | ||
| 383 | ||
| 384 | 384 | UINT8 cmd; |
| 385 | 385 | UINT8 sts; |
| 386 | 386 | UINT8 txd; |
| r17917 | r17918 | |
| 391 | 391 | UINT8 rst; |
| 392 | 392 | |
| 393 | 393 | const char *initReadPort; |
| 394 | } | |
| 394 | } | |
| 395 | 395 | |
| 396 | 396 | static JV8741 i8741[4]; |
| 397 | 397 |
| r17917 | r17918 | |
|---|---|---|
| 47 | 47 | |
| 48 | 48 | /* local vars */ |
| 49 | 49 | |
| 50 | ||
| 50 | ||
| 51 | 51 | { |
| 52 | 52 | const stepper_interface *intf; |
| 53 | 53 | UINT8 pattern, /* coil pattern */ |
| r17917 | r17918 | |
| 64 | 64 | index_patt; /* pattern needed on coils (0=don't care) */ |
| 65 | 65 | |
| 66 | 66 | UINT8 optic; |
| 67 | } | |
| 67 | } | |
| 68 | 68 | |
| 69 | 69 | static stepper step[MAX_STEPPERS]; |
| 70 | 70 |
| r17917 | r17918 | |
|---|---|---|
| 12 | 12 | |
| 13 | 13 | #define MC_LENGTH 512 |
| 14 | 14 | |
| 15 | ||
| 15 | ||
| 16 | 16 | { |
| 17 | 17 | UINT32 ram[16]; /* internal ram */ |
| 18 | 18 | UINT32 d; /* direct data D input */ |
| 19 | 19 | UINT32 q; /* Q register */ |
| 20 | 20 | UINT32 f; /* F ALU result */ |
| 21 | 21 | UINT32 y; /* Y output */ |
| 22 | } | |
| 22 | } | |
| 23 | 23 | |
| 24 | 24 | class vector_generator |
| 25 | 25 | { |
| r17917 | r17918 | |
| 50 | 50 | running_machine *m_machine; |
| 51 | 51 | }; |
| 52 | 52 | |
| 53 | ||
| 53 | ||
| 54 | 54 | { |
| 55 | 55 | UINT32 x; |
| 56 | 56 | UINT32 a; |
| r17917 | r17918 | |
| 68 | 68 | UINT32 jmp; |
| 69 | 69 | UINT32 jcon; |
| 70 | 70 | UINT32 ma; |
| 71 | } | |
| 71 | } | |
| 72 | 72 | |
| 73 | ||
| 73 | ||
| 74 | 74 | { |
| 75 | 75 | UINT16 sram[64]; /* external sram */ |
| 76 | 76 | UINT16 ramlatch; /* latch between 2901 and sram */ |
| r17917 | r17918 | |
| 78 | 78 | UINT32 pc; /* program counter */ |
| 79 | 79 | UINT32 ret; /* return address */ |
| 80 | 80 | |
| 81 | } | |
| 81 | } | |
| 82 | 82 | |
| 83 | 83 | |
| 84 | 84 | class vertigo_state : public driver_device |
| r17917 | r17918 | |
|---|---|---|
| 1 | 1 | #include "video/poly.h" |
| 2 | 2 | |
| 3 | 3 | |
| 4 | typedef struct _raster_state raster_state; | |
| 5 | typedef struct _geo_state geo_state; | |
| 4 | struct raster_state; | |
| 5 | struct geo_state; | |
| 6 | 6 | |
| 7 | 7 | |
| 8 | 8 | class model2_state : public driver_device |
| r17917 | r17918 | |
|---|---|---|
| 10 | 10 | float x,y,z,d; |
| 11 | 11 | }; |
| 12 | 12 | |
| 13 | ||
| 13 | ||
| 14 | 14 | |
| 15 | 15 | class model3_state : public driver_device |
| 16 | 16 | { |
| r17917 | r17918 | |
|---|---|---|
| 6 | 6 | |
| 7 | 7 | #define __uPD71054_TIMER 1 |
| 8 | 8 | |
| 9 | typedef struct _uPD71054_state uPD71054_state; | |
| 10 | struct _uPD71054_state | |
| 9 | struct uPD71054_state | |
| 11 | 10 | { |
| 12 | 11 | emu_timer *timer[3]; // Timer |
| 13 | 12 | UINT16 max[3]; // Max counter |
| r17917 | r17918 | |
|---|---|---|
| 116 | 116 | virtual void video_reset(); |
| 117 | 117 | }; |
| 118 | 118 | |
| 119 | ||
| 119 | ||
| 120 | 120 | { |
| 121 | 121 | INT32 x, y, z; |
| 122 | } | |
| 122 | } | |
| 123 | 123 | |
| 124 | 124 | |
| 125 | 125 | /*----------- defined in machine/micro3d.c -----------*/ |
| r17917 | r17918 | |
|---|---|---|
| 169 | 169 | #define COPY8(dst,s1,s2) *dst++ = s1; *dst++ = s2 |
| 170 | 170 | #define COPY16(dst,s1,s2,s3,s4) *dst++ = s1; *dst++ = s2; *dst++ = s3; *dst++ = s4 |
| 171 | 171 | |
| 172 | ||
| 172 | ||
| 173 | 173 | UINT8 antic00; /* 00 nothing */ |
| 174 | 174 | UINT8 antic01; /* 01 nothing */ |
| 175 | 175 | UINT8 antic02; /* 02 nothing */ |
| r17917 | r17918 | |
| 186 | 186 | UINT8 penv; /* 0d light pen vertical pos */ |
| 187 | 187 | UINT8 antic0e; /* 0e nothing */ |
| 188 | 188 | UINT8 nmist; /* 0f NMI status */ |
| 189 | } | |
| 189 | } | |
| 190 | 190 | |
| 191 | ||
| 191 | ||
| 192 | 192 | UINT8 dmactl; /* 00 write DMA control */ |
| 193 | 193 | UINT8 chactl; /* 01 write character control */ |
| 194 | 194 | UINT8 dlistl; /* 02 display list low */ |
| r17917 | r17918 | |
| 205 | 205 | UINT8 antic0d; /* 0d nothing */ |
| 206 | 206 | UINT8 nmien; /* 0e NMI enable */ |
| 207 | 207 | UINT8 nmires; /* 0f NMI reset */ |
| 208 | } | |
| 208 | } | |
| 209 | 209 | |
| 210 | 210 | /* per scanline buffer for video data (and optimization variables) */ |
| 211 | 211 | struct VIDEO { |
| r17917 | r17918 | |
|---|---|---|
| 6 | 6 | |
| 7 | 7 | #define IR_TIMING 1 /* try to emulate MB and VG running time */ |
| 8 | 8 | |
| 9 | ||
| 9 | ||
| 10 | 10 | { |
| 11 | 11 | const struct irmb_ops *nxtop; |
| 12 | 12 | UINT32 func; |
| r17917 | r17918 | |
| 18 | 18 | UINT8 diren; |
| 19 | 19 | UINT8 flags; |
| 20 | 20 | UINT8 ramsel; |
| 21 | } | |
| 21 | } | |
| 22 | 22 | |
| 23 | 23 | |
| 24 | 24 | class irobot_state : public driver_device |
| r17917 | r17918 | |
|---|---|---|
| 11 | 11 | |
| 12 | 12 | #define NVECT 10000 |
| 13 | 13 | |
| 14 | ||
| 14 | ||
| 15 | 15 | { |
| 16 | 16 | int x; int y; |
| 17 | 17 | rgb_t col; |
| 18 | 18 | int intensity; |
| 19 | } | |
| 19 | } | |
| 20 | 20 | |
| 21 | 21 | class vectrex_state : public driver_device |
| 22 | 22 | { |
| r17917 | r17918 | |
|---|---|---|
| 42 | 42 | class n64_periphs : public device_t |
| 43 | 43 | { |
| 44 | 44 | private: |
| 45 | | |
| 45 | | |
| 46 | 46 | { |
| 47 | 47 | UINT32 address; |
| 48 | 48 | UINT32 length; |
| 49 | } | |
| 49 | } | |
| 50 | 50 | |
| 51 | 51 | public: |
| 52 | 52 | // construction/destruction |
| r17917 | r17918 | |
|---|---|---|
| 60 | 60 | UINT8 weight_factor_b[768]; |
| 61 | 61 | }; |
| 62 | 62 | |
| 63 | ||
| 63 | ||
| 64 | 64 | { |
| 65 | 65 | running_machine &machine() const { assert(m_machine != NULL); return *m_machine; } |
| 66 | 66 | |
| r17917 | r17918 | |
| 71 | 71 | |
| 72 | 72 | running_machine *m_machine; |
| 73 | 73 | bitmap_rgb32 m_bitmap; |
| 74 | } | |
| 74 | } | |
| 75 | 75 | |
| 76 | 76 | #define MCD212_CURCNT_COLOR 0x00000f // Cursor color |
| 77 | 77 | #define MCD212_CURCNT_CUW 0x008000 // Cursor width |
| r17917 | r17918 | |
|---|---|---|
| 555 | 555 | // - regardless of the visible display dimensions |
| 556 | 556 | rectangle spriteClip(0, 512, 0, 512); |
| 557 | 557 | |
| 558 | | |
| 558 | | |
| 559 | 559 | int flipx = 0, flipy = 0; |
| 560 | 560 | int i; |
| 561 | 561 |
| r17917 | r17918 | |
|---|---|---|
| 126 | 126 | }; |
| 127 | 127 | |
| 128 | 128 | |
| 129 | ||
| 129 | ||
| 130 | 130 | UINT8 na; // P#0 - pattern name table data port (read/write) |
| 131 | 131 | UINT8 p1; // P#1 - sprite data port (read/write) |
| 132 | 132 | UINT8 p2; // P#2 - scroll data port (read/write) |
| r17917 | r17918 | |
| 135 | 135 | UINT8 p5; // P#5 - register select port (write only) |
| 136 | 136 | UINT8 p6; // P#6 - status port (read/write) |
| 137 | 137 | UINT8 p7; // P#7 - system control port (read/write) |
| 138 | } | |
| 138 | } | |
| 139 | 139 | |
| 140 | ||
| 140 | ||
| 141 | 141 | UINT8 r0; // R#0 - pattern name table access ptr (r/w) |
| 142 | 142 | UINT8 r1; // R#1 - pattern name table access ptr (r/w) |
| 143 | 143 | UINT8 r2; // R#2 - built in ram access control |
| r17917 | r17918 | |
| 205 | 205 | UINT8 tb13; |
| 206 | 206 | UINT8 tn4; |
| 207 | 207 | |
| 208 | } | |
| 208 | } | |
| 209 | 209 | |
| 210 | 210 | #define YGV608_MAX_SPRITES (YGV608_SPRITE_ATTR_TABLE_SIZE>>2) |
| 211 | 211 | |
| r17917 | r17918 | |
| 272 | 272 | #define VDW_SHIFT 0 |
| 273 | 273 | #define VDW_MASK 0x3f |
| 274 | 274 | |
| 275 | ||
| 275 | ||
| 276 | 276 | UINT8 sy; // y dot position 7:0 |
| 277 | 277 | UINT8 sx; // x dot position 7:0 |
| 278 | 278 | UINT8 attr; // 0xf0 = color, 0x0c = size, reverse, 0x02 = x hi bit, 0x01 = y hi bit |
| 279 | 279 | UINT8 sn; // pattern name (0-255) |
| 280 | } | |
| 280 | } | |
| 281 | 281 | |
| 282 | 282 | |
| 283 | ||
| 283 | ||
| 284 | 284 | |
| 285 | 285 | union { |
| 286 | 286 | UINT8 b[8]; |
| r17917 | r17918 | |
| 326 | 326 | UINT8 screen_resize; // screen requires resize |
| 327 | 327 | UINT8 tilemap_resize; // tilemap requires resize |
| 328 | 328 | |
| 329 | } | |
| 329 | } | |
| 330 | 330 | |
| 331 | 331 | |
| 332 | 332 | void ygv608_set_gfxbank(UINT8 gfxbank); |
| r17917 | r17918 | |
|---|---|---|
| 129 | 129 | INT16 center[2]; |
| 130 | 130 | }; |
| 131 | 131 | |
| 132 | struct | |
| 132 | struct | |
| 133 | 133 | { |
| 134 | 134 | poly_vertex v[4]; |
| 135 | 135 | UINT16 z; |
| r17917 | r17918 | |
| 297 | 297 | |
| 298 | 298 | #define MAX_TRIANGLES 32768 |
| 299 | 299 | |
| 300 | struct | |
| 300 | struct | |
| 301 | 301 | { |
| 302 | 302 | UINT32 mode; /* bit 0 = Test Mode, bit 2 = Switch 60Hz(1)/30Hz(0) operation */ |
| 303 | 303 | UINT16 * texture_rom; /* Texture ROM pointer */ |
| r17917 | r17918 | |
| 356 | 356 | |
| 357 | 357 | static void model2_3d_process_quad( raster_state *raster, UINT32 attr ) |
| 358 | 358 | { |
| 359 | | |
| 359 | | |
| 360 | 360 | UINT16 *th, *tp; |
| 361 | 361 | INT32 tho; |
| 362 | 362 | UINT32 cull, i; |
| r17917 | r17918 | |
| 1282 | 1282 | * |
| 1283 | 1283 | *******************************************/ |
| 1284 | 1284 | |
| 1285 | struct | |
| 1285 | struct | |
| 1286 | 1286 | { |
| 1287 | 1287 | raster_state * raster; |
| 1288 | 1288 | UINT32 mode; /* bit 0 = Enable Specular, bit 1 = Calculate Normals */ |
| r17917 | r17918 | |
|---|---|---|
| 136 | 136 | static bitmap_rgb32 *fake_accumulationbuffer_bitmap; |
| 137 | 137 | static void render_to_accumulation_buffer(running_machine &machine,bitmap_rgb32 &bitmap,const rectangle &cliprect); |
| 138 | 138 | |
| 139 | ||
| 139 | ||
| 140 | 140 | UINT32 address, vqbase; |
| 141 | 141 | int textured, sizex, sizey, stride, sizes, pf, palette, mode, mipmapped, blend_mode, filter_mode, flip_u, flip_v; |
| 142 | 142 | |
| 143 | 143 | UINT32 (*r)(running_machine &machine, struct texinfo *t, float x, float y); |
| 144 | 144 | UINT32 (*blend)(UINT32 s, UINT32 d); |
| 145 | 145 | int palbase, cd; |
| 146 | } | |
| 146 | } | |
| 147 | 147 | |
| 148 | 148 | typedef struct |
| 149 | 149 | { |
| r17917 | r17918 | |
|---|---|---|
| 77 | 77 | static float zbase; |
| 78 | 78 | |
| 79 | 79 | #if TRACK_REG_USAGE |
| 80 | ||
| 80 | ||
| 81 | 81 | { |
| 82 | 82 | struct reg_info *next; |
| 83 | 83 | UINT32 value; |
| 84 | } | |
| 84 | } | |
| 85 | 85 | |
| 86 | 86 | static reg_info *regdata[0x80]; |
| 87 | 87 | static int regdata_count[0x80]; |
| r17917 | r17918 | |
|---|---|---|
| 23 | 23 | UINT32 color; |
| 24 | 24 | }; |
| 25 | 25 | |
| 26 | struct | |
| 26 | struct | |
| 27 | 27 | { |
| 28 | 28 | cached_texture *next; |
| 29 | 29 | UINT8 width; |
| r17917 | r17918 | |
|---|---|---|
| 27 | 27 | ***************************************************************************/ |
| 28 | 28 | |
| 29 | 29 | /* internal structure containing a word index, shift and mask */ |
| 30 | typedef struct atarirle_mask atarirle_mask; | |
| 31 | 30 | struct atarirle_mask |
| 32 | 31 | { |
| 33 | 32 | int word; /* word index */ |
| r17917 | r17918 | |
| 36 | 35 | }; |
| 37 | 36 | |
| 38 | 37 | /* internal structure for sorting the motion objects */ |
| 39 | typedef struct mo_sort_entry mo_sort_entry; | |
| 40 | 38 | struct mo_sort_entry |
| 41 | 39 | { |
| 42 | 40 | mo_sort_entry * next; |
| r17917 | r17918 | |
| 44 | 42 | }; |
| 45 | 43 | |
| 46 | 44 | /* internal structure describing each object in the ROMs */ |
| 47 | typedef struct atarirle_info atarirle_info; | |
| 48 | 45 | struct atarirle_info |
| 49 | 46 | { |
| 50 | 47 | INT16 width; |
| r17917 | r17918 | |
| 57 | 54 | }; |
| 58 | 55 | |
| 59 | 56 | /* internal structure containing the state of the motion objects */ |
| 60 | typedef struct atarirle_data atarirle_data; | |
| 61 | 57 | struct atarirle_data |
| 62 | 58 | { |
| 63 | 59 | int bitmapwidth; /* width of the full playfield bitmap */ |
| r17917 | r17918 | |
|---|---|---|
| 35 | 35 | ***************************************************************************/ |
| 36 | 36 | |
| 37 | 37 | /* description for an eight-word mask */ |
| 38 | typedef struct atarirle_entry atarirle_entry; | |
| 39 | 38 | struct atarirle_entry |
| 40 | 39 | { |
| 41 | 40 | UINT16 data[8]; |
| 42 | 41 | }; |
| 43 | 42 | |
| 44 | 43 | /* description of the motion objects */ |
| 45 | typedef struct atarirle_desc atarirle_desc; | |
| 46 | 44 | struct atarirle_desc |
| 47 | 45 | { |
| 48 | 46 | const char * region; /* region where the GFX data lives */ |
| r17917 | r17918 | |
|---|---|---|
| 20 | 20 | |
| 21 | 21 | **************/ |
| 22 | 22 | |
| 23 | struct | |
| 23 | struct | |
| 24 | 24 | { |
| 25 | 25 | UINT16 *Dest; |
| 26 | 26 | UINT32 Pitch; //in UINT16s |
| r17917 | r17918 | |
| 50 | 50 | UINT32 DstColor; |
| 51 | 51 | }; |
| 52 | 52 | |
| 53 | struct | |
| 53 | struct | |
| 54 | 54 | { |
| 55 | 55 | UINT32 Tx; |
| 56 | 56 | UINT32 Ty; |
| r17917 | r17918 | |
| 81 | 81 | UINT16 InternalPalette[256]; |
| 82 | 82 | UINT32 LastPalUpdate; |
| 83 | 83 | |
| 84 | | |
| 84 | | |
| 85 | 85 | }; |
| 86 | 86 | |
| 87 | 87 | |
| r17917 | r17918 | |
| 135 | 135 | return RGB16(scr, scg, scb); |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | static UINT16 Alpha( | |
| 138 | static UINT16 Alpha( | |
| 139 | 139 | { |
| 140 | 140 | UINT32 scr = (EXTRACTR8(Src) * ((Quad->Shade >> 16) & 0xff)) >> 8; |
| 141 | 141 | UINT32 scg = (EXTRACTG8(Src) * ((Quad->Shade >> 8) & 0xff)) >> 8; |
| r17917 | r17918 | |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | #define TILENAME(bpp, t, a) \ |
| 241 | static void DrawQuad##bpp##t##a( | |
| 241 | static void DrawQuad##bpp##t##a( | |
| 242 | 242 | |
| 243 | 243 | //TRUST ON THE COMPILER OPTIMIZATIONS |
| 244 | 244 | #define TILETEMPL(bpp, t, a) \ |
| r17917 | r17918 | |
| 338 | 338 | DrawQuad##bpp##t##a |
| 339 | 339 | |
| 340 | 340 | |
| 341 | static void DrawQuadFill( | |
| 341 | static void DrawQuadFill( | |
| 342 | 342 | { |
| 343 | 343 | UINT32 x, y; |
| 344 | 344 | UINT16 *line = Quad->Dest; |
| r17917 | r17918 | |
| 358 | 358 | } |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | typedef void (*_DrawTemplate)( | |
| 361 | typedef void (*_DrawTemplate)( | |
| 362 | 362 | |
| 363 | 363 | static const _DrawTemplate DrawImage[]= |
| 364 | 364 | { |
| r17917 | r17918 | |
| 486 | 486 | |
| 487 | 487 | if (Packet0 & 0x100) |
| 488 | 488 | { |
| 489 | | |
| 489 | | |
| 490 | 490 | |
| 491 | 491 | Quad.Pitch = 512; |
| 492 | 492 |
| r17917 | r17918 | |
|---|---|---|
| 52 | 52 | |
| 53 | 53 | #define LOG(x) do { if (VERBOSE) logerror x; } while (0) |
| 54 | 54 | |
| 55 | ||
| 55 | ||
| 56 | 56 | { |
| 57 | 57 | const bfmdm01_interface *intf; |
| 58 | 58 | int data_avail, |
| r17917 | r17918 | |
| 64 | 64 | UINT8 scanline[DM_BYTESPERROW], |
| 65 | 65 | comdata; |
| 66 | 66 | |
| 67 | } | |
| 67 | } | |
| 68 | 68 | |
| 69 | 69 | static bfmdm01 dm01; |
| 70 | 70 | /////////////////////////////////////////////////////////////////////////// |
| r17917 | r17918 | |
|---|---|---|
| 620 | 620 | bool m_pending_mode_block; |
| 621 | 621 | bool m_pipe_clean; |
| 622 | 622 | |
| 623 | | |
| 623 | | |
| 624 | 624 | { |
| 625 | 625 | UINT8 cvg; |
| 626 | 626 | UINT8 cvbit; |
| 627 | 627 | UINT8 xoff; |
| 628 | 628 | UINT8 yoff; |
| 629 | } | |
| 629 | } | |
| 630 | 630 | CVMASKDERIVATIVE cvarray[(1 << 8)]; |
| 631 | 631 | |
| 632 | 632 | UINT16 z_com_table[0x40000]; //precalced table of compressed z values, 18b: 512 KB array! |
| r17917 | r17918 | |
|---|---|---|
| 101 | 101 | |
| 102 | 102 | ***************************************************************************/ |
| 103 | 103 | |
| 104 | ||
| 104 | ||
| 105 | 105 | { |
| 106 | 106 | #ifdef LSB_FIRST |
| 107 | 107 | struct { UINT16 loword, hiword ; } ; |
| r17917 | r17918 | |
| 111 | 111 | struct { UINT8 addr2, addr1, addr0; }; |
| 112 | 112 | #endif |
| 113 | 113 | UINT32 addr; |
| 114 | } | |
| 114 | } | |
| 115 | 115 | |
| 116 | 116 | /* Blitter register flag bits */ |
| 117 | 117 | #define CMD_RUN 0x01 |
| r17917 | r17918 | |
|---|---|---|
| 68 | 68 | * |
| 69 | 69 | *************************************/ |
| 70 | 70 | |
| 71 | struct | |
| 71 | struct | |
| 72 | 72 | { |
| 73 | 73 | /* Memory-mapped registers */ |
| 74 | 74 | UINT16 gr[8]; /* Command parameters */ |
| r17917 | r17918 | |
|---|---|---|
| 437 | 437 | class cobra_fifo |
| 438 | 438 | { |
| 439 | 439 | public: |
| 440 | | |
| 440 | | |
| 441 | 441 | { |
| 442 | 442 | EVENT_EMPTY, |
| 443 | 443 | EVENT_HALF_FULL, |
| 444 | 444 | EVENT_FULL, |
| 445 | } | |
| 445 | } | |
| 446 | 446 | |
| 447 | 447 | typedef delegate<void (EventType)> event_delegate; |
| 448 | 448 |
| r17917 | r17918 | |
|---|---|---|
| 144 | 144 | }; |
| 145 | 145 | |
| 146 | 146 | |
| 147 | ||
| 147 | ||
| 148 | 148 | |
| 149 | 149 | typedef void (*print_product_terms_func)(const pal_data* pal, const jed_data* jed); |
| 150 | 150 | |
| 151 | struct | |
| 151 | struct | |
| 152 | 152 | { |
| 153 | 153 | const char *name; |
| 154 | 154 | const pin_fuse_rows *pinfuserows; |
| r17917 | r17918 | |
|---|---|---|
| 40 | 40 | #include "emu.h" |
| 41 | 41 | #include <ctype.h> |
| 42 | 42 | |
| 43 | enum | |
| 43 | enum | |
| 44 | 44 | { |
| 45 | 45 | _8bit, |
| 46 | 46 | _8bitx, |
| r17917 | r17918 | |
| 59 | 59 | _64be, |
| 60 | 60 | _64le |
| 61 | 61 | }; |
| 62 | typedef enum _display_type display_type; | |
| 63 | 62 | |
| 64 | 63 | |
| 65 | 64 | struct dasm_table_entry |
| r17917 | r17918 | |
|---|---|---|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | struct | |
| 106 | struct | |
| 107 | 107 | { |
| 108 | 108 | char name[MAX_FILENAME_LEN+1]; |
| 109 | 109 | int size; |
| 110 | 110 | unsigned char *buf; /* file is read in here */ |
| 111 | 111 | int listed; |
| 112 | 112 | }; |
| 113 | typedef struct _fileinfo fileinfo; | |
| 114 | 113 | |
| 115 | 114 | static fileinfo files[2][MAX_FILES]; |
| 116 | 115 | static float matchscore[MAX_FILES][MAX_FILES][TOTAL_MODES][TOTAL_MODES]; |
| r17917 | r17918 | |
|---|---|---|
| 8 | 8 | #define CREATE_NETDEV(name) class netdev *name(const char *ifname, class device_network_interface *ifdev, int rate) |
| 9 | 9 | typedef class netdev *(*create_netdev)(const char *ifname, class device_network_interface *ifdev, int rate); |
| 10 | 10 | |
| 11 | ||
| 11 | ||
| 12 | 12 | { |
| 13 | 13 | int id; |
| 14 | 14 | char name[256]; |
| 15 | 15 | char description[256]; |
| 16 | 16 | create_netdev func; |
| 17 | struct netdev_entry *m_next; | |
| 18 | } netdev_entry_t; | |
| 17 | netdev_entry_t *m_next; | |
| 18 | }; | |
| 19 | 19 | |
| 20 | 20 | class netdev |
| 21 | 21 | { |
| r17917 | r17918 | |
|---|---|---|
| 37 | 37 | // TYPES |
| 38 | 38 | //============================================================ |
| 39 | 39 | |
| 40 | ||
| 40 | ||
| 41 | 41 | |
| 42 | 42 | #if (SDLMAME_SDL2) |
| 43 | 43 | #define DRAW2_SCALEMODE_NEAREST "0" |
| r17917 | r17918 | |
| 75 | 75 | int old_blitheight; |
| 76 | 76 | }; |
| 77 | 77 | |
| 78 | struct | |
| 78 | struct | |
| 79 | 79 | { |
| 80 | 80 | const char *name; |
| 81 | 81 | int is_scale; /* Scale mode? */ |
| r17917 | r17918 | |
|---|---|---|
| 65 | 65 | INT32 rotwidth, rotheight; |
| 66 | 66 | }; |
| 67 | 67 | |
| 68 | ||
| 68 | ||
| 69 | 69 | |
| 70 | 70 | typedef void (*texture_copy_func)(texture_info *texture, const render_texinfo *texsource); |
| 71 | 71 | |
| r17917 | r17918 | |
| 88 | 88 | }; |
| 89 | 89 | |
| 90 | 90 | /* texture_info holds information about a texture */ |
| 91 | struct | |
| 91 | struct | |
| 92 | 92 | { |
| 93 | 93 | texture_info * next; // next texture in the list |
| 94 | 94 |
| r17917 | r17918 | |
|---|---|---|
| 33 | 33 | #define pthread_t int |
| 34 | 34 | #define pthread_self _gettid |
| 35 | 35 | |
| 36 | struct | |
| 36 | struct | |
| 37 | 37 | volatile pthread_t holder; |
| 38 | 38 | INT32 count; |
| 39 | 39 | #ifdef PTR64 |
| r17917 | r17918 | |
| 43 | 43 | #endif |
| 44 | 44 | }; |
| 45 | 45 | |
| 46 | struct | |
| 46 | struct | |
| 47 | 47 | HMTX hmtx; |
| 48 | 48 | HEV hev; |
| 49 | 49 | volatile INT32 autoreset; |
| r17917 | r17918 | |
| 54 | 54 | // TYPE DEFINITIONS |
| 55 | 55 | //============================================================ |
| 56 | 56 | |
| 57 | struct | |
| 57 | struct | |
| 58 | 58 | pthread_t thread; |
| 59 | 59 | osd_thread_callback callback; |
| 60 | 60 | void *param; |
| 61 | 61 | }; |
| 62 | 62 | |
| 63 | struct | |
| 63 | struct | |
| 64 | 64 | { |
| 65 | 65 | struct |
| 66 | 66 | { |
| r17917 | r17918 | |
|---|---|---|
| 38 | 38 | pthread_mutex_t id; |
| 39 | 39 | }; |
| 40 | 40 | |
| 41 | struct | |
| 41 | struct | |
| 42 | 42 | pthread_mutex_t mutex; |
| 43 | 43 | pthread_cond_t cond; |
| 44 | 44 | volatile INT32 autoreset; |
| r17917 | r17918 | |
| 54 | 54 | // TYPE DEFINITIONS |
| 55 | 55 | //============================================================ |
| 56 | 56 | |
| 57 | struct | |
| 57 | struct | |
| 58 | 58 | pthread_t thread; |
| 59 | 59 | }; |
| 60 | 60 | |
| 61 | struct | |
| 61 | struct | |
| 62 | 62 | { |
| 63 | 63 | osd_lock *lock; |
| 64 | 64 | }; |
| r17917 | r17918 | |
|---|---|---|
| 34 | 34 | volatile INT32 threadid; |
| 35 | 35 | }; |
| 36 | 36 | |
| 37 | struct | |
| 37 | struct | |
| 38 | 38 | SDL_mutex * mutex; |
| 39 | 39 | SDL_cond * cond; |
| 40 | 40 | volatile INT32 autoreset; |
| r17917 | r17918 | |
| 45 | 45 | // TYPE DEFINITIONS |
| 46 | 46 | //============================================================ |
| 47 | 47 | |
| 48 | struct | |
| 48 | struct | |
| 49 | 49 | SDL_Thread * thread; |
| 50 | 50 | osd_thread_callback callback; |
| 51 | 51 | void *param; |
| 52 | 52 | }; |
| 53 | 53 | |
| 54 | struct | |
| 54 | struct | |
| 55 | 55 | { |
| 56 | 56 | SDL_mutex * mutex; |
| 57 | 57 | }; |
| r17917 | r17918 | |
|---|---|---|
| 18 | 18 | |
| 19 | 19 | /* osd_event is an opaque type which represents a setable/resetable event */ |
| 20 | 20 | |
| 21 | ||
| 21 | ||
| 22 | 22 | |
| 23 | 23 | |
| 24 | 24 | /*----------------------------------------------------------------------------- |
| r17917 | r17918 | |
| 107 | 107 | ***************************************************************************/ |
| 108 | 108 | |
| 109 | 109 | /* osd_thread is an opaque type which represents a thread */ |
| 110 | ||
| 110 | ||
| 111 | 111 | |
| 112 | 112 | |
| 113 | 113 | /* osd_thread_callback is a callback function that will be called from the thread */ |
| r17917 | r17918 | |
| 191 | 191 | // Scalable Locks |
| 192 | 192 | //============================================================ |
| 193 | 193 | |
| 194 | ||
| 194 | ||
| 195 | 195 | |
| 196 | 196 | osd_scalable_lock *osd_scalable_lock_alloc(void); |
| 197 | 197 |
| r17917 | r17918 | |
|---|---|---|
| 88 | 88 | }; |
| 89 | 89 | |
| 90 | 90 | |
| 91 | struct | |
| 91 | struct | |
| 92 | 92 | { |
| 93 | 93 | osd_scalable_lock * lock; // lock for protecting the queue |
| 94 | 94 | osd_work_item * volatile list; // list of items in the queue |
| r17917 | r17918 | |
| 112 | 112 | }; |
| 113 | 113 | |
| 114 | 114 | |
| 115 | struct | |
| 115 | struct | |
| 116 | 116 | { |
| 117 | 117 | osd_work_item * next; // pointer to next item |
| 118 | 118 | osd_work_queue * queue; // pointer back to the owning queue |
| r17917 | r17918 | |
|---|---|---|
| 26 | 26 | // TYPE DEFINITIONS |
| 27 | 27 | //============================================================ |
| 28 | 28 | |
| 29 | struct | |
| 29 | struct | |
| 30 | 30 | { |
| 31 | 31 | int handle; |
| 32 | 32 | int type; |
| r17917 | r17918 | |
|---|---|---|
| 54 | 54 | #define OSD_GL(ret,func,params) ret (APIENTRY *func) params; |
| 55 | 55 | #define OSD_GL_UNUSED(ret,func,params) |
| 56 | 56 | |
| 57 | typedef struct _osd_gl_dispatch osd_gl_dispatch; | |
| 58 | ||
| 59 | struct _osd_gl_dispatch | |
| 57 | struct osd_gl_dispatch | |
| 60 | 58 | { |
| 61 | 59 | #define GET_GLFUNC 1 |
| 62 | 60 | #include "osd_opengl.h" |
| r17917 | r17918 | |
|---|---|---|
| 160 | 160 | // TYPES |
| 161 | 161 | //============================================================ |
| 162 | 162 | |
| 163 | ||
| 163 | ||
| 164 | 164 | |
| 165 | 165 | #if USE_OPENGL |
| 166 | 166 | typedef void (*texture_copy_func)(texture_info *texture, const render_texinfo *texsource); |
| 167 | 167 | #endif |
| 168 | 168 | |
| 169 | 169 | /* texture_info holds information about a texture */ |
| 170 | struct | |
| 170 | struct | |
| 171 | 171 | { |
| 172 | 172 | #ifdef OLD_CODE |
| 173 | 173 | texture_info * next; // next texture in the list |
| r17917 | r17918 | |
|---|---|---|
| 57 | 57 | |
| 58 | 58 | #define HAS_DT_XXX defined(SDLMAME_LINUX) || defined(SDLMAME_BSD) || defined(SDLMAME_DARWIN) |
| 59 | 59 | |
| 60 | struct | |
| 60 | struct | |
| 61 | 61 | { |
| 62 | 62 | osd_directory_entry ent; |
| 63 | 63 | sdl_dirent *data; |
| r17917 | r17918 | |
|---|---|---|
| 21 | 21 | #define DVIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), DVIEW_TYPE, DViewClass)) |
| 22 | 22 | |
| 23 | 23 | |
| 24 | typedef struct _DViewClass DViewClass; | |
| 25 | typedef struct _DView DView; | |
| 24 | struct DViewClass; | |
| 25 | struct DView; | |
| 26 | 26 | |
| 27 | struct | |
| 27 | struct | |
| 28 | 28 | { |
| 29 | 29 | GtkContainerClass parent_class; |
| 30 | 30 | PangoFontDescription *fixedfont; |
| 31 | 31 | int fixedfont_width, fixedfont_height; |
| 32 | 32 | }; |
| 33 | 33 | |
| 34 | struct | |
| 34 | struct | |
| 35 | 35 | { |
| 36 | 36 | GtkContainer parent; |
| 37 | 37 | GtkAdjustment *hadj, *vadj; |
| r17917 | r17918 | |
|---|---|---|
| 32 | 32 | |
| 33 | 33 | #define USE_SCALABLE_LOCKS (0) |
| 34 | 34 | |
| 35 | struct | |
| 35 | struct | |
| 36 | 36 | { |
| 37 | 37 | void * ptr; |
| 38 | 38 | }; |
| 39 | 39 | |
| 40 | struct | |
| 40 | struct | |
| 41 | 41 | HANDLE handle; |
| 42 | 42 | osd_thread_callback callback; |
| 43 | 43 | void *param; |
| r17917 | r17918 | |
| 93 | 93 | // Scalable Locks |
| 94 | 94 | //============================================================ |
| 95 | 95 | |
| 96 | struct | |
| 96 | struct | |
| 97 | 97 | { |
| 98 | 98 | #if USE_SCALABLE_LOCKS |
| 99 | 99 | struct |
| r17917 | r17918 | |
|---|---|---|
| 51 | 51 | //============================================================ |
| 52 | 52 | |
| 53 | 53 | |
| 54 | ||
| 54 | ||
| 55 | 55 | struct hentry *h; |
| 56 | 56 | char *e; |
| 57 | } | |
| 57 | } | |
| 58 | 58 | |
| 59 | ||
| 59 | ||
| 60 | 60 | |
| 61 | 61 | struct edit { |
| 62 | 62 | GtkEntry *edit_w; |
| r17917 | r17918 | |
| 67 | 67 | win_i *cbp; |
| 68 | 68 | }; |
| 69 | 69 | |
| 70 | struct | |
| 70 | struct | |
| 71 | 71 | int type; |
| 72 | 72 | win_i * next; |
| 73 | 73 | GtkWidget * win; |
| r17917 | r17918 | |
|---|---|---|
| 40 | 40 | #include <errno.h> |
| 41 | 41 | #include <sys/time.h> |
| 42 | 42 | |
| 43 | struct | |
| 43 | struct | |
| 44 | 44 | volatile pthread_t holder; |
| 45 | 45 | INT32 count; |
| 46 | 46 | #ifdef PTR64 |
| r17917 | r17918 | |
| 50 | 50 | #endif |
| 51 | 51 | }; |
| 52 | 52 | |
| 53 | struct | |
| 53 | struct | |
| 54 | 54 | pthread_mutex_t mutex; |
| 55 | 55 | pthread_cond_t cond; |
| 56 | 56 | volatile INT32 autoreset; |
| r17917 | r17918 | |
| 67 | 67 | // TYPE DEFINITIONS |
| 68 | 68 | //============================================================ |
| 69 | 69 | |
| 70 | struct | |
| 70 | struct | |
| 71 | 71 | pthread_t thread; |
| 72 | 72 | }; |
| 73 | 73 | |
| 74 | struct | |
| 74 | struct | |
| 75 | 75 | { |
| 76 | 76 | struct |
| 77 | 77 | { |
| r17917 | r17918 | |
|---|---|---|
| 47 | 47 | // TYPE DEFINITIONS |
| 48 | 48 | //============================================================ |
| 49 | 49 | |
| 50 | struct | |
| 50 | struct | |
| 51 | 51 | { |
| 52 | 52 | void *result; |
| 53 | 53 | }; |
| r17917 | r17918 | |
|---|---|---|
| 72 | 72 | #define OPEN_FLAG_NO_PRELOAD 0x0010 /* do not decompress on open */ |
| 73 | 73 | |
| 74 | 74 | /* error codes returned by routines below */ |
| 75 | enum | |
| 75 | enum | |
| 76 | 76 | { |
| 77 | 77 | FILERR_NONE, |
| 78 | 78 | FILERR_FAILURE, |
| r17917 | r17918 | |
| 84 | 84 | FILERR_INVALID_DATA, |
| 85 | 85 | FILERR_INVALID_ACCESS |
| 86 | 86 | }; |
| 87 | typedef enum _file_error file_error; | |
| 88 | 87 | |
| 89 | 88 | /* osd_file is an opaque type which represents an open file */ |
| 90 | ||
| 89 | ||
| 91 | 90 | |
| 92 | 91 | /*----------------------------------------------------------------------------- |
| 93 | 92 | osd_open: open a new file. |
| r17917 | r17918 | |
| 267 | 266 | ***************************************************************************/ |
| 268 | 267 | |
| 269 | 268 | /* types of directory entries that can be returned */ |
| 270 | enum | |
| 269 | enum | |
| 271 | 270 | { |
| 272 | 271 | ENTTYPE_NONE, |
| 273 | 272 | ENTTYPE_FILE, |
| 274 | 273 | ENTTYPE_DIR, |
| 275 | 274 | ENTTYPE_OTHER |
| 276 | 275 | }; |
| 277 | typedef enum _osd_dir_entry_type osd_dir_entry_type; | |
| 278 | 276 | |
| 279 | 277 | /* osd_directory is an opaque type which represents an open directory */ |
| 280 | ||
| 278 | ||
| 281 | 279 | |
| 282 | 280 | /* osd_directory_entry contains basic information about a file when iterating through */ |
| 283 | 281 | /* a directory */ |
| r17917 | r17918 | |
| 428 | 426 | ***************************************************************************/ |
| 429 | 427 | |
| 430 | 428 | /* osd_lock is an opaque type which represents a recursive lock/mutex */ |
| 431 | ||
| 429 | ||
| 432 | 430 | |
| 433 | 431 | |
| 434 | 432 | /*----------------------------------------------------------------------------- |
| r17917 | r17918 | |
| 527 | 525 | #define WORK_ITEM_FLAG_AUTO_RELEASE 0x0001 |
| 528 | 526 | |
| 529 | 527 | /* osd_work_queue is an opaque type which represents a queue of work items */ |
| 530 | ||
| 528 | ||
| 531 | 529 | |
| 532 | 530 | /* osd_work_item is an opaque type which represents a single work item */ |
| 533 | ||
| 531 | ||
| 534 | 532 | |
| 535 | 533 | /* osd_work_callback is a callback function that does work */ |
| 536 | 534 | typedef void *(*osd_work_callback)(void *param, int threadid); |
| r17917 | r17918 | |
|---|---|---|
| 74 | 74 | // TYPE DEFINITIONS |
| 75 | 75 | //============================================================ |
| 76 | 76 | |
| 77 | typedef struct _d3d d3d; | |
| 78 | typedef struct _d3d_device d3d_device; | |
| 79 | typedef struct _d3d_surface d3d_surface; | |
| 80 | typedef struct _d3d_texture d3d_texture; | |
| 81 | typedef struct _d3d_vertex_buffer d3d_vertex_buffer; | |
| 82 | typedef struct _d3d_effect d3d_effect; | |
| 77 | struct d3d; | |
| 78 | struct d3d_device; | |
| 79 | struct d3d_surface; | |
| 80 | struct d3d_texture; | |
| 81 | struct d3d_vertex_buffer; | |
| 82 | struct d3d_effect; | |
| 83 | 83 | typedef D3DXVECTOR4 d3d_vector; |
| 84 | 84 | typedef D3DMATRIX d3d_matrix; |
| 85 | 85 | |
| r17917 | r17918 | |
| 129 | 129 | // Caps enumeration |
| 130 | 130 | //============================================================ |
| 131 | 131 | |
| 132 | enum | |
| 132 | enum | |
| 133 | 133 | { |
| 134 | 134 | CAPS_PRESENTATION_INTERVALS, |
| 135 | 135 | CAPS_CAPS2, |
| r17917 | r17918 | |
| 146 | 146 | CAPS_STRETCH_RECT_FILTER, |
| 147 | 147 | CAPS_MAX_PS30_INSN_SLOTS |
| 148 | 148 | }; |
| 149 | typedef enum _d3d_caps_index d3d_caps_index; | |
| 150 | 149 | |
| 151 | 150 | |
| 152 | 151 | //============================================================ |
| r17917 | r17918 | |
| 263 | 262 | // Core D3D object |
| 264 | 263 | //============================================================ |
| 265 | 264 | |
| 266 | struct | |
| 265 | struct | |
| 267 | 266 | { |
| 268 | 267 | // internal objects |
| 269 | 268 | int version; |
| r17917 | r17918 | |
|---|---|---|
| 63 | 63 | |
| 64 | 64 | typedef BOOL (WINAPI *try_enter_critical_section_ptr)(LPCRITICAL_SECTION lpCriticalSection); |
| 65 | 65 | |
| 66 | struct | |
| 66 | struct | |
| 67 | 67 | { |
| 68 | 68 | CRITICAL_SECTION critsect; |
| 69 | 69 | }; |
| r17917 | r17918 | |
|---|---|---|
| 65 | 65 | // TYPE DEFINITIONS |
| 66 | 66 | //============================================================ |
| 67 | 67 | |
| 68 | typedef struct _translation_info translation_info; | |
| 69 | struct _translation_info | |
| 68 | typedef struct | |
| 70 | 69 | { |
| 71 | 70 | DWORD vc_version; |
| 72 | 71 | const char *gcc_option; |
| 73 | 72 | const char *vc_option; |
| 74 | }; | |
| 73 | } translation_info; | |
| 75 | 74 | |
| 76 | 75 | |
| 77 | 76 |
| r17917 | r17918 | |
|---|---|---|
| 61 | 61 | // TYPE DEFINITIONS |
| 62 | 62 | //============================================================ |
| 63 | 63 | |
| 64 | struct | |
| 64 | struct | |
| 65 | 65 | { |
| 66 | 66 | HANDLE find; // handle to the finder |
| 67 | 67 | int is_first; // TRUE if this is the first entry |
| r17917 | r17918 | |
|---|---|---|
| 138 | 138 | }; |
| 139 | 139 | |
| 140 | 140 | |
| 141 | struct | |
| 141 | struct | |
| 142 | 142 | { |
| 143 | 143 | scalable_lock lock; // lock for protecting the queue |
| 144 | 144 | osd_work_item * volatile list; // list of items in the queue |
| r17917 | r17918 | |
| 162 | 162 | }; |
| 163 | 163 | |
| 164 | 164 | |
| 165 | struct | |
| 165 | struct | |
| 166 | 166 | { |
| 167 | 167 | osd_work_item * next; // pointer to next item |
| 168 | 168 | osd_work_queue * queue; // pointer back to the owning queue |
| r17917 | r17918 | |
|---|---|---|
| 131 | 131 | // TYPE DEFINITIONS |
| 132 | 132 | //============================================================ |
| 133 | 133 | |
| 134 | ||
| 134 | ||
| 135 | 135 | { |
| 136 | 136 | USHORT UnitId; // Unit identifier. |
| 137 | 137 | USHORT LedFlags; // LED indicator state. |
| 138 | } | |
| 138 | } | |
| 139 | 139 | |
| 140 | 140 | |
| 141 | 141 | struct id_map_entry |
| r17917 | r17918 | |
|---|---|---|
| 23 | 23 | // TYPE DEFINITIONS |
| 24 | 24 | //============================================================ |
| 25 | 25 | |
| 26 | struct | |
| 26 | struct | |
| 27 | 27 | { |
| 28 | 28 | HANDLE handle; |
| 29 | 29 | SOCKET socket; |
| r17917 | r17918 | |
|---|---|---|
| 151 | 151 | // TYPES |
| 152 | 152 | //============================================================ |
| 153 | 153 | |
| 154 | ||
| 154 | ||
| 155 | 155 | class debugwin_info; |
| 156 | 156 | |
| 157 | 157 | |
| 158 | struct | |
| 158 | struct | |
| 159 | 159 | { |
| 160 | 160 | debugwin_info * owner; |
| 161 | 161 | debug_view * view; |
| r17917 | r17918 | |
|---|---|---|
| 173 | 173 | |
| 174 | 174 | // temporary hacks |
| 175 | 175 | #if LOG_THREADS |
| 176 | struct | |
| 176 | struct | |
| 177 | 177 | { |
| 178 | 178 | osd_ticks_t timestamp; |
| 179 | 179 | const char *event; |
| 180 | 180 | }; |
| 181 | 181 | |
| 182 | static | |
| 182 | static | |
| 183 | 183 | static volatile LONG mtlogindex; |
| 184 | 184 | |
| 185 | 185 | void mtlog_add(const char *event) |
| r17917 | r17918 | |
|---|---|---|
| 24 | 24 | #define TRACK_DIRTY 0x02 |
| 25 | 25 | |
| 26 | 26 | |
| 27 | struct | |
| 27 | struct | |
| 28 | 28 | { |
| 29 | 29 | struct io_generic io; |
| 30 | 30 | |
| r17917 | r17918 | |
| 46 | 46 | |
| 47 | 47 | |
| 48 | 48 | |
| 49 | struct | |
| 49 | struct | |
| 50 | 50 | { |
| 51 | 51 | int param; |
| 52 | 52 | int value; |
| r17917 | r17918 | |
| 77 | 77 | { |
| 78 | 78 | floppy_image_legacy *floppy; |
| 79 | 79 | |
| 80 | floppy = (floppy_image_legacy *)malloc(sizeof( | |
| 80 | floppy = (floppy_image_legacy *)malloc(sizeof( | |
| 81 | 81 | if (!floppy) |
| 82 | 82 | return NULL; |
| 83 | 83 |
| r17917 | r17918 | |
|---|---|---|
| 41 | 41 | |
| 42 | 42 | ***************************************************************************/ |
| 43 | 43 | |
| 44 | ||
| 44 | ||
| 45 | 45 | { |
| 46 | 46 | FLOPPY_ERROR_SUCCESS, /* no error */ |
| 47 | 47 | FLOPPY_ERROR_INTERNAL, /* fatal internal error */ |
| r17917 | r17918 | |
| 53 | 53 | FLOPPY_ERROR_NOSPACE, |
| 54 | 54 | FLOPPY_ERROR_PARAMOUTOFRANGE, |
| 55 | 55 | FLOPPY_ERROR_PARAMNOTSPECIFIED |
| 56 | } | |
| 57 | floperr_t; | |
| 56 | }; | |
| 58 | 57 | |
| 59 | ||
| 58 | ||
| 60 | 59 | |
| 61 | 60 | struct FloppyCallbacks |
| 62 | 61 | { |
| r17917 | r17918 | |
|---|---|---|
| 84 | 84 | { |
| 85 | 85 | cassette_image *cassette; |
| 86 | 86 | |
| 87 | cassette = (cassette_image *)malloc(sizeof( | |
| 87 | cassette = (cassette_image *)malloc(sizeof( | |
| 88 | 88 | if (!cassette) |
| 89 | 89 | return NULL; |
| 90 | 90 |
| r17917 | r17918 | |
|---|---|---|
| 91 | 91 | size_t sample_count; |
| 92 | 92 | }; |
| 93 | 93 | |
| 94 | struct | |
| 94 | struct | |
| 95 | 95 | { |
| 96 | 96 | const struct CassetteFormat *format; |
| 97 | 97 | struct io_generic io; |
| r17917 | r17918 | |
| 106 | 106 | size_t sample_count; |
| 107 | 107 | }; |
| 108 | 108 | |
| 109 | typedef struct _cassette_image cassette_image; | |
| 110 | ||
| 111 | 109 | struct CassetteFormat |
| 112 | 110 | { |
| 113 | 111 | const char *extensions; |
| r17917 | r17918 | |
|---|---|---|
| 57 | 57 | |
| 58 | 58 | |
| 59 | 59 | /* a single palette client */ |
| 60 | struct | |
| 60 | struct | |
| 61 | 61 | { |
| 62 | 62 | palette_client *next; /* pointer to next client */ |
| 63 | 63 | palette_t * palette; /* reference to the palette */ |
| r17917 | r17918 | |
| 67 | 67 | |
| 68 | 68 | |
| 69 | 69 | /* a palette object */ |
| 70 | struct | |
| 70 | struct | |
| 71 | 71 | { |
| 72 | 72 | UINT32 refcount; /* reference count on the palette */ |
| 73 | 73 | UINT32 numcolors; /* number of colors in the palette */ |
| r17917 | r17918 | |
|---|---|---|
| 56 | 56 | typedef UINT16 rgb15_t; |
| 57 | 57 | |
| 58 | 58 | /* a palette is an opaque, reference counted object */ |
| 59 | ||
| 59 | ||
| 60 | 60 | |
| 61 | 61 | /* a palette client is someone who is tracking the dirty state of a palette */ |
| 62 | ||
| 62 | ||
| 63 | 63 | |
| 64 | 64 | |
| 65 | 65 |
| r17917 | r17918 | |
|---|---|---|
| 88 | 88 | TYPE DEFINITIONS |
| 89 | 89 | ***************************************************************************/ |
| 90 | 90 | |
| 91 | struct | |
| 91 | struct | |
| 92 | 92 | { |
| 93 | 93 | chd_file * chd; /* CHD file */ |
| 94 | 94 | cdrom_toc cdtoc; /* TOC for the CD */ |
| r17917 | r17918 | |
|---|---|---|
| 169 | 169 | }; |
| 170 | 170 | |
| 171 | 171 | |
| 172 | struct | |
| 172 | struct | |
| 173 | 173 | { |
| 174 | 174 | /* shared data */ |
| 175 | 175 | osd_file * file; /* pointer to open file */ |
| r17917 | r17918 | |
|---|---|---|
| 90 | 90 | TYPE DEFINITIONS |
| 91 | 91 | ***************************************************************************/ |
| 92 | 92 | |
| 93 | ||
| 93 | ||
| 94 | 94 | |
| 95 | 95 | struct cdrom_track_info |
| 96 | 96 | { |
| r17917 | r17918 | |
|---|---|---|
| 32 | 32 | } u; |
| 33 | 33 | }; |
| 34 | 34 | |
| 35 | struct | |
| 35 | struct | |
| 36 | 36 | { |
| 37 | 37 | object_pool *pool; |
| 38 | 38 | const char *specification; |
| r17917 | r17918 | |
|---|---|---|
| 48 | 48 | CONSTANTS |
| 49 | 49 | ***************************************************************************/ |
| 50 | 50 | |
| 51 | enum | |
| 51 | enum | |
| 52 | 52 | { |
| 53 | 53 | AVIERR_NONE = 0, |
| 54 | 54 | AVIERR_END, |
| r17917 | r17918 | |
| 68 | 68 | AVIERR_UNSUPPORTED_AUDIO_FORMAT, |
| 69 | 69 | AVIERR_EXCEEDED_SOUND_BUFFER |
| 70 | 70 | }; |
| 71 | typedef enum _avi_error avi_error; | |
| 72 | 71 | |
| 73 | 72 | |
| 74 | enum | |
| 73 | enum | |
| 75 | 74 | { |
| 76 | 75 | AVIDATA_VIDEO, |
| 77 | 76 | AVIDATA_AUDIO_CHAN0, |
| r17917 | r17918 | |
| 83 | 82 | AVIDATA_AUDIO_CHAN6, |
| 84 | 83 | AVIDATA_AUDIO_CHAN7 |
| 85 | 84 | }; |
| 86 | typedef enum _avi_datatype avi_datatype; | |
| 87 | 85 | |
| 88 | 86 | |
| 89 | 87 | |
| r17917 | r17918 | |
| 104 | 102 | TYPE DEFINITIONS |
| 105 | 103 | ***************************************************************************/ |
| 106 | 104 | |
| 107 | ||
| 105 | ||
| 108 | 106 | |
| 109 | 107 | |
| 110 | 108 | struct avi_movie_info |
| r17917 | r17918 | |
|---|---|---|
| 114 | 114 | |
| 115 | 115 | |
| 116 | 116 | |
| 117 | ||
| 117 | ||
| 118 | 118 | |
| 119 | 119 | struct OptionRange |
| 120 | 120 | { |
| r17917 | r17918 | |
|---|---|---|
| 87 | 87 | #define PNG_PF_Paeth 4 |
| 88 | 88 | |
| 89 | 89 | /* Error types */ |
| 90 | enum | |
| 90 | enum | |
| 91 | 91 | { |
| 92 | 92 | PNGERR_NONE, |
| 93 | 93 | PNGERR_OUT_OF_MEMORY, |
| r17917 | r17918 | |
| 101 | 101 | PNGERR_COMPRESS_ERROR, |
| 102 | 102 | PNGERR_UNSUPPORTED_FORMAT |
| 103 | 103 | }; |
| 104 | typedef enum _png_error png_error; | |
| 105 | 104 | |
| 106 | 105 | |
| 107 | 106 |
| r17917 | r17918 | |
|---|---|---|
| 56 | 56 | void *SZipAllocTemp(void *p, size_t size); |
| 57 | 57 | void SZipFreeTemp(void *p, void *address); |
| 58 | 58 | |
| 59 | ||
| 59 | ||
| 60 | 60 | { |
| 61 | 61 | long _7z_currfpos; |
| 62 | 62 | UINT64 _7z_length; |
| 63 | 63 | osd_file * _7z_osdfile; /* OSD file handle */ |
| 64 | 64 | |
| 65 | } | |
| 65 | } | |
| 66 | 66 | |
| 67 | 67 | |
| 68 | ||
| 68 | ||
| 69 | 69 | { |
| 70 | 70 | ISeqInStream s; |
| 71 | 71 | CSzFile file; |
| 72 | } | |
| 72 | } | |
| 73 | 73 | |
| 74 | 74 | void FileSeqInStream_CreateVTable(CFileSeqInStream *p); |
| 75 | 75 | |
| 76 | 76 | |
| 77 | ||
| 77 | ||
| 78 | 78 | { |
| 79 | 79 | ISeekInStream s; |
| 80 | 80 | CSzFile file; |
| 81 | } | |
| 81 | } | |
| 82 | 82 | |
| 83 | 83 | void FileInStream_CreateVTable(CFileInStream *p); |
| 84 | 84 | |
| 85 | 85 | |
| 86 | ||
| 86 | ||
| 87 | 87 | { |
| 88 | 88 | ISeqOutStream s; |
| 89 | 89 | CSzFile file; |
| 90 | } | |
| 90 | } | |
| 91 | 91 | |
| 92 | 92 | void FileOutStream_CreateVTable(CFileOutStream *p); |
| 93 | 93 | |
| r17917 | r17918 | |
| 99 | 99 | |
| 100 | 100 | |
| 101 | 101 | /* Error types */ |
| 102 | enum _ | |
| 102 | enum _ | |
| 103 | 103 | { |
| 104 | 104 | _7ZERR_NONE = 0, |
| 105 | 105 | _7ZERR_OUT_OF_MEMORY, |
| r17917 | r17918 | |
| 111 | 111 | _7ZERR_UNSUPPORTED, |
| 112 | 112 | _7ZERR_BUFFER_TOO_SMALL |
| 113 | 113 | }; |
| 114 | typedef enum __7z_error _7z_error; | |
| 115 | 114 | |
| 116 | 115 | |
| 117 | 116 |
| r17917 | r17918 | |
|---|---|---|
| 90 | 90 | |
| 91 | 91 | |
| 92 | 92 | /* the object pool itself */ |
| 93 | struct | |
| 93 | struct | |
| 94 | 94 | { |
| 95 | 95 | object_entry * hashtable[POOL_HASH_SIZE]; |
| 96 | 96 | object_entry * globallist; |
| r17917 | r17918 | |
| 102 | 102 | |
| 103 | 103 | |
| 104 | 104 | /* an iterator over objects in a pool */ |
| 105 | struct | |
| 105 | struct | |
| 106 | 106 | { |
| 107 | 107 | object_pool * pool; |
| 108 | 108 | object_type type; |
| r17917 | r17918 | |
|---|---|---|
| 52 | 52 | #define ZIP_DECOMPRESS_BUFSIZE 16384 |
| 53 | 53 | |
| 54 | 54 | /* Error types */ |
| 55 | enum | |
| 55 | enum | |
| 56 | 56 | { |
| 57 | 57 | ZIPERR_NONE = 0, |
| 58 | 58 | ZIPERR_OUT_OF_MEMORY, |
| r17917 | r17918 | |
| 64 | 64 | ZIPERR_UNSUPPORTED, |
| 65 | 65 | ZIPERR_BUFFER_TOO_SMALL |
| 66 | 66 | }; |
| 67 | typedef enum _zip_error zip_error; | |
| 68 | 67 | |
| 69 | 68 | |
| 70 | 69 |
| r17917 | r17918 | |
|---|---|---|
| 69 | 69 | typedef UINT32 object_type; |
| 70 | 70 | |
| 71 | 71 | /* opaque type representing a pool of objects */ |
| 72 | ||
| 72 | ||
| 73 | 73 | |
| 74 | 74 | /* opaque type representing an iterator over pool objects */ |
| 75 | ||
| 75 | ||
| 76 | 76 | |
| 77 | 77 | |
| 78 | 78 |
| r17917 | r17918 | |
|---|---|---|
| 70 | 70 | TYPE DEFINITIONS |
| 71 | 71 | ***************************************************************************/ |
| 72 | 72 | |
| 73 | enum | |
| 73 | enum | |
| 74 | 74 | { |
| 75 | 75 | TFT_OSD = 0, /* OSD depdendent encoding format used when BOMs missing */ |
| 76 | 76 | TFT_UTF8, /* UTF-8 */ |
| r17917 | r17918 | |
| 79 | 79 | TFT_UTF32BE, /* UTF-32 (UCS-4) (big endian) */ |
| 80 | 80 | TFT_UTF32LE /* UTF-32 (UCS-4) (little endian) */ |
| 81 | 81 | }; |
| 82 | typedef enum _text_file_type text_file_type; | |
| 83 | 82 | |
| 84 | 83 | |
| 85 | 84 | struct zlib_data |
| r17917 | r17918 | |
| 91 | 90 | }; |
| 92 | 91 | |
| 93 | 92 | |
| 94 | /* typedef struct _core_file core_file -- declared in corefile.h */ | |
| 95 | struct _core_file | |
| 93 | struct core_file | |
| 96 | 94 | { |
| 97 | 95 | osd_file * file; /* OSD file handle */ |
| 98 | 96 | zlib_data * zdata; /* compression data */ |
| r17917 | r17918 | |
|---|---|---|
| 66 | 66 | TYPE DEFINITIONS |
| 67 | 67 | ***************************************************************************/ |
| 68 | 68 | |
| 69 | ||
| 69 | ||
| 70 | 70 | |
| 71 | 71 | |
| 72 | 72 |
| r17917 | r17918 | |
|---|---|---|
| 26 | 26 | TYPE DEFINITIONS |
| 27 | 27 | ***************************************************************************/ |
| 28 | 28 | |
| 29 | /* typedef struct _text_buffer text_buffer; -- declared in textbuf.h */ | |
| 30 | struct _text_buffer | |
| 29 | struct text_buffer | |
| 31 | 30 | { |
| 32 | 31 | char * buffer; |
| 33 | 32 | INT32 * lineoffs; |
| r17917 | r17918 | |
|---|---|---|
| 17 | 17 | TYPE DEFINITIONS |
| 18 | 18 | ***************************************************************************/ |
| 19 | 19 | |
| 20 | ||
| 20 | ||
| 21 | 21 | |
| 22 | 22 | |
| 23 | 23 |
| r17917 | r17918 | |
|---|---|---|
| 96 | 96 | |
| 97 | 97 | #define MAX_OPS (((sizeof(PIC16C62xFormats) / sizeof(PIC16C62xFormats[0])) - 1) / PTRS_PER_FORMAT) |
| 98 | 98 | |
| 99 | ||
| 99 | ||
| 100 | 100 | word mask; /* instruction mask */ |
| 101 | 101 | word bits; /* constant bits */ |
| 102 | 102 | word extcode; /* value that gets extension code */ |
| 103 | 103 | const char *parse; /* how to parse bits */ |
| 104 | 104 | const char *fmt; /* instruction format */ |
| 105 | } | |
| 105 | } | |
| 106 | 106 | |
| 107 | 107 | static PIC16C62xOpcode Op[MAX_OPS+1]; |
| 108 | 108 | static int OpInizialized = 0; |
| r17917 | r17918 | |
|---|---|---|
| 11 | 11 | #ifndef __UNSP_H__ |
| 12 | 12 | #define __UNSP_H__ |
| 13 | 13 | |
| 14 | ||
| 14 | ||
| 15 | 15 | struct unsp_state |
| 16 | 16 | { |
| 17 | 17 | UINT16 r[16]; |
| r17917 | r17918 | |
|---|---|---|
| 61 | 61 | STRUCTS |
| 62 | 62 | ***************************************************************************/ |
| 63 | 63 | |
| 64 | ||
| 64 | ||
| 65 | 65 | { |
| 66 | 66 | void (*opcode)(am29000_state *); |
| 67 | 67 | UINT32 flags; |
| 68 | } | |
| 68 | } | |
| 69 | 69 | |
| 70 | 70 | |
| 71 | 71 | /*************************************************************************** |
| r17917 | r17918 | |
|---|---|---|
| 75 | 75 | STRUCTURES & TYPEDEFS |
| 76 | 76 | ***************************************************************************/ |
| 77 | 77 | |
| 78 | ||
| 78 | ||
| 79 | 79 | { |
| 80 | 80 | INT32 icount; |
| 81 | 81 | UINT32 pc; |
| r17917 | r17918 | |
| 136 | 136 | address_space *data; |
| 137 | 137 | direct_read_data *datadirect; |
| 138 | 138 | address_space *io; |
| 139 | } | |
| 139 | } | |
| 140 | 140 | |
| 141 | 141 | |
| 142 | 142 | /*************************************************************************** |
| r17917 | r17918 | |
|---|---|---|
| 529 | 529 | /* =============================== PROTOTYPES ============================= */ |
| 530 | 530 | /* ======================================================================== */ |
| 531 | 531 | |
| 532 | typedef union _fp_reg fp_reg; | |
| 533 | union _fp_reg | |
| 532 | union fp_reg | |
| 534 | 533 | { |
| 535 | 534 | UINT64 i; |
| 536 | 535 | double f; |
| r17917 | r17918 | |
|---|---|---|
| 29 | 29 | ***************************************************************************/ |
| 30 | 30 | |
| 31 | 31 | /* TMS34010 State */ |
| 32 | typedef struct _XY XY; | |
| 33 | struct _XY | |
| 32 | struct XY | |
| 34 | 33 | { |
| 35 | 34 | #ifdef LSB_FIRST |
| 36 | 35 | INT16 x; |
| r17917 | r17918 | |
|---|---|---|
| 88 | 88 | bool active; |
| 89 | 89 | }; |
| 90 | 90 | |
| 91 | typedef struct _SHARC_REGS SHARC_REGS; | |
| 92 | struct _SHARC_REGS | |
| 91 | struct SHARC_REGS | |
| 93 | 92 | { |
| 94 | 93 | UINT32 pc; |
| 95 | 94 | SHARC_REG r[16]; |
| r17917 | r17918 | |
|---|---|---|
| 73 | 73 | "slp" ,"sra" ,"srl" ,"sub" ,"tst" ,"tstio","xor " |
| 74 | 74 | }; |
| 75 | 75 | |
| 76 | ||
| 76 | ||
| 77 | 77 | UINT8 mnemonic; |
| 78 | 78 | const char *arguments; |
| 79 | } | |
| 79 | } | |
| 80 | 80 | |
| 81 | 81 | static const z80dasm mnemonic_xx_cb[256]= { |
| 82 | 82 | {zRLC,"b=Y"}, {zRLC,"c=Y"}, {zRLC,"d=Y"}, {zRLC,"e=Y"}, |
| r17917 | r17918 | |
|---|---|---|
| 22 | 22 | |
| 23 | 23 | |
| 24 | 24 | /* I86 registers */ |
| 25 | ||
| 25 | ||
| 26 | 26 | { /* eight general registers */ |
| 27 | 27 | UINT16 w[8]; /* viewed as 16 bits registers */ |
| 28 | 28 | UINT8 b[16]; /* or as 8 bit registers */ |
| 29 | } | |
| 30 | i8086basicregs; | |
| 29 | }; | |
| 31 | 30 | |
| 32 | 31 | struct i8086_state |
| 33 | 32 | { |
| r17917 | r17918 | |
|---|---|---|
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | /* the code logging context */ |
| 51 | struct | |
| 51 | struct | |
| 52 | 52 | { |
| 53 | 53 | astring filename; /* name of the file */ |
| 54 | 54 | FILE * file; /* file we are logging to */ |
| r17917 | r17918 | |
|---|---|---|
| 91 | 91 | 0, 0, 0, 0, 0, |
| 92 | 92 | }; |
| 93 | 93 | |
| 94 | ||
| 94 | ||
| 95 | 95 | UINT8 mnemonic; |
| 96 | 96 | UINT8 argument1; |
| 97 | 97 | UINT8 argument2; |
| 98 | } | |
| 98 | } | |
| 99 | 99 | |
| 100 | 100 | static const minxdasm mnemonic[256] = { |
| 101 | 101 | /* 00 - 0F */ |
| r17917 | r17918 | |
|---|---|---|
| 34 | 34 | DT_DOUBLE_WORD, |
| 35 | 35 | DT_LONG_WORD }; |
| 36 | 36 | |
| 37 | struct | |
| 37 | struct | |
| 38 | 38 | { |
| 39 | 39 | void* addr; |
| 40 | 40 | char data_type; |
| 41 | 41 | }; |
| 42 | typedef struct _typed_pointer typed_pointer; | |
| 43 | 42 | |
| 44 | 43 | //#define ADDRESS(X) (X<<1) |
| 45 | 44 | #define BITS(CUR,MASK) (Dsp56kOpMask(CUR,MASK)) |
| r17917 | r17918 | |
|---|---|---|
| 22 | 22 | TYPE DEFINITIONS |
| 23 | 23 | ***************************************************************************/ |
| 24 | 24 | |
| 25 | ||
| 25 | ||
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 |
| r17917 | r17918 | |
|---|---|---|
| 10 | 10 | #include "debugger.h" |
| 11 | 11 | #include "tlcs90.h" |
| 12 | 12 | |
| 13 | ||
| 13 | ||
| 14 | 14 | typedef UINT8 e_op; |
| 15 | 15 | static const char *const op_names[] = { "??", "nop", "ex", "exx", "ld", "ldw", "lda", "ldi", "ldir", "ldd", "lddr", "cpi", "cpir", "cpd", "cpdr", "push", "pop", "jp", "jr", "call", "callr", "ret", "reti", "halt", "di", "ei", "swi", "daa", "cpl", "neg", "ldar", "rcf", "scf", "ccf", "tset", "bit", "set", "res", "inc", "dec", "incx", "decx", "incw", "decw", "add", "adc", "sub", "sbc", "and", "xor", "or", "cp", "rlc", "rrc", "rl", "rr", "sla", "sra", "sll", "srl", "rld", "rrd", "djnz", "mul", "div" }; |
| 16 | 16 | |
| 17 | ||
| 17 | ||
| 18 | 18 | MODE_NONE, MODE_BIT8, MODE_CC, |
| 19 | 19 | MODE_I8, MODE_D8, MODE_R8, |
| 20 | 20 | MODE_I16, MODE_D16, MODE_R16, |
| 21 | 21 | MODE_MI16, MODE_MR16, MODE_MR16D8, MODE_MR16R8, |
| 22 | 22 | MODE_R16D8, MODE_R16R8 |
| 23 | } | |
| 23 | } | |
| 24 | 24 | ALLOW_SAVE_TYPE(e_mode); // allow save_item on a non-fundamental type |
| 25 | 25 | |
| 26 | 26 | typedef UINT16 e_r; |
| 27 | 27 | |
| 28 | ||
| 28 | ||
| 29 | 29 | { |
| 30 | 30 | PAIR prvpc,pc,sp,af,bc,de,hl,ix,iy; |
| 31 | 31 | PAIR af2,bc2,de2,hl2; |
| r17917 | r17918 | |
| 59 | 59 | |
| 60 | 60 | UINT32 addr; |
| 61 | 61 | |
| 62 | } | |
| 62 | } | |
| 63 | 63 | |
| 64 | 64 | INLINE t90_Regs *get_safe_token(device_t *device) |
| 65 | 65 | { |
| r17917 | r17918 | |
| 1280 | 1280 | |
| 1281 | 1281 | *************************************************************************************************************/ |
| 1282 | 1282 | |
| 1283 | ||
| 1283 | ||
| 1284 | 1284 | DECLARE_ENUM_OPERATORS(e_irq) |
| 1285 | 1285 | |
| 1286 | 1286 | INLINE void leave_halt(t90_Regs *cpustate) |
| r17917 | r17918 | |
|---|---|---|
| 13 | 13 | |
| 14 | 14 | #define T90_IOBASE 0xffc0 |
| 15 | 15 | |
| 16 | ||
| 16 | ||
| 17 | 17 | { |
| 18 | 18 | T90_P0=T90_IOBASE, T90_P1, T90_P01CR_IRFL, T90_IRFH, T90_P2, T90_P2CR, T90_P3, T90_P3CR, |
| 19 | 19 | T90_P4, T90_P4CR, T90_P5, T90_SMMOD, T90_P6, T90_P7, T90_P67CR, T90_SMCR, |
| r17917 | r17918 | |
| 21 | 21 | T90_TCLK, T90_TFFCR, T90_TMOD, T90_TRUN, T90_CAP1L, T90_CAP1H, T90_CAP2L, T90_CAL2H, |
| 22 | 22 | T90_TREG4L, T90_TREG4H, T90_TREG5L, T90_TREG5H, T90_T4MOD, T90_T4FFCR, T90_INTEL, T90_INTEH, |
| 23 | 23 | T90_DMAEH, T90_SCMOD, T90_SCCR, T90_SCBUF, T90_BX, T90_BY, T90_ADREG, T90_ADMOD |
| 24 | } | |
| 24 | } | |
| 25 | 25 | |
| 26 | 26 | #endif /* __TLCS90_H__ */ |
| r17917 | r17918 | |
|---|---|---|
| 3 | 3 | #include "se3208.h" |
| 4 | 4 | |
| 5 | 5 | |
| 6 | static struct | |
| 6 | static struct | |
| 7 | 7 | { |
| 8 | 8 | UINT32 PC; |
| 9 | 9 | UINT32 SR; |
| r17917 | r17918 | |
|---|---|---|
| 285 | 285 | |
| 286 | 286 | |
| 287 | 287 | /* Delay information */ |
| 288 | struct | |
| 288 | struct | |
| 289 | 289 | { |
| 290 | 290 | INT32 delay_cmd; |
| 291 | 291 | UINT32 delay_pc; |
| r17917 | r17918 | |
| 315 | 315 | UINT8 timer_int_pending; |
| 316 | 316 | emu_timer *timer; |
| 317 | 317 | |
| 318 | | |
| 318 | | |
| 319 | 319 | |
| 320 | 320 | device_irq_acknowledge_callback irq_callback; |
| 321 | 321 | legacy_cpu_device *device; |
| r17917 | r17918 | |
|---|---|---|
| 55 | 55 | ***************************************************************************/ |
| 56 | 56 | |
| 57 | 57 | /* i860 state. */ |
| 58 | ||
| 58 | ||
| 59 | 59 | /* Integer registers (32 x 32-bits). */ |
| 60 | 60 | UINT32 iregs[32]; |
| 61 | 61 | |
| r17917 | r17918 | |
| 173 | 173 | UINT32 ppc; |
| 174 | 174 | int icount; |
| 175 | 175 | |
| 176 | } | |
| 176 | } | |
| 177 | 177 | |
| 178 | 178 | INLINE i860_state_t *get_safe_token(device_t *device) |
| 179 | 179 | { |
| r17917 | r17918 | |
|---|---|---|
| 15 | 15 | #include "hcd62121.h" |
| 16 | 16 | |
| 17 | 17 | |
| 18 | struct | |
| 18 | struct | |
| 19 | 19 | { |
| 20 | 20 | UINT32 prev_pc; |
| 21 | 21 | UINT16 sp; |
| r17917 | r17918 | |
| 36 | 36 | int icount; |
| 37 | 37 | }; |
| 38 | 38 | |
| 39 | typedef struct _hcd62121_state hcd62121_state; | |
| 40 | 39 | |
| 41 | ||
| 42 | 40 | /* From the battery check routine at 20:e874 it looks like |
| 43 | 41 | bit 3 of the flag register should be the Zero flag. */ |
| 44 | 42 | #define _FLAG_Z 0x08 |
| r17917 | r17918 | |
|---|---|---|
| 153 | 153 | INT16 w[4]; |
| 154 | 154 | }; |
| 155 | 155 | |
| 156 | ||
| 156 | ||
| 157 | 157 | struct rsp_state |
| 158 | 158 | { |
| 159 | 159 | const rsp_config *config; |
| r17917 | r17918 | |
|---|---|---|
| 100 | 100 | code_label labelnum; /* index for local labels */ |
| 101 | 101 | }; |
| 102 | 102 | |
| 103 | struct | |
| 103 | struct | |
| 104 | 104 | { |
| 105 | 105 | /* core state */ |
| 106 | 106 | drc_cache * cache; /* pointer to the DRC code cache */ |
| r17917 | r17918 | |
|---|---|---|
| 82 | 82 | TYPE DEFINITIONS |
| 83 | 83 | ***************************************************************************/ |
| 84 | 84 | |
| 85 | ||
| 85 | ||
| 86 | 86 | |
| 87 | 87 | struct cop400_state |
| 88 | 88 | { |
| r17917 | r17918 | |
| 151 | 151 | |
| 152 | 152 | typedef void (*cop400_opcode_func) (cop400_state *cpustate, UINT8 opcode); |
| 153 | 153 | |
| 154 | struct | |
| 154 | struct | |
| 155 | 155 | unsigned cycles; |
| 156 | 156 | cop400_opcode_func function; |
| 157 | 157 | }; |
| r17917 | r17918 | |
|---|---|---|
| 73 | 73 | }; |
| 74 | 74 | |
| 75 | 75 | /* CKI bonding options */ |
| 76 | enum | |
| 76 | enum | |
| 77 | 77 | COP400_CKI_DIVISOR_4 = 4, |
| 78 | 78 | COP400_CKI_DIVISOR_8 = 8, |
| 79 | 79 | COP400_CKI_DIVISOR_16 = 16, |
| 80 | 80 | COP400_CKI_DIVISOR_32 = 32 |
| 81 | 81 | }; |
| 82 | typedef enum _cop400_cki_bond cop400_cki_bond; | |
| 83 | 82 | |
| 84 | 83 | /* CKO bonding options */ |
| 85 | enum | |
| 84 | enum | |
| 86 | 85 | COP400_CKO_OSCILLATOR_OUTPUT = 0, |
| 87 | 86 | COP400_CKO_RAM_POWER_SUPPLY, |
| 88 | 87 | COP400_CKO_HALT_IO_PORT, |
| 89 | 88 | COP400_CKO_SYNC_INPUT, |
| 90 | 89 | COP400_CKO_GENERAL_PURPOSE_INPUT |
| 91 | 90 | }; |
| 92 | typedef enum _cop400_cko_bond cop400_cko_bond; | |
| 93 | 91 | |
| 94 | 92 | /* microbus bonding options */ |
| 95 | enum | |
| 93 | enum | |
| 96 | 94 | COP400_MICROBUS_DISABLED = 0, |
| 97 | 95 | COP400_MICROBUS_ENABLED |
| 98 | 96 | }; |
| 99 | typedef enum _cop400_microbus cop400_microbus; | |
| 100 | 97 | |
| 101 | 98 | /* interface */ |
| 102 | 99 | struct cop400_interface |
| r17917 | r17918 | |
|---|---|---|
| 120 | 120 | |
| 121 | 121 | #define LOG(x) do { if (VERBOSE) logerror x; } while (0) |
| 122 | 122 | |
| 123 | typedef struct _m4510_Regs m4510_Regs; | |
| 124 | struct _m4510_Regs { | |
| 123 | struct m4510_Regs { | |
| 125 | 124 | void (*const *insn)(m4510_Regs *); /* pointer to the function pointer table */ |
| 126 | 125 | PAIR ppc; /* previous program counter */ |
| 127 | 126 | PAIR pc; /* program counter */ |
| r17917 | r17918 | |
|---|---|---|
| 48 | 48 | /**************************************************************************** |
| 49 | 49 | * The 6502 registers. |
| 50 | 50 | ****************************************************************************/ |
| 51 | typedef struct _m6502_Regs m6502_Regs; | |
| 52 | struct _m6502_Regs | |
| 51 | struct m6502_Regs | |
| 53 | 52 | { |
| 54 | 53 | UINT8 subtype; /* currently selected cpu sub type */ |
| 55 | 54 | void (*const *insn)(m6502_Regs *); /* pointer to the function pointer table */ |
| r17917 | r17918 | |
|---|---|---|
| 56 | 56 | |
| 57 | 57 | #define LOG(x) do { if (VERBOSE) logerror x; } while (0) |
| 58 | 58 | |
| 59 | typedef struct _m6509_Regs m6509_Regs; | |
| 60 | struct _m6509_Regs { | |
| 59 | struct m6509_Regs { | |
| 61 | 60 | UINT8 subtype; /* currently selected cpu sub type */ |
| 62 | 61 | void (*const *insn)(m6509_Regs *); /* pointer to the function pointer table */ |
| 63 | 62 | PAIR ppc; /* previous program counter */ |
| r17917 | r17918 | |
|---|---|---|
| 55 | 55 | |
| 56 | 56 | #define LOG(x) do { if (VERBOSE) logerror x; } while (0) |
| 57 | 57 | |
| 58 | typedef struct _m65ce02_Regs m65ce02_Regs; | |
| 59 | struct _m65ce02_Regs { | |
| 58 | struct m65ce02_Regs { | |
| 60 | 59 | void (*const *insn)(m65ce02_Regs *); /* pointer to the function pointer table */ |
| 61 | 60 | PAIR ppc; /* previous program counter */ |
| 62 | 61 | PAIR pc; /* program counter */ |
| r17917 | r17918 | |
|---|---|---|
| 440 | 440 | |
| 441 | 441 | |
| 442 | 442 | |
| 443 | typedef struct _DasmPSXCPU_state DasmPSXCPU_state; | |
| 444 | ||
| 445 | struct _DasmPSXCPU_state | |
| 443 | struct DasmPSXCPU_state | |
| 446 | 444 | { |
| 447 | 445 | UINT32 pc; |
| 448 | 446 | int delayr; |
| r17917 | r17918 | |
|---|---|---|
| 158 | 158 | |
| 159 | 159 | |
| 160 | 160 | /* PowerPC implementation state */ |
| 161 | struct | |
| 161 | struct | |
| 162 | 162 | { |
| 163 | 163 | /* core state */ |
| 164 | 164 | drc_cache * cache; /* pointer to the DRC code cache */ |
| r17917 | r17918 | |
|---|---|---|
| 44 | 44 | #define PPCCAP_604_MMU 0x100 /* TRUE if we have 604-class MMU features */ |
| 45 | 45 | |
| 46 | 46 | /* PowerPC flavors */ |
| 47 | enum | |
| 47 | enum | |
| 48 | 48 | { |
| 49 | 49 | PPC_MODEL_403GA = 0x00200000, |
| 50 | 50 | PPC_MODEL_403GB = 0x00200100, |
| r17917 | r17918 | |
| 75 | 75 | PPC_MODEL_MPC8241 = 0x80811014, /* "Kahlua Lt" */ |
| 76 | 76 | PPC_MODEL_MPC8245 = 0x80811014, /* "Kahlua II" */ |
| 77 | 77 | }; |
| 78 | typedef enum _powerpc_flavor powerpc_flavor; | |
| 79 | 78 | |
| 80 | 79 | |
| 81 | 80 | /* exception types */ |
| r17917 | r17918 | |
| 504 | 503 | |
| 505 | 504 | |
| 506 | 505 | /* forward declaration of implementation-specific state */ |
| 507 | ||
| 506 | ||
| 508 | 507 | |
| 509 | 508 | |
| 510 | 509 | /* PowerPC state */ |
| r17917 | r17918 | |
|---|---|---|
| 58 | 58 | _OVER,0 ,0 ,0 |
| 59 | 59 | }; |
| 60 | 60 | |
| 61 | ||
| 61 | ||
| 62 | 62 | { |
| 63 | 63 | UINT8 mnemonic; |
| 64 | 64 | const char *arguments; |
| 65 | } | |
| 65 | } | |
| 66 | 66 | |
| 67 | 67 | static const lr35902dasm mnemonic_cb[256] = { |
| 68 | 68 | {zRLC,"b"}, {zRLC,"c"}, {zRLC,"d"}, {zRLC,"e"}, |
| r17917 | r17918 | |
|---|---|---|
| 189 | 189 | #define GET_DSP16 UINT32 dsp16 = addr_add(cpustate, cpustate->pc, (INT16)get_operand(cpustate, 1)) |
| 190 | 190 | #define GET_ADDR(o) UINT32 addr = (UINT32)get_addr_operand(cpustate, o) |
| 191 | 191 | |
| 192 | ||
| 192 | ||
| 193 | 193 | |
| 194 | 194 | /* structure for the opcode definition table */ |
| 195 | ||
| 195 | ||
| 196 | 196 | int beg, end, step; |
| 197 | 197 | int size, cycles; |
| 198 | 198 | void (*opcode)(z8000_state *cpustate); |
| 199 | 199 | const char *dasm; |
| 200 | 200 | UINT32 dasmflags; |
| 201 | } | |
| 201 | } | |
| 202 | 202 | |
| 203 | 203 | /* structure for the opcode execution table / disassembler */ |
| 204 | ||
| 204 | ||
| 205 | 205 | void (*opcode)(z8000_state *cpustate); |
| 206 | 206 | int cycles; |
| 207 | 207 | int size; |
| 208 | 208 | const char *dasm; |
| 209 | 209 | UINT32 dasmflags; |
| 210 | } | |
| 210 | } | |
| 211 | 211 | |
| 212 | 212 | /* opcode execution table */ |
| 213 | 213 | extern Z8000_exec *z8000_exec; |
| r17917 | r17918 | |
|---|---|---|
| 56 | 56 | |
| 57 | 57 | #define LOG(x) do { if (VERBOSE) logerror x; } while (0) |
| 58 | 58 | |
| 59 | typedef union _z8000_reg_file z8000_reg_file; | |
| 60 | union _z8000_reg_file | |
| 59 | union z8000_reg_file | |
| 61 | 60 | { |
| 62 | 61 | UINT8 B[16]; /* RL0,RH0,RL1,RH1...RL7,RH7 */ |
| 63 | 62 | UINT16 W[16]; /* R0,R1,R2...R15 */ |
| r17917 | r17918 | |
| 65 | 64 | UINT64 Q[4]; /* RQ0,RQ4,..RQ12 */ |
| 66 | 65 | }; |
| 67 | 66 | |
| 68 | /* In z8000cpu.h: typedef struct _z8000_state z8000_state; */ | |
| 69 | struct _z8000_state | |
| 67 | struct z8000_state | |
| 70 | 68 | { |
| 71 | 69 | UINT32 op[4]; /* opcodes/data of current instruction */ |
| 72 | 70 | UINT32 ppc; /* previous program counter */ |
| r17917 | r17918 | |
|---|---|---|
| 28 | 28 | ***************************************************************************/ |
| 29 | 29 | |
| 30 | 30 | /* VTLB state */ |
| 31 | struct | |
| 31 | struct | |
| 32 | 32 | { |
| 33 | 33 | cpu_device * cpudevice; /* CPU device */ |
| 34 | 34 | address_spacenum space; /* address space */ |
| r17917 | r17918 | |
|---|---|---|
| 76 | 76 | |
| 77 | 77 | |
| 78 | 78 | |
| 79 | typedef struct _tms32010_state tms32010_state; /* Page 3-6 shows all registers */ | |
| 80 | struct _tms32010_state | |
| 79 | struct tms32010_state | |
| 81 | 80 | { |
| 82 | 81 | /******************** CPU Internal Registers *******************/ |
| 83 | 82 | UINT16 PC; |
| r17917 | r17918 | |
|---|---|---|
| 156 | 156 | |
| 157 | 157 | #define MAX_OPS (((sizeof(TMS32010Formats) / sizeof(TMS32010Formats[0])) - 1) / PTRS_PER_FORMAT) |
| 158 | 158 | |
| 159 | ||
| 159 | ||
| 160 | 160 | word mask; /* instruction mask */ |
| 161 | 161 | word bits; /* constant bits */ |
| 162 | 162 | word extcode; /* value that gets extension code */ |
| 163 | 163 | const char *parse; /* how to parse bits */ |
| 164 | 164 | const char *fmt; /* instruction format */ |
| 165 | } | |
| 165 | } | |
| 166 | 166 | |
| 167 | 167 | static TMS32010Opcode Op[MAX_OPS+1]; |
| 168 | 168 | static int OpInizialized = 0; |
| r17917 | r17918 | |
|---|---|---|
| 65 | 65 | 0, 0, 0 |
| 66 | 66 | }; |
| 67 | 67 | |
| 68 | ||
| 68 | ||
| 69 | 69 | { |
| 70 | 70 | UINT8 mnemonic; |
| 71 | 71 | UINT8 arguments; |
| 72 | } | |
| 72 | } | |
| 73 | 73 | |
| 74 | 74 | static const char *const sm8500_cond[16] = { |
| 75 | 75 | "F", "LT", "LE", "ULE", "OV", "MI", "Z", "C", |
| r17917 | r17918 | |
|---|---|---|
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | /* opaque structure describing VTLB state */ |
| 46 | ||
| 46 | ||
| 47 | 47 | |
| 48 | 48 | |
| 49 | 49 |
| r17917 | r17918 | |
|---|---|---|
| 34 | 34 | UINT16 psw; |
| 35 | 35 | UINT16 mdr; |
| 36 | 36 | |
| 37 | struct _simple_timer { | |
| 38 | UINT8 mode; | |
| 39 | UINT8 base; | |
| 40 | UINT8 cur; | |
| 37 | struct { | |
| 38 | UINT8 mode; | |
| 39 | UINT8 base; | |
| 40 | UINT8 cur; | |
| 41 | 41 | } simple_timer[NUM_TIMERS_8BIT]; |
| 42 | 42 | |
| 43 | 43 | emu_timer *timer_timers[NUM_TIMERS_8BIT]; |
| 44 | 44 | |
| 45 | struct _prescaler { | |
| 46 | UINT8 cycles; | |
| 47 | UINT8 mode; | |
| 45 | struct { | |
| 46 | UINT8 cycles; | |
| 47 | UINT8 mode; | |
| 48 | 48 | } prescaler[NUM_PRESCALERS]; |
| 49 | 49 | |
| 50 | struct _dma { | |
| 51 | UINT32 adr; | |
| 52 | UINT32 count; | |
| 53 | UINT16 iadr; | |
| 54 | UINT8 ctrll, ctrlh, irq; | |
| 50 | struct { | |
| 51 | UINT32 adr; | |
| 52 | UINT32 count; | |
| 53 | UINT16 iadr; | |
| 54 | UINT8 ctrll, ctrlh, irq; | |
| 55 | 55 | } dma[8]; |
| 56 | 56 | |
| 57 | struct _serial { | |
| 58 | UINT8 ctrll, ctrlh; | |
| 59 | UINT8 buf; | |
| 57 | struct { | |
| 58 | UINT8 ctrll, ctrlh; | |
| 59 | UINT8 buf; | |
| 60 | 60 | } serial[2]; |
| 61 | 61 | |
| 62 | 62 | UINT8 ddr[8]; |
| r17917 | r17918 | |
|---|---|---|
| 204 | 204 | }; |
| 205 | 205 | |
| 206 | 206 | /* The opcode table now is a combination of cycle counts and function pointers */ |
| 207 | ||
| 207 | ||
| 208 | 208 | unsigned cycles; |
| 209 | 209 | void (*function) (alpha8201_state *cpustate); |
| 210 | } | |
| 210 | } | |
| 211 | 211 | |
| 212 | 212 | |
| 213 | 213 | #define PC pc.w.l |
| r17917 | r17918 | |
|---|---|---|
| 61 | 61 | The X value shows where the data word is located, and the Y value is the |
| 62 | 62 | address of the next instruction. |
| 63 | 63 | */ |
| 64 | enum _format_type {branch, shiftl, shiftr, multiply, store, swap, one_address, two_address}; | |
| 65 | typedef enum _format_type format_type; | |
| 64 | enum format_type {branch, shiftl, shiftr, multiply, store, swap, one_address, two_address}; | |
| 66 | 65 | |
| 67 | ||
| 66 | ||
| 68 | 67 | { |
| 69 | 68 | const char *mnemonic; |
| 70 | 69 | format_type format; /* -> X and Y are format */ |
| 71 | } | |
| 70 | } | |
| 72 | 71 | |
| 73 | 72 | static const instr_desc instructions[16] = |
| 74 | 73 | { |
| r17917 | r17918 | |
|---|---|---|
| 33 | 33 | #define MIPS3_CAUSE_READ_CYCLES 250 |
| 34 | 34 | |
| 35 | 35 | /* MIPS flavors */ |
| 36 | enum | |
| 36 | enum | |
| 37 | 37 | { |
| 38 | 38 | /* MIPS III variants */ |
| 39 | 39 | MIPS3_TYPE_MIPS_III, |
| r17917 | r17918 | |
| 48 | 48 | MIPS3_TYPE_QED5271, |
| 49 | 49 | MIPS3_TYPE_RM7000 |
| 50 | 50 | }; |
| 51 | typedef enum _mips3_flavor mips3_flavor; | |
| 52 | 51 | |
| 53 | 52 | /* TLB bits */ |
| 54 | 53 | #define TLB_GLOBAL 0x01 |
| r17917 | r17918 | |
| 176 | 175 | |
| 177 | 176 | |
| 178 | 177 | /* forward declaration of implementation-specific state */ |
| 179 | ||
| 178 | ||
| 180 | 179 | |
| 181 | 180 | |
| 182 | 181 | /* MIPS3 state */ |
| r17917 | r17918 | |
|---|---|---|
| 179 | 179 | |
| 180 | 180 | |
| 181 | 181 | /* MIPS3 registers */ |
| 182 | struct | |
| 182 | struct | |
| 183 | 183 | { |
| 184 | 184 | /* core state */ |
| 185 | 185 | drc_cache * cache; /* pointer to the DRC code cache */ |
| r17917 | r17918 | |
|---|---|---|
| 36 | 36 | |
| 37 | 37 | #define LOG(x) do { if (VERBOSE) logerror x; } while (0) |
| 38 | 38 | |
| 39 | ||
| 39 | ||
| 40 | 40 | |
| 41 | 41 | /* Private prototypes */ |
| 42 | 42 | |
| r17917 | r17918 | |
| 64 | 64 | #define PULLBYTE(b) b = RM(pSP); pSP-- |
| 65 | 65 | #define PULLWORD(w) w.b.l = RM(pSP); pSP--; w.b.h = RM(pSP); pSP-- |
| 66 | 66 | |
| 67 | struct | |
| 67 | struct | |
| 68 | 68 | { |
| 69 | 69 | PAIR pc; /* Program counter */ |
| 70 | 70 | UINT8 sp; /* Stack Pointer */ |
| r17917 | r17918 | |
|---|---|---|
| 39 | 39 | #define cS 4 |
| 40 | 40 | #define cL 6 |
| 41 | 41 | |
| 42 | typedef struct _f8_Regs f8_Regs; | |
| 43 | struct _f8_Regs | |
| 42 | struct f8_Regs | |
| 44 | 43 | { |
| 45 | 44 | UINT16 pc0; /* program counter 0 */ |
| 46 | 45 | UINT16 pc1; /* program counter 1 */ |
| r17917 | r17918 | |
|---|---|---|
| 65 | 65 | 0 ,0 ,0 ,0 ,0 |
| 66 | 66 | }; |
| 67 | 67 | |
| 68 | ||
| 68 | ||
| 69 | 69 | { |
| 70 | 70 | UINT8 mnemonic; |
| 71 | 71 | const char *arguments; |
| 72 | } | |
| 72 | } | |
| 73 | 73 | |
| 74 | 74 | static const z80dasm mnemonic_xx_cb[256] = |
| 75 | 75 | { |
| r17917 | r17918 | |
|---|---|---|
| 257 | 257 | */ |
| 258 | 258 | #define USE_16_BIT_ACCESSORS ((TMS99XX_MODEL == TI990_10_ID) || (TMS99XX_MODEL == TMS9900_ID) || (TMS99XX_MODEL == TMS9940_ID) || (IS_99000)) |
| 259 | 259 | |
| 260 | ||
| 260 | ||
| 261 | 261 | |
| 262 | 262 | INLINE void execute(tms99xx_state *cpustate, UINT16 opcode); |
| 263 | 263 | |
| r17917 | r17918 | |
| 394 | 394 | #define R14 28 |
| 395 | 395 | #define R15 30 |
| 396 | 396 | |
| 397 | ||
| 397 | ||
| 398 | 398 | { |
| 399 | 399 | UINT16 L[3], B[3]; /* actual registers */ |
| 400 | 400 | UINT32 limit[3], bias[3]; /* equivalent in a more convenient form */ |
| 401 | } | |
| 401 | } | |
| 402 | 402 | |
| 403 | struct | |
| 403 | struct | |
| 404 | 404 | { |
| 405 | 405 | /* "actual" tms9900 registers : */ |
| 406 | 406 | UINT16 WP; /* Workspace pointer */ |
| r17917 | r17918 | |
|---|---|---|
| 73 | 73 | sd_11_15 = 0x200 /* bits 11-15 should be cleared in lwpi, limi, idle, rset, rtwp, ckon, ckof, lrex */ |
| 74 | 74 | }; |
| 75 | 75 | |
| 76 | ||
| 76 | ||
| 77 | 77 | { |
| 78 | 78 | const char *mnemonic; |
| 79 | 79 | format_t format; |
| 80 | 80 | int flags; |
| 81 | } | |
| 81 | } | |
| 82 | 82 | |
| 83 | 83 | |
| 84 | 84 | enum opcodes { |
| r17917 | r17918 | |
|---|---|---|
| 61 | 61 | structure with the parameters ti990_10_reset wants. |
| 62 | 62 | */ |
| 63 | 63 | |
| 64 | ||
| 64 | ||
| 65 | 65 | { |
| 66 | 66 | ti99xx_idle_func idle_callback; |
| 67 | 67 | ti99xx_rset_func rset_callback; |
| 68 | 68 | ti99xx_lrex_func lrex_callback; |
| 69 | 69 | ti99xx_ckon_ckof_func ckon_ckof_callback; |
| 70 | 70 | ti99xx_error_interrupt_func error_interrupt_callback; |
| 71 | } | |
| 71 | } | |
| 72 | 72 | |
| 73 | 73 | /* accessor for the internal ROM */ |
| 74 | 74 | extern READ16_HANDLER(ti990_10_internal_r); |
| r17917 | r17918 | |
| 87 | 87 | /* |
| 88 | 88 | structure with optional parameters for tms9900_reset. |
| 89 | 89 | */ |
| 90 | ||
| 90 | ||
| 91 | 91 | { |
| 92 | 92 | ti99xx_idle_func idle_callback; |
| 93 | } | |
| 93 | } | |
| 94 | 94 | |
| 95 | 95 | |
| 96 | 96 | |
| r17917 | r17918 | |
| 99 | 99 | /* |
| 100 | 100 | structure with optional parameters for tms9940_reset. |
| 101 | 101 | */ |
| 102 | ||
| 102 | ||
| 103 | 103 | { |
| 104 | 104 | ti99xx_idle_func idle_callback; |
| 105 | } | |
| 105 | } | |
| 106 | 106 | |
| 107 | 107 | |
| 108 | 108 | |
| r17917 | r17918 | |
| 111 | 111 | /* |
| 112 | 112 | structure with optional parameters for tms9980a_reset. |
| 113 | 113 | */ |
| 114 | ||
| 114 | ||
| 115 | 115 | { |
| 116 | 116 | ti99xx_idle_func idle_callback; |
| 117 | } | |
| 117 | } | |
| 118 | 118 | |
| 119 | 119 | |
| 120 | 120 | |
| r17917 | r17918 | |
| 123 | 123 | /*// |
| 124 | 124 | structure with optional parameters for tms9985_reset. |
| 125 | 125 | */ |
| 126 | ||
| 126 | ||
| 127 | 127 | { |
| 128 | 128 | ti99xx_idle_func idle_callback; |
| 129 | } | |
| 129 | } | |
| 130 | 130 | |
| 131 | 131 | |
| 132 | 132 | |
| r17917 | r17918 | |
| 135 | 135 | /* |
| 136 | 136 | structure with optional parameters for tms9989_reset. |
| 137 | 137 | */ |
| 138 | ||
| 138 | ||
| 139 | 139 | { |
| 140 | 140 | ti99xx_idle_func idle_callback; |
| 141 | } | |
| 141 | } | |
| 142 | 142 | |
| 143 | 143 | |
| 144 | 144 | |
| r17917 | r17918 | |
| 147 | 147 | /* |
| 148 | 148 | structure with the parameters tms9995_reset wants. |
| 149 | 149 | */ |
| 150 | ||
| 150 | ||
| 151 | 151 | { |
| 152 | 152 | /* auto_wait_state : a non-zero value makes tms9995 generate a wait state automatically on each |
| 153 | 153 | memory access */ |
| r17917 | r17918 | |
| 159 | 159 | disabled. This chip is used by the ti99/8 so that internal RAM does |
| 160 | 160 | not prevent the mapper from working correctly. */ |
| 161 | 161 | int is_mp9537; |
| 162 | } | |
| 162 | } | |
| 163 | 163 | |
| 164 | 164 | /* accessor for the first 252 bytes of internal RAM */ |
| 165 | 165 | extern READ8_HANDLER(tms9995_internal1_r); |
| r17917 | r17918 | |
| 175 | 175 | /* |
| 176 | 176 | structure with optional parameters for tms99000_reset. |
| 177 | 177 | */ |
| 178 | ||
| 178 | ||
| 179 | 179 | { |
| 180 | 180 | ti99xx_idle_func idle_callback; |
| 181 | } | |
| 181 | } | |
| 182 | 182 | |
| 183 | 183 | |
| 184 | 184 | |
| r17917 | r17918 | |
| 187 | 187 | /* |
| 188 | 188 | structure with optional parameters for tms99105a_reset. |
| 189 | 189 | */ |
| 190 | ||
| 190 | ||
| 191 | 191 | { |
| 192 | 192 | ti99xx_idle_func idle_callback; |
| 193 | } | |
| 193 | } | |
| 194 | 194 | |
| 195 | 195 | |
| 196 | 196 | |
| r17917 | r17918 | |
| 199 | 199 | /* |
| 200 | 200 | structure with optional parameters for tms99110a_reset. |
| 201 | 201 | */ |
| 202 | ||
| 202 | ||
| 203 | 203 | { |
| 204 | 204 | ti99xx_idle_func idle_callback; |
| 205 | } | |
| 205 | } | |
| 206 | 206 | |
| 207 | 207 | |
| 208 | 208 | unsigned Dasm9900 (char *buffer, unsigned pc, int model_id, const UINT8 *oprom, const UINT8 *opram); |
| r17917 | r17918 | |
|---|---|---|
| 60 | 60 | Configuration for the TMS9995. The connections are provided by the |
| 61 | 61 | main board which contains the processor. |
| 62 | 62 | */ |
| 63 | ||
| 63 | ||
| 64 | 64 | { |
| 65 | 65 | devcb_write8 external_callback; |
| 66 | 66 | devcb_write_line iaq_line; |
| r17917 | r17918 | |
| 69 | 69 | devcb_write_line holda_line; |
| 70 | 70 | int mode; |
| 71 | 71 | int overflow; |
| 72 | } | |
| 72 | } | |
| 73 | 73 | |
| 74 | 74 | #define TMS9995_CONFIG(name) \ |
| 75 | 75 | const tms9995_config(name) = |
| r17917 | r17918 | |
| 283 | 283 | |
| 284 | 284 | // ============== Prefetch support ===================== |
| 285 | 285 | |
| 286 | | |
| 286 | | |
| 287 | 287 | { |
| 288 | 288 | UINT16 IR; |
| 289 | 289 | UINT16 command; |
| 290 | 290 | const UINT8* program; |
| 291 | 291 | bool byteop; |
| 292 | 292 | int state; |
| 293 | } | |
| 293 | } | |
| 294 | 294 | |
| 295 | 295 | int m_instindex; |
| 296 | 296 | |
| r17917 | r17918 | |
| 312 | 312 | typedef void (tms9995_device::*ophandler)(void); |
| 313 | 313 | |
| 314 | 314 | // Opcode list entry |
| 315 | | |
| 315 | | |
| 316 | 316 | { |
| 317 | 317 | UINT16 opcode; |
| 318 | 318 | int id; |
| 319 | 319 | int format; |
| 320 | 320 | microprogram prog; // Microprogram |
| 321 | } | |
| 321 | } | |
| 322 | 322 | |
| 323 | 323 | // Lookup table entry |
| 324 | | |
| 324 | | |
| 325 | 325 | { |
| 326 | | |
| 326 | | |
| 327 | 327 | const tms_instruction *entry; |
| 328 | } | |
| 328 | } | |
| 329 | 329 | |
| 330 | 330 | // Pointer to the lookup table; the entry point for searching the command |
| 331 | 331 | lookup_entry* m_command_lookup_table; |
| r17917 | r17918 | |
|---|---|---|
| 109 | 109 | "*int" |
| 110 | 110 | }; |
| 111 | 111 | |
| 112 | ||
| 112 | ||
| 113 | 113 | { |
| 114 | 114 | devcb_write8 external_callback; |
| 115 | 115 | devcb_read8 irq_level; |
| r17917 | r17918 | |
| 117 | 117 | devcb_write_line clock_out; |
| 118 | 118 | devcb_write_line wait_line; |
| 119 | 119 | devcb_write_line holda_line; |
| 120 | } | |
| 120 | } | |
| 121 | 121 | |
| 122 | 122 | #define TMS99xx_CONFIG(name) \ |
| 123 | 123 | const tms99xx_config(name) = |
| r17917 | r17918 | |
| 270 | 270 | typedef void (tms99xx_device::*ophandler)(void); |
| 271 | 271 | |
| 272 | 272 | // Opcode list entry |
| 273 | | |
| 273 | | |
| 274 | 274 | { |
| 275 | 275 | UINT16 opcode; |
| 276 | 276 | int id; |
| 277 | 277 | int format; |
| 278 | 278 | microprogram prog; // Microprogram |
| 279 | } | |
| 279 | } | |
| 280 | 280 | |
| 281 | 281 | // Lookup table entry |
| 282 | | |
| 282 | | |
| 283 | 283 | { |
| 284 | | |
| 284 | | |
| 285 | 285 | const tms_instruction *entry; |
| 286 | } | |
| 286 | } | |
| 287 | 287 | |
| 288 | 288 | // Pointer to the lookup table |
| 289 | 289 | lookup_entry* m_command_lookup_table; |
| r17917 | r17918 | |
|---|---|---|
| 137 | 137 | |
| 138 | 138 | |
| 139 | 139 | |
| 140 | typedef struct _tms32025_state tms32025_state; /* Page 3-6 (45) shows all registers */ | |
| 141 | struct _tms32025_state | |
| 142 | ||
| 140 | struct tms32025_state | |
| 143 | 141 | { |
| 144 | 142 | /******************** CPU Internal Registers *******************/ |
| 145 | 143 | UINT16 PREVPC; /* previous program counter */ |
| r17917 | r17918 | |
| 198 | 196 | void (*function)(tms32025_state *); |
| 199 | 197 | }; |
| 200 | 198 | /* opcode table entry (Opcode CE has sub-opcodes) */ |
| 201 | typedef struct _tms32025_opcode_CE tms32025_opcode_CE; | |
| 202 | struct _tms32025_opcode_CE | |
| 199 | struct tms32025_opcode_CE | |
| 203 | 200 | { |
| 204 | 201 | UINT8 cycles; |
| 205 | 202 | void (*function)(tms32025_state *); |
| 206 | 203 | }; |
| 207 | 204 | /* opcode table entry (Opcode Dx has sub-opcodes) */ |
| 208 | typedef struct _tms32025_opcode_Dx tms32025_opcode_Dx; | |
| 209 | struct _tms32025_opcode_Dx | |
| 205 | struct tms32025_opcode_Dx | |
| 210 | 206 | { |
| 211 | 207 | UINT8 cycles; |
| 212 | 208 | void (*function)(tms32025_state *); |
| r17917 | r17918 | |
|---|---|---|
| 316 | 316 | |
| 317 | 317 | #define MAX_OPS (((sizeof(TMS32025Formats) / sizeof(TMS32025Formats[0])) - 1) / PTRS_PER_FORMAT) |
| 318 | 318 | |
| 319 | ||
| 319 | ||
| 320 | 320 | word mask; /* instruction mask */ |
| 321 | 321 | word bits; /* constant bits */ |
| 322 | 322 | word extcode; /* value that gets extension code */ |
| 323 | 323 | const char *parse; /* how to parse bits */ |
| 324 | 324 | const char *fmt; /* instruction format */ |
| 325 | } | |
| 325 | } | |
| 326 | 326 | |
| 327 | 327 | static TMS32025Opcode Op[MAX_OPS+1]; |
| 328 | 328 | static int OpInizialized = 0; |
| r17917 | r17918 | |
|---|---|---|
| 86 | 86 | |
| 87 | 87 | #define MAX_OPS (((sizeof(PIC16C5xFormats) / sizeof(PIC16C5xFormats[0])) - 1) / PTRS_PER_FORMAT) |
| 88 | 88 | |
| 89 | ||
| 89 | ||
| 90 | 90 | word mask; /* instruction mask */ |
| 91 | 91 | word bits; /* constant bits */ |
| 92 | 92 | word extcode; /* value that gets extension code */ |
| 93 | 93 | const char *parse; /* how to parse bits */ |
| 94 | 94 | const char *fmt; /* instruction format */ |
| 95 | } | |
| 95 | } | |
| 96 | 96 | |
| 97 | 97 | static PIC16C5xOpcode Op[MAX_OPS+1]; |
| 98 | 98 | static int OpInizialized = 0; |
| r17917 | r17918 | |
|---|---|---|
| 552 | 552 | |
| 553 | 553 | }; |
| 554 | 554 | |
| 555 | enum | |
| 555 | enum | |
| 556 | 556 | { |
| 557 | 557 | Complete=-1, |
| 558 | 558 | Illegal, |
| r17917 | r17918 | |
| 570 | 570 | OpcodeE, |
| 571 | 571 | OpcodeF |
| 572 | 572 | }; |
| 573 | typedef enum _opcode_sel opcode_sel; | |
| 574 | 573 | |
| 575 | enum | |
| 574 | enum | |
| 576 | 575 | { |
| 577 | 576 | AdrNone, |
| 578 | 577 | AdrAF, AdrA, AdrB, AdrCount, |
| r17917 | r17918 | |
| 584 | 583 | FieldP, FieldWP, FieldXS, FieldX, FieldS, FieldM, FieldB, FieldW, FieldA, |
| 585 | 584 | AdrImmCount |
| 586 | 585 | }; |
| 587 | typedef enum _opcode_adr opcode_adr; | |
| 588 | 586 | |
| 589 | 587 | struct OPCODE |
| 590 | 588 | { |
| r17917 | r17918 | |
|---|---|---|
| 1393 | 1393 | * |
| 1394 | 1394 | *************************************/ |
| 1395 | 1395 | |
| 1396 | typedef struct _voodoo_state voodoo_state; | |
| 1397 | typedef struct poly_extra_data poly_extra_data; | |
| 1396 | struct voodoo_state; | |
| 1397 | struct poly_extra_data; | |
| 1398 | 1398 | |
| 1399 | 1399 | |
| 1400 | 1400 | struct rgba |
| r17917 | r17918 | |
| 1407 | 1407 | }; |
| 1408 | 1408 | |
| 1409 | 1409 | |
| 1410 | typedef union _voodoo_reg voodoo_reg; | |
| 1411 | union _voodoo_reg | |
| 1410 | union voodoo_reg | |
| 1412 | 1411 | { |
| 1413 | 1412 | INT32 i; |
| 1414 | 1413 | UINT32 u; |
| r17917 | r17918 | |
| 1722 | 1721 | }; |
| 1723 | 1722 | |
| 1724 | 1723 | |
| 1725 | /* typedef struct _voodoo_state voodoo_state; -- declared above */ | |
| 1726 | struct _voodoo_state | |
| 1724 | struct voodoo_state | |
| 1727 | 1725 | { |
| 1728 | 1726 | UINT8 index; /* index of board */ |
| 1729 | 1727 | device_t *device; /* pointer to our containing device */ |
| r17917 | r17918 | |
|---|---|---|
| 41 | 41 | ***************************************************************************/ |
| 42 | 42 | |
| 43 | 43 | /* forward definitions */ |
| 44 | ||
| 44 | ||
| 45 | 45 | |
| 46 | 46 | |
| 47 | 47 | /* tri_extent describes start/end points for a scanline */ |
| r17917 | r17918 | |
| 112 | 112 | |
| 113 | 113 | |
| 114 | 114 | /* work_unit is a union of the two types */ |
| 115 | typedef union _work_unit work_unit; | |
| 116 | union _work_unit | |
| 115 | union work_unit | |
| 117 | 116 | { |
| 118 | 117 | work_unit_shared shared; /* shared data */ |
| 119 | 118 | tri_work_unit tri; /* triangle work unit */ |
| r17917 | r17918 | |
| 122 | 121 | |
| 123 | 122 | |
| 124 | 123 | /* polygon_info describes a single polygon, which includes the poly_params */ |
| 125 | struct | |
| 124 | struct | |
| 126 | 125 | { |
| 127 | 126 | poly_manager * poly; /* pointer back to the poly manager */ |
| 128 | 127 | void * dest; /* pointer to the destination we are rendering to */ |
| r17917 | r17918 | |
| 137 | 136 | |
| 138 | 137 | |
| 139 | 138 | /* full poly manager description */ |
| 140 | struct | |
| 139 | struct | |
| 141 | 140 | { |
| 142 | 141 | /* queue management */ |
| 143 | 142 | osd_work_queue * queue; /* work queue */ |
| r17917 | r17918 | |
|---|---|---|
| 55 | 55 | ***************************************************************************/ |
| 56 | 56 | |
| 57 | 57 | /* opaque reference to the poly manager */ |
| 58 | ||
| 58 | ||
| 59 | 59 | |
| 60 | 60 | |
| 61 | 61 | /* input vertex data */ |
| r17917 | r17918 | |
|---|---|---|
| 11 | 11 | #include "machine/devhelpr.h" |
| 12 | 12 | |
| 13 | 13 | |
| 14 | enum | |
| 14 | enum | |
| 15 | 15 | HUC6270_VSW, |
| 16 | 16 | HUC6270_VDS, |
| 17 | 17 | HUC6270_VDW, |
| 18 | 18 | HUC6270_VCR |
| 19 | 19 | }; |
| 20 | typedef enum _huc6270_v_state huc6270_v_state; | |
| 21 | 20 | |
| 22 | enum | |
| 21 | enum | |
| 23 | 22 | HUC6270_HDS, |
| 24 | 23 | HUC6270_HDW, |
| 25 | 24 | HUC6270_HDE, |
| 26 | 25 | HUC6270_HSW |
| 27 | 26 | }; |
| 28 | typedef enum _huc6270_h_state huc6270_h_state; | |
| 29 | 27 | |
| 30 | 28 | |
| 31 | 29 | #define MCFG_HUC6270_ADD( _tag, _intrf ) \ |
| r17917 | r17918 | |
|---|---|---|
| 38 | 38 | #define UI_MENU_PROCESS_CUSTOM_ONLY 4 |
| 39 | 39 | |
| 40 | 40 | /* options for ui_menu_reset */ |
| 41 | enum | |
| 41 | enum | |
| 42 | 42 | { |
| 43 | 43 | UI_MENU_RESET_SELECT_FIRST, |
| 44 | 44 | UI_MENU_RESET_REMEMBER_POSITION, |
| 45 | 45 | UI_MENU_RESET_REMEMBER_REF |
| 46 | 46 | }; |
| 47 | typedef enum _ui_menu_reset_options ui_menu_reset_options; | |
| 48 | 47 | |
| 49 | 48 | |
| 50 | 49 |
| r17917 | r17918 | |
|---|---|---|
| 64 | 64 | // forward references |
| 65 | 65 | class render_target; |
| 66 | 66 | class screen_device; |
| 67 | ||
| 67 | ||
| 68 | 68 | |
| 69 | 69 | |
| 70 | 70 |
| r17917 | r17918 | |
|---|---|---|
| 24 | 24 | const char *extrainfo; |
| 25 | 25 | }; |
| 26 | 26 | |
| 27 | ||
| 27 | ||
| 28 | 28 | |
| 29 | 29 | typedef void (*hashfile_error_func)(const char *message); |
| 30 | 30 | |
| r17917 | r17918 | |
| 47 | 47 | TYPE DEFINITIONS |
| 48 | 48 | ***************************************************************************/ |
| 49 | 49 | |
| 50 | struct | |
| 50 | struct | |
| 51 | 51 | { |
| 52 | 52 | emu_file *file; |
| 53 | 53 | object_pool *pool; |
| r17917 | r17918 | |
|---|---|---|
| 53 | 53 | return uval; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | void aica_dsp_init( | |
| 56 | void aica_dsp_init( | |
| 57 | 57 | { |
| 58 | memset(DSP,0,sizeof( | |
| 58 | memset(DSP,0,sizeof( | |
| 59 | 59 | DSP->RBL=0x8000; |
| 60 | 60 | DSP->Stopped=1; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | void aica_dsp_step( | |
| 63 | void aica_dsp_step( | |
| 64 | 64 | { |
| 65 | 65 | INT32 ACC=0; //26 bit |
| 66 | 66 | INT32 SHIFTED=0; //24 bit |
| r17917 | r17918 | |
| 326 | 326 | // fclose(f); |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | void aica_dsp_setsample( | |
| 329 | void aica_dsp_setsample( | |
| 330 | 330 | { |
| 331 | 331 | //DSP->MIXS[SEL]+=sample<<(MXL+1)/*7*/; |
| 332 | 332 | DSP->MIXS[SEL]+=sample; |
| r17917 | r17918 | |
| 334 | 334 | // int a=1; |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | void aica_dsp_start( | |
| 337 | void aica_dsp_start( | |
| 338 | 338 | { |
| 339 | 339 | int i; |
| 340 | 340 | DSP->Stopped=0; |
| r17917 | r17918 | |
|---|---|---|
| 4 | 4 | #define __AICADSP_H__ |
| 5 | 5 | |
| 6 | 6 | //the DSP Context |
| 7 | struct | |
| 7 | struct | |
| 8 | 8 | { |
| 9 | 9 | //Config |
| 10 | 10 | UINT16 *AICARAM; |
| r17917 | r17918 | |
| 32 | 32 | int LastStep; |
| 33 | 33 | }; |
| 34 | 34 | |
| 35 | void aica_dsp_init(struct _AICADSP *DSP); | |
| 36 | void aica_dsp_setsample(struct _AICADSP *DSP, INT32 sample, INT32 SEL, INT32 MXL); | |
| 37 | void aica_dsp_step(struct _AICADSP *DSP); | |
| 38 | void aica_dsp_start(struct _AICADSP *DSP); | |
| 35 | void aica_dsp_init(AICADSP *DSP); | |
| 36 | void aica_dsp_setsample(AICADSP *DSP, INT32 sample, INT32 SEL, INT32 MXL); | |
| 37 | void aica_dsp_step(AICADSP *DSP); | |
| 38 | void aica_dsp_start(AICADSP *DSP); | |
| 39 | 39 | |
| 40 | 40 | #endif /* __AICADSP_H__ */ |
| r17917 | r17918 | |
|---|---|---|
| 10 | 10 | |
| 11 | 11 | #define LFO_SHIFT 8 |
| 12 | 12 | |
| 13 | struct | |
| 13 | struct | |
| 14 | 14 | { |
| 15 | 15 | unsigned short phase; |
| 16 | 16 | UINT32 phase_step; |
| r17917 | r17918 | |
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | INLINE signed int PLFO_Step( | |
| 110 | INLINE signed int PLFO_Step( | |
| 111 | 111 | { |
| 112 | 112 | int p; |
| 113 | 113 | LFO->phase+=LFO->phase_step; |
| r17917 | r17918 | |
| 119 | 119 | return p<<(SHIFT-LFO_SHIFT); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | INLINE signed int ALFO_Step( | |
| 122 | INLINE signed int ALFO_Step( | |
| 123 | 123 | { |
| 124 | 124 | int p; |
| 125 | 125 | LFO->phase+=LFO->phase_step; |
| r17917 | r17918 | |
| 131 | 131 | return p<<(SHIFT-LFO_SHIFT); |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | static void LFO_ComputeStep( | |
| 134 | static void LFO_ComputeStep( | |
| 135 | 135 | { |
| 136 | 136 | float step=(float) LFOFreq[LFOF]*256.0/(float)44100; |
| 137 | 137 | LFO->phase_step=(unsigned int) ((float) (1<<LFO_SHIFT)*step); |
| r17917 | r17918 | |
|---|---|---|
| 48 | 48 | #define QUEUE_SIZE 0x2000 |
| 49 | 49 | #define QUEUE_MAX (QUEUE_SIZE-1) |
| 50 | 50 | |
| 51 | ||
| 51 | ||
| 52 | 52 | { |
| 53 | 53 | int pos; |
| 54 | 54 | unsigned char reg,val; |
| 55 | } | |
| 55 | } | |
| 56 | 56 | |
| 57 | 57 | #endif |
| 58 | 58 | |
| r17917 | r17918 | |
| 84 | 84 | /* CHANNEL TYPE DEFINITIONS */ |
| 85 | 85 | |
| 86 | 86 | /* Square Wave */ |
| 87 | ||
| 87 | ||
| 88 | 88 | { |
| 89 | 89 | uint8 regs[4]; |
| 90 | 90 | int vbl_length; |
| r17917 | r17918 | |
| 96 | 96 | uint8 adder; |
| 97 | 97 | uint8 env_vol; |
| 98 | 98 | boolean enabled; |
| 99 | } | |
| 99 | } | |
| 100 | 100 | |
| 101 | 101 | /* Triangle Wave */ |
| 102 | ||
| 102 | ||
| 103 | 103 | { |
| 104 | 104 | uint8 regs[4]; /* regs[1] unused */ |
| 105 | 105 | int linear_length; |
| r17917 | r17918 | |
| 110 | 110 | uint8 adder; |
| 111 | 111 | boolean counter_started; |
| 112 | 112 | boolean enabled; |
| 113 | } | |
| 113 | } | |
| 114 | 114 | |
| 115 | 115 | /* Noise Wave */ |
| 116 | ||
| 116 | ||
| 117 | 117 | { |
| 118 | 118 | uint8 regs[4]; /* regs[1] unused */ |
| 119 | 119 | int cur_pos; |
| r17917 | r17918 | |
| 123 | 123 | float env_phase; |
| 124 | 124 | uint8 env_vol; |
| 125 | 125 | boolean enabled; |
| 126 | } | |
| 126 | } | |
| 127 | 127 | |
| 128 | 128 | /* DPCM Wave */ |
| 129 | ||
| 129 | ||
| 130 | 130 | { |
| 131 | 131 | uint8 regs[4]; |
| 132 | 132 | uint32 address; |
| r17917 | r17918 | |
| 139 | 139 | boolean irq_occurred; |
| 140 | 140 | address_space *memory; |
| 141 | 141 | signed char vol; |
| 142 | } | |
| 142 | } | |
| 143 | 143 | |
| 144 | 144 | /* APU type */ |
| 145 | ||
| 145 | ||
| 146 | 146 | { |
| 147 | 147 | /* Sound channels */ |
| 148 | 148 | square_t squ[2]; |
| r17917 | r17918 | |
| 169 | 169 | #endif |
| 170 | 170 | |
| 171 | 171 | int step_mode; |
| 172 | } | |
| 172 | } | |
| 173 | 173 | |
| 174 | 174 | /* CONSTANTS */ |
| 175 | 175 |
| r17917 | r17918 | |
|---|---|---|
| 21 | 21 | #endif |
| 22 | 22 | }; |
| 23 | 23 | |
| 24 | struct | |
| 24 | struct | |
| 25 | 25 | |
| 26 | ||
| 26 | ||
| 27 | 27 | { |
| 28 | | |
| 28 | | |
| 29 | 29 | UINT8 reg[7]; |
| 30 | 30 | UINT32 SIDfreq; |
| 31 | 31 | UINT16 SIDpulseWidth; |
| 32 | 32 | UINT8 SIDctrl; |
| 33 | 33 | UINT8 SIDAD, SIDSR; |
| 34 | 34 | |
| 35 | struct _sidOperator* carrier; | |
| 36 | struct _sidOperator* modulator; | |
| 35 | sidOperator* carrier; | |
| 36 | sidOperator* modulator; | |
| 37 | 37 | int sync; |
| 38 | 38 | |
| 39 | 39 | UINT16 pulseIndex, newPulseIndex; |
| r17917 | r17918 | |
| 55 | 55 | UINT16 cycleLen, cycleLenPnt; |
| 56 | 56 | #endif |
| 57 | 57 | |
| 58 | INT8(*outProc)(struct _sidOperator *); | |
| 59 | void(*waveProc)(struct _sidOperator *); | |
| 58 | INT8(*outProc)(sidOperator *); | |
| 59 | void(*waveProc)(sidOperator *); | |
| 60 | 60 | |
| 61 | 61 | #if defined(DIRECT_FIXPOINT) |
| 62 | 62 | cpuLword waveStep, waveStepAdd; |
| r17917 | r17918 | |
| 80 | 80 | |
| 81 | 81 | UINT8 ADSRctrl; |
| 82 | 82 | // int gateOnCtrl, gateOffCtrl; |
| 83 | UINT16 (*ADSRproc)(s | |
| 83 | UINT16 (*ADSRproc)(s | |
| 84 | 84 | |
| 85 | 85 | #ifdef SID_FPUENVE |
| 86 | 86 | float fenveStep, fenveStepAdd; |
| r17917 | r17918 | |
| 93 | 93 | #endif |
| 94 | 94 | UINT8 enveVol, enveSusVol; |
| 95 | 95 | UINT16 enveShortAttackCount; |
| 96 | } | |
| 96 | } | |
| 97 | 97 | |
| 98 | 98 | typedef INT8 (*ptr2sidFunc)(sidOperator *); |
| 99 | 99 | typedef UINT16 (*ptr2sidUwordFunc)(sidOperator *); |
| r17917 | r17918 | |
|---|---|---|
| 53 | 53 | return uval; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | void SCSPDSP_Init( | |
| 56 | void SCSPDSP_Init( | |
| 57 | 57 | { |
| 58 | memset(DSP,0,sizeof( | |
| 58 | memset(DSP,0,sizeof( | |
| 59 | 59 | DSP->RBL=0x8000; |
| 60 | 60 | DSP->Stopped=1; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | void SCSPDSP_Step( | |
| 63 | void SCSPDSP_Step( | |
| 64 | 64 | { |
| 65 | 65 | INT32 ACC=0; //26 bit |
| 66 | 66 | INT32 SHIFTED=0; //24 bit |
| r17917 | r17918 | |
| 330 | 330 | // fclose(f); |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | void SCSPDSP_SetSample( | |
| 333 | void SCSPDSP_SetSample( | |
| 334 | 334 | { |
| 335 | 335 | //DSP->MIXS[SEL]+=sample<<(MXL+1)/*7*/; |
| 336 | 336 | DSP->MIXS[SEL]+=sample; |
| r17917 | r17918 | |
| 338 | 338 | // int a=1; |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | void SCSPDSP_Start( | |
| 341 | void SCSPDSP_Start( | |
| 342 | 342 | { |
| 343 | 343 | int i; |
| 344 | 344 | DSP->Stopped=0; |
| r17917 | r17918 | |
|---|---|---|
| 4 | 4 | #define __SCSPDSP_H__ |
| 5 | 5 | |
| 6 | 6 | //the DSP Context |
| 7 | struct | |
| 7 | struct | |
| 8 | 8 | { |
| 9 | 9 | //Config |
| 10 | 10 | UINT16 *SCSPRAM; |
| r17917 | r17918 | |
| 32 | 32 | int LastStep; |
| 33 | 33 | }; |
| 34 | 34 | |
| 35 | void SCSPDSP_Init(struct _SCSPDSP *DSP); | |
| 36 | void SCSPDSP_SetSample(struct _SCSPDSP *DSP, INT32 sample, INT32 SEL, INT32 MXL); | |
| 37 | void SCSPDSP_Step(struct _SCSPDSP *DSP); | |
| 38 | void SCSPDSP_Start(struct _SCSPDSP *DSP); | |
| 35 | void SCSPDSP_Init(SCSPDSP *DSP); | |
| 36 | void SCSPDSP_SetSample(SCSPDSP *DSP, INT32 sample, INT32 SEL, INT32 MXL); | |
| 37 | void SCSPDSP_Step(SCSPDSP *DSP); | |
| 38 | void SCSPDSP_Start(SCSPDSP *DSP); | |
| 39 | 39 | |
| 40 | 40 | #endif /* __SCSPDSP_H__ */ |
| r17917 | r17918 | |
|---|---|---|
| 81 | 81 | 28.0,25.0,22.0,18.0,14.0,12.0,11.0,8.5,7.1,6.1,5.4,4.3,3.6,3.1}; |
| 82 | 82 | static INT32 EG_TABLE[0x400]; |
| 83 | 83 | |
| 84 | enum _STATE {ATTACK,DECAY1,DECAY2,RELEASE}; | |
| 85 | struct _EG | |
| 84 | enum STATE {ATTACK,DECAY1,DECAY2,RELEASE}; | |
| 85 | struct EG_t | |
| 86 | 86 | { |
| 87 | 87 | int volume; // |
| 88 | | |
| 88 | | |
| 89 | 89 | int step; |
| 90 | 90 | //step vals |
| 91 | 91 | int AR; //Attack |
| r17917 | r17918 | |
| 97 | 97 | UINT8 LPLINK; |
| 98 | 98 | }; |
| 99 | 99 | |
| 100 | struct | |
| 100 | struct | |
| 101 | 101 | { |
| 102 | 102 | union |
| 103 | 103 | { |
| r17917 | r17918 | |
| 111 | 111 | UINT32 nxt_addr; //next play address |
| 112 | 112 | UINT32 step; //pitch step (24.8) |
| 113 | 113 | UINT8 Backwards; //the wave is playing backwards |
| 114 | struct _EG EG; //Envelope | |
| 115 | struct _LFO PLFO; //Phase LFO | |
| 116 | struct _LFO ALFO; //Amplitude LFO | |
| 114 | EG_t EG; //Envelope | |
| 115 | LFO_t PLFO; //Phase LFO | |
| 116 | LFO_t ALFO; //Amplitude LFO | |
| 117 | 117 | int slot; |
| 118 | 118 | int cur_sample; //current ADPCM sample |
| 119 | 119 | int cur_quant; //current ADPCM step |
| r17917 | r17918 | |
| 155 | 155 | #define SCITMA 6 |
| 156 | 156 | #define SCITMB 7 |
| 157 | 157 | |
| 158 | typedef struct _AICA aica_state; | |
| 159 | struct _AICA | |
| 158 | struct aica_state | |
| 160 | 159 | { |
| 161 | 160 | union |
| 162 | 161 | { |
| r17917 | r17918 | |
| 165 | 164 | } udata; |
| 166 | 165 | UINT16 IRQL, IRQR; |
| 167 | 166 | UINT16 EFSPAN[0x48]; |
| 168 | | |
| 167 | | |
| 169 | 168 | signed short RINGBUF[64]; |
| 170 | 169 | unsigned char BUFPTR; |
| 171 | 170 | unsigned char *AICARAM; |
| r17917 | r17918 | |
| 200 | 199 | |
| 201 | 200 | int ARTABLE[64], DRTABLE[64]; |
| 202 | 201 | |
| 203 | | |
| 202 | | |
| 204 | 203 | device_t *device; |
| 205 | 204 | }; |
| 206 | 205 | |
| r17917 | r17918 | |
| 341 | 340 | return AICA->DRTABLE[Rate]; |
| 342 | 341 | } |
| 343 | 342 | |
| 344 | static void Compute_EG(aica_state *AICA, | |
| 343 | static void Compute_EG(aica_state *AICA, | |
| 345 | 344 | { |
| 346 | 345 | int octave=(OCT(slot)^8)-8; |
| 347 | 346 | int rate; |
| r17917 | r17918 | |
| 358 | 357 | slot->EG.DL=0x1f-DL(slot); |
| 359 | 358 | } |
| 360 | 359 | |
| 361 | static void AICA_StopSlot( | |
| 360 | static void AICA_StopSlot( | |
| 362 | 361 | |
| 363 | static int EG_Update( | |
| 362 | static int EG_Update( | |
| 364 | 363 | { |
| 365 | 364 | switch(slot->EG.state) |
| 366 | 365 | { |
| r17917 | r17918 | |
| 408 | 407 | return (slot->EG.volume>>EG_SHIFT)<<(SHIFT-10); |
| 409 | 408 | } |
| 410 | 409 | |
| 411 | static UINT32 AICA_Step( | |
| 410 | static UINT32 AICA_Step( | |
| 412 | 411 | { |
| 413 | 412 | int octave=(OCT(slot)^8)-8+SHIFT-10; |
| 414 | 413 | UINT32 Fn=FNS(slot) + (0x400); |
| r17917 | r17918 | |
| 420 | 419 | } |
| 421 | 420 | |
| 422 | 421 | |
| 423 | static void Compute_LFO( | |
| 422 | static void Compute_LFO( | |
| 424 | 423 | { |
| 425 | 424 | if(PLFOS(slot)!=0) |
| 426 | 425 | AICALFO_ComputeStep(&(slot->PLFO),LFOF(slot),PLFOWS(slot),PLFOS(slot),0); |
| r17917 | r17918 | |
| 450 | 449 | return *PrevSignal; |
| 451 | 450 | } |
| 452 | 451 | |
| 453 | static void AICA_StartSlot(aica_state *AICA, | |
| 452 | static void AICA_StartSlot(aica_state *AICA, | |
| 454 | 453 | { |
| 455 | 454 | UINT64 start_offset; |
| 456 | 455 | |
| r17917 | r17918 | |
| 480 | 479 | } |
| 481 | 480 | } |
| 482 | 481 | |
| 483 | static void AICA_StopSlot( | |
| 482 | static void AICA_StopSlot( | |
| 484 | 483 | { |
| 485 | 484 | if(keyoff /*&& slot->EG.state!=RELEASE*/) |
| 486 | 485 | { |
| r17917 | r17918 | |
| 628 | 627 | |
| 629 | 628 | static void AICA_UpdateSlotReg(aica_state *AICA,int s,int r) |
| 630 | 629 | { |
| 631 | | |
| 630 | | |
| 632 | 631 | int sl; |
| 633 | 632 | switch(r&0x7f) |
| 634 | 633 | { |
| r17917 | r17918 | |
| 638 | 637 | { |
| 639 | 638 | for(sl=0;sl<64;++sl) |
| 640 | 639 | { |
| 641 | | |
| 640 | | |
| 642 | 641 | { |
| 643 | 642 | if(KEYONB(s2) && s2->EG.state==RELEASE/*&& !s2->active*/) |
| 644 | 643 | { |
| r17917 | r17918 | |
| 848 | 847 | case 0x11: |
| 849 | 848 | { |
| 850 | 849 | int slotnum = MSLC(AICA); |
| 851 | | |
| 850 | | |
| 852 | 851 | UINT16 LP = 0; |
| 853 | 852 | if (!(AFSEL(AICA))) |
| 854 | 853 | { |
| r17917 | r17918 | |
| 877 | 876 | case 0x15: |
| 878 | 877 | { |
| 879 | 878 | int slotnum = MSLC(AICA); |
| 880 | | |
| 879 | | |
| 881 | 880 | unsigned int CA = 0; |
| 882 | 881 | |
| 883 | 882 | if (PCMS(slot) == 0) // 16-bit samples |
| r17917 | r17918 | |
| 1036 | 1035 | } |
| 1037 | 1036 | #endif |
| 1038 | 1037 | |
| 1039 | INLINE INT32 AICA_UpdateSlot(aica_state *AICA, | |
| 1038 | INLINE INT32 AICA_UpdateSlot(aica_state *AICA, | |
| 1040 | 1039 | { |
| 1041 | 1040 | INT32 sample; |
| 1042 | 1041 | int step=slot->step; |
| r17917 | r17918 | |
| 1211 | 1210 | // mix slots' direct output |
| 1212 | 1211 | for(sl=0;sl<64;++sl) |
| 1213 | 1212 | { |
| 1214 | | |
| 1213 | | |
| 1215 | 1214 | RBUFDST=AICA->RINGBUF+AICA->BUFPTR; |
| 1216 | 1215 | if(AICA->Slots[sl].active) |
| 1217 | 1216 | { |
| r17917 | r17918 | |
|---|---|---|
| 176 | 176 | extern const device_type GAMEGEAR_NEW; |
| 177 | 177 | extern const device_type SEGAPSG_NEW; |
| 178 | 178 | |
| 179 | ||
| 179 | ||
| 180 | 180 | { |
| 181 | 181 | devcb_write_line ready; |
| 182 | } | |
| 182 | } | |
| 183 | 183 | |
| 184 | 184 | class sn76496_base_device : public device_t, public device_sound_interface |
| 185 | 185 | { |
| r17917 | r17918 | |
|---|---|---|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | |
| 56 | INLINE void syncEm( | |
| 56 | INLINE void syncEm( | |
| 57 | 57 | { |
| 58 | 58 | int sync1 = (This->optr1.modulator->cycleLenCount <= 0); |
| 59 | 59 | int sync2 = (This->optr2.modulator->cycleLenCount <= 0); |
| r17917 | r17918 | |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | |
| 99 | void sidEmuFillBuffer( | |
| 99 | void sidEmuFillBuffer( | |
| 100 | 100 | { |
| 101 | //void* fill16bitMono( SID6581 *This, void* buffer, UINT32 numberOfSamples ) | |
| 101 | //void* fill16bitMono( SID6581_t *This, void* buffer, UINT32 numberOfSamples ) | |
| 102 | 102 | |
| 103 | 103 | for ( ; bufferLen > 0; bufferLen-- ) |
| 104 | 104 | { |
| r17917 | r17918 | |
| 121 | 121 | |
| 122 | 122 | /* Reset. */ |
| 123 | 123 | |
| 124 | int sidEmuReset( | |
| 124 | int sidEmuReset( | |
| 125 | 125 | { |
| 126 | 126 | sidClearOperator( &This->optr1 ); |
| 127 | 127 | enveEmuResetOperator( &This->optr1 ); |
| r17917 | r17918 | |
| 208 | 208 | filterResTable[15] = resDyMax; |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | void sid6581_init ( | |
| 211 | void sid6581_init ( | |
| 212 | 212 | { |
| 213 | 213 | This->optr1.sid=This; |
| 214 | 214 | This->optr2.sid=This; |
| r17917 | r17918 | |
| 245 | 245 | sidEmuReset(This); |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | void sid6581_port_w ( | |
| 248 | void sid6581_port_w ( | |
| 249 | 249 | { |
| 250 | 250 | offset &= 0x1f; |
| 251 | 251 | |
| r17917 | r17918 | |
| 323 | 323 | } |
| 324 | 324 | } |
| 325 | 325 | |
| 326 | int sid6581_port_r (running_machine &machine, | |
| 326 | int sid6581_port_r (running_machine &machine, | |
| 327 | 327 | { |
| 328 | 328 | int data; |
| 329 | 329 | /* SIDPLAY reads last written at a sid address value */ |
| r17917 | r17918 | |
|---|---|---|
| 12 | 12 | #include "sidvoice.h" |
| 13 | 13 | |
| 14 | 14 | /* private area */ |
| 15 | ||
| 15 | ||
| 16 | 16 | { |
| 17 | 17 | device_t *device; |
| 18 | 18 | sound_stream *mixer_channel; // mame stream/ mixer channel |
| r17917 | r17918 | |
| 54 | 54 | |
| 55 | 55 | sidOperator optr1, optr2, optr3; |
| 56 | 56 | int optr3_outputmask; |
| 57 | } | |
| 57 | } | |
| 58 | 58 | |
| 59 | void sid6581_init ( | |
| 59 | void sid6581_init ( | |
| 60 | 60 | |
| 61 | int sidEmuReset( | |
| 61 | int sidEmuReset( | |
| 62 | 62 | |
| 63 | int sid6581_port_r (running_machine &machine, _SID6581 *This, int offset); | |
| 64 | void sid6581_port_w (_SID6581 *This, int offset, int data); | |
| 63 | int sid6581_port_r (running_machine &machine, SID6581_t *This, int offset); | |
| 64 | void sid6581_port_w (SID6581_t *This, int offset, int data); | |
| 65 | 65 | |
| 66 | void sidEmuFillBuffer( | |
| 66 | void sidEmuFillBuffer( | |
| 67 | 67 | |
| 68 | 68 | #endif /* __SID_H__ */ |
| r17917 | r17918 | |
|---|---|---|
| 4177 | 4177 | * |
| 4178 | 4178 | *************************************/ |
| 4179 | 4179 | |
| 4180 | ||
| 4180 | ||
| 4181 | 4181 | class discrete_node_base_factory; |
| 4182 | 4182 | class discrete_task; |
| 4183 | 4183 | class discrete_base_node; |
| r17917 | r17918 | |
| 4202 | 4202 | * |
| 4203 | 4203 | *************************************/ |
| 4204 | 4204 | |
| 4205 | struct | |
| 4205 | struct | |
| 4206 | 4206 | { |
| 4207 | 4207 | int node; /* Output node number */ |
| 4208 | 4208 | discrete_node_base_factory *factory; |
| r17917 | r17918 | |
|---|---|---|
| 111 | 111 | 28.0,25.0,22.0,18.0,14.0,12.0,11.0,8.5,7.1,6.1,5.4,4.3,3.6,3.1}; |
| 112 | 112 | static INT32 EG_TABLE[0x400]; |
| 113 | 113 | |
| 114 | enum _STATE {ATTACK,DECAY1,DECAY2,RELEASE}; | |
| 115 | struct _EG | |
| 114 | enum STATE {ATTACK,DECAY1,DECAY2,RELEASE}; | |
| 115 | struct EG_t | |
| 116 | 116 | { |
| 117 | 117 | int volume; // |
| 118 | | |
| 118 | | |
| 119 | 119 | int step; |
| 120 | 120 | //step vals |
| 121 | 121 | int AR; //Attack |
| r17917 | r17918 | |
| 128 | 128 | UINT8 LPLINK; |
| 129 | 129 | }; |
| 130 | 130 | |
| 131 | struct | |
| 131 | struct | |
| 132 | 132 | { |
| 133 | 133 | union |
| 134 | 134 | { |
| r17917 | r17918 | |
| 141 | 141 | UINT32 cur_addr; //current play address (24.8) |
| 142 | 142 | UINT32 nxt_addr; //next play address |
| 143 | 143 | UINT32 step; //pitch step (24.8) |
| 144 | struct _EG EG; //Envelope | |
| 145 | struct _LFO PLFO; //Phase LFO | |
| 146 | struct _LFO ALFO; //Amplitude LFO | |
| 144 | EG_t EG; //Envelope | |
| 145 | LFO_t PLFO; //Phase LFO | |
| 146 | LFO_t ALFO; //Amplitude LFO | |
| 147 | 147 | int slot; |
| 148 | 148 | signed short Prev; //Previous sample (for interpolation) |
| 149 | 149 | }; |
| r17917 | r17918 | |
| 182 | 182 | UINT16 data[0x30/2]; |
| 183 | 183 | UINT8 datab[0x30]; |
| 184 | 184 | } udata; |
| 185 | | |
| 185 | | |
| 186 | 186 | signed short RINGBUF[128]; |
| 187 | 187 | unsigned char BUFPTR; |
| 188 | 188 | #if FM_DELAY |
| r17917 | r17918 | |
| 224 | 224 | |
| 225 | 225 | int ARTABLE[64], DRTABLE[64]; |
| 226 | 226 | |
| 227 | | |
| 227 | | |
| 228 | 228 | devcb_resolved_write_line main_irq; |
| 229 | 229 | |
| 230 | 230 | device_t *device; |
| r17917 | r17918 | |
| 389 | 389 | return scsp->DRTABLE[Rate]; |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | static void Compute_EG(scsp_state *scsp, | |
| 392 | static void Compute_EG(scsp_state *scsp, | |
| 393 | 393 | { |
| 394 | 394 | int octave=(OCT(slot)^8)-8; |
| 395 | 395 | int rate; |
| r17917 | r17918 | |
| 407 | 407 | slot->EG.EGHOLD=EGHOLD(slot); |
| 408 | 408 | } |
| 409 | 409 | |
| 410 | static void SCSP_StopSlot( | |
| 410 | static void SCSP_StopSlot( | |
| 411 | 411 | |
| 412 | static int EG_Update( | |
| 412 | static int EG_Update( | |
| 413 | 413 | { |
| 414 | 414 | switch(slot->EG.state) |
| 415 | 415 | { |
| r17917 | r17918 | |
| 459 | 459 | return (slot->EG.volume>>EG_SHIFT)<<(SHIFT-10); |
| 460 | 460 | } |
| 461 | 461 | |
| 462 | static UINT32 SCSP_Step( | |
| 462 | static UINT32 SCSP_Step( | |
| 463 | 463 | { |
| 464 | 464 | int octave=(OCT(slot)^8)-8+SHIFT-10; |
| 465 | 465 | UINT32 Fn=FNS(slot)+(1 << 10); |
| r17917 | r17918 | |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | |
| 479 | static void Compute_LFO( | |
| 479 | static void Compute_LFO( | |
| 480 | 480 | { |
| 481 | 481 | if(PLFOS(slot)!=0) |
| 482 | 482 | LFO_ComputeStep(&(slot->PLFO),LFOF(slot),PLFOWS(slot),PLFOS(slot),0); |
| r17917 | r17918 | |
| 484 | 484 | LFO_ComputeStep(&(slot->ALFO),LFOF(slot),ALFOWS(slot),ALFOS(slot),1); |
| 485 | 485 | } |
| 486 | 486 | |
| 487 | static void SCSP_StartSlot(scsp_state *scsp, | |
| 487 | static void SCSP_StartSlot(scsp_state *scsp, | |
| 488 | 488 | { |
| 489 | 489 | UINT32 start_offset; |
| 490 | 490 | |
| r17917 | r17918 | |
| 505 | 505 | // printf("StartSlot[%p]: SA %x PCM8B %x LPCTL %x ALFOS %x STWINH %x TL %x EFSDL %x\n", slot, SA(slot), PCM8B(slot), LPCTL(slot), ALFOS(slot), STWINH(slot), TL(slot), EFSDL(slot)); |
| 506 | 506 | } |
| 507 | 507 | |
| 508 | static void SCSP_StopSlot( | |
| 508 | static void SCSP_StopSlot( | |
| 509 | 509 | { |
| 510 | 510 | if(keyoff /*&& slot->EG.state!=RELEASE*/) |
| 511 | 511 | { |
| r17917 | r17918 | |
| 657 | 657 | |
| 658 | 658 | static void SCSP_UpdateSlotReg(scsp_state *scsp,int s,int r) |
| 659 | 659 | { |
| 660 | | |
| 660 | | |
| 661 | 661 | int sl; |
| 662 | 662 | switch(r&0x3f) |
| 663 | 663 | { |
| r17917 | r17918 | |
| 667 | 667 | { |
| 668 | 668 | for(sl=0;sl<32;++sl) |
| 669 | 669 | { |
| 670 | | |
| 670 | | |
| 671 | 671 | { |
| 672 | 672 | if(KEYONB(s2) && s2->EG.state==RELEASE/*&& !s2->active*/) |
| 673 | 673 | { |
| r17917 | r17918 | |
| 863 | 863 | // MSLC | CA |SGC|EG |
| 864 | 864 | // f e d c b a 9 8 7 6 5 4 3 2 1 0 |
| 865 | 865 | unsigned char MSLC=(scsp->udata.data[0x8/2]>>11)&0x1f; |
| 866 | | |
| 866 | | |
| 867 | 867 | unsigned int SGC = (slot->EG.state) & 3; |
| 868 | 868 | unsigned int CA = (slot->cur_addr>>(SHIFT+12)) & 0xf; |
| 869 | 869 | unsigned int EG = (0x1f - (slot->EG.volume>>(EG_SHIFT+5))) & 0x1f; |
| r17917 | r17918 | |
| 953 | 953 | |
| 954 | 954 | #define REVSIGN(v) ((~v)+1) |
| 955 | 955 | |
| 956 | INLINE INT32 SCSP_UpdateSlot(scsp_state *scsp, | |
| 956 | INLINE INT32 SCSP_UpdateSlot(scsp_state *scsp, | |
| 957 | 957 | { |
| 958 | 958 | INT32 sample; |
| 959 | 959 | int step=slot->step; |
| r17917 | r17918 | |
| 1135 | 1135 | #endif |
| 1136 | 1136 | if(scsp->Slots[sl].active) |
| 1137 | 1137 | { |
| 1138 | | |
| 1138 | | |
| 1139 | 1139 | unsigned short Enc; |
| 1140 | 1140 | signed int sample; |
| 1141 | 1141 | |
| r17917 | r17918 | |
| 1165 | 1165 | |
| 1166 | 1166 | for(i=0;i<16;++i) |
| 1167 | 1167 | { |
| 1168 | | |
| 1168 | | |
| 1169 | 1169 | if(EFSDL(slot)) |
| 1170 | 1170 | { |
| 1171 | 1171 | unsigned short Enc=((EFPAN(slot))<<0x8)|((EFSDL(slot))<<0xd); |
| r17917 | r17918 | |
|---|---|---|
| 1 | 1 | #include "osdcore.h" |
| 2 | 2 | #include "sound/wavwrite.h" |
| 3 | 3 | |
| 4 | struct | |
| 4 | struct | |
| 5 | 5 | { |
| 6 | 6 | FILE *file; |
| 7 | 7 | UINT32 total_offs; |
| r17917 | r17918 | |
| 16 | 16 | UINT16 align, temp16; |
| 17 | 17 | |
| 18 | 18 | /* allocate memory for the wav struct */ |
| 19 | wav = (wav_file *) osd_malloc(sizeof( | |
| 19 | wav = (wav_file *) osd_malloc(sizeof( | |
| 20 | 20 | if (!wav) |
| 21 | 21 | return NULL; |
| 22 | 22 |
| r17917 | r17918 | |
|---|---|---|
| 3 | 3 | #ifndef __WAVWRITE_H__ |
| 4 | 4 | #define __WAVWRITE_H__ |
| 5 | 5 | |
| 6 | ||
| 6 | ||
| 7 | 7 | |
| 8 | 8 | wav_file *wav_open(const char *filename, int sample_rate, int channels); |
| 9 | 9 | void wav_close(wav_file*wavptr); |
| r17917 | r17918 | |
|---|---|---|
| 71 | 71 | #define VERBOSE 0 |
| 72 | 72 | #define LOG(x) do { if (VERBOSE) logerror x; } while (0) |
| 73 | 73 | |
| 74 | struct YMF278BChip; | |
| 75 | ||
| 74 | 76 | struct YMF278BSlot |
| 75 | 77 | { |
| 76 | 78 | INT16 wave; /* wavetable number */ |
| r17917 | r17918 | |
| 110 | 112 | INT8 env_preverb; |
| 111 | 113 | |
| 112 | 114 | int num; /* slot number (for debug only) */ |
| 113 | | |
| 115 | | |
| 114 | 116 | }; |
| 115 | 117 | |
| 116 | ||
| 118 | ||
| 117 | 119 | { |
| 118 | 120 | UINT8 pcmregs[256]; |
| 119 | 121 | YMF278BSlot slots[24]; |
| r17917 | r17918 | |
| 151 | 153 | INT32 mix_level[8]; |
| 152 | 154 | |
| 153 | 155 | sound_stream * stream; |
| 154 | } | |
| 156 | } | |
| 155 | 157 | |
| 156 | 158 | INLINE YMF278BChip *get_safe_token(device_t *device) |
| 157 | 159 | { |
| r17917 | r17918 | |
|---|---|---|
| 12 | 12 | |
| 13 | 13 | |
| 14 | 14 | |
| 15 | static | |
| 15 | static | |
| 16 | 16 | { |
| 17 | 17 | assert(device != NULL); |
| 18 | 18 | assert((device->type() == SID6581) || (device->type() == SID8580)); |
| 19 | return ( | |
| 19 | return ( | |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | |
| 23 | 23 | |
| 24 | 24 | static STREAM_UPDATE( sid_update ) |
| 25 | 25 | { |
| 26 | | |
| 26 | | |
| 27 | 27 | sidEmuFillBuffer(sid, outputs[0], samples); |
| 28 | 28 | } |
| 29 | 29 | |
| r17917 | r17918 | |
| 31 | 31 | |
| 32 | 32 | static void sid_start(device_t *device, SIDTYPE sidtype) |
| 33 | 33 | { |
| 34 | | |
| 34 | | |
| 35 | 35 | const sid6581_interface *iface = (const sid6581_interface*) device->static_config(); |
| 36 | 36 | assert(iface); |
| 37 | 37 | |
| r17917 | r17918 | |
| 53 | 53 | |
| 54 | 54 | static DEVICE_RESET( sid ) |
| 55 | 55 | { |
| 56 | | |
| 56 | | |
| 57 | 57 | sidEmuReset(sid); |
| 58 | 58 | } |
| 59 | 59 | |
| r17917 | r17918 | |
| 90 | 90 | : device_t(mconfig, SID6581, "SID6581", tag, owner, clock), |
| 91 | 91 | device_sound_interface(mconfig, *this) |
| 92 | 92 | { |
| 93 | m_token = global_alloc_array_clear(UINT8, sizeof( | |
| 93 | m_token = global_alloc_array_clear(UINT8, sizeof( | |
| 94 | 94 | } |
| 95 | 95 | sid6581_device::sid6581_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) |
| 96 | 96 | : device_t(mconfig, type, name, tag, owner, clock), |
| 97 | 97 | device_sound_interface(mconfig, *this) |
| 98 | 98 | { |
| 99 | m_token = global_alloc_array_clear(UINT8, sizeof( | |
| 99 | m_token = global_alloc_array_clear(UINT8, sizeof( | |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | //------------------------------------------------- |
| r17917 | r17918 | |
|---|---|---|
| 103 | 103 | DISCRETE_CLASS_CONSTRUCTOR(dss_inverter_osc, base) |
| 104 | 104 | DISCRETE_CLASS_DESTRUCTOR(dss_inverter_osc) |
| 105 | 105 | public: |
| 106 | | |
| 106 | | |
| 107 | 107 | { |
| 108 | 108 | double vB; |
| 109 | 109 | double vOutLow; |
| r17917 | r17918 | |
| 112 | 112 | double vInRise; // voltage that triggers the gate input to go high (vGate) on rise |
| 113 | 113 | double clamp; // voltage is clamped to -clamp ... vb+clamp if clamp>= 0; |
| 114 | 114 | int options; // bitmaped options |
| 115 | } | |
| 115 | } | |
| 116 | 116 | enum { |
| 117 | 117 | IS_TYPE1 = 0x00, |
| 118 | 118 | IS_TYPE2 = 0x01, |
| r17917 | r17918 | |
|---|---|---|
| 37 | 37 | //???? |
| 38 | 38 | #define MULTIPCM_CLOCKDIV (180.0) |
| 39 | 39 | |
| 40 | struct | |
| 40 | struct | |
| 41 | 41 | { |
| 42 | 42 | unsigned int Start; |
| 43 | 43 | unsigned int Loop; |
| r17917 | r17918 | |
| 48 | 48 | unsigned char AM; |
| 49 | 49 | }; |
| 50 | 50 | |
| 51 | enum _STATE {ATTACK,DECAY1,DECAY2,RELEASE}; | |
| 52 | ALLOW_SAVE_TYPE(_STATE); // allow save_item on a non-fundamental type | |
| 53 | struct _EG | |
| 51 | enum STATE {ATTACK,DECAY1,DECAY2,RELEASE}; | |
| 52 | ALLOW_SAVE_TYPE(STATE); // allow save_item on a non-fundamental type | |
| 53 | struct EG_t | |
| 54 | 54 | { |
| 55 | 55 | int volume; // |
| 56 | | |
| 56 | | |
| 57 | 57 | int step; |
| 58 | 58 | //step vals |
| 59 | 59 | int AR; //Attack |
| r17917 | r17918 | |
| 63 | 63 | int DL; //Decay level |
| 64 | 64 | }; |
| 65 | 65 | |
| 66 | struct | |
| 66 | struct | |
| 67 | 67 | { |
| 68 | 68 | unsigned short phase; |
| 69 | 69 | UINT32 phase_step; |
| r17917 | r17918 | |
| 72 | 72 | }; |
| 73 | 73 | |
| 74 | 74 | |
| 75 | struct | |
| 75 | struct | |
| 76 | 76 | { |
| 77 | 77 | unsigned char Num; |
| 78 | 78 | unsigned char Regs[8]; |
| 79 | 79 | int Playing; |
| 80 | | |
| 80 | | |
| 81 | 81 | unsigned int Base; |
| 82 | 82 | unsigned int offset; |
| 83 | 83 | unsigned int step; |
| r17917 | r17918 | |
| 85 | 85 | unsigned int DstTL; |
| 86 | 86 | int TLStep; |
| 87 | 87 | signed int Prev; |
| 88 | struct _EG EG; | |
| 89 | struct _LFO PLFO; //Phase lfo | |
| 90 | struct _LFO ALFO; //AM lfo | |
| 88 | EG_t EG; | |
| 89 | LFO_t PLFO; //Phase lfo | |
| 90 | LFO_t ALFO; //AM lfo | |
| 91 | 91 | }; |
| 92 | 92 | |
| 93 | typedef struct _MultiPCM MultiPCM; | |
| 94 | struct _MultiPCM | |
| 93 | struct MultiPCM | |
| 95 | 94 | { |
| 96 | 95 | sound_stream * stream; |
| 97 | struct _Sample Samples[0x200]; //Max 512 samples | |
| 98 | struct _SLOT Slots[28]; | |
| 96 | Sample_t Samples[0x200]; //Max 512 samples | |
| 97 | SLOT Slots[28]; | |
| 99 | 98 | unsigned int CurSlot; |
| 100 | 99 | unsigned int Address; |
| 101 | 100 | unsigned int BankR,BankL; |
| r17917 | r17918 | |
| 150 | 149 | |
| 151 | 150 | #define EG_SHIFT 16 |
| 152 | 151 | |
| 153 | static int EG_Update( | |
| 152 | static int EG_Update( | |
| 154 | 153 | { |
| 155 | 154 | switch(slot->EG.state) |
| 156 | 155 | { |
| r17917 | r17918 | |
| 202 | 201 | return Steps[r]; |
| 203 | 202 | } |
| 204 | 203 | |
| 205 | static void EG_Calc(MultiPCM *ptChip, | |
| 204 | static void EG_Calc(MultiPCM *ptChip, | |
| 206 | 205 | { |
| 207 | 206 | int octave=((slot->Regs[3]>>4)-1)&0xf; |
| 208 | 207 | int rate; |
| r17917 | r17918 | |
| 284 | 283 | } |
| 285 | 284 | } |
| 286 | 285 | |
| 287 | INLINE signed int PLFO_Step( | |
| 286 | INLINE signed int PLFO_Step( | |
| 288 | 287 | { |
| 289 | 288 | int p; |
| 290 | 289 | LFO->phase+=LFO->phase_step; |
| r17917 | r17918 | |
| 293 | 292 | return p<<(SHIFT-LFO_SHIFT); |
| 294 | 293 | } |
| 295 | 294 | |
| 296 | INLINE signed int ALFO_Step( | |
| 295 | INLINE signed int ALFO_Step( | |
| 297 | 296 | { |
| 298 | 297 | int p; |
| 299 | 298 | LFO->phase+=LFO->phase_step; |
| r17917 | r17918 | |
| 302 | 301 | return p<<(SHIFT-LFO_SHIFT); |
| 303 | 302 | } |
| 304 | 303 | |
| 305 | static void LFO_ComputeStep(MultiPCM *ptChip, | |
| 304 | static void LFO_ComputeStep(MultiPCM *ptChip, | |
| 306 | 305 | { |
| 307 | 306 | float step=(float) LFOFreq[LFOF]*256.0/(float) ptChip->Rate; |
| 308 | 307 | LFO->phase_step=(unsigned int) ((float) (1<<LFO_SHIFT)*step); |
| r17917 | r17918 | |
| 320 | 319 | |
| 321 | 320 | |
| 322 | 321 | |
| 323 | static void WriteSlot(MultiPCM *ptChip, | |
| 322 | static void WriteSlot(MultiPCM *ptChip, | |
| 324 | 323 | { |
| 325 | 324 | slot->Regs[reg]=data; |
| 326 | 325 | |
| r17917 | r17918 | |
| 333 | 332 | //according to YMF278 sample write causes some base params written to the regs (envelope+lfos) |
| 334 | 333 | //the game should never change the sample while playing. |
| 335 | 334 | { |
| 336 | | |
| 335 | | |
| 337 | 336 | WriteSlot(ptChip,slot,6,Sample->LFOVIB); |
| 338 | 337 | WriteSlot(ptChip,slot,7,Sample->AM); |
| 339 | 338 | } |
| r17917 | r17918 | |
| 441 | 440 | signed int smpr=0; |
| 442 | 441 | for(sl=0;sl<28;++sl) |
| 443 | 442 | { |
| 444 | | |
| 443 | | |
| 445 | 444 | if(slot->Playing) |
| 446 | 445 | { |
| 447 | 446 | unsigned int vol=(slot->TL>>SHIFT)|(slot->Pan<<7); |
| r17917 | r17918 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | #define LFO_SHIFT 8 |
| 11 | 11 | |
| 12 | struct | |
| 12 | struct | |
| 13 | 13 | { |
| 14 | 14 | unsigned short phase; |
| 15 | 15 | UINT32 phase_step; |
| r17917 | r17918 | |
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | INLINE signed int AICAPLFO_Step( | |
| 106 | INLINE signed int AICAPLFO_Step( | |
| 107 | 107 | { |
| 108 | 108 | int p; |
| 109 | 109 | |
| r17917 | r17918 | |
| 116 | 116 | return p<<(SHIFT-LFO_SHIFT); |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | INLINE signed int AICAALFO_Step( | |
| 119 | INLINE signed int AICAALFO_Step( | |
| 120 | 120 | { |
| 121 | 121 | int p; |
| 122 | 122 | LFO->phase+=LFO->phase_step; |
| r17917 | r17918 | |
| 128 | 128 | return p<<(SHIFT-LFO_SHIFT); |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | static void AICALFO_ComputeStep( | |
| 131 | static void AICALFO_ComputeStep( | |
| 132 | 132 | { |
| 133 | 133 | float step=(float) LFOFreq[LFOF]*256.0/(float)44100.0; |
| 134 | 134 | LFO->phase_step=(unsigned int) ((float) (1<<LFO_SHIFT)*step); |
| r17917 | r17918 | |
|---|---|---|
| 30 | 30 | #define KDAC_A_PCM_MAX (2) /* Channels per chip */ |
| 31 | 31 | |
| 32 | 32 | |
| 33 | ||
| 33 | ||
| 34 | 34 | { |
| 35 | 35 | UINT8 vol[KDAC_A_PCM_MAX][2]; /* volume for the left and right channel */ |
| 36 | 36 | UINT32 addr[KDAC_A_PCM_MAX]; |
| r17917 | r17918 | |
| 48 | 48 | sound_stream * stream; |
| 49 | 49 | const k007232_interface *intf; |
| 50 | 50 | UINT32 fncode[0x200]; |
| 51 | } | |
| 51 | } | |
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | #define BASE_SHIFT (12) |
| r17917 | r17918 | |
|---|---|---|
| 121 | 121 | extern const device_type TMS5200N; |
| 122 | 122 | |
| 123 | 123 | |
| 124 | ||
| 124 | ||
| 125 | 125 | { |
| 126 | 126 | devcb_write_line irq_func; // IRQ callback function, active low, i.e. state=0 (TODO: change to ASSERT/CLEAR) |
| 127 | 127 | devcb_write_line readyq_func; // Ready callback function, active low, i.e. state=0 |
| r17917 | r17918 | |
| 130 | 130 | devcb_write8 load_address; // speech ROM load address callback |
| 131 | 131 | devcb_write8 read_and_branch; // speech ROM read and branch callback |
| 132 | 132 | |
| 133 | } | |
| 133 | } | |
| 134 | 134 | |
| 135 | 135 | // Change back from 5220n to 5220 when all client drivers will be converted |
| 136 | 136 | class tms52xx_device : public device_t, public device_sound_interface |
| r17917 | r17918 | |
|---|---|---|
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | /* DELTA-T (adpcm type B) struct */ |
| 16 | ||
| 16 | ||
| 17 | 17 | UINT8 *memory; |
| 18 | 18 | INT32 *output_pointer;/* pointer of output pointers */ |
| 19 | 19 | INT32 *pan; /* pan : &output_pointer[pan] */ |
| r17917 | r17918 | |
| 69 | 69 | |
| 70 | 70 | UINT8 reg[16]; /* adpcm registers */ |
| 71 | 71 | UINT8 emulation_mode; /* which chip we're emulating */ |
| 72 | } | |
| 72 | } | |
| 73 | 73 | |
| 74 | 74 | /*void YM_DELTAT_BRDY_callback(YM_DELTAT *DELTAT);*/ |
| 75 | 75 |
| r17917 | r17918 | |
|---|---|---|
| 39 | 39 | }; |
| 40 | 40 | |
| 41 | 41 | |
| 42 | /* typedef struct _palette_private palette_private; */ | |
| 43 | 42 | struct palette_private |
| 44 | 43 | { |
| 45 | 44 | bitmap_format format; /* format assumed for palette data */ |
| r17917 | r17918 | |
| 57 | 56 | }; |
| 58 | 57 | |
| 59 | 58 | |
| 60 | /* typedef struct _colortable_t colortable_t; */ | |
| 61 | 59 | class colortable_t |
| 62 | 60 | { |
| 63 | 61 | public: |
| r17917 | r17918 | |
|---|---|---|
| 13 | 13 | #include "formats/cassimg.h" |
| 14 | 14 | |
| 15 | 15 | |
| 16 | enum | |
| 16 | enum | |
| 17 | 17 | { |
| 18 | 18 | /* this part of the state is controlled by the UI */ |
| 19 | 19 | CASSETTE_STOPPED = 0, |
| r17917 | r17918 | |
| 33 | 33 | CASSETTE_MASK_DRVSTATE = 12 |
| 34 | 34 | }; |
| 35 | 35 | |
| 36 | typedef enum _cassette_state cassette_state; | |
| 37 | 36 | |
| 38 | ||
| 39 | 37 | /*************************************************************************** |
| 40 | 38 | TYPE DEFINITIONS |
| 41 | 39 | ***************************************************************************/ |
| r17917 | r17918 | |
|---|---|---|
| 50 | 50 | CLASS DEFINITION |
| 51 | 51 | ***************************************************************************/ |
| 52 | 52 | |
| 53 | ||
| 53 | ||
| 54 | 54 | { |
| 55 | 55 | int interrupt_mask; // a bit for each input pin whose state is always notified to the TMS9901 core |
| 56 | 56 | devcb_read8 read_handler; // 4*8 bits, to be selected using the offset (0-3) |
| 57 | 57 | devcb_write_line write_handler[16]; // 16 Pn outputs |
| 58 | 58 | devcb_write8 interrupt_callback; // called when interrupt bus state changes |
| 59 | } | |
| 59 | } | |
| 60 | 60 | |
| 61 | 61 | class tms9901_device : public device_t |
| 62 | 62 | { |
| r17917 | r17918 | |
|---|---|---|
| 29 | 29 | STATE_READY |
| 30 | 30 | }; |
| 31 | 31 | |
| 32 | typedef struct pic8259 pic8259_t; | |
| 33 | ||
| 34 | struct pic8259 | |
| 32 | struct pic8259_t | |
| 35 | 33 | { |
| 36 | 34 | devcb_resolved_write_line out_int_func; |
| 37 | 35 |
| r17917 | r17918 | |
|---|---|---|
| 42 | 42 | |
| 43 | 43 | extern const device_type TMS9902; |
| 44 | 44 | |
| 45 | ||
| 45 | ||
| 46 | 46 | { |
| 47 | 47 | devcb_write_line int_callback; |
| 48 | 48 | devcb_write_line rcv_callback; |
| 49 | 49 | devcb_write8 xmit_callback; |
| 50 | 50 | devcb_write8 ctrl_callback; |
| 51 | } | |
| 51 | } | |
| 52 | 52 | |
| 53 | 53 | class tms9902_device : public device_t |
| 54 | 54 | { |
| r17917 | r17918 | |
|---|---|---|
| 16 | 16 | |
| 17 | 17 | |
| 18 | 18 | |
| 19 | typedef struct _TTL74181_state TTL74181_state; | |
| 20 | struct _TTL74181_state | |
| 19 | struct TTL74181_state | |
| 21 | 20 | { |
| 22 | 21 | UINT8 inputs[TTL74181_INPUT_TOTAL]; |
| 23 | 22 | UINT8 outputs[TTL74181_OUTPUT_TOTAL]; |
| r17917 | r17918 | |
|---|---|---|
| 23 | 23 | MCFG_DEVICE_CONFIG(_intf) |
| 24 | 24 | |
| 25 | 25 | |
| 26 | typedef struct _SCSICB_interface SCSICB_interface; | |
| 27 | struct _SCSICB_interface | |
| 26 | struct SCSICB_interface | |
| 28 | 27 | { |
| 29 | 28 | void (*line_change_cb)(device_t *, UINT8 line, UINT8 state); |
| 30 | 29 |
| r17917 | r17918 | |
|---|---|---|
| 60 | 60 | //************************************************************************** |
| 61 | 61 | |
| 62 | 62 | // forward references |
| 63 | ||
| 63 | ||
| 64 | 64 | |
| 65 | 65 | |
| 66 | 66 | // structure describing an indexed mixer |
| r17917 | r17918 | |
|---|---|---|
| 12 | 12 | #include "imgterrs.h" |
| 13 | 13 | #include "corefile.h" |
| 14 | 14 | |
| 15 | ||
| 15 | ||
| 16 | 16 | |
| 17 | 17 | imgtool_stream *stream_open(const char *fname, int read_or_write); /* similar params to mame_fopen */ |
| 18 | 18 | imgtool_stream *stream_open_write_stream(int filesize); |
| r17917 | r17918 | |
|---|---|---|
| 12 | 12 | #include "library.h" |
| 13 | 13 | #include "pool.h" |
| 14 | 14 | |
| 15 | struct | |
| 15 | struct | |
| 16 | 16 | { |
| 17 | 17 | object_pool *pool; |
| 18 | 18 | imgtool_module *first; |
| r17917 | r17918 | |
| 32 | 32 | goto error; |
| 33 | 33 | |
| 34 | 34 | /* allocate the main structure */ |
| 35 | library = (imgtool_library *)pool_malloc_lib(pool, sizeof( | |
| 35 | library = (imgtool_library *)pool_malloc_lib(pool, sizeof( | |
| 36 | 36 | if (!library) |
| 37 | 37 | goto error; |
| 38 | 38 |
| r17917 | r17918 | |
|---|---|---|
| 25 | 25 | #include "charconv.h" |
| 26 | 26 | |
| 27 | 27 | |
| 28 | typedef struct _imgtool_image imgtool_image; | |
| 29 | typedef struct _imgtool_partition imgtool_partition; | |
| 30 | typedef struct _imgtool_directory imgtool_directory; | |
| 31 | typedef struct _imgtool_library imgtool_library; | |
| 28 | struct imgtool_image; | |
| 29 | struct imgtool_partition; | |
| 30 | struct imgtool_directory; | |
| 31 | struct imgtool_library; | |
| 32 | 32 | |
| 33 | 33 | enum imgtool_suggestion_viability_t |
| 34 | 34 | { |
| r17917 | r17918 | |
| 228 | 228 | |
| 229 | 229 | |
| 230 | 230 | union imgtoolinfo; |
| 231 | typedef struct _imgtool_class imgtool_class; | |
| 232 | 231 | |
| 232 | struct imgtool_class; | |
| 233 | 233 | typedef void (*imgtool_get_info)(const imgtool_class *, UINT32, union imgtoolinfo *); |
| 234 | 234 | |
| 235 | struct | |
| 235 | struct | |
| 236 | 236 | { |
| 237 | 237 | imgtool_get_info get_info; |
| 238 | 238 | imgtool_get_info derived_get_info; |
| r17917 | r17918 | |
|---|---|---|
| 20 | 20 | TYPE DEFINITIONS |
| 21 | 21 | ***************************************************************************/ |
| 22 | 22 | |
| 23 | struct | |
| 23 | struct | |
| 24 | 24 | { |
| 25 | 25 | const imgtool_module *module; |
| 26 | 26 | object_pool *pool; |
| 27 | 27 | }; |
| 28 | 28 | |
| 29 | struct | |
| 29 | struct | |
| 30 | 30 | { |
| 31 | 31 | imgtool_image *image; |
| 32 | 32 | object_pool *pool; |
| r17917 | r17918 | |
| 68 | 68 | const char *writefile_optspec; |
| 69 | 69 | }; |
| 70 | 70 | |
| 71 | struct | |
| 71 | struct | |
| 72 | 72 | { |
| 73 | 73 | imgtool_partition *partition; |
| 74 | 74 | }; |
| r17917 | r17918 | |
| 1121 | 1121 | } |
| 1122 | 1122 | |
| 1123 | 1123 | /* setup the image structure */ |
| 1124 | size = sizeof( | |
| 1124 | size = sizeof( | |
| 1125 | 1125 | image = (imgtool_image *) pool_malloc_lib(pool, size); |
| 1126 | 1126 | if (!image) |
| 1127 | 1127 | { |
| r17917 | r17918 | |
| 2640 | 2640 | if (err) |
| 2641 | 2641 | goto done; |
| 2642 | 2642 | |
| 2643 | size = sizeof( | |
| 2643 | size = sizeof( | |
| 2644 | 2644 | enumeration = (imgtool_directory *) malloc(size); |
| 2645 | 2645 | if (!enumeration) |
| 2646 | 2646 | { |
| r17917 | r17918 | |
|---|---|---|
| 266 | 266 | Miscellaneous utilities that are used to handle TI data types |
| 267 | 267 | */ |
| 268 | 268 | |
| 269 | ||
| 269 | ||
| 270 | 270 | { |
| 271 | 271 | UINT8 bytes[2]; |
| 272 | } | |
| 272 | } | |
| 273 | 273 | |
| 274 | ||
| 274 | ||
| 275 | 275 | { |
| 276 | 276 | UINT8 bytes[2]; |
| 277 | } | |
| 277 | } | |
| 278 | 278 | |
| 279 | 279 | INLINE UINT16 get_UINT16BE(UINT16BE word) |
| 280 | 280 | { |
| r17917 | r17918 | |
| 456 | 456 | /* |
| 457 | 457 | Disk geometry |
| 458 | 458 | */ |
| 459 | ||
| 459 | ||
| 460 | 460 | { |
| 461 | 461 | int secspertrack; |
| 462 | 462 | int cylinders; |
| 463 | 463 | int heads; |
| 464 | } | |
| 464 | } | |
| 465 | 465 | |
| 466 | 466 | /* |
| 467 | 467 | Physical sector address |
| 468 | 468 | */ |
| 469 | ||
| 469 | ||
| 470 | 470 | { |
| 471 | 471 | int sector; |
| 472 | 472 | int cylinder; |
| 473 | 473 | int side; |
| 474 | } | |
| 474 | } | |
| 475 | 475 | |
| 476 | 476 | /* |
| 477 | 477 | Time stamp (used in fdr, and WIN VIB/DDR) |
| 478 | 478 | */ |
| 479 | ||
| 479 | ||
| 480 | 480 | { |
| 481 | 481 | UINT8 time_MSB, time_LSB;/* 0-4: hour, 5-10: minutes, 11-15: seconds/2 */ |
| 482 | 482 | UINT8 date_MSB, date_LSB;/* 0-6: year, 7-10: month, 11-15: day */ |
| 483 | } | |
| 483 | } | |
| 484 | 484 | |
| 485 | 485 | /* |
| 486 | 486 | Subdirectory descriptor (HFDC only) |
| 487 | 487 | |
| 488 | 488 | The HFDC supports up to 3 subdirectories. |
| 489 | 489 | */ |
| 490 | ||
| 490 | ||
| 491 | 491 | { |
| 492 | 492 | char name[10]; /* subdirectory name (10 characters, pad with spaces) */ |
| 493 | 493 | UINT16BE fdir_aphysrec; /* aphysrec address of fdir record for this subdirectory */ |
| 494 | } | |
| 494 | } | |
| 495 | 495 | |
| 496 | 496 | /* |
| 497 | 497 | DSK VIB record |
| r17917 | r17918 | |
| 499 | 499 | Most fields in this record are only revelant to level 2 routines, but level |
| 500 | 500 | 1 routines need the disk geometry information extracted from the VIB. |
| 501 | 501 | */ |
| 502 | ||
| 502 | ||
| 503 | 503 | { |
| 504 | 504 | char name[10]; /* disk volume name (10 characters, pad with spaces) */ |
| 505 | 505 | UINT16BE totphysrecs; /* total number of physrecs on disk (usually 360, */ |
| r17917 | r17918 | |
| 526 | 526 | /* (AU 0 is associated to LSBit of byte 0, */ |
| 527 | 527 | /* AU 7 to MSBit of byte 0, AU 8 to LSBit */ |
| 528 | 528 | /* of byte 1, etc.) */ |
| 529 | } | |
| 529 | } | |
| 530 | 530 | |
| 531 | 531 | enum ti99_img_format |
| 532 | 532 | { |
| r17917 | r17918 | |
| 540 | 540 | /* |
| 541 | 541 | level-1 disk image descriptor |
| 542 | 542 | */ |
| 543 | ||
| 543 | ||
| 544 | 544 | { |
| 545 | 545 | ti99_img_format img_format; /* tells the image format */ |
| 546 | 546 | imgtool_stream *file_handle; /* imgtool file handle */ |
| r17917 | r17918 | |
| 548 | 548 | ti99_geometry geometry; /* geometry */ |
| 549 | 549 | unsigned pc99_track_len; /* unformatted track length (pc99 format) */ |
| 550 | 550 | UINT32 *pc99_data_offset_array; /* offset for each sector (pc99 format) */ |
| 551 | } | |
| 551 | } | |
| 552 | 552 | |
| 553 | 553 | /* |
| 554 | 554 | calculate CRC for data address marks or sector data |
| r17917 | r17918 | |
| 1384 | 1384 | /* |
| 1385 | 1385 | WIN VIB/DDR record |
| 1386 | 1386 | */ |
| 1387 | ||
| 1387 | ||
| 1388 | 1388 | { |
| 1389 | 1389 | char name[10]; /* disk volume name (10 characters, pad with spaces) */ |
| 1390 | 1390 | UINT16BE totAUs; /* total number of AUs */ |
| r17917 | r17918 | |
| 1437 | 1437 | } ddr; |
| 1438 | 1438 | } u2; |
| 1439 | 1439 | UINT16BE subdir_AU[114];/* points to all subdirectory DDRs */ |
| 1440 | } | |
| 1440 | } | |
| 1441 | 1441 | |
| 1442 | 1442 | /* |
| 1443 | 1443 | AU format |
| 1444 | 1444 | */ |
| 1445 | ||
| 1445 | ||
| 1446 | 1446 | { |
| 1447 | 1447 | int totAUs; /* total number of AUs */ |
| 1448 | 1448 | int physrecsperAU; /* number of 256-byte physical records per AU */ |
| 1449 | } | |
| 1449 | } | |
| 1450 | 1450 | |
| 1451 | 1451 | /* |
| 1452 | 1452 | DSK directory reference: 0 for root, 1 for 1st subdir, 2 for 2nd subdir, 3 |
| r17917 | r17918 | |
| 1457 | 1457 | /* |
| 1458 | 1458 | catalog entry (used for in-memory catalog) |
| 1459 | 1459 | */ |
| 1460 | ||
| 1460 | ||
| 1461 | 1461 | { |
| 1462 | 1462 | UINT16 dir_ptr; /* DSK: unused */ |
| 1463 | 1463 | /* WIN: AU address of the DDR for this directory */ |
| 1464 | 1464 | char name[10]; /* name of this directory (copied from the VIB for DSK, DDR for WIN) */ |
| 1465 | } | |
| 1465 | } | |
| 1466 | 1466 | |
| 1467 | ||
| 1467 | ||
| 1468 | 1468 | { |
| 1469 | 1469 | UINT16 fdr_ptr; /* DSK: aphysrec address of the FDR for this file */ |
| 1470 | 1470 | /* WIN: AU address of the FDR for this file */ |
| 1471 | 1471 | char name[10]; /* name of this file (copied from FDR) */ |
| 1472 | } | |
| 1472 | } | |
| 1473 | 1473 | |
| 1474 | ||
| 1474 | ||
| 1475 | 1475 | { |
| 1476 | 1476 | int num_subdirs; /* number of subdirectories */ |
| 1477 | 1477 | int num_files; /* number of files */ |
| 1478 | 1478 | dir_entry subdirs[114]; /* description of each subdir */ |
| 1479 | 1479 | file_entry files[128]; /* description of each file */ |
| 1480 | } | |
| 1480 | } | |
| 1481 | 1481 | |
| 1482 | 1482 | /* |
| 1483 | 1483 | level-2 disk image descriptor |
| 1484 | 1484 | */ |
| 1485 | ||
| 1485 | ||
| 1486 | 1486 | { |
| 1487 | 1487 | UINT16 totphysrecs; /* total number of aphysrecs (extracted from vib record in aphysrec 0) */ |
| 1488 | 1488 | ti99_catalog catalogs[4]; /* catalog of root directory and up to 3 subdirectories */ |
| 1489 | 1489 | UINT16 fdir_aphysrec[4]; /* fdir aphysrec address for root directory |
| 1490 | 1490 | and up to 3 subdirectories */ |
| 1491 | } | |
| 1491 | } | |
| 1492 | 1492 | |
| 1493 | 1493 | enum win_vib_t |
| 1494 | 1494 | { |
| 1495 | 1495 | win_vib_v1, |
| 1496 | 1496 | win_vib_v2 |
| 1497 | 1497 | }; |
| 1498 | ||
| 1498 | ||
| 1499 | 1499 | { |
| 1500 | 1500 | win_vib_t vib_version; /* version of the vib record in aphysrec 0 (see win_vib_ddr) */ |
| 1501 | } | |
| 1501 | } | |
| 1502 | 1502 | |
| 1503 | 1503 | enum l2i_t |
| 1504 | 1504 | { |
| 1505 | 1505 | L2I_DSK, |
| 1506 | 1506 | L2I_WIN |
| 1507 | 1507 | }; |
| 1508 | ||
| 1508 | ||
| 1509 | 1509 | { |
| 1510 | 1510 | ti99_lvl1_imgref l1_img;/* image format, imgtool image handle, image geometry */ |
| 1511 | 1511 | ti99_AUformat AUformat; /* AU format */ |
| r17917 | r17918 | |
| 1535 | 1535 | { |
| 1536 | 1536 | ti99_lvl2_imgref_dsk dsk; |
| 1537 | 1537 | ti99_lvl2_imgref_win win; |
| 1538 | } | |
| 1538 | } | |
| 1539 | 1539 | } ti99_lvl2_imgref; |
| 1540 | 1540 | |
| 1541 | 1541 | /* |
| r17917 | r17918 | |
| 1554 | 1554 | /* |
| 1555 | 1555 | DSK FDR record |
| 1556 | 1556 | */ |
| 1557 | ||
| 1557 | ||
| 1558 | 1558 | { |
| 1559 | 1559 | char name[10]; /* file name (10 characters, pad with spaces) */ |
| 1560 | 1560 | UINT16BE xreclen; /* extended record len: if record len is >= 256, */ |
| r17917 | r17918 | |
| 1595 | 1595 | /* bytes each), one entry for each file cluster. */ |
| 1596 | 1596 | /* 12 bits: address of first AU of cluster */ |
| 1597 | 1597 | /* 12 bits: offset of last 256-byte record in cluster */ |
| 1598 | } | |
| 1598 | } | |
| 1599 | 1599 | |
| 1600 | 1600 | /* |
| 1601 | 1601 | WIN FDR record |
| 1602 | 1602 | */ |
| 1603 | ||
| 1603 | ||
| 1604 | 1604 | { |
| 1605 | 1605 | char name[10]; /* file name (10 characters, pad with spaces) */ |
| 1606 | 1606 | UINT16BE xreclen; /* extended record len: if record len is >= 256, */ |
| r17917 | r17918 | |
| 1657 | 1657 | /* bytes each), one entry for each file cluster. */ |
| 1658 | 1658 | /* 16 bits: address of first AU of cluster */ |
| 1659 | 1659 | /* 16 bits: address of last AU of cluster */ |
| 1660 | } | |
| 1660 | } | |
| 1661 | 1661 | |
| 1662 | 1662 | /* |
| 1663 | 1663 | tifile header: stand-alone file |
| 1664 | 1664 | */ |
| 1665 | ||
| 1665 | ||
| 1666 | 1666 | { |
| 1667 | 1667 | char tifiles[8]; /* always '\7TIFILES' */ |
| 1668 | 1668 | UINT16BE fphysrecs; /* file length in physrecs */ |
| r17917 | r17918 | |
| 1697 | 1697 | /* 4 bytes: time & date of last update */ |
| 1698 | 1698 | /* 2 bytes: unknown (always >0000) */ |
| 1699 | 1699 | /* 96 chars: 0xCA53 repeated 56 times */ |
| 1700 | } | |
| 1700 | } | |
| 1701 | 1701 | |
| 1702 | 1702 | /* |
| 1703 | 1703 | level-2 file descriptor |
| 1704 | 1704 | */ |
| 1705 | ||
| 1705 | ||
| 1706 | 1706 | { |
| 1707 | 1707 | ti99_lvl2_imgref *l2_img; |
| 1708 | 1708 | int fdr_aphysrec; |
| 1709 | 1709 | dsk_fdr fdr; |
| 1710 | } | |
| 1710 | } | |
| 1711 | 1711 | |
| 1712 | ||
| 1712 | ||
| 1713 | 1713 | { |
| 1714 | 1714 | ti99_lvl2_imgref *l2_img; |
| 1715 | 1715 | unsigned fphysrecs; /* copy of field in the eldest FDR */ |
| 1716 | 1716 | unsigned eldestfdr_aphysrec; /* aphysrec address of the eldest FDR */ |
| 1717 | 1717 | unsigned curfdr_aphysrec; /* aphysrec address of the currently open sibling FDR */ |
| 1718 | 1718 | win_fdr curfdr; /* buffer with currently open sibling FDR */ |
| 1719 | } | |
| 1719 | } | |
| 1720 | 1720 | |
| 1721 | ||
| 1721 | ||
| 1722 | 1722 | { |
| 1723 | 1723 | imgtool_stream *file_handle; |
| 1724 | 1724 | tifile_header hdr; |
| 1725 | } | |
| 1725 | } | |
| 1726 | 1726 | |
| 1727 | 1727 | enum l2f_type_t |
| 1728 | 1728 | { |
| r17917 | r17918 | |
| 1730 | 1730 | L2F_WIN, |
| 1731 | 1731 | L2F_TIFILES |
| 1732 | 1732 | }; |
| 1733 | ||
| 1733 | ||
| 1734 | 1734 | { |
| 1735 | 1735 | l2f_type_t type; |
| 1736 | 1736 | union |
| r17917 | r17918 | |
| 1738 | 1738 | ti99_lvl2_fileref_dsk dsk; |
| 1739 | 1739 | ti99_lvl2_fileref_win win; |
| 1740 | 1740 | ti99_lvl2_fileref_tifiles tifiles; |
| 1741 | } | |
| 1741 | } | |
| 1742 | 1742 | } ti99_lvl2_fileref; |
| 1743 | 1743 | |
| 1744 | 1744 | |
| r17917 | r17918 | |
| 3696 | 3696 | * files with variable-size records (sequential-access) |
| 3697 | 3697 | */ |
| 3698 | 3698 | |
| 3699 | ||
| 3699 | ||
| 3700 | 3700 | { |
| 3701 | 3701 | ti99_lvl2_fileref l2_file; |
| 3702 | 3702 | |
| 3703 | 3703 | int cur_log_rec; |
| 3704 | 3704 | int cur_phys_rec; |
| 3705 | 3705 | int cur_pos_in_phys_rec; |
| 3706 | } | |
| 3706 | } | |
| 3707 | 3707 | |
| 3708 | 3708 | #ifdef UNUSED_FUNCTION |
| 3709 | 3709 | /* |
| r17917 | r17918 | |
| 3827 | 3827 | /* |
| 3828 | 3828 | ti99 catalog iterator, used when imgtool reads the catalog |
| 3829 | 3829 | */ |
| 3830 | ||
| 3830 | ||
| 3831 | 3831 | { |
| 3832 | 3832 | ti99_lvl2_imgref *image; |
| 3833 | 3833 | int level; |
| 3834 | 3834 | int listing_subdirs; /* true if we are listing subdirectories at current level */ |
| 3835 | 3835 | int index[2]; /* current index in the disk catalog */ |
| 3836 | 3836 | ti99_catalog *cur_catalog; /* current catalog */ |
| 3837 | } | |
| 3837 | } | |
| 3838 | 3838 | |
| 3839 | ||
| 3839 | ||
| 3840 | 3840 | { |
| 3841 | 3841 | ti99_lvl2_imgref *image; |
| 3842 | 3842 | int level; |
| 3843 | 3843 | int listing_subdirs; /* true if we are listing subdirectories at current level */ |
| 3844 | 3844 | int index[MAX_DIR_LEVEL]; /* current index in the disk catalog */ |
| 3845 | 3845 | ti99_catalog catalog[MAX_DIR_LEVEL]; /* current catalog */ |
| 3846 | } | |
| 3846 | } | |
| 3847 | 3847 | |
| 3848 | 3848 | |
| 3849 | 3849 | static imgtoolerr_t dsk_image_init_mess(imgtool_image *image, imgtool_stream *f); |
| r17917 | r17918 | |
|---|---|---|
| 114 | 114 | #pragma mark MISCELLANEOUS UTILITIES |
| 115 | 115 | #endif |
| 116 | 116 | |
| 117 | ||
| 117 | ||
| 118 | 118 | { |
| 119 | 119 | UINT8 bytes[2]; |
| 120 | } | |
| 120 | } | |
| 121 | 121 | |
| 122 | ||
| 122 | ||
| 123 | 123 | { |
| 124 | 124 | UINT8 bytes[3]; |
| 125 | } | |
| 125 | } | |
| 126 | 126 | |
| 127 | ||
| 127 | ||
| 128 | 128 | { |
| 129 | 129 | UINT8 bytes[4]; |
| 130 | } | |
| 130 | } | |
| 131 | 131 | |
| 132 | 132 | INLINE UINT16 get_UINT16BE(UINT16BE word) |
| 133 | 133 | { |
| r17917 | r17918 | |
| 181 | 181 | /* |
| 182 | 182 | point record, with the y and x coordinates |
| 183 | 183 | */ |
| 184 | ||
| 184 | ||
| 185 | 185 | { |
| 186 | 186 | UINT16BE v; /* actually signed */ |
| 187 | 187 | UINT16BE h; /* actually signed */ |
| 188 | } | |
| 188 | } | |
| 189 | 189 | |
| 190 | 190 | /* |
| 191 | 191 | rect record, with the corner coordinates |
| 192 | 192 | */ |
| 193 | ||
| 193 | ||
| 194 | 194 | { |
| 195 | 195 | UINT16BE top; /* actually signed */ |
| 196 | 196 | UINT16BE left; /* actually signed */ |
| 197 | 197 | UINT16BE bottom;/* actually signed */ |
| 198 | 198 | UINT16BE right; /* actually signed */ |
| 199 | } | |
| 199 | } | |
| 200 | 200 | |
| 201 | 201 | /* |
| 202 | 202 | FInfo (Finder file info) record |
| 203 | 203 | */ |
| 204 | ||
| 204 | ||
| 205 | 205 | { |
| 206 | 206 | mac_type type; /* file type */ |
| 207 | 207 | mac_type creator; /* file creator */ |
| r17917 | r17918 | |
| 221 | 221 | /* HFS & HFS+: |
| 222 | 222 | System 7: The window in which the file???s icon appears |
| 223 | 223 | System 8: reserved (set to 0) */ |
| 224 | } | |
| 224 | } | |
| 225 | 225 | |
| 226 | 226 | /* |
| 227 | 227 | FXInfo (Finder extended file info) record -- not found in MFS |
| 228 | 228 | */ |
| 229 | ||
| 229 | ||
| 230 | 230 | { |
| 231 | 231 | UINT16BE iconID; /* System 7: An ID number for the file???s icon; the |
| 232 | 232 | numbers that identify icons are assigned by the |
| r17917 | r17918 | |
| 243 | 243 | file onto the desktop, the directory ID of the |
| 244 | 244 | folder from which the user moves the file is |
| 245 | 245 | saved here) */ |
| 246 | } | |
| 246 | } | |
| 247 | 247 | |
| 248 | 248 | /* |
| 249 | 249 | DInfo (Finder folder info) record -- not found in MFS |
| 250 | 250 | */ |
| 251 | ||
| 251 | ||
| 252 | 252 | { |
| 253 | 253 | mac_rect rect; /* Folder's window bounds */ |
| 254 | 254 | UINT16BE flags; /* Finder flags, e.g. kIsInvisible, kNameLocked, etc */ |
| r17917 | r17918 | |
| 259 | 259 | UINT16BE view; /* System 7: The manner in which folders are |
| 260 | 260 | displayed */ |
| 261 | 261 | /* System 8: reserved (set to 0) */ |
| 262 | } | |
| 262 | } | |
| 263 | 263 | |
| 264 | 264 | /* |
| 265 | 265 | DXInfo (Finder extended folder info) record -- not found in MFS |
| 266 | 266 | */ |
| 267 | ||
| 267 | ||
| 268 | 268 | { |
| 269 | 269 | mac_point scroll; /* Scroll position */ |
| 270 | 270 | UINT32BE openChain; /* System 7: chain of directory IDs for open folders */ |
| r17917 | r17918 | |
| 279 | 279 | folder onto the desktop, the directory ID of |
| 280 | 280 | the folder from which the user moves it is |
| 281 | 281 | saved here) */ |
| 282 | } | |
| 282 | } | |
| 283 | 283 | |
| 284 | 284 | /* |
| 285 | 285 | defines for FInfo & DInfo flags fields |
| r17917 | r17918 | |
| 609 | 609 | /* |
| 610 | 610 | disk image reference |
| 611 | 611 | */ |
| 612 | ||
| 612 | ||
| 613 | 613 | { |
| 614 | 614 | imgtool_image *image; |
| 615 | 615 | UINT32 heads; |
| 616 | } | |
| 616 | } | |
| 617 | 617 | |
| 618 | 618 | |
| 619 | 619 | |
| r17917 | r17918 | |
| 752 | 752 | |
| 753 | 753 | enum mac_forkID { data_fork = 0x00, rsrc_fork = 0xff }; |
| 754 | 754 | |
| 755 | typedef struct mac_l2_imgref mac_l2_imgref; | |
| 756 | ||
| 757 | 755 | /* |
| 758 | 756 | MFS image ref |
| 759 | 757 | */ |
| 760 | ||
| 758 | ||
| 761 | 759 | { |
| 762 | 760 | UINT16 dir_num_files; |
| 763 | 761 | UINT16 dir_start; |
| r17917 | r17918 | |
| 769 | 767 | |
| 770 | 768 | unsigned char ABlink_dirty[13]; /* dirty flag for each disk block in the ABlink array */ |
| 771 | 769 | UINT8 ABlink[6141]; |
| 772 | } | |
| 770 | } | |
| 773 | 771 | |
| 774 | 772 | /* |
| 775 | 773 | HFS extent descriptor |
| 776 | 774 | */ |
| 777 | ||
| 775 | ||
| 778 | 776 | { |
| 779 | 777 | UINT16BE stABN; /* first allocation block */ |
| 780 | 778 | UINT16BE numABlks; /* number of allocation blocks */ |
| 781 | } | |
| 779 | } | |
| 782 | 780 | |
| 783 | 781 | /* |
| 784 | 782 | HFS likes to group extents by 3 (it is 8 with HFS+), so we create a |
| r17917 | r17918 | |
| 789 | 787 | /* |
| 790 | 788 | MFS open file ref |
| 791 | 789 | */ |
| 792 | ||
| 790 | ||
| 793 | 791 | { |
| 794 | 792 | UINT16 stBlk; /* first allocation block of file */ |
| 795 | } | |
| 793 | } | |
| 796 | 794 | |
| 797 | 795 | /* |
| 798 | 796 | HFS open file ref |
| 799 | 797 | */ |
| 800 | ||
| 798 | ||
| 801 | 799 | { |
| 802 | 800 | hfs_extent_3 extents; /* first 3 file extents */ |
| 803 | 801 | |
| 804 | 802 | UINT32 parID; /* CNID of parent directory (undefined for extent & catalog files) */ |
| 805 | 803 | mac_str31 filename; /* file name (undefined for extent & catalog files) */ |
| 806 | } | |
| 804 | } | |
| 807 | 805 | |
| 808 | 806 | /* |
| 809 | 807 | MFS/HFS open file ref |
| 810 | 808 | */ |
| 811 | ||
| 809 | ||
| 812 | 810 | { |
| 813 | 811 | mac_l2_imgref *l2_img; /* image pointer */ |
| 814 | 812 | |
| r17917 | r17918 | |
| 828 | 826 | { |
| 829 | 827 | mfs_fileref mfs; |
| 830 | 828 | hfs_fileref hfs; |
| 831 | } | |
| 829 | } | |
| 832 | 830 | } mac_fileref; |
| 833 | 831 | |
| 834 | 832 | /* |
| 835 | 833 | open BT ref |
| 836 | 834 | */ |
| 837 | ||
| 835 | ||
| 838 | 836 | { |
| 839 | 837 | mac_fileref fileref; /* open B-tree file ref */ |
| 840 | 838 | |
| r17917 | r17918 | |
| 849 | 847 | int (*key_compare_func)(const void *key1, const void *key2); |
| 850 | 848 | |
| 851 | 849 | void *node_buf; /* current node buffer */ |
| 852 | } | |
| 850 | } | |
| 853 | 851 | |
| 854 | 852 | /* |
| 855 | 853 | Constants for BTHeaderRec attributes field |
| r17917 | r17918 | |
| 864 | 862 | /* |
| 865 | 863 | HFS image ref |
| 866 | 864 | */ |
| 867 | ||
| 865 | ||
| 868 | 866 | { |
| 869 | 867 | UINT16 VBM_start; |
| 870 | 868 | |
| r17917 | r17918 | |
| 876 | 874 | mac_BTref cat_BT; |
| 877 | 875 | |
| 878 | 876 | UINT8 VBM[8192]; |
| 879 | } | |
| 877 | } | |
| 880 | 878 | |
| 881 | 879 | /* |
| 882 | 880 | MFS/HFS image ref |
| r17917 | r17918 | |
| 903 | 901 | /* |
| 904 | 902 | MFS Master Directory Block |
| 905 | 903 | */ |
| 906 | ||
| 904 | ||
| 907 | 905 | { |
| 908 | 906 | UINT8 sigWord[2]; /* volume signature - always $D2D7 */ |
| 909 | 907 | UINT32BE crDate; /* date and time of volume creation */ |
| r17917 | r17918 | |
| 938 | 936 | was that the disk utility could rely on the tag |
| 939 | 937 | data to rebuild the link array if it should ever |
| 940 | 938 | be corrupted. */ |
| 941 | } | |
| 939 | } | |
| 942 | 940 | |
| 943 | 941 | /* |
| 944 | 942 | HFS Master Directory Block |
| 945 | 943 | */ |
| 946 | ||
| 944 | ||
| 947 | 945 | { |
| 948 | 946 | /* First fields are similar to MFS, though several fields have a different meaning */ |
| 949 | 947 | UINT8 sigWord[2]; /* volume signature - always $D2D7 */ |
| r17917 | r17918 | |
| 983 | 981 | UINT16BE VCSize; /* size (in blocks) of volume cache */ |
| 984 | 982 | UINT16BE VBMCSize; /* size (in blocks) of volume bitmap cache */ |
| 985 | 983 | UINT16BE ctlCSize; /* size (in blocks) of common volume cache */ |
| 986 | } | |
| 984 | } | |
| 987 | 985 | struct |
| 988 | 986 | { |
| 989 | 987 | UINT16BE embedSigWord; /* embedded volume signature */ |
| r17917 | r17918 | |
| 998 | 996 | } hfs_mdb_t; |
| 999 | 997 | |
| 1000 | 998 | /* to save a little stack space, we use the same buffer for MDB and next blocks */ |
| 1001 | ||
| 999 | ||
| 1002 | 1000 | { |
| 1003 | 1001 | mfs_mdb_t mfs_mdb; |
| 1004 | 1002 | hfs_mdb_t hfs_mdb; |
| 1005 | 1003 | UINT8 raw[512]; |
| 1006 | } | |
| 1004 | } | |
| 1007 | 1005 | |
| 1008 | 1006 | /* |
| 1009 | 1007 | Information extracted from catalog/directory |
| 1010 | 1008 | */ |
| 1011 | ||
| 1009 | ||
| 1012 | 1010 | { |
| 1013 | 1011 | UINT16 dataRecType; /* type of data record */ |
| 1014 | 1012 | |
| r17917 | r17918 | |
| 1026 | 1024 | |
| 1027 | 1025 | UINT32 createDate; /* date and time of creation */ |
| 1028 | 1026 | UINT32 modifyDate; /* date and time of last modification */ |
| 1029 | } | |
| 1027 | } | |
| 1030 | 1028 | |
| 1031 | 1029 | /* |
| 1032 | 1030 | Tag record for GCR floppies (12 bytes) |
| 1033 | 1031 | |
| 1034 | 1032 | And, no, I don't know the format of the 20-byte tag record of the HD20 |
| 1035 | 1033 | */ |
| 1036 | ||
| 1034 | ||
| 1037 | 1035 | { |
| 1038 | 1036 | UINT32BE fileID; /* a.k.a. CNID */ |
| 1039 | 1037 | /* a value of 1 seems to be the default for non-AB blocks, but this is not consistent */ |
| r17917 | r17918 | |
| 1051 | 1049 | each time a volume is written to, the current value of |
| 1052 | 1050 | wrCnt is written in the tag field, then it is incremented */ |
| 1053 | 1051 | /* (DV17 says "disk block number", but it cannot be true) */ |
| 1054 | } | |
| 1052 | } | |
| 1055 | 1053 | |
| 1056 | 1054 | #ifdef UNUSED_FUNCTION |
| 1057 | 1055 | static void hfs_image_close(mac_l2_imgref *l2_img); |
| r17917 | r17918 | |
| 1452 | 1450 | files appear does not match file names, and it does not always match file |
| 1453 | 1451 | IDs. |
| 1454 | 1452 | */ |
| 1455 | ||
| 1453 | ||
| 1456 | 1454 | { |
| 1457 | 1455 | UINT8 flags; /* bit 7=1 if entry used, bit 0=1 if file locked */ |
| 1458 | 1456 | /* 0x00 means end of block: if we are not done |
| r17917 | r17918 | |
| 1478 | 1476 | /* next chars are file name - 255 chars at most */ |
| 1479 | 1477 | /* IIRC, Finder 7 only supports 31 chars, |
| 1480 | 1478 | wheareas earlier versions support 63 chars */ |
| 1481 | } | |
| 1479 | } | |
| 1482 | 1480 | |
| 1483 | 1481 | /* |
| 1484 | 1482 | FOBJ desktop resource: describes a folder, or the location of the volume |
| r17917 | r17918 | |
| 1487 | 1485 | In typical Apple manner, this resource is not documented. However, I have |
| 1488 | 1486 | managed to reverse engineer some parts of it. |
| 1489 | 1487 | */ |
| 1490 | ||
| 1488 | ||
| 1491 | 1489 | { |
| 1492 | 1490 | UINT8 unknown0[2]; /* $00: $0004 for disk, $0008 for folder??? */ |
| 1493 | 1491 | mac_point location; /* $02: location in parent window */ |
| r17917 | r17918 | |
| 1522 | 1520 | UINT8 name[1]; /* variable-length macintosh string */ |
| 1523 | 1521 | } v2; |
| 1524 | 1522 | } u; |
| 1525 | } | |
| 1523 | } | |
| 1526 | 1524 | |
| 1527 | 1525 | /* |
| 1528 | 1526 | MFS open dir ref |
| 1529 | 1527 | */ |
| 1530 | ||
| 1528 | ||
| 1531 | 1529 | { |
| 1532 | 1530 | mac_l2_imgref *l2_img; /* image pointer */ |
| 1533 | 1531 | UINT16 index; /* current file index in the disk directory */ |
| 1534 | 1532 | UINT16 cur_block; /* current block offset in directory file */ |
| 1535 | 1533 | UINT16 cur_offset; /* current byte offset in current block of directory file */ |
| 1536 | 1534 | UINT8 block_buffer[512]; /* buffer with current directory block */ |
| 1537 | } | |
| 1535 | } | |
| 1538 | 1536 | |
| 1539 | 1537 | |
| 1540 | 1538 | |
| r17917 | r17918 | |
| 2770 | 2768 | /* |
| 2771 | 2769 | HFS extents B-tree key |
| 2772 | 2770 | */ |
| 2773 | ||
| 2771 | ||
| 2774 | 2772 | { |
| 2775 | 2773 | UINT8 keyLength; /* length of key, excluding this field */ |
| 2776 | 2774 | UINT8 forkType; /* 0 = data fork, FF = resource fork */ |
| 2777 | 2775 | UINT32BE fileID; /* file ID */ |
| 2778 | 2776 | UINT16BE startBlock; /* first file allocation block number in this extent */ |
| 2779 | } | |
| 2777 | } | |
| 2780 | 2778 | enum |
| 2781 | 2779 | { |
| 2782 | 2780 | keyLength_hfs_extentKey = sizeof(hfs_extentKey) - sizeof(UINT8) |
| r17917 | r17918 | |
| 2785 | 2783 | /* |
| 2786 | 2784 | HFS catalog B-tree key |
| 2787 | 2785 | */ |
| 2788 | ||
| 2786 | ||
| 2789 | 2787 | { |
| 2790 | 2788 | UINT8 keyLen; /* key length */ |
| 2791 | 2789 | UINT8 resrv1; /* reserved */ |
| r17917 | r17918 | |
| 2793 | 2791 | mac_str31 cName; /* catalog node name */ |
| 2794 | 2792 | /* note that in index nodes, it is a mac_str31, but |
| 2795 | 2793 | in leaf keys it's a variable-length string */ |
| 2796 | } | |
| 2794 | } | |
| 2797 | 2795 | |
| 2798 | 2796 | /* |
| 2799 | 2797 | HFS catalog data record for a folder - 70 bytes |
| 2800 | 2798 | */ |
| 2801 | ||
| 2799 | ||
| 2802 | 2800 | { |
| 2803 | 2801 | UINT16BE recordType; /* record type */ |
| 2804 | 2802 | UINT16BE flags; /* folder flags */ |
| r17917 | r17918 | |
| 2810 | 2808 | mac_DInfo userInfo; /* Finder information */ |
| 2811 | 2809 | mac_DXInfo finderInfo; /* additional Finder information */ |
| 2812 | 2810 | UINT32BE reserved[4]; /* reserved - set to zero */ |
| 2813 | } | |
| 2811 | } | |
| 2814 | 2812 | |
| 2815 | 2813 | /* |
| 2816 | 2814 | HFS catalog data record for a file - 102 bytes |
| 2817 | 2815 | */ |
| 2818 | ||
| 2816 | ||
| 2819 | 2817 | { |
| 2820 | 2818 | UINT16BE recordType; /* record type */ |
| 2821 | 2819 | UINT8 flags; /* file flags */ |
| r17917 | r17918 | |
| 2836 | 2834 | hfs_extent_3 dataExtents; /* first data fork extent record */ |
| 2837 | 2835 | hfs_extent_3 rsrcExtents; /* first resource fork extent record */ |
| 2838 | 2836 | UINT32BE reserved; /* reserved - set to zero */ |
| 2839 | } | |
| 2837 | } | |
| 2840 | 2838 | |
| 2841 | 2839 | /* |
| 2842 | 2840 | HFS catalog data record for a thread - 46 bytes |
| r17917 | r17918 | |
| 2844 | 2842 | The key for a thread record features the CNID of the item and an empty |
| 2845 | 2843 | name, instead of the CNID of the parent and the item name. |
| 2846 | 2844 | */ |
| 2847 | ||
| 2845 | ||
| 2848 | 2846 | { |
| 2849 | 2847 | UINT16BE recordType; /* record type */ |
| 2850 | 2848 | UINT32BE reserved[2]; /* reserved - set to zero */ |
| 2851 | 2849 | UINT32BE parID; /* parent ID for this catalog node */ |
| 2852 | 2850 | mac_str31 nodeName; /* name of this catalog node */ |
| 2853 | } | |
| 2851 | } | |
| 2854 | 2852 | |
| 2855 | 2853 | /* |
| 2856 | 2854 | union for all types at once |
| 2857 | 2855 | */ |
| 2858 | ||
| 2856 | ||
| 2859 | 2857 | { |
| 2860 | 2858 | UINT16BE dataType; |
| 2861 | 2859 | hfs_catFolderData folder; |
| 2862 | 2860 | hfs_catFileData file; |
| 2863 | 2861 | hfs_catThreadData thread; |
| 2864 | } | |
| 2862 | } | |
| 2865 | 2863 | |
| 2866 | 2864 | /* |
| 2867 | 2865 | HFS catalog record types |
| r17917 | r17918 | |
| 2890 | 2888 | /* |
| 2891 | 2889 | BT functions used by HFS functions |
| 2892 | 2890 | */ |
| 2893 | ||
| 2891 | ||
| 2894 | 2892 | { |
| 2895 | 2893 | mac_BTref *BTref; |
| 2896 | 2894 | UINT32 cur_node; |
| 2897 | 2895 | int cur_rec; |
| 2898 | } | |
| 2896 | } | |
| 2899 | 2897 | |
| 2900 | 2898 | static imgtoolerr_t BT_open(mac_BTref *BTref, int (*key_compare_func)(const void *key1, const void *key2), int is_extent); |
| 2901 | 2899 | static void BT_close(mac_BTref *BTref); |
| r17917 | r17918 | |
| 2907 | 2905 | static imgtoolerr_t BT_leaf_rec_enumerator_open(mac_BTref *BTref, BT_leaf_rec_enumerator *enumerator); |
| 2908 | 2906 | static imgtoolerr_t BT_leaf_rec_enumerator_read(BT_leaf_rec_enumerator *enumerator, void **record_ptr, int *rec_len); |
| 2909 | 2907 | |
| 2910 | ||
| 2908 | ||
| 2911 | 2909 | { |
| 2912 | 2910 | mac_l2_imgref *l2_img; |
| 2913 | 2911 | BT_leaf_rec_enumerator BT_enumerator; |
| 2914 | 2912 | UINT32 parID; |
| 2915 | } | |
| 2913 | } | |
| 2916 | 2914 | |
| 2917 | 2915 | /* |
| 2918 | 2916 | hfs_open_extents_file |
| r17917 | r17918 | |
| 3640 | 3638 | |
| 3641 | 3639 | Header of a node record |
| 3642 | 3640 | */ |
| 3643 | ||
| 3641 | ||
| 3644 | 3642 | { |
| 3645 | 3643 | UINT32BE fLink; /* (index of) next node at this level */ |
| 3646 | 3644 | UINT32BE bLink; /* (index of) previous node at this level */ |
| r17917 | r17918 | |
| 3650 | 3648 | parent, whatever IM says) */ |
| 3651 | 3649 | UINT16BE numRecords; /* number of records in this node */ |
| 3652 | 3650 | UINT16BE reserved; /* reserved; set to zero */ |
| 3653 | } | |
| 3651 | } | |
| 3654 | 3652 | |
| 3655 | 3653 | /* |
| 3656 | 3654 | Constants for BTNodeHeader kind field |
| r17917 | r17918 | |
| 3672 | 3670 | BTHeaderRecord: first record of a B-tree header node (second record is |
| 3673 | 3671 | unused, and third is node allocation bitmap). |
| 3674 | 3672 | */ |
| 3675 | ||
| 3673 | ||
| 3676 | 3674 | { |
| 3677 | 3675 | UINT16BE treeDepth; /* maximum height (usually leaf nodes) */ |
| 3678 | 3676 | UINT32BE rootNode; /* node number of root node */ |
| r17917 | r17918 | |
| 3693 | 3691 | UINT8 reserved2; /* reserved */ |
| 3694 | 3692 | UINT32BE attributes; /* persistent attributes about the tree */ |
| 3695 | 3693 | UINT32BE reserved3[16]; /* reserved */ |
| 3696 | } | |
| 3694 | } | |
| 3697 | 3695 | |
| 3698 | 3696 | static imgtoolerr_t BT_check(mac_BTref *BTref, int is_extent); |
| 3699 | 3697 | |
| r17917 | r17918 | |
| 3955 | 3953 | |
| 3956 | 3954 | Return imgtool error code |
| 3957 | 3955 | */ |
| 3958 | ||
| 3956 | ||
| 3959 | 3957 | { |
| 3960 | 3958 | void *buf; |
| 3961 | 3959 | UINT32 node_num; |
| 3962 | 3960 | UINT32 cur_rec; |
| 3963 | 3961 | UINT32 num_recs; |
| 3964 | } | |
| 3962 | } | |
| 3965 | 3963 | static imgtoolerr_t BT_check(mac_BTref *BTref, int is_extent) |
| 3966 | 3964 | { |
| 3967 | 3965 | UINT16 node_numRecords; |
| r17917 | r17918 | |
| 4842 | 4840 | /* |
| 4843 | 4841 | Resource header |
| 4844 | 4842 | */ |
| 4845 | ||
| 4843 | ||
| 4846 | 4844 | { |
| 4847 | 4845 | UINT32BE data_offs; /* Offset from beginning of resource fork to resource data */ |
| 4848 | 4846 | UINT32BE map_offs; /* Offset from beginning of resource fork to resource map */ |
| 4849 | 4847 | UINT32BE data_len; /* Length of resource data */ |
| 4850 | 4848 | UINT32BE map_len; /* Length of resource map */ |
| 4851 | } | |
| 4849 | } | |
| 4852 | 4850 | |
| 4853 | 4851 | /* |
| 4854 | 4852 | Resource data: each data entry is preceded by its len (UINT32BE) |
| r17917 | r17918 | |
| 4858 | 4856 | /* |
| 4859 | 4857 | Resource map: |
| 4860 | 4858 | */ |
| 4861 | ||
| 4859 | ||
| 4862 | 4860 | { |
| 4863 | 4861 | rsrc_header reserved0; /* Reserved for copy of resource header */ |
| 4864 | 4862 | UINT32BE reserved1; /* Reserved for handle to next resource map */ |
| r17917 | r17918 | |
| 4869 | 4867 | UINT16BE namelist_offs; /* Offset from beginning of map to resource name list */ |
| 4870 | 4868 | UINT16BE type_count; /* Number of types in the map minus 1 */ |
| 4871 | 4869 | /* This is actually part of the type list, which matters for offsets */ |
| 4872 | } | |
| 4870 | } | |
| 4873 | 4871 | |
| 4874 | 4872 | /* |
| 4875 | 4873 | Resource type list entry |
| 4876 | 4874 | */ |
| 4877 | ||
| 4875 | ||
| 4878 | 4876 | { |
| 4879 | 4877 | UINT32BE type; /* Resource type */ |
| 4880 | 4878 | UINT16BE ref_count; /* Number of resources of this type in map minus 1 */ |
| 4881 | 4879 | UINT16BE ref_offs; /* Offset from beginning of resource type list to reference list for this type */ |
| 4882 | } | |
| 4880 | } | |
| 4883 | 4881 | |
| 4884 | 4882 | /* |
| 4885 | 4883 | Resource reference list entry |
| 4886 | 4884 | */ |
| 4887 | ||
| 4885 | ||
| 4888 | 4886 | { |
| 4889 | 4887 | UINT16BE id; /* Resource ID */ |
| 4890 | 4888 | UINT16BE name_offs; /* Offset from beginning of resource name list to resource name */ |
| r17917 | r17918 | |
| 4892 | 4890 | UINT8 attr; /* Resource attributes */ |
| 4893 | 4891 | UINT24BE data_offs; /* Offset from beginning of resource data to data for this resource */ |
| 4894 | 4892 | UINT32BE reserved; /* Reserved for handle to resource */ |
| 4895 | } | |
| 4893 | } | |
| 4896 | 4894 | |
| 4897 | 4895 | /* |
| 4898 | 4896 | Resource name list entry: this is just a standard macintosh string |
| 4899 | 4897 | */ |
| 4900 | 4898 | |
| 4901 | ||
| 4899 | ||
| 4902 | 4900 | { |
| 4903 | 4901 | mac_fileref fileref; /* open resource fork ref (you may open resources |
| 4904 | 4902 | files in data fork, too, if you ever need to, |
| r17917 | r17918 | |
| 4911 | 4909 | UINT16 namelist_offs; /* Offset from beginning of map to resource name list */ |
| 4912 | 4910 | UINT16 type_count; /* Number of types in the map minus 1 */ |
| 4913 | 4911 | /* This is actually part of the type list, which matters for offsets */ |
| 4914 | } | |
| 4912 | } | |
| 4915 | 4913 | |
| 4916 | 4914 | #ifdef UNUSED_FUNCTION |
| 4917 | 4915 | /* |
| r17917 | r17918 | |
| 5311 | 5309 | /* |
| 5312 | 5310 | MFS/HFS catalog iterator, used when imgtool reads the catalog |
| 5313 | 5311 | */ |
| 5314 | ||
| 5312 | ||
| 5315 | 5313 | { |
| 5316 | 5314 | mac_format format; |
| 5317 | 5315 | mac_l2_imgref *l2_img; |
| r17917 | r17918 | |
| 5326 | 5324 | hfs_cat_enumerator catref; /* catalog file enumerator */ |
| 5327 | 5325 | } hfs; |
| 5328 | 5326 | } u; |
| 5329 | } | |
| 5327 | } | |
| 5330 | 5328 | |
| 5331 | 5329 | /* |
| 5332 | 5330 | Open the disk catalog for enumeration |
| r17917 | r17918 | |
|---|---|---|
| 40 | 40 | #define MAX_DIRENTS (15*8) |
| 41 | 41 | |
| 42 | 42 | /* vzdos directry entry */ |
| 43 | ||
| 43 | ||
| 44 | 44 | { |
| 45 | 45 | char ftype; |
| 46 | 46 | char delimitor; |
| r17917 | r17918 | |
| 49 | 49 | UINT8 start_sector; |
| 50 | 50 | UINT16 start_address; |
| 51 | 51 | UINT16 end_address; |
| 52 | } | |
| 52 | } | |
| 53 | 53 | |
| 54 | ||
| 54 | ||
| 55 | 55 | { |
| 56 | 56 | int index; |
| 57 | 57 | int eof; |
| 58 | } | |
| 58 | } | |
| 59 | 59 | |
| 60 | 60 | static const UINT8 sector_order[] = |
| 61 | 61 | { |
| r17917 | r17918 | |
|---|---|---|
| 35 | 35 | #define MAX_DIR_LEVEL 25 /* We need to put a recursion limit to avoid endless recursion hazard */ |
| 36 | 36 | |
| 37 | 37 | |
| 38 | ||
| 38 | ||
| 39 | 39 | { |
| 40 | 40 | UINT8 bytes[2]; |
| 41 | } | |
| 41 | } | |
| 42 | 42 | |
| 43 | ||
| 43 | ||
| 44 | 44 | { |
| 45 | 45 | UINT8 bytes[4]; |
| 46 | } | |
| 46 | } | |
| 47 | 47 | |
| 48 | 48 | INLINE UINT16 get_UINT16BE(UINT16BE word) |
| 49 | 49 | { |
| r17917 | r17918 | |
| 72 | 72 | /* |
| 73 | 73 | disk image header |
| 74 | 74 | */ |
| 75 | ||
| 75 | ||
| 76 | 76 | { |
| 77 | 77 | UINT32BE cylinders; /* number of cylinders on hard disk (big-endian) */ |
| 78 | 78 | UINT32BE heads; /* number of heads on hard disk (big-endian) */ |
| 79 | 79 | UINT32BE sectors_per_track; /* number of sectors per track on hard disk (big-endian) */ |
| 80 | 80 | UINT32BE bytes_per_sector; /* number of bytes of data per sector on hard disk (big-endian) */ |
| 81 | } | |
| 81 | } | |
| 82 | 82 | |
| 83 | 83 | enum |
| 84 | 84 | { |
| r17917 | r17918 | |
| 101 | 101 | /* |
| 102 | 102 | SC0 record (Disk sector 0) |
| 103 | 103 | */ |
| 104 | ||
| 104 | ||
| 105 | 105 | { |
| 106 | 106 | char vnm[8]; /* volume name */ |
| 107 | 107 | UINT16BE tna; /* total number of ADUs */ |
| r17917 | r17918 | |
| 148 | 148 | UINT16BE dct; /* disk creation time */ |
| 149 | 149 | UINT16BE fsf; /* * * RESERVED * * */ |
| 150 | 150 | /* SCOSIZ = >AA */ |
| 151 | } | |
| 151 | } | |
| 152 | 152 | |
| 153 | 153 | /* |
| 154 | 154 | DOR (Directory Overhead Record) |
| 155 | 155 | */ |
| 156 | ||
| 156 | ||
| 157 | 157 | { |
| 158 | 158 | UINT16BE nrc; /* # records in directory (minus DOR) nrc = nfl + nar (+ tfc???) */ |
| 159 | 159 | UINT16BE nfl; /* # files currently in directory */ |
| r17917 | r17918 | |
| 164 | 164 | char pnm[8]; /* name of parent directory (VCATALOG for root, even though it makes little sense) */ |
| 165 | 165 | UINT16BE prs; /* "default physical record length (used for file creation)" */ |
| 166 | 166 | /* DORSIZ = >1C */ |
| 167 | } | |
| 167 | } | |
| 168 | 168 | |
| 169 | 169 | /* |
| 170 | 170 | file flags found in fdr |
| r17917 | r17918 | |
| 198 | 198 | /* |
| 199 | 199 | ACE subrecord found in FDR |
| 200 | 200 | */ |
| 201 | ||
| 201 | ||
| 202 | 202 | { |
| 203 | 203 | char agn[8]; /* access group name */ |
| 204 | 204 | UINT16BE flg; /* flags */ |
| 205 | } | |
| 205 | } | |
| 206 | 206 | |
| 207 | 207 | /* |
| 208 | 208 | FDR record |
| 209 | 209 | */ |
| 210 | ||
| 210 | ||
| 211 | 211 | { |
| 212 | 212 | UINT16BE hkc; /* hask key count: the number of file descriptor records that are present in the directory that hashed to this record number */ |
| 213 | 213 | UINT16BE hkv; /* hask key value: the result of the hash algorithm for the file name actually covered in this record */ |
| r17917 | r17918 | |
| 243 | 243 | UINT16BE psa; /* public security attribute */ |
| 244 | 244 | ti990_ace ace[9]; /* 9 access control entries */ |
| 245 | 245 | UINT8 fil[2]; /* not used */ |
| 246 | } | |
| 246 | } | |
| 247 | 247 | |
| 248 | 248 | /* |
| 249 | 249 | ADR record: variant of FDR for Aliases |
| r17917 | r17918 | |
| 251 | 251 | The fields marked here with *** are in the ADR template to maintain |
| 252 | 252 | compatability with the FDR template. |
| 253 | 253 | */ |
| 254 | ||
| 254 | ||
| 255 | 255 | { |
| 256 | 256 | UINT16BE hkc; /* hask key count */ |
| 257 | 257 | UINT16BE hkv; /* hask key value */ |
| r17917 | r17918 | |
| 266 | 266 | UINT16BE fill05; /* *** secondary allocation address */ |
| 267 | 267 | UINT16BE rna; /* record number of next ADR */ |
| 268 | 268 | UINT16BE raf; /* record # of actual FDR (from 1 through dor.nrc) */ |
| 269 | } | |
| 269 | } | |
| 270 | 270 | |
| 271 | 271 | /* |
| 272 | 272 | CDR record: variant of FDR for Channel |
| r17917 | r17918 | |
| 274 | 274 | The CDR is the permanent record of a channel. It is carried as an alias |
| 275 | 275 | of the program file in which the channel owner task resides. |
| 276 | 276 | */ |
| 277 | ||
| 277 | ||
| 278 | 278 | { |
| 279 | 279 | UINT16BE hkc; /* hask key count */ |
| 280 | 280 | UINT16BE hkv; /* hask key value */ |
| r17917 | r17918 | |
| 295 | 295 | UINT16BE psa; /* public security attribute */ |
| 296 | 296 | UINT8 scg[94]; /* "SDT with 9 control groups" (whatever it means - and, no, 94 is not dividable by 9) */ |
| 297 | 297 | UINT8 fill06[8]; /* reserved */ |
| 298 | } | |
| 298 | } | |
| 299 | 299 | |
| 300 | 300 | /* |
| 301 | 301 | Based on contents of the flags field, catalog entries may be either an FDR, |
| r17917 | r17918 | |
| 305 | 305 | field starts at offset 4, and therefore if we try to interpret a KDR as an |
| 306 | 306 | FDR (or ADR, CDR), we will find fnm[0] and assume the FDR is empty. |
| 307 | 307 | */ |
| 308 | ||
| 308 | ||
| 309 | 309 | { |
| 310 | 310 | ti990_fdr fdr; |
| 311 | 311 | ti990_adr adr; |
| 312 | 312 | ti990_cdr cdr; |
| 313 | } | |
| 313 | } | |
| 314 | 314 | |
| 315 | 315 | #if 0 |
| 316 | 316 | |
| 317 | 317 | /* |
| 318 | 318 | tifile header: stand-alone file |
| 319 | 319 | */ |
| 320 | ||
| 320 | ||
| 321 | 321 | { |
| 322 | 322 | char tifiles[8]; /* always '\7TIFILES' */ |
| 323 | 323 | UINT8 secsused_MSB; /* file length in sectors (big-endian) */ |
| r17917 | r17918 | |
| 329 | 329 | UINT8 fixrecs_MSB; /* file length in records (big-endian) */ |
| 330 | 330 | UINT8 fixrecs_LSB; |
| 331 | 331 | UINT8 res[128-16]; /* reserved */ |
| 332 | } | |
| 332 | } | |
| 333 | 333 | |
| 334 | 334 | |
| 335 | 335 | /* |
| 336 | 336 | catalog entry (used for in-memory catalog) |
| 337 | 337 | */ |
| 338 | ||
| 338 | ||
| 339 | 339 | { |
| 340 | 340 | UINT16 fdr_secnum; |
| 341 | 341 | char filename[10]; |
| 342 | } | |
| 342 | } | |
| 343 | 343 | |
| 344 | 344 | #endif |
| 345 | 345 | |
| 346 | 346 | /* |
| 347 | 347 | Disk geometry |
| 348 | 348 | */ |
| 349 | ||
| 349 | ||
| 350 | 350 | { |
| 351 | 351 | unsigned int cylinders, heads, sectors_per_track, bytes_per_sector; |
| 352 | } | |
| 352 | } | |
| 353 | 353 | |
| 354 | 354 | /* |
| 355 | 355 | Physical sector address |
| 356 | 356 | */ |
| 357 | ||
| 357 | ||
| 358 | 358 | { |
| 359 | 359 | int cylinder; |
| 360 | 360 | int head; |
| 361 | 361 | int sector; |
| 362 | } | |
| 362 | } | |
| 363 | 363 | |
| 364 | 364 | /* |
| 365 | 365 | ti99 disk image descriptor |
| 366 | 366 | */ |
| 367 | ||
| 367 | ||
| 368 | 368 | { |
| 369 | 369 | imgtool_stream *file_handle; /* imgtool file handle */ |
| 370 | 370 | ti990_geometry geometry; /* geometry */ |
| 371 | 371 | ti990_sc0 sec0; /* cached copy of sector 0 */ |
| 372 | } | |
| 372 | } | |
| 373 | 373 | |
| 374 | 374 | /* |
| 375 | 375 | ti990 catalog iterator, used when imgtool reads the catalog |
| 376 | 376 | */ |
| 377 | ||
| 377 | ||
| 378 | 378 | { |
| 379 | 379 | ti990_image *image; |
| 380 | 380 | int level; /* current recursion level */ |
| 381 | 381 | int nrc[MAX_DIR_LEVEL]; /* length of disk catalogs in records */ |
| 382 | 382 | int index[MAX_DIR_LEVEL]; /* current index in the disk catalog */ |
| 383 | 383 | directory_entry xdr[MAX_DIR_LEVEL]; /* fdr records */ |
| 384 | } | |
| 384 | } | |
| 385 | 385 | |
| 386 | 386 | |
| 387 | 387 | static imgtoolerr_t ti990_image_init(imgtool_image *img, imgtool_stream *f); |
| r17917 | r17918 | |
|---|---|---|
| 12 | 12 | #include <limits.h> |
| 13 | 13 | #include "imgtool.h" |
| 14 | 14 | |
| 15 | ||
| 15 | ||
| 16 | 16 | { |
| 17 | 17 | UINT8 bytes[2]; |
| 18 | } | |
| 18 | } | |
| 19 | 19 | |
| 20 | 20 | /* |
| 21 | 21 | get_UINT16xE |
| r17917 | r17918 | |
| 69 | 69 | device directory record (Disk sector 2-5) |
| 70 | 70 | */ |
| 71 | 71 | |
| 72 | ||
| 72 | ||
| 73 | 73 | { |
| 74 | 74 | UINT16xE first_block; |
| 75 | 75 | UINT16xE next_block; |
| r17917 | r17918 | |
| 83 | 83 | char mem_flipped; |
| 84 | 84 | char disk_flipped; |
| 85 | 85 | UINT16xE unused; |
| 86 | } | |
| 86 | } | |
| 87 | 87 | |
| 88 | ||
| 88 | ||
| 89 | 89 | { |
| 90 | 90 | UINT16xE first_block; |
| 91 | 91 | UINT16xE next_block; |
| r17917 | r17918 | |
| 94 | 94 | unsigned char filename[16]; |
| 95 | 95 | UINT16xE last_byte; |
| 96 | 96 | UINT16xE last_access; |
| 97 | } | |
| 97 | } | |
| 98 | 98 | |
| 99 | ||
| 99 | ||
| 100 | 100 | { |
| 101 | 101 | concept_vol_hdr_entry vol_hdr; |
| 102 | 102 | concept_file_dir_entry file_dir[77]; |
| 103 | 103 | char unused[20]; |
| 104 | } | |
| 104 | } | |
| 105 | 105 | |
| 106 | 106 | /* |
| 107 | 107 | concept disk image descriptor |
| 108 | 108 | */ |
| 109 | ||
| 109 | ||
| 110 | 110 | { |
| 111 | 111 | imgtool_stream *file_handle; /* imgtool file handle */ |
| 112 | 112 | concept_dev_dir dev_dir; /* cached copy of device directory */ |
| 113 | } | |
| 113 | } | |
| 114 | 114 | |
| 115 | 115 | /* |
| 116 | 116 | concept catalog iterator, used when imgtool reads the catalog |
| 117 | 117 | */ |
| 118 | ||
| 118 | ||
| 119 | 119 | { |
| 120 | 120 | concept_image *image; |
| 121 | 121 | int index; /* current index */ |
| 122 | } | |
| 122 | } | |
| 123 | 123 | |
| 124 | 124 | |
| 125 | 125 | static imgtoolerr_t concept_image_init(imgtool_image *img, imgtool_stream *f); |
| r17917 | r17918 | |
|---|---|---|
| 14 | 14 | |
| 15 | 15 | #include "library.h" |
| 16 | 16 | |
| 17 | ||
| 17 | ||
| 18 | 18 | |
| 19 | 19 | enum |
| 20 | 20 | { |
| r17917 | r17918 | |
|---|---|---|
| 20 | 20 | IMG_MEM |
| 21 | 21 | }; |
| 22 | 22 | |
| 23 | struct | |
| 23 | struct | |
| 24 | 24 | { |
| 25 | 25 | imgtype_t imgtype; |
| 26 | 26 | int write_protect; |
| r17917 | r17918 | |
| 54 | 54 | goto error; |
| 55 | 55 | fclose(f); |
| 56 | 56 | |
| 57 | imgfile = (imgtool_stream *)malloc(sizeof( | |
| 57 | imgfile = (imgtool_stream *)malloc(sizeof( | |
| 58 | 58 | if (!imgfile) |
| 59 | 59 | goto error; |
| 60 | 60 | |
| r17917 | r17918 | |
| 156 | 156 | goto error; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | imgfile = (imgtool_stream *)malloc(sizeof( | |
| 159 | imgfile = (imgtool_stream *)malloc(sizeof( | |
| 160 | 160 | if (!imgfile) |
| 161 | 161 | goto error; |
| 162 | 162 | |
| r17917 | r17918 | |
| 186 | 186 | { |
| 187 | 187 | imgtool_stream *imgfile; |
| 188 | 188 | |
| 189 | imgfile = (imgtool_stream *)malloc(sizeof( | |
| 189 | imgfile = (imgtool_stream *)malloc(sizeof( | |
| 190 | 190 | if (!imgfile) |
| 191 | 191 | return NULL; |
| 192 | 192 | |
| r17917 | r17918 | |
| 211 | 211 | { |
| 212 | 212 | imgtool_stream *imgfile; |
| 213 | 213 | |
| 214 | imgfile = (imgtool_stream *)malloc(sizeof( | |
| 214 | imgfile = (imgtool_stream *)malloc(sizeof( | |
| 215 | 215 | if (!imgfile) |
| 216 | 216 | return NULL; |
| 217 | 217 |
| r17917 | r17918 | |
|---|---|---|
| 21 | 21 | INT8 signal; /* signal */ |
| 22 | 22 | }; |
| 23 | 23 | |
| 24 | typedef struct SND wswan_sound_state; | |
| 25 | struct SND { | |
| 24 | struct wswan_sound_state { | |
| 26 | 25 | sound_stream *channel; |
| 27 | 26 | struct CHAN audio1; /* Audio channel 1 */ |
| 28 | 27 | struct CHAN audio2; /* Audio channel 2 */ |
| r17917 | r17918 | |
|---|---|---|
| 1 | 1 | #ifndef __SPCHROMS_H |
| 2 | 2 | #define __SPCHROMS_H |
| 3 | 3 | |
| 4 | ||
| 4 | ||
| 5 | 5 | { |
| 6 | 6 | const char *memory_region; /* memory region where the speech ROM is. NULL means no speech ROM */ |
| 7 | } | |
| 7 | } | |
| 8 | 8 | |
| 9 | 9 | void spchroms_config(running_machine &machine, const spchroms_interface *intf); |
| 10 | 10 |
| r17917 | r17918 | |
|---|---|---|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | /* bus width for 8/16-bit handlers */ |
| 232 | ||
| 232 | ||
| 233 | 233 | { |
| 234 | 234 | bw_8, |
| 235 | 235 | bw_16 |
| 236 | } | |
| 236 | } | |
| 237 | 237 | |
| 238 | 238 | /* |
| 239 | 239 | read a 8/16-bit word from FEEPROM |
| r17917 | r17918 | |
|---|---|---|
| 23 | 23 | ***************************************************************************/ |
| 24 | 24 | |
| 25 | 25 | /* output lines on the CoCo cartridge slot */ |
| 26 | enum | |
| 26 | enum | |
| 27 | 27 | { |
| 28 | 28 | COCOCART_LINE_CART, /* connects to PIA1 CB1 */ |
| 29 | 29 | COCOCART_LINE_NMI, /* connects to NMI line on CPU */ |
| 30 | 30 | COCOCART_LINE_HALT, /* connects to HALT line on CPU */ |
| 31 | 31 | COCOCART_LINE_SOUND_ENABLE /* sound enable */ |
| 32 | 32 | }; |
| 33 | typedef enum _cococart_line cococart_line; | |
| 34 | 33 | |
| 35 | 34 | /* since we have a special value "Q" - we have to use a special enum here */ |
| 36 | enum | |
| 35 | enum | |
| 37 | 36 | { |
| 38 | 37 | COCOCART_LINE_VALUE_CLEAR, |
| 39 | 38 | COCOCART_LINE_VALUE_ASSERT, |
| 40 | 39 | COCOCART_LINE_VALUE_Q |
| 41 | 40 | }; |
| 42 | typedef enum _cococart_line_value cococart_line_value; | |
| 43 | 41 | |
| 44 | 42 | struct coco_cartridge_line |
| 45 | 43 | { |
| r17917 | r17918 | |
|---|---|---|
| 27 | 27 | #define MAX_SMARTMEDIA 1 |
| 28 | 28 | |
| 29 | 29 | /* machine-independent big-endian 32-bit integer */ |
| 30 | ||
| 30 | ||
| 31 | 31 | { |
| 32 | 32 | UINT8 bytes[4]; |
| 33 | } | |
| 33 | } | |
| 34 | 34 | |
| 35 | 35 | INLINE UINT32 get_UINT32BE(UINT32BE word) |
| 36 | 36 | { |
| r17917 | r17918 | |
| 48 | 48 | #endif |
| 49 | 49 | |
| 50 | 50 | /* SmartMedia image header */ |
| 51 | ||
| 51 | ||
| 52 | 52 | { |
| 53 | 53 | UINT8 version; |
| 54 | 54 | UINT32BE page_data_size; |
| 55 | 55 | UINT32BE page_total_size; |
| 56 | 56 | UINT32BE num_pages; |
| 57 | 57 | UINT32BE log2_pages_per_block; |
| 58 | } | |
| 58 | } | |
| 59 | 59 | |
| 60 | ||
| 60 | ||
| 61 | 61 | { |
| 62 | 62 | UINT8 data1[3]; |
| 63 | 63 | UINT8 padding1[256-3]; |
| 64 | 64 | UINT8 data2[16]; |
| 65 | 65 | UINT8 data3[16]; |
| 66 | 66 | UINT8 padding2[768-32]; |
| 67 | } | |
| 67 | } | |
| 68 | 68 | |
| 69 | 69 | enum |
| 70 | 70 | { |
| r17917 | r17918 | |
|---|---|---|
| 36 | 36 | |
| 37 | 37 | #define MAX_TAPE_UNIT 4 |
| 38 | 38 | |
| 39 | ||
| 39 | ||
| 40 | 40 | { |
| 41 | 41 | device_image_interface *img; /* image descriptor */ |
| 42 | 42 | unsigned int bot : 1; /* TRUE if we are at the beginning of tape */ |
| 43 | 43 | unsigned int eot : 1; /* TRUE if we are at the end of tape */ |
| 44 | 44 | unsigned int wp : 1; /* TRUE if tape is write-protected */ |
| 45 | } | |
| 45 | } | |
| 46 | 46 | |
| 47 | 47 | struct tap_990_t |
| 48 | 48 | { |
| r17917 | r17918 | |
|---|---|---|
| 91 | 91 | #define UPD765_GET_IMAGE(name) device_t *name(device_t *device, int floppy_index ) |
| 92 | 92 | |
| 93 | 93 | |
| 94 | ||
| 94 | ||
| 95 | 95 | { |
| 96 | 96 | /* interrupt issued */ |
| 97 | 97 | devcb_write_line out_int_func; |
| r17917 | r17918 | |
| 105 | 105 | UPD765_RDY_PIN rdy_pin; |
| 106 | 106 | |
| 107 | 107 | const char *floppy_drive_tags[4]; |
| 108 | } | |
| 108 | } | |
| 109 | 109 | |
| 110 | 110 | |
| 111 | 111 | /*************************************************************************** |
| r17917 | r17918 | |
|---|---|---|
| 13 | 13 | |
| 14 | 14 | #include "ti99defs.h" |
| 15 | 15 | |
| 16 | ||
| 16 | ||
| 17 | 17 | { |
| 18 | 18 | bool writable; |
| 19 | 19 | int ident; |
| r17917 | r17918 | |
| 22 | 22 | int size; |
| 23 | 23 | devcb_write_line ready; |
| 24 | 24 | int clockrate; |
| 25 | } | |
| 25 | } | |
| 26 | 26 | |
| 27 | 27 | #define GROM_CONFIG(name) \ |
| 28 | 28 | const ti99grom_config(name) = |
| r17917 | r17918 | |
|---|---|---|
| 22 | 22 | |
| 23 | 23 | extern const device_type JOYPORT; |
| 24 | 24 | |
| 25 | ||
| 25 | ||
| 26 | 26 | { |
| 27 | 27 | devcb_write_line interrupt; |
| 28 | 28 | int vdp_clock; |
| 29 | } | |
| 29 | } | |
| 30 | 30 | |
| 31 | 31 | #define JOYPORT_CONFIG(name) \ |
| 32 | 32 | const joyport_config(name) = |
| r17917 | r17918 | |
|---|---|---|
| 18 | 18 | #define GROMPORT_CONFIG(name) \ |
| 19 | 19 | const gromport_config(name) = |
| 20 | 20 | |
| 21 | ||
| 21 | ||
| 22 | 22 | { |
| 23 | 23 | devcb_write_line ready; |
| 24 | 24 | devcb_write_line reset; |
| 25 | } | |
| 25 | } | |
| 26 | 26 | |
| 27 | 27 | class ti99_cartridge_connector_device; |
| 28 | 28 | |
| r17917 | r17918 | |
| 366 | 366 | }; |
| 367 | 367 | |
| 368 | 368 | |
| 369 | ||
| 369 | ||
| 370 | 370 | { |
| 371 | 371 | int id; |
| 372 | 372 | const char* name; |
| 373 | } | |
| 373 | } | |
| 374 | 374 | |
| 375 | 375 | /************************************************************************* |
| 376 | 376 | RPK support |
| r17917 | r17918 | |
| 437 | 437 | void add_socket(const char* id, rpk_socket *newsock); |
| 438 | 438 | }; |
| 439 | 439 | |
| 440 | enum | |
| 440 | enum | |
| 441 | 441 | { |
| 442 | 442 | RPK_OK, |
| 443 | 443 | RPK_NOT_ZIP_FORMAT, |
| r17917 | r17918 | |
| 455 | 455 | RPK_NO_PCB_OR_RESOURCES, |
| 456 | 456 | RPK_UNKNOWN_PCB_TYPE |
| 457 | 457 | }; |
| 458 | typedef enum _rpk_open_error rpk_open_error; | |
| 459 | 458 | |
| 460 | 459 | static const char error_text[15][30] = |
| 461 | 460 | { |
| r17917 | r17918 | |
|---|---|---|
| 25 | 25 | Needed to adapt to higher cylinder numbers. Floppies do not have such |
| 26 | 26 | high numbers. |
| 27 | 27 | */ |
| 28 | ||
| 28 | ||
| 29 | 29 | { |
| 30 | 30 | UINT16 C; |
| 31 | 31 | UINT8 H; |
| r17917 | r17918 | |
| 33 | 33 | UINT8 N; |
| 34 | 34 | int data_id; // id for read/write data command |
| 35 | 35 | unsigned long flags; |
| 36 | } | |
| 36 | } | |
| 37 | 37 | |
| 38 | 38 | class mfm_harddisk_device : public device_t |
| 39 | 39 | { |
| r17917 | r17918 | |
|---|---|---|
| 44 | 44 | |
| 45 | 45 | /*****************************************************************************/ |
| 46 | 46 | |
| 47 | ||
| 47 | ||
| 48 | 48 | { |
| 49 | 49 | devcb_write_line interrupt; |
| 50 | } | |
| 50 | } | |
| 51 | 51 | |
| 52 | 52 | #define GENEVE_KEYBOARD_CONFIG(name) \ |
| 53 | 53 | const geneve_keyboard_config(name) = |
| r17917 | r17918 | |
| 110 | 110 | |
| 111 | 111 | /*****************************************************************************/ |
| 112 | 112 | |
| 113 | ||
| 113 | ||
| 114 | 114 | { |
| 115 | 115 | devcb_write_line ready; |
| 116 | } | |
| 116 | } | |
| 117 | 117 | |
| 118 | 118 | class geneve_mapper_device : public device_t |
| 119 | 119 | { |
| r17917 | r17918 | |
|---|---|---|
| 20 | 20 | |
| 21 | 21 | extern const device_type TI99_EVPC; |
| 22 | 22 | |
| 23 | ||
| 23 | ||
| 24 | 24 | { |
| 25 | 25 | UINT8 read_index, write_index, mask; |
| 26 | 26 | int read; |
| 27 | 27 | int state; |
| 28 | 28 | struct { UINT8 red, green, blue; } color[0x100]; |
| 29 | 29 | //int dirty; |
| 30 | } | |
| 30 | } | |
| 31 | 31 | |
| 32 | 32 | class snug_enhanced_video_device : public ti_expansion_card_device, public device_nvram_interface |
| 33 | 33 | { |
| r17917 | r17918 | |
|---|---|---|
| 77 | 77 | extern const device_type TISOUND_94624; |
| 78 | 78 | extern const device_type TISOUND_76496; |
| 79 | 79 | |
| 80 | ||
| 80 | ||
| 81 | 81 | { |
| 82 | 82 | devcb_write_line ready; |
| 83 | } | |
| 83 | } | |
| 84 | 84 | |
| 85 | 85 | #define TI_SOUND_CONFIG(name) \ |
| 86 | 86 | const ti_sound_config(name) = |
| r17917 | r17918 | |
|---|---|---|
| 21 | 21 | #define SPEECH8_CONFIG(name) \ |
| 22 | 22 | const speech8_config(name) = |
| 23 | 23 | |
| 24 | ||
| 24 | ||
| 25 | 25 | { |
| 26 | 26 | devcb_write_line ready; |
| 27 | } | |
| 27 | } | |
| 28 | 28 | |
| 29 | 29 | |
| 30 | 30 | class ti998_spsyn_device : public bus8z_device |
| r17917 | r17918 | |
|---|---|---|
| 23 | 23 | if the HGSPL expansion card is used, the GROMs in the console must be |
| 24 | 24 | removed. |
| 25 | 25 | */ |
| 26 | ||
| 26 | ||
| 27 | 27 | { |
| 28 | 28 | const char *name; // Name of the device (used for looking up the device) |
| 29 | 29 | UINT16 select; // State of the address line bits when addressing this device |
| r17917 | r17918 | |
| 32 | 32 | const char *setting; // configuration switch that may have an effect for the presence of this device |
| 33 | 33 | UINT8 set; // bits that must be set for this switch so that this device is present |
| 34 | 34 | UINT8 unset; // bits that must be reset for this switch so that this device is present |
| 35 | } | |
| 35 | } | |
| 36 | 36 | |
| 37 | 37 | #define DMUX_CONFIG(name) \ |
| 38 | 38 | const datamux_config(name) = |
| 39 | 39 | |
| 40 | ||
| 40 | ||
| 41 | 41 | { |
| 42 | 42 | devcb_write_line ready; |
| 43 | 43 | const dmux_device_list_entry *devlist; |
| 44 | } | |
| 44 | } | |
| 45 | 45 | |
| 46 | 46 | /* |
| 47 | 47 | Device list of this datamux. |
| r17917 | r17918 | |
|---|---|---|
| 23 | 23 | |
| 24 | 24 | #define DSRROM "dsrrom" |
| 25 | 25 | |
| 26 | ||
| 26 | ||
| 27 | 27 | { |
| 28 | 28 | devcb_write_line inta; |
| 29 | 29 | devcb_write_line intb; |
| 30 | 30 | devcb_write_line ready; |
| 31 | 31 | int prefix; |
| 32 | } | |
| 32 | } | |
| 33 | 33 | |
| 34 | 34 | #define PERIBOX_CONFIG(name) \ |
| 35 | 35 | const peribox_config(name) = |
| r17917 | r17918 | |
|---|---|---|
| 36 | 36 | #define SRAM_SIZE 2048 |
| 37 | 37 | #define DRAM_SIZE 65536 |
| 38 | 38 | |
| 39 | ||
| 39 | ||
| 40 | 40 | { |
| 41 | 41 | const char* name; // Name of the device (used for looking up the device) |
| 42 | 42 | int mode; // Mode of the system which applies to this entry |
| r17917 | r17918 | |
| 44 | 44 | UINT32 select_pattern; // State of the address line bits when addressing this device |
| 45 | 45 | UINT32 address_mask; // Bits of the address bus used to address this device |
| 46 | 46 | UINT32 write_select; // Additional bits set when doing write accesses to this device |
| 47 | } | |
| 47 | } | |
| 48 | 48 | |
| 49 | 49 | #define MAPPER8_CONFIG(name) \ |
| 50 | 50 | const mapper8_config(name) = |
| 51 | 51 | |
| 52 | ||
| 52 | ||
| 53 | 53 | { |
| 54 | 54 | devcb_write_line ready; |
| 55 | 55 | const mapper8_list_entry *devlist; |
| 56 | } | |
| 56 | } | |
| 57 | 57 | |
| 58 | 58 | /* |
| 59 | 59 | Device list of the mapper. |
| r17917 | r17918 | |
|---|---|---|
| 40 | 40 | /* We can use MAME's harddisk.c image format instead. */ |
| 41 | 41 | |
| 42 | 42 | /* machine-independent big-endian 32-bit integer */ |
| 43 | ||
| 43 | ||
| 44 | 44 | { |
| 45 | 45 | UINT8 bytes[4]; |
| 46 | } | |
| 46 | } | |
| 47 | 47 | |
| 48 | 48 | INLINE UINT32 get_UINT32BE(UINT32BE word) |
| 49 | 49 | { |
| r17917 | r17918 | |
| 61 | 61 | #endif |
| 62 | 62 | |
| 63 | 63 | /* disk image header */ |
| 64 | ||
| 64 | ||
| 65 | 65 | { |
| 66 | 66 | UINT32BE cylinders; /* number of cylinders on hard disk (big-endian) */ |
| 67 | 67 | UINT32BE heads; /* number of heads on hard disk (big-endian) */ |
| 68 | 68 | UINT32BE sectors_per_track; /* number of sectors per track on hard disk (big-endian) */ |
| 69 | 69 | UINT32BE bytes_per_sector; /* number of bytes of data per sector on hard disk (big-endian) */ |
| 70 | } | |
| 70 | } | |
| 71 | 71 | |
| 72 | 72 | enum |
| 73 | 73 | { |
| r17917 | r17918 | |
| 81 | 81 | }; |
| 82 | 82 | |
| 83 | 83 | /* disk drive unit descriptor */ |
| 84 | ||
| 84 | ||
| 85 | 85 | { |
| 86 | 86 | device_image_interface *img; /* image descriptor */ |
| 87 | 87 | format_t format; |
| r17917 | r17918 | |
| 91 | 91 | |
| 92 | 92 | /* disk geometry */ |
| 93 | 93 | unsigned int cylinders, heads, sectors_per_track, bytes_per_sector; |
| 94 | } | |
| 94 | } | |
| 95 | 95 | |
| 96 | 96 | /* disk controller */ |
| 97 | ||
| 97 | ||
| 98 | 98 | { |
| 99 | 99 | UINT16 w[8]; |
| 100 | 100 | |
| 101 | 101 | void (*interrupt_callback)(running_machine &machine, int state); |
| 102 | 102 | |
| 103 | 103 | hd_unit_t d[MAX_DISK_UNIT]; |
| 104 | } | |
| 104 | } | |
| 105 | 105 | |
| 106 | 106 | /* masks for individual bits controller registers */ |
| 107 | 107 | enum |
| r17917 | r17918 | |
|---|---|---|
| 64 | 64 | * - "Keypad ," is not mapped |
| 65 | 65 | */ |
| 66 | 66 | |
| 67 | ||
| 67 | ||
| 68 | 68 | { |
| 69 | 69 | device_t *beeper; |
| 70 | 70 | UINT8 buff[16]; |
| r17917 | r17918 | |
| 78 | 78 | int key; |
| 79 | 79 | int repeat; |
| 80 | 80 | int repeater; |
| 81 | } | |
| 81 | } | |
| 82 | 82 | |
| 83 | 83 | INPUT_PORTS_START( kay_kbd ) |
| 84 | 84 | PORT_START("ROW0") |
| r17917 | r17918 | |
|---|---|---|
| 495 | 495 | #define QDD_MAXBUF ( THOM_QDD_SIZE_ID + THOM_QDD_SIZE_DATA ) * 512 |
| 496 | 496 | |
| 497 | 497 | |
| 498 | st | |
| 498 | st | |
| 499 | 499 | { |
| 500 | 500 | /* MC6852 registers */ |
| 501 | 501 | UINT8 status; |
| r17917 | r17918 | |
| 514 | 514 | UINT8 data_crc; /* checksum when writing */ |
| 515 | 515 | UINT8 index_pulse; /* one pulse per track */ |
| 516 | 516 | |
| 517 | } | |
| 517 | } | |
| 518 | 518 | |
| 519 | static to7qdd_t * to7qdd; | |
| 519 | 520 | |
| 520 | 521 | |
| 522 | ||
| 521 | 523 | static void to7_qdd_index_pulse_cb ( device_t *controller,device_t *image, int state ) |
| 522 | 524 | { |
| 523 | 525 | to7qdd->index_pulse = state; |
| r17917 | r17918 | |
| 860 | 862 | { |
| 861 | 863 | LOG(( "to7_qdd_init: CQ 90-028 controller\n" )); |
| 862 | 864 | |
| 863 | to7qdd = auto_alloc(machine, | |
| 865 | to7qdd = auto_alloc(machine, | |
| 864 | 866 | |
| 865 | 867 | state_save_register_global( machine, to7qdd->status ); |
| 866 | 868 | state_save_register_global( machine, to7qdd->ctrl1 ); |
| r17917 | r17918 | |
| 904 | 906 | #define THOM_MAXBUF ( THOM_QDD_SIZE_ID + THOM_QDD_SIZE_DATA ) * 512 |
| 905 | 907 | |
| 906 | 908 | |
| 907 | st | |
| 909 | st | |
| 908 | 910 | { |
| 909 | 911 | |
| 910 | 912 | UINT8 op; |
| r17917 | r17918 | |
| 928 | 930 | |
| 929 | 931 | UINT8 stat0; /* status register */ |
| 930 | 932 | |
| 931 | } | |
| 933 | } | |
| 932 | 934 | |
| 935 | static thmfc1_t * thmfc1; | |
| 933 | 936 | |
| 937 | ||
| 934 | 938 | static emu_timer* thmfc_floppy_cmd; |
| 935 | 939 | |
| 936 | 940 | |
| r17917 | r17918 | |
| 1560 | 1564 | { |
| 1561 | 1565 | LOG(( "thmfc_floppy_init: THMFC1 controller\n" )); |
| 1562 | 1566 | |
| 1563 | thmfc1 = auto_alloc(machine, | |
| 1567 | thmfc1 = auto_alloc(machine, | |
| 1564 | 1568 | |
| 1565 | 1569 | thmfc_floppy_cmd = machine.scheduler().timer_alloc(FUNC(thmfc_floppy_cmd_complete_cb)); |
| 1566 | 1570 |
| r17917 | r17918 | |
|---|---|---|
| 320 | 320 | }; |
| 321 | 321 | |
| 322 | 322 | // Structure of Block #1, the Disk Parameter Block |
| 323 | t | |
| 323 | struct | |
| 324 | 324 | struct { |
| 325 | 325 | UINT8 lsb; |
| 326 | 326 | UINT8 msb; |
| r17917 | r17918 | |
| 337 | 337 | UINT8 lsb; |
| 338 | 338 | UINT8 msb; |
| 339 | 339 | } revh_spare_table[16]; |
| 340 | } | |
| 340 | } | |
| 341 | 341 | |
| 342 | 342 | // Structure of Block #3, the Constellation Parameter Block |
| 343 | 343 | struct constellation_parameter_block_t { |
| r17917 | r17918 | |
| 351 | 351 | }; |
| 352 | 352 | |
| 353 | 353 | // Structure of Block #7, the Semaphore Table Block |
| 354 | ||
| 354 | ||
| 355 | 355 | union { |
| 356 | 356 | UINT8 semaphore_table[256]; // Table consists of 256 bytes |
| 357 | 357 | struct { |
| r17917 | r17918 | |
| 359 | 359 | } semaphore_entry[32]; // 32 Entries |
| 360 | 360 | } semaphore_block; |
| 361 | 361 | UINT8 unused[256]; // Remaining half of block is unused |
| 362 | } | |
| 362 | } | |
| 363 | 363 | |
| 364 | 364 | // Command size structure (number of bytes to xmit and recv for each command) |
| 365 | 365 | struct corvus_cmd_t { |
| r17917 | r17918 | |
|---|---|---|
| 3166 | 3166 | #ifdef MAC_TRACETRAP |
| 3167 | 3167 | static void mac_tracetrap(const char *cpu_name_local, int addr, int trap) |
| 3168 | 3168 | { |
| 3169 | | |
| 3169 | | |
| 3170 | 3170 | { |
| 3171 | 3171 | int csCode; |
| 3172 | 3172 | const char *name; |
| 3173 | } | |
| 3173 | } | |
| 3174 | 3174 | |
| 3175 | 3175 | static const sonycscodeentry cscodes[] = |
| 3176 | 3176 | { |
| r17917 | r17918 | |
|---|---|---|
| 36 | 36 | TYPE DEFINITIONS |
| 37 | 37 | ***************************************************************************/ |
| 38 | 38 | |
| 39 | ||
| 39 | ||
| 40 | 40 | { |
| 41 | 41 | void (*interrupt)(device_t *device, int state); |
| 42 | 42 | void (*dma_request)(device_t *device, int state, int read_); |
| 43 | 43 | const char *floppy_drive_tags[2]; |
| 44 | } | |
| 44 | } | |
| 45 | 45 | |
| 46 | 46 | /*************************************************************************** |
| 47 | 47 | FUNCTION PROTOTYPES |
| r17917 | r17918 | |
|---|---|---|
| 59 | 59 | #define ISTR_FF_FLG (1<<1) /* FIFO-Full Flag */ |
| 60 | 60 | #define ISTR_FE_FLG (1<<0) /* FIFO-Empty Flag */ |
| 61 | 61 | |
| 62 | struct | |
| 62 | struct | |
| 63 | 63 | { |
| 64 | 64 | UINT16 istr; /* Interrupt Status Register (R) */ |
| 65 | 65 | UINT16 cntr; /* Control Register (RW) */ |
| r17917 | r17918 | |
| 69 | 69 | emu_timer *dma_timer; |
| 70 | 70 | }; |
| 71 | 71 | |
| 72 | static | |
| 72 | static | |
| 73 | 73 | |
| 74 | 74 | static void check_interrupts( running_machine &machine ) |
| 75 | 75 | { |
| r17917 | r17918 | |
|---|---|---|
| 12 | 12 | #include "upd7002.h" |
| 13 | 13 | |
| 14 | 14 | |
| 15 | typedef struct _uPD7002_t uPD7002_t; | |
| 16 | struct _uPD7002_t | |
| 15 | struct uPD7002_t | |
| 17 | 16 | { |
| 18 | 17 | /* Pointer to our interface */ |
| 19 | 18 | const uPD7002_interface *intf; |
| r17917 | r17918 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | ****************************************************************************************/ |
| 11 | 11 | |
| 12 | ||
| 12 | ||
| 13 | 13 | { |
| 14 | 14 | const char *board; /* UNIF board */ |
| 15 | 15 | |
| r17917 | r17918 | |
| 17 | 17 | int wram; |
| 18 | 18 | int chrram; |
| 19 | 19 | int board_idx; |
| 20 | } | |
| 20 | } | |
| 21 | 21 | |
| 22 | 22 | |
| 23 | 23 | /************************************************************* |
| r17917 | r17918 | |
|---|---|---|
| 47 | 47 | #define UPD7002_EOC(name) void name(device_t *device, int data ) |
| 48 | 48 | |
| 49 | 49 | |
| 50 | typedef struct _uPD7002_interface uPD7002_interface; | |
| 51 | struct _uPD7002_interface | |
| 50 | struct uPD7002_interface | |
| 52 | 51 | { |
| 53 | 52 | uPD7002_get_analogue_func get_analogue_func; |
| 54 | 53 | uPD7002_eoc_func EOC_func; |
| r17917 | r17918 | |
|---|---|---|
| 2831 | 2831 | static void mouse_js_reset(running_machine &machine) |
| 2832 | 2832 | { |
| 2833 | 2833 | rmnimbus_state *drvstate = machine.driver_data<rmnimbus_state>(); |
| 2834 | | |
| 2834 | | |
| 2835 | 2835 | |
| 2836 | 2836 | state->m_mouse_px=0; |
| 2837 | 2837 | state->m_mouse_py=0; |
| r17917 | r17918 | |
| 2860 | 2860 | int xint; |
| 2861 | 2861 | int yint; |
| 2862 | 2862 | |
| 2863 | | |
| 2863 | | |
| 2864 | 2864 | |
| 2865 | 2865 | |
| 2866 | 2866 | state->m_reg0a4 = machine.root_device().ioport(MOUSE_BUTTON_TAG)->read() | 0xC0; |
| r17917 | r17918 | |
| 3000 | 3000 | */ |
| 3001 | 3001 | UINT8 result; |
| 3002 | 3002 | //int pc=machine().device(MAINCPU_TAG)->safe_pc(); |
| 3003 | | |
| 3003 | | |
| 3004 | 3004 | |
| 3005 | 3005 | if (ioport("config")->read() & 0x01) |
| 3006 | 3006 | { |
| r17917 | r17918 | |
|---|---|---|
| 36 | 36 | #define DS_READY 0x02 /* drive ready bit */ |
| 37 | 37 | #define DS_WRFAULT 0x01 /* write fault */ |
| 38 | 38 | |
| 39 | ||
| 39 | ||
| 40 | 40 | { |
| 41 | 41 | // Disk format support. This flag allows to choose between the full |
| 42 | 42 | // FM/MFM format and an abbreviated track layout. The difference results |
| r17917 | r17918 | |
| 70 | 70 | // by external circuitry. */ |
| 71 | 71 | devcb_write8 dma_write; |
| 72 | 72 | |
| 73 | } | |
| 73 | } | |
| 74 | 74 | |
| 75 | 75 | |
| 76 | 76 | class smc92x4_device : public device_t |
| r17917 | r17918 | |
|---|---|---|
| 164 | 164 | }; |
| 165 | 165 | |
| 166 | 166 | /* tape reader registers */ |
| 167 | ||
| 167 | ||
| 168 | 168 | { |
| 169 | 169 | device_image_interface *fd; /* file descriptor of tape image */ |
| 170 | 170 | |
| r17917 | r17918 | |
| 177 | 177 | int rcp; /* 1-bit reader "need a completion pulse" flip-flop */ |
| 178 | 178 | |
| 179 | 179 | emu_timer *timer; /* timer to simulate reader timing */ |
| 180 | } | |
| 180 | } | |
| 181 | 181 | |
| 182 | 182 | |
| 183 | 183 | |
| 184 | 184 | /* tape puncher registers */ |
| 185 | ||
| 185 | ||
| 186 | 186 | { |
| 187 | 187 | device_image_interface *fd; /* file descriptor of tape image */ |
| 188 | 188 | |
| 189 | 189 | emu_timer *timer; /* timer to generate completion pulses */ |
| 190 | } | |
| 190 | } | |
| 191 | 191 | |
| 192 | 192 | |
| 193 | 193 | |
| 194 | 194 | /* typewriter registers */ |
| 195 | ||
| 195 | ||
| 196 | 196 | { |
| 197 | 197 | device_image_interface *fd; /* file descriptor of output image */ |
| 198 | 198 | |
| 199 | 199 | int tb; /* typewriter buffer */ |
| 200 | 200 | |
| 201 | 201 | emu_timer *tyo_timer;/* timer to generate completion pulses */ |
| 202 | } | |
| 202 | } | |
| 203 | 203 | |
| 204 | 204 | /* MIT parallel drum (mostly similar to type 23) */ |
| 205 | ||
| 205 | ||
| 206 | 206 | { |
| 207 | 207 | device_image_interface *fd; /* file descriptor of drum image */ |
| 208 | 208 | |
| r17917 | r17918 | |
| 216 | 216 | |
| 217 | 217 | emu_timer *rotation_timer; /* timer called each time dc is 0 */ |
| 218 | 218 | emu_timer *il_timer; /* timer called each time dc is il */ |
| 219 | } | |
| 219 | } | |
| 220 | 220 | |
| 221 | 221 | |
| 222 | ||
| 222 | ||
| 223 | 223 | { |
| 224 | 224 | char active; |
| 225 | 225 | char down; |
| 226 | 226 | short x, y; |
| 227 | 227 | short radius; |
| 228 | } | |
| 228 | } | |
| 229 | 229 | |
| 230 | 230 | |
| 231 | 231 | class pdp1_state : public driver_device |
| r17917 | r17918 | |
|---|---|---|
| 179 | 179 | static const device_timer_id TIMER_HIRES_JOYSTICK_Y = 1; |
| 180 | 180 | static const device_timer_id TIMER_DIECOM_LIGHTGUN = 2; |
| 181 | 181 | |
| 182 | | |
| 182 | | |
| 183 | 183 | { |
| 184 | 184 | SOUNDMUX_SEL1 = 1, |
| 185 | 185 | SOUNDMUX_SEL2 = 2, |
| 186 | 186 | SOUNDMUX_ENABLE = 4 |
| 187 | } | |
| 187 | } | |
| 188 | 188 | |
| 189 | | |
| 189 | | |
| 190 | 190 | { |
| 191 | 191 | JOYSTICK_NONE = 0x00, |
| 192 | 192 | JOYSTICK_NORMAL = 0x01, |
| 193 | 193 | JOYSTICK_RAT_MOUSE = 0x02, |
| 194 | 194 | JOYSTICK_DIECOM_LIGHT_GUN = 0x03 |
| 195 | } | |
| 195 | } | |
| 196 | 196 | |
| 197 | | |
| 197 | | |
| 198 | 198 | { |
| 199 | 199 | HIRES_NONE = 0x00, |
| 200 | 200 | HIRES_RIGHT = 0x01, |
| 201 | 201 | HIRES_RIGHT_COCOMAX3 = 0x02, |
| 202 | 202 | HIRES_LEFT = 0x03, |
| 203 | 203 | HIRES_LEFT_COCOMAX3 = 0x04, |
| 204 | } | |
| 204 | } | |
| 205 | 205 | |
| 206 | | |
| 206 | | |
| 207 | 207 | { |
| 208 | 208 | ioport_port *m_input[2][2]; |
| 209 | 209 | ioport_port *m_buttons; |
| 210 | 210 | |
| 211 | 211 | UINT8 input(int joystick, int axis) const { return m_input[joystick][axis] ? m_input[joystick][axis]->read() : 0x00; } |
| 212 | 212 | UINT8 buttons(void) const { return m_buttons ? m_buttons->read() : 0x00; } |
| 213 | } | |
| 213 | } | |
| 214 | 214 | |
| 215 | 215 | void analog_port_start(analog_input_t *analog, const char *rx_tag, const char *ry_tag, const char *lx_tag, const char *ly_tag, const char *buttons_tag); |
| 216 | 216 |
| r17917 | r17918 | |
|---|---|---|
| 16 | 16 | #define KB_COP421_TAG "kbcop" |
| 17 | 17 | |
| 18 | 18 | /* lisa MMU segment regs */ |
| 19 | ||
| 19 | ||
| 20 | 20 | { |
| 21 | 21 | UINT16 sorg; |
| 22 | 22 | UINT16 slim; |
| 23 | } | |
| 23 | } | |
| 24 | 24 | |
| 25 | 25 | /* MMU regs translated into a more efficient format */ |
| 26 | 26 | enum mmu_entry_t { RAM_stack_r, RAM_r, RAM_stack_rw, RAM_rw, IO, invalid, special_IO }; |
| 27 | 27 | |
| 28 | ||
| 28 | ||
| 29 | 29 | { |
| 30 | 30 | offs_t sorg; /* (real_sorg & 0x0fff) << 9 */ |
| 31 | 31 | mmu_entry_t type; /* <-> (real_slim & 0x0f00) */ |
| 32 | 32 | int slim; /* (~ ((real_slim & 0x00ff) << 9)) & 0x01ffff */ |
| 33 | } | |
| 33 | } | |
| 34 | 34 | |
| 35 | 35 | enum floppy_hardware_t |
| 36 | 36 | { |
| r17917 | r17918 | |
| 48 | 48 | }; /* clock mode */ |
| 49 | 49 | |
| 50 | 50 | /* clock registers */ |
| 51 | ||
| 51 | ||
| 52 | 52 | { |
| 53 | 53 | long alarm; /* alarm (20-bit binary) */ |
| 54 | 54 | int years; /* years (4-bit binary ) */ |
| r17917 | r17918 | |
| 66 | 66 | int clock_write_ptr; /* clock byte to be written next (-1 if clock write disabled) */ |
| 67 | 67 | |
| 68 | 68 | enum clock_mode_t clock_mode; |
| 69 | } | |
| 69 | } | |
| 70 | 70 | |
| 71 | ||
| 71 | ||
| 72 | 72 | { |
| 73 | 73 | unsigned int has_fast_timers : 1; /* I/O board VIAs are clocked at 1.25 MHz (?) instead of .5 MHz (?) (Lisa 2/10, Mac XL) */ |
| 74 | 74 | /* Note that the beep routine in boot ROMs implies that |
| r17917 | r17918 | |
| 86 | 86 | floppy_hardware_t floppy_hardware; |
| 87 | 87 | unsigned int has_double_sided_floppy : 1; /* true on lisa 1 and *hacked* lisa 2/10 / Mac XL */ |
| 88 | 88 | unsigned int has_mac_xl_video : 1; /* modified video for MacXL */ |
| 89 | } | |
| 89 | } | |
| 90 | 90 | |
| 91 | 91 | |
| 92 | 92 | class lisa_state : public driver_device |
| r17917 | r17918 | |
|---|---|---|
| 12 | 12 | #include "sound/beep.h" |
| 13 | 13 | #include "video/mc6845.h" |
| 14 | 14 | |
| 15 | struct kay_kbd_t; | |
| 15 | 16 | |
| 16 | 17 | class kaypro_state : public driver_device |
| 17 | 18 | { |
| r17917 | r17918 | |
| 65 | 66 | UINT8 m_framecnt; |
| 66 | 67 | UINT16 m_cursor; |
| 67 | 68 | UINT16 m_mc6845_video_address; |
| 68 | | |
| 69 | | |
| 69 | 70 | void mc6845_cursor_configure(); |
| 70 | 71 | void mc6845_screen_configure(); |
| 71 | 72 | DECLARE_MACHINE_START(kayproii); |
| r17917 | r17918 | |
|---|---|---|
| 55 | 55 | |
| 56 | 56 | |
| 57 | 57 | /* tape reader registers */ |
| 58 | ||
| 58 | ||
| 59 | 59 | { |
| 60 | 60 | device_image_interface *fd; /* file descriptor of tape image */ |
| 61 | 61 | |
| r17917 | r17918 | |
| 65 | 65 | int rc; /* 2-bit reader counter */ |
| 66 | 66 | |
| 67 | 67 | emu_timer *timer; /* timer to simulate reader timing */ |
| 68 | } | |
| 68 | } | |
| 69 | 69 | |
| 70 | 70 | |
| 71 | 71 | |
| 72 | 72 | /* tape puncher registers */ |
| 73 | ||
| 73 | ||
| 74 | 74 | { |
| 75 | 75 | device_image_interface *fd; /* file descriptor of tape image */ |
| 76 | 76 | |
| 77 | 77 | emu_timer *timer; /* timer to generate completion pulses */ |
| 78 | } | |
| 78 | } | |
| 79 | 79 | |
| 80 | 80 | |
| 81 | 81 | |
| 82 | 82 | /* typewriter registers */ |
| 83 | ||
| 83 | ||
| 84 | 84 | { |
| 85 | 85 | device_image_interface *fd; /* file descriptor of output image */ |
| 86 | 86 | |
| 87 | 87 | emu_timer *prt_timer;/* timer to generate completion pulses */ |
| 88 | } | |
| 88 | } | |
| 89 | 89 | |
| 90 | 90 | |
| 91 | 91 | /* magnetic tape unit registers */ |
| 92 | ||
| 92 | ||
| 93 | 93 | { |
| 94 | 94 | device_image_interface *img; /* image descriptor */ |
| 95 | 95 | |
| r17917 | r17918 | |
| 121 | 121 | int long_parity; |
| 122 | 122 | |
| 123 | 123 | emu_timer *timer; /* timer to simulate reader timing */ |
| 124 | } | |
| 124 | } | |
| 125 | 125 | |
| 126 | 126 | |
| 127 | 127 | class tx0_state : public driver_device |
| r17917 | r17918 | |
|---|---|---|
| 14 | 14 | #define NICK_PALETTE_SIZE 256 |
| 15 | 15 | |
| 16 | 16 | |
| 17 | struct NICK_STATE; | |
| 18 | ||
| 17 | 19 | class ep_state : public driver_device |
| 18 | 20 | { |
| 19 | 21 | public: |
| r17917 | r17918 | |
| 23 | 25 | UINT8 exdos_card_value; /* state of the wd1770 irq/drq lines */ |
| 24 | 26 | UINT8 keyboard_line; /* index of keyboard line to read */ |
| 25 | 27 | bitmap_ind16 m_bitmap; |
| 26 | | |
| 28 | | |
| 27 | 29 | DECLARE_READ8_MEMBER(exdos_card_r); |
| 28 | 30 | DECLARE_WRITE8_MEMBER(exdos_card_w); |
| 29 | 31 | virtual void machine_reset(); |
| r17917 | r17918 | |
|---|---|---|
| 152 | 152 | }; |
| 153 | 153 | |
| 154 | 154 | /* Mouse/Joystick */ |
| 155 | struct | |
| 155 | struct | |
| 156 | 156 | { |
| 157 | 157 | UINT8 m_mouse_px; |
| 158 | 158 | UINT8 m_mouse_py; |
| r17917 | r17918 | |
| 186 | 186 | UINT8 m_mcu_reg080; |
| 187 | 187 | UINT8 m_iou_reg092; |
| 188 | 188 | UINT8 m_last_playmode; |
| 189 | | |
| 189 | | |
| 190 | 190 | UINT8 m_ay8910_a; |
| 191 | 191 | UINT16 m_IOPorts[num_ioports]; |
| 192 | 192 | UINT8 m_sio_int_state; |
| r17917 | r17918 | |
|---|---|---|
| 24 | 24 | #define I824X_SCREEN_HEIGHT 243 |
| 25 | 25 | #define I824X_LINE_CLOCKS 228 |
| 26 | 26 | |
| 27 | ||
| 27 | ||
| 28 | 28 | UINT8 reg[0x100]; |
| 29 | 29 | struct { |
| 30 | 30 | struct { |
| r17917 | r17918 | |
| 52 | 52 | UINT8 hgrid[2][0x10]; |
| 53 | 53 | UINT8 vgrid[0x10]; |
| 54 | 54 | } s; |
| 55 | } | |
| 55 | } | |
| 56 | 56 | |
| 57 | 57 | struct ef9341_t |
| 58 | 58 | { |
| r17917 | r17918 | |
|---|---|---|
| 79 | 79 | 2, 1 /* low intensity, reverse */ |
| 80 | 80 | }; |
| 81 | 81 | |
| 82 | ||
| 82 | ||
| 83 | 83 | { |
| 84 | 84 | vdt911_screen_size_t screen_size; /* char_960 for 960-char, 12-line model; char_1920 for 1920-char, 24-line model */ |
| 85 | 85 | vdt911_model_t model; /* country code */ |
| r17917 | r17918 | |
| 110 | 110 | UINT8 last_key_pressed; |
| 111 | 111 | int last_modifier_state; |
| 112 | 112 | char foreign_mode; |
| 113 | } | |
| 113 | } | |
| 114 | 114 | |
| 115 | 115 | /* |
| 116 | 116 | Macros for model features |
| r17917 | r17918 | |
| 576 | 576 | { |
| 577 | 577 | vdt_t *vdt = get_safe_token(device); |
| 578 | 578 | |
| 579 | | |
| 579 | | |
| 580 | 580 | { |
| 581 | 581 | /* states for western keyboards and katakana/arabic keyboards in romaji/latin mode */ |
| 582 | 582 | lower_case = 0, upper_case, shift, control, |
| r17917 | r17918 | |
| 584 | 584 | foreign, foreign_shift, |
| 585 | 585 | /* special value to stop repeat if the modifier state changes */ |
| 586 | 586 | special_debounce = -1 |
| 587 | } | |
| 587 | } | |
| 588 | 588 | |
| 589 | 589 | static unsigned char repeat_timer; |
| 590 | 590 | enum { repeat_delay = 5 /* approx. 1/10s */ }; |
| r17917 | r17918 | |
|---|---|---|
| 33 | 33 | vdt911_model_FrenchWP /* French word processing */ |
| 34 | 34 | }; |
| 35 | 35 | |
| 36 | ||
| 36 | ||
| 37 | 37 | { |
| 38 | 38 | vdt911_screen_size_t screen_size; |
| 39 | 39 | vdt911_model_t model; |
| 40 | 40 | void (*int_callback)(running_machine &machine, int state); |
| 41 | } | |
| 41 | } | |
| 42 | 42 | |
| 43 | 43 | PALETTE_INIT( vdt911 ); |
| 44 | 44 |
| r17917 | r17918 | |
|---|---|---|
| 43 | 43 | |
| 44 | 44 | /* Nick executes a Display list, in the form of a list of Line Parameter |
| 45 | 45 | Tables, this is the form of the data */ |
| 46 | ||
| 46 | ||
| 47 | 47 | { |
| 48 | 48 | unsigned char SC; /* scanlines in this modeline (two's complement) */ |
| 49 | 49 | unsigned char MB; /* the MODEBYTE (defines video display mode) */ |
| r17917 | r17918 | |
| 54 | 54 | unsigned char LD2L; /* (a7..a0) of line data pointer LD2 */ |
| 55 | 55 | unsigned char LD2H; /* (a8..a15) of line data pointer LD2 */ |
| 56 | 56 | unsigned char COL[8]; /* COL0..COL7 */ |
| 57 | } | |
| 57 | } | |
| 58 | 58 | |
| 59 | ||
| 59 | ||
| 60 | 60 | { |
| 61 | 61 | /* horizontal position */ |
| 62 | 62 | unsigned char HorizontalClockCount; |
| r17917 | r17918 | |
| 90 | 90 | unsigned int PenIndexLookup_16Colour[256]; |
| 91 | 91 | |
| 92 | 92 | UINT8 *videoram; |
| 93 | } | |
| 93 | } | |
| 94 | 94 | |
| 95 | 95 | /* colour mode types */ |
| 96 | 96 | #define NICK_2_COLOUR_MODE 0 |
| r17917 | r17918 | |
|---|---|---|
| 75 | 75 | /* structure used to describe differences between national character sets and |
| 76 | 76 | US character set */ |
| 77 | 77 | /* much more compact than defining the complete 128-char vector */ |
| 78 | ||
| 78 | ||
| 79 | 79 | { |
| 80 | 80 | unsigned char char_index; /* char to replace */ |
| 81 | 81 | unsigned short symbol_index; /* replacement symbol */ |
| 82 | } | |
| 82 | } | |
| 83 | 83 | |
| 84 | 84 | /* One UK-specific character */ |
| 85 | 85 | static const char_override_t UK_overrides[1] = |
| r17917 | r17918 | |
|---|---|---|
| 261 | 261 | static pixel_t mix_color(double factor, UINT8 c0, UINT8 c1); |
| 262 | 262 | }; |
| 263 | 263 | |
| 264 | | |
| 264 | | |
| 265 | 265 | { |
| 266 | 266 | BORDER_COLOR_BLACK, |
| 267 | 267 | BORDER_COLOR_GREEN, |
| 268 | 268 | BORDER_COLOR_WHITE, |
| 269 | 269 | BORDER_COLOR_ORANGE |
| 270 | } | |
| 270 | } | |
| 271 | 271 | |
| 272 | 272 | // callbacks |
| 273 | 273 | devcb_resolved_write_line m_res_out_hsync_func; |
| r17917 | r17918 | |
|---|---|---|
| 25 | 25 | MACHINE_CONFIG_EXTERN( pcvideo_pc200 ); |
| 26 | 26 | |
| 27 | 27 | |
| 28 | ||
| 28 | ||
| 29 | 29 | void pc_aga_set_mode(running_machine &machine, AGA_MODE mode); |
| 30 | 30 | |
| 31 | 31 | READ8_HANDLER( pc_aga_videoram_r ); |
| r17917 | r17918 | |
|---|---|---|
| 658 | 658 | void asr733_keyboard(device_t *device) |
| 659 | 659 | { |
| 660 | 660 | asr_t *asr = get_safe_token(device); |
| 661 | | |
| 661 | | |
| 662 | 662 | { |
| 663 | 663 | /* key modifier states */ |
| 664 | 664 | unshifted = 0, shift, control, |
| 665 | 665 | /* special value to stop repeat if the modifier state changes */ |
| 666 | 666 | special_debounce = -1 |
| 667 | } | |
| 667 | } | |
| 668 | 668 | |
| 669 | 669 | enum { repeat_delay = 5 /* approx. 1/10s */ }; |
| 670 | 670 |
| r17917 | r17918 | |
|---|---|---|
| 9 | 9 | asr733_chr_region_len = 128*asr733_single_char_len |
| 10 | 10 | }; |
| 11 | 11 | |
| 12 | ||
| 12 | ||
| 13 | 13 | { |
| 14 | 14 | void (*int_callback)(running_machine &machine, int state); |
| 15 | } | |
| 15 | } | |
| 16 | 16 | |
| 17 | 17 | GFXDECODE_EXTERN( asr733 ); |
| 18 | 18 |
| r17917 | r17918 | |
|---|---|---|
| 141 | 141 | INTERRUPT_EI0 = 0x01 |
| 142 | 142 | }; |
| 143 | 143 | |
| 144 | | |
| 144 | | |
| 145 | 145 | { |
| 146 | 146 | GIME_TIMER_HBORD, |
| 147 | 147 | GIME_TIMER_CLOCK |
| 148 | } | |
| 148 | } | |
| 149 | 149 | |
| 150 | 150 | // timer constants |
| 151 | 151 | static const device_timer_id TIMER_GIME_CLOCK = 4; |
| r17917 | r17918 | |
|---|---|---|
| 10 | 10 | #include "emu.h" |
| 11 | 11 | #include "k1ge.h" |
| 12 | 12 | |
| 13 | typedef struct k1ge k1ge_t; | |
| 14 | struct k1ge | |
| 13 | struct k1ge_t | |
| 15 | 14 | { |
| 16 | 15 | const k1ge_interface *intf; |
| 17 | 16 | screen_device *screen; |
| r17917 | r17918 | |
|---|---|---|
| 30 | 30 | #include "audio/vboy.h" |
| 31 | 31 | #include "vboy.lh" |
| 32 | 32 | |
| 33 | typedef struct _vboy_regs_t vboy_regs_t; | |
| 34 | ||
| 35 | 33 | /* FIXME: most if not all of these must be UINT8 */ |
| 36 | struct | |
| 34 | struct | |
| 37 | 35 | { |
| 38 | 36 | UINT32 lpc, lpc2, lpt, lpr; |
| 39 | 37 | UINT32 khb, klb; |
| r17917 | r17918 | |
| 63 | 61 | UINT16 BKCOL; |
| 64 | 62 | }; |
| 65 | 63 | |
| 66 | struct | |
| 64 | struct | |
| 67 | 65 | { |
| 68 | 66 | UINT16 count; |
| 69 | 67 | UINT16 latch; |
| 70 | 68 | }; |
| 71 | 69 | |
| 72 | ||
| 70 | ||
| 73 | 71 | |
| 74 | 72 | class vboy_state : public driver_device |
| 75 | 73 | { |
| Previous | 199869 Revisions | Next |