mirror of
https://github.com/antoinevignau/source.git
synced 2024-06-01 00:41:39 +00:00
1 line
18 KiB
Plaintext
Executable File
1 line
18 KiB
Plaintext
Executable File
load 'macros.dump'
|
|
include 'driver.equ'
|
|
include 'wp.equ'
|
|
|
|
;-----------------------------------------------
|
|
;
|
|
; Imported addresses
|
|
;
|
|
;-----------------------------------------------
|
|
|
|
IMPORT W_CalcLineHeight
|
|
IMPORT W_Caret
|
|
IMPORT W_CaretBot
|
|
IMPORT W_CaretTop
|
|
IMPORT W_CurDoc
|
|
IMPORT W_FirstPage
|
|
IMPORT W_FtrHt
|
|
IMPORT W_GetLRecPtr
|
|
IMPORT D_GetPrintHandle
|
|
IMPORT W_GetRgn
|
|
IMPORT W_Hand
|
|
IMPORT W_HdrHt
|
|
|
|
IMPORT W_HeaderBits
|
|
IMPORT D_KillFont
|
|
IMPORT D_MainZPage
|
|
IMPORT W_MakeCaretNS
|
|
IMPORT W_NumPgs
|
|
IMPORT W_OverRide
|
|
IMPORT W_PrHExtra
|
|
IMPORT W_PageSize
|
|
IMPORT W_PageStr
|
|
IMPORT W_PaperBot
|
|
IMPORT W_PaperSize
|
|
IMPORT W_PaperTop
|
|
IMPORT Q_Point
|
|
IMPORT W_Ptr
|
|
IMPORT W_ScrollBar
|
|
IMPORT D_SelectFont
|
|
IMPORT W_SetTopPage
|
|
IMPORT W_ShowRuler
|
|
IMPORT W_TopPg
|
|
IMPORT W_TopPgPixel
|
|
IMPORT D_UnLock
|
|
IMPORT W_UpdateText
|
|
IMPORT W_View
|
|
IMPORT D_Deref
|
|
IMPORT W_Handle
|
|
IMPORT W_PrHRes
|
|
IMPORT Q_Rect
|
|
IMPORT W_Selected
|
|
|
|
;-----------------------------------------------
|
|
;
|
|
; Forward addresses and entries
|
|
;
|
|
;-----------------------------------------------
|
|
|
|
ENTRY W_CalcDocRect
|
|
ENTRY W_CalcScrollVals
|
|
ENTRY W_FOnPage
|
|
ENTRY W_GetTopSpace
|
|
ENTRY W_GotNewCtlVals
|
|
ENTRY W_HOnPage
|
|
ENTRY W_MakeNewTop
|
|
ENTRY W_MakeScrollBar
|
|
ENTRY W_ReadPrintRec
|
|
ENTRY W_ScreenChanged
|
|
ENTRY W_ScreenChangedNS
|
|
ENTRY W_ScrollBarProc
|
|
ENTRY W_SetDocRect
|
|
ENTRY W_SetFullREct
|
|
|
|
********************************************************************
|
|
*
|
|
* includes
|
|
*
|
|
* Wednesday, May 3, 1989 12:26:44 AM
|
|
********************************************************************
|
|
|
|
|
|
|
|
|
|
|
|
|
|
****************************************************************
|
|
* W_InitScreen(window) - inits all the screen vars
|
|
W_InitScreen PROC EXPORT
|
|
;Using wpglobals
|
|
input window:l
|
|
local PrHand:l,PrPtr:l
|
|
begin
|
|
|
|
spacelong
|
|
pushlong window
|
|
jsl D_GetPrintHandle
|
|
jsl W_ReadPrintRec
|
|
|
|
stz W_FirstPage
|
|
lda #1
|
|
sta W_TopPg
|
|
sta W_NumPgs
|
|
sta W_ShowRuler
|
|
|
|
pha
|
|
pha
|
|
pushword #1
|
|
pushword #0
|
|
jsl W_GetLRecPtr
|
|
pla
|
|
plx
|
|
jsl W_CalcLineHeight
|
|
sta W_HdrHt
|
|
sta W_FtrHt
|
|
|
|
stz W_ScrollBar
|
|
stz W_ScrollBar+2
|
|
stz W_HeaderBits
|
|
|
|
lda #1
|
|
jsl W_GetTopSpace
|
|
sta W_TopPgPixel
|
|
|
|
jsl W_ScreenChanged
|
|
|
|
return
|
|
|
|
ENDP
|
|
|
|
|
|
****************************************************************
|
|
* W_ReadPrintRec
|
|
W_ReadPrintRec PROC EXPORT
|
|
;Using WPGlobals
|
|
input PrHand:l
|
|
local PrPtr:l
|
|
begin
|
|
W_prinfo equ 2
|
|
W_rPaper equ 16
|
|
|
|
movelong PrHand,ax
|
|
jsl D_Deref
|
|
movelong ax,PrPtr
|
|
|
|
moveword [PrPtr]:#W_prinfo+4,W_PrHRes
|
|
subword [PrPtr]:#W_prinfo+10,[PrPtr]:#W_prinfo+6,W_PageSize
|
|
subword [PrPtr]:#W_prinfo+6,[PrPtr]:#W_rPaper,W_PaperTop
|
|
subword [PrPtr]:#W_prinfo+6,[PrPtr]:#W_rPaper,W_PrHExtra
|
|
subword [PrPtr]:#W_rPaper+4,[PrPtr]:#W_prinfo+10,W_PaperBot
|
|
clc
|
|
adc W_PaperTop
|
|
adc W_PageSize
|
|
sta W_PaperSize
|
|
|
|
movelong PrHand,ax
|
|
jsl D_UnLock
|
|
|
|
return
|
|
|
|
ENDP
|
|
|
|
|
|
****************************************************************
|
|
* W_ScreenChanged - gets port Q_Rect and gens ScreenPixels,BotPg
|
|
* BotPgPixel, and W_ScrollBar
|
|
W_ScreenChanged PROC EXPORT
|
|
begin
|
|
|
|
jsl W_ScreenChangedNS
|
|
|
|
jsl W_SetDocRect
|
|
|
|
pushword #0
|
|
jsl W_MakeScrollBar
|
|
|
|
jsl W_SetFullREct
|
|
|
|
return
|
|
|
|
ENDP
|
|
|
|
|
|
W_ScreenChangedNS PROC EXPORT
|
|
;Using WPGlobals
|
|
begin
|
|
|
|
jsl W_SetTopPage
|
|
|
|
return
|
|
|
|
ENDP
|
|
|
|
|
|
****************************************************************
|
|
* W_MakeScrollBar - resizes the current scroll bar (if not 0)
|
|
W_MakeScrollBar PROC EXPORT
|
|
;Using ScreenData
|
|
;Using W_SampleData
|
|
;Using WpGlobals
|
|
|
|
input clip:w
|
|
local trect:r,W_Ptr:l,W_Hand:l
|
|
begin
|
|
|
|
cpzl W_ScrollBar
|
|
beq NoKill
|
|
|
|
movelong W_ScrollBar,W_Hand
|
|
Movelong [W_Hand],W_Ptr
|
|
movelong [W_Ptr]:#8,trect
|
|
movelong [W_Ptr]:#8+4,trect+4
|
|
addword trect+4,#W_PNumBoxHt,trect+4
|
|
subword trect,#W_PNumBoxHt,trect
|
|
|
|
pushlong !Trect
|
|
_InvalRect
|
|
|
|
pushlong W_ScrollBar
|
|
_DisposeControl
|
|
|
|
NoKill
|
|
|
|
pushlong !Trect
|
|
_GetPortRect
|
|
|
|
stz TRect+6
|
|
|
|
lda clip
|
|
bne SkipCL
|
|
|
|
pushlong !Trect
|
|
_ClipRect
|
|
|
|
SkipCL
|
|
pushlong !Trect
|
|
_GetPortRect
|
|
|
|
subword trect+6,#W_SideWidth,Trect+2
|
|
|
|
pushlong !Trect
|
|
_InvalRect
|
|
|
|
addword trect,#W_PNumBoxHt,Trect
|
|
subword trect+4,#W_PNumBoxHt,Trect+4
|
|
inc trect+6
|
|
|
|
spacelong
|
|
spacelong
|
|
_getPort
|
|
pushlong !TRect
|
|
pushlong #0 ;no title
|
|
pushword #%00000011 ;defines scroll bar
|
|
pha
|
|
pha
|
|
pha
|
|
jsl W_CalcScrollVals
|
|
; pushword CtlVal ;cluge for where to start
|
|
; pushword CtlView ;cluge
|
|
; pushword CtlData ;cluge
|
|
pushlong #$06000000 ;scroll bar
|
|
pushlong #0 ;no ref con
|
|
pushlong #0 ;standard color table
|
|
_NewControl
|
|
pullLong W_ScrollBar
|
|
|
|
return
|
|
|
|
ENDP
|
|
|
|
|
|
****************************************************************
|
|
* W_CalcScrollVals - returns val,W_View,Data
|
|
W_CalcScrollVals PROC EXPORT
|
|
;Using WpGlobals
|
|
local trect:r,ScreenPixels:w
|
|
output Val:w,W_View:w,Data:w
|
|
begin
|
|
|
|
pushlong !Trect
|
|
jsl W_CalcDocRect
|
|
subword Trect+4,TRect,ScreenPixels
|
|
|
|
lda W_NumPgs
|
|
xba
|
|
sta Data
|
|
|
|
spacelong
|
|
spacelong
|
|
lda ScreenPixels
|
|
xba
|
|
and #$ff
|
|
pha
|
|
lda ScreenPixels
|
|
xba
|
|
and #$ff00
|
|
pha
|
|
pushword #0
|
|
pushword W_PaperSize
|
|
_LongDivide
|
|
pla
|
|
sta W_View
|
|
pla
|
|
pla
|
|
pla
|
|
|
|
spacelong
|
|
spacelong
|
|
lda W_TopPgPixel ;push W_TopPgPixel ; 256
|
|
xba
|
|
and #$ff
|
|
pha
|
|
lda W_TopPgPixel
|
|
xba
|
|
and #$ff00
|
|
pha
|
|
pushword #0
|
|
pushword W_PaperSize
|
|
_LongDivide
|
|
pla
|
|
sta Val
|
|
pla
|
|
pla
|
|
pla
|
|
short
|
|
lda W_TopPg
|
|
dec a
|
|
sta Val+1
|
|
long
|
|
|
|
return
|
|
|
|
ENDP
|
|
|
|
|
|
|
|
****************************************************************
|
|
* W_Caret On - draws W_Caret only if it's off
|
|
W_CaretOn PROC EXPORT
|
|
;Using wpglobals
|
|
;Using ScreenData
|
|
EXPORT CaretOff
|
|
EXPORT W_DrawCaret
|
|
lda W_Caret
|
|
bne COExit1
|
|
inc W_Caret
|
|
bra DoIt
|
|
|
|
COExit1 rtl
|
|
|
|
CaretOff ;
|
|
lda W_Caret
|
|
beq CoExit1
|
|
stz W_Caret
|
|
|
|
DoIt
|
|
W_DrawCaret ;
|
|
local W_Handle:l,W_Ptr:l,Q_Rect:r
|
|
begin
|
|
|
|
lda W_Selected
|
|
bne COExit
|
|
lda W_CaretBot
|
|
beq COExit
|
|
|
|
pha
|
|
pha
|
|
_getCliphandle
|
|
pullLong W_Handle
|
|
|
|
movelong [W_Handle],W_Ptr
|
|
|
|
movelong [W_Ptr]:#2,Q_Rect
|
|
movelong [W_Ptr]:#2+4,Q_Rect+4
|
|
|
|
jsl W_SetDocRect
|
|
|
|
_PenNormal
|
|
|
|
pushword #notXOR
|
|
_SetPenMode
|
|
|
|
pushlong W_CaretTop
|
|
_MoveTo
|
|
|
|
pushlong W_CaretBot
|
|
_LineTo
|
|
|
|
pushlong !Q_Rect
|
|
_ClipRect
|
|
|
|
COExit return
|
|
|
|
ENDP
|
|
|
|
|
|
|
|
|
|
****************************************************************
|
|
* W_CalcDocRect - returns doc Q_Rect
|
|
W_CalcDocRect PROC EXPORT
|
|
;Using wpglobals
|
|
;Using ScreenData
|
|
input RectPtr:l
|
|
begin
|
|
|
|
pushlong RectPtr
|
|
_GetPortRect
|
|
|
|
ldx W_ShowRuler
|
|
beq ItsHide
|
|
lda #W_RulerHt
|
|
ldy #2
|
|
sta [RectPtr]
|
|
|
|
ItsHide
|
|
subword [RectPtr]:#6,#W_SideWidth,[RectPtr]:#6
|
|
|
|
return
|
|
|
|
ENDP
|
|
|
|
|
|
|
|
****************************************************************
|
|
* W_SetRulRect
|
|
W_SetRulRect PROC EXPORT
|
|
;Using ScreenData
|
|
;Using wpglobals
|
|
local Q_Rect:r
|
|
begin
|
|
|
|
pushlong !Q_Rect
|
|
_GetPortRect
|
|
|
|
subword Q_Rect+6,#W_SideWidth,Q_Rect+6
|
|
subword Q_Rect+4,#W_RulerHt,Q_Rect+4
|
|
|
|
pushlong !Q_Rect
|
|
_ClipRect
|
|
|
|
return
|
|
|
|
ENDP
|
|
|
|
|
|
****************************************************************
|
|
* W_SetDocRect
|
|
W_SetDocRect PROC EXPORT
|
|
local tRect:r
|
|
begin
|
|
|
|
pushlong !TRect
|
|
jsl W_CalcDocRect
|
|
|
|
pushlong !TRect
|
|
_ClipRect
|
|
|
|
return
|
|
|
|
ENDP
|
|
|
|
|
|
|
|
|
|
**********************************************************
|
|
* W_DrawGrow
|
|
W_DrawGrow PROC EXPORT
|
|
;Using ScreenData
|
|
local TempRect:r
|
|
begin
|
|
|
|
pushlong #0
|
|
pushlong #-1
|
|
_SetCtlIcons
|
|
|
|
_SetFont ;to font from ctl icons
|
|
|
|
pushlong !TempRect
|
|
_GetPortRect
|
|
|
|
lda TempRect+4
|
|
sec
|
|
sbc #W_PNumBoxHt
|
|
sta TempRect
|
|
lda TempRect+6
|
|
sec
|
|
sbc #W_SideWidth
|
|
sta TempRect+2
|
|
pushlong !TempRect
|
|
_EraseRect
|
|
|
|
pushlong !TempRect
|
|
_GetPortRect
|
|
|
|
lda TempRect+6
|
|
sec
|
|
sbc #W_SideWidth
|
|
pha
|
|
lda TempRect+4
|
|
sec
|
|
sbc #W_PNumBoxHt
|
|
pha
|
|
_MoveTo
|
|
|
|
_PenNormal
|
|
pushword #2
|
|
pushword #1
|
|
_SetPenSize
|
|
|
|
pushword #0
|
|
pushword #W_PNumBoxHt
|
|
_Line
|
|
|
|
lda TempRect+6
|
|
sec
|
|
sbc #W_SideWidth
|
|
pha
|
|
lda TempRect
|
|
pha
|
|
_MoveTo
|
|
|
|
pushword #0
|
|
pushword #W_PNumBoxHt
|
|
_Line
|
|
|
|
lda TempRect+6
|
|
sec
|
|
sbc #W_SideWidth-3
|
|
pha
|
|
lda TempRect+4
|
|
sec
|
|
sbc #W_PNumBoxHt-1
|
|
pha
|
|
_MoveTo
|
|
|
|
pushword #$10 ;grow icon
|
|
_DrawChar
|
|
|
|
return
|
|
|
|
ENDP
|
|
|
|
|
|
|
|
*************************************************************
|
|
* Draw the page number
|
|
W_DrawPgBox PROC EXPORT
|
|
;Using WpGlobals
|
|
;Using ScreenData
|
|
local TempRect:r,size:w,UsePage:w,String:l
|
|
begin
|
|
|
|
movelong #StringPl,String
|
|
|
|
addword W_TopPg,W_FirstPage,UsePage
|
|
|
|
lda #0
|
|
ldx #$800
|
|
ldy #Black
|
|
jsl D_SelectFont
|
|
|
|
_penNormal
|
|
|
|
pushlong !TempRect ;first erase the old value
|
|
_getPortRect
|
|
|
|
lda TempRect+6
|
|
sec
|
|
sbc #W_SideWidth-2
|
|
sta TempRect+2
|
|
lda TempRect
|
|
clc
|
|
adc #W_PNumBoxHt
|
|
sta TempRect+4
|
|
|
|
pushlong !TempRect
|
|
_EraseRect
|
|
|
|
lda #1
|
|
sta StringPL
|
|
sta size
|
|
lda UsePage
|
|
cmp #10
|
|
bcc Set
|
|
lda #2
|
|
sta StringPL
|
|
sta size
|
|
|
|
SEt
|
|
pushword UsePage
|
|
pushlong #StringPL+1
|
|
pushword size
|
|
pushword #0
|
|
_Int2Dec
|
|
|
|
lda W_View
|
|
beq NoChange
|
|
bmi DoF
|
|
|
|
movelong #HStr,String
|
|
bra NoChange
|
|
|
|
DoF
|
|
movelong #FStr,String
|
|
|
|
NoChange
|
|
pha
|
|
pushlong String
|
|
_StringWidth
|
|
pullword size
|
|
|
|
lda #W_SideWidth
|
|
sec
|
|
sbc size
|
|
lsr a
|
|
clc
|
|
adc TempRect+2
|
|
pha
|
|
lda TempRect+4
|
|
sec
|
|
sbc #2
|
|
pha
|
|
_MoveTo
|
|
|
|
pushlong String
|
|
_DrawString
|
|
|
|
return
|
|
|
|
StringPl DS.B 6
|
|
|
|
HStr str 'H'
|
|
FStr str 'F'
|
|
|
|
ENDP
|
|
|
|
|
|
****************************************************************
|
|
* W_SetFullREct
|
|
W_SetFullREct PROC EXPORT
|
|
local Q_Rect:r
|
|
begin
|
|
|
|
pushlong !Q_Rect
|
|
_getPortRect
|
|
|
|
pushlong !Q_Rect
|
|
_ClipRect
|
|
|
|
return
|
|
|
|
ENDP
|
|
|
|
****************************************************************
|
|
* W_CalcGrowREct
|
|
W_CalcGrowREct PROC EXPORT
|
|
;Using ScreenData
|
|
input RectPtr:l
|
|
begin
|
|
|
|
pushlong RectPtr
|
|
_GetPortRect
|
|
|
|
ldy #4
|
|
lda [RectPtr],y
|
|
sec
|
|
sbc #W_PNumBoxHt
|
|
sta [RectPtr]
|
|
ldy #6
|
|
lda [RectPtr],y
|
|
sec
|
|
sbc #W_SideWidth
|
|
ldy #2
|
|
sta [RectPtr],y
|
|
|
|
return
|
|
|
|
ENDP
|
|
|
|
|
|
****************************************************************
|
|
* W_ScrollClick(taskRec):inScroll?
|
|
*
|
|
W_ScrollClick PROC EXPORT
|
|
;Using wpglobals
|
|
|
|
input TaskRec:l
|
|
local Q_Point:l,Control:l
|
|
output InScroll:w
|
|
|
|
begin
|
|
|
|
jsl D_KillFont
|
|
|
|
pha
|
|
pushlong #W_ScrollBar
|
|
pushlong [TaskRec]:#oWhere
|
|
pushlong W_CurDoc
|
|
_FindControl
|
|
pla
|
|
sta InScroll
|
|
beq SCExit
|
|
|
|
jsl W_SetDocRect
|
|
|
|
jsl CaretOff
|
|
|
|
jsl W_SetFullREct
|
|
|
|
pha
|
|
pushlong [TaskRec]:#oWhere
|
|
pushlong #W_ScrollBarProc
|
|
pushlong W_ScrollBar
|
|
_TrackControl
|
|
pla
|
|
|
|
jsl W_MakeCaretNS
|
|
|
|
SCExit
|
|
|
|
jsl D_KillFont
|
|
|
|
return
|
|
|
|
ENDP
|
|
|
|
|
|
|
|
****************************************************************
|
|
* W_ScrollBarProc
|
|
W_ScrollBarProc PROC EXPORT
|
|
;Using wpglobals
|
|
|
|
W_ScrollAmt equ 40
|
|
input part:w,control:l
|
|
local trect:r,ScreenPixels:w
|
|
local NewPixel:w,EndPixel:w,OldPage:l,NewPage:w,PageAmt:w
|
|
output dummy:w
|
|
begin +b
|
|
|
|
pushlong !Trect
|
|
jsl W_CalcDocRect
|
|
subword Trect+4,TRect,ScreenPixels
|
|
|
|
subword ScreenPixels,#10,PageAmt
|
|
subword W_PaperSize,ScreenPixels,EndPixel
|
|
movelong W_TopPg,OldPage ;does oldpixel too
|
|
|
|
lda part
|
|
jeq APExit
|
|
cmp #$81
|
|
jeq In_Thumb
|
|
sec
|
|
sbc #5
|
|
asl a
|
|
tax
|
|
jmp (ActionTable,x)
|
|
|
|
ActionTable DC.W In_Up_Arrow,In_Down_Arrow
|
|
DC.W In_Page_Up,In_Page_Down
|
|
|
|
In_Up_Arrow
|
|
lda W_TopPgPixel
|
|
sec
|
|
sbc #W_ScrollAmt
|
|
sta W_TopPgPixel
|
|
jpl GotNewTop
|
|
clc
|
|
adc W_PaperSize
|
|
sta W_TopPgPixel
|
|
dec W_TopPg
|
|
jne GotNewTop
|
|
moveword #1,W_TopPg
|
|
stz W_TopPgPixel
|
|
brl GotNewTop
|
|
|
|
In_Down_Arrow
|
|
cmpw W_NumPgs,OldPage
|
|
beq OnLastPage
|
|
lda W_TopPgPixel
|
|
clc
|
|
adc #W_ScrollAmt
|
|
sta W_TopPgPixel
|
|
cmp W_PaperSize
|
|
jcc GotNewTop
|
|
sec
|
|
sbc W_PaperSize
|
|
sta W_TopPgPixel
|
|
inc W_TopPg
|
|
brl GotNewTop
|
|
|
|
OnLastPage
|
|
lda W_TopPgPixel
|
|
clc
|
|
adc #W_ScrollAmt
|
|
sta W_TopPgPixel
|
|
cmp EndPixel
|
|
jcc GotNewTop
|
|
moveword EndPixel,W_TopPgPixel
|
|
brl GotNewTop
|
|
|
|
In_Page_Up
|
|
lda W_TopPgPixel
|
|
sec
|
|
sbc PageAmt
|
|
sta W_TopPgPixel
|
|
bpl GotNewTop
|
|
clc
|
|
adc W_PaperSize
|
|
sta W_TopPgPixel
|
|
dec W_TopPg
|
|
jne GotNewTop
|
|
moveword #1,W_TopPg
|
|
stz W_TopPgPixel
|
|
brl GotNewTop
|
|
|
|
In_Page_Down
|
|
cmpw W_NumPgs,OldPage
|
|
beq OnLastPage2
|
|
lda W_TopPgPixel
|
|
clc
|
|
adc PageAmt
|
|
sta W_TopPgPixel
|
|
cmp W_PaperSize
|
|
jcc GotNewTop
|
|
sec
|
|
sbc W_PaperSize
|
|
sta W_TopPgPixel
|
|
inc W_TopPg
|
|
brl GotNewTop
|
|
|
|
OnLastPage2
|
|
lda W_TopPgPixel
|
|
clc
|
|
adc PageAmt
|
|
sta W_TopPgPixel
|
|
cmp EndPixel
|
|
bcc GotNewTop
|
|
moveword EndPixel,W_TopPgPixel
|
|
|
|
GotNewTop
|
|
jsl W_SetFullREct
|
|
|
|
pha
|
|
pha
|
|
pha
|
|
jsl W_CalcScrollVals
|
|
pla
|
|
pla
|
|
pushlong control
|
|
_SetCtlValue
|
|
|
|
In_Thumb
|
|
|
|
pushlong OldPage
|
|
jsl W_GotNewCtlVals
|
|
|
|
APExit
|
|
return
|
|
|
|
ENDP
|
|
|
|
|
|
|
|
****************************************************************
|
|
* W_GotNewCtlVals
|
|
W_GotNewCtlVals PROC EXPORT
|
|
;Using wpglobals
|
|
|
|
input OldPage:l
|
|
local NewPixel:w
|
|
begin
|
|
|
|
In_Thumb
|
|
pha
|
|
pushlong W_ScrollBar
|
|
_GetCtlValue
|
|
pullword NewPixel
|
|
|
|
lda newpixel
|
|
xba
|
|
and #$ff
|
|
inc a
|
|
sta W_TopPg
|
|
|
|
pha
|
|
pha
|
|
lda NewPixel
|
|
and #$ff
|
|
pha
|
|
pushword W_PaperSize
|
|
_Multiply
|
|
pla
|
|
and #$ff00
|
|
ora 1,s ;divides
|
|
ply
|
|
xba
|
|
sta W_TopPgPixel
|
|
|
|
pushlong OldPage
|
|
pushlong W_TopPg
|
|
jsl W_MakeNewTop
|
|
|
|
return
|
|
|
|
ENDP
|
|
|
|
|
|
|
|
|
|
****************************************************************
|
|
* W_MakeNewTop
|
|
W_MakeNewTop PROC EXPORT
|
|
;Using wpglobals
|
|
|
|
input OldPage:l,TopPage:l
|
|
local ScrollPix:w,Rgn:l,Q_Rect:r,trect:r,ScreenPixels:w
|
|
|
|
begin
|
|
|
|
pushlong !Trect
|
|
jsl W_CalcDocRect
|
|
subword Trect+4,TRect,ScreenPixels
|
|
|
|
pushlong !Q_Rect
|
|
jsl W_CalcDocRect
|
|
|
|
lda W_OverRide
|
|
stz W_OverRide
|
|
tay
|
|
jne UpdateWhole
|
|
|
|
cmpw TopPage,OldPage
|
|
bne No2test
|
|
cmpw TopPage+2,OldPage+2
|
|
No2test bcc NewIsAbove
|
|
jeq APExit
|
|
;D_New Is below
|
|
lda TopPage
|
|
sec
|
|
sbc OldPage
|
|
beq SamePage
|
|
cmp #2
|
|
jcs UpDateWhole
|
|
lda TopPage+2 ;TopPixel
|
|
clc
|
|
adc W_PaperSize
|
|
bra GotPixel
|
|
|
|
SamePage
|
|
lda TopPage+2 ;TopPixel
|
|
GotPixel
|
|
pha
|
|
lda OldPage+2 ;old pixel
|
|
sec
|
|
sbc 1,s
|
|
sta ScrollPix
|
|
pla
|
|
sec
|
|
sbc ScreenPixels
|
|
scmpw a,OldPage+2 ;old pixel
|
|
bcc DoScroll
|
|
brl UpdateWhole
|
|
|
|
|
|
NewIsAbove
|
|
lda OldPage
|
|
sec
|
|
sbc TopPage
|
|
beq SamePage2
|
|
cmp #2
|
|
jcs UpDateWhole
|
|
lda OldPage+2 ;old Pixel
|
|
clc
|
|
adc W_PaperSize
|
|
bra GotPixel2
|
|
|
|
SamePage2
|
|
lda OldPage+2 ;old Pixel
|
|
GotPixel2
|
|
pha
|
|
sec
|
|
sbc TopPage+2 ;TopPixel
|
|
sta ScrollPix
|
|
pla
|
|
sec
|
|
sbc ScreenPixels
|
|
scmpw a,TopPage+2 ;TopPixel
|
|
bcc DoScroll
|
|
brl UpdateWhole
|
|
|
|
|
|
|
|
DoScroll
|
|
pushlong !Q_Rect
|
|
pushword #0
|
|
pushword ScrollPix
|
|
jsl W_GetRgn
|
|
movelong ax,Rgn
|
|
phx
|
|
pha
|
|
_ScrollRect
|
|
|
|
pushlong Rgn
|
|
_SetClip
|
|
|
|
bra W_DoUpDate
|
|
|
|
|
|
UpDateWhole
|
|
pushlong !Q_Rect
|
|
_ClipRect
|
|
|
|
W_DoUpDate
|
|
|
|
pushlong !Q_Rect
|
|
_EraseRect
|
|
|
|
jsl W_ScreenChangedNS
|
|
|
|
jsl W_UpdateText
|
|
|
|
jsl W_SetFullREct
|
|
|
|
APExit
|
|
jsl W_DrawPgBox
|
|
|
|
return
|
|
|
|
ENDP
|
|
|
|
|
|
****************************************************************
|
|
* W_GetTopSpace(Page:a):topspace:a
|
|
W_GetTopSpace PROC EXPORT
|
|
;Using wpglobals
|
|
|
|
ldy W_View
|
|
beq DoSpace
|
|
lda #0
|
|
bra Done
|
|
|
|
DoSpace
|
|
jsl W_HOnPage
|
|
bcc IsOn
|
|
|
|
lda W_PaperTop
|
|
bra Done
|
|
|
|
IsOn
|
|
|
|
addword W_PaperTop,W_HdrHt,a
|
|
|
|
Done
|
|
rtl
|
|
|
|
ENDP
|
|
|
|
****************************************************************
|
|
* W_GetPageSize(Page:a):W_PageSize:a
|
|
W_GetPageSize PROC EXPORT
|
|
;Using wpglobals
|
|
;Using D_GlobalData
|
|
W_CPage equ 0
|
|
W_CSize equ 2
|
|
tax
|
|
phd
|
|
lda >D_MainZPage
|
|
tcd
|
|
stx W_CPage
|
|
|
|
ldy W_View
|
|
beq DoSpace
|
|
moveword #W_HdrPixelLimit,W_CSize
|
|
brl AllDone
|
|
|
|
DoSpace
|
|
lda W_PaperSize
|
|
sec
|
|
sbc W_PaperTop
|
|
sbc W_PaperBot
|
|
sta W_CSize
|
|
|
|
lda W_CPage
|
|
jsl W_HOnPage
|
|
bcs W_GotSize
|
|
|
|
subword W_CSize,W_HdrHt,W_CSize
|
|
|
|
W_GotSize
|
|
|
|
lda W_CPage
|
|
jsl W_FOnPage
|
|
bcs AllDone
|
|
|
|
subword W_CSize,W_FtrHt,W_CSize
|
|
|
|
AllDone
|
|
lda W_CSize
|
|
pld
|
|
rtl
|
|
|
|
ENDP
|
|
|
|
|
|
|
|
****************************************************************
|
|
W_GetSpaceToFooter PROC EXPORT
|
|
|
|
pha
|
|
jsl W_GetTopSpace
|
|
tax
|
|
pla
|
|
phx
|
|
jsl W_GetPageSize
|
|
clc
|
|
adc 1,s
|
|
ply
|
|
|
|
rtl
|
|
|
|
ENDP
|
|
|
|
|
|
|
|
****************************************************************
|
|
* Is a Header on page in acc. cc=yes cs=no
|
|
W_HOnPage PROC EXPORT
|
|
;Using wpglobals
|
|
ldy W_View
|
|
bne NotOn
|
|
|
|
cmp #1
|
|
bne NotFirst
|
|
lda W_HeaderBits
|
|
and #W_HSkipFirst
|
|
bne NotOn
|
|
lda #1
|
|
|
|
NotFirst
|
|
clc
|
|
adc W_FirstPage
|
|
lsr a
|
|
bcc CheckEven
|
|
|
|
lda W_HeaderBits
|
|
and #W_HonOdd
|
|
bne IsOn
|
|
bra NotOn
|
|
|
|
CheckEven
|
|
|
|
lda W_HeaderBits
|
|
and #W_HonEven
|
|
bne IsOn
|
|
bra NotOn
|
|
|
|
NotOn sec
|
|
rtl
|
|
|
|
IsOn clc
|
|
rtl
|
|
|
|
ENDP
|
|
|
|
****************************************************************
|
|
* Is a Footer on page in acc. cc=yes cs=no
|
|
W_FOnPage PROC EXPORT
|
|
;Using wpglobals
|
|
ldy W_View
|
|
bne NotOn
|
|
|
|
cmp #1
|
|
bne NotFirst
|
|
lda W_HeaderBits
|
|
and #W_FSkipFirst
|
|
bne NotOn
|
|
lda #1
|
|
|
|
NotFirst
|
|
clc
|
|
adc W_FirstPage
|
|
lsr a
|
|
bcc CheckEven
|
|
|
|
lda W_HeaderBits
|
|
and #W_FonOdd
|
|
bne IsOn
|
|
bra NotOn
|
|
|
|
CheckEven
|
|
|
|
lda W_HeaderBits
|
|
and #W_FonEven
|
|
bne IsOn
|
|
bra NotOn
|
|
|
|
NotOn sec
|
|
rtl
|
|
|
|
IsOn clc
|
|
rtl
|
|
|
|
ENDP
|
|
|
|
|
|
|
|
|
|
****************************************************************
|
|
W_CheckDocPos PROC EXPORT
|
|
;Using wpglobals
|
|
|
|
local Q_Rect:r,ssize:w
|
|
begin
|
|
|
|
pushlong !Q_Rect
|
|
jsl W_CalcDocRect
|
|
|
|
cmpw W_NumPgs,W_TopPg
|
|
bcc ReDo
|
|
|
|
lda Q_Rect+4
|
|
cmp W_TopPgPixel
|
|
jle NoChange ;theres a PageBreak present.
|
|
|
|
subword Q_Rect+4,Q_Rect,ssize
|
|
addword a,W_TopPgPixel,a
|
|
cmp W_PaperSize
|
|
bcc NoChange
|
|
cmpw ssize,W_PaperSize
|
|
bcs NoChange
|
|
|
|
ReDo
|
|
jsl W_SetFullREct
|
|
|
|
pushlong W_TopPg
|
|
|
|
moveword W_NumPgs,W_TopPg
|
|
subword W_PaperSize,ssize,W_TopPgPixel
|
|
|
|
pha
|
|
pha
|
|
pha
|
|
jsl W_CalcScrollVals
|
|
pla
|
|
pla
|
|
pushlong W_ScrollBar
|
|
_SetCtlValue
|
|
|
|
In_Thumb
|
|
jsl W_SetDocRect
|
|
|
|
jsl W_GotNewCtlVals
|
|
|
|
NoChange
|
|
return
|
|
|
|
ENDP
|
|
|
|
|
|
****************************************************************
|
|
W_MakePageStr PROC EXPORT
|
|
;Using wpglobals
|
|
|
|
input Num:w
|
|
local size:w
|
|
begin
|
|
|
|
addword Num,W_FirstPage,Num
|
|
|
|
lda #1
|
|
sta W_PageStr
|
|
sta size
|
|
lda Num
|
|
cmp #10
|
|
bcc Set
|
|
|
|
lda #2
|
|
sta W_PageStr
|
|
sta size
|
|
lda Num
|
|
cmp #100
|
|
bcc Set
|
|
|
|
lda #3
|
|
sta W_PageStr
|
|
sta size
|
|
lda Num
|
|
cmp #1000
|
|
bcc set
|
|
|
|
lda #4
|
|
sta W_PageStr
|
|
sta size
|
|
|
|
SEt
|
|
pushword Num
|
|
pushlong #W_PageStr+1
|
|
pushword size
|
|
pushword #0
|
|
_Int2Dec
|
|
|
|
return
|
|
|
|
ENDP
|
|
END
|
|
|