Re: 17xx Routine Help

From: Greg King <greg.king5_at_verizon.net>
Date: Wed, 12 Oct 2016 12:33:14 -0400
Message-id: <b7dd957f-cc47-bb54-ce71-0091556374a5@verizon.net>
On 2016-10-11 11:57 PM, Nick Vivid wrote:
> Hey guys, having some trouble with an REM routine for the C64. The idea
> is that the routine writes and reads one byte at a time. I jsr to the
> read and write routines as I need them.
>
> I'm seeing only the checkered #$ff character for every character read
> back from the REM. Not sure if my problem is in my write or read. Though,
> the write looks like it's successfully taking place. But, I'm not sure.
>
> Is there anything I'm obviously doing wrong in this routine?
> I use the following temp bytes:
>
> cdfe - temp byte to reu
> cdff - temp byte from reu
>
> bufptr = $b0 (and $b1) write to reu pointer
> buffst = $b2 (and $b3) read from reu pointer
>
> ;read/write to from reu
>
> bank     = $00;using first bank only
> length   = $01;one byte at a time
>
> reuwrite
>          pha
>          lda #$fe
>          sta $df02
>          lda #$cd
>          sta $df03
>          lda bufptr
>          sta $df04
>          lda bufptr+1
>          sta $df05
>          lda bank
>          sta $df06
>          lda #<length
>          sta $df07
>          lda #>length
>          sta $df08
>          lda #0
>          sta $df0a
> c64toreu
>          lda #$b0
>          sta $df01
>          pla
>          rts
>
> reuread  pha
>          lda #$ff
>          sta $df02
>          lda #$cd
>          sta $df03
>          lda buffst
>          sta $df04
>          lda buffst+1
>          sta $df05
>          lda bank
>          sta $df06
>          lda #<length
>          sta $df07
>          lda #>length
>          sta $df08
>          lda #0
>          sta $df0a
> reutoc64 lda #$b1
>          sta $fd01
>          pla
>          rts

Also, your code loads "bank" as a variable; but, it's like "length": an 
immediate constant.

       Message was sent through the cbm-hackers mailing list
Received on 2016-10-12 18:00:02

Archive generated by hypermail 2.2.0.