This commit is contained in:
2019-04-01 20:22:55 +11:00
parent 381e5c2344
commit e1c4d0c334
3 changed files with 98 additions and 0 deletions

24
jacme/basic-boot.s Normal file
View File

@@ -0,0 +1,24 @@
; A BASIC booter, encodes `10 SYS <address>`.
; Macrofied from http://www.pouet.net/topic.php?which=6541
!macro start_at .address {
* = $0801
!byte $0c,$08,$00,$00,$9e
!if .address >= 10000 { !byte 48 + ((.address / 10000) % 10) }
!if .address >= 1000 { !byte 48 + ((.address / 1000) % 10) }
!if .address >= 100 { !byte 48 + ((.address / 100) % 10) }
!if .address >= 10 { !byte 48 + ((.address / 10) % 10) }
!byte $30 + (.address % 10), $00, $00, $00
* = .address
}
; A cooler example is to write
;
; 10 SYS <address>: REM <backspaces>Your comment
;
; When the user types LIST, he will just see
;
; 10 Your comment
;
; but still be able to run it.
; For this, see http://codebase64.org/doku.php?id=base:acme-macro-tut

18
jacme/constants.s Normal file
View File

@@ -0,0 +1,18 @@
stack = $0100
screen = $0400
rowlen = $28
bdcol = $D020
bgcol = $D021
inputa = $DC00
inputb = $DC01
ch1_freq_lo = $D400
ch1_freq_hi = $D401
ch1_duty_lo = $D402
ch1_duty_hi = $D403
ch1_ctl = $D404
ch1_env_ad = $D405
ch1_env_sr = $D406

56
jacme/jimmy.s Normal file
View File

@@ -0,0 +1,56 @@
!source "constants.s"
!source "basic-boot.s"
+start_at $0900
sei ; no interrupts pls
ldx #$00 ; Screen colours
stx bdcol
ldx #$08
stx bgcol
jsr $e544 ; clear screen
;lda < message ; print message
;pha
;lda > message
;pha
jsr print_string
;pla
;pla
ldx #$01 ; start triangle wave
ldy #$11
stx ch1_freq_hi
sty ch1_freq_lo
ldx #$11
stx ch1_ctl
.loop
inc bdcol
lda inputb ; Scans the keyboard buffer
cmp #$EF ; If user presses Space ($ef) then quit
bne .loop
ldx #$08 ; kill sound
stx ch1_ctl
rts
print_string:
;lda message
;sta PSL + 2
;lda > message
;sta PSL + 1
ldx #$00
PSL lda message, x
cmp #$0 ; return on null terminator
beq +
sta screen + rowlen, x
inx
jmp PSL
+ rts
message !scr "welcome to scat os", 0