system.pp 943 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. unit system;
  2. {$ASMMODE intel}
  3. interface
  4. {$ifdef FULL_RTL}
  5. {$DEFINE FPC_INCLUDE_SOFTWARE_MUL}
  6. {$I systemh.inc}
  7. {$endif FULL_RTL}
  8. const
  9. maxExitCode = 255;
  10. {$ifndef FULL_RTL}
  11. type
  12. DWord = LongWord;
  13. Cardinal = LongWord;
  14. Integer = SmallInt;
  15. UInt64 = QWord;
  16. HRESULT = LongInt;
  17. {$endif FULL_RTL}
  18. procedure DebugWrite(const S: string);
  19. procedure DebugWriteLn(const S: string);
  20. implementation
  21. {$ifdef FULL_RTL}
  22. {$I system.inc}
  23. {$endif FULL_RTL}
  24. procedure fpc_Initialize_Units;[public,alias:'FPC_INITIALIZEUNITS']; compilerproc;
  25. begin
  26. end;
  27. procedure do_exit;[Public,Alias:'FPC_DO_EXIT'];
  28. begin
  29. asm
  30. mov ax, 4c00h
  31. int 21h
  32. end;
  33. end;
  34. procedure DebugWrite(const S: string);
  35. begin
  36. asm
  37. mov si, S
  38. lodsb
  39. mov cl, al
  40. xor ch, ch
  41. mov ah, 2
  42. @@1:
  43. lodsb
  44. mov dl, al
  45. int 21h
  46. loop @@1
  47. end;
  48. end;
  49. procedure DebugWriteLn(const S: string);
  50. begin
  51. DebugWrite(S);
  52. DebugWrite(#13#10);
  53. end;
  54. end.