From: Nicolas Welte (no_spam_at_x1541.de)
Date: 2004-09-12 23:04:35
Baltissen, GJPAA (Ruud) wrote:
> More worrying is the fact that I only can write up to 34 byte. Is the
> computer to blame or the drive? In case of CBM-HD I even didn't know what to
> do with this number; at this moment I keep on storing bytes until I get an
> EOI or an ATN. Hmmm, I can adjust my test program a bit and see what the
> effect is on a real drive: I'll write more bytes then actually planned and
> then will read back the contents.
I think M-W is to be avoided because of this limitation and because of
possible slowness (needs to interprete command buffer). I started to use
another method instead to write to buffer memory: simply open one buffer with
e.g. OPEN1,8,2,"#0" and then set the buffer pointer to byte 0 and then start
putting 256 bytes in a row into the buffer. Here is some example code from my
1541 disk drive flash programmer which uses both methods, because I started
out with a few bytes only and then expanded by a whole page. (primm works
like in C128 and outputs all bytes until it ecounters 0, then continues with
the code after the 0).
ldx #15
jsr CHKOUT
jsr primm
dc.b "M-W",$e3,4,29,0
ldx #0
nxti lda drivei,x
jsr CHROUT
inx
cpx #29
bne nxti
jsr CLRCHN
jsr openbuf
ldx #15
jsr CHKOUT
jsr primm
dc.b "B-P 2 0",0
jsr CLRCHN
lda #<drive
sta adrlo
lda #>drive
sta adrhi
ldx #2
jsr CHKOUT
ldy #0
nxt lda (adrlo),y
jsr CHROUT
iny
bne nxt
lda #2
jsr CLOSE
ldx #15
jsr CHKOUT
jsr primm
dc.b "U3",0
jsr CLRCHN
lda #15
jsr CLOSE
sec
rts
nam DC.B "$"
buf dc.b "#2"
openbuf lda #2
ldy #>buf
ldx #<buf
jsr SETNAM
lda #2
ldx device
ldy #2
jsr SETLFS
jsr OPEN
rts
opencmd lda #0
ldy #>nam
ldx #<nam
jsr SETNAM
lda #15
ldx device
ldy #15
jsr SETLFS
jsr OPEN
rts
opendir lda #1
ldy #>nam
ldx #<nam
jsr SETNAM
lda #2
ldx device
ldy #2
jsr SETLFS
jsr OPEN
ldx #2
jsr CHKIN
rts
readchr jsr CHRIN
pha
jsr READST
clc
bne enddir
pla
rts
enddir pla
sec
rts
--
-> My Commodore hardware projects and the X1541 Shop at http://x1541.de <-
Message was sent through the cbm-hackers mailing list
Archive generated by hypermail pre-2.1.8.