6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Nov 22, 2024 4:51 pm

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Tue Oct 28, 2008 9:48 pm 
Offline

Joined: Tue Oct 28, 2008 9:41 pm
Posts: 3
Location: Northeast Ohio
how would you write a machine language program that adds the numbers 1,2,3,4,5 and 6 together and place the sum into location 0280h?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Oct 28, 2008 10:06 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8543
Location: Southern California
Should I assume this is homework? How much help will the teacher approve of? There are several ways you could do it. Without just giving it away, I might suggest starting with 0 in A and storing your number in address 280. Every time you add the contents of address 280 to A you decrement address 280 until it reaches 0. When that's done looping, store A in 280.


Top
 Profile  
Reply with quote  
 Post subject: machine language program
PostPosted: Tue Oct 28, 2008 10:34 pm 
Offline

Joined: Tue Oct 28, 2008 9:41 pm
Posts: 3
Location: Northeast Ohio
Thank you for the quick reply. I am the teacher and my grandson is the student who is home schooled. We are a little confused about his computer class problem and any help would be appreciated.

Thanks,
Carol


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Oct 28, 2008 11:28 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8543
Location: Southern California
Start with your number in 280H. It must be in the range of 1 to 22 decimal (1 to 16H) to avoid errors. Then:
Code:
        LDA   #0
        CLC
loop:   ADC   280H
        DEC   280H
        BNE   loop
        STA   280H


Top
 Profile  
Reply with quote  
 Post subject: machine language program
PostPosted: Tue Oct 28, 2008 11:37 pm 
Offline

Joined: Tue Oct 28, 2008 9:41 pm
Posts: 3
Location: Northeast Ohio
Thanks soooooo much

Carol


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 21 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: