17 November 1991

The content below is simply a reformatting of text as published decades ago by 9640 NEWS. The opinions and views expressed are not my (Jedimatt42) own. The content is published here to preserve and make accessible the technical data contained within.

Taken from the disk distributions archived at http://ftp.whtech.com/Geneve/9640 News disks v1-3/pc99 disks/

Note: This is in the disk for volume 3-1. 3-1 and 2-5 seems to be mixed in the archive.

NEWS

9640 News
Volume 2 #5

This issue of 9640 News contains extensive information for the programmer that wishes to program on the Geneve 9640. This information is the latest and most complete information that can be made available. This info was provided at the Chicago User's Group Programmer's meeting prior to the start of the Chicago Fair for those that attended.

Also included with this issue, is Version 0.91 of GEME. This has been released by Myarc to 9640 News for completion and general release to all Geneve owners. Updates will be available in subsequent releases of 9640 NEWS.

The Chicago Fair saw the release on one program making GOOD use of the Geneve and expanded memory. That is Sound F/X by Barry Boone and Texaments. I highly recommend this program and have played songs that are 5 minutes in length on the Geneve. In addition, to be reviewed in the next issue, Barry had converted a dozen Tomy Tutor games to be run directly from MDOS. These games are of top-notch quality and deserve to be supported. They may be ordered from Texaments.

The PSYSTEM run-time is now available directly from 9640 News. The PSYSTEM currently requires DS/DD capability due to the size of SYSTEM.LIBRARY file. The run-time module is "reported" to work with the old PCODE Card diskettes, but I have no way to confirm this. The disks may be ordered for $10 (2 DS/DD disks will be mailed).

Also released at Chicago was GenBench SHELL. This is a MDOS Shell package that supports WINDOWS 9640 and the mouse driver if you own it. Any MDOS or GPL program can be run out of this Shell program. Also included with this program is a set of utilities that may be used with the Full C Compiler (TIC) that permit one to use pop-up WINDOWS where Windows with status bars and inverse video selections are possible. This is very similar to the Windows seen in Telco and GEME, except it is is in 512*212*16 mode and whenever a WINDOW is displayed, it's contents are stored in CPU ram so that overlapping Windows can be used and created on the fly. This is a very powerful set of utilities with the programmer only needing to "print" the text, and no need to worry about the overlays that are on the screen.

Also available for the first time from 9640 News, has been the re-release of several programs by Mike Dodd. They are HyperCopy, PC-Transfer (with PC-Transfer Utils), PC-Transfer Utils, and Identifile. The enclosed catalog lists the reduced pricing structure when ordering from 9640 News.

This issue of 9640 News also includes the source code to RSBUG that Myarc and Paul Charlton have used to "debug" the operating system and utilities. This source code is being provided to provide further documentation into the inner-workings of the Geneve 9640 which have not been revealed to everyone.

Also included in this issue, is the source code to interfacing with the Command Line Interpreter. This is the code that GEME and WINDOWS 9640 uses to allow one to use MDOS commands better than the code provided by Paul Charlton.

Also included with the issue, is TASM-ARK that is Al Beard's latest MDOS version of his Assembler that runs from MDOS and does everything that GenPROG by Paul Charlton does, even better. It is a 2 pass compiler so it does take a little longer than GenASM, but it is documented and does everything that the documentation describes.

Also, within the next 6 months, I will be relocating from Memphis, TN to West Lafayette, IN. This will place me closer to the Chicago heartland of all TI'ers. My company is moving me and I will provide more information as it becomes available. I will welcome all responses of local user groups in that area.

Also, the TIC compiler will be released in the next issue of 9640 NEWS. This will be Volume 3 #1. Many folks will need to renew to receive this next issue. Version 1.58 was ready to be released, but conversation with Clint Pulley indicated that a "significant" bug had been isolated which would make "real-world" C programs more likely to run without any modifications. The update is pending upon Al Beard's return from Saudi Arabia. The next issue should be available before Christmas and could be multiple issues.

Till next issue,

Beery Miller
11.17.91

GEMEDOCS

GEME docs

GEME is a product of Myarc, Inc., and recent updates by Beery Miller of 9640 News. September of this year (1991), Lou Phillips gave me permission to complete whatever I could on GEME and make it available to Geneve Owners however I desired. The Good guy that I am (grin), it will be released in it's finished form in 9640 News to all subscribers that are maintaining their subscription. There will be no additional fees, etc. incurred from this product.

During my development part of this program, several needs and interests to maintain compatibility across the whole possible Geneve User Base has been attempted. In doing such, I have set one standard that I am going to adhere too.

1) It will work with MDOS 0.97H.

I can make no other guarantees, except only to say that it should work. If it doesn't work, UPGRADE!!!

Due to the various hardware configurations available and memory limitations, I am attempting to "solve" this by using disk based video memory overlays.

In other words, when a 'window' has been expanded to full screen, it's graphics page is stored as a 256 to 260 sector size file for rapid loading and saving. Hard Drive usage is highly recommended. If it is not available, a separate version of the program (WM5) is available. Filename of WM will use the hard drive for all Screen storages.

Installation:

To install the program on a HARD DRIVE, create a directory call GEME2 on HDS1 device. Anything other than that, you will have problems.

To use on Floppy based systems ONLY, initially create a RAMDISK large enough to hold 260 sectors X the number of graphic screens requiring storage. The DEMONSTRATION program can use up to 1040 sectors, possibly 1300 sectors if utilizing an additional option explained later. Allow enough room for the demo programs on your installed device.

If you wish to use a FLOPPY basis access other than DSK5, then sector edit the appropriate file (WM5) and change all occurences of DSK5 to DSK1/DSK9, etc.

NOTE:

IF YOU INSTALL THE FILES ON A FLOPPY BASED SYSTEM, YOU MUST CREATE A DIRECTORY CALLED GEME2 . COPY ALL FILES THAT ARE PROGRAM IMAGE FORMAT INTO THIS SUBDIRECTORY.

Once you have installed the system (all files on the disk), type either WM or WM5 (hard drive or floppy drive versions) and you will see the introductory screen.

Now, what can you do once you are this far????? Well, let's first discuss some things that are being fixed.

To bring up the 3 overlayed window menu choices, you must depress the middle mouse button and keep it depressed while moving the mouse pointer around. To make a choice from a menu, move the arrow onto the choice from the menu and it will be highlighted. Releasing the button while on the selection will invoke that choice. To choose from one of the other windows, simply move the arrow off of the top window onto one of the others, and that window will pop to the top. Selections from each of the other windows can be made the same way as the first menu window. The menus will pop up at whatever position on the screen your arrow is at when the middle mouse button is pressed. Below is a representation of how the menus will look.

                           ------------------- 
                          |All Windows        |
                          |  ------------------- 
                          | |Execute            |
                          | |  ------------------- 
                          | | |This Window        |
                          | | |                   |
                          | | |  Expand           |
                          | | |  Redisplay        |
                          | | |  Zap              |
                           -| |  Scroll X         |
                             -|  Scroll Y         |
                              |                   |
                               ------------------- 

Below is a description of the operations available from each menu.

With this version of this program, the first thing you will want to do is select the "Execute" window.

                           ------------------- 
                          |All Windows        |
                          |  -------------------  
                          | |This Window        |
                          | |  -------------------
                          | | |Execute            |
                          | | |                   |
                          | | |  Drawing demo     |
                          | | |  Demonstration    |
                          | | |  Task Loading     |
                           -| |  Dos CLI          |
                             -|                   |
                              |                   |
                               ------------------- 

Drawing demo

Loads a demonstration of a drawing program.

THIS program has bugs, but allows one to see some "intro" features.

Demonstration

Loads a demonstration program featuring five windows containing information on the Geneve.

Task Loading

Allows loading of other programs. No parsing of filename is available at this time, so HDS1. is required, not C:, etc.

Dos CLI

Drops to the command line interpreter with the same interface as that used by WINDOWS 9640. Commands may be entered just as if you were at the CLI. Return to GEME by pressing ALT/SHIFT.

From this menu ("Execute"), you may select one of the two demos by highlighting that selection with the arrow. Choosing "Demonstration" will load the demo program. Here you will see 5 WINDOWS pop up in brilliant colors and text start printing in each area. After a few seconds, it will stop. Essentially this is the end of the DEMO, but the start of the Windows Manager (WM). The mouse buttons all play a very very important role here.

NOTE: Being on different Menu Bars with the mouse pointer, or in the middle of screens, will all pull up different features. The Menu Bar will be highlighted for that particular window when you enter that window.

                           ------------------- 
                          |All Windows        |
                          |  ------------------- 
                          | |Execute            |
                          | |  ------------------- 
                          | | |This Window        |
                          | | |                   |
                          | | |  Expand           |
                          | | |  Redisplay        |
                          | | |  Zap              |
                           -| |  Scroll X         |
                             -|  Scroll Y         |
                              |                   |
                               ------------------- 

These operations will be performed only on the window you are currently on .

Expand

Move your mouse pointer to the middle of the window you want to expand. Depress the middle mouse button and select "Expand" and the window will expand to full screen size. Depressing the middle mouse button while on the menu bar of the expanded window will bring up a new menu window.

                              -----------
                             | Shrink    |
                             | Graphics  |
                             | Text Mode |
                             | Import #0 |
                              -----------

At this time, selecting "Shrink" is the only operable selection. This will collapse the window back to its previous size and show the other windows as well.

Redisplay

Selecting "Redisplay" from the menu "repaints" the currently displayed window. If there is a display problem, (other than the documented character glitch) this will usually correct it.

Zap

Selecting "Zap" will permanently erase that window (unless the program is reloaded, of course).

Scroll X/Scroll Y (in a previously expanded window in a small screen)

Choose the Scroll X or Scroll Y command from the menu by using the middle mouse button. If you choose the command to SCROLL X or SCROLL Y in a miniature window, the middle mouse button will toggle SCROLL X or SCROLL Y direction. Use the Left and Right buttons to move either Left and Right or Up and Down. To escape from the scrolling feature, release all mouse buttons, then press the middle and right mouse buttons to retrieve the normal mouse pointer. If it doesn't immediately return, release the buttons again and repeat TOGETHER!!!

                           ------------------- 
                          |This Window         |
                          |  ------------------- 
                          | |Execute            |
                          | |  ------------------- 
                          | | |All Windows        |
                          | | |                   |
                          | | |  Screen Save      |
                          | | |  Screen Load      |
                          | | |  Proportion       |
                           -| |  Redisplay        |
                             -|  Zap              |
                              |                   |
                               ------------------- 

Screen save

This option will save a copy of the displayed screen to your storage device. (This is how demo slides can be produced.) To check it out, drop to the CLI and catalog your storage device when you first load GEME. There should only be the files you put there. Execute one of the demos and then save the screen. Drop to the CLI and do another catalog. There should now be a file by the name of "SCREEN9" or some such that is about 250 sectors or so. That is your saved screen.

Screen Load

This option will load a previously saved screen.

Proportion

This option divides the screen evenly among the displayed windows. For example, if there were four windows on the screen and you selected this option, each would reappear using 1/4 of the screen.

Redisplay

Selecting this option "repaints" all of the currently displayed windows. If there is a display glitch, this will usually correct it.

Zap

This will delete all windows. This option exits you from the program.

Moving a WINDOW

While on the menu bar of a window, press the right mouse button and the window will disappear and the icon will change to a crosshair type. Move the pointer to the place on the screen where you want the window to reappear and click the right mouse button again. The window will reappear.

Resizing a WINDOW

Place the mouse pointer on the border of a window (horizontal border for a vertical expansion or vertical border for a horizontal expansion). When you are EXACTLY on the line your pointer will change to two arrows pointing at each other separated by a line. By depressing any mouse key and moving in the direction you wish to expand, when you get to your desired position and release the button, the window will expand to that size. Compression of a window can be accomplished in the same manner.

Collapsing a WINDOW

You may collapse a window down to it appearing as its menu bar only, by clicking the left mouse button while on the bar. Clicking it again restores it to its previous size.

PROGRAMMING ASPECTS

As a programmer, 8 open WINDOWS are available at any single point in time. You must make sure on any coding that you account for the WINDOWS MANAGER closing the WINDOW and you must be prepared to take action if it happens (exiting, recreating, etc.)

Also, WM does all the graphics printing. You should not use any VIDEO XOP's as DRASTIC results can happen if they interfere with information that GEME is doing. GEME writes directly to the video ports and does not use the VIDEO XOP's once past the introduction screen.

GEME's screen is in the first 64K of VDP. The second page of VDP (64K) is not available as overlays are stored here. No IFS, ANDS, or BUTS.

A listing of the XOP's is included, although this list is not 100 % bug free, but should allow something simple to be used.

The GEME XOP is number >000C, whereas the VIDEO XOP is >0006.

You should not invoke interrupts in your program or use the KSCAN feature of MDOS. An opcode of GEME is available. Keys will be returned to the WINDOW that has the mouse pointer in it (and will be buffered if necessary). If the mouse pointer is not in it, no key will be detected.

A DROP to CLI is available, with the same interface as that available in WINDOWS 9640.

This program does not support any program currently available. WINDOWS 9640 will be supported as a hook to toggle between WINDOWS 9640 and GEME. GEME will never control previously written programs, and no attempt to do such will be made in the next year. They are two totally different BEASTS!!!

When handling the printing of text strings, it is recommended that all text lines be 80 characters in width. Anything less, when lines scroll a line will not be erased, anything more than 80 characterss, they will not be printed. Routines were written to be quick (faster than MDOS).

