1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-01 03:30:20 +00:00

Fix race condition

This commit is contained in:
Karri Kaksonen 2022-04-19 20:01:47 +03:00 committed by mrdudz
parent 7f9909ef81
commit 4ee3e59f19
6 changed files with 29 additions and 42 deletions

View File

@ -4,7 +4,7 @@
.export _clrscr .export _clrscr
.import _screen .import _screen
.import pusha0,pushax .import pushax, __bzero
.include "extzp.inc" .include "extzp.inc"
.code .code
@ -13,22 +13,10 @@
lda #<_screen lda #<_screen
ldx #>_screen ldx #>_screen
sta ptr7800 jsr pushax
stx ptr7800+1 ldx #>(charsperline * screenrows)
ldx #screenrows lda #<(charsperline * screenrows)
@L1: ldy #charsperline jmp __bzero
lda #0
@L2: sta (ptr7800),y
dey
bne @L2
lda ptr7800
clc
adc #charsperline
bcc @L3
inc ptr7800+1
@L3: dex
bne @L1
rts
.endproc .endproc

View File

@ -9,7 +9,7 @@
.constructor initconio .constructor initconio
.include "atari7800.inc" .include "atari7800.inc"
.include "extzp.inc" .include "extzp.inc"
.import _font .import _conio_font
.import _get_tv .import _get_tv
.export _screen .export _screen
.export _zones .export _zones
@ -58,7 +58,7 @@ _screen:
; Cursor ; Cursor
.byte 254 .byte 254
.byte 0 .byte 0
.byte >_font .byte >_conio_font
.byte 0 .byte 0
.endmacro .endmacro
@ -206,7 +206,7 @@ vblankon:
vblankoff: vblankoff:
lda MSTAT lda MSTAT
bpl vblankoff bpl vblankoff
lda #>_font lda #>_conio_font
sta CHBASE sta CHBASE
lda #(CTRL_MODE160 | CTRL_KANGOFF | CTRL_BCBLACK | CTRL_CHAR2B | CTRL_DMAON | CTRL_CKOFF) lda #(CTRL_MODE160 | CTRL_KANGOFF | CTRL_BCBLACK | CTRL_CHAR2B | CTRL_DMAON | CTRL_CKOFF)
sta CTRL sta CTRL

View File

@ -16,10 +16,10 @@
; 0, 2, 4, 6, ... 254 ; 0, 2, 4, 6, ... 254
; Odd indices cannot be used. ; Odd indices cannot be used.
.export _font .export _conio_font
.rodata .rodata
.align 256 .align 256
_font: _conio_font:
.byte $0, $0, $41, $41, $0, $0, $14, $0 .byte $0, $0, $41, $41, $0, $0, $14, $0
.byte $0, $0, $0, $0, $1, $40, $0, $0 .byte $0, $0, $0, $0, $1, $40, $0, $0
.byte $0, $0, $0, $0, $0, $0, $0, $0 .byte $0, $0, $0, $0, $0, $0, $0, $0

View File

@ -4,7 +4,7 @@
.export _mono_clrscr .export _mono_clrscr
.import _mono_screen .import _mono_screen
.import pusha0,pushax .import pushax, __bzero
.include "extzp.inc" .include "extzp.inc"
.code .code
@ -13,22 +13,10 @@
lda #<_mono_screen lda #<_mono_screen
ldx #>_mono_screen ldx #>_mono_screen
sta ptr7800 jsr pushax
stx ptr7800+1 ldx #>(mono_charsperline * screenrows)
ldx #screenrows lda #<(mono_charsperline * screenrows)
@L1: ldy #mono_charsperline jmp __bzero
lda #0
@L2: sta (ptr7800),y
dey
bne @L2
lda ptr7800
clc
adc #mono_charsperline
bcc @L3
inc ptr7800+1
@L3: dex
bne @L1
rts
.endproc .endproc

View File

@ -42,7 +42,7 @@
; ;
blink_time: blink_time:
.byte 140 .byte 255
.code .code
@ -175,6 +175,9 @@ umula0:
; Offset to cursor zone 5. ; Offset to cursor zone 5.
; ;
.proc mono_blink_cursor .proc mono_blink_cursor
lda blink_time
cmp #255
beq @L3
inc blink_time inc blink_time
bne @L3 bne @L3
lda #140 lda #140
@ -197,7 +200,10 @@ umula0:
.segment "ONCE" .segment "ONCE"
mono_init_cursor: mono_init_cursor:
lda #0 lda #0
jmp calccursorzone jsr calccursorzone
lda #0
sta blink_time
rts
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------

View File

@ -42,7 +42,7 @@
; ;
blink_time: blink_time:
.byte 140 .byte 255
.code .code
@ -177,6 +177,9 @@ umula0:
; Offset to cursor zone 5. ; Offset to cursor zone 5.
; ;
.proc blink_cursor .proc blink_cursor
lda blink_time
cmp #255
beq @L3
inc blink_time inc blink_time
bne @L3 bne @L3
lda #140 lda #140
@ -199,6 +202,8 @@ umula0:
init_cursor: init_cursor:
lda #0 lda #0
jsr calccursorzone jsr calccursorzone
lda #0
sta blink_time
rts rts
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------