6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Nov 24, 2024 4:45 am

All times are UTC




Post new topic Reply to topic  [ 25 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Wed Nov 10, 2010 1:39 pm 
Offline

Joined: Fri Nov 21, 2008 3:07 pm
Posts: 31
Still not Showing the digits numbers

Code:
Broken external image link
http://i52.tinypic.com/w9e9gh.jpg


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Nov 10, 2010 4:42 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1748
Location: Sacramento, CA
You replaced the BRA f1 with JSR f1.

I said use JMP F1. Using JSR will cause possible stack problems.

Give that a try.

Daryl


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Nov 10, 2010 6:54 pm 
Offline

Joined: Fri Nov 21, 2008 3:07 pm
Posts: 31
8BIT wrote:
You replaced the BRA f1 with JSR f1.

I said use JMP F1. Using JSR will cause possible stack problems.

Give that a try.

Daryl

i tried both still getting same result..


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Nov 10, 2010 10:22 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
The part at the end that says
Code:
     n1: .db $10    ; multiplicand
     n2: .db $15    ; multiplier
     p:  .DB $0     ; product

could be part of the problem. I initially misinterpreted the ".DB" (or ".db") because none of the 6502 assemblers I've used this notation, and I was thinking that n1 was stored at address $0010, n2 at $0015, and p at $0000, which now I realize is incorrect. Since you're putting the actual variable space after the code and only leaving one byte for each, now with the modification for higher precision you will have to put in two bytes for each so the high byte of each does not overwrite the low byte of the next one. Then, put your inputs in the code there at n1 and n2, low byte first (as is customary with 6502).

For output, you can watch the content of p. You didn't tell us what kind of output is at "salida"; and when I added "salida+1", I had no way of knowing if that byte was available for the high byte. I probably should have used "salida2" which you never referenced except to define it.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Nov 11, 2010 12:21 am 
Offline

Joined: Fri Nov 21, 2008 3:07 pm
Posts: 31
GARTHWILSON wrote:
The part at the end that says
Code:
     n1: .db $10    ; multiplicand
     n2: .db $15    ; multiplier
     p:  .DB $0     ; product

could be part of the problem. I initially misinterpreted the ".DB" (or ".db") because none of the 6502 assemblers I've used this notation, and I was thinking that n1 was stored at address $0010, n2 at $0015, and p at $0000, which now I realize is incorrect. Since you're putting the actual variable space after the code and only leaving one byte for each, now with the modification for higher precision you will have to put in two bytes for each so the high byte of each does not overwrite the low byte of the next one. Then, put your inputs in the code there at n1 and n2, low byte first (as is customary with 6502).

For output, you can watch the content of p. You didn't tell us what kind of output is at "salida"; and when I added "salida+1", I had no way of knowing if that byte was available for the high byte. I probably should have used "salida2" which you never referenced except to define it.


.db is like a database


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Nov 11, 2010 1:02 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
Quote:
.db is like a database

I think it stands for "define byte," and "dw would be "define word," etc. (or "declare byte," "declare word," etc.).


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Nov 11, 2010 1:16 pm 
Offline

Joined: Fri Nov 21, 2008 3:07 pm
Posts: 31
GARTHWILSON wrote:
Quote:
.db is like a database

I think it stands for "define byte," and "dw would be "define word," etc. (or "declare byte," "declare word," etc.).

thats true... sorry i related db to database.. im also working on Oracle right now well Anyway thanks you


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Nov 11, 2010 1:20 pm 
Offline

Joined: Fri Nov 21, 2008 3:07 pm
Posts: 31
I find IT!!!!!!!!!! FINALY!!! its multiply to 99!!! without NO PROBLEM!!!!
salida=io_area+3
salida2=io_area+3
.ORG $0200
sed
LDA n2
BEQ fin
f1: LDA p
CLC
ADC n1
STA p
BCs carry

f2:
LDA n2
SEC
SBC #1
STA n2
BEQ fin
JMP f1

fin:
LDA $00
STA salida
LDA p
STA salida
BRK

carry:
LDA #00
ADC 00
sta 00
jmp f2
n1: .DB $99
n2: .db $99
p: .DB $0

now what i want to do is multiply more than 2 digits so.. i have to make 8 bit to 16 bit using my program, how i do this?

Thank you to all of you, who helped me and did gave me some advice and help with my programing hope u guys keep helping me with this one


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Nov 12, 2010 10:40 pm 
Offline

Joined: Fri Nov 21, 2008 3:07 pm
Posts: 31
I need to make this one to 16 bit.. so i could see larger numbers can some one give me some help me


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Nov 13, 2010 5:13 pm 
Offline

Joined: Sun Nov 08, 2009 1:56 am
Posts: 411
Location: Minnesota
I assume your output device likes to see its input in BCD form, which is why you use decimal mode. That would also explain why the "dec" instruction is commented out in your original code and replaced with a subtraction, since "dec" would not have the desired result.

There is a nice tutorial on 65xx decimal mode operations on this very site:

http://www.6502.org/tutorials/decimal_mode.html

It includes details on how to do multiple-byte additions and subtractions. Briefly, they are no different than binary multiple-byte additions and subtractions. You can do your multiplication by repeated addition of multiple-byte numbers.

More efficient algorithms are possible, but decimal multiplication and division are much more difficult than binary on 65xx processors. A pair of routines using the "Russian Peasant" algorithm can be found here:

http://www.llx.com/~nparker/a2/decimal.html


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 25 posts ]  Go to page Previous  1, 2

All times are UTC


Who is online

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