Several other things. All video interrupts have been removed. If you write for some unknown reason to video (either XOP's or through ports), chances are that on MEMEX systems your programs will NOT run. It must be done by GEME, or you must check VIDEO STATUS after each command issued. Otherwise, distorted screens will appear (this is documented!!!!!).

For now, this is it. The rest will be published in a future issue of 9640 News. The source code for a demo program is included.

Beery Miller
10/13/91
Additional documentation by Doug Phelps 11/02/91

*
* Windows Library XOP Handler
*
*
* Call:    XOP  @TWELVE,0
*
*
* Pass:    R0  Routine Number
*
*
* Return:  EQ  Set if Error
*              Reset if No Error
*
*          R0  Error Code:
*
*                 0  Invalid Routine Number
*                 1  Invalid Window Number
*                 2  Too Many Windows in Use
*                 3  Window Hidden
*                 4  Window Expanded
*                 5  Invalid Font Number
*                 6  Too Many Fonts in Use
*
*
* Note:  All Addresses are EXECUTION ADDRESSES
*        Unless Explicitly Stated Otherwise.
*
*        Fast Ram >F040 through >F07F is Reserved
*        for Library Use.  DO NOT USE!
*
*
********************************************************************************
*
* Routine 0 - Open a Window
*
* Pass:    R0  >0000
*          R1  MSB  Column Number (0=Left, 1=Right)
*              LSB  Title Bar/Message Line Font Number
*          R2  Desired Interior Height in Pixels
*          R3  MSB  Window Frame Color Code (>01->0F)
*              LSB  Interior Window Color Code (>01->0F)
*
* Return:  R0  Window Number
*          R1  Interior Height
*          R2  Interior Width
*
********************************************************************************
*
* Routine 1 - Redraw Window
*
* Pass:    R0  >0001
*          R1  Window Number
*
* Return:  R0  Exterior Height
*
********************************************************************************
*
* Routine 2 - Hide/Expose Window Toggle
*
* Pass:    R0  >0002
*          R1  Window Number
*
* Return:  R0  Exterior height
*
*******************************************************************************8
*
* Routine 3 - Display Title Bar Text
*
* Pass:    R0  >0003
*          R1  Window Number
*          R2  Text Address (First Byte is Length)
*
* Warning: Text data must not cross a page boundary
*          and must reside between >0400 and >DFFF.
*
********************************************************************************
* Routine 4 - Display Message Line Text
*
* Pass:    R0  >0004
*          R1  Window Number
*          R2  Text Address (First Byte is Length)
*          R3  MSB  Text Color Code
*              LSB  Background Color Code
*
* Warning: Text data must not cross a page boundary
*          and must reside between >0400 and >DFFF.
*
********************************************************************************
*
* Routine 5 - Set Cursor Icon Number
*
* Pass:    R0  >0005
*          R1  Window Number
*          R2  Icon Number
*
********************************************************************************
*
* Routine 6 - Close a Window
*
* Pass:    R0  >0006
*          R1  Window Number
*
********************************************************************************
* Routine 7 - Add a Font
*
* Pass:    R0  >0007
*          R1  Height of Characters
*          R2  Width of Characters
*          R3  Address of Font Data
*
* Return:  R0  Font Number
*
********************************************************************************
*
* Routine 8 - Set Menu Options
*
* Pass:    R0  >0008
*          R1  Window Number
*          R2  Address of Menu Data (0=None)
*
* Warning: Menu data must not cross a page boundary
*          and must reside between >0400 and >DFFF.
*
********************************************************************************
*
* ROUTINE 9 - FOOBAR
*
********************************************************************************
*
* ROUTINE >0A - GETKEY
* PASS
*      R0  >0A
*      R1  Window number
*
* RETURNS
*      R0, KEY PRESSED
********************************************************************************
* ROUTINE >0B - DISPLAY
* PASS
*      R0  >0B
*      R1  Window number
*      R2  NEW TEXT LINE (FIRST BYTE IS LENGTH)
*      R3  MSB  TEXT COLOR CODE
*          LSB  BACKGROUND COLOR CODE
*      R4  Replace last updated line (R4=0) or Next line (R4=-1)
*          IF 1 thru 22, then that line of page
*
*      WARNING, TEXT MUST LIE ON PAGE BOUNDARIES  >0400 TO >DFFF
* RETURNS
*      R0   = 0 IF WINDOW HIDDEN OR NO KEY IN BUFFER
********************************************************************************
*      OPCODE >0C
*      LOCATE TEXT WINDOW BOUNDARIES, RETURNS CURRENT WINDOW POSITIONS
*
*     PASS
*      R0  >0C
*      R1  WINDOW NUMBER
*
*
*      RETURN
*
*      R1   INTERIOR UPPER LEFT X COORDINATE
*      R2   INTERIOR UPPER LEFT Y COORDINATE
*      R3   CURRENT INTERIOR WIDTH
*      R4   CURRENT INTERIOR HEIGHT
*      R5   WINDOW HIDDEN FLAG >FF = HIDDEN
*
*
************************************************************************
*    OPCODE >0D
*      SET SCREEN FOR GRAPHICS, NON TEXT DISPLAY
*
*
*      ALLOWS "SHRINK" TO SAVE SCREEN DISPLAY
*
*      PASS
*      R0 = >0D
*      R1 = WINDOW NUMBER
*
*      RETURNS
*
************************************************************************
*
*      GET MOUSE LOCATIONS AND CLICKS
*      OPOCODE >0E
*
*      PASS
*      R0 = >0E
*      R1 = WINDOW NUMBER
*
*      RETURN
*      R1 = X
*      R2 = Y
*      R3 = CLICK OPTIONS
*
*           MSB    bits       LSB            Meaning
*               0  1  2  3  4  5  6  7
*               |  |  |  |  |  |  |  |
*               |  |  |  +--+--+--+--+-------Not Used (ZERO)
*               |  |  +----------------------Right Button (0=up, 1=down)
*               |  +-------------------------Middle Button (0=up, 1=down)
*               +----------------------------Left Button (0=up, 1=down)
*
****************************************************************************
* OPCODE >0F                  DRAW LINE PIXEL BY PIXEL
*      PASS R0 = >0F
*           R1 = WINDOW NUMBER
*           R2 =
*           R3 = UPPER LEFT X
*           R4 = UPPER LEFT Y
*           R5 = DELTA X
*           R6 = DELTA Y
*           R7 = MSB COLOR CODE
****************************************************************************
* OPCODE >10      DISPLAYS A RECTANGLE
*      PASS R0 = >10
*           R1 = WINDOW NUMBER
*           R2 =
*           R3 = UPPER LEFT X
*           R4 = UPPER LEFT Y
*           R5 = WIDTH
*           R6 = HEIGHT
*           R7 = MSB COLOR CODE
***************************************************************************
* OPCODE >11      FILLS IN A RECTANGULAR AREA
*      PASS R0 = >11
*           R1 = WINDOW NUMBER
*           R2 =
*           R3 = UPPER LEFT X
*           R4 = UPPER LEFT Y
*           R5 = WIDTH
*           R6 = HEIGHT
*           R7 = MSB COLOR CODE
****************************************************************************
* OPCODE >12      DISPLAYS A RECTANGLE
*      PASS R0 = >12
*           R1 = WINDOW NUMBER
*           R2 =
*           R3 = UPPER LEFT X
*           R4 = UPPER LEFT Y
*           R5 = WIDTH
*           R6 = HEIGHT
*           R7 = MSB COLOR CODE
*****************************************************************************
* OPCODE >13             CLEAR SCREEN
*   PASS R0 = >13
*
*****************************************************************************
* OPCODE >14             ADD SCROLL BARS TO MENU'S
*      PASS R0 = >14
*           R1 = WINDOW #
*
*
*****************************************************************************

DEMO3-S

       DEF SLAST1,SLAST2
       MAC  DXOP
       MAC  !1
!!0    XOP  !!1,!2
       !-MEND
       MEND
       B    @MAIN3

PGETBL DATA 0,0,0,0
MMG    DATA 7
UWS    EQU  >F000

MAIN3  LWPI UWS

       LI   R0,1         *Begin setting up for extra memory
       LI   R1,7         *Request 7 pages
       LI   R2,1         *Local page #1
       CLR  R3           *Slow RAM is OK since it's disk access
       XOP  @MMG,0       *Ask system for the RAM...
       ABS  R0           *Check for errors
       JEQ  GATMEM       *If none, then go to GOTMEM
*      LI   R0,>27
*      LI   R1,NOMEM
*      CLR  R2
*      XOP  @VID,0
*      BLWP @MDOS        *Warm Reboot of MDOS
GATMEM LI   R0,4         *Get mmgt page map.
       LI   R1,PGETBL    *Put it at pgetbl
       LI   R2,20        *Pgetbl is 10 words wide
       XOP  @MMG,0       *

       MOVB @PGETBL+1,@>F111              lets map our memory in
       MOV  @PGETBL+2,@>F112
       MOV  @PGETBL+4,@>F114
       MOV  @PGETBL+6,@>F116

*
* Test Task
*



       B    @START

       DXOP DOS,0
ONE    DATA >0101
VID    DATA 6
THREE  DATA 3
WIND   DATA 12
LL1    DATA 0
LL2    DATA 0
LL3    DATA 0
LL4    DATA 0
LL5    DATA 0

TBMSG1 BYTE 21
       TEXT 'What is a Geneve ?   '
       EVEN
TBMSG3 BYTE 21
       TEXT 'Software Availability'
       EVEN
TBMSG2 BYTE 21
       TEXT 'Operating Systems    '
       EVEN
TBMSG4 BYTE 21
       TEXT 'Miscellaneous Notes  '
       EVEN
TBMSG5 BYTE 10
       TEXT 'GEME Clock'
       EVEN

MLMSG1 BYTE 35
       TEXT 'Welcome to the World of the Geneve!'
       EVEN
MLMSG3 BYTE 34
       TEXT 'Please Support the Geneve!!!!!!!!!'
       EVEN
MLMSG2 BYTE 34
       TEXT 'What is the New OS Today ????     '
       EVEN
MLMSG4 BYTE 34
       TEXT 'Lets Enter Something              '
       EVEN
MLMSG5 BYTE 11
       TEXT 'Time of Day'
MENUA  DATA 1
       DATA 70
       DATA 30
       DATA MENU1A



MENU1A DATA 1,QUIT
       BYTE 7
       TEXT 'Options'
       BYTE 4
       TEXT 'Quit'
       EVEN


KEY    DATA 0

START  LWPI >F000

       LI   R1,QUIT
       MOV  R1,@>00FE

       CLR  R0
       CLR  R1
       LI   R2,60
       LI   R3,>010D
       DOS  @WIND

       MOV  R0,@LL1


       CLR  R0
       CLR  R1
       LI   R2,60
       LI   R3,>0F01
       DOS  @WIND

       MOV  R0,@LL2

       CLR  R0
       LI   R1,>0100
       LI   R2,60
       LI   R3,>0F04
       DOS  @WIND

       MOV  R0,@LL3

       CLR  R0
       LI   R1,>0100
       LI   R2,60
       LI   R3,>0107
       DOS  @WIND

       MOV  R0,@LL4

       CLR  R0
       LI   R1,>0100
       LI   R2,30
       LI   R3,>0A06
       DOS  @WIND
       MOV  R0,@LL5


       LI   R0,3
       MOV  @LL5,R1
       LI   R2,TBMSG5
       DOS  @WIND

       MOV  @LL1,R1
       LI   R2,TBMSG1
       DOS  @WIND

       MOV  @LL2,R1
       LI   R2,TBMSG2
       DOS  @WIND

       MOV  @LL3,R1
       LI   R2,TBMSG3
       DOS  @WIND

       MOV  @LL4,R1
       LI   R2,TBMSG4
       DOS  @WIND

       LI   R0,4
       MOV  @LL1,R1
       LI   R2,MLMSG1
       LI   R3,>010D
       DOS  @WIND

       LI   R0,4
       MOV  @LL2,R1
       LI   R2,MLMSG2
       LI   R3,>0F01
       DOS  @WIND

       LI   R0,4
       MOV  @LL3,R1
       LI   R2,MLMSG3
       LI   R3,>0F04
       DOS  @WIND


       LI   R0,4
       MOV  @LL4,R1
       LI   R2,MLMSG4
       LI   R3,>0107
       DOS  @WIND

       LI   R0,4
       MOV  @LL5,R1
       LI   R2,MLMSG5
       LI   R3,>0A06
       DOS  @WIND


       LI   R0,8
       MOV  @LL1,R1
       LI   R2,MENUA
       DOS  @WIND
       JMP  READKY1

READKY2
       B    @PAUSE1
READKY1
       CLR  @COUNTER
       MOV  @COUNTER,R2

READKY
*      MOVB @ONE,@>0103

       MOV  @COUNTER,R2
       CI   R2,21
       JEQ  READKY2
       MOV  R2,@STOREME

       LI   R0,>0B
       MOV  @LL1,R1
       A    R2,R2
       MOV  @WINDOW1(R2),R2
       LI   R3,>010D
       SETO R4
       DOS  @WIND

       MOV  @STOREME,R2

       LI   R0,>0B
       MOV  @LL2,R1
       A    R2,R2
       MOV  @WINDOW2(R2),R2
       LI   R3,>0F01
       SETO R4
       DOS  @WIND


       MOV  @STOREME,R2

       LI   R0,>0B
       MOV  @LL3,R1
       A    R2,R2
       MOV  @WINDOW3(R2),R2
       LI   R3,>0F04
       SETO R4
       DOS  @WIND

       MOV  @STOREME,R2

       LI   R0,>0B
       MOV  @LL4,R1
       A    R2,R2
       MOV  @WINDOW4(R2),R2
       LI   R3,>0107
       SETO R4
       DOS  @WIND

       INC  @COUNTER

       LI   R0,1
       LI   R1,BUFFER1
       DOS  @UTIL

       LI   R0,>0B
       MOV  @LL5,R1
       LI   R2,BUFFER
       LI   R3,>0A06
       CLR  R4
       DOS  @WIND

       B    @READKY

PAUSE1

       LIMI 0
       LI   R0,1
       LI   R1,BUFFER1
       DOS  @UTIL
       LIMI 2

       LI   R0,>0B
       MOV  @LL5,R1
       LI   R2,BUFFER
       LI   R3,>0A06
       CLR  R4
       DOS  @WIND

       JMP  PAUSE1





STOREME DATA 0
COUNTER DATA 0

WINDOW1 DATA A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16
        DATA A17,A18,A19,A20,A21,A22

WINDOW3 DATA B1,B24,B2,B3,B4,B5,B6,B7,B8,B9,B10,B13,B14,B15,B19
        DATA B20,B21,B22,B16,B17,B18,B23

WINDOW2 DATA C1,C2,C3,C4,C5,C6,C7,C22,C8,C9,C10,C11,C12,C13,C14,C15,C16
        DATA C17,C18,C19,C20,C21

WINDOW4 DATA D1,D2,D3,D4,D5,D6,D7,D8,D9,D10,D11,D12,D13,D14,D15,D16
        DATA D17,D18,D19,D20,D21,D22
SLAST1  DATA 0
        AORG >2000
BUFFER  BYTE 79
BUFFER1 TEXT '                                         '
        TEXT '                                         '
        EVEN
UTIL    DATA 9
A1      BYTE 80
        TEXT 'The Geneve 9640 is a 512 K CPU RAM Compu'
        TEXT 'ter with 128 K video ram.  The standard '
        EVEN
A2      BYTE 80
        TEXT 'setup includes a Peripheral Expansion Bo'
        TEXT 'x with Two DS/DD disk drives using the  '
        EVEN
A3      BYTE 80
        TEXT 'Hard and Floppy Disk Controller connecte'
        TEXT 'd to a 40 MB Hard drive.  In addition, a'
        EVEN
A4      BYTE 80
        TEXT 'RS232 card may be added to support print'
        TEXT 'ers, modems, and other communication    '
        EVEN
A5      BYTE 80
        TEXT 'devices.  Other devices may be added suc'
        TEXT 'h as the RAVE Speech Board adapter, the '
        EVEN
A6      BYTE 80
        TEXT 'MBP A/D Board, or the MEMEX Memory Expan'
        TEXT 'sion Board (by B. Mills and R. Walters).'
        EVEN
A7      BYTE 80
        TEXT '                                        '
        TEXT '                                        '
        EVEN
A8      BYTE 80
        TEXT 'The Video processor used by the Computer'
        TEXT ' is a Yamaha 9938 processor capable of  '
        EVEN
A9      BYTE 80
        TEXT 'displaying up to 256 * 212 * 256 Colors '
        TEXT 'in the highest resolution mode.         '
        EVEN
A10     BYTE 80
        TEXT 'Software that is packaged with the Genev'
        TEXT 'e 9640 includes MDOS(MS-DOS look-alike),'
        EVEN
A11     BYTE 80
        TEXT 'GPL Interpreter for TI-99/4A emulation, '
        TEXT 'My-Word for 80 column Word processing,  '
        EVEN
A12     BYTE 80
        TEXT 'ABASIC, and Multiplan updates for 80 col'
        TEXT 'umns.  The Pascal Runtime system will be'
        EVEN
A13     BYTE 80
        TEXT 'included at a later date.  Current retai'
        TEXT 'lers for the Geneve Computer include:   '
        EVEN
A14     BYTE 80
        TEXT 'Dheins True Value that include the Myarc'
        TEXT ' Mouse and MyART for $425.              '
        EVEN
A15     BYTE 80
        TEXT 'Other Distributors may have the computer'
        TEXT ' in stock, please ask.                  '
        EVEN
A16     BYTE 80
        TEXT '                                        '
        TEXT '                                        '
        EVEN
A17     BYTE 80
        TEXT 'The Geneve 9640 is supported through sev'
        TEXT 'eral peple.  They include the following:'
        EVEN
A18     BYTE 80
        TEXT '9640 News, P.O. Box 752465, Memphis, TN '
        TEXT '38175                                   '
        EVEN
A19     BYTE 80
        TEXT 'Asgard Software, P.O. Box 10306, Rockvil,
        TEXT 'le, MD 20849                            '
        EVEN
A20     BYTE 80
        TEXT 'LGMA Products, 5618 Apple Butter Hill Ro'
        TEXT 'ad, Coopersburg, PA. 18036              '
        EVEN
A21     BYTE 80
        TEXT 'McCann Software, 4411 North 93rd Street,'
        TEXT ' Omaha, NE 68134                        '
        EVEN
A22     BYTE 80
        TEXT 'T & J Software, 515 Alma Real Drive, Pac'
        TEXT 'ific Palisades, CA 90272                '
        EVEN


B1      BYTE 80
        TEXT 'Software currently available for the Gen'
        TEXT 'eve 9640 include:                       '
        EVEN
B2      BYTE 80
        TEXT 'Software Title             Price        '
        TEXT 'Distributor                             '
        EVEN
B3      BYTE 80
        TEXT '9640 News (Vol #1)        $25.00        '
        TEXT '9640 News                               '
        EVEN
B4      BYTE 80
        TEXT '9640 News (Vol #2)        $25.00        '
        TEXT '9640 News                               '
        EVEN
B5      BYTE 80
        TEXT '9640 News (Vol #3)        $25.00        '
        TEXT '9640 News                               '
        EVEN
B6      BYTE 80
        TEXT 'WINDOWS 9640              $25.00        '
        TEXT '9640 News                               '
        EVEN
B7      BYTE 80
        TEXT 'Tetris for MDOS           $25.00        '
        TEXT '9640 News                               '
        EVEN
B8      BYTE 80
        TEXT 'Barricade for ABASIC      $15.00        '
        TEXT '9640 News                               '
        EVEN
B9      BYTE 80
        TEXT 'Global War for ABASIC     $15.00        '
        TEXT '9640 News                               '
        EVEN
B10     BYTE 80
        TEXT 'Mouse Development Kit     $12.95        '
        TEXT '9640 News                               '
        EVEN
B13     BYTE 80
        TEXT '99/9640 Fortran           $50.00        '
        TEXT '9640 News and LGMA Products             '
        EVEN
B14     BYTE 80
        TEXT 'Shell                     $20.00        '
        TEXT '9640 News and LGMA Products             '
        EVEN
B15     BYTE 80
        TEXT 'GenTRI                    $49.95        '
        TEXT '9640 News / Disk Only Software          '
        EVEN
B16     BYTE 80
        TEXT 'The Bugger                $18.50        '
        TEXT '9640 News / T & J Software              '
        EVEN
B17     BYTE 80
        TEXT 'HardBack                  $15.00        '
        TEXT '9640 News / T & J Software              '
        EVEN
B18     BYTE 80
        TEXT 'DISkASSEMBLER             $22.95        '
        TEXT '9640 News / T & J Software              '
        EVEN
B19     BYTE 80
        TEXT 'IdentiFile                $10.00        '
        TEXT '9640 News                               '
        EVEN
B20     BYTE 80
        TEXT 'HyperCopy                 $15.00        '
        TEXT '9640 News                               '
        EVEN
B21     BYTE 80
        TEXT 'PC-Transfer and Utilities $25.00        '
        TEXT '9640 News                               '
        EVEN
B22     BYTE 80
        TEXT 'PC-Transfer Utilities     $ 7.50        '
        TEXT '9640 News                               '
        EVEN
B23     BYTE 80
        TEXT '                                        '
        TEXT '                                        '
        EVEN
B24     BYTE 80
        TEXT '________________________________________'
        TEXT '________________________________________'
        EVEN
C1      BYTE 80
        TEXT 'Various operating systems and languages '
        TEXT 'exist for the Geneve 9640.  They include'
        EVEN
C2      BYTE 80
        TEXT 'the following:                          '
        TEXT '                                        '
        EVEN
C4      BYTE 80
        TEXT 'ABASIC, a highly advanced basic programm'
        TEXT 'ing envoroment using advanced features  '
        EVEN
C5      BYTE 80
        TEXT ' of the 9938 VDP Chip.                  '
        TEXT '                                        '
        EVEN
C7      BYTE 80
        TEXT 'ASSEMBLY, the language of all languages,'
        TEXT ' direct machine coding at binary level. '
        EVEN
C8      BYTE 80
        TEXT 'C Language, full C, K & R Full C compati'
        TEXT 'ble, featuring structures, two          '
        EVEN
C9      BYTE 80
        TEXT ' dimensional arrays and more.           '
        TEXT '                                        '
        EVEN
C11     BYTE 80
        TEXT 'FORTH, a interpreter, available from McC'
        TEXT 'ann Software                            '
        EVEN
C15     BYTE 80
        TEXT 'GPL, the Graphics Programming Language d'
        TEXT 'eveloped by Texas Instruments.          '
        EVEN
C17     BYTE 80
        TEXT 'PASCAL, available in RUN-Time Module for'
        TEXT 'mat (still in development stages).      '
        EVEN
C13     BYTE 80
        TEXT 'FORTRAN, the tool for all engineers supp'
        TEXT 'orting the full use of the Geneve 9640. '
        EVEN
C12     BYTE 80
        TEXT '                                        '
        TEXT '                                        '
        EVEN
C14     BYTE 80
        TEXT '                                        '
        TEXT '                                        '
        EVEN
C16     BYTE 80
        TEXT '                                        '
        TEXT '                                        '
        EVEN
C18     BYTE 80
        TEXT '                                        '
        TEXT '                                        '
        EVEN
C10     BYTE 80
        TEXT '                                        '
        TEXT '                                        '
        EVEN
C3      BYTE 80
        TEXT '                                        '
        TEXT '                                        '
        EVEN
C6      BYTE 80
        TEXT '                                        '
        TEXT '                                        '
        EVEN
C19     BYTE 80
        TEXT '                                        '
        TEXT '                                        '
        EVEN
C20     BYTE 80
        TEXT '                                        '
        TEXT '                                        '
        EVEN
C21     BYTE 80
        TEXT '                                        '
        TEXT '                                        '
        EVEN
C22     BYTE 80
        TEXT '                                        '
        TEXT '                                        '
        EVEN

D1      BYTE 80
        TEXT 'This program is a demonstration of GEME '
        TEXT 'as written by Mike Riccio and finished  '
        EVEN
D2      BYTE 80
        TEXT 'by Beery Miller (9640 News).            '
        TEXT '                                        '
        EVEN
D3      BYTE 80
        TEXT '                                        '
        TEXT '                                        '
        EVEN
D4      BYTE 80
        TEXT 'This program will be released through 96'
        TEXT '40 News in the next few months as a     '
        EVEN
D5      BYTE 80
        TEXT 'courtesy of Myarc, Inc. to all Geneve ow'
        TEXT 'ners.  No financial reimbursement will  '
        EVEN
D6      BYTE 80
        TEXT 'be required from any Geneve owner.      '
        TEXT '                                        '
        EVEN
D7      BYTE 80
        TEXT 'Enjoy, as the MAJOR supporter and distri'
        TEXT 'butor of Geneve software tries to keep  '
        EVEN
D8      BYTE 80
        TEXT 'this computer alive.                    '
        TEXT '                                        '
        EVEN
D9      BYTE 80
        TEXT 'Future releases of software to the Genev'
        TEXT 'e World will possibly be the following: '
        EVEN
D10     BYTE 80
        TEXT '                                        '
        TEXT '                                        '
        EVEN
D11     BYTE 80
        TEXT 'Auto-Cad Clone, MDOS Terminal Emulator, '
        TEXT 'and Live Digitizing Hardware and        '
        EVEN
D12     BYTE 80
        TEXT 'Software.  More information will be avai'
        TEXT 'lable in the near future.               '
        EVEN
D13     BYTE 80
        TEXT '                                        '
        TEXT '                                        '
        EVEN
D14     BYTE 80
        TEXT '                                        '
        TEXT '                                        '
        EVEN
D15     BYTE 80
        TEXT '                                        '
        TEXT '                                        '
        EVEN
D16     BYTE 80
        TEXT '                                        '
        TEXT '                                        '
        EVEN
D17     BYTE 80
        TEXT '                                        '
        TEXT '                                        '
        EVEN
D18     BYTE 80
        TEXT '                                        '
        TEXT '                                        '
        EVEN
D19     BYTE 80
        TEXT '                                        '
        TEXT '                                        '
        EVEN
D20     BYTE 80
        TEXT '                                        '
        TEXT '                                        '
        EVEN
D21     BYTE 80
        TEXT '                                        '
        TEXT '                                        '
        EVEN
D22     BYTE 80
        TEXT '                                        '
        TEXT '                                        '
        EVEN

WAIT   LI   R0,9
       DOS  @WIND
       JEQ  WAIT
       MOV  R0,R0
       JEQ  WAIT

       B    *R0

QUIT

QUIT1  LI   R0,6
       MOV  @LL1,R1
       DOS  @WIND

       LI   R0,6
       MOV  @LL2,R1
       DOS  @WIND

       LI   R0,6
       MOV  @LL3,R1
       DOS  @WIND

       LI   R0,6
       MOV  @LL4,R1
       DOS  @WIND

       BLWP @0

SLAST2 END

DRAWER1-S


* * Test Task * MAC DXOP MAC !1 !!0 XOP !!1,!2 !-MEND MEND B @START DXOP DOS,0 VID DATA 6 THREE DATA 3 WIND DATA 12 LL1 DATA 0 FOUR DATA 4 ULX DATA 0 ULY DATA 0 WH DATA 0 HT DATA 0 MAXX DATA 0 MAXY DATA 0 COLOR1 DATA 0 MOUSEX DATA 0 MOUSEY DATA 0 FOCUS DATA 0 BUTTON DATA 0 DELTAX DATA 0 DELTAY DATA 0 WINDOW DATA 0 CURRENTX DATA 0 CURRENTY DATA 0 HIDDEN DATA 0 TBMSG BYTE 22 TEXT 'GEME Pro-Draw ' MLMSG BYTE 34 TEXT 'Please use Mouse to Draw .........' EVEN MENUA DATA 1 DATA 90 DATA 70 DATA MENU1A MENU1A DATA 6,BOXIT,POINT,INVERT,FRAME,CLEAR,QUIT BYTE 12 TEXT 'Draw Options' BYTE 5 TEXT 'Boxit' BYTE 5 TEXT 'Point' BYTE 6 TEXT 'Invert' BYTE 5 TEXT 'Frame' BYTE 5 TEXT 'Clear' BYTE 4 TEXT 'Quit' EVEN OPERATION DATA >000F KEY DATA 0 START LWPI >F000 START1 CLR R0 CLR R1 LI R2,60 LI R3,>010D DOS @WIND JNE START2 BLWP @0 START2 MOV R0,@LL1 MOV R0,@WINDOW MOV R0,@FOCUS LI R0,3 MOV @LL1,R1 LI R2,TBMSG DOS @WIND LI R0,4 MOV @LL1,R1 LI R2,MLMSG LI R3,>010D DOS @WIND LI R0,5 MOV @LL1,R1 CLR R2 DOS @WIND LI R0,8 MOV @LL1,R1 LI R2,MENUA DOS @WIND READKY LI R0,>000C MOV @WINDOW,R1 DOS @WIND MOV R1,@ULX MOV R2,@ULY MOV R3,@WH MOV R4,@HT MOV R5,@HIDDEN AI R1,R3 AI R2,R4 MOV R1,@MAXX MOV R2,@MAXY LI R0,>0E LI R1,0 DOS @WIND MOV R3,R3 JEQ READKY JMP BYME MOV R1,@MOUSEX MOV R2,@MOUSEY JMP BYME C @ULX,R1 JLT READKY C @ULY,R2 JLT READKY C @MAXX,R1 JGT READKY C @MAXY,R2 JGT READKY BYME * ANDI R3,>4000 * JNE READKY2 MOV @OPERATION,R0 MOV R1,R3 MOV R2,R4 CLR R1 CLR R2 LI R5,10 LI R6,10 LI R7,>0000 DOS @WIND * JMP READKY READKY2 LI R0,>09 OPTION SELECTED FROM DROP DOWN WINDOW? MOV @LL1,R1 DOS @WIND MOV R0,R0 JEQ READKY BL *R0 JMP READKY QUIT QUIT1 LI R0,6 MOV @LL1,R1 DOS @WIND BLWP @0 BOXITOP DATA >0010 POINTOP DATA >000F INVERTOP DATA >0012 CLEARITOP DATA >0013 FRAMEITOP DATA >0011 BOXIT MOV @BOXITOP,@OPERATION RT POINT MOV @POINTOP,@OPERATION RT INVERT MOV @INVERTOP,@OPERATION RT CLEAR MOV @CLEARITOP,@OPERATION RT FRAME MOV @FRAMEITOP,@OPERATION RT END * * I/O Port Addresses * VDP0 EQU >F108 VDP I/O Port #0 VDP1 EQU >F10A VDP I/O Port #1 VDP2 EQU >F10C VDP I/O Port #2 VDP3 EQU >F10E VDP I/O Port #3 SAVER0 DATA 0 Saved contents of R0 SAVR10 DATA 0 Saved contents of R10 * * Subprogram BLWP Vectors * MYREG1 EQU >F040 Subroutine Registers VSBR DATA MYREG1,VSBR0 VDP Single Byte Read VMBR DATA MYREG1,VMBR0 VDP Multiple Byte Read VSBW DATA MYREG1,VSBW0 VDP Single Byte Write VMBW DATA MYREG1,VMBW0 VDP Multiple Byte Write VWTR DATA MYREG1,VWTR0 VDP Write to Register VMWR DATA MYREG1,VMWR0 VDP Multiple Write to Registers * * Program Subroutines * * * SETVWA Set VDP Write Address * SETVWA MOV *R13,R0 Get VDP address ORI R0,>4000 Set write bit JMP SETVA1 Continue with routine * * SETVRA Set VDP Read Address * SETVRA MOV *R13,R0 Get VDP address SETVA1 MOV @2(R13),R1 Get buffer pointer MOV @4(R13),R2 Get byte count LIMI 0 No interrupts during VDP access SETVA2 MOV R11,R10 Save return address BL @CMDEND Wait for VDP to be ready SETVA3 SWPB R0 LSB goes first MOVB R0,@VDP1 Write it SWPB R0 MSB goes next MOVB R0,@VDP1 Write it B *R10 Return to caller * * VMBW VDP Multiple Byte Write * * Pass: R0 VDP Address * R1 CPU Data Address * R2 Number of Bytes to Write * VMBW0 BL @SETVWA Set VDP write address MOV R2,R2 Zero byte count? JEQ VMBW2 Yes, Return to caller VMBW1 MOVB *R1+,@VDP0 No, Write a byte DEC R2 Any bytes left? JNE VMBW1 Yes, Write another VMBW2 RTWP No, Return to caller * * VMBR VDP Multiple Byte Read * * Pass: R0 VDP Address * R1 CPU Buffer Address * R2 Number of Bytes to Read * VMBR0 BL @SETVRA Set VDP read address MOV R2,R2 Zero byte count? JEQ VMBR2 Yes, Return to caller VMBR1 MOVB @VDP0,*R1+ No, Read a byte DEC R2 Any bytes left? JNE VMBR1 Yes, Read another VMBR2 RTWP No, Return to caller * * VSBW VDP Single Byte Write * * Pass: R0 VDP Address * R1 MSB Byte to Write * VSBW0 BL @SETVWA Set VDP write address MOVB R1,@VDP0 Write the byte RTWP Return to caller * * VSBR VDP Single Byte Read * * Pass: R0 VDP Address * * Return: R1 MSB Byte Read * VSBR0 BL @SETVRA Set VDP read address MOVB @VDP0,@2(R13) Read the byte RTWP Return to caller * * VWTR VDP Write to Register * * Pass: R0 MSB Register Number * LSB Byte to Write * VWTR0 MOV *R13,R0 Get register and data ORI R0,>8000 Set register bit LIMI 0 No interrupts during VDP access BL @SETVA2 Write data to VDP register RTWP Return to caller * * VMWR VDP Multiple Write to Register * * Pass: R0 Starting Register Number * R1 CPU Data Address * R2 Number of Registers to Write to * VMWR0 MOV *R13,R0 Get starting register ORI R0,>9100 Add on register 17 MOV R10,@SAVR10 Save R10 (for CHAR) BL @SETVA1 Set up starting register MOV @SAVR10,R10 Restore R10 MOV R2,R2 Zero byte count? JEQ VMWR2 Yes, Return VMWR1 MOVB *R1+,@VDP3 No, Send a byte DEC R2 Any more bytes left? JNE VMWR1 Yes, Send another VMWR2 RTWP No, Return to caller * * CMDEND Waits for a VDP Command to Finish * CMDEND MOV R0,@SAVER0 Save contents of R0 CMDEN1 LI R0,>028F Set up to read status reg 2 MOVB R0,@VDP1 Write LSB first SWPB R0 Get at the MSB MOVB R0,@VDP1 Write MSB to register 15 SWPB R0 Waste some time MOVB @VDP1,R0 Get status register 2 data SRL R0,9 Is CE bit set? JOC CMDEN1 Yes, Command not finished yet MOV @SAVER0,R0 No, Restore R0 data RT Return to caller

HFSEC-DOC

HFSECTOR

By the Late John Birdwell

HFSECTOR is a GPL program for 80 column devices that permits one to sector edit floppies or hard drives. This is one of John Birdwell's last programs he leaves behind to the TI Community. It is fully compatible with MDOS 1.14. It requires ROMPAGE or OLDDSR for MDOS .97H.

Enjoy

NOTES-2

9640 PROGRAMMING NOTES

Copyright 1987 J. Peter Hoddie

Now that the MYARC 9640 computer has finally arrived on the scene, there are many programming issues which must be addressed. There are some issues of compatibility that software authors must consider so that their programs can work on both the 99/4A and the 9640. There is also a whole new set of rules that programmers must concern themselves with when writing software for the 9640. This discussion will primarily be in reference to the 99/4A mode of the 9640, as at this time most development is still taking place in 99/4A mode. Future articles will be presented on the details of the 9640's native mode, which is considerably less restricting than 99/4A mode.

CPU PAGING AND MEMORY USAGE

One of the most often asked questions about the 9640 is, "It has 512K of CPU memory, but is it accessed?" The answer is yes, through a paging scheme that is significantly more advanced than the methods used for RAM disks and the like on the 99/4A. The 9995 has a 64K address space just like the 9900, so to access more memory some sort of paging is required. MYARC chose to do the paging in 8K blocks because the architecture of the 99/4AA was essentially made up of separate 8K blocks. Thus, there are 8 page spaces on the 9640, numbered from 0 to 7. The 9640 is capable of addressing up to 2 megabytes of memory (2048K of memory). If this 2 megs of available memory is divided into 8K pages, there are a total of 256 pages available. Conveniently enough, values from 0 to 255 can be held in a single byte of memory. The 9640 has 8 page resisters, each one byte long. Each register controls a separate 8K page. By placing a page number into a map register, that particular page of memory will be mapped into that page in the 64K address space. Figure 1 is a listing of what memory space is controlled by each map register. The map registers can be read as well as written to and behave as regular memory locations, thanks to the magic of the 9640's gate array. For example, to put page >45 in the >E000 space, the assembly programmer could use the following lines:

          LI   R0,>4500
          MOVB R0,@>800

The map registers may also be accessed with the MOV (move word) instruction, so that the entire map can be saved or loaded in 4 instructions.

   Register number   First Address    End Address    Map Register Address
          0             >0000            >1FFF             >8000
          1             >2000            >3FFF             >8001
          2             >4000            >5FFF             >8002
          3             >6000            >7FFF             >8003
          4             >8000            >9FFF             >8004
          5             >AOOO            >BFFF             >8005
          6             >C000            >DFFF             >8006
          7             >E000            >FFFF             >8007

                                  Figure 1

Pages >00 to >3F are contained on the 9640 card itself. This accounts for the 512K of CPU memory that is available. In 99/4A mode, page >03 must be mapped in at location >C000 (map register 6) for GROM/GRAM and sound to be present. If a page other than >03 is present, the 9640 will essentially ignore any memory mapped I/O to the GROM and sound ports. Also, in 99/4A mode the map register for the >6000 memory space (register 3) can be changed; however, this will have no effect, since this page is locked as >36 by the gate array. If 2 banks of cartridge RAM are in use (such as in TI Extended BASIC), the second page is >37. Because the 9640 emulates GROM/GRAM using CPU memory, 8 pages of memory are also reserved for this purpose. The pages >38 to >3F are the GROM pages. These pages are offset by one byte. For example, GROM byte 0 is found at location >0001 on page >38 and GROM byte >FFFF is found at location >000 on page >38.

On the 9640 computer, there is also 32K of high speed, zero wait-state CPU memory. This is divided into 4 pages, numbered >EC, >ED, >EE, and >EF. If one or more of these pages is available, they should be used for time- critical portions of code, since they are noticeably faster than the regular pages. The EPROM that boots the 9640 (including the swan picture) is 16K long, occupying 2 pages, >F8 and >F9. If the 9640 is running with a modified MYARC 512K card, it will appear as pages >80 to >BF.

There are 8 more special pages in the mapper to be considered. These pages are >B8 to >BF, and when they are accessed the memory cycles are passed to the rest of the expansion box. At present, the only really useful application of this is to access memory mapped I/O in the DSR space. This is done using page >BA (the third bus page, corresponding to addresses >4000 to >5FFF). For example, if page >BA was placed in map register 2 (the >4000 page) and the TI RS232 card was turned on (using a LI R12,>1300 followed by a SBO 0 instruction) a MOVB instruction to address >5800 would write a byte to the parallel port. However, if page >BA was placed in map register 0, then writing to address >1800 would accomplish the same. Since the 9640 has all its own DSR's (that is, it ignores the ROM's in peripherals), a page other than >BA is mapped in the >4000 space. This means that print spooler software that directly accesses the PIO register (for the MYARC and TI RS232 cards) will no longer work. This can be easily fixed by having these programs put page >BA in the appropriate map register before writing to the parallel port. However, the program must be careful to restore the proper page when it is finished or the system may not behave correctly when an interrupt occurs, a peripheral access is attempted, or a software reset occurs.

