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

Subversion Repositories ssbcc

[/] [ssbcc/] [trunk/] [core/] [9x8/] [macros/] [storeoffset.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 storeoffset(ad):
def storeoffset(ad):
  """
  """
  Built-in macro to store the top of the data stack at the specified offset
  Built-in macro to store the top of the data stack at the specified offset
  into the specified variable.\n
  into the specified variable.\n
Line 18... Line 20...
 
 
  # Add the macro to the list of recognized macros.
  # Add the macro to the list of recognized macros.
  ad.AddMacro('.storeoffset', 3, [
  ad.AddMacro('.storeoffset', 3, [
                                   ['','symbol'],
                                   ['','symbol'],
                                   ['','singlevalue','symbol'],
                                   ['','singlevalue','symbol'],
                                   ['drop','instruction','singlemacro','singlevalue','symbol']
                                   ['drop','instruction','parameter','singlemacro','singlevalue','symbol']
                                 ]);
                                 ]);
 
 
  # 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['store'] | ixBank,'store '+bankName);
    ad.EmitOpcode(fp,ad.specialInstructions['store'] | ixBank,'store '+bankName);
    ad.EmitOptArg(fp,argument[2]);
    ad.EmitOptArg(fp,argument[2]);
 
 
  ad.EmitFunction['.storeoffset'] = emitFunction;
  ad.EmitFunction['.storeoffset'] = emitFunction;

powered by: WebSVN 2.1.0

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