Removed (pretty inconsistently used) tab chars from source code base.

This commit is contained in:
Oliver Schmidt
2013-05-09 13:56:54 +02:00
parent 44fd1082ae
commit 85885001b1
1773 changed files with 62864 additions and 62868 deletions

View File

@@ -3,13 +3,13 @@
; Marco van den Heuvel, 2010-01-27
;
.include "zeropage.inc"
.include "zeropage.inc"
.include "em-kernel.inc"
.include "em-error.inc"
.include "em-kernel.inc"
.include "em-error.inc"
.macpack generic
.macpack generic
; ------------------------------------------------------------------------
@@ -19,19 +19,19 @@
; Driver signature
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
; Jump table.
.word INSTALL
.word UNINSTALL
.word PAGECOUNT
.word MAP
.word USE
.word COMMIT
.word COPYFROM
.word COPYTO
.word INSTALL
.word UNINSTALL
.word PAGECOUNT
.word MAP
.word USE
.word COMMIT
.word COPYFROM
.word COPYTO
; ------------------------------------------------------------------------
; Constants
@@ -96,13 +96,13 @@ done: stx $01
.bss
curpage: .res 2 ; Current page number
curbank: .res 1 ; Current bank
window: .res 256 ; Memory "window"
curpage: .res 2 ; Current page number
curbank: .res 1 ; Current bank
window: .res 256 ; Memory "window"
; Since the functions above are copied to $200, the current contents of this
; memory area must be saved into backup storage. Allocate enough space.
backup: .res .max (.sizeof (copy), .sizeof (check))
backup: .res .max (.sizeof (copy), .sizeof (check))
@@ -115,52 +115,52 @@ backup: .res .max (.sizeof (copy), .sizeof (check))
;
INSTALL:
lda PIA+1 ; Select Peripheral Registers
ora #4
sta PIA+1
lda PIA+1 ; Select Peripheral Registers
ora #4
sta PIA+1
tax
lda PIA+3
ora #4
sta PIA+3
lda PIA+3
ora #4
sta PIA+3
tay
lda #$DC ; Set the default memory bank data
sta PIA
lda #$FE
sta PIA+2
lda #$DC ; Set the default memory bank data
sta PIA
lda #$FE
sta PIA+2
txa ; Select Data Direction Registers
and #$FB
sta PIA+1
txa ; Select Data Direction Registers
and #$FB
sta PIA+1
tya
and #$FB
sta PIA+3
and #$FB
sta PIA+3
lda #$FF ; Set the ports to output
sta PIA
sta PIA+2
lda #$FF ; Set the ports to output
sta PIA
sta PIA+2
txa
and #$C7
ora #$30 ; Set CA1 and
sta PIA+1 ; select Peripheral Registers
sty PIA+3
and #$C7
ora #$30 ; Set CA1 and
sta PIA+1 ; select Peripheral Registers
sty PIA+3
jsr backup_and_setup_check_routine
jsr check::entry
jsr backup_and_setup_check_routine
jsr check::entry
cli
ldx #.sizeof (check) - 1
jsr restore_data
cpy #$01
beq @present
lda #<EM_ERR_NO_DEVICE
ldx #>EM_ERR_NO_DEVICE
ldx #.sizeof (check) - 1
jsr restore_data
cpy #$01
beq @present
lda #<EM_ERR_NO_DEVICE
ldx #>EM_ERR_NO_DEVICE
rts
@present:
lda #<EM_ERR_OK
ldx #>EM_ERR_OK
; rts ; Run into UNINSTALL instead
lda #<EM_ERR_OK
ldx #>EM_ERR_OK
; rts ; Run into UNINSTALL instead
; ------------------------------------------------------------------------
; UNINSTALL routine. Is called before the driver is removed from memory.
@@ -176,8 +176,8 @@ UNINSTALL:
;
PAGECOUNT:
lda #<PAGES
ldx #>PAGES
lda #<PAGES
ldx #>PAGES
rts
; ------------------------------------------------------------------------
@@ -188,41 +188,41 @@ PAGECOUNT:
MAP:
sei
sta curpage ; Remember the new page
stx curpage+1
jsr adjust_page_and_bank
stx curbank
sta curpage ; Remember the new page
stx curpage+1
jsr adjust_page_and_bank
stx curbank
clc
adc #>BASE
sta ptr1+1
ldy #0
sty ptr1
jsr backup_and_setup_copy_routine
ldx #<ptr1
adc #>BASE
sta ptr1+1
ldy #0
sty ptr1
jsr backup_and_setup_copy_routine
ldx #<ptr1
stx copy::address
@L1:
ldx curbank
jsr copy::entry
ldx ptr1
sta window,x
inc ptr1
bne @L1
ldx curbank
jsr copy::entry
ldx ptr1
sta window,x
inc ptr1
bne @L1
; Return the memory window
jsr restore_copy_routine
lda #<window
ldx #>window ; Return the window address
jsr restore_copy_routine
lda #<window
ldx #>window ; Return the window address
cli
rts
; ------------------------------------------------------------------------
; USE: Tell the driver that the window is now associated with a given page.
USE: sta curpage ; Remember the page
stx curpage+1
lda #<window
ldx #>window ; Return the window
USE: sta curpage ; Remember the page
stx curpage+1
lda #<window
ldx #>window ; Return the window
rts
; ------------------------------------------------------------------------
@@ -230,32 +230,32 @@ USE: sta curpage ; Remember the page
COMMIT:
sei
lda curpage ; Get the current page
ldx curpage+1
lda curpage ; Get the current page
ldx curpage+1
jsr adjust_page_and_bank
stx curbank
jsr adjust_page_and_bank
stx curbank
clc
adc #>BASE
sta ptr1+1
ldy #0
sty ptr1
jsr backup_and_setup_copy_routine
ldx #<ptr1
adc #>BASE
sta ptr1+1
ldy #0
sty ptr1
jsr backup_and_setup_copy_routine
ldx #<ptr1
stx copy::address
ldx #<copy::stashop
stx copy::operation
ldx #<copy::stashop
stx copy::operation
@L1:
ldx ptr1
lda window,x
ldx curbank
jsr copy::entry
inc ptr1
bne @L1
ldx ptr1
lda window,x
ldx curbank
jsr copy::entry
inc ptr1
bne @L1
; Return the memory window
jsr restore_copy_routine
jsr restore_copy_routine
done:
cli
rts
@@ -269,8 +269,8 @@ done:
COPYFROM:
sei
jsr setup
jsr backup_and_setup_copy_routine
jsr setup
jsr backup_and_setup_copy_routine
; Setup is:
;
@@ -281,48 +281,48 @@ COPYFROM:
; - tmp1 contains zero (to be used for linear memory buffer offset)
; - tmp2 contains the bank value
lda #<ptr4
lda #<ptr4
sta copy::address
jmp @L3
jmp @L3
@L1:
ldx tmp2
ldy #0
jsr copy::entry
ldy tmp1
sta (ptr2),y
inc tmp1
bne @L2
inc ptr2+1
ldx tmp2
ldy #0
jsr copy::entry
ldy tmp1
sta (ptr2),y
inc tmp1
bne @L2
inc ptr2+1
@L2:
inc ptr4
beq @L4
inc ptr4
beq @L4
; Bump count and repeat
@L3:
inc ptr3
bne @L1
inc ptr3+1
bne @L1
jsr restore_copy_routine
inc ptr3
bne @L1
inc ptr3+1
bne @L1
jsr restore_copy_routine
cli
rts
; Bump page register
@L4:
inc ptr4+1
lda ptr4+1
cmp #$80
bne @L3
lda #>BASE
sta ptr4+1
lda tmp2
inc ptr4+1
lda ptr4+1
cmp #$80
bne @L3
lda #>BASE
sta ptr4+1
lda tmp2
clc
adc #$10
sta tmp2
jmp @L3
adc #$10
sta tmp2
jmp @L3
; ------------------------------------------------------------------------
; COPYTO: Copy from linear into extended memory. A pointer to a structure
@@ -332,8 +332,8 @@ COPYFROM:
COPYTO:
sei
jsr setup
jsr backup_and_setup_copy_routine
jsr setup
jsr backup_and_setup_copy_routine
; Setup is:
;
@@ -344,101 +344,101 @@ COPYTO:
; - tmp1 contains zero (to be used for linear memory buffer offset)
; - tmp2 contains the bank value
lda #<ptr4
lda #<ptr4
sta copy::address
lda #<copy::stashop
sta copy::operation
jmp @L3
lda #<copy::stashop
sta copy::operation
jmp @L3
@L1:
ldy tmp1
lda (ptr2),y
ldx tmp2
ldy #0
jsr copy::entry
inc tmp1
bne @L2
inc ptr2+1
ldy tmp1
lda (ptr2),y
ldx tmp2
ldy #0
jsr copy::entry
inc tmp1
bne @L2
inc ptr2+1
@L2:
inc ptr4
beq @L4
inc ptr4
beq @L4
; Bump count and repeat
@L3:
inc ptr3
bne @L1
inc ptr3+1
bne @L1
jsr restore_copy_routine
inc ptr3
bne @L1
inc ptr3+1
bne @L1
jsr restore_copy_routine
cli
rts
; Bump page register
@L4:
inc ptr4+1
lda ptr4+1
inc ptr4+1
lda ptr4+1
cmp #$80
bne @L3
lda #>BASE
sta ptr4+1
lda tmp2
bne @L3
lda #>BASE
sta ptr4+1
lda tmp2
clc
adc #$10
sta tmp2
jmp @L3
adc #$10
sta tmp2
jmp @L3
; ------------------------------------------------------------------------
; Helper function for COPYFROM and COPYTO: Store the pointer to the request
; structure and prepare data for the copy
setup:
sta ptr1
stx ptr1+1 ; Save passed pointer
sta ptr1
stx ptr1+1 ; Save passed pointer
; Get the page number from the struct and adjust it so that it may be used
; with the hardware. That is: ptr4 has the page address and page offset
; tmp2 will hold the bank value
ldy #EM_COPY::PAGE+1
lda (ptr1),y
ldy #EM_COPY::PAGE+1
lda (ptr1),y
tax
ldy #EM_COPY::PAGE
lda (ptr1),y
jsr adjust_page_and_bank
ldy #EM_COPY::PAGE
lda (ptr1),y
jsr adjust_page_and_bank
clc
adc #>BASE
sta ptr4+1
stx tmp2
adc #>BASE
sta ptr4+1
stx tmp2
; Get the buffer pointer into ptr2
ldy #EM_COPY::BUF
lda (ptr1),y
sta ptr2
ldy #EM_COPY::BUF
lda (ptr1),y
sta ptr2
iny
lda (ptr1),y
sta ptr2+1
lda (ptr1),y
sta ptr2+1
; Get the count, calculate -(count-1) and store it into ptr3
ldy #EM_COPY::COUNT
lda (ptr1),y
eor #$FF
sta ptr3
ldy #EM_COPY::COUNT
lda (ptr1),y
eor #$FF
sta ptr3
iny
lda (ptr1),y
eor #$FF
sta ptr3+1
lda (ptr1),y
eor #$FF
sta ptr3+1
; Get the page offset into ptr4 and clear tmp1
ldy #EM_COPY::OFFS
lda (ptr1),y
sta ptr4
lda #0
sta tmp1
ldy #EM_COPY::OFFS
lda (ptr1),y
sta ptr4
lda #0
sta tmp1
; Done
@@ -447,47 +447,47 @@ setup:
; Helper routines for copying to and from the +256k ram
backup_and_setup_copy_routine:
ldx #.sizeof (copy) - 1
ldx #.sizeof (copy) - 1
@L1:
lda copy::entry,x
sta backup,x
lda copy::template,x
sta copy::entry,x
lda copy::entry,x
sta backup,x
lda copy::template,x
sta copy::entry,x
dex
bpl @L1
bpl @L1
rts
backup_and_setup_check_routine:
ldx #.sizeof (check) - 1
ldx #.sizeof (check) - 1
@L1:
lda check::entry,x
sta backup,x
lda check::template,x
sta check::entry,x
lda check::entry,x
sta backup,x
lda check::template,x
sta check::entry,x
dex
bpl @L1
bpl @L1
rts
restore_copy_routine:
ldx #.sizeof (copy) - 1
ldx #.sizeof (copy) - 1
restore_data:
lda backup,x
sta TARGETLOC,x
lda backup,x
sta TARGETLOC,x
dex
bpl restore_data
bpl restore_data
rts
; Helper routine to correct for the bank and page
adjust_page_and_bank:
sta tmp4
lda #$0C
sta tmp4
lda #$0C
sta tmp3
lda tmp4
and #$c0
lda tmp4
and #$c0
lsr
lsr
ora tmp3
sta tmp3
ora tmp3
sta tmp3
txa
asl
asl
@@ -495,8 +495,8 @@ adjust_page_and_bank:
asl
asl
asl
ora tmp3
ora tmp3
tax
lda tmp4
and #$3f
lda tmp4
and #$3f
rts

