?login_element?

Subversion Repositories NedoOS

Rev

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

  1.  
  2.         MODULE ERRNOMOD
  3.         PUBLIC errno
  4.         RSEG    NO_INIT
  5. errno:
  6.         defs 1
  7.         ENDMOD
  8.        
  9.         MODULE MYGETCHAR
  10.         PUBLIC getchar
  11.         EXTERN _low_level_get
  12.         RSEG CODE
  13. getchar:
  14.         call _low_level_get
  15.         or a
  16.         jr z,getchar
  17.         ld l,a
  18.         ld h,0
  19.         ret    
  20.         ENDMOD
  21.        
  22.         MODULE OS_RESERV_1
  23.         PUBLIC os_reserv_1
  24.         #include "sysdefs.asm"
  25.         RSEG CODE
  26. os_reserv_1:
  27.         push bc
  28.         push ix
  29.         push iy
  30.     ld c,CMD_RESERV_1
  31.         call BDOS
  32.         pop iy
  33.         pop ix
  34.         pop bc
  35.         ret    
  36.         ENDMOD
  37.        
  38.         MODULE SCRREDRAW
  39.         PUBLIC scrredraw
  40.         RSEG CODE
  41. scrredraw:
  42.         xor a
  43.         ret    
  44.         ENDMOD
  45.  
  46.         MODULE OSLOWGET
  47.         PUBLIC bdosgetkey
  48.         EXTERN scrredraw,exit,YIELD
  49.         #include "sysdefs.asm"
  50.         RSEG CODE
  51. bdosgetkey:
  52.         push de
  53.         push bc
  54.         push ix
  55.         push iy
  56.         ld c,CMD_YIELD
  57.         call BDOS
  58.         rst 0x08
  59.         cp key_esc
  60.         jp z,exit
  61.         cp key_redraw
  62.         call z,scrredraw
  63.         ld l,a
  64.         ld h,0
  65.         pop iy
  66.         pop ix
  67.         pop bc
  68.         pop de
  69.         ret
  70.         ENDMOD
  71.    
  72.         MODULE conv1251to866
  73.         PUBLIC conv1251to866, t1251to866
  74.         RSEG CODE
  75. conv1251to866:  ;DE-string
  76.         push de
  77. ploop:
  78.         ld a,(de)
  79.         or a
  80.         jr z,pexit
  81.         cp 128
  82.         jr c,asci
  83.         add a,low(t1251to866-128)
  84.         ld l,a
  85.         ld a,0
  86.         adc a,high(t1251to866-128)
  87.         ld h,a
  88.         ld a,(hl)
  89.         ld (de),a
  90. asci:
  91.         inc de
  92.         jr ploop
  93. pexit:
  94.         pop de
  95.         ret
  96.         RSEG    CONST
  97. t1251to866:
  98.         DEFB 0x3F, 0x3F, 0x27, 0x3F, 0x22, 0x3A, 0xC5, 0xD8, 0x3F, 0x25, 0x3F, 0x3C, 0x3F, 0x3F, 0x3F, 0x3F
  99.         DEFB 0x30, 0x3F, 0x27, 0x27, 0x22, 0x22, 0x07, 0x2D, 0x2D, 0x54, 0x3F, 0x3E, 0x3F, 0x3F, 0x3F, 0x3F
  100.         DEFB 0xFF, 0xF6, 0xF7, 0x3F, 0xFD, 0x3F, 0xB3, 0x15, 0xF0, 0x63, 0xF2, 0x3C, 0xBF, 0x2D, 0x52, 0xF4
  101.         DEFB 0xF8, 0x2B, 0x3F, 0x3F, 0x3F, 0xE7, 0x14, 0xFA, 0xF1, 0xFC, 0xF3, 0x3E, 0x3F, 0x3F, 0x3F, 0xF5
  102.         DEFB 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F
  103.         DEFB 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F
  104.         DEFB 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF
  105.         DEFB 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF
  106.         ENDMOD
  107.        
  108.         MODULE YIELD
  109.         PUBLIC YIELD
  110.         #include "sysdefs.asm"
  111.         RSEG CODE
  112. YIELD:
  113.         push bc
  114.         push de
  115.         push ix
  116.         push iy
  117.         ld c,CMD_YIELD
  118.         call BDOS
  119.         pop iy
  120.         pop ix
  121.         pop de
  122.         pop bc
  123.         ret
  124.         ENDMOD
  125.        
  126.         MODULE SETMUSIC
  127.         PUBLIC OS_SETMUSIC
  128.         #include "sysdefs.asm"
  129.         RSEG CODE
  130. OS_SETMUSIC:    ;DE - proc_ptr, A - ?
  131.         ld h,d
  132.         ld l,e
  133.         ld a,c
  134.     ex af,af'
  135.         push ix
  136.         push iy
  137.         ld c,CMD_SETMUSIC       ;hl=muzaddr (0x4000..0x7fff), a=muzpg
  138.         call BDOS
  139.         pop iy
  140.         pop ix
  141.         ret
  142.         ENDMOD
  143.        
  144.         MODULE OSGETCONFIG
  145.         PUBLIC OS_GETCONFIG
  146.         #include "sysdefs.asm"
  147.         RSEG CODE
  148. OS_GETCONFIG:
  149.    push bc
  150.         ld c,CMD_GETCONFIG
  151.         push de
  152.         push ix
  153.         push iy
  154.         call BDOS
  155.         pop iy
  156.         pop ix
  157.         pop de
  158.    pop bc
  159.         ret
  160.         ENDMOD
  161.  
  162.         MODULE GETMAINPAGES
  163.         PUBLIC OS_GETMAINPAGES,OS_GETAPPMAINPAGES
  164.    EXTERN errno
  165.         #include "sysdefs.asm"
  166.         RSEG CODE
  167. OS_GETAPPMAINPAGES:
  168.    ld c,CMD_GETAPPMAINPAGES
  169.    jr l1
  170. OS_GETMAINPAGES:
  171.         ld c,CMD_GETMAINPAGES
  172. l1
  173.         push de
  174.         push ix
  175.         push iy
  176.          call BDOS
  177.         ld b,d ;out: d,e,h,l=pages in 0000,4000,8000,c000, c=flags, a=error
  178.         ld c,e
  179.         pop iy
  180.         pop ix
  181.         pop de
  182.    LD (errno), a
  183.         ret
  184.         ENDMOD
  185.  
  186.  
  187.         MODULE SETPG32KHIGH
  188.         PUBLIC SETPG32KHIGH
  189.         #include "sysdefs.asm"
  190.         RSEG CODE
  191. SETPG32KHIGH:
  192.         push bc
  193.         push ix
  194.         push iy
  195.         ld a,e
  196.         rst 0x28
  197.         pop iy
  198.         pop ix
  199.         pop bc
  200.         ret
  201.         ENDMOD
  202.        
  203.         MODULE MAIN_ARGS
  204.         PUBLIC main_args
  205.         RSEG CODE
  206. main_args
  207.         ld hl,args
  208.         ld de,0x0080
  209. get_cmd_args_l2
  210.         ld (hl),e
  211.         inc hl
  212.         ld (hl),d
  213.         inc hl
  214.         dec de
  215. get_cmd_args_l
  216.         inc de
  217.         ld a,(de)
  218.         or a
  219.         jr z,get_cmd_args_end
  220.         cp ' '
  221.         jr nz,get_cmd_args_l
  222.         xor a
  223.         ld (de),a
  224. skipspaces
  225.         inc de
  226.         ld a,(de)
  227.         or a
  228.         jr z,get_cmd_args_end
  229.         cp ' '
  230.         jr nz,get_cmd_args_l2
  231.         jr skipspaces
  232. get_cmd_args_end:
  233.         ld bc,args
  234.         sbc hl,bc
  235.         ex de,hl
  236.         srl e
  237.         ret
  238.         RSEG    NO_INIT
  239. args:
  240.         defs 32
  241.         ENDMOD
  242.  
  243.  
  244.         MODULE OSDROPAPP
  245.         PUBLIC OS_DROPAPP
  246.         #include "sysdefs.asm"
  247.         RSEG CODE
  248. OS_DROPAPP:     ;e=id ; hl=result
  249.         ld c,CMD_DROPAPP
  250.         push ix
  251.         push iy
  252.         call BDOS
  253.         pop iy
  254.         pop ix
  255.         ret
  256.         ENDMOD
  257.  
  258.  
  259.  
  260.  
  261.         MODULE OSGETPAGEOWNER   ;e=page ;out: e=owner id (0=free, 0xff=system)
  262.         PUBLIC OS_GETPAGEOWNER
  263.         #include "sysdefs.asm"
  264.         RSEG CODE
  265. OS_GETPAGEOWNER:
  266.    push bc
  267.         ld c,CMD_GETPAGEOWNER
  268.         push de
  269.         push ix
  270.         push iy
  271.         call BDOS
  272.         LD a, e
  273.         pop iy
  274.         pop ix
  275.         pop de
  276.    pop bc
  277.         ret
  278.         ENDMOD
  279.  
  280.  
  281.  
  282.  
  283.        
  284.         MODULE  my_im2
  285.         PUBLIC  my_im2_init
  286.         RSEG    INTJP
  287.         DEFS 3
  288.         RSEG    INTTABLE
  289.         DEFS 257
  290.         RSEG    CODE
  291. my_im2_init
  292.         di
  293.         ld a,0xc3
  294.         ld (SFB(INTJP)),a
  295.         ld (SFB(INTJP)+1),de
  296.         ld a,HIGH(SFB(INTTABLE))
  297.         ld i,a
  298.         inc a
  299.         ld hl,SFB(INTTABLE)-1
  300. tloop
  301.         inc hl
  302.         ld (hl),HIGH(SFB(INTJP))
  303.         cp h
  304.         jr nz,tloop
  305.         im 2
  306.         ret
  307.         ENDMOD
  308.  
  309.  
  310.  
  311.  
  312. ;Kulich Area
  313.         MODULE OS_READSECTORS   ;de= pointer to diskOp structure
  314.         PUBLIC OS_READSECTORS
  315.         #include "sysdefs.asm"
  316.         RSEG CODE
  317. OS_READSECTORS:
  318.         push bc
  319.         push de
  320.         push ix
  321.         push iy
  322.  
  323.         ex de,hl
  324.         ld b,(hl)       ;drive
  325.         inc l
  326.         ld e,(hl)       ;buffer L
  327.         inc l
  328.         ld d,(hl)       ;buffer H
  329.         inc l
  330.         push de
  331.         ld e,(hl)       ;sector L
  332.         inc l
  333.         ld d,(hl)       ;sector H
  334.         inc l
  335.         ld  a,(hl)      ;sector X
  336.         ld  ixl,a
  337.         inc l
  338.         ld  a,(hl)      ;sector I
  339.         ld  ixh,a
  340.         inc l
  341.         ld  a,(hl)      ;count
  342.         pop hl
  343.         ex de,hl
  344.  
  345. ;       push hl
  346.         ld c,CMD_READSECTORS
  347.         ex af,af' ;'
  348.     call BDOS ;c=CMD
  349.  
  350. ;       pop hl
  351.         pop iy
  352.         pop ix
  353.         pop de
  354.         pop bc
  355.         ret             ;BCHL
  356.         ENDMOD 
  357.        
  358.         MODULE OS_WRITESECTORS  ;de= pointer to diskOp structure
  359.         PUBLIC OS_WRITESECTORS
  360.         #include "sysdefs.asm"
  361.         RSEG CODE
  362. OS_WRITESECTORS:
  363.         push bc
  364.         push de
  365.         push ix
  366.         push iy
  367.  
  368.         ex de,hl
  369.         ld b,(hl)       ;drive
  370.         inc l
  371.         ld e,(hl)       ;buffer L
  372.         inc l
  373.         ld d,(hl)       ;buffer H
  374.         inc l
  375.         push de
  376.         ld e,(hl)       ;sector L
  377.         inc l
  378.         ld d,(hl)       ;sector H
  379.         inc l
  380.         ld  a,(hl)      ;sector X
  381.         ld  ixl,a
  382.         inc l
  383.         ld  a,(hl)      ;sector I
  384.         ld  ixh,a
  385.         inc l
  386.         ld  a,(hl)      ;count
  387.         pop hl
  388.         ex de,hl
  389.  
  390. ;       push hl
  391.         ld c,CMD_WRITESECTORS
  392.         ex af,af' ;'
  393.     call BDOS ;c=CMD
  394.  
  395. ;       pop hl
  396.         pop iy
  397.         pop ix
  398.         pop de
  399.         pop bc
  400.         ret             ;BCHL  
  401. ;End of Kulich area
  402.         END
  403.