Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
thelastpsion committed Apr 30, 2023
0 parents commit 173cd93
Show file tree
Hide file tree
Showing 26 changed files with 4,707 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**/*.APP
**/*.MAP
**/*.OBJ
INSTALL/**
**/*.DBD
**/*.SYM
**/*.SHD
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# nfsc 5.4 (Iain Tuddenham's wish list)

> Fri Jan 30 12:15:19 SGT 1998
- Now nfsc save files support the include directive:
include \<path\> reads in the specified file. Note that
in this case "exit" wont save the file.
- "Duplicate character in insert mode" bug fixed.
This could be seen in programs like emacs and pine. They actually
use insert mode.
- Some hotkeys changed to be more "psion" conform.
(Exit without saving, Paste)
- Saving X/Ymodem mode bug fixed
- UNIX-Mode: Only the drives marked for exporting are exported to p3nfsd.
- Modem state changes are now reported to the OPL program.
- "Toggle echo" menu entry added for switching off the display, used for
speeding up ascii downloads.
- Sending more than 127 bytes from the OPL program is handled correctly now.
- OPL program: lockups occured at sending data while waiting for text are
eliminated. The data sent to nfsc will not be sent back to the OPL program,
as the OPL program waits for the ack from the send, so it cannot listen
for new data.
- limited the number of scrollback lines to 800 as the old limit (1000)
caused allocating 81000-65536=15464 bytes
325 changes: 325 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

205 changes: 205 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
# Nfsc

By Rudolf König, Jürgen Weiger *et al*.

## Intro

**Nfsc** is a terminal emulator. If this file is part of the p3nfs package,
then **Nfsc** is also the psion counterpart to the `p3nfsd` daemon on unix with
additional terminal emulation support.

For `p3nfsd` related info refer to the README file in the `p3nfsd` package.

**Nfsc** emulates a DEC VT100 terminal and some features of the newer vt220.
It has following noteworthy features:

- Support for all builtin Series 3a fonts (9 fonts on the S3a).
- Support for bold, underlined, inverse and italic fonts.
- Alternative character set support.
- Defineable function key support.
- Jumpscroll and charset conversion (ISO8859-1 <-> IBM codepage 850).
- Support for history scrollback (over 500 lines are possible).
- Bring server functionality.
- Paste from the scrollback or from builtin applications.
- Dialing/scripting support. Extensible, as it is done in OPL.
- More than one configuration can be saved/loaded.
- Online help.
- Support for baudrates 50 to 115200.
- Should work on Psion Series 3; it is reported to work on the Siena.
- Robust: most (all?) VT100 animations are working.
- X/YMODEM support (partially working).
- Local mode.
- Experimental 3Fax support.
- Automatic dial at startup.
- TTY:I (infrared).

The current release (5.4) fixes some bugs and adds some features mainly of
interest for non-casual *Nfsc* users. See `CHANGELOG.md` for more.

**License:** GNU General Public Licence (Version 2)

## Installation

Place `nfsc.app` in the `\app` directory and install it with **Psion-I**.
If you also want keypad support, place `fnkeys.nfs` into the `\opd`
directory. Read it (with a text editor) for details.

If you want dial support, install the files `dialme.opl` & `nfscdial.opl`
in the `opl` directory and translate them. See below for more.

The rest of the files are documentation and source code. They should not be
copied to the Psion.

## Building Nfsc (If you have the Psion C SDK)

In the `src` directory, from the DOS prompt:

```batch
C:\PROJECTS\NFSC> makeshd nfsc
C:\PROJECTS\NFSC> rcomp nfsc.hlp
C:\PROJECTS\NFSC> tsc /m nfsc
C:\PROJECTS\NFSC> ren nfsc.img nfsc.app
```

## Notes

- X/Ymodem was tested with the only Zmodem package I found for UNIX.
Xmodem works, Ymodem has a problem: the receiver won't terminate cleanly
after a file was sent. I think the Psion driver and the Unix program
behave differently here.
- break. As there is no `p_break()` function or the like, the break is
generated as a series of 0 bytes sent at 50 baud. This can work, but
is not guaranteed, as the definition of break is 0 for at least 250ms
and this method generates more 200ms pieces. It works on SunOS, but not
on Solaris.
- Note for S3 owners: I only tested it on my S3a in compatibility mode.
All but the online help should work, as it is too wide for the S3.
Please drop me a mail if it works on your S3.
- Siena was reported to work OK.

