Skip to content

Commit

Permalink
version 9.7
Browse files Browse the repository at this point in the history
  • Loading branch information
irmen committed Dec 9, 2023
1 parent c7c72f0 commit dd4c073
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 7 deletions.
1 change: 1 addition & 0 deletions compiler/res/prog8lib/cx16/diskio.p8
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ io_error:
; Also sets carry on exit: Carry clear = all files returned, Carry set = directory has more files that didn't fit in the buffer.
uword buffer_start = filenames_buffer
ubyte files_found = 0
filenames_buffer[0]=0
if lf_start_list(pattern_ptr) {
while lf_next_entry() {
if list_filetype!="dir" {
Expand Down
34 changes: 28 additions & 6 deletions compiler/res/prog8lib/cx16/syslib.p8
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ cx16 {
&uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in
&uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in

&uword edkeyvec = $ac03 ; for intercepting BASIN/CHRIN key strokes. See set_basin_handler()
&uword edkeybk = $ac05 ; ...the RAM bank of this routine if not in low ram
&uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler()
&ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram


; the sixteen virtual 16-bit registers in both normal unsigned mode and signed mode (s)
Expand Down Expand Up @@ -415,8 +415,8 @@ romsub $fecc = monitor() clobbers(A,X,Y)
romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY
romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY
romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y)
romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, ubyte jiffies @R3) clobbers(A, X, Y)
romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, ubyte @R3 ; result registers see clock_set_date_time()
romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y)
romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time()

; keyboard, mouse, joystick
; note: also see the kbdbuf_clear() helper routine below!
Expand Down Expand Up @@ -849,14 +849,16 @@ asmsub restore_vera_context() clobbers(A) {


asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) {
; Install a custom CHRIN (BASIN) key handler. Call this before each line you want to read.
; Install a custom CHRIN (BASIN) key handler in a safe manner. Call this before each line you want to read.
; See https://github.com/X16Community/x16-docs/blob/master/X16%20Reference%20-%2002%20-%20Editor.md#custom-basin-petscii-code-override-handler
%asm {{
sei
sta cx16.edkeybk
sta P8ZP_SCRATCH_REG
lda $00
pha
stz $00
lda P8ZP_SCRATCH_REG
sta cx16.edkeybk
stx cx16.edkeyvec
sty cx16.edkeyvec+1
pla
Expand All @@ -866,6 +868,26 @@ asmsub restore_vera_context() clobbers(A) {
}}
}

asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 {
; --- retrieve the currently set CHRIN keyhandler in a safe manner, bank in r0L, handler address in R1.
%asm {{
sei
lda $00
pha
stz $00
lda cx16.edkeybk
sta cx16.r0L
lda cx16.edkeyvec
ldy cx16.edkeyvec+1
sta cx16.r1
sty cx16.r1+1
pla
sta $00
cli
rts
}}
}


; Commander X16 IRQ dispatcher routines

Expand Down
10 changes: 10 additions & 0 deletions docs/source/todo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
TODO
====


- fix problem with conversion to void call messing up the return '!':
if cx16.r0L==9 {
; process TAB
uword cmd = grab_cmdline()
return '!'
}



- [on branch: shortcircuit] investigate McCarthy evaluation again? this may also reduce code size perhaps for things like if a>4 or a<2 ....

...
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ org.gradle.daemon=true
kotlin.code.style=official
javaVersion=11
kotlinVersion=1.9.20
version=9.7-SNAPSHOT
version=9.7

0 comments on commit dd4c073

Please sign in to comment.