+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: CPU Program:Can't move data in/out of the CPU via address bus and data ports.

  1. #1
    Wire Sofaking Squeakyneb's Avatar
    Join Date
    May 2008
    Posts
    558

    Default CPU Program:Can't move data in/out of the CPU via address bus and data ports.

    I am trying to learn to use the CPU, but it isnt working

    Code:
    start:
        jmp main
    
    calls:
        input:
            in eax,8
            in ebx,9
            ret
        output:
            out 0,eax
            out 1,ebx
            ret
    
    main:
        call input
        call output
        jmp main
    Address Bus Settings:
    Code:
    Address	Offset	Size
    1	0	8
    2	8	8
    3	16	8
    4	24	8
    I'm starting by taking input and sending it out to the display straight away. The displays are screens(the screens that display 2 numbers). Using a debugger, I can see that the data port I am using for input (wired to Add. bus memory2) is getting the numbers from the input device(a numpad, dupe attatched) but the data port linked to the displays (add.bus mem1) is staying at all zeros.

    Dupes attatched, images for those who don't want the dupes. BPU is Bennys Processing Unit, by the way. The other dupe is the numpad I made for it. Would have been smarter to use a wired numpad, but i already had that built.

    Thanks for the help everyone.
    Attached Thumbnails Attached Thumbnails CPU Program:Can't move data in/out of the CPU via address bus and data ports.-gm_flatgrass20080040.jpg   CPU Program:Can't move data in/out of the CPU via address bus and data ports.-gm_flatgrass20080042.jpg  
    Attached Files Attached Files
    Last edited by Squeakyneb; 01-28-2009 at 04:21 AM.

    Quote Originally Posted by Bull View Post
    I'm annoyed at having to use my keyboard when coding. Can someone please make voice-recognition so I can just talk?

  2. #2
    Wire Sofaking Whodunnit's Avatar
    Join Date
    Jan 2008
    Location
    New Zealand, Ackl
    Posts
    636

    Default Re: CPU Program:Can't move data in/out of the CPU via address bus and data ports.

    Why are you using address bus for this program? just link one data port to the address bus slot on the cpu.

    a single databus can be used for input and output...

    however, this should still be working , have you tried

    input:
    mov eax, port8;
    mov ebx,port9;
    ret
    output:
    mov port0, eax;
    mov port1, ebx;

    ret


    personally i would remove the "calls:" label and just have a comment.
    also try with semicolons after instructions.

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

    Default Re: CPU Program:Can't move data in/out of the CPU via address bus and data ports.

    Nah, it's okay to leave "calls" label. I like how your code looks like. Are you sure you wired address bus to IOBUS?
    I'm a wire-crazy person with a tail.

    Take a daily journey into my brain

    D2K5

  4. #4
    Wire Sofaking Squeakyneb's Avatar
    Join Date
    May 2008
    Posts
    558

    Default Re: CPU Program:Can't move data in/out of the CPU via address bus and data ports.

    Ok, I'll try those.

    I used the address bus because I plan on expanding on this contraption, so I am using the first data port for display, second for input, third and fourth in case I need them.

    EDIT:
    @BP:Thanks. I have the address bus wired to IOBUS.

    UPDATE:
    I got it working. New Code
    Code:
    start:
        jmp main
    
    calls:
        input:
            mov eax,port8
            mov ebx,port9
            ret
        output:
            mov port0,eax
            mov port1,ebx
            ret
    
    main:
        call input
        call output
        jmp main
    Why could I not use in and out??
    Last edited by Squeakyneb; 01-28-2009 at 04:42 AM.

    Quote Originally Posted by Bull View Post
    I'm annoyed at having to use my keyboard when coding. Can someone please make voice-recognition so I can just talk?

  5. #5
    Wire Sofaking Whodunnit's Avatar
    Join Date
    Jan 2008
    Location
    New Zealand, Ackl
    Posts
    636

    Default Re: CPU Program:Can't move data in/out of the CPU via address bus and data ports.

    maybe a failure for that syntax with more than one data port.

  6. #6
    Wire Sofaking Whodunnit's Avatar
    Join Date
    Jan 2008
    Location
    New Zealand, Ackl
    Posts
    636

    Default Re: CPU Program:Can't move data in/out of the CPU via address bus and data ports.

    swapping registers doesn't work because there is no opcode for it.

    I think whitespace is ignored by the assembler.

    Edit by l3ulletje:
    if ( this post != sense ) {
    It has been made to reply on a post I made without noticing the thread got replies.
    Therefore my post was total bullcrap, so I deleted that post again.
    } else {
    ignore this edit
    }
    Last edited by Bull; 01-28-2009 at 05:13 AM.

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

    Default Re: CPU Program:Can't move data in/out of the CPU via address bus and data ports.

    XCHG swaps two values or registers
    I'm a wire-crazy person with a tail.

    Take a daily journey into my brain

    D2K5

  8. #8
    Wire Sofaking Squeakyneb's Avatar
    Join Date
    May 2008
    Posts
    558

    Default Re: CPU Program:Can't move data in/out of the CPU via address bus and data ports.

    Why are we exchangeing values in registers? Am I missing something?

    How would I use a register in the port number?

    Code:
    mov eax,port#ebx
    Would that work?

    I am thinking of using a "Device Connection Initiation Protocol" or DCIP. In short, each devices last port (port7 for device 0, port15 for device 1 etc.) will be used to identify the device. CPU will regularly scan these ports and establish what device, if any, is present, and store the necessary data.

    So if there is a numpad on device 3 (ports 24-31) the CPU will store 3 numbers in memory: 111(code to identify start of device data) 1(device number for numpads)3(device number).

    When the program calls for a numpad it will search a specified section of memory for 111, then check if the next value is 1 (device is a numpad) and then gets the device number if it is a numpad.

    In short, I want to make hot-swappable devices.

    Any opinions?

    To use the device: (device number)*8+(device port)=(actual port). Device3 port2 would be 3*8+2=26. I think.

    Quote Originally Posted by Bull View Post
    I'm annoyed at having to use my keyboard when coding. Can someone please make voice-recognition so I can just talk?

  9. #9
    Wire Sofaking Fizyk's Avatar
    Join Date
    Jun 2008
    Location
    Łomianki, Poland
    Posts
    740
    Blog Entries
    1

    Default Re: CPU Program:Can't move data in/out of the CPU via address bus and data ports.

    "in" and "out" should work, I use them and everything is ok...
    If you want to use ports with numbers in registers, you need "in" and "out", or... you could use the negative address space. AFAIK, address -1 is port0 etc., so let's say you have port number in ebx:
    Code:
    out ebx,eax //should output eax to port ebx
    
    //should be equivalent to this:
    neg ebx
    dec ebx
    mov #ebx,eax

    My programs: BIOS - Alcyone - Calculator - Notepad - Movie Player
    My tutorials: applyTorque - Quaternions - PID controllers
    Some other things I made: FT Chip - RK4 Solar System

  10. #10
    Wire Sofaking Squeakyneb's Avatar
    Join Date
    May 2008
    Posts
    558

    Default Re: CPU Program:Can't move data in/out of the CPU via address bus and data ports.

    Negative numbers are port space? Sounds odd, but I suppose it makes sense, because I think that using positive numbers represents memory.

    EDIT:
    I'm trying to use variables, but its not working. I tried "alloc curpos" but when it hits that instruction it puts out error 2(end of program?). What's going on?
    Last edited by Squeakyneb; 01-28-2009 at 11:49 PM.

    Quote Originally Posted by Bull View Post
    I'm annoyed at having to use my keyboard when coding. Can someone please make voice-recognition so I can just talk?

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Keyboard & Data Ports
    By -=Fox=- in forum Installation and Malfunctions Support
    Replies: 5
    Last Post: 09-18-2008, 02:08 PM
  2. Data Plug & Data Port
    By Xandaros in forum Wiremod General Chat
    Replies: 0
    Last Post: 08-04-2008, 05:46 AM
  3. Replies: 3
    Last Post: 06-24-2008, 10:34 AM
  4. Wired Data Plate? Non persistant data transferrer?
    By cpf in forum Ideas & Suggestions
    Replies: 6
    Last Post: 12-01-2007, 11:23 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