dio bugfix, added get_tv and get_ostype functions
git-svn-id: svn://svn.cc65.org/cc65/trunk@889 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -537,7 +537,8 @@ description of bits in return values - they describe the position in detail.
|
|||||||
<sect2>Sprites
|
<sect2>Sprites
|
||||||
<p>
|
<p>
|
||||||
You are free to use any of the eight sprites, but keep in mind that sprite 0 is actually the mouse
|
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
|
<sect3>DrawSprite
|
||||||
<p>
|
<p>
|
||||||
@@ -578,7 +579,7 @@ range 1-48.
|
|||||||
<p>
|
<p>
|
||||||
<tt/void PromptOff (void)/
|
<tt/void PromptOff (void)/
|
||||||
<p>
|
<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.
|
The second one is pretty self-explanatory.
|
||||||
|
|
||||||
<sect3>GetNextChar
|
<sect3>GetNextChar
|
||||||
@@ -616,7 +617,7 @@ These functions are taking single data sector (256 bytes) to read or write on a
|
|||||||
<p>
|
<p>
|
||||||
<tt/char WriteBuff (struct tr_se *myTrSe)/
|
<tt/char WriteBuff (struct tr_se *myTrSe)/
|
||||||
<p>
|
<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
|
<sect3>GetBlock and ReadBlock
|
||||||
<p>
|
<p>
|
||||||
@@ -694,7 +695,7 @@ In fact, this function could be used in a following way:
|
|||||||
<tscreen><verb>
|
<tscreen><verb>
|
||||||
#define BlockInUse FindBAMBit
|
#define BlockInUse FindBAMBit
|
||||||
...
|
...
|
||||||
if (!SectInUse(&myTrSe)) {
|
if (!BlockInUse(&myTrSe)) {
|
||||||
... block not allocated ...
|
... block not allocated ...
|
||||||
}
|
}
|
||||||
</verb></tscreen>
|
</verb></tscreen>
|
||||||
@@ -927,7 +928,7 @@ E.g. size of whole VLIR file can be retrieved by reading <tt/VLIRInfo.fileSize/.
|
|||||||
<p>
|
<p>
|
||||||
<tt/char OpenRecordFile (char *fName)/
|
<tt/char OpenRecordFile (char *fName)/
|
||||||
<p>
|
<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
|
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.
|
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.
|
You should <tt/PointRecord/ before trying to do something with file.
|
||||||
@@ -942,8 +943,8 @@ This function calls <tt/UpdateRecordFile/ and clears internal GEOS variables.
|
|||||||
<p>
|
<p>
|
||||||
<tt/char UpdateRecordFile (void)/
|
<tt/char UpdateRecordFile (void)/
|
||||||
<p>
|
<p>
|
||||||
This function fill check <tt/VLIRInfo.fileWritten/ flag and if it is set, then <tt/curDirHead/ will
|
This function will check <tt/VLIRInfo.fileWritten/ flag and if it is set, then <tt/curDirHead/ is
|
||||||
be updated along with size and date stamps in directory entry.
|
updated along with size and date stamps in directory entry.
|
||||||
|
|
||||||
<sect3>PointRecord
|
<sect3>PointRecord
|
||||||
<p>
|
<p>
|
||||||
@@ -1234,6 +1235,26 @@ This function sets current device to given. It might be used together with <tt/I
|
|||||||
<tt/DoneWithIO/ and some Kernal routines. Unless new device is a disk drive this only sets
|
<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.
|
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
|
<sect>Library Structures
|
||||||
<p>
|
<p>
|
||||||
To simplify usage and optimize passing parameters to functions I have declared several structures
|
To simplify usage and optimize passing parameters to functions I have declared several structures
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
GEOS system functions
|
GEOS system functions
|
||||||
|
|
||||||
ported to small C on 27.10.1999
|
ported to small C on 27.10.1999
|
||||||
by Maciej 'YTM/Alliance' Witkowiak
|
by Maciej 'YTM/Elysium' Witkowiak
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _GSYS_H
|
#ifndef _GSYS_H
|
||||||
@@ -23,4 +23,21 @@ char __fastcall__ GetRandom(void);
|
|||||||
|
|
||||||
void __fastcall__ SetDevice(char newdev);
|
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
|
#endif
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
|
|
||||||
ldy #diopp_head
|
ldy #diopp_head
|
||||||
|
lda (ptr2),y
|
||||||
bne _inv_data ; there is only head 0
|
bne _inv_data ; there is only head 0
|
||||||
ldy #diopp_track
|
ldy #diopp_track
|
||||||
lda (ptr2),y
|
lda (ptr2),y
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ sectsizetab:
|
|||||||
pha
|
pha
|
||||||
tax
|
tax
|
||||||
lda driveType,x ; check if there's a device
|
lda driveType,x ; check if there's a device
|
||||||
bne _inv_drive
|
beq _inv_drive
|
||||||
|
txa
|
||||||
clc
|
clc
|
||||||
adc #8 ; normalize devnum
|
adc #8 ; normalize devnum
|
||||||
sta curDevice
|
sta curDevice
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
|
|
||||||
S_OBJS = callroutine.o enterdesktop.o firstinit.o getrandom.o getserialnumber.o\
|
S_OBJS = callroutine.o enterdesktop.o firstinit.o getrandom.o getserialnumber.o\
|
||||||
initdoneio.o mainloop.o panic.o tobasic.o setdevice.o
|
initdoneio.o mainloop.o panic.o tobasic.o setdevice.o get_ostype.o
|
||||||
|
|
||||||
all: $(S_OBJS)
|
all: $(S_OBJS)
|
||||||
|
|
||||||
|
|||||||
51
libsrc/geos/system/get_ostype.s
Normal file
51
libsrc/geos/system/get_ostype.s
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
|
||||||
|
;
|
||||||
|
; 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
|
||||||
Reference in New Issue
Block a user