View File

@@ -3,13 +3,13 @@
; Marco van den Heuvel, 2010-01-27
;
.include "zeropage.inc"
.include "zeropage.inc"
.include "em-kernel.inc"
.include "em-error.inc"
.include "em-kernel.inc"
.include "em-error.inc"
.macpack generic
.macpack generic
; ------------------------------------------------------------------------
@@ -19,19 +19,19 @@
; Driver signature
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
; Jump table.
.word INSTALL
.word UNINSTALL
.word PAGECOUNT
.word MAP
.word USE
.word COMMIT
.word COPYFROM
.word COPYTO
.word INSTALL
.word UNINSTALL
.word PAGECOUNT
.word MAP
.word USE
.word COMMIT
.word COPYFROM
.word COPYTO
; ------------------------------------------------------------------------
; Constants
@@ -115,12 +115,12 @@ address := *+1 ; Patched at runtime
.bss
curpage: .res 1 ; Current page number
window: .res 256 ; Memory "window"
curpage: .res 1 ; Current page number
window: .res 256 ; Memory "window"
; Since the functions above are copied to $200, the current contents of this
; memory area must be saved into backup storage. Allocate enough space.
backup: .res .max (.sizeof (copy), .sizeof (check))
backup: .res .max (.sizeof (copy), .sizeof (check))
@@ -135,21 +135,21 @@ backup: .res .max (.sizeof (copy), .sizeof (check))
INSTALL:
sei
jsr backup_and_setup_check_routine
jsr check::entry
jsr backup_and_setup_check_routine
jsr check::entry
cli
ldx #.sizeof (check) - 1
jsr restore_data
cpy #$01
beq @present
lda #<EM_ERR_NO_DEVICE
ldx #>EM_ERR_NO_DEVICE
ldx #.sizeof (check) - 1
jsr restore_data
cpy #$01
beq @present
lda #<EM_ERR_NO_DEVICE
ldx #>EM_ERR_NO_DEVICE
rts
@present:
lda #<EM_ERR_OK
ldx #>EM_ERR_OK
; rts ; Run into UNINSTALL instead
lda #<EM_ERR_OK
ldx #>EM_ERR_OK
; rts ; Run into UNINSTALL instead
; ------------------------------------------------------------------------
; UNINSTALL routine. Is called before the driver is removed from memory.
@@ -165,8 +165,8 @@ UNINSTALL:
;
PAGECOUNT:
lda #<PAGES
ldx #>PAGES
lda #<PAGES
ldx #>PAGES
rts
; ------------------------------------------------------------------------
@@ -177,37 +177,37 @@ PAGECOUNT:
MAP:
sei
sta curpage ; Remember the new page
sta curpage ; Remember the new page
clc
adc #>BASE
sta ptr1+1
ldy #0
sty ptr1
jsr backup_and_setup_copy_routine
ldx #<ptr1
adc #>BASE
sta ptr1+1
ldy #0
sty ptr1
jsr backup_and_setup_copy_routine
ldx #<ptr1
stx copy::fetch::address
@L1:
ldx #$14
jsr copy::fetch
ldx ptr1
sta window,x
inc ptr1
bne @L1
ldx #$14
jsr copy::fetch
ldx ptr1
sta window,x
inc ptr1
bne @L1
; Return the memory window
jsr restore_copy_routine
lda #<window
ldx #>window ; Return the window address
jsr restore_copy_routine
lda #<window
ldx #>window ; Return the window address
cli
rts
; ------------------------------------------------------------------------
; USE: Tell the driver that the window is now associated with a given page.
USE: sta curpage ; Remember the page
lda #<window
ldx #>window ; Return the window
USE: sta curpage ; Remember the page
lda #<window
ldx #>window ; Return the window
rts
; ------------------------------------------------------------------------
@@ -215,26 +215,26 @@ USE: sta curpage ; Remember the page
COMMIT:
sei
lda curpage ; Get the current page
lda curpage ; Get the current page
clc
adc #>BASE
sta ptr1+1
ldy #0
sty ptr1
jsr backup_and_setup_copy_routine
ldx #<ptr1
adc #>BASE
sta ptr1+1
ldy #0
sty ptr1
jsr backup_and_setup_copy_routine
ldx #<ptr1
stx copy::stash::address
@L1:
ldx ptr1
lda window,x
ldx #$14
jsr copy::stash
inc ptr1
bne @L1
ldx ptr1
lda window,x
ldx #$14
jsr copy::stash
inc ptr1
bne @L1
; Return the memory window
jsr restore_copy_routine
jsr restore_copy_routine
cli
rts
@@ -250,11 +250,11 @@ COPYFROM:
pha
txa
pha
jsr backup_and_setup_copy_routine
jsr backup_and_setup_copy_routine
pla
tax
pla
jsr setup
jsr setup
; Setup is:
;
@@ -264,39 +264,39 @@ COPYFROM:
; - ptr4 contains the page memory buffer plus offset
; - tmp1 contains zero (to be used for linear memory buffer offset)
lda #<ptr4
lda #<ptr4
sta copy::fetch::address
jmp @L3
jmp @L3
@L1:
ldx #$14
ldy #0
jsr copy::fetch
ldy tmp1
sta (ptr2),y
inc tmp1
bne @L2
inc ptr2+1
ldx #$14
ldy #0
jsr copy::fetch
ldy tmp1
sta (ptr2),y
inc tmp1
bne @L2
inc ptr2+1
@L2:
inc ptr4
beq @L4
inc ptr4
beq @L4
; Bump count and repeat
@L3:
inc ptr3
bne @L1
inc ptr3+1
bne @L1
jsr restore_copy_routine
inc ptr3
bne @L1
inc ptr3+1
bne @L1
jsr restore_copy_routine
cli
rts
; Bump page register
@L4:
inc ptr4+1
jmp @L3
inc ptr4+1
jmp @L3
; ------------------------------------------------------------------------
; COPYTO: Copy from linear into extended memory. A pointer to a structure
@@ -309,11 +309,11 @@ COPYTO:
pha
txa
pha
jsr backup_and_setup_copy_routine
jsr backup_and_setup_copy_routine
pla
tax
pla
jsr setup
jsr setup
; Setup is:
;
@@ -323,85 +323,85 @@ COPYTO:
; - ptr4 contains the page memory buffer plus offset
; - tmp1 contains zero (to be used for linear memory buffer offset)
lda #<ptr4
lda #<ptr4
sta copy::stash::address
jmp @L3
jmp @L3
@L1:
ldy tmp1
lda (ptr2),y
ldx #$14
ldy #0
jsr copy::stash
inc tmp1
bne @L2
inc ptr2+1
ldy tmp1
lda (ptr2),y
ldx #$14
ldy #0
jsr copy::stash
inc tmp1
bne @L2
inc ptr2+1
@L2:
inc ptr4
beq @L4
inc ptr4
beq @L4
; Bump count and repeat
@L3:
inc ptr3
bne @L1
inc ptr3+1
bne @L1
jsr restore_copy_routine
inc ptr3
bne @L1
inc ptr3+1
bne @L1
jsr restore_copy_routine
cli
rts
; Bump page register
@L4:
inc ptr4+1
jmp @L3
inc ptr4+1
jmp @L3
; ------------------------------------------------------------------------
; Helper function for COPYFROM and COPYTO: Store the pointer to the request
; structure and prepare data for the copy
setup:
sta ptr1
stx ptr1+1 ; Save passed pointer
sta ptr1
stx ptr1+1 ; Save passed pointer
; Get the page number from the struct and adjust it so that it may be used
; with the hardware. That is: ptr4 has the page address and page offset
; tmp2 will hold the bank value
ldy #EM_COPY::PAGE
lda (ptr1),y
ldy #EM_COPY::PAGE
lda (ptr1),y
clc
adc #>BASE
sta ptr4+1
adc #>BASE
sta ptr4+1
; Get the buffer pointer into ptr2
ldy #EM_COPY::BUF
lda (ptr1),y
sta ptr2
ldy #EM_COPY::BUF
lda (ptr1),y
sta ptr2
iny
lda (ptr1),y
sta ptr2+1
lda (ptr1),y
sta ptr2+1
; Get the count, calculate -(count-1) and store it into ptr3
ldy #EM_COPY::COUNT
lda (ptr1),y
eor #$FF
sta ptr3
ldy #EM_COPY::COUNT
lda (ptr1),y
eor #$FF
sta ptr3
iny
lda (ptr1),y
eor #$FF
sta ptr3+1
lda (ptr1),y
eor #$FF
sta ptr3+1
; Get the page offset into ptr4 and clear tmp1
ldy #EM_COPY::OFFS
lda (ptr1),y
sta ptr4
lda #0
sta tmp1
ldy #EM_COPY::OFFS
lda (ptr1),y
sta ptr4
lda #0
sta tmp1
; Done
@@ -410,32 +410,32 @@ setup:
; Helper routines for copying to and from the +256k ram
backup_and_setup_copy_routine:
ldx #.sizeof (copy) - 1
ldx #.sizeof (copy) - 1
@L1:
lda copy::entry,x
sta backup,x
lda copy::template,x
sta copy::entry,x
lda copy::entry,x
sta backup,x
lda copy::template,x
sta copy::entry,x
dex
bpl @L1
bpl @L1
rts
backup_and_setup_check_routine:
ldx #.sizeof (check) - 1
ldx #.sizeof (check) - 1
@L1:
lda check::entry,x
sta backup,x
lda check::template,x
sta check::entry,x
lda check::entry,x
sta backup,x
lda check::template,x
sta check::entry,x
dex
bpl @L1
bpl @L1
rts
restore_copy_routine:
ldx #.sizeof (copy) - 1
ldx #.sizeof (copy) - 1
restore_data:
lda backup,x
sta TARGETLOC,x
lda backup,x
sta TARGETLOC,x
dex
bpl restore_data
bpl restore_data
rts

