?login_element?

Subversion Repositories NedoOS

Rev

Rev 1375 | 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. INTSTACK=0x3f00
  5. STACK=0x4000
  6. scrbase=0x8000
  7.  
  8. music=0x4000
  9.  
  10.         org PROGSTART
  11. begin
  12.         ld sp,STACK
  13.  
  14.         ld e,0
  15.         OS_SETGFX ;e=0:EGA, e=2:MC, e=3:6912, e=6:text ;+SET FOCUS ;e=-1: disable gfx (out: e=old gfxmode)
  16.         ld e,0 ;color byte
  17.         OS_CLS
  18.         ld e,1
  19.         OS_SETSCREEN
  20.         ld e,0 ;color byte
  21.         OS_CLS
  22.  
  23.         OS_GETMAINPAGES
  24. ;dehl=номера страниц в 0000,4000,8000,c000
  25.         ld a,e
  26.         LD (pgmusic),A
  27.  
  28.         ;OS_GETSCREENPAGES
  29. ;de=страницы 0-го экрана (d=старшая), hl=страницы 1-го экрана (h=старшая)
  30.         ;ld a,e
  31.         ;ld (setpgs_scr0_low),a
  32.         ;ld a,d
  33.         ;ld (setpgs_scr0_high),a
  34.         ;ld a,l
  35.         ;ld (setpgs_scr1_low),a
  36.         ;ld a,h
  37.         ;ld (setpgs_scr1_high),a
  38.  
  39.         ld de,texfilename
  40.         OS_OPENHANDLE
  41.  
  42.         ld hl,ttexpgs
  43.         ld c,32
  44. getttexpgs0
  45.         push bc
  46.         push hl
  47.  
  48.         push bc
  49.         OS_NEWPAGE
  50.         ld a,e
  51.         SETPG16K
  52.         pop bc        
  53.         push de
  54.         ld de,0x4000 ;addr
  55.         ld hl,0x4000 ;size
  56.         OS_READHANDLE        
  57.         pop de
  58.        
  59.         pop hl
  60.         ld (hl),e
  61.         inc hl
  62.         pop bc
  63.         dec c
  64.         jr nz,getttexpgs0
  65.  
  66.         OS_CLOSEHANDLE
  67.  
  68.         ld hl,0x4000+0x1f40
  69.         ld de,palbuf
  70.         ld b,16
  71. copypal0
  72.         ld a,(hl)
  73.         inc hl
  74.         ld (de),a
  75.         inc de
  76.         ld (de),a
  77.         inc de
  78.         djnz copypal0
  79.         ld de,palbuf
  80.         OS_SETPAL
  81.  
  82.         call setpgmusic
  83.         ld hl,wasmusic
  84.         ld de,music
  85.         ld bc,sz_music
  86.         ldir
  87.  
  88.         ld hl,module
  89.         call INIT
  90.  
  91.         ld a,(pgmusic)
  92.         ld hl,PLAY
  93.         OS_SETMUSIC
  94.  
  95.         call swapimer
  96.  
  97.         ld hl,ttexpgs
  98. showpic0
  99.         call setpgs_scr0
  100.         ld de,0x8000
  101.         call ldirpg
  102.         call ldirpg      
  103.         push hl
  104.         YIELD
  105.         ld e,0
  106.         OS_SETSCREEN
  107.         pop hl
  108.         call setpgs_scr1
  109.         ld de,0x8000
  110.         call ldirpg
  111.         call ldirpg      
  112.  
  113.         push hl
  114.         YIELDGETKEY ;out: nz=nokey, a=keylang, c=keynolang
  115.         push af
  116.         ld e,1
  117.         OS_SETSCREEN
  118.         pop af
  119.         pop hl
  120.         res 5,l
  121.         cp key_esc
  122.         jr nz,showpic0
  123.  
  124.         call swapimer
  125.  
  126.           ld a,(pgmusic)
  127.           ld hl,MUTE
  128.           OS_SETMUSIC
  129.           halt
  130.         ;call setpgmusic
  131.         ;call MUTE
  132.         QUIT
  133.  
  134. setpgmusic
  135. pgmusic=$+1
  136.         ld a,0
  137.         SETPG16K
  138.         ret
  139.  
  140. swapimer
  141.         di
  142.         ld de,0x0038
  143.         ld hl,oldimer
  144.         ld bc,3
  145. swapimer0
  146.         ld a,(de)
  147.         ldi ;[oldimer] -> [0x0038]
  148.         dec hl
  149.         ld (hl),a ;[0x0038] -> [oldimer]
  150.         inc hl
  151.         jp pe,swapimer0
  152.         ei
  153.         ret
  154. oldimer
  155.         jp on_int ;заменится на код из 0x0038
  156.         jp 0x0038+3
  157.  
  158. on_int
  159. ;restore stack with de
  160.         ld (on_int_hl),hl
  161.         ld (on_int_sp),sp
  162.         pop hl
  163.         ld (on_int_sp2),sp
  164.         ld (on_int_jp),hl
  165.         ld sp,INTSTACK
  166.         push af
  167.         push bc
  168.         push de
  169.  
  170. ;imer_curscreen_value=$+1
  171.          ;ld a,0
  172.          ;ld bc,0x7ffd
  173.          ;out (c),a
  174.  
  175.         ex de,hl;ld hl,0
  176. on_int_sp=$+1
  177.         ld (0),hl ;восстановили запоротый стек
  178.        
  179.         push ix
  180.         push iy
  181.         ex af,af'
  182.        exx
  183.        push af
  184.        push bc
  185.        push de
  186.        push hl
  187.        ;ld a,(curscreen)
  188.        ;ld e,a
  189.        ;OS_SETSCREEN ;вызываем здесь, а не в рандомном месте, иначе даже с одной задачей можем получить непредсказуемую задержку, которую не фиксирует наш таймер? с несколькими задачами надо учитывать и системный - TODO
  190. ;curpalette=$+1
  191.        ;ld de,wolfpal
  192.        ;OS_SETPAL
  193. ;        GET_KEY
  194. ;        ld (curkey),a
  195.        
  196. ;pgmuznum=$+1
  197. ;        ld a,0
  198. ;        SETPG32KHIGH
  199.        ;call PLAY ;muzplay
  200. ;pgc000=$+1
  201. ;        ld a,0
  202. ;        SETPG32KHIGH
  203.  
  204.        call oldimer ;ei
  205.        
  206.        pop hl
  207.        pop de
  208.        pop bc
  209.        pop af
  210.        exx
  211.        ex af,af'
  212.         pop iy
  213.         pop ix
  214.        
  215.         ;ld hl,(timer)
  216.         ;inc hl
  217.         ;ld (timer),hl
  218.  
  219.         pop de
  220.         pop bc
  221.         pop af
  222. on_int_hl=$+1
  223.         ld hl,0
  224. on_int_sp2=$+1
  225.         ld sp,0
  226.         ;ei
  227. on_int_jp=$+1
  228.         jp 0
  229.  
  230. setpgs_scr0
  231.         ld a,(user_scr0_low) ;ok
  232.         SETPG32KLOW
  233.         ld a,(user_scr0_high) ;ok
  234.         SETPG32KHIGH
  235.         ret
  236.  
  237. setpgs_scr1
  238.         ld a,(user_scr1_low) ;ok
  239.         SETPG32KLOW
  240.         ld a,(user_scr1_high) ;ok
  241.         SETPG32KHIGH
  242.         ret
  243.  
  244. ldirpg
  245.         ld a,(hl)
  246.         inc l
  247.         SETPG16K
  248.         push hl
  249.         ld hl,0x4000
  250.         ld bc,0x4000
  251.         ldir
  252.         pop hl
  253.         ret
  254.  
  255. texfilename
  256.         db "noise/forest.dat"
  257.  
  258. palbuf
  259.         ds 32
  260.  
  261. ;oldtimer
  262. ;        dw 0
  263.        
  264.         align 256
  265. ttexpgs
  266.         ds 32
  267.  
  268. wasmusic
  269.         disp music
  270.         include "ptsplay.asm"
  271. module
  272.         incbin "NOISE20.pt3"
  273.         ent
  274. sz_music=$-wasmusic
  275.  
  276. end
  277.  
  278.         display "End=",end
  279.         ;display "Free after end=",/d,#c000-end
  280.         display "Size ",/d,end-begin," bytes"
  281.        
  282.         savebin "noise.com",begin,end-begin
  283.