I wrote a program/hack in Processing to save an images compressed data in text for asm. I also created a dll for asmstudio8x to create an appvar. I created a viewer assembly program and it will display an image unless the appvar spans across pages. If the appvar is stored on one page it will display an image without problems. However, if it's drawing an image and it needs to change pages, the data is not on the next page. Here's some code without using compression. I think the problem is at IncMemPort. It would help if I could find the FlashToRam routine in the ROM to verify.


Code:

 di
 xor a
 out ($10),a
 ld a,$22   ;set GRAM register
 out ($10),a
 ld hl,PicName
 bcall(_Mov9ToOP1)
 bcall(_ChkFindSym) ;b=$0e (rom) de=$6ef6
 ex de,hl
 ld de,20 ;will point it to the data
 add hl,de
 bit 7,h
 jp z,PageGood
 inc b ;next page
 ld a,h
 sub $40
 ld h,a ;if hl happened to point past $7fff
PageGood:
 ld a,b
 call SetMemPage ;sets the rom page to $0e initially
 ld bc,$8000
CopyData:
 bit 7,h
 jp z,KeepPage
 call IncMemPort ;draws image until it has to change
 ld hl,$4000     ;pages. just starts displaying garbage.
KeepPage:
 ld a,(hl)
 out ($11),a
 ld a,b
 or c
 jp nz,CopyData
 ei
 ret

IncMemPort:
 ld a,($06)
 inc a
SetMemPage:
 bit 7,a
 jp z, Low
 xor a
 out ($06),a
 ld a,($0e)
 inc a
 out ($0e),a
 ret
Low:
 out ($06),a
 ret

Pic:
.db 0,0,0
PicName:
.db $15,"TESTAPPV", $00 ;appvar that stores image data
In IncMemPort, you have LD A, (06) and LD A, (0Eh) when you should be using IN A, (06) and IN A, (0Eh).

Also, if the appvar is located on a flash page above 80h, SetMemPage will set reset P:06 to 00 (instead of writing 00-7F) and possibly write garbage to P:0E. You should consider having a separate routine for setting the flash page initially, e.g. RLCA \ OUT (0Eh), A \ SRL A \ OUT (06), A ; writing garbage to bit 1 of 0E is bad form but acceptable
Oh my god... I am an idiot!!!! ld instead of in??? Thank you DrDnar. That has been bothering me for most of the day. I will change SetMemPage also.

I put up a video on youtube showing off the display

http://www.youtube.com/watch?v=-Xakg8cBjSQ

Thanks again! I get burnt out sometimes!
I'd like to suggest using OUTI for a minor speed improvement. Alternatively, you could try your hand at lossy image compression using a variant on discrete cosine transfer + Huffman coding like JPEGs use.
I use rle to compress the files. I wrote the code to find the least occurring byte in the file and use it as a run signal. I reduce the amount of colors in the image using photoshop if necessary. I also don't use dithering if it looks good without it. The city image has 64 colors and uses 1 byte per pixel. Its 76,935 bytes uncompressed and 55,523 bytes after. It's not the best but I can fit about 65,400 bytes into an appvar. Thanks one more time for catching that error! Sometimes I look over my code a hundred times and still manage to miss stuff.

The Flash app and source is at http://briandm82.com/ti84cse/ along with a simple text display routine and some dlls for ASMStudio8x. The IViewer app should be up on ticalc.org sometime soon too.
  
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