|
| 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 | +;; lets enable 6309 since the CPU is required for the architecture of the computer |
| 8 | +h6309 EQU 1 |
| 9 | + |
| 10 | + ORG $1000 |
| 11 | + |
| 12 | + ifdef h6309 |
| 13 | + ldmd #1 ; h6309 native mode |
| 14 | + endif |
| 15 | + |
| 16 | +;; main loop |
| 17 | + LEAS -5,S ; Allocate 5 bytes on the stack |
| 18 | + CLR ,S ; Clear X (temp low byte) |
| 19 | + CLR 1,S ; Clear X (temp high byte) |
| 20 | + CLR 2,S ; Clear Y (temp low byte) |
| 21 | + CLR 3,S ; Clear Y (temp high byte) |
| 22 | + ; Dispite what mand_get says in mandelbrot.asm itterations is in 6,S |
| 23 | + |
| 24 | +loop: |
| 25 | + LBSR mand_get ; Compute Mandelbrot for current position |
| 26 | + LBSR PLOT ; Map result to a gradient character and send it to UART |
| 27 | + |
| 28 | + LDD ,S ; Load X register |
| 29 | + ADDD #1 ; Increment X |
| 30 | + STD ,S ; Save X back |
| 31 | + |
| 32 | + CMPD #MAND_WIDTH ; Check if X reached the width |
| 33 | + BNE loop ; If not, continue |
| 34 | + |
| 35 | + BSR CRLF ; Send CRLF to start a new line |
| 36 | + CLR ,S ; Reset X to 0 |
| 37 | + CLR 1,S |
| 38 | + |
| 39 | + LDD 2,S ; Load Y register |
| 40 | + ADDD #1 ; Increment Y |
| 41 | + STD 2,S ; Save Y back |
| 42 | + |
| 43 | + CMPD #MAND_HEIGHT ; Check if Y reached the height |
| 44 | + BNE loop ; If not, continue |
| 45 | + LEAS 5,S ; Deallocate stack |
| 46 | + |
| 47 | + |
| 48 | + ifdef h6309 |
| 49 | + ldmd #0 ; h6809 emulation mode |
| 50 | + endif |
| 51 | + |
| 52 | + JMP [$FFFE] ; Jump to reset vector |
| 53 | + |
| 54 | +;; includes |
| 55 | + INCLUDE "68b50.asm" |
| 56 | + |
| 57 | + |
| 58 | + INCLUDE "../6x09/mandelbrot24.asm" ; Include Mandelbrot and fixed-point routines |
0 commit comments