funkheld Posted November 15, 2020 Share Posted November 15, 2020 hello tanks all for help and info. greeting Quote Link to comment Share on other sites More sharing options...
funkheld Posted November 15, 2020 Share Posted November 15, 2020 hello, load data (bin) to atarixl. how can you change that below please: export char DATEN[]..... --------------------------------------- export char SPRITE[] = kickasm(resource "sprite.png") {{ .var pic = LoadPicture("sprite.png", List().add($000000, $ffffff)) .for (var y=0; y<21; y++) .for (var x=0;x<3; x++) .byte pic.getSinglecolorByte(x,y) }}; ------------------------------------- greeting Quote Link to comment Share on other sites More sharing options...
fenrock Posted November 15, 2020 Share Posted November 15, 2020 1 hour ago, funkheld said: hello, load data (bin) to atarixl. how can you change that below please: export char DATEN[]..... --------------------------------------- export char SPRITE[] = kickasm(resource "sprite.png") {{ .var pic = LoadPicture("sprite.png", List().add($000000, $ffffff)) .for (var y=0; y<21; y++) .for (var x=0;x<3; x++) .byte pic.getSinglecolorByte(x,y) }}; ------------------------------------- greeting A few questions: 1. What's the format of the source file? (i.e. what size is it (X by Y), and how many colours does it have?) 2. What format do you need to output to be in your own file? 3. Have you read section 12.4 of http://theweb.dk/KickAssembler/KickAssembler.pdf ? Everything kick assembler supports for loading images is explained in the pdf above. You have several ways to get the data and convert it into bytes in your program; getSingleColorByte, getMultiColorByte and getPixel. If you provide a List (like you have in the code copied from kickc manual) it will convert any color 0 to $000000, and color 1 to $ffffff (3 bytes for R, G, B). There is also an example in the manual of doing 4 colors. Alternatively you can use getPixel and do the conversion yourself. But that's where you need to do the work. Because you're in the world of kick assembler inside the kickasm block of code, you can do anything the assembler supports. It has a quite extensive language built into it, so you can convert every pixel you are reading into anything you need, but without knowing what format you want the output to be, it's difficult to help you any more. Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted November 15, 2020 Share Posted November 15, 2020 Don't know Kickc personally, but it looks like your trying to load a picture file, if thats so then you need a device spect to load from i.e. LoadPicture("D1:sprite.png", Quote Link to comment Share on other sites More sharing options...
fenrock Posted November 15, 2020 Share Posted November 15, 2020 2 minutes ago, TGB1718 said: Don't know Kickc personally, but it looks like your trying to load a picture file, if thats so then you need a device spect to load from i.e. LoadPicture("D1:sprite.png", This is during assembly, not during runtime, so D1 isn't relevent here, as it's running on his laptop/PC. His question is actually about kick assembler, which kickc passes its ASM generated file to, but in the case of the code listed above, you can see there's a "kickasm {{ ... }}" block, which kickc passes naked to the assembler. It supports converting graphics into assembly output for you, and lots of other great stuff. I think he's trying to take a PM graphics file and convert it to binary .bytes for his eventual program. This is all doable in the assembler, but we need more information about the specifics to really help. 1 Quote Link to comment Share on other sites More sharing options...
funkheld Posted November 15, 2020 Share Posted November 15, 2020 (edited) Hi, Thank You. I just want to load a bin file into an array from atarixl here. this is TEST.BIN (3840 byte) array is : char data[] export char DATA [] ....... without converting a file in any way. greeting Edited November 15, 2020 by funkheld Quote Link to comment Share on other sites More sharing options...
JesperGravgaard Posted November 15, 2020 Share Posted November 15, 2020 38 minutes ago, funkheld said: Hi, Thank You. I just want to load a bin file into an array from atarixl here. this is TEST.BIN (3840 byte) array is : char data[] export char DATA [] ....... without converting a file in any way. This is how I usually initialize a char[] to the contents of a binary file. export char TILES[] = kickasm(resource "smb1_chr.bin") {{ .import binary "smb1_chr.bin" }}; If you know the size of the file to be 3840 you can help the compiler by specifying that export char DATA[3840] = ... A final note: The export keyword is not needed if your code uses the DATA array. It is only needed if you want to include the data in your program even if the code does not use it. Quote Link to comment Share on other sites More sharing options...
funkheld Posted November 15, 2020 Share Posted November 15, 2020 Hi, Thank You. it works wonderfully to push the data into the array. greeting Quote Link to comment Share on other sites More sharing options...
Dmitry Posted November 25, 2020 Share Posted November 25, 2020 (edited) Not to hijack the thread, but thanks for the linker definition. I think that is what I need. My goal is not to get a smaller XEX file. It's not to make a program run on a 32k atari either. I have 2 goals - and I mention in case that influences the answer, what I do want to do, is use bank switching. I prefer to set up the code to use bank switching from the start, then go bonkers with animations and waste memory as I see fit. However - today, I am not testing bank switching, I just want to start my code in Bank 2, and put my screen in Bank 1. I will then someday swap banks around in the $4000 to $7FFF window as I see fit. The secondary goal, is just to have the memory plan set - just simple reasonable something to get started, I just really cannot spend too much time on minutia, or the project bogs down. So, here is my plan. Start code at $8000 Bank 2. That's be my program code. Put my screen data in $4000, that'll be where Antic finds stuff. Someday I may swap those banks, but today I'm not even doing that. Here is the ld that I created, modified the the ld that was posted earlier in this thread. Does it look like its reasonable? It doesn't crash. But, why do I have to define this segment called "Data". What goes in Data? I'm aware is some super basic question, but it just helps to ask the simplest of questions, because it clarifies. thanks Edit: In case it's not clear, I'm fine with this limitation: My code will not take more than 16K (Bank 2). My characters data/animations will not take more than 64K (16k * 4 banks). Doesn't matter to me if it was technically possible to squeeze out more, that would be for a future project to squeeze the last bit....:). haha...anyway, thanks in advance for any help! //https://atariage.com/forums/topic/313212-funkheld-kickc-questions/ .file [name="%O", type="bin", segments="XexFile"] .segmentdef XexFile .segment XexFile // Binary File Header .byte $ff, $ff // Program segment [start address, end address, data] .word ProgramStart, ProgramEnd-1 .segmentout [ segments="Program" ] // RunAd - Run Address Segment [start address, end address, data] .word $02e0, $02e1 .word %E .segmentdef Program [segments="ProgramStart, Code, Data, Screen, ProgramEnd"] .segmentdef ProgramStart [start=$8000] .segment ProgramStart ProgramStart: .segmentdef Code [startAfter="ProgramStart"] .segmentdef Data [startAfter="Code"] .segmentdef Screen [start=$4000] .segmentdef ProgramEnd [startAfter="ProgramStart"] .segment ProgramEnd ProgramEnd: Edited November 25, 2020 by Dmitry Quote Link to comment Share on other sites More sharing options...
Dmitry Posted November 25, 2020 Share Posted November 25, 2020 P.s. I understand in Assembler, including KickAssembler, that I would use a * directive to tell the assembler where to place output, e.g. *=$4000 “Data”. And I know that from reading the manual. However, I didn't label a memory area called Data in my program. I know of no reason why it's required, except I cannot remove it, or the compile fails. Quote Link to comment Share on other sites More sharing options...
funkheld Posted November 26, 2020 Share Posted November 26, 2020 (edited) Hi good afternoon. years ago i had tested the compy-ram 512kb in altirra. 7680 byte shifted to $4000 and switched. no further idea came to me to do something different. your idea is great from $4000 to $7fff use as a program. here is my simple demo of action! greeting MODULE BYTE ARRAY COMPY = [$23 $27 $2B $2F $63 $67 $6B $6F $61 $29 $65 $25 $69 $2D $6D $21 $A1 $A3 $A5 $A7 $A9 $AB $AD $AF $E1 $E3 $E5 $E7 $E9 $EB $ED $EF] PROC DELAY(CARD Z) CARD I FOR I=0 TO Z DO OD RETURN PROC MAIN () CARD SAVMSC=$58, CO, I BYTE C, K, CO1 CO=54017 GRAPHICS (24) COLOR=1 ZERO(SAVMSC,7680) PLOT(0,0) DRAWTO(159,95) C=PEEK(COMPY) POKE(CO,C) ZERO(16384,7680) MOVEBLOCK(16384,SAVMSC,7680) POKE(CO,253) ZERO(SAVMSC,7680) PLOT(159,0) DRAWTO(0,95) C=PEEK(COMPY+1) POKE(CO,C) ZERO(16384,7680) MOVEBLOCK(16384,SAVMSC,7680) POKE(CO,253) ZERO(SAVMSC,7680) DELAY(50000) DELAY(50000) C=PEEK(COMPY) POKE(CO,C) MOVEBLOCK (SAVMSC,16384,7680) POKE(CO,253) DELAY(50000) DELAY(50000) C=PEEK(COMPY+1) POKE(CO,C) MOVEBLOCK (SAVMSC,16384,7680) POKE(CO,253) DO OD RETURN Edited November 26, 2020 by funkheld Quote Link to comment Share on other sites More sharing options...
funkheld Posted November 26, 2020 Share Posted November 26, 2020 my program always starts at $ 8000 and the screen is at $ 4000. if I have a simple dos-dsk, I can put the screen for $ 2000. greeting #pragma target(atarixl) #pragma emulator("65XEDebugger") #include <atari-xl.h> char* SCREEN = $4000; int zahl; void main() { *SDMCTL = 0x21; *SDLST = DISPLAY_LIST; for(zahl=0;zahl<3600;zahl++) { SCREEN[zahl]=129; } while (1) ; } char DISPLAY_LIST[] = { $70 , $70 , $70 , $4D , $00 , $40 , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $0D , $41 }; Quote Link to comment Share on other sites More sharing options...
fenrock Posted November 26, 2020 Share Posted November 26, 2020 21 hours ago, Dmitry said: Doesn't matter to me if it was technically possible to squeeze out more, that would be for a future project to squeeze the last bit....:). haha...anyway, thanks in advance for any help! //https://atariage.com/forums/topic/313212-funkheld-kickc-questions/ .file [name="%O", type="bin", segments="XexFile"] .segmentdef XexFile .segment XexFile // Binary File Header .byte $ff, $ff // Program segment [start address, end address, data] .word ProgramStart, ProgramEnd-1 .segmentout [ segments="Program" ] // RunAd - Run Address Segment [start address, end address, data] .word $02e0, $02e1 .word %E .segmentdef Program [segments="ProgramStart, Code, Data, Screen, ProgramEnd"] .segmentdef ProgramStart [start=$8000] .segment ProgramStart ProgramStart: .segmentdef Code [startAfter="ProgramStart"] .segmentdef Data [startAfter="Code"] .segmentdef Screen [start=$4000] .segmentdef ProgramEnd [startAfter="ProgramStart"] .segment ProgramEnd ProgramEnd: I don't think this will work, as you're setting the ProgramEnd to be right after the ProgramStart. Building XeX files has become much simpler in the latest version of kickC. You can now use a loader file like this: .plugin "dk.camelot64.kickass.xexplugin.AtariXex" .file [name="%O", type="bin", segments="File"] .segmentdef File [segments="Program", modify="XexFormat", _RunAddr=main] .segmentdef Program [segments="Code, Data, Screen, DList, Fonts"] .segmentdef Code [start=$8000] .segmentdef Data [startAfter="Code"] .segmentdef Screen [start=$4000] .segmentdef DList [start=$5000] .segmentdef Fonts [start=$7000] All the old way of having $ff, and ProgramStart / ProgramEnd has been removed in place of the AtariXex plugin. I've posted a full application build of your code at This breaks the application up into different segments that load into different memory locations correctly. It has the bonus of getting the file size down without you having to do anything, so consider that a gift Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.