Mercurial > hg > index.cgi
comparison src/print.s @ 80:bb50ac9fdf37
Checkpoint with very basic integer and floating point arithmetic, untested
This commit has implementations for floating point add, subtract, multiply,
and divide, along with 32 bit signed integer equivalents. These can probably
be optimized and they are untested.
author | William Astle <lost@l-w.ca> |
---|---|
date | Sat, 07 Oct 2023 02:56:59 -0600 |
parents | 5f8f0b0781e8 |
children | 663d8e77b579 |
comparison
equal
deleted
inserted
replaced
79:df86e6d64ce2 | 80:bb50ac9fdf37 |
---|---|
64 cmd_printint leas -12,s ; make a buffer | 64 cmd_printint leas -12,s ; make a buffer |
65 leay ,s ; point to buffer | 65 leay ,s ; point to buffer |
66 lda #0x20 ; default sign (positive) | 66 lda #0x20 ; default sign (positive) |
67 ldb val0+val.int ; is it negative? | 67 ldb val0+val.int ; is it negative? |
68 bpl cmd_printint0 ; brif not | 68 bpl cmd_printint0 ; brif not |
69 jsr val_negint32 ; negate the integer | 69 jsr int32_neg ; negate the integer |
70 lda #'- ; negative sign | 70 lda #'- ; negative sign |
71 cmd_printint0 sta ,y+ ; save sign | 71 cmd_printint0 sta ,y+ ; save sign |
72 ldu #cmd_printintpc ; point to positive constant table | 72 ldu #cmd_printintpc ; point to positive constant table |
73 ldx #10 ; there are 10 constants to process | 73 ldx #10 ; there are 10 constants to process |
74 ; subtraction loop - positive residue | 74 ; subtraction loop - positive residue |