Should I take the lack of responses to mean that nobody actually knows how to use high-speed devices with the CPU? Rather, nobody knows how to write and read to specific addresses in the CPU? >.<
Okay, I picked up CPU again after a long hiatus, and now everything's these brand new high speed things, and I am confused. I'm working on simply understanding it, and so far, no go. I wrote a program here to write a value from port0 to the RAM, and constantly loop (slowly) between every value of RAM, read it, and output it ... and of course reset itself if it goes past the RAM. Here's what I've got, and it seems that RAM is outputting 0's every time, that is, storing nothing.
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-spacere;overflow:auto'>jmp start;
alloc rwrite,0; // The RAM Write address
alloc temp,0; // Counter
alloc read,0; // Read address
start:
cpuid 1;
mov es,eax; // Stores 65536 or whatever that number
// into ES, so when I do ES:0, it will start in Ram slot 0
check:
add #temp,1;
cmp #temp,200;
jge counter; // Every time temp reaches 200, we increment read
mov port1,es:#read; // As far as I know
// This is the most effective way to read from an address
// But it could be wrong. I should use DS somewhere...
mov port2,ds:#read; // I tried this, also doesn't work correctly
mov port3,#rwrite; // Just for debugging, shows where the RAM's writing
cmp port0,es:#rwrite; // If it's the same number as the previous
je check; // Don't continue
// As a note, this way of 'reading' works, as does this comparison
// But reading values other than this one returns 0
add #rwrite,1; // Increment RAM address
mov es:#rwrite,port0; // Write value to it
jmp check;
counter: // Increments read, resets temp, and resets read if it's
//higher than the RAM address
mov #temp,0;
add #read,1;
cmp #read,#rwrite;
jl check;
mov #read,0;
jmp check;</div>
Right, well, commented for your pleasure.
So as you can see, I probably am reading and writing completely wrong, so if somone could walk me through that process, that would be awesome. Also, if I wanted to hook up a console screen and a RAM into one, how would I do that? As far as I know, I would set them both in an address BUS, with the size of Console at 2048, but then would I set the RAM's offset to 2048? And then would I just write to es:0 for the screen, and es:2048+ for the RAM?
Should I take the lack of responses to mean that nobody actually knows how to use high-speed devices with the CPU? Rather, nobody knows how to write and read to specific addresses in the CPU? >.<
Well, something that I noticed:
You say you store 65536 into ES (from EAX) but you don't set EAX to that value at any point in the code?start:
cpuid 1;
mov es,eax; // Stores 65536 or whatever that number
// into ES, so when I do ES:0, it will start in Ram slot 0[/b]
I've only done just one program for the cpu so far coz I just started learning the cpu day before last and I don't dare to test it now coz it's probably not working (among other things after the gmod update) adding to my frustration..![]()
Ah, well, the CPUID command automatically stores the result into EAX, in this case, 65536 (Or if it ever gets more built-in RAM, it'll use that value instead)
Try replacing:
withCode:mov port1,es:#read;
It might be ZASM that interprets your value wrong (it should be mov ...,es:##read, but thats not correct kinda)Code:mov esi,#read; mov port1,es:#esi;
Alright, thanks. The rest looks good, then?
Ah, well, I tested it, and I'm having problems, but I don't understand why. In another one I wrote, it stored them well enough to check the conditionals and didn't constantly increment the write values, but in this one ... it does increment constantly. But in the old one, the values never stayed when I went back to check them, and in this one, they just stay at 0, no matter how much I try to write and/or read from them. It's only odd because they both do the exact same thing, and I can't find any difference in the way they read and/or write values, down to which addresses I use (I started at 2048 for both, since I like to put a console screen in first...), and it's just ... bleh. I need to find you on the servers for some help, phoenix
Edit again: You know, I'm just going to go for a friends invitation![]()
Bookmarks