flat assembler
Message board for the users of flat assembler.
Index
> High Level Languages > Why the last loop doesn't start painting at 0,0 position? |
Author |
|
baldr 28 Feb 2014, 12:53
arcangel,
16400*4==65600, thus offset wraps around and overwrites 64 pixels at the beginning of window A. Use different color for indice[3] and you'll see it clearly. |
|||
28 Feb 2014, 12:53 |
|
arcangel 06 May 2014, 17:03
baldr wrote: arcangel, The bank is 65536 bytes... Code: { En el modo 640x480 el banco ocupa 16383 bytes, 4 subbancos de 0 a 16383 } {$M 8192,0,655360} uses crt; label loop0, loop1, exit; type pMemoria = ^memoria; (* Puntero a la memoria *) memoria = record (* Datos almacenados *) punto: array [0..16383] of byte; end; var indice: array [0..19] of pMemoria; (* Punteros a toda la memoria de video *) procedure ModoVESA64x48; begin asm; mov ah,$4f mov al,$2 mov bx,$101 int $10 end; end; PROCEDURE SetText; Begin; asm mov ax,0003h { Mueve 0003h al registro ax } int 10h { Llama a la interrupción 10h } end; End; procedure CambiaBancoVESA(banco:byte); begin asm; mov ah,$4f mov al,$5 xor bx,bx xor dh,dh mov dl,banco int $10 end; end; procedure refresca; var i,j: longint; begin CambiaBancoVESA(0); { primer banco 0 } i:=0; j:=0; repeat MEM[$A000:j]:=indice[0]^.punto[i]; inc(i); inc(j); until i = 16383; i:=0; repeat MEM[$A000:j]:=indice[1]^.punto[i]; inc(i); inc(j); until i = 16383; i:=0; repeat MEM[$A000:j]:=indice[2]^.punto[i]; inc(i); inc(j); until i = 16383; i:=0; repeat MEM[$A000:j]:=indice[3]^.punto[i]; inc(i); inc(j); until i = 16383; CambiaBancoVESA(1); { primer banco 1 } i:=0; j:=0; repeat MEM[$A000:j]:=indice[4]^.punto[i]; inc(i); inc(j); until i = 16383; i:=0; repeat MEM[$A000:j]:=indice[5]^.punto[i]; inc(i); inc(j); until i = 16383; i:=0; repeat MEM[$A000:j]:=indice[6]^.punto[i]; inc(i); inc(j); until i = 16383; i:=0; repeat MEM[$A000:j]:=indice[7]^.punto[i]; inc(i); inc(j); until i = 16383; CambiaBancoVESA(2); { primer banco 2 } i:=0; j:=0; repeat MEM[$A000:j]:=indice[8]^.punto[i]; inc(i); inc(j); until i = 16383; i:=0; repeat MEM[$A000:j]:=indice[9]^.punto[i]; inc(i); inc(j); until i = 16383; i:=0; repeat MEM[$A000:j]:=indice[10]^.punto[i]; inc(i); inc(j); until i = 16383; i:=0; repeat MEM[$A000:j]:=indice[11]^.punto[i]; inc(i); inc(j); until i = 16383; CambiaBancoVESA(3); { primer banco 3 } i:=0; j:=0; repeat MEM[$A000:j]:=indice[12]^.punto[i]; inc(i); inc(j); until i = 16383; i:=0; repeat MEM[$A000:j]:=indice[13]^.punto[i]; inc(i); inc(j); until i = 16383; i:=0; repeat MEM[$A000:j]:=indice[14]^.punto[i]; inc(i); inc(j); until i = 16383; i:=0; repeat MEM[$A000:j]:=indice[15]^.punto[i]; inc(i); inc(j); until i = 16383; CambiaBancoVESA(4); { primer banco 4 } i:=0; j:=0; repeat MEM[$A000:j]:=indice[16]^.punto[i]; inc(i); inc(j); until i = 16383; i:=0; repeat MEM[$A000:j]:=indice[17]^.punto[i]; inc(i); inc(j); until i = 16383; i:=0; repeat MEM[$A000:j]:=indice[18]^.punto[i]; inc(i); inc(j); until i = 16383; i:=0; repeat MEM[$A000:j]:=indice[19]^.punto[i]; inc(i); inc(j); until i = 16383; end; var i,j,x,y: longint; begin for i:=0 to 19 do new(indice[i]); ModoVESA64x48; for i:=0 to 16399 do indice[0]^.punto[i]:=2; for i:=0 to 16399 do indice[1]^.punto[i]:=2; for i:=0 to 16399 do indice[2]^.punto[i]:=2; for i:=0 to 16399 do indice[3]^.punto[i]:=2; refresca; readln; for i:=0 to 16399 do indice[0]^.punto[i]:=0; refresca; readln; SetText; end. baldr, Thank you very much |
|||
06 May 2014, 17:03 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.