+ Reply to Thread
Page 3 of 10 FirstFirst 12345 ... LastLast
Results 21 to 30 of 99

Thread: !!!OLD!!! Documentation of hi-speed devices

  1. #21
    That furred thing Black Phoenix's Avatar
    Join Date
    Feb 2007
    Location
    Kyiv, Ukraine
    Posts
    3,565

    Default

    Field Medic, yes.

    If you connect something to MemBus input it's placed at address 65536. So for your contraption (you should connect memory via address bus so when it's missing CPU won't crash):
    To store Value into connected memory's address X (0..63) you should write Value to address (65536+X), i.e.:
    Code:
    mov EDI,65536;
    add EDI,<X>;
    mov #EDI,<Value>
    - OR -

    Code:
    //Put this into initialization code:
    mov ES,65536;
    
    ...................................
    //Lots of code
    ...................................
    
    
    mov ES:#<X>,<Value>
    I'm a wire-crazy person with a tail.

    Take a daily journey into my brain

    D2K5

  2. #22
    Wire Amateur field_medic's Avatar
    Join Date
    Apr 2007
    Posts
    85

    Default

    Let me just make sure I&#39;m getting this:

    Let&#39;s say I plug an 8 store (for simplicity sake) into Memory 1 of an address bus with offset 0, size 8. Would this work?

    Code:
    DATA:
    
    alloc xcoordinate,1;** //65537
    alloc ycoordinate,2;** //65538
    alloc zcoordinate,3;** //65539
    
    CODE:
    
    initiate:
    mov edi,65536;
    
    mov es:#ycoordinate,55;
    mov es:#xcoordinate,65;
    mov es:#zcoordinate,75;
    So when I run it I should get an error 2 and when I go over to the 8 store, I should be able to disconnect it and the data in slot 0 is 0, slot 1 is 55, slot 2 is 65, and slot 3 is 75. Correct?

    And if that&#39;s true, how could I recall the values stored in memory?

    Code:
    gety:
    
    sub eax,eax;****//empty eax for a moment
    mov eax,es:#xcoordinate;
    mov port1,eax;
    And then get an output of 65 assuming I ran the code up above? I&#39;m sure my syntax is missing something.

  3. #23
    That furred thing Black Phoenix's Avatar
    Join Date
    Feb 2007
    Location
    Kyiv, Ukraine
    Posts
    3,565

    Default

    I&#39;m so sorry, replace EDI with ES in initialization, I&#39;m blind
    I'm a wire-crazy person with a tail.

    Take a daily journey into my brain

    D2K5

  4. #24
    Wire Amateur field_medic's Avatar
    Join Date
    Apr 2007
    Posts
    85

    Default

    Good news and bad news:

    It writes to the memory and allows me to read from it with ease. I can store all sorts of crazy values in there and it spits them back casually. The bad news is that when you disconnect the memory gate and start reading through the values on the gate, they aren&#39;t there (in this case it should have stored 55(slot1),65(slot2),75(slot3)). Did I miss something? Or do I need to wait for the hard drives/flash drives?

    Here was the final code:

    Code:
    DATA:
    
    alloc xcoordinate,1;** //65537
    alloc ycoordinate,2;** //65538
    alloc zcoordinate,3;** //65539
    
    CODE:
    
    initiate:
    mov es,65536;
    
    mov es:#ycoordinate,55;
    mov es:#xcoordinate,65;
    mov es:#zcoordinate,75;
    
    jmp gety;
    
    gety:
    
    sub eax,eax;****//empty eax for a moment
    mov eax,es:#xcoordinate;
    mov port1,eax;****//This should read 65, which it did, woot!

  5. #25
    That furred thing Black Phoenix's Avatar
    Join Date
    Feb 2007
    Location
    Kyiv, Ukraine
    Posts
    3,565

    Default

    I&#39;m gonna look into that
    I'm a wire-crazy person with a tail.

    Take a daily journey into my brain

    D2K5

  6. #26
    Wire Amateur field_medic's Avatar
    Join Date
    Apr 2007
    Posts
    85

    Default

    Did you manage to locate what was causing the problem? Also did the wired hard disk come out some where?

  7. #27
    Wirererer Ergzay's Avatar
    Join Date
    Jun 2007
    Posts
    232

    Default

    If I was to use a hi-speed link connecting the CPU to a RAM chip and I was to write my program in C and use the compiler to convert the C into assembler to run on the CPU how would I address the memory on the RAM chip? Would it be automatically assigned? Can I even use the RAM chip if I write a program in C?
    I am thinking in terms of making a very large 3 dimensional array in C and I am wondering how it would get stored onto the RAM chips and if there is any nice method that it does so, so that I can use regular chips to use values from this same RAM as well.

  8. #28
    That furred thing Black Phoenix's Avatar
    Join Date
    Feb 2007
    Location
    Kyiv, Ukraine
    Posts
    3,565

    Default

    If I was to use a hi-speed link connecting the CPU to a RAM chip and I was to write my program in C and use the compiler to convert the C into assembler to run on the CPU how would I address the memory on the RAM chip? Would it be automatically assigned? Can I even use the RAM chip if I write a program in C?
    I am thinking in terms of making a very large 3 dimensional array in C and I am wondering how it would get stored onto the RAM chips and if there is any nice method that it does so, so that I can use regular chips to use values from this same RAM as well.[/b]
    Yes, thats possible. Here is the code (example for my_array with 3 sizes), it should work:
    Code:
    #asm
    **define _my_array,65536; //my_array is your name (with _ in front cuz its C), 65536 is where it starts
    **define _size_x,64; //X size
    **define _size_y,64; //Y size
    **define _size_z,64; //Z size
    #endasm
    
    read_3d(x,y,z) int x,y,z; {
    **return *(my_array + z*size_x*size_y + y*size_x + x);
    }
    write_3d(x,y,z,value) int x,y,z,value; {
    ***(my_array + z*size_x*size_y + y*size_x + x) = value;
    }
    
    main() {
    **int i;
    **write_3d(1,2,3,4);
    **i = read_3d(1,2,3);
    }
    Ignore "external reference" messages, it should compile correctly.
    I'm a wire-crazy person with a tail.

    Take a daily journey into my brain

    D2K5

  9. #29
    Wirererer Ergzay's Avatar
    Join Date
    Jun 2007
    Posts
    232

    Default

    Just as a quick question. Seeing as there is no C tutorial for syntax of what I can do on the C for the cpu, I have a few questions on your program. First of all I might add I never learned directly C (I learned C++) and I also didn&#39;t go terribly far in it. Now my guess is the #asm is used to section off a bit of the code to be assembly so you can mix C and assembly. Is there a way to do that same code in C instead of assembly? I am also not understanding why the asterisk (*) is after the return statements and at the beginning of the other lines.
    Other than that it all makes sense pretty much (the declaration lines threw me for a sec (read_3d(x,y,z) int x,y,z; {), because you were using int in them to create variables, I am not used to that in C++ (nor did I know it was possible) as well as the semicolon there which is confusing.

  10. #30
    That furred thing Black Phoenix's Avatar
    Join Date
    Feb 2007
    Location
    Kyiv, Ukraine
    Posts
    3,565

    Default

    Just as a quick question. Seeing as there is no C tutorial for syntax of what I can do on the C for the cpu, I have a few questions on your program. First of all I might add I never learned directly C (I learned C++) and I also didn&#39;t go terribly far in it. Now my guess is the #asm is used to section off a bit of the code to be assembly so you can mix C and assembly. Is there a way to do that same code in C instead of assembly? I am also not understanding why the asterisk (*) is after the return statements and at the beginning of the other lines.
    Other than that it all makes sense pretty much (the declaration lines threw me for a sec (read_3d(x,y,z) int x,y,z; {), because you were using int in them to create variables, I am not used to that in C++ (nor did I know it was possible) as well as the semicolon there which is confusing.[/b]
    This is small C syntax

    #asm #endasm is used to insert assembly code, right.
    asterisk (*) means treat variable as pointer, and read/write to address pointed by it.
    For example:
    Code:
    *ptr = 0; /* sets memory cell at address "ptr" to 0 */
    **ptr++; /* Goes to next memory cell */
    *(<expression>) means write value at cell <expression>

    Declaration - small C syntax, cant do anything with that.
    I'm a wire-crazy person with a tail.

    Take a daily journey into my brain

    D2K5

+ Reply to Thread
Page 3 of 10 FirstFirst 12345 ... LastLast

LinkBacks (?)


Similar Threads

  1. !!!OLD!!! ZGPU Documentation
    By Black Phoenix in forum CPU, GPU, and Hi-speed Discussion & Help
    Replies: 38
    Last Post: 11-29-2010, 04:54 PM
  2. !!!OLD!!! ZCPU Documentation
    By Black Phoenix in forum CPU, GPU, and Hi-speed Discussion & Help
    Replies: 144
    Last Post: 09-05-2010, 03:46 AM
  3. Moongate Documentation
    By BlackNecro in forum Wiremod Addons & Coding
    Replies: 24
    Last Post: 04-22-2009, 01:32 AM
  4. CPU and High Speed Devices Help
    By Dimencia in forum CPU, GPU, and Hi-speed Discussion & Help
    Replies: 5
    Last Post: 08-04-2007, 02:13 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots