home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.asm.x86      Ahh, the lost art of x86 assembly      4,675 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 3,448 of 4,675   
   wolfgang kern to All   
   Re: text editor basics   
   29 Jun 18 12:27:08   
   
   From: nowhere@never.at   
      
   bilsch01 wrote:   
      
   > The underlying system is 16-bit real mode FAT16, 64 sectors/cluster.   
   > Display is via the 4000 byte area at segment 0xb800. That area holds   
   > 2000 text bytes. I have text files from 15k to 135k size to experiment   
   > with.  My program can find a desired file and load part (4096 bytes) of   
   > it in memory.  I have some questions now about designing a simple text   
   > editor. Questions regarding memory buffers.   
      
   4KB as minimum load size? why not 512 byte?   
   (my loader allow unbuffered single byte part read from any offset)   
      
   > 1.  I believe I must decide on a maximum (MAX) file size it will work   
   > with.  If the user tries to load a larger file (document) I must issue   
   > an error saying to choose a file less than MAX.  I think a good size for   
   > MAX might be 96k (3 clusters) but that might be too ambitious.   
      
   96k is lot, 64k are easier to handle.   
      
   > NOTE: I don't know how much memory I can use before overwriting   
   > essential BIOS information. OS (text editor included) begins at 0x7e00.   
      
   If you boot your own OS and setup your own stack then all memory in the   
   range 0060:0000 .. 8FC0:FFFF is yours (EBDA uses 1K at 9FC0:0000),   
   the 256 bytes at 0050:0000 arent used by my BIOSes.   
      
   so if your OS+appliction starts at 0:7e00 and you like to keep the MSR   
   then there are (07c00-00500=07700) 30208 rsp 30464 bytes free here.   
   I'd put the stack and all variables there (CS=SS=0).   
   Available memory above depends on the size of your code:   
      
   (9FC00-07E00=97E00) = 622080 byte minus your code.   
   iow:   
   if all your code fits into 32.5K then nine full 64K segments are free.   
      
   > 2. Size of files in bytes vs size of files in clusters.  This program   
   > must examine inside the last cluster of the file and determine where   
   > text ends and where zeros begin and calculate file size (nonzero data in   
   > last cluster plus n x 32768) and record that in the root directory entry.   
      
   FAT directory entries hold filesize in bytes and the start cluster#.   
      
   > 3.  I must provide a memory buffer larger than MAX because editing can   
   > add new text data which can exceed MAX size.  Call this MAXBUF.  What   
   > should I consider in choosing MAXBUF size ?   
      
   I'd use 50% of what's still available after the file loaded.   
      
   > 4. I need a 'selection buffer' to hold chunks of text selected for copy   
   > and insertion elsewhere in the document.   
      
   16 bit limited Clip boards go better to disk rather than to memory.   
   __   
   wolfgang   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca