Terminal control/Preserve screen: Difference between revisions

Content added Content deleted
(Terminal control/Preserve screen in FreeBASIC)
m (syntax highlighting fixup automation)
Line 12: Line 12:
{{trans|Python}}
{{trans|Python}}


<lang 11l>print("\033[?1049h\033[H")
<syntaxhighlight lang="11l">print("\033[?1049h\033[H")
print(‘Alternate buffer!’)
print(‘Alternate buffer!’)


Line 19: Line 19:
sleep(1)
sleep(1)


print("\033[?1049l")</lang>
print("\033[?1049l")</syntaxhighlight>


=={{header|Action!}}==
=={{header|Action!}}==
<lang Action!>PROC Wait(BYTE frames)
<syntaxhighlight lang="action!">PROC Wait(BYTE frames)
BYTE RTCLOK=$14
BYTE RTCLOK=$14
frames==+RTCLOK
frames==+RTCLOK
Line 48: Line 48:
Wait(200)
Wait(200)
MoveBlock(ptr,buffer,size) ;restore screen content
MoveBlock(ptr,buffer,size) ;restore screen content
RETURN</lang>
RETURN</syntaxhighlight>
{{out}}
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Preserve_screen.png Screenshot from Atari 8-bit computer]
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Preserve_screen.png Screenshot from Atari 8-bit computer]
Line 54: Line 54:
=={{header|Applesoft BASIC}}==
=={{header|Applesoft BASIC}}==
Restores 40 x 24 TEXT screen, cursor position, display mode, and speed. Adjusts HIMEM to make room to store 1024 bytes aligned to the 256 byte page boundary. POKEs a machine language "copy 4 pages of memory" routine into page 3.
Restores 40 x 24 TEXT screen, cursor position, display mode, and speed. Adjusts HIMEM to make room to store 1024 bytes aligned to the 256 byte page boundary. POKEs a machine language "copy 4 pages of memory" routine into page 3.
<lang ApplesoftBasic> 10 LET FF = 255:FE = FF - 1
<syntaxhighlight lang="applesoftbasic"> 10 LET FF = 255:FE = FF - 1
11 LET FD = 253:FC = FD - 1
11 LET FD = 253:FC = FD - 1
12 POKE FC, 0 : POKE FE, 0
12 POKE FC, 0 : POKE FE, 0
Line 103: Line 103:
61 CALL R : POKE 241, S
61 CALL R : POKE 241, S
62 VTAB V + 1 : HTAB C + 1
62 VTAB V + 1 : HTAB C + 1
63 POKE 50, M : POKE 243, F</lang>
63 POKE 50, M : POKE 243, F</syntaxhighlight>


=={{header|BBC BASIC}}==
=={{header|BBC BASIC}}==
{{works with|BBC BASIC for Windows}}
{{works with|BBC BASIC for Windows}}
The screen is saved as a bitmap:
The screen is saved as a bitmap:
<lang bbcbasic> PRINT "This is the original screen"
<syntaxhighlight lang="bbcbasic"> PRINT "This is the original screen"
OSCLI "GSAVE """ + @tmp$ + "bbcsave"""
OSCLI "GSAVE """ + @tmp$ + "bbcsave"""
WAIT 200
WAIT 200
Line 114: Line 114:
PRINT "This is the new screen, following a CLS"
PRINT "This is the new screen, following a CLS"
WAIT 200
WAIT 200
OSCLI "DISPLAY """ + @tmp$ + "bbcsave"""</lang>
OSCLI "DISPLAY """ + @tmp$ + "bbcsave"""</syntaxhighlight>


=={{header|Befunge}}==
=={{header|Befunge}}==
Line 120: Line 120:
Assuming a terminal with support for Xterm's [http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-The-Alternate-Screen-Buffer ''alternate screen buffer''] escape sequences (which I believe is fairly standard these days), this example will switch to the alternate screen buffer, output "Press <Enter> to restore..." in the top left corner, and then restore the original screen.
Assuming a terminal with support for Xterm's [http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-The-Alternate-Screen-Buffer ''alternate screen buffer''] escape sequences (which I believe is fairly standard these days), this example will switch to the alternate screen buffer, output "Press <Enter> to restore..." in the top left corner, and then restore the original screen.


