head	1.2;
access;
symbols
	OCT93:1.2;
locks;
comment	@;; @;


1.2
date	93.06.11.16.29.21;	author Rhialto;	state Exp;
branches;
next	1.1;

1.1
date	93.06.11.15.08.07;	author Rhialto;	state Exp;
branches;
next	;


desc
@Startup code and system data
@


1.2
log
@First real RCS checkin
@
text
@;; $Id$
;; $Log$
		    ;	PRINTERTAG.ASM
		    ;
		    ;	printer tag info and custom startup code for
		    ;	DICE.

;;;;
;
; Don't include all the include files but define the values here

PPC_BWGFX	    EQU     1
PPC_BW		    EQU     1
LINE_BITS	    EQU     1728
X_DPI		    EQU     204
Y_DPI		    EQU     196 	; or half this value
_LVOFreeMem	    EQU     -$d2

		    section text,code

		    xref    _DevInit
		    xref    _DevExpunge
		    xref    _DevOpen
		    xref    _DevClose

		    xref    _CommandTable
		    xref    _DoSpecial
		    xref    _MsgRender
		    xref    _ConvFunc

		    xdef    _PEDData
		    xdef    _SysBase
		    xdef    ___MemList	    ; used by malloc/free

		    moveq.l #30,D0
		    rts
		    dc.w    37	; version
		    dc.w    0	; revision

_PEDData:
		    dc.l    printerName
		    dc.l    _ADevInit
		    dc.l    _ADevExpunge
		    dc.l    _DevOpen
		    dc.l    _DevClose

		    dc.b    PPC_BWGFX	; printer class (devices/prtbase.h)
		    dc.b    PPC_BW	; color class	(devices/prtbase.h)
		    dc.b    1		; maximum number of columns (0)
		    dc.b    1		; number of character sets (0)

		    dc.w    8		; number of pixel rows per line dump
		    dc.l    LINE_BITS	; max X dots
		    dc.l    0		; max Y dots -- none, continuous
		    dc.w    X_DPI	; density, dpi horizontal
		    dc.w    Y_DPI	; density, dpi vertical

		    ;	command table & special functions

		    dc.l    _CommandTable
		    dc.l    _DoSpecial
		    dc.l    _MsgRender
		    dc.l    1			; timeout
		    dc.l    0			; 8BitChars
		    ds.l    1			; printer mode (???)
		    dc.l    _ConvFunc		; character conversion

printerName:	    dc.b    'FaxPrinter',0

		    ds.l    0


		    ;	-------------------------------------------------
		    ;	custom DICE startup code, same as for shared
		    ;	library example except args passed on stack, not
		    ;	in registers.

		    xref    __BSS_LEN	    ; (dlink), length of BSS
		    xref    __DATA_BAS	    ; (dlink), base of initialized data
		    xref    __DATA_LEN	    ; (dlink), length of data

_ADevInit:

		    movem.l D2-D7/A2-A6,-(sp)   ; blanket save
		    move.l  4,A6		; EXEC base

		    ;	Not resident, BSS space has been allocated for us
		    ;	beyond the specified data, just load the base ptr

snotres 	    lea     __DATA_BAS+32766,A4
		    sub.l   A3,A3

clrbss
		    ;	CLEAR BSS   &-32766(A4) + __DATA_LEN*4

		    lea     -32766(A4),A0
		    move.l  #__DATA_LEN,D0
		    asl.l   #2,D0
		    add.l   D0,A0

		    move.l  #__BSS_LEN,D0	; longwords of bss
		    moveq.l #0,D1
		    bra     clrent
clrlop		    move.l  D1,(A0)+
clrent		    dbf     D0,clrlop
		    sub.l   #$10000,D0
		    bcc     clrlop

		    move.l  A6,_SysBase

		    jsr     __AutoInit0 	; A6 has SYSBase
		    bne     xfail
		    jsr     __AutoInit1 	; A6 has SYSBase
		    bne     xfail

		    movem.l (sp)+,D2-D7/A2-A6   ; blanket restore
		    jmp     _DevInit(pc)        ; argument 4(sp) (on stack)

		    ;	if failure occurs (auto library open failed), return
		    ;	-1

xfail		    movem.l (sp)+,D2-D7/A2-A6
		    moveq.l #-1,D0
		    rts

		    ;	expunge the device

_ADevExpunge:
		    jsr     _DevExpunge(pc)
		    movem.l A4/A6,-(sp)
		    move.l  4,A6
		    lea     __DATA_BAS+32766,A4
		    jsr     __AutoExit1
		    jsr     __AutoExit0
;;; v this part taken from lib/amiga/c.a
		    move.l  ___MemList(A4),D0   ; free memory
		    beq     ex20
ex10		    move.l  D0,A2
		    move.l  (A2),A3             ; next...

		    move.l  4(A2),D0            ; bytes
		    move.l  A2,A1		; ptr
		    jsr     _LVOFreeMem(A6)

		    move.l  A3,D0		; next...
		    bne     ex10
ex20
;;; ^ end
		    movem.l (sp)+,A4/A6
		    moveq.l #0,D0
		    rts

		    xdef    _FakeSeg
		    xref    _PrinterProc
		    ds.l    0			; align
_FakeSeg:
		    dc.l    16			; seglist bptr
		    jmp     _PrinterProc(pc)

		    ;	These are special DICE sections that merge together special
		    ;	code from other object modules and link libraries, the base
		    ;	of which is defined here.

		    section autoinit0,code
__AutoInit0:
		    section autoinit1,code
__AutoInit1:
		    section autoexit0,code
__AutoExit0:
		    section autoexit1,code
__AutoExit1:

		    section bss,bss

_SysBase	    ds.l    1
___MemList	    ds.l    1

		    END
@


1.1
log
@Initial revision
@
text
@d1 2
a2 1

@
