mirror of
https://github.com/antoinevignau/source.git
synced 2024-11-18 01:05:18 +00:00
1 line
7.3 KiB
Plaintext
1 line
7.3 KiB
Plaintext
|
load 'macros.dump'
include 'driver.equ'
include 'scrap.equ'
include 'sssc.equ'
IMPORT X_AsciitoWPScrap
IMPORT D_BeachBall
IMPORT D_CurCursor
IMPORT X_DBtoPLScrap
IMPORT D_GrowHandle
IMPORT D_GrowLHandle
IMPORT D_NeedHand
IMPORT D_NeedHandle
IMPORT X_OldCursor
IMPORT X_ParBlockSize
IMPORT D_SetCursor
import X_AsciiFilter
IMPORT CellBody
IMPORT D_Deref
IMPORT EndCellBody
IMPORT X_FSScratch
IMPORT X_InitFieldScanner
IMPORT X_NextField
IMPORT X_FormatValue
IMPORT D_UnLock
import X_ClipData
X_ScPLtoAsciiScrap PROC EXPORT
;Using D_CursorData
;Using X_ClipData
input Src:l
local Sptr:l,Ssize:l,Dptr:l,Dsize:l,Doff:l
local EndDptr:l,EndSptr:l
output Dest:l
error err
begin
MoveWord >D_CurCursor,X_OldCursor
stz err
SpaceLong
PushLong Src
_GetHandleSize
sta err
PullLong Ssize
jcs exit
SpaceLong
PushLong Ssize
jsl D_NeedHand
sta err
PullLong Dest
jcs exit
MoveLong [Dest],Dptr
Stzl Doff
PushLong Src
_HLock
AddLong [Src],#7,Sptr
AddLong [Src],Ssize,EndSptr
loop Cmpl Sptr,EndSptr
jge done
shortm
lda [Sptr]
cmp #$20
bge normal
cmp #$9
beq normal
cmp #CR
bne notcr
longm
Addwl #7,Sptr
jsl D_BeachBall
shortm
lda #CR
brl normal
LONGA Off
notcr cmp #1
bne notfont
longm
Addwl #3,Sptr
brl loop
LONGA Off
notfont longm
Addwl #2,Sptr
brl loop
LONGA Off
normal sta [Dptr]
longm
IncLong Sptr
IncLong Doff
IncLong Dptr
brl loop
mem_err PushLong Dest
_DisposeHandle
PushLong Src
_HUnlock
brl exit
done PushLong Src
_HUnlock
PushLong Doff
PushLong Dest
jsl D_GrowHandle
exit PushWord X_OldCursor
jsl D_SetCursor
return err
ENDP
;************************************************************************
;
; X_WPtoAsciiScrap
;
;************************************************************************
X_ScWPtoAsciiScrap PROC EXPORT
;Using X_SWScrapEquates
;Using X_WPScrapData
;Using D_CursorData
;Using X_ClipData
input Src:l
local Sptr:l,Pars:w,Block:l,Bptr:l,Bsize:l
local Dptr:l,Dsize:l,FirstPar:w,Offset:w,NextPar:w
local Doff:l,Pptr:l
output Dest:l
error err
begin
MoveWord >D_CurCursor,X_OldCursor
stz err
Spacelong
_MaxBlock
PullLong Dsize
SpaceLong
PushLong Dsize
PushWord #X_Locked
jsl D_NeedHandle
sta err
PullLong Dest
jcs exit1
PushLong Src
_HLock
MoveLong [Src],Sptr
MoveWord [Sptr],Pars
AddLong Sptr,#2,Pptr
MoveLong [Pptr],Block
PushLong Block
_HLock
MoveLong [Block],Bptr
MoveWord [Bptr],Bsize
MoveLong [Dest],Dptr
stz Dsize+2
MoveWord Bsize,Dsize
stzl Doff
parloop jsl D_BeachBall
MoveWord [Pptr]:#4,Offset
AddWord Offset,#7,Offset
charloop shortm
ldy Offset
lda [Bptr],y
cmp #CR+1
jge notspecial
cmp #9
jeq notspecial
cmp #CR
jeq X_DoCR
cmp #1
jeq dofont
longm
AddWord Offset,#2,Offset
brl charloop
dofont longm
AddWord Offset,#3,Offset
brl charloop
X_DoCR sta [Dptr]
longm
inc Doff
bne x4
inc Doff+2
x4 inc Dptr
bne x5
inc Dptr+2
x5 inc Offset
dec Pars
jeq exit
AddLong Pptr,#X_ParBlockSize,Pptr
Cmpl Block,[Pptr]
jeq parloop
MoveLong [Pptr],Block
MoveLong [Block],Bptr
MoveWord [Bptr]:#2,Bsize
stz Bsize+2
lda Dsize
clc
adc Bsize
sta Dsize
bcc noadd1
inc Dsize+2
noadd1 SpaceLong
PushLong Dsize
PushLong Dest
jsl D_GrowLHandle
sta err
PullLong Dptr
jcs Exit
AddLong Dptr,Doff,Dptr
brl parloop
LONGA Off
notspecial
sta [Dptr]
longm
inc Doff
bne x1
inc Doff+2
x1 inc Dptr
bne x2
inc Dptr+2
x2 inc Offset
brl charloop
exit PushLong Block
_HUnlock
PushLong Src
_HUnlock
PushLong Dest
_HUnlock
lda err
jeq NoErrors
pushlong Dest
_DisposeHandle
bra Exitcursor
NoErrors
lda Doff
dec a
tax
bne nohistuff
lda Doff+2
dec a
bra histuff
nohistuff
lda Doff+2
histuff pha
phx
PushLong Dest
jsl D_GrowHandle
sta err
ExitCursor
PushWord X_OldCursor
jsl D_SetCursor
Exit1
return err
ENDP
;***********************************************************************
;
; X_SStoAsciiScrap
; From a D_SS-type scrap, generate an ascii textblock (handle)
; s.t. cells are seperated by tabs and rows by carriage returns.
;
;X_SSScrapRow
|