[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 264: mysqli_fetch_assoc(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 326: mysqli_free_result(): Couldn't fetch mysqli_result
Pete's QBASIC Site Discuss QBasic, Freebasic, QB64 and more 2008-03-05T18:55:38-05:00 http://www.petesqbsite.com/phpBB3/app.php/feed/topic/2615 2008-03-05T18:55:38-05:00 2008-03-05T18:55:38-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=16802#p16802 <![CDATA[Thanks]]>
I simply don't have the time to tutor via forum questions. I provided a program that would do the required operation. I say just run the program and update the ROM

Mac

Statistics: Posted by Mac — Wed Mar 05, 2008 6:55 pm


]]>
2008-03-04T13:30:28-05:00 2008-03-04T13:30:28-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=16796#p16796 <![CDATA[Inserting Hexadecimal in a file]]>
TheChar is the one byte String I referred to as 0$ = SPACE$(1). Either way works fine. You only add (PUT) or read (GET) one byte at a time. That is because each ASCII character in the file is one byte. This also makes the file more compact than using 2 byte integers.

TheHex is a 2 byte string character in HEX form like AA or 1F. Also Integers are always 2 bytes returned by ASC(TheChar). HEX$ converts it to a HEX string number and UCASE$ makes the letters uppercase.

Ted

Statistics: Posted by burger2227 — Tue Mar 04, 2008 1:30 pm


]]>
2008-03-04T12:59:24-05:00 2008-03-04T12:59:24-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=16795#p16795 <![CDATA[Inserting Hexadecimal in a file]]>
You get these ASCII characters in a string with length 1. Then you convert them to a numer 0-255 with ASC(asciicode$). You can make an ASCII character from a number with CHR$(number%).

I hope this will explain some things to you. Try messing around with it if you're not famaliar with it.

Statistics: Posted by Codemss — Tue Mar 04, 2008 12:59 pm


]]>
2008-03-04T08:42:28-05:00 2008-03-04T08:42:28-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=16794#p16794 <![CDATA[Inserting Hexadecimal in a file]]>
The lines that confuse me are:

DIM Size AS LONG: Size = LOF(1)

DIM TheChar AS STRING * 1 'Why times by 1?
DIM TheHex AS STRING * 2 'Why times by 2?

GET #1, CharNum, TheChar 'Reading hex. How did we already clarify what TheChar is?

TheHex = UCASE$(HEX$(ASC(TheChar))) 'This really confuses me.


'??? XD, confusing too
w1 = INSTR("0123456789ABCDEF", LEFT$(TheHex, 1))
IF w1 = 0 THEN PRINT "Use 0-F only": RETURN
W2 = (w1 - 1) * 16
w1 = INSTR("0123456789ABCDEF", RIGHT$(TheHex, 1))
IF w1 = 0 THEN PRINT "Use 0-F only": RETURN
W2 = W2 + w1 - 1
TheChar = CHR$(W2)

Size = LOF(1) 'Still yet to figure out what this does.

Anyways, BIG thanks mac! You too burger!

Statistics: Posted by Sinuvoid — Tue Mar 04, 2008 8:42 am


]]>
2008-03-04T07:02:02-05:00 2008-03-04T07:02:02-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=16792#p16792 <![CDATA[Inserting Hexadecimal in a file]]>
Get it?!?!
Got it.

Made a demo file, "z64". The demo program produced

Code:

Menu - Last byte is currently 2007 1) Read hex 2) Write hex <------------ I chose this option 3) FinishedCharacter Number? 2008 <--- I selected last+1 to append new charValue: e3 <---------------- I entered this HexDoneMenu - Last byte is currently 2008 1) Read hex  <------------ I chose this option 2) Write hex 3) FinishedCharacter Number? 2008Value is E3  <------------- I see the value was successfully added
Mac

Code:

