This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
salloc ;Struct Allocate | |
.block | |
lda offset | |
sta ptr ;Set lo addr byte | |
bne incoff | |
pha | |
lda #1 ;Alloc one page | |
jsr pgalloc | |
tay ;Page addr -> .Y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
moveptr .macro | |
ldy #\1 ;Set ptr offset | |
lda (ptr),y ;Load lo ptr byte | |
pha | |
iny | |
lda (ptr),y ;Load hi ptr byte | |
sta ptr+1 ;Save hi ptr byte | |
pla | |
sta ptr ;Save lo ptr byte | |
.endm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ptr = $fb | |
tptr = $fd | |
lptr = $71 | |
;.x .y pointer to filename string. | |
;ptr points to current menu entry struct | |
;tptr points to parsed file current line | |
load |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cr = $0d | |
parserow ldy #0 | |
lda (tptr),y ;Read first byte of | |
cmp #cr ;line. Chk for CR. | |
bne alloc | |
rts ;End Of Data | |
alloc jsr salloc ;ptr -> Empty Struct |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
headrow lda #0 | |
sta (tptr),y ;Terminate string | |
#incptr tptr ;Points to length | |
lda children ;Backup current | |
pha ;child count | |
lda (tptr),y ;Load child count | |
sec | |
sbc #$40 ;Shift a,x to 1,24 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;See Modifier Keys bit flags to under- | |
;stand these numbers. eg, " *^Q" | |
modlen .byte 0 ;Extra length for mods | |
modlens .byte 0,3,3,4,3,4,4,5 | |
actrow lda #0 | |
sta (ptr),y ;Terminate String | |
#incptr tptr ;Points to modkeys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nextnode ;Check if last sibling ptr is 0 | |
lda lptr+1 | |
bne chkchild | |
;Set this struct as the first | |
;child of its parent struct | |
#copyptr ptr,child | |
chkchild lda children |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rootpg .byte 0 | |
defpage .byte 0 | |
defpgcnt .byte 0 | |
;.x .y pointer to filename string. | |
mnuload ;Frees old memory. Allocs mem. | |
;Loads menu file and parses it. | |
.block | |
lda rootpg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
freemenu bne chkchild | |
lda ptr+1 | |
sta rootpg | |
beq menuend | |
ldy #1 ;Free 1 Page | |
jsr pgfree | |
chkchild ldy #childptr+1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;Module Code with table of pointer exports | |
;----------[ Input ]-------- | |
.include "io.s" | |
.include "colors.s" | |
.include "kernal.s" | |
* = $c7c4 |
OlderNewer