Author Topic: big nerd trying to learn assembly  (Read 1387 times)

so i was really bored today so i decided to take a shot at learning assembly with my calculator (ti 86, i have a Nspire but those things are weird to program)
only problem tho is i dont have a graph link cable and i dont want to buy one so im stuck with hexcode assembly on the calculator
so what im tryna do right now is decompose this program:
Code: [Select]
:ASMPRGM
:CD824A
:210300
:220FC0
:215BD7
:CD374A
:CD5F4A
:C9
:48656C6C6F20576F726C6400
to understand how the forget you can program a z80 and the hexcodes
i guess ill take help and ill post updates along the way
edit: forget forgot to post links
i've been using this website to look at the traditional z80 assembly to hexcode assembly so i can understand this
http://jgmalcolm.com/z80/opcodes/opcodesB
« Last Edit: November 19, 2017, 07:18:27 AM by SubDaWoofer »

so far i've decomposed it into this:
Code: [Select]
##preface
##$ means hex
##(nn) means the location that the memory is loaded at is used
CALL $824A
LD HL, $0300
LD ($0FC0), HL
LD HL, $5BD7
CALL $374A
CALL $5F4A
RET
Hello World ##null character at the end of the "World" to signify end of program i guess?
« Last Edit: November 18, 2017, 08:35:31 PM by SubDaWoofer »

Did you try turning it off and then back on

Did you try turning it off and then back on
whats an off button???
yes

dDOuBl Post
anyways i looked at why it used HL so much
so since A (the acc) is used so much for regular adding ands stuff HL was added as a secondary ACC which its being used for in this purpose
its also for storing the locations of stuff so thats why theres a "MOV HL, ($0FC0)" (simpligying to make it esaier to understand)



awh stuff assembly language is fun
good luck

ok no w what the f uck
i tried running only
Code: [Select]
CALL $824Aand it ran the original code (it clears screen and prrints hello world in center)
but when i change it to $823A it doesnt clear the screen? (it still prints helo world even though i havent loaded any of the other ROMCalls)
this is strange
edit:
ok nevermind i think i may've found whats happening
i changed it to $822A and i belive whats happening is that its only calling the machine code for printing helo world without cleaing the screen because when i ran $822A it ran a MEM ERROR
EDIT 2: ok so what i think its doing is that it loads $824A into memory and starts recording the data i belive
then it proceeds to record all of the data into $824A and then it runs it when you do Asm(ASM01
« Last Edit: November 19, 2017, 06:56:53 AM by SubDaWoofer »

ok again yet another post
i edited LD HL, $0300 to LD HL, $0104 and apparently it changes where it prints the "Hello World" at
since it went from 3 lines down to 1st line down and 4 words across from the edge
edit:ive been looking at the code again and since the next line from LD HL, $0300 is just above LD ($0FC0), HL
i belive that ($0FC0) might be a "variable" (calls back to) for VRAM that stores two bytes and tells where to put a certain string of letters or numbers at
since its $nn1 and $nn2 where $nn1 is the columns and $nn2 is the rows and then that allows the vram to print to a certain part of the screen i guess?
EDIT 2:
so when i decipher stuff im gonna use the prefix ^# to indicate what the hell it does
Code: [Select]
CALL $824A     ^# edit5: clears screen actually i think
LD HL, $0300   ^# it puts $0300 in HL so it can load into...
LD ($0FC0), HL ^# this, i belive that ($0FC0) is the ""variable"" for VRAM to know which column and row to print a string or a thing
EDIT 3:
oH WhaTi tried running CALL $5BD7 but instead i used $5BD6
and it outpitted somethn like
Code: [Select]
: x
: [sub]4[/sub]
:
EDIT 4:
$5BD7 may be a location of VRAM i think
cause when i change it, it glitched the F out
« Last Edit: November 19, 2017, 07:42:52 AM by SubDaWoofer »

ok nevermind??
CALL $824A
just clears the screen i think
because romcalls do specific things
and i was just being dumb because ive never done assembly and i just realised that ROMCALLS do stuff

You want to interpret those addresses as little endian. The $4AXX addresses are some functions in ROM you'd have to post the code for, $C00F (used as temporary storage) and $D75B are in RAM, and $0003 looks like screen coordinates for whichever one is the printing function.
« Last Edit: November 19, 2017, 09:29:32 AM by Truce »


awh stuff assembly language is fun
good luck
You and I have very different definitions of "fun".

You want to interpret those addresses as little endian. The $4AXX addresses are some functions in ROM you'd have to post the code for, $C00F (used as temporary storage) and $D75B are in RAM, and $0003 looks like screen coordinates for whichever one is the printing function.
o yea i forgot that little endian exists
thank
SO
Code: [Select]
##preface
##$ means hex
##(nn) means the location that the memory is loaded at is used
## ^# means what ithink it does
## using little endian here
CALL $824A           ^# clears screen
LD HL, $0300         ^# puts a number in "secondary" acc. for storage so it can...
LD ($0FC0), HL      ^# load the number into the VRAM "pointer" that "points" to which part of the screen to print to: also it isnt F00C its 0FC0 because little endian
LD HL, $5BD7        ^# dunno what the rest of this means yet
CALL $374A
CALL $5F4A
RET
Hello World ##null character at the end of the "World" to signify end of program i guess?
Code: [Select]
$4A** NUMBERS ARE ROMCALLS
$0FC0 IS THE THIN THAT VRAM CALLS TO KNOW WHERE TO PRINT stuff
« Last Edit: November 20, 2017, 02:23:55 PM by SubDaWoofer »