Previous 15994 Revisions Next

r3302 Saturday 20th September, 2008 at 13:37:39 UTC by Miodrag Milanović
[SAPI1] Updated driver according to documentation. Valid video finally
[docs]messnew.txt
[src/mess/drivers]sapi1.c
[src/mess/video]sapi1.c

src/mess/video/sapi1.c
r3301r3302
1010#include "driver.h"
1111#include "includes/sapi1.h"
1212 
13UINT8 MHB2501[] = {
14   0x0c,0x11,0x13,0x15,0x17,0x10,0x0e,0x00, // @
15   0x04,0x0a,0x11,0x11,0x1f,0x11,0x11,0x00, // A
16   0x1e,0x11,0x11,0x1e,0x11,0x11,0x1e,0x00, // B
17   0x0e,0x11,0x10,0x10,0x10,0x11,0x0e,0x00, // C
18   0x1e,0x09,0x09,0x09,0x09,0x09,0x1e,0x00, // D
19   0x1f,0x10,0x10,0x1e,0x10,0x10,0x1f,0x00, // E
20   0x1f,0x10,0x10,0x1e,0x10,0x10,0x10,0x00, // F
21   0x0e,0x11,0x10,0x10,0x13,0x11,0x0f,0x00, // G
22   
23   0x11,0x11,0x11,0x1f,0x11,0x11,0x11,0x00, // H
24   0x0e,0x04,0x04,0x04,0x04,0x04,0x0e,0x00, // I
25   0x01,0x01,0x01,0x01,0x11,0x11,0x0e,0x00, // J
26   0x11,0x12,0x14,0x18,0x14,0x12,0x11,0x00, // K
27   0x10,0x10,0x10,0x10,0x10,0x10,0x1f,0x00, // L
28   0x11,0x1b,0x15,0x15,0x11,0x11,0x11,0x00, // M
29   0x11,0x11,0x19,0x15,0x13,0x11,0x11,0x00, // N
30   0x0e,0x11,0x11,0x11,0x11,0x11,0x0e,0x00, // O
31   
32   0x1e,0x11,0x11,0x1e,0x10,0x10,0x10,0x00, // P
33   0x0e,0x11,0x11,0x11,0x15,0x12,0x0d,0x00, // Q
34   0x1e,0x11,0x11,0x1e,0x14,0x12,0x11,0x00, // R
35   0x0e,0x11,0x10,0x0e,0x01,0x11,0x0e,0x00, // S
36   0x1f,0x04,0x04,0x04,0x04,0x04,0x04,0x00, // T
37   0x11,0x11,0x11,0x11,0x11,0x11,0x0e,0x00, // U
38   0x11,0x11,0x11,0x0a,0x0a,0x04,0x04,0x00, // V
39   0x11,0x11,0x11,0x15,0x15,0x15,0x0a,0x00, // W
40   
41   0x11,0x11,0x0a,0x04,0x0a,0x11,0x11,0x00, // X
42   0x11,0x11,0x0a,0x04,0x04,0x04,0x04,0x00, // Y
43   0x1f,0x01,0x02,0x04,0x08,0x10,0x1f,0x00, // Z
44   0x1c,0x10,0x10,0x10,0x10,0x10,0x1c,0x00, // [
45   0x00,0x10,0x08,0x04,0x02,0x01,0x00,0x00, // backslash
46   0x07,0x01,0x01,0x01,0x01,0x01,0x07,0x00, // ]
47   0x0e,0x11,0x00,0x00,0x00,0x00,0x00,0x00, // ^
48   0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x00, // _
49   
50   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 
51   0x04,0x04,0x04,0x04,0x04,0x00,0x04,0x00, // !
52   0x0a,0x0a,0x0a,0x00,0x00,0x00,0x00,0x00, // "
53   0x0a,0x0a,0x1f,0x0a,0x1f,0x0a,0x0a,0x00, // #
54   0x00,0x11,0x0e,0x0a,0x0e,0x11,0x00,0x00, // 
55   0x18,0x19,0x02,0x04,0x08,0x13,0x03,0x00, // %
56   0x04,0x0a,0x0a,0x0c,0x15,0x12,0x0d,0x00, // &
57   0x04,0x04,0x08,0x00,0x00,0x00,0x00,0x00, // '
58   
59   0x02,0x04,0x08,0x08,0x08,0x04,0x02,0x00, // (
60   0x08,0x04,0x02,0x02,0x02,0x04,0x08,0x00, // )
61   0x00,0x04,0x15,0x0e,0x15,0x04,0x00,0x00, // *
62   0x00,0x04,0x04,0x1f,0x04,0x04,0x00,0x00, // +
63   0x00,0x00,0x00,0x00,0x08,0x08,0x10,0x00, // ,
64   0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x00, // -
65   0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00, // .
66   0x00,0x01,0x02,0x04,0x08,0x10,0x00,0x00, // /
67   
68   0x0e,0x11,0x13,0x15,0x19,0x11,0x0e,0x00, // 0
69   0x04,0x0c,0x04,0x04,0x04,0x04,0x0e,0x00, // 1
70   0x0e,0x11,0x01,0x06,0x08,0x10,0x1f,0x00, // 2
71   0x1f,0x01,0x02,0x06,0x01,0x11,0x0e,0x00, // 3
72   0x02,0x06,0x0a,0x12,0x1f,0x02,0x02,0x00, // 4
73   0x1f,0x10,0x1e,0x01,0x01,0x11,0x0e,0x00, // 5
74   0x07,0x08,0x10,0x1e,0x11,0x11,0x0e,0x00, // 6
75   0x1f,0x01,0x02,0x04,0x08,0x08,0x08,0x00, // 7
76   
77   0x0e,0x11,0x11,0x0e,0x11,0x11,0x0e,0x00, // 8
78   0x0e,0x11,0x11,0x0f,0x01,0x02,0x1c,0x00, // 9
79   0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00, // :
80   0x00,0x00,0x04,0x00,0x04,0x04,0x08,0x00, // ;
81   0x02,0x04,0x08,0x10,0x08,0x04,0x02,0x00, // <
82   0x00,0x00,0x1f,0x00,0x1f,0x00,0x00,0x00, // =
83   0x08,0x04,0x02,0x01,0x02,0x04,0x08,0x00, // >
84   0x0e,0x11,0x01,0x02,0x04,0x00,0x04,0x00  // ?
85};
86 
87static UINT8 refresh_counter;
88 
1389VIDEO_START( sapi1 )
1490{
91   refresh_counter = 0;
1592}
1693 
1794VIDEO_UPDATE( sapi1 )
1895{
1996    int x,y,j,b;
20   UINT8 *gfx = memory_region(screen->machine, "gfx1");
21 
97  UINT16 addr;
98  int xpos;
99   
22100   for(y = 0; y < 24; y++ )
23101   {
102      addr = 0x3800 + y*64;
103      xpos = 0;
24104      for(x = 0; x < 40; x++ )
25105      {
26         int code = program_read_byte(0x3800+ x + y*64);
27         if (code<0x20) code |= 0x40;
28         if (code==0xa0) code = 0xc0;
29         for(j = 0; j < 12; j++ )
30         {
106         UINT8 code = program_read_byte(addr + x);
107         UINT8 attr = (code >> 6) & 3;
108         code &= 0x3f;                   
109         for(j = 0; j < 9; j++ )
110         {             
31111            for(b = 0; b < 6; b++ )
32112           {
33              *BITMAP_ADDR16(bitmap, y*12+j, x*6+b ) = (gfx[code*16+(11-j)] >> (7-b)) & 1;
34           }
113              UINT8 val;
114              if (j==8) {
115                 if (attr==2) {
116                    val = (refresh_counter & 0x20) ? 1 : 0;
117                 } else {
118                    val = 0;
119                 }                 
120              } else {                 
121                 val = (MHB2501[code*8 + j] >> (5-b)) & 1;
122                 if (attr==1) {
123                    val = (refresh_counter & 0x20) ? val : 0;
124                 }
125              }
126              if(attr==3) {
127                 *BITMAP_ADDR16(bitmap, y*9+j, xpos+2*b   ) = val;
128                 *BITMAP_ADDR16(bitmap, y*9+j, xpos+2*b+1 ) = val;
129              } else {
130                 *BITMAP_ADDR16(bitmap, y*9+j, xpos+b ) = val;
131              }
132           }                       
35133         }
134         xpos+= (attr==3) ? 12 : 6;
135         if (xpos>=6*40) break;
36136      }
37137   }
138   refresh_counter++;
38139   return 0;
39140}
40141 
src/mess/drivers/sapi1.c
r3301r3302
1616static ADDRESS_MAP_START(sapi1_mem, ADDRESS_SPACE_PROGRAM, 8)
1717   ADDRESS_MAP_UNMAP_HIGH
1818   AM_RANGE(0x0000, 0x0fff) AM_ROM
19   AM_RANGE(0x1000, 0x23ff) AM_RAM
20   AM_RANGE(0x2400, 0x24ff) AM_READWRITE(sapi1_keyboard_r, sapi1_keyboard_w) // keyboard   
21   AM_RANGE(0x2800, 0x3fff) AM_RAM
19   AM_RANGE(0x1000, 0x1fff) AM_ROM // Extension ROM
20   AM_RANGE(0x2000, 0x23ff) AM_RAM
21   AM_RANGE(0x2400, 0x27ff) AM_READWRITE(sapi1_keyboard_r, sapi1_keyboard_w) // PORT 0 - keyboard   
22   //AM_RANGE(0x2800, 0x2bff) AM_NOP // PORT 1
23   //AM_RANGE(0x2c00, 0x2fff) AM_NOP // PORT 2
24   //AM_RANGE(0x3000, 0x33ff) AM_NOP // 3214       
25   AM_RANGE(0x3800, 0x3fff) AM_RAM // AND-1 (video RAM)
26   AM_RANGE(0x4000, 0x4000) AM_RAM // REM-1
2227ADDRESS_MAP_END
2328 
2429static ADDRESS_MAP_START( sapi1_io, ADDRESS_SPACE_IO, 8 )
25   ADDRESS_MAP_UNMAP_HIGH
30ADDRESS_MAP_UNMAP_HIGH
2631ADDRESS_MAP_END
2732 
2833/* Input ports */
r3301r3302
9095      MDRV_SCREEN_REFRESH_RATE(50)
9196      MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
9297      MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
93      MDRV_SCREEN_SIZE(40*6, 24*12)
94      MDRV_SCREEN_VISIBLE_AREA(0, 40*6-1, 0, 24*12-1)
98      MDRV_SCREEN_SIZE(40*6, 24*9)
99      MDRV_SCREEN_VISIBLE_AREA(0, 40*6-1, 0, 24*9-1)
95100 
96101      MDRV_PALETTE_LENGTH(2)
97102      MDRV_PALETTE_INIT(black_and_white)
r3301r3302
109114ROM_START( sapi1 )
110115    ROM_REGION( 0x10000, "main", ROMREGION_ERASEFF )
111116    ROM_LOAD( "sapi1.rom", 0x0000, 0x1000, CRC(c6e85b01) SHA1(2a26668249c6161aef7215a1e2b92bfdf6fe3671) )
112    ROM_REGION(0x1000, "gfx1",0)
113      ROM_LOAD ("sapi1.chr", 0x0000, 0x1000, CRC(9edafa2c) SHA1(a903db0e8923cca91646274d010dc19b6b377e3e))
114117ROM_END
115118 
116119 
117120/* Driver */
118121 
119122/*    YEAR  NAME    PARENT  COMPAT  MACHINE     INPUT       INIT     CONFIG COMPANY                  FULLNAME   FLAGS */
120COMP( 1985, sapi1,    0,        0,      sapi1,       sapi1,       sapi1,     sapi1,     "Tesla",                "SAPI-1",    GAME_NOT_WORKING)
123COMP( 1985, sapi1,    0,        0,      sapi1,       sapi1,       sapi1,     sapi1,     "Tesla",                "SAPI-1 ZPS 1",    0)
121124 
docs/messnew.txt
r3301r3302
66- HT-1080Z / HT-1080Z/64 [Miodrag Milanovic]
77- Primo B32/ Primo B48/ Primo C64 [Miodrag Milanovic]
88- Homelab 2/3/4 (not working) [Miodrag Milanovic]
9- SAPI-1 (not working) [Miodrag Milanovic]
9- SAPI-1 [Miodrag Milanovic]
1010- Vector-06c (not working) [Miodrag Milanovic]
1111- Irisha (not working) [Miodrag Milanovic]
1212- PP-01 (not working) [Miodrag Milanovic]

Previous 15994 Revisions Next


© 1998-2018 The MESS Team