ProgramMemory<OT extends ProgramOperation> class Null safety

A representation of the calculator's 406 nybble data store as a list of program instructions. ProgramMemory takes over space from register storage as needed. We also keep the return stack for GSB instructions here, and the current program line.

ProgramMemory takes care of the 15C's two-byte program instructions (cf. 15C manual page 218). For example, if line 3 is F-ENG-2, the next line will be line 4, despite the fact that F-ENG-2 takes up two bytes.

Implementers

Constructors

ProgramMemory(Memory<OT> memory, OperationMap<OT> layout, int returnStackSize, ProgramOperation _rtn)

Properties

bytesToNextAllocation int
read-only
currentLine int
read / write
hasExtended bool
read-only
hashCode int
The hash code for this object.
read-onlyinherited
isRunning bool
read-only
lines int
Number of lines in the program
read-only
listing List<String>
read-only
memory Memory<OT>
final
programBytes int
read-only
programListener ProgramListener
This is a testing hook; tests can override this to tweak behaviors and detect events.
read / write
returnStackPos int
read-only
returnStackUnderflow bool
read-only
runner MProgramRunner?
read / write
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
suspendedProgram MProgramRunner?
read / write

Methods

adjustStackForRunStopStarting() → void
A RunStop keypress can resume a program, in which case the return stack should be left undisturbed. It can also start a "new" program run, so we need to be sure the return stack isn't in underflow
debugReturnStack() String
decodeJson(Map<String, dynamic> json) → void
Must be called after the register storage has been read in, so any stray data will be properly zeroed out.
deleteCurrent() → void
displayCurrent({bool flash = false, bool delayed = false}) → void
doNextIf(bool condition) → void
getAllInstructions() List<ProgramInstruction<OT>>
getCurrent() ProgramInstruction<OT>
gosub(int label) → void
goto(int label) → void
gotoOpCode(int wanted) → void
importProgram(String listing) → void
importProgramFromFile(Uint8List original) → void
incrementCurrentLine() → void
Increment the current line, up to a max of lines, wrapping to 0. To be clear, there are lines+1 possible values.
insert(ProgramInstruction<OT> instruction) → void
Insert a new instruction, and increment currentLine to refer to it.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
opcodeAt(int line) int
popReturnStack() → void
reset({bool zeroMemory = true}) → void
resetReturnStack() → void
skipIfRunning() → void
stepCurrentLine(int sign) → void
toJson() Map<String, dynamic>
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](int line) ProgramInstruction<OT>
line counts from 1, with a phantom return at line 0