Merge pull request #2 from gungwald/merlin-impl

Merlin impl
This commit is contained in:
Bill Chatfield 2024-02-17 12:09:17 -05:00 committed by GitHub
commit 5e7e35e72a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 641 additions and 85 deletions

3
.gitignore vendored
View File

@ -1 +1,4 @@
MORE
MORE.dsk
_FileInformation.txt
*.swp *.swp

View File

@ -25,8 +25,8 @@ endif
# the PowerBook G4 and iBook G3. This version only requires Java 1.3. # the PowerBook G4 and iBook G3. This version only requires Java 1.3.
AC=java -jar AppleCommander-1.3.5-ac.jar AC=java -jar AppleCommander-1.3.5-ac.jar
SRC=more.s SRC=more.s
PGM=more PGM=MORE
BASE_DSK=prodos-2.0.3-boot.dsk BASE_DSK=prodos-2.0.3.dsk
VOL=$(PGM) VOL=$(PGM)
DSK=$(PGM).dsk DSK=$(PGM).dsk
@ -35,12 +35,13 @@ DSK=$(PGM).dsk
# disk instead. # disk instead.
#$(AC) -pro140 $(DSK) $(VOL) #$(AC) -pro140 $(DSK) $(VOL)
$(DSK): $(PGM) $(DSK): $(PGM) test.txt
$(COPY) $(BASE_DSK) $(DSK) $(COPY) $(BASE_DSK) $(DSK)
$(AC) -p $(DSK) $(PGM) BIN 0x8000 < $(PGM) $(AC) -p $(DSK) $(PGM) BIN 0x2000 < $(PGM)
cat test.txt | tr '\n' '\r' | $(AC) -p $(DSK) TEST TXT
$(PGM): $(SRC) Makefile $(PGM): $(SRC) Makefile
merlin32 --verbose $(SRC) merlin32 $(SRC)
clean: clean:
$(RM) $(DSK) $(PGM) *.zip _FileInformation.txt $(PGM)_Output.txt $(RM) $(DSK) $(PGM) *.zip _FileInformation.txt $(PGM)_Output.txt

513
more.S
View File

