;Ram vars Cursor_X equ $00FF0000 ;Ram for X_position Cursor_Y equ $00FF0000+1 ;Ram for Y position ;Video Ports VDP_data equ $C00000 ;VDP data port R/W word or long access only VDP_ctrl equ $C00004 ;VDP control port word or longword writes only ;Header for fusion dc.l $FFFFFE00 ;Mem 4 STAK PTR dc.l ProgramStart ;start of prog dc.l 62,InterruptHandler ;62*InterruptHandler ds.b 256,0 ProgramStart: ;Set up screen lea VDPSettings,a5 ;init screen registers move.l #19,d1 ;number of settings move.w (VDP_ctrl),d0 ;C00004 read vdp status (intrrupt acknowledge?) move.l #00008000,d5 ;VDP Reg command ($8rvv) R=Reg V=new Value NextInitByte: move.b (a5)+,d5 ;get next video control byte move.w d5,(VDP_ctrl) ;c00004 senda write register command to VDP. 8RVV - R=Reg V=Value add.w #$0100,d5 ;point to next VDP register dbra d1,NextInitByte ;loop for rest of block ;Define palette (%----BBB-GGG-RRR-) move.l #$C0000000,VDP_ctrl ;Color 0 move.w #%0000011000000000,VDP_data move.l #$C0020000,VDP_ctrl ;Color 1 move.w #%0000000011191110,VDP_data ;Setup Font lea Font, a1 ; Font Address in ROM move.l #26*8*4,d6 ;our font contains 26 8 line 4 bytes per line move.l #$44200000,(VDP_ctrl) ;start writes to address $0420 ;patterns in vram NextFont: move.b (a1)+,d0 ;Get byte from font moveq.l #7,d5 ;bit count (eight bits) clr.l d1 ;Reset buildup byte Font_NextBit: ;1 color per nibble = 4 bytes rol.l #3,d1 ;shift buildup 3 bytes left roxl.b #1,d0 ;shift a bit from the 1bpp font into the pattern roxl.l #1,d1 ;shift bit into BuildUp dbra d5,Font_NextBit ;Next bit from font move.l d1,(VDP_data) ;vvrite next long of char to VDP_data (one line) dbra d6,NextFont ;loop untill done clr.w Cursor_X ;clear cursor xy move.w #$8144,(VDP_ctrl) ;turn on screen lea Message,a3 ;string to show jsr PrintString ;print string to screen jmp * ;infinite loop PrintChar: ;show d0 to screen and.l #%11011111,d0 ;convert to uppercase sub.l #32,d0 ;no characters in our font below 32 PrintCharAlt: move.l #$40000003,d5 ;top 4 = write, bottom $3=CXXX range (tile map) clr.l d4 move.b (Cursor_Y),d4 move.l #8+8+7,d1 rol.l d1,d4 add.l d4,d5 ;add 4------3 move.b (Cursor_X),d4 move.l #8+8+1,d1 rol.l d1,d4 add.l d4,d5 ;add 4------3 move.l d5,(VDP_ctrl) ;C00004 write next character to VDP move.w d0,(VDP_data) ;C00000 store next word of name data addq.b #1,(Cursor_X) ;inc Xposition rts PrintString: move.b (a3)+,d0 ;read a character from A3 cmp.b #255,d0 beq PrintString_Done ;return on 255 jsr PrintChar ;print the character bra PrintString PrintString_Done rts InterruptHandler: ;Basic interrupt handler rte Font: dc.b $18,$3C,$66,$66,$7E,$66,$24,$00 ;A dc.b $3C,$66,$66,$7C,$66,$66,$3C,$00 ;B dc.b $38,$7C,$C0,$C0,$C0,$7C,$38,$00 ;C dc.b $3C,$64,$66,$66,$66,$64,$38,$00 ;D dc.b $3C,$7E,$60,$78,$60,$7E,$3C,$00 ;E dc.b $38,$7C,$60,$78,$60,$60,$20,$00 ;F dc.b $3C,$66,$C0,$C0,$CC,$66,$3C,$00 ;G dc.b $24,$66,$66,$7E,$66,$66,$24,$00 ;H dc.b $10,$18,$18,$18,$18,$18,$08,$00 ;I dc.b $08,$0C,$0C,$0C,$4C,$FC,$78,$00 ;J dc.b $24,$66,$6C,$78,$6C,$66,$24,$00 ;K dc.b $20,$60,$60,$60,$60,$7E,$3E,$00 ;L dc.b $44,$EE,$FE,$D6,$D6,$D6,$44,$00 ;M dc.b $44,$E6,$F6,$DE,$CE,$C6,$44,$00 ;N dc.b $38,$6C,$C6,$C6,$C6,$6C,$38,$00 ;O dc.b $38,$6C,$64,$7C,$60,$60,$20,$00 ;P dc.b $38,$6C,$C6,$C6,$CA,$74,$3A,$00 ;Q dc.b $3C,$66,$66,$7C,$6C,$66,$26,$00 ;R dc.b $3C,$7E,$60,$3C,$06,$7E,$3C,$00 ;S dc.b $3C,$7E,$18,$18,$18,$18,$08,$00 ;T dc.b $24,$66,$66,$66,$66,$66,$3C,$00 ;U dc.b $24,$66,$66,$66,$66,$3C,$18,$00 ;V dc.b $44,$C6,$D6,$D6,$FE,$EE,$44,$00 ;W dc.b $C6,$6C,$38,$38,$6C,$C6,$44,$00 ;X dc.b $24,$66,$66,$3C,$18,$18,$08,$00 ;Y dc.b $7C,$FC,$0C,$18,$30,$7E,$7C,$00 ;Z VDPSettings: dc.b 4,4,$30,$3C,$07,$6C,0,0,0,0,$FF,0,$81,$37,0,2,1,0,0 Message: dc.b 'Hello World',255 even ;word align after byte data