Lowlevel
Lowlevel => Lowlevel-Coding => Thema gestartet von: Coffee am 20. November 2006, 14:27
-
mhh... geht net.. aber sagt mal was ich falsch mache ich meine nicht inhaltliche fehler sondern am coden... und das loop am ende is nur testweie..
mov dx,378h
mov ax,0xAA
out dx,al
in ax,dx
cmp ax,0xAA
je LPT1_vorhanden
LPT1_nicht_vorhanden:
mov dx,278h
mov al,0xAA
out dx,al
in al,dx
cmp al,0xAA
je LPT2_vorhanden
LPT2_nicht_vorhanden:
mov dx,3BCh
mov al,0xAA
out dx,al
in al,dx
cmp al,0xAA
je LPT3_vorhanden
LPT3_nicht_vorhanden:
mov si,no_LPT
mov al,0x01
int 0x21
jmp LPT_ini_end
LPT1_vorhanden:
mov al,378h
mov si,LPT1_present
mov al,0x01
int 0x21
in al,379h
test al,00010000b
jnz LPT_offline
test al, 00100000b
jz LPT_no_Paper
test al, 00001000b
jz LPT_error
jmp LPT_ini_end
LPT2_vorhanden:
mov LPT_data_register, 278h
mov LPT_status_register, 279h
mov LPT_steuer_register, 27Ah
mov si, LPT2_present
mov al, 0x01
int 0x21
in al, 279h
test al, 00010000b
jnz LPT_offline
test al, 00100000b
jz LPT_no_Paper
test al, 00001000b
jz LPT_error
jmp LPT_ini_end
LPT3_vorhanden:
mov LPT_data_register, 3BCh
mov LPT_status_register, 3BDh
mov LPT_steuer_register, 3BEh
mov si, LPT1_present
mov al, 0x01
int 0x21
in al, 3BDh
test al, 00010000b
jnz LPT_offline
test al, 00100000b
jz LPT_no_Paper
test al, 00001000b
jz LPT_error
jmp LPT_ini_end
LPT_offline:
mov si, LPT_offline_msg
mov al, 0x01
int 0x21
jmp LPT_ini_end
LPT_no_Paper:
mov si, LPT_no_Paper_msg
mov al, 0x01
int 0x21
jmp LPT_ini_end
LPT_error:
mov si, LPT_error_msg
mov al, 0x01
int 0x21
LPT_ini_end:
mov si, LPT_ini_ready
mov al, 0x01
int 0x21
looping:
jmp looping
LPT_ini_ready db "LPT initialisiert",13,10,0
LPT_error_msg db "Error initalising LPT",13,10,0
LPT_no_Paper_msg db "Please refill paper in your LPT",13,10,0
LPT_offline_msg db "LPT offline",13,10,0
LPT1_present db "LPT1 present",13,10,0
LPT_data_register db 378h
LPT_status_register db 379h
LPT_steuer_register db 37Ah
LPT2_present db "LPT2 present",13,10,0
no_LPT db "No LPT found",13,10,0
-
Hm, also was du falsch codest, aber nix inhaltliches ... Mein Spezialgebiet!
Ich finde es sehr unelegant deutsche und englische Sprungmarkenbezeichner zu mischen. Auch Zahlen in Binärdarstellung finde ich sehr unübersichtlich, weil ich mich bei den vielen Nullen immer verzähle. Hexadezimaldarstellung ist imho mindestens genauso übersichtlich.
Ich kann mir vorstellen, dass dir dein Lehrer dafür Punkte abziehen könnte.
-
Es wäre zwar hilfreich wenn man eine genauere Fehler beschreibung zur ferfügung hätte aber folgende sachen sind mir so aufgefallen
; LPT1 Test
out dx,al
in ax,dx ; <-- weicht von restlichen LPT Tests ab (sonst al, nicht ax)
...
LPT1_vorhanden:
mov al,378h ; <--- 0x0378 ist zu groß für 8bit
mov si,LPT1_present
mov al,0x01 ; <--- wo für dann das obere(378h) ?
int 0x21
...
LPT2_vorhanden:
mov LPT_data_register, 278h ; <--- normal fehlt hier noch die Operanden größe (Word)
mov LPT_status_register, 279h ; "
mov LPT_steuer_register, 27Ah ; "
..
-
Hm, also was du falsch codest, aber nix inhaltliches ... Mein Spezialgebiet!
Das falsch coden? :P Nein, aber das war doch wirklich so klar: Den Jidder sieht man wochenlang nicht, aber wenn's mal was destruktives zu machen gibt, ist er zur Stelle. ;)
Du hättest mich aber trotzdem überraschen können, indem du zum Beispiel bemängelst, daß da nix kommentiert ist.
-
gut das war schonmal einiges.
jetzt zu den fehlern die nasm noch meldet:
LPT_ini.asm:38: error: invalid combination of opcode and operands
LPT_ini.asm:39: error: invalid combination of opcode and operands
LPT_ini.asm:40: error: invalid combination of opcode and operands
der code:
mov word LPT_data_register, 378h
mov word LPT_status_register, 379h
mov word LPT_steuer_register, 37Ah
LPT_ini.asm:45: warning: unsigned byte value exceeds bounds
der code:
in al,379h
und die fehler wiederholen sich dann bei den anderen lpt ports....
hier nochma der ganze source:
mov dx,378h
mov ax,0xAA
out dx,al
in ax,dx
cmp ax,0xAA
je LPT1_vorhanden
LPT1_nicht_vorhanden:
mov dx,278h
mov al,0xAA
out dx,al
in al,dx
cmp al,0xAA
je LPT2_vorhanden
LPT2_nicht_vorhanden:
mov dx,3BCh
mov al,0xAA
out dx,al
in al,dx
cmp al,0xAA
je LPT3_vorhanden
LPT3_nicht_vorhanden:
mov si,no_LPT
mov al,0x01
int 0x21
jmp LPT_ini_end
LPT1_vorhanden:
mov word LPT_data_register, 378h
mov word LPT_status_register, 379h
mov word LPT_steuer_register, 37Ah
mov si,LPT1_present
mov al,0x01
int 0x21
in al,379h
test ax,00010000b
jnz LPT_offline
test ax, 00100000b
jz LPT_no_Paper
test ax, 00001000b
jz LPT_error
jmp LPT_ini_end
LPT2_vorhanden:
mov word LPT_data_register, 278h
mov word LPT_status_register, 279h
mov word LPT_steuer_register, 27Ah
mov si, LPT2_present
mov al, 0x01
int 0x21
in al, 279h
test al, 00010000b
jnz LPT_offline
test al, 00100000b
jz LPT_no_Paper
test al, 00001000b
jz LPT_error
jmp LPT_ini_end
LPT3_vorhanden:
mov LPT_data_register, 3BCh
mov LPT_status_register, 3BDh
mov LPT_steuer_register, 3BEh
mov si, LPT1_present
mov al, 0x01
int 0x21
in al, 3BDh
test al, 00010000b
jnz LPT_offline
test al, 00100000b
jz LPT_no_Paper
test al, 00001000b
jz LPT_error
jmp LPT_ini_end
LPT_offline:
mov si, LPT_offline_msg
mov al, 0x01
int 0x21
jmp LPT_ini_end
LPT_no_Paper:
mov si, LPT_no_Paper_msg
mov al, 0x01
int 0x21
jmp LPT_ini_end
LPT_error:
mov si, LPT_error_msg
mov al, 0x01
int 0x21
LPT_ini_end:
mov si, LPT_ini_ready
mov al, 0x01
int 0x21
looping:
jmp looping
LPT_ini_ready db "LPT initialisiert",13,10,0
LPT_error_msg db "Error initalising LPT",13,10,0
LPT_no_Paper_msg db "Please refill paper in your LPT",13,10,0
LPT_offline_msg db "LPT offline",13,10,0
LPT1_present db "LPT1 present",13,10,0
LPT_data_register dw 378h
LPT_status_register dw 379h
LPT_steuer_register dw 37Ah
LPT2_present db "LPT2 present",13,10,0
no_LPT db "No LPT found",13,10,0
-
mov word [LPT_data_register], 378h
mov word [LPT_status_register], 379h
mov word [LPT_steuer_register], 37Ah
mov dx,379h
in al,dx
bitmaster
-
LPT_ini.asm:38: error: invalid combination of opcode and operands
LPT_ini.asm:39: error: invalid combination of opcode and operands
LPT_ini.asm:40: error: invalid combination of opcode and operands
der code:
mov word LPT_data_register, 378h
mov word LPT_status_register, 379h
mov word LPT_steuer_register, 37Ah
bei nasm muss man bei um variablen eckeicge klammern drum machen, also:
mov word [LPT_data_register], 378h
LPT_ini.asm:45: warning: unsigned byte value exceeds bounds
der code:
in al,379h
ich glaub auf port adressen über 0xff kann man nur mit hilfe des register dx zu greifen, also:
mov dx, 379h
in al, dx
EDIT: da war ich wider mal zu langsam :oops:
-
mkay danke.
es geht.
bei masm war das ohne eckige klammern oder?
-
Ja geht aber mit glaub ich fast auch^^
-
hat jemand ein tut wie man dann mit dem lpt druckt? bei toaster stehts ja nit drinne :roll: :roll:
-
Was für ein Drucker?
normalerweise textzeichen auf den Datenleitungen ausgeben, und dann mit CR LR (0x0d 0x0a) eine neue zeile einleiten. meistens wird erst dann gedurck, wenn der zeitenformschub besendet wird. FF FormFeed (glaub 0xff) Wie die daten jetzt genau rausgeschoben werden müssen, keine ahnung. dazu erfolgt auf den steuerleitungen die abhandlung. Data Ready, Printer Busy, Paper Empty, error, ....
Bei druckern, bei denen man unter windows mit copy bal.blu lpt1 was ausdrucken kann ohne erst gross mit net .... was einzurichten lollte die druckansteuerung ohne weiteres funktionieren. Mit den passenden ESC sequenzen, kann dann auch je nach drucker die Schriftart und deren formatierung gewechselt werden. ( z.B. Epson emulation )
Bei druckern wo sich nichts tut, oder nur sehr viel müll kommt, hat man ohne die passenden treiber leider verlohren, sogenante windows drucker, die die Druckaufbereitung im treiber und nicht im drucker machen, und vom prinzip her nur noch ein grosses bild blockweise auf den drucker übertragen. Meist die sehr günsigen drucker, da hir elektronikkosten gespart werden.
Farbig kann ich mal vorwegnehmen wird so einfach nicht realisierbar sein.
gruss
-
ne farbig wollet ich auch nich einfachnur text..
nur... is ja ganit so einfach..
aber naja. haste noch ein text sei es tutorial/spezifikation/...
-
Moin
http://www.longrange.net/ParallelPort/1284d12.pdf
auf seinte 23 ist der signalverlauf.
so wie ich das mal im kurtzúberflug gesehen hab.
Wenn busy nicht low, Daten anlegen, kurtz warten, danach strobe auf low, warten, strobe wieder auf eins und von vorne.
nAck auswertung hab ich jetzt keine ahnung, wird aber wohl bedeuten, das das zeichen,das gerade übertragen wurde nicht angenommen wurde und erneut übertragen werden muss.
gruss