View File

@@ -8,9 +8,9 @@
; Marco van den Heuvel, 2010-01-21
;
.include "zeropage.inc"
.include "zeropage.inc"
.include "em-kernel.inc"
.include "em-kernel.inc"
.include "em-error.inc"
@@ -25,7 +25,7 @@
; Driver signature
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
.byte EMD_API_VERSION ; EM API version number
; Jump table.
@@ -35,7 +35,7 @@
.word MAP
.word USE
.word COMMIT
.word COPYFROM
.word COPYFROM
.word COPYTO
; ------------------------------------------------------------------------
@@ -62,83 +62,83 @@ pagecount: .res 2 ; Number of available pages
;
INSTALL:
ldx GR_WINDOW
ldx GR_WINDOW
cpx GR_WINDOW
bne @notpresent
inc GR_WINDOW
cpx GR_WINDOW
beq @notpresent
cpx GR_WINDOW
beq @notpresent
lda #4
jsr check
cpy GR_WINDOW
beq @has64k
lda #8
jsr check
cpy GR_WINDOW
beq @has128k
lda #16
jsr check
cpy GR_WINDOW
beq @has256k
lda #32
jsr check
cpy GR_WINDOW
beq @has512k
lda #64
jsr check
cpy GR_WINDOW
beq @has1024k
lda #128
jsr check
cpy GR_WINDOW
beq @has2048k
ldx #>16384
lda #4
jsr check
cpy GR_WINDOW
beq @has64k
lda #8
jsr check
cpy GR_WINDOW
beq @has128k
lda #16
jsr check
cpy GR_WINDOW
beq @has256k
lda #32
jsr check
cpy GR_WINDOW
beq @has512k
lda #64
jsr check
cpy GR_WINDOW
beq @has1024k
lda #128
jsr check
cpy GR_WINDOW
beq @has2048k
ldx #>16384
bne @setok
@has64k:
ldx #>256
bne @setok
ldx #>256
bne @setok
@has128k:
ldx #>512
bne @setok
ldx #>512
bne @setok
@has256k:
ldx #>1024
bne @setok
ldx #>1024
bne @setok
@has512k:
ldx #>2048
bne @setok
ldx #>2048
bne @setok
@has1024k:
ldx #>4096
bne @setok
ldx #>4096
bne @setok
@has2048k:
ldx #>8192
bne @setok
ldx #>8192
bne @setok
@notpresent:
lda #<EM_ERR_NO_DEVICE
ldx #>EM_ERR_NO_DEVICE
rts
lda #<EM_ERR_NO_DEVICE
ldx #>EM_ERR_NO_DEVICE
rts
@setok:
lda #0
sta pagecount
stx pagecount+1
lda #<EM_ERR_OK
ldx #>EM_ERR_OK
rts
lda #0
sta pagecount
stx pagecount+1
lda #<EM_ERR_OK
ldx #>EM_ERR_OK
rts
check:
ldx #0
stx GR_PAGE_LO
stx GR_PAGE_HI
ldy GR_WINDOW
iny
sta GR_PAGE_HI
sty GR_WINDOW
ldx #0
stx GR_PAGE_HI
; rts ; Run into UNINSTALL instead
ldx #0
stx GR_PAGE_LO
stx GR_PAGE_HI
ldy GR_WINDOW
iny
sta GR_PAGE_HI
sty GR_WINDOW
ldx #0
stx GR_PAGE_HI
; rts ; Run into UNINSTALL instead
; ------------------------------------------------------------------------
; UNINSTALL routine. Is called before the driver is removed from memory.

