Fair enough.
hangon, how do you close out an OS? Do you like, setup an on-key interrupt and turnoff the lcd or what?
How you "exit" is for you to decide. When the batteries hit the calc, the screen is turned off. You need to turn it on. The calculator also does not wait for ON to be pressed to start executing. The moment the batteries hit it, it starts running, so you should sleep until the ON key is pressed.
sooo...like i said, you just turn off the lcd and wait for an on-key interrupt to turn it back on?
Yes. Here's my sleep routine from KOS:

Code:
Sleep:
   ld a, 2
   out (10h), a ; Disable LCD
   di ; And interrupts, for now
   im 1 ; interrupt mode 1, for cleanliness
   ei ; Enable interrupting when ON is pressed
   ld a, 1h
   out (03h), a ; ON
   halt ; and halt :)
   ld a, 0Bh ; Reset the interrupts
   out (03h), a
   ld a, 3
   out (10h), a ; Enable the screen
   ret
Thanks, that save me some time.I think i might add an On and off table about 4 bytes in size.like...


Code:
.dw On-Routine
.dw Off-Routine

Then people can just write the location of their offscripts and onscripts there to work.
I just tryed compiling and got an error saying LCDDelay wasnt defined, do i just do...


Code:
LCDDelay:
  nop
  nop
  ret

or am i wrong here?
; Do nothing for a few cycles
LCDDelay:
push hl
push de
pop de
pop hl
nop
ret
before i retry the compile, i do type

Code:
  ld sp,$FFFF
to initializ the stack before the programcode?
Probably, I'm not sure about Brass. That line should be the very first thing to execute, though.
SP is decremented before storing data on the stack, so ld sp,0 would save a byte of RAM (unless you were storing something else at $FFFF).

Rather than rely on a fixed delay between LCD accesses (which can break with slower drivers or when the calculator is running at 15MHz) consider polling the LCD's busy flag (bit 7 of I/O port $10; set if the LCD is busy, cleared otherwise):


Code:
busy:
    in a,($10)
    rla
    jr c,busy
I use SafeCopy in the official OS, but that's a good strategy for 15 MHz calculators.
Surprised wow, thats really helpful. Thanks
Actually, port (4) tells which interrupt(s) was/were triggered. Port (3) is the interrupt mask. To acknowledge an interrupt (so it won't be immediately taken after the next EI), you must reset the corresponding port (3) bit and then set it again.
I thought I'd share this script I use to compile my programs, apps, and os's...


Code:
@echo off
set PATH=%cd%;%PATH%
cd /d %~dp1
set out=%2
if #%2==# set out=%~n1.8xp
brass %1
if /I %out:~-3%==hex goto CompOS
if /I %out:~-3%==8xu goto CompOS
wabbit %~n1.bin %out%
goto Done
:CompOS
bin2hex -o %~n1.hex -s0x0000 -p0 %~n1.bin
if /I %out:~-3%==hex del *.bin* & exit
packxxu %~n1.hex -o %~n1.8xu -t 83p -q 04 -v 0.01 -h 255
rabbit -t 8xu -k 05.key -K 05 -g -p -r %~n1.8xu
del %~n1.8xu
ren %~n1-signed.8xu %~n1.8xu
:Done
rem if exist *.bin* del *.bin*
if exist *.hex* del *.hex*


just so you know, rabbit is rabbitsign, wabbit is wabbitsign, and bin2hex is bintointelhex taken from the appdev pack found at ticalc.org.The Os's compile and sign but you get a warning with something about the page header.of course i'm not a hundred percent sure whether or not its compiled complete right as i cant figure out how to compile a rom image to emu with :/
calc84maniac wrote:
Actually, port (4) tells which interrupt(s) was/were triggered. Port (3) is the interrupt mask. To acknowledge an interrupt (so it won't be immediately taken after the next EI), you must reset the corresponding port (3) bit and then set it again.
Whoops, did I say Port 3? I blame all the stuff that was happening yesterday for momentarily discombobulating me.
Anyone know how to compile a .rom file for use with an emu?

Check out my new avatar and sig too Very Happy
If you have a .hex file (not just a renamed .bin file Razz) you can use Hex2Rom. If you are using ZDS, a .hex file is created automatically. With Brass, there may be an option to do this. I can also look into making a Bin2Rom program.
What are the args for that?Can you show me how to convert a .hex to a .rom through the command line?
Hex2ROM 83P [file].hex [output].rom
  
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 3 of 5
» 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