1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-11-01 05:05:32 +00:00

Improve readkey on CBM targets. PET improvements.

This commit is contained in:
Karol Stasiak 2020-03-31 17:59:50 +02:00
parent ffb9de6889
commit 542474e920
3 changed files with 63 additions and 1 deletions

View File

@ -7,6 +7,8 @@ const byte KEY_ENTER = 13
#if CBM_64
noinline asm byte readkey() {
LDA #0
STA $C6
__read_key__start:
LDA $C6
BEQ __read_key__start
@ -18,6 +20,8 @@ __read_key__start:
#if CBM_128
noinline asm byte readkey() {
LDA #0
STA $D0
__read_key__start:
LDA $D0
BEQ __read_key__start
@ -30,6 +34,8 @@ __read_key__start:
#if CBM_264
noinline asm byte readkey() {
LDA #0
STA $EF
__read_key__start:
LDA $EF
BEQ __read_key__start
@ -42,6 +48,8 @@ __read_key__start:
#if CBM_VIC
noinline asm byte readkey() {
LDA #0
STA $C6
__read_key__start:
LDA $C6
BEQ __read_key__start
@ -51,6 +59,39 @@ __read_key__start:
#endif
#if CBM_PET
#if not(PET2001_SUPPORT) && not(PET3000_SUPPORT) && not(PET4000_SUPPORT)
#error At least one of PET2000_SUPPORT, PET3000_SUPPORT, PET4000_SUPPORT has to be defined
#endif
noinline asm byte readkey() {
#if PET2001_SUPPORT
JSR is_pet2000
BNE __read_key__start_new
// ROM 1.0:
LDA #0
STA $20D
__read_key__start1:
LDA $20D
BEQ __read_key__start1
LDA $20F
RTS
// ROM 2.0 and above:
__read_key__start_new:
LDA #0
STA $9E
__read_key__start2:
LDA $9E
BEQ __read_key__start2
LDA $026F
RTS
}
#define OK = 1
#endif
#if ATARI_8
noinline asm byte readkey() {
lda #$C

View File

@ -2,7 +2,7 @@
arch=nmos
encoding=oldpetscii
screen_encoding=petscr
modules=loader_0401,pet_kernal,default_panic
modules=loader_0401,pet_kernal,default_panic,stdlib
[allocation]
@ -18,6 +18,9 @@ WIDESCREEN=0
KEYBOARD=1
JOYSTICKS=0
HAS_BITMAP_MODE=0
PET2000_SUPPORT=1
PET3000_SUPPORT=1
PET4000_SUPPORT=1
[output]
style=single

View File

@ -11,3 +11,21 @@ asm void putchar(byte register(a) char) @$FFD2 extern
inline void new_line() {
putchar(13)
}
inline asm set_zero is_pet2000() {
? LDA #$CA
CMP $FFFB
? RTS
}
inline asm set_zero is_pet3000() {
? LDA #$FC
CMP $FFFB
? RTS
}
inline asm set_zero is_pet4000() {
? LDA #$FD
CMP $FFFB
? RTS
}