# m command (FlashBASIC Debugger)

The m command toggles modal trapping on and off.

## Syntax

```
 m
```

## Description

A modal trap occurs whenever an external subroutine is called, returned from, or when a
 mainline program enters another mainline program. In response to the modal trap, type the
 m command to toggle the modal trap ON or OFF depending on the trap’s
 previous state.

 When a modal trap occurs, it will be indicated by entering the BASIC debugger (*****), and
 one of these prompts appears:

| *MCxxx | Indicates the modal trap was caused by a CALL statement. xxx indicates the source code line number in the entered program (should be line 1). |
| --- | --- |
| *MRxxx | Indicates the modal trap was caused by a RETURN from the called subroutine. xxx indicates the source code line number in the calling program where the return occurred. |
| *MExxx | Indicates the modal trap was caused by an ENTER statement. xxx indicates the source code line number in the entered program (should be line 1). |

 In response to the previous modal traps, type the m command at the *****
 prompt to toggle the modal trap ON or OFF. While in this mode, using the g
 command will resume execution until the next modal trap occurs.

## Example(s)

**Example 1**

 This example shows one main program calling a subroutine:

```

 main
 001 debug
 002 print "calling sub"
 003 call subr
 004 print "returned from sub"

 subr
 001 subroutine subr
 002 print "in the sub"
 003 return10
```

 **Example 2**

 This example shows program execution showing modal trapping on:

```

 :main

 *I1
 *m on
 *g calling sub

 *MC subr 1
 *g in the sub

 *MR main 3
 *g returned from sub
 :
```

## See also

- [g command (FlashBASIC Debugger)](https://d3codex.com/flashbasicdebugger/g-command-flashbasic-debugger/)

---
Source: https://d3codex.com/flashbasicdebugger/m-command/ - part of the D3Codex reference.
