Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Matrefeytontias

Pages: 1 2 3 [4] 5 6 7
46
ASM / [z80] Writing to flash
« on: March 23, 2013, 06:56:50 am »
Hi guys,

I'm working on a file system for cmdOS, and I want every files to be in archive to allow user programs to use a maximal amount of free RAM. I planned to handle it this way :
  • A 3-bytes pointer on a VAT at a static address in RAM consisting of a 2-bytes address (low byte then high byte) and a page number.
  • At the location pointed to by this pointer and in the given flash page, the start of the VAT.
  • After this location, each and every file whose structure will be discussed later.
The problem is : I don't know how to write to flash. I know how to swap pages using ports 6 and 7, but I also know that you can't just write to the corresponding areas like that.

How can I, say, write a byte to a flash page ?

Note that I don't have any built-in routine for that. I'm NOT using the TI-OS nor any library, and I don't want to. I just want to understand how to do that and then being able to implement it.

47
TI Z80 / [z80] cmdOS, a 3rd-party OS written from scratch
« on: March 18, 2013, 06:14:36 am »
Hey guys !

A few days ago I started working on cmdOS, a command line-based 3rd-party OS. I only do that as a training to improve my ASM skills, so I don't plan any future for it. But hey, who knows ? ;)

I started with SirCmpwn's OS starter kit, which provides LCD and flash set up, RAM unlocking and memory mapping. I also used KnightOS's fontmap and putSpriteOR routine with the agreement of SirCmpwn, but I wrote myself everything else (that means, the text routine, the interpreter, and other functions that you don't see in the screenie below).

So, for now the OS boots on a command-line, which fully supports functions with no arguments :) so if you can think of one, please tell me.

Here are the functions already available :
  • SHUTDOWN : guess its use
  • CLS : clear the command-line
  • PING : prints "Pong !" ;D
  • VERSION : prints cmdOS's version
Of course, screenie :



Also, I don't show it in the screenie because I thought of it just after uploading the image, but the text wraps when you reach the bottom and the right edge of the screen :)

Share comments !

48
ASM / [z80] Problems building an OS
« on: March 12, 2013, 12:52:03 pm »
Hey guys,

Don't misunderstand the title, I'm not planning to code the best OS, nor any OS that has useful stuffs in it at all in fact :P

I just downloaded SirCmpwn's AsmOS and only tried to add this to boot.asm at line 140, following the readme's instructions :

Code: [Select]
bootedLoop:
ld d,44
ld e,28
ld b,8
ld iy,$90D3
ld ix,sprite
call PutSpriteOR
ld iy,$90D3
call BufferToLCD

ld a,$FD
out (1),a
in a,(1)
bit 6,a
call z,ShutDown
jp bootedLoop
sprite:
.db %00111100
.db %01000010
.db %10100101
.db %10000001
.db %10100101
.db %10011001
.db %01000010
.db %00111100

The shutdown code is working fine (I mean that it effectively shuts down when pressing [clear]) but the sprite ...



I didn't change anything else ... do you know why it's not working ?

Thanks by advance :)

49
ASM / [Ndless] Can't make a "hello world" work !
« on: March 10, 2013, 05:02:14 pm »
Hi guys,

I recently decided to try out ARM9 assembly for the Nspire, so I wrote a simple "hello world" program ... which I can't even compile.

Here's the code : http://pastebin.com/ReRUv7ED

It seems to compile normally, but on the Nspire nor on nspire_emu it doesn't do anything. Not even crashing. Weird.

So, can someone explain me how to setup the assembly environment correctly and with the latest version of Ndless, so that it'll work properly ?

