/[projet1]/public/pc/tools/osdk/main/Osdk/_final_/lib2/itoa.s
Defence Force logotype

Contents of /public/pc/tools/osdk/main/Osdk/_final_/lib2/itoa.s

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1154 - (show annotations)
Sun Aug 10 18:19:54 2014 UTC (5 years, 6 months ago) by dbug
File size: 718 byte(s)


1 ;
2 ; itoa
3 ;
4 _itoa
5 ldy #0
6 lda (sp),y
7 sta op2
8 iny
9 lda (sp),y
10 sta op2+1
11
12 jsr itoa
13 rts
14
15 bufconv
16 .byt 0,0,0,0,0,0,0,0,0,0,0,0
17 itoa
18 lda op2+1
19 bpl uitoa
20 lda #$2D ; minus sign
21 sta bufconv
22 sec
23 lda #0
24 sbc op2
25 sta op2
26 lda #0
27 sbc op2+1
28 sta op2+1
29
30 uitoa
31 ldy #0
32 sty bufconv
33 itoaloop
34 jsr udiv10
35 pha
36 iny
37 lda op2
38 ora op2+1
39 bne itoaloop
40
41 ldx #0
42 lda bufconv
43 beq poploop
44 inx
45 poploop
46 pla
47 clc
48 adc #$30
49 sta bufconv,x
50 inx
51 dey
52 bne poploop
53 lda #0
54 sta bufconv,x
55 ldx #<bufconv
56 lda #>bufconv
57 rts
58
59 ;
60 ; udiv10 op2= op2 / 10 and A= tmp2 % 10
61 ;
62 udiv10
63 lda #0
64 ldx #16
65 clc
66 udiv10lp
67 rol op2
68 rol op2+1
69 rol
70 cmp #10
71 bcc contdiv
72 sbc #10
73 contdiv
74 dex
75 bne udiv10lp
76 rol op2
77 rol op2+1
78 rts
79

  ViewVC Help
Powered by ViewVC 1.1.26