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 umula0
.import _gotoxy, gotox, gotoy, pusha0
.import gotox, gotoy, pusha0
.import pushax
.import _screen
.import txtcolor

View File

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

View File

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

View File

@ -31,7 +31,6 @@
.import _zones
.import cursor
.import pusha, incsp1, pusha0, pushax, popa
.import umula0
.include "atari7800.inc"
.include "extzp.inc"
@ -47,6 +46,33 @@ blink_time:
.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
; You also need to set the cursorzone to point to the correct cursor Header