|
7 | 7 | ex_statement_name_table: |
8 | 8 | name_table_entry "GR" |
9 | 9 | : name_table_entry "TEXT" |
| 10 | +: name_table_entry "HOME" |
| 11 | +: name_table_entry "COLOR" |
| 12 | + JUMP pvm_expression |
| 13 | +: name_table_entry "PLOT" |
| 14 | + JUMP pvm_arg_2 |
| 15 | +: name_table_entry "HLIN" |
| 16 | + CALL pvm_arg_2 |
| 17 | + MATCH "AT" |
| 18 | + JUMP pvm_expression |
| 19 | +: name_table_entry "VLIN" |
| 20 | + CALL pvm_arg_2 |
| 21 | + MATCH "AT" |
| 22 | + JUMP pvm_expression |
10 | 23 | : name_table_end |
11 | 24 |
|
12 | 25 | ex_function_name_table: |
13 | 26 | name_table_entry "PDL" |
| 27 | +: name_table_entry "SCRN" |
14 | 28 | : name_table_end |
15 | 29 |
|
16 | 30 | .segment "XVEC" |
17 | 31 |
|
18 | 32 | ex_statement_vectors: |
19 | | - .word exec_gr-1 |
20 | | - .word exec_text-1 |
21 | | - |
| 33 | + .word SETGR-1 |
| 34 | + .word SETTXT-1 |
| 35 | + .word HOME-1 |
| 36 | + .word exec_color-1 |
| 37 | + .word exec_plot-1 |
| 38 | + .word exec_hlin-1 |
| 39 | + .word exec_vlin-1 |
| 40 | + |
22 | 41 | .code |
23 | 42 |
|
24 | | -exec_gr: |
25 | | - jsr SETGR |
26 | | - rts |
| 43 | +exec_color: |
| 44 | + jsr evaluate_expression |
| 45 | + jsr pop_int_fp0 ; Pop the color value |
| 46 | + jmp SETCOL |
| 47 | + |
| 48 | +exec_plot: |
| 49 | + jsr evaluate_argument_list |
| 50 | + jsr pop_int_fp0 ; Pop the Y value |
| 51 | + pha ; We'll move it into A later |
| 52 | + jsr pop_int_fp0 ; Pop the X value |
| 53 | + tay ; Move X into Y for PLOT |
| 54 | + pla ; Get back Y from stack into A |
| 55 | + jmp PLOT |
| 56 | + |
| 57 | +exec_hlin: |
| 58 | + jsr get_hlin_vlin_arguments |
| 59 | + jmp HLINE |
27 | 60 |
|
28 | | -exec_text: |
29 | | - jsr SETTXT |
| 61 | +exec_vlin: |
| 62 | + jsr get_hlin_vlin_arguments |
| 63 | + jmp VLINE |
| 64 | + |
| 65 | +get_hlin_vlin_arguments: |
| 66 | + jsr evaluate_argument_list ; Evaluate start and end |
| 67 | + inc line_pos ; Skip "AT" |
| 68 | + inc line_pos |
| 69 | + jsr evaluate_expression |
| 70 | + jsr pop_int_fp0 ; Get coordinate (Row for HLIN, Column for VLIN) |
| 71 | + pha ; Save on hardware stack |
| 72 | + jsr pop_int_fp0 ; Get end point (H2/V2) |
| 73 | + sta H2 |
| 74 | + sta V2 |
| 75 | + jsr pop_int_fp0 ; Get start point |
| 76 | + tay ; Start point into Y |
| 77 | + pla ; Coordinate into A |
30 | 78 | rts |
31 | 79 |
|
32 | 80 | .segment "XFUNC" |
33 | 81 |
|
34 | 82 | ex_function_table: |
35 | 83 | .word fun_pdl-1 |
36 | 84 | .byte 1 | PROLOG_POP_INT | EPILOG_PUSH_INT |
| 85 | + .word fun_scrn-1 |
| 86 | + .byte 2 | PROLOG_POP_INT | EPILOG_PUSH_INT |
37 | 87 |
|
38 | 88 | .code |
39 | 89 |
|
40 | 90 | fun_pdl: |
| 91 | + jsr pop_int_fp0 ; Get paddle index |
| 92 | + tax |
41 | 93 | jsr PREAD ; Returns result in Y |
42 | 94 | tya |
43 | 95 | ldx #0 |
44 | 96 | rts |
| 97 | + |
| 98 | +fun_scrn: |
| 99 | + jsr pop_int_fp0 ; Pop the Y value (second arg) |
| 100 | + pha ; Save it |
| 101 | + jsr pop_int_fp0 ; Pop the X value (first arg) |
| 102 | + tay ; Move X into Y |
| 103 | + pla ; Get back Y into A |
| 104 | + jsr SCRN |
| 105 | + ldx #0 ; Make sure high byte is 0 |
| 106 | + rts |
0 commit comments