mirror of
https://github.com/cc65/cc65.git
synced 2024-06-07 07:29:33 +00:00
libsrc/*/kplot.s: Use cbm_kernal.inc symbols, not hardcoded addrs
On C64, VIC-20 and Plus/4, the conio library PLOT routine uses direct calls into the Kernal, including the Kernal PLOT routine that we're replacing. These were previously hardcoded addresses; we change these to use the symbols for those routines defined in cbm_kernal.inc. (This changes no functionality.) To do this, we need to import cbm_kernal.inc in a namespace so we don't have a collision between the PLOT that we're defining and the Kernal definition. We also add a UPDCRAMPTR symbol (used by kplot for VIC-20 and C64) to the direct entry kernal routines in in cbm_kernal.inc, and expand the comments describing what the "direct entry" Kernal routines are. <greg.king5@verizon.net> (GitHub: greg-king5) came up with this idea and did initial testing of it. This has been tested on VICE xvic, x64 and xplus4 emulators with a program that does a cputs() call (github.com/0cjs/vic20cc65) to confirm that it works the same way after as it did before.
This commit is contained in:
parent
9fa90e2265
commit
128991d868
|
@ -100,14 +100,26 @@ UDTIM := $FFEA
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; Kernal routines, direct entries
|
; Kernal routines, direct entries
|
||||||
|
;
|
||||||
|
; Unlike the above, these are not standard functions with entries in the jump
|
||||||
|
; table. They do not exist in all Kernals, and where they do the entry point is
|
||||||
|
; specific to that particular machine and possibly even Kernal version.
|
||||||
|
;
|
||||||
|
; This list is not comprehensive: missing items for particular machines
|
||||||
|
; should be added as needed.
|
||||||
|
;
|
||||||
|
; UPDCRAMPTR: Updates the color RAM pointer to match the screen RAM pointer.
|
||||||
|
;
|
||||||
|
|
||||||
.if .def(__VIC20__)
|
.if .def(__VIC20__)
|
||||||
CLRSCR := $E55F
|
CLRSCR := $E55F
|
||||||
KBDREAD := $E5CF
|
KBDREAD := $E5CF
|
||||||
|
UPDCRAMPTR := $EAB2
|
||||||
.elseif .def(__C64__)
|
.elseif .def(__C64__)
|
||||||
CLRSCR := $E544
|
CLRSCR := $E544
|
||||||
KBDREAD := $E5B4
|
KBDREAD := $E5B4
|
||||||
NMIEXIT := $FEBC
|
NMIEXIT := $FEBC
|
||||||
|
UPDCRAMPTR := $EA24
|
||||||
.elseif .def(__C128__)
|
.elseif .def(__C128__)
|
||||||
CLRSCR := $C142
|
CLRSCR := $C142
|
||||||
KBDREAD := $C006
|
KBDREAD := $C006
|
||||||
|
|
|
@ -7,15 +7,16 @@
|
||||||
|
|
||||||
.export PLOT
|
.export PLOT
|
||||||
|
|
||||||
|
.scope KERNAL
|
||||||
|
.include "cbm_kernal.inc"
|
||||||
|
.endscope
|
||||||
|
|
||||||
.proc PLOT
|
.proc PLOT
|
||||||
|
|
||||||
bcs @L1
|
bcs @L1
|
||||||
jsr $FFF0 ; Set cursor position
|
jsr KERNAL::PLOT ; Set cursor position using original ROM PLOT
|
||||||
jmp $EA24 ; Set pointer to color RAM
|
jmp KERNAL::UPDCRAMPTR ; Set pointer to color RAM to match new cursor position
|
||||||
|
|
||||||
@L1: jmp $FFF0 ; Get cursor position
|
@L1: jmp KERNAL::PLOT ; Get cursor position
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,16 +6,17 @@
|
||||||
|
|
||||||
.export PLOT
|
.export PLOT
|
||||||
|
|
||||||
|
.scope KERNAL
|
||||||
|
.include "cbm_kernal.inc"
|
||||||
|
.endscope
|
||||||
|
|
||||||
.include "plus4.inc"
|
.include "plus4.inc"
|
||||||
|
|
||||||
.segment "LOWCODE" ; Must go into low memory
|
.segment "LOWCODE" ; Must go into low memory
|
||||||
|
|
||||||
.proc PLOT
|
.proc PLOT
|
||||||
sta ENABLE_ROM ; Enable the ROM
|
sta ENABLE_ROM ; Enable the ROM
|
||||||
jsr $FFF0 ; Call the ROM routine
|
jsr KERNAL::PLOT ; Call the ROM routine
|
||||||
sta ENABLE_RAM ; Switch back to RAM
|
sta ENABLE_RAM ; Switch back to RAM
|
||||||
rts ; Return to caller
|
rts ; Return to caller
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,14 +7,16 @@
|
||||||
|
|
||||||
.export PLOT
|
.export PLOT
|
||||||
|
|
||||||
|
.scope KERNAL
|
||||||
|
.include "cbm_kernal.inc"
|
||||||
|
.endscope
|
||||||
|
|
||||||
.proc PLOT
|
.proc PLOT
|
||||||
|
|
||||||
bcs @L1
|
bcs @L1
|
||||||
jsr $FFF0 ; Set cursor position
|
jsr KERNAL::PLOT ; Set cursor position using original ROM PLOT
|
||||||
jmp $EAB2 ; Set pointer to color RAM
|
jmp KERNAL::UPDCRAMPTR ; Set pointer to color RAM to match new cursor position
|
||||||
|
|
||||||
@L1: jmp $FFF0 ; Get cursor position
|
@L1: jmp KERNAL::PLOT ; Get cursor position
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user