mirror of
				https://github.com/irmen/prog8.git
				synced 2025-11-03 19:16:13 +00:00 
			
		
		
		
	doc and opening borders
This commit is contained in:
		@@ -813,6 +813,9 @@ class AsmGen6502Internal (
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    internal fun assignExpressionTo(value: PtExpression, target: AsmAssignTarget) {
 | 
					    internal fun assignExpressionTo(value: PtExpression, target: AsmAssignTarget) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // this is basically the fallback assignment routine, it is RARELY called
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        when {
 | 
					        when {
 | 
				
			||||||
            target.datatype.isByteOrBool -> {
 | 
					            target.datatype.isByteOrBool -> {
 | 
				
			||||||
                if (value.asConstInteger()==0) {
 | 
					                if (value.asConstInteger()==0) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -132,7 +132,7 @@ dealing with all of them separately.  You first define the struct type like so::
 | 
				
			|||||||
You can use boolean fields, numeric fields (byte, word, float), and pointer fields (including str, which is translated into ^^ubyte).
 | 
					You can use boolean fields, numeric fields (byte, word, float), and pointer fields (including str, which is translated into ^^ubyte).
 | 
				
			||||||
You cannot nest struct types nor put arrays in them as a field.
 | 
					You cannot nest struct types nor put arrays in them as a field.
 | 
				
			||||||
Fields in a struct are 'packed' (meaning the values are placed back-to-back in memory), and placed in memory in order of declaration. This guarantees exact size and place of the fields.
 | 
					Fields in a struct are 'packed' (meaning the values are placed back-to-back in memory), and placed in memory in order of declaration. This guarantees exact size and place of the fields.
 | 
				
			||||||
``sizeof()`` knows how to calculate the size of a struct.
 | 
					``sizeof()`` knows how to calculate the combined size of a struct, and ``offsetof()`` can be used to get the byte offset of a given field in the struct.
 | 
				
			||||||
The size of a struct cannot exceed 1 memory page (256 bytes).
 | 
					The size of a struct cannot exceed 1 memory page (256 bytes).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
You can copy the whole contents of a struct to another one by assigning the dereferenced pointers::
 | 
					You can copy the whole contents of a struct to another one by assigning the dereferenced pointers::
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -170,6 +170,7 @@ Libraries
 | 
				
			|||||||
Optimizations
 | 
					Optimizations
 | 
				
			||||||
-------------
 | 
					-------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- check that expressions such as  targetvar = value1 + value2  , targetvar = value1 ^ value2   etc.   use the target variable directly and not use needless temp var / registers
 | 
				
			||||||
- Port benchmarks from https://thred.github.io/c-bench-64/  to prog8 and see how it stacks up.
 | 
					- Port benchmarks from https://thred.github.io/c-bench-64/  to prog8 and see how it stacks up.
 | 
				
			||||||
- Since fixing the missing zp-var initialization, programs grew in size again because STZ's reappered. Can we add more intelligent (and correct!) optimizations to remove those STZs that might be redundant again?
 | 
					- Since fixing the missing zp-var initialization, programs grew in size again because STZ's reappered. Can we add more intelligent (and correct!) optimizations to remove those STZs that might be redundant again?
 | 
				
			||||||
- in Identifier: use typedarray of strings instead of listOf? Other places?
 | 
					- in Identifier: use typedarray of strings instead of listOf? Other places?
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,17 +7,17 @@ main {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    sub start() {
 | 
					    sub start() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        txt.print("balloon sprites!\n...we are all floating...\n")
 | 
					        txt.print("balloon sprites!\n...we are all floating...\nborders are open too\n")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ubyte @zp i
 | 
					        ubyte @zp i
 | 
				
			||||||
        for i in 0 to 7 {
 | 
					        for i in 0 to 7 {
 | 
				
			||||||
            c64.set_sprite_ptr(i, &spritedata.balloonsprite)           ; alternatively, set directly:  c64.SPRPTR[i] = $0a00 / 64
 | 
					            c64.set_sprite_ptr(i, &spritedata.balloonsprite)           ; alternatively, set directly:  c64.SPRPTR[i] = $0a00 / 64
 | 
				
			||||||
            c64.SPXY[i*2] = 50+25*i
 | 
					            c64.SPXY[i*2] = 60+22*i
 | 
				
			||||||
            c64.SPXY[i*2+1] = math.rnd()
 | 
					            c64.SPXY[i*2+1] = math.rnd()
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        c64.SPENA = 255                ; enable all sprites
 | 
					        c64.SPENA = 255       ; enable all sprites
 | 
				
			||||||
        sys.set_rasterirq(&irq.irqhandler, 255)     ; enable animation
 | 
					        sys.set_rasterirq(&irq.irqhandler, 248)         ; trigger irq just above bottom border line
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -25,6 +25,7 @@ main {
 | 
				
			|||||||
irq {
 | 
					irq {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    sub irqhandler() -> bool {
 | 
					    sub irqhandler() -> bool {
 | 
				
			||||||
 | 
					        c64.SCROLY = 19             ; 24 row mode, preparing for border opening
 | 
				
			||||||
        c64.EXTCOL--
 | 
					        c64.EXTCOL--
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ; float up & wobble horizontally
 | 
					        ; float up & wobble horizontally
 | 
				
			||||||
@@ -39,6 +40,7 @@ irq {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        c64.EXTCOL++
 | 
					        c64.EXTCOL++
 | 
				
			||||||
 | 
					        c64.SCROLY = 27            ; 25 row mode, border is open
 | 
				
			||||||
        return true
 | 
					        return true
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user