141,6 → 141,8 |
align 8 |
sdsh_data: |
|
diff16 "sdsh_data : ",0,$ |
|
include 'fonts/sd_data.asm' |
|
sdsh_code: |
154,6 → 156,8 |
; then dl = single char to write |
; else edx= pointer to asciiz-string |
|
diff16 "draw_char : ",0,$ |
|
draw_char: |
; font test |
; bl=y; bh=x |
164,6 → 168,7 |
xor edi, edi |
mov ebp, edi |
|
|
sdsh_draw_char: |
; eax = left side X |
; ebx = bottom Y |
175,11 → 180,10 |
push ebp |
shl ebp, 4 |
add ebp, sdsh_data.info |
call ch_checkscreen |
jb .exit |
call ch_checkwin |
jc .exit |
xor ch, ch |
; call ch_checkscreen |
; jb .exit |
; call ch_checkwin |
; jc .exit |
mov edx, [ebp + 4] ; chartable addr |
mov cx, word[edx + ecx*2] ; tick info |
mov edx, ecx |
186,10 → 190,10 |
and ecx, 7 ; cl = number of ticks |
jz .blank |
shr edx, 4 ; offset in the chartable |
add edx, [sdsh_data.chars] ; edx -> the char's ticklist |
add edx, sdsh_data.chars ; edx -> the char's ticklist |
.next_tick: |
call parse_tick |
add edx, 4 |
add edx, 2 |
dec cl |
jnz .next_tick |
.blank: |
201,6 → 205,7 |
|
|
parse_tick: |
diff16 "parse_tick : ",0,$ |
; eax = left side X |
; ebx = bottom Y |
; edx ->tickinfo |
330,7 → 335,7 |
add dl, 8 |
.lntick.both: |
sub dl, 2 ; num_vertice = num_points - 2 |
and cl, 0x18 ; two rotation bits |
and cl, 0x18 ; two (lower) rotation bits |
shr cl, 3 |
mov esi, sdsh_data.blank |
.draw: |
350,6 → 355,7 |
ret |
|
|
diff16 "draw_tick : ",0,$ |
|
draw_tick: |
; eax = x-origin |
356,80 → 362,94 |
; ebx = y-origin |
; edi = 0x0RRGGBB |
; cl = direction (0..7) |
; dl = number of vertices (dl) |
; dl = number of vertice (dl) |
; esi -> tick bitfield |
|
pushad |
inc dl ; -- that's to count down to 0 |
call ch_putpixel ; the point of origin |
and ecx, 7 |
call [.moves + ecx*4] ; basic vector |
lea ebp, [.move000+ ecx*4] |
call ebp ; basic vector |
call ch_putpixel |
dec dl |
jz .done ; 2pix lines only |
mov esi, dword [esi] ; max 16 vertice bitfield limit |
and edx, 15 |
jz .done ; no vertex (2pix line) |
mov esi, dword [esi] ; 15 vertice will easily fit to 1dw |
xchg esi, edx |
.move_and_draw: |
mov ch, dl |
and ch, 3 |
jz .moved |
btc ecx, 8 |
dec ch |
jz .1 |
dec ch |
jz .2 |
.3: |
dec cl |
.1: |
dec cl ; right turns (1 and 3) |
and cl, 7 |
@@: btc ecx, 9 ; straight angle (3) ? |
jc .1 |
jmp .moved |
dec cl |
jmp .wipe_it |
.2: |
inc cl ; left turn (2) |
and cl, 7 |
btc ecx, 9 ; just to zero ah |
inc cl |
.wipe_it: |
and ecx, 7 |
.moved: |
call [.moves + ecx*4] ; go new way |
diff16 "moved : ",0,$ |
lea ebp, [.move000+ ecx*4] |
call ebp ; go new way |
call ch_putpixel |
shr edx, 2 |
dec esi |
jnz .move_and_draw |
diff16 "done : ",0,$ |
.done: |
popad |
ret |
|
; WARNING! The order matters! ------ |
align 4 |
diff16 "move000 : ",0,$ |
.move000: |
inc eax |
ret |
align 4 |
.move001: |
inc eax |
dec ebx |
ret |
align 4 |
.move010: |
dec ebx |
ret |
align 4 |
.move011: |
dec eax |
dec ebx |
ret |
align 4 |
.move100: |
dec eax |
ret |
align 4 |
.move101: |
dec eax |
inc ebx |
ret |
align 4 |
.move110: |
inc ebx |
ret |
|
align 4 |
diff10 "move111-move000 (must be 28!) : ",.move000,$ |
.move111: |
inc eax |
inc ebx |
ret |
|
align 4 |
.moves dd .move000, .move001, .move010, .move011, .move100, .move101, .move110, .move111 |
;) --------------- |
|
;) |
|
align 4 |
diff16 "checkscreen : ",0,$ |
ch_checkscreen: |
cmp [Screen_Max_X], eax |
jb .getout |
438,6 → 458,7 |
ret |
|
align 4 |
diff16 "checkwin : ",0,$ |
ch_checkwin: |
; eax = x coordinate |
; ebx = y coordinate |
472,6 → 493,7 |
ret |
|
align 4 |
diff16 "ch_putpix : ",0,$ |
ch_putpixel: |
; eax = x coordinate |
; ebx = y coordinate |