<lang befunge>"h9401?["39*>:#,_"...erotser ot >retnE< sserPH["39*>:#,_~$"l9401?["39*>:#,_@</lang>
<syntaxhighlight lang="befunge">"h9401?["39*>:#,_"...erotser ot >retnE< sserPH["39*>:#,_~$"l9401?["39*>:#,_@</syntaxhighlight>


=={{header|C}}==
=={{header|C}}==
For Xterm. "Allow alternate screen buffer" must be enabled by the popup menu.<lang C>#include <stdio.h>
For Xterm. "Allow alternate screen buffer" must be enabled by the popup menu.<syntaxhighlight lang="c">#include <stdio.h>
#include <unistd.h>
#include <unistd.h>


Line 139: Line 139:


return 0;
return 0;
}</lang>
}</syntaxhighlight>


=={{header|Common Lisp}}==
=={{header|Common Lisp}}==
{{trans|C}}
{{trans|C}}
<lang lisp>
<syntaxhighlight lang="lisp">
(format t "~C[?1049h~C[H" (code-char #O33) (code-char #O33))
(format t "~C[?1049h~C[H" (code-char #O33) (code-char #O33))
(format t "Alternate screen buffer~%")
(format t "Alternate screen buffer~%")
Line 151: Line 151:
))
))
(format t "~C[?1049l" (code-char #O33))
(format t "~C[?1049l" (code-char #O33))
</syntaxhighlight>
</lang>


==={{header|ncurses}}===
==={{header|ncurses}}===
When the ncurses terminal library is used, characters are displayed on an alternate screen of the terminal. Leaving ncurses returns to the original screen buffer with the previous content preserved. To interface ncurses from Lisp, the ''croatoan'' library is used.
When the ncurses terminal library is used, characters are displayed on an alternate screen of the terminal. Leaving ncurses returns to the original screen buffer with the previous content preserved. To interface ncurses from Lisp, the ''croatoan'' library is used.
<lang lisp>(defun clear-test ()
<syntaxhighlight lang="lisp">(defun clear-test ()
;; starting a ncurses screen enters the alternate screen buffer of the terminal
;; starting a ncurses screen enters the alternate screen buffer of the terminal
(with-screen (scr :input-echoing nil :input-blocking t)
(with-screen (scr :input-echoing nil :input-blocking t)
Line 165: Line 165:
(refresh scr)
(refresh scr)
(get-char scr)))
(get-char scr)))
;; leaving ncurses returns the terminal to the main screen buffer</lang>
;; leaving ncurses returns the terminal to the main screen buffer</syntaxhighlight>


=={{header|Emacs Lisp}}==
=={{header|Emacs Lisp}}==


<lang lisp>#!/usr/local/bin/emacs --script
<syntaxhighlight lang="lisp">#!/usr/local/bin/emacs --script
;; -*- lexical-binding: t; -*-
;; -*- lexical-binding: t; -*-


Line 185: Line 185:


;; "ESC [ ? 1049 l" - Disable alternative screen buffer
;; "ESC [ ? 1049 l" - Disable alternative screen buffer
(princ "\033[?1049l")</lang>
(princ "\033[?1049l")</syntaxhighlight>


=={{header|Forth}}==
=={{header|Forth}}==
{{trans|C}}
{{trans|C}}
{{works with|gforth|0.7.3}}
{{works with|gforth|0.7.3}}
<lang forth>.\" \033[?1049h\033[H" \ preserve screen
<syntaxhighlight lang="forth">.\" \033[?1049h\033[H" \ preserve screen
." Press any key to return" ekey drop
." Press any key to return" ekey drop
.\" \033[?1049l" \ restore screen</lang>
.\" \033[?1049l" \ restore screen</syntaxhighlight>




=={{header|FreeBASIC}}==
=={{header|FreeBASIC}}==
<lang freebasic>'' 640x480x8, with 3 pages
<syntaxhighlight lang="freebasic">'' 640x480x8, with 3 pages
Screen 12,,3
Screen 12,,3
Windowtitle "Terminal control/Preserve screen"
Windowtitle "Terminal control/Preserve screen"
Line 223: Line 223:
Next i
Next i
Screencopy 1, 0
Screencopy 1, 0
Sleep</lang>
Sleep</syntaxhighlight>




Line 229: Line 229:
{{trans|C}}
{{trans|C}}
{{works with|Ubuntu 16.04}}
{{works with|Ubuntu 16.04}}
<lang go>package main
<syntaxhighlight lang="go">package main


import (
import (
Line 248: Line 248:
}
}
fmt.Print("\033[?1049l")
fmt.Print("\033[?1049l")
}</lang>
}</syntaxhighlight>


=={{header|Java}}==
=={{header|Java}}==
{{trans|C}}
{{trans|C}}
{{works with|Ubuntu 16.04}}
{{works with|Ubuntu 16.04}}
<lang java>public class PreserveScreen
<syntaxhighlight lang="java">public class PreserveScreen
{
{
public static void main(String[] args) throws InterruptedException {
public static void main(String[] args) throws InterruptedException {
Line 265: Line 265:
System.out.print("\033[?1049l");
System.out.print("\033[?1049l");
}
}
}</lang>
}</syntaxhighlight>


=={{header|JavaScript}}==
=={{header|JavaScript}}==
<lang javascript>(function() {
<syntaxhighlight lang="javascript">(function() {
var orig= document.body.innerHTML
var orig= document.body.innerHTML
document.body.innerHTML= '';
document.body.innerHTML= '';
Line 277: Line 277:
}, 1000);
}, 1000);
}, 1000);
}, 1000);
})();</lang>
})();</syntaxhighlight>


