Knowledge Base

Some of the the NVEM instructions can also take advantage of jndexing. Specifically these are: NVfReadW, NVfReadQ, NVfWriteW, NVPopByte and NVPushByte. These are the same instructions that have an indexed version.

Example:

In the previous lesson I used a BranchJ to change the mapping between inputs and outputs in the good old on/off light switch example. In this program the mapping is done using a table in NVEM0.

(Click here for some tips for working around problems with copy and paste out of Internet Explorer and HTML-help (.chm) files)

        LaunchTask      Toggle,0
LaunchTask Toggle,1
LaunchTask Toggle,2
LaunchTask Toggle,3
RunTasksForever

Toggle:
WaitOnK 0
GoSub MapOutput
iOn 0
WaitOnK 0
GoSub MapOutput
iOff 0

GoTo Toggle
;---------------------------------------
;Given an input number in J, get the corresponding
;re-mapped output number to I.
MapOutput:
NVSetPtr MapTable
NVSetRecNum 0
NVPushByte 0 ;Read the table -> X
XtoI ;Transfer it to I
Return
;----------------------------------
NVEM0 ;Start of NVEM0 space
MapTable:
NV0Byte 1,6,7,0