flat assembler
Message board for the users of flat assembler.
  
       
      Index
      > OS Construction > make disc image with fasm | 
  
| Author | 
  | 
              
| 
                  
                   LocoDelAssembly 15 Apr 2011, 06:05 
                  Code: macro store_uppercase char*{ if char >= 'a' & char <= 'z' db (char) - 'a' + 'A' else db char end if } macro write_fat_name filename*{ local ..char, ..dotFound virtual at 0 db filename if $ > 8 + 1 + 3 err 'File name too large!' end if db 8 + 1 + 3 - $ dup(' ') rept 8 + 1 + 3 i:0\{ load ..char\#i byte from i \} end virtual ..dotFound = 0 rept 8 + 1 + 3 i:0\{ if ..dotFound if ..char\#i = '.' err 'Extension specified more than once!' end if if i <= 8 db ' ' end if else if ..char\#i = '.' ..dotFound = i else store_uppercase ..char\#i end if \} if ..dotFound = 0 | ..dotFound > 8 err 'Incorrect extension' end if rept 8 + 1 + 3 i:0\{ if i > ..dotFound & i <= ..dotFound + 3 store_uppercase ..char\#i end if \} } write_fat_name 'SysInfo.app' ; <- Example  | 
              |||
                  
  | 
              
| 
                  
                   egos 15 Apr 2011, 07:59 
                  Code: ...fatname1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11 Code: macro dent id, name, attr { @@ db name times @b+11-$ db 32 db attr ... } dent fileid,"FILE TXT",FA_ARC dent dirid,"DIR",FA_DIR  | 
              |||
                  
  | 
              
| 
                  
                   LocoDelAssembly 15 Apr 2011, 17:10 
                  New version using making less load to the preprocessor side (and saving compile-time memory)
 
                  
                Code: macro store_uppercase char*{ if char >= 'a' & char <= 'z' db (char) - 'a' + 'A' else db char end if } macro shift reg*, out*{ out = reg#0 and $FF reg#0 = reg#0 shr 8 reg#0 = (reg#1 and $FF) shl 56 or reg#0 reg#1 = reg#1 shr 8 } macro write_fat_name filename*{ local ..r, ..char, ..i, ..j virtual at 0 db filename if $ > 8 + 1 + 3 err 'File name too large!' end if db 16 - $ dup(' ') load r0 qword from $$ load r1 qword from $$+8 end virtual shift r, ..char ..i = 0 while ..i <= 8 & ..char <> '.' store_uppercase ..char shift r, ..char ..i = ..i + 1 end while if ..char <> '.' | ..i > 8 err 'Incorrect extension' end if db 8 - ..i dup(' ') ..j = 0 repeat 8 + 1 + 3 - ..i shift r, ..char if ..char = '.' err 'Extension specified more than once!' end if if ..j = 3 & ..char <> ' ' err 'Extension too large!' end if if ..j < 3 store_uppercase ..char ..j = ..j + 1 end if end repeat } write_fat_name 'SysInfo.app' ; <- Example The macro you have to use is write_fat_name. Note that although I placed some checks them are not enough so try to always provide valid file names  | 
              |||
                  
  | 
              
| 
                  
                   codelab 15 Apr 2011, 22:07 
                  Thanks for your replies !!!
 
                  
                Quote: 
 so 'test.bin' IN and 'test bin' OUT and no memory affected Loco's is processing this correct but also stores in memory. and maybe this is the only way ? but sample will work for the root entry purpose. sort of temp buffer / macro parameter properties, not affecting the binary....  | 
              |||
                  
  | 
              
| 
                  
                   egos 16 Apr 2011, 06:11 
                  You could make something like this:
 
                  
                Code: repeat 11 virtual at 0 db name times 11-$ db 32 load sym from %-1 end virtual store sym at rootdirptr+%-1 end repeat  | 
              |||
                  
  | 
              
| 
                  
                   codelab 16 Apr 2011, 09:36 
                  Here's a dirty sample explaining a bit better
 
                  
                Code: macro addfile filename { local fname align buffer11b+512 ; here is a heading buffer for temp use fname: write_fat_name filename bmov fname,tableptr ; add entry file filename ; Actual file insert here, with odd alignment tableptr=tableptr+32 } table: rb 32*no_of_root_entries fileclusters: tableptr=table addfile 'test.bin' addfile 'test2.bin' relocate_files_and_discard_buffers ; now all heading buffers are overwritten and we are aligned to 512 ; but we have used memory in the binary for storage ; this is not a happy solution, since we might want ; to assemble directly instead of include binary file ; which requiring more complex relocation  | 
              |||
                  
  | 
              
< Last Thread | Next Thread >  | 
    
Forum Rules: 
  | 
    
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.