OpenCores
URL https://opencores.org/ocsvn/ssbcc/ssbcc/trunk

Subversion Repositories ssbcc

[/] [ssbcc/] [trunk/] [core/] [9x8/] [macros/] [fetchoffset.py] - Diff between revs 5 and 11

Show entire file | Details | Blame | View Log

Rev 5 Rev 11
Line 1... Line 1...
# Copyright 2014, Sinclair R.F., Inc.
# Copyright 2014-2015, Sinclair R.F., Inc.
 
 
 
from asmDef import AsmException
 
 
def fetchoffset(ad):
def fetchoffset(ad):
  """
  """
  Built-in macro to copy the value at the specified offset into the specified
  Built-in macro to copy the value at the specified offset into the specified
  variable to the top of the data stack.\n
  variable to the top of the data stack.\n
Line 21... Line 23...
 
 
  # Define the macro functionality.
  # Define the macro functionality.
  def emitFunction(ad,fp,argument):
  def emitFunction(ad,fp,argument):
    (addr,ixBank,bankName) = ad.Emit_GetAddrAndBank(argument[0]);
    (addr,ixBank,bankName) = ad.Emit_GetAddrAndBank(argument[0]);
    offset = ad.Emit_EvalSingleValue(argument[1]);
    offset = ad.Emit_EvalSingleValue(argument[1]);
 
    if addr+offset >= 256:
 
      raise asmDef.AsmException('Unreasonable address+length=0x%02X+0x%02X >= 256 at %s' % (addr,N,argument[0]['loc'],))
    ad.EmitPush(fp,addr+offset,ad.Emit_String('%s+%s' % (argument[0]['value'],offset,)),argument[0]['loc']);
    ad.EmitPush(fp,addr+offset,ad.Emit_String('%s+%s' % (argument[0]['value'],offset,)),argument[0]['loc']);
    ad.EmitOpcode(fp,ad.specialInstructions['fetch'] | ixBank,'fetch '+bankName);
    ad.EmitOpcode(fp,ad.specialInstructions['fetch'] | ixBank,'fetch '+bankName);
 
 
  ad.EmitFunction['.fetchoffset'] = emitFunction;
  ad.EmitFunction['.fetchoffset'] = emitFunction;
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.