From a2f4ad9179e915fe29459623ff93a7e7ec008d78 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Tue, 25 Oct 2022 20:52:46 -0400 Subject: Reorganize code, no more separate init segment. --- dla.s | 60 +++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/dla.s b/dla.s index 1d27cfb..2d96928 100644 --- a/dla.s +++ b/dla.s @@ -156,12 +156,12 @@ noteol: tax dex stx seedtype - rts + ;rts - xex_init init + ;xex_init init ;;;;; end of init segment - xex_org loadaddr + ;xex_org loadaddr main: ;;; start of main() lda #$90 sta COLOR2 @@ -369,7 +369,11 @@ notredo: bne keyloop ; ignore any other keystroke ;rts ; exit to DOS jmp COLDSV ; reboot +;;; End of main() +;;; Subroutine: saveimage +;;; Does exactly what it says on the tin: saves the image. +;;; For now, the filename is hardcoded and there's no error checking. saveimage: ldx #$10 lda #3 ; OPEN @@ -409,29 +413,6 @@ saveimage: diskerr: sty textbuf hang: jmp hang -; TODO: code to save image goes here. -;;; End of main() - -; screen codes for menu -menumsg: - .byte $00,$00,$00 ; 3 digits of minutes - .byte $00 ; 1 decimal point - .byte $00,$00 ; 2 digits fractional minutes - .byte $00 ; 1 the letter "m" - .byte $00,$00 ; 2 spaces - .byte 'S'-$20+$80 ; 1 - scrcode "ave " ; 3 - .byte 'R'-$20+$80 ; 1 - scrcode "edo " ; 4 - .byte 'E'-$20+$80 ; 1 - scrcode "xit?" ; 4 - .byte $80 ; 1 (cursor) - .byte $00,$00,$00 ; 3 (filler) -menulen = * - menumsg - -; filename for Save command -filename: .byte "D:DLA.IMG" -fnlen = *-filename+1 ;;; Subroutine: set_limits ;;; Sets the X/Y min/max limits based on circlesize @@ -653,6 +634,7 @@ oob: rts ;;; Subroutine: drawseed +;;; dispatch to appropriate seed subroutine drawseed: ldx seedtype lda seeds_h,x @@ -684,6 +666,7 @@ slnoop: rts seed_plus: + ; plus, made of two 20px lines intersecting in the center lda #$7f sta cursor_x lda #$55 @@ -707,6 +690,7 @@ slloop: rts seed_4pt: + ; four points, the corners of a 20px square lda #$75 sta cursor_x lda #$55 @@ -724,6 +708,28 @@ seed_4pt: ;;;;; end of executable code +; screen codes for menu +menumsg: + .byte $00,$00,$00 ; 3 digits of minutes + .byte $00 ; 1 decimal point + .byte $00,$00 ; 2 digits fractional minutes + .byte $00 ; 1 the letter "m" + .byte $00,$00 ; 2 spaces + .byte 'S'-$20+$80 ; 1 + scrcode "ave " ; 3 + .byte 'R'-$20+$80 ; 1 + scrcode "edo " ; 4 + .byte 'E'-$20+$80 ; 1 + scrcode "xit?" ; 4 + .byte $80 ; 1 (cursor) + .byte $00,$00,$00 ; 3 (filler) +menulen = * - menumsg - 1 + + ; filename for Save command +filename: .byte "D:DLA.IMG" +fnlen = *-filename+1 + + ; jump table for seed functions seeds_l: .byte <(seed_point-1),<(seed_plus-1),<(seed_4pt-1),<(seed_long-1) seeds_h: .byte >(seed_point-1),>(seed_plus-1),>(seed_4pt-1),>(seed_long-1) @@ -788,4 +794,4 @@ xmasks: .word dlist ;.out .sprintf("%d",* - dlist) - xex_run loadaddr + xex_run init -- cgit v1.2.3