[TI ASM] How to start with ASM?

Got questions? Got answers? Go here for both.

Moderator: MaxCoderz Staff

Post Reply
User avatar
Shadow Phoenix
Calc Guru
Posts: 835
Joined: Mon 03 Jan, 2005 7:54 pm
Location: out there. seriosly.

[TI ASM] How to start with ASM?

Post by Shadow Phoenix »

Hello, I am a programmer for BASIC, and I got really good at it, but there is nowhere to go anymore...
can anyone show me a good ASM tutorial?
Life is getting better.
Stickmanofdoom
Regular Member
Posts: 86
Joined: Fri 17 Dec, 2004 8:20 pm
Contact:

Post by Stickmanofdoom »

I didn't get much out of the various tutorials I found on the internet, except for Learn Learn TI-83 Plus Assembly In 28 Days. It explains everything clearly and even makes compiling programs easy to do, something you can otherwise waste a lot of time trying to figure out.
Another guide that you might want to check out is The Independent Z80 Assembly Guide, by CoBB.
teoryn
New Member
Posts: 26
Joined: Sat 18 Dec, 2004 4:23 am
Location: Ohio
Contact:

Post by teoryn »

Stickman got you headed in the right direction, read those, and then read them again.
You've seen the posts, now see the sites!
http://hiddenuniverse.blogspot.com
http://teoryn.deviantart.com
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4141
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

Yes, im pretty sure you will be recommended those tutorials regardless of who you ask.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
DarkAuron
Maxcoderz Staff
Posts: 1349
Joined: Sat 18 Dec, 2004 6:53 pm

Post by DarkAuron »

And you'll most likely be constantly referring to those guides for reference when programming in z80. I sure do :)
[Gridwars Score] - E: 1860037 M: 716641 H: 261194
User avatar
kv83
Maxcoderz Staff
Posts: 2735
Joined: Wed 15 Dec, 2004 7:26 pm
Location: The Hague, Netherlands
Contact:

Post by kv83 »

I changed your topic title so that it makes more sense :wink:
Image
koolmansam375
Extreme Poster
Posts: 479
Joined: Fri 17 Dec, 2004 11:09 pm
Contact:

Post by koolmansam375 »

Yes those are good tutorials. Its a good idea to read through a section from 83p asm in 28 days (beginner, intermediate, advanced, and expert) and then take a while to let it sink in and try some stuff out. Otherwise it will confuse you and give you a massive headache and you will stay as far away from ASM as you can. I hope I help cheer you up motivate you :D . Now start learning!

btw if you get stuck (everyone does) you can always look around and post in this section. Someone will help you (be it CoBB, sigma, sic, Kozak, tr1p1ea, or someone else) !
Image

Pongwars shall live!

blog is down atm. :-(
Spengo
Calc Master
Posts: 1116
Joined: Sat 15 Jan, 2005 3:56 am
Location: ooga booga land
Contact:

Post by Spengo »

Hello, I am also a newbie at asm programming. I like to write videogames for the PC but I also really like to play games on my ti 83+. Anyway, I looked up asm tutorials(Basic = nasty and slow) and I been using the "Learn Ti-83 Plus Assembly in 28 days" and it is really helpful. However, everything I've been able to produce so far is text based stuff. Can you give me any good links to really simple games with really simple graphics that I could use as examples? (z80 source code would be nice too).
|
btw, my newest PC game is available there \/ if anyone is interested
bananas... o.o
Mike K

Post by Mike K »

You'll most likely be using ion or mirageOS for graphic functions. There are also some more specific routines out there. Check out ION programming guide (in the ion download), or the mirageOS developer guide (on detachedsolutions' website).

-Mike
Stickmanofdoom
Regular Member
Posts: 86
Joined: Fri 17 Dec, 2004 8:20 pm
Contact:

Post by Stickmanofdoom »

Everything that follows this paragraph are posts I have collected from other message boards. They were really helpful, but probably unnessary if you want to use ion or Mirage. Anyways, it's a good explaination of how sprites work, and also some example code.


First off you need to understand that the plotsscreen is just a long list of numbers that are copyed to the ram in the lcd driver. Each byte is a peice of the screen that is 1 row *8 columns big. So if you were to load %11111111 into the first byte of the plotsscreen there would be a line starting from {0,0} and going to {0,7}. Now since there are 96 pixels going across the screen there are 12 bytes on each "row" (96 / 8 bits), 64 different "rows" of bytes, and 768 bytes altogether (12 * 64).

