Programming => Problems & Solutions => Topic started by: Peter on December 05, 2011, 05:31:03 AM
Title: Cant load
Post by: Peter on December 05, 2011, 05:31:03 AM
Deleted..
Title: Re: Cant load
Post by: Charles Pegge on December 05, 2011, 10:44:02 PM
Hi Peter,
Your Text params were the wrong way round.
Code: OxygenBasic
indexbase 0
include "window.h"
SetWindow "Load Check",320,240,w_2
Font 12,24,700,"courier"
dim map(108) asbyte
sys x, loaded
loaded = LoadFile "maps/map1-1.bin", map
string s="Loaded= " + loaded
Text s,0,0,white
WaitKey(32)
While Esckey()=0
cls 0
for x=0 to 8
Text "map" + x + "= " + map(x),0,x*24,white
next
DoEvents
SwapBuffers
Wend
WinEnd
But In the course of investigating the LoadFile, I also corrected the dwc byte-count return. globally defined dim dwc as sys, should not be defined as byref
Code: OxygenBasic
Function LoadFile(File AsString, byref dest AsAny) AsLong
sys fHandle
Long count
fHandle = CreateFile(file, GENERIC_WRITE or GENERIC_READ, FILE_SHARE_READ Or FILE_SHARE_WRITE, BYVAL 0, OPEN_ALWAYS, 0, 0)
count = GetFileSize fHandle, Byval 0
ReadFile fHandle,dest,count,dwc,Byval 0
CloseHandle fHandle
Return dwc
EndFunction
Charles
Title: Re: Cant load
Post by: Charles Pegge on December 06, 2011, 05:16:41 AM
Okay Peter. Have you changed any other functions? - I am trying to keep compatibility with a selection of your previous examples.
I agree 64 bit is not a bundle of joy. I've worked on a few of your programs and got them running as 64 bit binaries. You have to pay close attention to variable types.
Working in 64 bit Assembler with the OS is considerably more demanding but good for the soul :D
Charles
PS: Rejuvenation therapy for the Basic language!
Title: Re: Cant load
Post by: efgee on December 06, 2011, 03:37:37 PM
Peter, Why do you have a Windows64.h?
There should not be a Windows32.h and a Windows64.h. All types that should change from 32 to 64 bits should be a sys datatype.
If every thing is sized correctly one Windows.h should work for 32 and 64 bit.
Title: Re: Cant load
Post by: JRS on December 06, 2011, 04:37:41 PM
Quote
Working in 64 bit Assembler with the OS is considerably more demanding but good for the soul
If a 64 bit Basic compiler was that easy to do, PowerBASIC would have released one by now. I think we all should be overjoyed we are seeing a 64 bit anything this early in the OxygenBasic development cycle.
P.S.
Site was down due to a major AT&T trunk line failure to my hosting provider. Sorry!
Title: Re: Cant load
Post by: efgee on December 06, 2011, 04:46:28 PM