lucienEn Posted November 26, 2022 Share Posted November 26, 2022 Hi, to better understand how a display is drawn onto the screen with CPU timing, I'm trying to remove first 8 pixels on the left side and output 192 lines (similar to Activision). However code below shows the last line only partially (43 pixels). Any idea why this is broken? Also with the vblank timing it seems you can only start drawing at position 7 or 10 so I wonder if Activision used instead a playfield or did they use a timer instead? What is the typical way to render? Thanks! Lucien Quote processor 6502 include "vcs.h" include "macro.h" SEG ORG $F000 Reset ; set TIA to known state (clear to 0) lda #0 ldx #0 .zapTIA sta 0,x inx cpx #$40 bne .zapTIA newFrame ; Start of vertical blank processing lda #0 sta VBLANK sta COLUBK ; background colour to black ; 3 scanlines of vertical sync signal lda #%00000010 sta VSYNC ; turn ON VSYNC bit 1 sta WSYNC ; wait a scanline sta WSYNC ; another sta WSYNC ; another = 3 lines total lda #0 sta VSYNC ; turn OFF VSYNC bit 1 ; 37 scanlines of vertical blank ldx #0 vBlank sta WSYNC inx cpx #37 bne vBlank ; 192 scanlines of picture ldx #10 doPicture sta WSYNC ; wait to the start of the next scanline sta COLUBK ; black for first 10 pixels due to display bug ; 68 + 8 pixels = 76 / 3 = 25.33 CPU cycles ; skip 68 clock counts = 22.67 CPU cycles REPEAT 10 nop ; 3+20 cycles REPEND ; 160 pixels = 53.33 cpu cycles stx COLUBK ; put a colour in the background inx cpx #202 ; CA bne doPicture lda #0 sta COLUBK ; remaining background to black ; 30 lines of overscan ldx #0 doOverscan sta WSYNC ; wait a scanline inx cpx #30 bne doOverscan jmp newFrame ;----------------------------------------------------------------------------------- ; the CPU reset vectors ORG $FFFA .word Reset ; NMI .word Reset ; RESET .word Reset ; IRQ END Quote Link to comment Share on other sites More sharing options...
lucienEn Posted November 26, 2022 Author Share Posted November 26, 2022 Actually see now I simply are missing WSYNC before I set it to black. I still wonder what the best pattern is to draw the screen and remove the first 8 pixels on the left? Is it timer based? sta WSYNC ; wait to the start of the next scanline lda #0 sta COLUBK ; remaining background to black Quote Link to comment Share on other sites More sharing options...
lucienEn Posted November 26, 2022 Author Share Posted November 26, 2022 (edited) One thing to add for anyone else learning how TIA timing works, in Stella you can see exactly the position when entering the debugger (key `) and then check 'Scn Ln' & 'Pixel Pos' on top. When you step through the code you also see small white dot moving on the mini screen (I wish you could make that upper left window bigger). Still wonder what is the best pattern to mask the first 8 pixels on the left and how for example Pitfall! did this. Edited November 26, 2022 by lucienEn Quote Link to comment Share on other sites More sharing options...
SeaGtGruff Posted August 8 Share Posted August 8 Not sure why no one ever answered, as it's well known. This was done by strobing the HMOVE register on every scan line. Normally, when you strobe HMOVE to shift the players, missiles, and ball to the left or right by whatever values you've indicated for each of them, you get a black line 8 pixels long at the beginning of that scan line. In games where HMOVE was strobed only on specific lines because of the way the game screen was divided up into horizontal bands or zones, you can see a "comb" of these black lines along the left edge of the screen. What Activision decided to do was strobe HMOVE on every scan line so this "comb" effect wasn't apparent, since those black lines are on every scan line instead of on only some of the scan lines. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.