mirror of
https://github.com/cc65/cc65.git
synced 2025-08-08 06:25:17 +00:00
Enhancements for cursor calculation
Fix handling of newlines. Wrap around to top of screen when newline occurs in last line. Initialize screen width in crt0.s.
This commit is contained in:
@@ -44,14 +44,12 @@ L3: iny
|
|||||||
rts
|
rts
|
||||||
|
|
||||||
newline:
|
newline:
|
||||||
lda SCR_LINELEN ; xsize-1
|
inc CURS_Y
|
||||||
sec ; Account for -1 above
|
lda CURS_Y
|
||||||
adc SCREEN_PTR
|
cmp #24 ; screen height 25 lines hardcoded
|
||||||
sta SCREEN_PTR
|
bne plot
|
||||||
bcc L4
|
lda #0 ; wrap around to line 0
|
||||||
inc SCREEN_PTR+1
|
sta CURS_Y
|
||||||
L4: inc CURS_Y
|
|
||||||
rts
|
|
||||||
|
|
||||||
plot: ldy CURS_Y
|
plot: ldy CURS_Y
|
||||||
lda ScrLo,y
|
lda ScrLo,y
|
||||||
|
@@ -13,6 +13,7 @@
|
|||||||
.import zerobss, initlib, donelib
|
.import zerobss, initlib, donelib
|
||||||
|
|
||||||
.include "zeropage.inc"
|
.include "zeropage.inc"
|
||||||
|
.include "extzp.inc"
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; Place the startup code in a special segment
|
; Place the startup code in a special segment
|
||||||
@@ -26,6 +27,13 @@ _init: LDX #$FF ; Initialize stack pointer to $01FF
|
|||||||
TXS
|
TXS
|
||||||
CLD ; Clear decimal mode
|
CLD ; Clear decimal mode
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; Initialize screen width
|
||||||
|
; TODO: Can initialization be done in a more idiomatic way?
|
||||||
|
; TODO: Create function for changing screen width
|
||||||
|
LDA #$18
|
||||||
|
STA SCR_LINELEN
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; Set cc65 argument stack pointer
|
; Set cc65 argument stack pointer
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user