www.pudn.com > tp60src.zip > COMPILER.INC
Invoke macro Name global Name:near call Name endm Chain macro Name global Name:near jmp Name endm Argm macro Symbol,SType,Count local Offset @AP = @AP + SType * Count Offset = @AP Symbol equ (SType ptr [bp+@AF-Offset]) endm @AP = 0 @AF = 0 Loc macro Symbol,SType,Count local Offset,S @LP = @LP + SType * Count Offset = @LP Symbol equ (SType ptr [bp-Offset]) endm @LP = 0 Entry macro Dist @Dist = 0 ifidni, @Dist = 1 push bp mov bp,sp elseif @LP ne 0 or @AP ne 0 ifndef cmd inc bp endif push bp mov bp,sp endif @AF = @AP + 6 if @LP ne 0 @LP = (@LP + 1) and 0fffeh sub sp,@LP endif endm Exit macro if @Dist eq 1 if @LP ne 0 mov sp,bp endif pop bp elseif @LP ne 0 or @AP ne 0 if @LP ne 0 mov sp,bp endif pop bp ifndef cmd dec bp endif endif ret @AP @AP = 0 @LP = 0 endm dwc macro a,b dw h&a&_&b endm zeroc macro a,b @h&a&_&b=0 endm peekc macro a,b,c a=@h&b&_&c endm pokec macro a,b,c @h&a&_&b=c endm fixupc macro a,b h&a&_&b=@h&a&_&b endm @hn=0 hash macro nbuck local nb @i=0 @hn=@hn+1 @nb=nbuck nb=@nb dw (nb-1) shl 1 rept @nb dwc %@hn,%@i zeroc %@hn,%@i @i=@i+2 endm endm hvalue macro nm,nb local a,i @i=0 @hs=0 irpc @c, @i=@i+1 @hs=@hs+'&@c&'-1 endm @hs=(@hs*2) and ((nb-1) shl 1) endm hent macro nm,code hvalue nm,%@nb peekc a,%@hn,%@hs pokec %@hn,%@hs,$ dw a i=@i db code db i,'&nm&' endm hend macro @i=0 rept @nb fixupc %@hn,%@i @i=@i+2 endm endm Offs equ (word ptr 0) Segm equ (word ptr 2) W0 equ (word ptr 0) W2 equ (word ptr 2) W4 equ (word ptr 4) W6 equ (word ptr 6) W8 equ (word ptr 8) B0 equ (byte ptr 0) B1 equ (byte ptr 1) B2 equ (byte ptr 2) B3 equ (byte ptr 3) B4 equ (byte ptr 4) B5 equ (byte ptr 5) B6 equ (byte ptr 6) B7 equ (byte ptr 7) B8 equ (byte ptr 8) B9 equ (byte ptr 9) Regs struc rAX dw ? rBX dw ? rCX dw ? rDX dw ? rBP dw ? rSI dw ? rDI dw ? rDS dw ? rES dw ? rCSIP label dword rIP dw ? rCS dw ? rFL dw ? rSP dw ? rSS dw ? ends rByte equ 80h TUnitHeader struc uhSignature db 'TPU9' uhNext dw ? uhLink dw ? uhName dw ? uhInterface dw ? uhProcMap dw ? uhCodeMap dw ? uhConstMap dw ? uhDataMap dw ? uhEndMaps dw ? uhUnits dw ? uhSources dw ? uhTrace dw ? uhEndTrace dw ? uhCodeSize dw ? uhConstSize dw ? uhCodeFixupSize dw ? uhDataFixupSize dw ? uhDataSize dw ? uhDebugHash dw ? uhFlags dw ? uhCodeStart dw ? uhCodeLength dw ? uhOverlayLength dw ? uhTpuName dw ? uhCodeSeg dw ? uhConstSeg dw ? uhCodeFixupSeg dw ? uhConstFixupSeg dw ? uhReserved dw 10 dup(?) ends uf8087 equ 1 ufOverlay equ 2 TTypeDescriptor struc tdType db ? tdModifier db ? tdSizeOf dw ? tdNext dw ? ends ttVoid equ 0 ttArray equ 1 ttRecord equ 2 ttObject equ 3 ttFile equ 4 ttText equ 5 ttProc equ 6 ttSet equ 7 ttPointer equ 8 ttString equ 9 tt8087 equ 10 ttReal equ 11 ttInteger equ 12 ttBoolean equ 13 ttChar equ 14 ttEnum equ 15 tmVoid equ 1 shl ttVoid tmArray equ 1 shl ttArray tmRecord equ 1 shl ttRecord tmObject equ 1 shl ttObject tmFile equ 1 shl ttFile tmText equ 1 shl ttText tmProc equ 1 shl ttProc tmSet equ 1 shl ttSet tmPointer equ 1 shl ttPointer tmString equ 1 shl ttString tm8087 equ 1 shl tt8087 tmReal equ 1 shl ttReal tmInteger equ 1 shl ttInteger tmBoolean equ 1 shl ttBoolean tmChar equ 1 shl ttChar tmEnum equ 1 shl ttEnum TArrayType struc TTypeDescriptor <> atBase dd ? atBounds dd ? ends TRecordType struc TTypeDescriptor <> rtHash dw ? rtFirst dw ? ends TObjectType struc TRecordType <> otParent dd ? otVMTSize dw ? otVMTAddr dw ? otVMTOffset dw ? otName dw ? otReserved dw ? otReserved2 dw ? otReserved3 dd ? ends TFileType struc TTypeDescriptor <> ftBase dd ? ends TSetType struc TTypeDescriptor <> stBase dd ? ends TPointerType struc TTypeDescriptor <> ptBase dd ? ends TProcParam struc ppType dd ? ppFlags db ? ends TProcType struc TTypeDescriptor <> ptResult dd ? ptParamCount dw ? ptParams label TProcParam ends TOrdinalType struc TTypeDescriptor <> itLowerBound dd ? itUpperBound dd ? itBase dd ? ends TEnumType struc TOrdinalType <> etSet TSetType <> etReserved dw ? ends TSymbol struc sePrev dw ? seType db ? seName db ? ends TLabelStub struc lsLink dw ? ends TConstStub struc csType dd ? csValue equ $ ends TTypeStub struc tsType dd ? ends TVarStub struc vsFlags db ? vsAddress label dword vsLink label dword vsOffset dw ? vsScope label word vsMap label word vsNext dw ? vsType dd ? ends vfVar equ 0 vfConst equ 1 vfLocal equ 2 vfAbsolute equ 3 vfType equ 3 vfAddress equ 4 vfField equ 8 vfAlias equ 10h vfParam equ 20h TProcStub struc psFlags db ? db ? psInlineLen label word psProcMap dw ? psScope dw ? psHash dw ? psOwner dw ? psType label TProcType ends pfFar equ 1 pfInline equ 2 pfInterrupt equ 4 pfExternal equ 8 pfMethod equ 10h pfConstructor equ 20h pfDestructor equ 40h pfAssembler equ 80h ffProc equ 0 ffCode equ 4000h ffData equ 8000h ffConst equ 0c000h ffOffs equ 1000h ffSegm equ 2000h ffPtr equ ffOffs+ffSegm TInlineRecord struc irType db ? irValue dw ? irFixup dd ? ends itByte equ 0 itWord equ 1 itDataFixup equ 2 itConstFixup equ 3 TUnitStub struc usAddress dw ? usChecksum dw ? usNext dw ? usPrev dw ? ends TProcMap struc pmStub dw ? pmFlags dw ? pmCodeMap dw ? pmEntryPoint dw ? ends TSegMap struc smAddr dw ? smLength dw ? smFixupLength dw ? smTrace label word smOwner dw ? ends TUnitList struc ulSegment dw ? ulName db ? ends TSourceList struc slFileType db ? slNumber dw ? slTimeStamp dd ? slName db ? ends TTraceTable struc trSymbol dw ? trSource dw ? trDataBytes dw ? trLineNumber dw ? trLineCount dw ? ends TFixup struc fiUnit dw ? fiMap dw ? fiTarget dw ? fiOffset dw ? ends _InitTurbo equ 4 _HaltError equ 8 _HaltTurbo equ 12 _BlockMove equ 16 _LongMul equ 20 _LongDiv equ 24 _LongShr equ 28 _LongShl equ 32 _LongAbs equ 36 _LongSqr equ 40 _SLoad equ 44 _SStore equ 48 _SLength equ 52 _SCopy equ 56 _SConcat equ 60 _SPos equ 64 _SCompare equ 68 _SChar equ 72 _SPacked equ 76 _SInsert equ 80 _SDelete equ 84 _ZLoad equ 88 _ZStore equ 92 _ZInTest equ 96 _FTrunc equ 100 _FRound equ 104 _FInt equ 108 _FSqrt equ 112 _FSin equ 116 _FCos equ 120 _FArcTan equ 124 _FLn equ 128 _FExp equ 132 _NewPtr equ 136 _DisposePtr equ 140 _MarkPtr equ 144 _ReleasePtr equ 148 _GetFreMem equ 152 _GetFreMax equ 156 _ZClear equ 160 _ZAddComp equ 164 _ZAddRange equ 168 _ZUnion equ 172 _ZDifference equ 176 _ZIntersect equ 180 _ZEqual equ 184 _ZRelation equ 188 _GetParCnt equ 192 _GetIORes equ 196 _InOutCheck equ 200 _RangeCheck equ 204 _StackCheck equ 208 _WriteFloat equ 212 _WriteStr equ 216 _WriteInt equ 220 _WriteBool equ 224 _WriteChar equ 228 _WriteLine equ 232 _WriteEnd equ 236 _WriteFile equ 240 _ReadFloat equ 244 _ReadStr equ 248 _ReadInt equ 252 _ReadChar equ 256 _ReadLine equ 260 _ReadEnd equ 264 _ReadFile equ 268 _InitRand equ 272 _AssignText equ 276 _ResetText equ 280 _RewriteText equ 284 _CloseText equ 288 _AssignFile equ 292 _ResetFile equ 296 _RewriteFile equ 300 _CloseFile equ 304 _EraseFile equ 308 _RenameFile equ 312 _GetSEoln equ 316 _GetSEof equ 320 _GetTEoln equ 324 _GetTEof equ 328 _ReadBlock equ 332 _WriteBlock equ 336 _SeekFile equ 340 _GetFPos equ 344 _GetFSize equ 348 _GetFEof equ 352 _FFrac equ 356 _UpperCase equ 360 _TruncFile equ 364 _FillMem equ 368 _RandInt equ 372 _RandFloat equ 376 _GetParStr equ 380 _MoveMem equ 384 _StrInt equ 388 _ValInt equ 392 _StrFloat equ 396 _ValFloat equ 400 _DirGet equ 404 _DirSet equ 408 _DirCreate equ 412 _DirRemove equ 416 _AppendText equ 420 _FlushText equ 424 _BufferText equ 428 _FRealExt equ 432 _FExtReal equ 436 _RAdd equ 440 _RSub equ 444 _RMul equ 448 _RDiv equ 452 _RCmp equ 456 _RFloat equ 460 _RTrunc equ 464 _RRound equ 468 _RSqr equ 472 _WriteReal equ 476 _ReadReal equ 480 _StrReal equ 484 _ValReal equ 488 _RInt equ 492 _RFrac equ 496 _RSqrt equ 500 _RSin equ 504 _RCos equ 508 _RLn equ 512 _RExp equ 516 _RArcTan equ 520 _RandReal equ 524 _InitEM86 equ 528 _InitEM87 equ 532 _Construct equ 536 _Destruct equ 540 _CopyObject equ 544 _MethodCheck equ 548 fnNeed8087 equ 8000h fnImmediate equ 4000h _Void equ 72h _File equ 78h _EmptySet equ 8ch _Pointer equ 96h _String equ 0a0h _Extended equ 0c0h _Real equ 0c6h _Byte equ 0deh _Integer equ 0f0h _Word equ 102h _Longint equ 114h _Boolean equ 130h _Char equ 14ch _OvrCodeList equ (word ptr 0) _OvrHeapSize equ (word ptr 2) _OvrDebugPtr equ (dword ptr 4) _OvrHeapOrg equ (word ptr 8) _OvrHeapPtr equ (word ptr 10) _OvrHeapEnd equ (word ptr 12) _OvrLoadList equ (word ptr 14) _OvrDosHandle equ (word ptr 16) _OvrEmsHandle equ (word ptr 18) _HeapOrg equ (dword ptr 20) _HeapPtr equ (dword ptr 24) _HeapEnd equ (dword ptr 28) _FreeList equ (dword ptr 32) _FreeZero equ (dword ptr 36) _HeapError equ (dword ptr 40) _ExitProc equ (dword ptr 44) _ExitCode equ (word ptr 48) _ErrorAddr equ (dword ptr 50) _PrefixSeg equ (word ptr 54) _StackLimit equ (word ptr 56) _InOutRes equ (word ptr 58) _RandSeed equ (dword ptr 60) _FileMode equ (byte ptr 64) _Test8087 equ (byte ptr 65) _Input equ 0 _Output equ 100h fHandle equ (word ptr 0) fMode equ (word ptr 2) fBufSize equ (word ptr 4) fPrivate equ (word ptr 6) fBufPos equ (word ptr 8) fBufEnd equ (word ptr 10) fBufPtr equ (dword ptr 12) fOpenProc equ (dword ptr 16) fInOutProc equ (dword ptr 20) fFlushProc equ (dword ptr 24) fCloseProc equ (dword ptr 28) fUserData equ (byte ptr 32) fName equ (byte ptr 48) fBuffer equ (byte ptr 128) fRecSize equ 256 fmClosed equ 0d7b0h fmInput equ 0d7b1h fmOutput equ 0d7b2h fmInOut equ 0d7b3h ovSignature equ (word ptr 0) ovSaveReturn equ (word ptr 2) ovFilePos equ (dword ptr 4) ovCodeSize equ (word ptr 8) ovFixupSize equ (word ptr 10) ovJumpCount equ (word ptr 12) ovLink equ (word ptr 14) ovSegment equ (word ptr 16) ovRetryCount equ (word ptr 18) ovNext equ (word ptr 20) ovEmsPage equ (word ptr 22) ovEmsOffset equ (word ptr 24) ovUserData equ (byte ptr 26) ovVectors equ (byte ptr 32) ovRecSize equ 32 TExpr struc exType dd ? exCode dw ? exLocation db ? exModifier db ? exRegsUsed db ? exMisc db ? exValue dt ? exOffset equ (word ptr exValue) exMap equ (word ptr exValue+2) exSegment equ (word ptr exValue+4) exOwner equ (dword ptr exValue+6) exChain1 equ (word ptr exValue) exChain2 equ (word ptr exValue+2) ends elMemory equ 0 elRegister equ 1 elImmediate equ 2 elAddress equ 3 elCondition equ 4 elPushed equ 5 elStack equ 6 elCall equ 7 emSigned equ 1 emUnsigned equ 2 emX equ 4 emXX equ 8 emBoolean equ 0 emByte equ emUnsigned emShortint equ emSigned emInteger equ emSigned+emX emWord equ emUnsigned+emX emLongint equ emSigned+emX+emXX emSingle equ 0 emExtended equ 2 emDouble equ 4 emComp equ 8 emReal equ 4 emNotVirtual equ 1 emNewConstruct equ 2 emDisposeDestr equ 4 erAX equ 1 erCX equ 2 erDX equ 4 erBX equ 8 erAll equ erAX+erCX+erDX+erBX efDS equ 1 efSS equ 2 efCS equ 4 efES equ 8 efBP equ 10h efDI equ 20h efConst equ 40h efSeg equ 80h efReadOnly equ 80h lvAX equ 0 lvCX equ 1 lvDX equ 2 lvBX equ 3 lvSI equ 6 lvDI equ 7 lrR1 equ 0 lrR2 equ 1 cdBelow equ 72h cdNotBelow equ 73h cdEqual equ 74h cdNotEqual equ 75h cdNotAfter equ 76h cdAfter equ 77h cdLess equ 7ch cdNotLess equ 7dh cdNotGreater equ 7eh cdGreater equ 7fh cdAlways equ 0ebh t_Ident equ 1 t_Constant equ 2 tPlus equ 3 tMinus equ 4 tTimes equ 5 tSlash equ 6 tEqual equ 7 tNotEqual equ 8 tGreater equ 9 tLess equ 10 tGEq equ 11 tLEq equ 12 tOParen equ 13 tCParen equ 14 tOBracket equ 15 tCBracket equ 16 tPoint equ 17 tComma equ 18 tColon equ 19 tSemicolon equ 20 tCaret equ 21 tAssign equ 22 tRange equ 23 tAt equ 24 tInlineSlash equ 25 tConstEqual equ 26 tAnd equ 28 tArray equ 29 tBegin equ 30 tCase equ 31 tConst equ 32 tConstructor equ 33 tDestructor equ 34 tDiv equ 35 tDo equ 36 tDownto equ 37 tElse equ 38 tEnd equ 39 tAsm equ 40 tFile equ 41 tFor equ 42 tFunction equ 44 tGoto equ 45 tIf equ 46 tImplementation equ 47 tIn equ 48 tInline equ 49 tInterface equ 50 tLabel equ 52 tMod equ 53 tNil equ 54 tNot equ 55 tObject equ 56 tOf equ 57 tOr equ 58 tPacked equ 59 tProcedure equ 60 tProgram equ 61 tRecord equ 62 tRepeat equ 63 tSet equ 64 tShl equ 65 tShr equ 66 tString equ 67 tThen equ 68 tType equ 69 tTo equ 70 tUnit equ 71 tUntil equ 72 tUses equ 73 tVar equ 74 tWhile equ 76 tWith equ 77 tXor equ 78 t_Label equ 79 t_Const equ 80 t_Type equ 81 t_Var equ 82 t_Proc equ 83 t_StdProc equ 84 t_StdFun equ 85 t_New equ 86 t_Port equ 87 t_Mem equ 88 t_Unit equ 89 t_@Seg equ 90 t_@Loc equ 91 t_StdType equ 92 t_Reg equ 93 tAbsolute equ 100 tAssembler equ 101 tExternal equ 102 tFar equ 103 tForward equ 104 tInterrupt equ 105 tNear equ 106 tVirtual equ 107 tPrivate equ 108 t_Private equ 80h opPlus equ 0 opMinus equ 1 opTimes equ 2 opDiv equ 3 opMod equ 4 opShl equ 5 opShr equ 6 opAnd equ 7 opOr equ 8 opXor equ 9 opEqual equ 10 opNotEqual equ 11 opGreater equ 12 opLess equ 13 opGEq equ 14 opLEq equ 15 opSlash equ 16 coIOChk equ 1 coRangeChk equ 2 coStackChk equ 4 coExtSyntax equ 8 coVarStringChk equ 10h coForceFarCalls equ 20h coBooleanEval equ 40h co8087 equ 80h coDebugInfo equ 100h coLocalSymbols equ 200h coEmulation equ 400h coOverlayCode equ 800h coWordAlign equ 1000h co286Code equ 2000h coWinFrame equ 4000h coGlobal equ 8000h cfUseUnits equ 1 cfDisk equ 2 cfBuild equ 4 cfMake equ 8 cfForceUnit equ 20h cfDebugging equ 40h cfLinkMap equ 3 cfSegmentsMap equ 1 cfPublicsMap equ 2 cfDetailedMap equ 3 cfExtDebugger equ 4 cfIntDebugger equ 8 cfDiskBuffer equ 10h psNoProgram equ 0 psCompiled equ 1 psRunning equ 2 psTerminated equ 3 plDisk equ 1 plMemory equ 2 TFileStack struc fsTextPos dw ? fsLineNumber dw ? fsFilePos dd ? fsFileName dw ? fsFileHandle dw ? fsLineLength dw ? fsNameEntry dw ? fsCurrentLine db 128 dup(?) fsNestLevel dw ? fsName db 80 dup(?) ends psMainProgram equ -1 psInterface equ 1 psImplementation equ 2 fePas equ 1 feExe equ 2 feTpu equ 3 feObj equ 4 feMap equ 5 feOvr equ 6 feForceExt equ 80h fdOutputDir equ 2 fdIncludeDir equ 3 fdUnitDir equ 4 fdObjectDir equ 5 fdNoEditor equ 80h TWithChain struc wcType db ? wcFlags db ? wcOffset dw ? wcMap dw ? wcSegment dw ? wcOwner dd ? wcNext dw ? ends wfNoTempVar equ 1 wfTempVar equ 2 THeapRecord struc hrAddress dd ? hrLimit dw ? hrError dw ? ends .data? extrn InitOptions:word extrn InitDefines:word extrn SourceBufPtr:word extrn SourceBufEnd:word extrn ErrorNum:word extrn ErrorPar:word extrn ErrorPos:word extrn LibraryUnits:word extrn FileStackPtr:word extrn SaveFileStack:word extrn TempBufPtr:word extrn TpuListPtr:word extrn ErrorHandler:word extrn ErrorSP:word extrn ErrorBP:word extrn ObjectFileSize:word extrn ObjectFileSeg:word extrn ProgramLocation:word extrn CodeSize:dword extrn DataSize:word extrn TotalLines:dword extrn FirstHeapRec:word extrn EndHeapRec:word extrn ExactAlloc:byte extrn FirstUnit:word extrn UsedUnit:word extrn CurDepth:word extrn SymbolType:dword extrn CompilerOptions:word extrn ParamsSize:word extrn ParamsBottom:word extrn ProcResult:word extrn LocalsSize:word extrn LocalsBottom:word extrn TempLocalsSize:word extrn WithChain:word extrn LabelChain:word extrn LastGoal:word extrn ExitChain:word extrn FailChain:word extrn FirstLineNumber:word extrn LastLineNumber:word extrn CurOwner:word extrn CurProc:word extrn CurScope:word extrn InStmtPart:byte extrn FileHandle:word extrn ExeHandle:word extrn DataStart:word extrn DebugInfoSize:dword extrn StackStart:word extrn DataSegment:dword extrn CompilerFlags:word extrn UnitName:word extrn StackSize:word extrn MinHeapSize:word extrn MaxHeapSize:word extrn GlobalOptions:word extrn SavedDepth:word extrn SavedDepth2:word extrn DefinesPtr:word extrn TextPos:word extrn SaveDefinesPtr:word extrn UnitNameLen:word extrn NextUnit:word extrn PrevUnit:word extrn InterfaceEnd:word extrn CompilingSystem:byte extrn SystemUnit:word extrn CurrentToken:byte extrn SlashToken:byte extrn EqualToken:byte extrn PrivateFlag:byte extrn ProgramSection:byte extrn DefUnitFlags:word extrn IndexModifier:byte extrn SymbolHash:byte extrn CurrentSymbol:dword extrn CurrentHash:word extrn CurrentWith:word extrn CurrentOwner:dword extrn VarsSize:word extrn LastTraceTable:word extrn CodeSectStart:word extrn ConstSectStart:word extrn LastCodeFixup:word extrn LastConstFixup:word extrn DataSectStart:word extrn ConstSectStart2:word extrn Dictionary:dword extrn ProcMap:dword extrn CodeMap:dword extrn ConstMap:dword extrn DataMap:dword extrn UnitList:dword extrn SourceList:dword extrn TraceTable:dword extrn TempDict:dword extrn CompiledCode:dword extrn CompiledConst:dword extrn CodeFixups:dword extrn ConstFixups:dword extrn StmtPart:dword extrn FileNameBuf:byte extrn ExeName:byte extrn IdentBuf:byte extrn SymbolValue:byte extrn Directories:word extrn TempBuffer:byte extrn TpuList:byte extrn DefinesBuf:byte extrn FileStack:TFileStack extrn CompMemPtr:word extrn CompMemTop:word extrn SourceBuffer:word extrn ProgramSegment:word extrn DebuggerPSP:word extrn SourceCount:word extrn Use8087:byte locals @@