Prosoft HomeSeries 3Series 5OPL ZonePCInternetLinks

topright.gif (833 bytes)









































































































































OPLZone Home  OPL Program Source Codes Series 3 Programming Tips Epoc 32 Programming Tips SIBO Programs EPOC32 Programs

EPOC 32 Programming Tips

How do you find out whether your program is running on a real machine, or the Windows Emulator?

Easy.... just use this code:

proc test:
  local float
  float = 1.0
  if peekl(addr(float))
    giprint "Psion"
  else
    giprint "Windows Emulator"
  endif
  get
endp

How do you transform hexadecimal to decimal and then back again?

    - To convert Decimal to Hex use the command:

hex$(x)


    - To go the other way and convert a hexadecimal string into a numbers use:

hex& = eval("&" + x$)

If you want to be able to deal with invalid hexadecimal numbers and know which digit was at fault then you may wish to use something like the following:

proc hex&:(arg$)
   local result&
   local tmp$(1), number$(255), digit$(16)

   : rem Local copy of the argument
   number$ = upper$(arg$)

   : rem Store the hex digits in order
   digit$ = "0123456789ABCDEF"

   : rem Start at zero.
   result& = 0

   : rem Work from left to right.
   while (number$ <> "")
      : rem Extract the leftmost hex digit. In C or
      : rem assembler we would index into the string
      : rem directly like an array.
      tmp$    = left$(number$, 1)
      number$ = right$(number$, len(number$) - 1)

      : rem Shift the result left by one hex place.
      : rem In C/assembler this would be a left shift
      : rem by four bits
      result& = result&*16

      : rem Add in the newly extracted digit. Note
      : rem that LOC() returns a position 1..16 for
      : rem the digits 0..F so we subtract 1. Also
      : rem note that invalid digits produce strange
      : rem results since we treat them as -1. We
      : rem could assume ASCII and convert the value
      : rem of tmp$ into 0..15 directly.
      : rem If we were doing this in C/assembler we
      : rem would use bitwise OR instead.
      result& = result& + (loc(digit$, tmp$) - 1)
   endwh

   return result&
endp
Download a copy of this code in text format by clicking here.

This answer was posted by Martin Dunstan in the comp.sys.psion.programmer newsgroup.

How do put commas in a dChoice list, as commas are used to separate different items in the list?

A "regular" comma ($2C) separates items, but there is also a nice character, very comma-looking at $82 (Psion Series 5 Only), so :

"aaa,bb"+chr$($82)+"b,ccc"

will give you three choices and not four...

On the Series 3 chr$(247) might work, however I have not tried it.

This was posted by Jean-Luc Damnet in the comp.sys.psion.programmer newsgroup.

What are the UIDs of the built in apps on the Psion Series 5?

App/File Type UID
Agenda 0x10000084
Data 0x10000086
File store info 0x10000050
OPL App 0x10000074
OPL Doc 0x10000075
OPL File 0x1000008A
OPL Interpreter 0x10000077
OPO 0x10000073
OPX DLL 0x1000005D
Program 0x10000085
Record 0x1000007E
Sheet 0x10000088
Sketch 0x1000007D
Word 0x1000007F

How do you create a multi bitmap mbm file?

I find the easiest way to create an mbm file is to create all my pictures on the PC and save them as bitmaps. I then use the Bmconv.exe program which I got on my PsiWin CD to create the mbm file. As I never get my icons right first time I have written a batch file which runs Bmconv with the appropriate switches etc.

If you have not got Bmconv.exe or you would like an example of how to use it (i.e. my batch file) download this zip:

bmconv.zip (33371 bytes)

The command syntax required for making an icon for a program with bmconv is as follows:

bmconv psi-file /4icon1.bmp mask1.bmp /4icon2.bmp mask2.bmp /4icon2.bmp mask2.bmp

/4 specifies that the following file should be stored with 4 bits per pixel, i.e. it contains grey. The mask only needs to be black and white, so there is no point storing unnecessary information.

This syntax is simplified for making icons. Bmconv can also convert mbm files into separate bmp files - see documentation on the PsiWin CD for more details.

When you are creating an icon for a program you will need three different sizes of it: 24x24 32x32 and 48x48. You will also need a mask for each icon, which tells the Psion which parts of the icon contains set bits in either black or grey. I have included an example set of icons in the above zip, as used in my o-and-x program.









































































































































 

 

Email

Email Me!