View File

@@ -3,13 +3,13 @@
; Marco van den Heuvel, 2010-01-24
;
.include "zeropage.inc"
.include "zeropage.inc"
.include "em-kernel.inc"
.include "em-error.inc"
.include "em-kernel.inc"
.include "em-error.inc"
.macpack generic
.macpack generic
; ------------------------------------------------------------------------
@@ -19,24 +19,24 @@
; Driver signature
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
; Jump table.
.word INSTALL
.word UNINSTALL
.word PAGECOUNT
.word MAP
.word USE
.word COMMIT
.word COPYFROM
.word COPYTO
.word INSTALL
.word UNINSTALL
.word PAGECOUNT
.word MAP
.word USE
.word COMMIT
.word COPYFROM
.word COPYTO
; ------------------------------------------------------------------------
; Constants
IP_WINDOW = $DF00 ; Address of ISEPIC window
IP_WINDOW = $DF00 ; Address of ISEPIC window
IP_CTRL_BASE = $DE00
PAGES = 8
@@ -53,32 +53,32 @@ PAGES = 8
;
INSTALL:
lda #0
sta IP_CTRL_BASE
ldx IP_WINDOW
cpx IP_WINDOW
bne @notpresent
inc IP_WINDOW
cpx IP_WINDOW
beq @notpresent
ldx IP_WINDOW
sta IP_CTRL_BASE+1
lda #0
sta IP_CTRL_BASE
ldx IP_WINDOW
cpx IP_WINDOW
bne @notpresent
inc IP_WINDOW
cpx IP_WINDOW
beq @notpresent
ldx IP_WINDOW
sta IP_CTRL_BASE+1
inx
stx IP_WINDOW
stx IP_WINDOW
dex
sta IP_CTRL_BASE
cpx IP_WINDOW
beq @setok
sta IP_CTRL_BASE
cpx IP_WINDOW
beq @setok
@notpresent:
lda #<EM_ERR_NO_DEVICE
ldx #>EM_ERR_NO_DEVICE
lda #<EM_ERR_NO_DEVICE
ldx #>EM_ERR_NO_DEVICE
rts
@setok:
lda #<EM_ERR_OK
ldx #>EM_ERR_OK
; rts ; Run into UNINSTALL instead
lda #<EM_ERR_OK
ldx #>EM_ERR_OK
; rts ; Run into UNINSTALL instead
; ------------------------------------------------------------------------
; UNINSTALL routine. Is called before the driver is removed from memory.
@@ -93,8 +93,8 @@ UNINSTALL:
;
PAGECOUNT:
lda #<PAGES
ldx #>PAGES
lda #<PAGES
ldx #>PAGES
rts
; ------------------------------------------------------------------------
@@ -112,9 +112,9 @@ USE := MAP
MAP:
tax
sta IP_CTRL_BASE,x
lda #<IP_WINDOW
ldx #>IP_WINDOW
sta IP_CTRL_BASE,x
lda #<IP_WINDOW
ldx #>IP_WINDOW
; Use the RTS from COMMIT below to save a precious byte of storage
@@ -131,7 +131,7 @@ COMMIT:
;
COPYFROM:
jsr setup
jsr setup
; Setup is:
;
@@ -142,37 +142,37 @@ COPYFROM:
; - X contains the page offset
; - Y contains zero
jmp @L5
jmp @L5
@L1:
lda IP_WINDOW,x
sta (ptr2),y
lda IP_WINDOW,x
sta (ptr2),y
iny
bne @L2
inc ptr2+1
bne @L2
inc ptr2+1
@L2:
inx
beq @L4
beq @L4
; Bump count and repeat
@L3:
inc ptr3
bne @L1
inc ptr3+1
bne @L1
inc ptr3
bne @L1
inc ptr3+1
bne @L1
rts
; Bump page register
@L4:
inc tmp1 ; Bump low page register
inc tmp1 ; Bump low page register
@L5:
stx tmp2
ldx tmp1
sta IP_CTRL_BASE,x
ldx tmp2
jmp @L3
stx tmp2
ldx tmp1
sta IP_CTRL_BASE,x
ldx tmp2
jmp @L3
; ------------------------------------------------------------------------
; COPYTO: Copy from linear into extended memory. A pointer to a structure
@@ -181,7 +181,7 @@ COPYFROM:
;
COPYTO:
jsr setup
jsr setup
; Setup is:
;
@@ -192,78 +192,78 @@ COPYTO:
; - X contains the page offset
; - Y contains zero
jmp @L5
jmp @L5
@L1:
lda (ptr2),y
sta IP_WINDOW,x
lda (ptr2),y
sta IP_WINDOW,x
iny
bne @L2
inc ptr2+1
bne @L2
inc ptr2+1
@L2:
inx
beq @L4
beq @L4
; Bump count and repeat
@L3:
inc ptr3
bne @L1
inc ptr3+1
bne @L1
inc ptr3
bne @L1
inc ptr3+1
bne @L1
rts
; Bump page register
@L4:
inc tmp1 ; Bump page register
inc tmp1 ; Bump page register
@L5:
stx tmp2
ldx tmp1
sta IP_CTRL_BASE,x
ldx tmp2
jmp @L3
stx tmp2
ldx tmp1
sta IP_CTRL_BASE,x
ldx tmp2
jmp @L3
; ------------------------------------------------------------------------
; Helper function for COPYFROM and COPYTO: Store the pointer to the request
; structure and prepare data for the copy
setup:
sta ptr1
stx ptr1+1 ; Save passed pointer
sta ptr1
stx ptr1+1 ; Save passed pointer
; Get the page number from the struct and remember it.
ldy #EM_COPY::PAGE
lda (ptr1),y
sta tmp1
ldy #EM_COPY::PAGE
lda (ptr1),y
sta tmp1
; Get the buffer pointer into ptr2
ldy #EM_COPY::BUF
lda (ptr1),y
sta ptr2
ldy #EM_COPY::BUF
lda (ptr1),y
sta ptr2
iny
lda (ptr1),y
sta ptr2+1
lda (ptr1),y
sta ptr2+1
; Get the count, calculate -(count-1) and store it into ptr3
ldy #EM_COPY::COUNT
lda (ptr1),y
eor #$FF
sta ptr3
ldy #EM_COPY::COUNT
lda (ptr1),y
eor #$FF
sta ptr3
iny
lda (ptr1),y
eor #$FF
sta ptr3+1
lda (ptr1),y
eor #$FF
sta ptr3+1
; Get the page offset into X and clear Y
ldy #EM_COPY::OFFS
lda (ptr1),y
ldy #EM_COPY::OFFS
lda (ptr1),y
tax
ldy #0
ldy #0
; Done

