Removed (pretty inconsistently used) tab chars from source code base.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user