Search found 154 matches
- Dec 28, 2023 22:45
- Forum: Beginners
- Topic: DIM-ing a constant string
- Replies: 6
- Views: 530
Re: DIM-ing a constant string
That's very clever. Many thanks once again.
- Dec 28, 2023 19:05
- Forum: Beginners
- Topic: DIM-ing a constant string
- Replies: 6
- Views: 530
DIM-ing a constant string
I would like to Dim a constant 512-byte string consisting of 256 repetitions of "Er". This pseudocode is essentially what I want: Dim sErrorSec as Const String * 512 = "Er" * 256 ... but this is the only code I can come up with: Dim sErrorSec As String Dim i As uByte sErrorSec = ...
- Jul 23, 2023 4:36
- Forum: Beginners
- Topic: Searching for bytes in a block of memory
- Replies: 3
- Views: 1452
Re: Searching for bytes in a block of memory
This is what I ended up with. Dim bHINxPtr As UByte Ptr Dim qwFFblock( 0 To 3 ) As ULongInt = { &HFFFFFFFFFFFFFFFF, &HFFFFFFFFFFFFFFFF, &HFFFFFFFFFFFFFFFF, &HFFFFFFFFFFFFFFFF} Dim wdBytOfst As UShort Dim wdUCodeLoc As UShort wdUCodeLoc = 0 For wdBytOfst = 0 To ( &H200 - 32 ) If m...
- Jul 22, 2023 23:19
- Forum: Beginners
- Topic: Searching for bytes in a block of memory
- Replies: 3
- Views: 1452
Searching for bytes in a block of memory
I have an allocation of memory which contains a block of data consisting of 32 repetitions of 0xFF. I would like to search this memory for this block and position the pointer at the following byte. However, I can't come up with a "clean" solution. Is there a built-in function, or a C funct...
- Jul 19, 2023 1:11
- Forum: Beginners
- Topic: Passing string parameters to subroutine
- Replies: 5
- Views: 1684
Re: Passing string parameters to subroutine
Among other things, my conceptual problem was that I did not understand that a string pointer had a length property associated with it.
Thanks again.
Thanks again.
- Jul 16, 2023 2:58
- Forum: Beginners
- Topic: Passing string parameters to subroutine
- Replies: 5
- Views: 1684
Re: Passing string parameters to subroutine
Thanks. I had wondered whether that was the solution, but it seems I never properly understood byref versus byval.
- Jul 15, 2023 22:22
- Forum: Beginners
- Topic: Passing string parameters to subroutine
- Replies: 5
- Views: 1684
Passing string parameters to subroutine
I have a main program which reads a ROM image file of size dwROMsiz into a large string, sROMdata. I want to be able to parse this string with Instr in a subroutine. I would prefer that the variables are not Shared, so that the subroutine would be portable. That is, I want to be able to insert the s...
- Jun 01, 2023 15:39
- Forum: Beginners
- Topic: Macro for Print + Print #
- Replies: 9
- Views: 2267
Re: Macro for Print + Print #
I was originally using Version 1.07.1. Command executed: "C:\FreeBASIC\fbc.exe" "C:\FreeBASIC\FBIDE\FBIDETEMP.bas" Compiler output: C:\FreeBASIC\FBIDE\FBIDETEMP.bas(27) error 42: Variable not declared, stuff in 'print "TEST:" '' screen only' C:\FreeBASIC\FBIDE\FBIDETEMP...
- May 31, 2023 21:45
- Forum: Beginners
- Topic: Macro for Print + Print #
- Replies: 9
- Views: 2267
Re: Macro for Print + Print #
Just FYI, this macro trick doesn't work in earlier versions of the compiler, so I expect that it is not guaranteed to work in future versions.
- May 28, 2023 17:56
- Forum: Beginners
- Topic: Macro for Print + Print #
- Replies: 9
- Views: 2267
Re: Macro for Print + Print #
Thanks. Very clever. Actually, redefining the Print command will be very useful to me. That's because my software usually parses firmware modules, and the structure of these modules changes as new versions emerge. These new versions will usually break my code. Unfortunately, if my program crashes, t...
- May 27, 2023 17:20
- Forum: Beginners
- Topic: Macro for Print + Print #
- Replies: 9
- Views: 2267
Re: Macro for Print + Print #
I want to write the same "stuff" to both the console and the specified file. I have a program which writes updates to a log file, and I want these updates to be echoed on the screen while the program is running.
- May 26, 2023 20:00
- Forum: Beginners
- Topic: Macro for Print + Print #
- Replies: 9
- Views: 2267
Re: Macro for Print + Print #
This works:
Code: Select all
#macro PrintC( a, b... )
Print a, b
Print b
#endmacro
Dim bdata as byte = 41
dim f as long
f = freefile
open "c:\temp\junk.txt" for output as #f
PrintC( #f, "text"; "text2" & "text3", bdata )
close #f
sleep
- May 26, 2023 9:18
- Forum: Beginners
- Topic: Macro for Print + Print #
- Replies: 9
- Views: 2267
Macro for Print + Print #
Would it be possible to define a macro, PrintC, such that this ... PrintC #f, "text"; "text2" & "text3", data ... resolves to ... Print #f, "text"; "text2" & "text3", data Print "text"; "text2" & "text3&...
- May 25, 2023 18:30
- Forum: Beginners
- Topic: (mis)understanding Isalnum
- Replies: 2
- Views: 1682
Re: (mis)understanding Isalnum
Thank you for the detailed explanation.
I would argue that the behaviour of this function is counterintuitive. In any case, it's inappropriate for my application, so I've had to write my own trivial 7-bit ASCII version.
Thanks again.
I would argue that the behaviour of this function is counterintuitive. In any case, it's inappropriate for my application, so I've had to write my own trivial 7-bit ASCII version.
Thanks again.
- May 24, 2023 19:23
- Forum: Beginners
- Topic: (mis)understanding Isalnum
- Replies: 2
- Views: 1682
(mis)understanding Isalnum
Why does the Isalnum function in crt/ctype.bi not return 0 for all ubyte values greater than 0x7F? Why is it not limited to 7-bit ASCII characters? This table lists Hex(ubytvar) and Hex(Isalnum(ubytvar)): 00 00 01 00 02 00 03 00 04 00 05 00 06 00 07 00 08 00 09 00 0A 00 0B 00 0C 00 0D 00 0E 00 0F 00...