I also noticed that even hella.tns (an ASM version of hello world, in Ndless's "Samples" directory) didn't work neither on CX or non-CX.

50
ASM / [z80] Needs help debugging a triangle filling routine
« on: March 07, 2013, 04:57:44 pm »
Hey guys,

I'm trying to build a triangle filler out of the algorithm ben_g sent me, and I'm encountering some problems... In most cases, the triangle is not drawn at the location I wanted it to be.

So here's the pseudocode of the algorithm :
Code: [Select]
inputs pt1,pt2,pt3,color       // color is unused for now

// we sorts the points with the smallest Y first
if (pt1.y > pt2.y) swap(pt1,pt2)     // swaps pt1.x with pt2.x and pt1.y with pt2.y

If (pt2.y > pt3.y) swap(pt2,pt3)

If(pt1.y > pt3.y) swap(pt1,pt3)

dx1 = (x2-x1)/(y2-y1)
dx2 = (x3-x1)/(y3-y1)
slx2 = slx1 = x1
sly = y1

drawLoop:
While (sly < y2)
{
  HorizontalLine(sly, slx1, slx2)
  slx1 = slx1 + dx1
  slx2 = slx2 + dx2
  sly++
}
If (y2 != y3)
{
  dx1 = (x3-x2)/(y3-y2)
  y2 = y3
  goto drawLoop
}

And here's the asm code I have so far (no screenie, I'm on a phone :/ ). So if you guys see anything wrong...

Thanks by advance :)

51
Hi guys !

Some of you may be aware of my "super-secret-project", and now that it reached a releasable state, I don't make you wait any more :P

