0 Members and 1 Guest are viewing this topic.
I'd suggest at least making an effort to learn it. It's well documented, rather straightforward, and very fast; however, it takes patience and practice to learn.
I got started on the TI-82 with the now very dated TI-82 Assembly Corner tutorial, but TI-83 Plus Assembly in 28 Days (which is currently being updated) is probably the best way to go for anything remotely modern.
For me the most amazing part in learning ASM was starting to understand on a rather low level how computers actually work, i personally found that extremely rewarding
So...I'd like to get ya'lls take on ASM...I've always been interested in learning it, but it seems so foreign of a computer language...is it worth the trouble to learn? Should I stick with axe? What's the ups and downs? Is there much difference between ti 83 & 84 ASM?For all you ASM gurus!
Well, Do you already know how girls work?
Sometimes it looks ugly down there, but for others is just a wonderful discovery. See, it all depends. I'd say give it a go, oh and BTW, ASM changes with the cpu, hehe. :P
Quote from: SpiroH on February 25, 2017, 10:02:20 am Well, Do you already know how girls work?Quote from: SpiroH on February 25, 2017, 10:02:20 am Sometimes it looks ugly down there, but for others is just a wonderful discovery. See, it all depends. I'd say give it a go, oh and BTW, ASM changes with the cpu, hehe. <<<<
;C is our "top" number.;E is our "bottom" number.;A will be our "accumulator" ld a,0 rrc e ;this rotates register 'e' right, putting the bottom bit as "carry" [out of the register]. jr nc,checkbit1 ;nc == not carry. If "carry" out was zero, skip this step. add a,c ;if carry out was 1, then add to our accumulator.checkbit1: sla c ;finally, shift our "top number" to the left in case we need to add this to the accumulator, too. Then [REPEAT] 7 more times. rrc e jr nc,checkbit2 add a,ccheckbit2: sla c rrc e jr nc,checkbit3 add a,ccheckbit3: sla c rrc e jr nc,checkbit4 add a,ccheckbit4: sla c rrc e jr nc,checkbit5 add a,ccheckbit5: sla c rrc e jr nc,checkbit6 add a,ccheckbit6: sla c rrc e jr nc,checkbit7 add a,ccheckbit7: sla c rrc e jr nc,all_done add a,call_done: ret
;C is our "top" number.;E is our "bottom" number.;A will be our "accumulator" xor a ;mad hax to set A to zero. Faster, smaller. ld b,8loop: rrc e ;this rotates register 'e' right, putting the bottom bit as "carry" [out of the register]. jr nc,no_add ;nc == not carry. If "carry" out was zero, skip this step. add a,c ;if carry out was 1, then add to our accumulator.no_add: sla c ;finally, shift our "top number" to the left in case we need to add this to the accumulator, too. djnz loop ;aaand repeat, decrementing register B until zero (this is a specialized instruction on the Z80) ret
0->acc10*acc+6*377->acc10*acc+1*377->acc10*acc+3*377->acc
H*E -> A;H is the "bottom" number that we will no be checking the top digit down to the bottom digit.;E is the 'Top" number.;A is the accumulator;basic algo, after initializing A to zero.; multiply A by 2.; shift H left by 1; if this results in a bit carried out (so a 1 carried out), then add E ('top' number) to A (the accumulator); repeat 7 more times for all bits in H. xor a ld b,8loop: add a,a sla h ;shifts H left by 1, bringing in a 0 for the low bit. mathematically the same as H*2 -> H jr nc,skip_add add a,eskip_add: djnz loop ret
ld l,0 ld b,8loop: sla l sla h jr nc,skip_add ld a,l \ add a,e \ ld l,askip_add: djnz loop ret
ld l,0 ld b,8loop: add hl,hl jr nc,skip_add ld a,l \ add a,e \ ld l,askip_add: djnz loop ret
ld d,0 ld l,d ;since D=0 already, this sets L to 0, as we want. It's smaller and faster than ld l,0. ld b,8loop: add hl,hl jr nc,skip_add add hl,deskip_add: djnz loop ret
I'm also guessing division would be the subtraction instead of addition, trunkating any remainder.
HL_div_C:;Input:; HL is the numerator; C is the denominator. C<128;Output:; A is the remainder; HL is the quotient. xor a ld b,16loop: add hl,hl ;this works like shifting HL left by 1. Overflow (thus, the top bit) is left in the carry flag rla ;shift a left, rotating in the c flag as the low bit. cp c ;compare a to c. Basically does A-C and returns the flags. If C>A, then there will be underflow setting the C flag. jr c,skip ;skip the next two bytes if c flag is set (so A<C) inc l ;we know the low bit of HL is 0, so incrementing HL will set that bit. sub cskip: djnz loop ret
ld b,8 - This must be telling the loop to repeat 8 times to check each bit, so, how does the loop relate to b? I'm thinking about how nested loops would work...
djnz loop - kindof like "goto" loop, with the automatic decrementing of register b?
rrc e - you say this rotates register e, is this the same as changing the register input from left to right?
Division is typically performed exactly like 'schoolbook' long division (until you get to higher precision, then you can use some state-of-the-art algorithms and math magic).