OPEN "z64" FOR BINARY AS #1DIM Size AS LONG: Size = LOF(1)DIM CharNum AS LONGCLSDO  PRINT : PRINT "Menu - Last byte is currently"; Size  PRINT " 1) Read hex"  PRINT " 2) Write hex"  PRINT " 3) Finished"  SELECT CASE INPUT$(1)  CASE "1": GOSUB Read1  CASE "2": GOSUB Write1  CASE "3": EXIT DO  CASE ELSE: PRINT "GOOF use 1 2 3 only"  END SELECTLOOPCLOSE #1SYSTEMDIM TheChar AS STRING * 1DIM TheHex AS STRING * 2Read1:INPUT "Character Number"; CharNumIF CharNum < 1 THEN PRINT "Too little": RETURNIF CharNum > Size THEN PRINT "Too big": RETURNGET #1, CharNum, TheCharTheHex = UCASE$(HEX$(ASC(TheChar)))PRINT "Value is "; TheHexRETURNWrite1:INPUT "Character Number"; CharNumIF CharNum < 1 THEN PRINT "Too little": RETURNIF CharNum > Size + 1 THEN PRINT "Too big": RETURNLINE INPUT "Value: "; TheHexTheHex = UCASE$(TheHex)IF LEN(TheHex) <> 2 THEN PRINT "Need two chars such as 3F": RETURNDIM w1 AS INTEGER, W2 AS INTEGERw1 = INSTR("0123456789ABCDEF", LEFT$(TheHex, 1))IF w1 = 0 THEN PRINT "Use 0-F only": RETURNW2 = (w1 - 1) * 16w1 = INSTR("0123456789ABCDEF", RIGHT$(TheHex, 1))IF w1 = 0 THEN PRINT "Use 0-F only": RETURNW2 = W2 + w1 - 1TheChar = CHR$(W2)PUT #1, CharNum, TheCharSize = LOF(1)PRINT "Done"RETURN

Statistics: Posted by Mac — Tue Mar 04, 2008 7:02 am


]]>
2008-03-04T03:23:21-05:00 2008-03-04T03:23:21-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=16791#p16791 <![CDATA[Inserting Hexadecimal in a file]]>
Just use: PUT #1, , CHR$(Number) to append it to a BINARY file end.

To read the numbers, use GET #1, bytenumber%, O$ , where O$ = SPACE$(1) and use ASC(O$) if needed. Use a loop to read a file.

If you ever need a HEXadecimal value returned just use:

HexNum$ = "&H" + HEX$(DecimalNumber)

To convert it to a QB value you must add "&H" to the beginning of the value. VAL will convert it back to decimal where needed.

Ted

Statistics: Posted by burger2227 — Tue Mar 04, 2008 3:23 am


]]>
2008-03-04T00:12:42-05:00 2008-03-04T00:12:42-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=16789#p16789 <![CDATA[Inserting Hexadecimal in a file]]>
Here's what Hex looks like folks:

Code:

This is hex, translates tooooooooo-----------------V1A F4 D7 B1 F5 AA 22 ------------> Some random ASCII characters.
Now, imagine a whole file of that. What I want to do is put hex at the end of the file. Like so:

Code:

-Hex code-*Insert Your hex code here, at the end of file*
Get it?!?!

Statistics: Posted by Sinuvoid — Tue Mar 04, 2008 12:12 am


]]>
2008-03-03T23:35:42-05:00 2008-03-03T23:35:42-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=16788#p16788 <![CDATA[Hmmmmmmm same problem asking questions]]>
I don't decipher lame questions! And you have been warned BEFORE.

So I WILL PASS!

Mr. Obvious

Statistics: Posted by burger2227 — Mon Mar 03, 2008 11:35 pm


]]>
2008-03-03T15:03:09-05:00 2008-03-03T15:03:09-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=16783#p16783 <![CDATA[Inserting Hexadecimal in a file]]>

Statistics: Posted by Sinuvoid — Mon Mar 03, 2008 3:03 pm


]]>
2008-03-03T12:40:35-05:00 2008-03-03T12:40:35-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=16781#p16781 <![CDATA[Re: Inserting Hexadecimal in a file]]>
How can I insert hex in a file?
z64 is a N64 ROM and Im making a text editor to insert code at the end of it.
I'm not sure that a ROM is a file. You can easily append HEX (or any other) stuff at the end of a file. How it would get to a ROM I am not
clear. Never messed with it.

Mac

Statistics: Posted by Mac — Mon Mar 03, 2008 12:40 pm


]]>
2008-03-03T12:33:21-05:00 2008-03-03T12:33:21-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=16780#p16780 <![CDATA[Inserting Hexadecimal in a file]]>
That goes like this:

OPEN file$ FOR BINARY AS #1 (Suppose file #1 is free)
FOR position = 1 to 10
PUT #1, position, number
NEXT position
CLOSE #1

There may be some things wrong, but I think most of this is right. Number is 0-255.

Statistics: Posted by Codemss — Mon Mar 03, 2008 12:33 pm


]]>
2008-03-03T10:04:44-05:00 2008-03-03T10:04:44-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=16779#p16779 <![CDATA[Inserting Hexadecimal in a file]]>

Anyways, heres my problem, How can I insert hex in a file? Like anywhere? Here's what I think it may look like:

Code:

-stuff-OPEN "File.z64" FOR BINARY  (Or Random?) AS #1PUT (Forget the rest of the command XD But I know it puts whatever a variable has in a certain spot)CLOSE #1
z64 is a N64 ROM and Im making a text editor to insert code at the end of it.

Statistics: Posted by Sinuvoid — Mon Mar 03, 2008 10:04 am


]]>