From 6671a92a8edbdadfa904923c98c665431ea199db Mon Sep 17 00:00:00 2001 From: Karri Kaksonen Date: Mon, 18 Apr 2022 13:49:29 +0300 Subject: [PATCH] Not sharing umula0 and fix cursor bug --- libsrc/atari7800/cputc.s | 3 +-- libsrc/atari7800/mono_cputc.s | 8 ++++---- libsrc/atari7800/mono_setcursor.s | 11 +++++------ libsrc/atari7800/setcursor.s | 28 +++++++++++++++++++++++++++- 4 files changed, 37 insertions(+), 13 deletions(-) diff --git a/libsrc/atari7800/cputc.s b/libsrc/atari7800/cputc.s index fb95277d2..9ec84bfe5 100644 --- a/libsrc/atari7800/cputc.s +++ b/libsrc/atari7800/cputc.s @@ -6,8 +6,7 @@ ; .export _cputc - .export umula0 - .import _gotoxy, gotox, gotoy, pusha0 + .import gotox, gotoy, pusha0 .import pushax .import _screen .import txtcolor diff --git a/libsrc/atari7800/mono_cputc.s b/libsrc/atari7800/mono_cputc.s index 4a7e5638c..aa6787e05 100644 --- a/libsrc/atari7800/mono_cputc.s +++ b/libsrc/atari7800/mono_cputc.s @@ -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 diff --git a/libsrc/atari7800/mono_setcursor.s b/libsrc/atari7800/mono_setcursor.s index 060f45cde..fa02b1744 100644 --- a/libsrc/atari7800/mono_setcursor.s +++ b/libsrc/atari7800/mono_setcursor.s @@ -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 diff --git a/libsrc/atari7800/setcursor.s b/libsrc/atari7800/setcursor.s index 99e051cff..d94eb8094 100644 --- a/libsrc/atari7800/setcursor.s +++ b/libsrc/atari7800/setcursor.s @@ -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