add chline, cvline functions

This commit is contained in:
Konstantin
2025-06-13 12:50:39 +03:00
parent 9afe980124
commit c28bafa581
5 changed files with 85 additions and 7 deletions

View File

@@ -32,7 +32,12 @@
#define CH_CURS_UP 0x19
#define CH_CURS_DOWN 0x1A
#define CH_ESC 0x1B
#define CH_HLINE 0x1B
#define CH_VLINE 0x5C
#define CH_ULCORNER 0x10
#define CH_URCORNER 0x12
#define CH_LLCORNER 0x1D
#define CH_LRCORNER 0x1F
/* Masks for joy_read */
#define JOY_UP_MASK 0x10
@@ -68,4 +73,4 @@ void rebootafterexit (void);
/* End of agat.h */
#endif //_AGAT_H
#endif

33
libsrc/agat/chline.s Normal file
View File

@@ -0,0 +1,33 @@
;
; Ullrich von Bassewitz, 08.08.1998
; Colin Leroy-Mira, 26.05.2025
; Konstantin Fedorov, 12.06.2025
;
; void chlinexy (unsigned char x, unsigned char y, unsigned char length);
; void chline (unsigned char length);
;
.export _chlinexy, _chline, chlinedirect
.import gotoxy, putchar
.include "zeropage.inc"
_chlinexy:
pha ; Save the length
jsr gotoxy ; Call this one, will pop params
pla ; Restore the length and run into _chline
_chline:
ldx #$1B ; horizontal line character
chlinedirect:
stx tmp1
cmp #$00 ; Is the length zero?
beq done ; Jump if done
sta tmp2
: lda tmp1 ; Screen code
jsr putchar ; Direct output
dec tmp2
bne :-
done: rts

View File

@@ -1,12 +1,13 @@
;
; Oleg A. Odintsov, Moscow, 2024
; Konstantin Fedorov, 12.06.2025
;
; void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);
; void __fastcall__ cputc (char c);
;
.import COUT
.export _cputcxy, _cputc
.export _cputcxy, _cputc, newline, putchar,putchardirect
.import gotoxy, VTABZ
.include "agat.inc"
@@ -15,20 +16,21 @@ _cputcxy:
jsr gotoxy
pla
_cputc:
cmp #$0D
cmp #$0D ; Test for \r = carriage return
bne notleft
ldy #$00
sty CH
rts
notleft:
cmp #$0A
cmp #$0A ; Test for \n = line feed
beq newline
putchar:
ldy CH
sta (BASL),Y
iny
lda TATTR
bmi wch
bmi wch ; Skip if t64
sta (BASL),Y
iny
wch:
@@ -47,3 +49,12 @@ newline:
: jmp VTABZ
noend:
rts
putchardirect:
ldy CH
sta (BASL),Y
lda TATTR
bmi :+
iny
sta (BASL),Y
: rts

29
libsrc/agat/cvline.s Normal file
View File

@@ -0,0 +1,29 @@
;
; Ullrich von Bassewitz, 08.08.1998
; Colin Leroy-Mira, 26.05.2025
; Konstantin Fedorov, 12.06.2025
;
; void cvlinexy (unsigned char x, unsigned char y, unsigned char length);
; void cvline (unsigned char length);
;
.export _cvlinexy, _cvline
.import gotoxy, putchardirect, newline
.include "zeropage.inc"
_cvlinexy:
pha ; Save the length
jsr gotoxy ; Call this one, will pop params
pla ; Restore the length and run into _cvline
_cvline:
cmp #$00 ; Is the length zero?
beq done ; Jump if done
sta tmp2
: lda #$5C ; vertical line character
jsr putchardirect ; Write, no cursor advance
jsr newline ; Advance cursor to next line
dec tmp2
bne :-
done: rts

View File

@@ -11,5 +11,5 @@
HOME:
lda #$8C
jsr COUT
jmp COUT
rts