?login_element?

Subversion Repositories NedoOS

Rev

Rev 1081 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1.         DEVICE ZXSPECTRUM128
  2.         include "../_sdk/sys_h.asm"
  3.  
  4.         org PROGSTART
  5. cmd_begin
  6.         ld sp,0x4000
  7.        
  8.         ld e,3 ;6912
  9.         OS_SETGFX ;e=0:EGA, e=2:MC, e=3:6912, e=6:text ;+SET FOCUS ;e=-1: disable gfx (out: e=old gfxmode)
  10.         YIELD ;set palette
  11.         OS_GETMAINPAGES
  12.         ld (reset_hook_place+5),de
  13.         ld (reset_hook_place+7),hl
  14.  
  15.         ;OS_GETSCREENPAGES
  16. ;de=pages of screen 0 (d=higher page), hl=pages of screen 1 (h=higher page)
  17.         ld a,(user_scr0_low) ;ok
  18.         ld (cmdpgscreen0_0),a
  19.  
  20. hobetarunner=0x4100
  21.  
  22.     OS_GETCONFIG
  23.     ld d,l
  24.     ld a,l    
  25.     cp 1
  26.     jr nz,no_eva
  27.  
  28.     OS_SETSYSDRV
  29.     ld sp,0x0000
  30.     ld hl,nmisvc_starter
  31.     ld de,0x0080
  32.     ld bc,nmisvc_starter_size
  33.     ldir
  34.     ld de,str_nmisvc
  35.     OS_OPENHANDLE
  36.     jp nmisvc_start
  37.    
  38. nmisvc_starter
  39.     disp 0x0080
  40. str_nmisvc
  41.     defb "/bin/nmisvc.com",0
  42. nmisvc_start
  43.     push bc
  44.         ld de,0x0100
  45.         ld hl,0xc000
  46.         OS_READHANDLE
  47.     pop bc
  48.     OS_CLOSEHANDLE
  49.     jp PROGSTART
  50.     ent
  51. nmisvc_starter_size=$-nmisvc_starter
  52.  
  53. no_eva    
  54.     ld (pcconf),a
  55.     ld c,0xff
  56.     cp 2
  57.     jr z,atm_1f
  58.     cp 3
  59.     jr nz,not_atm_1f
  60. atm_1f
  61.     ld c,0x7f
  62.     ld d,0
  63. not_atm_1f
  64.     ld (reset_hook_place+3),de
  65.     ld a,0x1f^0xff
  66.     and c
  67.     SETPGC000
  68.     ld hl,reset_hook_place
  69.     ld de,0xc000
  70.     ld bc,reset_hook_end - reset_hook_begin
  71.     ldir
  72.     ld hl,0xaa55
  73.     ld (0xfffe),hl
  74.     xor a
  75.     ld (0xfffd),a
  76.     ld hl,0xc000
  77.     ld e,a
  78. hook_crc_loop
  79.     add a,(hl)
  80.     adc a,e
  81.     inc hl
  82.     bit 7,h
  83.     jr nz,hook_crc_loop
  84.     neg
  85.     ld (0xfffd),a
  86.     di
  87. cmdpgscreen0_0=$+1
  88.         ld a,0xff-1
  89.         SETPG32KLOW
  90.         inc a ;ld a,0xff-0
  91.         SETPG32KHIGH
  92.  
  93.  
  94.     ld a,(cmdpgscreen0_0)
  95.     sub 4-1 ;ld a,0xff-4 ;pgkillable
  96.     SETPG16K
  97.  
  98.     ld hl,washobetarunner
  99.     ld de,hobetarunner
  100.     ld bc,hobetarunner_sz
  101.     ldir
  102.     jp hobetarunner
  103.  
  104.    
  105. washobetarunner
  106.         disp hobetarunner ;in pgkillable
  107.         di
  108.         ld a,0x7f-5
  109.         ld bc,0xbff7
  110.         out (c),a
  111.         ld a,0x7f-4
  112.         ld bc,0xfff7
  113.         out (c),a
  114.         ld hl,0xc000
  115.         ld de,0x8000
  116.         ld bc,0x4000
  117.         ldir ;pg4 -> pg5
  118.         ld a,0x7f-8;pgtrdosfs
  119.         ld bc,0xfff7
  120.         out (c),a
  121.         ld hl,0x1c00+0xc000
  122.         ld de,0x1c00+0x8000
  123.         ld bc,0x400
  124.         ldir ;restore sysvars
  125.         ld a,0x7f-2
  126.         ld bc,0xbff7
  127.         out (c),a
  128.         ld a,0x7f-1
  129.         ld bc,0xfff7
  130.         out (c),a
  131.         ld hl,0xc000
  132.         ld de,0x8000
  133.         ld bc,0x4000
  134.         ldir ;pg1 -> pg2
  135.         ld a,0x7f-0+0x80
  136.         ld bc,0xfff7
  137.         out (c),a
  138.         ld a,0x00
  139.         ld bc,0x7ffd
  140.         out (c),a
  141.         ld a,0x01 ;128 basic (with 7ffd)
  142.         ld bc,0x3ff7
  143.         out (c),a
  144.         ld a,0x7f-5
  145.         ld bc,0x7ff7
  146.         out (c),a
  147. ;128: pages 128/DOS,5,2,0(7ffd)
  148.         ld a,0x10
  149.         ld bc,0x7ffd
  150.         out (c),a
  151. ;48: pages 2,4,4,4
  152.         ld a,0x7f-5
  153.         ld bc,0x7ff7
  154.         out (c),a
  155.         ld a,0x7f-2
  156.         ld bc,0xbff7
  157.         out (c),a
  158.         ld a,0x7f-0+0x80
  159.         ld bc,0xfff7
  160.         out (c),a
  161.         ld a,0x83 ;48 basic switchable to DOS
  162.         ld bc,0x3ff7
  163.         out (c),a
  164. ;48: pages 48/DOS,5,2,0(7ffd)
  165.        
  166.         LD A,%10101011 ;6912
  167.         ld bc,0xff77 ;shadow ports off, palette off
  168.         out (c),a
  169.         ld sp,0x6000
  170.    
  171.    
  172.     ld a,0x10
  173.     ld bc,0x7ffd
  174.     out (c),a ;for 128 basic (проверено, работает, 48 тоже работает)
  175. pcconf=$ - hobetarunner + washobetarunner + 1
  176.     ld a,1
  177.     cp 2
  178.     jr z,set_xbios
  179.     cp 3
  180.     jr nz,not_set_xbios
  181. set_xbios
  182.     ld a,(0x3CBC)
  183.     cp 0x87
  184.     call z,0x3C9E   ;переключить в vtrdos
  185.     ;ld bc,0x0001    ;хотресет втрдоса, на всякий случай, может и ненадо
  186.     ;call 0x3D42
  187. not_set_xbios  
  188.     ld a,0
  189.     ld bc,0x7ffd
  190.     out (c),a ;for 128 basic (проверено, работает, 48 тоже работает)
  191.         ei
  192. hobetarunner_jp=$+1
  193.         jp 0;0x6000
  194. ;АТМный перехватчик ресета
  195.         ent
  196. hobetarunner_sz=$-washobetarunner
  197.  
  198. reset_hook_place
  199.     disp 0xc000
  200. reset_hook_begin
  201.     jp reset_hook_start
  202.     defs 10
  203. reset_hook_start
  204.     di
  205.     xor a
  206.     ld (reset_hook_begin),a
  207.     ld hl,reset_hook_begin
  208.     ld de,0x8000
  209.     ld bc,reset_hook_end - reset_hook_begin
  210.     ldir
  211.     jp $ + 3 - 0x4000
  212.     ld a,0x57
  213.     ld bc,0x7ffd
  214.     out (c),a
  215.     ld de,(0x8003)
  216.     ld iy,0x3f7f
  217.     ld ix,0xbfff
  218.     dec d
  219.     inc d
  220.     jr z,rest_atm2
  221.     ld iy,0x3777
  222.     ld ix,0xb7f7
  223. rest_atm2
  224.     ld a,0x7f
  225.     ld bc,0x3FF7
  226.     out (c),a
  227.     ld b,iyh
  228.     out (c),e
  229.     ld e,0x7b
  230.     ld b,0x7f
  231.     out (c),e
  232.     ld b,0xff
  233.     out (c),e
  234.     ld e,0x47
  235.     ld bc,0x7ffd
  236.     out (c),e
  237.     ld hl,(0x8005)
  238.     ld bc,0x3FF7
  239.     out (c),a
  240.     ld b,iyh
  241.     out (c),h
  242.     ld b,0x7F
  243.     out (c),a
  244.     ld b,iyl
  245.     out (c),l
  246.     ld hl,(0x8007)
  247.     ld b,0xfF
  248.     out (c),a
  249.     ld b,ixl
  250.     out (c),l
  251.     ld bc,0xbd77
  252.     ld a,0xae
  253.     out (c),a
  254.     ld sp,0x4000
  255.     im 1
  256.     ei
  257.     jp 0x0000
  258.    
  259. reset_hook_end
  260.         ent
  261.     nop
  262. cmd_end
  263.  
  264.         display "Size ",/d,cmd_end-cmd_begin," bytes"
  265.  
  266.         savebin "reset.com",cmd_begin,cmd_end-cmd_begin
  267.        
  268.         ;LABELSLIST "../us/user.l"
  269.