home *** CD-ROM | disk | FTP | other *** search
- *= $1000
- ;---------------------------------------
- ;Diese Funktion wandelt ein
- ;'16-bit unsigned word' (vorzeichenlose
- ;16-Bit-Zahl im Bereich von 0 bis 65535)
- ;das im x- und y-Register uebergeben
- ;wird (x=Low-Byte, y=High-Byte) in
- ;einen Dezimalstring, der an der
- ;Adresse angelegt wird, auf die der
- ;pointer ($fc/$fd) weisst ($fc=lo-byte,
- ;$fd=hi-byte).
- ;Die Funktion wird mit "jsr dez" auf-
- ;gerufen.
-
- ; (w) 1992 Benjamin Bommer
- ;---------------------------------------
- dez stx dl1 ;word puffern
- sty dh1
-
- ldy #4 ;bereich mit
- lda #$30 ;"00000" loeschen
- delp sta ($fc),y
- dey
- bpl delp
-
- lda #<dtab ;pointer auf
- sta $fe ;tabelle in ($fe)
- lda #>dtab
- sta $ff
-
- dn0 ldx dh1 ;oberstes bit ge-
- bpl dn1 ;setzt ?
-
- ldy #4 ;wenn ja, addiere
- clc ;wert aus tabelle
- dr0 lda ($fc),y
- adc ($fe),y
- cmp #$3a
- bcc dr1
- sbc #10
- dr1 sta ($fc),y
- dey
- bpl dr0
-
- dn1 lda $fe ;tabellen-pointer
- clc ;hochsetzen
- adc #5
- sta $fe
- bcc dn4
- inc $ff
-
- dn4 asl dl1 ;das word wird um
- rol dh1 ;ein bit nach links
- ;geshiftet.
-
- ora dl1 ;durch diese ver-
- bne dn0 ;knuepfung wird ge-
- ;prueft ob ueber-
- ;haupt noch ein bit
- ;im word gesetzt ist
- ;.. wenn nicht:
-
- rts ;ruecksprung
-
- dtab .byte 3,2,7,6,8 ;2^15
- .byte 1,6,3,8,4 ;2^14
- .byte 0,8,1,9,2 ;
- .byte 0,4,0,9,6 ;.
- .byte 0,2,0,4,8 ;.
- .byte 0,1,0,2,4 ;.
- .byte 0,0,5,1,2
- .byte 0,0,2,5,6 ;2^8
- .byte 0,0,1,2,8
- .byte 0,0,0,6,4 ;.
- .byte 0,0,0,3,2 ;.
- .byte 0,0,0,1,6 ;.
- .byte 0,0,0,0,8 ;
- .byte 0,0,0,0,4 ;2^2
- .byte 0,0,0,0,2 ;2^1
- .byte 0,0,0,0,1 ;2^0
-
- dl1 .byte 0
- dh1 .byte 0
-
-