mirror of
https://github.com/antoinevignau/source.git
synced 2025-02-12 15:30:45 +00:00
1 line
11 KiB
Plaintext
1 line
11 KiB
Plaintext
|
load 'macros.dump'
include 'driver.equ'
include 'wp.equ'
;-----------------------------------------------
;
; Imported addresses
;
;-----------------------------------------------
IMPORT W_CalcDocRect
IMPORT W_CalcLineHeight
IMPORT W_CalcScrollVals
IMPORT W_CheckWidow
IMPORT D_Deref
IMPORT W_GetPageSize
IMPORT W_GetParRec
IMPORT W_GetTopSpace
IMPORT W_GotNewCtlVals
IMPORT lastline
IMPORT W_LastP
IMPORT W_LineToTopPixel
IMPORT W_NumPgs
IMPORT W_OverRide
IMPORT W_PaperSize
IMPORT W_ReadRulerP
IMPORT W_ScrollBar
IMPORT W_SetFullREct
IMPORT W_TopParHeight
IMPORT W_TopPg
IMPORT W_TopPgLine
IMPORT W_TopPgPar
IMPORT W_TopPgPixel
IMPORT D_UnLock
IMPORT W_ValidLines
;-----------------------------------------------
;
; Forward addresses and entries
;
;-----------------------------------------------
ENTRY W_NewNumPgs
********************************************************************
*
* includes...
*
* Wednesday, May 3, 1989 1:23:24 AM
********************************************************************
****************************************************************
* W_CalcPages
W_CalcPages PROC EXPORT
;Using WPGlobals
local CurPar:w,ParPtr:l,Page:w,Pixel:w,LineHand:l,LinePtr:l
local temp:w,line:w,lastline:w,PagePixs:w
begin
moveword #1,CurPar
sta Page
stz Pixel
lda CurPar
jsl W_GetParRec
movelong ax,ParPtr
lda Page
jsl W_GetPageSize
sta PagePixs
; this loop is for normal pars, drops into subloop for pars that cross line
addloop
moveword [ParPtr]:#W_pAttr,a
beq okpar
and #W_PgBrk
beq okpar
inc Page
lda Page
jsl W_GetPageSize
sta PagePixs
stz Pixel
brl nextpar
okpar
lda pixel
clc
ldy #W_pPixels
adc [ParPtr],y
cmp PagePixs
jcc gotnewpixel
lda curpar
jsl W_CheckWidow
bcc NoWidow
lda pixel
beq NoWidow
inc Page
lda Page
jsl W_GetPageSize
sta PagePixs
stz Pixel
brl addloop
NoWidow
pushword CurPar
jsl W_ValidLines
movelong ParPtr,ax
jsl W_ReadRulerP
movelong [ParPtr]:#W_pLineHand,LineHand
movelong LineHand,ax
jsl D_Deref
movelong ax,LinePtr
addlong #W_LineHeader,LinePtr,LinePtr
stz line
LineLoop
movelong LinePtr,ax
jsl W_CalcLineHeight
clc
adc Pixel
cmp PagePixs
bcs GotLine
sta Pixel
inc line
addlong #W_lBytes,LinePtr,LinePtr
bra LineLoop
GotLine
movelong LinePtr,ax
jsl W_CalcLineHeight
sta Pixel
inc Page
lda Page
jsl W_GetPageSize
sta PagePixs
moveword [ParPtr]:#W_pLastLine,lastline
bra EndLoop
LineLoop2
movelong LinePtr,ax
jsl W_CalcLineHeight
clc
adc Pixel
cmp PagePixs
bcs GotLine
RegPix
sta Pixel
EndLoop
inc line
addlong #W_lBytes,LinePtr,LinePtr
cmpw line,lastline
bcc LineLoop2
Linenextpar
movelong LineHand,ax
jsl D_UnLock
bra nextpar
gotnewpixel sta Pixel
nextpar inc CurPar
lda W_LastP
cmp Curpar
bcc AllDone
addlong #W_pBytes,ParPtr,ParPtr
brl addloop
AllDone
cmpw Page,W_NumPgs
beq W_AllSet
pushword Page
jsl W_NewNumPgs
W_AllSet
return
ENDP
****************************************************************
* W_NewNumPgs
W_NewNumPgs PROC EXPORT
;Using WPGlobals
input Pages:w
begin
moveword Pages,W_NumPgs
jsl W_SetFullREct
pha
pha
pha
jsl W_CalcScrollVals
pla
ply
pha
phy
pushlong W_ScrollBar
_SetCtlParams
pla
return
ENDP
****************************************************************
* W_SetTopPage
W_SetTopPage PROC EXPORT
;Using WPGlobals
local ParPtr:l,Page:w,Pixel:w,LineHand:l,LinePtr:l
local temp:w,line:w,lastline:w,StartPixel:w,PagePixs:w
local TParHt:w
begin
moveword #1,W_TopPgPar
sta Page
stz W_TopPgLine
stz W_TopParHeight
stz Pixel
lda Page
jsl W_GetPageSize
sta PagePixs
lda W_TopPgPar
jsl W_GetParRec
movelong ax,ParPtr
cmpw #1,W_TopPg
jeq AllDone
; this loop is for normal pars, drops into subloop for pars that cross line
addloop
stz W_TopPgLine
stz W_TopParHeight
moveword [ParPtr]:#W_pAttr,a
beq okpar
and #W_PgBrk
beq okpar
inc Page
lda Page
jsl W_GetPageSize
sta PagePixs
stz Pixel
brl nextpar
okpar
lda pixel
clc
ldy #W_pPixels
adc [ParPtr],y
cmp PagePixs
jcc gotnewpixel
lda W_To
|