mirror of
https://github.com/KarolS/millfork.git
synced 2025-01-14 17:31:07 +00:00
Implement readline and readword for VIC-20
This commit is contained in:
parent
24c0e8a8ee
commit
a00e10382d
@ -8,6 +8,8 @@
|
||||
|
||||
* Allowed the `:` operator in const-pure functions.
|
||||
|
||||
* Implemented `readline` and `readword` for VIC-20.
|
||||
|
||||
* Fix: more instances of memset loops should be detected and optimized (#59).
|
||||
|
||||
* Fix: things mentioned in the segment layout should not be deleted even if unused.
|
||||
|
@ -70,6 +70,8 @@
|
||||
|
||||
* [C64-only modules](stdlib/c64.md)
|
||||
|
||||
* [VIC-20-only modules](stdlib/vic20.md)
|
||||
|
||||
* [PET-only modules](stdlib/cbm_pet.md)
|
||||
|
||||
* [`cbm_file` module](stdlib/cbm_file.md)
|
||||
|
@ -51,6 +51,7 @@ MSX,
|
||||
Apple II,
|
||||
Robotron Z1013 (always trims trailing spaces),
|
||||
TRS-80,
|
||||
VIC-20 (except for `vic20_a000`),
|
||||
Commodore 64 with `c64_basic` module (requires KERNAL and BASIC; empty input is treated like a single space),
|
||||
Commodore 16 or Plus/4 with `c264_basic` module (requires KERNAL and BASIC; empty input is treated like a single space).
|
||||
|
||||
@ -65,6 +66,7 @@ MSX,
|
||||
Apple II,
|
||||
Robotron Z1013,
|
||||
TRS-80,
|
||||
VIC-20 (except for `vic20_a000`),
|
||||
Commodore 64 with `c64_basic` module (requires KERNAL and BASIC),
|
||||
Commodore 16 or Plus/4 with `c264_basic` module (requires KERNAL and BASIC).
|
||||
|
||||
|
21
docs/stdlib/vic20.md
Normal file
21
docs/stdlib/vic20.md
Normal file
@ -0,0 +1,21 @@
|
||||
[< back to index](../doc_index.md)
|
||||
|
||||
# VIC-20-oriented modules
|
||||
|
||||
## vic20_kernal module
|
||||
|
||||
The `vic20_kernal` module is imported automatically on the VIC-20 target.
|
||||
It provides access to Kernal routines.
|
||||
|
||||
TODO
|
||||
|
||||
## vic20_basic module
|
||||
|
||||
The `vic20_basic` module provides access to Basic routines.
|
||||
It is imported automatically on all PRG VIC-20 targets (`vic20`, `vic20_3k`, `vic20_8k`), but not on cartridge targets (like `vic20_a000`).
|
||||
|
||||
TODO
|
||||
|
||||
## vic20_hardware
|
||||
|
||||
TODO
|
@ -27,11 +27,11 @@ 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/Apple II/ZX Spectrum/PC-88/MSX)– simple text input and output
|
||||
* [Echo](crossplatform/echo.mfk) (C64/C16/VIC-20/Apple II/ZX Spectrum/PC-88/MSX)– simple text input and output
|
||||
|
||||
* [Calculator](crossplatform/calculator.mfk) (C64/C16/Apple II/ZX Spectrum/PC-88/MSX/TRS-80) – simple numeric input and output
|
||||
* [Calculator](crossplatform/calculator.mfk) (C64/C16/VIC-20/Apple II/ZX Spectrum/PC-88/MSX/TRS-80) – simple numeric input and output
|
||||
|
||||
* [Guessing game](crossplatform/guess.mfk) (C64/C16/Apple II/ZX Spectrum/PC-88/MSX/TRS-80/Z1013) – a guess-a-number game
|
||||
* [Guessing game](crossplatform/guess.mfk) (C64/C16/VIC-20/Apple II/ZX Spectrum/PC-88/MSX/TRS-80/Z1013) – a guess-a-number game
|
||||
|
||||
* [Fire effect](crossplatform/fire.mfk) (C64/C16/ZX Spectrum) – a simple fire effect
|
||||
|
||||
|
@ -4,7 +4,7 @@ import stdio
|
||||
import c64_basic
|
||||
#elseif CBM_264
|
||||
import c264_basic
|
||||
#elseif ZX_SPECTRUM || NEC_PC_88 || TRS80
|
||||
#elseif ZX_SPECTRUM || NEC_PC_88 || TRS80 || CBM_VIC
|
||||
// no imports needed
|
||||
#else
|
||||
#error Unsupported platform
|
||||
|
@ -3,7 +3,7 @@
|
||||
import c64_basic
|
||||
#elseif CBM_264
|
||||
import c264_basic
|
||||
#elseif ZX_SPECTRUM || NEC_PC_88
|
||||
#elseif CBM_VIC || ZX_SPECTRUM || NEC_PC_88
|
||||
// no imports needed
|
||||
#else
|
||||
#error Unsupported platform
|
||||
|
@ -10,7 +10,7 @@ import c64_basic
|
||||
import c264_basic
|
||||
#endif
|
||||
|
||||
#define READKEY = CBM_64 | CBM_264 | ZX_SPECTRUM | NEC_PC_88 | APPLE_2
|
||||
#define READKEY = CBM_64 | CBM_264 | CBM_VIC | ZX_SPECTRUM | NEC_PC_88 | APPLE_2
|
||||
|
||||
#if READKEY
|
||||
import keyboard
|
||||
|
@ -2,7 +2,7 @@
|
||||
arch=nmos
|
||||
encoding=petscii
|
||||
screen_encoding=petscr
|
||||
modules=loader_1001,vic20_kernal,vic20_hardware,default_panic,stdlib
|
||||
modules=loader_1001,vic20_kernal,vic20_basic,vic20_hardware,default_panic,stdlib
|
||||
|
||||
|
||||
[allocation]
|
||||
|
@ -2,7 +2,7 @@
|
||||
arch=nmos
|
||||
encoding=petscii
|
||||
screen_encoding=petscr
|
||||
modules=loader_0401,vic20_kernal,vic20_hardware,default_panic,stdlib
|
||||
modules=loader_0401,vic20_kernal,vic20_basic,vic20_hardware,default_panic,stdlib
|
||||
|
||||
|
||||
[allocation]
|
||||
|
@ -2,7 +2,7 @@
|
||||
arch=nmos
|
||||
encoding=petscii
|
||||
screen_encoding=petscr
|
||||
modules=loader_1201,vic20_kernal,vic20_hardware,,default_panic,stdlib
|
||||
modules=loader_1201,vic20_kernal,vic20_basic,vic20_hardware,,default_panic,stdlib
|
||||
|
||||
|
||||
[allocation]
|
||||
|
30
include/vic20_basic.mfk
Normal file
30
include/vic20_basic.mfk
Normal file
@ -0,0 +1,30 @@
|
||||
// Routines from C64 BASIC ROM
|
||||
|
||||
#if not(CBM_VIC)
|
||||
#warn vic20_basic module should be only used on VIC-20-compatible targets
|
||||
#endif
|
||||
|
||||
import vic20_kernal
|
||||
import err
|
||||
|
||||
// print a 16-bit number on the standard output
|
||||
asm void putword_basic(word register(xa) num) @$DDCD extern
|
||||
|
||||
alias putword = putword_basic!
|
||||
|
||||
asm void __readline_basic() @$C560 extern
|
||||
|
||||
pointer readline_basic() {
|
||||
__readline_basic()
|
||||
return readline_out
|
||||
}
|
||||
|
||||
alias readline = readline_basic!
|
||||
|
||||
const pointer readline_out = $200
|
||||
|
||||
inline word readword_basic() {
|
||||
return strz2word(readline_basic())
|
||||
}
|
||||
|
||||
alias readword = readword_basic!
|
@ -47,6 +47,7 @@ nav:
|
||||
- Platform-dependent definitions: stdlib/frequent.md
|
||||
- cbm_file module: stdlib/cbm_file.md
|
||||
- C64-only modules: stdlib/c64.md
|
||||
- VIC-20-only modules: stdlib/vic20.md
|
||||
- PET-only modules: stdlib/cbm_pet.md
|
||||
- NES-only modules: stdlib/nes.md
|
||||
- Lynx-only modules: stdlib/lynx.md
|
||||
|
Loading…
x
Reference in New Issue
Block a user