ORCA-C/ObjOut.pas

1 line
18 KiB
ObjectPascal
Raw Normal View History

{$optimize 7} {---------------------------------------------------------------} { } { ObjOut } { } { This unit has the primitive routines used to actually } { create and write to object modules. A few low-level } { subroutines that need to be in assembly language for speed } { are also included here. } { } { External Subroutines: } { } { CloseObj - close the current obj file } { CloseSeg - close out the current segment } { COut - write a code byte to the object file } { CnOut - write a byte to the constant buffer } { CnOut2 - write a word to the constant buffer } { DestroySuffixes - destroy the .a, .b, etc suffixes } { FindSuffix - find the next available alphabetic suffix } { Header - write a segment header to the output file } { OpenObj - open a new obj file with the indicated file name } { OpenSeg - create a new segment and mark its beginning } { Out - write a byte to the output file } { Out2 - write a word to the output file } { Purge - write any constant bytes to the output buffer } { } {---------------------------------------------------------------} unit CCommon; interface {$LibPrefix '0/obj/'} uses CCommon, CGI, CGC; {$segment 'CodeGen'} procedure CloseObj; { close the current obj file } { } { Note: Declared as extern in CGI.pas } procedure COut (b: integer); extern; { write a code byte to the object file } { } { parameters: } { b - byte to write } procedure CnOut (i: integer); extern; { write a byte to the constant buffer } { } { parameters: } { i - byte to write } procedure CnOut2 (i: integer); extern; { write a word to the constant buffer } { } { parameters: } { i - word to write } procedure DestroySuffixes (var name: gsosOutString); { destroy the .a, .b, etc suffixes } { } { parameters: } { name - root name of file sequence to destroy } procedure CloseSeg; { close out the current segment } procedure FindSuffix (var name: gsosOutString; var ch: char); { find the next available alphabetic suffix } { } { parameters: } { ch - addr to place suffix character } { name - root name of suffix to find } procedure Header (name: stringPtr; kind: integer; lengthCode: integer); { write a segment header to the output file } { } { parameters: } { name - name of the segment } { kind - segment kind } {