mov ax,13h ; al =0x13 , ah = 0 int 10h ; set video mode 0x13 (320x200x8bit) mov bx,0a000h ; address a000:0000 == start of VGA memory mov ds,bx ; so set the data segment to be that xor cx,cx ; give me something to be 0 top_of_loop: mov al,[si] ; grab one byte from video memory inc ax ; increment the word, not the byte add al,ah ; and add any overflow to the value (clever part ;]) mov [si], al ; store it back in video ram inc si ; curpixel++ cmp si, 0fa00h ; curpixel != 64000 == 320 * 200 ? jnz top_of_loop ; if so, do the next pixel mov si,cx ; otherwise, reset curpixel jmp top_of_loop ; and start from top of screen
mov ax,13h ; al =0x13 , ah = 0 int 10h ; set video mode 0x13 (320x200x8bit) mov bx,0a000h ; address a000:0000 == start of VGA memory mov ds,bx ; so set the data segment to be that init_loop: xor si,si ; intialize the screen pointer top_of_loop: mov al,[si] ; grab one byte from video memory inc ax ; increment the word, not the byte.... add al,ah ; and add any overflow to the value (clever part ;]) mov [si], al ; store it back in video ram inc si ; curpixel++ cmp si, 0fa00h ; curpixel != 64000 == 320 * 200 ? jnz top_of_loop ; if so, do the next pixel jmp init_loop ; and start from top of screen
/* * You shouldn't expect this to actually work as C, but * it should give you a rough idea. */ setGraphicsMode(0x13); char *a000=address_at_start_of_16bit_segment(0xa000); while(1) // nearly forgot the important part { for(i=0;i<64000;i++) { ax[1]=a000[i]; ax++; // ax == (ah<<8)|al if al > 0xff, then al = 0, ah++ al=al+ah; a000[i]=al; } }
| 0| 1 2 3 0xff 0xff 0xff 0xff <- video memory SI=0x0000 mov al,[si] -> AX=0x00FF AH=0x00 AL=0xFF inc ax -> AX=0x0100 AH=0x01 AL=0x00 add al,ah -> AX=0x0101 mov [si],al inc si
0 | 1| 2 3 0x01 0xff 0xff 0xff SI=0x0001 mov al,[si] -> AX=0x01FF AH=0x01 AL=0xFF inc ax -> AX=0x0200 AH=0x02 AL=0x00 add al,ah -> AX=0x0202 mov [si],al inc si
0 1 | 2| 3 0x01 0x02 0xff 0xff SI=0x0002 mov al,[si] -> AX=0x00FF AH=0x00 AL=0xFF inc ax -> AX=0x0300 AH=0x03 AL=0x00 add al,ah -> AX=0x0303 mov [si],al inc si 0 1 2 | 3| 0x01 0x02 0x03 0xff
There are 31,328 total registered users.
[+] expand