Jump to content
IGNORED

Help with chessboard with venetian blinds


Recommended Posts

Hi everyone.

 

I'm working in a new chessboard for Atomchess but using venetian blinds.

 

My "clever" algorithm shows one line of two pieces in the left side (columns 0 and 2) and then one line of two pieces in the right side (columns 4 and 6).

 

And then in next frame it should show the odd columns.

 

However after reading Stella docs and TIA HW docs I'm still in the dark about why the right side doesn't appear (columns 4-7). Surely I'm overlooking something, so I'm posting here for help :grin:

 

The full code is in a working branch at Github: https://github.com/nanochess/Atomchess-6502/tree/test

 

        sta WSYNC        ; 0
        lda frame        ; 3
        lda frame        ; 6
        lda frame        ; 9
        lsr              ; 14
        ldy #3           ; 12
        bcc ds9          ; 16
        ldy #2           ; 18
ds10:   dey              ; 20/25
        bne ds10
        lda bitmap0      ; 29
        lda bitmap0      ; 32
        sta RESP0        ; 35
        lda bitmap0      ; 38
        sta RESP1        ; 41

ds11:
        ldy board,x      ; 54 Check color for the two pieces
        lda pieces_color,y ; 58
        sta COLUP0       ; 62
        ldy board+1,x    ; 65 Check color for the two pieces
        lda pieces_color,y ; 69
        sta COLUP1       ; 73

        sta WSYNC
        ldy bitmap0      ; 3
        lda pieces,y     ; 6
        sta GRP0         ; 10
        ldy bitmap1      ; 13
        lda pieces,y     ; 22
        sta GRP1         ; 31
        inc bitmap0      ; 34
        inc bitmap1      ; 39
        nop
        sta RESP0        ; 19
        lda bitmap0      ; 26
        sta RESP1        ; 28

        ldy board+4,x    ; 44 Check color for the two pieces
        lda pieces_color,y ; 48
        sta COLUP0        ; 52
        ldy board+5,x      ; 55 Check color for the two pieces
        lda pieces_color,y ; 59
        sta COLUP1         ; 63

        sta WSYNC
        ldy bitmap2        ; 3 
        lda pieces,y       ; 6
        sta GRP0           ; 10
        ldy bitmap3        ; 13
        lda pieces,y       ; 16
        sec                ; 20
        sta GRP1           ; 22
        inc bitmap2        ; 25
        inc bitmap3        ; 30
        sta RESBL          ; 35
        lda bitmap0        ; 38
        sta RESBL          ; 41
        and #7             ; 44
        sbc #7             ; 46
        bne ds11            ; 48 + 3
        jmp ds12

ds9:    sta RESP0        ; 19
        nop              ; 22
        nop              ; 24
        nop              ; 26
        sta RESP1        ; 28

ds3:
        ldy board,x      ; 54 Check color for the two pieces
        lda pieces_color,y ; 58
        sta COLUP0       ; 62
        ldy board+1,x    ; 65 Check color for the two pieces
        lda pieces_color,y ; 69
        sta COLUP1       ; 73

        sta WSYNC
        ldy bitmap0      ; 3
        lda pieces,y     ; 6
        sta GRP0         ; 10
        ldy bitmap1      ; 13
        lda pieces,y     ; 16
        sta GRP1         ; 20
        inc bitmap0      ; 23
        inc bitmap1      ; 28
        nop              ; 33
        ldy board+4,x    ; 35 Check color for the two pieces
        lda pieces_color,y ; 39
        sta COLUP0        ; 43
        nop              ; 46
        sta RESP0        ; 48
        lda bitmap0      ; 51
        sta RESP1        ; 54
        ldy board+5,x      ; 57 Check color for the two pieces
        lda pieces_color,y ; 61
        sta COLUP1         ; 65

        sta WSYNC
        ldy bitmap2        ; 3 
        lda pieces,y       ; 6
        sta GRP0           ; 10
        sta GRP0        ; 13
        ldy bitmap3        ; 16
        sta RESP0          ; 19
        lda pieces,y       ; 22
        sec                ; 26
        sta RESP1          ; 28
        sta GRP1           ; 31
        inc bitmap2        ; 34
        inc bitmap3        ; 39
        tya                ; 44
        and #7             ; 47
        sbc #6             ; 49
        bne ds3            ; 51 + 3
ds12:
        sta WSYNC
        sta ENAM0        ; Disable cursor
        sta WSYNC
        sta WSYNC
        sta WSYNC
Link to comment
Share on other sites

Just solved it in 3 scanlines:

 

