From fae5db3afd03dadd9bd3ea7c46c7b6f7b8f8c3b3 Mon Sep 17 00:00:00 2001 From: Antoine Vignau <34219772+antoinevignau@users.noreply.github.com> Date: Thu, 15 Aug 2024 21:27:35 +0200 Subject: [PATCH] scsi-2 powa! --- scsi2/AppleScanGS/AppleScan.GS | Bin 0 -> 50986 bytes .../AppleScanGS/AppleScan.GS_ResourceFork.bin | Bin 0 -> 5036 bytes scsi2/AppleScanGS/BoxCtrl..oc.aii | 1 + scsi2/AppleScanGS/BoxCtrl..oc.mac | 1 + scsi2/AppleScanGS/Control.c | 1 + scsi2/AppleScanGS/Event.c | 1 + scsi2/AppleScanGS/Globals.c | 1 + scsi2/AppleScanGS/Makefile | 1 + scsi2/AppleScanGS/Menu.c | 1 + scsi2/AppleScanGS/Scan.c | 1 + scsi2/AppleScanGS/Scan.h | 1 + scsi2/AppleScanGS/Scan.r | 1 + scsi2/AppleScanGS/Scanner.GSOS.aii | 1 + scsi2/AppleScanGS/Scanner.GSOS.h | 1 + scsi2/AppleScanGS/ScannerDefs.h | 1 + scsi2/AppleScanGS/Utils.c | 1 + scsi2/AppleScanGS/Window.c | 1 + scsi2/AppleScanGS/doScan..aii | 1 + scsi2/AppleScanGS/xSaveFile.c | 1 + scsi2/SCANNERSCSI.S | 1307 +++++++++++++++++ 20 files changed, 1324 insertions(+) create mode 100644 scsi2/AppleScanGS/AppleScan.GS create mode 100644 scsi2/AppleScanGS/AppleScan.GS_ResourceFork.bin create mode 100644 scsi2/AppleScanGS/BoxCtrl..oc.aii create mode 100644 scsi2/AppleScanGS/BoxCtrl..oc.mac create mode 100644 scsi2/AppleScanGS/Control.c create mode 100644 scsi2/AppleScanGS/Event.c create mode 100644 scsi2/AppleScanGS/Globals.c create mode 100644 scsi2/AppleScanGS/Makefile create mode 100644 scsi2/AppleScanGS/Menu.c create mode 100644 scsi2/AppleScanGS/Scan.c create mode 100644 scsi2/AppleScanGS/Scan.h create mode 100644 scsi2/AppleScanGS/Scan.r create mode 100644 scsi2/AppleScanGS/Scanner.GSOS.aii create mode 100644 scsi2/AppleScanGS/Scanner.GSOS.h create mode 100644 scsi2/AppleScanGS/ScannerDefs.h create mode 100644 scsi2/AppleScanGS/Utils.c create mode 100644 scsi2/AppleScanGS/Window.c create mode 100644 scsi2/AppleScanGS/doScan..aii create mode 100644 scsi2/AppleScanGS/xSaveFile.c create mode 100644 scsi2/SCANNERSCSI.S diff --git a/scsi2/AppleScanGS/AppleScan.GS b/scsi2/AppleScanGS/AppleScan.GS new file mode 100644 index 0000000000000000000000000000000000000000..e4d92122ed9f53193d6fc990277429fd1dad6831 GIT binary patch literal 50986 zcmeIb2|$$9`agc&Szs7ecU&7MQwdN^({V%4w9(W|+te0OFvxw&q_kmlpj3ixi?-X? z3l2qitDCpo>n(4X7In#t%#36LM4WKM)QJD*Ip>`XaOvLf{e8dR|F`j#^PcTF&w0*s zp7WgNEboI7GHG{D<&^VNo^2$8B??VN}9VB z_Zh`4S6mg+XqcA02cSc?Fy`9I*!y7=NhKpNNl8fWj3dM1JVD&mEK12(+#oYH9^PRE zjOj!$&n_i#kMc*&-N5X+b@wb>GB;)6iuK6aGm^1we_?C_ucA`-01%osKm@N#S-w1F z&5D>^h>YS1ls}>l?frvLSNa7a5p>Ep-U%&vJ^Bqd5*oB|_7LjG4!fby6t4Gw00 zWse~}SHm9d$TqiUp(9N-=h^Ixde+@+SE-DQ{jgK*U@Q-mPp>e$8FMqKSi{WjcDuQU z*;OHdsm?tb&2l@l>_%;4Syv@Zm?0pI^)vQbG%N1RY>nB!Y*VpajYWlxHg~z(uIEL* z){zyrXBB2+=v0=O2^dE64J;FA*cr=iu({j@hQ~N(I%0Q}b$w0Gigid{9K_7VnG1 zXPRPAA`VU%2+*J5F+M$?ireu(bjEqseQWFj4*`#}?#4HRm|Y5_A&?~EsX#{NmJl5s zfLZ#vY`3kUSjEal8=r|_J6t`C=farrr>@Md*%y$~*q|i<dRzL^=dstw( z>2^sSP}0cgj7ZkqM>ZGh{#p-K+)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4l?o8E>99vNNYo~WP1h7w=_)&Bj3zv0nPT1$if>Go0ekZP&>@?i=v`#KN# zcan2zP4T+BJb($ksa{uNHnda=+45z5L_ebAPLeGPas@I+mUMTwr2cL7snlL*sTL~P zg7cKhQz=iOr*SRdYT)AO;aOZRt}dboG_{DxUkL=6suS1j6(=WLapALES@J$p|#ZM2S?V-Eqq7NTJ{ZUI7Idw7Z zh1j>M;^_~g<%zp!VicS}{bQCUa%x&$4^6a=<3d$}Wl6n3PDv0ZvJ_ouiU5$`mlAi^ F{{p%EhT{ML literal 0 HcmV?d00001 diff --git a/scsi2/AppleScanGS/BoxCtrl..oc.aii b/scsi2/AppleScanGS/BoxCtrl..oc.aii new file mode 100644 index 0000000..ad7834c --- /dev/null +++ b/scsi2/AppleScanGS/BoxCtrl..oc.aii @@ -0,0 +1 @@ + case obj case on PRINT PUSH,OFF INCLUDE 'BoxCtrl.DefProc.mac' PRINT POP ******************************************************************************* * BoxCtl CDEFProc * * (C) Copyright Apple Computer, Inc. 1988 * All rights reserved. * * by Keith Rollin * September 1, 1988 * * This is a Custom Control for the Apple IIGS. It is similar in appearance * and action to the 'resize' box you get when clicking on an object in GS Draw * or MacDraw. * * The Control is essentially a frame with 4 or 8 grow knobs on the corners * and/or edges. Dragging on any of these knobs will grow the control. Dragging * on the frame will move the entire control (like moving a window). A flag can * be set so that the control will be dragged if the user clicks in the interior * of the control as well. Part codes for the knobs and frame are listed below. * * Snapping the rectangle's coordinates to a grid is also supported. The * rectangle is snapped to the nearest point on the grid. This effectively means * that I perform rounding, and not truncating. * * The frame of the control is the rectangle passed to NewControl. The size of * the knobs and the size of the grid are passed in ctlValue. The 'interior drag * flag' is passed in ctlFlags. See below for details. * * Color is supported. Currently, only two colors are used: one for the frame, * and one for the knobs. The default colors are black. * * * * * Modification History: * * v1.0a1 02-Apr-88 kaar New Today * v1.0a2 04-Apr-88 kaar Changed part codes. Defined CtlData to point * to a data block. Added edge knobs. Grid can * now be rectangular. Knob rectangles no longer * part of control (created on the fly). Added * new flags to ctlFlag. CtlValue now contains * only the size of the knobs. * v1.0a3 07-Apr-88 kaar Removed dependance on Direct Page from the * application (now uses the stack). Responds to * Hilite(255). * V1.0a4 08-Apr-88 kaar Added support for when Param1/2 are null. * V1.0B1 23-Apr-88 kaar Fixed some bugs. Checked for gridsizes of 0 * and 1. Called InvalRect in DragCtl. * V2.0B2 08-Jun-88 kaar Cleaned up the code some in response to a * code review. Version number bumped to 2.0 to * reflect existance of simpler 1.0 version for * a technote. Added support for fCtlTie in the * owner window's frame flags. Improved perfor- * mance and legibility of Snap2Grid routine. * V2.0B3 08-Jul-88 kaar Part codes changed again. It seems that only * one indicator per control is allowed. Turned * the source code upside down and put it into * Steve Glass format. Implemented some of Dan's * programming style suggestions. * V2.0 01-Sep-88 kaar First Release * * V2.01 23-May-90 Greg Branche * * Added minHeight and minWidth parameters to allow the * application to define the minimum width and height of * the control. This was formerly handled by the minX * and minY parameters. These have been redefined so * that they specify the leftmost and uppermost limits * of the control. The maxX and maxY parameters specify * the right- and bottom-most limits. * * Bug fixes: * * 1) In myDrawCtl, the code was never working * right that checked the current state of the * control to determine whether to draw the control * as active or inactive. This has been modified * to use a flag passed in the high word of ctlParam * as the state indicator. $0000 = control is active, * $FFFF = control is inactive. * * Version 1.0 kaar * * Used in Custom Control technote * * * Version 2.0 kaar * * Release for Source Code Demo Disk #1 * * * Version 2.01 Greg Branche * * Used for AppleScan.GS * ******************************************************************************* * * Part Code returned: * * $A0 for all parts of the control (all parts are 'indicators') * * * CtlValue: Bits 8-15: width of grow knobs * Bits 0- 7: height of grow knobs * * CtlFlag bits: * 7 = 1 - Control is invisible * = 0 - Control is visible * 2 = 1 - Has edge knobs * = 0 - Doesn't * 1 = 1 - Has corner knobs * = 0 - Doesn't * 0 = 1 - Clicking in interior will drag control * = 0 - Clicking in interior does nothing * * Data: Contains a pointer to the following data block. This data * block holds the following information, which is copied to * the end of the control record: * * WORD: Min Y when growing (top limit) * WORD: Min X when growing (left limit) * WORD: Max Y when growing (bottom limit) * WORD: Max X when growing (right limit) * WORD: Min Height * WORD: Min Width * WORD: Spacing for Y segment of grid * WORD: Spacing for X segment of grid * * Color Table: * WORD: Bits 12-15: * 8-11: Knob Color * 4- 7: Inactive Frame/Knob Color * 0- 3: Frame Color * ******************************************************************************* * * How to use the Control: * * Initialization and tracking of the control work just like any other; * set it up with NewControl. When GetNextEvent returns inContent, call * FindControl to see if you hit the control. If you did, call * TrackControl. * * Initialization: * * pha ; space for result * pha * PushLong theWindow * PushLong #theRect ; pointer to bounding rectangle * PushLong #0 ; no title * PushWord #%00000111 ; vis, int will drag, corners & edges * PushWord #$0503 ; Width = 5/Height = 3 * PushLong #CtrlData ; Pointer to additional data * PushLong #BoxProc ; pointer to DefProc * PushLong #0 ; refcon * PushLong #0 ; use std color table * _NewControl * PullLong theControl * * theRect dc.w 50,140,110,300 * CtrlData dc.w 10 ; min Y * dc.w 10 ; min X * dc.w 100 ; max Y * dc.w 200 ; max X * dc.w 10 ; min height * dc.w 16 ; min width * dc.w 16 ; grid Y * dc.w 32 ; grid X * ******************************************************************************* ********************************************************************** * * * Apple IIGS Source Code Sampler, Volume I * * * * Copyright (c) Apple Computer, Inc. 1988 * * All Rights Reserved * * * * Written by Apple II Developer Tech Support * * * * * * * * ---------------------------------------------------------------- * * * * This program and its derivatives are licensed only for * * use on Apple computers. * * * * Works based on this program must contain and * * conspicuously display this notice. * * * * This software is provided for your evaluation and to * * assist you in developing software for the Apple IIGS * * computer. * * * * DISCLAIMER OF WARRANTY * * * * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT * * WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, * * WITH RESPECT TO ITS MERCHANTABILITY OR ITS FITNESS * * FOR ANY PARTICULAR PURPOSE. THE ENTIRE RISK AS TO * * THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH * * YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU (AND * * NOT APPLE OR AN APPLE AUTHORIZED REPRESENTATIVE) * * ASSUME THE ENTIRE COST OF ALL NECESSARY SERVICING, * * REPAIR OR CORRECTION. * * * * Apple does not warrant that the functions * * contained in the Software will meet your requirements * * or that the operation of the Software will be * * uninterrupted or error free or that defects in the * * Software will be corrected. * * * * SOME STATES DO NOT ALLOW THE EXCLUSION * * OF IMPLIED WARRANTIES, SO THE ABOVE EXCLUSION MAY * * NOT APPLY TO YOU. THIS WARRANTY GIVES YOU SPECIFIC * * LEGAL RIGHTS AND YOU MAY ALSO HAVE OTHER RIGHTS * * WHICH VARY FROM STATE TO STATE. * * * * * ********************************************************************** eject ;------------------------------------------- ; ; --- Constants ; ; --- Stack Frame/Local Direct Page usage ; OrigD equ 1 ; caller's saved direct page register OrigB equ OrigD+2 ; caller's saved data bank register work equ OrigB+1 ; general use work space CtlPtr equ work+4 ; pointer to control record RtnAddr equ CtlPtr+4 ; RTL address back to Control Manager theCtlHandle equ RtnAddr+3 ; handle to control record CtlParam equ theCtlHandle+4 ; add'l parameter passed to DefProc CtlCode equ CtlParam+4 ; operation to perform ReturnValue equ CtlCode+2 ; space for return value to Ctl Mgr. ; ; --- Offsets for my control record ; oCtlMinY equ octlColor+4 oCtlMinX equ oCtlMinY+2 oCtlMaxY equ oCtlMinX+2 oCtlMaxX equ oCtlMaxY+2 oCtlMinHeight equ oCtlMaxX+2 oCtlMinWidth equ oCtlMinHeight+2 oCtlGridY equ oCtlMinWidth+2 oCtlGridX equ oCtlGridY+2 oCtlSize equ oCtlGridX+2 ; ; --- Part codes for my control ; BoxCtlPart equ $A0 ; This is returned to the app. FramePart equ $01 ; These are used internally to tell InteriorPart equ $02 ; 'myDragCtl' what part of the ULPart equ $03 ; control we are dragging. TopPart equ $04 URPart equ $05 RightPart equ $06 LLPart equ $07 BottomPart equ $08 LRPart equ $09 LeftPart equ $0A ; ; --- Masks for ctlFlags ; dragIntMask equ %00000001 ; if set, let user drag on interior knobCornerMask equ %00000010 ; if set, draw knobs on the corners knobEdgeMask equ %00000100 ; if set, draw knobs on the edges visMask equ ctlInVis EJECT ******************************************************************************* * CtlData RECORD * * Description: Storage for CDEF * * * External Refs: NONE * * Entry Points: NONE * ******************************************************************************* deltaX ds.b 2 ; used when growing the control deltaY ds.b 2 ColorPtr ds.b 4 ; pointer to actual color table to use theParam ds.b 4 ; copy of CtlParam passed on stack dragPart ds.b 2 ; internal part of control hit myCtlRect ds.b 8 ; copy of CtlRect in control record myCtlGridY ds.b 2 ; copy of CtlGridY myCtlGridX ds.b 2 ; copy of CtlGridX FrameHeight ds.b 2 FrameWidth ds.b 2 knobUL ds.b 8 ; This space is used to store the knobTop ds.b 8 ; rectangles that define the grow knobUR ds.b 8 ; knobs on the control. They are knobRight ds.b 8 ; created as needed, and are not knobLR ds.b 8 ; stored in the control record. knobBottom ds.b 8 knobLL ds.b 8 knobLeft ds.b 8 StdColorTable dc.b $C0 ; grey inact frame, blk normal frame dc.b $00 ; black knobs StdCtlData dc.w 10,10,200,640,0,0 ; min 10,10; max 200,640; no grid oldPenState ds.b $32 ; storage for old pen state. GreyPattern dc.b $CC,$CC,$CC,$CC,$CC,$CC,$CC,$CC dc.b $CC,$CC,$CC,$CC,$CC,$CC,$CC,$CC dc.b $CC,$CC,$CC,$CC,$CC,$CC,$CC,$CC dc.b $CC,$CC,$CC,$CC,$CC,$CC,$CC,$CC ENDR EJECT ******************************************************************************* * BoxProc PROC Export * * Description: Main Routine for Custom Control. * * * Inputs: On entry, the parameters are passed to us on the stack. * * | | Previous Contents * |-------------------| * | ReturnValue | LONG - Space for return value * |-------------------| * | CtlCode | WORD - operation to perform * |-------------------| * | CtlParam | LONG - add'l parameter * |-------------------| * | theCtlHandle | LONG - Handle to control record * |-------------------| * | RtnAddr | 3 BYTES - RTL address * |-------------------| * | | <-- Stack pointer * * Outputs: Put something into ReturnValue, pull off the parameters, * and return to the Control Manager. * * | | Previous Contents * |-------------------| * | ReturnValue | LONG - Space for return value * |-------------------| * | RtnAddr | 3 BYTES - RTL address * |-------------------| * | | <-- Stack pointer * * External Refs: import InitCtlData import myDrawCtl import myTestCtl import myInitCtl import myDragCtl import myNewValue import mySetParams import myRecSize import Null * * Entry Points: NONE * ******************************************************************************* with CtlData ; ; We are going to be using the stack as our direct page for the ; custom control. The equates listed at the beginning of the custom ; control (right after the pageful of comments that explain it) ; describe the layout of the stack frame. ; ; The way we set up the stack frame as our direct page is by first ; saving the old contents of the DP register, transfering the stack ; pointer to the accumulator, and then transferring that to the DP ; register. We also save the contents of the Data Bank Register and ; reset it to the Program Bank Register so that we don't have to ; use 3-byte long addressing anywhere. We will restore both of these ; registers when we leave the custom control. ; pha ; push on some room for 'CtlPtr' pha pha ; push on some room for 'work' pha phb ; save the Data Bank register phd ; save the Direct Page register phk ; switch data bank to program bank plb tsc ; switch Direct Page into stack tcd jsr InitCtlData ; init some handy data lda GridSize/2 then ; coordinate := coordinate + GridSize ; ldy #6 ; init our loop index Loop sty YSave lda whichGridYX ; do we now use X or Y grid spacing? and #%0001 beq UseY lda myCtlGridX bra UseIt UseY lda myCtlGridY ; we now have the gridsize in the Acc UseIt cmp #2 ; Is it 0 or 1? If so, then skip over blt ShortCircuit ; dividing routine. sta GridSize ; save this for the divide later. pha ; push space on stack for the result pha ; of the divide we are going to do. lda [>16 pea |&addr[2:255] ELSEIF &addr[1:1]='[' THEN ldy #&offset+2 pushword &addr,y ldy #&offset pushword &addr,y ELSEIF &offset='s' THEN pushword &addr+2,s pushword &addr+2,s ELSEIF &offset='' THEN pushword &addr+2 pushword &addr ELSE pushword &addr+2,&offset pushword &addr,&offset ENDIF MEND ;............................................................... ; ; Push 2 bytes onto stack ; ; pushword loc -- pushes bytes onto stack from 'loc' ; pushword loc,x -- pushes bytes onto stack from 'loc,x' ; pushword #n -- pushes constant #n onto stack ; pushword -- pushes bytes onto stack (from A) ;............................................................... MACRO pushword &addr,® IF &addr[1:1]='#' AND &SETTING('LONGA')='ON' THEN pea |&addr[2:255] ELSE IF &addr­'' THEN IF ®­'' THEN lda &addr,® ELSE lda &addr ENDIF ENDIF pha ENDIF MEND ;............................................................... ; ; Pull 2 bytes from stack ; ; pullword loc -- pulls bytes off stack and stores in 'loc' ; pullword loc,x -- pulls bytes off stack and stores in 'loc,x' ; pullword -- pulls bytes off stack and leaves in A ;............................................................... MACRO pullword &addr,® pla IF &addr­'' THEN IF ®­'' THEN sta &addr,® ELSE sta &addr ENDIF ELSEIF ®­'' THEN AERROR 'Illegal 2nd parameter' ENDIF MEND ; from M16.Window MACRO &lab _InvalRect &lab ldx #$3A0E jsl $E10000 MEND * * my own custom macros * ; cmps - signed comparison ; use just like the cmp instruction, but destroys contents of accumulator ; conditions c and z flags just like the built in cmp instruction. ; MACRO cmps &oprnd ; signed comparison sec sbc &oprnd beq @1 bvs @2 if &Setting('LONGA')='OFF' then ; must determine correct operand size eor #$80 else eor #$8000 endif @2 bmi @greaterThan clc dc.b $B0 ; BCS opcode @greaterThan sec @1 ENDM \ No newline at end of file diff --git a/scsi2/AppleScanGS/Control.c b/scsi2/AppleScanGS/Control.c new file mode 100644 index 0000000..358b1c4 --- /dev/null +++ b/scsi2/AppleScanGS/Control.c @@ -0,0 +1 @@ +/********************************************************************** * * Control.c * * Copyright (c) 1990 * Apple Computer, Inc. * All Rights Reserved. * * This file contains the code which implements the * procedures for the various controls. * **********************************************************************/ #define rulerXoffset 0 #define rulerYoffset 0 #define previewRes 75 #define maxX 10200 #define maxY 16800 #define yOrg 10 #define xOrg 36 #include #include #include #include #include #include #include #include #include #include #include #include #include #include "Scan.h" #include "Scanner_GSOS.h" extern scannerWindowDef sWindowDef; extern GrafPortPtr previewWindowPtr; extern void updateScannerWindow(); extern void updatePreviewWindow(); /* called by TrackControl when the mouse is held down in one of the scroll controls */ pascal void scrollAction(partCode,ctrlHndl) int partCode; Handle ctrlHndl; { int currentValue; if(partCode) { /* only do the work if the part code is valid */ currentValue = GetCtlValue(ctrlHndl); /* get the current value */ switch(partCode) { /* which part is active? */ case downArrow: /* right arrow */ if(++currentValue > 255) /* make sure we stay within the value bounds */ currentValue = 255; break; case upArrow: /* left arrow */ if(--currentValue < 0) currentValue = 0; break; case pageDown: /* right paging region */ if((currentValue += 8) > 255) currentValue = 255; break; case pageUp: /* left paging region */ if((currentValue -= 8) < 0) currentValue = 0; break; } SetCtlValue(currentValue, ctrlHndl); } return; } word getResolutionPopUp(theControlHandle) Handle theControlHandle; { static int resTable[] = {0, 75, 100, 150, 200, 300}; return(resTable[GetCtlValue(theControlHandle)]); } long doGetXYPos( xStart,xEnd,yStart,yEnd) unsigned long *xStart,*xEnd,*yStart,*yEnd; { CtlRecPtr boxCtl; Rect *boxRect; unsigned i; unsigned long temp, deltaX; if(!previewWindowPtr) { /* if preview window has not been opened... */ *xStart = *yStart = 0; /* use default values to define page */ *xEnd = 10200; /* 1200 * 8.5 inches */ *yEnd = 13200; /* 1200 * 11 inches */ } else { boxCtl = *GetWControls(previewWindowPtr); /* get the control handle from the window record */ boxRect = &(boxCtl->ctlRect); /* make a pointer to the control's rect */ *xStart = ((long) (boxRect->h1 - XINSET) * 1200) / hPPI; *xEnd = ((long) (boxRect->h2 - XINSET) * 1200) / hPPI; *yStart = ((long) (boxRect->v1 - YINSET) * 1200) / vPPI; *yEnd = ((long) (boxRect->v2 - YINSET) * 1200) / vPPI; } if(*yEnd < *yStart) { /* make sure that y is in the increasing direction */ temp = *yEnd; *yEnd = *yStart; *yStart = temp; } if(*xEnd < *xStart){ /* make sure that x is in the increasing direction */ temp = *xEnd; *xEnd = *xStart; *xStart = temp; } return (*yEnd - *yStart); /* scanlength */ } long doFixXPos( xStart,xEnd,yStart,yEnd,xres) unsigned long *xStart,*xEnd,*yStart,*yEnd; word xres; { unsigned long chunkiness, fixAmount; unsigned long remainder, diff, deltaX; diff = (Long)(*xEnd - *xStart); chunkiness = 8*xres; deltaX = diff%chunkiness; fixAmount = chunkiness - deltaX; if(deltaX != 0) { if(*xEnd + fixAmount > maxX) { if(fixAmount >= *xStart) { *xStart = 0; *xEnd = maxX; } else { *xStart -= fixAmount; } } else { *xEnd += fixAmount; } } return(*xEnd - *xStart); /* return scanWidth */ } doGetBrightness() { return(GetCtlValue(GetCtlHandleFromID(NULL,BrightnessScroll))); } doGetContrast() { return(GetCtlValue(GetCtlHandleFromID(NULL,ContrastScroll))); } doGetThreshold() { return(GetCtlValue(GetCtlHandleFromID(NULL,ThresholdScroll))); } doGetImageComposition() { return(GetCtlValue(GetCtlHandleFromID(NULL,CompositionPopUp))-1); } doGetBitsPerPixel(scanType) byte scanType; { byte dpi; switch(scanType){ case 0: dpi = 1; break; case 1: dpi = 1; break; case 2: dpi = 4; break; } return(dpi); } #if 0 /* currently not used, but will be when Data Chaining is implemented */ static void invertImage(bufptr, buflen) unsigned *bufptr; long buflen; /* number of 16-bit words in buffer */ { GrafPortPtr theWindow, oldPort; char *statText; unsigned cursNum = 0; unsigned counter = 0; word oldSCB; int thermX, thermY; int chunkSize, chunkCount; static Rect thermRect = {50,10,60,229}; statText = "Now inverting the image"; /* remember the current GrafPort */ oldPort = GetPort(); /* draw the thermometer window */ theWindow = NewWindow2(NULL,NULL,NULL,NULL,2,ThermWindow,0x800E); SetPort(theWindow); MoveTo((240 - CStringWidth(statText)) >> 1 ,30); DrawCString(statText); FrameRect(&thermRect); /* draw the thermometer frame */ SetSolidPenPat(7); /* use a red pen */ thermX = 11; thermY = 51; /* init drawing locations */ chunkSize = buflen / 217; /* determine size to process before filling in a line */ chunkCount = 0; SetMasterSCB((oldSCB = GetMasterSCB()) | 0x0100); /* make sure cursor doesn't flicker */ do { *bufptr ^= 0xffff; ++bufptr; if(!(++counter & 0x1fff)) { SetCursor(animCursor[++cursNum]); if(!(cursNum < 7)) /* in other words, if cursNum >= 7 (but this produces better code) */ cursNum = -1; } if(++chunkCount == chunkSize) { MoveTo(thermX++, thermY); /* init the pen position */ Line(0,7); chunkCount = 0; } } while(--buflen); SetMasterSCB(oldSCB); /* reset master SCB */ SetPort(oldPort); /* reset the GrafPort */ CloseWindow(theWindow); /* close the alert window */ SetSolidPenPat(0); /* reset the pen back to black */ } #endif void doScanButton() { unsigned *tempPtr; Handle bufferHandle; unsigned long bufferSize, i, transferCount; word xGSres, yGSres; unsigned long scanLength,scanWidth; unsigned long xStart,xEnd,yStart,yEnd; unsigned long dataWidth, dataLength; extern long doScan(); sWindowDef.windDescBlockLenMSB = 0; sWindowDef.windDescBlockLenLSB = 0x28; sWindowDef.windowIdentifier = 0; xGSres = getResolutionPopUp(GetCtlHandleFromID(NULL,XResolutionPopUp)); yGSres = getResolutionPopUp(GetCtlHandleFromID(NULL,YResolutionPopUp)); sWindowDef.xResolution = SwapBytes(xGSres); /* we want the # of 1200ths of an inch in lsb>>msb */ sWindowDef.yResolution = SwapBytes(yGSres); scanLength = doGetXYPos(&xStart,&xEnd,&yStart,&yEnd); scanWidth = doFixXPos(&xStart,&xEnd,&yStart,&yEnd,xGSres); sWindowDef.xUpperLeft = SwapWords(xStart); sWindowDef.yUpperLeft = SwapWords(yStart); sWindowDef.width = SwapWords(scanWidth); sWindowDef.length = SwapWords(scanLength); sWindowDef.brightness = doGetBrightness(); sWindowDef.threshold = doGetThreshold(); sWindowDef.contrast = doGetContrast(); sWindowDef.imageComposition = doGetImageComposition(); sWindowDef.bitsPerPixel = doGetBitsPerPixel(sWindowDef.imageComposition); sWindowDef.halfTone = SwapBytes(2); sWindowDef.paddingType = 3; switch(xGSres){ case 75: scanWidth += 16; break; case 150: scanWidth += 8; break; } dataWidth = (((scanWidth*xGSres)/1200) * (long) (sWindowDef.bitsPerPixel))/8; /* in bytes */ dataLength = (scanLength*yGSres)/1200; /* # of scan lines */ bufferSize = dataWidth * dataLength; /* bytes per scan line * # of scan lines */ bufferHandle = NewHandle(bufferSize,_ownerid,attrFixed,NULL); if(_toolErr != 0) { AlertWindow(4,NULL,(long) noMemAvailable); } else { WaitCursor(); transferCount = doScan(bufferHandle, bufferSize, &sWindowDef, dataWidth, dataLength); doOpenImage(dataWidth, dataLength, bufferHandle); InitCursor(); } } void doPreviewButton(){ /* format_call(); eject_call(); set_confg_parms(); set_format(); Assign_part(); arm_signal(); disarm_signal(); set_part_map(); reserve_unit(); release_unit(); send_diagnostics(); return_dev_status(); return_confg_parms(); return_wait(); return_format(); return_part_map(); return_last_cmd(); test_unit_rdy(); request_sense(); inquiry(); mode_sense(); get_wndow_parms(); extended_read(); get_data_status(); if(_toolErr != 0) { AlertWindow(4,NULL,(long) noMemAvailable); } */ } \ No newline at end of file diff --git a/scsi2/AppleScanGS/Event.c b/scsi2/AppleScanGS/Event.c new file mode 100644 index 0000000..fe37ba2 --- /dev/null +++ b/scsi2/AppleScanGS/Event.c @@ -0,0 +1 @@ +/********************************************************************** * * Event.c * * Copyright (c) * Apple Computer, Inc. 1986-1989 * All Rights Reserved. * * This file contains the code which implements the * main event loop used by the scanner program. * **********************************************************************/ #include #include #include #include #include #include #include "Scan.h" extern WmTaskRec event; extern unsigned int quitFlag; extern GrafPortPtr previewWindowPtr; extern GrafPortPtr settingsWindowPtr; static GrafPortPtr lastWindow; /* This private global is used in checkFrontW() ** to prevent extra work when the windows ** have not changed. It is initialized ** at the beginning of mainEvent(). */ /********************************************************************** * * doSetPageScroll * * This procedure is called when an inGrow or inZoom message is returned * by TaskMaster. * * This procedure resets the values used to scroll the content region * when the page areas are clicked on in the scroll bars. * ***********************************************************************/ static void doSetPageScroll() { int tempH, tempV; tempV = lastWindow->portRect.v2-lastWindow->portRect.v1; /* calculate vertical size */ tempH = lastWindow->portRect.h2-lastWindow->portRect.h1; /* calculate width */ SetPage(tempH-10, tempV-10, lastWindow); } /********************************************************************** * * doControls * * This procedure is called when an inControl message is returned * by TaskMaster. * * When this routine gets control, the ID of the control that was * hit is in TaskDATA4. The control handle is in TaskData2 and * the part code is in taskData 3. * **********************************************************************/ void doControls() { LongWord theID, thePartCode; LongWord theControlHandle; theID = event.wmTaskData4; thePartCode = event.wmTaskData3; theControlHandle = event.wmTaskData2; if (( 0 <= theID) && (theID <= 0xFFFFFFFF )) { switch(theID) { case ScanButton: doScanButton(); break; case PreviewButton: doPreviewButton(); break; } } } /********************************************************************** * * doInContent * * This procedure is called when an InContent message is returned * by TaskMaster. * * When this routine gets control, the ID of the control that was * hit is in TaskDATA4. The control handle is in TaskData2 and * the part code is in taskData 3. * **********************************************************************/ void doInContent() { LongWord theID, thePartCode; LongWord theControlHandle; theID = event.wmTaskData4; thePartCode = event.wmTaskData3; theControlHandle = event.wmTaskData2; SelectWindow(event.wmTaskData); #if 0 if (event.what == 0x01) { /* was it a mouse down event? */ if ((GrafPortPtr) event.wmTaskData == previewWindowPtr){ doInPreview(event.where); } } #endif } /********************************************************************** * * checkFrontW * * This routine checks the front window to see if any changes need * to be made to the menu items. * * We do this so that the edit items are only active when a desk * accessory is active. * **********************************************************************/ void checkFrontW() { GrafPortPtr theWindow; extern int cTable[], defCTable[]; theWindow = FrontWindow(); /* Get the front window into local storage.*/ if (theWindow == lastWindow) return; /* If the lastWindow is this window, we are all set. */ /* If there are no windows, everything should be disabled */ if (!theWindow) { SetMenuFlag(0x0080, EditMenuID); HiliteMenu(0,EditMenuID); SetColorTable(0,defCTable); } /* if the front window is an image window, then we want to enable the edit items */ if (!( (theWindow == previewWindowPtr)||(theWindow == settingsWindowPtr))) { EnableMItem(SaveAsID); /* allow Save As... */ SetMenuFlag (0xFF7F, EditMenuID); /* Set up for da windows. */ HiliteMenu(0,EditMenuID); } else { DisableMItem(SaveAsID); /* don't allow saving */ /* Otherwise we look at the window and see what to do. */ if (GetSysWFlag(theWindow)) { SetMenuFlag (0xFF7F, EditMenuID); /* Set up for da windows. */ HiliteMenu(0,EditMenuID); } else { SetMenuFlag (0x0080, EditMenuID); /* Set up for our windows. */ HiliteMenu(0,EditMenuID); } } /* use grayscale pallette for Preview or Image windows */ if((theWindow != settingsWindowPtr) && !GetSysWFlag(theWindow)) SetColorTable(0,cTable); else SetColorTable(0,defCTable); lastWindow = theWindow; /* Remember this for next time. */ /* here we want to update the hor/vert text if need be */ } /********************************************************************** * * mainEvent * * This is the main part of the program. The program cycles in this * loop until the user choose select. * **********************************************************************/ void mainEvent() { unsigned int code; unsigned temp; event.wmTaskMask = 0x001FFF7F; /* Allow TaskMaster to do everything, and return inContents */ quitFlag = 0; /* Done flag will be set by Quit item. */ lastWindow = NULL; /* Init this for checkFrontW(). */ for (;;) { checkFrontW(); code = TaskMaster(0xFFFF, &event); switch(code) { case wNoHit: /* null event, but TaskMaster might have handled something */ temp = event.wmTaskData & 0xffff; /* get the event code */ if(temp == wInGrow || temp == wInZoom) /* if the window changed sizes */ doSetPageScroll(); break; case wInGoAway: doCloseTop(); break; case wInSpecial: case wInMenuBar: doMenu(); break; case wInControl: doControls(); break; case wInContent: doInContent(); break; } if (quitFlag) break; } } \ No newline at end of file diff --git a/scsi2/AppleScanGS/Globals.c b/scsi2/AppleScanGS/Globals.c new file mode 100644 index 0000000..8af1f08 --- /dev/null +++ b/scsi2/AppleScanGS/Globals.c @@ -0,0 +1 @@ +/*********************************************************************** * * Globals.c * * Copyright (c) * Apple Computer, Inc. 1986-1989 * All Rights Reserved. * * This file contains the code which intializes the global variables * used by the scanner program. * ***********************************************************************/ #include "Scan.h" #include #include #include unsigned int quitFlag = 0; /* True when quitting */ unsigned int staggerCount = 0; /* Used to stagger windows as they open */ WmTaskRec event; /* All events are returned here */ scannerWindowDef sWindowDef; GrafPortPtr previewWindowPtr = NULL; GrafPortPtr settingsWindowPtr = NULL; PicHndl previewRuler = NULL; int scanDevnum; /* device number of Scanner */ word Scanner_Type; long (*Setup[2])() = {Setup_Apple,Setup_CPCScan}; void initGlobals() { quitFlag = staggerCount = 0; sWindowDef.reserved0 = sWindowDef.reserved0 = sWindowDef.reserved1 = sWindowDef.reserved2 = 0; sWindowDef.reserved3 = sWindowDef.reserved4 = sWindowDef.reserved5 = 0; sWindowDef.windDescBlockLenMSB = sWindowDef.windDescBlockLenLSB = 0; sWindowDef.windowIdentifier = sWindowDef.reserved6 = sWindowDef.xResolution = 0; sWindowDef.yResolution = sWindowDef.xUpperLeft = sWindowDef.yUpperLeft = 0; sWindowDef.width = sWindowDef.length = sWindowDef.brightness = 0; sWindowDef.threshold = sWindowDef.contrast = sWindowDef.imageComposition = 0; sWindowDef.bitsPerPixel = sWindowDef.halfTone = sWindowDef.paddingType = 0; } \ No newline at end of file diff --git a/scsi2/AppleScanGS/Makefile b/scsi2/AppleScanGS/Makefile new file mode 100644 index 0000000..b2cf1a7 --- /dev/null +++ b/scsi2/AppleScanGS/Makefile @@ -0,0 +1 @@ +# File: makefile # Target: AppleScan.GS # Created: Tuesday, August 29, 1989 10:46:51 AM Objs = Scan.obj ¶ Event.obj ¶ Globals.obj ¶ Menu.obj ¶ Utils.obj ¶ Window.obj ¶ Control.obj ¶ xSaveFile.obj ¶ Scanner_gsos.obj ¶ BoxCtrl.DefProc.obj AppleScan.GS ÄÄ Scan.r ScannerDefs.h "{RIIGSIncludes}"TypesIIGS.r RezIIGS Scan.r -o AppleScan.GS AppleScan.GS ÄÄ "{CIIGSLibrary}"Start.obj {objs} LinkIIGS -l >AppleScan.map -at $0000DB03 ¶ "{CIIGSLibrary}"BankAlign.obj # used only during debugging ¶ "{CIIGSLibrary}"Start.obj ¶ {objs} ¶ -lib "{CIIGSLibrary}"CLib ¶ -o AppleScan.GS ¶ -w2 # warnings are treated as fatal errors .obj Ä .c CIIGS {default}.c -o {default}.obj .obj Ä .aii ASMIIGS {default}.aii -o {default}.obj # include file dependencies Scan.h Ä "{CIIGSIncludes}"Types.h ¶ ScannerDefs.h SetFile -m . Scan.h Control.obj Ä "{CIIGSIncludes}"control.h ¶ "{CIIGSIncludes}"intmath.h ¶ "{CIIGSIncludes}"types.h ¶ "{CIIGSIncludes}"list.h ¶ "{CIIGSIncludes}"locator.h ¶ "{CIIGSIncludes}"quickdraw.h ¶ "{CIIGSIncludes}"qdaux.h ¶ "{CIIGSIncludes}"event.h ¶ "{CIIGSIncludes}"lineEdit.h ¶ "{CIIGSIncludes}"menu.h ¶ "{CIIGSIncludes}"memory.h ¶ "{CIIGSIncludes}"resources.h ¶ "{CIIGSIncludes}"window.h ¶ Scan.h ¶ Scanner_GSOS.h Event.obj Ä "{CIIGSIncludes}"types.h ¶ "{CIIGSIncludes}"locator.h ¶ "{CIIGSIncludes}"quickdraw.h ¶ "{CIIGSIncludes}"event.h ¶ "{CIIGSIncludes}"menu.h ¶ "{CIIGSIncludes}"window.h ¶ Scan.h Globals.obj Ä Scan.h ¶ "{CIIGSIncludes}"qdaux.h ¶ "{CIIGSIncludes}"quickdraw.h ¶ "{CIIGSIncludes}"window.h Menu.obj Ä "{CIIGSIncludes}"control.h ¶ "{CIIGSIncludes}"types.h ¶ "{CIIGSIncludes}"quickdraw.h ¶ "{CIIGSIncludes}"qdaux.h ¶ "{CIIGSIncludes}"window.h ¶ "{CIIGSIncludes}"event.h ¶ "{CIIGSIncludes}"menu.h ¶ "{CIIGSIncludes}"desk.h ¶ "{CIIGSIncludes}"intmath.h ¶ "{CIIGSIncludes}"stdfile.h ¶ "{CIIGSIncludes}"gsos.h ¶ "{CIIGSIncludes}"memory.h ¶ "{CIIGSIncludes}"malloc.h ¶ Scan.h ¶ Scan.obj Ä "{CIIGSIncludes}"types.h ¶ "{CIIGSIncludes}"quickdraw.h ¶ "{CIIGSIncludes}"locator.h ¶ "{CIIGSIncludes}"TextTool.h ¶ "{CIIGSIncludes}"IntMath.h Utils.obj Ä "{CIIGSIncludes}"quickdraw.h ¶ "{CIIGSIncludes}"QDAux.h ¶ "{CIIGSIncludes}"GSOS.h ¶ "{CIIGSIncludes}"Window.h ¶ "{CIIGSIncludes}"MiscTool.h ¶ "{CIIGSIncludes}"texttool.h ¶ Scan.h Window.obj Ä "{CIIGSIncludes}"intmath.h ¶ "{CIIGSIncludes}"memory.h ¶ "{CIIGSIncludes}"types.h ¶ "{CIIGSIncludes}"quickdraw.h ¶ "{CIIGSIncludes}"qdaux.h ¶ "{CIIGSIncludes}"resources.h ¶ "{CIIGSIncludes}"window.h ¶ "{CIIGSIncludes}"misctool.h ¶ "{CIIGSIncludes}"control.h ¶ "{CIIGSIncludes}"menu.h ¶ "{CIIGSIncludes}"malloc.h ¶ Scan.h xSaveFile.obj Ä "{CIIGSIncludes}"gsos.h ¶ "{CIIGSIncludes}"memory.h ¶ "{CIIGSIncludes}"malloc.h ¶ "{CIIGSIncludes}"string.h ¶ "{CIIGSIncludes}"quickdraw.h ¶ "{CIIGSIncludes}"qdaux.h ¶ "{CIIGSIncludes}"misctool.h BoxCtrl.DefProc.obj Ä BoxCtrl.DefProc.mac \ No newline at end of file diff --git a/scsi2/AppleScanGS/Menu.c b/scsi2/AppleScanGS/Menu.c new file mode 100644 index 0000000..7a90a19 --- /dev/null +++ b/scsi2/AppleScanGS/Menu.c @@ -0,0 +1 @@ +/*********************************************************************** * * Menu.c * * Copyright (c) * Apple Computer, Inc. 1986-1989 * All Rights Reserved. * * This file contains the code which implements * menus in the scanner program. * ***********************************************************************/ #include #include #include #include #include #include #include #include #include #include #include #include #include #include "Scan.h" extern WmTaskRec event; extern unsigned int quitFlag; extern GrafPortPtr previewWindow; extern GrafPortPtr settingsWindowPtr; extern GrafPortPtr openThisWindow(); SFReplyRec2 MyReply; extern void doCloseTop(); void doQuitItem(); void doAboutBox(); void doOpenItem(); void doSaveItem(); void doSaveAsItem(); void doPrefItem(); void doSettingsItem(); void doPreviewItem(); /* array of procedure address to handle menu selections */ void (*menuProc[])() = { doAboutBox, /* for Undo */ doAboutBox, /* for Cut */ doAboutBox, /* for Copy */ doAboutBox, /* for Paste */ doAboutBox, /* for Clear */ doCloseTop, /* for Close */ doAboutBox, /* for About (really!) */ doOpenItem, /* for Open */ doSaveItem, /* for Save */ doSaveAsItem, /* for Save As */ doPrefItem, /* for Preferences */ doAboutBox, /* for Print */ doQuitItem, /* for Quit */ doSettingsItem, /* for Settings (in Scan menu) */ doPreviewItem /* for Preview (in Scan Menu) */ }; /**********************************************************************/ void doQuitItem() { quitFlag++; } /**********************************************************************/ void doAboutBox() { AlertWindow(4, NULL, (long) AboutBox); } /**********************************************************************/ void doOpenItem() { AlertWindow(4, NULL, (long) AboutBox); } /**********************************************************************/ /**********************************************************************/ void doSaveItem() { AlertWindow(4, NULL, (long) AboutBox); } /**********************************************************************/ /**********************************************************************/ void doSaveAsItem() { extern int SavePic(); LocInfoHndl AuxHandle; LocInfoPtr RefPtr; ResultBuf255Ptr filename; GrafPortPtr WhichWindow; GSString255Ptr oldfilename; char *windowName, **nameHndl; int i, error; RefPtr = (LocInfoPtr) GetWRefCon((WhichWindow = FrontWindow())); nameHndl = (char **) GetWTitle(WhichWindow); /* get the current window title */ if((unsigned long) nameHndl & 0x80000000) { /* returned as a handle? */ windowName = *nameHndl; /* yes, dereference it */ nameHndl = NULL; /* then clear it so we don't dispose of it later */ } else windowName = (char *) nameHndl; /* else must be a real pointer */ oldfilename = (GSString255Ptr) malloc(*windowName+2); /* convert to GSOS string */ memcpy(oldfilename->text, windowName+2, (oldfilename->length = *windowName-2)); MyReply.nameDesc = MyReply.nameDesc = 3; /* let StdFile allocate the memory for the names */ SFPutFile2 (25,30, 0,"\pSave picture as:", 0, oldfilename, &MyReply); if (MyReply.good) { /* <> 0 --> OK to save it */ filename = (ResultBuf255Ptr) *((ResultBuf255Ptr *) MyReply.pathRef); if(error = /* assignment */ SavePic(&(filename->bufString), RefPtr)) /* save the picture */ ErrorWindow(0,NULL,error); else { filename = * ((ResultBuf255Ptr *) MyReply.nameRef); /* get pointer to filename result */ windowName = malloc((i = filename->bufString.length)+3); /* get the buffer */ windowName[0] = i + 2; /* set the new length (pascal string) */ memcpy(windowName+2,filename->bufString.text,i); /* copy the new name in */ windowName[1] = windowName[i+2] = ' '; SetWTitle(windowName,WhichWindow); /* change the window name */ if(nameHndl) /* if name was returned as a pointer... */ free(nameHndl); /* then dispose of the old name */ } } DisposeHandle(MyReply.nameRef); DisposeHandle(MyReply.pathRef); free(oldfilename); } /**********************************************************************/ void doPrefItem() { AlertWindow(4, NULL, (long) AboutBox); } /**********************************************************************/ void doSettingsItem() { Pointer theArrayList[1]; static char subString[] = {"0000"}; CtlRecHndl ctlHandle; extern void scrollAction(); extern int scanDevnum; if(settingsWindowPtr == NULL) { settingsWindowPtr = openThisWindow(SettingsWindow); if(!scanDevnum) { /* if a scanner wasn't found during initialization */ HiliteControl(inactiveHilite, GetCtlHandleFromID(settingsWindowPtr,ScanButton)); /* disable the buttons */ HiliteControl(inactiveHilite, GetCtlHandleFromID(settingsWindowPtr,PreviewButton)); } EnableMItem(CloseID); SetCtlAction(scrollAction,GetCtlHandleFromID(NULL,BrightnessScroll)); SetCtlAction(scrollAction,GetCtlHandleFromID(NULL,ContrastScroll)); SetCtlAction(scrollAction,GetCtlHandleFromID(NULL,ThresholdScroll)); } else SelectWindow(settingsWindowPtr); } /**********************************************************************/ void doPreviewItem() { openPreview(); } /**********************************************************************/ void doMenu() { unsigned int menuNum, itemNum; unsigned int *intPtr; /* Procedure to handle all menu selections. Examines the event.TaskData ** menu item ID word from TaskMaster (from Event Manager) and calls the ** appropriate routine. While the routine is running the menu title is ** still highlighted. After the routine returns, we unhilight the ** menu title. */ intPtr = (unsigned *) &(event.wmTaskData); menuNum = intPtr[1]; /* get high word of TaskData */ /* menuNum = HiWord(event.wmTaskData); itemNum = LoWord(event.wmTaskData);*/ (*menuProc[*intPtr-250])(); /* call the menu handler */ HiliteMenu(0, menuNum); /* Unhighlight the menu title. */ } /**********************************************************************/ void setupMenus() { /* Procedure to install our menu titles and their items in the system menu ** bar and to redraw it so we can see them. */ SetSysBar(NewMenuBar2(refIsResource, 0x0001L, NULL)); SetMenuBar(NULL); FixAppleMenu(AppleMenuID); /* Add DAs to apple menu */ FixMenuBar(); /* Set sizes of menus */ DrawMenuBar(); /* ...and draw the menu bar! */ } \ No newline at end of file diff --git a/scsi2/AppleScanGS/Scan.c b/scsi2/AppleScanGS/Scan.c new file mode 100644 index 0000000..4eb5fd5 --- /dev/null +++ b/scsi2/AppleScanGS/Scan.c @@ -0,0 +1 @@ +/*********************************************************************** * * Scan.c (Main Program) * * Copyright (c) * Apple Computer, Inc. 1986-1989 * All Rights Reserved. * * This file contains the scanner program. * ***********************************************************************/ #include #include #include #include #include #include #include /* Include this line to use Tool039 (the Scanner Toolset) #include "scToolSet.h" */ main() { Ref initRef; /* This holds the reference to the startstop record */ char errBuf[5]; initGlobals(); /* Initialize our globals. */ TLStartUp(); /* start up the tool locator */ /* Startup the tools using the new toolbox call */ initRef = StartUpTools(_ownerid, refIsResource, 0x0001L); if (!_toolErr) { #ifdef __scToolSet__ LoadOneTool(39, 1); /* load the Scanner toolset */ if(_toolErr) { InitCursor(); ErrorWindow(0,NULL,_toolErr); WaitCursor(); } else if(findScanner()) { /* find the device number of the scanner */ #else if(findScanner()) { /* find the device number of the scanner */ #endif setupMenus(); /* Set up menus */ setupWindows(); InitCursor(); /* Make cursor show ready */ mainEvent(); /* Use application */ #ifdef __scToolSet__ scShutDown(); /* shut down the scanner toolset */ UnloadOneTool(39); #endif } ShutDownTools(refIsHandle, initRef); /* Let the toolbox shutdown the tools. */ } else { Int2Hex(_toolErr, &errBuf[1], 4); errBuf[0] = 4; WriteLine("\pUnable to start toolsets."); WriteCString("Error code = $"); WriteLine(errBuf); WriteLine("\pPress any key to quit..."); ReadChar(0); } TLShutDown(); /* qFlags = 0x4000; /* we can be restarted from memory */ } \ No newline at end of file diff --git a/scsi2/AppleScanGS/Scan.h b/scsi2/AppleScanGS/Scan.h new file mode 100644 index 0000000..9c30a37 --- /dev/null +++ b/scsi2/AppleScanGS/Scan.h @@ -0,0 +1 @@ +/*********************************************************************** * * Scan.h * * Copyright (c) 1990 * Apple Computer, Inc. * All Rights Reserved. * * This file contains the header data used by the scanner program. * ***********************************************************************/ #ifndef _scanner_ #define _scanner_ 1 #include extern Word SwapBytes(); extern Long SwapWords(); extern void testPause(); extern long Setup_Apple(),Setup_CPCScan(); extern Word Scanner_Type; typedef struct scannerWindowStruct { byte reserved0,reserved1,reserved2,reserved3,reserved4,reserved5; byte windDescBlockLenMSB,windDescBlockLenLSB; byte windowIdentifier; byte reserved6; word xResolution,yResolution; long xUpperLeft,yUpperLeft,width,length; byte brightness,threshold,contrast,imageComposition,bitsPerPixel; word halfTone; byte paddingType; byte reserved[10]; } scannerWindowDef; #define SHORTINDEX 123 #define AppWindow 0x1000 #include "ScannerDefs.h" struct cocoonMemRec { long itemRefID; byte listFlags; long windowID; }; typedef struct cocoonMemRec *cocoonMemRecPtr; /* constants used to define the box control */ #define XINSET 30 #define YINSET 20 #define XOFFSET 2 #define YOFFSET 2 #define hPPI 16 /* pixels per inch as displayed on screen rulers */ #define vPPI 10 #endif \ No newline at end of file diff --git a/scsi2/AppleScanGS/Scan.r b/scsi2/AppleScanGS/Scan.r new file mode 100644 index 0000000..3fe0f9d --- /dev/null +++ b/scsi2/AppleScanGS/Scan.r @@ -0,0 +1 @@ +/*---------------------------------------------------------------*/ #include "TypesIIGS.r" #include "ScannerDefs.h" /* tricky, tricky! */ /*------------------- Values used through out -------------------*/ #define LELine1 20 #define LELeft1 10 #define LEHeight 15 #define LEWidth 80 #define TopOfRow4 90 #define LeftEdge3 100 #define BottomOfRow4 110 #define RightEdge3 130 #define disabled $80 #ifndef fUseShadowing #define fUseShadowing $8000 #define fFastPortAware $4000 #endif /*----------------------- About Box ------------------------------*/ resource rAlertString (AboutBox) { "\$00\$19\$00\$0A\$00\$AA\$00\$35\$01" "\$00/" TBCenterJust TBStyleOutline "AppleScan.GS" TBEndOfLine TBEndOfLine TBStylePlain "A Program to digitize images using the Apple Scanner." TBEndOfLine TBEndOfLine "by" TBEndOfLine "The Apple ][" TBEndOfLine "System Software Group" TBEndOfLine TBEndOfLine "© 1990, Apple Computer, Inc." TBEndOfLine "All Rights Reserved" TBEndOfLine "Version 1.0d1/^#6\$00" }; /*----------------------- Unable to allocate handle ------------------------------*/ resource rAlertString (noMemAvailable) { "20|Unable to allocate Handle.|^#0" }; /*----------------- no scanner device found in device list ------------------------*/ resource rAlertString (noScannerFound) { "83|AppleScan.GS is unable to find a scanner. " "Please check the power and SCSI connections, and " "make sure you have the scanner driver file installed " "in your system folder." TBEndOfLine TBEndOfLine "If you continue, you can work with documents, but " "you will not be able to scan." TBEndOfLine "|^#5|#6\$00" }; /*----------------------- Unable to allocate handle ------------------------------*/ resource rAlertString (scannerNotReady) { "83|Your scanner is not ready to be used. Please " "make sure it's turned on and warmed up, then " "click on the \"Try Again\" button." TBEndOfLine TBEndOfLine "If you \"Continue\", you can work with documents, but " "you will not be able to scan." TBEndOfLine "|^#5|#4|#6\$00" }; /*----------------------Startup Record ---------------------------*/ resource rToolStartup (1) { fUseShadowing + fFastPortAware, /* master SCB, mode 320 */ { 3,$0100, /* misc tools */ 4,$0100, /* quickdraw */ 5,$0100, /* desk manager */ 6,$0100, /* eventMgr */ /* 7,$0100, /* scheduler */ /* 8,$0100, /* sound tools */ /* 9,$0100, /* ADB tools */ /* 10,$0100, /* SANE */ 11,$0100, /* int math */ 14,$0300, /* Window Manager */ 15,$0300, /* Menu Manager */ 16,$0300, /* Control Manager */ 18,$0200, /* QD Aux */ 19,$0100, /* print manager */ 20,$0100, /* LineEdit tool set */ 21,$0100, /* Dialog Manager */ 22,$0100, /* Scrap manager */ 23,$0100, /* standard file */ 27,$0100, /* Font manager */ 28,$0100, /* list manager */ 34,$0100, /* text edit */ /* 29,$0100, /* ACE */ /* 32,$0100, /* Midi Tools */ /* 25,$0100, /* NoteSynth */ /* 26,$0100 /* Note Seq */ } }; /*********************************************************************/ /* /* Menus /* /*********************************************************************/ resource rMenuBar (1) { { AppleMenuID, FileMenuID, EditMenuID, ScanMenuID, }; }; resource rMenu (ScanMenuID) { ScanMenuID, 0xA008, ScanMenuID, { SettingsID, PreviewID }; }; resource rMenu (AppleMenuID) { AppleMenuID, 0xA008, AppleMenuID, { AboutID }; }; resource rMenu (FileMenuID) { FileMenuID, 0xA008, FileMenuID, { OpenID, SaveID, SaveAsID, PrefID, PrintID, CloseID, QuitID }; }; resource rMenu (EditMenuID) { EditMenuID, 0xA088, EditMenuID, { UndoID, CutID, CopyID, PasteID, ClearID }; }; resource rMenuItem (PreviewID) { PreviewID, "","", //"T","t", 0, 0x8000, PreviewID }; resource rMenuItem (SettingsID) { SettingsID, "","", 0, 0x8000, SettingsID }; resource rMenuItem (AboutID) { AboutID, "","", 0, 0x8040, AboutID }; resource rMenuItem (UndoID) { UndoID, "Z","z", 0, 0x8080, UndoID }; resource rMenuItem (CutID) { CutID, "X","x", 0, 0x8080, CutID }; resource rMenuItem (CopyID) { CopyID, "C","c", 0, 0x8080, CopyID }; resource rMenuItem (PasteID) { PasteID, "V","v", 0, 0x8080, PasteID }; resource rMenuItem (ClearID) { ClearID, "","", 0, 0x8080, ClearID }; resource rMenuItem (CloseID) { CloseID, "W","w", 0, 0x8000+disabled, CloseID }; resource rMenuItem (QuitID) { QuitID, "Q","q", 0, 0x8000, QuitID }; resource rMenuItem (OpenID) { OpenID, "O","o", 0, 0x8000+disabled, OpenID }; resource rMenuItem (SaveID) { SaveID, "S","s", 0, 0x8000+disabled, SaveID }; resource rMenuItem (SaveAsID) { SaveAsID, "","", 0, 0x8000+disabled, SaveAsID }; resource rMenuItem (PrefID) { PrefID, "","", 0, 0x8000+disabled, PrefID }; resource rMenuItem (PrintID) { PrintID, "P","p", 0, 0x8000+disabled, PrintID }; resource rPString (AppleMenuID) { "@" }; resource rPString (FileMenuID) { " File " }; resource rPString (EditMenuID) { " Edit " }; resource rPString (ScanMenuID) { " Scan " }; resource rPString (AboutID) { "About AppleScan.GSÉ" }; resource rPString (CloseID) { "Close" }; resource rPString (UndoID) { "Undo" }; resource rPString (CutID) { "Cut" }; resource rPString (CopyID) { "Copy" }; resource rPString (PasteID) { "Paste" }; resource rPString (ClearID) { "Clear" }; resource rPString (QuitID) { "Quit" }; resource rPString (PreviewID) { "Preview" }; resource rPString (OpenID) { "Open" }; resource rPString (SaveID) { "Save" }; resource rPString (SaveAsID) { "Save AsÉ" }; resource rPString (PrefID) { "PreferencesÉ" }; resource rPString (PrintID) { "Print" }; resource rPString (SettingsID) { "SettingsÉ" }; /*---------------------------------------------------------------------------*/ /* /* ImageWindowÉ /* /*---------------------------------------------------------------------------*/ resource rWindParam1 (ImageWindow) { fTitle+fMove+fZoom+fGrow+fBScroll+fRScroll+fClose+fVis, /* Frame Bits */ ImageWindow, /* title ID */ 0, /* ref Con */ {0,0,0,0}, /* Zoom Rect */ ImageWindow, /* color table id */ {0,0}, /* origin */ {400,640}, /* data size */ {200,640}, /* max height-width */ {2,2}, /* scroll amount, hor,ver */ {60,200}, /* page amount */ 0, /* wInfo Ref Con */ 0, /* wInfo height */ {50,50,120,260}, /* window Position */ infront, /* wPlane */ 0, /* Control Ref */ (refIsResource<<8) + /* descriptor for title */ (refIsResource<<10) /* descriptor for color table */ }; resource rpString (ImageWindow) { "Image Window" }; resource rWindColor (ImageWindow) { $0000, /* frameColor */ $0f00, /* titleColor */ $020f, /* tBarColor */ $00f0, /* growColor */ $0000 /* infoColor (not used, for now) */ }; //--------------------------------------------------------------------------- // // Thermometer Window // //--------------------------------------------------------------------------- resource rWindParam1 (ThermWindow) { fAlert+fVis, /* Frame Bits */ NIL, /* title ID */ NIL, /* ref Con */ {0,0,0,0}, /* Zoom Rect */ NIL, /* color table id */ {0,0}, /* origin */ {0,0}, /* data size */ {0,0}, /* max height-width */ {0,0}, /* scroll amount, hor,ver */ {0,0}, /* page amount */ NIL, /* wInfo Ref Con */ NIL, /* wInfo height */ {30,40,99,279}, /* window Position */ infront, /* wPlane */ NIL, /* controlList */ refIsResource*0x0100 /* descriptor */ }; /*---------------------------------------------------------------------------*/ /* /* PreviewWindowÉ /* /*---------------------------------------------------------------------------*/ resource rWindParam1 (PreviewWindow) { fTitle+fMove+fVis+fClose, /* Frame Bits */ PreviewWindow, /* title ID */ 0, /* ref Con */ {0,0,0,0}, /* Zoom Rect */ 0, /* color table id */ {0,0}, /* origin */ {79,103}, /* data size */ {79,103}, /* max height-width */ {0,0}, /* scroll amount, hor,ver */ {0,0}, /* page amount */ 0, /* wInfo Ref Con */ 0, /* wInfo height */ {27,2,198,186}, /* window Position */ infront, /* wPlane */ PreviewWindow, /* Control Ref */ refIsResource*0x0100+resourceToResource /* descriptor */ }; resource rpString (PreviewWindow) { "Preview" }; resource rControlList (PreviewWindow) { { 0 }; }; /*---------------------------------------------------------------------------*/ /* /* SettingsWindowÉ /* /* The Settings window /* /*---------------------------------------------------------------------------*/ #define ObjectOffset (21) #define windowHeight (4*ObjectOffset)+10 // leave a little slop #define windowWidth (316) #define windowBorderSize ((320-windowWidth-2 /* for border */) / 2) #define windowTop (13 /* menu bar height */ + 13 /* window title bar height */ + windowBorderSize) #define windowLeft (windowBorderSize+1) #define windowBottom ((4*ObjectOffset)+10+windowTop) #define windowRight (320-windowLeft) #define LeftInset (2) #define RightInset (196+2) // 196 = window field separation point #define scanButtonWidth (68) #define previewButtonWidth (85) #define freeFieldWidth ((windowWidth-previewButtonWidth-scanButtonWidth)/3) #define scrollHeight (11) resource rWindParam1 (SettingsWindow) { fTitle+fMove+fVis+fClose, /* Frame Bits */ SettingsWindow, /* title ID */ 0, /* ref Con */ {0,0,0,0}, /* Zoom Rect */ 0, /* color table id */ {0,0}, /* origin */ {400,640}, /* data size */ {200,640}, /* max height-width */ {1,1}, /* scroll amount, hor,ver */ {10,10}, /* page amount */ 0, /* wInfo Ref Con */ 0, /* wInfo height */ {windowTop,windowLeft,windowBottom,windowRight}, /* window Position */ infront, /* wPlane */ SettingsWindow, /* Control Ref */ refIsResource*0x0100+resourceToResource /* descriptor */ }; resource rpString (SettingsWindow) { "Settings" }; resource rControlList (SettingsWindow) { { CompositionPopUp, XResolutionPopUp, YResolutionPopUp, BrightnessScroll, BrightnessStatText, ContrastScroll, ContrastStatText, ThresholdScroll, ThresholdStatText, ScanButton, PreviewButton, 0 }; }; /*------ Image Composition ------*/ resource rControlTemplate (CompositionPopUp) { CompositionPopUp, /* control ID */ {1,LeftInset,0,0}, /* control rectangle */ PopUpControl{{ /* control type */ 0, /* flags */ fctlProcNotPtr+RefIsResource, /* MoreFlags */ 0, /* RefCon */ 0, /* Title Width */ CompositionPopUp, /* Menu ref */ 3 /* Initial Value */ }} }; resource rMenu (CompositionPopUp) { CompositionPopUp, /* id of menu */ RefIsResource*MenuTitleRefShift+RefIsResource*ItemRefShift+fAllowCache, /* menu flags */ CompositionPopUp, /* id of title string */ { /* id's of items */ CompositionPopUpItem1, CompositionPopUpItem2, CompositionPopUpItem3 }; }; resource rPString (CompositionPopUp) { "Composition: " }; resource rMenuItem (CompositionPopUpItem1) { 1, "","", 0, 0x8000, CompositionPopUpItem1 }; resource rMenuItem (CompositionPopUpItem2) { 2, "","", 0, 0x8000, CompositionPopUpItem2 }; resource rMenuItem (CompositionPopUpItem3) { 3, "","", 0, 0x8000, CompositionPopUpItem3 }; resource rPString (CompositionPopUpItem1) { "Line Art" }; resource rPString (CompositionPopUpItem2) { "Halftone" }; resource rPString (CompositionPopUpItem3) { "Greyscale" }; /*------ XResolutionPopUp ------*/ resource rControlTemplate (XResolutionPopUp) { XResolutionPopUp, /* control ID */ {(1*ObjectOffset)+1,LeftInset,0,0}, /* control rectangle */ PopUpControl{{ /* control type */ 0, /* flags */ fctlProcNotPtr+RefIsResource, /* MoreFlags */ 0, /* RefCon */ 0, /* Title Width */ XResolutionPopUp, /* Menu ref */ 1 /* Initial Value */ }} }; resource rMenu (XResolutionPopUp) { XResolutionPopUp, /* id of menu */ RefIsResource*MenuTitleRefShift+RefIsResource*ItemRefShift+fAllowCache, /* menu flags */ XResolutionPopUp, /* id of title string */ { /* id's of items */ XResolutionPopUpItem1, XResolutionPopUpItem2, XResolutionPopUpItem3, XResolutionPopUpItem4, XResolutionPopUpItem5 }; }; resource rPString (XResolutionPopUp) { "X Resolution: " }; resource rMenuItem (XResolutionPopUpItem1) { 1, "","", 0, 0x8000, XResolutionPopUpItem1 }; resource rMenuItem (XResolutionPopUpItem2) { 2, "","", 0, 0x8000, XResolutionPopUpItem2 }; resource rMenuItem (XResolutionPopUpItem3) { 3, "","", 0, 0x8000, XResolutionPopUpItem3 }; resource rMenuItem (XResolutionPopUpItem4) { 4, "","", 0, 0x8000, XResolutionPopUpItem4 }; resource rMenuItem (XResolutionPopUpItem5) { 5, "","", 0, 0x8000, XResolutionPopUpItem5 }; resource rPString (XResolutionPopUpItem1) { "75 dpi" }; resource rPString (XResolutionPopUpItem2) { "100 dpi" }; resource rPString (XResolutionPopUpItem3) { "150 dpi" }; resource rPString (XResolutionPopUpItem4) { "200 dpi" }; resource rPString (XResolutionPopUpItem5) { "300 dpi" }; /*------ YResolutionPopUp ------*/ resource rControlTemplate (YResolutionPopUp) { YResolutionPopUp, /* control ID */ {(2*ObjectOffset)+1,LeftInset,0,0}, /* control rectangle */ PopUpControl{{ /* control type */ 0, /* flags */ fctlProcNotPtr+RefIsResource, /* MoreFlags */ 0, /* RefCon */ 0, /* Title Width */ YResolutionPopUp, /* Menu ref */ 1 /* Initial Value */ }} }; resource rMenu (YResolutionPopUp) { YResolutionPopUp, /* id of menu */ RefIsResource*MenuTitleRefShift+RefIsResource*ItemRefShift+fAllowCache, /* menu flags */ YResolutionPopUp, /* id of title string */ { /* id's of items */ YResolutionPopUpItem1, YResolutionPopUpItem2, YResolutionPopUpItem3, YResolutionPopUpItem4, YResolutionPopUpItem5 }; }; resource rPString (YResolutionPopUp) { "Y Resolution: " }; resource rMenuItem (YResolutionPopUpItem1) { 1, "","", 0, 0x8000, YResolutionPopUpItem1 }; resource rMenuItem (YResolutionPopUpItem2) { 2, "","", 0, 0x8000, YResolutionPopUpItem2 }; resource rMenuItem (YResolutionPopUpItem3) { 3, "","", 0, 0x8000, YResolutionPopUpItem3 }; resource rMenuItem (YResolutionPopUpItem4) { 4, "","", 0, 0x8000, YResolutionPopUpItem4 }; resource rMenuItem (YResolutionPopUpItem5) { 5, "","", 0, 0x8000, YResolutionPopUpItem5 }; resource rPString (YResolutionPopUpItem1) { "75 dpi" }; resource rPString (YResolutionPopUpItem2) { "100 dpi" }; resource rPString (YResolutionPopUpItem3) { "150 dpi" }; resource rPString (YResolutionPopUpItem4) { "200 dpi" }; resource rPString (YResolutionPopUpItem5) { "300 dpi" }; /*------ Preview Button ------*/ resource rControlTemplate (PreviewButton) { PreviewButton, /* control ID */ {3*ObjectOffset+10,freeFieldWidth,0,0}, /* control rect */ SimpleButtonControl{{ /* control type */ NormalButton, /* flag */ 0x3002, /* more flags */ 0, /* ref con */ PreviewButton, /* title ref */ 0 }} }; resource rpString (PreviewButton) { "Preview" }; /*------ Brightness Scroll Bar ------*/ #define horScroll $0010 #define rightFlag $0008 #define leftFlag $0004 resource rControlTemplate (BrightnessScroll) { BrightnessScroll, /* control ID */ {(0*ObjectOffset)+1,RightInset,(0*ObjectOffset)+1+scrollHeight,windowWidth-2}, /* control rect */ scrollControl{{ /* control type */ horScroll+rightFlag+leftFlag, /* flag */ FctlProcNotPtr, /* more flags */ 0, /* ref con */ 256, /* max size */ 1, /* view size */ 128 /* initial value */ }} }; resource rControlTemplate (BrightnessStatText) { BrightnessStatText, /* control ID */ {(0*ObjectOffset)+1+11,RightInset,(0*ObjectOffset)+21,windowWidth-2}, /* control rect */ StatTextControl{{ /* control type */ 0, /* flags */ FctlProcNotPtr+RefIsResource, /* more flags */ 0, /* refcon */ BrightnessStatText, /* textRef */ 0, /* textSize */ 1 /* justification (centered) */ }} }; resource rTextForLETextBox2 (BrightnessStatText) { "Brightness" }; /*------ Contrast Scroll Bar ------*/ resource rControlTemplate (ContrastScroll) { ContrastScroll, /* control ID */ {(1*ObjectOffset)+1,RightInset,(1*ObjectOffset)+1+scrollHeight,windowWidth-2}, /* control rect */ scrollControl{{ /* control type */ horScroll+rightFlag+leftFlag, /* flag */ FctlProcNotPtr, /* more flags */ 0, /* ref con */ 256, /* max size */ 1, /* view size */ 128 /* initial value */ }} }; resource rControlTemplate (ContrastStatText) { ContrastStatText, /* control ID */ {(1*ObjectOffset)+1+11,RightInset,(1*ObjectOffset)+21,windowWidth-2}, /* control rect */ StatTextControl{{ /* control type */ 0, /* flags */ FctlProcNotPtr+RefIsResource, /* more flags */ 0, /* refcon */ ContrastStatText, /* textRef */ 0, /* textSize */ 1 /* justification (centered) */ }} }; resource rTextForLETextBox2 (ContrastStatText) { "Contrast" }; /*------ Threshold Scroll Bar ------*/ resource rControlTemplate (ThresholdScroll) { ThresholdScroll, /* control ID */ {(2*ObjectOffset)+1,RightInset,(2*ObjectOffset)+1+scrollHeight,windowWidth-2}, /* control rect */ scrollControl{{ /* control type */ horScroll+rightFlag+leftFlag, /* flag */ FctlProcNotPtr, /* more flags */ 0, /* ref con */ 256, /* max size */ 1, /* view size */ 128 /* initial value */ }} }; resource rControlTemplate (ThresholdStatText) { ThresholdStatText, /* control ID */ {(2*ObjectOffset)+1+11,RightInset,(2*ObjectOffset)+21,windowWidth-2}, /* control rect */ StatTextControl{{ /* control type */ 0, /* flags */ FctlProcNotPtr+RefIsResource, /* more flags */ 0, /* refcon */ ThresholdStatText, /* textRef */ 0, /* textSize */ 1 /* justification (centered) */ }} }; resource rTextForLETextBox2 (ThresholdStatText) { "Threshold" }; /*------ Scan Button ------*/ resource rControlTemplate (ScanButton) { ScanButton, /* control ID */ {3*ObjectOffset+10,windowWidth-freeFieldWidth-scanButtonWidth,0,0}, /* control rect */ SimpleButtonControl{{ /* control type */ DefaultButton, /* flag */ 0x3002, /* more flags */ 0, /* ref con */ ScanButton, /* title ref */ 0, /* color table ref */ {"\n","\n",0,0} /* key equivalents (return and enter) */ }} }; resource rpString (ScanButton) { "Scan" }; \ No newline at end of file diff --git a/scsi2/AppleScanGS/Scanner.GSOS.aii b/scsi2/AppleScanGS/Scanner.GSOS.aii new file mode 100644 index 0000000..4d13e3b --- /dev/null +++ b/scsi2/AppleScanGS/Scanner.GSOS.aii @@ -0,0 +1 @@ + CASE OBJ Case On INCLUDE 'M16.UTIL' _useToolset equ 0 ; define as 1 to use Tool039 open_call equ $2010 read_call equ $2012 close_call equ $2014 dinfo_call equ $202c dstatus_call equ $202d dcontrol_call equ $202e Import scanDevnum Import _toolErr ;*********************************** ; Scanner_SetMode() ; description: This call sets the mode for scanning ; entry: None. ; exit: Carry set, and error code in Acc. ;*********************************** Scanner_SetMode PROC EXPORT if _useToolset then lda >scanDevnum sta >ms_did else ENTRY ms_did endif jsl $e100a8 ;normal GS/OS entry point dc.w dcontrol_call dc.l mode_select ;4 byte pointer to parameter block sta >_toolErr rtl mode_select dc.w $0005 ms_did dc.w $0000 dc.w $8015 dc.l @cdb dc.l $0000000C dc.l $00000000 @cdb dc.w $0000 dc.b $15 dc.b $10 dcb.b 2,$00 dc.b $0C dcb.b 7,$00 dc.l @data @data dcb.b 4,$00 ;reserved - 4 bytes dc.b $01 ;page code - Apple-specific parameter page dc.b $08 ;page length - Apple-specific page dc.b $01 ;graymap - 1 = no alteration to data dc.b $40 ;auto background adjustment threshold dc.b $00 ;lamp - 0 = turn off dcb.b 3,$00 ;reserved - 3 bytes ENDP ;*********************************** ; Scanner_SetHalfTones() ; description: This call sets the mode for scanning ; entry: None. ; exit: Carry set, and error code in Acc. ;*********************************** Scanner_SetHalfTones PROC EXPORT if _useToolset then lda >scanDevnum sta >send_did else ENTRY send_did endif jsl $e100a8 ;normal GS/OS entry point dc.w dcontrol_call dc.l send ;4 byte pointer to parameter block sta >_toolErr rtl send dc.w $0005 send_did dc.w $0000 dc.w $802A dc.l @cdb dc.l $00000011 dc.l $00000000 @cdb dc.w $0000 dc.b $2A dc.b $00 dc.b $02 dcb.b 2,$00 dc.b $02 dcb.b 2,$00 dc.b $11 dcb.b 3,$00 dc.l @data @data dc.b $44,$f0,$40,$80,$c0,$b0,$00,$10,$50 dc.b $70,$30,$20,$90,$e0,$a0,$60,$d0 ENDP ;*********************************** ; Scanner_DefWindow(scanner_window_definition) ; description: This call defines the scanner window ; entry: Long pointer to the scanner definition proc. ; exit: Carry set, and error code in Acc. ;*********************************** Scanner_DefWindow PROC EXPORT ENTRY dfw_did lda 6,S ;get the pointer to the window definition sta >def_data+2 lda 4,S ;get the rest of the pointer sta >def_data if _useToolset then lda >scanDevnum sta >dfw_did jsl $e100a8 ;normal GS/OS entry point else @over_2 jsl $e100a8 ;normal GS/OS entry point endif dc.w dcontrol_call dc.l def_wndw ;4 byte pointer to parameter block sta >_toolErr rtl def_wndw dc.w $0005 dfw_did dc.w $0000 dc.w $8024 dc.l @cdb dc.l $00000030 dc.l $00000000 @cdb dc.w $0000 dc.b $24 dcb.b 7,$00 dc.b $30 dc.b $80 dcb.b 2,$00 def_data dc.l $00000000 ENDP ;*********************************** ; Scanner_Scan() ; description: This call starts the scanner scanning ; entry: None. ; exit: Carry set, and error code in Acc. ;*********************************** Scanner_Scan PROC EXPORT if _useToolset then lda >scanDevnum sta >scan_did else ENTRY scan_did endif jsl $e100a8 ;normal GS/OS entry point dc.w dcontrol_call dc.l scan ;4 byte pointer to parameter block sta >_toolErr rtl scan dc.w $0005 scan_did dc.w $0000 dc.w $801B dc.l @cdb dc.l $00000001 dc.l $00000000 @cdb dc.w $0000 dc.b $1b dcb.b 3,$00 dc.b $01 dc.b $00 dcb.b 6,$00 dc.l @data @data dc.b $00 ENDP ;*********************************** ; Scanner_Read(data_pointer, requestCount) ; description: This call starts the scanner scanning ; entry: A pointer to the data destination, and a long count. ; exit: Carry set, and error code in Acc. ;NOTE: here we must utilize the pointer we are handed...., and it must reflect the real data size ;*********************************** Scanner_Read PROC EXPORT lda 6,S ;get the pointer to the window definition sta >buffer1+2 lda 4,S ;get the rest of the pointer sta >buffer1 lda 10,S ;get the data length sta >r_trans+2 lda 8,S ;get the rest of the data length sta >r_trans @save_loop jsl $e100a8 ;normal GS/OS entry point dc.w read_call dc.l read ;4 byte pointer to parameter block bcs @exit sta >_toolErr lda >t_trans+2 tax lda >t_trans rtl @exit sta >_toolErr rtl export r_dref read dc.w $0004 r_dref dc.w $0000 buffer1 dc.l $00000000 r_trans dc.l 300 t_trans dc.l $00000000 ENDP ;*********************************** ; CPCScan_SetMode() ; description: This call sets the mode for scanning on the ; Complete PC Scanner, both Hand and Page ; entry: None. ; exit: Carry set, and error code in Acc. ;*********************************** CPCScan_SetMode PROC EXPORT ENTRY CPCms_did jsl $e100a8 ;normal GS/OS entry point dc.w dcontrol_call dc.l @mode_select ;4 byte pointer to parameter block sta >_toolErr rtl @mode_select dc.w $0005 CPCms_did dc.w $0000 dc.w $8015 dc.l @cdb dc.l $0000000C dc.l $00000000 @cdb dc.w $0000 dc.b $15 dcb.b 3,$00 dc.b $0C dcb.b 7,$00 dc.l CPC_MSdata EXPORT CPC_MSdata CPC_MSdata dcb.b 4,$00 ;reserved - 4 bytes EXPORT CPC_Type CPC_Type dc.b $00 ;Scanner Type <128 = Hand, ³128 = Page dc.b $00 ;reserved EXPORT CPC_Page_Ctrl CPC_Page_Ctrl dc.b $00 ;Page Control 1=Go, 0 = Stop EXPORT CPC_Hand_Ctrl CPC_Hand_Ctrl dc.b $00 ;Hand Control 1=On, 0 = Off EXPORT CPC_Scan_Len CPC_Scan_Len dcb.b 2,$00 ;Bytes Per Line MSB >>> LSB CPC_Timer dcb.b 2,$00 ;ShutOff Timer MSB >>> LSB ENDP ;*********************************** ; CPCScan_GetMode() ; description: This call gets the mode for scanning on the ; Complete PC Scanner, both Hand and Page ; entry: None. ; exit: Carry set, and error code in Acc. ;*********************************** CPCScan_GetMode PROC EXPORT ENTRY CPCmsen_did IMPORT CPC_MSdata jsl $e100a8 ;normal GS/OS entry point dc.w dstatus_call dc.l @mode_sense ;4 byte pointer to parameter block sta >_toolErr rtl @mode_sense dc.w $0005 CPCmsen_did dc.w $0000 dc.w $801A dc.l @cdb dc.l $0000000C dc.l $00000000 @cdb dc.w $0000 dc.b $1A dcb.b 3,$00 dc.b $0C dcb.b 7,$00 dc.l CPC_MSdata ENDP ;*********************************** ; CPC_GDStatus() ; description: This call gets the data status ; entry: Long pointer to the scanner definition proc. ; exit: Carry set, and error code in Acc. ;*********************************** CPC_GDStatus PROC EXPORT ENTRY CPC_GDS_did jsl $e100a8 ;normal GS/OS entry point dc.w dstatus_call dc.l @gd_Status ;4 byte pointer to parameter block sta >_toolErr rtl @gd_Status dc.w $0005 CPC_GDS_did dc.w $0000 dc.w $8007 dc.l @cdb dc.l $00000004 dc.l $00000000 @cdb dc.w $0000 dc.b $07 dcb.b 3,$00 dc.b $04 dcb.b 7,$00 dc.l CPC_GDStat CPC_GDStat dc.b $00 ;Paper End Status for Page Scanner dc.b $00 ;Reserevd EXPORT CPC_Data CPC_Data dc.b $0000 ;Bytes Available MSB >>> LSB dcb.b $20,$00 ENDP ;*********************************** ; CPC_XSense() ; description: This call gets the Transfer Rate ; at the current scanner settings. ; ; For a Page Scanner: ; 113-137 $0071-$0089 = 300 DPI ; 75- 92 $004B-$005C = 200 DPI ; ; For a Hand Scanner: ; 85-103 $0055-$0067 = 400 DPI ; 63- 77 $003F-$004D = 300 DPI ; 42- 53 $002A-$0035 = 200 DPI ; ; entry: Long pointer to the scanner definition proc. ; exit: Carry set, and error code in Acc. ;*********************************** CPC_XSense PROC EXPORT ENTRY CPC_XS_did ; jsl $e100a8 ;normal GS/OS entry point ; dc.w dstatus_call ; dc.l @xd_Status ;4 byte pointer to parameter block ; sta >_toolErr rtl @xd_Status dc.w $0005 CPC_XS_did dc.w $0000 dc.w $800E dc.l @cdb dc.l $00000003 dc.l $00000000 @cdb dc.w $0000 dc.b $0E dcb.b 3,$00 dc.b $03 dcb.b 7,$00 dc.l CPC_XStatus CPC_XStatus dc.b $00 ;Will be a Two '2' EXPORT CPC_TRate CPC_TRate dc.w $0030 ;Transfer Rate MSB >>> LSB ENDP ;*********************************** ; CPC_Read() ; description: This call Reads the Scaned Data ; entry: None. ; exit: Carry set, and error code in Acc. ;*********************************** CPC_Read PROC EXPORT ENTRY CPCRead_did ENTRY CPC_ReadRqst ENTRY CPC_buffer1 jsl $e100a8 ;normal GS/OS entry point dc.w dstatus_call dc.l @read ;4 byte pointer to parameter block sta >_toolErr rtl @read dc.w $0005 CPCRead_did dc.w $0000 dc.w $8008 dc.l cdb CPC_ReadRqst dc.l $00000000 dc.l $00000000 cdb dc.w $0000 dc.b $08 dcb.b 2,$00 dc.w $0000 ;Becomes the Request Count in the Driver dcb.b 7,$00 CPC_buffer1 dc.l $00000000 ENDP ;*********************************** ; CPC_Unload() ; description: This call Stops the scanning Process ; entry: None. ; exit: Carry set, and error code in Acc. ;*********************************** CPC_Unload PROC EXPORT ENTRY CPC_Kill_did jsl $e100a8 ;normal GS/OS entry point dc.w dcontrol_call dc.l @unload ;4 byte pointer to parameter block sta >_toolErr rtl @unload dc.w $0005 CPC_Kill_did dc.w $0000 dc.w $801B dc.l @cdb dc.l $00000000 dc.l $00000000 @cdb dc.w $0000 dc.b $1B dcb.b 11,$00 dc.l $00000000 ENDP ;*********************************** ; CPC_Scan(data_pointer, requestCount, Width, Length) ; ; description: This call Reads the scanner Data ; entry: A pointer to the data destination, and a long count. ; exit: Carry set, and error code in Acc. ; ; NOTE: Here we must utilize the pointer we are ; handed...., and it must reflect the real ; data size ; ;*********************************** CPC_Scan PROC EXPORT IMPORT CPC_Type IMPORT CPC_Page_Ctrl IMPORT CPC_Hand_Ctrl IMPORT CPC_TRate IMPORT CPC_Scan_Len IMPORT CPC_Data IMPORT CPC_ReadRqst lda 6,S ;get the pointer to the window definition sta >CPC_buffer1+2 lda 4,S sta >CPC_buffer1 lda 10,S ;get the data length sta >t_rqst+2 sta >t_remain+2 lda 8,S sta >t_rqst sta >t_remain lda 12,S ;get the Scan Line Width sta >tw_width clc adc #$0003 lsr a lsr a sta >w_width lda 16,S ;get the data length sta >w_length ; ; Get the Scanner Type ; jsl CPCScan_GetMode bcs @exit1 ; ; Get the Scanner Resolution ; jsl CPC_XSense ; bcs @exit1 ; ; Which Scanner is it? ; lda >CPC_Type bmi @page ; ; It's a hand Scanner. ; Turn it on ; lda #$0101 sta >CPC_Page_Ctrl lda #$0001 sta >CPC_Type ; ; What DPI are we at? ; lda >CPC_TRate cmp #$0055 bge @dpi_400 cmp #$003F bge @dpi_300 blt @dpi_200 ; ; It's a Page Scanner. ; Turn it on ; @page lda #$0101 sta >CPC_Page_Ctrl lda #$0081 sta >CPC_Type ; ; What DPI are we at? ; lda >CPC_TRate cmp #$0071 bge @dpi_300 blt @dpi_200 ; ; Set the DPI Value. ; @dpi_400 lda #400 bra @set_dpi @dpi_300 lda #300 bra @set_dpi @dpi_200 lda #200 @set_dpi sta >CPC_Dpi ; ; Set the Scanner Type and turn the ; Scanner on ; lda #$0000 sta >CPC_MSdata jsl CPCScan_SetMode bcs @exit1 ; ; Set the Scan Line Width. ; lda >w_width xba sta >CPC_Scan_Len ; ; Set the Scanner Type and turn the ; Scanner on ; jsl CPCScan_SetMode bcc @GDS_Loop @exit1 brl @exit ; ; Does the Scanner have a Scan Line Yet? ; @GDS_Loop jsl CPC_GDStatus bcs @exit1 lda >CPC_Data xba cmp >w_width blt @GDS_Loop ; ; Get the Scan Line ; lda >w_width sta >CPC_ReadRqst jsl CPC_Read bcs @exit1 jsl covert2gray2 bcs @skip_buff ; ; Update the Buffer Pointer ; lda >CPC_buffer1 adc >tw_width sta >CPC_buffer1 lda >CPC_buffer1+2 adc #$0000 sta >CPC_buffer1+2 ; ; Update the Resulting Count ; @skip_buff lda >t_rslt adc >tw_width sta >t_rslt lda >t_rslt+2 adc #$0000 sta >t_rslt+2 ; ; Is there any more data requested> ; sec lda >t_remain sbc >tw_width sta >t_remain lda >t_remain+2 sbc #$0000 sta >t_remain+2 ora >t_remain beq @done ;No! Done with the Scan sec lda >t_remain sbc >tw_width ;Room for at least 1 more? lda >t_remain+2 sbc #$0000 blt @done ;No! Done with the Scan brl @GDS_Loop ;Yes. Go Get it ; ; No more data left. Stop the Scan ; @done jsl CPC_Unload bcs @exit sta >_toolErr lda >t_rslt+2 tax lda >t_rslt rtl @exit sta >_toolErr rtl w_width dc.l $0000 tw_width dc.l $0000 w_length dc.l $0000 CPC_Dpi dc.w $0000 t_rqst dc.l $00000000 t_remain dc.l $00000000 t_rslt dc.l $00000000 ; ; Scanned Data is 1 bit/pixel. We need to ; convert it to 4 bits/pixel. We will do this ; with a lookup table in 8 bit mode. ; covert2gray phb phk plb pei <$40 pei <$42 phy lda >CPC_buffer1 sta <$40 lda >CPC_buffer1+2 sta <$42 ldx w_width dex and #$00ff stx @src_ndx lda w_width asl a asl a dec a sta @dest_ndx lda #$0000 SHORTM @cvrt_loop ldy @src_ndx lda [$40],y tax lda HTone_2Gray3,x pha lda HTone_2Gray2,x pha lda HTone_2Gray1,x pha lda HTone_2Gray0,x ldy @dest_ndx sta [$40],y pla dey sta [$40],y pla dey sta [$40],y pla dey sta [$40],y dey sty @dest_ndx dec @src_ndx bpl @cvrt_loop LONGM ply pla sta <$42 pla sta <$40 plb @exit clc rtl @src_ndx dc.w $0000 @dest_ndx dc.w $0000 HTone_2Gray0 dc.b $00,$0f,$f0,$ff,$00,$0f,$f0,$ff,$00,$0f,$f0,$ff,$00,$0f,$f0,$ff dc.b $00,$0f,$f0,$ff,$00,$0f,$f0,$ff,$00,$0f,$f0,$ff,$00,$0f,$f0,$ff dc.b $00,$0f,$f0,$ff,$00,$0f,$f0,$ff,$00,$0f,$f0,$ff,$00,$0f,$f0,$ff dc.b $00,$0f,$f0,$ff,$00,$0f,$f0,$ff,$00,$0f,$f0,$ff,$00,$0f,$f0,$ff dc.b $00,$0f,$f0,$ff,$00,$0f,$f0,$ff,$00,$0f,$f0,$ff,$00,$0f,$f0,$ff dc.b $00,$0f,$f0,$ff,$00,$0f,$f0,$ff,$00,$0f,$f0,$ff,$00,$0f,$f0,$ff dc.b $00,$0f,$f0,$ff,$00,$0f,$f0,$ff,$00,$0f,$f0,$ff,$00,$0f,$f0,$ff dc.b $00,$0f,$f0,$ff,$00,$0f,$f0,$ff,$00,$0f,$f0,$ff,$00,$0f,$f0,$ff dc.b $00,$0f,$f0,$ff,$00,$0f,$f0,$ff,$00,$0f,$f0,$ff,$00,$0f,$f0,$ff dc.b $00,$0f,$f0,$ff,$00,$0f,$f0,$ff,$00,$0f,$f0,$ff,$00,$0f,$f0,$ff dc.b $00,$0f,$f0,$ff,$00,$0f,$f0,$ff,$00,$0f,$f0,$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0,$f0 dc.b $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 dc.b $0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f dc.b $f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0 dc.b $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff HTone_2Gray3 dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 dc.b $0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f dc.b $0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f dc.b $0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f dc.b $0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f dc.b $f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0 dc.b $f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0 dc.b $f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0 dc.b $f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0,$f0 dc.b $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff dc.b $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff dc.b $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff dc.b $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff ; ; Scanned Data is 1 bit/pixel. We need to ; convert it to 4 bits/pixel. We will do this ; with a lookup table in 8 bit mode. ; covert2gray2 sec inc @pass beq @exit phb phk plb pei <$40 pei <$42 phy lda >CPC_buffer1 sta <$40 lda >CPC_buffer1+2 sta <$42 ldx w_width dex and #$00ff stx @src_ndx lda w_width asl a dec a sta @dest_ndx lda #$0000 SHORTM @cvrt_loop ldy @src_ndx lda [$40],y tax lda HTone_2Gray5,x pha lda HTone_2Gray4,x ldy @dest_ndx sta [$40],y pla dey sta [$40],y dey sty @dest_ndx dec @src_ndx bpl @cvrt_loop LONGM ply pla sta <$42 pla sta <$40 plb lda #$ffff sta @pass clc @exit rtl @src_ndx dc.w $0000 @dest_ndx dc.w $0000 @pass dc.w $ffff HTone_2Gray4 dc.b $00,$04,$03,$0C,$30,$78,$77,$CF,$40,$88,$87,$CF,$C4,$D5,$F7,$FF dc.b $00,$04,$03,$0C,$30,$78,$77,$CF,$40,$88,$87,$CF,$C4,$D5,$F7,$FF dc.b $00,$04,$03,$0C,$30,$78,$77,$CF,$40,$88,$87,$CF,$C4,$D5,$F7,$FF dc.b $00,$04,$03,$0C,$30,$78,$77,$CF,$40,$88,$87,$CF,$C4,$D5,$F7,$FF dc.b $00,$04,$03,$0C,$30,$78,$77,$CF,$40,$88,$87,$CF,$C4,$D5,$F7,$FF dc.b $00,$04,$03,$0C,$30,$78,$77,$CF,$40,$88,$87,$CF,$C4,$D5,$F7,$FF dc.b $00,$04,$03,$0C,$30,$78,$77,$CF,$40,$88,$87,$CF,$C4,$D5,$F7,$FF dc.b $00,$04,$03,$0C,$30,$78,$77,$CF,$40,$88,$87,$CF,$C4,$D5,$F7,$FF dc.b $00,$04,$03,$0C,$30,$78,$77,$CF,$40,$88,$87,$CF,$C4,$D5,$F7,$FF dc.b $00,$04,$03,$0C,$30,$78,$77,$CF,$40,$88,$87,$CF,$C4,$D5,$F7,$FF dc.b $00,$04,$03,$0C,$30,$78,$77,$CF,$40,$88,$87,$CF,$C4,$D5,$F7,$FF dc.b $00,$04,$03,$0C,$30,$78,$77,$CF,$40,$88,$87,$CF,$C4,$D5,$F7,$FF dc.b $00,$04,$03,$0C,$30,$78,$77,$CF,$40,$88,$87,$CF,$C4,$D5,$F7,$FF dc.b $00,$04,$03,$0C,$30,$78,$77,$CF,$40,$88,$87,$CF,$C4,$D5,$F7,$FF dc.b $00,$04,$03,$0C,$30,$78,$77,$CF,$40,$88,$87,$CF,$C4,$D5,$F7,$FF dc.b $00,$04,$03,$0C,$30,$78,$77,$CF,$40,$88,$87,$CF,$C4,$D5,$F7,$FF HTone_2Gray5 dcb.b 16,$00 dcb.b 16,$04 dcb.b 16,$03 dcb.b 16,$0C dcb.b 16,$30 dcb.b 16,$78 dcb.b 16,$77 dcb.b 16,$CF dcb.b 16,$40 dcb.b 16,$88 dcb.b 16,$87 dcb.b 16,$CF dcb.b 16,$C4 dcb.b 16,$D5 dcb.b 16,$F7 dcb.b 16,$FF ENDP ;*********************************** ; Scan_Inquiry() ; description: This call determines the Scanner Brand ; entry: None. ; exit: Carry set, and error code in Acc. ;*********************************** Scan_Inquiry PROC EXPORT ENTRY Inq_did ENTRY Inq_data jsl $e100a8 ;normal GS/OS entry point dc.w dstatus_call dc.l @Inquiry ;4 byte pointer to parameter block sta >_toolErr rtl @Inquiry dc.w $0005 Inq_did dc.w $0000 dc.w $8012 dc.l @cdb dc.l $00000020 dc.l $00000000 @cdb dc.w $0000 dc.b $12 dcb.b 3,$00 dc.b $20 dcb.b 7,$00 dc.l Inq_data Inq_data dcb.b $20,$00 ENDP ;*********************************** ; ; Scanner_Open(); ; description: Find and open the scanner device ; entry: None. ; exit: carry set, and error code in Acc if an error occurs. ; ;*********************************** Scanner_Open PROC EXPORT IMPORT c_dref,Scanner_Type lda >scanDevnum ;copy scanner device ID to various parm blocks sta >scanner_did sta >ms_did sta >send_did sta >dfw_did sta >scan_did sta >wait_did sta >CPCms_did sta >CPCmsen_did sta >CPC_GDS_did sta >CPC_XS_did sta >CPCRead_did sta >CPC_Kill_did sta >Inq_did ; ; Do the Scanner Inquiry Call. This way we can ID the Type of Scanner that ; we are dealing with. ; jsl Scan_Inquiry bcs @exit ; ; What Scanner do We have? ; ldx #$0010 @Apple_Loop lda >Inq_data,x cmp >Apple_String,x bne @chk_CPC dex bpl @Apple_Loop jmp Apple_Open @chk_CPC ldx #$0010 @CPC_Loop lda >Inq_data,x cmp >CPC_String,x bne @chk_NuScan dex bpl @CPC_Loop jmp CPC_Open @chk_NuScan ldx #$0010 @NuScan_Loop lda >Inq_data,x cmp >NuScan_String,x bne @None dex bpl @NuScan_Loop jmp NuScan_Open @None lda #$002f sec @exit sta >_toolErr rtl STRING ASIS Apple_String dc.b $06,$00,$02,$02,$2C,$00,$00,$00 dc.b 'APPLE SCANNER A9M0337 ' CPC_String dc.b $06,$00,$02,$02,$28,$00,$00,$00 dc.b 'CPC INC Smart Scan(FW) ' NuScan_String dc.b $06,$00,$02,$02,$28,$00,$00,$00 dc.b 'CPC INC Smart Scan(FW) ' ; ; Start point for finalizing the Apple Scanner Open Call ; make a DInfo call to get the device name ; Apple_Open jsl $e100a8 ;normal GS/OS entry point dc.w dinfo_call dc.l get_scan_name ;4 byte pointer to parameter block bcs @exit ; ; Now that we have the name, we can open the device (using the Character FST) ; jsl $e100a8 ;normal GS/OS entry point dc.w open_call dc.l dvc_open ;4 byte pointer to parameter block bcs @exit ;say goodnight if errors lda >open_dref ;copy reference number to other parm blocks sta >r_dref sta >c_dref ; ; Now that it's open, we can set wait mode to WAIT ; jsl $e100a8 ;normal GS/OS entry point dc.w dcontrol_call dc.l wait ;4 byte pointer to parameter block bcs @exit lda #$0000 sta >Scanner_Type lda #$0000 @exit sta >_toolErr rtl get_scan_name dc.w $0002 ;pCount scanner_did dc.w $0000 dc.l scan_dname_buf export open_dref dvc_open dc.w $0002 open_dref dc.w $0000 dc.l scan_dname STRING asis scan_dname_buf dc.w 36 ;ResultBuf32 length is 36 bytes scan_dname ds.w 1 ;returned length word ds.b 32 ;space for returned device name STRING PASCAL wait dc.w $0005 wait_did dc.w $0000 dc.w $0004 dc.l @cdb dc.l $00000002 dc.l $00000000 @cdb dc.w $0000 ;set wait mode ; ; Start point for finalizing the CPC Scanner Open Call ; CPC_Open lda #$0001 sta >Scanner_Type lda #$0000 clc sta >_toolErr rtl ; ; Start point for finalizing the NuScan Scanner Open Call ; NuScan_Open lda #$0002 sta >Scanner_Type lda #$0000 clc sta >_toolErr rtl ENDP ;*********************************** ; Scanner_Close() ; description: This call closes the scanner device ; entry: None. ; exit: Carry set, and error code in Acc. ;*********************************** Scanner_Close PROC EXPORT ENTRY c_dref clc lda >c_dref beq @close jsl $e100a8 ;normal GS/OS entry point dc.w close_call dc.l close ;4 byte pointer to parameter block @close sta >_toolErr rtl close dc.w $0001 export c_dref c_dref dc.w $0000 ENDP END \ No newline at end of file diff --git a/scsi2/AppleScanGS/Scanner.GSOS.h b/scsi2/AppleScanGS/Scanner.GSOS.h new file mode 100644 index 0000000..89d61cc --- /dev/null +++ b/scsi2/AppleScanGS/Scanner.GSOS.h @@ -0,0 +1 @@ +extern void Scanner_Open(); extern Long Scanner_Read(); extern void Scanner_Close(); extern void Scanner_Scan(); extern void Scanner_DefWindow(); extern void Scanner_SetHalfTones(); extern void Scanner_SetMode(); extern void CPCScan_SetMode(); extern void CPCScan_GetMode(); extern void CPC_GDStatus(); extern void CPC_XSense(); extern void CPC_Read(); extern void CPC_Unload(); extern Long CPC_Scan(); extern void Scan_Inquiry(); \ No newline at end of file diff --git a/scsi2/AppleScanGS/ScannerDefs.h b/scsi2/AppleScanGS/ScannerDefs.h new file mode 100644 index 0000000..ceec8a4 --- /dev/null +++ b/scsi2/AppleScanGS/ScannerDefs.h @@ -0,0 +1 @@ +#define fFamily0 0x1 #define fFamily1 0x2 #define fFamily2 0x3 /**********************************/ /* */ /* window resource ID definitions */ /* */ /**********************************/ #ifdef RezIIGS #define ImageWindow 0x00000001 #define ScannerWindow 0x00001100 #define PreviewWindow 0x00001200 #define PrefWindow 0x00001300 #define SettingsWindow 0x00001400 #define ThermWindow 0x00001500 #else #define ImageWindow 0x00000001L #define ScannerWindow 0x00001100L #define PreviewWindow 0x00001200L #define PrefWindow 0x00001300L #define SettingsWindow 0x00001400L #define ThermWindow 0x00001500L #endif #ifdef RezIIGS #define ScannerWindowID 0x00001101 #define PreviewWindowID 0x00001201 #define PrefWindowID 0x00001301 #else #define ScannerWindowID 0x00001101L #define PreviewWindowID 0x00001201L #define PrefWindowID 0x00001301L #endif #ifdef RezIIGS #define SettingsWindowID 0x00001401 #define CompositionPopUp 0x00001410 #define CompositionPopUpItem1 0x00001411 #define CompositionPopUpItem2 0x00001412 #define CompositionPopUpItem3 0x00001413 #define XResolutionPopUp 0x00001420 #define XResolutionPopUpItem1 0x00001421 #define XResolutionPopUpItem2 0x00001422 #define XResolutionPopUpItem3 0x00001423 #define XResolutionPopUpItem4 0x00001424 #define XResolutionPopUpItem5 0x00001425 #define YResolutionPopUp 0x00001430 #define YResolutionPopUpItem1 0x00001431 #define YResolutionPopUpItem2 0x00001432 #define YResolutionPopUpItem3 0x00001433 #define YResolutionPopUpItem4 0x00001434 #define YResolutionPopUpItem5 0x00001435 #define BrightnessScroll 0x00001440 #define BrightnessStatText 0x00001441 #define ContrastScroll 0x00001450 #define ContrastStatText 0x00001451 #define ThresholdScroll 0x00001460 #define ThresholdStatText 0x00001461 #define ScanButton 0x00001470 #define PreviewButton 0x00001480 #else #define SettingsWindowID 0x00001401L #define CompositionPopUp 0x00001410L #define CompositionPopUpItem1 0x00001411L #define CompositionPopUpItem2 0x00001412L #define CompositionPopUpItem3 0x00001413L #define XResolutionPopUp 0x00001420L #define XResolutionPopUpItem1 0x00001421L #define XResolutionPopUpItem2 0x00001422L #define XResolutionPopUpItem3 0x00001423L #define XResolutionPopUpItem4 0x00001424L #define XResolutionPopUpItem5 0x00001425L #define YResolutionPopUp 0x00001430L #define YResolutionPopUpItem1 0x00001431L #define YResolutionPopUpItem2 0x00001432L #define YResolutionPopUpItem3 0x00001433L #define YResolutionPopUpItem4 0x00001434L #define YResolutionPopUpItem5 0x00001435L #define BrightnessScroll 0x00001440L #define BrightnessStatText 0x00001441L #define ContrastScroll 0x00001450L #define ContrastStatText 0x00001451L #define ThresholdScroll 0x00001460L #define ThresholdStatText 0x00001461L #define ScanButton 0x00001470L #define PreviewButton 0x00001480L #endif #ifdef RezIIGS #define PalletteWindowID 0x00001501 #define ToolWindowID 0x00001601 #else #define PalletteWindowID 0x00001501L #define ToolWindowID 0x00001601L #endif /********************************/ /* */ /* Menu resource ID definitions */ /* */ /********************************/ #define AppleMenuID 0x901 #define FileMenuID 0x902 #define EditMenuID 0x903 #define ScanMenuID 0x904 #define UndoID 250 /* For DA's */ #define CutID 251 /* For DA's */ #define CopyID 252 /* For DA's */ #define PasteID 253 /* For DA's */ #define ClearID 254 /* For DA's */ #define CloseID 255 /* For DA's */ #define AboutID CloseID+1 #define OpenID AboutID+1 #define SaveID OpenID+1 #define SaveAsID SaveID+1 #define PrefID SaveAsID+1 #define PrintID PrefID+1 #define QuitID PrintID+1 #define SettingsID QuitID+1 #define PreviewID SettingsID+1 /********************************/ /* */ /* Alert String resource IDs */ /* */ /********************************/ #define AboutBox 1 #define noMemAvailable 2 #define noScannerFound 3 #define scannerNotReady 4 \ No newline at end of file diff --git a/scsi2/AppleScanGS/Utils.c b/scsi2/AppleScanGS/Utils.c new file mode 100644 index 0000000..11accb3 --- /dev/null +++ b/scsi2/AppleScanGS/Utils.c @@ -0,0 +1 @@ +#include #include #include #include #include #include #include #include "scan.h" /* include the following line to use Tool039 * #include "scToolSet.h" */ char test[80]; #if 0 /**********************************************************************/ void pdlWait() { unsigned int i; for (;;) { GrafOff(); for (;;) { for (i = 2; i; i--) { if (*((char *)(0xE0C060 + i)) & 0x80) break; } if (i) break; } GrafOn(); for (; *((char *)(0xE0C060 + i)) & 0x80;) { if (*((char *)(0xE0C063 - i)) & 0x80) return; } if (i == 1) return; } } /**********************************************************************/ void sbug(str) char *str; { if (*((char *)0xE0C061) >= 0x80) return; InitTextDev(1); WriteCString(str); pdlWait(); } /**********************************************************************/ void stack() { unsigned int stk; asm { tsc sta stk } sprintf(test, "stack=%X", stk); sbug(test); } #endif asm (SwapBytes) { lda 4,s xba rtl } asm (SwapWords) { lda 4,s /* swap the words, and swap the bytes inside of those words */ xba tax lda 6,s xba rtl } /*********************************************************************************************/ long doScan(bufferHandle, bufferSize, sWindowDef, Width, Length) Handle bufferHandle; unsigned long bufferSize, Width, Length; scannerWindowDef *sWindowDef; { extern Long (*Setup[])(); unsigned long requestCount, transferCount; Scanner_Open(); transferCount = (*Setup[Scanner_Type])(bufferHandle, bufferSize, sWindowDef, Width, Length); Scanner_Close(); return(transferCount); } long Setup_Apple(bufferHandle, bufferSize, sWindowDef, Width, Length) Handle bufferHandle; unsigned long bufferSize, Width, Length; scannerWindowDef *sWindowDef; { unsigned long requestCount, transferCount; Scanner_SetMode(); Scanner_SetHalfTones(); Scanner_DefWindow(sWindowDef); Scanner_Scan(); transferCount = Scanner_Read(*bufferHandle, bufferSize); return(transferCount); } long Setup_CPCScan(bufferHandle, bufferSize, sWindowDef, Width, Length) Handle bufferHandle; unsigned long bufferSize, Width, Length; scannerWindowDef *sWindowDef; { unsigned long requestCount, transferCount; transferCount = CPC_Scan(*bufferHandle, bufferSize, Width, Length); return(transferCount); } #ifndef __scToolSet__ /* original version */ int findScanner() { int retcode = 1; /* assume we're gonna find a scanner */ char cmdData[16]; /* need 16 bytes for Command Data list */ ResultBuf32 devName; DInfoRecGS devInfo; DAccessRecGS devStatus; extern int scanDevnum; devInfo.pCount = 8; /* we need the device ID */ devInfo.devNum = 1; /* start at the first device */ devInfo.devName = &devName; devName.bufSize = 36; scanDevnum = 0; /* initialize scanner device number */ DInfoGS(&devInfo); /* make the call */ while(!_toolErr) { /* continue until we run out of devices */ if(devInfo.deviceID == 0x001a) { /* is this a SCSI scanner? */ scanDevnum = devInfo.devNum; /* yes, save the device number */ break; /* and exit */ } ++devInfo.devNum; /* check the next device */ DInfoGS(&devInfo); } if(_toolErr && (_toolErr != 0x11)) { InitCursor(); ErrorWindow(0,NULL,_toolErr); WaitCursor(); } if(!scanDevnum) { InitCursor(); retcode = AlertWindow(4, NULL, (long) noScannerFound); WaitCursor(); } else { /* we have a scanner DIB, let's make sure it's ready for us */ devStatus.pCount = 5; /* set up for DStatus call */ devStatus.devNum = scanDevnum; devStatus.code = 0x8000; /* TestUnitReady status call */ devStatus.list = (Ptr) cmdData; memset(cmdData,0,16); /* set to all zeros */ devStatus.requestCount = 0; /* not used for this call */ DStatusGS(&devStatus); while(_toolErr) { /* if we get an error, let the user know */ InitCursor(); retcode = AlertWindow(4, NULL, (long) scannerNotReady); WaitCursor(); if(!retcode) /* user clicked QUIT */ break; else if(retcode == 2) { /* user clicked "Continue" */ scanDevnum = 0; /* pretend we didn't find a scanner */ break; } else { /* user clicked on "Try Again" */ DStatusGS(&devStatus); /* do the status call again */ DStatusGS(&devStatus); /* and again to make sure the SCSI bus is initialized */ } } } return(retcode); } #else /* new version which uses the toolset */ int findScanner() { int retcode = 1; /* assume we're gonna find a scanner */ extern int scanDevnum; scanDevnum = 0; /* initialize scanner device number */ /* start up the toolset here */ scStartUp(); switch(_toolErr) { case 0: /* no error */ scanDevnum = scGetDevNum(); /* get the device number from the toolset */ break; case scNotFoundErr: InitCursor(); retcode = AlertWindow(4, NULL, (long) noScannerFound); WaitCursor(); break; case scScannerErr: while(_toolErr) { /* if we get an error, let the user know */ InitCursor(); retcode = AlertWindow(4, NULL, (long) scannerNotReady); WaitCursor(); if(!retcode) /* user clicked QUIT */ break; else if(retcode == 2) { /* user clicked "Continue" */ scanDevnum = 0; /* pretend we didn't find a scanner */ break; } else { /* user clicked on "Try Again" */ scStartUp(); /* so try to start up the toolset again */ } } break; default: InitCursor(); ErrorWindow(0,NULL,_toolErr); WaitCursor(); } return(retcode); } #endif void testPause() { SysBeep(); SysBeep(); while (*(char *) 0xe0c000 < 128) ; *(char *) 0xe0c010 = 0; } \ No newline at end of file diff --git a/scsi2/AppleScanGS/Window.c b/scsi2/AppleScanGS/Window.c new file mode 100644 index 0000000..02b3677 --- /dev/null +++ b/scsi2/AppleScanGS/Window.c @@ -0,0 +1 @@ +/*********************************************************************** * * Window.c * * Copyright (c) 1990 * Apple Computer, Inc. * All Rights Reserved. * * This file contains the code which implements * windows in the scanner program. * ***********************************************************************/ #include #include #include #include #include #include #include #include #include #include #include #include "Scan.h" #define xRulerInset 10 #define yRulerInset 10 extern scannerWindowDef sWindowDef; extern unsigned int staggerCount; extern PicHndl previewRuler; void updatePreviewWindow(); extern GrafPortPtr previewWindowPtr; extern GrafPortPtr settingsWindowPtr; /* grayscale pallette */ int cTable[16]= {0x000,0x111,0x222,0x333,0x444,0x555,0x666,0x777, 0x888,0x999,0xAAA,0xBBB,0xCCC,0xDDD,0xEEE,0xFFF}; /* standard pallette */ int defCTable[16] = {0x000,0x777,0x841,0x72C,0x00F,0x080,0xF70,0xD00, 0xFA9,0xFF0,0x0E0,0x4DF,0xDAF,0x78F,0xCCC,0xFFF}; /*************************************************************************************************/ static CtlRecHndl makeBoxCtl(theWindow) GrafPortPtr theWindow; { CtlRecHndl boxCtl; static Rect boxRect = { YINSET,XINSET,YINSET+(11*vPPI)+1,XINSET+((85*hPPI)/10)+1 }; static int boxData[] = { YINSET, /* min Y */ XINSET, /* min X */ YINSET+(14*vPPI)+1, /* max Y */ XINSET+((85*hPPI)/10)+1,/* max X */ 10, /* minimum height */ 16, /* minimum width */ 1, /* grid Y */ 1 }; /* grid X */ static int boxColorTbl = 0x00B0; extern void BoxProc(); boxCtl = NewControl(theWindow,&boxRect,NULL,0x0006,0x0303,boxData,BoxProc,NULL,&boxColorTbl); /* | | | | | | | | ColorTable | | | | | | | RefCon | | | | | | DefProc | | | | | custom data | | | | width/heighth of knobs | | | ctlFlag | | title pointer | control rectangle window pointer */ if(_toolErr) ErrorWindow(0,NULL,_toolErr); return(boxCtl); } openPreview() { #define bufferSize 968L Handle tempHandle, bufferHandle; LocInfoPtr theLocInfo; GrafPortPtr theWindow; Rect *theRect; int fontWidth, rulerDepth1,rulerDepth2; unsigned i; if(previewWindowPtr != NULL) { SelectWindow(previewWindowPtr); } else { bufferHandle = NewHandle(bufferSize,_ownerid,attrFixed,NULL); if(_toolErr != 0) { AlertWindow(4,NULL,(long) noMemAvailable); } else { tempHandle = NewHandle((long)sizeof(LocInfo),_ownerid,attrFixed,NULL); theLocInfo = (LocInfoPtr)*tempHandle; theLocInfo->portSCB = (sWindowDef.bitsPerPixel == 4) ? 0x80 : 0; theLocInfo->ptrToPixImage = *bufferHandle; theLocInfo->width = (104 * sWindowDef.bitsPerPixel + 7)/8; theLocInfo->boundsRect.v1 = 0; theLocInfo->boundsRect.h1 = 0; theLocInfo->boundsRect.v2 = 149; theLocInfo->boundsRect.h2 = 104; theWindow = NewWindow2(NULL,theLocInfo,updatePreviewWindow,NULL,2,PreviewWindow,rWindParam1); SetPort(theWindow); previewWindowPtr = theWindow; SetDataSize(180,120,theWindow); makeBoxCtl(theWindow); /* go add the custom control */ if((previewRuler == NULL)) { fontWidth = 8; SetOrigin(0,0); GetPortRect(&theRect); rulerDepth1 = fontWidth+7; rulerDepth2 = (2*fontWidth)+7; previewRuler = OpenPicture(&theRect); MoveTo(XINSET-XOFFSET,YINSET); /* draw the vertical ruler first */ /* draw hash marks */ for(i = 0; i < 14; ++i) { Move(0,vPPI>>1); /* move to first hash mark */ Line(-3,0); /* draw half-inch mark */ Move(-4,vPPI>>1); /* move to full hash mark */ Line(7,0); /* draw full-inch mark */ } Move(0,-((vPPI*14)-4)); /* move back to top of ruler + 4 to center numerals */ /* mark the ruler divisions */ for(i = 2; i < 10; i += 2) { Move(-rulerDepth1,vPPI<<1); DrawChar('0'+i); Move(7,0); } for(i = 10; i < 14; i += 2) { Move(-rulerDepth2,vPPI<<1); DrawChar('1'); DrawChar('0'+(i-10)); Move(7,0); } Move(0,(vPPI*2)-4); /* position pen to bottom right corner */ /* then draw the ruler rectangle */ Line(-27,0); /* bottom */ Line(0,-(vPPI*14)); /* left side */ Line(27,0); /* top */ Line(0,(vPPI*14)); /* right side of ruler box */ /* now draw the ruler along the top */ Move(XOFFSET,-(vPPI*14+YOFFSET)); /* vertical ruler stopped at bottom right corner */ /* draw the hash marks */ for(i = 0; i < 8; ++i) { Move(hPPI>>1,0); Line(0,-2); Move(hPPI>>1,-2); Line(0,4); } Move(hPPI>>1,0); /* the 8 1/2 mark */ Line(0,-2); Move(-((hPPI*8)+(hPPI>>1)-(fontWidth>>1)),2); /* reposition back to start of ruler */ /* draw the ruler divisions */ for(i = 2; i < 10; i += 2) { Move((hPPI<<1)-fontWidth,-5); DrawChar('0'+i); Move(0,5); } Move((hPPI>>1)-(fontWidth>>1),0); /* move to lower-right corner of ruler */ /* draw the ruler frame */ Line(0,-14); Line(-((hPPI*8)+(hPPI>>1)),0); Line(0,14); Line(((hPPI*8)+(hPPI>>1)),0); ClosePicture(); } EnableMItem(CloseID); } } } #if 0 /* is this used? */ /***********************************************************************/ void drawMousePos(){ MouseRec thisMouseRec; CtlRecHndl ctlHandle; GrafPortPtr thisPort; Pointer theXArrayList[1]; Pointer theYArrayList[1]; static char xString[] = {"0000"}; static char yString[] = {"0000"}; theXArrayList[0] = xString; theYArrayList[0] = yString; if(settingsWindowPtr != 0){ thisMouseRec = ReadMouse(); /* thisPort = GetPort(); SetPort(settingsWindowPtr); */ /* ctlHandle = GetCtlHandleFromID(settingsWindowPtr,WinXEndText); Int2Dec(thisMouseRec.xPos,xString,4,FALSE); SetCtlParamPtr(theXArrayList); DrawOneCtl(ctlHandle); ctlHandle = GetCtlHandleFromID(settingsWindowPtr,WinYEndText); Int2Dec(thisMouseRec.yPos,yString,4,FALSE); SetCtlParamPtr(theYArrayList); DrawOneCtl(ctlHandle); */ /* SetPort(thisPort); */ } } /*********************************************************************** * * doInPreview * * This routine draws the contents of all the windows. * ***********************************************************************/ void doInPreview(mouseStart) Point mouseStart; { CtlRecHndl ctlHandle; Pointer theXArrayList[1]; Pointer theYArrayList[1]; static char xString[] = {"0000"}; static char yString[] = {"0000"}; Rect limitRect,slopRect; Point mouseEnd; word dragFlag, penMode; Long changePos; static char test[32]={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}; static char penMaskUnDraw[32]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; theXArrayList[0] = xString; theYArrayList[0] = yString; penMode = GetPenMode(); /* SetPenMode(modeXOR); SetPenMask( */ if(((dragRect.v1)|(dragRect.h1)|(dragRect.v2)|(dragRect.h2))) { FrameRect(&dragRect); } GetPortRect(&slopRect); limitRect.v1 = slopRect.v1 + YINSET-1; limitRect.h1 = slopRect.h1 + XINSET-4; limitRect.v2 = slopRect.v2 -5; limitRect.h2 = slopRect.h2 -109; GlobalToLocal(&mouseStart); if(mouseStart.h < limitRect.h1) mouseStart.h = limitRect.h1; if(mouseStart.v < limitRect.v1) mouseStart.v = limitRect.v1; if(mouseStart.h > limitRect.h2) mouseStart.h = limitRect.h2; if(mouseStart.v > limitRect.v2) mouseStart.v = limitRect.v2; /* ctlHandle = GetCtlHandleFromID(settingsWindowPtr,WinYStartText); Int2Dec(mouseStart.v,yString,4,FALSE); SetCtlParamPtr(theYArrayList); DrawOneCtl(ctlHandle); ctlHandle = GetCtlHandleFromID(settingsWindowPtr,WinXStartText); Int2Dec(mouseStart.h,xString,4,FALSE); SetCtlParamPtr(theXArrayList); DrawOneCtl(ctlHandle); */ SetRect(&dragRect,mouseStart,mouseStart.h+2,mouseStart.v+2); dragFlag = 0x0424; /* minimum of 4 pixels, return the final rect, drag rubberband rectangle */ DragRect(drawMousePos,test,mouseStart.h,mouseStart.v,&dragRect,&limitRect,&slopRect,dragFlag); FrameRect(&dragRect); SetPenMode(penMode); } #endif /*********************************************************************** * * drawThisWindow * * This routine draws the contents of all the windows. * ***********************************************************************/ void drawThisWindow() { DrawControls(GetPort()); } /*********************************************************************** * * doCloseTop * * This routine closes the topmost window. We do a little work to * prevent the main window from being closed. * ***********************************************************************/ void doCloseTop() { GrafPortPtr tempWin; LocInfoPtr theLocInfo; char **nameHndl; unsigned int k; tempWin = FrontWindow(); if(tempWin == previewWindowPtr) { previewWindowPtr = NULL; } if(tempWin == settingsWindowPtr) { settingsWindowPtr = NULL; } if(tempWin != NULL) { if (theLocInfo = (LocInfoPtr)GetWRefCon(tempWin)) { DisposeHandle(FindHandle(theLocInfo->ptrToPixImage)); DisposeHandle(FindHandle(theLocInfo)); } nameHndl = (char **) GetWTitle(tempWin); /* was the name allocated by us? */ if(!((long) nameHndl & 0x80000000)) /* not if it's a handle */ free(nameHndl); /* else dipose of it */ CloseWindow(tempWin); } if(!FrontWindow()) DisableMItem(CloseID); } /*********************************************************************** * * openThisWindow * * This routine either opens the specified window or brings it to the top * if it is already open. * * If it is not open, we open it with NewWindow2 invisibly, adjust the window's * location and then show and select the window. * ***********************************************************************/ GrafPortPtr openThisWindow(ctlid) unsigned long ctlid; { GrafPortPtr wptr; wptr = NewWindow2(NULL, NULL, drawThisWindow, NULL, 2, ctlid, rWindParam1); if (ctlid < AppWindow) { MoveWindow (50 + 8 * staggerCount, 50 + 8 * staggerCount, wptr); staggerCount++; staggerCount &= 0x0F; } SelectWindow(wptr); return(wptr); } /*********************************************************************** * * setupWindows - initializes window stuff prior to entering event loop * ***********************************************************************/ void setupWindows() { extern void doSettingsItem(); doSettingsItem(); return; } /*********************************************************************** * * updateScannerWindow() * * updates the bit mapped windows with the scanned data. * ***********************************************************************/ void updateScannerWindow() { LocInfoPtr theSrcLoc = (LocInfoPtr)GetWRefCon(GetPort()); PPToPort(theSrcLoc,&theSrcLoc->boundsRect,0,0,notCopy); if (_toolErr) ErrorWindow(0,NULL, _toolErr); } /*********************************************************************** * * updatePreviewWindow() * * updates the bit mapped windows with the scanned data. * ***********************************************************************/ void updatePreviewWindow() { Rect theRect, pageRect; LocInfoPtr theSrcLoc = (LocInfoPtr)GetWRefCon(GetPort()); GetPortRect(&theRect); DrawPicture(previewRuler,&theRect); /* if((dragRect.h1|dragRect.h2|dragRect.v1|dragRect.v2) != 0) { FrameRect(&dragRect); } */ pageRect.v1 = YINSET-1; pageRect.v2 = YINSET + (14 * vPPI) + 2; pageRect.h1 = XINSET-1; pageRect.h2 = XINSET + (8 * hPPI) + (hPPI >> 1) + 2; SetSolidPenPat(7); FrameRect(&pageRect); if (_toolErr) ErrorWindow(0,NULL,_toolErr); SetSolidPenPat(0); DrawControls(previewWindowPtr); } /*********************************************************************** * * doOpenImage * * ***********************************************************************/ void doOpenImage(dataWidth, dataLength, bufferHandle) unsigned long dataWidth, dataLength; Handle bufferHandle; { char *windowName; LocInfoPtr theLocInfo; GrafPortPtr theWindow; Handle tempHandle; int mode; int pixelWidth; static char windNum = '1'; /* Check the screen mode and multiply by 2 if 640 */ mode = (GetMasterSCB() & 0x0080) ? 1 : 2; pixelWidth = (dataWidth * 8) >> mode; tempHandle = NewHandle((long)sizeof(LocInfo),_ownerid,attrFixed,NULL); theLocInfo = (LocInfoPtr)*tempHandle; theLocInfo->portSCB = (mode == 2) ? 0x00 : 0x80; theLocInfo->ptrToPixImage = *bufferHandle; theLocInfo->width = dataWidth; theLocInfo->boundsRect.v1 = 0; theLocInfo->boundsRect.h1 = 0; theLocInfo->boundsRect.v2 = dataLength; theLocInfo->boundsRect.h2 = pixelWidth; windowName = malloc(12); /* get memory for window title */ memcpy(windowName,"\p Untitled ",12); windowName[10] = windNum; if(++windNum > '9') /* adjust window number for next time through */ windNum = '1'; theWindow = NewWindow2(windowName,theLocInfo,updateScannerWindow,NULL,2,ImageWindow,rWindParam1); SetPort(theWindow); SetDataSize(pixelWidth,(short)dataLength,theWindow); EnableMItem(CloseID); free(windowName); } \ No newline at end of file diff --git a/scsi2/AppleScanGS/doScan..aii b/scsi2/AppleScanGS/doScan..aii new file mode 100644 index 0000000..dc30691 --- /dev/null +++ b/scsi2/AppleScanGS/doScan..aii @@ -0,0 +1 @@ +/*********************************************************************************************/ long doScan(bufferHandle, bufferSize, sWindowDef, Width, Length) Handle bufferHandle; unsigned long bufferSize, Width, Length; scannerWindowDef *sWindowDef; { extern Long (*Setup[])(); unsigned long requestCount, transferCount; Scanner_Open(); transferCount = (*Setup[Scanner_Type])(bufferHandle, bufferSize, sWindowDef, Width, Length); Scanner_Close(); return(transferCount); } long Setup_Apple(bufferHandle, bufferSize, sWindowDef, Width, Length) Handle bufferHandle; unsigned long bufferSize, Width, Length; scannerWindowDef *sWindowDef; { unsigned long requestCount, transferCount; Scanner_SetMode(); Scanner_SetHalfTones(); Scanner_DefWindow(sWindowDef); Scanner_Scan(); transferCount = Scanner_Read(*bufferHandle, bufferSize); return(transferCount); } long Setup_CPCScan(bufferHandle, bufferSize, sWindowDef, Width, Length) Handle bufferHandle; unsigned long bufferSize, Width, Length; scannerWindowDef *sWindowDef; { unsigned long requestCount, transferCount; transferCount = CPC_Scan(*bufferHandle, bufferSize, Width, Length); return(transferCount); } \ No newline at end of file diff --git a/scsi2/AppleScanGS/xSaveFile.c b/scsi2/AppleScanGS/xSaveFile.c new file mode 100644 index 0000000..71f0e13 --- /dev/null +++ b/scsi2/AppleScanGS/xSaveFile.c @@ -0,0 +1 @@ +#include #include #include #include #include #include #include typedef struct { long blkSize; char identLen; char ident[4]; int mscb; int pixPerLine; int palletteCount; int pallette[16]; int scanLines; } infoBlockHdr; typedef struct { int numBytes; int modeWord; } dirEntry; infoBlockHdr picHeader = { 0, /* size of data block (get's filled in) */ 4, {'M', 'A', 'I', 'N'}, 0, /* master control word */ 320, /* pixels per scan line */ 1, /* number of pallettes */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* pallette */ 200 /* # of scan lines */ }; CreateRecGS createblk; NameRecGS destroyblk; OpenRecGS openblk; IORecGS readblk; IORecGS writeblk; RefNumRecGS closeblk; SetPositionRecGS setpositionblk; typedef struct { word slices; word width; char image[8 * 11]; char mask[8 * 11]; Point hotSpot; } myCursor; #define hotY 0 #define hotX 2 static myCursor cursor0 = { 11, 4, /* 0 */ { 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x0f,0x00,0x00,0x0f,0x00,0x00,0x00, 0x00,0xf0,0x00,0xf0,0x00,0xf0,0x00,0x00, 0x00,0xf0,0xff,0xf0,0x00,0xff,0x00,0x00, 0x00,0xf0,0x00,0x00,0x00,0xf0,0x00,0x00, 0x00,0x0f,0x00,0x00,0x0f,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00 }, { 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x0f,0xff,0xff,0xff,0x00,0x00,0x00, 0x00,0xff,0xff,0xff,0xff,0xf0,0x00,0x00, 0x00,0xff,0xff,0xff,0xff,0xff,0x00,0x00, 0x00,0xff,0xff,0xff,0xff,0xf0,0x00,0x00, 0x00,0x0f,0xff,0xff,0xff,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00 }, hotY, hotX }; static myCursor cursor1 = { 11, 4, /* 1 */ { 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x0f,0xf0,0x00,0x0f,0x00,0x00,0x00, 0x00,0xf0,0x0f,0xf0,0x00,0xf0,0x00,0x00, 0x00,0xf0,0x00,0xf0,0x00,0xff,0x00,0x00, 0x00,0xf0,0x00,0x00,0x00,0xf0,0x00,0x00, 0x00,0x0f,0x00,0x00,0x0f,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00 }, { 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x0f,0xff,0xff,0xff,0x00,0x00,0x00, 0x00,0xff,0xff,0xff,0xff,0xf0,0x00,0x00, 0x00,0xff,0xff,0xff,0xff,0xff,0x00,0x00, 0x00,0xff,0xff,0xff,0xff,0xf0,0x00,0x00, 0x00,0x0f,0xff,0xff,0xff,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00 }, hotY, hotX }; static myCursor cursor2 = { 11, 4, /* 2 */ { 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x0f,0x00,0xf0,0x0f,0x00,0x00,0x00, 0x00,0xf0,0x00,0xf0,0x00,0xf0,0x00,0x00, 0x00,0xf0,0x00,0xf0,0x00,0xff,0x00,0x00, 0x00,0xf0,0x00,0x00,0x00,0xf0,0x00,0x00, 0x00,0x0f,0x00,0x00,0x0f,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00 }, { 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x0f,0xff,0xff,0xff,0x00,0x00,0x00, 0x00,0xff,0xff,0xff,0xff,0xf0,0x00,0x00, 0x00,0xff,0xff,0xff,0xff,0xff,0x00,0x00, 0x00,0xff,0xff,0xff,0xff,0xf0,0x00,0x00, 0x00,0x0f,0xff,0xff,0xff,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00 }, hotY, hotX }; static myCursor cursor3 = { 11, 4, /* 3 */ { 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x0f,0x00,0x00,0xff,0x00,0x00,0x00, 0x00,0xf0,0x00,0xff,0x00,0xf0,0x00,0x00, 0x00,0xf0,0x00,0xf0,0x00,0xff,0x00,0x00, 0x00,0xf0,0x00,0x00,0x00,0xf0,0x00,0x00, 0x00,0x0f,0x00,0x00,0x0f,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00 }, { 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x0f,0xff,0xff,0xff,0x00,0x00,0x00, 0x00,0xff,0xff,0xff,0xff,0xf0,0x00,0x00, 0x00,0xff,0xff,0xff,0xff,0xff,0x00,0x00, 0x00,0xff,0xff,0xff,0xff,0xf0,0x00,0x00, 0x00,0x0f,0xff,0xff,0xff,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00 }, hotY, hotX }; static myCursor cursor4 = { 11, 4, /* 4 */ { 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x0f,0x00,0x00,0x0f,0x00,0x00,0x00, 0x00,0xf0,0x00,0xf0,0x00,0xf0,0x00,0x00, 0x00,0xf0,0x00,0xff,0xf0,0xff,0x00,0x00, 0x00,0xf0,0x00,0x00,0x00,0xf0,0x00,0x00, 0x00,0x0f,0x00,0x00,0x0f,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00 }, { 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x0f,0xff,0xff,0xff,0x00,0x00,0x00, 0x00,0xff,0xff,0xff,0xff,0xf0,0x00,0x00, 0x00,0xff,0xff,0xff,0xff,0xff,0x00,0x00, 0x00,0xff,0xff,0xff,0xff,0xf0,0x00,0x00, 0x00,0x0f,0xff,0xff,0xff,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00 }, hotY, hotX }; static myCursor cursor5 = { 11, 4, /* 5 */ { 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x0f,0x00,0x00,0x0f,0x00,0x00,0x00, 0x00,0xf0,0x00,0xf0,0x00,0xf0,0x00,0x00, 0x00,0xf0,0x00,0xf0,0x00,0xff,0x00,0x00, 0x00,0xf0,0x00,0x0f,0x00,0xf0,0x00,0x00, 0x00,0x0f,0x00,0x00,0xff,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00 }, { 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x0f,0xff,0xff,0xff,0x00,0x00,0x00, 0x00,0xff,0xff,0xff,0xff,0xf0,0x00,0x00, 0x00,0xff,0xff,0xff,0xff,0xff,0x00,0x00, 0x00,0xff,0xff,0xff,0xff,0xf0,0x00,0x00, 0x00,0x0f,0xff,0xff,0xff,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00 }, hotY, hotX }; static myCursor cursor6 = { 11, 4, /* 6 */ { 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x0f,0x00,0x00,0x0f,0x00,0x00,0x00, 0x00,0xf0,0x00,0xf0,0x00,0xf0,0x00,0x00, 0x00,0xf0,0x00,0xf0,0x00,0xff,0x00,0x00, 0x00,0xf0,0x00,0xf0,0x00,0xf0,0x00,0x00, 0x00,0x0f,0x00,0xf0,0x0f,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00 }, { 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x0f,0xff,0xff,0xff,0x00,0x00,0x00, 0x00,0xff,0xff,0xff,0xff,0xf0,0x00,0x00, 0x00,0xff,0xff,0xff,0xff,0xff,0x00,0x00, 0x00,0xff,0xff,0xff,0xff,0xf0,0x00,0x00, 0x00,0x0f,0xff,0xff,0xff,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00 }, hotY, hotX }; static myCursor cursor7 = { 11, 4, /* 7 */ { 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x0f,0x00,0x00,0x0f,0x00,0x00,0x00, 0x00,0xf0,0x00,0xf0,0x00,0xf0,0x00,0x00, 0x00,0xf0,0x00,0xf0,0x00,0xff,0x00,0x00, 0x00,0xf0,0x0f,0x00,0x00,0xf0,0x00,0x00, 0x00,0x0f,0xf0,0x00,0x0f,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00 }, { 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x0f,0xff,0xff,0xff,0x00,0x00,0x00, 0x00,0xff,0xff,0xff,0xff,0xf0,0x00,0x00, 0x00,0xff,0xff,0xff,0xff,0xff,0x00,0x00, 0x00,0xff,0xff,0xff,0xff,0xf0,0x00,0x00, 0x00,0x0f,0xff,0xff,0xff,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xf0,0x00,0x00,0x00 }, hotY, hotX }; static myCursor *animCursor[8] = {&cursor0,&cursor1,&cursor2,&cursor3,&cursor4,&cursor5,&cursor6,&cursor7}; int SavePic(pathname, RefPtr) GSString255 *pathname; LocInfoPtr RefPtr; { extern int cTable[16]; char *invertBuf, *dummyBuf; char *srcptr,*dstptr; dirEntry *ScanLineDirectory; /* dynamic array */ unsigned cursNum = 0; unsigned counter = 0; unsigned linenum, srcSize, dstSize; unsigned lineWidth, numLines; unsigned i; int errNum; word oldSCB; long totalSize; WaitCursor(); lineWidth = RefPtr->width; /* get # of bytes per scan line */ numLines = RefPtr->boundsRect.v2 - RefPtr->boundsRect.v1; /* # of scan lines */ /* get memory for scan line directory array */ if(!(ScanLineDirectory = (dirEntry *) malloc(numLines * sizeof(dirEntry)))) return(0x54); if(!(dstptr = malloc(lineWidth))) { /* allocate memory for converted scan line */ free(ScanLineDirectory); return(0x54); /* return error condition */ } if(!(invertBuf = malloc(lineWidth + 160))) { /* allocate memory for inverted scan line */ free(dstptr); free(ScanLineDirectory); return(0x54); /* return error condition */ } destroyblk.pCount = closeblk.pCount = 1; destroyblk.pathname = pathname; DestroyGS(&destroyblk); createblk.pCount = 4; createblk.pathname = pathname; createblk.access = 0xE3; createblk.fileType = 0xC0; createblk.auxType = 2; CreateGS(&createblk); if(errNum = /* assignment */ _toolErr) goto goodbye2; /* messy, but efficient! */ openblk.pCount = 3; openblk.pathname = pathname; openblk.requestAccess = 2; /* write only */ OpenGS(&openblk); if(errNum = /* assignment */ _toolErr) goto goodbye2; SetMasterSCB((oldSCB = GetMasterSCB()) | 0x0100); /* make sure cursor doesn't flicker */ setpositionblk.pCount = 3; setpositionblk.refNum = closeblk.refNum = openblk.refNum; setpositionblk.base = 0; setpositionblk.displacement = totalSize = sizeof(picHeader) + (numLines * sizeof(dirEntry)); /* adjust EOF and mark past header fields of file */ SetEOFGS(&setpositionblk); if(errNum = /* assignment */ _toolErr) goto goodbye; /* messy, but efficient! */ SetMarkGS(&setpositionblk); if(errNum = /* assignment */ _toolErr) goto goodbye; /* messy, but efficient! */ writeblk.pCount = 4; writeblk.refNum = openblk.refNum; srcptr = RefPtr->ptrToPixImage; /* initialize source pointer */ writeblk.dataBuffer = dstptr; for(linenum = 0; linenum < numLines; ++linenum) { asm { /* invert the bytes of the scan line */ ldy #0 ; get the # of bytes in the line ldx #0xFFFF ; inverse mask sep #0x20 ; 8-bit accumulator loop: txa ; put inverse mask into accumulator eor [srcptr],y ; get the byte and invert it sta [invertBuf],y ; store in the destination buffer iny cpy lineWidth ; done yet? bcc loop ; no... #if 0 txa ; prepare to fill in remainder of scan line loop2: cpy #160 ; at least 320 pixels wide? bcs done ; yes... sta [invertBuf],y ; else fill it in iny bra loop2 done: #endif rep #0x20 ; back to 16-bit accumulator } srcptr += lineWidth; /* update source pointer */ srcSize = lineWidth; /* # of bytes per scan line */ dummyBuf = invertBuf; /* use temporary pointer for PackBytes */ dstSize = PackBytes(&dummyBuf,&srcSize,dstptr,lineWidth); totalSize += dstSize; /* accumulate total size */ ScanLineDirectory[linenum].numBytes = dstSize; ScanLineDirectory[linenum].modeWord = RefPtr->portSCB; writeblk.requestCount = dstSize; WriteGS(&writeblk); if(errNum = /* assignment */ _toolErr) goto goodbye; /* messy, but efficient! */ if(!(++counter & 7)) { /* update the cursor every eighth scan line processed */ SetCursor(animCursor[++cursNum]); if(!(cursNum < 7)) /* in other words, if cursNum >= 7 (but this produces better code) */ cursNum = -1; } } setpositionblk.displacement = 0; /* set file mark to beginning of file */ SetMarkGS(&setpositionblk); if(errNum = /* assignment */ _toolErr) goto goodbye; /* messy, but efficient! */ picHeader.blkSize = totalSize; /* fill in header fields */ picHeader.pixPerLine = RefPtr->width << (RefPtr->portSCB ? 2 : 1); /* pixels per line */ picHeader.scanLines = numLines; /* # of lines in image */ picHeader.mscb = RefPtr->portSCB; /* master SCB */ /* get the pallette into the header */ memcpy(picHeader.pallette,cTable,sizeof(picHeader.pallette)); writeblk.requestCount = sizeof(infoBlockHdr); writeblk.dataBuffer = (Ptr) &picHeader; WriteGS(&writeblk); if(errNum = /* assignment */ _toolErr) goto goodbye; /* messy, but efficient! */ writeblk.requestCount = numLines * sizeof(dirEntry); writeblk.dataBuffer = (Ptr) ScanLineDirectory; WriteGS(&writeblk); if(errNum = /* assignment */ _toolErr) goto goodbye; /* messy, but efficient! */ CloseGS(&closeblk); errNum = _toolErr; goodbye: SetMasterSCB(oldSCB); /* reset master SCB */ closeblk.refNum = 0; /* do a global close */ CloseGS(&closeblk); goodbye2: free(invertBuf); free(dstptr); free(ScanLineDirectory); InitCursor(); return(errNum); } \ No newline at end of file diff --git a/scsi2/SCANNERSCSI.S b/scsi2/SCANNERSCSI.S new file mode 100644 index 0000000..2bf8413 --- /dev/null +++ b/scsi2/SCANNERSCSI.S @@ -0,0 +1,1307 @@ +* +* SCANNER SCSI +* A test app for SCSI scanner commands +* +* (c) 2024, Brutal Deluxe Software +* Visit brutaldeluxe.fr +* + + xc + xc + mx %00 + + rel + dsk SCANNERSCSI.l + lst off + +*---------- + + use 4/Int.Macs + use 4/Locator.Macs + use 4/Mem.Macs + use 4/Misc.Macs + use 4/Text.Macs + use 4/Util.Macs + +Debut = $00 +GSOS = $e100a8 + +*---------- + +devSCANNER = $001a + +maxDEVICES = 8 + +dcINQUIRY = $8012 +doMODESELECT = $8015 +dcMODESENSE6 = $801a +dcSTARTSTOP = $801b ; also eject/insert +dcGETWINDOW24 = $8024 ; for scanner +dcGETWINDOW25 = $8025 ; for scanner +dcREADCAPACITY = $8025 +dcSUBCHANNEL = $8042 +dcREADTOC = $8043 +dcPATI = $8048 +dcPAUSERESUME = $804b +dcMODESENSE10 = $805a + +*---------- + + phk + plb + + tdc + sta myDP + + _TLStartUp + pha + _MMStartUp + pla + sta appID + ora #$0100 + sta myID + + _MTStartUp + _TextStartUp + + _IMStartUp + + pha + pha + PushLong #$010000 + PushWord myID + PushWord #%11000000_00011100 + PushLong #0 + _NewHandle + phd + tsc + tcd + lda [3] + sta ptrBUFFER + ldy #2 + lda [3],y + sta ptrBUFFER+2 + pld + ply + sty haBUFFER + plx + stx haBUFFER+2 + +*---------- + + PushWord #$00FF + PushWord #$0080 + _SetInGlobals + PushWord #$00FF + PushWord #$0080 + _SetOutGlobals + PushWord #$00FF + PushWord #$0080 + _SetErrGlobals + + PushWord #0 + PushLong #3 + _SetInputDevice + PushWord #0 + PushLong #3 + _SetOutputDevice + PushWord #0 + PushLong #3 + _SetErrorDevice + + PushWord #0 + _InitTextDev + PushWord #1 + _InitTextDev + PushWord #2 + _InitTextDev + + PushWord #$0c ; home + _WriteChar + +* DEBUG + + lda #proSTATUS + stal $300 + lda #^proSTATUS + stal $302 + + lda #proCONTROL + stal $310 + lda #^proCONTROL + stal $312 + +*---------------------------- +* MAIN MENU +*---------------------------- + +mainMENU = * + + PushLong #strMAINMENU + _WriteCString + + jsr waitFORKEY + cmp #"Q" + beq doQUIT + cmp #"q" + beq doQUIT + cmp #"1" + bne mainMENU + + jmp searchMENU + +*--- Data + +strMAINMENU asc 0d'SCANNER SCSI'0d + asc '(c) 2024, Brutal Deluxe Software'0d + asc ' 1. Search for SCSI Scanners'0d + asc ' Q. Quit'0d00 + +*---------------------------- +* QUIT PROGRAM +*---------------------------- + +doQUIT = * + + _IMShutDown + _TextShutDown + _MTShutDown + + PushWord myID + _DisposeAll + + PushWord appID + _MMShutDown + + _TLShutDown + + jsl GSOS + dw $2029 + adrl proQUIT + + brk $bd + +*---------------------------- +* SEARCH MENU +*---------------------------- + +searchMENU = * + + PushLong #strSEARCHMENU + _WriteCString + + jsr pollCDSCSI ; show CD-ROM devices + +]lp jsr waitFORKEY ; is it 0-9 + cmp #"0" + bcc ]lp + bne searchMENU2 + jmp mainMENU ; or even 0 to exit +searchMENU2 cmp #"9"+1 + bcs ]lp + + sec ; we have our device ID + sbc #"0" + cmp nbDEVICES ; in the 1-nbDEVICES range + bcc searchMENU3 + bne ]lp + +searchMENU3 dec + asl + tax + lda tblDEVICES,x + sta theDEVICE ; we have our device now + jmp deviceMENU + +*---------- Routines + +pollCDSCSI stz nbDEVICES ; number of SCSI CD-ROM found + + lda #1 ; start with device 1 + sta proDINFO+2 + +]lp jsl GSOS ; do a DInfo + dw $202c + adrl proDINFO + bcc found + + cmp #$0011 ; no more devices + bne loop + rts + +loop inc proDINFO+2 + bra ]lp + +*---------- Check it is a scanner + +found lda proDINFO+20 ; not SCANNER + cmp #devSCANNER + bne loop + +*--- We have a scanner + + lda nbDEVICES + asl + tax + lda proDINFO+2 + sta tblDEVICES,x + + jsr showDEVICEINFO + + inc nbDEVICES + lda nbDEVICES + cmp #maxDEVICES + bcc loop ; loop again + rts + +*--- Sub routines +* +* x - $xxxx - .NAMEOFDEVICE + +showDEVICEINFO + pha ; from a word to a string + pha + pha + _HexIt + PullLong strDEVID + + PushWord #$20 ; space + _WriteChar + + lda nbDEVICES ; write device index + inc + ora #"0" + pha + _WriteChar + + PushLong #strDEV ; show the string + _WriteCString + + lda devINFO1 ; from a STRL to a STR + xba + sta devINFO1 + + PushLong #devINFO2 + _WriteString + + PushWord #$0d + _WriteChar + rts + +*---------- Data + +strDEV asc ' - $' +strDEVID asc '0000 - '00 + +nbDEVICES ds 2 ; number of devices +theDEVICE ds 2 ; the device to play with +tblDEVICES ds 16*2 ; we authorize 16 devices + +strSEARCHMENU + asc 0d'Searching for SCSI Scanners...'0d + asc ' 0. Go back to previous menu'0d00 + +*---------------------------- +* DEVICE MENU +*---------------------------- + +deviceMENU = * + + lda theDEVICE ; get our ID + sta proSTATUS+2 + sta proCONTROL+2 + + pha ; from a word to a string + pha + pha + _HexIt + PullLong strDEVMENU + + PushLong #strDEVICEMENU + _WriteCString + +*--- + +]lp jsr waitFORKEY ; is it 0-9 + cmp #"0" + bcc ]lp + bne deviceMENU2 + jmp searchMENU ; or even 0 to exit +deviceMENU2 cmp #"5"+1 + bcs ]lp + + sec ; call the routines + sbc #"1" + asl + tax + lda ptrCOMMANDS,x + sta deviceMENU3+1 +deviceMENU3 jsr $bdbd + jmp deviceMENU + +ptrCOMMANDS da doINQUIRY + da doGWP2424 + da doGWP2425 + da doGWP2524 + da doGWP2525 + +*--- Data + +strDEVICEMENU asc 0d'Using SCSI Scanner device $' +strDEVMENU asc '0000'0d + asc ' 0. Go back to previous menu'0d + asc ' 1. Inquiry'0d + asc ' 2. Get Window Parameters 24/24'0d + asc ' 3. Get Window Parameters 24/25'0d + asc ' 4. Get Window Parameters 25/24'0d + asc ' 5. Get Window Parameters 25/25'0d + asc 00 + +*---------------- +* SCSI COMMANDS +*---------------- + +doINQUIRY = * + + jsr initSTATUSDATA + + ldx #6-2 ; put the inquiry data +]lp lda scsiINQUIRY,x + sta statusDATA,x + dex + dex + bpl ]lp + + lda #dcINQUIRY + jsr statusCALL + bcc doINQUIRY1 + rts + +doINQUIRY1 + +*--- Display data + +* Byte 0 + + PushLong #strPQ + _WriteCString + + lda statusBUFF + and #%11100000 + xba + ldx #3 + jsr showBITS + + PushLong #strPDT + _WriteCString + + lda statusBUFF + and #%00011111 + asl + asl + asl + xba + ldx #5 + jsr showBITS + +* Byte 1 + + PushLong #strRMB + _WriteCString + + lda statusBUFF+1 + and #%10000000 + xba + ldx #1 + jsr showBITS + + PushLong #strDTM + _WriteCString + + lda statusBUFF+1 + and #%01111111 + asl + xba + ldx #7 + jsr showBITS + +* Byte 2 + + PushLong #strISO + _WriteCString + + lda statusBUFF+2 + and #%11000000 + xba + ldx #2 + jsr showBITS + + PushLong #strECMA + _WriteCString + + lda statusBUFF+2 + and #%00111000 + asl + asl + xba + ldx #3 + jsr showBITS + + PushLong #strANSI + _WriteCString + + lda statusBUFF+2 + and #%00000111 + asl + asl + asl + asl + asl + xba + ldx #3 + jsr showBITS + +* Byte 3 + + PushLong #strAENC + _WriteCString + + lda statusBUFF+3 + and #%10000000 + xba + ldx #1 + jsr showBITS + + PushLong #strTRMIOP + _WriteCString + + lda statusBUFF+3 + and #%01000000 + asl + xba + ldx #1 + jsr showBITS + + PushLong #strRDF + _WriteCString + + lda statusBUFF+3 + and #%00001111 + asl + asl + asl + asl + xba + ldx #4 + jsr showBITS + +* Bytes 4..6 not used + +* Byte 7 + + PushLong #strRELADR + _WriteCString + + lda statusBUFF+7 + and #%10000000 + xba + ldx #1 + jsr showBITS + + PushLong #strWBUS32 + _WriteCString + + lda statusBUFF+7 + and #%01000000 + asl + xba + ldx #1 + jsr showBITS + + PushLong #strWBUS16 + _WriteCString + + lda statusBUFF+7 + and #%00100000 + asl + asl + xba + ldx #1 + jsr showBITS + + PushLong #strSYNC + _WriteCString + + lda statusBUFF+7 + and #%00010000 + asl + asl + asl + xba + ldx #1 + jsr showBITS + + PushLong #strLINKED + _WriteCString + + lda statusBUFF+7 + and #%00001000 + asl + asl + asl + asl + xba + ldx #1 + jsr showBITS + + PushLong #strCMDQUE + _WriteCString + + lda statusBUFF+7 + and #%00000010 + asl + asl + asl + asl + asl + asl + xba + ldx #1 + jsr showBITS + + PushLong #strSFTRE + _WriteCString + + lda statusBUFF+7 + and #%00000001 + asl + asl + asl + asl + asl + asl + asl + xba + ldx #1 + jsr showBITS + +* Bytes 8 + + PushLong #strVI + _WriteCString + + lda #8 ; offset is 8 + tax ; length is 8 + jsr showTEXT + +* Bytes 16 + + PushLong #strPI + _WriteCString + + lda #16 + tax + jsr showTEXT + +* Bytes 32 + + PushLong #strPRL + _WriteCString + + lda #32 + ldx #4 + jsr showTEXT + + jmp waitKEY + +*--- Data + +scsiINQUIRY hex 12,00,00,00,00,00 + +strPQ asc 0d' Peripheral qualifier: '00 +strPDT asc ' - Peripheral device type : '00 +strRMB asc 0d' RMB: '00 +strDTM asc ' - Device-type modifier: '00 +strISO asc 0d' ISO version: '00 +strECMA asc ' - ECMA version: '00 +strANSI asc ' - ANSI-approved version: '00 +strAENC asc 0d' AENC: '00 +strTRMIOP asc ' - TrmIOP: '00 +strRDF asc ' - Response data format: '00 +strRELADR asc 0d' RelAdr: '00 +strWBUS32 asc ' - WBus32: '00 +strWBUS16 asc ' - WBus16: '00 +strSYNC asc ' - Sync: '00 +strLINKED asc 0d' Linked: '00 +strCMDQUE asc ' - CmdQue: '00 +strSFTRE asc ' - SftRe: '00 +strVI asc 0d' Vendor identification: '00 +strPI asc 0d' Product identification: '00 +strPRL asc 0d' Product revision level: '00 + +*---------------- + +doGWP2424 lda #dcGETWINDOW24 + ldx #$24 + bra doGETWINDOW + +doGWP2425 lda #dcGETWINDOW24 + ldx #$25 + bra doGETWINDOW + +doGWP2524 lda #dcGETWINDOW25 + ldx #$24 + bra doGETWINDOW + +doGWP2525 lda #dcGETWINDOW25 + ldx #$25 + +doGETWINDOW sta doGETWIN0+1 + sep #$10 + stx scsiGETWIN + rep #$10 + + jsr initSTATUSDATA + + ldx #10-2 ; put the getwindow data +]lp lda scsiGETWIN,x + sta statusDATA,x + dex + dex + bpl ]lp + +doGETWIN0 lda #dcGETWINDOW24 + jsr statusCALL + bcc doGETWINDOW1 + rts + +doGETWINDOW1 + +*--- Check response length + + lda #statusBUFF + clc + adc #8 + sta Debut + lda #^statusBUFF + adc #0 + sta Debut+2 + +*--- Display Window identifier + + PushLong #strGWID + _WriteCString + + ldy #0 + lda [Debut],y + xba + jsr showBYTE + +*--- Display X-Axis resolution + + PushLong #strGWXRES + _WriteCString + + ldy #2 + lda [Debut],y + xba + jsr showWORD + +*--- Display Y-Axis resolution + + PushLong #strGWYRES + _WriteCString + + ldy #4 + lda [Debut],y + xba + jsr showWORD + +*--- Display X-Axis upper left + + PushLong #strGWXUL + _WriteCString + + ldy #6 + lda [Debut],y + xba + jsr showWORD + ldy #8 + lda [Debut],y + xba + jsr showWORD + +*--- Display Y-Axis upper left + + PushLong #strGWYUL + _WriteCString + + ldy #10 + lda [Debut],y + xba + jsr showWORD + ldy #12 + lda [Debut],y + xba + jsr showWORD + +*--- Display Window width + + PushLong #strGWWW + _WriteCString + + ldy #14 + lda [Debut],y + xba + jsr showWORD + ldy #16 + lda [Debut],y + xba + jsr showWORD + +*--- Display Window length + + PushLong #strGWWL + _WriteCString + + ldy #18 + lda [Debut],y + xba + jsr showWORD + ldy #20 + lda [Debut],y + xba + jsr showWORD + +*--- Display Brightness + + PushLong #strGWBR + _WriteCString + + ldy #22 + lda [Debut],y + jsr showBYTE + +*--- Display Threshold + + PushLong #strGWTH + _WriteCString + + ldy #23 + lda [Debut],y + jsr showBYTE + +*--- Display Contrast + + PushLong #strGWCO + _WriteCString + + ldy #24 + lda [Debut],y + jsr showBYTE + +*--- Display Image composition + + PushLong #strGWIC + _WriteCString + + ldy #25 + lda [Debut],y + and #$ff + pha + jsr showBYTE + pla + cmp #6+1 + bcc okGWIC + lda #6 +okGWIC asl + tax + + lda #^strGWIC00 + pha + lda ptrGWIC,x + pha + _WriteCString + +*--- Display Bits per pixel + + PushLong #strGWBPP + _WriteCString + + ldy #26 + lda [Debut],y + jsr showBYTE + +*--- Display Halftone pattern + + PushLong #strGWHP + _WriteCString + + ldy #27 + lda [Debut],y + xba + jsr showWORD + +*--- Display Padding type + + PushLong #strGWPT + _WriteCString + + ldy #29 + lda [Debut],y + and #%00000111 + cmp #4+1 + bcc okGWPT + lda #4 +okGWPT asl + tax + + lda #^strGWPT00 + pha + lda ptrGWPT,x + pha + _WriteCString + +*--- Display Bit ordering + + PushLong #strGWBO + _WriteCString + + ldy #30 + lda [Debut],y + xba + jsr showWORD + +*--- Display Compression type + + PushLong #strGWCT + _WriteCString + + ldy #32 + lda [Debut],y + and #$ff + cmp #$10+1 + bcc okGWCT + lda #$10 +okGWCT asl + tax + + lda #^strGWCT00 + pha + lda ptrGWCT,x + pha + _WriteCString + +*--- Display Compression argument + + PushLong #strGWCA + _WriteCString + + ldy #33 + lda [Debut],y + jsr showBYTE + +*--- We're done + + jmp waitKEY + +*--- Data + +scsiGETWIN hex 25,00,00,00,00,00,00,00,00,00 + +strGWID asc 0d'Window identifier: $'00 +strGWXRES asc 0d'X-Axis resolution: $'00 +strGWYRES asc 0d'Y-axis resolution: $'00 +strGWXUL asc 0d'X-Axis upper left: $'00 +strGWYUL asc 0d'Y-Axis upper left: $'00 +strGWWW asc 0d'Window width: $'00 +strGWWL asc 0d'Window length: $'00 +strGWBR asc 0d'Brightness: $'00 +strGWTH asc 0d'Threshold: $'00 +strGWCO asc 0d'Contrast: $'00 +strGWIC asc 0d'Image composition: $'00 +strGWBPP asc 0d'Bits per pixel: $'00 +strGWHP asc 0d'Halftone pattern: $'00 +strGWPT asc 0d'Padding type: $'00 +strGWBO asc 0d'Bit ordering: $'00 +strGWCT asc 0d'Compression type: $'00 +strGWCA asc 0d'Compression argument: $'00 + +ptrGWIC da strGWIC00 + da strGWIC01 + da strGWIC02 + da strGWIC03 + da strGWIC04 + da strGWIC05 + da strGWIC06 + +strGWIC00 asc ' (Bi-level black & white)'00 +strGWIC01 asc ' (Dithered/halftone black & white)'00 +strGWIC02 asc ' (Multi-level black & white (gray scale))'00 +strGWIC03 asc ' (Bi-level RGB colour)'00 +strGWIC04 asc ' (Dithered/halftone RGB colour)'00 +strGWIC05 asc ' (Multi-level RGB colour)'00 +strGWIC06 asc ' (Reserved)'00 + +ptrGWPT da strGWPT00 + da strGWPT01 + da strGWPT02 + da strGWPT03 + da strGWPT04 + +strGWPT00 asc ' (No boundary)'00 +strGWPT01 asc ' (Pad with 0s to byte boundary)'00 +strGWPT02 asc ' (Pad with 1s to byte boundary)'00 +strGWPT03 asc ' (Truncate by byte boundary)'00 +strGWPT04 asc ' (Reserved)'00 + +ptrGWCT da strGWCT00 + da strGWCT01 + da strGWCT02 + da strGWCT03 + da strGWCT04 + da strGWCT04 + da strGWCT04 + da strGWCT04 + da strGWCT04 + da strGWCT04 + da strGWCT04 + da strGWCT04 + da strGWCT04 + da strGWCT04 + da strGWCT04 + da strGWCT04 + da strGWCT10 + +strGWCT00 asc ' (No compression)'00 +strGWCT01 asc ' (CCITT group III, 1 dimensional)'00 +strGWCT02 asc ' (CCITT group III, 2 dimensional)'00 +strGWCT03 asc ' (CCITT group IV, 2 dimensional)'00 +strGWCT04 asc ' (Reserved)'00 +strGWCT10 asc ' (Optical character recognition)'00 + +*--- SCSI routines + +initSTATUSDATA ; clear SCSI command buffer + ldx #12-2 +]lp stz statusDATA,x + dex + dex + bpl ]lp + rts + +initCOMMANDDATA ; clear SCSI command buffer + ldx #12-2 +]lp stz commandDATA,x + dex + dex + bpl ]lp + rts + +*--- DStatus +* Uses the DStatus parm buffer + +statusCALL sta proSTATUS+4 ; SCSI driver command + sep #$20 ; SCSI commands are 8-bit + sta statusDATA ; SCSI command + rep #$20 + + jsl GSOS ; call it + dw $202d + adrl proSTATUS + bra showERR + +*--- DControl + +controlCALL sta proCONTROL+4 ; SCSI driver command + sep #$20 ; SCSI commands are 8-bit + sta commandDATA ; SCSI command + rep #$20 + + jsl GSOS ; call it + dw $202e + adrl proCONTROL + +*--- Show GS/OS error code + +showERR bcc showNOERR + sta errCODE ; save error code + + PushLong #strERROR + _WriteCString + + lda errCODE + jsr showWORD ; display it + + PushWord #$0d + _WriteChar + sec ; force carry +showNOERR rts + +*---------------------------- +* TEXT ROUTINES +*---------------------------- + +*---------- Display in string offset +* A: offset in +* X: nb of chars to print +* offset from commandBUFF + +showTEXT ldy #^commandBUFF + phy + clc + adc #commandBUFF + pha + PushWord #0 + phx + _TextWriteBlock + rts + +*---------- Display decimal +* A: word + +showDECIMAL and #$ff + pha + + lda #' ' ; space by default + sta strDECIMAL + + PushLong #strDECIMAL + PushWord #2 + PushWord #0 + _Int2Dec + + PushLong #strDECIMAL + _WriteCString + rts + +*--- Data + +strDECIMAL asc '00'00 + +*---------- Display bits +* A: word +* X: nb of bits to display (1-8) + +showBITS cpx #16 + bcc showBITS0 + rts + +showBITS0 ldy #0 ; index +]lp pha + asl ; bit in carry + bcs showBITS1 + + lda #'00' ; output 0 + bra showBITS2 +showBITS1 lda #'11' ; output 1 +showBITS2 sta strBITS,y + + pla + asl + iny + dex + bne ]lp + + lda #0 ; end C string + sta strBITS,y + + PushLong #strBITS ; show the string + _WriteCString + rts + +*--- Data + +strBITS ds 18 ; 16 bits + 2 zeros + +*---------- Display a byte + +showBYTE pha ; from a byte to a string + pha + pha ; <= here, really + _HexIt + + lda #' ' ; empty string by default + sta strBYTE + + pla ; we don't use + pla + sta strBYTE + + PushLong #strBYTEP ; show the string + _WriteString + rts + +*--- Data + +strBYTEP dfb 2 ; for a Pascal string +strBYTE asc ' ' + +*---------- Display a word + +showWORD pha ; from a word to a string + pha + pha ; <= here, really + _HexIt + PullLong strHEX + + PushLong #strHEX ; show the string + _WriteCString + rts + +*--- Data + +strHEX asc '0000'00 + +*---------- Wait for a key in a range 0-Acc +* A: high key +* X: high ptr to C string +* Y: low ptr to C string + +keyINRANGE sta keyHIGH + sty strKEY + stx strKEY+2 + +]lp PushLong strKEY + _WriteCString + + PushWord #0 + PushWord #1 ; echo char + _ReadChar + pla + and #$ff + cmp #"0" + bcc ]lp + cmp keyHIGH + bcc keyINRANGE9 + beq keyINRANGE9 + bra ]lp + +keyINRANGE9 sec + sbc #"0" + pha + bra waitKEY8 + +*--- Data + +strKEY ds 4 ; pointer to string +keyHIGH ds 2 + +*---------- Wait for a key + +waitKEY PushWord #$0d + _WriteChar + + PushWord #0 + PushWord #0 ; don't echo char + _ReadChar + bra waitKEY1 ; go below + +*---------- Wait for a key + +waitFORKEY PushLong #strINPUT + _WriteCString + + PushWord #0 ; wait for key + PushWord #1 ; echo char + _ReadChar + +waitKEY1 lda 1,s ; check CR + and #$ff ; of typed + sta 1,s ; in char + cmp #$8d + beq waitKEY9 + +waitKEY8 PushWord #$0d ; return + _WriteChar + +waitKEY9 pla ; restore entered char + rts + +*--- Data + +strINPUT asc 'Select an entry: '00 + +*---------------------------- +* DATA +*---------------------------- + +errCODE ds 2 ; GS/OS error code +strERROR asc 0d' GS/OS error code $'00 + +*--- + +proQUIT dw 2 ; pcount + ds 4 ; pathname + ds 2 ; flags + +proDINFO dw 8 ; Parms for DInfo + ds 2 ; 02 device num + adrl devINFO ; 04 device name + ds 2 ; 08 characteristics + ds 4 ; 0A total blocks + ds 2 ; 0E slot number + ds 2 ; 10 unit number + ds 2 ; 12 version + ds 2 ; 14 device id + +devINFO dw $0032 ; buffer size +devINFO1 db $00 ; length +devINFO2 db $00 +devINFO3 ds $30 ; data + +proSTATUS dw 5 ; 00 pcount + ds 2 ; 02 device num + dw $8000 ; 04 status/control code + adrl statusLIST ; 06 status list + adrl 1024 ; 0A request count + ds 4 ; 0E transfer count + +statusLIST ds 2 ; always 0000 +statusDATA hex 00 ; 00 + hex 00 ; 01 + hex 00 ; 02 + hex 00 ; 03 + hex 00 ; 04 + hex 00 ; 05 + hex 00 ; 06 + hex 00 ; 07 + hex 00 ; 08 + hex 00 ; 09 + hex 00 ; 10 + hex 00 ; 11 + adrl statusBUFF +statusBUFF ds 1234 ; more than 1024 + +proCONTROL dw 5 ; 00 pcount + ds 2 ; 02 device num + dw $8000 ; 04 status/control code + adrl controlLIST ; 06 status list + adrl 1024 ; 0A request count + ds 4 ; 0E transfer count + +controlLIST ds 2 ; always 0000 +commandDATA hex 00 ; 00 + hex 00 ; 01 + hex 00 ; 02 + hex 00 ; 03 + hex 00 ; 04 + hex 00 ; 05 + hex 00 ; 06 + hex 00 ; 07 + hex 00 ; 08 + hex 00 ; 09 + hex 00 ; 10 + hex 00 ; 11 +commandPTR adrl commandBUFF +commandBUFF ds 1234 ; more than 1024 + +*---------- + +appID ds 2 +myID ds 2 + +myDP ds 2 +ptrBUFFER ds 4 +haBUFFER ds 4 +