One difference between the 9640 and the 99/4A is that the 9640 has RAM from >8020 to >82FF whereas the 99/4A has shadows of the >8300 to >83FF memory in that area. A few programmers accessed the >8300 page through one of its shadows at >8000, >8100, or >8200 on the 99/4A. Most of these programs will not run on the 9640. However, when patching 99/4A software on the 9640, having an extra 700 bytes or so of space that didn't exist on the 99/4A can be very useful. Another related difference is that on the 9640 the RAM at >8300 is not any faster than the rest of memory. On the 9640 the fast RAM is from >F000 to >F0FF. When writing assembly code for the 9640, if at all possible put the registers at >F000 for maximum speed. There is one problem when using the >F000 to >F0FF space, and that relates to the 9995. The fast memory at >F000 is actually in the 9995 microprocessor, which means that it can never be paged out. If the >E000 space is changed using the map register, the bytes from >F000 to >F0FF will remain the same. However, there is one more catch. If a write is performed to memory in hhe >F000 to >F0FF range, the memory in the page behind it will be trashed. The reasons for this have to do with memory speed. However, the point is that it is best not to change the >E000 space page. For example, in My-Word the >E000 space is used primarily for the code which is responsible for switching between the Editor, Formatter, Catalog, and Help portions of the program, so the >E000 page itself never changes.

VDP PAGING AND MEMORY USAGE

The 9640 contains 128K of video memory, whereas the 99/4A contains only 16K. Those familiar with how routines like VSBW and VMBR actually work (rather than just how to use them) will quickly recognize that some sort of VDP paging must exist in order to access all 128K of memory. However, VDP paging is handled quite differently from CPU paging. The 128K of video memory is divided into 8 pages of 16K. There is one VDP page register, and it is VDP register 14. To select a VDP page, the page number must be set in this register. In the example below the VWTR (VDP Write to Register) routine is used to select page 3:

          LI   R0,>0E03
          BLWP @VWTR

On the 99/4A, when VDP address >3FFF was accessed the VDP address automatically wrapped back to >0000. On the 9640, the situation is the same when working in any graphics mode that was present on the 99/4A. However, when working in a 9640 graphics mode, the page register will increment by 1, and the address will increment to >0000 on the next page. Thus, when working in a 9640 graphics mode it is possible to read/write up to 128K of data without resetting the VDP address.

To display screens stored on VDP pages other than zero, information must be passed to the various VDP registers to specify which pages. Such information is beyond the scope of this article. It is covered in the 9938 manual, which is available from Yamaha (with a little luck) or from MYARC for $20. Those planning on doing any serious work for the 9640 should obtain a copy of this manual which describes all the capabilities of the 9938 graphics chip. Perhaps a future series of articles will explore this chip in detail.

OTHER CONSIDERATIONS

