Questionnaire about SVI

By andrear1979

Expert (98)

andrear1979 さんの画像

13-02-2015, 01:12

Hi guys,

I ported my tiny MSX game I.N.E.R.T.I.A. to SVI-318, ROM format. Since
I don't own an SVI, I used BlueMSX as a test environment.

The final result is crappily coded and fragile, but seems to work, and
an SVI owner confirmed it works on a real SVI. I'm going to share it on
my website next days. While porting I had some doubts and difficulties
to understand the machine and the differences from MSXes, I'm now going
to expose my knowledge in form of a "question + my answer" list.

If you have time to read this and have some experience of the SVI,
would you please confirm or reject my answers, or add further details
you know, whatever you like. I think this isn't a very widespread
machine, so I don't expect heavy traffic on this topic. Thanks in
advance for any feedback.

Q1: is there an SVI video mode equivalent to "SCREEN 1" mode of the MSX?
A1: can't be set by BASIC, can't be set by BIOS calls (ouch!); you can
only set it by writing directly to the VDP registers.

Q2: does SVI have the BASIC "WIDTH" instruction?
A2: no; 40-columns width is fixed

Q3: is this a problem for an ASM program?
A3: yes if you need the MSX "SCREEN 1" mode and wanted to use the CHPUT
and POSIT BIOS calls. These are defined in SVI but assume width is 40
columns, while MSX "SCREEN 1" is 32 columns. You are forced to write
your own replacements for CHPUT and POSIT.

Q4: is there a GTSTCK BIOS call for joysticks and cursor keys?
A4: no! you have to write your own I/O procedure, something like this:

; Get joystick direction
; Result in A
; Each bit is cleared if signal is true
; Bit 0 - Joystick 1 is up
; Bit 1 - Joystick 1 is down
; Bit 2 - Joystick 1 is left
; Bit 3 - Joystick 1 is right
; Bit 4 - Joystick 2 is up
; Bit 5 - Joystick 2 is down
; Bit 6 - Joystick 2 is left
; Bit 7 - Joystick 2 is right

JD_PSG_LATCH .equ #0x088
JD_PSG_READ  .equ #0x090

    LD A,#0x0E

Q5: ok but answer A4 is for joysticks, what about cursor keys?
A5: there is a CHSNS BIOS call to check if a key is pressed or not. I don't
know if we can be reasonably sure that cursor keys and spacebar have the
same row and bit-column across SVI models.

Q6: is it easy to write a ROM game for the SVI-318?
A6: no, because the SVI bank switching I/O is more primitive than
MSX. You only have two 32KB banks, the upper at #0x8000 and the lower at
#0x0000. So you can't load your ROM at #0x4000 and use the
BIOS at #0x0000, you are forced to use a procedure P that does:

- bank-switch to see BIOS
- invoke the BIOS call
- bank-switch back to your ROM

Additionally, the procedure P must be located in a bank that isn't
going to be switched off in the middle of its execution, so you are
forced to relocate procedure P in the upper block (RAM).

In my port I chose to invoke BIOS by bank switching, but it's definitely
NOT comfortable.

Alternative solution 1: you can write all the I/O you need and forget
about bank switching, like the ROMTemplate available at Electric Adventures site,
but I don't know how uniform the Spectravideo hardware is.

Alternative solution 2: if your game is really small and all code+data+stack
can fit in 16KB of RAM, you could relocate all your code from ROM to RAM,
bank-switch to have the BIOS bank available and forget about the ROM.


By Grauw

Ascended (10821)

Grauw さんの画像

13-02-2015, 01:32

I have no value to add, but it is interesting to read Smile.

By andrear1979

Expert (98)

andrear1979 さんの画像

13-02-2015, 02:45

PS: a word of caution; readers, please don't take my answers for granted (example: for A2 and A3 I'm highly uncertain and looking for confirms Running Naked in a Field of Flowers ). Also consider that I'm talking about SVI-318 or 328 (pre-MSX), not 728 (regular MSX). Sorry that I can't edit the topic title oO .

By RetroTechie

Paragon (1563)

RetroTechie さんの画像

13-02-2015, 03:19

I'd think that a schematic of either of the non-MSX compatible SVI's should clear up anything you need to know... Big smile

If you have the same TMS9918 (or compatible) VDP, then all you need to know is which I/O ports it's on, and how much VRAM is available. That would also give you the answer for A2/A3: with same VDP, both systems are graphics-wise capable of the same, only difference is what support the built-in BIOS provides. What the BIOS doesn't provide (on any system), you will have to code yourself - most likely in assembler.

For joysticks, keyboard, sound etc its a similar story. If you're coding for different systems, then it's best to somehow use a variable to set the I/O addresses through which you access the various chips. Perhaps a constant that's referenced in many places in the assembler source. Assemble -> code for MSX. Change a few constants here & there, assemble -> code for SVI.

Or perhaps the same code, that does some 'auto-detect magic' to figure out on what system it's running (and adapts accordingly). Judging from description above, I suspect it's easier to start with a SVI program (keeping MSX memory layout in mind), and see what changes are needed to make it run on MSX. Easier than MSX -> SVI, that is... Smile

By gdx

Enlighted (6445)

gdx さんの画像

13-02-2015, 13:35

Most main components of the SVI-318 are the same as those of the MSX but the system is quite different.

By MäSäXi

Paragon (1884)

MäSäXi さんの画像

14-02-2015, 10:19

Same here, interesting to read! Smile Never had Spectravideo, but I liked them! Smile

By andrear1979

Expert (98)

andrear1979 さんの画像

14-02-2015, 18:45

Hello again guys,

I published my SVI-318/SVI-328 port of I.N.E.R.T.I.A. (ROM, manual, C sources, makefile) on my website.

Seems to work without spectacular bugs, but as said the code (especially the C-to-ASM interfacing parts) is crappy and fragile. Don't follow bad examples. :BA:

Since it's not really MSX stuff I don't think it deserves a news entry on, but I notified the owner of this SVI page and of this other SVI-and-more page, that should be enough to reach the SVI users wishing to give the game a run.

By tcruise

Master (135)

tcruise さんの画像

15-02-2015, 12:54

The original Spectravideo machines are all completely compatible ROM and hardware wise, bar the 318 models only have 16k of Ram (located in the upper half of the Ram bank).
They are the machine the MSX standard was created from with some minor, but important changes made to the final MSX standard. The main thing being the expanded memory mapping and bank switching capabilities and of course the next version of ROM and Basic.
The bank switching limitations are why I wrote my template to not use any BIOS routines, yes it requires a bit more code, but I have never been a big user of the BIOS for either machine anyway.