1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-07 07:29:33 +00:00

Not sharing umula0 and fix cursor bug

This commit is contained in:
Karri Kaksonen 2022-04-18 13:49:29 +03:00
parent 6a6aa094fa
commit 6671a92a8e
4 changed files with 37 additions and 13 deletions

View File

@ -6,8 +6,7 @@
; ;
.export _cputc .export _cputc
.export umula0 .import gotox, gotoy, pusha0
.import _gotoxy, gotox, gotoy, pusha0
.import pushax .import pushax
.import _screen .import _screen
.import txtcolor .import txtcolor

View File

@ -6,7 +6,7 @@
; ;
.export _mono_cputc .export _mono_cputc
.import _mono_gotoxy, _mono_gotox, _mono_gotoy, pusha0 .import mono_gotox, mono_gotoy, pusha0
.import pushax .import pushax
.import _mono_screen .import _mono_screen
@ -52,7 +52,7 @@ umula0:
cmp #$0A ; LF cmp #$0A ; LF
bne @L4 bne @L4
@L1: lda #0 ; newline @L1: lda #0 ; newline
jsr _mono_gotox jsr mono_gotox
lda CURS_Y lda CURS_Y
cmp #(screenrows-1) cmp #(screenrows-1)
bne @L2 bne @L2
@ -60,7 +60,7 @@ umula0:
beq @L3 beq @L3
@L2: clc @L2: clc
adc #1 adc #1
@L3: jmp _mono_gotoy @L3: jmp mono_gotoy
@L4: @L4:
pha pha
@ -96,7 +96,7 @@ umula0:
beq @L1 beq @L1
clc clc
adc #1 adc #1
jmp _mono_gotox jmp mono_gotox
.endproc .endproc

View File

@ -23,7 +23,7 @@
; definitely not allow direct access to the variables. ; definitely not allow direct access to the variables.
; ;
.export mono_gotoxy, _mono_gotoxy, _mono_gotox, _mono_gotoy .export mono_gotoxy, _mono_gotoxy, mono_gotox, mono_gotoy
.constructor mono_init_cursor .constructor mono_init_cursor
.interruptor mono_blink_cursor .interruptor mono_blink_cursor
@ -96,7 +96,6 @@ umula0:
adc #<_mono_zones adc #<_mono_zones
sta cursorzone ; calculate new cursorzone sta cursorzone ; calculate new cursorzone
txa txa
clc
adc #>_mono_zones adc #>_mono_zones
sta cursorzone+1 sta cursorzone+1
rts rts
@ -118,7 +117,7 @@ umula0:
; Enable cursor ; Enable cursor
; if showcursor cursorzone[1] = 31 ; if showcursor cursorzone[1] = 31
; ;
.proc _mono_gotoy .proc mono_gotoy
pha pha
lda CURS_Y lda CURS_Y
@ -143,7 +142,7 @@ umula0:
; You also need to set the hpos offset to the correct value on this line ; You also need to set the hpos offset to the correct value on this line
; cursorzone[3] = 4 * CURS_X? ; cursorzone[3] = 4 * CURS_X?
; ;
.proc _mono_gotox .proc mono_gotox
sta CURS_X sta CURS_X
ldy #3 ldy #3
@ -160,9 +159,9 @@ umula0:
; ;
.proc _mono_gotoxy .proc _mono_gotoxy
jsr _mono_gotoy jsr mono_gotoy
jsr popa jsr popa
jsr _mono_gotox jsr mono_gotox
rts rts
.endproc .endproc

View File

@ -31,7 +31,6 @@
.import _zones .import _zones
.import cursor .import cursor
.import pusha, incsp1, pusha0, pushax, popa .import pusha, incsp1, pusha0, pushax, popa
.import umula0
.include "atari7800.inc" .include "atari7800.inc"
.include "extzp.inc" .include "extzp.inc"
@ -47,6 +46,33 @@ blink_time:
.code .code
;---------------------------------------------------------------------------
; 8x16 routine
umula0:
ldy #8 ; Number of bits
lda #0
lsr ptr7800 ; Get first bit into carry
@L0: bcc @L1
clc
adc ptrtmp
tax
lda ptrtmp+1 ; hi byte of left op
clc
adc ptr7800+1
sta ptr7800+1
txa
@L1: ror ptr7800+1
ror a
ror ptr7800
dey
bne @L0
tax
lda ptr7800 ; Load the result
rts
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; Calculate cursorzone address ; Calculate cursorzone address
; You also need to set the cursorzone to point to the correct cursor Header ; You also need to set the cursorzone to point to the correct cursor Header