home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Crawly Crypt Collection 1
/
crawlyvol1.bin
/
program
/
compiler
/
nasm20b
/
nasm_src
/
lib
/
src
/
itoa.s65
< prev
next >
Wrap
Text File
|
1993-01-19
|
1KB
|
58 lines
.include #macros
.include #16bit
.if .not .def TEST
.zext _string1
.zext _value
.else
.include #cio
_string1 == $F0
_value == $F2
_tmp1 == $F4
_tmp2 == $F6
_tmp3 == $F8
main:
dpoke _value,2456
dpoke _string1,buffer
jsr itoa
print 0,header,255,@p1+@p2+@p3
dpoke _value,60001
dpoke _string1,buffer
jsr itoa
print 0,header,255,@p1+@p2+@p3
brk
header:
.byte "Value = "
buffer:
.ds 7
.byte 155,0
.endif
;; -------------------------------------------------------------
;; Convert a signed word into ASCII.
;; Parameters via zeropage STRING1 and VALUE. Needs also
;; 6 bytes of temporary zeropage storage.
;; -------------------------------------------------------------
itoa:
ldy #0
lda _value+1
bpl :ok
neg.w _value,$FFFF
lda #'-
sta (_string1),y
iny
:ok
jsr _utoa
lda #0
sta (_string1),y
rts