Does the @-operator work for method-parameters? (ealier How does the pasm-code of FDX
StefanL38
Posts: 2,292
Hi,
I want to write a VGA-2-FDX-wrapper.
The One-wire-Demo-code is written for VGA-Text or tv_text-driver
Some of the methods of VGA_text /TV_text differ from FDX.
So I want to write a variant of the FDX-object that has methods that
only the object-filename "vga_text" must be changed to "FDX_VGA_Text_Wrapper".
This means my FDX_VGA_Text_Wrapper-object must have f.e. a method
"start" with a single parameter naming the Tx-Pin.
The FDX-code still needs the other parameters Rx, mode and baudrate
So I want to hardcode these parameters but how?
I looked into the original start-method of FDX-code
How the heck does the pasm-code get the tx-pin-number???
Does the @-operator work for method-parameters just the same as for global variables??
If yes - cool! Of not how the heck does it work?
Can somebody explain this to me?
best regards
Stefan
I want to write a VGA-2-FDX-wrapper.
The One-wire-Demo-code is written for VGA-Text or tv_text-driver
Some of the methods of VGA_text /TV_text differ from FDX.
So I want to write a variant of the FDX-object that has methods that
only the object-filename "vga_text" must be changed to "FDX_VGA_Text_Wrapper".
This means my FDX_VGA_Text_Wrapper-object must have f.e. a method
"start" with a single parameter naming the Tx-Pin.
The FDX-code still needs the other parameters Rx, mode and baudrate
So I want to hardcode these parameters but how?
I looked into the original start-method of FDX-code
PUB start(rxpin, txpin, mode, baudrate) : okay stop longfill(@rx_head, 0, 4) longmove(@rx_pin, @rxpin, 3) bit_ticks := clkfreq / baudrate buffer_ptr := @rx_buffer okay := cog := cognew(@entry, @rx_head) + 1
How the heck does the pasm-code get the tx-pin-number???
Does the @-operator work for method-parameters just the same as for global variables??
If yes - cool! Of not how the heck does it work?
Can somebody explain this to me?
best regards
Stefan
Comments
Aha. So this means the @-operator works for global variables defined in the VAR-section AND works for method-parameters?
best regards
Stefan
You can see from this code they pass the beginning of hub variable rx_head to start which tx_pin comes shortly after.
My fault. I was writing a question in the title and this question was answered.
What I wanted to ask was something addtional:
Does the @-operator work for SPIN-method-parameters too?
Answer with Yes or No
best regards
Stefan
.. but you must be careful. These local variables (and parameters) are on the stack and therefore the adresses of the variables are only valid until you leave that methode.
Andy
and that's the reason why FDX has the command
which copies the values from the parameters "rxpin" "txpin" "mode" to the global variables
of the FDX-SPIN-file named very similar "rx_pin", "tx_pin", "rxtx_mode"
best regards
Stefan