Jump to content
IGNORED

help with hex to decimal mac65


dogdark

Recommended Posts

Estoy con el siguiente problema, necesito convertir el hexadecimal $44000 a decimal. por ende no puedo utilizar el floating point por que este solo trabaja hasta 2 bytes y un máximo de 65335, trate de todos los medios, incluso sumando de un byte a uno y comparando hasta llegar a la igualdad, pero el proceso es demasiado lento, casi 1 minuto. He revisado revistas manuales y ninguno da señal de algún código que pueda ayudar a realizar este proceso.

traduccion
I am with the following problem, I need to convert the hexadecimal $ 44000 to decimal. so I can not use the floating point because it only works up to 2 bytes and a maximum of 65335, try all media, even adding one byte to one and comparing until you reach equality, but the process is too slow , almost 1 minute. I have reviewed manual journals and none gives a signal of any code that can help to carry out this process.

        *=$2000
M=17
MEMORY
	.BYTE $00,$00,$00,$9B
DISPONIBLE
	.BYTE $00,$00,$00,$00,$00,$00,$9B
CALCULO
	.BYTE $00,$00,$00,$00,$00,$00,$9B
SUMAMOSMEMORIA
	LDX M
SUMAMOSMEMORIA?
	CLC
	LDA MEMORY+2
	ADC #$00
	STA MEMORY+2
	LDA MEMORY+1
	ADC #$40
	STA MEMORY+1
	LDA MEMORY
	ADC #0
	STA MEMORY
SUMAMOSMEMORIA??
	CPX #0
	BEQ FINSUMAMOSMEMORIA
	DEX
	JMP SUMAMOSMEMORIA?
FINSUMAMOSMEMORIA
	RTS
INICIO
	LDA #0
	STA 710
LOOP
	JMP LOOP
	*=$02E0
	.WORD INICIO

como se puede apreciar en el código tengo la variable M con un valor de 16 que realiza el bucle de SUMAMOSMEMORIA sumando de a $4000 bytes que equivale a 16384 y este resultado queda en MEMORY( $04 $40 $00) y eso quedo dejarlo como disponible ( $02,$07,$08,$05,$02,$08 ). Alguna idea de como realizar la conversión.

 

traducción

As you can see in the code I have the variable M with a value of 16 that makes the SUMAMOSMEMORIA loop adding up to $ 4000 bytes that is equivalent to 16384 and this result is in MEMORY ($ 04 $ 40 $ 00) and that is left as available ($ 02,$07,$08,$05,$02,$08). Some idea of ​​how to perform the conversion.

Link to comment
Share on other sites

As long as DISPONIBLE values will never be above $09

for each place you can just add $30 to it to get the

atascii value as a printable one place decimal number.

 

$08 = $38 which is one place character 8. Same holds

true for $00 thru $09 values.

 

Welcome new guy, most code heads are posting in the

official code side of the forum

http://atariage.com/forums/forum/51-atari-5200-8-bit-programming/

 

But posting code questions over here is Ok on

occasion too. Especially for the new guy with the

impressive code I don't fully understand but has the

correct results anyway. :)

 

You can call this a cheap and dirty atascii trick

I picked up on and I'll just smile and say yep. It

really belongs to someone else too, I just stole it

for my own use.

Link to comment
Share on other sites

muchas gracias por el código, y pido las disculpas por haber posteado en un lugar que no correspondía, me fijare para mas adelante, revisare la rutina para expandirla a 3 bytes. yo creo que me servirá de mucho.

 

traducción.

 

thank you very much for the code, and I apologize for having posted in a place that did not correspond, I will look for later, I will review the routine to expand it to 3 bytes. I think it will help me a lot.

Link to comment
Share on other sites

Just an update: this was also discussed in Retronia's forum. The problem was to display a 3-bytes integer (24 bits) as decimal digits. xt5 found a very simple method and modified it to take 3 bytes instead of a word (16 bits). It takes bits from the integer by the MSB side and adds to an acumulator using decimal mode (nibbles), and doubles that acumulator at the same time by adding it to itself in the loop. He also provides the code there if someone is interested: http://www.retronia.cl/foro/viewtopic.php?p=29596#p29602

 

  • Like 3
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...