1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-07 07:29:33 +00:00

I wasn't aware that the unit numbers in the ProDOS device list contain device type identifiers in the low nibble. So if we can't use the device list entries as-is we can as well present the high nibble as low nibble to the user thus providing more meaningful device numbers.

git-svn-id: svn://svn.cc65.org/cc65/trunk@5852 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
ol.sc 2012-10-15 21:59:51 +00:00
parent 170c59e4c2
commit 272b8e7185
8 changed files with 125 additions and 112 deletions

View File

@ -494,10 +494,10 @@ url="ca65.html" name="assembler manual">.
to the formula to the formula
<tscreen> <tscreen>
device = slot * 0x10 + (drive - 1) * 0x80 device = slot + (drive - 1) * 8
</tscreen> </tscreen>
so that for example slot 6 drive 2 is mapped to <tt/device/ 0xE0. so that for example slot 6 drive 2 is mapped to <tt/device/ 14.
<tag/Sector count/ <tag/Sector count/
The function <htmlurl url="dio-3.html" name="dio_query_sectcount()"> returns The function <htmlurl url="dio-3.html" name="dio_query_sectcount()"> returns

View File

@ -500,10 +500,10 @@ url="ca65.html" name="assembler manual">.
to the formula to the formula
<tscreen> <tscreen>
device = slot * 0x10 + (drive - 1) * 0x80 device = slot + (drive - 1) * 8
</tscreen> </tscreen>
so that for example slot 6 drive 2 is mapped to <tt/device/ 0xE0. so that for example slot 6 drive 2 is mapped to <tt/device/ 14.
<tag/Sector count/ <tag/Sector count/
The function <htmlurl url="dio-3.html" name="dio_query_sectcount()"> returns The function <htmlurl url="dio-3.html" name="dio_query_sectcount()"> returns

View File

