Monday, December 14, 2009

My first program

Entry # 100 - celebration? Anyway, ran into probably my first program ever. Machine code, for an MC6800 (6802, actually). Dates back to 1978 or 1979:

inadd: CLRB ; clear count
CLR,X
PUSH B ; count on stack
CLR 1,X
inadd3: BSR INHEX
BMI inadd1
LDB#4
inadd2: ASL 1,X
ROL,X
DEC B
BNE inadd2
PSHS A
ORA 1,X
STA 1,X
PULS A
INC,B ; count
LDB,S
CMPB#S
BNE inadd3
inadd1: LDB,S+ ; b=count0 + #hex counts
RTS

INHEX = INCHNP

It's a counter, that should be able to count over 256, if I recall correctly. Quite complicated when you only have 8 bits. The code may not even be correct, as pencil tends to fade, and recycled paper becomes yellowish brown. Not much contrast there.
Addition: I could try it of course, as I still own a Motorola MEK6800D2 kit...

No comments: