; ResFinder header file
; Rick, 2014/02/03
; Because random magic numbers are a pain in the ass

; we allocate 128 bytes of buffer space
BUFFERSIZE           * 128

; offsets into the ReadArgs array
ARGPTR_PROGNAME      *   4                   ; array is: [ <ourname> <progname> <resvar> <useos> ... ]
ARGPTR_RESVAR        *   8                   ;             +0        +4         +8       +12
ARGPTR_USEOS         *  12
; value ReadArgs returns for parameter being present
ARG_ISSET            * &7FFFFFFF

; flag if a resource variable is provided
CUSTOM_RESVAR        *   1

; OS_Byte stuff
OSB_RW_COUNTRY       *  70
OSB_RW_KEYALPHA      *  71
IS_DEFAULT           *   0
IS_UK                *   4                   ; we revert to UK if keyboard read fails
IS_UTF8              * 111

; OS_File stuff
READ_CATALOGUE       *  17                   ; with no Path...
NOT_FOUND            *   0                   ; I resisted calling this FOUR_OH_FOUR ;-)
IS_A_DIRECTORY       *   2

; OS_SetVarVal stuff
SET_STRING           *   0
SET_NUMBER           *   1

; This, and anything less, is a control character.
CTRLCHAR             *  31

; Null terminator (to make it blatantly obvious!)
TERMINULL            *   0

; Device detection stuff
PLATFORMCLASS        *   8
HAS_A_HAL            *   5
NO_MATCH             *  -1

; Device types
DEVICE_UNKNOWN       *   0
DEVICE_MESOLITHIC    *   1                   ; see note below for why "Mesolithic" was chosen
DEVICE_RISCPC        *   2
DEVICE_IYONIX        *   3
DEVICE_HALCPUTYPE    *   4                   ; the ones the HAL can reply are CPUTYPE+4
;DEVICE_OMAP3        *   4
;DEVICE_OMAP4        *   5
;DEVICE_RPI          *   6

; Why Mesolithic?
; The "Stone Age" is broken into three sections, namely:
;   Paleolithic  - Lower covers proto-human development in the Ice Age (ranging from ~2.5 million
;                  years ago) to around 300,000 years ago.
;                  Middle covers the period of around 300,000-50,000 years ago. This is the age of
;                  the Neanderthals.
;                  Upper covers the period of around 50,000-10,000 years ago. Sometime in this time
;                  frame humans (as we are now) arrived and took over the Earth. The truth is more
;                  likely that Neanderthals failed to adapt in time to the changing climate as the
;                  Ice Age drew to a close, so died out more naturally than by us slaying them, but
;                  given human history is basically an epic slaughterfest, either theory is viable.
;   Mesolithic   - In the warmer days after the Ice Age (around 10,000 to 6,000 years ago), this is
;                  the era of the Stone Age when humans were still primarily hunter-gatherers.
;   Neolithic    - From around 6,000-3,000 years ago, this is the period of the Stone Age where our
;                  species started to organise itself into agricultural based communities. Rather than
;                  killing wild animals, we raised animals. We grew crops, and we learned how to make
;                  pottery.
;   [this was followed by the Bronze Age (also known as steampunk ;-) ) and then the Iron Age (aka
;    "oh look, another war!").
; Now, with this history under our belt, the reasoning for the names is as follows:
;   Paleolithic  - the Beeb/6502 era.
;   Mesolithic   - the Archimedes era, including the RiscPC (etc) operating in a 2226 bit mode.
;   Neolithic    - the rise of the x86 PC; not strictly a part of the RISC OS timeline, but following
;                  the demise of Acorn and a lot of dumb infighting, it all went real quiet for a
;                  while.
; This, of course, implies that we are not yet in the Modern Era. This is correct.
;   Bronze Age   - This is the Iyonix. Not just because a company made "a new machine" because it has
;                  happened before post-Acorn (Mico, etc), but more importantly RISC OS was now fully
;                  free of the shackles of 26 bit PC+PSR mode that Acorn were damned reluctant to let
;                  go of. In other words, future ARMs *could* run RISC OS.
;   Iron Age     - WHERE WE ARE NOW.
;                  RISC OS itself is now an open source project (maybe not as open as RMS would like,
;                  but I can download and build my own so it is open enough for me). RISC OS has
;                  matured and is available on a selection of nice ARM boards, ranging from the pricey
;                  (Beagle, Panda) to the ridiculously cheap (Pi, Pi, Pi). We benefit from modern
;                  technologies (USB, SD cards, fast ethernet) while having ooodles of memory and
;                  big displays and processor speeds that are almost shamefully fast. When the RiscPC
;                  was released, you'd have been called crazy if you said you would pick up an 800MHz
;                  ARM (RPC=~35 at the start) with half a GIGABYTE of memory (RPC=~8-32MB; hell, most
;                  built-in harddiscs were smaller!) and it won't sweat at displays like 1280x1024 or
;                  even 1920x1080 (most people accepted 800x600 was a good size back then; which ever
;                  so slowly crawled to 1024x768). Oh, and that's with 16M colours throughout. The
;                  RiscPC couldn't do 1024x768@16M because it could only take up to 2MB VRAM. FullHD
;                  in RGBA needs 8MB which might have been as much as was fitted ENTIRELY.
;   Modern Age?  - This will come, but it relies upon the chip bakers. This will be the era when the
;                  ARM SoCs provide a way to autodetect what features are available and when the
;                  available features offer a generic compatible interface (for the most part). In
;                  this way, *one* RISC OS image will be able to run on different machines. You just
;                  download RISC OS, install it, and off you go.
;                  This isn't unrealistic. This is how the PC has worked ever since the days of the XT
;                  because back then it was the software that sold the machine and if you didn't run
;                  the software that people wanted (originally MS-DOS and then Windows in its various
;                  incarnations) you would be "incompatible" and you wouldn't sell. There were brief
;                  diversions (Hercules display, anybody?) but for the most part you can boot a twenty
;                  year old OS on a modern PC because the discovery process is the same. You may be
;                  missing features (possibly even keyboard now USB is ubiquitous - depends on how much
;                  the BIOS will assist) but it is possible.
;                  Compare and contrast this with current ARM SoCs where there are so many little
;                  differences that while the majority of RISC OS will run on any supported device, it
;                  needs a specific targeted version for each platform. Do we have a device discovery
;                  protocol? (No.) Can we rely upon at least a framebuffer for video? (Yes, but each
;                  one is different so this is more a No than a Yes.) Is there a serial port? (Maybe.)
;                  Where? (Um.... someplace.) How is memory arranged? (Umm...) What is the address of
;                  the USB driver? (I want a lollipop!) You booted from what? SD? eMMC? (I want my
;                  blankie!) How do you access the media you just booted from? (Mummmmeeeeeeee!!!!)
;                  The Modern Age is coming.
;                  Liken it to Climate Change.
;                  It WILL happen. We're just not sure when.


Created by ROView by Rick Murray.