mirror of
https://github.com/cc65/cc65.git
synced 2024-12-24 11:31:31 +00:00
e47485f925
For quite some time I deliberately didn't add cursor support to the Apple II CONIO imöplementation. I consider it inappropriate to increase the size of cgetc() unduly for a rather seldom used feature. There's no hardware cursor on the Apple II so displaying a cursor during keyboard input means reading the character stored at the cursor location, writing the cursor character, reading the keyboard and finally writing back the character read initially. The naive approach is to reuse the part of cputc() that determines the memory location of the character at the cursor position in order to read the character stored there. However that means to add at least one additional JSR / RTS pair to cputc() adding 4 bytes and 12 cycles :-( Apart from that this approach means still a "too" large cgetc(). The approach implemented instead is to include all functionality required by cgetc() into cputc() - which is to read the current character before writing a new one. This may seem surprising at first glance but an LDA(),Y / TAX sequence adds only 3 bytes and 7 cycles so it cheaper than the JSR / RTS pair and allows to brings down the code increase in cgetc() down to a reasonable value. However so far the internal cputc() code in question saved the X register. Now it uses the X register to return the old character present before writing the new character for cgetc(). This requires some rather small adjustments in other functions using that internal cputc() code.
38 lines
1.1 KiB
ArmAsm
38 lines
1.1 KiB
ArmAsm
;
|
|
; Ullrich von Bassewitz, 08.08.1998
|
|
;
|
|
; void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);
|
|
; void __fastcall__ chline (unsigned char length);
|
|
;
|
|
|
|
.export _chlinexy, _chline, chlinedirect
|
|
.import gotoxy, cputdirect
|
|
|
|
.include "zeropage.inc"
|
|
.include "apple2.inc"
|
|
|
|
_chlinexy:
|
|
pha ; Save the length
|
|
jsr gotoxy ; Call this one, will pop params
|
|
pla ; Restore the length and run into _chline
|
|
|
|
_chline:
|
|
.ifdef __APPLE2ENH__
|
|
ldx #'S' ; MouseText character
|
|
ldy INVFLG
|
|
cpy #$FF ; Normal character display mode?
|
|
beq chlinedirect
|
|
.endif
|
|
ldx #'-' | $80 ; Horizontal line, screen code
|
|
|
|
chlinedirect:
|
|
stx tmp1
|
|
cmp #$00 ; Is the length zero?
|
|
beq done ; Jump if done
|
|
sta tmp2
|
|
: lda tmp1 ; Screen code
|
|
jsr cputdirect ; Direct output
|
|
dec tmp2
|
|
bne :-
|
|
done: rts
|