View File

@@ -5,9 +5,9 @@
; Ullrich von Bassewitz, 2002-12-02
;
.include "zeropage.inc"
.include "zeropage.inc"
.include "em-kernel.inc"
.include "em-kernel.inc"
.include "em-error.inc"
@@ -22,7 +22,7 @@
; Driver signature
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
.byte EMD_API_VERSION ; EM API version number
; Jump table.
@@ -32,14 +32,14 @@
.word MAP
.word USE
.word COMMIT
.word COPYFROM
.word COPYFROM
.word COPYTO
; ------------------------------------------------------------------------
; Constants
BASE = $D000
PAGES = ($10000 - BASE) / 256
BASE = $D000
PAGES = ($10000 - BASE) / 256
; ------------------------------------------------------------------------
; Data.
@@ -88,18 +88,18 @@ PAGECOUNT:
; by the driver.
;
MAP: sta curpage ; Remember the new page
MAP: sta curpage ; Remember the new page
clc
adc #>BASE
sta ptr1+1
ldy #$00
sty ptr1
adc #>BASE
sta ptr1+1
ldy #$00
sty ptr1
lda #<window
sta ptr2
lda #>window
sta ptr2+1
lda #<window
sta ptr2
lda #>window
sta ptr2+1
; Transfer one page
@@ -122,36 +122,36 @@ USE: sta curpage ; Remember the page
; ------------------------------------------------------------------------
; COMMIT: Commit changes in the memory window to extended storage.
COMMIT: lda curpage ; Get the current page
COMMIT: lda curpage ; Get the current page
bmi done ; Jump if no page mapped
clc
adc #>BASE
sta ptr2+1
ldy #$00
sty ptr2
adc #>BASE
sta ptr2+1
ldy #$00
sty ptr2
lda #<window
sta ptr1
lda #>window
sta ptr1+1
lda #<window
sta ptr1
lda #>window
sta ptr1+1
; Transfer one page. Y must be zero on entry
transfer:
ldx $01 ; Remember c64 control port
ldx $01 ; Remember c64 control port
txa
and #$F8 ; Bank out ROMs, I/O
and #$F8 ; Bank out ROMs, I/O
sei
sta $01
sta $01
; Unroll the following loop
loop: .repeat 8
lda (ptr1),y
sta (ptr2),y
loop: .repeat 8
lda (ptr1),y
sta (ptr2),y
iny
.endrepeat
.endrepeat
bne loop
@@ -162,7 +162,7 @@ loop: .repeat 8
; Done
done: rts
done: rts
; ------------------------------------------------------------------------
; COPYFROM: Copy from extended into linear memory. A pointer to a structure
@@ -173,7 +173,7 @@ done: rts
COPYFROM:
sta ptr3
stx ptr3+1 ; Save the passed em_copy pointer
ldy #EM_COPY::OFFS
lda (ptr3),y
sta ptr1
@@ -213,15 +213,15 @@ common: ldy #EM_COPY::COUNT+1
lda $01 ; Remember c64 control port
pha
and #$F8 ; Bank out ROMs, I/O
and #$F8 ; Bank out ROMs, I/O
sei
sta $01
sta $01
; Transfer the bytes in the last page
ldy #$00
@L3: lda (ptr1),y
sta (ptr2),y
@L3: lda (ptr1),y
sta (ptr2),y
iny
dex
bne @L3

