Jump to content
IGNORED

AtariVox odd sounds when reading/writing to SaveKey area


johnnywc
 Share

Recommended Posts

Hello all,

 

I'm adding high score support to a game I am finishing up and I'm experiencing some odd behavior with the AtariVox when saving/loading the high scores. In short, when I write/read the scores from the AtariVox, it makes random speech and soundFX noises. Oddly enough, the saves/writes are working without issue.

 

Has anyone experienced this before? I tried this with a SaveKey test app I found somewhere on AA and it does the same thing, so I'm pretty sure it's not something specific I'm doing in my game. It is using v2.2 of i2c subroutines (optimized for space by Thomas J.).

 

I've attached the test app source; any help is greatly appreciated!

 

Thanks,

John

savekey_test.zip

Link to comment
Share on other sites

Did you test with the original i2c.inc file?

I finally got around to testing it with the original i2c.inc and it does *not* make the weird noises. Unfortunately I could really use the 64 bytes saved with the 2.2 version. :)

 

Here is an updated test program; set I2C_VERSION to 1 to use the original i2c.inc; any other value will use i2c_v2.2.inc.

 

Thanks,

John

savekey_test.zip

Edited by johnnywc
Link to comment
Share on other sites

I checked my mail with Alex from 10 years ago.

 

Oh, hang on, I've just seen what you've done in I2C_TXBIT:

 

lda #$00

sta SWCHA

adc #%1011

sta SWACNT

 

This is bad! When the carry flag is clear, %1011 will be written to SWACNT

which will also set pins 1 and 2 to Output 0 (low). When the carry flag is

set, %1100 is written to SWACNT, setting pins 1 and 2 to input mode (high).

We really don't want to be putting that sort of noise on the SpeakJet's data

line.

 

This should probably be ok though:

 

lda #%0011

sta SWCHA

adc #%1000

sta SWACNT

 

This should write the same values to SWACNT as your code, but it will also

set the lower 2 bits of SWCHA. What this means is, when the carry flag is

clear, pins 1 and 2 will get set to output 1 (high). When carry is set,

pins 1 and 2 are set to input mode (high). So, the SpeakJet will not see

any state changes on it's data line.

Maybe this fix was not sufficient, so please try this:

  MAC     I2C_TXBIT
; I2C_SCL_0
;    lda     #%0011                          ; 2
    lda     #$0                             ; 2
    sta     SWCHA                           ; 4
; set bit
;    adc     #%1000                          ; 2
    lda     #I2C_SCL_MASK >> 3              ; 2         = 1
    rol                                     ; 2
    asl                                     ; 2
    asl                                     ; 2
    sta     SWACNT                          ; 4         SDA = !C (a = %1000 / %1100)
; I2C_SCL_1
    lda     #I2C_SCL_MASK                   ; 2
    sta     SWCHA                           ; 4
; total: 18+6 cycles
  ENDM
Finger crossed!
Link to comment
Share on other sites

I checked my mail with Alex from 10 years ago.

 

Maybe this fix was not sufficient, so please try this:

  MAC     I2C_TXBIT
; I2C_SCL_0
;    lda     #%0011                          ; 2
    lda     #$0                             ; 2
    sta     SWCHA                           ; 4
; set bit
;    adc     #%1000                          ; 2
    lda     #I2C_SCL_MASK >> 3              ; 2         = 1
    rol                                     ; 2
    asl                                     ; 2
    asl                                     ; 2
    sta     SWACNT                          ; 4         SDA = !C (a = %1000 / %1100)
; I2C_SCL_1
    lda     #I2C_SCL_MASK                   ; 2
    sta     SWCHA                           ; 4
; total: 18+6 cycles
  ENDM
Finger crossed!

 

Hi TJ!

 

First the good news: it does work and the random noise is no longer played when transmitting a bit to the SaveKey

The bad news: The extra 6 cycles is causing screen rolls (most likely because I was originally trying to transfer up to 2 bytes per frame). I'll need to modify my code to transmit only 1 byte a frame which shouldn't be too difficult.

 

 

 

Thanks!

John

Edited by johnnywc
Link to comment
Share on other sites

Good news! icon_smile.gif

 

I think I can save 2 cycles:

  MAC     I2C_TXBIT
; I2C_SCL_0
;    lda     #%0011                          ; 2
    lda     #$0                             ; 2
    sta     SWCHA                           ; 4
; set bit
;;    adc     #%1000                          ; 2
;    lda     #I2C_SCL_MASK >> 3              ; 2
;    rol                                     ; 2
;    asl                                     ; 2
;    asl                                     ; 2
    adc     #I2C_SCL_MASK >> 2              ; 2         %10 / %11
    asl                                     ; 2
    asl                                     ; 2
    sta     SWACNT                          ; 4         SDA = !C (a = %1000 / %1100)
; I2C_SCL_1
    lda     #I2C_SCL_MASK                   ; 2
    sta     SWCHA                           ; 4
; total: 18+4 cycles
  ENDM
So only 4 extra cycles/bit instead of 6.
Link to comment
Share on other sites

Good news! icon_smile.gif

 

I think I can save 2 cycles:

  MAC     I2C_TXBIT
; I2C_SCL_0
;    lda     #%0011                          ; 2
    lda     #$0                             ; 2
    sta     SWCHA                           ; 4
; set bit
;;    adc     #%1000                          ; 2
;    lda     #I2C_SCL_MASK >> 3              ; 2
;    rol                                     ; 2
;    asl                                     ; 2
;    asl                                     ; 2
    adc     #I2C_SCL_MASK >> 2              ; 2         %10 / %11
    asl                                     ; 2
    asl                                     ; 2
    sta     SWACNT                          ; 4         SDA = !C (a = %1000 / %1100)
; I2C_SCL_1
    lda     #I2C_SCL_MASK                   ; 2
    sta     SWCHA                           ; 4
; total: 18+4 cycles
  ENDM
So only 4 extra cycles/bit instead of 6.

 

Excellent! That was just enough to allow me to transfer 2 bytes per frame so now I don't have to refactor my code. :)

 

Here is the updated i2c_v2.3.inc:

i2c_v2.3.inc

  • Like 1
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...
 Share

  • Recently Browsing   0 members

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