home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / SIMTEL / CPMUG / CPMUG008.ARK / BIOSGO.LIB < prev    next >
Text File  |  1984-04-29  |  2KB  |  73 lines

  1.  
  2. ;++++++++++++++++++++++++++++++++++++++++++++++
  3. ;
  4. ; BIOS ADDRESS TRANSFER PROGRAM
  5. ;
  6. ; BIOSGO.LIB  -  Version 0.1  -  5 NOV 77
  7. ;
  8. ; Jeffrey W. Shook
  9. ; P.O. Box 185
  10. ; Rocky Point, NY 11778
  11. ; (516) 744 7133
  12. ;
  13. ;++++++++++++++++++++++++++++++++++++++++++++++
  14.  
  15.  
  16. ; This program allows access to the BIOS functions
  17. ; independent of the size of the CP/M system.
  18. ; This is accomplished in the following way:
  19. ;
  20. ;    1)  The user program calls an entry in
  21. ;        the BIOSGO entry table.
  22. ;    2)  The call to BIOSGO in the table
  23. ;        pushes the address of the next table
  24. ;        entry on the stack and jumps to BIOSGO.
  25. ;    3)  BIOSGO subtracts the address of the start
  26. ;        of the table from the address of the
  27. ;        entry point to obtain the offset from
  28. ;        the start of the table.
  29. ;    4)  This offset is then added to the starting
  30. ;        address of the BIOS jump table in the CP/M
  31. ;        system, and the result is pushed onto the
  32. ;        stack.
  33. ;    5)  A RET instruction is executed to
  34. ;        pop the address into the program counter.
  35. ;        Control is thus transferred to the proper
  36. ;        BIOS routine and the return address of
  37. ;        the original caller is still on the stack.
  38.  
  39.  
  40. ; BIOS FUNCTION CALLING TABLE
  41.  
  42. ; Be sure not to remove any entries from
  43. ; this table or the wrong function will
  44. ; be called.
  45.  
  46. WBOOT:    CALL    BIOSGO
  47. CONST:    CALL    BIOSGO
  48. CONIN:    CALL    BIOSGO
  49. CONOUT:    CALL    BIOSGO
  50. LIST:    CALL    BIOSGO
  51. PUNCH:    CALL    BIOSGO
  52. READER:    CALL    BIOSGO
  53. HOME:    CALL    BIOSGO
  54. SELDSK:    CALL    BIOSGO
  55. SETTRK:    CALL    BIOSGO
  56. SETSEC:    CALL    BIOSGO
  57. SETDMA:    CALL    BIOSGO
  58. READS:    CALL    BIOSGO
  59. WRITES:    CALL    BIOSGO
  60.  
  61.  
  62. BIOSGO:    XTHL        ; Get call addr in HL, save HL on stack
  63.     PUSH    D    ; Save DE
  64.     XCHG        ; Move call addr to DE
  65.     LHLD    1    ; Get BIOS entry address
  66.     DAD    D    ; Add call addr to entry addr
  67.     LXI    D,-(WBOOT+3)    ; Get start of table
  68.     DAD    D    ; Subtract table addr
  69.     POP    D    ; Restore DE
  70.     XTHL        ; Restore HL, put jump addr on stack
  71.     RET        ; Jump to BIOS routine
  72.  
  73.