; BAR.ASM: Zeichnet ein geflltes Rechteck im Grafik-Bildschirm ; ; Autor: Frank Riemenschneider ; ; Eingabe: AX = X-Koordinate (0-239) der oberen linken Ecke ; BX = Y-Koordinate (0-63) der oberen linken Ecke ; CX = X-Koordinate (0-233) der unteren rechten Ecke ; DX = Y-Koordinate (0-63) der unteren rechten Ecke ; ; Ausgabe: keine DATASEG XB1 dw ? ; X-Koordinate linke obere Ecke XB2 dw ? ; X-Koordinate rechte untere Ecke YB1 dw ? ; Y-Koordinate linke obere Ecke YB2 dw ? ; Y-Koordinate rechte untere Ecke CODESEG PROC AsmBlock push ax ; Alle Register retten, die nicht schnell push bx ; genug in den n„chsten Stack kommen push cx push dx push di mov [XB1], ax ; Koordinaten abspeichern mov [YB1], bx mov [XB2], cx mov [YB2], dx mov dx, [YB1] BlockLoop: call AsmLine ; oberste Linie zeichnen cmp bx, [YB2] ; Ende erreicht? je BlockExit ; Ja -> Beenden inc bx ; Start- und Endkoordinaten der Linie erh”hen inc dx jmp BlockLoop ; N„chste Linie zeichnen BlockExit: pop di pop dx pop cx pop bx pop ax ret ; Back home ENDP ; BAR.ASM: Regelt die Parameterbernahme von Turbo Pascal aus fr ; die ASMBLOCK-Routine in Turbo Assembler ; ; Eingabe: Parameter der Block-Funktion auf dem Stack ; Bar( Xol, Yol, Xru, Yru:WORD ); ; Ausgabe: keine CODESEG PROC Bar Xlo:WORD, Ylo:WORD, Xru:WORD, Yru:WORD PUBLIC Bar mov ax, [Xlo] ; Anfangs- und Endkoordinaten in die mov bx, [Ylo] ; entsprechenden Register bringen mov cx, [Xru] mov dx, [Yru] ; Koordinaten testen cmp ax, 0 ; XAnf < 0? jge BlockLab1 xor ax, ax BlockLab1: cmp ax, 239 ; XAnf > 239? jle BlockLab2 mov ax, 239 BlockLab2: cmp bx, 0 ; YAnf < 0? jge BlockLab3 xor bx, bx BlockLab3: cmp bx, 63 ; YAnf > 63? jle BlockLab4 mov bx, 63 BlockLab4: cmp cx, 0 ; XEnde < 0? jge BlockLab5 xor cx, cx BlockLab5: cmp cx, 239 ; XEnde > 239? jle BlockLab6 mov cx, 239 BlockLab6: cmp dx, 0 ; YEnde < 0? jge BlockLab7 xor dx, dx BlockLab7: cmp dx, 63 ; YEnde > 63? jle BlockLab8 mov dx, 63 BlockLab8: cmp ax, cx ; XAnf > XEnde? jle BlockLab9 xchg ax, cx BlockLab9: cmp bx, dx ; YAnf > YEnde? jle BlockLab10 xchg bx, dx BlockLab10: call AsmBlock ; Block-Routine aufrufen ret ; Back home ENDP