z80.doc 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. THE Z80 BACK END TABLE
  2. INTRODUCTION
  3. This table was written to make it run, not to make it clever!
  4. The effect is, that the table written for the intel 8080,
  5. which was made very clever runs faster and requiers less space!!
  6. So, for anyone to run programs on a z80 machine:
  7. You could try to make the table as clever as the one for the i80,
  8. or you could run the i80 table, for that can run on every z80 too.
  9. IMPLEMENTATION
  10. It will not be possible to run the entire Amsterdam Compiler Kit on a
  11. Z80-based computer system.
  12. One has to write a program on another
  13. system, a system where the compiler kit runs on.
  14. This program may be a mixture of high-level languages, such as
  15. C or Pascal, EM and z80 assembly code.
  16. The program should be compiled using the compiler kit,
  17. producing z80 machine code.
  18. This code should come available to the z80 machine
  19. for example by downloading or
  20. by storing it in ROM (Read Only Memory).
  21. Depending on the characteristics of the particular z80 based system, some
  22. adaptions have to be made:
  23. 1) In 'head_em': the base address, which is the address where the first
  24. z80 instruction will be stored, and the initial value of the
  25. stackpointer are set to 0x1000 and 0x7ffe respectivally.
  26. The latter because it could run on a 32K machine as well.
  27. Other systems require other values.
  28. 2) In 'head_em': before calling "_m_a_i_n", the environment
  29. pointer, argument vector and argument count will have to be pushed
  30. onto the stack.
  31. Since this back-end is tested on a system without any knowledge
  32. of these things, dummies are pushed now.
  33. 3) In 'tail_em': proper routines "putchar" and "getchar" should
  34. be provided.
  35. They should write resp. read a character on/from the monitor.
  36. Maybe some conversions will have to be made.
  37. The ones for the Nascom and Hermac z80 micro's are to be found
  38. in the EM-library.
  39. 4) In 'head_em': an application program returns control to the monitor by
  40. jumping to address 0x20.
  41. If this is not the right way on your system, change it.
  42. For an CPM-machine for example this should be 0x5, to provide a warm boot.
  43. 5) In 'tail_em': the current version of the z80 back-end has very limited I/O
  44. capabilities, because it was tested on a system that
  45. had no knowlegde of files.
  46. So the implementation of the EM-instruction 'mon' is very simple;
  47. it can only do the following things:
  48. Monitor call 1:
  49. Exit
  50. Monitor call 3:
  51. read, always reads from the monitor.
  52. echos the read character.
  53. ignores file descriptor.
  54. Monitor call 4:
  55. write, always writes on the monitor.
  56. ignores file descriptor.
  57. Monitor call 5:
  58. open file, returns file descriptor -1.
  59. Monitor call 6:
  60. close file, returns error code = 0.
  61. Monitor call 54:
  62. io-control, returns error code = 0.
  63. If the system should do file-handling the routine ".mon"
  64. should be extended thoroughly.