6502 MIDI file player

Programming the 6502 microprocessor and its relatives in assembly and other languages.
User avatar
BitWise
In Memoriam
Posts: 996
Joined: 02 Mar 2004
Location: Berkshire, UK
Contact:

Re: 6502 MIDI file player

Post by BitWise »

For a 32-bit number subtracting from zero is quicker than complementing and incrementing

Code: Select all

sec
lda #0
sbc binvlq+0
sta tc+0
lda #0
sbc binvlq+1
sta tc+1
lda #0
sbc binvlq+2
sta tc+2
lda #0
sbc binvlq+3
sta tc+3
Andrew Jacobs
6502 & PIC Stuff - http://www.obelisk.me.uk/
Cross-Platform 6502/65C02/65816 Macro Assembler - http://www.obelisk.me.uk/dev65/
Open Source Projects - https://github.com/andrew-jacobs
lordbubsy
Posts: 207
Joined: 11 Sep 2013
Location: The Netherlands

Re: 6502 MIDI file player

Post by lordbubsy »

@Chromatix
Quote:
Perhaps you could upload the code as it presently stands
Sure thing:
Player31 bugfix working version.asm
(21.41 KiB) Downloaded 67 times
Quote:
I recall previously you said the tempo didn't vary with CPU speed
The difference is more noticeable with the MIDI file I’m using now. (from Duke3d) So I’m not so sure anymore if CPU speed didn’t matter back then when I stated that. I might test that again. However it is rather subtle.
Quote:
The solution will probably be that "better timer" I described previously.
Hmm, I’m not sure if I’m up to that task right now, it seems rather daunting. In addition, the MIDI file player is supposed to be relatively simple because the MIDI file is supposed to be playing in the background in conjunction with a scan line interrupt provided by the Video Display Processor. The VDP will give a 60Hz interrupt which should have priority over all other interrupts.

Hardware wise my computer is almost ready and I’m realizing that I have to learn a lot on the software front, especially on multiple interrupt handling.
Quote:
Optimising your code is also likely to help
Yes, I think there’s a lot of room to optimize it. I probably should start using the ‘816 features of my CPU.

@BDD
Quote:
Is your MIDI machine running on a 65C02 or 65C816?
My computer MARC-4 is running on a WDC65C816S @8MHz, or 4, 2 and 1MHz, selectable by software. Perhaps I should make a little presentation in a new thread, like I said it’s almost done and I’m really just testing various features at a time and see if they work.

@BitWise
Quote:
For a 32-bit number subtracting from zero is quicker than complementing and incrementing
Well, I’d like to be able to measure the amount of cycles a routine uses, but I guess that’s more of an emulator thing? Thinking about it, I could use my simple 8-bit logic analyzer to measure the difference of the start and end of a routine. (by flipping an output bit)
Marco
Post Reply