multiple parameter for single USR ?

By DanySoft

Expert (125)

DanySoft's picture

27-12-2011, 23:16

Before you say, Merry Christmas! Santa
Second, can not use A = USR (x, y, ...) with assembleer,
with parameters (user for CALL & CMD Smile&nbspWink
This sources : 

USR1:
  ld a,($F663)
  cp 2
  ret nz
  ld hl,($F7F8)
  ret

This source is used to manage the parameters of the USR
but I do not know which log should I take before using the FRMEVL?
Bye Bye.

Login or register to post comments

By NYYRIKKI

Prophet (2771)

NYYRIKKI's picture

28-12-2011, 16:46

Not possible, sorry. Formula evaluation has already been done before calling external routine pointed by DEFUSR. You can only read the result.

By Google

By DanySoft

Expert (125)

DanySoft's picture

28-12-2011, 21:18

Okey,  oO
Else defined the USR with this my example :

X=100 : Y= 100 
    DEFUSR=&Hd000
    A=USR ( Y*256 + X)

Other parameter ?  Adds with POKE  as SPRITE, COLOUR !! This is used for SPRITE, group of SPRITE is move on two bytes : X,Y ! 
Bye Bye Big smile 
 

By umaiboux

Supporter (9)

umaiboux's picture

29-12-2011, 15:45

multiple USR for single command ! Smile

DEFUSR1=&HD000 ' set value
DEFUSR2=&HD00A ' set address and execute
DEFFNW(AD,V)=USR2(0*USR1(V)+AD)
......
A=FNW(&H9000,&H3F)

By NYYRIKKI

Prophet (2771)

NYYRIKKI's picture

29-12-2011, 16:24

Big smile

By DanySoft

Expert (125)

DanySoft's picture

29-12-2011, 21:24

Ok.
This error is encountered cause DEF FN (CALL TURBO ON)
Disable TURBO and define parameter with DEF FN for multiple USR!
Thank you ! Big smile

By NYYRIKKI

Prophet (2771)

NYYRIKKI's picture

30-12-2011, 03:55

IF you use X-BASIC, then you can forget DEFUSR & USR:

10 _TURBO ON
20 DEFINT A-Z
30 X=500:Y=100:C=8
40 ' CALL ML Program in #D000 with paramaters X,Y,C:
50 '#I &HCD,0,&HD0,X,Y,C

Reading parameters in ML:

ORG #D000

POP HL
LD E,(HL)
INC HL
LD D,(HL)
INC HL
LD A,(DE)
LD IXL,A
INC DE
LD A,(DE)
LD IXH,A

LD E,(HL)
INC HL
LD D,(HL)
INC HL
LD A,(DE)
LD IYL,A
INC DE
LD A,(DE)
LD IYH,A

LD E,(HL)
INC HL
LD D,(HL)
INC HL
LD A,(DE)
LD C,A
INC DE
LD A,(DE)
LD B,A
PUSH HL

; IX = X
; IY = Y
; BC = C

: <Do something>

RET

 

By DanySoft

Expert (125)

DanySoft's picture

30-12-2011, 21:44

Again source ? This is sufficient to make sprite on 1 line on BASIC!

Again, tank You! Big smile

Bye bye

By konamiman

Paladin (675)

konamiman's picture

30-12-2011, 23:01

Put your parameters in an integer array, then pass the array address to the USR command.

Example: BASIC:

DEFINT P
    P(0) = 12
    P(1) = 34
    P(2) = 56 'etc...
    ?USR(VARPTR(P(0)))

Assembler:

INC HL
    INC HL
    LD A,(HL)
    INC HL
    LD H,(HL)
    LD L,A ;Now HL = Address of P(0)

    LD A,(HL) ;Now A = 12
    INC HL
    INC HL
    LD A,(HL) ;Now A = 34
    INC HL
    INC HL
    LD A,(HL) ;Now A = 56, etc...

Warning: 100% untested example! But you get the idea Smile
 

 

My MSX profile