diff options
-rw-r--r-- | compiler/assemble.pas | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/compiler/assemble.pas b/compiler/assemble.pas index 5bf009404a..dbb564c995 100644 --- a/compiler/assemble.pas +++ b/compiler/assemble.pas @@ -103,13 +103,17 @@ interface Procedure AsmClear; {# Write a string to the assembler file } + Procedure AsmWrite(const c:char); Procedure AsmWrite(const s:string); + Procedure AsmWrite(const s:ansistring); {# Write a string to the assembler file } Procedure AsmWritePChar(p:pchar); {# Write a string to the assembler file followed by a new line } + Procedure AsmWriteLn(const c:char); Procedure AsmWriteLn(const s:string); + Procedure AsmWriteLn(const s:ansistring); {# Write a new line to the assembler file } Procedure AsmLn; @@ -455,6 +459,16 @@ Implementation end; + Procedure TExternalAssembler.AsmWrite(const c: char); + begin + if OutCnt+1>=AsmOutSize then + AsmFlush; + OutBuf[OutCnt]:=c; + inc(OutCnt); + inc(AsmSize); + end; + + Procedure TExternalAssembler.AsmWrite(const s:string); begin if OutCnt+length(s)>=AsmOutSize then @@ -465,6 +479,38 @@ Implementation end; + Procedure TExternalAssembler.AsmWrite(const s:ansistring); + var + StartIndex, ToWrite: longint; + begin + if s='' then + exit; + if OutCnt+length(s)>=AsmOutSize then + AsmFlush; + StartIndex:=1; + ToWrite:=length(s); + while ToWrite>AsmOutSize do + begin + Move(s[StartIndex],OutBuf[OutCnt],AsmOutSize); + inc(OutCnt,AsmOutSize); + inc(AsmSize,AsmOutSize); + AsmFlush; + inc(StartIndex,AsmOutSize); + dec(ToWrite,AsmOutSize); + end; + Move(s[StartIndex],OutBuf[OutCnt],ToWrite); + inc(OutCnt,ToWrite); + inc(AsmSize,ToWrite); + end; + + + procedure TExternalAssembler.AsmWriteLn(const c: char); + begin + AsmWrite(c); + AsmLn; + end; + + Procedure TExternalAssembler.AsmWriteLn(const s:string); begin AsmWrite(s); @@ -472,6 +518,13 @@ Implementation end; + Procedure TExternalAssembler.AsmWriteLn(const s: ansistring); + begin + AsmWrite(s); + AsmLn; + end; + + Procedure TExternalAssembler.AsmWritePChar(p:pchar); var i,j : longint; |