This implementation assumes that Javascript is running in the browser.
This implementation assumes that Javascript is running in the browser.
Line 285: Line 285:
=={{header|Julia}}==
=={{header|Julia}}==
{{trans|C}}
{{trans|C}}
<lang julia>const ESC = "\u001B" # escape code
<syntaxhighlight lang="julia">const ESC = "\u001B" # escape code


print("$ESC[?1049h$ESC[H")
print("$ESC[?1049h$ESC[H")
Line 292: Line 292:
print("$ESC[?1049l\n\n\n")
print("$ESC[?1049l\n\n\n")


</syntaxhighlight>
</lang>


=={{header|Kotlin}}==
=={{header|Kotlin}}==
{{trans|C}}
{{trans|C}}
{{Works with|Ubuntu|14.04}}
{{Works with|Ubuntu|14.04}}
<lang scala>// version 1.1.2
<syntaxhighlight lang="scala">// version 1.1.2


const val ESC = "\u001B"
const val ESC = "\u001B"
Line 309: Line 309:
}
}
print("$ESC[?1049l")
print("$ESC[?1049l")
}</lang>
}</syntaxhighlight>


=={{header|M2000 Interpreter}}==
=={{header|M2000 Interpreter}}==
Line 317: Line 317:
If we change Mode (size of font), or Window size (console witdh/height), or use a Form statement to set character resolution (number characters in a row by row number) which automatic calculate size and line spacing, then saved consoled bitmap erased. To preserve screen from this situation we have to preserve last form's arguments, or window's arguments or mode's argument.
If we change Mode (size of font), or Window size (console witdh/height), or use a Form statement to set character resolution (number characters in a row by row number) which automatic calculate size and line spacing, then saved consoled bitmap erased. To preserve screen from this situation we have to preserve last form's arguments, or window's arguments or mode's argument.


<syntaxhighlight lang="m2000 interpreter">
<lang M2000 Interpreter>
Module PreserveScreen {
Module PreserveScreen {
Bold 1
Bold 1
Line 365: Line 365:
PreserveScreen
PreserveScreen


</syntaxhighlight>
</lang>


=={{header|Mathematica}}/{{header|Wolfram Language}}==
=={{header|Mathematica}}/{{header|Wolfram Language}}==
<lang Mathematica>Run["tput smcup"] (* Save the display *)
<syntaxhighlight lang="mathematica">Run["tput smcup"] (* Save the display *)
Run["echo Hello"]
Run["echo Hello"]
Pause[5] (* Wait five seconds *)
Pause[5] (* Wait five seconds *)
Run["tput rmcup"] </lang>
Run["tput rmcup"] </syntaxhighlight>


=={{header|Nim}}==
=={{header|Nim}}==
{{trans|Python}}
{{trans|Python}}
<lang nim>import os
<syntaxhighlight lang="nim">import os


echo "\e[?1049h\e[H"
echo "\e[?1049h\e[H"
Line 384: Line 384:
sleep 1000
sleep 1000


echo "\e[?1049l"</lang>
echo "\e[?1049l"</syntaxhighlight>


=={{header|Perl}}==
=={{header|Perl}}==
{{trans|C}}
{{trans|C}}
<lang perl>print "\033[?1049h\033[H";
<syntaxhighlight lang="perl">print "\033[?1049h\033[H";
print "Alternate screen buffer\n";
print "Alternate screen buffer\n";


Line 396: Line 396:
}
}


