Jump to content
IGNORED

Master of Lamps Graphics technique?


zzip
 Share

Recommended Posts

So this game puts manages to put at least 11 colors on a scanline at 160 pixel mode, so GTIA modes weren't used.

 

I've long tried to figure out what technique they are using to get so many colors on the gongs. (see attached screenshot). Each gong is 12 pixels wide, so they couldn't have used players and missiles to make some gongs, and there's no flicker, so they didn't cheat that way.

 

If I was to guess, I would say they are using Antic mode 4, which would give 5 playfield colors, and they have some interrupt running mid screen, counting cycles? Is it doable to change the entire palette mid-line like that? How much overhead would it add? I've tried writing such an interrupt of that type back in the day, but I could never get it stablized

post-50533-0-81920900-1485742882_thumb.png

Link to comment
Share on other sites

On the scanlines with the gongs, the game does eight color changes, some of them mid-line. Basically each color register swaps back and forth between two different colors every scanline.

You can see this in Altirra by launching the debugger and then typing "gs 200" to stop at scanline 200. Then type "h 40" to see some code execution history. That yields this:

     46) T=14765|197, 76 A=74 X=02 Y=58 S=F9 P=31 (     C) 5F0C: 8D 0A D4  L5F0C   STA WSYNC    [$D40A]
     45) T=14765|197,105 A=74 X=02 Y=58 S=F9 P=31 (     C) 5F0F: A9 36             LDA #$36
     44) T=14765|197,107 A=36 X=02 Y=58 S=F9 P=31 (     C) 5F11: 8D 16 D0          STA COLPF0   [$D016]
     43) T=14765|197,111 A=36 X=02 Y=58 S=F9 P=31 (     C) 5F14: A9 28             LDA #$28
     42) T=14765|197,113 A=28 X=02 Y=58 S=F9 P=31 (     C) 5F16: 8D 17 D0          STA COLPF1   [$D017]
     41) T=14765|198,  8 A=28 X=02 Y=58 S=F9 P=31 (     C) 5F19: A9 1C             LDA #$1C
     40) T=14765|198, 10 A=1C X=02 Y=58 S=F9 P=31 (     C) 5F1B: 8D 18 D0          STA COLPF2   [$D018]
     39) T=14765|198, 14 A=1C X=02 Y=58 S=F9 P=31 (     C) 5F1E: A9 CC             LDA #$CC
     38) T=14765|198, 16 A=CC X=02 Y=58 S=F9 P=B1 (N    C) 5F20: 8D 19 D0          STA COLPF3   [$D019]
     37) T=14765|198, 20 A=CC X=02 Y=58 S=F9 P=B1 (N    C) 5F23: EA                NOP
     36) T=14765|198, 23 A=CC X=02 Y=58 S=F9 P=B1 (N    C) 5F24: EA                NOP
     35) T=14765|198, 27 A=CC X=02 Y=58 S=F9 P=B1 (N    C) 5F25: EA                NOP
     34) T=14765|198, 31 A=CC X=02 Y=58 S=F9 P=B1 (N    C) 5F26: A9 C6             LDA #$C6
     33) T=14765|198, 35 A=C6 X=02 Y=58 S=F9 P=B1 (N    C) 5F28: 8D 16 D0          STA COLPF0   [$D016]
     32) T=14765|198, 43 A=C6 X=02 Y=58 S=F9 P=B1 (N    C) 5F2B: A9 9C             LDA #$9C
     31) T=14765|198, 47 A=9C X=02 Y=58 S=F9 P=B1 (N    C) 5F2D: 8D 17 D0          STA COLPF1   [$D017]
     30) T=14765|198, 55 A=9C X=02 Y=58 S=F9 P=B1 (N    C) 5F30: A9 74             LDA #$74
     29) T=14765|198, 59 A=74 X=02 Y=58 S=F9 P=31 (     C) 5F32: 8D 18 D0          STA COLPF2   [$D018]
     28) T=14765|198, 64 A=74 X=02 Y=58 S=F9 P=31 (     C) 5F35: 8C 19 D0          STY COLPF3   [$D019]
     27) T=14765|198, 70 A=74 X=02 Y=58 S=F9 P=31 (     C) 5F38: CA                DEX
     26) T=14765|198, 72 A=74 X=01 Y=58 S=F9 P=31 (     C) 5F39: 10 D1             BPL $5F0C
     25) T=14765|198, 76 A=74 X=01 Y=58 S=F9 P=31 (     C) 5F0C: 8D 0A D4  L5F0C   STA WSYNC    [$D40A]

The player and the posts on the right and left are rendered with PMGs. Hit Ctrl-F8 to see this. Ctrl-F8 also shows you that the gongs are the four playfield colors which hints at the fact that it's rendered in ANTIC mode 6 (BASIC mode 1), i.e. a color character mode. So you get COLBAK and COLPF0-3. The playfield that's used for "1" bits in the character set is determined by the top two bits of the character. The "0" bits are rendered with COLBAK.

  • Like 4
Link to comment
Share on other sites

Another visualization technique is to type "e CHBASE e0". This swaps in the default character set so you can get a feel for how the screen is laid out. This also reveals that the player is actually partially rendered in ANTIC mode 2 (BASIC mode 0), i.e. hi-res character mode.

 

Another observation is that the scanline kernel omits the NOPs on badlines, i.e. the first lines of a character where the character data is fetched.

  • Like 1
Link to comment
Share on other sites

About "Gr.1 and Gr. 2" depending on their nice effect to save a lot of CPU time, they were often used for Basic games.

 

 

 