@ -19,7 +19,7 @@ CFLAGS = -Osir -g -T -t $(SYS) --forget-inc-paths -I . -I ../../include
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Rules # Rules
%.o: %.c %.o: %.c
@$(CC) $(CFLAGS) $< @$(CC) $(CFLAGS) $<
@$(AS) -o $@ $(AFLAGS) $(*).s @$(AS) -o $@ $(AFLAGS) $(*).s
@ -50,19 +50,19 @@ C_OBJS= closedir.o \
rewinddir.o rewinddir.o
S_OBJS= _scrsize.o \ S_OBJS= _scrsize.o \
break.o \ break.o \
cclear.o \ cclear.o \
cgetc.o \ cgetc.o \
chline.o \ chline.o \
close.o \ close.o \
clrscr.o \ clrscr.o \
color.o \ color.o \
cout.o \ cout.o \
cputc.o \ cputc.o \
crt0.o \ crt0.o \
ctype.o \ ctype.o \
cvline.o \ cvline.o \
devicedir.o \ devicedir.o \
dioclose.o \ dioclose.o \
diocommon.o \ diocommon.o \
dioopen.o \ dioopen.o \
@ -75,41 +75,42 @@ S_OBJS= _scrsize.o \
exehdr.o \ exehdr.o \
filedes.o \ filedes.o \
filename.o \ filename.o \
get_ostype.o \ get_ostype.o \
getdevice.o \ getdevice.o \
gotoxy.o \ gotoxy.o \
gotoy.o \ gotoy.o \
home.o \ home.o \
initcwd.o \ initcwd.o \
iobuf.o \ iobuf.o \
joy_stddrv.o \ isdevice.o \
kbhit.o \ joy_stddrv.o \
mainargs.o \ kbhit.o \
mainargs.o \
mcbdefault.o \ mcbdefault.o \
mli.o \ mli.o \
mouse_stddrv.o \ mouse_stddrv.o \
open.o \ open.o \
oserrlist.o \ oserrlist.o \
oserror.o \ oserror.o \
randomize.o \ randomize.o \
rdkey.o \ rdkey.o \
read.o \ read.o \
reboot.o \ reboot.o \
revers.o \ revers.o \
rwcommon.o \ rwcommon.o \
syschdir.o \ syschdir.o \
sysmkdir.o \ sysmkdir.o \
sysremove.o \ sysremove.o \
sysrename.o \ sysrename.o \
sysrmdir.o \ sysrmdir.o \
systime.o \ systime.o \
sysuname.o \ sysuname.o \
tgi_colors.o \ tgi_colors.o \
tgi_stddrv.o \ tgi_stddrv.o \
toascii.o \ toascii.o \
vtabz.o \ vtabz.o \
wherex.o \ wherex.o \
wherey.o \ wherey.o \
write.o write.o
S_EXTRA_OBJS= \ S_EXTRA_OBJS= \
@ -141,5 +142,5 @@ all: $(C_OBJS) $(S_OBJS) $(S_EXTRA_OBJS) $(EMDS) $(JOYS) $(MOUS) $(SERS) $(TGIS
clean: clean:
@$(RM) $(C_OBJS:.o=.s) $(C_OBJS) $(S_OBJS) $(S_EXTRA_OBJS) $(EMDS:.emd=.o) $(JOYS:.joy=.o) $(MOUS:.mou=.o) $(SERS:.ser=.o) $(TGIS:.tgi=.o) @$(RM) $(C_OBJS:.o=.s) $(C_OBJS) $(S_OBJS) $(S_EXTRA_OBJS) $(EMDS:.emd=.o) $(JOYS:.joy=.o) $(MOUS:.mou=.o) $(SERS:.ser=.o) $(TGIS:.tgi=.o)
zap: clean zap: clean
@$(RM) $(EMDS) $(JOYS) $(MOUS) $(SERS) $(TGIS) @$(RM) $(EMDS) $(JOYS) $(MOUS) $(SERS) $(TGIS)

View File

@ -27,13 +27,13 @@ _getdevicedir:
; Set device ; Set device
jsr popa jsr popa
asl
asl
asl
asl
sta mliparam + MLI::ON_LINE::UNIT_NUM sta mliparam + MLI::ON_LINE::UNIT_NUM
; Check for valid slot ; Check for valid slot
tax
and #$0F
bne erange
txa
and #$70 and #$70
beq erange beq erange

View File

@ -5,7 +5,7 @@
; ;
.export _dio_open .export _dio_open
.import return0, __dos_type .import return0, __dos_type, isdevice
.include "errno.inc" .include "errno.inc"
.include "mli.inc" .include "mli.inc"
@ -17,19 +17,22 @@ _dio_open:
lda #$01 ; "Bad system call number" lda #$01 ; "Bad system call number"
bne oserr ; Branch always bne oserr ; Branch always
; Walk device list ; Check for valid device
: ldx DEVCNT : tax
: cmp DEVLST,x jsr isdevice
beq :+ ; Found drive_id in device list beq :+
dex
bpl :-
lda #$28 ; "No device connected" lda #$28 ; "No device connected"
; Return oserror ; Return oserror
oserr: sta __oserror oserr: sta __oserror
jmp return0 jmp return0
; Return success ; Return success
: ldx #$00 : txa
asl
asl
asl
asl
ldx #$00
stx __oserror stx __oserror
rts rts

View File

@ -7,42 +7,28 @@
.export _getfirstdevice .export _getfirstdevice
.export _getnextdevice .export _getnextdevice
.import __dos_type, isdevice
.import __dos_type
.include "zeropage.inc" .include "zeropage.inc"
.include "mli.inc"
_getfirstdevice: _getfirstdevice:
lda #$FF lda #$FF
; Fall through ; Fall through
_getnextdevice: _getnextdevice:
next: tax tax
inx next: inx
txa cpx #$FF
cmp #$FF
beq done beq done
; Check for ProDOS 8 ; Check for ProDOS 8
ldx __dos_type lda __dos_type
beq next beq next
; Up to 14 units may be active ; Check for valid device
ldx #<DEVLST jsr isdevice
ldy #>DEVLST bne next
stx ptr1
sty ptr1+1
; Number of on-line devices (minus 1) done: txa
ldy DEVCNT ldx #$00
; Does the list contain the device?
: cmp (ptr1),y
beq done
dey
bpl :-
bmi next ; Branch always
done: ldx #$00
rts rts

22
libsrc/apple2/isdevice.s Normal file
View File

@ -0,0 +1,22 @@
;
; Oliver Schmidt, 2012-10-15
;
.export isdevice
.include "zeropage.inc"
.include "mli.inc"
isdevice:
ldy DEVCNT
: lda DEVLST,y
lsr
lsr
lsr
lsr
sta tmp1
cpx tmp1
beq :+
dey
bpl :-
: rts

View File

@ -19,7 +19,7 @@ CFLAGS = -Osir -g -T -t $(SYS) --forget-inc-paths -I ../apple2 -I ../../include
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Rules # Rules
%.o: ../apple2/%.c %.o: ../apple2/%.c
@$(CC) -o $(notdir $(*).s) $(CFLAGS) $< @$(CC) -o $(notdir $(*).s) $(CFLAGS) $<
@$(AS) -o $@ $(AFLAGS) $(*).s @$(AS) -o $@ $(AFLAGS) $(*).s
@ -53,19 +53,19 @@ C_OBJS= closedir.o \
rewinddir.o rewinddir.o
S_OBJS= _scrsize.o \ S_OBJS= _scrsize.o \
break.o \ break.o \
cclear.o \ cclear.o \
cgetc.o \ cgetc.o \
chline.o \ chline.o \
close.o \ close.o \
clrscr.o \ clrscr.o \
color.o \ color.o \
cout.o \ cout.o \
cputc.o \ cputc.o \
crt0.o \ crt0.o \
ctype.o \ ctype.o \
cvline.o \ cvline.o \
devicedir.o \ devicedir.o \
dioclose.o \ dioclose.o \
diocommon.o \ diocommon.o \
dioopen.o \ dioopen.o \
@ -78,43 +78,44 @@ S_OBJS= _scrsize.o \
exehdr.o \ exehdr.o \
filedes.o \ filedes.o \
filename.o \ filename.o \
get_ostype.o \ get_ostype.o \
getdevice.o \ getdevice.o \
gotoxy.o \ gotoxy.o \
gotoy.o \ gotoy.o \
home.o \ home.o \
initcwd.o \ initcwd.o \
iobuf.o \ iobuf.o \
joy_stddrv.o \ isdevice.o \
kbhit.o \ joy_stddrv.o \
mainargs.o \ kbhit.o \
mainargs.o \
mcbdefault.o \ mcbdefault.o \
mli.o \ mli.o \
mouse_stddrv.o \ mouse_stddrv.o \
open.o \ open.o \
oserrlist.o \ oserrlist.o \
oserror.o \ oserror.o \
randomize.o \ randomize.o \
rdkey.o \ rdkey.o \
read.o \ read.o \
reboot.o \ reboot.o \
revers.o \ revers.o \
rwcommon.o \ rwcommon.o \
syschdir.o \ syschdir.o \
sysmkdir.o \ sysmkdir.o \
sysremove.o \ sysremove.o \
sysrename.o \ sysrename.o \
sysrmdir.o \ sysrmdir.o \
systime.o \ systime.o \
sysuname.o \ sysuname.o \
textframe.o \ textframe.o \
tgi_colors.o \ tgi_colors.o \
tgi_stddrv.o \ tgi_stddrv.o \
toascii.o \ toascii.o \
videomode.o \ videomode.o \
vtabz.o \ vtabz.o \
wherex.o \ wherex.o \
wherey.o \ wherey.o \
write.o write.o
S_EXTRA_OBJS= \ S_EXTRA_OBJS= \
@ -146,5 +147,5 @@ all: $(C_OBJS) $(S_OBJS) $(S_EXTRA_OBJS) $(EMDS) $(JOYS) $(MOUS) $(SERS) $(TGIS
clean: clean:
@$(RM) $(C_OBJS:.o=.s) $(C_OBJS) $(S_OBJS) $(S_EXTRA_OBJS) $(EMDS:.emd=.o) $(JOYS:.joy=.o) $(MOUS:.mou=.o) $(SERS:.ser=.o) $(TGIS:.tgi=.o) @$(RM) $(C_OBJS:.o=.s) $(C_OBJS) $(S_OBJS) $(S_EXTRA_OBJS) $(EMDS:.emd=.o) $(JOYS:.joy=.o) $(MOUS:.mou=.o) $(SERS:.ser=.o) $(TGIS:.tgi=.o)
zap: clean zap: clean
@$(RM) $(EMDS) $(JOYS) $(MOUS) $(SERS) $(TGIS) @$(RM) $(EMDS) $(JOYS) $(MOUS) $(SERS) $(TGIS)