Task

Draw a   cuboid   with relative dimensions of    2 × 3 × 4. 



The cuboid can be represented graphically, or in   ASCII art,   depending on the language capabilities.

To fulfill the criteria of being a cuboid, three faces must be visible.

Either static or rotational projection is acceptable for this task.



Related tasks
 draw a sphere
 draw a rotating cube
 write language name in 3D ASCII
 draw a Deathstar


      1                                  ;Assemble with: tasm, tlink /t
      2     0000                                 .model  tiny
      3     0000                                 .code
      4                                          .386
      5                                          org     100h
      6                                  ;assume: ax=0000h, bx=0000h, cx=00ff, and
      7                                  ; direction bit is clear (so di increments)
      8                                                                  ;                  ____
      9           =0050                  X0      equ     80              ;                 /   /|
     10           =0050                  Y0      equ     80              ;                /   / |
     11           =0050                  wide    equ     2*40            ;         X0,Y0 +---+  |
     12           =0064                  tall    equ     3*40*200/240    ;               |   |  |
     13           =0035                  deep    equ     4*40/3          ;               |   | /
     14                                                                  ;               |___|/
     15
     16     0100  B0 13                  start:  mov     al, 13h         ;set 320x200x8 graphic screen
     17     0102  CD 10                          int     10h
     18     0104  68 A000                        push    0A000h          ;point es to graphic memory segment
     19     0107  07                             pop     es
     20
     21                                  ;Draw front of cuboid using horizontal lines
     22     0108  B3 64                          mov     bl, tall
     23     010A  BF E150                        mov     di, X0+(Y0+tall)*320 ;set pen at lower-left corner
     24     010D  B0 04                          mov     al, 4           ;use red ink
     25     010F  B1 50                  dc10:   mov     cl, wide        ;draw horizontal line
     26     0111  F3> AA                         rep     stosb           ;es:[di++], al; cx--
     27     0113  81 EF 0190                     sub     di, wide+320    ;move up to start of next line
     28     0117  4B                             dec     bx              ;at top of face?
     29     0118  75 F5                          jne     dc10            ;loop if not
     30
     31     011A  B3 35                          mov     bl, deep
     32                                  ;Draw top using horizontal lines
     33     011C  B0 02                  dc20:   mov     al, 2           ;use green ink
     34     011E  B1 50                          mov     cl, wide        ;draw horizontal line
     35     0120  F3> AA                         rep     stosb           ;es:[di++], al; cx--
     36
     37                                  ;Draw side using vertical lines
     38     0122  B0 01                          mov     al, 1           ;use blue ink
     39     0124  B1 64                          mov     cl, tall        ;draw vertical line
     40     0126  AA                     dc30:   stosb                   ;es:[di++], al
     41     0127  81 C7 013F                     add     di, 320-1       ;move down a pixel
     42     012B  E2 F9                          loop    dc30
     43
     44     012D  81 EF 7E8F                     sub     di, wide+(tall+1)*320-1 ;move to start of next top line
     45     0131  4B                             dec     bx              ;at deep limit?
     46     0132  75 E8                          jne     dc20            ;loop if not
     47
     48     0134  CD 16                          int     16h             ;wait for keystroke (ah=0)
     49     0136  B8 0003                        mov     ax, 0003h       ;restore normal text-mode screen
     50     0139  CD 10                          int     10h
     51     013B  C3                             ret                     ;return to DOS
     52
     53                                          end     start
 