Merge pull request #604 from blackystardust/master
Improved reu size detection.
This commit is contained in:
@@ -221,10 +221,8 @@ missing on VDC, and are translated to the two colors missing from the VIC palett
|
|||||||
Will test the hardware for the available RAM.
|
Will test the hardware for the available RAM.
|
||||||
|
|
||||||
<tag><tt/c128-reu.emd (c128_reu_emd)/</tag>
|
<tag><tt/c128-reu.emd (c128_reu_emd)/</tag>
|
||||||
A driver for the CBM REUs. The driver will determine from the connected REU
|
A driver for the CBM REUs. The driver will test the connected REU to find
|
||||||
if it supports 128KB of RAM or more. In the latter case, 256KB are assumed,
|
out how much RAM is present.
|
||||||
but since there are no range checks, the application can use more memory if
|
|
||||||
it has better knowledge about the hardware than the driver.
|
|
||||||
|
|
||||||
<tag><tt/c128-vdc.emd (c128_vdc_emd)/</tag>
|
<tag><tt/c128-vdc.emd (c128_vdc_emd)/</tag>
|
||||||
A driver for the VDC memory of the C128, written and contributed by Maciej
|
A driver for the VDC memory of the C128, written and contributed by Maciej
|
||||||
|
|||||||
@@ -300,10 +300,8 @@ Note that the graphics drivers are incompatible with the
|
|||||||
Will test the hardware for the available RAM.
|
Will test the hardware for the available RAM.
|
||||||
|
|
||||||
<tag><tt/c64-reu.emd (c64_reu_emd)/</tag>
|
<tag><tt/c64-reu.emd (c64_reu_emd)/</tag>
|
||||||
A driver for the CBM REUs. The driver will determine from the connected REU
|
A driver for the CBM REUs. The driver will test the connected REU to find
|
||||||
if it supports 128KB of RAM or more. In the latter case, 256KB are assumed,
|
out how much RAM is present.
|
||||||
but since there are no range checks, the application can use more memory if
|
|
||||||
it has better knowledge about the hardware than the driver.
|
|
||||||
|
|
||||||
<tag><tt/c64-vdc.emd (c64_vdc_emd)/</tag>
|
<tag><tt/c64-vdc.emd (c64_vdc_emd)/</tag>
|
||||||
A driver for the VDC memory of the C128. Written and contributed by Maciej
|
A driver for the VDC memory of the C128. Written and contributed by Maciej
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ REU_TRIGGER = $FF00 ; REU command trigger
|
|||||||
OP_COPYFROM = $ED
|
OP_COPYFROM = $ED
|
||||||
OP_COPYTO = $EC
|
OP_COPYTO = $EC
|
||||||
|
|
||||||
|
OP_COPYFROM_ALOAD = $B1
|
||||||
|
OP_COPYTO_ALOAD = $B0
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; Data.
|
; Data.
|
||||||
@@ -92,17 +94,56 @@ INSTALL:
|
|||||||
cmp REU_REUADDR ; Check for presence of REU
|
cmp REU_REUADDR ; Check for presence of REU
|
||||||
bne nodevice
|
bne nodevice
|
||||||
|
|
||||||
ldy #>(128*4) ; Assume 128KB
|
; determine the size
|
||||||
lda REU_STATUS
|
php
|
||||||
and #$10 ; Check size bit
|
sei
|
||||||
beq @L1
|
|
||||||
ldy #>(256*4) ; 256KB when size bit is set
|
|
||||||
@L1: sty pagecount+1
|
|
||||||
|
|
||||||
ldy #$FF
|
ldy #$FF
|
||||||
sty curpage
|
loop:
|
||||||
sty curpage+1 ; Invalidate the current page
|
sty window
|
||||||
txa ; X = A = EM_ERR_OK
|
jsr reu_size_check_common
|
||||||
|
ldx #OP_COPYTO_ALOAD
|
||||||
|
stx REU_COMMAND
|
||||||
|
dey
|
||||||
|
cpy #$FF
|
||||||
|
bne loop
|
||||||
|
iny
|
||||||
|
size_loop:
|
||||||
|
jsr reu_size_check_common
|
||||||
|
ldx #OP_COPYFROM_ALOAD
|
||||||
|
stx REU_COMMAND
|
||||||
|
cpy window
|
||||||
|
bne size_found
|
||||||
|
iny
|
||||||
|
bne size_loop
|
||||||
|
size_found:
|
||||||
|
plp
|
||||||
|
ldx #$00
|
||||||
|
cpy #$00 ; too many pages, shave off 2
|
||||||
|
bne pagecount_ok
|
||||||
|
dex
|
||||||
|
dex
|
||||||
|
dey
|
||||||
|
pagecount_ok:
|
||||||
|
stx pagecount
|
||||||
|
sty pagecount+1
|
||||||
|
lda #<EM_ERR_OK
|
||||||
|
ldx #>EM_ERR_OK
|
||||||
|
rts
|
||||||
|
|
||||||
|
; common REU setup for size check
|
||||||
|
reu_size_check_common:
|
||||||
|
sty REU_REUADDR+2
|
||||||
|
ldx #<window
|
||||||
|
stx REU_C64ADDR
|
||||||
|
ldx #>window
|
||||||
|
stx REU_C64ADDR+1
|
||||||
|
ldx #$00
|
||||||
|
stx REU_REUADDR
|
||||||
|
stx REU_REUADDR+1
|
||||||
|
stx REU_COUNT+1
|
||||||
|
stx REU_CONTROL
|
||||||
|
inx
|
||||||
|
stx REU_COUNT
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; No REU found
|
; No REU found
|
||||||
|
|||||||
@@ -55,6 +55,9 @@ REU_TRIGGER = $FF00 ; REU command trigger
|
|||||||
OP_COPYFROM = $ED
|
OP_COPYFROM = $ED
|
||||||
OP_COPYTO = $EC
|
OP_COPYTO = $EC
|
||||||
|
|
||||||
|
OP_COPYFROM_ALOAD = $B1
|
||||||
|
OP_COPYTO_ALOAD = $B0
|
||||||
|
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; Data.
|
; Data.
|
||||||
@@ -92,19 +95,59 @@ INSTALL:
|
|||||||
cmp REU_REUADDR ; Check for presence of REU
|
cmp REU_REUADDR ; Check for presence of REU
|
||||||
bne nodevice
|
bne nodevice
|
||||||
|
|
||||||
ldy #>(128*4) ; Assume 128KB
|
; determine the size
|
||||||
lda REU_STATUS
|
php
|
||||||
and #$10 ; Check size bit
|
sei
|
||||||
beq @L1
|
|
||||||
ldy #>(256*4) ; 256KB when size bit is set
|
|
||||||
@L1: sty pagecount+1
|
|
||||||
|
|
||||||
ldy #$FF
|
ldy #$FF
|
||||||
sty curpage
|
loop:
|
||||||
sty curpage+1 ; Invalidate the current page
|
sty window
|
||||||
txa ; X = A = EM_ERR_OK
|
jsr reu_size_check_common
|
||||||
|
ldx #OP_COPYTO_ALOAD
|
||||||
|
stx REU_COMMAND
|
||||||
|
dey
|
||||||
|
cpy #$FF
|
||||||
|
bne loop
|
||||||
|
iny
|
||||||
|
size_loop:
|
||||||
|
jsr reu_size_check_common
|
||||||
|
ldx #OP_COPYFROM_ALOAD
|
||||||
|
stx REU_COMMAND
|
||||||
|
cpy window
|
||||||
|
bne size_found
|
||||||
|
iny
|
||||||
|
bne size_loop
|
||||||
|
size_found:
|
||||||
|
plp
|
||||||
|
ldx #$00
|
||||||
|
cpy #$00 ; too many pages, shave off 2
|
||||||
|
bne pagecount_ok
|
||||||
|
dex
|
||||||
|
dex
|
||||||
|
dey
|
||||||
|
pagecount_ok:
|
||||||
|
stx pagecount
|
||||||
|
sty pagecount+1
|
||||||
|
lda #<EM_ERR_OK
|
||||||
|
ldx #>EM_ERR_OK
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
; common REU setup for size check
|
||||||
|
reu_size_check_common:
|
||||||
|
sty REU_REUADDR+2
|
||||||
|
ldx #<window
|
||||||
|
stx REU_C64ADDR
|
||||||
|
ldx #>window
|
||||||
|
stx REU_C64ADDR+1
|
||||||
|
ldx #$00
|
||||||
|
stx REU_REUADDR
|
||||||
|
stx REU_REUADDR+1
|
||||||
|
stx REU_COUNT+1
|
||||||
|
stx REU_CONTROL
|
||||||
|
inx
|
||||||
|
stx REU_COUNT
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
; No REU found
|
; No REU found
|
||||||
|
|
||||||
nodevice:
|
nodevice:
|
||||||
|
|||||||
Reference in New Issue
Block a user