Now that you understand how the plotsscreen works, i'll tell you how to find the location of the sprite. First you should calculate the y cord. So think, since the plotsscreen is just a long list of bytes and each row is 12 bytes across, the byte right below you should be the 12th byte (if you start with 0), and the next would be 24, 36, 48, and so on. So to calculate the y cord you just need to multiply the y by 12. Now for the x cord i'm just going to explain how to do it for alinged sprite. So you need to divide the x cord by 8 because you need to find what BYTE the sprite starts at and there are 8 bits in a byte. You add what you got from the x cord to what you got from the y cord to the starting point of the plotsscreen (which should be defined in your include as plotsscrean or gbuf) and you have the starting location for your sprite!

Now you can actually start blitting the sprite onto the plotsscreen. It's fairly simple really. You just have a loop that goes around 8 times (or however tall your sprite is) which does the following:

1. It lds the sprite data and the byte which is currently at that location in the plotsscreen
2. It XORs (or ORs or ANDs) those two bytes together
3. It lds the result of that back into the plotsscreen
4. It increments the pointer of the sprite data and adds 12 (moves down 1 row) to the pointer to the plotssceen

Now you can use ionFastCopy to copy the plotsscreen to the lcd driver and the sprite will appear onscreen.

You should, if you understood all that i said, be able to make an aligned sprite routine now. If you didn't understand or want to know about unaligned sprites, clipping, or masking just ask.

Code: Select all

   ld a,2 			;X=2
   ld l,2 			;Y=2
   ld ix,mouse1 		;Pointer
   ld e,l 			;E=X (E=2) ;He needs HL, so hes copying to other      registers
   ld h,0 			;H=0
   ld d,h 			;D=0
   add hl,de 		;02+02 = 4
   add hl,de 		;04+04 = 8
   add hl,hl 		;08+08 = 16
   add hl,hl 		;16+16 = 32
   ld e,a 			;e now = x coord
   add hl,de 		;d is 0 so add hl and de together to get offset in buffer
   ld de,plotsscreen	; load address of plotsscreen into de
   add hl,de 		; add offset to the plotsscreen and store it in hl 
   ld b,8 			;number of executions it = 8 (8 pixels high)
   ld de,12 		;ld de with 12 bytes
put8by8loop:
   ld a,(ix) 		;load a with the byte from the pointer (ix)
   xor (hl) 		;xor it with buffer offset
   ld (hl),a 		; load product of xoring back into the buffer
   inc ix 			;move to the next byte of the sprite
   add hl,de 		; add the 12 bytes (#from de) to the offset to move to    the next row of the plotsscreen directly under the previous position
   djnz put8by8loop 	;if b doesn't = 0 go back and repeat above code.
   bcall(_grbufcpy) 	//Copy grBuf to plotsScreen
   bcall(_getKey) 		//Wait for keypress
   ret;Exit program 	//End

mouse1:
   .db %10000000
   .db %11100000
   .db %11111000
   .db %11111100
   .db %11111110
   .db %00010000
   .db %00011000
   .db %00001000

.end
.end
============================================
((Y coord*buffer width)+X coord)=offset

the buffer is 12 bytes wide.

plottscreen+offset=byte to start reading/writing from/to
============================================
Spengo
Calc Master
Posts: 1116
Joined: Sat 15 Jan, 2005 3:56 am
Location: ooga booga land
Contact:

Post by Spengo »

Hokay, I think I've got a sort of semi grasp on the basics of z80. Can anyone give me a link to a heavily commented simple game for mirage that I can use as an example?
bananas... o.o
User avatar
kv83
Maxcoderz Staff
Posts: 2735
Joined: Wed 15 Dec, 2004 7:26 pm
Location: The Hague, Netherlands
Contact:

Post by kv83 »

A better idea is to start with a simple game to get some experience with programming. Think of a simple puzzle game or something in those lines. Reading code may give you also experience, but what I experienced is that reading code from others can confuse someone new to ASM, and above writing your own code is more fun anyway.
Image
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4141
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

Nice PC shooter! ... Could use a little GFX work though :).
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
User avatar
Shadow Phoenix
Calc Guru
Posts: 835
Joined: Mon 03 Jan, 2005 7:54 pm
Location: out there. seriosly.

Post by Shadow Phoenix »

REALLY THANKS TO EVERYONE!!!!
I jsut got my DISPLAY!!!

Code: Select all

.nolist
#include "ti83plus.inc"
#define    ProgStart    $9D95
.list
.org    ProgStart - 2
    .db    t2ByteTok, tAsmCmp
    b_call(_ClrLCDFull)
   
    ld    hl, 4
    ld    (PenCol), hl
    ld    hl, msg
    b_call(_PutS)            ; Display the text
    b_call(_NewLine)
   
ret

msg:
    .db "Hello world!YEA!", 0
.end
.end
THANKS AGAIN!!! ^runs to his calc^
You will hear about me soon :)
Life is getting better.
Post Reply