Fix codestyle

This commit is contained in:
Konstantin
2025-06-07 12:36:49 +03:00
parent 5ff18c1ebc
commit 1a109c0b34
14 changed files with 215 additions and 219 deletions

View File

@@ -14,38 +14,38 @@
/* Color defines */ /* Color defines */
#define COLOR_BLACK 0x00 #define COLOR_BLACK 0x00
#define COLOR_RED 0x01 #define COLOR_RED 0x01
#define COLOR_GREEN 0x02 #define COLOR_GREEN 0x02
#define COLOR_YELLOW 0x03 #define COLOR_YELLOW 0x03
#define COLOR_BLUE 0x04 #define COLOR_BLUE 0x04
#define COLOR_MAGENTA 0x05 #define COLOR_MAGENTA 0x05
#define COLOR_CYAN 0x06 #define COLOR_CYAN 0x06
#define COLOR_WHITE 0x07 #define COLOR_WHITE 0x07
/* Characters codes */ /* Characters codes */
#define CH_CTRL_C 0x03 #define CH_CTRL_C 0x03
#define CH_ENTER 0x0D #define CH_ENTER 0x0D
#define CH_ESC 0x1B #define CH_ESC 0x1B
#define CH_CURS_LEFT 0x08 #define CH_CURS_LEFT 0x08
#define CH_CURS_RIGHT 0x15 #define CH_CURS_RIGHT 0x15
#define CH_CURS_UP 0x19 #define CH_CURS_UP 0x19
#define CH_CURS_DOWN 0x1A #define CH_CURS_DOWN 0x1A
#define CH_ESC 0x1B #define CH_ESC 0x1B
/* Masks for joy_read */ /* Masks for joy_read */
#define JOY_UP_MASK 0x10 #define JOY_UP_MASK 0x10
#define JOY_DOWN_MASK 0x20 #define JOY_DOWN_MASK 0x20
#define JOY_LEFT_MASK 0x04 #define JOY_LEFT_MASK 0x04
#define JOY_RIGHT_MASK 0x08 #define JOY_RIGHT_MASK 0x08
#define JOY_BTN_1_MASK 0x40 #define JOY_BTN_1_MASK 0x40
#define JOY_BTN_2_MASK 0x80 #define JOY_BTN_2_MASK 0x80
/* Return codes for get_ostype */ /* Return codes for get_ostype */
#define AGAT_UNKNOWN 0x00 #define AGAT_UNKNOWN 0x00
#define AGAT_7 0x10 /* Agat 7 */ #define AGAT_7 0x10 /* Agat 7 */
#define AGAT_9 0x20 /* Agat 9 */ #define AGAT_9 0x20 /* Agat 9 */
/*****************************************************************************/ /*****************************************************************************/

View File

@@ -4,14 +4,14 @@
; void __fastcall__ cclear (unsigned char length); ; void __fastcall__ cclear (unsigned char length);
; ;
.export _cclear .export _cclear
.import COUT .import COUT
.include "zeropage.inc" .include "zeropage.inc"
_cclear: _cclear:
sta ptr1 sta ptr1
lda #$A0 lda #$A0
next: jsr COUT next: jsr COUT
dec ptr1 dec ptr1
bne next bne next
rts rts

View File

@@ -4,20 +4,19 @@
; char cgetc (void); ; char cgetc (void);
; ;
.export _cgetc .export _cgetc
.import cursor .import cursor
.include "agat.inc" .include "agat.inc"
_cgetc: _cgetc:
lda #$DF ; _ lda #$DF ; _
bit cursor bit cursor
bne hascur bne hascur
lda #$00 lda #$00
hascur: sta CURSOR hascur: sta CURSOR
jsr j1 jsr j1
cmp #$A0 cmp #$A0
bpl :+ bpl :+
and #$7F and #$7F
: rts : rts
j1: jmp (VCIN) j1: jmp (VCIN)

View File

@@ -4,7 +4,7 @@
; void clrscr (void); ; void clrscr (void);
; ;
.export _clrscr .export _clrscr
.import HOME .import HOME
_clrscr := HOME _clrscr := HOME

View File

@@ -5,17 +5,16 @@
; ;
.export _textcolor .export _textcolor
.include "agat.inc" .include "agat.inc"
_textcolor: _textcolor:
ldx TATTR ldx TATTR
eor TATTR eor TATTR
and #$07 and #$07
eor TATTR eor TATTR
sta TATTR sta TATTR
txa txa
and #$0F and #$0F
rts rts

View File

@@ -4,11 +4,11 @@
; COUT routine ; COUT routine
; ;
.export COUT .export COUT
.include "agat.inc" .include "agat.inc"
COUT: COUT:
cmp #$10 cmp #$10
bpl out bpl out
ora #$80 ora #$80
out: jmp (VCOUT) out: jmp (VCOUT)

View File

@@ -5,41 +5,41 @@
; void __fastcall__ cputc (char c); ; void __fastcall__ cputc (char c);
; ;
.import COUT .import COUT
.export _cputcxy, _cputc .export _cputcxy, _cputc
.import gotoxy, VTABZ .import gotoxy, VTABZ
.include "agat.inc" .include "agat.inc"
_cputcxy: _cputcxy:
pha pha
jsr gotoxy jsr gotoxy
pla pla
_cputc: _cputc:
cmp #$0D cmp #$0D
bne notleft bne notleft
ldy #$00 ldy #$00
sty CH sty CH
rts rts
notleft:cmp #$0A notleft:cmp #$0A
beq newline beq newline
putchar: putchar:
ldy CH ldy CH
sta (BASL),Y sta (BASL),Y
iny iny
lda TATTR lda TATTR
bmi wch bmi wch
sta (BASL),Y sta (BASL),Y
iny iny
wch: sty CH wch:sty CH
cpy WNDWDTH cpy WNDWDTH
bcc noend bcc noend
ldy #$00 ldy #$00
sty CH sty CH
newline:inc CV newline:inc CV
lda CV lda CV
cmp WNDBTM cmp WNDBTM
bcc :+ bcc :+
lda WNDTOP lda WNDTOP
sta CV sta CV
: jmp VTABZ : jmp VTABZ
noend: rts noend: rts

