it scans...

...always in b&w
This commit is contained in:
Antoine Vignau 2024-08-18 22:25:57 +02:00
parent 210c84309f
commit ca27071da1
27 changed files with 5136 additions and 2231 deletions

15
scsi2/MAKE.S Normal file
View File

@ -0,0 +1,15 @@
* Expansion linker file
DSK SCANNERSCSI
TYP $B3
AUX $DB00
* Assemble files
ASM SCANNERSCSI.S
KND $0000
SNA ScannerSCSI
* END

Binary file not shown.

View File

@ -123,9 +123,19 @@ DControl = $202e
PushWord #2
_InitTextDev
PushWord #$0c ; home
PushWord #$0c ; home
_WriteChar
lda #previewPAGE
stal $300
lda #^previewPAGE
stal $302
lda #statusCALL
stal $310
lda #^statusCALL
stal $312
*----------------------------
* MAIN MENU
*----------------------------
@ -272,12 +282,12 @@ showDEVICEINFO
PushLong #strDEV ; show the string
_WriteCString
ldx #$32 ; copy the original
]lp lda devINFO1,x ; devname for open/close
sta devNAME,x ; calls
ldx #$32-2 ; copy the original
]lp lda devINFO1,x ; devname for open/close
sta devNAME,x ; calls
dex
dex
bpl ]lp
bpl ]lp
lda devINFO1 ; from a STRL to a STR
xba
@ -644,7 +654,7 @@ doINQUIRY1
*--- Data
scsiINQUIRY hex 12,00,00,00,00,00
scsiINQUIRY hex 12,00,00,00,F0,00
strPQ asc 0d' Peripheral qualifier: '00
strPDT asc ' - Peripheral device type : '00
@ -672,40 +682,58 @@ strPRL asc 0d' Product revision level: '00
*-----------------------
previewPAGE
jsr openSCANNER
jsr setMODE
jsr setWINDOW
jsr askforMEM
jsr scanSCANNER
jsr readSCANNER
jmp closeSCANNER
jsr openSCANNER
bit setMODE
bit setHALFTONES
jsr setWINDOW
jsr askforMEM
jsr scanSCANNER
jsr readSCANNER
jsr closeSCANNER
jmp saveFILE
*-----------------------
* OPEN THE SCANNER
*-----------------------
openSCANNER
PushLong #startOS
_WriteCString
jsl GSOS
dw $2010
adrl proOPEN
bcs os_err
lda proOPEN+2
sta proREAD+2
sta proCLOSE+2
lda theDEVICE
sta proWAIT+2
jsl GSOS
dw DControl
adrl proWAIT
bcs os_err
bcc os_ok
PushLong #openOS
_WriteCString
os_ok lda proOPEN+2
sta proREAD+2
sta proCLOSE+2
lda theDEVICE
sta proWAIT+2
jsl GSOS
dw DControl
adrl proWAIT
bcc os_ok2
PushLong #waitOS
_WriteCString
os_ok2 PushLong #endOS
_WriteCString
rts
os_err brk $b0
*---
startOS asc 0d'Start openSCANNER...'00
openOS asc ' (open not OK) '00
waitOS asc ' (wait not OK) '00
endOS asc 'End'00
proOPEN dw 2 ; 00 pcount
ds 2 ; 02 ref num
adrl devNAME ; 04 path name
@ -724,18 +752,30 @@ waitDATA dw 0 ; activate wait mode
*-----------------------
setMODE
PushLong #startSM
_WriteCString
lda theDEVICE
sta proSETMODE+2
jsl GSOS
dw DControl
adrl proSETMODE
bcs st_err
bcc st_ok
PushLong #controlSM
_WriteCString
st_ok PushLong #endSM
_WriteCString
rts
st_err brk $b2
*---
startSM asc 0d'Start setMODE...'00
controlSM asc ' (dcontrol not OK) '00
endSM asc 'End'00
proSETMODE
dw 5
ds 2
@ -747,38 +787,108 @@ proSETMODE
setmodeBUFF
dw $0000
hex 15
hex 10
hex 00,00
dfb 12
hex 10 ; PF (bit is 1) for SCSI-2
hex 00,00 ; reserved
dfb 12 ; parameter list length
hex 00,00,00,00,00,00,00
adrl setmodeDATA
setmodeDATA
hex 00,00,00,00
hex 01
hex 08
hex 01
hex 40
hex 00
hex 00,00,00
hex 00,00,00,00 ; mode parameter header (8.3.3, table 91)
hex 01 ; page code - Apple-specific parameter page
hex 08 ; page length - Apple-specific page
hex 01 ; graymap - 1 = no alteration to data
hex 40 ; auto background adjustment threshold
hex 00 ; lamp - 0 = turn off
hex 00,00,00 ; reserved - 3 bytes
*-----------------------
* SET HALFTONES
*-----------------------
setHALFTONES
PushLong #startSHT
_WriteCString
lda theDEVICE
sta proSETHALFTONES+2
jsl GSOS
dw DControl
adrl proSETHALFTONES
bcc sht_ok
PushLong #controlSHT
_WriteCString
sht_ok PushLong #endSHT
_WriteCString
rts
*---
startSHT asc 0d'Start setHALFTONES...'00
controlSHT asc ' (control not OK) '00
endSHT asc 'End'00
proSETHALFTONES
dw 5
ds 2
dw $802A
adrl sethalftonesBUFF
adrl 17
ds 4
sethalftonesBUFF
dw $0000
hex 2A ; operation code
hex 00 ; logical unit / reserved
hex 02 ; data type code (halftone mask)
hex 00 ; reserved
hex 00,02 ; data type qualifier (halftone mask)
dfb 00,00,17 ; transfer length
hex 00 ; control
hex 00,00
adrl sethalftonesDATA
sethalftonesDATA
hex 44,F0,40,80,C0,B0,00,10,50
hex 70,30,20,90,E0,A0,60,D0
*-----------------------
* SET THE WINDOW
*-----------------------
setWINDOW
PushLong #startSW
_WriteCString
lda theDEVICE
sta proSETWINDOW+2
jsl GSOS
dw DControl
adrl proSETWINDOW
bcs sw_err
rts
sw_err brk $b4
bcc sw_ok
PushLong #controlSW
_WriteCString
sw_ok lda #^setwindowDATA
jsr showWORD
lda #setwindowDATA
jsr showWORD
PushLong #endSW
_WriteCString
rts
*---
startSW asc 0d'Start setWINDOW... Adr=$'00
controlSW asc ' (control not OK) '00
endSW asc '...End'00
proSETWINDOW
dw 5
ds 2
@ -790,42 +900,60 @@ proSETWINDOW
setwindowBUFF
dw $0000
hex 24
hex 00,00,00,00,00,00,00
dfb 48
hex 80
hex 00,00
hex 00
hex 00,00,00,00
dfb 00,00,48 ; length is 48 bytes
hex 80 ; control
hex 00,00
adrl setwindowDATA
setwindowDATA
hex 00,00,00,00,00,00
hex 00,28 ; 40 in big endian
dfb 00,40 ; window length
hex 00 ; window identifier
hex 00 ; reserved
dfb 00,75 ; x-axis resolution
dfb 00,75 ; y-axis resolution
hex 00,00,00,00 ; x-upper left
hex 00,00,00,00 ; y-upper left
hex 00,00,27,D8 ; x-width
hex 00,00,33,90 ; y-height
* hex 00,00,27,D8 ; x-width (10200)
hex 00,00,13,EC ; x-width ( 5100)
* hex 00,00,33,90 ; y-height (13200)
hex 00,00,11,30 ; y-height ( 4400)
hex 00 ; brightness
hex 00 ; threshold
hex 00 ; contrast
hex 01 ; imageComposition
hex 08 ; bitsPerPixel
hex 00,02 ; halftone (to be validated with 8bpp)
hex 03 ; paddingType
hex 00,00,00,00,00,00,00,00,00,00
hex 05 ; imageComposition (see table 283)
hex 08 ; bitsPerPixel (8)
hex 00,00 ; halftone (2)
hex 03 ; paddingType (byte boundary)
hex 00,00 ; bit ordering
hex 00 ; compression type
hex 00 ; compression argument
hex 00,00,00,00,00,00
*-----------------------
* ASK FOR MEMORY
*-----------------------
askforMEM
PushLong #startMEM
_WriteCString
lda haMEM
ora haMEM+2
beq noMEM
PushLong haMEM
_DisposeHandle
noMEM
pha
pha
PushLong #526350 ; 638 bytes-w * 825 bytes-h
PushWord myID
PushWord #%01000000_00000000
PushWord #%01000000_00001100 ; fixed + aligned + no spec mem
PushLong #0
_NewHandle
phd
@ -838,28 +966,61 @@ askforMEM
sta proREAD+6
pld
pla
sta haMEM
pla
sta haMEM+2
bcs am_err
PushLong #adrMEM
_WriteCString
lda proREAD+6
jsr showWORD
lda proREAD+4
jsr showWORD
PushLong #endMEM
_WriteCString
rts
am_err brk $b6
*---
startMEM asc 0d'Start askforMEM...'00
adrMEM asc ' Adr=$'00
endMEM asc '...End'00
haMEM ds 4
*-----------------------
* START THE SCANNING
*-----------------------
scanSCANNER
PushLong #startSS
_WriteCString
lda theDEVICE
sta proSCAN+2
jsl GSOS
dw DControl
adrl proSCAN
bcs ss_err
bcc ss_ok
PushLong #controlSS
_WriteCString
ss_ok PushLong #endSS
_WriteCString
clc
rts
ss_err brk $b8
*---
startSS asc 0d'Start scanSCANNER...'00
controlSS asc ' (control not OK) '00
endSS asc 'End'00
proSCAN dw 5
ds 2
dw $801b
@ -870,29 +1031,49 @@ proSCAN dw 5
scanBUFF
dw $0000
hex 1b
hex 00,00,00
hex 01
hex 00
hex 00,00
hex 01 ; length is 1
hex 00
hex 00,00,00,00,00,00
adrl scanDATA
scanDATA
hex 00
hex 00 ; the window identifier we want to scan
*-----------------------
* READ THE PAGE
*-----------------------
readSCANNER
PushLong #startRS
_WriteCString
jsl GSOS
dw $2012
adrl proREAD
bcs rs_err
bcc rs_ok
PushLong #controlRS
_WriteCString
rs_ok PushLong #lengthRS
_WriteCString
lda proREAD+14
jsr showWORD
lda proREAD+12
jsr showWORD
PushLong #endRS
_WriteCString
rts
rs_err brk $ba
*---
startRS asc 0d'Start readSCANNER...'00
controlRS asc ' (read not OK) '00
lengthRS asc ' Len=$'00
endRS asc '...End'00
proREAD dw 4 ; 00 pcount
ds 2 ; 02 ref num
ds 4 ; 04 buffer ptr
@ -904,18 +1085,129 @@ proREAD dw 4 ; 00 pcount
*-----------------------
closeSCANNER
PushLong #startCS
_WriteCString
jsl GSOS
dw $2014
adrl proCLOSE
bcs cs_err
bcc cs_ok
PushLong #closeCS
_WriteCString
cs_ok PushLong #endCS
_WriteCString
rts
cs_err brk $bc
*---
startCS asc 0d'Start closeSCANNER...'00
closeCS asc ' (close not OK) '00
endCS asc 'End'00
proCLOSE dw 1 ; 00 pcount
ds 2 ; 02 ref num
*-----------------------
* SAVE FILE
*-----------------------
saveFILE
PushLong #startFILE
_WriteCString
lda proREAD+4
sta fileWRITE+4
lda proREAD+6
sta fileWRITE+6
lda proREAD+12
sta fileWRITE+8
lda proREAD+14
sta fileWRITE+10
jsl GSOS
dw $2002
adrl fileDESTROY
jsl GSOS
dw $2001
adrl fileCREATE
jsl GSOS
dw $2010
adrl fileOPEN
lda fileOPEN+2
* sta fileHEADER+2
sta fileWRITE+2
sta fileCLOSE+2
* jsl GSOS
* dw $2013
* adrl fileHEADER
jsl GSOS
dw $2013
adrl fileWRITE
jsl GSOS
dw $2014
adrl fileCLOSE
PushLong #endFILE
_WriteCString
rts
*--- Data
startFILE asc 0d'Write file...'00
endFILE asc 'End'0d00
fileDESTROY
dw 1 ; pcount
adrl pFILE ; pathname
fileCREATE
dw 7 ; 00 pcount
adrl pFILE ; 02 pathname
dw $c3 ; 06 access_code
dw $06 ; 08 file_type
ds 4 ; 0A aux_type
ds 2 ; 0E storage_type
ds 4 ; 10 eof
ds 4 ; 14 resource_eof
fileOPEN
dw 2
ds 2
adrl pFILE
fileHEADER
dw 5
ds 2
adrl headerDATA
adrl 4
ds 4
dw 1
fileWRITE dw 5
ds 2
ds 4
ds 4
ds 4
dw 1
fileCLOSE dw 1
ds 2
headerDATA
dw 500
dw 800
pFILE strl '1/Scan.BIN'
*-----------------------
* STATUS $801A - MODE SENSE (6)
*-----------------------
@ -930,11 +1222,6 @@ doMODESENSE6
dex
bpl ]lp
lda #previewPAGE
stal $300
lda #^previewPAGE
stal $302
lda #dcMODESENSE6
jsr statusCALL
jmp waitKEY
@ -1725,7 +2012,7 @@ proSTATUS dw 5 ; 00 pcount
ds 2 ; 02 device num
dw $8000 ; 04 status/control code
adrl statusLIST ; 06 status list
adrl 240 ; 0A request count (AVI was 1024/32)
adrl 240 ; 0A request count (AVI was 1024/32)
ds 4 ; 0E transfer count
statusLIST ds 2 ; always 0000
@ -1733,7 +2020,7 @@ statusDATA hex 00 ; 00
hex 00 ; 01
hex 00 ; 02
hex 00 ; 03
hex 00 ; 04 - (240 AVI was $00)
dfb 240 ; 04 - (240 AVI was $00)
hex 00 ; 05
hex 00 ; 06
hex 00 ; 07
@ -1756,7 +2043,7 @@ commandDATA hex 00 ; 00
hex 00 ; 01
hex 00 ; 02
hex 00 ; 03
dfb 00 ; 04
dfb 240 ; 04 - (240 AVI was $00)
hex 00 ; 05
hex 00 ; 06
hex 00 ; 07

