James_Parsons wrote:
Ok everyone has now established me as a noob, but I love the 6502 and it's asm. I need to know exactly what I would have to do to write an OS for a homebuilt 6502. I think I should disable interrupts for boot up and then assign everything necessary. But, as I said im new to the 6502. Does anyone have a small bootloader and/or kernel I can study the source of
< . . . >
I know how to disable interrupts, but how do I enable them
The peripheral (I/O) ICs that can cause the interrupts also come out of reset with interrupts disabled. Your software sets up the I/O ICs per your needs and gets things ready to do before finally telling them it's ok to interrupt. How you do that depends on the particular ICs, and will be in their data sheets. There are examples in my 6502 interrupts primer. As for the processor itself, CLI clears the interrupt-disable flag so it will pay attention the the IRQ\ line. (Note also—and this is mentioned in the interrupts primer—that your interrupt-service routine, or ISR for short, does not need to waste time checking for interrupts from sources that are not even enabled.)
If you haven't already, read through the topic, "introducing minimOS" where the value and function of an OS is discussed. You probably don't need an actual OS to get started, but of course some code does need to be available immediately upon reset.
There are various OSs and kernels posted on this website and members' websites. I'm a little bit hesitant to recommend any particular one, partly because I have not looked closely into any of them, and partly because it seems that the ones written with better programming habits are also more lofty and perhaps well beyond what a newbie needs or can understand. (Perhaps my perception there is not very accurate.) You might tell us what you envision doing; but then be open to recommendations from those who have been down this road before you. My first home-made computer worked as designed; but in spite of its size and how much work it was to make, was not really useful for anything, but got me on the road to learning what would be useful and more practical.
More and more, I find that the 6502 (and family) is a great passion of mine too (which is partly why I'm checking the forum countless times a day!), and the passion grows as I continue to gain more knowledge and experience.