@ -5,10 +5,26 @@
* * * *
******************************** ********************************
* DSK MORE ;WRITE ASSEMBLED FILE TO DISK * Memory Map
* TYP $06 ;$FF=SYSTEM, $06=BINARY
.OR $2000 ;ASSEMBLE START ADDRESS
* *
* $0000 - $00FF Zero Page
* $0100 - $01FF Stack
* $0200 - $03FF Mostly Free, Input Buffer, Interrupt Vectors
* $0400 - $07FF Lo-res/Text Page1
* $0800 - $0BFF Lo-res/Text Page2 (BASIC programs load here)
* $0C00 - $1FFF Free
* $2000 - $3FFF Hi-res Page1
* $4000 - $5FFF Hi-res Page2
* $6000 - $95FF Free
* $9600 - $BFFF DOS3.3 and Buffers
* $C000 - $CFFF Soft Switches, Expansion Card I/O and ROM
* $D000 - $F7FF BASIC ROM (can be bankswitched later models)
* $F800 - $FFFF Machine Language Monitor ROM (also can be bankswitched)
DSK MORE ;WRITE ASSEMBLED FILE TO DISK
TYP $06 ;$FF=SYSTEM, $06=BINARY
ORG $2000 ;ASSEMBLE START ADDRESS
* SYSTEM VARIABLES * SYSTEM VARIABLES
* *
IN .EQ $200 ;256-CHAR INPUT BUF IN .EQ $200 ;256-CHAR INPUT BUF
@ -23,19 +39,26 @@ COUT .EQ $FDED
PRBYTE .EQ $FDDA PRBYTE .EQ $FDDA
* *
* SUBROUTINES IN BASIC.SYSTEM ROM: * SUBROUTINES IN BASIC.SYSTEM ROM:
*
GETBUFR .EQ $BEF5 ;ALLOCATE BUFFER, DESTROYS X & Y GETBUFR EQU $BEF5 ;BCC=OKAY & A=HIBYTE OF BUF
FREEBUFR .EQ $BEF8 ;FREE BUFFER ;BCS=FAIL & A=ERRCODE
* ;X & Y ARE DESTROYED
FREEBUFR EQU $BEF8 ;FREE BUFFER
* PRODOS ENTRY POINT * PRODOS ENTRY POINT
PRODOS_MLI EQU $BF00 ;MACHINE LANG IFACE (MLI)
* *
MLI .EQ $BF00 * MEMORY MAPPED I/O: $C000 - $CFFF
* *
* MEMORY LOCATIONS RD80VID EQU $C01F ;<=128->40COL, >128->80COL
* *
OURCH .EQ $057B ;80-COL HORIZ CURSOR POSITION * SLOT 3 SCRATCHPAD RAM - TEXT PAGE 0 SCREEN HOLE
OURCV .EQ $05FB ;VERTICAL CURSOR POSITION * http://yesterbits.com/media/books/apple/heiserman-1983-intermediate-level-apple-ii-handbook.pdf
* *
OURCH EQU $057B ;80-COL HORIZ CURSOR POSITION
OURCV EQU $05FB ;VERTICAL CURSOR POSITION
* ZERO-PAGE ADDRESSES * ZERO-PAGE ADDRESSES
* *
ZP.A1L .EQ $3C ;MONITOR GENERAL PURPOSE ZP.A1L .EQ $3C ;MONITOR GENERAL PURPOSE
@ -58,8 +81,8 @@ BUFSIZE .EQ $00FF
SCR.HGHT .EQ 24 ;SCREEN HEIGHT SCR.HGHT .EQ 24 ;SCREEN HEIGHT
* *
* DEBUGGING * DEBUGGING
*
TRACE .EQ 0 TRACE EQU 0
******************************** ********************************
* * * *
@ -164,31 +187,52 @@ MAIN CLD ;CLEAR DECIMAL FLG, AVOID CRASH
* *
* GET FILE NAME * GET FILE NAME
* *
>PUTS PROMPT PUTS INFOLINE
JSR CROUT
:ASKFILE PUTS PROMPT
JSR GETLN1 ;LENGTH IN X, CR AT END JSR GETLN1 ;LENGTH IN X, CR AT END
CPX #0 ;IS THE LENGTH ZERO? CPX #0 ;IS THE LENGTH ZERO?
BEQ END ;USER JUST PRESSED RETURN BNE :CONT0 ;USER JUST PRESSED RETURN
CPIN FILENAME ;COPY "IN" BUF TO FILENAME JMP :END
:CONT0 CPX #1
BNE :CONT1
LDA #"?"
CMP IN
BNE :CONT1
JSR HELPINFO
JMP :ASKFILE
:CONT1 CPIN FILENAME ;COPY "IN" BUF TO FILENAME
DO TRACE
JSR PRSTRBYTES
JSR GETLN
FIN
* *
* GET FILE I/O BUFFER FOR OPEN CALL * GET FILE I/O BUFFER FOR OPEN CALL
* *
LDA #4 ;FOUR 256 BYTE PAGES = 1KB LDA #4 ;FOUR 256 BYTE PAGES = 1KB
JSR GETBUFR ;GET BUF FROM BASIC.SYSTEM JSR GETBUFR ;GET BUF FROM BASIC.SYSTEM
BCS ERRFWDR ;CARRY SET INDICATES AN ERROR BCC :CONT2 ;CARRY CLEAR MEANS NO ERROR
STA OBUFADDR+1 ;GETBUFR RETURNS HIBYTE IN A JSR OBUFERR
JMP :END
:CONT2 STA OBUFADDR+1 ;GETBUFR RETURNS HIBYTE IN A
LDA #0 ;PREPARE LDA #0 ;PREPARE
STA OBUFADDR ;LOBYTE IS 0 B/C ADDR OF PAGE STA OBUFADDR ;LOBYTE IS 0 B/C ADDR OF PAGE
* *
* OPEN FILE * OPEN FILE
* *
JSR MLI JSR PRODOS_MLI
DB OPENCMD DB OPENCMD
DA OPENPRMS DA OPENPRMS
BNE ERRFWDR BEQ :CONT3
JSR OPENERR
JSR FREEBUFR ;CLEAN UP BEFORE TRY AGAIN
JMP :ASKFILE
* *
* COPY FILE NUMBER FROM OPEN PARAMETERS TO READ AND CLOSE * COPY FILE NUMBER FROM OPEN PARAMETERS TO READ AND CLOSE
* *
LDA OPENFNUM :CONT3 LDA OPENFNUM
STA READFNUM STA READFNUM
STA CLOSFNUM STA CLOSFNUM
* *
@ -196,47 +240,166 @@ MAIN CLD ;CLEAR DECIMAL FLG, AVOID CRASH
* *
LDA #1 ;ONE 256 BYTE BUFFER LDA #1 ;ONE 256 BYTE BUFFER
JSR GETBUFR ;CALL BASIC.SYSTEM SUB JSR GETBUFR ;CALL BASIC.SYSTEM SUB
BCS ERRFWDR ;CARRY SET MEANS ERROR BCC :CONT4
STA RBADDR+1 ;STORE HI-BYTE JSR RBUFERR ;CARRY SET MEANS ERROR
STA ZP.A1H ;AGAIN, FOR 0-PAGE INDIRECTION JMP :CLOSFILE
:CONT4 STA RBADDR+1 ;STORE HI-BYTE
STA ZP_A1H ;FOR 0-PAGE INDIRECTION
LDA #0 ;0 FOR LO-BYTE LDA #0 ;0 FOR LO-BYTE
STA RBADDR ;STORE IT STA RBADDR ;STORE IT
STA ZP.A1L ;AGAIN, FOR 0-PAGE INDIRECTION STA ZP.A1L ;AGAIN, FOR 0-PAGE INDIRECTION
* *
* PRINT THE FILE * PRINT THE FILE
* *
JSR VIEWFILE ;MUST CLOSE BEFORE ERR HANDLING JSR VIEWFILE
* *
* FREE READ BUFFER * CLEANUP
* *
JSR FREEBUFR JSR FREEBUFR ;FREE READ BUFFER
* *
* CLOSE FILE * Close file
* *
JSR MLI :CLOSFILE JSR PRODOS_MLI ;CLOSE THE FILE
DB CLOSCMD DB CLOSCMD
DA CLOSPRMS DA CLOSPRMS
STA CLOSERR BEQ :FREEOBUF
* JSR CLOSERR
* FREE FILE BUFFER USED IN OPEN CALL
* :FREEOBUF JSR FREEBUFR ;FREE OPEN I/O BUFFER
JSR FREEBUFR :END NOP
* RTS
* CHECK FOR ERRORS
* ********************************
LDA READERR ;RELOAD THE READ RESULT CODE * *
CMP EOFERR ;WAS IT AN EOF "ERROR" * END OF MAIN - PROGRAM EXIT *
BEQ END ;EOF IS NOT REALLY AN ERROR * *
CMP #0 ********************************
BNE ERRFWDR
LDA CLOSERR ********************************
BNE ERRFWDR * *
JMP END * PROGRAM INFO AND HELP *
* * *
* FINISH ********************************
* HELPINFO JSR CROUT
ERRFWDR JSR ERRPROC PUTS INFO0
END NOP JSR CROUT
PUTS INFO1
JSR CROUT
PUTS INFO2
JSR CROUT
PUTS INFO3
JSR CROUT
PUTS INFO4
JSR CROUT
JSR CROUT
RTS
********************************
* *
* HANDLE ERROR WHEN OPENING *
* FILE *
* *
********************************
OPENERR STA ERRCODE
PUTS OERRMSG
PUTS FILENAME
LDA #":"
JSR COUT
LDA ERRCODE
JSR ERRPROC
RTS
********************************
* *
* HANDLE ERROR WHEN CLOSING *
* FILE *
* *
********************************
CLOSERR STA ERRCODE
PUTS CERRMSG
PUTS FILENAME
LDA #"'"
JSR COUT
LDA #":"
JSR COUT
LDA ERRCODE
JSR ERRPROC
RTS
********************************
* *
* HANDLE ERROR WHEN REQUESTING *
* READ BUFFER *
* *
********************************
RBUFERR STA ERRCODE
PUTS RBERRMSG
LDA #":"
JSR COUT
LDA ERRCODE
JSR ERRPROC
RTS
********************************
* *
* HANDLE ERROR WHEN REQUESTING *
* READ BUFFER *
* *
********************************
OBUFERR STA ERRCODE
PUTS OBERRMSG
LDA #":"
JSR COUT
LDA ERRCODE
JSR ERRPROC
RTS
********************************
* *
* PRINT "IN" BUFFER *
* *
********************************
PRINT_IN
PUSHY
LDA #"X"
JSR COUT
LDA #"="
JSR COUT
TXA
JSR PRBYTE
JSR CROUT
LDY #0
:LOOP CPY #255
BEQ :ENDLOOP
LDA IN,Y
JSR PRBYTE
LDA #" "
JSR COUT
INY
JMP :LOOP
:ENDLOOP JSR CROUT
POPY
RTS
********************************
* *
* PRINT STRING BYTES *
* *
********************************
PRSTRBYTES
PUSHY
LDY #0
:LOOP CPY #255
BEQ :ENDLOOP
LDA FILENAME,Y
JSR PRBYTE
LDA #" "
JSR COUT
INY
JMP :LOOP
:ENDLOOP JSR CROUT
POPY
RTS RTS
******************************** ********************************
@ -250,18 +413,18 @@ VIEWFILE
>PUTS ENVIEW >PUTS ENVIEW
FIN FIN
>SET1 LINENUM ;INIT LINE NUMBER SET1 LINENUM ;INIT LINE NUMBER
.1 JSR MLI ;CALL PRODOS TO READ FILE :LOOP JSR PRODOS_MLI ;CALL PRODOS TO READ FILE
DB READCMD ;SPECIFY PRODOS READ COMMAND DB READCMD ;SPECIFY PRODOS READ COMMAND
DA READPRMS ;READ PARAMETERS DA READPRMS ;READ PARAMETERS
STA READERR ;SAVE RESULT OF READ OPERATION BNE :READERR
BNE .2 ;IF ERROR THEN END SUB
JSR WRITEBUF ;WRITE TO SCREEN WHAT WAS READ JSR WRITEBUF ;WRITE TO SCREEN WHAT WAS READ
LDA #1 ;PREPARE FOR NEXT OP LDA #1 ;PREPARE FOR NEXT OP
CMP USRQUIT ;IF USER WANTS TO QUIT, THEN CMP USRQUIT ;IF USER WANTS TO QUIT, THEN
BEQ .2 ;EXIT THE LOOP BEQ :ENDLOOP ;EXIT THE LOOP
JMP .1 ;ELSE, GET THE NEXT BUFFER JMP :LOOP ;ELSE, GET THE NEXT BUFFER
.2 NOP :READERR JSR ERRPROC
:ENDLOOP NOP
RTS RTS
******************************** ********************************
@ -299,7 +462,7 @@ WRITEBUF
.3 >POPY .3 >POPY
DO TRACE DO TRACE
>PUTS EXVIEW PUTS EXWRITEBUF
FIN FIN
RTS RTS
@ -387,13 +550,171 @@ ERASEBAR
******************************** ********************************
* * * *
* ERROR HANDLER * * ERROR HANDLER *
* INPUT PARAM: A HOLDS ERRCODE *
* * * *
******************************** ********************************
ERRPROC STA ERRCODE ERRPROC
>PUTS ERRTXT STA ERRCODE
CMP #0
BNE :EEOF
JMP :END
:EEOF CMP #EOFERR
BNE :E01
JMP :END
:E01 CMP #1
BNE :E04
PUTS E01MSG
JMP :END
:E04 CMP #4
BNE :E25
PUTS E04MSG
JMP :END
:E25 CMP #$25
BNE :E27
PUTS E25MSG
JMP :END
:E27 CMP #$27
BNE :E28
PUTS E27MSG
JMP :END
:E28 CMP #$28
BNE :E2B
PUTS E28MSG
JMP :END
:E2B CMP #$2B
BNE :E2E
PUTS E2BMSG
JMP :END
:E2E CMP #$2E
BNE :E40
PUTS E2EMSG
JMP :END
:E40 CMP #$40
BNE :E42
PUTS E40MSG
JMP :END
:E42 CMP #$42
BNE :E43
PUTS E42MSG
JMP :END
:E43 CMP #$43
BNE :E44
PUTS E43MSG
JMP :END
:E44 CMP #$44
BNE :E45
PUTS E44MSG
JMP :END
:E45 CMP #$45
BNE :E46
PUTS E45MSG
JMP :END
:E46 CMP #$46
BNE :E47
PUTS E46MSG
JMP :END
:E47 CMP #$47
BNE :E48
PUTS E47MSG
JMP :END
:E48 CMP #$48
BNE :E49
PUTS E48MSG
JMP :END
:E49 CMP #$49
BNE :E4A
PUTS E49MSG
JMP :END
:E4A CMP #$4A
BNE :E4B
PUTS E4AMSG
JMP :END
:E4B CMP #$4B
BNE :E4C
PUTS E4BMSG
JMP :END
:E4C CMP #$4C
BNE :E4D
PUTS E4CMSG
JMP :END
:E4D CMP #$4D
BNE :E4E
PUTS E4DMSG
JMP :END
:E4E CMP #$4E
BNE :E50
PUTS E4EMSG
JMP :END
:E50 CMP #$50
BNE :E51
PUTS E50MSG
JMP :END
:E51 CMP #$51
BNE :E52
PUTS E51MSG
JMP :END
:E52 CMP #$52
BNE :E53
PUTS E52MSG
JMP :END
:E53 CMP #$53
BNE :E55
PUTS E53MSG
JMP :END
:E55 CMP #$55
BNE :E56
PUTS E55MSG
JMP :END
:E56 CMP #$56
BNE :E57
PUTS E56MSG
JMP :END
:E57 CMP #$57
BNE :E5A
PUTS E57MSG
JMP :END
:E5A CMP #$5A
BNE :E_UNK
PUTS E5AMSG
JMP :END
:E_UNK PUTS E_UNK_MSG
LDA #":"
JSR COUT
LDA ERRCODE
JSR PRBYTE JSR PRBYTE
JSR CROUT :END JSR CROUT
RTS RTS
******************************** ********************************
@ -402,26 +723,62 @@ ERRPROC STA ERRCODE
* * * *
******************************** ********************************
PROMPT .DA #5 ;LENGTH BYTE INFOLINE STR "ENTER [?] FOR PROGRAM INFO AND HELP"
.AS "FILE:" INFO0 STR "MORE - PAGES THROUGH TEXT FILE"
INFO1 STR "COPYRIGHT (C) 2024 BILL CHATFIELD"
INFO2 STR "DISTRIBUTED UNDER THE GPL VERSION 3"
INFO3 STR "https://github.com/gungwald/prodos-more"
INFO4 STR "PRESS RETURN TO QUIT"
PROMPT STR "FILE:"
ERRTXT STR "ERROR:"
FILENAME DS $FF
ERRCODE DS 1
LINENUM DS 1
BAR STR '[RET] LINE [SPC] PAGE [Q]UIT'
USRQUIT DS 1
BUFCHAR DS 1
USRCHAR DS 1
ERRTXT .DA #6 ;LENGTH BYTE OERRMSG STR "CANNOT OPEN "
.AS "ERROR:" CERRMSG STR "CANNOT CLOSE "
RBERRMSG STR "CANNOT CREATE READ BUFFER"
OBERRMSG STR "CANNOT CREATE FILE BUFFER"
BAR .DA #42 E00MSG STR "NO ERROR"
.AS '[RET] NEXT LINE / [SPC] NEXT PAGE / [Q]UIT' E01MSG STR "BAD SYSTEM CALL NUMBER"
E04MSG STR "BAD SYSTEM CALL PARAMETER COUNT"
FILENAME .BS $FF E25MSG STR "INTERRUPT TABLE FULL"
ERRCODE .BS 1 E27MSG STR "I/O ERROR"
READERR .BS 1 E28MSG STR "NO DEVICE CONNECTED"
CLOSERR .BS 1 E2BMSG STR "DISK WRITE PROTECTED"
LINENUM .BS 1 E2EMSG STR "DISK SWITCHED"
USRQUIT .BS 1 E40MSG STR "INVALID PATHNAME"
BUFCHAR .BS 1 E42MSG STR "MAXIMUM NUMBER OF FILES OPEN"
USRCHAR .BS 1 E43MSG STR "INVALID REFERENCE NUMBER"
E44MSG STR "DIRECTORY NOT FOUND"
E45MSG STR "VOLUME NOT FOUND"
E46MSG STR "FILE NOT FOUND"
E47MSG STR "DUPLICATE FILENAME"
E48MSG STR "VOLUME FULL"
E49MSG STR "VOLUME DIRECTORY FULL"
E4AMSG STR "INCOMPATIBLE FILE FORMAT OR PRODOS DIRECTORY"
E4BMSG STR "UNSUPPORTED STORAGE TYPE"
E4CMSG STR "END OF FILE ENCOUNTERED"
E4DMSG STR "POSITION OUT OF RANGE"
E4EMSG STR "FILE ACCESS ERROR OR FILE LOCKED"
E50MSG STR "FILE IS OPEN"
E51MSG STR "DIRECTORY STRUCTURE DAMAGED"
E52MSG STR "NOT A PRODOS VOLUME"
E53MSG STR "INVALID SYSTEM CALL PARAMETER"
E55MSG STR "VOLUME CONTROL BLOCK TABLE FULL"
E56MSG STR "BAD BUFFER ADDRESS"
E57MSG STR "DUPLICATE VOLUME"
E5AMSG STR "FILE STRUCTURE DAMAGED"
E_UNK_MSG STR "UNKNOWN ERROR CODE"
ENVIEW STR 'ENTERING VIEWFILE' ENVIEW STR 'ENTERING VIEWFILE'
EXVIEW STR 'EXITING VIEWFILE' EXVIEW STR 'EXITING VIEWFILE'
EXWRITEBUF STR 'EXITING WRITEBUF'
ENSTATB STR 'ENTERING STATUSBAR' ENSTATB STR 'ENTERING STATUSBAR'
EXSTATB STR 'EXITING STATUSBAR' EXSTATB STR 'EXITING STATUSBAR'
ENERASEB STR 'ENTERING ERASEBAR' ENERASEB STR 'ENTERING ERASEBAR'
@ -452,5 +809,5 @@ CLOSFNUM .BS 1
* CONSUME ALL BYTES UP TO THE NEXT PAGE BOUNDRY * CONSUME ALL BYTES UP TO THE NEXT PAGE BOUNDRY
*FILLER DS \,$00 *FILLER DS \,$00
* MUST START ON PAGE BOUNDRY * MUST START ON PAGE BOUNDRY
*OPENBUF .BS 1024 *OPENBUF DS 1024
*READBUF .BS BUFSIZE *READBUF DS BUFSIZE

