some cleanup

This commit is contained in:
mrdudz
2022-07-21 03:43:54 +02:00
parent a55807f682
commit 86091ac6bf

View File

@@ -3,19 +3,22 @@
;should work for ActionReplay as well...
;
;
;Version 1.0
;
;Johannes Braun 2006-08-22
;hannenz@freenet.de
; original Version 1.0 by Johannes Braun 2006-08-22 <hannenz@freenet.de>
;
;use the functions described in "usr/lib/cc65/include/em.h" to make use of this driver.
;-------------------------------------------------------------------------------------------------------------------------
; ------------------------------------------------------------------------
;NOTE: If called from ROM the Lo_Code routines must exit with LDA #$00 / STA $DE00!!! just change and recompile!
.include "zeropage.inc"
.include "em-kernel.inc"
.importzp ptr1,ptr2,ptr3,ptr4,tmp1
.include "em-error.inc"
.macpack generic
.macpack module
; ------------------------------------------------------------------------
c64_ram = ptr1 ; use some more expressive identifiers...
rr_ram = ptr2
@@ -25,12 +28,23 @@ temp = tmp1
Lo_Mem = $0100 ; location of Lo_Code (must be below $1000 or above $e000)
.segment "JUMPTABLE"
; ------------------------------------------------------------------------
; Header. Includes jump table
.byte $65,$6d,$64 ;Driver signature
.byte EMD_API_VERSION
module_header _c64_rrr_emd
.addr INSTALL ;Jump Table
; Driver signature
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
; Library reference
.addr $0000
; Jump table
.addr INSTALL
.addr UNINSTALL
.addr PAGECOUNT
.addr MAP
@@ -39,13 +53,17 @@ Lo_Mem = $0100 ;location of Lo_Code (must be below $1000 or above
.addr COPYFROM
.addr COPYTO
; ------------------------------------------------------------------------
.bss
window: .res 256 ; the memory window (256 bytes)
.rodata
dummy: .word window ;a "pseudo"-em_copy_struct, used by em_map/ em_commit
dummy:
.word window ; a "pseudo"-em_copy_struct, used by em_map/ em_commit
.byte 0 ; to pass over to COPYTO/COPYFROM
curpage: .byte $ff ;just this byte is changed according to the desired page
curpage:
.byte $ff ; just this byte is changed according to the desired page
.byte 0
.word 256
@@ -100,7 +118,7 @@ c1: stx $de00 ;try accessing rr-ram
bne no
lda #0
rts
no: asl ;.A still has #2, so return #4: error code for "device not present"
no: asl ; A still has #2, so return #4: error code for "device not present"
rts
c2:
;----------------------------------------------------------------------------------------
@@ -109,6 +127,7 @@ c2:
UNINSTALL:
return_null:
lda #$00 ; always return 32kb (128 pages)
; fall through, skip the LDA
.byte $2c
;----------------------------------------------------------------------------------------
@@ -126,7 +145,8 @@ USE:
cmp #$80 ; valid page?
bcs return_null ; no, return NULL pointer
sta curpage ; set to current page
return_win: lda #<window ;return pointer to window
return_win:
lda #<window ; return pointer to window
ldx #>window
return: rts
@@ -281,5 +301,6 @@ get_struct_data:
lda (aux),y ;length hi-byte
adc c64_ram+1
sta len+1 ;tmp2: length, tmp3 contains end adress of transfer in c64-ram.
rts ;55 bytes
rts
;55 bytes