print "\033[?1049l";</lang>
print "\033[?1049l";</syntaxhighlight>


=={{header|Phix}}==
=={{header|Phix}}==
<!--<lang Phix>(notonline)-->
<!--<syntaxhighlight lang="phix">(notonline)-->
<span style="color: #008080;">without</span> <span style="color: #008080;">js</span> <span style="color: #000080;font-style:italic;">-- (save_text_image, sleep, display_text_image)</span>
<span style="color: #008080;">without</span> <span style="color: #008080;">js</span> <span style="color: #000080;font-style:italic;">-- (save_text_image, sleep, display_text_image)</span>
<span style="color: #004080;">sequence</span> <span style="color: #000000;">s</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">save_text_image</span><span style="color: #0000FF;">({</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #000000;">1</span><span style="color: #0000FF;">},</span> <span style="color: #0000FF;">{</span><span style="color: #000000;">25</span><span style="color: #0000FF;">,</span><span style="color: #000000;">80</span><span style="color: #0000FF;">})</span>
<span style="color: #004080;">sequence</span> <span style="color: #000000;">s</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">save_text_image</span><span style="color: #0000FF;">({</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #000000;">1</span><span style="color: #0000FF;">},</span> <span style="color: #0000FF;">{</span><span style="color: #000000;">25</span><span style="color: #0000FF;">,</span><span style="color: #000000;">80</span><span style="color: #0000FF;">})</span>
Line 407: Line 407:
<span style="color: #000000;">display_text_image</span><span style="color: #0000FF;">({</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #000000;">1</span><span style="color: #0000FF;">},</span> <span style="color: #000000;">s</span><span style="color: #0000FF;">)</span>
<span style="color: #000000;">display_text_image</span><span style="color: #0000FF;">({</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #000000;">1</span><span style="color: #0000FF;">},</span> <span style="color: #000000;">s</span><span style="color: #0000FF;">)</span>
<span style="color: #7060A8;">sleep</span><span style="color: #0000FF;">(</span><span style="color: #000000;">3</span><span style="color: #0000FF;">)</span>
<span style="color: #7060A8;">sleep</span><span style="color: #0000FF;">(</span><span style="color: #000000;">3</span><span style="color: #0000FF;">)</span>
<!--</lang>-->
<!--</syntaxhighlight>-->
The following also works fine on linux (but not windows, or under p2js)
The following also works fine on linux (but not windows, or under p2js)
<!--<lang Phix>(notonline)-->
<!--<syntaxhighlight lang="phix">(notonline)-->
<span style="color: #008080;">without</span> <span style="color: #008080;">js</span> <span style="color: #000080;font-style:italic;">-- (escape sequences, sleep)</span>
<span style="color: #008080;">without</span> <span style="color: #008080;">js</span> <span style="color: #000080;font-style:italic;">-- (escape sequences, sleep)</span>
<span style="color: #7060A8;">puts</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"\e[?1049h\e[H"</span><span style="color: #0000FF;">)</span>
<span style="color: #7060A8;">puts</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"\e[?1049h\e[H"</span><span style="color: #0000FF;">)</span>
Line 419: Line 419:
<span style="color: #008080;">end</span> <span style="color: #008080;">for</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">for</span>
<span style="color: #7060A8;">puts</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"\e[?1049l"</span><span style="color: #0000FF;">)</span>
<span style="color: #7060A8;">puts</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"\e[?1049l"</span><span style="color: #0000FF;">)</span>
<!--</lang>-->
<!--</syntaxhighlight>-->


=={{header|PicoLisp}}==
=={{header|PicoLisp}}==
<lang PicoLisp>#!/usr/bin/picolisp /usr/lib/picolisp/lib.l
<syntaxhighlight lang="picolisp">#!/usr/bin/picolisp /usr/lib/picolisp/lib.l


