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.

Constructors

ProgramMemory(Memory<ProgramOperation> _memory, ByteData _registerStorage, List<OT> _operationTable)

Properties

bytesToNextAllocation int
read-only
currentLine int
read / write
hashCode int
The hash code for this object. [...]
read-only, inherited
lines int
Number of lines in the program
read-only
listing List<String>
read-only
programBytes int
read-only
programListener ProgramListener
This is a testing hook. In normal operation, it's always null.
read / write
returnStackUnderflow bool
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

decodeJson(Map<String, dynamic> json) → void
Must be called after the register storage has been read in, so any stray data will be propely zeroed out.
deleteCurrent() → void
displayCurrent({bool flash = false, bool delayed = false}) → void
doNextIf(bool condition) → void
getCurrent() ProgramInstruction<OT>
gosub(int label) → void
goto(int label) → void
handleRunStopKepyress() → void
A RunStop keypress can resume a program, in which case the return stack shoould be left undisturbed. It can also start a "new" program run, so we need to be sure the return stack isn't in underflow
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
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