mach.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /* $Header$ */
  2. /*
  3. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  4. * See the copyright notice in the ACK home directory, in the file "Copyright".
  5. */
  6. con_part(sz,w) register sz; word w; {
  7. while (part_size % sz)
  8. part_size++;
  9. if (part_size == TEM_WSIZE)
  10. part_flush();
  11. if (sz == 1) {
  12. w &= 0xFF;
  13. if (part_size)
  14. w <<= 8;
  15. part_word |= w;
  16. } else {
  17. assert(sz == 2);
  18. part_word = w;
  19. }
  20. part_size += sz;
  21. }
  22. con_mult(sz) word sz; {
  23. long atol();
  24. if (sz != 4)
  25. fatal("bad icon/ucon size");
  26. fprintf(codefile,".data4 %ld\n", atol(str));
  27. }
  28. con_float() {
  29. static int been_here;
  30. if (argval != 4 && argval != 8)
  31. fatal("bad fcon size");
  32. fprintf(codefile,".long\t");
  33. if (argval == 8)
  34. fprintf(codefile,"F_DUM,");
  35. fprintf(codefile,"F_DUM\n");
  36. if ( !been_here++)
  37. {
  38. fprintf(stderr,"Warning : dummy float-constant(s)\n");
  39. }
  40. }
  41. prolog(nlocals) full nlocals; {
  42. fprintf(codefile,"\tjsr Pro\n");
  43. if (nlocals == 0)
  44. return;
  45. else
  46. fprintf(codefile,
  47. "\tldx #[%d].h\n\tlda #[%d].l\n\tjsr Lcs\n",
  48. nlocals, nlocals);
  49. }
  50. mes(type) word type; {
  51. int argt ;
  52. switch ( (int)type ) {
  53. case ms_ext :
  54. for (;;) {
  55. switch ( argt=getarg(
  56. ptyp(sp_cend)|ptyp(sp_pnam)|sym_ptyp) ) {
  57. case sp_cend :
  58. return ;
  59. default:
  60. strarg(argt) ;
  61. fprintf(codefile,".define %s\n",argstr) ;
  62. break ;
  63. }
  64. }
  65. default :
  66. while ( getarg(any_ptyp) != sp_cend ) ;
  67. break ;
  68. }
  69. }
  70. char *segname[] = {
  71. ".sect .text", /* SEGTXT */
  72. ".sect .data", /* SEGCON */
  73. ".sect .rom", /* SEGROM */
  74. ".sect .bss" /* SEGBSS */
  75. };