Subversion Repositories NedoOS

Rev

Rev 49 | Rev 260 | 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. ;text=#4000
  5. COLOR=7
  6.        
  7.         org PROGSTART
  8. cmd_begin
  9.         ld sp,#4000 ;эх фюыцхэ юяєёърЄ№ё  эшцх #3b00! шэрўх тючьюцэр яюЁўр OS
  10.         ld e,6 ;textmode
  11.         OS_SETGFX
  12.  
  13.         ;YIELD ;ўЄюс√ cmd ьюу фюфхырЄ№ ётюш фхыр эр ¤ъЁрэх
  14.        
  15.         ld e,COLOR
  16.         OS_CLS
  17.  
  18.         if 1==0
  19.         ld de,0x0709
  20.         OS_SETXY
  21.         ld hl,thello
  22.         call prtext
  23.         OS_GETXY
  24.         push de
  25.        
  26.         ld de,0x0a00
  27.         OS_SETXY
  28.        
  29.         pop de
  30.         OS_SETXY
  31.         ld hl,tzello
  32.         call prtext
  33.         jr $
  34.        
  35. thello
  36.         db "hello",0
  37. tzello
  38.         db "zello",0
  39.         endif
  40.        
  41.         ld hl,COMMANDLINE ;command line
  42.         call skipword
  43.         call skipspaces
  44.         ld a,(hl)
  45.         or a
  46.         jr z,noautoload
  47. ;command line = "texted <file to load>"
  48.         ld (texted_filenameaddr),hl
  49.         ex de,hl ;de=drive/path/file
  50.         OS_OPENHANDLE
  51. ;b=new file handle
  52.  
  53.         if 1==0
  54.         push bc
  55.         ld de,0
  56.         ld hl,1
  57.         ;dehl=shift
  58.         OS_SEEKHANDLE
  59.         pop bc
  60.         endif
  61.  
  62.         ld hl,0
  63.         ld de,0
  64. nvview_load0
  65.         push bc
  66.         push de
  67.         push hl
  68.         call reservepage
  69.         pop hl
  70.         pop de
  71.         pop bc
  72.         ret nz ;no memory
  73.         ;ld a,#c000/256
  74.         ;call cmd_loadpage
  75.  
  76.         push bc
  77.        
  78.         push de
  79.         push hl
  80.         ld de,0xc000
  81.         ld hl,0x4000
  82. ;B = file handle, DE = Buffer address, HL = Number of bytes to read
  83.         OS_READHANDLE
  84. ;HL = Number of bytes actually read, A=error
  85.         ld b,h
  86.         ld c,l
  87.         ld hl,0x4000
  88.         or a
  89.         sbc hl,bc ;NZ = bytes to read != bytes actually read
  90.         pop hl
  91.         pop de
  92.  
  93.         push af ;NZ = bytes to read != bytes actually read
  94.         ex de,hl
  95.         add hl,bc
  96.         ex de,hl
  97.         jr nc,$+3
  98.         inc hl
  99.         pop af ;NZ = bytes to read != bytes actually read
  100.  
  101.         pop bc
  102.  
  103.         ;or a
  104.         jr z,nvview_load0
  105. ;hlde=true file size (for TRDOSFS)
  106.         ld (fcb+FCB_FSIZE),de
  107.         ld (fcb+FCB_FSIZE+2),hl
  108.        
  109.         OS_CLOSEHANDLE
  110.        
  111.         ;ld hl,text
  112.         ;call prtext
  113. noautoload
  114.  
  115.         call textview
  116.         jp 0
  117.  
  118. prtext
  119. ;out: hl=after terminator
  120. prtext0
  121.         ld a,(hl)
  122.         inc hl
  123.         or a
  124.         ret z
  125.         push hl
  126.         PRCHAR
  127.         pop hl
  128.         jp prtext0
  129.        
  130.        
  131. skipword
  132. ;hl=string
  133. ;out: hl=terminator/space addr
  134. getword0
  135.         ld a,(hl)
  136.         or a
  137.         ret z
  138.         cp ' '
  139.         ret z
  140.         inc hl
  141.         jr getword0
  142.  
  143. skipspaces
  144. ;hl=string
  145. ;out: hl=after last space
  146.         ld a,(hl)
  147.         cp ' '
  148.         ret nz
  149.         inc hl
  150.         jr skipspaces
  151.  
  152. nv_setxy
  153. ;de=yx (kept)
  154. ;keeps hl
  155.         push de
  156.         push hl
  157.         push ix
  158.         OS_SETXY
  159.         pop ix
  160.         pop hl
  161.         pop de
  162.         ret
  163.        
  164. minhl_bc_tobc
  165.         or a
  166.         sbc hl,bc
  167.         add hl,bc
  168.         ret nc ;bc<=hl
  169.         ld b,h
  170.         ld c,l
  171.         ret
  172.  
  173.         include "../_sdk/prdword.asm"
  174.         include "textview.asm"
  175.         include "text_mem.asm"
  176.  
  177. oldtimer
  178.         dw 0
  179.        
  180. fcb
  181.         ds FCB_sz
  182. fcb_filename=fcb+FCB_FNAME        ;яю єьюыўрэш■ Єрь фышэр 0
  183.        
  184. cmd_end
  185.  
  186.         display "Size ",/d,cmd_end-cmd_begin," bytes"
  187.  
  188.         savebin "texted.com",cmd_begin,cmd_end-cmd_begin
  189.        
  190.         ;LABELSLIST "../us/user.l"
  191.