diff --git a/doc/ca65.sgml b/doc/ca65.sgml
index 19fd3aa2a..276a2b697 100644
--- a/doc/ca65.sgml
+++ b/doc/ca65.sgml
@@ -183,7 +183,7 @@ Here is a description of all the command line options:
Enable an emulation feature. This is identical as using
@@ -2825,6 +2825,23 @@ See: ,
+
+ Affects 65816 mode only.
+
+ Allows jsr and jmp to produce long jumps if the target
+ address has been previously declared in a far segment,
+ or imported as far.
+ Otherwise jsl and jml must be used instead.
+
+ Also allows to convert rts
+ to a long return rtl when the enclosing scope or memory model
+ indicates returning from a far procedure.
+
+ This permits compatibility with the old behavior of this assembler, or other
+ assemblers which similarly allowed jsr and jmp to be used
+ this way.
+
loose_char_term
Accept single quotes as well as double quotes as terminators for char
@@ -3994,7 +4011,9 @@ See: ,In 65816 mode, replace a In 65816 mode, if the feature is enabled,
+ smart mode will replace a AddrSize == ADDR_SIZE_FAR) {
+ if (LongJsrJmpRts) {
+ PutJMP (Ins);
+ } else {
+ InsDesc InsAbs = *Ins;
+ InsAbs.AddrMode &= ~(AM65_ABS_LONG);
+ PutJMP (&InsAbs);
+ }
+}
+
+
+
+static void PutJSR816 (const InsDesc* Ins)
+/* Handle the JSR instruction for the 816.
+** Allowing the long_jsr_jmp_rts feature to permit a long JSR.
+*/
+{
+ if (LongJsrJmpRts) {
+ PutAll (Ins);
+ } else {
+ InsDesc InsAbs = *Ins;
+ InsAbs.AddrMode &= ~(AM65_ABS_LONG);
+ PutJMP (&InsAbs);
+ }
+}
+
+
+
+static void PutRTS (const InsDesc* Ins attribute ((unused)))
+/* Handle the RTS instruction for the 816. In smart mode emit a RTL opcode if
+** the enclosing scope is FAR, but only if the long_jsr_jmp_rts feature applies.
+*/
+{
+ if (LongJsrJmpRts && SmartMode && CurrentScope->AddrSize == ADDR_SIZE_FAR) {
Emit0 (0x6B); /* RTL */
} else {
Emit0 (0x60); /* RTS */