6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Apr 26, 2024 8:12 pm

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: OS dev
PostPosted: Fri Jul 26, 2013 9:44 pm 
Offline
User avatar

Joined: Wed Jul 10, 2013 3:13 pm
Posts: 67
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

_________________
JMP $FFD2


Top
 Profile  
Reply with quote  
 Post subject: Re: OS dev
PostPosted: Fri Jul 26, 2013 9:52 pm 
Offline
User avatar

Joined: Tue Mar 02, 2004 8:55 am
Posts: 996
Location: Berkshire, UK
Interrupts are disabled with the 6502 is reset. On a 6502 you need to LDX #$FF; TSX; CLD at the start of your power on reset routine then setup the hardware and enable interrupts. The 65C02 will clear decimal mode for you, so one less instruction to worry about.

_________________
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


Top
 Profile  
Reply with quote  
 Post subject: Re: OS dev
PostPosted: Fri Jul 26, 2013 9:56 pm 
Offline
User avatar

Joined: Wed Jul 10, 2013 3:13 pm
Posts: 67
I know how to disable interrupts, but how do I enable them

_________________
JMP $FFD2


Top
 Profile  
Reply with quote  
 Post subject: Re: OS dev
PostPosted: Fri Jul 26, 2013 10:19 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8428
Location: Southern California
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.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: