Jump to content
IGNORED

Where am I missing in the source code when converting to PAL60?


alfredtdk

Recommended Posts

I am using all the variable constants from the color table similar to the PAL60 standard.
I had already removed the underlined lines if they were interfering with the conversion, but to no avail.
Below is the source code.

 

 
rem  variable constants from the color table for the PAL60 standard system
 
const _00 = $00
const _02 = $02
const _04 = $04
const _06 = $06
const _08 = $08
const _0A = $0A
const _0C = $0C
const _0E = $0E
const _10 = $20
const _12 = $22
const _14 = $24
const _16 = $26
const _18 = $28
const _1A = $2A
const _1C = $2C
const _1E = $2E
const _20 = $20
const _22 = $22
const _24 = $24
const _26 = $26
const _28 = $28
const _2A = $2A
const _2C = $2C
const _2E = $2E
const _30 = $40
const _32 = $42
const _34 = $44
const _36 = $46
const _38 = $48
const _3A = $4A
const _3C = $4C
const _3E = $4E
const _40 = $60
const _42 = $62
const _44 = $64
const _46 = $66
const _48 = $68
const _4A = $6A
const _4C = $6C
const _4E = $6E
const _50 = $80
const _52 = $82
const _54 = $84
const _56 = $86
const _58 = $88
const _5A = $8A
const _5C = $8C
const _5E = $8E
const _60 = $A0
const _62 = $A2
const _64 = $A4
const _66 = $A6
const _68 = $A8
const _6A = $AA
const _6C = $AC
const _6E = $AE
const _70 = $C0
const _72 = $C2
const _74 = $C4
const _76 = $C6
const _78 = $C8
const _7A = $CA
const _7C= $CC
const _7E = $CE
const _80 = $D0
const _82 = $D2
const _84 = $D4
const _86 = $D6
const _88 = $D8
const _8A = $DA
const _8C = $DC
const _8E = $DE
const _90 = $B0
const _92 = $B2
const _94 = $B4
const _96 = $B6
const _98 = $B8
const _9A = $BA
const _9C = $BC
const _9E = $BE
const _A0 = $90
const _A2 = $92
const _A4 = $94
const _A6 = $96
const _A8 = $98
const _AA = $9A
const _AC = $9C
const _AE = $9E
const _B0 = $70
const _B2 = $72
const _B4 = $74
const _B6 = $76
const _B8 = $78
const _BA = $7A
const _BC= $7C
const _BE = $7E
const _C0 = $50
const _C2 = $52
const _C4 = $54
const _C6 = $56
const _C8 = $58
const _CA = $5A
const _CC = $5C
const _CE = $5E
const _D0 = $30
const _D2 = $32
const _D4 = $34
const _D6 = $36
const _D8 = $38
const _DA= $3A
const _DC= $3C
const _DE= $3E
const _E0 = $20
const _E2 = $22
const _E4 = $24
const _E6 = $26
const _E8 = $28
const _EA = $2A
const _EC = $2C
const _EE = $2E
const _F0 = $20
const _F2 = $22
const _F4 = $24
const _F6 = $26
const _F8 = $28
const _FA = $2A
const _FC= $2C
const _FE = $2E

main

SB_RB.bas

Link to comment
Share on other sites

I see that you defined all of these constants, but I don't see anywhere where you make use of them in your code. I don't think this is probably the easiest approach to making a pal60 version, anyway. A better approach might be to use two sets of constants with color names, one for NTSC, and one for PAL60. When compiling, comment out the set that you aren't using to compile the appropriate version. Let me know if you would like an example. 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Posted (edited)
2 hours ago, Karl G said:

I see that you defined all of these constants, but I don't see anywhere where you make use of them in your code. I don't think this is probably the easiest approach to making a pal60 version, anyway. A better approach might be to use two sets of constants with color names, one for NTSC, and one for PAL60. When compiling, comment out the set that you aren't using to compile the appropriate version. Let me know if you would like an example. 

Yes,. This would certainly help me and also others who will come to learn.

Edited by alfredtdk
Link to comment
Share on other sites

9 hours ago, Karl G said:

I see that you defined all of these constants, but I don't see anywhere where you make use of them in your code. I don't think this is probably the easiest approach to making a pal60 version, anyway. A better approach might be to use two sets of constants with color names, one for NTSC, and one for PAL60. When compiling, comment out the set that you aren't using to compile the appropriate version. Let me know if you would like an example. 

 

Have you seen this?

 

https://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html#color_constants_ntsc_pal60

Link to comment
Share on other sites

Okay, this is a very simple example of how I do PAL vs NTSC colors in a bB project. I use descriptive color names like "mountain_color" and "flower_color", and use these contants in my code instead of setting colors by number. At the top I have two sets of these constants with the same names: one set for NTSC colors, and one set for PAL colors. I uncomment the version I am compiling for, and comment the other set. In the code below, the NTSC color constants are uncommented, and the PAL ones are commented, so it will build with NTSC colors. If you reverse those, then it will compile with PAL colors.

 

