mirror of
https://github.com/cc65/cc65.git
synced 2025-02-12 21:31:10 +00:00
fixed screensize, timertick, revers mode
This commit is contained in:
parent
1414411bba
commit
21ef6b8510
@ -14,8 +14,7 @@ BGCOLOR = $38
|
|||||||
tickcount = $39 ;4
|
tickcount = $39 ;4
|
||||||
|
|
||||||
screenrows = (224/8)
|
screenrows = (224/8)
|
||||||
charsperline = (512/8)
|
charsperline = 61
|
||||||
xsize = charsperline
|
|
||||||
|
|
||||||
CH_HLINE = 7
|
CH_HLINE = 7
|
||||||
CH_VLINE = 7
|
CH_VLINE = 7
|
||||||
|
@ -100,9 +100,8 @@ unsigned _clocks_per_sec (void);
|
|||||||
# define CLK_TCK 50 /* POSIX */
|
# define CLK_TCK 50 /* POSIX */
|
||||||
# define CLOCKS_PER_SEC 50 /* ANSI */
|
# define CLOCKS_PER_SEC 50 /* ANSI */
|
||||||
#elif defined(__PCE__)
|
#elif defined(__PCE__)
|
||||||
/* FIXME: we likely need to read it at runtime */
|
# define CLK_TCK 60 /* POSIX */
|
||||||
# define CLK_TCK 50 /* POSIX */
|
# define CLOCKS_PER_SEC 60 /* ANSI */
|
||||||
# define CLOCKS_PER_SEC 50 /* ANSI */
|
|
||||||
#elif defined(__GEOS__)
|
#elif defined(__GEOS__)
|
||||||
# define CLK_TCK 1 /* POSIX */
|
# define CLK_TCK 1 /* POSIX */
|
||||||
# define CLOCKS_PER_SEC 1 /* ANSI */
|
# define CLOCKS_PER_SEC 1 /* ANSI */
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
;
|
;
|
||||||
; Screen size variables
|
; Screen size variables
|
||||||
;
|
;
|
||||||
|
.include "pce.inc"
|
||||||
|
|
||||||
.export _screensize
|
.export screensize
|
||||||
_screensize:
|
screensize:
|
||||||
ldx xsize
|
ldx xsize
|
||||||
ldy ysize
|
ldy ysize
|
||||||
rts
|
rts
|
||||||
@ -13,5 +14,5 @@ _screensize:
|
|||||||
.rodata
|
.rodata
|
||||||
.export xsize, ysize
|
.export xsize, ysize
|
||||||
|
|
||||||
xsize: .byte 64
|
xsize: .byte charsperline
|
||||||
ysize: .byte 28
|
ysize: .byte screenrows
|
@ -51,7 +51,7 @@ set_palette:
|
|||||||
;
|
;
|
||||||
;----------------------------------------------------------------------------
|
;----------------------------------------------------------------------------
|
||||||
|
|
||||||
.importzp ptr1
|
.importzp ptr1, tmp1
|
||||||
conio_init:
|
conio_init:
|
||||||
; Load font
|
; Load font
|
||||||
st0 #VDC_MAWR
|
st0 #VDC_MAWR
|
||||||
@ -65,10 +65,35 @@ conio_init:
|
|||||||
sta ptr1+1
|
sta ptr1+1
|
||||||
|
|
||||||
st0 #VDC_VWR ; VWR
|
st0 #VDC_VWR ; VWR
|
||||||
|
|
||||||
|
lda #0
|
||||||
|
sta tmp1
|
||||||
|
jsr copy
|
||||||
|
|
||||||
|
lda #<font
|
||||||
|
sta ptr1
|
||||||
|
lda #>font
|
||||||
|
sta ptr1+1
|
||||||
|
|
||||||
|
lda #$ff
|
||||||
|
sta tmp1
|
||||||
|
jsr copy
|
||||||
|
|
||||||
|
|
||||||
|
ldx #0
|
||||||
|
stx BGCOLOR
|
||||||
|
inx
|
||||||
|
stx CHARCOLOR
|
||||||
|
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
copy:
|
||||||
ldy #$80 ; 128 chars
|
ldy #$80 ; 128 chars
|
||||||
charloop: ldx #$08 ; 8 bytes/char
|
charloop: ldx #$08 ; 8 bytes/char
|
||||||
lineloop:
|
lineloop:
|
||||||
lda (ptr1)
|
lda (ptr1)
|
||||||
|
eor tmp1
|
||||||
sta a:VDC_DATA_LO ; bitplane 0
|
sta a:VDC_DATA_LO ; bitplane 0
|
||||||
stz a:VDC_DATA_HI ; bitplane 1
|
stz a:VDC_DATA_HI ; bitplane 1
|
||||||
|
|
||||||
@ -89,12 +114,6 @@ fillloop: st1 #$00
|
|||||||
dey
|
dey
|
||||||
bne charloop ; next character
|
bne charloop ; next character
|
||||||
|
|
||||||
ldx #0
|
|
||||||
stx BGCOLOR
|
|
||||||
inx
|
|
||||||
stx CHARCOLOR
|
|
||||||
|
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.rodata
|
.rodata
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
.export newline, plot
|
.export newline, plot
|
||||||
.import popa, _gotoxy
|
.import popa, _gotoxy
|
||||||
.import PLOT
|
.import PLOT
|
||||||
|
.import xsize
|
||||||
|
|
||||||
.importzp tmp3,tmp4
|
.importzp tmp3,tmp4
|
||||||
|
|
||||||
@ -38,7 +39,7 @@ cputdirect:
|
|||||||
advance:
|
advance:
|
||||||
ldy CURS_X
|
ldy CURS_X
|
||||||
iny
|
iny
|
||||||
cpy #xsize
|
cpy xsize
|
||||||
bne L3
|
bne L3
|
||||||
jsr newline ; new line
|
jsr newline ; new line
|
||||||
ldy #0 ; + cr
|
ldy #0 ; + cr
|
||||||
|
@ -6,16 +6,11 @@ joystick support should get verified on real hw
|
|||||||
- the masks for buttons may be wrong.
|
- the masks for buttons may be wrong.
|
||||||
- 6 button gamepads are different and need slightly different code
|
- 6 button gamepads are different and need slightly different code
|
||||||
|
|
||||||
revers() is a dummy function, actual reverse output is not supported yet
|
|
||||||
|
|
||||||
some graphical petscii chars should get added to the charset
|
some graphical petscii chars should get added to the charset
|
||||||
|
|
||||||
interruptor support in crt0 (and cfg) is missing
|
interruptor support in crt0 (and cfg) is missing
|
||||||
- clock() should be hooked to a VBL interrupt
|
- clock() should be hooked to a VBL interrupt
|
||||||
|
|
||||||
conio lacks support for different screen sizes, which could be used with
|
|
||||||
different video modes
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
a good emulator to use for PC-Engine is "mednafen" (mednafen.sourceforge.net)
|
a good emulator to use for PC-Engine is "mednafen" (mednafen.sourceforge.net)
|
||||||
|
@ -1,11 +1,25 @@
|
|||||||
|
|
||||||
; FIXME: actual revers output is not supported yet
|
.include "pce.inc"
|
||||||
|
|
||||||
.export _revers
|
.export _revers
|
||||||
_revers:
|
|
||||||
lda #0
|
.proc _revers
|
||||||
|
|
||||||
|
ldx #$00 ; Assume revers off
|
||||||
|
tay ; Test onoff
|
||||||
|
beq L1 ; Jump if off
|
||||||
|
ldx #$80 ; Load on value
|
||||||
|
ldy #$00 ; Assume old value is zero
|
||||||
|
L1: lda RVS ; Load old value
|
||||||
|
stx RVS ; Set new value
|
||||||
|
beq L2 ; Jump if old value zero
|
||||||
|
iny ; Make old value = 1
|
||||||
|
L2: ldx #$00 ; Load high byte of result
|
||||||
|
tya ; Load low byte, set CC
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
;-------------------------------------------------------------------------------
|
;-------------------------------------------------------------------------------
|
||||||
; force the init constructor to be imported
|
; force the init constructor to be imported
|
||||||
|
|
||||||
|
@ -13,10 +13,12 @@ void main(void)
|
|||||||
int i, j;
|
int i, j;
|
||||||
clock_t clk;
|
clock_t clk;
|
||||||
char *p;
|
char *p;
|
||||||
|
unsigned char xsize, ysize, n;
|
||||||
|
|
||||||
joy_install(&joy_static_stddrv);
|
joy_install(&joy_static_stddrv);
|
||||||
|
|
||||||
clrscr();
|
clrscr();
|
||||||
|
screensize(&xsize, &ysize);
|
||||||
|
|
||||||
cputs("hello world");
|
cputs("hello world");
|
||||||
cputsxy(0, 2, "colors:" );
|
cputsxy(0, 2, "colors:" );
|
||||||
@ -43,6 +45,25 @@ void main(void)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gotoxy(0,ysize - 1);
|
||||||
|
for (i = 0; i < xsize; ++i) {
|
||||||
|
cputc('0' + i % 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
gotoxy(0,ysize - 2 - ((256 + xsize) / xsize));
|
||||||
|
for (i = 0; i < xsize; ++i) {
|
||||||
|
cputc('0' + i % 10);
|
||||||
|
}
|
||||||
|
for (i = 0; i < (xsize * 5); ++i) {
|
||||||
|
cputc('#');
|
||||||
|
}
|
||||||
|
gotoxy(0,ysize - 1 - ((256 + xsize) / xsize));
|
||||||
|
for (i = 0; i < 256; ++i) {
|
||||||
|
if ((i != '\n') && (i != '\r')) {
|
||||||
|
cputc(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
i = get_tv();
|
i = get_tv();
|
||||||
gotoxy(30,0);
|
gotoxy(30,0);
|
||||||
cputs("TV Mode: ");
|
cputs("TV Mode: ");
|
||||||
@ -57,6 +78,7 @@ void main(void)
|
|||||||
cputs("OTHER");
|
cputs("OTHER");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
cprintf(" %dx%d", xsize, ysize);
|
||||||
|
|
||||||
for(;;) {
|
for(;;) {
|
||||||
gotoxy(13,4);
|
gotoxy(13,4);
|
||||||
@ -82,7 +104,16 @@ void main(void)
|
|||||||
(j & joy_masks[JOY_FIRE])? " fire " : " ---- ",
|
(j & joy_masks[JOY_FIRE])? " fire " : " ---- ",
|
||||||
(j & joy_masks[JOY_FIRE2])? "fire2 " : " ---- ");
|
(j & joy_masks[JOY_FIRE2])? "fire2 " : " ---- ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gotoxy(xsize - 10, 3);
|
||||||
|
j = (n >> 5) & 1;
|
||||||
|
revers(j);
|
||||||
|
cputc(j ? 'R' : ' ');
|
||||||
|
cputs(" revers");
|
||||||
|
revers(0);
|
||||||
|
|
||||||
waitvblank();
|
waitvblank();
|
||||||
|
++n;
|
||||||
}
|
}
|
||||||
for(;;);
|
for(;;);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user