mirror of
https://github.com/irmen/prog8.git
synced 2025-02-16 22:30:46 +00:00
cx16: monogfx can fill with stipple mode again.
cx16: charset switching enabled again on program exit. cx16: fileselector example: can now also show directories
This commit is contained in:
parent
10b9162dc5
commit
f2cfcfdf31
@ -1,4 +1,6 @@
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
import org.jetbrains.kotlin.gradle.internal.config.LanguageFeature
|
||||
|
||||
|
||||
plugins {
|
||||
kotlin("jvm") version "2.1.0"
|
||||
@ -17,6 +19,12 @@ allprojects {
|
||||
freeCompilerArgs = listOf("-Xwhen-guards")
|
||||
jvmTarget = JvmTarget.JVM_11
|
||||
}
|
||||
sourceSets.all {
|
||||
languageSettings {
|
||||
// enable language features like so:
|
||||
// enableLanguageFeature(LanguageFeature.WhenGuards.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
java {
|
||||
|
@ -401,15 +401,14 @@ drawmode: ora cx16.r15L
|
||||
}
|
||||
word @zp dx2 = dx*2
|
||||
word @zp dy2 = dy*2
|
||||
cx16.r14 = x1 ; internal plot X
|
||||
|
||||
if dx >= dy {
|
||||
if cx16.r1L!=0 {
|
||||
repeat {
|
||||
plot(cx16.r14, y1, draw)
|
||||
if cx16.r14==x2
|
||||
plot(x1, y1, draw)
|
||||
if x1==x2
|
||||
return
|
||||
cx16.r14++
|
||||
x1++
|
||||
d += dy2
|
||||
if d > dx {
|
||||
y1++
|
||||
@ -418,10 +417,10 @@ drawmode: ora cx16.r15L
|
||||
}
|
||||
} else {
|
||||
repeat {
|
||||
plot(cx16.r14, y1, draw)
|
||||
if cx16.r14==x2
|
||||
plot(x1, y1, draw)
|
||||
if x1==x2
|
||||
return
|
||||
cx16.r14--
|
||||
x1--
|
||||
d += dy2
|
||||
if d > dx {
|
||||
y1++
|
||||
@ -433,25 +432,25 @@ drawmode: ora cx16.r15L
|
||||
else {
|
||||
if cx16.r1L!=0 {
|
||||
repeat {
|
||||
plot(cx16.r14, y1, draw)
|
||||
plot(x1, y1, draw)
|
||||
if y1 == y2
|
||||
return
|
||||
y1++
|
||||
d += dx2
|
||||
if d > dy {
|
||||
cx16.r14++
|
||||
x1++
|
||||
d -= dy2
|
||||
}
|
||||
}
|
||||
} else {
|
||||
repeat {
|
||||
plot(cx16.r14, y1, draw)
|
||||
plot(x1, y1, draw)
|
||||
if y1 == y2
|
||||
return
|
||||
y1++
|
||||
d += dx2
|
||||
if d > dy {
|
||||
cx16.r14--
|
||||
x1--
|
||||
d -= dy2
|
||||
}
|
||||
}
|
||||
@ -655,6 +654,11 @@ nostipple:
|
||||
%asm {{
|
||||
tsb cx16.VERA_DATA0
|
||||
}}
|
||||
} else {
|
||||
prepare()
|
||||
%asm {{
|
||||
trb cx16.VERA_DATA0
|
||||
}}
|
||||
}
|
||||
} else {
|
||||
; only erase
|
||||
@ -682,9 +686,9 @@ invert:
|
||||
}}
|
||||
xx /= 8
|
||||
if width==320
|
||||
xx += yy*(320/8)
|
||||
xx += yy*(320/8) ; TODO *40 table
|
||||
else
|
||||
xx += yy*(640/8)
|
||||
xx += yy*(640/8) ; TODO *80 table? (a bit large, need lo,mid,hi. maybe just reuse *40 table and do 1 shift.)
|
||||
%asm {{
|
||||
stz cx16.VERA_CTRL
|
||||
stz cx16.VERA_ADDR_H
|
||||
@ -715,9 +719,9 @@ invert:
|
||||
}}
|
||||
xx /= 8
|
||||
if width==320
|
||||
xx += yy*(320/8)
|
||||
xx += yy*(320/8) ; TODO *40 table
|
||||
else
|
||||
xx += yy*(640/8)
|
||||
xx += yy*(640/8) ; TODO *80 table? (a bit large, need lo,mid,hi maybe just reuse *40 table and do 1 shift.)
|
||||
|
||||
%asm {{
|
||||
stz cx16.VERA_CTRL
|
||||
@ -827,9 +831,9 @@ skip:
|
||||
}}
|
||||
xpos /= 8
|
||||
if width==320
|
||||
xpos += yy*(320/8) as uword
|
||||
xpos += yy*(320/8) as uword ; TODO *40 table
|
||||
else
|
||||
xpos += yy*(640/8) as uword
|
||||
xpos += yy*(640/8) as uword ; TODO *80 table? (a bit large, need lo,mid,hi maybe just reuse *40 table and do 1 shift.)
|
||||
|
||||
%asm {{
|
||||
stz cx16.VERA_CTRL
|
||||
@ -848,10 +852,23 @@ skip:
|
||||
eor cx16.r11L
|
||||
beq +
|
||||
rts
|
||||
+ ; cx16.r10L = new color to set
|
||||
+ ; cx16.r10L = new color to set, check stipple mode
|
||||
lda p8v_mode
|
||||
and #1
|
||||
beq _normal
|
||||
; stipple drawing
|
||||
lda p8v_xx
|
||||
eor p8v_yy
|
||||
and #1
|
||||
php
|
||||
lda p8s_plot.p8v_maskbits,y
|
||||
plp
|
||||
bra _doplot
|
||||
|
||||
_normal ; cx16.r10L = new color to set
|
||||
lda p8s_plot.p8v_maskbits,y
|
||||
ldx cx16.r10L
|
||||
beq +
|
||||
_doplot beq +
|
||||
tsb cx16.VERA_DATA0
|
||||
bra ++
|
||||
+ trb cx16.VERA_DATA0
|
||||
@ -863,9 +880,9 @@ skip:
|
||||
|
||||
sub position(uword @zp xx, uword yy) {
|
||||
if width==320
|
||||
cx16.r0 = yy*(320/8)
|
||||
cx16.r0 = yy*(320/8) ; TODO *40 table
|
||||
else
|
||||
cx16.r0 = yy*(640/8)
|
||||
cx16.r0 = yy*(640/8) ; TODO *80 table? (a bit large, need lo,mid,hi maybe just reuse *40 table and do 1 shift.)
|
||||
cx16.vaddr(0, cx16.r0+(xx/8), 0, 1)
|
||||
}
|
||||
|
||||
|
@ -1948,6 +1948,8 @@ asmsub cleanup_at_exit() {
|
||||
lda #4
|
||||
sta $01 ; rom bank 4 (basic)
|
||||
jsr cbm.CLRCHN ; reset i/o channels
|
||||
lda #9
|
||||
jsr cbm.CHROUT ; enable charset switch
|
||||
_exitcodeCarry = *+1
|
||||
lda #0
|
||||
lsr a
|
||||
|
@ -1152,24 +1152,23 @@ internal class AstChecker(private val program: Program,
|
||||
|
||||
checkLongType(expr)
|
||||
val dt = expr.expression.inferType(program).getOrUndef()
|
||||
if(dt.isUndefined)
|
||||
return // any error should be reported elsewhere
|
||||
|
||||
when (expr.operator) {
|
||||
"-" -> {
|
||||
if (!(dt.isSigned && dt.isNumeric)) {
|
||||
errors.err("can only take negative of a signed number type", expr.position)
|
||||
if(!dt.isUndefined) {
|
||||
when (expr.operator) {
|
||||
"-" -> {
|
||||
if (!(dt.isSigned && dt.isNumeric)) {
|
||||
errors.err("can only take negative of a signed number type", expr.position)
|
||||
}
|
||||
}
|
||||
}
|
||||
"~" -> {
|
||||
if(!dt.isInteger)
|
||||
errors.err("can only use bitwise invert on integer types", expr.position)
|
||||
else if(dt.isBool)
|
||||
errors.err("bitwise invert is for integer types, use 'not' on booleans", expr.position)
|
||||
}
|
||||
"not" -> {
|
||||
if(!dt.isBool) {
|
||||
errors.err("logical not is for booleans", expr.position)
|
||||
"~" -> {
|
||||
if(!dt.isInteger)
|
||||
errors.err("can only use bitwise invert on integer types", expr.position)
|
||||
else if(dt.isBool)
|
||||
errors.err("bitwise invert is for integer types, use 'not' on booleans", expr.position)
|
||||
}
|
||||
"not" -> {
|
||||
if(!dt.isBool) {
|
||||
errors.err("logical not is for booleans", expr.position)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ TODO
|
||||
Future Things and Ideas
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
- reduce the number of collateral errors reported for undefined symbols
|
||||
- Kotlin: can we use inline value classes in certain spots?
|
||||
- Improve the SublimeText syntax file for prog8, you can also install this for 'bat': https://github.com/sharkdp/bat?tab=readme-ov-file#adding-new-syntaxes--language-definitions
|
||||
|
||||
@ -72,8 +73,8 @@ IR/VM
|
||||
|
||||
Libraries
|
||||
---------
|
||||
- monogfx: flood fill should be able to fill stippled (it could do this in the past? vm version does it?)
|
||||
- Sorting module gnomesort_uw could be optimized more, rewrite in asm? Shellshort seems consistently faster even if most of the words are already sorted.
|
||||
- Monogfx: use *40 multiplication lookup tables (possibly *80 as well? but those are a bit large; needing lo,mid,hi)
|
||||
- Add split-word array sorting routines to sorting module?
|
||||
- pet32 target: make syslib more complete (missing kernal routines)?
|
||||
- need help with: PET disk routines (OPEN, SETLFS etc are not exposed as kernal calls)
|
||||
|
@ -5,17 +5,17 @@
|
||||
%zeropage basicsafe
|
||||
|
||||
; A "TUI" for an interactive file selector, that scrolls the selection list if it doesn't fit on the screen.
|
||||
; Returns the name of the selected file. If it is a directory instead, the name will start and end with a slash '/'.
|
||||
; Depends a lot on diskio routines, and uses the drive set in the diskio.drivenumber variable (usually just 8)
|
||||
|
||||
; TODO also show directories (how to distinguish them? what with the result value? start with a slash , so they sort together too?)
|
||||
; TODO joystick control? mouse control?
|
||||
; TODO keyboard typing; jump to the first entry that starts with that character?
|
||||
; TODO keyboard typing; jump to the first entry that starts with that character? (but 'q' for quit stops working then)
|
||||
|
||||
|
||||
main {
|
||||
sub start() {
|
||||
|
||||
fileselector.configure(20, 10, 20, 2)
|
||||
fileselector.configure(20, 10, 20, true, 2)
|
||||
uword chosen = fileselector.select("*")
|
||||
txt.nl()
|
||||
txt.print_ub(cx16.getrambank())
|
||||
@ -40,17 +40,19 @@ fileselector {
|
||||
ubyte dialog_topy = 10
|
||||
ubyte max_lines = 20
|
||||
ubyte buffer_rambank = 1 ; default hiram bank to use for the data buffers
|
||||
bool also_directories = true
|
||||
|
||||
str chosen_filename = "?" * 32
|
||||
uword name_ptr
|
||||
ubyte num_visible_files
|
||||
|
||||
|
||||
sub configure(ubyte column, ubyte row, ubyte max_entries, ubyte rambank) {
|
||||
sub configure(ubyte column, ubyte row, ubyte max_entries, bool also_dirs, ubyte rambank) {
|
||||
dialog_topx = column
|
||||
dialog_topy = row
|
||||
max_lines = max_entries
|
||||
buffer_rambank = rambank
|
||||
also_directories = also_dirs
|
||||
}
|
||||
|
||||
sub select(str pattern) -> uword {
|
||||
@ -85,7 +87,7 @@ fileselector {
|
||||
txt.column(dialog_topx)
|
||||
footerline()
|
||||
|
||||
ubyte num_files = diskio.list_filenames(pattern, filenamesbuffer, filenamesbuf_size) ; use Hiram bank to store the files
|
||||
ubyte num_files = get_filenames(pattern, filenamesbuffer, filenamesbuf_size) ; use Hiram bank to store the files
|
||||
ubyte selected_line
|
||||
ubyte top_index
|
||||
uword filename_ptrs
|
||||
@ -302,4 +304,40 @@ fileselector {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub get_filenames(uword pattern_ptr, uword filenames_buffer, uword filenames_buf_size) -> ubyte {
|
||||
uword buffer_start = filenames_buffer
|
||||
ubyte files_found = 0
|
||||
filenames_buffer[0]=0
|
||||
if diskio.lf_start_list(pattern_ptr) {
|
||||
while diskio.lf_next_entry() {
|
||||
bool is_dir = diskio.list_filetype=="dir"
|
||||
if is_dir {
|
||||
if not also_directories
|
||||
continue
|
||||
@(filenames_buffer) = '/' ; directories start with a slash so they're grouped when sorting
|
||||
filenames_buffer++
|
||||
}
|
||||
filenames_buffer += strings.copy(diskio.list_filename, filenames_buffer)
|
||||
if is_dir {
|
||||
@(filenames_buffer) = '/' ; directories also end with a slash
|
||||
filenames_buffer++
|
||||
@(filenames_buffer) = 0
|
||||
}
|
||||
filenames_buffer++
|
||||
files_found++
|
||||
if filenames_buffer - buffer_start > filenames_buf_size-20 {
|
||||
@(filenames_buffer)=0
|
||||
diskio.lf_end_list()
|
||||
sys.set_carry()
|
||||
return files_found
|
||||
}
|
||||
}
|
||||
diskio.lf_end_list()
|
||||
}
|
||||
@(filenames_buffer)=0
|
||||
sys.clear_carry()
|
||||
return files_found
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,18 +1,9 @@
|
||||
%import textio
|
||||
%import strings
|
||||
%import diskio
|
||||
%zeropage basicsafe
|
||||
%option no_sysinit
|
||||
|
||||
main {
|
||||
sub start() {
|
||||
diskio.lf_start_list("")
|
||||
while diskio.lf_next_entry() {
|
||||
txt.print_uw(diskio.list_blocks)
|
||||
txt.spc()
|
||||
txt.print(diskio.list_filename)
|
||||
txt.nl()
|
||||
}
|
||||
diskio.lf_end_list()
|
||||
if not unexistingsymbol
|
||||
cx16.r0++
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user