195
test.txt Normal file
View File

@ -0,0 +1,195 @@
MORE(1) User Commands MORE(1)
NAME
more - display the contents of a file in a terminal
SYNOPSIS
more [options] file ...
DESCRIPTION
more is a filter for paging through text one screenful at a time. This
version is especially primitive. Users should realize that less(1)
provides more(1) emulation plus extensive enhancements.
OPTIONS
Options are also taken from the environment variable MORE (make sure to
precede them with a dash (-)) but command-line options will override
those.
-d, --silent
Prompt with "[Press space to continue, 'q' to quit.]", and display
"[Press 'h' for instructions.]" instead of ringing the bell when an
illegal key is pressed.
-l, --logical
Do not pause after any line containing a ^L (form feed).
-e, --exit-on-eof
Exit on End-Of-File, enabled by default if POSIXLY_CORRECT
environment variable is not set or if not executed on terminal.
-f, --no-pause
Count logical lines, rather than screen lines (i.e., long lines are
not folded).
-p, --print-over
Do not scroll. Instead, clear the whole screen and then display the
text. Notice that this option is switched on automatically if the
executable is named page.
-c, --clean-print
Do not scroll. Instead, paint each screen from the top, clearing
the remainder of each line as it is displayed.
-s, --squeeze
Squeeze multiple blank lines into one.
-u, --plain
Suppress underlining. This option is silently ignored as backwards
compatibility.
-n, --lines number
Specify the number of lines per screenful. The number argument is a
positive decimal integer. The --lines option shall override any
values obtained from any other source, such as number of lines
reported by terminal.
-number
A numeric option means the same as --lines option argument.
+number
Start displaying each file at line number.
+/string
The string to be searched in each file before starting to display
it.
-h, --help
Display help text and exit.
-V, --version
Print version and exit.
COMMANDS
Interactive commands for more are based on vi(1). Some commands may be
preceded by a decimal number, called k in the descriptions below. In
the following descriptions, ^X means control-X.
h or ?
Help; display a summary of these commands. If you forget all other
commands, remember this one.
SPACE
Display next k lines of text. Defaults to current screen size.
z
Display next k lines of text. Defaults to current screen size.
Argument becomes new default.
RETURN
Display next k lines of text. Defaults to 1. Argument becomes new
default.
d or ^D
Scroll k lines. Default is current scroll size, initially 11.
Argument becomes new default.
q or Q or INTERRUPT
Exit.
s
Skip forward k lines of text. Defaults to 1.
f
Skip forward k screenfuls of text. Defaults to 1.
b or ^B
Skip backwards k screenfuls of text. Defaults to 1. Only works with
files, not pipes.
'
Go to the place where the last search started.
=
Display current line number.
/pattern
Search for kth occurrence of regular expression. Defaults to 1.
n
Search for kth occurrence of last regular expression. Defaults to
1.
!command or :!command
Execute command in a subshell.
v
Start up an editor at current line. The editor is taken from the
environment variable VISUAL if defined, or EDITOR if VISUAL is not
defined, or defaults to vi(1) if neither VISUAL nor EDITOR is
defined.
^L
Redraw screen.
:n
Go to kth next file. Defaults to 1.
:p
Go to kth previous file. Defaults to 1.
:f
Display current file name and line number.
.
Repeat previous command.
ENVIRONMENT
The more command respects the following environment variables, if they
exist:
MORE
This variable may be set with favored options to more.
SHELL
Current shell in use (normally set by the shell at login time).
TERM
The terminal type used by more to get the terminal characteristics
necessary to manipulate the screen.
VISUAL
The editor the user prefers. Invoked when command key v is pressed.
EDITOR
The editor of choice when VISUAL is not specified.
POSIXLY_CORRECT
Disable exit-on-eof (see option -e for more details).
HISTORY
The more command appeared in 3.0BSD. This man page documents more
version 5.19 (Berkeley 6/29/88), which is currently in use in the Linux
community. Documentation was produced using several other versions of
the man page, and extensive inspection of the source code.
AUTHORS
Eric Shienbrood, UC Berkeley.
Modified by Geoff Peck, UCB to add underlining, single spacing.
Modified by John Foderaro, UCB to add -c and MORE environment variable.
SEE ALSO
less(1), vi(1)
REPORTING BUGS
For bug reports, use the issue tracker at
https://github.com/util-linux/util-linux/issues.
AVAILABILITY
The more command is part of the util-linux package which can be
downloaded from Linux Kernel Archive
<https://www.kernel.org/pub/linux/utils/util-linux/>.
util-linux 2.39.3 2023-11-21 MORE(1)