So, the project I'm working on is an axiom (ASM for Axe so) which allows you to work with 3D vertices in a high-level way. Before saying anything, please know that I didn't made any 3D calculus during the development of this axiom. I just ported the 3D routine set Juha3D by yhean from pure ASM to Axe-friendly ASM, which still was a PITA that took me 27 days, especially because I've fully done it with Mimas (yeah, I'm a great Mimas fan) ;D So, all credits goes to him (wherever he is now) for the 3D calculations (and I would especially thank him for his wonderful macros and SMC that aren't allowed in an axiom coded with Mimas and which gave me strong headaches).

Instead of explaining the way it works any further, have a look at the 3 current commands of the axiom, which are all available in the [PRB] menu ([math][?]) :

CommandTokenEffect
CalcMatrx(x_angle,y_angle,z_angle)randInt(Calculates the rotation matrix given the X, Y and Z angles. The matrix is written to the whole 9 bytes of OP1, this means that it got destroyed by float{}, GetCalc or a call to Ans (tell me if I forgot something).
RotVertx(x_coord,y_coord,z_coord,outputArea)randNorm(Rotate a vertex given its X, Y and Z coordinates according to the rotation matrix calculated with a previous call to CalcMatrx and writes the resulting coordinates to the 6 bytes starting at outputArea.
ProjVertex(x_coord,y_coord,z_coord)randBin(Converts 3D coordinates into 2D ones. Basically, it takes a point in space and converts it into a point on screen. It returns the X coordinate in L and the Y coordinate in H, so make a modulus 256 on the returned value to have the X coordinate, and divide it by 256 to have the Y coordinate. Don't forget that you'll need to use a camera offset (distance from the camera to the plan) to avoid having the vertices display right on your face !

And now ... examples time :D !

The classic cube :

8 vertices, 12 links, 4 calls to getKey, 29 FPS

Omnimaga's logo :D :

20 vertices, 30 links, 4 calls to getKey, and still strong - 14 FPS !

Trip through the galaxy !

32 vertices, no links, 4 calls to getKey, moving camera, 12 FPS

I attached the axiom itself, AXMJH3D.8xv, and the source of the cube program as a small example, CUBE.8xp.

Note that it's not a complete project. Yeah, it's only a port of Juha3D, but I'm actually looking for people who would want to get into it with me in order to build a full axiom that could provide by himself all the functionalities that working with volumetric objects would require (scaled down to calc dev of course, so I'd be really happy only with polygon filling, but I'm sure people can think - and realize - better than only that ;) ).

So, to make it clear : if you want to team up with me to carry this axiom even further, do a big up ;)

Have fun, and share comments !



LAST UPDATE : http://ourl.ca/18452/346582

52
TI Z80 / [z80 hex] Small but useful key hook
« on: February 22, 2013, 10:12:39 am »
Heya people,

Yesterday, I was working on Super Crate Box again, and all was good until I saw that I forgot to write something on the really last line of the biggest program (which was 481 lines long). So I got lazy and thank about how to go to the bottom of a program with one key.

And I found : this small hex program installs a key hook that will make the cursor go at the very last character of the current editing session (also works with the homescreen) by accessing the Link menu ([2nd] [x,t,Θ,n]). Don't worry about the menu being inaccessible, you can still disable the hook by accessing the Calc menu ([2nd] [trace]). To re-enable it, just execute the program once again.

:AsmPrgm
:21A99D
:110080
:011900
:EDB0
:210080
:3E01
:EF664F
:C9
:83
:FDCB0156
:C8
:FE41
:2006
:EF5D49
:3E00
:C9
:FE3B
:C0
:EF6F4F
:3E00
:C9




Share comments :)

53
Heya guys !

Five months earlier, our engineering sciences professors asked us to think of a project we'll have 5 months to finish. Two friends and me came with a crazy idea : manipulating a wireless robot with a Ti-83+ ! (well, in fact they had the idea of the robot, and me the idea of the calc, it made the thing a pretty crazy project ;D)

And now it's done ! Well, not entirely, it still needs some aesthetic things, but it's fully usable and transportable ! :thumbsup:

Here's a video I made of the whole thing working. Never mind the sound, it's only my family, well, living ;D

As you (barely) can see on the video, the robot is powered by eight 1.5V batteries, and the remote by a big 9V battery. The whole project uses 5 Arduino boards : two Arduinos Uno, one for the robot and the other for the remote, one Arduino Motor Shield to command the motors (as you can guess with the name), and two Arduino XBee shields (XBee is a radio protocol), for the remote and the robot to communicate with each other.

The things I had to write was a link protocol (kind of) for the calc to communicate with the Arduino of the remote, an Arduino program to send the command received from the calc to the other Arduino using the XBee shield, and another Arduino program to receive the command and manipulate the motors accordingly (my classmates made it as a very first introduction to programming, even if I took care of the receive stuffs). I had a reaaaally hard time making the XBee transmission work (almost a month with 4 hours of class work per week, and many more at home), so my classmates had all the time for building the robot ;D

Share comments ;)

54
ASM / [z80] Problem with the port and an Arduino
« on: February 05, 2013, 03:39:01 am »
Heya guys,

For my school project I want my calc to set and unset the two wires of the port 0 to drive a robot. Since I only want 4 commands, I use direct output instead of a real protocol.

So my problem is here : while I set at least one line low, there is no problem (the Arduino always receives the right bits). But when I set both lines high, sometimes the Arduino receives high-high, sometimes it receives low-low (and never low-high nor high-low).

Here's my ASM code for the link stuffs :
Code: [Select]
.org $9D93
 .db $BB,$6D
keys5thCol = $FD
keysArrows = $FE
; equates for sending values
; R → red → tip, W → white → ring
; L → low, H → high
wRLWL = 3
wRHWL = 2
wRLWH = 1
wRHWH = 0

 ld b,RHWH
Start:
 ld a,$FF
 out (1),a
 ld a,b
 out (0),a
 ld a,keysArrows
 out (1),a
 nop
 in a,(1)
 cpl
 and %00001110
; no arrow pressed
 jr z,setRHWH
 bit 1,a
 call nz,setRHWL
 bit 2,a
 call nz,setRLWH
 bit 3,a
 call nz,setRLWL
Skip:
 ld a,keys5thCol
 out (1),a
 nop
 in a,(1)
 bit 6,a
 jr nz,Start

 ld a,wRHWH
 out (0),a
 ret

setRLWH:
 ld b,wRLWH
 ret
setRHWL:
 ld b,wRHWL
 ret
setRHWH:
 ld b,wRHWH
 jr Skip
setRLWL:
 ld b,wRLWL
 ret
.end

And here's the Arduino code I wrote (it's C++) :
Code: [Select]
int ring = 2, tip = 4; // let's say that the ring is port 2 and the tip port 4

void setup(void)
{
  pinMode(ring, INPUT);
  pinMode(tip, INPUT);
  Serial.begin(9600);
}

int getBit(int port)
{
  if(digitalRead(port) == HIGH) return 0;
  else return 1;
}

