mirror of
https://github.com/irmen/prog8.git
synced 2024-06-01 06:41:42 +00:00
removed diskio.set_drive(), just set the diskio.drivenumber variable directly
there already wasn't a getter
This commit is contained in:
parent
f81061dd42
commit
a6756d2cea
|
@ -21,11 +21,7 @@ diskio {
|
||||||
const ubyte READ_IO_CHANNEL=12
|
const ubyte READ_IO_CHANNEL=12
|
||||||
const ubyte WRITE_IO_CHANNEL=13
|
const ubyte WRITE_IO_CHANNEL=13
|
||||||
|
|
||||||
ubyte drivenumber = 8
|
ubyte drivenumber = 8 ; user programs can set this to the drive number they want to load/save to!
|
||||||
|
|
||||||
sub set_drive(ubyte number) {
|
|
||||||
drivenumber = number
|
|
||||||
}
|
|
||||||
|
|
||||||
sub reset_read_channel() {
|
sub reset_read_channel() {
|
||||||
void cbm.CHKIN(READ_IO_CHANNEL)
|
void cbm.CHKIN(READ_IO_CHANNEL)
|
||||||
|
|
|
@ -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 $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 $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 $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 $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 $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus
|
||||||
romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus
|
romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus
|
||||||
|
|
|
@ -10,11 +10,7 @@ diskio {
|
||||||
const ubyte READ_IO_CHANNEL=12
|
const ubyte READ_IO_CHANNEL=12
|
||||||
const ubyte WRITE_IO_CHANNEL=13
|
const ubyte WRITE_IO_CHANNEL=13
|
||||||
|
|
||||||
ubyte drivenumber = 8
|
ubyte drivenumber = 8 ; user programs can set this to the drive number they want to load/save to!
|
||||||
|
|
||||||
sub set_drive(ubyte number) {
|
|
||||||
drivenumber = number
|
|
||||||
}
|
|
||||||
|
|
||||||
sub reset_read_channel() {
|
sub reset_read_channel() {
|
||||||
void cbm.CHKIN(READ_IO_CHANNEL)
|
void cbm.CHKIN(READ_IO_CHANNEL)
|
||||||
|
|
|
@ -313,7 +313,7 @@ internal class AstChecker(private val program: Program,
|
||||||
err("cannot redefine a built-in function")
|
err("cannot redefine a built-in function")
|
||||||
|
|
||||||
if(subroutine.parameters.size>6 && !subroutine.isAsmSubroutine && !subroutine.definingBlock.isInLibrary)
|
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()
|
val uniqueNames = subroutine.parameters.asSequence().map { it.name }.toSet()
|
||||||
if(uniqueNames.size!=subroutine.parameters.size)
|
if(uniqueNames.size!=subroutine.parameters.size)
|
||||||
|
|
|
@ -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.
|
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.
|
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::
|
.. attention::
|
||||||
Error handling is peculiar on CBM dos systems (C64, C128, cx16, PET). Read the
|
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.
|
descriptions for the various methods in this library for details and tips.
|
||||||
|
|
|
@ -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::
|
will corrupt any Vera operations that were going on in the main program. The routines are::
|
||||||
|
|
||||||
cx16.save_vera_context()
|
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()
|
cx16.restore_vera_context()
|
||||||
|
|
||||||
.. caution::
|
.. 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
|
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.
|
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.
|
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.
|
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
|
Beside them being very slow, there are intricate requirements such as having the
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
TODO
|
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 ....
|
- [on branch: shortcircuit] investigate McCarthy evaluation again? this may also reduce code size perhaps for things like if a>4 or a<2 ....
|
||||||
|
|
||||||
...
|
...
|
||||||
|
|
|
@ -8,15 +8,13 @@
|
||||||
|
|
||||||
main {
|
main {
|
||||||
sub start() {
|
sub start() {
|
||||||
diskio.set_drive(8)
|
diskio.drivenumber = 8
|
||||||
txt.print("showing the full directory of drive ")
|
txt.print("showing the full directory of drive 8:\n")
|
||||||
txt.print_ub(diskio.drivenumber)
|
|
||||||
txt.print(":\n")
|
|
||||||
void diskio.directory()
|
void diskio.directory()
|
||||||
txt.nl()
|
txt.nl()
|
||||||
|
|
||||||
if diskio.lf_start_list("cub*") {
|
if diskio.lf_start_list("test*") {
|
||||||
txt.print("\nfiles starting with 'cub':\n")
|
txt.print("\nfiles starting with 'test':\n")
|
||||||
while diskio.lf_next_entry() {
|
while diskio.lf_next_entry() {
|
||||||
txt.print(diskio.list_filename)
|
txt.print(diskio.list_filename)
|
||||||
txt.print(" ")
|
txt.print(" ")
|
||||||
|
@ -28,8 +26,8 @@ main {
|
||||||
txt.print("error\n")
|
txt.print("error\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
if diskio.lf_start_list("*gfx") {
|
if diskio.lf_start_list("*bin") {
|
||||||
txt.print("\nfiles ending with 'gfx':\n")
|
txt.print("\nfiles ending with 'bin':\n")
|
||||||
while diskio.lf_next_entry() {
|
while diskio.lf_next_entry() {
|
||||||
txt.print(diskio.list_filename)
|
txt.print(diskio.list_filename)
|
||||||
txt.print(" ")
|
txt.print(" ")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user