|
| 1 | +;; asembly battle royal for the HB63C09M |
| 2 | +;; This simply resets the comptuer at the end of exicution, and should |
| 3 | +;; technically work on any homebrew computer with a serial MLM as long as |
| 4 | +;; there is a supported UART -- You should check the addresses in your |
| 5 | +;; source file for the UART to make shure they align with your architecture |
| 6 | + |
| 7 | +;; Load this into MON09 or ASSIST09 with 'L' command by pasteing the .S19 |
| 8 | +;; into the terminal. |
| 9 | + |
| 10 | +;; lets enable 6309 since the CPU is required for the architecture of the computer |
| 11 | +h6309 EQU 1 |
| 12 | +SWATCH EQU $A03D ; dumb stop watch routine |
| 13 | + ORG $1000 ; Jump to this location with G 1000 in MON09 or ASSIST9 |
| 14 | +CONFIG: |
| 15 | + ifdef h6309 |
| 16 | + LDMD #1 ; h6309 native mode |
| 17 | + endif |
| 18 | + |
| 19 | + LDA SWATCH ;should display "start" and start the debugger watch |
| 20 | +;; main loop |
| 21 | + LEAS -5,S ; Allocate 5 bytes on the stack |
| 22 | + CLR ,S ; Clear X (temp low byte) |
| 23 | + CLR 1,S ; Clear X (temp high byte) |
| 24 | + CLR 2,S ; Clear Y (temp low byte) |
| 25 | + CLR 3,S ; Clear Y (temp high byte) |
| 26 | + ; Dispite what mand_get says in mandelbrot.asm itterations is in 6,S |
| 27 | + |
| 28 | +loop: |
| 29 | + LBSR mand_get ; Compute Mandelbrot for current position |
| 30 | + LBSR PLOT ; Map result to a gradient character and send it to UART |
| 31 | + |
| 32 | + LDD ,S ; Load X register |
| 33 | + ADDD #1 ; Increment X |
| 34 | + STD ,S ; Save X back |
| 35 | + |
| 36 | + CMPD #MAND_WIDTH ; Check if X reached the width |
| 37 | + BNE loop ; If not, continue |
| 38 | + |
| 39 | + BSR CRLF ; Send CRLF to start a new line |
| 40 | + CLR ,S ; Reset X to 0 |
| 41 | + CLR 1,S |
| 42 | + |
| 43 | + LDD 2,S ; Load Y register |
| 44 | + ADDD #1 ; Increment Y |
| 45 | + STD 2,S ; Save Y back |
| 46 | + |
| 47 | + CMPD #MAND_HEIGHT ; Check if Y reached the height |
| 48 | + BNE loop ; If not, continue |
| 49 | + LEAS 5,S ; Deallocate stack |
| 50 | + |
| 51 | +DONE: |
| 52 | + LDA SWATCH ; should print the milliseconds delay. |
| 53 | + ifdef h6309 |
| 54 | + LDMD #0 ; h6809 emulation mode |
| 55 | + endif |
| 56 | + |
| 57 | + JMP [$FFFE] ; Jump to reset vector |
| 58 | + |
| 59 | +;; includes uart and multi-mandelbrot for 24 bit fp math for optimal results. |
| 60 | + |
| 61 | + INCLUDE "68b50.asm" |
| 62 | + |
| 63 | + |
| 64 | + INCLUDE "../6x09/mandelbrot24.asm" ; Include Mandelbrot and fixed-point routines |
0 commit comments