private IEnumerable <AssemblyLine> Ldsflda(Instruction instruction) { var fieldDefinition = (FieldDefinition)instruction.Operand; yield return(LDA($"#{LabelGenerator.GetFromField(fieldDefinition)}")); yield return(PHA()); }
private IEnumerable <Symbol> LayoutGlobals() { var staticVariablesByType = Program.Types.SelectMany(t => t.Fields).GroupBy(f => f.FieldDefinition.DeclaringType); foreach (var fieldGrouping in staticVariablesByType) { foreach (var field in fieldGrouping.Where(f => f.FieldDefinition.IsStatic).OrderBy(f => f.Name)) { yield return(DefineSymbol(LabelGenerator.GetFromField(field.FieldDefinition), NextGlobal).WithComment($"{field.FieldType.Name} - {field.FieldType.TotalSize} bytes")); AdvanceNextGlobal(field.FieldType.TotalSize); } } }
private IEnumerable <AssemblyLine> Stsfld(Instruction instruction) { var fieldDefinition = (FieldDefinition)instruction.Operand; var(_, processedField) = GetProcessedInfo(fieldDefinition); if (processedField.FieldType.TotalSize == 1) { yield return(PLA()); yield return(STA(LabelGenerator.GetFromField(fieldDefinition))); yield break; } for (var i = processedField.FieldType.TotalSize - 1; i >= 0; i--) { yield return(PLA()); yield return(STA(LabelGenerator.GetFromField(fieldDefinition), i)); } }