1. Setup position with RESP0 and RESP1 (doesn't draw anything)

2. Draw two chesspieces, reposition RESP0 and RESP1 at right (only condition that complies with the independent 160-clock to display limitation)

3. Draw two chesspieces.

 

The pieces look thin but now flickers at 30hz making for a steady display.

 

Code still in the test branch waiting for tests in real hardware https://github.com/nanochess/Atomchess-6502/tree/test

Link to comment
Share on other sites

This flicker is rather noticeable in Stella, even with phosphor mode on (at least on Linux Mint). I'll load it up on my Supercharger tonight and see how it looks on my television.

Maybe your Linux box is overloaded? Enabled phosphor mode in Stella in my Mac and looks even better. I'll be glad to hear of your test in real hardware.

 

post-30245-0-43348200-1499533494_thumb.png

Link to comment
Share on other sites

Maybe your Linux box is overloaded? Enabled phosphor mode in Stella in my Mac and looks even better. I'll be glad to hear of your test in real hardware.

 

Stella refuses to use OpenGL so it's stuck in software rendering mode. I'll try to grab a photo and/or video from my TV tonight.

Link to comment
Share on other sites

On more suggestion, if you can spare the 8 bytes, is to change

if mode = atari 
    echo "Free bytes section 2: ",$fffc-*

    org $fffc
    .word START        ; RESET
    .word START        ; BRK
endif

to

if mode = atari 
    echo "Free bytes section 2: ",$fff4-*

    org $fff4
    .ds 8              ; Bank Switching Hotspots
    .word START        ; RESET
    .word START        ; BRK
endif

This will keep your code from accessing any of the bank switch areas, any problems on unmodified Superchargers or Flash Carts.

Of course, this assumes you can keep the entire ROM below 4k.

Link to comment
Share on other sites

On more suggestion, if you can spare the 8 bytes, is to change

if mode = atari 
    echo "Free bytes section 2: ",$fffc-*

    org $fffc
    .word START        ; RESET
    .word START        ; BRK
endif
to

if mode = atari 
    echo "Free bytes section 2: ",$fff4-*

    org $fff4
    .ds 8              ; Bank Switching Hotspots
    .word START        ; RESET
    .word START        ; BRK
endif
This will keep your code from accessing any of the bank switch areas, any problems on unmodified Superchargers or Flash Carts.

 

Of course, this assumes you can keep the entire ROM below 4k.

 

Not a problem if I extend myself outside 1K, currently I don't have enough bytes to do it and fit 1K.

Link to comment
Share on other sites

On more suggestion, if you can spare the 8 bytes, is to change

if mode = atari 
    echo "Free bytes section 2: ",$fffc-*

    org $fffc
    .word START        ; RESET
    .word START        ; BRK
endif
to

if mode = atari 
    echo "Free bytes section 2: ",$fff4-*

    org $fff4
    .ds 8              ; Bank Switching Hotspots
    .word START        ; RESET
    .word START        ; BRK
endif
This will keep your code from accessing any of the bank switch areas, any problems on unmodified Superchargers or Flash Carts.

 

Of course, this assumes you can keep the entire ROM below 4k.

 

Just added support for Supercharger in Github, probably you will need still to extend it to 2K.

Link to comment
Share on other sites

Today tested it on TV and it's rock solid display :) so I've moved the test branch to the master branch.

 

What kind of television did you test it on?

 

I used a 1990's GE CRT television with a digital tuner and the flicker was terrible. Oddly enough, this same television had a rock stable display when I accidentally ran a PAL game on it (the display just ran off the bottom of the screen).

 

I have at least two more CRT televisions at home that I can test it on, including a color set from the 1960's (if it still works). I'm interested to see how these turn out.

Link to comment
Share on other sites

What kind of television did you test it on?

 

I used a 1990's GE CRT television with a digital tuner and the flicker was terrible. Oddly enough, this same television had a rock stable display when I accidentally ran a PAL game on it (the display just ran off the bottom of the screen).

 

I have at least two more CRT televisions at home that I can test it on, including a color set from the 1960's (if it still works). I'm interested to see how these turn out.

It's a Samsung 3D LCD TV 42"

 

Anyway even if it flickers in your TV is a lot better than the old 15hz flicker. Also just checked with Stella and it has a 262 lines count, so everything looks good.

 

This is the latest binary replicated to 4K, in case you're testing something different.

atomchess4k.bin

Link to comment
Share on other sites

Maybe your Linux box is overloaded? Enabled phosphor mode in Stella in my Mac and looks even better. I'll be glad to hear of your test in real hardware.

 

attachicon.giftoledo_atomchess_6502_f455a84e.png

 

 

phosphor mode's been updated in the 5.0.0-pre builds, it's closer to what you see on a real display so flicker is noticeable even when using phosphor mode, whereas it wouldn't be in an older version of Stella.

Link to comment
Share on other sites

phosphor mode's been updated in the 5.0.0-pre builds, it's closer to what you see on a real display so flicker is noticeable even when using phosphor mode, whereas it wouldn't be in an older version of Stella.

 

I'm using 3.9.3 since that's what's in the Linux Mint 17.3 Rosa repository.

Link to comment
Share on other sites

I'm using Mac OS X, now updated to Stella 4.7.3 some flicker is noticeable in normal mode, then Cmd+P makes it a nice steady display.

Edit: My first time compiling from a Github and it worked just fine! :o the Stella 5.0.0pre shows some flicker even in Cmd+P mode :| , well that's an argument in favour of a real Atari + LCD TV :grin:

Link to comment
Share on other sites

You didn't have to create build for the latest version for OSX; they're available here. But in any event, it's good that you were able to compile it correctly. That means we have things set up correctly and explained on Github.

 

As for the flickering still being present in the 5.0 version, that is intentional. There will be a way to increase the phosphor blend level, to make it flicker less, but the flicker won't be completely removed. This was done to simulate a real TV, since many people were developing in Stella with phosphor mode on, and then finding out about the flicker only when trying on the real thing. IOW, the flicker in Stella 4.x is quite simplistic and forgiving compared to a real TV; what's in the 5.0 version will be much more like the real thing.

Link to comment
Share on other sites

You didn't have to create build for the latest version for OSX; they're available here. But in any event, it's good that you were able to compile it correctly. That means we have things set up correctly and explained on Github.

Yes. It's pretty direct. I was surprised by how so fast it cloned and compiled. :)

 

As for the flickering still being present in the 5.0 version, that is intentional. There will be a way to increase the phosphor blend level, to make it flicker less, but the flicker won't be completely removed. This was done to simulate a real TV, since many people were developing in Stella with phosphor mode on, and then finding out about the flicker only when trying on the real thing. IOW, the flicker in Stella 4.x is quite simplistic and forgiving compared to a real TV; what's in the 5.0 version will be much more like the real thing.

Ok. I see. Thanks for the heads up :)

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...