From 8b6a40c04e0a5fefacd3a4351101b239a1c4e8b6 Mon Sep 17 00:00:00 2001 From: uz Date: Sat, 27 Feb 2010 14:46:43 +0000 Subject: [PATCH] Patch by Marco van den Heuvel that adds detection of GEOS 1.1 and the plus4 GEOS to the get_ostype function. git-svn-id: svn://svn.cc65.org/cc65/trunk@4600 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- include/geos/gsys.h | 4 +++- libsrc/geos/system/get_ostype.s | 38 ++++++++++++++++++++++++++++----- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/include/geos/gsys.h b/include/geos/gsys.h index ff150191d..493c2609f 100644 --- a/include/geos/gsys.h +++ b/include/geos/gsys.h @@ -28,10 +28,12 @@ char get_ostype(void); be combined with OR */ /* machine flags */ #define GEOS64 0x00 +#define GEOS4 0x04 /* plus4 geos is not or'ed with version */ #define GEOS128 0x80 /* version flags */ #define GEOS_V10 0x10 -#define GEOS_V12 0x12 /* ??? not sure */ +#define GEOS_V11 0x11 +#define GEOS_V12 0x12 /* ??? not sure */ #define GEOS_V20 0x20 #define WHEELS 0x40 /* only Wheels? */ diff --git a/libsrc/geos/system/get_ostype.s b/libsrc/geos/system/get_ostype.s index ea6801e5c..342b16c6b 100644 --- a/libsrc/geos/system/get_ostype.s +++ b/libsrc/geos/system/get_ostype.s @@ -1,8 +1,12 @@ - + ; ; Maciej 'YTM/Elysium' Witkowiak ; ; 10.09.2001 +; +; Plus4 and GEOS 1.1 detection by +; Marco van den Heuvel, 2010-02-02 +; ; unsigned char get_ostype (void); ; unsigned char get_tv (void); @@ -18,18 +22,30 @@ _get_ostype: ldx #0 lda version + cmp #$a9 + beq geos11 and #%11110000 cmp #$10 beq geos10 lda c128Flag ; we're on at least 2.0 + cmp #$18 + beq geos_on_plus4 ora version rts geos10: lda version rts +geos11: + lda #$11 + rts +geos_on_plus4: + lda #$04 + rts _get_tv: jsr _get_ostype + cmp #$04 + beq plus4_get_tv bpl only40 ; C64 with 40 columns only lda graphMode bpl only40 ; C128 but currently on 40 columns @@ -43,18 +59,21 @@ tvmode: ; PAL/NTSC check here, result in A pha lda #IO_IN ; enable access to I/O sta CPU_DATA - bit rasreg + bit rasreg bpl tvmode ; wait for rasterline 127=256!) -modelp: cmp rasreg ; wait for rasterline = 24 (or 280 on PAL) +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 +ntsc: + lda #$80 ; NTSC -modeend: stx tmp1 +modeend: + stx tmp1 ora tmp1 sta tmp1 ldx #0 @@ -63,3 +82,12 @@ modeend: stx tmp1 plp ; restore interrupt state lda tmp1 rts +plus4_get_tv: + ldx #1 ; Assume PAL + bit $FF07 ; Test bit 6 + bvc plus4pal + dex ; NTSC +plus4pal: + txa + ldx #0 + rts -- 2.39.2