?login_element?

Subversion Repositories NedoOS

Rev

Rev 260 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1.         DEVICE ZXSPECTRUM128
  2.         include "../_sdk/sys_h.asm"
  3.  
  4. COLOR=7
  5.  
  6.         include "gsports.asm"
  7.        
  8.         org PROGSTART
  9. cmd_begin
  10.         ld sp,0x4000 ;не должен опускаться ниже 0x3b00! иначе возможна порча OS
  11.         ld e,6 ;textmode
  12.         OS_SETGFX
  13.        
  14.         ;ld e,COLOR
  15.         ;OS_CLS
  16.  
  17.         ld hl,COMMANDLINE ;command line
  18.         call skipword
  19.         call skipspaces
  20.         ld a,(hl)
  21.         or a
  22.         jp z,noautoload
  23.         ld (filenameaddr),hl
  24. ;command line = "texted <file to load>"
  25.         ;ld (texted_filenameaddr),hl
  26.         ex de,hl ;de=drive/path/file
  27.         call openstream_file
  28.         or a
  29.         jr nz,openerror
  30.  
  31. readmod0
  32.         ld de,0xc000
  33.         ld hl,0x4000
  34. ;DE = Buffer address, HL = Number of bytes to read
  35.         push de
  36.         call readstream_file
  37. ;hl=actual size
  38.         ex (sp),hl ;hl=buffer address, (sp)=actual size
  39.        
  40.        ;SC 0x38 ;Load FX
  41.         SC 0x30 ;Load module
  42.         WC
  43.         SC 0xD1 ;Open Stream
  44.         WC
  45.  
  46.         pop bc ;actual size
  47.         ld a,b
  48.         or c
  49.         jr z,readmodq
  50. LDSMP0
  51.         LD A,(HL)
  52.         INC HL
  53.         OUT (GSDAT),A
  54.         WD
  55.         DEC BC
  56.         LD A,B
  57.         OR C
  58.         JR NZ,LDSMP0
  59.  
  60.         jr readmod0
  61. readmodq
  62.        
  63.         SC 0xD2 ;Close Stream
  64.         WC
  65.  
  66.         call closestream_file
  67.  
  68.         LD A,1 ;mod
  69.         OUT (GSDAT),A
  70.         SC 0x31 ;play module
  71.         WC
  72.        
  73.        
  74. mainloopredraw
  75. filenameaddr=$+1
  76.         ld hl,0
  77.         call prtext
  78.         ld a,0x0d
  79.         PRCHAR
  80.         ld a,0x0a
  81.         PRCHAR
  82.        
  83.         if 1==0
  84. mainloop
  85.         YIELD
  86.         GET_KEY
  87.         cp key_redraw
  88.         jr z,mainloopredraw
  89.         cp key_esc
  90.         jr nz,mainloop
  91.         endif
  92.         QUIT
  93.  
  94. openerror        
  95. noautoload
  96.         SC 0x32 ;stop module
  97.         WC
  98.        
  99.         QUIT
  100.  
  101.        
  102. skipword
  103. ;hl=string
  104. ;out: hl=terminator/space addr
  105. getword0
  106.         ld a,(hl)
  107.         or a
  108.         ret z
  109.         cp ' '
  110.         ret z
  111.         inc hl
  112.         jr getword0
  113.  
  114. skipspaces
  115. ;hl=string
  116. ;out: hl=after last space
  117.         ld a,(hl)
  118.         cp ' '
  119.         ret nz
  120.         inc hl
  121.         jr skipspaces
  122.  
  123. prtext
  124. ;out: hl=after terminator
  125. prtext0
  126.         ld a,(hl)
  127.         inc hl
  128.         or a
  129.         ret z
  130.         push hl
  131.         PRCHAR
  132.         pop hl
  133.         jp prtext0
  134.  
  135.        
  136. ;oldtimer
  137. ;        dw 0
  138.  
  139.         include "../_sdk/file.asm"
  140.        
  141. cmd_end
  142.  
  143.         display "Size ",/d,cmd_end-cmd_begin," bytes"
  144.  
  145.         savebin "modplay.com",cmd_begin,cmd_end-cmd_begin
  146.        
  147.         ;LABELSLIST "../us/user.l"
  148.