Because the 9640 has such a radically improved keyboard from the 99/4A, the console KSCAN (keyboard scanning) routine was completely changed. From a functional perspective, the routine in the 9640 is identical to that in the 99/4A; however, in terms of how they work, nothing is the same. This means that any 99/4A program that scanned the keyboard without using the console KSCAN routine will not respond to keyboard int on the 9640. In general, these pograms fall into 2 categories: (1termil emators which couldn`t ??e the console KSCAN because it was too slow; (2) interrupt routines which would check to see if a weird key combination such as Control-Shift-something or Function-Shift-whatever was pressed to invoke special commands. If the only reason for not using the console KSCAN routine was for speed, then programs can be easily converted by the author to run on the 9640. The program simply has to check to see if it is running on a 9640 (RAM at >0000 is a good check) and if so, use the console KSCAN. If the reason for avoiding the console KSCAN was for weird key press combinations, then more drastic changes may be required by the author.

The 99/4A emulator for the 9640 is capable of running at 5 speeds, with speed 5 being the fastest. The only factor that keeps many 99/4A programs from running at speed 5 is related to VDP access. TI stated that in settling the VDP read or write address, that it was necessary to wait after

writing each byte of the address. On the 99/4A, because of the many wait states inserted by the computer, there was really no need for this. On the 9640, running at faster speeds, these delays are required. In general, it has been found that using a SWPB (swap byte) instruction after each byte will work. A NOP (no-operation) or RT (return) is generally too fast. One known offender is the GPL/DSRLNK published in The Smart Programmer by Craig Miller and Doug Warren. In a related note, TI also said that it was necessary to insert delays when accessing GROM/GRAM. This is not so on the 9640 because GROM/GRAM is handled by the gate array without any delays.

Those familiar with the MYARC hard disk personality card are probably aware that it is capable of transferring data directly to CPU memory rather than passing all data through VDP memory. On the 9640, this capability has been expanded to include all DSR calls. Note that the PAB must still reside in VDP memory, regardless of where the data is passed. To indicate that data is to be transferred through CPU memory, set the 4 bit of the high nibble of the op-code when doing a DSRLNK. For example, to read to CPU memory, use a read opcode of >42 instead of >02.

When programming for the 9938 video chip, be careful to consider unused bits in the VDP registers. Some bits that were not used on the 9918A are used on the 9938 (rumor has it that some versions of Forth set certain unused VDP bits to 1 that the 9640 expects to be 0, which can produce weird video displays). For example, the high bit of VDP register 1 tells the 9918A whether 4K or 16K of video memory is available. This bit is not used on the 9938. Setting this bit to 0 when writing on the 9640 will cause the program to bomb when running a 99/4A. When working in the new video modes (like 80 columns), it is important to set all the bits to 1 that the manual specifies, even if it doesn't make sense. Failing to set certain bits can produce some fascinating results.

*
* math library ...  XOP @TEN,0
*
*      all floating point arguments must be on an even byte boundary
*      calling registers must be in PAD from >f000 to >f060
*
*      floating point representation, radix 100:
*
*      0  = 00 00 xx xx xx xx xx xx
*     +n  = e0 m0 m1 m2 m3 m4 m5 m6
*
*           e0 is int(log[100](n)) + >40
*           m0 - m6 are numbers from >00 to >63 (0 to 99)
*           m0 is most  significant digits of mantissa,
*           m6 is least significant digits of mantissa.
*
*           in normalized numbers, decimal is between m0 and m1
*     -n  is same as "n" except first word is negated ... -(e0 m0)
*
*      examples:
*      decimal                floating point
*
*      7                      >40 >07 >00 >00 >00 >00 >00 >00
*      70                     >40 >46 >00 >00 >00 >00 >00 >00
*      2,345,600              >43 >02 >22 >38 >00 >00 >00 >00
*      23,456,000             >43 >17 >2D >3C >00 >00 >00 >00
*      0                      >00 >00 >xx >xx >xx >xx >xx >xx
*      -7                     >BF >F9 >00 >00 >00 >00 >00 >00
*      -70                    >BF >BA >00 >00 >00 >00 >00 >00
*      -2,345,600             >BC >FE >22 >38 >00 >00 >00 >00
*
*  opcode #0
*  FCOMP    floating point compare
*           input:            r0=0
*                             r2=^float1
*                             r3=^float2
*
*           return:           status reg = AG set iff (float2 > float1)
*                                          EQ set iff (float2 = float1)
*
*  opcode #1
*  FSUB     floating point subtract
*           input:            r0=1
*                             r1=^result
*                             r2=^float1
*                             r3=^float2
*           return:           r0=error code
*                             ^r1 = float2 - float1
*
*  opcode #2
*  FADD     floating point add
*           input:            r0=2
*                             r1=^result
*                             r2=^float1
*                             r3=^float2
*           return:           r0=error code
*                             ^r1 = float2 + float1
*
*  opcode #3
*  FMULT    floating point multiply
*           input:            r0=3
*                             r1=^result
*                             r2=^float1
*                             r3=^float2
*           return:           r0=error code
*                             ^r1 = float2 * float1
*
*  opcode #4
*  FDIV     floating point divide
*           input:            r0=4
*                             r1=^result
*                             r2=^float1
*                             r3=^float2
*           return:           r0=error code
*                             ^r1 = float2 / float1
*
*  opcode #5
*  PWR      floating point power
*           input:            r0=5
*                             r1=^result
*                             r2=^float1
*                             r3=^float2
*           return:           r0=error code
*                             ^r1 = float2 ^ float1
*
*  opcode #6
*  EXP      floating point e^x
*           input:            r0=6
*                             r1=^result
*                             r2=^float1
*           return:           r0=error code
*                             ^r1 = e ^ float1
*
*  opcode #7
*  LOG      floating point ln(x)
*           input:            r0=7
*                             r1=^result
*                             r2=^float1
*           return:           r0=error code
*                             ^r1 = ln( float1 )
*
*  opcode #8
*  SQR      floating point sqr(x)
*           input:            r0=8
*                             r1=^result
*                             r2=^float1
*           return:           r0=error code
*                             ^r1 = sqr( float1 )
*
*  opcode #9
*  COS      floating point cos(x)
*           input:            r0=9
*                             r1=^result
*                             r2=^float1
*           return:           r0=error code
*                             ^r1 = cos( float1 )
*
*  opcode #10
*  SIN      floating point sin(x)
*           input:            r0=10
*                             r1=^result
*                             r2=^float1
*           return:           r0=error code
*                             ^r1 = sin( float1 )
*
*  opcode #11
*  TAN      floating point tan(x)
*           input:            r0=11
*                             r1=^result
*                             r2=^float1
*           return:           r0=error code
*                             ^r1 = tan( float1 )
*
*  opcode #12
*  ATN      floating point atn(x)
*           input:            r0=12
*                             r1=^result
*                             r2=^float1
*           return:           r0=error code
*                             ^r1 = atn( float1 )
*
*  opcode #13
*  GRI      floating point greatest integer
*           input:            r0=13
*                             r1=^result
*                             r2=^float1
*           return:           r0=error code
*                             ^r1 = || float1 ||
*
*  opcode #14
*  CFI      convert floating point to integer
*           input:            r0=14
*                             r2=^float1
*           return:           r0=error code
*                             r1 = integer
*
*  opcode #15
*  CIF      convert integer to floating point
*           input:            r0=15
*                             r1=^result
*                             r2=integer
*           return:           r0=error code
*                             ^r1 = float( integer )
*
*  opcode #16
*  CSINT    convert string to integer
*           input:            r0=16
*                             r2=^string
*           return:           r0=error code
*                             r1 = integer
*
*  opcode #17
*  CSN      convert string to floating point
*           input:            r0=17
*                             r1=^result
*                             r2=^string
*                             r3=strlen
*           return:           r0=error code
*                             ^r1 = float( string )
*
*  opcode #18
*  CNS      convert float to string
*           input:            r0=18
*                             r1=^string
*                             r2=^float1
*                             r3=opt1
*                                 bit 0: 0=free form (ignore opt2, opt3)
*                                        1=fixed (opt2, opt3 are field sizes)
*                                 bit 1: 1 for explicit sign
*                                 bit 2: 1 to show sign of positive number
*                                        as a '+' instead of as a space.
*                                        (bit 1 must also be on)
*                                 bit 3: 1 for E-notation output
*                                 bit 4: 1 for extended E-notation
*                                        (bit 3 must also be 1)
*                             r4=if fixed format, number of places to left
*                                of decimal point, including explicit sign
*                             r5=if fixed format, number of places to the
*                                right of decimal point and including decimal
*                                point
*                             if fixed format, with exponent, r4,r5 exclude the
*                             3 places for an exponent
*
*           return:           r0=error code
*                             ^r1 = string
*
*



***************************
*
*
* keyboard    XOP @FIVE,0
*
*      IN:     R0Lsb =  scan mode   (like ti modes, 0-5)
*
*      OUT:    R0Lsb =  returned mode  (same as >8374 in 99/4a)
*              R1Msb =  returned scan code (same as >8375)
*              R2Msb =  joystick Y value     (same as >8376)
*              R2Lsb =  joystick X value     (same as >8377)
*           EQ bit in Status register set if there's a new key in R0
*
*              mode 7 = break key check  return EQ=1 if Break on
*              mode 8 = raw scan code returned in R1h
*                       raw code returned is >FF if there was no code in buffer
*



       TITL 'c99 CLI call function'
       IDT  'callcli'
*
* for use with c99/MDOS
*
* (c) 1990 Clint Pulley
*
       DEF  CALLCL
*
* status=callcli(command_string);
*
* calls the MDOS Command Line Interpreter (CLI) to process the command
* in command_string (char[]). At MDOS 0.97h, only intrinsic commands may
* be processed (eg. dir, del, time etc.). Returns true if the running
* version of MDOS does not support this feature.
*
* CAUTION : Use of certain CLI commands (ie copy) with MDOS 1.14/0.97h
* will result in the system crashing when batch files are executed.
* This is believed to be an internal MDOS problem.
*
* Last edit 2320 90/05/09
*
CALLCL CLR  R8           FOR STATUS RETURN
       MOV  R14,R1       GET CURRENT STACK PTR
       AI   R1,-104      USE STACK FOR PAD SAVE AREA
       MOV  R1,@PADBF1   SAVE PTR IN CALLS
       MOV  R1,@PADBF2
       BL   @MOVEM       SAVE >F018->F07F
       DATA >F018
PADBF1 DATA 0
       DATA 104
       MOV  @2(R14),@CMDPTR
       BL   @MOVEM       MOVE COMMAND STRING TO PAD
CMDPTR DATA 0
       DATA >F020,81
       MOVB @>F117,@USRP7 SWAP PAGE 7
       MOVB @CLIP7,@>F117
       LI   R0,>F020     COMMAND
       LI   R1,>F208     CLI COMMAND BUFFER
       MOVB @NULL,*R1+   STORE NULL BYTE COUNT
LOOP1  MOVB *R0+,*R1+    COPY COMMAND
       JNE  LOOP1
       DEC  R1
       MOVB @SPACE,*R1+  TERMINATE WITH SPACE
       MOVB @NULL,*R1    AND NULL
       LI   R0,>F209     PTR TO START OF COMMAND
       BL   @MOVEM       SAVE MAPPER REGISTERS
       DATA >F110,>F200,7
       BL   @MOVEM       MOVE CLI CALL CODE TO PAGE 7
       DATA CCODE,>F300,CCSIZE
       BLWP @CALLC       CALL COMMAND PROCESSOR
       INC  R8           IF WRONG MDOS VERSION
       MOVB @USRP7,@>F117 RESTORE PAGE 7
       BL   @MOVEM       RESTORE >F018->F07F
PADBF2 DATA 0,>F018,104
       B    *R13
*
*      BL   @MOVEM       MOVE N BYTES
*      DATA FROM,TO,N
*
* USES R4, R5, R6
*
MOVEM  MOV  *R11+,R4     FROM
       MOV  *R11+,R5     TO
       MOV  *R11+,R6     N
MOVEM1 MOVB *R4+,*R5+
       DEC  R6
       JNE  MOVEM1
       RT
*
* CLI CALL CODE - RELOCATED TO >F300
*
CCODE  LIMI 0
       MOV  *R13,R1      START OF COMMAND
       MOV  @2(R13),R2   END OF COMMAND
       CLR  R0
       MOV  R0,@>F110    MAP SYSTEM PAGE 0
       MOVB @>1B03,@>F110 MAP CLI PAGE 0
       MOV  @>0402,R0
       CI   R0,>ECEC     CLI CHECKWORD
       JNE  CCERR        IF WRONG MDOS VERSION
       INCT R14          BYPASS ERROR EXIT
       MOV  @>0404,R3    ADDRESS OF COMMAND PRCESSOR
       LI   R4,>0114
       LI   R5,>F110
       MOV  *R4+,*R5+    MAP IN CLI
       MOV  *R4+,*R5+
       MOV  *R4+,*R5+
       MOVB *R4,*R5
       LI   R0,>FE00
       MOVB R0,@>0102    TWEAK SCHEDULER
       BLWP *R3          CALL COMMAND PROCESSOR
CCERR  LI   R4,>F200
       LI   R5,>F110
       MOV  *R4+,*R5+    MAP IN CALLER
       MOV  *R4+,*R5+
       MOV  *R4+,*R5+
       MOVB *R4,*R5
       RTWP
CCSIZE EQU  $-CCODE
*
CALLC  DATA >F060,>F300  BLWP VECTOR FOR CLI CALL
USRP7  BYTE 0            USER PAGE 7
CLIP7  BYTE >13          CLI PAGE 7
NULL   BYTE 0
SPACE  BYTE >20
*
       END

This is the only information available regarding physical page 0 on the Geneve 9640

       DEF  HEAD#T,TAIL#T,TASK#C
       DEF  CONTEX
*
INTREG EQU  >F080
XOPREG EQU  >F0A0
SYS1   EQU  >F0A0
SYS2   EQU  >F0C0
SYSREG EQU  >F0E0
SCRATC EQU  >F0E0
MAPPER EQU  >F110
*
       AORG 0
*
RSETVC DATA >F000,OSINT0
       DATA INTREG,OSINT1     9901 interrupt
       DATA INTREG,OSINT2     MID trap
       DATA INTREG,OSINT3     internal timer interrupt
       DATA INTREG,OSINT4     external bus interrupt
*
       AORG >20
LIBTAB DATA XOPTAB,PWRTAB                    LIBRARY USAGE
MAXXOP DATA XOPCNT,XOPUSE

HEAD#T DATA TASK#0
TAIL#T DATA TASK#N
TASK#C DATA TASK#0
*
MOVLOC DATA MOVTAB
MOVLST DATA MOVEND
*
       AORG >40               XOP table
SYSXOP DATA SYS2,XOPCAL
       DATA >FFD8,>FFF8       USER #1        RSBUG
       DATA 0,0               USER #2
       DATA 0,0               USER #3
       DATA 0,0               USER #4
       DATA 0,0               USER #5
       DATA 0,0               USER #6
       DATA 0,0               USER #7
       DATA 0,0               USER #8
       DATA 0,0               USER #9
       DATA 0,0               USER #10
       DATA 0,0               USER #11
       DATA 0
*
*

This is the only information available and documented regarding the Geneve 9640 and your Task 0 Page

       DEF  FREPTR,CURDRV,MAXDRV,ALIASA
       DEF  PMTSTR,PATH#P,GPLPAR,ALIASP
       DEF  TSKMAP,BREAK,CTLP,CTLS
       DEF  CMDSTR
*
       DEF  TURX,TURXMN,TURXMX
       DEF  TURY,TURYMN,TURYMX
       DEF  PAGE,PAGEPX
       DEF  COTASK
       DEF  LINFLG,LINPTR
       DEF  ESCSEQ,ESCCNT,ESCROU,ESCDAT,STDCLR
       DEF  DELON
*
INTREG EQU  >F080
XOPREG EQU  >F0A0
SYS1   EQU  >F0A0
SYS2   EQU  >F0C0
SYSREG EQU  >F0E0
SCRATC EQU  >F0E0
MAPPER EQU  >F110
*
       AORG 0
*
RSETVC DATA INTREG,KILLIT
       DATA INTREG,INT1       9901 interrupt
       DATA INTREG,INT2       MID trap
       DATA INTREG,INT3       internal timer interrupt
       DATA INTREG,INT4       external bus interrupt
*
       DATA 0,0
*
INT1   LIMI 0
       LI   R11,1
       JMP  INTCAL
*
INT2   LIMI 0
       LI   R11,2
       JMP  INTCAL
*
INT3   LIMI 0
       LI   R11,3
       JMP  INTCAL
*
INT4   LIMI 0
       LI   R11,4
       JMP  INTCAL
*
       AORG >40               XOP table
SYSXOP DATA XOPREG,XOPCAL
       DATA >FFD8,>FFF8       USER #1        RSBUG
       DATA XOPREG,ABORTX     USER #2
       DATA XOPREG,ABORTX     USER #3
       DATA XOPREG,ABORTX     USER #4
       DATA XOPREG,ABORTX     USER #5
       DATA XOPREG,ABORTX     USER #6
       DATA XOPREG,ABORTX     USER #7
       DATA XOPREG,ABORTX     USER #8
       DATA XOPREG,ABORTX     USER #9
       DATA XOPREG,ABORTX     USER #10
       DATA XOPREG,ABORTX     USER #11
       DATA XOPREG,ABORTX     USER #12
       DATA XOPREG,ABORTX     USER #13
       DATA XOPREG,ABORTX     USER #14
       DATA XOPREG,ABORTX     USER #15
*
       AORG >80               start after XOPS
*
XOPCAL LIMI 0
       MOV  *R11,R11
INTCAL MOV  @MAPPER,@TSKMAP
       MOV  @MAPPER,@SYSREG
       MOV  @MAPPER+2,@TSKMAP+2
       MOV  @MAPPER+4,@TSKMAP+4
       MOV  @MAPPER+6,@TSKMAP+6
       CLR  @MAPPER
       NOP                                   we page OS here...
ABORTX RTWP
*
KILLIT LIMI 0
       CLR  R11
       JMP  INTCAL
*
       DATA 0,0,0,0,0,0
       DATA 0,0,0,0,0,0,0,0
*
       DATA 0,0,0,0
DELON  DATA 0
ESCSEQ DATA 0
ESCCNT DATA 0
ESCROU DATA 0
ESCDAT DATA 0
STDCLR DATA 0
LINFLG DATA 0
LINPTR DATA 0
COTASK DATA 0
PAGE   DATA 0
PAGEPX DATA 0
TURX   DATA 0
TURXMN DATA 0
TURXMX DATA 0
TURY   DATA 0
TURYMN DATA 0
TURYMX DATA 0
CTLP   DATA 0
CTLS   DATA 0
BREAK  DATA 0
*
       AORG >0100
TSKTBL BYTE 00           TASK ID #
MAXDRV BYTE 'G'          MAXIMUM ALIAS LETTER USER CAN SPECIFY
STATE  BYTE >FF          PROCESS STATE
SLICE  BYTE 6            NUMBER OF SLICES LEFT UNTIL SWAPPED OUT
PNAME  TEXT '        '   NAME OF THIS TASK
UWP    DATA >F000        USER WORKSPACE POINTER
UPC    DATA >0400        USER PROGRAM COUNTER
UST    DATA >0002        USER STATUS REGISTER
MEMLST DATA 0            POINTER TO MEMORY LIST
TSKMAP DATA 0,0,0,0      SAVED MEMORY MAP USED DURING XOPS AND INTERRUPTS
CURDRV DATA ALIASA       POINTER TO CURRENT DRIVE ENTRY
PATH#P DATA 0            POINTER TO TEXT FOR PATH COMMAND
BLKDEV DATA 0            POINTER TO NAMES OF BLOCK DEVICES
FREPTR DATA FRENOD       POINTER TO FREE NODES
PMTSTR DATA STRPMT       POINTER TO PROMPT STRING'S NODES
GPLPAR DATA 0            STRING TO CONTROL SPEED OF GPL INTERPRETER
CMDSTR DATA 0            STRING CONTAINING COMMAND LINE OPTIONS
*
ALIASA DATA DSK1,0       POINTERS TO THE ALIAS STRINGS
ALIASB DATA DSK2,0
ALIASC DATA DSK3,0
ALIASD DATA DSK4,0
ALIASE DATA HDS1,0
ALIASF DATA HDS2,0
ALIASG DATA HDS3,0
ALIASH DATA 0,0
ALIASI DATA 0,0
ALIASJ DATA 0,0
ALIASK DATA 0,0
ALIASL DATA 0,0
ALIASM DATA 0,0
ALIASN DATA 0,0
ALIASO DATA 0,0
ALIASP DATA 0,0
*
*
* for all handles, 0 input is keyboard, 0 output is screen
*
HANDL0 DATA 0                 stdin
HANDL1 DATA 0                 stdout
HANDL2 DATA 0                 stderr
HANDL3 DATA 0
HANDL4 DATA 0
HANDL5 DATA 0
HANDL6 DATA 0
HANDL7 DATA 0
HANDL8 DATA 0
HANDL9 DATA 0
HANDLA DATA 0
*
       AORG >0180
SAVPAD BSS  128
*
       AORG >0200
STRPMT DATA >0000,>04*256+'$','n$','g'*256+>00    default prompt
*
DSK1   DATA 0,>04*256+'D','SK','1'*256+>00
DSK2   DATA 0,>04*256+'D','SK','2'*256+>00
DSK3   DATA 0,>04*256+'D','SK','3'*256+>00
DSK4   DATA 0,>04*256+'D','SK','4'*256+>00
HDS1   DATA 0,>04*256+'H','DS','1'*256+>00
HDS2   DATA 0,>04*256+'H','DS','2'*256+>00
HDS3   DATA 0,>04*256+'H','DS','3'*256+>00
FRENOD
FRES00 DATA FRES01,0,0,0
FRES01 DATA FRES02,0,0,0
FRES02 DATA FRES03,0,0,0
FRES03 DATA FRES04,0,0,0
FRES04 DATA FRES05,0,0,0
FRES05 DATA FRE1,0,0,0
FRE1   DATA FRE2,0,0,0
FRE2   DATA FRE3,0,0,0
FRE3   DATA FRE4,0,0,0
FRE4   DATA FRE5,0,0,0
FRE5   DATA FRE6,0,0,0
FRE6   DATA FRE7,0,0,0
FRE7   DATA FRE8,0,0,0
FRE8   DATA FRE9,0,0,0
FRE9   DATA FREA,0,0,0
FREA   DATA FREB,0,0,0
FREB   DATA FREC,0,0,0
FREC   DATA FRED,0,0,0
FRED   DATA FREE,0,0,0
FREE   DATA FREF,0,0,0
FREF   DATA FREG,0,0,0
FREG   DATA FREH,0,0,0
FREH   DATA FREI,0,0,0
FREI   DATA FREJ,0,0,0
FREJ   DATA FREK,0,0,0
FREK   DATA FREL,0,0,0
FREL   DATA FREM,0,0,0
FREM   DATA FREN,0,0,0
FREN   DATA FREO,0,0,0
FREO   DATA FREP,0,0,0
FREP   DATA FREQ,0,0,0
FREQ   DATA FRER,0,0,0
FRER   DATA FRES,0,0,0
FRES   DATA FRET,0,0,0
FRET   DATA FREU,0,0,0
FREU   DATA FREV,0,0,0
FREV   DATA FREW,0,0,0
FREW   DATA FREX,0,0,0
FREX   DATA FREY,0,0,0
FREY   DATA FREZ,0,0,0
FREZ   DATA FRFA,0,0,0
FRFA   DATA FRFB,0,0,0
FRFB   DATA FRFC,0,0,0
FRFC   DATA FRFD,0,0,0
FRFD   DATA FRFE,0,0,0
FRFE   DATA FRFF,0,0,0
FRFF   DATA FRFG,0,0,0
FRFG   DATA FRFH,0,0,0
FRFH   DATA FRFI,0,0,0
FRFI   DATA FRFJ,0,0,0
FRFJ   DATA FRFK,0,0,0
FRFK   DATA FRFL,0,0,0
FRFL   DATA FRFM,0,0,0
FRFM   DATA FRFN,0,0,0
FRFN   DATA FRFO,0,0,0
FRFO   DATA 0,0,0,0
*
ENDNOD EQU  $
*
       END
*

VID97H

VIDEO XOP'S

Data Library 6

* SetVideoMode           >00
*
* R1x = Video mode
*
* Video modes:
*       0000    Text 1 mode
*       0001    Text 2 mode
*       0002    MultiColor mode
*       0003    Graphic 1 mode
*       0004    Graphic 2 mode
*       0005    Graphic 3 mode
*       0006    Graphic 4 mode
*       0007    Graphic 5 mode
*       0008    Graphic 6 mode
*       0009    Graphic 7 mode
*       000A    Text 2 mode -- 26 lines
*

* GetVideoMode           >01
*
* -----
* R0x = Returned video mode
* R1x = Number of columns
* R2x = Number of rows
* R3x = Number of Graphics columns (pixels)
* R4x = Number of Graphics rows (pixels)
* R5x = Current page offset (in pixel rows, use for chip commands)
* R6x = Color of screen border
* R7h = Foreground color of text
* R7l = Background color of text
*

* SetCurPos              >02
*
* R1x = Row number
* R2x = Column number
*

* GetCurPos              >03
*
* -----
* R0x = Returned row number
* R1x = Returned column number
*

* SetDisPage             >04
*
* R1x = Page number
* R2x = Initialize tables? (0=YES !0=NO)
*

* GetDisPage             >05
*
* -----
* R0x = Returned page number
*

* ScrollWinUp            >06
*
* R1x = Number of lines to scroll
* R2x = Row number of upper left corner
* R3x = Column number of upper left corner
* R4x = Row number of lower right corner
* R5x = Column number of lower right corner
* R6x = Character value for blank lines
* R7h = Foreground color for blank lines
* R7l = Background color for blank lines
*

* ScrollWinDown          >07
*
* R1x = Number of lines to scroll
* R2x = Row number of upper left corner
* R3x = Column number of upper left corner
* R4x = Row number of lower right corner
* R5x = Column number of lower right corner
* R6x = Character value for blank lines
* R7h = Foreground color for blank lines
* R7l = Background color for blank lines
*

* ScrollWinLeft          >08
*
* R1x = Number of lines to scroll
* R2x = Row number of upper left corner
* R3x = Column number of upper left corner
* R4x = Row number of lower right corner
* R5x = Column number of lower right corner
* R6x = Character value for blank lines
* R7h = Foreground color for blank lines
* R7l = Background color for blank lines
*

* ScrollWinRight         >09
*
* R1x = Number of lines to scroll
* R2x = Row number of upper left corner
* R3x = Column number of upper left corner
* R4x = Row number of lower right corner
* R5x = Column number of lower right corner
* R6x = Character value for blank lines
* R7h = Foreground color for blank lines
* R7l = Background color for blank lines
*

* CALL COLOR   (ONLY WORKS IN SCREEN CODE 3) >0A
*
* R1h = Foreground color
* R1l = Background color
* R2x = Charset # (if mode 3)
*

* GCharColor             >0B
*
* R1x = Row
* R2x = Col
* -----
* R0x = ASCII character read from screen
* R1h = Foreground color for character
* R1l = Background color for character
*

* SetBorderColor         >0C
*
* R1x = Color to render border
*

* SetColPalette          >0D
*
* R1x = Palette register number
* R2x = Color to put into palette register
* (G,R,B -- AS BOOK DESCRIBES)  NIBBLE JUSTIFIED MOST 0-G-R-B
*

* SetPixelColor          >0E
*
* R1x = X coordinate of pixel
* R2x = Y coordinate of pixel
* R3h = Foreground color to render pixel
* R3l = Background color to render pixel in graphics 2-3
* R4h = Logic operation to be performed
*

* GetPixelColor          >0F
*
* R1x = X coordinate of pixel
* R2x = Y coordinate of pixel
* -----
* R0h = Returned foreground color of pixel
* R0l = Returned background color of pixel in graphics 2-3
*

* SetVectorColor         >10
*
* R1x = X coordinate of first pixel
* R2x = Y coordinate of first pixel
* R3x = X coordinate of second pixel
* R4x = Y coordinate of second pixel
* R5h = Foreground color to render vector
* R5l = Background color to render vector in graphics 2-3
* R6h = Logic operation to be performed
*

* ColorSRCH              >11
*
* R1x = X coordinate of source point
* R2x = Y coordinate of source point
* R3l = Color for search
* R3h = Direction for search (>00=LEFT, >FF=RIGHT)
* -----
* ST  = if EQUAL, color found
* R0x = X coordinate of location where color was found
* R1x = Y coordinate of location where color was found
*

* HBlockMove             >12
*
* R1x = Row number of upper left corner of source
* R2x = Column number of upper left corner of source
* R3x = Row number of upper left corner of destination
* R4x = Column number of upper left corner of destination
* R5x = Number of rows
* R6x = Number of columns
* R7l = Pixel color for blank pixels
*

* HBlockCopy             >13
*
* R1x = Row number of upper left corner of source
* R2x = Column number of upper left corner of source
* R3x = Row number of upper left corner of destination
* R4x = Column number of upper left corner of destination
* R5x = Number of rows
* R6x = Number of columns
*

* LBlockMove             >14
*
* R1x = Row number of upper left corner of source
* R2x = Column number of upper left corner of source
* R3x = Row number of upper left corner of destination
* R4x = Column number of upper left corner of destination
* R5x = Number of rows
* R6x = Number of columns
* R7l = Pixel color for blank pixels
* R7h = Logic operation to be performed on destination
*

* LBlockCopy             >15
*
* R1x = Row number of upper left corner of source
* R2x = Column number of upper left corner of source
* R3x = Row number of upper left corner of destination
* R4x = Column number of upper left corner of destination
* R5x = Number of rows
* R6x = Number of columns
* R7h = Logic operation to be performed on destination
*

* BScrollUp              >16
*
* R1x = Number of pixels to scroll
* R2x = Row number of upper left corner
* R3x = Column number of upper left corner
* R4x = Row number of lower right corner
* R5x = Column number of lower right corner
* R6h = Pixel color for blank pixels
*

* BScrollDown            >17
*
* R1x = Number of pixels to scroll
* R2x = Row number of upper left corner
* R3x = Column number of upper left corner
* R4x = Row number of lower right corner
* R5x = Column number of lower right corner
* R6h = Pixel color for blank pixels
*

* BScrollLeft            >18
*
* R1x = Number of pixels to scroll
* R2x = Row number of upper left corner
* R3x = Column number of upper left corner
* R4x = Row number of lower right corner
* R5x = Column number of lower right corner
* R6h = Pixel color for blank pixels
*

* BScrollRight           >19
*
* R1x = Number of pixels to scroll
* R2x = Row number of upper left corner
* R3x = Column number of upper left corner
* R4x = Row number of lower right corner
* R5x = Column number of lower right corner
* R6h = Pixel color for blank pixels
*


              ##### SEE ADDENDUM FOR MOR ON SPRITES #####
* SpriteDef              >1A
*
* R1x = Pointer to sprite data
* R2x = # of sprites to define
*

* SpriteDel              >1B
*
* R1x = Pointer to list of sprite #'s
* R2x = # of sprites to delete (>FFFF for all)
*

* SpriteLocate           >1C
*
* R1x = Pointer to location data
* R2x = # of sprites to locate
*

* SpriteMotion           >1D
*
* R1x = Pointer to motion data
* R2x = # of sprites to put in motion
*

* SpriteColor            >1E
*
* R1x = Pointer to color data     LIST=SP#,SP COL,....,SP#,SP COL
* R2x = # of sprites to color
*

* SpritePattern          >1F
*
* R1x = Pointer to pattern # data  (SET POINTER TO SPRITE TABLE 0-255)
* R2x = # of sprites to pattern
*

* SpriteMagnify          >20
*
* R1x = MagFac (1-4, just like XB)
*

* SpritePosition / SpriteDistance            >21
*
* R1x = # of sprite to get position of
* R2x = Type of Distance, 0 for none, 1 for Sprite, 2 for Location
* R3x = # of second sprite (type 1), or Pixel row (type 2)
* R4x = Pixel column (type 2)
* -----
* R0x = Returned Row of sprite
* R1x = Returned Column of sprite
* R2x = Distance (if second sprite # was given)
* R3X = Distance squared (if second sprite # was given)

* SpriteCoinc            >22
*
* R1x = Type (0=sprites, 1=locations, 2=any two sprites)
* R2x = # of coincidence checks (if1,2) IF 2 PUTS THE RESULT IN R4 ONLY 2
* R3x = Pointer to test field     0   SP#, SP#, TOLER  1  SP#,DR,DC,TOL
* R4x = Pointer to result field   0 one COINC PAIR  row,col  if coinc
* -----                           1 SP#, DR, DC
*                                 2 DR,DC         (2 IS ALL, SP TO SP IS 0)
* R0x = # of coincidences detected                     (DR,DC  )
*

* SpritePatDefGet        >23
*
* R1x = CPU address of sprite pattern definitions
* R2x = # of sprite patterns to define or get
* R3x = Starting pattern #
* R4x = 0 if Def, >FFFF if Get
*

* CharPatDefGet          >24
*
* R1x = CPU address of character pattern definitions
* R2x = # of character patterns to define or get     (SPRITE & CHAR DATA SAME
* R3x = Starting pattern #                                   ONLY IN MODE 1,1)
* R4x = 0 if Def, >FFFF if Get
*

* SetTextWindow          >25
*
* R1x = Top row
* R2x = Left column
* R3x = Bottom row
* R4x = Right column
*

* GetTextWindow          >26
*
* -----
* R0x = Returned top row
* R1x = Returned left column
* R2x = Returned bottom row
* R3x = Returned right column
*

* WriteTTY               >27
*
* R1x = CPU address of string
* R2x = # of characters in string (0=NULL terminated)
*

* RestoreCharSpritePat   >28
*
* R1x = Restore Chars?   (0=No)
* R2x = Restore Sprites? (0=No)
*

* SetTextColor           >29
*
* R1h = Foreground color for text
* R1l = Background color for text
*

* WriteCharString        >2A
*
* R1x = Address of string
* R2x = # of characters in string
* R3x = 0 if change cursor position, >FFFF if leave cursor at beginning
*

* PrintScreen            >2B
* R1x = 0 for shades, 1 for outline
* R2x = 0 for normal density (double), 1 for hi density (quad)

* HCharColor             >2C
*
* R1x = Row
* R2x = Col
* R3x = ASCII character to write to screen
* R4x = Number of times to write character and color
* R5h = Foreground color for character
* R5l = Background color for character
*

* VCharColor             >2D
*
* R1x = Row
* R2x = Col
* R3x = ASCII character to write to screen
* R4x = Number of times to write character and color
* R5h = Foreground color for character
* R5l = Background color for character
*

* HChar                  >2E
*
* R1x = Row
* R2x = Col
* R3x = ASCII character to write to screen
* R4x = Number of times to write character and color
*

* VChar                  >2F
*
* R1x = Row
* R2x = Col
* R3x = ASCII character to write to screen
* R4x = Number of times to write character and color
*

*
* SetMouse               >30
*
* R1x = new Xposition for mouse
* R2x = new Yposition for mouse
* R3x = scale factor for mouse speed  (0 to 7) 0=fastest
* -----
*
* GetMouse               >31
*
* -----
* R1x = Returned Xposition for mouse
* R2x = Returned Yposition for mouse
* R3x = b1 b2 b3 0 xxxx xxxx xxxx   (highest bits)
*       \          b1= left   1=down
*          \       b2= middle 1=down
*             \    b3= right  1=down
*
* GetMouseRel            >32
*
* -----
* R1x = Returned X displacement since last call to GetMouse or GetMouseRel
* R2x = Returned Y displacement since last call to GetMouse or GetMouseRel
*
* MakeSound              >33
*
* R1x = Generator 1 frequency in Hz
* R2x = Generator 2 frequency in Hz
* R3x = Generator 3 frequency in Hz
* R4h = Attenuation for Generator 1 (0-15)
* R4l = Attenuation for Generator 2 (0-15)
* R5h = Attenuation for Generator 3 (0-15)
* R6h = control for noise generator: bits= 0000 0w t1 t2
*                                                |  +--+-- 00= 6991 Hz
*                                                |         01= 3496 Hz
*                                                |         10= 1738 Hz
*                                                |         11= same Hz as Gen #3
*                                                +--------- 0= periodic noise
*                                                           1= white noise
* R6l = Attenuation for Noise Generator
* R7x = duration of noise in 60th seconds
* -----


*
* SoundStatus            >34
*
* -----
* EQ bit set if no sound is in progress
*

* OPCODE >35
* VWTR - write to video registers, with register save
*
* R1x = VDP register #
* R2l = Value to put into VDP register
*

* OPCODE >36
* VRFR - read from video registers, actually, a read from stored values
*
* R1x = VDP register #
* -----
* R0l = Value read from VDP register
*

* GetTables              >37
*
* R1x = Pointer in user data, to put copy of tables (24 bytes)
* -----
* Copies of this data are put into user data:
*
* CTABLE  DATA    0,0
* PTABLE  DATA    0,0
* SCRIMG  DATA    0,0
* SPRATT  DATA    0,0
* SPRPAT  DATA    0,0
* SPRCOL  DATA    0,0
*

* GetPalRegs
*
* R1x = Pointer in user data, to put copy of Palette Registers (32 bytes)
* R2x = FORMAT (0=SQUASHED !0=BY THE BOOK, EXPANDED)
*

MOUSE SAME VIDEO

R0 2A-SET MOUSE
R1 -X POSTION
R2 Y POSITION
R3 SCALE FACTOR 0-7 0 FASTEST

R0 2B-GET ABSOLUTE (WHOLE REGISTER)
R1 RETURNED X
R2 RETURNED Y
R3 MOST SIGNIFICANT 3 BITS L BUTTON, 1 DOWN, 0 NOT DOWN

R0 2C-GET RELATIVE (HOW MUCH MOUSE HAS MOVED SINCE LAST CALL TO GET MOUSE)
R1 RETURNED X
R2 RETURNED Y
R3 MOST 3 BITS L BUTTON,1 DOWN 0 NOT DOWN

DEFINE SPRITES

POINTER IS TO WORDS (SPRITE MODE 1)

1ST WORD IN LIST IS SPRITE # (BASE 0)
2ND WORD IN LIST IS CHAR CODE 0-255
3RD WORD IN LIST IS POSITION
4TH WORD IN LIST IS VOLOCITY
5TH WORD IN LIST IS VOLOCITY
6TH WORD IN LIST IS COLOR
POINTER IS TO WORDS (SPRITE MODE 2)

1ST WORD IN LIST IS SPRITE # (BASE 0)
2ND WORD IN LIST IS CHAR CODE 0-255
3RD WORD IN LIST IS POSITION
4TH WORD IN LIST IS VOLOCITY
5TH WORD IN LIST IS VOLOCITY
NEXT 16 WORDS IN LIST ARE COLORS

SPRITE COLOR

SAME AS COLORS FOR SPRITE MODE 1 OR 2

VIDEO-DIR


MYREG EQU >F000 Program Registers MYREG1 EQU >F040 Subroutine Registers MYREG2 EQU >F060 Subroutine Registers MYREG3 BSS >20 Proportion Registers MYREG4 BSS >20 Redraw Registers TEMPWS BSS >20 Temporary workspace * * I/O Port Addresses * VDP0 EQU >F108 VDP I/O Port #0 VDP1 EQU >F10A VDP I/O Port #1 VDP2 EQU >F10C VDP I/O Port #2 VDP3 EQU >F10E VDP I/O Port #3 * * Library Call XOP Vectors * SAVER0 DATA 0 TEMP R0 SAVR10 DATA 0 TEMP R10 KSCAN DATA >0005 Keyboard scan library VIDEO DATA >0006 VDP access library MEMMAN DATA >0007 Memory management library IO DATA >0008 I/O access library UTIL DATA >0009 Utility library MATH DATA >000A Math library WIND DATA >000C Windows library MRESTR BYTE >00,>01,>00,>00 BYTE >00,>00,>00,>00 BYTE >D4,>00,>00,>00 BYTE >E0 EVEN * * Subprogram BLWP Vectors * VSBR DATA MYREG1,VSBR0 VDP Single Byte Read VMBR DATA MYREG1,VMBR0 VDP Multiple Byte Read VSBW DATA MYREG1,VSBW0 VDP Single Byte Write VMBW DATA MYREG1,VMBW0 VDP Multiple Byte Write VWTR DATA MYREG1,VWTR0 VDP Write to Register VMWR DATA MYREG1,VMWR0 VDP Multiple Write to Registers * * Program Subroutines * * * SETVWA Set VDP Write Address * SETVWA MOV *R13,R0 Get VDP address ORI R0,>4000 Set write bit JMP SETVA1 Continue with routine * * SETVRA Set VDP Read Address * SETVRA MOV *R13,R0 Get VDP address SETVA1 MOV @2(R13),R1 Get buffer pointer MOV @4(R13),R2 Get byte count LIMI 0 No interrupts during VDP access SETVA2 MOV R11,R10 Save return address BL @CMDEND Wait for VDP to be ready SETVA3 SWPB R0 LSB goes first MOVB R0,@VDP1 Write it SWPB R0 MSB goes next MOVB R0,@VDP1 Write it B *R10 Return to caller * * VMBW VDP Multiple Byte Write * * Pass: R0 VDP Address * R1 CPU Data Address * R2 Number of Bytes to Write * VMBW0 BL @SETVWA Set VDP write address MOV R2,R2 Zero byte count? JEQ VMBW2 Yes, Return to caller VMBW1 MOVB *R1+,@VDP0 No, Write a byte DEC R2 Any bytes left? JNE VMBW1 Yes, Write another VMBW2 RTWP No, Return to caller * * VMBR VDP Multiple Byte Read * * Pass: R0 VDP Address * R1 CPU Buffer Address * R2 Number of Bytes to Read * VMBR0 BL @SETVRA Set VDP read address MOV R2,R2 Zero byte count? JEQ VMBR2 Yes, Return to caller VMBR1 MOVB @VDP0,*R1+ No, Read a byte DEC R2 Any bytes left? JNE VMBR1 Yes, Read another VMBR2 RTWP No, Return to caller * * FILL VDP Fill with a Byte * * Pass: R0 VDP Address * R1 MSB Byte to Fill with * R2 Number of Bytes to Fill * FILL0 BL @SETVWA Set VDP write address MOV R2,R2 Zero byte count? JEQ FILL2 Yes, Return to caller FILL1 MOVB R1,@VDP0 No, Write a byte DEC R2 Any bytes left? JNE FILL1 Yes, Write another FILL2 RTWP No, Return to caller * * VSBW VDP Single Byte Write * * Pass: R0 VDP Address * R1 MSB Byte to Write * VSBW0 BL @SETVWA Set VDP write address MOVB R1,@VDP0 Write the byte RTWP Return to caller * * VSBR VDP Single Byte Read * * Pass: R0 VDP Address * * Return: R1 MSB Byte Read * VSBR0 BL @SETVRA Set VDP read address MOVB @VDP0,@2(R13) Read the byte RTWP Return to caller * * VWTR VDP Write to Register * * Pass: R0 MSB Register Number * LSB Byte to Write * VWTR0 MOV *R13,R0 Get register and data ORI R0,>8000 Set register bit LIMI 0 No interrupts during VDP access BL @SETVA2 Write data to VDP register RTWP Return to caller * * VMWR VDP Multiple Write to Register * * Pass: R0 Starting Register Number * R1 CPU Data Address * R2 Number of Registers to Write to * VMWR0 MOV *R13,R0 Get starting register ORI R0,>9100 Add on register 17 MOV R10,@SAVR10 Save R10 (for CHAR) BL @SETVA1 Set up starting register MOV @SAVR10,R10 Restore R10 MOV R2,R2 Zero byte count? JEQ VMWR2 Yes, Return VMWR1 MOVB *R1+,@VDP3 No, Send a byte DEC R2 Any more bytes left? JNE VMWR1 Yes, Send another VMWR2 RTWP No, Return to caller * * CMDEND Waits for a VDP Command to Finish * CMDEND MOV R0,@SAVER0 Save contents of R0 CMDEN1 LI R0,>028F Set up to read status reg 2 MOVB R0,@VDP1 Write LSB first SWPB R0 Get at the MSB MOVB R0,@VDP1 Write MSB to register 15 SWPB R0 Waste some time MOVB @VDP1,R0 Get status register 2 data SRL R0,9 Is CE bit set? JOC CMDEN1 Yes, Command not finished yet MOV @SAVER0,R0 No, Restore R0 data RT Return to caller

CHAOS_C

#include "a:video_h"
#include "a:stdio_h"
#include "a:stdlib_h"
int oldx,oldy,r,x,y,k,s;
char c,t;

main()
{
c=vidmode(8);
oldx=254;
oldy=0;
c='a';while (c!=32){
r=rnd(3);
r=r+1;
if (r==1){x=254;}
if (r==1){y=1;}
if (r==2){x=511;}
if (r==2){y=195;}
if (r==3){x=1;}
if (r==3){y=195;}
x=(oldx+x)/2;
y=(oldy+y)/2;
plot(x,y,8);
oldx=x;
oldy=y;
c=key(1,&s);
}
exit(0);
}

CHILD_C

#include "a:video_h"
int b;
char c;

main()
{
b=1;
while (c!=32){
setbor(b++);
}
}


CIRCLE1~C

#include "a:video_h"

main()
{
int c,col,a,b,r,phi,y1,x1,phixy,phiy;
c=grfmode(7,8);
col=0;
r=80;
BEGIN:
a=128;
b=100;
r--;
if(r==0)r=80;
phi=0;
y1=0;
x1=r;
START:
phiy=phi+y1+y1+1;
col=col+1;
phixy=phiy-x1-x1+1;
line(a,b,a+x1,b+y1,col);
line(a,b,a-x1,b+y1,col);
line(a,b,a+x1,b-y1,col);
line(a,b,a-x1,b-y1,col);
line(a,b,a+y1,b+x1,col);
line(a,b,a-y1,b+x1,col);
line(a,b,a+y1,b-x1,col);
line(a,b,a-y1,b-x1,col);
phi=phiy;
y1++;
if (phixy<phiy){phi=phixy;x1--;}
if (x1>=y1)goto START;
goto BEGIN;
}



CIRCLE~C

#include "a:video_h"

/* Jeffrey A. Kuhlmann 2/2/90   11:00 */
/* This is the results of using the circle alogorithm */
/* with integers in 'C' */

main()
{
int c,col,a,b,r,phi,y1,x1,phixy,phiy;
c=grfmode(7,8); /* 256x212x256 colors */
col=0;          /* color of pixel */
BEGIN:
a=128;          /* xcoordinate for center */
b=100;          /* ycoordinate for center */
r=80;           /* radius */
phi=0;
y1=0;
x1=r;
START:
phiy=phi+y1+y1+1;
col=col+8;      /* increment color counter */
phixy=phiy-x1-x1+1;
line(a,b,a+x1,b+y1,col);
line(a,b,a-x1,b+y1,col+1);
line(a,b,a+x1,b-y1,col+2);
line(a,b,a-x1,b-y1,col+3);
line(a,b,a+y1,b+x1,col+4);
line(a,b,a-y1,b+x1,col+5);
line(a,b,a+y1,b-x1,col+6);
line(a,b,a-y1,b-x1,col+7);
phi=phiy;
y1++;
if (phixy<phiy){phi=phixy;x1--;}    /* Done ? */
if (x1>=y1)goto START;              /* Nope, keep going */
goto BEGIN;                         /* Continue drawing shapes */
}



!DEBUG

PAGES 0,,,,,,,7
ADD DEBUGO
COPY  >E000,CODE,>1000
CLEAR
BLOCK >0400,>1500
SAVE DEBUG
EXIT

SRC

 UNL
       REF CODE,RSTOP
*
       LWPI >F000
       LI   R0,>1300
       MOVB R0,@>F117
*
       LI   R0,CODE
       LI   R1,>E000
PCS00  MOV  *R0+,*R1+
       CI   R1,>EFFE
       JL   PCS00
*
       B    @RSTOP
       END
*
       DEF  CODE
       DEF  RSTOP
       AORG >E000
CODE   EQU  $

       AORG >E000
       COPY "SRCA"
       COPY "SRCB"
       COPY "SRCC"
*      COPY "SRCD"
       COPY "SRCE"
       COPY "SRCF"
       COPY "KEYB"
 LIST
       END

SRCA

       TITL 'GENEVE RS232 DEBUGGER V 4.0'
       IDT  'RSBUG4.0'
       DEF  RSTOP
*******************************************
* RS232 Debugger Version 4.0   (04/03/87) *
*******************************************
*
* hacked up from pete jaden's 99/4 debugger
*
* Known problems:
*
*  1) Care should be used when changing the memory mapper's
*     map file that you do not map the debugger OUT.  To
*     avoid this, you can enter a "/" command and the
*     debugger will display the LAS of the debugger.  One
*     could change this by reading the current map file at
*     "init" time and have the mapper routine eye-ball your
*     changes.
*
************************************************************
       PAGE
MODBAS EQU  >1EF0
CRUB1  EQU  >1300
OFSET2 EQU  >80
PORT2  EQU  CRUB1+OFSET2
TIPRN  EQU  0
*
PORTM  EQU  PORT2        main port
PORTP  EQU  CRUB1+TIPRN  TI PIO printer port
*
B49600 EQU 208           2400 BAUD
*B49600 EQU  52           9600 baud
*B44800 EQU  104          4800 baud
B44800 EQU  208          2400 BAUD 10.16.91 BWM
SB1    EQU  >C000        1   (stop bit selection)
SB2    EQU  >4000        2
PNONE  EQU  >0000        none (parity selection)
PODD   EQU  >3000        Odd
CL7    EQU >0200         7 bits
CL8    EQU >0300         8 bits
*
SKIPIR EQU  13           Skip interval register
RTSON  EQU  16           Transmitter control
RIENB  EQU  18           Receiver interrupt enable
XBRE   EQU  22           Transmit buffer register empty
DSR    EQU  27           Data set ready
RESET  EQU  31           Reset
*
RFIRST EQU  $            first address
*
MREGS  DATA 0,0,0,0,0,0  Main Workspace (load and xop)
       DATA 0,0,0,0,0,0,0,0,0,0
IREGS  DATA 0,0,0,0,0    ASCII Read/Write WP (r0-r4)
RX     DATA >A000        X Bias r5
RY     DATA >0400        Y Bias r6
RZ     DATA >40          Z Bias r7
       DATA 0,0,0,0,0,0,0,0  r8-r15
*
XREGS  DATA 0,0,0,0,0    I/O WP r0-r4
GFLAG1 BYTE 0            r5   grom glag #1
VFLAG1 BYTE 0            r5lb vdp  flag #1
GFLAG2 BYTE 0            r6   grom glag #2
       BYTE 0            r6lb vdp  flag #2
       DATA 0,0          r7-r8
       DATA GROMRD       r9
       DATA 0            r10
       DATA 0,0,0,0,0    r11-r15
BKPT   DATA -1           breakpoint address table
       DATA 0            opcode 1
       DATA -1,0,-1,0,-1,0
       DATA -1,0,-1,0,-1,0
       DATA -1,0,-1,0,-1,0
       DATA -1,0,-1,0,-1,0
BPTE   EQU  $
*
SSVEC  DATA 0
SSVAL  DATA 0
SSLOC  DATA 0
DWPFLG DATA 0
PRF    DATA 0
INDXST DATA 0
       PAGE
BAUD   DATA PORTM        main i/o port info
       DATA SB2+PNONE+CL8 control register value
       DATA B49600       baud rate if 12 MHZ
*
BAUDP  DATA PORTP        print port info
       DATA SB1+PODD+CL7 control register value
       DATA B44800       baud rate if 12 MHZ
BAUDE  EQU  $            end of baud rate table
VDP1   DATA >8800,>8C00
VDP2   DATA >F100,>F100
*
BANNER TEXT 'Rsbug V4.0  '
       BYTE 0
       EVEN
*
TRACE  EQU  >13C0        Single Step CRU bit
GROMRD EQU  >9800        Grom data Read/Write Location
GWA    EQU  >9C02-GROMRD Grom address Read/Write Location
GWD    EQU  >9C00-GROMRD
*

SRCB

MONTOP BLWP @MSCRLF      output prompt
       DATA PROMPT
       CLR  R2           start addr (parm1)
       CLR  R3           stop  addr (parm2)
       CLR  R4           length     (parm3)
       CLR  R5           counts number of parms entered
       CLR  @GFLAG1      grom/vdp flag1
       CLR  @GFLAG2      grom/vdp flag2
       MOVB @ASC1,@PARM1 init parm to 1
       BL   @ECHO        read and write a char
       MOV  R0,R7        save char.. ????
       LI   R8,CMDTAB-3  get address of command table
SRCH   AI   R8,3         skip parms
       MOV  *R8,R10      end of table (zero word)
       JEQ  ERR4         jump if zero (invalid command)
       CB   *R8+,R7      correct command ?
       JNE  SRCH         jump if not
       MOVB *R8+,R6      get number of entries
       MOV  *R8,R8       get branch address
       SRL  R6,8         right align (zero fill)
       LI   R9,R2*2+MREGS pointer to R2
       INC  R6           bump count
INLOOP DEC  R6           finished ?
       JNE  HEXIN        jump if not
CEXIT  B    *R8          else branch to routine
HEXIN  BLWP @MESG        output a space
       DATA PARM
       AB   @HB01,@PARM1
       BLWP @RHEX        hex input
       DATA NULL         vector
       MOV  R0,*R9+      save hex value entered
CNT    INC  R5           count values entered ????
       CB   R1,@CR       carriage return termination char ?
       JEQ  CEXIT        jump if it was
       JMP INLOOP        else collect next parameter
NULL   INCT R9           no value entered (bump pointer)
       CB   R1,@CR       carriage return termination char ?
       JEQ  CEXIT        if so...exit
       CB   R1,@MINUST   "-" entered ?
       JEQ  CEXIT        if so...exit
       JMP  CNT          else
ERR2   BLWP @MSCRLF      bad value
       DATA BADVAL
       JMP  MONTOP
ERR4   BLWP @MSCRLF      bad command
       DATA BADCMD
       JMP  MONTOP
       PAGE
************************************************************
* Read character                                           *
*                                                          *
* This routine Reads an ascii character and places it in   *
* the MSBy of the user's R0.   ( LSBy is cleared).         *
*                                                          *
*      CALL:  BLWP @READ                                   *
************************************************************
*READ   DATA IREGS,$+2    blwp vectors
*READ1  MOV  @BAUD,R12    cru base
*      TB   DSR          is the data set ready ?
*      JNE  READ1        jump if not
*      TB   RBRL         is reveive buffer full ?
*      JNE  READ1        jump if not
*      TB   9            receive error ?
*      JNE  XFER         jump if not
*      SBZ  RIENB        clear receiver
*      JMP  READ1        and try again
*XFER   CLR  *R13         clear calling r0
*      STCR *R13,7       store character
*      SBZ  RIENB        clear receiver
*      RTWP
***************************************************
* ECHO a character                                *
*  This routine calls the read and writ routines. *
*                                                 *
*      CALL: BL @ECHO                             *
***************************************************
ECHO   BLWP @READ
       BLWP @WRIT
       RT
       PAGE
************************************************************
* Message output                                           *
*  outputs ASCII string pointed to by the word following   *
*  the call.  The string terminator is a >0 byte.          *
*                                                          *
*  CALL:  BLWP @MESG                                       *
*         DATA <address of string>                         *
************************************************************
MSCRLF DATA XREGS,$+2    output cr lf first
       SETO R1           set flag
       LI   R2,CRLF      addr of crlf
       JMP  MESG3
MESGCR DATA XREGS,$+2    output cr lf
       LI   R2,CRLF
       JMP  MESG2
MESGS2 DATA XREGS,$+2    output cr lf
       LI   R2,SPACE2
       JMP  MESG2
MESGR0 DATA XREGS,$+2    write mesg using calling r0
       MOV  *R13,R2      get text addr
       JMP  MESG2
MESG   DATA XREGS,$+2    blwp vectors
MESG1  MOV  *R14+,R2     get text address
MESG2  CLR  R1           flag for crlf
MESG3  MOVB *R2+,R0      get character
       JEQ  MESG4        jump if EOT character (>00)
       BLWP @WRIT        output Character
       JMP  MESG3
MESG4  ABS  R1           crlf flag
       JNE  MESG1        now...go get data
       RTWP
       PAGE
*******************************************************
* Write Character                                     *
*  output ASCII character from the MSBy of calling R0 *
*                                                     *
*      CALL:  BLWP @WRIT                              *
*******************************************************
WRIT   DATA IREGS,$+2    blwp vectors
       MOV  @BAUD,R12    cru base
WRIT05 TB   DSR          data set ready ?
       JNE  WRIT05       jump if not
       TB   XBRE         buffer empty ?
       JNE  WRIT05       jump if not
       LDCR *R13,8       transmit character
WLOOP1 TB   22           transmit buffer empty ?
       JNE  WLOOP1       jump if not
       TB   23           end of transmission ?
       JNE  WLOOP1       jump if not
*
WEXIT  BL   @KEYTST           test for a new key
       JEQ  PRNTST            no key yet
*
       CB   R0,@ESC
       JEQ  KEYDIE
       CI   R0,>1000     CONTROL-P
       JEQ  ABORTP
*
PRNL1  BL   @KEYTST      Wait for new char to restart
       JEQ  PRNL1             no new key yet
       CB   R0,@ESC
       JEQ  KEYDIE
       CI   R0,>1000     CONTROL-P
       JNE  PRNTST       continue with printing
*
ABORTP CLR  @PRF
PRNTST ABS  @PRF
       JEQ  LEDOFF
*
       MOV  @BAUDP,R12   >1300 for TI , >1301 for myarc
       SRL  R12,1
       JOC  MYARC
       SLA  R12,1
*
       TB   2
       JNE  TIREDY
       JMP  WEXIT
*
MYARC  SLA  R12,1
       TB   0
       JNE  MYRRDY
       JMP  WEXIT
*
TIREDY BL   @ROMON
       MOVB *R13,@>5000
       SBZ  2
       NOP
       SBO  2
       BL   @ROMOFF
       JMP  LEDOFF
*
MYRRDY BL   @ROMON
       SBZ  2
       MOVB *R13,@>5A00
       SBZ  1
       NOP
       SBO  1
       SBO  2
       BL   @ROMOFF
*
KEYDIE B    @ABORT
LEDOFF MOV  @BAUD,R12    get correct address
       RTWP
*
ROMON  MOVB @>F112,R10
       MOVB @>8002,R9
       MOVB @HBA00,@>8002
       MOVB @HBA00,@>F112
       SBO  0
       RT
ROMOFF SBZ  0
       MOVB R9,@>8002
       MOVB R10,@>F112
       RT
HBA00  DATA >BA00
       PAGE
************************************************************
* Hex Input                                                *
*  This routine returns a 4 digit hex value in the users   *
*  R0.  Hex digits are entered via keyboard. Termination   *
*  characters are Carrage Return, Comma, Space, or a Minus *
*  sign.  The termination character is returned in the     *
*  MSBy of the user's R1 and the LSBy is cleared. Normal   *
*  return is PC + 2.  If no hex characters are entered     *
*  before a termination character, control is returned to  *
*  the null entry point.  If an invalid character is       *
*  entered control is returned to the error "ERR2".        *
*  Entering an X, Y, or Z will add the value of the bias   *
*  to the final hex number.                                *
*                                                          *
*  If a G is entered and R5=0 then GFLAG1 will be set,     *
*  else GFLAG2 will be set.                                *
*                                                          *
*      CALL:  BLWP @RHEX  call routine                     *
*             DATA NULL   address if no hex characters     *
*             ..........  normal return                    *
************************************************************
RHEX   DATA XREGS,$+2    blwp vectors
       CLR  R1           bias
       CLR  R2           buffer
       CLR  R3           count
LOOP   BL   @ECHO        get character
       CI   R0,'0'*256   min numeric
       JL   NOTHEX
       CI   R0,'9'*256   max numeric
       JLE  GOTONE
       CI   R0,'A'*256   min alpha
       JL   NOTHEX
       CI   R0,'F'*256   max alpha
       JH   NOTHEX
       AI   R0,>900      alpha adjust
GOTONE SLA  R0,4         isolate digit
       SRL  R0,12        word align
       SLA  R2,4
       A    R0,R2        add to buffer
INC    INC  R3
       JMP  LOOP
NOTHEX LI   R4,GFLAG1    address of grom flag 1
       LI   R8,RHTAB     jump table
JMPLOP MOVB *R8+,@INDXST   get jump addr index
       JLT  ERR          end of table
       CB   *R8+,R0      char ?
       JNE  JMPLOP       jump there
       MOVB @INDXST,R8
       SRL  R8,8
       SLA  R8,1
       B    @JINDEX(R8)
       JMP  $+2
JINDEX EQU  $            adjust index
J1     A    @RX,R1       x bias
       JMP  INC
J2     A    @RY,R1       y bias
       JMP  INC
J3     A    @RZ,R1       z bias
       JMP  INC
J4     A    @14*2+MREGS,R1 program counter
       JMP  INC
J5     LI   R0,' '*256   load space
SPCK   A    R1,R2        add bias
       MOV  R0,@2(R13)   return termination char to r1
       MOV  R3,R3        null input ?
       JEQ  EXIT1        jump if so
       MOV  R2,*R13      return value to calling r0
       INCT R14          add 2 to pc
       RTWP
EXIT1  MOV  *R14,R14     get null/error address
       RTWP
ERR    LI   R14,ERR2     point at error address
       RTWP
VSET   INC  R4
GSET   MOV  @R5*2(R13),R0 get calling wp r5 value
       JEQ  GVSET1       count = 0?  set flag1
       INCT R4           address of flag
       DEC  R0           count = 1?  set flag2
       JNE  LOOP         jump if not zero
GVSET1 MOVB @HBFF,*R4    set flag
       JMP  LOOP
*
RHTAB  BYTE GSET-JINDEX/2,'G'
       BYTE VSET-JINDEX/2,'V'
       BYTE J1-JINDEX/2,'X'
       BYTE J2-JINDEX/2,'Y'
       BYTE J3-JINDEX/2,'Z'
       BYTE J4-JINDEX/2,'P'
       BYTE J5-JINDEX/2,','
       BYTE SPCK-JINDEX/2,' '
       BYTE SPCK-JINDEX/2,'-'
       BYTE SPCK-JINDEX/2,>0D
       BYTE >FF,>FF
       EVEN
       PAGE
************************************************************
* Hex output                                               *
*                                                          *
* output either 1 or 4 hex digits.                         *
* "WHX1" outputs 1 hex digit from the LSnibble of call R0. *
* "WHEX" outputs 4 hex digit from the MSnibble of call R0. *
*                                                          *
*  CALL:  BLWP @WHX1        one character                  *
*         BLWP @WHEX        four characters                *
************************************************************
WHX1   DATA XREGS,$+2    blwp vector
       MOV  *R13,R2      one nybble (lsn)
       SLA  R2,12        align nybble
       LI   R3,1         count
HB01   EQU  $-1
       JMP  WHEX2
WHX2   DATA XREGS,$+2    hex output (two characters)
       LI   R3,2         two characters (MSBy)
       JMP  WHEX1
WHEX   DATA XREGS,$+2    hex output (four characters) vector
       LI   R3,4         count
WHEX1  MOV  *R13,R2
WHEX2  BL   @KEYTST      cru base
       JEQ  ROOP         jump if not
       CB   @ESC,R0      escape ?
       JEQ  ABORT        jump if yes
*
ROOP   MOV  R2,R0        save
       ANDI R0,>F000     isolate nyble
       SRL  R0,4         byte align
       CI   R0,>900      numeric
       JLE  NUM          jump if yes
       AI   R0,>700      alpha adjust
NUM    AI   R0,>3000     convert ot ascii
       BLWP @WRIT        output character
       SRC  R2,12        align next nyble
       DEC  R3           count
       JNE  ROOP         jump not done
       RTWP
ABORT  LWPI MREGS        wp
       LI   R0,STEXTN-SSTAB
       MOV  R0,@SSVEC
       B    @MONTOP
       PAGE
************************************************************
*      Load Grom   AND VDP address                         *
************************************************************
GLOAD  MOVB R2,@GWA(R9)  send grom address (hi)
       SWPB R2
       MOVB R2,@GWA(R9)  send grom address (low)
       RT
VLOADR ANDI R2,>BFFF     mask unused address bits
VLOAD  LI   R12,MODBAS
       MOV  @VDP1+2,R10
       TB   2
       JNE  VLOAD2
       MOV  @VDP2+2,R10
*
VLOAD2 SWPB R2
       MOVB R2,@2(R10)   send low address byte
       SWPB R2
       MOVB R2,@2(R10)   send hi  address byte
       RT
VLOADW ORI  R2,>4000     write address bit
       JMP  VLOAD
       PAGE

SRCC

************************************************************
* Get data from source or destination (ram, grom, or vdp   *
*                                                          *
*   SOURCE      = calling R2 (used GFLAG1 or R5)           *
*   DESTINATION = calling R3 (used GFLAG2 or R6)           *
*           and uses GFLAG2                                *
************************************************************
GETFR  DATA XREGS,$+2    get data from 'From' location
       MOV  R5,R1        flags
       MOV  @2*R2(R13),R2 get start address
       JMP  GETT
*
GETTO  DATA XREGS,$+2    get data from 'To' location
       MOV  R6,R1        flags
       MOV  @2*R3(R13),R2 get ending address
GETT   MOVB R1,R1        is it a grom access ?
       JEQ  GETT1        no, skip
       BL   @GLOAD       load grom address
       MOVB *R9,*R13     put a byte in user's R0 MSBy
       JMP  GETT5
GETT1  SWPB R1
       MOVB R1,R1        is it a vdp access ?
       JEQ  GETT4        no, skip
       BL   @VLOADR
       MOV  @VDP1,R10
       TB   2
       JNE  GETT3
       MOV  @VDP2,R10
*
GETT3  MOVB *R10,*R13
       JMP  GETT5
GETT4  MOVB *R2+,*R13    must be CPU memory access
       MOVB *R2,@1(R13)
GETT5  RTWP
       PAGE
**********************************
*   Put to source or destination *
**********************************
PUTFR  DATA XREGS,$+2    Put data to 'From' location
       MOV  R5,R1        use source flags
       MOV  @2*R2(R13),R2 get start address
       JMP  PUT
PUTTO  DATA XREGS,$+2    Put data to 'To' location
       MOV  R6,R1        use dest flag
       MOV  @2*R3(R13),R2 get ending address
PUT    MOVB R1,R1        is it a grom access ?
       JEQ  PUT1         no, skip
       COC  @H1FFF,R2    on a boundry ?
       BL   @GLOAD
       MOVB *R13,@GWD(R9)
       RTWP
PUT1   SWPB R1
       MOVB R1,R1        is is a VDP access
       JEQ  PUT4         no, skip
       BL   @VLOADW
       MOVB *R13,*R10
       RTWP
PUT4   MOVB *R13,*R2     must be CPU memory access
       RTWP
       PAGE
**************************************
* Memory-Grom-Vdp     inspect/change *
**************************************
M      MOV  R2,R8        save original start addr
       LI   R6,8         default char/line
HB08   EQU  $-1
       SLA  R6,1         8 words per line
       MOV  @GFLAG1,R0   is it grom or vdp ?
       JNE  GV           jump if yes
       ANDI R2,>FFFE     word align
       ANDI R3,>FFFE     word align
       DEC  R5           1 Input?
       JEQ  MIC          yes, memory inspect/change
*
* Memory Dump
*
MLOOP1 MOV  R6,R5        words per line
       BL   @NLSAEQ      new line, start address, equal
MLOOP2 BL   @CONSPA      output contents
       INCT R2
       DECT R5           finished ?
       JNE  MLOOP2       jump if not
       BL   @OUTASC      output ascii/see if done
       JMP  MLOOP1
*
* memory inspect
*
MIC    BL   @NLSAEQ      output new line, address , =
       BL   @CONSPA      output contents & 2 spaces
       BLWP @RHEX        accept new data
       DATA MNULL
       MOV  R0,*R2       change memory location
MNULL  CI   R1,>D00      return terminator ?
       JEQ  MT$1         yes, exit
       CI   R1,'-'*256   minus terminator ?
       JNE  NEXTA        jump if not
       DECT R2           backup address
       JMP MIC           do it again
NEXTA  INCT R2           next address
       JMP MIC           do it again
       PAGE
***********************
* Grom or VDP examine *
***********************
GV     DEC  R5           ONE Input?
       JEQ  GIC          yes, Grom INSPECT/CHANGE
GLOOP1 MOV  R6,R5        bytes per line
       BL   @NLSAEQ      NEW LINE, STARTA,=
GLOOP2 BLWP @GETFR       Read & output Grom DATA
       BLWP @WHX2
       BLWP @MESG
       DATA SPACE1
       INC  R2           address
       DEC  R5           end of line
       JNE  GLOOP2       jump if not
       BL   @OUTASC      out ascii/see if done
       JMP  GLOOP1
GIC    BL   @NLSAEQ      NEW LINE, STARTA, =
       BLWP @GETFR       get Grom OR VDP DATA
       MOVB @VFLAG1,R10  IS IT VDP ACCESS ?
       JEQ  GIC020       NO, SKIP
       MOV  R2,R10
       SLA  R10,1        IS IT A REGISTER Load
*      JOC  STAT         yes, print OUT Status AND QUIT
GIC020 BLWP @WHX2        output BYTE
       BLWP @MESGS2
       BLWP @RHEX        ACCEDPT NEW DATA
       DATA GNULL
       SWPB R0
       BLWP @PUTFR       Load Grom OR VDP DATA
GNULL  CI   R1,>0D00     DONE?
       JEQ  MT$1         yes,EXIT
       CI   R1,>2D00     minus?
       JNE  NEXTGA
       DEC  R2           GO TO PREVIOUS location
       JMP  GIC
NEXTGA INC  R2           GO TO NEXT location
       JMP GIC
MT$1   JMP  MT$3
****************************************
* Subroutine to print ascii equivalent *
****************************************
OUTASC BLWP @MESGS2
       MOV  R6,R5        char/line
       S    R5,R2
MSKIP3 BLWP @GETFR       get data (returned in R0)
       INC  R2           address
       ANDI R0,>7F00     strip off MSB
       CI   R0,>2000     is is a control character ?
       JHE  MSKIP5       jump if not
MSKIP4 LI   R0,'.'*256   yes, output *
MSKIP5 CI   R0,>7F00     is it a delete ?
       JEQ  MSKIP4       jump if yes
       BLWP @WRIT        output character
       DEC  R5           count
       JNE  MSKIP3       jump if not finished ?
       C    R2,R3        finished ?
       JH   MT$3         jump if yes
       C    R2,R8        compare to original start
       JLE  MT$3         jump if rolled over
       RT
MT$3   JMP  MT$4
******************************************************
* Subroutine to output a new line, starting address, *
* and the equal sign.                                *
******************************************************
NLSAEQ BLWP @MESGCR
       MOV  R2,R0
       BLWP @WHEX        output START address
       BLWP @MESG        output MESSAGE
       DATA EQUSGN
       RT
*
* output addressed memory contents and 2 spaces
*
CONSPA MOV  *R2,R0
       BLWP @WHEX             output MEMORY CONTENTS
       BLWP @MESGS2
       RT
*************************
*                       *
* Input ASCII to memory *
*                       *
*************************
A      BL   @NLSAEQ      NEW LINE,STARTA,=
       LI   R5,16
A2     BL   @ECHO        get Character
       CI   R0,>1B00     QUIT ?
ESC    EQU  $-2
       JEQ  A5           yes
       CI   R0,>0800     BACKSPACE ?
       JNE  A3           NO, SKIP
       DEC  R2           PREVIOUS location
       INC  R5
       CI   R5,17        if COUNT IS TOO HIGH, REALIGN
       JEQ  A4
       JMP  A2
A3     BLWP @PUTFR
       INC  R2
       C    R2,R3
       JEQ  MT$4
A4     DEC  R5
       JNE  A2
       JMP  A
A5     LI   R0,>0D00
       BLWP @WRIT
MT$4   JMP  MT$5
       PAGE
**********************
* CRU INSPECT/CHANGE *
**********************
C      MOV  R2,R12       CRU BASE
       ANDI R3,>F        ISOLATE BIT COUNT
       CLR  R7           CLEAR WORDFLAG
       MOV  R3,R3        16 bits?
       JEQ  SETFG        yes, SET Flag
       CI   R3,>9        BYTE OR LESS
       JL   CSKIP1       yes,SKIP
SETFG  INC  R7           SET Flag
CSKIP1 SLA  R3,6         FORM STCR COMMAND
CLOOP  LI   R8,>340A     STCR R10,R3
       SOC  R3,R8
       X    R8           EXECTUE 'STCR'
       BLWP @MESGCR
       MOV  R12,R0       output BASE
       BLWP @WHEX
       BLWP @MESG
       DATA EQUSGN       output EQUAL SIGN
       MOV  R7,R7        WORD TRANSFER?
       JNE  CSKIP2       yes,SKIP
       SRL  R10,8        ALIGN WORD
CSKIP2 MOV  R10,R0
       BLWP @WHEX        output DATA
       BLWP @MESGS2
       BLWP @RHEX        ACCEPT NEW DATA
       DATA CNULL3
       MOV  R0,R10
       MOV  R7,R7        WORD TRANSFER
       JNE  CSKIP3       yes, SKIP
       SLA  R10,8        ALIGN WORD
CSKIP3 ANDI R8,>F3FF     CONVERT STCR TO LDCR
       X    R8           EXECUTE LDCR
CNULL3 CI   R1,>D00      RETURN?
       JNE  CLOOP        NO, JUMP BACK
MT$5   JMP  MT$6
       PAGE
***************************
*                         *
* Register Inspect/Change *
*                         *
***************************
R      LI   R8,WS        MESSAGE pointer
       LI   R5,3         LOOP COUNT
       LI   R9,13*2+MREGS address Mregs WP
RLOOP  MOV  R8,@RDATA
       BLWP @MSCRLF      output MESSAGE
RDATA  DATA 0
       MOV  *R9,R0
       BLWP @WHEX        output CONTENTS
       BLWP @MESGS2      output SPACES
       BLWP @RHEX        accept new data
       DATA RNULL
       MOV  R0,*R9       update reg
RNULL  CI   R1,>2D00     minus?
       JEQ  RLOOP        yes,do again
       CI   R1,>0D00     return?
       JEQ  MT$6         yes,exit
       DEC  R5           done?
       JEQ  MT$6         yes, exit
       C    *R8+,*R8+    add 4 to message pointer
       INCT R9           next reg
       JMP  RLOOP
MT$6   JMP  MT$7
***********
* EXECUTE *
***********
E      MOV  R5,R5        user entry?
       JEQ  GIT          j if not
       MOV  R2,R14
GIT    RTWP
       PAGE
****************************
* Workspace inspect/change *
****************************
W      MOV  R13,R8       get workspace pointer
       MOV  R5,R5        null input?
       JEQ  WNULL1       yes, to formatted dump
       ANDI R2,>F        mask of nyble
       MOV  R2,R9        save register #
       SLA  R2,1
       A    R2,R8        form register address
ICLOOP BL   @WOUT        output  workspace data
       BLWP @RHEX        accept new value
       DATA WNULL2
       MOV  R0,*R8       update register
WNULL2 CI   R1,>D00      return?
       JNE  SKIP
MT$7   JMP  MT$8
SKIP   CI   R1,>2000     next register?
       JEQ  NREG         yes, jump ahead
       MOV  R9,R9        at r0?
       JEQ  MT$8         yes, quit
       DEC  R9           update register #
       DECT R8           update pointer
       JMP  ICLOOP
NREG   CI   R9,>F        at r15?
       JEQ  MT$8         yes, quit
       INC  R9           update register #
       INCT R8           update address
       JMP  ICLOOP
WNULL1 BL   @DUMPWP      dump workspace
MT$8   B    @MONTOP
       PAGE
*****************************************
* formatted dump of workspace registers *
*****************************************
DUMPCK MOV  @DWPFLG,R10  check dump wp flag
       JNE  DUMPWP       jump if not zero
       RT
DUMPWP MOV  R11,R10      save return
       LI   R2,3         asr value (4/line)
       C    *R2+,*R2+    (+4) not asr (8/line)
       CLR  R9           start at 0
       MOV  R13,R8       get start address
DWP2   BLWP @MESGCR
DWP3   BL   @WOUT1       output data
       INC  R9           update register #
       CI   R9,>F        done?
       JLE  DWP4
       B    *R10         return
DWP4   INCT R8           update pointer
       CZC  R2,R9        end of line
       JEQ  DWP2         yes, new line
       JMP  DWP3
*
WOUT   BLWP @MESGCR      new line
WOUT1  BLWP @MESG        output 'R'
       DATA VR
       MOV  R9,R0
       BLWP @WHX1        output register #
       BLWP @MESG        output equal sign
       DATA EQUSGN
       MOV  *R8,R0
       BLWP @WHEX        output contents of register
       BLWP @MESGS2      output 2 spaces
       RT
       PAGE

SRCE

*************
*
* Step Interpreter ...
*
*      a) single step
*      b) set bkpt at old PC
*      c) run
*
*************
G      C    *R14,@XOP1
       JNE  G20
*
       INCT R14
       RTWP
*
G20    MOV  R2,@SSVAL
       JNE  G23
       INC  @SSVAL
*
G23    LI   R1,STINTP-SSTAB
       MOV  R1,@SSVEC
       MOV  R14,@SSLOC
       B    @TRACE1
*
SSINTP MOV  @SSLOC,R1
       MOV  *R1,R2            save opcode
       MOV  @XOP1,*R1         set breakpoint
*
       LI   R3,BKPT
       LI   R4,BPTE
       SETO R6
*
G30    C    *R3,R6
       JEQ  G40
       AI   R3,4
       CI   R3,R4
       JL   G30
*
       LI   R0,BPER3     can not assign bp
       B    @BPERR       print error and exit
*
G40    MOV  R1,*R3+
       MOV  R2,*R3+
       RTWP
*
BKINTP C    R14,@SSLOC
       JNE  G59
*
G50    DEC  @SSVAL
       JEQ  G58               all done
*
       LI   R3,BKPT
       LI   R4,BPTE
*
G51    C    *R3,@SSLOC
       JEQ  G55
       AI   R3,4
       C    R3,R4
       JL   G51
*
       JMP  G58
*
G55    MOV  *R3,R2
       SETO *R3+
       MOV  *R3,*R2
       JMP  TRACE0
*
G58    LI   R1,STEXTN-SSTAB
       MOV  R1,@SSVEC
G59    B    @BRK00
*
*************
*
* D loc     Step until location changes
* D loc,val Step until location=val
*
* Ignore DOS calls during stepping
*
*************
D      ANDI R2,>FFFE
       MOV  R2,@SSLOC
       DEC  R5
       JEQ  D10               go until location changes
*
       MOV  R3,@SSVAL         compare value
       LI   R1,STLOCE-SSTAB
       MOV  R1,@SSVEC
       JMP  TRACE1
*
D10    MOV  *R2,@SSVAL
       LI   R1,STLOCC-SSTAB
       MOV  R1,@SSVEC
       JMP  TRACE0
*
SSLOCC MOV  @SSLOC,R2
       C    *R2,@SSVAL
       JNE  TRDONE
       JMP  D20
*
SSLOCE MOV  @SSLOC,R2
       C    *R2,@SSVAL
       JEQ  TRDONE
*
D20    CI   R14,>0400         calling DOS?
       JHE  BKTRC             no, continue tracing
*
       MOV  @28(R13),R2       save return PC
*
       LI   R3,D50
       MOV  R3,@28(R13)
       RTWP
*
D50    BLWP @D51
D51    DATA MREGS,D60
*
D60    MOV  R2,R14            restore return pc
       JMP  TRACE1

***************
* Single Step *
***************
S      CB   R1,@MINUST   minus ?
       JNE  S1           jump if not
*
* step until PC=val
*
       MOV  R2,R2        value required in trace mode
       JNE  SST1
       B    @ERR2        bad value
*
SST1   LI   R1,STTRC-SSTAB
       MOV  R1,@SSVEC
       MOV  R2,@SSVAL
       BLWP @MSCRLF
       DATA TRACEM
       JMP  TRACE1
*
******************************
*
* step CNT
*
S1     LI   R1,STCNT-SSTAB
       MOV  R1,@SSVEC
*
       MOV  R2,@SSVAL    number of steps
       JNE  TRACE0       zero ?
       INC  @SSVAL
*
TRACE0 BL   @GETWP       get correct wp
       BLWP @MSCRLF
       DATA TRACEM
       BL   @OUTWS       output workspace
       BL   @DUMPCK      check for dump workspace
*
TRACE1 C    *R14,@XOP1   xop assigned ?
       JEQ  SEX
       LI   R12,TRACE    ss cru base
       SBO  0            execute 2 instructions
SEX    RTWP              first one
*
SSTRC  C    R14,@SSVAL
       JEQ  TRDONE
*
BKTRC  BL   @KEYTST
       JEQ  TRACE1       no key
       CB   @ESC,R0
       JNE  TRACE1
*
       JMP  TRDONE            abort
*
SSCNT  DEC  @SSVAL
       JNE  TRACE0
       JMP  TREXIT
*
SSEXTN
TRDONE BL   @I9902
       BL   @GETWP       get correct wp
       BLWP @MSCRLF
       DATA TRACEM
       BL   @OUTWS       output workspace
       BL   @DUMPCK      check for dump workspace
*
TREXIT BL   @I9902
       LI   R1,STEXTN-SSTAB
       MOV  R1,@SSVEC
       JMP  MT$12
*
**************
* Load Entry *
**************
LD     LIMI 0            disable interrupts
       MOV  @SSVEC,R1
       MOV  @SSTAB(R1),R1
       B    *R1
*
SSTAB
STEXTN DATA SSEXTN,BRK00      external NMI
STCNT  DATA SSCNT,BRK00       step CNT
STTRC  DATA SSTRC,BRK00       step until PC=val
STINTP DATA SSINTP,BKINTP     step, set brk, run
STLOCC DATA SSLOCC,BRK00      step until loc val changes
STLOCE DATA SSLOCE,BRK00      step until loc=val
*
**************
* Debug Init *
**************
IDATA  B    @BPENT       init data
       DATA MREGS        wp for load
       DATA LD           pc for load
RSTOP  BLWP @RSBUGV      save vectors
RSBUGV DATA MREGS        wp
       DATA $+2
       LIMI 0
       MOV  @11*2(R13),R14 old r11 to pc
       CLR  R12
       LI   R0,IDATA     addr of data
       LI   R1,>FFF8     addr to write data
RSBUG1 MOV  *R0+,*R1+    copy data
       MOV  R1,R1        end of memory ?
       JNE  RSBUG1
       LI   R1,STEXTN-SSTAB
       MOV  R1,@SSVEC
*********************
* initialize system *
*********************
INIT   BL   @I9902       init 9902 port
INIT1  BLWP @MSCRLF      output banner
       DATA BANNER
       LI   R0,RFIRST    addr of first loacation
       BLWP @WHEX
       BLWP @MESG        -
       DATA MINUST
       LI   R0,RLAST     addr of last loacation
       BLWP @WHEX
MT$12  JMP  MT$14
********************
* Breakpoint Entry *
********************
BPENT  LIMI 0            disable interrupts
       BL   @GETWP
       DECT R14          adjust pc
       BL   @I9902       init 9902 (power up may kill it)
*
       MOV  @SSVEC,R1
       MOV  @SSTAB+2(R1),R1
       B    *R1
*
BRK00  BLWP @MSCRLF      output 'B'
       DATA BPMSG
       BL   @OUTWS       output ws,pc,st
       BL   @DUMPCK      check for dump workspace
       MOV  R14,R2       init bp to delete
       LI   R1,'-'*256   delete flag
       INC  R5           number of parms flag
       PAGE
**********************
* breakpoint routine *
**********************
*
* R0 = temp address
* R1 = termination character
* R2 = value entered
* R3 = address of bp table
* R4 = address of end of bp table
* R5 = number of parms entered
* R6 = >FFFF flag for entry not used
* R7 = XOP R0,1 instruction (>2C40) or BLWP (>420)
*
B      ANDI R2,>FFFE     even address
       LI   R3,BKPT      address of bp table
       LI   R4,BPTE      address of bp table
       SETO R6           no entry flag
       LI   R7,>2C40     xop r0 instruction
XOP1   EQU  $-2
*************************************
* verify all breakpoint assignments *
*************************************
BPV1   MOV  *R3+,R0      get first address
       C    *R0,R7       still assigned ?
       JEQ  BPV2         jump if still assigned
       SETO @-2(R3)      delete in table
BPV2   C    *R3+,*R3     skip data field
       C    R3,R4        end of table ?
       JL   BPV1         jump if not
       LI   R3,BKPT      address of bp table
*****************************
* now figure out what to do *
*****************************
       CB   R1,@MINUST   term char
       JEQ  BPD          jump if delete
       MOV  R5,R5        parm count ?
       JEQ  BPL          jump to list if zero
       PAGE
***********************************************
* check if already assigned, if not assign bp *
***********************************************
BPI    C    R2,*R3+      in table ?
       JEQ  MT$14        jump if assigned
       C    *R3+,*R3     next
       C    R3,R4        end of table ?
       JL   BPI          jump if not
       LI   R3,BKPT      table addr
BPI2   C    R6,*R3       find open spot
       JEQ  BPI3         jump if open
       AI   R3,4
       C    R3,R4        end of table ?
       JL   BPI2         jump if not
       LI   R0,BPER1     buffer full
       JMP  BPERR        print error and exit
BPI3   MOV  R2,*R3+      save addr
       MOV  *R2,*R3+     save opcode
       MOV  R7,*R2       insert bp opcode
       C    *R2,R7       did it get there ?
       JEQ  BPI5         continue if it did
       SETO @-4(R3)      delete bp
       LI   R0,BPER3     can not assign bp
       JMP  BPERR        print error and exit
BPI5   JMP  MT$14
***********************************
* verify and delete breakpoint(s) *
***********************************
BPD    MOV  R5,R5        any parms ?
       JEQ  BPD2         delete all
BPD1   C    R2,*R3+      in table ?
       JEQ  BPD3         jump is so
       C    *R3+,*R3+    add 4
       C    R3,R4        end of table ?
       JL   BPD1         jump if not
       LI   R0,BPER2     bp not found
       JMP  BPERR        print error and exit
BPD2   MOV  *R3+,R2      get addr
       C    R2,R6        assigned ?
       JEQ  BPD4         jump if not
BPD3   MOV  *R3,*R2+     restore opcode
*      ABS  @TWBPF       2 wds ?
*      JEQ  BPD4         j if not
*      MOV  @2(R3),*R2   restore 2nd opcode
BPD4   SETO @-2(R3)      delete bp
       C    *R3+,*R3+
       MOV  R5,R5        delete all ?
       JNE  MT$14        exit if not
       C    R3,R4        end of table ?
       JL   BPD2         jump if not
MT$14  JMP  MT$15
***********************************
* verify and list all breakpoints *
***********************************
BPL    BLWP @MSCRLF
       DATA BPMESG
BPL1   MOV  *R3+,R0      get address
       C    R0,R6        assigned ?
       JEQ  BPL2         jump if not
       BLWP @MESGS2
       BLWP @WHEX        write address
BPL2   C    *R3+,*R3
       C    R3,R4        end of table
       JL   BPL1         jump if not
       JMP  MT$15
BPERR  BLWP @MESGR0      print message via r0
MT$15  B    @MONTOP
       PAGE
********************
* output workspace *
********************
OUTWS  STWP R2           get workspace
       AI   R2,13*2      point as wp
       LI   R5,3         count
       LI   R3,STBL      status table
OUTWS1 MOV  *R3+,R0      get text
       BLWP @MESGR0      write wp/st/pc
       MOV  *R2+,R0      get value
       BLWP @WHEX        output r value
       BLWP @MESGS2
       DEC  R5           count
       JNE  OUTWS1       jump if not
       MOV  R0,R1        get status value
OUTWS3 LI   R0,SPACE2    output 2 spaces
       BLWP @MESGR0
       SLA  R1,1         status bit
       JNC  OUTWS4       jump if not on
       MOV  *R3,R0       get addr text
OUTWS4 BLWP @MESGR0      print r0
       INCT R3           index
       CI   R3,STBLE     done ?
       JNE  OUTWS3
       RT
STBL   DATA WSM
       DATA PCM
       DATA STM
       DATA LGTM
       DATA AGTM
       DATA EQM
       DATA CM
       DATA OVM
       DATA OPM
       DATA XOPM
STBLE  EQU  $
       PAGE
**************************************
* Subroutine to initialize 9902 port *
*                                    *
*      bl   @i9902                   *
*      data baud                     *
*                                    *
* baud data cru base                 *
*      data control reg val          *
*      data baud rate val if /4      *
*      data baud rate val if /8      *
*                                    *
* R8,R9,R10,R11,R12 are used         *
**************************************
I9902  LI   R10,BAUD     table addr
       CLR  R8           /8 flag
       CLR  R12
I9902A MOV  *R10+,R12    cru base
       MOV  *R10+,R9     control reg
       SZCB @HB08,R9     control reg clk4m bit
       MOV  *R10,*R10    test baud value
       JGT  I9902C       jump if not cnt4
       SOCB @HB08,R9     set control reg bit
I9902C SBO  RESET        reset 9902
       C    *R0,*R0      delay
       LDCR R9,8         control register
       SBZ  SKIPIR       skip interval reg
       LDCR *R10+,12     load baud rate
       SBO  RTSON        request to send on
       SBZ  RIENB        clear input
       INCT R10          correct pointer
       CI   R10,BAUDE    end of table
       JEQ  I9902X
       ABS  @PRF         printer flag
       JNE  I9902A       is set, go setup printer
I9902X RT
********************************************************
* routine to get mreg workspace and pass old blwp info *
********************************************************
GETWP  MOV  R13,@13*2+MREGS   r13
       MOV  R14,@14*2+MREGS   r14
       MOV  R15,@15*2+MREGS   r14
       MOV  R11,@11*2+MREGS   r11
       LWPI MREGS
       RT
       PAGE

SRCF

*************
* Help Menu *
*************
HELP   LI   R0,HELPM     addr of menu
HELP1  SETO R1           flag
HELP2  BLWP @MESGR0      send help menu
       MOV  @R2*2+XREGS,R0 last addr
       MOVB *R0+,R3      end ?
       JLT  MT$16        exit if so
       MOV  R1,R1        flag
       JGT  HELP4        output crlf
       SRL  R3,8         right align
       MOV  R0,R4        save address
       LI   R0,' '*256   space
HELP3  BLWP @WRIT        write a space
       DEC  R3           count
       JNE  HELP3
       MOV  R4,R0        get address back
       INC  R1           flag
       JMP  HELP2
HELP4  BLWP @MESGCR
       JMP  HELP1
       PAGE
************************
* N  Move block        *
************************
N      BL   @CALCR4      check and calc r4
N1     BLWP @GETFR       get a byte
       BLWP @PUTTO       put a byte
       INC  R2           inc addr
       INC  R3
       DEC  R4           done?
       JNE  N1           jump if not
MT$16  JMP  MT$17        return
*
CALCR4 MOV  R4,R4        0?
       JNE  CALCEX
       MOV  R3,R4        end addr
       S    R2,R4        start addr
       JGT  CALCEX
       B    @ERR2        bad value
CALCEX RT
******************
* Compare Blocks *
******************
CMP    BL   @CALCR4      get r4
       BLWP @GETFR       data from first block
       MOV  R0,R7
       BLWP @GETTO       data form second block
       CB   R0,R7        = ?
       JEQ  CMPNT        yes, skip
       MOV  R0,R1
       BL   @PRTBD       print crlf, add/data
       BLWP @MESGS2
       BL   @PRTBD1      print addr/data
       MOV  R9,R2
CMPNT  INC  R2
       INC  R3
       DEC  R4           finished ?
       JNE  CMP
MT$17  JMP  MT$18
       PAGE
***************************************
* F=find Word/Byte Equal to Value     *
* K=find Word/Byte Not Equal to Value *
***************************************
F      LI   R8,>1602     jump not equal inst
       JMP  FIND
K      LI   R8,>1302     jump equal inst
FIND   DEC  R2
       CI   R1,>2D00
       JNE  CB
       SWPB R4           swap if byte compare
CB     INC  R2
       BLWP @GETFR
       MOV  R0,R7
       CI   R1,>2D00     byte ?
       JEQ  CB1          jmp if yes
       C    R7,R4
       X    R8
       BL   @PRTWD
       INC  R2
       JMP  GOOD1
CB1    CB   R7,R4
       X    R8           execute jump instruction
       BL   @PRTBD       output addr/data
GOOD1  C    R2,R3        done?
       JL   CB
MT$18  JMP  MT$19
***************
* Change Bias *
***************
X      LI   R2,RX        addr of X bias
       JMP  CBIAS
Y      LI   R2,RY        addr of Y bias
       JMP  CBIAS
Z      LI   R2,RZ        addr of Z bias
CBIAS  BLWP @MESG
       DATA EQUSGN
       MOV  *R2,R0       output present value
       BLWP @WHEX
       BLWP @MESGS2
       BLWP @RHEX        get new value
       DATA MONTOP       do not change if null
       MOV  R0,*R2       enter new value
MT$19  JMP  MT$20
       PAGE
****************************************************
* print address, equal sign and two digits of data *
****************************************************
PRTBD1 MOV  R2,R9
       MOV  R3,R2
       MOV  R1,R7
       JMP  PRTBD2
PRTBD  BLWP @MESGCR
PRTBD2 MOV  R2,R0
       BLWP @WHEX
       BLWP @MESG
       DATA EQUSGN
       MOV  R7,R0
       BLWP @WHX2
       RT
*
* same as prdbd except 4 digits of data
*
PRTWD  MOV  R11,R10
       BL   @PRTBD
       SWPB R0
       BLWP @WHX2
       B    *R10
*******************************
* controlled s (system reset) *
*******************************
SRESET BLWP @0
*******************************************
* controlled e (jump to editor/assembler) *
*******************************************
JMPEA  LI   R0,>6025     grom address
       MOVB R0,@>9C02    hi addr
       SWPB R0
       MOVB R0,@>9C02    lo addr
       LWPI >83E0        gplws
       B    @>6A         back to e/a
       PAGE
*********************************************
* controlled p (change printer port on/off) *
*********************************************
PR     LI   R0,PRM1      printer
       LI   R1,PRF       flag
PRTFLG BLWP @MESGCR
       BLWP @MESGR0      print message
       ABS  *R1          flag
       JEQ  PR1          jump if off
       CLR  *R1          set off
       LI   R0,PRMF      off
       JMP  PRX          now off
PR1    SETO *R1          set on
       LI   R0,PRMN      on
PRX    BLWP @MESGR0      print
*      CI   R1,DWPFLG    wp flag ?
*      JEQ  MT$20        jump if yes
*      LI   R10,BAUDP
*      BL   @I9902P      init the pig
MT$20  JMP  MT$21
*PRF    DATA 0            0=off, <>0=on
*********************************************
* controlled w (change workspace dump flag) *
*********************************************
DWF    LI   R0,DWFM1     dump wp
       LI   R1,DWPFLG    flag
       JMP  PRTFLG
*DWPFLG DATA -1           default to go "on" first time
****************************************
* controlled v (write to vdp register) *
* <rrdd> rr=reg  dd=value              *
****************************************
VMOD   LI   R12,MODBAS
       MOV  @VDP1+2,R1
       TB   2
       JNE  VMOD2
       MOV  @VDP2+2,R1
VMOD2  INCT R1
*
       ORI  R2,>8000     set for write
       SWPB R2
       MOVB R2,*R1
       SWPB R2
       MOVB R2,*R1
MT$21  JMP  MT$22
       PAGE
************************************************************
* test command                                             *
* this routine will test memory by loading a test pattern  *
* into memory and then verify that pattern.                *
* t <start addr> <ending addr> {<test pattern> or if null  *
*   then the address will be written as data.}             *
* if termination character is a "-" then test pattern data *
* will be shifted right after each word.                   *
************************************************************
T      MOV  R2,R6        starting addr
       MOV  R3,R7        ending   addr
       MOV  R4,R8        save data
T1     CI   R5,2         number of parms
       JGT  T2           jump if 3 parms
       MOV  R2,R4        init address as data
T2     MOV  R4,R0        init data
       C    R2,R3        done ?
       JH   T3           jump if done
       BLWP @PUTFR       write byte
       INC  R2           addr
       JOC  T3           exit on rollover
       SWPB R0           data
       BLWP @PUTFR       write byte
       INC  R2           addr
       JOC  T3           exit on rollover
       CB   R1,@MINUST   - term char ?
       JNE  T1           jump if not
       SRC  R4,1         shift
       JMP  T1
T3     MOV  R6,R2        starting addr
       MOV  R7,R3        ending   addr
       MOV  R8,R4        data
T4     CI   R5,2         number of parms
       JGT  T5           jump if 3
       MOV  R2,R4        init addr as data
T5     C    R2,R3        end ?
       JH   MT$22        jump if done
       BL   @T7          test first  byte
       BL   @T7          test second byte
       CB   R1,@MINUST   term char ?
       JNE  T4           jump if not
       SRC  R4,1         shift
       JMP  T4
MT$22  B    @MONTOP
T7     BLWP @GETFR       get byte
       CB   R0,R4        same ?
       JEQ  T8           jump if so
       BLWP @MSCRLF
       DATA ADDRM        addr=
       MOV  R0,R8
       MOV  R2,R0        get addr
       BLWP @WHEX        output value
       BLWP @MESG
       DATA WASM         data was=
       MOV  R8,R0
       BLWP @WHX2        output value
       BLWP @MESG
       DATA SBM          data should be=
       MOV  R4,R0
       BLWP @WHX2        output value
T8     INC  R2           addr
       JOC  MT$22        exit on rollover
       SWPB R4           data
       RT
       PAGE
*****************
* Command Table *
*****************
CMDTAB TEXT 'M'          Memory inspect/change
       BYTE 2            2 possible inputs
       DATA M            enrty point
       BYTE 'W',1        Workspace inspect/change
       DATA W
       BYTE 'E',1        Execute
       DATA E
*
       BYTE 'D',2        Step until location changes/=value
       DATA D            Ignore DOS calls
       BYTE 'G',1        Step interpreter
       DATA G            Ignore DOS calls
*
       BYTE 'B',1        Breakpoint
       DATA B
       BYTE 'S',1        Single step
       DATA S
       BYTE '/',0        help display
       DATA HELP
       BYTE 'C',2        CRU inspect/change
       DATA C
       BYTE 'R',0        RTWP vector inspect/change
       DATA R
       BYTE 'F',3        Find byte/word
       DATA F
       BYTE 'X',0        change X bias
       DATA X
       BYTE 'Y',0        change Y bias
       DATA Y
       BYTE 'Z',0        change Z bias
       DATA Z
       BYTE 'N',3        move block
       DATA N
       BYTE 'T',3        test memory
       DATA T
       BYTE 'P',3        compare blocks
       DATA CMP
       BYTE 'K',3        find buffer error
       DATA K
       BYTE 'A',2        ASCII
       DATA A
       BYTE >12,0        controlled R
       DATA SRESET       system reset
       BYTE >05,0        controlled E
       DATA JMPEA        jump to editor/assembler
       BYTE >10,0        controlled P
       DATA PR           printer on/off
       BYTE >17,0        controlled W
       DATA DWF          change dump workspace flag
       BYTE 'V',0        /
       DATA INIT1        display version
       BYTE >16,1        controlled V
       DATA VMOD,0       mod vdp regs
H1FFF  DATA >1FFF        lower addr bits
       PAGE
************
* Messages *
************
ASC1   TEXT '1'
CR     EQU  $
CRLF   BYTE >D,>A,0
SPACE2 TEXT ' '
SPACE1 BYTE ' ',0
BPMESG TEXT 'bp'
       BYTE >27
       TEXT 's'
       TEXT ' '
EQUSGN BYTE '=',0
BPMSG  TEXT 'break '
       BYTE 0
VR     BYTE 'r',0
WS     EQU  $
WSM    TEXT 'ws='
       BYTE 0
PCM    TEXT 'pc='
       BYTE 0
STM    TEXT 'st='
       BYTE 0
TRACEM TEXT 'trace '
       BYTE 0
DWFM1  TEXT 'dump wp '
       BYTE 0
PRMF   TEXT 'off'
       BYTE 0
PRMN   TEXT 'on'
       BYTE 0
PRM1   TEXT 'printer '
       BYTE 0
PROMPT BYTE '?',' ',0
PARM   TEXT ' P'
PARM1  TEXT '1='
       BYTE 0
BADCMD TEXT 'bad cmd'
       BYTE 0
BADVAL TEXT 'bad value'
       BYTE 0
BPER1  BYTE >D,>A
       TEXT 'bp buf full'
       BYTE 0
BPER2  BYTE >D,>A
       TEXT 'bp not found'
       BYTE 0
BPER3  BYTE >D,>A
       TEXT 'can'
       BYTE >27          '
       TEXT 't assign bp'
       BYTE 0
MINUST BYTE '-',0
LGTM   TEXT 'LG'
       BYTE 0
AGTM   TEXT 'AG'
       BYTE 0
EQM    TEXT 'EQ'
       BYTE 0
CM     TEXT 'CR'
       BYTE 0
OVM    TEXT 'OV'
       BYTE 0
OPM    TEXT 'OP'
       BYTE 0
XOPM   TEXT 'XP'
       BYTE 0
ADDRM  TEXT 'add='
       BYTE 0
WASM   TEXT ' is='
       BYTE 0
SBM    TEXT ' s/b='
       BYTE 0
       EVEN
TAB    EQU 26
HELPM  BYTE >D,>A
HM1    TEXT 'A = ascii'
HM1L   EQU  $-HM1-1
       BYTE 0,TAB-HM1L
HM2    TEXT 'B = breakpoint'
HM2L   EQU  $-HM2-1
       BYTE 0,TAB-HM2L
HM3    TEXT 'C = cru'
HM3L   EQU  $-HM3-1
       BYTE 0,TAB-HM3L
*
HM3A   TEXT 'D = step until'
HM3AL  EQU  $-HM3A-1
       BYTE 0,TAB-HM3AL
*
HM4    TEXT 'E = execute'
HM4L   EQU  $-HM4-1
       BYTE 0,TAB-HM4L
HM5    TEXT 'F = find byte/word'
HM5L   EQU  $-HM5-1
       BYTE 0,TAB-HM5L
*
HM5A   TEXT 'G = step interp'
HM5AL  EQU  $-HM5A-1
       BYTE 0,TAB-HM5AL
*
HM6    TEXT 'K = find mem <>'
HM6L   EQU  $-HM6-1
       BYTE 0,TAB-HM6L
HM7    TEXT 'M = mem'
HM7L   EQU  $-HM7-1
       BYTE 0,TAB-HM7L
HM8    TEXT 'N = copy mem'
HM8L   EQU  $-HM8-1
       BYTE 0,TAB-HM8L
HM9    TEXT 'P = compare mem'
HM9L   EQU  $-HM9-1
       BYTE 0,TAB-HM9L
HMA    TEXT 'R = rtwp vectors'
HMAL   EQU  $-HMA-1
       BYTE 0,TAB-HMAL
HMB    TEXT 'S = single step/trace'
HMBL   EQU  $-HMB-1
       BYTE 0,TAB-HMBL
HMM    TEXT 'T = test mem'
HMML   EQU  $-HMM-1
       BYTE 0,TAB-HMML
HMC    TEXT 'W = workspace'
HMCL   EQU  $-HMC-1
       BYTE 0,TAB-HMCL
HMF    TEXT 'X,Y,Z = bias'
HMFL   EQU  $-HMF-1
       BYTE 0,TAB-HMFL
HMI    TEXT 'F1 = reset'
HMIL   EQU  $-HMI-1
       BYTE 0,TAB-HMIL
HMJ    TEXT 'F2 = to E/A'
HMJL   EQU  $-HMJ-1
       BYTE 0,TAB-HMJL
HML    TEXT 'F3 = wp flag'
HMLL   EQU  $-HML-1
       BYTE 0,TAB-HMLL
HMP    TEXT 'F4 = ptr flag'
HMPL   EQU  $-HMP-1
       BYTE 0,TAB-HMPL
       TEXT 'F5 = vdp reg (rrvv)'
       BYTE 0
HBFF   BYTE >FF
       EVEN

KEYB

*
* read a character from keyboard
* put char in r0 of caller MSBy, LSBy is cleared
*
READ   DATA IREGS,$+2
READ1  CLR  R12
       TB   8
       JEQ  READ1             no char from kb yet
       MOVB @>8008,R1         get kb char from /4a address
       LI   R12,>1EF4
       TB   0
       JNE  READ2
       MOVB @>F118,R1         get kb char from 9640 address
READ2  LI   R12,>1EF0
       SBZ  1
       SBO  1                 cleat the kb char
*
       MOVB R1,R1
       JLT  READ1             this was a break code, ignore it
       CLR  *R13
       SRL  R1,8
       MOVB @SCAN1(R1),*R13
       CB   *R13,@HFF
       JEQ  READ1             not a good character
       RTWP
*
KEYTST CLR  R12
       TB   8
       JEQ  KEYT98            no char from kb yet
       MOVB @>8008,R1         get kb char from /4a address
       LI   R12,>1EF4
       TB   0
       JNE  KEYT10
       MOVB @>F118,R1         get kb char from 9640 address
KEYT10 LI   R12,>1EF0
       SBZ  1
       SBO  1                 cleat the kb char
*
       MOVB R1,R1
       JLT  KEYT98            this was a break code, ignore it
*
       CLR  R0
       SRL  R1,8
       MOVB @SCAN1(R1),R0
       CB   R0,@HFF
       JNE  KEYT99            good character
*
KEYT98 CLR  R0
KEYT99 MOV  R0,R0
       RT
*
HFF
SCAN1  BYTE >FF,>1B,>31,>32     "12"
       BYTE >33,>34,>35,>36   "3456"
       BYTE >37,>38,>39,>30   "7890"
       BYTE >2D,>3D,>08,>89   "-="
*
       BYTE >51,>57,>45,>52   "qwer"
       BYTE >54,>59,>55,>49   "tyui"
       BYTE >4F,>50,>5B,>5D   "op[]"
       BYTE >0D,>FF,>41,>53     "as"  <CONTROL>
*
       BYTE >44,>46,>47,>48   "dfgh"
       BYTE >4A,>4B,>4C,>3B   "jkl;"
       BYTE >27,>60,>FF,>5C   "'` \"  <SHIFT1>
       BYTE >5A,>58,>43,>56   "zxcv"
*
       BYTE >42,>4E,>4D,>2C   "bnm,"
       BYTE >2E,>2F,>FF,>2A   "./ *"  <SHIFT2>
       BYTE >FF,>20,>FF,>12   " "     <ALT = FCTN> <CAP LOCK>   f1
       BYTE >05,>17,>10,>16   f2 f3 f4 f5
*
       BYTE >0C,>01,>06,>0F   f6 f7 f8 f9
       BYTE >BC,>FF,>FF,>FF           <NUMLOCK> <SCROLL LOCK>
       BYTE >0B,>0C,>2D,>08
       BYTE >FF,>09,>2B,>FF
*
       BYTE >0A,>02,>04,>03
*
RLAST  EQU  $
*

DODD

9640 News
P.O. Box 752465
Memphis, TN 38175

9640 News is proud to announce the availability of several JP Software titles via Mike Dodd.

At special reduced prices, they are:

HyperCopy

HyperCopy is the copy program of all programs. Runs directly out of MDOS, and if enough memory is available, it will store an entire DS/QD disk in memory for multiple copy outputs. A SS/SD disk can be copied in 15 seconds. $15.00 SS/SD

PC-Transfer and Utils

PC-Transfer is a program compatible with the Myarc and CorComp disk controllers permitting one to read/write/format both TI and IBM disks. The PC-Transfer utilities disk is included in this package allowing one to convert Multiplan files, ASCII files, and others between one computer and another. $25.00 SS/SD

PC-Transfer Utilities

PC-Transfer Utilities is a package of 4 programs that can be used inside of PC-Transfer to manipulate and move DIS/FIX 128 files, SYLK files (Multiplan), ASCII files, and files with the TIFILES header. A "must" set of utilities if you own PC-Transfer. $7.50 SS/SD

Identifile

Identifile is the first and only program available capable of cataloging a disk and telling you the user, what kind of files are there. Information as far as EA Utility, XB Program, Multiplan worksheet, Game file, etc are available. $10.00, SS/SD

All of these prices have been negotiated directly with Mike Dodd. Outstanding orders with JP Software can not be handled under my distribution agreement with Mike Dodd.

Beery Miller
11/5/91

TURBO-DOC

TURBO

BY Beery W. Miller

TURBO is a short, quick-hack program that greatly speeds VDP Access up on the Geneve 9640. It should ONLY be run on systems that do NOT have the GenMOD modification on their Geneve.

Turbo turns OFF VDP wait states that are normally on as set by the Gate Array. If you turn VDP wait states off with the GenMOD, the following results will happen. Your program may out-run the 9938 chip and distorted graphics will result. I have seen speed increases 2x to 4x in programs that deal with graphics. This program is only effective on MDOS side of the Geneve and should be run immediately before each and every program that you want sped up.

This program comes about as a result of Myarc's release of code to me.

Beery Miller

WIN-DOC

WIN-DRIVE

BY Beery W. Miller

This is the latest release of the Window's Driver V2.3 that supports GenBENCH SHELL.

Enjoy

Beery Miller

TASMDOC


============================================================================ TASM - TI-99/4A and 9640 GENEVE ASSEMBLER 05-MAY-91 ============================================================================ Copyright 1991 by LGMA Products User Manual v3.4 Index 1. Introduction 2. Running TASM 2.1 Examples 2.2 Errors 2.3 Instruction Set 2.4 Operand Addressing Modes 2.5 Upper and Lower Case 2.6 Labels 2.7 Comments 2.8 Expressions 2.9 Psuedo-Instructions 3. Macros 3.1 Macro Definition 3.2 Macro Body 3.3 Macro Formal Parameters 3.4 Local Labels 3.5 Protected Values 3.6 Invoking a Macro 3.7 LIST Directive 4. Sysgen Limits 5. Include (COPY) files 6. Known Bugs, Deficiencies, Differences =========================================================================== 1. Introduction TASM is an Assembler for the TMS99xx series of TI processors that runs on several machines, including: 9640 Geneve IBM PC or Compatible AMIGA Actually, since TASM is written entirely in C, it can be ported to any machine supporting a good C compiler. In the Geneve version, TASM is generated using the TIC C Compiler. TASM will take an input source file that contains Assembly source statements, and create from that file an Object File and a Listing File, i.e.: Source File ------+------> Object File DV80 | DF80 _X or .X _S or .S | +------> Listing File DV132 _P or .P The listing file can be printed; the object file is compatible with the standard loaders available for the TI-99/4A and Geneve. Features of TASM are quite extensive, including: o Two-Pass Assembler o Extensive Symbol Table Size (1000 Symbols on Geneve) o Conditional Assemblies o MACRO Facility o Support for TMS9900, TMS9995, & TMS99000 Instruction sets o Versions available for several different machines o Extensive error checking o Fast hash table storage of symbols o Supports special "link chains" for GENEVE paging TASM has its roots in a99, a cross-assembler originally developed at the University of Arizona by Dr. Bruce Wampler. This assembler was converted to the present TI-99/4A cross-assembler by Alan Beard (LGMA Products) and Ron Lepine (Moderator of the TI Conference on Byte Information Exchange). TASM was recoded to operate specifically with TIC, the Full-C compiler for the Geneve and TI-99/4A; the resulting program is TASM, this assembler. TASM gets around several problems with using other assemblers with TIC, including: o Runs in MDOS Native Mode (not GPL mode) o Two-Pass, so backward REF chains are allowed o Special Geneve Paging chains supported (-X Option) o Supports 31-character external names o MACRO capability o Extensions TASM does NOT support the debug code generation mode of GenASM. Also, because TASM is a two-pass assembler (GenASM is one-pass) and because it is written in C, it is slower than GenASM. TASM is copyrighted by LGMA Products, you may freely use this program for non-commercial applications. You may not distribute TASM on any medium without the express permission of LGMA Products. ============================================================================= 2. Running TASM Regardless of what machine environment you are using, TASM is always started in the same manner: TASM [+/-options] sourcefile A source file on the GENEVE is a normal Display/Variable 80 file. Under MSDOS and Amiga, it is a normal TEXT type of file. The source file must have an extension of: MYARC GENEVE: _S MSDOS, AMIGA: .S or .s TASM optionally produces as output the following files: Object File: _X, .X, or .x Listing File: _P, .P, or .p TASM allows you to specify parameters that allows options to be turned ON and OFF for the subsequent assemblies. These options are specified with a + to turn ON the option, a - to turn OFF the option. The options are: O - generate object file _X or .X (default = yes) L - generate listing file _L or .L (default = no ) R - use register definitions (e.g. R1 instead of 1) (default = yes) C - generate compressed object (default = yes) G - allow TMS9995 instructions (default = yes) M - generate long name (>6 characters) references (default = yes) X - generate special GENEVE X-REF chains (default = no) H - allow TMS99105A & TMS99110A extensions (default = no) 2.1 Examples For example, to assemble a source file, called A99P1_S, you could type: TASM A99P1_S This will create the file: A99P1_X and will NOT create a listing file, will assemble using register definitions, TMS9995 instruction set, long name references, no special REF chains, and no TMS99XXX instructions. This is equivalent to: TASM -LXH +ORCG A99P1_S TASM is a two pass assembler. At the end of the first pass, it displays the value of the last memory location used. It displays the number of errors detected at the end of the second pass. 2.2 Errors TASM will detect most syntax errors. Offending lines are displayed on the terminal screen, followed by the error message. In addition, the offending lines are marked in the '.P' listing file (if generated). 2.3 Instruction set TASM supports the complete instruction set as described in the TI-99/4A Editor/Assembler User's Guide. If the +G parameter is chosen (default=yes), then four additional opcodes are recognized for the TMS9995 microprocessor, as follows: MPYS - Signed Multiply DIVS - Signed Divide LST - Load Status Register LWP - Load Workspace Pointer If the +H parameter is chosen, then 24 new opcodes for the TMS99105A/ TMS99110A processors, as well as the four additional TMS9995 instructions are recognized: BIND - Branch Auto-Increment BLSK - Branch and Link through Stack TMB - Test Memory Bit TCMB - Test and Clear Memory Bit TSMB - Test and Set Memory Bit AM - Add Double SM - Subtract Double SLAM - Shift Left Arithmetic Double SRAM - Shift Right Arithmetic Double LDS - Long Distance Source LDD - Long Distance Destination AR - Add Real SR - Subtract Real MR - Multiply Real DR - Divide Real LR - Load Real STR - Store Real CIR - Convert Integer to Real CRI - Convert Real to Int NEGR - Negate Real CRE - Convert Real to Ext Int CER - Convert Ext Int to Real CR - Compare Reals MM - Multiply Multiple Refer to the TI TMS9995 Data Manual, and the TMS99105A/TMS99110A manuals for a description of the new instructions.. 2.4 Operand Addressing Modes TASM supports all TI-990 addressing modes. The symbols R0-R15 are predefined for registers (if the -R option was not chosen). Any symbols used as operands may use the rules for labels described below. In addition, expressions as described below may also be used. For example, "CLR @VAR+4" is a legal operation which refers to the contents of the 2nd word following the label VAR. (VAR+0 is the word at VAR, VAR+2 is the 1st word, VAR+4 the 2nd following word.) 2.5 Upper and Lower Case TASM is totally case insensitive. Thus `ABC' is treated as being identical to `abc'. This is true for opcodes, operands, and labels. 2.6 Labels TASM allows labels to be up to 128 characters long. Labels can begin with any character except: 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, >, @, (, ), *, ;, -, ', ", comma, space,tab, or :. Following characters may use 0 to 9 and in addition. Labels are defined by appearing in the label field, which is a symbol beginning in column 1. Labels are terminated by a space or tab, as well as a colon. If a label is followed by a colon, it need not begin in column 1, but must be the first symbol on the line. The following are valid labels: SHORT: A_LABEL_WITH_UNDERSCORE TEMP$ 2.7 Comments Comment lines are indicated by the first character in the line being a semi-colon or an asterick. Comments may be included on the same line as an instruction by preceding them by a blank or a semi-colon. There are certain cases were you must precede the comment with a semi- colon. In particular, if the first character of your comment beings with a comma (,) or colon (:), then it must be preceded by a semi-colon. 2.8 Expressions More general expressions are allowed in TASM. The operations +, -, *, /, | (logical or), and & (logical and) are supported. Expressions may not use parens, and are evaluated strictly left to right. (* does not have precedence over +, for example.) In general, expressions may use any symbol defined anywhere in the program, as well as constants. Hex constants begin with >. Restrictions: the current version of TASM does not allow spaces between expression symbols and operators. Symbols used in an expression in an "EQU" directive must not be forward references. 2.9 Psuedo-Instructions AORG <address> ============== The AORG statement works exactly the same as in the 99/4 assembler. If AORG is omitted, the assembly is assumed to be relocatable as if the statement RORG 0 preceded any object code generation. RORG <address> ============== The RORG statement works exactly the same as in the 99/4 assembler. If RORG is omitted, TASM defaults to a starting relocatable address of >0000. You should not mix AORG mode with RORG mode. BSS <blocksize> =============== This reserves a block of of memory of <blocksize> bytes. If <blocksize> is odd, it will NOT be rounded up to an even size. DATA <valuelist> ================ This reserves a word of storage for each item in the list. Items are separated by commas. Unlike the UNIBUG assembler, you may have several values following the DATA statement, each taking one word of memory. END <label> =========== Denotes the end of the program. Every program must have an END statement. The <label> field is optional, and if specified, generates an object tag '1' for absolute entry point, or an object tag '2' for relative entry point, and denotes the entry point into the program for the loader. <label> EQU <value> =================== This directive will give <value> to the symbol <label>. The value may be any expression, but must not use any symbols defined after the EQU statement (a forward reference is not allowed, in other words). It is possible, however, to use the <label> of the EQU anywhere in the program. TEXT /string/ ================ This reserves storage for the given string. The string is delimeted by two matching characters, e.g.: "string" or /string/ or 'string' If double single quotes are included in the string, they will be interpreted as a single quote, i.e.: 'don''t do it' BYTE <valuelist> ================ This reserves a byte of storage for each item in the list. Items are separated by commas. Note it is possible to leave the location counter odd with this statement (as with the TEXT directive). This allows you to freely mix TEXT and BYTE expressions. DORG <address> ============== The DORG statement works exactly the same as in the 99/4 assembler. It differs from AORG in that object code generation is suppressed. DXOP <symbol>,<term> ==================== The DXOP statement allows you to define an XOP; exactly the same as defined in the 99/4 assembler, page 233 of E/A manual. The DXOP actually defines internally a MACRO, the following two code segments are similar: SYSC MACRO XOP %1,0 ENDM ...and... DXOP SYSC,0 You can then use the defined XOP in following statements, i.e.: SYSC @VID VID DATA 6 DEF <label>[,<label> ... [,<label>] =================================== Provides an external definition. Most useful to indicate an entry point into the program for the load and run option. Multiple labels are allowed per one DEF statement. Each label must be sepereated by a comma, and the DEF list must be terminated by a blank or tab. IDT <ident> =========== An up to six character program identifier can be provided. Merely includes it in the object file. PAGE ==== Causes a page eject on the listing file. TITL <up-to-50-character-title> =============================== An up to 50 character title line can be included within quotes. This line will be put at the top of each listing page. REF <label>[,<label>] ... [,<label>] ==================================== Provides an external reference. The <label> field must be specified in another program using the DEF statement. Multiple labels are allowed per one REF statement. Each label must be sepereated by a comma, and the REF list must be terminated by a blank or tab. RT == The RT psuedo instruction provides a convenient means of executing a standard TI return from subroutine. It actually generates the same code as the instruction: B *R11 COPY ==== The COPY psuedo instruction provides a means for including source files with the compilation. This is useful say, to create a small module which "INCLUDES" or "COPIES" other modules in its address space. It is also useful to COPY in common equate files (e.g. what was created for the MYARC GENEVE). The SYNTAX of the command is: COPY "<filename>" where <filename> is the DOS full file name (not the TI-99 file name). For example, on the Amiga, an equates file called "vid.eq9" exists in directory "df2:equates/", so the COPY directive would be: COPY "df2:equates/vid.eq9" A COPY'd file may not contain another COPY command, or an error will result. IFxx <expression> / ELSE / ENDIF ================================ The IFxx/ELSE/ENDIF statements allow you to create modules with conditionally assembled code. The <expression> is evaluated, and if the expression is non-zero, then the following code is assembled. If the expression is zero, then the following code is not assembled, until an ELSE or ENDIF statement is encountered. This is especially useful in writing code for two different machines or operating systems. Only one source module need be maintained, and the proper code for each operating system can be generated by merely setting an equate in the program or in an equate file. For example, to generate code for MDOS or GPL, one could create a flag set to one or zero, e.g.: MDOS EQU 0 ; MDOS=1, GPL=0 and then generate two sets of code, i.e.: IFEQ MDOS XOP @DKEYOP,0 ; In MDOS, call keyboard XOP ELSE BLWP @KSCAN ; In GPL, call keyboard scan ENDIF Note that if the MDOS flag is set to non-zero, then the XOP code will be generated, else the KSCAN routine will be called. The ELSE condition is optional, however the ENDIF statement must be present. The following conditionals, when TRUE, will cause any following code to be assembled up to any following ELSE or ENDIF statement: IF - if expression NOT 0 IFEQ - if expression 0 IFNE - if expression not 0 (same as IF) IFLT - if expression less than 0 IFLE - if expression less than or equal to 0 IFGT - if expression greater than 0 IFGE - if expression greater than or equal to 0 ============================================================================ 3. Macros A macro is a facility for text replacement. A single line of source assembly code that uses a macro will be replaced by possibly many lines of assembly code defined in the body of the macro definition. Thus, to use a macro, it must first be defined, then "called" from within the assembly language program. While a macro may be considered to be somewhat like a subroutine, there is a major difference. When a subroutine is called, the PC changes value, and the program begins executing code in a different place in memory. When a macro is called, the code from the macro body is actually substituted at the place of the call. This substitution process is called expanding the macro. Macros may have parameters that can be substituted within the body when the macro is expanded. Figure 1 illustrates a macro definition and call: SOURCE CODE EXPANDED CODE AORG >300 AORG >300 JLSEQ MACRO ; "Jump <=" JLT %1 ; %1 is param JEQ %1 ENDM ; end ; ; C R1,R2 ; compare C R1,R2 JLSEQ LBL1 ; jmp <= JLT LBL1 [expansion] JEQ LBL1 A R1,R2 A R1,R2 LBL1 ... LBL1 ... Figure 1. A Macro Example This macro allows a jump on arithmetic less than or equal using one line of assembly source code. It is expanded at assembly time to two actual instructions, JLT and JEQ, using the parameter provided in the call: LBL1. The macro definition starts with the directive MACRO and ends with the directive ENDM. Parameters in the definition are denoted with a %, and provided in the call just like an ordinary operand. 3.1 Macro Definition A macro is defined with an initial line of the form: MACRONAME MACRO. The macro name may be any standard label, and must be present with the MACRO directive. When assembling, the macro definition table is checked last. Thus, it is not legal to define a macro with the same name as a valid instruction such as MOV or INC since TASM will match the regular MOV instruction first and never get to the macro definition table. 3.2 Macro body The body of a macro consists of any number of legal TI assembly language instructions. There must not be calls to other macros within the body of a macro definition. Nested macros are not allowed. The macro is ended with the ENDM directive. Macros definitions appear in the .P file with dashes in place of the usual address/value fields. 3.3 Macro Formal Parameters Any macro definition may use up to 9 parameters. Parameters are implicitly defined, and can appear in the body of the macro definition as the symbols %1 to %9. Any given parameter may be used as often as needed within the macro body. Parameters will be expanded whenever they are found within the macro body, regardless of the context. Thus, you may not use an unprotected % in a macro body (See Protected values, below). Parameters must be used in order from %1 to %9. 3.4 Local Labels It is sometimes necessary to use labels within a macro definition. If a standard label were used, it would result in a multiple definition of a label error whenever the macro was called more than once. TASM allows local labels to be defined within the body of a macro that will be expanded to unique labels whenever the macro is called. Local labels have the form ?x. The ? denotes a local label, and the x is any letter from a to z that the programmer chooses. Thus, any one macro may have up to 26 local labels. Labels may be re-used in different macro definitions - ?a can be used in more than one macro definition. When local labels are expanded, the ?x portion remains constant, and two additional letters are automatically appended to generate a unique label of the form ?xyz. Each time any macro is called, the label generator produces a new label, whether labels are used or not. Thus, the very first macro call will have generated labels of the form ?xaa, the second macro call ?xab, and so on. Thus up to 676 macro calls may appear in any one program -- far more than will ever be needed for this class. The ? is a special character, just like the % and may require protection. 3.5 Protected Values Sometimes you may want to protect portions of the macro body. For example, you may have a string with a ? or % within the macro body definition. If such values are left as is, they would be confused with parameters or local labels. Square brackets ([ and ]) may be used to protect any portion of a macro body. Thus a string text[?] would be expanded to text? with no label expansion of the ?. 3.6 Invoking a Macro A macro is invoked by using the macro name followed by any parameters. A macro call will look just like a regular instruction in the source code, and may be followed by up to 9 operands. The operands in the order given are then substituted for the formal parameters %1 to %9 in the macro body as the macro is expanded. 3.7 LIST Directive The LIST assembler directive is used to control the listing of generated code for macro calls and TEXT directives. These directives affect only the .P file, and in no way change the code generated in the .x object code file. LIST TEXT LIST NOTEXT ; default The TEXT and NOTEXT options control how generated code for TEXT directives is listed in the .P file. With NOTEXT, the default, the starting address of the string is given, along with the number of bytes the string takes in the value field. Using the LIST TEXT option has TASM list the address and value of each word of data generated by the TEXT directive in the .P file. The NOTEXT option makes the .P file much smaller. LIST MOBJECT LIST MNEVER LIST MONCE ; default LIST MALWAYS These LIST options control the .P expansion of macro calls. The MOBJECT option is the defaulted option and causes the MACRO not to be expaned in the listing, only the original source line and the resultant object are listed. The MNEVER option forces TASM to never list the expanded code produced by a macro call. The default MONCE option will have TASM list the full expansion of a macro the first time it is called. Subsequent calls to the same macro will not be expanded in the listing. The MALWAYS option will have TASM show the full macro expansion every time a macro is called. This option is most useful for debugging to make sure the parameter expansion and label generation works as expected. Comments present in the original macro definition will be removed from the expanded code. Expanded code is also formatted on tab stops. This automatic provision means that strings may have some spaces replaced with tab stops. This can be avoided by being sure string defined with TEXT directives inside the macro body use double quotation marks: "STRING". Other forms of the LIST statement: LIST LIST "file_name" These directives serve two distinct purposes. The LIST statement with no arguments restores output to the listing file which had been previously disabled using the UNL (unlist) command. The list statement with a file name enclosed in double quotation marks will cause the listed output to be redirected from the file specified on the -l command line switch to the file_name specified. =========================================================================== 4.0 Sysgen Limits The TASM assembler has certain limitations that are changed only during sysgen of the TASM program. These limits are currently set to: MSDOS/Amiga Geneve Symbol Table Space 12000 BYTES 10000 BYTES Maximum # of Symbols 2000 1000 Maximum # of Macros 80 25 Maximum Chars in a Macro 250 BYTES 250 BYTES 5.0 Include (COPY) Files Include files or COPY files are used extensively in most modern operating systems to provide the user with a symbolic way of interfacing to other programs or operating system calls. The MYARC DOS package provides a very structured method of interfacing to system services, the XOP interface. COPY files are provided to give the user a symbolic mechinism of using the XOP interface. For example, the following assembly statements within a program set the video mode to graphics mode 6: COPY "HDS1.INCLUDE.VIDEO_I" LI R0,SETVID LI R1,GRAPH6 XOP @DVIDXP,0 DVIDXP DATA VIDXOP This provides readable source. The following source is equivalent to the previous code, but does not use symbols and therefore is not very readable: LI R0,0 LI R1,8 XOP @SIX,0 SIX DATA 6 The TASM package includes a number of COPY files that provide definition of the Geneve XOP Libraries. For a definition of what these libraries are and how they work, the most definitive document is contained within Paul Charlton's GenASM program. The 9640 Windows library is described in Beery Miller's 9640 Windows user manual. The video library is currently only defined as postings on various BBS's, and has non-working sections. The header files provided are: keyboard_i : Keyboard Library video_i : Video Library memory_i : Memory Library io_i : Input/Output Library utility_i : Utility Library math_i : Math Library windows_i : 9640 Windows Library These files can be used by placing the files in an "INCLUDE" directory. For example, suppose you place all six files in the "HDS1.INCLUDE" directory on your hard disk. You can then utilize the header files you need by placing the statement: COPY "HDS1.INCLUDE.FILENAME_I" in your Assembly program. The following example program sets the video mode to text mode (40 column mode) and writes a string of text to it: COPY "HDS1.INCLUDE.VIDEO_I" DEF START START EQU $ LI R0,SETVID LI R1,TEXT1 XOP @DVIDXP,0 * LI R0,WRITET LI R1,STRING XOP @DVIDXP,0 * BLWP @0 ; EXIT * STRING TEXT 'Set Video Mode to 40 Columns' BYTE >0D,>0A,>00 EVEN DVIDXP DATA VIDXOP END 6. Known Bugs/Deficiencies/Differences a. The following code acts differently if assembled under TIC rather than the standard TI assembler: RORG 0 ADDRS EQU 4 NEWADR EQU $+ADDRS The symbol "NEWADR" is calculated as an absolute symbol. In the TI assembler, it is treated as a relative symbol. b. Under unknown circumstances, occasionally the disk directory that is being used for assemblies will "wipe-out", and be not accessable to later disk operations (a DEVICE ERROR results). I wonder if this is related to MDOS hard disk wipeouts in general. ==========end of document===========