View File

@@ -14,61 +14,61 @@
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
.segment "STARTUP" .segment "STARTUP"
jsr init jsr init
jsr zerobss jsr zerobss
jsr callmain jsr callmain
_exit: ldx #<exit _exit: ldx #<exit
lda #>exit lda #>exit
jsr reset jsr reset
jsr donelib jsr donelib
exit: ldx #$02 exit: ldx #$02
: lda rvsave,x : lda rvsave,x
sta SOFTEV,x sta SOFTEV,x
dex dex
bpl :- bpl :-
ldx #zpspace-1 ldx #zpspace-1
: lda zpsave,x : lda zpsave,x
sta sp,x sta sp,x
dex dex
bpl :- bpl :-
ldx #$FF ldx #$FF
txs txs
jmp DOSWARM jmp DOSWARM
.segment "ONCE" .segment "ONCE"
init: ldx #zpspace-1 init: ldx #zpspace-1
: lda sp,x : lda sp,x
sta zpsave,x sta zpsave,x
dex dex
bpl :- bpl :-
ldx #$02 ldx #$02
: lda SOFTEV,x : lda SOFTEV,x
sta rvsave,x sta rvsave,x
dex dex
bpl :- bpl :-
lda HIMEM lda HIMEM
ldx HIMEM+1 ldx HIMEM+1
sta sp sta sp
stx sp+1 stx sp+1
ldx #<_exit ldx #<_exit
lda #>_exit lda #>_exit
jsr reset jsr reset
jmp initlib jmp initlib
.code .code
reset: stx SOFTEV reset: stx SOFTEV
sta SOFTEV+1 sta SOFTEV+1
eor #$A5 eor #$A5
sta PWREDUP sta PWREDUP
rts rts
.segment "INIT" .segment "INIT"
zpsave: .res zpspace zpsave: .res zpspace
rvsave: .res 3 rvsave: .res 3

View File

@@ -12,17 +12,17 @@
.include "agat.inc" .include "agat.inc"
gotoxy: gotoxy:
jsr popa ; Get Y jsr popa ; Get Y
_gotoxy: _gotoxy:
clc clc
adc WNDTOP adc WNDTOP
sta CV ; Store Y sta CV ; Store Y
jsr VTABZ jsr VTABZ
jsr popa ; Get X jsr popa ; Get X
_gotox: _gotox:
bit TATTR bit TATTR
bmi t64 bmi t64
asl asl
t64: t64:
sta CH ; Store X sta CH ; Store X
rts rts

View File

@@ -5,14 +5,12 @@
; void __fastcall__ gotoy (unsigned char y); ; void __fastcall__ gotoy (unsigned char y);
; ;
.import VTABZ .import VTABZ
.export _gotoy .export _gotoy
.include "agat.inc" .include "agat.inc"
_gotoy: _gotoy:
clc clc
adc WNDTOP adc WNDTOP
sta CV sta CV
jmp VTABZ jmp VTABZ

View File

@@ -10,6 +10,6 @@
.include "agat.inc" .include "agat.inc"
HOME: HOME:
lda #$8C lda #$8C
jsr COUT jsr COUT
rts rts

View File

@@ -6,33 +6,33 @@
; unsigned char __fastcall__ flash (unsigned char onoff) ; unsigned char __fastcall__ flash (unsigned char onoff)
; ;
.export _revers, _flash .export _revers, _flash
.include "agat.inc" .include "agat.inc"
_revers: _revers:
tax tax
beq noinv beq noinv
lda TATTR lda TATTR
and #$D7 and #$D7
sta TATTR sta TATTR
rts rts
noinv: noinv:
lda TATTR lda TATTR
ora #$20 ora #$20
sta TATTR sta TATTR
rts rts
_flash: _flash:
tax tax
beq noflash beq noflash
lda TATTR lda TATTR
and #$DF and #$DF
ora #$08 ora #$08
sta TATTR sta TATTR
rts rts
noflash: noflash:
lda TATTR lda TATTR
ora #$20 ora #$20
sta TATTR sta TATTR
rts rts

View File

@@ -4,21 +4,21 @@
; VTABZ routine ; VTABZ routine
; ;
.export VTABZ .export VTABZ
.include "agat.inc" .include "agat.inc"
VTABZ: VTABZ:
lda CV lda CV
ror ror
ror ror
ror ror
and #$C0 and #$C0
sta BASL sta BASL
lda CV lda CV
lsr lsr
lsr lsr
eor BASH eor BASH
and #$07 and #$07
eor BASH eor BASH
sta BASH sta BASH
rts rts

View File

@@ -10,10 +10,10 @@
.include "agat.inc" .include "agat.inc"
_wherex: _wherex:
lda CH lda CH
bit TATTR bit TATTR
bmi t64 bmi t64
lsr lsr
t64: t64:
ldx #$00 ldx #$00
rts rts