flat assembler
Message board for the users of flat assembler.
  
|  Index
      > Projects and Ideas > SmartAssembler | 
| Author | 
 | 
| revolution 14 Dec 2010, 01:26 Are you asking us what your "Own Syntax" should be for that instruction? Shouldn't it be your decision as to what your "Own Syntax" looks like? | |||
|  14 Dec 2010, 01:26 | 
 | 
| masonswanson 14 Dec 2010, 01:29 Yes you're Correct Revolution I AM Asking You What It Should Be As I Currently Only Understand The Conversion Of Instructions With Registers Or The Stack, But I Haven't Successfully Converted Anything With Memory, And I Would Like Input From People Who Are More Experienced Than Myself With Assembly Programming | |||
|  14 Dec 2010, 01:29 | 
 | 
| revolution 14 Dec 2010, 01:33 Then I suggest your "Own Syntax" should be:     Code: mov [memorylocation],5 | |||
|  14 Dec 2010, 01:33 | 
 | 
| masonswanson 14 Dec 2010, 02:07 Ok, As Far As My Own Syntax Goes It Is In The Spirit Of Procedural Languages Such As Python Or C/C++ In That An Add Instruction Such As:
 Code: add ah,al    Would Become This: Code: add("ah", "al") Where The Registers Would Be Passed As Strings That Are Case Insensitive But The Mnemonics ARE Case Sensitive. You See For Each Mnemonic I Am Writing A Python Function That Takes As Input Whatever Operands That mnemonic Would Normally Take, As A String Or As A Number In The Case Of An Immediate Operand. I Just Don't Know How It Should Take A Memory Location Or How To Differentiate Between A Memory Location Or Immediate Instruction | |||
|  14 Dec 2010, 02:07 | 
 | 
| Coty 14 Dec 2010, 02:12 Code: move("[memorylocation]" = 5d); | |||
|  14 Dec 2010, 02:12 | 
 | 
| revolution 14 Dec 2010, 02:18 In most HLLs memory locations are just variables:     Code: memorylocation = 5 | |||
|  14 Dec 2010, 02:18 | 
 | 
| masonswanson 14 Dec 2010, 02:21 It would Have to be passed as a python datatype as that is the language it is written in, how would i differentiate between a memory location and a Immediate value, for instance:
 Code: mov edi, memorylocation    being: Code: mov("edi", "memorylocation") could be thought of as moving a string containing "memorylocation" to edi but that is obviously not what we want, we want the location moved there, where as: Code: mov("edi", [memorylocation]) would move a list to edi which in turn turns to: Code: mov("edi", "memorylocation") Causing the same differentiation problem as before, this is Not a bug it is a feature so that you could do this: Code: mov([eax,ebx],[4,5]) which would turn into: Code: mov("eax", 4) mov("ebx", 5) Also instead of having a macro capability you would just use a python function: Code: def turnspeakeron(): in("al", 0x61) or("al", 00000011b) out(0x61, "al") def turnspeakeroff(): in("al", 0x61) and("al", 11111100b) out(0x61, "al") | |||
|  14 Dec 2010, 02:21 | 
 | 
| masonswanson 14 Dec 2010, 02:26 revolution wrote: In most HLLs memory locations are just variables: Code: label1: mov al,5 jmp label3 label2: mov al, 6 jmp label3 label3: cmp al,5 jne label1 je label2 This Is What I Need To Know How To Turn Into Machine Code, And How It Should Be Incorporated Into My Assembler's Syntax | |||
|  14 Dec 2010, 02:26 | 
 | 
| masonswanson 14 Dec 2010, 02:27 Quote: 
 As opposed to: Code: macro speakeron { IN AL, 0x61 OR AL, 00000011b OUT 0x61, AL } macro speakeroff { IN AL, 0x61 AND AL, 11111100b OUT 0x61, AL } | |||
|  14 Dec 2010, 02:27 | 
 | 
| revolution 14 Dec 2010, 02:39 C uses the "&" to get a pointer.     Code: a = &variable | |||
|  14 Dec 2010, 02:39 | 
 | 
| masonswanson 14 Dec 2010, 02:46 It is written in python, i Don't need to find the address of a variable, i need to make a label and record the location, and be able to jmp to it | |||
|  14 Dec 2010, 02:46 | 
 | 
| bitRAKE 14 Dec 2010, 08:45 Assembly allows pointer arithmetic. Without address support how will you implement jump tables or other such code?     Code: jmp("eax") | |||
|  14 Dec 2010, 08:45 | 
 | 
| baldr 14 Dec 2010, 20:20 masonswanson,
 If You Do Really Need A Label, You Should Invent (Or Use Ready One) Syntactic Construct To Make One. Code: const ref here = loc $;  | |||
|  14 Dec 2010, 20:20 | 
 | 
| masonswanson 19 Dec 2010, 11:54 Thanks But I Think I Am Going To Have It Use Something Like
 Code: Label("Labelname"); jmp("Labelname") And then during the pass right before the last or the last pass it will compute where in the output "Labelname" would be, and adjust any reference to it then | |||
|  19 Dec 2010, 11:54 | 
 | 
| < Last Thread | Next Thread > | 
| Forum Rules: 
 | 
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.