prog8 : str name = "test.bmx"....bmx.open(8, name)

All aspects of programming on the Commander X16.
Post Reply
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

prog8 : str name = "test.bmx"....bmx.open(8, name)

Post by funkheld »

Hi good afternoon.

the string:
str name = "test.bmx"
is not recognized for:
bmx.open(8, name)

thanks
greeting.

-----------------------------------
%import textio
%import palette
%import bmx
%option no_sysinit
%zeropage basicsafe

main {

sub start() {
str name = "test.bmx"

void txt.waitkey()
load_bmx()

}

sub load_bmx() {
bmx.open(8, name)
----------------------------------------------
User avatar
desertfish
Posts: 1123
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Re: prog8 : str name = "test.bmx"....bmx.open(8, name)

Post by desertfish »

Sure, because "name" is not in scope in the load_bmx subroutine. It's defined in the start subroutine.
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

Re: prog8 : str name = "test.bmx"....bmx.open(8, name)

Post by funkheld »

hello thanks for help.

I now make png images with this converter
to get finished:
X16PngConverter.exe
effective and fast.

that's how I imagined it.
Load images quickly and easily.
wonderful.

Code: Select all

%import textio
%import palette
%import bmx
%option no_sysinit
%zeropage basicsafe

main {

    str name = "test.bmx"

    sub start() {
	  bmx.open(8, name) 
	  load_bmx()
	  
	  txt.color(5)
          txt.plot(6,4)
	  txt.print("pebisoft")   
	  
	  repeat {}
	}
	
	sub load_bmx() { 
		bmx.palette_buffer_ptr = memory("palette", 512, 0)
		sys.memset(bmx.palette_buffer_ptr, 512, 0)
		palette.set_rgb(bmx.palette_buffer_ptr, 256)

		void cx16.screen_mode($80, false)
		cx16.VERA_L0_CONFIG = cx16.VERA_L0_CONFIG & %11111100 | bmx.vera_colordepth

		cx16.GRAPH_set_colors(0, 0, bmx.border)
		cx16.GRAPH_clear()
		uword offset = (320-bmx.width)/2 + (240-bmx.height)/2*320
		if bmx.continue_load_stamp(0, offset, 320) {
			activate_palette()
		}                                  
    }

    sub activate_palette() {
        cx16.VERA_DC_BORDER = bmx.border
        cx16.r1 = bmx.palette_buffer_ptr
        cx16.r2L = bmx.palette_start
        cx16.r3L = lsb(bmx.palette_entries)
        do {
            palette.set_color(cx16.r2L, peekw(cx16.r1))
            cx16.r1+=2
            cx16.r2L++
            cx16.r3L--
        } until cx16.r3L==0
    }
}
greeting
Attachments
bmx-bild.jpg
bmx-bild.jpg (21.78 KiB) Viewed 441 times
Post Reply