palntsc.bas

  • Like 2
Link to comment
Share on other sites

@Karl G  That's pretty much my strategy.  Except I have constants for each color as opposed to drilling down to the game object itself.

 

In an NTSC game I can cut-and-paste NTSC colors:

 

rem //** NTSC Colors **//
 const _orange = $3A

 

If I need a PAL60 game I can replace that with PAL60 colors:

 

rem //** PAL Colors **//
 const _orange = $46

 

The advantage being I do not have to change any code besides the color constants to make a PAL60 game.

  • Like 1
Link to comment
Share on other sites

2 hours ago, Karl G said:

That was what the OP was referencing in the first post. Those constants are defined but not used in the code, however.

 

I meant once you scroll down past the constants, it says this:

 

If you already have NTSC or PAL-60 colors in your game without using constants, all you have to do is replace the dollar sign with an underscore, but make sure you only do that to colors, not things like CTRLPF and NUSIZ.

 

So this:

COLUPF = $2C

 

becomes this:

COLUPF = _2C

 

And this:

   player1color:
   $06
   $04
   $08
   $0A
   $0C
end

 

becomes this:

   player1color:
   _06
   _04
   _08
   _0A
   _0C
end

 

  • Like 1
Link to comment
Share on other sites

To provide another example, in my games (in assembly), this is how I handle colors.  I have a flag (NTSC or PAL60) where whichever format I want to activate I set to 1, and the other to 0 (assuming all of this is being compiled in DASM):

 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Define constants
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
NTSC = 1
PAL60 = 0

 

Then, when I'm defining constants I have some IF statements that will define the colors according to a label (in this case DARK_GREEN_COLOR or RED_COLOR)

 IF NTSC
    DARK_GREEN_COLOR =  #$D6
    RED_COLOR = #$44

  ENDIF

  IF PAL60
    DARK_GREEN_COLOR = #$58
    RED_COLOR = #$66

  ENDIF

 

Then in the actual code I use the associated label to set the colors.  When it is compiled for NTSC it will use my NTSC colors, and when it uses PAL60 it will use PAL60 colors.

  lda #RED_COLOR
  sta COLUPF



  lda #DARK_GREEN_COLOR

  sta COLUP0

 

 In some cases I want to have the color be set in a variable so that I can manipulate the color further.  So I could have a memory (ds 1) variable named PlayerColor which I modify similar to the following:

lda #RED_COLOR

sta PlayerColor

 

... some other code here ...

; Modifies the color by subtracting 2 and storing it in the same variable

lda PlayerColor    

sec

sbc #2  ; (Will make for a slightly different color of red)

sta PlayerColor

 

... some other code here ..

; Takes the final player color value and assigns it

lda PlayerColor

sta COLUP0

 

 

  • Like 1
Link to comment
Share on other sites

21 minutes ago, littaum said:

To provide another example, in my games (in assembly), this is how I handle colors.  I have a flag (NTSC or PAL60) where whichever format I want to activate I set to 1, and the other to 0 (assuming all of this is being compiled in DASM):

That's how I do it for assembly projects as well, but batari Basic doesn't have conditional compilation like that. It's possible to do it with inline assembly, though.

Link to comment
Share on other sites

1942 uses an external assembly file to define generic color constants for both PAL and NTSC with an IF/ELSE/ENDIF construct.  Doing so allows a const flag to choose between the two sets.  Then, within the 1942 bB source file, color-named constants are defined that utilize those external color constants, with a simple 'const IS_NTSC = 0/1' being used to choose between the two color sets.

 

  • Like 1
Link to comment
Share on other sites

From 1942 source code:

 

   ; TV mode. IS_NTSC = 0 for PAL colors
   const IS_NTSC = 1

   ; Color constants are defined in external ASM file
   inline NTSC_PAL_colors.asm

   ; To use the ASM defined colors in bB assignments they have to be redefined,
   ; otherwise bB is using the ZP memory instead!
   const _Color_Ocean               = _96
   const _Color_Carrier             = _04
   const _Color_Gras_Island         = _C8
   const _Color_Sand_Island         = _EE
   const _Color_Jungle_Island       = _C6
   const _Color_Titlescreen_BG      = _00
   const _Color_Player_Plane_Base   = _2A
   const _Color_Player_Plane_Bottom = _26
   const _Color_Score               = _9E
   const _Color_Player_Bullet       = _40

 

ADDENDUM:  Here's the assembly file:

NTSC_PAL_colors.asm

  • Like 1
  • Thanks 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...
  • Recently Browsing   0 members

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