hey guys... I understand how to read a hex file and get the data to ram, I am just asking how can i write the file. I have included my code for reading which works great... I just need to reverse it without adding spaces or anything leading at the front and end file...
file is a ROM image so HEX "c000: 00 78 66 34 55 67 89" .eg no address or spaces. just 4k ascii dump I want to write back
put #1, with dot comma at the end or not
or
print #1 with dot comma at the end or not
also I know i need to change the above to send hex out to the file..
Thank you for any help or suggestions...
file is a ROM image so HEX "c000: 00 78 66 34 55 67 89" .eg no address or spaces. just 4k ascii dump I want to write back
Code: (Select All)
DIM SHARED c16(7, 15, 255) AS _UNSIGNED _BYTE, charload AS _UNSIGNED _BYTE, CHARACTER64 AS STRING * 1
' ----------------------------------------------------------------------------------------------------
READROM816: OPEN FILENAME$ FOR BINARY AS #1
FOR CHRDOLLAR% = 0 TO 255
FOR VERTPIXEL% = 0 TO 15
GET #1, , charload
FOR HORIPIXEL% = 0 TO 7
IF readbit(HORIPIXEL%, charload) THEN c16(7 - HORIPIXEL%, VERTPIXEL%, CHRDOLLAR%) = 1 ELSE c16(7 - HORIPIXEL%, VERTPIXEL%, CHRDOLLAR%) = 0
NEXT
NEXT
NEXT
CLOSE #1
RETURN
WRITEROM816: OPEN FILENAME$ FOR BINARY AS #1
FOR CHRDOLLAR% = 0 TO 255
HEXCHARACTER=0
FOR VERTPIXEL% = 0 TO 15
FOR HORIPIXEL% = 0 TO 7
CHARACTER% = c16(HORIPIXEL%, VERTPIXEL%, CHRDOLLAR%)
NEXT HORIPIXEL%
??? PRINT OR PUT #1, HEX CODE HERE 'HEXCHARACTER "&H CHARACTER%" EACH CELL IS ONE ASC(HEX 0 TO 255) SO WHEN WRITTEN IS "0A3D44FAFF" eg.
NEXT VERTPIXEL%
NEXT CHRDOLLAR%
CLOSE #1
RETURN
Do I use the put #1, with dot comma at the end or not
or
print #1 with dot comma at the end or not
also I know i need to change the above to send hex out to the file..
Thank you for any help or suggestions...

