kamakazi Posted August 5, 2008 Share Posted August 5, 2008 Hey guys! I was going over Andrew's lessons while also entering code in documents given to me for development purposes. The code sounded simple and interesting while actually using less lines of code to accomplish a color cycling task. However, considering that this code was written a long time ago, I need help in cross referencing to today's way. Here's the area's I'm having trouble with upon compiling the code: For the 2600...how do you enter equates? Here's the portion of code I entered: COLUP0 .EQU $06 COLUP1 .EQU $07 CNTRLPF .EQU $0A PF2 .EQU $0F SWCHB .EQU $0282 This was typed in exactly as it appears in the listing I received. When compiled using DASM...I keep getting syntax errors on these. The code references back to them like so (which is also where the errors in DASM occur): STA $CNTRLPF . . . STA $COLUP1 . . . STA $COLUP0 etc, etc. What is it that I'm doing wrong that DASM is not understanding me (or something I'm not understanding)? I can't share the whole code right now cause it's on a different PC and the new one doesn't use floppies and the old one doesn't use a million different types of memory cards. I did however learn of a new way to set a timer for the 2600. Help me please! I want to learn Assembly and try to understand what it is I'm doing wrong. This is for the 2600. Thanks in advance! Quote Link to comment Share on other sites More sharing options...
+batari Posted August 5, 2008 Share Posted August 5, 2008 You should use the vcs.h header file, which has all those equates predefined (except CNTRLPF is now CTRLPF.) If you wish to use equates, use EQU (without the dot) or just =. The other errors are the $ in your STA instruction - the $ is only needed for hexadecimal numbers and not equates. Quote Link to comment Share on other sites More sharing options...
kamakazi Posted August 5, 2008 Author Share Posted August 5, 2008 Thanks...that helped! But the code also has the following to redirect the processor: Init: . . . Start: . . . Loop1: . . . Proc: . . . NReset: . . Loop2: . . . Loop3: DASM is now giving me unresolved errors on 5 of these: Loop1, Loop2, Loop3, NReset & Start. What else am I doing wrong? Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted August 5, 2008 Share Posted August 5, 2008 DASM is now giving me unresolved errors on 5 of these: Loop1, Loop2, Loop3, NReset & Start. What else am I doing wrong? Post the complete source code as a file. That should make it easier to help. Quote Link to comment Share on other sites More sharing options...
kamakazi Posted August 5, 2008 Author Share Posted August 5, 2008 Here's the code. Sorry it took so long. Finally found a blank CD! ; Color Demo ; shows almost all the colors on the left side ; of the screen and cycles slowly on the right processor 6502 include "vcs.h" include "macro.h" COLUP0 EQU $06 COLUP1 EQU $07 CTRLPF EQU $0A PF2 EQU $0F SWCHB EQU $0282 Init: LDA #$E0 STA $80 ; initialize time counter Start: LDA $81 ; get contents of memory STA PF2 ; save into a pattern control register LDA #$03 ; set right side to reflection of left STA CTRLPF ; set background control register LDA #$55 STA COLUP1 ; set right side color ;******************************************************************************* *************** LDA #$02 STA WSYNC ; wait for horizontal sync STA VBLANK ; start vertical blanking STA VSYNC ; start vertical retrace LDA #$2A STA TIM8T ; set timer for vertical retrace duration Loop1: LDA INTIM BNE Loop1 ; waste time STY WSYNC ; wait for horizontal sync STY VSYNC ; and vertical retrace period Proc: LDA #$24 STA TIM64T ; set timer for next wait ;******************************************************************************* *************** LDA SWCHB AND #$01 ; check for reset switch BNE NReset BRK ; only interrupt avail - need vector set NReset: INC $80 ; increment right side color cycle counter BNE Loop2 LDA #$E0 ; change color every 32/60 seconds STA $80 ; reset counter INC $81 LDA $81 ; increment left side color STA COLUP0 ; store it in color register ;******************************************************************************* *************** Loop2: LDY INTIM BNE Loop2 ; waste time STY WSYNC ; wait for horizontal sync STY VBLANK ; end vertical blanking LDX #$E4 ; number of lines to draw on screen Loop3: STY WSYNC ; wait for horizontal sync ;******************************************************************************* **************** STX PF1 ; change the background pattern each line STX COLUP1 ; change right side color with each line ;******************************************************************************* **************** DEX BNE Loop3 JMP Start ; do next screen (every 1/60th second) END This is the code exactly as it appears in the documents I received, with the exception of the edits made to it as described above by batari. Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted August 5, 2008 Share Posted August 5, 2008 Here's the code. Sorry it took so long. Finally found a blank CD! ; Color Demo ; shows almost all the colors on the left side ; of the screen and cycles slowly on the right processor 6502 include "vcs.h" include "macro.h" COLUP0 EQU $06 COLUP1 EQU $07 CTRLPF EQU $0A PF2 EQU $0F SWCHB EQU $0282 Init: LDA #$E0 STA $80 ; initialize time counter Start: LDA $81 ; get contents of memory STA PF2 ; save into a pattern control register LDA #$03 ; set right side to reflection of left STA CTRLPF ; set background control register LDA #$55 STA COLUP1 ; set right side color ;******************************************************************************* *************** LDA #$02 STA WSYNC ; wait for horizontal sync STA VBLANK ; start vertical blanking STA VSYNC ; start vertical retrace LDA #$2A STA TIM8T ; set timer for vertical retrace duration Loop1: LDA INTIM BNE Loop1 ; waste time STY WSYNC ; wait for horizontal sync STY VSYNC ; and vertical retrace period Proc: LDA #$24 STA TIM64T ; set timer for next wait ;******************************************************************************* *************** LDA SWCHB AND #$01 ; check for reset switch BNE NReset BRK ; only interrupt avail - need vector set NReset: INC $80 ; increment right side color cycle counter BNE Loop2 LDA #$E0 ; change color every 32/60 seconds STA $80 ; reset counter INC $81 LDA $81 ; increment left side color STA COLUP0 ; store it in color register ;******************************************************************************* *************** Loop2: LDY INTIM BNE Loop2 ; waste time STY WSYNC ; wait for horizontal sync STY VBLANK ; end vertical blanking LDX #$E4 ; number of lines to draw on screen Loop3: STY WSYNC ; wait for horizontal sync ;******************************************************************************* **************** STX PF1 ; change the background pattern each line STX COLUP1 ; change right side color with each line ;******************************************************************************* **************** DEX BNE Loop3 JMP Start ; do next screen (every 1/60th second) END This is the code exactly as it appears in the documents I received, with the exception of the edits made to it as described above by batari. The initial blanks and the broken lines are your problem. Remove all all leading blanks before the labels (should be about 6 or 7) and make the comments one line again. 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.