Selaa lähdekoodia

Working program

Nikola Kotur 6 kuukautta sitten
commit
442dedec8f
1 muutettua tiedostoa jossa 41 lisäystä ja 0 poistoa
  1. 41 0
      pr.asm

+ 41 - 0
pr.asm

@@ -0,0 +1,41 @@
+*=$0800 "BASIC Start"  
+        // location to put a 1 line basic program so we can just
+        // type run to execute the assembled program.
+        
+        // will just call assembled program at correct location
+        //    10 SYS (4096)
+
+        // These bytes are a one line basic program that will 
+        // do a sys call to assembly language portion of
+        // of the program which will be at $1000 or 4096 decimal
+        // basic line is: 
+        // 10 SYS (4096)
+        .byte $00                // first byte of basic should be a zero
+        .byte $0E, $08           // Forward address to next basic line
+        .byte $0A, $00           // this will be line 10 ($0A)
+        .byte $9E                // basic token for SYS
+        .byte $20, $28, $34, $30, $39, $36, $29 // ASCII for " (4096)"
+        .byte $00, $00, $00      // end of basic program (addr $080E from above)
+
+*=$1000 "Main Start"
+
+        ldx #$00
+        stx $d020               // Border color register
+        stx $d021               // Background color
+
+clear:  lda #$20                // spacebar screen code
+        sta $0400,x             // fill four areas of screen with 256 spacebar characters
+        sta $0500,x
+        sta $0600,x
+        sta $06e8,x
+        lda #$00                // set foreground to black in Color Ram 
+        sta $d800,x
+        sta $d900,x
+        sta $da00,x
+        sta $dae8,x
+        inx
+        bne clear               // bne = branch on not equal
+                                // did x turn to zero already? 
+                                // if yes -> stop loop
+                                // if no -> continue loop
+        rts