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:
izydorst
2001-09-10 21:43:15 +00:00
parent 1da6f339dc
commit 490e3b8c0f
6 changed files with 103 additions and 12 deletions

View File

@@ -38,6 +38,7 @@
ldy #diopp_head
lda (ptr2),y
bne _inv_data ; there is only head 0
ldy #diopp_track
lda (ptr2),y
@@ -53,7 +54,7 @@
iny
lda (ptr2),y
bne _inv_data ; there are no more than 256 sectors
; tmp1 (int) holds track+sector, translate it using device info
ldy #sst_driveno
@@ -67,7 +68,7 @@
beq dio_cts1571
cmp #DRV_1581
beq dio_cts1581
; unknown device, return what you have got
dio_ctsend:

View File

@@ -29,7 +29,8 @@ sectsizetab:
pha
tax
lda driveType,x ; check if there's a device
bne _inv_drive
beq _inv_drive
txa
clc
adc #8 ; normalize devnum
sta curDevice

View File

@@ -9,7 +9,7 @@
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)

View 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