From: Frank K. <fbk...@zy...> - 2009-08-09 18:08:31
|
zak100 wrote: > Hi, > I have changed the code but still I am getting garbage at kernel startup. I > have got the macro definition at the beginning but the iret code at the end. > I cant understand what ou mean by PIC. What do you say to a student who hasn't done the assigned reading, Zulfi? <http://www.arl.wustl.edu/~lockwood/class/cs306/books/artofasm/Chapter_17/CH17-3.html> explains what I mean by PIC - Programmable Interrupt Controller - the 8259 (or equivalent - I think modern hardware emulates this). Might as well go to the original of this: <http://homepage.mac.com/randyhyde/webster.cs.ucr.edu/www.artofasm.com/DOS/AoADosIndex.html> You may want to read the whole thing. > The new code is given below: > ;Printing test mesg at kernel startup > ;If I move macro at end , i get syntax error. > %macro install 1 > push ax > mov ax, 0 > mov word[%1*4],isr_add > mov word[%1*4+2],cs > pop ax > %endmacro What's this supposed to do? It appears to overwrite your code. Why have you tried to make it a macro, when it loads the same "isr_add", no matter what the parameter? > mov ax, 7E0H > mov ds,ax > mov es,ax > mov si, msg > > mov ah, 0Eh > mov bx, 7 > top: > lodsb > cmp al, 0 > jz blackhole1 > int 10h > jmp short top Are you seeing this message? If you aren't getting this far, it's useless to try to continue! > blackhole1:install 01ch; calling macro Okay... suppose we've got int 1Ch patched... > xor ax,ax; print the mesgA using int10h > mov ds,ax > mov es,ax Why???????? > mov si,msgA ; "our dear string" > mov bx,7 > mov ah,0Eh > msgloop: > lodsb > or al,al > jz end44 > int 10h ; since we're still in RM, we can use bios. > jmp msgloop I suppose you're going to print the time here? It'll still be 00:00, presumably... > end44: jmp end44 > > > > blackhole: > hlt > jmp blackhole > > msg db 'Welcome to the Kernel!', 0 > msgA db 'Total minutes elapsed since Kernel start is', 0AH, 0DH Is this supposed to be zero-terminated? > clkcounter db 0 > secs db 0 > mins db 0 > > > isr_add: > cli > inc byte [byte cs:clkcounter] > cmp byte [byte cs:clkcounter],18; if clkcounter is 18, it means 1 sec > jz handle_secs > sti > iret > handle_secs: > mov byte [byte cs:clkcounter],0 > inc byte [byte cs:secs] > cmp byte [byte cs:secs],60;if secs is 60, it means 1 min > jz handle_mins > sti > iret > handle_mins: > mov byte [byte cs:secs],0 > inc byte [byte cs:mins]; we are done, now print the number of minutes > elapsed > sti > iret > > times 0x200-($-$$) db 0 18.2 ticks/second != 18 ticks/second - close enough to see if your isr is working, I guess, but your clock is going to be wildly fast! > Kindly somebody plz help me with the above code. I'd have to "test" anything I'd suggest. Might take a while... Best, Frank |