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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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