Previous 15994 Revisions Next

r4787 Friday 22nd May, 2009 at 12:40:20 UTC by Miodrag Milanović
[POLY88] img loading (snapshot)
[src/mess/drivers]poly88.c
[src/mess/includes]poly88.h
[src/mess/machine]poly88.c

src/mess/includes/poly88.h
r4786r4787
66
77#ifndef POLY88_H_
88#define POLY88_H_
9#include "machine/msm8251.h"
10#include "devices/snapquik.h"
911
1012/*----------- defined in machine/poly88.c -----------*/
1113
1214MACHINE_RESET(poly88);
1315INTERRUPT_GEN( poly88_interrupt );
14READ8_HANDLER(polly_keyboard_r);
15WRITE8_HANDLER(polly_intr_w);
16READ8_HANDLER(poly_keyboard_r);
17WRITE8_HANDLER(poly_intr_w);
18WRITE8_HANDLER(poly_baud_rate_w);
19extern const msm8251_interface poly88_usart_interface;
1620
21extern SNAPSHOT_LOAD( poly88 );
22
1723/*----------- defined in video/poly88.c -----------*/
1824extern UINT8 *poly_video_ram;
1925
r4786r4787
2127extern VIDEO_UPDATE( poly88 );
2228
2329#endif /* POLY88_H_ */
30
src/mess/machine/poly88.c
r4786r4787
88
99#include "driver.h"
1010#include "includes/poly88.h"
11#include "cpu/i8085/i8085.h"
1112
1213static UINT8 intr = 0;
1314static UINT8 last_code = 0;
1415static UINT8 int_vector = 0;
1516
17WRITE8_HANDLER(poly_baud_rate_w)
18{
19   logerror("poly_baud_rate_w %02x\n",data);
20}
21
1622static UINT8 row_number(UINT8 code) {
1723   if BIT(code,0) return 0;
1824   if BIT(code,1) return 1;
r4786r4787
131137   int_vector = 0xf7;
132138   cpu_set_input_line(device, 0, HOLD_LINE);   
133139}
140static void poly88_usart_rxready (const device_config *device, int state)
141{
142   int_vector = 0xe7;
143   //cpu_set_input_line(device, 0, HOLD_LINE);   
144}
145const msm8251_interface poly88_usart_interface=
146{
147   NULL,
148   NULL,
149   poly88_usart_rxready
150};
134151
135READ8_HANDLER(polly_keyboard_r)
152READ8_HANDLER(poly_keyboard_r)
136153{
137154   UINT8 retVal = last_code;
138155   cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE);
r4786r4787
140157   return retVal;
141158}
142159
143WRITE8_HANDLER(polly_intr_w)
160WRITE8_HANDLER(poly_intr_w)
144161{
145162   cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE);
146163}
164
165SNAPSHOT_LOAD( poly88 )
166{
167   const address_space *space = cputag_get_address_space(image->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
168   UINT8* data= auto_alloc_array(image->machine, UINT8, snapshot_size);
169   UINT16 recordNum;
170   UINT16 recordLen;
171   UINT16 address;
172   UINT8  recordType;
173   
174   int pos = 0x300;
175   char name[9];
176   int i = 0;
177   int theend = 0;
178
179   image_fread(image, data, snapshot_size);
180     
181   while (pos<snapshot_size) {
182      for(i=0;i<9;i++) {
183         name[i] = (char) data[pos + i];
184      }
185      pos+=8;
186      name[8] = 0;
187     
188     
189      recordNum = data[pos]+ data[pos+1]*256; pos+=2;
190      recordLen = data[pos]; pos++;
191      if (recordLen==0) recordLen=0x100;
192      address = data[pos] + data[pos+1]*256; pos+=2;
193      recordType = data[pos]; pos++;
194     
195      logerror("Block :%s number:%d length: %d address=%04x type:%d\n",name,recordNum,recordLen,address, recordType);     
196      switch(recordType) {
197         case 0 :
198               /* 00 Absolute */
199               memcpy(memory_get_read_ptr(space,address ), data + pos ,recordLen);
200               break;
201         case 1 :
202               /* 01 Comment */
203               break;
204         case 2 :
205               /* 02 End */
206               theend = 1;
207               break;
208         case 3 :     
209                /* 03 Auto Start @ Address */
210                cpu_set_reg(cputag_get_cpu(image->machine, "maincpu"), I8085_PC, address);
211                theend = 1;
212                break;
213          case 4 :
214                /* 04 Data ( used by Assembler ) */
215                logerror("ASM load unsupported\n");
216                theend = 1;
217                break;
218          case 5 :
219                /* 05 BASIC program file */
220                logerror("BASIC load unsupported\n");
221                theend = 1;
222                break;
223          case 6 :
224                /* 06 End ( used by Assembler? ) */
225                theend = 1;
226               break;
227         default: break;
228       }     
229             
230      if (theend) {
231         break;
232      }
233      pos+=recordLen;
234   }   
235   return INIT_PASS;
236}
src/mess/drivers/poly88.c
r4786r4787
2222ADDRESS_MAP_END
2323
2424static ADDRESS_MAP_START( poly88_io , ADDRESS_SPACE_IO, 8)
25   ADDRESS_MAP_UNMAP_HIGH   
26   AM_RANGE(0x08, 0x08) AM_WRITE(polly_intr_w)
27   AM_RANGE(0xf8, 0xf8) AM_READ(polly_keyboard_r)
25   ADDRESS_MAP_UNMAP_HIGH
26   AM_RANGE(0x01, 0x01) AM_DEVREADWRITE("uart", msm8251_status_r,msm8251_control_w)
27   AM_RANGE(0x00, 0x00) AM_DEVREADWRITE("uart", msm8251_data_r,msm8251_data_w)
28   AM_RANGE(0x04, 0x04) AM_WRITE(poly_baud_rate_w)
29   AM_RANGE(0x08, 0x08) AM_WRITE(poly_intr_w)
30   AM_RANGE(0xf8, 0xf8) AM_READ(poly_keyboard_r)
2831ADDRESS_MAP_END
2932
3033/* Input ports */
r4786r4787
131134
132135    MDRV_VIDEO_START(poly88)
133136    MDRV_VIDEO_UPDATE(poly88)
137   
138    /* uart */
139   MDRV_MSM8251_ADD("uart", poly88_usart_interface)
140   
141   /* snapshot */
142   MDRV_SNAPSHOT_ADD("snapshot", poly88, "img", 0)   
134143MACHINE_DRIVER_END
135144
136145static SYSTEM_CONFIG_START(poly88)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team