|
|
|
![]() |
|
Strumenti |
![]() |
#1 |
Junior Member
Iscritto dal: Jul 2006
Città: Cittadino del Mondo
Messaggi: 5
|
[assembly]
hello!!
sorry ma avrei bisogno ancora di una mano ![]() Programmino assembly 8086 usando assembler TASM in DOS. Il fatto è questo: io ho un array che contiene dei numeri (che sono stati letti da tastiera) ad es: 1 2 3 4 e devo stamparlo ma in questa forma: 4x^3+3x^2+2x+1 come posso fare??? denghiu a tutti!!!
__________________
So...what do you fear?? A CAGE!! Canada (100% Born to be free)
|
![]() |
![]() |
![]() |
#2 |
Bannato
Iscritto dal: Feb 2003
Messaggi: 947
|
Codice:
N_INPUT_LEN EQU OFFSET _c_input_end - OFFSET _c_input_start data segment byte 'DATA' _char_num: DB 0h,'$' _x_pow: DB 'x^$' _plus: DB '+$' _c_input_start: DB 1d,2d,3d,4d _c_input_end: data ends .8086 .ALPHA code segment para use16 'CODE' assume cs:code Init proc near std mov ax,DATA mov ds,ax mov cx,N_INPUT_LEN - 1 mov si,OFFSET _c_input_end - 1 xor ah,ah loop_write_dt: lodsb call Write_Dec_Num mov dx,OFFSET _x_pow call Write_DOS_Message mov al,cl call Write_Dec_Num mov dx,OFFSET _plus call Write_DOS_Message loop loop_write_dt lodsb call Write_Dec_Num mov ax,4C00h int 21h init endp ;############################################################################# ; ; DS:[DX] = Offset write DOS string ; ;############################################################################# Write_DOS_Message proc near push ax push bx push cx push dx push di push si push bp mov ah,9h int 21h pop bp pop si pop di pop dx pop cx pop bx pop ax ret Write_DOS_Message endp ;############################################################################# ; ; AX = Write number ; ;############################################################################# Write_Dec_Num proc near push ax push cx push dx mov cx,100d loop_div: div cl or al,al jne write_char or ch,ch je end_of_div write_char: or ch,1h mov dx,OFFSET _char_num mov ds: byte ptr [_char_num],al add ds: byte ptr [_char_num],'0' call Write_DOS_Message end_of_div: mov dl,ah mov al,cl xor ah,ah mov cl,10d div cl mov cl,al mov al,dl xor ah,ah or cl,cl jne loop_div pop dx pop cx pop ax ret Write_Dec_Num endp code ends end init |
![]() |
![]() |
![]() |
Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 17:47.