Jump to content
IGNORED

How to port a game to CV?


SiRioKD

Recommended Posts

4 hours ago, Pixelboy said:

I'm not sure 100% about the ADAM, I'm just assuming that it works the same as the ColecoVision, since it's always possible that a ColecoVision cartridge will interact with the Coleco BIOS which is expected to be in the first 8K range, regardless if this cart is used on the CV or the ADAM.

 

Yep it just depends what you want selected, but by using Port 7Fh you can select what is in the lower memory from the follow options:

image.thumb.png.31ef752a299fbde4d2e544fc2e12a40d.png

and what is in the upper memory from the following options:

image.png.15cbd73a532419c76ab6395a9f1d0a26.png

of course always ensuring bits 4-7 are left as zero.

Link to comment
Share on other sites

20 hours ago, Pixelboy said:

Yes on the memory being the same between the ADAM and SGM (24K of RAM at the same addressing range) except that the ADAM does not let you replace the first 8K of the Coleco BIOS with regular RAM, and the SGM allows you to do that, if you really need 32K of RAM for your game.

 

Also, the ADAM doesn't have a "sound enhancer" at all, that's strictly a feature of the SGM. That's why an SGM detection routine usually doesn't just check if 24K of RAM is available, it also has to check the I/O port for the MSX sound chip, to distinguish between the cartridge running on an ADAM or a ColecoVision with an SGM plugged in.

 

Finally, plugging an SGM into the ADAM's expansion port works fine in terms of compatibility and detection (the SGM yields to the ADAM for the RAM, if I remember correctly). However, there's a problem with the sound output where the passthrough of the MSX sound chip through the ADAM and to the TV doesn't work properly (the volume is brought down to almost silence) because the designers of the ADAM never imagined that the expansion port would be used in this way to double the number of sound channels (because yes, it's possible to use the CV's native sound chip and the SGM sound chip in tandem for enhanced sound output).

 

Hi,

do you have a standard detection routines for SGM? Memory is easy to detect but the 8910, how? 

Link to comment
Share on other sites

8 hours ago, Tony Cruise said:

Yep it just depends what you want selected, but by using Port 7Fh you can select what is in the lower memory from the follow options:

image.thumb.png.31ef752a299fbde4d2e544fc2e12a40d.png

and what is in the upper memory from the following options:

image.png.15cbd73a532419c76ab6395a9f1d0a26.png

of course always ensuring bits 4-7 are left as zero.

Nice!

Link to comment
Share on other sites

2 hours ago, SiRioKD said:

Hi,

do you have a standard detection routines for SGM? Memory is easy to detect but the 8910, how? 

My knowledge of the subject is not detailed enough to remember, so I would suggest sending a PM to nanochess on these forums, he's the author of the CoolCV emulator which supports the SGM.

 

Edited by Pixelboy
Link to comment
Share on other sites

So, to run a game that need more RAM (even without AY chip) is enough to test if there is RAM at some expected address simply writing at that address and reading back to check if the value is the one written a moment ago.

In that case we could let the game run (no matter if you write to AY ports if AY isn't present, right?)

Just to do some tests...

Edited by thegeps
Link to comment
Share on other sites

21 hours ago, thegeps said:

So, to run a game that need more RAM (even without AY chip) is enough to test if there is RAM at some expected address simply writing at that address and reading back to check if the value is the one written a moment ago.

In that case we could let the game run (no matter if you write to AY ports if AY isn't present, right?)

Just to do some tests...

;=========================
; Enable SGM Memory
;=========================
ENABLE_SGM_MEMORY:
    XOR A
    LD (MACHINE),A ; By default a machine is a ColecoVision
    ; don't enable SGM memory if we have an Adam
    CALL IS_ADAM
    CP 1
    RET Z
    ; look for the SGM PSG
    CALL PSG_TST
    ; maybe save this somewhere so we know we know what machine we have
    CP 1
    RET NZ
    LD A,2
    LD (MACHINE),A
    ; enable SGM memory
    LD A,00000001bh
    OUT(53h),A
    RET

;=========================
; The presence of RAM between 2000h-5FFFh on boot means we have an Adam
; A = 1 if an Adam, 0 otherwise
;=========================
IS_ADAM:
    ; check for Ram at 2000h-5FFFh
    ; write values to 2000h-20FFh
    LD HL,02000h
    LD B,0FFh
ISA1:
    LD (HL),B
    INC HL
    DJNZ ISA1
    ; now read values back
    LD HL,02000h
    LD B,0FFh
ISA2:
    LD A,(HL)
    CP B
    JP Z, ISA3
    ; not a match so probably ROM
    XOR A
    RET
ISA3:
    INC HL
    DJNZ ISA2
    LD A,1
    LD (MACHINE),A ; for the moment make this machine an Adam
    RET

;=========================
; SGM PSG Ports
;=========================
PSGCTR: EQU 050h
PSGWRT: EQU 051h
PSGRD:  EQU 052h

;=========================
;Check for the existence of a SGM PSG
; A = 1 if found, false otherwise
;=========================
PSG_TST:
    LD HL,5502H
    LD DE,0AA00H
    CALL PSG_SET
    EX DE,HL                ;5502H
    CALL PSG_SET
    EX DE,HL                ;AA00H
    CALL PSG_TST1           ;TEST BYTE
    EX DE,HL                ;5502H
    CALL PSG_TST1           ;TEST BYTE
PSG_TST3:
    ; PSG Found
    LD A,1
    RET

;1st PSG Test
PSG_TST1:
    LD A,E
    OUT (PSGCTR),A
    LD D,D
    IN A,(PSGRD)            ;READ BACK
    CP D
    RET Z                   ;RETURN IF OK
    ;IF PSG NOT FOUND
    POP DE ; Remove return point
    XOR A
    RET

;=========================
; SET SGM PSG
;=========================
PSG_SET:
    LD A,E
    OUT (PSGCTR),A          ;SET PSG REG #0
    LD A,D
    OUT (PSGWRT),A
    RET

 

Call ENABLE_SGM_MEMORY and the memory location MACHINE will contain 0 = No SGM or Adam, 1 = Just Adam, 2 = Coleco with SGM and if 0 or 2 then the SGM memory will be enabled.

 

If you get the result 'Just Adam', then you can call PSG_TST separately to see if you have a SGM plugged into an Adam and thus use the extra sound chip.

  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...