Hyperlist Now Available
The PowerBASIC compiler is now available for the Atari Portfolio. Priced at $99.95, if s a must for Portfolio-Specific development
Portfolio Chess, offering ten levels of play from Novice to Master, is now available for $49.95.
Instant Speller lets you perform spelling checks on your Portfolio files. Now available at $39.95.
Hyperlist lets you organize any topic in any format you define, and is now available for $49.95.
To order, add $5.00 to the purchase price for shipping and handling. Residents of California, Illinois, and Texas please add 8.25% sales tax.
Send orders to:
Atari Computer Portfolio Marketing Dept. 11% Borregas Ave Sunnyvale, CA 94089-1302
Mike Fulton
Q: What GEM VDI support is there j for the greyscale video mode of the !
TT030? j i
A: The EsetgreyO function which j puts the TT video into greyscale j mode is only supported at the ! XBIOS and hardware level. VDI functions for setting and requesting color palette settings will not function correctly when the i
EsetgreyO mode is in effect |
Q: I'm trying to use some of the new FSMGDOS VDI calls, but I'm not getting the results that I expect
A: One thing thafs very important about using the new FSMGDOS functions is making sure that the active font is indeed an FSMGDOS Outline rather than a bitmapped font. The new FSMGDOS calls work only with the outline fonts.
One of the most common errors I've seen so far is using the vst_aibpt() function to set the text size. If the active font is a bitmapped font, then this function will have no effect whatsoever. You may think you've set 72pt text, but the VDI may still be set to 12pt
Q: How can I detect if FSMGDOS is running, and if a font is an FSMGDOS outline font instead of a bitmapped font?
A: If you place a -2 into register dO and then do a TRAP #2 call, the return value in dO will be 0x5F46534D ("_FSM") if FSMGDOS is active. If FontGDOS is active, the return value in dO will be 0x5F464E54 ("_FNT").
Note that some languages provide a vq_gdos() function which is used to detect GDOS. These functions may not return the correct values for FSMGDOS and FontGDOS. They may detect that some version of GDOS is available, but not which particular one. The values returned by these functions may not be equal j to those values shown above. i i
If you determine that FSMGDOS is |
not active, you should not make any j calls that require FSMGDOS. Note j that the bezier curve functions are [
available with either FSMGDOS or j
FontGDOS. I
Once the program has determined i that FSMGDOS is active, then it j activates a particular font, it should determine if that font is an FSMGDOS outline font or a bitmapped font.
When you do a vqt_name() call with FSMGDOS active, the intout[32] value will contain a 1 if the font is an FSMGDOS outline font, or a 0 if it is a bitmapped font. Whatever your program uses to set the current font can make this call and save the flag value to indicate to the rest of the program if it should make FSMGDOS calls or not
Q: I'd like to write a program that plays a different digitized sound everytime something happens an alert box being put up on screen, or a window opening or closing, or a different sound each time a different key is pressed. How do I hook into the system so I can do this and know what's what?
A: First of all, such a program should only be done as a combination of a TSR AUTO-folder program that does the actual work of playing the sounds, and a desk accessory or XCONTROL panel module (or both) which configures the TSR as to which sound to play for which event, and whatever other user-defined settings there might be.
The TSR would grab the Trap #2 vector, which is used to call all GEM VDI and AES functions. The original vector would be saved to be used as the exit point of the TSR's trap handler. (Please note that programs which steal the Trap #2
vector should be placed in the AUTO folder after FSMGDOS.)
The TSR's trap handler would look in register dO for the AES magic number $C8 (decimal 200). If that value is found, register dl contains a pointer to the AES parameter block. The trap handler would then obtain the AES function opcode through the following method:
move.1 dl,aO ; Get AESPB Ptr move.1 (aO),a0 ; Get CONTROL Ptr move.w 0(a0),d2 ; Get CONTROL(0)
At this point, register d2 would now contain the AES function opcode, and that value would be used to decide what sound to play, if any. After starting the sound, then the trap handler would pass control to the original trap handler so that the AES could execute the requested function.
The above method will not provide any info about keypresses. As of TOS 1.06, there is a new OS vector called kcl_hook at location 0x05B0. If you put the address of your own function into this vector, it will get called each time a key is pressed, and the low byte of register dO will contain the keyboard scancode (but not the ASCII code) of the key. The remainder of dO will contain garbage, so be sure to mask it off.
The ASCII value of a key may be different depending on the language version of TOS, so if your function needs to worry about ASCII values, it may wish to use the keyboard lookup table information available through the KeytblO XBIOS function. (Do this at program initialization, not in the interrupt function.) Note, however, that there is no table for ASCII values generated in conjunction with the Alternate key, and some language versions of TOS use this key to generate certain ASCII values. Your function would have to handle such keystrokes as a special case.
continued on page 8
PowerBASICLibrary for Portfolio Only Programming copyright © 1992 by BJ Gleason
PowerBASIC, the BASIC compiler for the Portfolio, is a veiv nice product, limited by support for "Portfolio Only" features. This collection of routines is designed to support built-in features, such as Menus, Screen Saving, Boxes, etc., and also includes support for PGC and PGF graphics.
Here is the complete list of functions provided:
box Display a Box cmode Set Cursor Mode errwin Display an Error Window
FNcoodeX Get Cursor Mode
FNdsizeX Return Size of RAM Disk (C:)
FNlssizeX Get Logical Screen Size
FNmenuX Create/Display/Return Menu Item
FNpssizeX Get Physical Screen Size
FNslgnedX Convert a Real to an Integer
FNsnodeX Return Screen Mode
FNspeedX Get the CPU Speed
FNvsposX Get Virtual Screen Position init Initialize Portfolio Services mesnrin Display a Message Window noise Make Noise (Key Click, Beep, Alarm)
off Turn the Portfolio Off pgcl Load a PGC file to Video Memory pgcs Save Video Memory as a PGC file pgfl Load a PGF file to Video Memory pgfs Save Video Memory as a PGF file rfsh Refresh the Screen savres Save and Restore areas of the screen smode Set Screen Mode speed Set the CPU Speed vmove Move Virtual Screen Position vspos Set Virtual Screen Position
Since PowerBASIC does not support libraries, the code for these routines will have to be appended onto your source code. Most of these routine are independent of each other, so you need only include those you are using in the program in order to keep the program as small as possible. The only routine that is called by others is the FNsigned% function, which is used to create an integer from a real number. However, if you leave it out when a routines needs it, PowerBASIC will generate an error message.
The only routines that need additional explanation are the PGC/PGF routines. The routines to load them only copy them to video memory, but does not display them. You would have to call RFSH after PGFL or PGCL. The reason for this is to allow one image to "replace" another on the screen. The load and save routines also expect the screen to be in graphics mode (SCREEN 1) before you call.
Here is an example program showing the calling sequence for PGCL:
1 input "Enter Filename";f$
screen 1
screen 0
goto 1
The PowerBASIC compiler was designed to run on the Portfolio, but it will also run on a PC Since PowerBASIC does not have built in editor, an editor has been developed to allow for quick and easy program development on your desktop.
The PowerBASIC Editor 1.0 (POWED.ZIP) is a full screen text editor, very similar to that of Turbo Pascal 3.0. But it has a couple of built in additions. By
Pressing ALT-C, you can save your file and invoke the owerBASIC compiler. While you can compile the file, you can not run it. While this might not appear to be much of a benefit, you do get the advantage of an 80x25 screen, and the editor will automatically point to the line that the compile error appears on.
To use POWED, you need to copy PB.RUN from the PowerBASIC ROM card to your PC and rename it PB.COM. Invoke POWED with the name of the file, and then press ALT-C to compile. When the compile is complete, you will have a .COM file that can be copied to the Portfolio. To speed things up, the <F7> key will invoke FT.COM and send over the file that you just compiled.
Finally, here is the complete list of the library routines. Please feel free to include these in your programs. If you implement any of the other functions, please send them to me, and I will include them in future releases.
All the programs mentioned, and the library routines are available for downloading on Compuserve, in the APORTFOLIO forum.
def fnsignedX(unsigned!) if unsigned! > 32767 then fnsignedX - unsigned! - 65536 else fnsignedX * unsigned! end if end def sub rfsh shared
' copy video memory to LCD screen reg 1, 4608 call interrupt 97 end sub sub pgfl (f$) shared ' copy .PGF file to video memory def seg - 4S0S6 pg$-""
for iX- 0 to 1919
poke iX,asc(nridS(pgS,iX+l,l))
next end sub sub pgfs (fS) shared ' save video memory to .PGF file def seg - 45056 pg$=""
pg$ - pg$ + chrSCpeek(iX)) next iX open "b",l,fS putS 1, pgS close 1 end sub sub pgcl (fS) shared
' copy .PGC file to video memory def seg - 45056 offsX - 0 cS-""
close 1
do cntX - asc (mi d$(pg$, f p%, 1) ) fpX - fpX + 1 if cntX > 128 then cntX - cntX - 128 cX - asc(mid$(pg$,fpX,l)) fpX - fpX + 1 for iX - 1 to cntX poke offsX, cX offsX - offs% + 1 next iX
else for 135-1 to cntX
cX-asc(roidJ(pgi, fpX, 1)) fpX - fp« + 1X poke offsX, cX offsX - offsX + 1 next i 9S end if loop until offsX > 1919 end sub sub pgcs (fj) shared
' copy video memory to .PGC file def seg - 45056 offsJS - 0 c$ - ""
pgS - "PC" * chr$(l) in$ - "" run* - 0 unique* - 0
do while ((peek(offsX+runX) - _ peek(offsX+runX+1)) and (runX < 126) _ and (offsX+runX < 1919)) run* - runX + 1
loop if (run* > 0) then if(uniqueX<>0) then pg$ ■ pgS + chrt(uniqueX) pgS - pg$ + in$ unique» - 0 in$ - "" end if pgf - pg$ + chr$(runX+129)
else in$ - in$ + chr$(peek(offsX)) uniqueX - uniqueX + 1 offsX - offsX + 1 end if loop while((uniqueX < 127) and (offsX < 1920)) if(uniqueXoO) then pg$ - pgS + chrS(uniqueX and 127) pgS - pg$ + in$ in$ - * uniqueX - 0 end if loop while(offsX < 1920) if(uniqueX) then pg$ => pg$ + chrl(uniqueX and 127) pg$ - pg$ + in$ end if open "b",l,f$ puts 1. pgS close 1 end sub sub box (xlX, ylX, x2X, y2X, btX) shared
' display a box on the screen.
reg 3,x2X * 256 + y2X reg 4,xlX * 256 + ylX reg 1,2304 + btX call interrupt 96 end sub sub savres (xlX, yl36, x25i, y2X, serX, bsX, boX) shared ' screen save/restore
' xl, yl : upper left corner, 0 based ' x2, y2 : lower right corner, 0 based ser : service ' 0 - Save characters only
' 1 - Save characters and Attributes
2 - Restore characters only ' 3 - Restore characters and Attributes
' bs : segment to buffer to save/restore screen ' bo : offset to buffer ss$ - string$(350,0) :' make sure there is enough room bsX - fnsi gnedX(st rseg(ssi)) ; boX - fnsignedX(strptr(ss$))
reg 2,0
reg 3,x2X * 256 + y2X reg 4,xlX * 256 + ylX reg S.boX reg 8,bsX reg 1,2048 + serX call interrupt 96 end sub sub meswin (xX, y%, msX, moX) shared
' display a box on the screen.
' ms : segment to message text
' mo : offset to message text
' Each line is terminated with a 0 ' text has to be terminated with 00
' First element is the title m$ - "Title" + chr$(0) + "Message" + chr$(0) + chr$(0) ' msX - fnsignedX(strseg(m$)) ' moX - fnsignedX(strptr(m$))
reg 2,0
reg 4,xX * 256 + yX reg S.moX reg 8,msX reg 1,4608 call Interrupt 96 end sub sub errwin (xX, y%, msX, moX) shared
' display a box on the screen. ' x, y : upper left corner, 0 based ' ms : segment to message text ' mo : offset to message text ' text has to be terminated with 00
ml - "Test" + chr$(0) + chrj(0) ' msX - fnsignedX(strseg(m$)) ' mdX - fnsignedX(strptr(mS))
reg 4,xX * 256 t yX reg S.moX reg 8,msX reg 1,5120 call interrupt 96 end sub def FNmenuX(xX, yX, topX, lasX, btX, msX, rooX)
' display a box on the screen. ' x, y : upper left corner, 0 based ' top : last top line ' las : last selected item ' bt : border (0 single, 1 double) ' ms : segment to menu text ' mo : offset to menu text ' Each element is terminated with a 0 text has to be terminated with 00 First element is the title m$-"Again?"+chr$(0)+"Yes"+chr$(0)+"No"+chr$(0)+chr$(0) msX - fnsignedX(strseg(m$)) moX - fnsignedX(strptr(m$))
returned value -1 - escape pressed int(mcX / 256) - top line mcX mod 256 - selected line reg 2,0
reg 4,xX * 256 + yX reg 3,topX * 256 + lasX reg S.moX reg 6,-1 reg 8,msX
reg 9,msX reg 1,3840 + btX call interrupt 96 FNmenuX - reg(l) end def sub init shared
' Portfolio Service Initialization ' Use once at beginning of program reg 1, 0
call interrupt 97 end sub def FNdsizeX
' get the size of the RAM Disk reg 1,2048 call interrupt 97 FNdsi zeX - reg(2) end def def FNsmodeX
' get screen mode ' returns
2 : 80 x 25 Tracked ' 128 : Graphics reg 1.3S84 call interrupt 97 FNsaodeX - reg(4) end def sub smode(ntt) shared
2 : 80 x 25 Tracked 128 : Graphics reg 1,3585 reg 4,nK
call interrupt 97 end sub def FNcmodeX
' get cursor mode ' returns
' 0 : cursor off ' 1 : Underline ; 2 : block reg 1,3840 call interrupt 97 FNcmodeX - reg(2) end def sub cmode(iriO shared
' 0 : cursor off ' 1 : Underline | 2 : block reg 1,3841 reg 2,mX
call interrupt 97 end sub def FNpssi zeX
' get physical screen size ' rows - int(result / 256) ' cols - result mod 256
reg 1,3328 call interrupt 97 FNpssizeX - reg(l) end def def FN1ssi zeX
' get logical screen size ' rows - int(result / 256) ' cols - result mod 256
reg 1,3328 call interrupt 97
FNIssizeX - reg (4) end def def FNvsposX
' get virtual screen position ' row - intCresult / 256) ' col - result mod 256
reg 1,4096 call interrupt 97 FNvsposX - reg(4) end def sub vspos(xX, ySO shared
' set virtual screen position ' x - row ' y - col reg 1,4097 reg 4,xX * 256 + yX call interrupt 97 end sub sub vmove(dirX, disX) shared
' move virtual screen position ' dir - direction ' 1 : up ' 2 : down 3 : left ' 4 : right
' dis - distance in characters reg 1,4352 + disX reg 4,dirX call interrupt 97 end sub sub noise(tyX) shared
' 2 : Alarm reg lj5376 + tyX call interrupt 97 end sub def FNspeedX
' get clock tick speed ' returns
0 : slow - 1 tick 128 seconds ' 1 : fast - 1 tick per second reg 1,7680 call interrupt 97 FNspeedX - reg(2) end def sub speed(mX) shared
0 : slow - 1 tick 128 seconds ' 1 : fast - 1 tick per second reg 1,7681 reg 2,m3i call interrupt 97 end sub sub off shared
' turn the portfolio off reg 1,11520 call interrupt 97 end sub
ABOUT THE AUTHOR
B.J. Gleason is an instructor of Computer Science at The American University in Washington D.C. and he's been programming for over a decade now. He's the author of over four dozen utilities and games, including PBASIC 4.9, the 'freeware' BASIC interpreter designed specifically for the Portfolio. His Email address is BfGLEAS@auvm.american.edu and his Compuserve ID is 75300,2517.
Atari Developer News
ATARI. RSC Staff
Post a comment