zilog_z80a Posted March 1, 2018 Share Posted March 1, 2018 (edited) Hi, this is a humble post to know where is the correct place to put in code our constants, i found this code (below) time ago... and i think that constant data should go after ORG $F000 Please can somebody correct me if i'm not right? cheers!! ty in advance. processor 6502 include "vcs.h" include "macro.h" SPRITE_HEIGHT0 equ 37 Joy0Right equ 128 Joy0Left equ 64 Joy0Down equ 32 Joy0Up equ 16 SEG.U RAM ORG $80 Player0X ds 1 Player0Y ds 1 Player0PTR ds 2 time_of_jump ds 1 SEG ROM ORG $F000Reset CLEAN_START lda #%00001000 sta REFP0 ;SHALA LALALALALALA....... FOO FOO FOO.... TONS OF CODE FROM HERE.... YEH! Edited March 2, 2018 by zilog_z80a Quote Link to comment Share on other sites More sharing options...
RevEng Posted March 2, 2018 Share Posted March 2, 2018 Functionally, it doesn't really matter where they go, since the generated code will be the same. Ideally you'll place them prior to being referenced, to save the assembler a pass. Aesthetically, I tend to gather them all at the top, just before or after the RAM definitions. It works better for me to have most symbol definitions in one place, so I know immediately where to go to change them. (the exception being labels, of coure.) If some symbols are very local in scope, I might consider placing their definition close to where they're used, though truthfully I can't recall having done so. In a similar vein, just above any semi-complex routine that uses temp memory locations, I'll redefine a symbol for temp locations to give them more meaningful names. e.g. "deltax = temp3" 3 Quote Link to comment Share on other sites More sharing options...
zilog_z80a Posted March 2, 2018 Author Share Posted March 2, 2018 Functionally, it doesn't really matter where they go, since the generated code will be the same. Ideally you'll place them prior to being referenced, to save the assembler a pass. Aesthetically, I tend to gather them all at the top, just before or after the RAM definitions. It works better for me to have most symbol definitions in one place, so I know immediately where to go to change them. (the exception being labels, of coure.) If some symbols are very local in scope, I might consider placing their definition close to where they're used, though truthfully I can't recall having done so. In a similar vein, just above any semi-complex routine that uses temp memory locations, I'll redefine a symbol for temp locations to give them more meaningful names. e.g. "deltax = temp3" tnx RevEng, this text now is a reference and a guide for me, and tnx for your time to write and explain. cheers!! 1 Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted March 2, 2018 Share Posted March 2, 2018 A good idea is also to separate game specific constants (e.g. SPRITE_HEIGHT) which may change and general Atari 2600 constants (e.g. Joy0Right), which have a fixed value. Also it is a best practice to use all UPPER_CASE for constants (BTW: GRP0, HMOVE etc. are all just general Atari 2600 constants too). 3 Quote Link to comment Share on other sites More sharing options...
zilog_z80a Posted March 2, 2018 Author Share Posted March 2, 2018 A good idea is also to separate game specific constants (e.g. SPRITE_HEIGHT) which may change and general Atari 2600 constants (e.g. Joy0Right), which have a fixed value. Also it is a best practice to use all UPPER_CASE for constants (BTW: GRP0, HMOVE etc. are all just general Atari 2600 constants too). ty Thomas, great, always wanted to know about constants spots and all related, will take note about this too. if somebody else wants to add something about constants is really really welcome. cheers! 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.