; Issue #75 test harness (original, test-only HuCARD image, NOT a BIOS). ; Runs ma_mul16u on CASES operand pairs from ma_mul16u_cases.inc (generated by the ; integration script) with D=1 on entry, so the routine must force binary mode itself. ; Result block at CPU $2200 (work RAM +$200), read by the host: ; +0 "DONE"; +4 P after the last call (D and I must be as on entry); ; +$100 + 4*i .. +$103 + 4*i: product of case i, little-endian (+2..+5 of the routine). .setcpu "huc6280" .import ma_mul16u .importzp ma_mul16u_zp RESULT = $2200 CASES = 64 .segment "STARTUP" reset: sei cld csh lda #$FF tam #$01 ; MPR0 = I/O lda #$F8 tam #$02 ; MPR1 = work RAM (zero page $2000, stack $2100) ldx #$FF txs sed ; D=1 for every call: routine must clear it ldy #0 ; Y = 4*case index; 4 INY per case, wraps to 0 after 64 @case: lda case_tab,y sta ma_mul16u_zp+0 lda case_tab+1,y sta ma_mul16u_zp+1 lda case_tab+2,y sta ma_mul16u_zp+2 lda case_tab+3,y sta ma_mul16u_zp+3 jsr ma_mul16u ; Y must survive for the store index to stay valid lda ma_mul16u_zp+2 sta RESULT+$100,y lda ma_mul16u_zp+3 sta RESULT+$101,y lda ma_mul16u_zp+4 sta RESULT+$102,y lda ma_mul16u_zp+5 sta RESULT+$103,y iny iny iny iny bne @case php pla sta RESULT+4 tii done_text, RESULT, 4 halt: bra halt done_text: .byte "DONE" .include "ma_mul16u_cases.inc" .segment "VECTORS" .word halt, halt, halt, halt, reset