Search found 1236 matches

by jj2007
Nov 26, 2017 20:46
Forum: General
Topic: POINTER NULL CHECK
Replies: 41
Views: 1682

Re: POINTER NULL CHECK

Another example, I don't like the syntax: If Len(string) Then ... Dim MyString as string="123" asm int 3 if len(MyString) Then print "ifLen" endif asm int 3 if len(MyString)>0 Then print "ifLenGtzero" endif Address Hex dump Command Comments 0040161B ³. CC int3 0040161C...
by jj2007
Nov 26, 2017 16:31
Forum: General
Topic: POINTER NULL CHECK
Replies: 41
Views: 1682

Re: POINTER NULL CHECK

When compiling with gcc, complement a pointer is disallowed (works with gas). gcc is stricter (or gas more lax) The problem is maybe that some programmers don't pay much attention to the consequences: Dim handleI as integer Dim handleB as boolean handleI=123 handleB=123 if not handleI then print &q...
by jj2007
Nov 26, 2017 12:50
Forum: Beginners
Topic: Copy FB .csv file to Base table
Replies: 3
Views: 610

Re: Copy FB .csv file to Base table

Have you tried copying a tab-delimited text instead?

P.S.: There is a csv test file attached to this post.
by jj2007
Nov 26, 2017 12:41
Forum: General
Topic: POINTER NULL CHECK
Replies: 41
Views: 1682

Re: POINTER NULL CHECK

This works fine for me: dim handle as any ptr if handle = 0 then Print "NULL" if not handle then Print "Handle="; handle handle=1 if handle = 0 then Print "NULL" if not handle then Print "Handle="; handle Sleep Output: NULL Handle=0 Handle=1 Check also the out...
by jj2007
Nov 25, 2017 23:07
Forum: General
Topic: QuickSort Text
Replies: 3
Views: 335

Re: QuickSort Text

For position 11, ascending, your last code produces this - is that the intended result? alemania berlin freuiweuiweiu austria viena oihgijhvygctfs china pekin zxcxcvxc dinamarca copenague asgsdfgfsgdfgd francia paris abcdefghijklmno grecia atenas piuoiutuyyt inglaterra londres sdfsarbfbwshifb italia...
by jj2007
Nov 23, 2017 15:14
Forum: General
Topic: How non-random was QB's RND
Replies: 40
Views: 1594

Re: How non-random was QB's RND

Here is the code from C Diagonal patterns as well... Here is one with a switch: useMb=1 uses the MasmBasic Rand() algo. For useMb=0, you get QB. The result is pretty clear but have a closer look... const maxloops= 20000000 const useMb= 1 Static Shared As Long MasmBasicSeed=&h6f616943 Function M...
by jj2007
Nov 23, 2017 1:26
Forum: General
Topic: How non-random was QB's RND
Replies: 40
Views: 1594

Re: How non-random was QB's RND

I am not sure if the random generator is to blame: c = Int(Rnd() * 16) Try e.g. *4 or *12 or *1000... or see if you can recognise a pattern here: Dim As Short x, y, c, r Dim As long ct Screen 12 Randomize, 4 ct=0 Do x = Int(Rnd() * 640) y = Int(Rnd() * 480) c = Int(Rnd() * 16) r = Rnd() PSet (x, y),...
by jj2007
Nov 22, 2017 21:09
Forum: Beginners
Topic: ATARI basic to Free Basic
Replies: 7
Views: 914

Re: ATARI basic to Free Basic

50 CH=(PEEK(106)-8)*256 ' Is it the high byte of the first CHAR in screen memory or what ? 60 CHORG=PEEK(756)*256 ' Is it the start of the character ROM or what ? I remember vaguely to have seen such stuff briefly, in the early 1980s. But already in the late 1980s, Basic on an Atari looked more lik...
by jj2007
Nov 22, 2017 19:43
Forum: General
Topic: How non-random was QB's RND
Replies: 40
Views: 1594

Re: How non-random was QB's RND

All that is clear so far, and not surprising. But
r = Rnd()
produces non-random stripes, while
'r = Rnd()
looks much better. Same for
r = Rnd()
r = Rnd()
so my best guess is that calling Rnd() four times in a row causes some kind of repetition. Pretty odd anyway...
by jj2007
Nov 22, 2017 15:50
Forum: General
Topic: How non-random was QB's RND
Replies: 40
Views: 1594

Re: How non-random was QB's RND

If you comment out the r=Rnd(4), it looks a lot more random. What is the role of that line?
by jj2007
Nov 20, 2017 14:26
Forum: Tips and Tricks
Topic: WaitTimer
Replies: 6
Views: 1319

Re: WaitTimer

I wonder where mov [function+4],rdx is writing to...
by jj2007
Nov 20, 2017 14:17
Forum: General
Topic: Implicit vs Explicit Reference/Dereference
Replies: 7
Views: 329

Re: Implicit vs Explicit Reference/Dereference

Interesting... even a local string triggers a malloc/mfree sequence:

Code: Select all

Function hello3 (ct as integer) as Boolean
  Dim as string MyString3="Hello World "+str(ct)
  print MyString3
  Return 0
End Function
by jj2007
Nov 18, 2017 2:40
Forum: Beginners
Topic: Reversing
Replies: 13
Views: 933

Re: Reversing

You would probably be better of rewriting the source file. Exactly. Of course, you can load the executable into a debugger like OllyDbg , but you would typically see something like this: Address Hex dump Command Comments 00406AF3 ³. 53 push ebx 00406AF4 ³. 83EC 2C sub esp, 2C 00406AF7 ³. A1 3890400...
by jj2007
Nov 15, 2017 20:45
Forum: Tips and Tricks
Topic: LeapYear Function (Boolean eval.)
Replies: 126
Views: 5789

Re: LeapYear Function (Boolean eval.)

In future when the compiler is beating me perhaps I should post my asm and ask if anyone can improve on it. <smile> We have played that game many times in the Masm32 forum. It is fun to beat a C compiler, or the C Runtime library. And often you can indeed beat the CRT, for example by using SIMD ins...
by jj2007
Nov 15, 2017 18:14
Forum: Tips and Tricks
Topic: LeapYear Function (Boolean eval.)
Replies: 126
Views: 5789

Re: LeapYear Function (Boolean eval.)

http://deltarho.org.uk/Downloads/jj2007LeapYear11122017.zip Thanks a lot. This is an interesting piece of code indeed. The compiler replaces the division (very slow) with a multiplication by a magic number. The technique is well-known in assembler, but I didn't use it out of laziness ;-) Address He...

Go to advanced search