View File

@@ -7,10 +7,10 @@
;
.include "zeropage.inc"
.include "zeropage.inc"
.include "em-kernel.inc"
.include "em-error.inc"
.include "em-kernel.inc"
.include "em-error.inc"
.macpack generic
@@ -24,7 +24,7 @@
; Driver signature
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
.byte EMD_API_VERSION ; EM API version number
; Jump table.
@@ -32,9 +32,9 @@
.word UNINSTALL
.word PAGECOUNT
.word MAP
.word USE
.word USE
.word COMMIT
.word COPYFROM
.word COPYFROM
.word COPYTO
; ------------------------------------------------------------------------
@@ -61,46 +61,46 @@ pagecount: .res 2 ; Number of available pages
;
INSTALL:
ldx RAMC_WINDOW
cpx RAMC_WINDOW
bne @notpresent
ldx RAMC_WINDOW
cpx RAMC_WINDOW
bne @notpresent
lda #0
sta RAMC_PAGE_LO
sta RAMC_PAGE_HI
ldx RAMC_WINDOW
cpx RAMC_WINDOW
bne @notpresent
lda #2
sta RAMC_WINDOW
cmp RAMC_WINDOW
beq @cont
cpx RAMC_WINDOW
beq @readonly
@cont: ldy #1
sty RAMC_PAGE_HI
sty RAMC_WINDOW
dey
sty RAMC_PAGE_HI
iny
cpy RAMC_WINDOW
beq @rc64
; we're on rc128
ldx #>512
bne @setsize
@rc64: ldx #>256
lda #0
sta RAMC_PAGE_LO
sta RAMC_PAGE_HI
ldx RAMC_WINDOW
cpx RAMC_WINDOW
bne @notpresent
lda #2
sta RAMC_WINDOW
cmp RAMC_WINDOW
beq @cont
cpx RAMC_WINDOW
beq @readonly
@cont: ldy #1
sty RAMC_PAGE_HI
sty RAMC_WINDOW
dey
sty RAMC_PAGE_HI
iny
cpy RAMC_WINDOW
beq @rc64
; we're on rc128
ldx #>512
bne @setsize
@rc64: ldx #>256
@setsize:
lda #0
sta pagecount
stx pagecount+1
lda #0
sta pagecount
stx pagecount+1
lda #<EM_ERR_OK
ldx #>EM_ERR_OK
rts
@notpresent:
@readonly:
lda #<EM_ERR_NO_DEVICE
ldx #>EM_ERR_NO_DEVICE
; rts ; Run into UNINSTALL instead
lda #<EM_ERR_NO_DEVICE
ldx #>EM_ERR_NO_DEVICE
; rts ; Run into UNINSTALL instead
; ------------------------------------------------------------------------
; UNINSTALL routine. Is called before the driver is removed from memory.
@@ -134,8 +134,8 @@ USE = MAP
; by the driver.
;
MAP: sta RAMC_PAGE_LO
stx RAMC_PAGE_HI
MAP: sta RAMC_PAGE_LO
stx RAMC_PAGE_HI
lda #<RAMC_WINDOW
ldx #>RAMC_WINDOW
@@ -185,14 +185,14 @@ COPYFROM:
; Bump page register
@L4: inc tmp1
bne @L5
inc tmp2
@L5: lda tmp1
sta RAMC_PAGE_LO
lda tmp2
sta RAMC_PAGE_HI
jmp @L3
@L4: inc tmp1
bne @L5
inc tmp2
@L5: lda tmp1
sta RAMC_PAGE_LO
lda tmp2
sta RAMC_PAGE_HI
jmp @L3
; ------------------------------------------------------------------------
; COPYTO: Copy from linear into extended memory. A pointer to a structure
@@ -233,14 +233,14 @@ COPYTO:
; Bump page register
@L4: inc tmp1
bne @L5
inc tmp2
@L5: lda tmp1
sta RAMC_PAGE_LO
lda tmp2
sta RAMC_PAGE_HI
jmp @L3
@L4: inc tmp1
bne @L5
inc tmp2
@L5: lda tmp1
sta RAMC_PAGE_LO
lda tmp2
sta RAMC_PAGE_HI
jmp @L3
; ------------------------------------------------------------------------
; Helper function for COPYFROM and COPYTO: Store the pointer to the request

View File

@@ -5,9 +5,9 @@
; Ullrich von Bassewitz, 2002-11-29
;
.include "zeropage.inc"
.include "zeropage.inc"
.include "em-kernel.inc"
.include "em-kernel.inc"
.include "em-error.inc"
@@ -22,7 +22,7 @@
; Driver signature
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
.byte EMD_API_VERSION ; EM API version number
; Jump table.
@@ -32,7 +32,7 @@
.word MAP
.word USE
.word COMMIT
.word COPYFROM
.word COPYFROM
.word COPYTO
; ------------------------------------------------------------------------
@@ -60,12 +60,12 @@ curpage: .res 2 ; Current page number
window: .res 256 ; Memory "window"
reu_params: .word $0000 ; Host address, lo, hi
.word $0000 ; Exp address, lo, hi
.byte $00 ; Expansion bank no.
.word $0000 ; # bytes to move, lo, hi
.byte $00 ; Interrupt mask reg.
.byte $00 ; Adress control reg.
reu_params: .word $0000 ; Host address, lo, hi
.word $0000 ; Exp address, lo, hi
.byte $00 ; Expansion bank no.
.word $0000 ; # bytes to move, lo, hi
.byte $00 ; Interrupt mask reg.
.byte $00 ; Adress control reg.
.code
@@ -142,7 +142,7 @@ done: rts
; ------------------------------------------------------------------------
; USE: Tell the driver that the window is now associated with a given page.
USE: sta curpage
stx curpage+1 ; Remember the page
lda #<window
@@ -220,15 +220,15 @@ transfer1:
; Transfer subroutine for the REU. Expects command in Y.
transfer:
sty REU_COMMAND ; Issue command
sty REU_COMMAND ; Issue command
ldy $01 ; Save the value of the c64 control port...
tya ;
ldy $01 ; Save the value of the c64 control port...
tya ;
and #$F8 ; Disable ROMs and I/O.
sei ;
sta $01
sei ;
sta $01
lda REU_TRIGGER ; Don't change $FF00
sta REU_TRIGGER ; Start the transfer...
sta REU_TRIGGER ; Start the transfer...
sty $01 ; Restore the old configuration
cli

