M jasm/assembling/instructions_6502.cpp +13 -0
@@ 235,6 235,19 @@ bool is_ending_instruction(InstructionTy
|| type == InstructionType::Rts;
}
+bool is_stack_instruction(InstructionType type)
+{
+ return
+ type == InstructionType::Brk
+ || type == InstructionType::Jsr
+ || type == InstructionType::Pha
+ || type == InstructionType::Php
+ || type == InstructionType::Pla
+ || type == InstructionType::Plp
+ || type == InstructionType::Rti
+ || type == InstructionType::Rts;
+}
+
const std::string_view to_string(AddressingModeType type)
{
const static std::string_view names[] = {
M jasm/assembling/instructions_6502.h +2 -0
@@ 149,6 149,8 @@ InstructionType inverse_branch(Instructi
/// Returns true if the instruction doesn't provide a fall-through branch.
bool is_ending_instruction(InstructionType type);
+/// Returns true if the instruction is guaranteed to affect the stack.
+bool is_stack_instruction(InstructionType type);
/// Convert an addressing mode to a string for printing.
const std::string_view to_string(AddressingModeType type);