mirror of
https://github.com/KarolS/millfork.git
synced 2025-04-22 01:37:23 +00:00
Implement readkey and readline for Apple II
This commit is contained in:
parent
29335d376a
commit
cd5e9decac
@ -60,6 +60,8 @@
|
||||
|
||||
* Added detection for various PET variants and implemented `readkey` for PET.
|
||||
|
||||
* Implemented `readkey` and `readline` for Apple II.
|
||||
|
||||
* Changed the default load address for BBC Micro.
|
||||
|
||||
* Multiple fixes to the `string`, `scrstring` and `encconv` modules.
|
||||
|
@ -48,6 +48,7 @@ Available for:
|
||||
ZX Spectrum,
|
||||
NEC PC-88,
|
||||
MSX,
|
||||
Apple II,
|
||||
Commodore 64 with `c64_basic` module (requires KERNAL and BASIC),
|
||||
Commodore 16 or Plus/4 with `c264_basic` module (requires KERNAL and BASIC).
|
||||
|
||||
@ -59,6 +60,7 @@ Available for:
|
||||
ZX Spectrum,
|
||||
NEC PC-88,
|
||||
MSX,
|
||||
Apple II,
|
||||
Commodore 64 with `c64_basic` module (requires KERNAL and BASIC),
|
||||
Commodore 16 or Plus/4 with `c264_basic` module (requires KERNAL and BASIC).
|
||||
|
||||
|
@ -21,15 +21,15 @@ If you are using a release version of the compiler, consider browsing the older
|
||||
|
||||
* [Text encodings](crossplatform/text_encodings.mfk) (C64/ZX Spectrum) – examples of text encoding features
|
||||
|
||||
* [Echo](crossplatform/echo.mfk) (C64/C16/ZX Spectrum/PC-88/MSX)– simple text input and output
|
||||
* [Echo](crossplatform/echo.mfk) (C64/C16/Apple II/ZX Spectrum/PC-88/MSX)– simple text input and output
|
||||
|
||||
* [Calculator](crossplatform/calculator.mfk) (C64/C16/ZX Spectrum/PC-88/MSX) – simple numeric input and output
|
||||
* [Calculator](crossplatform/calculator.mfk) (C64/C16/Apple II/ZX Spectrum/PC-88/MSX) – simple numeric input and output
|
||||
|
||||
* [Guessing game](crossplatform/guess.mfk) (C64/C16/ZX Spectrum/PC-88/MSX) – a guess-a-number game
|
||||
* [Guessing game](crossplatform/guess.mfk) (C64/C16/Apple II/ZX Spectrum/PC-88/MSX) – a guess-a-number game
|
||||
|
||||
* [Fire effect](crossplatform/fire.mfk) (C64/C16/ZX Spectrum) – a simple fire effect
|
||||
|
||||
* [`readkey` test](crossplatform/readkeytest.mfk) (C64/C16/PET/VIC-20/Atari/Armstrad CPC/ZX Spectrum/PC-88) – keyboard reading test
|
||||
* [`readkey` test](crossplatform/readkeytest.mfk) (C64/C16/PET/VIC-20/Atari/Apple II/Armstrad CPC/ZX Spectrum/PC-88) – keyboard reading test
|
||||
|
||||
* [Screen encoding test](crossplatform/screnctest.mfk) (C64/C16) – default-to-screen encoding conversion test
|
||||
|
||||
@ -37,7 +37,7 @@ If you are using a release version of the compiler, consider browsing the older
|
||||
|
||||
* [Life](crossplatform/life.mfk) (C64/C16/Atari/ZX Spectrum) – Conway's game of life
|
||||
|
||||
* [Test suite](tests) (C64/C16/Atari/Armstrad CPC/ZX Spectrum/PC-88) – the semi-official test-suite for Millfork
|
||||
* [Test suite](tests) (C64/C16/Atari/Apple II/BBC Micro/Armstrad CPC/ZX Spectrum/PC-88) – the semi-official test-suite for Millfork
|
||||
|
||||
## Commodore 64 examples
|
||||
|
||||
|
@ -15,8 +15,9 @@ void main() {
|
||||
pointer line
|
||||
while true {
|
||||
line = readline()
|
||||
// empty line is read as a single space
|
||||
// empty line is read as a single space on C64
|
||||
if line[0] == 32 && line[1] == 0 { return }
|
||||
if line[0] == 0 { return }
|
||||
putstrz(line)
|
||||
new_line()
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import c64_basic
|
||||
import c264_basic
|
||||
#endif
|
||||
|
||||
#define READKEY = CBM_64 | CBM_264 | ZX_SPECTRUM | NEC_PC_88
|
||||
#define READKEY = CBM_64 | CBM_264 | ZX_SPECTRUM | NEC_PC_88 | APPLE_2
|
||||
|
||||
#if READKEY
|
||||
import keyboard
|
||||
|
@ -28,6 +28,8 @@ note that support for these targets may end when the suite grows beyond their me
|
||||
|
||||
* BBC Micro, loadable programs (`bbcmicro`)
|
||||
|
||||
* Apple II, loadable programs (`apple2`)
|
||||
|
||||
Compiling with the `-D PRINT_SUCCESSES` will cause the suite to print all tests, including successful ones.
|
||||
Otherwise, only failed tests will be printed.
|
||||
|
||||
|
@ -4,7 +4,7 @@ pointer current_suite_name
|
||||
byte current_test_number
|
||||
word failure_count = 0
|
||||
|
||||
#if ZX_SPECTRUM || CBM || NEC_PC88 || ATARI_8 || AMSTRAD_CPC
|
||||
#if ZX_SPECTRUM || CBM || NEC_PC88 || ATARI_8 || AMSTRAD_CPC || APPLE_2
|
||||
|
||||
import keyboard
|
||||
alias wait_after_failure = readkey
|
||||
|
@ -1,7 +1,7 @@
|
||||
[compilation]
|
||||
arch=strict
|
||||
encoding=apple2
|
||||
modules=apple2_kernel,default_panic,stdlib
|
||||
modules=apple2_kernel,default_panic,stdlib,default_readword
|
||||
lenient_encoding=true
|
||||
|
||||
|
||||
|
@ -10,3 +10,16 @@ asm void bell() @$FBE4 extern
|
||||
|
||||
asm void putchar(byte register(a) char) @$FDED extern
|
||||
asm void new_line() @$FC62 extern
|
||||
asm pointer readline() {
|
||||
jsr $FD6A
|
||||
ldx #$ff
|
||||
__readline_loop:
|
||||
inx
|
||||
lda $200,x
|
||||
cmp #$8d
|
||||
bne __readline_loop
|
||||
lda #0
|
||||
sta $200,x
|
||||
ldx #2
|
||||
rts
|
||||
}
|
||||
|
@ -112,6 +112,12 @@ noinline asm byte readkey() {
|
||||
#endif
|
||||
|
||||
|
||||
#if APPLE_2
|
||||
asm byte readkey() @$FD0C extern
|
||||
#define OK = 1
|
||||
#endif
|
||||
|
||||
|
||||
#if NEC_PC_88
|
||||
asm byte readkey() @$3583 extern
|
||||
#define OK = 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user