home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Crawly Crypt Collection 1
/
crawlyvol1.bin
/
program
/
compiler
/
nasm20b
/
libinc
/
demo
/
readboot.s65
< prev
next >
Wrap
Text File
|
1984-11-21
|
2KB
|
88 lines
.include #system
.include #macros
.include #cio
.include #os
.include #16bit
maxsecs = 16
:more = @special + @s2 + @p1 + @p2 + @p3 ; len will be ignored
;; This is more or less an example, not written for beauty or
;; anything. Maybe you can pick up some ideas about using STDIO
;; This little ditty was actually put to use, to get some gamedisks
;; working on the XL
main:
print 0,"SD boot sector reader -- 1991 Natürlich!"
print 0,"Input diskette in drive 1",0,:more ; same IOCB chan.
print 0,"Press פדקרפמ to continue",0,:more ; so we can use
getc 0,@special ; @special to save
print 0,"Reading boot sectors",0,:more ; some bytes
readsector 1,1,buffer ; read first sector
bpl :ok1
jmp :failure
:ok1
lda buffer+1 ; get number of sectors to
bne :cool
jmp :invalid
:cool
cmp #maxsecs+1 ; can we read that many
bcc :fits
jmp :toomuch
:fits
sta size+1
sbc #0 ; minus one
beq :fine
tay
SETUP_SIO 1,SIOREAD,2,buffer+128
jsr sd_secs
bpl :fine
jmp :failure
:fine
lsr.w size
bput 0,prompt,filename-prompt,@p1+@p2+@p3
input 0,filename,buffer-filename,@p1+@p2+@p3+@special
open 1,8,0,filename,@p1+@p2+@p3+@p4
bmi :noopen
bput 1,buffer,size,@special+@p1+@p2
php
close 1,@special+@p1
plp
bpl :ok
jsr :diskfull
jmp :fine
:ok
print 0,"Done"
rts
:failure:
print 0,"Couldn't read sectors"
rts
:noopen:
print 0,"Couldn't open output file"
rts
:diskfull:
print 0,"Disk full ? Retry with another..."
rts
:toomuch
print 0,"Too many sectors in that boot segment"
rts
:invalid
print 0,"That bootsector is unusable"
rts
size: .word 0
prompt: .byte "Output file name: "
filename: .ds 128
buffer: .ds 128*maxsecs