home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
8bitfiles.net/archives
/
archives.tar
/
archives
/
canada-remote-systems
/
geos
/
drivers
/
shelldc2.sda
/
PRINTERSHELL
(
.txt
)
< prev
next >
Wrap
GEOS ConVerT
|
2019-04-13
|
13KB
|
402 lines
PrinterShell
PRG formatted GEOS file V1.0
Star NX-10
OP V2.0 or higherHELL
ShellHeader
BLASTER'S CONVERTER V2.5
PetASCII
PChanGC
Write Image V2.0
geoWrite V2.1
.Source code for Printer Shell. DO NOT MODIFY. For viewing only.
.include ShellZero
@MoveData
==$c17e
@START OF DRIVER ($7900)
.psect
jmp jInitForPrint
jmp jStartPrint
jmp jPrintBuffer
jmp jStopPrint
jmp jGetDimensions
jmp rPrintText
jmp jStartASCII
@SetNLQ
lda #$c0
sta PrintMode
jsr OpenChannel
ldx #mSetNLQ
jsr SendMessage
@CloseCha
nnel:
jmp rCloseChannel ;
@Entry fixed at $7922.
@jInitFor
Print:
jsr InitForPrint
ldx #0 ;Fixes bug in geoCalc.
@SendByte
jmp rSendByte ;
@Entry fixed at $792b.
@OpenChan
jmp rOpenChannel ;
@Entry fixed at $792e.
@OPOffset
.byte 0 ;Offsets used by OpenWindow (odd bytes).
@Primary
.byte nPrimary ;
@Parameter fixed at $7932.
.byte 7 ;Second offset.
@Secondar
.byte nSecondary ;
@Parameter fixed at $7934.
.byte 14 ;Third offset.
@Pointers
.block 6 ;Three pointers to 640-byte card buffers.
StackSize =20 ;All calls to Shell subroutines must not have
@StackSav
e: ;used more than twenty bytes on the stack.
.block StackSize
@jGetDime
nsions:
ldx #CardsWide ;
@Parameter fixed at $7951.
ldy #CardsLong ;
@Parameter fixed at $7953.
lda #0
@jGetDime
nsions:
ldx #CardsWide ;
@Parameter fixed at $7951.
ldy #CardsLong ;
@Parameter fixed at $7953.
lda #0
@SendMess
age: ;
@Entry fixed at $7957.
ldy MessageLength,x ;Get length of message "X".
@(At $7958.)
beq 99$ ;Branch if message length is zero.
lda MessageOffset,x ;Get offset to message "X".
@(At $795d.)
10$ lda messages,x ;Get next byte of message.
@(At $7961.)
jsr SendByte ;Transmit byte to printer.
inx ;Step to next byte.
dey ;Decrement length counter.
bne 10$
99$ rts
@ShiftPix
els:
@Entry fixed at $796b.
ldx #23 ;Shift the pixels within the Window one
10$ asl Window+48,x ;position to the left. The new pixels on
rol Window+24,x ;the right are cleared. After 8 shifts, the
rol Window,x ;right hand pane is cleared and the
dex ;subroutine returns with the Z-flag set.
bpl 10$
dec PixelCounter ;PixelCounter is initialized by the
rts ;subroutine ColorWindow.
@OpenWind
ow:
@Entry fixed at $7979.
sty ActiveColumn ;Save active column minus two times eight.
lda #<-8 ;Get ready in case we're on column one.
sta temp
bmi 6$ ;Branch if on first column.
asl a ;Maximum value is 80 so carry is clear.
asl a
sta temp
lda #0
rol a
asl temp
rol a
6$ sta temp+1
ldx #4
10$ clc
ldy OPOffsets,x
lda Pointers,x
adc temp ;Low parameter for lda 1234,y.
sta OpenPane+7,y
lda Pointers+1,x
adc temp+1 ;High parameter for lda 1234,y.
sta OpenPane+8,y
bpl 10$
; Fall through into ColorWindow on next page.
@ColorWin
dow:
@ColorWin
dow:
@Entry fixed at $79aa.
lda #8
sta PixelCounter
jsr OpenRightPane
jsr OpenMidPane
@OpenLeft
Pane:
ldy ActiveColumn ;Y points to current middle pane so
dey ;decrement it.
jsr SetColor ;Modify "eor #0" instruction of OpenPane.
ldy #$ff ;Y gets incremented to point to first card.
lda #0 ;A will index into left pane of window.
beq OpenCont ;(Always)
@OpenMidP
ldy ActiveColumn ;Y points to current middle pane.
jsr SetColor ;Modify "eor #0" instruction of OpenPane.
ldy #$07 ;Y gets inc'ed to point to second card.
lda #24 ;A will index into middle pane of window.
bne OpenCont ;(Always)
@OpenRigh
tPane:
ldy ActiveColumn ;Y points to current middle pane so
iny ;increment it.
jsr SetColor ;Modify "eor #0" instruction of OpenPane.
ldy #$0f ;Y gets inc'ed to point to third card.
lda #48 ;A will index into right pane of window.
OpenCont:
CaFr: ora #7 ;Offset for PreWindow is modified here.
@OpenPane
lda #8 ;Counter for eight bytes per card.
sta temp
10$ inx
lda 1234,y ;This address gets modified.
eor #0 ;Reserve for color modification.
sta PreWindow+15,x ;Bottom card.
lda 1234,y ;This address gets modified.
eor #0 ;Reserve for color modification.
sta PreWindow+7,x ;Middle card.
lda 1234,y ;This address gets modified.
eor #0 ;Reserve for color modification.
sta PreWindow-1,x ;Top card.
dec temp
bne 10$
@SetColor
@SetColor
lda (r1),y ;Get colors for bottom card of pane.
jsr CalcColor ;Calculate active fore/background pixels.
sta OpenPane+9 ;Opcode for "lda" or "eor".
stx OpenPane+10 ;Parameter "$00" or "$ff".
lda (r2),y ;Get colors for middle card of pane.
jsr CalcColor ;Calculate active fore/background pixels.
sta OpenPane+16 ;Opcode for "lda" or "eor".
stx OpenPane+17 ;Parameter "$00" or "$ff".
lda (r3),y ;Get colors for top card of pane.
jsr CalcColor ;Calculate active fore/background pixels.
sta OpenPane+23 ;Opcode for "lda" or "eor".
stx OpenPane+24 ;Parameter "$00" or "$ff".
@CalcColo
sty temp ;Temp save current column postion.
SeFi: ldy #0 ;SelectFilter
@Parameter fixed at $7a1d.
pha ;Test for a match of the foreground color.
lsr a
lsr a
lsr a
lsr a
cmp #8 ;Copy MSB of nybble to carry bit.
and #7 ;Three LSBs remain.
lda ColorFilters,y ;Get LSByte of foreground filter
@(at $7a29)
bcc 10$ ;Branch if that's the one we need.
lda ColorFilters+1,y ;Else get the MSByte filter.
10$ and BitTable,x ;See if this card's color is on the filter.
beq 20$ ;Branch if not with ACC=0.
lda #2 ;Else use 2 as foreground part of index.
20$ sta temp+1
pla ;Now test for match of background color.
and #$0f
cmp #8 ;Copy MSB of nybble to carry bit.
and #7 ;Three LSBs remain.
lda ColorFilters+2,y ;Get background filter (LSByte).
bcc 30$ ;Branch if that's the one we need.
lda ColorFilters+3,y ;Else get the MSByte filter.
30$ ldy temp+1
and BitTable,x ;See if this card's color is on the filter.
beq 40$ ;Branch if not.
iny ;Else use 1 as background part of index.
40$ lda ColorOpTable,y
ldx ColorParmTable,y
ldy temp ;Restore Y.
@ColorOpT
able:
.byte $a9,$49,$49,$a9 ;"lda", "eor", "eor", "lda".
@ColorPar
mTable:
.byte $00,$ff,$00,$ff
@BitTable
.byte 1,2,4,8,16,32,64,128 ;
@Table starts at $7a62.
@jStartAS
lda #$81 ;Set ASCII Flag.
bne ContStart
@jStartAS
lda #$81 ;Set ASCII Flag.
bne ContStart
@jStartPr
lda #$40 ;Clear ASCII Flag, but set bit 6 for StopPrint.
ContStart: sta PrintMode
jsr OpenChannel ;Test if printer available.
jsr CloseChannel
ldx STATUS
beq PrMo
rts ;Exit with "printer inaccessible".
PrMo: lda #0 ;PrintMode
@Parameter stored a$7a7f.
bpl ContPrint
jmp rStartText
ContPrint: tsx ;Save stack pointer for GetBuffer.
stx StackPoint
jsr GetBuffer ;Get first buffer and valid pointers.
bit PrintMode
bvc SetAppEnv ;Branch on blank page.
lda #7 ;Initialize CardFraction for one full card.
sta CardFraction
lda r8 ;See if color printing is needed.
bne DoBorder ;Branch if so.
ldy #80 ;Else fill bottom color buffer with
BlCo: lda #$01 ;black on white
@(at $7a9d).
110$ sta (r1),y
bne 110$
DoBorder: ldy #81 ;Now fill middle buffer for
BoCo: lda #$11 ;White on white
@(at $7aa6).
sta (r1),y ;Fill right border color for bottom buffer.
210$ sta (r2),y ;Fill middle color buffer for blank top border.
bpl 210$
sta (r1),y ;Fill left border color for bottom buffer.
ldx #4
220$ lda r5-1,x ;Initialize top two card buffer pointers.
sta Pointers+1,x
bne 220$
jsr NextBuffer
jsr PrintPage
@SetAppEn
ldy #$8f-$22
10$ lda (r4),y
sta ProgEnd-ProgEnd+$22,y ;Force ABS,Y mode on page zero.
bpl 10$
jmp CloseChannel
@MoveDown
@MoveDown
@Entry fixed at $7ace
sta temp ;Number of pixels to move down.
ldx $dc01 ;Test for mouse button down (to halt print).
bne 1111$ ;Branch if so.
lda CardFraction ;Else calculate fractional part of card
sec ;to see if necessary to return to application.
sbc temp
bcs 999$ ;Branch if not.
100$ pha
jsr NextBuffer ;Else get another buffer from the application.
adc #8
bcc 100$
999$ sta CardFraction
1111$ jsr NextBuffer ;Mouse button down - cancel print. Keep
beq 1111$ ;returning to app until it notices button.
@NextBuff
er: ;Update Pointers and get more data.
ldy #80 ;Move color buffers up.
10$ lda (r2),y ;Copy middle color buffer
sta (r3),y ;to top color buffer.
lda (r1),y ;Copy bottom color buffer
sta (r2),y ;to middle color buffer.
bne 10$
ldx #1
100$ ldy Pointers+4,x ;Excange top card buffer pointer
lda Pointers+2,x ;with middle card buffer pointer.
sta Pointers+4,x
sta Pointers+2,x
bpl 100$
bit PrintMode ;See if the bottom has already been hit.
bvs 200$ ;Branch if not.
dec PrintMode ;Else keep track of how many times thru.
rts ;Go immediately back to driver.
200$ sta r1 ;Copy middle pointer to destination
lda Pointers+3 ;parameter for MoveData.
sta r1+1
lda #>640 ;Number of bytes-to-move parameter
sta r2+1 ;for MoveData.
lda #<640
sta r2
jsr SetAppEnv
jsr MoveData ;Source parameter is already in r0.
@GetBuffe
ldy #StackSize ;Restore Application environment.
GB10: dey
sta StackSave,y
StPo: cpx #0 ;StackPoint is modified here.
bcc GB10
sty StackPoint
ldx #0 ;Clear error flag.
rts ;Back to application.
@jStopPri
dec PrintMode ;$81 for ASCII, $40 for grap
@jStopPri
dec PrintMode ;$81 for ASCII, $40 for graphics.
bpl 100$ ;Branch if graphics mode.
jmp rStopText
100$ ldy #80 ;Fill bottom color buffer with
lda BorderColor ;border colors.
110$ sta (r1),y
bne 110$
beq SetDriverEnv ;(Always)
@jPrintBu
ffer:
lda r2+1 ;See if Application and driver want color.
CoFl: and #0 ;
@Parameter fixed at $7b57.
sta r8 ;Let caller know.
beq 400$ ;Branch if not color.
ldy #0 ;Else pass 80 bytes of color.
300$ lda (r2),y ;Get color passed by Application.
sta (r1),y ;Put in bottom color buffer.
cpy #80 ;See if near right border.
bcc 300$ ;Branch if not yet there.
400$ lda r0 ;Adjust bottom pointers.
sta Pointers
lda r0+1
sta Pointers+1
SetDriverEnv:
ldx #<-12 ;Calculate buffer pointers.
8$ lda r1+12,x
adc PointOffTable+12-256,x ;Zero-page mode.
sta r2+12,x
bne 8$
jsr OpenChannel
ldy #$8f-$22 ;Save a bunch of zero page locations.
9$ lda ProgEnd-ProgEnd+$22,y ;Force ABS,Y on page zero.
sta (r4),y
bpl 9$
tsx ;Re-create driver's stack environment.
ldy StackPoint
10$ lda StackSave,y
cpy #StackSize
bcc 10$
stx StackPoint
@PointOff
Table: ;Three color buffers, zero-page buffer,
.word 82,82,82,138,640,640 ;two card buffers, general buffer.
.word TextAddress ;
@Fixed at $7ba8.
.word XfaceAddress ;
@Fixed at $7baa.
.word ProgEnd ;
@Fixed at $7bac.
PrintMode ==PrMo+$7901
StackPoint ==StPo+$7901
CardFraction ==CaFr+$7901
ColorFlag ==CoFl+$7901
SelectFilter ==SeFi+$7901
BorderColor ==BoCo+$7901
BlackColor ==BlCo+$7901 ;
@Custom code starts at $7bae.
HGEOS Printer Driver Shell
Page: PAGE
Printed on: DATE At: TIME File: PrinterShell
HGEOS Printer Driver Shell
Page: PAGE
Printed on: DATE At: TIME File: PrinterShell
-----------------------------------------------------------------------------------------------
th ACC=0