Jump to content

Just Jeff

Members
  • Posts

    597
  • Joined

  • Last visited

Everything posted by Just Jeff

  1. Thanks! Got some questions of course.. These things: MAC READ_PADDLE_1 lda INPT0 ; 3 - always 9 bpl .save ; 2 3 .byte $2c ; 4 0 .save sty Paddle1 ; 0 3 ENDM I assume these are macros? Does DASM use these to insert the code whenever it finds READ_PADDLE...? Also, this one and others don't appear to even be used- are they? It looks like you are only using READ_TWO_PADDLES which is alternating between frames. So do INPUTs have a positive value until their associated capacitor is completely discharged? If they are not discharged, the current y value will be stored in RAM for the appropriate player. When the value is zero (cap discharged), byte $2C will prevent subsequent y's from being stored for the player and the last y stored is the player position?. And paddles are read between turning off VBLANK and the start of the kernal? Is VBLANK turned off a little earlier to account for this? When are the paddle capacitors charged? Is this a carefully timed routine? If so, what's the time?
  2. Assembly for all six questions. Note: you don't program with DASM, you'll use Microsoft WordPad or something like it to write your code then DASM to convert it to binary. Assembly is easy to pick up. Do you already know it?
  3. Notice how Air-Sea Battle can have just as many objects and does not flicker? This is because televisions (and Atari) draw the screen very fast (not instantly) from top to bottom. As the screen is drawn here, one of the players is not only re-drawn, but also redrawn in a different shape and position for each occurrence. So as Atari goes down the screen, it draws the same player over and over, in different shapes and positions, just a little bit ahead of the TV's electron beam. So, if any of these objects were to move up or down to the same level of another, it wouldn't work- as you know, it's only one object in Atari's register. Pac Man' ghosts move up and down so instead (as you mentioned), it flips back and forth each TV frame between 4 different ghost locations for the one ghost sprite,and you can see that each ghost only appears once every four frames. Ms. Pac Man uses the first technique whenever everybody is on a different line, but when it the program detects multiple ghosts on the same line, introduces the second technique. You can see flicker in Ms. Pacman, but only on these occasions. Further, (I think) Ms. Pacman puts Ms Pacman herself into the mix, so if two ghosts are on the same line, Ms. Pacman's sprite changed and used for one of them so no flicker is necessary even then. So when there are 3 object on the same line, only then do we need to start alternating frames (flickering).
  4. Still more questions after watching the video- Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot? Of course you don't, no one does. It never happens. Sorry, Ted, that's a dumb question... skip that.
  5. Thanks.. I realize this was getting a little tangential, but I don't like putting code in an asm without understanding what's going on and this little bit went on way too long. Also maybe one day I'll code an actual 6502 and it will be more useful. Maybe one more question. Why is it called a vector? That term doesn't come up too much- seems like its just an address. Here's the definition I found but it doesn't seem to apply; 4. (Computers) an array of data ordered such that individual items can be located with a single index or subscript.
  6. OK Cool-this isn't so hard. I guess I just ignored it because it tends to appear at the end of programs and I get distracted way before I get to it. I was hacking a program once and someone pointed out that I had let it run into the reset vector and that was causing my issue but I never pursued it any further. So is the NMI non-maskable because its supposed to be a hardware interrupt? Is the fact that IRQ is maskable relevant to 2600? Seems like it might only be usable if that was RAM- not ROM. Or do you load it into the accumulator and do whatever masking you wanted to apply to it?
  7. OK I think I'm getting it. Basically, the 6502 does a jmp.ind to the address located at $FFFC when its first turned on. I've been using this: ORG $FFFA ; set address to 6507 Interrupt Vectors .WORD InitSystem ; NMI .WORD InitSystem ; RESET .WORD InitSystem ; IRQ and InitSystem is my CLEAN_START macro. Thanks! What about the interrupts above? Do we ever use these? Is this for the BRK command? How is a mask used for an interrupt?
  8. Good Morning, After all this time, I still have a pretty sad understanding of reset vector. I put it in my programs, I read that it is an address that will trigger an initialization of the processor, but I really don't know specifically what's going on here or why. So in my own words, if the program counter goes there, your program is done and its like you turned the machine off then on again. Does that sound about right? If so, I'm still wondering why it is put into the ASM. Seems like it would be a hard-wired address that you can't change or that when you tell DASM "PROCESSOR 6502", the reset would already be known. Can I pick another address? Also, I don't recall ever seeing an instruction pointing to the reset address so it doesn't seem useful.
  9. Hmm yeah I read through the stuff again and I think I just applied the term wavelength to it myself. It looks like I was actually noticing the differences in amplitude, not wavelength. Thanks!
  10. New theory. I focused on frequency but not wavelength. As far as I can tell, my frequencies are correct but my wavelengths are only half of the normal wavelengths for any given frequency. Looking at graphs of frequencies, you see the waves goes from positive to negative and and back again. If I understand AUDF0 correctly, it goes from positive to zero, never negative, so the wavelength is only half the height. Does this sound plausible?
  11. OK.. I created a digital version of Mary Had a Little Lamb that is working, but is way,way out of tune. I've re-checked my math but can't quite figure out where I went wrong, Can anyone see where I went wrong? My frequency calculations (I explain where I define C5) or cycle counts maybe? I also found the song using different notes, put them in and it made little or no difference. ; Digital Mary Had a Little Lamb ; ; 29 April 2017 ; Mary Had A Little Lamb ; EDCDEEE ; DDDEGG ; EDCDEEEa ; EDDEDC ;or is it ;BAGABBB ;AAABDD ;BAGABBBB ;AABAG ; dasm MHALL.asm -f3 -v0 -sMHALL.sym -lMHALL.lst -oMHALL.bin ; Attempt to produce a simple in-tune song PROCESSOR 6502 include vcs.h ;============================================================================== ; Define Notes ;============================================================================== C_FIVE = 141 ; 141 C5 is 523.25 Hz. 6507 runs at 1,193,333 Hz. ; 1,193,333/523.25= 2280.6 machine cycles ; Divide by 2 for each half of the square wave ; equals 1140.3 machine cycles ; the wait loops are 8 cycles which means I need to loop ; through approximately 142 times for each half wave ; Subtract 1 for the 5 cycle delay in initial AUDV0 loadings D_FIVE = 125 ; 125 E_FIVE = 112 ; 112 F_FIVE = 105 ; 105 G_FIVE = 94 ; 94 A_FIVE = 83 ; 83 B_FIVE = 74 ; 74 END_SONG = 0 ; WHOLE_NOTE = 255 HALF_NOTE = 128 QUARTER_NOTE = 64 SEG.U VARS ORG $80 ; Start of Cartridge ; Tell DASM to start here. RAM begins at $80 Hold5: ds 1 ; Used to hold wave high or low CurrentNoteDuration: ds 1 ; Quarter note, half note, etc CurrentNote: ds 1 ; Which note the song is on ; define the segment for code SEG CODE ; 2K ROM starts at $F800, 4K ROM starts at $F000 ORG $F800 InitSystem: sei ; Set Interrupt cld ; Clear the decimal bit. ldx #$FF ; Start at the top of the stack txs ; Transfer to the stack lda #0 ClearMem: sta 0,X ; Store zero at (0+X) dex ; Do all of RAM bne ClearMem ; Repeat if we are not down to zero ;============================================================================== ; Load Tune ;============================================================================== LoadTune: lda Song,y ; Load the current note of the song (half wave value) sta Hold5 ; Store it in RAM lda Song+1,y ; Load the duration of the note sta CurrentNoteDuration ; Store it in RAM Tone: lda #$0F ; 2 set volume high for high part of square wave sta AUDV0 ; 3 ;============================================================================== ; Wave High ;============================================================================== WaitHigh: ; Loop to hold high part of wave dec Hold5 ; 5 bne WaitHigh ; 3 8 8 machine cycles per loop through WaitHighFine: ; Future use for fine tuning notes with a 5 cycle loop ;dex ; Future use for fine tuning notes with a 5 cycle loop ;bne WaitHighFine ; lda Song,y ; 4 Re-load the current note of the song sta Hold5 ; 3 Store it in RAM for low half of the wave ;============================================================================== ; Wave Low ;============================================================================== Interval: lda #$00 ; 2 Turn off volume for bottom of square wave sta AUDV0 ; 3 WaitLow: ; dec Hold5 ; 5 bne WaitLow ; 3 8 Holds 8 with the branch taken WaitLowFine: ;dex ; Future use ;bne WaitLowFine ; ;============================================================================== ; Next CurrentNote? ;============================================================================== dec CurrentNoteDuration ; 5 bne Tone ; 3 ;============================================================================== ; Get Next CurrentNote ;============================================================================== inc CurrentNote ; Increment to next note inc CurrentNote ; Again to skip over duration lda CurrentNote tay ; Put it in index lda Song,y ; Load the note beq StartOver ; if END_SONG then go to reset sta Hold5 ; otherwise, store in RAM lda Song+1,y ; load the note duration sta CurrentNoteDuration ; Store it in RAM jmp LoadTune ; Back to the top StartOver: ldy #0 sty CurrentNote sty Hold5 sty CurrentNoteDuration jmp LoadTune Song: byte E_FIVE,HALF_NOTE,D_FIVE,HALF_NOTE,C_FIVE,HALF_NOTE byte D_FIVE,HALF_NOTE,E_FIVE,HALF_NOTE,E_FIVE,HALF_NOTE,E_FIVE,WHOLE_NOTE byte D_FIVE,HALF_NOTE,D_FIVE,HALF_NOTE,D_FIVE,WHOLE_NOTE byte E_FIVE,HALF_NOTE,G_FIVE,HALF_NOTE,G_FIVE,WHOLE_NOTE byte E_FIVE,HALF_NOTE,D_FIVE,HALF_NOTE,C_FIVE,HALF_NOTE byte D_FIVE,HALF_NOTE,E_FIVE,HALF_NOTE,E_FIVE,HALF_NOTE,E_FIVE,HALF_NOTE byte E_FIVE,HALF_NOTE,D_FIVE,HALF_NOTE,D_FIVE,HALF_NOTE byte E_FIVE,HALF_NOTE,D_FIVE,HALF_NOTE,C_FIVE,WHOLE_NOTE byte END_SONG ; End of Cartridge ORG $FFFA ; set address to 6507 Interrupt Vectors .WORD InitSystem ; NMI .WORD InitSystem ; RESET .WORD InitSystem ; IRQ MHALL.bin MHALL.asm
  12. Thanks! I changed it, but strangely- it didn't make a difference.
  13. OK.. I created a digital version that is working, but is way,way out of tune. I've re-checked my math but can't quite figure out where I went wrong, Well commented .asm attached if anyone wants to take a look.. ; Digital Mary Had a Little Lamb ; ; 29 April 2017 ; Mary Had A Little Lamb ; EDCDEEE ; DDDEGG ; EDCDEEE ; EDDEDC ; dasm MHALL.asm -f3 -v0 -sMHALL.sym -lMHALL.lst -oMHALL.bin ; Attempt to produce a simple in-tune song PROCESSOR 6502 include vcs.h ;============================================================================== ; Define Notes ;============================================================================== C_FIVE = 141 ; C5 is 523.25 Hz. 6507 runs at 1,193,333 Hz. ; 1,193,333/523.25= 2280.6 machine cycles ; Divide by 2 for each half of the square wave ; equals 1140.3 machine cycles ; the wait loops are 8 cycles which means I need to loop ; through approximately 142 times for each half wave ; Subtract 1 for the 5 cycle delay in initial AUDV0 loadings D_FIVE = 125 ; E_FIVE = 112 ; F_FIVE = 105 ; G_FIVE = 94 ; A_FIVE = 83 ; B_FIVE = 74 ; END_SONG = 0 ; WHOLE_NOTE = 255 HALF_NOTE = 128 QUARTER_NOTE = 64 SEG.U VARS ORG $80 ; Start of Cartridge ; Tell DASM to start here. RAM begins at $80 Hold5: ds 1 ; Used to hold wave high or low CurrentNoteDuration: ds 1 ; Quarter note, half note, etc CurrentNote: ds 1 ; Which note the song is on ; define the segment for code SEG CODE ; 2K ROM starts at $F800, 4K ROM starts at $F000 ORG $F800 InitSystem: sei ; Set Interrupt cld ; Clear the decimal bit. ldx #$FF ; Start at the top of the stack txs ; Transfer to the stack lda #0 ClearMem: sta 0,X ; Store zero at (0+X) dex ; Do all of RAM bne ClearMem ; Repeat if we are not down to zero ;============================================================================== ; Load Tune ;============================================================================== LoadTune: lda Song,y ; Load the current note of the song (half wave value) sta Hold5 ; Store it in RAM lda Song,y+1 ; Load the duration of the note sta CurrentNoteDuration ; Store it in RAM Tone: lda #$0F ; 2 set volume high for high part of square wave sta AUDV0 ; 3 ;============================================================================== ; Wave High ;============================================================================== WaitHigh: ; Loop to hold high part of wave dec Hold5 ; 5 bne WaitHigh ; 3 8 8 machine cycles per loop through WaitHighFine: ; Future use for fine tuning notes with a 5 cycle loop ;dex ; Future use for fine tuning notes with a 5 cycle loop ;bne WaitHighFine ; lda Song,y ; 4 Re-load the current note of the song sta Hold5 ; 3 Store it in RAM for low half of the wave ;============================================================================== ; Wave Low ;============================================================================== Interval: lda #$00 ; 2 Turn off volume for bottom of square wave sta AUDV0 ; 3 WaitLow: ; dec Hold5 ; 5 bne WaitLow ; 3 8 Holds 8 with the branch taken WaitLowFine: ;dex ; Future use ;bne WaitLowFine ; ;============================================================================== ; Next CurrentNote? ;============================================================================== dec CurrentNoteDuration ; 5 bne Tone ; 3 ;============================================================================== ; Get Next CurrentNote ;============================================================================== inc CurrentNote ; Increment to next note inc CurrentNote ; Again to skip over duration lda CurrentNote tay ; Put it in index lda Song,y ; Load the note beq StartOver ; if END_SONG then go to reset sta Hold5 ; otherwise, store in RAM lda Song,y+1 ; load the note duration sta CurrentNoteDuration ; Store it in RAM jmp LoadTune ; Back to the top StartOver: ldy #0 sty CurrentNote sty Hold5 sty CurrentNoteDuration jmp LoadTune Song: byte E_FIVE,HALF_NOTE,D_FIVE,HALF_NOTE,C_FIVE,HALF_NOTE byte D_FIVE,HALF_NOTE,E_FIVE,HALF_NOTE,E_FIVE,HALF_NOTE,E_FIVE,WHOLE_NOTE byte D_FIVE,HALF_NOTE,D_FIVE,HALF_NOTE,D_FIVE,WHOLE_NOTE byte E_FIVE,HALF_NOTE,G_FIVE,HALF_NOTE,G_FIVE,WHOLE_NOTE byte E_FIVE,HALF_NOTE,D_FIVE,HALF_NOTE,C_FIVE,HALF_NOTE byte D_FIVE,HALF_NOTE,E_FIVE,HALF_NOTE,E_FIVE,HALF_NOTE,E_FIVE,HALF_NOTE byte E_FIVE,HALF_NOTE,D_FIVE,HALF_NOTE,D_FIVE,HALF_NOTE byte E_FIVE,HALF_NOTE,D_FIVE,HALF_NOTE,C_FIVE,WHOLE_NOTE byte END_SONG ; End of Cartridge ORG $FFFA ; set address to 6507 Interrupt Vectors .WORD InitSystem ; NMI .WORD InitSystem ; RESET .WORD InitSystem ; IRQ MHALL.bin MHALL.asm
  14. Update: I download 5.0.0 and yes the lines are now stable and the gaps are much less noticeable.
  15. Thanks.. I have 4.7.3 so I'll check into the pre-release. Also, I tried my .bin on the Harmony and it worked correctly for me as well.
  16. Ah.. I'll try it on my Harmony then. I guess I need to figure out how to record audio on Windows 10 at some point if I'm going to do this. Here's a Fraps video of what I'm getting: https://www.youtube.com/watch?v=Ky70LOBv-P0&feature=youtu.be
  17. That sounds a lot better than mine. Strange. Maybe its my version of Stella. Any Idea? I get 2 or 3 little breaks each time it cycles through fom high to low.
  18. I'm trying to figure out how to write in-tune music with the 2600 so as a first step, I wrote this little routine that changes frequency without changing the frequency register- AUDFx. There are little hiccups in the sound that so far have me stumped. All of the NOPs in there were to lower the frequency for a less annoying "siren" sound. DigitalNoise.bin DigitalNoise.asm
  19. Cool I think I'll do something like this. Took me a minute to figure out your British music terms..
  20. https://www.youtube.com/watch?v=1FHkMqHx5xM
  21. If you are looking to dive into Assembly, I also suggest Assembly In One Step http://atariage.com/2600/programming/2600_101/docs/onestep.html . You can get a basic grasp of assembly in a weekend. bcs is the test you are looking for above. Are you familiar with the processor status register? When a math result (from your sbc) causes the carry flag to be set in that register, the program takes the branch and loads your graphics. If your carry flag is not set, the program proceeds to that strange .byte $2c. That's a trick that makes your program skip over the following lda. Therefore, the previously loaded zero stays in your accumulator and that's what gets stored in the graphics register instead. Also, this is a good reference to bookmark http://www.6502.org/tutorials/6502opcodes.html#WRAP
  22. That was pretty much what was going on- thanks... But to fix it, what I did was load NoteCounter into the index register (x) before I increment NoteCounter twice (instead of the other way around) which allowed me to get rid of those two zeros and check for #70 instead of #72 as well. I still had a split second high pitched beep when I would first launch it which I believe was an effect of initializing the volume level at $7 at the start of the program. So I also initialized AUDF0, with the first note of the song so its now unnoticeable. Which brings me to the next question... Using this method, there seems to be that there are no frequency values that would make true silence between notes- correct? (The separations I have between identical notes is actually a different note, not a break.) Tune.bin Tune3.asm
  23. Good Evening.. Does anyone know of a good paddle programming tutorial and/or code example?
  24. I bought it the day it came out with my paper route money and was really disappointed. My 12 year old self understood the the flicker must have been due to Atari's technical limitations but the light blue background.. why..
×
×
  • Create New...