home *** CD-ROM | disk | FTP | other *** search
/ 8bitfiles.net/archives / archives.tar / archives / genie-commodore-file-library / Information / MEMMAP95.NOV < prev    next >
Encoding:
Text File  |  2019-04-13  |  31.6 KB  |  828 lines

  1.                                 NOVATERM 9.5
  2.  
  3.                                  Memory Map
  4.  
  5.                     Copyright (c) 1989-1994 by Nick Rossi
  6.  
  7.  
  8. If you have any questions about writing modules or external programs
  9. with Novaterm, my addresses are:
  10.  
  11. Internet:  "voyager@eskimo.com"
  12. GEnie:     "N.ROSSI"
  13. U.S. mail: Nick Rossi
  14.            10002 Aurora Ave. N. #1159
  15.            Seattle, WA 98133
  16.  
  17. The latest Novaterm updates are available at the Internet FTP site:
  18.  
  19. FTP site:   eskimo.com
  20. Directory:  /voyager
  21.  
  22. MEMORY OVERVIEW
  23.  
  24. Hex             Decimal         Use
  25. $02A7-$02FF     679-767         ML work area
  26. $033C-$0343     828-835         vectors
  27. $0344-$03F1    836-1009    misc data tables
  28. $0400-$04FF    1024-1279    transmit table
  29. $0500-$05FF    1280-1535    receive table
  30. $0600-$064F    1536-1615    80 column tab stops
  31. $0650-$06FF    1616-1791    string input buffer
  32. $0700-$07FF    1792-2047    RS232 receive buffer
  33. $0800-$81FF    2048-33279    compiled BASIC
  34. $8200-$88FF    33280-35071    machine language
  35. $8900-$8BFF    35072-35839    80 column font
  36. $8C00-$8FFF    35840-36863    screen memory
  37. $9000-$95FF    36864-38143    terminal emulator
  38. $9600-$9FFF    38144-40959    machine language 
  39. $A000-$BFFF    40960-49151    hi-res screen (80 columns)
  40. $B000-$B7FF    45056-47103    character set (40 columns)
  41. $B800-$BBFF    47104-48127    terminal screen save (40 columns)
  42. $BC00-$BFFF    48128-49151    color memory save (40 columns)
  43. $C000-$CBFF    49152-52223    file transfer protocol
  44. $CC00-$CD7F    52224-52607    modem driver
  45. $CD80-$CEFF    52608-52991    machine language
  46. $CF00-$CFFF    52992-53247    RAM expander interface
  47. $D000-$D7FF    53248-55295    hi-res screen save/font save
  48. $D800-$DBFF    55296-56319    color memory save (80 columns)
  49. $E000-$FFFF    57344-65535    buffer
  50.  
  51.  
  52. ZERO PAGE
  53.  
  54. $02 - $03    2 - 3    REGISTER VECTOR
  55. Vector to the start of the data registers at location 703.
  56.  
  57. $04 - $05    4 - 5    STATUS LINE VECTOR
  58. Vector to the start of the status line at location 836.
  59.  
  60. $06             6       FLAG
  61. Bit flag used for various purposes:
  62.  
  63.     bit 0,1:    unused
  64.     bit 2:    Buffer capture file open?  (1=yes)
  65.     bit 3:    unused
  66.     bit 4:    Save buffer when full?  (1=yes)
  67.     bit 5:    Flow control enabled?  (1=yes)
  68.     bit 6:    Terminal in 80 column mode?  (1=yes)
  69.     bit 7:    Status line on?  (1=yes)
  70.  
  71. $FB - $FC    251 - 252    BUFFER READ POINTER
  72. Pointer to the location in the buffer which will be read next.
  73.  
  74. $FD - $FE    253 - 254    BUFFER WRITE POINTER
  75. Pointer to the location in the buffer which will be written to next.
  76.  
  77.  
  78. REGISTERS
  79.  
  80. $02A7 - $02A8    679 - 680    BUFGET VECTOR
  81. Vector to Routine 72, which gets a byte from the buffer.
  82.  
  83. $02A9 - $02AA    681 - 682    BUFSTR VECTOR
  84. Vector to Routine 75, which writes a byte to the buffer.
  85.  
  86. $02AB - $02AC    683 - 684    ENABLE VECTOR
  87. Vector to Routine 21, which re-enables RS232 I/O after disk access.
  88.  
  89. $02AD - $02AE    685 - 686    RSGET VECTOR
  90. Vector to Routine 27, which gets a character from the receive buffer and
  91. puts it in the accumulator.
  92.  
  93. $02AF - $02B0    687 - 688    CARDET VECTOR
  94. Vector to Routine 57, which checks for a carrier.
  95.  
  96. $02B1 - $02B2    689 - 690    DISABLE VECTOR
  97. Vector to Routine 24, which disables RS232 I/O before disk access.
  98.  
  99. $02B3 - $02E0    691 - 736    NOVATERM REGISTERS
  100. Add the offset value given below to determine the true address of each
  101. register.
  102.  
  103.     0-1    Pointer to the end of the current buffer read file.
  104.         2-3     Pointer to the end of the current buffer capture file.
  105.                 Updated as data is captured.
  106.         4       Set to 1 when the buffer fills up.
  107.     5    Set to 1 for output in 80 columns.
  108.     6    Set to 1 if host has been paused.
  109.     7    Saved cursor color from 80 column mode.
  110.     8    Flow control tolerance.
  111.     9    SwiftLink page map ($DE, $DF, or $D7).
  112.     10    Set to 1 if a SwiftLink is connected.
  113.     11    Set to 1 if the 80 column status line must be updated.
  114.         12      Color of 80 column status line (foreground and
  115.                 background).
  116.         13      Set to 1 if "Press C= M" already displayed.
  117.     14    Last value of phone ring detect register.
  118.     15    XOFF character.
  119.     16    XON character.
  120.     17    Saved cursor row position from 40 column terminal mode.
  121.         18      Saved cursor column position from 40 column terminal
  122.                 mode.
  123.         19      Saved cursor color from 40 column terminal mode.
  124.     20    Saved cursor row position from 80 column terminal mode.
  125.         21      Saved cursor column position from 80 column terminal
  126.                 mode.
  127.         22      Saved border color from 80 column terminal mode.
  128.     23    80 column text color.
  129.     24    80 column screen color.
  130.     25    Set to 1 if the bell is turned on.
  131.     26-28    Used to preserve A,X,Y registers in certain routines.
  132.     29    Number of detected string during script CHECK.
  133.     30    RAM expander device number.
  134.     31    SwiftLink command register parity.
  135.     32    Parity: 0=none, 1=even, 2=odd.
  136.     33-34    RS-232 start bit time.
  137.     35-36    RS-232 full bit time.
  138.     37    Flag/tab position for menu routine.
  139.     38    Color of 40 column status line.
  140.     39    Baud rate.
  141.     40-41    Unused.
  142.     42    Flow control type:  0=none, 1=XOFF/XON, 2=RTS/CTS
  143.     43    Zmodem auto-download, 1=on
  144.     44-45    Pointer to script search strings
  145.  
  146. $02E1 - $02F0    737 - 752    FUNCTION KEY TRANSLATE TABLE
  147. Table used to translate the value of the current key pressed (location
  148. 203) combined with the appropriate shift, Commodore, or control key
  149. combination to produce the number of the function key that was pressed.
  150. The values in this table are:   7,1,3,5,8,2,4,6,16,13,14,15,12,9,10,11
  151.  
  152.  
  153. MORE REGISTERS
  154.  
  155. $033C - $033D    828 - 829    INDEX TO MAIN MACHINE LANGUAGE
  156. Vector to the start of the main machine language at $9600 (38400).
  157.  
  158. $033E - $033F    830 - 831    OLDOUT VECTOR
  159. Vector to the old CHROUT routine used if the output device is not the
  160. modem.  This will normally be $F1CA, but if a RAM expander is in use, it
  161. may be something else.
  162.  
  163. $0342 - $0343    834 - 835    OLDCHKIN VECTOR
  164. Vector to the old location of the CHKOUT routine used to jump to the old
  165. routine if the output device is not the modem.  This will normally be
  166. $F21B unless a RAM expander is present.
  167.  
  168. $0344 - $036B    836 - 875    STATUS LINE
  169. Text for the status line is stored here.  The values of the indicator
  170. bytes here are used to determine the status of the terminal.  An ASCII
  171. display of this memory looks like this (quotes not included):
  172.  
  173. "^:E:T:K:C:B:X:                    00:00:00 "
  174.  
  175. Add the offset value given below to determine the true location of each
  176. register.  Each indicator is turned on by setting the high bit of the
  177. register.
  178.  
  179.         0       An up-arrow means that command and function keys are
  180.                 taken as normal characters.
  181.         2       Local echo on/off.
  182.     4    ASCII translation on/off.
  183.     6    Control character display on/off.
  184.     8    Carrier indicator.
  185.     10    Buffer indicator (open or closed).
  186.     12    Indicates script file in progress.
  187.     31-38    On-line timer.
  188.  
  189. $036C - $038F    876 - 911    BAUD RATE TABLES
  190. Contains the start-bit, full-bit, and transmit times for 300, 1200, and
  191. 2400 baud.
  192.  
  193. $0390 - $0396    912 - 918    SWIFTLINK BAUD RATES
  194. Contains control register values for the seven baud rates.
  195.  
  196. $0397 - $03A0    919 - 928    BELL SID OFFSETS
  197. Offsets from the beginning of the SID registers to which the bell
  198. sounding values are stored.
  199.  
  200. $03A1 - $03AA    929 - 938    BELL SID VALUES
  201. Whenever the bell is sounded, the values here are stored in the SID chip
  202. locations pointed to by the preceding ten bytes, in order.
  203.  
  204. $03AB - $03C4    939 - 964    80 COLUMN ROWS - LOW BYTES
  205. $03C5 - $03DE    965 - 990    80 COLUMN ROWS - HIGH BYTES
  206. This table gives bitmap memory addresses for the start of each 80 column
  207. display line.
  208.  
  209. $03DF - $03E5    991 - 997    FLOW CONTROL TOLERANCES
  210. This table defines a default flow control tolerance for each baud rate.
  211.  
  212. $0400 - $04FF    1024 - 1279    TRANSMIT TRANSLATION TABLE
  213. Characters sent to the modem are first replaced with the corresponding
  214. ASCII value in this table.
  215.  
  216. $0500 - $05FF    1280 - 1535    RECEIVE TRANSLATION TABLE
  217. Characters received from the modem are replaced with the corresponding
  218. ASCII value in this table.
  219.  
  220. $0600 - $064F    1536 - 1615    TAB STOPS
  221. Table of tab stops for 80 column mode.
  222.  
  223. $0650 - $06FF    1616 - 1791    STRING INPUT BUFFER
  224. Buffer for reading strings from disk.
  225.  
  226. $0700 - $07FF    1792 - 2047    RS232 RECEIVE BUFFER
  227. The NMI interrupt routine reads data from the modem and stores it here.
  228.  
  229. $0800 - $81FF    2048 - 33279    COMPILED BASIC
  230. Main compiled BASIC program of Novaterm and variable storage area.
  231.  
  232.  
  233. 80 COLUMN SCREEN DRIVER
  234.  
  235. The 80 column machine language handles all output in 80 column mode.  A
  236. number of the routines are made available to external programs (such as
  237. the ANSI, VT52, and VT102 terminals) via a jump table. The 80 column
  238. mode uses location 214 for the cursor row position and location 211 for
  239. the cursor column position, as well as 209-210 as a pointer to the
  240. actual memory location of the cursor on the hi-res screen.
  241.  
  242. $8500           34048           INIT
  243. Turns on hi-res mode and clears the hi-res screen.
  244.  
  245. $8503           34051           CHROUT
  246. Takes the ASCII value in the .A register, executes the control code if a
  247. control character, or searches for the pattern in the 80 column font,
  248. puts the character on the screen, and advances the cursor.
  249.  
  250. $8506           34054           BLCRSR
  251. Reverses the seventh nybble of the current cursor location, turning the
  252. underline cursor on or off.
  253.  
  254. $8509           34057           ENTER
  255. Performs initialization without clearing the hi-res screen.
  256.  
  257. $850C           34060           CALCRSR
  258. Calculates the actual screen location from the cursor column in 211 and
  259. the cursor row stored in .X register and stores in 209-210.
  260.  
  261. $850F           34063           SCROLL
  262. Deletes the number of rows specified in the accumulator starting from
  263. the row specified in the .X register.
  264.  
  265. $8512           34066           INSERT
  266. Inserts the number of rows given in the accumulator before the row
  267. specified in the .X register.
  268.  
  269. $8515           34069           ERASE
  270. Blanks the row specified in the .X register.
  271.  
  272. $8518           34072           PUTCHAR
  273. Puts a character in the current cursor location without updating the
  274. cursor.
  275.  
  276. $851B           34075           CRSR
  277. Holds either the value $F0 (240) if the cursor is on the left side of a
  278. hi-res screen block, or $0F (15) if the cursor is on the right side of a
  279. screen block.
  280.  
  281. $851C           34076           UNDERLINE
  282. Holds a 1 if printed characters are to be underlined.
  283.  
  284. $851D           34077           COLOR80
  285. Contains the foreground and background colors of 80 column text.  The
  286. lower 4 bits are the background color and the higher 4 bits are the
  287. foreground (text) color.
  288.  
  289. $851E           34078           BORDER80
  290. Holds the value for the border color in 80 column mode.
  291.  
  292. $851F           34079           SCTOP
  293. Specifies the upper boundary row of the scrolling region.
  294.  
  295. $8520           34080           SCBOT
  296. Specifies the lower boundary row of the scrolling region.
  297.  
  298. $8521           34081           BLANK
  299. Value of 1 forces character output to be blank spaces, regardless of
  300. attribute settings.
  301.  
  302. $8522           34082           RVS
  303. Value of 1 causes characters to be reversed.  A carriage return does not
  304. reset reverse mode as it does in 40 columns.
  305.  
  306. $8523           34083           SCRL
  307. Number of lines to scroll in 80 columns.  Only values between 0 and 3
  308. produce useful results.
  309.  
  310. $8900 - $8BFF    35072 - 35845    80 COLUMN FONT
  311. Each set of 8 bytes holds two character patterns.  The first four bits
  312. of each of the 8 bytes make up one character, and the last four bits of
  313. each byte make up the other character.  Locations $8900-$8A7F hold
  314. characters 32 through 127 and locations $8A80-$8BFF hold characters 160
  315. through 255.  Note that there are more character patterns available in
  316. 80 column mode than in 40 columns.
  317.  
  318. $8C00 - $8FFF    35840 - 36863    SCREEN MEMORY
  319.  
  320.  
  321. TERMINAL EMULATORS
  322.  
  323. This small area near the top of BASIC is the location of the terminal
  324. emulator modules.  SYS 36864 or JSR $9000 will enter terminal mode.  As
  325. soon as control is returned to the basic program, Novaterm checks the
  326. exit code to determine what interrupted terminal mode.  Novaterm then
  327. takes the appropriate action.  If you are going to write a terminal
  328. emulator, all you need to do to check the necessary conditions is
  329. include a call to display the status line and a call to the routine
  330. CHECK at $CD89.  The CHECK routine leaves the exit code in the
  331. accumulator, and your terminal emulator must store this value in
  332. location 36872 and exit if it is not zero.
  333.  
  334. $9000           36864           TERMINAL EMULATOR
  335.  
  336. $9003           36869           TERMINAL EMULATOR REGISTERS
  337. Add the offset value given below to determine the true value of each
  338. register.
  339.  
  340.     0    flag:    bit 0: 1=80 columns only
  341.             bit 1: 1=don't allow c/g mode
  342.     1    Last character received from modem.
  343.     2    Last character from keyboard.
  344.     3    Terminal emulator exit code.  The codes are:
  345.             1: C= (logo) key pressed
  346.             2: function key pressed
  347.             3: C= 0 pressed
  348.             4: script file check string found
  349.             5: carrier detected
  350.             6: carrier lost
  351.             7: ring detected
  352.     4    Number of function key pressed.  (1-16)
  353.         5       Temporary location for character.
  354.         6       Control key pressed?  (4=yes)
  355.  
  356.  
  357. MACHINE LANGUAGE
  358.  
  359. This area in memory contains the machine language routines.  Each
  360. routine number represents the byte offset from the starting location of
  361. 38400 ($9600).
  362.  
  363. Routine 0    PRINT
  364. Used by the terminal emulators to print characters to the screen in
  365. terminal mode, taking into account the color and character under the
  366. cursor and ensuring that the cursor does not move underneath the status
  367. line if it is on.
  368.  
  369. Routine 3    SETCRSR
  370. Used by PRINT to turn on the cursor and save the color and character.
  371.  
  372. Routine 6    RETCRSR
  373. Restores the screen location to its previous color and character.
  374.  
  375. Routine 9    STATLIN
  376. Puts the status line at the top of the screen if the flag is set.
  377.  
  378. Routine 12    BELL
  379. Uses the values and offsets in locations 912-931 to sound the bell.
  380.  
  381. Routine 15    OUTPUT
  382. Outputs the string contained in S$ to the modem, taking into account
  383. ASCII translation and control characters (such as ^M for a return). If
  384. local echo is on, output is sent to the screen as well.  If the byte
  385. immediately to the right of the last colon symbol in the status line has
  386. its high bit set, output to the modem will be supressed. Used for local
  387. mode in the BBS module.
  388.  
  389. Routine 18    RVSLIN
  390. Reverses characters on a screen line starting from the current cursor
  391. location and proceeding until it reaches an ASCII 96 (invisible
  392. character, like a space).  Used to highlight menu selections.
  393.  
  394. Routine 21    INABLE
  395. Re-enables RS232 input/output by initializing the CIA #2 chip with timer
  396. values.  In machine language modules (especially protocols), this
  397. routine should be called after disk access.
  398.  
  399. Routine 24    DISABL
  400. Disables RS232 input/output by turning off the CIA timer.  This routine
  401. should be called before turning off any interrupts.
  402.  
  403. Routine 27    RSGET
  404. Gets a character from receive buffer and puts it in the accumulator.
  405.  
  406. Routine 30    RSOUT
  407. Puts the character in the accumlator into the transmit buffer.
  408.  
  409. Routine 33    SETBAUD
  410. Uses the values from the baud rate table pointed to by the accumulator
  411. (by storing in location 780 from BASIC either a 0 for 300 baud, 1 for
  412. 1200 baud, or 2 for 2400 baud).  PAL baud rates are accounted for.
  413.  
  414. Routine 36    INIT
  415. Initialization routine executed when the BASIC program begins.  Sets the
  416. registers to their defaults, sets the locations of the RS232 buffers,
  417. and sets up vectors to the buffer routines.
  418.  
  419. Routine 39    KEYBD
  420. Keyboard input routine.  This takes the value in the accumulator
  421. (location 780 from BASIC) as the maximum length for the string, and the
  422. string is stored in I$.
  423.  
  424. Routine 42    PRINTEX
  425. Jumps into the middle of the PRINT routine to store characters in the
  426. buffer without actually printing them. Used by ANSI and VT102 terminals
  427. to capture escape sequences.
  428.  
  429. Routine 45    SAVESCR
  430. Used when terminal mode is exited.  Either saves 40 column screen to
  431. $B800-$BFFF or leaves hi-res mode.
  432.  
  433. Routine 48    RESTSCR
  434. Used when terminal mode is entered.  Either restores the saved terminal
  435. screen or enters hi-res mode.
  436.  
  437. Routine 51    KEYCHK
  438. Checks to see if the last key pressed was a function key. If it was, it
  439. determines which function key was pressed using location 203, location
  440. 653, and the table at locations 737-752.
  441.  
  442. Routine 54    DIRFIL
  443. Reads a directory entry from disk and stores it in Z$ when the directory
  444. file is opened with logical file #1 (as in OPEN 1,8,0,"$")
  445.  
  446. Routine 57    FILLSCR
  447. Fills color memory with the current cursor color (location 646).
  448.  
  449. Routine 60    GETSTR
  450. Inputs a string from the logical file specified in the .X register.
  451.  
  452. Routine 63    FLOWCTRL
  453. Starts or stops the remote using the selected flow control type.  Set
  454. the .X register to 0 to stop or 1 to start.
  455.  
  456. Routine 66    SETLOOK
  457. Finds the location of the array LK$(0..6), which contains pointers to
  458. the script file search strings.  Stores the location of the array in
  459. Novaterm registers 44-45.
  460.  
  461. Routine 69    JUMP
  462. Performs the script command JUMP by reading characters from the buffer
  463. until it encounters a value of 255, which indicates the end of a script
  464. statement.
  465.  
  466. Routine 72    BUFGET
  467. Reads one byte from the location pointed to by locations 251-252 into
  468. the .A register and increments the counter.  It will not read a
  469. character if the pointer is at the end of the buffer.
  470.  
  471. Routine 75    BUFSTR
  472. Stores the byte in the .A register into the location pointed to by
  473. locations 253-254.  Does not store a byte if the pointer is at the end
  474. of the buffer.
  475.  
  476. Routine 78    BUFDEL
  477. Deletes the current buffer entry.
  478.  
  479. Routine 81    CHKREC
  480. Puts a 1 in the accumulator if data is being received from the modem.
  481.  
  482. Routine 84    BLANKSCR
  483. Blanks or un-blanks the screen.
  484.  
  485.  
  486. $9657 - $9658    38487 - 38488    VECTOR
  487. Contains a vector to the register table at location 689.
  488.  
  489. $A000-$BFFF    40960 - 49151    80-COLUMN HI-RESOLUTION BITMAP
  490. The hi-resolution screen is placed here in 80 column mode.
  491.  
  492. $B000 - $B7FF    45056 - 47103    CHARACTER SET
  493. Font files are loaded directly into this area.  When 80 column mode is
  494. entered, this memory block is moved into the RAM underneath $D000 for
  495. temporary storage.
  496.  
  497. $B800 - $BBFF    47104 - 44031    TERMINAL SCREEN SAVE
  498. Used to save the contents of screen memory when terminal mode is exited.
  499. Restored when terminal mode is entered.
  500.  
  501. $BC00 - $BFFF    44032 - 45055    TEMPORARY COLOR MEMORY SAVE
  502. Used to save color memory when terminal mode is exited.  Restored to
  503. color RAM when terminal mode is entered.
  504.  
  505.  
  506. PROTOCOLS
  507.  
  508. A simple format for protocol files has been developed to keep things
  509. standard.  If you follow the format use the registers properly, you can
  510. write any new protocol.  NOTE:  When you write a protocol, you will need
  511. memory to store the data bytes contained in each protocol block.  That
  512. block MUST be stored in this memory area, but it doesn't matter where in
  513. the range it is located.  Don't use some other memory to store the
  514. protocol block, because there really isn't any free space not used by
  515. Novaterm.
  516.  
  517. To use a protocol from basic, you must first set the file name in the
  518. variable I$.  Open the file with logical file #2 first before an upload,
  519. but only first before a download if the file name and file type are not
  520. received during the download.  POKE the proper values for the block
  521. size, ASCII translation on or off, buffer transfer on or off, disk
  522. device number, and drive number.  Then SYS the appropriate location for
  523. an upload or download.  After the transfer is done, check the abort code
  524. register to see if the transfer aborted abnormally.
  525.  
  526. NOTE:  If you are going to use an existing modem driver separately, you
  527. MUST have the vectors in locations 679-688 set to routines that are the
  528. equivalents of those found in Novaterm's machine language code.
  529.  
  530. Here is an example of BASIC program text for downloading with single
  531. file or batch file protocols:
  532.  
  533. 999 PT=49161 : FL=0 : REM set the index variable
  534. 1000 IF PEEK(PT+14) AND 10 THEN 1020 : REM skip input of file name if
  535. protocol is batch or file name received
  536. 1005 INPUT"Name of file";I$ : IF I$="" THEN END
  537. 1010 TT=0 : IF(PEEK(PT+14) AND 1)=0 THEN INPUT"File type (P,S,U)" ;TP$
  538. :TT=-(TP$="P")- 2*(TP$="S")-3*(TP$="U") : REM TT = 1 for P, 2 for S, 3
  539. for U : REM if bit 0 of attribute is 0, file type is not received
  540. 1020 POKE PT,1 : REM suppress display of block on screen
  541. 1021 POKE PT+18,DV : REM poke device number
  542. 1022 POKE PT+21,0 : REM to or from disk (change to 1 for buffer)
  543. 1023 POKE PT+22,0 : REM ASCII translation off (change to 1 for on)
  544. 1025 IF PEEK(PT+14) AND 11 THEN 1040
  545. 1030 OPEN 2,DV,2,I$+","+TP$+",W" : REM if protocol is not batch, file
  546. name received, or file type received, then open the file
  547. 1035 PRINT : PRINT" Bytes recv:         Errors:"; : REM there must be
  548. EXACTLY 9 spaces between "Bytes recv" and "Errors"
  549. 1040 POKE PT+16,TT : SYS PT-6 : TT=PEEK(PT+16) : CLOSE 2 : REM store
  550. file type, then download, then get a received type.  close file #2 for
  551. safety.
  552. 1045 IF PEEK(PT+15) THEN END : REM if abort register is not zero, end
  553. transfer
  554. 1047 IF FL THEN BY=PEEK(PT+11) + PEEK(PT+12)*256 + PEEK(PT+13)*65536 :
  555. REM byte count for previous file
  556. 1050 A=0 : IF (PEEK(PT+14) AND 11) AND I$>"" THEN FL=1 :
  557. TP$=MID$("PSU",TT,1) : A=1 : REM set variable A to execute more
  558. statements under this condition : REM if protocol is batch, file name
  559. received, or file type received, then get file type.  received file name
  560. should be stored in I$. if I$ is empty, then batch protocol is finished.
  561. 1060 IF A THEN IF LEN(I$)>1 THEN IF MID$(I$,LEN(I$)-1,1)="," THEN
  562. TP$=RIGHT(I$,1) : I$=LEFT$(I$,LEN(I$)-2) : REM if the received file name
  563. has a file type attached (e.g. I$="file,p") then amputate the type and
  564. retain in TP$
  565. 1070 IF A THEN 1030 : REM finally, go to open the file. then re-enter
  566. protocol through same vector, and download will continue.
  567. 1080 END
  568.  
  569. The following BASIC program text is for uploading with a single file or
  570. batch protocol:
  571.  
  572. 999 PT=49161 : FL=0 : DIM F$(16) : OPEN 15,DV,15
  573. 1000 IF (PEEK(PT+14) AND 8)=0 THEN exit: REM if not batch protocol, skip
  574. multiple file input
  575. 1010 PRINT"Name of file #"FL+1; : INPUT I$
  576. 1020 IF I$>"" THEN FL=FL+1 : F$(FL)=I$ : IF FL<16 THEN 1010
  577. 1030 IF FL=0 THEN END
  578. 1040 FOR I=1 TO FL : I$=F$(I) : GOSUB 1050 : REM enter FOR loop.  set I$
  579. to current file name, then GOSUB the program to upload file.
  580. 1050 IF PEEK(PT+15) THEN I=FL : REM if transfer aborted, don't send any
  581. more files -- set FOR variable to end
  582. 1060 NEXT : I$="" : GOSUB 1050 : REM must GOSUB the upload routine one
  583. more time with an empty file name.  this tells the protocol to end the
  584. transfer.
  585. 1070 END
  586. 1100 INPUT"File name";I$ : IF I$="" THEN END
  587. 1110 TT=1 : OPEN 2,DV,2,I$+",P" : INPUT#15,E : IF E>19 AND E<>64 THEN
  588. CLOSE 2 : END : REM if disk error (not file type mismatch) then end
  589. 1120 IF E=64 THEN CLOSE 2 : TT=2 : OPEN 2,DV,2,I$+",S" : INPUT#15,E : IF
  590. E=64 THEN CLOSE 2 : TT=3 : OPEN 2,DV,2,I$+",U" : INPUT#15,E : IF E=64
  591. THEN CLOSE 2 : END : REM check for correct file type
  592. 1130 PRINT : PRINT" Bytes sent:         Errors:"; : REM there must be
  593. EXACTLY 9 spaces between "Bytes sent" and "Errors"
  594. 1140 POKE PT+16,TT : SYS PT-9 : CLOSE 2 : IF PEEK(PT+15) THEN END : REM
  595. store file type, then upload.  if abort register is not zero, then
  596. transfer aborted.
  597. 1150 IF FL THEN RETURN : REM if batch protocol in progress, return from
  598. GOSUB.
  599. 1160 END
  600.  
  601. The BASIC code for uploading and downloading given here is not exactly
  602. what is used in Novaterm itself, but the above programs should do the
  603. job. You can change the cosmetics of the transfer routines to fit your
  604. own programs, but you must include a statement to print the line "Bytes
  605. xxxx        Errors:" or else you will have numbers appearing on your
  606. screen without a label.
  607.  
  608. $C000           49152           UPLOAD
  609. Upload a file from logical file #2.
  610.  
  611. $C003           49155           DOWNLOAD
  612. Download a file to logical file #2.
  613.  
  614. $C006           49158           ABORT
  615. Abort batch transfer from BASIC.
  616.  
  617. $C009           49161           PROTOCOL REGISTERS
  618. Add the offset value given below to determine the true value of each register.
  619.  
  620.   0     Flag: 1=suppress display in window
  621.   1-2   Size of one block in bytes.
  622.   3-4   Minimum block size (for variable sizes).
  623.   5-6   Maximum block size (for variable sizes).
  624.   7-8   Current block number.
  625.   9-10  Bad block count.
  626.   11-13 Byte count.
  627.   14    A flag with the following bits used:
  628.           bit 0: file type received?  (1=yes)
  629.           bit 1: file name received?  (1=yes)
  630.           bit 2: use screen window?  (1=yes)
  631.           bit 3: batch protocol?  (1=yes)
  632.           bit 4: abort on carrier loss? (1=yes) (can be set by basic
  633.                  program)
  634.           bit 5: prevent downloading?  (1=yes)  (for upload-only
  635.                  protocols)
  636.           bit 6: prevent uploading?  (1=yes)  (for download-only
  637.                  protocols)
  638.           bit 7: is this Zmodem?  (1=yes)  (to enable auto-download)
  639.   15    Protocol abort code.  (0=good, 1=bad)
  640.   16    File type is stored here by the program before an upload or if
  641.         received by a download.
  642.  
  643.   17    Unused
  644.   18    Disk device number.
  645.   19-20 Screen block window size.
  646.   21    Upload or download from buffer?  (1=yes)
  647.   22    ASCII translation?  (1=yes)
  648.   23    Strip padding?  (1=yes)
  649.   24    Drive number.
  650.  
  651.  
  652. MODEM DRIVERS
  653.  
  654. Another important feature of Novaterm is its ability to support ANY type
  655. of modem that it is programmed for.  Using this format you can program a
  656. modem driver that is not already supported.
  657.  
  658. In order to use a modem driver, set an index variable to the start of
  659. the modem driver, such as MD=52224. Then, to perform any of the
  660. operations, do a SYS MD+xx, where xx is whatever the corresponding
  661. offset happens to be.  For example, to take the phone off the hook, you
  662. would do a SYS MD+3.  To dial a number, you would write: P$="555-1212" :
  663. SYS MD+12
  664.  
  665. NOTE:  If you are going to use an existing modem driver separately, you
  666. MUST have the CARDET vector in locations 687-688 set to some machine
  667. language routine that checks for a carrier.
  668.  
  669. The baud rate locations below hold values which correspond to the
  670. following:
  671.  
  672. 0=300 baud    4=9600 baud
  673. 1=1200 baud    5=19200 baud
  674. 2=2400 baud    6=38400 baud
  675. 3=4800 baud
  676.  
  677. $CC00           52224           HANGUP
  678. Hang up the phone.
  679.  
  680. $CC03           52227           PICKUP
  681. Take the phone off the hook.
  682.  
  683. $CC06           52230           ANSWER
  684. Answer a ring and determine caller's baud rate.
  685.  
  686. $CC09           52233           UNUSED
  687.  
  688. $CC0C           52236           DIAL
  689. Dial the number contained in P$.
  690.  
  691. $CC0F           52239           ABORT
  692. Abort dialing.
  693.  
  694. $CC12           52242           MODEM DRIVER REGISTERS
  695. Add the value of the offset given below to determine the true location
  696. of each register.
  697.  
  698.   0  Maximum baud rate of modem.
  699.   1  Baud rate at which modem answered.
  700.   2  Contains the value to compare with bit 4 of location 56577. If
  701.      equal, a carrier is present.
  702.   3  Unused.
  703.   4  A flag, using the following bits:
  704.        bit 0: Hayes compatible modem? (1=yes)
  705.        bit 1: 0=only pulse available, 1=tone and pulse available
  706.        bit 2: 0=pulse dial, 1=tone dial
  707.  
  708.  
  709. MORE MACHINE LANGUAGE
  710.  
  711. The index for these routines is 52608 ($CD80).
  712.  
  713. $CD80           52608           BUF
  714. General file output routine.  It reads data from the logical file number
  715. contained in location 781 and outputs to the file number stored in
  716. location 782.  If either location is 0, the buffer will be used.
  717.  
  718. $CD83           52611           CHKLIN
  719. Check to see if screen line has a menu bar terminator (ASCII 96).
  720.  
  721. $CD86           52614           CARCHK
  722. Returns a 1 in the accumulator if a carrier is found, 0 if not.
  723.  
  724. $CD89           52617           CHECK
  725. Used by the terminal emulators to check for a command key, a function
  726. key, a carrier detect, and a ring detect.  Exits terminal mode if any of
  727. these are found, and sets the exit code in location 36869.
  728.  
  729. $CD8C           52620           ONINT
  730. Turns on interrupts and calls INABLE.
  731.  
  732. $CD8F           52623           OFFLIN
  733. Blanks status line and makes the two lines available for screen use.
  734.  
  735. $CD92           52626           ROWCHK
  736. Used by STATLIN to check if the cursor is underneath the status line.
  737.  
  738. $CD95           52629           LOADML
  739. Loads the file contained in F$ from the device number in location 780.
  740.  
  741. $CD98           52632           BREAK
  742. Send 250 millisecond break signal.
  743.  
  744. $CD9B           52635           MENU
  745. General menu selection routine.  As input:
  746.  
  747.   accumulator (location 780) = starting location of menu bar
  748.   .X register (location 781) = row number of first item (minus 1)
  749.   .Y register (location 782) = number of menu items
  750.   menu flag (location 726):       bit 7: 1=allow right cursor key
  751.     bit 6: 1=allow function keys
  752.     bit 5: 0=jump to bottom of menu on exit
  753.     bits 0-4: tab position of menu items
  754.  
  755. Output:
  756.   accumulator (location 780) = number of selected item
  757.  
  758. $CD9E           52638           OFFINT
  759. Turns off interrupts and calls DISABL.
  760.  
  761.  
  762. $CF00 - $CFFF    52736 - 53247    RAM EXPANDER INTERFACE
  763. Reserved for the RAMDOS interface.  If a RAM expander is to be used,
  764. RAMDOS must be installed and the interface must be placed at page 207
  765. before loading Novaterm.
  766.  
  767. $D000 - $D7FF    53248 - 55295    BLOCK STORAGE AREA
  768. The RAM under this area is used to swap the font set and 80 column
  769. hi-res screen depending on which one is not in use.  In 80 column mode,
  770. the font is temporarily saved here, and part of the hi-res screen is
  771. saved here when 80 column mode is exited.
  772.  
  773. $D800 - $DBFF    55296 - 56319    COLOR MEMORY SAVE
  774. The 80 column color memory is saved here temporarily.
  775.  
  776. $E000 - $FFFF    57344 - 65535    BUFFER
  777. All data for the buffer is stored in this area.  The BASIC program keeps
  778. track of where files begin and end within this memory space.
  779.  
  780.  
  781. UTILITY PROGRAMS
  782.  
  783. Utility programs are usually written in BASIC, but you may write one in
  784. machine language as long as you tack on a BASIC SYS statement and the
  785. BASIC lines below so that the program can be loaded and executed by
  786. Novaterm.  These programs are run separately from Novaterm, so there are
  787. no restrictions on available variable names.
  788.  
  789. There are only three things that are necessary to interface a BASIC or
  790. ML program with Novaterm:
  791.  
  792. 1)  The first line of your program should read:
  793.  
  794.     poke 45,peek(174) : poke 46,peek(175) : clr
  795.  
  796. This line resets the pointer to the end of BASIC program text to the end
  797. of the program just loaded.  This is necessary because when Novaterm
  798. loads the program file from within its own program, this pointer is not
  799. set and it remains pointing to the end of Novaterm's main program.  If
  800. this pointer were left alone, your program would be greatly restricted
  801. in memory available for variable storage.  The above line will free up a
  802. great deal of memory.
  803.  
  804. 2)  Before loading a program file, Novaterm executes a POKE 6,255.  This
  805. is used to indicate to the program module that Novaterm loaded it
  806. directly.  In the place where your program exits, you should have some
  807. code that looks similar to this:
  808.  
  809. 1000 if peek(6)<255 then end
  810. 1010 open 2,dv,2,"prog menu" : input#15,e : close2 : if e<20 then
  811.      load"prog menu",dv
  812. 1020 open 2,dv,2,"novaterm *" : input#15,e : close2 : if e<20 then
  813.      load"novaterm *",dv
  814. 1030 end
  815.  
  816. This code first ends normally if location 6 does not contain 255.  If
  817. location 6 does contain 255, the code checks the disk (with the device
  818. number stored in the variable DV) to see if the module selection program
  819. is there.  It then tries to find Novaterm's main program if the module
  820. selection program is not found. Notice that the wildcard specifiers are
  821. set up to match any file with a version number in the filename "novaterm
  822. *".  This allows your module program to be compatible with any version
  823. of Novaterm.
  824.  
  825. 3)  The file name of your program must have the "nova." prefix so that
  826. the "Utility progs" option on the main menu will recognize it.
  827.  
  828.