Subversion Repositories NedoOS

Rev

Rev 116 | Rev 338 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download

  1.         DEVICE ZXSPECTRUM128
  2.         include "../_sdk/sys_h.asm"
  3.  
  4. COLOR=7
  5. module=0xc000
  6.        
  7.         org PROGSTART
  8. cmd_begin
  9.         ld sp,#4000 ;эх фюыцхэ юяєёърЄ№ё  эшцх #3b00! шэрўх тючьюцэр яюЁўр OS
  10.         ld e,6 ;textmode
  11.         OS_SETGFX
  12.        
  13.         ;ld e,COLOR
  14.         ;OS_CLS
  15.  
  16.         ld hl,COMMANDLINE ;command line
  17.         call skipword
  18.         call skipspaces
  19.         ld a,(hl)
  20.         or a
  21.         jr z,noautoload
  22.         ld (filenameaddr),hl
  23. ;command line = "texted <file to load>"
  24.         ;ld (texted_filenameaddr),hl
  25.         ex de,hl ;de=drive/path/file
  26.         OS_OPENHANDLE
  27. ;b=new file handle
  28.  
  29.         ld de,module;0xc000
  30.         ld hl,0x4000
  31. ;B = file handle, DE = Buffer address, HL = Number of bytes to read
  32.         push bc
  33.         OS_READHANDLE
  34.         pop bc
  35.  
  36. ;B = file handle
  37.         OS_CLOSEHANDLE
  38.        
  39.         ld a,(module)
  40.         cp 'V'
  41.         jr z,$+4
  42.         cp 'P' ;'P'/'V' for PT3
  43.         ld a,%00100000 ;PT3
  44.         jr z,$+4
  45.         ld a,%00000010 ;PT2
  46.         ld (SETUP),a
  47.        
  48.         ld hl,module
  49.         call INIT
  50.        
  51. mainloopredraw
  52. filenameaddr=$+1
  53.         ld hl,0
  54.         call prtext
  55.         ld a,0x0d
  56.         PRCHAR
  57.         ld a,0x0a
  58.         PRCHAR
  59.        
  60. mainloop
  61.         YIELD
  62.         di ;TODO fix player
  63.         call PLAY
  64.         ei
  65.         GET_KEY
  66.         cp key_redraw
  67.         jr z,mainloopredraw
  68.         ;or a ;cp NOKEY ;keylang==0?
  69.         ;jr nz,$+2+1+2
  70.         ;cp c ;keynolang==0?
  71.         ;jr z,_1;1b;prwindow_waitkey_nokey
  72.         cp key_esc
  73.         jr nz,mainloop
  74.         call MUTE
  75. noautoload
  76.         QUIT
  77.  
  78.        
  79. skipword
  80. ;hl=string
  81. ;out: hl=terminator/space addr
  82. getword0
  83.         ld a,(hl)
  84.         or a
  85.         ret z
  86.         cp ' '
  87.         ret z
  88.         inc hl
  89.         jr getword0
  90.  
  91. skipspaces
  92. ;hl=string
  93. ;out: hl=after last space
  94.         ld a,(hl)
  95.         cp ' '
  96.         ret nz
  97.         inc hl
  98.         jr skipspaces
  99.  
  100. prtext
  101. ;out: hl=after terminator
  102. prtext0
  103.         ld a,(hl)
  104.         inc hl
  105.         or a
  106.         ret z
  107.         push hl
  108.         PRCHAR
  109.         pop hl
  110.         jp prtext0
  111.  
  112.        
  113. oldtimer
  114.         dw 0
  115.  
  116.         ;include "../_sdk/pt3play.i"
  117.         include "ptsplay.asm"
  118.        
  119. cmd_end
  120.  
  121.         display "Size ",/d,cmd_end-cmd_begin," bytes"
  122.  
  123.         savebin "player.com",cmd_begin,cmd_end-cmd_begin
  124.        
  125.         ;LABELSLIST "../us/user.l"
  126.