File diff suppressed because it is too large Load Diff

View File

@ -1 +1 @@
SCANNERSCSI=Type(00),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000)
SCANNERSCSI=Type(B3),AuxType(DB00),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000)

BIN
scsi2/dlld.2mg Executable file

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

BIN
scsi2/scans/Scan1.BIN Normal file

Binary file not shown.

BIN
scsi2/scans/Scan10.BIN Normal file

Binary file not shown.

BIN
scsi2/scans/Scan10.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 998 KiB

BIN
scsi2/scans/Scan11.BIN Normal file

Binary file not shown.

BIN
scsi2/scans/Scan11.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 KiB

BIN
scsi2/scans/Scan2.BIN Normal file

Binary file not shown.

BIN
scsi2/scans/Scan3.BIN Normal file

Binary file not shown.

BIN
scsi2/scans/Scan4.BIN Normal file

Binary file not shown.

BIN
scsi2/scans/Scan4.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

BIN
scsi2/scans/Scan5.BIN Normal file

Binary file not shown.

BIN
scsi2/scans/Scan6.BIN Normal file

Binary file not shown.

BIN
scsi2/scans/Scan7.BIN Normal file

Binary file not shown.

BIN
scsi2/scans/Scan8.BIN Normal file

Binary file not shown.

BIN
scsi2/scans/Scan8.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 555 KiB

