! MCDSBM - AlphaBASIC program to display a Bitmap file using AMIGOS
!
! NOTICE
!
!All rights reserved. This software is the property of Alpha Microsystems
!and the material contained herein is the proprietary property and trade
!secrets of Alpha Microsystems, embodying substantial creative efforts and
!confidential information, ideas and expressions, no part of which may be
!reproduced or transmitted in any form or by any means, electronic,
!mechanical, or otherwise, including photocopying or input into any
!information storage or retrieval system without the express written
!permission of Alpha Microsystems.
!
!CAUTION: Unauthorized distribution or reproduction of this material may
!subject you to legal action.
!
!Copyright (C) 1984, 1988 - Alpha Microsystems, An Unpublished Work
!
!Edit History:
!
![100] 13 July 1988 17:00 Edited by RJ Wilcox
! Created for simple demonstation of AMIGOS interface
! to AlphaBASIC
! [101] MFC 01/09/89 Changed to wait for mouse input after displaying
! image.
!
!Syntax: DSPBMP {outfile=} infile {altGDVname}
! where:
! outfile - optional output file to redirect graphics output to.
! If not specified, output will be directed to default
! output used by the GDV.
! infile - existing bitmap file (.BMP) used for input.
! altGDV - name of graphics device driver to user for output
! code generation. If not specified, the GDV with the
! same name as the user's TDV will be used.
!
PROGRAM MCDSBM,1.0(101)
++INCLUDE AMGSYM.BSI ! Get AMIGOS Definitions
MAP1 GCB,X,20000 ! Graphics control block for AMIGOS
MAP1 CMDLIN,S,100 ! variable used to parse command line
MAP1 T$,S,30 ! Token used in parsing
MAP1 TEXT$,S,80 ! TEXT FOR MOUSE CLICK. [101]
DSPGRF:
CALL PARSE'COMMAND ! parse the command line, open files
!Open the workstation with possible alternate GDV and output file
XCALL AMGSBR,G'OPWK,GCB,ALTGDV,STATUS,ALTCHN
IF STATUS<>0 THEN GOTO GRAPH'ERROR
!Clear the workstation
XCALL AMGSBR,G'CLRW,GCB,STATUS
! Turn cursor off
PRINT TAB(-1,29);
! Display the file-based bitmap in upper left corner
XCALL AMGSBR,G'BMF,GCB,0,32767,1,BM'FIL+BM'VOR,STATUS
IF STATUS<>0 THEN GOTO GRAPH'ERROR
!close the files
CLOSE #1
IF ALTCHN<>0 THEN CLOSE #3
! get mouse input
GOSUB MSECLK
! turn cursor on
PRINT TAB(-1,28);
! Close the workstation
XCALL AMGSBR,G'CLWK,GCB,STATUS
END
! Parse the command line and open necessary files.
! External subroutine LSTLIN.SBR returns last line input.
PARSE'COMMAND:
XCALL LSTLIN,CMDLIN
!find second space to get past RUN DSPGRF
P=INSTR(1,CMDLIN," ")
IF P=0 THEN GOTO BAD'COMMAND
P1=INSTR(P+1,CMDLIN," ")
IF P1=0 THEN GOTO BAD'COMMAND
P=P1+1
! P now has pointer to start of command line
GET'INFILE:
CALL TOKEN ! get the next token
IF T$="" THEN GOTO BAD'COMMAND
P1=INSTR(1,T$,".") ! Look for extension
IF P1=0 THEN INFILE$=T$+".BMP" ELSE INFILE$=T$
CALL TOKEN ! get the next token
IF T$="" THEN GOTO LINDON
IF T$<>"=" THEN GOTO GET'AGDV
! Token indicates alternate output file - exchange input file and alternate
ALTCHN = 3
OPEN #3,INFILE$,OUTPUT
GOTO GET'INFILE
! Process alternate GDV
GET'AGDV:
ALTGDV = T$
LINDON:
OPEN #1,INFILE$,INPUT
RETURN
! Parse line starting at P, skip blanks and put next token in T$. Update P
TOKEN:
T$=""
T'LOOP:
IF P>LEN(CMDLIN) THEN RETURN
IF CMDLIN[P;1]<>" " AND CMDLIN[P;1]<>CHR(9) THEN GOTO NOT'SPACE
P=P+1
IF LEN(T$)<>0 THEN RETURN ELSE GOTO T'LOOP
NOT'SPACE:
IF CMDLIN[P;1]<>"=" THEN GOTO ADDT
IF LEN(T$)<>0 THEN RETURN
T$="="
P=P+1
RETURN
ADDT:
T$=T$+CMDLIN[P;1]
P=P+1
GOTO T'LOOP
BAD'COMMAND:
PRINT TAB(P-1);"^ Illegal Input"
END
GRAPH'ERROR:
PRINT "Graph Error";STATUS
END
MSECLK:
! Set Mouse Cursor Shape
PRINT TAB(-1,29);
PRINT TAB(-1,160);CHR(32+8);
! Text Overhead
XCALL AMGSBR,G'STXF,GCB,1003,STATUS ! font
XCALL AMGSBR,G'STXC,GCB,7,STATUS ! color
XCALL AMGSBR,G'SCHH,GCB,700,STATUS ! height
XCALL AMGSBR,G'SCHR,GCB,0,STATUS ! rotation
XVAL = 50
YVAL = 50
TEXT$ = "Click mouse once to continue : "
GOSUB DISP'TEXT
GOSUB GETCOR
END