From 7029c8ca884e9fe7dbb5e6052df40f267c392edb Mon Sep 17 00:00:00 2001 From: netpipe Date: Tue, 6 Feb 2024 01:37:41 -0700 Subject: [PATCH] helloworld --- samples/cbm/Makefile | 4 +- samples/cbm/hello.s | 152 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 155 insertions(+), 1 deletion(-) create mode 100755 samples/cbm/hello.s diff --git a/samples/cbm/Makefile b/samples/cbm/Makefile index 03387a061..c50a7d95c 100644 --- a/samples/cbm/Makefile +++ b/samples/cbm/Makefile @@ -135,7 +135,9 @@ plasma: plasma.c $(CL) -t $(SYS) -O -o plasma -m plasma.map plasma.c nachtm: nachtm.c $(CL) -t $(SYS) -O -o nachtm -m nachtm.map nachtm.c - +hello: hello.s + #$(AS) '--cpu 6502' hello.s -o hello.obj -l hello.lst + $(CL) -t $(SYS) -C c64-asm.cfg -u __EXEHDR__ hello.s -o hello.prg # -------------------------------------------------------------------------- # Rule to make a CBM disk with all samples. Needs the c1541 program that comes # with the VICE emulator. diff --git a/samples/cbm/hello.s b/samples/cbm/hello.s new file mode 100755 index 000000000..93b1cdc47 --- /dev/null +++ b/samples/cbm/hello.s @@ -0,0 +1,152 @@ +;;https://www.lemon64.com/forum/viewtopic.php?t=33082 +.segment "CODE" +.macpack cbm +scrcode + ;; top of border is line 50, bottom of visible screen is line 250 +top = $32 +bottom = $fa +start: + ;; lower case char mode + lda #$06 + ora $d018 + sta $d018 + ldx #$00 +showms: + lda message,x ;setup message + ;; start the horrible case conversion routine + rol + rol + bcc ucase64 + rol + bcc ucase32 ;64 and 32 bit set + ror ;sub 96 from chr + ror + ror + sec + sbc #$60 + jmp caseok +ucase32: + ror +ucase64: + ror + ror +caseok: ; is it really all necessary! + sta $0400,x + inx + cpx #$28 + bne showms + + sei + lda #$7f + sta $dc0d ;block cia1 interrupts + sta $dd0d ;block cia2 interrupts + + lda #$01 + sta $d01a ;enable raster interrupts + + jsr setupraster1 + cli + rts + +raster1: + nop + nop + nop + nop + nop + nop + nop + nop + nop + lda #$00 + sta $d020 ;do some flashy border stuff + + lda #$01 + sta $d019 + + ;; setup the next raster point + sei + jsr colourwash + jsr setupraster2 + cli + jmp $ea31 ;call next interrupt + +raster2: + nop + nop + nop + nop + nop + nop + nop + nop + nop + lda #$02 + sta $d020 ;do some flashy border stuff + + lda #$01 + sta $d019 + + ;; setup the next raster point + sei + jsr setupraster1 + cli + jmp $ea31 ;call next interrupt + +setupraster1: + lda #raster1 + sta $0314 ;change the interrupt vector + stx $0315 + + ;; setup the raster point + ;; top + lda #$1b + sta $d011 + lda #top + sta $d012 ;interrupt at raster line 0 + rts + +setupraster2: + lda #raster2 + sta $0314 ;change the interrupt vector + stx $0315 + + ;; setup the raster point + ;; bottom + lda #$1b + sta $d011 + lda #bottom + sta $d012 ;interrupt at raster line 0 + rts + +colourwash: + lda colour+$00 + sta colour+$28 + ldx #$00 +cycle: + lda colour+$01,x + sta colour+$00,x + lda colour,x + sta $d800,x + inx + cpx #$28 + bne cycle + rts + +colour: ;colour data tables + .byte $09,$09,$02,$02,$08 + .byte $08,$0a,$0a,$0f,$0f + .byte $07,$07,$01,$01,$01 + .byte $01,$01,$01,$01,$01 + .byte $01,$01,$01,$01,$01 + .byte $01,$01,$01,$07,$07 + .byte $0f,$0f,$0a,$0a,$08 + .byte $08,$02,$02,$09,$09 + .byte $00,$00,$00,$00,$00 + +message: ;data for message + .byte " The C64 was made " + .byte "by Dr Rubbix !!!" + .byte " "