[ASM] Is there any ROM jump to get a decimal value...

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
Post Reply
User avatar
XavSnap
Posts: 1941
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

[ASM] Is there any ROM jump to get a decimal value...

Post by XavSnap »

Hi all,

I have lost the ROM offset to convert a string "123" (in decimal) to a BC value.

I ever used it, but i can't remember the piece of code...

LD DE, STRINGOFFSET ; first char in the D_File for example.
CALL $ROM
And BC= the pointed value...

In the BASIC VAL"123" function ?

Any ideas to refresh my mind ?
Last edited by XavSnap on Fri Jun 10, 2022 3:43 am, edited 1 time in total.
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
dr beep
Posts: 2076
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: [ASM] Is there any ROM jump to get a decimal value...

Post by dr beep »

AF8EE447-5383-4B33-B203-0FCA04BFE6A8.png
User avatar
XavSnap
Posts: 1941
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: [ASM] Is there any ROM jump to get a decimal value...

Post by XavSnap »

Thanks Dr Beep !

I found another routine:
PRN0032.jpg
PRN0032.jpg (14.61 KiB) Viewed 1073 times

Code: Select all

1 REM [ASM=\
;------- TASM ASM mnemonics. -------|\
; Compile this file using:|\
; Set TASMOPTS = -b|\
; tasm -80 ThisCode.tas MyBinary.BIN|\
;-----------------------------------|\
; Zx81 Program name: VB81 XuR [GetNum.bas] :|\
; REM   line   name: D=16514/16542 : H=4082/409E|\
|\
#define ORG  .org       ; TASM cross-assembler definitions|\
#define equ  .equ|\
;-----------------------------------|\
|\
;------------------------------------|\
;-BASIC sub-routine entry.          -|\
;+----------------------------------+|\
; Lb4082  ;  <- USR BASIC Enty.|\
;+----------------------------------+|\
|\
;------- Rom and Ram Symbols -------|\
RAM_CH_ADD equ $4016|\
RAM_SPARE2 equ $407B|\
RAM_D_FILE equ $400C|\
INT_TO_FP equ $1548|\
FP_TO_BC equ $158A|\
|\
|\
ORG $4082 ; [@16514/@h4082]|\
Lb4082:|\
	LD DE,(RAM_CH_ADD) ; GET CH-ADD|\
	LD (RAM_SPARE2),DE ; SET UNUSED-16|\
	LD HL,(RAM_D_FILE) ; GET D-FILE|\
	INC HL |\
	LD (RAM_CH_ADD),HL ; SET CH-ADD|\
	RST 18H |\
	CALL INT_TO_FP ; [INT-TO-FP]|\
	CALL FP_TO_BC ; [FP-TO-BC]|\
	LD HL,(RAM_SPARE2) ; GET UNUSED-16|\
	LD (RAM_CH_ADD),HL ; SET CH-ADD|\
	RET ; ==========================|\
.end|\
]

10 FOR A=0 TO 3
20 PRINT AT 0,A;CHR$(INT(RND*10)+28)
30 NEXT A
40 LET BC=USR 16514
50 PRINT AT 10,10;"BC=";BC

Code: Select all

     1  REM [HEX:\
ED,5B,16,40,ED,53,7B,40,\
2A,0C,40,23,22,16,40,DF,\
CD,48,15,CD,8A,15,2A,7B,\
40,22,16,40,C9 ]

    10 FOR A=0 TO 3
    20 PRINT AT 0,A;CHR$ (INT (RND*10)+28)
    30 NEXT A
    40 LET BC=USR 16514
    50 PRINT AT 10,10;"BC=";BC
NUM.P
(1.05 KiB) Downloaded 70 times
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
Post Reply