mirror of
				https://github.com/irmen/prog8.git
				synced 2025-11-04 10:16:13 +00:00 
			
		
		
		
	gfx2 future mode, upgrate to Kotlin 1.9.20
This commit is contained in:
		
							
								
								
									
										2
									
								
								.idea/kotlinc.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								.idea/kotlinc.xml
									
									
									
										generated
									
									
									
								
							@@ -4,6 +4,6 @@
 | 
				
			|||||||
    <option name="jvmTarget" value="11" />
 | 
					    <option name="jvmTarget" value="11" />
 | 
				
			||||||
  </component>
 | 
					  </component>
 | 
				
			||||||
  <component name="KotlinJpsPluginSettings">
 | 
					  <component name="KotlinJpsPluginSettings">
 | 
				
			||||||
    <option name="version" value="1.9.0-release-358" />
 | 
					    <option name="version" value="1.9.20" />
 | 
				
			||||||
  </component>
 | 
					  </component>
 | 
				
			||||||
</project>
 | 
					</project>
 | 
				
			||||||
@@ -159,6 +159,7 @@ val ElementToArrayTypes = mapOf(
 | 
				
			|||||||
    DataType.FLOAT to DataType.ARRAY_F,
 | 
					    DataType.FLOAT to DataType.ARRAY_F,
 | 
				
			||||||
    DataType.BOOL to DataType.ARRAY_BOOL
 | 
					    DataType.BOOL to DataType.ARRAY_BOOL
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
val Cx16VirtualRegisters = arrayOf(
 | 
					val Cx16VirtualRegisters = arrayOf(
 | 
				
			||||||
    RegisterOrPair.R0, RegisterOrPair.R1, RegisterOrPair.R2, RegisterOrPair.R3,
 | 
					    RegisterOrPair.R0, RegisterOrPair.R1, RegisterOrPair.R2, RegisterOrPair.R3,
 | 
				
			||||||
    RegisterOrPair.R4, RegisterOrPair.R5, RegisterOrPair.R6, RegisterOrPair.R7,
 | 
					    RegisterOrPair.R4, RegisterOrPair.R5, RegisterOrPair.R6, RegisterOrPair.R7,
 | 
				
			||||||
@@ -166,6 +167,10 @@ val Cx16VirtualRegisters = arrayOf(
 | 
				
			|||||||
    RegisterOrPair.R12, RegisterOrPair.R13, RegisterOrPair.R14, RegisterOrPair.R15
 | 
					    RegisterOrPair.R12, RegisterOrPair.R13, RegisterOrPair.R14, RegisterOrPair.R15
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					val CpuRegisters = setOf(
 | 
				
			||||||
 | 
					    RegisterOrPair.A, RegisterOrPair.X, RegisterOrPair.Y,
 | 
				
			||||||
 | 
					    RegisterOrPair.AX, RegisterOrPair.AY, RegisterOrPair.XY
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum class OutputType {
 | 
					enum class OutputType {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -89,7 +89,6 @@ internal class FunctionCallAsmGen(private val program: PtProgram, private val as
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private fun argumentsViaRegisters(sub: PtAsmSub, call: PtFunctionCall) {
 | 
					    private fun argumentsViaRegisters(sub: PtAsmSub, call: PtFunctionCall) {
 | 
				
			||||||
        val cpuRegisters = setOf(RegisterOrPair.A, RegisterOrPair.X, RegisterOrPair.Y, RegisterOrPair.AX, RegisterOrPair.AY, RegisterOrPair.XY)
 | 
					 | 
				
			||||||
        val registersUsed = mutableListOf<RegisterOrStatusflag>();
 | 
					        val registersUsed = mutableListOf<RegisterOrStatusflag>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        fun usedA() = registersUsed.any {it.registerOrPair==RegisterOrPair.A || it.registerOrPair==RegisterOrPair.AX || it.registerOrPair==RegisterOrPair.AY}
 | 
					        fun usedA() = registersUsed.any {it.registerOrPair==RegisterOrPair.A || it.registerOrPair==RegisterOrPair.AX || it.registerOrPair==RegisterOrPair.AY}
 | 
				
			||||||
@@ -104,7 +103,7 @@ internal class FunctionCallAsmGen(private val program: PtProgram, private val as
 | 
				
			|||||||
                val param = sub.parameters[it]
 | 
					                val param = sub.parameters[it]
 | 
				
			||||||
                val arg = call.args[it]
 | 
					                val arg = call.args[it]
 | 
				
			||||||
                registersUsed += if(usesOtherRegistersWhileEvaluating(arg)) {
 | 
					                registersUsed += if(usesOtherRegistersWhileEvaluating(arg)) {
 | 
				
			||||||
                    if(!registersUsed.any{it.statusflag!=null || it.registerOrPair in cpuRegisters})
 | 
					                    if(!registersUsed.any{it.statusflag!=null || it.registerOrPair in CpuRegisters})
 | 
				
			||||||
                        argumentViaRegister(sub, IndexedValue(it, param.second), arg)
 | 
					                        argumentViaRegister(sub, IndexedValue(it, param.second), arg)
 | 
				
			||||||
                    else if(registersUsed.any {it.statusflag!=null}) {
 | 
					                    else if(registersUsed.any {it.statusflag!=null}) {
 | 
				
			||||||
                        throw AssemblyError("call argument evaluation problem: can't save cpu statusregister parameter ${call.position}")
 | 
					                        throw AssemblyError("call argument evaluation problem: can't save cpu statusregister parameter ${call.position}")
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,10 +14,10 @@
 | 
				
			|||||||
; SCREEN MODE LIST:
 | 
					; SCREEN MODE LIST:
 | 
				
			||||||
;   mode 0 = reset back to default text mode
 | 
					;   mode 0 = reset back to default text mode
 | 
				
			||||||
;   mode 1 = bitmap 320 x 240 x 256c (8 bpp)
 | 
					;   mode 1 = bitmap 320 x 240 x 256c (8 bpp)
 | 
				
			||||||
;   mode 2 = bitmap 640 x 480 x 4c (2 bpp. there's not enough vram for more colors in hires mode.)
 | 
					;   mode 2 = bitmap 640 x 480 x 4c (2 bpp)
 | 
				
			||||||
;   mode 3 = bitmap 320 x 240 x 16c (not yet implemented: just use 256c, there's enough vram for that)
 | 
					;   mode 3 = bitmap 320 x 240 x 4c (not yet implemented: just use 256c, there's enough vram for that)
 | 
				
			||||||
;   mode 4 = bitmap 320 x 240 x 4c (not yet implemented: just use 256c, there's enough vram for that)
 | 
					;   mode 4 = bitmap 320 x 240 x 16c (not yet implemented: just use 256c, there's enough vram for that)
 | 
				
			||||||
;   higher color depths in highres are not supported due to lack of VRAM
 | 
					;   mode 5 = bitmap 640 x 400 x 16c (not yet implemented)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
gfx2 {
 | 
					gfx2 {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,10 @@
 | 
				
			|||||||
TODO
 | 
					TODO
 | 
				
			||||||
====
 | 
					====
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- fix the parameter passing bug intruduced recently. Example: cx16.FB_cursor_position(math.rnd(), math.rnd())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- add a %zpallowed option to specify the range of zeropage register that can be used (intersect with the actual available zp registers ofcourse)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- [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 ....
 | 
				
			||||||
- [on branch: ir-less-branch-opcodes] IR: reduce the number of branch instructions such as BEQ, BEQR, etc (gradually), replace with CMP(I) + status branch instruction
 | 
					- [on branch: ir-less-branch-opcodes] IR: reduce the number of branch instructions such as BEQ, BEQR, etc (gradually), replace with CMP(I) + status branch instruction
 | 
				
			||||||
- IR: reduce amount of CMP/CMPI after instructions that set the status bits correctly (LOADs? INC? Bitwise operations, etc), but only after setting the status bits is verified!
 | 
					- IR: reduce amount of CMP/CMPI after instructions that set the status bits correctly (LOADs? INC? Bitwise operations, etc), but only after setting the status bits is verified!
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,28 +1,16 @@
 | 
				
			|||||||
%import textio
 | 
					%import syslib
 | 
				
			||||||
 | 
					%import gfx2
 | 
				
			||||||
%import math
 | 
					%import math
 | 
				
			||||||
%option no_sysinit
 | 
					 | 
				
			||||||
%zeropage basicsafe
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
main {
 | 
					main {
 | 
				
			||||||
    sub start() {
 | 
					    sub start() {
 | 
				
			||||||
        uword[] array = [$1010,$2020,$3030,$4040,$5050]
 | 
					        void cx16.screen_mode(128, false)
 | 
				
			||||||
        ubyte index = 2
 | 
					 | 
				
			||||||
        uword value = $0205
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        array[index] ^= $0205
 | 
					        ubyte color
 | 
				
			||||||
        txt.print_uwhex(array[2], true)
 | 
					        repeat {
 | 
				
			||||||
        txt.nl()
 | 
					            cx16.FB_cursor_position(math.rnd(), math.rnd())
 | 
				
			||||||
 | 
					            cx16.FB_set_pixel(color)
 | 
				
			||||||
        array[index]+=9
 | 
					            color++
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        txt.print_uwhex(array[2], true)
 | 
					 | 
				
			||||||
        txt.nl()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        array[index] = $3030
 | 
					 | 
				
			||||||
        array[index] |= value
 | 
					 | 
				
			||||||
        txt.print_uwhex(array[2], true)
 | 
					 | 
				
			||||||
        txt.nl()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        ; TODO met var array[index]|=index
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,5 +4,5 @@ org.gradle.parallel=true
 | 
				
			|||||||
org.gradle.daemon=true
 | 
					org.gradle.daemon=true
 | 
				
			||||||
kotlin.code.style=official
 | 
					kotlin.code.style=official
 | 
				
			||||||
javaVersion=11
 | 
					javaVersion=11
 | 
				
			||||||
kotlinVersion=1.9.10
 | 
					kotlinVersion=1.9.20
 | 
				
			||||||
version=9.6-SNAPSHOT
 | 
					version=9.6-SNAPSHOT
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user