1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-27 15:29:46 +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 {
ZEROPAGE: load = ZP, type = zp;
EXTZP: load = ZP, type = zp;
EXEHDR: load = HEADER, type = ro, optional = yes;
STARTUP: 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 pushax
.import _screen
.importzp ptr3
.import CURS_X, CURS_Y
.include "atari7800.inc"
.include "extzp.inc"
.data
;-----------------------------------------------------------------------------
@ -132,12 +132,12 @@ txtcolor:
lda #<(_screen)
ldx #>(_screen)
jsr tosaddax
sta ptr3
stx ptr3+1
sta ptr7800
stx ptr7800+1
pla
ldy #0
sta (ptr3),y
sta (ptr7800),y
rts
.endproc

View File

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