Using them in their limits o 64 Bytes, one could do a screen , using one charset every charmode line, you could do very interesting effects, creating a bitmap screen with interchangable colour blocks. Possibly the best mode for some Ego shooter. The non linear mode may cost some additional CPU cycles, but the mode will save even more, for "3d" calculations.

Link to comment
Share on other sites

On the scanlines with the gongs, the game does eight color changes, some of them mid-line. Basically each color register swaps back and forth between two different colors every scanline.

 

You can see this in Altirra by launching the debugger and then typing "gs 200" to stop at scanline 200. Then type "h 40" to see some code execution history. That yields this:

 

     46) T=14765|197, 76 A=74 X=02 Y=58 S=F9 P=31 (     C) 5F0C: 8D 0A D4  L5F0C   STA WSYNC    [$D40A]
     45) T=14765|197,105 A=74 X=02 Y=58 S=F9 P=31 (     C) 5F0F: A9 36             LDA #$36
     44) T=14765|197,107 A=36 X=02 Y=58 S=F9 P=31 (     C) 5F11: 8D 16 D0          STA COLPF0   [$D016]
     43) T=14765|197,111 A=36 X=02 Y=58 S=F9 P=31 (     C) 5F14: A9 28             LDA #$28
     42) T=14765|197,113 A=28 X=02 Y=58 S=F9 P=31 (     C) 5F16: 8D 17 D0          STA COLPF1   [$D017]
     41) T=14765|198,  8 A=28 X=02 Y=58 S=F9 P=31 (     C) 5F19: A9 1C             LDA #$1C
     40) T=14765|198, 10 A=1C X=02 Y=58 S=F9 P=31 (     C) 5F1B: 8D 18 D0          STA COLPF2   [$D018]
     39) T=14765|198, 14 A=1C X=02 Y=58 S=F9 P=31 (     C) 5F1E: A9 CC             LDA #$CC
     38) T=14765|198, 16 A=CC X=02 Y=58 S=F9 P=B1 (N    C) 5F20: 8D 19 D0          STA COLPF3   [$D019]
     37) T=14765|198, 20 A=CC X=02 Y=58 S=F9 P=B1 (N    C) 5F23: EA                NOP
     36) T=14765|198, 23 A=CC X=02 Y=58 S=F9 P=B1 (N    C) 5F24: EA                NOP
     35) T=14765|198, 27 A=CC X=02 Y=58 S=F9 P=B1 (N    C) 5F25: EA                NOP
     34) T=14765|198, 31 A=CC X=02 Y=58 S=F9 P=B1 (N    C) 5F26: A9 C6             LDA #$C6
     33) T=14765|198, 35 A=C6 X=02 Y=58 S=F9 P=B1 (N    C) 5F28: 8D 16 D0          STA COLPF0   [$D016]
     32) T=14765|198, 43 A=C6 X=02 Y=58 S=F9 P=B1 (N    C) 5F2B: A9 9C             LDA #$9C
     31) T=14765|198, 47 A=9C X=02 Y=58 S=F9 P=B1 (N    C) 5F2D: 8D 17 D0          STA COLPF1   [$D017]
     30) T=14765|198, 55 A=9C X=02 Y=58 S=F9 P=B1 (N    C) 5F30: A9 74             LDA #$74
     29) T=14765|198, 59 A=74 X=02 Y=58 S=F9 P=31 (     C) 5F32: 8D 18 D0          STA COLPF2   [$D018]
     28) T=14765|198, 64 A=74 X=02 Y=58 S=F9 P=31 (     C) 5F35: 8C 19 D0          STY COLPF3   [$D019]
     27) T=14765|198, 70 A=74 X=02 Y=58 S=F9 P=31 (     C) 5F38: CA                DEX
     26) T=14765|198, 72 A=74 X=01 Y=58 S=F9 P=31 (     C) 5F39: 10 D1             BPL $5F0C
     25) T=14765|198, 76 A=74 X=01 Y=58 S=F9 P=31 (     C) 5F0C: 8D 0A D4  L5F0C   STA WSYNC    [$D40A]

The player and the posts on the right and left are rendered with PMGs. Hit Ctrl-F8 to see this. Ctrl-F8 also shows you that the gongs are the four playfield colors which hints at the fact that it's rendered in ANTIC mode 6 (BASIC mode 1), i.e. a color character mode. So you get COLBAK and COLPF0-3. The playfield that's used for "1" bits in the character set is determined by the top two bits of the character. The "0" bits are rendered with COLBAK.

 

Cool, so I was close! I thought it was using the multi-color text mode instead of the gr.1, but that makes sense too since the gongs are a single color. I didn't expect the posts to be missiles though.

 

Thanks

Link to comment
Share on other sites

  • 2 weeks later...

The game that I always confuse this with, "Black Lamp" also uses something similar in its inventory screen to bring about a lot of colours.

@Snicklin: It's nothing special like mid-scanline PFs colour changings in Master Lamp.

It's the 3PFs + BAK:

-> BAK: (0C) light white;

-> PF0 / PF1 / PF2: dark brown (14) / black (00) / light middle brown (18);

Each line of lamps uses (from left to right): P0 / P1 / P2 then DLI for the next line in the same way.

As you can see from this Altirra debugging you have on the right side three lamps (P0 / P1 / P2 sets their lamps main colour and inside is light middle brown and light gray that are PFs) and when you got one with the right colour it goes to the left side panel and erases the one at the right side so it just moves that correspondant PLAYER to other xPos:

post-6517-0-60164200-1486857580_thumb.png

:thumbsup:

 

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