1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-02 09:34:22 +00:00

Renaming: workingscreen -> altscreen, some deduplication

This commit is contained in:
mc78 2024-08-28 13:32:16 +02:00
parent 6565fb8b11
commit 0331ef1824

View File

@ -8,7 +8,7 @@
.include "c64.inc" .include "c64.inc"
.importzp ptr1 .importzp sp, ptr1
.import popa, PLOT .import popa, PLOT
.import _restorecursorfrom, _savecursorto .import _restorecursorfrom, _savecursorto
.export _cbm_init_alt_screen, _cbm_set_alt_screen, _cbm_set_def_screen .export _cbm_init_alt_screen, _cbm_set_alt_screen, _cbm_set_def_screen
@ -16,13 +16,14 @@
.proc _cbm_set_alt_screen .proc _cbm_set_alt_screen
ldx screen_selected ; If alternate screen is already set, then error ldx screen_selected ; If alternate screen is already set, then error
bne @error sec ; set error flag
bne @return
ldx SCREEN_HI ldx SCREEN_HI
stx old_screen_hi stx old_screen_hi
lda alt_screen_addr lda alt_screen_addr
beq @error ; not initialized beq @return ; not initialized
sta SCREEN_HI ; Tell kernal to which memory screen output will go sta SCREEN_HI ; Tell kernal to which memory screen output will go
lda #<def_screen_crsr_pos lda #<def_screen_crsr_pos
@ -32,22 +33,19 @@
lda #<alt_screen_crsr_pos lda #<alt_screen_crsr_pos
ldx #>alt_screen_crsr_pos ldx #>alt_screen_crsr_pos
jsr _restorecursorfrom jsr _restorecursorfrom
inc screen_selected inc screen_selected
lda #0 clc ; clear error flag
tax @return:
rts jmp return_exit_status
@error:
lda #$01
ldx #$00
rts
.endproc .endproc
.proc _cbm_set_def_screen .proc _cbm_set_def_screen
lda screen_selected ; If original screen is already set, then error lda screen_selected ; If original screen is already set, then error
beq @error sec ; set error flag
beq return_exit_status
lda old_screen_hi lda old_screen_hi
sta SCREEN_HI sta SCREEN_HI
@ -58,33 +56,30 @@
dec screen_selected dec screen_selected
lda #0 clc ; clear error fla
tax bcc return_exit_status
rts
@error:
lda #$01
ldx #$00
rts
.endproc .endproc
.proc _cbm_init_alt_screen .proc _cbm_init_alt_screen
jsr check_screen_addr jsr check_screen_addr
bcs @error bcs @return
; Pay attention, that carry is clear from here on
sta alt_screen_addr sta alt_screen_addr
sta ptr1 + 1 sta ptr1 + 1
lda #0 ldy #0
sta ptr1 sty ptr1
jsr popa ; fetch fillchar lda (sp), y ; fetch fillchar (does not influence carry)
ldy #0 ldy #0
ldx #4 ; This may depend on the target system ldx #4 ; This may depend on the target system
@fill_screen: @fill_screen:
sta (ptr1), y sta (ptr1), y
iny iny
bne @fill_screen bne @fill_screen
inc ptr1 + 1 inc ptr1 + 1
dex dex
bne @fill_screen bne @fill_screen
@ -92,14 +87,9 @@
stx alt_screen_crsr_pos ; Init cursor pos to 0/0 on alt screen stx alt_screen_crsr_pos ; Init cursor pos to 0/0 on alt screen
stx alt_screen_crsr_pos + 1 stx alt_screen_crsr_pos + 1
lda #0 @return:
tax
rts
@error:
jsr popa jsr popa
lda #$01 jmp return_exit_status
ldx #$00
rts
.endproc .endproc
@ -129,6 +119,17 @@
.endproc .endproc
.proc return_exit_status
; return EXIT_SUCCESS, if clc
; return EXIT_FAILURE, if sec
lda #0
tax
bcc :+
adc #0
: rts
.endproc
; Screen addr must not be set to $1000-$1fff nor $9000-$9fff for shadowing reasons and not to $d000-$dfff, due to registers ; Screen addr must not be set to $1000-$1fff nor $9000-$9fff for shadowing reasons and not to $d000-$dfff, due to registers
reject_range_start: reject_range_start:
.byte $d0, $90, $10 .byte $d0, $90, $10