BIN
scsi2/scans/Scan9.BIN Normal file

Binary file not shown.

BIN
scsi2/scans/Scan9.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 634 KiB

View File

85
scsi2/scans/theorie.txt Normal file
View File

@ -0,0 +1,85 @@
Tests sur Mac
OneScanner
------------------
xGSres = getResolutionPopUp(GetCtlHandleFromID(NULL,XResolutionPopUp));
75, 150, 200, 300
yGSres = getResolutionPopUp(GetCtlHandleFromID(NULL,YResolutionPopUp));
75, 150, 200, 300
scanLength = doGetXYPos(&xStart,&xEnd,&yStart,&yEnd);
scanWidth = doFixXPos(&xStart,&xEnd,&yStart,&yEnd,xGSres);
switch(xGSres){
case 75:
scanWidth += 16;
break;
case 150:
scanWidth += 8;
break;
}
/* in bytes */
dataWidth = (((scanWidth * xGSres) / 1200) * (long) (sWindowDef.bitsPerPixel))/8;
4-bits / 75 dpi : (10200 x 75 / 1200) x (4/8)
8-bits / 75 dpi : (10200 x 75 / 1200) x (8/8)
/* # of scan lines */
dataLength = (scanLength * yGSres) / 1200;
bufferSize = dataWidth * dataLength; /* bytes per scan line * # of scan lines */
------------------
#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
bitsPerPixel = 4, 8, 24
------------------ for scanLength
par dŽfaut, c'est 13200 pour 11 pouces
doGetXYPos (xStart, xEnd, yStart, yEnd)
if not preview window opened
*xStart = *yStart = 0; /* use default values to define page */
*xEnd = 10200; /* 1200 * 8.5 inches */
*yEnd = 13200; /* 1200 * 11 inches */
else
*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;
endif
return (*yEnd - *yStart); /* scanlength */
------------------ for scanWidth
par dŽfaut, c'est 10200 pour 8.5 pouces
doFixXPos (xStart, xEnd, yStart, yEnd, xGSres)
diff = (Long)(*xEnd - *xStart);
10200 - 0 = 10200
chunkiness = 8 * xres;
8 x 75 = 600
deltaX = diff % chunkiness;
10200 % 600 = 0
fixAmount = chunkiness - deltaX;
600 - 0 = 600
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 */