void loop(void)
{
  Serial.print("Command received : ");
  switch((getBit(ring) << 1) | getBit(tip))
  {
    case 0:
      Serial.println("don't move");
      break;
    case 1:
      Serial.println("rotate right");
      break;
    case 2:
      Serial.println("rotate left");
      break;
    case 3:
      Serial.println("go forward");
      break;
  }
delay(1000);
}

I know that it's not a matter of cables nor connection.

Thanks by advance :)

EDIT : oh but, what's this wire ? The ground ? So I think it goes in this hole ... -_____________________-'

It's okay, I just forgot to plug the ground in the hole where the ground has to go. Forget that.

55
Site Feedback and Questions / Tutorial still waiting after 2 months
« on: January 05, 2013, 01:16:43 pm »
Hi, you admins and staff members :P

I submitted a tutorial I called "[Tutorial] Using the PageSwap axiom" in the Axe tutorials section two months ago, and I still don't know if it has been validated or rejected ;D

If someone could check that, it would be great.

Thanks by advance :)

56
TI-Nspire / [C] F-Zero : trackSpire
« on: January 03, 2013, 06:07:32 am »
THIS POST IS OUTDATED !!! SEE THE LAST PAGE OF THE TOPIC INSTEAD.

Hey guys,

Since I'm back working on Mode 7, let's make a game out of that :P

For now the Mode7 perspective engine is done, and I wrote a masked sprite routine (for transparency), but that's all for now.

I'm actively working on it, so I'll post update regularly :)

Screenshots history (from newest to oldest) :

Spoiler For Gif support for maps, original Mute City 1 map from SNES F-Zero !:

Spoiler For Moved origin, acceleration/deceleration and sample map:

Spoiler For Masked sprite:

Spoiler For Mode7 engine working !:

Share comments :)

(if you want to test the program, both files must be in the same directory)

57
ASM / [z80 ASM] How do 8.8 maths work ?
« on: December 30, 2012, 02:11:28 pm »
Hi guys,

I already know how to do 16-bits multiplication and division in z80 ASM, but how to extend them to 8.8 fixed point ?

In fact there are two questions in one : how do 8.8 work (guess the title) and how do I implement them ?

Thanks by advance :)

58
Axe / [Axe] Mode 7 test
« on: December 25, 2012, 04:27:00 pm »
Hey guys,

I made a kind-of mode 7 test (pretty ugly) and I thought I could post it here.

It's Axe → slow.

It takes Pic0 and projects it in Mode 7 style (rotate with left / right). No screenshot because Axe 1.2.1 crashes wabbitemu.

Oh, and it's REAAAAAAALLY ugly.

59
Axe / What can be done in Axe in 3D ?
« on: December 17, 2012, 03:49:28 pm »
Hi guys,

After WiredWorks, I've got pretty interested in 3D stuffs, so I wondered what could be done in Axe which is related to 3D.

I have already tested vertices with WiredWorks, raycasting is also already done (by several people), so what remains ? Do you think it's possible to do voxel, and if yes, do you have a tutorial for that (I googled it and didn't found) ?

Btw, you can just enumerate all the 3D techniques that comes to your mind :P

60
Axe / [Tutorial] Using the PageSwap axiom
« on: December 11, 2012, 01:58:02 pm »
PageSwap is an Axiom made by myself which allows you to use Axe subroutines you defined in another program and compiled separately as an app directly in your classic Axe program.

What's the benefit for it ? Well, imagine that your Axe program is so large that it can't fit in the RAM, even if it's all free (this means that your program is greater than 24K). You can write 16K of code in an app as subroutines, make a 8k program and use PageSwap to access this last app and use the functions you defined in it. The result is 24K of executable code which take only 8k of RAM. You can even use CrabCake by Hot_Dog or FullRene by thepenguin77 to overpass the 8K limit, to have still moar executable code ! And more of that, you can also use PageSwap with several apps, which is 16K of executable code per app !

So, how to use this axiom ? It can be pretty complicated due to all the things you have to beware when you use that.

