c128lib Common
Various common functionalities.
Loading...
Searching...
No Matches
invoke-global.asm File Reference

Invoke module. More...

Functions

macro c128lib_invokeStackBegin (value)
 
macro c128lib_invokeStackEnd (value)
 
macro c128lib_pushParamB (value)
 
macro c128lib_pushParamW (value)
 
macro c128lib_pushParamBInd (value)
 
macro c128lib_pushParamWInd (value)
 
macro c128lib_pullParamB (value)
 
macro c128lib_pullParamW (value)
 
macro c128lib_pullParamWList (list)
 

Detailed Description

Invoke module.

Set of KickAssembler macros for subroutine implementation.

With these macros one can realize communication with subroutines using stack. This approach is following:

1) subroutine caller prepares input parameters and pushes them to the stack using push*() macros

2) subroutine is then called using JSR

3) subroutine first preserves return address in local variable using invokeStackBegin(variablePtr) macro

4) subroutine then pulls all pushed parameters in opposite order using pull*() macros

5) when subroutine is about to end, just before RTS is called, it must restore return address with invokeStackEnd(varPtr) macro

Date
2022

Function Documentation

◆ c128lib_invokeStackBegin()

macro c128lib_invokeStackBegin ( value )

Preserves return address that is used with JSR. Should be called at beginning of subroutine.

Parameters
[out]valuePointer to the memory location (that is local variable of the subroutine) where return address will be preserved.
Since
0.6.0

◆ c128lib_invokeStackEnd()

macro c128lib_invokeStackEnd ( value )

Restores return address that will be then used with RTS. Should be called at the very end of subroutine just before RTS.

Parameters
[in]valuePointer to the memory location (that is local variable of the subroutine) from where return address will be restored.
Since
0.6.0

◆ c128lib_pullParamB()

macro c128lib_pullParamB ( value )

Pulls byte value from the stack and stores it under given address.

Parameters
[out]valuePointer to the memory location where given byte will be pulled to
Since
0.6.0

◆ c128lib_pullParamW()

macro c128lib_pullParamW ( value )

Pulls two bytes value from the stack and stores it under given address.

Parameters
[out]valuePointer to the beginning of memory location where given two bytes will be pulled to
Since
0.6.0

◆ c128lib_pullParamWList()

macro c128lib_pullParamWList ( list )

Pulls two bytes value from the stack and stores it under provided addresses.

Parameters
[out]listList of memory locations, where given two byte value will be stored
Since
0.6.0

◆ c128lib_pushParamB()

macro c128lib_pushParamB ( value )

Pushes byte value as a parameter to the subroutine. Such value should be then pulled in subroutine in opposite order.

Parameters
[in]valueByte value of the parameter for subroutine
Since
0.6.0

◆ c128lib_pushParamBInd()

macro c128lib_pushParamBInd ( value )

Pushes byte pointed by an address as a parameter to the subroutine. Such value should be then pulled in subroutine in opposite order.

Parameters
[in]valuePointer to the byte value of the parameter for subroutine
Since
0.6.0

◆ c128lib_pushParamW()

macro c128lib_pushParamW ( value )

Pushes two bytes value as a parameter to the subroutine. Such value should be then pulled in subroutine in opposite order.

Parameters
[in]valueWord value of the parameter for subroutine
Since
0.6.0

◆ c128lib_pushParamWInd()

macro c128lib_pushParamWInd ( value )

Pushes two bytes value pointed by an address as a parameter to the subroutine. Such value should be then pulled in subroutine in opposite order.

Parameters
[in]valuePointer to the two bytes value of the parameter for subroutine
Since
0.6.0