...Program

I'm pretty new to assembly/anything low level at all, so I decided to attempt to make a sprite-editor for KnightOS to broaden my understanding of basically everything d:

So far it doesn't support drawing or movement, but I hope to finish it up within the next month or so (depends how busy I am with school/life). Maybe I'll try and make it in TI-basic or something in the future, but atm I really like the idea of KnightOS and want to experiment with it.

The code can be found on https://github.com/maxleiter/kimp but it's pretty depressing imo.

Eventually I would like to support exporting to KnightOS's img format 'kimg', but currently there's no kernel support for it and I have no idea where I would start. The current plan for saving is simple binary, where 0's represent a blank square and 1's represent a filled on (example can be found on the readme on github).

any ideas/criticisms/etc welcome

Here's a quick video of KIMP atm, with the cursor


Right now, I need to figure out how to A) store the 'pixels' (4x4 'pixels'), and B) loop the cursor movements somehow, right now its a huge define-word block
Welcome, and sounds like an interesting project! Since it has such a broader audience, perhaps you could consider making the project assemble for the TI-OS as well? You could make it edit the Picture format, which is very well-understood. In addition, for a TI-BASIC implementation, take a look at this TI-BASIC GIMP clone currently under development by Nik_.
KermMartian wrote:
Welcome, and sounds like an interesting project! Since it has such a broader audience, perhaps you could consider making the project assemble for the TI-OS as well? You could make it edit the Picture format, which is very well-understood. In addition, for a TI-BASIC implementation, take a look at this TI-BASIC GIMP clone currently under development by Nik_.


I'd like to make it for TI-OS eventually but have 0 idea where to start, maybe once I have a working prototype I'll look into it some more. I can't find anything on the Picture format, mind providing a link or something?
It's extremely easy, if you have some z80 ASM experience. I usually recommend the Doors CS SDK: just put your source code in the source directory, pop open a command window and type "compile myprgm", and the result appears in the exec directory. The name notwithstanding, the SDK also lets you make so-called nostub programs that don't require the Doors CS shell. If you're not experience with calculator programming, though, I'd recommend looking into TI-BASIC a bit, as it's a good, fun, and easy first step to get familiar with calculators before stepping into the more complex z80 ASM.

Edit: For the 8xp format, take a look at this: http://merthsoft.com/linkguide/ti83+/vars.html
I kind of doubt anyone can help with this, but I've spent all day trying to figure it out and it's halting any other progress. For some reason, pressing any key causes the main_menu label/function to fire, not just F3 like specified here: https://github.com/MaxLeiter/KIMP/blob/master/main.asm#L82-L83

Any ideas as to why this is happening? The menu code is basically taken from other KnightOS projects which work properly.

EDIT: Was able to mostly fix it, I was calling an extra pcall(flushKeys) because I thought it was necessary. Next step: cursor!
Hopefully it's been long enough to double post;


Added a basic cursor, doesn't loop in any direction yet but it (sometimes Razz) moves correctly. Need to find a way to loop the creation of the actual grid (atm its hardcoded), and line up the cursor positions accordingly (they're also hardcoded). If anyone has some psuedocode/ideas as to how to go about it please let me know, I'm a little lost...
24 hours is our double-posting limit, and we're a little more relaxed for Your Projects topics, so you're fine. That doesn't look like a jsTIfied screenshot; is that from WabbitEmu? I've never seen a 480x320-pixel screenshot from an emulator, I think, only the standard 192x128 pixels. Anyway, nice work on the progress! Can you throw us some code for how you're currently drawing the grid and computing the cursor position?
KermMartian wrote:
24 hours is our double-posting limit, and we're a little more relaxed for Your Projects topics, so you're fine. That doesn't look like a jsTIfied screenshot; is that from WabbitEmu? I've never seen a 480x320-pixel screenshot from an emulator, I think, only the standard 192x128 pixels. Anyway, nice work on the progress! Can you throw us some code for how you're currently drawing the grid and computing the cursor position?


It's probably a screenshot from z80e, KnightOS's emulator
The JS TI-68k emulator can make screenshots at scales 1, 2, 3 and 4, which can yield screenshots even much larger than 480x320 pixels. 480 is a multiple of both 160 and 240, but neither 100, nor 128 divide 320.
Lionel Debroux wrote:
The JS TI-68k emulator can make screenshots at scales 1, 2, 3 and 4, which can yield screenshots even much larger than 480x320 pixels. 480 is a multiple of both 160 and 240, but neither 100, nor 128 divide 320.
*I've never seen a 480x320-pixel screenshot from an emulator emulating a z80 calculator.
KermMartian wrote:
24 hours is our double-posting limit, and we're a little more relaxed for Your Projects topics, so you're fine. That doesn't look like a jsTIfied screenshot; is that from WabbitEmu? I've never seen a 480x320-pixel screenshot from an emulator, I think, only the standard 192x128 pixels. Anyway, nice work on the progress! Can you throw us some code for how you're currently drawing the grid and computing the cursor position?

As Ivoah said, I'm using z80e, KnightOS's emulator (because I don't need to upload the ROM or anything).

The code is all available on GitHub, except for the new cursor code, but here's a snippet of how I'm drawing the table:

Code:
.macro line(x1, y1, x2, y2)
    ld hl, (x1 + upper_x) * 256 + (y1 + upper_y)
    ld de, (x2 + upper_x) * 256 + (y2 + upper_y)
    pcall(drawLine)
.endmacro
    ;10x10
    ;horizontal
    line(28, 0, 68, 0)
    line(28, 4, 68, 4)
    line(28, 8, 68, 8)
    line(28, 12, 68, 12)
    line(28, 16, 68, 16)
    line(28, 20, 68, 20)
    ...same thing a bunch



The cursor itself has positions which are just defined bytes (ie db x,y), and moving the cursor is simply


Code:
.right:
    kld(a, (current)) ;the current location, initially 0
    inc a
    cp (cursorPos_end - cursorPos) / 2 + 1
    jr z, main_loop
    kld((current), a)
    jr main_loop



Lionel Debroux wrote:
The JS TI-68k emulator can make screenshots at scales 1, 2, 3 and 4, which can yield screenshots even much larger than 480x320 pixels. 480 is a multiple of both 160 and 240, but neither 100, nor 128 divide 320.


I probably had the emulator scaled.


EDIT: I got the cursor to move, but it uses defined words (.dw x,y like .dw 25, 39) for its location. Any suggestions/ideas on how to loop/mathematically solve this in ASM? https://sr.ht/DvgK.txt is the current code
Since, like Kerm said, I am working on an Image Manipulation Program too, I would be glad to help with algorithms in TI-BASIC. But I don't know any assembly, so this part would be your work.

Anyway - if you ever need help, just let me know!
MaxLeiter wrote:
EDIT: I got the cursor to move, but it uses defined words (.dw x,y like .dw 25, 39) for its location. Any suggestions/ideas on how to loop/mathematically solve this in ASM? https://sr.ht/DvgK.txt is the current code
(29 + 4*x) + (55 - 4*y). That's an easy one; if you store x and y separately:

Code:
ld a,(x)
add a,a
add a,a
add a,29
ld e,a
ld a,(y)
add a,a
add a,a
ld l,a
ld a,55
sub l
ld l,a
; Outputs: e=x, l=y
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement