1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-03 11:29:42 +00:00

Allocate own zp pointer for conio implementation

This commit is contained in:
Karri Kaksonen 2022-04-05 11:13:38 +03:00
parent d5dcea65b7
commit 9caf7cefd8
3 changed files with 14 additions and 12 deletions

View File

@ -39,6 +39,7 @@ MEMORY {
SEGMENTS { SEGMENTS {
ZEROPAGE: load = ZP, type = zp; ZEROPAGE: load = ZP, type = zp;
EXTZP: load = ZP, type = zp;
EXEHDR: load = HEADER, type = ro, optional = yes; EXEHDR: load = HEADER, type = ro, optional = yes;
STARTUP: load = ROMS, type = ro, define = yes; STARTUP: load = ROMS, type = ro, define = yes;
ONCE: load = ROMS, type = ro, define = yes; ONCE: load = ROMS, type = ro, define = yes;

View File

@ -10,10 +10,10 @@
.import _gotoxy, _gotox, _gotoy, tosaddax, tosumula0, pusha0 .import _gotoxy, _gotox, _gotoy, tosaddax, tosumula0, pusha0
.import pushax .import pushax
.import _screen .import _screen
.importzp ptr3
.import CURS_X, CURS_Y .import CURS_X, CURS_Y
.include "atari7800.inc" .include "atari7800.inc"
.include "extzp.inc"
.data .data
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
@ -132,12 +132,12 @@ txtcolor:
lda #<(_screen) lda #<(_screen)
ldx #>(_screen) ldx #>(_screen)
jsr tosaddax jsr tosaddax
sta ptr3 sta ptr7800
stx ptr3+1 stx ptr7800+1
pla pla
ldy #0 ldy #0
sta (ptr3),y sta (ptr7800),y
rts rts
.endproc .endproc

View File

@ -28,10 +28,11 @@
.export CURS_X, CURS_Y .export CURS_X, CURS_Y
.constructor init_cursor .constructor init_cursor
.importzp ptr3, sp .importzp sp
.import _zones .import _zones
.import pusha, incsp1, pusha0, pushax, popax, tosumula0, incax5 .import pusha, incsp1, pusha0, pushax, popax, tosumula0, incax5
.include "atari7800.inc" .include "atari7800.inc"
.include "extzp.inc"
.macpack generic .macpack generic
@ -81,11 +82,11 @@ _cursorzone:
clc clc
adc #<_zones adc #<_zones
sta _cursorzone ; calculate new cursorzone sta _cursorzone ; calculate new cursorzone
sta ptr3 sta ptr7800
txa txa
adc #>_zones adc #>_zones
sta _cursorzone+1 sta _cursorzone+1
sta ptr3+1 sta ptr7800+1
rts rts
.endproc .endproc
@ -112,7 +113,7 @@ _cursorzone:
jsr calccursorzone jsr calccursorzone
ldy #1 ldy #1
lda #0 lda #0
sta (ptr3),y ; disable cursor sta (ptr7800),y ; disable cursor
pla pla
sta CURS_Y sta CURS_Y
jsr calccursorzone jsr calccursorzone
@ -120,7 +121,7 @@ _cursorzone:
beq @L1 beq @L1
lda #30 ; enable cursor lda #30 ; enable cursor
@L1: ldy #1 @L1: ldy #1
sta (ptr3),y sta (ptr7800),y
rts rts
.endproc .endproc
@ -136,15 +137,15 @@ _cursorzone:
tay tay
lda _cursorzone lda _cursorzone
ldx _cursorzone+1 ldx _cursorzone+1
sta ptr3 sta ptr7800
stx ptr3+1 stx ptr7800+1
tya tya
ldy #3 ldy #3
clc clc
rol rol
rol rol
rol rol
sta (ptr3),y sta (ptr7800),y
rts rts
.endproc .endproc