(call 'tput "smcup")
(call 'tput "smcup")
Line 429: Line 429:
(call 'tput "rmcup")
(call 'tput "rmcup")


(bye)</lang>
(bye)</syntaxhighlight>


=={{header|Python}}==
=={{header|Python}}==
Similar to the C example above:
Similar to the C example above:


<lang Python>#!/usr/bin/env python
<syntaxhighlight lang="python">#!/usr/bin/env python


import time
import time
Line 445: Line 445:
time.sleep(1)
time.sleep(1)


print "\033[?1049l"</lang>
print "\033[?1049l"</syntaxhighlight>


=={{header|R}}==
=={{header|R}}==
{{trans|C}}
{{trans|C}}
<lang R>cat("\033[?1049h\033[H")
<syntaxhighlight lang="r">cat("\033[?1049h\033[H")
cat("Alternate screen buffer\n")
cat("Alternate screen buffer\n")
for (i in 5:1) {
for (i in 5:1) {
Line 456: Line 456:
cat("\33[2J")
cat("\33[2J")
}
}
cat("\033[?1049l")</lang>
cat("\033[?1049l")</syntaxhighlight>


=={{header|Racket}}==
=={{header|Racket}}==
<syntaxhighlight lang="racket">
<lang Racket>
#lang racket
#lang racket


Line 471: Line 471:


(flash "Hello world.")
(flash "Hello world.")
</syntaxhighlight>
</lang>


=={{header|Raku}}==
=={{header|Raku}}==
(formerly Perl 6)
(formerly Perl 6)
<lang perl6>print "\e[?1049h\e[H";
<syntaxhighlight lang="raku" line>print "\e[?1049h\e[H";
say "Alternate buffer!";
say "Alternate buffer!";


Line 483: Line 483:
}
}


print "\e[?1049l";</lang>
print "\e[?1049l";</syntaxhighlight>


=={{header|REXX}}==
=={{header|REXX}}==
Line 489: Line 489:


The &nbsp; '''CLS''' &nbsp; (DOS) command is used to clear the terminal screen.
The &nbsp; '''CLS''' &nbsp; (DOS) command is used to clear the terminal screen.
<lang rexx>/*REXX program saves the screen contents and also the cursor location, then clears the */
<syntaxhighlight lang="rexx">/*REXX program saves the screen contents and also the cursor location, then clears the */
/*──── screen, writes a half screen of ~~~ lines, and then restores the original screen.*/
/*──── screen, writes a half screen of ~~~ lines, and then restores the original screen.*/


Line 507: Line 507:
end /*restore*/ /* [↑] writes (restores) SD lines. */
end /*restore*/ /* [↑] writes (restores) SD lines. */
/*stick a fork in it, we're all done. */
/*stick a fork in it, we're all done. */
call cursor curRow, curCol /*restore the original cursor position.*/</lang>
call cursor curRow, curCol /*restore the original cursor position.*/</syntaxhighlight>
This REXX program makes use of &nbsp; '''scrsize''' &nbsp; BIF which is used to determine the screen size of the terminal (console).
This REXX program makes use of &nbsp; '''scrsize''' &nbsp; BIF which is used to determine the screen size of the terminal (console).


Line 514: Line 514:
{{trans|C}}
{{trans|C}}
Uses xterm escape codes.
Uses xterm escape codes.
<lang rust>use std::io::{stdout, Write};
<syntaxhighlight lang="rust">use std::io::{stdout, Write};
use std::time::Duration;
use std::time::Duration;


Line 530: Line 530:


print!("\x1b[?1049l");
print!("\x1b[?1049l");
}</lang>
}</syntaxhighlight>
The Rust [https://doc.rust-lang.org/std/ops/struct.RangeInclusive.html inclusive range operator] is used as an iterator from 1 to 5 (inclusive). It is then reversed to count down.
The Rust [https://doc.rust-lang.org/std/ops/struct.RangeInclusive.html inclusive range operator] is used as an iterator from 1 to 5 (inclusive). It is then reversed to count down.


Line 538: Line 538:
Similar to the C example above:
Similar to the C example above:


<lang Scala>print("\033[?1049h\033[H")
<syntaxhighlight lang="scala">print("\033[?1049h\033[H")
println("Alternate buffer!")
println("Alternate buffer!")


Line 546: Line 546:
}
}


print("\033[?1049l")</lang>
print("\033[?1049l")</syntaxhighlight>


=={{header|Sidef}}==
=={{header|Sidef}}==
{{trans|Raku}}
{{trans|Raku}}
<lang ruby>print "\e[?1049h\e[H";
<syntaxhighlight lang="ruby">print "\e[?1049h\e[H";
say "Alternate buffer!";
say "Alternate buffer!";


Line 558: Line 558:
}
}


