home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
No Fragments Archive 10: Diskmags
/
nf_archive_10.iso
/
MAGS
/
STFORMAT
/
STF04.MSA
/
2ND_SIDE_GFADEMOS_WINDOW1.LST
< prev
next >
Wrap
File List
|
1989-09-27
|
17KB
|
483 lines
' Window Demo --- GFA Systemtechnik 1986 ---
' Extensive work by John Tal/Michtron/1987
'
'
' Works in Color(med-rez) or Mono(hi-rez)
'
'
Dim Test$(78)
'
True=-1
False=0
'
' bios function call for screen resolution and returned values
Bios_rez=4
Mrez=1
Hrez=2
'
' screen size (to be used with Rez)
Scr_org_x=640
Scr_org_y=200
'
' get screen resolution from Xbios/Trap #14, opcode=Bios_rez=4
Rez=Xbios(Bios_rez)
'
' calc to allow this demo to function in med or Hi rez
Scr_max_y=Scr_org_y*Rez-1
Scr_max_x=Scr_org_x-1
'
' GEM opcodes
W_get=104
W_set=105
W_calc=108
'
' working margin on GFA basic screen at top
Top_margin=11*Rez
'
' vars for tracking window full state
Wfull=False
Old_fulx=0
Old_fuly=Top_margin
Old_fulw=Scr_max_x
Old_fulh=Scr_max_y-Top_margin
'
' window attributes(&HFFF=all active)
Wattribs=&HFFF
'
' event messages return values in Menu
Wclosed=22
Wfulled=23
Warrowed=24
Whslided=25
Wvslided=26
Wsized=27
Wmoved=28
Wguess=30
'
' vars to track sliders
Slid_horz_pos=1
Slid_vert_pos=1
Slid_horz_size=1
Slid_vert_size=1
'
' vars to track and calc text size
Char_cell_width=8
Char_cell_height=8*Rez
'
' position in string array for upper left corner of window
Txt_char=1
Txt_line=1
'
' window size in chars for text to display
Txt_wind_w=1
Txt_wind_h=1
Tot_txt_len=92
Tot_txt_lines=77
'
' create sample data to manupilate within window
Test$(1)=" For further information contact: "
Test$(2)=" Gordon Monnier "
Test$(3)=" President, MichTron Inc. "
Test$(4)=" "
Test$(5)="For Immediate Release: "
Test$(6)="GFA BASIC by GFA Systemtechnik "
Test$(7)=" MichTron is pleased to announce the release of GFA BASIC. GFA BASIC "
Test$(8)="was developed by our friends in Germany, GFA Systemtechnik. MichTron is "
Test$(9)="delighted that we can continue to bring you dynamic and useful programs "
Test$(10)="from both home and abroad. Besides this package from Germany, we are "
Test$(11)="currently releasing new programs from England, Scotland, and France. "
Test$(12)=" GFA BASIC is a high level language for the ATARI ST that is as easy to "
Test$(13)="program as BASIC yet offers full access to system features and an execution "
Test$(14)="speed that rivals assembly language. "
Test$(15)=" The concept behind the development of GFA BASIC was not to make "
Test$(16)="further minor improvements in BASICs programming language but to develop a "
Test$(17)="totally new form of BASIC which would meet the following criteria: "
Test$(18)="structured programming should be made possible in its entirety, everyone "
Test$(19)="who has programmed in BASIC should be able to use the new Interpreter in "
Test$(20)="the shortest time possible, and the advantages already present in BASIC "
Test$(21)="should be found in the newly developed BASIC. "
Test$(22)=" GFA BASIC offers the user a BASIC Interpreter which, apart from "
Test$(23)="entirely fulfilling the before mentioned conditions, also offers the user "
Test$(24)="other advantages. The GFA BASIC Interpreter is very compact; it uses only "
Test$(25)="55 KBytes of 'precious' memory on your ATARI ST. The Interpreter has an "
Test$(26)="extremely fast processing speed; it needs less than half a second to carry "
Test$(27)="out an empty FOR-NEXT loop 10,000 times. "
Test$(28)=" GFA BASIC also makes structured programming possible. In order to do "
Test$(29)="this, several additional structure commands were added to the list of BASIC "
Test$(30)="commands. For example: DO ... LOOP, WHILE ... WEND, REPEAT ... UNTIL, and "
Test$(31)="PROCEDURE (with local variables) were among those added. It was considered "
Test$(32)="necessary to limit the amount of commands to one per line to keep the "
Test$(33)="structure of the program simple. "
Test$(34)=" The functions which, GFA BASIC is capable of, can be differentiated by "
Test$(35)="two types: numerical and character string functions, depending upon "
Test$(36)="whether the result of the operation is a number or a character string. "
Test$(37)="There are two types of character string operators: those character strings "
Test$(38)="which are linked by the function + and the character string functions "
Test$(39)="LEFT$, RIGHT$, MID$, SPACE$, STRING$, and STR$. The numerical operators "
Test$(40)="can be divided into four categories: Arithmetic functions, Comparison "
Test$(41)="functions, Logical functions, and Numerical functions. "
Test$(42)=" When programming with GFA BASIC you will be using two screens which "
Test$(43)="can be used independently of one another. One is the Editor screen which "
Test$(44)="you will see on the command line at the top of the screen. The other is a "
Test$(45)="display screen which shows the results of the program commands which have "
Test$(46)="been entered. This excellent, full-screen editor includes word processor- "
Test$(47)="style features such as search and replace, block copy, move, delete, and "
Test$(48)="more. "
Test$(49)=" GFA BASIC is capable of incorporating the features found in GEM "
Test$(50)="including windows, drop-down menus, and alert boxes. Various menu commands "
Test$(51)="let you handle GEM drop-down menus with ease and efficiency. Four mouse "
Test$(52)="commands makes using the mouse a snap. Other key words allow for the easy "
Test$(53)="use of windows and alert boxes. "
Test$(54)=" GFA BASIC offers everything found in conventional BASICs plus much "
Test$(55)="more. GFA BASIC resembles Modula-2 or Pascal code with the ability to "
Test$(56)="accept parameters from the main program as well as using local variables. "
Test$(57)="Line numbers are eliminated in favor of meaningful labels, and subroutines "
Test$(58)="take the form of procedures which are called by name. Also, the various "
Test$(59)="menu commands lets you handle GEM drop-down menus with ease and efficiency. "
Test$(60)=" Two impressive features of GFA BASIC are the EXEC and C: commands. "
Test$(61)="EXEC allows you to load and execute a non-BASIC ST application from within "
Test$(62)="a BASIC program. The C: command calls a routine written and compiled in C. "
Test$(63)="Both commands purport to allow full parameter passing. GFA BASIC also "
Test$(64)="supports the unary * operator for C-style pointer operations. Together "
Test$(65)="these capabilities pave the way for an intriguing sort of program which "
Test$(66)="efficiently blends BASIC code with program modules written in other "
Test$(67)="languages. "
Test$(68)=" GFA BASIC sports an abundance of new graphic commands, along with "
Test$(69)="Unix-style DOS functions, and a host of additions to the keywords already "
Test$(70)="offered by ST BASIC. "
Test$(71)=" GFA BASIC not only demonstrates what BASIC can be on the ATARI ST but "
Test$(72)="it points the way to an entirely new sort of BASIC - one that's able to "
Test$(73)="reach beyond its own confines and incorporate routines from other "
Test$(74)="languages, actually stretching the definition of BASIC itself. "
Test$(75)=" GFA BASIC is available through MichTron at the low price of $79.95. "
Test$(76)="MichTron is the largest distributor of software for the Atari ST and is "
Test$(77)="proud to welcome GFA BASIC into its family of computer programs. "
Test$(78)=Space$(92)
'
' defined fill pattern & fill entire screen
' for color - 3=color=green, 2,8=pattern=solid
' for mono - 1=color=black, 2,4=pattern=med screen(dots)
'
If Rez=Mrez Then
Deffill 3,2,8
Else
Deffill 1,2,4
Endif
Pbox 0,0,Scr_max_x,Scr_max_y
'
' assign our vars to match(point to) Window paramater table
Attr=Windtab+2
Xpos=Windtab+4
Ypos=Windtab+6
Width=Windtab+8
Height=Windtab+10
'
' set up window with all attributes functioning
Dpoke Attr,Wattribs
'
' assign title for window 1
Titlew 1,"Window Demo"
'
' windows dimensions based on screen resolution
Wx=100
Wy=29*Rez
Ww=400
Wh=180*Rez
'
' ** set up handling for GEM messages **
On Menu Message Gosub Msg_event
'
' open and clear window 1
@Open_window(Wx,Wy,Ww,Wh)
'
' *** Main program loop ***
Do
' break out on GEM message
On Menu
Loop
' *************************
'
' ** handler for any message
'
Procedure Msg_event
' menu() array = event message buffer array +1
M=Menu(1)
If M=Wclosed
Alert 2,"End WindDemo| Program?",1,"Yes|No",A
If A=1
Closew 1
Edit
Endif
Endif
If M=Wfulled
@Setwindfull(Menu(5),Menu(6),Menu(7),Menu(8))
Endif
If M=Warrowed
On Menu(5)+1 Gosub Page_up,Page_dn,Row_up,Row_dn,Page_lt,Page_rt,Col_rt,Col_lt
Endif
If M=Whslided
@Sethslid(Menu(5))
Endif
If M=Wvslided
@Setvslid(Menu(5))
Endif
If M=Wsized
@Setwindsiz(Wx,Wy,Ww,Wh)
Endif
If M=Wmoved
@Setwindmov(Menu(5),Menu(6),Menu(7),Menu(8))
Endif
If M=Wguess
Print "Hurrah"
Endif
Return
'
' *** Routines to service Msg_event procedure ***
'
Procedure Setwindfull(X,Y,W,H)
' request to full window
Closew 1
' set Windowtable with new values/save current
Wfull=Not Wfull
Swap Old_fulx,X
Swap Old_fuly,Y
Swap Old_fulw,W
Swap Old_fulh,H
Wx=X
Wy=Y
Ww=W
Wh=H
@Open_window(X,Y,W,H)
Return
'
Procedure Page_up
Txt_line=Max(1,Txt_line-Txt_wind_h)
' Clearw 1
@Calc_vert_pos
@Setwindvslid(Slid_vert_pos)
@Draw_window
Return
'
Procedure Page_dn
Txt_line=Min(Txt_line+Txt_wind_h,Tot_txt_lines-Txt_wind_h+1)
' Clearw 1
@Calc_vert_pos
@Setwindvslid(Slid_vert_pos)
@Draw_window
Return
'
Procedure Row_up
If Txt_line>1 Then
Dec Txt_line
' Clearw 1
@Calc_vert_pos
@Setwindvslid(Slid_vert_pos)
@Draw_window
Endif
Return
'
Procedure Row_dn
If Txt_line+Txt_wind_h<=Tot_txt_lines Then
Inc Txt_line
' Clearw 1
@Calc_vert_pos
@Setwindvslid(Slid_vert_pos)
@Draw_window
Endif
Return
'
Procedure Page_lt
Txt_char=Max(1,Txt_char-Txt_wind_w)
' Clearw 1
@Calc_horz_pos
@Setwindhslid(Slid_horz_pos)
@Draw_window
Return
'
Procedure Page_rt
Txt_char=Min(Txt_char+Txt_wind_w,Tot_txt_len-Txt_wind_w+1)
' Clearw 1
@Calc_horz_pos
@Setwindhslid(Slid_horz_pos)
@Draw_window
Return
'
Procedure Col_lt
If Txt_char+Txt_wind_w<=Tot_txt_len Then
Inc Txt_char
' Clearw 1
@Calc_horz_pos
@Setwindhslid(Slid_horz_pos)
@Draw_window
Endif
Return
'
Procedure Col_rt
If Txt_char>1 Then
Dec Txt_char
' Clearw 1
@Calc_horz_pos
@Setwindhslid(Slid_horz_pos)
@Draw_window
Endif
Return
'
Procedure Sethslid(Mark)
' set pos of horz slider, service routine for user moving slider directly
' must adjust starting horz text pos to match 0..1000 slider range
' Clearw 1
I1=Tot_txt_len-Txt_wind_w+1
Txt_char=Trunc(Mark/1000*I1+0.5)
Dpoke Gintin,Dpeek(Windtab)
Dpoke Gintin+2,8
Dpoke Gintin+4,Mark
Gemsys W_set
@Draw_window
Return
'
Procedure Setvslid(Mark)
' set pos of vert slider, service routine for user moving slider directly
' must adjust starting vert text pos to match 0..1000 slider range
' Clearw 1
I1=Tot_txt_lines-Txt_wind_h+1
Txt_line=Max(1,Trunc(Mark/1000*I1+0.5))
Dpoke Gintin,Dpeek(Windtab)
Dpoke Gintin+2,9
Dpoke Gintin+4,Mark
Gemsys W_set
@Draw_window
Return
'
Procedure Setwindsiz(X,Y,W,H)
' handles sized and fulled windows
Closew 1
X=Menu(5)
Y=Menu(6)
W=Menu(7)
H=Menu(8)
If Wfull Then
Old_fulx=Wx
Old_fuly=Wy
Old_fulw=Ww
Old_fulh=Wh
Wx=X
Wy=Y
Ww=W
Wh=H
Wfull=False
Endif
@Open_window(X,Y,W,H)
Return
'
Procedure Setwindmov(X,Y,W,H)
' window has been moved, set Windowtable with new values
Closew 1
@Open_window(X,Y,W,H)
Return
'
' *** open window ***
'
Procedure Open_window(X,Y,W,H)
' main open service routine for procedures in this program
Dpoke Xpos,X
Dpoke Ypos,Y
' force window to open on multiple of character cell size
' to show complete text characters in window
' W=Char_cell_width*(W Div Char_cell_width)-3*Rez
' H=Char_cell_height*(H Div Char_cell_height)-1*Rez
Dpoke Width,W
Dpoke Height,H
'
Openw 1
Clearw 1
' get working co-ords of new window position
@Calc_txt_wind
' make sure that fulled/expanding window resets beginning txt_char/line if necessary
Txt_char=Min(Txt_char,Tot_txt_len-Trunc((Wtemp/Char_cell_width)+0.5)+1)
Txt_line=Min(Txt_line,Tot_txt_lines-Trunc((Htemp/Char_cell_height)+0.5)+1)
@Calc_horz_pos
@Calc_vert_pos
@Size_sliders(Xtemp,Ytemp,Wtemp,Htemp)
@Setwindhslid(Slid_horz_pos)
@Setwindvslid(Slid_vert_pos)
@Draw_window
Return
'
' *** Support routines for displaying text in window
'
Procedure Calc_txt_wind
' calc the size of the text window for Txt_wind_w & h
' also prepares _temp vars for window open
Dpoke Gintin,Dpeek(Windtab)
Dpoke Gintin+2,4
Gemsys W_get
Xtemp=Dpeek(Gintout+2)
Ytemp=Dpeek(Gintout+4)
Wtemp=Dpeek(Gintout+6)
Htemp=Dpeek(Gintout+8)
Txt_wind_w=Wtemp Div Char_cell_width
Txt_wind_h=Htemp Div Char_cell_height
Return
'
Procedure Draw_window
' draw text within window
' calc avail size of window in chars and *Text* into window what we need
@Calc_txt_wind
For I1=0 To Txt_wind_h
Text 2,7*Rez+I1*Char_cell_height,0,Mid$(Test$(Txt_line+I1),Txt_char,Txt_wind_w)
Next I1
Return
'
' *** Slider support routines ***
'
Procedure Setwindhslid(Mark)
' set position of horz slider, service routine for horz page & arrow
Slid_horz_pos=Mark
Dpoke Gintin,Dpeek(Windtab)
Dpoke Gintin+2,8
Dpoke Gintin+4,Mark
Gemsys W_set
Return
'
Procedure Setwindvslid(Mark)
' set position of vert slider
Slid_vert_pos=Mark
Dpoke Gintin,Dpeek(Windtab)
Dpoke Gintin+2,9
Dpoke Gintin+4,Mark
Gemsys W_set
Return
'
Procedure Size_sliders(Xtemp,Ytemp,Wtemp,Htemp)
' set horizontal (bottom) slider size for this window
@Calc_horz(Wtemp)
Dpoke Gintin,Dpeek(Windtab)
Dpoke Gintin+2,15
Dpoke Gintin+4,Slid_horz_size
Gemsys W_set
' set vertical (side) slider size for window
@Calc_vert(Htemp)
Dpoke Gintin,Dpeek(Windtab)
Dpoke Gintin+2,16
Dpoke Gintin+4,Slid_vert_size
Gemsys W_set
Return
'
Procedure Calc_horz(Wtemp)
Slid_horz_size=Trunc((Wtemp/(Tot_txt_len*Char_cell_width))*1000+0.5)
Return
'
Procedure Calc_vert(Htemp)
Slid_vert_size=Trunc((Htemp/(Tot_txt_lines*Char_cell_height))*1000+0.5)
Return
'
Procedure Calc_horz_pos
Slid_horz_pos=Abs(Trunc(Txt_char/(Tot_txt_len-Txt_wind_w)*1000))-21
Return
'
Procedure Calc_vert_pos
Slid_vert_pos=Abs(Trunc(Txt_line/(Tot_txt_lines-Txt_wind_h)*1000))-21
Return
'
' --- End. ---