## Dial Support

It is implemented in OPL, so if you want to use it, you have to write
first an OPL program, and have to translate it (typing Psion-T).

Don't be afraid, it may be sufficient to write a program as simple as:

```opl
PROC dialme:
global nfscPid%
loadm "nfscdial"
dialinit:
puts:("ATDT 0123456789"+chr$(10))
expect:("login:")
puts:("my_username"+chr$(10))
expect:("Password:")
puts:("my_password"+chr$(10))
ENDP
```

The function `hotk:("x")` calls **Nfsc** to execute "Psion-x".
You can of course add more expect/puts lines or use OPL features if you
like (or have to :)).

Dialing is a second "thread", it works in parallel, so you can type
on the psion while the script is listening (e.g. your password). The
only problem with this method is that the dial script may lose data.


### How Dial Support Works (for programmers only)

#### Sending text to Nfsc

The opl program sends a message with `ID $40` to the **Nfsc** application,
and the address of the OPL string.

#### Receiving data

The opl program sends a message with `ID $41` to the **Nfsc** application,
and waits for data. It sends a return receipt of 1 if it wants to
quit, 0 if it requests more data.

**Note:** if the OPL program receives a string of length 0, this is in fact
a modem status change report. The first data byte is to interpreted as
follows:

```text
Signal Bit
CTS 0
DSR 1
DCD 2
RTS 3
DTR 4
```

As it is a string of length 0 it won't disturb any normal OPL routine.

See `nfscdial.opl` for the implementation of `expect`, `puts` & `hotk`.
(It would be nice to have a "`gets`" call.)

## Tips

- You can save your modem parameters with a little opl "dialme" program
like the following:

```opl
PROC dialme:
global nfscPid%
loadm "nfscdial"
dialinit:
puts:("ATZ"+chr$(10))
ENDP
```

- If you're logging in to a UNIX system via **Nfsc**, and you dont want to
start the `p3nfsd` program there (the UNIX counterpart of **Nfsc**), you may
have an inappropriate number of lines set. `p3nfsd` takes care of that,
but you have to be root while starting it.

Here is how to fix the number of rows (a little UNIX exercise):

```bash
# Check the number of lines (rows) with the following command:
% stty -a
# To set the number of rows to 20, try
% stty rows 20
# If this won't work, then try
% setenv LINES 20
# If you now get "setenv: not found", then (you're using a different shell):
$ LINES=20
$ export LINES
```


- If you like to fiddle with the save files manually, then you can use the
"include filename" statement. Include files can be nested and "Exit"
will not overwrite the file if there was an "include" in it.

## History

**Nfsc** was originally developed as an OPL counterpart for the UNIX p3nfs
daemon which is a way to connect psions to UNIX computers.

After N.N. rewrote it as a C program, I (Rudi) added terminal emulator
code to it. Then Michael checked it once more together with me so that
the vt100 animations ran on it. Odd Gripensteim used it on a VMS system
and wished he had key translation, so he got it (but not everything he
wished for).

The famous WWW page ot Steve Litchfield helped me to reorganize the
whole, and add some user features to it, like online help and config
saved in a file. For a Bring server I have to remember the data on the
screen. From here was a little to get scrollback too.

## Sources

```text
nfsc.c | protocol and dialog routines
vt100.c | terminal emulator stuff + scrollback handling
xymodem.c | X/Y modem support
paste.c | bring + paste server
params.c | parameter loading and saving
nfsc.hlp | guess what
```
8 changes: 8 additions & 0 deletions dialme.opl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
PROC dialme:
global nfscPid%
loadm "nfscdial"
dialinit:

