Advertisement
Oldbitcollector

Boot Loader

Feb 4th, 2022
1,740
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Pretty Boot Loader
  2.  
  3. ; Include this in main file:
  4.  
  5. ;Boot loader
  6. !source "./libs/loader.asm"
  7. +start_at $1000
  8.  
  9.  
  10.  
  11.  
  12. ;source of loader.asm
  13.  
  14. ;Basic loader
  15.  
  16. ;Creates a macro that sets the program counter to BASIC, then
  17. ;puts "10 SYS <address>". Address is written in base 10 and
  18. ;assumes 5 digits, although it will work with 4. Finally, it
  19. ;sets the program counter to the given address to start the
  20. ;assembly.
  21. !macro start_at .address {
  22.   * = $0801 ;Set program counter to address of BASIC in memory.
  23.   !byte $0e,$08,$0a,$00,$9e,$20
  24.   !if .address >= 10000 { !byte 48 + ((.address / 10000) % 10) }
  25.   !if .address >=  1000 { !byte 48 + ((.address /  1000) % 10) }
  26.   !if .address >=   100 { !byte 48 + ((.address /   100) % 10) }
  27.   !if .address >=    10 { !byte 48 + ((.address /    10) % 10) }
  28.   !byte $30 + (.address % 10), $3a,$8f,$20,$4c,$45,$44,$47,$45,$52,$00, $00, $00
  29.   * = .address
  30. }
  31.  
  32. ;10 SYS ####:REM LEDGER
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement