Re: Strange C128 & REU behavior

From: Niklas Ramsberg (niklas.ramsberg_at_swipnet.se)
Date: 2004-02-09 21:48:32

OK, here are the two code examples (in Buddy128 format). This is how I 
would like to do it:

;------------------------------
* = $0b00
.obj "@:test2"
.dis

   cld
   lda #$00  ;Set slow mode
   sta $d030

   lda #$01  ;Set flag
   sta temp3

   lda $d506 ;Preserve RAM config
   sta temp1

   ;Transfer RAM0
   lda temp1
   and #$3f  ;Clear bits 6 & 7 (RAM0)
   sta $d506

   lda #$02  ;Set bank 2
   sta temp2
   lda #$00  ;Set system bank 0
   sta temp4

- lda #$00  ;Start at base addr $0000
   sta $df02
   lda #$00
   sta $df03

   lda #$00  ;Store at base addr $0000
   sta $df04
   lda #$00
   sta $df05

   lda temp2 ;RAM bank
   sta $df06

   lda #$00  ;Increment both addresses
   sta $df0a

   lda #$00 ;Transfer $ffff bytes
   sta $df08
   lda #$ff
   sta $df09

   ldx temp4 ;Bank
   ldy #$80  ;Stash now
   jsr $ff50

   lda temp1 ;Restore config
   sta $d506

   lda temp3 ;Check flag
   beq +

   ;Transfer RAM1
   lda #$00  ;Clear flag
   sta temp3

   lda $d506
   sta temp1
   ora #$7f  ;Set bit 6 (RAM1)
   sta $d506
   lda #$03
   sta temp2
   lda #$01
   sta temp4
   jmp -

+ rts
;------------------------------


This is what I have had to resort to:



;------------------------------
* = $0b00
.obj "@:test"
.dis

   cld
   lda #$00  ;Set slow mode
   sta $d030

   lda #$01  ;Set flag
   sta temp3

   lda $d506 ;Preserve RAM config
   sta temp1

   ;Transfer RAM0
   lda temp1
   and #$3f  ;Clear bits 6 & 7 (RAM0)
   sta $d506

   lda #$02  ;Set bank 2
   sta temp2
   lda #$00  ;Set system bank 0
   sta temp4

- lda #$00  ;Start at base addr $0000
   sta $df02
   lda #$00
   sta $df03

   lda #$00  ;Store at base addr $0000
   sta $df04
   lda #$00
   sta $df05

   lda temp2 ;RAM bank
   sta $df06

   lda #$00  ;Increment both addresses
   sta $df0a

- lda #$00 ;Transfer $0100 bytes
   sta $df08
   lda #$01
   sta $df09

   ldx temp4 ;Bank
   ldy #$80  ;Stash now
   jsr $ff50

   clc
   lda $df03
   adc #$01
   bcs +
   sta $df03 ;Transfer $100 bytes at a time until all memory has
   sta $df05 ;been transferred
   jmp -

+ lda temp1 ;Restore config
   sta $d506

   lda temp3 ;Check flag
   beq +

   ;Transfer RAM1
   lda #$00  ;Clear flag
   sta temp3

   lda $d506
   sta temp1
   ora #$7f  ;Set bit 6 (RAM1)
   sta $d506
   lda #$03
   sta temp2
   lda #$01
   sta temp4
   jmp --

+ rts
;------------------------------

/Niklas Ramsberg
aka
< .
     (:)  Bacon
< .

       Message was sent through the cbm-hackers mailing list

Archive generated by hypermail pre-2.1.8.