Prev: OctaOS
Next: DIV overflow
From: �a/b on
On Mon, 02 Apr 2007 08:21:00 +0200, "�a\\/b" <al(a)f.g> wrote:
>int main(void)
>{char s[1000], *pc;
> int rr, h;
> num n;
> printf("Inserisci un numero decimale > ");
> pc=fgets(s, 1000, stdin);
> if(pc==0) return 0;
> rr=StrToNum(&n, s, &pc, 10);
>
> for(h=0; s[h] ; ++h );
> if(s[--h]=='\n') s[h]=0;

this above should be

if(h>0 && s[--h]=='\n') s[h]=0;


> if(rr==0) {printf("errore\n"); }
> printf("rr=%i, pc=%s\nHai inserito = ", rr, pc);
> prx(n);
> printf("\n");
> return 0;
>}
From: �a/b on
On Tue, 27 Mar 2007 11:56:53 +0200, Herbert Kleebauer wrote:
>dec_ascii: dc.b "1234567890123456789011223344556677889900111222333444555",0


for your ruotines a number should be what?
something like
unsigned32bits *array;
unsigned32bits size_array;
?

than i have some dubit "dec_dump" is right

what are the arguments of that functions?

>dec_dump:
> move.l #10,r3
> move.l #text_out_end,r6
>
>_20: move.l #result,r5
> move.l #size-1,r4
> eor.l r1,r1
> eor.l r2,r2
>_10: move.l (r5,r4*4),r0
> divu.l r3,r1|r0
> move.l r0,(r5,r4*4)
> or.l r0,r2
> dec.l r4
> bpl.b _10
> add.b #'0',r1
> dec.l r6
> move.b r1,(r6)
> tst.l r2,r2
> bne.b _20
>
> subq.l #4,r6
> move.l #$0a0d0a0d,(r6)
> move.b #$40,m0
> move.w r6,r1
> move.l #text_out_end,r2
> sub.w r1,r2
> move.w #1,r3
> trap #$21

why trap 21 and not write the result in an array 0 terminated string?

> rts.l
>
>
> even 4
>result: blk.l size
>tmp: blk.l size
>
>text_out: blk.b size*10+10
>text_out_end:
From: Herbert Kleebauer on
"�a\\/b" wrote:
> On Tue, 27 Mar 2007 11:56:53 +0200, Herbert Kleebauer wrote:

> for your ruotines a number should be what?
> something like
> unsigned32bits *array;
> unsigned32bits size_array;
> ?

This is assembly programing, there are only bytes and nothing else.

> than i have some dubit "dec_dump" is right
>
> what are the arguments of that functions?

No arguments at all. It dumps the binary number starting at
label "result" with a length of size*4 bytes as decimal text
string to stdout (now you can dump your 7000! as decimal string).

> >dec_dump:
> > move.l #10,r3
> > move.l #text_out_end,r6
> >
> >_20: move.l #result,r5
> > move.l #size-1,r4
> > eor.l r1,r1
> > eor.l r2,r2
> >_10: move.l (r5,r4*4),r0
> > divu.l r3,r1|r0
> > move.l r0,(r5,r4*4)
> > or.l r0,r2
> > dec.l r4
> > bpl.b _10
> > add.b #'0',r1
> > dec.l r6
> > move.b r1,(r6)
> > tst.l r2,r2
> > bne.b _20
> >
> > subq.l #4,r6
> > move.l #$0a0d0a0d,(r6)
> > move.b #$40,m0
> > move.w r6,r1
> > move.l #text_out_end,r2
> > sub.w r1,r2
> > move.w #1,r3
> > trap #$21
>
> why trap 21 and not write the result in an array 0 terminated string?

Because I want to see it on the screen.

> > rts.l
> >
> >
> > even 4
> >result: blk.l size
> >tmp: blk.l size
> >
> >text_out: blk.b size*10+10
> >text_out_end:
From: Guga on
Hi Wolfgang

Did you got my email ?

Best Regards

Guga

From: �a/b on
On Wed, 04 Apr 2007 19:59:14 +0200, Herbert Kleebauer <klee(a)unibwm.de>
wrote:

>"�a\\/b" wrote:
>> On Tue, 27 Mar 2007 11:56:53 +0200, Herbert Kleebauer wrote:
>
>> for your ruotines a number should be what?
>> something like
>> unsigned32bits *array;
>> unsigned32bits size_array;
>> ?
>
>This is assembly programing, there are only bytes and nothing else.

always are bytes the clue is how organize them
First  |  Prev  |  Next  |  Last
Pages: 5 6 7 8 9 10 11 12 13 14 15 16
Prev: OctaOS
Next: DIV overflow