#Assembler #cross-assembler #Assembler #cross-assembler
I am using A18 assembler and trying "MARK" subroutine technique explained CDP1802 user manual page 58.
It works very well when call subroutine without parameters. But there is also possibility to provide some parameters to subroutine call and then in subroutine use "LDXA" for getting it.
How can I pass an argument to call?
In Manual, there is something like:
SEP RB .. Call "SUB2" PC becomes R(B)
,#24 · . Pass a data byte to "SUB2"
but I don't really understand this part.
Does anyone have an example of calling subroutine and passing one or more arguments?
On 1/7/20 3:56 PM, btrenkoski via Groups.Io wrote:
In SUB2 you use LDXA and MARK set X to the old P so this grabs the
inline data. This loads the data and advances the register so that when
you eventually do a SEP, it will point at code and not data.
The function TYPE6 in UT71 does something like this but with SCRT. In
SCRT, R6 holds the previous program counter so LDA R6 picks up the
argument following the call. For example:
DB ' ' ;SPACE STARTS COMMAND
Prints a single space.
(Web pages available only at the Wayback Machine because Earthlink
terminated that service.)