Skip to content

Commit a31413b

Browse files
authored
Merge pull request #20 from lindoran/main
Adding ASCII output for 6850 and Testing for the HB63C09
2 parents 726124e + a1821d4 commit a31413b

File tree

6 files changed

+732
-0
lines changed

6 files changed

+732
-0
lines changed

hb63c09/68b50.asm

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
; UART and control the routines are set up for the 6850
2+
; or 'like' such as the 6850 Wrapper in the HB63C09M.
3+
4+
USTAT EQU $A000 ; UART Status Register
5+
UDATA EQU $A001 ; UART Data Register
6+
7+
; Send CRLF to terminal
8+
CRLF: LDA #$0A ; Line feed
9+
BSR CHOUT
10+
LDA #$0D ; Carriage return
11+
BSR CHOUT
12+
RTS
13+
14+
; Map iterations to printable ASCII characters
15+
PLOT: LDA 6,S ; Load iteration count
16+
INCA ; Offset for gradient lookup
17+
LDY #PSUSHD ; Address of gradient table
18+
LDA A,Y ; Load corresponding ASCII shade
19+
; Fall through to `CHOUT`
20+
21+
CHOUT: PSHS A ; Save character in A
22+
WRWAIT: LDA USTAT ; Check UART status
23+
BITA #2 ; Ready to send?
24+
BEQ WRWAIT ; Wait until ready
25+
PULS A ; Restore character
26+
STA UDATA ; Send character
27+
RTS
28+
29+
30+
; 16 levels of pseudo-shades in 7-Bit ASCII (darkest to lightest)
31+
PSUSHD: FCB $23,$40,$25,$26,$58,$2A,$2B,$3D ; Darker characters
32+
FCB $2D,$7E,$3A,$2E,$2C,$60,$20,$20 ; Lighter characters

hb63c09/Makefile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Define variables
2+
ASM = hb-mand.asm
3+
LIST = hb-mand.lst
4+
OUTPUT = hb-mand.s19
5+
6+
# Define the lwasm command
7+
LZASM = lwasm
8+
9+
# Compilation rule
10+
all: $(OUTPUT)
11+
12+
$(OUTPUT): $(ASM)
13+
$(LZASM) -l$(LIST) -fsrec -o$(OUTPUT) -3 $(ASM)
14+
15+
# Clean rule
16+
clean:
17+
rm -f $(LIST) $(OUTPUT)

hb63c09/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
hb63c09m:
2+
3+
The HB63C09 Completes asembly in 261 miliseconds (.261 Seconds) I beleve that is faster than the most recent Agon Light test, under asembly.
4+
5+
Computer is clocked at 20Mhz and has a wait state for serial (which is the only video output) so once the graphics expansion is completed
6+
it will be interesting to see how much faster the test completes without the serial io wait state.
7+
8+
CPU SPECS:
9+
HD68C09 CPU running in native mode.
10+
system clock 20Mhz
11+
E strobe 5Mhz
12+
Serial output
13+
MRDY is sent on every IO request and is cleared by the IO Controller.
14+
15+
16+
I did not run the test without video output.
17+
18+
this code takes advantage of the speed tweeks avalible to the 6309 and uses the same maths in the ../6x09 directory that the Coco uses.

hb63c09/hb-mand.asm

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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

Comments
 (0)