<sect2>Sprites
<p>
You are free to use any of the eight sprites, but keep in mind that sprite 0 is actually the mouse
-pointer and sprite 1 can be overwritten when using text prompt.
+pointer and sprite 1 can be overwritten when using text prompt. You don't have to worry about
+40/80 column issues because GEOS128 has pretty good sprite emulator for VDC.
<sect3>DrawSprite
<p>
<p>
<tt/void PromptOff (void)/
<p>
-The first function places text prompt in given place and enables its blinking
+The first function places text prompt in given place and enables blinking.
The second one is pretty self-explanatory.
<sect3>GetNextChar
<p>
<tt/char WriteBuff (struct tr_se *myTrSe)/
<p>
-These functions are reading and writting sector placed at <tt/diskBlkBuf/.
+These functions read and write sector placed at <tt/diskBlkBuf/.
<sect3>GetBlock and ReadBlock
<p>
<tscreen><verb>
#define BlockInUse FindBAMBit
...
-if (!SectInUse(&myTrSe)) {
+if (!BlockInUse(&myTrSe)) {
... block not allocated ...
}
</verb></tscreen>
<p>
<tt/char OpenRecordFile (char *fName)/
<p>
-This function finds and opens given file. An error is returned if file is not found or it is not
+This function finds and opens given file. An error is returned if file is not found or if it is not
in VLIR format. Information in <tt/VLIRInfo/ is initialized. VLIR track and sector table is
loaded at <tt/fileTrScTab/ and will be valid until call to <tt/CloseRecordFile/ so don't modify it.
You should <tt/PointRecord/ before trying to do something with file.
<p>
<tt/char UpdateRecordFile (void)/
<p>
-This function fill check <tt/VLIRInfo.fileWritten/ flag and if it is set, then <tt/curDirHead/ will
-be updated along with size and date stamps in directory entry.
+This function will check <tt/VLIRInfo.fileWritten/ flag and if it is set, then <tt/curDirHead/ is
+updated along with size and date stamps in directory entry.
<sect3>PointRecord
<p>
<tt/DoneWithIO/ and some Kernal routines. Unless new device is a disk drive this only sets
new value in <tt/curDevice/, in other case new disk driver is loaded from REU or internal RAM.
+<sect2>get_ostype
+<p>
+<tt/char get_ostype (void)/
+<p>
+This function returns GEOS Kernal version combined (by logical OR) with machine type. Read
+<tt/gsys.h/ for definitions of returned values.
+
+<sect2>get_tv
+<p>
+<tt/char get_tv (void)/
+<p>
+This function returns PAL/NTSC flag combined (by logical OR) with 40/80 columns flag. This is
+not the best way to check if screen has 40 or 80 columns since PAL/NTSC check is always
+performed and it can take as long as full raster frame. If you just want to know if
+screen has 40 or 80 columns use expression <tt/graphMode & 0x80/ which returns <tt/0/ for
+40 columns and <tt/0x80/ for 80 columns. Remember that this parameter can be changed during
+runtime. It is unclear if this will work for GEOS 64 so you probably do not want to test
+anything if not running under GEOS128. Use <tt/get_ostype/ to check it. Read <tt/gsys.h/ for
+definitions of returned values.
+
<sect>Library Structures
<p>
To simplify usage and optimize passing parameters to functions I have declared several structures
GEOS system functions
ported to small C on 27.10.1999
- by Maciej 'YTM/Alliance' Witkowiak
+ by Maciej 'YTM/Elysium' Witkowiak
*/
#ifndef _GSYS_H
void __fastcall__ SetDevice(char newdev);
+char __fastcall__ get_ostype(void);
+/* possible return values of get_ostype, machine and version flags will
+ be combined */
+#define GEOS64 0x00
+#define GEOS128 0x80
+#define GEOS_V10 0x10
+#define GEOS_V12 0x12 /* ??? not sure */
+#define GEOS_V20 0x20
+
+char __fastcall__ get_tv(void);
+/* possible return values of get_tv, these flags will be combined
+ note that columns state can be changed during runtime */
+#define COLUMNS40 0x00
+#define COLUMNS80 0x01
+#define TV_PAL 0x00
+#define TV_NTSC 0x80
+
#endif
--- /dev/null
+
+;
+; Maciej 'YTM/Elysium' Witkowiak
+;
+; 10.09.2001
+
+; unsigned char get_ostype (void);
+; unsigned char get_tv (void);
+
+ .export get_ostype
+ .export get_tv
+ .import tmp1
+
+ .include "../inc/geossym.inc"
+ .include "../inc/geossym2.inc"
+
+get_ostype:
+ lda version
+ and #%11110000
+ cmp #$10
+ beq geos10
+ lda c128Flag ; we're on at least 2.0
+ ora version
+ rts
+geos10:
+ lda version
+ rts
+
+get_tv:
+ jsr get_ostype
+ bpl only40 ; C64 with 40 columns only
+ lda graphMode
+ bpl only40 ; C128 but currently on 40 columns
+ ldx #1 ; COLUMNS80
+ bne tvmode
+only40: ldx #0 ; COLUMNS40
+tvmode: ; PAL/NTSC check here, result in A
+ bit rasreg
+ bpl tvmode ; wait for rasterline 127<x<256
+ lda #24 ; (rasterline now >=256!)
+modelp: cmp rasreg ; wait for rasterline = 24 (or 280 on PAL)
+ bne modelp
+ lda grcntrl1 ; 24 or 280 ?
+ bpl ntsc
+ lda #0 ; PAL
+ beq modeend
+ntsc: lda #$80 ; NTSC
+
+modeend: stx tmp1
+ ora tmp1
+ rts