removed diskio.set_drive(), just set the diskio.drivenumber variable directly

there already wasn't a getter
This commit is contained in:
Irmen de Jong 2023-11-19 18:59:03 +01:00
parent f81061dd42
commit a6756d2cea
8 changed files with 22 additions and 21 deletions

View File

@ -21,11 +21,7 @@ diskio {
const ubyte READ_IO_CHANNEL=12
const ubyte WRITE_IO_CHANNEL=13
ubyte drivenumber = 8
sub set_drive(ubyte number) {
drivenumber = number
}
ubyte drivenumber = 8 ; user programs can set this to the drive number they want to load/save to!
sub reset_read_channel() {
void cbm.CHKIN(READ_IO_CHANNEL)

View File

@ -21,7 +21,7 @@ romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA
romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK
romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks()
romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer
romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard
romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan
romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus
romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus
romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus

View File

@ -10,11 +10,7 @@ diskio {
const ubyte READ_IO_CHANNEL=12
const ubyte WRITE_IO_CHANNEL=13
ubyte drivenumber = 8
sub set_drive(ubyte number) {
drivenumber = number
}
ubyte drivenumber = 8 ; user programs can set this to the drive number they want to load/save to!
sub reset_read_channel() {
void cbm.CHKIN(READ_IO_CHANNEL)

View File

@ -313,7 +313,7 @@ internal class AstChecker(private val program: Program,
err("cannot redefine a built-in function")
if(subroutine.parameters.size>6 && !subroutine.isAsmSubroutine && !subroutine.definingBlock.isInLibrary)
errors.warn("subroutine has a large number of parameters, this slows down code execution a lot", subroutine.position)
errors.warn("subroutine has a large number of parameters, this is slow if called often", subroutine.position)
val uniqueNames = subroutine.parameters.asSequence().map { it.name }.toSet()
if(uniqueNames.size!=subroutine.parameters.size)

View File

@ -193,6 +193,10 @@ to see what's in there. (Note: slight variations for different compiler targets)
routines, please first try again with an SD-card image instead of HostFs.
It is possible that there are still small differences between HostFS and actual CBM DOS in the X16 emulator.
.. note::
You can set the active disk drive number so it supports multiple drives,
but it does not support multiple open files at the same time.
.. attention::
Error handling is peculiar on CBM dos systems (C64, C128, cx16, PET). Read the
descriptions for the various methods in this library for details and tips.

View File

@ -154,7 +154,9 @@ They take care of saving and restoring the Vera state of the interrupted main pr
will corrupt any Vera operations that were going on in the main program. The routines are::
cx16.save_vera_context()
; ... do your work that uses vera here...
; perhaps also cx16.save_virtual_registers() here...
; ... do your work that uses vera here!...
; perhaps also cx16.restore_virtual_registers() here...
cx16.restore_vera_context()
.. caution::
@ -162,6 +164,7 @@ will corrupt any Vera operations that were going on in the main program. The rou
So you should make sure that the handler routine does NOT use these registers, or do some sort of saving/restoring yourself
of the ones that you do need in the IRQ handler.
There are two utility routines in cx16 that save and restore *all* 16 registers so it's a bit inefficient but safe.
(these are ``save_virtual_registers()`` and ``restore_virtual_registers()``)
It is also advised to not use floating point calculations inside IRQ handler routines.
Beside them being very slow, there are intricate requirements such as having the

View File

@ -2,6 +2,10 @@
TODO
====
- IRQ callback should return boolean to tell Prog8 to call the kernal ISR or not.
- Is there a way to tell prog8 not to optimize out a function that is only called from within %asm{{}}? like a @shared but for subs?
- [on branch: shortcircuit] investigate McCarthy evaluation again? this may also reduce code size perhaps for things like if a>4 or a<2 ....
...

View File

@ -8,15 +8,13 @@
main {
sub start() {
diskio.set_drive(8)
txt.print("showing the full directory of drive ")
txt.print_ub(diskio.drivenumber)
txt.print(":\n")
diskio.drivenumber = 8
txt.print("showing the full directory of drive 8:\n")
void diskio.directory()
txt.nl()
if diskio.lf_start_list("cub*") {
txt.print("\nfiles starting with 'cub':\n")
if diskio.lf_start_list("test*") {
txt.print("\nfiles starting with 'test':\n")
while diskio.lf_next_entry() {
txt.print(diskio.list_filename)
txt.print(" ")
@ -28,8 +26,8 @@ main {
txt.print("error\n")
}
if diskio.lf_start_list("*gfx") {
txt.print("\nfiles ending with 'gfx':\n")
if diskio.lf_start_list("*bin") {
txt.print("\nfiles ending with 'bin':\n")
while diskio.lf_next_entry() {
txt.print(diskio.list_filename)
txt.print(" ")