Skip to content

Commit 9aea64b

Browse files
authored
Merge pull request #32 from visrealm/dev
v 0.4.4
2 parents 2197af2 + 218f2d3 commit 9aea64b

File tree

5 files changed

+20
-15
lines changed

5 files changed

+20
-15
lines changed

src/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ cmake_minimum_required(VERSION 3.13)
33

44
# compile-time options
55

6-
set(PICO9918_VERSION "0.4.3")
6+
set(PICO9918_VERSION "0.4.4")
77
set(PICO9918_PCB_MAJOR_VER 0)
88
set(PICO9918_PCB_MINOR_VER 4)
99

10-
set(PICO9918_SCANLINES 1)
10+
set(PICO9918_SCANLINES 0)
1111

1212
# SCART RGBs options
1313
set(PICO9918_SCART_RGBS 0) # 1 for RGBs, 0 for VGA

src/main.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,16 +152,18 @@ void __not_in_flash_func(pio_irq_handler)()
152152
if ((TMS_PIO->fstat & (1u << (PIO_FSTAT_RXEMPTY_LSB + tmsWriteSm))) == 0) // write?
153153
{
154154
uint32_t writeVal = TMS_PIO->rxf[tmsWriteSm];
155+
uint8_t dataVal = writeVal & 0xff;
156+
writeVal >>= ((GPIO_MODE - GPIO_CD7) + 16);
155157

156-
if (writeVal & (GPIO_MODE_MASK >> GPIO_CD7)) // write reg/addr
158+
if (writeVal & 0x01) // write reg/addr
157159
{
158-
vrEmuTms9918WriteAddrImpl(writeVal & 0xff);
160+
vrEmuTms9918WriteAddrImpl(dataVal);
159161
currentInt = vrEmuTms9918InterruptStatusImpl();
160162
gpio_put(GPIO_INT, !currentInt);
161163
}
162164
else // write data
163165
{
164-
vrEmuTms9918WriteDataImpl(writeVal & 0xff);
166+
vrEmuTms9918WriteDataImpl(dataVal);
165167
}
166168

167169
nextValue = vrEmuTms9918ReadDataNoIncImpl();
@@ -381,7 +383,7 @@ void tmsPioInit()
381383

382384
pio_sm_config writeConfig = tmsWrite_program_get_default_config(tmsWriteProgram);
383385
sm_config_set_in_pins(&writeConfig, GPIO_CD7);
384-
sm_config_set_in_shift(&writeConfig, false, true, 16); // L shift, autopush @ 16 bits
386+
sm_config_set_in_shift(&writeConfig, false, true, 32); // L shift, autopush @ 16 bits
385387
sm_config_set_clkdiv(&writeConfig, 1.0f);
386388

387389
pio_sm_init(TMS_PIO, tmsWriteSm, tmsWriteProgram, &writeConfig);

src/res/splash.png

226 Bytes
Loading

src/tms9918.pio

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,20 @@ endPart:
6262
; tmsWrite - monitor the CSW pin and pass on pin state via FIFO
6363
;
6464
; very simple grab the data and send it through...
65+
; state at CSW going low in the high 16-bits
66+
; state at CSW going high in the low 16-bits
6567
;
66-
; fifo isr 0b|x|m|w|r|xxxx|dddddddd|
67-
; | |o|r|e| | CD0-7 |
68-
; | |d|i|a| | |
69-
; | |e|t|d| | |
70-
; | | |e| | | |
68+
; fifo isr 0b|x|m|w|r|xxxx|dddddddd|x|m|w|r|xxxx|dddddddd|
69+
; | |o|r|e| | CD0-7 | | | | | | CD0-7 |
70+
; | |d|i|a| | ignore | | | | | | |
71+
; | |e|t|d| | | | | | | | |
72+
; | | |e| | | | | | | | | |
7173

7274
.program tmsWrite
7375
.define public CSW_PIN 27
7476

75-
wait 0 gpio CSW_PIN [12] ; wait for CSW to go active (low)
76-
in pins, 16 ; grab the data CD0-7 and auto-push
77-
wait 1 gpio CSW_PIN [12] ; wait for CSW high (inactive)
77+
wait 0 gpio CSW_PIN ; wait for CSW to go active (low)
78+
in pins, 16 ; grab the initial state
79+
wait 1 gpio CSW_PIN ; wait for CSW inactive (high)
80+
in pins, 16 ; grab the final state
7881
.wrap

0 commit comments

Comments
 (0)