home *** CD-ROM | disk | FTP | other *** search
/ ftp.whtech.com / ftp.whtech.com.7z / ftp.whtech.com / emulators / v9t9 / linux / sources / V9t9 / tools / Forth / dev.inc < prev    next >
Encoding:
Text File  |  2006-10-19  |  2.0 KB  |  100 lines

  1. ;    V9t9: the TI Emulator! v6.0 Source 
  2. ;    Copyright (c) 1996 by Edward Swartz
  3.  
  4. ;    DEV.INC
  5. ;
  6. ;    Peripheral device access.
  7. ;
  8. ;
  9.  
  10.  
  11. ;==========================================================================
  12. ;    Device init.
  13. ;
  14. ;    Execute each DSR's initialization routine.
  15. ;==========================================================================
  16.  
  17. haa    byte    >aa
  18.     byte    0
  19.  
  20. dinit    li    0,>3fff
  21.     mov    0,@vdplimit            ; set up 16k VDP RAM
  22.  
  23.     lwpi    >83e0                  ; be standard
  24.     li    13,>9800
  25.     li    14,>100
  26.     li    15,>8c02
  27.  
  28.     li    12,>0f00            ; start below first DSR
  29. di00    sbz    0
  30.     ab    @h01,12                ; point to next DSR
  31.     ci    12,>2000
  32.     jhe    diout                ; done
  33.  
  34.     sbo    0                    ; turn on ROM
  35.     cb    @>4000,@haa            ; legal rom?
  36.     jne    di00                ; nope
  37.  
  38.     mov    @>4004,1            ; get init ptr
  39.     jeq    di00                ; none
  40. di01    mov    @2(1),11            ; get addr for init
  41.     mov    12,@>83d0
  42.     bl    *11                ; call powerup routine
  43.     mov    *1,1                ; get next powerup
  44.     jne    di01                ; if it exists
  45.     jmp    di00
  46.  
  47. diout    lwpi    mainws                ; restore WP
  48.     rt
  49.  
  50.  
  51. ;--------------------------------------------------------------------------
  52. ;    Disk init.
  53. ;
  54. ;    We want to limit to two buffers, since bitmap mode would otherwise
  55. ;    overwrite it.
  56. ;
  57. ;    With this setup we will ONLY use the emulated disk DSR for stuff.
  58. ;    So, we'll simply write the new info for the real DSR, if installed,
  59. ;    and probe the emulated disk DSR.
  60. ;--------------------------------------------------------------------------
  61.  
  62. noemuerr db    "No emulated disk DSR found!",>ff
  63.     db    "Please install the emulated disk DSR",>ff
  64.     db    "by adding 'EmuDisk' to the DSRCombo",>ff
  65.     db    "variable in FORTH.CNF.",>ff,>ff
  66.     db    "(See DISKS.TXT for info.)",>ff,>ff
  67.     db    "Press Ctrl+Break to halt."
  68.     db    0
  69.  
  70. forthdskdef db    "FORTHDSK  "
  71.     even
  72.  
  73. diskinit dect    SP
  74.     mov    11,*SP
  75.  
  76.     li    0,>3fff
  77.     mov    0,@vdplimit            ; setup
  78.  
  79.     li    12,>1000            ; DSR base for emulated DSR
  80.     sbo    0                ; turn on
  81.     cb    @haa,@>4000            ; installed?
  82.     jeq    dskiokay
  83.  
  84.     li    2,noemuerr            ; print error message
  85.     b    @dieerr
  86.  
  87. dskiokay:
  88.     sbz    0
  89.  
  90.     li    0,forthdskdef
  91.     li    1,forthdsk
  92.     li    2,10
  93. dskifn    movb    +*0,+*1
  94.     dec    2
  95.     jgt    dskifn
  96.  
  97.     mov    +*SP,11
  98.     rt
  99.  
  100.