| | |
moving from memory to register
Please support our Assembly advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Sep 2007
Posts: 33
Reputation:
Solved Threads: 1
so, I want to avoid using int 21h and start working with BIOS level code. I'm trying to write something equivalent to int 21h, function 09h, using int 10h functions 09h, 03h, and 02h, except I want the reading to terminate when it reaches a 00h character, switch to green text when it reaches a 02h character, and switch back to normal when it reaches a 01h character.
Here is my code:
to use this I would set dx to the offset of the beginning of the string andthen call outp.
I'm getting the error that mov al,[dx] is an "illegal indexing mode," and that mov attrCUR,attrWHT and mov attrCUR,attrGRN are illegal memory references, although now that I look at it I can see exactly why. Anyways, how can I move the contents of the memory location in dx into the al register?
Also, I changed mov attrCUR,attrWHT to "mov attrCUR,[offset attrWHT]" and it said constant too large... how do I fix this?
help please...thanks in advance.
----edit----
fixed the mov attrCUR,attrWHT problem... just put the value into bl directly instead of using a memory location intermediate.
Here is my code:
asm Syntax (Toggle Plain Text)
outp proc push cx push ax push bx push dx xor cx,cx xor bx,bx nxchr: add dx,cx mov al,[dx] cmp al,00h jz stwrt cmp al,01h jnz skp01 mov attrCUR,attrWHT skp01: cmp al,02h jnz skp02 mov attrCUR,attrGRN skp02: mov ah,09h mov bl,attrCUR push cx xor cx,cx int 10h pop cx inc cx mov ah,03h int 10h inc dl mov ah,02h int 10h jmp nxchr stwrt: pop dx pop bx pop ax pop cx ret outp endp
to use this I would set dx to the offset of the beginning of the string andthen call outp.
I'm getting the error that mov al,[dx] is an "illegal indexing mode," and that mov attrCUR,attrWHT and mov attrCUR,attrGRN are illegal memory references, although now that I look at it I can see exactly why. Anyways, how can I move the contents of the memory location in dx into the al register?
Also, I changed mov attrCUR,attrWHT to "mov attrCUR,[offset attrWHT]" and it said constant too large... how do I fix this?
help please...thanks in advance.
----edit----
fixed the mov attrCUR,attrWHT problem... just put the value into bl directly instead of using a memory location intermediate.
Last edited by carson myers; Dec 11th, 2008 at 11:00 pm.
Firs of all what assembler are you using. The main problem is that you can not move a word to a byte. That is what you are trying to do when you do mov al, dx. Second, if dx is an offset you should be using si ( I am assuming this is a 16 bit program). As for you rsecond question, you can not move a value from one memory address to another. You must move it to a register and then to the second memory location. Hope this helps. I am fairly new to assembly myself so if I have stated something wrong I hope someone will correct me but I am pretty sure this is correct.
![]() |
Similar Threads
- Moving values (Assembly)
- memory management in wndows 2000 (Windows NT / 2000 / XP)
- SUB the contents of two arrays and move the result in a third array (Assembly)
- My HJT log. Ready for help!! (Viruses, Spyware and other Nasties)
Other Threads in the Assembly Forum
- Previous Thread: Need help if possible pls!!!
- Next Thread: bios level video instructions
Views: 1162 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for Assembly
3d 68hc11 6811 80386 :( adress array asm assembler assembly boot bootloader buffer compression cursor debug directory division docs dos draw emulator endtask error exceptions file int10h integer intel interrupt interrupts language loop newbie nohau osdevelopment print program range read remainder shape string text theory tsr x86





