Vera Development

Got questions? Got answers? Go here for both.

Moderator: MaxCoderz Staff

Post Reply
User avatar
JoostinOnline
Regular Member
Posts: 133
Joined: Wed 11 Jul, 2007 10:42 pm
Location: Behind You

Vera Development

Post by JoostinOnline »

I am part of the Vera project, and we are hoping for some optimizations, and possibly new coders. I thought I would post a couple of sets of code for possible optimizations.

Code: Select all

;; === system_random ===
;;
;; Generate a pseudo random number between 0 and 255
;;
;; Authors:
;;   Joe Wingbermuehle for Ion
;;   Adapted slightly for Vera by Tim Franssen (mail@timendus.com)
;;
;; Post:
;;   a = random number between 0 and 255 inclusive

system_random:
	push    hl
	push    de
	ld      hl,(SEED)
	ld      a,r
	ld      d,a
	ld      e,(hl)
	add     hl,de
	add     a,l
	xor     h
	ld      (SEED),hl
	pop     de
	pop     hl
	ret

Code: Select all

;; === system_sleep ===
;;
;; Sleep for hl * 10.000 + 69 clockcycles
;;
;; Authors:
;;   Tim Franssen (mail@timendus.com)
;;
;; Pre:
;;   hl = number of clockcycles / 10.000 to sleep
;;
;; Example:
;;  	ld hl,SECS2SLEEP(30)
;;  	call system_sleep
;;  	; About 30 seconds have passed

system_sleep:                   ; call = 17 cc
	push af                 ; 11 cc
	push bc                 ; 11 cc
system_sleep_loop1:
	ld b,181                ; 7 cc
system_sleep_loop2:		
	push hl                 ; 11 cc
	pop hl                  ; 10 cc
	push hl                 ; 11 cc
	pop hl                  ; 10 cc
	djnz system_sleep_loop2 ; 13/8 cc
	                        ; total: 55 cc per iteration
	                        ; times 181 = 9955 cc
	
	in b,(c)		; 12 cc
	dec hl                  ; 6 cc
	ld a,h                  ; 4 cc
	or l                    ; 4 cc
	jr nz,system_sleep_loop1; 12/7 cc
	                        ; total overhead per hl: 45 cc
	
	pop bc                  ; 10 cc
	pop af                  ; 10 cc
	ret                     ; 10 cc
	                        ; call overhead: 69 cc
"Macs are the Perfect Computers", said the Perfect Idiot.
Image
Testing for:
Vera
brandonw
New Member
Posts: 17
Joined: Thu 21 Jun, 2007 1:11 pm

Post by brandonw »

Like on the other four forums you posted to, I'll say that there's nothing wrong with Joe's ionRandom routine, and you don't want to read from a random port in register C in the second routine, which could throw off the link assist, USB counter and 0Axh ports, and who knows what else.

How far along is this project in creating a usable OS? How much code is written? How many developers do you currently have? Is there a plan or timeline already in place?
User avatar
Dwedit
Maxcoderz Staff
Posts: 579
Joined: Wed 15 Dec, 2004 6:06 am
Location: Chicago!
Contact:

Post by Dwedit »

Never try to waste time without using HALT. Your batteries will thank you.

The random number generator will not work with multiplayer linking games, as I found out the hard way one time. You need a purely deterministic one, and pre-exchange of a seed.
You know your hexadecimal output routine is broken when it displays the character 'G'.
User avatar
JoostinOnline
Regular Member
Posts: 133
Joined: Wed 11 Jul, 2007 10:42 pm
Location: Behind You

Post by JoostinOnline »

brandonw wrote:How far along is this project in creating a usable OS? How much code is written? How many developers do you currently have? Is there a plan or timeline already in place?
Check the Vera page for answers.
"Macs are the Perfect Computers", said the Perfect Idiot.
Image
Testing for:
Vera
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

@Dwedit: Thanks for those hints! Will look into them.

@Brandon:

I'll just reply on one forum, as I don't have accounts on most of the others.

I've been running the project for a few months, since about october last year. I'll agree with you that before that time not much was going on, which is why I adopted it as a personal toy. Because I don't have the time to write a full blown OS by myself I've been asking people to help me, and give me advice. About twelve people have since joined my mailinglist and have been giving me some great input, even working code.

The Vera kernel, as far as it exists at this point, can boot the calculator, initialize the hardware, handle interrupts with application specific hooks, has all kinds of routines for text in- and output and other purposes, and the last thing I've been working on is the memory management. You can allocate and free a chunk of RAM, but you can't really load an application yet, nor is there a file system in the flash memory.

The project has been a bit dead as of late because I've been very busy with work and studying, not to mention my girlfriend and family, and of course because of the general lack of interest in the community as a whole at this time of year. Because of this, JoostinOnline offered to post some routines to several fora, to see if we could get them optimized a bit, and to draw some attention (and perhaps programmers) to our project.

There is no timeline or anything, there's no hurry. We've managed to gain control over pretty much all the hardware, and offer it to application programmers in easy to use ways, in a few months this year. I guess we'll get the memory stuff going next year when the community revives. The year after that we may see some applications, perhaps even the VM we've been dreaming of.

I don't really like the general attitude and impatience of people towards ambitious projects like these. Of course it's a difficult thing to write, of course you need experienced coders and a good design, but if you just take it slowly you can get there eventually. You can't express the success of a project in how many lines of code it contains, or if it's meeting its deadlines. Neither can you build an OS in three days. You'll see that it has been succesful when it's running on your calculator, and yes, that may take a few more years.
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
CoBB
MCF Legend
Posts: 1601
Joined: Mon 20 Dec, 2004 8:45 am
Location: Budapest, Absurdistan
Contact:

Post by CoBB »

Timendus wrote:You can't express the success of a project in how many lines of code it contains
I have to disagree with that. The less the better! It’s a pity there’s no practical C compiler for the Z80, progress could be a lot faster. :(
brandonw
New Member
Posts: 17
Joined: Thu 21 Jun, 2007 1:11 pm

Post by brandonw »

Timendus wrote:...
I don't really like the general attitude and impatience of people towards ambitious projects like these. Of course it's a difficult thing to write, of course you need experienced coders and a good design, but if you just take it slowly you can get there eventually. You can't express the success of a project in how many lines of code it contains, or if it's meeting its deadlines. Neither can you build an OS in three days. You'll see that it has been succesful when it's running on your calculator, and yes, that may take a few more years.
...
That's the most informative piece of information I've seen on the project. Maybe I'm just dumb, but I didn't see any of that on the site.
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

Well, the site is a bit chaotic, that much is true :) But if you look at the "Current Topics" on the main page, you can get some idea of what we've been working on last. You can also find instructions on the site on checking out the source repository, so you can see it running yourself.

Anyway, you're welcome. Maybe someone more involved with the other fora might want to distribute my "most informative" post elsewhere?

@CoBB: You're right, of course. In most cases good, small code is to be prefered over good, large code. That's more or less what I meant when I said that you can't express success in the amount of LOC. But I guess you got that :)
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
Post Reply