print "\e[?1049l";</lang>
print "\e[?1049l";</syntaxhighlight>


=={{header|Swift}}==
=={{header|Swift}}==
{{trans|C}}
{{trans|C}}
<lang swift>
<syntaxhighlight lang="swift">
public let CSI = ESC+"[" // Control Sequence Introducer
public let CSI = ESC+"[" // Control Sequence Introducer
func write(_ text: String...) {
func write(_ text: String...) {
Line 574: Line 574:
}
}
write(CSI,"?1049l") // close alternate screen
write(CSI,"?1049l") // close alternate screen
</syntaxhighlight>
</lang>


=={{header|Tcl}}==
=={{header|Tcl}}==
On Unix terminals only, with the help of <tt>tput</tt>:
On Unix terminals only, with the help of <tt>tput</tt>:
<lang tcl># A helper to make code more readable
<syntaxhighlight lang="tcl"># A helper to make code more readable
proc terminal {args} {
proc terminal {args} {
exec /usr/bin/tput {*}$args >/dev/tty
exec /usr/bin/tput {*}$args >/dev/tty
Line 589: Line 589:
gets stdin
gets stdin
# Restore the screen with the "exit_ca_mode" capability, a.k.a. 'rmcup'
# Restore the screen with the "exit_ca_mode" capability, a.k.a. 'rmcup'
terminal rmcup</lang>
terminal rmcup</syntaxhighlight>


=={{header|UNIX Shell}}==
=={{header|UNIX Shell}}==
Line 595: Line 595:
{{works with|Bourne Shell}} {{works with|bash}}
{{works with|Bourne Shell}} {{works with|bash}}


<lang sh>#!/bin/sh
<syntaxhighlight lang="sh">#!/bin/sh
tput smcup # Save the display
tput smcup # Save the display
echo 'Hello'
echo 'Hello'
sleep 5 # Wait five seconds
sleep 5 # Wait five seconds
tput rmcup # Restore the display</lang>
tput rmcup # Restore the display</syntaxhighlight>


=={{header|Wren}}==
=={{header|Wren}}==
{{trans|C}}
{{trans|C}}
<lang ecmascript>import "io" for Stdout
<syntaxhighlight lang="ecmascript">import "io" for Stdout
import "timer" for Timer
import "timer" for Timer


Line 614: Line 614:
Timer.sleep(1000)
Timer.sleep(1000)
}
}
System.write("\e[?1049l")</lang>
System.write("\e[?1049l")</syntaxhighlight>


=={{header|XPL0}}==
=={{header|XPL0}}==
<lang XPL0>include c:\cxpl\codes; \intrinsic 'code' declarations
<syntaxhighlight lang="xpl0">include c:\cxpl\codes; \intrinsic 'code' declarations


proc SetPage(P); \Select active display page for video screen
proc SetPage(P); \Select active display page for video screen
Line 632: Line 632:
if ChIn(1) then []; \wait for keystroke
if ChIn(1) then []; \wait for keystroke
SetPage(0); \restore original, default text screen, page 0
SetPage(0); \restore original, default text screen, page 0
]</lang>
]</syntaxhighlight>


=={{header|Z80 Assembly}}==
=={{header|Z80 Assembly}}==
Line 638: Line 638:
Using the Amstrad CPC firmware:
Using the Amstrad CPC firmware:


<lang z80> org $3000
<syntaxhighlight lang="z80"> org $3000


txt_output: equ $bb5a
txt_output: equ $bb5a
Line 682: Line 682:
ret
ret


text: defm "This is some text. Please press a key.\0"</lang>
text: defm "This is some text. Please press a key.\0"</syntaxhighlight>


=={{header|zkl}}==
=={{header|zkl}}==
{{trans|C}}
{{trans|C}}
Works in a Mint Linux terminal, switching to the alternate screen buffer, printing a count down message and then switching back.
Works in a Mint Linux terminal, switching to the alternate screen buffer, printing a count down message and then switching back.
<lang zkl>print("\e[?1049h\e[H");
<syntaxhighlight lang="zkl">print("\e[?1049h\e[H");
println("Alternate screen buffer");
println("Alternate screen buffer");
foreach i in ([5..1,-1]){
foreach i in ([5..1,-1]){
Line 693: Line 693:
Atomic.sleep(1);
Atomic.sleep(1);
}
}
print("\e[?1049l");</lang>
print("\e[?1049l");</syntaxhighlight>