home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / EXTRA-ST / CPM-80-E / CPM-0.2 / CPM-0 / cpm-0.2 / z80-sources / mylib / bioscall.mac < prev    next >
Encoding:
Text File  |  1994-06-06  |  1.4 KB  |  43 lines

  1. ;************************************************************************
  2. ;*        call the CBIOS to execute spec. function        *
  3. ;************************************************************************
  4.  
  5.         .z80            ;
  6.         entry _bioscall        ;
  7.  
  8.         maclib BDOSCALL.MLB    ; definition of the BDOS functions
  9.  
  10. _bioscall:    push hl            ; save l, the first time we do
  11.         ld hl,0            ; some checking
  12.         ld a,(hl)        ; first byte is start of wboot-vector
  13.         cp 0c3h            ; no JP-instruction?
  14.         jp nz,bad_jp        ; note we use 8080-Opcode
  15.         inc hl            ; in case you use BIOS INIT
  16.         ld a,(hl)        ; before CPU
  17.         cp 003h            ; correct offset?
  18.         jp nz,bad_jp        ; do not, if false
  19.         inc hl            ; point to high byte of vector
  20.         ld a,(hl)        ; read it
  21.         ld hl,_bioscall        ; point to sequence
  22.         .8080            ; now we risk some program modification
  23.         mvi m,(mvi h)        ; store opcode
  24.         .z80            ; back to good old Zilog
  25.         inc hl            ; next byte
  26.         ld (hl),a        ; and store high(CBIOS) where needed
  27.         inc hl            ; last byte
  28.         .8080            ; I'm afraid we have to do it
  29.         mvi m,(pchl)        ; the JP (HL) Instruction
  30.         .z80            ; huugh, it's done
  31.         pop hl            ; saved function number
  32.         jp _bioscall        ; may execute the function
  33.                     ; ld h,high(cbios)
  34.                     ; jp (hl)
  35. bad_jp:        bdos print_string,bad_jp_msg
  36.         bdos system_reset    ; what never returns
  37.  
  38.         dseg            ;
  39. bad_jp_msg:    db 'bad WBOOT vector$'    ;
  40.         cseg            ;
  41.  
  42.         end            ;
  43.