expect:("assword:")
puts:("mypw"+chr$(10))
ENDP
72 changes: 72 additions & 0 deletions fnkeys.nfs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#
# Keypad mappings by Odd Gripenstam ([email protected])
# Store this file as \opd\fnkeys.nfs on the psion
#
#Ctrl-Shift-0 KP0
# .
# .
# .
#Ctrl-Shift-9 KP9
#Ctrl-Shift-. KP.
#Ctrl-Shift-, KP,
#Ctrl-Shift-- KP-
#Ctrl-Shift-Enter KP-ENTER
#Ctrl-Shift-U PF1
#Ctrl-Shift-I PF2
#Ctrl-Shift-O PF3
#Ctrl-Shift-P PF4
#
#I also defined Delete to DEL, and PgDn and PgUp to Next Screen and Prev
#Screen, respectively:
#
# Key(Hex) Modifier(Hex) String
fnkey 0008 00 \127
fnkey 0030 06 \27Op
fnkey 0031 06 \27Oq
fnkey 0032 06 \27Or
fnkey 0033 06 \27Os
fnkey 0034 06 \27Ot
fnkey 0035 06 \27Ou
fnkey 0036 06 \27Ov
fnkey 0037 06 \27Ow
fnkey 0038 06 \27Ox
fnkey 0039 06 \27Oy
#
fnkey 002C 06 \27Ol
fnkey 002E 06 \27On
fnkey 001F 06 \27Om
fnkey 000D 06 \27OM
#
fnkey 0015 06 \27OP
fnkey 0009 06 \27OQ
fnkey 000F 06 \27OR
fnkey 0010 06 \27OS
#
fnkey 0104 08 \27[5~
fnkey 0105 08 \27[6~
#
# One more time, now with caps lock
fnkey 0008 10 \127
fnkey 0030 16 \27Op
fnkey 0031 16 \27Oq
fnkey 0032 16 \27Or
fnkey 0033 16 \27Os
fnkey 0034 16 \27Ot
fnkey 0035 16 \27Ou
fnkey 0036 16 \27Ov
fnkey 0037 16 \27Ow
fnkey 0038 16 \27Ox
fnkey 0039 16 \27Oy
#
fnkey 002C 16 \27Ol
fnkey 002E 16 \27On
fnkey 001F 16 \27Om
fnkey 000D 16 \27OM
#
fnkey 0015 16 \27OP
fnkey 0009 16 \27OQ
fnkey 000F 16 \27OR
fnkey 0010 16 \27OS
#
fnkey 0104 18 \27[5~
fnkey 0105 18 \27[6~
Binary file added nfsc.app
Binary file not shown.
53 changes: 53 additions & 0 deletions nfscdial.opl
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
PROC dialinit:
local name$(8)

name$ = "NFSC.*"
nfscPid% = call($188,addr(name$)+1)
call($83,$204,0,0,0,0) rem MessInit, 4 msgs, 2 byte each
print "Now you can switch back to nfsc"
ENDP

PROC puts:(text$)
local data%(2)
local myvar$(255)

myvar$ = text$
data%(1) = addr(myvar$)
rem msendreceivew: send $40
call($683,nfscPid%,$40,0,addr(data%(1)))
ENDP

rem hotk:("x") Execute "Psion-X" in nfsc.app
PROC hotk:(text$)
local data%(2),l%

data%(1) = asc(text$)
call($683,nfscPid%,$42,0,addr(data%(1)))
ENDP

PROC expect:(text$)
local data%(2), pM%, mStat%, l%
local buf1$(255),buf2$(255)

buf2$ = ""
data%(1) = addr(buf1$)
rem Tell nfsc we need some text: msendreceivew
call($683,nfscPid%,$41,0,addr(data%(1)))
while 1
rem Wait for messages: mreceivea
call($183,addr(pM%),0,0,0,addr(mStat%))

iowait

if mStat% <> -46
if len(buf1$) + len(buf2$) > 255
buf2$ = right$(buf2$,255-len(buf1$))+buf1$
else
buf2$ = buf2$ + buf1$
endif
l%=loc(buf2$, text$)
call($783,pM%,l%) rem mfree
if l% > 0 : return : endif
endif
endwh
ENDP
Loading

0 comments on commit 173cd93

Please sign in to comment.