home *** CD-ROM | disk | FTP | other *** search
- ; > plotline
-
- .CINCLUDE "h.ploth"
-
- a1 = 0
- a2 = 1
- a3 = 2
- a4 = 3
-
- v1 = 4
- v2 = 5
- v3 = 6
- v4 = 7
- v5 = 8
- v6 = 9
-
- sl = 10
- fp = 11
- ip = 12
- sp = 13
-
- lr = 14
- pc = 15
-
- .AREA WA$$code,.CODE,.READONLY
-
-
- ; extern void plot_line(int x0, int y0, int x1, int y1);
-
- x0 = a1
- y0 = a2
- x1 = a3
- y1 = a4
-
- dx = x1
- dy = y1
- yinc = v1
- d = v2
- m = v3
- j = x0
- e = y0
-
-
- v_screen_adr: .ADDRESS screen_adr
-
- plot_line::
- STMFD sp!, {v1-v6, sl, fp, lr}
-
- SUBS dx, x0, x1
- BPL line1
- SUB x0, x0, dx
- RSB dx, dx, #0
- MOV ip, y0
- MOV y0, y1
- MOV y1, ip
- line1:
- ADD x0, x0, #640
- MOV x0, x0, ASR #2
-
- SUBS dy, y1, y0
- MOV yinc, #160
- RSBPL yinc, yinc, #0
- RSBMI dy, dy, #0
- RSB y0, y0, #512
- MOV y0, y0, ASR #2
-
- LDR d, v_screen_adr
- LDR d, [d]
- ADD d, d, y0, LSL #7
- ADD d, d, y0, LSL #5
-
- CMP dy, dx
- BLT line_3
-
- ADD x0, x0, #1
- MOV ip, x0, LSR #3
- ADD d, d, ip, LSL #2
-
- MOV m, #0x80000007
- MVN ip, x0, LSL #2
- MOV m, m, ROR ip
-
- MVN e, dy, LSR #1
- ADD j, dy, #3
- MOV j, j, ASR #2
-
- ORR v4, m, m, ROR #8
-
- TST m, #0x000000FF
- BNE loopys
- loopy:
- LDR ip, [d]
- ORR ip, ip, v4
- BIC ip, ip, m, LSR #4
- STR ip, [d], yinc
- SUBS j, j, #1
- LDMMIFD sp!, {v1-v6, sl, fp, pc}^
- ADDS e, e, dx
- BLE loopy
-
- SUB e, e, dy
- MOV m, m, ROR #4
- MOVS v4, v4, ROR #4
- BCC loopy
- loopys:
- LDMDA d, {ip, lr}
- ORR lr, lr, m
- BIC lr, lr, m, LSR #4
- ORR lr, lr, m, LSR #8
- BIC ip, ip, m, LSL #28
- ORR ip, ip, m, LSL #24
- STMDA d, {ip, lr}
- SUBS j, j, #1
- LDMMIFD sp!, {v1-v6, sl, fp, pc}^
- ADD d, d, yinc
- ADDS e, e, dx
- BLE loopys
-
- SUB e, e, dy
- MOV v4, v4, ROR #4
- MOVS m, m, ROR #4
- SUBCS d, d, #4
- BCC loopys
- B loopy
-
- line_3:
- MOV ip, x0, LSR #3
- ADD d, d, ip, LSL #2
-
- MOV m, #0x80000007
- MVN ip, x0, LSL #2
- MOV m, m, ROR ip
-
- MVN e, dx, LSR #1
- ADD j, dx, #3
- MOV j, j, ASR #2
- LDR v4, [d, -yinc]
- LDR v5, [d]
- LDR v6, [d, yinc]
- loopx:
- ORR v4, v4, m
- BIC v5, v5, m
- ORR v6, v6, m
- SUBS j, j, #1
- BMI loopxr
- MOVS m, m, ROR #4
- BCS loopxs
- ADDS e, e, dy
- BLT loopx
-
- SUB e, e, dx
- STR v4, [d, -yinc]
- MOV v4, v5
- MOV v5, v6
- ADD d, d, yinc
- LDR v6, [d, yinc]
- B loopx
- loopxs:
- STR v4, [d, -yinc]
- STR v5, [d]
- STR v6, [d, yinc]
- SUB d, d, #4
- ADDS e, e, dy
- SUBGE e, e, dx
- ADDGE d, d, yinc
- LDR v4, [d, -yinc]
- LDR v5, [d]
- LDR v6, [d, yinc]
- B loopx
- loopxr:
- STR v4, [d, -yinc]
- STR v5, [d]
- STR v6, [d, yinc]
- LDMFD sp!, {v1-v6, sl, fp, pc}^
-