First, we need an API. It's an Axe program you'll compile into an app and which will contain all of your subroutines. Let's call it AppTest (app names can contain lowercase). Then we need a program to use these subroutines, let's call it APPTEST in uppercase (yeah, I'm lacking names). That's all what we need.

So, our app needs to have a specific format. Since it's a lib, it must contains functions. And in order to know where are located all of these functions, we do a jump table.

:.AppTest
:
:Goto Func1
:Goto Func2
:Goto Func3
:.and so on
:
:Lbl Func1
:. code here
:Return
:
:Lbl Func2
:.same
:Return
:
:Lbl Func3
:.same again
:Return
:
:.and so on


So when in your code you need to call one of these funcs, you'll just have to call the corresponding Goto (which has a fixed address the axiom knows).

But wait, we must not run this app ! So let's write a Start function that exits the app when the user launches it :

:.AppTest
:
:.Execution will start here
:Goto Start
:Goto Func1
:Goto Func2
:Goto Func3
:.and so on
:
:Lbl Start
:ClrHome
:Text(0,,"This app is an Axe lib
:Text(0,8,"It's not meant to be ran
:Text(0,16,"Press any key to quit
:getKeyr
:Return
:
:Lbl Func1
:. code here
:Return
:
:Lbl Func2
:.same
:Return
:
:Lbl Func3
:.same again
:Return
:
:.and so on


Okay, now we have a pattern for our API !

You can write your subroutines the same way you write ones in a classic Axe source. So you can use r1 to r6, static pointers (GDB, Pic ...) and so on.

When, let's fill these routines with something so we'll can use them.

:.AppTest
:
:Goto Start
:Goto Func1
:Goto Func2
:Goto Func3
:
:Lbl Start
:ClrHome
:Text(0,,"This app is an Axe lib
:Text(0,8,"It's not meant to be ran
:Text(0,16,"Press any key to quit
:getKeyr
:Return
:
:Lbl Func1
:Pt-On(r1,r2,r3
:Return
:
:Lbl Func2
:Text(r1,r2,r3
:Return
:
:Lbl Func3
:DispGraph
:Return


Now, let's write our prgmAPPTEST program. First, let's include PageSwap.

:.APPTEST
:
:#Axiom(PAGESWAP)


Now, you can start working with PageSwap.

Using PageSwap is a bit complicated since it works with really low level things : app pages. When you launch a regular program (I mean not an app), it's usually from the page 0, which is the RAM. Now, you want to access your lib which is an app, but apps aren't stored in page 0. So, you'll need to go to the page of your app, use the routines inside, and when you're done with it go back to the page 0 before exit your program.

You'll say "hey, but what if I launch my program from flash using a shell ?" In fact that remains the same : the program must exit in the same page as the one which he started. So at the start of APPTEST, just save your current page by using PageSwap's getCurPage (all the PageSwap commands are the Angle menu [2nd] [apps]).

:.APPTEST
:#Axiom(PAGESWAP)
:
:getCurPage?P
:
:.code here


Then, to change the current app page, use the well-named setCurPage() :P

But which page must we go in ? You know that we want to access AppTest to be able to use the subroutines in it. So search for your app by using getAppPage("APP"), and then set the current page to it.

:.APPTEST
:#Axiom(PAGESWAP)
:
:getCurPage?P
:setCurPage(getAppPage("AppTest"))
:
:.Don't forget to restore the initial page before quitting !
:setCurPage(P)


Now that you're in the page of your app, you can use its functions ! Well, in fact you don't know the addresses of your functions ... but PageSwap does ! Just retrieve the address of the Nth function of your app by using appFunc(N), then call it with Axe's (ADDR)(ARGS). Beware, the 0th function is the Start function !

:.APPTEST
:#Axiom(PAGESWAP)
:
:getCurPage?P
:setCurPage(getAppPage("AppTest"))
:
:.You have to remember which function does what
:(appFunc(1))(0,8,[3C4281818181423C])
:(appFunc(3))()
:(appFunc(2))(0,0,"Over 9000!")
:getKeyr
:
:setCurPage(P)


Now compile AppTest into an app, APPTEST into Noshell, try to run AppTest, run APPTEST, and see !

And that's all, now you know how to use PageSwap !

Now, go make a 40KB-large program ! :P

Pages: 1 2 3 [4] 5 6 7