Special Feature: ColorForth Commentary COLOR.ASM: Screen NOTICE: This is a work in progress. Parts of my commentary are still very rough. However, I have it up on the web because even in this rough form it may be useful to ColorForth enthusiasts. Expect the contents of these files to change frequently. include gen.asm ; cce.asm pio.asm ati128.asm ati64.asm gen.asm yellow equ 0ffff00h cyan: dup_ mov eax, 0ffffh jmp color magenta: dup_ mov eax, 0ff00ffh jmp color silver: dup_ mov eax, 0c0c0c0h jmp color blue: dup_ mov eax, 4040ffh jmp color red: dup_ mov eax, 0ff0000h jmp color green: dup_ mov eax, 8000ff00h jmp color ;............................................................................. ; Refs: ; -- yellow: keyc, ww, nw1, actc, e, eout ; -- cyan: mw ; -- magenta: var, actv ; -- silver: none ; -- blue: none ; -- red: rw ; -- green: gw
history ;[Refs: echo_, right, keyboard] db 11 dup (0) echo_: ;[Refs: abort1, word1] push esi mov ecx, 11-1 lea edi, history lea esi, [1+edi] rep movsb pop esi mov history+11-1, al drop ret rep stosb: store al into [edi] ecx times -- therefore "right" just fills the "history" buffer (11 bytes) with zeroes. right: ;[Refs: x, word_] dup_ mov ecx, 11 lea edi, history xor eax, eax rep stosb drop ret down: ;[Refs: forth2] dup_ xor edx, edx mov ecx, ih div ecx mov eax, edx add edx, 3*10000h+8000h-ih+3 mov xy, edx zero: ;If TOS=0, set TOS and ZF to 1; otherwise set both to 0. ;[Refs: none] test eax, eax mov eax, 0 jnz @f inc eax @@: ret blank: ;Blanks the screen (draws a black box over the whole screen). ;[Refs: refresh] dup_ xor eax, eax mov xy, eax call color dup_ mov eax, hp dup_ mov eax, vp jmp box top: ;Sets cursor position to top-left corner. ;[Refs: text1] mov ecx, lm shl ecx, 16 ; Make offset from video-memory start to scanline. add ecx, 3 ; Add padding between left margin and first icon. mov xy, ecx mov xycr, ecx ret qcr: ;[Refs: emit] mov cx, word ptr xy+2 cmp cx, word ptr rm js @f cr: ;[Refs: forth2, keyboard, rw] mov ecx, lm shl ecx, 16 mov cx, word ptr xy add ecx, ih mov xy, ecx @@: ret Setting screen parameters lms: ;"lm" ;Set left margin. mov lm, eax drop ret rms: ;"rm" ;Set right margin. mov rm, eax drop ret at: ;Set screen position. mov word ptr xy, ax drop mov word ptr xy+2, ax drop ret pat: ;"+at" ;Set screen position relative to current position. add word ptr xy, ax drop add word ptr xy+2, ax drop ret ;............................................................................. ; Refs: ; -- lms: forth2 ; -- rms: forth2 ; -- at: forth2 ; -- pat: forth2 Octant octant: ;( -- ?? ) ?? ;[Refs: forth2] dup_ mov eax, 43h ; poly -last y+ x+ ;23h ; last y+ x+ mov edx, [4+esi] ; (if bit 31 in 2nd arg not set, return) test edx, edx jns @f neg edx ; (negate 2nd arg) mov [4+esi], edx xor al, 1 ; (toggle bit 0) @@: cmp edx, [esi] ; (cmp modified 2nd arg, 1st arg) jns @f ; (if edx - [esi] signed,) xor al, 4 ; (toggle bit 2) @@: ret Drawing the user interface ; keyboard eight: ;Prints one line of the keyboard "map" ;in the lower-right corner of the screen. ;[Refs: keyboard] add edi, 12 call four call space sub edi, 16 four: ;[Refs: eight] mov ecx, 4 four1: ;[Refs: four1, keyboard] push ecx dup_ xor eax, eax mov al, [4+edi] inc edi call emit pop ecx next four1 ret stack: ;(?)Retrieves items from stack and prints them one by one? ;[Refs: keyboard] mov edi, godd-4 @@: mov edx, god cmp [edx], edi jnc @f dup_ mov eax, [edi] sub edi, 4 call qdot jmp @b @@: ret keyboard: ;[Refs: forth2, type0] call text1 mov edi, board dup_ mov eax, keyc call color mov rm, hc*iw mov lm, hp-9*iw+3 mov xy, (hp-9*iw+3)*10000h+vp-4*ih+3 call eight call eight call eight call cr add xy, 4*iw*10000h mov edi, shift add edi, 4*4-4 mov ecx, 3 call four1 mov lm, 3 mov word ptr xy+2, 3 call stack mov word ptr xy+2, hp-(11+9)*iw+3 lea edi, history-4 mov ecx, 11 jmp four1 Check the index for other entries. |