View File

@@ -8,10 +8,10 @@
; Marco van den Heuvel, 2010-01-22
;
.include "zeropage.inc"
.include "zeropage.inc"
.include "em-kernel.inc"
.include "em-error.inc"
.include "em-kernel.inc"
.include "em-error.inc"
.macpack generic
@@ -25,7 +25,7 @@
; Driver signature
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
.byte EMD_API_VERSION ; EM API version number
; Jump table.
@@ -33,33 +33,33 @@
.word UNINSTALL
.word PAGECOUNT
.word MAP
.word USE
.word USE
.word COMMIT
.word COPYFROM
.word COPYFROM
.word COPYTO
; ------------------------------------------------------------------------
; Constants
VDC_ADDR_REG = $D600 ; VDC address
VDC_DATA_REG = $D601 ; VDC data
VDC_ADDR_REG = $D600 ; VDC address
VDC_DATA_REG = $D601 ; VDC data
VDC_DATA_HI = 18 ; used registers
VDC_DATA_LO = 19
VDC_CSET = 28
VDC_DATA = 31
VDC_DATA_HI = 18 ; used registers
VDC_DATA_LO = 19
VDC_CSET = 28
VDC_DATA = 31
; ------------------------------------------------------------------------
; Data.
.data
pagecount: .word 64 ; $0000-$3fff as 16k default
curpage: .word $ffff ; currently mapped-in page (invalid)
pagecount: .word 64 ; $0000-$3fff as 16k default
curpage: .word $ffff ; currently mapped-in page (invalid)
.bss
window: .res 256 ; memory window
window: .res 256 ; memory window
.code
@@ -73,8 +73,8 @@ window: .res 256 ; memory window
INSTALL:
ldx #0
ldy #0
lda #VDC_CSET ; determine size of RAM...
sta VDC_ADDR_REG
lda #VDC_CSET ; determine size of RAM...
sta VDC_ADDR_REG
@L0: bit VDC_ADDR_REG
bmi @present
@@ -82,81 +82,81 @@ INSTALL:
bne @L0
iny
bne @L0
lda #<EM_ERR_NO_DEVICE
ldx #>EM_ERR_NO_DEVICE
rts
lda #<EM_ERR_NO_DEVICE
ldx #>EM_ERR_NO_DEVICE
rts
@present:
ldx #VDC_CSET ; determine size of RAM...
jsr vdcgetreg
sta tmp1
ora #%00010000
jsr vdcputreg ; turn on 64k
ldx #VDC_CSET ; determine size of RAM...
jsr vdcgetreg
sta tmp1
ora #%00010000
jsr vdcputreg ; turn on 64k
jsr settestadr1 ; save original value of test byte
jsr vdcgetbyte
sta tmp2
jsr settestadr1 ; save original value of test byte
jsr vdcgetbyte
sta tmp2
lda #$55 ; write $55 here
ldy #ptr1
jsr test64k ; read it here and there
lda #$aa ; write $aa here
ldy #ptr2
jsr test64k ; read it here and there
lda #$55 ; write $55 here
ldy #ptr1
jsr test64k ; read it here and there
lda #$aa ; write $aa here
ldy #ptr2
jsr test64k ; read it here and there
jsr settestadr1
lda tmp2
jsr vdcputbyte ; restore original value of test byte
jsr settestadr1
lda tmp2
jsr vdcputbyte ; restore original value of test byte
lda ptr1 ; do bytes match?
cmp ptr1+1
bne @have64k
lda ptr2
cmp ptr2+1
bne @have64k
lda ptr1 ; do bytes match?
cmp ptr1+1
bne @have64k
lda ptr2
cmp ptr2+1
bne @have64k
ldx #VDC_CSET
lda tmp1
jsr vdcputreg ; restore 16/64k flag
jmp @endok ; and leave default values for 16k
ldx #VDC_CSET
lda tmp1
jsr vdcputreg ; restore 16/64k flag
jmp @endok ; and leave default values for 16k
@have64k:
lda #<256
ldx #>256
sta pagecount
stx pagecount+1
lda #<256
ldx #>256
sta pagecount
stx pagecount+1
@endok:
lda #<EM_ERR_OK
lda #<EM_ERR_OK
ldx #>EM_ERR_OK
rts
test64k:
sta tmp1
sty ptr3
lda #0
sta ptr3+1
jsr settestadr1
lda tmp1
jsr vdcputbyte ; write $55
jsr settestadr1
jsr vdcgetbyte ; read here
pha
jsr settestadr2
jsr vdcgetbyte ; and there
ldy #1
sta (ptr3),y
pla
dey
sta (ptr3),y
rts
sta tmp1
sty ptr3
lda #0
sta ptr3+1
jsr settestadr1
lda tmp1
jsr vdcputbyte ; write $55
jsr settestadr1
jsr vdcgetbyte ; read here
pha
jsr settestadr2
jsr vdcgetbyte ; and there
ldy #1
sta (ptr3),y
pla
dey
sta (ptr3),y
rts
settestadr1:
ldy #$02 ; test page 2 (here)
.byte $2c
ldy #$02 ; test page 2 (here)
.byte $2c
settestadr2:
ldy #$42 ; or page 64+2 (there)
lda #0
jmp vdcsetsrcaddr
ldy #$42 ; or page 64+2 (there)
lda #0
jmp vdcsetsrcaddr
; ------------------------------------------------------------------------
; UNINSTALL routine. Is called before the driver is removed from memory.
@@ -164,7 +164,7 @@ settestadr2:
;
UNINSTALL:
;on C128 restore font and clear the screen?
;on C128 restore font and clear the screen?
rts
; ------------------------------------------------------------------------
@@ -182,42 +182,42 @@ PAGECOUNT:
; by the driver.
;
MAP: sta curpage
stx curpage+1
sta ptr1+1
ldy #0
sty ptr1
MAP: sta curpage
stx curpage+1
sta ptr1+1
ldy #0
sty ptr1
lda #<window
sta ptr2
lda #>window
sta ptr2+1
lda #<window
sta ptr2
lda #>window
sta ptr2+1
jsr transferin
jsr transferin
lda #<window
ldx #>window
rts
rts
; copy a single page from (ptr1):VDCRAM to (ptr2):RAM
transferin:
lda ptr1
ldy ptr1+1
jsr vdcsetsrcaddr ; set source address in VDC
ldy #0
ldx #VDC_DATA
stx VDC_ADDR_REG
@L0: bit VDC_ADDR_REG
bpl @L0
lda VDC_DATA_REG ; get 2 bytes at a time to speed-up
sta (ptr2),y ; (in fact up to 8 bytes could be fetched with special VDC config)
iny
lda VDC_DATA_REG
sta (ptr2),y
iny
bne @L0
rts
lda ptr1
ldy ptr1+1
jsr vdcsetsrcaddr ; set source address in VDC
ldy #0
ldx #VDC_DATA
stx VDC_ADDR_REG
@L0: bit VDC_ADDR_REG
bpl @L0
lda VDC_DATA_REG ; get 2 bytes at a time to speed-up
sta (ptr2),y ; (in fact up to 8 bytes could be fetched with special VDC config)
iny
lda VDC_DATA_REG
sta (ptr2),y
iny
bne @L0
rts
; ------------------------------------------------------------------------
; USE: Tell the driver that the window is now associated with a given page.
@@ -232,36 +232,36 @@ done: rts
; COMMIT: Commit changes in the memory window to extended storage.
COMMIT:
lda curpage ; jump if no page mapped
ldx curpage+1
bmi done
sta ptr1+1
ldy #0
sty ptr1
lda curpage ; jump if no page mapped
ldx curpage+1
bmi done
sta ptr1+1
ldy #0
sty ptr1
lda #<window
sta ptr2
lda #>window
sta ptr2+1
lda #<window
sta ptr2
lda #>window
sta ptr2+1
; fall through to transferout
; copy a single page from (ptr2):RAM to (ptr1):VDCRAM
transferout:
lda ptr1
ldy ptr1+1
jsr vdcsetsrcaddr ; set source address in VDC
ldy #0
ldx #VDC_DATA
stx VDC_ADDR_REG
@L0: bit VDC_ADDR_REG
bpl @L0
lda (ptr2),y ; speedup does not work for writing
sta VDC_DATA_REG
iny
bne @L0
rts
lda ptr1
ldy ptr1+1
jsr vdcsetsrcaddr ; set source address in VDC
ldy #0
ldx #VDC_DATA
stx VDC_ADDR_REG
@L0: bit VDC_ADDR_REG
bpl @L0
lda (ptr2),y ; speedup does not work for writing
sta VDC_DATA_REG
iny
bne @L0
rts
; ------------------------------------------------------------------------
; COPYFROM: Copy from extended into linear memory. A pointer to a structure
@@ -270,8 +270,8 @@ transferout:
;
COPYFROM:
jsr setup
beq @L2 ; Skip if no full pages
jsr setup
beq @L2 ; Skip if no full pages
; Copy full pages
@@ -286,18 +286,18 @@ COPYFROM:
@L2: ldy #EM_COPY::COUNT
lda (ptr3),y ; Get bytes in last page
beq @L4
sta tmp1
sta tmp1
; Transfer the bytes in the last page
ldy #0
@L3: jsr vdcgetbyte
sta (ptr2),y
iny
dec tmp1
lda tmp1
bne @L3
@L4: rts
ldy #0
@L3: jsr vdcgetbyte
sta (ptr2),y
iny
dec tmp1
lda tmp1
bne @L3
@L4: rts
; ------------------------------------------------------------------------
; COPYTO: Copy from linear into extended memory. A pointer to a structure
@@ -306,8 +306,8 @@ COPYFROM:
;
COPYTO:
jsr setup
beq @L2 ; Skip if no full pages
jsr setup
beq @L2 ; Skip if no full pages
; Copy full pages
@@ -322,52 +322,52 @@ COPYTO:
@L2: ldy #EM_COPY::COUNT
lda (ptr3),y ; Get bytes in last page
beq @L4
sta tmp1
sta tmp1
; Transfer the bytes in the last page
ldy #0
@L3: lda (ptr2),y
jsr vdcputbyte
iny
dec tmp1
lda tmp1
bne @L3
@L4: rts
ldy #0
@L3: lda (ptr2),y
jsr vdcputbyte
iny
dec tmp1
lda tmp1
bne @L3
@L4: rts
;-------------------------------------------------------------------------
; Helper functions to handle VDC ram
;
vdcsetsrcaddr:
ldx #VDC_DATA_LO
stx VDC_ADDR_REG
@L0: bit VDC_ADDR_REG
bpl @L0
sta VDC_DATA_REG
dex
tya
stx VDC_ADDR_REG
sta VDC_DATA_REG
rts
ldx #VDC_DATA_LO
stx VDC_ADDR_REG
@L0: bit VDC_ADDR_REG
bpl @L0
sta VDC_DATA_REG
dex
tya
stx VDC_ADDR_REG
sta VDC_DATA_REG
rts
vdcgetbyte:
ldx #VDC_DATA
ldx #VDC_DATA
vdcgetreg:
stx VDC_ADDR_REG
@L0: bit VDC_ADDR_REG
bpl @L0
lda VDC_DATA_REG
rts
stx VDC_ADDR_REG
@L0: bit VDC_ADDR_REG
bpl @L0
lda VDC_DATA_REG
rts
vdcputbyte:
ldx #VDC_DATA
ldx #VDC_DATA
vdcputreg:
stx VDC_ADDR_REG
@L0: bit VDC_ADDR_REG
bpl @L0
sta VDC_DATA_REG
rts
stx VDC_ADDR_REG
@L0: bit VDC_ADDR_REG
bpl @L0
sta VDC_DATA_REG
rts
; ------------------------------------------------------------------------
; Helper function for COPYFROM and COPYTO: Store the pointer to the request
@@ -375,7 +375,7 @@ vdcputreg:
;
setup:
sta ptr3
sta ptr3
stx ptr3+1 ; Save the passed em_copy pointer
ldy #EM_COPY::OFFS
@@ -392,8 +392,8 @@ setup:
lda (ptr3),y
sta ptr2+1 ; To
ldy #EM_COPY::COUNT+1
ldy #EM_COPY::COUNT+1
lda (ptr3),y ; Get number of pages
sta tmp1
rts
rts

View File

@@ -6,11 +6,11 @@
;
.include "zeropage.inc"
.include "zeropage.inc"
.include "em-kernel.inc"
.include "em-kernel.inc"
.include "em-error.inc"
.import _get_ostype
.import _get_ostype
.macpack generic
@@ -24,7 +24,7 @@
; Driver signature
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
.byte EMD_API_VERSION ; EM API version number
; Jump table.
@@ -34,7 +34,7 @@
.word MAP
.word USE
.word COMMIT
.word COPYFROM
.word COPYFROM
.word COPYTO
; ------------------------------------------------------------------------
@@ -58,10 +58,10 @@ window: .res 256 ; Memory "window"
; The MAP and COMMIT entries will actually call COPYFROM/COPYTO with
; a pointer to the following data structure:
dma_params: .word window ; Host address
dma_params: .word window ; Host address
.byte 0 ; Offset in page
curpage: .word $0000 ; Page
.word .sizeof (window); # bytes to move, lo, hi
curpage: .word $0000 ; Page
.word .sizeof (window); # bytes to move, lo, hi
.code