mirror of
https://github.com/antoinevignau/source.git
synced 2024-11-19 07:31:13 +00:00
1 line
8.8 KiB
Plaintext
1 line
8.8 KiB
Plaintext
|
load 'macros.dump'
include 'driver.equ'
include 'wp.equ'
include 'WP.Macros'
IMPORT D_BitMapPtr
IMPORT W_CalcDocRect
IMPORT W_CalcFBytes
IMPORT D_ClearBitMap
IMPORT W_CurDoc
IMPORT W_DoRoom
IMPORT W_FindFont
IMPORT W_GetAddr
IMPORT W_GetLRecPtr
IMPORT W_GetLineRec
IMPORT W_GetParRec
IMPORT W_JunkLeft
IMPORT W_JunkRight
IMPORT W_lastline
IMPORT W_LineToTopPixel
IMPORT W_MaxAscent
IMPORT W_MaxDescent
IMPORT W_NextLine
IMPORT W_ParRec
IMPORT W_Ptr
IMPORT W_ReadFont
IMPORT D_RectClear
IMPORT D_RectZap
IMPORT W_SetDocRect
IMPORT W_StartLine
IMPORT W_StartOffset
IMPORT W_StartPar
IMPORT W_UpdateTextP
IMPORT W_ValidLines
IMPORT W_WPColor
IMPORT W_WpFont
IMPORT W_WPFontFlag
IMPORT W_WriteFBytesNB
IMPORT W_WriteFBytesNE
IMPORT W_elColor
IMPORT W_elOffset
IMPORT W_LastP
ENTRY W_CheckCol
ENTRY W_MyClearRect
****************************************************************
* W_IsJunk(Offset1,Offset2):answer
W_IsJunk PROC EXPORT
;Using W_EditData
;Using WPGlobals
input Offset1:w,Offset2:w
local color:w,ChrPtr:l,LinePtr:l
output answer:w
begin
moveword #1,answer
lda W_StartPar
ldx #0
jsl W_GetAddr
movelong ax,ChrPtr
moveword W_elColor,color
shortm
ldy W_elOffset
bra DoComp
Loop1 lda [ChrPtr],y
cmpw a,#sp
bcs NotSpec
asl a
tax
jmp (ChrTable1,x)
ChrTable1
DC.W 0,SkipTwo ;0,1
DC.W SkipOne,SkipOne ;2,3
DC.W ColorChange,NotSpec ;4,5
DC.W NotSpec,NotSpec ;6,7
DC.W 0,IJExit ;8,9
ColorChange
iny
lda [ChrPtr],y
and #$ff
sta color
bra NotSpec
SkipTwo iny
SkipOne iny
NotSpec iny
DoComp cpy Offset1
bcc Loop1
longm
lda color
jne IJExit
shortm
ldy Offset1
bra DoComp2
Loop2 lda [ChrPtr],y
cmp #sp
bcs NotSpec2
asl a
tax
jmp (ChrTable2,x)
ChrTable2
DC.W 0,SkipTwo2 ;0,1
DC.W SkipOne2,SkipOne2 ;2,3
DC.W ColorChange2,NotSpec2 ;4,5
DC.W NotSpec2,NotSpec2 ;6,7
DC.W 0,IJExit ;8,9
ColorChange2
iny
lda [ChrPtr],y
bne IJExit
bra NotSpec2
SkipTwo2 iny
SkipOne2 iny
NotSpec2 iny
DoComp2 cpy Offset2
bcc Loop2
longm
stz answer
IJExit longm
return
ENDP
****************************************************************
;This is W_Stuff that changes font when inserting
W_MakeFontChange PROC EXPORT
;Using wpglobals
local O1:w,O2:w,font1:l,col1:w,font2:l,col2:w
local bytes1:w,bytes2:w,W_Ptr:l,cbytes1:w,cbytes2:w
local LineRec:l,ChrPtr:l
output ChangeBytes:w
begin
stz ChangeBytes
pha
pushword W_StartPar
pushword W_StartLine
pushword W_StartOffset
jsl W_JunkLeft
pullword O1
pha
pushword W_StartPar
pushword W_StartLine
pushword W_StartOffset
jsl W_JunkRight
pullword O2
spacelong
pha
spacelong
pha
pushword W_StartPar
pushword W_StartLine
pushword O1
jsl W_FindFont
moveword 1:s,col1
movelong 3:s,font1
lda W_StartPar
ldx O1
jsl W_GetAddr
phx
pha
lda W_StartPar
ldx O2
jsl W_GetAddr
phx
pha
jsl W_ReadFont
pullword col2
pullLong font2
pha
pushlong font1
pushword col1
pushlong W_WpFont
pushword W_WPColor
jsl W_CalcFBytes
pullword bytes1
stz bytes2
pha
pushlong W_WpFont
pushword W_WPColor
pushlong font2
pushword col2
jsl W_CalcFBytes
pullword bytes2
ora bytes1
jeq MCExit
pushword W_StartPar
pushword O1
addword bytes1,bytes2,a ;bytes=bytes1+bytes2-(O2-O1)
addword a,O1,a
subword a,O2,s
sta ChangeBytes
jsl W_DoRoom
spaceword
pushword W_StartPar
pushword O1
pushlong font1
pushword col1 ;no check end of par
pushlong W_WpFont
pushword W_WPColor
jsl W_WriteFBytesNE
pullword cbytes1
subword bytes1,cbytes1,bytes1
lda cbytes1
beq NoPutInLine
pha
jsl W_CheckCol
pla
NoPutInLine
spaceword
lda W_StartPar
pha
addword O1,bytes1,W_StartOffset
pha
pushlong W_WpFont
pushword W_WPColor
pushlong font2
pushword col2
jsl W_WriteFBytesNB
pullword cbytes2
subword changebytes,cbytes1,a
subword a,cbytes2,changebytes
MCExit
stz W_WPFontFlag
return
ENDP
**************************************************
|