;****************************************************************************
; UseReadFromVar [SONAVAR_VMARG]
;
; Opcode prefix, hijacks ReadByte to fetch the bytes for the following
; opcode from VM variables instead of ROM.
;----------------------------------------------------------------------------
; input c ..... current bank
; input hl .... current address
;----------------------------------------------------------------------------
; output c .... new bank
; output hl ... new address
;----------------------------------------------------------------------------
; continues in ProcessOpcodeDirectly (to execute the opcode following this)
; then ProcessStreamLoop
;****************************************************************************
UseReadFromVar:
ReadArgByte ; Read variable to read from (1st
ld a, b ; operand byte, following bytes are
ld (ReadByteFromVarId), a ; read from consecutive variables)
ld de, ReadByteFromVar ; Now swap the function called by
ld (ReadArgByteFunc), de ; the ReadArgByte macro to call the
; one that reads data from the VM
; variables
pop de ; We won't use the return address
jp ProcessOpcodeDirectly ; Proceed to process the opcode now