;============================================================================== ;file :marble.asm ;author :Andre Long ;due :April 19, 2006 ;description :This program will use arrays to calulate prime numbers ;============================================================================== ;Procedures To INCLUDE Pcmac.inc ;macros EXTRN NEWLINE:FAR ;display a new line EXTRN GETDEC$:FAR ;gets 16-bit decimal number EXTRN PUTDEC$:FAR ;display 16-bit decimal number EXTRN PUTSTRNG:FAR ;display a string EXTRN xyPrime: FAR ;============================================================================== .MODEL SMALL .586 .STACK 1000h ;============================================================================== .DATA PUBLIC step maxcups EQU 499 cups DB 500 DUP (0) blank DB ' ', '$' step DW ? messtest1 DB 'made it!', '$' messtest2 DB 'Hello', '$' ;============================================================================== .CODE marble proc _Begin mov bx, 0 start: cmp bx, maxcups mov al, 1 jbe loopA jmp doneA loopA: mov [cups + bx], al inc bx jmp start doneA: mov bx, 0 mov ah, 0 startB: cmp bx, maxcups jbe loopB jmp doneB loopB: mov al, [cups + bx] ;call putdec$ inc bx jmp startB doneB: call newline setOutter: mov step, 2 startOuter: setInner: mov bx, 0 mov bx, step startInner: mov al, [cups + bx] call xyPrime mov [cups + bx], al add bx, step cmp bx, maxcups jbe startInner jmp continue continue: inc step cmp step, maxcups jbe startOuter jmp doneC doneC: mov bx, 0 startBB: ;THIS WERE THE ARRAY IS PRINTED OUT AFTER CHANGE ;cmp bx, maxcups ;jbe loopBB ;jmp doneBB loopBB: ;mov al, [cups + bx] ;mov ah, 0 ;push bx ;mov bx, 0 ;call putdec$ ;pop bx ;inc bx ;jmp startBB doneBB: mov bx, 0 call newline call newline outty: cmp bx, maxcups jbe o2 jmp E o2: mov al, [cups + bx] cmp al, 1 je prime jmp continueOutty continueOutty: inc bx jmp outty prime: push bx xchg ax, bx mov bh, -1 call putdec$ sPutStr blank pop bx xchg ax, bx inc bx jmp outty E: _Exit marble endp end marble