Author Topic: Cant load  (Read 3241 times)

0 Members and 2 Guests are viewing this topic.

Peter

  • Guest
Cant load
« on: December 05, 2011, 05:31:03 AM »
Deleted..
« Last Edit: May 05, 2015, 12:13:53 PM by Peter »

Charles Pegge

  • Guest
Re: Cant load
« Reply #1 on: December 05, 2011, 10:44:02 PM »

Hi Peter,

Your Text params were the wrong way round.

Code: OxygenBasic
  1. indexbase 0
  2. include "window.h"
  3.  
  4. SetWindow "Load Check",320,240,w_2
  5. Font 12,24,700,"courier"
  6.  
  7. dim map(108) as byte
  8. sys x, loaded
  9. loaded = LoadFile "maps/map1-1.bin", map
  10. string s="Loaded= " + loaded
  11. Text s,0,0,white
  12. WaitKey(32)
  13.  
  14. While Esckey()=0
  15. cls 0
  16. for x=0 to 8
  17.    Text "map" + x + "= " + map(x),0,x*24,white
  18. next
  19. DoEvents
  20. SwapBuffers
  21. Wend
  22. WinEnd
  23.  


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
  1.  
  2. Function LoadFile(File As String, byref dest As Any) As Long
  3. sys fHandle
  4. Long count
  5. fHandle = CreateFile(file, GENERIC_WRITE or GENERIC_READ, FILE_SHARE_READ Or FILE_SHARE_WRITE, BYVAL 0, OPEN_ALWAYS, 0, 0)
  6. count   = GetFileSize fHandle, Byval 0
  7. ReadFile fHandle,dest,count,dwc,Byval 0
  8. CloseHandle fHandle
  9. Return dwc
  10. End Function
  11.  

Charles

Charles Pegge

  • Guest
Re: Cant load
« Reply #2 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!
« Last Edit: December 06, 2011, 05:19:40 AM by Charles Pegge »

efgee

  • Guest
Re: Cant load
« Reply #3 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.

JRS

  • Guest
Re: Cant load
« Reply #4 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!

« Last Edit: December 06, 2011, 10:50:53 PM by JRS »

efgee

  • Guest
Re: Cant load
« Reply #5 on: December 06, 2011, 04:46:28 PM »
...I think we all should be overjoyed we are seeing a 64 bit anything this early the the OxygenBasic development cycle.

I concur!!!

It amazes me how fast Charles reads necessary documents and spits out code at the same time.

Great Job Charles.

 8)

Charles Pegge

  • Guest
Re: Cant load
« Reply #6 on: December 07, 2011, 02:20:23 PM »

Hi Peter

I found the problem was mixing a C and a Basic expression in the prototype.

Function LoadFile(string file, byref dest As Any) As sys

I am in the process of refactoring (pulling the compiler to pieces :)) to make it interpret these mixes correctly.

Charles