some changes in SMC routines for the cx16:

sys.poweroff_system() moved to cx16
sys.set_leds_brightness() moved to cx16 and changed to set_led_brightness, you can only change the activity led brightness.
This commit is contained in:
Irmen de Jong 2024-03-15 01:04:51 +01:00
parent a94cfd34f5
commit 6a9269111e
5 changed files with 53 additions and 42 deletions

View File

@ -1214,6 +1214,20 @@ _continue iny
}}
}
sub reset_system() {
; Soft-reset the system back to initial power-on Basic prompt.
sys.reset_system()
}
sub poweroff_system() {
; use the SMC to shutdown the computer
void cx16.i2c_write_byte($42, $01, $00)
}
sub set_led_brightness(ubyte brightness) {
void cx16.i2c_write_byte($42, $05, brightness)
}
}
sys {
@ -1413,13 +1427,13 @@ asmsub set_rasterline(uword line @AY) {
asmsub reset_system() {
; Soft-reset the system back to initial power-on Basic prompt.
; We do this via the SMC so that a true reset is performed that also resets the Vera fully.
; (note: this is an asmsub on purpose! don't change into a normal sub)
%asm {{
sei
ldx #$42
ldy #2
lda #0
jsr cx16.i2c_write_byte
bra *
jmp cx16.i2c_write_byte
}}
}

View File

@ -135,12 +135,6 @@ sys (part of syslib)
Soft-reset the system back to initial power-on BASIC prompt.
(called automatically by Prog8 when the main subroutine returns and the program is not using basicsafe zeropage option)
``poweroff_system ()`` (commander x16 only)
Powers down the computer.
``set_leds_brightness (ubyte activity, ubyte power)`` (commander x16 only)
Sets the brightness of the activity and power leds on the computer.
``disable_caseswitch()`` and ``enable_caseswitch()``
Disable or enable the ability to switch character set case using a keyboard combination.
@ -582,6 +576,15 @@ On the other targets, it only contains the definition of the 16 memory mapped vi
``cpu_is_65816()``
Returns true if the CPU in the computer is a 65816, false otherwise (6502 cpu).
``reset_system ()``
Soft-reset the system back to initial power-on BASIC prompt. (same as the routine in sys)
``poweroff_system ()``
Powers down the computer.
``set_led_brightness (ubyte brightness)``
Sets the brightness of the activity led on the computer.
bmx (cx16 only)
----------------

View File

@ -1,6 +1,8 @@
TODO
====
add more verifications to diskspeed.p8
...

View File

@ -139,18 +139,18 @@ main {
txt.print(diskio.status())
txt.print("\ndone.\n")
; diskio.delete("benchmark0.dat")
; diskio.delete("benchmark1.dat")
; diskio.delete("benchmark2.dat")
; diskio.delete("benchmark3.dat")
; diskio.delete("benchmark4.dat")
; diskio.delete("benchmark5.dat")
; diskio.delete("benchmark6.dat")
; diskio.delete("benchmark7.dat")
; diskio.delete("benchmark8.dat")
; diskio.delete("benchmark9.dat")
; diskio.delete("benchmark64.dat")
; diskio.delete("benchmark256.dat")
diskio.delete("benchmark0.dat")
diskio.delete("benchmark1.dat")
diskio.delete("benchmark2.dat")
diskio.delete("benchmark3.dat")
diskio.delete("benchmark4.dat")
diskio.delete("benchmark5.dat")
diskio.delete("benchmark6.dat")
diskio.delete("benchmark7.dat")
diskio.delete("benchmark8.dat")
diskio.delete("benchmark9.dat")
diskio.delete("benchmark64.dat")
diskio.delete("benchmark256.dat")
}
sub verify_20k(str filename, uword crc32_low, uword crc32_high) {

View File

@ -4,32 +4,24 @@
main {
sub start() {
; TODO func is not called 4 times!!!!! FIX!!!
if (not func(1))
or (not func(1))
or (not func(1))
or (not func(1)) {
txt.print("done1\n")
cx16.reset_system()
repeat {
for cx16.r0L in 0 to 255 {
cx16.set_led_brightness(cx16.r0L)
delay()
}
; TODO func is not called 4 times!!!!! FIX!!!
if func(2)
and func(2)
and func(2)
and func(2) {
txt.print("done2\n")
for cx16.r0L in 255 downto 0 {
cx16.set_led_brightness(cx16.r0L)
delay()
}
; TODO func is not called 4 times!!!!! FIX!!!
if func(3) and func(3) and func(3) and func(3) {
txt.print("done3\n")
}
}
sub func(ubyte x) -> bool {
txt.print("func ")
txt.print_ub(x)
txt.nl()
return true
sub delay() {
repeat 2000 {
%asm {{
nop
}}
}
}
}